Server IP : 172.67.157.199 / Your IP : 3.142.40.175 [ Web Server : Apache System : Linux b70eb322-3aee-0c53-7c82-0db91281f2c6.secureserver.net 6.1.90-1.el9.elrepo.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 2 12:09:22 EDT 2024 x86_64 User : root ( 0) PHP Version : 8.0.30.2 Disable Function : NONE Domains : 0 Domains MySQL : ON | cURL : ON | WGET : ON | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /var/www/wp-content/plugins/templately/includes/Builder/Conditions/ |
Upload File : |
<?php namespace Templately\Builder\Conditions; use Templately\Builder\ThemeBuilder; /** * Code Inspiration from Elementor */ abstract class Condition { /** * @var ThemeBuilder */ protected $builder; protected $controls = []; protected $sub_conditions = []; public function __construct( $args = [] ) { $this->builder = templately()->theme_builder; $this->register_sub_conditions(); $this->register_controls(); } protected function register_sub_conditions() { } protected function register_controls() { } public function get_priority(): int { return 100; } public function get_config(): array { $config = []; $config['label'] = $this->get_label(); $config['plural_label'] = $this->get_all_label(); $config['sub_conditions'] = $this->get_sub_conditions(); $config['type'] = $this->get_type(); $config['name'] = $this->get_name(); if ( ! empty( $this->get_controls() ) ) { $config['controls'] = $this->get_controls(); } return $config; } abstract public function get_label(): string; public function get_all_label(): string { return $this->get_label(); } public function get_sub_conditions() { return $this->sub_conditions; } abstract public function get_type(): string; abstract public function get_name(): string; private function get_controls() { return $this->controls; } public function check( $args = [] ): bool { return true; } public function add_control( $control_name, $control ) { $this->controls[ $control_name ] = $control; } /** * @param Condition $condition */ public function register_sub_condition( Condition $condition ) { $this->sub_conditions[] = $condition->get_name(); $this->builder::$conditions_manager->register_condition_instance( $condition ); } }