function preDispatch()
 {
     parent::preDispatch();
     if (!current_user_can("manage_options")) {
         return false;
     }
     return true;
 }
Exemple #2
0
 static function initAjaxActions()
 {
     foreach (get_declared_classes() as $cname) {
         if (is_subclass_of($cname, 'am4PageController')) {
             foreach (get_class_methods($cname) as $m) {
                 if (preg_match("/^doAjax(.*)/", $m, $r)) {
                     $hook = "wp_ajax_" . am4PageController::getAjaxActionValue($cname);
                     add_action($hook, self::createController($cname, am4PageController::AJAX));
                     break;
                 }
             }
         }
     }
 }