Ticket #35229: 35229.5.diff
File 35229.5.diff, 3.9 KB (added by , 9 years ago) |
---|
-
src/wp-includes/class.wp-dependencies.php
class WP_Dependencies { 86 86 * 87 87 * @param mixed $handles Optional. Items to be processed: Process queue (false), process item (string), process items (array of strings). 88 88 * @param mixed $group Group level: level (int), no groups (false). 89 89 * @return array Handles of items that have been processed. 90 90 */ 91 91 public function do_items( $handles = false, $group = false ) { 92 92 /* 93 93 * If nothing is passed, print the queue. If a string is passed, 94 94 * print that item. If an array is passed, print those items. 95 95 */ 96 96 $handles = false === $handles ? $this->queue : (array) $handles; 97 97 $this->all_deps( $handles ); 98 98 99 99 foreach ( $this->to_do as $key => $handle ) { 100 100 if ( !in_array($handle, $this->done, true) && isset($this->registered[$handle]) ) { 101 102 /*103 * A single item may alias a set of items, by having dependencies,104 * but no source. Queuing the item queues the dependencies.105 *106 * Example: The extending class WP_Scripts is used to register 'scriptaculous' as a set of registered handles:107 * <code>add( 'scriptaculous', false, array( 'scriptaculous-dragdrop', 'scriptaculous-slider', 'scriptaculous-controls' ) );</code>108 *109 * The src property is false.110 */111 if ( ! $this->registered[$handle]->src ) {112 $this->done[] = $handle;113 continue;114 }115 116 101 /* 117 102 * Attempt to process the item. If successful, 118 103 * add the handle to the done array. 119 104 * 120 105 * Unset the item from the to_do array. 121 106 */ 122 107 if ( $this->do_item( $handle, $group ) ) 123 108 $this->done[] = $handle; 124 109 125 110 unset( $this->to_do[$key] ); 126 111 } 127 112 } 128 113 129 114 return $this->done; 130 115 } -
src/wp-includes/class.wp-styles.php
class WP_Styles extends WP_Dependencies 60 60 if ( $this->in_default_dir($obj->src) && !isset($obj->extra['conditional']) && !isset($obj->extra['alt']) ) { 61 61 $this->concat .= "$handle,"; 62 62 $this->concat_version .= "$handle$ver"; 63 63 64 64 $this->print_code .= $this->print_inline_style( $handle, false ); 65 65 66 66 return true; 67 67 } 68 68 } 69 69 70 70 if ( isset($obj->args) ) 71 71 $media = esc_attr( $obj->args ); 72 72 else 73 73 $media = 'all'; 74 74 75 $href = $this->_css_href( $obj->src, $ver, $handle ); 76 if ( empty( $href ) ) { 77 // Turns out there is nothing to print. 75 if ( ! $obj->src ) { 76 if ( $inline_style = $this->print_inline_style( $handle, false ) ) { 77 $inline_style = sprintf( "<style id='%s-inline-css' type='text/css'>\n%s\n</style>\n", esc_attr( $handle ), $inline_style ); 78 if ( $this->do_concat ) { 79 $this->print_html .= $inline_style; 80 } else { 81 echo $inline_style; 82 } 83 } 78 84 return true; 79 85 } 86 // Patch note: $href should never have been empty, perhaps it meant `$osb->src`, it's always escaped as a URL nowdays. 87 $href = $this->_css_href( $obj->src, $ver, $handle ); 80 88 $rel = isset($obj->extra['alt']) && $obj->extra['alt'] ? 'alternate stylesheet' : 'stylesheet'; 81 89 $title = isset($obj->extra['title']) ? "title='" . esc_attr( $obj->extra['title'] ) . "'" : ''; 82 90 83 91 /** 84 92 * Filter the HTML link tag of an enqueued style. 85 93 * 86 94 * @since 2.6.0 87 95 * @since 4.3.0 Introduced the `$href` parameter. 88 96 * 89 97 * @param string $html The link tag for the enqueued style. 90 98 * @param string $handle The style's registered handle. 91 99 * @param string $href The stylesheet's source URL. 92 100 */ 93 101 $tag = apply_filters( 'style_loader_tag', "<link rel='$rel' id='$handle-css' $title href='$href' type='text/css' media='$media' />\n", $handle, $href ); 94 102 if ( 'rtl' === $this->text_direction && isset($obj->extra['rtl']) && $obj->extra['rtl'] ) {