mirror of
https://github.com/WordPress/WordPress.git
synced 2024-11-02 16:59:35 +01:00
abcbee954f
Noteable changes: - The `magic_quotes_runtime` and `magic_quotes_sybase` settings were removed in PHP 5.4, so no longer need to be set. - Some functions that use external libraries can generate errors that can't be tested for, so are globally allowed to silence errors. - Quite a few functions would cause errors if `safe_mode` was set. This setting was removed in PHP 5.4. - Only a handful of `header()` calls needed corresponding `headers_sent()` checks for unit tests to pass, but more may need to be added as the nightlies builds are tested. See #46732. Built from https://develop.svn.wordpress.org/trunk@45611 git-svn-id: http://core.svn.wordpress.org/trunk@45422 1a063a9b-81f0-0310-95a4-ce76da25c4cd
134 lines
2.3 KiB
PHP
134 lines
2.3 KiB
PHP
<?php
|
|
/**
|
|
* Dependencies API: _WP_Dependency class
|
|
*
|
|
* @since 4.7.0
|
|
*
|
|
* @package WordPress
|
|
* @subpackage Dependencies
|
|
*/
|
|
|
|
/**
|
|
* Class _WP_Dependency
|
|
*
|
|
* Helper class to register a handle and associated data.
|
|
*
|
|
* @access private
|
|
* @since 2.6.0
|
|
*/
|
|
class _WP_Dependency {
|
|
/**
|
|
* The handle name.
|
|
*
|
|
* @since 2.6.0
|
|
* @var null
|
|
*/
|
|
public $handle;
|
|
|
|
/**
|
|
* The handle source.
|
|
*
|
|
* @since 2.6.0
|
|
* @var null
|
|
*/
|
|
public $src;
|
|
|
|
/**
|
|
* An array of handle dependencies.
|
|
*
|
|
* @since 2.6.0
|
|
* @var array
|
|
*/
|
|
public $deps = array();
|
|
|
|
/**
|
|
* The handle version.
|
|
*
|
|
* Used for cache-busting.
|
|
*
|
|
* @since 2.6.0
|
|
* @var bool|string
|
|
*/
|
|
public $ver = false;
|
|
|
|
/**
|
|
* Additional arguments for the handle.
|
|
*
|
|
* @since 2.6.0
|
|
* @var null
|
|
*/
|
|
public $args = null; // Custom property, such as $in_footer or $media.
|
|
|
|
/**
|
|
* Extra data to supply to the handle.
|
|
*
|
|
* @since 2.6.0
|
|
* @var array
|
|
*/
|
|
public $extra = array();
|
|
|
|
/**
|
|
* Translation textdomain set for this dependency.
|
|
*
|
|
* @since 5.0.0
|
|
* @var string
|
|
*/
|
|
public $textdomain;
|
|
|
|
/**
|
|
* Translation path set for this dependency.
|
|
*
|
|
* @since 5.0.0
|
|
* @var string
|
|
*/
|
|
public $translations_path;
|
|
|
|
/**
|
|
* Setup dependencies.
|
|
*
|
|
* @since 2.6.0
|
|
*/
|
|
public function __construct() {
|
|
list( $this->handle, $this->src, $this->deps, $this->ver, $this->args ) = func_get_args();
|
|
if ( ! is_array( $this->deps ) ) {
|
|
$this->deps = array();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Add handle data.
|
|
*
|
|
* @since 2.6.0
|
|
*
|
|
* @param string $name The data key to add.
|
|
* @param mixed $data The data value to add.
|
|
* @return bool False if not scalar, true otherwise.
|
|
*/
|
|
public function add_data( $name, $data ) {
|
|
if ( ! is_scalar( $name ) ) {
|
|
return false;
|
|
}
|
|
$this->extra[ $name ] = $data;
|
|
return true;
|
|
}
|
|
|
|
/**
|
|
* Sets the translation domain for this dependency.
|
|
*
|
|
* @since 5.0.0
|
|
*
|
|
* @param string $domain The translation textdomain.
|
|
* @param string $path Optional. The full file path to the directory containing translation files.
|
|
*
|
|
* @return bool False if $domain is not a string, true otherwise.
|
|
*/
|
|
public function set_translations( $domain, $path = null ) {
|
|
if ( ! is_string( $domain ) ) {
|
|
return false;
|
|
}
|
|
$this->textdomain = $domain;
|
|
$this->translations_path = $path;
|
|
return true;
|
|
}
|
|
}
|