source: trunk/www.guidonia.net/wp/wp-includes/functions.wp-styles.php@ 44

Last change on this file since 44 was 44, checked in by luciano, 15 years ago
File size: 2.5 KB
Line 
1<?php
2/**
3 * BackPress styles procedural API.
4 *
5 * @package BackPress
6 * @since r79
7 */
8
9/**
10 * Display styles that are in the queue or part of $handles.
11 *
12 * @since r79
13 * @uses do_action() Calls 'wp_print_styles' hook.
14 * @global object $wp_styles The WP_Styles object for printing styles.
15 *
16 * @param array $handles (optional) Styles to be printed. (void) prints queue, (string) prints that style, (array of strings) prints those styles.
17 * @return bool True on success, false on failure.
18 */
19function wp_print_styles( $handles = false ) {
20 do_action( 'wp_print_styles' );
21 if ( '' === $handles ) // for wp_head
22 $handles = false;
23
24 global $wp_styles;
25 if ( !is_a($wp_styles, 'WP_Styles') ) {
26 if ( !$handles )
27 return array(); // No need to instantiate if nothing's there.
28 else
29 $wp_styles = new WP_Styles();
30 }
31
32 return $wp_styles->do_items( $handles );
33}
34
35/**
36 * Register CSS style file.
37 *
38 * @since r79
39 * @see WP_Styles::add() For parameter and additional information.
40 */
41function wp_register_style( $handle, $src, $deps = array(), $ver = false, $media = 'all' ) {
42 global $wp_styles;
43 if ( !is_a($wp_styles, 'WP_Styles') )
44 $wp_styles = new WP_Styles();
45
46 $wp_styles->add( $handle, $src, $deps, $ver, $media );
47}
48
49/**
50 * Remove a registered CSS file.
51 *
52 * @since r79
53 * @see WP_Styles::remove() For parameter and additional information.
54 */
55function wp_deregister_style( $handle ) {
56 global $wp_styles;
57 if ( !is_a($wp_styles, 'WP_Styles') )
58 $wp_styles = new WP_Styles();
59
60 $wp_styles->remove( $handle );
61}
62
63/**
64 * Enqueue a CSS style file.
65 *
66 * @since r79
67 * @see WP_Styles::add(), WP_Styles::enqueue()
68 */
69function wp_enqueue_style( $handle, $src = false, $deps = array(), $ver = false, $media = false ) {
70 global $wp_styles;
71 if ( !is_a($wp_styles, 'WP_Styles') )
72 $wp_styles = new WP_Styles();
73
74 if ( $src ) {
75 $_handle = explode('?', $handle);
76 $wp_styles->add( $_handle[0], $src, $deps, $ver, $media );
77 }
78 $wp_styles->enqueue( $handle );
79}
80
81/**
82 * Check whether style has been added to WordPress Styles.
83 *
84 * The values for list defaults to 'queue', which is the same as enqueue for
85 * styles.
86 *
87 * @since WP unknown; BP unknown
88 *
89 * @param string $handle Handle used to add style.
90 * @param string $list Optional, defaults to 'queue'. Others values are 'registered', 'queue', 'done', 'to_do'
91 * @return bool
92 */
93function wp_style_is( $handle, $list = 'queue' ) {
94 global $wp_styles;
95 if ( !is_a($wp_styles, 'WP_Styles') )
96 $wp_styles = new WP_Styles();
97
98 $query = $wp_styles->query( $handle, $list );
99
100 if ( is_object( $query ) )
101 return true;
102
103 return $query;
104}
Note: See TracBrowser for help on using the repository browser.