| @@ 75-99 (lines=25) @@ | ||
| 72 | /** |
|
| 73 | * Initializes the classmap. |
|
| 74 | */ |
|
| 75 | public function set_class_paths() { |
|
| 76 | $active_plugins = $this->plugins_handler->get_all_active_plugins(); |
|
| 77 | $plugins_paths = array_map( array( $this, 'create_classmap_path_array' ), $active_plugins ); |
|
| 78 | ||
| 79 | if ( empty( $plugins_paths ) ) { |
|
| 80 | // There may have been a problem generating the plugin paths. |
|
| 81 | // Try to add this directory's classmap as a last resort. |
|
| 82 | $classmap_path = trailingslashit( dirname( __FILE__ ) ) . 'composer/jetpack_autoload_classmap.php'; |
|
| 83 | if ( is_readable( $classmap_path ) ) { |
|
| 84 | $plugins_paths = array( $classmap_path ); |
|
| 85 | } |
|
| 86 | } |
|
| 87 | ||
| 88 | foreach ( $plugins_paths as $path ) { |
|
| 89 | if ( is_readable( $path ) ) { |
|
| 90 | $class_map = require $path; |
|
| 91 | ||
| 92 | if ( is_array( $class_map ) ) { |
|
| 93 | foreach ( $class_map as $class_name => $class_info ) { |
|
| 94 | $this->enqueue_package_class( $class_name, $class_info['version'], $class_info['path'] ); |
|
| 95 | } |
|
| 96 | } |
|
| 97 | } |
|
| 98 | } |
|
| 99 | } |
|
| 100 | } |
|
| 101 | ||
| @@ 75-99 (lines=25) @@ | ||
| 72 | /** |
|
| 73 | * Initializes the filemap. |
|
| 74 | */ |
|
| 75 | public function set_file_paths() { |
|
| 76 | $active_plugins = $this->plugins_handler->get_all_active_plugins(); |
|
| 77 | $plugins_paths = array_map( array( $this, 'create_filemap_path_array' ), $active_plugins ); |
|
| 78 | ||
| 79 | if ( empty( $plugins_paths ) ) { |
|
| 80 | // There may have been a problem generating the plugin paths. |
|
| 81 | // Try to add this directory's filemap as a last resort. |
|
| 82 | $filemap_path = trailingslashit( dirname( __FILE__ ) ) . 'composer/jetpack_autoload_filemap.php'; |
|
| 83 | if ( is_readable( $filemap_path ) ) { |
|
| 84 | $plugins_paths = array( $filemap_path ); |
|
| 85 | } |
|
| 86 | } |
|
| 87 | ||
| 88 | foreach ( $plugins_paths as $path ) { |
|
| 89 | if ( is_readable( $path ) ) { |
|
| 90 | $file_map = require $path; |
|
| 91 | ||
| 92 | if ( is_array( $file_map ) ) { |
|
| 93 | foreach ( $file_map as $file_identifier => $file_data ) { |
|
| 94 | $this->enqueue_package_file( $file_identifier, $file_data['version'], $file_data['path'] ); |
|
| 95 | } |
|
| 96 | } |
|
| 97 | } |
|
| 98 | } |
|
| 99 | } |
|
| 100 | ||
| 101 | /** |
|
| 102 | * Include latest version of all enqueued files. |
|