| @@ -113,9 +113,9 @@ | ||
| 113 | 113 | * @param string $basefile Product basefile. |
| 114 | 114 | */ |
| 115 | 115 | public function __construct( $basefile ) { |
| 116 | 116 | if ( ! empty( $basefile ) ) { |
| 117 | - if ( is_readable( $basefile ) ) { | |
| 117 | + if ( is_file( $basefile ) ) { | |
| 118 | 118 | $this->basefile = $basefile; |
| 119 | 119 | $this->setup_from_path(); |
| 120 | 120 | $this->setup_from_fileheaders(); |
| 121 | 121 | } |
| @@ -199,8 +199,9 @@ | ||
| 199 | 199 | */ |
| 200 | 200 | public function get_key() { |
| 201 | 201 | return $this->key; |
| 202 | 202 | } |
| 203 | + | |
| 203 | 204 | /** |
| 204 | 205 | * Check if the product is either theme or plugin. |
| 205 | 206 | * |
| 206 | 207 | * @return string Product type. |
| @@ -341,8 +342,13 @@ | ||
| 341 | 342 | * |
| 342 | 343 | * @return string The store url. |
| 343 | 344 | */ |
| 344 | 345 | public function get_store_url() { |
| 346 | + | |
| 347 | + if ( strpos( $this->store_url, '/themeisle.com' ) !== false ) { | |
| 348 | + return 'https://store.themeisle.com/'; | |
| 349 | + } | |
| 350 | + | |
| 345 | 351 | return $this->store_url; |
| 346 | 352 | } |
| 347 | 353 | |
| 348 | 354 | /** |
| @@ -354,8 +360,23 @@ | ||
| 354 | 360 | return $this->basefile; |
| 355 | 361 | } |
| 356 | 362 | |
| 357 | 363 | /** |
| 364 | + * Get changelog url. | |
| 365 | + * | |
| 366 | + * @return string Changelog url. | |
| 367 | + */ | |
| 368 | + public function get_changelog() { | |
| 369 | + return add_query_arg( | |
| 370 | + [ | |
| 371 | + 'name' => rawurlencode( $this->get_name() ), | |
| 372 | + 'edd_action' => 'view_changelog', | |
| 373 | + ], | |
| 374 | + $this->get_store_url() | |
| 375 | + ); | |
| 376 | + } | |
| 377 | + | |
| 378 | + /** | |
| 358 | 379 | * Returns product filename. |
| 359 | 380 | * |
| 360 | 381 | * @return string The product filename. |
| 361 | 382 | */ |
| @@ -361,8 +382,9 @@ | ||
| 361 | 382 | */ |
| 362 | 383 | public function get_file() { |
| 363 | 384 | return $this->file; |
| 364 | 385 | } |
| 386 | + | |
| 365 | 387 | /** |
| 366 | 388 | * Returns the pro slug, if available. |
| 367 | 389 | * |
| 368 | 390 | * @return string The pro slug. |
| @@ -377,7 +399,20 @@ | ||
| 377 | 399 | * @return int The install timestamp. |
| 378 | 400 | */ |
| 379 | 401 | public function get_install_time() { |
| 380 | 402 | return $this->install; |
| 403 | + } | |
| 404 | + | |
| 405 | + /** | |
| 406 | + * Returns the URL of the product base file. | |
| 407 | + * | |
| 408 | + * @param string $path The path to the file. | |
| 409 | + * | |
| 410 | + * @return string The URL of the product base file. | |
| 411 | + */ | |
| 412 | + public function get_base_url( $path = '/' ) { | |
| 413 | + if ( $this->type ) { | |
| 414 | + return plugins_url( $path, $this->basefile ); | |
| 415 | + } | |
| 381 | 416 | } |
| 382 | 417 | |
| 383 | 418 | } |