PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.11.7
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.11.7
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 3.10.3 3.10.4 All 148 releases
visualizer / vendor / codeinwp / themeisle-sdk / src / Loader.php

Loader.php in Visualizer – Tables & Charts Manager with Built-in AI Generator 3.11.7, at vendor/codeinwp/themeisle-sdk/src/Loader.php

407 lines 17.0 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The main loader class for ThemeIsle SDK
4 *
5 * @package ThemeIsleSDK
6 * @subpackage Loader
7 * @copyright Copyright (c) 2017, Marius Cristea
8 * @license http://opensource.org/licenses/gpl-3.0.php GNU Public License
9 * @since 1.0.0
10 */
11
12 namespace ThemeisleSDK;
13
14 use ThemeisleSDK\Common\Module_Factory;
15
16 if ( ! defined( 'ABSPATH' ) ) {
17 exit;
18 }
19
20
21 /**
22 * Singleton loader for ThemeIsle SDK.
23 */
24 final class Loader {
25 /**
26 * Singleton instance.
27 *
28 * @var Loader instance The singleton instance
29 */
30 private static $instance;
31 /**
32 * Current loader version.
33 *
34 * @var string $version The class version.
35 */
36 private static $version = '2.0.0';
37 /**
38 * Holds registered products.
39 *
40 * @var array<Product> The products which use the SDK.
41 */
42 private static $products = [];
43 /**
44 * Holds available modules to load.
45 *
46 * @var array The modules which SDK will be using.
47 */
48 private static $available_modules = [
49 'script_loader',
50 'dashboard_widget',
51 'rollback',
52 'uninstall_feedback',
53 'licenser',
54 'logger',
55 'translate',
56 'translations',
57 'review',
58 'recommendation',
59 'notification',
60 'promotions',
61 'welcome',
62 'compatibilities',
63 'about_us',
64 'announcements',
65 'featured_plugins',
66 'float_widget',
67 ];
68 /**
69 * Holds the labels for the modules.
70 *
71 * @var array The labels for the modules.
72 */
73 public static $labels = [
74 'announcements' => [
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',
79 ],
80 'compatibilities' => [
81 'notice' => '%s requires a newer version of %s. Please %supdate%s %s %s to the latest version.',
82 'notice2' => '%s update requires a newer version of %s. Please %supdate%s %s %s.',
83 '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.',
84 '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.',
85 'theme' => 'theme',
86 'plugin' => 'plugin',
87 ],
88 'dashboard_widget' => [
89 'title' => 'WordPress Guides/Tutorials',
90 'popular' => 'Popular %s',
91 'install' => 'Install',
92 'powered' => 'Powered by %s',
93 ],
94 'licenser' => [
95 'activate' => 'Activate',
96 'invalid_msg' => 'Invalid license.',
97 'error_notice' => 'ERROR: Failed to connect to the license service. Please try again later. Reason: %s',
98 'error_notice2' => 'ERROR: Failed to validate license. Please try again in one minute.',
99 'error_invalid' => 'ERROR: Invalid license provided.',
100 'update_license' => 'Updating this theme will lose any customizations you have made. Cancel to stop, OK to update.',
101 'invalid_msg' => 'Invalid license.',
102 'already_active' => 'License is already active.',
103 'notice_update' => '%1$s is available. %2$sCheck out what\'s%3$s new or %4$supdate now%3$s.',
104 'not_active' => 'License not active.',
105 'deactivate' => 'Deactivate',
106 'renew_cta' => 'Renew license to update',
107 'autoactivate_notice' => '%s has been successfully activated using %s license !',
108 'valid' => 'Valid',
109 'invalid' => 'Invalid',
110 'notice' => 'Enter your license from %s purchase history in order to get %s updates',
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.',
112
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.',
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.',
115 ],
116 'promotions' => [
117 'recommended' => 'Recommended by %s',
118 'installActivate' => 'Install & Activate',
119 'preview' => 'Preview',
120 'installing' => 'Installing',
121 'activating' => 'Activating',
122 'connecting' => 'Connecting to API',
123 'learnmore' => 'Learn More',
124 'activate' => 'Activate',
125 'all_set' => 'Awesome! You are all set!',
126 'woo' => [
127 'title' => 'More extensions from Themeisle',
128 'title2' => 'Recommended extensions',
129 'cta_install' => 'Install',
130 'learn_more' => 'Learn More',
131 'dismiss' => 'Dismiss this suggestion',
132 'ppom_title' => 'Product Add-Ons',
133 'ppom_desc' => 'Add extra custom fields & add-ons on your product pages, like sizes, colors & more.',
134 'spark_title1' => 'Wishlist',
135 'spark_title2' => 'Multi-Announcement Bars',
136 'spark_title3' => 'Advanced Product Review',
137 'spark_desc1' => 'Loyalize your customers by allowing them to save their favorite products.',
138 'spark_desc2' => 'Add a top notification bar on your website to highlight the latest products, offers, or upcoming events.',
139 'spark_desc3' => 'Enable an advanced review section, enlarging the basic review options with lots of capabilities.',
140 ],
141 'optimole' => [
142 'installOptimole' => 'Install Optimole',
143 'gotodash' => 'Go to Optimole dashboard',
144 'dismisscta' => 'Dismiss this notice.',
145 'message1' => 'Increase this page speed and SEO ranking by optimizing images with Optimole.',
146 'message3' => 'Save your server space by storing images to Optimole and deliver them optimized from 400 locations around the globe. Unlimited images, Unlimited traffic.',
147 'message4' => 'This image looks to be too large and would affect your site speed, we recommend you to install Optimole to optimize your images.',
148 'message2' => 'Leverage Optimole\'s full integration with Elementor to automatically lazyload, resize, compress to AVIF/WebP and deliver from 400 locations around the globe!',
149 ],
150 'redirectionCF7' => [
151 'gotodash' => 'Go to Contact Forms',
152 'dismisscta' => 'Dismiss this notice.',
153 'gst' => 'Get Started Free',
154 'message' => 'Add URL redirects, spam protection, execute JavaScript after submissions, and more with the Redirection for CF7 free plugin.',
155 ],
156 'hyve' => [
157 'gotodash' => 'Go to Hyve Dashboard',
158 'install' => 'Install Hyve',
159 'dismisscta' => 'Dismiss this notice.',
160 'message' => 'Hyve is an AI-powered chatbot that turns your WordPress content into interactive conversations, helping you efficiently handle user inquiries.',
161 ],
162 'wp_full_pay' => [
163 'gotodash' => 'Go to WP Full Pay Settings',
164 'install' => 'Install WP Full Pay',
165 'dismisscta' => 'Dismiss this notice.',
166 '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.',
167 ],
168 ],
169 'welcome' => [
170 'ctan' => 'No, thanks.',
171 'ctay' => 'Upgrade Now!',
172 '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>',
173 ],
174 'uninstall' => [
175 'heading_plugin' => 'What\'s wrong?',
176 'heading_theme' => 'What does not work for you in {theme}?',
177 'submit' => 'Submit',
178 'cta_info' => 'What info do we collect?',
179 'button_submit' => 'Submit &amp; Deactivate',
180 'button_cancel' => 'Skip &amp; Deactivate',
181 'disclosure' => [
182 '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.',
183 'version' => '%s %s version %s %s %s %s',
184 'website' => '%sCurrent website:%s %s %s %s',
185 'usage' => '%sUsage time:%s %s %s%s',
186 'reason' => '%s Uninstall reason %s %s Selected reason from the above survey %s ',
187 ],
188
189 'options' => [
190 'id3' => [
191 'title' => 'I found a better plugin',
192 'placeholder' => 'What\'s the plugin\'s name?',
193 ],
194 'id4' => [
195
196 'title' => 'I could not get the plugin to work',
197 'placeholder' => 'What problem are you experiencing?',
198 ],
199 'id5' => [
200
201 'title' => 'I no longer need the plugin',
202 'placeholder' => 'If you could improve one thing about our product, what would it be?',
203 ],
204 'id6' => [
205 'title' => 'It\'s a temporary deactivation. I\'m just debugging an issue.',
206 'placeholder' => 'What problem are you experiencing?',
207 ],
208 'id7' => [
209 'title' => 'I don\'t know how to make it look like demo',
210 ],
211 'id8' => [
212
213 'placeholder' => 'What option is missing?',
214 'title' => 'It lacks options',
215 ],
216 'id9' => [
217 'title' => 'Is not working with a plugin that I need',
218 'placeholder' => 'What is the name of the plugin',
219 ],
220 'id10' => [
221 'title' => 'I want to try a new design, I don\'t like {theme} style',
222 ],
223 'id999' => [
224 'title' => 'Other',
225 'placeholder' => 'What can we do better?',
226 ],
227 ],
228 ],
229 'review' => [
230 '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>',
231 'ctay' => 'Ok, I will gladly help.',
232 'ctan' => 'No, thanks.',
233
234 ],
235 'rollback' => [
236 'cta' => 'Rollback to v%s',
237 ],
238 'logger' => [
239 '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.',
240 'cta_y' => 'Sure, I would love to help.',
241 'cta_n' => 'No, thanks.',
242 ],
243 'about_us' => [
244 'title' => 'About Us',
245 'heroHeader' => 'Our Story',
246 '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.',
247 '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.',
248 'teamImageCaption' => 'Our team in WCEU2022 in Portugal',
249 'newsHeading' => 'Stay connected for news & updates!',
250 'emailPlaceholder' => 'Your email address',
251 'signMeUp' => 'Sign me up',
252 'installNow' => 'Install Now',
253 'activate' => 'Activate',
254 'learnMore' => 'Learn More',
255 'installed' => 'Installed',
256 'notInstalled' => 'Not Installed',
257 'active' => 'Active',
258 'others' => [
259 '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.',
260 'neve_desc' => 'A fast, lightweight, customizable WordPress theme offering responsive design, speed, and flexibility for various website types.',
261 'landingkit_desc' => 'Turn WordPress into a landing page powerhouse with Landing Kit, map domains to pages or any other published resource.',
262 'sparks_desc' => 'Extend your store functionality with 8 ultra-performant features like product comparisons, variation swatches, wishlist, and more.',
263 'tpc_desc' => 'Design, save, and revisit your templates anytime with your personal vault on Templates Cloud.',
264 ],
265 'otter-page' => [
266 'heading' => 'Build innovative layouts with Otter Blocks and Gutenberg',
267 'text' => 'Otter is a lightweight, dynamic collection of page building blocks and templates for the WordPress block editor.',
268 'buttons' => [
269 'install_otter_free' => "Install Otter - It's free!",
270 'install_now' => 'Install Now',
271 'learn_more' => 'Learn More',
272 ],
273 'features' => [
274 'advancedTitle' => 'Advanced Features',
275 'advancedDesc' => 'Add features such as Custom CSS, Animations & Visibility Conditions to all blocks.',
276 'fastTitle' => 'Lightweight and Fast',
277 'fastDesc' => 'Otter enhances WordPress site building experience without impacting site speed.',
278 'mobileTitle' => 'Mobile-Friendly',
279 'mobileDesc' => 'Each block can be tweaked to provide a consistent experience across all devices.',
280 ],
281 'details' => [
282 's1Title' => 'A Better Page Building Experience',
283 '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.',
284 's2Title' => 'A New Collection of Patterns',
285 '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.',
286 's3Title' => 'Advanced Blocks',
287 's3Text' => 'Enhance your website’s design with powerful blocks, like the Add to Cart, Business Hours, Review Comparison, and dozens of WooCommerce blocks.',
288 ],
289 'testimonials' => [
290 'heading' => 'Trusted by more than 300K website owners',
291 'users' => [
292 'user_1' => 'Loved the collection of blocks. If you want to create nice Gutenberg Pages, this plugin will be very handy and useful.',
293 '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.',
294 '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.',
295 ],
296 ],
297 ],
298 ],
299 'float_widget' => [
300 'button' => 'Toggle Help Widget for %s',
301 'panel' => [
302 'greeting' => 'Thank you for using %s',
303 'title' => 'How can we help you?',
304 'close' => 'Close Toggle Help Widget',
305 ],
306 'links' => [
307 'documentation' => 'Documentation',
308 'support' => 'Get Support',
309 'wizard' => 'Run Setup Wizard',
310 'upgrade' => 'Upgrade to Pro',
311 'feature_request' => 'Suggest a Feature',
312 'rate' => 'Rate Us',
313 ],
314 ],
315 ];
316
317 /**
318 * Initialize the sdk logic.
319 */
320 public static function init() {
321 /**
322 * This filter can be used to localize the labels inside each product.
323 */
324 self::$labels = apply_filters( 'themeisle_sdk_labels', self::$labels );
325 if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Loader ) ) {
326 self::$instance = new Loader();
327 $modules = array_merge( self::$available_modules, apply_filters( 'themeisle_sdk_modules', [] ) );
328 foreach ( $modules as $key => $module ) {
329 if ( ! class_exists( 'ThemeisleSDK\\Modules\\' . ucwords( $module, '_' ) ) ) {
330 unset( $modules[ $key ] );
331 }
332 }
333 self::$available_modules = $modules;
334 }
335 }
336
337 /**
338 * Get cache token used in API requests.
339 *
340 * @return string Cache token.
341 */
342 public static function get_cache_token() {
343 $cache_token = get_transient( 'themeisle_sdk_cache_token' );
344 if ( false === $cache_token ) {
345 $cache_token = wp_generate_password( 6, false );
346 set_transient( $cache_token, WEEK_IN_SECONDS );
347 }
348
349 return $cache_token;
350 }
351
352 /**
353 * Clear cache token.
354 */
355 public static function clear_cache_token() {
356 delete_transient( 'themeisle_sdk_cache_token' );
357 }
358
359 /**
360 * Register product into SDK.
361 *
362 * @param string $base_file The product base file.
363 *
364 * @return Loader The singleton object.
365 */
366 public static function add_product( $base_file ) {
367
368 if ( ! is_file( $base_file ) ) {
369 return self::$instance;
370 }
371 $product = new Product( $base_file );
372
373 Module_Factory::attach( $product, self::get_modules() );
374
375 self::$products[ $product->get_slug() ] = $product;
376
377 return self::$instance;
378 }
379
380 /**
381 * Get all registered modules by the SDK.
382 *
383 * @return array Modules available.
384 */
385 public static function get_modules() {
386 return self::$available_modules;
387 }
388
389 /**
390 * Get all products using the SDK.
391 *
392 * @return array<Product> Products available.
393 */
394 public static function get_products() {
395 return self::$products;
396 }
397
398 /**
399 * Get the version of the SDK.
400 *
401 * @return string The version.
402 */
403 public static function get_version() {
404 return self::$version;
405 }
406 }
407