Ticket #11512: add_editor_style.4.diff
File add_editor_style.4.diff, 3.1 KB (added by , 14 years ago) |
---|
-
wp-admin/includes/post.php
1305 1305 * @param mixed $settings optional An array that can add to or overwrite the default TinyMCE settings. 1306 1306 */ 1307 1307 function wp_tiny_mce( $teeny = false, $settings = false ) { 1308 global $concatenate_scripts, $compress_scripts, $tinymce_version ;1308 global $concatenate_scripts, $compress_scripts, $tinymce_version, $editor_styles; 1309 1309 1310 1310 if ( ! user_can_richedit() ) 1311 1311 return; … … 1467 1467 'plugins' => $plugins 1468 1468 ); 1469 1469 1470 $mce_css = trim(apply_filters('mce_css', ''), ' ,'); 1470 if ( ! empty( $editor_styles ) && is_array( $editor_styles ) ) { 1471 $mce_css = array(); 1472 $style_uri = get_stylesheet_directory_uri(); 1473 if ( TEMPLATEPATH == STYLESHEETPATH ) { 1474 foreach ( $editor_styles as $file ) 1475 $mce_css[] = "$style_uri/$file"; 1476 } else { 1477 $style_dir = get_stylesheet_directory(); 1478 $template_uri = get_template_directory_uri(); 1479 $template_dir = get_template_directory(); 1480 foreach ( $editor_styles as $file ) { 1481 if ( file_exists( "$style_dir/$file" ) ) 1482 $mce_css[] = "$style_uri/$file"; 1483 if ( file_exists( "$template_dir/$file" ) ) 1484 $mce_css[] = "$template_uri/$file"; 1485 } 1486 } 1487 $mce_css = implode( ',', $mce_css ); 1488 } else { 1489 $mce_css = ''; 1490 } 1471 1491 1492 $mce_css = trim( apply_filters( 'mce_css', $mce_css ), ' ,' ); 1493 1472 1494 if ( ! empty($mce_css) ) 1473 1495 $initArray['content_css'] = $mce_css; 1474 1496 -
wp-includes/theme.php
1465 1465 if ( ! is_admin() ) 1466 1466 return; 1467 1467 1468 global $editor_style; 1469 $editor_style = (array) $editor_style; 1470 $stylesheet = (array) $stylesheet; 1471 foreach ( $stylesheet as $file ) { 1472 if ( file_exists( get_stylesheet_directory() . "/$file" ) 1473 && ( $uri = get_stylesheet_directory_uri() . "/$file" ) 1474 && ! in_array( $uri, $editor_style ) ) 1475 $editor_style[] = $uri; 1476 elseif ( TEMPLATEPATH !== STYLESHEETPATH 1477 && file_exists( get_template_directory() . "/$file" ) 1478 && ( $uri = get_template_directory_uri() . "/$file" ) 1479 && ! in_array( $uri, $editor_style ) ) 1480 $editor_style[] = $uri; 1481 } 1482 add_filter( 'mce_css', '_editor_style_cb' ); 1468 global $editor_styles; 1469 $editor_styles = (array) $editor_styles; 1470 $stylesheet = (array) $stylesheet; 1471 $editor_styles = array_merge( $editor_styles, $stylesheet ); 1483 1472 } 1484 1473 1485 1474 /** 1486 * Callback for custom editor stylesheet support.1487 *1488 * @since 3.0.01489 * @see add_editor_style()1490 * @access protected1491 */1492 function _editor_style_cb( $url ) {1493 global $editor_style;1494 if ( ! empty( $url ) )1495 $url .= ',';1496 return $url . implode( ',', $editor_style );1497 }1498 1499 /**1500 1475 * Allows a theme to register its support of a certain feature 1501 1476 * 1502 1477 * Must be called in the themes functions.php file to work. … … 1520 1495 * @param string $feature the feature being checked 1521 1496 * @return boolean 1522 1497 */ 1523 1524 1498 function current_theme_supports( $feature ) { 1525 1499 global $_wp_theme_features; 1526 1500