Changeset 1091:d32eaf9fac5e for inc/admin/class.dc.admincontext.php
- Timestamp:
- 12/20/12 23:59:54 (13 years ago)
- Branch:
- twig
- File:
-
- 1 edited
-
inc/admin/class.dc.admincontext.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
inc/admin/class.dc.admincontext.php
r1089 r1091 23 23 protected $globals = array(); 24 24 protected $protected_globals = array(); 25 protected $memory = array(); 25 26 26 27 public function __construct($core) … … 126 127 return array( 127 128 '__' => new Twig_Function_Function("__", array('is_safe' => array('html'))), 128 'debug_info' => new Twig_Function_Method($this, 'getDebugInfo', array('is_safe' => array('html'))) 129 //,'page_menu' => new Twig_Function_Method($this, 'pageMenu', array('is_safe' => array('html'))) 129 'debug_info' => new Twig_Function_Method($this, 'getDebugInfo', array('is_safe' => array('html'))), 130 'memorize' => new Twig_Function_Method($this, 'setMemory', array('is_safe' => array('html'))), 131 'memorized' => new Twig_Function_Method($this, 'getMemory', array('is_safe' => array('html'))) 130 132 ); 131 133 } … … 461 463 return $di; 462 464 } 465 466 /** 467 Add a value in a namespace memory 468 469 This help keep variable when recalling Twig macros 470 471 @param string $ns A namespace 472 @param string $str A value to memorize in this namespace 473 */ 474 public function setMemory($ns,$str) 475 { 476 if (!array_key_exists($ns,$this->memory) || !in_array($str,$this->memory[$ns])) { 477 $this->memory[$ns][] = $str; 478 } 479 } 480 481 /** 482 Check if a value is previously memorized in a namespace 483 484 @param string $ns A namespace 485 @param string $str A value to search in this namespace 486 @return array True if exists 487 */ 488 public function getMemory($ns,$str) 489 { 490 return array_key_exists($ns,$this->memory) && in_array($str,$this->memory[$ns]); 491 } 463 492 } 464 493 ?>
Note: See TracChangeset
for help on using the changeset viewer.
