| @@ -63,9 +63,8 @@ | ||
| 63 | 63 | 'about_us', |
| 64 | 64 | 'announcements', |
| 65 | 65 | 'featured_plugins', |
| 66 | 66 | 'float_widget', |
| 67 | - 'migrator', | |
| 68 | 67 | ]; |
| 69 | 68 | /** |
| 70 | 69 | * Holds the labels for the modules. |
| 71 | 70 | * |
| @@ -72,13 +71,12 @@ | ||
| 72 | 71 | * @var array The labels for the modules. |
| 73 | 72 | */ |
| 74 | 73 | public static $labels = [ |
| 75 | 74 | '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', | |
| 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', | |
| 81 | 79 | ], |
| 82 | 80 | 'compatibilities' => [ |
| 83 | 81 | 'notice' => '%s requires a newer version of %s. Please %supdate%s %s %s to the latest version.', |
| 84 | 82 | 'notice2' => '%s update requires a newer version of %s. Please %supdate%s %s %s.', |
| @@ -109,16 +107,12 @@ | ||
| 109 | 107 | 'autoactivate_notice' => '%s has been successfully activated using %s license !', |
| 110 | 108 | 'valid' => 'Valid', |
| 111 | 109 | 'invalid' => 'Invalid', |
| 112 | 110 | '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.', | |
| 111 | + '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 | 112 | |
| 117 | 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.', |
| 118 | 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.', |
| 119 | - 'renew_license' => 'Renew License', | |
| 120 | - 'learn_more' => 'Learn More', | |
| 121 | 115 | ], |
| 122 | 116 | 'promotions' => [ |
| 123 | 117 | 'recommended' => 'Recommended by %s', |
| 124 | 118 | 'installActivate' => 'Install & Activate', |
| @@ -254,11 +248,11 @@ | ||
| 254 | 248 | 'rollback' => [ |
| 255 | 249 | 'cta' => 'Rollback to v%s', |
| 256 | 250 | ], |
| 257 | 251 | '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', | |
| 252 | + '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.', | |
| 253 | + 'cta_y' => 'Sure, I would love to help.', | |
| 254 | + 'cta_n' => 'No, thanks.', | |
| 261 | 255 | ], |
| 262 | 256 | 'about_us' => [ |
| 263 | 257 | 'title' => 'About Us', |
| 264 | 258 | 'heroHeader' => 'Our Story', |
| @@ -336,9 +330,12 @@ | ||
| 336 | 330 | /** |
| 337 | 331 | * Initialize the sdk logic. |
| 338 | 332 | */ |
| 339 | 333 | public static function init() { |
| 340 | - self::localize_labels(); | |
| 334 | + /** | |
| 335 | + * This filter can be used to localize the labels inside each product. | |
| 336 | + */ | |
| 337 | + self::$labels = apply_filters( 'themeisle_sdk_labels', self::$labels ); | |
| 341 | 338 | if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Loader ) ) { |
| 342 | 339 | self::$instance = new Loader(); |
| 343 | 340 | $modules = array_merge( self::$available_modules, apply_filters( 'themeisle_sdk_modules', [] ) ); |
| 344 | 341 | foreach ( $modules as $key => $module ) { |
| @@ -348,91 +345,9 @@ | ||
| 348 | 345 | } |
| 349 | 346 | self::$available_modules = $modules; |
| 350 | 347 | |
| 351 | 348 | add_action( 'themeisle_sdk_first_activation', array( __CLASS__, 'activate' ) ); |
| 352 | - | |
| 353 | 349 | } |
| 354 | - } | |
| 355 | - | |
| 356 | - /** | |
| 357 | - * Localize the labels. | |
| 358 | - */ | |
| 359 | - public static function localize_labels() { | |
| 360 | - $originals = self::$labels; | |
| 361 | - $all_translations = []; | |
| 362 | - | |
| 363 | - global $wp_filter; | |
| 364 | - if ( isset( $wp_filter['themeisle_sdk_labels'] ) ) { | |
| 365 | - foreach ( $wp_filter['themeisle_sdk_labels']->callbacks as $priority => $hooks ) { | |
| 366 | - foreach ( $hooks as $hook ) { | |
| 367 | - // Each callback gets fresh originals, not previous callback's output | |
| 368 | - $result = call_user_func( $hook['function'], $originals ); | |
| 369 | - $all_translations[] = $result; | |
| 370 | - } | |
| 371 | - } | |
| 372 | - | |
| 373 | - // Remove the filter so it doesn't run again via apply_filters | |
| 374 | - remove_all_filters( 'themeisle_sdk_labels' ); | |
| 375 | - } | |
| 376 | - | |
| 377 | - // Merge all results, first real translation wins | |
| 378 | - self::$labels = self::merge_all_translations( $originals, $all_translations ); | |
| 379 | - } | |
| 380 | - /** | |
| 381 | - * Merge all translations. | |
| 382 | - * | |
| 383 | - * @param array $originals The original labels. | |
| 384 | - * @param array $all_translations The all translations. | |
| 385 | - * | |
| 386 | - * @return array The merged labels. | |
| 387 | - */ | |
| 388 | - private static function merge_all_translations( $originals, $all_translations ) { | |
| 389 | - $result = $originals; | |
| 390 | - | |
| 391 | - foreach ( $all_translations as $translations ) { | |
| 392 | - $result = self::merge_if_translated( $result, $translations, $originals ); | |
| 393 | - } | |
| 394 | - | |
| 395 | - return $result; | |
| 396 | - } | |
| 397 | - /** | |
| 398 | - * Merge if translated. | |
| 399 | - * | |
| 400 | - * @param array $current The current labels. | |
| 401 | - * @param array $new The new labels. | |
| 402 | - * @param array $originals The original labels. | |
| 403 | - * @return array The merged labels. | |
| 404 | - */ | |
| 405 | - private static function merge_if_translated( $current, $new, $originals ) { | |
| 406 | - foreach ( $new as $key => $value ) { | |
| 407 | - if ( ! isset( $originals[ $key ] ) ) { | |
| 408 | - // New key, accept it | |
| 409 | - if ( ! isset( $current[ $key ] ) ) { | |
| 410 | - $current[ $key ] = $value; | |
| 411 | - } | |
| 412 | - continue; | |
| 413 | - } | |
| 414 | - | |
| 415 | - if ( is_array( $value ) && is_array( $originals[ $key ] ) ) { | |
| 416 | - $current[ $key ] = self::merge_if_translated( | |
| 417 | - $current[ $key ], | |
| 418 | - $value, | |
| 419 | - $originals[ $key ] | |
| 420 | - ); | |
| 421 | - } else { | |
| 422 | - // Only accept if: | |
| 423 | - // 1. New value is actually translated (differs from original) | |
| 424 | - // 2. Current value is NOT already translated | |
| 425 | - $is_new_translated = ( $value !== $originals[ $key ] ); | |
| 426 | - $is_current_untranslated = ( $current[ $key ] === $originals[ $key ] ); | |
| 427 | - | |
| 428 | - if ( $is_new_translated && $is_current_untranslated ) { | |
| 429 | - $current[ $key ] = $value; | |
| 430 | - } | |
| 431 | - } | |
| 432 | - } | |
| 433 | - | |
| 434 | - return $current; | |
| 435 | 350 | } |
| 436 | 351 | |
| 437 | 352 | /** |
| 438 | 353 | * Get cache token used in API requests. |