| Server IP : 213.186.33.4 / Your IP : 216.73.216.222 Web Server : Apache System : Linux webm005.cluster103.gra.hosting.ovh.net 6.18.39-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Tue Jul 21 12:03:15 CEST 2026 x86_64 User : karinebmkh ( 644538) PHP Version : 8.4.22 Disable Function : _dyuweyrj4,_dyuweyrj4r,dl MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : OFF | Pkexec : OFF Directory : /home/karinebmkh/www/wp-content/plugins/divi-pixel/admin/customizer/ |
Upload File : |
<?php
namespace DiviPixel;
abstract class DIPI_Customizer_Base
{
private $customizer_api;
private $panels;
private $sections;
private $fields;
public function __construct()
{
$this->customizer_api = DIPI_Customizer_api::instance();
$this->register_settings();
}
private function register_settings(){
$this->customizer_api->add_panels($this->get_panels());
$this->customizer_api->add_sections($this->get_sections());
$this->customizer_api->add_fields($this->get_fields());
}
public function get_panels(){
if(null === $this->panels) {
$this->panels = $this->create_panels();
}
return $this->panels;
}
public function get_sections(){
if(null === $this->sections) {
$this->sections = $this->create_sections();
}
return $this->sections;
}
public function get_fields(){
if(null === $this->fields) {
$this->fields = $this->create_fields();
}
return $this->fields;
}
abstract protected function create_panels();
abstract protected function create_sections();
abstract protected function create_fields();
protected function show_if($field_id, $field_value){
return function ($control) use ($field_id, $field_value) {
return $control->manager->get_setting("dipi_customizer_option_{$field_id}")->value() == $field_value;
};
}
protected function show_if_option($options, $operator = "AND"){
return function ($control) use ($options, $operator) {
$show = $operator === "AND" ? true : false;
foreach($options as $key => $value) {
$compare_to = $value === 'off' ? '' : $value;
if(!is_array($compare_to)) {
$compare_to = [$compare_to];
}
$option = get_option('dipi_' . $key, '');
if($operator === "AND") {
$show = $show && in_array($option, $compare_to);
} else {
$show = $show || in_array($option, $compare_to);
}
}
return $show;
};
}
}
do_action("dipi_customizer_base_ready");