Exemplo n.º 1
0
 /**
  * Fetch role list
  * 
  * @return array
  * 
  * @access protected
  */
 protected function fetchRoleList()
 {
     $response = array();
     //filter by name
     $search = trim(AAM_Core_Request::request('search.value'));
     $roles = get_editable_roles();
     foreach ($roles as $id => $role) {
         if (!$search || preg_match('/^' . $search . '/i', $role['name'])) {
             $response[$id] = $role;
         }
     }
     return $response;
 }
Exemplo n.º 2
0
 /**
  * Process the ajax call
  *
  * @return string
  *
  * @access public
  */
 public function processAjax()
 {
     $response = null;
     $action = AAM_Core_Request::request('sub_action');
     $parts = explode('.', $action);
     if (method_exists($this, $parts[0])) {
         $response = call_user_func(array($this, $parts[0]));
     } elseif (count($parts) == 2) {
         //cover the Model.method pattern
         $classname = 'AAM_Backend_' . $parts[0];
         if (class_exists($classname)) {
             $object = new $classname();
             if (method_exists($object, $parts[1])) {
                 $response = call_user_func(array($object, $parts[1]));
             }
         }
     }
     return apply_filters('aam-ajax-filter', $response, $this->getSubject(), $action);
 }
Exemplo n.º 3
0
 /**
  * Process the ajax call
  *
  * @return string
  *
  * @access public
  */
 public function processAjax()
 {
     $response = null;
     $act = explode('.', AAM_Core_Request::request('sub_action'));
     if (count($act) == 1 && method_exists($this, $act[0])) {
         $response = call_user_func(array($this, $act[0]));
     } else {
         $classname = 'AAM_Backend_' . $act[0];
         if (class_exists($classname)) {
             $object = new $classname();
             if (method_exists($object, $act[1])) {
                 $response = call_user_func(array($object, $act[1]));
             }
         }
     }
     if (is_null($response)) {
         $response = apply_filters('aam-ajax-action', $response, $this->getSubject(), $act[0], $act[1]);
     }
     return $response;
 }
Exemplo n.º 4
0
 /**
  * Prepare response
  * 
  * @param array $response
  * 
  * @return string
  * 
  * @access protected
  */
 protected function wrapTable($response)
 {
     $response['draw'] = AAM_Core_Request::request('draw');
     return json_encode($response);
 }
Exemplo n.º 5
0
 /**
  * Query database for list of users
  * 
  * Based on filters and settings get the list of users from database
  * 
  * @return \WP_User_Query
  * 
  * @access public
  */
 public function query()
 {
     $search = trim(AAM_Core_Request::request('search.value'));
     $args = array('number' => '', 'blog_id' => get_current_blog_id(), 'role' => AAM_Core_Request::request('role'), 'fields' => 'all', 'number' => AAM_Core_Request::request('length'), 'offset' => AAM_Core_Request::request('start'), 'search' => $search ? $search . '*' : '', 'search_columns' => array('user_login', 'user_email', 'display_name'), 'orderby' => 'user_nicename', 'order' => 'ASC');
     return new WP_User_Query($args);
 }