Пример #1
0
 /**
  * Creates the main admin page and saves the data if submitted
  *
  * @return null
  * @added 1.0
  */
 static function adminPage()
 {
     if (RM_Input::post('RMExport')) {
         RM_Export::export();
     }
     if (RM_Input::post('RMSubmit') || RM_Input::post('RMImport') || RM_Input::post('RMReset')) {
         $data = RM_Input::post('RMImport') ? RM_Import::getData(RM_Input::file('RMImportFile')) : RM_Input::post();
         /* Reset to defaults */
         if (RM_Input::post('RMReset')) {
             $data = RM_Registry::get('defaults');
             $data['RMArShpA'] = json_decode($data['RMArShpA']);
             $data['RMArShpI'] = json_decode($data['RMArShpI']);
         }
         RM_AdminModel::save($data);
         if (ResponsiveMenu::getOption('RMExternal')) {
             RM_FolderModel::create();
             $js = RM_JSModel::getJs(ResponsiveMenu::getOptions());
             $js = ResponsiveMenu::getOption('RMMinify') == 'minify' ? RM_JSModel::Minify($js) : ($js = $js);
             RM_JSModel::createJSFile($js);
             $css = RM_CSSModel::getCSS(ResponsiveMenu::getOptions());
             $css = ResponsiveMenu::getOption('RMMinify') == 'minify' ? RM_JSModel::Minify($css) : ($css = $css);
             RM_CSSModel::createCSSFile($css);
         }
     }
     RM_View::make('admin.page', ResponsiveMenu::getOptions());
 }
 /**
  * Script that runs if the menu has been upgraded
  *
  * @return mixed
  * @added 2.0
  */
 static function upgrade()
 {
     if (self::needsUpgrade()) {
         if (ResponsiveMenu::getOption('RMExternal')) {
             RM_FolderModel::create();
             $js = RM_JSModel::getJs(ResponsiveMenu::getOptions());
             $js = ResponsiveMenu::getOption('RMMinify') == 'minify' ? RM_JSModel::Minify($js) : ($js = $js);
             RM_JSModel::createJSFile($js);
             $css = RM_CSSModel::getCSS(ResponsiveMenu::getOptions());
             $css = ResponsiveMenu::getOption('RMMinify') == 'minify' ? RM_CSSModel::Minify($css) : ($css = $css);
             RM_CSSModel::createCSSFile($css);
         }
         /* Update Version */
         update_option('RMVer', RM_Registry::get('config', 'current_version'));
         /* Merge Changes */
         update_option('RMOptions', array_merge(RM_Registry::get('defaults'), ResponsiveMenu::getOptions()));
     }
 }