Plugin Directory

Changeset 1763298

Timestamp:
11/10/2017 07:49:58 PM (7 years ago)
Author:
derekspringer
Message:

1.3: New options to control which page types below post ads appear on.

Location:
radcontrol/trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • radcontrol/trunk/adcontrol.php

    r1600157 r1763298  
    33/*
    44Plugin Name: AdControl
    5 Plugin URI: http://wordads.co/
    6 Description: Harness WordPress.com's advertising partners for your own website. Requires <a href="http://jetpack.me/" target="_blank">Jetpack</a> to be installed and connected.
     5Plugin URI: http://wordads.co/
     6Description: Harness WordPress.com's advertising partners for your own website. Requires <a href="http/" target="_blank">Jetpack</a> to be installed and connected.
    77Author: Automattic
    8 Version: 1.2.1
    9 Author URI: http://automattic.com
     8Version: 1.
     9Author URI: http://automattic.com
    1010Text Domain: adcontrol
    1111Domain Path: /languages
     
    2828*/
    2929
    30 define( 'ADCONTROL_VERSION', '1.2.1' );
     30define( 'ADCONTROL_VERSION', '1.' );
    3131define( 'ADCONTROL_ROOT', dirname( __FILE__ ) );
    3232define( 'ADCONTROL_BASENAME', plugin_basename( __FILE__ ) );
     
    3434define( 'ADCONTROL_URL', plugins_url( '/', __FILE__ ) );
    3535define( 'ADCONTROL_API_TEST_ID', '26942' );
     36
    3637
    3738add_action( 'plugins_loaded', array( 'AdControl', 'plugin_textdomain'), 99 );
     
    126127
    127128        $this->insert_adcode();
    128         $this->insert_extras();
    129129    }
    130130
     
    154154
    155155        if ( $this->option( 'leaderboard' ) ) {
    156             add_action( 'wp_head', array( $this, 'insert_header_ad' ), 100 );
    157         }
    158     }
    159 
    160     /**
    161      * Add the actions/filters to insert extra-network features.
    162      *
    163      * @since 0.1
    164      */
    165     private function insert_extras() {
    166         require_once( ADCONTROL_ROOT . '/php/networks/amazon.php' );
     156           
     157       
     158   
     159                case 'twentyfourteen':
     160   
     161   
     162   
     163   
     164   
     165   
     166       
    167167    }
    168168
     
    210210        $data_tags = ( $this->params->cloudflare ) ? ' data-cfasync="false"' : '';
    211211        echo <<<HTML
     212
     213
     214
     215
     216
     217
     218
     219
     220
     221
     222
     223
     224
     225
     226
     227
     228
    212229        <script$data_tags type="text/javascript" src="//s.pubmine.com/head.js"></script>
     230
    213231HTML;
    214232    }
     
    261279
    262280    /**
     281
     282
     283
     284
     285
     286
     287
     288
     289
     290
     291
     292
     293
     294
     295
     296
     297
     298
     299
     300
     301
     302
     303
     304
     305
     306
     307
     308
     309
     310
     311
     312
     313
     314
     315
     316
     317
     318
     319
     320
     321
     322
     323
    263324     * Get the ad for the spot and type.
    264325     * @param  string $spot top, side, or belowpost
     
    267328    function get_ad( $spot, $type = 'iponweb' ) {
    268329        $snippet = '';
     330
    269331        if ( 'iponweb' == $type ) {
    270332            $section_id = ADCONTROL_API_TEST_ID;
    271333            $width = 300;
    272334            $height = 250;
     335
    273336            if ( 'top' == $spot ) {
    274337                // mrec for mobile, leaderboard for desktop
     
    276339                $width = $this->params->mobile_device ? 300 : 728;
    277340                $height = $this->params->mobile_device ? 250 : 90;
    278             } else if ( 'belowpost' ) {
     341                $blocker_unit = $this->params->mobile_device ? 'top_mrec' : 'top';
     342            } else if ( 'belowpost' == $spot ) {
    279343                $section_id = 0 === $this->params->blog_id ? ADCONTROL_API_TEST_ID : $this->params->blog_id . '1';
    280344                $width = 300;
    281345                $height = 250;
     346
     347
     348
     349
     350
    282351            }
     352
    283353            $data_tags = ( $this->params->cloudflare ) ? ' data-cfasync="false"' : '';
    284354            $snippet = <<<HTML
    285             <script$data_tags type='text/javascript'>
    286                 (function(g){g.__ATA.initAd({sectionId:$section_id, width:$width, height:$height});})(window);
     355            <script$data_tags id='s$section_id' type='text/javascript'>
     356                (function(g){if('undefined'!=typeof g.__ATA){
     357                    g.__ATA.initAd({collapseEmpty:'after', sectionId:$section_id, width:$width, height:$height});
     358                    $second_belowpost
     359                }})(window);
    287360            </script>
    288361HTML;
     
    290363            $leaderboard = 'top' == $spot && ! $this->params->mobile_device;
    291364            $snippet = $this->get_house_ad( $leaderboard ? 'leaderboard' : 'mrec' );
    292         }
    293 
     365            if ( 'belowpost' == $spot && $this->option( 'second_belowpost', true ) ) {
     366                $snippet .= $this->get_house_ad( $leaderboard ? 'leaderboard' : 'mrec' );
     367            }
     368        }
     369
     370        $ad_blocker_ad = 'iponweb' == $type ? $this->get_adblocker_ad( $blocker_unit ) : '';
     371        $second_belowpost_css = '';
     372        $double_mrec = '';
     373        if ( 'belowpost' == $spot && $this->option( 'second_belowpost', true ) ) {
     374            if ( 'iponweb' == $type ) {
     375                $ad_blocker_ad .= $this->get_adblocker_ad( 'mrec2' );
     376            }
     377
     378            $double_mrec = 'wpmrec2x';
     379            $second_belowpost_css = <<<HTML
     380            <style type="text/css">
     381            div.wpmrec2x{max-width:610px;}
     382            div.wpmrec2x div.u > div{float:left;margin-right:10px;}
     383            div.wpmrec2x div.u > div:nth-child(3n){margin-right:0px;}
     384            </style>
     385HTML;
     386        }
     387
     388        $header = 'top' == $spot ? 'wpcnt-header' : '';
    294389        $about = __( 'Advertisements', 'adcontrol' );
    295390        return <<<HTML
    296         <div class="wpcnt">
     391        $second_belowpost_css
     392        <div class="wpcnt $header $double_mrec">
    297393            <div class="wpa">
    298394                <span class="wpa-about">$about</span>
     
    300396                    $snippet
    301397                </div>
     398
    302399            </div>
    303400        </div>
     401
     402
     403
     404
     405
     406
     407
     408
     409
     410
     411
     412
     413
     414
     415
     416
     417
     418
     419
     420
     421
     422
     423
     424
     425
     426
     427
     428
     429
     430
     431
     432
     433
     434
     435
     436
     437
     438
     439
     440
     441
     442
    304443HTML;
    305444    }
  • radcontrol/trunk/css/ac-style.css

    r1600157 r1763298  
    44    <div class="wpcnt">
    55        <div class="wpa [wpmrec|wpwidesky|wpleaderboard]">
    6             <a class="wpa-about" href="http://wordpress.com/about-these-ads/" rel="nofollow">
     6            <a class="wpa-about" href="http://wordpress.com/about-these-ads/" rel="nofollow">
    77            About these ads
    88            </a>
  • radcontrol/trunk/languages/adcontrol.pot

    r1318784 r1763298  
    122122msgid ""
    123123"Harness WordPress.com's advertising partners for your own website. Requires "
    124 "<a href=\"http://jetpack.me/\" target=\"_blank\">Jetpack</a> to be installed "
     124"<a href=\"http/\" target=\"_blank\">Jetpack</a> to be installed "
    125125"and connected."
    126126msgstr ""
     
    131131
    132132#. Author URI of the plugin/theme
    133 msgid "http://automattic.com"
     133msgid "http://automattic.com"
    134134msgstr ""
  • radcontrol/trunk/php/admin.php

    r1576964 r1763298  
    1111        'leaderboard',
    1212        'leaderboard_mobile',
     13
     14
     15
     16
     17
    1318        'wordads_approved',
    1419        'wordads_active',
     
    271276            isset( $settings['leaderboard_mobile'] ) && $settings['leaderboard_mobile'] ? 1 : 0;
    272277
     278
     279
     280
     281
     282
     283
     284
     285
     286
     287
     288
     289
     290
     291
     292
    273293        return $to_save;
    274294    }
     
    354374        add_settings_field(
    355375            'adcontrol_userdash_leaderboard_id',
    356             __( 'Enable header unit:', 'adcontrol' ),
     376            __( 'Enable header :', 'adcontrol' ),
    357377            array( $this, 'setting_leaderboard' ),
    358378            $this->basic_settings_key,
     
    363383        add_settings_field(
    364384            'adcontrol_userdash_leaderboard_mobile_id',
    365             __( 'Enable mobile header unit:', 'adcontrol' ),
     385            __( 'Enable mobile header :', 'adcontrol' ),
    366386            array( $this, 'setting_leaderboard_mobile' ),
    367387            $this->basic_settings_key,
    368388            $section_name,
    369389            array( 'label_for' => 'leaderboard_mobile' )
     390
     391
     392
     393
     394
     395
     396
     397
     398
     399
     400
     401
     402
     403
     404
     405
     406
     407
     408
     409
     410
     411
     412
     413
     414
     415
     416
     417
     418
     419
     420
     421
     422
     423
     424
     425
     426
     427
     428
     429
     430
     431
     432
     433
     434
     435
     436
     437
     438
     439
     440
     441
     442
     443
    370444        );
    371445
     
    381455        add_settings_field(
    382456            'adcontrol_userdash_tos_id',
    383             sprintf( __( 'I have read and agree to the %sWordAds Terms of Service%s', 'adcontrol' ), '<br /><a href="http://wordpress.com/tos-wordads/" target="_blank">', '</a>' ),
     457            sprintf( __( 'I have read and agree to the %sWordAds Terms of Service%s', 'adcontrol' ), '<br /><a href="http://wordpress.com/tos-wordads/" target="_blank">', '</a>' ),
    384458            array( $this, 'setting_tos' ),
    385459            $this->basic_settings_key,
     
    423497
    424498    /**
     499
     500
     501
     502
     503
     504
     505
     506
     507
     508
     509
     510
     511
     512
     513
     514
     515
     516
     517
     518
     519
     520
     521
     522
     523
     524
     525
     526
     527
     528
     529
     530
     531
     532
     533
     534
     535
     536
     537
     538
    425539     * @since 0.1
    426540     */
  • radcontrol/trunk/php/networks/adsense.php

    r1503924 r1763298  
    2323        //-->
    2424        </script>
    25         <script' . $data_tags . ' src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script>';
     25        <script' . $data_tags . ' src="//pagead2.googlesyndication.com/pagead/show_ads.js"></script>';
    2626        return $output;
    2727    }
  • radcontrol/trunk/php/no-jetpack.php

    r1312024 r1763298  
    3030        $notice = sprintf(
    3131            __( 'AdControl requires %sJetpack%s to be installed and connected at this time. %sHelp getting started.%s', 'adcontrol' ),
    32             '<a href="http://jetpack.me/" target="_blank">', '</a>',
    33             '<a href="http://jetpack.me/support/getting-started-with-jetpack/" target="_blank">', '</a>'
     32            '<a href="http/" target="_blank">', '</a>',
     33            '<a href="http/support/getting-started-with-jetpack/" target="_blank">', '</a>'
    3434        );
    3535
     
    4747     */
    4848    function settings_link( $links ) {
    49         $settings_link = '<a href="http://jetpack.me/" target="_blank">Install Jetpack</a>';
     49        $settings_link = '<a href="http/" target="_blank">Install Jetpack</a>';
    5050        array_unshift( $links, $settings_link );
    5151        return $links;
     
    7676        $notice = sprintf(
    7777            __( 'AdControl requires %sJetpack%s to be installed and connected at this time. %sHelp getting started.%s', 'adcontrol' ),
    78             '<a href="http://jetpack.me/" target="_blank">', '</a>',
    79             '<a href="http://jetpack.me/support/getting-started-with-jetpack/" target="_blank">', '</a>'
     78            '<a href="http/" target="_blank">', '</a>',
     79            '<a href="http/support/getting-started-with-jetpack/" target="_blank">', '</a>'
    8080        );
    8181
  • radcontrol/trunk/php/params.php

    r1503924 r1763298  
    3030            'AdSafe'    => 1, // TODO
    3131        );
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
    3248    }
    3349
     
    166182     * @since 0.1
    167183     */
    168     public static function should_show() {
     184    public function should_show() {
    169185        global $wp_query;
     186
     187
     188
     189
     190
     191
     192
     193
     194
     195
     196
     197
     198
     199
     200
     201
    170202        if ( is_single() || ( is_page() && ! is_home() ) ) {
    171203            return true;
  • radcontrol/trunk/readme.txt

    r1671989 r1763298  
    33Tags: advertising, ad codes, ads
    44Requires at least: 3.4
    5 Tested up to: 4.8
    6 Stable tag: 1.2.1
     5Tested up to: 4.
     6Stable tag: 1.
    77
    88Harness WordPress.com's advertising partners for your own website.
     
    1616Make sure you [apply to WordAds](https://wordads.co/signup/) for each site you want to run AdControl on.
    1717
    18 Requires [Jetpack](http://jetpack.me/) to be installed and connected. [Help getting started.](http://jetpack.me/support/getting-started-with-jetpack/)
     18Requires [Jetpack](http/support/getting-started-with-jetpack/)
    1919
    2020New in version 1.1.3 Moved inline JavaScript in the header to an external JavaScript.
     
    2323
    24241. [Apply to WordAds](https://wordads.co/signup/) for each site you want to run AdControl on.
    25 1. [Install and activate Jetpack.](http://wordpress.org/plugins/jetpack/installation/)
     251. [Install and activate Jetpack.](http://wordpress.org/plugins/jetpack/installation/)
    26261. Upload `AdControl` to the `/wp-content/plugins/` directory.
    27271. Activate the plugin through the 'Plugins' menu in WordPress.
     
    3535
    3636== Changelog ==
     37
     38
     39
     40
     41
     42
     43
    3744
    3845= 1.2.1 =
Note: See TracChangeset for help on using the changeset viewer.