PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.10.7
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.10.7
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
← All changes | vendor/codeinwp/themeisle-sdk/src/Common/Abstract_module.php +139 -1 3.10.03.10.7 View file →
@@ -23,8 +23,26 @@
23 23 * @package ThemeisleSDK\Common
24 24 */
25 25 abstract class Abstract_Module {
26 26 /**
27 + * Plugin paths.
28 + *
29 + * @var string[] $plugin_paths Plugin paths.
30 + */
31 + private $plugin_paths = [
32 + 'otter-blocks' => 'otter-blocks/otter-blocks.php',
33 + 'optimole-wp' => 'optimole-wp/optimole-wp.php',
34 + 'tweet-old-post' => 'tweet-old-post/tweet-old-post.php',
35 + 'feedzy-rss-feeds' => 'feedzy-rss-feeds/feedzy-rss-feed.php',
36 + 'woocommerce-product-addon' => 'woocommerce-product-addon/woocommerce-product-addon.php',
37 + 'visualizer' => 'visualizer/index.php',
38 + 'wp-landing-kit' => 'wp-landing-kit/wp-landing-kit.php',
39 + 'multiple-pages-generator-by-porthas' => 'multiple-pages-generator-by-porthas/porthas-multi-pages-generator.php',
40 + 'sparks-for-woocommerce' => 'sparks-for-woocommerce/sparks-for-woocommerce.php',
41 + 'templates-patterns-collection' => 'templates-patterns-collection/templates-patterns-collection.php',
42 + ];
43 +
44 + /**
27 45 * Product which use the module.
28 46 *
29 47 * @var Product $product Product object.
30 48 */
@@ -53,9 +71,8 @@
53 71 *
54 72 * @return bool Is product from partner.
55 73 */
56 74 public function is_from_partner( $product ) {
57 -
58 75 foreach ( Module_Factory::$domains as $partner_domain ) {
59 76 if ( strpos( $product->get_store_url(), $partner_domain ) !== false ) {
60 77 return true;
61 78 }
@@ -78,6 +95,127 @@
78 95 : wp_remote_get( //phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.wp_remote_get_wp_remote_get, Already used.
79 96 $url,
80 97 $args
81 98 );
99 + }
100 +
101 + /**
102 + * Get the SDK base url.
103 + *
104 + * @return string
105 + */
106 + public function get_sdk_uri() {
107 + global $themeisle_sdk_max_path;
108 +
109 + /**
110 + * $themeisle_sdk_max_path can point to the theme when the theme version is higher.
111 + * hence we also need to check that the path does not point to the theme else this will break the URL.
112 + * References: https://github.com/Codeinwp/neve-pro-addon/issues/2403
113 + */
114 + if ( $this->product->is_plugin() && false === strpos( $themeisle_sdk_max_path, get_template_directory() ) ) {
115 + return plugins_url( '/', $themeisle_sdk_max_path . '/themeisle-sdk/' );
116 + };
117 +
118 + return get_template_directory_uri() . '/vendor/codeinwp/themeisle-sdk/';
119 + }
120 +
121 + /**
122 + * Call plugin api
123 + *
124 + * @param string $slug plugin slug.
125 + *
126 + * @return array|mixed|object
127 + */
128 + public function call_plugin_api( $slug ) {
129 + include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
130 +
131 + $call_api = get_transient( 'ti_plugin_info_' . $slug );
132 +
133 + if ( false === $call_api ) {
134 + $call_api = plugins_api(
135 + 'plugin_information',
136 + array(
137 + 'slug' => $slug,
138 + 'fields' => array(
139 + 'downloaded' => false,
140 + 'rating' => false,
141 + 'description' => false,
142 + 'short_description' => true,
143 + 'donate_link' => false,
144 + 'tags' => false,
145 + 'sections' => true,
146 + 'homepage' => true,
147 + 'added' => false,
148 + 'last_updated' => false,
149 + 'compatibility' => false,
150 + 'tested' => false,
151 + 'requires' => false,
152 + 'downloadlink' => false,
153 + 'icons' => true,
154 + 'banners' => true,
155 + ),
156 + )
157 + );
158 + set_transient( 'ti_plugin_info_' . $slug, $call_api, 30 * MINUTE_IN_SECONDS );
159 + }
160 +
161 + return $call_api;
162 + }
163 +
164 + /**
165 + * Get the plugin status.
166 + *
167 + * @param string $plugin Plugin slug.
168 + *
169 + * @return bool
170 + */
171 + public function is_plugin_installed( $plugin ) {
172 + if ( ! isset( $this->plugin_paths[ $plugin ] ) ) {
173 + return false;
174 + }
175 +
176 + if ( file_exists( WP_CONTENT_DIR . '/plugins/' . $this->plugin_paths[ $plugin ] ) ) {
177 + return true;
178 + }
179 +
180 + return false;
181 + }
182 +
183 + /**
184 + * Get plugin activation link.
185 + *
186 + * @param string $slug The plugin slug.
187 + *
188 + * @return string
189 + */
190 + public function get_plugin_activation_link( $slug ) {
191 + $reference_key = $slug === 'otter-blocks' ? 'reference_key' : 'optimole_reference_key';
192 + $plugin = isset( $this->plugin_paths[ $slug ] ) ? $this->plugin_paths[ $slug ] : $slug . '/' . $slug . '.php';
193 +
194 + return add_query_arg(
195 + array(
196 + 'plugin_status' => 'all',
197 + 'paged' => '1',
198 + 'action' => 'activate',
199 + $reference_key => $this->product->get_key(),
200 + 'plugin' => rawurlencode( $plugin ),
201 + '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $plugin ),
202 + ),
203 + admin_url( 'plugins.php' )
204 + );
205 + }
206 +
207 + /**
208 + * Checks if a plugin is active.
209 + *
210 + * @param string $plugin plugin slug.
211 + *
212 + * @return bool
213 + */
214 + public function is_plugin_active( $plugin ) {
215 + include_once ABSPATH . 'wp-admin/includes/plugin.php';
216 +
217 + $plugin = isset( $this->plugin_paths[ $plugin ] ) ? $this->plugin_paths[ $plugin ] : $plugin . '/' . $plugin . '.php';
218 +
219 + return is_plugin_active( $plugin );
82 220 }
83 221 }