Make WordPress Core

Changeset 13266


Ignore:
Timestamp:
02/20/2010 11:58:00 PM (15 years ago)
Author:
ryan
Message:

Make js noConflict compat. see #11817

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-admin/custom-navigation.php

    r13263 r13266  
    4646
    4747    <div class="wrap">
    48     <div id="no-js"><h3>You do not have JavaScript enabled in your browser. Please enabled it to access the Custom Menu functionality.</h3></div>
     48    <div id="no-js"><h3>You do not have JavaScript enabled in your browser. Please enable it to access the Custom Menu functionality.</h3></div>
    4949           
    5050    <?php
     
    5252    $menu_id_in_edit = 0;
    5353       
    54     //Get the theme name
     54    // Get the theme name
    5555    $themename =  get_current_theme();
    5656       
    57     //CHECK which menu is selected and if menu is in edit already
     57    // Check which menu is selected and if menu is in edit already
    5858    if ( isset( $_POST['switch_menu'] ) )
    5959        $menu_selected_id = $_POST['menu_select'];
     
    6161        $menu_selected_id = $_POST['menu_id_in_edit'];
    6262       
    63     //Default Menu to show
     63    // Default Menu to show
    6464    $custom_menus = get_terms( 'menu', array( 'hide_empty' => false ) );
    6565    if ( !empty( $custom_menus ) )
     
    8585    else
    8686            $postCounter = 0;
    87        
     87
     88    // Create a new menu. Menus are stored as terms in the 'menu' taxonomy.
    8889    if ( isset( $_POST['add_menu'] ) ) {
    8990        $insert_menu_name = $_POST['add_menu_name'];
     
    107108            $messagesdiv = '<div id="message" class="error fade below-h2"><p>Please enter a valid Menu name</p></div>';
    108109        }
    109            
    110            
    111110    }
    112111       
    113     if (isset($_POST['reset_wp_menu'])) {   
     112    if ( isset($_POST['reset_wp_menu']) ) {
    114113            $success = wp_custom_nav_reset();
    115114            if ($success) {
    116                 //DISPLAY SUCCESS MESSAGE IF Menu Reset Correctly
    117             $messagesdiv = '<div id="message" class="updated fade below-h2"><p>'.$themename.'s Custom Menu has been RESET!</p></div>';
    118             //GET reset menu id
    119             $custom_menus = array();
    120             $menu_selected_id = 0;
     115                // DISPLAY SUCCESS MESSAGE IF Menu Reset Correctly
     116                $messagesdiv = '<div id="message" class="updated fade below-h2"><p>'.$themename.'s Custom Menu has been RESET!</p></div>';
     117                // GET reset menu id
     118                $custom_menus = array();
     119                $menu_selected_id = 0;
    121120            } else {
    122                 //DISPLAY SUCCESS MESSAGE IF Menu Reset Correctly
    123             $messagesdiv = '<div id="message" class="error fade below-h2"><p>'.$themename.'s Custom Menu could not be RESET. Please try again.</p></div>';
     121                // DISPLAY SUCCESS MESSAGE IF Menu Reset Correctly
     122                $messagesdiv = '<div id="message" class="error fade below-h2"><p>'.$themename.'s Custom Menu could not be RESET. Please try again.</p></div>';
    124123            }
    125124    } elseif ( $postCounter > 0 && $menu_selected_id > 0 ) {
     
    286285                        foreach( $custom_menus as $menu ) {
    287286                            $menu_term = get_term( $menu, 'menu' );
    288                             if ( ( $menu_id_in_edit == $menu ) || ( $menu_selected_id == $menu ) )
     287                            if ( ( $menu_id_in_edit == $menu->term_id ) || ( $menu_selected_id == $menu->term_id ) )
    289288                                $selected_option = 'selected="selected"';
    290289                            else
  • trunk/wp-admin/js/custom-navigation-default-items.dev.js

    r13257 r13266  
    1313 * Init Functions
    1414*/
    15 $(function()
     15jQuery(function($)
    1616    {
    1717        //Makes dialog box
  • trunk/wp-admin/js/custom-navigation-default-items.js

    r13257 r13266  
    1 $(function(){$("#dialog-confirm").dialog({autoOpen:false,resizable:false,height:210,width:400,modal:true,buttons:{Save:function(){titletosave=$("#edittitle").attr("value");linktosave=$("#editlink").attr("value");anchortitletosave=$("#editanchortitle").attr("value");newwindowtosave=$("#editnewwindow").attr("value");desctosave=$("#editdescription").attr("value");$("#title"+$(this).dialog("option","itemID")).attr("value",titletosave);$("#linkurl"+$(this).dialog("option","itemID")).attr("value",linktosave);$("#anchortitle"+$(this).dialog("option","itemID")).attr("value",anchortitletosave);$("#newwindow"+$(this).dialog("option","itemID")).attr("value",newwindowtosave);$("#description"+$(this).dialog("option","itemID")).attr("value",desctosave);$("#menu-"+$(this).dialog("option","itemID")+" > dl > dt > span.title").text(titletosave);$("#view"+ +$(this).dialog("option","itemID")).attr("href",linktosave);$(this).dialog("close")},Cancel:function(){$(this).dialog("close")}}});$("#message").animate({opacity:1},2000).fadeOut(300,function(){$(this).remove()});$("#custom-nav li").prepend('<div class="dropzone"></div>');$("#custom-nav li").draggable({handle:" > dl",opacity:0.8,addClasses:false,helper:"clone",zIndex:100});$("#custom-nav dl, #custom-nav .dropzone").droppable({accept:"#custom-nav li",tolerance:"pointer",drop:function(f,d){var a=$(this).parent();var g=!$(this).hasClass("dropzone");if(g&&a.children("ul").length==0){a.append('<ul id="sub-menu" />')}if(g){a.children("ul").append(d.draggable)}else{a.before(d.draggable)}a.find("dl,.dropzone").css({backgroundColor:"",borderColor:""});var c=d.draggable.attr("value");var b=a.attr("value");a.find("#menu-"+c).find("#parent"+c).val(b);$(this).parent().find("dt").removeAttr("style");$(this).parent().find("div:first").removeAttr("style")},over:function(){if($(this).attr("class")=="dropzone ui-droppable"){$(this).parent().find("div:first").css("background","none").css("height","50px")}else{if($(this).attr("class")=="ui-droppable"){$(this).parent().find("dt:first").css("background","#d8d8d8")}else{}}var a=$(this).parent().attr("id")},out:function(){$(this).parent().find("dt").removeAttr("style");$(this).parent().find("div:first").removeAttr("style");$(this).filter(".dropzone").css({borderColor:""})},deactivate:function(){}});$("#save_top").click(function(){updatepostdata()});$("#save_bottom").click(function(){updatepostdata()})});
     1jQuery(function(a){a("#dialog-confirm").dialog({autoOpen:false,resizable:false,height:210,width:400,modal:true,buttons:{Save:function(){titletosave=a("#edittitle").attr("value");linktosave=a("#editlink").attr("value");anchortitletosave=a("#editanchortitle").attr("value");newwindowtosave=a("#editnewwindow").attr("value");desctosave=a("#editdescription").attr("value");a("#title"+a(this).dialog("option","itemID")).attr("value",titletosave);a("#linkurl"+a(this).dialog("option","itemID")).attr("value",linktosave);a("#anchortitle"+a(this).dialog("option","itemID")).attr("value",anchortitletosave);a("#newwindow"+a(this).dialog("option","itemID")).attr("value",newwindowtosave);a("#description"+a(this).dialog("option","itemID")).attr("value",desctosave);a("#menu-"+a(this).dialog("option","itemID")+" > dl > dt > span.title").text(titletosave);a("#view"+ +a(this).dialog("option","itemID")).attr("href",linktosave);a(this).dialog("close")},Cancel:function(){a(this).dialog("close")}}});a("#message").animate({opacity:1},2000).fadeOut(300,function(){a(this).remove()});a("#custom-nav li").prepend('<div class="dropzone"></div>');a("#custom-nav li").draggable({handle:" > dl",opacity:0.8,addClasses:false,helper:"clone",zIndex:100});a("#custom-nav dl, #custom-nav .dropzone").droppable({accept:"#custom-nav li",tolerance:"pointer",drop:function(g,f){var b=a(this).parent();var h=!a(this).hasClass("dropzone");if(h&&b.children("ul").length==0){b.append('<ul id="sub-menu" />')}if(h){b.children("ul").append(f.draggable)}else{b.before(f.draggable)}b.find("dl,.dropzone").css({backgroundColor:"",borderColor:""});var d=f.draggable.attr("value");var c=b.attr("value");b.find("#menu-"+d).find("#parent"+d).val(c);a(this).parent().find("dt").removeAttr("style");a(this).parent().find("div:first").removeAttr("style")},over:function(){if(a(this).attr("class")=="dropzone ui-droppable"){a(this).parent().find("div:first").css("background","none").css("height","50px")}else{if(a(this).attr("class")=="ui-droppable"){a(this).parent().find("dt:first").css("background","#d8d8d8")}else{}}var b=a(this).parent().attr("id")},out:function(){a(this).parent().find("dt").removeAttr("style");a(this).parent().find("div:first").removeAttr("style");a(this).filter(".dropzone").css({borderColor:""})},deactivate:function(){}});a("#save_top").click(function(){updatepostdata()});a("#save_bottom").click(function(){updatepostdata()})});
  • trunk/wp-admin/js/custom-navigation-dynamic-functions.dev.js

    r13257 r13266  
    3535{
    3636           
    37         itemTitle = $('#title' + o).attr('value');
    38         itemURL = $('#linkurl' + o).attr('value');
    39         itemAnchorTitle = $('#anchortitle' + o).attr('value');
    40         itemNewWindow = $('#newwindow' + o).attr('value');
    41         itemDesc = $('#description' + o).attr('value');
    42        
    43         $('#dialog-confirm').dialog( 'option' , 'itemID' , o )
     37        itemTitle = jQuery('#title' + o).attr('value');
     38        itemURL = jQuery('#linkurl' + o).attr('value');
     39        itemAnchorTitle = jQuery('#anchortitle' + o).attr('value');
     40        itemNewWindow = jQuery('#newwindow' + o).attr('value');
     41        itemDesc = jQuery('#description' + o).attr('value');
     42       
     43        jQuery('#dialog-confirm').dialog( 'option' , 'itemID' , o )
    4444               
    45         $('#dialog-confirm').dialog('open');
    46        
    47         $('#edittitle').attr('value', itemTitle);
    48         $('#editlink').attr('value', itemURL);
    49         $('#editanchortitle').attr('value', itemAnchorTitle);
    50         $("#editnewwindow option[value='" + itemNewWindow  + "']").attr('selected', 'selected');
    51         $('#editdescription').attr('value', itemDesc);
     45        jQuery('#dialog-confirm').dialog('open');
     46       
     47        jQuery('#edittitle').attr('value', itemTitle);
     48        jQuery('#editlink').attr('value', itemURL);
     49        jQuery('#editanchortitle').attr('value', itemAnchorTitle);
     50        jQuery("#editnewwindow option[value='" + itemNewWindow  + "']").attr('selected', 'selected');
     51        jQuery('#editdescription').attr('value', itemDesc);
    5252   
    5353};
     
    6060   
    6161    var i = 0;
    62      $("#custom-nav").find("li").each(function(i) {
     62     jQuery("#custom-nav").find("li").each(function(i) {
    6363        i = i + 1;
    64         var j = $(this).attr('value');
    65        
    66         $(this).find('#position' + j).attr('value', i);
    67         $(this).attr('id','menu-' + i);
    68         $(this).attr('value', i);
    69        
    70         $(this).find('#dbid' + j).attr('name','dbid' + i);
    71         $(this).find('#dbid' + j).attr('id','dbid' + i);
    72        
    73         $(this).find('#postmenu' + j).attr('name','postmenu' + i);
    74         $(this).find('#postmenu' + j).attr('id','postmenu' + i);
    75        
    76         var p = $(this).find('#parent' + j).parent().parent().parent().attr('value');
    77        
    78         $(this).find('#parent' + j).attr('name','parent' + i);
    79         $(this).find('#parent' + j).attr('id','parent' + i);
     64        var j = jQuery(this).attr('value');
     65       
     66        jQuery(this).find('#position' + j).attr('value', i);
     67        jQuery(this).attr('id','menu-' + i);
     68        jQuery(this).attr('value', i);
     69       
     70        jQuery(this).find('#dbid' + j).attr('name','dbid' + i);
     71        jQuery(this).find('#dbid' + j).attr('id','dbid' + i);
     72       
     73        jQuery(this).find('#postmenu' + j).attr('name','postmenu' + i);
     74        jQuery(this).find('#postmenu' + j).attr('id','postmenu' + i);
     75       
     76        var p = jQuery(this).find('#parent' + j).parent().parent().parent().attr('value');
     77       
     78        jQuery(this).find('#parent' + j).attr('name','parent' + i);
     79        jQuery(this).find('#parent' + j).attr('id','parent' + i);
    8080        if (p) {
    8181            //Do nothing
     
    8686        }
    8787               
    88         $(this).find('#parent' + j).attr('value', p);
     88        jQuery(this).find('#parent' + j).attr('value', p);
    8989               
    90         $(this).find('#title' + j).attr('name','title' + i);
    91         $(this).find('#title' + j).attr('id','title' + i);
    92        
    93         $(this).find('#linkurl' + j).attr('name','linkurl' + i);
    94         $(this).find('#linkurl' + j).attr('id','linkurl' + i);
     90        jQuery(this).find('#title' + j).attr('name','title' + i);
     91        jQuery(this).find('#title' + j).attr('id','title' + i);
     92       
     93        jQuery(this).find('#linkurl' + j).attr('name','linkurl' + i);
     94        jQuery(this).find('#linkurl' + j).attr('id','linkurl' + i);
    9595           
    96         $(this).find('#description' + j).attr('name','description' + i);
    97         $(this).find('#description' + j).attr('id','description' + i);
    98        
    99         $(this).find('#icon' + j).attr('name','icon' + i);
    100         $(this).find('#icon' + j).attr('id','icon' + i);
    101        
    102         $(this).find('#position' + j).attr('name','position' + i);
    103         $(this).find('#position' + j).attr('id','position' + i);
    104        
    105         $(this).find('#linktype' + j).attr('name','linktype' + i);
    106         $(this).find('#linktype' + j).attr('id','linktype' + i);
    107        
    108         $(this).find('#anchortitle' + j).attr('name','anchortitle' + i);
    109         $(this).find('#anchortitle' + j).attr('id','anchortitle' + i);
    110        
    111         $(this).find('#newwindow' + j).attr('name','newwindow' + i);
    112         $(this).find('#newwindow' + j).attr('id','newwindow' + i);
    113        
    114         $(this).find('dl > dt > span > #remove' + j).attr('value', i);
    115         $(this).find('dl > dt > span > #remove' + j).attr('onClick', 'removeitem(' + i + ')');
    116         $(this).find('dl > dt > span > #remove' + j).attr('id','remove' + i);
    117 
    118         $('#licount').attr('value',i);
     96        jQuery(this).find('#description' + j).attr('name','description' + i);
     97        jQuery(this).find('#description' + j).attr('id','description' + i);
     98       
     99        jQuery(this).find('#icon' + j).attr('name','icon' + i);
     100        jQuery(this).find('#icon' + j).attr('id','icon' + i);
     101       
     102        jQuery(this).find('#position' + j).attr('name','position' + i);
     103        jQuery(this).find('#position' + j).attr('id','position' + i);
     104       
     105        jQuery(this).find('#linktype' + j).attr('name','linktype' + i);
     106        jQuery(this).find('#linktype' + j).attr('id','linktype' + i);
     107       
     108        jQuery(this).find('#anchortitle' + j).attr('name','anchortitle' + i);
     109        jQuery(this).find('#anchortitle' + j).attr('id','anchortitle' + i);
     110       
     111        jQuery(this).find('#newwindow' + j).attr('name','newwindow' + i);
     112        jQuery(this).find('#newwindow' + j).attr('id','newwindow' + i);
     113       
     114        jQuery(this).find('dl > dt > span > #remove' + j).attr('value', i);
     115        jQuery(this).find('dl > dt > span > #remove' + j).attr('onClick', 'removeitem(' + i + ')');
     116        jQuery(this).find('dl > dt > span > #remove' + j).attr('id','remove' + i);
     117
     118        jQuery('#licount').attr('value',i);
    119119
    120120   });
     
    211211   
    212212    //Notification Message
    213     $('.maintitle').after('<div id="message" class="updated fade below-h2"><p>Menu Item added!</p></div>');
    214     $('#message').animate({ opacity: 1.0 },2000).fadeOut(300, function(){ $(this).remove();});
     213    jQuery('.maintitle').after('<div id="message" class="updated fade below-h2"><p>Menu Item added!</p></div>');
     214    jQuery('#message').animate({ opacity: 1.0 },2000).fadeOut(300, function(){ jQuery(this).remove();});
    215215   
    216216    //Appends HTML to the menu
    217     $('#custom-nav').append('<li id="menu-' + randomnumber + '" value="' + randomnumber + '"><div class="dropzone ui-droppable"></div><dl class="ui-droppable"><dt><span class="title">' + inputvaluevarname + '</span><span class="controls"><span class="type">' + additemtype + '</span><a id="edit' + randomnumber + '" onclick="edititem(' + randomnumber + ')" value="' + randomnumber +'"><img class="edit" alt="Edit Menu Item" title="Edit Menu Item" src="' + templatedir + '/wp-admin/images/ico-edit.png" /></a> <a id="remove' + randomnumber + '" onclick="removeitem(' + randomnumber + ')" value="' + randomnumber +'"><img class="remove" alt="Remove from Custom Menu" title="Remove from Custom Menu" src="' + templatedir + '/wp-admin/images/ico-close.png" /></a> <a href="' + inputvaluevarurl + '" target="_blank"><img alt="View Custom Link" title="View Custom Link" src="' + templatedir + '/wp-admin/images/ico-viewpage.png" /></a></span></dt></dl><a class="hide" href="' + inputvaluevarurl + '">' + inputvaluevarname + '</a><input type="hidden" name="postmenu' + randomnumber + '" id="postmenu' + randomnumber + '" value="' + inputitemid + '" /><input type="hidden" name="parent' + randomnumber + '" id="parent' + randomnumber + '" value="' + inputparentid + '" /><input type="hidden" name="title' + randomnumber + '" id="title' + randomnumber + '" value="' + inputvaluevarname + '" /><input type="hidden" name="linkurl' + randomnumber + '" id="linkurl' + randomnumber + '" value="' + inputvaluevarurl + '" /><input type="hidden" name="description' + randomnumber + '" id="description' + randomnumber + '" value="' + inputdescription + '" /><input type="hidden" name="icon' + randomnumber + '" id="icon' + randomnumber + '" value="' + inputicon + '" /><input type="hidden" name="position' + randomnumber + '" id="position' + randomnumber + '" value="' + randomnumber + '" /><input type="hidden" name="linktype' + randomnumber + '" id="linktype' + randomnumber + '" value="' + inputlinktype + '" /><input type="hidden" name="anchortitle' + randomnumber + '" id="anchortitle' + randomnumber + '" value="' + inputvaluevarname + '" /><input type="hidden" name="newwindow' + randomnumber + '" id="newwindow' + randomnumber + '" value="0" /></li>');
     217    jQuery('#custom-nav').append('<li id="menu-' + randomnumber + '" value="' + randomnumber + '"><div class="dropzone ui-droppable"></div><dl class="ui-droppable"><dt><span class="title">' + inputvaluevarname + '</span><span class="controls"><span class="type">' + additemtype + '</span><a id="edit' + randomnumber + '" onclick="edititem(' + randomnumber + ')" value="' + randomnumber +'"><img class="edit" alt="Edit Menu Item" title="Edit Menu Item" src="' + templatedir + '/wp-admin/images/ico-edit.png" /></a> <a id="remove' + randomnumber + '" onclick="removeitem(' + randomnumber + ')" value="' + randomnumber +'"><img class="remove" alt="Remove from Custom Menu" title="Remove from Custom Menu" src="' + templatedir + '/wp-admin/images/ico-close.png" /></a> <a href="' + inputvaluevarurl + '" target="_blank"><img alt="View Custom Link" title="View Custom Link" src="' + templatedir + '/wp-admin/images/ico-viewpage.png" /></a></span></dt></dl><a class="hide" href="' + inputvaluevarurl + '">' + inputvaluevarname + '</a><input type="hidden" name="postmenu' + randomnumber + '" id="postmenu' + randomnumber + '" value="' + inputitemid + '" /><input type="hidden" name="parent' + randomnumber + '" id="parent' + randomnumber + '" value="' + inputparentid + '" /><input type="hidden" name="title' + randomnumber + '" id="title' + randomnumber + '" value="' + inputvaluevarname + '" /><input type="hidden" name="linkurl' + randomnumber + '" id="linkurl' + randomnumber + '" value="' + inputvaluevarurl + '" /><input type="hidden" name="description' + randomnumber + '" id="description' + randomnumber + '" value="' + inputdescription + '" /><input type="hidden" name="icon' + randomnumber + '" id="icon' + randomnumber + '" value="' + inputicon + '" /><input type="hidden" name="position' + randomnumber + '" id="position' + randomnumber + '" value="' + randomnumber + '" /><input type="hidden" name="linktype' + randomnumber + '" id="linktype' + randomnumber + '" value="' + inputlinktype + '" /><input type="hidden" name="anchortitle' + randomnumber + '" id="anchortitle' + randomnumber + '" value="' + inputvaluevarname + '" /><input type="hidden" name="newwindow' + randomnumber + '" id="newwindow' + randomnumber + '" value="0" /></li>');
    218218
    219219    //make menu item draggable
    220     $('#menu-' + randomnumber + '').draggable(
     220    jQuery('#menu-' + randomnumber + '').draggable(
    221221    {
    222222        handle: ' > dl',
     
    228228
    229229    //make menu item droppable
    230     $('#menu-' + randomnumber + ' dl, #menu-' + randomnumber + ' .dropzone').droppable({
     230    jQuery('#menu-' + randomnumber + ' dl, #menu-' + randomnumber + ' .dropzone').droppable({
    231231        accept: '#' + randomnumber + ', #custom-nav li',
    232232        tolerance: 'pointer',
    233233        drop: function(e, ui)
    234234        {
    235             var li = $(this).parent();
    236             var child = !$(this).hasClass('dropzone');
     235            var li = jQuery(this).parent();
     236            var child = !jQuery(this).hasClass('dropzone');
    237237            //Append UL to first child
    238238            if (child && li.children('ul').length == 0)
     
    255255            var droppablevalue = li.attr('value');
    256256            li.find('#menu-' + draggablevalue).find('#parent' + draggablevalue).val(droppablevalue);
    257             $(this).parent().find("dt").removeAttr('style');
    258             $(this).parent().find("div:first").removeAttr('style');
     257            jQuery(this).parent().find("dt").removeAttr('style');
     258            jQuery(this).parent().find("div:first").removeAttr('style');
    259259           
    260260        },
     
    262262            {
    263263                //Add child
    264                 if ($(this).attr('class') == 'dropzone ui-droppable')
     264                if (jQuery(this).attr('class') == 'dropzone ui-droppable')
    265265                {
    266                     $(this).parent().find("div:first").css('background', 'none').css('height', '50px');
     266                    jQuery(this).parent().find("div:first").css('background', 'none').css('height', '50px');
    267267                }
    268268                //Add above
    269                 else if ($(this).attr('class') == 'ui-droppable')
     269                else if (jQuery(this).attr('class') == 'ui-droppable')
    270270                {
    271                     $(this).parent().find("dt:first").css('background', '#d8d8d8');
     271                    jQuery(this).parent().find("dt:first").css('background', '#d8d8d8');
    272272                }
    273273                //do nothing
     
    275275               
    276276                }
    277                 var parentid = $(this).parent().attr('id');
     277                var parentid = jQuery(this).parent().attr('id');
    278278               
    279279            },
    280280            out: function()
    281281            {
    282                 $(this).parent().find("dt").removeAttr('style');
    283                 $(this).parent().find("div:first").removeAttr('style');
    284                 $(this).filter('.dropzone').css({ borderColor: '' });
     282                jQuery(this).parent().find("dt").removeAttr('style');
     283                jQuery(this).parent().find("div:first").removeAttr('style');
     284                jQuery(this).filter('.dropzone').css({ borderColor: '' });
    285285            }
    286286    });
  • trunk/wp-admin/js/custom-navigation-dynamic-functions.js

    r13257 r13266  
    1 function removeitem(c){var b=document.getElementById("menu-"+c);if(b){var a=document.getElementById("menu-"+c).parentNode;throwaway_node=a.removeChild(b)}updatepostdata()}function edititem(a){itemTitle=$("#title"+a).attr("value");itemURL=$("#linkurl"+a).attr("value");itemAnchorTitle=$("#anchortitle"+a).attr("value");itemNewWindow=$("#newwindow"+a).attr("value");itemDesc=$("#description"+a).attr("value");$("#dialog-confirm").dialog("option","itemID",a);$("#dialog-confirm").dialog("open");$("#edittitle").attr("value",itemTitle);$("#editlink").attr("value",itemURL);$("#editanchortitle").attr("value",itemAnchorTitle);$("#editnewwindow option[value='"+itemNewWindow+"']").attr("selected","selected");$("#editdescription").attr("value",itemDesc)}function updatepostdata(){var a=0;$("#custom-nav").find("li").each(function(c){c=c+1;var b=$(this).attr("value");$(this).find("#position"+b).attr("value",c);$(this).attr("id","menu-"+c);$(this).attr("value",c);$(this).find("#dbid"+b).attr("name","dbid"+c);$(this).find("#dbid"+b).attr("id","dbid"+c);$(this).find("#postmenu"+b).attr("name","postmenu"+c);$(this).find("#postmenu"+b).attr("id","postmenu"+c);var d=$(this).find("#parent"+b).parent().parent().parent().attr("value");$(this).find("#parent"+b).attr("name","parent"+c);$(this).find("#parent"+b).attr("id","parent"+c);if(d){}else{d=0}$(this).find("#parent"+b).attr("value",d);$(this).find("#title"+b).attr("name","title"+c);$(this).find("#title"+b).attr("id","title"+c);$(this).find("#linkurl"+b).attr("name","linkurl"+c);$(this).find("#linkurl"+b).attr("id","linkurl"+c);$(this).find("#description"+b).attr("name","description"+c);$(this).find("#description"+b).attr("id","description"+c);$(this).find("#icon"+b).attr("name","icon"+c);$(this).find("#icon"+b).attr("id","icon"+c);$(this).find("#position"+b).attr("name","position"+c);$(this).find("#position"+b).attr("id","position"+c);$(this).find("#linktype"+b).attr("name","linktype"+c);$(this).find("#linktype"+b).attr("id","linktype"+c);$(this).find("#anchortitle"+b).attr("name","anchortitle"+c);$(this).find("#anchortitle"+b).attr("id","anchortitle"+c);$(this).find("#newwindow"+b).attr("name","newwindow"+c);$(this).find("#newwindow"+b).attr("id","newwindow"+c);$(this).find("dl > dt > span > #remove"+b).attr("value",c);$(this).find("dl > dt > span > #remove"+b).attr("onClick","removeitem("+c+")");$(this).find("dl > dt > span > #remove"+b).attr("id","remove"+c);$("#licount").attr("value",c)})}function appendToList(b,s,d,n,h,l,e){var k="";var c="";var r="";var o="";var i="";var a="";if(s=="Custom"){k=document.getElementById("custom_menu_item_name").value;c=document.getElementById("custom_menu_item_url").value;r="";o="";inputlinktype="custom";i=document.getElementById("custom_menu_item_description").value}else{if(s=="Page"){k=htmlentities(d.toString());c=n.toString();r=h.toString();o="0";inputlinktype="page";i=htmlentities(e.toString())}else{if(s=="Category"){k=htmlentities(d.toString());c=n.toString();r=h.toString();o="0";inputlinktype="category";i=htmlentities(e.toString())}else{k="";k="";r="";o="";inputlinktype="custom";i=""}}}var g=document.getElementById("custom-nav").getElementsByTagName("li").length;var p=g;var m=0;try{var q=document.getElementById("menu-"+p.toString()).value}catch(f){m=1}while(m==0){p=p+1;try{var j=document.getElementById("menu-"+p.toString()).value}catch(f){m=1}}$(".maintitle").after('<div id="message" class="updated fade below-h2"><p>Menu Item added!</p></div>');$("#message").animate({opacity:1},2000).fadeOut(300,function(){$(this).remove()});$("#custom-nav").append('<li id="menu-'+p+'" value="'+p+'"><div class="dropzone ui-droppable"></div><dl class="ui-droppable"><dt><span class="title">'+k+'</span><span class="controls"><span class="type">'+s+'</span><a id="edit'+p+'" onclick="edititem('+p+')" value="'+p+'"><img class="edit" alt="Edit Menu Item" title="Edit Menu Item" src="'+b+'/wp-admin/images/ico-edit.png" /></a> <a id="remove'+p+'" onclick="removeitem('+p+')" value="'+p+'"><img class="remove" alt="Remove from Custom Menu" title="Remove from Custom Menu" src="'+b+'/wp-admin/images/ico-close.png" /></a> <a href="'+c+'" target="_blank"><img alt="View Custom Link" title="View Custom Link" src="'+b+'/wp-admin/images/ico-viewpage.png" /></a></span></dt></dl><a class="hide" href="'+c+'">'+k+'</a><input type="hidden" name="postmenu'+p+'" id="postmenu'+p+'" value="'+r+'" /><input type="hidden" name="parent'+p+'" id="parent'+p+'" value="'+o+'" /><input type="hidden" name="title'+p+'" id="title'+p+'" value="'+k+'" /><input type="hidden" name="linkurl'+p+'" id="linkurl'+p+'" value="'+c+'" /><input type="hidden" name="description'+p+'" id="description'+p+'" value="'+i+'" /><input type="hidden" name="icon'+p+'" id="icon'+p+'" value="'+a+'" /><input type="hidden" name="position'+p+'" id="position'+p+'" value="'+p+'" /><input type="hidden" name="linktype'+p+'" id="linktype'+p+'" value="'+inputlinktype+'" /><input type="hidden" name="anchortitle'+p+'" id="anchortitle'+p+'" value="'+k+'" /><input type="hidden" name="newwindow'+p+'" id="newwindow'+p+'" value="0" /></li>');$("#menu-"+p+"").draggable({handle:" > dl",opacity:0.8,addClasses:false,helper:"clone",zIndex:100});$("#menu-"+p+" dl, #menu-"+p+" .dropzone").droppable({accept:"#"+p+", #custom-nav li",tolerance:"pointer",drop:function(x,w){var t=$(this).parent();var y=!$(this).hasClass("dropzone");if(y&&t.children("ul").length==0){t.append("<ul/>")}if(y){t.children("ul").append(w.draggable)}else{t.before(w.draggable)}t.find("dl,.dropzone").css({backgroundColor:"",borderColor:""});var v=w.draggable.attr("value");var u=t.attr("value");t.find("#menu-"+v).find("#parent"+v).val(u);$(this).parent().find("dt").removeAttr("style");$(this).parent().find("div:first").removeAttr("style")},over:function(){if($(this).attr("class")=="dropzone ui-droppable"){$(this).parent().find("div:first").css("background","none").css("height","50px")}else{if($(this).attr("class")=="ui-droppable"){$(this).parent().find("dt:first").css("background","#d8d8d8")}else{}}var t=$(this).parent().attr("id")},out:function(){$(this).parent().find("dt").removeAttr("style");$(this).parent().find("div:first").removeAttr("style");$(this).filter(".dropzone").css({borderColor:""})}});updatepostdata()};
     1function removeitem(c){var b=document.getElementById("menu-"+c);if(b){var a=document.getElementById("menu-"+c).parentNode;throwaway_node=a.removeChild(b)}updatepostdata()}function edititem(a){itemTitle=jQuery("#title"+a).attr("value");itemURL=jQuery("#linkurl"+a).attr("value");itemAnchorTitle=jQuery("#anchortitle"+a).attr("value");itemNewWindow=jQuery("#newwindow"+a).attr("value");itemDesc=jQuery("#description"+a).attr("value");jQuery("#dialog-confirm").dialog("option","itemID",a);jQuery("#dialog-confirm").dialog("open");jQuery("#edittitle").attr("value",itemTitle);jQuery("#editlink").attr("value",itemURL);jQuery("#editanchortitle").attr("value",itemAnchorTitle);jQuery("#editnewwindow option[value='"+itemNewWindow+"']").attr("selected","selected");jQuery("#editdescription").attr("value",itemDesc)}function updatepostdata(){var a=0;jQuery("#custom-nav").find("li").each(function(c){c=c+1;var b=jQuery(this).attr("value");jQuery(this).find("#position"+b).attr("value",c);jQuery(this).attr("id","menu-"+c);jQuery(this).attr("value",c);jQuery(this).find("#dbid"+b).attr("name","dbid"+c);jQuery(this).find("#dbid"+b).attr("id","dbid"+c);jQuery(this).find("#postmenu"+b).attr("name","postmenu"+c);jQuery(this).find("#postmenu"+b).attr("id","postmenu"+c);var d=jQuery(this).find("#parent"+b).parent().parent().parent().attr("value");jQuery(this).find("#parent"+b).attr("name","parent"+c);jQuery(this).find("#parent"+b).attr("id","parent"+c);if(d){}else{d=0}jQuery(this).find("#parent"+b).attr("value",d);jQuery(this).find("#title"+b).attr("name","title"+c);jQuery(this).find("#title"+b).attr("id","title"+c);jQuery(this).find("#linkurl"+b).attr("name","linkurl"+c);jQuery(this).find("#linkurl"+b).attr("id","linkurl"+c);jQuery(this).find("#description"+b).attr("name","description"+c);jQuery(this).find("#description"+b).attr("id","description"+c);jQuery(this).find("#icon"+b).attr("name","icon"+c);jQuery(this).find("#icon"+b).attr("id","icon"+c);jQuery(this).find("#position"+b).attr("name","position"+c);jQuery(this).find("#position"+b).attr("id","position"+c);jQuery(this).find("#linktype"+b).attr("name","linktype"+c);jQuery(this).find("#linktype"+b).attr("id","linktype"+c);jQuery(this).find("#anchortitle"+b).attr("name","anchortitle"+c);jQuery(this).find("#anchortitle"+b).attr("id","anchortitle"+c);jQuery(this).find("#newwindow"+b).attr("name","newwindow"+c);jQuery(this).find("#newwindow"+b).attr("id","newwindow"+c);jQuery(this).find("dl > dt > span > #remove"+b).attr("value",c);jQuery(this).find("dl > dt > span > #remove"+b).attr("onClick","removeitem("+c+")");jQuery(this).find("dl > dt > span > #remove"+b).attr("id","remove"+c);jQuery("#licount").attr("value",c)})}function appendToList(b,s,d,n,h,l,e){var k="";var c="";var r="";var o="";var i="";var a="";if(s=="Custom"){k=document.getElementById("custom_menu_item_name").value;c=document.getElementById("custom_menu_item_url").value;r="";o="";inputlinktype="custom";i=document.getElementById("custom_menu_item_description").value}else{if(s=="Page"){k=htmlentities(d.toString());c=n.toString();r=h.toString();o="0";inputlinktype="page";i=htmlentities(e.toString())}else{if(s=="Category"){k=htmlentities(d.toString());c=n.toString();r=h.toString();o="0";inputlinktype="category";i=htmlentities(e.toString())}else{k="";k="";r="";o="";inputlinktype="custom";i=""}}}var g=document.getElementById("custom-nav").getElementsByTagName("li").length;var p=g;var m=0;try{var q=document.getElementById("menu-"+p.toString()).value}catch(f){m=1}while(m==0){p=p+1;try{var j=document.getElementById("menu-"+p.toString()).value}catch(f){m=1}}jQuery(".maintitle").after('<div id="message" class="updated fade below-h2"><p>Menu Item added!</p></div>');jQuery("#message").animate({opacity:1},2000).fadeOut(300,function(){jQuery(this).remove()});jQuery("#custom-nav").append('<li id="menu-'+p+'" value="'+p+'"><div class="dropzone ui-droppable"></div><dl class="ui-droppable"><dt><span class="title">'+k+'</span><span class="controls"><span class="type">'+s+'</span><a id="edit'+p+'" onclick="edititem('+p+')" value="'+p+'"><img class="edit" alt="Edit Menu Item" title="Edit Menu Item" src="'+b+'/wp-admin/images/ico-edit.png" /></a> <a id="remove'+p+'" onclick="removeitem('+p+')" value="'+p+'"><img class="remove" alt="Remove from Custom Menu" title="Remove from Custom Menu" src="'+b+'/wp-admin/images/ico-close.png" /></a> <a href="'+c+'" target="_blank"><img alt="View Custom Link" title="View Custom Link" src="'+b+'/wp-admin/images/ico-viewpage.png" /></a></span></dt></dl><a class="hide" href="'+c+'">'+k+'</a><input type="hidden" name="postmenu'+p+'" id="postmenu'+p+'" value="'+r+'" /><input type="hidden" name="parent'+p+'" id="parent'+p+'" value="'+o+'" /><input type="hidden" name="title'+p+'" id="title'+p+'" value="'+k+'" /><input type="hidden" name="linkurl'+p+'" id="linkurl'+p+'" value="'+c+'" /><input type="hidden" name="description'+p+'" id="description'+p+'" value="'+i+'" /><input type="hidden" name="icon'+p+'" id="icon'+p+'" value="'+a+'" /><input type="hidden" name="position'+p+'" id="position'+p+'" value="'+p+'" /><input type="hidden" name="linktype'+p+'" id="linktype'+p+'" value="'+inputlinktype+'" /><input type="hidden" name="anchortitle'+p+'" id="anchortitle'+p+'" value="'+k+'" /><input type="hidden" name="newwindow'+p+'" id="newwindow'+p+'" value="0" /></li>');jQuery("#menu-"+p+"").draggable({handle:" > dl",opacity:0.8,addClasses:false,helper:"clone",zIndex:100});jQuery("#menu-"+p+" dl, #menu-"+p+" .dropzone").droppable({accept:"#"+p+", #custom-nav li",tolerance:"pointer",drop:function(x,w){var t=jQuery(this).parent();var y=!jQuery(this).hasClass("dropzone");if(y&&t.children("ul").length==0){t.append("<ul/>")}if(y){t.children("ul").append(w.draggable)}else{t.before(w.draggable)}t.find("dl,.dropzone").css({backgroundColor:"",borderColor:""});var v=w.draggable.attr("value");var u=t.attr("value");t.find("#menu-"+v).find("#parent"+v).val(u);jQuery(this).parent().find("dt").removeAttr("style");jQuery(this).parent().find("div:first").removeAttr("style")},over:function(){if(jQuery(this).attr("class")=="dropzone ui-droppable"){jQuery(this).parent().find("div:first").css("background","none").css("height","50px")}else{if(jQuery(this).attr("class")=="ui-droppable"){jQuery(this).parent().find("dt:first").css("background","#d8d8d8")}else{}}var t=jQuery(this).parent().attr("id")},out:function(){jQuery(this).parent().find("dt").removeAttr("style");jQuery(this).parent().find("div:first").removeAttr("style");jQuery(this).filter(".dropzone").css({borderColor:""})}});updatepostdata()};
  • trunk/wp-includes/custom-navigation.php

    r13262 r13266  
    1414    $menu_items = array();
    1515    if ( !empty( $menu_objects ) && !empty( $key ) ) {
    16         $args = array( 'orderby' => 'menu_order', 'post_type' => 'menu_item', 'post_status' => 'menu-category,menu-page,menu-custom' );
     16        $args = array( 'orderby' => 'menu_order', 'post_type' => 'menu_item', 'post_status' => 'publish' );
    1717        if ( count( $menu_objects ) > 1 )
    1818            $args['include'] = implode( ',', $menu_objects );
    1919        else
    2020            $args['include'] = $menu_objects[0];
    21         $posts = new WP_Query( $args );
    22         if ( ! empty( $posts->posts ) ) {
    23             foreach( $posts->posts as $post ) {
     21        $posts = get_posts( $args );
     22        if ( ! empty( $posts ) ) {
     23            foreach ( $posts as $post ) {
    2424                $menu_items[ $post->$key ] = $post;
    2525            }
     
    3030    return $menu_items;
    3131}
     32
    3233function wp_custom_navigation_setup($override = false) {
    3334   
  • trunk/wp-includes/script-loader.php

    r13263 r13266  
    404404    $scripts->add_data( 'custom-navigation-ui-custom', 'group', 1 );
    405405   
    406     $scripts->add( 'custom-navigation-default-items', '/wp-admin/js/custom-navigation-default-items.js', false, '1.0.0' );
    407     $scripts->add( 'custom-navigation-dynamic-functions', '/wp-admin/js/custom-navigation-dynamic-functions.js', false, '1.0.0' );
    408     $scripts->add( 'custom-navigation-php-functions', '/wp-admin/js/custom-navigation-php-functions.js', false, '1.0.0' );
     406    $scripts->add( 'custom-navigation-default-items', "/wp-admin/js/custom-navigation-default-items$suffix.js", false, '20100220' );
     407    $scripts->add( 'custom-navigation-dynamic-functions', "/wp-admin/js/custom-navigation-dynamic-functions$suffix.js", false, '20100220' );
     408    $scripts->add( 'custom-navigation-php-functions', "/wp-admin/js/custom-navigation-php-functions$suffix.js", false, '20100220' );
    409409   
    410410}
Note: See TracChangeset for help on using the changeset viewer.