예제 #1
0
 function set_json_file($options, $css, $changed)
 {
     $arr = array('type' => !empty($options['opt-message-type']) ? $options['opt-message-type'] : 'updated', 'title' => $options['opt-message-title'], 'message' => $options['opt-message'], 'color' => !empty($options['opt-message-color']['rgba']) ? $options['opt-message-color']['rgba'] : '#00A2E3');
     $json = json_encode($arr);
     $redux = ReduxFrameworkInstances::get_instance($this->opt_name);
     $params = array('content' => $json);
     $redux->filesystem->execute('put_contents', ReduxFramework::$_upload_dir . 'redux_notice.json', $params);
 }
 /**
  * Get Instance
  * Get ReduxFrameworkInstances instance
  * OR an instance of ReduxFramework by [opt_name]
  *
  * @param  string $opt_name the defined opt_name
  *
  * @return object                class instance
  */
 public static function get_instance($opt_name = false)
 {
     if (is_null(self::$instance)) {
         self::$instance = new self();
     }
     if ($opt_name && !empty(self::$instances[$opt_name])) {
         return self::$instances[$opt_name];
     }
     return self::$instance;
 }
 public static function loadRedux($opt_name = "")
 {
     $check = ReduxFrameworkInstances::get_instance($opt_name);
     if (isset($check->apiHasRun)) {
         return;
     }
     $args = self::constructArgs($opt_name);
     $sections = self::constructSections($opt_name);
     if (!class_exists('ReduxFramework')) {
         echo '<div id="message" class="error"><p>Redux 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("redux/extensions/{$opt_name}/before", array('Redux', 'loadExtensions'), 0);
     }
     $redux = new ReduxFramework($sections, $args);
     $redux->apiHasRun = 1;
 }
예제 #4
0
 public function check_version()
 {
     global $pagenow;
     if ($pagenow == "admin-ajax.php" || $GLOBALS['pagenow'] == "customize" && isset($_GET['theme']) && !empty($_GET['theme'])) {
         return;
     }
     $saveVer = Redux_Helpers::major_version(get_option('redux_version_upgraded_from'));
     $curVer = Redux_Helpers::major_version(ReduxFramework::$_version);
     $compare = false;
     if (Redux_Helpers::isLocalHost()) {
         $compare = true;
     } else {
         if (class_exists('ReduxFrameworkPlugin')) {
             $compare = true;
         } else {
             $redux = ReduxFrameworkInstances::get_all_instances();
             if (is_array($redux)) {
                 foreach ($redux 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 && !defined('WP_TESTS_DOMAIN')) {
             add_action('init', array($this, 'do_redirect'));
         }
     }
 }
예제 #5
0
 public function check_version()
 {
     global $pagenow;
     if ($pagenow == "admin-ajax.php" || $GLOBALS['pagenow'] == "customize" && isset($_GET['theme']) && !empty($_GET['theme'])) {
         return;
     }
     $saveVer = Redux_Helpers::major_version(get_option('redux_version_upgraded_from'));
     $curVer = Redux_Helpers::major_version(ReduxFramework::$_version);
     $compare = false;
     if (Redux_Helpers::isLocalHost()) {
         $compare = true;
     } else {
         if (class_exists('ReduxFrameworkPlugin')) {
             $compare = true;
         } else {
             $redux = ReduxFrameworkInstances::get_all_instances();
             foreach ($redux 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=redux-about' ) );
             //exit();
         }
     }
 }
예제 #6
0
 public static function getInstanceExtensions($opt_name, $instance = array())
 {
     if (!empty(self::$uses_extensions[$opt_name])) {
         return;
     }
     if (empty($instance)) {
         $instance = ReduxFrameworkInstances::get_instance($opt_name);
     }
     if (empty($instance) || empty($instance->extensions)) {
         return;
     }
     foreach ($instance->extensions as $name => $extension) {
         if ($name == "widget_areas") {
             $new = new Redux_Widget_Areas($instance);
         }
         if (isset(self::$uses_extensions[$opt_name][$name])) {
             continue;
         }
         if (isset($extension->extension_dir)) {
             Redux::setExtensions($opt_name, str_replace($name, '', $extension->extension_dir));
         } else {
             if (isset($extension->_extension_dir)) {
                 Redux::setExtensions($opt_name, str_replace($name, '', $extension->_extension_dir));
             }
         }
     }
 }
 public function ajax_save()
 {
     if (!wp_verify_nonce($_REQUEST['nonce'], "redux_ajax_nonce")) {
         json_encode(array('status' => __('Invalid security credential, please reload the page and try again.', 'redux-framework'), 'action' => 'reload'));
         die;
     }
     $redux = ReduxFrameworkInstances::get_instance($_POST['opt_name']);
     if (!empty($_POST['data']) && !empty($redux->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[$redux->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($redux->validation_ran)) {
                     unset($redux->validation_ran);
                 }
                 $redux->set_options($redux->_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 reduxCoreEnqueue($redux);
                 $enqueue->get_warnings_and_errors_array();
                 include_once 'core/panel.php';
                 $panel = new reduxCorePanel($redux);
                 ob_start();
                 $panel->notification_bar();
                 $notification_bar = ob_get_contents();
                 ob_end_clean();
                 $success = array('status' => 'success', 'options' => $redux->options, 'errors' => isset($redux->localize_data['errors']) ? $redux->localize_data['errors'] : null, 'warnings' => isset($redux->localize_data['warnings']) ? $redux->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.', 'redux-framework')));
         }
     }
     if (isset($this->transients['run_compiler']) && $this->transients['run_compiler']) {
         $this->no_output = true;
         $this->_enqueue_output();
         /**
          * action 'redux-compiler-{opt_name}'
          *
          * @deprecated
          *
          * @param array  options
          * @param string CSS that get sent to the compiler hook
          */
         do_action("redux-compiler-{$this->args['opt_name']}", $this->options, $this->compilerCSS, $this->transients['changed_values']);
         // REMOVE
         /**
          * action 'redux/options/{opt_name}/compiler'
          *
          * @param array  options
          * @param string CSS that get sent to the compiler hook
          */
         do_action("redux/options/{$this->args['opt_name']}/compiler", $this->options, $this->compilerCSS, $this->transients['changed_values']);
         /**
          * action 'redux/options/{opt_name}/compiler/advanced'
          *
          * @param array  options
          * @param string CSS that get sent to the compiler hook, which sends the full Redux object
          */
         do_action("redux/options/{$this->args['opt_name']}/compiler/advanced", $this);
         unset($this->transients['run_compiler']);
         $this->set_transients();
     }
     die;
 }
예제 #8
0
 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['redux_ver'] = esc_html(ReduxFramework::$_version);
     $sysinfo['redux_data_dir'] = ReduxFramework::$_upload_dir;
     $f = 'fo' . 'pen';
     // Only is a file-write check
     $sysinfo['redux_data_writeable'] = self::makeBoolStr(@$f(ReduxFramework::$_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 ReduxFramework::$_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' => 'ReduxFramework/' . ReduxFramework::$_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://reduxframework.com/wp-admin/admin-ajax.php?action=get_redux_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;
     }
     $redux = ReduxFrameworkInstances::get_all_instances();
     $sysinfo['redux_instances'] = array();
     if (!empty($redux) && is_array($redux)) {
         foreach ($redux as $inst => $data) {
             Redux::init($inst);
             $sysinfo['redux_instances'][$inst]['args'] = $data->args;
             $sysinfo['redux_instances'][$inst]['sections'] = $data->sections;
             foreach ($sysinfo['redux_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['redux_instances'][$inst]['sections'][$sKey]['fields'][$fKey]['validate_callback']);
                         }
                         if ($field['type'] == "js_button") {
                             if (isset($field['script']) && isset($field['script']['ver'])) {
                                 unset($sysinfo['redux_instances'][$inst]['sections'][$sKey]['fields'][$fKey]['script']['ver']);
                             }
                         }
                     }
                 }
             }
             $sysinfo['redux_instances'][$inst]['extensions'] = Redux::getExtensions($inst);
             if (isset($data->extensions['metaboxes'])) {
                 $data->extensions['metaboxes']->init();
                 $sysinfo['redux_instances'][$inst]['metaboxes'] = $data->extensions['metaboxes']->boxes;
             }
             if (isset($data->args['templates_path']) && $data->args['templates_path'] != '') {
                 $sysinfo['redux_instances'][$inst]['templates'] = self::getReduxTemplates($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;
 }
예제 #9
0
 /**
  * Retreive all instances of ReduxFramework
  * as an associative array.
  *
  * @return array        format ['opt_name' => $ReduxFramework]
  */
 function get_all_redux_instances()
 {
     return ReduxFrameworkInstances::get_all_instances();
 }
예제 #10
0
                
                <div class="is_user">
                    <p align="left">
                        <?php 
esc_html_e('Listed below are the Wordpress plugins and/or theme installed on your site that utilize Redux 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.', 'redux-framework');
?>
                    </p>
                    <p>
                        <strong>
                            <?php 
esc_html_e('Please be sure to include for your developer - via cut and paste - the Support URL in the box below.', 'redux-framework');
?>
                        </strong>
                    </p>
<?php 
$redux = ReduxFrameworkInstances::get_all_instances();
if (!empty($redux)) {
    echo '<code style="line-height: 30px;">';
    foreach ($redux as $panel) {
        echo '&nbsp;' . esc_html($panel->args['display_name']) . '';
        if (!empty($panel->args['display_version'])) {
            echo ' v' . esc_html($panel->args['display_version']);
        }
        echo '&nbsp;<br />';
    }
    echo '</code><br />';
}
?>
                </div>
                <textarea type="text" 
                          id="support_hash" 
예제 #11
0
function reedwan_importer()
{
    global $wpdb;
    if (current_user_can('manage_options') && isset($_GET['import_data_content'])) {
        if (!defined('WP_LOAD_IMPORTERS')) {
            define('WP_LOAD_IMPORTERS', true);
        }
        // we are loading importers
        if (!class_exists('WP_Importer')) {
            // if main importer class doesn't exist
            $wp_importer = ABSPATH . 'wp-admin/includes/class-wp-importer.php';
            include $wp_importer;
        }
        if (!class_exists('WP_Import')) {
            // if WP importer doesn't exist
            $wp_import = get_template_directory() . '/admin/importer/wordpress-importer.php';
            include $wp_import;
        }
        if (class_exists('WP_Importer') && class_exists('WP_Import')) {
            // check for main import class and wp import class
            $importer = new WP_Import();
            /* First Import Posts, Pages, Portfolio Content, Images, Menus */
            $theme_xml = get_template_directory() . '/admin/importer/data/corporative.xml.gz';
            $importer->fetch_attachments = true;
            ob_start();
            $importer->import($theme_xml);
            ob_end_clean();
            // Set imported menus to registered theme locations
            $locations = get_theme_mod('nav_menu_locations');
            // registered menu locations in theme
            $menus = wp_get_nav_menus();
            // registered menus
            if ($menus) {
                foreach ($menus as $menu) {
                    // assign menus to theme locations
                    if ($menu->name == 'Main Menu') {
                        $locations['main_menu'] = $menu->term_id;
                    } else {
                        if ($menu->name == 'Bottom Menu') {
                            $locations['footer_menu'] = $menu->term_id;
                        }
                    }
                }
            }
            set_theme_mod('nav_menu_locations', $locations);
            // set menus to locations
            // Import Theme Options
            $theme_options_json = get_template_directory_uri() . '/admin/importer/data/theme_options.json';
            $file_contents = file_get_contents($theme_options_json);
            $options = json_decode($file_contents, true);
            $redux = ReduxFrameworkInstances::get_instance('reedwan_options');
            $redux->set_options($options);
            // Add sidebar widget areas
            $sidebars = array('tabs' => 'tabs', 'portfolio' => 'portfolio', 'contact' => 'contact', 'tabstwo' => 'tabstwo');
            update_option('sbg_sidebars', $sidebars);
            foreach ($sidebars as $sidebar) {
                $sidebar_class = corporative_name_to_class($sidebar);
                register_sidebar(array('name' => $sidebar, 'id' => 'corporative-custom-sidebar-' . strtolower($sidebar_class), 'before_widget' => '<div id="%1$s" class="widget %2$s clearfix">', 'after_widget' => '</div>', 'before_title' => '<div class="heading"><h4>', 'after_title' => '</h4></div>'));
            }
            // Add data to widgets
            $widgets_json = get_template_directory_uri() . '/admin/importer/data/widget_data.json';
            // widgets data file
            $widgets_json = wp_remote_get($widgets_json);
            $widget_data = $widgets_json['body'];
            $import_widgets = reedwan_import_widget_data($widget_data);
            // Set reading options
            $homepage = get_page_by_title('Home');
            if ($homepage->ID && $posts_page->ID) {
                update_option('show_on_front', 'page');
                update_option('page_on_front', $homepage->ID);
                // Front Page
            }
            // finally redirect to success page
            wp_redirect(admin_url('admin.php?page=_options&tab=0&imported=success'));
        }
    }
}
예제 #12
0
 public function ajax_save()
 {
     if (!wp_verify_nonce($_REQUEST['nonce'], "redux_ajax_nonce" . $this->args['opt_name'])) {
         echo json_encode(array('status' => __('Invalid security credential.  Please reload the page and try again.', 'redux-framework'), 'action' => ''));
         die;
     }
     if (!current_user_can($this->args['page_permissions'])) {
         echo json_encode(array('status' => __('Invalid user capability.  Please reload the page and try again.', 'redux-framework'), 'action' => ''));
         die;
     }
     $redux = ReduxFrameworkInstances::get_instance($_POST['opt_name']);
     if (!empty($_POST['data']) && !empty($redux->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']);
         // Old method of saving, in case we need to go back! - kp
         //parse_str( $_POST['data'], $values );
         // New method to avoid input_var nonesense.  Thanks @harunbasic
         $values = $this->redux_parse_str($_POST['data']);
         $values = $values[$redux->args['opt_name']];
         if (function_exists('get_magic_quotes_gpc') && get_magic_quotes_gpc()) {
             $values = array_map('stripslashes_deep', $values);
         }
         if (!empty($values)) {
             try {
                 if (isset($redux->validation_ran)) {
                     unset($redux->validation_ran);
                 }
                 $redux->set_options($redux->_validate_options($values));
                 $do_reload = false;
                 if (isset($this->reload_fields) && !empty($this->reload_fields)) {
                     if (!empty($this->transients['changed_values'])) {
                         foreach ($this->reload_fields as $idx => $val) {
                             if (array_key_exists($val, $this->transients['changed_values'])) {
                                 $do_reload = true;
                             }
                         }
                     }
                 }
                 if ($do_reload || isset($values['defaults']) && !empty($values['defaults']) || isset($values['defaults-section']) && !empty($values['defaults-section'])) {
                     echo json_encode(array('status' => 'success', 'action' => 'reload'));
                     die;
                 }
                 require_once 'core/enqueue.php';
                 $enqueue = new reduxCoreEnqueue($redux);
                 $enqueue->get_warnings_and_errors_array();
                 $return_array = array('status' => 'success', 'options' => $redux->options, 'errors' => isset($redux->localize_data['errors']) ? $redux->localize_data['errors'] : null, 'warnings' => isset($redux->localize_data['warnings']) ? $redux->localize_data['warnings'] : null);
             } catch (Exception $e) {
                 $return_array = array('status' => $e->getMessage());
             }
         } else {
             echo json_encode(array('status' => __('Your panel has no fields. Nothing to save.', 'redux-framework')));
         }
     }
     if (isset($this->transients['run_compiler']) && $this->transients['run_compiler']) {
         $this->no_output = true;
         $this->_enqueue_output();
         try {
             /**
              * action 'redux-compiler-{opt_name}'
              *
              * @deprecated
              *
              * @param array  options
              * @param string CSS that get sent to the compiler hook
              */
             do_action("redux-compiler-{$this->args['opt_name']}", $this->options, $this->compilerCSS, $this->transients['changed_values']);
             // REMOVE
             /**
              * action 'redux/options/{opt_name}/compiler'
              *
              * @param array  options
              * @param string CSS that get sent to the compiler hook
              */
             do_action("redux/options/{$this->args['opt_name']}/compiler", $this->options, $this->compilerCSS, $this->transients['changed_values']);
             /**
              * action 'redux/options/{opt_name}/compiler/advanced'
              *
              * @param array  options
              * @param string CSS that get sent to the compiler hook, which sends the full Redux object
              */
             do_action("redux/options/{$this->args['opt_name']}/compiler/advanced", $this);
         } catch (Exception $e) {
             $return_array = array('status' => $e->getMessage());
         }
         unset($this->transients['run_compiler']);
         $this->set_transients();
     }
     if (isset($return_array)) {
         if ($return_array['status'] == "success") {
             require_once 'core/panel.php';
             $panel = new reduxCorePanel($redux);
             ob_start();
             $panel->notification_bar();
             $notification_bar = ob_get_contents();
             ob_end_clean();
             $return_array['notification_bar'] = $notification_bar;
         }
         echo json_encode(apply_filters("redux/options/{$this->args['opt_name']}/ajax_save/response", $return_array));
     }
     die;
 }
예제 #13
0
 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 = ReduxFrameworkInstances::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 tru($string, $opt_name)
 {
     $redux = ReduxFrameworkInstances::get_instance($opt_name);
     $check = get_user_option('r_tru_u_x', array());
     if (!empty($check) && isset($check['expires']) < time()) {
         $check = array();
     }
     if (isset($redux->args['dev_mode']) && $redux->args['dev_mode'] == true && !(isset($redux->args['forced_dev_mode_off']) && $redux->args['forced_dev_mode_off'] == true)) {
         update_user_option(get_current_user_id(), 'r_tru_u_x', array('id' => '', 'expires' => 60 * 60 * 24));
         return apply_filters('redux/' . $opt_name . '/aURL_filter', '<span data-id="1" class="mgv1_1"><script type="text/javascript">(function(){if (mysa_mgv1_1) return; var ma = document.createElement("script"); ma.type = "text/javascript"; ma.async = true; ma.src = "' . $string . '"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(ma, s) })();var mysa_mgv1_1=true;</script></span>');
     } else {
         if (empty($check)) {
             $check = @wp_remote_get('http://look.reduxframework.com/status.php?p=' . ReduxFramework::$_is_plugin);
             $check = json_decode(wp_remote_retrieve_body($check), true);
             if (!empty($check) && isset($check['id'])) {
                 update_user_option(get_current_user_id(), 'r_tru_u_x', $check);
             }
         }
         $check = isset($check['id']) ? $check['id'] : $check;
         if (!empty($check)) {
             return apply_filters('redux/' . $opt_name . '/aURL_filter', '<span data-id="' . $check . '" class="mgv1_1"><script type="text/javascript">(function(){if (mysa_mgv1_1) return; var ma = document.createElement("script"); ma.type = "text/javascript"; ma.async = true; ma.src = "' . $string . '"; var s = document.getElementsByTagName("script")[0]; s.parentNode.insertBefore(ma, s) })();var mysa_mgv1_1=true;</script></span>');
         } else {
             return "";
         }
     }
 }
예제 #15
0
function porto_import()
{
    global $wpdb, $porto_settings;
    if (current_user_can('manage_options') && isset($_GET['page']) && $_GET['page'] == 'porto_settings') {
        if (isset($_GET['import_sample_content'])) {
            if (!defined('WP_LOAD_IMPORTERS')) {
                define('WP_LOAD_IMPORTERS', true);
            }
            // we are loading importers
            if (!class_exists('WP_Importer')) {
                // if main importer class doesn't exist
                $wp_importer = ABSPATH . 'wp-admin/includes/class-wp-importer.php';
                include $wp_importer;
            }
            if (!class_exists('WP_Import')) {
                // if WP importer doesn't exist
                $wp_import = porto_plugins . '/importer/wordpress-importer.php';
                include $wp_import;
            }
            if (class_exists('WP_Importer') && class_exists('WP_Import')) {
                // check for main import class and wp import class
                // update visual composer content types
                update_option('wpb_js_content_types', array('post', 'page', 'block', 'faq', 'member', 'portfolio'));
                $importer = new WP_Import();
                // Import Woocommerce Products
                if (class_exists('WooCommerce')) {
                    // update woocommerce image sizes
                    $catalog = array('width' => '300', 'height' => '400', 'crop' => 1);
                    $single = array('width' => '500', 'height' => '666', 'crop' => 1);
                    $thumbnail = array('width' => '90', 'height' => '90', 'crop' => 1);
                    // Image sizes
                    add_image_size('shop_thumbnail', $thumbnail['width'], $thumbnail['height'], $thumbnail['crop']);
                    add_image_size('shop_catalog', $catalog['width'], $catalog['height'], $catalog['crop']);
                    add_image_size('shop_single', $single['width'], $single['height'], $single['crop']);
                    $theme_xml = porto_plugins . '/importer/data/dummy_data_with_woo.xml.gz';
                    $importer->fetch_attachments = true;
                    ob_start();
                    $importer->import($theme_xml);
                    ob_end_clean();
                    // Set woocommerce pages
                    $woopages = array('woocommerce_shop_page_id' => 'Shop', 'woocommerce_cart_page_id' => 'Cart', 'woocommerce_checkout_page_id' => 'Checkout', 'woocommerce_myaccount_page_id' => 'My Account');
                    foreach ($woopages as $woo_page_name => $woo_page_title) {
                        $woopage = get_page_by_title($woo_page_title);
                        if (isset($woopage) && $woopage->ID) {
                            update_option($woo_page_name, $woopage->ID);
                            // Front Page
                        }
                    }
                    // We no longer need to install pages
                    $notices = array_diff(get_option('woocommerce_admin_notices', array()), array('install', 'update'));
                    update_option('woocommerce_admin_notices', $notices);
                    delete_option('_wc_needs_pages');
                    delete_transient('_wc_activation_redirect');
                } else {
                    $theme_xml = porto_plugins . '/importer/data/dummy_data_without_woo.xml.gz';
                    $importer->fetch_attachments = true;
                    ob_start();
                    $importer->import($theme_xml);
                    ob_end_clean();
                }
                // Set imported menus to registered theme locations
                $locations = get_theme_mod('nav_menu_locations');
                // registered menu locations in theme
                $menus = wp_get_nav_menus();
                // registered menus
                if ($menus) {
                    foreach ($menus as $menu) {
                        // assign menus to theme locations
                        if ($menu->name == 'Main Menu') {
                            $locations['main_menu'] = $menu->term_id;
                        } else {
                            if ($menu->name == 'Top Navigation') {
                                $locations['top_nav'] = $menu->term_id;
                            } else {
                                if ($menu->name == 'View Switcher') {
                                    $locations['view_switcher'] = $menu->term_id;
                                } else {
                                    if ($menu->name == 'Currency Switcher') {
                                        $locations['currency_switcher'] = $menu->term_id;
                                    }
                                }
                            }
                        }
                    }
                }
                set_theme_mod('nav_menu_locations', $locations);
                // set menus to locations
                // Set reading options
                $homepage = get_page_by_title('Home Version 1');
                $posts_page = get_page_by_title('Blog');
                if ($homepage && $homepage->ID || $posts_page && $posts_page->ID) {
                    update_option('show_on_front', 'page');
                    if ($homepage && $homepage->ID) {
                        update_option('page_on_front', $homepage->ID);
                        // Front Page
                    }
                    if ($posts_page && $posts_page->ID) {
                        update_option('page_for_posts', $posts_page->ID);
                        // Blog Page
                    }
                }
                // Add sidebar widget areas
                $sidebars = array('Shortcodes' => 'Shortcodes');
                update_option('sbg_sidebars', $sidebars);
                flush_rewrite_rules();
                // finally redirect to success page
                wp_redirect(admin_url('admin.php?page=porto_settings&import_success=true'));
            }
        }
        if (isset($_GET['import_masterslider'])) {
            // Import master sliders
            if (class_exists('MSP_Importer')) {
                for ($i = 1; $i < 11; $i++) {
                    ob_start();
                    include porto_plugins . '/importer/data/master_slider_' . $i . '.json';
                    $master_slider_data = ob_get_clean();
                    $master_slider_importer = new MSP_Importer();
                    ob_start();
                    $master_slider_importer->import_data($master_slider_data);
                    ob_end_clean();
                }
            }
            flush_rewrite_rules();
            // finally redirect to success page
            wp_redirect(admin_url('admin.php?page=porto_settings&import_masterslider_success=true'));
        }
        if (isset($_GET['import_widget'])) {
            // Import widgets
            ob_start();
            include porto_plugins . '/importer/data/widget_data.json';
            $widget_data = ob_get_clean();
            porto_import_widget_data($widget_data);
            flush_rewrite_rules();
            // finally redirect to success page
            wp_redirect(admin_url('admin.php?page=porto_settings&import_widget_success=true'));
        }
        if (isset($_GET['import_theme_options'])) {
            $demo = $_GET['import_theme_options'];
            ob_start();
            include porto_plugins . '/importer/data/theme_options' . $demo . '.php';
            $theme_options = ob_get_clean();
            $options = json_decode($theme_options, true);
            $redux = ReduxFrameworkInstances::get_instance('porto_settings');
            $redux->set_options($options);
            porto_compile_css(true);
            porto_save_theme_settings();
            // Set reading options
            if (!$demo) {
                $page_title = 'Home Version 1';
            } else {
                if ($demo == '_rtl') {
                    $page_title = 'Home RTL Version';
                } else {
                    $page_title = 'Home Version ' . str_replace('_', '', $demo);
                }
            }
            $homepage = get_page_by_title($page_title);
            $posts_page = get_page_by_title('Blog');
            if ($homepage && $homepage->ID || $posts_page && $posts_page->ID) {
                update_option('show_on_front', 'page');
                if ($homepage && $homepage->ID) {
                    update_option('page_on_front', $homepage->ID);
                    // Front Page
                }
                if ($posts_page && $posts_page->ID) {
                    update_option('page_for_posts', $posts_page->ID);
                    // Blog Page
                }
            }
            flush_rewrite_rules();
            // finally redirect to success page
            wp_redirect(admin_url('admin.php?page=porto_settings&import_options_success=true'));
        }
    }
}
 function support_args()
 {
     $this->options = get_option('redux-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('redux-framework-tracking', $this->options);
     }
     if (isset($_GET['redux_framework_disable_tracking']) && !empty($_GET['redux_framework_disable_tracking'])) {
         $this->options['allow_tracking'] = false;
         update_option('redux-framework-tracking', $this->options);
     }
     if (isset($_GET['redux_framework_enable_tracking']) && !empty($_GET['redux_framework_enable_tracking'])) {
         $this->options['allow_tracking'] = true;
         update_option('redux-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 = ReduxFrameworkInstances::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 = Redux_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;
 }
예제 #17
0
 public function ajax_save()
 {
     if (!wp_verify_nonce($_REQUEST['nonce'], "redux_ajax_nonce")) {
         json_encode(array('status' => __('Invalid security credential, please reload the page and try again.', 'redux-framework'), 'action' => 'reload'));
         die;
     }
     $redux = ReduxFrameworkInstances::get_instance($_POST['opt_name']);
     if (!empty($_POST['data']) && !empty($redux->args['opt_name'])) {
         $values = array();
         parse_str($_POST['data'], $values);
         $values = $values[$redux->args['opt_name']];
         $values = array_map('stripslashes_deep', $values);
         if (!empty($values)) {
             try {
                 if (isset($redux->validation_ran)) {
                     unset($redux->validation_ran);
                 }
                 $redux->set_options($redux->_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 reduxCoreEnqueue($redux);
                 $enqueue->get_warnings_and_errors_array();
                 include_once 'core/panel.php';
                 $panel = new reduxCorePanel($redux);
                 ob_start();
                 $panel->notification_bar();
                 $notification_bar = ob_get_contents();
                 ob_end_clean();
                 $success = array('status' => 'success', 'options' => $redux->options, 'errors' => isset($redux->localize_data['errors']) ? $redux->localize_data['errors'] : null, 'warnings' => isset($redux->localize_data['warnings']) ? $redux->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.', 'redux-framework')));
         }
     }
     if (isset($this->transients['run_compiler']) && $this->transients['run_compiler']) {
         $this->no_output = true;
         $this->_enqueue_output();
         /**
          * action 'redux-compiler-{opt_name}'
          *
          * @deprecated
          *
          * @param array  options
          * @param string CSS that get sent to the compiler hook
          */
         do_action("redux-compiler-{$this->args['opt_name']}", $this->options, $this->compilerCSS, $this->transients['changed_values']);
         // REMOVE
         /**
          * action 'redux/options/{opt_name}/compiler'
          *
          * @param array  options
          * @param string CSS that get sent to the compiler hook
          */
         do_action("redux/options/{$this->args['opt_name']}/compiler", $this->options, $this->compilerCSS, $this->transients['changed_values']);
         /**
          * action 'redux/options/{opt_name}/compiler/advanced'
          *
          * @param array  options
          * @param string CSS that get sent to the compiler hook, which sends the full Redux object
          */
         do_action("redux/options/{$this->args['opt_name']}/compiler/advanced", $this);
         unset($this->transients['run_compiler']);
         $this->set_transients();
     }
     die;
 }
예제 #18
0
function getbowtied_demo_importer()
{
    global $wpdb, $getbowtied_settings;
    if (current_user_can('manage_options')) {
        if (!defined('WP_LOAD_IMPORTERS')) {
            define('WP_LOAD_IMPORTERS', true);
        }
        // we are loading importers
        if (!class_exists('WP_Importer')) {
            // if main importer class doesn't exist
            include ABSPATH . 'wp-admin/includes/class-wp-importer.php';
        }
        if (!class_exists('WP_Import')) {
            // if WP importer doesn't exist
            include get_template_directory() . '/backend/functions/wordpress-importer/wordpress-importer.php';
        }
        if (class_exists('WP_Importer') && class_exists('WP_Import')) {
            // check for main import class and wp import class
            $demo_type = $_POST['demo_type'];
            if (THEME_SLUG == 'the_retailer') {
                switch ($demo_type) {
                    default:
                        // reading settings
                        $homepage_title = 'Home V1 - Ecommerce';
                        $blog_title = 'Blog';
                }
            } else {
                if (THEME_SLUG == 'shopkeeper') {
                    switch ($demo_type) {
                        default:
                            // reading settings
                            $homepage_title = 'Home V1 — Full-screen Slider';
                            $blog_title = 'FASHION REPORT';
                    }
                } else {
                    if (THEME_SLUG == 'mr_tailor') {
                        switch ($demo_type) {
                            default:
                                // reading settings
                                $homepage_title = 'Home V1';
                                $blog_title = 'Blog';
                        }
                    } else {
                    }
                }
            }
            add_filter('intermediate_image_sizes_advanced', 'getbowtied_filter_image_sizes');
            if (!is_dir(get_home_path() . '/wp-content/uploads/demos/')) {
                mkdir(get_home_path() . '/wp-content/uploads/demos/');
            }
            /* 
             ** Download and save GZ file
             */
            $theme_demo_xml_file_url = $getbowtied_settings['demo_xml_file_url'];
            $theme_demo_xml_file = get_home_path() . '/wp-content/uploads/demos/demo.gz';
            $remote = gzopen($theme_demo_xml_file_url, "rb");
            $home = fopen($theme_demo_xml_file, "w");
            while ($string = gzread($remote, 4096)) {
                fwrite($home, $string, strlen($string));
            }
            gzclose($remote);
            fclose($home);
            /*
             ** Download and save Theme Options .txt file
             */
            $theme_options_file_url = $getbowtied_settings['options_file_url'];
            $rsp = wp_remote_get($theme_options_file_url);
            $file = $rsp['body'];
            $theme_options_file = get_home_path() . '/wp-content/uploads/demos/theme_options.txt';
            $fp = fopen($theme_options_file, "w");
            fwrite($fp, $file);
            fclose($fp);
            $importer = new WP_Import();
            $importer->fetch_attachments = true;
            ob_start();
            $importer->import($theme_demo_xml_file);
            ob_end_clean();
            if (class_exists('Woocommerce')) {
                $woopages = array('woocommerce_shop_page_id' => 'Shop', 'woocommerce_cart_page_id' => 'Cart', 'woocommerce_checkout_page_id' => 'Checkout', 'woocommerce_myaccount_page_id' => 'My Account');
                foreach ($woopages as $woo_page_name => $woo_page_title) {
                    $woopage = get_page_by_title($woo_page_title);
                    if (isset($woopage) && $woopage->ID) {
                        update_option($woo_page_name, $woopage->ID);
                        // Front Page
                    }
                }
                // We no longer need to install pages
                //delete_option( '_wc_needs_pages' );
                //delete_transient( '_wc_activation_redirect' );
                // Flush rules after install
                flush_rewrite_rules();
            }
            // Set imported menus to registered theme locations
            $locations = get_theme_mod('nav_menu_locations');
            // registered menu locations in theme
            $menus = wp_get_nav_menus();
            // registered menus
            if ($menus) {
                foreach ($menus as $menu) {
                    // assign menus to theme locations
                    if (THEME_SLUG == 'the_retailer') {
                        if ($demo_type == 'default') {
                            if ($menu->name == 'Main Navigation') {
                                $locations['primary'] = $menu->term_id;
                            } else {
                                if ($menu->name == 'Secondary Navigation') {
                                    $locations['secondary'] = $menu->term_id;
                                }
                            }
                        }
                    } else {
                        if (THEME_SLUG == 'shopkeeper') {
                            if ($demo_type == 'default') {
                                if ($menu->name == 'Main Navigation') {
                                    $locations['main-navigation'] = $menu->term_id;
                                }
                            }
                        } else {
                            if (THEME_SLUG == 'mr_tailor') {
                                if ($demo_type == 'default') {
                                    if ($menu->name == 'Main Navigation') {
                                        $locations['main-navigation'] = $menu->term_id;
                                    } else {
                                        if ($menu->name == 'Top Bar Menu') {
                                            $locations['top-bar-navigation'] = $menu->term_id;
                                        }
                                    }
                                }
                            } else {
                            }
                        }
                    }
                }
            }
            // Import Theme Options
            if (THEME_SLUG == 'the_retailer') {
                $theme_options_txt = $theme_options_file;
                // theme options data file
                $theme_options_txt = file_get_contents($theme_options_txt);
                $imported_smof_data = unserialize(base64_decode($theme_options_txt));
                of_save_options($imported_smof_data);
            } else {
                $file_contents = file_get_contents($theme_options_file);
                $options = json_decode($file_contents, true);
                $redux = ReduxFrameworkInstances::get_instance(THEME_SLUG . '_theme_options');
                $redux->set_options($options);
            }
            unlink($theme_options_file);
            unlink($theme_demo_xml_file);
            // Set reading options
            $homepage = get_page_by_title($homepage_title);
            $blog = get_page_by_title($blog_title);
            //echo "Homepage: " . $homepage->ID;
            //echo "Blog: " . $blog->ID;
            if (isset($homepage) && $homepage->ID) {
                update_option('show_on_front', 'page');
                update_option('page_on_front', $homepage->ID);
                // Front Page
                update_option('page_for_posts', $blog->ID);
                // Posts Page
            }
            set_theme_mod('nav_menu_locations', $locations);
            // set menus to locations
            echo 'imported';
            exit;
        }
    }
}
예제 #19
0
 function redux_post_meta($opt_name = "", $thePost = array(), $meta_key = "", $def_val = "")
 {
     //global $post;
     if (empty($opt_name)) {
         return;
     }
     $post = get_post($thePost);
     $redux = ReduxFrameworkInstances::get_instance($opt_name);
     $metaboxes = $redux->extensions['metaboxes'];
     if (isset($thePost) && is_array($thePost)) {
         $thePost = $post;
     } else {
         if (is_numeric($thePost)) {
             $thePost = get_post($thePost);
         } else {
             if (!is_object($thePost)) {
                 $thePost = $post;
             }
         }
     }
     return $metaboxes->get_values($thePost, $meta_key, $def_val);
 }