HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux vmi1674223.contaboserver.net 5.4.0-182-generic #202-Ubuntu SMP Fri Apr 26 12:29:36 UTC 2024 x86_64
User: root (0)
PHP: 7.4.3-4ubuntu2.22
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/html/onlineshop/wp-content/plugins/pinterest-for-woocommerce/src/Admin/Admin.php
<?php
/**
 * Class Admin
 *
 * @package Automattic\WooCommerce\Pinterest\Admin
 */

declare( strict_types=1 );

namespace Automattic\WooCommerce\Pinterest\Admin;

use Automattic\WooCommerce\Pinterest\Product\GoogleCategorySearch;
use Automattic\WooCommerce\Pinterest\View\ViewException;
use Automattic\WooCommerce\Pinterest\View\ViewFactory;

/**
 * Class Admin
 */
class Admin {

	/**
	 * View factory.
	 *
	 * @var ViewFactory
	 */
	protected $view_factory;

	/**
	 * Admin constructor.
	 *
	 * @param ViewFactory $view_factory View factory.
	 */
	public function __construct( ViewFactory $view_factory ) {
		$this->view_factory = $view_factory;
	}

	/**
	 * Register a service.
	 */
	public function register(): void {
		add_action(
			'admin_enqueue_scripts',
			function() {
				$this->enqueue_assets();
			}
		);

		( new GoogleCategorySearch() )->register();
	}

	/**
	 * Enqueues any assets.
	 */
	protected function enqueue_assets() {
		$screen = get_current_screen();

		if ( $screen && 'product' === $screen->id ) {
			wp_enqueue_style(
				'pinterest-product-attributes-css',
				Pinterest_For_Woocommerce()->plugin_url() . '/assets/build/style-product-attributes.css',
				array(),
				PINTEREST_FOR_WOOCOMMERCE_VERSION
			);
		}
	}

	/**
	 * Get the admin view.
	 *
	 * @param string $view              Name of the view.
	 * @param array  $context_variables Array of variables to pass to the view.
	 *
	 * @return string The rendered view
	 *
	 * @throws ViewException If the view doesn't exist or can't be loaded.
	 */
	public function get_view( string $view, array $context_variables = array() ): string {
		return $this->view_factory->create( $view )
							->render( $context_variables );
	}

}