| @@ -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', |
| @@ -267,44 +255,8 @@ | ||
| 267 | 255 | 'teamImageCaption' => 'Our team in WCEU2022 in Portugal', |
| 268 | 256 | 'newsHeading' => 'Stay connected for news & updates!', |
| 269 | 257 | 'emailPlaceholder' => 'Your email address', |
| 270 | 258 | '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 | 259 | 'installNow' => 'Install Now', |
| 308 | 260 | 'activate' => 'Activate', |
| 309 | 261 | 'learnMore' => 'Learn More', |
| 310 | 262 | 'installed' => 'Installed', |
| @@ -372,9 +324,12 @@ | ||
| 372 | 324 | /** |
| 373 | 325 | * Initialize the sdk logic. |
| 374 | 326 | */ |
| 375 | 327 | public static function init() { |
| 376 | - 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 ); | |
| 377 | 332 | if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Loader ) ) { |
| 378 | 333 | self::$instance = new Loader(); |
| 379 | 334 | $modules = array_merge( self::$available_modules, apply_filters( 'themeisle_sdk_modules', [] ) ); |
| 380 | 335 | foreach ( $modules as $key => $module ) { |
| @@ -382,96 +337,12 @@ | ||
| 382 | 337 | unset( $modules[ $key ] ); |
| 383 | 338 | } |
| 384 | 339 | } |
| 385 | 340 | self::$available_modules = $modules; |
| 386 | - | |
| 387 | - add_action( 'themeisle_sdk_first_activation', array( __CLASS__, 'activate' ) ); | |
| 388 | - | |
| 389 | 341 | } |
| 390 | 342 | } |
| 391 | - | |
| 392 | - /** | |
| 393 | - * Localize the labels. | |
| 394 | - */ | |
| 395 | - public static function localize_labels() { | |
| 396 | - $originals = self::$labels; | |
| 397 | - $all_translations = []; | |
| 398 | 343 | |
| 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 | 344 | /** |
| 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 | 345 | * Get cache token used in API requests. |
| 475 | 346 | * |
| 476 | 347 | * @return string Cache token. |
| 477 | 348 | */ |
| @@ -512,30 +383,8 @@ | ||
| 512 | 383 | |
| 513 | 384 | return self::$instance; |
| 514 | 385 | } |
| 515 | 386 | |
| 516 | - /** | |
| 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 | 387 | /** |
| 539 | 388 | * Get all registered modules by the SDK. |
| 540 | 389 | * |
| 541 | 390 | * @return array Modules available. |