本文整理汇总了PHP中WP_Styles类的典型用法代码示例。如果您正苦于以下问题:PHP WP_Styles类的具体用法?PHP WP_Styles怎么用?PHP WP_Styles使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WP_Styles类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: array
/**
* @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;
}
开发者ID:AshiqKiron,项目名称:wp-customize-partial-refresh,代码行数:12,代码来源:class-wp-customize-partial-refresh-plugin.php
示例2: __construct
/**
* 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);
}
开发者ID:soflyy,项目名称:wp-all-export,代码行数:59,代码来源:admin.php
示例3: jitm_enqueue_files
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'))));
}
开发者ID:tinggao,项目名称:woofWarrior,代码行数:10,代码来源:class.jetpack-jitm.php
示例4: __construct
/**
* 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'));
}
开发者ID:rebeccayshen,项目名称:kitlist,代码行数:58,代码来源:admin.php
示例5: wp_enqueue_style
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);
}
开发者ID:nurpax,项目名称:saastafi,代码行数:12,代码来源:functions.wp-styles.php
示例6: wp_style_is
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;
}
开发者ID:AgilData,项目名称:WordPress-Skeleton,代码行数:12,代码来源:_compat.php
示例7: wp_print_styles
/**
* 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();
}
开发者ID:semiologic,项目名称:sem-cache,代码行数:55,代码来源:asset-cache.php
示例8: do_styles
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>";
}
开发者ID:marchibbins,项目名称:dytorworks,代码行数:14,代码来源:Util.php
示例9: register_styles
/**
* 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);
}
开发者ID:xwp,项目名称:wp-customize-snapshots,代码行数:19,代码来源:class-plugin.php
示例10: __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();
}
开发者ID:stuttter,项目名称:wp-enqueue-masher,代码行数:14,代码来源:class-wp-css-concat.php
示例11: register_styles
/**
* 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;
}
开发者ID:BE-Webdesign,项目名称:wp-customize-widgets-plus,代码行数:18,代码来源:class-plugin.php
示例12: print_admin_styles
/**
* 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;
}
开发者ID:hachi4,项目名称:WordPress,代码行数:27,代码来源:script-loader.php
示例13: print_admin_styles
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;
}
开发者ID:Esleelkartea,项目名称:herramienta_para_autodiagnostico_ADEADA,代码行数:28,代码来源:script-loader.php
示例14: register_styles
/**
* 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);
}
开发者ID:chandra-patel,项目名称:wp-customize-rest-resources,代码行数:13,代码来源:class-plugin.php
示例15: print_admin_styles
/**
* 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;
}
开发者ID:stiyes,项目名称:ngionic,代码行数:31,代码来源:script-loader.php
示例16: wp_dequeue_style
function wp_dequeue_style($handle)
{
global $wp_styles;
if (!is_a($wp_styles, 'WP_Styles')) {
$wp_styles = new WP_Styles();
}
$wp_styles->dequeue($handle);
}
开发者ID:kidaa30,项目名称:Constant-Contact-WordPress-Plugin,代码行数:8,代码来源:form-designer.php
示例17: wp_style_is
/**
* 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;
}
开发者ID:staylor,项目名称:develop.svn.wordpress.org,代码行数:28,代码来源:functions.wp-styles.php
示例18: wp_admin_css
/**
* 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");
}
}
开发者ID:Harreh,项目名称:magicowl,代码行数:56,代码来源:general-template.php
示例19: wp_admin_css
/**
* 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");
}
}
开发者ID:batruji,项目名称:metareading,代码行数:45,代码来源:general-template.php
示例20: wp_style_is
/**
* 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);
}
开发者ID:luskyj89,项目名称:mt-wordpress,代码行数:23,代码来源:functions.wp-styles.php
注:本文中的WP_Styles类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论