示例#1
0
 /**
  * 
  * @return type
  */
 protected function getCurrentSubject()
 {
     $userId = AAM_Core_Request::get('user');
     if ($userId) {
         $u = get_user_by('id', $userId);
         $subject = array('type' => 'user', 'id' => $userId, 'name' => $u->display_name ? $u->display_name : $u->user_nicename);
     } else {
         $roles = array_keys(get_editable_roles());
         $role = array_shift($roles);
         $subject = array('type' => 'role', 'id' => $role, 'name' => AAM_Core_API::getRoles()->get_role($role)->name);
     }
     return (object) $subject;
 }
示例#2
0
 /**
  * Make sure that AAM UI Page is used
  *
  * @return boolean
  *
  * @access public
  */
 public static function isAAM()
 {
     $page = AAM_Core_Request::get('page');
     $action = AAM_Core_Request::post('action');
     $intersect = array_intersect(array('aam', 'aamc'), array($page, $action));
     return is_admin() && count($intersect);
 }
示例#3
0
文件: aam.php 项目: phongvan212/tuanh
 /**
  * Make sure that AAM UI Page is used
  *
  * @return boolean
  *
  * @access public
  */
 public static function isAAM()
 {
     $page = AAM_Core_Request::get('page');
     $action = AAM_Core_Request::post('action');
     return is_admin() && in_array('aam', array($page, $action));
 }
示例#4
0
文件: aam.php 项目: severnrescue/web
 /**
  * Make sure that AAM UI Page is used
  *
  * @return boolean
  *
  * @access public
  */
 public static function isAAM()
 {
     return AAM_Core_Request::get('page') == 'aam';
 }
示例#5
0
 /**
  * Get Post ID
  *
  * Replication of the same mechanism that is in wp-admin/post.php
  *
  * @return WP_Post|null
  *
  * @access public
  */
 public function getPost()
 {
     if (get_post()) {
         $post = get_post();
     } elseif ($post_id = AAM_Core_Request::get('post')) {
         $post = get_post($post_id);
     } elseif ($post_id = AAM_Core_Request::get('post_ID')) {
         $post = get_post($post_id);
     } else {
         $post = null;
     }
     return $post;
 }
示例#6
0
 /**
  * Print plugin localization
  * 
  * @param string $localKey
  * 
  * @return void
  * 
  * @access protected
  */
 protected function printLocalization($localKey)
 {
     $user = AAM_Core_Request::get('user');
     $roles = array_keys(get_editable_roles());
     $role = array_shift($roles);
     wp_localize_script($localKey, 'aamLocal', array('nonce' => wp_create_nonce('aam_ajax'), 'ajaxurl' => admin_url('admin-ajax.php'), 'url' => array('site' => admin_url('index.php'), 'jsbase' => AAM_MEDIA . '/js/aam', 'editUser' => admin_url('user-edit.php'), 'addUser' => admin_url('user-new.php')), 'subject' => array('type' => $user ? 'user' : 'role', 'id' => $user ? $user : $role, 'blog' => get_current_blog_id()), 'welcome' => AAM_Core_API::getOption('aam-welcome', 1)));
 }