????JFIF??x?x????'
| Server IP : 79.136.114.73 / Your IP : 216.73.216.181 Web Server : Apache/2.4.7 (Ubuntu) PHP/5.5.9-1ubuntu4.29 OpenSSL/1.0.1f System : Linux b8009 3.13.0-170-generic #220-Ubuntu SMP Thu May 9 12:40:49 UTC 2019 x86_64 User : www-data ( 33) PHP Version : 5.5.9-1ubuntu4.29 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/www.astacus.eu/wp-content/themes/Avada/includes/ |
Upload File : |
<?php
// Do not allow directly accessing this file.
if ( ! defined( 'ABSPATH' ) ) {
exit( 'Direct script access denied.' );
}
/**
* Gets the options from separate files and unites them.
*/
class Avada_Options {
/**
* An array of section names.
* We'll be using those to load all other files containing the options.
*
* @access public
* @var array
*/
public $section_names = array();
/**
* An array of our sections.
*
* @access public
* @var array
*/
public $sections = array();
/**
* An array of our fields.
*
* @access private
* @var array
*/
private static $fields;
/**
* The class instance.
*
* @static
* @access private
* @var null|object
*/
private static $instance = null;
/**
* The class constructor.
*
* @access public
*/
private function __construct() {
Avada::$is_updating = ( $_GET && isset( $_GET['avada_update'] ) && '1' == $_GET['avada_update'] ) ? true : false;
/**
* The array of sections by ID.
* These are used in the filenames AND the function-names.
*/
$this->section_names = array(
'layout',
'menu',
'responsive',
'colors',
'header',
'logo',
'page_title_bar',
'sliding_bar',
'footer',
'sidebars',
'background',
'typography',
'blog',
'portfolio',
'social_media',
'slideshows',
'elastic_slider',
'lightbox',
'contact',
'search_page',
'extra',
'advanced',
'bbpress',
'woocommerce',
'events_calendar',
'custom_css',
);
// Include the section files.
$this->include_files();
// Set the $sections.
$this->set_sections();
// Set the $fields.
$this->set_fields();
}
/**
* Returns a single instance of the object (singleton).
*
* @access public
* @return object
*/
public static function get_instance() {
if ( null === self::$instance ) {
self::$instance = new Avada_Options();
}
return self::$instance;
}
/**
* Include required files.
*
* @access public
*/
public function include_files() {
foreach ( $this->section_names as $section ) {
include_once Avada::$template_dir_path . '/includes/options/' . $section . '.php';
}
}
/**
* Set the sections.
*
* @access public
*/
public function set_sections() {
$sections = array();
foreach ( $this->section_names as $section ) {
$sections = call_user_func( 'avada_options_section_' . $section, $sections );
}
$this->sections = apply_filters( 'avada_options_sections', $sections );
}
/**
* Get a flat array of our fields.
* This will contain simply the field IDs and nothing more than that.
* We'll be using this to check if a setting belongs to Avada or not.
*
* @access public
* @return array
*/
public function fields_array() {
// Get the options object.
$avada_new_options = Avada::$options;
$fields = array();
// Start parsing sections.
foreach ( $avada_new_options->sections as $section ) {
// Make sure we have defined fields for this section.
// No need to proceed otherwise.
if ( ! isset( $section['fields'] ) ) {
continue;
}
// Start parsing the fields inside the section.
foreach ( $section['fields'] as $field ) {
// Make sure a field-type has been defined.
if ( ! isset( $field['type'] ) ) {
continue;
}
// For normal fields, we'll just add the field ID to our array.
if ( ! in_array( $field['type'], array( 'sub-section', 'accordion' ) ) ) {
if ( isset( $field['id'] ) ) {
$fields[] = $field['id'];
}
} else {
// For sub-sections & accordions we'll have to parse the sub-fields and add them to our array.
if ( ! isset( $field['fields'] ) ) {
continue;
}
foreach ( $field['fields'] as $sub_field ) {
if ( isset( $sub_field['id'] ) ) {
$fields[] = $sub_field['id'];
}
}
}
}
}
return $fields;
}
/**
* Sets the fields.
*
* @access public
*/
public function set_fields() {
// Start parsing the sections.
foreach ( $this->sections as $section ) {
if ( ! isset( $section['fields'] ) ) {
continue;
}
// Start parsing the fields.
foreach ( $section['fields'] as $field ) {
if ( ! isset( $field['id'] ) ) {
continue;
}
// This is a sub-section or an accordion.
if ( isset( $field['type'] ) && in_array( $field['type'], array( 'sub-section', 'accordion' ) ) ) {
// Start parsing the fields inside the sub-section/accordion.
foreach ( $field['fields'] as $sub_field ) {
if ( ! isset( $sub_field['id'] ) ) {
continue;
}
self::$fields[ $sub_field['id'] ] = $sub_field;
}
} else {
// This is not a section, continue processing.
self::$fields[ $field['id'] ] = $field;
}
}
}
}
/**
* Returns the static $fields property.
*
* @static
* @access public
* @return array
*/
public static function get_option_fields() {
return self::$fields;
}
}