@@ -112,19 +112,19 @@ function column_name( $snippet ) {
112112 $ actions ['deactivate ' ] = sprintf (
113113 '<a href="%2$s">%1$s</a> ' ,
114114 $ screen ->is_network ? __ ( 'Network Deactivate ' , 'code-snippets ' ) : __ ( 'Deactivate ' , 'code-snippets ' ),
115- add_query_arg ( array (
115+ esc_url ( add_query_arg ( array (
116116 'action ' => 'deactivate ' ,
117117 'id ' => $ snippet ->id
118- ) )
118+ ) ) )
119119 );
120120 } else {
121121 $ actions ['activate ' ] = sprintf (
122122 '<a href="%2$s">%1$s</a> ' ,
123123 $ screen ->is_network ? __ ( 'Network Activate ' , 'code-snippets ' ) : __ ( 'Activate ' , 'code-snippets ' ),
124- add_query_arg ( array (
124+ esc_url ( add_query_arg ( array (
125125 'action ' => 'activate ' ,
126126 'id ' => $ snippet ->id
127- ) )
127+ ) ) )
128128 );
129129 }
130130
@@ -137,19 +137,19 @@ function column_name( $snippet ) {
137137 $ actions ['export ' ] = sprintf (
138138 '<a href="%2$s">%1$s</a> ' ,
139139 __ ( 'Export ' , 'code-snippets ' ),
140- add_query_arg ( array (
140+ esc_url ( add_query_arg ( array (
141141 'action ' => 'export ' ,
142142 'id ' => $ snippet ->id
143- ) )
143+ ) ) )
144144 );
145145
146146 $ actions ['delete ' ] = sprintf (
147147 '<a href="%2$s" class="delete" onclick="%3$s">%1$s</a> ' ,
148148 __ ( 'Delete ' , 'code-snippets ' ),
149- add_query_arg ( array (
149+ esc_url ( add_query_arg ( array (
150150 'action ' => 'delete ' ,
151151 'id ' => $ snippet ->id
152- ) ),
152+ ) ) ) ,
153153 esc_js ( sprintf (
154154 'return confirm("%s"); ' ,
155155 __ ("You are about to permanently delete the selected item.
@@ -202,7 +202,7 @@ function column_tags( $snippet ) {
202202
203203 foreach ( $ snippet ->tags as $ tag ) {
204204 $ out [] = sprintf ( '<a href="%s">%s</a> ' ,
205- add_query_arg ( 'tag ' , esc_attr ( $ tag ) ),
205+ esc_url ( add_query_arg ( 'tag ' , esc_attr ( $ tag ) ) ),
206206 esc_html ( $ tag )
207207 );
208208 }
@@ -314,7 +314,7 @@ function get_views() {
314314 }
315315
316316 $ status_links [$ type ] = sprintf ( '<a href="%s"%s>%s</a> ' ,
317- add_query_arg ( 'status ' , $ type ),
317+ esc_url ( add_query_arg ( 'status ' , $ type ) ),
318318 ( $ type === $ status ) ? ' class="current" ' : '' ,
319319 sprintf ( $ text , number_format_i18n ( $ count ) )
320320 );
@@ -479,7 +479,7 @@ function process_bulk_actions() {
479479 if ( ! in_array ( $ action , array ( 'export ' , 'export-php ' ) ) ) {
480480 wp_redirect ( apply_filters (
481481 "code_snippets/ {$ action }_redirect " ,
482- add_query_arg ( $ action , true )
482+ esc_url_raw ( add_query_arg ( $ action , true ) )
483483 ) );
484484 }
485485
@@ -499,14 +499,14 @@ function process_bulk_actions() {
499499 foreach ( $ ids as $ id ) {
500500 activate_snippet ( $ id , $ network );
501501 }
502- wp_redirect ( add_query_arg ( 'activate-multi ' , true ) );
502+ wp_redirect ( esc_url_raw ( add_query_arg ( 'activate-multi ' , true ) ) );
503503 break ;
504504
505505 case 'deactivate-selected ' :
506506 foreach ( $ ids as $ id ) {
507507 deactivate_snippet ( $ id , $ network );
508508 }
509- wp_redirect ( add_query_arg ( 'deactivate-multi ' , true ) );
509+ wp_redirect ( esc_url_raw ( add_query_arg ( 'deactivate-multi ' , true ) ) );
510510 break ;
511511
512512 case 'export-selected ' :
@@ -521,7 +521,7 @@ function process_bulk_actions() {
521521 foreach ( $ ids as $ id ) {
522522 delete_snippet ( $ id , $ network );
523523 }
524- wp_redirect ( add_query_arg ( 'delete-multi ' , true ) );
524+ wp_redirect ( esc_url_raw ( add_query_arg ( 'delete-multi ' , true ) ) );
525525 break ;
526526
527527 case 'clear-recent-list ' :
@@ -568,13 +568,8 @@ function prepare_items() {
568568
569569 /* Filter snippets by tag */
570570 if ( isset ( $ _POST ['tag ' ] ) ) {
571-
572- if ( ! empty ( $ _POST ['tag ' ] ) ) {
573- wp_redirect ( add_query_arg ( 'tag ' , $ _POST ['tag ' ] ) );
574- }
575- else {
576- wp_redirect ( remove_query_arg ( 'tag ' ) );
577- }
571+ $ location = empty ( $ _POST ['tag ' ] ) ? remove_query_arg ( 'tag ' ) : add_query_arg ( 'tag ' , $ _POST ['tag ' ] );
572+ wp_redirect ( esc_url_raw ( $ location ) );
578573 }
579574
580575 if ( ! empty ( $ _GET ['tag ' ] ) ) {
@@ -777,7 +772,7 @@ public function search_notice() {
777772
778773 printf (
779774 ' <a class="button clear-filters" href="%s"> ' . __ ( 'Clear Filters ' , 'code-snippets ' ) . '</a> ' ,
780- remove_query_arg ( array ( 's ' , 'tag ' ) )
775+ esc_url ( remove_query_arg ( array ( 's ' , 'tag ' ) ) )
781776 );
782777 }
783778 }
0 commit comments