HEX
Server: Apache/2.4.65 (Ubuntu)
System: Linux ielts-store-v2 6.8.0-1036-gcp #38~22.04.1-Ubuntu SMP Thu Aug 14 01:19:18 UTC 2025 x86_64
User: root (0)
PHP: 7.2.34-54+ubuntu20.04.1+deb.sury.org+1
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,
Upload Files
File: /var/www/html/ielts-store/wp-content/plugins/automatewoo/admin/controllers/settings.php
<?php
// phpcs:ignoreFile

namespace AutomateWoo\Admin\Controllers;

if ( ! defined( 'ABSPATH' ) ) exit;

/**
 * @class Settings
 */
class Settings extends Base {

	/** @var array */
	public $settings = [];


	function handle() {
		wp_localize_script( 'automatewoo-settings', 'automatewooSettingsLocalizeScript', [
			'messages' => [
				'switchToOptinWarning' => __( "WARNING: After switching to 'Opt-in mode' current customers will not be automatically opted in. Non-transactional workflows will stop sending emails and SMS until customers choose to opt-in. You can import opt-ins via AutomateWoo > Tools.", 'automatewoo' ),
			],
		] );

		wp_enqueue_script( 'automatewoo-settings' );

		$this->output_view( 'page-settings', [
			'current_tab' => $this->get_current_tab(),
			'tabs' => $this->get_settings_tabs()
		]);
	}


	function save() {

		// Save settings if data has been posted
		if ( empty( $_POST ) )
			return;

		if ( empty( $_REQUEST['_wpnonce'] ) || ! wp_verify_nonce( $_REQUEST['_wpnonce'], 'automatewoo-settings' ) ) {
			die( __( 'Action failed. Please refresh the page and retry.', 'automatewoo' ) );
		}

		$current_tab = $this->get_current_tab();
		$current_tab->save();
	}


	/**
	 * @return \AutomateWoo\Admin_Settings_Tab_Abstract|false
	 */
	function get_current_tab() {

		$current_tab_id = empty( $_GET['tab'] ) ? 'general' : sanitize_title( $_GET['tab'] );

		$tabs = $this->get_settings_tabs();

		return isset( $tabs[$current_tab_id] ) ? $tabs[$current_tab_id] : false;
	}



	/**
	 * @return array
	 */
	function get_settings_tabs() {
		if ( empty( $this->settings ) ) {
			$path = AW()->path( '/admin/settings-tabs/' );

			$settings_includes = apply_filters( 'automatewoo/settings/tabs', [
				$path . 'general.php',
				$path . 'carts.php',
				$path . 'mailchimp.php',
				$path . 'campaign-monitor.php',
				$path . 'active-campaign.php',
				$path . 'twilio.php',
				$path . 'bitly.php'
			]);

			$settings_includes[] = $path . 'status.php';

			foreach ( $settings_includes as $settings_include ) {
				if ( $class = require_once $settings_include ) {
					$this->settings[$class->id] = $class;
				}
			}
		}

		return $this->settings;
	}

}

return new Settings();