← All changes
|
includes/setup-wizard/class-plugin-integration-helper.php
+22
-1
4.5.2
→
4.5.6
View file →
| @@ -18,9 +18,9 @@ | ||
| 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', |
| @@ -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 |