Пример #1
0
 /**
  * Adds External Styles to Header
  *
  * @return null
  * @added 2.0
  */
 static function addExternal()
 {
     $opt = ResponsiveMenuPro::getOptions();
     if (!wp_is_mobile() && $opt['use_only_on_mobile']) {
         return false;
     } else {
         wp_enqueue_style('responsive-menu-pro', ResponsiveMenuPro_Registry::get('config', 'plugin_data_uri') . 'css/responsive-menu-pro-' . get_current_blog_id() . '.css', array(), '1.0', 'all');
     }
 }
Пример #2
0
 /**
  * Adds the external scripts to the site if required
  *
  * @return null
  * @added 1.4
  */
 static function addExternal()
 {
     $opt = ResponsiveMenuPro::getOptions();
     if (!wp_is_mobile() && $opt['use_only_on_mobile']) {
         return false;
     } else {
         wp_enqueue_script('responsive-menu-pro', ResponsiveMenuPro_Registry::get('config', 'plugin_data_uri') . 'js/responsive-menu-pro-' . get_current_blog_id() . '.js', 'jquery.mobile', '1.0', self::inFooter());
     }
 }
Пример #3
0
 /**
  * Script that runs if the menu has been upgraded
  *
  * @return mixed
  * @added 2.0
  */
 static function upgrade()
 {
     if (self::needsUpgrade()) {
         ResponsiveMenuPro_Factories_FileFolderFactory::create();
         /* Update Version */
         update_option('responsive_menu_pro_version', ResponsiveMenuPro_Registry::get('config', 'current_version'));
         /* Merge Changes */
         update_option('responsive_menu_pro_options', array_merge(ResponsiveMenuPro_Registry::get('defaults'), ResponsiveMenuPro::getOptions()));
     }
 }
Пример #4
0
 /**
  * Creates the view for the menu and echos it out
  *
  * @return string
  * @added 1.0
  */
 static function display($args = null)
 {
     $options = ResponsiveMenuPro::getOptions();
     if (!wp_is_mobile() && $options['use_only_on_mobile']) {
         return false;
     } else {
         ResponsiveMenuPro_View::make('menu', $args ? array_merge($options, $args) : $options);
         ResponsiveMenuPro_View::make('button', $args ? array_merge($options, $args) : $options);
     }
 }
Пример #5
0
 /**
  * Function to create export XML file
  *
  * @return file xml
  * @added 2.2
  */
 static function export()
 {
     if (!is_admin()) {
         exit;
     }
     $xml = '<?xml version="1.0" encoding="UTF-8"?>';
     $xml .= '<responsive_menu_pro_options>';
     foreach (ResponsiveMenuPro::getOptions() as $option_key => $option_val) {
         $xml .= '<' . $option_key . '>' . base64_encode($option_val) . '</' . $option_key . '>';
     }
     $xml .= '</responsive_menu_pro_options>';
     $FileCreator = new ResponsiveMenuPro_FileSystem_FileCreator();
     $NewFile = $FileCreator->create(ResponsiveMenuPro_Registry::get('config', 'plugin_base_dir') . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR . 'export' . DIRECTORY_SEPARATOR . 'export.xml', $xml);
     $link = ResponsiveMenuPro_Registry::get('config', 'plugin_base_uri') . 'public/export/export.xml';
     if ($NewFile) {
         ResponsiveMenuPro_Status::set('updated', '<a href="' . $link . '">' . __('You can download your exported file by clicking here', 'responsive-menu-pro') . '</a>');
     }
 }
Пример #6
0
 public static function create()
 {
     $FolderCreator = new ResponsiveMenuPro_FileSystem_FolderCreator();
     $FolderCreator->create(ResponsiveMenuPro_Registry::get('config', 'plugin_base_dir') . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR . 'export');
     if (ResponsiveMenuPro::getOption('create_external_scripts')) {
         $FileCreator = new ResponsiveMenuPro_FileSystem_FileCreator();
         /* Create Folders */
         $FolderCreator->create(ResponsiveMenuPro_Registry::get('config', 'plugin_data_dir'));
         $FolderCreator->create(ResponsiveMenuPro_Registry::get('config', 'plugin_data_dir') . DIRECTORY_SEPARATOR . 'js');
         $FolderCreator->create(ResponsiveMenuPro_Registry::get('config', 'plugin_data_dir') . DIRECTORY_SEPARATOR . 'css');
         /* Create JS Content */
         $js = ResponsiveMenuPro_Models_JS::getJs(ResponsiveMenuPro::getOptions());
         $js = ResponsiveMenuPro::getOption('minify') == 'minify' ? ResponsiveMenuPro_Models_JS::Minify($js) : ($js = $js);
         /* Create JS File */
         $FileCreator->create(ResponsiveMenuPro_Registry::get('config', 'plugin_data_dir') . DIRECTORY_SEPARATOR . 'js' . DIRECTORY_SEPARATOR . 'responsive-menu-pro-' . get_current_blog_id() . '.js', $js);
         /* Create CSS Content */
         $css = ResponsiveMenuPro_Models_CSS::getCSS(ResponsiveMenuPro::getOptions());
         $css = ResponsiveMenuPro::getOption('minify') == 'minify' ? ResponsiveMenuPro_Models_CSS::Minify($css) : ($css = $css);
         /* Create CSS File */
         $FileCreator->create(ResponsiveMenuPro_Registry::get('config', 'plugin_data_dir') . DIRECTORY_SEPARATOR . 'css' . DIRECTORY_SEPARATOR . 'responsive-menu-pro-' . get_current_blog_id() . '.css', $css);
     }
 }
Пример #7
0
 /**
  * Creates the main admin page and saves the data if submitted
  *
  * @return null
  * @added 1.0
  */
 static function adminPage()
 {
     /* Is Export */
     if (ResponsiveMenuPro_Input::post('responsive_menu_pro_export')) {
         ResponsiveMenuPro_Export::export();
     }
     /* Is Import, Normal Save or Reset */
     if (ResponsiveMenuPro_Input::post('responsive_menu_pro_submit') || ResponsiveMenuPro_Input::post('responsive_menu_pro_import') || ResponsiveMenuPro_Input::post('responsive_menu_pro_reset') || ResponsiveMenuPro_Input::post('responsive_menu_pro_update_theme')) {
         /* Get our Data Array */
         $data = ResponsiveMenuPro_Input::post('responsive_menu_pro_import') ? ResponsiveMenuPro_Import::getData(ResponsiveMenuPro_Input::file('responsive_menu_pro_import_file')) : ResponsiveMenuPro_Input::post();
         /* Reset to defaults */
         if (ResponsiveMenuPro_Input::post('responsive_menu_pro_reset')) {
             $data = ResponsiveMenuPro_Registry::get('defaults');
             $data['arrow_shape_active'] = json_decode($data['arrow_shape_active']);
             $data['arrow_shape_inactive'] = json_decode($data['arrow_shape_inactive']);
         }
         /* Apply Theme Options if Required */
         if (ResponsiveMenuPro_Input::post('responsive_menu_pro_update_theme')) {
             $Theme = new ResponsiveMenuPro_Theme(ResponsiveMenuPro_Input::post());
             $data = $Theme->apply(ResponsiveMenuPro_Input::post('theme'));
         }
         /* Apply Final Filters to avoid setting conflicts */
         $FinalFilters = new ResponsiveMenuPro_Filters_Final($data);
         $data = $FinalFilters->apply();
         /* Save Details to database */
         ResponsiveMenuPro_Models_Admin::save($data);
         /* Clear Transient Menus */
         if (ResponsiveMenuPro::getOption('use_transient_caching')) {
             ResponsiveMenuPro_Transient::clearTransientMenus();
         }
         /* Create all our Files and Folders */
         ResponsiveMenuPro_Factories_FileFolderFactory::create();
     }
     /* Return with Admin Page */
     ResponsiveMenuPro_View::make('admin.page', ResponsiveMenuPro::getOptions());
 }