Changeset 13444
- Timestamp:
- 02/26/2010 09:07:41 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-includes/theme.php
r13441 r13444 1448 1448 1449 1449 /** 1450 * Add callback for a custom TinyMCE editor stylesheet.1450 * Add callback for custom TinyMCE editor stylesheets. 1451 1451 * 1452 1452 * The parameter $stylesheet is the name of the stylesheet, relative to 1453 * the theme root. It is optional and defaults to 'editor-style.css'. 1453 * the theme root. It also accepts an array of stylesheets. 1454 * It is optional and defaults to 'editor-style.css'. 1454 1455 * 1455 1456 * @since 3.0.0 1456 1457 * 1457 * @param callback $stylesheet Name of stylesheet relative to theme root. 1458 * @param mixed $stylesheet Optional. Stylesheet name or array thereof, relative to theme root. 1459 * Defaults to 'editor-style.css' 1458 1460 */ 1459 1461 function add_editor_style( $stylesheet = 'editor-style.css' ) { 1460 if ( isset( $GLOBALS['editor_style'] ) )1461 return;1462 1462 1463 1463 add_theme_support( 'editor-style' ); … … 1466 1466 return; 1467 1467 1468 $GLOBALS['editor_style'] = $stylesheet; 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 } 1469 1482 add_filter( 'mce_css', '_editor_style_cb' ); 1470 1483 } 1471 1484 1472 1485 /** 1473 * Callback for custom editor stylesheet .1486 * Callback for custom editor stylesheet support. 1474 1487 * 1475 1488 * @since 3.0.0 … … 1481 1494 if ( ! empty( $url ) ) 1482 1495 $url .= ','; 1483 return $url . get_stylesheet_directory_uri() . "/$editor_style";1496 return $url . implode( ',', $editor_style ); 1484 1497 } 1485 1498
Note: See TracChangeset
for help on using the changeset viewer.