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-ad-parameters.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-ad-parameters.php
199 lines
1 <?php // phpcs:ignoreFile
2
3 /**
4 * Renders the AdSense ad parameters metabox on the ad edit page.
5 *
6 * @package AdvancedAds
7 * @author Advanced Ads <info@wpadvancedads.com>
8 *
9 * @var string $unit_type The type of the AdSense unit, e.g. 'responsive'.
10 * @var string $unit_resize The value of the resize option.
11 * @var string $unit_id The client ID.
12 * @var string $unit_code The slot ID.
13 * @var string $unit_pubid The publisher ID which differs if there comes a different it from the content.
14 * @var string $json_content The content as JSON.
15 * @var string $pub_id The publisher ID.
16 * @var Advanced_Ads_Ad_Type_Adsense $ad The AdSense Ad type.
17 * @var string $pub_id_errors A string with error messages.
18 * @var string $content The content.
19 * @var array $extra_params Filterable extra params that can be passed.
20 */
21
22 if ( ! defined( 'WPINC' ) ) {
23 die();
24 }
25 $is_responsive = 'responsive' === $unit_type;
26 $is_link_responsive_unit = 'link-responsive' === $unit_type;
27 $is_matched_content = 'matched-content' === $unit_type;
28 $use_manual_css = 'manual' === $unit_resize;
29 if ( $is_responsive || $is_link_responsive_unit || $is_matched_content ) {
30 echo '<style> #advanced-ads-ad-parameters-size {display: none;} </style>';
31 }
32
33 $MAPI = Advanced_Ads_AdSense_MAPI::get_instance();
34 $use_user_app = Advanced_Ads_AdSense_MAPI::use_user_app();
35
36 $use_paste_code = true;
37 $use_paste_code = apply_filters( 'advanced-ads-gadsense-use-pastecode', $use_paste_code );
38
39 $db = Advanced_Ads_AdSense_Data::get_instance();
40 $adsense_id = trim( $db->get_adsense_id() );
41 $sizing_array = $db->get_responsive_sizing();
42
43 $gadsense_options = $db->get_options();
44 $mapi_options = Advanced_Ads_AdSense_MAPI::get_option();
45 $mapi_nonce = wp_create_nonce( 'advads-mapi' );
46 $has_token = Advanced_Ads_AdSense_MAPI::has_token( $adsense_id );
47 $quota = $MAPI->get_quota();
48
49 $mapi_ad_codes = $mapi_options['ad_codes'];
50 $mapi_ad_codes['length'] = count( $mapi_ad_codes );
51 ?>
52 <?php if ( $has_token ) : ?>
53 <script type="text/javascript">
54 if ( 'undefined' == typeof window.AdsenseMAPI ) {
55 var AdsenseMAPI = {};
56 }
57 AdsenseMAPI.hasToken = true;
58 AdsenseMAPI.nonce = '<?php echo $mapi_nonce ?>';
59 //AdsenseMAPI.codes = <?php echo json_encode( $mapi_ad_codes ) ?>;
60 AdsenseMAPI.quota = <?php echo json_encode( $quota ) ?>;
61 AdsenseMAPI.pubId = '<?php echo $pub_id ?>';
62 AdsenseMAPI.adStatus = '<?php echo $ad->get_status() ?>';
63 AdsenseMAPI.unsupportedUnits = <?php echo wp_json_encode( $mapi_options['unsupported_units'] ); ?>;
64 </script>
65 <?php endif; ?>
66
67 <script type="text/javascript">
68 if ( 'undefined' === typeof gadsenseData ) {
69 window.gadsenseData = {};
70 }
71 gadsenseData['pubId'] = '<?php echo $adsense_id; ?>';
72 gadsenseData['msg'] = {
73 unknownAd: '<?php esc_attr_e( "The ad details couldn't be retrieved from the ad code", 'advanced-ads' ); ?>',
74 pubIdMismatch: '<?php esc_attr_e( 'Warning: The AdSense account from this code does not match the one set in the Advanced Ads options.', 'advanced-ads' ); ?>'
75 };
76 </script>
77
78 <input type="hidden" id="advads-ad-content-adsense" name="advanced_ad[content]" value="<?php echo esc_attr( $json_content ); ?>"/>
79 <input type="hidden" name="unit_id" id="unit_id" value="<?php echo esc_attr( $unit_id ); ?>"/>
80 <?php if ( $use_paste_code ) : ?>
81 <div class="advads-adsense-code" style="display: none;">
82 <p class="description"><?php _e( 'Copy the ad code from your AdSense account, paste it into the area below and click on <em>Get details</em>.', 'advanced-ads' ); ?></p>
83 <textarea rows="10" cols="40" class="advads-adsense-content"></textarea>
84 <button class="button button-primary advads-adsense-submit-code"><?php _e( 'Get details', 'advanced-ads' ); ?></button>&nbsp;&nbsp;
85 <button class="button button-secondary advads-adsense-close-code"><?php _e( 'cancel', 'advanced-ads' ); ?></button>&nbsp;&nbsp;
86 <?php if ( ! $has_token ) : ?>
87 <a style="vertical-align:sub;font-weight:600;font-style:italic;" href="<?php echo admin_url( 'admin.php?page=advanced-ads-settings#top#adsense' ) ?>"><?php _e( 'connect to your AdSense account', 'advanced-ads' ) ?></a>
88 <?php endif; ?>
89 <div id="pastecode-msg"></div>
90 </div>
91 <?php if ( $has_token && Advanced_Ads_Checks::php_version_minimum() ) {
92 Advanced_Ads_AdSense_Admin::get_mapi_ad_selector();
93 }
94
95 // the network variable needs to be set for the view to work!
96 $network = Advanced_Ads_Network_Adsense::get_instance();
97 include( ADVADS_ABSPATH . '/modules/gadsense/admin/views/external-ads-links.php' );
98 ?>
99 <?php endif; ?>
100 <p id="adsense-ad-param-error"></p>
101 <?php ob_start(); ?>
102 <label class="label"><?php _e( 'Ad Slot ID', 'advanced-ads' ); ?></label>
103 <div>
104 <input type="text" name="unit-code" id="unit-code" value="<?php echo $unit_code; ?>"/>
105 <input type="hidden" name="advanced_ad[output][adsense-pub-id]" id="advads-adsense-pub-id" value="<?php echo esc_attr( $unit_pubid ); ?>"/>
106 <?php if ( $unit_pubid ) : ?>
107 <?php /* translators: %s is the publisher ID. */
108 printf( __( 'Publisher ID: %s', 'advanced-ads' ), $unit_pubid ); ?>
109 <?php endif; ?>
110 <p id="advads-pubid-in-slot" class="advads-notice-inline advads-error"
111 <?php echo ! ( 0 === strpos( $pub_id, 'pub-' ) && false !== strpos( $unit_code, substr( $pub_id, 4 ) ) ) ? 'style="display:none"' : ''; ?>
112 ><?php _e( 'The ad slot ID is either a number or empty and not the same as the publisher ID.', 'advanced-ads' ) ?></p>
113 </div>
114 <hr/>
115 <?php
116 $unit_code_markup = ob_get_clean();
117 echo apply_filters( 'advanced-ads-gadsense-unit-code-markup', $unit_code_markup, $unit_code );
118 if ( $pub_id_errors ) : ?>
119 <p>
120 <span class="advads-notice-inline advads-error">
121 <?php echo $pub_id_errors; ?>
122 </span>
123 <?php /* translators: %s the setting page link */
124 printf( __( 'Please <a href="%s" target="_blank">change it here</a>.', 'advanced-ads' ), admin_url( 'admin.php?page=advanced-ads-settings#top#adsense' ) ); ?>
125 </p>
126 <?php endif; ?>
127 <label class="label" id="unit-type-block"><?php _e( 'Type', 'advanced-ads' ); ?></label>
128 <div>
129 <select name="unit-type" id="unit-type">
130 <option value="normal" <?php selected( $unit_type, 'normal' ); ?>><?php _e( 'Fixed Size', 'advanced-ads' ); ?></option>
131 <option value="responsive" <?php selected( $unit_type, 'responsive' ); ?>><?php _e( 'Responsive', 'advanced-ads' ); ?></option>
132 <option value="matched-content" <?php selected( $unit_type, 'matched-content' ); ?>><?php esc_html_e( 'Multiplex', 'advanced-ads' ); ?></option>
133 <?php if ( $unit_type === 'link' ) : ?>
134 <option value="link" <?php selected( $unit_type, 'link' ); ?>><?php _e( 'Link ads', 'advanced-ads' ); ?></option>
135 <?php endif; ?>
136 <?php if ( $unit_type === 'link-responsive' ) : ?>
137 <option value="link-responsive" <?php selected( $unit_type, 'link-responsive' ); ?>><?php _e( 'Link ads (Responsive)', 'advanced-ads' ); ?></option>
138 <?php endif; ?>
139 <option value="in-article" <?php selected( $unit_type, 'in-article' ); ?>><?php _e( 'In-article', 'advanced-ads' ); ?></option>
140 <option value="in-feed" <?php selected( $unit_type, 'in-feed' ); ?>><?php _e( 'In-feed', 'advanced-ads' ); ?></option>
141 </select>
142 <a href="https://wpadvancedads.com/google-adsense-ad-formats/?utm_source=advanced-ads&utm_medium=link&utm_campaign=adsense-ad-types" class="advads-manual-link" target="_blank"><?php esc_html_e( 'Manual', 'advanced-ads' ); ?></a>
143 </div>
144 <?php if ( in_array( $unit_type, [ 'link', 'link-responsive' ], true ) ) : ?>
145 <p class="advads-message-warning"><?php esc_html_e( 'Google AdSense deprecated Link Units. Please choose another type.', 'advanced-ads' ); ?>
146 <a href="https://wpadvancedads.com/adsense-link-units/" target="_blank" rel="noopener">
147 <?php esc_html_e( 'Learn more', 'advanced-ads' ); ?>
148 </a>
149 </p>
150 <?php endif; ?>
151 <hr/>
152 <label class="label" <?php if ( ! $is_responsive || 2 > count( $sizing_array ) ) {
153 echo 'style="display: none;"';
154 } ?> id="resize-label"><?php _e( 'Resizing', 'advanced-ads' ); ?></label>
155 <div <?php if ( ! $is_responsive || 2 > count( $sizing_array ) ) {
156 echo 'style="display: none;"';
157 } ?>>
158 <select name="ad-resize-type" id="ad-resize-type">
159 <?php foreach ( $sizing_array as $key => $desc ) : ?>
160 <option value="<?php echo $key; ?>" <?php selected( $key, $unit_resize ); ?>><?php echo $desc; ?></option>
161 <?php endforeach; ?>
162 </select>
163 </div>
164 <hr>
165 <label class="label advads-adsense-layout" <?php if ( 'in-feed' !== $unit_type ) {
166 echo 'style="display: none;"';
167 } ?> id="advads-adsense-layout"><?php _e( 'Layout', 'advanced-ads' ); ?></label>
168 <div <?php if ( 'in-feed' !== $unit_type ) {
169 echo 'style="display: none;"';
170 } ?>>
171 <input name="ad-layout" id="ad-layout" value="<?php echo isset( $layout ) ? $layout : ''; ?>"/>
172 </div>
173 <hr>
174 <label class="label advads-adsense-layout-key" <?php if ( 'in-feed' !== $unit_type ) {
175 echo 'style="display: none;"';
176 } ?> id="advads-adsense-layout-key"><?php _e( 'Layout-Key', 'advanced-ads' ); ?></label>
177 <div <?php if ( 'in-feed' !== $unit_type ) {
178 echo 'style="display: none;"';
179 } ?>>
180 <input type="text" name="ad-layout-key" id="ad-layout-key" value="<?php echo $layout_key ?? ''; ?>"/>
181 </div>
182 <hr/>
183 <label class="label clearfix-before" <?php if ( ! $is_responsive ) {
184 echo 'style="display: none;"';
185 } ?>><?php _e( 'Clearfix', 'advanced-ads' ); ?></label>
186 <div class="clearfix-before" <?php if ( ! $is_responsive ) {
187 echo 'style="display: none;"';
188 } ?>>
189 <input type="hidden" name="advanced_ad[output][clearfix_before]" value="0" />
190 <input type="checkbox" name="advanced_ad[output][clearfix_before]" value="1" <?php checked( ! empty( $options['clearfix_before'] ), true ); ?> />
191 <p class="description inline">
192 <?php _e( 'Enable this if responsive ads cover something on your site.', 'advanced-ads' ); ?>
193 </p>
194 </div>
195 <hr class="clearfix-before" <?php if ( ! $is_responsive ) {
196 echo 'style="display: none;"';
197 } ?> />
198 <?php do_action( 'advanced-ads-gadsense-extra-ad-param', $extra_params, $content, $ad );
199