WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru Самая быстрая Тема-конструктор для WordPress
класс не описан

Automattic\Jetpack\Autoloader\jp02f167abb8e9ed34472e5bd963af3d06

Files_Handler{} WC 1.0

This class selects the package versions for the package files.

Хуков нет.

Возвращает

Null. Ничего.

Использование

$Files_Handler = new Files_Handler();
// use class methods

Методы

  1. __construct( $plugins_handler, $version_selector )
  2. ERROR: no method name found on line ` private $version_selector = null;`
  3. __construct( $plugins_handler, $version_selector )
  4. ERROR: no method name found on line ` private $version_selector = null;`
  5. __construct( $plugins_handler, $version_selector )
  6. ERROR: no method name found on line ` private $version_selector = null;`
  7. create_filemap_path( $plugin_path )
  8. ERROR: no method name found on line ` /**`
  9. create_filemap_path( $plugin_path )
  10. ERROR: no method name found on line ` /**`
  11. create_filemap_path( $plugin_path )
  12. ERROR: no method name found on line ` /**`
  13. enqueue_package_file( $file_identifier, $version, $path )
  14. ERROR: no method name found on line ` /**`
  15. enqueue_package_file( $file_identifier, $version, $path )
  16. ERROR: no method name found on line ` /**`
  17. enqueue_package_file( $file_identifier, $version, $path )
  18. ERROR: no method name found on line ` /**`
  19. file_loader()
  20. ERROR: no method name found on line ` }`
  21. file_loader()
  22. ERROR: no method name found on line ` }`
  23. file_loader()
  24. ERROR: no method name found on line ` }`
  25. set_file_paths()
  26. ERROR: no method name found on line ` */`
  27. set_file_paths()
  28. ERROR: no method name found on line ` */`
  29. set_file_paths()
  30. ERROR: no method name found on line ` */`

Код Files_Handler{} WC 4.6.1

<?php
class Files_Handler {

	/**
	 * The Plugins_Handler object.
	 *
	 * @var Plugins_Handler
	 */
	private $plugins_handler = null;

	/**
	 * The Version_Selector object.
	 *
	 * @var Version_Selector
	 */
	private $version_selector = null;

	/**
	 * The constructor.
	 *
	 * @param Plugins_Handler  $plugins_handler The Plugins_Handler object.
	 * @param Version_Selector $version_selector The Version_Selector object.
	 */
	public function __construct( $plugins_handler, $version_selector ) {
		$this->plugins_handler  = $plugins_handler;
		$this->version_selector = $version_selector;
	}

	/**
	 * Adds the version of a package file to the $jetpack_packages_filemap global
	 * array so that we can load the most recent version.
	 *
	 * @param string $file_identifier Unique id to file assigned by composer based on package name and filename.
	 * @param string $version Version of the file.
	 * @param string $path Absolute path to the file so that we can load it.
	 */
	public function enqueue_package_file( $file_identifier, $version, $path ) {
		global $jetpack_packages_filemap;

		if ( isset( $jetpack_packages_filemap[ $file_identifier ]['version'] ) ) {
			$selected_version = $jetpack_packages_filemap[ $file_identifier ]['version'];
		} else {
			$selected_version = null;
		}

		if ( $this->version_selector->is_version_update_required( $selected_version, $version ) ) {
			$jetpack_packages_filemap[ $file_identifier ] = array(
				'version' => $version,
				'path'    => $path,
			);
		}
	}

	/**
	 * Creates a path to the plugin's filemap. The filemap filename is the filename
	 * generated by Jetpack Autoloader version >= 2.0.
	 *
	 * @param String $plugin_path The plugin path.
	 *
	 * @return String The filemap path
	 */
	public function create_filemap_path( $plugin_path ) {
		return trailingslashit( $plugin_path ) . 'vendor/composer/jetpack_autoload_filemap.php';
	}

	/**
	 *  Initializes the filemap.
	 */
	public function set_file_paths() {
		$active_plugin_paths = $this->plugins_handler->get_all_active_plugins_paths();
		$filemap_paths       = array_map( array( $this, 'create_filemap_path' ), $active_plugin_paths );

		foreach ( $filemap_paths as $path ) {
			if ( is_readable( $path ) ) {
				$file_map = require $path;

				if ( is_array( $file_map ) ) {
					foreach ( $file_map as $file_identifier => $file_data ) {
						$this->enqueue_package_file( $file_identifier, $file_data['version'], $file_data['path'] );
					}
				}
			}
		}
	}

	/**
	 * Include latest version of all enqueued files.
	 */
	public function file_loader() {
		global $jetpack_packages_filemap;
		foreach ( $jetpack_packages_filemap as $file_identifier => $file_data ) {
			if ( empty( $GLOBALS['__composer_autoload_files'][ $file_identifier ] ) ) {
				require_once $file_data['path'];

				$GLOBALS['__composer_autoload_files'][ $file_identifier ] = true;
			}
		}
	}
}