Ticket #11420: internal-linking.second-pass.diff
File internal-linking.second-pass.diff, 32.5 KB (added by , 10 years ago) |
---|
-
wp-includes/js/tinymce/plugins/wplink/editor_plugin.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 : 380, 18 inline : 1 19 }, { 20 plugin_url : url // Plugin absolute URL 21 }); 22 }); 23 24 // Register example button 25 ed.addButton('wplink', { 26 title : ed.getLang('wplink.link_desc'), 27 cmd : 'WP_Link' 28 }); 29 30 ed.addShortcut('alt+shift+a', ed.getLang('wplink.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/plugins/wplink/js/wplink.js
1 // WPTABS 2 (function($){ 3 $.widget('wp.wpTabs', { 4 options: { 5 6 }, 7 _create: function() { 8 var self = this, 9 ul = this.element, 10 lis = ul.children(); 11 12 this.active = lis.filter('.wp-tab-active'); 13 // Calculate panel IDs 14 lis.each(function() { 15 var panel = self._getPanel( $(this) ); 16 if ( self.active[0] == this ) 17 panel.show(); 18 else 19 panel.hide(); 20 }); 21 22 ul.delegate('li', 'click.wpTabs', function(e) { 23 var li = $(this); 24 25 // Prevent any child link from redirecting the page. 26 e.preventDefault(); 27 // Deactivate previous tab. 28 self._getPanel( self.active ).hide(); 29 self.active.removeClass('wp-tab-active'); 30 // Activate current tab. 31 self.active = li.addClass('wp-tab-active'); 32 self._getPanel( self.active ).show(); 33 }); 34 }, 35 _setPanel: function( $el ) { 36 var panel = $( '#' + $el[0].id.replace('wp-tab-for-','') ); 37 $el.data( 'wp-tab-panel', panel ); 38 return panel; 39 }, 40 _getPanel: function( $el ) { 41 var panel = $el.data('wp-tab-panel'); 42 return ( !panel || !panel.length ) ? this._setPanel( $el ) : panel; 43 } 44 }); 45 // Create tab bars by default. 46 $(function(){ 47 $('.wp-tab-bar').wpTabs(); 48 }); 49 })(jQuery); 50 51 (function($){ 52 var inputs = {}, panels, active, ed, 53 wpLink = { 54 init : function() { 55 var e, etarget, eclass; 56 // Init shared vars 57 ed = tinyMCEPopup.editor; 58 // Secondary options 59 inputs.title = $('#link-title-field'); 60 // Advanced Options 61 inputs.advancedOptions = $('#link-advanced-options'); 62 inputs.target = $('#link-target-select'); 63 inputs['class'] = $('#link-class-select'); 64 // Types 65 inputs.typeDropdown = $('#link-type'); 66 inputs.typeOptions = inputs.typeDropdown.find('option'); 67 68 panels = $('.link-panel'); 69 active = $('.link-panel-active'); 70 71 // Build lists 72 wpLink.fillClassList('link-class-select'); 73 wpLink.fillTargetList('link-target-select'); 74 75 // Extract type names 76 inputs.typeOptions.each( function(){ 77 var linkType = this.id.replace(/^link-option-id-/,''), 78 parts = linkType.split('-'); 79 $(this).data( 'link-type', { 80 full : linkType, 81 type : parts[0], 82 name : parts[1] || '' 83 }); 84 }); 85 panels.each( function(){ 86 var linkType = this.id.replace(/^link-panel-id-/,''), 87 parts = linkType.split('-'); 88 $(this).data( 'link-type', { 89 full : linkType, 90 type : parts[0], 91 name : parts[1] || '' 92 }); 93 }); 94 95 // Bind event handlers 96 inputs.typeDropdown.change( wpLink.selectPanel ); 97 $('#wp-update').click( wpLink.update ); 98 $('#wp-cancel').click( function() { tinyMCEPopup.close(); } ); 99 $('#link-advanced-options-toggle').click( wpLink.toggleAdvancedOptions ); 100 $('.link-panel .wp-tab-panel').delegate('li', 'click', wpLink.selectInternalLink ); 101 $('.link-panel .link-search-field').keyup( wpLink.searchInternalLinks ); 102 103 // If link exists, select proper values. 104 e = ed.dom.getParent(ed.selection.getNode(), 'A'); 105 if ( ! e ) 106 return; 107 108 // @TODO: select proper panel/fill values when a link is edited 109 active.find('input.url-field').val( e.href ); 110 inputs.title.val( ed.dom.getAttrib(e, 'title') ); 111 // Advanced Options 112 inputs.target.val( etarget = ed.dom.getAttrib(e, 'target') ); 113 inputs['class'].val( eclass = ed.dom.getAttrib(e, 'class') ); 114 if ( etarget || eclass ) // Open the adv. options if one is set. 115 inputs.advancedOptions.toggleClass('adv-options-active'); 116 }, 117 118 update : function() { 119 var el, 120 ed = tinyMCEPopup.editor, 121 attrs = { 122 title : inputs.title.val(), 123 target : inputs.target.val(), 124 'class' : inputs['class'].val() 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 }, 207 208 toggleAdvancedOptions : function() { 209 inputs.advancedOptions.toggleClass('adv-options-active'); 210 return false; 211 }, 212 213 selectInternalLink : function() { 214 $(this).siblings('.selected').removeClass('selected'); 215 $(this).addClass('selected'); 216 }, 217 218 searchInternalLinks : function() { 219 var t = $(this), 220 linkType = t.parents('.link-panel').data('link-type'), 221 waiting = t.siblings('img.waiting').show(); 222 $.post( ajaxurl, { 223 action : 'wp-link-search', 224 type : linkType.type, 225 name : linkType.name, 226 title : t.val() 227 }, function(r) { 228 var s = ''; 229 $.each( r, function() { 230 s+= '<li id="link-to-' + linkType.full + '-' + this['ID'] + '">'; 231 s+= '<input type="hidden" value="' + this['permalink'] + '" />'; 232 s+= this['title'] + '</li>'; 233 }); 234 235 t.parent().siblings('ul').html( s ); 236 waiting.hide(); 237 }, "json"); 238 }, 239 240 /** 241 * Taken from themes/advanced/js/link.js 242 */ 243 fillClassList : function(id) { 244 var dom = tinyMCEPopup.dom, lst = dom.get(id), v, cl; 245 246 if (v = tinyMCEPopup.getParam('theme_advanced_styles')) { 247 cl = []; 248 249 tinymce.each(v.split(';'), function(v) { 250 var p = v.split('='); 251 252 cl.push({'title' : p[0], 'class' : p[1]}); 253 }); 254 } else 255 cl = tinyMCEPopup.editor.dom.getClasses(); 256 257 if (cl.length > 0) { 258 lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), ''); 259 260 tinymce.each(cl, function(o) { 261 lst.options[lst.options.length] = new Option(o.title || o['class'], o['class']); 262 }); 263 } else 264 dom.remove(dom.getParent(id, 'tr')); 265 }, 266 267 /** 268 * Taken from themes/advanced/js/link.js 269 */ 270 fillTargetList : function(id) { 271 var dom = tinyMCEPopup.dom, lst = dom.get(id), v; 272 273 lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('not_set'), ''); 274 lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('advanced_dlg.link_target_same'), '_self'); 275 lst.options[lst.options.length] = new Option(tinyMCEPopup.getLang('advanced_dlg.link_target_blank'), '_blank'); 276 277 if (v = tinyMCEPopup.getParam('theme_advanced_link_targets')) { 278 tinymce.each(v.split(','), function(v) { 279 v = v.split('='); 280 lst.options[lst.options.length] = new Option(v[0], v[1]); 281 }); 282 } 283 } 284 } 285 286 $(document).ready( wpLink.init ); 287 })(jQuery); 288 No newline at end of file -
wp-includes/js/tinymce/langs/wp-langs-en.js
429 429 caption:"Edit Image Caption", 430 430 alt:"Edit Alternate Text" 431 431 }); 432 433 tinyMCE.addI18n("en.wplink",{ 434 link_desc:"Insert/edit link", 435 unlink_desc:"Unlink (Alt+Shift+S)" 436 }); -
wp-includes/js/tinymce/langs/wp-langs.php
452 452 caption:"' . mce_escape( __('Edit Image Caption') ) . '", 453 453 alt:"' . mce_escape( __('Edit Alternate Text') ) . '" 454 454 }); 455 456 tinyMCE.addI18n("' . $language . '.wplink",{ 457 link_desc:"' . mce_escape( __('Insert/edit link') ) . '", 458 unlink_desc:"' . mce_escape( __('Unlink') ) . ' (Alt+Shift+S)" 459 }); 455 460 '; -
wp-includes/js/tinymce/themes/advanced/skins/wp_theme/ui.css
274 274 .wp_themeSkin span.mce_anchor {background-position:-200px 0} 275 275 .wp_themeSkin span.mce_indent {background-position:-400px 0} 276 276 .wp_themeSkin span.mce_outdent {background-position:-540px 0} 277 .wp_themeSkin span.mce_link {background-position:-500px 0} 277 .wp_themeSkin span.mce_link, 278 .wp_themeSkin span.mce_wplink {background-position:-500px 0} 278 279 .wp_themeSkin span.mce_unlink {background-position:-640px 0} 279 280 .wp_themeSkin span.mce_sub {background-position:-600px 0} 280 281 .wp_themeSkin span.mce_sup {background-position:-620px 0} -
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 //]]> 14 </script> 15 <script type="text/javascript" src="tiny_mce_popup.js?ver=3223"></script> 16 <?php 17 wp_print_scripts( array('jquery', 'jquery-ui-widget') ); 18 ?> 19 <script type="text/javascript" src="plugins/wplink/js/wplink.js?ver=1.0"></script> 20 <?php 21 wp_admin_css( 'global', true ); 22 wp_admin_css( 'wp-admin', true ); 23 wp_admin_css( 'colors-fresh', true ); 24 ?> 25 <style> 26 html, body { 27 background: #f1f1f1; 28 } 29 30 a:link, a:visited { 31 color: #21759B; 32 } 33 34 select { 35 height: 2em; 36 } 37 38 #link-header, 39 #link-options, 40 #link-advanced-options { 41 padding: 5px; 42 border-bottom: 1px solid #dfdfdf; 43 } 44 #link-type { 45 width: 140px; 46 } 47 48 .link-panel { 49 padding: 5px 5px 0; 50 display: none; 51 } 52 .link-panel-active { 53 display: block; 54 } 55 56 label input[type="text"] { 57 width: 220px; 58 } 59 .wp-tab-panel label input[type="text"] { 60 float: left; 61 width: 200px; 62 } 63 64 label span { 65 display: inline-block; 66 width: 80px; 67 text-align: right; 68 padding-right: 5px; 69 } 70 .wp-tab-panel label span { 71 width: auto; 72 text-align: left; 73 float: left; 74 margin-top: 3px; 75 } 76 .link-search-wrapper { 77 padding: 5px; 78 border-bottom: solid 1px #dfdfdf; 79 display: block; 80 overflow: hidden; 81 } 82 .link-search-wrapper img.waiting { 83 margin: 4px 1px 0 4px; 84 float: left; 85 display: none; 86 } 87 88 #link-advanced-options, 89 #link-advanced-options select, 90 #link-advanced-options option { 91 font-size: 11px; 92 } 93 94 #link-advanced-options { 95 background: #f9f9f9; 96 padding: 3px 5px; 97 } 98 #link-advanced-options label select { 99 width: 195px; 100 } 101 102 #link-advanced-options-toggle { 103 display: block; 104 } 105 106 #link-advanced-options label { 107 padding-top: 2px; 108 display: none; 109 } 110 #link-advanced-options.adv-options-active label { 111 display: block; 112 } 113 114 .submitbox { 115 padding: 5px; 116 font-size: 11px; 117 overflow: auto; 118 height: 29px; 119 } 120 #wp-cancel { 121 line-height: 25px; 122 float: left; 123 } 124 #wp-update { 125 line-height: 23px; 126 float: right; 127 } 128 #wp-update a { 129 display: inline-block; 130 } 131 .wp-tab-active, 132 .wp-tab-panel { 133 background: #fff; 134 } 135 .wp-tab-panel { 136 height: 160px; 137 padding: 0; 138 } 139 .wp-tab-panel li { 140 margin-bottom: 0; 141 border-bottom: 1px solid #dfdfdf; 142 color: #555; 143 padding: 4px 6px; 144 cursor: pointer; 145 } 146 .wp-tab-panel li:hover { 147 background: #EAF2FA; 148 color: #333; 149 } 150 .wp-tab-panel li.selected { 151 background: #f1f1f1; 152 font-weight: bold; 153 color: #333; 154 } 155 .wp-tab-panel-pagelinks { 156 padding:4px 0; 157 margin:0 auto; 158 text-align:center; 159 } 160 .wp-tab-panel-pagelinks-top { 161 border-bottom: 1px solid #dfdfdf; 162 } 163 </style> 164 </head> 165 <?php 166 167 168 $panels = array(); 169 foreach ( $pts as $pt_obj ) { 170 $panel = new WP_Link_Panel( 'pt', $pt_obj, array( 171 array( 'preset' => 'all', 'label' => __('View All'), 'pagenum' => 1 ), 172 array( 'preset' => 'recent', 'label' => __('Most Recent') ), 173 )); 174 if ( !empty( $panel->queries[0]['data'] ) ) 175 $panels[] = $panel; 176 } 177 foreach ( $taxes as $tax_obj ) { 178 $panel = new WP_Link_Panel( 'tax', $tax_obj, array( 179 array( 'preset' => 'all', 'label' => __('View All'), 'pagenum' => 1 ), 180 array( 'preset' => 'popular', 'label' => __('Most Used') ), 181 )); 182 if ( !empty( $panel->queries[0]['data'] ) ) 183 $panels[] = $panel; 184 } 185 186 ?> 187 <body id="post-body"> 188 <div id="link-header"> 189 <label for="link-type"> 190 <span><strong><?php _e('Link Type:'); ?></strong> 191 </span><select id="link-type"> 192 <option id="link-option-id-custom" class="link-custom"><?php _e('External Link'); ?></option> 193 <?php 194 foreach ( $panels as $panel ) { 195 echo "<option id='link-option-id-$panel->id' class='link-option-pt'>"; 196 echo $panel->labels->singular_name . '</option>'; 197 } ?> 198 </select> 199 </label> 200 </div> 201 <div id="link-selector"> 202 <?php 203 wp_link_panel_custom(); 204 foreach( $panels as $panel ) 205 $panel->render(); 206 ?> 207 <div id="link-options"> 208 <label for="link-title-field"> 209 <span><?php _e('Description:'); ?></span><input id="link-title-field" type="text" /> 210 </label> 211 </div> 212 <div id="link-advanced-options"> 213 <a id="link-advanced-options-toggle" href="#"><?php _e('Advanced Options'); ?></a> 214 <label for="link-target-select"> 215 <span><?php _e('Target:'); ?></span><select id="link-target-select"></select> 216 </label> 217 <label for="link-class-select"> 218 <span><?php _e('Class:'); ?></span><select id="link-class-select"></select> 219 </label> 220 </div> 221 </div> 222 <div class="submitbox"> 223 <div id="wp-cancel"> 224 <a class="submitdelete deletion"><?php _e('Cancel'); ?></a> 225 </div> 226 <div id="wp-update"> 227 <a class="button-primary"><?php _e('Update'); ?></a> 228 </div> 229 </div> 230 </body> 231 </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 function wp_tab_bar( $tabs, $active=null, $echo=true ) { 7 if ( empty( $active ) ) 8 $active = $tabs[0]['for']; 9 10 $out = "<ul class='wp-tab-bar'>"; 11 foreach( $tabs as $tab ) { 12 if ( !isset($tab['url']) ) 13 $tab['url'] = ''; 14 15 $out.= "<li id='wp-tab-for-{$tab['for']}' class='"; 16 $out.= $active == $tab['for'] ? 'wp-tab-active' : ''; 17 $out.= "'><a href='{$tab['url']}#{$tab['for']}'>"; 18 $out.= "{$tab['title']}</a></li>"; 19 } 20 $out.= "</ul>"; 21 22 if ( $echo ) 23 echo $out; 24 25 return $out; 26 } 27 28 function wp_tab_bar_item( $title, $id, $url='' ) { 29 return array( 30 'title' => $title, 31 'for' => $id, 32 'url' => $url 33 ); 34 } 35 36 // Set up some vars 37 $pts = get_post_types( array( 'public' => true, 'show_ui' => true ), 'objects' ); 38 $taxes = get_taxonomies( array( 'public' => true, 'show_ui' => true ), 'objects' ); 39 40 // Helper functions 41 function wp_link_panel_custom() { ?> 42 <div id="link-panel-id-custom" class="link-panel link-panel-custom link-panel-active"> 43 <label> 44 <span><?php _e('URL:'); ?></span><input class="url-field" type="text" /> 45 </label> 46 </div> 47 <?php } 48 49 class WP_Link_Panel { 50 /** 51 * The type of data contained: post type or taxonomy. 52 * 53 * @var string 'pt' or 'tax' 54 */ 55 var $obj_type; 56 /** 57 * Either a post type object or a taxonomy object. 58 * 59 * @var object 60 */ 61 var $obj; 62 /** 63 * An array of array('slug' => string, 'preset' => string, 'label' => string, ['pagenum' => int]) 64 * 65 * @var array 66 */ 67 var $queries; 68 /** 69 * The pt/tax name. 70 * 71 * @var string 72 */ 73 var $name; 74 /** 75 * The pt/tax id (combined with the obj_type). 76 * 77 * @var string 78 */ 79 var $id; 80 /** 81 * The pt/tax labels. 82 * 83 * @var string 84 */ 85 var $labels; 86 87 function WP_Link_Panel( $obj_type, $obj, $queries ) { 88 if ( !in_array( $obj_type, array('pt','tax') ) ) 89 return; 90 91 $this->obj_type = $obj_type; 92 $this->obj = $obj; 93 $this->name = $obj->name; 94 $this->id = esc_attr("$this->obj_type-$this->name"); 95 $this->labels = $obj->labels; 96 97 foreach( $queries as $i => $query ) { 98 if ( !isset( $query['slug'] ) ) 99 $queries[$i]['slug'] = $query['preset']; 100 101 $args = array(); 102 if ( isset( $query['pagenum'] ) ) 103 $args['pagenum'] = $query['pagenum']; 104 105 if ( 'pt' == $this->obj_type ) 106 $queries[$i]['data'] = wp_link_query_post_type( $this->obj, $query['preset'], $args ); 107 else 108 $queries[$i]['data'] = wp_link_query_taxonomy( $this->obj, $query['preset'], $args ); 109 } 110 111 $this->queries = $queries; 112 } 113 114 /** 115 * Render the link data. 116 */ 117 function render() { 118 $id = $this->id; 119 $tabs = $this->queries; 120 ?> 121 <div id="link-panel-id-<?php echo $id; ?>" class="link-panel link-panel-<?php echo $this->obj_type; ?>"> 122 <?php 123 124 $tbitems = array(); 125 foreach( $tabs as $i => $tab ) { 126 $tabs[$i]['id'] = "$id-{$tabs[$i]['slug']}"; 127 $tbitems[] = wp_tab_bar_item( $tabs[$i]['label'], $tabs[$i]['id'] ); 128 } 129 array_push( $tbitems, wp_tab_bar_item( __('Search'), "$id-search" ) ); 130 wp_tab_bar( $tbitems ); 131 132 foreach( $tabs as $tab ): 133 $data = $tab['data']; 134 $slug = $tab['slug']; 135 ?> 136 <div id="<?php echo $tab['id']; ?>" class="wp-tab-panel"> 137 <?php if ( isset( $data['pages'] ) && ! empty( $data['pages']['page_links'] ) ) : ?> 138 <div class="wp-tab-panel-pagelinks wp-tab-panel-pagelinks-top"> 139 <?php echo $data['pages']['page_links']; ?> 140 </div> 141 <?php endif; ?> 142 <ul> 143 <?php 144 foreach( $data['results'] as $result ): ?> 145 <li id="link-to-<?php echo "$id-" . esc_attr( $result['ID'] ); ?>"> 146 <input type="hidden" value="<?php echo esc_url( $result['permalink'] ); ?>" /> 147 <?php 148 echo empty( $result['title'] ) ? '<em>' . __('Untitled') . '</em>' : esc_html( $result['title'] ); ?> 149 </li> 150 <?php endforeach; ?> 151 </ul> 152 <?php if ( isset( $data['pages'] ) && ! empty( $data['pages']['page_links'] ) ) : ?> 153 <div class="wp-tab-panel-pagelinks wp-tab-panel-pagelinks-bottom"> 154 <?php echo $data['pages']['page_links']; ?> 155 </div> 156 <?php endif; ?> 157 </div> 158 <?php endforeach; ?> 159 <div id="<?php echo $id; ?>-search" class="wp-tab-panel"> 160 <label for="<?php echo $id; ?>-search-field" class="link-search-wrapper"> 161 <span><?php _e('Search:'); ?></span> 162 <input type="text" id="<?php echo $id; ?>-search-field" class="link-search-field" /> 163 <img class="waiting" src="<?php echo esc_url( admin_url( 'images/wpspin_light.gif' ) ); ?>" alt="" /> 164 </label> 165 <ul id="<?php echo $id; ?>-search-results" class="link-search-results"></ul> 166 </div> 167 </div> 168 <?php } 169 } 170 171 function wp_link_query_post_type( $pt_obj, $preset='all', $opts=array() ) { 172 $args_base = array( 173 'post_type' => $pt_obj->name, 174 'suppress_filters' => true, 175 'update_post_term_cache' => false, 176 'update_post_meta_cache' => false, 177 'post_status' => 'publish', 178 ); 179 180 switch( $preset ) { 181 case 'all': 182 $args = array_merge( $args_base, array( 183 'order' => 'ASC', 184 'orderby' => 'title', 185 'posts_per_page' => 20, 186 )); 187 break; 188 case 'recent': 189 $args = array_merge( $args_base, array( 190 'order' => 'DESC', 191 'orderby' => 'post_date', 192 'posts_per_page' => 15, 193 )); 194 break; 195 case 'search': 196 $args = array_merge( $args_base, array( 197 's' => $opts['search'], 198 'posts_per_page' => 10 199 )); 200 break; 201 } 202 203 // Handle pages if a page number is specified. 204 if ( isset( $opts['pagenum'] ) && isset( $args['posts_per_page'] ) ) { 205 $pages = array( 206 'current' => $opts['pagenum'], 207 'per_page' => $args['posts_per_page'] 208 ); 209 210 if ( ! isset( $args['offset'] ) ) 211 $args['offset'] = 0 < $opts['pagenum'] ? $args['posts_per_page'] * ( $opts['pagenum'] - 1 ) : 0; 212 $pages['offset'] = $args['offset']; 213 } 214 215 // Do main query. 216 $get_posts = new WP_Query; 217 $posts = $get_posts->query( $args ); 218 // Check if any posts were found. 219 if ( ! $get_posts->post_count ) 220 return false; 221 222 // Build results. 223 $results = array(); 224 foreach ( $posts as $post ) { 225 $results[] = array( 226 'ID' => $post->ID, 227 'title' => $post->post_title, 228 'permalink' => get_permalink( $post->ID ) 229 ); 230 } 231 // Build response. 232 $resp = array( 233 'query' => $get_posts, 234 'objects' => $posts, 235 'results' => $results 236 ); 237 238 // Set remaining pages values. 239 if ( isset( $pages ) ) { 240 $pages['max'] = $resp['query']->max_num_pages; 241 $pages['page_links'] = paginate_links( array( 242 'prev_text' => __('«'), 243 'next_text' => __('»'), 244 'total' => $pages['max'], 245 'current' => $pages['current'] 246 )); 247 $resp['pages'] = $pages; 248 } 249 250 return $resp; 251 } 252 253 function wp_link_query_taxonomy( $tax_obj, $preset='all', $opts=array() ) { 254 switch( $preset ) { 255 case 'all': 256 $args = array( 257 'child_of' => 0, 258 'exclude' => '', 259 'hide_empty' => false, 260 'hierarchical' => 1, 261 'include' => '', 262 'include_last_update_time' => false, 263 'number' => 30, 264 'order' => 'ASC', 265 'orderby' => 'name', 266 'pad_counts' => false, 267 ); 268 break; 269 case 'popular': 270 $args = array( 271 'orderby' => 'count', 272 'order' => 'DESC', 273 'number' => 10, 274 'hierarchical' => false 275 ); 276 break; 277 case 'search': 278 $args = array( 279 'name__like' => $opts['search'], 280 'number' => 10 281 ); 282 break; 283 } 284 285 // Handle pages if a page number is specified. 286 if ( isset( $opts['pagenum'] ) && isset( $args['number'] ) ) { 287 $pages = array( 288 'current' => $opts['pagenum'], 289 'per_page' => $args['number'] 290 ); 291 292 $pages['max'] = ceil( wp_count_terms( $tax_obj->name , array_merge( $args, array('number' => '', 'offset' => '') ) ) / $pages['per_page'] ); 293 294 if ( ! isset( $args['offset'] ) ) 295 $args['offset'] = 0 < $opts['pagenum'] ? $args['number'] * ( $opts['pagenum'] - 1 ) : 0; 296 $pages['offset'] = $args['offset']; 297 298 $pages['page_links'] = paginate_links( array( 299 'prev_text' => __('«'), 300 'next_text' => __('»'), 301 'total' => $pages['max'], 302 'current' => $pages['current'] 303 )); 304 } 305 306 // Do the main query. 307 $terms = get_terms( $tax_obj->name, $args ); 308 // Check if any terms were found. 309 if ( ! $terms || is_wp_error($terms) ) 310 return false; 311 312 // Build results. 313 $results = array(); 314 foreach ( $terms as $term ) { 315 $results[] = array( 316 'ID' => $term->term_id, 317 'title' => $term->name, 318 'permalink' => get_term_link( $term ) 319 ); 320 } 321 322 // Build response. 323 $resp = array( 324 'objects' => $terms, 325 'results' => $results 326 ); 327 if ( isset( $pages ) ) 328 $resp['pages'] = $pages; 329 330 return $resp; 331 } 332 ?> 333 No newline at end of file -
wp-admin/admin-ajax.php
1102 1102 1103 1103 exit; 1104 1104 break; 1105 case 'wp-link-search': 1106 require_once ABSPATH . WPINC . '/js/tinymce/wp-mce-link-includes.php'; 1107 1108 if ( !isset($_REQUEST['type']) || !isset($_REQUEST['name']) || !isset($_REQUEST['title']) ) 1109 die('-1'); 1110 1111 if ( 'pt' == $_REQUEST['type'] && $obj = get_post_type_object($_REQUEST['name']) ) 1112 $resp = wp_link_query_post_type( $obj, 'search', array('search' => $_REQUEST['title']) ); 1113 else if ( 'tax' == $_REQUEST['type'] && $obj = get_taxonomy($_REQUEST['name']) ) 1114 $resp = wp_link_query_taxonomy( $obj, 'search', array('search' => $_REQUEST['title']) ); 1115 else 1116 die('-1'); 1117 1118 if ( !$resp ) 1119 die('0'); 1120 1121 echo json_encode($resp['results']); 1122 echo "\n"; 1123 1124 exit; 1125 break; 1105 1126 case 'menu-locations-save': 1106 1127 if ( ! current_user_can( 'edit_theme_options' ) ) 1107 1128 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'. … … 1398 1398 $plugins = implode($plugins, ','); 1399 1399 1400 1400 if ( $teeny ) { 1401 $mce_buttons = apply_filters( 'teeny_mce_buttons', array('bold, italic, underline, blockquote, separator, strikethrough, bullist, numlist,justifyleft, justifycenter, justifyright, undo, redo, link, unlink, fullscreen') );1401 $mce_buttons = apply_filters( 'teeny_mce_buttons', array('bold, italic, underline, blockquote, separator, strikethrough, bullist, numlist,justifyleft, justifycenter, justifyright, undo, redo, wplink, unlink, fullscreen') ); 1402 1402 $mce_buttons = implode($mce_buttons, ','); 1403 1403 $mce_buttons_2 = $mce_buttons_3 = $mce_buttons_4 = ''; 1404 1404 } else { 1405 $mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', '|', 'bullist', 'numlist', 'blockquote', '|', 'justifyleft', 'justifycenter', 'justifyright', '|', ' link', 'unlink', 'wp_more', '|', 'spellchecker', 'fullscreen', 'wp_adv' ));1405 $mce_buttons = apply_filters('mce_buttons', array('bold', 'italic', 'strikethrough', '|', 'bullist', 'numlist', 'blockquote', '|', 'justifyleft', 'justifycenter', 'justifyright', '|', 'wplink', 'unlink', 'wp_more', '|', 'spellchecker', 'fullscreen', 'wp_adv' )); 1406 1406 $mce_buttons = implode($mce_buttons, ','); 1407 1407 1408 1408 $mce_buttons_2 = array('formatselect', 'underline', 'justifyfull', 'forecolor', '|', 'pastetext', 'pasteword', 'removeformat', '|' ); -
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;