Ejemplo n.º 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());
 }
Ejemplo n.º 2
0
 /**
  * Function to clear all transient menus
  *
  * @return null
  * @added 2.3
  */
 static function clearTransientMenus()
 {
     if (ResponsiveMenu::hasMenus()) {
         foreach (ResponsiveMenu::getMenus() as $menu) {
             delete_transient($menu->slug . '_' . get_current_blog_id());
         }
     }
 }
Ejemplo n.º 3
0
 /**
  * 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'));
         }
     }
 }
Ejemplo n.º 4
0
 /**
  * Creates the view for the menu and echos it out
  *
  * @return string
  * @added 1.0
  */
 static function display($args = null)
 {
     /* Unfortunately this messy section is due to shortcodes converting all args to lowercase */
     if ($args) {
         if ($args['rm']) {
             $args['RM'] = $args['rm'];
         }
     }
     RM_View::make('menu', $args ? array_merge(ResponsiveMenu::getOptions(), $args) : ResponsiveMenu::getOptions());
 }
Ejemplo n.º 5
0
 /**
  * Creates the view for the menu and echos it out
  *
  * @return string
  * @added 1.0
  */
 static function display($args = null)
 {
     /* Unfortunately this messy section is due to shortcodes converting all args to lowercase */
     if ($args) {
         if ($args['rm']) {
             $args['RM'] = $args['rm'];
         }
         if ($args['menu']) {
             $args['RM'] = $args['menu'];
         }
         if ($args['title']) {
             $args['RMTitle'] = $args['title'];
         }
         if ($args['title_link']) {
             $args['RMTitleLink'] = $args['title_link'];
         }
         if ($args['title_open']) {
             $args['RMTitleLoc'] = $args['title_open'];
         }
         if ($args['html']) {
             $args['RMHtml'] = $args['html'];
         }
         if ($args['html_loc']) {
             $args['RMHtmlLoc'] = $args['html_loc'];
         }
         if ($args['title_img']) {
             $args['RMImage'] = $args['title_img'];
         }
         if ($args['search_loc']) {
             $args['RMSearchPos'] = $args['search_loc'];
         }
         if ($args['btn_img']) {
             $args['RMClickImg'] = $args['btn_img'];
         }
         if ($args['btn_img_clicked']) {
             $args['RMClickImgClicked'] = $args['btn_img_clicked'];
         }
         if ($args['btn_title']) {
             $args['RMClickTitle'] = $args['btn_title'];
         }
     }
     $options = ResponsiveMenu::getOptions();
     RM_View::make('menu', $args ? array_merge($options, $args) : $options);
     RM_View::make('click-button', $args ? array_merge($options, $args) : $options);
 }
Ejemplo n.º 6
0
 /**
  * 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()));
     }
 }
Ejemplo n.º 7
0
 /**
  * Function to create export XML file
  *
  * @return file xml
  * @added 2.2
  */
 static function export()
 {
     if (!is_admin()) {
         exit;
     }
     $fileName = RM_Registry::get('config', 'plugin_base_dir') . '/public/export/export.xml';
     $file = fopen($fileName, 'w+');
     if (!$file) {
         return RM_Status::set('error', __('Could not create export file, please check plugin folder permissions', 'responsive-menu'));
     }
     $xml = '<?xml version="1.0" encoding="UTF-8"?>';
     $xml .= '<RMOptions>';
     foreach (ResponsiveMenu::getOptions() as $option_key => $option_val) {
         $xml .= '<' . $option_key . '>' . $option_val . '</' . $option_key . '>';
     }
     $xml .= '</RMOptions>';
     fwrite($file, $xml);
     fclose($file);
     $link = RM_Registry::get('config', 'plugin_base_uri') . 'public/export/export.xml';
     RM_Status::set('updated', '<a href="' . $link . '">' . __('You can download your exported file by clicking here', 'responsive-menu') . '</a>');
 }
Ejemplo n.º 8
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;
 }
Ejemplo n.º 9
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);
 }
Ejemplo n.º 10
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 
     }
 }
Ejemplo n.º 11
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'));
     }
 }