public function check_version()
 {
     global $pagenow;
     if ($pagenow == "admin-ajax.php" || $GLOBALS['pagenow'] == "customize" && isset($_GET['theme']) && !empty($_GET['theme'])) {
         return;
     }
     $saveVer = SeedRedux_Helpers::major_version(get_option('seedredux_version_upgraded_from'));
     $curVer = SeedRedux_Helpers::major_version(SeedReduxFramework::$_version);
     $compare = false;
     if (SeedRedux_Helpers::isLocalHost()) {
         $compare = true;
     } else {
         if (class_exists('SeedReduxFrameworkPlugin')) {
             $compare = true;
         } else {
             $seedredux = SeedReduxFrameworkInstances::get_all_instances();
             foreach ($seedredux as $panel) {
                 if ($panel->args['dev_mode'] == 1) {
                     $compare = true;
                     break;
                 }
             }
         }
     }
     if ($compare) {
         $redirect = false;
         if (empty($saveVer)) {
             $redirect = true;
             // First time
         } else {
             if (version_compare($curVer, $saveVer, '>')) {
                 $redirect = true;
                 // Previous version
             }
         }
         if ($redirect) {
             //wp_safe_redirect( admin_url( 'tools.php?page=seedredux-about' ) );
             //exit();
         }
     }
 }
 function support_args()
 {
     $this->options = get_option('seedredux-framework-tracking');
     $this->options['dev_mode'] = false;
     if (!isset($this->options['hash']) || !$this->options['hash'] || empty($this->options['hash'])) {
         $this->options['hash'] = md5(network_site_url() . '-' . $_SERVER['REMOTE_ADDR']);
         update_option('seedredux-framework-tracking', $this->options);
     }
     if (isset($_GET['seedredux_framework_disable_tracking']) && !empty($_GET['seedredux_framework_disable_tracking'])) {
         $this->options['allow_tracking'] = false;
         update_option('seedredux-framework-tracking', $this->options);
     }
     if (isset($_GET['seedredux_framework_enable_tracking']) && !empty($_GET['seedredux_framework_enable_tracking'])) {
         $this->options['allow_tracking'] = true;
         update_option('seedredux-framework-tracking', $this->options);
     }
     header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
     header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
     header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
     header('Cache-Control: no-store, no-cache, must-revalidate');
     header('Cache-Control: post-check=0, pre-check=0', false);
     header('Pragma: no-cache');
     $instances = SeedReduxFrameworkInstances::get_all_instances();
     if (isset($_REQUEST['i']) && !empty($_REQUEST['i'])) {
         if (is_array($instances) && !empty($instances)) {
             foreach ($instances as $opt_name => $data) {
                 if (md5($opt_name . '-debug') == $_REQUEST['i']) {
                     $array = $instances[$opt_name];
                 }
                 if ($data->args['dev_mode']) {
                     $this->options['dev_mode'] = $data->args['dev_mode'];
                 }
             }
         }
         if (isset($array)) {
             if (isset($array->extensions) && is_array($array->extensions) && !empty($array->extensions)) {
                 foreach ($array->extensions as $key => $extension) {
                     if (isset($extension->{$version})) {
                         $array->extensions[$key] = $extension->{$version};
                     } else {
                         $array->extensions[$key] = true;
                     }
                 }
             }
             if (isset($array->import_export)) {
                 unset($array->import_export);
             }
             if (isset($array->debug)) {
                 unset($array->debug);
             }
         } else {
             die;
         }
     } else {
         $array = SeedRedux_Helpers::trackingObject();
         if (is_array($instances) && !empty($instances)) {
             $array['instances'] = array();
             foreach ($instances as $opt_name => $data) {
                 $array['instances'][] = $opt_name;
             }
         }
         $array['key'] = md5(AUTH_KEY . SECURE_AUTH_KEY);
     }
     echo @json_encode($array, true);
     die;
 }
                </div>
                <div class="is_user">
                    <p align="left"><?php 
_e('Listed below are the Wordpress plugins and/or theme installed on your site that utilize SeedRedux Framework. We do not directly support products created with our framework.  It is the responsibility of the plugin or theme developer to support their work. You will need to contact the author(s) of the products listed below with your support questions.', 'seedredux-framework');
?>
</p>

                    <p>
                        <strong><?php 
_e('Please be sure to include for your developer - via cut and paste - the Support URL in the box below.', 'seedredux-framework');
?>
</strong>
                    </p>
                    <?php 
$seedredux = SeedReduxFrameworkInstances::get_all_instances();
if (!empty($seedredux)) {
    echo '<code style="line-height: 30px;">';
    foreach ($seedredux as $panel) {
        echo '&nbsp;' . $panel->args['display_name'] . '';
        if (!empty($panel->args['display_version'])) {
            echo ' v' . $panel->args['display_version'];
        }
        echo '&nbsp;<br />';
    }
    echo '</code><br />';
}
//
//    $t            = wp_get_theme();
//    $active_theme = array(
//        'name'       => $t->get( 'Name' ),
 public function ajax_save()
 {
     if (!wp_verify_nonce($_REQUEST['nonce'], "seedredux_ajax_nonce")) {
         json_encode(array('status' => __('Invalid security credential, please reload the page and try again.', 'seedredux-framework'), 'action' => 'reload'));
         die;
     }
     $seedredux = SeedReduxFrameworkInstances::get_instance($_POST['opt_name']);
     if (!empty($_POST['data']) && !empty($seedredux->args['opt_name'])) {
         $values = array();
         //if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
         //    $process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST);
         //    while (list($key, $val) = each($process)) {
         //        foreach ($val as $k => $v) {
         //            unset($process[$key][$k]);
         //            if (is_array($v)) {
         //                $process[$key][stripslashes($k)] = $v;
         //                $process[] = &$process[$key][stripslashes($k)];
         //            } else {
         //                $process[$key][stripslashes($k)] = stripslashes($v);
         //            }
         //        }
         //    }
         //    unset($process);
         //}
         $_POST['data'] = stripslashes($_POST['data']);
         parse_str($_POST['data'], $values);
         $values = $values[$seedredux->args['opt_name']];
         if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
             $values = array_map('stripslashes_deep', $values);
         }
         //$beforeDeep = $values;
         //// Ace editor hack for < PHP 5.4. Oy
         //if ( isset( $this->fields['ace_editor'] ) ) {
         //    if ( function_exists( 'get_magic_quotes_gpc' ) && get_magic_quotes_gpc() ) {
         //        foreach ( $this->fields['ace_editor'] as $id => $v ) {
         //            if ( version_compare( phpversion(), '5.4', '<' ) ) {
         //                $values[ $id ] = stripslashes( $beforeDeep[ $id ] );
         //            } else {
         //                $values[ $id ] = $beforeDeep[ $id ];
         //            }
         //        }
         //    }
         //}
         if (!empty($values)) {
             try {
                 if (isset($seedredux->validation_ran)) {
                     unset($seedredux->validation_ran);
                 }
                 $seedredux->set_options($seedredux->_validate_options($values));
                 if (isset($values['defaults']) && !empty($values['defaults']) || isset($values['defaults-section']) && !empty($values['defaults-section'])) {
                     echo json_encode(array('status' => 'success', 'action' => 'reload'));
                     die;
                 }
                 include_once 'core/enqueue.php';
                 $enqueue = new seedreduxCoreEnqueue($seedredux);
                 $enqueue->get_warnings_and_errors_array();
                 include_once 'core/panel.php';
                 $panel = new seedreduxCorePanel($seedredux);
                 ob_start();
                 $panel->notification_bar();
                 $notification_bar = ob_get_contents();
                 ob_end_clean();
                 $success = array('status' => 'success', 'options' => $seedredux->options, 'errors' => isset($seedredux->localize_data['errors']) ? $seedredux->localize_data['errors'] : null, 'warnings' => isset($seedredux->localize_data['warnings']) ? $seedredux->localize_data['warnings'] : null, 'notification_bar' => $notification_bar);
                 echo json_encode($success);
             } catch (Exception $e) {
                 echo json_encode(array('status' => $e->getMessage()));
             }
         } else {
             echo json_encode(array('status' => __('Your panel has no fields. Nothing to save.', 'seedredux-framework')));
         }
     }
     if (isset($this->transients['run_compiler']) && $this->transients['run_compiler']) {
         $this->no_output = true;
         $this->_enqueue_output();
         /**
          * action 'seedredux-compiler-{opt_name}'
          *
          * @deprecated
          *
          * @param array  options
          * @param string CSS that get sent to the compiler hook
          */
         do_action("seedredux-compiler-{$this->args['opt_name']}", $this->options, $this->compilerCSS, $this->transients['changed_values']);
         // REMOVE
         /**
          * action 'seedredux/options/{opt_name}/compiler'
          *
          * @param array  options
          * @param string CSS that get sent to the compiler hook
          */
         do_action("seedredux/options/{$this->args['opt_name']}/compiler", $this->options, $this->compilerCSS, $this->transients['changed_values']);
         /**
          * action 'seedredux/options/{opt_name}/compiler/advanced'
          *
          * @param array  options
          * @param string CSS that get sent to the compiler hook, which sends the full SeedRedux object
          */
         do_action("seedredux/options/{$this->args['opt_name']}/compiler/advanced", $this);
         unset($this->transients['run_compiler']);
         $this->set_transients();
     }
     die;
 }
 /**
  * Retreive all instances of SeedReduxFramework
  * as an associative array.
  *
  * @return array        format ['opt_name' => $SeedReduxFramework]
  */
 function get_all_seedredux_instances()
 {
     return SeedReduxFrameworkInstances::get_all_instances();
 }
 function support_args()
 {
     header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
     header("Last-Modified: " . gmdate("D, d M Y H:i:s") . "GMT");
     header('Expires: Sat, 26 Jul 1997 05:00:00 GMT');
     header('Cache-Control: no-store, no-cache, must-revalidate');
     header('Cache-Control: post-check=0, pre-check=0', false);
     header('Pragma: no-cache');
     $instances = SeedReduxFrameworkInstances::get_all_instances();
     if (isset($_REQUEST['i']) && !empty($_REQUEST['i'])) {
         if (is_array($instances) && !empty($instances)) {
             foreach ($instances as $opt_name => $data) {
                 if (md5($opt_name . '-debug') == $_REQUEST['i']) {
                     $array = $instances[$opt_name];
                 }
             }
         }
         if (isset($array)) {
             if (isset($array->extensions) && is_array($array->extensions) && !empty($array->extensions)) {
                 foreach ($array->extensions as $key => $extension) {
                     if (isset($extension->{$version})) {
                         $array->extensions[$key] = $extension->{$version};
                     } else {
                         $array->extensions[$key] = true;
                     }
                 }
             }
             if (isset($array->import_export)) {
                 unset($array->import_export);
             }
             if (isset($array->debug)) {
                 unset($array->debug);
             }
         } else {
             die;
         }
     } else {
         $array = $this->trackingObject();
         if (is_array($instances) && !empty($instances)) {
             $array['instances'] = array();
             foreach ($instances as $opt_name => $data) {
                 $array['instances'][] = $opt_name;
             }
         }
         $array['key'] = md5(AUTH_KEY . SECURE_AUTH_KEY);
     }
     echo @json_encode($array, true);
     die;
 }
 public static function loadSeedRedux($opt_name = "")
 {
     if (empty($opt_name)) {
         return;
     }
     $check = SeedReduxFrameworkInstances::get_instance($opt_name);
     if (isset($check->apiHasRun)) {
         return;
     }
     $args = self::constructArgs($opt_name);
     $sections = self::constructSections($opt_name);
     if (!class_exists('SeedReduxFramework')) {
         echo '<div id="message" class="error"><p>SeedRedux Framework is <strong>not installed</strong>. Please install it.</p></div>';
         return;
     }
     if (isset(self::$uses_extensions[$opt_name]) && !empty(self::$uses_extensions[$opt_name])) {
         add_action("seedredux/extensions/{$opt_name}/before", array('SeedRedux', 'loadExtensions'), 0);
     }
     $seedredux = new SeedReduxFramework($sections, $args);
     $seedredux->apiHasRun = 1;
     self::$init[$opt_name] = 1;
     if (isset($seedredux->args['opt_name']) && $seedredux->args['opt_name'] != $opt_name) {
         self::$init[$seedredux->args['opt_name']] = 1;
     }
 }
 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['seedredux_ver'] = esc_html(SeedReduxFramework::$_version);
     $sysinfo['seedredux_data_dir'] = SeedReduxFramework::$_upload_dir;
     $sysinfo['seedredux_data_writeable'] = self::makeBoolStr(@fopen(SeedReduxFramework::$_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 SeedReduxFramework::$_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' => 'SeedReduxFramework/' . SeedReduxFramework::$_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://seedreduxframework.com/wp-admin/admin-ajax.php?action=get_seedredux_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;
     }
     $seedredux = SeedReduxFrameworkInstances::get_all_instances();
     $sysinfo['seedredux_instances'] = array();
     if (!empty($seedredux) && is_array($seedredux)) {
         foreach ($seedredux as $inst => $data) {
             SeedRedux::init($inst);
             $sysinfo['seedredux_instances'][$inst]['args'] = $data->args;
             $sysinfo['seedredux_instances'][$inst]['sections'] = $data->sections;
             foreach ($sysinfo['seedredux_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['seedredux_instances'][$inst]['sections'][$sKey]['fields'][$fKey]['validate_callback']);
                         }
                         if ($field['type'] == "js_button") {
                             if (isset($field['script']) && isset($field['script']['ver'])) {
                                 unset($sysinfo['seedredux_instances'][$inst]['sections'][$sKey]['fields'][$fKey]['script']['ver']);
                             }
                         }
                     }
                 }
             }
             $sysinfo['seedredux_instances'][$inst]['extensions'] = SeedRedux::getExtensions($inst);
             if (isset($data->args['templates_path']) && $data->args['templates_path'] != '') {
                 $sysinfo['seedredux_instances'][$inst]['templates'] = self::getSeedReduxTemplates($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;
 }