本文整理汇总了PHP中WP_Styles类的典型用法代码示例。如果您正苦于以下问题:PHP WP_Styles类的具体用法?PHP WP_Styles怎么用?PHP WP_Styles使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WP_Styles类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
示例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'))));
}
示例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'));
}
示例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);
}
示例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;
}
示例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();
}
示例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>";
}
示例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);
}
示例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();
}
示例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;
}
示例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;
}
示例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;
}
示例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);
}
示例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;
}