Skip to content
This repository has been archived by the owner on Jan 13, 2022. It is now read-only.

Commit

Permalink
Use wp_parse_list over explode.
Browse files Browse the repository at this point in the history
  • Loading branch information
spacedmonkey committed Nov 26, 2019
1 parent f1ee75a commit aa5242a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/class-wp-rest-menu-items-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -383,7 +383,7 @@ protected function prepare_item_for_database( $request ) {
foreach ( array( 'menu-item-xfn', 'menu-item-classes' ) as $key ) {
$value = $prepared_nav_item[ $key ];
if ( ! is_array( $value ) ) {
$value = explode( ' ', $value );
$value = wp_parse_list( $value );
}
$prepared_nav_item[ $key ] = implode( ' ', array_map( 'sanitize_html_class', $value ) );
}
Expand Down Expand Up @@ -711,7 +711,7 @@ public function get_item_schema() {
'context' => array( 'view', 'edit', 'embed' ),
'arg_options' => array(
'sanitize_callback' => function ( $value ) {
return array_map( 'sanitize_html_class', explode( ' ', $value ) );
return array_map( 'sanitize_html_class', wp_parse_list( $value ) );
},
),
);
Expand Down Expand Up @@ -779,7 +779,7 @@ public function get_item_schema() {
'context' => array( 'view', 'edit', 'embed' ),
'arg_options' => array(
'sanitize_callback' => function ( $value ) {
return array_map( 'sanitize_html_class', explode( ' ', $value ) );
return array_map( 'sanitize_html_class', wp_parse_list( $value ) );
},
),
);
Expand Down

0 comments on commit aa5242a

Please sign in to comment.