PluginProbe ʕ •ᴥ•ʔ
Image Widget / 4.2
Image Widget v4.2
trunk 1.0 2.0 2.1 2.2 2.2.1 2.2.2 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 3.2 3.2.1 3.2.10 3.2.11 3.2.2 3.2.3 3.2.4 3.2.5 3.2.7 3.2.8 3.2.9 3.3 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 4.0 4.0.1 4.0.2 4.0.3 4.0.4 4.0.5 4.0.6 4.0.7 4.0.8 4.0.9 4.1 4.1.1 4.1.2 4.2 4.2.1 4.2.2 4.3 4.3.1 4.4 4.4.1 4.4.11 4.4.12 4.4.2 4.4.3 4.4.4 4.4.5 4.4.6 4.4.7 4.4.8 4.4.9
image-widget / freemius / templates / plugin-icon.php
image-widget / freemius / templates Last commit date
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>