PluginProbe ʕ •ᴥ•ʔ
Advanced Ads – Ad Manager & AdSense / 2.0.25
Advanced Ads – Ad Manager & AdSense v2.0.25
2.0.25 2.0.24 2.0.23 2.0.22 2.0.21 1.38.0 1.39.0 1.39.1 1.39.2 1.39.3 1.39.4 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8 1.4.9 1.40.0 1.40.1 1.40.2 1.41.0 1.42.0 1.42.1 1.42.2 1.43.0 1.44.0 1.44.1 1.45.0 1.45.1 1.46.0 1.47.0 1.47.1 1.47.2 1.47.3 1.47.4 1.47.5 1.48.0 1.48.1 1.49.0 1.5.0 1.5.0.1 1.5.1 1.5.2 1.5.2.1 1.5.4 1.5.4.1 1.5.5 1.50.0 1.51.0 1.51.1 1.51.2 1.51.3 1.52.0 1.52.1 1.52.2 1.52.3 1.52.4 1.53.0 1.53.1 1.53.2 1.54.0 1.54.1 1.55.0 1.56.0 1.56.1 1.56.2 1.56.3 1.56.4 1.6 1.6.1 1.6.10 1.6.10.1 1.6.10.2 1.6.11 1.6.11.1 1.6.12 1.6.13 1.6.14 1.6.15 1.6.16 1.6.17 1.6.17.1 1.6.17.2 1.6.2 1.6.2.1 1.6.3 1.6.4 1.6.4.1 1.6.5 1.6.6 1.6.6.1 1.6.7 1.6.7.1 1.6.8 1.6.8.1 1.6.8.2 1.6.8.3 1.6.9 1.6.9.1 1.6.9.2 1.6.9.3 1.6.9.4 1.7 1.7.0.1 1.7.0.2 1.7.0.3 1.7.1 1.7.1.1 1.7.1.2 1.7.1.3 1.7.1.4 1.7.1.5 1.7.10 trunk 1.7.11 1.0.1 1.7.12 1.0.2 1.7.13 1.0.3 1.7.14 1.1.0 1.7.15 1.1.1 1.7.16 1.1.2 1.7.17 1.1.3 1.7.18 1.10 1.7.19 1.10.1 1.7.2 1.10.10 1.7.2.1 1.10.11 1.7.20 1.10.12 1.7.21 1.10.2 1.7.22 1.10.3 1.7.23 1.10.4 1.7.24 1.10.5 1.7.25 1.10.6 1.7.3 1.10.7 1.7.4 1.10.8 1.7.4.1 1.10.9 1.7.4.2 1.11 1.7.4.3 1.11.1 1.7.4.4 1.11.2 1.7.4.5 1.12 1.7.5 1.13 1.7.5.1 1.13.1 1.7.6 1.13.2 1.7.7 1.13.3 1.7.8 1.13.4 1.7.9 1.13.5 1.7.9.1 1.13.6 1.7.9.2 1.13.7 1.7.9.3 1.13.8 1.8 1.14 1.8.1 1.14.1 1.8.10 1.14.10 1.8.11 1.14.11 1.8.12 1.14.2 1.8.13 1.14.3 1.8.14 1.14.4 1.8.15 1.14.5 1.8.16 1.14.6 1.8.17 1.14.7 1.8.18 1.14.8 1.8.19 1.14.9 1.8.2 1.15 1.8.20 1.16 1.8.21 1.16.1 1.8.22 1.17 1.8.23 1.17.1 1.8.24 1.17.10 1.8.25 1.17.10-rc.1 1.8.26 1.17.11 1.8.27 1.17.12 1.8.28 1.17.12-rc.1 1.8.29 1.17.2 1.8.3 1.17.3 1.8.30 1.17.4 1.8.4 1.17.5 1.8.5 1.17.6 1.8.6 1.17.7 1.8.7 1.17.8 1.8.8 1.17.9 1.8.9 1.17.9-beta.1 1.9 1.18.0 2.0.0 1.19.0 2.0.1 1.19.1 2.0.10 1.2 2.0.11 1.2.1 2.0.12 1.2.2 2.0.13 1.2.3 2.0.14 1.2.4 2.0.15 1.2.5 2.0.16 1.2.6 2.0.17 1.2.7 2.0.18 1.20.0 2.0.19 1.20.0-rc.1 2.0.2 1.20.0-rc.2 2.0.20 1.20.1 2.0.3 1.20.2 2.0.4 1.20.3 2.0.5 1.21.0 2.0.6 1.21.1 2.0.7 1.22.0 2.0.8 1.22.1 2.0.9 1.22.2 1.23.0 1.23.1 1.23.2 1.24.0 1.24.1 1.24.2 1.25.0 1.25.1 1.26.0 1.27.0 1.28.0 1.29.0 1.29.1 1.3 1.3.1 1.3.10 1.3.11 1.3.12 1.3.13 1.3.14 1.3.15 1.3.16 1.3.17 1.3.18 1.3.2 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.30.0 1.30.1 1.30.2 1.30.2-rc.1 1.30.3 1.30.4 1.30.4-rc.1 1.30.5 1.31.0 1.31.1 1.32.0 1.32.0-rc.1 1.33.0 1.33.1 1.33.2 1.34.0 1.35.0 1.35.1 1.36.0 1.36.1 1.36.2 1.36.3 1.37.0 1.37.1 1.37.2
advanced-ads / modules / gadsense / admin / views / adsense-account.php
advanced-ads / modules / gadsense / admin / views Last commit date
settings 5 years ago adsense-account.php 1 year ago adsense-ad-parameters.php 5 months ago adsense-report.php 3 years ago auto-ads-video.php 6 years ago borlabs-cookie-auto-ads-warning.php 3 years ago connect-adsense.php 1 year ago external-ads-adsense.php 6 years ago external-ads-links.php 1 year ago external-ads-list.php 1 year ago
adsense-account.php
326 lines
1 <?php // phpcs:ignoreFile
2 /**
3 * View for the Settings - AdSense.
4 *
5 * @package Advanced_Ads
6 */
7
8 use AdvancedAds\Utilities\Conditional;
9
10 $MAPI = Advanced_Ads_AdSense_MAPI::get_instance();
11 $options = $this->data->get_options();
12 $adsense_id = $this->data->get_adsense_id();
13 $mapi_options = Advanced_Ads_AdSense_MAPI::get_option();
14
15 $mapi_account_details = false;
16
17 $CID = Advanced_Ads_AdSense_MAPI::CID;
18
19 $use_user_app = Advanced_Ads_AdSense_MAPI::use_user_app();
20 if ( $use_user_app ) {
21 $CID = ADVANCED_ADS_MAPI_CID;
22 }
23
24 $can_connect = true;
25
26 if ( $use_user_app && !( ( defined( 'ADVANCED_ADS_MAPI_CID' ) && '' != ADVANCED_ADS_MAPI_CID ) && ( defined( 'ADVANCED_ADS_MAPI_CIS' ) && '' != ADVANCED_ADS_MAPI_CIS ) ) ) {
27 $can_connect = false;
28 }
29
30 $has_token = Advanced_Ads_AdSense_MAPI::has_token( $adsense_id );
31
32 if ( $has_token && isset( $mapi_options['accounts'][ $adsense_id ]['details'] ) ) {
33 $mapi_account_details = $mapi_options['accounts'][ $adsense_id ]['details'];
34 }
35
36 $alerts = Advanced_Ads_AdSense_MAPI::get_stored_account_alerts( $adsense_id );
37
38 /* translators: 1: opening anchor tag for link to adsense account 2: closing anchor tag for link to adsense account */
39 $alerts_heading = $adsense_id ? sprintf( esc_html__( 'Warning from your %1$sAdSense account%2$s', 'advanced-ads' ), '<a target="_blank" href="https://www.google.com/adsense/new/u/1/' . esc_html( $adsense_id ) . '/">', '</a>' ) : esc_html__( 'AdSense warnings', 'advanced-ads' );
40
41 $alerts_heading = $adsense_id
42 ? wp_kses(
43 sprintf(
44 /* translators: 1: opening anchor tag for link to adsense account 2: closing anchor tag for link to adsense account */
45 __( 'Warning from your %1$sAdSense account%2$s', 'advanced-ads' ),
46 '<a target="_blank" href="https://www.google.com/adsense/new/u/1/' . $adsense_id . '/">',
47 '</a>'
48 ),
49 [
50 'a' => [
51 'target' => true,
52 'href' => true,
53 ],
54 ]
55 )
56 : __( 'AdSense warnings', 'advanced-ads' );
57
58 $alerts_dismiss = __( 'dismiss', 'advanced-ads' );
59 $connection_error_messages = Advanced_Ads_AdSense_MAPI::get_connect_error_messages();
60 $alerts_advads_messages = Advanced_Ads_Adsense_MAPI::get_adsense_alert_messages();
61
62 ?>
63 <div id="mapi-account-alerts">
64 <?php if ( is_array( $alerts ) && isset( $alerts['items'] ) && is_array( $alerts['items'] ) && $alerts['items'] ) : ?>
65 <h3>
66 <?php
67 //phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- already escaped
68 echo $alerts_heading;
69 ?>
70 </h3>
71 <?php foreach ( $alerts['items'] as $alert_id => $alert ) : ?>
72 <div class="card advads-notice-block advads-error">
73 <button type="button" class="mapi-dismiss-alert notice-dismiss" data-id="<?php echo esc_attr( $alert_id ); ?>">
74 <span class="screen-reader-text"><?php echo esc_html( $alerts_dismiss ); ?></span>
75 </button>
76 <?php
77 $internal_id = $alert['id'] ?? str_replace( '-', '_', strtoupper( $alert['type'] ) );
78 echo wp_kses(
79 $alerts_advads_messages[ $internal_id ] ?? $alert['message'],
80 [
81 'a' => [
82 'href' => true,
83 'target' => true,
84 'class' => true,
85 ],
86 ]
87 );
88 ?>
89 </div>
90 <?php endforeach; ?>
91 <?php /* translators: %s: date and time of last check in the format set in wp_options */ ?>
92 <p class="description alignright"><?php printf( __( 'last checked: %s', 'advanced-ads' ), $alerts['lastCheck'] ? esc_html( ( new DateTime( '@' . $alerts['lastCheck'], Advanced_Ads_Utils::get_wp_timezone() ) )->format( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ) ) ) : '-' ); ?></p>
93 <?php endif; ?>
94 <?php
95 if ( ! empty( $mapi_options['connect_error'] ) ) {
96 $message = isset( $mapi_options['connect_error']['message'] ) ? $mapi_options['connect_error']['message'] : '';
97 if ( isset( $connection_error_messages[ $mapi_options['connect_error']['reason'] ] ) ) {
98 $message = $connection_error_messages[ $mapi_options['connect_error']['reason'] ];
99 }
100 if ( ! empty( $message ) ) {
101 echo '<div id="mapi-connect-errors" class="notice error inline"><p class="advads-notice-inline advads-error">';
102 echo wp_kses( $message, [
103 'a' => [
104 'id' => [],
105 'class' => [],
106 'href' => [],
107 'style' => [],
108 ],
109 'i' => [
110 'id' => [],
111 'class' => [],
112 'style' => [],
113 ],
114 ] );
115 echo '</p></div>';
116 }
117 }
118 ?>
119 </div>
120 <div id="full-adsense-settings-div" <?php if ( empty( $adsense_id ) ) echo 'style="display:none"' ?>>
121 <input type="text" <?php echo $has_token ? 'readonly' : ''; ?> name="<?php echo esc_attr( GADSENSE_OPT_NAME ); ?>[adsense-id]" placeholder="pub-1234567891234567" style="margin-right:.8em" id="adsense-id" size="32" value="<?php echo esc_attr( $adsense_id ); ?>"/>
122 <?php if ( !empty( $adsense_id ) && !$has_token ) : ?>
123 <a id="connect-adsense" class="button-primary <?php echo ! Advanced_Ads_Checks::php_version_minimum() ? 'disabled ' : ''; ?>preventDefault" <?php if ( ! $can_connect || ! Advanced_Ads_Checks::php_version_minimum() ) echo 'disabled'; ?>><?php esc_attr_e( 'Connect to AdSense', 'advanced-ads' ) ?></a>
124 <?php endif; ?>
125 <?php if ( $has_token ) : ?>
126 <a id="revoke-token" class="button-secondary preventDefault"><?php esc_attr_e( 'Revoke API acccess', 'advanced-ads' ) ?></a>
127 <div id="gadsense-freeze-all" style="position:fixed;top:0;bottom:0;right:0;left:0;background-color:rgba(255,255,255,.5);text-align:center;display:none;">
128 <img alt="..." src="<?php echo ADVADS_BASE_URL . 'admin/assets/img/loader.gif'; ?>" style="margin-top:40vh" />
129 </div>
130 <?php endif; ?>
131 <?php if ( $mapi_account_details ) : ?>
132 <p class="description"><?php esc_html_e( 'Account holder name', 'advanced-ads' ); echo ': <strong>' . esc_html( $mapi_account_details['name'] ) . '</strong>'; ?></p>
133 <?php else : ?>
134 <?php if ( 0 !== strpos( $adsense_id, 'pub-' ) ) : ?>
135 <p class="advads-notice-inline advads-error"><?php esc_html_e( 'The Publisher ID has an incorrect format. (must start with "pub-")', 'advanced-ads' ); ?></p>
136 <?php endif; ?>
137 <?php endif; ?>
138 </div>
139 <?php if ( empty( $adsense_id ) ) : ?>
140 <div id="auto-adsense-settings-div" <?php if ( !empty( $adsense_id ) ) echo 'style="display:none;"' ?>>
141 <div class="widget-col">
142 <h3><?php _e( 'Yes, I have an AdSense account', 'advanced-ads' ) ?></h3>
143 <a id="connect-adsense" class="button-primary <?php echo ! Advanced_Ads_Checks::php_version_minimum() ? 'disabled ' : ''; ?>preventDefault" <?php echo ! Advanced_Ads_Checks::php_version_minimum() ? 'disabled' : ''; ?>><?php _e( 'Connect to AdSense', 'advanced-ads' ) ?></a>
144 <a id="adsense-manual-config" class="button-secondary preventDefault"><?php _e( 'Configure everything manually', 'advanced-ads' ) ?></a>
145 </div>
146 <div class="widget-col">
147 <h3><?php _e( "No, I still don't have an AdSense account", 'advanced-ads' ) ?></h3>
148 <a class="button button-secondary" target="_blank" href="<?php echo Advanced_Ads_AdSense_Admin::ADSENSE_NEW_ACCOUNT_LINK; ?>"><?php _e( 'Get a free AdSense account', 'advanced-ads' ); ?></a>
149 <p>
150 <?php
151 printf(
152 wp_kses(
153 /* translators: %1$s is an opening a tag, %2$s is the closing one */
154 __( 'See all %1$srecommended ad networks%2$s.', 'advanced-ads' ),
155 [
156 'a' => [
157 'href' => [],
158 'target' => [],
159 ],
160 ]
161 ),
162 '<a href="https://wpadvancedads.com/recommended-ad-networks/?utm_source=advanced-ads&utm_medium=link&utm_campaign=recommendations" target="_blank">',
163 '</a>'
164 );
165 ?>
166 </p>
167 </div>
168 </div>
169 <style type="text/css">
170 #adsense table h3 {
171 margin-top: 0;
172 margin-bottom: .2em;
173 }
174 #adsense .form-table tr {
175 display: none;
176 }
177 #adsense .form-table tr:first-of-type {
178 display: table-row;
179 }
180 #auto-adsense-settings-div .widget-col {
181 float: left;
182 margin: 0px 5px 5px 0px;
183 }
184 #auto-adsense-settings-div:after {
185 display: block;
186 content: "";
187 clear: left;
188 }
189 #auto-adsense-settings-div .widget-col:first-child {
190 margin-right: 20px;
191 border-right: 1px solid #cccccc;
192 padding: 0px 20px 0px 0px;
193 position: relative;
194 }
195 #auto-adsense-settings-div .widget-col:first-child:after {
196 position: absolute;
197 content: "or";
198 display: block;
199 top: 20px;
200 right: -10px;
201 background: #ffffff;
202 color: #cccccc;
203 font-size: 20px;
204 }
205 @media screen and (max-width: 1199px) {
206 #auto-adsense-settings-div .widget-col { float: none; margin-right: 0; }
207 #auto-adsense-settings-div .widget-col:first-child { margin: 0px 0px 20px 0px; padding: 0px 0px 20px 0px; border-bottom: 1px solid #cccccc; border-right: 0; }
208 #auto-adsense-settings-div .widget-col:first-child:after { top: auto; right: auto; bottom: -10px; left: 20px; display: inline-block; padding: 0px 5px 0px 5px; }
209 }
210 </style>
211 <?php
212 echo "<br/><br/><br/><hr>";
213 include ADVADS_ABSPATH . 'modules/gadsense/admin/views/auto-ads-video.php';
214 ?><p>
215 <a href="https://wpadvancedads.com/place-adsense-ad-unit-manually/?utm_source=advanced-ads&utm_medium=link&utm_campaign=adsense-manually" style="text-decoration: none;" target="_blank"><span class="dashicons dashicons-welcome-learn-more"></span>
216 <?php
217 esc_attr_e( 'How to choose specific positions for AdSense ad units', 'advanced-ads' ); ?></a>
218 </p>
219
220 <?php
221 $_notice = 'nl_adsense';
222 if ( Advanced_Ads_Admin_Notices::get_instance()->can_display( $_notice ) && Conditional::user_can_subscribe( 'nl_first_steps' ) ) {
223 $box_classes = '!margin-top-4';
224 $text = sprintf(
225 /* translators: %s: number of add-ons. */
226 __( 'Subscribe to our free email course for Google AdSense, receive our newsletter for periodic tutorials, and get %s for Advanced Ads.', 'advanced-ads' ),
227 '<strong>' . __( '2 free add-ons', 'advanced-ads' ) . '</strong>'
228 );
229 include ADVADS_ABSPATH . '/admin/views/notices/inline.php';
230 }
231 ?>
232 <?php else : ?>
233 <p>
234 <?php
235 printf(
236 wp_kses(
237 /* translators: %1$s is the opening link tag to our manual; %2$s is the appropriate closing link tag; %3$s is the opening link tag to our help forum; %4$s is the appropriate closing link tag */
238 __( 'Problems with AdSense? Check out the %1$smanual%2$s or %3$sask here%4$s.', 'advanced-ads' ),
239 [
240 'a' => [
241 'href' => [],
242 'target' => [],
243 ],
244 ]
245 ),
246 '<a href="https://wpadvancedads.com/adsense-ads/?utm_source=advanced-ads&utm_medium=link&utm_campaign=adsense-manual-check" target="_blank">',
247 '</a>',
248 '<a href="https://wordpress.org/support/plugin/advanced-ads/#new-post" target="_blank">',
249 '</a>'
250 ); ?></p>
251 <p>
252 <?php
253 printf(
254 wp_kses(
255 /* translators: %1$s is an opening a tag, %2$s is the closing one */
256 __( 'See all %1$srecommended ad networks%2$s.', 'advanced-ads' ),
257 [
258 'a' => [
259 'href' => [],
260 'target' => [],
261 ],
262 ]
263 ),
264 '<a href="https://wpadvancedads.com/recommended-ad-networks/?utm_source=advanced-ads&utm_medium=link&utm_campaign=recommendations" target="_blank">',
265 '</a>'
266 );
267 ?>
268 </p><?php endif; ?>
269 <?php if ( ! Advanced_Ads_Checks::php_version_minimum() ) : ?>
270 <p class="advads-notice-inline advads-error"><?php esc_html_e( 'Can not connect AdSense account. PHP version is too low.', 'advanced-ads' ); ?></p>
271 <?php endif; ?>
272 <div id="mapi-alerts-overlay">
273 <div style="position:relative;text-align:center;display:table;width:100%;height:100%;">
274 <div style="display:table-cell;vertical-align:middle;">
275 <img alt="loading" src="<?php echo esc_url( ADVADS_BASE_URL . 'admin/assets/img/loader.gif' ); ?>" />
276 </div>
277 </div>
278 </div>
279 <script type="text/javascript">
280 if ( 'undefined' == typeof window.AdsenseMAPI ) {
281 AdsenseMAPI = {};
282 }
283 AdsenseMAPI = Object.assign(
284 AdsenseMAPI,
285 <?php
286 echo wp_json_encode(
287 [
288 'alertsMsg' => $alerts_advads_messages,
289 'alertsHeadingMsg' => $alerts_heading,
290 'alertsDismissMsg' => wp_kses( $alerts_dismiss, [] ),
291 ]
292 )
293 ?>
294 );
295 </script>
296 <style type="text/css">
297 #adsense {
298 position: relative;
299 }
300 #mapi-alerts-overlay {
301 position:absolute;
302 top:0;
303 right:0;
304 bottom:0;
305 left:0;
306 background-color: rgb(255, 255, 255, .90);
307 display: none;
308 }
309 #mapi-account-alerts, #mapi-connect-errors {
310 margin-bottom: .5em;
311 }
312 #dissmiss-connect-error {
313 cursor: pointer;
314 }
315 #gadsense-overlay {
316 display:none;
317 background-color:rgba(255,255,255,.5);
318 position:absolute;
319 width: 100%;
320 height: 100%;
321 top: 0;
322 left: 0;
323 text-align:center;
324 }
325 </style>
326