mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-01 19:24:34 +00:00
Docs: Improve documentation for WP_Dependencies, WP_Scripts, and WP_Styles methods.
See #48303. git-svn-id: https://develop.svn.wordpress.org/trunk@47170 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -175,10 +175,11 @@ class WP_Scripts extends WP_Dependencies {
|
||||
* @since 2.1.0
|
||||
* @since 2.8.0 Added the `$group` parameter.
|
||||
*
|
||||
* @param mixed $handles Optional. Scripts to be printed. (void) prints queue, (string) prints
|
||||
* that script, (array of strings) prints those scripts. Default false.
|
||||
* @param int|false $group Optional. If scripts were queued in groups prints this group number.
|
||||
* Default false.
|
||||
* @param string|string[]|false $handles Optional. Scripts to be printed: queue (false),
|
||||
* single script (string), or multiple scripts (array of strings).
|
||||
* Default false.
|
||||
* @param int|false $group Optional. Group level: level (int), no groups (false).
|
||||
* Default false.
|
||||
* @return string[] Handles of scripts that have been printed.
|
||||
*/
|
||||
public function print_scripts( $handles = false, $group = false ) {
|
||||
@@ -195,9 +196,10 @@ class WP_Scripts extends WP_Dependencies {
|
||||
* @see print_extra_script()
|
||||
*
|
||||
* @param string $handle The script's registered handle.
|
||||
* @param bool $echo Optional. Whether to echo the extra script instead of just returning it.
|
||||
* Default true.
|
||||
* @return bool|string|void Void if no data exists, extra scripts if `$echo` is true, true otherwise.
|
||||
* @param bool $echo Optional. Whether to echo the extra script
|
||||
* instead of just returning it. Default true.
|
||||
* @return bool|string|void Void if no data exists, extra scripts if `$echo` is true,
|
||||
* true otherwise.
|
||||
*/
|
||||
public function print_scripts_l10n( $handle, $echo = true ) {
|
||||
_deprecated_function( __FUNCTION__, '3.3.0', 'WP_Scripts::print_extra_script()' );
|
||||
@@ -210,9 +212,10 @@ class WP_Scripts extends WP_Dependencies {
|
||||
* @since 3.3.0
|
||||
*
|
||||
* @param string $handle The script's registered handle.
|
||||
* @param bool $echo Optional. Whether to echo the extra script instead of just returning it.
|
||||
* Default true.
|
||||
* @return bool|string|void Void if no data exists, extra scripts if `$echo` is true, true otherwise.
|
||||
* @param bool $echo Optional. Whether to echo the extra script
|
||||
* instead of just returning it. Default true.
|
||||
* @return bool|string|void Void if no data exists, extra scripts if `$echo` is true,
|
||||
* true otherwise.
|
||||
*/
|
||||
public function print_extra_script( $handle, $echo = true ) {
|
||||
$output = $this->get_data( $handle, 'data' );
|
||||
@@ -251,7 +254,8 @@ class WP_Scripts extends WP_Dependencies {
|
||||
* @see WP_Dependencies::do_item()
|
||||
*
|
||||
* @param string $handle The script's registered handle.
|
||||
* @param int|false $group Optional. Group level: (int) level, (false) no groups. Default false.
|
||||
* @param int|false $group Optional. Group level: level (int), no groups (false).
|
||||
* Default false.
|
||||
* @return bool True on success, false on failure.
|
||||
*/
|
||||
public function do_item( $handle, $group = false ) {
|
||||
@@ -409,10 +413,11 @@ class WP_Scripts extends WP_Dependencies {
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @param string $handle Name of the script to add the inline script to. Must be lowercase.
|
||||
* @param string $handle Name of the script to add the inline script to.
|
||||
* Must be lowercase.
|
||||
* @param string $data String containing the javascript to be added.
|
||||
* @param string $position Optional. Whether to add the inline script before the handle
|
||||
* or after. Default 'after'.
|
||||
* @param string $position Optional. Whether to add the inline script
|
||||
* before the handle or after. Default 'after'.
|
||||
* @return bool True on success, false on failure.
|
||||
*/
|
||||
public function add_inline_script( $handle, $data, $position = 'after' ) {
|
||||
@@ -435,11 +440,12 @@ class WP_Scripts extends WP_Dependencies {
|
||||
*
|
||||
* @since 4.5.0
|
||||
*
|
||||
* @param string $handle Name of the script to add the inline script to. Must be lowercase.
|
||||
* @param string $position Optional. Whether to add the inline script before the handle
|
||||
* or after. Default 'after'.
|
||||
* @param bool $echo Optional. Whether to echo the script instead of just returning it.
|
||||
* Default true.
|
||||
* @param string $handle Name of the script to add the inline script to.
|
||||
* Must be lowercase.
|
||||
* @param string $position Optional. Whether to add the inline script
|
||||
* before the handle or after. Default 'after'.
|
||||
* @param bool $echo Optional. Whether to echo the script
|
||||
* instead of just returning it. Default true.
|
||||
* @return string|false Script on success, false otherwise.
|
||||
*/
|
||||
public function print_inline_script( $handle, $position = 'after', $echo = true ) {
|
||||
@@ -510,8 +516,9 @@ class WP_Scripts extends WP_Dependencies {
|
||||
*
|
||||
* @param string $handle Name of the item. Should be unique.
|
||||
* @param bool $recursion Internal flag that calling function was called recursively.
|
||||
* @param int|false $group Optional. Group level: (int) level, (false) no groups. Default false.
|
||||
* @return bool Not already in the group or a lower group
|
||||
* @param int|false $group Optional. Group level: level (int), no groups (false).
|
||||
* Default false.
|
||||
* @return bool Not already in the group or a lower group.
|
||||
*/
|
||||
public function set_group( $handle, $recursion, $group = false ) {
|
||||
if ( isset( $this->registered[ $handle ]->args ) && $this->registered[ $handle ]->args === 1 ) {
|
||||
@@ -558,9 +565,10 @@ class WP_Scripts extends WP_Dependencies {
|
||||
*
|
||||
* @since 5.0.0
|
||||
*
|
||||
* @param string $handle Name of the script to add the inline script to. Must be lowercase.
|
||||
* @param bool $echo Optional. Whether to echo the script instead of just returning it.
|
||||
* Default true.
|
||||
* @param string $handle Name of the script to add the inline script to.
|
||||
* Must be lowercase.
|
||||
* @param bool $echo Optional. Whether to echo the script
|
||||
* instead of just returning it. Default true.
|
||||
* @return string|false Script on success, false otherwise.
|
||||
*/
|
||||
public function print_translations( $handle, $echo = true ) {
|
||||
@@ -600,9 +608,11 @@ JS;
|
||||
*
|
||||
* @see WP_Dependencies::all_deps()
|
||||
*
|
||||
* @param mixed $handles Item handle and argument (string) or item handles and arguments (array of strings).
|
||||
* @param bool $recursion Internal flag that function is calling itself.
|
||||
* @param int|false $group Optional. Group level: (int) level, (false) no groups. Default false.
|
||||
* @param string|string[] $handles Item handle (string) or item handles (array of strings).
|
||||
* @param bool $recursion Optional. Internal flag that function is calling itself.
|
||||
* Default false.
|
||||
* @param int|false $group Optional. Group level: level (int), no groups (false).
|
||||
* Default false.
|
||||
* @return bool True on success, false on failure.
|
||||
*/
|
||||
public function all_deps( $handles, $recursion = false, $group = false ) {
|
||||
|
||||
Reference in New Issue
Block a user