| Conditions | 2 |
| Paths | 2 |
| Total Lines | 22 |
| Code Lines | 15 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | <?php |
||
| 21 | public function expand_plugin_data( $args ) { |
||
| 22 | $plugin_path = $args[0]; |
||
| 23 | $plugin_data = array(); |
||
| 24 | |||
| 25 | //Try to get plugin data from cache (if it isn't cached, get_plugins() tries to get it from disk) |
||
| 26 | $all_plugins = get_plugins(); |
||
| 27 | if ( isset( $all_plugins[$plugin_path] ) ) { |
||
| 28 | $all_plugin_data = $all_plugins[$plugin_path]; |
||
| 29 | $plugin_data['Name'] = $all_plugin_data['Name']; |
||
| 30 | $plugin_data['Version'] = $all_plugin_data['Version']; |
||
| 31 | } else { |
||
| 32 | $slug = Jetpack_Autoupdate::get_plugin_slug( $plugin_path ); |
||
| 33 | $plugin_data = plugins_api( 'plugin_information', array( 'slug' => $slug ) ); |
||
| 34 | } |
||
| 35 | |||
| 36 | |||
| 37 | return array( |
||
| 38 | $args[0], |
||
| 39 | $args[1], |
||
| 40 | $plugin_data, |
||
| 41 | ); |
||
| 42 | } |
||
| 43 | } |
||
| 44 |