HEX
Server: Apache
System: Linux vpshost0650.publiccloud.com.br 4.4.79-grsec-1.lc.x86_64 #1 SMP Wed Aug 2 14:18:21 -03 2017 x86_64
User: bandeirantesbomb3 (10068)
PHP: 8.0.7
Disabled: apache_child_terminate,dl,escapeshellarg,escapeshellcmd,exec,link,mail,openlog,passthru,pcntl_alarm,pcntl_exec,pcntl_fork,pcntl_get_last_error,pcntl_getpriority,pcntl_setpriority,pcntl_signal,pcntl_signal_dispatch,pcntl_sigprocmask,pcntl_sigtimedwait,pcntl_sigwaitinfo,pcntl_strerror,pcntl_wait,pcntl_waitpid,pcntl_wexitstatus,pcntl_wifexited,pcntl_wifsignaled,pcntl_wifstopped,pcntl_wstopsig,pcntl_wtermsig,php_check_syntax,php_strip_whitespace,popen,proc_close,proc_open,shell_exec,symlink,system
Upload Files
File: /home/goremar3/public_html/wp-content/plugins/shopengine/widgets/prod-short-code.php
<?php

namespace ShopEngine\Widgets;
defined('ABSPATH') || exit;

class Prod_Short_Code extends \WC_Shortcode_Products {

	public function __construct($settings = array(), $type = 'products') {

		$this->settings = $settings;
		$this->type     = $type;

		$this->attributes = $this->parse_attributes([
			'columns'  => $settings['shopengine_columns'],
			'rows'     => $settings['shopengine_rows'],
			'paginate' => $settings['shopengine_paginate'],
			'cache'    => false,
		]);

		$this->query_args = $this->parse_query_args();
	}


	protected function parse_query_args() {

		$query_args = [
			'post_type'           => 'product',
			'post_status'         => 'publish',
			'ignore_sticky_posts' => true,
			'no_found_rows'       => false === wc_string_to_bool($this->attributes['paginate']),
		];

		$settings = $this->settings;

		if($settings['shopengine_paginate'] === 'yes') {
			//phpcs:ignore WordPress.Security.NonceVerification.Recommended -- It's a fronted user part, not possible to verify nonce here
			$page = empty( $_GET['product-page'] ) ? 1 : absint($_GET['product-page']);

			if ($page > 1) {
				$query_args['paged'] = $page;
			}

			$ord_arg = WC()->query->get_catalog_ordering_args();

			$query_args['orderby'] = $ord_arg['orderby'];
			$query_args['order']   = $ord_arg['order'];
		}


		$query_args['fields']         = 'ids';
		$query_args['post_type']      = 'product';
		$query_args['posts_per_page'] = intval($settings['shopengine_columns'] * $settings['shopengine_rows']);


		return $query_args;
	}


	protected function get_query_results() {

		$results = parent::get_query_results();

		return $results;
	}
}