| @@ -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 | + 'hurry_up' => 'Hurry up! Only %s left.', | |
| 76 | + 'sale_live' => 'Themeisle Black Friday Sale is Live!', | |
| 77 | + 'learn_more' => 'Learn more', | |
| 78 | + 'max_savings' => 'Enjoy Maximum Savings on %s', | |
| 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', |
| @@ -177,14 +171,8 @@ | ||
| 177 | 171 | 'install' => 'Install WP Full Pay', |
| 178 | 172 | 'dismisscta' => 'Dismiss this notice.', |
| 179 | 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.', |
| 180 | 174 | ], |
| 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 | 175 | ], |
| 188 | 176 | 'welcome' => [ |
| 189 | 177 | 'ctan' => 'No, thanks.', |
| 190 | 178 | 'ctay' => 'Upgrade Now!', |
| @@ -254,11 +242,11 @@ | ||
| 254 | 242 | 'rollback' => [ |
| 255 | 243 | 'cta' => 'Rollback to v%s', |
| 256 | 244 | ], |
| 257 | 245 | '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', | |
| 246 | + '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.', | |
| 247 | + 'cta_y' => 'Sure, I would love to help.', | |
| 248 | + 'cta_n' => 'No, thanks.', | |
| 261 | 249 | ], |
| 262 | 250 | 'about_us' => [ |
| 263 | 251 | 'title' => 'About Us', |
| 264 | 252 | 'heroHeader' => 'Our Story', |
| @@ -336,9 +324,12 @@ | ||
| 336 | 324 | /** |
| 337 | 325 | * Initialize the sdk logic. |
| 338 | 326 | */ |
| 339 | 327 | public static function init() { |
| 340 | - self::localize_labels(); | |
| 328 | + /** | |
| 329 | + * This filter can be used to localize the labels inside each product. | |
| 330 | + */ | |
| 331 | + self::$labels = apply_filters( 'themeisle_sdk_labels', self::$labels ); | |
| 341 | 332 | if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Loader ) ) { |
| 342 | 333 | self::$instance = new Loader(); |
| 343 | 334 | $modules = array_merge( self::$available_modules, apply_filters( 'themeisle_sdk_modules', [] ) ); |
| 344 | 335 | foreach ( $modules as $key => $module ) { |
| @@ -346,96 +337,12 @@ | ||
| 346 | 337 | unset( $modules[ $key ] ); |
| 347 | 338 | } |
| 348 | 339 | } |
| 349 | 340 | self::$available_modules = $modules; |
| 350 | - | |
| 351 | - add_action( 'themeisle_sdk_first_activation', array( __CLASS__, 'activate' ) ); | |
| 352 | - | |
| 353 | 341 | } |
| 354 | 342 | } |
| 355 | - | |
| 356 | - /** | |
| 357 | - * Localize the labels. | |
| 358 | - */ | |
| 359 | - public static function localize_labels() { | |
| 360 | - $originals = self::$labels; | |
| 361 | - $all_translations = []; | |
| 362 | 343 | |
| 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 | 344 | /** |
| 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 | - } | |
| 436 | - | |
| 437 | - /** | |
| 438 | 345 | * Get cache token used in API requests. |
| 439 | 346 | * |
| 440 | 347 | * @return string Cache token. |
| 441 | 348 | */ |
| @@ -476,30 +383,8 @@ | ||
| 476 | 383 | |
| 477 | 384 | return self::$instance; |
| 478 | 385 | } |
| 479 | 386 | |
| 480 | - /** | |
| 481 | - * Activate the product routine. | |
| 482 | - * | |
| 483 | - * @param string $file The base file of the product. | |
| 484 | - * | |
| 485 | - * @return void | |
| 486 | - */ | |
| 487 | - public static function activate( $file ) { | |
| 488 | - | |
| 489 | - $dirname = trailingslashit( dirname( ( $file ) ) ); | |
| 490 | - if ( ! file_exists( $dirname . '_reference.php' ) ) { | |
| 491 | - return; | |
| 492 | - } | |
| 493 | - $reference_data = require_once $dirname . '_reference.php'; | |
| 494 | - if ( ! is_array( $reference_data ) || | |
| 495 | - ! isset( $reference_data['key'] ) || | |
| 496 | - ! isset( $reference_data['value'] ) || | |
| 497 | - ! preg_match( '/^[a-zA-Z0-9_]+_reference_key$/', $reference_data['key'] ) ) { | |
| 498 | - return; | |
| 499 | - } | |
| 500 | - add_option( $reference_data['key'], sanitize_key( $reference_data['value'] ) ); | |
| 501 | - } | |
| 502 | 387 | /** |
| 503 | 388 | * Get all registered modules by the SDK. |
| 504 | 389 | * |
| 505 | 390 | * @return array Modules available. |