| @@ -36,9 +36,9 @@ | ||
| 36 | 36 | private static $version = '2.0.0'; |
| 37 | 37 | /** |
| 38 | 38 | * Holds registered products. |
| 39 | 39 | * |
| 40 | - * @var array The products which use the SDK. | |
| 40 | + * @var array<Product> The products which use the SDK. | |
| 41 | 41 | */ |
| 42 | 42 | private static $products = []; |
| 43 | 43 | /** |
| 44 | 44 | * Holds available modules to load. |
| @@ -52,8 +52,9 @@ | ||
| 52 | 52 | 'uninstall_feedback', |
| 53 | 53 | 'licenser', |
| 54 | 54 | 'logger', |
| 55 | 55 | 'translate', |
| 56 | + 'translations', | |
| 56 | 57 | 'review', |
| 57 | 58 | 'recommendation', |
| 58 | 59 | 'notification', |
| 59 | 60 | 'promotions', |
| @@ -61,8 +62,9 @@ | ||
| 61 | 62 | 'compatibilities', |
| 62 | 63 | 'about_us', |
| 63 | 64 | 'announcements', |
| 64 | 65 | 'featured_plugins', |
| 66 | + 'float_widget', | |
| 65 | 67 | ]; |
| 66 | 68 | /** |
| 67 | 69 | * Holds the labels for the modules. |
| 68 | 70 | * |
| @@ -69,12 +71,12 @@ | ||
| 69 | 71 | * @var array The labels for the modules. |
| 70 | 72 | */ |
| 71 | 73 | public static $labels = [ |
| 72 | 74 | 'announcements' => [ |
| 73 | - 'hurry_up' => 'Hurry up! Only %s left.', | |
| 74 | - 'sale_live' => 'Themeisle Black Friday Sale is Live!', | |
| 75 | - 'learn_more' => 'Learn more', | |
| 76 | - 'max_savings' => 'Enjoy Maximum Savings on %s', | |
| 75 | + 'notice_link_label' => 'See the Offer', | |
| 76 | + 'max_savings' => 'Our biggest sale of the year: <strong>%s OFF everything!</strong> Don\'t miss this limited-time offer.', | |
| 77 | + 'black_friday' => 'Black Friday Sale', | |
| 78 | + 'time_left' => '%s left', | |
| 77 | 79 | ], |
| 78 | 80 | 'compatibilities' => [ |
| 79 | 81 | 'notice' => '%s requires a newer version of %s. Please %supdate%s %s %s to the latest version.', |
| 80 | 82 | 'notice2' => '%s update requires a newer version of %s. Please %supdate%s %s %s.', |
| @@ -111,10 +113,18 @@ | ||
| 111 | 113 | 'inactive' => 'In order to benefit from updates and support for %s, please add your license code from your %spurchase history%s and validate it %shere%s.', |
| 112 | 114 | 'no_activations' => 'No more activations left for %s. You need to upgrade your plan in order to use %s on more websites. If you need assistance, please get in touch with %s staff.', |
| 113 | 115 | ], |
| 114 | 116 | 'promotions' => [ |
| 115 | - 'recommended' => 'Recommended by %s', | |
| 116 | - 'woo' => [ | |
| 117 | + 'recommended' => 'Recommended by %s', | |
| 118 | + 'installActivate' => 'Install & Activate', | |
| 119 | + 'preview' => 'Preview', | |
| 120 | + 'installing' => 'Installing', | |
| 121 | + 'activating' => 'Activating', | |
| 122 | + 'connecting' => 'Connecting to API', | |
| 123 | + 'learnmore' => 'Learn More', | |
| 124 | + 'activate' => 'Activate', | |
| 125 | + 'all_set' => 'Awesome! You are all set!', | |
| 126 | + 'woo' => [ | |
| 117 | 127 | 'title' => 'More extensions from Themeisle', |
| 118 | 128 | 'title2' => 'Recommended extensions', |
| 119 | 129 | 'cta_install' => 'Install', |
| 120 | 130 | 'learn_more' => 'Learn More', |
| @@ -127,25 +137,48 @@ | ||
| 127 | 137 | 'spark_desc1' => 'Loyalize your customers by allowing them to save their favorite products.', |
| 128 | 138 | 'spark_desc2' => 'Add a top notification bar on your website to highlight the latest products, offers, or upcoming events.', |
| 129 | 139 | 'spark_desc3' => 'Enable an advanced review section, enlarging the basic review options with lots of capabilities.', |
| 130 | 140 | ], |
| 131 | - 'optimole' => [ | |
| 132 | - 'all_set' => 'Awesome! You are all set!', | |
| 133 | - 'gotodash' => 'Go to Optimole dashboard', | |
| 134 | - 'installing' => 'Installing', | |
| 135 | - 'activating' => 'Activating', | |
| 136 | - 'connecting' => 'Connecting to API', | |
| 137 | - 'start_cta' => 'Start using Optimole', | |
| 138 | - 'dismisscta' => 'Dismiss this notice.', | |
| 139 | - 'gst' => 'Get Started Free', | |
| 140 | - 'heading' => 'Get more with Optimole', | |
| 141 | - 'learnmore' => 'Learn more', | |
| 142 | - 'message1' => 'Increase this page speed and SEO ranking by optimizing images with Optimole.', | |
| 143 | - 'message3' => 'Save your server space by storing images to Optimole and deliver them optimized from 400 locations around the globe. Unlimited images, Unlimited traffic.', | |
| 144 | - 'message4' => 'This image looks to be too large and would affect your site speed, we recommend you to install Optimole to optimize your images.', | |
| 145 | - 'message2' => 'Leverage Optimole\'s full integration with Elementor to automatically lazyload, resize, compress to AVIF/WebP and deliver from 400 locations around the globe!', | |
| 146 | - 'email_placeholder' => 'Email address', | |
| 141 | + | |
| 142 | + 'feedzy' => [ | |
| 143 | + 'import_desc' => 'Schedule automatic content imports from any RSS feed directly to your site. %sBuilt by %s%s', | |
| 144 | + 'install_now' => 'Install Now', | |
| 145 | + 'by' => 'by %s', | |
| 146 | + 'editor_recommends' => '%s recommends %sFeedzy%s to display entries from any RSS feed with more advanced styling and filtering options.', | |
| 147 | 147 | ], |
| 148 | + 'optimole' => [ | |
| 149 | + 'installOptimole' => 'Install Optimole', | |
| 150 | + 'gotodash' => 'Go to Optimole dashboard', | |
| 151 | + 'dismisscta' => 'Dismiss this notice.', | |
| 152 | + 'message1' => 'Increase this page speed and SEO ranking by optimizing images with Optimole.', | |
| 153 | + 'message3' => 'Save your server space by storing images to Optimole and deliver them optimized from 400 locations around the globe. Unlimited images, Unlimited traffic.', | |
| 154 | + 'message4' => 'This image looks to be too large and would affect your site speed, we recommend you to install Optimole to optimize your images.', | |
| 155 | + 'message2' => 'Leverage Optimole\'s full integration with Elementor to automatically lazyload, resize, compress to AVIF/WebP and deliver from 400 locations around the globe!', | |
| 156 | + ], | |
| 157 | + 'redirectionCF7' => [ | |
| 158 | + 'gotodash' => 'Go to Contact Forms', | |
| 159 | + 'dismisscta' => 'Dismiss this notice.', | |
| 160 | + 'gst' => 'Get Started Free', | |
| 161 | + 'message' => 'Add URL redirects, spam protection, execute JavaScript after submissions, and more with the Redirection for CF7 free plugin.', | |
| 162 | + ], | |
| 163 | + 'hyve' => [ | |
| 164 | + 'gotodash' => 'Go to Hyve Dashboard', | |
| 165 | + 'install' => 'Install Hyve', | |
| 166 | + 'dismisscta' => 'Dismiss this notice.', | |
| 167 | + 'message' => 'Hyve is an AI-powered chatbot that turns your WordPress content into interactive conversations, helping you efficiently handle user inquiries.', | |
| 168 | + ], | |
| 169 | + 'wp_full_pay' => [ | |
| 170 | + 'gotodash' => 'Go to WP Full Pay Settings', | |
| 171 | + 'install' => 'Install WP Full Pay', | |
| 172 | + 'dismisscta' => 'Dismiss this notice.', | |
| 173 | + 'message' => 'Enhance your donation page with WP Full Pay—create custom Stripe forms for one-time and recurring donations, manage transactions easily, and boost support with a seamless setup.', | |
| 174 | + ], | |
| 175 | + 'masteriyo' => [ | |
| 176 | + 'gotodash' => 'Go to Masteriyo Dashboard', | |
| 177 | + 'install' => 'Install Masteriyo', | |
| 178 | + 'dismisscta' => 'Dismiss this notice.', | |
| 179 | + 'message' => 'Transform your site into a learning hub with Masteriyo LMS. Build engaging courses with intuitive tools, track student progress effortlessly, and grow your education business with powerful marketing features and seamless payment integration.', | |
| 180 | + ], | |
| 148 | 181 | ], |
| 149 | 182 | 'welcome' => [ |
| 150 | 183 | 'ctan' => 'No, thanks.', |
| 151 | 184 | 'ctay' => 'Upgrade Now!', |
| @@ -275,8 +308,24 @@ | ||
| 275 | 308 | ], |
| 276 | 309 | ], |
| 277 | 310 | ], |
| 278 | 311 | ], |
| 312 | + 'float_widget' => [ | |
| 313 | + 'button' => 'Toggle Help Widget for %s', | |
| 314 | + 'panel' => [ | |
| 315 | + 'greeting' => 'Thank you for using %s', | |
| 316 | + 'title' => 'How can we help you?', | |
| 317 | + 'close' => 'Close Toggle Help Widget', | |
| 318 | + ], | |
| 319 | + 'links' => [ | |
| 320 | + 'documentation' => 'Documentation', | |
| 321 | + 'support' => 'Get Support', | |
| 322 | + 'wizard' => 'Run Setup Wizard', | |
| 323 | + 'upgrade' => 'Upgrade to Pro', | |
| 324 | + 'feature_request' => 'Suggest a Feature', | |
| 325 | + 'rate' => 'Rate Us', | |
| 326 | + ], | |
| 327 | + ], | |
| 279 | 328 | ]; |
| 280 | 329 | |
| 281 | 330 | /** |
| 282 | 331 | * Initialize the sdk logic. |
| @@ -294,8 +343,10 @@ | ||
| 294 | 343 | unset( $modules[ $key ] ); |
| 295 | 344 | } |
| 296 | 345 | } |
| 297 | 346 | self::$available_modules = $modules; |
| 347 | + | |
| 348 | + add_action( 'themeisle_sdk_first_activation', array( __CLASS__, 'activate' ) ); | |
| 298 | 349 | } |
| 299 | 350 | } |
| 300 | 351 | |
| 301 | 352 | /** |
| @@ -341,8 +392,30 @@ | ||
| 341 | 392 | return self::$instance; |
| 342 | 393 | } |
| 343 | 394 | |
| 344 | 395 | /** |
| 396 | + * Activate the product routine. | |
| 397 | + * | |
| 398 | + * @param string $file The base file of the product. | |
| 399 | + * | |
| 400 | + * @return void | |
| 401 | + */ | |
| 402 | + public static function activate( $file ) { | |
| 403 | + | |
| 404 | + $dirname = trailingslashit( dirname( ( $file ) ) ); | |
| 405 | + if ( ! file_exists( $dirname . '_reference.php' ) ) { | |
| 406 | + return; | |
| 407 | + } | |
| 408 | + $reference_data = require_once $dirname . '_reference.php'; | |
| 409 | + if ( ! is_array( $reference_data ) || | |
| 410 | + ! isset( $reference_data['key'] ) || | |
| 411 | + ! isset( $reference_data['value'] ) || | |
| 412 | + ! preg_match( '/^[a-zA-Z0-9_]+_reference_key$/', $reference_data['key'] ) ) { | |
| 413 | + return; | |
| 414 | + } | |
| 415 | + add_option( $reference_data['key'], sanitize_key( $reference_data['value'] ) ); | |
| 416 | + } | |
| 417 | + /** | |
| 345 | 418 | * Get all registered modules by the SDK. |
| 346 | 419 | * |
| 347 | 420 | * @return array Modules available. |
| 348 | 421 | */ |
| @@ -352,9 +425,9 @@ | ||
| 352 | 425 | |
| 353 | 426 | /** |
| 354 | 427 | * Get all products using the SDK. |
| 355 | 428 | * |
| 356 | - * @return array Products available. | |
| 429 | + * @return array<Product> Products available. | |
| 357 | 430 | */ |
| 358 | 431 | public static function get_products() { |
| 359 | 432 | return self::$products; |
| 360 | 433 | } |