PluginProbe
Elementor Website Builder – more than just a page builder / 4.3.2
Elementor Website Builder – more than just a page builder v4.3.2
4.3.2 4.3.1 4.3.0 4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 4.1.0-dev2 All 455 releases
elementor / vendor / jetpack-autoloader / class-manifest-reader.php

class-manifest-reader.php in Elementor Website Builder – more than just a page builder 4.3.2, at vendor/jetpack-autoloader/class-manifest-reader.php

100 lines 2.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * This file was automatically generated by automattic/jetpack-autoloader.
4 *
5 * @package automattic/jetpack-autoloader
6 */
7
8 namespace Automattic\Jetpack\Autoloader\jpcaa4a5ea48fb26243757d5e89e99a04e\al5_0_23;
9
10 // phpcs:ignore
11
12 /**
13 * This class reads autoloader manifest files.
14 */
15 class Manifest_Reader {
16
17 /**
18 * The Version_Selector object.
19 *
20 * @var Version_Selector
21 */
22 private $version_selector;
23
24 /**
25 * The constructor.
26 *
27 * @param Version_Selector $version_selector The Version_Selector object.
28 */
29 public function __construct( $version_selector ) {
30 $this->version_selector = $version_selector;
31 }
32
33 /**
34 * Reads all of the manifests in the given plugin paths.
35 *
36 * @param array $plugin_paths The paths to the plugins we're loading the manifest in.
37 * @param string $manifest_path The path that we're loading the manifest from in each plugin.
38 * @param array $path_map The path map to add the contents of the manifests to.
39 *
40 * @return array $path_map The path map we've built using the manifests in each plugin.
41 */
42 public function read_manifests( $plugin_paths, $manifest_path, &$path_map ) {
43 $file_paths = array_map(
44 function ( $path ) use ( $manifest_path ) {
45 return trailingslashit( $path ) . $manifest_path;
46 },
47 $plugin_paths
48 );
49
50 foreach ( $file_paths as $path ) {
51 $this->register_manifest( $path, $path_map );
52 }
53
54 return $path_map;
55 }
56
57 /**
58 * Registers a plugin's manifest file with the path map.
59 *
60 * @param string $manifest_path The absolute path to the manifest that we're loading.
61 * @param array $path_map The path map to add the contents of the manifest to.
62 */
63 protected function register_manifest( $manifest_path, &$path_map ) {
64 if ( ! is_readable( $manifest_path ) ) {
65 return;
66 }
67
68 $manifest = require $manifest_path;
69 if ( ! is_array( $manifest ) ) {
70 return;
71 }
72
73 foreach ( $manifest as $key => $data ) {
74 $this->register_record( $key, $data, $path_map );
75 }
76 }
77
78 /**
79 * Registers an entry from the manifest in the path map.
80 *
81 * @param string $key The identifier for the entry we're registering.
82 * @param array $data The data for the entry we're registering.
83 * @param array $path_map The path map to add the contents of the manifest to.
84 */
85 protected function register_record( $key, $data, &$path_map ) {
86 if ( isset( $path_map[ $key ]['version'] ) ) {
87 $selected_version = $path_map[ $key ]['version'];
88 } else {
89 $selected_version = null;
90 }
91
92 if ( $this->version_selector->is_version_update_required( $selected_version, $data['version'] ) ) {
93 $path_map[ $key ] = array(
94 'version' => $data['version'],
95 'path' => $data['path'],
96 );
97 }
98 }
99 }
100