PluginProbe
Visualizer – Tables & Charts Manager with Built-in AI Generator / 3.7.12
Visualizer – Tables & Charts Manager with Built-in AI Generator v3.7.12
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/Product.php +50 -3 3.1.33.7.12 View file →
@@ -105,10 +105,13 @@
105 105 *
106 106 * @var string $version The product version.
107 107 */
108 108 private $version;
109 -
110 109 /**
110 + * Root api endpoint.
111 + */
112 + const API_URL = 'https://api.themeisle.com/';
113 + /**
111 114 * ThemeIsle_SDK_Product constructor.
112 115 *
113 116 * @param string $basefile Product basefile.
114 117 */
@@ -113,9 +116,9 @@
113 116 * @param string $basefile Product basefile.
114 117 */
115 118 public function __construct( $basefile ) {
116 119 if ( ! empty( $basefile ) ) {
117 - if ( is_readable( $basefile ) ) {
120 + if ( is_file( $basefile ) ) {
118 121 $this->basefile = $basefile;
119 122 $this->setup_from_path();
120 123 $this->setup_from_fileheaders();
121 124 }
@@ -153,9 +156,9 @@
153 156 * @param string $string the String to be normalized for cron handler.
154 157 *
155 158 * @return string $name The normalized string.
156 159 */
157 - static function key_ready_name( $string ) {
160 + public static function key_ready_name( $string ) {
158 161 return str_replace( '-', '_', strtolower( trim( $string ) ) );
159 162 }
160 163
161 164 /**
@@ -199,8 +202,9 @@
199 202 */
200 203 public function get_key() {
201 204 return $this->key;
202 205 }
206 +
203 207 /**
204 208 * Check if the product is either theme or plugin.
205 209 *
206 210 * @return string Product type.
@@ -318,8 +322,17 @@
318 322 return $name;
319 323 }
320 324
321 325 /**
326 + * Return the product version cache key.
327 + *
328 + * @return string The product version cache key.
329 + */
330 + public function get_cache_key() {
331 + return $this->get_key() . '_' . preg_replace( '/[^0-9a-zA-Z ]/m', '', $this->get_version() ) . 'versions';
332 + }
333 +
334 + /**
322 335 * Getter for product name.
323 336 *
324 337 * @return string The product name.
325 338 */
@@ -341,8 +354,13 @@
341 354 *
342 355 * @return string The store url.
343 356 */
344 357 public function get_store_url() {
358 +
359 + if ( strpos( $this->store_url, '/themeisle.com' ) !== false ) {
360 + return 'https://store.themeisle.com/';
361 + }
362 +
345 363 return $this->store_url;
346 364 }
347 365
348 366 /**
@@ -354,8 +372,23 @@
354 372 return $this->basefile;
355 373 }
356 374
357 375 /**
376 + * Get changelog url.
377 + *
378 + * @return string Changelog url.
379 + */
380 + public function get_changelog() {
381 + return add_query_arg(
382 + [
383 + 'name' => rawurlencode( $this->get_name() ),
384 + 'edd_action' => 'view_changelog',
385 + ],
386 + $this->get_store_url()
387 + );
388 + }
389 +
390 + /**
358 391 * Returns product filename.
359 392 *
360 393 * @return string The product filename.
361 394 */
@@ -361,8 +394,9 @@
361 394 */
362 395 public function get_file() {
363 396 return $this->file;
364 397 }
398 +
365 399 /**
366 400 * Returns the pro slug, if available.
367 401 *
368 402 * @return string The pro slug.
@@ -377,7 +411,20 @@
377 411 * @return int The install timestamp.
378 412 */
379 413 public function get_install_time() {
380 414 return $this->install;
415 + }
416 +
417 + /**
418 + * Returns the URL of the product base file.
419 + *
420 + * @param string $path The path to the file.
421 + *
422 + * @return string The URL of the product base file.
423 + */
424 + public function get_base_url( $path = '/' ) {
425 + if ( $this->type ) {
426 + return plugins_url( $path, $this->basefile );
427 + }
381 428 }
382 429
383 430 }