equal
deleted
inserted
replaced
66 * @var array |
66 * @var array |
67 */ |
67 */ |
68 public $extra = array(); |
68 public $extra = array(); |
69 |
69 |
70 /** |
70 /** |
|
71 * Translation textdomain set for this dependency. |
|
72 * |
|
73 * @since 5.0.0 |
|
74 * @var string |
|
75 */ |
|
76 public $textdomain; |
|
77 |
|
78 /** |
|
79 * Translation path set for this dependency. |
|
80 * |
|
81 * @since 5.0.0 |
|
82 * @var string |
|
83 */ |
|
84 public $translations_path; |
|
85 |
|
86 /** |
71 * Setup dependencies. |
87 * Setup dependencies. |
72 * |
88 * |
73 * @since 2.6.0 |
89 * @since 2.6.0 |
74 */ |
90 */ |
75 public function __construct() { |
91 public function __construct() { |
76 @list( $this->handle, $this->src, $this->deps, $this->ver, $this->args ) = func_get_args(); |
92 @list( $this->handle, $this->src, $this->deps, $this->ver, $this->args ) = func_get_args(); |
77 if ( ! is_array($this->deps) ) |
93 if ( ! is_array( $this->deps ) ) { |
78 $this->deps = array(); |
94 $this->deps = array(); |
|
95 } |
79 } |
96 } |
80 |
97 |
81 /** |
98 /** |
82 * Add handle data. |
99 * Add handle data. |
83 * |
100 * |
86 * @param string $name The data key to add. |
103 * @param string $name The data key to add. |
87 * @param mixed $data The data value to add. |
104 * @param mixed $data The data value to add. |
88 * @return bool False if not scalar, true otherwise. |
105 * @return bool False if not scalar, true otherwise. |
89 */ |
106 */ |
90 public function add_data( $name, $data ) { |
107 public function add_data( $name, $data ) { |
91 if ( !is_scalar($name) ) |
108 if ( ! is_scalar( $name ) ) { |
92 return false; |
109 return false; |
93 $this->extra[$name] = $data; |
110 } |
|
111 $this->extra[ $name ] = $data; |
94 return true; |
112 return true; |
95 } |
113 } |
96 |
114 |
|
115 /** |
|
116 * Sets the translation domain for this dependency. |
|
117 * |
|
118 * @since 5.0.0 |
|
119 * |
|
120 * @param string $domain The translation textdomain. |
|
121 * @param string $path Optional. The full file path to the directory containing translation files. |
|
122 * |
|
123 * @return bool False if $domain is not a string, true otherwise. |
|
124 */ |
|
125 public function set_translations( $domain, $path = null ) { |
|
126 if ( ! is_string( $domain ) ) { |
|
127 return false; |
|
128 } |
|
129 $this->textdomain = $domain; |
|
130 $this->translations_path = $path; |
|
131 return true; |
|
132 } |
97 } |
133 } |