protected function getAllowedMethods($item) {
		$cls = get_class($item);
		$allowed = isset($this->allowedMethods[$cls]) ? $this->allowedMethods[$cls] : null;
		if (!$allowed) {
			$conf = Config::inst()->get(get_class($item), 'allowed_template_methods');
			if ($conf) {
				$allowed = $conf;
			} else {
				$methodsFromObject = function ($obj) {
					$cls = get_class($obj);
					$clazz = new ReflectionObject($obj);
					$declaredMethods = $clazz->getMethods(ReflectionMethod::IS_PUBLIC);
					$methods = array();
					foreach ($declaredMethods as $method) {
						/* @var $method  ReflectionMethod  */
						if ($method->class == $cls) {
							$methods[$method->getName()] = $method->getName();
						}
					}
					return $methods;
				};

				$allowed = $methodsFromObject($item);

				$extensions = $item->getExtensionInstances();
				foreach ($extensions as $ext) {
					$add = $methodsFromObject($ext);
					$allowed = array_merge($allowed, $add);
				}
			}
			$this->allowedMethods[$cls] = $allowed;
		}
		return $allowed;
	}
protected function getAllowedMethods($item) {
		$cls = get_class($item);
		$allowed = isset($this->allowedMethods[$cls]) ? $this->allowedMethods[$cls] : null;
		if (!$allowed) {
			$conf = Config::inst()->get(get_class($item), 'allowed_template_methods');
			if ($conf) {
				$allowed = $conf;
			} else {
				$methodsFromObject = function ($obj) {
					$cls = get_class($obj);
					$clazz = new ReflectionObject($obj);
					$declaredMethods = $clazz->getMethods(ReflectionMethod::IS_PUBLIC);
					$methods = array();
					foreach ($declaredMethods as $method) {
						/* @var $method  ReflectionMethod  */
						if ($method->class == $cls) {
							$methods[$method->getName()] = $method->getName();
						}
					}
					return $methods;
				};

				$allowed = $methodsFromObject($item);

				$extensions = $item->getExtensionInstances();
				foreach ($extensions as $ext) {
					$add = $methodsFromObject($ext);
					$allowed = array_merge($allowed, $add);
				}
			}
			$this->allowedMethods[$cls] = $allowed;
		}
		return $allowed;
	}
protected function getAllowedMethods ( $ item ) { $ cls = get_class ( $ item ) ; $ allowed = isset ( $ this -> allowedMethods [ $ cls ] ) ? $ this -> allowedMethods [ $ cls ] : null ; if ( ! $ allowed ) { $ conf = Config :: inst ( ) -> get ( get_class ( $ item ) , 'allowed_template_methods' ) ; if ( $ conf ) { $ allowed = $ conf ; } else { $ methodsFromObject = function ( $ obj ) { $ cls = get_class ( $ obj ) ; $ clazz = new ReflectionObject ( $ obj ) ; $ declaredMethods = $ clazz -> getMethods ( ReflectionMethod :: IS_PUBLIC ) ; $ methods = array ( ) ; foreach ( $ declaredMethods as $ method ) { /* @var $method  ReflectionMethod  */ if ( $ method -> class == $ cls ) { $ methods [ $ method -> getName ( ) ] = $ method -> getName ( ) ; } } return $ methods ; } ; $ allowed = $ methodsFromObject ( $ item ) ; $ extensions = $ item -> getExtensionInstances ( ) ; foreach ( $ extensions as $ ext ) { $ add = $ methodsFromObject ( $ ext ) ; $ allowed = array_merge ( $ allowed , $ add ) ; } } $ this -> allowedMethods [ $ cls ] = $ allowed ; } return $ allowed ; }
Gets the list of methods that can be called from a template.

Checks if there's any explicitly defined methods, if not makes available
any publicly defined methods on the object directly.

@param DataObject $item
@return array
Gets the list of methods that can be called from a template .