install-automator.php
15.5 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
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
121
122
123
124
125
126
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
<?php
namespace uncanny_learndash_toolkit;
/**
* Class AdminMenu
*
* @package uncanny_learndash_toolkit
*/
class InstallAutomator extends Boot {
/**
* class constructor
*/
public function __construct() {
// Setup Theme Options Page Menu in Admin
if ( is_admin() ) {
add_action( 'admin_menu', array( $this, 'add_try_automator_page' ), 99 );
add_action( 'admin_enqueue_scripts', array( $this, 'enqueue_styles' ) );
add_action( 'admin_init', array( $this, 'install_callback' ), 99 );
}
}
/**
* add_try_automator_page
*
* @return void
*/
public function add_try_automator_page() {
// Check if Automator is already installed
if ( defined( 'AUTOMATOR_BASE_FILE' ) ) {
return;
}
// Check if we have to render the item
if ( ! apply_filters( 'ult_admin_sidebar_try_automator_add', true ) ) {
return;
}
// Get the item text
$menu_item_text = apply_filters( 'ult_admin_sidebar_try_automator_text', __( 'Automation', 'uncanny-learndash-toolkit' ) );
// Create the link content
$menu_item_html = '<span class="ult-sidebar-featured-item">' . apply_filters( 'ult_admin_sidebar_try_automator_inner_html', '<span class="ult-sidebar-featured-item__text">' . $menu_item_text . '</span>' ) . '</span>';
// Add the subpage menu
add_submenu_page(
'uncanny-toolkit',
$menu_item_text,
$menu_item_html,
'manage_options',
'install-automator',
array( $this, 'install_automator_page' ),
1
);
}
/**
* enqueue_styles
*
* @param mixed $hook
* @return void
*/
public function enqueue_styles( $hook ) {
// Target Uncanny Automator installation page
if ( strpos( $hook, 'install-automator' ) ) {
// Remove all notices
remove_all_actions( 'user_admin_notices' );
remove_all_actions( 'admin_notices' );
wp_enqueue_style( 'install-automator', Config::get_admin_css( 'install-automator.css' ), array(), UNCANNY_TOOLKIT_VERSION );
wp_enqueue_style( 'google-fonts-css', 'https://fonts.googleapis.com/css?family=Nunito%3A700%2C800&', array(), UNCANNY_TOOLKIT_VERSION );
wp_enqueue_script( 'recipe-simulator', Config::get_admin_js( 'recipe-simulator.js' ), array( 'jquery' ), UNCANNY_TOOLKIT_VERSION, true );
}
}
/**
* install_automator_page
*
* @return void
*/
public function install_automator_page() {
$one_click_install = new \uncanny_one_click_installer\Auto_Plugin_Install();
?>
<div class="wrap uo-install-automator">
<div class="uo-install-automator__header">
<h1>
<?php esc_html_e( 'Take your site to the next level with Uncanny Automator', 'uncanny-learndash-toolkit' ); ?>
</h1>
<p><?php esc_html_e( 'Finding Uncanny Toolkit useful for your LearnDash site?', 'uncanny-learndash-toolkit' ); ?></br>
<?php esc_html_e( "You'll love", 'uncanny-learndash-toolkit' ); ?> <strong><?php esc_html_e( 'Uncanny Automator', 'uncanny-learndash-toolkit' ); ?></strong>. <?php esc_html_e( 'Best of all,', 'uncanny-learndash-toolkit' ); ?> <strong><?php esc_html_e( "it's free!", 'uncanny-learndash-toolkit' ); ?></strong></p>
<div class="uo-install-automator__box">
<div class="uo-install-automator__logo">
<img src="<?php echo esc_url( Config::get_admin_media( 'install-automator/uncanny-automator-icon.svg' ) ); ?>" alt="Uncanny Automator logo" />
</div>
<div class="uo-install-automator__text">
<h3><?php esc_html_e( 'Uncanny Automator', 'uncanny-learndash-toolkit' ); ?></h3>
<span><?php esc_html_e( 'By the creators of Uncanny Toolkit', 'uncanny-learndash-toolkit' ); ?></span>
<span class="uo-install-automator__rating">
<img src="<?php echo esc_url( Config::get_admin_media( 'install-automator/icon-star-yellow.svg' ) ); ?>" alt="Yellow star" />
<img src="<?php echo esc_url( Config::get_admin_media( 'install-automator/icon-star-yellow.svg' ) ); ?>" alt="Yellow star" />
<img src="<?php echo esc_url( Config::get_admin_media( 'install-automator/icon-star-yellow.svg' ) ); ?>" alt="Yellow star" />
<img src="<?php echo esc_url( Config::get_admin_media( 'install-automator/icon-star-yellow.svg' ) ); ?>" alt="Yellow star" />
<img src="<?php echo esc_url( Config::get_admin_media( 'install-automator/icon-star-yellow.svg' ) ); ?>" alt="Yellow star" />
</span>
</div>
<div class="uo-install-automator__button">
<?php echo $one_click_install->button( 'uncanny-automator', admin_url( 'post-new.php?post_type=uo-recipe' ) ); ?>
</div>
</div>
</div>
<div class="uo-install-automator__body">
<h2><?php esc_html_e( 'How it works', 'uncanny-learndash-toolkit' ); ?></h2>
<p><?php esc_html_e( 'Use Uncanny Automator to get your favourite plugins and apps talking to each other —', 'uncanny-learndash-toolkit' ); ?>
<strong><?php esc_html_e( 'without hiring a developer to write custom code.', 'uncanny-learndash-toolkit' ); ?></strong></p>
<p><?php esc_html_e( 'Here are a few examples:', 'uncanny-learndash-toolkit' ); ?></p>
<ul class="uo-install-automator__examples">
<li>
<?php
echo wp_kses(
sprintf(
__(
'When a user completes a course and fills out an evaluation form, add a row with the form entries to a %1$sGoogle Sheet%2$s and add the user to alumni %1$sBuddyBoss%2$s and %1$sLearnDash%2$s groups.',
'uncanny-learndash-toolkit'
),
'<strong>',
'</strong>'
),
array(
'strong' => array(),
)
);
?>
<?php esc_html_e( 'When a user completes a course and fills out an evaluation form, add a row with the form entries to a', 'uncanny-learndash-toolkit' ); ?>
<strong><?php esc_html_e( 'Google Sheet', 'uncanny-learndash-toolkit' ); ?></strong>
<?php esc_html_e( 'and add the user to alumni', 'uncanny-learndash-toolkit' ); ?>
<strong><?php esc_html_e( 'BuddyBoss', 'uncanny-learndash-toolkit' ); ?></strong>
<?php esc_html_e( 'and', 'uncanny-learndash-toolkit' ); ?>
<strong><?php esc_html_e( 'LearnDash', 'uncanny-learndash-toolkit' ); ?></strong>
<?php esc_html_e( ' groups.', 'uncanny-learndash-toolkit' ); ?>
<div class="uo-install-automator__requirements">
<label><?php esc_html_e( 'Requires', 'uncanny-learndash-toolkit' ); ?></label>
<ul>
<li><span class="uo-install-automator__icon"><img src="<?php echo esc_url( Config::get_admin_media( 'install-automator/integrations/google-sheet-icon.svg' ) ); ?>" alt="Google Sheets icon" /></span> Google Sheets</li>
<li><span class="uo-install-automator__icon"><img src="<?php echo esc_url( Config::get_admin_media( 'install-automator/integrations/buddyboss-icon.svg' ) ); ?>" alt="BuddyBoss icon" /></span> BuddyBoss</li>
<li><span class="uo-install-automator__icon"><img src="<?php echo esc_url( Config::get_admin_media( 'install-automator/integrations/learndash-icon.svg' ) ); ?>" alt="Learndash icon" /></span> LearnDash</li>
</ul>
</div>
</li>
<li>
<?php
echo wp_kses(
sprintf(
__(
'When a new blog post is published, automatically post it to %1$sTwitter%2$s and email the post to a %1$sMailChimp%2$s list.',
'uncanny-learndash-toolkit'
),
'<strong>',
'</strong>'
),
array(
'strong' => array(),
)
);
?>
<div class="uo-install-automator__requirements">
<label><?php esc_html_e( 'Requires', 'uncanny-learndash-toolkit' ); ?></label>
<ul>
<li><span class="uo-install-automator__icon"><img src="<?php echo esc_url( Config::get_admin_media( 'install-automator/integrations/twitter-icon.svg' ) ); ?>" alt="Twitter icon" /></span> Twitter</li>
<li><span class="uo-install-automator__icon"><img src="<?php echo esc_url( Config::get_admin_media( 'install-automator/integrations/mailchimp-icon.svg' ) ); ?>" alt="Mailchimp icon" /></span> Mailchimp</li>
</ul>
</div>
</li>
<li>
<?php
echo wp_kses(
sprintf(
__(
'When a user purchases a product, register them for a live event in %1$sEvents Calendar%2$s add them to a %1$sLearnDash%2$s group and send a %1$sWooCommerce%2$s coupon code for their next order.',
'uncanny-learndash-toolkit'
),
'<strong>',
'</strong>'
),
array(
'strong' => array(),
)
);
?>
<div class="uo-install-automator__requirements">
<label><?php esc_html_e( 'Requires', 'uncanny-learndash-toolkit' ); ?></label>
<ul>
<li><span class="uo-install-automator__icon"><img src="<?php echo esc_url( Config::get_admin_media( 'install-automator/integrations/the-events-calendar-icon.svg' ) ); ?>" alt="Events Calendar icon" /></span> Events Calendar</li>
<li><span class="uo-install-automator__icon"><img src="<?php echo esc_url( Config::get_admin_media( 'install-automator/integrations/learndash-icon.svg' ) ); ?>" alt="Learndash icon" /></span> LearnDash</li>
<li><span class="uo-install-automator__icon"><img src="<?php echo esc_url( Config::get_admin_media( 'install-automator/integrations/woocommerce-icon.svg' ) ); ?>" alt="WooCommerce icon" /></span> WooCommerce</li>
</ul>
</div>
</li>
<li>
<?php
echo wp_kses(
sprintf(
__(
'When a user clicks a button, register them for a %1$sZoom%2$s webinar, reset their progress in one course and enroll them in another course.',
'uncanny-learndash-toolkit'
),
'<strong>',
'</strong>'
),
array(
'strong' => array(),
)
);
?>
<div class="uo-install-automator__requirements">
<label><?php esc_html_e( 'Requires', 'uncanny-learndash-toolkit' ); ?></label>
<ul>
<li><span class="uo-install-automator__icon"><img src="<?php echo esc_url( Config::get_admin_media( 'install-automator/integrations/zoom-icon.svg' ) ); ?>" alt="Zoom icon" /></span> Zoom Meetings</li>
</ul>
</div>
</li>
</ul>
<?php
$utm = '?utm_source=';
if ( defined( 'UNCANNY_TOOLKIT_PRO_PATH' ) ) {
$utm .= 'uncanny_toolkit_pro';
} else {
$utm .= 'uncanny_toolkit_free';
}
$utm .= '&utm_medium=try_automator&utm_content=all_of_the_most_popular_plugins';
?>
<div class="uo-install-automator__recipes">
<div class="header">
<strong><?php esc_html_e( 'Uncanny Automator', 'uncanny-learndash-toolkit' ); ?></strong> <?php esc_html_e( 'supports', 'uncanny-learndash-toolkit' ); ?> <a href="https://automatorplugin.com/integrations/<?php echo $utm; ?>" target="_blank"> <?php esc_html_e( 'all of the most popular WordPress plugins', 'uncanny-learndash-toolkit' ); ?> <span class="external-link"><img src="<?php echo esc_url( Config::get_admin_media( 'install-automator/icon-link-blue.svg' ) ); ?>" alt="External link icon" /></span></a> <?php esc_html_e( "and we're adding new integrations all the time. The possibilities are limitless.", 'uncanny-learndash-toolkit' ); ?>
</div>
<div class="triggers">
<div class="uo-recipe-simulator">
<div class="uo-recipe-simulator__title"><?php esc_html_e( 'Choose any combination of triggers', 'uncanny-learndash-toolkit' ); ?></div>
<div class="uo-recipe-simulator__box">
<div class="uo-recipe-simulator__items">
<ul>
<li><?php esc_html_e( 'Users complete a lesson', 'uncanny-learndash-toolkit' ); ?></li>
<li><?php esc_html_e( 'Users are added to a group', 'uncanny-learndash-toolkit' ); ?></li>
<li><?php esc_html_e( 'Users fill out a form', 'uncanny-learndash-toolkit' ); ?></li>
<li><?php esc_html_e( 'Users register for an event', 'uncanny-learndash-toolkit' ); ?></li>
<li><?php esc_html_e( 'Users buy a product', 'uncanny-learndash-toolkit' ); ?></li>
<li><?php esc_html_e( 'Users complete a course', 'uncanny-learndash-toolkit' ); ?></li>
<li><?php esc_html_e( 'Users fail a quiz', 'uncanny-learndash-toolkit' ); ?></li>
</ul>
</div>
</div>
</div>
</div>
<div class="actions">
<div class="uo-recipe-simulator">
<div class="uo-recipe-simulator__title"><?php esc_html_e( '...to initiate any combination of actions', 'uncanny-learndash-toolkit' ); ?></div>
<div class="uo-recipe-simulator__box">
<div class="uo-recipe-simulator__items">
<ul>
<li><?php esc_html_e( 'Add users to a group', 'uncanny-learndash-toolkit' ); ?></li>
<li><?php esc_html_e( 'Send an email', 'uncanny-learndash-toolkit' ); ?></li>
<li><?php esc_html_e( 'Mark a lesson complete', 'uncanny-learndash-toolkit' ); ?></li>
<li><?php esc_html_e( 'Unlock a new course', 'uncanny-learndash-toolkit' ); ?></li>
<li><?php esc_html_e( 'Reset course progress', 'uncanny-learndash-toolkit' ); ?></li>
<li><?php esc_html_e( 'Trigger a Zapier webhook', 'uncanny-learndash-toolkit' ); ?></li>
<li><?php esc_html_e( 'Add a tag in Infusionsoft', 'uncanny-learndash-toolkit' ); ?></li>
</ul>
</div>
</div>
</div>
</div>
<script>
// Global JS variable to init the JS
window.hasRecipeSimulator = true;
</script>
<div class="robot">
<span class="robot"><img src="<?php echo esc_url( Config::get_admin_media( 'install-automator/uncanny-automator-present-pose.svg' ) ); ?>" alt="External link icon" /></span>
</div>
</div>
<p>
<?php esc_html_e( 'Build better experiences for your users while saving money on custom development. And save', 'uncanny-learndash-toolkit' ); ?>
<strong><?php esc_html_e( 'your', 'uncanny-learndash-toolkit' ); ?></strong>
<?php esc_html_e( 'time by automating routine tasks — all with no code.', 'uncanny-learndash-toolkit' ); ?>
</p>
<div class="uo-install-automator__box">
<div class="uo-install-automator__logo">
<img src="<?php echo esc_url( Config::get_admin_media( 'install-automator/uncanny-automator-icon.svg' ) ); ?>" alt="Uncanny Automator logo" />
</div>
<div class="uo-install-automator__text">
<h3><?php esc_html_e( 'Uncanny Automator', 'uncanny-learndash-toolkit' ); ?></h3>
<span><?php esc_html_e( 'By the creators of Uncanny Toolkit', 'uncanny-learndash-toolkit' ); ?></span>
<span class="uo-install-automator__rating">
<img src="<?php echo esc_url( Config::get_admin_media( 'install-automator/icon-star-yellow.svg' ) ); ?>" alt="Yellow star" />
<img src="<?php echo esc_url( Config::get_admin_media( 'install-automator/icon-star-yellow.svg' ) ); ?>" alt="Yellow star" />
<img src="<?php echo esc_url( Config::get_admin_media( 'install-automator/icon-star-yellow.svg' ) ); ?>" alt="Yellow star" />
<img src="<?php echo esc_url( Config::get_admin_media( 'install-automator/icon-star-yellow.svg' ) ); ?>" alt="Yellow star" />
<img src="<?php echo esc_url( Config::get_admin_media( 'install-automator/icon-star-yellow.svg' ) ); ?>" alt="Yellow star" />
</span>
</div>
<div class="uo-install-automator__button">
<?php echo $one_click_install->button( 'uncanny-automator', esc_url( admin_url( 'post-new.php?post_type=uo-recipe' ) ) ); ?>
</div>
</div>
</div>
</div>
<?php
}
/**
* install_callback
*
* @return void
*/
public function install_callback() {
$one_click_install = new \uncanny_one_click_installer\Auto_Plugin_Install();
$one_click_install->create_ajax();
}
}