Version Description
Download this release
Release Info
Developer | namith.jawahar |
Plugin | Quick Adsense |
Version | 2.8.6 |
Comparing to | |
See all releases |
Code changes from version 2.8.5 to 2.8.6
- includes/adsense.php +244 -244
- includes/loader.php +24 -24
- includes/settings.php +192 -177
- includes/templates/adunit-onpost.php +61 -61
- includes/templates/adunit-widget.php +23 -23
- includes/templates/section-general.php +13 -13
- includes/templates/section-onpost-content.php +85 -85
- includes/templates/section-widgets.php +83 -83
- quick-adsense.php +25 -25
- readme.txt +2 -2
includes/adsense.php
CHANGED
@@ -1,244 +1,244 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Adsense specific features.
|
4 |
-
*/
|
5 |
-
|
6 |
-
/**
|
7 |
-
* Add inline script to hide the notice on clicking dismiss button.
|
8 |
-
*/
|
9 |
-
add_action(
|
10 |
-
'admin_enqueue_scripts',
|
11 |
-
function () {
|
12 |
-
if ( current_user_can( 'manage_options' ) ) {
|
13 |
-
wp_localize_script(
|
14 |
-
'jquery',
|
15 |
-
'quick_adsense_adstxt_adsense',
|
16 |
-
[
|
17 |
-
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
18 |
-
'nonce' => wp_create_nonce( 'quick-adsense-adstxt-adsense-nonce' ),
|
19 |
-
]
|
20 |
-
);
|
21 |
-
wp_add_inline_script(
|
22 |
-
'jquery',
|
23 |
-
quick_adsense_load_file( 'templates/js/script-admin-notice.php' )
|
24 |
-
);
|
25 |
-
}
|
26 |
-
}
|
27 |
-
);
|
28 |
-
|
29 |
-
/**
|
30 |
-
* This function checks for and displays the admin notice when needed.
|
31 |
-
*
|
32 |
-
* @param boolean $is_ajax Specific where the function is being called during an ajax call.
|
33 |
-
*/
|
34 |
-
function quick_adsense_adstxt_adsense_admin_notice( $is_ajax = false ) {
|
35 |
-
if ( current_user_can( 'manage_options' ) ) {
|
36 |
-
if ( ! get_option( 'quick_adsense_adstxt_adsense_admin_notice_dismissed' ) ) {
|
37 |
-
$adstxt_new_adsense_entries = get_transient( 'quick_adsense_adstxt_adsense_autocheck_content' );
|
38 |
-
if ( 'CHECKED' !== $adstxt_new_adsense_entries ) {
|
39 |
-
if ( ! isset( $adstxt_new_adsense_entries ) || ( false === $adstxt_new_adsense_entries ) ) {
|
40 |
-
$adstxt_new_adsense_entries = quick_adsense_adstxt_adsense_get_status();
|
41 |
-
}
|
42 |
-
if ( ( false !== $adstxt_new_adsense_entries ) && is_array( $adstxt_new_adsense_entries ) ) {
|
43 |
-
set_transient( 'quick_adsense_adstxt_adsense_autocheck_content', $adstxt_new_adsense_entries, DAY_IN_SECONDS );
|
44 |
-
$screen = get_current_screen();
|
45 |
-
quick_adsense_load_file(
|
46 |
-
'templates/block-adsense-adstxt-notice.php',
|
47 |
-
[
|
48 |
-
'screen_id' => $screen->id,
|
49 |
-
'is_ajax' => $is_ajax,
|
50 |
-
'adstxt_new_adsense_entries' => implode( '<br />', $adstxt_new_adsense_entries ),
|
51 |
-
],
|
52 |
-
true
|
53 |
-
);
|
54 |
-
} else {
|
55 |
-
set_transient( 'quick_adsense_adstxt_adsense_autocheck_content', 'CHECKED', DAY_IN_SECONDS );
|
56 |
-
}
|
57 |
-
}
|
58 |
-
}
|
59 |
-
}
|
60 |
-
}
|
61 |
-
add_action( 'admin_notices', 'quick_adsense_adstxt_adsense_admin_notice' );
|
62 |
-
|
63 |
-
/**
|
64 |
-
* This function checks whether new entries need to be added to ads.txt based on the adcodes added.
|
65 |
-
*
|
66 |
-
* @return mixed False is no changes are needed, New ads.txt lines as an array if changes are required.
|
67 |
-
*/
|
68 |
-
function quick_adsense_adstxt_adsense_get_status() {
|
69 |
-
$file_handler = new QuickAdsense\FileHandler( 'ads.txt' );
|
70 |
-
if ( $file_handler->exists() ) {
|
71 |
-
$adsense_publisher_ids = quick_adsense_adstxt_adsense_get_publisherids();
|
72 |
-
$adstxt_content = $file_handler->read();
|
73 |
-
if ( false !== $adstxt_content ) {
|
74 |
-
$adstxt_content_data = array_filter( explode( "\n", trim( $adstxt_content ) ), 'trim' );
|
75 |
-
if ( is_array( $adstxt_content_data ) ) {
|
76 |
-
$adstxt_existing_adsense_entries = [];
|
77 |
-
foreach ( $adstxt_content_data as $line ) {
|
78 |
-
if ( strpos( $line, 'google.com' ) !== false ) {
|
79 |
-
$adstxt_existing_adsense_entries[] = $line;
|
80 |
-
}
|
81 |
-
}
|
82 |
-
|
83 |
-
$adstxt_new_adsense_entries = [];
|
84 |
-
if ( count( $adstxt_existing_adsense_entries ) === 0 ) {
|
85 |
-
if ( is_array( $adsense_publisher_ids ) && ( count( $adsense_publisher_ids ) > 0 ) ) {
|
86 |
-
foreach ( $adsense_publisher_ids as $adsense_publisher_id ) {
|
87 |
-
$adstxt_new_adsense_entries[] = 'google.com, ' . $adsense_publisher_id . ', DIRECT, f08c47fec0942fa0';
|
88 |
-
}
|
89 |
-
}
|
90 |
-
} else {
|
91 |
-
if ( is_array( $adsense_publisher_ids ) && ( count( $adsense_publisher_ids ) > 0 ) ) {
|
92 |
-
foreach ( $adsense_publisher_ids as $adsense_publisher_id ) {
|
93 |
-
$entry_exists = false;
|
94 |
-
foreach ( $adstxt_existing_adsense_entries as $adstxt_existing_adsense_entry ) {
|
95 |
-
if ( strpos( $adstxt_existing_adsense_entry, $adsense_publisher_id ) !== false ) {
|
96 |
-
$entry_exists = true;
|
97 |
-
}
|
98 |
-
}
|
99 |
-
if ( false === $entry_exists ) {
|
100 |
-
$adstxt_new_adsense_entries[] = 'google.com, ' . $adsense_publisher_id . ', DIRECT, f08c47fec0942fa0';
|
101 |
-
}
|
102 |
-
}
|
103 |
-
}
|
104 |
-
}
|
105 |
-
}
|
106 |
-
}
|
107 |
-
}
|
108 |
-
if ( isset( $adstxt_new_adsense_entries ) && count( $adstxt_new_adsense_entries ) > 0 ) {
|
109 |
-
return $adstxt_new_adsense_entries;
|
110 |
-
}
|
111 |
-
return false;
|
112 |
-
}
|
113 |
-
|
114 |
-
/**
|
115 |
-
* Function to extract publisher Ids from settings.
|
116 |
-
*
|
117 |
-
* @return mixed False if no publisher ids found, Array of publisher ids if publisher ids found.
|
118 |
-
*/
|
119 |
-
function quick_adsense_adstxt_adsense_get_publisherids() {
|
120 |
-
$adsense_publisher_ids = [];
|
121 |
-
|
122 |
-
$settings = get_option( 'quick_adsense_settings' );
|
123 |
-
if ( isset( $settings ) && is_array( $settings ) ) {
|
124 |
-
for ( $i = 1; $i <= 10; $i++ ) {
|
125 |
-
if ( isset( $settings[ 'onpost_ad_' . $i . '_content' ] ) && ( '' !== $settings[ 'onpost_ad_' . $i . '_content' ] ) ) {
|
126 |
-
$temp = quick_adsense_adstxt_adsense_extract_publisherids( $settings[ 'onpost_ad_' . $i . '_content' ] );
|
127 |
-
if ( false !== $temp ) {
|
128 |
-
$adsense_publisher_ids = array_merge( $adsense_publisher_ids, $temp );
|
129 |
-
}
|
130 |
-
}
|
131 |
-
|
132 |
-
if ( isset( $settings[ 'widget_ad_' . $i . '_content' ] ) && ( '' !== $settings[ 'widget_ad_' . $i . '_content' ] ) ) {
|
133 |
-
$temp = quick_adsense_adstxt_adsense_extract_publisherids( $settings[ 'widget_ad_' . $i . '_content' ] );
|
134 |
-
if ( false !== $temp ) {
|
135 |
-
$adsense_publisher_ids = array_merge( $adsense_publisher_ids, $temp );
|
136 |
-
}
|
137 |
-
}
|
138 |
-
|
139 |
-
if ( isset( $settings['header_embed_code'] ) && ( '' !== $settings['header_embed_code'] ) ) {
|
140 |
-
$temp = quick_adsense_adstxt_adsense_extract_publisherids( $settings['header_embed_code'] );
|
141 |
-
if ( false !== $temp ) {
|
142 |
-
$adsense_publisher_ids = array_merge( $adsense_publisher_ids, $temp );
|
143 |
-
}
|
144 |
-
}
|
145 |
-
|
146 |
-
if ( isset( $settings['footer_embed_code'] ) && ( '' !== $settings['footer_embed_code'] ) ) {
|
147 |
-
$temp = quick_adsense_adstxt_adsense_extract_publisherids( $settings['footer_embed_code'] );
|
148 |
-
if ( false !== $temp ) {
|
149 |
-
$adsense_publisher_ids = array_merge( $adsense_publisher_ids, $temp );
|
150 |
-
}
|
151 |
-
}
|
152 |
-
}
|
153 |
-
}
|
154 |
-
$adsense_publisher_ids = array_unique( $adsense_publisher_ids );
|
155 |
-
|
156 |
-
if ( count( $adsense_publisher_ids ) > 0 ) {
|
157 |
-
return $adsense_publisher_ids;
|
158 |
-
}
|
159 |
-
return false;
|
160 |
-
}
|
161 |
-
|
162 |
-
/**
|
163 |
-
* Function to extract publisher Ids from provided adcode.
|
164 |
-
*
|
165 |
-
* @param string $ad_code The ad code.
|
166 |
-
*
|
167 |
-
* @return mixed False if no publisher ids found, Array of publisher ids if publisher ids found.
|
168 |
-
*/
|
169 |
-
function quick_adsense_adstxt_adsense_extract_publisherids( $ad_code ) {
|
170 |
-
$publisher_ids = [];
|
171 |
-
if ( isset( $ad_code ) && ( '' !== $ad_code ) ) {
|
172 |
-
if ( preg_match( '/googlesyndication.com/', $ad_code ) ) {
|
173 |
-
if ( preg_match( '/data-ad-client=/', $ad_code ) ) {
|
174 |
-
// ASYNC AD CODE.
|
175 |
-
$ad_code_parts = explode( 'data-ad-client', $ad_code );
|
176 |
-
} elseif ( preg_match( '/client=ca-pub-/', $ad_code ) ) {
|
177 |
-
// NEW ASYNC AD CODE.
|
178 |
-
$ad_code_parts = explode( 'ca-pub-', str_replace( 'ca-pub-', 'ca-pub-"', $ad_code ) );
|
179 |
-
} else {
|
180 |
-
// ORDINARY AD CODE.
|
181 |
-
$ad_code_parts = explode( 'google_ad_client', $ad_code );
|
182 |
-
}
|
183 |
-
if ( isset( $ad_code_parts[1] ) && ( '' !== $ad_code_parts[1] ) ) {
|
184 |
-
preg_match( '#"([a-zA-Z0-9-\s]+)"#', stripslashes( $ad_code_parts[1] ), $matches );
|
185 |
-
if ( isset( $matches[1] ) && ( '' !== $matches[1] ) ) {
|
186 |
-
$publisher_ids[] = str_replace( [ '"', ' ', 'ca-' ], [ '' ], $matches[1] );
|
187 |
-
}
|
188 |
-
}
|
189 |
-
}
|
190 |
-
}
|
191 |
-
|
192 |
-
if ( count( $publisher_ids ) > 0 ) {
|
193 |
-
return $publisher_ids;
|
194 |
-
}
|
195 |
-
return false;
|
196 |
-
}
|
197 |
-
|
198 |
-
/**
|
199 |
-
* This action dismisses the Ads.txt admin notice permanently.
|
200 |
-
*/
|
201 |
-
add_action(
|
202 |
-
'wp_ajax_quick_adsense_adstxt_adsense_admin_notice_dismiss',
|
203 |
-
function () {
|
204 |
-
if ( isset( $_POST['nonce'] ) && wp_verify_nonce( sanitize_key( $_POST['nonce'] ), 'quick-adsense-adstxt-adsense-nonce' ) && ( current_user_can( 'manage_options' ) ) ) {
|
205 |
-
update_option( 'quick_adsense_adstxt_adsense_admin_notice_dismissed', 'true' );
|
206 |
-
wp_send_json_success();
|
207 |
-
}
|
208 |
-
wp_send_json_error();
|
209 |
-
}
|
210 |
-
);
|
211 |
-
|
212 |
-
/**
|
213 |
-
* This action handles the Ajax trigerred Ads.txt update.
|
214 |
-
*/
|
215 |
-
add_action(
|
216 |
-
'wp_ajax_quick_adsense_adstxt_adsense_auto_update',
|
217 |
-
function () {
|
218 |
-
if ( isset( $_POST['nonce'] ) && wp_verify_nonce( sanitize_key( $_POST['nonce'] ), 'quick-adsense-adstxt-adsense-nonce' ) && ( current_user_can( 'manage_options' ) ) ) {
|
219 |
-
$adstxt_new_adsense_entries = quick_adsense_adstxt_adsense_get_status();
|
220 |
-
$file_handler = new QuickAdsense\FileHandler( 'ads.txt' );
|
221 |
-
if ( false !== $adstxt_new_adsense_entries ) {
|
222 |
-
$adstxt_content = $file_handler->read();
|
223 |
-
$adstxt_content_data = array_filter( explode( "\n", trim( $adstxt_content ) ), 'trim' );
|
224 |
-
$adstxt_updated_content = array_filter( array_merge( $adstxt_content_data, $adstxt_new_adsense_entries ), 'trim' );
|
225 |
-
}
|
226 |
-
if ( isset( $adstxt_updated_content ) && is_array( $adstxt_updated_content ) && ( count( $adstxt_updated_content ) > 0 ) ) {
|
227 |
-
$adstxt_updated_content = implode( "\n", $adstxt_updated_content );
|
228 |
-
if ( $file_handler->write( $adstxt_updated_content ) ) {
|
229 |
-
wp_send_json_success();
|
230 |
-
} else {
|
231 |
-
wp_send_json_error(
|
232 |
-
quick_adsense_load_file(
|
233 |
-
'templates/block-adsense-adstxt-update-failed.php',
|
234 |
-
[
|
235 |
-
'content' => $adstxt_updated_content,
|
236 |
-
]
|
237 |
-
)
|
238 |
-
);
|
239 |
-
}
|
240 |
-
}
|
241 |
-
}
|
242 |
-
wp_send_json_error();
|
243 |
-
}
|
244 |
-
);
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Adsense specific features.
|
4 |
+
*/
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Add inline script to hide the notice on clicking dismiss button.
|
8 |
+
*/
|
9 |
+
add_action(
|
10 |
+
'admin_enqueue_scripts',
|
11 |
+
function () {
|
12 |
+
if ( current_user_can( 'manage_options' ) ) {
|
13 |
+
wp_localize_script(
|
14 |
+
'jquery',
|
15 |
+
'quick_adsense_adstxt_adsense',
|
16 |
+
[
|
17 |
+
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
18 |
+
'nonce' => wp_create_nonce( 'quick-adsense-adstxt-adsense-nonce' ),
|
19 |
+
]
|
20 |
+
);
|
21 |
+
wp_add_inline_script(
|
22 |
+
'jquery',
|
23 |
+
quick_adsense_load_file( 'templates/js/script-admin-notice.php' )
|
24 |
+
);
|
25 |
+
}
|
26 |
+
}
|
27 |
+
);
|
28 |
+
|
29 |
+
/**
|
30 |
+
* This function checks for and displays the admin notice when needed.
|
31 |
+
*
|
32 |
+
* @param boolean $is_ajax Specific where the function is being called during an ajax call.
|
33 |
+
*/
|
34 |
+
function quick_adsense_adstxt_adsense_admin_notice( $is_ajax = false ) {
|
35 |
+
if ( current_user_can( 'manage_options' ) ) {
|
36 |
+
if ( ! get_option( 'quick_adsense_adstxt_adsense_admin_notice_dismissed' ) ) {
|
37 |
+
$adstxt_new_adsense_entries = get_transient( 'quick_adsense_adstxt_adsense_autocheck_content' );
|
38 |
+
if ( 'CHECKED' !== $adstxt_new_adsense_entries ) {
|
39 |
+
if ( ! isset( $adstxt_new_adsense_entries ) || ( false === $adstxt_new_adsense_entries ) ) {
|
40 |
+
$adstxt_new_adsense_entries = quick_adsense_adstxt_adsense_get_status();
|
41 |
+
}
|
42 |
+
if ( ( false !== $adstxt_new_adsense_entries ) && is_array( $adstxt_new_adsense_entries ) ) {
|
43 |
+
set_transient( 'quick_adsense_adstxt_adsense_autocheck_content', $adstxt_new_adsense_entries, DAY_IN_SECONDS );
|
44 |
+
$screen = get_current_screen();
|
45 |
+
quick_adsense_load_file(
|
46 |
+
'templates/block-adsense-adstxt-notice.php',
|
47 |
+
[
|
48 |
+
'screen_id' => $screen->id,
|
49 |
+
'is_ajax' => $is_ajax,
|
50 |
+
'adstxt_new_adsense_entries' => implode( '<br />', $adstxt_new_adsense_entries ),
|
51 |
+
],
|
52 |
+
true
|
53 |
+
);
|
54 |
+
} else {
|
55 |
+
set_transient( 'quick_adsense_adstxt_adsense_autocheck_content', 'CHECKED', DAY_IN_SECONDS );
|
56 |
+
}
|
57 |
+
}
|
58 |
+
}
|
59 |
+
}
|
60 |
+
}
|
61 |
+
add_action( 'admin_notices', 'quick_adsense_adstxt_adsense_admin_notice' );
|
62 |
+
|
63 |
+
/**
|
64 |
+
* This function checks whether new entries need to be added to ads.txt based on the adcodes added.
|
65 |
+
*
|
66 |
+
* @return mixed False is no changes are needed, New ads.txt lines as an array if changes are required.
|
67 |
+
*/
|
68 |
+
function quick_adsense_adstxt_adsense_get_status() {
|
69 |
+
$file_handler = new QuickAdsense\FileHandler( 'ads.txt' );
|
70 |
+
if ( $file_handler->exists() ) {
|
71 |
+
$adsense_publisher_ids = quick_adsense_adstxt_adsense_get_publisherids();
|
72 |
+
$adstxt_content = $file_handler->read();
|
73 |
+
if ( false !== $adstxt_content ) {
|
74 |
+
$adstxt_content_data = array_filter( explode( "\n", trim( $adstxt_content ) ), 'trim' );
|
75 |
+
if ( is_array( $adstxt_content_data ) ) {
|
76 |
+
$adstxt_existing_adsense_entries = [];
|
77 |
+
foreach ( $adstxt_content_data as $line ) {
|
78 |
+
if ( strpos( $line, 'google.com' ) !== false ) {
|
79 |
+
$adstxt_existing_adsense_entries[] = $line;
|
80 |
+
}
|
81 |
+
}
|
82 |
+
|
83 |
+
$adstxt_new_adsense_entries = [];
|
84 |
+
if ( count( $adstxt_existing_adsense_entries ) === 0 ) {
|
85 |
+
if ( is_array( $adsense_publisher_ids ) && ( count( $adsense_publisher_ids ) > 0 ) ) {
|
86 |
+
foreach ( $adsense_publisher_ids as $adsense_publisher_id ) {
|
87 |
+
$adstxt_new_adsense_entries[] = 'google.com, ' . $adsense_publisher_id . ', DIRECT, f08c47fec0942fa0';
|
88 |
+
}
|
89 |
+
}
|
90 |
+
} else {
|
91 |
+
if ( is_array( $adsense_publisher_ids ) && ( count( $adsense_publisher_ids ) > 0 ) ) {
|
92 |
+
foreach ( $adsense_publisher_ids as $adsense_publisher_id ) {
|
93 |
+
$entry_exists = false;
|
94 |
+
foreach ( $adstxt_existing_adsense_entries as $adstxt_existing_adsense_entry ) {
|
95 |
+
if ( strpos( $adstxt_existing_adsense_entry, $adsense_publisher_id ) !== false ) {
|
96 |
+
$entry_exists = true;
|
97 |
+
}
|
98 |
+
}
|
99 |
+
if ( false === $entry_exists ) {
|
100 |
+
$adstxt_new_adsense_entries[] = 'google.com, ' . $adsense_publisher_id . ', DIRECT, f08c47fec0942fa0';
|
101 |
+
}
|
102 |
+
}
|
103 |
+
}
|
104 |
+
}
|
105 |
+
}
|
106 |
+
}
|
107 |
+
}
|
108 |
+
if ( isset( $adstxt_new_adsense_entries ) && count( $adstxt_new_adsense_entries ) > 0 ) {
|
109 |
+
return $adstxt_new_adsense_entries;
|
110 |
+
}
|
111 |
+
return false;
|
112 |
+
}
|
113 |
+
|
114 |
+
/**
|
115 |
+
* Function to extract publisher Ids from settings.
|
116 |
+
*
|
117 |
+
* @return mixed False if no publisher ids found, Array of publisher ids if publisher ids found.
|
118 |
+
*/
|
119 |
+
function quick_adsense_adstxt_adsense_get_publisherids() {
|
120 |
+
$adsense_publisher_ids = [];
|
121 |
+
|
122 |
+
$settings = get_option( 'quick_adsense_settings' );
|
123 |
+
if ( isset( $settings ) && is_array( $settings ) ) {
|
124 |
+
for ( $i = 1; $i <= 10; $i++ ) {
|
125 |
+
if ( isset( $settings[ 'onpost_ad_' . $i . '_content' ] ) && ( '' !== $settings[ 'onpost_ad_' . $i . '_content' ] ) ) {
|
126 |
+
$temp = quick_adsense_adstxt_adsense_extract_publisherids( $settings[ 'onpost_ad_' . $i . '_content' ] );
|
127 |
+
if ( false !== $temp ) {
|
128 |
+
$adsense_publisher_ids = array_merge( $adsense_publisher_ids, $temp );
|
129 |
+
}
|
130 |
+
}
|
131 |
+
|
132 |
+
if ( isset( $settings[ 'widget_ad_' . $i . '_content' ] ) && ( '' !== $settings[ 'widget_ad_' . $i . '_content' ] ) ) {
|
133 |
+
$temp = quick_adsense_adstxt_adsense_extract_publisherids( $settings[ 'widget_ad_' . $i . '_content' ] );
|
134 |
+
if ( false !== $temp ) {
|
135 |
+
$adsense_publisher_ids = array_merge( $adsense_publisher_ids, $temp );
|
136 |
+
}
|
137 |
+
}
|
138 |
+
|
139 |
+
if ( isset( $settings['header_embed_code'] ) && ( '' !== $settings['header_embed_code'] ) ) {
|
140 |
+
$temp = quick_adsense_adstxt_adsense_extract_publisherids( $settings['header_embed_code'] );
|
141 |
+
if ( false !== $temp ) {
|
142 |
+
$adsense_publisher_ids = array_merge( $adsense_publisher_ids, $temp );
|
143 |
+
}
|
144 |
+
}
|
145 |
+
|
146 |
+
if ( isset( $settings['footer_embed_code'] ) && ( '' !== $settings['footer_embed_code'] ) ) {
|
147 |
+
$temp = quick_adsense_adstxt_adsense_extract_publisherids( $settings['footer_embed_code'] );
|
148 |
+
if ( false !== $temp ) {
|
149 |
+
$adsense_publisher_ids = array_merge( $adsense_publisher_ids, $temp );
|
150 |
+
}
|
151 |
+
}
|
152 |
+
}
|
153 |
+
}
|
154 |
+
$adsense_publisher_ids = array_unique( $adsense_publisher_ids );
|
155 |
+
|
156 |
+
if ( count( $adsense_publisher_ids ) > 0 ) {
|
157 |
+
return $adsense_publisher_ids;
|
158 |
+
}
|
159 |
+
return false;
|
160 |
+
}
|
161 |
+
|
162 |
+
/**
|
163 |
+
* Function to extract publisher Ids from provided adcode.
|
164 |
+
*
|
165 |
+
* @param string $ad_code The ad code.
|
166 |
+
*
|
167 |
+
* @return mixed False if no publisher ids found, Array of publisher ids if publisher ids found.
|
168 |
+
*/
|
169 |
+
function quick_adsense_adstxt_adsense_extract_publisherids( $ad_code ) {
|
170 |
+
$publisher_ids = [];
|
171 |
+
if ( isset( $ad_code ) && ( '' !== $ad_code ) ) {
|
172 |
+
if ( preg_match( '/googlesyndication.com/', $ad_code ) ) {
|
173 |
+
if ( preg_match( '/data-ad-client=/', $ad_code ) ) {
|
174 |
+
// ASYNC AD CODE.
|
175 |
+
$ad_code_parts = explode( 'data-ad-client', $ad_code );
|
176 |
+
} elseif ( preg_match( '/client=ca-pub-/', $ad_code ) ) {
|
177 |
+
// NEW ASYNC AD CODE.
|
178 |
+
$ad_code_parts = explode( 'ca-pub-', str_replace( 'ca-pub-', 'ca-pub-"', $ad_code ) );
|
179 |
+
} else {
|
180 |
+
// ORDINARY AD CODE.
|
181 |
+
$ad_code_parts = explode( 'google_ad_client', $ad_code );
|
182 |
+
}
|
183 |
+
if ( isset( $ad_code_parts[1] ) && ( '' !== $ad_code_parts[1] ) ) {
|
184 |
+
preg_match( '#"([a-zA-Z0-9-\s]+)"#', stripslashes( $ad_code_parts[1] ), $matches );
|
185 |
+
if ( isset( $matches[1] ) && ( '' !== $matches[1] ) ) {
|
186 |
+
$publisher_ids[] = str_replace( [ '"', ' ', 'ca-' ], [ '' ], $matches[1] );
|
187 |
+
}
|
188 |
+
}
|
189 |
+
}
|
190 |
+
}
|
191 |
+
|
192 |
+
if ( count( $publisher_ids ) > 0 ) {
|
193 |
+
return $publisher_ids;
|
194 |
+
}
|
195 |
+
return false;
|
196 |
+
}
|
197 |
+
|
198 |
+
/**
|
199 |
+
* This action dismisses the Ads.txt admin notice permanently.
|
200 |
+
*/
|
201 |
+
add_action(
|
202 |
+
'wp_ajax_quick_adsense_adstxt_adsense_admin_notice_dismiss',
|
203 |
+
function () {
|
204 |
+
if ( isset( $_POST['nonce'] ) && wp_verify_nonce( sanitize_key( $_POST['nonce'] ), 'quick-adsense-adstxt-adsense-nonce' ) && ( current_user_can( 'manage_options' ) ) ) {
|
205 |
+
update_option( 'quick_adsense_adstxt_adsense_admin_notice_dismissed', 'true' );
|
206 |
+
wp_send_json_success();
|
207 |
+
}
|
208 |
+
wp_send_json_error();
|
209 |
+
}
|
210 |
+
);
|
211 |
+
|
212 |
+
/**
|
213 |
+
* This action handles the Ajax trigerred Ads.txt update.
|
214 |
+
*/
|
215 |
+
add_action(
|
216 |
+
'wp_ajax_quick_adsense_adstxt_adsense_auto_update',
|
217 |
+
function () {
|
218 |
+
if ( isset( $_POST['nonce'] ) && wp_verify_nonce( sanitize_key( $_POST['nonce'] ), 'quick-adsense-adstxt-adsense-nonce' ) && ( current_user_can( 'manage_options' ) ) ) {
|
219 |
+
$adstxt_new_adsense_entries = quick_adsense_adstxt_adsense_get_status();
|
220 |
+
$file_handler = new QuickAdsense\FileHandler( 'ads.txt' );
|
221 |
+
if ( false !== $adstxt_new_adsense_entries ) {
|
222 |
+
$adstxt_content = $file_handler->read();
|
223 |
+
$adstxt_content_data = array_filter( explode( "\n", trim( $adstxt_content ) ), 'trim' );
|
224 |
+
$adstxt_updated_content = array_filter( array_merge( $adstxt_content_data, $adstxt_new_adsense_entries ), 'trim' );
|
225 |
+
}
|
226 |
+
if ( isset( $adstxt_updated_content ) && is_array( $adstxt_updated_content ) && ( count( $adstxt_updated_content ) > 0 ) ) {
|
227 |
+
$adstxt_updated_content = implode( "\n", $adstxt_updated_content );
|
228 |
+
if ( $file_handler->write( $adstxt_updated_content ) ) {
|
229 |
+
wp_send_json_success();
|
230 |
+
} else {
|
231 |
+
wp_send_json_error(
|
232 |
+
quick_adsense_load_file(
|
233 |
+
'templates/block-adsense-adstxt-update-failed.php',
|
234 |
+
[
|
235 |
+
'content' => $adstxt_updated_content,
|
236 |
+
]
|
237 |
+
)
|
238 |
+
);
|
239 |
+
}
|
240 |
+
}
|
241 |
+
}
|
242 |
+
wp_send_json_error();
|
243 |
+
}
|
244 |
+
);
|
includes/loader.php
CHANGED
@@ -1,24 +1,24 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Return the content of the File after processing.
|
4 |
-
*
|
5 |
-
* @param string $file File name.
|
6 |
-
* @param array $args Data to pass to the file.
|
7 |
-
* @param boolean $echo Choose whether to echo or return the output.
|
8 |
-
*/
|
9 |
-
function quick_adsense_load_file( $file, $args = [], $echo = false ) {
|
10 |
-
if ( ( '' !== $file ) && file_exists( dirname( __FILE__ ) . '/' . $file ) ) {
|
11 |
-
//phpcs:disable WordPress.PHP.DontExtract.extract_extract
|
12 |
-
// Usage of extract() is necessary in this content to simulate templating functionality.
|
13 |
-
extract( $args );
|
14 |
-
//phpcs:enable
|
15 |
-
ob_start();
|
16 |
-
include dirname( __FILE__ ) . '/' . $file;
|
17 |
-
$content = ob_get_contents();
|
18 |
-
ob_end_clean();
|
19 |
-
if ( $echo ) {
|
20 |
-
echo wp_kses( $content, quick_adsense_get_allowed_html() );
|
21 |
-
}
|
22 |
-
return $content;
|
23 |
-
}
|
24 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Return the content of the File after processing.
|
4 |
+
*
|
5 |
+
* @param string $file File name.
|
6 |
+
* @param array $args Data to pass to the file.
|
7 |
+
* @param boolean $echo Choose whether to echo or return the output.
|
8 |
+
*/
|
9 |
+
function quick_adsense_load_file( $file, $args = [], $echo = false ) {
|
10 |
+
if ( ( '' !== $file ) && file_exists( dirname( __FILE__ ) . '/' . $file ) ) {
|
11 |
+
//phpcs:disable WordPress.PHP.DontExtract.extract_extract
|
12 |
+
// Usage of extract() is necessary in this content to simulate templating functionality.
|
13 |
+
extract( $args );
|
14 |
+
//phpcs:enable
|
15 |
+
ob_start();
|
16 |
+
include dirname( __FILE__ ) . '/' . $file;
|
17 |
+
$content = ob_get_contents();
|
18 |
+
ob_end_clean();
|
19 |
+
if ( $echo ) {
|
20 |
+
echo wp_kses( $content, quick_adsense_get_allowed_html() );
|
21 |
+
}
|
22 |
+
return $content;
|
23 |
+
}
|
24 |
+
}
|
includes/settings.php
CHANGED
@@ -1,177 +1,192 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* The plugin settings page.
|
4 |
-
*/
|
5 |
-
|
6 |
-
/**
|
7 |
-
* Add a settings page link to the plugin listing in the plugins admin page.
|
8 |
-
*/
|
9 |
-
add_action(
|
10 |
-
'plugin_action_links_quick-adsense/quick-adsense.php',
|
11 |
-
function ( $links ) {
|
12 |
-
$links = array_merge(
|
13 |
-
[ '<a href="' . esc_url( admin_url( '/admin.php?page=quick-adsense' ) ) . '">Settings</a>' ],
|
14 |
-
$links
|
15 |
-
);
|
16 |
-
return $links;
|
17 |
-
}
|
18 |
-
);
|
19 |
-
|
20 |
-
/**
|
21 |
-
* Create the Admin menu entry for the settings page.
|
22 |
-
*/
|
23 |
-
add_action(
|
24 |
-
'admin_menu',
|
25 |
-
function () {
|
26 |
-
add_menu_page(
|
27 |
-
'Quick Adsense Options',
|
28 |
-
'Quick Adsense',
|
29 |
-
'manage_options',
|
30 |
-
'quick-adsense',
|
31 |
-
function () {
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
wp_enqueue_script( 'quick-adsense-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
);
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
'
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
'
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
'
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
119 |
-
},
|
120 |
-
'quick-adsense-
|
121 |
-
);
|
122 |
-
$settings['location'] = '
|
123 |
-
add_settings_section(
|
124 |
-
'
|
125 |
-
'',
|
126 |
-
function () use ( $settings ) {
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
);
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
|
147 |
-
|
148 |
-
|
149 |
-
|
150 |
-
|
151 |
-
|
152 |
-
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
-
|
157 |
-
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
|
169 |
-
|
170 |
-
|
171 |
-
|
172 |
-
|
173 |
-
|
174 |
-
|
175 |
-
|
176 |
-
|
177 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* The plugin settings page.
|
4 |
+
*/
|
5 |
+
|
6 |
+
/**
|
7 |
+
* Add a settings page link to the plugin listing in the plugins admin page.
|
8 |
+
*/
|
9 |
+
add_action(
|
10 |
+
'plugin_action_links_quick-adsense/quick-adsense.php',
|
11 |
+
function ( $links ) {
|
12 |
+
$links = array_merge(
|
13 |
+
[ '<a href="' . esc_url( admin_url( '/admin.php?page=quick-adsense' ) ) . '">Settings</a>' ],
|
14 |
+
$links
|
15 |
+
);
|
16 |
+
return $links;
|
17 |
+
}
|
18 |
+
);
|
19 |
+
|
20 |
+
/**
|
21 |
+
* Create the Admin menu entry for the settings page.
|
22 |
+
*/
|
23 |
+
add_action(
|
24 |
+
'admin_menu',
|
25 |
+
function () {
|
26 |
+
add_menu_page(
|
27 |
+
'Quick Adsense Options',
|
28 |
+
'Quick Adsense',
|
29 |
+
'manage_options',
|
30 |
+
'quick-adsense',
|
31 |
+
function () {
|
32 |
+
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
|
33 |
+
// Contains textareas which need to allow output of scripts, iframes etc necessary to output ads and trackers.
|
34 |
+
echo quick_adsense_load_file( 'templates/page-settings.php' );
|
35 |
+
// phpcs:enable
|
36 |
+
}
|
37 |
+
);
|
38 |
+
}
|
39 |
+
);
|
40 |
+
|
41 |
+
/**
|
42 |
+
* Add scripts and styles for Settings page.
|
43 |
+
*/
|
44 |
+
add_action(
|
45 |
+
'admin_enqueue_scripts',
|
46 |
+
function ( $hook ) {
|
47 |
+
global $wp_scripts;
|
48 |
+
if ( ( 'toplevel_page_quick-adsense' === $hook ) && ( current_user_can( 'manage_options' ) ) ) {
|
49 |
+
wp_enqueue_script( 'quick-adsense-chart-scripts', plugins_url( '../assets/js/chart.min.js', __FILE__ ), [ 'jquery', 'jquery-ui-core', 'jquery-ui-accordion', 'jquery-ui-dialog' ], '3.7.1', false );
|
50 |
+
wp_enqueue_style( 'quick-adsense-jquery-ui-styles', plugins_url( '../assets/css/jquery-ui.min.css', __FILE__ ), [], '1.9.1' );
|
51 |
+
wp_enqueue_style( 'quick-adsense-admin-styles', plugins_url( '../assets/css/admin.css', __FILE__ ), [], '2.8.2' );
|
52 |
+
wp_enqueue_script( 'quick-adsense-admin-scripts', plugins_url( '../assets/js/admin.js', __FILE__ ), [ 'jquery', 'jquery-ui-core', 'jquery-ui-tabs', 'wp-util' ], '2.8.2', false );
|
53 |
+
wp_localize_script(
|
54 |
+
'quick-adsense-admin-scripts',
|
55 |
+
'quick_adsense',
|
56 |
+
[
|
57 |
+
'ajax_url' => admin_url( 'admin-ajax.php' ),
|
58 |
+
'nonce' => wp_create_nonce( 'quick-adsense-nonce' ),
|
59 |
+
]
|
60 |
+
);
|
61 |
+
}
|
62 |
+
}
|
63 |
+
);
|
64 |
+
|
65 |
+
/**
|
66 |
+
* Register settings and sections.
|
67 |
+
*/
|
68 |
+
add_action(
|
69 |
+
'admin_init',
|
70 |
+
function () {
|
71 |
+
if ( current_user_can( 'manage_options' ) ) {
|
72 |
+
register_setting(
|
73 |
+
'quick_adsense_settings',
|
74 |
+
'quick_adsense_settings',
|
75 |
+
function ( $input ) {
|
76 |
+
delete_transient( 'quick_adsense_adstxt_adsense_autocheck_content' );
|
77 |
+
return $input;
|
78 |
+
}
|
79 |
+
);
|
80 |
+
$settings = get_option( 'quick_adsense_settings' );
|
81 |
+
$settings['alignment_options'] = [
|
82 |
+
[
|
83 |
+
'text' => 'Left',
|
84 |
+
'value' => '1',
|
85 |
+
],
|
86 |
+
[
|
87 |
+
'text' => 'Center',
|
88 |
+
'value' => '2',
|
89 |
+
],
|
90 |
+
[
|
91 |
+
'text' => 'Right',
|
92 |
+
'value' => '3',
|
93 |
+
],
|
94 |
+
[
|
95 |
+
'text' => 'None',
|
96 |
+
'value' => '4',
|
97 |
+
],
|
98 |
+
];
|
99 |
+
add_settings_section(
|
100 |
+
'quick_adsense_general',
|
101 |
+
'',
|
102 |
+
function () use ( $settings ) {
|
103 |
+
echo wp_kses(
|
104 |
+
quick_adsense_load_file( 'templates/section-general.php', $settings ),
|
105 |
+
quick_adsense_get_allowed_html()
|
106 |
+
);
|
107 |
+
},
|
108 |
+
'quick-adsense-general'
|
109 |
+
);
|
110 |
+
$settings['location'] = 'onpost';
|
111 |
+
add_settings_section(
|
112 |
+
'quick_adsense_onpost',
|
113 |
+
'',
|
114 |
+
function () use ( $settings ) {
|
115 |
+
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
|
116 |
+
// Contains textareas which need to allow output of scripts, iframes etc necessary to output ads and trackers.
|
117 |
+
echo quick_adsense_load_file( 'templates/section-onpost-content.php', $settings );
|
118 |
+
// phpcs:enable
|
119 |
+
},
|
120 |
+
'quick-adsense-onpost'
|
121 |
+
);
|
122 |
+
$settings['location'] = 'widgets';
|
123 |
+
add_settings_section(
|
124 |
+
'quick_adsense_widgets',
|
125 |
+
'',
|
126 |
+
function () use ( $settings ) {
|
127 |
+
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
|
128 |
+
// Contains textareas which need to allow output of scripts, iframes etc necessary to output ads and trackers.
|
129 |
+
echo quick_adsense_load_file( 'templates/section-widgets.php', $settings );
|
130 |
+
// phpcs:enable
|
131 |
+
},
|
132 |
+
'quick-adsense-widgets'
|
133 |
+
);
|
134 |
+
$settings['location'] = 'header_footer_codes';
|
135 |
+
add_settings_section(
|
136 |
+
'quick_adsense_header_footer_codes',
|
137 |
+
'',
|
138 |
+
function () use ( $settings ) {
|
139 |
+
// phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
|
140 |
+
// Contains textareas which need to allow output of scripts, iframes etc necessary to output ads and trackers.
|
141 |
+
echo quick_adsense_load_file( 'templates/section-header-footer.php', $settings );
|
142 |
+
// phpcs:enable
|
143 |
+
},
|
144 |
+
'quick-adsense-header-footer-codes'
|
145 |
+
);
|
146 |
+
}
|
147 |
+
}
|
148 |
+
);
|
149 |
+
|
150 |
+
add_action(
|
151 |
+
'wp_ajax_quick_adsense_onpost_ad_reset_stats',
|
152 |
+
function () {
|
153 |
+
if ( isset( $_POST['nonce'] ) && wp_verify_nonce( sanitize_key( $_POST['nonce'] ), 'quick-adsense-nonce' ) && ( isset( $_POST['index'] ) ) && ( current_user_can( 'manage_options' ) ) ) {
|
154 |
+
delete_option( 'quick_adsense_onpost_ad_' . sanitize_key( $_POST['index'] ) . '_stats' );
|
155 |
+
wp_send_json_success();
|
156 |
+
}
|
157 |
+
wp_send_json_error();
|
158 |
+
}
|
159 |
+
);
|
160 |
+
|
161 |
+
|
162 |
+
add_action(
|
163 |
+
'wp_ajax_quick_adsense_onpost_ad_get_stats_chart',
|
164 |
+
function () {
|
165 |
+
if ( isset( $_POST['nonce'] ) && wp_verify_nonce( sanitize_key( $_POST['nonce'] ), 'quick-adsense-nonce' ) && ( isset( $_POST['index'] ) ) && ( current_user_can( 'manage_options' ) ) ) {
|
166 |
+
$stats = get_option( 'quick_adsense_onpost_ad_' . sanitize_key( $_POST['index'] ) . '_stats' );
|
167 |
+
$stats_data = [];
|
168 |
+
for ( $i = 0; $i < 30; $i++ ) {
|
169 |
+
$clicks = 0;
|
170 |
+
$impressions = 0;
|
171 |
+
if ( isset( $stats ) && is_array( $stats ) && isset( $stats[ gmdate( 'dmY', strtotime( '-' . $i . ' day' ) ) ] ) ) {
|
172 |
+
$clicks = $stats[ gmdate( 'dmY', strtotime( '-' . $i . ' day' ) ) ]['c'];
|
173 |
+
$impressions = $stats[ gmdate( 'dmY', strtotime( '-' . $i . ' day' ) ) ]['i'];
|
174 |
+
}
|
175 |
+
$stats_data[] = [
|
176 |
+
'x' => gmdate( 'm/d/Y', strtotime( '-' . $i . ' day' ) ),
|
177 |
+
'y' => $impressions,
|
178 |
+
'y1' => $clicks,
|
179 |
+
];
|
180 |
+
}
|
181 |
+
wp_send_json_success(
|
182 |
+
quick_adsense_load_file(
|
183 |
+
'templates/block-stats-chart.php',
|
184 |
+
[
|
185 |
+
'stats_data' => wp_json_encode( $stats_data ),
|
186 |
+
]
|
187 |
+
)
|
188 |
+
);
|
189 |
+
}
|
190 |
+
wp_send_json_error();
|
191 |
+
}
|
192 |
+
);
|
includes/templates/adunit-onpost.php
CHANGED
@@ -1,61 +1,61 @@
|
|
1 |
-
<?php $adunit_index = quick_adsense_get_value( $args, 'adunit_index' ); ?>
|
2 |
-
<div id="quick_adsense_onpost_adunits_control_<?php echo esc_attr( $adunit_index ); ?>" class="quick_adsense_onpost_adunits_control_wrapper">
|
3 |
-
<div class="quick_adsense_onpost_adunits_label">Ads<?php echo esc_attr( $adunit_index ); ?></div>
|
4 |
-
<div class="quick_adsense_onpost_adunits_control">
|
5 |
-
<?php
|
6 |
-
echo wp_kses(
|
7 |
-
quickadsense_get_control(
|
8 |
-
'textarea',
|
9 |
-
'',
|
10 |
-
'quick_adsense_settings_onpost_ad_' . $adunit_index . '_content',
|
11 |
-
'quick_adsense_settings[onpost_ad_' . $adunit_index . '_content]',
|
12 |
-
quick_adsense_get_value( $args, 'onpost_ad_' . $adunit_index . '_content' ),
|
13 |
-
null,
|
14 |
-
'input',
|
15 |
-
'display: block; margin: 0 0 10px 0',
|
16 |
-
'Enter Code'
|
17 |
-
),
|
18 |
-
quick_adsense_get_allowed_html()
|
19 |
-
);
|
20 |
-
?>
|
21 |
-
<p class="quick_adsense_onpost_adunits_styling_controls">
|
22 |
-
Alignment
|
23 |
-
<?php
|
24 |
-
echo wp_kses(
|
25 |
-
quickadsense_get_control(
|
26 |
-
'select',
|
27 |
-
'',
|
28 |
-
'quick_adsense_settings_onpost_ad_' . $adunit_index . '_alignment',
|
29 |
-
'quick_adsense_settings[onpost_ad_' . $adunit_index . '_alignment]',
|
30 |
-
quick_adsense_get_value( $args, 'onpost_ad_' . $adunit_index . '_alignment' ),
|
31 |
-
quick_adsense_get_value( $args, 'alignment_options' ),
|
32 |
-
'input',
|
33 |
-
'margin: -2px 20px 0 10px;'
|
34 |
-
),
|
35 |
-
quick_adsense_get_allowed_html()
|
36 |
-
);
|
37 |
-
?>
|
38 |
-
<wbr />margin
|
39 |
-
<?php
|
40 |
-
echo wp_kses(
|
41 |
-
quickadsense_get_control(
|
42 |
-
'number',
|
43 |
-
'',
|
44 |
-
'quick_adsense_settings_onpost_ad_' . $adunit_index . '_margin',
|
45 |
-
'quick_adsense_settings[onpost_ad_' . $adunit_index . '_margin]',
|
46 |
-
quick_adsense_get_value( $args, 'onpost_ad_' . $adunit_index . '_margin' ),
|
47 |
-
null,
|
48 |
-
'input',
|
49 |
-
'margin: -2px 10px 0 10px; width: 52px;'
|
50 |
-
),
|
51 |
-
quick_adsense_get_allowed_html()
|
52 |
-
);
|
53 |
-
?>
|
54 |
-
px
|
55 |
-
</p>
|
56 |
-
<?php
|
57 |
-
quick_adsense_load_file( 'templates/block-adunit-advanced.php', $args, true );
|
58 |
-
?>
|
59 |
-
</div>
|
60 |
-
<div class="clear"></div>
|
61 |
-
</div>
|
1 |
+
<?php $adunit_index = quick_adsense_get_value( $args, 'adunit_index' ); ?>
|
2 |
+
<div id="quick_adsense_onpost_adunits_control_<?php echo esc_attr( $adunit_index ); ?>" class="quick_adsense_onpost_adunits_control_wrapper">
|
3 |
+
<div class="quick_adsense_onpost_adunits_label">Ads<?php echo esc_attr( $adunit_index ); ?></div>
|
4 |
+
<div class="quick_adsense_onpost_adunits_control">
|
5 |
+
<?php
|
6 |
+
echo wp_kses(
|
7 |
+
quickadsense_get_control(
|
8 |
+
'textarea',
|
9 |
+
'',
|
10 |
+
'quick_adsense_settings_onpost_ad_' . $adunit_index . '_content',
|
11 |
+
'quick_adsense_settings[onpost_ad_' . $adunit_index . '_content]',
|
12 |
+
quick_adsense_get_value( $args, 'onpost_ad_' . $adunit_index . '_content' ),
|
13 |
+
null,
|
14 |
+
'input',
|
15 |
+
'display: block; margin: 0 0 10px 0',
|
16 |
+
'Enter Code'
|
17 |
+
),
|
18 |
+
quick_adsense_get_allowed_html()
|
19 |
+
);
|
20 |
+
?>
|
21 |
+
<p class="quick_adsense_onpost_adunits_styling_controls">
|
22 |
+
Alignment
|
23 |
+
<?php
|
24 |
+
echo wp_kses(
|
25 |
+
quickadsense_get_control(
|
26 |
+
'select',
|
27 |
+
'',
|
28 |
+
'quick_adsense_settings_onpost_ad_' . $adunit_index . '_alignment',
|
29 |
+
'quick_adsense_settings[onpost_ad_' . $adunit_index . '_alignment]',
|
30 |
+
quick_adsense_get_value( $args, 'onpost_ad_' . $adunit_index . '_alignment' ),
|
31 |
+
quick_adsense_get_value( $args, 'alignment_options' ),
|
32 |
+
'input',
|
33 |
+
'margin: -2px 20px 0 10px;'
|
34 |
+
),
|
35 |
+
quick_adsense_get_allowed_html()
|
36 |
+
);
|
37 |
+
?>
|
38 |
+
<wbr />margin
|
39 |
+
<?php
|
40 |
+
echo wp_kses(
|
41 |
+
quickadsense_get_control(
|
42 |
+
'number',
|
43 |
+
'',
|
44 |
+
'quick_adsense_settings_onpost_ad_' . $adunit_index . '_margin',
|
45 |
+
'quick_adsense_settings[onpost_ad_' . $adunit_index . '_margin]',
|
46 |
+
quick_adsense_get_value( $args, 'onpost_ad_' . $adunit_index . '_margin' ),
|
47 |
+
null,
|
48 |
+
'input',
|
49 |
+
'margin: -2px 10px 0 10px; width: 52px;'
|
50 |
+
),
|
51 |
+
quick_adsense_get_allowed_html()
|
52 |
+
);
|
53 |
+
?>
|
54 |
+
px
|
55 |
+
</p>
|
56 |
+
<?php
|
57 |
+
quick_adsense_load_file( 'templates/block-adunit-advanced.php', $args, true );
|
58 |
+
?>
|
59 |
+
</div>
|
60 |
+
<div class="clear"></div>
|
61 |
+
</div>
|
includes/templates/adunit-widget.php
CHANGED
@@ -1,23 +1,23 @@
|
|
1 |
-
<?php $adunit_index = quick_adsense_get_value( $args, 'adunit_index' ); ?>
|
2 |
-
<div id="quick_adsense_widget_adunits_control_<?php echo esc_attr( $adunit_index ); ?>" class="quick_adsense_widget_adunits_control_wrapper">
|
3 |
-
<div class="quick_adsense_widget_adunits_label">AdsWidget<?php echo esc_attr( $adunit_index ); ?></div>
|
4 |
-
<div class="quick_adsense_widget_adunits_control">
|
5 |
-
<?php
|
6 |
-
echo wp_kses(
|
7 |
-
quickadsense_get_control(
|
8 |
-
'textarea',
|
9 |
-
'',
|
10 |
-
'quick_adsense_settings_widget_ad_' . $adunit_index . '_content',
|
11 |
-
'quick_adsense_settings[widget_ad_' . $adunit_index . '_content]',
|
12 |
-
quick_adsense_get_value( $args, 'widget_ad_' . $adunit_index . '_content' ),
|
13 |
-
null,
|
14 |
-
'input',
|
15 |
-
'display: block; margin: 0 0 10px 0;',
|
16 |
-
'Enter Code'
|
17 |
-
),
|
18 |
-
quick_adsense_get_allowed_html()
|
19 |
-
);
|
20 |
-
?>
|
21 |
-
</div>
|
22 |
-
<div class="clear"></div>
|
23 |
-
</div>
|
1 |
+
<?php $adunit_index = quick_adsense_get_value( $args, 'adunit_index' ); ?>
|
2 |
+
<div id="quick_adsense_widget_adunits_control_<?php echo esc_attr( $adunit_index ); ?>" class="quick_adsense_widget_adunits_control_wrapper">
|
3 |
+
<div class="quick_adsense_widget_adunits_label">AdsWidget<?php echo esc_attr( $adunit_index ); ?></div>
|
4 |
+
<div class="quick_adsense_widget_adunits_control">
|
5 |
+
<?php
|
6 |
+
echo wp_kses(
|
7 |
+
quickadsense_get_control(
|
8 |
+
'textarea',
|
9 |
+
'',
|
10 |
+
'quick_adsense_settings_widget_ad_' . $adunit_index . '_content',
|
11 |
+
'quick_adsense_settings[widget_ad_' . $adunit_index . '_content]',
|
12 |
+
quick_adsense_get_value( $args, 'widget_ad_' . $adunit_index . '_content' ),
|
13 |
+
null,
|
14 |
+
'input',
|
15 |
+
'display: block; margin: 0 0 10px 0;',
|
16 |
+
'Enter Code'
|
17 |
+
),
|
18 |
+
quick_adsense_get_allowed_html()
|
19 |
+
);
|
20 |
+
?>
|
21 |
+
</div>
|
22 |
+
<div class="clear"></div>
|
23 |
+
</div>
|
includes/templates/section-general.php
CHANGED
@@ -1,13 +1,13 @@
|
|
1 |
-
<div class="quick_adsense_block">
|
2 |
-
<div class="quick_adsense_block_labels"><span>Options</span></div>
|
3 |
-
<div class="quick_adsense_block_controls">
|
4 |
-
<a id="quick_adsense_settings_reset_to_default" href="javascript:;">Reset to Default Settings</a>
|
5 |
-
</div>
|
6 |
-
<div class="clear"></div>
|
7 |
-
</div>
|
8 |
-
<?php
|
9 |
-
quick_adsense_load_file( 'templates/block-general-adsense.php', $args, true );
|
10 |
-
quick_adsense_load_file( 'templates/block-general-appearance.php', $args, true );
|
11 |
-
quick_adsense_load_file( 'templates/block-general-assign-position.php', $args, true );
|
12 |
-
quick_adsense_load_file( 'templates/block-general-quicktag.php', $args, true );
|
13 |
-
?>
|
1 |
+
<div class="quick_adsense_block">
|
2 |
+
<div class="quick_adsense_block_labels"><span>Options</span></div>
|
3 |
+
<div class="quick_adsense_block_controls">
|
4 |
+
<a id="quick_adsense_settings_reset_to_default" href="javascript:;">Reset to Default Settings</a>
|
5 |
+
</div>
|
6 |
+
<div class="clear"></div>
|
7 |
+
</div>
|
8 |
+
<?php
|
9 |
+
quick_adsense_load_file( 'templates/block-general-adsense.php', $args, true );
|
10 |
+
quick_adsense_load_file( 'templates/block-general-appearance.php', $args, true );
|
11 |
+
quick_adsense_load_file( 'templates/block-general-assign-position.php', $args, true );
|
12 |
+
quick_adsense_load_file( 'templates/block-general-quicktag.php', $args, true );
|
13 |
+
?>
|
includes/templates/section-onpost-content.php
CHANGED
@@ -1,85 +1,85 @@
|
|
1 |
-
<div id="quick_adsense_block_bottom" class="quick_adsense_block" style="margin: 30px 0 0;">
|
2 |
-
<div class="quick_adsense_block_labels" style="width: auto;">
|
3 |
-
<span>Adsense Codes - Ads on Post Body</span>
|
4 |
-
</div>
|
5 |
-
<div class="clear"></div>
|
6 |
-
<p>Paste up to 10 Ads codes on Post Body as assigned above. Ads codes provided must not be identical, repeated codes may result the Ads not being display correctly. Ads will never displays more than once in a page.</p>
|
7 |
-
</div>
|
8 |
-
|
9 |
-
<div id="quick_adsense_onpost_content_controls_wrapper">
|
10 |
-
<div id="quick_adsense_onpost_content_global_controls_wrapper">
|
11 |
-
<p class="quick_adsense_onpost_adunits_styling_controls">
|
12 |
-
<?php
|
13 |
-
echo wp_kses(
|
14 |
-
quickadsense_get_control(
|
15 |
-
'checkbox',
|
16 |
-
'',
|
17 |
-
'quick_adsense_settings_onpost_enable_global_style',
|
18 |
-
'quick_adsense_settings[onpost_enable_global_style]',
|
19 |
-
quick_adsense_get_value( $args, 'onpost_enable_global_style' ),
|
20 |
-
null,
|
21 |
-
'input',
|
22 |
-
'margin: -3px 10px 0 0;'
|
23 |
-
),
|
24 |
-
quick_adsense_get_allowed_html()
|
25 |
-
);
|
26 |
-
?>
|
27 |
-
<span>Use for all</span>
|
28 |
-
<wbr />Alignment
|
29 |
-
<?php
|
30 |
-
echo wp_kses(
|
31 |
-
quickadsense_get_control(
|
32 |
-
'select',
|
33 |
-
'',
|
34 |
-
'quick_adsense_settings_onpost_global_alignment',
|
35 |
-
'quick_adsense_settings[onpost_global_alignment]',
|
36 |
-
quick_adsense_get_value( $args, 'onpost_global_alignment' ),
|
37 |
-
quick_adsense_get_value( $args, 'alignment_options' ),
|
38 |
-
'input',
|
39 |
-
'margin: -6px 20px 0 10px; width: 73px;'
|
40 |
-
),
|
41 |
-
quick_adsense_get_allowed_html()
|
42 |
-
);
|
43 |
-
?>
|
44 |
-
<wbr />margin
|
45 |
-
<?php
|
46 |
-
echo wp_kses(
|
47 |
-
quickadsense_get_control(
|
48 |
-
'number',
|
49 |
-
'',
|
50 |
-
'quick_adsense_settings_onpost_global_margin',
|
51 |
-
'quick_adsense_settings[onpost_global_margin]',
|
52 |
-
quick_adsense_get_value( $args, 'onpost_global_margin' ),
|
53 |
-
null,
|
54 |
-
'input',
|
55 |
-
'margin: -1px 10px 0 10px; width: 62px;'
|
56 |
-
),
|
57 |
-
quick_adsense_get_allowed_html()
|
58 |
-
);
|
59 |
-
?>
|
60 |
-
px
|
61 |
-
</p>
|
62 |
-
</div>
|
63 |
-
|
64 |
-
<div id="quick_adsense_onpost_content_adunits_wrapper">
|
65 |
-
<div id="quick_adsense_onpost_content_adunits_initial_wrapper">
|
66 |
-
<?php
|
67 |
-
for ( $i = 1; $i <= 3; $i++ ) {
|
68 |
-
$args['adunit_index'] = $i;
|
69 |
-
quick_adsense_load_file( 'templates/adunit-onpost.php', $args, true );
|
70 |
-
}
|
71 |
-
?>
|
72 |
-
</div>
|
73 |
-
<div id="quick_adsense_onpost_content_adunits_all_wrapper" style="display: none;">
|
74 |
-
<?php
|
75 |
-
for ( $i = 4; $i <= 10; $i++ ) {
|
76 |
-
$args['adunit_index'] = $i;
|
77 |
-
quick_adsense_load_file( 'templates/adunit-onpost.php', $args, true );
|
78 |
-
}
|
79 |
-
?>
|
80 |
-
</div>
|
81 |
-
<a id="quick_adsense_onpost_content_adunits_showall_button" class="input button-secondary">
|
82 |
-
<span class="dashicons dashicons-arrow-down"></span> <b>Show All</b>
|
83 |
-
</a>
|
84 |
-
</div>
|
85 |
-
</div>
|
1 |
+
<div id="quick_adsense_block_bottom" class="quick_adsense_block" style="margin: 30px 0 0;">
|
2 |
+
<div class="quick_adsense_block_labels" style="width: auto;">
|
3 |
+
<span>Adsense Codes - Ads on Post Body</span>
|
4 |
+
</div>
|
5 |
+
<div class="clear"></div>
|
6 |
+
<p>Paste up to 10 Ads codes on Post Body as assigned above. Ads codes provided must not be identical, repeated codes may result the Ads not being display correctly. Ads will never displays more than once in a page.</p>
|
7 |
+
</div>
|
8 |
+
|
9 |
+
<div id="quick_adsense_onpost_content_controls_wrapper">
|
10 |
+
<div id="quick_adsense_onpost_content_global_controls_wrapper">
|
11 |
+
<p class="quick_adsense_onpost_adunits_styling_controls">
|
12 |
+
<?php
|
13 |
+
echo wp_kses(
|
14 |
+
quickadsense_get_control(
|
15 |
+
'checkbox',
|
16 |
+
'',
|
17 |
+
'quick_adsense_settings_onpost_enable_global_style',
|
18 |
+
'quick_adsense_settings[onpost_enable_global_style]',
|
19 |
+
quick_adsense_get_value( $args, 'onpost_enable_global_style' ),
|
20 |
+
null,
|
21 |
+
'input',
|
22 |
+
'margin: -3px 10px 0 0;'
|
23 |
+
),
|
24 |
+
quick_adsense_get_allowed_html()
|
25 |
+
);
|
26 |
+
?>
|
27 |
+
<span>Use for all</span>
|
28 |
+
<wbr />Alignment
|
29 |
+
<?php
|
30 |
+
echo wp_kses(
|
31 |
+
quickadsense_get_control(
|
32 |
+
'select',
|
33 |
+
'',
|
34 |
+
'quick_adsense_settings_onpost_global_alignment',
|
35 |
+
'quick_adsense_settings[onpost_global_alignment]',
|
36 |
+
quick_adsense_get_value( $args, 'onpost_global_alignment' ),
|
37 |
+
quick_adsense_get_value( $args, 'alignment_options' ),
|
38 |
+
'input',
|
39 |
+
'margin: -6px 20px 0 10px; width: 73px;'
|
40 |
+
),
|
41 |
+
quick_adsense_get_allowed_html()
|
42 |
+
);
|
43 |
+
?>
|
44 |
+
<wbr />margin
|
45 |
+
<?php
|
46 |
+
echo wp_kses(
|
47 |
+
quickadsense_get_control(
|
48 |
+
'number',
|
49 |
+
'',
|
50 |
+
'quick_adsense_settings_onpost_global_margin',
|
51 |
+
'quick_adsense_settings[onpost_global_margin]',
|
52 |
+
quick_adsense_get_value( $args, 'onpost_global_margin' ),
|
53 |
+
null,
|
54 |
+
'input',
|
55 |
+
'margin: -1px 10px 0 10px; width: 62px;'
|
56 |
+
),
|
57 |
+
quick_adsense_get_allowed_html()
|
58 |
+
);
|
59 |
+
?>
|
60 |
+
px
|
61 |
+
</p>
|
62 |
+
</div>
|
63 |
+
|
64 |
+
<div id="quick_adsense_onpost_content_adunits_wrapper">
|
65 |
+
<div id="quick_adsense_onpost_content_adunits_initial_wrapper">
|
66 |
+
<?php
|
67 |
+
for ( $i = 1; $i <= 3; $i++ ) {
|
68 |
+
$args['adunit_index'] = $i;
|
69 |
+
quick_adsense_load_file( 'templates/adunit-onpost.php', $args, true );
|
70 |
+
}
|
71 |
+
?>
|
72 |
+
</div>
|
73 |
+
<div id="quick_adsense_onpost_content_adunits_all_wrapper" style="display: none;">
|
74 |
+
<?php
|
75 |
+
for ( $i = 4; $i <= 10; $i++ ) {
|
76 |
+
$args['adunit_index'] = $i;
|
77 |
+
quick_adsense_load_file( 'templates/adunit-onpost.php', $args, true );
|
78 |
+
}
|
79 |
+
?>
|
80 |
+
</div>
|
81 |
+
<a id="quick_adsense_onpost_content_adunits_showall_button" class="input button-secondary">
|
82 |
+
<span class="dashicons dashicons-arrow-down"></span> <b>Show All</b>
|
83 |
+
</a>
|
84 |
+
</div>
|
85 |
+
</div>
|
includes/templates/section-widgets.php
CHANGED
@@ -1,83 +1,83 @@
|
|
1 |
-
<div id="quick_adsense_block_bottom" class="quick_adsense_block" style="margin: 30px 0 0;">
|
2 |
-
<div class="quick_adsense_block_labels" style="width: auto;">
|
3 |
-
<span>Adsense Codes - <a href="<?php echo esc_url( admin_url( 'widgets.php' ) ); ?>">Sidebar WIdget</a></span>
|
4 |
-
</div>
|
5 |
-
<div class="clear"></div>
|
6 |
-
<p>Paste up to 10 Ads codes on Sidebar Widget. Ads codes provided must not be identical, repeated codes may result the Ads not being display correctly. Ads will never displays more than once in a page.</p>
|
7 |
-
</div>
|
8 |
-
|
9 |
-
<div id="quick_adsense_widget_controls_wrapper">
|
10 |
-
<div id="quick_adsense_widget_global_controls_wrapper" style="visibility: hidden;">
|
11 |
-
<p class="quick_adsense_widget_adunits_styling_controls">
|
12 |
-
<?php
|
13 |
-
echo wp_kses(
|
14 |
-
quickadsense_get_control(
|
15 |
-
'checkbox',
|
16 |
-
'',
|
17 |
-
'quick_adsense_settings_widget_enable_global_style',
|
18 |
-
'quick_adsense_settings[widget_enable_global_style]',
|
19 |
-
quick_adsense_get_value( $args, 'widget_enable_global_style' ),
|
20 |
-
null,
|
21 |
-
'input',
|
22 |
-
'margin: -3px 10px 0 0;'
|
23 |
-
),
|
24 |
-
quick_adsense_get_allowed_html()
|
25 |
-
);
|
26 |
-
?>
|
27 |
-
<span>Use for all</span>
|
28 |
-
<wbr />Alignment
|
29 |
-
<?php
|
30 |
-
echo wp_kses(
|
31 |
-
quickadsense_get_control(
|
32 |
-
'select',
|
33 |
-
'',
|
34 |
-
'quick_adsense_settings_widget_global_alignment',
|
35 |
-
'quick_adsense_settings[widget_global_alignment]',
|
36 |
-
quick_adsense_get_value( $args, 'widget_global_alignment' ),
|
37 |
-
quick_adsense_get_value( $args, 'alignment_options' ),
|
38 |
-
'input',
|
39 |
-
'margin: -6px 20px 0 10px; width: 73px;'
|
40 |
-
),
|
41 |
-
quick_adsense_get_allowed_html()
|
42 |
-
);
|
43 |
-
?>
|
44 |
-
<wbr />margin
|
45 |
-
<?php
|
46 |
-
echo wp_kses(
|
47 |
-
quickadsense_get_control(
|
48 |
-
'number',
|
49 |
-
'',
|
50 |
-
'quick_adsense_settings_widget_global_margin',
|
51 |
-
'quick_adsense_settings[widget_global_margin]',
|
52 |
-
quick_adsense_get_value( $args, 'widget_global_margin' ),
|
53 |
-
null,
|
54 |
-
'input',
|
55 |
-
'margin: -1px 10px 0 10px; width: 62px;'
|
56 |
-
),
|
57 |
-
quick_adsense_get_allowed_html()
|
58 |
-
);
|
59 |
-
?>
|
60 |
-
px
|
61 |
-
</p>
|
62 |
-
</div>
|
63 |
-
|
64 |
-
<div id="quick_adsense_widget_adunits_wrapper">
|
65 |
-
<div id="quick_adsense_widget_adunits_initial_wrapper">
|
66 |
-
<?php
|
67 |
-
for ( $i = 1; $i <= 3; $i++ ) {
|
68 |
-
$args['adunit_index'] = $i;
|
69 |
-
quick_adsense_load_file( 'templates/adunit-widget.php', $args, true );
|
70 |
-
}
|
71 |
-
?>
|
72 |
-
</div>
|
73 |
-
<div id="quick_adsense_widget_adunits_all_wrapper" style="display: none;">
|
74 |
-
<?php
|
75 |
-
for ( $i = 4; $i <= 10; $i++ ) {
|
76 |
-
$args['adunit_index'] = $i;
|
77 |
-
quick_adsense_load_file( 'templates/adunit-widget.php', $args, true );
|
78 |
-
}
|
79 |
-
?>
|
80 |
-
</div>
|
81 |
-
<a id="quick_adsense_widget_adunits_showall_button" class="input button-secondary"><span class="dashicons dashicons-arrow-down"></span> <b>Show All</b></a>
|
82 |
-
</div>
|
83 |
-
</div>
|
1 |
+
<div id="quick_adsense_block_bottom" class="quick_adsense_block" style="margin: 30px 0 0;">
|
2 |
+
<div class="quick_adsense_block_labels" style="width: auto;">
|
3 |
+
<span>Adsense Codes - <a href="<?php echo esc_url( admin_url( 'widgets.php' ) ); ?>">Sidebar WIdget</a></span>
|
4 |
+
</div>
|
5 |
+
<div class="clear"></div>
|
6 |
+
<p>Paste up to 10 Ads codes on Sidebar Widget. Ads codes provided must not be identical, repeated codes may result the Ads not being display correctly. Ads will never displays more than once in a page.</p>
|
7 |
+
</div>
|
8 |
+
|
9 |
+
<div id="quick_adsense_widget_controls_wrapper">
|
10 |
+
<div id="quick_adsense_widget_global_controls_wrapper" style="visibility: hidden;">
|
11 |
+
<p class="quick_adsense_widget_adunits_styling_controls">
|
12 |
+
<?php
|
13 |
+
echo wp_kses(
|
14 |
+
quickadsense_get_control(
|
15 |
+
'checkbox',
|
16 |
+
'',
|
17 |
+
'quick_adsense_settings_widget_enable_global_style',
|
18 |
+
'quick_adsense_settings[widget_enable_global_style]',
|
19 |
+
quick_adsense_get_value( $args, 'widget_enable_global_style' ),
|
20 |
+
null,
|
21 |
+
'input',
|
22 |
+
'margin: -3px 10px 0 0;'
|
23 |
+
),
|
24 |
+
quick_adsense_get_allowed_html()
|
25 |
+
);
|
26 |
+
?>
|
27 |
+
<span>Use for all</span>
|
28 |
+
<wbr />Alignment
|
29 |
+
<?php
|
30 |
+
echo wp_kses(
|
31 |
+
quickadsense_get_control(
|
32 |
+
'select',
|
33 |
+
'',
|
34 |
+
'quick_adsense_settings_widget_global_alignment',
|
35 |
+
'quick_adsense_settings[widget_global_alignment]',
|
36 |
+
quick_adsense_get_value( $args, 'widget_global_alignment' ),
|
37 |
+
quick_adsense_get_value( $args, 'alignment_options' ),
|
38 |
+
'input',
|
39 |
+
'margin: -6px 20px 0 10px; width: 73px;'
|
40 |
+
),
|
41 |
+
quick_adsense_get_allowed_html()
|
42 |
+
);
|
43 |
+
?>
|
44 |
+
<wbr />margin
|
45 |
+
<?php
|
46 |
+
echo wp_kses(
|
47 |
+
quickadsense_get_control(
|
48 |
+
'number',
|
49 |
+
'',
|
50 |
+
'quick_adsense_settings_widget_global_margin',
|
51 |
+
'quick_adsense_settings[widget_global_margin]',
|
52 |
+
quick_adsense_get_value( $args, 'widget_global_margin' ),
|
53 |
+
null,
|
54 |
+
'input',
|
55 |
+
'margin: -1px 10px 0 10px; width: 62px;'
|
56 |
+
),
|
57 |
+
quick_adsense_get_allowed_html()
|
58 |
+
);
|
59 |
+
?>
|
60 |
+
px
|
61 |
+
</p>
|
62 |
+
</div>
|
63 |
+
|
64 |
+
<div id="quick_adsense_widget_adunits_wrapper">
|
65 |
+
<div id="quick_adsense_widget_adunits_initial_wrapper">
|
66 |
+
<?php
|
67 |
+
for ( $i = 1; $i <= 3; $i++ ) {
|
68 |
+
$args['adunit_index'] = $i;
|
69 |
+
quick_adsense_load_file( 'templates/adunit-widget.php', $args, true );
|
70 |
+
}
|
71 |
+
?>
|
72 |
+
</div>
|
73 |
+
<div id="quick_adsense_widget_adunits_all_wrapper" style="display: none;">
|
74 |
+
<?php
|
75 |
+
for ( $i = 4; $i <= 10; $i++ ) {
|
76 |
+
$args['adunit_index'] = $i;
|
77 |
+
quick_adsense_load_file( 'templates/adunit-widget.php', $args, true );
|
78 |
+
}
|
79 |
+
?>
|
80 |
+
</div>
|
81 |
+
<a id="quick_adsense_widget_adunits_showall_button" class="input button-secondary"><span class="dashicons dashicons-arrow-down"></span> <b>Show All</b></a>
|
82 |
+
</div>
|
83 |
+
</div>
|
quick-adsense.php
CHANGED
@@ -1,25 +1,25 @@
|
|
1 |
-
<?php
|
2 |
-
/**
|
3 |
-
* Plugin Name: Quick Adsense
|
4 |
-
* Plugin URI: http://quickadsense.com/
|
5 |
-
* Description: Quick Adsense offers a quicker & flexible way to insert Google Adsense or any Ads code into a blog post.
|
6 |
-
* Author: namithjawahar
|
7 |
-
* Author URI: https://smartlogix.co.in/
|
8 |
-
* Version: 2.8.
|
9 |
-
*/
|
10 |
-
require_once dirname( __FILE__ ) . '/includes/loader.php';
|
11 |
-
require_once dirname( __FILE__ ) . '/includes/countries.php';
|
12 |
-
require_once dirname( __FILE__ ) . '/includes/defaults.php';
|
13 |
-
require_once dirname( __FILE__ ) . '/includes/controls.php';
|
14 |
-
require_once dirname( __FILE__ ) . '/includes/settings.php';
|
15 |
-
require_once dirname( __FILE__ ) . '/includes/widgets.php';
|
16 |
-
require_once dirname( __FILE__ ) . '/includes/quicktags.php';
|
17 |
-
require_once dirname( __FILE__ ) . '/includes/content.php';
|
18 |
-
require_once dirname( __FILE__ ) . '/includes/adsense.php';
|
19 |
-
require_once dirname( __FILE__ ) . '/includes/class-filehandler.php';
|
20 |
-
if ( ! class_exists( 'Mobile_Detect' ) ) {
|
21 |
-
require_once dirname( __FILE__ ) . '/includes/vendor/MobileDetect/Mobile_Detect.php';
|
22 |
-
}
|
23 |
-
if ( ! class_exists( 'iriven\\GeoIPCountry' ) ) {
|
24 |
-
require_once dirname( __FILE__ ) . '/includes/vendor/GeoIP/GeoIPCountry.php';
|
25 |
-
}
|
1 |
+
<?php
|
2 |
+
/**
|
3 |
+
* Plugin Name: Quick Adsense
|
4 |
+
* Plugin URI: http://quickadsense.com/
|
5 |
+
* Description: Quick Adsense offers a quicker & flexible way to insert Google Adsense or any Ads code into a blog post.
|
6 |
+
* Author: namithjawahar
|
7 |
+
* Author URI: https://smartlogix.co.in/
|
8 |
+
* Version: 2.8.6
|
9 |
+
*/
|
10 |
+
require_once dirname( __FILE__ ) . '/includes/loader.php';
|
11 |
+
require_once dirname( __FILE__ ) . '/includes/countries.php';
|
12 |
+
require_once dirname( __FILE__ ) . '/includes/defaults.php';
|
13 |
+
require_once dirname( __FILE__ ) . '/includes/controls.php';
|
14 |
+
require_once dirname( __FILE__ ) . '/includes/settings.php';
|
15 |
+
require_once dirname( __FILE__ ) . '/includes/widgets.php';
|
16 |
+
require_once dirname( __FILE__ ) . '/includes/quicktags.php';
|
17 |
+
require_once dirname( __FILE__ ) . '/includes/content.php';
|
18 |
+
require_once dirname( __FILE__ ) . '/includes/adsense.php';
|
19 |
+
require_once dirname( __FILE__ ) . '/includes/class-filehandler.php';
|
20 |
+
if ( ! class_exists( 'Mobile_Detect' ) ) {
|
21 |
+
require_once dirname( __FILE__ ) . '/includes/vendor/MobileDetect/Mobile_Detect.php';
|
22 |
+
}
|
23 |
+
if ( ! class_exists( 'iriven\\GeoIPCountry' ) ) {
|
24 |
+
require_once dirname( __FILE__ ) . '/includes/vendor/GeoIP/GeoIPCountry.php';
|
25 |
+
}
|
readme.txt
CHANGED
@@ -2,8 +2,8 @@
|
|
2 |
Contributors: namithjawahar
|
3 |
Tags: WordPress Plugin, adsense, google adsense, random adsense, random ads, advertising, adsense insertion, ad manager, ad, yahoo, google, ads, text insertion, widget, sidebar, admin, posts, plugin
|
4 |
Requires at least: 5.0
|
5 |
-
Tested up to:
|
6 |
-
Stable tag: 2.8.
|
7 |
|
8 |
Quick Adsense offers a quicker & flexible way to insert Google Adsense or any Ads code into a blog post.
|
9 |
|
2 |
Contributors: namithjawahar
|
3 |
Tags: WordPress Plugin, adsense, google adsense, random adsense, random ads, advertising, adsense insertion, ad manager, ad, yahoo, google, ads, text insertion, widget, sidebar, admin, posts, plugin
|
4 |
Requires at least: 5.0
|
5 |
+
Tested up to: 6.0
|
6 |
+
Stable tag: 2.8.6
|
7 |
|
8 |
Quick Adsense offers a quicker & flexible way to insert Google Adsense or any Ads code into a blog post.
|
9 |
|