-
+ 231DFAC3CB1F3E6310DE2886569510DA3AD4C66D07975BB49E0E98747E8719E409BEC7A52240B8BB5AEE0C50C24E0003DA7DA77938772E658F3EE70F93A03BF2
mp-wp/wp-includes/class.wp-styles.php
(0 . 0)(1 . 87)
81859 <?php
81860 /**
81861 * BackPress Styles enqueue.
81862 *
81863 * These classes were refactored from the WordPress WP_Scripts and WordPress
81864 * script enqueue API.
81865 *
81866 * @package BackPress
81867 * @since r74
81868 */
81869
81870 /**
81871 * BackPress Styles enqueue class.
81872 *
81873 * @package BackPress
81874 * @uses WP_Dependencies
81875 * @since r74
81876 */
81877 class WP_Styles extends WP_Dependencies {
81878 var $base_url;
81879 var $default_version;
81880 var $text_direction = 'ltr';
81881
81882 function __construct() {
81883 do_action_ref_array( 'wp_default_styles', array(&$this) );
81884 }
81885
81886 function do_item( $handle ) {
81887 if ( !parent::do_item($handle) )
81888 return false;
81889
81890 $ver = $this->registered[$handle]->ver ? $this->registered[$handle]->ver : $this->default_version;
81891 if ( isset($this->args[$handle]) )
81892 $ver .= '&' . $this->args[$handle];
81893
81894 if ( isset($this->registered[$handle]->args) )
81895 $media = attribute_escape( $this->registered[$handle]->args );
81896 else
81897 $media = 'all';
81898
81899 $href = $this->_css_href( $this->registered[$handle]->src, $ver, $handle );
81900
81901 $end_cond = '';
81902 if ( isset($this->registered[$handle]->extra['conditional']) && $this->registered[$handle]->extra['conditional'] ) {
81903 echo "<!--[if {$this->registered[$handle]->extra['conditional']}]>\n";
81904 $end_cond = "<![endif]-->\n";
81905 }
81906
81907 echo apply_filters( 'style_loader_tag', "<link rel='stylesheet' href='$href' type='text/css' media='$media' />\n", $handle );
81908 if ( 'rtl' === $this->text_direction && isset($this->registered[$handle]->extra['rtl']) && $this->registered[$handle]->extra['rtl'] ) {
81909 if ( is_bool( $this->registered[$handle]->extra['rtl'] ) )
81910 $rtl_href = str_replace( '.css', '-rtl.css', $href );
81911 else
81912 $rtl_href = $this->_css_href( $this->registered[$handle]->extra['rtl'], $ver, "$handle-rtl" );
81913
81914 echo apply_filters( 'style_loader_tag', "<link rel='stylesheet' href='$rtl_href' type='text/css' media='$media' />\n", $handle );
81915 }
81916
81917 echo $end_cond;
81918
81919 // Could do something with $this->registered[$handle]->extra here to print out extra CSS rules
81920 // echo "<style type='text/css'>\n";
81921 // echo "/* <![CDATA[ */\n";
81922 // echo "/* ]]> */\n";
81923 // echo "</style>\n";
81924
81925 return true;
81926 }
81927
81928 function all_deps( $handles, $recursion = false ) {
81929 $r = parent::all_deps( $handles, $recursion );
81930 if ( !$recursion )
81931 $this->to_do = apply_filters( 'print_styles_array', $this->to_do );
81932 return $r;
81933 }
81934
81935 function _css_href( $src, $ver, $handle ) {
81936 if ( !preg_match('|^https?://|', $src) && !preg_match('|^' . preg_quote(WP_CONTENT_URL) . '|', $src) ) {
81937 $src = $this->base_url . $src;
81938 }
81939
81940 $src = add_query_arg('ver', $ver, $src);
81941 $src = apply_filters( 'style_loader_src', $src, $handle );
81942 return clean_url( $src );
81943 }
81944
81945 }