<?php
/*
+--------------------------------------------------------------------+
- | CiviCRM version 4.5 |
+ | CiviCRM version 4.6 |
+--------------------------------------------------------------------+
| Copyright CiviCRM LLC (c) 2004-2014 |
+--------------------------------------------------------------------+
*
*/
class CRM_Core_Smarty extends Smarty {
- CONST
+ const
// use print.tpl and bypass the CMS. Civi prints a valid html file
PRINT_PAGE = 1,
// this and all the below bypasses the CMS html surrounding it and assumes we will embed this within other pages
* Class constructor
*
* @return CRM_Core_Smarty
- * @access private
*/
private function __construct() {
parent::__construct();
}
- private function initialize( ) {
+ private function initialize() {
$config = CRM_Core_Config::singleton();
if (isset($config->customTemplateDir) && $config->customTemplateDir) {
* Method providing static instance of SmartTemplate, as
* in Singleton pattern.
*/
- static function &singleton() {
+ public static function &singleton() {
if (!isset(self::$_singleton)) {
self::$_singleton = new CRM_Core_Smarty( );
self::$_singleton->initialize( );
* @param string $resource_name
* @param string $cache_id
* @param string $compile_id
- * @param boolean $display
+ * @param bool $display
*
* @return bool|mixed|string
*/
- function fetch($resource_name, $cache_id = NULL, $compile_id = NULL, $display = FALSE) {
+ public function fetch($resource_name, $cache_id = NULL, $compile_id = NULL, $display = FALSE) {
if (preg_match( '/^(\s+)?string:/', $resource_name)) {
$old_security = $this->security;
$this->security = TRUE;
* Fetch a template (while using certain variables)
*
* @param string $resource_name
- * @param array $vars (string $name => mixed $value) variables to export to Smarty
+ * @param array $vars
+ * (string $name => mixed $value) variables to export to Smarty.
* @throws Exception
* @return bool|mixed|string
*/
- function fetchWith($resource_name, $vars) {
+ public function fetchWith($resource_name, $vars) {
$this->pushScope($vars);
try {
$result = $this->fetch($resource_name);
- } catch (Exception $e) {
+ }
+ catch (Exception $e) {
// simulate try { ... } finally { ... }
$this->popScope();
throw $e;
* @param string $name
* @param $value
*/
- function appendValue($name, $value) {
+ public function appendValue($name, $value) {
$currentValue = $this->get_template_vars($name);
if (!$currentValue) {
$this->assign($name, $value);
}
}
- function clearTemplateVars() {
+ public function clearTemplateVars() {
foreach (array_keys($this->_tpl_vars) as $key) {
if ($key == 'config' || $key == 'session') {
continue;
}
}
- static function registerStringResource() {
+ public static function registerStringResource() {
require_once 'CRM/Core/Smarty/resources/String.php';
civicrm_smarty_register_string_resource();
}
/**
* @param $path
*/
- function addTemplateDir($path) {
+ public function addTemplateDir($path) {
if ( is_array( $this->template_dir ) ) {
array_unshift( $this->template_dir, $path );
- } else {
+ }
+ else {
$this->template_dir = array( $path, $this->template_dir );
}
* $smarty->popScope();
* @endcode
*
- * @param array $vars (string $name => mixed $value)
+ * @param array $vars
+ * (string $name => mixed $value).
* @return CRM_Core_Smarty
* @see popScope
*/
}
/**
- * @param array $vars (string $name => mixed $value)
+ * @param array $vars
+ * (string $name => mixed $value).
* @return CRM_Core_Smarty
*/
public function assignAll($vars) {
return $this;
}
}
-