public function __construct()
 {
     // An array of all the custom fields we have.
     $this->field_types = array('typography', 'color_alpha', 'spacing', 'dimensions');
     // An array of all our extensions
     $this->extensions = array('search', 'repeater', 'accordion', 'vendorsupport');
     $this->path = dirname(__FILE__);
     foreach ($this->field_types as $field_type) {
         add_action('avadaredux/' . Avada::get_option_name() . '/field/class/' . $field_type, array($this, 'register_' . $field_type));
     }
     foreach ($this->extensions as $extension) {
         if (class_exists('AvadaRedux')) {
             AvadaRedux::setExtensions(Avada::get_option_name(), $this->path . '/extensions/' . $extension . '/extension_' . $extension . '.php');
         }
     }
 }
 /**
  * Create the AvadaRedux Config.
  */
 public function add_config()
 {
     $args = array('opt_name' => $this->key, 'display_name' => 'Avada', 'display_version' => $this->ver, 'allow_sub_menu' => true, 'menu_title' => __('Theme Options', 'Avada'), 'page_title' => __('Theme Options', 'Avada'), 'async_typography' => true, 'admin_bar' => false, 'admin_bar_icon' => 'dashicons-portfolio', 'admin_bar_priority' => 50, 'global_variable' => 'avada_avadaredux_options', 'update_notice' => true, 'page_parent' => 'themes.php', 'page_slug' => 'avada_options', 'menu_type' => 'submenu', 'page_permissions' => 'manage_options', 'dev_mode' => false, 'customizer' => false, 'default_show' => false, 'templates_path' => dirname(__FILE__) . '/panel_templates/', 'show_options_object' => false, 'forced_dev_mode_off' => true);
     if (class_exists('AvadaRedux')) {
         AvadaRedux::setArgs($this->key, $args);
     }
 }
 public static function compileSystemStatus($json_output = false, $remote_checks = false)
 {
     global $wpdb;
     $sysinfo = array();
     $sysinfo['home_url'] = home_url();
     $sysinfo['site_url'] = site_url();
     $sysinfo['avadaredux_ver'] = esc_html(AvadaReduxFramework::$_version);
     $sysinfo['avadaredux_data_dir'] = AvadaReduxFramework::$_upload_dir;
     $f = 'fo' . 'pen';
     // Only is a file-write check
     $sysinfo['avadaredux_data_writeable'] = self::makeBoolStr(@$f(AvadaReduxFramework::$_upload_dir . 'test-log.log', 'a'));
     $sysinfo['wp_content_url'] = WP_CONTENT_URL;
     $sysinfo['wp_ver'] = get_bloginfo('version');
     $sysinfo['wp_multisite'] = is_multisite();
     $sysinfo['permalink_structure'] = get_option('permalink_structure') ? get_option('permalink_structure') : 'Default';
     $sysinfo['front_page_display'] = get_option('show_on_front');
     if ($sysinfo['front_page_display'] == 'page') {
         $front_page_id = get_option('page_on_front');
         $blog_page_id = get_option('page_for_posts');
         $sysinfo['front_page'] = $front_page_id != 0 ? get_the_title($front_page_id) . ' (#' . $front_page_id . ')' : 'Unset';
         $sysinfo['posts_page'] = $blog_page_id != 0 ? get_the_title($blog_page_id) . ' (#' . $blog_page_id . ')' : 'Unset';
     }
     $sysinfo['wp_mem_limit']['raw'] = self::let_to_num(WP_MEMORY_LIMIT);
     $sysinfo['wp_mem_limit']['size'] = size_format($sysinfo['wp_mem_limit']['raw']);
     $sysinfo['db_table_prefix'] = 'Length: ' . strlen($wpdb->prefix) . ' - Status: ' . (strlen($wpdb->prefix) > 16 ? 'ERROR: Too long' : 'Acceptable');
     $sysinfo['wp_debug'] = 'false';
     if (defined('WP_DEBUG') && WP_DEBUG) {
         $sysinfo['wp_debug'] = 'true';
     }
     $sysinfo['wp_lang'] = get_locale();
     if (!class_exists('Browser')) {
         require_once AvadaReduxFramework::$_dir . 'inc/browser.php';
     }
     $browser = new Browser();
     $sysinfo['browser'] = array('agent' => $browser->getUserAgent(), 'browser' => $browser->getBrowser(), 'version' => $browser->getVersion(), 'platform' => $browser->getPlatform());
     $sysinfo['server_info'] = esc_html($_SERVER['SERVER_SOFTWARE']);
     $sysinfo['localhost'] = self::makeBoolStr(self::isLocalHost());
     $sysinfo['php_ver'] = function_exists('phpversion') ? esc_html(phpversion()) : 'phpversion() function does not exist.';
     $sysinfo['abspath'] = ABSPATH;
     if (function_exists('ini_get')) {
         $sysinfo['php_mem_limit'] = size_format(self::let_to_num(ini_get('memory_limit')));
         $sysinfo['php_post_max_size'] = size_format(self::let_to_num(ini_get('post_max_size')));
         $sysinfo['php_time_limit'] = ini_get('max_execution_time');
         $sysinfo['php_max_input_var'] = ini_get('max_input_vars');
         $sysinfo['php_display_errors'] = self::makeBoolStr(ini_get('display_errors'));
     }
     $sysinfo['suhosin_installed'] = extension_loaded('suhosin');
     $sysinfo['mysql_ver'] = $wpdb->db_version();
     $sysinfo['max_upload_size'] = size_format(wp_max_upload_size());
     $sysinfo['def_tz_is_utc'] = 'true';
     if (date_default_timezone_get() !== 'UTC') {
         $sysinfo['def_tz_is_utc'] = 'false';
     }
     $sysinfo['fsockopen_curl'] = 'false';
     if (function_exists('fsockopen') || function_exists('curl_init')) {
         $sysinfo['fsockopen_curl'] = 'true';
     }
     //$sysinfo['soap_client'] = 'false';
     //if ( class_exists( 'SoapClient' ) ) {
     //    $sysinfo['soap_client'] = 'true';
     //}
     //
     //$sysinfo['dom_document'] = 'false';
     //if ( class_exists( 'DOMDocument' ) ) {
     //    $sysinfo['dom_document'] = 'true';
     //}
     //$sysinfo['gzip'] = 'false';
     //if ( is_callable( 'gzopen' ) ) {
     //    $sysinfo['gzip'] = 'true';
     //}
     if ($remote_checks == true) {
         $response = wp_remote_post('https://www.paypal.com/cgi-bin/webscr', array('sslverify' => false, 'timeout' => 60, 'user-agent' => 'AvadaReduxFramework/' . AvadaReduxFramework::$_version, 'body' => array('cmd' => '_notify-validate')));
         if (!is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) {
             $sysinfo['wp_remote_post'] = 'true';
             $sysinfo['wp_remote_post_error'] = '';
         } else {
             $sysinfo['wp_remote_post'] = 'false';
             $sysinfo['wp_remote_post_error'] = $response->get_error_message();
         }
         $response = @wp_remote_get('http://avadareduxframework.com/wp-admin/admin-ajax.php?action=get_avadaredux_extensions');
         if (!is_wp_error($response) && $response['response']['code'] >= 200 && $response['response']['code'] < 300) {
             $sysinfo['wp_remote_get'] = 'true';
             $sysinfo['wp_remote_get_error'] = '';
         } else {
             $sysinfo['wp_remote_get'] = 'false';
             $sysinfo['wp_remote_get_error'] = $response->get_error_message();
         }
     }
     $active_plugins = (array) get_option('active_plugins', array());
     if (is_multisite()) {
         $active_plugins = array_merge($active_plugins, get_site_option('active_sitewide_plugins', array()));
     }
     $sysinfo['plugins'] = array();
     foreach ($active_plugins as $plugin) {
         $plugin_data = @get_plugin_data(WP_PLUGIN_DIR . '/' . $plugin);
         $plugin_name = esc_html($plugin_data['Name']);
         $sysinfo['plugins'][$plugin_name] = $plugin_data;
     }
     $avadaredux = AvadaReduxFrameworkInstances::get_all_instances();
     $sysinfo['avadaredux_instances'] = array();
     if (!empty($avadaredux) && is_array($avadaredux)) {
         foreach ($avadaredux as $inst => $data) {
             AvadaRedux::init($inst);
             $sysinfo['avadaredux_instances'][$inst]['args'] = $data->args;
             $sysinfo['avadaredux_instances'][$inst]['sections'] = $data->sections;
             foreach ($sysinfo['avadaredux_instances'][$inst]['sections'] as $sKey => $section) {
                 if (isset($section['fields']) && is_array($section['fields'])) {
                     foreach ($section['fields'] as $fKey => $field) {
                         if (isset($field['validate_callback'])) {
                             unset($sysinfo['avadaredux_instances'][$inst]['sections'][$sKey]['fields'][$fKey]['validate_callback']);
                         }
                         if ($field['type'] == "js_button") {
                             if (isset($field['script']) && isset($field['script']['ver'])) {
                                 unset($sysinfo['avadaredux_instances'][$inst]['sections'][$sKey]['fields'][$fKey]['script']['ver']);
                             }
                         }
                     }
                 }
             }
             $sysinfo['avadaredux_instances'][$inst]['extensions'] = AvadaRedux::getExtensions($inst);
             if (isset($data->extensions['metaboxes'])) {
                 $data->extensions['metaboxes']->init();
                 $sysinfo['avadaredux_instances'][$inst]['metaboxes'] = $data->extensions['metaboxes']->boxes;
             }
             if (isset($data->args['templates_path']) && $data->args['templates_path'] != '') {
                 $sysinfo['avadaredux_instances'][$inst]['templates'] = self::getAvadaReduxTemplates($data->args['templates_path']);
             }
         }
     }
     $active_theme = wp_get_theme();
     $sysinfo['theme']['name'] = $active_theme->Name;
     $sysinfo['theme']['version'] = $active_theme->Version;
     $sysinfo['theme']['author_uri'] = $active_theme->{'Author URI'};
     $sysinfo['theme']['is_child'] = self::makeBoolStr(is_child_theme());
     if (is_child_theme()) {
         $parent_theme = wp_get_theme($active_theme->Template);
         $sysinfo['theme']['parent_name'] = $parent_theme->Name;
         $sysinfo['theme']['parent_version'] = $parent_theme->Version;
         $sysinfo['theme']['parent_author_uri'] = $parent_theme->{'Author URI'};
     }
     //if ( $json_output ) {
     //    $sysinfo = json_encode( $sysinfo );
     //}
     //print_r($sysinfo);
     //exit();
     return $sysinfo;
 }
 public static function getExtensions($opt_name = "", $key = "")
 {
     if (empty($opt_name)) {
         AvadaRedux::getAllExtensions();
         if (empty($key)) {
             return self::$extension_paths;
         } else {
             if (isset(self::$extension_paths[$key])) {
                 return self::$extension_paths[$key];
             }
         }
     } else {
         if (empty(self::$uses_extensions[$opt_name])) {
             AvadaRedux::getInstanceExtensions($opt_name);
         }
         if (empty(self::$uses_extensions[$opt_name])) {
             return false;
         }
         $instanceExtensions = array();
         foreach (self::$uses_extensions[$opt_name] as $extension) {
             $class_file = end(self::$extensions[$extension]);
             $name = str_replace('.php', '', basename($extension));
             $extension_class = 'AvadaReduxFramework_Extension_' . $name;
             $instanceExtensions[$extension] = array('path' => $class_file, 'class' => $extension_class, 'version' => AvadaRedux_Helpers::get_template_version($class_file));
         }
         return $instanceExtensions;
     }
     return false;
 }