| @@ -36,9 +36,9 @@ | ||
| 36 | 36 | private static $version = '2.0.0'; |
| 37 | 37 | /** |
| 38 | 38 | * Holds registered products. |
| 39 | 39 | * |
| 40 | - * @var array<Product> The products which use the SDK. | |
| 40 | + * @var array The products which use the SDK. | |
| 41 | 41 | */ |
| 42 | 42 | private static $products = []; |
| 43 | 43 | /** |
| 44 | 44 | * Holds available modules to load. |
| @@ -52,9 +52,8 @@ | ||
| 52 | 52 | 'uninstall_feedback', |
| 53 | 53 | 'licenser', |
| 54 | 54 | 'logger', |
| 55 | 55 | 'translate', |
| 56 | - 'translations', | |
| 57 | 56 | 'review', |
| 58 | 57 | 'recommendation', |
| 59 | 58 | 'notification', |
| 60 | 59 | 'promotions', |
| @@ -62,10 +61,8 @@ | ||
| 62 | 61 | 'compatibilities', |
| 63 | 62 | 'about_us', |
| 64 | 63 | 'announcements', |
| 65 | 64 | 'featured_plugins', |
| 66 | - 'float_widget', | |
| 67 | - 'migrator', | |
| 68 | 65 | ]; |
| 69 | 66 | /** |
| 70 | 67 | * Holds the labels for the modules. |
| 71 | 68 | * |
| @@ -72,13 +69,12 @@ | ||
| 72 | 69 | * @var array The labels for the modules. |
| 73 | 70 | */ |
| 74 | 71 | public static $labels = [ |
| 75 | 72 | 'announcements' => [ |
| 76 | - 'notice_link_label' => 'See the deals', | |
| 77 | - 'max_savings' => 'Best WordPress Black Friday deals of %s — themes, plugins, hosting. Curated by the Themeisle team.', | |
| 78 | - 'black_friday' => 'Black Friday Sale', | |
| 79 | - 'time_left' => '%s left', | |
| 80 | - 'plugin_meta_message' => 'Black Friday Sale - 60% OFF', | |
| 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', | |
| 81 | 77 | ], |
| 82 | 78 | 'compatibilities' => [ |
| 83 | 79 | 'notice' => '%s requires a newer version of %s. Please %supdate%s %s %s to the latest version.', |
| 84 | 80 | 'notice2' => '%s update requires a newer version of %s. Please %supdate%s %s %s.', |
| @@ -109,28 +105,16 @@ | ||
| 109 | 105 | 'autoactivate_notice' => '%s has been successfully activated using %s license !', |
| 110 | 106 | 'valid' => 'Valid', |
| 111 | 107 | 'invalid' => 'Invalid', |
| 112 | 108 | 'notice' => 'Enter your license from %s purchase history in order to get %s updates', |
| 113 | - 'expired' => '%s license expired', | |
| 114 | - 'expired_date' => 'Expired on %s', | |
| 115 | - 'expired_notice' => 'Your current setup continues working, but premium features are disabled and you\'re no longer receive updates - including critical patches - or support.', | |
| 109 | + 'expired' => 'Your %s\'s License Key has expired. In order to continue receiving support and software updates you must %srenew%s your license key.', | |
| 116 | 110 | |
| 117 | 111 | '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.', |
| 118 | 112 | '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.', |
| 119 | - 'renew_license' => 'Renew License', | |
| 120 | - 'learn_more' => 'Learn More', | |
| 121 | 113 | ], |
| 122 | 114 | 'promotions' => [ |
| 123 | - 'recommended' => 'Recommended by %s', | |
| 124 | - 'installActivate' => 'Install & Activate', | |
| 125 | - 'preview' => 'Preview', | |
| 126 | - 'installing' => 'Installing', | |
| 127 | - 'activating' => 'Activating', | |
| 128 | - 'connecting' => 'Connecting to API', | |
| 129 | - 'learnmore' => 'Learn More', | |
| 130 | - 'activate' => 'Activate', | |
| 131 | - 'all_set' => 'Awesome! You are all set!', | |
| 132 | - 'woo' => [ | |
| 115 | + 'recommended' => 'Recommended by %s', | |
| 116 | + 'woo' => [ | |
| 133 | 117 | 'title' => 'More extensions from Themeisle', |
| 134 | 118 | 'title2' => 'Recommended extensions', |
| 135 | 119 | 'cta_install' => 'Install', |
| 136 | 120 | 'learn_more' => 'Learn More', |
| @@ -143,48 +127,25 @@ | ||
| 143 | 127 | 'spark_desc1' => 'Loyalize your customers by allowing them to save their favorite products.', |
| 144 | 128 | 'spark_desc2' => 'Add a top notification bar on your website to highlight the latest products, offers, or upcoming events.', |
| 145 | 129 | 'spark_desc3' => 'Enable an advanced review section, enlarging the basic review options with lots of capabilities.', |
| 146 | 130 | ], |
| 147 | - | |
| 148 | - 'feedzy' => [ | |
| 149 | - 'import_desc' => 'Schedule automatic content imports from any RSS feed directly to your site. %sBuilt by %s%s', | |
| 150 | - 'install_now' => 'Install Now', | |
| 151 | - 'by' => 'by %s', | |
| 152 | - 'editor_recommends' => '%s recommends %sFeedzy%s to display entries from any RSS feed with more advanced styling and filtering options.', | |
| 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', | |
| 153 | 147 | ], |
| 154 | - 'optimole' => [ | |
| 155 | - 'installOptimole' => 'Install Optimole', | |
| 156 | - 'gotodash' => 'Go to Optimole dashboard', | |
| 157 | - 'dismisscta' => 'Dismiss this notice.', | |
| 158 | - 'message1' => 'Increase this page speed and SEO ranking by optimizing images with Optimole.', | |
| 159 | - 'message3' => 'Save your server space by storing images to Optimole and deliver them optimized from 400 locations around the globe. Unlimited images, Unlimited traffic.', | |
| 160 | - 'message4' => 'This image looks to be too large and would affect your site speed, we recommend you to install Optimole to optimize your images.', | |
| 161 | - 'message2' => 'Leverage Optimole\'s full integration with Elementor to automatically lazyload, resize, compress to AVIF/WebP and deliver from 400 locations around the globe!', | |
| 162 | - ], | |
| 163 | - 'redirectionCF7' => [ | |
| 164 | - 'gotodash' => 'Go to Contact Forms', | |
| 165 | - 'dismisscta' => 'Dismiss this notice.', | |
| 166 | - 'gst' => 'Get Started Free', | |
| 167 | - 'message' => 'Add URL redirects, spam protection, execute JavaScript after submissions, and more with the Redirection for CF7 free plugin.', | |
| 168 | - ], | |
| 169 | - 'hyve' => [ | |
| 170 | - 'gotodash' => 'Go to Hyve Dashboard', | |
| 171 | - 'install' => 'Install Hyve', | |
| 172 | - 'dismisscta' => 'Dismiss this notice.', | |
| 173 | - 'message' => 'Hyve is an AI-powered chatbot that turns your WordPress content into interactive conversations, helping you efficiently handle user inquiries.', | |
| 174 | - ], | |
| 175 | - 'wp_full_pay' => [ | |
| 176 | - 'gotodash' => 'Go to WP Full Pay Settings', | |
| 177 | - 'install' => 'Install WP Full Pay', | |
| 178 | - 'dismisscta' => 'Dismiss this notice.', | |
| 179 | - '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.', | |
| 180 | - ], | |
| 181 | - 'masteriyo' => [ | |
| 182 | - 'gotodash' => 'Go to Masteriyo Dashboard', | |
| 183 | - 'install' => 'Install Masteriyo', | |
| 184 | - 'dismisscta' => 'Dismiss this notice.', | |
| 185 | - '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.', | |
| 186 | - ], | |
| 187 | 148 | ], |
| 188 | 149 | 'welcome' => [ |
| 189 | 150 | 'ctan' => 'No, thanks.', |
| 190 | 151 | 'ctay' => 'Upgrade Now!', |
| @@ -254,11 +215,11 @@ | ||
| 254 | 215 | 'rollback' => [ |
| 255 | 216 | 'cta' => 'Rollback to v%s', |
| 256 | 217 | ], |
| 257 | 218 | 'logger' => [ |
| 258 | - 'notice' => 'Help improve <b>{product}</b> by sharing anonymous usage data about your setup. No personal data collected.', | |
| 259 | - 'cta_y' => 'Count me in', | |
| 260 | - 'cta_n' => 'No thanks', | |
| 219 | + 'notice' => 'Do you enjoy <b>{product}</b>? Become a contributor by opting in to our anonymous data tracking. We guarantee no sensitive data is collected.', | |
| 220 | + 'cta_y' => 'Sure, I would love to help.', | |
| 221 | + 'cta_n' => 'No, thanks.', | |
| 261 | 222 | ], |
| 262 | 223 | 'about_us' => [ |
| 263 | 224 | 'title' => 'About Us', |
| 264 | 225 | 'heroHeader' => 'Our Story', |
| @@ -267,44 +228,8 @@ | ||
| 267 | 228 | 'teamImageCaption' => 'Our team in WCEU2022 in Portugal', |
| 268 | 229 | 'newsHeading' => 'Stay connected for news & updates!', |
| 269 | 230 | 'emailPlaceholder' => 'Your email address', |
| 270 | 231 | 'signMeUp' => 'Sign me up', |
| 271 | - 'services' => [ | |
| 272 | - 'ariaLabel' => 'Themeisle services', | |
| 273 | - 'trustpilotLabel' => 'Rated excellent on Trustpilot', | |
| 274 | - 'trustpilotRated' => 'Rated', | |
| 275 | - 'trustpilotOn' => 'on', | |
| 276 | - 'trustpilotBrand' => 'Trustpilot', | |
| 277 | - 'heading' => 'Expert WordPress services from the Themeisle team', | |
| 278 | - 'description' => 'Done for you by the same people who build your plugins and themes.', | |
| 279 | - 'cta' => 'Explore all services', | |
| 280 | - 'items' => [ | |
| 281 | - 'websiteDesign' => [ | |
| 282 | - 'title' => 'Website Design', | |
| 283 | - 'subtitle' => 'Built for your business', | |
| 284 | - ], | |
| 285 | - 'support' => [ | |
| 286 | - 'title' => 'Support', | |
| 287 | - 'subtitle' => 'On-demand expert help', | |
| 288 | - ], | |
| 289 | - 'speed' => [ | |
| 290 | - 'title' => 'Speed Optimization', | |
| 291 | - 'subtitle' => 'Core Web Vitals boost', | |
| 292 | - ], | |
| 293 | - 'seo' => [ | |
| 294 | - 'title' => 'SEO Foundation', | |
| 295 | - 'subtitle' => 'Rank & get found', | |
| 296 | - ], | |
| 297 | - 'maintenance' => [ | |
| 298 | - 'title' => 'Maintenance', | |
| 299 | - 'subtitle' => 'Updates, backups, security', | |
| 300 | - ], | |
| 301 | - 'hackedSite' => [ | |
| 302 | - 'title' => 'Hacked Site Repair', | |
| 303 | - 'subtitle' => 'Malware removed fast', | |
| 304 | - ], | |
| 305 | - ], | |
| 306 | - ], | |
| 307 | 232 | 'installNow' => 'Install Now', |
| 308 | 233 | 'activate' => 'Activate', |
| 309 | 234 | 'learnMore' => 'Learn More', |
| 310 | 235 | 'installed' => 'Installed', |
| @@ -350,24 +275,8 @@ | ||
| 350 | 275 | ], |
| 351 | 276 | ], |
| 352 | 277 | ], |
| 353 | 278 | ], |
| 354 | - 'float_widget' => [ | |
| 355 | - 'button' => 'Toggle Help Widget for %s', | |
| 356 | - 'panel' => [ | |
| 357 | - 'greeting' => 'Thank you for using %s', | |
| 358 | - 'title' => 'How can we help you?', | |
| 359 | - 'close' => 'Close Toggle Help Widget', | |
| 360 | - ], | |
| 361 | - 'links' => [ | |
| 362 | - 'documentation' => 'Documentation', | |
| 363 | - 'support' => 'Get Support', | |
| 364 | - 'wizard' => 'Run Setup Wizard', | |
| 365 | - 'upgrade' => 'Upgrade to Pro', | |
| 366 | - 'feature_request' => 'Suggest a Feature', | |
| 367 | - 'rate' => 'Rate Us', | |
| 368 | - ], | |
| 369 | - ], | |
| 370 | 279 | ]; |
| 371 | 280 | |
| 372 | 281 | /** |
| 373 | 282 | * Initialize the sdk logic. |
| @@ -372,9 +281,12 @@ | ||
| 372 | 281 | /** |
| 373 | 282 | * Initialize the sdk logic. |
| 374 | 283 | */ |
| 375 | 284 | public static function init() { |
| 376 | - self::localize_labels(); | |
| 285 | + /** | |
| 286 | + * This filter can be used to localize the labels inside each product. | |
| 287 | + */ | |
| 288 | + self::$labels = apply_filters( 'themeisle_sdk_labels', self::$labels ); | |
| 377 | 289 | if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Loader ) ) { |
| 378 | 290 | self::$instance = new Loader(); |
| 379 | 291 | $modules = array_merge( self::$available_modules, apply_filters( 'themeisle_sdk_modules', [] ) ); |
| 380 | 292 | foreach ( $modules as $key => $module ) { |
| @@ -382,96 +294,12 @@ | ||
| 382 | 294 | unset( $modules[ $key ] ); |
| 383 | 295 | } |
| 384 | 296 | } |
| 385 | 297 | self::$available_modules = $modules; |
| 386 | - | |
| 387 | - add_action( 'themeisle_sdk_first_activation', array( __CLASS__, 'activate' ) ); | |
| 388 | - | |
| 389 | 298 | } |
| 390 | 299 | } |
| 391 | - | |
| 392 | - /** | |
| 393 | - * Localize the labels. | |
| 394 | - */ | |
| 395 | - public static function localize_labels() { | |
| 396 | - $originals = self::$labels; | |
| 397 | - $all_translations = []; | |
| 398 | 300 | |
| 399 | - global $wp_filter; | |
| 400 | - if ( isset( $wp_filter['themeisle_sdk_labels'] ) ) { | |
| 401 | - foreach ( $wp_filter['themeisle_sdk_labels']->callbacks as $priority => $hooks ) { | |
| 402 | - foreach ( $hooks as $hook ) { | |
| 403 | - // Each callback gets fresh originals, not previous callback's output | |
| 404 | - $result = call_user_func( $hook['function'], $originals ); | |
| 405 | - $all_translations[] = $result; | |
| 406 | - } | |
| 407 | - } | |
| 408 | - | |
| 409 | - // Remove the filter so it doesn't run again via apply_filters | |
| 410 | - remove_all_filters( 'themeisle_sdk_labels' ); | |
| 411 | - } | |
| 412 | - | |
| 413 | - // Merge all results, first real translation wins | |
| 414 | - self::$labels = self::merge_all_translations( $originals, $all_translations ); | |
| 415 | - } | |
| 416 | 301 | /** |
| 417 | - * Merge all translations. | |
| 418 | - * | |
| 419 | - * @param array $originals The original labels. | |
| 420 | - * @param array $all_translations The all translations. | |
| 421 | - * | |
| 422 | - * @return array The merged labels. | |
| 423 | - */ | |
| 424 | - private static function merge_all_translations( $originals, $all_translations ) { | |
| 425 | - $result = $originals; | |
| 426 | - | |
| 427 | - foreach ( $all_translations as $translations ) { | |
| 428 | - $result = self::merge_if_translated( $result, $translations, $originals ); | |
| 429 | - } | |
| 430 | - | |
| 431 | - return $result; | |
| 432 | - } | |
| 433 | - /** | |
| 434 | - * Merge if translated. | |
| 435 | - * | |
| 436 | - * @param array $current The current labels. | |
| 437 | - * @param array $new The new labels. | |
| 438 | - * @param array $originals The original labels. | |
| 439 | - * @return array The merged labels. | |
| 440 | - */ | |
| 441 | - private static function merge_if_translated( $current, $new, $originals ) { | |
| 442 | - foreach ( $new as $key => $value ) { | |
| 443 | - if ( ! isset( $originals[ $key ] ) ) { | |
| 444 | - // New key, accept it | |
| 445 | - if ( ! isset( $current[ $key ] ) ) { | |
| 446 | - $current[ $key ] = $value; | |
| 447 | - } | |
| 448 | - continue; | |
| 449 | - } | |
| 450 | - | |
| 451 | - if ( is_array( $value ) && is_array( $originals[ $key ] ) ) { | |
| 452 | - $current[ $key ] = self::merge_if_translated( | |
| 453 | - $current[ $key ], | |
| 454 | - $value, | |
| 455 | - $originals[ $key ] | |
| 456 | - ); | |
| 457 | - } else { | |
| 458 | - // Only accept if: | |
| 459 | - // 1. New value is actually translated (differs from original) | |
| 460 | - // 2. Current value is NOT already translated | |
| 461 | - $is_new_translated = ( $value !== $originals[ $key ] ); | |
| 462 | - $is_current_untranslated = ( $current[ $key ] === $originals[ $key ] ); | |
| 463 | - | |
| 464 | - if ( $is_new_translated && $is_current_untranslated ) { | |
| 465 | - $current[ $key ] = $value; | |
| 466 | - } | |
| 467 | - } | |
| 468 | - } | |
| 469 | - | |
| 470 | - return $current; | |
| 471 | - } | |
| 472 | - | |
| 473 | - /** | |
| 474 | 302 | * Get cache token used in API requests. |
| 475 | 303 | * |
| 476 | 304 | * @return string Cache token. |
| 477 | 305 | */ |
| @@ -513,30 +341,8 @@ | ||
| 513 | 341 | return self::$instance; |
| 514 | 342 | } |
| 515 | 343 | |
| 516 | 344 | /** |
| 517 | - * Activate the product routine. | |
| 518 | - * | |
| 519 | - * @param string $file The base file of the product. | |
| 520 | - * | |
| 521 | - * @return void | |
| 522 | - */ | |
| 523 | - public static function activate( $file ) { | |
| 524 | - | |
| 525 | - $dirname = trailingslashit( dirname( ( $file ) ) ); | |
| 526 | - if ( ! file_exists( $dirname . '_reference.php' ) ) { | |
| 527 | - return; | |
| 528 | - } | |
| 529 | - $reference_data = require_once $dirname . '_reference.php'; | |
| 530 | - if ( ! is_array( $reference_data ) || | |
| 531 | - ! isset( $reference_data['key'] ) || | |
| 532 | - ! isset( $reference_data['value'] ) || | |
| 533 | - ! preg_match( '/^[a-zA-Z0-9_]+_reference_key$/', $reference_data['key'] ) ) { | |
| 534 | - return; | |
| 535 | - } | |
| 536 | - add_option( $reference_data['key'], sanitize_key( $reference_data['value'] ) ); | |
| 537 | - } | |
| 538 | - /** | |
| 539 | 345 | * Get all registered modules by the SDK. |
| 540 | 346 | * |
| 541 | 347 | * @return array Modules available. |
| 542 | 348 | */ |
| @@ -546,9 +352,9 @@ | ||
| 546 | 352 | |
| 547 | 353 | /** |
| 548 | 354 | * Get all products using the SDK. |
| 549 | 355 | * |
| 550 | - * @return array<Product> Products available. | |
| 356 | + * @return array Products available. | |
| 551 | 357 | */ |
| 552 | 358 | public static function get_products() { |
| 553 | 359 | return self::$products; |
| 554 | 360 | } |