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


PHP WP_Scripts::query方法代码示例

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


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

示例1:

 function wp_script_is($handle, $list = 'queue')
 {
     global $wp_scripts;
     if (!is_a($wp_scripts, 'WP_Scripts')) {
         $wp_scripts = new WP_Scripts();
     }
     $query = $wp_scripts->query($handle, $list);
     if (is_object($query)) {
         return true;
     }
     return $query;
 }
开发者ID:AgilData,项目名称:WordPress-Skeleton,代码行数:12,代码来源:_compat.php

示例2: 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

示例3: wp_script_is

/**
 * Check whether script has been added to WordPress Scripts.
 *
 * By default, checks if the script has been enqueued. You can also
 * pass 'registered' to $list, to see if the script is registered,
 * and you can check processing statuses with 'to_do' and 'done'.
 *
 * @since WP unknown; BP unknown
 *
 * @param string $handle Name of the script.
 * @param string $list Optional. Defaults to 'enqueued'. Values are
 * 	'registered', 'enqueued' (or 'queue'), 'to_do', and 'done'.
 * @return bool Whether script is in the list.
 */
function wp_script_is($handle, $list = 'enqueued')
{
    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>init</code>'), '3.3');
        }
        $wp_scripts = new WP_Scripts();
    }
    return (bool) $wp_scripts->query($handle, $list);
}
开发者ID:adisonc,项目名称:MaineLearning,代码行数:25,代码来源:functions.wp-scripts.php

示例4: register_ui_scripts

 /**
  * Register additional jQuery UI scripts
  *
  * Never call this manually unless you really know what you are doing!
  *
  * @internal
  */
 public function register_ui_scripts()
 {
     global $wp_scripts;
     if (!$wp_scripts instanceof WP_Scripts) {
         $wp_scripts = new WP_Scripts();
     }
     $deps_c = array('jquery-ui-core');
     $deps_cw = array_merge($deps_c, array('jquery-ui-widget'));
     $deps_cwm = array_merge($deps_cw, array('jquery-ui-mouse'));
     $deps_cwp = array_merge($deps_cw, array('jquery-ui-position'));
     $jui = array('jquery-ui-accordion' => array('src' => 'jquery.ui.accordion.min.js', 'deps' => $deps_cw), 'jquery-ui-autocomplete' => array('src' => 'jquery.ui.autocomplete.min.js', 'deps' => $deps_cwp), 'jquery-ui-datepicker' => array('src' => 'jquery.ui.datepicker.min.js', 'deps' => $deps_c), 'jquery-ui-progressbar' => array('src' => 'jquery.ui.progressbar.min.js', 'deps' => $deps_cw), 'jquery-ui-slider' => array('src' => 'jquery.ui.slider.min.js', 'deps' => $deps_cwm));
     // register more scripts
     foreach ($jui as $handle => $cfg) {
         // make sure not registered already
         if (!$wp_scripts->query($handle)) {
             // register it
             $wp_scripts->add($handle, ICE_JS_URL . '/' . $cfg['src'], $cfg['deps'], '1.8.12');
             // put in footer group
             $wp_scripts->add_data($handle, 'group', 1);
         }
     }
 }
开发者ID:nathan929,项目名称:infinity,代码行数:29,代码来源:enqueue.php


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