ThatGerber/dfp-ads

View on GitHub
includes/admin/Import_Form.php

Summary

Maintainability
A
0 mins
Test Coverage

Expected 0 spaces before closing bracket; 1 found
Open

        <?php foreach ( $reader as $row ) { ?>

Blank line found at end of control structure
Open


Space found after opening bracket of FOREACH loop
Open

        foreach ( $reader as $key => $value ) {

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

    public function prepare_data( $file ) {

Expected 0 spaces before closing bracket; 1 found
Open

                    switch ( $submit_value ) :

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

class Import_Form extends Form {

Method name "Import_Form::results_table" is not in camel caps format
Open

    public function results_table( $reader ) {

Method name "Import_Form::render_form" is not in camel caps format
Open

    public function render_form() {

Space found after opening bracket of FOREACH loop
Open

        <?php foreach ( $reader as $row ) { ?>

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

    public function setup_data( $reader ) {

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

    public function setup_data( $reader ) {

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

    public function return_button( $text ) {

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

    public function prepare_data( $file ) {

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

    public function add_position( $position ) {

Method name "Import_Form::import_data" is not in camel caps format
Open

    public function import_data() {

Space found before closing bracket of FOREACH loop
Open

        foreach ( $data as $position ) {

Expected 0 spaces before closing bracket; 1 found
Open

        foreach ( $reader as $key => $value ) {

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

    public function add_position( $position ) {

Method name "Import_Form::import_form" is not in camel caps format
Open

    public function import_form() {

Expected 0 spaces before closing bracket; 1 found
Open

        foreach ( $data as $position ) {

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

    public function return_button( $text ) {

DEFAULT statements must be defined using a colon
Open

                        default;

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

    public function file( $args ) {

Method name "Import_Form::prepare_data" is not in camel caps format
Open

    public function prepare_data( $file ) {

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

    public function results_table( $reader ) {

Space found after opening bracket of FOREACH loop
Open

        foreach ( $data as $position ) {

Space found before closing bracket of FOREACH loop
Open

        foreach ( $reader as $key => $value ) {

Expected 0 spaces before closing bracket; 1 found
Open

            if ( array_key_exists ( $position['#Code'], $new_positions ) ) {

Method name "Import_Form::setup_data" is not in camel caps format
Open

    public function setup_data( $reader ) {

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

    public function file( $args ) {

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

    public function results_table( $reader ) {

Method name "Import_Form::return_button" is not in camel caps format
Open

    public function return_button( $text ) {

Space found before closing bracket of FOREACH loop
Open

        <?php foreach ( $reader as $row ) { ?>

Method name "Import_Form::add_position" is not in camel caps format
Open

    public function add_position( $position ) {

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

        echo '<h3>Choose the positions to import</h3>';

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

        $reader = new CsvReader($file);

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

        <table>

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

            <tbody>

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

                <td><?php _e( $row['Sizes'] ); ?></td>

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

            </tbody>

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

        $file   = new \SplFileObject( $file );

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

    /**

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

            <thead>

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

            <tr>

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

                <th align="center">Code</th>

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

        </table>

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

        // Nested args....

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

    public $csv_importer;

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

                        case 'Import CSV':

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

                        default;

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

        echo '</form>';

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

     * @param $reader

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

                <th align="center">Select</th>

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

                        // We're importing a CSV

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

                            break;

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

    }

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

                <td><?php _e( $row['#Code']); ?></td>

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

        ?><input id="<?php _e( $id, 'dfp-ads' ); ?>" name="<?php _e( $id, 'dfp-ads' ); ?>" type="file" /><?php

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

        $reader->setHeaderRowNumber(0);

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

            </tr>

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

        $this->button( $text );

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

        $id     = $this->options_str . '[' . $args['id'] . ']';

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

                        // Display Import Form

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 '<form id="return" name="return" method="post">';

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

                    $submit_value = ( DFP_Ads_Globals::post_var_exists( 'submit' ) ? DFP_Ads_Globals::get_post_var('submit') : '' );

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

                    switch ( $submit_value ) :

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

        </form>

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

        echo '<form id="CSVImport" name="CSVImport" method="post" enctype="multipart/form-data">';

Line exceeds 120 characters; contains 184 characters
Open

                <td align="center"><input type="checkbox" id="code[<?php _e( $row['#Code']); ?>]" name="code[<?php _e( $row['#Code']); ?>]" value="<?php _e( $row['#Code']); ?>" /></td>

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

    public function import_form() {

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

        <form id="CSVImport" name="CSVImport" method="post" enctype="multipart/form-data">

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

        $this->results_table( $reader );

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

        $this->button( 'Confirm Import', true );

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 '</form>';

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

    }

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

                <th align="center">Name</th>

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

            <tr>

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

                            $this->prepare_data( $_FILES['DFP_Ads_Import']['tmp_name']['import_csv'] );

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

    public function return_button( $text ) {

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

        echo '<br />';

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

    }

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

        <?php foreach ( $reader as $row ) { ?>

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

        $args = $args[0];

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 file( $args ) {

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

                    endswitch;

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

                <th align="center">Sizes</th>

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

            </thead>

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

        <?php

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

                <td align="center"><input type="checkbox" id="code[<?php _e( $row['#Code']); ?>]" name="code[<?php _e( $row['#Code']); ?>]" value="<?php _e( $row['#Code']); ?>" /></td>

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

                <td><?php _e( $row['Name'] ); ?></td>

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

        // Field values

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

                            $this->import_form();

Line exceeds 120 characters; contains 151 characters
Open

                    <a href="http://www.chriswgerber.com/dfp-ads/import-from-csv" target="_blank">www.chriswgerber.com/dfp-ads/import-from-csv</a>.</p>

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

    }

Line exceeds 120 characters; contains 132 characters
Open

                    $submit_value = ( DFP_Ads_Globals::post_var_exists( 'submit' ) ? DFP_Ads_Globals::get_post_var('submit') : '' );

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

    public function prepare_data( $file ) {

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

    public function results_table( $reader ) {

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

        ?>

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

            </tr>

Space after opening parenthesis of function call prohibited
Open

            <?php $this->button( 'Import CSV' ); ?>

Opening brace should be on a new line
Open

    public function prepare_data( $file ) {

Space after opening parenthesis of function call prohibited
Open

        $data = get_transient( 'import_data' );

Expected 0 spaces before closing bracket; 1 found
Open

        $ad_post_id = wp_insert_post( $post );

Expected 0 spaces after opening bracket; 1 found
Open

                    switch ( $submit_value ) :

Space after opening parenthesis of function call prohibited
Open

            <?php settings_fields( $this->settings_fields ); ?>

Space after opening parenthesis of function call prohibited
Open

        $this->setup_data( $reader );

Space after opening parenthesis of function call prohibited
Open

        $this->button( 'Confirm Import', true );

Expected 0 spaces before closing bracket; 1 found
Open

        $this->button( 'Confirm Import', true );

Expected 0 spaces before closing bracket; 1 found
Open

                <td><?php _e( $row['Sizes'] ); ?></td>

Space after opening parenthesis of function call prohibited
Open

        $this->button( $text );

Space after opening parenthesis of function call prohibited
Open

        update_post_meta( $ad_post_id, 'dfp_ad_code', $position['#Code'] );

Space after opening parenthesis of function call prohibited
Open

                    $submit_value = ( DFP_Ads_Globals::post_var_exists( 'submit' ) ? DFP_Ads_Globals::get_post_var('submit') : '' );

Space after opening parenthesis of function call prohibited
Open

            <?php do_settings_sections( $this->settings_sections ); ?>

Expected 0 spaces before closing bracket; 1 found
Open

            <?php do_settings_sections( $this->settings_sections ); ?>

Space after opening parenthesis of function call prohibited
Open

                <td><?php _e( $row['#Code']); ?></td>

Space after opening parenthesis of function call prohibited
Open

                <td><?php _e( $row['Name'] ); ?></td>

Space after opening parenthesis of function call prohibited
Open

                <td><?php _e( $row['Sizes'] ); ?></td>

Expected 0 spaces before closing bracket; 1 found
Open

        $new_positions = DFP_Ads_Globals::filter_post_var( 'code', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY );

Space after opening parenthesis of function call prohibited
Open

                <td align="center"><input type="checkbox" id="code[<?php _e( $row['#Code']); ?>]" name="code[<?php _e( $row['#Code']); ?>]" value="<?php _e( $row['#Code']); ?>" /></td>

Expected 0 spaces before closing bracket; 1 found
Open

            if ( array_key_exists ( $position['#Code'], $new_positions ) ) {

Expected 0 spaces before closing bracket; 1 found
Open

        $data = get_transient( 'import_data' );

Space after opening parenthesis of function call prohibited
Open

        ?><input id="<?php _e( $id, 'dfp-ads' ); ?>" name="<?php _e( $id, 'dfp-ads' ); ?>" type="file" /><?php

Space after opening parenthesis of function call prohibited
Open

        update_post_meta( $ad_post_id, 'dfp_position_sizes', $position['Sizes'] );

Expected 0 spaces before closing bracket; 1 found
Open

        ?><input id="<?php _e( $id, 'dfp-ads' ); ?>" name="<?php _e( $id, 'dfp-ads' ); ?>" type="file" /><?php

Space after opening parenthesis of function call prohibited
Open

        update_post_meta( $ad_post_id, 'dfp_position_name', $position['Name'] );

Space after opening parenthesis of function call prohibited
Open

        $this->results_table( $reader );

Expected 0 spaces after opening bracket; 1 found
Open

        <?php foreach ( $reader as $row ) { ?>

Space after opening parenthesis of function call prohibited
Open

        $ad_post_id = wp_insert_post( $post );

Expected 0 spaces before closing bracket; 1 found
Open

        update_post_meta( $ad_post_id, 'dfp_position_name', $position['Name'] );

Expected 0 spaces before closing bracket; 1 found
Open

        ?><input id="<?php _e( $id, 'dfp-ads' ); ?>" name="<?php _e( $id, 'dfp-ads' ); ?>" type="file" /><?php

Opening brace should be on a new line
Open

    public function import_form() {

Space after opening parenthesis of function call prohibited
Open

        $file   = new \SplFileObject( $file );

Space after opening parenthesis of function call prohibited
Open

        set_transient( 'import_data', $transient, 30 );

Opening brace should be on a new line
Open

    public function add_position( $position ) {

Expected 0 spaces before closing bracket; 1 found
Open

        update_post_meta( $ad_post_id, 'dfp_position_sizes', $position['Sizes'] );

Space after opening parenthesis of function call prohibited
Open

        ?><input id="<?php _e( $id, 'dfp-ads' ); ?>" name="<?php _e( $id, 'dfp-ads' ); ?>" type="file" /><?php

Expected 0 spaces before closing bracket; 1 found
Open

        $file   = new \SplFileObject( $file );

Opening brace should be on a new line
Open

    public function results_table( $reader ) {

Space after opening parenthesis of function call prohibited
Open

                <td align="center"><input type="checkbox" id="code[<?php _e( $row['#Code']); ?>]" name="code[<?php _e( $row['#Code']); ?>]" value="<?php _e( $row['#Code']); ?>" /></td>

Opening brace should be on a new line
Open

    public function setup_data( $reader ) {

Space after opening parenthesis of function call prohibited
Open

                            $this->prepare_data( $_FILES['DFP_Ads_Import']['tmp_name']['import_csv'] );

Expected 0 spaces before closing bracket; 1 found
Open

            <?php settings_fields( $this->settings_fields ); ?>

Expected 0 spaces before closing bracket; 1 found
Open

                <td><?php _e( $row['Name'] ); ?></td>

Expected 0 spaces before closing bracket; 1 found
Open

        $this->button( $text );

Expected 0 spaces after opening bracket; 1 found
Open

        foreach ( $reader as $key => $value ) {

Expected 0 spaces before closing bracket; 1 found
Open

            <?php $this->button( 'Import CSV' ); ?>

Expected 0 spaces before closing bracket; 1 found
Open

        $this->results_table( $reader );

Expected 0 spaces before closing bracket; 1 found
Open

        $this->setup_data( $reader );

Space after opening parenthesis of function call prohibited
Open

            if ( array_key_exists ( $position['#Code'], $new_positions ) ) {

Expected 0 spaces before closing bracket; 1 found
Open

                    $submit_value = ( DFP_Ads_Globals::post_var_exists( 'submit' ) ? DFP_Ads_Globals::get_post_var('submit') : '' );

Space after opening parenthesis of function call prohibited
Open

                <td align="center"><input type="checkbox" id="code[<?php _e( $row['#Code']); ?>]" name="code[<?php _e( $row['#Code']); ?>]" value="<?php _e( $row['#Code']); ?>" /></td>

Opening brace should be on a new line
Open

    public function return_button( $text ) {

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

class Import_Form extends Form {

Expected 0 spaces before closing bracket; 1 found
Open

                            $this->prepare_data( $_FILES['DFP_Ads_Import']['tmp_name']['import_csv'] );

Opening brace should be on a new line
Open

    public function import_data() {

Expected 0 spaces after opening bracket; 1 found
Open

        foreach ( $data as $position ) {

Space after opening parenthesis of function call prohibited
Open

                $this->add_position( $position );

Expected 0 spaces before closing bracket; 1 found
Open

                $this->add_position( $position );

Space before opening parenthesis of function call prohibited
Open

            if ( array_key_exists ( $position['#Code'], $new_positions ) ) {

Expected 0 spaces before closing bracket; 1 found
Open

        update_post_meta( $ad_post_id, 'dfp_ad_code', $position['#Code'] );

Opening brace should be on a new line
Open

    public function file( $args ) {

Opening brace should be on a new line
Open

    public function render_form() {

Space after opening parenthesis of function call prohibited
Open

        $new_positions = DFP_Ads_Globals::filter_post_var( 'code', FILTER_DEFAULT, FILTER_REQUIRE_ARRAY );

Expected 0 spaces after opening bracket; 1 found
Open

            if ( array_key_exists ( $position['#Code'], $new_positions ) ) {

Expected 0 spaces before closing bracket; 1 found
Open

        set_transient( 'import_data', $transient, 30 );

There are no issues that match your filters.

Category
Status