PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 2.1.4
Visualizer – Tables & Charts Manager with Built-in AI Generator v2.1.4
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 3.10.3 All 149 releases
visualizer / vendor / codeinwp / themeisle-sdk / class-themeisle-sdk-loader.php

class-themeisle-sdk-loader.php in Visualizer – Tables & Charts Manager with Built-in AI Generator 2.1.4, at vendor/codeinwp/themeisle-sdk/class-themeisle-sdk-loader.php

113 lines 3.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 // Exit if accessed directly.
12 if ( ! defined( 'ABSPATH' ) ) {
13 exit;
14 }
15 if ( ! class_exists( 'ThemeIsle_SDK_Loader' ) ) :
16 /**
17 * Singleton loader for ThemeIsle SDK.
18 */
19 final class ThemeIsle_SDK_Loader {
20 /**
21 * @var ThemeIsle_SDK_Loader instance The singleton instance
22 */
23 private static $instance;
24 /**
25 * @var string $version The class version.
26 */
27 private static $version = '1.0.0';
28 /**
29 * @var array The products which use the SDK.
30 */
31 private static $products;
32
33 /**
34 * Register product into SDK.
35 *
36 * @param string $basefile The product basefile.
37 *
38 * @return ThemeIsle_SDK_Loader The singleton object.
39 */
40 public static function init_product( $basefile ) {
41 if ( ! isset( self::$instance ) && ! ( self::$instance instanceof ThemeIsle_SDK_Loader ) ) {
42 self::$instance = new ThemeIsle_SDK_Loader;
43 self::$instance->setup_hooks();
44 }
45 $product_object = new ThemeIsle_SDK_Product( $basefile );
46 self::$products[ $product_object->get_slug() ] = $product_object;
47
48 $notifications = array();
49 // Based on the Wordpress Available file header we enable the logger or not.
50 if ( ! $product_object->is_wordpress_available() ) {
51 $licenser = new ThemeIsle_SDK_Licenser( $product_object );
52 $licenser->enable();
53 }
54
55 $logger = new ThemeIsle_SDK_Logger( $product_object );
56 if ( $product_object->is_logger_active() ) {
57 $logger->enable();
58 } else {
59 $notifications[] = $logger;
60 }
61
62 $feedback = new ThemeIsle_SDK_Feedback_Factory( $product_object, $product_object->get_feedback_types() );
63
64 $instances = $feedback->get_instances();
65 if ( array_key_exists( 'review', $instances ) ) {
66 $notifications[] = $instances['review'];
67 }
68 new ThemeIsle_SDK_Notification_Manager( $product_object, $notifications );
69
70 new ThemeIsle_SDK_Widgets_Factory( $product_object, $product_object->get_widget_types() );
71
72 return self::$instance;
73 }
74
75 /**
76 * Get all products using the SDK.
77 *
78 * @return array Products available.
79 */
80 public static function get_products() {
81 return self::$products;
82 }
83
84 /**
85 * Setup loader hookds.
86 */
87 public function setup_hooks() {
88 add_filter( 'extra_plugin_headers', array( $this, 'add_extra_headers' ) );
89 add_filter( 'extra_theme_headers', array( $this, 'add_extra_headers' ) );
90 }
91
92 /**
93 * @param array $headers The extra headers.
94 *
95 * @return array The new headers.
96 */
97 function add_extra_headers( $headers ) {
98 if ( ! in_array( 'Requires License', $headers ) ) {
99 $headers[] = 'Requires License';
100 }
101 if ( ! in_array( 'WordPress Available', $headers ) ) {
102 $headers[] = 'WordPress Available';
103 }
104 if ( ! in_array( 'Pro Slug', $headers ) ) {
105 $headers[] = 'Pro Slug';
106 }
107
108 return $headers;
109 }
110
111 }
112 endif;
113