PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 4.0.9
Visualizer – Tables & Charts Manager with Built-in AI Generator v4.0.9
4.0.9 4.0.8 4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.10.1 3.10.10 3.10.11 3.10.12 3.10.13 3.10.14 3.10.15 3.10.2 All 150 releases
← All changes | vendor/codeinwp/themeisle-sdk/src/Loader.php +466 -3 3.10.0 → 4.0.9 View file →
@@ -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.
@@ -45,8 +45,10 @@
45 45 *
46 46 * @var array The modules which SDK will be using.
47 47 */
48 48 private static $available_modules = [
49 + 'crash_reporter',
50 + 'script_loader',
49 51 'dashboard_widget',
50 52 'rollback',
51 53 'uninstall_feedback',
52 54 'licenser',
@@ -51,19 +53,375 @@
51 53 'uninstall_feedback',
52 54 'licenser',
53 55 'logger',
54 56 'translate',
57 + 'translations',
55 58 'review',
56 59 'recommendation',
57 60 'notification',
58 61 'promotions',
62 + 'welcome',
59 63 'compatibilities',
64 + 'about_us',
65 + 'announcements',
66 + 'featured_plugins',
67 + 'float_widget',
68 + 'migrator',
69 + 'ai_connect',
60 70 ];
71 + /**
72 + * Holds the labels for the modules.
73 + *
74 + * @var array The labels for the modules.
75 + */
76 + public static $labels = [
77 + 'announcements' => [
78 + 'notice_link_label' => 'See the deals',
79 + 'max_savings' => 'Best WordPress Black Friday deals of %s — themes, plugins, hosting. Curated by the Themeisle team.',
80 + 'black_friday' => 'Black Friday Sale',
81 + 'time_left' => '%s left',
82 + 'plugin_meta_message' => 'Black Friday Sale - 60% OFF',
83 + ],
84 + 'compatibilities' => [
85 + 'notice' => '%s requires a newer version of %s. Please %supdate%s %s %s to the latest version.',
86 + 'notice2' => '%s update requires a newer version of %s. Please %supdate%s %s %s.',
87 + 'notice_theme' => '%1$sWarning:%2$s This theme has not been tested with your current version of %1$s%3$s%2$s. Please update %3$s plugin.',
88 + 'notice_plugin' => '%1$sWarning:%2$s This plugin has not been tested with your current version of %1$s%3$s%2$s. Please update %3$s %4$s.',
89 + 'theme' => 'theme',
90 + 'plugin' => 'plugin',
91 + ],
92 + 'dashboard_widget' => [
93 + 'title' => 'WordPress Guides/Tutorials',
94 + 'popular' => 'Popular %s',
95 + 'install' => 'Install',
96 + 'powered' => 'Powered by %s',
97 + ],
98 + 'licenser' => [
99 + 'activate' => 'Activate',
100 + 'invalid_msg' => 'Invalid license.',
101 + 'error_notice' => 'ERROR: Failed to connect to the license service. Please try again later. Reason: %s',
102 + 'error_notice2' => 'ERROR: Failed to validate license. Please try again in one minute.',
103 + 'error_invalid' => 'ERROR: Invalid license provided.',
104 + 'update_license' => 'Updating this theme will lose any customizations you have made. Cancel to stop, OK to update.',
105 + 'invalid_msg' => 'Invalid license.',
106 + 'already_active' => 'License is already active.',
107 + 'notice_update' => '%1$s is available. %2$sCheck out what\'s%3$s new or %4$supdate now%3$s.',
108 + 'not_active' => 'License not active.',
109 + 'deactivate' => 'Deactivate',
110 + 'renew_cta' => 'Renew license to update',
111 + 'autoactivate_notice' => '%s has been successfully activated using %s license !',
112 + 'valid' => 'Valid',
113 + 'invalid' => 'Invalid',
114 + 'notice' => 'Enter your license from %s purchase history in order to get %s updates',
115 + 'expired' => '%s license expired',
116 + 'expired_date' => 'Expired on %s',
117 + 'expired_notice' => 'Your current setup continues working, but premium features are disabled and you\'re no longer receive updates - including critical patches - or support.',
61 118
119 + '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.',
120 + '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.',
121 + 'renew_license' => 'Renew License',
122 + 'learn_more' => 'Learn More',
123 + ],
124 + 'promotions' => [
125 + 'recommended' => 'Recommended by %s',
126 + 'installActivate' => 'Install & Activate',
127 + 'preview' => 'Preview',
128 + 'installing' => 'Installing',
129 + 'activating' => 'Activating',
130 + 'connecting' => 'Connecting to API',
131 + 'learnmore' => 'Learn More',
132 + 'activate' => 'Activate',
133 + 'all_set' => 'Awesome! You are all set!',
134 + 'woo' => [
135 + 'title' => 'More extensions from Themeisle',
136 + 'title2' => 'Recommended extensions',
137 + 'cta_install' => 'Install',
138 + 'learn_more' => 'Learn More',
139 + 'dismiss' => 'Dismiss this suggestion',
140 + 'ppom_title' => 'Product Add-Ons',
141 + 'ppom_desc' => 'Add extra custom fields & add-ons on your product pages, like sizes, colors & more.',
142 + 'spark_title1' => 'Wishlist',
143 + 'spark_title2' => 'Multi-Announcement Bars',
144 + 'spark_title3' => 'Advanced Product Review',
145 + 'spark_desc1' => 'Loyalize your customers by allowing them to save their favorite products.',
146 + 'spark_desc2' => 'Add a top notification bar on your website to highlight the latest products, offers, or upcoming events.',
147 + 'spark_desc3' => 'Enable an advanced review section, enlarging the basic review options with lots of capabilities.',
148 + ],
149 +
150 + 'feedzy' => [
151 + 'import_desc' => 'Schedule automatic content imports from any RSS feed directly to your site. %sBuilt by %s%s',
152 + 'install_now' => 'Install Now',
153 + 'by' => 'by %s',
154 + 'editor_recommends' => '%s recommends %sFeedzy%s to display entries from any RSS feed with more advanced styling and filtering options.',
155 + ],
156 + 'optimole' => [
157 + 'installOptimole' => 'Install Optimole',
158 + 'gotodash' => 'Go to Optimole dashboard',
159 + 'dismisscta' => 'Dismiss this notice.',
160 + 'message1' => 'Increase this page speed and SEO ranking by optimizing images with Optimole.',
161 + 'message3' => 'Save your server space by storing images to Optimole and deliver them optimized from 400 locations around the globe. Unlimited images, Unlimited traffic.',
162 + 'message4' => 'This image looks to be too large and would affect your site speed, we recommend you to install Optimole to optimize your images.',
163 + 'message2' => 'Leverage Optimole\'s full integration with Elementor to automatically lazyload, resize, compress to AVIF/WebP and deliver from 400 locations around the globe!',
164 + ],
165 + 'redirectionCF7' => [
166 + 'gotodash' => 'Go to Contact Forms',
167 + 'dismisscta' => 'Dismiss this notice.',
168 + 'gst' => 'Get Started Free',
169 + 'message' => 'Add URL redirects, spam protection, execute JavaScript after submissions, and more with the Redirection for CF7 free plugin.',
170 + ],
171 + 'hyve' => [
172 + 'gotodash' => 'Go to Hyve Dashboard',
173 + 'install' => 'Install Hyve',
174 + 'dismisscta' => 'Dismiss this notice.',
175 + 'message' => 'Hyve is an AI-powered chatbot that turns your WordPress content into interactive conversations, helping you efficiently handle user inquiries.',
176 + ],
177 + 'wp_full_pay' => [
178 + 'gotodash' => 'Go to WP Full Pay Settings',
179 + 'install' => 'Install WP Full Pay',
180 + 'dismisscta' => 'Dismiss this notice.',
181 + '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.',
182 + ],
183 + 'masteriyo' => [
184 + 'gotodash' => 'Go to Masteriyo Dashboard',
185 + 'install' => 'Install Masteriyo',
186 + 'dismisscta' => 'Dismiss this notice.',
187 + '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.',
188 + ],
189 + 'easy_mcp' => [
190 + 'gotodash' => 'Go to Easy MCP Dashboard',
191 + 'install' => 'Install Easy MCP AI',
192 + 'dismisscta' => 'Dismiss this notice.',
193 + 'message' => 'Connect Claude, ChatGPT, and other AI assistants to this site with Easy MCP AI — a free MCP server that lets your AI manage content, media, and SEO data, with per-scope permissions and a full audit trail.',
194 + ],
195 + ],
196 + 'welcome' => [
197 + 'ctan' => 'No, thanks.',
198 + 'ctay' => 'Upgrade Now!',
199 + 'message' => '<p>You\'ve been using <b>{product}</b> for 7 days now and we appreciate your loyalty! We also want to make sure you\'re getting the most out of our product. That\'s why we\'re offering you a special deal - upgrade to <b>{pro_product}</b> in the next 5 days and receive a discount of <b>up to 30%</b>. <a href="{cta_link}" target="_blank">Upgrade now</a> and unlock all the amazing features of <b>{pro_product}</b>!</p>',
200 + ],
201 + 'uninstall' => [
202 + 'heading_plugin' => 'What\'s wrong?',
203 + 'heading_theme' => 'What does not work for you in {theme}?',
204 + 'submit' => 'Submit',
205 + 'cta_info' => 'What info do we collect?',
206 + 'button_submit' => 'Submit &amp; Deactivate',
207 + 'button_cancel' => 'Skip &amp; Deactivate',
208 + 'disclosure' => [
209 + 'title' => 'Below is a detailed view of all data that Themeisle will receive if you fill in this survey. No email address or IP addresses are transmitted after you submit the survey.',
210 + 'version' => '%s %s version %s %s %s %s',
211 + 'website' => '%sCurrent website:%s %s %s %s',
212 + 'usage' => '%sUsage time:%s %s %s%s',
213 + 'reason' => '%s Uninstall reason %s %s Selected reason from the above survey %s ',
214 + 'diagnostics' => '%sCrash diagnostics:%s Anonymized technical details of errors recorded for this product, if any.',
215 + ],
216 +
217 + 'options' => [
218 + 'id3' => [
219 + 'title' => 'I found a better plugin',
220 + 'placeholder' => 'What\'s the plugin\'s name?',
221 + ],
222 + 'id4' => [
223 +
224 + 'title' => 'I could not get the plugin to work',
225 + 'placeholder' => 'What problem are you experiencing?',
226 + ],
227 + 'id5' => [
228 +
229 + 'title' => 'I no longer need the plugin',
230 + 'placeholder' => 'If you could improve one thing about our product, what would it be?',
231 + ],
232 + 'id6' => [
233 + 'title' => 'It\'s a temporary deactivation. I\'m just debugging an issue.',
234 + 'placeholder' => 'What problem are you experiencing?',
235 + ],
236 + 'id7' => [
237 + 'title' => 'I don\'t know how to make it look like demo',
238 + ],
239 + 'id8' => [
240 +
241 + 'placeholder' => 'What option is missing?',
242 + 'title' => 'It lacks options',
243 + ],
244 + 'id9' => [
245 + 'title' => 'Is not working with a plugin that I need',
246 + 'placeholder' => 'What is the name of the plugin',
247 + ],
248 + 'id10' => [
249 + 'title' => 'I want to try a new design, I don\'t like {theme} style',
250 + ],
251 + 'id999' => [
252 + 'title' => 'Other',
253 + 'placeholder' => 'What can we do better?',
254 + ],
255 + ],
256 + ],
257 + 'review' => [
258 + 'notice' => '<p>Hey, it\'s great to see you have <b>{product}</b> active for a few days now. How is everything going? If you can spare a few moments to rate it on WordPress.org it would help us a lot (and boost my motivation). Cheers! <br/> <br/>~ {developer}, developer of {product}</p>',
259 + 'ctay' => 'Ok, I will gladly help.',
260 + 'ctan' => 'No, thanks.',
261 +
262 + ],
263 + 'rollback' => [
264 + 'cta' => 'Rollback to v%s',
265 + ],
266 + 'logger' => [
267 + 'notice' => 'Help improve <b>{product}</b> by sharing anonymous usage data about your setup. No personal data collected.',
268 + 'cta_y' => 'Count me in',
269 + 'cta_n' => 'No thanks',
270 + ],
271 + 'about_us' => [
272 + 'title' => 'About Us',
273 + 'heroHeader' => 'Our Story',
274 + 'heroTextFirst' => 'Themeisle was founded in 2012 by a group of passionate developers who wanted to create beautiful and functional WordPress themes and plugins. Since then, we have grown into a team of over 20 dedicated professionals who are committed to delivering the best possible products to our customers.',
275 + 'heroTextSecond' => 'At Themeisle, we offer a wide range of WordPress themes and plugins that are designed to meet the needs of both beginners and advanced users. Our products are feature-rich, easy to use, and are designed to help you create beautiful and functional websites.',
276 + 'teamImageCaption' => 'Our team in WCEU2022 in Portugal',
277 + 'newsHeading' => 'Stay connected for news & updates!',
278 + 'emailPlaceholder' => 'Your email address',
279 + 'signMeUp' => 'Sign me up',
280 + 'services' => [
281 + 'ariaLabel' => 'Themeisle services',
282 + 'trustpilotLabel' => 'Rated excellent on Trustpilot',
283 + 'trustpilotRated' => 'Rated',
284 + 'trustpilotOn' => 'on',
285 + 'trustpilotBrand' => 'Trustpilot',
286 + 'heading' => 'Expert WordPress services from the Themeisle team',
287 + 'description' => 'Done for you by the same people who build your plugins and themes.',
288 + 'cta' => 'Explore all services',
289 + 'items' => [
290 + 'websiteDesign' => [
291 + 'title' => 'Website Design',
292 + 'subtitle' => 'Built for your business',
293 + ],
294 + 'support' => [
295 + 'title' => 'Support',
296 + 'subtitle' => 'On-demand expert help',
297 + ],
298 + 'speed' => [
299 + 'title' => 'Speed Optimization',
300 + 'subtitle' => 'Core Web Vitals boost',
301 + ],
302 + 'seo' => [
303 + 'title' => 'SEO Foundation',
304 + 'subtitle' => 'Rank & get found',
305 + ],
306 + 'maintenance' => [
307 + 'title' => 'Maintenance',
308 + 'subtitle' => 'Updates, backups, security',
309 + ],
310 + 'hackedSite' => [
311 + 'title' => 'Hacked Site Repair',
312 + 'subtitle' => 'Malware removed fast',
313 + ],
314 + ],
315 + ],
316 + 'installNow' => 'Install Now',
317 + 'activate' => 'Activate',
318 + 'learnMore' => 'Learn More',
319 + 'installed' => 'Installed',
320 + 'notInstalled' => 'Not Installed',
321 + 'active' => 'Active',
322 + 'others' => [
323 + 'optimole_desc' => 'Optimole is an image optimization service that automatically optimizes your images and serves them to your visitors via a global CDN, making your website lighter, faster and helping you reduce your bandwidth usage.',
324 + 'neve_desc' => 'A fast, lightweight, customizable WordPress theme offering responsive design, speed, and flexibility for various website types.',
325 + 'landingkit_desc' => 'Turn WordPress into a landing page powerhouse with Landing Kit, map domains to pages or any other published resource.',
326 + 'sparks_desc' => 'Extend your store functionality with 8 ultra-performant features like product comparisons, variation swatches, wishlist, and more.',
327 + 'tpc_desc' => 'Design, save, and revisit your templates anytime with your personal vault on Templates Cloud.',
328 + ],
329 + 'otter-page' => [
330 + 'heading' => 'Build innovative layouts with Otter Blocks and Gutenberg',
331 + 'text' => 'Otter is a lightweight, dynamic collection of page building blocks and templates for the WordPress block editor.',
332 + 'buttons' => [
333 + 'install_otter_free' => "Install Otter - It's free!",
334 + 'install_now' => 'Install Now',
335 + 'learn_more' => 'Learn More',
336 + ],
337 + 'features' => [
338 + 'advancedTitle' => 'Advanced Features',
339 + 'advancedDesc' => 'Add features such as Custom CSS, Animations & Visibility Conditions to all blocks.',
340 + 'fastTitle' => 'Lightweight and Fast',
341 + 'fastDesc' => 'Otter enhances WordPress site building experience without impacting site speed.',
342 + 'mobileTitle' => 'Mobile-Friendly',
343 + 'mobileDesc' => 'Each block can be tweaked to provide a consistent experience across all devices.',
344 + ],
345 + 'details' => [
346 + 's1Title' => 'A Better Page Building Experience',
347 + 's1Text' => 'Otter can be used to build everything from a personal blog to an e-commerce site without losing the personal touch. Otter’s ease of use transforms basic blocks into expressive layouts in seconds.',
348 + 's2Title' => 'A New Collection of Patterns',
349 + 's2Text' => 'A New Patterns Library, containing a range of different elements in a variety of styles to help you build great pages. All of your website’s most important areas are covered: headers, testimonials, pricing tables, sections and more.',
350 + 's3Title' => 'Advanced Blocks',
351 + 's3Text' => 'Enhance your website’s design with powerful blocks, like the Add to Cart, Business Hours, Review Comparison, and dozens of WooCommerce blocks.',
352 + ],
353 + 'testimonials' => [
354 + 'heading' => 'Trusted by more than 300K website owners',
355 + 'users' => [
356 + 'user_1' => 'Loved the collection of blocks. If you want to create nice Gutenberg Pages, this plugin will be very handy and useful.',
357 + 'user_2' => 'I am very satisfied with Otter – a fantastic collection of blocks. And the plugin is perfectly integrated with Gutenberg and complete enough for my needs.',
358 + 'user_3' => 'Otter Blocks work really well and I like the customization options. Easy to use and format to fit in with my site theme – and I’ve not encountered any compatibility or speed issues.',
359 + ],
360 + ],
361 + ],
362 + ],
363 + 'ai_connect' => [
364 + 'row_link' => 'Connect with your AI agent',
365 + // translators: %s is the product name.
366 + 'notice_title' => 'Manage %s with your AI agent.',
367 + // translators: %s is a list of things the agent can do, e.g. "optimize new uploads, purge cached images or offload originals".
368 + 'notice_text' => 'Ask Claude, ChatGPT or Cursor to %s.',
369 + // translators: 1: comma-separated use cases, 2: the last use case.
370 + 'cases_join' => '%1$s or %2$s',
371 + 'notice_button' => 'Connect your AI agent',
372 + 'eyebrow' => 'Works with Claude, ChatGPT, Cursor and any MCP agent',
373 + // translators: %s is the product name.
374 + 'title' => 'Use %s from your AI agent',
375 + // translators: %s is the product name.
376 + 'lead' => 'Activate your site’s MCP URL, connect the agent you already use, and %s becomes something you can simply ask for.',
377 + 'enable' => 'Install and activate Easy MCP',
378 + 'enable_installed' => 'Activate Easy MCP',
379 + 'enabling' => 'Installing…',
380 + 'activating' => 'Activating…',
381 + 'enabled' => 'Easy MCP is active',
382 + // translators: %s is the product name.
383 + 'enable_note' => 'Easy MCP is free, by the %s team. It enables your site’s MCP URL.',
384 + 'url_label' => 'Your site’s MCP URL',
385 + 'copy' => 'Copy',
386 + 'copied' => 'Copied',
387 + 'close' => 'Close',
388 + 'connect_heading' => 'Connect your agent',
389 + 'connect_claude' => 'Connect to Claude',
390 + 'connect_chatgpt' => 'Connect to ChatGPT',
391 + 'connect_cursor' => 'Add to Cursor',
392 + 'hint_off' => 'Your agents can connect once Easy MCP is active.',
393 + 'hint_on' => 'Each button opens your agent with this site pre-filled. ChatGPT asks you to paste the URL above.',
394 + 'more_agents' => 'Using another agent?',
395 + 'more_agents_link' => 'See how to connect it.',
396 + 'prompts_off' => 'Once Easy MCP is active, you can ask your AI agent things like',
397 + 'prompts_on' => 'Try asking',
398 + 'error_permission' => 'You are not allowed to do this.',
399 + 'error_install' => 'Easy MCP could not be activated. Please try again.',
400 + ],
401 + 'float_widget' => [
402 + 'button' => 'Toggle Help Widget for %s',
403 + 'panel' => [
404 + 'greeting' => 'Thank you for using %s',
405 + 'title' => 'How can we help you?',
406 + 'close' => 'Close Toggle Help Widget',
407 + ],
408 + 'links' => [
409 + 'documentation' => 'Documentation',
410 + 'support' => 'Get Support',
411 + 'wizard' => 'Run Setup Wizard',
412 + 'upgrade' => 'Upgrade to Pro',
413 + 'feature_request' => 'Suggest a Feature',
414 + 'rate' => 'Rate Us',
415 + ],
416 + ],
417 + ];
418 +
62 419 /**
63 420 * Initialize the sdk logic.
64 421 */
65 422 public static function init() {
423 + self::localize_labels();
66 424 if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Loader ) ) {
67 425 self::$instance = new Loader();
68 426 $modules = array_merge( self::$available_modules, apply_filters( 'themeisle_sdk_modules', [] ) );
69 427 foreach ( $modules as $key => $module ) {
@@ -71,12 +429,96 @@
71 429 unset( $modules[ $key ] );
72 430 }
73 431 }
74 432 self::$available_modules = $modules;
433 +
434 + add_action( 'themeisle_sdk_first_activation', array( __CLASS__, 'activate' ) );
435 +
75 436 }
76 437 }
438 +
439 + /**
440 + * Localize the labels.
441 + */
442 + public static function localize_labels() {
443 + $originals = self::$labels;
444 + $all_translations = [];
77 445
446 + global $wp_filter;
447 + if ( isset( $wp_filter['themeisle_sdk_labels'] ) ) {
448 + foreach ( $wp_filter['themeisle_sdk_labels']->callbacks as $priority => $hooks ) {
449 + foreach ( $hooks as $hook ) {
450 + // Each callback gets fresh originals, not previous callback's output
451 + $result = call_user_func( $hook['function'], $originals );
452 + $all_translations[] = $result;
453 + }
454 + }
455 +
456 + // Remove the filter so it doesn't run again via apply_filters
457 + remove_all_filters( 'themeisle_sdk_labels' );
458 + }
459 +
460 + // Merge all results, first real translation wins
461 + self::$labels = self::merge_all_translations( $originals, $all_translations );
462 + }
78 463 /**
464 + * Merge all translations.
465 + *
466 + * @param array $originals The original labels.
467 + * @param array $all_translations The all translations.
468 + *
469 + * @return array The merged labels.
470 + */
471 + private static function merge_all_translations( $originals, $all_translations ) {
472 + $result = $originals;
473 +
474 + foreach ( $all_translations as $translations ) {
475 + $result = self::merge_if_translated( $result, $translations, $originals );
476 + }
477 +
478 + return $result;
479 + }
480 + /**
481 + * Merge if translated.
482 + *
483 + * @param array $current The current labels.
484 + * @param array $new The new labels.
485 + * @param array $originals The original labels.
486 + * @return array The merged labels.
487 + */
488 + private static function merge_if_translated( $current, $new, $originals ) {
489 + foreach ( $new as $key => $value ) {
490 + if ( ! isset( $originals[ $key ] ) ) {
491 + // New key, accept it
492 + if ( ! isset( $current[ $key ] ) ) {
493 + $current[ $key ] = $value;
494 + }
495 + continue;
496 + }
497 +
498 + if ( is_array( $value ) && is_array( $originals[ $key ] ) ) {
499 + $current[ $key ] = self::merge_if_translated(
500 + $current[ $key ],
501 + $value,
502 + $originals[ $key ]
503 + );
504 + } else {
505 + // Only accept if:
506 + // 1. New value is actually translated (differs from original)
507 + // 2. Current value is NOT already translated
508 + $is_new_translated = ( $value !== $originals[ $key ] );
509 + $is_current_untranslated = ( $current[ $key ] === $originals[ $key ] );
510 +
511 + if ( $is_new_translated && $is_current_untranslated ) {
512 + $current[ $key ] = $value;
513 + }
514 + }
515 + }
516 +
517 + return $current;
518 + }
519 +
520 + /**
79 521 * Get cache token used in API requests.
80 522 *
81 523 * @return string Cache token.
82 524 */
@@ -118,8 +560,30 @@
118 560 return self::$instance;
119 561 }
120 562
121 563 /**
564 + * Activate the product routine.
565 + *
566 + * @param string $file The base file of the product.
567 + *
568 + * @return void
569 + */
570 + public static function activate( $file ) {
571 +
572 + $dirname = trailingslashit( dirname( ( $file ) ) );
573 + if ( ! file_exists( $dirname . '_reference.php' ) ) {
574 + return;
575 + }
576 + $reference_data = require_once $dirname . '_reference.php';
577 + if ( ! is_array( $reference_data ) ||
578 + ! isset( $reference_data['key'] ) ||
579 + ! isset( $reference_data['value'] ) ||
580 + ! preg_match( '/^[a-zA-Z0-9_]+_reference_key$/', $reference_data['key'] ) ) {
581 + return;
582 + }
583 + add_option( $reference_data['key'], sanitize_key( $reference_data['value'] ) );
584 + }
585 + /**
122 586 * Get all registered modules by the SDK.
123 587 *
124 588 * @return array Modules available.
125 589 */
@@ -129,9 +593,9 @@
129 593
130 594 /**
131 595 * Get all products using the SDK.
132 596 *
133 - * @return array Products available.
597 + * @return array<Product> Products available.
134 598 */
135 599 public static function get_products() {
136 600 return self::$products;
137 601 }
@@ -143,6 +607,5 @@
143 607 */
144 608 public static function get_version() {
145 609 return self::$version;
146 610 }
147 -
148 611 }