| [ Index ] |
PHP Cross Reference of Wordpress 2.7.1 |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * BackPress Styles enqueue. 4 * 5 * These classes were refactored from the WordPress WP_Scripts and WordPress 6 * script enqueue API. 7 * 8 * @package BackPress 9 * @since r74 10 */ 11 12 /** 13 * BackPress Styles enqueue class. 14 * 15 * @package BackPress 16 * @uses WP_Dependencies 17 * @since r74 18 */ 19 class WP_Styles extends WP_Dependencies { 20 var $base_url; 21 var $default_version; 22 var $text_direction = 'ltr'; 23 24 function __construct() { 25 do_action_ref_array( 'wp_default_styles', array(&$this) ); 26 } 27 28 function do_item( $handle ) { 29 if ( !parent::do_item($handle) ) 30 return false; 31 32 $ver = $this->registered[$handle]->ver ? $this->registered[$handle]->ver : $this->default_version; 33 if ( isset($this->args[$handle]) ) 34 $ver .= '&' . $this->args[$handle]; 35 36 if ( isset($this->registered[$handle]->args) ) 37 $media = attribute_escape( $this->registered[$handle]->args ); 38 else 39 $media = 'all'; 40 41 $href = $this->_css_href( $this->registered[$handle]->src, $ver, $handle ); 42 43 $end_cond = ''; 44 if ( isset($this->registered[$handle]->extra['conditional']) && $this->registered[$handle]->extra['conditional'] ) { 45 echo "<!--[if {$this->registered[$handle]->extra['conditional']}]>\n"; 46 $end_cond = "<![endif]-->\n"; 47 } 48 49 echo apply_filters( 'style_loader_tag', "<link rel='stylesheet' href='$href' type='text/css' media='$media' />\n", $handle ); 50 if ( 'rtl' === $this->text_direction && isset($this->registered[$handle]->extra['rtl']) && $this->registered[$handle]->extra['rtl'] ) { 51 if ( is_bool( $this->registered[$handle]->extra['rtl'] ) ) 52 $rtl_href = str_replace( '.css', '-rtl.css', $href ); 53 else 54 $rtl_href = $this->_css_href( $this->registered[$handle]->extra['rtl'], $ver, "$handle-rtl" ); 55 56 echo apply_filters( 'style_loader_tag', "<link rel='stylesheet' href='$rtl_href' type='text/css' media='$media' />\n", $handle ); 57 } 58 59 echo $end_cond; 60 61 // Could do something with $this->registered[$handle]->extra here to print out extra CSS rules 62 // echo "<style type='text/css'>\n"; 63 // echo "/* <![CDATA[ */\n"; 64 // echo "/* ]]> */\n"; 65 // echo "</style>\n"; 66 67 return true; 68 } 69 70 function all_deps( $handles, $recursion = false ) { 71 $r = parent::all_deps( $handles, $recursion ); 72 if ( !$recursion ) 73 $this->to_do = apply_filters( 'print_styles_array', $this->to_do ); 74 return $r; 75 } 76 77 function _css_href( $src, $ver, $handle ) { 78 if ( !preg_match('|^https?://|', $src) && !preg_match('|^' . preg_quote(WP_CONTENT_URL) . '|', $src) ) { 79 $src = $this->base_url . $src; 80 } 81 82 $src = add_query_arg('ver', $ver, $src); 83 $src = apply_filters( 'style_loader_src', $src, $handle ); 84 return clean_url( $src ); 85 } 86 87 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
| Generated: Mon Mar 23 16:23:02 2009 | Cross-referenced by PHPXref 0.7 |