PluginProbe ʕ •ᴥ•ʔ
Advanced Ads – Ad Manager & AdSense / 2.0.24
Advanced Ads – Ad Manager & AdSense v2.0.24
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 / includes / admin / pages / class-onboarding.php
advanced-ads / includes / admin / pages Last commit date
class-ads-editing.php 3 months ago class-ads.php 3 months ago class-dashboard.php 3 months ago class-groups.php 3 months ago class-onboarding.php 3 months ago class-placements.php 3 months ago class-settings.php 3 months ago class-support.php 3 months ago class-tools.php 3 months ago
class-onboarding.php
267 lines
1 <?php
2 /**
3 * Onboarding wizard screen.
4 *
5 * @package AdvancedAds
6 * @author Advanced Ads <info@wpadvancedads.com>
7 * @since 1.47.0
8 */
9
10 namespace AdvancedAds\Admin\Pages;
11
12 use AdvancedAds\Constants;
13 use Advanced_Ads_AdSense_Data;
14 use Advanced_Ads_AdSense_MAPI;
15 use Advanced_Ads_AdSense_Admin;
16 use AdvancedAds\Abstracts\Screen;
17 use AdvancedAds\Utilities\Conditional;
18
19 defined( 'ABSPATH' ) || exit;
20
21 /**
22 * Onboarding Wizard.
23 */
24 class Onboarding extends Screen {
25
26 /**
27 * Screen unique id.
28 *
29 * @return string
30 */
31 public function get_id(): string {
32 return 'onboarding';
33 }
34
35 /**
36 * Register screen into WordPress admin area.
37 *
38 * @return void
39 */
40 public function register_screen(): void {
41 $hook = add_submenu_page(
42 Constants::HIDDEN_PAGE_SLUG,
43 __( 'Onboarding Wizard', 'advanced-ads' ),
44 __( 'Onboarding Wizard', 'advanced-ads' ),
45 Conditional::user_cap( 'advanced_ads_manage_options' ),
46 ADVADS_SLUG . '-onboarding',
47 [ $this, 'display' ]
48 );
49
50 $this->set_hook( $hook );
51 }
52
53 /**
54 * Enqueue assets
55 *
56 * @return void
57 */
58 public function enqueue_assets(): void {
59 $this->i18n();
60 $this->adsense_data();
61 wp_enqueue_media();
62
63 wp_advads()->registry->enqueue_style( 'screen-onboarding' );
64 wp_advads()->registry->enqueue_script( 'screen-onboarding' );
65 }
66
67 /**
68 * Display screen content.
69 *
70 * @return void
71 */
72 public function display(): void {
73 include ADVADS_ABSPATH . 'views/admin/screens/onboarding.php';
74 }
75
76 /**
77 * Add Adsense data
78 *
79 * @return void
80 */
81 private function adsense_data(): void {
82 if ( current_user_can( Conditional::user_cap( 'advanced_ads_manage_options' ) ) ) {
83 $nonce = wp_create_nonce( 'advanced_ads_wizard' );
84 wp_advads_json_add(
85 'wizard',
86 [
87 'nonce' => $nonce,
88 'authUrl' => 'https://accounts.google.com/o/oauth2/v2/auth?scope=' . rawurlencode( 'https://www.googleapis.com/auth/adsense.readonly' ),
89 'clientId' => Advanced_Ads_AdSense_MAPI::CID,
90 'state' => base64_encode( // phpcs:ignore WordPress.PHP.DiscouragedPHPFunctions.obfuscation_base64_encode
91 wp_json_encode(
92 [
93 'api' => 'adsense',
94 'nonce' => $nonce,
95 'return_url' => admin_url( 'admin.php?page=advanced-ads-onboarding&route=adsense#wizard#adsense' ),
96 ]
97 )
98 ),
99 'redirectUri' => Advanced_Ads_AdSense_MAPI::REDIRECT_URI,
100 'adsenseData' => array_merge(
101 Advanced_Ads_AdSense_Data::get_instance()->get_options(),
102 [ 'accounts' => Advanced_Ads_AdSense_MAPI::get_option()['accounts'] ]
103 ),
104 'newAccountLink' => Advanced_Ads_AdSense_Admin::ADSENSE_NEW_ACCOUNT_LINK,
105 ]
106 );
107 }
108 }
109
110 /**
111 * Add wizard internationalization
112 *
113 * @return void
114 */
115 private function i18n(): void {
116 wp_advads_json_add(
117 'i18n',
118 [
119 'wizard' => [
120 'loading' => __( 'Loading...', 'advanced-ads' ),
121 'processing' => __( 'Processing authorization...', 'advanced-ads' ),
122 'selectAccount' => [
123 'optionZero' => __( 'Select an account', 'advanced-ads' ),
124 'title' => __( 'Please select an account to use', 'advanced-ads' ),
125 ],
126 'exitLabel' => __( 'Exit the wizard without saving', 'advanced-ads' ),
127 'btnGoBack' => __( 'Go back', 'advanced-ads' ),
128 'newsletter' => [
129 'title' => __( 'Subscribe to our newsletter and get 2 add-ons for free', 'advanced-ads' ),
130 'btnLabel' => __( 'Subscribe now', 'advanced-ads' ),
131 'inputPlaceholder' => __( 'Enter your email address', 'advanced-ads' ),
132 ],
133 'stepTitles' => [
134 'adImage' => __( 'Please select your image', 'advanced-ads' ),
135 'adCode' => __( 'Please paste your ad code', 'advanced-ads' ),
136 'congrats' => [
137 'default' => __( 'Congratulations, your ad is now published!', 'advanced-ads' ),
138 'adsenseManual' => __( 'Your ad is almost ready!', 'advanced-ads' ),
139 'adsenseAuto' => __( 'Congratulations, AdSense Auto Ads are now set up!', 'advanced-ads' ),
140 ],
141 ],
142 'firstStep' => [
143 'taskAdSense' => __( 'I want to use mostly Google AdSense or Google Auto Ads', 'advanced-ads' ),
144 'taskImage' => __( 'I want to add a banner ad with an image', 'advanced-ads' ),
145 'taskCode' => __( 'I want to insert an ad code from an ad network', 'advanced-ads' ),
146 'stepHeading' => __( 'Welcome! To kick things off, and to simplify your journey, answer a few questions and let Advanced Ads tailor the perfect ad for your site\'s needs.', 'advanced-ads' ),
147 'agreementText' => __( 'I agree to share usage data to <strong>help the developers</strong> improve the plugin. Read more in our <a href="https://wpadvancedads.com/privacy-policy/" target="_blank">privacy policy</a>.', 'advanced-ads' ),
148 'inputTitle' => __( 'What\'s your task?', 'advanced-ads' ),
149 ],
150 'bannerAd' => [
151 'mediaFrameTitle' => __( 'Select an image to upload', 'advanced-ads' ),
152 'mediaFrameButton' => __( 'Use this image', 'advanced-ads' ),
153 'mediaBtnUpload' => __( 'Upload', 'advanced-ads' ),
154 'mediaBtnReplace' => __( 'Replace', 'advanced-ads' ),
155 'stepHeading' => __( 'Would you like to set a target URL for your image ad?', 'advanced-ads' ),
156 'inputPlaceholder' => __( 'Enter an optional target URL for your image ad', 'advanced-ads' ),
157 'footerEnableText' => __( 'Create placement and ad', 'advanced-ads' ),
158 'footerDisableText' => __( 'Please select an image', 'advanced-ads' ),
159 ],
160 'codeAd' => [
161 'inputPlaceholder' => __( 'Paste the ad code that your advertising network has provided to you', 'advanced-ads' ),
162 'footerEnableText' => __( 'Insert the ad code into my site', 'advanced-ads' ),
163 'footerDisableText' => __( 'Please paste your ad code', 'advanced-ads' ),
164 ],
165 'googleAd' => [
166 'adsPlacement' => [
167 [
168 'label' => __( 'I will place ad units manually', 'advanced-ads' ),
169 'value' => 'manual',
170 ],
171 [
172 'label' => __( 'I will use Auto Ads and let Google place the ads automatically', 'advanced-ads' ),
173 'value' => 'auto_ads',
174 ],
175 ],
176 'autoAdsOptions' => [
177 [
178 'label' => __( 'Enable Auto Ads on my site', 'advanced-ads' ),
179 'value' => 'enable',
180 ],
181 [
182 'label' => __( 'Enable Accelerated Mobile Pages (AMP) Auto Ads', 'advanced-ads' ),
183 'value' => 'enableAmp',
184 ],
185 ],
186 'errors' => [
187 'notSaved' => __( 'Unknown error while saving account information.', 'advanced-ads' ),
188 'notFetched' => __( 'Unknown error while fetching AdSense account information.', 'advanced-ads' ),
189 'notAuthorized' => __( 'Unknown error while submitting the authorization code.', 'advanced-ads' ),
190 ],
191 'stepHeading' => __( 'Do you have a Google AdSense account?', 'advanced-ads' ),
192 'btnSignup' => __( 'No, I’d like to sign up for free now', 'advanced-ads' ),
193 'btnConnect' => __( 'Yes, connect to AdSense now', 'advanced-ads' ),
194 'labelAccount' => __( 'Account holder name:', 'advanced-ads' ),
195 'labelConnected' => __( 'You are connected to Google AdSense. Publisher ID:', 'advanced-ads' ),
196 'labelAdsPlacement' => __( 'Will you place ad units manually or use Google Auto Ads?', 'advanced-ads' ),
197 'labelAutoAds' => __( 'Please confirm these Auto Ads options', 'advanced-ads' ),
198 'footerProcessText' => __( 'Process', 'advanced-ads' ),
199 'footerEnableText' => [
200 'manual' => __( 'Create placement and ad', 'advanced-ads' ),
201 'autoAds' => __( 'Confirm Auto Ads options', 'advanced-ads' ),
202 ],
203 'footerDisableText' => __( 'Please select an option', 'advanced-ads' ),
204 ],
205 'congrats' => [
206 'adsenseManual' => [
207 'stepHeading' => __( "For the last step, import the desired ad unit from AdSense. Visit the ad's edit screen to make your selection.", 'advanced-ads' ),
208 'btnEditItem' => __( 'Select ad unit', 'advanced-ads' ),
209 'liveHeading' => sprintf(
210 /* translators: 1: opening strong tag, 2: closing strong tag, 3: opening italic tag, 4: closing italic tag. */
211 esc_html__( 'We have created a placement for your ad that will display %1$safter the 3rd paragraph on every post%2$s. Go to %3$sAdvanced Ads > Placements%4$s and edit the placement to change this.', 'advanced-ads' ),
212 '<strong>',
213 '</strong>',
214 '<i>',
215 '</i>'
216 ),
217 ],
218 'adsenseAuto' => [
219 'stepHeading' => __( "Everything's ready for AdSense to populate your site with Auto Ads. Make sure your site is verified, <strong>enable Auto Ads in your AdSense account</strong>, and, optionally, fine-tune their settings further.", 'advanced-ads' ),
220 'btnAccount' => __( 'Go to AdSense account', 'advanced-ads' ),
221 ],
222 'stepHeading' => __( 'We have created a placement for your ad that will display <strong>after the 3rd paragraph on every post</strong>. You may edit the placement to change this.', 'advanced-ads' ),
223 'liveHeading' => __( 'See the live ad in your website\'s frontend.', 'advanced-ads' ),
224 'btnEditItem' => __( 'Edit the placement', 'advanced-ads' ),
225 'btnLiveAd' => __( 'See the live ad', 'advanced-ads' ),
226 'upgradeHeading' => __( 'Upgrade to all features and full support today', 'advanced-ads' ),
227 'upgradeText' => __( 'Our All Access deal offers every drop of ad expertise that we\'ve acquired in more than ten years, distilled into one jam-packed plugin bundle, supported by a dedicated team of real persons eager to help you.', 'advanced-ads' ),
228 'btnUpgrade' => __( 'Upgrade now', 'advanced-ads' ),
229 'btnDashboard' => __( 'Go to the Dashboard', 'advanced-ads' ),
230 'upgradePoints' => [
231 [
232 'title' => __( 'More placements', 'advanced-ads' ),
233 'text' => __( 'to embed in high-converting spots', 'advanced-ads' ),
234 'icon' => true,
235 ],
236 [
237 'title' => __( 'More conditions', 'advanced-ads' ),
238 'text' => __( 'for advanced targeting', 'advanced-ads' ),
239 'icon' => true,
240 ],
241 [
242 'title' => __( 'Ad Tracking', 'advanced-ads' ),
243 'text' => __( 'to optimize performance', 'advanced-ads' ),
244 'icon' => true,
245 ],
246 [
247 'title' => __( 'Click Fraud Protection', 'advanced-ads' ),
248 'text' => __( 'to safeguard your accounts', 'advanced-ads' ),
249 'icon' => true,
250 ],
251 [
252 'title' => __( 'Lazy Loading', 'advanced-ads' ),
253 'text' => __( 'to speed up your website', 'advanced-ads' ),
254 'icon' => true,
255 ],
256 [
257 'text' => '' . __( 'and much more!', 'advanced-ads' ),
258 'icon' => false,
259 ],
260 ],
261 ],
262 ],
263 ]
264 );
265 }
266 }
267