Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VIP linter fixes #820

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions inc/fields/class-shortcode-ui-field-post-select.php
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ public function action_wp_ajax_shortcode_ui_post_field() {
$nonce = isset( $_GET['nonce'] ) ? sanitize_text_field( $_GET['nonce'] ) : null;
$requested_shortcode = isset( $_GET['shortcode'] ) ? sanitize_text_field( $_GET['shortcode'] ) : null;
$requested_attr = isset( $_GET['attr'] ) ? sanitize_text_field( $_GET['attr'] ) : null;
$include = isset( $_GET['include'] ) ? $_GET['include'] : array();
svandragt marked this conversation as resolved.
Show resolved Hide resolved


$response = array(
'items' => array(),
Expand Down Expand Up @@ -136,9 +138,12 @@ public function action_wp_ajax_shortcode_ui_post_field() {
$query_args['s'] = sanitize_text_field( $_GET['s'] );
}

if ( ! empty( $_GET['include'] ) ) {
$post__in = is_array( $_GET['include'] ) ? $_GET['include'] : explode( ',', $_GET['include'] );
$query_args['post__in'] = array_map( 'intval', $post__in );
if ( ! empty( $include ) ) {
$post__in = is_array( $include ) ? $include : (array) explode( ',', sanitize_text_field( $include ) );
$post__in = array_map( 'intval', $post__in );
unset( $include );

$query_args['post__in'] = $post__in;
$query_args['orderby'] = 'post__in';
$query_args['ignore_sticky_posts'] = true;
}
Expand Down
11 changes: 8 additions & 3 deletions inc/fields/class-shortcode-ui-field-term-select.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,13 @@ public function output_templates() {
*/
public function action_wp_ajax_shortcode_ui_term_field() {

$args = array();
$nonce = isset( $_GET['nonce'] ) ? sanitize_text_field( $_GET['nonce'] ) : null;
$requested_shortcode = isset( $_GET['shortcode'] ) ? sanitize_text_field( $_GET['shortcode'] ) : null;
$requested_attr = isset( $_GET['attr'] ) ? sanitize_text_field( $_GET['attr'] ) : null;
$page = isset( $_GET['page'] ) ? absint( $_GET['page'] ) : null;
$search = isset( $_GET['s'] ) ? sanitize_text_field( $_GET['s'] ) : '';
$include = isset( $_GET['include'] ) ? $_GET['include'] : array();

$response = array(
'items' => array(),
Expand Down Expand Up @@ -142,10 +144,13 @@ public function action_wp_ajax_shortcode_ui_term_field() {
$args['hide_empty'] = false;
$args['number'] = 10;

if ( ! empty( $_GET['include'] ) ) {
$term__in = is_array( $_GET['include'] ) ? $_GET['include'] : explode( ',', $_GET['include'] );
if ( ! empty( $include ) ) {
$term__in = is_array( $include ) ? $include : (array) explode( ',', sanitize_text_field( $include ) );
$term__in = array_map( 'intval', $term__in );
unset( $include );

$args['number'] = count( $term__in );
$args['include'] = array_map( 'intval', $term__in );
$args['include'] = $term__in;
$args['orderby'] = 'tag__in';
}

Expand Down