Get subject ID * * @return string|int * * @access public * @version 6.0.0 */ public function getId() { return $this->_id; } /** * Get subject name * * @return string * * @access public * @version 6.0.0 */ abstract public function getName(); /** * Get maximum subject User level * * @return int * * @access public * @version 6.0.0 */ public function getMaxLevel() { return 0; } /** * Get WP core principal * * @return WP_Role|WP_User * * @access public * @version 6.0.0 */ public function getPrincipal() { return $this->_principal; } /** * Set WP core principal * * @param WP_Role|WP_User $principal * * @return void * * @access public * @version 6.0.0 */ public function setPrincipal($principal) { $this->_principal = $principal; } /** * Get subject siblings * * @param array $siblings * * @return void * * @access public * @version 6.0.0 */ public function setSiblings(array $siblings) { $this->_siblings = $siblings; } /** * Check if subject has siblings * * @return boolean * * @access public * @version 6.0.0 */ public function hasSiblings() { return (count($this->_siblings) > 0); } /** * Get list of subject siblings * * @return array * * @access public * @version 6.0.0 */ public function getSiblings() { return $this->_siblings; } /** * Get AAM core object * * This method will instantiate requested AAM core object with pre-populated * access settings for the subject that requested the object. * * @param string $type * @param mixed $id * @param boolean $skipInheritance * * @return AAM_Core_Object * * @since 6.3.2 Added new hook `aam_initialized_{$type}_object_filter` to solve * https://github.com/aamplugin/advanced-access-manager/issues/52 * @since 6.1.0 Fixed the bug where initialize object was not cached correctly * due to $skipInheritance flag * @since 6.0.0 Initial implementation of the method * * @access public * @version 6.3.2 */ public function getObject($type, $id = null, $skipInheritance = false) { $suffix = ($skipInheritance ? '_direct' : '_full'); // Check if there is an object with specified ID if (!isset($this->_objects[$type . $id . $suffix])) { $class_name = 'AAM_Core_Object_' . ucfirst($type); // If requested object is part of the core, instantiate it if (class_exists($class_name)) { $object = new $class_name($this, $id, $skipInheritance); } else { $object = apply_filters( 'aam_object_filter', null, $this, $type, $id, $skipInheritance ); } if (is_a($object, 'AAM_Core_Object')) { // Kick in the inheritance chain if needed if ($skipInheritance === false) { $this->inheritFromParent($object); } // Finally cache the object $this->_objects[$type . $id . $suffix] = apply_filters( "aam_initialized_{$type}_object_filter", $object ); } } else { $object = $this->_objects[$type . $id . $suffix]; } return $object; } /** * Inherit access settings for provided object from the parent subject(s) * * @param AAM_Core_Object $object * * @return array * * @access protected * @version 6.0.0 */ protected function inheritFromParent(AAM_Core_Object $object) { $subject = $this->getParent(); if (is_a($subject, 'AAM_Core_Subject')) { $option = $subject->getObject( $object::OBJECT_TYPE, $object->getId() )->getOption(); // Merge access settings while reading hierarchical chain $option = array_replace_recursive($option, $object->getOption()); // Merge access settings if multi-roles option is enabled $multi = AAM::api()->getConfig('core.settings.multiSubject', false); if ($multi && $subject->hasSiblings()) { foreach ($subject->getSiblings() as $sibling) { $option = $sibling->getObject( $object::OBJECT_TYPE, $object->getId() )->mergeOption( $option ); } } // Finally set the option for provided object $object->setOption($option); } return $object->getOption(); } /** * Retrieve parent subject * * If there is no parent subject, return null * * @return AAM_Core_Subject|null * * @access public * @version 6.0.0 */ abstract public function getParent(); /** * Update subject access option * * @param mixed $value * @param string $object * @param mixed $id * * @return boolean * * @access public * @version 6.0.0 */ public function updateOption($value, $object, $id = null) { return AAM_Core_AccessSettings::getInstance()->set( $this->getOptionName($object, $id), $value )->save(); } /** * Read subject access option * * @param string $object * @param mixed $id * * @return array * * @access public * @version 6.0.0 */ public function readOption($object, $id = null) { return AAM_Core_AccessSettings::getInstance()->get( $this->getOptionName($object, $id) ); } /** * Delete subject access option * * @param string $object * @param mixed $id * * @return boolean * * @access public * @version 6.0.0 */ public function deleteOption($object, $id = null) { return AAM_Core_AccessSettings::getInstance()->delete( $this->getOptionName($object, $id) )->save(); } /** * Compute access option name based on object type * * @param string $object * @param mixed $id * * @return string * * @access protected * @version 6.0.0 */ public function getOptionName($object, $id) { $subjectId = $this->getId(); $name = static::UID . ($subjectId ? ".{$subjectId}" : '') . '.'; $name .= $object . ($id ? ".{$id}" : ''); return $name; } /** * Reset object cache * * Subject caches all instantiated object for performance reasons * * @return void * * @access public * @version 6.0.0 */ public function flushCache() { $this->_objects = array(); } }
Fatal error: Uncaught Error: Class 'AAM_Core_Subject' not found in /home/arasetne/public_html/wp-content/plugins/advanced-access-manager/application/Core/Subject/Visitor.php:18 Stack trace: #0 /home/arasetne/public_html/wp-content/plugins/advanced-access-manager/autoloader.php(72): require() #1 [internal function]: AAM_Autoloader::load('AAM_Core_Subjec...') #2 /home/arasetne/public_html/wp-content/plugins/advanced-access-manager/aam.php(137): spl_autoload_call('AAM_Core_Subjec...') #3 /home/arasetne/public_html/wp-content/plugins/advanced-access-manager/aam.php(67): AAM->initializeUser() #4 /home/arasetne/public_html/wp-content/plugins/advanced-access-manager/aam.php(216): AAM->__construct() #5 /home/arasetne/public_html/wp-content/plugins/advanced-access-manager/aam.php(187): AAM::getInstance() #6 /home/arasetne/public_html/wp-includes/class-wp-hook.php(324): AAM::onPluginsLoaded('') #7 /home/arasetne/public_html/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array) #8 /home/arasetne/public_html/wp-includ in /home/arasetne/public_html/wp-content/plugins/advanced-access-manager/application/Core/Subject/Visitor.php on line 18