' ' . esc_attr($attributes['className']) : '') . '">'; // possible values for "Time Range" and "Order by" $time_units = ['minute', 'hour', 'day', 'week', 'month']; $range_values = ['daily', 'last24hours', 'weekly', 'last7days', 'monthly', 'last30days', 'all', 'custom']; $order_by_values = ['comments', 'views', 'avg']; $theme_data = $this->themer->get_theme($theme); if ( ! isset($theme_data['json']) ) { $theme = ''; } $query_args = [ 'title' => strip_tags($title), // phpcs:ignore WordPress.WP.AlternativeFunctions.strip_tags_strip_tags -- We want the behavior of strip_tags 'limit' => ( ! empty($limit) && Helper::is_number($limit) && $limit > 0 ) ? $limit : 10, 'offset' => ( ! empty($offset) && Helper::is_number($offset) && $offset >= 0 ) ? $offset : 0, 'range' => ( in_array($range, $range_values) ) ? $range : 'daily', 'time_quantity' => ( ! empty($time_quantity) && Helper::is_number($time_quantity) && $time_quantity > 0 ) ? $time_quantity : 24, 'time_unit' => ( in_array($time_unit, $time_units) ) ? $time_unit : 'hour', 'freshness' => empty($freshness) ? false : $freshness, 'order_by' => ( in_array($order_by, $order_by_values) ) ? $order_by : 'views', 'post_type' => empty($post_type) ? 'post' : $post_type, 'pid' => rtrim(preg_replace('|[^0-9,]|', '', $pid), ','), /** Deprecated */ 'exclude' => rtrim(preg_replace('|[^0-9,]|', '', $exclude), ','), 'taxonomy' => empty($tax) ? 'category' : $tax, 'term_id' => rtrim(preg_replace('|[^0-9,;-]|', '', $term_id), ','), 'author' => rtrim(preg_replace('|[^0-9,]|', '', $author), ','), 'shorten_title' => [ 'active' => ( (bool) $attributes['shorten_title'] && ! empty($title_length) && Helper::is_number($title_length) && $title_length > 0 ), 'length' => ( ! empty($title_length) && Helper::is_number($title_length) ) ? $title_length : 0, 'words' => (( ! empty($title_by_words) && Helper::is_number($title_by_words) && $title_by_words > 0 )), ], 'post-excerpt' => [ 'active' => ( (bool) $attributes['display_post_excerpt'] && ! empty($excerpt_length) && Helper::is_number($excerpt_length) && $excerpt_length > 0 ), 'length' => ( ! empty($excerpt_length) && Helper::is_number($excerpt_length) ) ? $excerpt_length : 0, 'keep_format' => ( ! empty($excerpt_format) && Helper::is_number($excerpt_format) && $excerpt_format > 0 ), 'words' => ( ! empty($excerpt_by_words) && Helper::is_number($excerpt_by_words) && $excerpt_by_words > 0 ), ], 'thumbnail' => [ 'active' => ( 'predefined' == $thumbnail_build && (bool) $attributes['display_post_thumbnail'] ) ? true : ( ! empty($thumbnail_width) && Helper::is_number($thumbnail_width) && $thumbnail_width > 0 ), 'width' => ( ! empty($thumbnail_width) && Helper::is_number($thumbnail_width) && $thumbnail_width > 0 ) ? $thumbnail_width : 0, 'height' => ( ! empty($thumbnail_height) && Helper::is_number($thumbnail_height) && $thumbnail_height > 0 ) ? $thumbnail_height : 0, 'build' => 'predefined' == $thumbnail_build ? 'predefined' : 'manual', 'size' => empty($thumbnail_size) ? '' : $thumbnail_size, ], 'rating' => (bool) $attributes['rating'], 'stats_tag' => [ 'comment_count' => (bool) $attributes['stats_comments'], 'views' => (bool) $attributes['stats_views'], 'author' => (bool) $attributes['stats_author'], 'date' => [ 'active' => (bool) $attributes['stats_date'], 'format' => empty($stats_date_format) ? 'F j, Y' : $stats_date_format ], 'taxonomy' => [ 'active' => (bool) $attributes['stats_taxonomy'], 'name' => empty($taxonomy) ? 'category' : $taxonomy, ] ], 'markup' => [ 'custom_html' => (bool) $attributes['custom_html'], 'wpp-start' => empty($wpp_start) ? '' : $wpp_start, 'wpp-end' => empty($wpp_end) ? '' : $wpp_end, 'title-start' => empty($header_start) ? '' : $header_start, 'title-end' => empty($header_end) ? '' : $header_end, 'post-html' => empty($post_html) ? '