Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5bd0630
commit 44b6cd8
Showing
245 changed files
with
42,561 additions
and
54 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,212 @@ | ||
<?php | ||
/* | ||
+--------------------------------------------------------------------+ | ||
| Copyright CiviCRM LLC. All rights reserved. | | ||
| | | ||
| This work is published under the GNU AGPLv3 license with some | | ||
| permitted exceptions and without any warranty. For full license | | ||
| and copyright information, see https://civicrm.org/licensing | | ||
+--------------------------------------------------------------------+ | ||
*/ | ||
|
||
/** | ||
* | ||
* @package CRM | ||
* @copyright CiviCRM LLC https://civicrm.org/licensing | ||
*/ | ||
|
||
/** | ||
* Fix for bug CRM-392. Not sure if this is the best fix or it will impact | ||
* other similar PEAR packages. doubt it | ||
*/ | ||
if (!class_exists('Smarty')) { | ||
if (defined('CIVICRM_SMARTY3')) { | ||
global $civicrm_root; | ||
require_once $civicrm_root . '/ext/smarty3/vendor/autoload.php'; | ||
} | ||
else { | ||
require_once 'Smarty/Smarty.class.php'; | ||
} | ||
} | ||
|
||
/** | ||
* | ||
*/ | ||
class CRM_Core_SmartyCompatibility extends Smarty { | ||
public function loadFilter($type, $name) { | ||
if (method_exists(get_parent_class(), 'load_filter')) { | ||
parent::load_filter($type, $name); | ||
return; | ||
} | ||
parent::loadFilter($type, $name); | ||
} | ||
|
||
/** | ||
* @deprecated | ||
* | ||
* @param string $type | ||
* @param string $name | ||
* | ||
* @throws \SmartyException | ||
*/ | ||
public function load_filter($type, $name) { | ||
if (method_exists(get_parent_class(), 'load_filter')) { | ||
parent::load_filter($type, $name); | ||
return; | ||
} | ||
parent::loadFilter($type, $name); | ||
} | ||
|
||
/** | ||
* Registers modifier to be used in templates | ||
* | ||
* @deprecated | ||
* | ||
* @param string $modifier name of template modifier | ||
* @param string $modifier_impl name of PHP function to register | ||
*/ | ||
public function register_modifier($modifier, $modifier_impl) { | ||
if (method_exists(get_parent_class(), 'register_modifier')) { | ||
parent::register_modifier($modifier, $modifier_impl); | ||
return; | ||
} | ||
parent::registerPlugin('modifier', $modifier, $modifier_impl); | ||
} | ||
|
||
public function registerPlugin($type, $name, $callback, $cacheable = true, $cache_attr = null) { | ||
if (method_exists(get_parent_class(), 'registerPlugin')) { | ||
parent::registerPlugin($type, $name, $callback, $cacheable = true, $cache_attr = null); | ||
return; | ||
} | ||
if ($type === 'modifier') { | ||
parent::register_modifier($name, $callback); | ||
} | ||
} | ||
|
||
/** | ||
* Registers a resource to fetch a template | ||
* | ||
* @param string $type name of resource | ||
* @param array $functions array of functions to handle resource | ||
*/ | ||
public function register_resource($type, $functions) { | ||
if (method_exists(get_parent_class(), 'register_resource')) { | ||
parent::register_resource($type, $functions); | ||
return; | ||
} | ||
parent::registerResource($type, $functions); | ||
} | ||
|
||
/** | ||
* Registers custom function to be used in templates | ||
* | ||
* @param string $function the name of the template function | ||
* @param string $function_impl the name of the PHP function to register | ||
*/ | ||
function register_function($function, $function_impl, $cacheable=true, $cache_attrs=null) { | ||
if (method_exists(get_parent_class(), 'register_function')) { | ||
parent::register_function($function, $function_impl, $cacheable=true, $cache_attrs=null); | ||
return; | ||
} | ||
parent::registerPlugin('function', $function, $function, $cacheable, $cache_attrs); | ||
} | ||
|
||
/** | ||
* Returns an array containing template variables | ||
* | ||
* @param string $name | ||
* @param string $type | ||
* @return array | ||
*/ | ||
public function &get_template_vars($name=null) { | ||
if (method_exists(get_parent_class(), 'get_template_vars')) { | ||
return parent::get_template_vars($name); | ||
} | ||
$var = parent::getTemplateVars($name); | ||
return $var; | ||
} | ||
|
||
/** | ||
* Returns a single or all template variables | ||
* | ||
* @api Smarty::getTemplateVars() | ||
* @link http://www.smarty.net/docs/en/api.get.template.vars.tpl | ||
* | ||
* @param string $varName variable name or null | ||
* @param \Smarty_Internal_Data|\Smarty_Internal_Template|\Smarty $_ptr optional pointer to data object | ||
* @param bool $searchParents include parent templates? | ||
* | ||
* @return mixed variable value or or array of variables | ||
*/ | ||
public function getTemplateVars($varName = null, Smarty_Internal_Data $_ptr = null, $searchParents = true) { | ||
if (method_exists(get_parent_class(), 'getTemplateVars')) { | ||
return parent::getTemplateVars($varName. $_ptr, $searchParents); | ||
} | ||
return parent::get_template_vars($varName); | ||
} | ||
|
||
/** | ||
* Generally Civi mis-uses this for perceived php4 conformance, avoid. | ||
* | ||
* @deprecated | ||
* @param string $tpl_var | ||
* @param mixed $value | ||
* | ||
* @return \Smarty|\Smarty_Internal_Data|\Smarty_Internal_Template|void | ||
*/ | ||
public function assign_by_ref($tpl_var, &$value) { | ||
if (method_exists(get_parent_class(), 'assign_by_ref')) { | ||
parent::assign_by_ref($tpl_var, $value); | ||
return; | ||
} | ||
return parent::assignByRef($tpl_var, $value); | ||
} | ||
|
||
/** | ||
* Generally Civi mis-uses this for perceived php4 conformance, avoid. | ||
* | ||
* @deprecated | ||
* @param string $tpl_var | ||
* | ||
* @return \Smarty|\Smarty_Internal_Data|\Smarty_Internal_Template|void | ||
*/ | ||
public function clear_assign($tpl_var) { | ||
if (method_exists(get_parent_class(), 'clear_assign')) { | ||
parent::clear_assign($tpl_var); | ||
return; | ||
} | ||
return parent::clearAssign($tpl_var); | ||
} | ||
|
||
/** | ||
* Checks whether requested template exists. | ||
* | ||
* @param string $tpl_file | ||
* | ||
* @return bool | ||
* @throws \SmartyException | ||
*/ | ||
public function template_exists($tpl_file) { | ||
if (method_exists(get_parent_class(), 'template_exists')) { | ||
return parent::template_exists($tpl_file); | ||
} | ||
return parent::templateExists($tpl_file); | ||
} | ||
|
||
/** | ||
* Check if a template resource exists | ||
* | ||
* @param string $resource_name template name | ||
* | ||
* @return bool status | ||
* @throws \SmartyException | ||
*/ | ||
public function templateExists($resource_name) { | ||
if (method_exists(get_parent_class(), 'templateExists')) { | ||
return parent::templateExists($resource_name); | ||
} | ||
return parent::template_exists($resource_name); | ||
} | ||
|
||
|
||
} |
Oops, something went wrong.