Пример #1
0
 /**
  * init all actions
  */
 private function init()
 {
     global $revSliderAsTheme;
     $template = new RevSliderTemplate();
     $operations = new RevSliderOperations();
     $general_settings = $operations->getGeneralSettingsValues();
     $role = RevSliderBase::getVar($general_settings, 'role', 'admin');
     $force_activation_box = RevSliderBase::getVar($general_settings, 'force_activation_box', 'off');
     if ($force_activation_box == 'on') {
         //force the notifications and more
         $revSliderAsTheme = false;
     }
     self::setMenuRole($role);
     self::addMenuPage('Slider Revolution', "adminPages");
     self::addSubMenuPage(__('Navigation Editor', 'revslider'), 'display_plugin_submenu_page_navigation', 'revslider_navigation');
     $this->addSliderMetaBox();
     //ajax response to save slider options.
     self::addActionAjax("ajax_action", "onAjaxAction");
     //add common scripts there
     $validated = get_option('revslider-valid', 'false');
     $notice = get_option('revslider-valid-notice', 'true');
     $latestv = RevSliderGlobals::SLIDER_REVISION;
     $stablev = get_option('revslider-stable-version', '0');
     $upgrade = new RevSliderUpdate(GlobalsRevSlider::SLIDER_REVISION);
     if (!$revSliderAsTheme || version_compare($latestv, $stablev, '<')) {
         if ($validated === 'false' && $notice === 'true') {
             add_action('admin_notices', array($this, 'addActivateNotification'));
         }
         if (isset($_GET['checkforupdates']) && $_GET['checkforupdates'] == 'true') {
             $upgrade->_retrieve_version_info(true);
         }
         if ($validated === 'true' || version_compare($latestv, $stablev, '<')) {
             $upgrade->add_update_checks();
         }
     }
     if (isset($_REQUEST['update_shop'])) {
         $template->_get_template_list(true);
     } else {
         $template->_get_template_list();
     }
     $upgrade->_retrieve_version_info();
     add_action('admin_notices', array($this, 'add_notices'));
     add_action('admin_enqueue_scripts', array('RevSliderAdmin', 'enqueue_styles'));
     add_action('admin_enqueue_scripts', array('RevSliderAdmin', 'enqueue_all_admin_scripts'));
     add_action('wp_ajax_revslider_ajax_call_front', array('RevSliderAdmin', 'onFrontAjaxAction'));
     add_action('wp_ajax_nopriv_revslider_ajax_call_front', array('RevSliderAdmin', 'onFrontAjaxAction'));
     //for not logged in users
     add_action('admin_head', array('RevSliderAdmin', 'include_custom_css'));
 }