plugin-info
10 years ago
account.php
10 years ago
add-ons.php
10 years ago
admin-notice.php
10 years ago
all-admin-notice.php
10 years ago
checkout.php
10 years ago
connect.php
10 years ago
contact.php
10 years ago
deactivation-feedback-modal.php
10 years ago
debug.php
10 years ago
email.php
10 years ago
firewall-issues-js.php
10 years ago
pending-activation.php
10 years ago
plugin-icon.php
10 years ago
powered-by.php
10 years ago
pricing.php
10 years ago
sticky-admin-notice-js.php
10 years ago
plugin-icon.php
58 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @package Freemius |
| 4 | * @copyright Copyright (c) 2015, Freemius, Inc. |
| 5 | * @license http://opensource.org/licenses/gpl-2.0.php GNU Public License |
| 6 | * @since 1.1.4 |
| 7 | */ |
| 8 | $slug = $VARS['slug']; |
| 9 | $fs = freemius( $slug ); |
| 10 | |
| 11 | $icons = glob( fs_normalize_path( WP_FS__DIR_IMG . '/icon.*' ) ); |
| 12 | if ( ! is_array( $icons ) || 0 === count( $icons ) ) { |
| 13 | $icon_found = false; |
| 14 | $local_path = fs_normalize_path( WP_FS__DIR_IMG . '/icon.png' ); |
| 15 | |
| 16 | if ( WP_FS__IS_LOCALHOST && $fs->is_org_repo_compliant() ) { |
| 17 | /** |
| 18 | * IMPORTANT: THIS CODE WILL NEVER RUN AFTER THE PLUGIN IS IN THE REPO. |
| 19 | * |
| 20 | * This code will only be executed once during the testing |
| 21 | * of the plugin in a local environment. The plugin icon file WILL |
| 22 | * already exist in the assets folder when the plugin is deployed to |
| 23 | * the repository. |
| 24 | */ |
| 25 | $suffixes = array( |
| 26 | '-128x128.png', |
| 27 | '-128x128.jpg', |
| 28 | '-256x256.png', |
| 29 | '-256x256.jpg', |
| 30 | '.svg', |
| 31 | ); |
| 32 | |
| 33 | $base_url = 'https://plugins.svn.wordpress.org/' . $slug . '/assets/icon'; |
| 34 | |
| 35 | foreach ( $suffixes as $s ) { |
| 36 | $headers = get_headers( $base_url . $s ); |
| 37 | if ( strpos( $headers[0], '200' ) ) { |
| 38 | $local_path = fs_normalize_path( WP_FS__DIR_IMG . '/icon.' . substr( $s, strpos( $s, '.' ) + 1 ) ); |
| 39 | fs_download_image( $base_url . $s, $local_path ); |
| 40 | $icon_found = true; |
| 41 | break; |
| 42 | } |
| 43 | } |
| 44 | } |
| 45 | |
| 46 | if ( ! $icon_found ) { |
| 47 | // No icons found, fallback to default icon. |
| 48 | copy( fs_normalize_path( WP_FS__DIR_IMG . '/plugin-icon.png' ), $local_path ); |
| 49 | } |
| 50 | |
| 51 | $icons = array( $local_path ); |
| 52 | } |
| 53 | |
| 54 | $relative_url = fs_img_url( substr( $icons[0], strlen( fs_normalize_path( WP_FS__DIR_IMG ) ) ) ); |
| 55 | ?> |
| 56 | <div class="fs-plugin-icon"> |
| 57 | <img src="<?php echo $relative_url ?>"/> |
| 58 | </div> |