WordPress.org

Make WordPress Core

Ticket #6812: disable-captions-support.patch

File disable-captions-support.patch, 10.3 KB (added by azaozz, 6 years ago)
  • wp-admin/gears-manifest.php

     
    6464?> 
    6565{ 
    6666"betaManifestVersion" : 1, 
    67 "version" : "<?php echo $man_version; ?>_20080710", 
     67"version" : "<?php echo $man_version; ?>_20080710a", 
    6868"entries" : [ 
    6969<?php echo $defaults; ?> 
    7070 
     
    131131{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/link.js?ver=311" }, 
    132132{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/source_editor.js?ver=311" }, 
    133133{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/anchor.js?ver=311" }, 
    134 { "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js?ver=311c" }, 
     134{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js?ver=311d" }, 
    135135{ "url" : "../wp-includes/js/tinymce/tiny_mce.js?ver=311" }, 
    136136{ "url" : "../wp-includes/js/tinymce/themes/advanced/editor_template.js?ver=311" }, 
    137137{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js?ver=311" }, 
     
    148148{ "url" : "../wp-includes/js/tinymce/plugins/paste/pastetext.htm?ver=311" }, 
    149149{ "url" : "../wp-includes/js/tinymce/plugins/fullscreen/fullscreen.htm?ver=311" }, 
    150150{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/template.htm?ver=311" }, 
    151 { "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/editimage.html?ver=311c" }, 
     151{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/editimage.html?ver=311d" }, 
    152152{ "url" : "../wp-includes/js/tinymce/wp-mce-help.php?ver=311" }, 
    153153 
    154154{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/ui.css?ver=311" }, 
     
    161161{ "url" : "../wp-includes/js/tinymce/plugins/media/css/media.css?ver=311" }, 
    162162{ "url" : "../wp-includes/js/tinymce/plugins/paste/css/pasteword.css?ver=311" }, 
    163163{ "url" : "../wp-includes/js/tinymce/plugins/paste/css/blank.css?ver=311" }, 
    164 { "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css?ver=311c" }, 
     164{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css?ver=311d" }, 
    165165{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/css/editimage-rtl.css?ver=311" }, 
    166166{ "url" : "../wp-includes/js/tinymce/wordpress.css?ver=311" }, 
    167167 
  • wp-admin/includes/media.php

     
    6767 
    6868function image_add_caption( $html, $id, $alt, $title, $align, $url, $size ) { 
    6969 
    70         if ( empty($alt) ) return $html; 
     70        if ( empty($alt) || ( defined('DISABLE_IMAGE_CAPTIONS') && true == DISABLE_IMAGE_CAPTIONS ) ) return $html; 
    7171        $id = ( 0 < (int) $id ) ? 'attachment_' . $id : ''; 
    7272 
    7373        preg_match( '/width="([0-9]+)/', $html, $matches ); 
     
    508508function image_attachment_fields_to_edit($form_fields, $post) { 
    509509        if ( substr($post->post_mime_type, 0, 5) == 'image' ) { 
    510510                $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"'); 
    513511 
     512                if ( defined('DISABLE_IMAGE_CAPTIONS') && true == DISABLE_IMAGE_CAPTIONS ) { 
     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 
    514520                $form_fields['post_content']['label'] = __('Description'); 
    515521 
    516522                $thumb = wp_get_attachment_thumb_url($post->ID); 
     
    598604        $file = wp_get_attachment_url($post->ID); 
    599605        $link = get_attachment_link($post->ID); 
    600606 
     607        if ( defined('DISABLE_IMAGE_CAPTIONS') && true == DISABLE_IMAGE_CAPTIONS ) 
     608                $alt = __('Alternate Text'); 
     609        else 
     610                $alt = __('Caption'); 
     611 
    601612        $form_fields = array( 
    602613                'post_title'   => array( 
    603614                        'label'      => __('Title'), 
    604615                        'value'      => $edit_post->post_title, 
    605616                ), 
    606617                'post_excerpt' => array( 
    607                         'label'      => __('Caption'), 
     618                        'label'      => $alt, 
    608619                        'value'      => $edit_post->post_excerpt, 
    609620                ), 
    610621                'post_content' => array( 
     
    10071018 
    10081019                if ( f.alt.value ) { 
    10091020                        alt = f.alt.value.replace(/['"<>]+/g, ''); 
     1021<?php if ( ! defined('DISABLE_IMAGE_CAPTIONS') || true != DISABLE_IMAGE_CAPTIONS ) { ?> 
    10101022                        caption = f.alt.value.replace(/'/g, '&#39;').replace(/"/g, '&quot;').replace(/</g, '&lt;').replace(/>/g, '&gt;'); 
     1023<?php } ?> 
    10111024                } 
    10121025 
    10131026                cls = caption ? '' : ' class="'+t.align+'"'; 
     
    12621275} 
    12631276 
    12641277function type_form_image() { 
    1265         return ' 
     1278        $form = ' 
    12661279        <table class="describe"><tbody> 
    12671280                <tr> 
    12681281                        <th valign="top" scope="row" class="label" style="width:120px;"> 
     
    12791292                        </th> 
    12801293                        <td class="field"><p><input id="title" name="title" value="" type="text" aria-required="true" /></p></td> 
    12811294                </tr> 
     1295'; 
     1296        if ( defined('DISABLE_IMAGE_CAPTIONS') && true == DISABLE_IMAGE_CAPTIONS ) { 
     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'; 
    12821306 
     1307        } else { 
     1308                $form .= ' 
    12831309                <tr> 
    12841310                        <th valign="top" scope="row" class="label"> 
    12851311                                <span class="alignleft"><label for="alt">' . __('Image Caption') . '</label></span> 
     
    12871313                        <td class="field"><input id="alt" name="alt" value="" type="text" aria-required="true" /> 
    12881314                        <p class="help">' . __('Also used as alternate text for the image') . '</p></td> 
    12891315                </tr> 
    1290  
     1316'; 
     1317        } 
     1318                $form .= ' 
    12911319                <tr class="align"> 
    12921320                        <th valign="top" scope="row" class="label"><p><label for="align">' . __('Alignment') . '</label></p></th> 
    12931321                        <td class="field"> 
     
    13211349                </tr> 
    13221350        </tbody></table> 
    13231351'; 
     1352 
     1353        return $form; 
    13241354} 
    13251355 
    13261356function type_form_audio() { 
  • wp-includes/js/tinymce/plugins/wpeditimage/editimage.html

     
    44<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> 
    55<title></title> 
    66 
    7 <script type="text/javascript" src="js/editimage.js?ver=311c"></script> 
     7<script type="text/javascript" src="js/editimage.js?ver=311d"></script> 
    88<script type="text/javascript" src="../../utils/form_utils.js?ver=311"></script> 
    99 
    10 <link rel="stylesheet" href="css/editimage.css?ver=311c" type="text/css" media="all" /> 
     10<link rel="stylesheet" href="css/editimage.css?ver=311d" type="text/css" media="all" /> 
    1111<link rel="stylesheet" href="../../../../../wp-admin/css/media.css?ver=2.6-beta3" type="text/css" media="all" /> 
    1212<script type="text/javascript"> 
    1313if ( 'rtl' == tinyMCEPopup.editor.getParam('directionality','') ) 
     
    8585                        </td> 
    8686                </tr> 
    8787 
    88                 <tr> 
     88                <tr id="cap_field"> 
    8989                        <th valign="top" scope="row" class="label"> 
    9090                                <label for="img_cap"> 
    9191                                <span class="alignleft">{#wpeditimage.caption}</span> 
  • wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js

     
    247247        setup : function() { 
    248248                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; 
    249249                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 
    250254                tinyMCEPopup.restoreSelection(); 
    251255                el = ed.selection.getNode(); 
    252256                if (el.nodeName != 'IMG') return; 
  • wp-includes/js/tinymce/tiny_mce_config.php

     
    130130$mce_buttons_4 = apply_filters('mce_buttons_4', array()); 
    131131$mce_buttons_4 = implode($mce_buttons_4, ','); 
    132132 
     133$do_captions = ( defined('DISABLE_IMAGE_CAPTIONS') && true == DISABLE_IMAGE_CAPTIONS ) ? false : true; 
     134 
    133135// TinyMCE init settings 
    134136$initArray = array ( 
    135137        'mode' => 'none', 
     
    163165        'tab_focus' => ':next', 
    164166        'content_css' => "$mce_css", 
    165167        'save_callback' => 'switchEditors.saveCallback', 
     168        'wpeditimage_do_captions' => $do_captions, 
    166169        'plugins' => "$plugins", 
    167170        // pass-through the settings for compression and caching, so they can be changed with "tiny_mce_before_init" 
    168171        'disk_cache' => true, 
     
    222225// Setup cache info 
    223226if ( $disk_cache ) { 
    224227 
    225         $cacheKey = apply_filters('tiny_mce_version', '20080709'); 
     228        $cacheKey = apply_filters('tiny_mce_version', '20080710'); 
    226229 
    227230        foreach ( $initArray as $v ) 
    228231                $cacheKey .= $v; 
  • wp-includes/media.php

     
    353353add_shortcode('wp_caption', 'img_caption_shortcode'); 
    354354 
    355355function img_caption_shortcode($attr, $content = null) { 
    356          
     356 
     357        if ( defined('DISABLE_IMAGE_CAPTIONS') && true == DISABLE_IMAGE_CAPTIONS ) 
     358                return $content; 
     359 
    357360        // Allow plugins/themes to override the default caption template. 
    358361        $output = apply_filters('img_caption_shortcode', '', $attr, $content); 
    359362        if ( $output != '' ) 
  • wp-includes/script-loader.php

     
    3737        $scripts->add( 'editor_functions', '/wp-admin/js/editor.js', false, '20080706' ); 
    3838 
    3939        // Modify this version when tinyMCE plugins are changed. 
    40         $mce_version = apply_filters('tiny_mce_version', '20080709'); 
     40        $mce_version = apply_filters('tiny_mce_version', '20080710'); 
    4141        $scripts->add( 'tiny_mce', '/wp-includes/js/tinymce/tiny_mce_config.php', array('editor_functions'), $mce_version ); 
    4242 
    4343        $scripts->add( 'prototype', '/wp-includes/js/prototype.js', false, '1.6');