| 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 |
' |
| 28 |
<div class="ekit-go-pro-notice"> |
| 29 |
<strong>Thank you for using EmailKit .</strong> To get more amazing |
| 30 |
features and the outstanding pro ready-made templates, please get the |
| 31 |
<a style="color: #FCB214;" target="_blank" |
| 32 |
href="https://wpmet.com/emailkit-pricing">Premium Version</a>. |
| 33 |
</div> |
| 34 |
' |
| 35 |
) # @notice_massage_html |
| 36 |
->call(); |
| 37 |
} |
| 38 |
|
| 39 |
if( \EmailKit\Promotional\Util::get_settings( 'emailkit_user_consent_for_banner', 'yes' ) == 'yes' ){ |
| 40 |
|
| 41 |
|
| 42 |
/** |
| 43 |
* MetForm get free templates promotional class initialization |
| 44 |
* |
| 45 |
*/ |
| 46 |
if( !did_action('metform/after_load') && did_action('elementor/loaded') && class_exists('\EmailKit\Promotional\MetformPromoBanner\MetformPromoBanner') ) { |
| 47 |
|
| 48 |
new \EmailKit\Promotional\MetformPromoBanner\MetformPromoBanner(); |
| 49 |
} |
| 50 |
|
| 51 |
/** |
| 52 |
* Show WPMET stories widget in the dashboard |
| 53 |
*/ |
| 54 |
|
| 55 |
$filter_string = ''; // elementskit,metform-pro |
| 56 |
$filter_string .= ((!in_array('elementskit/elementskit.php', apply_filters('active_plugins', get_option('active_plugins')))) ? '' : ',elementskit'); |
| 57 |
$filter_string .= (!class_exists('\MetForm\Plugin') ? '' : ',metform'); |
| 58 |
$filter_string .= (!class_exists('\MetForm_Pro\Plugin') ? '' : ',metform-pro'); |
| 59 |
|
| 60 |
Stories::instance( 'metform' ) # @plugin_slug |
| 61 |
// ->is_test(true) # @check_interval |
| 62 |
->set_filter( $filter_string ) # @active_plugins |
| 63 |
->set_plugin( 'EmailKit', 'https://wpmet.com/plugin/metform/' ) # @plugin_name @plugin_url |
| 64 |
->set_api_url( 'https://api.wpmet.com/public/stories/' ) # @api_url_for_stories |
| 65 |
->call(); |
| 66 |
|
| 67 |
/** |
| 68 |
* Show WPMET banner (codename: jhanda) |
| 69 |
*/ |
| 70 |
|
| 71 |
Banner::instance( 'emailkit' ) # @plugin_slug |
| 72 |
// ->is_test(true) # @check_interval |
| 73 |
->set_filter( ltrim( $filter_string, ',' ) ) # @active_plugins |
| 74 |
->set_api_url( 'https://api.wpmet.com/public/jhanda' ) # @api_url_for_banners |
| 75 |
->set_plugin_screens( 'edit-elementskit_template' ) # @set_allowed_screen |
| 76 |
->set_plugin_screens( 'toplevel_page_elementskit' ) # @set_allowed_screen |
| 77 |
->call(); |
| 78 |
|
| 79 |
/** |
| 80 |
* Ask for Ratings |
| 81 |
*/ |
| 82 |
Rating::instance('emailkit') # @plugin_slug |
| 83 |
->set_message('Creating custom emails with a no-code solution - <strong>EmailKit?</strong> 📩 </br> |
| 84 |
We would love to hear your thoughts! Share a <strong>5-star</strong> review to keep us motivated. 🙌') |
| 85 |
->set_plugin_logo('https://ps.w.org/emailkit/assets/icon-128x128.png') # @plugin_logo_url |
| 86 |
->set_plugin('EmailKit', 'https://wpmet.com/wordpress.org/rating/emailkit') # @plugin_name @plugin_url |
| 87 |
->set_rating_url('https://wordpress.org/support/plugin/emailkit/reviews/#new-post') |
| 88 |
->set_support_url('https://wpmet.com/support-ticket') |
| 89 |
->set_allowed_screens('edit-emailkit') # @set_allowed_screen |
| 90 |
->set_allowed_screens('edit-emailkit') # @set_allowed_screen |
| 91 |
->set_allowed_screens('emailkit_page_emailkit_get_help') # @set_allowed_screen |
| 92 |
->set_priority(30) # @priority |
| 93 |
->set_first_appear_day(7) # @time_interval_days |
| 94 |
->set_condition(true) # @check_conditions |
| 95 |
->call(); |
| 96 |
} |
| 97 |
|
| 98 |
/** |
| 99 |
* Show our plugins menu for others wpmet plugins |
| 100 |
*/ |
| 101 |
|
| 102 |
Plugins::instance()->init('emailkit') # @text_domain |
| 103 |
->set_parent_menu_slug('emailkit-menu') # @plugin_slug |
| 104 |
->set_submenu_name('Our Plugins') |
| 105 |
->set_section_title('Get More out of Your WordPress Website!') |
| 106 |
->set_section_description('Revamp your website with other top plugins from us. And guess what, they\'re absolutely free!') # @section_description (optional) |
| 107 |
->set_items_per_row(4) # @items_per_row (optional- default: 6) |
| 108 |
->set_plugins( # @plugins |
| 109 |
[ |
| 110 |
'elementskit-lite/elementskit-lite.php' => [ |
| 111 |
'name' => 'ElementsKit Elementor addons', |
| 112 |
'url' => 'https://wordpress.org/plugins/elementskit-lite/', |
| 113 |
'icon' => 'https://ps.w.org/elementskit-lite/assets/icon-256x256.gif?rev=2518175', |
| 114 |
'desc' => 'All-in-one Elementor addon trusted by 1 Million+ users, makes your website builder process easier with ultimate freedom.', |
| 115 |
'docs' => 'https://wpmet.com/docs/elementskit/', |
| 116 |
], |
| 117 |
'getgenie/getgenie.php' => [ |
| 118 |
'name' => 'GetGenie', |
| 119 |
'url' => 'https://wordpress.org/plugins/getgenie/', |
| 120 |
'icon' => 'https://ps.w.org/getgenie/assets/icon-256x256.gif?rev=2798355', |
| 121 |
'desc' => 'Your personal AI assistant for content and SEO. Write content that ranks on Google with NLP keywords and SERP analysis data.', |
| 122 |
'docs' => 'https://getgenie.ai/docs/', |
| 123 |
], |
| 124 |
'gutenkit-blocks-addon/gutenkit-blocks-addon.php' => [ |
| 125 |
'name' => 'GutenKit', |
| 126 |
'url' => 'https://wordpress.org/plugins/gutenkit-blocks-addon/', |
| 127 |
'icon' => 'https://ps.w.org/gutenkit-blocks-addon/assets/icon-128x128.gif?rev=3116270', |
| 128 |
'desc' => 'Gutenberg blocks, patterns, and templates that extend the page-building experience using the WordPress block editor.', |
| 129 |
'docs' => 'https://wpmet.com/doc/gutenkit/', |
| 130 |
], |
| 131 |
'shopengine/shopengine.php' => [ |
| 132 |
'name' =>'Shopengine', |
| 133 |
'url' => 'https://wordpress.org/plugins/shopengine/', |
| 134 |
'icon' => 'https://ps.w.org/shopengine/assets/icon-256x256.gif?rev=2505061', |
| 135 |
'desc' => 'Complete WooCommerce solution for Elementor to fully customize any pages including cart, checkout, shop page, and so on.', |
| 136 |
'docs' => 'https://wpmet.com/doc/shopengine/', |
| 137 |
], |
| 138 |
'metform/metform.php' => [ |
| 139 |
'name' => 'MetForm', |
| 140 |
'url' => 'https://wordpress.org/plugins/metform/', |
| 141 |
'icon' => 'https://ps.w.org/metform/assets/icon-256x256.png', |
| 142 |
'desc' => 'Drag & drop form builder for Elementor to create contact forms, multi-step forms, and more — smoother, faster, and better!', |
| 143 |
'docs' => 'https://wpmet.com/doc/metform/', |
| 144 |
], |
| 145 |
|
| 146 |
'wp-social/wp-social.php' => [ |
| 147 |
'name' => 'WP Social', |
| 148 |
'url' => 'https://wordpress.org/plugins/wp-social/', |
| 149 |
'icon' => 'https://ps.w.org/wp-social/assets/icon-256x256.png?rev=2544214', |
| 150 |
'desc' => 'Add social share, login, and engagement counter — unified solution for all social media with tons of different styles for your website.', |
| 151 |
'docs' => 'https://wpmet.com/doc/wp-social/', |
| 152 |
], |
| 153 |
|
| 154 |
'wp-ultimate-review/wp-ultimate-review.php' => [ |
| 155 |
'name' => 'WP Ultimate Review', |
| 156 |
'url' => 'https://wordpress.org/plugins/wp-ultimate-review/', |
| 157 |
'icon' => 'https://ps.w.org/wp-ultimate-review/assets/icon-256x256.png?rev=2544187', |
| 158 |
'desc' => 'Collect and showcase reviews on your website to build brand credibility and social proof with the easiest solution.', |
| 159 |
'docs' => 'https://wpmet.com/doc/wp-ultimate-review/', |
| 160 |
], |
| 161 |
|
| 162 |
'wp-fundraising-donation/wp-fundraising.php' => [ |
| 163 |
'name' => 'FundEngine', |
| 164 |
'url' => 'https://wordpress.org/plugins/wp-fundraising-donation/', |
| 165 |
'icon' => 'https://ps.w.org/wp-fundraising-donation/assets/icon-256x256.png?rev=2544150', |
| 166 |
'desc' => 'Create fundraising, crowdfunding, and donation websites with PayPal and Stripe payment gateway integration.', |
| 167 |
|
| 168 |
'docs' => 'https://wpmet.com/doc/fundengine/', |
| 169 |
], |
| 170 |
'blocks-for-shopengine/shopengine-gutenberg-addon.php' => [ |
| 171 |
'name' => 'Blocks for ShopEngine', |
| 172 |
'url' => 'https://wordpress.org/plugins/blocks-for-shopengine/', |
| 173 |
'icon' => 'https://ps.w.org/blocks-for-shopengine/assets/icon-256x256.gif?rev=2702483', |
| 174 |
'desc' => 'All in one WooCommerce solution for Gutenberg! Build your WooCommerce pages in a block editor with full customization.', |
| 175 |
'docs' => 'https://wpmet.com/doc/shopengine/shopengine-gutenberg/', |
| 176 |
], |
| 177 |
'genie-image-ai/genie-image-ai.php' => [ |
| 178 |
'name' => 'Genie Image', |
| 179 |
'url' => 'https://wordpress.org/plugins/genie-image-ai/', |
| 180 |
'icon' => 'https://ps.w.org/genie-image-ai/assets/icon-256x256.png?rev=2977297', |
| 181 |
'desc' => 'AI-powered text-to-image generator for WordPress with OpenAI’s DALL-E 2 technology to generate high-quality images in one click.', |
| 182 |
'docs' => 'https://getgenie.ai/docs/', |
| 183 |
], |
| 184 |
|
| 185 |
] |
| 186 |
) |
| 187 |
->call(); |
| 188 |
|
| 189 |
$is_pro_active = ''; |
| 190 |
|
| 191 |
if (!in_array('emailkit-pro/emailkit-pro.php', apply_filters('active_plugins', get_option('active_plugins')))) { |
| 192 |
$is_pro_active = 'Go Premium'; |
| 193 |
} |
| 194 |
|
| 195 |
$pro_awareness = ProAwareness::instance('emailkit'); |
| 196 |
$pro_awareness |
| 197 |
->set_parent_menu_slug('emailkit-menu') |
| 198 |
->set_pro_link( |
| 199 |
(in_array('emailkit-pro/emailkit-pro.php', apply_filters('active_plugins', get_option('active_plugins')))) ? '' : |
| 200 |
'https://wpmet.com/emailkit-pricing' |
| 201 |
) |
| 202 |
->set_plugin_file('emailkit/EmailKit.php') |
| 203 |
->set_default_grid_thumbnail(EMAILKIT_URL . '/Promotional/ProAwareness/assets/images/support.png') |
| 204 |
->set_page_grid([ |
| 205 |
'url' => 'https://wpmet.com/fb-group', |
| 206 |
'title' => 'Join the Community', |
| 207 |
'thumbnail' => EMAILKIT_URL . '/Promotional/ProAwareness/assets/images/community.png', |
| 208 |
'description' => 'Join our Facebook group to get 20% discount coupon on premium products. Follow us to get more exciting offers.' |
| 209 |
|
| 210 |
]) |
| 211 |
->set_page_grid([ |
| 212 |
'url' => 'https://www.youtube.com/watch?v=Fz_1M-s_Faw&list=PL3t2OjZ6gY8O0ul4d9KROcQMyoSaTad6N', |
| 213 |
'title' =>'Video Tutorials', |
| 214 |
'thumbnail' => EMAILKIT_URL . '/Promotional/ProAwareness/assets/images/videos.png', |
| 215 |
'description' => 'Learn the step by step process for developing your site easily from video tutorials.' |
| 216 |
]) |
| 217 |
->set_page_grid([ |
| 218 |
'url' => 'https://wpmet.com/plugin/emailkit/roadmaps#ideas', |
| 219 |
'title' =>'Request a feature', |
| 220 |
'thumbnail' => EMAILKIT_URL . '/Promotional/ProAwareness/assets/images/request.png', |
| 221 |
'description' => 'Have any special feature in mind? Let us know through the feature request.' |
| 222 |
]) |
| 223 |
->set_page_grid([ |
| 224 |
'url' => 'https://wpmet.com/doc/emailkit/', |
| 225 |
'title' => 'Documentation', |
| 226 |
'thumbnail' => EMAILKIT_URL . '/Promotional/ProAwareness/assets/images/documentation.png', |
| 227 |
'description' => 'Detailed documentation to help you understand the functionality of each feature.' |
| 228 |
]) |
| 229 |
->set_page_grid([ |
| 230 |
'url' => 'https://wpmet.com/plugin/emailkit/roadmaps/', |
| 231 |
'title' => 'Public Roadmap', |
| 232 |
'thumbnail' => EMAILKIT_URL . '/Promotional/ProAwareness/assets/images/roadmaps.png', |
| 233 |
'description' => 'Check our upcoming new features, detailed development stories and tasks' |
| 234 |
]) |
| 235 |
|
| 236 |
->set_plugin_row_meta('Documentation', 'https://help.wpmet.com/docs-cat/emailkit/', ['target' => '_blank']) |
| 237 |
->set_plugin_row_meta('Facebook Community', 'https://wpmet.com/fb-group', ['target' => '_blank']) |
| 238 |
->set_plugin_row_meta('Rate the plugin � |
| 239 |
� |
| 240 |
� |
| 241 |
� |
| 242 |
� |
| 243 |
', 'https://wordpress.org/support/plugin/emailkit/reviews/#new-post', ['target' => '_blank']) |
| 244 |
->set_plugin_action_link('Settings', admin_url() . 'admin.php?page=emailkit-menu-settings') |
| 245 |
->set_plugin_action_link($is_pro_active, 'https://wpmet.com/plugin/emailkit/pricing/', ['target' => '_blank', 'style' => 'color: #FCB214; font-weight: bold;']) |
| 246 |
->call(); |
| 247 |
|
| 248 |
if( ! $this->already_onboarded_other() ){ |
| 249 |
|
| 250 |
Onboard::instance()->init(); |
| 251 |
|
| 252 |
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')) { |
| 253 |
Attr::instance(); |
| 254 |
} |
| 255 |
} |
| 256 |
|
| 257 |
add_action('emailkit-settings', function(){ |
| 258 |
|
| 259 |
if( ! $this->already_onboarded_other() ){ |
| 260 |
|
| 261 |
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')) { |
| 262 |
wp_enqueue_style( 'emailkit-steps-css-steps' ); // needed when onboardning |
| 263 |
Onboard::instance()->views(); |
| 264 |
} |
| 265 |
} |
| 266 |
|
| 267 |
(new \EmailKit\Promotional\ProConsent())->get_consent_form(); |
| 268 |
} |
| 269 |
); |
| 270 |
} |
| 271 |
|
| 272 |
/** |
| 273 |
* Check if user already onboarded for any of the plugins (elements_kit, met_form or shopengine). |
| 274 |
* |
| 275 |
* @return bool |
| 276 |
* |
| 277 |
* @since 1.5.4 |
| 278 |
*/ |
| 279 |
public function already_onboarded_other() { |
| 280 |
|
| 281 |
return get_option( 'elements_kit_onboard_status' ) == 'onboarded' || get_option( 'met_form_onboard_status' ) == 'onboarded' || get_option( 'shopengine_onboard_status' ) == '1'; |
| 282 |
} |
| 283 |
|
| 284 |
} |