├── .gitignore ├── img ├── ad.png └── ribbon.png ├── .gitmodules ├── lib ├── forms │ ├── plugin_settings.php │ ├── ads_loop.php │ ├── ad_single.php │ └── ads_single-alex.php ├── class_wdca_codec.php ├── class_wdca_public_pages.php ├── class_wdca_data.php ├── class_wdca_admin_pages.php ├── class_wdca_custom_ad.php └── class_wdca_admin_form_renderer.php ├── css ├── wdca-default.css ├── wdca-dark.css ├── wdca-wpmu.css ├── wdca-dotted.css ├── wdca.css ├── wdca-greenbutton.css ├── wdca-paper.css ├── wdca-alex.css └── wdca-wpmu2013.css ├── changelog.txt ├── js ├── wdca.js └── wdca-button.js ├── README.md ├── custom-ads.php ├── license.txt └── languages └── wdca-default.po /.gitignore: -------------------------------------------------------------------------------- 1 | TODO 2 | -------------------------------------------------------------------------------- /img/ad.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wpmudev/in-post-ads/master/img/ad.png -------------------------------------------------------------------------------- /img/ribbon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wpmudev/in-post-ads/master/img/ribbon.png -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "dash-notice"] 2 | path = dash-notice 3 | url = git@bitbucket.org:incsub/wpmudev-dashboard-notification.git 4 | branch = master 5 | -------------------------------------------------------------------------------- /lib/forms/plugin_settings.php: -------------------------------------------------------------------------------- 1 |
2 |

3 | 4 |
5 | 6 | 7 | 8 |

9 | 10 |

11 |
12 | 13 |
14 | -------------------------------------------------------------------------------- /css/wdca-default.css: -------------------------------------------------------------------------------- 1 | @CHARSET "UTF-8"; 2 | 3 | .wdca_custom_ad { 4 | border: 1px solid #cccccc; 5 | padding: 10px; 6 | margin: 0px 0px 10px 0px; 7 | overflow: hidden; 8 | background: #f8f8f8; 9 | } 10 | .wdca_custom_ad h4 { 11 | font-weight: bold; 12 | } 13 | .wdca_custom_ad a.button, .wdca_custom_ad a:visited .button, .wdca_custom_ad a:hover .button { 14 | text-decoration: none; 15 | padding: 2px 5px; 16 | float: right; 17 | } -------------------------------------------------------------------------------- /css/wdca-dark.css: -------------------------------------------------------------------------------- 1 | @CHARSET "UTF-8"; 2 | 3 | .wdca_custom_ad { 4 | border: 1px solid #cccccc; 5 | padding: 10px; 6 | margin: 0px 0px 10px 0px; 7 | overflow: hidden; 8 | background: #111111; 9 | color: #ffffff!important; 10 | } 11 | .wdca_custom_ad h4, .wdca_custom_ad h4 a{ 12 | font-weight: bold; 13 | color: #ffffff; 14 | } 15 | .wdca_custom_ad a.button, .wdca_custom_ad a:visited .button, .wdca_custom_ad a:hover .button { 16 | text-decoration: underline; 17 | padding: 2px 5px; 18 | float: right; 19 | color: #ffffff; 20 | } -------------------------------------------------------------------------------- /css/wdca-wpmu.css: -------------------------------------------------------------------------------- 1 | @CHARSET "UTF-8"; 2 | 3 | .wdca_custom_ad { 4 | border:2px dashed #555; 5 | padding:10px 15px; 6 | margin:10px 0px 20px 0px; 7 | overflow:hidden; 8 | background:#EEF9FD; 9 | clear:both; 10 | } 11 | .wdca_custom_ad .wdca_ad_body_full{ 12 | padding-bottom:10px; 13 | } 14 | .wdca_custom_ad a.button,.wdca_custom_ad a:visited .button,.wdca_custom_ad a:hover .button{ 15 | text-decoration:none; 16 | padding:2px 5px; 17 | color:#ffffff; 18 | float:right; 19 | } 20 | .wdca_custom_ad .wdca_stars{ 21 | height:30px; 22 | width:100px; 23 | float:right; 24 | } 25 | -------------------------------------------------------------------------------- /css/wdca-dotted.css: -------------------------------------------------------------------------------- 1 | @CHARSET "UTF-8"; 2 | 3 | .wdca_custom_ad { 4 | border: 1px dashed #333333; 5 | padding: 10px; 6 | margin: 0px 0px 10px 0px; 7 | overflow: hidden; 8 | background: #f6f6f6; 9 | } 10 | .wdca_custom_ad h4 { 11 | font-weight: bold; 12 | } 13 | .wdca_custom_ad a.button, .wdca_custom_ad a:visited .button, .wdca_custom_ad a:hover .button { 14 | text-decoration: none; 15 | padding: 2px 5px; 16 | float: right; 17 | } 18 | 19 | a.wdca_button{ 20 | background: #333333; 21 | padding: 5px; 22 | border: 1px solid #111111; 23 | color: #ffffff!important; 24 | text-shadow: -1px -1px 0px #70800E; 25 | } -------------------------------------------------------------------------------- /lib/forms/ads_loop.php: -------------------------------------------------------------------------------- 1 | ' 4 | : '
' 5 | ; 6 | if ($data) foreach ($data as $ad) { 7 | $appearance_classes = ''; 8 | $system_classes = Wdca_CustomAd::wrap('ad_item') . ' ' . Wdca_CustomAd::wrap('not_placed'); 9 | 10 | include $this->_wdca->get_ad_template(); 11 | } 12 | echo defined('WDCA_FLAG_FORCE_NON_INDEXING_WRAPPER') && WDCA_FLAG_FORCE_NON_INDEXING_WRAPPER 13 | ? '' 14 | : '
' 15 | ; -------------------------------------------------------------------------------- /css/wdca.css: -------------------------------------------------------------------------------- 1 | @CHARSET "UTF-8"; 2 | 3 | /** 4 | * Auto-placed Ads start initially hidden 5 | */ 6 | .wdca_not_placed { 7 | display: none; 8 | } 9 | 10 | .wdca_default, .wdca_large { 11 | width: 95%; 12 | overflow: none; 13 | } 14 | 15 | .wdca_medium { 16 | width: 48%; 17 | overflow: none; 18 | } 19 | 20 | .wdca_small { 21 | width: 23%; 22 | overflow: none; 23 | } 24 | 25 | .wdca_left { 26 | float: left; 27 | clear: left; 28 | } 29 | 30 | .wdca_right { 31 | float: right; 32 | clear: right; 33 | } 34 | 35 | /* CLEARFIX HACK */ 36 | 37 | .wdca_custom_ad:before, 38 | .wdca_custom_ad:after { 39 | content: ""; 40 | display: table; 41 | } 42 | .wdca_custom_ad:after { 43 | clear: both; 44 | } 45 | .wdca_custom_ad { 46 | zoom: 1; /* For IE 6/7 (trigger hasLayout) */ 47 | } -------------------------------------------------------------------------------- /css/wdca-greenbutton.css: -------------------------------------------------------------------------------- 1 | @CHARSET "UTF-8"; 2 | 3 | .wdca_custom_ad { 4 | border: 1px solid #cccccc; 5 | padding: 10px; 6 | margin: 0px 0px 10px 0px; 7 | overflow: hidden; 8 | background: #f8f8f8; 9 | } 10 | .wdca_custom_ad h4 { 11 | font-weight: bold; 12 | } 13 | .wdca_custom_ad a.button, .wdca_custom_ad a:visited .button, .wdca_custom_ad a:hover .button { 14 | text-decoration: none; 15 | padding: 2px 5px; 16 | float: right; 17 | } 18 | 19 | a.wdca_button{ 20 | background: #ABC01E; 21 | background: -moz-linear-gradient(top,#ABC01E 0%,#809410 100%); 22 | background: -webkit-gradient(linear,left top,left bottom,color-stop(0%,#ABC01E),color-stop(100%,#809410)); 23 | background: -webkit-linear-gradient(top,#ABC01E 0%,#809410 100%); 24 | background: -o-linear-gradient(top,#ABC01E 0%,#809410 100%); 25 | background: -ms-linear-gradient(top,#ABC01E 0%,#809410 100%); 26 | filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ABC01E',endColorstr='#809410',GradientType=0 ); 27 | background: linear-gradient(top,#ABC01E 0%,#809410 100%); 28 | padding: 0.4em 0.8em; 29 | border: 1px solid #70800E; 30 | color: #ffffff!important; 31 | text-shadow: -1px -1px 0px #70800E; 32 | -moz-border-radius: 5px; 33 | -khtml-border-radius: 5px; 34 | -webkit-border-radius: 5px; 35 | border-radius: 5px; 36 | } -------------------------------------------------------------------------------- /lib/forms/ad_single.php: -------------------------------------------------------------------------------- 1 | ID, 'wdca_plugin_url', true); 3 | $link = $link ? $link : '#'; 4 | if (preg_match('/^www\./', $link)) $link = esc_url($link); 5 | $appearance = get_post_meta($ad->ID, 'wdca_appearance', true); 6 | $theme_class = @$appearance['strip_class'] ? '' : Wdca_CustomAd::wrap('custom_ad'); 7 | $appearance_classes = @$appearance['strip_class'] ? '' : $appearance_classes; 8 | ?> 9 |
> 10 |
11 | 12 |

13 | >post_title; ?> 14 |

15 | 16 | 17 |
18 | post_content) 20 | ); ?> 21 |
22 | 23 | 24 | class=" button ">' . $msg_footer . '

'; 29 | } ?> 30 |
-------------------------------------------------------------------------------- /lib/forms/ads_single-alex.php: -------------------------------------------------------------------------------- 1 | ID, 'wdca_plugin_url', true); 3 | $link = $link ? $link : '#'; 4 | $appearance = get_post_meta($ad->ID, 'wdca_appearance', true); 5 | $theme_class = @$appearance['strip_class'] ? '' : 'wdca_custom_ad'; 6 | $appearance_classes = @$appearance['strip_class'] ? '' : $appearance_classes; 7 | $thumb_id = function_exists('get_post_thumbnail_id') ? get_post_thumbnail_id($ad->ID) : false; 8 | $thumbnail = $thumb_id ? wp_get_attachment_image_src($thumb_id, 'thumbnail') : false; 9 | ?> 10 |
> 11 |
12 | 13 | 14 |
15 | >post_title; ?> 16 |
17 | 18 | 19 | 20 |
21 | post_content; ?> 22 |
23 | 24 |
25 | 26 | 27 | 28 | 29 | 30 |
31 | > 32 |
33 | 34 | 35 |
36 | class="wdca_ad_cta"> 37 |
38 | 39 |
40 | > 41 |
42 | 43 |
-------------------------------------------------------------------------------- /css/wdca-paper.css: -------------------------------------------------------------------------------- 1 | .wdca_custom_ad { 2 | padding: 20px 20px 10px 40px; 3 | 4 | -webkit-box-shadow: 0 10px 0 -5px #f2f2f2, 0 10px 1px -4px rgba(0,0,0,0.15), 0 20px 0 -10px #ededed, 0 20px 1px -9px rgba(0,0,0,0.15); 5 | box-shadow: 0 10px 0 -5px #f2f2f2, 0 10px 1px -4px rgba(0,0,0,0.15), 0 20px 0 -10px #ededed, 0 20px 1px -9px rgba(0,0,0,0.15); 6 | position: relative; 7 | background-color: #fafafa; 8 | 9 | background-image: -webkit-linear-gradient(#b9e4ff .1em, transparent .1em); 10 | background-image: -moz-linear-gradient(#b9e4ff .1em, transparent .1em); 11 | background-image: -o-linear-gradient(#b9e4ff .1em, transparent .1em); 12 | background-image: -ms-linear-gradient(#b9e4ff .1em, transparent .1em); 13 | background-image: linear-gradient(#b9e4ff .1em, transparent .1em); 14 | 15 | -webkit-background-size: 100% 1.6em; 16 | -moz-background-size: 100% 1.6em; 17 | background-size: 100% 1.6em; 18 | background-position: 0px -5px; 19 | border: 1px solid #d9d9d9; 20 | margin-bottom: 2em; 21 | } 22 | 23 | .wdca_custom_ad:after { 24 | content: ""; 25 | width: 1px; 26 | height: 100%; 27 | position: absolute; 28 | left: 30px; 29 | background-color: #faa7a7; 30 | display: block; 31 | top: 0; 32 | } 33 | 34 | .wdca_custom_ad h4 { 35 | font-size:1.6em; 36 | margin-top: 0; 37 | line-height: 1.6em; 38 | padding-top: 16px; 39 | margin-bottom: 0.8em; 40 | } 41 | 42 | .wdca_custom_ad h4 a { text-decoration: none; } 43 | .wdca_ad_body_full { line-height: 1.6em; font-size:1em; } 44 | .wdca_read_more a, .wdca_button a { color: rgb(247, 249, 255); } 45 | 46 | a.wdca_read_more, a.wdca_button { 47 | display: inline-block; 48 | padding: 10px 45px 8px; 49 | color: #fff; 50 | font-weight: bold; 51 | background-color: #5eabed; 52 | margin:1.8em 0 0; 53 | text-decoration: none; 54 | font-size: 1.2em; 55 | letter-spacing: 1px; 56 | border-radius: 10px; 57 | border-bottom:5px solid #5293cc; 58 | } 59 | 60 | .wdca_read_more:hover, .wdca_button:hover { 61 | background-color: #66b8ff; 62 | } 63 | 64 | .wdca_footer { font-size:0.9em; padding-top:.5em; opacity: 0.8; } -------------------------------------------------------------------------------- /css/wdca-alex.css: -------------------------------------------------------------------------------- 1 | .wdca_custom_ad { 2 | position:relative; 3 | background-color:#eef1fa; 4 | width:640px; 5 | min-height:100px; 6 | border:1px solid #d0d8e3; 7 | } 8 | 9 | .wdca_ad_info { 10 | margin:25px; 11 | position:relative; 12 | width:283px; 13 | min-height:100px; 14 | } 15 | 16 | .wdca_ad_featured { 17 | font-size:11pt; 18 | font-weight:bold; 19 | color:#7a8c98; 20 | margin-top:-3px; 21 | } 22 | 23 | .wdca_ad_title { 24 | font-size:18pt; 25 | color:#7a8c98; 26 | margin-top:-5px; 27 | } 28 | 29 | .wdca_ad_title a{ 30 | color:#14afe9; 31 | text-decoration:none; 32 | } 33 | 34 | .wdca_ad_body_full { 35 | font-size:11pt; 36 | color:#04243d; 37 | line-height: 22px; 38 | } 39 | 40 | .wdca_ad_body_full a{ 41 | color:#04243d; 42 | } 43 | 44 | .wdca_ad_thumb { 45 | position:absolute; 46 | top:25px; 47 | right:25px; 48 | width:280px; 49 | text-align:right; 50 | } 51 | 52 | .wdca_ad_button { 53 | position:absolute; 54 | top:200px; 55 | right:25px; 56 | width:280px; 57 | text-align:right; 58 | } 59 | 60 | .wdca_ad_cta { 61 | font-size:17px; 62 | font-family:Arial; 63 | font-weight:normal; 64 | -moz-border-radius:6px; 65 | -webkit-border-radius:6px; 66 | border-radius:6px; 67 | border:0px solid #ffffff; 68 | padding:11px 25px; 69 | text-decoration:none; 70 | background:-webkit-gradient( linear, left top, left bottom, color-stop(5%, #14b0e9), color-stop(100%, #14b0e9) ); 71 | background:-moz-linear-gradient( center top, #14b0e9 5%, #14b0e9 100% ); 72 | background:-ms-linear-gradient( top, #14b0e9 5%, #14b0e9 100% ); 73 | filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#14b0e9', endColorstr='#14b0e9'); 74 | background-color:#14b0e9; 75 | color:#ffffff; 76 | display:inline-block; 77 | } 78 | 79 | .wdca_ad_cta:hover { 80 | background:-webkit-gradient( linear, left top, left bottom, color-stop(5%, #14b0e9), color-stop(100%, #14b0e9) ); 81 | background:-moz-linear-gradient( center top, #14b0e9 5%, #14b0e9 100% ); 82 | background:-ms-linear-gradient( top, #14b0e9 5%, #14b0e9 100% ); 83 | filter:progid:DXImageTransform.Microsoft.gradient(startColorstr='#14b0e9', endColorstr='#14b0e9'); 84 | background-color:#14b0e9; 85 | } 86 | 87 | .wdca_ad_cta:active { 88 | position:relative; 89 | top:1px; 90 | } 91 | 92 | .wdca_ad_ribbon { 93 | position:absolute; 94 | top:-10px; 95 | right:-10px; 96 | z-index:100; 97 | } 98 | .wdca_ad_ribbon img { 99 | border: none; 100 | box-shadow: none; 101 | } -------------------------------------------------------------------------------- /lib/class_wdca_codec.php: -------------------------------------------------------------------------------- 1 | 'wdca_ad', 6 | ); 7 | private $_data; 8 | private $_wdca; 9 | 10 | function __construct () { 11 | $this->_data = Wdca_Data::get_options();//get_option('wdca'); 12 | $this->_wdca = Wdca_CustomAd::get_instance(); 13 | } 14 | 15 | function process_ad_code ($args=array(), $content='') { 16 | $args = shortcode_atts(array( 17 | 'id' => false, 18 | 'appearance' => false, 19 | 'forced' => false, 20 | ), $args); 21 | $forced = ($args['forced'] && in_array($args['forced'], array('on', 'forced', 'yes', 'true'))); 22 | if (!is_singular() && !$forced) return $content; 23 | if (is_singular() && !$forced && !defined('WDCA_ADS_DONE')) define('WDCA_ADS_DONE', true); // Auto-injection flag 24 | 25 | // Check published against delayed publishing 26 | if (!$forced) { 27 | global $post; 28 | $published = strtotime($post->post_date); 29 | $delay = $this->_data['ad_delay']; 30 | $ad_time = strtotime(sprintf('+%d days', $delay), $published); 31 | if ($ad_time > current_time('timestamp')) return $content; 32 | } 33 | 34 | $appearance_classes = $this->_parse_appearance($args['appearance']); 35 | 36 | $msg_header = @$this->_data['msg_header']; 37 | $msg_footer = @$this->_data['msg_footer']; 38 | $msg_link = @$this->_data['msg_link']; 39 | 40 | $ad = Wdca_CustomAd::get_ad($args['id']); 41 | if (!$ad) return ''; 42 | $appearance = get_post_meta($ad->ID, 'wdca_appearance', true); 43 | if (!@$appearance['strip_class']) { 44 | $appearance_classes = $appearance_classes ? $appearance_classes : 'wdca_default'; 45 | } 46 | $system_classes = ''; 47 | 48 | ob_start(); 49 | include $this->_wdca->get_ad_template(); 50 | $markup = ob_get_contents(); 51 | ob_end_clean(); 52 | 53 | $this->_wdca->late_bind_frontend_dependencies(); 54 | 55 | return $markup; 56 | } 57 | 58 | /** 59 | * Registers shortcode handlers. 60 | */ 61 | function register () { 62 | foreach ($this->shortcodes as $key=>$shortcode) { 63 | add_shortcode($shortcode, array($this, "process_{$key}_code")); 64 | } 65 | } 66 | 67 | private function _parse_appearance ($arg) { 68 | if (!$arg) return false; 69 | $tmp = explode(' ', $arg); 70 | if (!$tmp) return false; 71 | 72 | $ret = array(); 73 | foreach ($tmp as $class) { 74 | $ret[] = 'wdca_' . strtolower(preg_replace('/[^a-z0-9]/', '', $class)); 75 | } 76 | 77 | if (!$ret) return false; 78 | return join(' ', $ret); 79 | } 80 | 81 | } -------------------------------------------------------------------------------- /changelog.txt: -------------------------------------------------------------------------------- 1 | Plugin Name: In Post Ads 2 | Author: Ve Bailovity (Incsub) 3 | 4 | Change Log: 5 | ---------------------------------------------------------------------- 6 | ---------------------------------------------------------------------- 7 | 8 | 1.5.2 - 2016-12-14 9 | ---------------------------------------------------------------------- 10 | - Fix: taxonomy filtering issue 11 | - Fix: remove deprecated resources 12 | - Fix: deprecated constructors 13 | - Fix: make method signatures explicit 14 | 15 | 1.5.1 - 2013-12-14 16 | ---------------------------------------------------------------------- 17 | - Improved the ad serving method. 18 | - Added optional prefix shuffling and style loading selection. 19 | 20 | 1.5 - 2013-06-19 21 | ---------------------------------------------------------------------- 22 | - Added A/B testing support. 23 | - Added tags mapping support. 24 | - Added new appearance styles. 25 | - Predefined positions fix. 26 | 27 | 1.4 - 2012-11-26 28 | ---------------------------------------------------------------------- 29 | - Added extended settings access privileges. 30 | - Added `forced` shortcode argument, to be used on non-singular pages. 31 | - Added optional dependencies lazy loading. 32 | - Added support for custom post types auto-insertion. 33 | - Added predefined injection positions. 34 | 35 | 1.3.3 - 2012-08-06 36 | ---------------------------------------------------------------------- 37 | - Appying varying protocol replacement. 38 | - Allowing proper html attributes in footer text. 39 | 40 | 1.3.2 - 2012-07-26 41 | ---------------------------------------------------------------------- 42 | - Fix for button-specific class. 43 | - Made settings text more clear. 44 | 45 | 1.3.1 - 2012-07-13 46 | ---------------------------------------------------------------------- 47 | - Stylesheet cleanup. 48 | 49 | 1.3 - 2012-03-10 50 | ---------------------------------------------------------------------- 51 | - Editor integration. 52 | - Added Ad taxonomies and mapping for post categories. 53 | - Added per-post Ad inserting prevention. 54 | 55 | 1.2 - 2011-08-19 56 | ---------------------------------------------------------------------- 57 | - Added advanced selector control for Ad placement 58 | 59 | 1.1 - 2011-08-17 60 | ---------------------------------------------------------------------- 61 | - Added: settings for for Appearance and messages. 62 | - Added: granular display control options for particular ads. 63 | 64 | 1.0 - 2011-08-16 65 | ---------------------------------------------------------------------- 66 | - Initial release 67 | -------------------------------------------------------------------------------- /js/wdca.js: -------------------------------------------------------------------------------- 1 | (function ($) { 2 | 3 | function wdca_insert_ad ($root, $placement, callback) { 4 | var $add = $root.find('.' + _wdca.pfx + 'ad_item').first(); 5 | $add.removeClass(_wdca.pfx + 'not_placed'); 6 | $placement[callback]($add); 7 | } 8 | 9 | $(function () { 10 | 11 | var pfx = _wdca.pfx, 12 | $ads_root = $("#" + pfx + "ads_root") 13 | ; 14 | 15 | // Dynamic style load 16 | if (_wdca.dynamic_styles) { 17 | $.post(_wdca.ajax_url, { 18 | "action": pfx + "get_styles", 19 | }, function (response) { 20 | if (response.style) $("head").append(""); 21 | }); 22 | } 23 | 24 | if (!$ads_root.length) return false; 25 | 26 | var $parent = $ads_root.parent(), 27 | $ps = $parent.find(_wdca.selector), 28 | ignore_other = !!_wdca.predefined.ignore_other, 29 | allow_predefined = ( 30 | !!(ignore_other && !!($ps.length > _wdca.predefined.ignore_requirement)) 31 | || 32 | (_wdca.predefined.before || _wdca.predefined.middle || _wdca.predefined.after) 33 | ), 34 | allow_default = !ignore_other 35 | ; 36 | 37 | // Start the fiddling 38 | if (_wdca.non_indexing_wrapper) { 39 | var root_markup = $ads_root.html(); 40 | $ads_root.remove(); 41 | $parent.append(''; 284 | } 285 | $cat_str .= ''; 286 | 287 | //echo $cat_str . $ad_str; 288 | echo ''; 289 | echo ''; 290 | echo ''; 291 | echo ""; 292 | echo '
' . __('My posts within this Category', 'wdca') . '……' . __('will only show Ads from these Ad Categories', 'wdca') . '
{$cat_str}{$ad_str}
'; 293 | _e('If you do not set any mappings here, any Ad could appear in any of your posts.', 'wdca'); 294 | echo << 296 | (function ($) { 297 | $(function () { 298 | 299 | function toggle_ads_to_cats () { 300 | var cat = $("#wdca_categories").val(); 301 | var root = $("#wdca_ads_to-cat-" + cat); 302 | if (!root.length) return false; 303 | $(".wdca_ads_to_cat").hide(); 304 | root.show(); 305 | } 306 | 307 | $("#wdca_categories").change(toggle_ads_to_cats); 308 | toggle_ads_to_cats(); 309 | 310 | }); 311 | })(jQuery); 312 | 313 | EOMappingJs; 314 | } 315 | 316 | function create_tags_box () { 317 | $tags = apply_filters('wdca-settings-tags_list', get_terms('post_tag', array('orderby'=>'term_group', 'hide_empty' => false))); 318 | $ad_terms = get_terms('wdca_ad_categories', array('orderby'=>'term_group', 'hide_empty' => false)); 319 | 320 | $tags_to_ads = $this->_get_option('tag_ads'); 321 | $tags_to_ads = is_array($tags_to_ads) ? $tags_to_ads : array(); 322 | 323 | $ad_str = $tag_str = ''; 324 | 325 | $tag_str = '"; 333 | $ad_str .= "
"; 334 | } 335 | $ad_str .= ''; 336 | } 337 | $tag_str .= ''; 338 | 339 | //echo $cat_str . $ad_str; 340 | echo ''; 341 | echo ''; 342 | echo ''; 343 | echo ""; 344 | echo '
' . __('My posts within this Tag', 'wdca') . '……' . __('will only show Ads from these Ad Categories', 'wdca') . '
{$tag_str}{$ad_str}
'; 345 | _e('If you do not set any mappings here, any Ad could appear in any of your posts.', 'wdca'); 346 | echo << 348 | (function ($) { 349 | $(function () { 350 | 351 | function toggle_ads_to_tags () { 352 | var tag = $("#wdca_tags").val(); 353 | var root = $("#wdca_ads_to-tag-" + tag); 354 | if (!root.length) return false; 355 | $(".wdca_ads_to_tag").hide(); 356 | root.show(); 357 | } 358 | 359 | $("#wdca_tags").change(toggle_ads_to_tags); 360 | toggle_ads_to_tags(); 361 | 362 | }); 363 | })(jQuery); 364 | 365 | EOMappingJs; 366 | } 367 | 368 | function create_lazy_loading_box () { 369 | echo __('Enable lazy dependency loading:', 'wdca') . 370 | ' ' . 371 | $this->_create_checkbox('enable_late_binding') . 372 | '
' . __('Lazy dependency loading can improve your site load times by requiring resources as they are needed.', 'wdca') . '
' 373 | ; 374 | 375 | $wdca = Wdca_CustomAd::get_instance(); 376 | $hook = $wdca->get_late_binding_hook(); 377 | echo '
' . 378 | ' ' . 379 | '' . 380 | '
' . __('Lazy dependency loading relies on footer hook to deploy properly. If your theme does not implement the default hook, use this field to set your custom one.', 'wdca') . '
' 381 | ; 382 | 383 | echo '

' . __('Style inclusion type', 'wdca') . '

' . 384 | $this->_create_radiobox('style_inclusion_type', '') . ' 
' . 385 | $this->_create_radiobox('style_inclusion_type', 'inline') . ' 
' . 386 | $this->_create_radiobox('style_inclusion_type', 'dynamic') . ' 
' . 387 | ''; 388 | } 389 | 390 | 391 | function create_ab_mode_setup_box () { 392 | echo '

' . 393 | __('This is where you can set up your A/B testing, and settings group loading rules.', 'wdca') . 394 | '

'; 395 | } 396 | 397 | function create_sessions_box () { 398 | echo $this->_create_checkbox('remember_in_session'); 399 | echo '
' . 400 | __('By default, A/B mode distribution is random. Enabling this option will enforce initially selected mode for your users to persist accross requests (i.e. users that got A mode settings will keep seeing them, and vice versa).', 'wdca') . 401 | '
'; 402 | } 403 | 404 | function create_b_group_for_admins_box () { 405 | echo $this->_create_checkbox('b_group_for_admins'); 406 | } 407 | 408 | function create_b_group_for_users_box () { 409 | echo $this->_create_checkbox('b_group_for_users'); 410 | } 411 | 412 | function create_get_key_override_box () { 413 | echo $this->_create_checkbox('allow_get_key_override'); 414 | echo '
' . 415 | __('If A/B testing is enabled, allowing this option will let you test each group unconditionally, by passing this to your URL: ?wdca_mode=a for A group settings, ?wdca_mode=b for B group settings.', 'wdca') . 416 | '
'; 417 | } 418 | 419 | 420 | } --------------------------------------------------------------------------------