Changeset 4398 for sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-site-cloner/includes/source-site-id-setting.php
- Timestamp:
- 11/22/2016 12:12:31 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
sites/trunk/wordcamp.org/public_html/wp-content/plugins/wordcamp-site-cloner/includes/source-site-id-setting.php
r4280 r4398 3 3 namespace WordCamp\Site_Cloner; 4 4 defined( 'WPINC' ) or die(); 5 6 use \WordCamp\RemoteCSS; 5 7 6 8 /** … … 48 50 49 51 switch_to_blog( $this->preview_source_site_id ); 50 printf( '<style id="wcsc-source-site-custom-css">%s</style>', \Jetpack_Custom_CSS::get_css( true ) ); 52 53 printf( 54 '<style id="wcsc-source-site-custom-css">%s %s</style>', 55 $this->get_cached_remote_css(), 56 \Jetpack_Custom_CSS::get_css( true ) 57 ); 58 51 59 restore_current_blog(); 52 60 } … … 107 115 108 116 /** 117 * Get the cached remote CSS for the current blog. 118 * 119 * @return string 120 */ 121 public function get_cached_remote_css() { 122 $remote_css = ''; 123 124 if ( ! function_exists( '\WordCamp\RemoteCSS\get_safe_css_post' ) ) { 125 return $remote_css; 126 } 127 128 $post = RemoteCSS\get_safe_css_post(); 129 130 if ( $post instanceof \WP_Post ) { 131 // Sanitization copied from \Jetpack_Custom_CSS::get_css() 132 // so that there is parity with how Jetpack outputs the CSS 133 $remote_css = str_replace( 134 array( '\\\00BB \\\0020', '\0BB \020', '0BB 020' ), 135 '\00BB \0020', 136 $post->post_content_filtered 137 ); 138 } 139 140 return $remote_css; 141 } 142 143 /** 109 144 * Clone the source site into the current site 110 145 * … … 124 159 } 125 160 126 $source_site_css = \Jetpack_Custom_CSS::get_css( false ); 161 $source_site_css = ''; 162 163 // Add Remote CSS first 164 // This maintains the correct cascading order of stylesheet rules 165 if ( $remote_css = $this->get_cached_remote_css() ) { 166 $source_site_css .= sprintf( 167 "/* %s */\n%s\n\n", 168 sprintf( 169 esc_html__( 'Remote CSS from %s', 'wordcamporg' ), 170 esc_url( get_option( 'wcrcss_remote_css_url' ) ) 171 ), 172 $remote_css 173 ); 174 } 175 176 // Add Jetpack Custom CSS second 177 if ( $custom_css = \Jetpack_Custom_CSS::get_css( false ) ) { 178 $source_site_css .= sprintf( 179 "/* %s */\n%s\n\n", 180 sprintf( 181 esc_html__( 'Custom CSS from %s', 'wordcamporg' ), 182 get_bloginfo( 'name' ) 183 ), 184 $custom_css 185 ); 186 } 187 127 188 $source_site_preprocessor = get_post_meta( $source_cite_css_post['ID'], 'custom_css_preprocessor', true ); 128 189 $source_site_mode = get_post_meta( $source_cite_css_post['ID'], 'custom_css_add', true );
Note: See TracChangeset
for help on using the changeset viewer.