Removes the disabling of captions, but leaves couple of hooks so a plugin can do it easily. see #6812

git-svn-id: http://svn.automattic.com/wordpress/trunk@8358 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
azaozz 2008-07-16 21:36:17 +00:00
parent d726af852a
commit 99fd979933
8 changed files with 32 additions and 56 deletions

View File

@ -64,7 +64,7 @@ header( 'Content-Type: application/x-javascript; charset=UTF-8' );
?>
{
"betaManifestVersion" : 1,
"version" : "<?php echo $man_version; ?>_20080710a",
"version" : "<?php echo $man_version; ?>_20080712",
"entries" : [
<?php echo $defaults; ?>
@ -131,7 +131,7 @@ header( 'Content-Type: application/x-javascript; charset=UTF-8' );
{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/link.js?ver=311" },
{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/source_editor.js?ver=311" },
{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/anchor.js?ver=311" },
{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js?ver=311d" },
{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js?ver=311e" },
{ "url" : "../wp-includes/js/tinymce/tiny_mce.js?ver=311" },
{ "url" : "../wp-includes/js/tinymce/themes/advanced/editor_template.js?ver=311" },
{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js?ver=311" },
@ -148,7 +148,7 @@ header( 'Content-Type: application/x-javascript; charset=UTF-8' );
{ "url" : "../wp-includes/js/tinymce/plugins/paste/pastetext.htm?ver=311" },
{ "url" : "../wp-includes/js/tinymce/plugins/fullscreen/fullscreen.htm?ver=311" },
{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/template.htm?ver=311" },
{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/editimage.html?ver=311d" },
{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/editimage.html?ver=311e" },
{ "url" : "../wp-includes/js/tinymce/wp-mce-help.php?ver=311" },
{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/ui.css?ver=311" },
@ -161,7 +161,7 @@ header( 'Content-Type: application/x-javascript; charset=UTF-8' );
{ "url" : "../wp-includes/js/tinymce/plugins/media/css/media.css?ver=311" },
{ "url" : "../wp-includes/js/tinymce/plugins/paste/css/pasteword.css?ver=311" },
{ "url" : "../wp-includes/js/tinymce/plugins/paste/css/blank.css?ver=311" },
{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css?ver=311d" },
{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css?ver=311e" },
{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/css/editimage-rtl.css?ver=311" },
{ "url" : "../wp-includes/js/tinymce/wordpress.css?ver=311" },

View File

@ -67,8 +67,7 @@ function get_image_send_to_editor($id, $alt, $title, $align, $url='', $rel = fal
function image_add_caption( $html, $id, $alt, $title, $align, $url, $size ) {
// CAPTIONS_OFF is temporary. Do not use it.
if ( empty($alt) || ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF ) ) return $html;
if ( empty($alt) || apply_filters( 'disable_captions', '' ) ) return $html;
$id = ( 0 < (int) $id ) ? 'attachment_' . $id : '';
preg_match( '/width="([0-9]+)/', $html, $matches );
@ -510,14 +509,8 @@ function image_attachment_fields_to_edit($form_fields, $post) {
if ( substr($post->post_mime_type, 0, 5) == 'image' ) {
$form_fields['post_title']['required'] = true;
// CAPTIONS_OFF is temporary. Do not use it.
if ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF ) {
$form_fields['post_excerpt']['label'] = __('Alternate Text');
$form_fields['post_excerpt']['helps'][] = __('Alt text for the image, e.g. "The Mona Lisa"');
} else {
$form_fields['post_excerpt']['label'] = __('Caption');
$form_fields['post_excerpt']['helps'][] = __('Also used as alternate text for the image');
}
$form_fields['post_excerpt']['label'] = __('Caption');
$form_fields['post_excerpt']['helps'][] = __('Also used as alternate text for the image');
$form_fields['post_content']['label'] = __('Description');
@ -606,19 +599,13 @@ function get_attachment_fields_to_edit($post, $errors = null) {
$file = wp_get_attachment_url($post->ID);
$link = get_attachment_link($post->ID);
// CAPTIONS_OFF is temporary. Do not use it.
if ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF )
$alt = __('Alternate Text');
else
$alt = __('Caption');
$form_fields = array(
'post_title' => array(
'label' => __('Title'),
'value' => $edit_post->post_title,
),
'post_excerpt' => array(
'label' => $alt,
'label' => __('Caption'),
'value' => $edit_post->post_excerpt,
),
'post_content' => array(
@ -1021,7 +1008,7 @@ var addExtImage = {
if ( f.alt.value ) {
alt = f.alt.value.replace(/['"<>]+/g, '');
<?php if ( ! defined('CAPTIONS_OFF') || true != CAPTIONS_OFF ) { // CAPTIONS_OFF is temporary. Do not use it. ?>
<?php if ( ! apply_filters( 'disable_captions', '' ) ) { ?>
caption = f.alt.value.replace(/'/g, '&#39;').replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
<?php } ?>
}
@ -1278,7 +1265,16 @@ jQuery(function($){
}
function type_form_image() {
$form = '
if ( apply_filters( 'disable_captions', '' ) ) {
$alt = __('Alternate Text');
$alt_help = __('Alt text for the image, e.g. "The Mona Lisa"');
} else {
$alt = __('Image Caption');
$alt_help = __('Also used as alternate text for the image');
}
return '
<table class="describe"><tbody>
<tr>
<th valign="top" scope="row" class="label" style="width:120px;">
@ -1295,31 +1291,15 @@ function type_form_image() {
</th>
<td class="field"><p><input id="title" name="title" value="" type="text" aria-required="true" /></p></td>
</tr>
';
// CAPTIONS_OFF is temporary. Do not use it.
if ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF ) {
$form .= '
<tr>
<th valign="top" scope="row" class="label">
<span class="alignleft"><label for="alt">' . __('Alternate Text') . '</label></span>
</th>
<td class="field"><input id="alt" name="alt" value="" type="text" aria-required="true" />
<p class="help">' . __('Alt text for the image, e.g. "The Mona Lisa"') . '</p></td>
</tr>
';
} else {
$form .= '
<tr>
<th valign="top" scope="row" class="label">
<span class="alignleft"><label for="alt">' . __('Image Caption') . '</label></span>
<span class="alignleft"><label for="alt">' . $alt . '</label></span>
</th>
<td class="field"><input id="alt" name="alt" value="" type="text" aria-required="true" />
<p class="help">' . __('Also used as alternate text for the image') . '</p></td>
<p class="help">' . $alt_help . '</p></td>
</tr>
';
}
$form .= '
<tr class="align">
<th valign="top" scope="row" class="label"><p><label for="align">' . __('Alignment') . '</label></p></th>
<td class="field">
@ -1354,7 +1334,6 @@ function type_form_image() {
</tbody></table>
';
return $form;
}
function type_form_audio() {

View File

@ -4,11 +4,11 @@
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title></title>
<script type="text/javascript" src="js/editimage.js?ver=311d"></script>
<script type="text/javascript" src="js/editimage.js?ver=311e"></script>
<script type="text/javascript" src="../../utils/form_utils.js?ver=311"></script>
<link rel="stylesheet" href="css/editimage.css?ver=311d" type="text/css" media="all" />
<link rel="stylesheet" href="../../../../../wp-admin/css/media.css?ver=2.6-beta3" type="text/css" media="all" />
<link rel="stylesheet" href="css/editimage.css?ver=311e" type="text/css" media="all" />
<link rel="stylesheet" href="../../../../../wp-admin/css/media.css?ver=2.6" type="text/css" media="all" />
<script type="text/javascript">
if ( 'rtl' == tinyMCEPopup.editor.getParam('directionality','') )
document.write('<link rel="stylesheet" href="css/editimage-rtl.css?ver=311" type="text/css" media="all" />');

View File

@ -15,7 +15,7 @@
if ( ed.dom.getAttrib(el, 'class').indexOf('mceItem') != -1 || el.nodeName != 'IMG' )
return;
tb_show('', url + '/editimage.html?ver=311c&TB_iframe=true');
tb_show('', url + '/editimage.html?ver=311e&TB_iframe=true');
tinymce.DOM.setStyle( ['TB_overlay','TB_window','TB_load'], 'z-index', '999999' );
});

View File

@ -248,7 +248,7 @@ var wpImage = {
var t = this, h, c, el, id, link, fname, f = document.forms[0], ed = tinyMCEPopup.editor, d = t.I('img_demo'), dom = tinyMCEPopup.dom, DL, caption = null;
document.dir = tinyMCEPopup.editor.getParam('directionality','');
if ( ! tinyMCEPopup.editor.getParam('wpeditimage_do_captions', true) )
if ( tinyMCEPopup.editor.getParam('wpeditimage_disable_captions', false) )
t.I('cap_field').style.display = 'none';
tinyMCEPopup.restoreSelection();

View File

@ -130,7 +130,7 @@ $mce_buttons_3 = implode($mce_buttons_3, ',');
$mce_buttons_4 = apply_filters('mce_buttons_4', array());
$mce_buttons_4 = implode($mce_buttons_4, ',');
$do_captions = ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF ) ? false : true;
$no_captions = ( apply_filters( 'disable_captions', '' ) ) ? true : false;
// TinyMCE init settings
$initArray = array (
@ -165,7 +165,7 @@ $initArray = array (
'tab_focus' => ':next',
'content_css' => "$mce_css",
'save_callback' => 'switchEditors.saveCallback',
'wpeditimage_do_captions' => $do_captions,
'wpeditimage_disable_captions' => $no_captions,
'plugins' => "$plugins",
// pass-through the settings for compression and caching, so they can be changed with "tiny_mce_before_init"
'disk_cache' => true,
@ -225,7 +225,7 @@ if ( $compress && isset($_SERVER['HTTP_ACCEPT_ENCODING']) ) {
// Setup cache info
if ( $disk_cache ) {
$cacheKey = apply_filters('tiny_mce_version', '20080710');
$cacheKey = apply_filters('tiny_mce_version', '20080712');
foreach ( $initArray as $v )
$cacheKey .= $v;
@ -328,4 +328,4 @@ if ( '' != $cacheKey && is_dir($cache_path) && is_readable($cache_path) ) {
putFileContents( $cache_file, $content );
}
?>
?>

View File

@ -355,9 +355,6 @@ add_shortcode('caption', 'img_caption_shortcode');
function img_caption_shortcode($attr, $content = null) {
if ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF )
return $content;
// Allow plugins/themes to override the default caption template.
$output = apply_filters('img_caption_shortcode', '', $attr, $content);
if ( $output != '' )

View File

@ -37,7 +37,7 @@ function wp_default_scripts( &$scripts ) {
$scripts->add( 'editor_functions', '/wp-admin/js/editor.js', false, '20080710' );
// Modify this version when tinyMCE plugins are changed.
$mce_version = apply_filters('tiny_mce_version', '20080710');
$mce_version = apply_filters('tiny_mce_version', '20080712');
$scripts->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_config.php', array('editor_functions'), $mce_version );
$scripts->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6');