ThatGerber/dfp-ads

View on GitHub
includes/Functions.php

Summary

Maintainability
A
50 mins
Test Coverage

Function dfp_get_ad_positions has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function dfp_get_ad_positions() {
    $args = array(
        'post_type'           => 'dfp_ads',
        'post_status'         => 'publish',
        'posts_per_page'      => - 1,
Severity: Minor
Found in includes/Functions.php - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function dfp_get_ad_sizes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function dfp_get_ad_sizes( $size_string ) {
    $sizes_array = array();
    // Check if there are any sizes to explode
    if ( strlen( $size_string ) > 0 ) {
        $sizes = explode( ',', $size_string );
Severity: Minor
Found in includes/Functions.php - About 25 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Blank line found at start of control structure
Open

    if ( ! is_array( $input ) ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

function dfp_ad_position( $id ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

    if ( strlen( $size_string ) > 0 ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

function dfp_ads_shortcode_field( $post_id ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

function dfp_get_settings_value( $setting ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

    if ( $position !== null && $position->post_type === 'dfp_ads' ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Space found before closing bracket of FOREACH loop
Open

        foreach ( $sizes as $size ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

function dfp_get_settings_value( $setting ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Space found after opening bracket of FOREACH loop
Open

    foreach ( $positions as $position ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Space found after opening bracket of FOREACH loop
Open

    foreach ( $positions as $key => $position ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

    foreach ( $positions as $key => $position ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Blank line found at start of control structure
Open

    if ( ! is_array( $array ) ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

function dfp_trim_array( $input ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

    if ( ! is_array( $input ) ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

function dfp_ad_select_options( $value ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

function dfp_get_ad_sizes( $size_string ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

function dfp_intval_array( $array ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

function dfp_ads_shortcode_field( $post_id ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

function dfp_intval_array( $array ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

        foreach ( $sizes as $size ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

function dfp_ad_position( $id ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

    if ( ! is_array( $array ) ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Space found before closing bracket of FOREACH loop
Open

    foreach ( $positions as $position ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

    if ( $all_ads->have_posts() ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

function dfp_get_ad_position( $id ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

        if ( $position->post_id == null ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Blank line found at start of control structure
Open

    if ( $position !== null && $position->post_type === 'dfp_ads' ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

function dfp_get_ad_position( $id ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

function dfp_get_ad_position_by_name( $title ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

function dfp_get_ad_sizes( $size_string ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

function dfp_trim_array( $input ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

    if ( $_SERVER["SERVER_PORT"] != "80" ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

function dfp_ad_select_options( $value ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

        while ( $all_ads->have_posts() ) :
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Space found before closing bracket of FOREACH loop
Open

    foreach ( $positions as $key => $position ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

function dfp_get_ad_position_by_name( $title ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

    if ( count( $sizes ) > 1 ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Space found after opening bracket of FOREACH loop
Open

        foreach ( $sizes as $size ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

    foreach ( $positions as $position ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Blank line found at start of control structure
Open

    } else {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

    if ( isset( $_SERVER["HTTPS"] ) && $_SERVER["HTTPS"] == "on" ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

        endwhile;
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

        return false;
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    }
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    $positions = dfp_get_ad_positions();
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    if ( $all_ads->have_posts() ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

        while ( $all_ads->have_posts() ) :
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    }
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    // Trim array and eval everything into integers
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    <input style="text-align:center;" type="text" readonly
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    $option_array = get_option( 'DFP_Ads_Settings' );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

        echo '<option' . selected( $value, $position->post_id ) . ' value="' . $position->post_id . '">(' . $position->post_id . ') ' . $position->title . '</option>';
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    if ( $position !== null && $position->post_type === 'dfp_ads' ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    return ( $position->post_type !== 'dfp_ads' ? false : new DFP_Ad_Position( $position->ID ) );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    // Check if there are any sizes to explode
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    }
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    }
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    }
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

        return new DFP_Ad_Position( $position->ID );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    if ( ! is_array( $input ) ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    if ( $_SERVER["SERVER_PORT"] != "80" ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    $position = new DFP_Ad_Position( $id );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

        'post_type'           => 'dfp_ads',
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    return apply_filters( DFP_Ads_Post_Type::FIELDS_FILTER, array() );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    }
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    if ( isset( $_SERVER["HTTPS"] ) && $_SERVER["HTTPS"] == "on" ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    $pageURL .= "://";
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    } else {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    }
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Line exceeds 120 characters; contains 167 characters
Open

        echo '<option' . selected( $value, $position->post_id ) . ' value="' . $position->post_id . '">(' . $position->post_id . ') ' . $position->title . '</option>';
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    }
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

        if ( $position->post_id == null ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    /**
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    }
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    $positions = array();
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    $position = apply_filters( 'get_dfp_ad_position', get_post( $id ) );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    if ( ! is_array( $array ) ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

            $sizes_array[] = explode( 'x', $size );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    return array_map( 'dfp_trim_array', $input );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

        $pageURL .= "s";
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    $all_ads = new WP_Query( $args );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

            $all_ads->the_post();
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

            unset( $positions[ $key ] );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

        'post_status'         => 'publish',
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

        return null;
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

        return trim( $input );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    return $pageURL;
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    $position->display_position();
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

        'ignore_sticky_posts' => 1
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    foreach ( $positions as $key => $position ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

            $positions[] = new DFP_Ad_Position( get_the_ID() );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

        $sizes = explode( ',', $size_string );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    } else {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    $sizes_array = array();
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    if ( count( $sizes ) > 1 ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

        $sizes_array = explode( 'x', $sizes[0] );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

        return intval( $array );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    return array_map( 'dfp_intval_array', $array );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

           value="<?php printf( __( '[dfp_ads id=%1s]', 'dfp-ads' ), $post_id ); ?>"/>
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    foreach ( $positions as $position ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    echo '<option value="false">Select Position</option>';
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    $args = array(
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

     * @var WP_Query $all_ads
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    wp_reset_query();
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    } else {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    return dfp_intval_array( dfp_trim_array( $sizes_array ) );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    ?>
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    $pageURL = 'http';
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

        $pageURL .= $_SERVER["SERVER_NAME"] . ":" . $_SERVER["SERVER_PORT"] . $_SERVER["REQUEST_URI"];
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    return ( isset( $option_array[ $setting ] ) ? $option_array[ $setting ] : null );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    return $positions;
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    $position = apply_filters( 'get_dfp_ad_position', get_page_by_title( $title, $output = 'OBJECT', $post_type = 'dfp_ads' ) );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Line exceeds 120 characters; contains 128 characters
Open

    $position = apply_filters( 'get_dfp_ad_position', get_page_by_title( $title, $output = 'OBJECT', $post_type = 'dfp_ads' ) );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    if ( strlen( $size_string ) > 0 ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

        foreach ( $sizes as $size ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

        }
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

        $pageURL .= $_SERVER["SERVER_NAME"] . $_SERVER["REQUEST_URI"];
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

        'posts_per_page'      => - 1,
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

     */
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

        }
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    } else {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    }
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

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

    <?php
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

            unset( $positions[ $key ] );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

    $position = apply_filters( 'get_dfp_ad_position', get_post( $id ) );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

    $position = apply_filters( 'get_dfp_ad_position', get_post( $id ) );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Opening brace should be on a new line
Open

function dfp_get_ad_position_by_name( $title ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

    if ( strlen( $size_string ) > 0 ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

        echo '<option' . selected( $value, $position->post_id ) . ' value="' . $position->post_id . '">(' . $position->post_id . ') ' . $position->title . '</option>';
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

    $position = apply_filters( 'get_dfp_ad_position', get_page_by_title( $title, $output = 'OBJECT', $post_type = 'dfp_ads' ) );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

    return ( isset( $option_array[ $setting ] ) ? $option_array[ $setting ] : null );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Opening brace should be on a new line
Open

function dfp_get_ad_position( $id ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

    $position = apply_filters( 'get_dfp_ad_position', get_post( $id ) );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

        $sizes = explode( ',', $size_string );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

    if ( ! is_array( $input ) ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

    $option_array = get_option( 'DFP_Ads_Settings' );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

    return ( isset( $option_array[ $setting ] ) ? $option_array[ $setting ] : null );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces after opening bracket; 1 found
Open

    foreach ( $positions as $position ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Opening brace should be on a new line
Open

function dfp_get_ad_positions() {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces after opening bracket; 1 found
Open

        while ( $all_ads->have_posts() ) :
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

    if ( strlen( $size_string ) > 0 ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

    if ( isset( $_SERVER["HTTPS"] ) && $_SERVER["HTTPS"] == "on" ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces after opening bracket; 1 found
Open

    if ( $all_ads->have_posts() ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

        return new DFP_Ad_Position( $position->ID );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

        return intval( $array );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

        $sizes_array = explode( 'x', $sizes[0] );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

    return array_map( 'dfp_intval_array', $array );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

    if ( ! is_array( $input ) ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

    if ( isset( $_SERVER["HTTPS"] ) && $_SERVER["HTTPS"] == "on" ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

    $option_array = get_option( 'DFP_Ads_Settings' );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

            $positions[] = new DFP_Ad_Position( get_the_ID() );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces after opening bracket; 1 found
Open

    if ( $position !== null && $position->post_type === 'dfp_ads' ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

    return ( $position->post_type !== 'dfp_ads' ? false : new DFP_Ad_Position( $position->ID ) );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

    return ( $position->post_type !== 'dfp_ads' ? false : new DFP_Ad_Position( $position->ID ) );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

    if ( count( $sizes ) > 1 ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

    if ( ! is_array( $array ) ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

    return dfp_intval_array( dfp_trim_array( $sizes_array ) );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

    return dfp_intval_array( dfp_trim_array( $sizes_array ) );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

           value="<?php printf( __( '[dfp_ads id=%1s]', 'dfp-ads' ), $post_id ); ?>"/>
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Opening brace should be on a new line
Open

function dfp_get_settings_value( $setting ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

    $position = apply_filters( 'get_dfp_ad_position', get_page_by_title( $title, $output = 'OBJECT', $post_type = 'dfp_ads' ) );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Opening brace should be on a new line
Open

function dfp_get_ad_sizes( $size_string ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces after opening bracket; 1 found
Open

    if ( strlen( $size_string ) > 0 ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

    if ( count( $sizes ) > 1 ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Opening brace should be on a new line
Open

function dfp_trim_array( $input ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

    $position = new DFP_Ad_Position( $id );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

            $positions[] = new DFP_Ad_Position( get_the_ID() );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

    return array_map( 'dfp_trim_array', $input );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces after opening bracket; 1 found
Open

    if ( $_SERVER["SERVER_PORT"] != "80" ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

    $all_ads = new WP_Query( $args );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces after opening bracket; 1 found
Open

    foreach ( $positions as $key => $position ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

        return new DFP_Ad_Position( $position->ID );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

    $position = apply_filters( 'get_dfp_ad_position', get_page_by_title( $title, $output = 'OBJECT', $post_type = 'dfp_ads' ) );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

    return apply_filters( DFP_Ads_Post_Type::FIELDS_FILTER, array() );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces after opening bracket; 1 found
Open

        foreach ( $sizes as $size ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

        $sizes_array = explode( 'x', $sizes[0] );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

    return array_map( 'dfp_trim_array', $input );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

           value="<?php printf( __( '[dfp_ads id=%1s]', 'dfp-ads' ), $post_id ); ?>"/>
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Opening brace should be on a new line
Open

function dfp_ads_shortcode_field( $post_id ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

    if ( ! is_array( $array ) ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

    return array_map( 'dfp_intval_array', $array );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

        return trim( $input );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

    $all_ads = new WP_Query( $args );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces after opening bracket; 1 found
Open

    if ( count( $sizes ) > 1 ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

            $sizes_array[] = explode( 'x', $size );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

    return dfp_intval_array( dfp_trim_array( $sizes_array ) );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces after opening bracket; 1 found
Open

    if ( ! is_array( $array ) ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

    $position = new DFP_Ad_Position( $id );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces after opening bracket; 1 found
Open

        if ( $position->post_id == null ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

            unset( $positions[ $key ] );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

    $position = apply_filters( 'get_dfp_ad_position', get_post( $id ) );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

    return apply_filters( DFP_Ads_Post_Type::FIELDS_FILTER, array() );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

           value="<?php printf( __( '[dfp_ads id=%1s]', 'dfp-ads' ), $post_id ); ?>"/>
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Opening brace should be on a new line
Open

function dfp_get_url() {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces after opening bracket; 1 found
Open

    if ( isset( $_SERVER["HTTPS"] ) && $_SERVER["HTTPS"] == "on" ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Opening brace should be on a new line
Open

function dfp_ad_select_options( $value ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Opening brace should be on a new line
Open

function dfp_ad_position( $id ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

    $position = apply_filters( 'get_dfp_ad_position', get_page_by_title( $title, $output = 'OBJECT', $post_type = 'dfp_ads' ) );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Opening brace should be on a new line
Open

function dfp_get_fields() {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

        $sizes = explode( ',', $size_string );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

            $sizes_array[] = explode( 'x', $size );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Space after opening parenthesis of function call prohibited
Open

    return dfp_intval_array( dfp_trim_array( $sizes_array ) );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Opening brace should be on a new line
Open

function dfp_intval_array( $array ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

        return intval( $array );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces after opening bracket; 1 found
Open

    if ( ! is_array( $input ) ) {
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

        return trim( $input );
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

           value="<?php printf( __( '[dfp_ads id=%1s]', 'dfp-ads' ), $post_id ); ?>"/>
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

Expected 0 spaces before closing bracket; 1 found
Open

        echo '<option' . selected( $value, $position->post_id ) . ' value="' . $position->post_id . '">(' . $position->post_id . ') ' . $position->title . '</option>';
Severity: Minor
Found in includes/Functions.php by phpcodesniffer

There are no issues that match your filters.

Category
Status