PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 4.0.8
Visualizer – Tables & Charts Manager with Built-in AI Generator v4.0.8
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 +153 -1 3.10.14.0.8 View file →
@@ -23,8 +23,30 @@
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 + 'wpcf7-redirect' => 'wpcf7-redirect/wpcf7-redirect.php',
43 + 'wp-full-stripe-free' => 'wp-full-stripe-free/wp-full-stripe.php',
44 + 'learning-management-system' => 'learning-management-system/lms.php',
45 + 'wp-cloudflare-page-cache' => 'wp-cloudflare-page-cache/wp-cloudflare-super-page-cache.php',
46 + ];
47 +
48 + /**
27 49 * Product which use the module.
28 50 *
29 51 * @var Product $product Product object.
30 52 */
@@ -53,9 +75,8 @@
53 75 *
54 76 * @return bool Is product from partner.
55 77 */
56 78 public function is_from_partner( $product ) {
57 -
58 79 foreach ( Module_Factory::$domains as $partner_domain ) {
59 80 if ( strpos( $product->get_store_url(), $partner_domain ) !== false ) {
60 81 return true;
61 82 }
@@ -78,6 +99,137 @@
78 99 : wp_remote_get( //phpcs:ignore WordPressVIPMinimum.Functions.RestrictedFunctions.wp_remote_get_wp_remote_get, Already used.
79 100 $url,
80 101 $args
81 102 );
103 + }
104 +
105 + /**
106 + * Get the SDK base url.
107 + *
108 + * @return string
109 + */
110 + public function get_sdk_uri() {
111 + global $themeisle_sdk_max_path;
112 +
113 + /**
114 + * $themeisle_sdk_max_path can point to the theme when the theme version is higher.
115 + * hence we also need to check that the path does not point to the theme else this will break the URL.
116 + * References: https://github.com/Codeinwp/neve-pro-addon/issues/2403
117 + */
118 + if ( ( $this->product->is_plugin() || $this->product->is_theme() ) && false === strpos( $themeisle_sdk_max_path, get_template_directory() ) ) {
119 + return plugins_url( '/', $themeisle_sdk_max_path . '/themeisle-sdk/' );
120 + };
121 +
122 + return get_template_directory_uri() . '/vendor/codeinwp/themeisle-sdk/';
123 + }
124 +
125 + /**
126 + * Call plugin api
127 + *
128 + * @param string $slug plugin slug.
129 + *
130 + * @return array|mixed|object
131 + */
132 + public function call_plugin_api( $slug ) {
133 + include_once ABSPATH . 'wp-admin/includes/plugin-install.php';
134 +
135 + $call_api = get_transient( 'ti_plugin_info_' . $slug );
136 +
137 + if ( false === $call_api ) {
138 + $call_api = plugins_api(
139 + 'plugin_information',
140 + array(
141 + 'slug' => $slug,
142 + 'fields' => array(
143 + 'downloaded' => false,
144 + 'rating' => true,
145 + 'ratings' => true,
146 + 'description' => false,
147 + 'short_description' => true,
148 + 'donate_link' => false,
149 + 'tags' => false,
150 + 'sections' => true,
151 + 'homepage' => true,
152 + 'added' => false,
153 + 'last_updated' => false,
154 + 'compatibility' => false,
155 + 'tested' => false,
156 + 'requires' => false,
157 + 'downloadlink' => false,
158 + 'icons' => true,
159 + 'banners' => true,
160 + ),
161 + )
162 + );
163 + set_transient( 'ti_plugin_info_' . $slug, $call_api, 30 * MINUTE_IN_SECONDS );
164 + }
165 +
166 + return $call_api;
167 + }
168 +
169 + /**
170 + * Get the plugin status.
171 + *
172 + * @param string $plugin Plugin slug.
173 + *
174 + * @return bool
175 + */
176 + public function is_plugin_installed( $plugin ) {
177 + if ( ! isset( $this->plugin_paths[ $plugin ] ) ) {
178 + return false;
179 + }
180 +
181 + if ( file_exists( WP_CONTENT_DIR . '/plugins/' . $this->plugin_paths[ $plugin ] ) ) {
182 + return true;
183 + }
184 +
185 + return false;
186 + }
187 +
188 + /**
189 + * Get plugin activation link.
190 + *
191 + * @param string $slug The plugin slug.
192 + *
193 + * @return string
194 + */
195 + public function get_plugin_activation_link( $slug ) {
196 + $reference_key = $slug === 'otter-blocks' ? 'reference_key' : 'optimole_reference_key';
197 + $plugin = isset( $this->plugin_paths[ $slug ] ) ? $this->plugin_paths[ $slug ] : $slug . '/' . $slug . '.php';
198 +
199 + return add_query_arg(
200 + array(
201 + 'plugin_status' => 'all',
202 + 'paged' => '1',
203 + 'action' => 'activate',
204 + $reference_key => $this->product->get_key(),
205 + 'plugin' => rawurlencode( $plugin ),
206 + '_wpnonce' => wp_create_nonce( 'activate-plugin_' . $plugin ),
207 + ),
208 + admin_url( 'plugins.php' )
209 + );
210 + }
211 +
212 + /**
213 + * Checks if a plugin is active.
214 + *
215 + * @param string $plugin plugin slug.
216 + *
217 + * @return bool
218 + */
219 + public function is_plugin_active( $plugin ) {
220 + include_once ABSPATH . 'wp-admin/includes/plugin.php';
221 +
222 + $plugin = isset( $this->plugin_paths[ $plugin ] ) ? $this->plugin_paths[ $plugin ] : $plugin . '/' . $plugin . '.php';
223 +
224 + return is_plugin_active( $plugin );
225 + }
226 +
227 + /**
228 + * Get the current date.
229 + *
230 + * @return \DateTime The date time.
231 + */
232 + public function get_current_date() {
233 + return apply_filters( 'themeisle_sdk_current_date', new \DateTime( 'now' ) );
82 234 }
83 235 }