public static function displaySettingsPage()
 {
     wp_enqueue_style('jquery-ui-tabs-css', CMA_URL . '/views/resources/jquery-ui-tabs.css');
     wp_enqueue_script('jquery-ui-tabs', false, array(), false, true);
     wp_enqueue_script('cma-suggest-user', CMA_URL . '/views/resources/js/suggest-user.js', array('suggest', 'jquery'));
     $messages = array();
     if (!empty($_POST['titles'])) {
         self::$_titles = array_map('stripslashes', $_POST['titles']);
         update_option(self::OPTION_TITLES, self::$_titles);
         $messages[] = CMA_Settings::__('Settings succesfully updated');
     }
     if (!get_option('permalink_structure')) {
         // rewrite notice
         $messages[] = sprintf(CMA_Settings::__('Plugin pages will appear correctly if you choose non-default <a href="%s">permalink structure</a> in your Wordpress settings and enable URL rewrite rules.'), esc_attr(admin_url('options-permalink.php')));
     }
     $params = apply_filters('CMA_admin_settings', array());
     extract($params);
     ob_start();
     require CMA_PATH . '/views/backend/settings.phtml';
     self::displayAdminPage(ob_get_clean());
 }
Ejemplo n.º 2
0
 public static function displaySettingsPage()
 {
     $messages = array();
     if (!empty($_POST['titles'])) {
         self::$_titles = array_map('stripslashes', $_POST['titles']);
         update_option(self::OPTION_TITLES, self::$_titles);
         $messages[] = __('Settings succesfully updated', 'cm-answers');
     }
     $params = array();
     $params = apply_filters('CMA_admin_settings', $params);
     extract($params);
     ob_start();
     require CMA_PATH . '/views/backend/settings.phtml';
     $content = ob_get_contents();
     ob_end_clean();
     self::displayAdminPage($content);
 }
Ejemplo n.º 3
0
 public static function displaySettingsPage()
 {
     // CSRF protection
     if (!empty($_POST) and (empty($_POST['nonce']) or !wp_verify_nonce($_POST['nonce'], self::ADMIN_SETTINGS))) {
         die('Invalid nonce');
     }
     $messages = array();
     if (!empty($_POST['titles'])) {
         self::$_titles = array_map('stripslashes', $_POST['titles']);
         update_option(self::OPTION_TITLES, self::$_titles);
         $messages[] = __('Settings succesfully updated', 'cm-answers');
     }
     wp_enqueue_style('cma-settings', CMA_URL . '/views/resources/settings.css');
     wp_enqueue_script('cma-backend', CMA_URL . '/views/resources/backend.js');
     $params = array();
     $params = apply_filters('CMA_admin_settings', $params);
     extract($params);
     ob_start();
     require CMA_PATH . '/views/backend/settings.phtml';
     $content = ob_get_contents();
     ob_end_clean();
     self::displayAdminPage($content);
 }