summaryrefslogtreecommitdiff
path: root/buildscripts/PhpDocumentor/phpDocumentor/Smarty-2.6.0/libs/core/core.process_cached_inserts.php
diff options
context:
space:
mode:
authorctrlaltca@gmail.com <>2011-11-19 11:33:31 +0000
committerctrlaltca@gmail.com <>2011-11-19 11:33:31 +0000
commit98dbe6f0d2edfff3a1f5785504504b4a6e5dd4eb (patch)
tree89f19120abb170cb37bb512c8c9535eb2b451da8 /buildscripts/PhpDocumentor/phpDocumentor/Smarty-2.6.0/libs/core/core.process_cached_inserts.php
parent1f09b786730956d01c48a82272617a0f8b2597f0 (diff)
updating phpDocumentor, part 2: add new version
Diffstat (limited to 'buildscripts/PhpDocumentor/phpDocumentor/Smarty-2.6.0/libs/core/core.process_cached_inserts.php')
-rw-r--r--buildscripts/PhpDocumentor/phpDocumentor/Smarty-2.6.0/libs/core/core.process_cached_inserts.php71
1 files changed, 71 insertions, 0 deletions
diff --git a/buildscripts/PhpDocumentor/phpDocumentor/Smarty-2.6.0/libs/core/core.process_cached_inserts.php b/buildscripts/PhpDocumentor/phpDocumentor/Smarty-2.6.0/libs/core/core.process_cached_inserts.php
new file mode 100644
index 00000000..0e368fdd
--- /dev/null
+++ b/buildscripts/PhpDocumentor/phpDocumentor/Smarty-2.6.0/libs/core/core.process_cached_inserts.php
@@ -0,0 +1,71 @@
+<?php
+/**
+ * Smarty plugin
+ * @package Smarty
+ * @subpackage plugins
+ */
+
+/**
+ * Replace cached inserts with the actual results
+ *
+ * @param string $results
+ * @return string
+ */
+function smarty_core_process_cached_inserts($params, &$smarty)
+{
+ preg_match_all('!'.$smarty->_smarty_md5.'{insert_cache (.*)}'.$smarty->_smarty_md5.'!Uis',
+ $params['results'], $match);
+ list($cached_inserts, $insert_args) = $match;
+
+ for ($i = 0, $for_max = count($cached_inserts); $i < $for_max; $i++) {
+ if ($smarty->debugging) {
+ $_params = array();
+ require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.get_microtime.php');
+ $debug_start_time = smarty_core_get_microtime($_params, $smarty);
+ }
+
+ $args = unserialize($insert_args[$i]);
+ $name = $args['name'];
+
+ if (isset($args['script'])) {
+ $_params = array('resource_name' => $smarty->_dequote($args['script']));
+ require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.get_php_resource.php');
+ if(!smarty_core_get_php_resource($_params, $smarty)) {
+ return false;
+ }
+ $resource_type = $_params['resource_type'];
+ $php_resource = $_params['php_resource'];
+
+
+ if ($resource_type == 'file') {
+ $smarty->_include($php_resource, true);
+ } else {
+ $smarty->_eval($php_resource);
+ }
+ }
+
+ $function_name = $smarty->_plugins['insert'][$name][0];
+ if (empty($args['assign'])) {
+ $replace = $function_name($args, $smarty);
+ } else {
+ $smarty->assign($args['assign'], $function_name($args, $smarty));
+ $replace = '';
+ }
+
+ $params['results'] = str_replace($cached_inserts[$i], $replace, $params['results']);
+ if ($smarty->debugging) {
+ $_params = array();
+ require_once(SMARTY_DIR . 'core' . DIRECTORY_SEPARATOR . 'core.get_microtime.php');
+ $smarty->_smarty_debug_info[] = array('type' => 'insert',
+ 'filename' => 'insert_'.$name,
+ 'depth' => $smarty->_inclusion_depth,
+ 'exec_time' => smarty_core_get_microtime($_params, $smarty) - $debug_start_time);
+ }
+ }
+
+ return $params['results'];
+}
+
+/* vim: set expandtab: */
+
+?>