ThatGerber/dfp-ads

View on GitHub
widget/widget.ad_position.php

Summary

Maintainability
A
0 mins
Test Coverage

Each class must be in a namespace of at least one level (a top-level vendor name)
Open

class DFP_Ads_Widget extends WP_Widget {

Expected 0 spaces between opening bracket and argument "$args"; 1 found
Open

    public function widget( $args, $instance ) {

Expected 0 spaces between argument "$instance" and closing bracket; 1 found
Open

    public function form( $instance ) {

Opening brace of a class must be on the line after the definition
Open

class DFP_Ads_Widget extends WP_Widget {

Expected 0 spaces between argument "$instance" and closing bracket; 1 found
Open

    public function widget( $args, $instance ) {

Expected 0 spaces between opening bracket and argument "$instance"; 1 found
Open

    public function form( $instance ) {

Expected 0 spaces between argument "$old_instance" and closing bracket; 1 found
Open

    public function update( $new_instance, $old_instance ) {

Space found before closing bracket of FOREACH loop
Open

        foreach ( $this->fields as $field ) {

Expected 0 spaces between opening bracket and argument "$new_instance"; 1 found
Open

    public function update( $new_instance, $old_instance ) {

The closing brace for the class must go on the next line after the body
Open

}

Expected 0 spaces before closing bracket; 1 found
Open

        foreach ( $this->fields as $field ) {

Method name "DFP_Ads_Widget::flush_widget_cache" is not in camel caps format
Open

    public function flush_widget_cache() {

Space found after opening bracket of FOREACH loop
Open

        foreach ( $this->fields as $field ) {

Method name "DFP_Ads_Widget::get_widget_slug" is not in camel caps format
Open

    public function get_widget_slug() {

Spaces must be used to indent lines; tabs are not allowed
Open

        add_action( 'switch_theme', array( $this, 'flush_widget_cache' ) );

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

     * Holds the fields that will be added to the widget form

Spaces must be used to indent lines; tabs are not allowed
Open

     * @access protected

Spaces must be used to indent lines; tabs are not allowed
Open

    protected $fields = array(

Spaces must be used to indent lines; tabs are not allowed
Open

        parent::__construct(

Spaces must be used to indent lines; tabs are not allowed
Open

                'classname'   => $this->get_widget_slug() . '-class',

Spaces must be used to indent lines; tabs are not allowed
Open

     * @since  0.0.1

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

    public function widget( $args, $instance ) {

Spaces must be used to indent lines; tabs are not allowed
Open

     * The variable name is used as the text domain when internationalizing strings

Spaces must be used to indent lines; tabs are not allowed
Open

     * @var      string

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

     * @var      array

Spaces must be used to indent lines; tabs are not allowed
Open

            __( 'DFP Ad Position', $this->get_widget_slug() ),

Spaces must be used to indent lines; tabs are not allowed
Open

                'description' => __( 'Displays an ad position', $this->get_widget_slug() )

Spaces must be used to indent lines; tabs are not allowed
Open

        );

Spaces must be used to indent lines; tabs are not allowed
Open

        echo $args['before_widget'];

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param array instance The array of keys and values for the widget.

Spaces must be used to indent lines; tabs are not allowed
Open

        <p>

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

    );

Spaces must be used to indent lines; tabs are not allowed
Open

     * loads localization files, and includes necessary stylesheets and JavaScript.

Spaces must be used to indent lines; tabs are not allowed
Open

        // Refreshing the widget's cached output with each new post

Spaces must be used to indent lines; tabs are not allowed
Open

     * Specifies the class name and description, instantiates the widget,

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

    public function __construct() {

Spaces must be used to indent lines; tabs are not allowed
Open

            array(

Spaces must be used to indent lines; tabs are not allowed
Open

        add_action( 'deleted_post', array( $this, 'flush_widget_cache' ) );

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return mixed

Spaces must be used to indent lines; tabs are not allowed
Open

        <?php

Spaces must be used to indent lines; tabs are not allowed
Open

     * of text. Its value should match the Text Domain file header in the main

Spaces must be used to indent lines; tabs are not allowed
Open

     * Outputs the content of the widget.

Spaces must be used to indent lines; tabs are not allowed
Open

        dfp_ad_position( $instance['position_title'] );

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

     * @since  0.0.1

Spaces must be used to indent lines; tabs are not allowed
Open

        $id    = ( $this->get_field_id( 'position_title' ) !== null ? $this->get_field_id( 'position_title' ) : '' );

Spaces must be used to indent lines; tabs are not allowed
Open

            <select class="widefat" name="<?php _e( $name ); ?>" id="<?php _e( $id ); ?>">

Spaces must be used to indent lines; tabs are not allowed
Open

                <?php dfp_ad_select_options( $value ); ?>

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param array old_instance The previous instance of values before the update.

Spaces must be used to indent lines; tabs are not allowed
Open

     * widget file.

Spaces must be used to indent lines; tabs are not allowed
Open

     * @access protected

Spaces must be used to indent lines; tabs are not allowed
Open

     * @since  0.0.1

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

        echo $args['after_widget'];

Spaces must be used to indent lines; tabs are not allowed
Open

     * Generates the administration form for the widget.

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

            </select>

Spaces must be used to indent lines; tabs are not allowed
Open

        </p>

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

    protected $widget_slug = 'dfp-ad-widget';

Spaces must be used to indent lines; tabs are not allowed
Open

        'position_title'

Spaces must be used to indent lines; tabs are not allowed
Open

            $this->get_widget_slug(),

Spaces must be used to indent lines; tabs are not allowed
Open

        add_action( 'save_post', array( $this, 'flush_widget_cache' ) );

Spaces must be used to indent lines; tabs are not allowed
Open

     * Unique identifier for your widget.

Spaces must be used to indent lines; tabs are not allowed
Open

     * PHP5 Constructor

Spaces must be used to indent lines; tabs are not allowed
Open

            )

Spaces must be used to indent lines; tabs are not allowed
Open

     * @since  0.0.1

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param array $args     The array of form elements

Spaces must be used to indent lines; tabs are not allowed
Open

     * @access public

Line exceeds 120 characters; contains 121 characters
Open

        $name  = ( $this->get_field_name( 'position_title' ) !== null ? $this->get_field_name( 'position_title' ) : '' );

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

     * @since  0.0.1

Spaces must be used to indent lines; tabs are not allowed
Open

     * Widget form fields

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

     * @since  0.0.1

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

        ?>

Spaces must be used to indent lines; tabs are not allowed
Open

        <h4><label for="<?php _e( $id ); ?>"><?php _e( 'Ad Position', 'dfp-ads' ); ?></label></h4>

Spaces must be used to indent lines; tabs are not allowed
Open

     * Processes the widget's options to be saved.

Spaces must be used to indent lines; tabs are not allowed
Open

     * @access public

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

     * @access public

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param array $instance The current instance of the widget

Spaces must be used to indent lines; tabs are not allowed
Open

     * @access public

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

    public function form( $instance ) {

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

     * @param array new_instance The new instance of values to be generated via the update.

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

        $value = ( isset( $instance['position_title'] ) ? $instance['position_title'] : '' );

Spaces must be used to indent lines; tabs are not allowed
Open

        $name  = ( $this->get_field_name( 'position_title' ) !== null ? $this->get_field_name( 'position_title' ) : '' );

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

     * @access public

Spaces must be used to indent lines; tabs are not allowed
Open

            $instance[ $field ] = $new_instance[ $field ];

Spaces must be used to indent lines; tabs are not allowed
Open

        return $instance;

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return string Plugin slug variable.

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

     * @access public

Spaces must be used to indent lines; tabs are not allowed
Open

     * Return the widget slug.

Spaces must be used to indent lines; tabs are not allowed
Open

     * Flushes the cache

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

        wp_cache_delete( $this->get_widget_slug(), 'widget' );

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

     * @since  0.0.1

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

    public function get_widget_slug() {

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

     */

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

    /**

Spaces must be used to indent lines; tabs are not allowed
Open

     *

Spaces must be used to indent lines; tabs are not allowed
Open

        foreach ( $this->fields as $field ) {

Spaces must be used to indent lines; tabs are not allowed
Open

        }

Spaces must be used to indent lines; tabs are not allowed
Open

    }

Spaces must be used to indent lines; tabs are not allowed
Open

     * @since  0.0.1

Spaces must be used to indent lines; tabs are not allowed
Open

    public function flush_widget_cache() {

Spaces must be used to indent lines; tabs are not allowed
Open

     * @return array

Spaces must be used to indent lines; tabs are not allowed
Open

    public function update( $new_instance, $old_instance ) {

Spaces must be used to indent lines; tabs are not allowed
Open

        return $this->widget_slug;

Expected 0 spaces before closing bracket; 1 found
Open

                'description' => __( 'Displays an ad position', $this->get_widget_slug() )

Expected 0 spaces before closing bracket; 1 found
Open

        add_action( 'save_post', array( $this, 'flush_widget_cache' ) );

Space after opening parenthesis of function call prohibited
Open

        $id    = ( $this->get_field_id( 'position_title' ) !== null ? $this->get_field_id( 'position_title' ) : '' );

Space after opening parenthesis of function call prohibited
Open

        $name  = ( $this->get_field_name( 'position_title' ) !== null ? $this->get_field_name( 'position_title' ) : '' );

Space after opening parenthesis of function call prohibited
Open

            <select class="widefat" name="<?php _e( $name ); ?>" id="<?php _e( $id ); ?>">

Expected 0 spaces before closing bracket; 1 found
Open

                <?php dfp_ad_select_options( $value ); ?>

Expected 0 spaces before closing bracket; 1 found
Open

            __( 'DFP Ad Position', $this->get_widget_slug() ),

Expected 0 spaces before closing bracket; 1 found
Open

        $value = ( isset( $instance['position_title'] ) ? $instance['position_title'] : '' );

Space after opening parenthesis of function call prohibited
Open

        <h4><label for="<?php _e( $id ); ?>"><?php _e( 'Ad Position', 'dfp-ads' ); ?></label></h4>

Expected 0 spaces before closing bracket; 1 found
Open

        $id    = ( $this->get_field_id( 'position_title' ) !== null ? $this->get_field_id( 'position_title' ) : '' );

Space after opening parenthesis of function call prohibited
Open

        $value = ( isset( $instance['position_title'] ) ? $instance['position_title'] : '' );

Space after opening parenthesis of function call prohibited
Open

        add_action( 'switch_theme', array( $this, 'flush_widget_cache' ) );

Opening brace should be on a new line
Open

    public function widget( $args, $instance ) {

Space after opening parenthesis of function call prohibited
Open

        dfp_ad_position( $instance['position_title'] );

Expected 0 spaces before closing bracket; 1 found
Open

            <select class="widefat" name="<?php _e( $name ); ?>" id="<?php _e( $id ); ?>">

Expected 0 spaces before closing bracket; 1 found
Open

        add_action( 'deleted_post', array( $this, 'flush_widget_cache' ) );

Expected 0 spaces before closing bracket; 1 found
Open

        <h4><label for="<?php _e( $id ); ?>"><?php _e( 'Ad Position', 'dfp-ads' ); ?></label></h4>

Expected 0 spaces before closing bracket; 1 found
Open

            <select class="widefat" name="<?php _e( $name ); ?>" id="<?php _e( $id ); ?>">

Class name "DFP_Ads_Widget" is not in camel caps format
Open

class DFP_Ads_Widget extends WP_Widget {

Space after opening parenthesis of function call prohibited
Open

        add_action( 'save_post', array( $this, 'flush_widget_cache' ) );

Expected 0 spaces before closing bracket; 1 found
Open

        add_action( 'switch_theme', array( $this, 'flush_widget_cache' ) );

Expected 0 spaces before closing bracket; 1 found
Open

        <h4><label for="<?php _e( $id ); ?>"><?php _e( 'Ad Position', 'dfp-ads' ); ?></label></h4>

Space after opening parenthesis of function call prohibited
Open

        add_action( 'deleted_post', array( $this, 'flush_widget_cache' ) );

Opening brace should be on a new line
Open

    public function form( $instance ) {

Space after opening parenthesis of function call prohibited
Open

            <select class="widefat" name="<?php _e( $name ); ?>" id="<?php _e( $id ); ?>">

Space after opening parenthesis of function call prohibited
Open

                <?php dfp_ad_select_options( $value ); ?>

Space after opening parenthesis of function call prohibited
Open

                'description' => __( 'Displays an ad position', $this->get_widget_slug() )

Expected 0 spaces before closing bracket; 1 found
Open

        dfp_ad_position( $instance['position_title'] );

Space after opening parenthesis of function call prohibited
Open

        $name  = ( $this->get_field_name( 'position_title' ) !== null ? $this->get_field_name( 'position_title' ) : '' );

Space after opening parenthesis of function call prohibited
Open

        $id    = ( $this->get_field_id( 'position_title' ) !== null ? $this->get_field_id( 'position_title' ) : '' );

Expected 0 spaces before closing bracket; 1 found
Open

        $name  = ( $this->get_field_name( 'position_title' ) !== null ? $this->get_field_name( 'position_title' ) : '' );

Space after opening parenthesis of function call prohibited
Open

        <h4><label for="<?php _e( $id ); ?>"><?php _e( 'Ad Position', 'dfp-ads' ); ?></label></h4>

Opening brace should be on a new line
Open

    public function __construct() {

Space after opening parenthesis of function call prohibited
Open

            __( 'DFP Ad Position', $this->get_widget_slug() ),

Expected 0 spaces before closing bracket; 1 found
Open

        $name  = ( $this->get_field_name( 'position_title' ) !== null ? $this->get_field_name( 'position_title' ) : '' );

Expected 0 spaces before closing bracket; 1 found
Open

        $id    = ( $this->get_field_id( 'position_title' ) !== null ? $this->get_field_id( 'position_title' ) : '' );

Expected 0 spaces before closing bracket; 1 found
Open

        wp_cache_delete( $this->get_widget_slug(), 'widget' );

Opening brace should be on a new line
Open

    public function flush_widget_cache() {

Space after opening parenthesis of function call prohibited
Open

        wp_cache_delete( $this->get_widget_slug(), 'widget' );

Opening brace should be on a new line
Open

    public function update( $new_instance, $old_instance ) {

Expected 0 spaces after opening bracket; 1 found
Open

        foreach ( $this->fields as $field ) {

Opening brace should be on a new line
Open

    public function get_widget_slug() {

There are no issues that match your filters.

Category
Status