Mixin_WordPress_Security_Manager

The NextGEN Gallery Mixin WordPress Security Manager class.

Defined (1)

The class is defined in the following location(s).

/products/photocrati_nextgen/modules/security/package.module.security.php  
  1. class Mixin_WordPress_Security_Manager extends Mixin 
  2. function get_actor($actor_id, $actor_type = null, $args = null) 
  3. if ($actor_type == null) { 
  4. $actor_type = 'user'; 
  5. $object = null; 
  6. if ($actor_id != null) { 
  7. switch ($actor_type) { 
  8. case 'user': 
  9. $object = get_userdata($actor_id); 
  10. if ($object == false) { 
  11. $object = null; 
  12. break; 
  13. case 'role': 
  14. $object = get_role($actor_id); 
  15. if ($object == false) { 
  16. $object = null; 
  17. break; 
  18. if ($object != null) { 
  19. $factory = C_Component_Factory::get_instance(); 
  20. $actor = $factory->create('wordpress_security_actor', $actor_type); 
  21. $entity_props = array('type' => $actor_type, 'id' => $actor_id); 
  22. $actor->set_entity($object, $entity_props); 
  23. return $actor; 
  24. return $this->object->get_guest_actor(); 
  25. function get_current_actor() 
  26. // If the current_user has an id of 0, then perhaps something went wrong 
  27. // with trying to parse the cookie. In that case, we'll force WordPress to try 
  28. // again 
  29. global $current_user; 
  30. if ($current_user->ID == 0) { 
  31. if (isset($GLOBALS['HTTP_COOKIE_VARS']) && isset($GLOBALS['_COOKIE'])) { 
  32. $current_user = NULL; 
  33. foreach ($GLOBALS['HTTP_COOKIE_VARS'] as $key => $value) { 
  34. if (!isset($_COOKIE[$key])) { 
  35. $_COOKIE[$key] = $value; 
  36. return $this->object->get_actor(get_current_user_id(), 'user'); 
  37. function get_guest_actor() 
  38. $factory = C_Component_Factory::get_instance(); 
  39. $actor = $factory->create('wordpress_security_actor', 'user'); 
  40. $entity_props = array('type' => 'user'); 
  41. $actor->set_entity(null, $entity_props); 
  42. return $actor;