WC_REST_System_Status_V2_Controller::format_plugin_data()
Format plugin data, including data on updates, into a standard format.
Метод класса: WC_REST_System_Status_V2_Controller{}
Хуков нет.
Возвращает
Массив
. Formatted data.
Использование
// protected - в коде основоного (родительского) или дочернего класса $result = $this->format_plugin_data( $plugin, $data );
- $plugin(строка) (обязательный)
- Plugin directory/file.
- $data(массив) (обязательный)
- Plugin data from WP.
Список изменений
С версии 3.6.0 | Введена. |
Код WC_REST_System_Status_V2_Controller::format_plugin_data() WC REST System Status V2 Controller::format plugin data WC 7.5.1
protected function format_plugin_data( $plugin, $data ) { require_once ABSPATH . 'wp-admin/includes/update.php'; if ( ! function_exists( 'get_plugin_updates' ) ) { return array(); } // Use WP API to lookup latest updates for plugins. WC_Helper injects updates for premium plugins. if ( empty( $this->available_updates ) ) { $this->available_updates = get_plugin_updates(); } $version_latest = $data['Version']; // Find latest version. if ( isset( $this->available_updates[ $plugin ]->update->new_version ) ) { $version_latest = $this->available_updates[ $plugin ]->update->new_version; } return array( 'plugin' => $plugin, 'name' => $data['Name'], 'version' => $data['Version'], 'version_latest' => $version_latest, 'url' => $data['PluginURI'], 'author_name' => $data['AuthorName'], 'author_url' => esc_url_raw( $data['AuthorURI'] ), 'network_activated' => $data['Network'], ); }