Ticket #11420: internal-linking.third-pass.diff
File internal-linking.third-pass.diff, 26.6 KB (added by , 10 years ago) |
---|
-
wp-includes/js/tinymce/plugins/wplink/editor_plugin.js
1 (function(){tinymce.create("tinymce.plugins.wpLink",{init:function(a,b){a.addCommand("WP_Link",function(){a.windowManager.open({file:tinymce.baseURL+"/wp-mce-link.php",width:320,height:340,inline:1},{plugin_url:b})});a.addButton("link",{title:a.getLang("advanced.link_desc"),cmd:"WP_Link"});a.addShortcut("alt+shift+a",a.getLang("advanced.link_desc"),"WP_Link");a.onNodeChange.add(function(d,c,e){c.setActive("wplink",e.nodeName=="A")})},getInfo:function(){return{longname:"WordPress Link Dialog",author:"WordPress",authorurl:"http://wordpress.org",infourl:"",version:"1.0"}}});tinymce.PluginManager.add("wplink",tinymce.plugins.wpLink)})(); 2 No newline at end of file -
wp-includes/js/tinymce/plugins/wplink/js/wplink.js
1 (function($){ 2 $.widget('wp.wpTabs', { 3 options: {}, 4 _create: function() { 5 var self = this, 6 ul = this.element, 7 lis = ul.children(); 8 9 this.active = lis.filter('.wp-tab-active'); 10 // Calculate panel IDs 11 lis.each(function() { 12 var panel = self._getPanel( $(this) ); 13 if ( self.active[0] == this ) 14 panel.show(); 15 else 16 panel.hide(); 17 }); 18 19 ul.delegate('li', 'click.wpTabs', function(e) { 20 var li = $(this); 21 22 // Prevent any child link from redirecting the page. 23 e.preventDefault(); 24 // Deactivate previous tab. 25 self._getPanel( self.active ).hide(); 26 self.active.removeClass('wp-tab-active'); 27 self._trigger("hide", e, self.widget() ); 28 29 // Activate current tab. 30 self.active = li.addClass('wp-tab-active'); 31 self._getPanel( self.active ).show(); 32 self._trigger("show", e, self.widget() ); 33 }); 34 }, 35 widget: function() { 36 return { 37 ul: this.element, 38 tab: this.active, 39 panel: this._getPanel( this.active ) 40 }; 41 }, 42 _setPanel: function( $el ) { 43 var panel = $( '#' + $el.children('.wp-tab-for-id').val() ); 44 $el.data( 'wp-tab-panel', panel ); 45 return panel; 46 }, 47 _getPanel: function( $el ) { 48 var panel = $el.data('wp-tab-panel'); 49 return ( !panel || !panel.length ) ? this._setPanel( $el ) : panel; 50 } 51 }); 52 // Create tab bars by default. 53 $(function(){ 54 $('.wp-tab-bar').wpTabs(); 55 }); 56 })(jQuery); 57 58 (function($){ 59 var inputs = {}, panels, active, ed, 60 wpLink = { 61 init : function() { 62 var e, etarget, eclass; 63 // Init shared vars 64 ed = tinyMCEPopup.editor; 65 // Secondary options 66 inputs.title = $('#link-title-field'); 67 // Advanced Options 68 inputs.openInNewTab = $('#link-target-checkbox'); 69 // Types 70 inputs.typeDropdown = $('#link-type'); 71 inputs.typeOptions = inputs.typeDropdown.find('option'); 72 73 panels = $('.link-panel'); 74 active = $('.link-panel-active'); 75 76 // Extract type names 77 inputs.typeOptions.each( function(){ 78 var linkType = this.id.replace(/^link-option-id-/,''), 79 parts = linkType.split('-'); 80 $(this).data( 'link-type', { 81 full : linkType, 82 type : parts[0], 83 name : parts[1] || '' 84 }); 85 }); 86 panels.each( function(){ 87 var linkType = this.id.replace(/^link-panel-id-/,''), 88 parts = linkType.split('-'); 89 $(this).data( 'link-type', { 90 full : linkType, 91 type : parts[0], 92 name : parts[1] || '' 93 }); 94 }); 95 96 // Bind event handlers 97 inputs.typeDropdown.change( wpLink.selectPanel ); 98 $('#wp-update').click( wpLink.update ); 99 $('#wp-cancel').click( function() { tinyMCEPopup.close(); } ); 100 $('.link-panel .wp-tab-bar').wpTabs('option', 'show', wpLink.maybeLoadPanel ); 101 $('.link-panel .wp-tab-panel').delegate('li', 'click', wpLink.selectInternalLink ); 102 $('.wp-tab-panel-pagelinks').delegate('a', 'click', wpLink.selectPageLink ); 103 $('.link-panel .link-search-field').keyup( wpLink.searchInternalLinks ); 104 105 // If link exists, select proper values. 106 e = ed.dom.getParent(ed.selection.getNode(), 'A'); 107 if ( ! e ) 108 return; 109 110 // @TODO: select proper panel/fill values when a link is edited 111 active.find('input.url-field').val( e.href ); 112 inputs.title.val( ed.dom.getAttrib(e, 'title') ); 113 // Advanced Options 114 115 if ( "_blank" == ed.dom.getAttrib(e, 'target') ) 116 inputs.openInNewTab.attr('checked','checked'); 117 }, 118 119 update : function() { 120 var el, 121 ed = tinyMCEPopup.editor, 122 attrs = { 123 title : inputs.title.val(), 124 target : inputs.openInNewTab.attr('checked') ? '_blank' : '' 125 }, defaultContent, e, b; 126 127 if ( active.hasClass('link-panel-custom') ) { 128 attrs.href = active.find('input.url-field').val(); 129 defaultContent = attrs.href; 130 } else { 131 el = active.find('li.selected:visible'); 132 if ( !el.length ) 133 return; 134 135 attrs.href = el.children('input').val(); 136 defaultContent = el.text(); 137 } 138 139 tinyMCEPopup.restoreSelection(); 140 e = ed.dom.getParent(ed.selection.getNode(), 'A'); 141 142 // If the values are empty... 143 if ( ! attrs.href ) { 144 // ...and nothing is selected, we should return 145 if ( ed.selection.isCollapsed() ) { 146 tinyMCEPopup.close(); 147 return; 148 // ...and a link exists, we should unlink and return 149 } else if ( e ) { 150 tinyMCEPopup.execCommand("mceBeginUndoLevel"); 151 b = ed.selection.getBookmark(); 152 ed.dom.remove(e, 1); 153 ed.selection.moveToBookmark(b); 154 tinyMCEPopup.execCommand("mceEndUndoLevel"); 155 tinyMCEPopup.close(); 156 return; 157 } 158 } 159 160 tinyMCEPopup.execCommand("mceBeginUndoLevel"); 161 162 if (e == null) { 163 ed.getDoc().execCommand("unlink", false, null); 164 165 // If no selection exists, create a new link from scratch. 166 if ( ed.selection.isCollapsed() ) { 167 var el = ed.dom.create('a', { href: "#mce_temp_url#" }, defaultContent); 168 ed.selection.setNode(el); 169 // If a selection exists, wrap it in a link. 170 } else { 171 tinyMCEPopup.execCommand("CreateLink", false, "#mce_temp_url#", {skip_undo : 1}); 172 } 173 174 tinymce.each(ed.dom.select("a"), function(n) { 175 if (ed.dom.getAttrib(n, 'href') == '#mce_temp_url#') { 176 e = n; 177 ed.dom.setAttribs(e, attrs); 178 } 179 }); 180 } else { 181 ed.dom.setAttribs(e, attrs); 182 } 183 184 // Don't move caret if selection was image 185 if (e.childNodes.length != 1 || e.firstChild.nodeName != 'IMG') { 186 ed.focus(); 187 ed.selection.select(e); 188 ed.selection.collapse(0); 189 tinyMCEPopup.storeSelection(); 190 } 191 192 tinyMCEPopup.execCommand("mceEndUndoLevel"); 193 tinyMCEPopup.close(); 194 }, 195 196 selectPanel : function( option ) { 197 var sel = inputs.typeOptions.filter(':selected'); 198 199 if ( option.jquery ) { 200 sel.removeAttr('selected'); 201 sel = option.attr('selected', 'selected'); 202 } 203 204 active.removeClass('link-panel-active'); 205 active = $('#link-panel-id-' + sel.data('link-type').full ).addClass('link-panel-active'); 206 wpLink.maybeLoadPanel(); 207 }, 208 209 maybeLoadPanel : function() { 210 var panel = active.find('.wp-tab-panel:visible'); 211 if ( panel.length && panel.find('.wp-tab-panel-loading').length ) 212 wpLink.linkPanelAJAX( panel ); 213 }, 214 215 linkPanelAJAX : function( $panel, params, callback ) { 216 if ( ! $panel.hasClass('wp-tab-panel') ) 217 $panel = $panel.parents('.wp-tab-panel'); 218 219 if ( ! $panel.length ) 220 return; 221 222 var query = $panel.children('.wp-tab-panel-query').val(); 223 224 wpLink.linkAJAX( $panel, $.extend({ 225 preset : query, 226 page : 'all' == query ? 1 : 0 227 }, params), function(r, lt) { 228 var pagelinks = $panel.children('.wp-tab-panel-pagelinks'); 229 230 // Set results 231 $panel.children('ul').html( wpLink.generateListMarkup( r['results'], lt ) ); 232 233 // Handle page links 234 if ( r['page_links'] ) 235 pagelinks.html( r['page_links'] ).show(); 236 else 237 pagelinks.hide(); 238 // Run callback 239 if ( callback ) 240 callback(r, lt); 241 }) 242 }, 243 244 selectInternalLink : function() { 245 var t = $(this); 246 if ( t.hasClass('unselectable') ) 247 return; 248 t.siblings('.selected').removeClass('selected'); 249 t.addClass('selected'); 250 }, 251 252 selectPageLink : function(e) { 253 var page = e.target.href.match(/page=(\d+)/); 254 255 page = page ? page[1] : 1; // If there's no match, it's the first page. 256 e.preventDefault(); // Prevent the link from redirecting. 257 258 wpLink.linkPanelAJAX( $(this), { page : page }); 259 }, 260 261 searchInternalLinks : function() { 262 var t = $(this), 263 waiting = t.siblings('img.waiting').show(); 264 265 wpLink.linkPanelAJAX( t, { title : t.val() }, function(){ waiting.hide(); }); 266 }, 267 268 linkAJAX : function( el, params, callback ) { 269 var linkType = el.parents('.link-panel').data('link-type'); 270 $.post( ajaxurl, $.extend({ 271 action : 'wp-link-ajax', 272 type : linkType.type, 273 name : linkType.name 274 }, params ), function(r) { 275 return callback(r, linkType); 276 }, "json" ); 277 }, 278 279 generateListMarkup : function( results, linkType ) { 280 var s = ''; 281 282 if ( ! results ) 283 return '<li class="no-matches-found unselectable"><em>' + wpLinkL10n.noMatchesFound + '</em></li>'; 284 285 $.each( results, function() { 286 s+= '<li id="link-to-' + linkType.full + '-' + this['ID'] + '">'; 287 s+= '<input type="hidden" value="' + this['permalink'] + '" />'; 288 s+= this['title'] ? this['title'] : '<em>'+ wpLinkL10n.untitled + '</em>'; 289 s+= '</li>'; 290 }); 291 return s; 292 } 293 } 294 295 $(document).ready( wpLink.init ); 296 })(jQuery); 297 No newline at end of file -
wp-includes/js/tinymce/plugins/wplink/editor_plugin.dev.js
1 (function() { 2 tinymce.create('tinymce.plugins.wpLink', { 3 /** 4 * Initializes the plugin, this will be executed after the plugin has been created. 5 * This call is done before the editor instance has finished it's initialization so use the onInit event 6 * of the editor instance to intercept that event. 7 * 8 * @param {tinymce.Editor} ed Editor instance that the plugin is initialized in. 9 * @param {string} url Absolute URL to where the plugin is located. 10 */ 11 init : function(ed, url) { 12 // Register the command so that it can be invoked by using tinyMCE.activeEditor.execCommand('mceExample'); 13 ed.addCommand('WP_Link', function() { 14 ed.windowManager.open({ 15 file : tinymce.baseURL + '/wp-mce-link.php', 16 width : 320, 17 height : 340, 18 inline : 1 19 }, { 20 plugin_url : url // Plugin absolute URL 21 }); 22 }); 23 24 // Register example button 25 ed.addButton('link', { 26 title : ed.getLang('advanced.link_desc'), 27 cmd : 'WP_Link' 28 }); 29 30 ed.addShortcut('alt+shift+a', ed.getLang('advanced.link_desc'), 'WP_Link'); 31 32 // Add a node change handler, selects the button in the UI when a link is selected 33 ed.onNodeChange.add(function(ed, cm, n) { 34 cm.setActive('wplink', n.nodeName == 'A'); 35 }); 36 }, 37 /** 38 * Returns information about the plugin as a name/value array. 39 * The current keys are longname, author, authorurl, infourl and version. 40 * 41 * @return {Object} Name/value array containing information about the plugin. 42 */ 43 getInfo : function() { 44 return { 45 longname : 'WordPress Link Dialog', 46 author : 'WordPress', 47 authorurl : 'http://wordpress.org', 48 infourl : '', 49 version : "1.0" 50 }; 51 } 52 }); 53 54 // Register plugin 55 tinymce.PluginManager.add('wplink', tinymce.plugins.wpLink); 56 })(); 57 No newline at end of file -
wp-includes/js/tinymce/wp-mce-link.php
1 <?php 2 include 'wp-mce-link-includes.php'; 3 header('Content-Type: text/html; charset=' . get_bloginfo('charset')); 4 ?> 5 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 6 <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>> 7 <head> 8 <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" /> 9 <title><?php _e('Insert/edit link') ?></title> 10 <script type="text/javascript"> 11 //<![CDATA[ 12 var ajaxurl = '<?php echo admin_url('admin-ajax.php'); ?>', 13 wpLinkL10n = { 14 untitled : '<?php _e('Untitled'); ?>', 15 noMatchesFound : '<?php _e('No matches found.'); ?>' 16 }; 17 //]]> 18 </script> 19 <script type="text/javascript" src="tiny_mce_popup.js?ver=3223"></script> 20 <?php 21 wp_print_scripts( array('jquery', 'jquery-ui-widget') ); 22 ?> 23 <script type="text/javascript" src="plugins/wplink/js/wplink.js?ver=1.0"></script> 24 <?php 25 wp_admin_css( 'global', true ); 26 wp_admin_css( 'wp-admin', true ); 27 wp_admin_css( 'colors-fresh', true ); 28 ?> 29 <style> 30 html, body { 31 background: #f1f1f1; 32 } 33 34 a:link, a:visited { 35 color: #21759B; 36 } 37 38 select { 39 height: 2em; 40 } 41 42 #link-header, 43 #link-options, 44 #link-advanced-options { 45 padding: 5px; 46 border-bottom: 1px solid #dfdfdf; 47 } 48 #link-type { 49 width: 140px; 50 } 51 52 .link-panel { 53 padding: 5px 5px 0; 54 display: none; 55 } 56 .link-panel-active { 57 display: block; 58 } 59 60 label input[type="text"] { 61 width: 220px; 62 } 63 .wp-tab-panel label input[type="text"] { 64 float: left; 65 width: 200px; 66 } 67 68 label span { 69 display: inline-block; 70 width: 80px; 71 text-align: right; 72 padding-right: 5px; 73 } 74 .wp-tab-panel label span { 75 width: auto; 76 text-align: left; 77 float: left; 78 margin-top: 3px; 79 } 80 .link-search-wrapper { 81 padding: 5px; 82 border-bottom: solid 1px #dfdfdf; 83 display: block; 84 overflow: hidden; 85 } 86 .link-search-wrapper img.waiting { 87 margin: 4px 1px 0 4px; 88 float: left; 89 display: none; 90 } 91 92 #open-in-new-tab { 93 padding-left: 87px; 94 } 95 #open-in-new-tab span { 96 width: auto; 97 margin-left: 10px; 98 font-size: 11px; 99 } 100 101 .submitbox { 102 padding: 5px; 103 font-size: 11px; 104 overflow: auto; 105 height: 29px; 106 } 107 #wp-cancel { 108 line-height: 25px; 109 float: left; 110 } 111 #wp-update { 112 line-height: 23px; 113 float: right; 114 } 115 #wp-update a { 116 display: inline-block; 117 } 118 .wp-tab-active, 119 .wp-tab-panel { 120 background: #fff; 121 } 122 .wp-tab-panel { 123 height: 160px; 124 padding: 0; 125 } 126 .wp-tab-panel li { 127 margin-bottom: 0; 128 border-bottom: 1px solid #dfdfdf; 129 color: #555; 130 padding: 4px 6px; 131 cursor: pointer; 132 } 133 .wp-tab-panel li:hover { 134 background: #EAF2FA; 135 color: #333; 136 } 137 .wp-tab-panel li.selected { 138 background: #f1f1f1; 139 font-weight: bold; 140 color: #333; 141 } 142 .wp-tab-panel-pagelinks { 143 display: none; 144 padding:4px 0; 145 margin:0 auto; 146 text-align:center; 147 } 148 .wp-tab-panel-pagelinks-top { 149 border-bottom: 1px solid #dfdfdf; 150 } 151 </style> 152 </head> 153 <?php 154 155 $pts = get_post_types( array( 'public' => true ), 'objects' ); 156 $queries = array( 157 array( 'preset' => 'all', 'label' => __('View All') ), 158 array( 'preset' => 'recent', 'label' => __('Most Recent') ), 159 array( 'preset' => 'search', 'label' => __('Search') ) 160 ); 161 162 ?> 163 <body id="post-body"> 164 <div id="link-header"> 165 <label for="link-type"> 166 <span><strong><?php _e('Link Type:'); ?></strong> 167 </span><select id="link-type"> 168 <option id="link-option-id-custom" class="link-custom"><?php _e('External Link'); ?></option> 169 <?php 170 foreach ( $pts as $pt ) { 171 echo "<option id='link-option-id-pt-$pt->name' class='link-option-pt'>"; 172 echo $pt->labels->singular_name . '</option>'; 173 } ?> 174 </select> 175 </label> 176 </div> 177 <div id="link-selector"> 178 <?php 179 wp_link_panel_custom(); 180 foreach( $pts as $pt ) 181 wp_link_panel_structure('pt', $pt->name, $queries); 182 ?> 183 <div id="link-options"> 184 <label for="link-title-field"> 185 <span><?php _e('Description:'); ?></span><input id="link-title-field" type="text" /> 186 </label> 187 <label for="link-target-checkbox" id="open-in-new-tab"> 188 <input type="checkbox" id="link-target-checkbox" /><span><?php _e('Open in new tab'); ?></span> 189 </label> 190 </div> 191 </div> 192 <div class="submitbox"> 193 <div id="wp-cancel"> 194 <a class="submitdelete deletion"><?php _e('Cancel'); ?></a> 195 </div> 196 <div id="wp-update"> 197 <a class="button-primary"><?php _e('Update'); ?></a> 198 </div> 199 </div> 200 </body> 201 </html> -
wp-includes/js/tinymce/wp-mce-link-includes.php
1 <?php 2 /** @ignore */ 3 if ( ! defined('ABSPATH') ) 4 require_once('../../../wp-load.php'); 5 6 7 class WP_Tab_Bar { 8 var $tabs = array(); 9 10 var $selected = ''; 11 12 function add( $id, $label, $url='' ) { 13 array_push( $this->tabs, array( 14 'label' => $label, 15 'for' => $id, 16 'url' => $url 17 )); 18 } 19 20 function select( $id ) { 21 $this->selected = $id; 22 } 23 24 function render( $echo=true ) { 25 if ( empty( $this->selected ) ) 26 $this->selected = $this->tabs[0]['for']; 27 28 $out = "<ul class='wp-tab-bar'>"; 29 foreach( $this->tabs as $tab ) { 30 if ( !isset($tab['url']) ) 31 $tab['url'] = ''; 32 33 $out.= "<li class='"; 34 $out.= $this->selected == $tab['for'] ? 'wp-tab-active' : ''; 35 $out.= "'><input type='hidden' class='wp-tab-for-id' value='{$tab['for']}' />"; 36 $out.= "<a href='{$tab['url']}#{$tab['for']}'>"; 37 $out.= "{$tab['label']}</a></li>"; 38 } 39 $out.= "</ul>"; 40 41 if ( $echo ) 42 echo $out; 43 44 return $out; 45 } 46 } 47 48 function wp_link_panel_custom() { ?> 49 <div id="link-panel-id-custom" class="link-panel link-panel-custom link-panel-active"> 50 <input type="hidden" class="link-panel-type" value="custom" /> 51 <label> 52 <span><?php _e('URL:'); ?></span><input class="url-field" type="text" /> 53 </label> 54 </div> 55 <?php } 56 57 function wp_link_panel_structure( $panel_type, $name, $queries ) { 58 $id = $panel_type . '-' . $name; 59 60 ?> 61 <div id="link-panel-id-<?php echo $id; ?>" class="link-panel link-panel-<?php echo $panel_type; ?>"> 62 <!-- <input type="hidden" class="link-panel-type" value="<?php echo $panel_type; ?>" /> --> 63 <!-- <input type="hidden" class="link-panel-id" value="" /> --> 64 <?php 65 66 $tb = new WP_Tab_Bar(); 67 foreach( $queries as $i => $query ) { 68 $queries[$i]['id'] = "$id-{$query['preset']}"; 69 $tb->add( $queries[$i]['id'], $query['label'] ); 70 } 71 $tb->render(); 72 73 foreach( $queries as $query ): ?> 74 <div id="<?php echo $query['id']; ?>" class="wp-tab-panel"> 75 <input type="hidden" class="wp-tab-panel-query" value="<?php echo $query['preset']; ?>" /> 76 77 <?php if ( 'search' == $query['preset'] ): ?> 78 <label for="<?php echo $id; ?>-search-field" class="link-search-wrapper"> 79 <span><?php _e('Search:'); ?></span> 80 <input type="text" id="<?php echo $id; ?>-search-field" class="link-search-field" /> 81 <img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" /> 82 </label> 83 <ul id="<?php echo $id; ?>-search-results" class="link-search-results"></ul> 84 85 <?php else: ?> 86 <div class="wp-tab-panel-pagelinks wp-tab-panel-pagelinks-top"></div> 87 <ul> 88 <li class="wp-tab-panel-loading unselectable"><em><?php _e('Loading...'); ?></em></li> 89 </ul> 90 <div class="wp-tab-panel-pagelinks wp-tab-panel-pagelinks-bottom"></div> 91 <?php endif; ?> 92 </div> 93 <?php endforeach; ?> 94 </div> 95 <?php } 96 97 function wp_link_query_post_type( $pt_obj, $preset='all', $opts=array() ) { 98 $args_base = array( 99 'post_type' => $pt_obj->name, 100 'suppress_filters' => true, 101 'update_post_term_cache' => false, 102 'update_post_meta_cache' => false, 103 'post_status' => 'publish', 104 ); 105 106 switch( $preset ) { 107 case 'all': 108 $args = array_merge( $args_base, array( 109 'order' => 'ASC', 110 'orderby' => 'title', 111 'posts_per_page' => 20, 112 )); 113 break; 114 case 'recent': 115 $args = array_merge( $args_base, array( 116 'order' => 'DESC', 117 'orderby' => 'post_date', 118 'posts_per_page' => 15, 119 )); 120 break; 121 case 'search': 122 $args = array_merge( $args_base, array( 123 's' => isset($opts['search']) ? $opts['search'] : '', 124 'posts_per_page' => 10 125 )); 126 break; 127 } 128 129 // Handle pages if a page number is specified. 130 if ( isset( $opts['pagenum'] ) && isset( $args['posts_per_page'] ) ) { 131 $pages = array( 132 'current' => $opts['pagenum'], 133 'per_page' => $args['posts_per_page'] 134 ); 135 136 if ( ! isset( $args['offset'] ) ) 137 $args['offset'] = 0 < $opts['pagenum'] ? $args['posts_per_page'] * ( $opts['pagenum'] - 1 ) : 0; 138 $pages['offset'] = $args['offset']; 139 } 140 141 // Allow args to be extended. 142 if ( isset( $opts['args'] ) ) 143 $args = array_merge( $args, $opts['args'] ); 144 145 // Do main query. 146 $get_posts = new WP_Query; 147 $posts = $get_posts->query( $args ); 148 // Check if any posts were found. 149 if ( ! $get_posts->post_count ) 150 return false; 151 152 // Build results. 153 $results = array(); 154 foreach ( $posts as $post ) { 155 $results[] = array( 156 'ID' => $post->ID, 157 'title' => $post->post_title, 158 'permalink' => get_permalink( $post->ID ) 159 ); 160 } 161 // Build response. 162 $resp = array( 163 'query' => $get_posts, 164 'objects' => $posts, 165 'results' => $results 166 ); 167 168 // Set remaining pages values. 169 if ( isset( $pages ) ) { 170 $pages['max'] = $resp['query']->max_num_pages; 171 $pages['page_links'] = paginate_links( array( 172 'prev_text' => __('«'), 173 'next_text' => __('»'), 174 'total' => $pages['max'], 175 'current' => $pages['current'] 176 )); 177 $resp['pages'] = $pages; 178 } 179 180 return $resp; 181 } 182 183 function wp_link_ajax( $request ) { 184 if ( !isset($request['type']) || !isset($request['name']) || !isset($request['preset']) ) 185 die('-1'); 186 187 // Run only presets we recognize. 188 if ( 'pt' != $request['type'] || ! in_array( $request['preset'], array('all','search','recent') ) ) 189 die('-1'); 190 // Searches must have a search term. 191 else if ( 'search' == $request['preset'] && !isset($request['title']) ) 192 die('-1'); 193 194 $opts = array(); 195 if ( 'search' == $request['preset'] ) { 196 $opts['search'] = $request['title']; 197 } else if ( ! empty( $request['page'] ) ) { 198 $opts['pagenum'] = $request['page']; 199 } 200 201 if ( 'pt' == $request['type'] && $obj = get_post_type_object($request['name']) ) 202 $resp = wp_link_query_post_type( $obj, $request['preset'], $opts ); 203 204 if ( ! isset( $resp ) ) 205 die('0'); 206 207 $json = array( 'results' => $resp['results'] ); 208 if ( isset( $resp['pages'] ) && !empty( $resp['pages']['page_links'] ) ) 209 $json['page_links'] = $resp['pages']['page_links']; 210 211 echo json_encode( $json ); 212 echo "\n"; 213 } 214 ?> 215 No newline at end of file -
wp-admin/admin-ajax.php
1102 1102 1103 1103 exit; 1104 1104 break; 1105 case 'wp-link-ajax': 1106 require_once ABSPATH . WPINC . '/js/tinymce/wp-mce-link-includes.php'; 1107 1108 wp_link_ajax( $_REQUEST ); 1109 1110 exit; 1111 break; 1105 1112 case 'menu-locations-save': 1106 1113 if ( ! current_user_can( 'edit_theme_options' ) ) 1107 1114 die('-1'); -
wp-admin/includes/post.php
1311 1311 $mce_spellchecker_languages = apply_filters('mce_spellchecker_languages', '+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv'); 1312 1312 1313 1313 if ( $teeny ) { 1314 $plugins = apply_filters( 'teeny_mce_plugins', array('inlinepopups', 'media', 'fullscreen', 'wordpress' ) );1314 $plugins = apply_filters( 'teeny_mce_plugins', array('inlinepopups', 'media', 'fullscreen', 'wordpress', 'wplink') ); 1315 1315 $ext_plugins = ''; 1316 1316 } else { 1317 $plugins = array( 'inlinepopups', 'spellchecker', 'paste', 'wordpress', 'media', 'fullscreen', 'wpeditimage', 'wpgallery', 'tabfocus' );1317 $plugins = array( 'inlinepopups', 'spellchecker', 'paste', 'wordpress', 'media', 'fullscreen', 'wpeditimage', 'wpgallery', 'tabfocus', 'wplink' ); 1318 1318 1319 1319 /* 1320 1320 The following filter takes an associative array of external plugins for TinyMCE in the form 'plugin_name' => 'url'. -
wp-admin/css/colors-fresh.dev.css
110 110 } 111 111 112 112 div.tabs-panel, 113 .wp-tab-panel, 113 114 ul.category-tabs li.tabs, 114 ul.add-menu-item-tabs li.tabs { 115 ul.add-menu-item-tabs li.tabs, 116 .wp-tab-active { 115 117 border-color: #dfdfdf; 116 118 } 117 119 118 120 ul.category-tabs li.tabs, 119 ul.add-menu-item-tabs li.tabs { 121 ul.add-menu-item-tabs li.tabs, 122 .wp-tab-active { 120 123 background-color: #f1f1f1; 121 124 } 122 125 … … 382 385 } 383 386 384 387 #side-sortables .category-tabs .tabs a, 385 #side-sortables .add-menu-item-tabs .tabs a { 388 #side-sortables .add-menu-item-tabs .tabs a, 389 .wp-tab-bar .wp-tab-active a { 386 390 color: #333; 387 391 } 388 392 -
wp-admin/css/wp-admin.dev.css
2029 2029 text-decoration: none; 2030 2030 } 2031 2031 2032 .wp-tab-panel, 2032 2033 .categorydiv div.tabs-panel, 2033 2034 .customlinkdiv div.tabs-panel, 2034 2035 .posttypediv div.tabs-panel, … … 2063 2064 } 2064 2065 2065 2066 #side-sortables .category-tabs li, 2066 #side-sortables .add-menu-item-tabs li { 2067 #side-sortables .add-menu-item-tabs li, 2068 .wp-tab-bar li { 2067 2069 display: inline; 2068 2070 } 2069 2071 2070 2072 #side-sortables .category-tabs a, 2071 #side-sortables .add-menu-item-tabs a { 2073 #side-sortables .add-menu-item-tabs a, 2074 .wp-tab-bar a { 2072 2075 text-decoration: none; 2073 2076 } 2074 2077 2075 2078 #side-sortables .category-tabs, 2076 #side-sortables .add-menu-item-tabs { 2079 #side-sortables .add-menu-item-tabs, 2080 .wp-tab-bar { 2077 2081 margin-bottom: 3px; 2078 2082 } 2079 2083 … … 2110 2114 margin-bottom: 0px; 2111 2115 } 2112 2116 2113 .categorydiv .tabs-panel,2114 .customlinkdiv .tabs-panel,2115 .posttypediv .tabs-panel,2116 .taxonomydiv .tabs-panel {2117 border-width: 3px;2118 border-style: solid;2119 }2120 2121 2117 ul.category-tabs, 2122 ul.add-menu-item-tabs { 2118 ul.add-menu-item-tabs, 2119 ul.wp-tab-bar { 2123 2120 margin-top: 12px; 2124 2121 } 2125 2122 2126 2123 ul.category-tabs li.tabs, 2127 ul.add-menu-item-tabs li.tabs { 2124 ul.add-menu-item-tabs li.tabs, 2125 .wp-tab-active { 2128 2126 border-style: solid solid none; 2129 2127 border-width: 1px 1px 0; 2130 2128 } … … 2137 2135 } 2138 2136 2139 2137 ul.category-tabs li, 2140 ul.add-menu-item-tabs li { 2138 ul.add-menu-item-tabs li, 2139 ul.wp-tab-bar li { 2141 2140 padding: 5px; 2142 2141 -moz-border-radius: 3px 3px 0 0; 2143 2142 -webkit-border-top-left-radius: 3px;