Version Description
Download this release
Release Info
Developer | namith.jawahar |
Plugin | Wp-Insert |
Version | 2.4 |
Comparing to | |
See all releases |
Code changes from version 2.3 to 2.4
- includes/assets/js/wp-insert-global.js +10 -1
- includes/common/rules.php +0 -144
- includes/modules/adstxt/css/module.css +0 -0
- includes/modules/adstxt/module.php +0 -37
- includes/modules/adwidgets/functions.php +0 -273
- includes/modules/adwidgets/js/module.js +0 -145
- includes/modules/adwidgets/module.php +0 -41
- includes/{common/abtesting.php → modules/core/abtesting/module.php} +0 -10
- includes/modules/core/adstxt/adsense.php +238 -0
- includes/modules/{adstxt → core/adstxt}/js/module.js +39 -0
- includes/modules/{adstxt/functions.php → core/adstxt/module.php} +31 -0
- includes/{common/control-panel.php → modules/core/controlpanel/module.php} +12 -3
- includes/{controls/assets → modules/core/controls}/css/controls.css +0 -0
- includes/{controls/assets → modules/core/controls}/images/chosen-sprite.png +0 -0
- includes/{controls/assets → modules/core/controls}/images/chosen-sprite@2x.png +0 -0
- includes/{controls/assets → modules/core/controls}/images/jquery-te.png +0 -0
- includes/{controls/assets → modules/core/controls}/images/jquery.minicolors.png +0 -0
- includes/{controls/assets → modules/core/controls}/js/controls.js +0 -0
- includes/{controls/assets → modules/core/controls}/js/uncompressed/jQuery-TE/jquery-te-1.4.0.js +0 -0
- includes/{controls/assets → modules/core/controls}/js/uncompressed/jQuery-TE/license/AUTHOR.txt +0 -0
- includes/{controls/assets → modules/core/controls}/js/uncompressed/jQuery-TE/license/MIT-LICENSE.txt +0 -0
- includes/{controls/assets → modules/core/controls}/js/uncompressed/jQuery-chosen/LICENSE.md +0 -0
- includes/{controls/assets → modules/core/controls}/js/uncompressed/jQuery-chosen/chosen.jquery.js +0 -0
- includes/{controls/assets → modules/core/controls}/js/uncompressed/jQuery-minicolors/LICENSE.md +0 -0
- includes/{controls/assets → modules/core/controls}/js/uncompressed/jQuery-minicolors/jquery.minicolors.js +0 -0
- includes/{controls/controls.php → modules/core/controls/module.php} +11 -3
- includes/{common/common.php → modules/core/misc/module.php} +0 -0
- includes/modules/core/modules.php +8 -0
- includes/modules/core/units/adcode.php +74 -0
- includes/modules/core/units/adunit.php +297 -0
- includes/modules/core/units/device-styles.php +63 -0
- includes/{common/geotargeting.php → modules/core/units/geo-targeting.php} +46 -34
- includes/modules/core/units/js/module.js +154 -0
- includes/modules/core/units/module.php +136 -0
- includes/modules/core/units/notes.php +44 -0
- includes/modules/core/units/rules.php +137 -0
- includes/modules/general/inpost/js/module.js +82 -0
- includes/modules/general/inpost/module.php +231 -0
- includes/modules/general/intheme/module.php +44 -0
- includes/modules/{legalpages → general/legalpages}/functions.php +0 -0
- includes/modules/{legalpages → general/legalpages}/js/module.js +0 -0
- includes/modules/{legalpages → general/legalpages}/module.php +1 -7
- includes/modules/general/modules.php +10 -0
- includes/modules/general/pagelevel/module.php +36 -0
- includes/modules/general/shortcode/module.php +47 -0
- includes/modules/{trackingcodes → general/trackingcodes}/functions.php +8 -0
- includes/modules/{trackingcodes → general/trackingcodes}/js/module.js +0 -0
- includes/modules/{trackingcodes → general/trackingcodes}/module.php +1 -7
- includes/modules/{videointelligence → general/videointelligence}/api/vi.php +0 -0
- includes/modules/{videointelligence → general/videointelligence}/css/module.css +0 -0
- includes/modules/{videointelligence → general/videointelligence}/functions.php +4 -0
- includes/modules/{videointelligence → general/videointelligence}/js/module.js +0 -0
- includes/modules/{videointelligence → general/videointelligence}/module.php +2 -2
- includes/modules/{videointelligence → general/videointelligence}/vi-constants.php +0 -0
- includes/modules/general/widgets/module.php +74 -0
- includes/modules/inpostads/functions.php +0 -484
- includes/modules/inpostads/js/module.js +0 -235
- includes/modules/inpostads/module.php +0 -60
- includes/modules/inthemeads/functions.php +0 -242
- includes/modules/inthemeads/js/module.js +0 -145
- includes/modules/inthemeads/module.php +0 -41
- includes/modules/modules.php +0 -11
- includes/modules/pagelevelads/functions.php +0 -239
- includes/modules/pagelevelads/js/module.js +0 -145
- includes/modules/pagelevelads/module.php +0 -41
- includes/modules/shortcodeads/functions.php +0 -242
- includes/modules/shortcodeads/js/module.js +0 -145
- includes/modules/shortcodeads/module.php +0 -41
- readme.txt +12 -18
- wp-insert.php +4 -9
includes/assets/js/wp-insert-global.js
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
jQuery(document).ready(function() {
|
2 |
-
jQuery('.wp_insert_notice').click
|
3 |
jQuery.post(
|
4 |
jQuery('#wp_insert_admin_notice_ajax').val(), {
|
5 |
'action': 'wp_insert_admin_notice_dismiss',
|
@@ -7,4 +7,13 @@ jQuery(document).ready(function() {
|
|
7 |
}, function(response) { }
|
8 |
);
|
9 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
10 |
});
|
1 |
jQuery(document).ready(function() {
|
2 |
+
jQuery('.wp_insert_notice').on('click', '.notice-dismiss', function() {
|
3 |
jQuery.post(
|
4 |
jQuery('#wp_insert_admin_notice_ajax').val(), {
|
5 |
'action': 'wp_insert_admin_notice_dismiss',
|
7 |
}, function(response) { }
|
8 |
);
|
9 |
});
|
10 |
+
|
11 |
+
jQuery('.wp_insert_adstxt_adsense_notice').on('click', '.notice-dismiss', function() {
|
12 |
+
jQuery.post(
|
13 |
+
jQuery('#wp_insert_adstxt_adsense_admin_notice_ajax').val(), {
|
14 |
+
'action': 'wp_insert_adstxt_adsense_admin_notice_dismiss',
|
15 |
+
'wp_insert_adstxt_adsense_admin_notice_nonce': jQuery('#wp_insert_adstxt_adsense_admin_notice_nonce').val(),
|
16 |
+
}, function(response) { }
|
17 |
+
);
|
18 |
+
});
|
19 |
});
|
includes/common/rules.php
DELETED
@@ -1,144 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
$wpInsertPostInstance;
|
3 |
-
$wpInsertABTestingMode;
|
4 |
-
/* Begin Assign Instance Identifier */
|
5 |
-
add_action('the_content', 'wp_insert_track_post_instance', 1);
|
6 |
-
function wp_insert_track_post_instance($content) {
|
7 |
-
global $wpInsertPostInstance;
|
8 |
-
if(is_main_query()) {
|
9 |
-
if($wpInsertPostInstance == '') {
|
10 |
-
$wpInsertPostInstance = 1;
|
11 |
-
} else {
|
12 |
-
$wpInsertPostInstance++;
|
13 |
-
}
|
14 |
-
}
|
15 |
-
return $content;
|
16 |
-
}
|
17 |
-
/* End Assign Instance Identifier */
|
18 |
-
|
19 |
-
/* Begin Assign AB Testing Mode */
|
20 |
-
add_action('wp', 'wp_insert_track_ad_instance', 1);
|
21 |
-
function wp_insert_track_ad_instance() {
|
22 |
-
global $wpInsertABTestingMode;
|
23 |
-
$abtestingMode = get_option('wp_insert_abtesting_mode');
|
24 |
-
if(isset($abtestingMode)) {
|
25 |
-
$wpInsertABTestingMode = rand(1, floatval($abtestingMode));
|
26 |
-
} else {
|
27 |
-
$wpInsertABTestingMode = 1;
|
28 |
-
}
|
29 |
-
}
|
30 |
-
/* End Assign AB Testing Mode */
|
31 |
-
|
32 |
-
/* Begin Get Current Page Type */
|
33 |
-
function wp_insert_get_page_details() {
|
34 |
-
global $post;
|
35 |
-
$page_details = array(
|
36 |
-
'type' => 'POST',
|
37 |
-
'ID' => (isset($post->ID)?$post->ID:'')
|
38 |
-
);
|
39 |
-
if(is_home() || is_front_page()) {
|
40 |
-
$page_details['type'] = 'HOME';
|
41 |
-
} else if(is_category()) {
|
42 |
-
$page_details['type'] = 'CATEGORY';
|
43 |
-
$page_details['ID'] = get_query_var('cat');
|
44 |
-
} else if(is_archive()) {
|
45 |
-
$page_details['type'] = 'ARCHIVE';
|
46 |
-
} else if(is_search()) {
|
47 |
-
$page_details['type'] = 'SEARCH';
|
48 |
-
} else if(is_page()) {
|
49 |
-
$page_details['type'] = 'PAGE';
|
50 |
-
} else if(is_single()) {
|
51 |
-
if(is_singular('post')) {
|
52 |
-
$page_details['type'] = 'POST';
|
53 |
-
$page_details['categories'] = wp_get_post_categories($page_details['ID']);
|
54 |
-
} else {
|
55 |
-
$page_details['type'] = 'CUSTOM';
|
56 |
-
$page_details['type_name'] = $post->post_type;
|
57 |
-
}
|
58 |
-
} else if(is_404()) {
|
59 |
-
$page_details['type'] = '404';
|
60 |
-
}
|
61 |
-
return $page_details;
|
62 |
-
}
|
63 |
-
/* End Get Current Page Type */
|
64 |
-
|
65 |
-
/* Begin Get Ad Status */
|
66 |
-
function wp_insert_get_ad_status($rules) {
|
67 |
-
if(!isset($rules)) { return false; }
|
68 |
-
|
69 |
-
if(!$rules['status']) {
|
70 |
-
return false;
|
71 |
-
}
|
72 |
-
|
73 |
-
if(isset($rules['rules_exclude_loggedin']) && wp_validate_boolean($rules['rules_exclude_loggedin']) && is_user_logged_in()) {
|
74 |
-
return false;
|
75 |
-
}
|
76 |
-
|
77 |
-
if(isset($rules['rules_exclude_mobile_devices']) && wp_validate_boolean($rules['rules_exclude_mobile_devices']) && wp_is_mobile()) {
|
78 |
-
return false;
|
79 |
-
}
|
80 |
-
|
81 |
-
global $wpInsertPostInstance;
|
82 |
-
$page_details = wp_insert_get_page_details();
|
83 |
-
switch($page_details['type']) {
|
84 |
-
case 'HOME':
|
85 |
-
if(isset($rules['rules_exclude_home']) && wp_validate_boolean($rules['rules_exclude_home']) ) {
|
86 |
-
return false;
|
87 |
-
} else if(isset($rules['rules_home_instances']) && is_array($rules['rules_home_instances']) && (in_array($wpInsertPostInstance, $rules['rules_home_instances']))) {
|
88 |
-
return false;
|
89 |
-
}
|
90 |
-
break;
|
91 |
-
case 'ARCHIVE':
|
92 |
-
if(isset($rules['rules_exclude_archives']) && wp_validate_boolean($rules['rules_exclude_archives']) ) {
|
93 |
-
return false;
|
94 |
-
} else if(isset($rules['rules_archives_instances']) && is_array($rules['rules_archives_instances']) && (in_array($wpInsertPostInstance, $rules['rules_archives_instances']))) {
|
95 |
-
return false;
|
96 |
-
}
|
97 |
-
break;
|
98 |
-
case 'SEARCH':
|
99 |
-
if(isset($rules['rules_exclude_search']) && wp_validate_boolean($rules['rules_exclude_search']) ) {
|
100 |
-
return false;
|
101 |
-
} else if(isset($rules['rules_search_instances']) && is_array($rules['rules_search_instances']) && (in_array($wpInsertPostInstance, $rules['rules_search_instances']))) {
|
102 |
-
return false;
|
103 |
-
}
|
104 |
-
break;
|
105 |
-
case 'PAGE':
|
106 |
-
if(isset($rules['rules_exclude_page']) && wp_validate_boolean($rules['rules_exclude_page']) ) {
|
107 |
-
return false;
|
108 |
-
} else if(isset($rules['rules_page_exceptions']) && is_array($rules['rules_page_exceptions']) && (in_array($page_details['ID'], $rules['rules_page_exceptions']))) {
|
109 |
-
return false;
|
110 |
-
}
|
111 |
-
break;
|
112 |
-
case 'POST':
|
113 |
-
if(isset($rules['rules_exclude_post']) && wp_validate_boolean($rules['rules_exclude_post']) ) {
|
114 |
-
return false;
|
115 |
-
} else if(isset($rules['rules_post_exceptions']) && is_array($rules['rules_post_exceptions']) && (in_array($page_details['ID'], $rules['rules_post_exceptions']))) {
|
116 |
-
return false;
|
117 |
-
} else if(isset($rules['rules_post_categories_exceptions']) && isset($page_details['categories']) && is_array($rules['rules_post_categories_exceptions']) && is_array($page_details['categories']) && (count(array_intersect($page_details['categories'], $rules['rules_post_categories_exceptions'])) > 0)) {
|
118 |
-
return false;
|
119 |
-
}
|
120 |
-
break;
|
121 |
-
case 'CATEGORY':
|
122 |
-
if(isset($rules['rules_exclude_categories']) && wp_validate_boolean($rules['rules_exclude_categories']) ) {
|
123 |
-
return false;
|
124 |
-
} else if(isset($rules['rules_categories_exceptions']) && is_array($rules['rules_categories_exceptions']) && (in_array($page_details['ID'], $rules['rules_categories_exceptions']))) {
|
125 |
-
return false;
|
126 |
-
} else if(isset($rules['rules_categories_instances']) && is_array($rules['rules_categories_instances']) && (in_array($wpInsertPostInstance, $rules['rules_categories_instances']))) {
|
127 |
-
return false;
|
128 |
-
}
|
129 |
-
break;
|
130 |
-
case '404':
|
131 |
-
if(isset($rules['rules_exclude_404']) && wp_validate_boolean($rules['rules_exclude_404'])) {
|
132 |
-
return false;
|
133 |
-
}
|
134 |
-
break;
|
135 |
-
case 'CUSTOM':
|
136 |
-
if(isset($rules['rules_exclude_cpt_'.$page_details['type_name']]) && wp_validate_boolean($rules['rules_exclude_cpt_'.$page_details['type_name']])) {
|
137 |
-
return false;
|
138 |
-
}
|
139 |
-
break;
|
140 |
-
}
|
141 |
-
return true;
|
142 |
-
}
|
143 |
-
/* End Get Ad Status */
|
144 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/modules/adstxt/css/module.css
DELETED
File without changes
|
includes/modules/adstxt/module.php
DELETED
@@ -1,37 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
require_once(dirname(__FILE__).'/functions.php');
|
3 |
-
|
4 |
-
/* Begin Add Assets */
|
5 |
-
/*add_action('wp_insert_modules_css', 'wp_insert_module_adstxt_css', 0);
|
6 |
-
function wp_insert_module_adstxt_css() {
|
7 |
-
wp_register_style('wp-insert-module-adstxt-css', WP_INSERT_URL.'includes/modules/adstxt/css/module.css', array('wp-insert-css'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
|
8 |
-
wp_enqueue_style('wp-insert-module-adstxt-css');
|
9 |
-
}*/
|
10 |
-
|
11 |
-
add_action('wp_insert_modules_js', 'wp_insert_module_adstxt_js', 0);
|
12 |
-
function wp_insert_module_adstxt_js() {
|
13 |
-
wp_register_script('wp-insert-module-adstxt-js', WP_INSERT_URL.'includes/modules/adstxt/js/module.js', array('wp-insert-js'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
|
14 |
-
wp_enqueue_script('wp-insert-module-adstxt-js');
|
15 |
-
}
|
16 |
-
/* End Add Assets */
|
17 |
-
|
18 |
-
/* Begin Add Card in Admin Panel */
|
19 |
-
add_action('wp_insert_plugin_card', 'wp_insert_adstxt_plugin_card', 100);
|
20 |
-
function wp_insert_adstxt_plugin_card() {
|
21 |
-
echo '<div class="plugin-card adstxt-card">';
|
22 |
-
echo '<div class="plugin-card-top">';
|
23 |
-
echo '<h4>Authorized Digital Sellers / ads.txt</h4>';
|
24 |
-
echo '<p>Authorized Digital Sellers, or ads.txt, is an <a href="https://iabtechlab.com/">IAB</a> initiative to improve transparency in programmatic advertising.</p>';
|
25 |
-
echo '<p>You can easily manage your ads.txt from within Wp-Insert, providing confidence to brands they are buying authentic publisher inventory, protect you from counterfiet inventory and might even lead to higher monetization for your ad invertory.</p>';
|
26 |
-
echo '</div>';
|
27 |
-
echo '<div class="plugin-card-bottom">';
|
28 |
-
if(wp_insert_adstxt_file_exists()) {
|
29 |
-
echo '<a id="wp_insert_adstxt_generate" href="javascript:;" class="button button-primary">Modify ads.txt</a>';
|
30 |
-
} else {
|
31 |
-
echo '<a id="wp_insert_adstxt_generate" href="javascript:;" class="button button-primary">Generate ads.txt</a>';
|
32 |
-
}
|
33 |
-
echo '</div>';
|
34 |
-
echo '</div>';
|
35 |
-
}
|
36 |
-
/* End Add Card in Admin Panel */
|
37 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/modules/adwidgets/functions.php
DELETED
@@ -1,273 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/* Begin Add New Adwidget Content */
|
3 |
-
add_action('wp_ajax_wp_insert_adwidgets_new_form_get_content', 'wp_insert_adwidgets_new_form_get_content');
|
4 |
-
function wp_insert_adwidgets_new_form_get_content() {
|
5 |
-
check_ajax_referer('wp-insert', 'wp_insert_nonce');
|
6 |
-
wp_insert_adwidgets_form_get_content(uniqid());
|
7 |
-
die();
|
8 |
-
}
|
9 |
-
/* End Add New Adwidget Content */
|
10 |
-
|
11 |
-
/* Begin Edit Adwidget Content */
|
12 |
-
add_action('wp_ajax_wp_insert_adwidgets_existing_form_get_content', 'wp_insert_adwidgets_existing_form_get_content');
|
13 |
-
function wp_insert_adwidgets_existing_form_get_content() {
|
14 |
-
check_ajax_referer('wp-insert', 'wp_insert_nonce');
|
15 |
-
if(isset($_POST['wp_insert_adwidgets_identifier'])) {
|
16 |
-
wp_insert_adwidgets_form_get_content($_POST['wp_insert_adwidgets_identifier']);
|
17 |
-
}
|
18 |
-
die();
|
19 |
-
}
|
20 |
-
|
21 |
-
add_action('wp_ajax_wp_insert_adwidgets_existing_form_save_action', 'wp_insert_adwidgets_existing_form_save_action');
|
22 |
-
function wp_insert_adwidgets_existing_form_save_action() {
|
23 |
-
check_ajax_referer('wp-insert', 'wp_insert_nonce');
|
24 |
-
if(isset($_POST['wp_insert_adwidgets_identifier'])) {
|
25 |
-
wp_insert_adwidgets_form_save_action($_POST['wp_insert_adwidgets_identifier']);
|
26 |
-
}
|
27 |
-
die();
|
28 |
-
}
|
29 |
-
/* End Edit Adwidget Content */
|
30 |
-
|
31 |
-
/* Begin Delete Adwidget Content */
|
32 |
-
add_action('wp_ajax_wp_insert_adwidgets_remove', 'wp_insert_adwidgets_remove');
|
33 |
-
function wp_insert_adwidgets_remove() {
|
34 |
-
check_ajax_referer('wp-insert', 'wp_insert_nonce');
|
35 |
-
if(isset($_POST['wp_insert_adwidgets_identifier'])) {
|
36 |
-
$adwidgets = get_option('wp_insert_adwidgets');
|
37 |
-
unset($adwidgets[$_POST['wp_insert_adwidgets_identifier']]);
|
38 |
-
update_option('wp_insert_adwidgets', $adwidgets);
|
39 |
-
}
|
40 |
-
die();
|
41 |
-
}
|
42 |
-
/* End Delete Adwidget Content */
|
43 |
-
|
44 |
-
/* Begin Shared UI Functions */
|
45 |
-
function wp_insert_adwidgets_form_get_content($identifier) {
|
46 |
-
$adwidgets = get_option('wp_insert_adwidgets');
|
47 |
-
echo '<div class="wp_insert_popup_content_wrapper">';
|
48 |
-
$control = new smartlogixControls(array('optionIdentifier' => 'wp_insert_adwidgets['.$identifier.']', 'values' => $adwidgets[$identifier]));
|
49 |
-
$control->add_control(array('type' => 'ipCheckbox', 'className' => 'wp_insert_adwidgets_status', 'optionName' => 'status'));
|
50 |
-
$control->add_control(array('type' => 'hidden', 'className' => 'wp_insert_adwidgets_identifier', 'optionName' => 'identifier', 'value' => $identifier));
|
51 |
-
echo $control->HTML;
|
52 |
-
$control->clear_controls();
|
53 |
-
echo '<div id="wp_insert_adwidgets_'.$identifier.'_accordion">';
|
54 |
-
echo '<h3>Ad Code</h3>';
|
55 |
-
echo '<div>';
|
56 |
-
$abtestingMode = get_option('wp_insert_abtesting_mode');
|
57 |
-
$control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'primary_ad_code'));
|
58 |
-
$control->create_section('Ad Code (Primary Network)');
|
59 |
-
echo $control->HTML;
|
60 |
-
$control->clear_controls();
|
61 |
-
|
62 |
-
$control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'secondary_ad_code'));
|
63 |
-
$control->create_section('Ad Code (Secondary Network)');
|
64 |
-
if($abtestingMode != '2' && $abtestingMode != '3') {
|
65 |
-
$control->set_HTML('<div style="display: none;">'.$control->HTML.'</div>');
|
66 |
-
}
|
67 |
-
echo $control->HTML;
|
68 |
-
$control->clear_controls();
|
69 |
-
|
70 |
-
$control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'tertiary_ad_code'));
|
71 |
-
$control->create_section('Ad Code (Tertiary Network)');
|
72 |
-
if($abtestingMode != '3') {
|
73 |
-
$control->set_HTML('<div style="display: none;">'.$control->HTML.'</div>');
|
74 |
-
}
|
75 |
-
echo $control->HTML;
|
76 |
-
$control->clear_controls();
|
77 |
-
echo '</div>';
|
78 |
-
echo '<h3>Rules</h3>';
|
79 |
-
echo '<div>';
|
80 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_loggedin'));
|
81 |
-
$control->create_section('Logged in Users');
|
82 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
|
83 |
-
echo $control->HTML;
|
84 |
-
$control->clear_controls();
|
85 |
-
|
86 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_mobile_devices'));
|
87 |
-
$control->create_section('Mobile Devices');
|
88 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
89 |
-
echo $control->HTML;
|
90 |
-
$control->clear_controls();
|
91 |
-
|
92 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_404'));
|
93 |
-
$control->create_section('404 Pages');
|
94 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
|
95 |
-
echo $control->HTML;
|
96 |
-
$control->clear_controls();
|
97 |
-
|
98 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_home'));
|
99 |
-
$control->create_section('Home');
|
100 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
101 |
-
echo $control->HTML;
|
102 |
-
$control->clear_controls();
|
103 |
-
|
104 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_archives'));
|
105 |
-
$control->create_section('Archives');
|
106 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
|
107 |
-
echo $control->HTML;
|
108 |
-
$control->clear_controls();
|
109 |
-
|
110 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_search'));
|
111 |
-
$control->create_section('Search Results');
|
112 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
113 |
-
echo $control->HTML;
|
114 |
-
$control->clear_controls();
|
115 |
-
|
116 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_page'));
|
117 |
-
$control->add_control(array('type' => 'pages-chosen-multiselect', 'label' => 'Exceptions', 'optionName' => 'rules_page_exceptions'));
|
118 |
-
$control->create_section('Single Pages');
|
119 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
|
120 |
-
echo $control->HTML;
|
121 |
-
$control->clear_controls();
|
122 |
-
|
123 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_categories'));
|
124 |
-
$control->add_control(array('type' => 'categories-chosen-multiselect', 'label' => 'Exceptions', 'optionName' => 'rules_categories_exceptions'));
|
125 |
-
$control->create_section('Category Archives');
|
126 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
127 |
-
echo $control->HTML;
|
128 |
-
$control->clear_controls();
|
129 |
-
|
130 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_post'));
|
131 |
-
$control->add_control(array('type' => 'posts-chosen-multiselect', 'label' => 'Exceptions', 'optionName' => 'rules_post_exceptions'));
|
132 |
-
$control->add_control(array('type' => 'categories-chosen-multiselect', 'label' => 'Category Exceptions', 'optionName' => 'rules_post_categories_exceptions'));
|
133 |
-
$control->create_section('Single Posts');
|
134 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
135 |
-
echo $control->HTML;
|
136 |
-
$control->clear_controls();
|
137 |
-
|
138 |
-
echo '</div>';
|
139 |
-
echo '<h3>Geo Targeting</h3>';
|
140 |
-
echo '<div>';
|
141 |
-
echo '<p>';
|
142 |
-
echo 'A Geo Targeted Ads have a higher priority than Ads configured via Multiple Ad Networks / A-B Testing.<br />';
|
143 |
-
echo 'If a Geo Targeting match is found all other Ads (Primary, Secondary and Tertiary Networks) will be ignored.';
|
144 |
-
echo '</p>';
|
145 |
-
$control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Countries', 'optionName' => 'geo_group1_countries', 'options' => wp_insert_get_countries()));
|
146 |
-
$control->add_control(array('type' => 'textarea', 'label' => 'Ad Code', 'style' => 'height: 220px;', 'optionName' => 'geo_group1_adcode'));
|
147 |
-
$control->create_section('Group 1');
|
148 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
|
149 |
-
echo $control->HTML;
|
150 |
-
$control->clear_controls();
|
151 |
-
|
152 |
-
$control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Countries', 'optionName' => 'geo_group2_countries', 'options' => wp_insert_get_countries()));
|
153 |
-
$control->add_control(array('type' => 'textarea', 'label' => 'Ad Code', 'style' => 'height: 220px;', 'optionName' => 'geo_group2_adcode'));
|
154 |
-
$control->create_section('Group 2');
|
155 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
156 |
-
echo $control->HTML;
|
157 |
-
$control->clear_controls();
|
158 |
-
echo '<p>';
|
159 |
-
echo 'This feature uses the Free Geo ip service from <a href="http://freegeoip.net/">freegeoip.net</a>, if you find this feature useful please consider donating to the project at <a href="http://freegeoip.net/">freegeoip.net</a>';
|
160 |
-
echo '</p>';
|
161 |
-
echo '</div>';
|
162 |
-
echo '<h3>Styles</h3>';
|
163 |
-
echo '<div>';
|
164 |
-
$control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'styles'));
|
165 |
-
$control->create_section('Styles');
|
166 |
-
echo $control->HTML;
|
167 |
-
$control->clear_controls();
|
168 |
-
echo '</div>';
|
169 |
-
echo '<h3>Notes</h3>';
|
170 |
-
echo '<div>';
|
171 |
-
$control->add_control(array('type' => 'text', 'optionName' => 'title', 'helpText' => 'The title is used to identify your Ad Widget easily in future. A Random Title will be assigned to your Ad widget by default.', 'value' => ((isset($adwidgets[$identifier]['title']))?$adwidgets[$identifier]['title']:$identifier)));
|
172 |
-
$control->create_section('Title');
|
173 |
-
echo $control->HTML;
|
174 |
-
$control->clear_controls();
|
175 |
-
|
176 |
-
$control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'notes'));
|
177 |
-
$control->create_section('Notes');
|
178 |
-
echo $control->HTML;
|
179 |
-
$control->clear_controls();
|
180 |
-
echo '</div>';
|
181 |
-
echo '</div>';
|
182 |
-
echo '<script type="text/javascript">';
|
183 |
-
echo $control->JS;
|
184 |
-
echo 'jQuery("#wp_insert_adwidgets_'.$identifier.'_accordion").accordion({ icons: { header: "ui-icon-circle-arrow-e", activeHeader: "ui-icon-circle-arrow-s" }, heightStyle: "auto" });';
|
185 |
-
echo '</script>';
|
186 |
-
echo '</div>';
|
187 |
-
}
|
188 |
-
|
189 |
-
function wp_insert_adwidgets_form_save_action($identifier) {
|
190 |
-
$adwidgets = get_option('wp_insert_adwidgets');
|
191 |
-
$adwidgets[$identifier]['identifier'] = ((isset($_POST['wp_insert_adwidgets_identifier']))?$_POST['wp_insert_adwidgets_identifier']:'');
|
192 |
-
$adwidgets[$identifier]['status'] = ((isset($_POST['wp_insert_adwidgets_'.$identifier.'_status']) && ($_POST['wp_insert_adwidgets_'.$identifier.'_status'] == 'true'))?'1':'');
|
193 |
-
|
194 |
-
$adwidgets[$identifier]['primary_ad_code'] = ((isset($_POST['wp_insert_adwidgets_'.$identifier.'_primary_ad_code']))?$_POST['wp_insert_adwidgets_'.$identifier.'_primary_ad_code']:'');
|
195 |
-
$adwidgets[$identifier]['secondary_ad_code'] = ((isset($_POST['wp_insert_adwidgets_'.$identifier.'_secondary_ad_code']))?$_POST['wp_insert_adwidgets_'.$identifier.'_secondary_ad_code']:'');
|
196 |
-
$adwidgets[$identifier]['tertiary_ad_code'] = ((isset($_POST['wp_insert_adwidgets_'.$identifier.'_tertiary_ad_code']))?$_POST['wp_insert_adwidgets_'.$identifier.'_tertiary_ad_code']:'');
|
197 |
-
|
198 |
-
$adwidgets[$identifier]['rules_exclude_loggedin'] = ((isset($_POST['wp_insert_adwidgets_'.$identifier.'_rules_exclude_loggedin']))?$_POST['wp_insert_adwidgets_'.$identifier.'_rules_exclude_loggedin']:'');
|
199 |
-
$adwidgets[$identifier]['rules_exclude_mobile_devices'] = ((isset($_POST['wp_insert_adwidgets_'.$identifier.'_rules_exclude_mobile_devices']))?$_POST['wp_insert_adwidgets_'.$identifier.'_rules_exclude_mobile_devices']:'');
|
200 |
-
$adwidgets[$identifier]['rules_exclude_404'] = ((isset($_POST['wp_insert_adwidgets_'.$identifier.'_rules_exclude_404']))?$_POST['wp_insert_adwidgets_'.$identifier.'_rules_exclude_404']:'');
|
201 |
-
$adwidgets[$identifier]['rules_exclude_home'] = ((isset($_POST['wp_insert_adwidgets_'.$identifier.'_rules_exclude_home']))?$_POST['wp_insert_adwidgets_'.$identifier.'_rules_exclude_home']:'');
|
202 |
-
$adwidgets[$identifier]['rules_exclude_archives'] = ((isset($_POST['wp_insert_adwidgets_'.$identifier.'_rules_exclude_archives']))?$_POST['wp_insert_adwidgets_'.$identifier.'_rules_exclude_archives']:'');
|
203 |
-
$adwidgets[$identifier]['rules_exclude_search'] = ((isset($_POST['wp_insert_adwidgets_'.$identifier.'_rules_exclude_search']))?$_POST['wp_insert_adwidgets_'.$identifier.'_rules_exclude_search']:'');
|
204 |
-
$adwidgets[$identifier]['rules_exclude_page'] = ((isset($_POST['wp_insert_adwidgets_'.$identifier.'_rules_exclude_page']))?$_POST['wp_insert_adwidgets_'.$identifier.'_rules_exclude_page']:'');
|
205 |
-
$adwidgets[$identifier]['rules_page_exceptions'] = ((isset($_POST['wp_insert_adwidgets_'.$identifier.'_rules_page_exceptions']))?$_POST['wp_insert_adwidgets_'.$identifier.'_rules_page_exceptions']:'');
|
206 |
-
$adwidgets[$identifier]['rules_exclude_post'] = ((isset($_POST['wp_insert_adwidgets_'.$identifier.'_rules_exclude_post']))?$_POST['wp_insert_adwidgets_'.$identifier.'_rules_exclude_post']:'');
|
207 |
-
$adwidgets[$identifier]['rules_post_exceptions'] = ((isset($_POST['wp_insert_adwidgets_'.$identifier.'_rules_post_exceptions']))?$_POST['wp_insert_adwidgets_'.$identifier.'_rules_post_exceptions']:'');
|
208 |
-
$adwidgets[$identifier]['rules_post_categories_exceptions'] = ((isset($_POST['wp_insert_adwidgets_'.$identifier.'_rules_post_categories_exceptions']))?$_POST['wp_insert_adwidgets_'.$identifier.'_rules_post_categories_exceptions']:'');
|
209 |
-
$adwidgets[$identifier]['rules_exclude_categories'] = ((isset($_POST['wp_insert_adwidgets_'.$identifier.'_rules_exclude_categories']))?$_POST['wp_insert_adwidgets_'.$identifier.'_rules_exclude_categories']:'');
|
210 |
-
$adwidgets[$identifier]['rules_categories_exceptions'] = ((isset($_POST['wp_insert_adwidgets_'.$identifier.'_rules_categories_exceptions']))?$_POST['wp_insert_adwidgets_'.$identifier.'_rules_categories_exceptions']:'');
|
211 |
-
|
212 |
-
$adwidgets[$identifier]['geo_group1_countries'] = ((isset($_POST['wp_insert_adwidgets_'.$identifier.'_geo_group1_countries']))?$_POST['wp_insert_adwidgets_'.$identifier.'_geo_group1_countries']:'');
|
213 |
-
$adwidgets[$identifier]['geo_group1_adcode'] = ((isset($_POST['wp_insert_adwidgets_'.$identifier.'_geo_group1_adcode']))?$_POST['wp_insert_adwidgets_'.$identifier.'_geo_group1_adcode']:'');
|
214 |
-
$adwidgets[$identifier]['geo_group2_countries'] = ((isset($_POST['wp_insert_adwidgets_'.$identifier.'_geo_group2_countries']))?$_POST['wp_insert_adwidgets_'.$identifier.'_geo_group2_countries']:'');
|
215 |
-
$adwidgets[$identifier]['geo_group2_adcode'] = ((isset($_POST['wp_insert_adwidgets_'.$identifier.'_geo_group2_adcode']))?$_POST['wp_insert_adwidgets_'.$identifier.'_geo_group2_adcode']:'');
|
216 |
-
|
217 |
-
$adwidgets[$identifier]['styles'] = ((isset($_POST['wp_insert_adwidgets_'.$identifier.'_styles']))?$_POST['wp_insert_adwidgets_'.$identifier.'_styles']:'');
|
218 |
-
|
219 |
-
$adwidgets[$identifier]['title'] = ((isset($_POST['wp_insert_adwidgets_'.$identifier.'_title']))?$_POST['wp_insert_adwidgets_'.$identifier.'_title']:'');
|
220 |
-
$adwidgets[$identifier]['notes'] = ((isset($_POST['wp_insert_adwidgets_'.$identifier.'_notes']))?$_POST['wp_insert_adwidgets_'.$identifier.'_notes']:'');
|
221 |
-
update_option('wp_insert_adwidgets', $adwidgets);
|
222 |
-
}
|
223 |
-
/* End Shared UI Functions */
|
224 |
-
|
225 |
-
/* Begin Ad Widget Insertion */
|
226 |
-
add_action('widgets_init', create_function('', 'register_widget("wpInsertAdWidget");'));
|
227 |
-
class wpInsertAdWidget extends WP_Widget {
|
228 |
-
public function __construct() {
|
229 |
-
parent::__construct('wp_insert_ad_widget', 'Wp-Insert Ad Widget', array('description' => 'Wp-Insert Ad Widget'));
|
230 |
-
}
|
231 |
-
|
232 |
-
public function widget($args, $instance) {
|
233 |
-
extract($args);
|
234 |
-
$title = apply_filters('widget_title', $instance['title']);
|
235 |
-
$adwidgets = get_option('wp_insert_adwidgets');
|
236 |
-
if(wp_insert_get_ad_status($adwidgets[$instance['instance']])) {
|
237 |
-
echo $before_widget;
|
238 |
-
if(!empty($title)) { echo $before_title.$title.$after_title; }
|
239 |
-
echo '<div class="wpInsert wpInsertAdWidget"'.(($adwidgets[$instance['instance']]['styles'] != '')?' style="'.$adwidgets[$instance['instance']]['styles'].'"':'').'>'.wp_insert_get_geotargeted_adcode($adwidgets[$instance['instance']]).'</div>';
|
240 |
-
echo $after_widget;
|
241 |
-
}
|
242 |
-
}
|
243 |
-
|
244 |
-
public function update($new_opts, $old_opts) {
|
245 |
-
$opts = array();
|
246 |
-
$opts['title'] = $new_opts['title'];
|
247 |
-
$opts['instance'] = $new_opts['instance'];
|
248 |
-
return $opts;
|
249 |
-
}
|
250 |
-
|
251 |
-
public function form($instance) {
|
252 |
-
$adwidgets = get_option('wp_insert_adwidgets');
|
253 |
-
echo '<p>';
|
254 |
-
echo '<label for="'.$this->get_field_id('title').'">Title:</label>';
|
255 |
-
echo '<input class="widefat" id="'.$this->get_field_id('title').'" name="'.$this->get_field_name('title').'" type="text" value="'.$instance['title'].'" />';
|
256 |
-
echo '</p>';
|
257 |
-
echo '<p>';
|
258 |
-
if(is_array($adwidgets) && (count($adwidgets) > 0)) {
|
259 |
-
echo '<label for="'.$this->get_field_id('instance').'">Select Ad-Widget:</label>';
|
260 |
-
echo '<select class="widefat" id="'.$this->get_field_id('instance').'" name="'.$this->get_field_name('instance').'">';
|
261 |
-
foreach($adwidgets as $adwidget) {
|
262 |
-
echo '<option value="'.$adwidget['identifier'].'" '.selected($adwidget['identifier'], $instance['instance'], false).'>Ad Widget : '.$adwidget['title'].'</option>';
|
263 |
-
}
|
264 |
-
echo '</select>';
|
265 |
-
} else {
|
266 |
-
echo 'Please <a href="'.admin_url('admin.php?page=wp-insert').'">Configure an Ad-Widget</a> to Proceed.';
|
267 |
-
echo '<input class="widefat" id="'.$this->get_field_id('instance').'" name="'.$this->get_field_name('instance').'" type="hidden" value="" />';
|
268 |
-
}
|
269 |
-
echo '</p>';
|
270 |
-
}
|
271 |
-
}
|
272 |
-
/* End Ad Widget Insertion */
|
273 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/modules/adwidgets/js/module.js
DELETED
@@ -1,145 +0,0 @@
|
|
1 |
-
jQuery(document).ready(function() {
|
2 |
-
wp_insert_click_handler(
|
3 |
-
'wp_insert_adwidgets_new',
|
4 |
-
'Ad Widget : Add New',
|
5 |
-
jQuery("body").width() * 0.8,
|
6 |
-
jQuery("body").height() * 0.8,
|
7 |
-
function() {
|
8 |
-
jQuery('.wp_insert_adwidgets_status').parent().css({'display': 'inline-block', 'margin': '5px 0 0'}).prependTo('.ui-dialog-buttonpane');
|
9 |
-
},
|
10 |
-
function() {
|
11 |
-
var identifier = jQuery(".wp_insert_adwidgets_identifier").val();
|
12 |
-
var adwidgetLink = jQuery("<a></a>");
|
13 |
-
adwidgetLink.attr("id", "wp_insert_adwidgets_"+identifier);
|
14 |
-
adwidgetLink.attr("href", "javascript:;");
|
15 |
-
adwidgetLink.attr("onClick", "wp_insert_adwidgets_click_handler(\'"+identifier+"\', \'"+jQuery("#wp_insert_adwidgets_"+identifier+"_title").val()+"\')");
|
16 |
-
adwidgetLink.html("Ad Widget : "+jQuery("#wp_insert_adwidgets_"+identifier+"_title").val());
|
17 |
-
var deleteButton = jQuery("<span></span>");
|
18 |
-
deleteButton.attr("class", "dashicons dashicons-dismiss wp_insert_delete_icon");
|
19 |
-
deleteButton.attr("onClick", "wp_insert_adwidgets_remove(\'"+identifier+"\')");
|
20 |
-
jQuery("#wp_insert_adwidgets_new").parent().before(jQuery("<p></p>").append(adwidgetLink, deleteButton));
|
21 |
-
wp_insert_adwidgets_update(identifier);
|
22 |
-
},
|
23 |
-
function() { }
|
24 |
-
);
|
25 |
-
});
|
26 |
-
|
27 |
-
function wp_insert_adwidgets_click_handler(identifier, title) {
|
28 |
-
jQuery('<div id="wp_insert_adwidgets_'+identifier+'_dialog"></div>').html('<div class="wp_insert_ajaxloader"></div>').dialog({
|
29 |
-
'modal': true,
|
30 |
-
'resizable': false,
|
31 |
-
'width': jQuery("body").width() * 0.8,
|
32 |
-
'maxWidth': jQuery("body").width() * 0.8,
|
33 |
-
'maxHeight': jQuery("body").height() * 0.9,
|
34 |
-
'title': 'Ad Widget : '+title,
|
35 |
-
position: { my: 'center', at: 'center', of: window },
|
36 |
-
open: function (event, ui) {
|
37 |
-
jQuery('.ui-dialog').css({'z-index': 999999, 'max-width': '90%'});
|
38 |
-
jQuery('.ui-widget-overlay').css({'z-index': 999998, 'opacity': 0.8, 'background': '#000000'});
|
39 |
-
jQuery('.ui-dialog-buttonpane button:contains("Update")').button('disable');
|
40 |
-
jQuery.post(
|
41 |
-
jQuery('#wp_insert_admin_ajax').val(), {
|
42 |
-
'action': 'wp_insert_adwidgets_existing_form_get_content',
|
43 |
-
'wp_insert_adwidgets_identifier': identifier,
|
44 |
-
'wp_insert_nonce': jQuery('#wp_insert_nonce').val()
|
45 |
-
}, function(response) {
|
46 |
-
jQuery('.wp_insert_ajaxloader').hide();
|
47 |
-
jQuery('.ui-dialog-content').html(response);
|
48 |
-
jQuery('.ui-accordion .ui-accordion-content').css('max-height', (jQuery("body").height() * 0.45));
|
49 |
-
jQuery('.ui-dialog-buttonpane button:contains("Update")').button('enable');
|
50 |
-
jQuery('.wp_insert_adwidgets_status').parent().css({'display': 'inline-block', 'margin': '5px 0 0'}).prependTo('.ui-dialog-buttonpane');
|
51 |
-
jQuery('.ui-dialog').css({'position': 'fixed'});
|
52 |
-
jQuery('#wp_insert_adwidgets_'+identifier+'_dialog').delay(500).dialog({position: { my: 'center', at: 'center', of: window }});
|
53 |
-
}
|
54 |
-
);
|
55 |
-
},
|
56 |
-
buttons: {
|
57 |
-
'Update': function() {
|
58 |
-
jQuery("#wp_insert_adwidgets_"+identifier).html("Ad Widget : "+jQuery("#wp_insert_adwidgets_"+identifier+"_title").val());
|
59 |
-
jQuery("#wp_insert_adwidgets_"+identifier).attr("onClick", "wp_insert_adwidgets_click_handler(\'"+identifier+"\', \'"+jQuery("#wp_insert_adwidgets_"+identifier+"_title").val()+"\')");
|
60 |
-
wp_insert_adwidgets_update(identifier);
|
61 |
-
jQuery(this).dialog('close');
|
62 |
-
},
|
63 |
-
Cancel: function() {
|
64 |
-
jQuery(this).dialog('close');
|
65 |
-
}
|
66 |
-
},
|
67 |
-
close: function() {
|
68 |
-
jQuery(this).dialog('destroy');
|
69 |
-
}
|
70 |
-
});
|
71 |
-
}
|
72 |
-
|
73 |
-
function wp_insert_adwidgets_update(identifier) {
|
74 |
-
args = {};
|
75 |
-
args['action'] = 'wp_insert_adwidgets_existing_form_save_action';
|
76 |
-
args['wp_insert_nonce'] = jQuery('#wp_insert_nonce').val();
|
77 |
-
args['wp_insert_adwidgets_identifier'] = identifier;
|
78 |
-
args['wp_insert_adwidgets_'+identifier+'_status'] = jQuery('#wp_insert_adwidgets_'+identifier+'_status').prop('checked');
|
79 |
-
|
80 |
-
args['wp_insert_adwidgets_'+identifier+'_title'] = jQuery('#wp_insert_adwidgets_'+identifier+'_title').val();
|
81 |
-
|
82 |
-
args['wp_insert_adwidgets_'+identifier+'_primary_ad_code'] = jQuery('#wp_insert_adwidgets_'+identifier+'_primary_ad_code').val();
|
83 |
-
args['wp_insert_adwidgets_'+identifier+'_secondary_ad_code'] = jQuery('#wp_insert_adwidgets_'+identifier+'_secondary_ad_code').val();
|
84 |
-
args['wp_insert_adwidgets_'+identifier+'_tertiary_ad_code'] = jQuery('#wp_insert_adwidgets_'+identifier+'_tertiary_ad_code').val();
|
85 |
-
|
86 |
-
args['wp_insert_adwidgets_'+identifier+'_rules_exclude_loggedin'] = jQuery('#wp_insert_adwidgets_'+identifier+'_rules_exclude_loggedin').prop('checked');
|
87 |
-
args['wp_insert_adwidgets_'+identifier+'_rules_exclude_mobile_devices'] = jQuery('#wp_insert_adwidgets_'+identifier+'_rules_exclude_mobile_devices').prop('checked');
|
88 |
-
args['wp_insert_adwidgets_'+identifier+'_rules_exclude_404'] = jQuery('#wp_insert_adwidgets_'+identifier+'_rules_exclude_404').prop('checked');
|
89 |
-
args['wp_insert_adwidgets_'+identifier+'_rules_exclude_home'] = jQuery('#wp_insert_adwidgets_'+identifier+'_rules_exclude_home').prop('checked');
|
90 |
-
args['wp_insert_adwidgets_'+identifier+'_rules_exclude_archives'] = jQuery('#wp_insert_adwidgets_'+identifier+'_rules_exclude_archives').prop('checked');
|
91 |
-
args['wp_insert_adwidgets_'+identifier+'_rules_exclude_search'] = jQuery('#wp_insert_adwidgets_'+identifier+'_rules_exclude_search').prop('checked');
|
92 |
-
args['wp_insert_adwidgets_'+identifier+'_rules_exclude_page'] = jQuery('#wp_insert_adwidgets_'+identifier+'_rules_exclude_page').prop('checked');
|
93 |
-
args['wp_insert_adwidgets_'+identifier+'_rules_page_exceptions'] = jQuery.map(jQuery('#wp_insert_adwidgets_'+identifier+'_rules_page_exceptions :selected'), function(e) { return jQuery(e).val(); });
|
94 |
-
args['wp_insert_adwidgets_'+identifier+'_rules_exclude_post'] = jQuery('#wp_insert_adwidgets_'+identifier+'_rules_exclude_post').prop('checked');
|
95 |
-
args['wp_insert_adwidgets_'+identifier+'_rules_post_exceptions'] = jQuery.map(jQuery('#wp_insert_adwidgets_'+identifier+'_rules_post_exceptions :selected'), function(e) { return jQuery(e).val(); });
|
96 |
-
args['wp_insert_adwidgets_'+identifier+'_rules_post_categories_exceptions'] = jQuery.map(jQuery('#wp_insert_adwidgets_'+identifier+'_rules_post_categories_exceptions :selected'), function(e) { return jQuery(e).val(); });
|
97 |
-
args['wp_insert_adwidgets_'+identifier+'_rules_exclude_categories'] = jQuery('#wp_insert_adwidgets_'+identifier+'_rules_exclude_categories').prop('checked');
|
98 |
-
args['wp_insert_adwidgets_'+identifier+'_rules_categories_exceptions'] = jQuery.map(jQuery('#wp_insert_adwidgets_'+identifier+'_rules_categories_exceptions :selected'), function(e) { return jQuery(e).val(); });
|
99 |
-
|
100 |
-
args['wp_insert_adwidgets_'+identifier+'_geo_group1_countries'] = jQuery.map(jQuery('#wp_insert_adwidgets_'+identifier+'_geo_group1_countries :selected'), function(e) { return jQuery(e).val(); });
|
101 |
-
args['wp_insert_adwidgets_'+identifier+'_geo_group1_adcode'] = jQuery('#wp_insert_adwidgets_'+identifier+'_geo_group1_adcode').val();
|
102 |
-
args['wp_insert_adwidgets_'+identifier+'_geo_group2_countries'] = jQuery.map(jQuery('#wp_insert_adwidgets_'+identifier+'_geo_group2_countries :selected'), function(e) { return jQuery(e).val(); });
|
103 |
-
args['wp_insert_adwidgets_'+identifier+'_geo_group2_adcode'] = jQuery('#wp_insert_adwidgets_'+identifier+'_geo_group2_adcode').val();
|
104 |
-
|
105 |
-
args['wp_insert_adwidgets_'+identifier+'_styles'] = jQuery('#wp_insert_adwidgets_'+identifier+'_styles').val();
|
106 |
-
|
107 |
-
args['wp_insert_adwidgets_'+identifier+'_notes'] = jQuery('#wp_insert_adwidgets_'+identifier+'_notes').val();
|
108 |
-
|
109 |
-
jQuery.post(
|
110 |
-
jQuery('#wp_insert_admin_ajax').val(), args, function(response) { }
|
111 |
-
);
|
112 |
-
}
|
113 |
-
|
114 |
-
function wp_insert_adwidgets_remove(identifier) {
|
115 |
-
jQuery("<p>Are you Sure you want to remove this Ad Unit?</p>").dialog({
|
116 |
-
'modal': true,
|
117 |
-
'resizable': false,
|
118 |
-
'title': 'Deletion Confirmation',
|
119 |
-
position: { my: 'center', at: 'center', of: window },
|
120 |
-
open: function (event, ui) {
|
121 |
-
jQuery('.ui-dialog').css({'z-index': 999999, 'max-width': '90%'});
|
122 |
-
jQuery('.ui-widget-overlay').css({'z-index': 999998, 'opacity': 0.8, 'background': '#000000'});
|
123 |
-
},
|
124 |
-
buttons : {
|
125 |
-
'Confirm': function() {
|
126 |
-
jQuery("#wp_insert_adwidgets_"+identifier).parent().remove();
|
127 |
-
jQuery.post(
|
128 |
-
jQuery('#wp_insert_admin_ajax').val(), {
|
129 |
-
'action': 'wp_insert_adwidgets_remove',
|
130 |
-
'wp_insert_adwidgets_identifier': identifier,
|
131 |
-
'wp_insert_nonce': jQuery('#wp_insert_nonce').val()
|
132 |
-
}, function(response) {
|
133 |
-
}
|
134 |
-
);
|
135 |
-
jQuery(this).dialog("close");
|
136 |
-
},
|
137 |
-
'Cancel': function() {
|
138 |
-
jQuery(this).dialog("close");
|
139 |
-
}
|
140 |
-
},
|
141 |
-
close: function() {
|
142 |
-
jQuery(this).dialog('destroy');
|
143 |
-
}
|
144 |
-
});
|
145 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/modules/adwidgets/module.php
DELETED
@@ -1,41 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
require_once(dirname(__FILE__).'/functions.php');
|
3 |
-
|
4 |
-
/* Begin Add Assets */
|
5 |
-
/*add_action('wp_insert_modules_css', 'wp_insert_module_adwidgets_css', 0);
|
6 |
-
function wp_insert_module_adwidgets_css() {
|
7 |
-
wp_register_style('wp-insert-module-adwidgets-css', WP_INSERT_URL.'includes/modules/adwidgets/css/module.css', array('wp-insert-css'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
|
8 |
-
wp_enqueue_style('wp-insert-module-adwidgets-css');
|
9 |
-
}*/
|
10 |
-
|
11 |
-
add_action('wp_insert_modules_js', 'wp_insert_module_adwidgets_js', 0);
|
12 |
-
function wp_insert_module_adwidgets_js() {
|
13 |
-
wp_register_script('wp-insert-module-adwidgets-js', WP_INSERT_URL.'includes/modules/adwidgets/js/module.js', array('wp-insert-js'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
|
14 |
-
wp_enqueue_script('wp-insert-module-adwidgets-js');
|
15 |
-
}
|
16 |
-
/* End Add Assets */
|
17 |
-
|
18 |
-
/* Begin Add Card in Admin Panel */
|
19 |
-
add_action('wp_insert_plugin_card', 'wp_insert_adwidgets_plugin_card', 50);
|
20 |
-
function wp_insert_adwidgets_plugin_card() {
|
21 |
-
echo '<div class="plugin-card">';
|
22 |
-
echo '<div class="plugin-card-top">';
|
23 |
-
echo '<h4>Ad Widgets</h4>';
|
24 |
-
echo '<p>Ads shown inside widget enabled areas.</p>';
|
25 |
-
echo '</div>';
|
26 |
-
echo '<div class="plugin-card-bottom">';
|
27 |
-
$adwidgets = get_option('wp_insert_adwidgets');
|
28 |
-
if(isset($adwidgets) && is_array($adwidgets)) {
|
29 |
-
foreach($adwidgets as $key => $value) {
|
30 |
-
echo '<p>';
|
31 |
-
echo '<a id="wp_insert_adwidgets_'.$key.'" href="javascript:;" onclick="wp_insert_adwidgets_click_handler(\''.$key.'\', \''.$value['title'].'\')">Ad Widget : '.$value['title'].'</a>';
|
32 |
-
echo '<span class="dashicons dashicons-dismiss wp_insert_delete_icon" onclick="wp_insert_adwidgets_remove(\''.$key.'\')"></span>';
|
33 |
-
echo '</p>';
|
34 |
-
}
|
35 |
-
}
|
36 |
-
echo '<p style="text-align: center; padding: 20px 0 10px;"><a id="wp_insert_adwidgets_new" href="#" class="button-secondary">Add New Ad Widget</a></p>';
|
37 |
-
echo '</div>';
|
38 |
-
echo '</div>';
|
39 |
-
}
|
40 |
-
/* End Add Card in Admin Panel */
|
41 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/{common/abtesting.php → modules/core/abtesting/module.php}
RENAMED
@@ -51,14 +51,4 @@ function wp_insert_abtesting_configuration_form_save_action() {
|
|
51 |
die();
|
52 |
}
|
53 |
/* End AB Testing Content */
|
54 |
-
|
55 |
-
/* Begin Database Upgrade */
|
56 |
-
add_action('wp_insert_upgrade_database', 'wp_insert_upgrade_database');
|
57 |
-
function wp_insert_upgrade_database() {
|
58 |
-
if(!get_option('wp_insert_abtesting_mode')) {
|
59 |
-
$oldValues = get_option('wp_insert_multiple_network_status');
|
60 |
-
update_option('wp_insert_abtesting_mode', ((isset($oldValues))?$oldValues:'1'));
|
61 |
-
}
|
62 |
-
}
|
63 |
-
/* End Database Upgrade */
|
64 |
?>
|
51 |
die();
|
52 |
}
|
53 |
/* End AB Testing Content */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
54 |
?>
|
includes/modules/core/adstxt/adsense.php
ADDED
@@ -0,0 +1,238 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* Begin Admin Notice */
|
3 |
+
add_action('init', 'wp_insert_adstxt_adsense_admin_notice_reactivate');
|
4 |
+
function wp_insert_adstxt_adsense_admin_notice_reactivate() {
|
5 |
+
if(isset($_GET['wp_insert_adstxt_adsense_reset'])) {
|
6 |
+
wp_insert_adstxt_adsense_admin_notice_reset();
|
7 |
+
}
|
8 |
+
}
|
9 |
+
|
10 |
+
function wp_insert_adstxt_adsense_admin_notice_reset() {
|
11 |
+
delete_option('wp_insert_adstxt_adsense_admin_notice_dismissed');
|
12 |
+
delete_transient('wp_insert_adstxt_adsense_autocheck_content');
|
13 |
+
}
|
14 |
+
|
15 |
+
add_action('admin_notices', 'wp_insert_adstxt_adsense_admin_notice');
|
16 |
+
function wp_insert_adstxt_adsense_admin_notice() {
|
17 |
+
if(current_user_can('manage_options')) {
|
18 |
+
if(!get_option('wp_insert_adstxt_adsense_admin_notice_dismissed')) {
|
19 |
+
$adstxtNewAdsenseEntries = get_transient('wp_insert_adstxt_adsense_autocheck_content');
|
20 |
+
if($adstxtNewAdsenseEntries == '###CHECKED###') {
|
21 |
+
} else {
|
22 |
+
if($adstxtNewAdsenseEntries === false) {
|
23 |
+
$adstxtNewAdsenseEntries = wp_insert_adstxt_adsense_get_status();
|
24 |
+
}
|
25 |
+
if($adstxtNewAdsenseEntries !== false) {
|
26 |
+
set_transient('wp_insert_adstxt_adsense_autocheck_content', $adstxtNewAdsenseEntries, DAY_IN_SECONDS);
|
27 |
+
echo '<div class="notice notice-error wp_insert_adstxt_adsense_notice is-dismissible" style="padding: 15px;">';
|
28 |
+
echo '<p><b>Wp-Insert</b> had detected that your ads.txt file does not have all your Google Adsense Publisher IDs.<br />This will severely impact your adsense earnings and your immediate attention is required.</p>';
|
29 |
+
echo '<p>Your recommended google entries for ads.txt is as given below.<br />You can manually copy this to your ads.txt file or ';
|
30 |
+
$screen = get_current_screen();
|
31 |
+
if($screen->id != 'toplevel_page_wp-insert') {
|
32 |
+
echo '<a href="'.esc_url(admin_url('/admin.php?page=wp-insert#wp_insert_adstxt_adsense_auto_update')).'">CLICK HERE</a>';
|
33 |
+
} else {
|
34 |
+
echo '<a href="javascript:;" onclick="wp_insert_adstxt_adsense_auto_update()">CLICK HERE</a>';
|
35 |
+
}
|
36 |
+
echo ' to instruct Wp-Insert to try and add the entries automatically.</p>';
|
37 |
+
echo '<p><code style="display: block; padding: 2px 10px;">'.implode("<br />", $adstxtNewAdsenseEntries).'</code></p>';
|
38 |
+
echo '<p><small><i><b>We recommend you not to dismiss this notice for continued daily ads.txt monitoring. This notice will stop appearing automatically once Wp-Insert detects correct entries in ads.txt (rechecked daily).</b></i></small></p>';
|
39 |
+
echo '<div class="clear"></div>';
|
40 |
+
echo '<input type="hidden" id="wp_insert_adstxt_adsense_admin_notice_nonce" name="wp_insert_adstxt_adsense_admin_notice_nonce" value="'.wp_create_nonce('wp-insert-adstxt-adsense-admin-notice').'" />';
|
41 |
+
echo '<input type="hidden" id="wp_insert_adstxt_adsense_admin_notice_ajax" name="wp_insert_adstxt_adsense_admin_notice_ajax" value="'.admin_url('admin-ajax.php').'" />';
|
42 |
+
echo '</div>';
|
43 |
+
} else {
|
44 |
+
set_transient('wp_insert_adstxt_adsense_autocheck_content', '###CHECKED###', DAY_IN_SECONDS);
|
45 |
+
}
|
46 |
+
}
|
47 |
+
}
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
add_action('wp_ajax_wp_insert_adstxt_adsense_admin_notice_dismiss', 'wp_insert_adstxt_adsense_admin_notice_dismiss');
|
52 |
+
function wp_insert_adstxt_adsense_admin_notice_dismiss() {
|
53 |
+
check_ajax_referer('wp-insert-adstxt-adsense-admin-notice', 'wp_insert_adstxt_adsense_admin_notice_nonce');
|
54 |
+
update_option('wp_insert_adstxt_adsense_admin_notice_dismissed', 'true');
|
55 |
+
die();
|
56 |
+
}
|
57 |
+
/* End Admin Notice */
|
58 |
+
|
59 |
+
/* Begin Auto Update Ads.txt (Adsense) */
|
60 |
+
add_action('wp_ajax_wp_insert_adstxt_adsense_auto_update', 'wp_insert_adstxt_adsense_auto_update');
|
61 |
+
function wp_insert_adstxt_adsense_auto_update() {
|
62 |
+
check_ajax_referer('wp-insert-adstxt-adsense-admin-notice', 'wp_insert_adstxt_adsense_admin_notice_nonce');
|
63 |
+
$adstxtNewAdsenseEntries = wp_insert_adstxt_adsense_get_status();
|
64 |
+
if($adstxtNewAdsenseEntries !== false) {
|
65 |
+
$adstxtContent = wp_insert_adstxt_get_content();
|
66 |
+
$adstxtContentData = array_filter(explode("\n", trim($adstxtContent)), 'trim');
|
67 |
+
$adstxtUpdatedContent = array_merge($adstxtContentData, $adstxtNewAdsenseEntries);
|
68 |
+
}
|
69 |
+
|
70 |
+
if(isset($adstxtUpdatedContent) && is_array($adstxtUpdatedContent) && (count($adstxtUpdatedContent) > 0)) {
|
71 |
+
$adstxtUpdatedContent = implode("\n", $adstxtUpdatedContent);
|
72 |
+
if(wp_insert_adstxt_update_content($adstxtUpdatedContent)) {
|
73 |
+
echo '###SUCCESS###';
|
74 |
+
} else {
|
75 |
+
echo wp_insert_adstxt_updation_failed_message($adstxtUpdatedContent);
|
76 |
+
}
|
77 |
+
}
|
78 |
+
die();
|
79 |
+
}
|
80 |
+
/* End Auto Update Ads.txt (Adsense) */
|
81 |
+
|
82 |
+
/* Begin ads.txt Adsense Check */
|
83 |
+
function wp_insert_adstxt_adsense_get_status() {
|
84 |
+
if(wp_insert_adstxt_file_exists()) {
|
85 |
+
$adsensePublisherIds = wp_insert_adstxt_adsense_get_publisherids();
|
86 |
+
$adstxtContent = wp_insert_adstxt_get_content();
|
87 |
+
$adstxtContentData = array_filter(explode("\n", trim($adstxtContent)), 'trim');
|
88 |
+
$adstxtExistingAdsenseEntries = array();
|
89 |
+
foreach($adstxtContentData as $line) {
|
90 |
+
if(strpos($line, 'google.com') !== false) {
|
91 |
+
$adstxtExistingAdsenseEntries[] = $line;
|
92 |
+
}
|
93 |
+
}
|
94 |
+
|
95 |
+
$adstxtNewAdsenseEntries = array();
|
96 |
+
if(count($adstxtExistingAdsenseEntries) == 0) {
|
97 |
+
if(is_array($adsensePublisherIds) && (count($adsensePublisherIds) > 0)) {
|
98 |
+
foreach($adsensePublisherIds as $adsensePublisherId) {
|
99 |
+
$adstxtNewAdsenseEntries[] = 'google.com, '.$adsensePublisherId.', DIRECT, f08c47fec0942fa0';
|
100 |
+
}
|
101 |
+
}
|
102 |
+
} else {
|
103 |
+
if(is_array($adsensePublisherIds) && (count($adsensePublisherIds) > 0)) {
|
104 |
+
foreach($adsensePublisherIds as $adsensePublisherId) {
|
105 |
+
$entryExists = false;
|
106 |
+
foreach($adstxtExistingAdsenseEntries as $adstxtExistingAdsenseEntry) {
|
107 |
+
if(strpos($adstxtExistingAdsenseEntry, $adsensePublisherId) !== false) {
|
108 |
+
$entryExists = true;
|
109 |
+
}
|
110 |
+
}
|
111 |
+
if($entryExists == false) {
|
112 |
+
$adstxtNewAdsenseEntries[] = 'google.com, '.$adsensePublisherId.', DIRECT, f08c47fec0942fa0';
|
113 |
+
}
|
114 |
+
}
|
115 |
+
}
|
116 |
+
}
|
117 |
+
}
|
118 |
+
if(count($adstxtNewAdsenseEntries) > 0) {
|
119 |
+
return $adstxtNewAdsenseEntries;
|
120 |
+
}
|
121 |
+
return false;
|
122 |
+
}
|
123 |
+
/* End ads.txt Adsense Check */
|
124 |
+
|
125 |
+
/* Begin Extract Publisher Ids from Ads */
|
126 |
+
function wp_insert_adstxt_adsense_get_publisherids() {
|
127 |
+
$adsensePublisherIds = array();
|
128 |
+
$data = get_option('wp_insert_inpostads');
|
129 |
+
if(isset($data) && is_array($data)) {
|
130 |
+
foreach($data as $adUnit) {
|
131 |
+
$temp = wp_insert_adstxt_adsense_extract_publisherids($adUnit);
|
132 |
+
if($temp !== false) {
|
133 |
+
$adsensePublisherIds = array_merge($adsensePublisherIds, $temp);
|
134 |
+
}
|
135 |
+
}
|
136 |
+
}
|
137 |
+
|
138 |
+
$data = get_option('wp_insert_adwidgets');
|
139 |
+
if(isset($data) && is_array($data)) {
|
140 |
+
foreach($data as $adUnit) {
|
141 |
+
$temp = wp_insert_adstxt_adsense_extract_publisherids($adUnit);
|
142 |
+
if($temp !== false) {
|
143 |
+
$adsensePublisherIds = array_merge($adsensePublisherIds, $temp);
|
144 |
+
}
|
145 |
+
}
|
146 |
+
}
|
147 |
+
|
148 |
+
$data = get_option('wp_insert_inthemeads');
|
149 |
+
if(isset($data) && is_array($data)) {
|
150 |
+
foreach($data as $adUnit) {
|
151 |
+
$temp = wp_insert_adstxt_adsense_extract_publisherids($adUnit);
|
152 |
+
if($temp !== false) {
|
153 |
+
$adsensePublisherIds = array_merge($adsensePublisherIds, $temp);
|
154 |
+
}
|
155 |
+
}
|
156 |
+
}
|
157 |
+
|
158 |
+
$data = get_option('wp_insert_shortcodeads');
|
159 |
+
if(isset($data) && is_array($data)) {
|
160 |
+
foreach($data as $adUnit) {
|
161 |
+
$temp = wp_insert_adstxt_adsense_extract_publisherids($adUnit);
|
162 |
+
if($temp !== false) {
|
163 |
+
$adsensePublisherIds = array_merge($adsensePublisherIds, $temp);
|
164 |
+
}
|
165 |
+
}
|
166 |
+
}
|
167 |
+
|
168 |
+
$data = get_option('wp_insert_pagelevelads');
|
169 |
+
if(isset($data) && is_array($data)) {
|
170 |
+
foreach($data as $adUnit) {
|
171 |
+
$temp = wp_insert_adstxt_adsense_extract_publisherids($adUnit);
|
172 |
+
if($temp !== false) {
|
173 |
+
$adsensePublisherIds = array_merge($adsensePublisherIds, $temp);
|
174 |
+
}
|
175 |
+
}
|
176 |
+
}
|
177 |
+
$adsensePublisherIds = array_unique($adsensePublisherIds);
|
178 |
+
|
179 |
+
if(count($adsensePublisherIds) > 0) {
|
180 |
+
return $adsensePublisherIds;
|
181 |
+
}
|
182 |
+
return false;
|
183 |
+
}
|
184 |
+
|
185 |
+
function wp_insert_adstxt_adsense_extract_publisherids($adUnit) {
|
186 |
+
$publisherIds = array();
|
187 |
+
if(isset($adUnit['primary_ad_code']) && ($adUnit['primary_ad_code'] != '')) {
|
188 |
+
if(preg_match('/googlesyndication.com/', $adUnit['primary_ad_code'])) {
|
189 |
+
if(preg_match('/data-ad-client=/', $adUnit['primary_ad_code'])) { //ASYNS AD CODE
|
190 |
+
$adCodeParts = explode('data-ad-client', $adUnit['primary_ad_code']);
|
191 |
+
} else {
|
192 |
+
$adCodeParts = explode('google_ad_client', $adUnit['primary_ad_code']); //ORDINARY AD CODE
|
193 |
+
}
|
194 |
+
if(isset($adCodeParts[1]) && ($adCodeParts[1] != '')) {
|
195 |
+
preg_match('#"([a-zA-Z0-9-\s]+)"#', stripslashes($adCodeParts[1]), $matches);
|
196 |
+
if(isset($matches[1]) && ($matches[1] != '')) {
|
197 |
+
$publisherIds[] = str_replace(array('"', ' ', 'ca-'), array(''), $matches[1]);
|
198 |
+
}
|
199 |
+
}
|
200 |
+
}
|
201 |
+
}
|
202 |
+
if(isset($adUnit['secondary_ad_code']) && ($adUnit['secondary_ad_code'] != '')) {
|
203 |
+
if(preg_match('/googlesyndication.com/', $adUnit['secondary_ad_code'])) {
|
204 |
+
if(preg_match('/data-ad-client=/', $adUnit['secondary_ad_code'])) { //ASYNS AD CODE
|
205 |
+
$adCodeParts = explode('data-ad-client', $adUnit['secondary_ad_code']);
|
206 |
+
} else {
|
207 |
+
$adCodeParts = explode('google_ad_client', $adUnit['secondary_ad_code']); //ORDINARY AD CODE
|
208 |
+
}
|
209 |
+
if(isset($adCodeParts[1]) && ($adCodeParts[1] != '')) {
|
210 |
+
preg_match('#"([a-zA-Z0-9-\s]+)"#', stripslashes($adCodeParts[1]), $matches);
|
211 |
+
if(isset($matches[1]) && ($matches[1] != '')) {
|
212 |
+
$publisherIds[] = str_replace(array('"', ' ', 'ca-'), array(''), $matches[1]);
|
213 |
+
}
|
214 |
+
}
|
215 |
+
}
|
216 |
+
}
|
217 |
+
if(isset($adUnit['tertiary_ad_code']) && ($adUnit['tertiary_ad_code'] != '')) {
|
218 |
+
if(preg_match('/googlesyndication.com/', $adUnit['tertiary_ad_code'])) {
|
219 |
+
if(preg_match('/data-ad-client=/', $adUnit['tertiary_ad_code'])) { //ASYNS AD CODE
|
220 |
+
$adCodeParts = explode('data-ad-client', $adUnit['tertiary_ad_code']);
|
221 |
+
} else {
|
222 |
+
$adCodeParts = explode('google_ad_client', $adUnit['tertiary_ad_code']); //ORDINARY AD CODE
|
223 |
+
}
|
224 |
+
if(isset($adCodeParts[1]) && ($adCodeParts[1] != '')) {
|
225 |
+
preg_match('#"([a-zA-Z0-9-\s]+)"#', stripslashes($adCodeParts[1]), $matches);
|
226 |
+
if(isset($matches[1]) && ($matches[1] != '')) {
|
227 |
+
$publisherIds[] = str_replace(array('"', ' ', 'ca-'), array(''), $matches[1]);
|
228 |
+
}
|
229 |
+
}
|
230 |
+
}
|
231 |
+
}
|
232 |
+
if(count($publisherIds) > 0) {
|
233 |
+
return $publisherIds;
|
234 |
+
}
|
235 |
+
return false;
|
236 |
+
}
|
237 |
+
/* End Extract Publisher Ids from Ads */
|
238 |
+
?>
|
includes/modules/{adstxt → core/adstxt}/js/module.js
RENAMED
@@ -33,8 +33,47 @@ jQuery(document).ready(function() {
|
|
33 |
function() { },
|
34 |
function() { }
|
35 |
);
|
|
|
|
|
|
|
|
|
36 |
});
|
37 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
function wp_insert_adstxt_add_entry() {
|
39 |
var wp_insert_adstxt_new_entry_domain = jQuery("#wp_insert_adstxt_new_entry_domain").val();
|
40 |
var wp_insert_adstxt_new_entry_pid = jQuery("#wp_insert_adstxt_new_entry_pid").val();
|
33 |
function() { },
|
34 |
function() { }
|
35 |
);
|
36 |
+
|
37 |
+
if(window.location.href.indexOf('#wp_insert_adstxt_adsense_auto_update') > -1) {
|
38 |
+
wp_insert_adstxt_adsense_auto_update();
|
39 |
+
}
|
40 |
});
|
41 |
|
42 |
+
function wp_insert_adstxt_adsense_auto_update() {
|
43 |
+
jQuery.post(
|
44 |
+
jQuery('#wp_insert_adstxt_adsense_admin_notice_ajax').val(), {
|
45 |
+
'action': 'wp_insert_adstxt_adsense_auto_update',
|
46 |
+
'wp_insert_adstxt_adsense_admin_notice_nonce': jQuery('#wp_insert_adstxt_adsense_admin_notice_nonce').val(),
|
47 |
+
}, function(response) {
|
48 |
+
if(response != '###SUCCESS###') {
|
49 |
+
jQuery(response).dialog({
|
50 |
+
'modal': true,
|
51 |
+
'resizable': false,
|
52 |
+
'title': 'Ads.txt Auto Updation Failed',
|
53 |
+
'width': jQuery("body").width() * 0.5,
|
54 |
+
'maxWidth': jQuery("body").width() * 0.5,
|
55 |
+
'maxHeight': jQuery("body").height() * 0.9,
|
56 |
+
position: { my: 'center', at: 'center', of: window },
|
57 |
+
open: function (event, ui) {
|
58 |
+
jQuery('.ui-dialog').css({'z-index': 999999, 'max-width': '90%'});
|
59 |
+
jQuery('.ui-widget-overlay').css({'z-index': 999998, 'opacity': 0.8, 'background': '#000000'});
|
60 |
+
},
|
61 |
+
buttons : {
|
62 |
+
'Cancel': function() {
|
63 |
+
jQuery(this).dialog("close");
|
64 |
+
}
|
65 |
+
},
|
66 |
+
close: function() {
|
67 |
+
jQuery(this).dialog('destroy');
|
68 |
+
}
|
69 |
+
});
|
70 |
+
} else {
|
71 |
+
jQuery('.wp_insert_adstxt_adsense_notice').hide();
|
72 |
+
}
|
73 |
+
}
|
74 |
+
);
|
75 |
+
}
|
76 |
+
|
77 |
function wp_insert_adstxt_add_entry() {
|
78 |
var wp_insert_adstxt_new_entry_domain = jQuery("#wp_insert_adstxt_new_entry_domain").val();
|
79 |
var wp_insert_adstxt_new_entry_pid = jQuery("#wp_insert_adstxt_new_entry_pid").val();
|
includes/modules/{adstxt/functions.php → core/adstxt/module.php}
RENAMED
@@ -1,4 +1,34 @@
|
|
1 |
<?php
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
/* Begin Create Ads.txt */
|
3 |
add_action('wp_ajax_wp_insert_adstxt_generate_form_get_content', 'wp_insert_adstxt_generate_form_get_content');
|
4 |
function wp_insert_adstxt_generate_form_get_content() {
|
@@ -69,6 +99,7 @@ function wp_insert_adstxt_get_content() {
|
|
69 |
}
|
70 |
|
71 |
function wp_insert_adstxt_update_content($content) {
|
|
|
72 |
if(get_filesystem_method() === 'direct') {
|
73 |
$creds = request_filesystem_credentials(site_url().'/wp-admin/', '', false, false, array());
|
74 |
if(!WP_Filesystem($creds)) {
|
1 |
<?php
|
2 |
+
require_once(dirname(__FILE__).'/adsense.php');
|
3 |
+
|
4 |
+
/* Begin Add Assets */
|
5 |
+
add_action('wp_insert_modules_js', 'wp_insert_module_adstxt_js', 0);
|
6 |
+
function wp_insert_module_adstxt_js() {
|
7 |
+
wp_register_script('wp-insert-module-adstxt-js', WP_INSERT_URL.'includes/modules/core/adstxt/js/module.js', array('wp-insert-js'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
|
8 |
+
wp_enqueue_script('wp-insert-module-adstxt-js');
|
9 |
+
}
|
10 |
+
/* End Add Assets */
|
11 |
+
|
12 |
+
/* Begin Add Card in Admin Panel */
|
13 |
+
add_action('wp_insert_plugin_card', 'wp_insert_adstxt_plugin_card', 100);
|
14 |
+
function wp_insert_adstxt_plugin_card() {
|
15 |
+
echo '<div class="plugin-card adstxt-card">';
|
16 |
+
echo '<div class="plugin-card-top">';
|
17 |
+
echo '<h4>Authorized Digital Sellers / ads.txt</h4>';
|
18 |
+
echo '<p>Authorized Digital Sellers, or ads.txt, is an <a href="https://iabtechlab.com/">IAB</a> initiative to improve transparency in programmatic advertising.</p>';
|
19 |
+
echo '<p>You can easily manage your ads.txt from within Wp-Insert, providing confidence to brands they are buying authentic publisher inventory, protect you from counterfiet inventory and might even lead to higher monetization for your ad invertory.</p>';
|
20 |
+
echo '</div>';
|
21 |
+
echo '<div class="plugin-card-bottom">';
|
22 |
+
if(wp_insert_adstxt_file_exists()) {
|
23 |
+
echo '<a id="wp_insert_adstxt_generate" href="javascript:;" class="button button-primary">Modify ads.txt</a>';
|
24 |
+
} else {
|
25 |
+
echo '<a id="wp_insert_adstxt_generate" href="javascript:;" class="button button-primary">Generate ads.txt</a>';
|
26 |
+
}
|
27 |
+
echo '</div>';
|
28 |
+
echo '</div>';
|
29 |
+
}
|
30 |
+
/* End Add Card in Admin Panel */
|
31 |
+
|
32 |
/* Begin Create Ads.txt */
|
33 |
add_action('wp_ajax_wp_insert_adstxt_generate_form_get_content', 'wp_insert_adstxt_generate_form_get_content');
|
34 |
function wp_insert_adstxt_generate_form_get_content() {
|
99 |
}
|
100 |
|
101 |
function wp_insert_adstxt_update_content($content) {
|
102 |
+
wp_insert_adstxt_adsense_admin_notice_reset();
|
103 |
if(get_filesystem_method() === 'direct') {
|
104 |
$creds = request_filesystem_credentials(site_url().'/wp-admin/', '', false, false, array());
|
105 |
if(!WP_Filesystem($creds)) {
|
includes/{common/control-panel.php → modules/core/controlpanel/module.php}
RENAMED
@@ -1,5 +1,14 @@
|
|
1 |
<?php
|
2 |
add_action('admin_menu', 'wp_insert_admin_menu');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
3 |
function wp_insert_admin_menu() {
|
4 |
add_menu_page('Wp Insert', 'Wp Insert', 'manage_options', 'wp-insert', 'wp_insert_admin_page', WP_INSERT_URL.'/includes/assets/images/icon.png');
|
5 |
}
|
@@ -19,7 +28,7 @@ function wp_insert_admin_enqueue_scripts($page) {
|
|
19 |
wp_enqueue_script('chart-js');
|
20 |
do_action('wp_insert_modules_css');
|
21 |
do_action('wp_insert_modules_js');
|
22 |
-
smartlogixControls::enqueue_assets(WP_INSERT_URL.'includes/controls', WP_INSERT_VERSION);
|
23 |
wp_enqueue_script('editor');
|
24 |
wp_enqueue_script('quicktags');
|
25 |
wp_enqueue_style('buttons');
|
@@ -61,7 +70,7 @@ add_action('admin_notices', 'wp_insert_admin_notices');
|
|
61 |
function wp_insert_admin_notices() {
|
62 |
if(current_user_can('manage_options')) {
|
63 |
$userId = get_current_user_id();
|
64 |
-
if(!get_user_meta($userId, '
|
65 |
echo '<div class="notice notice-success wp_insert_notice is-dismissible" style="padding: 15px;">';
|
66 |
echo '<div style="float: left; max-width: 875px; font-size: 14px; font-family: Arial; line-height: 18px; color: #232323;">';
|
67 |
echo '<p>Thank you for updating <b>Wp-Insert</b>.</p>';
|
@@ -81,7 +90,7 @@ add_action('wp_ajax_wp_insert_admin_notice_dismiss', 'wp_insert_admin_notice_dis
|
|
81 |
function wp_insert_admin_notice_dismiss() {
|
82 |
check_ajax_referer('wp-insert-admin-notice', 'wp_insert_admin_notice_nonce');
|
83 |
$userId = get_current_user_id();
|
84 |
-
update_user_meta($userId, '
|
85 |
die();
|
86 |
}
|
87 |
/* End Admin Notice */
|
1 |
<?php
|
2 |
add_action('admin_menu', 'wp_insert_admin_menu');
|
3 |
+
add_action('plugin_action_links_wp-insert/wp-insert.php', 'wp_insert_plugin_action_links');
|
4 |
+
function wp_insert_plugin_action_links($links) {
|
5 |
+
$links = array_merge(
|
6 |
+
array('<a href="'.esc_url(admin_url('/admin.php?page=wp-insert')).'">Settings</a>'),
|
7 |
+
$links
|
8 |
+
);
|
9 |
+
return $links;
|
10 |
+
}
|
11 |
+
|
12 |
function wp_insert_admin_menu() {
|
13 |
add_menu_page('Wp Insert', 'Wp Insert', 'manage_options', 'wp-insert', 'wp_insert_admin_page', WP_INSERT_URL.'/includes/assets/images/icon.png');
|
14 |
}
|
28 |
wp_enqueue_script('chart-js');
|
29 |
do_action('wp_insert_modules_css');
|
30 |
do_action('wp_insert_modules_js');
|
31 |
+
smartlogixControls::enqueue_assets(WP_INSERT_URL.'includes/modules/core/controls', WP_INSERT_VERSION);
|
32 |
wp_enqueue_script('editor');
|
33 |
wp_enqueue_script('quicktags');
|
34 |
wp_enqueue_style('buttons');
|
70 |
function wp_insert_admin_notices() {
|
71 |
if(current_user_can('manage_options')) {
|
72 |
$userId = get_current_user_id();
|
73 |
+
if(!get_user_meta($userId, 'wp_insert_2.3_admin_notice_dismissed', true)) {
|
74 |
echo '<div class="notice notice-success wp_insert_notice is-dismissible" style="padding: 15px;">';
|
75 |
echo '<div style="float: left; max-width: 875px; font-size: 14px; font-family: Arial; line-height: 18px; color: #232323;">';
|
76 |
echo '<p>Thank you for updating <b>Wp-Insert</b>.</p>';
|
90 |
function wp_insert_admin_notice_dismiss() {
|
91 |
check_ajax_referer('wp-insert-admin-notice', 'wp_insert_admin_notice_nonce');
|
92 |
$userId = get_current_user_id();
|
93 |
+
update_user_meta($userId, 'wp_insert_2.3_admin_notice_dismissed', 'true');
|
94 |
die();
|
95 |
}
|
96 |
/* End Admin Notice */
|
includes/{controls/assets → modules/core/controls}/css/controls.css
RENAMED
File without changes
|
includes/{controls/assets → modules/core/controls}/images/chosen-sprite.png
RENAMED
File without changes
|
includes/{controls/assets → modules/core/controls}/images/chosen-sprite@2x.png
RENAMED
File without changes
|
includes/{controls/assets → modules/core/controls}/images/jquery-te.png
RENAMED
File without changes
|
includes/{controls/assets → modules/core/controls}/images/jquery.minicolors.png
RENAMED
File without changes
|
includes/{controls/assets → modules/core/controls}/js/controls.js
RENAMED
File without changes
|
includes/{controls/assets → modules/core/controls}/js/uncompressed/jQuery-TE/jquery-te-1.4.0.js
RENAMED
File without changes
|
includes/{controls/assets → modules/core/controls}/js/uncompressed/jQuery-TE/license/AUTHOR.txt
RENAMED
File without changes
|
includes/{controls/assets → modules/core/controls}/js/uncompressed/jQuery-TE/license/MIT-LICENSE.txt
RENAMED
File without changes
|
includes/{controls/assets → modules/core/controls}/js/uncompressed/jQuery-chosen/LICENSE.md
RENAMED
File without changes
|
includes/{controls/assets → modules/core/controls}/js/uncompressed/jQuery-chosen/chosen.jquery.js
RENAMED
File without changes
|
includes/{controls/assets → modules/core/controls}/js/uncompressed/jQuery-minicolors/LICENSE.md
RENAMED
File without changes
|
includes/{controls/assets → modules/core/controls}/js/uncompressed/jQuery-minicolors/jquery.minicolors.js
RENAMED
File without changes
|
includes/{controls/controls.php → modules/core/controls/module.php}
RENAMED
@@ -15,12 +15,13 @@ class smartlogixControls {
|
|
15 |
|
16 |
private $optionName;
|
17 |
private $optionIdentifier;
|
18 |
-
|
19 |
|
20 |
private $pages;
|
21 |
private $posts;
|
22 |
private $categories;
|
23 |
|
|
|
24 |
public $HTML;
|
25 |
public $JS;
|
26 |
|
@@ -255,6 +256,13 @@ class smartlogixControls {
|
|
255 |
if($args['helpText'] != '') { $HTML .= '<small>'.$args['helpText'].'</small>'; }
|
256 |
if($args['useParagraph']) { $HTML .= '</p>'; }
|
257 |
break;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
258 |
case 'password':
|
259 |
if($args['useParagraph']) { $HTML .= '<p>'; }
|
260 |
if($args['label'] != '') { $HTML .= '<label '.(($args['name'] != '')?'for="'.$args['name'].'"':'').'>'.$args['label'].'</label><br />'; }
|
@@ -562,9 +570,9 @@ class smartlogixControls {
|
|
562 |
}
|
563 |
|
564 |
public static function enqueue_assets($path, $version = '1') {
|
565 |
-
wp_register_style('smartlogix-controls-css', $path.'/
|
566 |
wp_enqueue_style('smartlogix-controls-css');
|
567 |
-
wp_register_script('smartlogix-controls-js', $path.'/
|
568 |
wp_enqueue_script('smartlogix-controls-js');
|
569 |
}
|
570 |
}
|
15 |
|
16 |
private $optionName;
|
17 |
private $optionIdentifier;
|
18 |
+
|
19 |
|
20 |
private $pages;
|
21 |
private $posts;
|
22 |
private $categories;
|
23 |
|
24 |
+
public $values;
|
25 |
public $HTML;
|
26 |
public $JS;
|
27 |
|
256 |
if($args['helpText'] != '') { $HTML .= '<small>'.$args['helpText'].'</small>'; }
|
257 |
if($args['useParagraph']) { $HTML .= '</p>'; }
|
258 |
break;
|
259 |
+
case 'number':
|
260 |
+
if($args['useParagraph']) { $HTML .= '<p>'; }
|
261 |
+
if($args['label'] != '') { $HTML .= '<label '.(($args['name'] != '')?'for="'.$args['name'].'"':'').'>'.$args['label'].'</label><br />'; }
|
262 |
+
$HTML .= '<input type="number" '.(($args['id'] != '')?'id="'.$args['id'].'"':'').' '.(($args['name'] != '')?'name="'.$args['name'].'"':'').' '.(($args['value'] != '')?'value="'.$args['value'].'"':'').' '.(($args['className'] != '')?'class="'.$args['className'].'"':'').' '.(($args['style'] != '')?'style="'.$args['style'].'"':'').' '.(($args['required'])?'required':'').' />';
|
263 |
+
if($args['helpText'] != '') { $HTML .= '<small>'.$args['helpText'].'</small>'; }
|
264 |
+
if($args['useParagraph']) { $HTML .= '</p>'; }
|
265 |
+
break;
|
266 |
case 'password':
|
267 |
if($args['useParagraph']) { $HTML .= '<p>'; }
|
268 |
if($args['label'] != '') { $HTML .= '<label '.(($args['name'] != '')?'for="'.$args['name'].'"':'').'>'.$args['label'].'</label><br />'; }
|
570 |
}
|
571 |
|
572 |
public static function enqueue_assets($path, $version = '1') {
|
573 |
+
wp_register_style('smartlogix-controls-css', $path.'/css/controls.css', array(), $version);
|
574 |
wp_enqueue_style('smartlogix-controls-css');
|
575 |
+
wp_register_script('smartlogix-controls-js', $path.'/js/controls.js', array('jquery', 'jquery-ui-core'), $version);
|
576 |
wp_enqueue_script('smartlogix-controls-js');
|
577 |
}
|
578 |
}
|
includes/{common/common.php → modules/core/misc/module.php}
RENAMED
File without changes
|
includes/modules/core/modules.php
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once(dirname(__FILE__).'/adstxt/module.php');
|
3 |
+
require_once(dirname(__FILE__).'/controls/module.php');
|
4 |
+
require_once(dirname(__FILE__).'/controlpanel/module.php');
|
5 |
+
require_once(dirname(__FILE__).'/units/module.php');
|
6 |
+
require_once(dirname(__FILE__).'/abtesting/module.php');
|
7 |
+
require_once(dirname(__FILE__).'/misc/module.php');
|
8 |
+
?>
|
includes/modules/core/units/adcode.php
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
function wp_insert_form_accordion_tabs_adcode($control, $identifier, $location) {
|
3 |
+
echo '<h3>Ad Code</h3>';
|
4 |
+
echo '<div>';
|
5 |
+
$abtestingMode = get_option('wp_insert_abtesting_mode');
|
6 |
+
|
7 |
+
if($location == 'inpostads') {
|
8 |
+
$adTypes = array(
|
9 |
+
array('text' => 'Use Generic / Custom Ad Code', 'value' => 'generic'),
|
10 |
+
array('text' => 'vi stories', 'value' => 'vicode'),
|
11 |
+
);
|
12 |
+
$control->add_control(array('type' => 'select', 'label' => 'Ad Type', 'optionName' => 'primary_ad_code_type', 'options' => $adTypes));
|
13 |
+
echo $control->HTML;
|
14 |
+
$control->clear_controls();
|
15 |
+
|
16 |
+
$control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'primary_ad_code'));
|
17 |
+
$control->create_section('<span id="primary_ad_code_type_generic" class="isSelectedIndicator"></span><span class="isSelectedIndicatorText">Generic / Custom Ad Code (Primary Network)</span>');
|
18 |
+
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
|
19 |
+
echo $control->HTML;
|
20 |
+
$control->clear_controls();
|
21 |
+
|
22 |
+
$IsVILoggedin = wp_insert_vi_api_is_loggedin();
|
23 |
+
$isJSTagGenerated = ((wp_insert_vi_api_get_vi_code() === false)?false:true);
|
24 |
+
$isVIDisabled = false;
|
25 |
+
$viMessage = '';
|
26 |
+
if(!$IsVILoggedin && !$isJSTagGenerated) {
|
27 |
+
$isVIDisabled = true;
|
28 |
+
$viMessage = '<p>Introducing <b>vi stories</b> – the video content and advertising player.</p>';
|
29 |
+
$viMessage .= '<p>Before you can use <b>vi stories</b>, you must configure it. Once you’ve signed up, in the <i>video intelligence</i> panel, click <i>Sign in</i> then click <i>Configure</i></p>';
|
30 |
+
} else if($IsVILoggedin && !$isJSTagGenerated) {
|
31 |
+
$isVIDisabled = true;
|
32 |
+
$viMessage .= '<p>Before you can use <b>vi stories</b>, you must configure it. In the <i>video intelligence</i> panel, click <i>Configure</i></p>';
|
33 |
+
//$viMessage .= '<p><a id="wp_insert_inpostads_vi_customize_adcode" href="javascript:;" class="button button-primary aligncenter">Configure vi Code</a></p>'; /*Button being temporarily removed to avoid confusion for users*/
|
34 |
+
} else if(!$IsVILoggedin && $isJSTagGenerated) {
|
35 |
+
$isVIDisabled = false;
|
36 |
+
$viMessage = '<p>Before you can use <b>vi stories</b>, you must configure it. Once you’ve signed up, in the <i>video intelligence</i> panel, click <i>Sign in</i> then click <i>Configure</i></p>';
|
37 |
+
} else {
|
38 |
+
$isVIDisabled = false;
|
39 |
+
$viMessage = wp_insert_vi_customize_adcode_get_settings();
|
40 |
+
$viMessage .= '<p>To configure <b>vi stories</b>, go to the <i>video intelligence</i> panel, click <i>Configure</i></p>';
|
41 |
+
//$viMessage .= '<p><a id="wp_insert_inpostads_vi_customize_adcode" href="javascript:;" class="button button-primary aligncenter">Configure vi Code</a></p>'; /*Button being temporarily removed to avoid confusion for users*/
|
42 |
+
}
|
43 |
+
|
44 |
+
$control->HTML .= $viMessage;
|
45 |
+
$control->create_section('<span id="primary_ad_code_type_vicode" class="isSelectedIndicator '.(($isVIDisabled)?'disabled':'').'"></span><span class="isSelectedIndicatorText">vi stories (Primary Network)</span>');
|
46 |
+
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
47 |
+
echo $control->HTML;
|
48 |
+
$control->clear_controls();
|
49 |
+
} else {
|
50 |
+
$control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'primary_ad_code'));
|
51 |
+
$control->create_section('Ad Code (Primary Network)');
|
52 |
+
echo $control->HTML;
|
53 |
+
$control->clear_controls();
|
54 |
+
}
|
55 |
+
|
56 |
+
$control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'secondary_ad_code'));
|
57 |
+
$control->create_section('Ad Code (Secondary Network)');
|
58 |
+
if($abtestingMode != '2' && $abtestingMode != '3') {
|
59 |
+
$control->set_HTML('<div style="display: none;">'.$control->HTML.'</div>');
|
60 |
+
}
|
61 |
+
echo $control->HTML;
|
62 |
+
$control->clear_controls();
|
63 |
+
|
64 |
+
$control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'tertiary_ad_code'));
|
65 |
+
$control->create_section('Ad Code (Tertiary Network)');
|
66 |
+
if($abtestingMode != '3') {
|
67 |
+
$control->set_HTML('<div style="display: none;">'.$control->HTML.'</div>');
|
68 |
+
}
|
69 |
+
echo $control->HTML;
|
70 |
+
$control->clear_controls();
|
71 |
+
echo '</div>';
|
72 |
+
return $control;
|
73 |
+
}
|
74 |
+
?>
|
includes/modules/core/units/adunit.php
ADDED
@@ -0,0 +1,297 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
$wpInsertPostInstance;
|
3 |
+
$wpInsertABTestingMode;
|
4 |
+
$wpInsertVIAdDisplayed = false;
|
5 |
+
$wpInsertGeoLocation;
|
6 |
+
|
7 |
+
/* Begin Ad Unit */
|
8 |
+
function wp_insert_get_ad_unit($data, $additionalStyles = '') {
|
9 |
+
/* Begin Ad Styles */
|
10 |
+
$adunitClass = substr(str_shuffle(str_repeat("abcdefghijklmnopqrstuvwxyz", 5)), 0, 5).uniqid();
|
11 |
+
$adUnitStyles = wp_insert_get_ad_unit_styles($data, $adunitClass);
|
12 |
+
$adUnitCode = wp_insert_get_ad_unit_code($data);
|
13 |
+
if($adUnitCode != '') {
|
14 |
+
return '<div class="'.$adunitClass.'" '.(($additionalStyles != '')?'style="'.$additionalStyles.'"':'').'>'.$adUnitCode.'</div>'.$adUnitStyles;
|
15 |
+
}
|
16 |
+
return '';
|
17 |
+
}
|
18 |
+
/* End Ad Unit */
|
19 |
+
|
20 |
+
/* Begin Ad Unit Styles */
|
21 |
+
function wp_insert_get_ad_unit_styles($data, $adunitClass) {
|
22 |
+
$adBreakpoints =array(
|
23 |
+
'device_large_desktop_width' => (int)((!isset($data['device_large_desktop_width']) || ($data['device_large_desktop_width'] == ''))?'1200':$data['device_large_desktop_width']),
|
24 |
+
'device_medium_desktop_width' => (int)((!isset($data['device_medium_desktop_width']) || ($data['device_medium_desktop_width'] == ''))?'992':$data['device_medium_desktop_width']),
|
25 |
+
'device_tablet_width' => (int)((!isset($data['device_tablet_width']) || ($data['device_tablet_width'] == ''))?'768':$data['device_tablet_width']),
|
26 |
+
'device_mobile_width' => (int)((!isset($data['device_mobile_width']) || ($data['device_mobile_width'] == ''))?'480':$data['device_mobile_width']),
|
27 |
+
);
|
28 |
+
$adUnitStyles = '<style type="text/css">'."\r\n";
|
29 |
+
if(isset($data['styles']) && ($data['styles'] != '')) {
|
30 |
+
$adUnitStyles .= '.'.$adunitClass.' {'."\r\n";
|
31 |
+
$adUnitStyles .= $data['styles']."\r\n";
|
32 |
+
$adUnitStyles .= '}'."\r\n";
|
33 |
+
}
|
34 |
+
$adUnitStyles .= '@media screen and (min-width: '.($adBreakpoints['device_large_desktop_width'] + 1).'px) {'."\r\n";
|
35 |
+
$adUnitStyles .= '.'.$adunitClass.' {'."\r\n";
|
36 |
+
if(isset($data['device_exclude_large_desktop']) && wp_validate_boolean($data['device_exclude_large_desktop'])) {
|
37 |
+
$adUnitStyles .= 'display: none;'."\r\n";
|
38 |
+
} else {
|
39 |
+
$adUnitStyles .= 'display: block;'."\r\n";
|
40 |
+
if(isset($data['device_large_desktop_adwidth']) && ($data['device_large_desktop_adwidth'] != '') && ($data['device_large_desktop_adwidth'] != '0')) {
|
41 |
+
$adUnitStyles .= 'width: '.$data['device_large_desktop_adwidth'].'px;'."\r\n";
|
42 |
+
}
|
43 |
+
if(isset($data['device_large_desktop_styles']) && ($data['device_large_desktop_styles'] != '')) {
|
44 |
+
$adUnitStyles .= $data['device_large_desktop_styles']."\r\n";
|
45 |
+
}
|
46 |
+
}
|
47 |
+
$adUnitStyles .= '}'."\r\n";
|
48 |
+
$adUnitStyles .= '}'."\r\n";
|
49 |
+
$adUnitStyles .= '@media screen and (min-width: '.($adBreakpoints['device_medium_desktop_width'] + 1).'px) and (max-width: '.$adBreakpoints['device_large_desktop_width'].'px) {'."\r\n";
|
50 |
+
$adUnitStyles .= '.'.$adunitClass.' {'."\r\n";
|
51 |
+
if(isset($data['device_exclude_medium_desktop']) && wp_validate_boolean($data['device_exclude_medium_desktop'])) {
|
52 |
+
$adUnitStyles .= 'display: none;'."\r\n";
|
53 |
+
} else {
|
54 |
+
$adUnitStyles .= 'display: block;'."\r\n";
|
55 |
+
if(isset($data['device_medium_desktop_adwidth']) && ($data['device_medium_desktop_adwidth'] != '') && ($data['device_medium_desktop_adwidth'] != '0')) {
|
56 |
+
$adUnitStyles .= 'width: '.$data['device_medium_desktop_adwidth'].'px;'."\r\n";
|
57 |
+
}
|
58 |
+
if(isset($data['device_medium_desktop_styles']) && ($data['device_medium_desktop_styles'] != '')) {
|
59 |
+
$adUnitStyles .= $data['device_medium_desktop_styles']."\r\n";
|
60 |
+
}
|
61 |
+
}
|
62 |
+
$adUnitStyles .= '}'."\r\n";
|
63 |
+
$adUnitStyles .= '}'."\r\n";
|
64 |
+
$adUnitStyles .= '@media screen and (min-width: '.($adBreakpoints['device_tablet_width'] + 1).'px) and (max-width: '.$adBreakpoints['device_medium_desktop_width'].'px) {'."\r\n";
|
65 |
+
$adUnitStyles .= '.'.$adunitClass.' {'."\r\n";
|
66 |
+
if(isset($data['device_exclude_tablet']) && wp_validate_boolean($data['device_exclude_tablet'])) {
|
67 |
+
$adUnitStyles .= 'display: none;'."\r\n";
|
68 |
+
} else {
|
69 |
+
$adUnitStyles .= 'display: block;'."\r\n";
|
70 |
+
if(isset($data['device_tablet_adwidth']) && ($data['device_tablet_adwidth'] != '') && ($data['device_tablet_adwidth'] != '0')) {
|
71 |
+
$adUnitStyles .= 'width: '.$data['device_tablet_adwidth'].'px;'."\r\n";
|
72 |
+
}
|
73 |
+
if(isset($data['device_tablet_styles']) && ($data['device_tablet_styles'] != '')) {
|
74 |
+
$adUnitStyles .= $data['device_tablet_styles']."\r\n";
|
75 |
+
}
|
76 |
+
}
|
77 |
+
$adUnitStyles .= '}'."\r\n";
|
78 |
+
$adUnitStyles .= '}'."\r\n";
|
79 |
+
$adUnitStyles .= '@media screen and (min-width: '.$adBreakpoints['device_tablet_width'].'px) and (max-width: '.$adBreakpoints['device_tablet_width'].'px) {'."\r\n";
|
80 |
+
$adUnitStyles .= '.'.$adunitClass.' {'."\r\n";
|
81 |
+
if(isset($data['device_exclude_mobile']) && wp_validate_boolean($data['device_exclude_mobile'])) {
|
82 |
+
$adUnitStyles .= 'display: none;'."\r\n";
|
83 |
+
} else {
|
84 |
+
$adUnitStyles .= 'display: block;'."\r\n";
|
85 |
+
if(isset($data['device_mobile_adwidth']) && ($data['device_mobile_adwidth'] != '') && ($data['device_mobile_adwidth'] != '0')) {
|
86 |
+
$adUnitStyles .= 'width: '.$data['device_mobile_adwidth'].'px;'."\r\n";
|
87 |
+
}
|
88 |
+
if(isset($data['device_mobile_styles']) && ($data['device_mobile_styles'] != '')) {
|
89 |
+
$adUnitStyles .= $data['device_mobile_styles']."\r\n";
|
90 |
+
}
|
91 |
+
}
|
92 |
+
$adUnitStyles .= '}'."\r\n";
|
93 |
+
$adUnitStyles .= '}'."\r\n";
|
94 |
+
$adUnitStyles .= '@media screen and (max-width: '.($adBreakpoints['device_tablet_width'] - 1).'px) {'."\r\n";
|
95 |
+
$adUnitStyles .= '.'.$adunitClass.' {'."\r\n";
|
96 |
+
if(isset($data['device_exclude_small_mobile']) && wp_validate_boolean($data['device_exclude_small_mobile'])) {
|
97 |
+
$adUnitStyles .= 'display: none;'."\r\n";
|
98 |
+
} else {
|
99 |
+
$adUnitStyles .= 'display: block;'."\r\n";
|
100 |
+
if(isset($data['device_small_mobile_adwidth']) && ($data['device_small_mobile_adwidth'] != '') && ($data['device_small_mobile_adwidth'] != '0')) {
|
101 |
+
$adUnitStyles .= 'width: '.$data['device_small_mobile_adwidth'].'px;'."\r\n";
|
102 |
+
}
|
103 |
+
if(isset($data['device_small_mobile_styles']) && ($data['device_small_mobile_styles'] != '')) {
|
104 |
+
$adUnitStyles .= $data['device_small_mobile_styles']."\r\n";
|
105 |
+
}
|
106 |
+
}
|
107 |
+
$adUnitStyles .= '}'."\r\n";
|
108 |
+
$adUnitStyles .= '}'."\r\n";
|
109 |
+
$adUnitStyles .= '</style>'."\r\n";
|
110 |
+
return $adUnitStyles;
|
111 |
+
}
|
112 |
+
/* End Ad Unit Styles */
|
113 |
+
|
114 |
+
/* Begin Ad Unit Code */
|
115 |
+
function wp_insert_get_ad_unit_code($data) {
|
116 |
+
global $wpInsertABTestingMode;
|
117 |
+
global $wpInsertVIAdDisplayed;
|
118 |
+
global $wpInsertGeoLocation;
|
119 |
+
|
120 |
+
$adUnitCode = '';
|
121 |
+
if(($wpInsertGeoLocation != false) && ($wpInsertGeoLocation != '') && ((is_array($data['geo_group1_countries']) && (count($data['geo_group1_countries']) > 0)) || (is_array($data['geo_group2_countries']) && (count($adOptions['geo_group1_countries']) > 0)))) {
|
122 |
+
if(($data['geo_group1_adcode'] != '') && in_array($wpInsertGeoLocation, $data['geo_group1_countries'])) {
|
123 |
+
$adUnitCode = do_shortcode(stripslashes($data['geo_group1_adcode']));
|
124 |
+
}
|
125 |
+
if(($data['geo_group2_adcode'] != '') && in_array($wpInsertGeoLocation, $data['geo_group2_countries'])) {
|
126 |
+
$adUnitCode = do_shortcode(stripslashes($data['geo_group2_adcode']));
|
127 |
+
}
|
128 |
+
}
|
129 |
+
if($adUnitCode == '') {
|
130 |
+
switch($wpInsertABTestingMode) {
|
131 |
+
case 1:
|
132 |
+
if(isset($data['primary_ad_code_type']) && ($data['primary_ad_code_type'] == 'vicode')) {
|
133 |
+
if($wpInsertVIAdDisplayed !== true) {
|
134 |
+
$wpInsertVIAdDisplayed = true;
|
135 |
+
$adUnitCode = '<div id="wp_insert_vi_ad">'.wp_insert_vi_api_get_vi_code('wp_insert_vi_code_settings').'</div>';
|
136 |
+
} else {
|
137 |
+
$adUnitCode = '';
|
138 |
+
}
|
139 |
+
} else {
|
140 |
+
$adUnitCode = do_shortcode(stripslashes($data['primary_ad_code']));
|
141 |
+
}
|
142 |
+
break;
|
143 |
+
case 2:
|
144 |
+
$adUnitCode = do_shortcode(stripslashes($data['secondary_ad_code']));
|
145 |
+
break;
|
146 |
+
case 3:
|
147 |
+
$adUnitCode = do_shortcode(stripslashes($data['tertiary_ad_code']));
|
148 |
+
break;
|
149 |
+
default:
|
150 |
+
$adUnitCode = do_shortcode(stripslashes($data['primary_ad_code']));
|
151 |
+
}
|
152 |
+
}
|
153 |
+
return $adUnitCode;
|
154 |
+
}
|
155 |
+
/* End Ad Unit Code */
|
156 |
+
|
157 |
+
/* Begin Assign Instance Identifier */
|
158 |
+
add_action('the_content', 'wp_insert_track_post_instance', 1);
|
159 |
+
function wp_insert_track_post_instance($content) {
|
160 |
+
global $wpInsertPostInstance;
|
161 |
+
if(is_main_query()) {
|
162 |
+
if($wpInsertPostInstance == '') {
|
163 |
+
$wpInsertPostInstance = 1;
|
164 |
+
} else {
|
165 |
+
$wpInsertPostInstance++;
|
166 |
+
}
|
167 |
+
}
|
168 |
+
return $content;
|
169 |
+
}
|
170 |
+
/* End Assign Instance Identifier */
|
171 |
+
|
172 |
+
/* Begin Assign AB Testing Mode */
|
173 |
+
add_action('wp', 'wp_insert_track_ad_instance', 1);
|
174 |
+
function wp_insert_track_ad_instance() {
|
175 |
+
global $wpInsertABTestingMode;
|
176 |
+
$abtestingMode = get_option('wp_insert_abtesting_mode');
|
177 |
+
if(isset($abtestingMode)) {
|
178 |
+
$wpInsertABTestingMode = rand(1, floatval($abtestingMode));
|
179 |
+
} else {
|
180 |
+
$wpInsertABTestingMode = 1;
|
181 |
+
}
|
182 |
+
}
|
183 |
+
/* End Assign AB Testing Mode */
|
184 |
+
|
185 |
+
/* Begin Get Current Page Type */
|
186 |
+
function wp_insert_get_page_details() {
|
187 |
+
global $post;
|
188 |
+
$page_details = array(
|
189 |
+
'type' => 'POST',
|
190 |
+
'ID' => (isset($post->ID)?$post->ID:'')
|
191 |
+
);
|
192 |
+
if(is_home() || is_front_page()) {
|
193 |
+
$page_details['type'] = 'HOME';
|
194 |
+
} else if(is_category()) {
|
195 |
+
$page_details['type'] = 'CATEGORY';
|
196 |
+
$page_details['ID'] = get_query_var('cat');
|
197 |
+
} else if(is_archive()) {
|
198 |
+
$page_details['type'] = 'ARCHIVE';
|
199 |
+
} else if(is_search()) {
|
200 |
+
$page_details['type'] = 'SEARCH';
|
201 |
+
} else if(is_page()) {
|
202 |
+
$page_details['type'] = 'PAGE';
|
203 |
+
} else if(is_single()) {
|
204 |
+
if(is_singular('post')) {
|
205 |
+
$page_details['type'] = 'POST';
|
206 |
+
$page_details['categories'] = wp_get_post_categories($page_details['ID']);
|
207 |
+
} else {
|
208 |
+
$page_details['type'] = 'CUSTOM';
|
209 |
+
$page_details['type_name'] = $post->post_type;
|
210 |
+
}
|
211 |
+
} else if(is_404()) {
|
212 |
+
$page_details['type'] = '404';
|
213 |
+
}
|
214 |
+
return $page_details;
|
215 |
+
}
|
216 |
+
/* End Get Current Page Type */
|
217 |
+
|
218 |
+
/* Begin Get Ad Status */
|
219 |
+
function wp_insert_get_ad_status($rules) {
|
220 |
+
if(!isset($rules)) { return false; }
|
221 |
+
|
222 |
+
if(!wp_validate_boolean($rules['status'])) {
|
223 |
+
return false;
|
224 |
+
}
|
225 |
+
|
226 |
+
if(isset($rules['rules_exclude_loggedin']) && wp_validate_boolean($rules['rules_exclude_loggedin']) && is_user_logged_in()) {
|
227 |
+
return false;
|
228 |
+
}
|
229 |
+
|
230 |
+
if(isset($rules['rules_exclude_mobile_devices']) && wp_validate_boolean($rules['rules_exclude_mobile_devices']) && wp_is_mobile()) {
|
231 |
+
return false;
|
232 |
+
}
|
233 |
+
|
234 |
+
global $wpInsertPostInstance;
|
235 |
+
$page_details = wp_insert_get_page_details();
|
236 |
+
switch($page_details['type']) {
|
237 |
+
case 'HOME':
|
238 |
+
if(isset($rules['rules_exclude_home']) && wp_validate_boolean($rules['rules_exclude_home']) ) {
|
239 |
+
return false;
|
240 |
+
} else if(isset($rules['rules_home_instances']) && is_array($rules['rules_home_instances']) && (in_array($wpInsertPostInstance, $rules['rules_home_instances']))) {
|
241 |
+
return false;
|
242 |
+
}
|
243 |
+
break;
|
244 |
+
case 'ARCHIVE':
|
245 |
+
if(isset($rules['rules_exclude_archives']) && wp_validate_boolean($rules['rules_exclude_archives']) ) {
|
246 |
+
return false;
|
247 |
+
} else if(isset($rules['rules_archives_instances']) && is_array($rules['rules_archives_instances']) && (in_array($wpInsertPostInstance, $rules['rules_archives_instances']))) {
|
248 |
+
return false;
|
249 |
+
}
|
250 |
+
break;
|
251 |
+
case 'SEARCH':
|
252 |
+
if(isset($rules['rules_exclude_search']) && wp_validate_boolean($rules['rules_exclude_search']) ) {
|
253 |
+
return false;
|
254 |
+
} else if(isset($rules['rules_search_instances']) && is_array($rules['rules_search_instances']) && (in_array($wpInsertPostInstance, $rules['rules_search_instances']))) {
|
255 |
+
return false;
|
256 |
+
}
|
257 |
+
break;
|
258 |
+
case 'PAGE':
|
259 |
+
if(isset($rules['rules_exclude_page']) && wp_validate_boolean($rules['rules_exclude_page']) ) {
|
260 |
+
return false;
|
261 |
+
} else if(isset($rules['rules_page_exceptions']) && is_array($rules['rules_page_exceptions']) && (in_array($page_details['ID'], $rules['rules_page_exceptions']))) {
|
262 |
+
return false;
|
263 |
+
}
|
264 |
+
break;
|
265 |
+
case 'POST':
|
266 |
+
if(isset($rules['rules_exclude_post']) && wp_validate_boolean($rules['rules_exclude_post']) ) {
|
267 |
+
return false;
|
268 |
+
} else if(isset($rules['rules_post_exceptions']) && is_array($rules['rules_post_exceptions']) && (in_array($page_details['ID'], $rules['rules_post_exceptions']))) {
|
269 |
+
return false;
|
270 |
+
} else if(isset($rules['rules_post_categories_exceptions']) && isset($page_details['categories']) && is_array($rules['rules_post_categories_exceptions']) && is_array($page_details['categories']) && (count(array_intersect($page_details['categories'], $rules['rules_post_categories_exceptions'])) > 0)) {
|
271 |
+
return false;
|
272 |
+
}
|
273 |
+
break;
|
274 |
+
case 'CATEGORY':
|
275 |
+
if(isset($rules['rules_exclude_categories']) && wp_validate_boolean($rules['rules_exclude_categories'])) {
|
276 |
+
return false;
|
277 |
+
} else if(isset($rules['rules_categories_exceptions']) && is_array($rules['rules_categories_exceptions']) && (in_array($page_details['ID'], $rules['rules_categories_exceptions']))) {
|
278 |
+
return false;
|
279 |
+
} else if(isset($rules['rules_categories_instances']) && is_array($rules['rules_categories_instances']) && (in_array($wpInsertPostInstance, $rules['rules_categories_instances']))) {
|
280 |
+
return false;
|
281 |
+
}
|
282 |
+
break;
|
283 |
+
case '404':
|
284 |
+
if(isset($rules['rules_exclude_404']) && wp_validate_boolean($rules['rules_exclude_404'])) {
|
285 |
+
return false;
|
286 |
+
}
|
287 |
+
break;
|
288 |
+
case 'CUSTOM':
|
289 |
+
if(isset($rules['rules_exclude_cpt_'.$page_details['type_name']]) && wp_validate_boolean($rules['rules_exclude_cpt_'.$page_details['type_name']])) {
|
290 |
+
return false;
|
291 |
+
}
|
292 |
+
break;
|
293 |
+
}
|
294 |
+
return true;
|
295 |
+
}
|
296 |
+
/* End Get Ad Status */
|
297 |
+
?>
|
includes/modules/core/units/device-styles.php
ADDED
@@ -0,0 +1,63 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
function wp_insert_form_accordion_tabs_devices_styles($control, $identifier, $location) {
|
3 |
+
echo '<h3>Devices & Styles</h3>';
|
4 |
+
echo '<div>';
|
5 |
+
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'device_exclude_large_desktop'));
|
6 |
+
$control->HTML .= '<p style="text-align: center; min-height: 40px;"><small>This setting will apply to all devices which are greater than the Device Width set below</small></p>';
|
7 |
+
$control->add_control(array('type' => 'number', 'label' => 'Device Width (px)', 'optionName' => 'device_large_desktop_width', 'helpText' => 'The width of the browser screen.', 'value' => ((!isset($control->values['device_large_desktop_width']) || ($control->values['device_large_desktop_width'] == ''))?'1200':$control->values['device_large_desktop_width'])));
|
8 |
+
$control->add_control(array('type' => 'number', 'label' => 'Ad Width (px)', 'optionName' => 'device_large_desktop_adwidth', 'helpText' => 'The width of the ad block at the given browser screen width. (Leave empty for auto width)'));
|
9 |
+
$control->add_control(array('type' => 'textarea', 'label' => 'Styles', 'optionName' => 'device_large_desktop_styles', 'helpText' => 'You can add CSS to customize your ad block for this device type'));
|
10 |
+
$control->create_section('Device - Large Desktop');
|
11 |
+
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
|
12 |
+
echo $control->HTML;
|
13 |
+
$control->clear_controls();
|
14 |
+
|
15 |
+
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'device_exclude_medium_desktop'));
|
16 |
+
$control->HTML .= '<p style="text-align: center; min-height: 40px;"><small>This setting will apply to all devices which are greater than the Device Width set below but smaller than Device Width set for Large Desktop</small></p>';
|
17 |
+
$control->add_control(array('type' => 'number', 'label' => 'Device Width (px)', 'optionName' => 'device_medium_desktop_width', 'helpText' => 'The width of the browser screen.', 'value' => ((!isset($control->values['device_medium_desktop_width']) || ($control->values['device_medium_desktop_width'] == ''))?'992':$control->values['device_medium_desktop_width'])));
|
18 |
+
$control->add_control(array('type' => 'number', 'label' => 'Ad Width (px)', 'optionName' => 'device_medium_desktop_adwidth', 'helpText' => 'The width of the ad block at the given browser screen width. (Leave empty for auto width)'));
|
19 |
+
$control->add_control(array('type' => 'textarea', 'label' => 'Styles', 'optionName' => 'device_medium_desktop_styles', 'helpText' => 'You can add CSS to customize your ad block for this device type'));
|
20 |
+
$control->create_section('Devices - Medium Desktop');
|
21 |
+
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
22 |
+
echo $control->HTML;
|
23 |
+
$control->clear_controls();
|
24 |
+
|
25 |
+
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'device_exclude_tablet'));
|
26 |
+
$control->HTML .= '<p style="text-align: center; min-height: 40px;"><small>This setting will apply to all devices which are greater than the Device Width set below but smaller than Device Width set for Medium Desktop</small></p>';
|
27 |
+
$control->add_control(array('type' => 'number', 'label' => 'Device Width (px)', 'optionName' => 'device_tablet_width', 'helpText' => 'The width of the browser screen.', 'value' => ((!isset($control->values['device_tablet_width']) || ($control->values['device_tablet_width'] == ''))?'768':$control->values['device_tablet_width'])));
|
28 |
+
$control->add_control(array('type' => 'number', 'label' => 'Ad Width (px)', 'optionName' => 'device_tablet_adwidth', 'helpText' => 'The width of the ad block at the given browser screen width. (Leave empty for auto width)'));
|
29 |
+
$control->add_control(array('type' => 'textarea', 'label' => 'Styles', 'optionName' => 'device_tablet_styles', 'helpText' => 'You can add CSS to customize your ad block for this device type'));
|
30 |
+
$control->create_section('Devices - Tablet');
|
31 |
+
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
|
32 |
+
echo $control->HTML;
|
33 |
+
$control->clear_controls();
|
34 |
+
|
35 |
+
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'device_exclude_mobile'));
|
36 |
+
$control->HTML .= '<p style="text-align: center; min-height: 40px;"><small>This setting will apply to all devices which are smaller than the Device Width set for Tablets</small></p>';
|
37 |
+
$control->add_control(array('type' => 'number', 'label' => 'Device Width (px)', 'optionName' => 'device_mobile_width', 'helpText' => 'The width of the browser screen.', 'value' => ((!isset($control->values['device_mobile_width']) || ($control->values['device_mobile_width'] == ''))?'480':$control->values['device_mobile_width'])));
|
38 |
+
$control->add_control(array('type' => 'number', 'label' => 'Ad Width (px)', 'optionName' => 'device_mobile_adwidth', 'helpText' => 'The width of the ad block at the given browser screen width. (Leave empty for auto width)'));
|
39 |
+
$control->add_control(array('type' => 'textarea', 'label' => 'Styles', 'optionName' => 'device_mobile_styles', 'helpText' => 'You can add CSS to customize your ad block for this device type'));
|
40 |
+
$control->create_section('Devices - Mobile (Normal)');
|
41 |
+
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
42 |
+
echo $control->HTML;
|
43 |
+
$control->clear_controls();
|
44 |
+
|
45 |
+
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'device_exclude_small_mobile'));
|
46 |
+
$control->HTML .= '<p style="text-align: center; min-height: 40px;"><small>This setting will apply to all devices which are smaller than the Device Width set for Mobile (Normal)</small></p>';
|
47 |
+
$control->add_control(array('type' => 'number', 'label' => 'Ad Width (px)', 'optionName' => 'device_small_mobile_adwidth', 'helpText' => 'The width of the ad block at the given browser screen width. (Leave empty for auto width)'));
|
48 |
+
$control->add_control(array('type' => 'textarea', 'label' => 'Styles', 'optionName' => 'device_small_mobile_styles', 'helpText' => 'You can add CSS to customize your ad block for this device type'));
|
49 |
+
$control->create_section('Devices - Mobile (Small)');
|
50 |
+
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
51 |
+
echo $control->HTML;
|
52 |
+
$control->clear_controls();
|
53 |
+
|
54 |
+
$control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'styles', 'helpText' => 'You can add CSS to customize your ad block'));
|
55 |
+
$control->create_section('Styles (Common)');
|
56 |
+
echo $control->HTML;
|
57 |
+
$control->clear_controls();
|
58 |
+
echo '</div>';
|
59 |
+
return $control;
|
60 |
+
}
|
61 |
+
|
62 |
+
|
63 |
+
?>
|
includes/{common/geotargeting.php → modules/core/units/geo-targeting.php}
RENAMED
@@ -1,6 +1,33 @@
|
|
1 |
<?php
|
2 |
$wpInsertGeoLocation = false;
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
4 |
/* Begin Generate Country List */
|
5 |
function wp_insert_get_countries() {
|
6 |
$data = array(
|
@@ -260,39 +287,6 @@ function wp_insert_get_countries() {
|
|
260 |
/* End Generate Country List */
|
261 |
|
262 |
/* Begin Get Geo Targeted Ad Code */
|
263 |
-
function wp_insert_get_geotargeted_adcode($adOptions) {
|
264 |
-
global $wpInsertGeoLocation;
|
265 |
-
global $wpInsertABTestingMode;
|
266 |
-
global $wpInsertVIAdDisplayed;
|
267 |
-
if(($wpInsertGeoLocation != false) && ($wpInsertGeoLocation != '') && ((is_array($adOptions['geo_group1_countries']) && (count($adOptions['geo_group1_countries']) > 0)) || (is_array($adOptions['geo_group2_countries']) && (count($adOptions['geo_group1_countries']) > 0)))) {
|
268 |
-
if(($adOptions['geo_group1_adcode'] != '') && in_array($wpInsertGeoLocation, $adOptions['geo_group1_countries'])) {
|
269 |
-
return do_shortcode(stripslashes($adOptions['geo_group1_adcode']));
|
270 |
-
}
|
271 |
-
if(($adOptions['geo_group2_adcode'] != '') && in_array($wpInsertGeoLocation, $adOptions['geo_group2_countries'])) {
|
272 |
-
return do_shortcode(stripslashes($adOptions['geo_group2_adcode']));
|
273 |
-
}
|
274 |
-
}
|
275 |
-
switch($wpInsertABTestingMode) {
|
276 |
-
case 1:
|
277 |
-
if(isset($adOptions['primary_ad_code_type']) && ($adOptions['primary_ad_code_type'] == 'vicode')) {
|
278 |
-
if($wpInsertVIAdDisplayed !== true) {
|
279 |
-
$wpInsertVIAdDisplayed = true;
|
280 |
-
return '<div id="wp_insert_vi_ad">'.wp_insert_vi_api_get_vi_code('wp_insert_vi_code_settings').'</div>';
|
281 |
-
} else {
|
282 |
-
return '';
|
283 |
-
}
|
284 |
-
} else {
|
285 |
-
return do_shortcode(stripslashes($adOptions['primary_ad_code']));
|
286 |
-
}
|
287 |
-
case 2:
|
288 |
-
return do_shortcode(stripslashes($adOptions['secondary_ad_code']));
|
289 |
-
case 3:
|
290 |
-
return do_shortcode(stripslashes($adOptions['tertiary_ad_code']));
|
291 |
-
default:
|
292 |
-
return do_shortcode(stripslashes($adOptions['primary_ad_code']));
|
293 |
-
}
|
294 |
-
}
|
295 |
-
|
296 |
add_action('init', 'wp_insert_ip_to_country');
|
297 |
function wp_insert_ip_to_country() {
|
298 |
global $wpInsertGeoLocation;
|
@@ -357,6 +351,24 @@ function wp_insert_is_geoip_enabled() {
|
|
357 |
}
|
358 |
}
|
359 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
360 |
return false;
|
361 |
}
|
362 |
/* End Get Geo Targeted Ad Code */
|
1 |
<?php
|
2 |
$wpInsertGeoLocation = false;
|
3 |
+
|
4 |
+
function wp_insert_form_accordion_tabs_geo_targeting($control, $identifier, $location) {
|
5 |
+
echo '<h3>Geo Targeting</h3>';
|
6 |
+
echo '<div>';
|
7 |
+
echo '<p>';
|
8 |
+
echo 'A Geo Targeted Ads have a higher priority than Ads configured via Multiple Ad Networks / A-B Testing.<br />';
|
9 |
+
echo 'If a Geo Targeting match is found all other Ads (Primary, Secondary and Tertiary Networks) will be ignored.';
|
10 |
+
echo '</p>';
|
11 |
+
$control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Countries', 'optionName' => 'geo_group1_countries', 'options' => wp_insert_get_countries()));
|
12 |
+
$control->add_control(array('type' => 'textarea', 'label' => 'Ad Code', 'style' => 'height: 220px;', 'optionName' => 'geo_group1_adcode'));
|
13 |
+
$control->create_section('Group 1');
|
14 |
+
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
|
15 |
+
echo $control->HTML;
|
16 |
+
$control->clear_controls();
|
17 |
+
|
18 |
+
$control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Countries', 'optionName' => 'geo_group2_countries', 'options' => wp_insert_get_countries()));
|
19 |
+
$control->add_control(array('type' => 'textarea', 'label' => 'Ad Code', 'style' => 'height: 220px;', 'optionName' => 'geo_group2_adcode'));
|
20 |
+
$control->create_section('Group 2');
|
21 |
+
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
22 |
+
echo $control->HTML;
|
23 |
+
$control->clear_controls();
|
24 |
+
echo '<p>';
|
25 |
+
echo 'This feature uses the Free Geo ip service from <a href="http://freegeoip.net/">freegeoip.net</a>, if you find this feature useful please consider donating to the project at <a href="http://freegeoip.net/">freegeoip.net</a>';
|
26 |
+
echo '</p>';
|
27 |
+
echo '</div>';
|
28 |
+
return $control;
|
29 |
+
}
|
30 |
+
|
31 |
/* Begin Generate Country List */
|
32 |
function wp_insert_get_countries() {
|
33 |
$data = array(
|
287 |
/* End Generate Country List */
|
288 |
|
289 |
/* Begin Get Geo Targeted Ad Code */
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
290 |
add_action('init', 'wp_insert_ip_to_country');
|
291 |
function wp_insert_ip_to_country() {
|
292 |
global $wpInsertGeoLocation;
|
351 |
}
|
352 |
}
|
353 |
}
|
354 |
+
|
355 |
+
$shortcodeads = get_option('wp_insert_shortcodeads');
|
356 |
+
if(isset($shortcodeads) && is_array($shortcodeads)) {
|
357 |
+
foreach($shortcodeads as $shortcodead) {
|
358 |
+
if(isset($shortcodead['geo_group1_countries']) && isset($shortcodead['geo_group2_countries']) && ((is_array($shortcodead['geo_group1_countries']) && (count($shortcodead['geo_group1_countries']) > 0)) || (is_array($shortcodead['geo_group2_countries']) && (count($shortcodead['geo_group2_countries']) > 0)))) {
|
359 |
+
return true;
|
360 |
+
}
|
361 |
+
}
|
362 |
+
}
|
363 |
+
|
364 |
+
$pagelevelads = get_option('wp_insert_pagelevelads');
|
365 |
+
if(isset($pagelevelads) && is_array($pagelevelads)) {
|
366 |
+
foreach($pagelevelads as $pagelevelad) {
|
367 |
+
if(isset($pagelevelad['geo_group1_countries']) && isset($pagelevelad['geo_group2_countries']) && ((is_array($pagelevelad['geo_group1_countries']) && (count($pagelevelad['geo_group1_countries']) > 0)) || (is_array($pagelevelad['geo_group2_countries']) && (count($pagelevelad['geo_group2_countries']) > 0)))) {
|
368 |
+
return true;
|
369 |
+
}
|
370 |
+
}
|
371 |
+
}
|
372 |
return false;
|
373 |
}
|
374 |
/* End Get Geo Targeted Ad Code */
|
includes/modules/core/units/js/module.js
ADDED
@@ -0,0 +1,154 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
function wp_insert_ads_click_handler(type, identifier, title, isNew) {
|
2 |
+
var preTitle = jQuery('#wp_insert_'+type+'_ad_'+identifier).attr('data-pre-title');
|
3 |
+
jQuery('<div id="wp_insert_'+type+'_'+identifier+'_dialog"></div>').html('<div class="wp_insert_ajaxloader"></div>').dialog({
|
4 |
+
'modal': true,
|
5 |
+
'resizable': false,
|
6 |
+
'width': jQuery("body").width() * 0.8,
|
7 |
+
'maxWidth': jQuery("body").width() * 0.8,
|
8 |
+
'maxHeight': jQuery("body").height() * 0.9,
|
9 |
+
'title': preTitle+' : '+title,
|
10 |
+
position: { my: 'center', at: 'center', of: window },
|
11 |
+
open: function (event, ui) {
|
12 |
+
jQuery('.ui-dialog').css({'z-index': 999999, 'max-width': '90%'});
|
13 |
+
jQuery('.ui-widget-overlay').css({'z-index': 999998, 'opacity': 0.8, 'background': '#000000'});
|
14 |
+
jQuery('.ui-dialog-buttonpane button:contains("Update")').button('disable');
|
15 |
+
jQuery.post(
|
16 |
+
jQuery('#wp_insert_admin_ajax').val(), {
|
17 |
+
'action': 'wp_insert_'+type+'_get_ad_form',
|
18 |
+
'wp_insert_identifier': identifier,
|
19 |
+
'wp_insert_type': type,
|
20 |
+
'wp_insert_nonce': jQuery('#wp_insert_nonce').val()
|
21 |
+
}, function(response) {
|
22 |
+
jQuery('.wp_insert_ajaxloader').hide();
|
23 |
+
jQuery('.ui-dialog-content').html(response);
|
24 |
+
jQuery('.ui-accordion .ui-accordion-content').css('max-height', (jQuery("body").height() * 0.45));
|
25 |
+
jQuery('.ui-dialog-buttonpane button:contains("Update")').button('enable');
|
26 |
+
jQuery('.wp_insert_'+type+'_status').parent().css({'display': 'inline-block', 'margin': '5px 0 0'}).prependTo('.ui-dialog-buttonpane');
|
27 |
+
jQuery('.ui-dialog').css({'position': 'fixed'});
|
28 |
+
jQuery('#wp_insert_'+type+'_'+identifier+'_dialog').delay(500).dialog({position: { my: 'center', at: 'center', of: window }});
|
29 |
+
}
|
30 |
+
);
|
31 |
+
},
|
32 |
+
buttons: {
|
33 |
+
'Update': {
|
34 |
+
text: 'Update',
|
35 |
+
icons: { primary: "ui-icon-gear" },
|
36 |
+
click: function() {
|
37 |
+
if(isNew) {
|
38 |
+
var newIdentifier = jQuery('.wp_insert_'+type+'_identifier').val();
|
39 |
+
var adLink = jQuery("<a></a>");
|
40 |
+
adLink.attr('id', 'wp_insert_'+type+'_ad_'+newIdentifier);
|
41 |
+
adLink.attr('href', 'javascript:;');
|
42 |
+
adLink.attr('data-pre-title', preTitle);
|
43 |
+
adLink.attr('onClick', "wp_insert_ads_click_handler(\'"+type+"\', \'"+newIdentifier+"\', \'"+jQuery('#wp_insert_'+type+'_'+newIdentifier+'_title').val()+"\', false)");
|
44 |
+
adLink.html(preTitle+' : '+jQuery('#wp_insert_'+type+'_'+newIdentifier+'_title').val());
|
45 |
+
var deleteButton = jQuery('<span></span>');
|
46 |
+
deleteButton.attr('class', 'dashicons dashicons-dismiss wp_insert_delete_icon');
|
47 |
+
deleteButton.attr('onClick', "wp_insert_ad_delete_handler(\'"+type+"\', \'"+newIdentifier+"\')");
|
48 |
+
jQuery('#wp_insert_'+type+'_ad_new').parent().before(jQuery('<p></p>').append(adLink, deleteButton));
|
49 |
+
wp_insert_ad_update_handler(type, newIdentifier);
|
50 |
+
} else {
|
51 |
+
jQuery("#wp_insert_"+type+"_ad_"+identifier).html(preTitle+' : '+jQuery('#wp_insert_'+type+'_'+identifier+'_title').val());
|
52 |
+
jQuery("#wp_insert_"+type+"_ad_"+identifier).attr('onClick', "wp_insert_ads_click_handler(\'"+type+"\', \'"+identifier+"\', \'"+jQuery('#wp_insert_'+type+'_'+identifier+'_title').val()+"\', false)");
|
53 |
+
wp_insert_ad_update_handler(type, identifier);
|
54 |
+
}
|
55 |
+
jQuery(this).dialog('close');
|
56 |
+
}
|
57 |
+
},
|
58 |
+
Cancel: {
|
59 |
+
text: 'Cancel',
|
60 |
+
icons: { primary: "ui-icon-cancel" },
|
61 |
+
click: function() {
|
62 |
+
jQuery(this).dialog('close');
|
63 |
+
}
|
64 |
+
}
|
65 |
+
},
|
66 |
+
close: function() {
|
67 |
+
jQuery(this).dialog('destroy');
|
68 |
+
}
|
69 |
+
});
|
70 |
+
}
|
71 |
+
|
72 |
+
function wp_insert_ad_update_handler(type, identifier) {
|
73 |
+
inputElements = jQuery('#wp_insert_'+type+'_'+identifier+'_accordion').find('.input').map(function() { return jQuery(this).attr('name'); }).get();
|
74 |
+
inputElements = jQuery.grep(inputElements, function(v, i) { return jQuery.inArray(v, inputElements) === i });
|
75 |
+
|
76 |
+
autoArgs = {};
|
77 |
+
if(jQuery('#wp_insert_'+type+'_'+identifier+'_status').length > 0) {
|
78 |
+
autoArgs['wp_insert_'+type+'_'+identifier+'_status'] = jQuery('#wp_insert_'+type+'_'+identifier+'_status').prop('checked');
|
79 |
+
}
|
80 |
+
jQuery.each(inputElements, function(key, value) {
|
81 |
+
currentElementID = value.replace('[', '_').replace(']', '');
|
82 |
+
while(currentElementID.includes('[') || currentElementID.includes(']')) {
|
83 |
+
var currentElementID = currentElementID.replace('[', '_').replace(']', '');
|
84 |
+
}
|
85 |
+
|
86 |
+
currentElement = jQuery('[name="'+value+'"]');
|
87 |
+
if(currentElement.prop('nodeName') == 'SELECT') {
|
88 |
+
if(currentElement.prop('multiple')) {
|
89 |
+
autoArgs[currentElementID] = jQuery.map(jQuery('[name="'+value+'"] :selected'), function(e) { return jQuery(e).val(); });
|
90 |
+
} else {
|
91 |
+
autoArgs[currentElementID] = currentElement.val();
|
92 |
+
}
|
93 |
+
} else if(currentElement.prop('nodeName') == 'INPUT') {
|
94 |
+
if(currentElement.attr('type') == 'checkbox') {
|
95 |
+
autoArgs[currentElementID] = currentElement.prop('checked');
|
96 |
+
} else if(currentElement.attr('type') == 'radio') {
|
97 |
+
autoArgs[currentElementID] = jQuery('[name="'+value+'"]:checked').val();
|
98 |
+
} else {
|
99 |
+
autoArgs[currentElementID] = currentElement.val();
|
100 |
+
}
|
101 |
+
} else {
|
102 |
+
autoArgs[currentElementID] = currentElement.val();
|
103 |
+
}
|
104 |
+
});
|
105 |
+
|
106 |
+
parameters = [];
|
107 |
+
jQuery.each(autoArgs, function(key, value) {
|
108 |
+
parameters.push(key);
|
109 |
+
});
|
110 |
+
|
111 |
+
autoArgs['action'] = 'wp_insert_'+type+'_save_ad_data';
|
112 |
+
autoArgs['wp_insert_nonce'] = jQuery('#wp_insert_nonce').val();
|
113 |
+
autoArgs['wp_insert_identifier'] = identifier;
|
114 |
+
autoArgs['wp_insert_type'] = type;
|
115 |
+
autoArgs['wp_insert_parameters'] = parameters;
|
116 |
+
/*alert(JSON.stringify(autoArgs, null, 4));*/
|
117 |
+
jQuery.post(
|
118 |
+
jQuery('#wp_insert_admin_ajax').val(), autoArgs, function(response) { }
|
119 |
+
);
|
120 |
+
}
|
121 |
+
|
122 |
+
function wp_insert_ad_delete_handler(type, identifier) {
|
123 |
+
jQuery("<p>Are you Sure you want to remove this Ad Unit?</p>").dialog({
|
124 |
+
'modal': true,
|
125 |
+
'resizable': false,
|
126 |
+
'title': 'Deletion Confirmation',
|
127 |
+
position: { my: 'center', at: 'center', of: window },
|
128 |
+
open: function (event, ui) {
|
129 |
+
jQuery('.ui-dialog').css({'z-index': 999999, 'max-width': '90%'});
|
130 |
+
jQuery('.ui-widget-overlay').css({'z-index': 999998, 'opacity': 0.8, 'background': '#000000'});
|
131 |
+
},
|
132 |
+
buttons : {
|
133 |
+
'Confirm': function() {
|
134 |
+
jQuery('#wp_insert_'+type+'_ad_'+identifier).parent().remove();
|
135 |
+
jQuery.post(
|
136 |
+
jQuery('#wp_insert_admin_ajax').val(), {
|
137 |
+
'action': 'wp_insert_'+type+'_delete_ad_data',
|
138 |
+
'wp_insert_nonce': jQuery('#wp_insert_nonce').val(),
|
139 |
+
'wp_insert_type': type,
|
140 |
+
'wp_insert_identifier': identifier
|
141 |
+
}, function(response) {
|
142 |
+
}
|
143 |
+
);
|
144 |
+
jQuery(this).dialog("close");
|
145 |
+
},
|
146 |
+
'Cancel': function() {
|
147 |
+
jQuery(this).dialog("close");
|
148 |
+
}
|
149 |
+
},
|
150 |
+
close: function() {
|
151 |
+
jQuery(this).dialog('destroy');
|
152 |
+
}
|
153 |
+
});
|
154 |
+
}
|
includes/modules/core/units/module.php
ADDED
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* Begin Include Files */
|
3 |
+
require_once(dirname(__FILE__).'/adunit.php');
|
4 |
+
require_once(dirname(__FILE__).'/adcode.php');
|
5 |
+
require_once(dirname(__FILE__).'/device-styles.php');
|
6 |
+
require_once(dirname(__FILE__).'/geo-targeting.php');
|
7 |
+
require_once(dirname(__FILE__).'/notes.php');
|
8 |
+
require_once(dirname(__FILE__).'/rules.php');
|
9 |
+
/* End Include Files */
|
10 |
+
|
11 |
+
/* Begin Add Assets */
|
12 |
+
add_action('wp_insert_modules_js', 'wp_insert_module_adform_js', 0);
|
13 |
+
function wp_insert_module_adform_js() {
|
14 |
+
wp_register_script('wp-insert-module-adform-js', WP_INSERT_URL.'includes/modules/core/units/js/module.js', array('wp-insert-js'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
|
15 |
+
wp_enqueue_script('wp-insert-module-adform-js');
|
16 |
+
}
|
17 |
+
/* End Add Assets */
|
18 |
+
|
19 |
+
/* Begin Get Admin Panel Card*/
|
20 |
+
function wp_insert_get_plugin_card($title, $description, $type, $preTitle) {
|
21 |
+
echo '<div class="plugin-card">';
|
22 |
+
echo '<div class="plugin-card-top">';
|
23 |
+
echo '<h4>'.$title.'</h4>';
|
24 |
+
echo $description;
|
25 |
+
echo '</div>';
|
26 |
+
echo '<div class="plugin-card-bottom">';
|
27 |
+
$data = get_option('wp_insert_'.$type);
|
28 |
+
if(isset($data) && is_array($data)) {
|
29 |
+
foreach($data as $key => $value) {
|
30 |
+
/* Begin Workaround for migrating old users to new system (can be removed in a later version) */
|
31 |
+
$title = $key;
|
32 |
+
if(!isset($value['title']) || ($value['title'] == '')) {
|
33 |
+
switch($key) {
|
34 |
+
case 'above':
|
35 |
+
$title = 'Above Post Content';
|
36 |
+
break;
|
37 |
+
case 'middle':
|
38 |
+
$title = 'Middle of Post Content';
|
39 |
+
break;
|
40 |
+
case 'below':
|
41 |
+
$title = 'Below Post Content';
|
42 |
+
break;
|
43 |
+
case 'left':
|
44 |
+
$title = 'To the Left of Post Content';
|
45 |
+
break;
|
46 |
+
case 'right':
|
47 |
+
$title = 'To the Right of Post Content';
|
48 |
+
break;
|
49 |
+
}
|
50 |
+
} else {
|
51 |
+
$title = $value['title'];
|
52 |
+
}
|
53 |
+
/* End Workaround for migrating old users to new system (can be removed in a later version) */
|
54 |
+
echo '<p>';
|
55 |
+
echo '<a id="wp_insert_'.$type.'_ad_'.$key.'" href="javascript:;" data-pre-title="'.$preTitle.'" onclick="wp_insert_ads_click_handler(\''.$type.'\', \''.$key.'\', \''.$value['title'].'\', false)">'.$preTitle.' : '.$title.'</a>';
|
56 |
+
echo '<span class="dashicons dashicons-dismiss wp_insert_delete_icon" onclick="wp_insert_ad_delete_handler(\''.$type.'\', \''.$key.'\')"></span>';
|
57 |
+
echo '</p>';
|
58 |
+
}
|
59 |
+
}
|
60 |
+
echo '<p style="text-align: center; padding: 20px 0 10px;"><a id="wp_insert_'.$type.'_ad_new" data-pre-title="'.$preTitle.'" href="#" class="button-secondary" onclick="wp_insert_ads_click_handler(\''.$type.'\', \'new\', \'Add New\', true)">Add New</a></p>';
|
61 |
+
echo '</div>';
|
62 |
+
echo '</div>';
|
63 |
+
}
|
64 |
+
/* End Get Admin Panel Card*/
|
65 |
+
|
66 |
+
/* Begin Get Ad Form */
|
67 |
+
function wp_insert_get_ad_form($script = '') {
|
68 |
+
check_ajax_referer('wp-insert', 'wp_insert_nonce');
|
69 |
+
if(isset($_POST['wp_insert_identifier']) && isset($_POST['wp_insert_type'])) {
|
70 |
+
$type = $_POST['wp_insert_type'];
|
71 |
+
$identifier = substr(str_shuffle(str_repeat("abcdefghijklmnopqrstuvwxyz", 5)), 0, 5).uniqid();
|
72 |
+
if($_POST['wp_insert_identifier'] != 'new') {
|
73 |
+
$identifier = $_POST['wp_insert_identifier'];
|
74 |
+
}
|
75 |
+
$data = get_option('wp_insert_'.$type);
|
76 |
+
echo '<div class="wp_insert_popup_content_wrapper">';
|
77 |
+
$control = new smartlogixControls(array('optionIdentifier' => 'wp_insert_'.$type.'['.$identifier.']', 'values' => $data[$identifier]));
|
78 |
+
$control->add_control(array('type' => 'ipCheckbox', 'className' => 'wp_insert_'.$type.'_status', 'optionName' => 'status'));
|
79 |
+
$control->add_control(array('type' => 'hidden', 'className' => 'wp_insert_'.$type.'_identifier', 'optionName' => 'identifier', 'value' => $identifier));
|
80 |
+
echo $control->HTML;
|
81 |
+
$control->clear_controls();
|
82 |
+
echo '<div id="wp_insert_'.$type.'_'.$identifier.'_accordion">';
|
83 |
+
$control = apply_filters('wp_insert_'.$type.'_form_accordion_tabs', $control, $identifier, $type);
|
84 |
+
echo '</div>';
|
85 |
+
echo '<script type="text/javascript">';
|
86 |
+
echo $control->JS;
|
87 |
+
echo 'jQuery("#wp_insert_'.$type.'_'.$identifier.'_accordion").accordion({ icons: { header: "ui-icon-circle-arrow-e", activeHeader: "ui-icon-circle-arrow-s" }, heightStyle: "auto" });';
|
88 |
+
if($script != '') {
|
89 |
+
echo str_replace('###IDENTIFIER###', $identifier, $script);
|
90 |
+
}
|
91 |
+
echo '</script>';
|
92 |
+
echo '</div>';
|
93 |
+
}
|
94 |
+
die();
|
95 |
+
}
|
96 |
+
/* End Get Ad Form */
|
97 |
+
|
98 |
+
/* Begin Save Ad Data */
|
99 |
+
function wp_insert_save_ad_data() {
|
100 |
+
check_ajax_referer('wp-insert', 'wp_insert_nonce');
|
101 |
+
if((isset($_POST['wp_insert_identifier']) && ($_POST['wp_insert_identifier'] != '')) && (isset($_POST['wp_insert_type'])&& ($_POST['wp_insert_type'] != '')) && (isset($_POST['wp_insert_parameters']) && (is_array($_POST['wp_insert_parameters'])))) {
|
102 |
+
$type = $_POST['wp_insert_type'];
|
103 |
+
$parameters = $_POST['wp_insert_parameters'];
|
104 |
+
$data = get_option('wp_insert_'.$type);
|
105 |
+
foreach($parameters as $parameter) {
|
106 |
+
$data[$_POST['wp_insert_identifier']][str_replace(array('wp_insert_', $type.'_', $_POST['wp_insert_identifier'].'_'), '', $parameter)] = ((isset($_POST[$parameter]))?$_POST[$parameter]:'');
|
107 |
+
}
|
108 |
+
echo '<pre>'; print_r($data); echo '</pre>';
|
109 |
+
|
110 |
+
update_option('wp_insert_'.$type, $data);
|
111 |
+
|
112 |
+
if(function_exists('wp_insert_adstxt_adsense_admin_notice_reset')) {
|
113 |
+
wp_insert_adstxt_adsense_admin_notice_reset();
|
114 |
+
}
|
115 |
+
}
|
116 |
+
die();
|
117 |
+
}
|
118 |
+
/* End Save Ad Data */
|
119 |
+
|
120 |
+
/* Begin Delete Ad Data */
|
121 |
+
function wp_insert_delete_ad_data() {
|
122 |
+
check_ajax_referer('wp-insert', 'wp_insert_nonce');
|
123 |
+
if((isset($_POST['wp_insert_identifier']) && ($_POST['wp_insert_identifier'] != '')) && (isset($_POST['wp_insert_type'])&& ($_POST['wp_insert_type'] != ''))) {
|
124 |
+
$type = $_POST['wp_insert_type'];
|
125 |
+
$data = get_option('wp_insert_'.$type);
|
126 |
+
unset($data[$_POST['wp_insert_identifier']]);
|
127 |
+
update_option('wp_insert_'.$type, $data);
|
128 |
+
|
129 |
+
if(function_exists('wp_insert_adstxt_adsense_admin_notice_reset')) {
|
130 |
+
wp_insert_adstxt_adsense_admin_notice_reset();
|
131 |
+
}
|
132 |
+
}
|
133 |
+
die();
|
134 |
+
}
|
135 |
+
/* End Delete Ad Data */
|
136 |
+
?>
|
includes/modules/core/units/notes.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
function wp_insert_form_accordion_tabs_notes($control, $identifier, $location) {
|
3 |
+
echo '<h3>Notes</h3>';
|
4 |
+
echo '<div>';
|
5 |
+
|
6 |
+
$title = $identifier;
|
7 |
+
if(!isset($control->values['title']) || ($control->values['title'] == '')) {
|
8 |
+
switch($identifier) {
|
9 |
+
case 'above':
|
10 |
+
$title = 'Above Post Content';
|
11 |
+
break;
|
12 |
+
case 'middle':
|
13 |
+
$title = 'Middle of Post Content';
|
14 |
+
break;
|
15 |
+
case 'below':
|
16 |
+
$title = 'Below Post Content';
|
17 |
+
break;
|
18 |
+
case 'left':
|
19 |
+
$title = 'To the Left of Post Content';
|
20 |
+
break;
|
21 |
+
case 'right':
|
22 |
+
$title = 'To the Right of Post Content';
|
23 |
+
break;
|
24 |
+
default:
|
25 |
+
$title = $identifier;
|
26 |
+
break;
|
27 |
+
}
|
28 |
+
} else {
|
29 |
+
$title = $control->values['title'];
|
30 |
+
}
|
31 |
+
echo $title;
|
32 |
+
$control->add_control(array('type' => 'text', 'optionName' => 'title', 'helpText' => 'The title is used to identify your Ad Widget easily in future. A Random Title will be assigned to your Ad widget by default.', 'value' => $title));
|
33 |
+
$control->create_section('Title');
|
34 |
+
echo $control->HTML;
|
35 |
+
$control->clear_controls();
|
36 |
+
|
37 |
+
$control->add_control(array('type' => 'textarea', 'optionName' => 'notes', 'style' => 'height: 220px;'));
|
38 |
+
$control->create_section('Notes');
|
39 |
+
echo $control->HTML;
|
40 |
+
$control->clear_controls();
|
41 |
+
echo '</div>';
|
42 |
+
return $control;
|
43 |
+
}
|
44 |
+
?>
|
includes/modules/core/units/rules.php
ADDED
@@ -0,0 +1,137 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
function wp_insert_form_accordion_tabs_rules($control, $identifier, $location) {
|
3 |
+
$posts_per_page = get_option('posts_per_page');
|
4 |
+
$instances = array();
|
5 |
+
for($i = 1; $i <= $posts_per_page; $i++) {
|
6 |
+
$instances[] = array('text' => 'Hide on '.wp_insert_add_ordinal_number_suffix($i).' Post', 'value' => $i);
|
7 |
+
}
|
8 |
+
|
9 |
+
echo '<h3>Rules</h3>';
|
10 |
+
if($location == 'inpostads') {
|
11 |
+
echo '<div>';
|
12 |
+
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_loggedin'));
|
13 |
+
$control->create_section('Logged in Users');
|
14 |
+
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
|
15 |
+
echo $control->HTML;
|
16 |
+
$control->clear_controls();
|
17 |
+
|
18 |
+
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_mobile_devices'));
|
19 |
+
$control->create_section('Mobile Devices');
|
20 |
+
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
21 |
+
echo $control->HTML;
|
22 |
+
$control->clear_controls();
|
23 |
+
|
24 |
+
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_404'));
|
25 |
+
$control->create_section('404 Pages');
|
26 |
+
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
27 |
+
echo $control->HTML;
|
28 |
+
$control->clear_controls();
|
29 |
+
|
30 |
+
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_home'));
|
31 |
+
$control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Instances', 'optionName' => 'rules_home_instances', 'options' => $instances));
|
32 |
+
$control->create_section('Home');
|
33 |
+
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
|
34 |
+
echo $control->HTML;
|
35 |
+
$control->clear_controls();
|
36 |
+
|
37 |
+
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_archives'));
|
38 |
+
$control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Instances', 'optionName' => 'rules_archives_instances', 'options' => $instances));
|
39 |
+
$control->create_section('Archives');
|
40 |
+
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
41 |
+
echo $control->HTML;
|
42 |
+
$control->clear_controls();
|
43 |
+
|
44 |
+
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_search'));
|
45 |
+
$control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Instances', 'optionName' => 'rules_search_instances', 'options' => $instances));
|
46 |
+
$control->create_section('Search Results');
|
47 |
+
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
|
48 |
+
echo $control->HTML;
|
49 |
+
$control->clear_controls();
|
50 |
+
|
51 |
+
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_page'));
|
52 |
+
$control->add_control(array('type' => 'pages-chosen-multiselect', 'label' => 'Exceptions', 'optionName' => 'rules_page_exceptions'));
|
53 |
+
$control->create_section('Single Pages');
|
54 |
+
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
55 |
+
echo $control->HTML;
|
56 |
+
$control->clear_controls();
|
57 |
+
|
58 |
+
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_post'));
|
59 |
+
$control->add_control(array('type' => 'posts-chosen-multiselect', 'label' => 'Exceptions', 'optionName' => 'rules_post_exceptions'));
|
60 |
+
$control->add_control(array('type' => 'categories-chosen-multiselect', 'label' => 'Category Exceptions', 'optionName' => 'rules_post_categories_exceptions'));
|
61 |
+
$control->create_section('Single Posts');
|
62 |
+
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
|
63 |
+
echo $control->HTML;
|
64 |
+
$control->clear_controls();
|
65 |
+
|
66 |
+
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_categories'));
|
67 |
+
$control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Instances', 'optionName' => 'rules_categories_instances', 'options' => $instances));
|
68 |
+
$control->add_control(array('type' => 'categories-chosen-multiselect', 'label' => 'Exceptions', 'optionName' => 'rules_categories_exceptions'));
|
69 |
+
$control->create_section('Category Archives');
|
70 |
+
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
71 |
+
echo $control->HTML;
|
72 |
+
$control->clear_controls();
|
73 |
+
echo '</div>';
|
74 |
+
} else {
|
75 |
+
echo '<div>';
|
76 |
+
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_loggedin'));
|
77 |
+
$control->create_section('Logged in Users');
|
78 |
+
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
|
79 |
+
echo $control->HTML;
|
80 |
+
$control->clear_controls();
|
81 |
+
|
82 |
+
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_mobile_devices'));
|
83 |
+
$control->create_section('Mobile Devices');
|
84 |
+
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
85 |
+
echo $control->HTML;
|
86 |
+
$control->clear_controls();
|
87 |
+
|
88 |
+
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_404'));
|
89 |
+
$control->create_section('404 Pages');
|
90 |
+
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
|
91 |
+
echo $control->HTML;
|
92 |
+
$control->clear_controls();
|
93 |
+
|
94 |
+
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_home'));
|
95 |
+
$control->create_section('Home');
|
96 |
+
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
97 |
+
echo $control->HTML;
|
98 |
+
$control->clear_controls();
|
99 |
+
|
100 |
+
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_archives'));
|
101 |
+
$control->create_section('Archives');
|
102 |
+
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
|
103 |
+
echo $control->HTML;
|
104 |
+
$control->clear_controls();
|
105 |
+
|
106 |
+
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_search'));
|
107 |
+
$control->create_section('Search Results');
|
108 |
+
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
109 |
+
echo $control->HTML;
|
110 |
+
$control->clear_controls();
|
111 |
+
|
112 |
+
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_page'));
|
113 |
+
$control->add_control(array('type' => 'pages-chosen-multiselect', 'label' => 'Exceptions', 'optionName' => 'rules_page_exceptions'));
|
114 |
+
$control->create_section('Single Pages');
|
115 |
+
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
|
116 |
+
echo $control->HTML;
|
117 |
+
$control->clear_controls();
|
118 |
+
|
119 |
+
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_categories'));
|
120 |
+
$control->add_control(array('type' => 'categories-chosen-multiselect', 'label' => 'Exceptions', 'optionName' => 'rules_categories_exceptions'));
|
121 |
+
$control->create_section('Category Archives');
|
122 |
+
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
123 |
+
echo $control->HTML;
|
124 |
+
$control->clear_controls();
|
125 |
+
|
126 |
+
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_post'));
|
127 |
+
$control->add_control(array('type' => 'posts-chosen-multiselect', 'label' => 'Exceptions', 'optionName' => 'rules_post_exceptions'));
|
128 |
+
$control->add_control(array('type' => 'categories-chosen-multiselect', 'label' => 'Category Exceptions', 'optionName' => 'rules_post_categories_exceptions'));
|
129 |
+
$control->create_section('Single Posts');
|
130 |
+
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
131 |
+
echo $control->HTML;
|
132 |
+
$control->clear_controls();
|
133 |
+
echo '</div>';
|
134 |
+
}
|
135 |
+
return $control;
|
136 |
+
}
|
137 |
+
?>
|
includes/modules/general/inpost/js/module.js
ADDED
@@ -0,0 +1,82 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
function wp_insert_inpostads_primary_ad_code_location_change_action(identifier) {
|
2 |
+
jQuery('input[name="wp_insert_inpostads['+identifier+'][location]"]').click(function() {
|
3 |
+
var location = jQuery('input[name="wp_insert_inpostads['+identifier+'][location]"]:checked').val();
|
4 |
+
if((location == 'above') || (location == 'middle') || (location == 'paragraphtop')) {
|
5 |
+
jQuery('#primary_ad_code_type_vicode').parent().parent().parent().show();
|
6 |
+
jQuery('#primary_ad_code_type_generic').show();
|
7 |
+
jQuery('#primary_ad_code_type_generic').parent().find('.isSelectedIndicatorText').html('Generic / Custom Ad Code (Primary Network)');
|
8 |
+
jQuery('#primary_ad_code_type_generic').parent().parent().parent().css({'width': 'calc(50% - 40px)', 'margin': '0 20px 5px', 'float': 'left'});
|
9 |
+
//jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').val('generic');
|
10 |
+
} else {
|
11 |
+
jQuery('#primary_ad_code_type_vicode').parent().parent().parent().hide();
|
12 |
+
jQuery('#primary_ad_code_type_generic').hide();
|
13 |
+
jQuery('#primary_ad_code_type_generic').parent().find('.isSelectedIndicatorText').html('Ad Code (Primary Network)');
|
14 |
+
jQuery('#primary_ad_code_type_generic').parent().parent().parent().css({'width': '100%', 'margin': '15px 0', 'float': 'none'});
|
15 |
+
jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').val('generic');
|
16 |
+
}
|
17 |
+
|
18 |
+
if(location == 'middle') {
|
19 |
+
jQuery('.wp_insert_inpostads_location_middle_panel').show();
|
20 |
+
} else {
|
21 |
+
jQuery('.wp_insert_inpostads_location_middle_panel').hide();
|
22 |
+
}
|
23 |
+
});
|
24 |
+
var location = jQuery('input[name="wp_insert_inpostads['+identifier+'][location]"]:checked').val();
|
25 |
+
if((location == 'above') || (location == 'middle') || (location == 'paragraphtop')) {
|
26 |
+
jQuery('#primary_ad_code_type_vicode').parent().parent().parent().show();
|
27 |
+
jQuery('#primary_ad_code_type_generic').show();
|
28 |
+
jQuery('#primary_ad_code_type_generic').parent().find('.isSelectedIndicatorText').html('Generic / Custom Ad Code (Primary Network)');
|
29 |
+
jQuery('#primary_ad_code_type_generic').parent().parent().parent().css({'width': 'calc(50% - 40px)', 'margin': '0 20px 5px', 'float': 'left'});
|
30 |
+
//jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').val('generic');
|
31 |
+
} else {
|
32 |
+
jQuery('#primary_ad_code_type_vicode').parent().parent().parent().hide();
|
33 |
+
jQuery('#primary_ad_code_type_generic').hide();
|
34 |
+
jQuery('#primary_ad_code_type_generic').parent().find('.isSelectedIndicatorText').html('Ad Code (Primary Network)');
|
35 |
+
jQuery('#primary_ad_code_type_generic').parent().parent().parent().css({'width': '100%', 'margin': '15px 0', 'float': 'none'});
|
36 |
+
jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').val('generic');
|
37 |
+
}
|
38 |
+
|
39 |
+
if(location == 'middle') {
|
40 |
+
jQuery('.wp_insert_inpostads_location_middle_panel').show();
|
41 |
+
} else {
|
42 |
+
jQuery('.wp_insert_inpostads_location_middle_panel').hide();
|
43 |
+
}
|
44 |
+
}
|
45 |
+
|
46 |
+
function wp_insert_inpostads_primary_ad_code_type_change(identifier) {
|
47 |
+
jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').parent().hide();
|
48 |
+
jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').change(function() {
|
49 |
+
jQuery('.isSelectedIndicator').removeClass('active');
|
50 |
+
jQuery('#primary_ad_code_type_'+jQuery(this).val()).addClass('active');
|
51 |
+
});
|
52 |
+
jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').change();
|
53 |
+
|
54 |
+
jQuery('#primary_ad_code_type_generic').click(function() {
|
55 |
+
jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').val('generic');
|
56 |
+
jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').change();
|
57 |
+
});
|
58 |
+
jQuery('#primary_ad_code_type_generic').parent().click(function() {
|
59 |
+
jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').val('generic');
|
60 |
+
jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').change();
|
61 |
+
});
|
62 |
+
|
63 |
+
jQuery('#primary_ad_code_type_vicode').click(function() {
|
64 |
+
if(!jQuery('#primary_ad_code_type_vicode').hasClass('disabled')) {
|
65 |
+
jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').val('vicode');
|
66 |
+
jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').change();
|
67 |
+
}
|
68 |
+
});
|
69 |
+
jQuery('#primary_ad_code_type_vicode').parent().click(function() {
|
70 |
+
if(!jQuery('#primary_ad_code_type_vicode').hasClass('disabled')) {
|
71 |
+
jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').val('vicode');
|
72 |
+
jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').change();
|
73 |
+
}
|
74 |
+
});
|
75 |
+
}
|
76 |
+
|
77 |
+
function wp_insert_inpostads_vi_customize_adcode() {
|
78 |
+
jQuery('#wp_insert_inpostads_vi_customize_adcode').click(function() {
|
79 |
+
jQuery('.ui-dialog-titlebar').find('button').last().button('enable').click();
|
80 |
+
jQuery('#wp_insert_vi_customize_adcode').click();
|
81 |
+
});
|
82 |
+
}
|
includes/modules/general/inpost/module.php
ADDED
@@ -0,0 +1,231 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* Begin Add Assets */
|
3 |
+
add_action('wp_insert_modules_js', 'wp_insert_module_inpostads_js', 0);
|
4 |
+
function wp_insert_module_inpostads_js() {
|
5 |
+
wp_register_script('wp-insert-module-inpostads-js', WP_INSERT_URL.'includes/modules/general/inpost/js/module.js', array('wp-insert-js'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
|
6 |
+
wp_enqueue_script('wp-insert-module-inpostads-js');
|
7 |
+
}
|
8 |
+
/* End Add Assets */
|
9 |
+
|
10 |
+
/* Begin UI Functions */
|
11 |
+
add_action('wp_insert_plugin_card', 'wp_insert_inpostads_plugin_card', 20);
|
12 |
+
function wp_insert_inpostads_plugin_card() {
|
13 |
+
wp_insert_get_plugin_card(
|
14 |
+
'In-Post Ads',
|
15 |
+
'<p>Ads shown within the post content.<br />You can choose different locations to insert ads from Above / Below / Inside / Middle Of / To the Left / To the Right of post content</p>',
|
16 |
+
'inpostads',
|
17 |
+
'In-Post Ad'
|
18 |
+
);
|
19 |
+
}
|
20 |
+
|
21 |
+
add_action('wp_ajax_wp_insert_inpostads_get_ad_form', 'wp_insert_inpostads_get_ad_form');
|
22 |
+
function wp_insert_inpostads_get_ad_form() {
|
23 |
+
wp_insert_get_ad_form('wp_insert_inpostads_primary_ad_code_type_change("###IDENTIFIER###"); wp_insert_inpostads_primary_ad_code_location_change_action("###IDENTIFIER###"); wp_insert_inpostads_vi_customize_adcode();');
|
24 |
+
}
|
25 |
+
add_action('wp_ajax_wp_insert_inpostads_save_ad_data', 'wp_insert_save_ad_data');
|
26 |
+
add_action('wp_ajax_wp_insert_inpostads_delete_ad_data', 'wp_insert_delete_ad_data');
|
27 |
+
|
28 |
+
add_filter('wp_insert_inpostads_form_accordion_tabs', 'wp_insert_inpostads_form_accordion_tabs_location', 10, 3);
|
29 |
+
function wp_insert_inpostads_form_accordion_tabs_location($control, $identifier, $location) {
|
30 |
+
echo '<h3>Location</h3>';
|
31 |
+
echo '<div>';
|
32 |
+
$paragraphPositioningOptions = array(
|
33 |
+
array('text' => '1st', 'value' => '1'),
|
34 |
+
array('text' => '2nd', 'value' => '2'),
|
35 |
+
array('text' => '3rd', 'value' => '3'),
|
36 |
+
array('text' => '4th', 'value' => '4'),
|
37 |
+
array('text' => '5th', 'value' => '5'),
|
38 |
+
array('text' => '6th', 'value' => '6'),
|
39 |
+
array('text' => '7th', 'value' => '7'),
|
40 |
+
array('text' => '8th', 'value' => '8'),
|
41 |
+
array('text' => '9th', 'value' => '9'),
|
42 |
+
array('text' => '10th', 'value' => '10'),
|
43 |
+
);
|
44 |
+
$control->add_control(array('type' => 'select', 'className' => 'input', 'style' => 'display: inline;', 'useParagraph' => false, 'optionName' => 'paragraphtopposition', 'options' => $paragraphPositioningOptions));
|
45 |
+
$nthParagraphTopControl = $control->HTML;
|
46 |
+
$control->clear_controls();
|
47 |
+
$control->add_control(array('type' => 'select', 'className' => 'input', 'style' => 'display: inline;', 'useParagraph' => false, 'optionName' => 'paragraphbottomposition', 'options' => $paragraphPositioningOptions));
|
48 |
+
$nthParagraphBottomControl = $control->HTML;
|
49 |
+
$control->clear_controls();
|
50 |
+
|
51 |
+
$location = '';
|
52 |
+
if(!isset($control->values['location'])) {
|
53 |
+
switch($identifier) {
|
54 |
+
case 'above':
|
55 |
+
$location = 'above';
|
56 |
+
break;
|
57 |
+
case 'middle':
|
58 |
+
$location = 'middle';
|
59 |
+
break;
|
60 |
+
case 'below':
|
61 |
+
$location = 'below';
|
62 |
+
break;
|
63 |
+
case 'left':
|
64 |
+
$location = 'left';
|
65 |
+
break;
|
66 |
+
case 'right':
|
67 |
+
$location = 'right';
|
68 |
+
break;
|
69 |
+
default:
|
70 |
+
$location = 'above';
|
71 |
+
break;
|
72 |
+
}
|
73 |
+
} else {
|
74 |
+
$location = $control->values['location'];
|
75 |
+
}
|
76 |
+
$locations = array(
|
77 |
+
array('text' => 'Above Post Content', 'value' => 'above'),
|
78 |
+
array('text' => 'Middle of Post Content', 'value' => 'middle'),
|
79 |
+
array('text' => 'Below Post Content', 'value' => 'below'),
|
80 |
+
array('text' => 'To the Left of Post Content', 'value' => 'left'),
|
81 |
+
array('text' => 'To the Right of Post Content', 'value' => 'right'),
|
82 |
+
array('text' => 'After '.$nthParagraphTopControl.' Paragraph in Post Content (From the Top)', 'value' => 'paragraphtop'),
|
83 |
+
array('text' => 'After '.$nthParagraphBottomControl.' Paragraph in Post Content (From the Bottom)', 'value' => 'paragraphbottom'),
|
84 |
+
);
|
85 |
+
$control->add_control(array('type' => 'radio-group', 'style' => 'line-height: 40px; margin-top: 3px;', 'optionName' => 'location', 'options' => $locations, 'value' => $location));
|
86 |
+
$control->create_section('Location');
|
87 |
+
echo $control->HTML;
|
88 |
+
$control->clear_controls();
|
89 |
+
echo '</div>';
|
90 |
+
return $control;
|
91 |
+
}
|
92 |
+
add_filter('wp_insert_inpostads_form_accordion_tabs', 'wp_insert_form_accordion_tabs_adcode', 20, 3);
|
93 |
+
add_filter('wp_insert_inpostads_form_accordion_tabs', 'wp_insert_form_accordion_tabs_rules', 30, 3);
|
94 |
+
add_filter('wp_insert_inpostads_form_accordion_tabs', 'wp_insert_form_accordion_tabs_geo_targeting', 40, 3);
|
95 |
+
add_filter('wp_insert_inpostads_form_accordion_tabs', 'wp_insert_form_accordion_tabs_devices_styles', 50, 3);
|
96 |
+
add_filter('wp_insert_inpostads_form_accordion_tabs', 'wp_insert_form_accordion_tabs_notes', 60, 3);
|
97 |
+
add_filter('wp_insert_inpostads_form_accordion_tabs', 'wp_insert_inpostads_form_accordion_tabs_positioning', 70, 3);
|
98 |
+
function wp_insert_inpostads_form_accordion_tabs_positioning($control, $identifier, $location) {
|
99 |
+
echo '<h3 class="wp_insert_inpostads_location_middle_panel">Positioning</h3>';
|
100 |
+
echo '<div>';
|
101 |
+
$control->add_control(array('type' => 'text', 'label' => 'Minimum Character Count', 'optionName' => 'minimum_character_count', 'helpText' => 'Show the ad only if the Content meets the minimum character count. If this parameter is set to 0 (or empty) minimum character count check will be deactivated.'));
|
102 |
+
$control->add_control(array('type' => 'text', 'label' => 'Paragraph Buffer Count', 'optionName' => 'paragraph_buffer_count', 'helpText' => 'Shows the ad after X number of Paragraphs. If this parameter is set to 0 (or empty) the ad will appear in the middle of the content.'));
|
103 |
+
$control->create_section('Positioning');
|
104 |
+
echo $control->HTML;
|
105 |
+
$control->clear_controls();
|
106 |
+
echo '</div>';
|
107 |
+
return $control;
|
108 |
+
}
|
109 |
+
/* End UI Functions */
|
110 |
+
|
111 |
+
/* Begin In-Post Ads Ad Insertion */
|
112 |
+
add_filter('the_content', 'wp_insert_inpostads_the_content', 100);
|
113 |
+
function wp_insert_inpostads_the_content($content) {
|
114 |
+
if(function_exists('is_amp_endpoint') && is_amp_endpoint()) {
|
115 |
+
return $content;
|
116 |
+
} else if(!is_feed() && is_main_query()) {
|
117 |
+
$inpostads = get_option('wp_insert_inpostads');
|
118 |
+
if(isset($inpostads) && is_array($inpostads)) {
|
119 |
+
$paragraphCount = wp_insert_inpostads_get_paragraph_count($content);
|
120 |
+
foreach($inpostads as $key => $inpostad) {
|
121 |
+
if(!isset($inpostad['location'])) { //Get the location value from the key for old users who doesnt have a location saved.
|
122 |
+
switch($key) {
|
123 |
+
case 'above':
|
124 |
+
$inpostad['location'] = 'above';
|
125 |
+
break;
|
126 |
+
case 'middle':
|
127 |
+
$inpostad['location'] = 'middle';
|
128 |
+
break;
|
129 |
+
case 'below':
|
130 |
+
$inpostad['location'] = 'below';
|
131 |
+
break;
|
132 |
+
case 'left':
|
133 |
+
$inpostad['location'] = 'left';
|
134 |
+
break;
|
135 |
+
case 'right':
|
136 |
+
$inpostad['location'] = 'right';
|
137 |
+
break;
|
138 |
+
default:
|
139 |
+
$inpostad['location'] = 'above';
|
140 |
+
break;
|
141 |
+
}
|
142 |
+
}
|
143 |
+
|
144 |
+
if(wp_insert_get_ad_status($inpostad)) {
|
145 |
+
switch($inpostad['location']) {
|
146 |
+
case 'above':
|
147 |
+
$content = wp_insert_get_ad_unit($inpostad).$content;
|
148 |
+
break;
|
149 |
+
case 'middle':
|
150 |
+
if($paragraphCount > 1) {
|
151 |
+
if(($inpostad['paragraph_buffer_count'] == 0) || ($inpostad['paragraph_buffer_count'] == '')) {
|
152 |
+
$position = wp_insert_inpostads_get_insertion_position('/p>', $content, round($paragraphCount / 2));
|
153 |
+
} else {
|
154 |
+
$position = wp_insert_inpostads_get_insertion_position('/p>', $content, $inpostad['paragraph_buffer_count']);
|
155 |
+
}
|
156 |
+
if($position) {
|
157 |
+
if(($inpostad['minimum_character_count'] == 0) || ($inpostad['minimum_character_count'] == '')) {
|
158 |
+
$content = substr_replace($content, '/p>'.wp_insert_get_ad_unit($inpostad), $position, 3);
|
159 |
+
} else {
|
160 |
+
if(strlen(strip_tags($content)) > $inpostad['minimum_character_count']) {
|
161 |
+
$content = substr_replace($content, '/p>'.wp_insert_get_ad_unit($inpostad), $position, 3);
|
162 |
+
}
|
163 |
+
}
|
164 |
+
}
|
165 |
+
}
|
166 |
+
break;
|
167 |
+
case 'below':
|
168 |
+
$content = $content.wp_insert_get_ad_unit($inpostad);
|
169 |
+
break;
|
170 |
+
case 'left':
|
171 |
+
$content = wp_insert_get_ad_unit($inpostad, 'float: left;').$content;
|
172 |
+
break;
|
173 |
+
case 'right':
|
174 |
+
$content = wp_insert_get_ad_unit($inpostad, 'float: right;').$content;
|
175 |
+
break;
|
176 |
+
case 'paragraphtop':
|
177 |
+
if($paragraphCount > 1) {
|
178 |
+
$position = wp_insert_inpostads_get_insertion_position('/p>', $content, $inpostad['paragraphtopposition']);
|
179 |
+
if($position) {
|
180 |
+
$content = substr_replace($content, '/p>'.wp_insert_get_ad_unit($inpostad), $position, 3);
|
181 |
+
}
|
182 |
+
}
|
183 |
+
break;
|
184 |
+
case 'paragraphbottom':
|
185 |
+
if($paragraphCount > 1) {
|
186 |
+
$paragraphbottomposition = ($paragraphCount - (int)$inpostad['paragraphbottomposition']);
|
187 |
+
if(($paragraphbottomposition > 0) && ($paragraphbottomposition < $paragraphCount)) {
|
188 |
+
$position = wp_insert_inpostads_get_insertion_position('/p>', $content, $paragraphbottomposition);
|
189 |
+
if($position) {
|
190 |
+
$content = substr_replace($content, '/p>'.wp_insert_get_ad_unit($inpostad), $position, 3);
|
191 |
+
}
|
192 |
+
}
|
193 |
+
}
|
194 |
+
break;
|
195 |
+
}
|
196 |
+
}
|
197 |
+
}
|
198 |
+
}
|
199 |
+
}
|
200 |
+
return $content;
|
201 |
+
}
|
202 |
+
|
203 |
+
function wp_insert_inpostads_get_paragraph_count($content) {
|
204 |
+
$paragraphs = explode('/p>', $content);
|
205 |
+
$paragraphCount = 0;
|
206 |
+
if(is_array($paragraphs)) {
|
207 |
+
foreach($paragraphs as $paragraph) {
|
208 |
+
if(strlen($paragraph) > 1) {
|
209 |
+
$paragraphCount++;
|
210 |
+
}
|
211 |
+
}
|
212 |
+
}
|
213 |
+
return $paragraphCount;
|
214 |
+
}
|
215 |
+
|
216 |
+
function wp_insert_inpostads_get_insertion_position($search, $string, $offset) {
|
217 |
+
$arr = explode($search, $string);
|
218 |
+
switch($offset) {
|
219 |
+
case $offset == 0:
|
220 |
+
return false;
|
221 |
+
break;
|
222 |
+
case $offset > max(array_keys($arr)):
|
223 |
+
return false;
|
224 |
+
break;
|
225 |
+
default:
|
226 |
+
return strlen(implode($search, array_slice($arr, 0, $offset)));
|
227 |
+
break;
|
228 |
+
}
|
229 |
+
}
|
230 |
+
/* End In-Post Ads Ad Insertion */
|
231 |
+
?>
|
includes/modules/general/intheme/module.php
ADDED
@@ -0,0 +1,44 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* Begin UI Functions */
|
3 |
+
add_action('wp_insert_plugin_card', 'wp_insert_inthemeads_plugin_card', 40);
|
4 |
+
function wp_insert_inthemeads_plugin_card() {
|
5 |
+
wp_insert_get_plugin_card(
|
6 |
+
'In-Theme Ads',
|
7 |
+
'<p>Ads embedded directly inside theme files (Advanced Users Only).</p>',
|
8 |
+
'inthemeads',
|
9 |
+
'In-Theme Ad'
|
10 |
+
);
|
11 |
+
}
|
12 |
+
|
13 |
+
add_action('wp_ajax_wp_insert_inthemeads_get_ad_form', 'wp_insert_get_ad_form');
|
14 |
+
add_action('wp_ajax_wp_insert_inthemeads_save_ad_data', 'wp_insert_save_ad_data');
|
15 |
+
add_action('wp_ajax_wp_insert_inthemeads_delete_ad_data', 'wp_insert_delete_ad_data');
|
16 |
+
|
17 |
+
add_filter('wp_insert_inthemeads_form_accordion_tabs', 'wp_insert_inthemeads_form_accordion_tabs_code_snippet', 10, 3);
|
18 |
+
function wp_insert_inthemeads_form_accordion_tabs_code_snippet($control, $identifier, $location) {
|
19 |
+
echo '<h3>Code Snippet</h3>';
|
20 |
+
echo '<div>';
|
21 |
+
$control->set_HTML('<p class="codeSnippet"><code><?php if(function_exists("wp_intheme_ad")) { wp_intheme_ad("'.$identifier.'"); } ?></code></p>');
|
22 |
+
$control->create_section('Code to add to your theme files');
|
23 |
+
echo $control->HTML;
|
24 |
+
$control->clear_controls();
|
25 |
+
echo '</div>';
|
26 |
+
return $control;
|
27 |
+
}
|
28 |
+
add_filter('wp_insert_inthemeads_form_accordion_tabs', 'wp_insert_form_accordion_tabs_adcode', 20, 3);
|
29 |
+
add_filter('wp_insert_inthemeads_form_accordion_tabs', 'wp_insert_form_accordion_tabs_rules', 30, 3);
|
30 |
+
add_filter('wp_insert_inthemeads_form_accordion_tabs', 'wp_insert_form_accordion_tabs_geo_targeting', 40, 3);
|
31 |
+
add_filter('wp_insert_inthemeads_form_accordion_tabs', 'wp_insert_form_accordion_tabs_devices_styles', 50, 3);
|
32 |
+
add_filter('wp_insert_inthemeads_form_accordion_tabs', 'wp_insert_form_accordion_tabs_notes', 60, 3);
|
33 |
+
/* End UI Functions */
|
34 |
+
|
35 |
+
/* Begin In-Theme Ad Insertion */
|
36 |
+
function wp_template_ad($identifier) { wp_intheme_ad('templateads-'.$identifier); } /*Backward Compatibility */
|
37 |
+
function wp_intheme_ad($identifier) {
|
38 |
+
$inthemeads = get_option('wp_insert_inthemeads');
|
39 |
+
if(isset($inthemeads[$identifier]) && is_array($inthemeads[$identifier]) && wp_insert_get_ad_status($inthemeads[$identifier])) {
|
40 |
+
echo wp_insert_get_ad_unit($inthemeads[$identifier]);
|
41 |
+
}
|
42 |
+
}
|
43 |
+
/* End In-Theme Ad Insertion */
|
44 |
+
?>
|
includes/modules/{legalpages → general/legalpages}/functions.php
RENAMED
File without changes
|
includes/modules/{legalpages → general/legalpages}/js/module.js
RENAMED
File without changes
|
includes/modules/{legalpages → general/legalpages}/module.php
RENAMED
@@ -2,15 +2,9 @@
|
|
2 |
require_once(dirname(__FILE__).'/functions.php');
|
3 |
|
4 |
/* Begin Add Assets */
|
5 |
-
/*add_action('wp_insert_modules_css', 'wp_insert_module_legalpages_css', 0);
|
6 |
-
function wp_insert_module_legalpages_css() {
|
7 |
-
wp_register_style('wp-insert-module-legalpages-css', WP_INSERT_URL.'includes/modules/legalpages/css/module.css', array('wp-insert-css'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
|
8 |
-
wp_enqueue_style('wp-insert-module-legalpages-css');
|
9 |
-
}*/
|
10 |
-
|
11 |
add_action('wp_insert_modules_js', 'wp_insert_module_legalpages_js', 0);
|
12 |
function wp_insert_module_legalpages_js() {
|
13 |
-
wp_register_script('wp-insert-module-legalpages-js', WP_INSERT_URL.'includes/modules/legalpages/js/module.js', array('wp-insert-js'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
|
14 |
wp_enqueue_script('wp-insert-module-legalpages-js');
|
15 |
}
|
16 |
/* End Add Assets */
|
2 |
require_once(dirname(__FILE__).'/functions.php');
|
3 |
|
4 |
/* Begin Add Assets */
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
add_action('wp_insert_modules_js', 'wp_insert_module_legalpages_js', 0);
|
6 |
function wp_insert_module_legalpages_js() {
|
7 |
+
wp_register_script('wp-insert-module-legalpages-js', WP_INSERT_URL.'includes/modules/general/legalpages/js/module.js', array('wp-insert-js'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
|
8 |
wp_enqueue_script('wp-insert-module-legalpages-js');
|
9 |
}
|
10 |
/* End Add Assets */
|
includes/modules/general/modules.php
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
require_once(dirname(__FILE__).'/inpost/module.php');
|
3 |
+
require_once(dirname(__FILE__).'/widgets/module.php');
|
4 |
+
require_once(dirname(__FILE__).'/shortcode/module.php');
|
5 |
+
require_once(dirname(__FILE__).'/intheme/module.php');
|
6 |
+
require_once(dirname(__FILE__).'/pagelevel/module.php');
|
7 |
+
require_once(dirname(__FILE__).'/trackingcodes/module.php');
|
8 |
+
require_once(dirname(__FILE__).'/legalpages/module.php');
|
9 |
+
require_once(dirname(__FILE__).'/videointelligence/module.php');
|
10 |
+
?>
|
includes/modules/general/pagelevel/module.php
ADDED
@@ -0,0 +1,36 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* Begin UI Functions */
|
3 |
+
add_action('wp_insert_plugin_card', 'wp_insert_pagelevelads_plugin_card', 60);
|
4 |
+
function wp_insert_pagelevelads_plugin_card() {
|
5 |
+
wp_insert_get_plugin_card(
|
6 |
+
'Page-level Ads',
|
7 |
+
'<p>Adsense Page-level ads are shown on your site only at optimal times.<br />Google Provides a testing tool in adsense portal for webadmins to test your Adsense Page-Level Ads.</p>',
|
8 |
+
'pagelevelads',
|
9 |
+
'Page-Level Ad'
|
10 |
+
);
|
11 |
+
}
|
12 |
+
|
13 |
+
add_action('wp_ajax_wp_insert_pagelevelads_get_ad_form', 'wp_insert_get_ad_form');
|
14 |
+
add_action('wp_ajax_wp_insert_pagelevelads_save_ad_data', 'wp_insert_save_ad_data');
|
15 |
+
add_action('wp_ajax_wp_insert_pagelevelads_delete_ad_data', 'wp_insert_delete_ad_data');
|
16 |
+
|
17 |
+
add_filter('wp_insert_pagelevelads_form_accordion_tabs', 'wp_insert_form_accordion_tabs_adcode', 20, 3);
|
18 |
+
add_filter('wp_insert_pagelevelads_form_accordion_tabs', 'wp_insert_form_accordion_tabs_rules', 30, 3);
|
19 |
+
add_filter('wp_insert_pagelevelads_form_accordion_tabs', 'wp_insert_form_accordion_tabs_geo_targeting', 40, 3);
|
20 |
+
add_filter('wp_insert_pagelevelads_form_accordion_tabs', 'wp_insert_form_accordion_tabs_notes', 60, 3);
|
21 |
+
/* End UI Functions */
|
22 |
+
|
23 |
+
/* Begin Page-Level Ad Insertion */
|
24 |
+
add_action('wp_head', 'wp_insert_pagelevelads_wp_head');
|
25 |
+
function wp_insert_pagelevelads_wp_head() {
|
26 |
+
$pagelevelads = get_option('wp_insert_pagelevelads');
|
27 |
+
if(isset($pagelevelads) && is_array($pagelevelads)) {
|
28 |
+
foreach($pagelevelads as $pagelevelad) {
|
29 |
+
if(isset($pagelevelad) && is_array($pagelevelad) && wp_insert_get_ad_status($pagelevelad)) {
|
30 |
+
echo wp_insert_get_ad_unit_code($pagelevelad);
|
31 |
+
}
|
32 |
+
}
|
33 |
+
}
|
34 |
+
}
|
35 |
+
/* End Page-Level Ad Insertion */
|
36 |
+
?>
|
includes/modules/general/shortcode/module.php
ADDED
@@ -0,0 +1,47 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* Begin UI Functions */
|
3 |
+
add_action('wp_insert_plugin_card', 'wp_insert_shortcodeads_plugin_card', 50);
|
4 |
+
function wp_insert_shortcodeads_plugin_card() {
|
5 |
+
wp_insert_get_plugin_card(
|
6 |
+
'Shortcode Ads',
|
7 |
+
'<p>Ads embedded directly inside post / page content via shortcodes.</p>',
|
8 |
+
'shortcodeads',
|
9 |
+
'Shortcode Ad'
|
10 |
+
);
|
11 |
+
}
|
12 |
+
|
13 |
+
add_action('wp_ajax_wp_insert_shortcodeads_get_ad_form', 'wp_insert_get_ad_form');
|
14 |
+
add_action('wp_ajax_wp_insert_shortcodeads_save_ad_data', 'wp_insert_save_ad_data');
|
15 |
+
add_action('wp_ajax_wp_insert_shortcodeads_delete_ad_data', 'wp_insert_delete_ad_data');
|
16 |
+
|
17 |
+
add_filter('wp_insert_shortcodeads_form_accordion_tabs', 'wp_insert_shortcodeads_form_accordion_tabs_shortcode', 10, 3);
|
18 |
+
function wp_insert_shortcodeads_form_accordion_tabs_shortcode($control, $identifier, $location) {
|
19 |
+
echo '<h3>Shortcode</h3>';
|
20 |
+
echo '<div>';
|
21 |
+
$control->set_HTML('<p class="codeSnippet"><code>[wpshortcodead id="'.$identifier.'"]</code></p>');
|
22 |
+
$control->create_section('Code to add to your post/page content');
|
23 |
+
echo $control->HTML;
|
24 |
+
$control->clear_controls();
|
25 |
+
echo '</div>';
|
26 |
+
return $control;
|
27 |
+
}
|
28 |
+
add_filter('wp_insert_shortcodeads_form_accordion_tabs', 'wp_insert_form_accordion_tabs_adcode', 20, 3);
|
29 |
+
add_filter('wp_insert_shortcodeads_form_accordion_tabs', 'wp_insert_form_accordion_tabs_rules', 30, 3);
|
30 |
+
add_filter('wp_insert_shortcodeads_form_accordion_tabs', 'wp_insert_form_accordion_tabs_geo_targeting', 40, 3);
|
31 |
+
add_filter('wp_insert_shortcodeads_form_accordion_tabs', 'wp_insert_form_accordion_tabs_devices_styles', 50, 3);
|
32 |
+
add_filter('wp_insert_shortcodeads_form_accordion_tabs', 'wp_insert_form_accordion_tabs_notes', 60, 3);
|
33 |
+
/* End UI Functions */
|
34 |
+
|
35 |
+
/* Begin Shortcode Ad Insertion */
|
36 |
+
add_shortcode('wpshortcodead', 'wp_insert_shortcodeads_shortcode');
|
37 |
+
function wp_insert_shortcodeads_shortcode($atts) {
|
38 |
+
$atts = shortcode_atts(array('id' => ''), $atts, 'wpshortcodead');
|
39 |
+
if(isset($atts['id']) && ($atts['id'] != '')) {
|
40 |
+
$shortcodeads = get_option('wp_insert_shortcodeads');
|
41 |
+
if(isset($shortcodeads[$atts['id']]) && is_array($shortcodeads[$atts['id']]) && wp_insert_get_ad_status($shortcodeads[$atts['id']])) {
|
42 |
+
return wp_insert_get_ad_unit($shortcodeads[$atts['id']]);
|
43 |
+
}
|
44 |
+
}
|
45 |
+
}
|
46 |
+
/* End Shortcode Ad Insertion */
|
47 |
+
?>
|
includes/modules/{trackingcodes → general/trackingcodes}/functions.php
RENAMED
@@ -71,6 +71,10 @@ function wp_insert_trackingcodes_header_form_save_action() {
|
|
71 |
$trackingCodes['header']['status'] = ((isset($_POST['wp_insert_trackingcodes_header_status']) && ($_POST['wp_insert_trackingcodes_header_status'] == 'true'))?'1':'');
|
72 |
$trackingCodes['header']['code'] = ((isset($_POST['wp_insert_trackingcodes_header_code']))?$_POST['wp_insert_trackingcodes_header_code']:'');
|
73 |
update_option('wp_insert_trackingcodes', $trackingCodes);
|
|
|
|
|
|
|
|
|
74 |
die();
|
75 |
}
|
76 |
|
@@ -109,6 +113,10 @@ function wp_insert_trackingcodes_footer_form_save_action() {
|
|
109 |
$trackingCodes['footer']['status'] = ((isset($_POST['wp_insert_trackingcodes_footer_status']) && ($_POST['wp_insert_trackingcodes_footer_status'] == 'true'))?'1':'');
|
110 |
$trackingCodes['footer']['code'] = ((isset($_POST['wp_insert_trackingcodes_footer_code']))?$_POST['wp_insert_trackingcodes_footer_code']:'');
|
111 |
update_option('wp_insert_trackingcodes', $trackingCodes);
|
|
|
|
|
|
|
|
|
112 |
die();
|
113 |
}
|
114 |
|
71 |
$trackingCodes['header']['status'] = ((isset($_POST['wp_insert_trackingcodes_header_status']) && ($_POST['wp_insert_trackingcodes_header_status'] == 'true'))?'1':'');
|
72 |
$trackingCodes['header']['code'] = ((isset($_POST['wp_insert_trackingcodes_header_code']))?$_POST['wp_insert_trackingcodes_header_code']:'');
|
73 |
update_option('wp_insert_trackingcodes', $trackingCodes);
|
74 |
+
|
75 |
+
if(function_exists('wp_insert_adstxt_adsense_admin_notice_reset')) {
|
76 |
+
wp_insert_adstxt_adsense_admin_notice_reset();
|
77 |
+
}
|
78 |
die();
|
79 |
}
|
80 |
|
113 |
$trackingCodes['footer']['status'] = ((isset($_POST['wp_insert_trackingcodes_footer_status']) && ($_POST['wp_insert_trackingcodes_footer_status'] == 'true'))?'1':'');
|
114 |
$trackingCodes['footer']['code'] = ((isset($_POST['wp_insert_trackingcodes_footer_code']))?$_POST['wp_insert_trackingcodes_footer_code']:'');
|
115 |
update_option('wp_insert_trackingcodes', $trackingCodes);
|
116 |
+
|
117 |
+
if(function_exists('wp_insert_adstxt_adsense_admin_notice_reset')) {
|
118 |
+
wp_insert_adstxt_adsense_admin_notice_reset();
|
119 |
+
}
|
120 |
die();
|
121 |
}
|
122 |
|
includes/modules/{trackingcodes → general/trackingcodes}/js/module.js
RENAMED
File without changes
|
includes/modules/{trackingcodes → general/trackingcodes}/module.php
RENAMED
@@ -2,15 +2,9 @@
|
|
2 |
require_once(dirname(__FILE__).'/functions.php');
|
3 |
|
4 |
/* Begin Add Assets */
|
5 |
-
/*add_action('wp_insert_modules_css', 'wp_insert_module_trackingcodes_css', 0);
|
6 |
-
function wp_insert_module_trackingcodes_css() {
|
7 |
-
wp_register_style('wp-insert-module-trackingcodes-css', WP_INSERT_URL.'includes/modules/trackingcodes/css/module.css', array('wp-insert-css'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
|
8 |
-
wp_enqueue_style('wp-insert-module-trackingcodes-css');
|
9 |
-
}*/
|
10 |
-
|
11 |
add_action('wp_insert_modules_js', 'wp_insert_module_trackingcodes_js', 0);
|
12 |
function wp_insert_module_trackingcodes_js() {
|
13 |
-
wp_register_script('wp-insert-module-trackingcodes-js', WP_INSERT_URL.'includes/modules/trackingcodes/js/module.js', array('wp-insert-js'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
|
14 |
wp_enqueue_script('wp-insert-module-trackingcodes-js');
|
15 |
}
|
16 |
/* End Add Assets */
|
2 |
require_once(dirname(__FILE__).'/functions.php');
|
3 |
|
4 |
/* Begin Add Assets */
|
|
|
|
|
|
|
|
|
|
|
|
|
5 |
add_action('wp_insert_modules_js', 'wp_insert_module_trackingcodes_js', 0);
|
6 |
function wp_insert_module_trackingcodes_js() {
|
7 |
+
wp_register_script('wp-insert-module-trackingcodes-js', WP_INSERT_URL.'includes/modules/general/trackingcodes/js/module.js', array('wp-insert-js'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
|
8 |
wp_enqueue_script('wp-insert-module-trackingcodes-js');
|
9 |
}
|
10 |
/* End Add Assets */
|
includes/modules/{videointelligence → general/videointelligence}/api/vi.php
RENAMED
File without changes
|
includes/modules/{videointelligence → general/videointelligence}/css/module.css
RENAMED
File without changes
|
includes/modules/{videointelligence → general/videointelligence}/functions.php
RENAMED
@@ -53,6 +53,10 @@ function wp_insert_vi_login_form_save_action() {
|
|
53 |
} else {
|
54 |
echo '###SUCCESS###';
|
55 |
wp_insert_vi_plugin_card_content(true, true);
|
|
|
|
|
|
|
|
|
56 |
}
|
57 |
}
|
58 |
die();
|
53 |
} else {
|
54 |
echo '###SUCCESS###';
|
55 |
wp_insert_vi_plugin_card_content(true, true);
|
56 |
+
|
57 |
+
if(function_exists('wp_insert_adstxt_adsense_admin_notice_reset')) {
|
58 |
+
wp_insert_adstxt_adsense_admin_notice_reset();
|
59 |
+
}
|
60 |
}
|
61 |
}
|
62 |
die();
|
includes/modules/{videointelligence → general/videointelligence}/js/module.js
RENAMED
File without changes
|
includes/modules/{videointelligence → general/videointelligence}/module.php
RENAMED
@@ -6,13 +6,13 @@ require_once(dirname(__FILE__).'/vi-constants.php');
|
|
6 |
/* Begin Add Assets */
|
7 |
add_action('wp_insert_modules_css', 'wp_insert_module_vi_css', 0);
|
8 |
function wp_insert_module_vi_css() {
|
9 |
-
wp_register_style('wp-insert-module-vi-css', WP_INSERT_URL.'includes/modules/videointelligence/css/module.css', array('wp-insert-css'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
|
10 |
wp_enqueue_style('wp-insert-module-vi-css');
|
11 |
}
|
12 |
|
13 |
add_action('wp_insert_modules_js', 'wp_insert_module_vi_js', 0);
|
14 |
function wp_insert_module_vi_js() {
|
15 |
-
wp_register_script('wp-insert-module-vi-js', WP_INSERT_URL.'includes/modules/videointelligence/js/module.js', array('wp-insert-js'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
|
16 |
wp_enqueue_script('wp-insert-module-vi-js');
|
17 |
}
|
18 |
/* End Add Assets */
|
6 |
/* Begin Add Assets */
|
7 |
add_action('wp_insert_modules_css', 'wp_insert_module_vi_css', 0);
|
8 |
function wp_insert_module_vi_css() {
|
9 |
+
wp_register_style('wp-insert-module-vi-css', WP_INSERT_URL.'includes/modules/general/videointelligence/css/module.css', array('wp-insert-css'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
|
10 |
wp_enqueue_style('wp-insert-module-vi-css');
|
11 |
}
|
12 |
|
13 |
add_action('wp_insert_modules_js', 'wp_insert_module_vi_js', 0);
|
14 |
function wp_insert_module_vi_js() {
|
15 |
+
wp_register_script('wp-insert-module-vi-js', WP_INSERT_URL.'includes/modules/general/videointelligence/js/module.js', array('wp-insert-js'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
|
16 |
wp_enqueue_script('wp-insert-module-vi-js');
|
17 |
}
|
18 |
/* End Add Assets */
|
includes/modules/{videointelligence → general/videointelligence}/vi-constants.php
RENAMED
File without changes
|
includes/modules/general/widgets/module.php
ADDED
@@ -0,0 +1,74 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/* Begin UI Functions */
|
3 |
+
add_action('wp_insert_plugin_card', 'wp_insert_adwidgets_plugin_card', 30);
|
4 |
+
function wp_insert_adwidgets_plugin_card() {
|
5 |
+
wp_insert_get_plugin_card(
|
6 |
+
'Ad Widgets',
|
7 |
+
'<p>Ads shown inside widget enabled areas.</p>',
|
8 |
+
'adwidgets',
|
9 |
+
'Ad Widget'
|
10 |
+
);
|
11 |
+
}
|
12 |
+
|
13 |
+
add_action('wp_ajax_wp_insert_adwidgets_get_ad_form', 'wp_insert_get_ad_form');
|
14 |
+
add_action('wp_ajax_wp_insert_adwidgets_save_ad_data', 'wp_insert_save_ad_data');
|
15 |
+
add_action('wp_ajax_wp_insert_adwidgets_delete_ad_data', 'wp_insert_delete_ad_data');
|
16 |
+
|
17 |
+
add_filter('wp_insert_adwidgets_form_accordion_tabs', 'wp_insert_form_accordion_tabs_adcode', 20, 3);
|
18 |
+
add_filter('wp_insert_adwidgets_form_accordion_tabs', 'wp_insert_form_accordion_tabs_rules', 30, 3);
|
19 |
+
add_filter('wp_insert_adwidgets_form_accordion_tabs', 'wp_insert_form_accordion_tabs_geo_targeting', 40, 3);
|
20 |
+
add_filter('wp_insert_adwidgets_form_accordion_tabs', 'wp_insert_form_accordion_tabs_devices_styles', 50, 3);
|
21 |
+
add_filter('wp_insert_adwidgets_form_accordion_tabs', 'wp_insert_form_accordion_tabs_notes', 60, 3);
|
22 |
+
/* End UI Functions */
|
23 |
+
|
24 |
+
/* Begin Ad Widget Insertion */
|
25 |
+
add_action('widgets_init', create_function('', 'register_widget("wpInsertAdWidget");'));
|
26 |
+
class wpInsertAdWidget extends WP_Widget {
|
27 |
+
public function __construct() {
|
28 |
+
parent::__construct('wp_insert_ad_widget', 'Wp-Insert Ad Widget', array('description' => 'Wp-Insert Ad Widget'));
|
29 |
+
}
|
30 |
+
|
31 |
+
public function widget($args, $instance) {
|
32 |
+
extract($args);
|
33 |
+
$title = apply_filters('widget_title', (isset($instance['title'])?$instance['title']:''));
|
34 |
+
$adwidgets = get_option('wp_insert_adwidgets');
|
35 |
+
if(isset($adwidgets[$instance['instance']]) && is_array($adwidgets[$instance['instance']])) {
|
36 |
+
if(wp_insert_get_ad_status($adwidgets[$instance['instance']])) {
|
37 |
+
echo $before_widget;
|
38 |
+
if(!empty($title)) { echo $before_title.$title.$after_title; }
|
39 |
+
echo wp_insert_get_ad_unit($adwidgets[$instance['instance']]);
|
40 |
+
echo $after_widget;
|
41 |
+
}
|
42 |
+
}
|
43 |
+
}
|
44 |
+
|
45 |
+
public function update($new_opts, $old_opts) {
|
46 |
+
$opts = array();
|
47 |
+
$opts['title'] = $new_opts['title'];
|
48 |
+
$opts['instance'] = $new_opts['instance'];
|
49 |
+
return $opts;
|
50 |
+
}
|
51 |
+
|
52 |
+
public function form($instance) {
|
53 |
+
$adwidgets = get_option('wp_insert_adwidgets');
|
54 |
+
echo '<p>';
|
55 |
+
echo '<label for="'.$this->get_field_id('title').'">Title:</label>';
|
56 |
+
echo '<input class="widefat" id="'.$this->get_field_id('title').'" name="'.$this->get_field_name('title').'" type="text" value="'.((isset($instance['title']))?$instance['title']:'').'" />';
|
57 |
+
echo '</p>';
|
58 |
+
echo '<p>';
|
59 |
+
if(is_array($adwidgets) && (count($adwidgets) > 0)) {
|
60 |
+
echo '<label for="'.$this->get_field_id('instance').'">Select Ad-Widget:</label>';
|
61 |
+
echo '<select class="widefat" id="'.$this->get_field_id('instance').'" name="'.$this->get_field_name('instance').'">';
|
62 |
+
foreach($adwidgets as $identifier => $adwidget) {
|
63 |
+
echo '<option value="'.$identifier.'" '.selected($identifier, ((isset($instance['instance']))?$instance['instance']:''), false).'>Ad Widget : '.((isset($adwidget['title']))?$adwidget['title']:'').'</option>';
|
64 |
+
}
|
65 |
+
echo '</select>';
|
66 |
+
} else {
|
67 |
+
echo 'Please <a href="'.admin_url('admin.php?page=wp-insert').'">Configure an Ad-Widget</a> to Proceed.';
|
68 |
+
echo '<input class="widefat" id="'.$this->get_field_id('instance').'" name="'.$this->get_field_name('instance').'" type="hidden" value="" />';
|
69 |
+
}
|
70 |
+
echo '</p>';
|
71 |
+
}
|
72 |
+
}
|
73 |
+
/* End Ad Widget Insertion */
|
74 |
+
?>
|
includes/modules/inpostads/functions.php
DELETED
@@ -1,484 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/* Begin Add New In-Post Ads Content */
|
3 |
-
add_action('wp_ajax_wp_insert_inpostads_new_form_get_content', 'wp_insert_inpostads_new_form_get_content');
|
4 |
-
function wp_insert_inpostads_new_form_get_content() {
|
5 |
-
check_ajax_referer('wp-insert', 'wp_insert_nonce');
|
6 |
-
wp_insert_inpostads_form_get_content(uniqid());
|
7 |
-
die();
|
8 |
-
}
|
9 |
-
/* End Add New In-Post Ads Content */
|
10 |
-
|
11 |
-
/* Begin Edit In-Post Ads Content */
|
12 |
-
add_action('wp_ajax_wp_insert_inpostads_existing_form_get_content', 'wp_insert_inpostads_existing_form_get_content');
|
13 |
-
function wp_insert_inpostads_existing_form_get_content() {
|
14 |
-
check_ajax_referer('wp-insert', 'wp_insert_nonce');
|
15 |
-
if(isset($_POST['wp_insert_inpostads_identifier'])) {
|
16 |
-
wp_insert_inpostads_form_get_content($_POST['wp_insert_inpostads_identifier']);
|
17 |
-
}
|
18 |
-
die();
|
19 |
-
}
|
20 |
-
|
21 |
-
add_action('wp_ajax_wp_insert_inpostads_existing_form_save_action', 'wp_insert_inpostads_existing_form_save_action');
|
22 |
-
function wp_insert_inpostads_existing_form_save_action() {
|
23 |
-
check_ajax_referer('wp-insert', 'wp_insert_nonce');
|
24 |
-
if(isset($_POST['wp_insert_inpostads_identifier'])) {
|
25 |
-
wp_insert_inpostads_form_save_action($_POST['wp_insert_inpostads_identifier']);
|
26 |
-
}
|
27 |
-
die();
|
28 |
-
}
|
29 |
-
/* End Edit In-Post Ads Content */
|
30 |
-
|
31 |
-
/* Begin Delete In-Post Ads Content */
|
32 |
-
add_action('wp_ajax_wp_insert_inpostads_remove', 'wp_insert_inpostads_remove');
|
33 |
-
function wp_insert_inpostads_remove() {
|
34 |
-
check_ajax_referer('wp-insert', 'wp_insert_nonce');
|
35 |
-
if(isset($_POST['wp_insert_inpostads_identifier'])) {
|
36 |
-
$inpostads = get_option('wp_insert_inpostads');
|
37 |
-
unset($inpostads[$_POST['wp_insert_inpostads_identifier']]);
|
38 |
-
update_option('wp_insert_inpostads', $inpostads);
|
39 |
-
}
|
40 |
-
die();
|
41 |
-
}
|
42 |
-
/* End Delete In-Post Ads Content */
|
43 |
-
|
44 |
-
/* Begin Shared UI Functions */
|
45 |
-
function wp_insert_inpostads_form_get_content($identifier) {
|
46 |
-
$inpostads = get_option('wp_insert_inpostads');
|
47 |
-
echo '<div class="wp_insert_popup_content_wrapper">';
|
48 |
-
$control = new smartlogixControls(array('optionIdentifier' => 'wp_insert_inpostads['.$identifier.']', 'values' => $inpostads[$identifier]));
|
49 |
-
$control->add_control(array('type' => 'ipCheckbox', 'className' => 'wp_insert_inpostads_status', 'optionName' => 'status'));
|
50 |
-
$control->add_control(array('type' => 'hidden', 'className' => 'wp_insert_inpostads_identifier', 'optionName' => 'identifier', 'value' => $identifier));
|
51 |
-
echo $control->HTML;
|
52 |
-
$control->clear_controls();
|
53 |
-
echo '<div id="wp_insert_inpostads_'.$identifier.'_accordion">';
|
54 |
-
echo '<h3>Location</h3>';
|
55 |
-
echo '<div>';
|
56 |
-
$paragraphPositioningOptions = array(
|
57 |
-
array('text' => '1st', 'value' => '1'),
|
58 |
-
array('text' => '2nd', 'value' => '2'),
|
59 |
-
array('text' => '3rd', 'value' => '3'),
|
60 |
-
array('text' => '4th', 'value' => '4'),
|
61 |
-
array('text' => '5th', 'value' => '5'),
|
62 |
-
array('text' => '6th', 'value' => '6'),
|
63 |
-
array('text' => '7th', 'value' => '7'),
|
64 |
-
array('text' => '8th', 'value' => '8'),
|
65 |
-
array('text' => '9th', 'value' => '9'),
|
66 |
-
array('text' => '10th', 'value' => '10'),
|
67 |
-
);
|
68 |
-
$control->add_control(array('type' => 'select', 'className' => 'input', 'style' => 'display: inline;', 'useParagraph' => false, 'optionName' => 'paragraphtopposition', 'options' => $paragraphPositioningOptions));
|
69 |
-
$nthParagraphTopControl = $control->HTML;
|
70 |
-
$control->clear_controls();
|
71 |
-
$control->add_control(array('type' => 'select', 'className' => 'input', 'style' => 'display: inline;', 'useParagraph' => false, 'optionName' => 'paragraphbottomposition', 'options' => $paragraphPositioningOptions));
|
72 |
-
$nthParagraphBottomControl = $control->HTML;
|
73 |
-
$control->clear_controls();
|
74 |
-
|
75 |
-
if(!isset($inpostads[$identifier]['location'])) {
|
76 |
-
switch($identifier) {
|
77 |
-
case 'above':
|
78 |
-
$inpostads[$identifier]['location'] = 'above';
|
79 |
-
break;
|
80 |
-
case 'middle':
|
81 |
-
$inpostads[$identifier]['location'] = 'middle';
|
82 |
-
break;
|
83 |
-
case 'below':
|
84 |
-
$inpostads[$identifier]['location'] = 'below';
|
85 |
-
break;
|
86 |
-
case 'left':
|
87 |
-
$inpostads[$identifier]['location'] = 'left';
|
88 |
-
break;
|
89 |
-
case 'right':
|
90 |
-
$inpostads[$identifier]['location'] = 'right';
|
91 |
-
break;
|
92 |
-
default:
|
93 |
-
$inpostads[$identifier]['location'] = 'above';
|
94 |
-
break;
|
95 |
-
}
|
96 |
-
}
|
97 |
-
$locations = array(
|
98 |
-
array('text' => 'Above Post Content', 'value' => 'above'),
|
99 |
-
array('text' => 'Middle of Post Content', 'value' => 'middle'),
|
100 |
-
array('text' => 'Below Post Content', 'value' => 'below'),
|
101 |
-
array('text' => 'To the Left of Post Content', 'value' => 'left'),
|
102 |
-
array('text' => 'To the Right of Post Content', 'value' => 'right'),
|
103 |
-
array('text' => 'After '.$nthParagraphTopControl.' Paragraph in Post Content (From the Top)', 'value' => 'paragraphtop'),
|
104 |
-
array('text' => 'After '.$nthParagraphBottomControl.' Paragraph in Post Content (From the Bottom)', 'value' => 'paragraphbottom'),
|
105 |
-
);
|
106 |
-
$control->add_control(array('type' => 'radio-group', 'style' => 'line-height: 40px; margin-top: 3px;', 'optionName' => 'location', 'options' => $locations, 'value' => $inpostads[$identifier]['location']));
|
107 |
-
$control->create_section('Location');
|
108 |
-
echo $control->HTML;
|
109 |
-
$control->clear_controls();
|
110 |
-
echo '</div>';
|
111 |
-
echo '<h3>Ad Code</h3>';
|
112 |
-
echo '<div>';
|
113 |
-
$abtestingMode = get_option('wp_insert_abtesting_mode');
|
114 |
-
$adTypes = array(
|
115 |
-
array('text' => 'Use Generic / Custom Ad Code', 'value' => 'generic'),
|
116 |
-
array('text' => 'vi stories', 'value' => 'vicode'),
|
117 |
-
);
|
118 |
-
$control->add_control(array('type' => 'select', 'label' => 'Ad Type', 'optionName' => 'primary_ad_code_type', 'options' => $adTypes));
|
119 |
-
echo $control->HTML;
|
120 |
-
$control->clear_controls();
|
121 |
-
|
122 |
-
$control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'primary_ad_code'));
|
123 |
-
$control->create_section('<span id="primary_ad_code_type_generic" class="isSelectedIndicator"></span><span class="isSelectedIndicatorText">Generic / Custom Ad Code (Primary Network)</span>');
|
124 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
|
125 |
-
echo $control->HTML;
|
126 |
-
$control->clear_controls();
|
127 |
-
|
128 |
-
$IsVILoggedin = wp_insert_vi_api_is_loggedin();
|
129 |
-
$isJSTagGenerated = ((wp_insert_vi_api_get_vi_code() === false)?false:true);
|
130 |
-
$isVIDisabled = false;
|
131 |
-
$viMessage = '';
|
132 |
-
if(!$IsVILoggedin && !$isJSTagGenerated) {
|
133 |
-
$isVIDisabled = true;
|
134 |
-
$viMessage = '<p>Introducing <b>vi stories</b> – the video content and advertising player.</p>';
|
135 |
-
$viMessage .= '<p>Before you can use <b>vi stories</b>, you must configure it. Once you’ve signed up, in the <i>video intelligence</i> panel, click <i>Sign in</i> then click <i>Configure</i></p>';
|
136 |
-
} else if($IsVILoggedin && !$isJSTagGenerated) {
|
137 |
-
$isVIDisabled = true;
|
138 |
-
$viMessage .= '<p>Before you can use <b>vi stories</b>, you must configure it. In the <i>video intelligence</i> panel, click <i>Configure</i></p>';
|
139 |
-
//$viMessage .= '<p><a id="wp_insert_inpostads_vi_customize_adcode" href="javascript:;" class="button button-primary aligncenter">Configure vi Code</a></p>'; /*Button being temporarily removed to avoid confusion for users*/
|
140 |
-
} else if(!$IsVILoggedin && $isJSTagGenerated) {
|
141 |
-
$isVIDisabled = false;
|
142 |
-
$viMessage = '<p>Before you can use <b>vi stories</b>, you must configure it. Once you’ve signed up, in the <i>video intelligence</i> panel, click <i>Sign in</i> then click <i>Configure</i></p>';
|
143 |
-
} else {
|
144 |
-
$isVIDisabled = false;
|
145 |
-
$viMessage = wp_insert_vi_customize_adcode_get_settings();
|
146 |
-
$viMessage .= '<p>To configure <b>vi stories</b>, go to the <i>video intelligence</i> panel, click <i>Configure</i></p>';
|
147 |
-
//$viMessage .= '<p><a id="wp_insert_inpostads_vi_customize_adcode" href="javascript:;" class="button button-primary aligncenter">Configure vi Code</a></p>'; /*Button being temporarily removed to avoid confusion for users*/
|
148 |
-
}
|
149 |
-
|
150 |
-
$control->HTML .= $viMessage;
|
151 |
-
$control->create_section('<span id="primary_ad_code_type_vicode" class="isSelectedIndicator '.(($isVIDisabled)?'disabled':'').'"></span><span class="isSelectedIndicatorText">vi stories (Primary Network)</span>');
|
152 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
153 |
-
echo $control->HTML;
|
154 |
-
$control->clear_controls();
|
155 |
-
|
156 |
-
$control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'secondary_ad_code'));
|
157 |
-
$control->create_section('Ad Code (Secondary Network)');
|
158 |
-
if($abtestingMode != '2' && $abtestingMode != '3') {
|
159 |
-
$control->set_HTML('<div style="display: none;">'.$control->HTML.'</div>');
|
160 |
-
}
|
161 |
-
echo $control->HTML;
|
162 |
-
$control->clear_controls();
|
163 |
-
|
164 |
-
$control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'tertiary_ad_code'));
|
165 |
-
$control->create_section('Ad Code (Tertiary Network)');
|
166 |
-
if($abtestingMode != '3') {
|
167 |
-
$control->set_HTML('<div style="display: none;">'.$control->HTML.'</div>');
|
168 |
-
}
|
169 |
-
echo $control->HTML;
|
170 |
-
$control->clear_controls();
|
171 |
-
echo '</div>';
|
172 |
-
echo '<h3>Rules</h3>';
|
173 |
-
echo '<div>';
|
174 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_loggedin'));
|
175 |
-
$control->create_section('Logged in Users');
|
176 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
|
177 |
-
echo $control->HTML;
|
178 |
-
$control->clear_controls();
|
179 |
-
|
180 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_mobile_devices'));
|
181 |
-
$control->create_section('Mobile Devices');
|
182 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
183 |
-
echo $control->HTML;
|
184 |
-
$control->clear_controls();
|
185 |
-
|
186 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_404'));
|
187 |
-
$control->create_section('404 Pages');
|
188 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
189 |
-
echo $control->HTML;
|
190 |
-
$control->clear_controls();
|
191 |
-
|
192 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_home'));
|
193 |
-
$control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Instances', 'optionName' => 'rules_home_instances', 'options' => $instances));
|
194 |
-
$control->create_section('Home');
|
195 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
|
196 |
-
echo $control->HTML;
|
197 |
-
$control->clear_controls();
|
198 |
-
|
199 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_archives'));
|
200 |
-
$control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Instances', 'optionName' => 'rules_archives_instances', 'options' => $instances));
|
201 |
-
$control->create_section('Archives');
|
202 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
203 |
-
echo $control->HTML;
|
204 |
-
$control->clear_controls();
|
205 |
-
|
206 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_search'));
|
207 |
-
$control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Instances', 'optionName' => 'rules_search_instances', 'options' => $instances));
|
208 |
-
$control->create_section('Search Results');
|
209 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
|
210 |
-
echo $control->HTML;
|
211 |
-
$control->clear_controls();
|
212 |
-
|
213 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_page'));
|
214 |
-
$control->add_control(array('type' => 'pages-chosen-multiselect', 'label' => 'Exceptions', 'optionName' => 'rules_page_exceptions'));
|
215 |
-
$control->create_section('Single Pages');
|
216 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
217 |
-
echo $control->HTML;
|
218 |
-
$control->clear_controls();
|
219 |
-
|
220 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_post'));
|
221 |
-
$control->add_control(array('type' => 'posts-chosen-multiselect', 'label' => 'Exceptions', 'optionName' => 'rules_post_exceptions'));
|
222 |
-
$control->add_control(array('type' => 'categories-chosen-multiselect', 'label' => 'Category Exceptions', 'optionName' => 'rules_post_categories_exceptions'));
|
223 |
-
$control->create_section('Single Posts');
|
224 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
|
225 |
-
echo $control->HTML;
|
226 |
-
$control->clear_controls();
|
227 |
-
|
228 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_categories'));
|
229 |
-
$control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Instances', 'optionName' => 'rules_categories_instances', 'options' => $instances));
|
230 |
-
$control->add_control(array('type' => 'categories-chosen-multiselect', 'label' => 'Exceptions', 'optionName' => 'rules_categories_exceptions'));
|
231 |
-
$control->create_section('Category Archives');
|
232 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
233 |
-
echo $control->HTML;
|
234 |
-
$control->clear_controls();
|
235 |
-
echo '</div>';
|
236 |
-
echo '<h3>Geo Targeting</h3>';
|
237 |
-
echo '<div>';
|
238 |
-
echo '<p>';
|
239 |
-
echo 'A Geo Targeted Ads have a higher priority than Ads configured via Multiple Ad Networks / A-B Testing.<br />';
|
240 |
-
echo 'If a Geo Targeting match is found all other Ads (Primary, Secondary and Tertiary Networks) will be ignored.';
|
241 |
-
echo '</p>';
|
242 |
-
$control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Countries', 'optionName' => 'geo_group1_countries', 'options' => wp_insert_get_countries()));
|
243 |
-
$control->add_control(array('type' => 'textarea', 'label' => 'Ad Code', 'style' => 'height: 220px;', 'optionName' => 'geo_group1_adcode'));
|
244 |
-
$control->create_section('Group 1');
|
245 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
|
246 |
-
echo $control->HTML;
|
247 |
-
$control->clear_controls();
|
248 |
-
|
249 |
-
$control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Countries', 'optionName' => 'geo_group2_countries', 'options' => wp_insert_get_countries()));
|
250 |
-
$control->add_control(array('type' => 'textarea', 'label' => 'Ad Code', 'style' => 'height: 220px;', 'optionName' => 'geo_group2_adcode'));
|
251 |
-
$control->create_section('Group 2');
|
252 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
253 |
-
echo $control->HTML;
|
254 |
-
$control->clear_controls();
|
255 |
-
echo '<p>';
|
256 |
-
echo 'This feature uses the Free Geo ip service from <a href="http://freegeoip.net/">freegeoip.net</a>, if you find this feature useful please consider donating to the project at <a href="http://freegeoip.net/">freegeoip.net</a>';
|
257 |
-
echo '</p>';
|
258 |
-
echo '</div>';
|
259 |
-
echo '<h3>Styles</h3>';
|
260 |
-
echo '<div>';
|
261 |
-
$control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'styles'));
|
262 |
-
$control->create_section('Styles');
|
263 |
-
echo $control->HTML;
|
264 |
-
$control->clear_controls();
|
265 |
-
echo '</div>';
|
266 |
-
echo '<h3>Notes</h3>';
|
267 |
-
echo '<div>';
|
268 |
-
if(!isset($inpostads[$identifier]['title']) || ($inpostads[$identifier]['title'] == '')) {
|
269 |
-
switch($identifier) {
|
270 |
-
case 'above':
|
271 |
-
$inpostads[$identifier]['title'] = 'Above Post Content';
|
272 |
-
break;
|
273 |
-
case 'middle':
|
274 |
-
$inpostads[$identifier]['title'] = 'Middle of Post Content';
|
275 |
-
break;
|
276 |
-
case 'below':
|
277 |
-
$inpostads[$identifier]['title'] = 'Below Post Content';
|
278 |
-
break;
|
279 |
-
case 'left':
|
280 |
-
$inpostads[$identifier]['title'] = 'To the Left of Post Content';
|
281 |
-
break;
|
282 |
-
case 'right':
|
283 |
-
$inpostads[$identifier]['title'] = 'To the Right of Post Content';
|
284 |
-
break;
|
285 |
-
default:
|
286 |
-
$inpostads[$identifier]['title'] = $identifier;
|
287 |
-
break;
|
288 |
-
}
|
289 |
-
}
|
290 |
-
$control->add_control(array('type' => 'text', 'optionName' => 'title', 'helpText' => 'The title is used to identify your Ad Widget easily in future. A Random Title will be assigned to your Ad widget by default.', 'value' => $inpostads[$identifier]['title']));
|
291 |
-
$control->create_section('Title');
|
292 |
-
echo $control->HTML;
|
293 |
-
$control->clear_controls();
|
294 |
-
|
295 |
-
$control->add_control(array('type' => 'textarea', 'optionName' => 'notes', 'style' => 'height: 220px;'));
|
296 |
-
$control->create_section('Notes');
|
297 |
-
echo $control->HTML;
|
298 |
-
$control->clear_controls();
|
299 |
-
echo '</div>';
|
300 |
-
echo '<h3 class="wp_insert_inpostads_location_middle_panel">Positioning</h3>';
|
301 |
-
echo '<div>';
|
302 |
-
$control->add_control(array('type' => 'text', 'label' => 'Minimum Character Count', 'optionName' => 'minimum_character_count', 'helpText' => 'Show the ad only if the Content meets the minimum character count. If this parameter is set to 0 (or empty) minimum character count check will be deactivated.'));
|
303 |
-
$control->add_control(array('type' => 'text', 'label' => 'Paragraph Buffer Count', 'optionName' => 'paragraph_buffer_count', 'helpText' => 'Shows the ad after X number of Paragraphs. If this parameter is set to 0 (or empty) the ad will appear in the middle of the content.'));
|
304 |
-
$control->create_section('Positioning');
|
305 |
-
echo $control->HTML;
|
306 |
-
$control->clear_controls();
|
307 |
-
echo '</div>';
|
308 |
-
echo '</div>';
|
309 |
-
echo '<script type="text/javascript">';
|
310 |
-
echo $control->JS;
|
311 |
-
echo 'jQuery("#wp_insert_inpostads_'.$identifier.'_accordion").accordion({ icons: { header: "ui-icon-circle-arrow-e", activeHeader: "ui-icon-circle-arrow-s" }, heightStyle: "auto" });';
|
312 |
-
echo 'wp_insert_inpostads_primary_ad_code_type_change("'.$identifier.'");';
|
313 |
-
echo 'wp_insert_inpostads_primary_ad_code_location_change_action("'.$identifier.'");';
|
314 |
-
echo 'wp_insert_inpostads_vi_customize_adcode();';
|
315 |
-
echo '</script>';
|
316 |
-
echo '</div>';
|
317 |
-
}
|
318 |
-
|
319 |
-
function wp_insert_inpostads_form_save_action($identifier) {
|
320 |
-
$inpostads = get_option('wp_insert_inpostads');
|
321 |
-
$inpostads[$identifier]['identifier'] = ((isset($_POST['wp_insert_inpostads_identifier']))?$_POST['wp_insert_inpostads_identifier']:'');
|
322 |
-
$inpostads[$identifier]['status'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_status']) && ($_POST['wp_insert_inpostads_'.$identifier.'_status'] == 'true'))?'1':'');
|
323 |
-
|
324 |
-
$inpostads[$identifier]['location'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_location']))?$_POST['wp_insert_inpostads_'.$identifier.'_location']:'');
|
325 |
-
$inpostads[$identifier]['paragraphtopposition'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_paragraphtopposition']))?$_POST['wp_insert_inpostads_'.$identifier.'_paragraphtopposition']:'');
|
326 |
-
$inpostads[$identifier]['paragraphbottomposition'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_paragraphbottomposition']))?$_POST['wp_insert_inpostads_'.$identifier.'_paragraphbottomposition']:'');
|
327 |
-
|
328 |
-
$inpostads[$identifier]['primary_ad_code_type'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_primary_ad_code_type']))?$_POST['wp_insert_inpostads_'.$identifier.'_primary_ad_code_type']:'');
|
329 |
-
$inpostads[$identifier]['primary_ad_code'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_primary_ad_code']))?$_POST['wp_insert_inpostads_'.$identifier.'_primary_ad_code']:'');
|
330 |
-
$inpostads[$identifier]['secondary_ad_code'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_secondary_ad_code']))?$_POST['wp_insert_inpostads_'.$identifier.'_secondary_ad_code']:'');
|
331 |
-
$inpostads[$identifier]['tertiary_ad_code'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_tertiary_ad_code']))?$_POST['wp_insert_inpostads_'.$identifier.'_tertiary_ad_code']:'');
|
332 |
-
|
333 |
-
$inpostads[$identifier]['rules_exclude_loggedin'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_rules_exclude_loggedin']))?$_POST['wp_insert_inpostads_'.$identifier.'_rules_exclude_loggedin']:'');
|
334 |
-
$inpostads[$identifier]['rules_exclude_mobile_devices'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_rules_exclude_mobile_devices']))?$_POST['wp_insert_inpostads_'.$identifier.'_rules_exclude_mobile_devices']:'');
|
335 |
-
$inpostads[$identifier]['rules_exclude_404'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_rules_exclude_404']))?$_POST['wp_insert_inpostads_'.$identifier.'_rules_exclude_404']:'');
|
336 |
-
$inpostads[$identifier]['rules_exclude_home'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_rules_exclude_home']))?$_POST['wp_insert_inpostads_'.$identifier.'_rules_exclude_home']:'');
|
337 |
-
$inpostads[$identifier]['rules_exclude_archives'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_rules_exclude_archives']))?$_POST['wp_insert_inpostads_'.$identifier.'_rules_exclude_archives']:'');
|
338 |
-
$inpostads[$identifier]['rules_exclude_search'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_rules_exclude_search']))?$_POST['wp_insert_inpostads_'.$identifier.'_rules_exclude_search']:'');
|
339 |
-
$inpostads[$identifier]['rules_exclude_page'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_rules_exclude_page']))?$_POST['wp_insert_inpostads_'.$identifier.'_rules_exclude_page']:'');
|
340 |
-
$inpostads[$identifier]['rules_page_exceptions'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_rules_page_exceptions']))?$_POST['wp_insert_inpostads_'.$identifier.'_rules_page_exceptions']:'');
|
341 |
-
$inpostads[$identifier]['rules_exclude_post'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_rules_exclude_post']))?$_POST['wp_insert_inpostads_'.$identifier.'_rules_exclude_post']:'');
|
342 |
-
$inpostads[$identifier]['rules_post_exceptions'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_rules_post_exceptions']))?$_POST['wp_insert_inpostads_'.$identifier.'_rules_post_exceptions']:'');
|
343 |
-
$inpostads[$identifier]['rules_post_categories_exceptions'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_rules_post_categories_exceptions']))?$_POST['wp_insert_inpostads_'.$identifier.'_rules_post_categories_exceptions']:'');
|
344 |
-
$inpostads[$identifier]['rules_exclude_categories'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_rules_exclude_categories']))?$_POST['wp_insert_inpostads_'.$identifier.'_rules_exclude_categories']:'');
|
345 |
-
$inpostads[$identifier]['rules_categories_exceptions'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_rules_categories_exceptions']))?$_POST['wp_insert_inpostads_'.$identifier.'_rules_categories_exceptions']:'');
|
346 |
-
|
347 |
-
$inpostads[$identifier]['geo_group1_countries'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_geo_group1_countries']))?$_POST['wp_insert_inpostads_'.$identifier.'_geo_group1_countries']:'');
|
348 |
-
$inpostads[$identifier]['geo_group1_adcode'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_geo_group1_adcode']))?$_POST['wp_insert_inpostads_'.$identifier.'_geo_group1_adcode']:'');
|
349 |
-
$inpostads[$identifier]['geo_group2_countries'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_geo_group2_countries']))?$_POST['wp_insert_inpostads_'.$identifier.'_geo_group2_countries']:'');
|
350 |
-
$inpostads[$identifier]['geo_group2_adcode'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_geo_group2_adcode']))?$_POST['wp_insert_inpostads_'.$identifier.'_geo_group2_adcode']:'');
|
351 |
-
|
352 |
-
$inpostads[$identifier]['styles'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_styles']))?$_POST['wp_insert_inpostads_'.$identifier.'_styles']:'');
|
353 |
-
|
354 |
-
$inpostads[$identifier]['title'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_title']))?$_POST['wp_insert_inpostads_'.$identifier.'_title']:'');
|
355 |
-
$inpostads[$identifier]['notes'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_notes']))?$_POST['wp_insert_inpostads_'.$identifier.'_notes']:'');
|
356 |
-
|
357 |
-
$inpostads[$identifier]['minimum_character_count'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_minimum_character_count']))?$_POST['wp_insert_inpostads_'.$identifier.'_minimum_character_count']:'');
|
358 |
-
$inpostads[$identifier]['paragraph_buffer_count'] = ((isset($_POST['wp_insert_inpostads_'.$identifier.'_paragraph_buffer_count']))?$_POST['wp_insert_inpostads_'.$identifier.'_paragraph_buffer_count']:'');
|
359 |
-
|
360 |
-
update_option('wp_insert_inpostads', $inpostads);
|
361 |
-
}
|
362 |
-
/* End Shared UI Functions */
|
363 |
-
|
364 |
-
/* Begin In-Post Ads Ad Insertion */
|
365 |
-
add_filter('the_content', 'wp_insert_inpostads_the_content', 100);
|
366 |
-
function wp_insert_inpostads_the_content($content) {
|
367 |
-
if(function_exists('is_amp_endpoint') && is_amp_endpoint()) {
|
368 |
-
return $content;
|
369 |
-
} else if(!is_feed() && is_main_query()) {
|
370 |
-
$inpostads = get_option('wp_insert_inpostads');
|
371 |
-
if(isset($inpostads) && is_array($inpostads)) {
|
372 |
-
$paragraphCount = wp_insert_inpostads_get_paragraph_count($content);
|
373 |
-
foreach($inpostads as $key => $inpostad) {
|
374 |
-
if(!isset($inpostad['location'])) { //Get the location value from the key for old users who doesnt have a location saved.
|
375 |
-
switch($key) {
|
376 |
-
case 'above':
|
377 |
-
$inpostad['location'] = 'above';
|
378 |
-
break;
|
379 |
-
case 'middle':
|
380 |
-
$inpostad['location'] = 'middle';
|
381 |
-
break;
|
382 |
-
case 'below':
|
383 |
-
$inpostad['location'] = 'below';
|
384 |
-
break;
|
385 |
-
case 'left':
|
386 |
-
$inpostad['location'] = 'left';
|
387 |
-
break;
|
388 |
-
case 'right':
|
389 |
-
$inpostad['location'] = 'right';
|
390 |
-
break;
|
391 |
-
default:
|
392 |
-
$inpostad['location'] = 'above';
|
393 |
-
break;
|
394 |
-
}
|
395 |
-
}
|
396 |
-
|
397 |
-
if(wp_insert_get_ad_status($inpostad)) {
|
398 |
-
switch($inpostad['location']) {
|
399 |
-
case 'above':
|
400 |
-
$content = '<div class="wpInsert wpInsertInPostAd wpInsertAbove"'.(($inpostad['styles'] != '')?' style="'.$inpostad['styles'].'"':'').'>'.wp_insert_get_geotargeted_adcode($inpostad).'</div>'.$content;
|
401 |
-
break;
|
402 |
-
case 'middle':
|
403 |
-
if($paragraphCount > 1) {
|
404 |
-
if(($inpostad['paragraph_buffer_count'] == 0) || ($inpostad['paragraph_buffer_count'] == '')) {
|
405 |
-
$position = wp_insert_inpostads_get_insertion_position('/p>', $content, round($paragraphCount / 2));
|
406 |
-
} else {
|
407 |
-
$position = wp_insert_inpostads_get_insertion_position('/p>', $content, $inpostad['paragraph_buffer_count']);
|
408 |
-
}
|
409 |
-
if($position) {
|
410 |
-
if(($inpostad['minimum_character_count'] == 0) || ($inpostad['minimum_character_count'] == '')) {
|
411 |
-
$content = substr_replace($content, '/p>'.'<div class="wpInsert wpInsertInPostAd wpInsertMiddle"'.(($inpostad['styles'] != '')?' style="'.$inpostad['styles'].'"':'').'>'.wp_insert_get_geotargeted_adcode($inpostad).'</div>', $position, 3);
|
412 |
-
} else {
|
413 |
-
if(strlen(strip_tags($content)) > $inpostad['minimum_character_count']) {
|
414 |
-
$content = substr_replace($content, '/p>'.'<div class="wpInsert wpInsertInPostAd wpInsertMiddle"'.(($inpostad['styles'] != '')?' style="'.$inpostad['styles'].'"':'').'>'.wp_insert_get_geotargeted_adcode($inpostad).'</div>', $position, 3);
|
415 |
-
}
|
416 |
-
}
|
417 |
-
}
|
418 |
-
}
|
419 |
-
break;
|
420 |
-
case 'below':
|
421 |
-
$content = $content.'<div class="wpInsert wpInsertInPostAd wpInsertBelow"'.(($inpostad['styles'] != '')?' style="'.$inpostad['styles'].'"':'').'>'.wp_insert_get_geotargeted_adcode($inpostad).'</div>';
|
422 |
-
break;
|
423 |
-
case 'left':
|
424 |
-
$content = '<div class="wpInsert wpInsertInPostAd wpInsertLeft" style="float: left; '.(($inpostad['styles'] != '')?$inpostad['styles']:'').'">'.wp_insert_get_geotargeted_adcode($inpostad).'</div>'.$content;
|
425 |
-
break;
|
426 |
-
case 'right':
|
427 |
-
$content = '<div class="wpInsert wpInsertInPostAd wpInsertRight" style="float: right; '.(($inpostad['styles'] != '')?$inpostad['styles']:'').'">'.wp_insert_get_geotargeted_adcode($inpostad).'</div>'.$content;
|
428 |
-
break;
|
429 |
-
case 'paragraphtop':
|
430 |
-
if($paragraphCount > 1) {
|
431 |
-
$position = wp_insert_inpostads_get_insertion_position('/p>', $content, $inpostad['paragraphtopposition']);
|
432 |
-
if($position) {
|
433 |
-
$content = substr_replace($content, '/p>'.'<div class="wpInsert wpInsertInPostAd wpInsertMiddle"'.(($inpostad['styles'] != '')?' style="'.$inpostad['styles'].'"':'').'>'.wp_insert_get_geotargeted_adcode($inpostad).'</div>', $position, 3);
|
434 |
-
}
|
435 |
-
}
|
436 |
-
break;
|
437 |
-
case 'paragraphbottom':
|
438 |
-
if($paragraphCount > 1) {
|
439 |
-
$paragraphbottomposition = ($paragraphCount - (int)$inpostad['paragraphbottomposition']);
|
440 |
-
if(($paragraphbottomposition > 0) && ($paragraphbottomposition < $paragraphCount)) {
|
441 |
-
$position = wp_insert_inpostads_get_insertion_position('/p>', $content, $paragraphbottomposition);
|
442 |
-
if($position) {
|
443 |
-
$content = substr_replace($content, '/p>'.'<div class="wpInsert wpInsertInPostAd wpInsertMiddle"'.(($inpostad['styles'] != '')?' style="'.$inpostad['styles'].'"':'').'>'.wp_insert_get_geotargeted_adcode($inpostad).'</div>', $position, 3);
|
444 |
-
}
|
445 |
-
}
|
446 |
-
}
|
447 |
-
break;
|
448 |
-
}
|
449 |
-
}
|
450 |
-
}
|
451 |
-
}
|
452 |
-
}
|
453 |
-
return $content;
|
454 |
-
}
|
455 |
-
|
456 |
-
function wp_insert_inpostads_get_paragraph_count($content) {
|
457 |
-
$paragraphs = explode('/p>', $content);
|
458 |
-
$paragraphCount = 0;
|
459 |
-
if(is_array($paragraphs)) {
|
460 |
-
foreach($paragraphs as $paragraph) {
|
461 |
-
if(strlen($paragraph) > 1) {
|
462 |
-
$paragraphCount++;
|
463 |
-
}
|
464 |
-
}
|
465 |
-
}
|
466 |
-
return $paragraphCount;
|
467 |
-
}
|
468 |
-
|
469 |
-
function wp_insert_inpostads_get_insertion_position($search, $string, $offset) {
|
470 |
-
$arr = explode($search, $string);
|
471 |
-
switch($offset) {
|
472 |
-
case $offset == 0:
|
473 |
-
return false;
|
474 |
-
break;
|
475 |
-
case $offset > max(array_keys($arr)):
|
476 |
-
return false;
|
477 |
-
break;
|
478 |
-
default:
|
479 |
-
return strlen(implode($search, array_slice($arr, 0, $offset)));
|
480 |
-
break;
|
481 |
-
}
|
482 |
-
}
|
483 |
-
/* End In-Post Ads Ad Insertion */
|
484 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/modules/inpostads/js/module.js
DELETED
@@ -1,235 +0,0 @@
|
|
1 |
-
jQuery(document).ready(function() {
|
2 |
-
wp_insert_click_handler(
|
3 |
-
'wp_insert_inpostads_new',
|
4 |
-
'In-Post Ad : Add New',
|
5 |
-
jQuery("body").width() * 0.8,
|
6 |
-
jQuery("body").height() * 0.8,
|
7 |
-
function() {
|
8 |
-
jQuery('.wp_insert_inpostads_status').parent().css({'display': 'inline-block', 'margin': '5px 0 0'}).prependTo('.ui-dialog-buttonpane');
|
9 |
-
},
|
10 |
-
function() {
|
11 |
-
var identifier = jQuery(".wp_insert_inpostads_identifier").val();
|
12 |
-
var inpostadLink = jQuery("<a></a>");
|
13 |
-
inpostadLink.attr("id", "wp_insert_inpostads_"+identifier);
|
14 |
-
inpostadLink.attr("href", "javascript:;");
|
15 |
-
inpostadLink.attr("onClick", "wp_insert_inpostads_click_handler(\'"+identifier+"\', \'"+jQuery("#wp_insert_inpostads_"+identifier+"_title").val()+"\')");
|
16 |
-
inpostadLink.html("In-Post Ad : "+jQuery("#wp_insert_inpostads_"+identifier+"_title").val());
|
17 |
-
var deleteButton = jQuery("<span></span>");
|
18 |
-
deleteButton.attr("class", "dashicons dashicons-dismiss wp_insert_delete_icon");
|
19 |
-
deleteButton.attr("onClick", "wp_insert_inpostads_remove(\'"+identifier+"\')");
|
20 |
-
jQuery("#wp_insert_inpostads_new").parent().before(jQuery("<p></p>").append(inpostadLink, deleteButton));
|
21 |
-
wp_insert_inpostads_update(identifier);
|
22 |
-
},
|
23 |
-
function() { }
|
24 |
-
);
|
25 |
-
});
|
26 |
-
|
27 |
-
function wp_insert_inpostads_click_handler(identifier, title) {
|
28 |
-
jQuery('<div id="wp_insert_inpostads_'+identifier+'_dialog"></div>').html('<div class="wp_insert_ajaxloader"></div>').dialog({
|
29 |
-
'modal': true,
|
30 |
-
'resizable': false,
|
31 |
-
'width': jQuery("body").width() * 0.8,
|
32 |
-
'maxWidth': jQuery("body").width() * 0.8,
|
33 |
-
'maxHeight': jQuery("body").height() * 0.9,
|
34 |
-
'title': 'In-Post Ad : '+title,
|
35 |
-
position: { my: 'center', at: 'center', of: window },
|
36 |
-
open: function (event, ui) {
|
37 |
-
jQuery('.ui-dialog').css({'z-index': 999999, 'max-width': '90%'});
|
38 |
-
jQuery('.ui-widget-overlay').css({'z-index': 999998, 'opacity': 0.8, 'background': '#000000'});
|
39 |
-
jQuery('.ui-dialog-buttonpane button:contains("Update")').button('disable');
|
40 |
-
jQuery.post(
|
41 |
-
jQuery('#wp_insert_admin_ajax').val(), {
|
42 |
-
'action': 'wp_insert_inpostads_existing_form_get_content',
|
43 |
-
'wp_insert_inpostads_identifier': identifier,
|
44 |
-
'wp_insert_nonce': jQuery('#wp_insert_nonce').val()
|
45 |
-
}, function(response) {
|
46 |
-
jQuery('.wp_insert_ajaxloader').hide();
|
47 |
-
jQuery('.ui-dialog-content').html(response);
|
48 |
-
jQuery('.ui-accordion .ui-accordion-content').css('max-height', (jQuery("body").height() * 0.45));
|
49 |
-
jQuery('.ui-dialog-buttonpane button:contains("Update")').button('enable');
|
50 |
-
jQuery('.wp_insert_inpostads_status').parent().css({'display': 'inline-block', 'margin': '5px 0 0'}).prependTo('.ui-dialog-buttonpane');
|
51 |
-
jQuery('.ui-dialog').css({'position': 'fixed'});
|
52 |
-
jQuery('#wp_insert_inpostads_'+identifier+'_dialog').delay(500).dialog({position: { my: 'center', at: 'center', of: window }});
|
53 |
-
}
|
54 |
-
);
|
55 |
-
},
|
56 |
-
buttons: {
|
57 |
-
'Update': function() {
|
58 |
-
jQuery("#wp_insert_inpostads_"+identifier).html("In-Post Ad : "+jQuery("#wp_insert_inpostads_"+identifier+"_title").val());
|
59 |
-
jQuery("#wp_insert_inpostads_"+identifier).attr("onClick", "wp_insert_inpostads_click_handler(\'"+identifier+"\', \'"+jQuery("#wp_insert_inpostads_"+identifier+"_title").val()+"\')");
|
60 |
-
wp_insert_inpostads_update(identifier);
|
61 |
-
jQuery(this).dialog('close');
|
62 |
-
},
|
63 |
-
Cancel: function() {
|
64 |
-
jQuery(this).dialog('close');
|
65 |
-
}
|
66 |
-
},
|
67 |
-
close: function() {
|
68 |
-
jQuery(this).dialog('destroy');
|
69 |
-
}
|
70 |
-
});
|
71 |
-
}
|
72 |
-
|
73 |
-
function wp_insert_inpostads_update(identifier) {
|
74 |
-
args = {};
|
75 |
-
args['action'] = 'wp_insert_inpostads_existing_form_save_action';
|
76 |
-
args['wp_insert_nonce'] = jQuery('#wp_insert_nonce').val();
|
77 |
-
args['wp_insert_inpostads_identifier'] = identifier;
|
78 |
-
args['wp_insert_inpostads_'+identifier+'_status'] = jQuery('#wp_insert_inpostads_'+identifier+'_status').prop('checked');
|
79 |
-
|
80 |
-
args['wp_insert_inpostads_'+identifier+'_location'] = jQuery('input[name="wp_insert_inpostads['+identifier+'][location]"]:checked').val();
|
81 |
-
args['wp_insert_inpostads_'+identifier+'_paragraphtopposition'] = jQuery('#wp_insert_inpostads_'+identifier+'_paragraphtopposition').val();
|
82 |
-
args['wp_insert_inpostads_'+identifier+'_paragraphbottomposition'] = jQuery('#wp_insert_inpostads_'+identifier+'_paragraphbottomposition').val();
|
83 |
-
|
84 |
-
args['wp_insert_inpostads_'+identifier+'_primary_ad_code_type'] = jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').val();
|
85 |
-
args['wp_insert_inpostads_'+identifier+'_primary_ad_code'] = jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code').val();
|
86 |
-
args['wp_insert_inpostads_'+identifier+'_secondary_ad_code'] = jQuery('#wp_insert_inpostads_'+identifier+'_secondary_ad_code').val();
|
87 |
-
args['wp_insert_inpostads_'+identifier+'_tertiary_ad_code'] = jQuery('#wp_insert_inpostads_'+identifier+'_tertiary_ad_code').val();
|
88 |
-
|
89 |
-
args['wp_insert_inpostads_'+identifier+'_rules_exclude_loggedin'] = jQuery('#wp_insert_inpostads_'+identifier+'_rules_exclude_loggedin').prop('checked');
|
90 |
-
args['wp_insert_inpostads_'+identifier+'_rules_exclude_mobile_devices'] = jQuery('#wp_insert_inpostads_'+identifier+'_rules_exclude_mobile_devices').prop('checked');
|
91 |
-
args['wp_insert_inpostads_'+identifier+'_rules_exclude_404'] = jQuery('#wp_insert_inpostads_'+identifier+'_rules_exclude_404').prop('checked');
|
92 |
-
args['wp_insert_inpostads_'+identifier+'_rules_exclude_home'] = jQuery('#wp_insert_inpostads_'+identifier+'_rules_exclude_home').prop('checked');
|
93 |
-
args['wp_insert_inpostads_'+identifier+'_rules_exclude_archives'] = jQuery('#wp_insert_inpostads_'+identifier+'_rules_exclude_archives').prop('checked');
|
94 |
-
args['wp_insert_inpostads_'+identifier+'_rules_exclude_search'] = jQuery('#wp_insert_inpostads_'+identifier+'_rules_exclude_search').prop('checked');
|
95 |
-
args['wp_insert_inpostads_'+identifier+'_rules_exclude_page'] = jQuery('#wp_insert_inpostads_'+identifier+'_rules_exclude_page').prop('checked');
|
96 |
-
args['wp_insert_inpostads_'+identifier+'_rules_page_exceptions'] = jQuery.map(jQuery('#wp_insert_inpostads_'+identifier+'_rules_page_exceptions :selected'), function(e) { return jQuery(e).val(); });
|
97 |
-
args['wp_insert_inpostads_'+identifier+'_rules_exclude_post'] = jQuery('#wp_insert_inpostads_'+identifier+'_rules_exclude_post').prop('checked');
|
98 |
-
args['wp_insert_inpostads_'+identifier+'_rules_post_exceptions'] = jQuery.map(jQuery('#wp_insert_inpostads_'+identifier+'_rules_post_exceptions :selected'), function(e) { return jQuery(e).val(); });
|
99 |
-
args['wp_insert_inpostads_'+identifier+'_rules_post_categories_exceptions'] = jQuery.map(jQuery('#wp_insert_inpostads_'+identifier+'_rules_post_categories_exceptions :selected'), function(e) { return jQuery(e).val(); });
|
100 |
-
args['wp_insert_inpostads_'+identifier+'_rules_exclude_categories'] = jQuery('#wp_insert_inpostads_'+identifier+'_rules_exclude_categories').prop('checked');
|
101 |
-
args['wp_insert_inpostads_'+identifier+'_rules_categories_exceptions'] = jQuery.map(jQuery('#wp_insert_inpostads_'+identifier+'_rules_categories_exceptions :selected'), function(e) { return jQuery(e).val(); });
|
102 |
-
|
103 |
-
args['wp_insert_inpostads_'+identifier+'_geo_group1_countries'] = jQuery.map(jQuery('#wp_insert_inpostads_'+identifier+'_geo_group1_countries :selected'), function(e) { return jQuery(e).val(); });
|
104 |
-
args['wp_insert_inpostads_'+identifier+'_geo_group1_adcode'] = jQuery('#wp_insert_inpostads_'+identifier+'_geo_group1_adcode').val();
|
105 |
-
args['wp_insert_inpostads_'+identifier+'_geo_group2_countries'] = jQuery.map(jQuery('#wp_insert_inpostads_'+identifier+'_geo_group2_countries :selected'), function(e) { return jQuery(e).val(); });
|
106 |
-
args['wp_insert_inpostads_'+identifier+'_geo_group2_adcode'] = jQuery('#wp_insert_inpostads_'+identifier+'_geo_group2_adcode').val();
|
107 |
-
|
108 |
-
args['wp_insert_inpostads_'+identifier+'_title'] = jQuery('#wp_insert_inpostads_'+identifier+'_title').val();
|
109 |
-
args['wp_insert_inpostads_'+identifier+'_styles'] = jQuery('#wp_insert_inpostads_'+identifier+'_styles').val();
|
110 |
-
|
111 |
-
args['wp_insert_inpostads_'+identifier+'_notes'] = jQuery('#wp_insert_inpostads_'+identifier+'_notes').val();
|
112 |
-
|
113 |
-
args['wp_insert_inpostads_'+identifier+'_minimum_character_count'] = jQuery('#wp_insert_inpostads_'+identifier+'_minimum_character_count').val();
|
114 |
-
args['wp_insert_inpostads_'+identifier+'_paragraph_buffer_count'] = jQuery('#wp_insert_inpostads_'+identifier+'_paragraph_buffer_count').val();
|
115 |
-
|
116 |
-
jQuery.post(
|
117 |
-
jQuery('#wp_insert_admin_ajax').val(), args, function(response) { }
|
118 |
-
);
|
119 |
-
}
|
120 |
-
|
121 |
-
function wp_insert_inpostads_remove(identifier) {
|
122 |
-
jQuery("<p>Are you Sure you want to remove this Ad Unit?</p>").dialog({
|
123 |
-
'modal': true,
|
124 |
-
'resizable': false,
|
125 |
-
'title': 'Deletion Confirmation',
|
126 |
-
position: { my: 'center', at: 'center', of: window },
|
127 |
-
open: function (event, ui) {
|
128 |
-
jQuery('.ui-dialog').css({'z-index': 999999, 'max-width': '90%'});
|
129 |
-
jQuery('.ui-widget-overlay').css({'z-index': 999998, 'opacity': 0.8, 'background': '#000000'});
|
130 |
-
},
|
131 |
-
buttons : {
|
132 |
-
'Confirm': function() {
|
133 |
-
jQuery("#wp_insert_inpostads_"+identifier).parent().remove();
|
134 |
-
jQuery.post(
|
135 |
-
jQuery('#wp_insert_admin_ajax').val(), {
|
136 |
-
'action': 'wp_insert_inpostads_remove',
|
137 |
-
'wp_insert_inpostads_identifier': identifier,
|
138 |
-
'wp_insert_nonce': jQuery('#wp_insert_nonce').val()
|
139 |
-
}, function(response) {
|
140 |
-
}
|
141 |
-
);
|
142 |
-
jQuery(this).dialog("close");
|
143 |
-
},
|
144 |
-
'Cancel': function() {
|
145 |
-
jQuery(this).dialog("close");
|
146 |
-
}
|
147 |
-
},
|
148 |
-
close: function() {
|
149 |
-
jQuery(this).dialog('destroy');
|
150 |
-
}
|
151 |
-
});
|
152 |
-
}
|
153 |
-
|
154 |
-
function wp_insert_inpostads_primary_ad_code_location_change_action(identifier) {
|
155 |
-
jQuery('input[name="wp_insert_inpostads['+identifier+'][location]"]').click(function() {
|
156 |
-
var location = jQuery('input[name="wp_insert_inpostads['+identifier+'][location]"]:checked').val();
|
157 |
-
if((location == 'above') || (location == 'middle') || (location == 'paragraphtop')) {
|
158 |
-
jQuery('#primary_ad_code_type_vicode').parent().parent().parent().show();
|
159 |
-
jQuery('#primary_ad_code_type_generic').show();
|
160 |
-
jQuery('#primary_ad_code_type_generic').parent().find('.isSelectedIndicatorText').html('Generic / Custom Ad Code (Primary Network)');
|
161 |
-
jQuery('#primary_ad_code_type_generic').parent().parent().parent().css({'width': 'calc(50% - 40px)', 'margin': '0 20px 5px', 'float': 'left'});
|
162 |
-
//jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').val('generic');
|
163 |
-
} else {
|
164 |
-
jQuery('#primary_ad_code_type_vicode').parent().parent().parent().hide();
|
165 |
-
jQuery('#primary_ad_code_type_generic').hide();
|
166 |
-
jQuery('#primary_ad_code_type_generic').parent().find('.isSelectedIndicatorText').html('Ad Code (Primary Network)');
|
167 |
-
jQuery('#primary_ad_code_type_generic').parent().parent().parent().css({'width': '100%', 'margin': '15px 0', 'float': 'none'});
|
168 |
-
jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').val('generic');
|
169 |
-
}
|
170 |
-
|
171 |
-
if(location == 'middle') {
|
172 |
-
jQuery('.wp_insert_inpostads_location_middle_panel').show();
|
173 |
-
} else {
|
174 |
-
jQuery('.wp_insert_inpostads_location_middle_panel').hide();
|
175 |
-
}
|
176 |
-
});
|
177 |
-
var location = jQuery('input[name="wp_insert_inpostads['+identifier+'][location]"]:checked').val();
|
178 |
-
if((location == 'above') || (location == 'middle') || (location == 'paragraphtop')) {
|
179 |
-
jQuery('#primary_ad_code_type_vicode').parent().parent().parent().show();
|
180 |
-
jQuery('#primary_ad_code_type_generic').show();
|
181 |
-
jQuery('#primary_ad_code_type_generic').parent().find('.isSelectedIndicatorText').html('Generic / Custom Ad Code (Primary Network)');
|
182 |
-
jQuery('#primary_ad_code_type_generic').parent().parent().parent().css({'width': 'calc(50% - 40px)', 'margin': '0 20px 5px', 'float': 'left'});
|
183 |
-
//jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').val('generic');
|
184 |
-
} else {
|
185 |
-
jQuery('#primary_ad_code_type_vicode').parent().parent().parent().hide();
|
186 |
-
jQuery('#primary_ad_code_type_generic').hide();
|
187 |
-
jQuery('#primary_ad_code_type_generic').parent().find('.isSelectedIndicatorText').html('Ad Code (Primary Network)');
|
188 |
-
jQuery('#primary_ad_code_type_generic').parent().parent().parent().css({'width': '100%', 'margin': '15px 0', 'float': 'none'});
|
189 |
-
jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').val('generic');
|
190 |
-
}
|
191 |
-
|
192 |
-
if(location == 'middle') {
|
193 |
-
jQuery('.wp_insert_inpostads_location_middle_panel').show();
|
194 |
-
} else {
|
195 |
-
jQuery('.wp_insert_inpostads_location_middle_panel').hide();
|
196 |
-
}
|
197 |
-
}
|
198 |
-
|
199 |
-
function wp_insert_inpostads_primary_ad_code_type_change(identifier) {
|
200 |
-
jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').parent().hide();
|
201 |
-
jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').change(function() {
|
202 |
-
jQuery('.isSelectedIndicator').removeClass('active');
|
203 |
-
jQuery('#primary_ad_code_type_'+jQuery(this).val()).addClass('active');
|
204 |
-
});
|
205 |
-
jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').change();
|
206 |
-
|
207 |
-
jQuery('#primary_ad_code_type_generic').click(function() {
|
208 |
-
jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').val('generic');
|
209 |
-
jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').change();
|
210 |
-
});
|
211 |
-
jQuery('#primary_ad_code_type_generic').parent().click(function() {
|
212 |
-
jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').val('generic');
|
213 |
-
jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').change();
|
214 |
-
});
|
215 |
-
|
216 |
-
jQuery('#primary_ad_code_type_vicode').click(function() {
|
217 |
-
if(!jQuery('#primary_ad_code_type_vicode').hasClass('disabled')) {
|
218 |
-
jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').val('vicode');
|
219 |
-
jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').change();
|
220 |
-
}
|
221 |
-
});
|
222 |
-
jQuery('#primary_ad_code_type_vicode').parent().click(function() {
|
223 |
-
if(!jQuery('#primary_ad_code_type_vicode').hasClass('disabled')) {
|
224 |
-
jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').val('vicode');
|
225 |
-
jQuery('#wp_insert_inpostads_'+identifier+'_primary_ad_code_type').change();
|
226 |
-
}
|
227 |
-
});
|
228 |
-
}
|
229 |
-
|
230 |
-
function wp_insert_inpostads_vi_customize_adcode() {
|
231 |
-
jQuery('#wp_insert_inpostads_vi_customize_adcode').click(function() {
|
232 |
-
jQuery('.ui-dialog-titlebar').find('button').last().button('enable').click();
|
233 |
-
jQuery('#wp_insert_vi_customize_adcode').click();
|
234 |
-
});
|
235 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/modules/inpostads/module.php
DELETED
@@ -1,60 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
require_once(dirname(__FILE__).'/functions.php');
|
3 |
-
|
4 |
-
/* Begin Add Assets */
|
5 |
-
/*add_action('wp_insert_modules_css', 'wp_insert_module_inpostads_css', 0);
|
6 |
-
function wp_insert_module_inpostads_css() {
|
7 |
-
wp_register_style('wp-insert-module-inpostads-css', WP_INSERT_URL.'includes/modules/inpostads/css/module.css', array('wp-insert-css'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
|
8 |
-
wp_enqueue_style('wp-insert-module-inpostads-css');
|
9 |
-
}*/
|
10 |
-
|
11 |
-
add_action('wp_insert_modules_js', 'wp_insert_module_inpostads_js', 0);
|
12 |
-
function wp_insert_module_inpostads_js() {
|
13 |
-
wp_register_script('wp-insert-module-inpostads-js', WP_INSERT_URL.'includes/modules/inpostads/js/module.js', array('wp-insert-js'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
|
14 |
-
wp_enqueue_script('wp-insert-module-inpostads-js');
|
15 |
-
}
|
16 |
-
/* End Add Assets */
|
17 |
-
|
18 |
-
/* Begin Add Card in Admin Panel */
|
19 |
-
add_action('wp_insert_plugin_card', 'wp_insert_inpostads_plugin_card', 20);
|
20 |
-
function wp_insert_inpostads_plugin_card() {
|
21 |
-
echo '<div class="plugin-card">';
|
22 |
-
echo '<div class="plugin-card-top">';
|
23 |
-
echo '<h4>In-Post Ads</h4>';
|
24 |
-
echo '<p>Ads shown within the post content.<br />You can choose different locations to insert ads from Above / Below / Inside / Middle Of / To the Left / To the Right of post content</p>';
|
25 |
-
echo '</div>';
|
26 |
-
echo '<div class="plugin-card-bottom">';
|
27 |
-
$inpostads = get_option('wp_insert_inpostads');
|
28 |
-
if(isset($inpostads) && is_array($inpostads)) {
|
29 |
-
foreach($inpostads as $key => $value) {
|
30 |
-
echo '<p>';
|
31 |
-
if(!isset($value['title']) || ($value['title'] == '')) {
|
32 |
-
switch($key) {
|
33 |
-
case 'above':
|
34 |
-
$value['title'] = 'Above Post Content';
|
35 |
-
break;
|
36 |
-
case 'middle':
|
37 |
-
$value['title'] = 'Middle of Post Content';
|
38 |
-
break;
|
39 |
-
case 'below':
|
40 |
-
$value['title'] = 'Below Post Content';
|
41 |
-
break;
|
42 |
-
case 'left':
|
43 |
-
$value['title'] = 'To the Left of Post Content';
|
44 |
-
break;
|
45 |
-
case 'right':
|
46 |
-
$value['title'] = 'To the Right of Post Content';
|
47 |
-
break;
|
48 |
-
}
|
49 |
-
}
|
50 |
-
echo '<a id="wp_insert_inpostads_'.$key.'" href="javascript:;" onclick="wp_insert_inpostads_click_handler(\''.$key.'\', \''.$value['title'].'\')">In-Post Ad : '.$value['title'].'</a>';
|
51 |
-
echo '<span class="dashicons dashicons-dismiss wp_insert_delete_icon" onclick="wp_insert_inpostads_remove(\''.$key.'\')"></span>';
|
52 |
-
echo '</p>';
|
53 |
-
}
|
54 |
-
}
|
55 |
-
echo '<p style="text-align: center; padding: 20px 0 10px;"><a id="wp_insert_inpostads_new" href="#" class="button-secondary">Add New In-Post Ad</a></p>';
|
56 |
-
echo '</div>';
|
57 |
-
echo '</div>';
|
58 |
-
}
|
59 |
-
/* End Add Card in Admin Panel */
|
60 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/modules/inthemeads/functions.php
DELETED
@@ -1,242 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/* Begin Add New In-Theme Content */
|
3 |
-
add_action('wp_ajax_wp_insert_inthemeads_new_form_get_content', 'wp_insert_inthemeads_new_form_get_content');
|
4 |
-
function wp_insert_inthemeads_new_form_get_content() {
|
5 |
-
check_ajax_referer('wp-insert', 'wp_insert_nonce');
|
6 |
-
wp_insert_inthemeads_form_get_content(uniqid());
|
7 |
-
die();
|
8 |
-
}
|
9 |
-
/* End Add New In-Theme Content */
|
10 |
-
|
11 |
-
/* Begin Edit In-Theme Content */
|
12 |
-
add_action('wp_ajax_wp_insert_inthemeads_existing_form_get_content', 'wp_insert_inthemeads_existing_form_get_content');
|
13 |
-
function wp_insert_inthemeads_existing_form_get_content() {
|
14 |
-
check_ajax_referer('wp-insert', 'wp_insert_nonce');
|
15 |
-
if(isset($_POST['wp_insert_inthemeads_identifier'])) {
|
16 |
-
wp_insert_inthemeads_form_get_content($_POST['wp_insert_inthemeads_identifier']);
|
17 |
-
}
|
18 |
-
die();
|
19 |
-
}
|
20 |
-
|
21 |
-
add_action('wp_ajax_wp_insert_inthemeads_existing_form_save_action', 'wp_insert_inthemeads_existing_form_save_action');
|
22 |
-
function wp_insert_inthemeads_existing_form_save_action() {
|
23 |
-
check_ajax_referer('wp-insert', 'wp_insert_nonce');
|
24 |
-
if(isset($_POST['wp_insert_inthemeads_identifier'])) {
|
25 |
-
wp_insert_inthemeads_form_save_action($_POST['wp_insert_inthemeads_identifier']);
|
26 |
-
}
|
27 |
-
die();
|
28 |
-
}
|
29 |
-
/* End Edit In-Theme Content */
|
30 |
-
|
31 |
-
/* Begin Delete In-Theme Content */
|
32 |
-
add_action('wp_ajax_wp_insert_inthemeads_remove', 'wp_insert_inthemeads_remove');
|
33 |
-
function wp_insert_inthemeads_remove() {
|
34 |
-
check_ajax_referer('wp-insert', 'wp_insert_nonce');
|
35 |
-
if(isset($_POST['wp_insert_inthemeads_identifier'])) {
|
36 |
-
$inthemeads = get_option('wp_insert_inthemeads');
|
37 |
-
unset($inthemeads[$_POST['wp_insert_inthemeads_identifier']]);
|
38 |
-
update_option('wp_insert_inthemeads', $inthemeads);
|
39 |
-
}
|
40 |
-
die();
|
41 |
-
}
|
42 |
-
/* End Delete In-Theme Content */
|
43 |
-
|
44 |
-
/* Begin Shared UI Functions */
|
45 |
-
function wp_insert_inthemeads_form_get_content($identifier) {
|
46 |
-
$inthemeads = get_option('wp_insert_inthemeads');
|
47 |
-
echo '<div class="wp_insert_popup_content_wrapper">';
|
48 |
-
$control = new smartlogixControls(array('optionIdentifier' => 'wp_insert_inthemeads['.$identifier.']', 'values' => $inthemeads[$identifier]));
|
49 |
-
$control->add_control(array('type' => 'ipCheckbox', 'className' => 'wp_insert_inthemeads_status', 'optionName' => 'status'));
|
50 |
-
$control->add_control(array('type' => 'hidden', 'className' => 'wp_insert_inthemeads_identifier', 'optionName' => 'identifier', 'value' => $identifier));
|
51 |
-
echo $control->HTML;
|
52 |
-
$control->clear_controls();
|
53 |
-
echo '<div id="wp_insert_inthemeads_'.$identifier.'_accordion">';
|
54 |
-
echo '<h3>Code Snippet</h3>';
|
55 |
-
echo '<div>';
|
56 |
-
$control->set_HTML('<p class="codeSnippet"><code><?php if(function_exists("wp_intheme_ad")) { wp_intheme_ad("'.$identifier.'"); } ?></code></p>');
|
57 |
-
$control->create_section('Code to add to your theme files');
|
58 |
-
echo $control->HTML;
|
59 |
-
$control->clear_controls();
|
60 |
-
echo '</div>';
|
61 |
-
echo '<h3>Ad Code</h3>';
|
62 |
-
echo '<div>';
|
63 |
-
$abtestingMode = get_option('wp_insert_abtesting_mode');
|
64 |
-
$control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'primary_ad_code'));
|
65 |
-
$control->create_section('Ad Code (Primary Network)');
|
66 |
-
echo $control->HTML;
|
67 |
-
$control->clear_controls();
|
68 |
-
|
69 |
-
$control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'secondary_ad_code'));
|
70 |
-
$control->create_section('Ad Code (Secondary Network)');
|
71 |
-
if($abtestingMode != '2' && $abtestingMode != '3') {
|
72 |
-
$control->set_HTML('<div style="display: none;">'.$control->HTML.'</div>');
|
73 |
-
}
|
74 |
-
echo $control->HTML;
|
75 |
-
$control->clear_controls();
|
76 |
-
|
77 |
-
$control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'tertiary_ad_code'));
|
78 |
-
$control->create_section('Ad Code (Tertiary Network)');
|
79 |
-
if($abtestingMode != '3') {
|
80 |
-
$control->set_HTML('<div style="display: none;">'.$control->HTML.'</div>');
|
81 |
-
}
|
82 |
-
echo $control->HTML;
|
83 |
-
$control->clear_controls();
|
84 |
-
echo '</div>';
|
85 |
-
echo '<h3>Rules</h3>';
|
86 |
-
echo '<div>';
|
87 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_loggedin'));
|
88 |
-
$control->create_section('Logged in Users');
|
89 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
|
90 |
-
echo $control->HTML;
|
91 |
-
$control->clear_controls();
|
92 |
-
|
93 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_mobile_devices'));
|
94 |
-
$control->create_section('Mobile Devices');
|
95 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
96 |
-
echo $control->HTML;
|
97 |
-
$control->clear_controls();
|
98 |
-
|
99 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_404'));
|
100 |
-
$control->create_section('404 Pages');
|
101 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
|
102 |
-
echo $control->HTML;
|
103 |
-
$control->clear_controls();
|
104 |
-
|
105 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_home'));
|
106 |
-
$control->create_section('Home');
|
107 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
108 |
-
echo $control->HTML;
|
109 |
-
$control->clear_controls();
|
110 |
-
|
111 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_archives'));
|
112 |
-
$control->create_section('Archives');
|
113 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
|
114 |
-
echo $control->HTML;
|
115 |
-
$control->clear_controls();
|
116 |
-
|
117 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_search'));
|
118 |
-
$control->create_section('Search Results');
|
119 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
120 |
-
echo $control->HTML;
|
121 |
-
$control->clear_controls();
|
122 |
-
|
123 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_page'));
|
124 |
-
$control->add_control(array('type' => 'pages-chosen-multiselect', 'label' => 'Exceptions', 'optionName' => 'rules_page_exceptions'));
|
125 |
-
$control->create_section('Single Pages');
|
126 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
|
127 |
-
echo $control->HTML;
|
128 |
-
$control->clear_controls();
|
129 |
-
|
130 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_categories'));
|
131 |
-
$control->add_control(array('type' => 'categories-chosen-multiselect', 'label' => 'Exceptions', 'optionName' => 'rules_categories_exceptions'));
|
132 |
-
$control->create_section('Category Archives');
|
133 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
134 |
-
echo $control->HTML;
|
135 |
-
$control->clear_controls();
|
136 |
-
|
137 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_post'));
|
138 |
-
$control->add_control(array('type' => 'posts-chosen-multiselect', 'label' => 'Exceptions', 'optionName' => 'rules_post_exceptions'));
|
139 |
-
$control->add_control(array('type' => 'categories-chosen-multiselect', 'label' => 'Category Exceptions', 'optionName' => 'rules_post_categories_exceptions'));
|
140 |
-
$control->create_section('Single Posts');
|
141 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
142 |
-
echo $control->HTML;
|
143 |
-
$control->clear_controls();
|
144 |
-
|
145 |
-
echo '</div>';
|
146 |
-
echo '<h3>Geo Targeting</h3>';
|
147 |
-
echo '<div>';
|
148 |
-
echo '<p>';
|
149 |
-
echo 'A Geo Targeted Ads have a higher priority than Ads configured via Multiple Ad Networks / A-B Testing.<br />';
|
150 |
-
echo 'If a Geo Targeting match is found all other Ads (Primary, Secondary and Tertiary Networks) will be ignored.';
|
151 |
-
echo '</p>';
|
152 |
-
$control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Countries', 'optionName' => 'geo_group1_countries', 'options' => wp_insert_get_countries()));
|
153 |
-
$control->add_control(array('type' => 'textarea', 'label' => 'Ad Code', 'style' => 'height: 220px;', 'optionName' => 'geo_group1_adcode'));
|
154 |
-
$control->create_section('Group 1');
|
155 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
|
156 |
-
echo $control->HTML;
|
157 |
-
$control->clear_controls();
|
158 |
-
|
159 |
-
$control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Countries', 'optionName' => 'geo_group2_countries', 'options' => wp_insert_get_countries()));
|
160 |
-
$control->add_control(array('type' => 'textarea', 'label' => 'Ad Code', 'style' => 'height: 220px;', 'optionName' => 'geo_group2_adcode'));
|
161 |
-
$control->create_section('Group 2');
|
162 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
163 |
-
echo $control->HTML;
|
164 |
-
$control->clear_controls();
|
165 |
-
echo '<p>';
|
166 |
-
echo 'This feature uses the Free Geo ip service from <a href="http://freegeoip.net/">freegeoip.net</a>, if you find this feature useful please consider donating to the project at <a href="http://freegeoip.net/">freegeoip.net</a>';
|
167 |
-
echo '</p>';
|
168 |
-
echo '</div>';
|
169 |
-
echo '<h3>Styles</h3>';
|
170 |
-
echo '<div>';
|
171 |
-
$control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'styles'));
|
172 |
-
$control->create_section('Styles');
|
173 |
-
echo $control->HTML;
|
174 |
-
$control->clear_controls();
|
175 |
-
echo '</div>';
|
176 |
-
echo '<h3>Notes</h3>';
|
177 |
-
echo '<div>';
|
178 |
-
$control->add_control(array('type' => 'text', 'optionName' => 'title', 'helpText' => 'The title is used to identify your Ad Widget easily in future. A Random Title will be assigned to your Ad widget by default.', 'value' => ((isset($inthemeads[$identifier]['title']))?$inthemeads[$identifier]['title']:$identifier)));
|
179 |
-
$control->create_section('Title');
|
180 |
-
echo $control->HTML;
|
181 |
-
$control->clear_controls();
|
182 |
-
|
183 |
-
$control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'notes'));
|
184 |
-
$control->create_section('Notes');
|
185 |
-
echo $control->HTML;
|
186 |
-
$control->clear_controls();
|
187 |
-
echo '</div>';
|
188 |
-
echo '</div>';
|
189 |
-
echo '<script type="text/javascript">';
|
190 |
-
echo $control->JS;
|
191 |
-
echo 'jQuery("#wp_insert_inthemeads_'.$identifier.'_accordion").accordion({ icons: { header: "ui-icon-circle-arrow-e", activeHeader: "ui-icon-circle-arrow-s" }, heightStyle: "auto" });';
|
192 |
-
echo '</script>';
|
193 |
-
echo '</div>';
|
194 |
-
}
|
195 |
-
|
196 |
-
function wp_insert_inthemeads_form_save_action($identifier) {
|
197 |
-
$inthemeads = get_option('wp_insert_inthemeads');
|
198 |
-
$inthemeads[$identifier]['identifier'] = ((isset($_POST['wp_insert_inthemeads_identifier']))?$_POST['wp_insert_inthemeads_identifier']:'');
|
199 |
-
$inthemeads[$identifier]['status'] = ((isset($_POST['wp_insert_inthemeads_'.$identifier.'_status']) && ($_POST['wp_insert_inthemeads_'.$identifier.'_status'] == 'true'))?'1':'');
|
200 |
-
|
201 |
-
$inthemeads[$identifier]['title'] = ((isset($_POST['wp_insert_inthemeads_'.$identifier.'_title']))?$_POST['wp_insert_inthemeads_'.$identifier.'_title']:'');
|
202 |
-
|
203 |
-
$inthemeads[$identifier]['primary_ad_code'] = ((isset($_POST['wp_insert_inthemeads_'.$identifier.'_primary_ad_code']))?$_POST['wp_insert_inthemeads_'.$identifier.'_primary_ad_code']:'');
|
204 |
-
$inthemeads[$identifier]['secondary_ad_code'] = ((isset($_POST['wp_insert_inthemeads_'.$identifier.'_secondary_ad_code']))?$_POST['wp_insert_inthemeads_'.$identifier.'_secondary_ad_code']:'');
|
205 |
-
$inthemeads[$identifier]['tertiary_ad_code'] = ((isset($_POST['wp_insert_inthemeads_'.$identifier.'_tertiary_ad_code']))?$_POST['wp_insert_inthemeads_'.$identifier.'_tertiary_ad_code']:'');
|
206 |
-
|
207 |
-
$inthemeads[$identifier]['rules_exclude_loggedin'] = ((isset($_POST['wp_insert_inthemeads_'.$identifier.'_rules_exclude_loggedin']))?$_POST['wp_insert_inthemeads_'.$identifier.'_rules_exclude_loggedin']:'');
|
208 |
-
$inthemeads[$identifier]['rules_exclude_mobile_devices'] = ((isset($_POST['wp_insert_inthemeads_'.$identifier.'_rules_exclude_mobile_devices']))?$_POST['wp_insert_inthemeads_'.$identifier.'_rules_exclude_mobile_devices']:'');
|
209 |
-
$inthemeads[$identifier]['rules_exclude_404'] = ((isset($_POST['wp_insert_inthemeads_'.$identifier.'_rules_exclude_404']))?$_POST['wp_insert_inthemeads_'.$identifier.'_rules_exclude_404']:'');
|
210 |
-
$inthemeads[$identifier]['rules_exclude_home'] = ((isset($_POST['wp_insert_inthemeads_'.$identifier.'_rules_exclude_home']))?$_POST['wp_insert_inthemeads_'.$identifier.'_rules_exclude_home']:'');
|
211 |
-
$inthemeads[$identifier]['rules_exclude_archives'] = ((isset($_POST['wp_insert_inthemeads_'.$identifier.'_rules_exclude_archives']))?$_POST['wp_insert_inthemeads_'.$identifier.'_rules_exclude_archives']:'');
|
212 |
-
$inthemeads[$identifier]['rules_exclude_search'] = ((isset($_POST['wp_insert_inthemeads_'.$identifier.'_rules_exclude_search']))?$_POST['wp_insert_inthemeads_'.$identifier.'_rules_exclude_search']:'');
|
213 |
-
$inthemeads[$identifier]['rules_exclude_page'] = ((isset($_POST['wp_insert_inthemeads_'.$identifier.'_rules_exclude_page']))?$_POST['wp_insert_inthemeads_'.$identifier.'_rules_exclude_page']:'');
|
214 |
-
$inthemeads[$identifier]['rules_page_exceptions'] = ((isset($_POST['wp_insert_inthemeads_'.$identifier.'_rules_page_exceptions']))?$_POST['wp_insert_inthemeads_'.$identifier.'_rules_page_exceptions']:'');
|
215 |
-
$inthemeads[$identifier]['rules_exclude_post'] = ((isset($_POST['wp_insert_inthemeads_'.$identifier.'_rules_exclude_post']))?$_POST['wp_insert_inthemeads_'.$identifier.'_rules_exclude_post']:'');
|
216 |
-
$inthemeads[$identifier]['rules_post_exceptions'] = ((isset($_POST['wp_insert_inthemeads_'.$identifier.'_rules_post_exceptions']))?$_POST['wp_insert_inthemeads_'.$identifier.'_rules_post_exceptions']:'');
|
217 |
-
$inthemeads[$identifier]['rules_post_categories_exceptions'] = ((isset($_POST['wp_insert_inthemeads_'.$identifier.'_rules_post_categories_exceptions']))?$_POST['wp_insert_inthemeads_'.$identifier.'_rules_post_categories_exceptions']:'');
|
218 |
-
$inthemeads[$identifier]['rules_exclude_categories'] = ((isset($_POST['wp_insert_inthemeads_'.$identifier.'_rules_exclude_categories']))?$_POST['wp_insert_inthemeads_'.$identifier.'_rules_exclude_categories']:'');
|
219 |
-
$inthemeads[$identifier]['rules_categories_exceptions'] = ((isset($_POST['wp_insert_inthemeads_'.$identifier.'_rules_categories_exceptions']))?$_POST['wp_insert_inthemeads_'.$identifier.'_rules_categories_exceptions']:'');
|
220 |
-
|
221 |
-
$inthemeads[$identifier]['geo_group1_countries'] = ((isset($_POST['wp_insert_inthemeads_'.$identifier.'_geo_group1_countries']))?$_POST['wp_insert_inthemeads_'.$identifier.'_geo_group1_countries']:'');
|
222 |
-
$inthemeads[$identifier]['geo_group1_adcode'] = ((isset($_POST['wp_insert_inthemeads_'.$identifier.'_geo_group1_adcode']))?$_POST['wp_insert_inthemeads_'.$identifier.'_geo_group1_adcode']:'');
|
223 |
-
$inthemeads[$identifier]['geo_group2_countries'] = ((isset($_POST['wp_insert_inthemeads_'.$identifier.'_geo_group2_countries']))?$_POST['wp_insert_inthemeads_'.$identifier.'_geo_group2_countries']:'');
|
224 |
-
$inthemeads[$identifier]['geo_group2_adcode'] = ((isset($_POST['wp_insert_inthemeads_'.$identifier.'_geo_group2_adcode']))?$_POST['wp_insert_inthemeads_'.$identifier.'_geo_group2_adcode']:'');
|
225 |
-
|
226 |
-
$inthemeads[$identifier]['styles'] = ((isset($_POST['wp_insert_inthemeads_'.$identifier.'_styles']))?$_POST['wp_insert_inthemeads_'.$identifier.'_styles']:'');
|
227 |
-
|
228 |
-
$inthemeads[$identifier]['notes'] = ((isset($_POST['wp_insert_inthemeads_'.$identifier.'_notes']))?$_POST['wp_insert_inthemeads_'.$identifier.'_notes']:'');
|
229 |
-
update_option('wp_insert_inthemeads', $inthemeads);
|
230 |
-
}
|
231 |
-
/* End Shared UI Functions */
|
232 |
-
|
233 |
-
/* Begin In-Theme Ad Insertion */
|
234 |
-
function wp_template_ad($identifier) { wp_intheme_ad('templateads-'.$identifier); }
|
235 |
-
function wp_intheme_ad($identifier) {
|
236 |
-
$inthemeads = get_option('wp_insert_inthemeads');
|
237 |
-
if(isset($inthemeads[$identifier]) && is_array($inthemeads[$identifier]) && wp_insert_get_ad_status($inthemeads[$identifier])) {
|
238 |
-
echo '<div class="wpInsert wpInsertTemplateTag"'.(($inthemeads[$identifier]['styles'] != '')?' style="'.$inthemeads[$identifier]['styles'].'"':'').'>'.wp_insert_get_geotargeted_adcode($inthemeads[$identifier]).'</div>';
|
239 |
-
}
|
240 |
-
}
|
241 |
-
/* End In-Theme Ad Insertion */
|
242 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/modules/inthemeads/js/module.js
DELETED
@@ -1,145 +0,0 @@
|
|
1 |
-
jQuery(document).ready(function() {
|
2 |
-
wp_insert_click_handler(
|
3 |
-
'wp_insert_inthemeads_new',
|
4 |
-
'In-Theme Ad : Add New',
|
5 |
-
jQuery("body").width() * 0.8,
|
6 |
-
jQuery("body").height() * 0.8,
|
7 |
-
function() {
|
8 |
-
jQuery('.wp_insert_inthemeads_status').parent().css({'display': 'inline-block', 'margin': '5px 0 0'}).prependTo('.ui-dialog-buttonpane');
|
9 |
-
},
|
10 |
-
function() {
|
11 |
-
var identifier = jQuery(".wp_insert_inthemeads_identifier").val();
|
12 |
-
var inthemeadLink = jQuery("<a></a>");
|
13 |
-
inthemeadLink.attr("id", "wp_insert_inthemeads_"+identifier);
|
14 |
-
inthemeadLink.attr("href", "javascript:;");
|
15 |
-
inthemeadLink.attr("onClick", "wp_insert_inthemeads_click_handler(\'"+identifier+"\', \'"+jQuery("#wp_insert_inthemeads_"+identifier+"_title").val()+"\')");
|
16 |
-
inthemeadLink.html("In-Theme Ad : "+jQuery("#wp_insert_inthemeads_"+identifier+"_title").val());
|
17 |
-
var deleteButton = jQuery("<span></span>");
|
18 |
-
deleteButton.attr("class", "dashicons dashicons-dismiss wp_insert_delete_icon");
|
19 |
-
deleteButton.attr("onClick", "wp_insert_inthemeads_remove(\'"+identifier+"\')");
|
20 |
-
jQuery("#wp_insert_inthemeads_new").parent().before(jQuery("<p></p>").append(inthemeadLink, deleteButton));
|
21 |
-
wp_insert_inthemeads_update(identifier);
|
22 |
-
},
|
23 |
-
function() { }
|
24 |
-
);
|
25 |
-
});
|
26 |
-
|
27 |
-
function wp_insert_inthemeads_click_handler(identifier, title) {
|
28 |
-
jQuery('<div id="wp_insert_inthemeads_'+identifier+'_dialog"></div>').html('<div class="wp_insert_ajaxloader"></div>').dialog({
|
29 |
-
'modal': true,
|
30 |
-
'resizable': false,
|
31 |
-
'width': jQuery("body").width() * 0.8,
|
32 |
-
'maxWidth': jQuery("body").width() * 0.8,
|
33 |
-
'maxHeight': jQuery("body").height() * 0.9,
|
34 |
-
'title': 'In-Theme Ad : '+title,
|
35 |
-
position: { my: 'center', at: 'center', of: window },
|
36 |
-
open: function (event, ui) {
|
37 |
-
jQuery('.ui-dialog').css({'z-index': 999999, 'max-width': '90%'});
|
38 |
-
jQuery('.ui-widget-overlay').css({'z-index': 999998, 'opacity': 0.8, 'background': '#000000'});
|
39 |
-
jQuery('.ui-dialog-buttonpane button:contains("Update")').button('disable');
|
40 |
-
jQuery.post(
|
41 |
-
jQuery('#wp_insert_admin_ajax').val(), {
|
42 |
-
'action': 'wp_insert_inthemeads_existing_form_get_content',
|
43 |
-
'wp_insert_inthemeads_identifier': identifier,
|
44 |
-
'wp_insert_nonce': jQuery('#wp_insert_nonce').val()
|
45 |
-
}, function(response) {
|
46 |
-
jQuery('.wp_insert_ajaxloader').hide();
|
47 |
-
jQuery('.ui-dialog-content').html(response);
|
48 |
-
jQuery('.ui-accordion .ui-accordion-content').css('max-height', (jQuery("body").height() * 0.45));
|
49 |
-
jQuery('.ui-dialog-buttonpane button:contains("Update")').button('enable');
|
50 |
-
jQuery('.wp_insert_inthemeads_status').parent().css({'display': 'inline-block', 'margin': '5px 0 0'}).prependTo('.ui-dialog-buttonpane');
|
51 |
-
jQuery('.ui-dialog').css({'position': 'fixed'});
|
52 |
-
jQuery('#wp_insert_inthemeads_'+identifier+'_dialog').delay(500).dialog({position: { my: 'center', at: 'center', of: window }});
|
53 |
-
}
|
54 |
-
);
|
55 |
-
},
|
56 |
-
buttons: {
|
57 |
-
'Update': function() {
|
58 |
-
jQuery("#wp_insert_inthemeads_"+identifier).html("In-Theme Ad : "+jQuery("#wp_insert_inthemeads_"+identifier+"_title").val());
|
59 |
-
jQuery("#wp_insert_inthemeads_"+identifier).attr("onClick", "wp_insert_inthemeads_click_handler(\'"+identifier+"\', \'"+jQuery("#wp_insert_inthemeads_"+identifier+"_title").val()+"\')");
|
60 |
-
wp_insert_inthemeads_update(identifier);
|
61 |
-
jQuery(this).dialog('close');
|
62 |
-
},
|
63 |
-
Cancel: function() {
|
64 |
-
jQuery(this).dialog('close');
|
65 |
-
}
|
66 |
-
},
|
67 |
-
close: function() {
|
68 |
-
jQuery(this).dialog('destroy');
|
69 |
-
}
|
70 |
-
});
|
71 |
-
}
|
72 |
-
|
73 |
-
function wp_insert_inthemeads_update(identifier) {
|
74 |
-
args = {};
|
75 |
-
args['action'] = 'wp_insert_inthemeads_existing_form_save_action';
|
76 |
-
args['wp_insert_nonce'] = jQuery('#wp_insert_nonce').val();
|
77 |
-
args['wp_insert_inthemeads_identifier'] = identifier;
|
78 |
-
args['wp_insert_inthemeads_'+identifier+'_status'] = jQuery('#wp_insert_inthemeads_'+identifier+'_status').prop('checked');
|
79 |
-
|
80 |
-
args['wp_insert_inthemeads_'+identifier+'_title'] = jQuery('#wp_insert_inthemeads_'+identifier+'_title').val();
|
81 |
-
|
82 |
-
args['wp_insert_inthemeads_'+identifier+'_primary_ad_code'] = jQuery('#wp_insert_inthemeads_'+identifier+'_primary_ad_code').val();
|
83 |
-
args['wp_insert_inthemeads_'+identifier+'_secondary_ad_code'] = jQuery('#wp_insert_inthemeads_'+identifier+'_secondary_ad_code').val();
|
84 |
-
args['wp_insert_inthemeads_'+identifier+'_tertiary_ad_code'] = jQuery('#wp_insert_inthemeads_'+identifier+'_tertiary_ad_code').val();
|
85 |
-
|
86 |
-
args['wp_insert_inthemeads_'+identifier+'_rules_exclude_loggedin'] = jQuery('#wp_insert_inthemeads_'+identifier+'_rules_exclude_loggedin').prop('checked');
|
87 |
-
args['wp_insert_inthemeads_'+identifier+'_rules_exclude_mobile_devices'] = jQuery('#wp_insert_inthemeads_'+identifier+'_rules_exclude_mobile_devices').prop('checked');
|
88 |
-
args['wp_insert_inthemeads_'+identifier+'_rules_exclude_404'] = jQuery('#wp_insert_inthemeads_'+identifier+'_rules_exclude_404').prop('checked');
|
89 |
-
args['wp_insert_inthemeads_'+identifier+'_rules_exclude_home'] = jQuery('#wp_insert_inthemeads_'+identifier+'_rules_exclude_home').prop('checked');
|
90 |
-
args['wp_insert_inthemeads_'+identifier+'_rules_exclude_archives'] = jQuery('#wp_insert_inthemeads_'+identifier+'_rules_exclude_archives').prop('checked');
|
91 |
-
args['wp_insert_inthemeads_'+identifier+'_rules_exclude_search'] = jQuery('#wp_insert_inthemeads_'+identifier+'_rules_exclude_search').prop('checked');
|
92 |
-
args['wp_insert_inthemeads_'+identifier+'_rules_exclude_page'] = jQuery('#wp_insert_inthemeads_'+identifier+'_rules_exclude_page').prop('checked');
|
93 |
-
args['wp_insert_inthemeads_'+identifier+'_rules_page_exceptions'] = jQuery.map(jQuery('#wp_insert_inthemeads_'+identifier+'_rules_page_exceptions :selected'), function(e) { return jQuery(e).val(); });
|
94 |
-
args['wp_insert_inthemeads_'+identifier+'_rules_exclude_post'] = jQuery('#wp_insert_inthemeads_'+identifier+'_rules_exclude_post').prop('checked');
|
95 |
-
args['wp_insert_inthemeads_'+identifier+'_rules_post_exceptions'] = jQuery.map(jQuery('#wp_insert_inthemeads_'+identifier+'_rules_post_exceptions :selected'), function(e) { return jQuery(e).val(); });
|
96 |
-
args['wp_insert_inthemeads_'+identifier+'_rules_post_categories_exceptions'] = jQuery.map(jQuery('#wp_insert_inthemeads_'+identifier+'_rules_post_categories_exceptions :selected'), function(e) { return jQuery(e).val(); });
|
97 |
-
args['wp_insert_inthemeads_'+identifier+'_rules_exclude_categories'] = jQuery('#wp_insert_inthemeads_'+identifier+'_rules_exclude_categories').prop('checked');
|
98 |
-
args['wp_insert_inthemeads_'+identifier+'_rules_categories_exceptions'] = jQuery.map(jQuery('#wp_insert_inthemeads_'+identifier+'_rules_categories_exceptions :selected'), function(e) { return jQuery(e).val(); });
|
99 |
-
|
100 |
-
args['wp_insert_inthemeads_'+identifier+'_geo_group1_countries'] = jQuery.map(jQuery('#wp_insert_inthemeads_'+identifier+'_geo_group1_countries :selected'), function(e) { return jQuery(e).val(); });
|
101 |
-
args['wp_insert_inthemeads_'+identifier+'_geo_group1_adcode'] = jQuery('#wp_insert_inthemeads_'+identifier+'_geo_group1_adcode').val();
|
102 |
-
args['wp_insert_inthemeads_'+identifier+'_geo_group2_countries'] = jQuery.map(jQuery('#wp_insert_inthemeads_'+identifier+'_geo_group2_countries :selected'), function(e) { return jQuery(e).val(); });
|
103 |
-
args['wp_insert_inthemeads_'+identifier+'_geo_group2_adcode'] = jQuery('#wp_insert_inthemeads_'+identifier+'_geo_group2_adcode').val();
|
104 |
-
|
105 |
-
args['wp_insert_inthemeads_'+identifier+'_styles'] = jQuery('#wp_insert_inthemeads_'+identifier+'_styles').val();
|
106 |
-
|
107 |
-
args['wp_insert_inthemeads_'+identifier+'_notes'] = jQuery('#wp_insert_inthemeads_'+identifier+'_notes').val();
|
108 |
-
|
109 |
-
jQuery.post(
|
110 |
-
jQuery('#wp_insert_admin_ajax').val(), args, function(response) { }
|
111 |
-
);
|
112 |
-
}
|
113 |
-
|
114 |
-
function wp_insert_inthemeads_remove(identifier) {
|
115 |
-
jQuery("<p>Are you Sure you want to remove this Ad Unit?</p>").dialog({
|
116 |
-
'modal': true,
|
117 |
-
'resizable': false,
|
118 |
-
'title': 'Deletion Confirmation',
|
119 |
-
position: { my: 'center', at: 'center', of: window },
|
120 |
-
open: function (event, ui) {
|
121 |
-
jQuery('.ui-dialog').css({'z-index': 999999, 'max-width': '90%'});
|
122 |
-
jQuery('.ui-widget-overlay').css({'z-index': 999998, 'opacity': 0.8, 'background': '#000000'});
|
123 |
-
},
|
124 |
-
buttons : {
|
125 |
-
'Confirm': function() {
|
126 |
-
jQuery("#wp_insert_inthemeads_"+identifier).parent().remove();
|
127 |
-
jQuery.post(
|
128 |
-
jQuery('#wp_insert_admin_ajax').val(), {
|
129 |
-
'action': 'wp_insert_inthemeads_remove',
|
130 |
-
'wp_insert_inthemeads_identifier': identifier,
|
131 |
-
'wp_insert_nonce': jQuery('#wp_insert_nonce').val()
|
132 |
-
}, function(response) {
|
133 |
-
}
|
134 |
-
);
|
135 |
-
jQuery(this).dialog("close");
|
136 |
-
},
|
137 |
-
'Cancel': function() {
|
138 |
-
jQuery(this).dialog("close");
|
139 |
-
}
|
140 |
-
},
|
141 |
-
close: function() {
|
142 |
-
jQuery(this).dialog('destroy');
|
143 |
-
}
|
144 |
-
});
|
145 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/modules/inthemeads/module.php
DELETED
@@ -1,41 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
require_once(dirname(__FILE__).'/functions.php');
|
3 |
-
|
4 |
-
/* Begin Add Assets */
|
5 |
-
/*add_action('wp_insert_modules_css', 'wp_insert_module_inthemeads_css', 0);
|
6 |
-
function wp_insert_module_inthemeads_css() {
|
7 |
-
wp_register_style('wp-insert-module-inthemeads-css', WP_INSERT_URL.'includes/modules/inthemeads/css/module.css', array('wp-insert-css'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
|
8 |
-
wp_enqueue_style('wp-insert-module-inthemeads-css');
|
9 |
-
}*/
|
10 |
-
|
11 |
-
add_action('wp_insert_modules_js', 'wp_insert_module_inthemeads_js', 0);
|
12 |
-
function wp_insert_module_inthemeads_js() {
|
13 |
-
wp_register_script('wp-insert-module-inthemeads-js', WP_INSERT_URL.'includes/modules/inthemeads/js/module.js', array('wp-insert-js'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
|
14 |
-
wp_enqueue_script('wp-insert-module-inthemeads-js');
|
15 |
-
}
|
16 |
-
/* End Add Assets */
|
17 |
-
|
18 |
-
/* Begin Add Card in Admin Panel */
|
19 |
-
add_action('wp_insert_plugin_card', 'wp_insert_inthemeads_plugin_card', 60);
|
20 |
-
function wp_insert_inthemeads_plugin_card() {
|
21 |
-
echo '<div class="plugin-card">';
|
22 |
-
echo '<div class="plugin-card-top">';
|
23 |
-
echo '<h4>In-Theme Ads</h4>';
|
24 |
-
echo '<p>Ads embedded directly inside theme files (Advanced Users Only).</p>';
|
25 |
-
echo '</div>';
|
26 |
-
echo '<div class="plugin-card-bottom">';
|
27 |
-
$inthemeads = get_option('wp_insert_inthemeads');
|
28 |
-
if(isset($inthemeads) && is_array($inthemeads)) {
|
29 |
-
foreach($inthemeads as $key => $value) {
|
30 |
-
echo '<p>';
|
31 |
-
echo '<a id="wp_insert_inthemeads_'.$key.'" href="javascript:;" onclick="wp_insert_inthemeads_click_handler(\''.$key.'\', \''.$value['title'].'\')">In-Theme Ad : '.$value['title'].'</a>';
|
32 |
-
echo '<span class="dashicons dashicons-dismiss wp_insert_delete_icon" onclick="wp_insert_inthemeads_remove(\''.$key.'\')"></span>';
|
33 |
-
echo '</p>';
|
34 |
-
}
|
35 |
-
}
|
36 |
-
echo '<p style="text-align: center; padding: 20px 0 10px;"><a id="wp_insert_inthemeads_new" href="#" class="button-secondary">Add New In-Theme Ad</a></p>';
|
37 |
-
echo '</div>';
|
38 |
-
echo '</div>';
|
39 |
-
}
|
40 |
-
/* End Add Card in Admin Panel */
|
41 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/modules/modules.php
DELETED
@@ -1,11 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
require_once(dirname(__FILE__).'/adstxt/module.php');
|
3 |
-
require_once(dirname(__FILE__).'/inpostads/module.php');
|
4 |
-
require_once(dirname(__FILE__).'/adwidgets/module.php');
|
5 |
-
require_once(dirname(__FILE__).'/shortcodeads/module.php');
|
6 |
-
require_once(dirname(__FILE__).'/inthemeads/module.php');
|
7 |
-
require_once(dirname(__FILE__).'/pagelevelads/module.php');
|
8 |
-
require_once(dirname(__FILE__).'/trackingcodes/module.php');
|
9 |
-
require_once(dirname(__FILE__).'/legalpages/module.php');
|
10 |
-
require_once(dirname(__FILE__).'/videointelligence/module.php');
|
11 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/modules/pagelevelads/functions.php
DELETED
@@ -1,239 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/* Begin Add New Page-Level Content */
|
3 |
-
add_action('wp_ajax_wp_insert_pagelevelads_new_form_get_content', 'wp_insert_pagelevelads_new_form_get_content');
|
4 |
-
function wp_insert_pagelevelads_new_form_get_content() {
|
5 |
-
check_ajax_referer('wp-insert', 'wp_insert_nonce');
|
6 |
-
wp_insert_pagelevelads_form_get_content(uniqid());
|
7 |
-
die();
|
8 |
-
}
|
9 |
-
/* End Add New Page-Level Content */
|
10 |
-
|
11 |
-
/* Begin Edit Page-Level Content */
|
12 |
-
add_action('wp_ajax_wp_insert_pagelevelads_existing_form_get_content', 'wp_insert_pagelevelads_existing_form_get_content');
|
13 |
-
function wp_insert_pagelevelads_existing_form_get_content() {
|
14 |
-
check_ajax_referer('wp-insert', 'wp_insert_nonce');
|
15 |
-
if(isset($_POST['wp_insert_pagelevelads_identifier'])) {
|
16 |
-
wp_insert_pagelevelads_form_get_content($_POST['wp_insert_pagelevelads_identifier']);
|
17 |
-
}
|
18 |
-
die();
|
19 |
-
}
|
20 |
-
|
21 |
-
add_action('wp_ajax_wp_insert_pagelevelads_existing_form_save_action', 'wp_insert_pagelevelads_existing_form_save_action');
|
22 |
-
function wp_insert_pagelevelads_existing_form_save_action() {
|
23 |
-
check_ajax_referer('wp-insert', 'wp_insert_nonce');
|
24 |
-
if(isset($_POST['wp_insert_pagelevelads_identifier'])) {
|
25 |
-
wp_insert_pagelevelads_form_save_action($_POST['wp_insert_pagelevelads_identifier']);
|
26 |
-
}
|
27 |
-
die();
|
28 |
-
}
|
29 |
-
/* End Edit Page-Level Content */
|
30 |
-
|
31 |
-
/* Begin Delete Page-Level Content */
|
32 |
-
add_action('wp_ajax_wp_insert_pagelevelads_remove', 'wp_insert_pagelevelads_remove');
|
33 |
-
function wp_insert_pagelevelads_remove() {
|
34 |
-
check_ajax_referer('wp-insert', 'wp_insert_nonce');
|
35 |
-
if(isset($_POST['wp_insert_pagelevelads_identifier'])) {
|
36 |
-
$pagelevelads = get_option('wp_insert_pagelevelads');
|
37 |
-
unset($pagelevelads[$_POST['wp_insert_pagelevelads_identifier']]);
|
38 |
-
update_option('wp_insert_pagelevelads', $pagelevelads);
|
39 |
-
}
|
40 |
-
die();
|
41 |
-
}
|
42 |
-
/* End Delete Page-Level Content */
|
43 |
-
|
44 |
-
/* Begin Shared UI Functions */
|
45 |
-
function wp_insert_pagelevelads_form_get_content($identifier) {
|
46 |
-
$pagelevelads = get_option('wp_insert_pagelevelads');
|
47 |
-
echo '<div class="wp_insert_popup_content_wrapper">';
|
48 |
-
$control = new smartlogixControls(array('optionIdentifier' => 'wp_insert_pagelevelads['.$identifier.']', 'values' => $pagelevelads[$identifier]));
|
49 |
-
$control->add_control(array('type' => 'ipCheckbox', 'className' => 'wp_insert_pagelevelads_status', 'optionName' => 'status'));
|
50 |
-
$control->add_control(array('type' => 'hidden', 'className' => 'wp_insert_pagelevelads_identifier', 'optionName' => 'identifier', 'value' => $identifier));
|
51 |
-
echo $control->HTML;
|
52 |
-
$control->clear_controls();
|
53 |
-
echo '<div id="wp_insert_pagelevelads_'.$identifier.'_accordion">';
|
54 |
-
echo '<h3>Ad Code</h3>';
|
55 |
-
echo '<div>';
|
56 |
-
$abtestingMode = get_option('wp_insert_abtesting_mode');
|
57 |
-
$control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'primary_ad_code'));
|
58 |
-
$control->create_section('Ad Code (Primary Network)');
|
59 |
-
echo $control->HTML;
|
60 |
-
$control->clear_controls();
|
61 |
-
|
62 |
-
$control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'secondary_ad_code'));
|
63 |
-
$control->create_section('Ad Code (Secondary Network)');
|
64 |
-
if($abtestingMode != '2' && $abtestingMode != '3') {
|
65 |
-
$control->set_HTML('<div style="display: none;">'.$control->HTML.'</div>');
|
66 |
-
}
|
67 |
-
echo $control->HTML;
|
68 |
-
$control->clear_controls();
|
69 |
-
|
70 |
-
$control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'tertiary_ad_code'));
|
71 |
-
$control->create_section('Ad Code (Tertiary Network)');
|
72 |
-
if($abtestingMode != '3') {
|
73 |
-
$control->set_HTML('<div style="display: none;">'.$control->HTML.'</div>');
|
74 |
-
}
|
75 |
-
echo $control->HTML;
|
76 |
-
$control->clear_controls();
|
77 |
-
echo '</div>';
|
78 |
-
echo '<h3>Rules</h3>';
|
79 |
-
echo '<div>';
|
80 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_loggedin'));
|
81 |
-
$control->create_section('Logged in Users');
|
82 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
|
83 |
-
echo $control->HTML;
|
84 |
-
$control->clear_controls();
|
85 |
-
|
86 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_mobile_devices'));
|
87 |
-
$control->create_section('Mobile Devices');
|
88 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
89 |
-
echo $control->HTML;
|
90 |
-
$control->clear_controls();
|
91 |
-
|
92 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_404'));
|
93 |
-
$control->create_section('404 Pages');
|
94 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
|
95 |
-
echo $control->HTML;
|
96 |
-
$control->clear_controls();
|
97 |
-
|
98 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_home'));
|
99 |
-
$control->create_section('Home');
|
100 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
101 |
-
echo $control->HTML;
|
102 |
-
$control->clear_controls();
|
103 |
-
|
104 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_archives'));
|
105 |
-
$control->create_section('Archives');
|
106 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
|
107 |
-
echo $control->HTML;
|
108 |
-
$control->clear_controls();
|
109 |
-
|
110 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_search'));
|
111 |
-
$control->create_section('Search Results');
|
112 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
113 |
-
echo $control->HTML;
|
114 |
-
$control->clear_controls();
|
115 |
-
|
116 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_page'));
|
117 |
-
$control->add_control(array('type' => 'pages-chosen-multiselect', 'label' => 'Exceptions', 'optionName' => 'rules_page_exceptions'));
|
118 |
-
$control->create_section('Single Pages');
|
119 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
|
120 |
-
echo $control->HTML;
|
121 |
-
$control->clear_controls();
|
122 |
-
|
123 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_categories'));
|
124 |
-
$control->add_control(array('type' => 'categories-chosen-multiselect', 'label' => 'Exceptions', 'optionName' => 'rules_categories_exceptions'));
|
125 |
-
$control->create_section('Category Archives');
|
126 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
127 |
-
echo $control->HTML;
|
128 |
-
$control->clear_controls();
|
129 |
-
|
130 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_post'));
|
131 |
-
$control->add_control(array('type' => 'posts-chosen-multiselect', 'label' => 'Exceptions', 'optionName' => 'rules_post_exceptions'));
|
132 |
-
$control->add_control(array('type' => 'categories-chosen-multiselect', 'label' => 'Category Exceptions', 'optionName' => 'rules_post_categories_exceptions'));
|
133 |
-
$control->create_section('Single Posts');
|
134 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
135 |
-
echo $control->HTML;
|
136 |
-
$control->clear_controls();
|
137 |
-
|
138 |
-
echo '</div>';
|
139 |
-
echo '<h3>Geo Targeting</h3>';
|
140 |
-
echo '<div>';
|
141 |
-
echo '<p>';
|
142 |
-
echo 'A Geo Targeted Ads have a higher priority than Ads configured via Multiple Ad Networks / A-B Testing.<br />';
|
143 |
-
echo 'If a Geo Targeting match is found all other Ads (Primary, Secondary and Tertiary Networks) will be ignored.';
|
144 |
-
echo '</p>';
|
145 |
-
$control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Countries', 'optionName' => 'geo_group1_countries', 'options' => wp_insert_get_countries()));
|
146 |
-
$control->add_control(array('type' => 'textarea', 'label' => 'Ad Code', 'style' => 'height: 220px;', 'optionName' => 'geo_group1_adcode'));
|
147 |
-
$control->create_section('Group 1');
|
148 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
|
149 |
-
echo $control->HTML;
|
150 |
-
$control->clear_controls();
|
151 |
-
|
152 |
-
$control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Countries', 'optionName' => 'geo_group2_countries', 'options' => wp_insert_get_countries()));
|
153 |
-
$control->add_control(array('type' => 'textarea', 'label' => 'Ad Code', 'style' => 'height: 220px;', 'optionName' => 'geo_group2_adcode'));
|
154 |
-
$control->create_section('Group 2');
|
155 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
156 |
-
echo $control->HTML;
|
157 |
-
$control->clear_controls();
|
158 |
-
echo '<p>';
|
159 |
-
echo 'This feature uses the Free Geo ip service from <a href="http://freegeoip.net/">freegeoip.net</a>, if you find this feature useful please consider donating to the project at <a href="http://freegeoip.net/">freegeoip.net</a>';
|
160 |
-
echo '</p>';
|
161 |
-
echo '</div>';
|
162 |
-
echo '<h3>Styles</h3>';
|
163 |
-
echo '<div>';
|
164 |
-
$control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'styles'));
|
165 |
-
$control->create_section('Styles');
|
166 |
-
echo $control->HTML;
|
167 |
-
$control->clear_controls();
|
168 |
-
echo '</div>';
|
169 |
-
echo '<h3>Notes</h3>';
|
170 |
-
echo '<div>';
|
171 |
-
$control->add_control(array('type' => 'text', 'optionName' => 'title', 'helpText' => 'The title is used to identify your Ad Widget easily in future. A Random Title will be assigned to your Ad widget by default.', 'value' => ((isset($pagelevelads[$identifier]['title']))?$pagelevelads[$identifier]['title']:$identifier)));
|
172 |
-
$control->create_section('Title');
|
173 |
-
echo $control->HTML;
|
174 |
-
$control->clear_controls();
|
175 |
-
|
176 |
-
$control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'notes'));
|
177 |
-
$control->create_section('Notes');
|
178 |
-
echo $control->HTML;
|
179 |
-
$control->clear_controls();
|
180 |
-
echo '</div>';
|
181 |
-
echo '</div>';
|
182 |
-
echo '<script type="text/javascript">';
|
183 |
-
echo $control->JS;
|
184 |
-
echo 'jQuery("#wp_insert_pagelevelads_'.$identifier.'_accordion").accordion({ icons: { header: "ui-icon-circle-arrow-e", activeHeader: "ui-icon-circle-arrow-s" }, heightStyle: "auto" });';
|
185 |
-
echo '</script>';
|
186 |
-
echo '</div>';
|
187 |
-
}
|
188 |
-
|
189 |
-
function wp_insert_pagelevelads_form_save_action($identifier) {
|
190 |
-
$pagelevelads = get_option('wp_insert_pagelevelads');
|
191 |
-
$pagelevelads[$identifier]['identifier'] = ((isset($_POST['wp_insert_pagelevelads_identifier']))?$_POST['wp_insert_pagelevelads_identifier']:'');
|
192 |
-
$pagelevelads[$identifier]['status'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_status']) && ($_POST['wp_insert_pagelevelads_'.$identifier.'_status'] == 'true'))?'1':'');
|
193 |
-
|
194 |
-
$pagelevelads[$identifier]['primary_ad_code'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_primary_ad_code']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_primary_ad_code']:'');
|
195 |
-
$pagelevelads[$identifier]['secondary_ad_code'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_secondary_ad_code']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_secondary_ad_code']:'');
|
196 |
-
$pagelevelads[$identifier]['tertiary_ad_code'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_tertiary_ad_code']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_tertiary_ad_code']:'');
|
197 |
-
|
198 |
-
$pagelevelads[$identifier]['rules_exclude_loggedin'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_rules_exclude_loggedin']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_rules_exclude_loggedin']:'');
|
199 |
-
$pagelevelads[$identifier]['rules_exclude_mobile_devices'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_rules_exclude_mobile_devices']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_rules_exclude_mobile_devices']:'');
|
200 |
-
$pagelevelads[$identifier]['rules_exclude_404'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_rules_exclude_404']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_rules_exclude_404']:'');
|
201 |
-
$pagelevelads[$identifier]['rules_exclude_home'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_rules_exclude_home']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_rules_exclude_home']:'');
|
202 |
-
$pagelevelads[$identifier]['rules_exclude_archives'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_rules_exclude_archives']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_rules_exclude_archives']:'');
|
203 |
-
$pagelevelads[$identifier]['rules_exclude_search'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_rules_exclude_search']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_rules_exclude_search']:'');
|
204 |
-
$pagelevelads[$identifier]['rules_exclude_page'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_rules_exclude_page']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_rules_exclude_page']:'');
|
205 |
-
$pagelevelads[$identifier]['rules_page_exceptions'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_rules_page_exceptions']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_rules_page_exceptions']:'');
|
206 |
-
$pagelevelads[$identifier]['rules_exclude_post'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_rules_exclude_post']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_rules_exclude_post']:'');
|
207 |
-
$pagelevelads[$identifier]['rules_post_exceptions'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_rules_post_exceptions']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_rules_post_exceptions']:'');
|
208 |
-
$pagelevelads[$identifier]['rules_post_categories_exceptions'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_rules_post_categories_exceptions']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_rules_post_categories_exceptions']:'');
|
209 |
-
$pagelevelads[$identifier]['rules_exclude_categories'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_rules_exclude_categories']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_rules_exclude_categories']:'');
|
210 |
-
$pagelevelads[$identifier]['rules_categories_exceptions'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_rules_categories_exceptions']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_rules_categories_exceptions']:'');
|
211 |
-
|
212 |
-
$pagelevelads[$identifier]['geo_group1_countries'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_geo_group1_countries']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_geo_group1_countries']:'');
|
213 |
-
$pagelevelads[$identifier]['geo_group1_adcode'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_geo_group1_adcode']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_geo_group1_adcode']:'');
|
214 |
-
$pagelevelads[$identifier]['geo_group2_countries'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_geo_group2_countries']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_geo_group2_countries']:'');
|
215 |
-
$pagelevelads[$identifier]['geo_group2_adcode'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_geo_group2_adcode']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_geo_group2_adcode']:'');
|
216 |
-
|
217 |
-
$pagelevelads[$identifier]['styles'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_styles']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_styles']:'');
|
218 |
-
|
219 |
-
$pagelevelads[$identifier]['title'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_title']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_title']:'');
|
220 |
-
$pagelevelads[$identifier]['notes'] = ((isset($_POST['wp_insert_pagelevelads_'.$identifier.'_notes']))?$_POST['wp_insert_pagelevelads_'.$identifier.'_notes']:'');
|
221 |
-
|
222 |
-
update_option('wp_insert_pagelevelads', $pagelevelads);
|
223 |
-
}
|
224 |
-
/* End Shared UI Functions */
|
225 |
-
|
226 |
-
/* Begin Page-Level Ad Insertion */
|
227 |
-
add_action('wp_head', 'wp_insert_pagelevelads_wp_head');
|
228 |
-
function wp_insert_pagelevelads_wp_head() {
|
229 |
-
$pagelevelads = get_option('wp_insert_pagelevelads');
|
230 |
-
if(isset($pagelevelads) && is_array($pagelevelads)) {
|
231 |
-
foreach($pagelevelads as $pagelevelad) {
|
232 |
-
if(isset($pagelevelad) && is_array($pagelevelad) && wp_insert_get_ad_status($pagelevelad)) {
|
233 |
-
echo '<div class="wpInsert wpInsertTemplateTag"'.(($pagelevelad['styles'] != '')?' style="'.$pagelevelad['styles'].'"':'').'>'.wp_insert_get_geotargeted_adcode($pagelevelad).'</div>';
|
234 |
-
}
|
235 |
-
}
|
236 |
-
}
|
237 |
-
}
|
238 |
-
/* End Page-Level Ad Insertion */
|
239 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/modules/pagelevelads/js/module.js
DELETED
@@ -1,145 +0,0 @@
|
|
1 |
-
jQuery(document).ready(function() {
|
2 |
-
wp_insert_click_handler(
|
3 |
-
'wp_insert_pagelevelads_new',
|
4 |
-
'Page-Level Ad : Add New',
|
5 |
-
jQuery("body").width() * 0.8,
|
6 |
-
jQuery("body").height() * 0.8,
|
7 |
-
function() {
|
8 |
-
jQuery('.wp_insert_pagelevelads_status').parent().css({'display': 'inline-block', 'margin': '5px 0 0'}).prependTo('.ui-dialog-buttonpane');
|
9 |
-
},
|
10 |
-
function() {
|
11 |
-
var identifier = jQuery(".wp_insert_pagelevelads_identifier").val();
|
12 |
-
var pageleveladLink = jQuery("<a></a>");
|
13 |
-
pageleveladLink.attr("id", "wp_insert_pagelevelads_"+identifier);
|
14 |
-
pageleveladLink.attr("href", "javascript:;");
|
15 |
-
pageleveladLink.attr("onClick", "wp_insert_pagelevelads_click_handler(\'"+identifier+"\', \'"+jQuery("#wp_insert_pagelevelads_"+identifier+"_title").val()+"\')");
|
16 |
-
pageleveladLink.html("Page-Level Ad : "+jQuery("#wp_insert_pagelevelads_"+identifier+"_title").val());
|
17 |
-
var deleteButton = jQuery("<span></span>");
|
18 |
-
deleteButton.attr("class", "dashicons dashicons-dismiss wp_insert_delete_icon");
|
19 |
-
deleteButton.attr("onClick", "wp_insert_pagelevelads_remove(\'"+identifier+"\')");
|
20 |
-
jQuery("#wp_insert_pagelevelads_new").parent().before(jQuery("<p></p>").append(pageleveladLink, deleteButton));
|
21 |
-
wp_insert_pagelevelads_update(identifier);
|
22 |
-
},
|
23 |
-
function() { }
|
24 |
-
);
|
25 |
-
});
|
26 |
-
|
27 |
-
function wp_insert_pagelevelads_click_handler(identifier, title) {
|
28 |
-
jQuery('<div id="wp_insert_pagelevelads_'+identifier+'_dialog"></div>').html('<div class="wp_insert_ajaxloader"></div>').dialog({
|
29 |
-
'modal': true,
|
30 |
-
'resizable': false,
|
31 |
-
'width': jQuery("body").width() * 0.8,
|
32 |
-
'maxWidth': jQuery("body").width() * 0.8,
|
33 |
-
'maxHeight': jQuery("body").height() * 0.9,
|
34 |
-
'title': 'Page-Level Ad : '+title,
|
35 |
-
position: { my: 'center', at: 'center', of: window },
|
36 |
-
open: function (event, ui) {
|
37 |
-
jQuery('.ui-dialog').css({'z-index': 999999, 'max-width': '90%'});
|
38 |
-
jQuery('.ui-widget-overlay').css({'z-index': 999998, 'opacity': 0.8, 'background': '#000000'});
|
39 |
-
jQuery('.ui-dialog-buttonpane button:contains("Update")').button('disable');
|
40 |
-
jQuery.post(
|
41 |
-
jQuery('#wp_insert_admin_ajax').val(), {
|
42 |
-
'action': 'wp_insert_pagelevelads_existing_form_get_content',
|
43 |
-
'wp_insert_pagelevelads_identifier': identifier,
|
44 |
-
'wp_insert_nonce': jQuery('#wp_insert_nonce').val()
|
45 |
-
}, function(response) {
|
46 |
-
jQuery('.wp_insert_ajaxloader').hide();
|
47 |
-
jQuery('.ui-dialog-content').html(response);
|
48 |
-
jQuery('.ui-accordion .ui-accordion-content').css('max-height', (jQuery("body").height() * 0.45));
|
49 |
-
jQuery('.ui-dialog-buttonpane button:contains("Update")').button('enable');
|
50 |
-
jQuery('.wp_insert_pagelevelads_status').parent().css({'display': 'inline-block', 'margin': '5px 0 0'}).prependTo('.ui-dialog-buttonpane');
|
51 |
-
jQuery('.ui-dialog').css({'position': 'fixed'});
|
52 |
-
jQuery('#wp_insert_pagelevelads_'+identifier+'_dialog').delay(500).dialog({position: { my: 'center', at: 'center', of: window }});
|
53 |
-
}
|
54 |
-
);
|
55 |
-
},
|
56 |
-
buttons: {
|
57 |
-
'Update': function() {
|
58 |
-
jQuery("#wp_insert_pagelevelads_"+identifier).html("Page-Level Ad : "+jQuery("#wp_insert_pagelevelads_"+identifier+"_title").val());
|
59 |
-
jQuery("#wp_insert_pagelevelads_"+identifier).attr("onClick", "wp_insert_pagelevelads_click_handler(\'"+identifier+"\', \'"+jQuery("#wp_insert_pagelevelads_"+identifier+"_title").val()+"\')");
|
60 |
-
wp_insert_pagelevelads_update(identifier);
|
61 |
-
jQuery(this).dialog('close');
|
62 |
-
},
|
63 |
-
Cancel: function() {
|
64 |
-
jQuery(this).dialog('close');
|
65 |
-
}
|
66 |
-
},
|
67 |
-
close: function() {
|
68 |
-
jQuery(this).dialog('destroy');
|
69 |
-
}
|
70 |
-
});
|
71 |
-
}
|
72 |
-
|
73 |
-
function wp_insert_pagelevelads_update(identifier) {
|
74 |
-
args = {};
|
75 |
-
args['action'] = 'wp_insert_pagelevelads_existing_form_save_action';
|
76 |
-
args['wp_insert_nonce'] = jQuery('#wp_insert_nonce').val();
|
77 |
-
args['wp_insert_pagelevelads_identifier'] = identifier;
|
78 |
-
args['wp_insert_pagelevelads_'+identifier+'_status'] = jQuery('#wp_insert_pagelevelads_'+identifier+'_status').prop('checked');
|
79 |
-
|
80 |
-
args['wp_insert_pagelevelads_'+identifier+'_title'] = jQuery('#wp_insert_pagelevelads_'+identifier+'_title').val();
|
81 |
-
|
82 |
-
args['wp_insert_pagelevelads_'+identifier+'_primary_ad_code'] = jQuery('#wp_insert_pagelevelads_'+identifier+'_primary_ad_code').val();
|
83 |
-
args['wp_insert_pagelevelads_'+identifier+'_secondary_ad_code'] = jQuery('#wp_insert_pagelevelads_'+identifier+'_secondary_ad_code').val();
|
84 |
-
args['wp_insert_pagelevelads_'+identifier+'_tertiary_ad_code'] = jQuery('#wp_insert_pagelevelads_'+identifier+'_tertiary_ad_code').val();
|
85 |
-
|
86 |
-
args['wp_insert_pagelevelads_'+identifier+'_rules_exclude_loggedin'] = jQuery('#wp_insert_pagelevelads_'+identifier+'_rules_exclude_loggedin').prop('checked');
|
87 |
-
args['wp_insert_pagelevelads_'+identifier+'_rules_exclude_mobile_devices'] = jQuery('#wp_insert_pagelevelads_'+identifier+'_rules_exclude_mobile_devices').prop('checked');
|
88 |
-
args['wp_insert_pagelevelads_'+identifier+'_rules_exclude_404'] = jQuery('#wp_insert_pagelevelads_'+identifier+'_rules_exclude_404').prop('checked');
|
89 |
-
args['wp_insert_pagelevelads_'+identifier+'_rules_exclude_home'] = jQuery('#wp_insert_pagelevelads_'+identifier+'_rules_exclude_home').prop('checked');
|
90 |
-
args['wp_insert_pagelevelads_'+identifier+'_rules_exclude_archives'] = jQuery('#wp_insert_pagelevelads_'+identifier+'_rules_exclude_archives').prop('checked');
|
91 |
-
args['wp_insert_pagelevelads_'+identifier+'_rules_exclude_search'] = jQuery('#wp_insert_pagelevelads_'+identifier+'_rules_exclude_search').prop('checked');
|
92 |
-
args['wp_insert_pagelevelads_'+identifier+'_rules_exclude_page'] = jQuery('#wp_insert_pagelevelads_'+identifier+'_rules_exclude_page').prop('checked');
|
93 |
-
args['wp_insert_pagelevelads_'+identifier+'_rules_page_exceptions'] = jQuery.map(jQuery('#wp_insert_pagelevelads_'+identifier+'_rules_page_exceptions :selected'), function(e) { return jQuery(e).val(); });
|
94 |
-
args['wp_insert_pagelevelads_'+identifier+'_rules_exclude_post'] = jQuery('#wp_insert_pagelevelads_'+identifier+'_rules_exclude_post').prop('checked');
|
95 |
-
args['wp_insert_pagelevelads_'+identifier+'_rules_post_exceptions'] = jQuery.map(jQuery('#wp_insert_pagelevelads_'+identifier+'_rules_post_exceptions :selected'), function(e) { return jQuery(e).val(); });
|
96 |
-
args['wp_insert_pagelevelads_'+identifier+'_rules_post_categories_exceptions'] = jQuery.map(jQuery('#wp_insert_pagelevelads_'+identifier+'_rules_post_categories_exceptions :selected'), function(e) { return jQuery(e).val(); });
|
97 |
-
args['wp_insert_pagelevelads_'+identifier+'_rules_exclude_categories'] = jQuery('#wp_insert_pagelevelads_'+identifier+'_rules_exclude_categories').prop('checked');
|
98 |
-
args['wp_insert_pagelevelads_'+identifier+'_rules_categories_exceptions'] = jQuery.map(jQuery('#wp_insert_pagelevelads_'+identifier+'_rules_categories_exceptions :selected'), function(e) { return jQuery(e).val(); });
|
99 |
-
|
100 |
-
args['wp_insert_pagelevelads_'+identifier+'_geo_group1_countries'] = jQuery.map(jQuery('#wp_insert_pagelevelads_'+identifier+'_geo_group1_countries :selected'), function(e) { return jQuery(e).val(); });
|
101 |
-
args['wp_insert_pagelevelads_'+identifier+'_geo_group1_adcode'] = jQuery('#wp_insert_pagelevelads_'+identifier+'_geo_group1_adcode').val();
|
102 |
-
args['wp_insert_pagelevelads_'+identifier+'_geo_group2_countries'] = jQuery.map(jQuery('#wp_insert_pagelevelads_'+identifier+'_geo_group2_countries :selected'), function(e) { return jQuery(e).val(); });
|
103 |
-
args['wp_insert_pagelevelads_'+identifier+'_geo_group2_adcode'] = jQuery('#wp_insert_pagelevelads_'+identifier+'_geo_group2_adcode').val();
|
104 |
-
|
105 |
-
args['wp_insert_pagelevelads_'+identifier+'_styles'] = jQuery('#wp_insert_pagelevelads_'+identifier+'_styles').val();
|
106 |
-
|
107 |
-
args['wp_insert_pagelevelads_'+identifier+'_notes'] = jQuery('#wp_insert_pagelevelads_'+identifier+'_notes').val();
|
108 |
-
|
109 |
-
jQuery.post(
|
110 |
-
jQuery('#wp_insert_admin_ajax').val(), args, function(response) { }
|
111 |
-
);
|
112 |
-
}
|
113 |
-
|
114 |
-
function wp_insert_pagelevelads_remove(identifier) {
|
115 |
-
jQuery("<p>Are you Sure you want to remove this Ad Unit?</p>").dialog({
|
116 |
-
'modal': true,
|
117 |
-
'resizable': false,
|
118 |
-
'title': 'Deletion Confirmation',
|
119 |
-
position: { my: 'center', at: 'center', of: window },
|
120 |
-
open: function (event, ui) {
|
121 |
-
jQuery('.ui-dialog').css({'z-index': 999999, 'max-width': '90%'});
|
122 |
-
jQuery('.ui-widget-overlay').css({'z-index': 999998, 'opacity': 0.8, 'background': '#000000'});
|
123 |
-
},
|
124 |
-
buttons : {
|
125 |
-
'Confirm': function() {
|
126 |
-
jQuery("#wp_insert_pagelevelads_"+identifier).parent().remove();
|
127 |
-
jQuery.post(
|
128 |
-
jQuery('#wp_insert_admin_ajax').val(), {
|
129 |
-
'action': 'wp_insert_pagelevelads_remove',
|
130 |
-
'wp_insert_pagelevelads_identifier': identifier,
|
131 |
-
'wp_insert_nonce': jQuery('#wp_insert_nonce').val()
|
132 |
-
}, function(response) {
|
133 |
-
}
|
134 |
-
);
|
135 |
-
jQuery(this).dialog("close");
|
136 |
-
},
|
137 |
-
'Cancel': function() {
|
138 |
-
jQuery(this).dialog("close");
|
139 |
-
}
|
140 |
-
},
|
141 |
-
close: function() {
|
142 |
-
jQuery(this).dialog('destroy');
|
143 |
-
}
|
144 |
-
});
|
145 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/modules/pagelevelads/module.php
DELETED
@@ -1,41 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
require_once(dirname(__FILE__).'/functions.php');
|
3 |
-
|
4 |
-
/* Begin Add Assets */
|
5 |
-
/*add_action('wp_insert_modules_css', 'wp_insert_module_pagelevelads_css', 0);
|
6 |
-
function wp_insert_module_pagelevelads_css() {
|
7 |
-
wp_register_style('wp-insert-module-pagelevelads-css', WP_INSERT_URL.'includes/modules/pagelevelads/css/module.css', array('wp-insert-css'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
|
8 |
-
wp_enqueue_style('wp-insert-module-pagelevelads-css');
|
9 |
-
}*/
|
10 |
-
|
11 |
-
add_action('wp_insert_modules_js', 'wp_insert_module_pagelevelads_js', 0);
|
12 |
-
function wp_insert_module_pagelevelads_js() {
|
13 |
-
wp_register_script('wp-insert-module-pagelevelads-js', WP_INSERT_URL.'includes/modules/pagelevelads/js/module.js', array('wp-insert-js'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
|
14 |
-
wp_enqueue_script('wp-insert-module-pagelevelads-js');
|
15 |
-
}
|
16 |
-
/* End Add Assets */
|
17 |
-
|
18 |
-
/* Begin Add Card in Admin Panel */
|
19 |
-
add_action('wp_insert_plugin_card', 'wp_insert_pagelevelads_plugin_card', 20);
|
20 |
-
function wp_insert_pagelevelads_plugin_card() {
|
21 |
-
echo '<div class="plugin-card">';
|
22 |
-
echo '<div class="plugin-card-top">';
|
23 |
-
echo '<h4>Page-level Ads</h4>';
|
24 |
-
echo '<p>Adsense Page-level ads are shown on your site only at optimal times.<br />Google Provides a testing tool in adsense portal for webadmins to test your Adsense Page-Level Ads.</p>';
|
25 |
-
echo '</div>';
|
26 |
-
echo '<div class="plugin-card-bottom">';
|
27 |
-
$pagelevelads = get_option('wp_insert_pagelevelads');
|
28 |
-
if(isset($pagelevelads) && is_array($pagelevelads)) {
|
29 |
-
foreach($pagelevelads as $key => $value) {
|
30 |
-
echo '<p>';
|
31 |
-
echo '<a id="wp_insert_pagelevelads_'.$key.'" href="javascript:;" onclick="wp_insert_pagelevelads_click_handler(\''.$key.'\', \''.$value['title'].'\')">Page-Level Ad : '.$value['title'].'</a>';
|
32 |
-
echo '<span class="dashicons dashicons-dismiss wp_insert_delete_icon" onclick="wp_insert_pagelevelads_remove(\''.$key.'\')"></span>';
|
33 |
-
echo '</p>';
|
34 |
-
}
|
35 |
-
}
|
36 |
-
echo '<p style="text-align: center; padding: 20px 0 10px;"><a id="wp_insert_pagelevelads_new" href="#" class="button-secondary">Add New Page-Level Ad</a></p>';
|
37 |
-
echo '</div>';
|
38 |
-
echo '</div>';
|
39 |
-
}
|
40 |
-
/* End Add Card in Admin Panel */
|
41 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/modules/shortcodeads/functions.php
DELETED
@@ -1,242 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
/* Begin Add New Shortcode Content */
|
3 |
-
add_action('wp_ajax_wp_insert_shortcodeads_new_form_get_content', 'wp_insert_shortcodeads_new_form_get_content');
|
4 |
-
function wp_insert_shortcodeads_new_form_get_content() {
|
5 |
-
check_ajax_referer('wp-insert', 'wp_insert_nonce');
|
6 |
-
wp_insert_shortcodeads_form_get_content(uniqid());
|
7 |
-
die();
|
8 |
-
}
|
9 |
-
/* End Add New Shortcode Content */
|
10 |
-
|
11 |
-
/* Begin Edit Shortcode Content */
|
12 |
-
add_action('wp_ajax_wp_insert_shortcodeads_existing_form_get_content', 'wp_insert_shortcodeads_existing_form_get_content');
|
13 |
-
function wp_insert_shortcodeads_existing_form_get_content() {
|
14 |
-
check_ajax_referer('wp-insert', 'wp_insert_nonce');
|
15 |
-
if(isset($_POST['wp_insert_shortcodeads_identifier'])) {
|
16 |
-
wp_insert_shortcodeads_form_get_content($_POST['wp_insert_shortcodeads_identifier']);
|
17 |
-
}
|
18 |
-
die();
|
19 |
-
}
|
20 |
-
|
21 |
-
add_action('wp_ajax_wp_insert_shortcodeads_existing_form_save_action', 'wp_insert_shortcodeads_existing_form_save_action');
|
22 |
-
function wp_insert_shortcodeads_existing_form_save_action() {
|
23 |
-
check_ajax_referer('wp-insert', 'wp_insert_nonce');
|
24 |
-
if(isset($_POST['wp_insert_shortcodeads_identifier'])) {
|
25 |
-
wp_insert_shortcodeads_form_save_action($_POST['wp_insert_shortcodeads_identifier']);
|
26 |
-
}
|
27 |
-
die();
|
28 |
-
}
|
29 |
-
/* End Edit Shortcode Content */
|
30 |
-
|
31 |
-
/* Begin Delete Shortcode Content */
|
32 |
-
add_action('wp_ajax_wp_insert_shortcodeads_remove', 'wp_insert_shortcodeads_remove');
|
33 |
-
function wp_insert_shortcodeads_remove() {
|
34 |
-
check_ajax_referer('wp-insert', 'wp_insert_nonce');
|
35 |
-
if(isset($_POST['wp_insert_shortcodeads_identifier'])) {
|
36 |
-
$shortcodeads = get_option('wp_insert_shortcodeads');
|
37 |
-
unset($shortcodeads[$_POST['wp_insert_shortcodeads_identifier']]);
|
38 |
-
update_option('wp_insert_shortcodeads', $shortcodeads);
|
39 |
-
}
|
40 |
-
die();
|
41 |
-
}
|
42 |
-
/* End Delete Shortcode Content */
|
43 |
-
|
44 |
-
/* Begin Shared UI Functions */
|
45 |
-
function wp_insert_shortcodeads_form_get_content($identifier) {
|
46 |
-
$shortcodeads = get_option('wp_insert_shortcodeads');
|
47 |
-
echo '<div class="wp_insert_popup_content_wrapper">';
|
48 |
-
$control = new smartlogixControls(array('optionIdentifier' => 'wp_insert_shortcodeads['.$identifier.']', 'values' => $shortcodeads[$identifier]));
|
49 |
-
$control->add_control(array('type' => 'ipCheckbox', 'className' => 'wp_insert_shortcodeads_status', 'optionName' => 'status'));
|
50 |
-
$control->add_control(array('type' => 'hidden', 'className' => 'wp_insert_shortcodeads_identifier', 'optionName' => 'identifier', 'value' => $identifier));
|
51 |
-
echo $control->HTML;
|
52 |
-
$control->clear_controls();
|
53 |
-
echo '<div id="wp_insert_shortcodeads_'.$identifier.'_accordion">';
|
54 |
-
echo '<h3>Shortcode</h3>';
|
55 |
-
echo '<div>';
|
56 |
-
$control->set_HTML('<p class="codeSnippet"><code>[wpshortcodead id="'.$identifier.'"]</code></p>');
|
57 |
-
$control->create_section('Code to add to your post/page content');
|
58 |
-
echo $control->HTML;
|
59 |
-
$control->clear_controls();
|
60 |
-
echo '</div>';
|
61 |
-
echo '<h3>Ad Code</h3>';
|
62 |
-
echo '<div>';
|
63 |
-
$abtestingMode = get_option('wp_insert_abtesting_mode');
|
64 |
-
$control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'primary_ad_code'));
|
65 |
-
$control->create_section('Ad Code (Primary Network)');
|
66 |
-
echo $control->HTML;
|
67 |
-
$control->clear_controls();
|
68 |
-
|
69 |
-
$control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'secondary_ad_code'));
|
70 |
-
$control->create_section('Ad Code (Secondary Network)');
|
71 |
-
if($abtestingMode != '2' && $abtestingMode != '3') {
|
72 |
-
$control->set_HTML('<div style="display: none;">'.$control->HTML.'</div>');
|
73 |
-
}
|
74 |
-
echo $control->HTML;
|
75 |
-
$control->clear_controls();
|
76 |
-
|
77 |
-
$control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'tertiary_ad_code'));
|
78 |
-
$control->create_section('Ad Code (Tertiary Network)');
|
79 |
-
if($abtestingMode != '3') {
|
80 |
-
$control->set_HTML('<div style="display: none;">'.$control->HTML.'</div>');
|
81 |
-
}
|
82 |
-
echo $control->HTML;
|
83 |
-
$control->clear_controls();
|
84 |
-
echo '</div>';
|
85 |
-
echo '<h3>Rules</h3>';
|
86 |
-
echo '<div>';
|
87 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_loggedin'));
|
88 |
-
$control->create_section('Logged in Users');
|
89 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
|
90 |
-
echo $control->HTML;
|
91 |
-
$control->clear_controls();
|
92 |
-
|
93 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_mobile_devices'));
|
94 |
-
$control->create_section('Mobile Devices');
|
95 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
96 |
-
echo $control->HTML;
|
97 |
-
$control->clear_controls();
|
98 |
-
|
99 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_404'));
|
100 |
-
$control->create_section('404 Pages');
|
101 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
|
102 |
-
echo $control->HTML;
|
103 |
-
$control->clear_controls();
|
104 |
-
|
105 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_home'));
|
106 |
-
$control->create_section('Home');
|
107 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
108 |
-
echo $control->HTML;
|
109 |
-
$control->clear_controls();
|
110 |
-
|
111 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_archives'));
|
112 |
-
$control->create_section('Archives');
|
113 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
|
114 |
-
echo $control->HTML;
|
115 |
-
$control->clear_controls();
|
116 |
-
|
117 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_search'));
|
118 |
-
$control->create_section('Search Results');
|
119 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
120 |
-
echo $control->HTML;
|
121 |
-
$control->clear_controls();
|
122 |
-
|
123 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_page'));
|
124 |
-
$control->create_section('Single Pages');
|
125 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
|
126 |
-
echo $control->HTML;
|
127 |
-
$control->clear_controls();
|
128 |
-
|
129 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_post'));
|
130 |
-
$control->create_section('Single Posts');
|
131 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
132 |
-
echo $control->HTML;
|
133 |
-
$control->clear_controls();
|
134 |
-
|
135 |
-
$control->add_control(array('type' => 'checkbox-button', 'label' => 'Status : Show Ads', 'checkedLabel' => 'Status : Hide Ads', 'uncheckedLabel' => 'Status : Show Ads', 'optionName' => 'rules_exclude_categories'));
|
136 |
-
$control->add_control(array('type' => 'categories-chosen-multiselect', 'label' => 'Exceptions', 'optionName' => 'rules_categories_exceptions'));
|
137 |
-
$control->create_section('Category Archives');
|
138 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
139 |
-
echo $control->HTML;
|
140 |
-
$control->clear_controls();
|
141 |
-
|
142 |
-
echo '</div>';
|
143 |
-
echo '<h3>Geo Targeting</h3>';
|
144 |
-
echo '<div>';
|
145 |
-
echo '<p>';
|
146 |
-
echo 'A Geo Targeted Ads have a higher priority than Ads configured via Multiple Ad Networks / A-B Testing.<br />';
|
147 |
-
echo 'If a Geo Targeting match is found all other Ads (Primary, Secondary and Tertiary Networks) will be ignored.';
|
148 |
-
echo '</p>';
|
149 |
-
$control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Countries', 'optionName' => 'geo_group1_countries', 'options' => wp_insert_get_countries()));
|
150 |
-
$control->add_control(array('type' => 'textarea', 'label' => 'Ad Code', 'style' => 'height: 220px;', 'optionName' => 'geo_group1_adcode'));
|
151 |
-
$control->create_section('Group 1');
|
152 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div>');
|
153 |
-
echo $control->HTML;
|
154 |
-
$control->clear_controls();
|
155 |
-
|
156 |
-
$control->add_control(array('type' => 'choosen-multiselect', 'label' => 'Countries', 'optionName' => 'geo_group2_countries', 'options' => wp_insert_get_countries()));
|
157 |
-
$control->add_control(array('type' => 'textarea', 'label' => 'Ad Code', 'style' => 'height: 220px;', 'optionName' => 'geo_group2_adcode'));
|
158 |
-
$control->create_section('Group 2');
|
159 |
-
$control->set_HTML('<div class="wp_insert_rule_block">'.$control->HTML.'</div><div style="clear: both;"></div>');
|
160 |
-
echo $control->HTML;
|
161 |
-
$control->clear_controls();
|
162 |
-
echo '<p>';
|
163 |
-
echo 'This feature uses the Free Geo ip service from <a href="http://freegeoip.net/">freegeoip.net</a>, if you find this feature useful please consider donating to the project at <a href="http://freegeoip.net/">freegeoip.net</a>';
|
164 |
-
echo '</p>';
|
165 |
-
echo '</div>';
|
166 |
-
echo '<h3>Styles</h3>';
|
167 |
-
echo '<div>';
|
168 |
-
$control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'styles'));
|
169 |
-
$control->create_section('Styles');
|
170 |
-
echo $control->HTML;
|
171 |
-
$control->clear_controls();
|
172 |
-
echo '</div>';
|
173 |
-
echo '<h3>Notes</h3>';
|
174 |
-
echo '<div>';
|
175 |
-
$control->add_control(array('type' => 'text', 'optionName' => 'title', 'helpText' => 'The title is used to identify your Ad Widget easily in future. A Random Title will be assigned to your Ad widget by default.', 'value' => ((isset($shortcodeads[$identifier]['title']))?$shortcodeads[$identifier]['title']:$identifier)));
|
176 |
-
$control->create_section('Title');
|
177 |
-
echo $control->HTML;
|
178 |
-
$control->clear_controls();
|
179 |
-
|
180 |
-
$control->add_control(array('type' => 'textarea', 'style' => 'height: 220px;', 'optionName' => 'notes'));
|
181 |
-
$control->create_section('Notes');
|
182 |
-
echo $control->HTML;
|
183 |
-
$control->clear_controls();
|
184 |
-
echo '</div>';
|
185 |
-
echo '</div>';
|
186 |
-
echo '<script type="text/javascript">';
|
187 |
-
echo $control->JS;
|
188 |
-
echo 'jQuery("#wp_insert_shortcodeads_'.$identifier.'_accordion").accordion({ icons: { header: "ui-icon-circle-arrow-e", activeHeader: "ui-icon-circle-arrow-s" }, heightStyle: "auto" });';
|
189 |
-
echo '</script>';
|
190 |
-
echo '</div>';
|
191 |
-
}
|
192 |
-
|
193 |
-
function wp_insert_shortcodeads_form_save_action($identifier) {
|
194 |
-
$shortcodeads = get_option('wp_insert_shortcodeads');
|
195 |
-
$shortcodeads[$identifier]['identifier'] = ((isset($_POST['wp_insert_shortcodeads_identifier']))?$_POST['wp_insert_shortcodeads_identifier']:'');
|
196 |
-
$shortcodeads[$identifier]['status'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_status']) && ($_POST['wp_insert_shortcodeads_'.$identifier.'_status'] == 'true'))?'1':'');
|
197 |
-
|
198 |
-
$shortcodeads[$identifier]['primary_ad_code'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_primary_ad_code']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_primary_ad_code']:'');
|
199 |
-
$shortcodeads[$identifier]['secondary_ad_code'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_secondary_ad_code']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_secondary_ad_code']:'');
|
200 |
-
$shortcodeads[$identifier]['tertiary_ad_code'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_tertiary_ad_code']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_tertiary_ad_code']:'');
|
201 |
-
|
202 |
-
$shortcodeads[$identifier]['rules_exclude_loggedin'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_rules_exclude_loggedin']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_rules_exclude_loggedin']:'');
|
203 |
-
$shortcodeads[$identifier]['rules_exclude_mobile_devices'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_rules_exclude_mobile_devices']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_rules_exclude_mobile_devices']:'');
|
204 |
-
$shortcodeads[$identifier]['rules_exclude_404'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_rules_exclude_404']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_rules_exclude_404']:'');
|
205 |
-
$shortcodeads[$identifier]['rules_exclude_home'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_rules_exclude_home']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_rules_exclude_home']:'');
|
206 |
-
$shortcodeads[$identifier]['rules_exclude_archives'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_rules_exclude_archives']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_rules_exclude_archives']:'');
|
207 |
-
$shortcodeads[$identifier]['rules_exclude_search'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_rules_exclude_search']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_rules_exclude_search']:'');
|
208 |
-
$shortcodeads[$identifier]['rules_exclude_page'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_rules_exclude_page']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_rules_exclude_page']:'');
|
209 |
-
$shortcodeads[$identifier]['rules_page_exceptions'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_rules_page_exceptions']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_rules_page_exceptions']:'');
|
210 |
-
$shortcodeads[$identifier]['rules_exclude_post'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_rules_exclude_post']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_rules_exclude_post']:'');
|
211 |
-
$shortcodeads[$identifier]['rules_post_exceptions'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_rules_post_exceptions']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_rules_post_exceptions']:'');
|
212 |
-
$shortcodeads[$identifier]['rules_post_categories_exceptions'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_rules_post_categories_exceptions']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_rules_post_categories_exceptions']:'');
|
213 |
-
$shortcodeads[$identifier]['rules_exclude_categories'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_rules_exclude_categories']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_rules_exclude_categories']:'');
|
214 |
-
$shortcodeads[$identifier]['rules_categories_exceptions'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_rules_categories_exceptions']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_rules_categories_exceptions']:'');
|
215 |
-
|
216 |
-
$shortcodeads[$identifier]['geo_group1_countries'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_geo_group1_countries']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_geo_group1_countries']:'');
|
217 |
-
$shortcodeads[$identifier]['geo_group1_adcode'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_geo_group1_adcode']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_geo_group1_adcode']:'');
|
218 |
-
$shortcodeads[$identifier]['geo_group2_countries'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_geo_group2_countries']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_geo_group2_countries']:'');
|
219 |
-
$shortcodeads[$identifier]['geo_group2_adcode'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_geo_group2_adcode']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_geo_group2_adcode']:'');
|
220 |
-
|
221 |
-
$shortcodeads[$identifier]['styles'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_styles']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_styles']:'');
|
222 |
-
|
223 |
-
$shortcodeads[$identifier]['title'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_title']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_title']:'');
|
224 |
-
$shortcodeads[$identifier]['notes'] = ((isset($_POST['wp_insert_shortcodeads_'.$identifier.'_notes']))?$_POST['wp_insert_shortcodeads_'.$identifier.'_notes']:'');
|
225 |
-
|
226 |
-
update_option('wp_insert_shortcodeads', $shortcodeads);
|
227 |
-
}
|
228 |
-
/* End Shared UI Functions */
|
229 |
-
|
230 |
-
/* Begin Shortcode Ad Insertion */
|
231 |
-
add_shortcode('wpshortcodead', 'wp_insert_shortcodeads_shortcode');
|
232 |
-
function wp_insert_shortcodeads_shortcode($atts) {
|
233 |
-
$atts = shortcode_atts(array('id' => ''), $atts, 'wpshortcodead');
|
234 |
-
if(isset($atts['id']) && ($atts['id'] != '')) {
|
235 |
-
$shortcodeads = get_option('wp_insert_shortcodeads');
|
236 |
-
if(isset($shortcodeads[$atts['id']]) && is_array($shortcodeads[$atts['id']]) && wp_insert_get_ad_status($shortcodeads[$atts['id']])) {
|
237 |
-
return '<div class="wpInsert wpInsertShortcodeAd"'.(($shortcodeads[$atts['id']]['styles'] != '')?' style="'.$shortcodeads[$atts['id']]['styles'].'"':'').'>'.wp_insert_get_geotargeted_adcode($shortcodeads[$atts['id']]).'</div>';
|
238 |
-
}
|
239 |
-
}
|
240 |
-
}
|
241 |
-
/* End Shortcode Ad Insertion */
|
242 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/modules/shortcodeads/js/module.js
DELETED
@@ -1,145 +0,0 @@
|
|
1 |
-
jQuery(document).ready(function() {
|
2 |
-
wp_insert_click_handler(
|
3 |
-
'wp_insert_shortcodeads_new',
|
4 |
-
'Shortcode Ad : Add New',
|
5 |
-
jQuery("body").width() * 0.8,
|
6 |
-
jQuery("body").height() * 0.8,
|
7 |
-
function() {
|
8 |
-
jQuery('.wp_insert_shortcodeads_status').parent().css({'display': 'inline-block', 'margin': '5px 0 0'}).prependTo('.ui-dialog-buttonpane');
|
9 |
-
},
|
10 |
-
function() {
|
11 |
-
var identifier = jQuery(".wp_insert_shortcodeads_identifier").val();
|
12 |
-
var shortcodeadLink = jQuery("<a></a>");
|
13 |
-
shortcodeadLink.attr("id", "wp_insert_shortcodeads_"+identifier);
|
14 |
-
shortcodeadLink.attr("href", "javascript:;");
|
15 |
-
shortcodeadLink.attr("onClick", "wp_insert_shortcodeads_click_handler(\'"+identifier+"\', \'"+jQuery("#wp_insert_shortcodeads_"+identifier+"_title").val()+"\')");
|
16 |
-
shortcodeadLink.html("Shortcode Ad : "+jQuery("#wp_insert_shortcodeads_"+identifier+"_title").val());
|
17 |
-
var deleteButton = jQuery("<span></span>");
|
18 |
-
deleteButton.attr("class", "dashicons dashicons-dismiss wp_insert_delete_icon");
|
19 |
-
deleteButton.attr("onClick", "wp_insert_shortcodeads_remove(\'"+identifier+"\')");
|
20 |
-
jQuery("#wp_insert_shortcodeads_new").parent().before(jQuery("<p></p>").append(shortcodeadLink, deleteButton));
|
21 |
-
wp_insert_shortcodeads_update(identifier);
|
22 |
-
},
|
23 |
-
function() { }
|
24 |
-
);
|
25 |
-
});
|
26 |
-
|
27 |
-
function wp_insert_shortcodeads_click_handler(identifier, title) {
|
28 |
-
jQuery('<div id="wp_insert_shortcodeads_'+identifier+'_dialog"></div>').html('<div class="wp_insert_ajaxloader"></div>').dialog({
|
29 |
-
'modal': true,
|
30 |
-
'resizable': false,
|
31 |
-
'width': jQuery("body").width() * 0.8,
|
32 |
-
'maxWidth': jQuery("body").width() * 0.8,
|
33 |
-
'maxHeight': jQuery("body").height() * 0.9,
|
34 |
-
'title': 'Shortcode Ad : '+title,
|
35 |
-
position: { my: 'center', at: 'center', of: window },
|
36 |
-
open: function (event, ui) {
|
37 |
-
jQuery('.ui-dialog').css({'z-index': 999999, 'max-width': '90%'});
|
38 |
-
jQuery('.ui-widget-overlay').css({'z-index': 999998, 'opacity': 0.8, 'background': '#000000'});
|
39 |
-
jQuery('.ui-dialog-buttonpane button:contains("Update")').button('disable');
|
40 |
-
jQuery.post(
|
41 |
-
jQuery('#wp_insert_admin_ajax').val(), {
|
42 |
-
'action': 'wp_insert_shortcodeads_existing_form_get_content',
|
43 |
-
'wp_insert_shortcodeads_identifier': identifier,
|
44 |
-
'wp_insert_nonce': jQuery('#wp_insert_nonce').val()
|
45 |
-
}, function(response) {
|
46 |
-
jQuery('.wp_insert_ajaxloader').hide();
|
47 |
-
jQuery('.ui-dialog-content').html(response);
|
48 |
-
jQuery('.ui-accordion .ui-accordion-content').css('max-height', (jQuery("body").height() * 0.45));
|
49 |
-
jQuery('.ui-dialog-buttonpane button:contains("Update")').button('enable');
|
50 |
-
jQuery('.wp_insert_shortcodeads_status').parent().css({'display': 'inline-block', 'margin': '5px 0 0'}).prependTo('.ui-dialog-buttonpane');
|
51 |
-
jQuery('.ui-dialog').css({'position': 'fixed'});
|
52 |
-
jQuery('#wp_insert_shortcodeads_'+identifier+'_dialog').delay(500).dialog({position: { my: 'center', at: 'center', of: window }});
|
53 |
-
}
|
54 |
-
);
|
55 |
-
},
|
56 |
-
buttons: {
|
57 |
-
'Update': function() {
|
58 |
-
jQuery("#wp_insert_shortcodeads_"+identifier).html("Shortcode Ad : "+jQuery("#wp_insert_shortcodeads_"+identifier+"_title").val());
|
59 |
-
jQuery("#wp_insert_shortcodeads_"+identifier).attr("onClick", "wp_insert_shortcodeads_click_handler(\'"+identifier+"\', \'"+jQuery("#wp_insert_shortcodeads_"+identifier+"_title").val()+"\')");
|
60 |
-
wp_insert_shortcodeads_update(identifier);
|
61 |
-
jQuery(this).dialog('close');
|
62 |
-
},
|
63 |
-
Cancel: function() {
|
64 |
-
jQuery(this).dialog('close');
|
65 |
-
}
|
66 |
-
},
|
67 |
-
close: function() {
|
68 |
-
jQuery(this).dialog('destroy');
|
69 |
-
}
|
70 |
-
});
|
71 |
-
}
|
72 |
-
|
73 |
-
function wp_insert_shortcodeads_update(identifier) {
|
74 |
-
args = {};
|
75 |
-
args['action'] = 'wp_insert_shortcodeads_existing_form_save_action';
|
76 |
-
args['wp_insert_nonce'] = jQuery('#wp_insert_nonce').val();
|
77 |
-
args['wp_insert_shortcodeads_identifier'] = identifier;
|
78 |
-
args['wp_insert_shortcodeads_'+identifier+'_status'] = jQuery('#wp_insert_shortcodeads_'+identifier+'_status').prop('checked');
|
79 |
-
|
80 |
-
args['wp_insert_shortcodeads_'+identifier+'_title'] = jQuery('#wp_insert_shortcodeads_'+identifier+'_title').val();
|
81 |
-
|
82 |
-
args['wp_insert_shortcodeads_'+identifier+'_primary_ad_code'] = jQuery('#wp_insert_shortcodeads_'+identifier+'_primary_ad_code').val();
|
83 |
-
args['wp_insert_shortcodeads_'+identifier+'_secondary_ad_code'] = jQuery('#wp_insert_shortcodeads_'+identifier+'_secondary_ad_code').val();
|
84 |
-
args['wp_insert_shortcodeads_'+identifier+'_tertiary_ad_code'] = jQuery('#wp_insert_shortcodeads_'+identifier+'_tertiary_ad_code').val();
|
85 |
-
|
86 |
-
args['wp_insert_shortcodeads_'+identifier+'_rules_exclude_loggedin'] = jQuery('#wp_insert_shortcodeads_'+identifier+'_rules_exclude_loggedin').prop('checked');
|
87 |
-
args['wp_insert_shortcodeads_'+identifier+'_rules_exclude_mobile_devices'] = jQuery('#wp_insert_shortcodeads_'+identifier+'_rules_exclude_mobile_devices').prop('checked');
|
88 |
-
args['wp_insert_shortcodeads_'+identifier+'_rules_exclude_404'] = jQuery('#wp_insert_shortcodeads_'+identifier+'_rules_exclude_404').prop('checked');
|
89 |
-
args['wp_insert_shortcodeads_'+identifier+'_rules_exclude_home'] = jQuery('#wp_insert_shortcodeads_'+identifier+'_rules_exclude_home').prop('checked');
|
90 |
-
args['wp_insert_shortcodeads_'+identifier+'_rules_exclude_archives'] = jQuery('#wp_insert_shortcodeads_'+identifier+'_rules_exclude_archives').prop('checked');
|
91 |
-
args['wp_insert_shortcodeads_'+identifier+'_rules_exclude_search'] = jQuery('#wp_insert_shortcodeads_'+identifier+'_rules_exclude_search').prop('checked');
|
92 |
-
args['wp_insert_shortcodeads_'+identifier+'_rules_exclude_page'] = jQuery('#wp_insert_shortcodeads_'+identifier+'_rules_exclude_page').prop('checked');
|
93 |
-
args['wp_insert_shortcodeads_'+identifier+'_rules_page_exceptions'] = jQuery.map(jQuery('#wp_insert_shortcodeads_'+identifier+'_rules_page_exceptions :selected'), function(e) { return jQuery(e).val(); });
|
94 |
-
args['wp_insert_shortcodeads_'+identifier+'_rules_exclude_post'] = jQuery('#wp_insert_shortcodeads_'+identifier+'_rules_exclude_post').prop('checked');
|
95 |
-
args['wp_insert_shortcodeads_'+identifier+'_rules_post_exceptions'] = jQuery.map(jQuery('#wp_insert_shortcodeads_'+identifier+'_rules_post_exceptions :selected'), function(e) { return jQuery(e).val(); });
|
96 |
-
args['wp_insert_shortcodeads_'+identifier+'_rules_post_categories_exceptions'] = jQuery.map(jQuery('#wp_insert_shortcodeads_'+identifier+'_rules_post_categories_exceptions :selected'), function(e) { return jQuery(e).val(); });
|
97 |
-
args['wp_insert_shortcodeads_'+identifier+'_rules_exclude_categories'] = jQuery('#wp_insert_shortcodeads_'+identifier+'_rules_exclude_categories').prop('checked');
|
98 |
-
args['wp_insert_shortcodeads_'+identifier+'_rules_categories_exceptions'] = jQuery.map(jQuery('#wp_insert_shortcodeads_'+identifier+'_rules_categories_exceptions :selected'), function(e) { return jQuery(e).val(); });
|
99 |
-
|
100 |
-
args['wp_insert_shortcodeads_'+identifier+'_geo_group1_countries'] = jQuery.map(jQuery('#wp_insert_shortcodeads_'+identifier+'_geo_group1_countries :selected'), function(e) { return jQuery(e).val(); });
|
101 |
-
args['wp_insert_shortcodeads_'+identifier+'_geo_group1_adcode'] = jQuery('#wp_insert_shortcodeads_'+identifier+'_geo_group1_adcode').val();
|
102 |
-
args['wp_insert_shortcodeads_'+identifier+'_geo_group2_countries'] = jQuery.map(jQuery('#wp_insert_shortcodeads_'+identifier+'_geo_group2_countries :selected'), function(e) { return jQuery(e).val(); });
|
103 |
-
args['wp_insert_shortcodeads_'+identifier+'_geo_group2_adcode'] = jQuery('#wp_insert_shortcodeads_'+identifier+'_geo_group2_adcode').val();
|
104 |
-
|
105 |
-
args['wp_insert_shortcodeads_'+identifier+'_styles'] = jQuery('#wp_insert_shortcodeads_'+identifier+'_styles').val();
|
106 |
-
|
107 |
-
args['wp_insert_shortcodeads_'+identifier+'_notes'] = jQuery('#wp_insert_shortcodeads_'+identifier+'_notes').val();
|
108 |
-
|
109 |
-
jQuery.post(
|
110 |
-
jQuery('#wp_insert_admin_ajax').val(), args, function(response) { }
|
111 |
-
);
|
112 |
-
}
|
113 |
-
|
114 |
-
function wp_insert_shortcodeads_remove(identifier) {
|
115 |
-
jQuery("<p>Are you Sure you want to remove this Ad Unit?</p>").dialog({
|
116 |
-
'modal': true,
|
117 |
-
'resizable': false,
|
118 |
-
'title': 'Deletion Confirmation',
|
119 |
-
position: { my: 'center', at: 'center', of: window },
|
120 |
-
open: function (event, ui) {
|
121 |
-
jQuery('.ui-dialog').css({'z-index': 999999, 'max-width': '90%'});
|
122 |
-
jQuery('.ui-widget-overlay').css({'z-index': 999998, 'opacity': 0.8, 'background': '#000000'});
|
123 |
-
},
|
124 |
-
buttons : {
|
125 |
-
'Confirm': function() {
|
126 |
-
jQuery("#wp_insert_shortcodeads_"+identifier).parent().remove();
|
127 |
-
jQuery.post(
|
128 |
-
jQuery('#wp_insert_admin_ajax').val(), {
|
129 |
-
'action': 'wp_insert_shortcodeads_remove',
|
130 |
-
'wp_insert_shortcodeads_identifier': identifier,
|
131 |
-
'wp_insert_nonce': jQuery('#wp_insert_nonce').val()
|
132 |
-
}, function(response) {
|
133 |
-
}
|
134 |
-
);
|
135 |
-
jQuery(this).dialog("close");
|
136 |
-
},
|
137 |
-
'Cancel': function() {
|
138 |
-
jQuery(this).dialog("close");
|
139 |
-
}
|
140 |
-
},
|
141 |
-
close: function() {
|
142 |
-
jQuery(this).dialog('destroy');
|
143 |
-
}
|
144 |
-
});
|
145 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
includes/modules/shortcodeads/module.php
DELETED
@@ -1,41 +0,0 @@
|
|
1 |
-
<?php
|
2 |
-
require_once(dirname(__FILE__).'/functions.php');
|
3 |
-
|
4 |
-
/* Begin Add Assets */
|
5 |
-
/*add_action('wp_insert_modules_css', 'wp_insert_module_shortcodeads_css', 0);
|
6 |
-
function wp_insert_module_shortcodeads_css() {
|
7 |
-
wp_register_style('wp-insert-module-shortcodeads-css', WP_INSERT_URL.'includes/modules/shortcodeads/css/module.css', array('wp-insert-css'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
|
8 |
-
wp_enqueue_style('wp-insert-module-shortcodeads-css');
|
9 |
-
}*/
|
10 |
-
|
11 |
-
add_action('wp_insert_modules_js', 'wp_insert_module_shortcodeads_js', 0);
|
12 |
-
function wp_insert_module_shortcodeads_js() {
|
13 |
-
wp_register_script('wp-insert-module-shortcodeads-js', WP_INSERT_URL.'includes/modules/shortcodeads/js/module.js', array('wp-insert-js'), WP_INSERT_VERSION.((WP_INSERT_DEBUG)?rand(0,9999):''));
|
14 |
-
wp_enqueue_script('wp-insert-module-shortcodeads-js');
|
15 |
-
}
|
16 |
-
/* End Add Assets */
|
17 |
-
|
18 |
-
/* Begin Add Card in Admin Panel */
|
19 |
-
add_action('wp_insert_plugin_card', 'wp_insert_shortcodeads_plugin_card', 40);
|
20 |
-
function wp_insert_shortcodeads_plugin_card() {
|
21 |
-
echo '<div class="plugin-card">';
|
22 |
-
echo '<div class="plugin-card-top">';
|
23 |
-
echo '<h4>Shortcode Ads</h4>';
|
24 |
-
echo '<p>Ads embedded directly inside post / page content via shortcodes.</p>';
|
25 |
-
echo '</div>';
|
26 |
-
echo '<div class="plugin-card-bottom">';
|
27 |
-
$shortcodeads = get_option('wp_insert_shortcodeads');
|
28 |
-
if(isset($shortcodeads) && is_array($shortcodeads)) {
|
29 |
-
foreach($shortcodeads as $key => $value) {
|
30 |
-
echo '<p>';
|
31 |
-
echo '<a id="wp_insert_shortcodeads_'.$key.'" href="javascript:;" onclick="wp_insert_shortcodeads_click_handler(\''.$key.'\', \''.$value['title'].'\')">Shortcode Ad : '.$value['title'].'</a>';
|
32 |
-
echo '<span class="dashicons dashicons-dismiss wp_insert_delete_icon" onclick="wp_insert_shortcodeads_remove(\''.$key.'\')"></span>';
|
33 |
-
echo '</p>';
|
34 |
-
}
|
35 |
-
}
|
36 |
-
echo '<p style="text-align: center; padding: 20px 0 10px;"><a id="wp_insert_shortcodeads_new" href="#" class="button-secondary">Add New Shortcode Ad</a></p>';
|
37 |
-
echo '</div>';
|
38 |
-
echo '</div>';
|
39 |
-
}
|
40 |
-
/* End Add Card in Admin Panel */
|
41 |
-
?>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
-
=== Wp-Insert
|
2 |
Contributors: Namith Jawahar
|
3 |
Tags: google adsense, adsense, google ads, google analytics, privacy policy, best adsense plugin, ad management, ad rotation, tracking codes
|
4 |
Donate link: http://wpinsert.smartlogix.co.in/support/
|
5 |
Requires at least: 4.1.0
|
6 |
-
Tested up to: 4.9
|
7 |
-
Stable tag: 2.
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
@@ -37,33 +37,27 @@ Wp-Insert is the most powerful yet easiest to use wordpress ad management / ad i
|
|
37 |
* Insert any type of Embed codes into the Header / Footer of your Site
|
38 |
* Insert Google Analytics Code, Facebook Pixel Code, Custom CSS or any other code to your site without having to edit any theme files
|
39 |
* Style Ads the Way you want
|
|
|
40 |
* Does not slow down your site (Highly Efficient Algorithms)
|
41 |
* Legal Page Templates (Privacy Policy, Terms & Conditions, Disclaimer, Copyright) to kick start your Legal Pages
|
42 |
* A/B Testing Facility for Ads (Comply with Adsense Policies while serving other Ad Networks)
|
43 |
* Ad roation via A/B testing feature (You can even use different networks with conflicting terms such that only ads from one network appears at any time)
|
44 |
* Geo-targeted Country Specific Ad Placement with builtin caching for improved performace.
|
45 |
* Supports Authorized Digital Sellers, or ads.txt, an IAB initiative to improve transparency in programmatic advertising.
|
|
|
46 |
* Backed by <a href="http://www.smartlogix.co.in/" title="SmartLogix Technologies : Experts in WordPress Themes and Plugins">SmartLogix</a>, The Unparalleled WordPress Specialist
|
47 |
|
48 |
== Screenshots ==
|
49 |
|
50 |
1. The New Unified plugin admin page.
|
51 |
-
2.
|
52 |
-
3.
|
53 |
-
4.
|
54 |
-
5. Ad
|
55 |
-
6.
|
56 |
-
7. Google Analytics integrated
|
57 |
-
8. Multiple Ad Networks / Ab testing.
|
58 |
-
9. Geotarget Different Ads just for audence from specific Countries
|
59 |
-
10. Easily insert Ads directly into your theme for Advanced Ad Placement and still support the Rules system.
|
60 |
-
11. Easy to use preprepared Legal Page Templates to serve as a starting point to your legal pages.
|
61 |
-
12. Easily create new legal pages or assign legal content to existing pages without leaving the unified admin page.
|
62 |
-
13. Easily edit your ads.txt (Authorized Digital Sellers) right from inside wordpress.
|
63 |
-
14. Handholds you to format your ads.txt entry correctly.
|
64 |
-
|
65 |
8. Easily embed codes in the Header / Footer.
|
66 |
-
|
67 |
|
68 |
== Installation ==
|
69 |
= In WordPress =
|
1 |
+
=== Wp-Insert ===
|
2 |
Contributors: Namith Jawahar
|
3 |
Tags: google adsense, adsense, google ads, google analytics, privacy policy, best adsense plugin, ad management, ad rotation, tracking codes
|
4 |
Donate link: http://wpinsert.smartlogix.co.in/support/
|
5 |
Requires at least: 4.1.0
|
6 |
+
Tested up to: 4.9.4
|
7 |
+
Stable tag: 2.4
|
8 |
License: GPLv2 or later
|
9 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html
|
10 |
|
37 |
* Insert any type of Embed codes into the Header / Footer of your Site
|
38 |
* Insert Google Analytics Code, Facebook Pixel Code, Custom CSS or any other code to your site without having to edit any theme files
|
39 |
* Style Ads the Way you want
|
40 |
+
* Hide / Modify ads on Large Desktop, Medium Desktop, Tablets and Mobiles with indivigual targetting options and features available for different deveices.
|
41 |
* Does not slow down your site (Highly Efficient Algorithms)
|
42 |
* Legal Page Templates (Privacy Policy, Terms & Conditions, Disclaimer, Copyright) to kick start your Legal Pages
|
43 |
* A/B Testing Facility for Ads (Comply with Adsense Policies while serving other Ad Networks)
|
44 |
* Ad roation via A/B testing feature (You can even use different networks with conflicting terms such that only ads from one network appears at any time)
|
45 |
* Geo-targeted Country Specific Ad Placement with builtin caching for improved performace.
|
46 |
* Supports Authorized Digital Sellers, or ads.txt, an IAB initiative to improve transparency in programmatic advertising.
|
47 |
+
* ads.txt daily monitoring to prevent revenue loss due to accidental adsense publisher id omission.
|
48 |
* Backed by <a href="http://www.smartlogix.co.in/" title="SmartLogix Technologies : Experts in WordPress Themes and Plugins">SmartLogix</a>, The Unparalleled WordPress Specialist
|
49 |
|
50 |
== Screenshots ==
|
51 |
|
52 |
1. The New Unified plugin admin page.
|
53 |
+
2. Elaborate Rules system to control WHEN and WHERE to show your Ads
|
54 |
+
3. Geotarget Different Ads just for audence from specific Countries
|
55 |
+
4. Easy to use preprepared Legal Page Templates to serve as a starting point to your legal pages.
|
56 |
+
5. Easily insert Ads directly into your theme for Advanced Ad Placement and still support the Rules system.
|
57 |
+
6. Multiple Ad Networks / Ab testing.
|
58 |
+
7. Google Analytics integrated.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
8. Easily embed codes in the Header / Footer.
|
60 |
+
9. Ad Widgets which support the Rules System.
|
61 |
|
62 |
== Installation ==
|
63 |
= In WordPress =
|
wp-insert.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Wp-Insert
|
4 |
Plugin URI: http://www.wp-insert.smartlogix.co.in/
|
5 |
Description: WP-INSERT by SMARTLOGIX : The Ultimate Adsense / Ad-Management Plugin for WordPress
|
6 |
-
Version: 2.
|
7 |
Author: Namith Jawahar
|
8 |
Author URI: http://www.smartlogix.co.in/
|
9 |
WP-INSERT by SMARTLOGIX : The Ultimate Adsense / Ad-Management Plugin for WordPress
|
@@ -31,16 +31,11 @@ if(!defined('WP_INSERT_URL'))
|
|
31 |
if(!defined('WP_INSERT_DIR'))
|
32 |
define('WP_INSERT_DIR', plugin_dir_path(__FILE__));
|
33 |
if(!defined('WP_INSERT_VERSION'))
|
34 |
-
define('WP_INSERT_VERSION', '2.
|
35 |
if(!defined('WP_INSERT_DEBUG'))
|
36 |
define('WP_INSERT_DEBUG', false);
|
37 |
/*Includes*/
|
38 |
-
require_once(dirname(__FILE__).'/includes/common/common.php');
|
39 |
-
require_once(dirname(__FILE__).'/includes/controls/controls.php');
|
40 |
-
require_once(dirname(__FILE__).'/includes/common/control-panel.php');
|
41 |
-
require_once(dirname(__FILE__).'/includes/common/abtesting.php');
|
42 |
-
require_once(dirname(__FILE__).'/includes/common/rules.php');
|
43 |
-
require_once(dirname(__FILE__).'/includes/common/geotargeting.php');
|
44 |
|
45 |
-
require_once(dirname(__FILE__).'/includes/modules/modules.php');
|
|
|
46 |
?>
|
3 |
Plugin Name: Wp-Insert
|
4 |
Plugin URI: http://www.wp-insert.smartlogix.co.in/
|
5 |
Description: WP-INSERT by SMARTLOGIX : The Ultimate Adsense / Ad-Management Plugin for WordPress
|
6 |
+
Version: 2.4
|
7 |
Author: Namith Jawahar
|
8 |
Author URI: http://www.smartlogix.co.in/
|
9 |
WP-INSERT by SMARTLOGIX : The Ultimate Adsense / Ad-Management Plugin for WordPress
|
31 |
if(!defined('WP_INSERT_DIR'))
|
32 |
define('WP_INSERT_DIR', plugin_dir_path(__FILE__));
|
33 |
if(!defined('WP_INSERT_VERSION'))
|
34 |
+
define('WP_INSERT_VERSION', '2.4');
|
35 |
if(!defined('WP_INSERT_DEBUG'))
|
36 |
define('WP_INSERT_DEBUG', false);
|
37 |
/*Includes*/
|
|
|
|
|
|
|
|
|
|
|
|
|
38 |
|
39 |
+
require_once(dirname(__FILE__).'/includes/modules/core/modules.php');
|
40 |
+
require_once(dirname(__FILE__).'/includes/modules/general/modules.php');
|
41 |
?>
|