HEX
Server: Apache/2.4.41 (Ubuntu)
System: Linux wordpress-ubuntu-s-2vcpu-4gb-fra1-01 5.4.0-169-generic #187-Ubuntu SMP Thu Nov 23 14:52:28 UTC 2023 x86_64
User: root (0)
PHP: 7.4.33
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/zaklada/wp-content/plugins/sitepress-multilingual-cms/classes/wizard/class-wpml-wizard.php
<?php

abstract class WPML_Wizard extends WPML_Twig_Template_Loader {

	const TEMPLATE_PATH = '/templates/wizard';
	const NONCE         = 'wpml_wizard_fetch_content';

	/** @var array $model */
	private $model = array();

	public function __construct() {
		parent::__construct( array( WPML_PLUGIN_PATH . self::TEMPLATE_PATH ) );
	}

	abstract protected function initialize_steps();
	abstract protected function enqueue_scripts();

	public function render() {
		$this->initialize_steps();
		$this->initialize_strings();
		$this->set_nonce();

		$this->enqueue_main_script();
		$this->enqueue_scripts();

		return $this->get_template()->show( $this->model, 'wizard.twig' );
	}

	/**
	 * @param string $slug
	 * @param string $title
	 */
	protected function add_step( $slug, $title ) {
		$this->model['steps'][] = array(
			'slug'  => $slug,
			'title' => $title,
		);
	}

	/**
	 * @param string $current_step_slug
	 */
	protected function set_current_step( $current_step_slug ) {
		$allowed_step_slugs = wp_list_pluck( $this->model['steps'], 'slug' );

		if ( ! in_array( $current_step_slug, $allowed_step_slugs, true ) ) {
			$current_step_slug = reset( $allowed_step_slugs );
		}

		$this->model['current_step_slug'] = $current_step_slug;
	}

	protected function initialize_strings() {
		$this->model['strings'] = array(
			'back'     => __( '<<< Back', 'sitepress' ),
			'next'     => __( 'Next >>>', 'sitepress' ),
			'finished' => __( 'Finished', 'sitepress' ),
		);
	}

	private function set_nonce() {
		$this->model['nonce'] = wp_create_nonce( self::NONCE );
	}

	private function enqueue_main_script() {
		wp_register_script( 'wpml-wizard', ICL_PLUGIN_URL . '/res/js/wizard.js', array( 'jquery' ), ICL_SITEPRESS_VERSION, true );
		wp_enqueue_script( 'wpml-wizard' );

		wp_register_style( 'wpml-wizard', ICL_PLUGIN_URL . '/res/css/wpml-wizard.css' );
		wp_enqueue_style( 'wpml-wizard' );
	}
}