HEX
Server: LiteSpeed
System: Linux eko108.isimtescil.net 4.18.0-477.21.1.lve.1.el8.x86_64 #1 SMP Tue Sep 5 23:08:35 UTC 2023 x86_64
User: uyarreklamcomtr (11202)
PHP: 7.4.33
Disabled: opcache_get_status
Upload Files
File: /var/www/vhosts/uyarreklam.com.tr/httpdocs/Proxies.tar
ActionsProxy.php000064400000002120151540702550007716 0ustar00<?php
/**
 * ActionsProxy class file.
 */

namespace Automattic\WooCommerce\Proxies;

/**
 * Proxy for interacting with WordPress actions and filters.
 *
 * This class should be used instead of directly accessing the WordPress functions, to ease unit testing.
 */
class ActionsProxy {

	/**
	 * Retrieve the number of times an action is fired.
	 *
	 * @param string $tag The name of the action hook.
	 *
	 * @return int The number of times action hook $tag is fired.
	 */
	public function did_action( $tag ) {
		return did_action( $tag );
	}

	/**
	 * Calls the callback functions that have been added to a filter hook.
	 *
	 * @param string $tag     The name of the filter hook.
	 * @param mixed  $value   The value to filter.
	 * @param mixed  ...$parameters Additional parameters to pass to the callback functions.
	 *
	 * @return mixed The filtered value after all hooked functions are applied to it.
	 */
	public function apply_filters( $tag, $value, ...$parameters ) {
		return apply_filters( $tag, $value, ...$parameters );
	}

	// TODO: Add the rest of the actions and filters related methods.
}
LegacyProxy.php000064400000007706151540702550007541 0ustar00<?php
/**
 * LegacyProxy class file.
 */

namespace Automattic\WooCommerce\Proxies;

use Automattic\WooCommerce\Internal\DependencyManagement\Definition;
use Automattic\WooCommerce\Vendor\Psr\Container\ContainerInterface;

/**
 * Proxy class to access legacy WooCommerce functionality.
 *
 * This class should be used to interact with code outside the `src` directory, especially functions and classes
 * in the `includes` directory, unless a more specific proxy exists for the functionality at hand (e.g. `ActionsProxy`).
 * Idempotent functions can be executed directly.
 */
class LegacyProxy {

	/**
	 * Gets an instance of a given legacy class.
	 * This must not be used to get instances of classes in the `src` directory.
	 *
	 * If a given class needs a special procedure to get an instance of it,
	 * please add a private get_instance_of_(lowercased_class_name) and it will be
	 * automatically invoked. See also how objects of classes having a static `instance`
	 * method are retrieved, similar approaches can be used as needed to make use
	 * of existing factory methods such as e.g. 'load'.
	 *
	 * @param string $class_name The name of the class to get an instance for.
	 * @param mixed  ...$args Parameters to be passed to the class constructor or to the appropriate internal 'get_instance_of_' method.
	 *
	 * @return object The instance of the class.
	 * @throws \Exception The requested class belongs to the `src` directory, or there was an error creating an instance of the class.
	 */
	public function get_instance_of( string $class_name, ...$args ) {
		if ( false !== strpos( $class_name, '\\' ) ) {
			throw new \Exception(
				'The LegacyProxy class is not intended for getting instances of classes in the src directory, please use ' .
				Definition::INJECTION_METHOD . ' method injection or the instance of ' . ContainerInterface::class . ' for that.'
			);
		}

		// If a class has a dedicated method to obtain a instance, use it.
		$method = 'get_instance_of_' . strtolower( $class_name );
		if ( method_exists( __CLASS__, $method ) ) {
			return $this->$method( ...$args );
		}

		// If the class is a singleton, use the "instance" method.
		if ( method_exists( $class_name, 'instance' ) ) {
			return $class_name::instance( ...$args );
		}

		// If the class has a "load" method, use it.
		if ( method_exists( $class_name, 'load' ) ) {
			return $class_name::load( ...$args );
		}

		// Fallback to simply creating a new instance of the class.
		return new $class_name( ...$args );
	}

	/**
	 * Get an instance of a class implementing WC_Queue_Interface.
	 *
	 * @return \WC_Queue_Interface The instance.
	 */
	private function get_instance_of_wc_queue_interface() {
		return \WC_Queue::instance();
	}

	/**
	 * Call a user function. This should be used to execute any non-idempotent function, especially
	 * those in the `includes` directory or provided by WordPress.
	 *
	 * @param string $function_name The function to execute.
	 * @param mixed  ...$parameters The parameters to pass to the function.
	 *
	 * @return mixed The result from the function.
	 */
	public function call_function( $function_name, ...$parameters ) {
		return call_user_func_array( $function_name, $parameters );
	}

	/**
	 * Call a static method in a class. This should be used to execute any non-idempotent method in classes
	 * from the `includes` directory.
	 *
	 * @param string $class_name The name of the class containing the method.
	 * @param string $method_name The name of the method.
	 * @param mixed  ...$parameters The parameters to pass to the method.
	 *
	 * @return mixed The result from the method.
	 */
	public function call_static( $class_name, $method_name, ...$parameters ) {
		return call_user_func_array( "$class_name::$method_name", $parameters );
	}

	/**
	 * Get the value of a global.
	 *
	 * @param string $global_name The name of the global to get the value for.
	 * @return mixed The value of the global.
	 */
	public function get_global( string $global_name ) {
		return $GLOBALS[ $global_name ];
	}
}
GoogleGtagJs.php000064400000005137151543445730007612 0ustar00<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\GoogleListingsAndAds\Proxies;

/**
 * Class GoogleGtagJs
 *
 * @package Automattic\WooCommerce\GoogleListingsAndAds\Proxies
 */
class GoogleGtagJs {

	/** @var array */
	private $wcga_settings;

	/** @var bool $ga4c_v2 True if Google Analytics for WooCommerce version 2 or higher is installed */
	public $ga4w_v2;

	/**
	 * GoogleGtagJs constructor.
	 *
	 * Load the WooCommerce Google Analytics for WooCommerce extension settings.
	 */
	public function __construct() {
		$this->wcga_settings = get_option( 'woocommerce_google_analytics_settings', [] );
		$this->ga4w_v2       = defined( '\WC_GOOGLE_ANALYTICS_INTEGRATION_VERSION' ) && version_compare( \WC_GOOGLE_ANALYTICS_INTEGRATION_VERSION, '2.0.0', '>=' );

		// Prime some values.
		if ( $this->ga4w_v2 ) {
			$this->wcga_settings['ga_gtag_enabled'] = 'yes';
		} elseif ( empty( $this->wcga_settings['ga_gtag_enabled'] ) ) {
			$this->wcga_settings['ga_gtag_enabled'] = 'no';
		}
		if ( empty( $this->wcga_settings['ga_standard_tracking_enabled'] ) ) {
			$this->wcga_settings['ga_standard_tracking_enabled'] = 'no';
		}
		if ( empty( $this->wcga_settings['ga_id'] ) ) {
			$this->wcga_settings['ga_id'] = null;
		}
	}

	/**
	 * Determine whether WooCommerce Google Analytics for WooCommerce is already
	 * injecting the gtag <script> code.
	 *
	 * @return bool True if the <script> code is present.
	 */
	public function is_adding_framework() {
		// WooCommerce Google Analytics for WooCommerce is disabled for admin users.
		$is_admin = is_admin() || current_user_can( 'manage_options' );

		return ! $is_admin && class_exists( '\WC_Google_Gtag_JS' ) && $this->is_gtag_page() && $this->has_required_settings();
	}

	/**
	 * Determine whether the current page has WooCommerce Google Analytics for WooCommerce enabled.
	 *
	 * @return bool If the page is a Analytics-enabled page.
	 */
	private function is_gtag_page(): bool {
		$standard_tracking_enabled = 'yes' === $this->wcga_settings['ga_standard_tracking_enabled'];
		$is_wc_page                = is_order_received_page() || is_woocommerce() || is_cart() || is_checkout();

		return $this->ga4w_v2 || $standard_tracking_enabled || $is_wc_page;
	}

	/**
	 * In order for WooCommerce Google Analytics for WooCommerce to include the Global Site Tag
	 * framework, it needs to be enabled in the settings and a Measurement ID must be provided.
	 *
	 * @return bool True if Global Site Tag is enabled and a Measurement ID is provided.
	 */
	private function has_required_settings() {
		return 'yes' === $this->wcga_settings['ga_gtag_enabled'] && $this->wcga_settings['ga_id'];
	}
}
Jetpack.php000064400000001273151543445740006655 0ustar00<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\GoogleListingsAndAds\Proxies;

use Automattic\Jetpack\Connection\Client;

/**
 * Class JP.
 *
 * This class provides proxy methods to wrap around Jetpack functions.
 *
 * @since 2.8.0
 *
 * @package Automattic\WooCommerce\GoogleListingsAndAds\Proxies
 */
class Jetpack {

	/**
	 * Makes an authorized remote request using Jetpack_Signature
	 *
	 * @param array $args the arguments for the remote request.
	 * @param mixed $body the body of the request.
	 *
	 * @return array|WP_Error — WP HTTP response on success
	 */
	public function remote_request( $args, $body = null ) {
		return Client::remote_request( $args, $body );
	}
}
RESTServer.php000064400000004674151543445750007251 0ustar00<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\GoogleListingsAndAds\Proxies;

use Automattic\WooCommerce\GoogleListingsAndAds\API\TransportMethods;
use WP_REST_Request as Request;
use WP_REST_Response as Response;
use WP_REST_Server as Server;

/**
 * Class RESTServer
 *
 * @package Automattic\WooCommerce\GoogleListingsAndAds\Proxies
 */
class RESTServer {

	/**
	 * The REST server instance.
	 *
	 * @var Server
	 */
	protected $server;

	/**
	 * RESTServer constructor.
	 *
	 * @param Server|null $server
	 */
	public function __construct( ?Server $server = null ) {
		$this->server = $server ?? rest_get_server();
	}

	/**
	 * Register a REST route.
	 *
	 * @param string $route_namespace The route namespace.
	 * @param string $route           The route.
	 * @param array  $args            Arguments for the route.
	 */
	public function register_route( string $route_namespace, string $route, array $args ): void {
		// Clean up namespace and route.
		$route_namespace = trim( $route_namespace, '/' );
		$route           = trim( $route, '/' );
		$full_route      = "/{$route_namespace}/{$route}";
		$this->server->register_route( $route_namespace, $full_route, $this->prepare_route_args( $args ) );
	}

	/**
	 * Get the registered REST routes.
	 *
	 * @param string $route_namespace Optionally, only return routes in the given namespace.
	 * @return array `'/path/regex' => array( $callback, $bitmask )` or
	 *               `'/path/regex' => array( array( $callback, $bitmask ), ...)`.
	 *
	 * @since 1.4.0
	 */
	public function get_routes( string $route_namespace = '' ): array {
		return $this->server->get_routes( $route_namespace );
	}

	/**
	 * Run an internal request.
	 *
	 * @param Request $request
	 *
	 * @return Response
	 */
	public function dispatch_request( Request $request ): Response {
		return $this->server->dispatch( $request );
	}

	/**
	 * Prepare the route arguments.
	 *
	 * @param array $args The route args to prepare.
	 *
	 * @return array Prepared args.
	 */
	protected function prepare_route_args( array $args ): array {
		$defaults = [
			'methods'  => TransportMethods::READABLE,
			'callback' => null,
			'args'     => [],
		];

		$common_args = $args['args'] ?? [];
		unset( $args['args'] );

		foreach ( $args as $key => &$group ) {
			if ( ! is_numeric( $key ) ) {
				continue;
			}

			$group         = array_merge( $defaults, $group );
			$group['args'] = array_merge( $common_args, $group['args'] );
		}

		return $args;
	}
}
Tracks.php000064400000001272151543445750006523 0ustar00<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\GoogleListingsAndAds\Proxies;

use WC_Tracks;

/**
 * Class Tracks
 *
 * @package Automattic\WooCommerce\GoogleListingsAndAds\Proxies
 */
class Tracks {

	/**
	 * Record a tracks event.
	 *
	 * @param string $name       The event name to record.
	 * @param array  $properties Array of properties to include with the event.
	 */
	public function record_event( string $name, array $properties = [] ): void {
		if ( class_exists( WC_Tracks::class ) ) {
			WC_Tracks::record_event( $name, $properties );
		} elseif ( function_exists( 'wc_admin_record_tracks_event' ) ) {
			wc_admin_record_tracks_event( $name, $properties );
		}
	}
}
WC.php000064400000010712151543445750005604 0ustar00<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\GoogleListingsAndAds\Proxies;

use Automattic\WooCommerce\Container;
use Automattic\WooCommerce\GoogleListingsAndAds\Exception\InvalidValue;
use WC_Countries;
use WC_Coupon;
use WC_Product;
use WC_Shipping_Zone;
use WC_Shipping_Zones;
use WP_Term;
use function WC as WCCore;

defined( 'ABSPATH' ) || exit;

/**
 * Class WC
 *
 * @package Automattic\WooCommerce\GoogleListingsAndAds\Proxies
 */
class WC {

	/**
	 * The base location for the store.
	 *
	 * @var string
	 */
	protected $base_country;

	/**
	 * @var array
	 */
	protected $countries;

	/**
	 * List of countries the WC store sells to.
	 *
	 * @var array
	 */
	protected $allowed_countries;

	/** @var WC_Countries */
	protected $wc_countries;

	/**
	 * @var array
	 */
	protected $continents;

	/**
	 * WC constructor.
	 *
	 * @param WC_Countries|null $countries
	 */
	public function __construct( ?WC_Countries $countries = null ) {
		$this->wc_countries = $countries ?? new WC_Countries();
	}

	/**
	 * Get WooCommerce countries.
	 *
	 * @return array
	 */
	public function get_countries(): array {
		if ( null === $this->countries ) {
			$this->countries = $this->wc_countries->get_countries() ?? [];
		}

		return $this->countries;
	}

	/**
	 * Get WooCommerce allowed countries.
	 *
	 * @return array
	 */
	public function get_allowed_countries(): array {
		if ( null === $this->allowed_countries ) {
			$this->allowed_countries = $this->wc_countries->get_allowed_countries() ?? [];
		}

		return $this->allowed_countries;
	}

	/**
	 * Get the base country for the store.
	 *
	 * @return string
	 */
	public function get_base_country(): string {
		if ( null === $this->base_country ) {
			$this->base_country = $this->wc_countries->get_base_country() ?? 'US';
		}

		return $this->base_country;
	}

	/**
	 * Get all continents.
	 *
	 * @return array
	 */
	public function get_continents(): array {
		if ( null === $this->continents ) {
			$this->continents = $this->wc_countries->get_continents() ?? [];
		}

		return $this->continents;
	}

	/**
	 * Get the WC_Countries object
	 *
	 * @return WC_Countries
	 */
	public function get_wc_countries(): WC_Countries {
		return $this->wc_countries;
	}

	/**
	 * Get a WooCommerce product and confirm it exists.
	 *
	 * @param int $product_id
	 *
	 * @return WC_Product
	 *
	 * @throws InvalidValue When the product does not exist.
	 */
	public function get_product( int $product_id ): WC_Product {
		$product = wc_get_product( $product_id );
		if ( ! $product instanceof WC_Product ) {
			throw InvalidValue::not_valid_product_id( $product_id );
		}

		return $product;
	}

	/**
	 * Get a WooCommerce product if it exists or return null if it doesn't
	 *
	 * @param int $product_id
	 *
	 * @return WC_Product|null
	 */
	public function maybe_get_product( int $product_id ): ?WC_Product {
		$product = wc_get_product( $product_id );
		if ( ! $product instanceof WC_Product ) {
			return null;
		}

		return $product;
	}

	/**
	 * Get a WooCommerce coupon if it exists or return null if it doesn't
	 *
	 * @param int $coupon_id
	 *
	 * @return WC_Coupon|null
	 */
	public function maybe_get_coupon( int $coupon_id ): ?WC_Coupon {
		$coupon = new WC_Coupon( $coupon_id );
		if ( $coupon->get_id() === 0 ) {
			return null;
		}
		return $coupon;
	}

	/**
	 * Get shipping zones from the database.
	 *
	 * @return array Array of arrays.
	 *
	 * @since 1.9.0
	 */
	public function get_shipping_zones(): array {
		return WC_Shipping_Zones::get_zones();
	}

	/**
	 * Get shipping zone using it's ID
	 *
	 * @param int $zone_id Zone ID.
	 *
	 * @return WC_Shipping_Zone|bool
	 *
	 * @since 1.9.0
	 */
	public function get_shipping_zone( int $zone_id ): ?WC_Shipping_Zone {
		return WC_Shipping_Zones::get_zone( $zone_id );
	}

	/**
	 * Get an array of shipping classes.
	 *
	 * @return array|WP_Term[]
	 *
	 * @since 1.10.0
	 */
	public function get_shipping_classes(): array {
		return WCCore()->shipping()->get_shipping_classes();
	}

	/**
	 * Get Base Currency Code.
	 *
	 * @return string
	 *
	 * @since 1.10.0
	 */
	public function get_woocommerce_currency(): string {
		return get_woocommerce_currency();
	}

	/**
	 * Get available payment gateways.
	 */
	public function get_available_payment_gateways(): array {
		return WCCore()->payment_gateways->get_available_payment_gateways();
	}

	/**
	 * Returns the WooCommerce object container.
	 *
	 * @return Container
	 *
	 * @since 2.3.10
	 */
	public function wc_get_container(): Container {
		return wc_get_container();
	}
}
WP.php000064400000024277151543445750005634 0ustar00<?php
declare( strict_types=1 );

namespace Automattic\WooCommerce\GoogleListingsAndAds\Proxies;

use Automattic\WooCommerce\GoogleListingsAndAds\PluginHelper;
use DateTimeZone;
use WP as WPCore;
use WP_Error;
use WP_Post;
use WP_Term;
use WP_Taxonomy;
use function dbDelta;
use function get_locale;
use function plugins_url;

/**
 * Class WP.
 *
 * This class provides proxy methods to wrap around WP functions.
 *
 * @package Automattic\WooCommerce\GoogleListingsAndAds\Proxies
 */
class WP {

	use PluginHelper;

	/** @var WPCore $wp */
	protected $wp;

	/**
	 * WP constructor.
	 */
	public function __construct() {
		global $wp;
		$this->wp =& $wp;
	}

	/**
	 * Get the plugin URL, possibly with an added path.
	 *
	 * @param string $path
	 *
	 * @return string
	 */
	public function plugins_url( string $path = '' ): string {
		return plugins_url( $path, $this->get_main_file() );
	}

	/**
	 * Retrieve values from the WP query_vars property.
	 *
	 * @param string $key           The key of the value to retrieve.
	 * @param null   $default_value The default value to return if the key isn't found.
	 *
	 * @return mixed The query value if found, or the default value.
	 */
	public function get_query_vars( string $key, $default_value = null ) {
		return $this->wp->query_vars[ $key ] ?? $default_value;
	}

	/**
	 * Get the locale of the site.
	 *
	 * @return string
	 */
	public function get_locale(): string {
		return get_locale();
	}

	/**
	 * Get the locale of the current user.
	 *
	 * @return string
	 */
	public function get_user_locale(): string {
		return get_user_locale();
	}

	/**
	 * Run the WP dbDelta() function.
	 *
	 * @param string|string[] $sql The query or queries to run.
	 *
	 * @return array Results of the query or queries.
	 */
	public function db_delta( $sql ): array {
		require_once ABSPATH . 'wp-admin/includes/upgrade.php';
		return dbDelta( $sql );
	}

	/**
	 * Retrieves the edit post link for post.
	 *
	 * @param int|WP_POST $id Post ID or post object.
	 * @param string      $context How to output the '&' character.
	 *
	 * @return string The edit post link for the given post. Null if the post type does not exist or does not allow an editing UI.
	 */
	public function get_edit_post_link( $id, string $context = 'display' ): string {
		return get_edit_post_link( $id, $context );
	}

	/**
	 * Retrieves the terms of the taxonomy that are attached to the post.
	 *
	 * @param int|WP_Post $post     Post ID or object.
	 * @param string      $taxonomy Taxonomy name.
	 *
	 * @return WP_Term[]|false|WP_Error Array of WP_Term objects on success, false if there are no terms
	 *                                  or the post does not exist, WP_Error on failure.
	 */
	public function get_the_terms( $post, string $taxonomy ) {
		return get_the_terms( $post, $taxonomy );
	}

	/**
	 * Checks whether the given variable is a WordPress Error.
	 *
	 * Returns whether `$thing` is an instance of the `WP_Error` class.
	 *
	 * @param mixed $thing The variable to check.
	 *
	 * @return bool Whether the variable is an instance of WP_Error.
	 */
	public function is_wp_error( $thing ): bool {
		return is_wp_error( $thing );
	}

	/**
	 * Retrieves the timezone from site settings as a string.
	 *
	 * Uses the `timezone_string` option to get a proper timezone if available,
	 * otherwise falls back to an offset.
	 *
	 * @return string PHP timezone string or a ±HH:MM offset.
	 *
	 * @since 1.5.0
	 */
	public function wp_timezone_string(): string {
		return wp_timezone_string();
	}

	/**
	 * Retrieves the timezone from site settings as a `DateTimeZone` object.
	 *
	 * Timezone can be based on a PHP timezone string or a ±HH:MM offset.
	 *
	 * @return DateTimeZone Timezone object.
	 *
	 * @since 1.7.0
	 */
	public function wp_timezone(): DateTimeZone {
		return wp_timezone();
	}

	/**
	 * Convert float number to format based on the locale.
	 *
	 * @param float $number   The number to convert based on locale.
	 * @param int   $decimals Optional. Precision of the number of decimal places. Default 0.
	 *
	 * @return string Converted number in string format.
	 *
	 * @since 1.7.0
	 */
	public function number_format_i18n( float $number, int $decimals = 0 ): string {
		return number_format_i18n( $number, $decimals );
	}

	/**
	 * Determines whether the current request is a WordPress Ajax request.
	 *
	 * @return bool True if it's a WordPress Ajax request, false otherwise.
	 *
	 * @since 1.10.0
	 */
	public function wp_doing_ajax(): bool {
		return wp_doing_ajax();
	}

	/**
	 * Retrieves an array of the latest posts, or posts matching the given criteria.
	 *
	 * @since 2.4.0
	 *
	 * @see WP_Query
	 * @see WP_Query::parse_query()
	 *
	 * @param array $args {
	 *     Arguments to retrieve posts. See WP_Query::parse_query() for all available arguments.
	 * }
	 * @return WP_Post[]|int[] Array of post objects or post IDs.
	 */
	public function get_posts( array $args ): array {
		return get_posts( $args );
	}

	/**
	 * Gets a list of all registered post type objects.
	 *
	 * @since 2.4.0
	 *
	 * @param array|string $args     Optional. An array of key => value arguments to match against
	 *                               the post type objects. Default empty array.
	 * @param string       $output   Optional. The type of output to return. Accepts post type 'names'
	 *                               or 'objects'. Default 'names'.
	 * @param string       $operator Optional. The logical operation to perform. 'or' means only one
	 *                               element from the array needs to match; 'and' means all elements
	 *                               must match; 'not' means no elements may match. Default 'and'.
	 * @return string[]|WP_Post_Type[] An array of post type names or objects.
	 */
	public function get_post_types( $args = [], string $output = 'names', string $operator = 'and' ): array {
		return get_post_types( $args, $output, $operator );
	}

	/**
	 * Retrieves a list of registered taxonomy names or objects.
	 *
	 * @since 2.4.0
	 *
	 * @param array  $args     Optional. An array of `key => value` arguments to match against the taxonomy objects.
	 *                         Default empty array.
	 * @param string $output   Optional. The type of output to return in the array. Accepts either taxonomy 'names'
	 *                         or 'objects'. Default 'names'.
	 * @param string $operator Optional. The logical operation to perform. Accepts 'and' or 'or'. 'or' means only
	 *                         one element from the array needs to match; 'and' means all elements must match.
	 *                         Default 'and'.
	 * @return string[]|WP_Taxonomy[] An array of taxonomy names or objects.
	 */
	public function get_taxonomies( array $args = [], string $output = 'names', string $operator = 'and' ): array {
		return get_taxonomies( $args, $output, $operator );
	}

	/**
	 * Retrieves the terms in a given taxonomy or list of taxonomies.
	 *
	 * @since 2.4.0
	 *
	 * @param array|string $args Optional. Array or string of arguments. See WP_Term_Query::__construct()
	 *                           for information on accepted arguments. Default empty array.
	 * @return WP_Term[]|int[]|string[]|string|WP_Error Array of terms, a count thereof as a numeric string,
	 *                                                  or WP_Error if any of the taxonomies do not exist.
	 *                                                  See the function description for more information.
	 */
	public function get_terms( $args = [] ) {
		return get_terms( $args );
	}

	/**
	 * Get static homepage
	 *
	 * @since 2.4.0
	 *
	 * @see https://wordpress.org/support/article/creating-a-static-front-page/
	 *
	 * @return WP_Post|null Returns the Homepage post if it is set as a static otherwise null.
	 */
	public function get_static_homepage() {
		$post_id = (int) get_option( 'page_on_front' );

		// The front page contains a static home page
		if ( $post_id > 0 ) {
			return get_post( $post_id );
		}

		return null;
	}

	/**
	 * Get Shop page
	 *
	 * @since 2.4.0
	 *
	 * @return WP_Post|null Returns the Homepage post if it is set as a static otherwise null.
	 */
	public function get_shop_page() {
		$post_id = wc_get_page_id( 'shop' );

		if ( $post_id > 0 ) {
			return get_post( $post_id );
		}

		return null;
	}

	/**
	 * If any of the currently registered image sub-sizes are missing,
	 * create them and update the image meta data.
	 *
	 * @since 2.4.0
	 *
	 * @param int $attachment_id The image attachment post ID.
	 * @return array|WP_Error The updated image meta data array or WP_Error object
	 *                        if both the image meta and the attached file are missing.
	 */
	public function wp_update_image_subsizes( int $attachment_id ) {
		// It is required as wp_update_image_subsizes is not loaded automatically.
		if ( ! function_exists( 'wp_update_image_subsizes' ) ) {
			include ABSPATH . 'wp-admin/includes/image.php';
		}

		return wp_update_image_subsizes( $attachment_id );
	}

	/**
	 * Performs an HTTP request using the GET method and returns its response.
	 *
	 * @since 2.4.0
	 *
	 * @see wp_remote_request() For more information on the response array format.
	 * @see WP_Http::request() For default arguments information.
	 *
	 * @param string $url  URL to retrieve.
	 * @param array  $args Optional. Request arguments. Default empty array.
	 * @return array|WP_Error The response or WP_Error on failure.
	 */
	public function wp_remote_get( string $url, array $args = [] ) {
		return wp_remote_get( $url, $args );
	}

	/**
	 * Adds extra code to a registered script.
	 *
	 * @param string $handle   Name of the script to add the inline script to.
	 * @param string $data     String containing the JavaScript to be added.
	 * @param string $position Whether to add the inline script before the handle or after. Default 'after'.
	 * @return boolean
	 */
	public function wp_add_inline_script( string $handle, string $data, string $position = 'after' ): bool {
		return wp_add_inline_script( $handle, $data, $position );
	}

	/**
	 * Prints an inline script tag.
	 *
	 * @param string $data       Data for script tag: JavaScript, importmap, speculationrules, etc.
	 * @param array  $attributes Key-value pairs representing <script> tag attributes. Default:array()
	 */
	public function wp_print_inline_script_tag( string $data, array $attributes = [] ) {
		return wp_print_inline_script_tag( $data, $attributes );
	}
}