class-autoloader-handler.php
1 day ago
class-autoloader-locator.php
1 day ago
class-autoloader.php
1 day ago
class-container.php
1 day ago
class-hook-manager.php
1 day ago
class-latest-autoloader-guard.php
1 day ago
class-manifest-reader.php
1 day ago
class-path-processor.php
1 day ago
class-php-autoloader.php
1 day ago
class-plugin-locator.php
1 day ago
class-plugins-handler.php
1 day ago
class-shutdown-handler.php
1 day ago
class-version-loader.php
1 day ago
class-version-selector.php
1 day ago
index.php
11 months ago
class-manifest-reader.php
48 lines
| 1 | <?php |
| 2 | namespace Automattic\Jetpack\Autoloader\jp872900f5b87449668837c6f68e6176ac\al5_0_8; |
| 3 | if (!defined('ABSPATH')) exit; |
| 4 | // phpcs:ignore |
| 5 | class Manifest_Reader { |
| 6 | private $version_selector; |
| 7 | public function __construct( $version_selector ) { |
| 8 | $this->version_selector = $version_selector; |
| 9 | } |
| 10 | public function read_manifests( $plugin_paths, $manifest_path, &$path_map ) { |
| 11 | $file_paths = array_map( |
| 12 | function ( $path ) use ( $manifest_path ) { |
| 13 | return trailingslashit( $path ) . $manifest_path; |
| 14 | }, |
| 15 | $plugin_paths |
| 16 | ); |
| 17 | foreach ( $file_paths as $path ) { |
| 18 | $this->register_manifest( $path, $path_map ); |
| 19 | } |
| 20 | return $path_map; |
| 21 | } |
| 22 | protected function register_manifest( $manifest_path, &$path_map ) { |
| 23 | if ( ! is_readable( $manifest_path ) ) { |
| 24 | return; |
| 25 | } |
| 26 | $manifest = require $manifest_path; |
| 27 | if ( ! is_array( $manifest ) ) { |
| 28 | return; |
| 29 | } |
| 30 | foreach ( $manifest as $key => $data ) { |
| 31 | $this->register_record( $key, $data, $path_map ); |
| 32 | } |
| 33 | } |
| 34 | protected function register_record( $key, $data, &$path_map ) { |
| 35 | if ( isset( $path_map[ $key ]['version'] ) ) { |
| 36 | $selected_version = $path_map[ $key ]['version']; |
| 37 | } else { |
| 38 | $selected_version = null; |
| 39 | } |
| 40 | if ( $this->version_selector->is_version_update_required( $selected_version, $data['version'] ) ) { |
| 41 | $path_map[ $key ] = array( |
| 42 | 'version' => $data['version'], |
| 43 | 'path' => $data['path'], |
| 44 | ); |
| 45 | } |
| 46 | } |
| 47 | } |
| 48 |