示例#1
0
 function zerowp_customizer_enqueue_font($option)
 {
     $font_name = get_theme_mod($option);
     if (empty($font_name)) {
         $font_name = 'Arial';
     }
     if (!in_array($font_name, zerowp_customizer_standard_fonts())) {
         $font_weight = get_theme_mod($option . '_weight', 400);
         $font_weight = !empty($font_weight) ? $font_weight : 400;
         $font_weight_in_url = !in_array(absint($font_weight), array(400, 700)) ? '400,700,' . $font_weight : '400,700';
         $font_name = trim($font_name);
         $handle = 'google_font_' . str_ireplace(' ', '_', $font_name);
         if (!wp_style_is($handle, 'enqueued')) {
             wp_register_style($handle, "//fonts.googleapis.com/css?family=" . str_ireplace(' ', '+', $font_name) . ":" . $font_weight_in_url);
             wp_enqueue_style($handle);
         } else {
             $registered_link = wp_styles()->query($handle)->src;
             if (strpos($registered_link, (string) $font_weight) === false) {
                 wp_deregister_style($handle);
                 wp_register_style($handle, $registered_link . ',' . $font_weight);
                 wp_enqueue_style($handle);
             }
         }
     }
 }
示例#2
0
 public function replace_admin_bar_style()
 {
     global $wp_styles;
     $wp_styles = wp_styles();
     if (!isset($wp_styles->registered['admin-bar'])) {
         return;
     }
     $this->replace_css('admin-bar', 'admin-bar.css', '');
 }
示例#3
0
 public function enqueueInclude(FrontInclude $style)
 {
     if (defined('WP_DEBUG') && WP_DEBUG) {
         $dependencies = $style->getDependency();
         $scripts = wp_styles()->registered;
         foreach ($dependencies as $dependency) {
             if (!isset($scripts[$dependency])) {
                 trigger_error(sprintf('Dependency failed for %s, No style with handle %s is registered', $style->getHandle(), $dependency), E_USER_WARNING);
             }
         }
     }
     wp_enqueue_style($style->getHandle(), $style->getSrc(), $style->getDependency(), $style->getVersion(), $style->loadInFooter());
 }
 function enqueue_scripts()
 {
     $GLOBALS['is_IE'] = false;
     $wp_styles = wp_styles();
     $wp_scripts = wp_scripts();
     $this->plugin->enqueue_scripts();
     $this->assertContains('font-awesome', $wp_styles->queue);
     $this->assertContains('wpcw-admin', $wp_styles->queue);
     $this->assertContains('wpcw-admin', $wp_scripts->queue);
     $this->assertNotContains('wpcw-admin-ie', $wp_scripts->queue);
     $GLOBALS['is_IE'] = true;
     $this->plugin->enqueue_scripts();
     $this->assertContains('wpcw-admin-ie', $wp_scripts->queue);
 }
 function test_widget()
 {
     $instance = ['title' => 'test', 'labels' => ['value' => 'yes']];
     $args = ['before_widget' => '<div class="widget wpcw-widget-social"><div class="widget-content">', 'after_widget' => '</div><div class="clear"></div></div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>'];
     $this->expectOutputRegex('/<div class="widget wpcw-widget-social"><div class="widget-content">/');
     $this->expectOutputRegex('/<h3 class="widget-title">/');
     $this->plugin->widget($args, $instance);
     // Tests that script & styles are enqueued enqueued
     do_action('wp_enqueue_scripts');
     $wp_styles = wp_styles();
     // Make sure the JS file is enqueued
     $this->assertContains('font-awesome', $wp_styles->queue);
     $this->assertContains('wpcw', $wp_styles->queue);
 }
 function test_widget()
 {
     $instance = ['title' => 'test', 'labels' => ['value' => 'yes'], 'map' => ['value' => 'yes'], 'address' => ['value' => '<br>123 Santa Monica<br>']];
     $args = ['before_widget' => '<div class="widget wpcw-widget-contact"><div class="widget-content">', 'after_widget' => '</div><div class="clear"></div></div>', 'before_title' => '<h3 class="widget-title">', 'after_title' => '</h3>'];
     $this->expectOutputRegex('/<div class="widget wpcw-widget-contact"><div class="widget-content">/');
     $this->expectOutputRegex('/<h3 class="widget-title">/');
     // Check that we sprint the right google url
     $this->expectOutputRegex('~//www\\.google\\.com/maps\\?q=123\\+Santa\\+Monica&output=embed~');
     $this->plugin->widget($args, $instance);
     // Tests that script & styles are enqueued enqueued
     do_action('wp_enqueue_scripts');
     $wp_styles = wp_styles();
     $this->assertContains('wpcw', $wp_styles->queue);
 }
 /**
  * Init
  */
 protected function __construct()
 {
     // init properties
     $this->wp_styles = wp_styles();
     $this->handles_loaded_async = get_option('bcd-css-handles', array());
     $this->critical_css = get_option('bcd-critical-css', '');
     // add wp hooks
     add_action('wp_print_styles', array($this, 'loadCSS'));
     add_filter('style_loader_tag', array($this, 'style_loader_tag'), 10, 3);
     if (strlen($this->critical_css)) {
         add_action('wp_print_styles', array($this, 'print_critical_css'));
     }
     // conditionally print debug information in the foot
     if (true === filter_input(INPUT_GET, 'debugBCD', FILTER_VALIDATE_BOOLEAN)) {
         add_action('wp_footer', array($this, 'footer_debug'), 9999);
     }
 }
示例#8
0
 /**
  * Register assets
  *
  * @since   0.1.0
  * @wp_hook action icon_picker_loader_init
  *
  * @param  Icon_Picker_Loader  $loader Icon_Picker_Loader instance.
  *
  * @return void
  */
 public function register_assets(Icon_Picker_Loader $loader)
 {
     if (empty($this->stylesheet_uri)) {
         return;
     }
     $register = true;
     $deps = false;
     $styles = wp_styles();
     if ($styles->query($this->stylesheet_id, 'registered')) {
         $object = $styles->registered[$this->stylesheet_id];
         if (version_compare($object->ver, $this->version, '<')) {
             $deps = $object->deps;
             wp_deregister_style($this->stylesheet_id);
         } else {
             $register = false;
         }
     }
     if ($register) {
         wp_register_style($this->stylesheet_id, $this->stylesheet_uri, $deps, $this->version);
     }
     $loader->add_style($this->stylesheet_id);
 }
 /**
  * Enqueue preview scripts.
  *
  * @since 4.5.0
  * @access public
  */
 public function enqueue_preview_scripts()
 {
     wp_enqueue_script('customize-partial-refresh-preview');
     $wp_scripts = wp_scripts();
     $wp_styles = wp_styles();
     /*
      * Core does not rebuild MediaElement.js audio and video players when DOM subtrees change.
      * The Jetpack Infinite Scroll handles this when a post-load event is triggered.
      * Ideally this should be incorporated into Core.
      *
      * Hard-coded reference to a Jetpack module's event is not relevant for #coremerge.
      */
     if (class_exists('Jetpack')) {
         $exports = array();
         $handle = 'customize-partial-jetpack-support';
         $src = $this->dir_url . 'js/plugin-support/jetpack.js';
         $deps = array('customize-partial-refresh-preview');
         $in_footer = true;
         wp_enqueue_script($handle, $src, $deps, $this->get_version(), $in_footer);
         if (Jetpack::is_module_active('infinite-scroll')) {
             $exports['infiniteScroll'] = array('themeSupport' => current_theme_supports('infinite-scroll'));
         }
         if (Jetpack::is_module('widgets')) {
             $exports['widgets'] = array('scripts' => array('google-maps' => array('src' => 'https://maps.googleapis.com/maps/api/js?sensor=false'), 'contact-info-map-js' => array('src' => plugins_url('modules/widgets/contact-info/contact-info-map.js', JETPACK__PLUGIN_FILE), 'deps' => array('jquery', 'google-maps'))), 'styles' => array('contact-info-map-css' => array('src' => plugins_url('modules/widgets/contact-info/contact-info-map.css', JETPACK__PLUGIN_FILE))));
         }
         wp_scripts()->add_data($handle, 'data', sprintf('var _customizeSelectiveRefreshJetpackExports = %s;', wp_json_encode($exports)));
     }
     add_action('wp_footer', array($this, 'export_preview_data'), 1000);
 }
/**
 * Check whether a CSS stylesheet has been added to the queue.
 *
 * @since 2.8.0
 *
 * @param string $handle Name of the stylesheet.
 * @param string $list   Optional. Status of the stylesheet to check. Default 'enqueued'.
 *                       Accepts 'enqueued', 'registered', 'queue', 'to_do', and 'done'.
 * @return bool Whether style is queued.
 */
function wp_style_is($handle, $list = 'enqueued')
{
    _wp_scripts_maybe_doing_it_wrong(__FUNCTION__);
    return (bool) wp_styles()->query($handle, $list);
}
 /**
  * Test enqueue frontend scripts.
  *
  * @see Customize_Snapshot_Manager::enqueue_frontend_scripts()
  */
 function test_enqueue_frontend_scripts()
 {
     $this->plugin->register_scripts(wp_scripts());
     $this->plugin->register_styles(wp_styles());
     $manager = new Customize_Snapshot_Manager($this->plugin);
     $manager->init();
     $this->assertFalse(wp_script_is('customize-snapshots-frontend', 'enqueued'));
     $manager->enqueue_frontend_scripts();
     $this->assertFalse(wp_script_is('customize-snapshots-frontend', 'enqueued'));
     $_REQUEST['customize_snapshot_uuid'] = self::UUID;
     $manager = new Customize_Snapshot_Manager($this->plugin);
     $manager->init();
     $this->assertFalse(wp_script_is('customize-snapshots-frontend', 'enqueued'));
     $manager->enqueue_frontend_scripts();
     $this->assertTrue(wp_script_is('customize-snapshots-frontend', 'enqueued'));
 }
示例#12
0
 /**
  * Register assets
  *
  * @since   0.1.0
  * @wp_hook action icon_picker_loader_init
  *
  * @param  Icon_Picker_Loader  $loader Icon_Picker_Loader instance.
  *
  * @return void
  */
 public function register_assets(Icon_Picker_Loader $loader)
 {
     if (empty($this->stylesheet_uri)) {
         return;
     }
     $register = true;
     $deps = false;
     $styles = wp_styles();
     /**
      * When the stylesheet ID of an icon type is already registered,
      * we'll compare its version with ours. If our stylesheet has greater
      * version number, we'll deregister the other stylesheet.
      */
     if ($styles->query($this->stylesheet_id, 'registered')) {
         $object = $styles->registered[$this->stylesheet_id];
         if (version_compare($object->ver, $this->version, '<')) {
             $deps = $object->deps;
             wp_deregister_style($this->stylesheet_id);
         } else {
             $register = false;
         }
     }
     if ($register) {
         wp_register_style($this->stylesheet_id, $this->stylesheet_uri, $deps, $this->version);
     }
     $loader->add_style($this->stylesheet_id);
 }
示例#13
0
/**
 * Asset enqueue handler on single social paper pages.
 *
 * Removes all styles except the most pertinent ones.
 *
 * @todo maybe do the same for scripts?
 */
function cacsp_asset_enqueue_handler()
{
    if (!cacsp_is_page() || is_404()) {
        return;
    }
    $styles = wp_styles();
    // wipe out all styles and only enqueue the ones we need
    $styles->queue = array('social-paper-single', 'side-comments-style', 'side-comments-theme', 'incom-style', 'media-views', 'wp-core-ui-colors', 'buttons', 'wp-auth-check', 'fee-modal', 'fee-link-modal', 'tinymce-core', 'tinymce-view', 'fee', 'dashicons', 'admin-bar', 'fee-adminbar');
    // enqueue our styles
    wp_enqueue_style('social-paper-single', Social_Paper::$URL . '/assets/css/single.css');
    wp_enqueue_style('social-paper-single-print', Social_Paper::$URL . '/assets/css/print.css', array('social-paper-single'), '0.1', 'print');
    if (function_exists('bp_is_active') && bp_is_active('groups')) {
        $select2_css_url = set_url_scheme('http://cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/css/select2.min.css');
        wp_enqueue_style('social-paper-select2', $select2_css_url);
    }
    // Register scripts.
    $sp_js_deps = array('jquery');
    if (function_exists('bp_is_active') && bp_is_active('groups')) {
        $select2_js_url = set_url_scheme('http://cdnjs.cloudflare.com/ajax/libs/select2/4.0.0/js/select2.js');
        wp_register_script('social-paper-select2', $select2_js_url, array('jquery'));
        $sp_js_deps[] = 'social-paper-select2';
    }
    wp_enqueue_script('social-paper-single', Social_Paper::$URL . '/assets/js/single.js', $sp_js_deps);
    wp_localize_script('social-paper-single', 'SocialPaperL18n', array('group_placeholder' => __('Enter a group name', 'social-paper'), 'reader_placeholder' => __('Enter a user name', 'social-paper')));
}
 /**
  * Get Style List
  *
  * @since 4.0.0
  */
 private function get_include_style()
 {
     return $this->add_suffix('.css', wp_styles()->queue);
 }
 /**
  * @see Customize_Concurrency::customize_controls_enqueue_scripts()
  */
 function test_customize_controls_enqueue_scripts()
 {
     $this->plugin->register_scripts(wp_scripts());
     $this->plugin->register_styles(wp_styles());
     $instance = new Customize_Concurrency($this->plugin);
     $instance->customize_controls_enqueue_scripts();
     $this->assertTrue(wp_script_is($this->plugin->slug, 'enqueued'));
     $this->assertTrue(wp_style_is($this->plugin->slug, 'enqueued'));
     $this->assertEquals(1, has_action('customize_controls_print_footer_scripts', array($instance, 'export_js_data')));
 }
 /**
  * Gets the src url for the registered fontawesome handler
  * @param bool $ngg_provided_only
  * @return null|string|void
  */
 static function get_fontawesome_url($ngg_provided_only = FALSE)
 {
     $retval = NULL;
     if (wp_style_is('fontawesome', 'registered') && !$ngg_provided_only) {
         $style = wp_styles()->registered['fontawesome'];
         $retval = $style->src;
     } else {
         if (strpos(strtolower($_SERVER['SERVER_SOFTWARE']), 'microsoft-iis') !== FALSE) {
             $retval = site_url('/?ngg_serve_fontawesome_css=1');
         } else {
             $router = C_Router::get_instance();
             $retval = $router->get_static_url('photocrati-nextgen_gallery_display#fontawesome/font-awesome.css');
         }
     }
     return $retval;
 }
示例#17
0
/**
 * Enqueues or directly prints a stylesheet link to the specified CSS file.
 *
 * "Intelligently" decides to enqueue or to print the CSS file. If the
 * 'wp_print_styles' action has *not* yet been called, the CSS file will be
 * enqueued. If the wp_print_styles action *has* been called, the CSS link will
 * be printed. Printing may be forced by passing true as the $force_echo
 * (second) parameter.
 *
 * For backward compatibility with WordPress 2.3 calling method: If the $file
 * (first) parameter does not correspond to a registered CSS file, we assume
 * $file is a file relative to wp-admin/ without its ".css" extension. A
 * stylesheet link to that generated URL is printed.
 *
 * @since 2.3.0
 *
 * @param string $file       Optional. Style handle name or file name (without ".css" extension) relative
 * 	                         to wp-admin/. Defaults to 'wp-admin'.
 * @param bool   $force_echo Optional. Force the stylesheet link to be printed rather than enqueued.
 */
function wp_admin_css($file = 'wp-admin', $force_echo = false)
{
    // For backward compatibility
    $handle = 0 === strpos($file, 'css/') ? substr($file, 4) : $file;
    if (wp_styles()->query($handle)) {
        if ($force_echo || did_action('wp_print_styles')) {
            // we already printed the style queue. Print this one immediately
            wp_print_styles($handle);
        } else {
            // Add to style queue
            wp_enqueue_style($handle);
        }
        return;
    }
    /**
     * Filter the stylesheet link to the specified CSS file.
     *
     * If the site is set to display right-to-left, the RTL stylesheet link
     * will be used instead.
     *
     * @since 2.3.0
     *
     * @param string $file Style handle name or filename (without ".css" extension)
     *                     relative to wp-admin/. Defaults to 'wp-admin'.
     */
    echo apply_filters('wp_admin_css', "<link rel='stylesheet' href='" . esc_url(wp_admin_css_uri($file)) . "' type='text/css' />\n", $file);
    if (function_exists('is_rtl') && is_rtl()) {
        /** This filter is documented in wp-includes/general-template.php */
        echo apply_filters('wp_admin_css', "<link rel='stylesheet' href='" . esc_url(wp_admin_css_uri("{$file}-rtl")) . "' type='text/css' />\n", "{$file}-rtl");
    }
}
 /**
  * Set up any style sheets we need
  */
 function enqueue_styles()
 {
     if (!is_tax('presentation')) {
         return;
     }
     // Find theme's stylesheet
     $styles = wp_styles();
     $theme_handle = '';
     $parent_theme_handle = '';
     foreach ($styles->registered as $queue => $arg) {
         // Main theme
         if (false !== strpos($arg->src, get_stylesheet_uri())) {
             $theme_handle = $arg->handle;
             if (!is_child_theme()) {
                 break;
             }
         }
         // Parent theme
         if (is_child_theme() && false !== strpos($arg->src, get_template_directory_uri() . '/style.css')) {
             $parent_theme_handle = $arg->handle;
             if (!empty($theme_handle)) {
                 break;
             }
         }
     }
     // Found the theme's stylesheet; let's remove it!
     if (!empty($theme_handle)) {
         wp_deregister_style($theme_handle);
     }
     if (!empty($parent_theme_handle)) {
         wp_deregister_style($parent_theme_handle);
     }
     $options = $this->get_presentation_settings();
     if ('default' == $options['theme']) {
         $options['theme'] = 'league';
     }
     wp_register_style('theme-base', get_stylesheet_uri(), array(), $this->version, 'all');
     wp_register_style('reveal-js-presentations', plugins_url('css/reveal-js-presentations.css', dirname(__FILE__)), array(), $this->version, 'all');
     wp_register_style('reveal-js', plugins_url('reveal-js/css/reveal.css', dirname(__FILE__)), array('reveal-js-presentations'), $this->version, 'all');
     wp_register_style('reveal-theme', plugins_url(sprintf('reveal-js/css/theme/%s.css', $options['theme']), dirname(__FILE__)), array('reveal-js'), $this->version, 'all');
     wp_register_style('reveal-syntax', plugins_url('reveal-js/lib/css/zenburn.css', dirname(__FILE__)), array(), $this->version, 'all');
     wp_enqueue_style('reveal-theme');
     wp_enqueue_style('reveal-syntax');
 }
示例#19
0
/**
 * Print styles (internal use only)
 *
 * @ignore
 *
 * @global bool $compress_css
 */
function _print_styles()
{
    global $compress_css;
    $wp_styles = wp_styles();
    $zip = $compress_css ? 1 : 0;
    if ($zip && defined('ENFORCE_GZIP') && ENFORCE_GZIP) {
        $zip = 'gzip';
    }
    if (!empty($wp_styles->concat)) {
        $dir = $wp_styles->text_direction;
        $ver = $wp_styles->default_version;
        $href = $wp_styles->base_url . "/wp-admin/load-styles.php?c={$zip}&dir={$dir}&load=" . trim($wp_styles->concat, ', ') . '&ver=' . $ver;
        $css = "";
        foreach (array_unique(explode(',', trim($wp_styles->concat, ', '))) as $load) {
            if (!array_key_exists($load, $wp_styles->registered)) {
                continue;
            }
            $style = $wp_styles->registered[$load];
            $css .= file_get_contents(ABSPATH . $style->src) . '\\n';
            //			echo "<link rel='stylesheet' href='" . $style->src . "' type='text/css' media='all' />\n";
        }
        $path = '/wp-content/cache/' . md5($css) . '.css';
        $file_path = ABSPATH . $path;
        if (!file_exists($file_path)) {
            $file = fopen($file_path, 'w');
            fwrite($file, CssMin::minify($css));
            fclose($file);
        }
        echo "<link rel='stylesheet' href='" . $path . "' type='text/css' media='all' />\n";
        //		echo "<link rel='stylesheet' href='" . esc_attr($href) . "' type='text/css' media='all' />\n";
        if (!empty($wp_styles->print_code)) {
            echo "<style type='text/css'>\n";
            echo $wp_styles->print_code;
            echo "\n</style>\n";
        }
    }
    if (!empty($wp_styles->print_html)) {
        echo $wp_styles->print_html;
    }
}
示例#20
0
/**
 * Gets registered scripts and styles.
 *
 * Gets WordPress default scripts/styles, then those plugin/theme registered.
 * The 'shutdown' hook fires after wp_default_scripts()/_styles()
 * and after admin screen has rendered (so enqueued scripts don't affect admin display).
 *
 * @since   0.1.0
 */
function postscript_get_reg_handles()
{
    if (is_admin()) {
        return;
    }
    // Hack to get front-end scripts into memory, from here in the back-end
    // (in $wp_scripts, $wp_styles) by firing the front-end registration hook.
    do_action('wp_enqueue_scripts');
    // Arrays now have front-end registered scripts.
    $wp_scripts_reg = wp_scripts();
    $wp_styles_reg = wp_styles();
    // Default and plugin/theme scripts array.
    $scripts_reg = $wp_scripts_reg->registered;
    $postscript_scripts_reg = get_transient('postscript_scripts_reg');
    $styles_reg = $wp_styles_reg->registered;
    $postscript_styles_reg = get_transient('postscript_styles_reg');
    // Set transients with scripts arrays (!= checks for new registrations).
    if ($scripts_reg != $postscript_scripts_reg) {
        set_transient('postscript_scripts_reg', $scripts_reg, 60 * 60 * 4);
    }
    if ($styles_reg != $postscript_styles_reg) {
        set_transient('postscript_styles_reg', $styles_reg, 60 * 60 * 4);
    }
    /* For future feature to separate defaults from plugin/theme scripts.
        // Get arrays of only back-end and only front-end scripts
        // by comparing before and after actions arrays.
        $wp_scripts_front = array_diff( $wp_scripts_reg, $wp_scripts_pre);
        $wp_scripts_back = array_intersect( $wp_scripts_reg, $wp_scripts_pre);
    
        // THIS GOES ABOVE AT TOP OF FN, ABOVE do_action().
        // Arrays with WordPress default and back-end scripts.
        $wp_scripts_pre = wp_scripts();
        $wp_styles_pre  = wp_styles();
    
        // Default scripts array.
        $scripts_pre            = $wp_scripts_pre->registered;
        $postscript_scripts_pre = get_transient( 'postscript_scripts_pre' );
    
        $styles_pre             = $wp_styles_pre->registered;
        $postscript_styles_pre  = get_transient( 'postscript_styles_pre' );
    
        // Set transients with defaults scripts.
        if ( $scripts_pre != $postscript_scripts_pre ) {
            set_transient( 'postscript_scripts_pre', $scripts_pre, 60 * 60 * 4 );
        }
    
        if ( $styles_pre != $postscript_styles_pre ) {
            set_transient( 'postscript_styles_pre', $styles_pre, 60 * 60 * 4 );
        }
        */
}
/**
 * Add metadata to a CSS stylesheet.
 *
 * Works only if the stylesheet has already been added.
 *
 * Possible values for $key and $value:
 * 'conditional' string      Comments for IE 6, lte IE 7 etc.
 * 'rtl'         bool|string To declare an RTL stylesheet.
 * 'suffix'      string      Optional suffix, used in combination with RTL.
 * 'alt'         bool        For rel="alternate stylesheet".
 * 'title'       string      For preferred/alternate stylesheets.
 *
 * @see WP_Dependency::add_data()
 *
 * @since 3.6.0
 *
 * @param string $handle Name of the stylesheet.
 * @param string $key Name of data point for which we're storing a value.
 *                       Accepts 'conditional', 'rtl' and 'suffix', 'alt' and 'title'.
 * @param mixed $value String containing the CSS data to be added.
 * @return bool True on success, false on failure.
 */
function wp_style_add_data($handle, $key, $value)
{
    return wp_styles()->add_data($handle, $key, $value);
}
 function desktop_shortcode_get_assets($post_id, $type)
 {
     // Compares assets loaded on original page load to those loaded during AJAX content retrieval and prepares the balance for enqueuing in later page views (from our cache)
     if ($type == 'scripts') {
         $source_object = wp_scripts();
     } elseif ($type == 'styles') {
         $source_object = wp_styles();
     }
     $starting_assets = get_post_meta($post_id, 'wptouch_sc_' . $type, true);
     $queued_assets = $source_object->queue;
     $registered_assets = $source_object->registered;
     if (is_array($starting_assets)) {
         $missing_assets = array_diff($queued_assets, $starting_assets);
     } else {
         $missing_assets = $queued_assets;
     }
     $return_array = array();
     foreach ($missing_assets as $asset) {
         $return_array[] = $registered_assets[$asset];
     }
     // cleanup postmeta
     delete_post_meta($post_id, 'wptouch_sc_' . $type);
     return $return_array;
 }
示例#23
0
/**
 * Print styles (internal use only)
 *
 * @ignore
 *
 * @global bool $compress_css
 */
function _print_styles()
{
    global $compress_css;
    $wp_styles = wp_styles();
    $zip = $compress_css ? 1 : 0;
    if ($zip && defined('ENFORCE_GZIP') && ENFORCE_GZIP) {
        $zip = 'gzip';
    }
    if (!empty($wp_styles->concat)) {
        $dir = $wp_styles->text_direction;
        $ver = $wp_styles->default_version;
        $href = $wp_styles->base_url . "/wp-admin/load-styles.php?c={$zip}&dir={$dir}&load=" . trim($wp_styles->concat, ', ') . '&ver=' . $ver;
        echo "<link rel='stylesheet' href='" . esc_attr($href) . "' type='text/css' media='all' />\n";
        if (!empty($wp_styles->print_code)) {
            echo "<style type='text/css'>\n";
            echo $wp_styles->print_code;
            echo "\n</style>\n";
        }
    }
    if (!empty($wp_styles->print_html)) {
        echo $wp_styles->print_html;
    }
}
 /**
  * @see HTTPS_Resource_Proxy::enqueue_scripts()
  */
 function test_enqueue_scripts()
 {
     $instance = new HTTPS_Resource_Proxy($this->plugin);
     add_filter('https_resource_proxy_filtering_enabled', '__return_true');
     $instance->add_proxy_filtering();
     unset($instance);
     $wp_scripts = wp_scripts();
     // and fire wp_default_scripts
     wp_styles();
     // fire wp_default_styles
     do_action('wp_enqueue_scripts');
     $this->assertContains($this->plugin->script_handles['https-resource-proxy'], $wp_scripts->queue);
     $this->assertContains('var _httpsResourceProxyExports', $wp_scripts->get_data($this->plugin->script_handles['https-resource-proxy'], 'data'));
 }