Ticket #36638: 36638.patch
File 36638.patch, 5.4 KB (added by , 9 years ago) |
---|
-
src/wp-admin/admin-ajax.php
62 62 'send-attachment-to-editor', 'save-attachment-order', 'heartbeat', 'get-revision-diffs', 63 63 'save-user-color-scheme', 'update-widget', 'query-themes', 'parse-embed', 'set-attachment-thumbnail', 64 64 'parse-media-shortcode', 'destroy-sessions', 'install-plugin', 'update-plugin', 'press-this-save-post', 65 'press-this-add-category', 'crop-image', 'generate-password', 'save-wporg-username', 65 'press-this-add-category', 'crop-image', 'generate-password', 'save-wporg-username', 'url-exists', 66 66 ); 67 67 68 68 // Deprecated -
src/wp-admin/includes/ajax-actions.php
3327 3327 3328 3328 wp_send_json_success( update_user_meta( get_current_user_id(), 'wporg_favorites', $username ) ); 3329 3329 } 3330 3331 /** 3332 * Ajax handler for checking the existence of a URL. 3333 * 3334 * @since 4.6.0 3335 */ 3336 function wp_ajax_url_exists() { 3337 3338 3339 $array = get_headers( $_POST['check_url'] ); 3340 $string = $array[0]; 3341 3342 if( '' != $string && ! preg_match( '/4[0-9][0-9]/', $string ) ) { 3343 wp_send_json_success('success'); 3344 } else { 3345 wp_send_json_error('failed'); 3346 } 3347 3348 } -
src/wp-includes/css/editor.css
1775 1775 margin: 2px 1px; 1776 1776 } 1777 1777 1778 div.wp-link-bad { 1779 display: none; 1780 cursor: default; 1781 margin: 5px; 1782 float: right; 1783 font-weight: 600; 1784 color: #a00; 1785 } 1786 1778 1787 .mce-inline-toolbar-grp .mce-btn-group .mce-btn:last-child { 1779 1788 margin-right: 2px; 1780 1789 } -
src/wp-includes/js/tinymce/plugins/wplink/plugin.js
84 84 } 85 85 } ); 86 86 87 tinymce.ui.WPBadLink = tinymce.ui.Control.extend( { 88 renderHtml: function() { 89 return ( 90 '<div id="' + this._id + '" class="wp-link-bad" title="This URL does not lead to a working page.">Bad Link</div>' 91 ); 92 }, 93 } ); 94 95 87 96 tinymce.PluginManager.add( 'wplink', function( editor ) { 88 97 var toolbar; 89 98 var editToolbar; … … 133 142 function removePlaceholderStrings( content, dataAttr ) { 134 143 if ( dataAttr ) { 135 144 content = content.replace( / data-wplink-edit="true"/g, '' ); 145 content = content.replace( / data-link-broken="true"/g, '' ); 136 146 } 137 147 138 148 return content.replace( /<a [^>]*?href="_wp_link_placeholder"[^>]*>([\s\S]+)<\/a>/g, '$1' ); … … 143 153 toolbar = editor.wp._createToolbar( [ 144 154 'wp_link_preview', 145 155 'wp_link_edit', 146 'wp_link_remove' 156 'wp_link_remove', 157 'wp_link_bad', 147 158 ], true ); 148 159 149 160 var editButtons = [ … … 226 237 href = 'http://' + href; 227 238 } 228 239 240 try { 241 xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); 242 } catch ( e1 ) { 243 try { 244 xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); 245 } catch ( e2 ) { 246 xmlhttp = false; 247 } 248 } 249 250 if ( ! xmlhttp ) { 251 if ( 'undefined' != typeof XMLHttpRequest ) { 252 xmlhttp = new XMLHttpRequest(); 253 } else if ( window.createRequest ) { 254 xmlhttp = window.createRequest(); 255 } else { 256 xmlhttp = false; 257 } 258 } 259 260 if( false != xmlhttp ) { 261 var data = { 262 type: 'POST', 263 check_url: href, 264 } 265 266 wp.ajax.send( 'url-exists', { 267 data: data, 268 success: function () { 269 linkNode.removeAttribute( 'data-link-broken' ); 270 badLinkFlag.css('display', 'none'); 271 }, 272 error: function() { 273 linkNode.setAttribute( 'data-link-broken', true ); 274 badLinkFlag.css('display', 'block'); 275 }, 276 }); 277 } 278 229 279 editor.dom.setAttribs( linkNode, { href: href, 'data-wplink-edit': null } ); 230 280 231 281 if ( ! tinymce.trim( linkNode.innerHTML ) ) { … … 483 533 editToolbar.tempHide = false; 484 534 485 535 if ( linkNode ) { 536 537 if( linkNode.hasAttribute('data-link-broken') ) { 538 badLinkFlag.css('display', 'block'); 539 } else { 540 badLinkFlag.css('display', 'none'); 541 } 542 486 543 $linkNode = editor.$( linkNode ); 487 544 href = $linkNode.attr( 'href' ); 488 545 edit = $linkNode.attr( 'data-wplink-edit' ); … … 551 608 classes: 'widget btn primary' 552 609 } ); 553 610 611 editor.addButton( 'wp_link_bad', { 612 type: 'WPBadLink', 613 onPostRender: function() { 614 badLinkFlag = $('#'+this._id); 615 } 616 } ); 617 554 618 return { 555 619 close: function() { 556 620 editToolbar.tempHide = false; … … 558 622 } 559 623 }; 560 624 } ); 561 } )( window.tinymce ); 625 } )( window.tinymce ); 626 No newline at end of file -
src/wp-includes/js/tinymce/skins/wordpress/wp-content.css
501 501 float: right; 502 502 } 503 503 504 /* For bad links in the text editor */ 505 a[data-link-broken="true"] { 506 color: #a00; 507 } 508 504 509 @media print, 505 510 (-o-min-device-pixel-ratio: 5/4), 506 511 (-webkit-min-device-pixel-ratio: 1.25),