PluginProbe
EmailKit – Email Customizer for WooCommerce & WP / 1.6.9
EmailKit – Email Customizer for WooCommerce & WP v1.6.9
1.6.9 1.6.8 1.6.7 trunk 1.0.0 1.2.0 1.4.0 1.4.5 1.5.0 1.5.1 1.5.2 1.5.3 1.5.4 1.5.5 1.5.6 1.5.7 1.5.8 1.5.9 1.6.0 1.6.1 1.6.2 1.6.3 1.6.4 1.6.5 1.6.6
emailkit / Promotional / Promotional.php

Promotional.php in EmailKit – Email Customizer for WooCommerce & WP 1.6.9, at Promotional/Promotional.php

299 lines 17.9 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace EmailKit\Promotional;
3 defined( 'ABSPATH' ) || exit;
4 use \Wpmet\UtilityPackage\Stories\Stories;
5 use \Wpmet\UtilityPackage\Notice\Notice;
6 use \Wpmet\UtilityPackage\Banner\Banner;
7 use \Wpmet\UtilityPackage\Rating\Rating;
8 use \Wpmet\UtilityPackage\Plugins\Plugins;
9
10 use \EmailKit\Promotional\ProAwareness\ProAwareness;
11 use \EmailKit\Promotional\Onboard\Onboard;
12 use \EmailKit\Promotional\Onboard\Attr;
13 class Promotional{
14
15 function init(){
16
17 /**
18 * Show Eamilkit Notice
19 */
20 Notice::init();
21
22 if( !class_exists( 'EmailKitPro' ) ){
23 Notice::instance( 'emailkit', 'go-pro-notice' ) # @plugin_slug @notice_name
24 ->set_dismiss( 'global', ( 3600 * 24 * 300 ) ) # @global/user @time_period
25 ->set_type( 'warning' ) # @notice_type
26 ->set_html(
27 sprintf(
28 '<div class="ekit-go-pro-notice"><strong>%1$s</strong> %2$s</div>',
29 esc_html__( 'Thank you for using EmailKit.', 'emailkit' ),
30 sprintf(
31 /* translators: %s: "Premium Version" link to the EmailKit pricing page. */
32 esc_html__( 'To get more amazing features and the outstanding pro ready-made templates, please get the %s.', 'emailkit' ),
33 '<a style="color: #FCB214;" target="_blank" href="' . esc_url( 'https://wpmet.com/emailkit-pricing' ) . '">' . esc_html__( 'Premium Version', 'emailkit' ) . '</a>'
34 )
35 )
36 ) # @notice_massage_html
37 ->call();
38 }
39
40 if( \EmailKit\Promotional\Util::get_settings( 'emailkit_user_consent_for_banner', 'yes' ) == 'yes' ){
41
42
43 /**
44 * MetForm get free templates promotional class initialization
45 *
46 */
47 if( !did_action('metform/after_load') && did_action('elementor/loaded') && class_exists('\EmailKit\Promotional\MetformPromoBanner\MetformPromoBanner') ) {
48
49 new \EmailKit\Promotional\MetformPromoBanner\MetformPromoBanner();
50 }
51
52 /**
53 * Show WPMET stories widget in the dashboard
54 */
55
56 $filter_string = ''; // elementskit,metform-pro
57 $filter_string .= ((!in_array('elementskit/elementskit.php', apply_filters('active_plugins', get_option('active_plugins')))) ? '' : ',elementskit');
58 $filter_string .= (!class_exists('\MetForm\Plugin') ? '' : ',metform');
59 $filter_string .= (!class_exists('\MetForm_Pro\Plugin') ? '' : ',metform-pro');
60
61 Stories::instance( 'metform' ) # @plugin_slug
62 // ->is_test(true) # @check_interval
63 ->set_filter( $filter_string ) # @active_plugins
64 ->set_plugin( 'EmailKit', 'https://wpmet.com/plugin/metform/' ) # @plugin_name @plugin_url
65 ->set_api_url( 'https://api.wpmet.com/public/stories/' ) # @api_url_for_stories
66 ->call();
67
68 /**
69 * Show WPMET banner (codename: jhanda)
70 */
71
72 Banner::instance( 'emailkit' ) # @plugin_slug
73 // ->is_test(true) # @check_interval
74 ->set_filter( ltrim( $filter_string, ',' ) ) # @active_plugins
75 ->set_api_url( 'https://api.wpmet.com/public/jhanda' ) # @api_url_for_banners
76 ->set_plugin_screens( 'edit-elementskit_template' ) # @set_allowed_screen
77 ->set_plugin_screens( 'toplevel_page_elementskit' ) # @set_allowed_screen
78 ->call();
79
80 /**
81 * Ask for Ratings
82 */
83 Rating::instance('emailkit') # @plugin_slug
84 ->set_message(
85 sprintf(
86 /* translators: %s: EmailKit plugin name, wrapped in a <strong> tag. */
87 esc_html__( 'Creating custom emails with a no-code solution - %s? 📩', 'emailkit' ),
88 '<strong>EmailKit</strong>'
89 ) . ' </br> ' . sprintf(
90 /* translators: %s: "5-star", wrapped in a <strong> tag. */
91 esc_html__( 'We would love to hear your thoughts! Share a %s review to keep us motivated. 🙌', 'emailkit' ),
92 '<strong>' . esc_html__( '5-star', 'emailkit' ) . '</strong>'
93 )
94 )
95 ->set_plugin_logo('https://ps.w.org/emailkit/assets/icon-128x128.png') # @plugin_logo_url
96 ->set_plugin('EmailKit', 'https://wpmet.com/wordpress.org/rating/emailkit') # @plugin_name @plugin_url
97 ->set_rating_url('https://wordpress.org/support/plugin/emailkit/reviews/#new-post')
98 ->set_support_url('https://wpmet.com/support-ticket')
99 ->set_allowed_screens('edit-emailkit') # @set_allowed_screen
100 ->set_allowed_screens('edit-emailkit') # @set_allowed_screen
101 ->set_allowed_screens('emailkit_page_emailkit_get_help') # @set_allowed_screen
102 ->set_priority(30) # @priority
103 ->set_first_appear_day(7) # @time_interval_days
104 ->set_condition(true) # @check_conditions
105 ->call();
106 }
107
108 /**
109 * Show our plugins menu for others wpmet plugins
110 */
111
112 Plugins::instance()->init('emailkit') # @text_domain
113 ->set_parent_menu_slug('emailkit-menu') # @plugin_slug
114 ->set_submenu_name(__('Our Plugins', 'emailkit'))
115 ->set_section_title(__('Get More out of Your WordPress Website!', 'emailkit'))
116 ->set_section_description(__('Revamp your website with other top plugins from us. And guess what, they\'re absolutely free!', 'emailkit')) # @section_description (optional)
117 ->set_items_per_row(4) # @items_per_row (optional- default: 6)
118 ->set_plugins( # @plugins
119 [
120 'elementskit-lite/elementskit-lite.php' => [
121 'name' => __('ElementsKit Elementor addons', 'emailkit'),
122 'url' => 'https://wordpress.org/plugins/elementskit-lite/',
123 'icon' => 'https://ps.w.org/elementskit-lite/assets/icon-256x256.gif?rev=2518175',
124 'desc' => __('All-in-one Elementor addon trusted by 1 Million+ users, makes your website builder process easier with ultimate freedom.', 'emailkit'),
125 'docs' => 'https://wpmet.com/docs/elementskit/',
126 ],
127 'gutenkit-blocks-addon/gutenkit-blocks-addon.php' => [
128 'name' => __('GutenKit', 'emailkit'),
129 'url' => 'https://wordpress.org/plugins/gutenkit-blocks-addon/',
130 'icon' => 'https://ps.w.org/gutenkit-blocks-addon/assets/icon-128x128.gif?rev=3116270',
131 'desc' => __('Gutenberg blocks, patterns, and templates that extend the page-building experience using the WordPress block editor.', 'emailkit'),
132 'docs' => 'https://wpmet.com/doc/gutenkit/',
133 ],
134 'rox-dynamic-cpt-fields-engine/rox-dynamic-cpt-fields-engine.php' => [
135 'name' => esc_html__('Rox Dynamic CPT Fields', 'emailkit'),
136 'url' => 'https://wordpress.org/plugins/rox-dynamic-cpt-fields-engine/',
137 'icon' => 'https://ps.w.org/rox-dynamic-cpt-fields-engine/assets/icon-256x256.jpeg?rev=3538537',
138 'desc' => esc_html__('Build custom post types, fields, taxonomies, and dynamic frontend layouts for WordPress, with zero coding and full AI-generated schema.', 'emailkit'),
139 'docs' => 'https://wpmet.com/doc/rox-dynamic-cpt-fields-engine/',
140 ],
141 'rox-appointment-booking/rox-appointment-booking.php' => [
142 'name' => esc_html__('Rox Appointment Booking', 'emailkit'),
143 'url' => 'https://wordpress.org/plugins/rox-appointment-booking/',
144 'icon' => 'https://ps.w.org/rox-appointment-booking/assets/icon-256x256.png?rev=3575641',
145 'desc' => esc_html__('Manage bookings, agents, payments, and calendars from one dashboard! A complete appointment and scheduling solution for WordPress.', 'emailkit'),
146 'docs' => 'https://wpmet.com/doc/rox-appointment-booking/',
147 ],
148 'metform/metform.php' => [
149 'name' => __('MetForm', 'emailkit'),
150 'url' => 'https://wordpress.org/plugins/metform/',
151 'icon' => 'https://ps.w.org/metform/assets/icon-256x256.png',
152 'desc' => __('Drag & drop form builder for Elementor to create contact forms, multi-step forms, and more — smoother, faster, and better!', 'emailkit'),
153 'docs' => 'https://wpmet.com/doc/metform/',
154 ],
155 'shopengine/shopengine.php' => [
156 'name' => __('Shopengine', 'emailkit'),
157 'url' => 'https://wordpress.org/plugins/shopengine/',
158 'icon' => 'https://ps.w.org/shopengine/assets/icon-256x256.gif?rev=2505061',
159 'desc' => __('Complete WooCommerce solution for Elementor to fully customize any pages including cart, checkout, shop page, and so on.', 'emailkit'),
160 'docs' => 'https://wpmet.com/doc/shopengine/',
161 ],
162 'popup-builder-block/popup-builder-block.php' => [
163 'name' => esc_html__('PopupKit', 'emailkit'),
164 'url' => 'https://wordpress.org/plugins/popup-builder-block/',
165 'icon' => 'https://ps.w.org/popup-builder-block/assets/icon-256x256.png?rev=3316844',
166 'desc' => esc_html__('Design popups that convert, right in your WordPress dashboard.', 'emailkit'),
167 'docs' => 'https://wpmet.com/doc/popupkit/',
168 ],
169 'table-builder-block/table-builder-block.php' => [
170 'name' => esc_html__('TableKit', 'emailkit'),
171 'url' => 'https://wordpress.org/plugins/table-builder-block/',
172 'icon' => 'https://ps.w.org/table-builder-block/assets/icon-256x256.png?rev=3509972',
173 'desc' => esc_html__('Fully Customizable. Multi-Media Integration. Synch Any Data Files. All Within Block Editor.', 'emailkit'),
174 'docs' => 'https://wpmet.com/doc/tablekit/',
175 ],
176 'getgenie/getgenie.php' => [
177 'name' => __('GetGenie', 'emailkit'),
178 'url' => 'https://wordpress.org/plugins/getgenie/',
179 'icon' => 'https://ps.w.org/getgenie/assets/icon-256x256.gif?rev=2798355',
180 'desc' => __('Your personal AI assistant for content and SEO. Write content that ranks on Google with NLP keywords and SERP analysis data.', 'emailkit'),
181 'docs' => 'https://getgenie.ai/docs/',
182 ],
183 'wp-social/wp-social.php' => [
184 'name' => __('WP Social', 'emailkit'),
185 'url' => 'https://wordpress.org/plugins/wp-social/',
186 'icon' => 'https://ps.w.org/wp-social/assets/icon-256x256.png?rev=2544214',
187 'desc' => __('Add social share, login, and engagement counter — unified solution for all social media with tons of different styles for your website.', 'emailkit'),
188 'docs' => 'https://wpmet.com/doc/wp-social/',
189 ],
190 'blocks-for-shopengine/shopengine-gutenberg-addon.php' => [
191 'name' => __('Blocks for ShopEngine', 'emailkit'),
192 'url' => 'https://wordpress.org/plugins/blocks-for-shopengine/',
193 'icon' => 'https://ps.w.org/blocks-for-shopengine/assets/icon-256x256.gif?rev=2702483',
194 'desc' => __('All in one WooCommerce solution for Gutenberg! Build your WooCommerce pages in a block editor with full customization.', 'emailkit'),
195 'docs' => 'https://wpmet.com/doc/shopengine/shopengine-gutenberg/',
196 ],
197
198 ]
199 )
200 ->call();
201
202 $is_pro_active = '';
203
204 if (!in_array('emailkit-pro/emailkit-pro.php', apply_filters('active_plugins', get_option('active_plugins')))) {
205 $is_pro_active = __('Go Premium', 'emailkit');
206 }
207
208 $pro_awareness = ProAwareness::instance('emailkit');
209 $pro_awareness
210 ->set_parent_menu_slug('emailkit-menu')
211 ->set_pro_link(
212 (in_array('emailkit-pro/emailkit-pro.php', apply_filters('active_plugins', get_option('active_plugins')))) ? '' :
213 'https://wpmet.com/emailkit-pricing'
214 )
215 ->set_plugin_file('emailkit/EmailKit.php')
216 ->set_default_grid_thumbnail(EMAILKIT_URL . '/Promotional/ProAwareness/assets/images/support.png')
217 ->set_page_grid([
218 'url' => 'https://wpmet.com/fb-group',
219 'title' => __('Join the Community', 'emailkit'),
220 'thumbnail' => EMAILKIT_URL . '/Promotional/ProAwareness/assets/images/community.png',
221 'description' => __('Join our Facebook group to get 20% discount coupon on premium products. Follow us to get more exciting offers.', 'emailkit')
222
223 ])
224 ->set_page_grid([
225 'url' => 'https://www.youtube.com/watch?v=Fz_1M-s_Faw&list=PL3t2OjZ6gY8O0ul4d9KROcQMyoSaTad6N',
226 'title' => __('Video Tutorials', 'emailkit'),
227 'thumbnail' => EMAILKIT_URL . '/Promotional/ProAwareness/assets/images/videos.png',
228 'description' => __('Learn the step by step process for developing your site easily from video tutorials.', 'emailkit')
229 ])
230 ->set_page_grid([
231 'url' => 'https://wpmet.com/plugin/emailkit/roadmaps#ideas',
232 'title' => __('Request a feature', 'emailkit'),
233 'thumbnail' => EMAILKIT_URL . '/Promotional/ProAwareness/assets/images/request.png',
234 'description' => __('Have any special feature in mind? Let us know through the feature request.', 'emailkit')
235 ])
236 ->set_page_grid([
237 'url' => 'https://wpmet.com/doc/emailkit/',
238 'title' => __('Documentation', 'emailkit'),
239 'thumbnail' => EMAILKIT_URL . '/Promotional/ProAwareness/assets/images/documentation.png',
240 'description' => __('Detailed documentation to help you understand the functionality of each feature.', 'emailkit')
241 ])
242 ->set_page_grid([
243 'url' => 'https://wpmet.com/plugin/emailkit/roadmaps/',
244 'title' => __('Public Roadmap', 'emailkit'),
245 'thumbnail' => EMAILKIT_URL . '/Promotional/ProAwareness/assets/images/roadmaps.png',
246 'description' => __('Check our upcoming new features, detailed development stories and tasks', 'emailkit')
247 ])
248
249 ->set_plugin_row_meta(__('Documentation', 'emailkit'), 'https://help.wpmet.com/docs-cat/emailkit/', ['target' => '_blank'])
250 ->set_plugin_row_meta(__('Facebook Community', 'emailkit'), 'https://wpmet.com/fb-group', ['target' => '_blank'])
251 ->set_plugin_row_meta(__('Rate the plugin �
252
253
254
255
256 ', 'emailkit'), 'https://wordpress.org/support/plugin/emailkit/reviews/#new-post', ['target' => '_blank'])
257 ->set_plugin_action_link(__('Settings', 'emailkit'), admin_url() . 'admin.php?page=emailkit-menu-settings')
258 ->set_plugin_action_link($is_pro_active, 'https://wpmet.com/plugin/emailkit/pricing/', ['target' => '_blank', 'style' => 'color: #FCB214; font-weight: bold;'])
259 ->call();
260
261 if( ! $this->already_onboarded_other() ){
262
263 Onboard::instance()->init();
264
265 if(isset($_GET['emailkit-onboard-steps']) && isset($_GET['emailkit-onboard-steps-nonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_GET['emailkit-onboard-steps-nonce'])),'emailkit-onboard-steps-action')) {
266 Attr::instance();
267 }
268 }
269
270 add_action('emailkit-settings', function(){
271
272 if( ! $this->already_onboarded_other() ){
273
274 if(isset($_GET['emailkit-onboard-steps']) && $_GET['emailkit-onboard-steps'] == 'loaded' && isset($_GET['emailkit-onboard-steps-nonce']) && wp_verify_nonce(sanitize_text_field(wp_unslash($_GET['emailkit-onboard-steps-nonce'])),'emailkit-onboard-steps-action')) {
275 wp_enqueue_style( 'emailkit-steps-css-steps' ); // needed when onboardning
276 Onboard::instance()->views();
277 return; // Exit early during onboarding to prevent showing ProConsent form
278 }
279 }
280
281 // Only show ProConsent form when not in onboarding mode
282 (new \EmailKit\Promotional\ProConsent())->get_consent_form();
283 }
284 );
285 }
286
287 /**
288 * Check if user already onboarded for any of the plugins (elements_kit, met_form or shopengine).
289 *
290 * @return bool
291 *
292 * @since 1.5.4
293 */
294 public function already_onboarded_other() {
295
296 return get_option( 'elements_kit_onboard_status' ) == 'onboarded' || get_option( 'met_form_onboard_status' ) == 'onboarded' || get_option( 'shopengine_onboard_status' ) == '1';
297 }
298
299 }