/**
  * @param WP_Styles $wp_styles
  * @action wp_default_styles
  */
 function register_styles($wp_styles)
 {
     $handle = 'customize-partial-refresh-widgets-preview';
     $src = $this->get_dir_url('css/customize-partial-refresh-widgets-preview.css');
     $deps = array();
     $wp_styles->add($handle, $src, $deps, $this->get_version());
     $this->style_handles['widgets-preview'] = $handle;
 }
Esempio n. 2
0
 /**
  * Constructor
  */
 public function __construct()
 {
     $remove = array_diff(array_keys($_GET), $this->baseUrlParamNames);
     if ($remove) {
         $this->baseUrl = remove_query_arg($remove);
     } else {
         $this->baseUrl = $_SERVER['REQUEST_URI'];
     }
     parent::__construct();
     // add special filter for url fields
     $this->input->addFilter(create_function('$str', 'return "http://" == $str || "ftp://" == $str ? "" : $str;'));
     // enqueue required sripts and styles
     global $wp_styles;
     if (!is_a($wp_styles, 'WP_Styles')) {
         $wp_styles = new WP_Styles();
     }
     wp_enqueue_style('jquery-ui', PMXE_ROOT_URL . '/static/js/jquery/css/redmond/jquery-ui.css');
     wp_enqueue_style('jquery-tipsy', PMXE_ROOT_URL . '/static/js/jquery/css/smoothness/jquery.tipsy.css');
     wp_enqueue_style('pmxe-admin-style', PMXE_ROOT_URL . '/static/css/admin.css', array(), PMXE_VERSION);
     wp_enqueue_style('pmxe-admin-style-ie', PMXE_ROOT_URL . '/static/css/admin-ie.css');
     wp_enqueue_style('jquery-select2', PMXE_ROOT_URL . '/static/js/jquery/css/select2/select2.css');
     wp_enqueue_style('jquery-select2', PMXE_ROOT_URL . '/static/js/jquery/css/select2/select2-bootstrap.css');
     wp_enqueue_style('jquery-chosen', PMXE_ROOT_URL . '/static/js/jquery/css/chosen/chosen.css');
     wp_enqueue_style('jquery-codemirror', PMXE_ROOT_URL . '/static/codemirror/codemirror.css', array(), PMXE_VERSION);
     $wp_styles->add_data('pmxe-admin-style-ie', 'conditional', 'lte IE 7');
     wp_enqueue_style('wp-pointer');
     if (version_compare(get_bloginfo('version'), '3.8-RC1') >= 0) {
         wp_enqueue_style('pmxe-admin-style-wp-3.8', PMXE_ROOT_URL . '/static/css/admin-wp-3.8.css');
     }
     if (version_compare(get_bloginfo('version'), '4.4') >= 0) {
         wp_enqueue_style('pmxe-admin-style-wp-4.4', PMXE_ROOT_URL . '/static/css/admin-wp-4.4.css');
     }
     $scheme_color = get_user_option('admin_color') and is_file(PMXE_Plugin::ROOT_DIR . '/static/css/admin-colors-' . $scheme_color . '.css') or $scheme_color = 'fresh';
     if (is_file(PMXE_Plugin::ROOT_DIR . '/static/css/admin-colors-' . $scheme_color . '.css')) {
         wp_enqueue_style('pmxe-admin-style-color', PMXE_ROOT_URL . '/static/css/admin-colors-' . $scheme_color . '.css');
     }
     wp_enqueue_script('jquery-ui-datepicker', PMXE_ROOT_URL . '/static/js/jquery/ui.datepicker.js', 'jquery-ui-core');
     //wp_enqueue_script('jquery-ui-autocomplete', PMXE_ROOT_URL . '/static/js/jquery/ui.autocomplete.js', array('jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-position'));
     wp_enqueue_script('jquery-tipsy', PMXE_ROOT_URL . '/static/js/jquery/jquery.tipsy.js', 'jquery');
     wp_enqueue_script('jquery-pmxe-nestable', PMXE_ROOT_URL . '/static/js/jquery/jquery.mjs.pmxe_nestedSortable.js', array('jquery', 'jquery-ui-dialog', 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-tabs', 'jquery-ui-progressbar'));
     wp_enqueue_script('jquery-moment', PMXE_ROOT_URL . '/static/js/jquery/moment.js', 'jquery');
     wp_enqueue_script('jquery-select2', PMXE_ROOT_URL . '/static/js/jquery/select2.min.js', 'jquery');
     wp_enqueue_script('jquery-ddslick', PMXE_ROOT_URL . '/static/js/jquery/jquery.ddslick.min.js', 'jquery');
     wp_enqueue_script('jquery-chosen', PMXE_ROOT_URL . '/static/js/jquery/chosen.jquery.min.js', 'jquery');
     wp_enqueue_script('jquery-codemirror', PMXE_ROOT_URL . '/static/codemirror/codemirror.js', array(), PMXE_VERSION);
     wp_enqueue_script('jquery-codemirror-matchbrackets', PMXE_ROOT_URL . '/static/codemirror/matchbrackets.js', array('jquery-codemirror'), PMXE_VERSION);
     wp_enqueue_script('jquery-codemirror-htmlmixed', PMXE_ROOT_URL . '/static/codemirror/htmlmixed.js', array('jquery-codemirror-matchbrackets'), PMXE_VERSION);
     wp_enqueue_script('jquery-codemirror-xml', PMXE_ROOT_URL . '/static/codemirror/xml.js', array('jquery-codemirror-htmlmixed'), PMXE_VERSION);
     wp_enqueue_script('jquery-codemirror-javascript', PMXE_ROOT_URL . '/static/codemirror/javascript.js', array('jquery-codemirror-xml'), PMXE_VERSION);
     wp_enqueue_script('jquery-codemirror-clike', PMXE_ROOT_URL . '/static/codemirror/clike.js', array('jquery-codemirror-javascript'), PMXE_VERSION);
     wp_enqueue_script('jquery-codemirror-php', PMXE_ROOT_URL . '/static/codemirror/php.js', array('jquery-codemirror-clike'), PMXE_VERSION);
     wp_enqueue_script('jquery-codemirror-autorefresh', PMXE_ROOT_URL . '/static/codemirror/autorefresh.js', array('jquery-codemirror'), PMXE_VERSION);
     wp_enqueue_script('wp-pointer');
     /* load plupload scripts */
     wp_enqueue_script('pmxe-admin-script', PMXE_ROOT_URL . '/static/js/admin.js', array('jquery', 'jquery-ui-dialog', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-position', 'jquery-ui-autocomplete'), PMXE_VERSION);
 }
Esempio n. 3
0
 function jitm_enqueue_files($hook)
 {
     $wp_styles = new WP_Styles();
     $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
     wp_enqueue_style('jetpack-jitm-css', plugins_url("css/jetpack-admin-jitm{$min}.css", JETPACK__PLUGIN_FILE), false, JETPACK__VERSION . '-20121016');
     $wp_styles->add_data('jetpack-jitm-css', 'rtl', true);
     // Enqueue javascript to handle jitm notice events
     wp_enqueue_script('jetpack-jitm-js', plugins_url('_inc/jetpack-jitm.js', JETPACK__PLUGIN_FILE), array('jquery'), JETPACK__VERSION, true);
     wp_localize_script('jetpack-jitm-js', 'jitmL10n', array('ajaxurl' => admin_url('admin-ajax.php'), 'jitm_nonce' => wp_create_nonce('jetpack-jitm-nonce'), 'photon_msgs' => array('success' => __('Success! Photon is now actively optimizing and serving your images for free.', 'jetpack'), 'fail' => __('We are sorry but unfortunately Photon did not activate.', 'jetpack'))));
 }
Esempio n. 4
0
 /**
  * Constructor
  */
 public function __construct()
 {
     $remove = array_diff(array_keys($_GET), $this->baseUrlParamNames);
     $p_url = parse_url(site_url());
     $url = $p_url['scheme'] . '://' . $p_url['host'] . ':' . $_SERVER['SERVER_PORT'];
     if ($remove) {
         $this->baseUrl = $url . remove_query_arg($remove);
     } else {
         $this->baseUrl = $url . $_SERVER['REQUEST_URI'];
     }
     parent::__construct();
     // add special filter for url fields
     $this->input->addFilter(create_function('$str', 'return "http://" == $str || "ftp://" == $str ? "" : $str;'));
     // enqueue required sripts and styles
     global $wp_styles;
     if (!is_a($wp_styles, 'WP_Styles')) {
         $wp_styles = new WP_Styles();
     }
     wp_enqueue_style('jquery-ui', PMXI_ROOT_URL . '/static/js/jquery/css/redmond/jquery-ui.css');
     wp_enqueue_style('jquery-tipsy', PMXI_ROOT_URL . '/static/js/jquery/css/smoothness/jquery.tipsy.css');
     wp_enqueue_style('pmxi-admin-style', PMXI_ROOT_URL . '/static/css/admin.css');
     wp_enqueue_style('pmxi-admin-style-ie', PMXI_ROOT_URL . '/static/css/admin-ie.css');
     wp_enqueue_style('jquery-select2', PMXI_ROOT_URL . '/static/js/jquery/css/select2/select2.css');
     wp_enqueue_style('jquery-select2', PMXI_ROOT_URL . '/static/js/jquery/css/select2/select2-bootstrap.css');
     add_editor_style(PMXI_ROOT_URL . '/static/css/custom-editor-style.css');
     $wp_styles->add_data('pmxi-admin-style-ie', 'conditional', 'lte IE 7');
     wp_enqueue_style('wp-pointer');
     if (version_compare(get_bloginfo('version'), '3.8-RC1') >= 0) {
         wp_enqueue_style('pmxi-admin-style-wp-3.8', PMXI_ROOT_URL . '/static/css/admin-wp-3.8.css');
     }
     if (version_compare(get_bloginfo('version'), '4.0-beta3') >= 0) {
         wp_enqueue_style('pmxi-admin-style-wp-3.8', PMXI_ROOT_URL . '/static/css/admin-wp-4.0.css');
     }
     $scheme_color = get_user_option('admin_color') and is_file(PMXI_Plugin::ROOT_DIR . '/static/css/admin-colors-' . $scheme_color . '.css') or $scheme_color = 'fresh';
     if (is_file(PMXI_Plugin::ROOT_DIR . '/static/css/admin-colors-' . $scheme_color . '.css')) {
         wp_enqueue_style('pmxi-admin-style-color', PMXI_ROOT_URL . '/static/css/admin-colors-' . $scheme_color . '.css');
     }
     wp_enqueue_script('jquery-ui-datepicker', PMXI_ROOT_URL . '/static/js/jquery/ui.datepicker.js', 'jquery-ui-core');
     wp_enqueue_script('jquery-ui-autocomplete', PMXI_ROOT_URL . '/static/js/jquery/ui.autocomplete.js', array('jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-position'));
     wp_enqueue_script('jquery-tipsy', PMXI_ROOT_URL . '/static/js/jquery/jquery.tipsy.js', 'jquery');
     wp_enqueue_script('jquery-nestable', PMXI_ROOT_URL . '/static/js/jquery/jquery.mjs.nestedSortable.js', array('jquery', 'jquery-ui-dialog', 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-tabs', 'jquery-ui-progressbar'));
     wp_enqueue_script('jquery-moment', PMXI_ROOT_URL . '/static/js/jquery/moment.js', 'jquery');
     wp_enqueue_script('jquery-select2', PMXI_ROOT_URL . '/static/js/jquery/select2.min.js', 'jquery');
     wp_enqueue_script('jquery-ddslick', PMXI_ROOT_URL . '/static/js/jquery/jquery.ddslick.min.js', 'jquery');
     wp_enqueue_script('jquery-contextmenu', PMXI_ROOT_URL . '/static/js/jquery/jquery.ui-contextmenu.min.js', array('jquery', 'jquery-ui-menu'));
     wp_enqueue_script('wp-pointer');
     /* load plupload scripts */
     wp_deregister_script('swfupload-all');
     wp_deregister_script('swfupload-handlers');
     wp_enqueue_script('swfupload-handlers', get_option('siteurl') . "/wp-includes/js/swfupload/handlers.js", array('jquery'), '2201-20100523');
     wp_enqueue_script('jquery-browserplus-min', PMXI_ROOT_URL . '/static/js/jquery/browserplus-min.js', array('jquery'));
     wp_enqueue_script('full-plupload', PMXI_ROOT_URL . '/static/js/plupload/plupload.full.js', array('jquery-browserplus-min'));
     wp_enqueue_script('jquery-plupload', PMXI_ROOT_URL . '/static/js/plupload/wplupload.js', array('full-plupload', 'jquery'));
     wp_enqueue_script('pmxi-admin-script', PMXI_ROOT_URL . '/static/js/admin.js', array('jquery', 'jquery-ui-dialog', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'jquery-ui-droppable'));
 }
Esempio n. 5
0
function wp_enqueue_style($handle, $src = false, $deps = array(), $ver = false, $media = false)
{
    global $wp_styles;
    if (!is_a($wp_styles, 'WP_Styles')) {
        $wp_styles = new WP_Styles();
    }
    if ($src) {
        $_handle = explode('?', $handle);
        $wp_styles->add($_handle[0], $src, $deps, $ver, $media);
    }
    $wp_styles->enqueue($handle);
}
Esempio n. 6
0
 function wp_style_is($handle, $list = 'queue')
 {
     global $wp_styles;
     if (!is_a($wp_styles, 'WP_Scripts')) {
         $wp_styles = new WP_Styles();
     }
     $query = $wp_styles->query($handle, $list);
     if (is_object($query)) {
         return true;
     }
     return $query;
 }
Esempio n. 7
0
 /**
  * wp_print_styles()
  *
  * @return void
  **/
 static function wp_print_styles()
 {
     static $done = false;
     if ($done) {
         return;
     }
     $done = true;
     global $wp_styles;
     if (!$wp_styles instanceof WP_Styles) {
         $wp_styles = new WP_Styles();
     }
     $queue = $wp_styles->queue;
     $wp_styles->all_deps($queue);
     if (!$wp_styles->to_do) {
         return;
     }
     $todo = array();
     $css = array();
     $dirs = array(content_url(), plugins_url(), includes_url());
     foreach ($wp_styles->to_do as $key => $handle) {
         $cssPath = $wp_styles->registered[$handle]->src;
         if (!asset_cache::startsWith($cssPath, site_url())) {
             $cssPath = site_url() . $cssPath;
         }
         $inDir = false;
         foreach ($dirs as $dir) {
             if (asset_cache::startsWith($cssPath, $dir)) {
                 $inDir = true;
                 break;
             }
         }
         $suffixMatch = asset_cache::endsWith($cssPath, ".css");
         if ($inDir && $suffixMatch) {
             $css[$handle] = $wp_styles->registered[$handle]->ver;
             $todo[] = $handle;
             unset($wp_styles->to_do[$key]);
             $wp_styles->done[] = $handle;
         }
     }
     if ($todo) {
         $file = '/assets/' . md5(serialize($css)) . '.css';
         if (!cache_fs::exists($file)) {
             asset_cache::concat_styles($file, $todo);
         }
         $wp_styles->default_version = null;
         wp_enqueue_style('styles_concat', content_url() . '/cache' . $file);
     }
     //		$wp_styles->do_concat = true;
     //		$wp_styles->do_items();
 }
Esempio n. 8
0
 static function do_styles($handles)
 {
     self::do_scripts('jquery');
     global $wp_styles;
     if (!is_a($wp_styles, 'WP_Styles')) {
         $wp_styles = new WP_Styles();
     }
     ob_start();
     $wp_styles->do_items((array) $handles);
     $content = str_replace(array("'", "\n"), array('"', ''), ob_get_clean());
     echo "<script type='text/javascript'>\n";
     echo "jQuery(function (\$) { \$('head').prepend('{$content}'); });\n";
     echo "</script>";
 }
 /**
  * Register styles.
  *
  * @action wp_default_styles, 11
  *
  * @param \WP_Styles $wp_styles Instance of \WP_Styles.
  */
 public function register_styles(\WP_Styles $wp_styles)
 {
     $min = SCRIPT_DEBUG ? '' : '.min';
     $handle = 'customize-snapshots';
     $src = $this->dir_url . 'css/customize-snapshots' . $min . '.css';
     $deps = array('wp-jquery-ui-dialog');
     $wp_styles->add($handle, $src, $deps);
     $handle = 'customize-snapshots-preview';
     $src = $this->dir_url . 'css/customize-snapshots-preview' . $min . '.css';
     $deps = array('customize-preview');
     $wp_styles->add($handle, $src, $deps);
 }
Esempio n. 10
0
 function __construct($styles)
 {
     $this->old_styles = $styles;
     // Unset all the object properties except our private copy of the styles object.
     // We have to unset everything so that the overload methods talk to $this->old_styles->whatever
     // instead of $this->whatever.
     foreach (array_keys(get_object_vars($this)) as $key) {
         if ('old_styles' === $key) {
             continue;
         }
         unset($this->{$key});
     }
     parent::__construct();
 }
 public function __construct($styles = '')
 {
     $this->old_styles = empty($styles) || !$styles instanceof WP_Styles ? new WP_Styles() : $styles;
     // Unset all the object properties except our private copy of the
     // styles object. We have to unset everything so that the overload
     // methods talk to $this->old_styles->whatever instead of $this->whatever.
     foreach (array_keys(get_object_vars($this)) as $key) {
         if ('old_styles' === $key) {
             continue;
         }
         unset($this->{$key});
     }
     parent::__construct();
 }
 /**
  * Register styles.
  *
  * @param \WP_Styles $wp_styles
  * @action wp_default_styles
  */
 function register_styles(\WP_Styles $wp_styles)
 {
     $slug = 'customize-widgets';
     $handle = "{$this->slug}-{$slug}";
     $src = $this->dir_url . 'css/customize-widgets.css';
     $wp_styles->add($handle, $src);
     $this->style_handles[$slug] = $handle;
     $handle = "{$this->slug}-post-edit";
     $src = $this->dir_url . 'css/post-edit.css';
     $wp_styles->add($handle, $src);
     $this->style_handles['post_edit'] = $handle;
 }
Esempio n. 13
0
/**
 * Prints the styles queue in the HTML head on admin pages.
 *
 * @since 2.8.0
 */
function print_admin_styles()
{
    global $wp_styles, $concatenate_scripts;
    if (!is_a($wp_styles, 'WP_Styles')) {
        $wp_styles = new WP_Styles();
    }
    script_concat_settings();
    $wp_styles->do_concat = $concatenate_scripts;
    $wp_styles->do_items(false);
    /**
     * Filter whether to print the admin styles.
     *
     * @since 2.8.0
     *
     * @param bool $print Whether to print the admin styles. Default true.
     */
    if (apply_filters('print_admin_styles', true)) {
        _print_styles();
    }
    $wp_styles->reset();
    return $wp_styles->done;
}
function print_admin_styles()
{
    global $wp_styles, $concatenate_scripts, $compress_css;
    if (!is_a($wp_styles, 'WP_Styles')) {
        $wp_styles = new WP_Styles();
    }
    script_concat_settings();
    $wp_styles->do_concat = $concatenate_scripts;
    $zip = $compress_css ? 1 : 0;
    if ($zip && defined('ENFORCE_GZIP') && ENFORCE_GZIP) {
        $zip = 'gzip';
    }
    $wp_styles->do_items(false);
    if (apply_filters('print_admin_styles', true)) {
        if (!empty($wp_styles->concat)) {
            $dir = $wp_styles->text_direction;
            $ver = md5("{$wp_styles->concat_version}{$dir}");
            $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_html)) {
            echo $wp_styles->print_html;
        }
    }
    $wp_styles->do_concat = false;
    $wp_styles->concat = $wp_styles->concat_version = $wp_styles->print_html = '';
    return $wp_styles->done;
}
 /**
  * Register styles.
  *
  * @param \WP_Styles $wp_styles Instance of \WP_Styles.
  * @action wp_default_styles
  */
 public function register_styles(\WP_Styles $wp_styles)
 {
     $handle = 'customize-rest-resources-pane';
     $src = $this->dir_url . 'css/customize-pane.css';
     $deps = array('customize-controls');
     $wp_styles->add($handle, $src, $deps, $this->version);
 }
Esempio n. 16
0
/**
 * Prints the styles queue in the HTML head on admin pages.
 *
 * @since 2.8.0
 */
function print_admin_styles()
{
    global $wp_styles, $concatenate_scripts, $compress_css;
    if (!is_a($wp_styles, 'WP_Styles')) {
        $wp_styles = new WP_Styles();
    }
    script_concat_settings();
    $wp_styles->do_concat = $concatenate_scripts;
    $zip = $compress_css ? 1 : 0;
    if ($zip && defined('ENFORCE_GZIP') && ENFORCE_GZIP) {
        $zip = 'gzip';
    }
    $wp_styles->do_items(false);
    /**
     * Filter whether to print the admin styles.
     *
     * @since 2.8.0
     *
     * @param bool $print Whether to print the admin styles. Default true.
     */
    if (apply_filters('print_admin_styles', true)) {
        _print_styles();
    }
    $wp_styles->reset();
    return $wp_styles->done;
}
 function wp_dequeue_style($handle)
 {
     global $wp_styles;
     if (!is_a($wp_styles, 'WP_Styles')) {
         $wp_styles = new WP_Styles();
     }
     $wp_styles->dequeue($handle);
 }
/**
 * Check whether style has been added to WordPress Styles.
 *
 * The values for list defaults to 'queue', which is the same as wp_enqueue_style().
 *
 * @since WP unknown; BP unknown
 * @global object $wp_styles The WP_Styles object for printing styles.
 *
 * @param string $handle Name of the stylesheet.
 * @param string $list Values are 'registered', 'done', 'queue' and 'to_do'.
 * @return bool True on success, false on failure.
 */
function wp_style_is( $handle, $list = 'queue' ) {
	global $wp_styles;
	if ( ! is_a( $wp_styles, 'WP_Styles' ) ) {
		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_styles = new WP_Styles();
	}

	$query = $wp_styles->query( $handle, $list );

	if ( is_object( $query ) )
		return true;

	return $query;
}
Esempio n. 19
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
 * @uses $wp_styles WordPress Styles Object
 *
 * @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)
{
    global $wp_styles;
    if (!$wp_styles instanceof WP_Styles) {
        $wp_styles = new WP_Styles();
    }
    // 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");
    }
}
Esempio n. 20
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.
 *
 * @package WordPress
 * @since 2.3.0
 * @uses $wp_styles WordPress Styles Object
 *
 * @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)
{
    global $wp_styles;
    if (!is_a($wp_styles, 'WP_Styles')) {
        $wp_styles = new WP_Styles();
    }
    // 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;
    }
    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()) {
        echo apply_filters('wp_admin_css', "<link rel='stylesheet' href='" . esc_url(wp_admin_css_uri("{$file}-rtl")) . "' type='text/css' />\n", "{$file}-rtl");
    }
}
/**
 * Check whether a CSS stylesheet has been added to the queue.
 *
 * @global WP_Styles $wp_styles The WP_Styles object for printing styles.
 *
 * @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')
{
    global $wp_styles;
    if (!is_a($wp_styles, 'WP_Styles')) {
        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');
        }
        $wp_styles = new WP_Styles();
    }
    return (bool) $wp_styles->query($handle, $list);
}
Esempio n. 22
0
 /**
  * For all late styles (now footer group) do default behavior with lazy load opportunity
  * @param $group (0 - header , 1 - footer)
  * @return bool
  */
 protected function puzzler_styles_foot_do_default($group)
 {
     if (1 !== $group) {
         return false;
     }
     foreach ($this->to_do as $key => $handle) {
         // -- processing items only by current group
         if ($this->groups[$handle] !== $group) {
             continue;
         }
         if (parent::do_item($handle)) {
             $this->done[] = $handle;
             unset($this->to_do[$key]);
         }
     }
     return true;
 }
Esempio n. 23
0
 /**
  * Constructor
  */
 public function __construct()
 {
     $remove = array_diff(array_keys($_GET), $this->baseUrlParamNames);
     $p_url = parse_url(site_url());
     $url = $p_url['scheme'] . '://' . $p_url['host'];
     if (!empty($_POST['is_settings_submitted'])) {
         // save settings form
         $input = new PMXI_Input();
         $post = $input->post(array('port' => ''));
         PMXI_Plugin::getInstance()->updateOption($post);
     }
     $port = PMXI_Plugin::getInstance()->getOption('port');
     if (!empty($port) and is_numeric($port)) {
         $url .= ':' . $port;
     }
     if ($remove) {
         $this->baseUrl = $url . remove_query_arg($remove);
     } else {
         $this->baseUrl = $url . $_SERVER['REQUEST_URI'];
     }
     parent::__construct();
     // add special filter for url fields
     $this->input->addFilter(create_function('$str', 'return "http://" == $str || "ftp://" == $str ? "" : $str;'));
     // enqueue required sripts and styles
     global $wp_styles;
     if (!is_a($wp_styles, 'WP_Styles')) {
         $wp_styles = new WP_Styles();
     }
     wp_enqueue_style('jquery-ui', WP_ALL_IMPORT_ROOT_URL . '/static/js/jquery/css/redmond/jquery-ui.css');
     wp_enqueue_style('jquery-tipsy', WP_ALL_IMPORT_ROOT_URL . '/static/js/jquery/css/smoothness/jquery.tipsy.css');
     wp_enqueue_style('pmxi-admin-style', WP_ALL_IMPORT_ROOT_URL . '/static/css/admin.css', array(), PMXI_VERSION);
     wp_enqueue_style('pmxi-admin-style-ie', WP_ALL_IMPORT_ROOT_URL . '/static/css/admin-ie.css');
     wp_enqueue_style('jquery-select2', WP_ALL_IMPORT_ROOT_URL . '/static/js/jquery/css/select2/select2.css');
     wp_enqueue_style('jquery-select2', WP_ALL_IMPORT_ROOT_URL . '/static/js/jquery/css/select2/select2-bootstrap.css');
     add_editor_style(WP_ALL_IMPORT_ROOT_URL . '/static/css/custom-editor-style.css');
     wp_enqueue_style('jquery-codemirror', WP_ALL_IMPORT_ROOT_URL . '/static/codemirror/codemirror.css', array(), PMXI_VERSION);
     $wp_styles->add_data('pmxi-admin-style-ie', 'conditional', 'lte IE 7');
     wp_enqueue_style('wp-pointer');
     if (version_compare(get_bloginfo('version'), '3.8-RC1') >= 0) {
         wp_enqueue_style('pmxi-admin-style-wp-3.8', WP_ALL_IMPORT_ROOT_URL . '/static/css/admin-wp-3.8.css');
     }
     if (version_compare(get_bloginfo('version'), '4.0-beta3') >= 0) {
         wp_enqueue_style('pmxi-admin-style-wp-3.8', WP_ALL_IMPORT_ROOT_URL . '/static/css/admin-wp-4.0.css');
     }
     $scheme_color = get_user_option('admin_color') and is_file(PMXI_Plugin::ROOT_DIR . '/static/css/admin-colors-' . $scheme_color . '.css') or $scheme_color = 'fresh';
     if (is_file(PMXI_Plugin::ROOT_DIR . '/static/css/admin-colors-' . $scheme_color . '.css')) {
         wp_enqueue_style('pmxi-admin-style-color', WP_ALL_IMPORT_ROOT_URL . '/static/css/admin-colors-' . $scheme_color . '.css');
     }
     wp_enqueue_script('jquery-ui-datepicker', WP_ALL_IMPORT_ROOT_URL . '/static/js/jquery/ui.datepicker.js', 'jquery-ui-core');
     //wp_enqueue_script('wp-all-import-autocomplete', WP_ALL_IMPORT_ROOT_URL . '/static/js/jquery/ui.autocomplete.js', array('jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-position'));
     wp_enqueue_script('jquery-tipsy', WP_ALL_IMPORT_ROOT_URL . '/static/js/jquery/jquery.tipsy.js', 'jquery');
     wp_enqueue_script('jquery-nestable', WP_ALL_IMPORT_ROOT_URL . '/static/js/jquery/jquery.mjs.nestedSortable.js', array('jquery', 'jquery-ui-dialog', 'jquery-ui-sortable', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-tabs', 'jquery-ui-progressbar'));
     wp_enqueue_script('jquery-moment', WP_ALL_IMPORT_ROOT_URL . '/static/js/jquery/moment.js', 'jquery');
     wp_enqueue_script('jquery-select2', WP_ALL_IMPORT_ROOT_URL . '/static/js/jquery/select2.min.js', 'jquery');
     wp_enqueue_script('jquery-ddslick', WP_ALL_IMPORT_ROOT_URL . '/static/js/jquery/jquery.ddslick.min.js', 'jquery');
     wp_enqueue_script('jquery-contextmenu', WP_ALL_IMPORT_ROOT_URL . '/static/js/jquery/jquery.ui-contextmenu.min.js', array('jquery', 'jquery-ui-menu'));
     wp_enqueue_script('jquery-codemirror', WP_ALL_IMPORT_ROOT_URL . '/static/codemirror/codemirror.js', array(), PMXI_VERSION);
     wp_enqueue_script('jquery-codemirror-matchbrackets', WP_ALL_IMPORT_ROOT_URL . '/static/codemirror/matchbrackets.js', array('jquery-codemirror'), PMXI_VERSION);
     wp_enqueue_script('jquery-codemirror-htmlmixed', WP_ALL_IMPORT_ROOT_URL . '/static/codemirror/htmlmixed.js', array('jquery-codemirror-matchbrackets'), PMXI_VERSION);
     wp_enqueue_script('jquery-codemirror-xml', WP_ALL_IMPORT_ROOT_URL . '/static/codemirror/xml.js', array('jquery-codemirror-htmlmixed'), PMXI_VERSION);
     wp_enqueue_script('jquery-codemirror-javascript', WP_ALL_IMPORT_ROOT_URL . '/static/codemirror/javascript.js', array('jquery-codemirror-xml'), PMXI_VERSION);
     wp_enqueue_script('jquery-codemirror-clike', WP_ALL_IMPORT_ROOT_URL . '/static/codemirror/clike.js', array('jquery-codemirror-javascript'), PMXI_VERSION);
     wp_enqueue_script('jquery-codemirror-php', WP_ALL_IMPORT_ROOT_URL . '/static/codemirror/php.js', array('jquery-codemirror-clike'), PMXI_VERSION);
     wp_enqueue_script('wp-pointer');
     /* load plupload scripts */
     wp_deregister_script('swfupload-all');
     wp_deregister_script('swfupload-handlers');
     wp_enqueue_script('swfupload-handlers', site_url() . "/wp-includes/js/swfupload/handlers.js", array('jquery'), '2201-20100523');
     wp_enqueue_script('jquery-browserplus-min', WP_ALL_IMPORT_ROOT_URL . '/static/js/jquery/browserplus-min.js', array('jquery'));
     wp_enqueue_script('full-plupload', WP_ALL_IMPORT_ROOT_URL . '/static/js/plupload/plupload.full.js', array('jquery-browserplus-min'));
     wp_enqueue_script('jquery-plupload', WP_ALL_IMPORT_ROOT_URL . '/static/js/plupload/wplupload.js', array('full-plupload', 'jquery'));
     wp_enqueue_script('pmxi-admin-script', WP_ALL_IMPORT_ROOT_URL . '/static/js/admin.js', array('jquery', 'jquery-ui-dialog', 'jquery-ui-datepicker', 'jquery-ui-draggable', 'jquery-ui-droppable', 'jquery-ui-core', 'jquery-ui-widget', 'jquery-ui-position', 'jquery-ui-autocomplete'), PMXI_VERSION);
 }
/**
 * 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.
 *
 * @package WordPress
 * @since 2.3.0
 * @uses $wp_styles WordPress Styles Object
 *
 * @param string $file Style handle name or file name (without ".css" extension) relative 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 ) {
	global $wp_styles;
	if ( !is_a($wp_styles, 'WP_Styles') )
		$wp_styles = new WP_Styles();

	// 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;
	}

	echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . clean_url( wp_admin_css_uri( $file ) ) . "' type='text/css' />\n", $file );
	if ( 'rtl' == get_bloginfo( 'text_direction' ) )
		echo apply_filters( 'wp_admin_css', "<link rel='stylesheet' href='" . clean_url( wp_admin_css_uri( "$file-rtl" ) ) . "' type='text/css' />\n", "$file-rtl" );
}
/**
 * Prints the styles queue in the HTML head on admin pages.
 *
 * @since 2.8
 */
function print_admin_styles()
{
    global $wp_styles, $concatenate_scripts, $compress_css;
    if (!is_a($wp_styles, 'WP_Styles')) {
        $wp_styles = new WP_Styles();
    }
    script_concat_settings();
    $wp_styles->do_concat = $concatenate_scripts;
    $zip = $compress_css ? 1 : 0;
    if ($zip && defined('ENFORCE_GZIP') && ENFORCE_GZIP) {
        $zip = 'gzip';
    }
    $wp_styles->do_items(false);
    if (apply_filters('print_admin_styles', true)) {
        _print_styles();
    }
    $wp_styles->reset();
    return $wp_styles->done;
}
 function jitm_enqueue_files($hook)
 {
     $wp_styles = new WP_Styles();
     $min = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
     wp_enqueue_style('jetpack-jitm-css', plugins_url("css/jetpack-admin-jitm{$min}.css", JETPACK__PLUGIN_FILE), false, JETPACK__VERSION . '-201243242');
     $wp_styles->add_data('jetpack-jitm-css', 'rtl', true);
     //Build stats url for tracking manage button
     $jitm_stats_url = Jetpack::build_stats_url(array('x_jetpack-jitm' => 'wordpresstools'));
     // Enqueue javascript to handle jitm notice events
     wp_enqueue_script('jetpack-jitm-js', plugins_url('_inc/jetpack-jitm.js', JETPACK__PLUGIN_FILE), array('jquery'), JETPACK__VERSION, true);
     wp_localize_script('jetpack-jitm-js', 'jitmL10n', array('ajaxurl' => admin_url('admin-ajax.php'), 'jitm_nonce' => wp_create_nonce('jetpack-jitm-nonce'), 'photon_msgs' => array('success' => esc_html__('Success! Photon is now actively optimizing and serving your images for free.', 'jetpack'), 'fail' => esc_html__('We are sorry but unfortunately Photon did not activate.', 'jetpack')), 'manage_msgs' => array('success' => esc_html__('Success! WordPress.com tools are now active.', 'jetpack'), 'fail' => esc_html__('We are sorry but unfortunately Manage did not activate.', 'jetpack')), 'stats_msgs' => array('success' => esc_html__('Success! Stats are now active.', 'jetpack'), 'fail' => esc_html__('We are sorry but unfortunately Stats did not activate.', 'jetpack')), 'jitm_stats_url' => $jitm_stats_url));
 }
Esempio n. 27
0
function sp_combine_plugin_css_files()
{
    global $sp_plugin_styles, $spDevice;
    if (!is_a($sp_plugin_styles, 'WP_Styles')) {
        $sp_plugin_styles = new WP_Styles();
    }
    # save copy of styles in case of failure writing
    $saved_styles = clone $sp_plugin_styles;
    # check for standard theme or mobile
    if ($spDevice == 'mobile') {
        $option = 'sp_css_concat_mobile';
    } else {
        if ($spDevice == 'tablet') {
            $option = 'sp_css_concat_tablet';
        } else {
            $option = 'sp_css_concat';
        }
    }
    $css_concat = sp_get_option($option);
    if (!is_array($css_concat)) {
        $css_concat = array();
    }
    $css_files_modify = array();
    $css_files = array();
    if (is_array($sp_plugin_styles->queue)) {
        # is there anything in the queue?
        $sp_plugin_styles->all_deps($sp_plugin_styles->queue);
        # preparing the queue taking dependencies into account
        foreach ($css_concat as $css => $value) {
            # going through all the already found css files, checking that they are still required
            if (!in_array(substr($css, 4), $sp_plugin_styles->to_do) && substr($css, 0, 4) == 'css-') {
                # if the css is not queued, rewrite the file
                $css_media = $value['type'];
                $css_files_modify[$css_media] = true;
                unset($css_concat[$css]);
            }
        }
        foreach ($sp_plugin_styles->to_do as $css) {
            $css_src = $sp_plugin_styles->registered[$css]->src;
            $css_media = $sp_plugin_styles->registered[$css]->args;
            # is the css is hosted localy AND is a css file?
            if ((!(strpos($css_src, get_bloginfo('url')) === false) || substr($css_src, 0, 1) === '/' || substr($css_src, 0, 1) === '.') && (substr($css_src, strrpos($css_src, '.'), 4) == '.css' || substr($css_src, strrpos($css_src, '.'), 4) == '.php')) {
                if (!is_array($css_files) || !array_key_exists($css_media, $css_files)) {
                    $css_files[$css_media] = array();
                }
                if (strpos($css_src, get_bloginfo('url')) === false) {
                    $css_relative_url = substr($css_src, 1);
                } else {
                    $css_relative_url = substr($css_src, strlen(get_bloginfo('url')) + 1);
                }
                if (strpos($css_relative_url, '?')) {
                    $css_relative_url = substr($css_relative_url, 0, strpos($css_relative_url, '?'));
                }
                # removing parameters
                $css_m_time = null;
                @($css_m_time = filemtime($css_relative_url));
                # getting the mofified time of the css file. extracting the file's dir
                if ($css_m_time) {
                    # only add the file if it's accessible
                    # check for php theme file indicating main theme file and save whole url vs just relative
                    if (substr($css_src, strrpos($css_src, '.'), 4) == '.php') {
                        array_push($css_files[$css_media], $css_src);
                    } else {
                        array_push($css_files[$css_media], $css_relative_url);
                    }
                    if (!file_exists(SP_COMBINED_CACHE_DIR . SP_COMBINED_CSS_BASE_NAME . $css_media . '.css') || isset($css_concat['css-' . $css]) && ($css_m_time != $css_concat['css-' . $css]['modified'] || $css_concat['css-' . $css]['type'] != $css_media) || !isset($css_concat['css-' . $css])) {
                        # css file is first identified
                        $css_files_modify[$css_media] = true;
                        # the combined file containing this media type css should be changed
                        if (isset($css_concat['css-' . $css]) && $css_concat['css-' . $css]['type'] != $css_media) {
                            # if the media type changed - rewrite both css files
                            $tmp = $css_concat['css-' . $css]['type'];
                            $css_files_modify[$tmp] = true;
                        }
                        if (!is_array($css_concat['css-' . $css])) {
                            $css_concat['css-' . $css] = array();
                        }
                        $css_concat['css-' . $css]['modified'] = $css_m_time;
                        # write the new modified date
                        $css_concat['css-' . $css]['type'] = $css_media;
                    }
                    $sp_plugin_styles->remove($css);
                    # removes the css file from the queue
                }
            }
        }
    }
    foreach ($css_files_modify as $key => $value) {
        $combined_file = fopen(SP_COMBINED_CACHE_DIR . SP_COMBINED_CSS_BASE_NAME . $key . '.css', 'w');
        if ($combined_file) {
            $css_content = '';
            if (is_array($css_files[$key])) {
                foreach ($css_files[$key] as $css_src) {
                    $css_content .= "\n" . sp_get_css_content($css_src) . "\n";
                }
            }
            if (!isset($css_concat['ver'][$key])) {
                $css_concat['ver'][$key] = 0;
            }
            $css_concat['ver'][$key]++;
            # compress the css before writing it out
            require 'sp-api-class-css-compressor.php';
            $css_content = Minify_CSS_Compressor::process($css_content);
            fwrite($combined_file, $css_content);
            fclose($combined_file);
        } else {
            # couldnt open file for writing so revert back to enqueueing all the styles
            if (!empty($saved_styles)) {
                foreach ($saved_styles->queue as $handle) {
                    wp_enqueue_style($handle, $saved_styles->registered[$handle]->src);
                }
            }
            return;
            # enqueued through wp now so bail
        }
    }
    foreach ($css_files as $key => $value) {
        # enqueue the combined css files
        wp_enqueue_style(SP_COMBINED_CSS_BASE_NAME . $key, SP_COMBINED_CACHE_URL . SP_COMBINED_CSS_BASE_NAME . $key . '.css', array(), $css_concat['ver'][$key]);
    }
    sp_update_option($option, $css_concat);
}
Esempio n. 28
0
 /**
  * Prints specific styles.
  *
  * @param string|array $print A string, or an array of specific handles to print.
  */
 public function print_styles($print)
 {
     $this->check_arg_types(array('string', 'array'), func_get_args());
     $print = (array) $print;
     // Force an array value.
     global $wp_styles;
     // Global object reference.
     if (!$wp_styles instanceof \WP_Styles) {
         $wp_styles = new \WP_Styles();
     }
     foreach ($print = array_unique($print) as $_key => $_handle) {
         if (!$this->©string->is_not_empty($_handle) || !wp_style_is($_handle, 'registered')) {
             unset($print[$_key]);
         }
     }
     // Remove (NOT a handle, or NOT registered).
     unset($_key, $_handle);
     // Housekeeping.
     if ($print) {
         // Still have something to print?
         $wp_styles->do_items($print);
     }
 }
Esempio n. 29
0
/**
 * Assign default styles to $styles object.
 *
 * Nothing is returned, because the $styles parameter is passed by reference.
 * Meaning that whatever object is passed will be updated without having to
 * reassign the variable that was passed back to the same value. This saves
 * memory.
 *
 * Adding default styles is not the only task, it also assigns the base_url
 * property, the default version, and text direction for the object.
 *
 * @since 2.6.0
 *
 * @param WP_Styles $styles
 */
function wp_default_styles(&$styles)
{
    include ABSPATH . WPINC . '/version.php';
    // include an unmodified $wp_version
    if (!defined('SCRIPT_DEBUG')) {
        define('SCRIPT_DEBUG', false !== strpos($wp_version, '-src'));
    }
    if (!($guessurl = site_url())) {
        $guessurl = wp_guess_url();
    }
    $styles->base_url = $guessurl;
    $styles->content_url = defined('WP_CONTENT_URL') ? WP_CONTENT_URL : '';
    $styles->default_version = get_bloginfo('version');
    $styles->text_direction = function_exists('is_rtl') && is_rtl() ? 'rtl' : 'ltr';
    $styles->default_dirs = array('/wp-admin/', '/wp-includes/css/');
    $open_sans_font_url = '';
    /* translators: If there are characters in your language that are not supported
     * by Open Sans, translate this to 'off'. Do not translate into your own language.
     */
    if ('off' !== _x('on', 'Open Sans font: on or off')) {
        $subsets = 'latin,latin-ext';
        /* translators: To add an additional Open Sans character subset specific to your language,
         * translate this to 'greek', 'cyrillic' or 'vietnamese'. Do not translate into your own language.
         */
        $subset = _x('no-subset', 'Open Sans font: add new subset (greek, cyrillic, vietnamese)');
        if ('cyrillic' == $subset) {
            $subsets .= ',cyrillic,cyrillic-ext';
        } elseif ('greek' == $subset) {
            $subsets .= ',greek,greek-ext';
        } elseif ('vietnamese' == $subset) {
            $subsets .= ',vietnamese';
        }
        // Hotlink Open Sans, for now
        $open_sans_font_url = "https://fonts.googleapis.com/css?family=Open+Sans:300italic,400italic,600italic,300,400,600&subset={$subsets}";
    }
    // Register a stylesheet for the selected admin color scheme.
    $styles->add('colors', true, array('wp-admin', 'buttons', 'open-sans', 'dashicons'));
    $suffix = SCRIPT_DEBUG ? '' : '.min';
    // Admin CSS
    $styles->add('wp-admin', "/wp-admin/css/wp-admin{$suffix}.css", array('open-sans', 'dashicons'));
    $styles->add('login', "/wp-admin/css/login{$suffix}.css", array('buttons', 'open-sans', 'dashicons'));
    $styles->add('install', "/wp-admin/css/install{$suffix}.css", array('buttons', 'open-sans'));
    $styles->add('wp-color-picker', "/wp-admin/css/color-picker{$suffix}.css");
    $styles->add('customize-controls', "/wp-admin/css/customize-controls{$suffix}.css", array('wp-admin', 'colors', 'ie', 'imgareaselect'));
    $styles->add('customize-widgets', "/wp-admin/css/customize-widgets{$suffix}.css", array('wp-admin', 'colors'));
    $styles->add('customize-nav-menus', "/wp-admin/css/customize-nav-menus{$suffix}.css", array('wp-admin', 'colors'));
    $styles->add('press-this', "/wp-admin/css/press-this{$suffix}.css", array('open-sans', 'buttons'));
    $styles->add('ie', "/wp-admin/css/ie{$suffix}.css");
    $styles->add_data('ie', 'conditional', 'lte IE 7');
    // Common dependencies
    $styles->add('buttons', "/wp-includes/css/buttons{$suffix}.css");
    $styles->add('dashicons', "/wp-includes/css/dashicons{$suffix}.css");
    $styles->add('open-sans', $open_sans_font_url);
    // Includes CSS
    $styles->add('admin-bar', "/wp-includes/css/admin-bar{$suffix}.css", array('open-sans', 'dashicons'));
    $styles->add('wp-auth-check', "/wp-includes/css/wp-auth-check{$suffix}.css", array('dashicons'));
    $styles->add('editor-buttons', "/wp-includes/css/editor{$suffix}.css", array('dashicons'));
    $styles->add('media-views', "/wp-includes/css/media-views{$suffix}.css", array('buttons', 'dashicons', 'wp-mediaelement'));
    $styles->add('wp-pointer', "/wp-includes/css/wp-pointer{$suffix}.css", array('dashicons'));
    $styles->add('customize-preview', "/wp-includes/css/customize-preview{$suffix}.css");
    // External libraries and friends
    $styles->add('imgareaselect', '/wp-includes/js/imgareaselect/imgareaselect.css', array(), '0.9.8');
    $styles->add('wp-jquery-ui-dialog', "/wp-includes/css/jquery-ui-dialog{$suffix}.css", array('dashicons'));
    $styles->add('mediaelement', "/wp-includes/js/mediaelement/mediaelementplayer.min.css", array(), '2.17.0');
    $styles->add('wp-mediaelement', "/wp-includes/js/mediaelement/wp-mediaelement.css", array('mediaelement'));
    $styles->add('thickbox', '/wp-includes/js/thickbox/thickbox.css', array('dashicons'));
    // Deprecated CSS
    $styles->add('media', "/wp-admin/css/deprecated-media{$suffix}.css");
    $styles->add('farbtastic', '/wp-admin/css/farbtastic.css', array(), '1.3u1');
    $styles->add('jcrop', "/wp-includes/js/jcrop/jquery.Jcrop.min.css", array(), '0.9.12');
    $styles->add('colors-fresh', false, array('wp-admin', 'buttons'));
    // Old handle.
    // RTL CSS
    $rtl_styles = array('wp-admin', 'install', 'wp-color-picker', 'customize-controls', 'customize-widgets', 'customize-nav-menus', 'ie', 'login', 'press-this', 'buttons', 'admin-bar', 'wp-auth-check', 'editor-buttons', 'media-views', 'wp-pointer', 'wp-jquery-ui-dialog', 'media', 'farbtastic');
    foreach ($rtl_styles as $rtl_style) {
        $styles->add_data($rtl_style, 'rtl', 'replace');
        if ($suffix) {
            $styles->add_data($rtl_style, 'suffix', $suffix);
        }
    }
}
Esempio n. 30
0
/**
 * Register the GlotPress styles
 *
 * @param WP_Styles $styles
 */
function gp_styles_default(&$styles)
{
    $url = gp_plugin_url('assets/css');
    $styles->add('base', $url . '/style.css', array(), '20150717');
}