Merge pull request #3539 from totten/master-tx-api
[civicrm-core.git] / CRM / Core / Smarty.php
index c88b450ee937fe51542cfac61377e2a3740aabab..a29d2e231f238c616233fb98e5ce4a991f37c9da 100644 (file)
@@ -1,9 +1,9 @@
 <?php
 /*
  +--------------------------------------------------------------------+
- | CiviCRM version 4.4                                                |
+ | CiviCRM version 4.5                                                |
  +--------------------------------------------------------------------+
- | Copyright CiviCRM LLC (c) 2004-2013                                |
+ | Copyright CiviCRM LLC (c) 2004-2014                                |
  +--------------------------------------------------------------------+
  | This file is a part of CiviCRM.                                    |
  |                                                                    |
@@ -28,7 +28,7 @@
 /**
  *
  * @package CRM
- * @copyright CiviCRM LLC (c) 2004-2013
+ * @copyright CiviCRM LLC (c) 2004-2014
  * $Id$
  *
  */
@@ -48,7 +48,7 @@ class CRM_Core_Smarty extends Smarty {
   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 surronding it and assumes we will embed this within other pages
+    // this and all the below bypasses the CMS html surrounding it and assumes we will embed this within other pages
     PRINT_SNIPPET = 2,
     // sends the generated html to the chosen pdf engine
     PRINT_PDF = 3,
@@ -59,8 +59,10 @@ class CRM_Core_Smarty extends Smarty {
     // this prints a complete form and also generates a qfKey, can we replace this with
     // snippet = 2?? Does the constant _NOFFORM do anything?
     PRINT_QFKEY = 5,
-    // this sends the output back in json
-    PRINT_JSON = 6;
+    // Note: added in v 4.3 with the value '6'
+    // Value changed in 4.5 to 'json' for better readability
+    // @see CRM_Core_Page_AJAX::returnJsonResponse
+    PRINT_JSON = 'json';
 
   /**
    * We only need one instance of this object. So we use the singleton
@@ -187,6 +189,8 @@ class CRM_Core_Smarty extends Smarty {
    * @param string $cache_id
    * @param string $compile_id
    * @param boolean $display
+   *
+   * @return bool|mixed|string
    */
   function fetch($resource_name, $cache_id = NULL, $compile_id = NULL, $display = FALSE) {
     if (preg_match( '/^(\s+)?string:/', $resource_name)) {
@@ -200,6 +204,10 @@ class CRM_Core_Smarty extends Smarty {
     return $output;
   }
 
+  /**
+   * @param $name
+   * @param $value
+   */
   function appendValue($name, $value) {
     $currentValue = $this->get_template_vars($name);
     if (!$currentValue) {
@@ -226,6 +234,9 @@ class CRM_Core_Smarty extends Smarty {
     civicrm_smarty_register_string_resource();
   }
 
+  /**
+   * @param $path
+   */
   function addTemplateDir($path) {
     if ( is_array( $this->template_dir ) ) {
       array_unshift( $this->template_dir, $path );