Changeset 1511400
- Timestamp:
- 10/10/2016 02:47:20 AM (9 years ago)
- Location:
- ownerauthor-ad-split-for-genesis
- Files:
-
- 18 added
- 11 edited
-
assets/banner-772x250.png (added)
-
assets/icon-256x256.png (added)
-
tags/1.2.0 (added)
-
tags/1.2.0/admin (added)
-
tags/1.2.0/admin/Admin.php (added)
-
tags/1.2.0/admin/Global_Settings.php (added)
-
tags/1.2.0/admin/Post_Metabox.php (added)
-
tags/1.2.0/admin/User_Profile_Setting.php (added)
-
tags/1.2.0/adsense-owner-author-split.php (added)
-
tags/1.2.0/includes (added)
-
tags/1.2.0/includes/Content_Ads.php (added)
-
tags/1.2.0/includes/Main.php (added)
-
tags/1.2.0/includes/Shortcode.php (added)
-
tags/1.2.0/readme.txt (added)
-
tags/1.2.0/resources (added)
-
tags/1.2.0/resources/js (added)
-
tags/1.2.0/resources/js/gb-adsense-shortcode-split.js (added)
-
tags/1.2.0/resources/js/gb-adsense-split.js (added)
-
trunk/admin/Admin.php (modified) (4 diffs)
-
trunk/admin/Global_Settings.php (modified) (13 diffs)
-
trunk/admin/Post_Metabox.php (modified) (6 diffs)
-
trunk/admin/User_Profile_Setting.php (modified) (2 diffs)
-
trunk/adsense-owner-author-split.php (modified) (2 diffs)
-
trunk/includes/Content_Ads.php (modified) (3 diffs)
-
trunk/includes/Main.php (modified) (10 diffs)
-
trunk/includes/Shortcode.php (modified) (4 diffs)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/resources/js/gb-adsense-shortcode-split.js (modified) (1 diff)
-
trunk/resources/js/gb-adsense-split.js (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
ownerauthor-ad-split-for-genesis/trunk/admin/Admin.php
r1422584 r1511400 5 5 * 6 6 * @since 1.0.0 7 * @package adsense-owner-author-split8 * @subpackage adsense-owner-author-split/admin7 * @package owner-author-ad-split 8 * @subpackage owner-author-ad-split/admin 9 9 * @author Josh Mallard <[email protected]> 10 10 */ 11 11 12 namespace GingerBeard\Adsense_Owner_Author_Split\Admin;12 namespace LimeCuda\Owner_Author_Ad_Split\Admin; 13 13 14 14 class Admin { … … 22 22 public function __construct() { 23 23 24 // Add the admin page 24 // Add the admin page. 25 25 add_action( 'after_setup_theme', array( $this, 'load_after_theme' ) ); 26 26 add_action( 'after_setup_theme', array( $this, 'get_global_settings' ) ); 27 27 28 // Add the user profile fields 28 // Add the user profile fields. 29 29 require plugin_dir_path( __FILE__ ) . 'User_Profile_Setting.php'; 30 30 add_action( 'show_user_profile', array( User_Profile_Setting\Profile_Setting::instance(), 'user_meta' ) ); 31 31 add_action( 'edit_user_profile', array( User_Profile_Setting\Profile_Setting::instance(), 'user_meta' ) ); 32 32 33 // Save user profile fields 33 // Save user profile fields. 34 34 add_action( 'personal_options_update', array( User_Profile_Setting\Profile_Setting::instance(), 'save_meta' ) ); 35 35 add_action( 'edit_user_profile_update', array( User_Profile_Setting\Profile_Setting::instance(), 'save_meta' ) ); 36 36 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. 38 41 require plugin_dir_path( __FILE__ ) . 'Post_Metabox.php'; 39 42 add_action( 'add_meta_boxes', array( Post_Metabox\Metabox::instance(), 'metabox' ) ); … … 48 51 * 49 52 * @since 1.0.0 50 * @access p rivate53 * @access public 51 54 */ 52 55 public function load_after_theme() { … … 74 77 } 75 78 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 } 76 105 } -
ownerauthor-ad-split-for-genesis/trunk/admin/Global_Settings.php
r1426244 r1511400 5 5 * 6 6 * @since 1.0.0 7 * @package adsense-owner-author-split8 * @subpackage adsense-owner-author-split/admin7 * @package owner-author-ad-split 8 * @subpackage owner-author-ad-split/admin 9 9 * @author Josh Mallard <[email protected]> 10 10 */ 11 11 12 namespace GingerBeard\Adsense_Owner_Author_Split\Admin\Global_Settings;12 namespace LimeCuda\Owner_Author_Ad_Split\Admin\Global_Settings; 13 13 14 14 class Global_Settings extends \Genesis_Admin_Boxes { … … 41 41 public function __construct() { 42 42 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'; 46 46 47 47 $menu_ops = array( 48 48 'submenu' => array( 49 49 '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' ) 52 52 ) 53 53 ); … … 55 55 $page_ops = array(); 56 56 57 $settings_field = GINGERBEARD_ADSENSE_SPLIT;57 $settings_field = LC_AD_SPLIT; 58 58 59 59 $default_settings = apply_filters( 60 ' gingerbeard_adsense_global_settings',60 'lc_ad_split_global_settings', 61 61 array( 62 62 'show_content_ads' => 1, … … 117 117 function metaboxes() { 118 118 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' ); 123 123 } 124 124 … … 133 133 <table class="form-table"> 134 134 <tbody> 135 135 136 <tr valign="top"> 136 137 <th scope="row"></th> 137 138 <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> 139 143 </td> 140 144 </tr> … … 144 148 <td> 145 149 <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> 147 151 </p> 148 152 </td> … … 172 176 173 177 <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> 175 179 <td> 176 180 <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> … … 179 183 180 184 <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> 182 186 <td> 183 187 <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 forevery <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> 185 189 </td> 186 190 </tr> … … 207 211 208 212 <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> 210 214 <td> 211 215 <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> … … 214 218 215 219 <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> 217 221 <td> 218 222 <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 forevery <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> 220 224 </td> 221 225 </tr> … … 224 228 <th scope="row"></th> 225 229 <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> 227 231 </td> 228 232 </tr> … … 246 250 247 251 <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> 249 253 <td> 250 254 <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> … … 253 257 254 258 <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> 256 260 <td> 257 261 <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 forevery <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> 259 263 </td> 260 264 </tr> -
ownerauthor-ad-split-for-genesis/trunk/admin/Post_Metabox.php
r1426244 r1511400 4 4 * 5 5 * @since 1.0.0 6 * @package adsense-owner-author-split7 * @subpackage adsense-owner-author-split/admin6 * @package owner-author-ad-split 7 * @subpackage owner-author-ad-split/admin 8 8 * @author Josh Mallard <[email protected]> 9 9 */ 10 10 11 namespace GingerBeard\Adsense_Owner_Author_Split\Admin\Post_Metabox;11 namespace LimeCuda\Owner_Author_Ad_Split\Admin\Post_Metabox; 12 12 13 13 class Metabox { … … 44 44 return; 45 45 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' ); 47 47 } 48 48 … … 57 57 global $current_screen; 58 58 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' ); 60 60 $hide_post = get_post_meta( $post->ID, 'gb_adsense_hide_content_ads', true ); 61 61 … … 80 80 <label for="gb_adsense_hide_content_ads"> 81 81 <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> 84 84 </select> 85 85 </label> … … 92 92 <p class="description"> 93 93 <?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' ); 95 95 ?> 96 96 </p> … … 152 152 $profile_link = get_edit_user_link( get_current_user_id() ); 153 153 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>'; 155 155 156 156 } -
ownerauthor-ad-split-for-genesis/trunk/admin/User_Profile_Setting.php
r1426244 r1511400 4 4 * 5 5 * @since 1.0.0 6 * @package adsense-owner-author-split7 * @subpackage adsense-owner-author-split/admin6 * @package owner-author-ad-split 7 * @subpackage owner-author-ad-split/admin 8 8 * @author Josh Mallard <[email protected]> 9 9 */ 10 10 11 namespace GingerBeard\Adsense_Owner_Author_Split\Admin\User_Profile_Setting;11 namespace LimeCuda\Owner_Author_Ad_Split\Admin\User_Profile_Setting; 12 12 13 13 class Profile_Setting { … … 41 41 public static function user_meta( $user ) { ?> 42 42 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> 44 44 45 45 <table class="form-table"> 46 46 <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> 48 48 <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> 49 49 </tr> 50 50 51 51 <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> 54 54 </tr> 55 55 56 56 <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> 59 59 </tr> 60 60 -
ownerauthor-ad-split-for-genesis/trunk/adsense-owner-author-split.php
r1426244 r1511400 1 1 <?php 2 2 /** 3 * @since 1.0.04 * @package adsense-owner-author-split5 *6 3 * Plugin Name: Owner/Author Ad Split for Genesis 7 * Plugin URI: https:// github.com/BeardedGinger/adsense-owner-author-split4 * Plugin URI: https://fewerthanthree.com/plugin/ownerauthor-ad-split-for-genesis 8 5 * 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.06 * Version: 1.2.0 10 7 * Author: Josh Mallard 11 * Author URI: http ://gingercult.com8 * Author URI: https://fewerthanthree.com 12 9 * License: GPL-2.0+ 13 10 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt 14 * Text Domain: adsense_owner_author_split11 * Text Domain: owner-author-ad-split 15 12 * Domain Path: /languages 13 * 14 * @package owner-author-ad-split 16 15 */ 17 16 … … 24 23 include_once( 'admin/Admin.php' ); 25 24 26 function gingerbeard_adsense_owner_author_split() {27 new GingerBeard\Adsense_Owner_Author_Split\Adsense_Owner_Author_Split();25 function lc_owner_author_ad_split() { 26 new LimeCuda\Owner_Author_Ad_Split\Owner_Author_Ad_Split(); 28 27 } 29 28 30 gingerbeard_adsense_owner_author_split();29 lc_owner_author_ad_split(); 31 30 32 function gingerbeard_adsense_owner_author_split_admin() {33 if ( is_admin() ) {34 new GingerBeard\Adsense_Owner_Author_Split\Admin\Admin();31 function lc_owner_author_ad_split_admin() { 32 if ( is_admin() ) { 33 new LimeCuda\Owner_Author_Ad_Split\Admin\Admin(); 35 34 } 36 35 } 37 36 38 gingerbeard_adsense_owner_author_split_admin();37 lc_owner_author_ad_split_admin(); -
ownerauthor-ad-split-for-genesis/trunk/includes/Content_Ads.php
r1422584 r1511400 5 5 * 6 6 * @since 1.0.0 7 * @package adsense-owner-author-split8 * @subpackage adsense-owner-author-split/includes7 * @package owner-author-ad-split 8 * @subpackage owner-author-ad-split/includes 9 9 * @author Josh Mallard <[email protected]> 10 10 */ 11 11 12 namespace GingerBeard\Adsense_Owner_Author_Split\Content_Ads;12 namespace LimeCuda\Owner_Author_Ad_Split\Content_Ads; 13 13 14 14 class Ads { … … 109 109 public function owner_weights() { 110 110 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' ); 113 113 114 114 if( isset( $above_weight ) ) { … … 131 131 private function owner_adsense_codes() { 132 132 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' ); 135 135 136 136 if( isset( $owner_above ) ) { -
ownerauthor-ad-split-for-genesis/trunk/includes/Main.php
r1426244 r1511400 5 5 * 6 6 * @since 1.0.0 7 * @package adsense-owner-author-split 7 * @package owner-author-ad-split 8 * @subpackage owner-author-ad-split/includes 8 9 * @author Josh Mallard <[email protected]> 9 10 */ 10 11 11 namespace GingerBeard\Adsense_Owner_Author_Split;12 13 class Adsense_Owner_Author_Split {12 namespace LimeCuda\Owner_Author_Ad_Split; 13 14 class Owner_Author_Ad_Split { 14 15 15 16 /** … … 28 29 * @var string 29 30 */ 30 protected $plugin_slug = ' adsense_owner_author_split';31 protected $plugin_slug = 'owner_author_ad_split'; 31 32 32 33 /** … … 39 40 public function __construct() { 40 41 41 // shortcode42 add_action( 'after_setup_theme', array( $this, 'ad_shortcode ' ) );43 44 // place the content ads42 // Add the shortcodes. 43 add_action( 'after_setup_theme', array( $this, 'ad_shortcodes' ) ); 44 45 // Place the content ads. 45 46 add_action( 'after_setup_theme', array( $this, 'place_content_ads' ) ); 46 47 add_action( 'wp_enqueue_scripts', array( $this, 'scripts' ) ); … … 69 70 * @access public 70 71 */ 71 public function ad_shortcode () {72 public function ad_shortcodes() { 72 73 73 74 require plugin_dir_path( __FILE__ ) . 'Shortcode.php'; 74 75 76 add_shortcode( 'gb_ad_above', array( $this, 'before_content_ad_shortcode' ) ); 75 77 add_shortcode( 'gb_ad', array( Shortcode\Shortcode::instance(), 'build_shortcode' ) ); 78 add_shortcode( 'gb_ad_below', array( $this, 'below_content_ad_shortcode' ) ); 76 79 77 80 } … … 85 88 public function scripts() { 86 89 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 ( 105 98 'owner_above_ad' => Content_Ads\Ads::instance()->owner_above_ad, 106 99 'owner_above_weight' => Content_Ads\Ads::instance()->owner_above_weight, … … 108 101 'owner_below_weight' => Content_Ads\Ads::instance()->owner_below_weight, 109 102 '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 112 115 } 113 116 … … 124 127 return; 125 128 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' ); 127 130 $hide_post = get_post_meta( get_the_ID(), 'gb_adsense_hide_content_ads', true ); 128 131 … … 135 138 136 139 /** 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 /** 137 164 * Below content ad 138 165 * … … 146 173 return; 147 174 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' ); 149 176 $hide_post = get_post_meta( get_the_ID(), 'gb_adsense_hide_content_ads', true ); 150 177 … … 156 183 } 157 184 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 4 4 * 5 5 * @since 1.0.0 6 * @package adsense-owner-author-split7 * @subpackage adsense-owner-author-split/includes6 * @package owner-author-ad-split 7 * @subpackage owner-author-ad-split/includes 8 8 * @author Josh Mallard <[email protected]> 9 9 */ 10 10 11 namespace GingerBeard\Adsense_Owner_Author_Split\Shortcode;11 namespace LimeCuda\Owner_Author_Ad_Split\Shortcode; 12 12 13 13 class Shortcode { … … 95 95 96 96 // 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( 98 98 'owner_shortcode_ad' => $this->owner_shortcode_ad, 99 99 'owner_shortcode_weight' => $this->owner_shortcode_weight, … … 121 121 return; 122 122 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' ); 124 124 125 125 if( isset( $owner_weight ) ) { … … 140 140 return; 141 141 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' ); 143 143 144 144 if( isset( $owner_shortcode ) ) { -
ownerauthor-ad-split-for-genesis/trunk/readme.txt
r1427177 r1511400 1 1 === Owner/Author Ad Split for Genesis=== 2 Contributors: joshlimecuda 3 Donate link: http ://joshmallard.com4 Tags: genesis, adsense, ads 2 Contributors: joshlimecuda, imeson 3 Donate link: https://fewerthanthree.com 4 Tags: genesis, adsense, ads, ad sharing 5 5 Requires at least: 4.2 6 Tested up to: 4. 5.27 Stable tag: 1. 1.06 Tested up to: 4.6.1 7 Stable tag: 1.2.0 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 15 15 Built 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. 16 16 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.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]`, `[gb_ad_above]`, & `[gb_ad_below]` shortcode. 18 18 19 19 = Ad Codes & Weights = 20 21 20 22 21 **Site Owner** … … 53 52 == Screenshots == 54 53 55 Set the site owner ads and display weight56 Set the post author ads on their profile page54 1. Set the site owner ads and display weight 55 2. Set the post author ads on their profile page 57 56 58 57 == 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 59 62 60 63 = 1.1.0 = -
ownerauthor-ad-split-for-genesis/trunk/resources/js/gb-adsense-shortcode-split.js
r1422584 r1511400 1 1 (function (window, document) { 2 2 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; 6 6 7 7 var shortcodeAds = [ ownerShortcodeAd, authorShortcodeAd ], -
ownerauthor-ad-split-for-genesis/trunk/resources/js/gb-adsense-split.js
r1422584 r1511400 1 1 (function (window, document) { 2 2 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; 9 9 10 10 var aboveAds = [ ownerAboveAd, authorAboveAd ],
Note: See TracChangeset
for help on using the changeset viewer.