36 $this->blocks = array();
37 $this->traits = array();
65 if (null !== $this->parent) {
73 $name =
$parent->getTemplateName();
74 $this->parents[$name] =
$parent;
77 $this->parents[
$parent] = $this->env->loadTemplate($parent);
105 $name = (string) $name;
107 if (isset($this->traits[$name])) {
108 $this->traits[$name][0]->displayBlock($name, $context,
$blocks);
128 $name = (string) $name;
133 call_user_func(
$blocks[$name], $context, $b);
134 }
elseif (isset($this->blocks[$name])) {
135 call_user_func($this->blocks[$name], $context,
$blocks);
137 $parent->displayBlock($name, $context, array_merge($this->blocks,
$blocks));
158 return ob_get_clean();
178 return ob_get_clean();
200 return isset($this->blocks[(
string) $name]);
215 return array_keys($this->blocks);
246 $level = ob_get_level();
250 }
catch (Exception $e) {
251 while (ob_get_level() > $level) {
258 return ob_get_clean();
278 }
catch (Exception $e) {
279 throw new Twig_Error_Runtime(sprintf(
'An exception has been thrown during the rendering of a template ("%s").', $e->getMessage()), -1, null, $e);
289 abstract protected function doDisplay(array $context, array
$blocks = array());
310 final protected function getContext($context, $item, $ignoreStrictCheck =
false)
312 if (!array_key_exists($item, $context)) {
313 if ($ignoreStrictCheck || !$this->env->isStrictVariables()) {
320 return $context[$item];
341 $arrayItem = is_bool($item) || is_float($item) ? (int) $item : $item;
343 if ((is_array($object) && array_key_exists($arrayItem, $object))
344 || ($object instanceof ArrayAccess && isset($object[$arrayItem]))
346 if ($isDefinedTest) {
350 return $object[$arrayItem];
354 if ($isDefinedTest) {
358 if ($ignoreStrictCheck || !$this->env->isStrictVariables()) {
362 if (is_object($object)) {
363 throw new Twig_Error_Runtime(sprintf(
'Key "%s" in object (with ArrayAccess) of type "%s" does not exist', $arrayItem, get_class($object)), -1, $this->
getTemplateName());
364 }
elseif (is_array($object)) {
365 throw new Twig_Error_Runtime(sprintf(
'Key "%s" for array with keys "%s" does not exist', $arrayItem, implode(
', ', array_keys($object))), -1, $this->
getTemplateName());
367 throw new Twig_Error_Runtime(sprintf(
'Impossible to access a key ("%s") on a %s variable ("%s")', $item, gettype($object), $object), -1, $this->
getTemplateName());
369 throw new Twig_Error_Runtime(sprintf(
'Impossible to access an attribute ("%s") on a %s variable ("%s")', $item, gettype($object), $object), -1, $this->
getTemplateName());
374 if (!is_object($object)) {
375 if ($isDefinedTest) {
379 if ($ignoreStrictCheck || !$this->env->isStrictVariables()) {
383 throw new Twig_Error_Runtime(sprintf(
'Impossible to invoke a method ("%s") on a %s variable ("%s")', $item, gettype($object), $object), -1, $this->
getTemplateName());
386 $class = get_class($object);
390 if (isset($object->$item) || array_key_exists((
string) $item, $object)) {
391 if ($isDefinedTest) {
395 if ($this->env->hasExtension(
'sandbox')) {
396 $this->env->getExtension(
'sandbox')->checkPropertyAllowed($object, $item);
399 return $object->$item;
404 if (!isset(self::$cache[
$class][
'methods'])) {
405 self::$cache[
$class][
'methods'] = array_change_key_case(array_flip(get_class_methods($object)));
408 $lcItem = strtolower($item);
409 if (isset(self::$cache[$class][
'methods'][$lcItem])) {
410 $method = (string) $item;
411 }
elseif (isset(self::$cache[$class][
'methods'][
'get'.$lcItem])) {
412 $method =
'get'.$item;
413 }
elseif (isset(self::$cache[$class][
'methods'][
'is'.$lcItem])) {
414 $method =
'is'.$item;
415 }
elseif (isset(self::$cache[$class][
'methods'][
'__call'])) {
416 $method = (string) $item;
418 if ($isDefinedTest) {
422 if ($ignoreStrictCheck || !$this->env->isStrictVariables()) {
429 if ($isDefinedTest) {
433 if ($this->env->hasExtension(
'sandbox')) {
434 $this->env->getExtension(
'sandbox')->checkMethodAllowed($object, $method);
437 $ret = call_user_func_array(array($object, $method), $arguments);
442 return $ret ===
'' ?
'' :
new Twig_Markup($ret, $this->env->getCharset());
453 self::$cache = array();
getBlocks()
Returns all blocks.
hasBlock($name)
Returns whether a block exists or not.
if($rub=fetch_assoc($rub_query)) if(check_if_module_active('url_rewriting')) $class
getTemplateLine()
Gets the template line where the error occurred.
displayParentBlock($name, array $context, array $blocks=array())
Displays a parent block.
setTemplateLine($lineno)
Sets the template line where the error occurred.
getAttribute($object, $item, array $arguments=array(), $type=Twig_TemplateInterface::ANY_CALL, $isDefinedTest=false, $ignoreStrictCheck=false)
Returns the attribute value for a given array/object.
getTemplateFile()
Gets the filename where the error occurred.
getEnvironment()
{Returns the bound environment for this template.Twig_Environment The current environment} ...
Interface implemented by all compiled templates.
render(array $context)
{Renders the template with the given context and returns it as string.An array of parameters to pass ...
displayBlock($name, array $context, array $blocks=array())
Displays a block.
__construct(Twig_Environment $env)
Constructor.
doDisplay(array $context, array $blocks=array())
Auto-generated method to display the template with the given context.
if(strlen($date2)== '10') if($type== 'users-by-age'&&a_priv('admin_users', true)) elseif($type== 'forums-count'&&a_priv('admin_content', true)) elseif($type== 'forums-categories'&&a_priv('admin_content', true)) elseif($type== 'users-count'&&a_priv('admin_users', true)) elseif($type== 'product-categories'&&a_priv('admin_products', true)) elseif($type== 'users-by-sex'&&a_priv('admin_users', true)) elseif($type== 'users-by-country'&&a_priv('admin_users', true)) elseif($type== 'sales'&&a_priv('admin_sales', true))
doGetParent(array $context)
renderBlock($name, array $context, array $blocks=array())
Renders a block.
Default base class for compiled templates.
static clearCache()
This method is only useful when testing Twig.
getContext($context, $item, $ignoreStrictCheck=false)
Returns a variable from the context.
Stores the Twig configuration.
displayWithErrorHandling(array $context, array $blocks=array())
getTemplateName()
Returns the template name.
getParent(array $context)
Returns the parent template.
display(array $context, array $blocks=array())
{Displays the template with the given context.An array of parameters to pass to the template An array...
Exception thrown when an error occurs at runtime.
renderParentBlock($name, array $context, array $blocks=array())
Renders a parent block.
setTemplateFile($filename)
Sets the filename where the error occurred.
getBlockNames()
Returns all block names.