Changeset 18464 for trunk/wp-includes/class.wp-styles.php
- Timestamp:
- 07/25/2011 12:36:06 AM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/class.wp-styles.php
r18446 r18464 26 26 var $do_concat = false; 27 27 var $print_html = ''; 28 var $print_code = ''; 28 29 var $default_dirs; 29 30 … … 36 37 return false; 37 38 38 if ( null === $this->registered[$handle]->ver ) 39 $obj = $this->registered[$handle]; 40 if ( null === $obj->ver ) 39 41 $ver = ''; 40 42 else 41 $ver = $ this->registered[$handle]->ver ? $this->registered[$handle]->ver : $this->default_version;43 $ver = $obj->ver ? $obj->ver : $this->default_version; 42 44 43 45 if ( isset($this->args[$handle]) ) … … 45 47 46 48 if ( $this->do_concat ) { 47 if ( $this->in_default_dir($ this->registered[$handle]->src) && !isset($this->registered[$handle]->extra['conditional']) && !isset($this->registered[$handle]->extra['alt']) ) {49 if ( $this->in_default_dir($obj->src) && !isset($obj->extra['conditional']) && !isset($obj->extra['alt']) ) { 48 50 $this->concat .= "$handle,"; 49 51 $this->concat_version .= "$handle$ver"; 52 53 if ( !empty($this->registered[$handle]->extra['data']) ) 54 $this->print_code .= $this->registered[$handle]->extra['data']; 55 50 56 return true; 51 57 } 52 58 } 53 59 54 if ( isset($ this->registered[$handle]->args) )55 $media = esc_attr( $ this->registered[$handle]->args );60 if ( isset($obj->args) ) 61 $media = esc_attr( $obj->args ); 56 62 else 57 63 $media = 'all'; 58 64 59 $href = $this->_css_href( $ this->registered[$handle]->src, $ver, $handle );60 $rel = isset($ this->registered[$handle]->extra['alt']) && $this->registered[$handle]->extra['alt'] ? 'alternate stylesheet' : 'stylesheet';61 $title = isset($ this->registered[$handle]->extra['title']) ? "title='" . esc_attr( $this->registered[$handle]->extra['title'] ) . "'" : '';65 $href = $this->_css_href( $obj->src, $ver, $handle ); 66 $rel = isset($obj->extra['alt']) && $obj->extra['alt'] ? 'alternate stylesheet' : 'stylesheet'; 67 $title = isset($obj->extra['title']) ? "title='" . esc_attr( $obj->extra['title'] ) . "'" : ''; 62 68 63 69 $end_cond = $tag = ''; 64 if ( isset($ this->registered[$handle]->extra['conditional']) && $this->registered[$handle]->extra['conditional'] ) {65 $tag .= "<!--[if {$ this->registered[$handle]->extra['conditional']}]>\n";70 if ( isset($obj->extra['conditional']) && $obj->extra['conditional'] ) { 71 $tag .= "<!--[if {$obj->extra['conditional']}]>\n"; 66 72 $end_cond = "<![endif]-->\n"; 67 73 } 68 74 69 75 $tag .= apply_filters( 'style_loader_tag', "<link rel='$rel' id='$handle-css' $title href='$href' type='text/css' media='$media' />\n", $handle ); 70 if ( 'rtl' === $this->text_direction && isset($ this->registered[$handle]->extra['rtl']) && $this->registered[$handle]->extra['rtl'] ) {71 if ( is_bool( $ this->registered[$handle]->extra['rtl'] ) ) {72 $suffix = isset( $ this->registered[$handle]->extra['suffix'] ) ? $this->registered[$handle]->extra['suffix'] : '';73 $rtl_href = str_replace( "{$suffix}.css", "-rtl{$suffix}.css", $this->_css_href( $ this->registered[$handle]->src , $ver, "$handle-rtl" ));76 if ( 'rtl' === $this->text_direction && isset($obj->extra['rtl']) && $obj->extra['rtl'] ) { 77 if ( is_bool( $obj->extra['rtl'] ) ) { 78 $suffix = isset( $obj->extra['suffix'] ) ? $obj->extra['suffix'] : ''; 79 $rtl_href = str_replace( "{$suffix}.css", "-rtl{$suffix}.css", $this->_css_href( $obj->src , $ver, "$handle-rtl" )); 74 80 } else { 75 $rtl_href = $this->_css_href( $ this->registered[$handle]->extra['rtl'], $ver, "$handle-rtl" );81 $rtl_href = $this->_css_href( $obj->extra['rtl'], $ver, "$handle-rtl" ); 76 82 } 77 83 … … 81 87 $tag .= $end_cond; 82 88 83 if ( $this->do_concat ) 89 if ( $this->do_concat ) { 84 90 $this->print_html .= $tag; 85 else 91 $this->print_html .= $this->print_inline_style( $handle, false ); 92 } else { 86 93 echo $tag; 94 $this->print_inline_style( $handle ); 95 } 87 96 88 // Could do something with $this->registered[$handle]->extra here to print out extra CSS rules 89 // echo "<style type='text/css'>\n"; 90 // echo "/* <![CDATA[ */\n"; 91 // echo "/* ]]> */\n"; 92 // echo "</style>\n"; 97 return true; 98 } 99 100 function add_inline_style( $handle, $data ) { 101 if ( !$data ) 102 return false; 103 104 if ( !empty( $this->registered[$handle]->extra['data'] ) ) 105 $data .= "\n" . $this->registered[$handle]->extra['data']; 106 107 return $this->add_data( $handle, 'data', $data ); 108 } 109 110 function print_inline_style( $handle, $echo = true ) { 111 if ( empty($this->registered[$handle]->extra['data']) ) 112 return false; 113 114 $output = $this->registered[$handle]->extra['data']; 115 116 if ( !$echo ) 117 return $output; 118 119 echo "<style type='text/css'>\n"; 120 echo "$output\n"; 121 echo "</style>\n"; 93 122 94 123 return true;
Note: See TracChangeset
for help on using the changeset viewer.