当前位置: 首页>>代码示例>>PHP>>正文


PHP WP_Scripts::do_items方法代码示例

本文整理汇总了PHP中WP_Scripts::do_items方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_Scripts::do_items方法的具体用法?PHP WP_Scripts::do_items怎么用?PHP WP_Scripts::do_items使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在WP_Scripts的用法示例。


在下文中一共展示了WP_Scripts::do_items方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: wp_print_scripts

/**
 * Print scripts in document head that are in the $handles queue.
 *
 * Called by admin-header.php and wp_head hook. Since it is called by wp_head on every page load,
 * the function does not instantiate the WP_Scripts object unless script names are explicitly passed.
 * Makes use of already-instantiated $wp_scripts global if present. Use provided wp_print_scripts
 * hook to register/enqueue new scripts.
 *
 * @see WP_Scripts::do_items()
 * @global WP_Scripts $wp_scripts The WP_Scripts object for printing scripts.
 *
 * @since 2.6.0
 *
 * @param string|bool|array $handles Optional. Scripts to be printed. Default 'false'.
 * @return array On success, a processed array of WP_Dependencies items; otherwise, an empty array.
 */
function wp_print_scripts($handles = false)
{
    /**
     * Fires before scripts in the $handles queue are printed.
     *
     * @since 2.1.0
     */
    do_action('wp_print_scripts');
    if ('' === $handles) {
        // for wp_head
        $handles = false;
    }
    global $wp_scripts;
    if (!is_a($wp_scripts, 'WP_Scripts')) {
        if (!did_action('init')) {
            _doing_it_wrong(__FUNCTION__, sprintf(__('Scripts and styles should not be registered or enqueued until the %1$s, %2$s, or %3$s hooks.'), '<code>wp_enqueue_scripts</code>', '<code>admin_enqueue_scripts</code>', '<code>login_enqueue_scripts</code>'), '3.3');
        }
        if (!$handles) {
            return array();
        } else {
            $wp_scripts = new WP_Scripts();
        }
    }
    return $wp_scripts->do_items($handles);
}
开发者ID:hachi4,项目名称:WordPress,代码行数:41,代码来源:functions.wp-scripts.php

示例2:

 static function do_scripts($handles)
 {
     global $wp_scripts;
     if (!is_a($wp_scripts, 'WP_Scripts')) {
         $wp_scripts = new WP_Scripts();
     }
     $wp_scripts->do_items((array) $handles);
 }
开发者ID:rarescosma,项目名称:wp-ric,代码行数:8,代码来源:Util.php

示例3: wp_print_scripts

/**
 * Prints script tags in document head.
 *
 * Called by admin-header.php and by wp_head hook. Since it is called by wp_head
 * on every page load, the function does not instantiate the WP_Scripts object
 * unless script names are explicitly passed. Does make use of already
 * instantiated $wp_scripts if present. Use provided wp_print_scripts hook to
 * register/enqueue new scripts.
 *
 * @since r16
 * @see WP_Dependencies::print_scripts()
 */
function wp_print_scripts($handles = false)
{
    do_action('wp_print_scripts');
    if ('' === $handles) {
        // for wp_head
        $handles = false;
    }
    global $wp_scripts;
    if (!is_a($wp_scripts, 'WP_Scripts')) {
        if (!$handles) {
            return array();
        } else {
            $wp_scripts = new WP_Scripts();
        }
    }
    return $wp_scripts->do_items($handles);
}
开发者ID:fka2004,项目名称:webkit,代码行数:29,代码来源:functions.wp-scripts.php

示例4: test_group_mismatch_in_deps

 /**
  * Test mismatch of groups in dependencies outputs all scripts in right order.
  *
  * @ticket 35873
  */
 public function test_group_mismatch_in_deps()
 {
     $scripts = new WP_Scripts();
     $scripts->add('one', 'one', array(), 'v1', 1);
     $scripts->add('two', 'two', array('one'));
     $scripts->add('three', 'three', array('two'), 'v1', 1);
     $scripts->enqueue(array('three'));
     $this->expectOutputRegex('/^(?:<script[^>]+><\\/script>\\n){7}$/');
     $scripts->do_items(false, 0);
     $this->assertContains('one', $scripts->done);
     $this->assertContains('two', $scripts->done);
     $this->assertNotContains('three', $scripts->done);
     $scripts->do_items(false, 1);
     $this->assertContains('one', $scripts->done);
     $this->assertContains('two', $scripts->done);
     $this->assertContains('three', $scripts->done);
     $scripts = new WP_Scripts();
     $scripts->add('one', 'one', array(), 'v1', 1);
     $scripts->add('two', 'two', array('one'), 'v1', 1);
     $scripts->add('three', 'three', array('one'));
     $scripts->add('four', 'four', array('two', 'three'), 'v1', 1);
     $scripts->enqueue(array('four'));
     $scripts->do_items(false, 0);
     $this->assertContains('one', $scripts->done);
     $this->assertNotContains('two', $scripts->done);
     $this->assertContains('three', $scripts->done);
     $this->assertNotContains('four', $scripts->done);
     $scripts->do_items(false, 1);
     $this->assertContains('one', $scripts->done);
     $this->assertContains('two', $scripts->done);
     $this->assertContains('three', $scripts->done);
     $this->assertContains('four', $scripts->done);
 }
开发者ID:jaspermdegroot,项目名称:develop.wordpress,代码行数:38,代码来源:scripts.php

示例5: print_head_scripts

/**
 * Prints the script queue in the HTML head on admin pages.
 *
 * Postpones the scripts that were queued for the footer.
 * print_footer_scripts() is called in the footer to print these scripts.
 *
 * @since 2.8
 * @see wp_print_scripts()
 */
function print_head_scripts()
{
    global $wp_scripts, $concatenate_scripts;
    if (!did_action('wp_print_scripts')) {
        do_action('wp_print_scripts');
    }
    if (!is_a($wp_scripts, 'WP_Scripts')) {
        $wp_scripts = new WP_Scripts();
    }
    script_concat_settings();
    $wp_scripts->do_items('l10n');
    $wp_scripts->do_concat = $concatenate_scripts;
    $wp_scripts->do_head_items();
    if (apply_filters('print_head_scripts', true)) {
        _print_scripts();
    }
    $wp_scripts->reset();
    return $wp_scripts->done;
}
开发者ID:Esleelkartea,项目名称:herramienta_para_autodiagnostico_ADEADA,代码行数:28,代码来源:script-loader.php

示例6: array

 /**
  * Test placing of jQuery in footer.
  *
  * @ticket 25247
  */
 function test_jquery_in_footer()
 {
     $scripts = new WP_Scripts();
     $scripts->add('jquery', false, array('jquery-core', 'jquery-migrate'));
     $scripts->add('jquery-core', '/jquery.js', array());
     $scripts->add('jquery-migrate', '/jquery-migrate.js', array());
     $scripts->enqueue('jquery');
     $jquery = $scripts->query('jquery');
     $jquery->add_data('group', 1);
     foreach ($jquery->deps as $dep) {
         $scripts->add_data($dep, 'group', 1);
     }
     $this->expectOutputRegex('/^(?:<script[^>]+><\\/script>\\n){2}$/');
     $scripts->do_items(false, 0);
     $this->assertNotContains('jquery', $scripts->done);
     $this->assertNotContains('jquery-core', $scripts->done, 'jquery-core should be in footer but is in head');
     $this->assertNotContains('jquery-migrate', $scripts->done, 'jquery-migrate should be in footer but is in head');
     $scripts->do_items(false, 1);
     $this->assertContains('jquery', $scripts->done);
     $this->assertContains('jquery-core', $scripts->done, 'jquery-core in footer');
     $this->assertContains('jquery-migrate', $scripts->done, 'jquery-migrate in footer');
 }
开发者ID:atimmer,项目名称:wordpress-develop-mirror,代码行数:27,代码来源:jquery.php

示例7: print_scripts

 /**
  * Prints specific scripts.
  *
  * @param string|array $components A string, or an array of specific components to print.
  */
 public function print_scripts($components)
 {
     $this->check_arg_types(array('string', 'array'), func_get_args());
     $components = (array) $components;
     // Force an array value.
     global $wp_scripts;
     // Global object reference.
     if (!$wp_scripts instanceof \WP_Scripts) {
         $wp_scripts = new \WP_Scripts();
     }
     foreach ($components = array_unique($components) as $_key => $_handle) {
         if (!$this->©string->is_not_empty($_handle) || !wp_script_is($_handle, 'registered')) {
             unset($components[$_key]);
         }
     }
     // Remove (NOT a handle, or NOT registered).
     unset($_key, $_handle);
     // Housekeeping.
     if ($components) {
         // Still have something to print?
         $wp_scripts->do_items($components);
     }
 }
开发者ID:panvagenas,项目名称:x-related-posts,代码行数:28,代码来源:scripts.php


注:本文中的WP_Scripts::do_items方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。