Ticket #6812: disable-captions-support.2.patch
File disable-captions-support.2.patch, 17.7 KB (added by , 16 years ago) |
---|
-
wp-admin/gears-manifest.php
64 64 ?> 65 65 { 66 66 "betaManifestVersion" : 1, 67 "version" : "<?php echo $man_version; ?>_20080710 ",67 "version" : "<?php echo $man_version; ?>_20080710a", 68 68 "entries" : [ 69 69 <?php echo $defaults; ?> 70 70 … … 131 131 { "url" : "../wp-includes/js/tinymce/themes/advanced/js/link.js?ver=311" }, 132 132 { "url" : "../wp-includes/js/tinymce/themes/advanced/js/source_editor.js?ver=311" }, 133 133 { "url" : "../wp-includes/js/tinymce/themes/advanced/js/anchor.js?ver=311" }, 134 { "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js?ver=311 c" },134 { "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js?ver=311d" }, 135 135 { "url" : "../wp-includes/js/tinymce/tiny_mce.js?ver=311" }, 136 136 { "url" : "../wp-includes/js/tinymce/themes/advanced/editor_template.js?ver=311" }, 137 137 { "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js?ver=311" }, … … 148 148 { "url" : "../wp-includes/js/tinymce/plugins/paste/pastetext.htm?ver=311" }, 149 149 { "url" : "../wp-includes/js/tinymce/plugins/fullscreen/fullscreen.htm?ver=311" }, 150 150 { "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/template.htm?ver=311" }, 151 { "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/editimage.html?ver=311 c" },151 { "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/editimage.html?ver=311d" }, 152 152 { "url" : "../wp-includes/js/tinymce/wp-mce-help.php?ver=311" }, 153 153 154 154 { "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/ui.css?ver=311" }, … … 161 161 { "url" : "../wp-includes/js/tinymce/plugins/media/css/media.css?ver=311" }, 162 162 { "url" : "../wp-includes/js/tinymce/plugins/paste/css/pasteword.css?ver=311" }, 163 163 { "url" : "../wp-includes/js/tinymce/plugins/paste/css/blank.css?ver=311" }, 164 { "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css?ver=311 c" },164 { "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css?ver=311d" }, 165 165 { "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/css/editimage-rtl.css?ver=311" }, 166 166 { "url" : "../wp-includes/js/tinymce/wordpress.css?ver=311" }, 167 167 -
wp-admin/includes/media.php
67 67 68 68 function image_add_caption( $html, $id, $alt, $title, $align, $url, $size ) { 69 69 70 if ( empty($alt) ) return $html;70 if ( empty($alt) || ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF ) ) return $html; 71 71 $id = ( 0 < (int) $id ) ? 'attachment_' . $id : ''; 72 72 73 73 preg_match( '/width="([0-9]+)/', $html, $matches ); … … 77 77 $html = preg_replace( '/align[^\s\'"]+\s?/', '', $html ); 78 78 if ( empty($align) ) $align = 'none'; 79 79 80 $shcode = '[ wp_caption id="' . $id . '" align="align' . $align81 . '" width="' . $width . '" caption="' . $alt . '"]' . $html . '[/ wp_caption]';80 $shcode = '[caption id="' . $id . '" align="align' . $align 81 . '" width="' . $width . '" caption="' . $alt . '"]' . $html . '[/caption]'; 82 82 83 83 return apply_filters( 'image_add_caption_shortcode', $shcode, $html ); 84 84 } … … 508 508 function image_attachment_fields_to_edit($form_fields, $post) { 509 509 if ( substr($post->post_mime_type, 0, 5) == 'image' ) { 510 510 $form_fields['post_title']['required'] = true; 511 $form_fields['post_excerpt']['label'] = __('Caption');512 $form_fields['post_excerpt']['helps'][] = __('Alternate text, e.g. "The Mona Lisa"');513 511 512 if ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF ) { 513 $form_fields['post_excerpt']['label'] = __('Alternate Text'); 514 $form_fields['post_excerpt']['helps'][] = __('Alt text for the image, e.g. "The Mona Lisa"'); 515 } else { 516 $form_fields['post_excerpt']['label'] = __('Caption'); 517 $form_fields['post_excerpt']['helps'][] = __('Also used as alternate text for the image'); 518 } 519 514 520 $form_fields['post_content']['label'] = __('Description'); 515 521 516 522 $thumb = wp_get_attachment_thumb_url($post->ID); … … 598 604 $file = wp_get_attachment_url($post->ID); 599 605 $link = get_attachment_link($post->ID); 600 606 607 if ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF ) 608 $alt = __('Alternate Text'); 609 else 610 $alt = __('Caption'); 611 601 612 $form_fields = array( 602 613 'post_title' => array( 603 614 'label' => __('Title'), 604 615 'value' => $edit_post->post_title, 605 616 ), 606 617 'post_excerpt' => array( 607 'label' => __('Caption'),618 'label' => $alt, 608 619 'value' => $edit_post->post_excerpt, 609 620 ), 610 621 'post_content' => array( … … 1007 1018 1008 1019 if ( f.alt.value ) { 1009 1020 alt = f.alt.value.replace(/['"<>]+/g, ''); 1021 <?php if ( ! defined('CAPTIONS_OFF') || true != CAPTIONS_OFF ) { ?> 1010 1022 caption = f.alt.value.replace(/'/g, ''').replace(/"/g, '"').replace(/</g, '<').replace(/>/g, '>'); 1023 <?php } ?> 1011 1024 } 1012 1025 1013 1026 cls = caption ? '' : ' class="'+t.align+'"'; … … 1018 1031 html = '<a href="'+f.url.value+'">'+html+'</a>'; 1019 1032 1020 1033 if ( caption ) 1021 html = '[ wp_caption id="" align="'+t.align+'" width="'+t.width+'" caption="'+caption+'"]'+html+'[/wp_caption]';1034 html = '[caption id="" align="'+t.align+'" width="'+t.width+'" caption="'+caption+'"]'+html+'[/caption]'; 1022 1035 1023 1036 var win = window.dialogArguments || opener || parent || top; 1024 1037 win.send_to_editor(html); … … 1262 1275 } 1263 1276 1264 1277 function type_form_image() { 1265 return'1278 $form = ' 1266 1279 <table class="describe"><tbody> 1267 1280 <tr> 1268 1281 <th valign="top" scope="row" class="label" style="width:120px;"> … … 1279 1292 </th> 1280 1293 <td class="field"><p><input id="title" name="title" value="" type="text" aria-required="true" /></p></td> 1281 1294 </tr> 1295 '; 1296 if ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF ) { 1297 $form .= ' 1298 <tr> 1299 <th valign="top" scope="row" class="label"> 1300 <span class="alignleft"><label for="alt">' . __('Alternate Text') . '</label></span> 1301 </th> 1302 <td class="field"><input id="alt" name="alt" value="" type="text" aria-required="true" /> 1303 <p class="help">' . __('Alt text for the image, e.g. "The Mona Lisa"') . '</p></td> 1304 </tr> 1305 '; 1282 1306 1307 } else { 1308 $form .= ' 1283 1309 <tr> 1284 1310 <th valign="top" scope="row" class="label"> 1285 1311 <span class="alignleft"><label for="alt">' . __('Image Caption') . '</label></span> … … 1287 1313 <td class="field"><input id="alt" name="alt" value="" type="text" aria-required="true" /> 1288 1314 <p class="help">' . __('Also used as alternate text for the image') . '</p></td> 1289 1315 </tr> 1290 1316 '; 1317 } 1318 $form .= ' 1291 1319 <tr class="align"> 1292 1320 <th valign="top" scope="row" class="label"><p><label for="align">' . __('Alignment') . '</label></p></th> 1293 1321 <td class="field"> … … 1321 1349 </tr> 1322 1350 </tbody></table> 1323 1351 '; 1352 1353 return $form; 1324 1354 } 1325 1355 1326 1356 function type_form_audio() { -
wp-admin/js/editor.js
52 52 // Fix some block element newline issues 53 53 content = content.replace(new RegExp('\\s*<div', 'mg'), '\n<div'); 54 54 content = content.replace(new RegExp('</div>\\s*', 'mg'), '</div>\n'); 55 content = content.replace(new RegExp('\\s*\\[ wp_caption([^\\[]+)\\[/wp_caption\\]\\s*', 'gi'), '\n\n[wp_caption$1[/wp_caption]\n\n');56 content = content.replace(new RegExp(' wp_caption\\]\\n\\n+\\[wp_caption', 'g'), 'wp_caption]\n\n[wp_caption');55 content = content.replace(new RegExp('\\s*\\[caption([^\\[]+)\\[/caption\\]\\s*', 'gi'), '\n\n[caption$1[/caption]\n\n'); 56 content = content.replace(new RegExp('caption\\]\\n\\n+\\[caption', 'g'), 'caption]\n\n[caption'); 57 57 58 58 var blocklist2 = 'blockquote|ul|ol|li|table|thead|tr|th|td|h[1-6]|pre'; 59 59 content = content.replace(new RegExp('\\s*<(('+blocklist2+') ?[^>]*)\\s*>', 'mg'), '\n<$1>'); … … 166 166 pee = pee.replace(new RegExp('\\s*\\n', 'gi'), "<br />\n"); 167 167 pee = pee.replace(new RegExp('(</?(?:'+blocklist+')[^>]*>)\\s*<br />', 'gi'), "$1"); 168 168 pee = pee.replace(new RegExp('<br />(\\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)', 'gi'), '$1'); 169 pee = pee.replace(new RegExp('(?:<p>|<br ?/?>)*\\s*\\[ wp_caption([^\\[]+)\\[/wp_caption\\]\\s*(?:</p>|<br ?/?>)*', 'gi'), '[wp_caption$1[/wp_caption]');169 pee = pee.replace(new RegExp('(?:<p>|<br ?/?>)*\\s*\\[caption([^\\[]+)\\[/caption\\]\\s*(?:</p>|<br ?/?>)*', 'gi'), '[caption$1[/caption]'); 170 170 // pee = pee.replace(new RegExp('^((?: )*)\\s', 'mg'), '$1 '); 171 171 172 172 // Fix the pre|script tags -
wp-admin/js/media-upload.js
5 5 if (tinymce.isIE) 6 6 ed.selection.moveToBookmark(tinymce.EditorManager.activeEditor.windowManager.bookmark); 7 7 8 if ( h.indexOf('[ wp_caption') != -1 )8 if ( h.indexOf('[caption') != -1 ) 9 9 h = ed.plugins.wpeditimage._do_shcode(h); 10 10 11 11 ed.execCommand('mceInsertContent', false, h); -
wp-includes/js/tinymce/plugins/wpeditimage/editimage.html
4 4 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 5 5 <title></title> 6 6 7 <script type="text/javascript" src="js/editimage.js?ver=311 c"></script>7 <script type="text/javascript" src="js/editimage.js?ver=311d"></script> 8 8 <script type="text/javascript" src="../../utils/form_utils.js?ver=311"></script> 9 9 10 <link rel="stylesheet" href="css/editimage.css?ver=311 c" type="text/css" media="all" />10 <link rel="stylesheet" href="css/editimage.css?ver=311d" type="text/css" media="all" /> 11 11 <link rel="stylesheet" href="../../../../../wp-admin/css/media.css?ver=2.6-beta3" type="text/css" media="all" /> 12 12 <script type="text/javascript"> 13 13 if ( 'rtl' == tinyMCEPopup.editor.getParam('directionality','') ) … … 85 85 </td> 86 86 </tr> 87 87 88 <tr >88 <tr id="cap_field"> 89 89 <th valign="top" scope="row" class="label"> 90 90 <label for="img_cap"> 91 91 <span class="alignleft">{#wpeditimage.caption}</span> -
wp-includes/js/tinymce/plugins/wpeditimage/editor_plugin.js
87 87 }, 88 88 89 89 _do_shcode : function(co) { 90 return co.replace(/\[ wp_caption([^\]]+)\]([\s\S]+?)\[\/wp_caption\][\s\u00a0]*/g, function(a,b,c){90 return co.replace(/\[(?:wp_)?caption([^\]]+)\]([\s\S]+?)\[\/(?:wp_)?caption\][\s\u00a0]*/g, function(a,b,c){ 91 91 b = b.replace(/\\'|\\'|\\'/g, ''').replace(/\\"|\\"/g, '"'); 92 92 c = c.replace(/\\'|\\'/g, ''').replace(/\\"/g, '"'); 93 93 var id = b.match(/id=['"]([^'"]+)/i), cls = b.match(/align=['"]([^'"]+)/i); … … 101 101 102 102 var div_cls = (cls == 'aligncenter') ? 'mceTemp mceIEcenter' : 'mceTemp'; 103 103 104 return '<div class="'+div_cls+'"><dl id="'+id+'" class="wp _caption '+cls+'" style="width: '+(10+parseInt(w))+105 'px"><dt class="wp _caption_dt">'+c+'</dt><dd class="wp_caption_dd">'+cap+'</dd></dl></div>';104 return '<div class="'+div_cls+'"><dl id="'+id+'" class="wp-caption '+cls+'" style="width: '+(10+parseInt(w))+ 105 'px"><dt class="wp-caption-dt">'+c+'</dt><dd class="wp-caption-dd">'+cap+'</dd></dl></div>'; 106 106 }); 107 107 }, 108 108 … … 119 119 cls = cls.match(/align[^ '"]+/) || 'alignnone'; 120 120 cap = cap.replace(/<\S[^<>]*>/gi, '').replace(/'/g, ''').replace(/"/g, '"'); 121 121 122 return '[ wp_caption id="'+id+'" align="'+cls+'" width="'+w+'" caption="'+cap+'"]'+c+'[/wp_caption]';122 return '[caption id="'+id+'" align="'+cls+'" width="'+w+'" caption="'+cap+'"]'+c+'[/caption]'; 123 123 }); 124 124 }, 125 125 -
wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js
247 247 setup : function() { 248 248 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; 249 249 document.dir = tinyMCEPopup.editor.getParam('directionality',''); 250 251 if ( ! tinyMCEPopup.editor.getParam('wpeditimage_do_captions', true) ) 252 t.I('cap_field').style.display = 'none'; 253 250 254 tinyMCEPopup.restoreSelection(); 251 255 el = ed.selection.getNode(); 252 256 if (el.nodeName != 'IMG') return; … … 265 269 } 266 270 267 271 tinymce.each(DL.childNodes, function(e) { 268 if ( e.nodeName == 'DD' && dom.hasClass(e, 'wp _caption_dd') ) {272 if ( e.nodeName == 'DD' && dom.hasClass(e, 'wp-caption-dd') ) { 269 273 caption = e.innerHTML; 270 274 return; 271 275 } … … 423 427 424 428 if ( DL ) { 425 429 ed.dom.setAttribs(DL, { 426 'class' : 'wp _caption '+t.align,430 'class' : 'wp-caption '+t.align, 427 431 style : 'width: '+cap_width+'px;' 428 432 }); 429 433 430 434 if ( DIV ) 431 435 ed.dom.setAttrib(DIV, 'class', div_cls); 432 436 433 if ( (DT = ed.dom.getParent(el, 'dt')) && (DD = DT.nextSibling) && ed.dom.hasClass(DD, 'wp _caption_dd') )437 if ( (DT = ed.dom.getParent(el, 'dt')) && (DD = DT.nextSibling) && ed.dom.hasClass(DD, 'wp-caption-dd') ) 434 438 ed.dom.setHTML(DD, f.img_cap.value); 435 439 436 440 } else { … … 448 452 } 449 453 } else html = ed.dom.getOuterHTML(el); 450 454 451 html = '<dl id="'+cap_id+'" class="wp _caption '+t.align+'" style="width: '+cap_width+452 'px"><dt class="wp _caption_dt">'+html+'</dt><dd class="wp_caption_dd">'+f.img_cap.value+'</dd></dl>';455 html = '<dl id="'+cap_id+'" class="wp-caption '+t.align+'" style="width: '+cap_width+ 456 'px"><dt class="wp-caption-dt">'+html+'</dt><dd class="wp-caption-dd">'+f.img_cap.value+'</dd></dl>'; 453 457 454 458 cap = ed.dom.create('div', {'class': div_cls}, html); 455 459 -
wp-includes/js/tinymce/tiny_mce_config.php
130 130 $mce_buttons_4 = apply_filters('mce_buttons_4', array()); 131 131 $mce_buttons_4 = implode($mce_buttons_4, ','); 132 132 133 $do_captions = ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF ) ? false : true; 134 133 135 // TinyMCE init settings 134 136 $initArray = array ( 135 137 'mode' => 'none', … … 163 165 'tab_focus' => ':next', 164 166 'content_css' => "$mce_css", 165 167 'save_callback' => 'switchEditors.saveCallback', 168 'wpeditimage_do_captions' => $do_captions, 166 169 'plugins' => "$plugins", 167 170 // pass-through the settings for compression and caching, so they can be changed with "tiny_mce_before_init" 168 171 'disk_cache' => true, … … 222 225 // Setup cache info 223 226 if ( $disk_cache ) { 224 227 225 $cacheKey = apply_filters('tiny_mce_version', '200807 09');228 $cacheKey = apply_filters('tiny_mce_version', '20080710'); 226 229 227 230 foreach ( $initArray as $v ) 228 231 $cacheKey .= $v; -
wp-includes/js/tinymce/wordpress.css
15 15 float: right; 16 16 } 17 17 18 .wp _caption {18 .wp-caption { 19 19 border: 1px solid #ddd; 20 20 text-align: center; 21 21 background-color: #f3f3f3; … … 27 27 border-radius: 3px; 28 28 } 29 29 30 .wp _caption img {30 .wp-caption img { 31 31 margin: 0; 32 32 padding: 0; 33 33 border: 0 none; 34 34 } 35 35 36 .wp _caption_dd {36 .wp-caption-dd { 37 37 font-size: 11px; 38 38 line-height: 17px; 39 39 padding: 0 4px 5px; -
wp-includes/media.php
351 351 } 352 352 353 353 add_shortcode('wp_caption', 'img_caption_shortcode'); 354 add_shortcode('caption', 'img_caption_shortcode'); 354 355 355 356 function img_caption_shortcode($attr, $content = null) { 356 357 358 if ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF ) 359 return $content; 360 357 361 // Allow plugins/themes to override the default caption template. 358 362 $output = apply_filters('img_caption_shortcode', '', $attr, $content); 359 363 if ( $output != '' ) -
wp-includes/script-loader.php
34 34 $visual_editor = apply_filters('visual_editor', array('tiny_mce')); 35 35 $scripts->add( 'editor', false, $visual_editor, '20080321' ); 36 36 37 $scripts->add( 'editor_functions', '/wp-admin/js/editor.js', false, '200807 06' );37 $scripts->add( 'editor_functions', '/wp-admin/js/editor.js', false, '20080710' ); 38 38 39 39 // Modify this version when tinyMCE plugins are changed. 40 $mce_version = apply_filters('tiny_mce_version', '200807 09');40 $mce_version = apply_filters('tiny_mce_version', '20080710'); 41 41 $scripts->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_config.php', array('editor_functions'), $mce_version ); 42 42 43 43 $scripts->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6'); … … 159 159 'edit' => __('Edit'), 160 160 ) ); 161 161 $scripts->add( 'admin-gallery', '/wp-admin/js/gallery.js', array( 'jquery-ui-sortable' ), '20080709' ); 162 $scripts->add( 'media-upload', '/wp-admin/js/media-upload.js', array( 'thickbox' ), '200807 02' );162 $scripts->add( 'media-upload', '/wp-admin/js/media-upload.js', array( 'thickbox' ), '20080710' ); 163 163 $scripts->localize( 'upload', 'uploadL10n', array( 164 164 'browseTitle' => attribute_escape(__('Browse your files')), 165 165 'back' => __('« Back'),