本文整理汇总了PHP中WP_Styles::do_items方法的典型用法代码示例。如果您正苦于以下问题:PHP WP_Styles::do_items方法的具体用法?PHP WP_Styles::do_items怎么用?PHP WP_Styles::do_items使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WP_Styles
的用法示例。
在下文中一共展示了WP_Styles::do_items方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: wp_print_styles
/**
* Display styles that are in the $handles queue.
*
* Passing an empty array to $handles prints the queue,
* passing an array with one string prints that style,
* and passing an array of strings prints those styles.
*
* @global WP_Styles $wp_styles The WP_Styles object for printing styles.
*
* @since 2.6.0
*
* @param string|bool|array $handles Styles to be printed. Default 'false'.
* @return array On success, a processed array of WP_Dependencies items; otherwise, an empty array.
*/
function wp_print_styles($handles = false)
{
if ('' === $handles) {
// for wp_head
$handles = false;
}
/**
* Fires before styles in the $handles queue are printed.
*
* @since 2.6.0
*/
if (!$handles) {
do_action('wp_print_styles');
}
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');
}
if (!$handles) {
return array();
} else {
$wp_styles = new WP_Styles();
}
}
return $wp_styles->do_items($handles);
}
示例2: array
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>";
}
示例3: wp_print_styles
/**
* Display styles that are in the queue or part of $handles.
*
* @since r79
* @uses do_action() Calls 'wp_print_styles' hook.
* @global object $wp_styles The WP_Styles object for printing styles.
*
* @param array|bool $handles Styles to be printed. An empty array prints the queue,
* an array with one string prints that style, and an array of strings prints those styles.
* @return bool True on success, false on failure.
*/
function wp_print_styles($handles = false)
{
do_action('wp_print_styles');
if ('' === $handles) {
// for wp_head
$handles = false;
}
global $wp_styles;
if (!is_a($wp_styles, 'WP_Styles')) {
if (!$handles) {
return array();
} else {
$wp_styles = new WP_Styles();
}
}
return $wp_styles->do_items($handles);
}
示例4: wp_print_styles
/**
* Display styles that are in the queue or part of $handles.
*
* @since r79
* @uses do_action() Calls 'wp_print_styles' hook.
* @global object $wp_styles The WP_Styles object for printing styles.
*
* @param array|bool $handles Styles to be printed. An empty array prints the queue,
* an array with one string prints that style, and an array of strings prints those styles.
* @return bool True on success, false on failure.
*/
function wp_print_styles( $handles = false ) {
do_action( 'wp_print_styles' );
if ( '' === $handles ) // for wp_head
$handles = false;
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' );
if ( !$handles )
return array(); // No need to instantiate if nothing is there.
else
$wp_styles = new WP_Styles();
}
return $wp_styles->do_items( $handles );
}
示例5: print_admin_styles
/**
* 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;
}
示例6: 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;
}
示例7: 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;
}
示例8: 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;
}
示例9: print_styles
/**
* 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);
}
}