mp-wp_genesis 1 <?php
mp-wp_genesis 2 /**
mp-wp_genesis 3 * BackPress styles procedural API.
mp-wp_genesis 4 *
mp-wp_genesis 5 * @package BackPress
mp-wp_genesis 6 * @since r79
mp-wp_genesis 7 */
mp-wp_genesis 8
mp-wp_genesis 9 /**
mp-wp_genesis 10 * Display styles that are in the queue or part of $handles.
mp-wp_genesis 11 *
mp-wp_genesis 12 * @since r79
mp-wp_genesis 13 * @uses do_action() Calls 'wp_print_styles' hook.
mp-wp_genesis 14 * @global object $wp_styles The WP_Styles object for printing styles.
mp-wp_genesis 15 *
mp-wp_genesis 16 * @param array $handles (optional) Styles to be printed. (void) prints queue, (string) prints that style, (array of strings) prints those styles.
mp-wp_genesis 17 * @return bool True on success, false on failure.
mp-wp_genesis 18 */
mp-wp_genesis 19 function wp_print_styles( $handles = false ) {
mp-wp_genesis 20 do_action( 'wp_print_styles' );
mp-wp_genesis 21 if ( '' === $handles ) // for wp_head
mp-wp_genesis 22 $handles = false;
mp-wp_genesis 23
mp-wp_genesis 24 global $wp_styles;
mp-wp_genesis 25 if ( !is_a($wp_styles, 'WP_Styles') ) {
mp-wp_genesis 26 if ( !$handles )
mp-wp_genesis 27 return array(); // No need to instantiate if nothing's there.
mp-wp_genesis 28 else
mp-wp_genesis 29 $wp_styles = new WP_Styles();
mp-wp_genesis 30 }
mp-wp_genesis 31
mp-wp_genesis 32 return $wp_styles->do_items( $handles );
mp-wp_genesis 33 }
mp-wp_genesis 34
mp-wp_genesis 35 /**
mp-wp_genesis 36 * Register CSS style file.
mp-wp_genesis 37 *
mp-wp_genesis 38 * @since r79
mp-wp_genesis 39 * @see WP_Styles::add() For parameter and additional information.
mp-wp_genesis 40 */
mp-wp_genesis 41 function wp_register_style( $handle, $src, $deps = array(), $ver = false, $media = 'all' ) {
mp-wp_genesis 42 global $wp_styles;
mp-wp_genesis 43 if ( !is_a($wp_styles, 'WP_Styles') )
mp-wp_genesis 44 $wp_styles = new WP_Styles();
mp-wp_genesis 45
mp-wp_genesis 46 $wp_styles->add( $handle, $src, $deps, $ver, $media );
mp-wp_genesis 47 }
mp-wp_genesis 48
mp-wp_genesis 49 /**
mp-wp_genesis 50 * Remove a registered CSS file.
mp-wp_genesis 51 *
mp-wp_genesis 52 * @since r79
mp-wp_genesis 53 * @see WP_Styles::remove() For parameter and additional information.
mp-wp_genesis 54 */
mp-wp_genesis 55 function wp_deregister_style( $handle ) {
mp-wp_genesis 56 global $wp_styles;
mp-wp_genesis 57 if ( !is_a($wp_styles, 'WP_Styles') )
mp-wp_genesis 58 $wp_styles = new WP_Styles();
mp-wp_genesis 59
mp-wp_genesis 60 $wp_styles->remove( $handle );
mp-wp_genesis 61 }
mp-wp_genesis 62
mp-wp_genesis 63 /**
mp-wp_genesis 64 * Enqueue a CSS style file.
mp-wp_genesis 65 *
mp-wp_genesis 66 * @since r79
mp-wp_genesis 67 * @see WP_Styles::add(), WP_Styles::enqueue()
mp-wp_genesis 68 */
mp-wp_genesis 69 function wp_enqueue_style( $handle, $src = false, $deps = array(), $ver = false, $media = false ) {
mp-wp_genesis 70 global $wp_styles;
mp-wp_genesis 71 if ( !is_a($wp_styles, 'WP_Styles') )
mp-wp_genesis 72 $wp_styles = new WP_Styles();
mp-wp_genesis 73
mp-wp_genesis 74 if ( $src ) {
mp-wp_genesis 75 $_handle = explode('?', $handle);
mp-wp_genesis 76 $wp_styles->add( $_handle[0], $src, $deps, $ver, $media );
mp-wp_genesis 77 }
mp-wp_genesis 78 $wp_styles->enqueue( $handle );
mp-wp_genesis 79 }