summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--composer.json3
-rw-r--r--src/class-draggable-post-order.php7
2 files changed, 5 insertions, 5 deletions
diff --git a/composer.json b/composer.json
index a3c1e6c..908af46 100644
--- a/composer.json
+++ b/composer.json
@@ -21,7 +21,8 @@
},
"scripts": {
"test:unit": "phpunit",
- "test:cs": "phpcs"
+ "test:cs": "phpcs",
+ "format:cbf": "phpcbf"
},
"autoload": {
"classmap": [
diff --git a/src/class-draggable-post-order.php b/src/class-draggable-post-order.php
index a976816..ee9156c 100644
--- a/src/class-draggable-post-order.php
+++ b/src/class-draggable-post-order.php
@@ -136,11 +136,10 @@ class Draggable_Post_Order {
$page = intval( $_POST['page'] );
$per_page = intval( $_POST['perPage'] );
- //phpcs:ignore WordPress.Security.ValidatedSanitizedInput.MissingUnslash, WordPress.Security.ValidatedSanitizedInput.InputNotSanitized
- parse_str( $_POST['postOrder'], $post_order );
+ parse_str( sanitize_text_field( wp_unslash( $_POST['postOrder'] ) ), $post_order );
- foreach ( $post_order['post'] as $order => $post_id ) {
- $order = intval( $order ) + 1;
+ foreach ( $post_order['post'] as $idx => $post_id ) {
+ $order = intval( $idx ) + 1;
update_post_meta( $post_id, self::$meta_key, ( ( $page - 1 ) * $per_page ) + $order );
}
}