← All changes
|
includes/setup-wizard/class-plugin-integration-helper.php
+34
-13
4.1.10
→
4.5.6
View file →
| @@ -18,15 +18,15 @@ | ||
| 18 | 18 | * |
| 19 | 19 | * @return array Plugin configurations |
| 20 | 20 | */ |
| 21 | 21 | public static function get_predefined_plugins() { |
| 22 | - return [ | |
| 22 | + $plugins = [ | |
| 23 | 23 | 'bdthemes-element-pack-lite' => [ |
| 24 | 24 | 'recommended' => true, |
| 25 | 25 | 'fallback' => [ |
| 26 | 26 | 'name' => 'Element Pack', |
| 27 | 27 | 'description' => 'Build your website with 100+ ready-made blocks and widgets for Elementor.', |
| 28 | - 'logo' => 'https://ps.w.org/bdthemes-element-pack-lite/assets/icon-256x256.png', | |
| 28 | + 'logo' => '', | |
| 29 | 29 | 'rating' => 4.8, |
| 30 | 30 | 'num_ratings' => 1000, |
| 31 | 31 | 'active_installs' => '50,000+' |
| 32 | 32 | ] |
| @@ -35,9 +35,9 @@ | ||
| 35 | 35 | 'recommended' => true, |
| 36 | 36 | 'fallback' => [ |
| 37 | 37 | 'name' => 'Prime Slider', |
| 38 | 38 | 'description' => 'Create eye-catching sliders for your website quickly and easily with 55+ modern Elementor slider widgets.', |
| 39 | - 'logo' => 'https://ps.w.org/bdthemes-prime-slider-lite/assets/icon-256x256.png', | |
| 39 | + 'logo' => '', | |
| 40 | 40 | 'rating' => 4.7, |
| 41 | 41 | 'num_ratings' => 500, |
| 42 | 42 | 'active_installs' => '100,000+' |
| 43 | 43 | ] |
| @@ -46,9 +46,9 @@ | ||
| 46 | 46 | 'recommended' => true, |
| 47 | 47 | 'fallback' => [ |
| 48 | 48 | 'name' => 'Ultimate Post Kit', |
| 49 | 49 | 'description' => 'Design beautiful post layouts with simple, ready-made blocks.', |
| 50 | - 'logo' => 'https://ps.w.org/ultimate-post-kit/assets/icon-256x256.png', | |
| 50 | + 'logo' => '', | |
| 51 | 51 | 'rating' => 4.8, |
| 52 | 52 | 'num_ratings' => 1000, |
| 53 | 53 | 'active_installs' => '50,000+' |
| 54 | 54 | ] |
| @@ -57,9 +57,9 @@ | ||
| 57 | 57 | 'recommended' => false, |
| 58 | 58 | 'fallback' => [ |
| 59 | 59 | 'name' => 'Live Copy Paste', |
| 60 | 60 | 'description' => 'Copy and paste website elements between WordPress sites instantly.', |
| 61 | - 'logo' => 'https://ps.w.org/live-copy-paste/assets/icon-256x256.png', | |
| 61 | + 'logo' => '', | |
| 62 | 62 | 'rating' => 4.9, |
| 63 | 63 | 'num_ratings' => 200, |
| 64 | 64 | 'active_installs' => '10,000+' |
| 65 | 65 | ] |
| @@ -68,9 +68,9 @@ | ||
| 68 | 68 | 'recommended' => true, |
| 69 | 69 | 'fallback' => [ |
| 70 | 70 | 'name' => 'Ultimate Store Kit', |
| 71 | 71 | 'description' => 'Improve your online store with tools to display products better.', |
| 72 | - 'logo' => 'https://ps.w.org/ultimate-store-kit/assets/icon-256x256.png', | |
| 72 | + 'logo' => '', | |
| 73 | 73 | 'rating' => 4.6, |
| 74 | 74 | 'num_ratings' => 300, |
| 75 | 75 | 'active_installs' => '20,000+' |
| 76 | 76 | ] |
| @@ -79,9 +79,9 @@ | ||
| 79 | 79 | // 'recommended' => false, |
| 80 | 80 | // 'fallback' => [ |
| 81 | 81 | // 'name' => 'Pixel Gallery', |
| 82 | 82 | // 'description' => 'Show off your photos in a stylish, responsive gallery.', |
| 83 | - // 'logo' => 'https://ps.w.org/pixel-gallery/assets/icon-256x256.gif', | |
| 83 | + // 'logo' => '', | |
| 84 | 84 | // 'rating' => 4.5, |
| 85 | 85 | // 'num_ratings' => 150, |
| 86 | 86 | // 'active_installs' => '5,000+' |
| 87 | 87 | // ] |
| @@ -90,9 +90,9 @@ | ||
| 90 | 90 | // 'recommended' => false, |
| 91 | 91 | // 'fallback' => [ |
| 92 | 92 | // 'name' => 'ZoloBlocks', |
| 93 | 93 | // 'description' => 'Build amazing WordPress pages with helpful and flexible Gutenberg blocks.', |
| 94 | - // 'logo' => 'https://ps.w.org/zoloblocks/assets/icon-256x256.gif', | |
| 94 | + // 'logo' => '', | |
| 95 | 95 | // 'rating' => 4.3, |
| 96 | 96 | // 'num_ratings' => 100, |
| 97 | 97 | // 'active_installs' => '3,000+' |
| 98 | 98 | // ] |
| @@ -101,9 +101,9 @@ | ||
| 101 | 101 | // 'recommended' => false, |
| 102 | 102 | // 'fallback' => [ |
| 103 | 103 | // 'name' => 'Spin Wheel', |
| 104 | 104 | // 'description' => 'Add a fun, interactive spin wheel to offer instant coupons, boost engagement, and grow your email list.', |
| 105 | - // 'logo' => 'https://ps.w.org/spin-wheel/assets/icon-256x256.gif', | |
| 105 | + // 'logo' => '', | |
| 106 | 106 | // 'rating' => 4.2, |
| 107 | 107 | // 'num_ratings' => 50, |
| 108 | 108 | // 'active_installs' => '1,000+' |
| 109 | 109 | // ] |
| @@ -112,9 +112,9 @@ | ||
| 112 | 112 | // 'recommended' => false, |
| 113 | 113 | // 'fallback' => [ |
| 114 | 114 | // 'name' => 'Instant Image Generator', |
| 115 | 115 | // 'description' => 'Instant Image Generator (One Click Image Uploads from Pixabay, Pexels and OpenAI).', |
| 116 | - // 'logo' => 'https://ps.w.org/ai-image/assets/icon-256x256.gif', | |
| 116 | + // 'logo' => '', | |
| 117 | 117 | // 'rating' => 4.0, |
| 118 | 118 | // 'num_ratings' => 25, |
| 119 | 119 | // 'active_installs' => '500+' |
| 120 | 120 | // ] |
| @@ -123,9 +123,9 @@ | ||
| 123 | 123 | // 'recommended' => false, |
| 124 | 124 | // 'fallback' => [ |
| 125 | 125 | // 'name' => 'Dark Reader', |
| 126 | 126 | // 'description' => 'Add beautiful dark mode to your WordPress site with customizable settings.', |
| 127 | - // 'logo' => 'https://ps.w.org/dark-reader/assets/icon-256x256.gif', | |
| 127 | + // 'logo' => '', | |
| 128 | 128 | // 'rating' => 4.1, |
| 129 | 129 | // 'num_ratings' => 30, |
| 130 | 130 | // 'active_installs' => '800+' |
| 131 | 131 | // ] |
| @@ -134,9 +134,9 @@ | ||
| 134 | 134 | // 'recommended' => false, |
| 135 | 135 | // 'fallback' => [ |
| 136 | 136 | // 'name' => 'AR Viewer', |
| 137 | 137 | // 'description' => 'Augmented Reality Viewer – 3D Model Viewer.', |
| 138 | - // 'logo' => 'https://ps.w.org/ar-viewer/assets/icon-256x256.gif', | |
| 138 | + // 'logo' => '', | |
| 139 | 139 | // 'rating' => 3.9, |
| 140 | 140 | // 'num_ratings' => 15, |
| 141 | 141 | // 'active_installs' => '200+' |
| 142 | 142 | // ] |
| @@ -141,8 +141,29 @@ | ||
| 141 | 141 | // 'active_installs' => '200+' |
| 142 | 142 | // ] |
| 143 | 143 | // ] |
| 144 | 144 | ]; |
| 145 | + | |
| 146 | + // Point every fallback at the logo bundled with this plugin. These entries are | |
| 147 | + // what render when the wordpress.org data is unavailable, so without this the | |
| 148 | + // cards would fall back to a placeholder instead of the real branding. Keys may | |
| 149 | + // be either a bare slug or "slug/file.php", so normalise to the directory first. | |
| 150 | + if ( class_exists( __NAMESPACE__ . '\\Remote_Data_Handler' ) ) { | |
| 151 | + foreach ( $plugins as $key => $config ) { | |
| 152 | + if ( ! empty( $config['fallback']['logo'] ) ) { | |
| 153 | + continue; | |
| 154 | + } | |
| 155 | + | |
| 156 | + $slug = ( false !== strpos( $key, '/' ) ) ? dirname( $key ) : $key; | |
| 157 | + $logo = Remote_Data_Handler::get_local_plugin_logo( $slug ); | |
| 158 | + | |
| 159 | + if ( '' !== $logo ) { | |
| 160 | + $plugins[ $key ]['fallback']['logo'] = $logo; | |
| 161 | + } | |
| 162 | + } | |
| 163 | + } | |
| 164 | + | |
| 165 | + return $plugins; | |
| 145 | 166 | } |
| 146 | 167 | |
| 147 | 168 | /** |
| 148 | 169 | * Build plugin data array with API data and fallbacks |
| @@ -262,9 +283,9 @@ | ||
| 262 | 283 | $predefined = self::get_predefined_plugins(); |
| 263 | 284 | $predefined[$slug] = $config; |
| 264 | 285 | |
| 265 | 286 | // In a real implementation, you'd save this to options |
| 266 | - // update_option('upk_predefined_plugins', $predefined); | |
| 287 | + // update_option('ultimate_post_kit_predefined_plugins', $predefined); | |
| 267 | 288 | } |
| 268 | 289 | |
| 269 | 290 | /** |
| 270 | 291 | * Check if a plugin is installed and active |