/**
  * 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());
 }
Exemple #2
0
 /**
  * Function to create named cached transient menu
  *
  * @param  string  $name
  * @return array
  * @added 2.3
  */
 static function createTransientMenu($name)
 {
     $walker = ResponsiveMenu::getOption('RMWalker');
     $depth = ResponsiveMenu::getOption('RMDepth');
     $cachedMenu = wp_nav_menu(array('menu' => $name, 'menu_class' => 'responsive-menu', 'depth' => $depth, 'walker' => !empty($walker) ? new $walker() : '', 'echo' => false));
     return $cachedMenu;
 }
 /**
  * Prepare our Front End Options
  *
  * @return null
  * @added 2.0
  */
 static function prepare()
 {
     // Check that we are in the admin area
     if (!is_admin()) {
         if (ResponsiveMenu::getOption('RMCliToClo')) {
             add_action('wp_enqueue_scripts', array('RM_FrontController', 'jQueryMobile'));
         }
     }
 }
Exemple #4
0
 /**
  * Function to get named cached transient menu
  *
  * @param  string  $name
  * @return string
  * @added 2.3
  * @edited 2.4 - Added option to use transient caching
  */
 static function getTransientMenu($data)
 {
     $Transient = ResponsiveMenu::getOption('RMUseTran');
     if ($Transient) {
         $cachedKey = $data['RM'] . '_' . get_current_blog_id();
         $cachedMenu = get_transient($cachedKey);
     } else {
         $cachedMenu = false;
     }
     if ($cachedMenu === false) {
         $cachedMenu = self::createTransientMenu($data);
         if ($Transient) {
             set_transient($cachedKey, $cachedMenu);
         }
     }
     return $cachedMenu;
 }
 /**
  * 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()));
     }
 }
 /**
  * Prepare the HTML for display on the front end
  *
  * @return null
  * @added 1.0
  */
 static function prepare()
 {
     if (!ResponsiveMenu::getOption('RMShortcode')) {
         add_action('wp_footer', array('RM_HTMLController', 'display'));
     }
 }
Exemple #7
0
 /**
  * Determines wether to display scripts in footer
  *
  * @return boolean
  * @added 2.0
  */
 static function inFooter()
 {
     return ResponsiveMenu::getOption('RMFooter') && ResponsiveMenu::getOption('RMFooter') == 'footer' ? true : false;
 }
Exemple #8
0
 /**
  * Creates and echos the inline styles if used
  *
  * @return string
  * @added 1.0
  */
 static function addInline()
 {
     $opt = ResponsiveMenu::getOptions();
     echo ResponsiveMenu::getOption('RMMinify') == 'minify' ? RM_JSModel::Minify(RM_JSModel::getJs($opt)) : RM_JSModel::getJs($opt);
 }
Exemple #9
0
 /**
  * Function to format and display the additional content in the main menu
  *
  * @return string
  * @added 2.0
  */
 static function additionalContent()
 {
     if (ResponsiveMenu::getOption('RMHtml')) {
         ?>
     
         <div id="rm-additional-content">
             <?php 
         echo do_shortcode(ResponsiveMenu::getOption('RMHtml'));
         ?>
         </div>
                                   
 <?php 
     }
 }
Exemple #10
0
 /**
  * Function to set a new status in the system
  *
  * @param  string  $type
  * @param string $text
  * @return null
  * @added 2.0
  */
 static function prepare()
 {
     if (ResponsiveMenu::getOption('RMShortcode')) {
         add_shortcode('responsive-menu', array('RM_HTMLController', 'display'));
     }
 }