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;
	}