Default target to _self. Add some sanitization and gettext. see #11817
git-svn-id: http://svn.automattic.com/wordpress/trunk@13719 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
6f27182cf1
commit
b98f319bcf
|
@ -93,6 +93,6 @@ jQuery(document).ready(function($){
|
|||
var link_name = jQuery(e.currentTarget).parent().parent().find('#custom-menu-item-name').val();
|
||||
|
||||
// Add link to menu
|
||||
wp_add_item_to_menu( 0, '', 'custom', navMenuL10n.custom, 0, link_name, link_url, '', '', '_none', '', '' );
|
||||
wp_add_item_to_menu( 0, '', 'custom', navMenuL10n.custom, 0, link_name, link_url, '', '', '_self', '', '' );
|
||||
});
|
||||
});
|
|
@ -1 +1 @@
|
|||
jQuery(document).ready(function(a){wp_drag_and_drop();a("#update-nav-menu .deletion").click(function(){if(confirm(navMenuL10n.warnDelete)){return true}else{return false}});a("#save_menu").click(function(){return wp_update_post_data()});a(".if-js-closed").removeClass("if-js-closed").addClass("closed");postboxes.add_postbox_toggles("menus");a(".quick-search").click(function(){a(this).attr("value","")});a(".quick-search-submit").click(function(){a(this).siblings(".quick-search").search()});a("#menu-container .item-edit").click(function(){return wp_edit_menu_item(a(this).attr("value"))});a("#menu-container .item-delete").live("click",function(b){return wp_remove_menu_item(a(this).attr("value"))});a("#update-menu-item").click(function(){wp_update_menu_item();return tb_remove()});a("#cancel-save").click(function(){return tb_remove()});a(".show-all").click(function(b){jQuery(b.currentTarget).parent().siblings(".list-wrap").css("display","block");jQuery(b.currentTarget).parent().siblings(".list-wrap").find("li").css("display","block");jQuery(b.currentTarget).hide();jQuery(b.currentTarget).siblings(".hide-all").show()});a(".hide-all").click(function(b){jQuery(b.currentTarget).parent().siblings(".list-wrap").css("display","none");jQuery(b.currentTarget).parent().siblings(".list-wrap").find("li").css("display","none");jQuery(b.currentTarget).hide();jQuery(b.currentTarget).siblings(".show-all").show()});a(".add-to-menu").click(function(b){return wp_add_checked_items_to_menu(b.currentTarget)});a("#add-custom-links .add-to-menu a").click(function(d){var b=jQuery(d.currentTarget).parent().parent().find("#custom-menu-item-url").val();var c=jQuery(d.currentTarget).parent().parent().find("#custom-menu-item-name").val();wp_add_item_to_menu(0,"","custom",navMenuL10n.custom,0,c,b,"","","_none","","")})});
|
||||
jQuery(document).ready(function(a){wp_drag_and_drop();a("#update-nav-menu .deletion").click(function(){if(confirm(navMenuL10n.warnDelete)){return true}else{return false}});a("#save_menu").click(function(){return wp_update_post_data()});a(".if-js-closed").removeClass("if-js-closed").addClass("closed");postboxes.add_postbox_toggles("menus");a(".quick-search").click(function(){a(this).attr("value","")});a(".quick-search-submit").click(function(){a(this).siblings(".quick-search").search()});a("#menu-container .item-edit").click(function(){return wp_edit_menu_item(a(this).attr("value"))});a("#menu-container .item-delete").live("click",function(b){return wp_remove_menu_item(a(this).attr("value"))});a("#update-menu-item").click(function(){wp_update_menu_item();return tb_remove()});a("#cancel-save").click(function(){return tb_remove()});a(".show-all").click(function(b){jQuery(b.currentTarget).parent().siblings(".list-wrap").css("display","block");jQuery(b.currentTarget).parent().siblings(".list-wrap").find("li").css("display","block");jQuery(b.currentTarget).hide();jQuery(b.currentTarget).siblings(".hide-all").show()});a(".hide-all").click(function(b){jQuery(b.currentTarget).parent().siblings(".list-wrap").css("display","none");jQuery(b.currentTarget).parent().siblings(".list-wrap").find("li").css("display","none");jQuery(b.currentTarget).hide();jQuery(b.currentTarget).siblings(".show-all").show()});a(".add-to-menu").click(function(b){return wp_add_checked_items_to_menu(b.currentTarget)});a("#add-custom-links .add-to-menu a").click(function(d){var b=jQuery(d.currentTarget).parent().parent().find("#custom-menu-item-url").val();var c=jQuery(d.currentTarget).parent().parent().find("#custom-menu-item-name").val();wp_add_item_to_menu(0,"","custom",navMenuL10n.custom,0,c,b,"","","_self","","")})});
|
|
@ -152,7 +152,7 @@ function wp_add_checked_items_to_menu( button ) {
|
|||
var item_xfn = jQuery(this).parent().siblings('.menu-item-xfn').val();
|
||||
} else {
|
||||
var item_attr_title = '';
|
||||
var item_target = '_none';
|
||||
var item_target = '_self';
|
||||
var item_classes = '';
|
||||
var item_xfn = '';
|
||||
};
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -107,7 +107,6 @@ switch ( $action ) {
|
|||
|
||||
// Loop through all POST variables
|
||||
for ( $k = 0; $k < $update_nav_items; $k++ ) {
|
||||
|
||||
$menu_item_db_id = isset( $_POST['menu-item-db-id'][$k] ) ? $_POST['menu-item-db-id'][$k] : 0;
|
||||
$menu_item_object_id = isset( $_POST['menu-item-object-id'][$k] ) ? $_POST['menu-item-object-id'][$k] : 0;
|
||||
$menu_item_parent_id = isset( $_POST['menu-item-parent-id'][$k] ) ? $_POST['menu-item-parent-id'][$k] : 0;
|
||||
|
@ -143,12 +142,14 @@ switch ( $action ) {
|
|||
}
|
||||
$parent_menu_ids[$k] = $menu_item_db_id;
|
||||
|
||||
// @todo sanitize type append and ID.
|
||||
update_post_meta( $menu_item_db_id, 'menu_item_type', $menu_item_type );
|
||||
update_post_meta( $menu_item_db_id, 'menu_item_append', $menu_item_append );
|
||||
update_post_meta( $menu_item_db_id, 'menu_item_object_id', $menu_item_object_id );
|
||||
update_post_meta( $menu_item_db_id, 'menu_item_target', esc_attr($menu_item_target) );
|
||||
update_post_meta( $menu_item_db_id, 'menu_item_classes', esc_attr($menu_item_classes) );
|
||||
update_post_meta( $menu_item_db_id, 'menu_item_xfn', esc_attr($menu_item_xfn) );
|
||||
update_post_meta( $menu_item_db_id, 'menu_item_target', sanitize_key($menu_item_target) );
|
||||
// @todo handle sanitizing multiple classes separated by whitespace.
|
||||
update_post_meta( $menu_item_db_id, 'menu_item_classes', sanitize_html_class($menu_item_classes) );
|
||||
update_post_meta( $menu_item_db_id, 'menu_item_xfn', sanitize_html_class($menu_item_xfn) );
|
||||
|
||||
// @todo: only save custom link urls.
|
||||
update_post_meta( $menu_item_db_id, 'menu_item_url', esc_url_raw( $menu_item_url ) );
|
||||
|
@ -288,8 +289,8 @@ require_once( 'admin-header.php' );
|
|||
<label for="edit-menu-item-target">
|
||||
<?php _e( 'Link Target' ); ?><br />
|
||||
<select id="edit-menu-item-target" class="widefat" name="edit-menu-item-target" tabindex="4">
|
||||
<option value="_self">Same window or tab</option>
|
||||
<option value="_blank">New window or tab</option>
|
||||
<option value="_self"><?php _e('Same window or tab'); ?></option>
|
||||
<option value="_blank"><?php _e('New window or tab'); ?></option>
|
||||
</select>
|
||||
</label>
|
||||
</p>
|
||||
|
@ -309,7 +310,7 @@ require_once( 'admin-header.php' );
|
|||
<label for="edit-menu-item-description">
|
||||
<?php _e( 'Description (optional)' ); ?><br />
|
||||
<textarea id="edit-menu-item-description" class="widefat" rows="3" name="edit-menu-item-description" tabindex="7" /></textarea>
|
||||
<span class="description">The description will be displayed in the menu if the current theme supports it.</span>
|
||||
<span class="description"><?php _e('The description will be displayed in the menu if the current theme supports it.'); ?></span>
|
||||
</label>
|
||||
</p>
|
||||
<p>
|
||||
|
|
|
@ -211,7 +211,7 @@ function wp_setup_nav_menu_item( $menu_item, $menu_item_type = null, $menu_item_
|
|||
|
||||
$menu_item->title = $menu_item->post_title;
|
||||
$menu_item->url = get_permalink( $menu_item->ID );
|
||||
$menu_item->target = '_none';
|
||||
$menu_item->target = '_self';
|
||||
|
||||
$menu_item->attr_title = '';
|
||||
$menu_item->description = strip_tags( $menu_item->post_content );
|
||||
|
@ -229,7 +229,7 @@ function wp_setup_nav_menu_item( $menu_item, $menu_item_type = null, $menu_item_
|
|||
|
||||
$menu_item->title = $menu_item->name;
|
||||
$menu_item->url = get_term_link( $menu_item, $menu_item_object );
|
||||
$menu_item->target = '_none';
|
||||
$menu_item->target = '_self';
|
||||
$menu_item->attr_title = '';
|
||||
$menu_item->description = strip_tags( $menu_item->description );
|
||||
break;
|
||||
|
|
Loading…
Reference in New Issue