示例#1
0
 function generate_theme()
 {
     require_once XF_ADMIN_DIR . '/xtreme-basemod-css.php';
     require_once XF_ADMIN_DIR . '/xtreme-patch-css.php';
     require_once XF_ADMIN_DIR . '/xtreme-production-css.php';
     require_once XF_ADMIN_DIR . '/xtreme-editor-css.php';
     $old_error_handler = set_error_handler(array(&$this, "on_writing_error"));
     $basemod = new Xtreme_Basemod_CSS();
     $basemod->write();
     $patch = new Xtreme_Patch_CSS();
     $patch->write();
     $production = new Xtreme_Production_CSS();
     $production->write();
     $editor = new Xtreme_Editor_Style();
     $editor->write();
     if ($old_error_handler) {
         set_error_handler($old_error_handler);
     }
     delete_option(XF_UPDATE_PENDING);
     delete_option(XF_UPDATE_ERRORS);
 }
示例#2
0
 function generate_theme()
 {
     require_once XF_ADMIN_DIR . '/xtreme-basemod-css.php';
     require_once XF_ADMIN_DIR . '/xtreme-patch-css.php';
     require_once XF_ADMIN_DIR . '/xtreme-production-css.php';
     $old_error_handler = set_error_handler(array(&$this, "on_writing_error"));
     $basemod = new Xtreme_Basemod_CSS();
     $basemod->write();
     $patch = new Xtreme_Patch_CSS();
     $patch->write();
     $production = new Xtreme_Production_CSS();
     $production->write();
     if ($old_error_handler) {
         set_error_handler($old_error_handler);
     }
 }
示例#3
0
 function on_save_backup()
 {
     if (!current_user_can('manage_options')) {
         wp_die(__('Cheatin’ uh?', XF_TEXTDOMAIN));
     }
     check_admin_referer('xtreme_backend_settings');
     $redirect = $_POST['_wp_http_referer'];
     if (isset($_POST['xtreme_export'])) {
         require_once XF_ADMIN_DIR . '/includes/xtreme-xmlprocessor.php';
         $xml = new xtreme_xml_processor();
         $xml->backup_as_xml(XF_VERSION, get_option(XF_OPTIONS), get_option(XF_LAYOUTS), get_option(XF_TEMPLATES), get_option(XF_WIDGET_PERMISSIONS), is_multisite() ? get_blog_option(XF_SITE_ID, XF_WIDGET_BURNING_REG, array()) : get_option(XF_WIDGET_BURNING_REG, array()), get_option('sidebars_widgets'), $this->_collect_widgets());
     }
     //should we import an existing file ?
     if (isset($_POST['xtreme_import'])) {
         if (!current_user_can('upload_files')) {
             wp_die(__('Cheatin’ uh?', XF_TEXTDOMAIN));
         }
         if (isset($_FILES) == true && empty($_FILES) == false) {
             if (!$_FILES['xml_file']['error'] && $_FILES['xml_file']['size'] > 0) {
                 require_once XF_ADMIN_DIR . '/includes/xtreme-xmlprocessor.php';
                 $xml = new xtreme_xml_processor();
                 $saved_options = $xml->restore_from_xml(XF_VERSION, $_FILES['xml_file']['tmp_name']);
                 @unlink($_FILES['xml_file']['tmp_name']);
                 if (!is_array($saved_options)) {
                     wp_redirect(admin_url('admin.php?page=xtreme_backup&error=' . $saved_options));
                     exit;
                 }
                 update_option(XF_OPTIONS, $saved_options[XF_OPTIONS]);
                 update_option(XF_LAYOUTS, $saved_options[XF_LAYOUTS]);
                 update_option(XF_TEMPLATES, $saved_options[XF_TEMPLATES]);
                 update_option(XF_WIDGET_PERMISSIONS, $saved_options[XF_WIDGET_PERMISSIONS]);
                 if (is_multisite() && XF_IS_MAIN_BLOG) {
                     update_blog_option(XF_SITE_ID, XF_WIDGET_BURNING_REG, $saved_options[XF_WIDGET_BURNING_REG]);
                 }
                 if (isset($_POST['permit_widget_import']) && $_POST['permit_widget_import'] == 1) {
                     update_option('sidebars_widgets', $saved_options['sidebars-widgets']);
                     $widgets = $saved_options['widgets'];
                     foreach ($widgets as $key => $value) {
                         update_option($key, $value);
                     }
                     $redirect .= '&message=1';
                 } else {
                     $redirect .= '&message=2';
                 }
                 if (isset($saved_options[XF_VERSION_FIELD])) {
                     //we import an old (lower) version backup and have to patch it upto current version
                     update_option(XF_VERSION_FIELD, $saved_options[XF_VERSION_FIELD]);
                     xtreme_validate_framework();
                 }
                 require_once XF_ADMIN_DIR . '/xtreme-basemod-css.php';
                 require_once XF_ADMIN_DIR . '/xtreme-patch-css.php';
                 require_once XF_ADMIN_DIR . '/xtreme-production-css.php';
                 $basemod = new Xtreme_Basemod_CSS();
                 $basemod->write();
                 $patch = new Xtreme_Patch_CSS();
                 $patch->write();
                 $production = new Xtreme_Production_CSS();
                 $production->write();
             } else {
                 $redirect .= '&error=4';
             }
         } else {
             $redirect .= '&error=4';
         }
     }
     wp_redirect($redirect);
 }