Changeset 42343 for trunk/src/wp-admin/link.php
- Timestamp:
- 11/30/2017 11:09:33 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/link.php
r38028 r42343 15 15 wp_reset_vars( array( 'action', 'cat_id', 'link_id' ) ); 16 16 17 if ( ! current_user_can( 'manage_links') )17 if ( ! current_user_can( 'manage_links' ) ) { 18 18 wp_link_manager_disabled_message(); 19 } 19 20 20 if ( ! empty($_POST['deletebookmarks']) )21 if ( ! empty( $_POST['deletebookmarks'] ) ) { 21 22 $action = 'deletebookmarks'; 22 if ( !empty($_POST['move']) ) 23 } 24 if ( ! empty( $_POST['move'] ) ) { 23 25 $action = 'move'; 24 if ( !empty($_POST['linkcheck']) ) 26 } 27 if ( ! empty( $_POST['linkcheck'] ) ) { 25 28 $linkcheck = $_POST['linkcheck']; 29 } 26 30 27 $this_file = admin_url( 'link-manager.php');31 $this_file = admin_url( 'link-manager.php' ); 28 32 29 switch ( $action) {30 case 'deletebookmarks' 31 check_admin_referer( 'bulk-bookmarks');33 switch ( $action ) { 34 case 'deletebookmarks': 35 check_admin_referer( 'bulk-bookmarks' ); 32 36 33 37 // For each link id (in $linkcheck[]) change category to selected value. 34 if ( count($linkcheck) == 0) {35 wp_redirect( $this_file);38 if ( count( $linkcheck ) == 0 ) { 39 wp_redirect( $this_file ); 36 40 exit; 37 41 } 38 42 39 43 $deleted = 0; 40 foreach ( $linkcheck as $link_id) {44 foreach ( $linkcheck as $link_id ) { 41 45 $link_id = (int) $link_id; 42 46 43 if ( wp_delete_link( $link_id) )47 if ( wp_delete_link( $link_id ) ) { 44 48 $deleted++; 49 } 45 50 } 46 51 47 wp_redirect( "$this_file?deleted=$deleted");52 wp_redirect( "$this_file?deleted=$deleted" ); 48 53 exit; 49 54 50 case 'move' 51 check_admin_referer( 'bulk-bookmarks');55 case 'move': 56 check_admin_referer( 'bulk-bookmarks' ); 52 57 53 58 // For each link id (in $linkcheck[]) change category to selected value. 54 if ( count($linkcheck) == 0) {55 wp_redirect( $this_file);59 if ( count( $linkcheck ) == 0 ) { 60 wp_redirect( $this_file ); 56 61 exit; 57 62 } 58 $all_links = join( ',', $linkcheck);63 $all_links = join( ',', $linkcheck ); 59 64 /* 60 65 * Should now have an array of links we can change: … … 62 67 */ 63 68 64 wp_redirect( $this_file);69 wp_redirect( $this_file ); 65 70 exit; 66 71 67 case 'add' 68 check_admin_referer( 'add-bookmark');72 case 'add': 73 check_admin_referer( 'add-bookmark' ); 69 74 70 75 $redir = wp_get_referer(); 71 if ( add_link() ) 76 if ( add_link() ) { 72 77 $redir = add_query_arg( 'added', 'true', $redir ); 78 } 73 79 74 80 wp_redirect( $redir ); 75 81 exit; 76 82 77 case 'save' 83 case 'save': 78 84 $link_id = (int) $_POST['link_id']; 79 check_admin_referer( 'update-bookmark_' . $link_id);85 check_admin_referer( 'update-bookmark_' . $link_id ); 80 86 81 edit_link( $link_id);87 edit_link( $link_id ); 82 88 83 wp_redirect( $this_file);89 wp_redirect( $this_file ); 84 90 exit; 85 91 86 case 'delete' 92 case 'delete': 87 93 $link_id = (int) $_GET['link_id']; 88 check_admin_referer( 'delete-bookmark_' . $link_id);94 check_admin_referer( 'delete-bookmark_' . $link_id ); 89 95 90 wp_delete_link( $link_id);96 wp_delete_link( $link_id ); 91 97 92 wp_redirect( $this_file);98 wp_redirect( $this_file ); 93 99 exit; 94 100 95 case 'edit' 96 wp_enqueue_script( 'link');97 wp_enqueue_script( 'xfn');101 case 'edit': 102 wp_enqueue_script( 'link' ); 103 wp_enqueue_script( 'xfn' ); 98 104 99 if ( wp_is_mobile() ) 105 if ( wp_is_mobile() ) { 100 106 wp_enqueue_script( 'jquery-touch-punch' ); 107 } 101 108 102 $parent_file = 'link-manager.php';109 $parent_file = 'link-manager.php'; 103 110 $submenu_file = 'link-manager.php'; 104 $title = __('Edit Link');111 $title = __( 'Edit Link' ); 105 112 106 113 $link_id = (int) $_GET['link_id']; 107 114 108 if (!$link = get_link_to_edit($link_id)) 109 wp_die(__('Link not found.')); 115 if ( ! $link = get_link_to_edit( $link_id ) ) { 116 wp_die( __( 'Link not found.' ) ); 117 } 110 118 111 119 include( ABSPATH . 'wp-admin/edit-link-form.php' ); … … 113 121 break; 114 122 115 default 123 default: 116 124 break; 117 125 }
Note: See TracChangeset
for help on using the changeset viewer.