Plugin Directory

Changeset 1511400


Ignore:
Timestamp:
10/10/2016 02:47:20 AM (9 years ago)
Author:
joshlimecuda
Message:

tagging version 1.2.0

Location:
ownerauthor-ad-split-for-genesis
Files:
18 added
11 edited

Legend:

Unmodified
Added
Removed
  • ownerauthor-ad-split-for-genesis/trunk/admin/Admin.php

    r1422584 r1511400  
    55 *
    66 * @since      1.0.0
    7  * @package    adsense-owner-author-split
    8  * @subpackage adsense-owner-author-split/admin
     7 * @package    owner-author-ad-split
     8 * @subpackage owner-author-ad-split/admin
    99 * @author     Josh Mallard <[email protected]>
    1010 */
    1111
    12 namespace GingerBeard\Adsense_Owner_Author_Split\Admin;
     12namespace LimeCuda\Owner_Author_Ad_Split\Admin;
    1313
    1414class Admin {
     
    2222    public function __construct() {
    2323
    24         // Add the admin page
     24        // Add the admin page.
    2525        add_action( 'after_setup_theme', array( $this, 'load_after_theme' ) );
    2626        add_action( 'after_setup_theme', array( $this, 'get_global_settings' ) );
    2727
    28         // Add the user profile fields
     28        // Add the user profile fields.
    2929        require plugin_dir_path( __FILE__ ) . 'User_Profile_Setting.php';
    3030        add_action( 'show_user_profile', array( User_Profile_Setting\Profile_Setting::instance(), 'user_meta' ) );
    3131        add_action( 'edit_user_profile', array( User_Profile_Setting\Profile_Setting::instance(), 'user_meta' ) );
    3232
    33         // Save user profile fields
     33        // Save user profile fields.
    3434        add_action( 'personal_options_update', array( User_Profile_Setting\Profile_Setting::instance(), 'save_meta' ) );
    3535        add_action( 'edit_user_profile_update', array( User_Profile_Setting\Profile_Setting::instance(), 'save_meta' ) );
    3636
    37         // Add the post metabox
     37        // Add the content ad to the WYSIWYG.
     38        add_filter( 'default_content', array( $this, 'default_content_ad' ), 10, 2 );
     39
     40        // Add the post metabox.
    3841        require plugin_dir_path( __FILE__ ) . 'Post_Metabox.php';
    3942        add_action( 'add_meta_boxes', array( Post_Metabox\Metabox::instance(), 'metabox' ) );
     
    4851     *
    4952     * @since     1.0.0
    50      * @access    private
     53     * @access    public
    5154     */
    5255    public function load_after_theme() {
     
    7477    }
    7578
     79    /**
     80     * Add the ad shortcode to the content area by default.
     81     *
     82     * @since     1.2.0
     83     * @param     string $content  The content for the post.
     84     * @param     object $post     The current post object.
     85     */
     86    public function default_content_ad( $content, $post ) {
     87
     88        $include_default_shortcode = genesis_get_option( 'default_content_shortcode', 'lc_ad_split_settings_field' );
     89
     90        // If content isn't empty, return the content.
     91        if ( '' !== $content )
     92            return $content;
     93
     94        // If we're not on a post, return the content.
     95        if ( 'post' !== $post->post_type )
     96            return $content;
     97
     98        // If setting to include isn't selected
     99        if ( 1 != $include_default_shortcode )
     100            return $content;
     101
     102        return '[gb_ad]';
     103
     104    }
    76105}
  • ownerauthor-ad-split-for-genesis/trunk/admin/Global_Settings.php

    r1426244 r1511400  
    55 *
    66 * @since      1.0.0
    7  * @package    adsense-owner-author-split
    8  * @subpackage adsense-owner-author-split/admin
     7 * @package    owner-author-ad-split
     8 * @subpackage owner-author-ad-split/admin
    99 * @author     Josh Mallard <[email protected]>
    1010 */
    1111
    12 namespace GingerBeard\Adsense_Owner_Author_Split\Admin\Global_Settings;
     12namespace LimeCuda\Owner_Author_Ad_Split\Admin\Global_Settings;
    1313
    1414class Global_Settings extends \Genesis_Admin_Boxes {
     
    4141    public function __construct() {
    4242
    43         define( 'GINGERBEARD_ADSENSE_SPLIT', 'gingerbeard_adsense_settings_field' );
    44 
    45         $page_id = 'gingerbeard-adsense-split';
     43        define( 'LC_AD_SPLIT', 'lc_ad_split_settings_field' );
     44
     45        $page_id = 'lc_ad_split';
    4646
    4747        $menu_ops = array(
    4848            'submenu' => array(
    4949                'parent_slug'  => 'genesis',
    50                 'page_title'   => __( 'Owner/Author Ad Split Settings', 'adsense_owner_author_split' ),
    51                 'menu_title'   => __( 'Ad Split', 'adsense_owner_author_split' )
     50                'page_title'   => __( 'Owner/Author Ad Split Settings', 'owner_author_ad_split' ),
     51                'menu_title'   => __( 'Ad Split', 'owner_author_ad_split' )
    5252            )
    5353        );
     
    5555        $page_ops = array();
    5656
    57         $settings_field = GINGERBEARD_ADSENSE_SPLIT;
     57        $settings_field = LC_AD_SPLIT;
    5858
    5959        $default_settings = apply_filters(
    60             'gingerbeard_adsense_global_settings',
     60            'lc_ad_split_global_settings',
    6161            array(
    6262                'show_content_ads'                  => 1,
     
    117117    function metaboxes() {
    118118
    119         add_meta_box( 'aoas_default_settings', __( 'Defaults', 'adsense_owner_author_split' ), array( $this, 'default_settings' ), $this->pagehook, 'main' );
    120         add_meta_box( 'aoas_above_ad_settings', __( 'Above-Content Ad', 'adsense_owner_author_split' ), array( $this, 'above_ad' ), $this->pagehook, 'main' );
    121         add_meta_box( 'aoas_shortcode_ad_settings', __( 'Content Ad', 'adsense_owner_author_split' ), array( $this, 'shortcode_ad' ), $this->pagehook, 'main' );
    122         add_meta_box( 'aoas_below_ad_settings', __( 'Below-Content Ad', 'adsense_owner_author_split' ), array( $this, 'below_ad' ), $this->pagehook, 'main' );
     119        add_meta_box( 'aoas_default_settings', __( 'General Settings', 'owner_author_ad_split' ), array( $this, 'default_settings' ), $this->pagehook, 'main' );
     120        add_meta_box( 'aoas_above_ad_settings', __( 'Above-Content Ad', 'owner_author_ad_split' ), array( $this, 'above_ad' ), $this->pagehook, 'main' );
     121        add_meta_box( 'aoas_shortcode_ad_settings', __( 'Content Ad', 'owner_author_ad_split' ), array( $this, 'shortcode_ad' ), $this->pagehook, 'main' );
     122        add_meta_box( 'aoas_below_ad_settings', __( 'Below-Content Ad', 'owner_author_ad_split' ), array( $this, 'below_ad' ), $this->pagehook, 'main' );
    123123    }
    124124
     
    133133        <table class="form-table">
    134134            <tbody>
     135
    135136                <tr valign="top">
    136137                    <th scope="row"></th>
    137138                    <td>
    138                         <p class="description"><?php _e( 'By default ads show automatically on all posts. Alternatively, check this box and ads will be hidden by default and then can be enabled on a per-post basis.', 'adsense_owner_author_split' ); ?></p>
     139                        <p>
     140                            <label for="<?php $this->field_id( 'hide_content_ads' ); ?>"><input type="checkbox" name="<?php $this->field_name( 'hide_content_ads' ); ?>" id="<?php $this->field_id( 'hide_content_ads' ); ?>" value="1" <?php checked( $this->get_field_value( 'hide_content_ads' ) ); ?> /><?php _e( 'Hide Content Ads by Default', 'owner-author-ad-split' ); ?></label>
     141                            <p class="description"><?php _e( 'By default ads show automatically on all posts. Alternatively, check this box and ads will be hidden by default and then can be enabled on a per-post basis.', 'owner-author-ad-split' ); ?></p>
     142                        </p>
    139143                    </td>
    140144                </tr>
     
    144148                    <td>
    145149                        <p>
    146                             <label for="<?php $this->field_id( 'hide_content_ads' ); ?>"><input type="checkbox" name="<?php $this->field_name( 'hide_content_ads' ); ?>" id="<?php $this->field_id( 'hide_content_ads' ); ?>" value="1" <?php checked( $this->get_field_value( 'hide_content_ads' ) ); ?> /><?php _e( 'Hide Content Ads by Default', 'adsense_owner_author_split' ); ?></label>
     150                            <label for="<?php $this->field_id( 'default_content_shortcode' ); ?>"><input type="checkbox" name="<?php $this->field_name( 'default_content_shortcode' ); ?>" id="<?php $this->field_id( 'default_content_shortcode' ); ?>" value="1" <?php checked( $this->get_field_value( 'default_content_shortcode' ) ); ?> /><?php _e( 'Include the <code>[gb_ad]</code> shortcode within the WYSIWYG by default when drafting a new post', 'owner-author-ad-split' ); ?></label>
    147151                        </p>
    148152                    </td>
     
    172176
    173177                <tr valign="top">
    174                     <th scope="row"><label for="owner_above_adsense_code"><?php _e( 'Above-Content Ad Code', 'adsense_owner_author_split' ); ?></label></th>
     178                    <th scope="row"><label for="owner_above_adsense_code"><?php _e( 'Above-Content Ad Code', 'owner_author_ad_split' ); ?></label></th>
    175179                    <td>
    176180                        <p><textarea name="<?php echo $this->get_field_name( 'owner_above_adsense_code' ); ?>" class="regular-text" id="owner_above_adsense_code" cols="78" rows="8"><?php echo esc_attr( $this->get_field_value( 'owner_above_adsense_code' ) ); ?></textarea></p>
     
    179183
    180184                <tr valign="top">
    181                     <th scope="row"><label for="owner_above_weight"><?php _e( 'Weight', 'adsense_owner_author_split' ); ?></label></th>
     185                    <th scope="row"><label for="owner_above_weight"><?php _e( 'Weight', 'owner_author_ad_split' ); ?></label></th>
    182186                    <td>
    183187                        <p><input type="range" min="0" max="10" step="1" name="<?php echo $this->get_field_name( 'owner_above_weight' ); ?>" class="regular-text" id="owner_above_weight" value="<?php echo esc_attr( $this->get_field_value( 'owner_above_weight' ) ); ?>" oninput="outputUpdate('#owner_above_weight_output', value)" /></p>
    184                         <p class="description">Show the Owner's ad above the content for every <strong><output for="owner_above_weight" id="owner_above_weight_output"><?php echo esc_attr( $this->get_field_value( 'owner_above_weight' ) ); ?></output></strong> out of 10 page loads</p>
     188                        <p class="description">Show the Owner's ad above the content on every <strong><output for="owner_above_weight" id="owner_above_weight_output"><?php echo esc_attr( $this->get_field_value( 'owner_above_weight' ) ); ?></output></strong> out of 10 page loads</p>
    185189                    </td>
    186190                </tr>
     
    207211
    208212                <tr valign="top">
    209                     <th scope="row"><label for="owner_shortcode_adsense_code"><?php _e( 'Content Ad Code', 'adsense_owner_author_split' ); ?></label></th>
     213                    <th scope="row"><label for="owner_shortcode_adsense_code"><?php _e( 'Content Ad Code', 'owner_author_ad_split' ); ?></label></th>
    210214                    <td>
    211215                        <p><textarea name="<?php echo $this->get_field_name( 'owner_shortcode_adsense_code' ); ?>" class="regular-text" id="owner_shortcode_adsense_code" cols="78" rows="8"><?php echo esc_attr( $this->get_field_value( 'owner_shortcode_adsense_code' ) ); ?></textarea></p>
     
    214218
    215219                <tr valign="top">
    216                     <th scope="row"><label for="owner_shortcode_weight"><?php _e( 'Weight', 'adsense_owner_author_split' ); ?></label></th>
     220                    <th scope="row"><label for="owner_shortcode_weight"><?php _e( 'Weight', 'owner_author_ad_split' ); ?></label></th>
    217221                    <td>
    218222                        <p><input type="range" min="0" max="10" step="1" name="<?php echo $this->get_field_name( 'owner_shortcode_weight' ); ?>" class="regular-text" id="owner_shortcode_weight" value="<?php echo esc_attr( $this->get_field_value( 'owner_shortcode_weight' ) ); ?>" oninput="outputUpdate('#owner_shortcode_weight_output', value)" /></p>
    219                         <p class="description">Show the Owner's ad in the shortcode for every <strong><output for="owner_shortcode_weight" id="owner_shortcode_weight_output"><?php echo esc_attr( $this->get_field_value( 'owner_shortcode_weight' ) ); ?></output></strong> out of 10 page loads</p>
     223                        <p class="description">Show the Owner's ad in the shortcode on every <strong><output for="owner_shortcode_weight" id="owner_shortcode_weight_output"><?php echo esc_attr( $this->get_field_value( 'owner_shortcode_weight' ) ); ?></output></strong> out of 10 page loads</p>
    220224                    </td>
    221225                </tr>
     
    224228                    <th scope="row"></th>
    225229                    <td>
    226                         <p class="description"><?php printf( esc_html__( 'Include content ad within your content by using the %s shortcode', 'adsense_owner_author_split' ), $shortcode ); ?></p>
     230                        <p class="description"><?php printf( esc_html__( 'Include content ad within your content by using the %s shortcode', 'owner_author_ad_split' ), $shortcode ); ?></p>
    227231                    </td>
    228232                </tr>
     
    246250
    247251                <tr valign="top">
    248                     <th scope="row"><label for="owner_below_adsense_code"><?php _e( 'Below-Content Ad Code', 'adsense_owner_author_split' ); ?></label></th>
     252                    <th scope="row"><label for="owner_below_adsense_code"><?php _e( 'Below-Content Ad Code', 'owner_author_ad_split' ); ?></label></th>
    249253                    <td>
    250254                        <p><textarea name="<?php echo $this->get_field_name( 'owner_below_adsense_code' ); ?>" class="regular-text" id="owner_above_adsense_code" cols="78" rows="8"><?php echo esc_attr( $this->get_field_value( 'owner_below_adsense_code' ) ); ?></textarea></p>
     
    253257
    254258                <tr valign="top">
    255                     <th scope="row"><label for="owner_below_weight"><?php _e( 'Weight', 'adsense_owner_author_split' ); ?></label></th>
     259                    <th scope="row"><label for="owner_below_weight"><?php _e( 'Weight', 'owner_author_ad_split' ); ?></label></th>
    256260                    <td>
    257261                        <p><input type="range" min="0" max="10" step="1" name="<?php echo $this->get_field_name( 'owner_below_weight' ); ?>" class="regular-text" id="owner_below_weight" value="<?php echo esc_attr( $this->get_field_value( 'owner_below_weight' ) ); ?>" oninput="outputUpdate('#owner_below_weight_output', value)" /></p>
    258                         <p class="description">Show the Owner's ad below the content for every <strong><output for="owner_below_weight" id="owner_below_weight_output"><?php echo esc_attr( $this->get_field_value( 'owner_below_weight' ) ); ?></output></strong> out of 10 page loads</p>
     262                        <p class="description">Show the Owner's ad below the content on every <strong><output for="owner_below_weight" id="owner_below_weight_output"><?php echo esc_attr( $this->get_field_value( 'owner_below_weight' ) ); ?></output></strong> out of 10 page loads</p>
    259263                    </td>
    260264                </tr>
  • ownerauthor-ad-split-for-genesis/trunk/admin/Post_Metabox.php

    r1426244 r1511400  
    44 *
    55 * @since      1.0.0
    6  * @package    adsense-owner-author-split
    7  * @subpackage adsense-owner-author-split/admin
     6 * @package    owner-author-ad-split
     7 * @subpackage owner-author-ad-split/admin
    88 * @author     Josh Mallard <[email protected]>
    99 */
    1010
    11 namespace GingerBeard\Adsense_Owner_Author_Split\Admin\Post_Metabox;
     11namespace LimeCuda\Owner_Author_Ad_Split\Admin\Post_Metabox;
    1212
    1313class Metabox {
     
    4444            return;
    4545
    46         add_meta_box( 'gb_post_ad_control', __( 'Automatic Ad Blocks', 'adsense-owner-author-split' ), array( $this, 'metabox_options' ), 'post', 'side', 'high' );
     46        add_meta_box( 'gb_post_ad_control', __( 'Automatic Ad Blocks', 'owner-author-ad-split' ), array( $this, 'metabox_options' ), 'post', 'side', 'high' );
    4747    }
    4848
     
    5757        global $current_screen;
    5858
    59         $hide_global = genesis_get_option( 'hide_content_ads', 'gingerbeard_adsense_settings_field' );
     59        $hide_global = genesis_get_option( 'hide_content_ads', 'lc_ad_split_settings_field' );
    6060        $hide_post = get_post_meta( $post->ID, 'gb_adsense_hide_content_ads', true );
    6161
     
    8080                            <label for="gb_adsense_hide_content_ads">
    8181                            <select name="gb_adsense_hide_content_ads" id="gb_adsense_hide_content_ads" default="">
    82                                 <option value="show-ads" <?php echo ( $show_selected ) ? 'selected' : ''; ?>><?php _e( 'Show Automatic Ads on Post', 'adsense-owner-author-split' ); ?></option>
    83                                 <option value="hide-ads" <?php echo ( $hide_selected ) ? 'selected' : ''; ?>><?php _e( 'Hide Automatic Ads on Post', 'adsense-owner-author-split' ); ?></option>
     82                                <option value="show-ads" <?php echo ( $show_selected ) ? 'selected' : ''; ?>><?php _e( 'Show Automatic Ads on Post', 'owner-author-ad-split' ); ?></option>
     83                                <option value="hide-ads" <?php echo ( $hide_selected ) ? 'selected' : ''; ?>><?php _e( 'Hide Automatic Ads on Post', 'owner-author-ad-split' ); ?></option>
    8484                            </select>
    8585                            </label>
     
    9292                        <p class="description">
    9393                            <?php
    94                                 _e( 'This option determines whether the automatic above and below content ads will display on this post', 'adsense-owner-author-split' );
     94                                _e( 'This option determines whether the automatic above and below content ads will display on this post', 'owner-author-ad-split' );
    9595                            ?>
    9696                        </p>
     
    152152        $profile_link = get_edit_user_link( get_current_user_id() );
    153153
    154         echo '<a href="' . $profile_link . '#aoas-profile-settings" target="_blank">' . __( 'Update Your Ad Codes', 'adsense-owner-author-split') . '</a>';
     154        echo '<a href="' . $profile_link . '#aoas-profile-settings" target="_blank">' . __( 'Update Your Ad Codes', 'owner-author-ad-split') . '</a>';
    155155
    156156    }
  • ownerauthor-ad-split-for-genesis/trunk/admin/User_Profile_Setting.php

    r1426244 r1511400  
    44 *
    55 * @since      1.0.0
    6  * @package    adsense-owner-author-split
    7  * @subpackage adsense-owner-author-split/admin
     6 * @package    owner-author-ad-split
     7 * @subpackage owner-author-ad-split/admin
    88 * @author     Josh Mallard <[email protected]>
    99 */
    1010
    11 namespace GingerBeard\Adsense_Owner_Author_Split\Admin\User_Profile_Setting;
     11namespace LimeCuda\Owner_Author_Ad_Split\Admin\User_Profile_Setting;
    1212
    1313class Profile_Setting {
     
    4141    public static function user_meta( $user ) { ?>
    4242
    43         <h3 id="aoas-profile-settings"><?php echo __( 'Adsense Owner/Author Split', 'adsense_owner_author_split' ); ?></h3>
     43        <h3 id="aoas-profile-settings"><?php echo __( 'Owner/Author Ad Split', 'owner_author_ad_split' ); ?></h3>
    4444
    4545        <table class="form-table">
    4646            <tr>
    47                 <th><label for="author_above_adsense_code"><?php echo __( 'Above Content Adsense Code', 'adsense_owner_author_split' ); ?></label>
     47                <th><label for="author_above_adsense_code"><?php echo __( 'Above-Content Ad Code', 'owner_author_ad_split' ); ?></label>
    4848                <td><textarea name="author_above_adsense_code" cols="78" rows="8"><?php echo esc_attr(get_the_author_meta( 'author_above_adsense_code', $user->ID )); ?></textarea></td>
    4949            </tr>
    5050
    5151            <tr>
    52                 <th><label for="author_below_adsense_code"><?php echo __( 'Below Content Adsense Code', 'adsense_owner_author_split' ); ?></label>
    53                 <td><textarea name="author_below_adsense_code" cols="78" rows="8"><?php echo esc_attr(get_the_author_meta( 'author_below_adsense_code', $user->ID )); ?></textarea></td>
     52                <th><label for="author_shortcode_adsense_code"><?php echo __( 'Content Ad Code', 'owner_author_ad_split' ); ?></label>
     53                <td><textarea name="author_shortcode_adsense_code" cols="78" rows="8"><?php echo esc_attr(get_the_author_meta( 'author_shortcode_adsense_code', $user->ID )); ?></textarea></td>
    5454            </tr>
    5555
    5656            <tr>
    57                 <th><label for="author_shortcode_adsense_code"><?php echo __( 'Shortcode Adsense Code', 'adsense_owner_author_split' ); ?></label>
    58                 <td><textarea name="author_shortcode_adsense_code" cols="78" rows="8"><?php echo esc_attr(get_the_author_meta( 'author_shortcode_adsense_code', $user->ID )); ?></textarea></td>
     57                <th><label for="author_below_adsense_code"><?php echo __( 'Below-Content Ad Code', 'owner_author_ad_split' ); ?></label>
     58                <td><textarea name="author_below_adsense_code" cols="78" rows="8"><?php echo esc_attr(get_the_author_meta( 'author_below_adsense_code', $user->ID )); ?></textarea></td>
    5959            </tr>
    6060
  • ownerauthor-ad-split-for-genesis/trunk/adsense-owner-author-split.php

    r1426244 r1511400  
    11<?php
    22/**
    3  * @since       1.0.0
    4  * @package     adsense-owner-author-split
    5  *
    63 * Plugin Name:     Owner/Author Ad Split for Genesis
    7  * Plugin URI:      https://github.com/BeardedGinger/adsense-owner-author-split
     4 * Plugin URI:      https://fewerthanthree.com/plugin/ownerauthor-ad-split-for-genesis
    85 * Description:     Built specifically for use with the Genesis Framework, split ad space with post author and set how often your ad displays vs the post author's ad
    9  * Version:         1.1.0
     6 * Version:         1.2.0
    107 * Author:          Josh Mallard
    11  * Author URI:      http://gingercult.com
     8 * Author URI:      https://fewerthanthree.com
    129 * License:         GPL-2.0+
    1310 * License URI:     http://www.gnu.org/licenses/gpl-2.0.txt
    14  * Text Domain:     adsense_owner_author_split
     11 * Text Domain:     owner-author-ad-split
    1512 * Domain Path:     /languages
     13 *
     14 * @package   owner-author-ad-split
    1615 */
    1716
     
    2423include_once( 'admin/Admin.php' );
    2524
    26 function gingerbeard_adsense_owner_author_split() {
    27     new GingerBeard\Adsense_Owner_Author_Split\Adsense_Owner_Author_Split();
     25function lc_owner_author_ad_split() {
     26    new LimeCuda\Owner_Author_Ad_Split\Owner_Author_Ad_Split();
    2827}
    2928
    30 gingerbeard_adsense_owner_author_split();
     29lc_owner_author_ad_split();
    3130
    32 function gingerbeard_adsense_owner_author_split_admin() {
    33     if( is_admin() ) {
    34         new GingerBeard\Adsense_Owner_Author_Split\Admin\Admin();
     31function lc_owner_author_ad_split_admin() {
     32    if ( is_admin() ) {
     33        new LimeCuda\Owner_Author_Ad_Split\Admin\Admin();
    3534    }
    3635}
    3736
    38 gingerbeard_adsense_owner_author_split_admin();
     37lc_owner_author_ad_split_admin();
  • ownerauthor-ad-split-for-genesis/trunk/includes/Content_Ads.php

    r1422584 r1511400  
    55 *
    66 * @since      1.0.0
    7  * @package    adsense-owner-author-split
    8  * @subpackage adsense-owner-author-split/includes
     7 * @package    owner-author-ad-split
     8 * @subpackage owner-author-ad-split/includes
    99 * @author     Josh Mallard <[email protected]>
    1010 */
    1111
    12 namespace GingerBeard\Adsense_Owner_Author_Split\Content_Ads;
     12namespace LimeCuda\Owner_Author_Ad_Split\Content_Ads;
    1313
    1414class Ads {
     
    109109    public function owner_weights() {
    110110
    111         $above_weight = genesis_get_option( 'owner_above_weight', 'gingerbeard_adsense_settings_field' );
    112         $below_weight = genesis_get_option( 'owner_below_weight', 'gingerbeard_adsense_settings_field' );
     111        $above_weight = genesis_get_option( 'owner_above_weight', 'lc_ad_split_settings_field' );
     112        $below_weight = genesis_get_option( 'owner_below_weight', 'lc_ad_split_settings_field' );
    113113
    114114        if( isset( $above_weight ) ) {
     
    131131    private function owner_adsense_codes() {
    132132
    133         $owner_above = genesis_get_option( 'owner_above_adsense_code', 'gingerbeard_adsense_settings_field' );
    134         $owner_below = genesis_get_option( 'owner_below_adsense_code', 'gingerbeard_adsense_settings_field' );
     133        $owner_above = genesis_get_option( 'owner_above_adsense_code', 'lc_ad_split_settings_field' );
     134        $owner_below = genesis_get_option( 'owner_below_adsense_code', 'lc_ad_split_settings_field' );
    135135
    136136        if( isset( $owner_above ) ) {
  • ownerauthor-ad-split-for-genesis/trunk/includes/Main.php

    r1426244 r1511400  
    55 *
    66 * @since      1.0.0
    7  * @package    adsense-owner-author-split
     7 * @package    owner-author-ad-split
     8 * @subpackage owner-author-ad-split/includes
    89 * @author     Josh Mallard <[email protected]>
    910 */
    1011
    11 namespace GingerBeard\Adsense_Owner_Author_Split;
    12 
    13 class Adsense_Owner_Author_Split {
     12namespace LimeCuda\Owner_Author_Ad_Split;
     13
     14class Owner_Author_Ad_Split {
    1415
    1516    /**
     
    2829     * @var      string
    2930     */
    30     protected $plugin_slug = 'adsense_owner_author_split';
     31    protected $plugin_slug = 'owner_author_ad_split';
    3132
    3233    /**
     
    3940    public function __construct() {
    4041
    41         // shortcode
    42         add_action( 'after_setup_theme', array( $this, 'ad_shortcode' ) );
    43 
    44         // place the content ads
     42        // Add the shortcodes.
     43        add_action( 'after_setup_theme', array( $this, 'ad_shortcodes' ) );
     44
     45        // Place the content ads.
    4546        add_action( 'after_setup_theme', array( $this, 'place_content_ads' ) );
    4647        add_action( 'wp_enqueue_scripts', array( $this, 'scripts' ) );
     
    6970     * @access    public
    7071     */
    71     public function ad_shortcode() {
     72    public function ad_shortcodes() {
    7273
    7374        require plugin_dir_path( __FILE__ ) . 'Shortcode.php';
    7475
     76        add_shortcode( 'gb_ad_above', array( $this, 'before_content_ad_shortcode' ) );
    7577        add_shortcode( 'gb_ad', array( Shortcode\Shortcode::instance(), 'build_shortcode' ) );
     78        add_shortcode( 'gb_ad_below', array( $this, 'below_content_ad_shortcode' ) );
    7679
    7780    }
     
    8588    public function scripts() {
    8689
    87         // register the shortcode ad js only when shortcode is used
    88         wp_register_script( 'gb-adsense-shortcode-split', plugin_dir_url( __FILE__ ) . '../resources/js/gb-adsense-shortcode-split.js', array(), $this->version, false );
    89 
    90         // If we're not running genesis, don't do anything
    91         if( ! function_exists( 'genesis' ) )
    92             return;
    93 
    94         $hide_global = genesis_get_option( 'hide_content_ads', 'gingerbeard_adsense_settings_field' );
    95         $hide_post = get_post_meta( get_the_ID(), 'gb_adsense_hide_content_ads', true );
    96 
    97         // If global default hide & Add screen
    98         if( $hide_global == 1 && $hide_post != 'show-ads' || $hide_post == 'hide-ads' )
    99             return;
    100 
    101         wp_enqueue_script( 'gb-adsense-split', plugin_dir_url( __FILE__ ) . '../resources/js/gb-adsense-split.js', array(), $this->version, false );
    102 
    103         // Localize the script with all of our ads and weights
    104         wp_localize_script( 'gb-adsense-split', 'GINGERBEARD_CONTENT_ADS', array(
     90        // If we're not running genesis, don't do anything.
     91        if ( ! function_exists( 'genesis' ) )
     92            return;
     93
     94        $hide_global = genesis_get_option( 'hide_content_ads', 'lc_ad_split_settings_field' );
     95        $hide_post = get_post_meta( get_the_ID(), 'gb_adsense_hide_content_ads', true );
     96
     97        $ads = array (
    10598            'owner_above_ad'      => Content_Ads\Ads::instance()->owner_above_ad,
    10699            'owner_above_weight'  => Content_Ads\Ads::instance()->owner_above_weight,
     
    108101            'owner_below_weight'  => Content_Ads\Ads::instance()->owner_below_weight,
    109102            'author_above_ad'     => Content_Ads\Ads::instance()->author_above_ad,
    110             'author_below_ad'     => Content_Ads\Ads::instance()->author_below_ad
    111         ) );
     103            'author_below_ad'     => Content_Ads\Ads::instance()->author_below_ad,
     104        );
     105
     106        // Register the shortcode ad js only when shortcode is used.
     107        wp_register_script( 'gb-adsense-shortcode-split', plugin_dir_url( __FILE__ ) . '../resources/js/gb-adsense-shortcode-split.js', array(), $this->version, false );
     108
     109        wp_enqueue_script( 'gb-adsense-split', plugin_dir_url( __FILE__ ) . '../resources/js/gb-adsense-split.js', array(), $this->version, false );
     110
     111        // Localize the script with all of our ads and weights.
     112        wp_localize_script( 'gb-adsense-split', 'LC_CONTENT_ADS', $ads );
     113        wp_localize_script( 'gb-adsense-shortcode-split', 'LC_CONTENT_ADS', $ads );
     114
    112115    }
    113116
     
    124127            return;
    125128
    126         $hide_global = genesis_get_option( 'hide_content_ads', 'gingerbeard_adsense_settings_field' );
     129        $hide_global = genesis_get_option( 'hide_content_ads', 'lc_ad_split_settings_field' );
    127130        $hide_post = get_post_meta( get_the_ID(), 'gb_adsense_hide_content_ads', true );
    128131
     
    135138
    136139    /**
     140     * The shortcode for displaying the above content ad
     141     *
     142     * @since     1.2.0
     143     * @access    public
     144     */
     145    public function before_content_ad_shortcode() {
     146
     147        $hide_post = get_post_meta( get_the_ID(), 'gb_adsense_hide_content_ads', true );
     148
     149        // Don't output the shortcode if the post is set to show the default ads.
     150        if ( 'show-ads' === $hide_post )
     151            return;
     152
     153        ob_start();
     154
     155            wp_enqueue_script( 'gb-adsense-split' );
     156
     157            echo '<div class="gb-ad gb-above-ad"><script>document.write(aboveAdsSplit[Math.floor(Math.random()*10)]);</script></div>';
     158
     159        return ob_get_clean();
     160
     161    }
     162
     163    /**
    137164     * Below content ad
    138165     *
     
    146173            return;
    147174
    148         $hide_global = genesis_get_option( 'hide_content_ads', 'gingerbeard_adsense_settings_field' );
     175        $hide_global = genesis_get_option( 'hide_content_ads', 'lc_ad_split_settings_field' );
    149176        $hide_post = get_post_meta( get_the_ID(), 'gb_adsense_hide_content_ads', true );
    150177
     
    156183    }
    157184
    158  }
     185    /**
     186     * The shortcode for displaying the below content ad
     187     *
     188     * @since     1.2.0
     189     * @access    public
     190     */
     191    public function below_content_ad_shortcode() {
     192
     193        $hide_post = get_post_meta( get_the_ID(), 'gb_adsense_hide_content_ads', true );
     194
     195        // Don't output the shortcode if the post is set to show the default ads.
     196        if ( 'show-ads' === $hide_post )
     197            return;
     198
     199        ob_start();
     200
     201            wp_enqueue_script( 'gb-adsense-split' );
     202
     203            echo '<div class="gb-ad gb-below-ad"><script>document.write(belowAdsSplit[Math.floor(Math.random()*10)]);</script></div>';
     204
     205        return ob_get_clean();
     206
     207    }
     208}
  • ownerauthor-ad-split-for-genesis/trunk/includes/Shortcode.php

    r1422584 r1511400  
    44 *
    55 * @since      1.0.0
    6  * @package    adsense-owner-author-split
    7  * @subpackage adsense-owner-author-split/includes
     6 * @package    owner-author-ad-split
     7 * @subpackage owner-author-ad-split/includes
    88 * @author     Josh Mallard <[email protected]>
    99 */
    1010
    11 namespace GingerBeard\Adsense_Owner_Author_Split\Shortcode;
     11namespace LimeCuda\Owner_Author_Ad_Split\Shortcode;
    1212
    1313class Shortcode {
     
    9595
    9696        // Localize the script with all of our ads and weights
    97         wp_localize_script( 'gb-adsense-shortcode-split', 'GINGERBEARD_SHORTCODE_ADS', array(
     97        wp_localize_script( 'gb-adsense-shortcode-split', 'LC_SHORTCODE_ADS', array(
    9898            'owner_shortcode_ad'      => $this->owner_shortcode_ad,
    9999            'owner_shortcode_weight'  => $this->owner_shortcode_weight,
     
    121121            return;
    122122
    123         $owner_weight = genesis_get_option( 'owner_shortcode_weight', 'gingerbeard_adsense_settings_field' );
     123        $owner_weight = genesis_get_option( 'owner_shortcode_weight', 'lc_ad_split_settings_field' );
    124124
    125125        if( isset( $owner_weight ) ) {
     
    140140            return;
    141141
    142         $owner_shortcode = genesis_get_option( 'owner_shortcode_adsense_code', 'gingerbeard_adsense_settings_field' );
     142        $owner_shortcode = genesis_get_option( 'owner_shortcode_adsense_code', 'lc_ad_split_settings_field' );
    143143
    144144        if( isset( $owner_shortcode ) ) {
  • ownerauthor-ad-split-for-genesis/trunk/readme.txt

    r1427177 r1511400  
    11=== Owner/Author Ad Split for Genesis===
    2 Contributors: joshlimecuda
    3 Donate link: http://joshmallard.com
    4 Tags: genesis, adsense, ads
     2Contributors: joshlimecuda, imeson
     3Donate link: https://fewerthanthree.com
     4Tags: genesis, adsense, ads, ad sharing
    55Requires at least: 4.2
    6 Tested up to: 4.5.2
    7 Stable tag: 1.1.0
     6Tested up to: 4.6.1
     7Stable tag: 1.2.0
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    1515Built specifically for use with the [Genesis Framework](http://joshmallard.com/genesis-link), the Owner/Author Ad Split plugin allows your blog authors to share in the ad space for their blog posts on your site.
    1616
    17 The plugin has the option to include ad spaces by default above and below the post content as well as within the post content via the `[gb_ad]` shortcode.
     17The plugin has the option to include ad spaces by default above and below the post content as well as within the post content via the `[gb_ad]`, `[gb_ad_above]`, & `[gb_ad_below]` shortcode.
    1818
    1919= Ad Codes & Weights =
    20 
    2120
    2221**Site Owner**
     
    5352== Screenshots ==
    5453
    55 Set the site owner ads and display weight
    56 Set the post author ads on their profile page
     541. Set the site owner ads and display weight
     552. Set the post author ads on their profile page
    5756
    5857== Changelog ==
     58
     59= 1.2.0 =
     60* Added shortcodes for above and below content ads ([gb_ad_above], [gb_ad_below])
     61* Option to automatically include content ad in WYSIWYG of post draft
    5962
    6063= 1.1.0 =
  • ownerauthor-ad-split-for-genesis/trunk/resources/js/gb-adsense-shortcode-split.js

    r1422584 r1511400  
    11(function (window, document) {
    22
    3     var ownerShortcodeAd = GINGERBEARD_SHORTCODE_ADS.owner_shortcode_ad,
    4         ownerShortcodeWeight = GINGERBEARD_SHORTCODE_ADS.owner_shortcode_weight,
    5         authorShortcodeAd = GINGERBEARD_SHORTCODE_ADS.author_shortcode_ad;
     3    var ownerShortcodeAd = LC_SHORTCODE_ADS.owner_shortcode_ad,
     4        ownerShortcodeWeight = LC_SHORTCODE_ADS.owner_shortcode_weight,
     5        authorShortcodeAd = LC_SHORTCODE_ADS.author_shortcode_ad;
    66
    77    var shortcodeAds = [ ownerShortcodeAd, authorShortcodeAd ],
  • ownerauthor-ad-split-for-genesis/trunk/resources/js/gb-adsense-split.js

    r1422584 r1511400  
    11(function (window, document) {
    22
    3     var ownerAboveAd = GINGERBEARD_CONTENT_ADS.owner_above_ad,
    4         ownerAboveWeight = GINGERBEARD_CONTENT_ADS.owner_above_weight,
    5         ownerBelowAd = GINGERBEARD_CONTENT_ADS.owner_below_ad,
    6         ownerBelowWeight = GINGERBEARD_CONTENT_ADS.owner_below_weight,
    7         authorAboveAd = GINGERBEARD_CONTENT_ADS.author_above_ad,
    8         authorBelowAd = GINGERBEARD_CONTENT_ADS.author_below_ad;
     3    var ownerAboveAd = LC_CONTENT_ADS.owner_above_ad,
     4        ownerAboveWeight = LC_CONTENT_ADS.owner_above_weight,
     5        ownerBelowAd = LC_CONTENT_ADS.owner_below_ad,
     6        ownerBelowWeight = LC_CONTENT_ADS.owner_below_weight,
     7        authorAboveAd = LC_CONTENT_ADS.author_above_ad,
     8        authorBelowAd = LC_CONTENT_ADS.author_below_ad;
    99
    1010    var aboveAds = [ ownerAboveAd, authorAboveAd ],
Note: See TracChangeset for help on using the changeset viewer.