});
// fancyboxes
- /*$("a.popupbox").fancybox({
- 'transitionIn' : 'elastic',
- 'transitionOut' : 'elastic'
- });*/
$("a.popupbox").colorbox({
'inline' : true,
'transition' : 'elastic'
-Smarty 3.1.11
+Smarty 3.1.19
Author: Monte Ohrt <monte at ohrt dot com >
Author: Uwe Tews
$smarty->unregisterFilter($type, $function_name)
$smarty->unregisterResource($resource_type)
-$smarty->compileAllTemplates($extention = '.tpl', $force_compile = false, $time_limit = 0, $max_errors = null)
+$smarty->compileAllTemplates($extension = '.tpl', $force_compile = false, $time_limit = 0, $max_errors = null)
$smarty->clearCompiledTemplate($resource_name = null, $compile_id = null, $exp_time = null)
$smarty->testInstall()
$smarty->fetch('./foo.tpl') cannot be relative to a template, an
exception is thrown.
- Adressing a specific $template_dir
+ Addressing a specific $template_dir
Smarty 3.1 introduces the $template_dir index notation.
$smarty->fetch('[foo]bar.tpl') and {include file="[foo]bar.tpl"}
-===== trunk =====
-===== Smarty-3.1.11 =====
+ ===== 3.1.20-dev ===== (xx.xx.2014)
+ ===== 3.1.19 ===== (06.30.2014)
+ 20.06.2014
+ - bugfix template variables could not be passed as paramter in {include} when the include was in a {nocache} section (topic 25131)
+
+ 17.06.2014
+ - bugfix large template text of some charsets could cause parsing errors (topic 24630)
+
+ 08.06.2014
+ - bugfix registered objects did not work after spelling fixes of 06.06.2014
+ - bugfix {block} tags within {literal} .. {/literal} got not displayed correctly (topic 25024)
+ - bugfix UNC WINDOWS PATH like "\\psf\path\to\dir" did not work as template directory (Issue 192)
+ - bugfix {html_image} security check did fail on files relative to basedir (Issue 191)
+
+ 06.06.2014
+ - fixed PHPUnit outputFilterTrimWhitespaceTests.php assertion of test result
+ - fixed spelling, PHPDoc , minor errors, code cleanup
+
+ 02.06.2014
+ - using multiple cwd with relative template dirs could result in identical compiled file names. (issue 194 and topic 25099)
+
+ 19.04.2014
+ - bugfix calling createTemplate(template, data) with empty data array caused notice of array to string conversion (Issue 189)
+ - bugfix clearCompiledTemplate() did not delete files on WINDOWS when a compile_id was specified
+
+ 18.04.2014
+ - revert bugfix of 5.4.2014 because %-e date format is not supported on all operating systems
+
+ ===== 3.1.18 ===== (07.04.2014)
+ 06.04.2014
+ - bugfix template inheritance fail when using custom resource after patch of 8.3.2014 (Issue 187)
+ - bugfix update of composer file (Issue 168 and 184)
+
+ 05.04.2014
+ - bugfix default date format leads to extra spaces when displaying dates with single digit days (Issue 165)
+
+ 26.03.2014
+ - bugfix Smart_Resource_Custom should not lowercase the resource name (Issue 183)
+
+ 24.03.2014
+ - bugfix using a {foreach} property like @iteration could fail when used in inheritance parent templates (Issue 182)
+
+ 20.03.2014
+ - bugfix $smarty->auto_literal and mbsting.func_overload 2, 6 or 7 did fail (forum topic 24899)
+
+ 18.03.2014
+ - revert change of 17.03.2014
+
+17.03.2014
+ - bugfix $smarty->auto_literal and mbsting.func_overload 2, 6 or 7 did fail (forum topic 24899)
+
+ 15.03.2014
+ - bugfix Smarty_CacheResource_Keyvaluestore did use different keys on read/writes and clearCache() calls (Issue 169)
+
+ 13.03.2014
+ - bugfix clearXxx() change of 27.1.2014 did not work when specifing cache_id or compile_id (forum topic 24868 and 24867)
+
+ ===== 3.1.17 =====
+ 08.03.2014
+ - bugfix relative file path {include} within {block} of child templates did throw exception on first call (Issue 177)
+
+ 17.02.2014
+ - bugfix Smarty failed when executing PHP on HHVM (Hip Hop 2.4) because uniqid('',true) does return string with ',' (forum topic 20343)
+
+ 16.02.2014
+ - bugfix a '//' or '\\' in template_dir path could produce wrong path on relative filepath in {include} (Issue 175)
+
+ 05.02.2014
+ - bugfix shared.literal_compiler_param.php did throw an exception when literal did contain a '-' (smarty-developers group)
+
+ 27.01.2014
+ - bugfix $smarty->debugging = true; did show the variable of the $smarty object not the variables used in display() call (forum topic 24764)
+ - bugfix clearCompiledTemplate(), clearAll() and clear() should use realpath to avoid possible exception from RecursiveDirectoryIterator (Issue 171)
+
+ 26.01.2014
+ - bugfix undo block nesting checks for {nocache} for reasons like forum topic 23280 (forum topic 24762)
+
+ 18.01.2014
+ - bugfix the compiler did fail when using template inheritance and recursive {include} (smarty-developers group)
+
+ 11.01.2014
+ - bugfix "* }" (spaces before right delimiter) was interpreted by mistake as comment end tag (Issue 170)
+ - internals content cache should be clear when updating cache file
+
+ 08.01.2014
+ - bugfix Smarty_CacheResource_Custom did not handle template resource type specifications on clearCache() calls (Issue 169)
+ - bugfix SmartyBC.class.php should use require_once to load Smarty.class.php (forum topic 24683)
+
+ ===== 3.1.16 =====
+ 15.12.2013
+ - bugfix {include} with {block} tag handling (forum topic 24599, 24594, 24682) (Issue 161)
+ Read 3.1.16_RELEASE_NOTES for more details
+ - enhancement additional debug output at $smarty->_parserdebug = true;
+
+ 07.11.2013
+ - bugfix too restrictive handling of {include} within {block} tags. 3.1.15 did throw errors where 3.1.14 did not (forum topic 24599)
+ - bugfix compiler could fail if PHP mbstring.func_overload is enabled (Issue 164)
+
+ 28.10.2013
+ - bugfix variable resource name at custom resource plugin did not work within {block} tags (Issue 163)
+ - bugfix notice "Trying to get property of non-object" removed (Issue 163)
+ - bugfix correction of modifier capitalize fix from 3.10.2013 (issue 159)
+ - bugfix multiple {block}s with same name in parent did not work (forum topic 24631)
+
+ 20.10.2013
+ - bugfix a variable file name at {extends} tag did fail (forum topic 24618)
+
+ 14.10.2013
+ - bugfix yesterdays fix could result in an undefined variable
+
+ 13.10.2013
+ - bugfix variable names on {include} in template inheritance did unextepted error message (forum topic 24594) (Issue 161)
+.- bugfix relative includes with same name like {include './foo.tpl'} from different folder failed (forum topic 24590)(Issue 161)
+
+ 04.10.2013
+ - bugfix variable file names at {extends} had been disbabled by mistake with the rewrite of
+ template inheritance of 24.08.2013 (forum topic 24585)
+
+03.10.2013
+ - bugfix loops using modifier capitalize did eat up memory (issue 159)
+
+ ===== Smarty 3.1.15 =====
+01.10.2013
+ - use current delimiters in compiler error messages (issue 157)
+ - improvement on performance when using error handler and multiple template folders (issue 152)
+
+17.09.2013
+ - improvement added patch for additional SmartyCompilerException properties for better access to scource information (forum topic 24559)
+
+16.09.2013
+ - bugfix recompiled templates did not show on first request with zend opcache cache (forum topic 24320)
+
+13.09.2013
+ - bugfix html_select_time defaulting error for the Meridian dropdown (forum topic 24549)
+
+09.09.2012
+- bugfix incorrect compiled code with array(object,method) callback at registered Variable Filter (forum topic 24542)
+
+27.08.2013
+- bugfix delimiter followed by linebreak did not work as auto literal after update from 24.08.2013 (forum topic 24518)
+
+24.08.2013
+- bugfix and enhancement
+ Because several recent problems with template inheritance the {block} tag compiler has been rewriten
+ - Error messages shown now the correct child template file and line number
+ - The compiler could fail on some larger UTF-8 text block (forum topic 24455)
+ - The {strip} tag can now be placed outside {block} tags in child templates (forum topic 24289)
+- change SmartyException::$escape is now false by default
+- change PHP traceback has been remove for SmartyException and SmartyCompilerException
+
+14.08.2013
+- bugfix compiled filepath of config file did not observe different config_dir (forum topic 24493)
+
+13.08.2013
+- bugfix the internal resource cache did not observe config_dir changes (forum topic 24493)
+
+12.08.2013
+- bugfix internal $tmpx variables must be unique over all inheritance templates (Issue 149)
+
+10.08.2013
+- bugfix a newline was eaten when a <?xml ... ?> was passed by a Smarty variable and caching was enabled (forum topic 24482)
+
+29.07.2013
+- bugfix headers already send warning thrown when using 'SMARTY_DEBUG=on' from URL (Issue 148)
+
+27.07.2013
+- enhancement allow access to properties of registered opjects for Smarty2 BC (forum topic 24344)
+
+26.07.2013
+- bugfix template inheritance nesting problem (forum topic 24387)
+
+15.7.2013
+- update code generated by PSR-2 standards fixer which introduced PHP 5.4 incompatibilities of 14.7.2013
+
+14.7.2013
+- bugfix increase of internal maximum parser stacksize to allow more complex tag code {forum topic 24426}
+- update for PHP 5.4 compatibility
+- reformat source to PSR-2 standard
+
+12.7.2013
+- bugfix Do not remove '//' from file path at normalization (Issue 142)
+
+2.7.2013
+- bugfix trimwhitespace would replace captured items in wrong order (forum topic 24387)
+
+===== Smarty-3.1.14 =====
+27.06.2013
+- bugfix removed PHP 5.5 deprecated preg_replace /e option in modifier capitalize (forum topic 24389)
+
+17.06.2013
+- fixed spelling in sources and documentation (from smarty-developers forum Veres Lajos)
+- enhancement added constant SMARTY::CLEAR_EXPIRED for the change of 26.05.2013 (forum topic 24310)
+- bugfix added smarty_security.php to composer.json (Issue 135)
+
+26.05.2013
+- enhancement an expire_time of -1 in clearCache() and clearAllCache() will delete outdated cache files
+ by their individual cache_lifetime used at creation (forum topic 24310)
+
+21.05.2013
+- bugfix modifier strip_tags:true was compiled into wrong code (Forum Topic 24287)
+- bugfix /n after ?> in Smarty.class.php did start output buffering (Issue 138)
+
+25.04.2013
+- bugfix escape and wordrap modifier could be compiled into wrong code when used in {nocache}{/nocache}
+ section but caching is disabled (Forum Topic 24260)
+
+05.04.2013
+- bugfix post filter must not run when compiling inheritance child blocks (Forum Topic 24094)
+- bugfix after the fix for Issue #130 compiler exceptions got double escaped (Forum Topic 24199)
+
+28.02.2013
+- bugfix nocache blocks could be lost when using CACHING_LIFETIME_SAVED (Issue #133)
+- bugfix Compile ID gets nulled when compiling child blocks (Issue #134)
+
+
+24.01.2013
+- bugfix wrong tag type in smarty_internal_templatecompilerbase.php could cause wrong plugin search order (Forum Topic 24028)
+
+===== Smarty-3.1.13 =====
+13.01.2013
+- enhancement allow to disable exception message escaping by SmartyException::$escape = false; (Issue #130)
+
+09.01.2013
+- bugfix compilation did fail when a prefilter did modify an {extends} tag c
+- bugfix template inheritance could fail if nested {block} tags in childs did contain {$smarty.block.child} (Issue #127)
+- bugfix template inheritance could fail if {block} tags in childs did have similar name as used plugins (Issue #128)
+- added abstract method declaration doCompile() in Smarty_Internal_TemplateCompilerBase (Forum Topic 23969)
+
+06.01.2013
+- Allow '://' URL syntax in template names of stream resources (Issue #129)
+
+27.11.2012
+- bugfix wrong variable usage in smarty_internal_utility.php (Issue #125)
+
+26.11.2012
+- bugfix global variable assigned within template function are not seen after template function exit (Forum Topic 23800)
+
+24.11.2012
+- made SmartyBC loadable via composer (Issue #124)
+
+20.11.2012
+- bugfix assignGlobal() called from plugins did not work (Forum Topic 23771)
+
+13.11.2012
+- adding attribute "strict" to html_options, html_checkboxes, html_radios to only print disabled/readonly attributes if their values are true or "disabled"/"readonly" (Issue #120)
+
+01.11.2012
+- bugfix muteExcpetedErrors() would screw up for non-readable paths (Issue #118)
+
+===== Smarty-3.1.12 =====
+14.09.2012
+- bugfix template inheritance failed to compile with delimiters {/ and /} (Forum Topic 23008)
+
+11.09.2012
+- bugfix escape Smarty exception messages to avoid possible script execution
+
+10.09.2012
+- bugfix tag option flags and shorttag attributes did not work when rdel started with '=' (Forum Topic 22979)
+
+31.08.2012
+- bugfix resolving relative paths broke in some circumstances (Issue #114)
+
+22.08.2012
+- bugfix test MBString availability through mb_split, as it could've been compiled without regex support (--enable-mbregex).
+ Either we get MBstring's full package, or we pretend it's not there at all.
+
+21.08.2012
+- bugfix $auto_literal = false did not work with { block} tags in child templates
+ (problem was reintroduced after fix in 3.1.7)(Forum Topic 20581)
+
+17.08.2012
+- bugfix compiled code of nocache sections could contain wrong escaping (Forum Topic 22810)
+
+15.08.2012
+- bugfix template inheritance did produce wrong code if subtemplates with {block} was
+ included several times (from smarty-developers forum)
+
+14.08.2012
+- bugfix PHP5.2 compatibility compromised by SplFileInfo::getBasename() (Issue 110)
+
+01.08.2012
+- bugfix avoid PHP error on $smarty->configLoad(...) with invalid section specification (Forum Topic 22608)
+
+30.07.2012
+-bugfix {assign} in a nocache section should not overwrite existing variable values
+ during compilation (issue 109)
+
+28.07.2012
+- bugfix array access of config variables did not work (Forum Topic 22527)
+
+19.07.2012
+- bugfix the default plugin handler did create wrong compiled code for static class methods
+ from external script files (issue 108)
+
+===== Smarty-3.1.11 =====
30.06.2012
- bugfix {block.. hide} did not work as nested child (Forum Topic 22216)
03/09/2011
- bugfix createTemplate() must default to cache_id and compile_id of Smarty object
- bugfix Smarty_CacheResource_KeyValueStore must include $source->uid in cache filepath to keep templates with same
- name but different folders seperated
+ name but different folders separated
- added cacheresource.apc.php example in demo folder
02/09/2011
- changed ./ and ../ behaviour
14/02/2011
-- added {block ... hide} option to supress block if no child is defined
+- added {block ... hide} option to suppress block if no child is defined
13/02/2011
- update handling of recursive subtemplate calls
- bugfix on compiler object destruction. compiler_object property was by mistake unset.
09/03/2011
--bugfix a variable filter should run before modifers on an output tag (see change of 23/07/2010)
+-bugfix a variable filter should run before modifiers on an output tag (see change of 23/07/2010)
08/03/2011
- bugfix loading config file without section should load only defaults
- bugfix passing scope attributes in doublequoted strings did not work at {include} {assign} and {append}
25/07/2010
-- another bugfix of change from 23/07/2010 when compiling modifer
+- another bugfix of change from 23/07/2010 when compiling modifier
24/07/2010
-- bugfix of change from 23/07/2010 when compiling modifer
+- bugfix of change from 23/07/2010 when compiling modifier
23/07/2010
- changed execution order. A variable filter does now run before modifiers on output of variables
- bugfix on {if} tags
01/12/2010
-- changed back modifer handling in parser. Some restrictions still apply:
+- changed back modifier handling in parser. Some restrictions still apply:
if modifiers are used in side {if...} expression or in mathematical expressions
parentheses must be used.
- bugfix the {function..} tag did not accept the name attribute in double quotes
- fixed exceptions in function plugins
- fixed notice error in Smarty.class.php
- allow chained objects to span multiple lines
-- fixed error in modifers
+- fixed error in modifiers
03/20/2009
- moved /plugins folder into /libs folder
- autoappend a directory separator if the xxxxx_dir definition have no trailing one
03/19/2009
-- allow array definition as modifer parameter
+- allow array definition as modifier parameter
- changed modifier to use multi byte string funktions.
03/17/2009
<?php
- /**
+/**
* Example Application
-
+ *
* @package Example-application
*/
-require('../libs/Smarty.class.php');
+require '../libs/Smarty.class.php';
$smarty = new Smarty;
-
-
//$smarty->force_compile = true;
$smarty->debugging = true;
$smarty->caching = true;
$smarty->cache_lifetime = 120;
-$smarty->assign("Name","Fred Irving Johnathan Bradley Peppergill",true);
-$smarty->assign("FirstName",array("John","Mary","James","Henry"));
-$smarty->assign("LastName",array("Doe","Smith","Johnson","Case"));
-$smarty->assign("Class",array(array("A","B","C","D"), array("E", "F", "G", "H"),
- array("I", "J", "K", "L"), array("M", "N", "O", "P")));
+$smarty->assign("Name", "Fred Irving Johnathan Bradley Peppergill", true);
+$smarty->assign("FirstName", array("John", "Mary", "James", "Henry"));
+$smarty->assign("LastName", array("Doe", "Smith", "Johnson", "Case"));
+$smarty->assign("Class", array(array("A", "B", "C", "D"), array("E", "F", "G", "H"),
+ array("I", "J", "K", "L"), array("M", "N", "O", "P")));
$smarty->assign("contacts", array(array("phone" => "1", "fax" => "2", "cell" => "3"),
- array("phone" => "555-4444", "fax" => "555-3333", "cell" => "760-1234")));
+ array("phone" => "555-4444", "fax" => "555-3333", "cell" => "760-1234")));
-$smarty->assign("option_values", array("NY","NE","KS","IA","OK","TX"));
-$smarty->assign("option_output", array("New York","Nebraska","Kansas","Iowa","Oklahoma","Texas"));
+$smarty->assign("option_values", array("NY", "NE", "KS", "IA", "OK", "TX"));
+$smarty->assign("option_output", array("New York", "Nebraska", "Kansas", "Iowa", "Oklahoma", "Texas"));
$smarty->assign("option_selected", "NE");
$smarty->display('index.tpl');
-?>
/**
* APC CacheResource
- *
* CacheResource Implementation based on the KeyValueStore API to use
* memcache as the storage resource for Smarty's output caching.
* *
+ *
* @package CacheResource-examples
- * @author Uwe Tews
+ * @author Uwe Tews
*/
-class Smarty_CacheResource_Apc extends Smarty_CacheResource_KeyValueStore {
-
+class Smarty_CacheResource_Apc extends Smarty_CacheResource_KeyValueStore
+{
public function __construct()
{
// test if APC is present
- if(!function_exists('apc_cache_info')) {
+ if (!function_exists('apc_cache_info')) {
throw new Exception('APC Template Caching Error: APC is not installed');
}
}
/**
* Read values for a set of keys from cache
*
- * @param array $keys list of keys to fetch
- * @return array list of values with the given keys used as indexes
+ * @param array $keys list of keys to fetch
+ *
+ * @return array list of values with the given keys used as indexes
* @return boolean true on success, false on failure
*/
protected function read(array $keys)
foreach ($res as $k => $v) {
$_res[$k] = $v;
}
+
return $_res;
}
/**
* Save values for a set of keys to cache
*
- * @param array $keys list of values to save
- * @param int $expire expiration time
+ * @param array $keys list of values to save
+ * @param int $expire expiration time
+ *
* @return boolean true on success, false on failure
*/
- protected function write(array $keys, $expire=null)
+ protected function write(array $keys, $expire = null)
{
foreach ($keys as $k => $v) {
apc_store($k, $v, $expire);
}
+
return true;
}
/**
* Remove values from cache
*
- * @param array $keys list of keys to delete
+ * @param array $keys list of keys to delete
+ *
* @return boolean true on success, false on failure
*/
protected function delete(array $keys)
foreach ($keys as $k) {
apc_delete($k);
}
+
return true;
}
/**
* Memcache CacheResource
- *
* CacheResource Implementation based on the KeyValueStore API to use
* memcache as the storage resource for Smarty's output caching.
- *
* Note that memcache has a limitation of 256 characters per cache-key.
* To avoid complications all cache-keys are translated to a sha1 hash.
*
* @package CacheResource-examples
- * @author Rodney Rehm
+ * @author Rodney Rehm
*/
-class Smarty_CacheResource_Memcache extends Smarty_CacheResource_KeyValueStore {
+class Smarty_CacheResource_Memcache extends Smarty_CacheResource_KeyValueStore
+{
/**
* memcache instance
+ *
* @var Memcache
*/
protected $memcache = null;
-
+
public function __construct()
{
$this->memcache = new Memcache();
- $this->memcache->addServer( '127.0.0.1', 11211 );
+ $this->memcache->addServer('127.0.0.1', 11211);
}
-
+
/**
* Read values for a set of keys from cache
*
- * @param array $keys list of keys to fetch
- * @return array list of values with the given keys used as indexes
+ * @param array $keys list of keys to fetch
+ *
+ * @return array list of values with the given keys used as indexes
* @return boolean true on success, false on failure
*/
protected function read(array $keys)
foreach ($res as $k => $v) {
$_res[$lookup[$k]] = $v;
}
+
return $_res;
}
-
+
/**
* Save values for a set of keys to cache
*
- * @param array $keys list of values to save
- * @param int $expire expiration time
+ * @param array $keys list of values to save
+ * @param int $expire expiration time
+ *
* @return boolean true on success, false on failure
*/
- protected function write(array $keys, $expire=null)
+ protected function write(array $keys, $expire = null)
{
foreach ($keys as $k => $v) {
$k = sha1($k);
$this->memcache->set($k, $v, 0, $expire);
}
+
return true;
}
/**
* Remove values from cache
*
- * @param array $keys list of keys to delete
+ * @param array $keys list of keys to delete
+ *
* @return boolean true on success, false on failure
*/
protected function delete(array $keys)
$k = sha1($k);
$this->memcache->delete($k);
}
+
return true;
}
*/
protected function purge()
{
- return $this->memcache->flush();
+ $this->memcache->flush();
}
}
/**
* MySQL CacheResource
- *
* CacheResource Implementation based on the Custom API to use
* MySQL as the storage resource for Smarty's output caching.
- *
* Table definition:
* <pre>CREATE TABLE IF NOT EXISTS `output_cache` (
* `id` CHAR(40) NOT NULL COMMENT 'sha1 hash',
* ) ENGINE = InnoDB;</pre>
*
* @package CacheResource-examples
- * @author Rodney Rehm
+ * @author Rodney Rehm
*/
-class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom {
+class Smarty_CacheResource_Mysql extends Smarty_CacheResource_Custom
+{
// PDO instance
protected $db;
protected $fetch;
protected $fetchTimestamp;
protected $save;
-
- public function __construct() {
+
+ public function __construct()
+ {
try {
- $this->db = new PDO("mysql:dbname=test;host=127.0.0.1", "smarty", "smarty");
- } catch (PDOException $e) {
+ $this->db = new PDO("mysql:dbname=test;host=127.0.0.1", "smarty");
+ }
+ catch (PDOException $e) {
throw new SmartyException('Mysql Resource failed: ' . $e->getMessage());
}
$this->fetch = $this->db->prepare('SELECT modified, content FROM output_cache WHERE id = :id');
/**
* fetch cached content and its modification time from data source
*
- * @param string $id unique cache content identifier
- * @param string $name template name
- * @param string $cache_id cache id
- * @param string $compile_id compile id
- * @param string $content cached content
- * @param integer $mtime cache modification timestamp (epoch)
+ * @param string $id unique cache content identifier
+ * @param string $name template name
+ * @param string $cache_id cache id
+ * @param string $compile_id compile id
+ * @param string $content cached content
+ * @param integer $mtime cache modification timestamp (epoch)
+ *
* @return void
*/
protected function fetch($id, $name, $cache_id, $compile_id, &$content, &$mtime)
{
$this->fetch->execute(array('id' => $id));
$row = $this->fetch->fetch();
- $this->fetch->closeCursor();
+ $this->fetch->closeCursor();
if ($row) {
$content = $row['content'];
$mtime = strtotime($row['modified']);
$mtime = null;
}
}
-
+
/**
* Fetch cached content's modification timestamp from data source
*
* @note implementing this method is optional. Only implement it if modification times can be accessed faster than loading the complete cached content.
- * @param string $id unique cache content identifier
- * @param string $name template name
- * @param string $cache_id cache id
- * @param string $compile_id compile id
+ *
+ * @param string $id unique cache content identifier
+ * @param string $name template name
+ * @param string $cache_id cache id
+ * @param string $compile_id compile id
+ *
* @return integer|boolean timestamp (epoch) the template was modified, or false if not found
*/
protected function fetchTimestamp($id, $name, $cache_id, $compile_id)
$this->fetchTimestamp->execute(array('id' => $id));
$mtime = strtotime($this->fetchTimestamp->fetchColumn());
$this->fetchTimestamp->closeCursor();
+
return $mtime;
}
-
+
/**
* Save content to cache
*
- * @param string $id unique cache content identifier
- * @param string $name template name
- * @param string $cache_id cache id
- * @param string $compile_id compile id
- * @param integer|null $exp_time seconds till expiration time in seconds or null
- * @param string $content content to cache
- * @return boolean success
+ * @param string $id unique cache content identifier
+ * @param string $name template name
+ * @param string $cache_id cache id
+ * @param string $compile_id compile id
+ * @param integer|null $exp_time seconds till expiration time in seconds or null
+ * @param string $content content to cache
+ *
+ * @return boolean success
*/
protected function save($id, $name, $cache_id, $compile_id, $exp_time, $content)
{
$this->save->execute(array(
- 'id' => $id,
- 'name' => $name,
- 'cache_id' => $cache_id,
- 'compile_id' => $compile_id,
- 'content' => $content,
- ));
+ 'id' => $id,
+ 'name' => $name,
+ 'cache_id' => $cache_id,
+ 'compile_id' => $compile_id,
+ 'content' => $content,
+ ));
+
return !!$this->save->rowCount();
}
-
+
/**
* Delete content from cache
*
- * @param string $name template name
- * @param string $cache_id cache id
- * @param string $compile_id compile id
- * @param integer|null $exp_time seconds till expiration or null
- * @return integer number of deleted caches
+ * @param string $name template name
+ * @param string $cache_id cache id
+ * @param string $compile_id compile id
+ * @param integer|null $exp_time seconds till expiration or null
+ *
+ * @return integer number of deleted caches
*/
protected function delete($name, $cache_id, $compile_id, $exp_time)
{
if ($name === null && $cache_id === null && $compile_id === null && $exp_time === null) {
// returning the number of deleted caches would require a second query to count them
$query = $this->db->query('TRUNCATE TABLE output_cache');
- return -1;
+
+ return - 1;
}
// build the filter
$where = array();
}
// equal test cache_id and match sub-groups
if ($cache_id !== null) {
- $where[] = '(cache_id = '. $this->db->quote($cache_id)
- . ' OR cache_id LIKE '. $this->db->quote($cache_id .'|%') .')';
+ $where[] = '(cache_id = ' . $this->db->quote($cache_id)
+ . ' OR cache_id LIKE ' . $this->db->quote($cache_id . '|%') . ')';
}
// run delete query
$query = $this->db->query('DELETE FROM output_cache WHERE ' . join(' AND ', $where));
+
return $query->rowCount();
}
}
/**
* Extends All Resource
- *
* Resource Implementation modifying the extends-Resource to walk
* through the template_dirs and inherit all templates of the same name
- *
+ *
* @package Resource-examples
- * @author Rodney Rehm
+ * @author Rodney Rehm
*/
-class Smarty_Resource_Extendsall extends Smarty_Internal_Resource_Extends {
-
+class Smarty_Resource_Extendsall extends Smarty_Internal_Resource_Extends
+{
/**
* populate Source Object with meta data from Resource
*
- * @param Smarty_Template_Source $source source object
- * @param Smarty_Internal_Template $_template template object
+ * @param Smarty_Template_Source $source source object
+ * @param Smarty_Internal_Template $_template template object
+ *
* @return void
*/
- public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)
+ public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
{
$uid = '';
$sources = array();
$exists = true;
foreach ($_template->smarty->getTemplateDir() as $key => $directory) {
try {
- $s = Smarty_Resource::source(null, $source->smarty, '[' . $key . ']' . $source->name );
+ $s = Smarty_Resource::source(null, $source->smarty, '[' . $key . ']' . $source->name);
if (!$s->exists) {
continue;
}
$sources[$s->uid] = $s;
$uid .= $s->filepath;
}
- catch (SmartyException $e) {}
+ catch (SmartyException $e) {
+ }
}
-
+
if (!$sources) {
$source->exists = false;
$source->template = $_template;
+
return;
}
-
+
$sources = array_reverse($sources, true);
reset($sources);
$s = current($sources);
-
+
$source->components = $sources;
$source->filepath = $s->filepath;
$source->uid = sha1($uid);
// need the template at getContent()
$source->template = $_template;
}
-}
-
-?>
\ No newline at end of file
+}
/**
* MySQL Resource
- *
* Resource Implementation based on the Custom API to use
* MySQL as the storage resource for Smarty's templates and configs.
- *
* Table definition:
* <pre>CREATE TABLE IF NOT EXISTS `templates` (
* `name` varchar(100) NOT NULL,
* `source` text,
* PRIMARY KEY (`name`)
* ) ENGINE=InnoDB DEFAULT CHARSET=utf8;</pre>
- *
* Demo data:
* <pre>INSERT INTO `templates` (`name`, `modified`, `source`) VALUES ('test.tpl', "2010-12-25 22:00:00", '{$x="hello world"}{$x}');</pre>
*
* @package Resource-examples
- * @author Rodney Rehm
+ * @author Rodney Rehm
*/
-class Smarty_Resource_Mysql extends Smarty_Resource_Custom {
+class Smarty_Resource_Mysql extends Smarty_Resource_Custom
+{
// PDO instance
protected $db;
// prepared fetch() statement
// prepared fetchTimestamp() statement
protected $mtime;
- public function __construct() {
+ public function __construct()
+ {
try {
- $this->db = new PDO("mysql:dbname=test;host=127.0.0.1", "smarty", "smarty");
- } catch (PDOException $e) {
+ $this->db = new PDO("mysql:dbname=test;host=127.0.0.1", "smarty");
+ }
+ catch (PDOException $e) {
throw new SmartyException('Mysql Resource failed: ' . $e->getMessage());
}
$this->fetch = $this->db->prepare('SELECT modified, source FROM templates WHERE name = :name');
$this->mtime = $this->db->prepare('SELECT modified FROM templates WHERE name = :name');
}
-
+
/**
* Fetch a template and its modification time from database
*
- * @param string $name template name
- * @param string $source template source
- * @param integer $mtime template modification timestamp (epoch)
+ * @param string $name template name
+ * @param string $source template source
+ * @param integer $mtime template modification timestamp (epoch)
+ *
* @return void
*/
protected function fetch($name, &$source, &$mtime)
$mtime = null;
}
}
-
+
/**
* Fetch a template's modification time from database
*
* @note implementing this method is optional. Only implement it if modification times can be accessed faster than loading the comple template source.
- * @param string $name template name
+ *
+ * @param string $name template name
+ *
* @return integer timestamp (epoch) the template was modified
*/
- protected function fetchTimestamp($name) {
+ protected function fetchTimestamp($name)
+ {
$this->mtime->execute(array('name' => $name));
$mtime = $this->mtime->fetchColumn();
$this->mtime->closeCursor();
+
return strtotime($mtime);
}
}
/**
* MySQL Resource
- *
* Resource Implementation based on the Custom API to use
* MySQL as the storage resource for Smarty's templates and configs.
- *
* Note that this MySQL implementation fetches the source and timestamps in
- * a single database query, instead of two seperate like resource.mysql.php does.
- *
+ * a single database query, instead of two separate like resource.mysql.php does.
* Table definition:
* <pre>CREATE TABLE IF NOT EXISTS `templates` (
* `name` varchar(100) NOT NULL,
* `source` text,
* PRIMARY KEY (`name`)
* ) ENGINE=InnoDB DEFAULT CHARSET=utf8;</pre>
- *
* Demo data:
* <pre>INSERT INTO `templates` (`name`, `modified`, `source`) VALUES ('test.tpl', "2010-12-25 22:00:00", '{$x="hello world"}{$x}');</pre>
*
* @package Resource-examples
- * @author Rodney Rehm
+ * @author Rodney Rehm
*/
-class Smarty_Resource_Mysqls extends Smarty_Resource_Custom {
+class Smarty_Resource_Mysqls extends Smarty_Resource_Custom
+{
// PDO instance
protected $db;
// prepared fetch() statement
protected $fetch;
- public function __construct() {
+ public function __construct()
+ {
try {
- $this->db = new PDO("mysql:dbname=test;host=127.0.0.1", "smarty", "smarty");
- } catch (PDOException $e) {
+ $this->db = new PDO("mysql:dbname=test;host=127.0.0.1", "smarty");
+ }
+ catch (PDOException $e) {
throw new SmartyException('Mysql Resource failed: ' . $e->getMessage());
}
$this->fetch = $this->db->prepare('SELECT modified, source FROM templates WHERE name = :name');
}
-
+
/**
* Fetch a template and its modification time from database
*
- * @param string $name template name
- * @param string $source template source
- * @param integer $mtime template modification timestamp (epoch)
+ * @param string $name template name
+ * @param string $source template source
+ * @param integer $mtime template modification timestamp (epoch)
+ *
* @return void
*/
protected function fetch($name, &$source, &$mtime)
<HTML>
<HEAD>
-<TITLE>{$title} - {$Name}</TITLE>
+ <TITLE>{$title} - {$Name}</TITLE>
</HEAD>
<BODY bgcolor="#ffffff">
<PRE>
{* bold and title are read from the config file *}
-{if #bold#}<b>{/if}
-{* capitalize the first letters of each word of the title *}
-Title: {#title#|capitalize}
-{if #bold#}</b>{/if}
+ {if #bold#}<b>{/if}
+ {* capitalize the first letters of each word of the title *}
+ Title: {#title#|capitalize}
+ {if #bold#}</b>{/if}
-The current date and time is {$smarty.now|date_format:"%Y-%m-%d %H:%M:%S"}
+ The current date and time is {$smarty.now|date_format:"%Y-%m-%d %H:%M:%S"}
-The value of global assigned variable $SCRIPT_NAME is {$SCRIPT_NAME}
+ The value of global assigned variable $SCRIPT_NAME is {$SCRIPT_NAME}
-Example of accessing server environment variable SERVER_NAME: {$smarty.server.SERVER_NAME}
+ Example of accessing server environment variable SERVER_NAME: {$smarty.server.SERVER_NAME}
-The value of {ldelim}$Name{rdelim} is <b>{$Name}</b>
+ The value of {ldelim}$Name{rdelim} is <b>{$Name}</b>
variable modifier example of {ldelim}$Name|upper{rdelim}
An example of a section loop:
-{section name=outer
-loop=$FirstName}
-{if $smarty.section.outer.index is odd by 2}
- {$smarty.section.outer.rownum} . {$FirstName[outer]} {$LastName[outer]}
-{else}
- {$smarty.section.outer.rownum} * {$FirstName[outer]} {$LastName[outer]}
-{/if}
-{sectionelse}
- none
-{/section}
-
-An example of section looped key values:
-
-{section name=sec1 loop=$contacts}
- phone: {$contacts[sec1].phone}<br>
- fax: {$contacts[sec1].fax}<br>
- cell: {$contacts[sec1].cell}<br>
-{/section}
-<p>
-
-testing strip tags
-{strip}
+ {section name=outer
+ loop=$FirstName}
+ {if $smarty.section.outer.index is odd by 2}
+ {$smarty.section.outer.rownum} . {$FirstName[outer]} {$LastName[outer]}
+ {else}
+ {$smarty.section.outer.rownum} * {$FirstName[outer]} {$LastName[outer]}
+ {/if}
+ {sectionelse}
+ none
+ {/section}
+
+ An example of section looped key values:
+
+ {section name=sec1 loop=$contacts}
+ phone: {$contacts[sec1].phone}
+ <br>
+
+ fax: {$contacts[sec1].fax}
+ <br>
+
+ cell: {$contacts[sec1].cell}
+ <br>
+ {/section}
+ <p>
+
+ testing strip tags
+ {strip}
<table border=0>
- <tr>
- <td>
- <A HREF="{$SCRIPT_NAME}">
- <font color="red">This is a test </font>
- </A>
- </td>
- </tr>
+ <tr>
+ <td>
+ <A HREF="{$SCRIPT_NAME}">
+ <font color="red">This is a test </font>
+ </A>
+ </td>
+ </tr>
</table>
-{/strip}
+ {/strip}
</PRE>
This is an example of the html_select_date function:
<form>
-{html_select_date start_year=1998 end_year=2010}
+ {html_select_date start_year=1998 end_year=2010}
</form>
This is an example of the html_select_time function:
<form>
-{html_select_time use_24_hours=false}
+ {html_select_time use_24_hours=false}
</form>
This is an example of the html_options function:
<form>
-<select name=states>
-{html_options values=$option_values selected=$option_selected output=$option_output}
-</select>
+ <select name=states>
+ {html_options values=$option_values selected=$option_selected output=$option_output}
+ </select>
</form>
{include file="footer.tpl"}
/**
* Project: Smarty: the PHP compiling template engine
* File: Smarty.class.php
- * SVN: $Id: Smarty.class.php 4614 2012-05-24 15:13:19Z rodneyrehm $
- *
+ * SVN: $Id: Smarty.class.php 4848 2014-06-08 18:12:09Z Uwe.Tews@googlemail.com $
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
- *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
* For questions, help, comments, discussion, etc., please join the
* Smarty mailing list. Send a blank e-mail to
* smarty-discussion-subscribe@googlegroups.com
*
- * @link http://www.smarty.net/
+ * @link http://www.smarty.net/
* @copyright 2008 New Digital Group, Inc.
- * @author Monte Ohrt <monte at ohrt dot com>
- * @author Uwe Tews
- * @author Rodney Rehm
- * @package Smarty
- * @version 3.1-DEV
+ * @author Monte Ohrt <monte at ohrt dot com>
+ * @author Uwe Tews
+ * @author Rodney Rehm
+ * @package Smarty
+ * @version 3.1.19
*/
/**
define('SMARTY_PLUGINS_DIR', SMARTY_DIR . 'plugins' . DS);
}
if (!defined('SMARTY_MBSTRING')) {
- define('SMARTY_MBSTRING', function_exists('mb_strlen'));
+ define('SMARTY_MBSTRING', function_exists('mb_split'));
}
if (!defined('SMARTY_RESOURCE_CHAR_SET')) {
// UTF-8 can only be done properly when mbstring is available!
/**
* Load always needed external class files
*/
-include_once SMARTY_SYSPLUGINS_DIR.'smarty_internal_data.php';
-include_once SMARTY_SYSPLUGINS_DIR.'smarty_internal_templatebase.php';
-include_once SMARTY_SYSPLUGINS_DIR.'smarty_internal_template.php';
-include_once SMARTY_SYSPLUGINS_DIR.'smarty_resource.php';
-include_once SMARTY_SYSPLUGINS_DIR.'smarty_internal_resource_file.php';
-include_once SMARTY_SYSPLUGINS_DIR.'smarty_cacheresource.php';
-include_once SMARTY_SYSPLUGINS_DIR.'smarty_internal_cacheresource_file.php';
+include_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_data.php';
+include_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_templatebase.php';
+include_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_template.php';
+include_once SMARTY_SYSPLUGINS_DIR . 'smarty_resource.php';
+include_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_resource_file.php';
+include_once SMARTY_SYSPLUGINS_DIR . 'smarty_cacheresource.php';
+include_once SMARTY_SYSPLUGINS_DIR . 'smarty_internal_cacheresource_file.php';
/**
* This is the main Smarty class
+ *
* @package Smarty
*/
-class Smarty extends Smarty_Internal_TemplateBase {
-
+class Smarty extends Smarty_Internal_TemplateBase
+{
/**#@+
* constant definitions
*/
/**
* smarty version
*/
- const SMARTY_VERSION = 'Smarty-3.1.11';
+ const SMARTY_VERSION = 'Smarty-3.1.19';
/**
* define variable scopes
const CACHING_OFF = 0;
const CACHING_LIFETIME_CURRENT = 1;
const CACHING_LIFETIME_SAVED = 2;
+ /**
+ * define constant for clearing cache files be saved expiration datees
+ */
+ const CLEAR_EXPIRED = - 1;
+
/**
* define compile check modes
*/
* Flag denoting if PCRE should run in UTF-8 mode
*/
public static $_UTF8_MODIFIER = 'u';
-
+
/**
* Flag denoting if operating system is windows
*/
public static $_IS_WINDOWS = false;
-
+
/**#@+
* variables
*/
/**
* auto literal on delimiters with whitspace
+ *
* @var boolean
*/
public $auto_literal = true;
/**
* display error on not assigned variables
+ *
* @var boolean
*/
public $error_unassigned = false;
/**
* look up relative filepaths in include_path
+ *
* @var boolean
*/
public $use_include_path = false;
/**
* template directory
+ *
* @var array
*/
private $template_dir = array();
/**
* joined template directory string used in cache keys
+ *
* @var string
*/
public $joined_template_dir = null;
/**
* joined config directory string used in cache keys
+ *
* @var string
*/
public $joined_config_dir = null;
/**
* default template handler
+ *
* @var callable
*/
public $default_template_handler_func = null;
/**
* default config handler
+ *
* @var callable
*/
public $default_config_handler_func = null;
/**
* default plugin handler
+ *
* @var callable
*/
public $default_plugin_handler_func = null;
/**
* compile directory
+ *
* @var string
*/
private $compile_dir = null;
/**
* plugins directory
+ *
* @var array
*/
private $plugins_dir = array();
/**
* cache directory
+ *
* @var string
*/
private $cache_dir = null;
/**
* config directory
+ *
* @var array
*/
private $config_dir = array();
/**
* force template compiling?
+ *
* @var boolean
*/
public $force_compile = false;
/**
* check template for modifications?
+ *
* @var boolean
*/
public $compile_check = true;
/**
* use sub dirs for compiled/cached files?
+ *
* @var boolean
*/
public $use_sub_dirs = false;
/**
* allow ambiguous resources (that are made unique by the resource handler)
+ *
* @var boolean
*/
public $allow_ambiguous_resources = false;
/**
* caching enabled
+ *
* @var boolean
*/
public $caching = false;
/**
* merge compiled includes
+ *
* @var boolean
*/
public $merge_compiled_includes = false;
+ /**
+ * template inheritance merge compiled includes
+ *
+ * @var boolean
+ */
+ public $inheritance_merge_compiled_includes = true;
/**
* cache lifetime in seconds
+ *
* @var integer
*/
public $cache_lifetime = 3600;
/**
* force cache file creation
+ *
* @var boolean
*/
public $force_cache = false;
public $compile_id = null;
/**
* template left-delimiter
+ *
* @var string
*/
public $left_delimiter = "{";
/**
* template right-delimiter
+ *
* @var string
*/
public $right_delimiter = "}";
*/
/**
* class name
- *
* This should be instance of Smarty_Security.
*
* @var string
public $allow_php_templates = false;
/**
* Should compiled-templates be prevented from being called directly?
- *
* {@internal
* Currently used by Smarty_Internal_Template only.
* }}
/**#@-*/
/**
* debug mode
- *
* Setting this to true enables the debug-console.
*
* @var boolean
* <li>NONE => no debugging control allowed</li>
* <li>URL => enable debugging when SMARTY_DEBUG is found in the URL.</li>
* </ul>
+ *
* @var string
*/
public $debugging_ctrl = 'NONE';
/**
* Name of debugging URL-param.
- *
* Only used when $debugging_ctrl is set to 'URL'.
* The name of the URL-parameter that activates debugging.
*
public $smarty_debug_id = 'SMARTY_DEBUG';
/**
* Path of debug template.
+ *
* @var string
*/
public $debug_tpl = null;
/**
* When set, smarty uses this value as error_reporting-level.
+ *
* @var int
*/
public $error_reporting = null;
/**
* Internal flag for getTags()
+ *
* @var boolean
*/
public $get_used_tags = false;
/**
* Controls whether variables with the same name overwrite each other.
+ *
* @var boolean
*/
public $config_overwrite = true;
/**
* Controls whether config values of on/true/yes and off/false/no get converted to boolean.
+ *
* @var boolean
*/
public $config_booleanize = true;
/**
* Controls whether hidden config sections/vars are read from the file.
+ *
* @var boolean
*/
public $config_read_hidden = false;
/**
* locking concurrent compiles
+ *
* @var boolean
*/
public $compile_locking = true;
/**
* Controls whether cache resources should emply locking mechanism
+ *
* @var boolean
*/
public $cache_locking = false;
/**
* seconds to wait for acquiring a lock before ignoring the write lock
+ *
* @var float
*/
public $locking_timeout = 10;
/**
* global template functions
+ *
* @var array
*/
public $template_functions = array();
/**
* resource type used if none given
- *
* Must be an valid key of $registered_resources.
+ *
* @var string
*/
public $default_resource_type = 'file';
/**
* caching type
- *
* Must be an element of $cache_resource_types.
*
* @var string
public $caching_type = 'file';
/**
* internal config properties
+ *
* @var array
*/
public $properties = array();
/**
* config type
+ *
* @var string
*/
public $default_config_type = 'file';
/**
* cached template objects
+ *
* @var array
*/
public $template_objects = array();
/**
* check If-Modified-Since headers
+ *
* @var boolean
*/
public $cache_modified_check = false;
/**
* registered plugins
+ *
* @var array
*/
public $registered_plugins = array();
/**
* plugin search order
+ *
* @var array
*/
public $plugin_search_order = array('function', 'block', 'compiler', 'class');
/**
* registered objects
+ *
* @var array
*/
public $registered_objects = array();
/**
* registered classes
+ *
* @var array
*/
public $registered_classes = array();
/**
* registered filters
+ *
* @var array
*/
public $registered_filters = array();
/**
* registered resources
+ *
* @var array
*/
public $registered_resources = array();
/**
* resource handler cache
+ *
* @var array
*/
public $_resource_handlers = array();
/**
* registered cache resources
+ *
* @var array
*/
public $registered_cache_resources = array();
/**
* cache resource handler cache
+ *
* @var array
*/
public $_cacheresource_handlers = array();
/**
* autoload filter
+ *
* @var array
*/
public $autoload_filters = array();
/**
* default modifier
+ *
* @var array
*/
public $default_modifiers = array();
/**
* autoescape variable output
+ *
* @var boolean
*/
public $escape_html = false;
/**
* global internal smarty vars
+ *
* @var array
*/
public static $_smarty_vars = array();
/**
* start time for execution time calculation
+ *
* @var int
*/
public $start_time = 0;
/**
* default file permissions
+ *
* @var int
*/
public $_file_perms = 0644;
/**
* default dir permissions
+ *
* @var int
*/
public $_dir_perms = 0771;
/**
* block tag hierarchy
+ *
* @var array
*/
public $_tag_stack = array();
/**
* self pointer to Smarty object
+ *
* @var Smarty
*/
public $smarty;
/**
* required by the compiler for BC
+ *
* @var string
*/
public $_current_file = null;
/**
* internal flag to enable parser debugging
+ *
* @var bool
*/
public $_parserdebug = false;
/**
* Initialize new Smarty object
- *
+
*/
public function __construct()
{
}
}
-
/**
* Class destructor
*/
$this->smarty = $this;
}
-
/**
* <<magic>> Generic getter.
- *
* Calls the appropriate getter function.
* Issues an E_USER_NOTICE if no valid getter is found.
*
- * @param string $name property name
+ * @param string $name property name
+ *
* @return mixed
*/
public function __get($name)
{
$allowed = array(
- 'template_dir' => 'getTemplateDir',
- 'config_dir' => 'getConfigDir',
- 'plugins_dir' => 'getPluginsDir',
- 'compile_dir' => 'getCompileDir',
- 'cache_dir' => 'getCacheDir',
+ 'template_dir' => 'getTemplateDir',
+ 'config_dir' => 'getConfigDir',
+ 'plugins_dir' => 'getPluginsDir',
+ 'compile_dir' => 'getCompileDir',
+ 'cache_dir' => 'getCacheDir',
);
if (isset($allowed[$name])) {
return $this->{$allowed[$name]}();
} else {
- trigger_error('Undefined property: '. get_class($this) .'::$'. $name, E_USER_NOTICE);
+ trigger_error('Undefined property: ' . get_class($this) . '::$' . $name, E_USER_NOTICE);
}
}
/**
* <<magic>> Generic setter.
- *
* Calls the appropriate setter function.
* Issues an E_USER_NOTICE if no valid setter is found.
*
public function __set($name, $value)
{
$allowed = array(
- 'template_dir' => 'setTemplateDir',
- 'config_dir' => 'setConfigDir',
- 'plugins_dir' => 'setPluginsDir',
- 'compile_dir' => 'setCompileDir',
- 'cache_dir' => 'setCacheDir',
+ 'template_dir' => 'setTemplateDir',
+ 'config_dir' => 'setConfigDir',
+ 'plugins_dir' => 'setPluginsDir',
+ 'compile_dir' => 'setCompileDir',
+ 'cache_dir' => 'setCacheDir',
);
if (isset($allowed[$name])) {
/**
* Check if a template resource exists
*
- * @param string $resource_name template name
+ * @param string $resource_name template name
+ *
* @return boolean status
*/
public function templateExists($resource_name)
// check if it does exists
$result = $tpl->source->exists;
$this->template_objects = $save;
+
return $result;
}
/**
* Returns a single or all global variables
*
- * @param object $smarty
- * @param string $varname variable name or null
+ * @param string $varname variable name or null
+ *
* @return string variable value or or array of variables
*/
public function getGlobal($varname = null)
foreach (self::$global_tpl_vars AS $key => $var) {
$_result[$key] = $var->value;
}
+
return $_result;
}
}
/**
* Empty cache folder
*
- * @param integer $exp_time expiration time
- * @param string $type resource type
+ * @param integer $exp_time expiration time
+ * @param string $type resource type
+ *
* @return integer number of cache files deleted
*/
- function clearAllCache($exp_time = null, $type = null)
+ public function clearAllCache($exp_time = null, $type = null)
{
// load cache resource and call clearAll
$_cache_resource = Smarty_CacheResource::load($this, $type);
Smarty_CacheResource::invalidLoadedCache($this);
+
return $_cache_resource->clearAll($this, $exp_time);
}
/**
* Empty cache for a specific template
*
- * @param string $template_name template name
- * @param string $cache_id cache id
- * @param string $compile_id compile id
- * @param integer $exp_time expiration time
- * @param string $type resource type
+ * @param string $template_name template name
+ * @param string $cache_id cache id
+ * @param string $compile_id compile id
+ * @param integer $exp_time expiration time
+ * @param string $type resource type
+ *
* @return integer number of cache files deleted
*/
public function clearCache($template_name, $cache_id = null, $compile_id = null, $exp_time = null, $type = null)
// load cache resource and call clear
$_cache_resource = Smarty_CacheResource::load($this, $type);
Smarty_CacheResource::invalidLoadedCache($this);
+
return $_cache_resource->clear($this, $template_name, $cache_id, $compile_id, $exp_time);
}
/**
* Loads security class and enables security
*
- * @param string|Smarty_Security $security_class if a string is used, it must be class-name
- * @return Smarty current Smarty instance for chaining
- * @throws SmartyException when an invalid class name is provided
+ * @param string|Smarty_Security $security_class if a string is used, it must be class-name
+ *
+ * @return Smarty current Smarty instance for chaining
+ * @throws SmartyException when an invalid class name is provided
*/
public function enableSecurity($security_class = null)
{
if ($security_class instanceof Smarty_Security) {
$this->security_policy = $security_class;
+
return $this;
} elseif (is_object($security_class)) {
throw new SmartyException("Class '" . get_class($security_class) . "' must extend Smarty_Security.");
/**
* Disable security
+ *
* @return Smarty current Smarty instance for chaining
*/
public function disableSecurity()
/**
* Set template directory
*
- * @param string|array $template_dir directory(s) of template sources
- * @return Smarty current Smarty instance for chaining
+ * @param string|array $template_dir directory(s) of template sources
+ *
+ * @return Smarty current Smarty instance for chaining
*/
public function setTemplateDir($template_dir)
{
$this->template_dir = array();
foreach ((array) $template_dir as $k => $v) {
- $this->template_dir[$k] = rtrim($v, '/\\') . DS;
+ $this->template_dir[$k] = preg_replace('#(\w+)(/|\\\\){1,}#', '$1$2', rtrim($v, '/\\')) . DS;
}
$this->joined_template_dir = join(DIRECTORY_SEPARATOR, $this->template_dir);
+
return $this;
}
/**
* Add template directory(s)
*
- * @param string|array $template_dir directory(s) of template sources
- * @param string $key of the array element to assign the template dir to
- * @return Smarty current Smarty instance for chaining
+ * @param string|array $template_dir directory(s) of template sources
+ * @param string $key of the array element to assign the template dir to
+ *
+ * @return Smarty current Smarty instance for chaining
* @throws SmartyException when the given template directory is not valid
*/
- public function addTemplateDir($template_dir, $key=null)
+ public function addTemplateDir($template_dir, $key = null)
{
// make sure we're dealing with an array
$this->template_dir = (array) $this->template_dir;
if (is_array($template_dir)) {
foreach ($template_dir as $k => $v) {
+ $v = preg_replace('#(\w+)(/|\\\\){1,}#', '$1$2', rtrim($v, '/\\')) . DS;
if (is_int($k)) {
// indexes are not merged but appended
- $this->template_dir[] = rtrim($v, '/\\') . DS;
+ $this->template_dir[] = $v;
} else {
// string indexes are overridden
- $this->template_dir[$k] = rtrim($v, '/\\') . DS;
+ $this->template_dir[$k] = $v;
}
}
- } elseif ($key !== null) {
- // override directory at specified index
- $this->template_dir[$key] = rtrim($template_dir, '/\\') . DS;
} else {
- // append new directory
- $this->template_dir[] = rtrim($template_dir, '/\\') . DS;
+ $v = preg_replace('#(\w+)(/|\\\\){1,}#', '$1$2', rtrim($template_dir, '/\\')) . DS;
+ if ($key !== null) {
+ // override directory at specified index
+ $this->template_dir[$key] = $v;
+ } else {
+ // append new directory
+ $this->template_dir[] = $v;
+ }
}
$this->joined_template_dir = join(DIRECTORY_SEPARATOR, $this->template_dir);
+
return $this;
}
/**
* Get template directories
*
- * @param mixed index of directory to get, null to get all
+ * @param mixed $index index of directory to get, null to get all
+ *
* @return array|string list of template directories, or directory of $index
*/
- public function getTemplateDir($index=null)
+ public function getTemplateDir($index = null)
{
if ($index !== null) {
return isset($this->template_dir[$index]) ? $this->template_dir[$index] : null;
}
- return (array)$this->template_dir;
+ return (array) $this->template_dir;
}
/**
* Set config directory
*
- * @param string|array $template_dir directory(s) of configuration sources
- * @return Smarty current Smarty instance for chaining
+ * @param $config_dir
+ *
+ * @return Smarty current Smarty instance for chaining
*/
public function setConfigDir($config_dir)
{
$this->config_dir = array();
foreach ((array) $config_dir as $k => $v) {
- $this->config_dir[$k] = rtrim($v, '/\\') . DS;
+ $this->config_dir[$k] = preg_replace('#(\w+)(/|\\\\){1,}#', '$1$2', rtrim($v, '/\\')) . DS;
}
$this->joined_config_dir = join(DIRECTORY_SEPARATOR, $this->config_dir);
+
return $this;
}
/**
* Add config directory(s)
*
- * @param string|array $config_dir directory(s) of config sources
- * @param string key of the array element to assign the config dir to
+ * @param string|array $config_dir directory(s) of config sources
+ * @param mixed $key key of the array element to assign the config dir to
+ *
* @return Smarty current Smarty instance for chaining
*/
- public function addConfigDir($config_dir, $key=null)
+ public function addConfigDir($config_dir, $key = null)
{
// make sure we're dealing with an array
$this->config_dir = (array) $this->config_dir;
if (is_array($config_dir)) {
foreach ($config_dir as $k => $v) {
+ $v = preg_replace('#(\w+)(/|\\\\){1,}#', '$1$2', rtrim($v, '/\\')) . DS;
if (is_int($k)) {
// indexes are not merged but appended
- $this->config_dir[] = rtrim($v, '/\\') . DS;
+ $this->config_dir[] = $v;
} else {
// string indexes are overridden
- $this->config_dir[$k] = rtrim($v, '/\\') . DS;
+ $this->config_dir[$k] = $v;
}
}
- } elseif( $key !== null ) {
- // override directory at specified index
- $this->config_dir[$key] = rtrim($config_dir, '/\\') . DS;
} else {
- // append new directory
- $this->config_dir[] = rtrim($config_dir, '/\\') . DS;
+ $v = preg_replace('#(\w+)(/|\\\\){1,}#', '$1$2', rtrim($config_dir, '/\\')) . DS;
+ if ($key !== null) {
+ // override directory at specified index
+ $this->config_dir[$key] = rtrim($v, '/\\') . DS;
+ } else {
+ // append new directory
+ $this->config_dir[] = rtrim($v, '/\\') . DS;
+ }
}
$this->joined_config_dir = join(DIRECTORY_SEPARATOR, $this->config_dir);
+
return $this;
}
/**
* Get config directory
*
- * @param mixed index of directory to get, null to get all
+ * @param mixed $index index of directory to get, null to get all
+ *
* @return array|string configuration directory
*/
- public function getConfigDir($index=null)
+ public function getConfigDir($index = null)
{
if ($index !== null) {
return isset($this->config_dir[$index]) ? $this->config_dir[$index] : null;
}
- return (array)$this->config_dir;
+ return (array) $this->config_dir;
}
/**
* Set plugins directory
*
- * @param string|array $plugins_dir directory(s) of plugins
- * @return Smarty current Smarty instance for chaining
+ * @param string|array $plugins_dir directory(s) of plugins
+ *
+ * @return Smarty current Smarty instance for chaining
*/
public function setPluginsDir($plugins_dir)
{
$this->plugins_dir = array();
- foreach ((array)$plugins_dir as $k => $v) {
+ foreach ((array) $plugins_dir as $k => $v) {
$this->plugins_dir[$k] = rtrim($v, '/\\') . DS;
}
/**
* Adds directory of plugin files
*
- * @param object $smarty
- * @param string $ |array $ plugins folder
+ * @param $plugins_dir
+ *
* @return Smarty current Smarty instance for chaining
*/
public function addPluginsDir($plugins_dir)
}
$this->plugins_dir = array_unique($this->plugins_dir);
+
return $this;
}
*/
public function getPluginsDir()
{
- return (array)$this->plugins_dir;
+ return (array) $this->plugins_dir;
}
/**
* Set compile directory
*
- * @param string $compile_dir directory to store compiled templates in
+ * @param string $compile_dir directory to store compiled templates in
+ *
* @return Smarty current Smarty instance for chaining
*/
public function setCompileDir($compile_dir)
if (!isset(Smarty::$_muted_directories[$this->compile_dir])) {
Smarty::$_muted_directories[$this->compile_dir] = null;
}
+
return $this;
}
/**
* Set cache directory
*
- * @param string $cache_dir directory to store cached templates in
+ * @param string $cache_dir directory to store cached templates in
+ *
* @return Smarty current Smarty instance for chaining
*/
public function setCacheDir($cache_dir)
if (!isset(Smarty::$_muted_directories[$this->cache_dir])) {
Smarty::$_muted_directories[$this->cache_dir] = null;
}
+
return $this;
}
/**
* Set default modifiers
*
- * @param array|string $modifiers modifier or list of modifiers to set
- * @return Smarty current Smarty instance for chaining
+ * @param array|string $modifiers modifier or list of modifiers to set
+ *
+ * @return Smarty current Smarty instance for chaining
*/
public function setDefaultModifiers($modifiers)
{
$this->default_modifiers = (array) $modifiers;
+
return $this;
}
/**
* Add default modifiers
*
- * @param array|string $modifiers modifier or list of modifiers to add
- * @return Smarty current Smarty instance for chaining
+ * @param array|string $modifiers modifier or list of modifiers to add
+ *
+ * @return Smarty current Smarty instance for chaining
*/
public function addDefaultModifiers($modifiers)
{
return $this->default_modifiers;
}
-
/**
* Set autoload filters
*
- * @param array $filters filters to load automatically
- * @param string $type "pre", "output", … specify the filter type to set. Defaults to none treating $filters' keys as the appropriate types
+ * @param array $filters filters to load automatically
+ * @param string $type "pre", "output", … specify the filter type to set. Defaults to none treating $filters' keys as the appropriate types
+ *
* @return Smarty current Smarty instance for chaining
*/
- public function setAutoloadFilters($filters, $type=null)
+ public function setAutoloadFilters($filters, $type = null)
{
if ($type !== null) {
$this->autoload_filters[$type] = (array) $filters;
/**
* Add autoload filters
*
- * @param array $filters filters to load automatically
- * @param string $type "pre", "output", … specify the filter type to set. Defaults to none treating $filters' keys as the appropriate types
+ * @param array $filters filters to load automatically
+ * @param string $type "pre", "output", … specify the filter type to set. Defaults to none treating $filters' keys as the appropriate types
+ *
* @return Smarty current Smarty instance for chaining
*/
- public function addAutoloadFilters($filters, $type=null)
+ public function addAutoloadFilters($filters, $type = null)
{
if ($type !== null) {
if (!empty($this->autoload_filters[$type])) {
/**
* Get autoload filters
*
- * @param string $type type of filter to get autoloads for. Defaults to all autoload filters
- * @return array array( 'type1' => array( 'filter1', 'filter2', … ) ) or array( 'filter1', 'filter2', …) if $type was specified
+ * @param string $type type of filter to get autoloads for. Defaults to all autoload filters
+ *
+ * @return array array( 'type1' => array( 'filter1', 'filter2', … ) ) or array( 'filter1', 'filter2', …) if $type was specified
*/
- public function getAutoloadFilters($type=null)
+ public function getAutoloadFilters($type = null)
{
if ($type !== null) {
return isset($this->autoload_filters[$type]) ? $this->autoload_filters[$type] : array();
/**
* set the debug template
*
- * @param string $tpl_name
- * @return Smarty current Smarty instance for chaining
+ * @param string $tpl_name
+ *
+ * @return Smarty current Smarty instance for chaining
* @throws SmartyException if file is not readable
*/
public function setDebugTemplate($tpl_name)
/**
* creates a template object
*
- * @param string $template the resource handle of the template file
- * @param mixed $cache_id cache id to be used with this template
- * @param mixed $compile_id compile id to be used with this template
- * @param object $parent next higher level of Smarty variables
- * @param boolean $do_clone flag is Smarty object shall be cloned
- * @return object template object
+ * @param string $template the resource handle of the template file
+ * @param mixed $cache_id cache id to be used with this template
+ * @param mixed $compile_id compile id to be used with this template
+ * @param object $parent next higher level of Smarty variables
+ * @param boolean $do_clone flag is Smarty object shall be cloned
+ *
+ * @return object template object
*/
public function createTemplate($template, $cache_id = null, $compile_id = null, $parent = null, $do_clone = true)
{
- if (!empty($cache_id) && (is_object($cache_id) || is_array($cache_id))) {
+ if ($cache_id !== null && (is_object($cache_id) || is_array($cache_id))) {
$parent = $cache_id;
$cache_id = null;
}
- if (!empty($parent) && is_array($parent)) {
+ if ($parent !== null && is_array($parent)) {
$data = $parent;
$parent = null;
} else {
$tpl->tpl_vars[$_key] = new Smarty_variable($_val);
}
}
+
return $tpl;
}
-
/**
* Takes unknown classes and loads plugin files for them
* class name format: Smarty_PluginType_PluginName
* plugin filename format: plugintype.pluginname.php
*
- * @param string $plugin_name class plugin name to load
- * @param bool $check check if already loaded
+ * @param string $plugin_name class plugin name to load
+ * @param bool $check check if already loaded
+ *
+ * @throws SmartyException
* @return string |boolean filepath of loaded file or false
*/
public function loadPlugin($plugin_name, $check = true)
// count($_name_parts) < 3 === !isset($_name_parts[2])
if (!isset($_name_parts[2]) || strtolower($_name_parts[0]) !== 'smarty') {
throw new SmartyException("plugin {$plugin_name} is not a valid name format");
- return false;
}
// if type is "internal", get plugin from sysplugins
if (strtolower($_name_parts[1]) == 'internal') {
$file = SMARTY_SYSPLUGINS_DIR . strtolower($plugin_name) . '.php';
if (file_exists($file)) {
require_once($file);
+
return $file;
} else {
return false;
}
// plugin filename is expected to be: [type].[name].php
$_plugin_filename = "{$_name_parts[1]}.{$_name_parts[2]}.php";
-
+
$_stream_resolve_include_path = function_exists('stream_resolve_include_path');
// loop through plugin dirs and find the plugin
- foreach($this->getPluginsDir() as $_plugin_dir) {
+ foreach ($this->getPluginsDir() as $_plugin_dir) {
$names = array(
$_plugin_dir . $_plugin_filename,
$_plugin_dir . strtolower($_plugin_filename),
foreach ($names as $file) {
if (file_exists($file)) {
require_once($file);
+
return $file;
}
if ($this->use_include_path && !preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $_plugin_dir)) {
} else {
$file = Smarty_Internal_Get_Include_Path::getIncludePath($file);
}
-
+
if ($file !== false) {
require_once($file);
+
return $file;
}
}
/**
* Compile all template files
*
- * @param string $extension file extension
- * @param bool $force_compile force all to recompile
- * @param int $time_limit
- * @param int $max_errors
+ * @param string $extension file extension
+ * @param bool $force_compile force all to recompile
+ * @param int $time_limit
+ * @param int $max_errors
+ *
* @return integer number of template files recompiled
*/
- public function compileAllTemplates($extention = '.tpl', $force_compile = false, $time_limit = 0, $max_errors = null)
+ public function compileAllTemplates($extension = '.tpl', $force_compile = false, $time_limit = 0, $max_errors = null)
{
- return Smarty_Internal_Utility::compileAllTemplates($extention, $force_compile, $time_limit, $max_errors, $this);
+ return Smarty_Internal_Utility::compileAllTemplates($extension, $force_compile, $time_limit, $max_errors, $this);
}
/**
* Compile all config files
*
- * @param string $extension file extension
- * @param bool $force_compile force all to recompile
- * @param int $time_limit
- * @param int $max_errors
+ * @param string $extension file extension
+ * @param bool $force_compile force all to recompile
+ * @param int $time_limit
+ * @param int $max_errors
+ *
* @return integer number of template files recompiled
*/
- public function compileAllConfig($extention = '.conf', $force_compile = false, $time_limit = 0, $max_errors = null)
+ public function compileAllConfig($extension = '.conf', $force_compile = false, $time_limit = 0, $max_errors = null)
{
- return Smarty_Internal_Utility::compileAllConfig($extention, $force_compile, $time_limit, $max_errors, $this);
+ return Smarty_Internal_Utility::compileAllConfig($extension, $force_compile, $time_limit, $max_errors, $this);
}
/**
* Delete compiled template file
*
- * @param string $resource_name template name
- * @param string $compile_id compile id
- * @param integer $exp_time expiration time
+ * @param string $resource_name template name
+ * @param string $compile_id compile id
+ * @param integer $exp_time expiration time
+ *
* @return integer number of template files deleted
*/
public function clearCompiledTemplate($resource_name = null, $compile_id = null, $exp_time = null)
return Smarty_Internal_Utility::clearCompiledTemplate($resource_name, $compile_id, $exp_time, $this);
}
-
/**
* Return array of tag/attributes of all tags used by an template
*
- * @param object $templae template object
- * @return array of tag/attributes
+ * @param Smarty_Internal_Template $template
+ *
+ * @return array of tag/attributes
*/
public function getTags(Smarty_Internal_Template $template)
{
/**
* Run installation test
*
- * @param array $errors Array to write errors into, rather than outputting them
+ * @param array $errors Array to write errors into, rather than outputting them
+ *
* @return boolean true if setup is fine, false if something is wrong
*/
- public function testInstall(&$errors=null)
+ public function testInstall(&$errors = null)
{
return Smarty_Internal_Utility::testInstall($this, $errors);
}
* Error Handler to mute expected messages
*
* @link http://php.net/set_error_handler
- * @param integer $errno Error level
+ *
+ * @param integer $errno Error level
+ * @param $errstr
+ * @param $errfile
+ * @param $errline
+ * @param $errcontext
+ *
* @return boolean
*/
public static function mutingErrorHandler($errno, $errstr, $errfile, $errline, $errcontext)
// add the SMARTY_DIR to the list of muted directories
if (!isset(Smarty::$_muted_directories[SMARTY_DIR])) {
$smarty_dir = realpath(SMARTY_DIR);
- Smarty::$_muted_directories[SMARTY_DIR] = array(
- 'file' => $smarty_dir,
- 'length' => strlen($smarty_dir),
- );
+ if ($smarty_dir !== false) {
+ Smarty::$_muted_directories[SMARTY_DIR] = array(
+ 'file' => $smarty_dir,
+ 'length' => strlen($smarty_dir),
+ );
+ }
}
// walk the muted directories and test against $errfile
if (!$dir) {
// resolve directory and length for speedy comparisons
$file = realpath($key);
+ if ($file === false) {
+ // this directory does not exist, remove and skip it
+ unset(Smarty::$_muted_directories[$key]);
+ continue;
+ }
$dir = array(
- 'file' => $file,
+ 'file' => $file,
'length' => strlen($file),
);
}
/**
* Smarty exception class
+ *
* @package Smarty
*/
-class SmartyException extends Exception {
+class SmartyException extends Exception
+{
+ public static $escape = false;
+
+ public function __toString()
+ {
+ return ' --> Smarty: ' . (self::$escape ? htmlentities($this->message) : $this->message) . ' <-- ';
+ }
}
/**
* Smarty compiler exception class
+ *
* @package Smarty
*/
-class SmartyCompilerException extends SmartyException {
+class SmartyCompilerException extends SmartyException
+{
+ public function __toString()
+ {
+ return ' --> Smarty Compiler: ' . $this->message . ' <-- ';
+ }
+
+ /**
+ * The line number of the template error
+ *
+ * @type int|null
+ */
+ public $line = null;
+ /**
+ * The template source snippet relating to the error
+ *
+ * @type string|null
+ */
+ public $source = null;
+ /**
+ * The raw text of the error message
+ *
+ * @type string|null
+ */
+ public $desc = null;
+ /**
+ * The resource identifier or template name
+ *
+ * @type string|null
+ */
+ public $template = null;
}
/**
function smartyAutoload($class)
{
$_class = strtolower($class);
- $_classes = array(
- 'smarty_config_source' => true,
- 'smarty_config_compiled' => true,
- 'smarty_security' => true,
- 'smarty_cacheresource' => true,
- 'smarty_cacheresource_custom' => true,
+ static $_classes = array(
+ 'smarty_config_source' => true,
+ 'smarty_config_compiled' => true,
+ 'smarty_security' => true,
+ 'smarty_cacheresource' => true,
+ 'smarty_cacheresource_custom' => true,
'smarty_cacheresource_keyvaluestore' => true,
- 'smarty_resource' => true,
- 'smarty_resource_custom' => true,
- 'smarty_resource_uncompiled' => true,
- 'smarty_resource_recompiled' => true,
+ 'smarty_resource' => true,
+ 'smarty_resource_custom' => true,
+ 'smarty_resource_uncompiled' => true,
+ 'smarty_resource_recompiled' => true,
);
if (!strncmp($_class, 'smarty_internal_', 16) || isset($_classes[$_class])) {
include SMARTY_SYSPLUGINS_DIR . $_class . '.php';
}
}
-
-?>
-<?php\r
-/**\r
- * Project: Smarty: the PHP compiling template engine\r
- * File: SmartyBC.class.php\r
- * SVN: $Id: $\r
- *\r
- * This library is free software; you can redistribute it and/or\r
- * modify it under the terms of the GNU Lesser General Public\r
- * License as published by the Free Software Foundation; either\r
- * version 2.1 of the License, or (at your option) any later version.\r
- *\r
- * This library is distributed in the hope that it will be useful,\r
- * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU\r
- * Lesser General Public License for more details.\r
- *\r
- * You should have received a copy of the GNU Lesser General Public\r
- * License along with this library; if not, write to the Free Software\r
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA\r
- *\r
- * For questions, help, comments, discussion, etc., please join the\r
- * Smarty mailing list. Send a blank e-mail to\r
- * smarty-discussion-subscribe@googlegroups.com\r
- *\r
- * @link http://www.smarty.net/\r
- * @copyright 2008 New Digital Group, Inc.\r
- * @author Monte Ohrt <monte at ohrt dot com>\r
- * @author Uwe Tews\r
- * @author Rodney Rehm\r
- * @package Smarty\r
- */\r
-/**\r
- * @ignore\r
- */\r
-require(dirname(__FILE__) . '/Smarty.class.php');\r
-\r
-/**\r
- * Smarty Backward Compatability Wrapper Class\r
- *\r
- * @package Smarty\r
- */\r
-class SmartyBC extends Smarty {\r
-\r
- /**\r
- * Smarty 2 BC\r
- * @var string\r
- */\r
- public $_version = self::SMARTY_VERSION;\r
-\r
- /**\r
- * Initialize new SmartyBC object\r
- *\r
- * @param array $options options to set during initialization, e.g. array( 'forceCompile' => false )\r
- */\r
- public function __construct(array $options=array())\r
- {\r
- parent::__construct($options);\r
- // register {php} tag\r
- $this->registerPlugin('block', 'php', 'smarty_php_tag');\r
- }\r
-\r
- /**\r
- * wrapper for assign_by_ref\r
- *\r
- * @param string $tpl_var the template variable name\r
- * @param mixed &$value the referenced value to assign\r
- */\r
- public function assign_by_ref($tpl_var, &$value)\r
- {\r
- $this->assignByRef($tpl_var, $value);\r
- }\r
-\r
- /**\r
- * wrapper for append_by_ref\r
- *\r
- * @param string $tpl_var the template variable name\r
- * @param mixed &$value the referenced value to append\r
- * @param boolean $merge flag if array elements shall be merged\r
- */\r
- public function append_by_ref($tpl_var, &$value, $merge = false)\r
- {\r
- $this->appendByRef($tpl_var, $value, $merge);\r
- }\r
-\r
- /**\r
- * clear the given assigned template variable.\r
- *\r
- * @param string $tpl_var the template variable to clear\r
- */\r
- public function clear_assign($tpl_var)\r
- {\r
- $this->clearAssign($tpl_var);\r
- }\r
-\r
- /**\r
- * Registers custom function to be used in templates\r
- *\r
- * @param string $function the name of the template function\r
- * @param string $function_impl the name of the PHP function to register\r
- * @param bool $cacheable\r
- * @param mixed $cache_attrs\r
- */\r
- public function register_function($function, $function_impl, $cacheable=true, $cache_attrs=null)\r
- {\r
- $this->registerPlugin('function', $function, $function_impl, $cacheable, $cache_attrs);\r
- }\r
-\r
- /**\r
- * Unregisters custom function\r
- *\r
- * @param string $function name of template function\r
- */\r
- public function unregister_function($function)\r
- {\r
- $this->unregisterPlugin('function', $function);\r
- }\r
-\r
- /**\r
- * Registers object to be used in templates\r
- *\r
- * @param string $object name of template object\r
- * @param object $object_impl the referenced PHP object to register\r
- * @param array $allowed list of allowed methods (empty = all)\r
- * @param boolean $smarty_args smarty argument format, else traditional\r
- * @param array $block_functs list of methods that are block format\r
- */\r
- public function register_object($object, $object_impl, $allowed = array(), $smarty_args = true, $block_methods = array())\r
- {\r
- settype($allowed, 'array');\r
- settype($smarty_args, 'boolean');\r
- $this->registerObject($object, $object_impl, $allowed, $smarty_args, $block_methods);\r
- }\r
-\r
- /**\r
- * Unregisters object\r
- *\r
- * @param string $object name of template object\r
- */\r
- public function unregister_object($object)\r
- {\r
- $this->unregisterObject($object);\r
- }\r
-\r
- /**\r
- * Registers block function to be used in templates\r
- *\r
- * @param string $block name of template block\r
- * @param string $block_impl PHP function to register\r
- * @param bool $cacheable\r
- * @param mixed $cache_attrs\r
- */\r
- public function register_block($block, $block_impl, $cacheable=true, $cache_attrs=null)\r
- {\r
- $this->registerPlugin('block', $block, $block_impl, $cacheable, $cache_attrs);\r
- }\r
-\r
- /**\r
- * Unregisters block function\r
- *\r
- * @param string $block name of template function\r
- */\r
- public function unregister_block($block)\r
- {\r
- $this->unregisterPlugin('block', $block);\r
- }\r
-\r
- /**\r
- * Registers compiler function\r
- *\r
- * @param string $function name of template function\r
- * @param string $function_impl name of PHP function to register\r
- * @param bool $cacheable\r
- */\r
- public function register_compiler_function($function, $function_impl, $cacheable=true)\r
- {\r
- $this->registerPlugin('compiler', $function, $function_impl, $cacheable);\r
- }\r
-\r
- /**\r
- * Unregisters compiler function\r
- *\r
- * @param string $function name of template function\r
- */\r
- public function unregister_compiler_function($function)\r
- {\r
- $this->unregisterPlugin('compiler', $function);\r
- }\r
-\r
- /**\r
- * Registers modifier to be used in templates\r
- *\r
- * @param string $modifier name of template modifier\r
- * @param string $modifier_impl name of PHP function to register\r
- */\r
- public function register_modifier($modifier, $modifier_impl)\r
- {\r
- $this->registerPlugin('modifier', $modifier, $modifier_impl);\r
- }\r
-\r
- /**\r
- * Unregisters modifier\r
- *\r
- * @param string $modifier name of template modifier\r
- */\r
- public function unregister_modifier($modifier)\r
- {\r
- $this->unregisterPlugin('modifier', $modifier);\r
- }\r
-\r
- /**\r
- * Registers a resource to fetch a template\r
- *\r
- * @param string $type name of resource\r
- * @param array $functions array of functions to handle resource\r
- */\r
- public function register_resource($type, $functions)\r
- {\r
- $this->registerResource($type, $functions);\r
- }\r
-\r
- /**\r
- * Unregisters a resource\r
- *\r
- * @param string $type name of resource\r
- */\r
- public function unregister_resource($type)\r
- {\r
- $this->unregisterResource($type);\r
- }\r
-\r
- /**\r
- * Registers a prefilter function to apply\r
- * to a template before compiling\r
- *\r
- * @param callable $function\r
- */\r
- public function register_prefilter($function)\r
- {\r
- $this->registerFilter('pre', $function);\r
- }\r
-\r
- /**\r
- * Unregisters a prefilter function\r
- *\r
- * @param callable $function\r
- */\r
- public function unregister_prefilter($function)\r
- {\r
- $this->unregisterFilter('pre', $function);\r
- }\r
-\r
- /**\r
- * Registers a postfilter function to apply\r
- * to a compiled template after compilation\r
- *\r
- * @param callable $function\r
- */\r
- public function register_postfilter($function)\r
- {\r
- $this->registerFilter('post', $function);\r
- }\r
-\r
- /**\r
- * Unregisters a postfilter function\r
- *\r
- * @param callable $function\r
- */\r
- public function unregister_postfilter($function)\r
- {\r
- $this->unregisterFilter('post', $function);\r
- }\r
-\r
- /**\r
- * Registers an output filter function to apply\r
- * to a template output\r
- *\r
- * @param callable $function\r
- */\r
- public function register_outputfilter($function)\r
- {\r
- $this->registerFilter('output', $function);\r
- }\r
-\r
- /**\r
- * Unregisters an outputfilter function\r
- *\r
- * @param callable $function\r
- */\r
- public function unregister_outputfilter($function)\r
- {\r
- $this->unregisterFilter('output', $function);\r
- }\r
-\r
- /**\r
- * load a filter of specified type and name\r
- *\r
- * @param string $type filter type\r
- * @param string $name filter name\r
- */\r
- public function load_filter($type, $name)\r
- {\r
- $this->loadFilter($type, $name);\r
- }\r
-\r
- /**\r
- * clear cached content for the given template and cache id\r
- *\r
- * @param string $tpl_file name of template file\r
- * @param string $cache_id name of cache_id\r
- * @param string $compile_id name of compile_id\r
- * @param string $exp_time expiration time\r
- * @return boolean\r
- */\r
- public function clear_cache($tpl_file = null, $cache_id = null, $compile_id = null, $exp_time = null)\r
- {\r
- return $this->clearCache($tpl_file, $cache_id, $compile_id, $exp_time);\r
- }\r
-\r
- /**\r
- * clear the entire contents of cache (all templates)\r
- *\r
- * @param string $exp_time expire time\r
- * @return boolean\r
- */\r
- public function clear_all_cache($exp_time = null)\r
- {\r
- return $this->clearCache(null, null, null, $exp_time);\r
- }\r
-\r
- /**\r
- * test to see if valid cache exists for this template\r
- *\r
- * @param string $tpl_file name of template file\r
- * @param string $cache_id\r
- * @param string $compile_id\r
- * @return boolean\r
- */\r
- public function is_cached($tpl_file, $cache_id = null, $compile_id = null)\r
- {\r
- return $this->isCached($tpl_file, $cache_id, $compile_id);\r
- }\r
-\r
- /**\r
- * clear all the assigned template variables.\r
- */\r
- public function clear_all_assign()\r
- {\r
- $this->clearAllAssign();\r
- }\r
-\r
- /**\r
- * clears compiled version of specified template resource,\r
- * or all compiled template files if one is not specified.\r
- * This function is for advanced use only, not normally needed.\r
- *\r
- * @param string $tpl_file\r
- * @param string $compile_id\r
- * @param string $exp_time\r
- * @return boolean results of {@link smarty_core_rm_auto()}\r
- */\r
- public function clear_compiled_tpl($tpl_file = null, $compile_id = null, $exp_time = null)\r
- {\r
- return $this->clearCompiledTemplate($tpl_file, $compile_id, $exp_time);\r
- }\r
-\r
- /**\r
- * Checks whether requested template exists.\r
- *\r
- * @param string $tpl_file\r
- * @return boolean\r
- */\r
- public function template_exists($tpl_file)\r
- {\r
- return $this->templateExists($tpl_file);\r
- }\r
-\r
- /**\r
- * Returns an array containing template variables\r
- *\r
- * @param string $name\r
- * @return array\r
- */\r
- public function get_template_vars($name=null)\r
- {\r
- return $this->getTemplateVars($name);\r
- }\r
-\r
- /**\r
- * Returns an array containing config variables\r
- *\r
- * @param string $name\r
- * @return array\r
- */\r
- public function get_config_vars($name=null)\r
- {\r
- return $this->getConfigVars($name);\r
- }\r
-\r
- /**\r
- * load configuration values\r
- *\r
- * @param string $file\r
- * @param string $section\r
- * @param string $scope\r
- */\r
- public function config_load($file, $section = null, $scope = 'global')\r
- {\r
- $this->ConfigLoad($file, $section, $scope);\r
- }\r
-\r
- /**\r
- * return a reference to a registered object\r
- *\r
- * @param string $name\r
- * @return object\r
- */\r
- public function get_registered_object($name)\r
- {\r
- return $this->getRegisteredObject($name);\r
- }\r
-\r
- /**\r
- * clear configuration values\r
- *\r
- * @param string $var\r
- */\r
- public function clear_config($var = null)\r
- {\r
- $this->clearConfig($var);\r
- }\r
-\r
- /**\r
- * trigger Smarty error\r
- *\r
- * @param string $error_msg\r
- * @param integer $error_type\r
- */\r
- public function trigger_error($error_msg, $error_type = E_USER_WARNING)\r
- {\r
- trigger_error("Smarty error: $error_msg", $error_type);\r
- }\r
-\r
-}\r
-\r
-/**\r
- * Smarty {php}{/php} block function\r
- *\r
- * @param array $params parameter list\r
- * @param string $content contents of the block\r
- * @param object $template template object\r
- * @param boolean &$repeat repeat flag\r
- * @return string content re-formatted\r
- */\r
-function smarty_php_tag($params, $content, $template, &$repeat)\r
-{\r
- eval($content);\r
- return '';\r
-}\r
-\r
-?>
\ No newline at end of file
+<?php
+/**
+ * Project: Smarty: the PHP compiling template engine
+ * File: SmartyBC.class.php
+ * SVN: $Id: $
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * For questions, help, comments, discussion, etc., please join the
+ * Smarty mailing list. Send a blank e-mail to
+ * smarty-discussion-subscribe@googlegroups.com
+ *
+ * @link http://www.smarty.net/
+ * @copyright 2008 New Digital Group, Inc.
+ * @author Monte Ohrt <monte at ohrt dot com>
+ * @author Uwe Tews
+ * @author Rodney Rehm
+ * @package Smarty
+ */
+/**
+ * @ignore
+ */
+require_once(dirname(__FILE__) . '/Smarty.class.php');
+
+/**
+ * Smarty Backward Compatability Wrapper Class
+ *
+ * @package Smarty
+ */
+class SmartyBC extends Smarty
+{
+ /**
+ * Smarty 2 BC
+ *
+ * @var string
+ */
+ public $_version = self::SMARTY_VERSION;
+
+ /**
+ * Initialize new SmartyBC object
+ *
+ * @param array $options options to set during initialization, e.g. array( 'forceCompile' => false )
+ */
+ public function __construct(array $options = array())
+ {
+ parent::__construct($options);
+ // register {php} tag
+ $this->registerPlugin('block', 'php', 'smarty_php_tag');
+ }
+
+ /**
+ * wrapper for assign_by_ref
+ *
+ * @param string $tpl_var the template variable name
+ * @param mixed &$value the referenced value to assign
+ */
+ public function assign_by_ref($tpl_var, &$value)
+ {
+ $this->assignByRef($tpl_var, $value);
+ }
+
+ /**
+ * wrapper for append_by_ref
+ *
+ * @param string $tpl_var the template variable name
+ * @param mixed &$value the referenced value to append
+ * @param boolean $merge flag if array elements shall be merged
+ */
+ public function append_by_ref($tpl_var, &$value, $merge = false)
+ {
+ $this->appendByRef($tpl_var, $value, $merge);
+ }
+
+ /**
+ * clear the given assigned template variable.
+ *
+ * @param string $tpl_var the template variable to clear
+ */
+ public function clear_assign($tpl_var)
+ {
+ $this->clearAssign($tpl_var);
+ }
+
+ /**
+ * 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
+ * @param bool $cacheable
+ * @param mixed $cache_attrs
+ */
+ public function register_function($function, $function_impl, $cacheable = true, $cache_attrs = null)
+ {
+ $this->registerPlugin('function', $function, $function_impl, $cacheable, $cache_attrs);
+ }
+
+ /**
+ * Unregisters custom function
+ *
+ * @param string $function name of template function
+ */
+ public function unregister_function($function)
+ {
+ $this->unregisterPlugin('function', $function);
+ }
+
+ /**
+ * Registers object to be used in templates
+ *
+ * @param string $object name of template object
+ * @param object $object_impl the referenced PHP object to register
+ * @param array $allowed list of allowed methods (empty = all)
+ * @param boolean $smarty_args smarty argument format, else traditional
+ * @param array $block_methods list of methods that are block format
+ *
+ * @throws SmartyException
+ * @internal param array $block_functs list of methods that are block format
+ */
+ public function register_object($object, $object_impl, $allowed = array(), $smarty_args = true, $block_methods = array())
+ {
+ settype($allowed, 'array');
+ settype($smarty_args, 'boolean');
+ $this->registerObject($object, $object_impl, $allowed, $smarty_args, $block_methods);
+ }
+
+ /**
+ * Unregisters object
+ *
+ * @param string $object name of template object
+ */
+ public function unregister_object($object)
+ {
+ $this->unregisterObject($object);
+ }
+
+ /**
+ * Registers block function to be used in templates
+ *
+ * @param string $block name of template block
+ * @param string $block_impl PHP function to register
+ * @param bool $cacheable
+ * @param mixed $cache_attrs
+ */
+ public function register_block($block, $block_impl, $cacheable = true, $cache_attrs = null)
+ {
+ $this->registerPlugin('block', $block, $block_impl, $cacheable, $cache_attrs);
+ }
+
+ /**
+ * Unregisters block function
+ *
+ * @param string $block name of template function
+ */
+ public function unregister_block($block)
+ {
+ $this->unregisterPlugin('block', $block);
+ }
+
+ /**
+ * Registers compiler function
+ *
+ * @param string $function name of template function
+ * @param string $function_impl name of PHP function to register
+ * @param bool $cacheable
+ */
+ public function register_compiler_function($function, $function_impl, $cacheable = true)
+ {
+ $this->registerPlugin('compiler', $function, $function_impl, $cacheable);
+ }
+
+ /**
+ * Unregisters compiler function
+ *
+ * @param string $function name of template function
+ */
+ public function unregister_compiler_function($function)
+ {
+ $this->unregisterPlugin('compiler', $function);
+ }
+
+ /**
+ * Registers modifier to be used in templates
+ *
+ * @param string $modifier name of template modifier
+ * @param string $modifier_impl name of PHP function to register
+ */
+ public function register_modifier($modifier, $modifier_impl)
+ {
+ $this->registerPlugin('modifier', $modifier, $modifier_impl);
+ }
+
+ /**
+ * Unregisters modifier
+ *
+ * @param string $modifier name of template modifier
+ */
+ public function unregister_modifier($modifier)
+ {
+ $this->unregisterPlugin('modifier', $modifier);
+ }
+
+ /**
+ * 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)
+ {
+ $this->registerResource($type, $functions);
+ }
+
+ /**
+ * Unregisters a resource
+ *
+ * @param string $type name of resource
+ */
+ public function unregister_resource($type)
+ {
+ $this->unregisterResource($type);
+ }
+
+ /**
+ * Registers a prefilter function to apply
+ * to a template before compiling
+ *
+ * @param callable $function
+ */
+ public function register_prefilter($function)
+ {
+ $this->registerFilter('pre', $function);
+ }
+
+ /**
+ * Unregisters a prefilter function
+ *
+ * @param callable $function
+ */
+ public function unregister_prefilter($function)
+ {
+ $this->unregisterFilter('pre', $function);
+ }
+
+ /**
+ * Registers a postfilter function to apply
+ * to a compiled template after compilation
+ *
+ * @param callable $function
+ */
+ public function register_postfilter($function)
+ {
+ $this->registerFilter('post', $function);
+ }
+
+ /**
+ * Unregisters a postfilter function
+ *
+ * @param callable $function
+ */
+ public function unregister_postfilter($function)
+ {
+ $this->unregisterFilter('post', $function);
+ }
+
+ /**
+ * Registers an output filter function to apply
+ * to a template output
+ *
+ * @param callable $function
+ */
+ public function register_outputfilter($function)
+ {
+ $this->registerFilter('output', $function);
+ }
+
+ /**
+ * Unregisters an outputfilter function
+ *
+ * @param callable $function
+ */
+ public function unregister_outputfilter($function)
+ {
+ $this->unregisterFilter('output', $function);
+ }
+
+ /**
+ * load a filter of specified type and name
+ *
+ * @param string $type filter type
+ * @param string $name filter name
+ */
+ public function load_filter($type, $name)
+ {
+ $this->loadFilter($type, $name);
+ }
+
+ /**
+ * clear cached content for the given template and cache id
+ *
+ * @param string $tpl_file name of template file
+ * @param string $cache_id name of cache_id
+ * @param string $compile_id name of compile_id
+ * @param string $exp_time expiration time
+ *
+ * @return boolean
+ */
+ public function clear_cache($tpl_file = null, $cache_id = null, $compile_id = null, $exp_time = null)
+ {
+ return $this->clearCache($tpl_file, $cache_id, $compile_id, $exp_time);
+ }
+
+ /**
+ * clear the entire contents of cache (all templates)
+ *
+ * @param string $exp_time expire time
+ *
+ * @return boolean
+ */
+ public function clear_all_cache($exp_time = null)
+ {
+ return $this->clearCache(null, null, null, $exp_time);
+ }
+
+ /**
+ * test to see if valid cache exists for this template
+ *
+ * @param string $tpl_file name of template file
+ * @param string $cache_id
+ * @param string $compile_id
+ *
+ * @return boolean
+ */
+ public function is_cached($tpl_file, $cache_id = null, $compile_id = null)
+ {
+ return $this->isCached($tpl_file, $cache_id, $compile_id);
+ }
+
+ /**
+ * clear all the assigned template variables.
+ */
+ public function clear_all_assign()
+ {
+ $this->clearAllAssign();
+ }
+
+ /**
+ * clears compiled version of specified template resource,
+ * or all compiled template files if one is not specified.
+ * This function is for advanced use only, not normally needed.
+ *
+ * @param string $tpl_file
+ * @param string $compile_id
+ * @param string $exp_time
+ *
+ * @return boolean results of {@link smarty_core_rm_auto()}
+ */
+ public function clear_compiled_tpl($tpl_file = null, $compile_id = null, $exp_time = null)
+ {
+ return $this->clearCompiledTemplate($tpl_file, $compile_id, $exp_time);
+ }
+
+ /**
+ * Checks whether requested template exists.
+ *
+ * @param string $tpl_file
+ *
+ * @return boolean
+ */
+ public function template_exists($tpl_file)
+ {
+ return $this->templateExists($tpl_file);
+ }
+
+ /**
+ * Returns an array containing template variables
+ *
+ * @param string $name
+ *
+ * @return array
+ */
+ public function get_template_vars($name = null)
+ {
+ return $this->getTemplateVars($name);
+ }
+
+ /**
+ * Returns an array containing config variables
+ *
+ * @param string $name
+ *
+ * @return array
+ */
+ public function get_config_vars($name = null)
+ {
+ return $this->getConfigVars($name);
+ }
+
+ /**
+ * load configuration values
+ *
+ * @param string $file
+ * @param string $section
+ * @param string $scope
+ */
+ public function config_load($file, $section = null, $scope = 'global')
+ {
+ $this->ConfigLoad($file, $section, $scope);
+ }
+
+ /**
+ * return a reference to a registered object
+ *
+ * @param string $name
+ *
+ * @return object
+ */
+ public function get_registered_object($name)
+ {
+ return $this->getRegisteredObject($name);
+ }
+
+ /**
+ * clear configuration values
+ *
+ * @param string $var
+ */
+ public function clear_config($var = null)
+ {
+ $this->clearConfig($var);
+ }
+
+ /**
+ * trigger Smarty error
+ *
+ * @param string $error_msg
+ * @param integer $error_type
+ */
+ public function trigger_error($error_msg, $error_type = E_USER_WARNING)
+ {
+ trigger_error("Smarty error: $error_msg", $error_type);
+ }
+}
+
+/**
+ * Smarty {php}{/php} block function
+ *
+ * @param array $params parameter list
+ * @param string $content contents of the block
+ * @param object $template template object
+ * @param boolean &$repeat repeat flag
+ *
+ * @return string content re-formatted
+ */
+function smarty_php_tag($params, $content, $template, &$repeat)
+{
+ eval($content);
+
+ return '';
+}
{capture name='_smarty_debug' assign=debug_output}
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
-<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
-<head>
- <title>Smarty Debug Console</title>
-<style type="text/css">
-{literal}
-body, h1, h2, td, th, p {
- font-family: sans-serif;
- font-weight: normal;
- font-size: 0.9em;
- margin: 1px;
- padding: 0;
-}
-
-h1 {
- margin: 0;
- text-align: left;
- padding: 2px;
- background-color: #f0c040;
- color: black;
- font-weight: bold;
- font-size: 1.2em;
- }
-
-h2 {
- background-color: #9B410E;
- color: white;
- text-align: left;
- font-weight: bold;
- padding: 2px;
- border-top: 1px solid black;
-}
-
-body {
- background: black;
-}
-
-p, table, div {
- background: #f0ead8;
-}
-
-p {
- margin: 0;
- font-style: italic;
- text-align: center;
-}
-
-table {
- width: 100%;
-}
-
-th, td {
- font-family: monospace;
- vertical-align: top;
- text-align: left;
- width: 50%;
-}
-
-td {
- color: green;
-}
-
-.odd {
- background-color: #eeeeee;
-}
-
-.even {
- background-color: #fafafa;
-}
-
-.exectime {
- font-size: 0.8em;
- font-style: italic;
-}
-
-#table_assigned_vars th {
- color: blue;
-}
-
-#table_config_vars th {
- color: maroon;
-}
-{/literal}
-</style>
-</head>
-<body>
-
-<h1>Smarty Debug Console - {if isset($template_name)}{$template_name|debug_print_var nofilter}{else}Total Time {$execution_time|string_format:"%.5f"}{/if}</h1>
-
-{if !empty($template_data)}
-<h2>included templates & config files (load time in seconds)</h2>
-
-<div>
-{foreach $template_data as $template}
- <font color=brown>{$template.name}</font>
- <span class="exectime">
- (compile {$template['compile_time']|string_format:"%.5f"}) (render {$template['render_time']|string_format:"%.5f"}) (cache {$template['cache_time']|string_format:"%.5f"})
+ <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
+ <head>
+ <title>Smarty Debug Console</title>
+ <style type="text/css">
+ {literal}
+ body, h1, h2, td, th, p {
+ font-family: sans-serif;
+ font-weight: normal;
+ font-size: 0.9em;
+ margin: 1px;
+ padding: 0;
+ }
+
+ h1 {
+ margin: 0;
+ text-align: left;
+ padding: 2px;
+ background-color: #f0c040;
+ color: black;
+ font-weight: bold;
+ font-size: 1.2em;
+ }
+
+ h2 {
+ background-color: #9B410E;
+ color: white;
+ text-align: left;
+ font-weight: bold;
+ padding: 2px;
+ border-top: 1px solid black;
+ }
+
+ body {
+ background: black;
+ }
+
+ p, table, div {
+ background: #f0ead8;
+ }
+
+ p {
+ margin: 0;
+ font-style: italic;
+ text-align: center;
+ }
+
+ table {
+ width: 100%;
+ }
+
+ th, td {
+ font-family: monospace;
+ vertical-align: top;
+ text-align: left;
+ width: 50%;
+ }
+
+ td {
+ color: green;
+ }
+
+ .odd {
+ background-color: #eeeeee;
+ }
+
+ .even {
+ background-color: #fafafa;
+ }
+
+ .exectime {
+ font-size: 0.8em;
+ font-style: italic;
+ }
+
+ #table_assigned_vars th {
+ color: blue;
+ }
+
+ #table_config_vars th {
+ color: maroon;
+ }
+
+ {/literal}
+ </style>
+ </head>
+ <body>
+
+ <h1>Smarty Debug Console
+ - {if isset($template_name)}{$template_name|debug_print_var nofilter}{else}Total Time {$execution_time|string_format:"%.5f"}{/if}</h1>
+
+ {if !empty($template_data)}
+ <h2>included templates & config files (load time in seconds)</h2>
+ <div>
+ {foreach $template_data as $template}
+ <font color=brown>{$template.name}</font>
+ <span class="exectime">
+ (compile {$template['compile_time']|string_format:"%.5f"}) (render {$template['render_time']|string_format:"%.5f"}) (cache {$template['cache_time']|string_format:"%.5f"}
+ )
</span>
- <br>
-{/foreach}
-</div>
-{/if}
-
-<h2>assigned template variables</h2>
-
-<table id="table_assigned_vars">
- {foreach $assigned_vars as $vars}
- <tr class="{if $vars@iteration % 2 eq 0}odd{else}even{/if}">
- <th>${$vars@key|escape:'html'}</th>
- <td>{$vars|debug_print_var nofilter}</td></tr>
- {/foreach}
-</table>
-
-<h2>assigned config file variables (outer template scope)</h2>
-
-<table id="table_config_vars">
- {foreach $config_vars as $vars}
- <tr class="{if $vars@iteration % 2 eq 0}odd{else}even{/if}">
- <th>{$vars@key|escape:'html'}</th>
- <td>{$vars|debug_print_var nofilter}</td></tr>
- {/foreach}
-
-</table>
-</body>
-</html>
+ <br>
+ {/foreach}
+ </div>
+ {/if}
+
+ <h2>assigned template variables</h2>
+
+ <table id="table_assigned_vars">
+ {foreach $assigned_vars as $vars}
+ <tr class="{if $vars@iteration % 2 eq 0}odd{else}even{/if}">
+ <th>${$vars@key|escape:'html'}</th>
+ <td>{$vars|debug_print_var nofilter}</td>
+ </tr>
+ {/foreach}
+ </table>
+
+ <h2>assigned config file variables (outer template scope)</h2>
+
+ <table id="table_config_vars">
+ {foreach $config_vars as $vars}
+ <tr class="{if $vars@iteration % 2 eq 0}odd{else}even{/if}">
+ <th>{$vars@key|escape:'html'}</th>
+ <td>{$vars|debug_print_var nofilter}</td>
+ </tr>
+ {/foreach}
+
+ </table>
+ </body>
+ </html>
{/capture}
<script type="text/javascript">
-{$id = $template_name|default:''|md5}
- _smarty_console = window.open("","console{$id}","width=680,height=600,resizable,scrollbars=yes");
+ {$id = $template_name|default:''|md5}
+ _smarty_console = window.open("", "console{$id}", "width=680,height=600,resizable,scrollbars=yes");
_smarty_console.document.write("{$debug_output|escape:'javascript' nofilter}");
_smarty_console.document.close();
</script>
/**
* Smarty plugin to format text blocks
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsBlock
*/
/**
* Smarty {textformat}{/textformat} block plugin
- *
* Type: block function<br>
* Name: textformat<br>
* Purpose: format text a certain way with preset styles
* - wrap_boundary - boolean (true)
* </pre>
*
- * @link http://www.smarty.net/manual/en/language.function.textformat.php {textformat}
- * (Smarty online manual)
+ * @link http://www.smarty.net/manual/en/language.function.textformat.php {textformat}
+ * (Smarty online manual)
+ *
* @param array $params parameters
* @param string $content contents of the block
* @param Smarty_Internal_Template $template template object
* @param boolean &$repeat repeat flag
+ *
* @return string content re-formatted
* @author Monte Ohrt <monte at ohrt dot com>
*/
case 'indent_char':
case 'wrap_char':
case 'assign':
- $$_key = (string)$_val;
+ $$_key = (string) $_val;
break;
case 'indent':
case 'indent_first':
case 'wrap':
- $$_key = (int)$_val;
+ $$_key = (int) $_val;
break;
case 'wrap_cut':
- $$_key = (bool)$_val;
+ $$_key = (bool) $_val;
break;
default:
}
// split into paragraphs
$_paragraphs = preg_split('![\r\n]{2}!', $content);
- $_output = '';
-
foreach ($_paragraphs as &$_paragraph) {
if (!$_paragraph) {
}
}
$_output = implode($wrap_char . $wrap_char, $_paragraphs);
-
+
if ($assign) {
$template->assign($assign, $_output);
} else {
return $_output;
}
}
-
-?>
\ No newline at end of file
<?php
/**
* Smarty plugin
- * @package Smarty
+ *
+ * @package Smarty
* @subpackage PluginsFunction
*/
/**
* Smarty {counter} function plugin
- *
* Type: function<br>
* Name: counter<br>
* Purpose: print out a counter value
*
* @author Monte Ohrt <monte at ohrt dot com>
- * @link http://www.smarty.net/manual/en/language.function.counter.php {counter}
- * (Smarty online manual)
+ * @link http://www.smarty.net/manual/en/language.function.counter.php {counter}
+ * (Smarty online manual)
+ *
* @param array $params parameters
* @param Smarty_Internal_Template $template template object
+ *
* @return string|null
*/
function smarty_function_counter($params, $template)
$name = (isset($params['name'])) ? $params['name'] : 'default';
if (!isset($counters[$name])) {
$counters[$name] = array(
- 'start'=>1,
- 'skip'=>1,
- 'direction'=>'up',
- 'count'=>1
- );
+ 'start' => 1,
+ 'skip' => 1,
+ 'direction' => 'up',
+ 'count' => 1
+ );
}
$counter =& $counters[$name];
if (isset($params['start'])) {
- $counter['start'] = $counter['count'] = (int)$params['start'];
+ $counter['start'] = $counter['count'] = (int) $params['start'];
}
if (!empty($params['assign'])) {
if (isset($counter['assign'])) {
$template->assign($counter['assign'], $counter['count']);
}
-
+
if (isset($params['print'])) {
- $print = (bool)$params['print'];
+ $print = (bool) $params['print'];
} else {
$print = empty($counter['assign']);
}
if (isset($params['skip'])) {
$counter['skip'] = $params['skip'];
}
-
+
if (isset($params['direction'])) {
$counter['direction'] = $params['direction'];
}
- if ($counter['direction'] == "down")
+ if ($counter['direction'] == "down") {
$counter['count'] -= $counter['skip'];
- else
+ } else {
$counter['count'] += $counter['skip'];
-
+ }
+
return $retval;
-
}
-
-?>
\ No newline at end of file
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsFunction
*/
/**
* Smarty {cycle} function plugin
- *
* Type: function<br>
* Name: cycle<br>
* Date: May 3, 2002<br>
* {cycle name=row}
* </pre>
*
- * @link http://www.smarty.net/manual/en/language.function.cycle.php {cycle}
- * (Smarty online manual)
- * @author Monte Ohrt <monte at ohrt dot com>
- * @author credit to Mark Priatel <mpriatel@rogers.com>
- * @author credit to Gerard <gerard@interfold.com>
- * @author credit to Jason Sweat <jsweat_php@yahoo.com>
+ * @link http://www.smarty.net/manual/en/language.function.cycle.php {cycle}
+ * (Smarty online manual)
+ * @author Monte Ohrt <monte at ohrt dot com>
+ * @author credit to Mark Priatel <mpriatel@rogers.com>
+ * @author credit to Gerard <gerard@interfold.com>
+ * @author credit to Jason Sweat <jsweat_php@yahoo.com>
* @version 1.3
+ *
* @param array $params parameters
* @param Smarty_Internal_Template $template template object
+ *
* @return string|null
*/
static $cycle_vars;
$name = (empty($params['name'])) ? 'default' : $params['name'];
- $print = (isset($params['print'])) ? (bool)$params['print'] : true;
- $advance = (isset($params['advance'])) ? (bool)$params['advance'] : true;
- $reset = (isset($params['reset'])) ? (bool)$params['reset'] : false;
+ $print = (isset($params['print'])) ? (bool) $params['print'] : true;
+ $advance = (isset($params['advance'])) ? (bool) $params['advance'] : true;
+ $reset = (isset($params['reset'])) ? (bool) $params['reset'] : false;
if (!isset($params['values'])) {
- if(!isset($cycle_vars[$name]['values'])) {
+ if (!isset($cycle_vars[$name]['values'])) {
trigger_error("cycle: missing 'values' parameter");
+
return;
}
} else {
- if(isset($cycle_vars[$name]['values'])
- && $cycle_vars[$name]['values'] != $params['values'] ) {
+ if (isset($cycle_vars[$name]['values'])
+ && $cycle_vars[$name]['values'] != $params['values']
+ ) {
$cycle_vars[$name]['index'] = 0;
}
$cycle_vars[$name]['values'] = $params['values'];
$cycle_vars[$name]['delimiter'] = ',';
}
- if(is_array($cycle_vars[$name]['values'])) {
+ if (is_array($cycle_vars[$name]['values'])) {
$cycle_array = $cycle_vars[$name]['values'];
} else {
- $cycle_array = explode($cycle_vars[$name]['delimiter'],$cycle_vars[$name]['values']);
+ $cycle_array = explode($cycle_vars[$name]['delimiter'], $cycle_vars[$name]['values']);
}
- if(!isset($cycle_vars[$name]['index']) || $reset ) {
+ if (!isset($cycle_vars[$name]['index']) || $reset) {
$cycle_vars[$name]['index'] = 0;
}
$template->assign($params['assign'], $cycle_array[$cycle_vars[$name]['index']]);
}
- if($print) {
+ if ($print) {
$retval = $cycle_array[$cycle_vars[$name]['index']];
} else {
$retval = null;
}
- if($advance) {
- if ( $cycle_vars[$name]['index'] >= count($cycle_array) -1 ) {
+ if ($advance) {
+ if ($cycle_vars[$name]['index'] >= count($cycle_array) - 1) {
$cycle_vars[$name]['index'] = 0;
} else {
- $cycle_vars[$name]['index']++;
+ $cycle_vars[$name]['index'] ++;
}
}
return $retval;
}
-
-?>
\ No newline at end of file
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsFunction
*/
/**
* Smarty {fetch} plugin
- *
* Type: function<br>
* Name: fetch<br>
* Purpose: fetch file, web or ftp data and display results
*
- * @link http://www.smarty.net/manual/en/language.function.fetch.php {fetch}
- * (Smarty online manual)
+ * @link http://www.smarty.net/manual/en/language.function.fetch.php {fetch}
+ * (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
+ *
* @param array $params parameters
* @param Smarty_Internal_Template $template template object
+ *
+ * @throws SmartyException
* @return string|null if the assign parameter is passed, Smarty assigns the result to a template variable
*/
function smarty_function_fetch($params, $template)
{
if (empty($params['file'])) {
- trigger_error("[plugin] fetch parameter 'file' cannot be empty",E_USER_NOTICE);
+ trigger_error("[plugin] fetch parameter 'file' cannot be empty", E_USER_NOTICE);
+
return;
}
-
+
// strip file protocol
if (stripos($params['file'], 'file://') === 0) {
$params['file'] = substr($params['file'], 7);
}
-
+
$protocol = strpos($params['file'], '://');
if ($protocol !== false) {
$protocol = strtolower(substr($params['file'], 0, $protocol));
}
-
+
if (isset($template->smarty->security_policy)) {
if ($protocol) {
// remote resource (or php stream, …)
- if(!$template->smarty->security_policy->isTrustedUri($params['file'])) {
+ if (!$template->smarty->security_policy->isTrustedUri($params['file'])) {
return;
}
} else {
// local file
- if(!$template->smarty->security_policy->isTrustedResourceDir($params['file'])) {
+ if (!$template->smarty->security_policy->isTrustedResourceDir($params['file'])) {
return;
}
}
$content = '';
if ($protocol == 'http') {
// http fetch
- if($uri_parts = parse_url($params['file'])) {
+ if ($uri_parts = parse_url($params['file'])) {
// set defaults
$host = $server_name = $uri_parts['host'];
$timeout = 30;
$accept = "image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, */*";
- $agent = "Smarty Template Engine ". Smarty::SMARTY_VERSION;
+ $agent = "Smarty Template Engine " . Smarty::SMARTY_VERSION;
$referer = "";
$uri = !empty($uri_parts['path']) ? $uri_parts['path'] : '/';
$uri .= !empty($uri_parts['query']) ? '?' . $uri_parts['query'] : '';
$_is_proxy = false;
- if(empty($uri_parts['port'])) {
+ if (empty($uri_parts['port'])) {
$port = 80;
} else {
$port = $uri_parts['port'];
}
- if(!empty($uri_parts['user'])) {
+ if (!empty($uri_parts['user'])) {
$user = $uri_parts['user'];
}
- if(!empty($uri_parts['pass'])) {
+ if (!empty($uri_parts['pass'])) {
$pass = $uri_parts['pass'];
}
// loop through parameters, setup headers
- foreach($params as $param_key => $param_value) {
- switch($param_key) {
+ foreach ($params as $param_key => $param_value) {
+ switch ($param_key) {
case "file":
case "assign":
case "assign_headers":
break;
case "user":
- if(!empty($param_value)) {
+ if (!empty($param_value)) {
$user = $param_value;
}
break;
case "pass":
- if(!empty($param_value)) {
+ if (!empty($param_value)) {
$pass = $param_value;
}
break;
case "accept":
- if(!empty($param_value)) {
+ if (!empty($param_value)) {
$accept = $param_value;
}
break;
case "header":
- if(!empty($param_value)) {
- if(!preg_match('![\w\d-]+: .+!',$param_value)) {
- trigger_error("[plugin] invalid header format '".$param_value."'",E_USER_NOTICE);
+ if (!empty($param_value)) {
+ if (!preg_match('![\w\d-]+: .+!', $param_value)) {
+ trigger_error("[plugin] invalid header format '" . $param_value . "'", E_USER_NOTICE);
+
return;
} else {
$extra_headers[] = $param_value;
}
break;
case "proxy_host":
- if(!empty($param_value)) {
+ if (!empty($param_value)) {
$proxy_host = $param_value;
}
break;
case "proxy_port":
- if(!preg_match('!\D!', $param_value)) {
+ if (!preg_match('!\D!', $param_value)) {
$proxy_port = (int) $param_value;
} else {
- trigger_error("[plugin] invalid value for attribute '".$param_key."'",E_USER_NOTICE);
+ trigger_error("[plugin] invalid value for attribute '" . $param_key . "'", E_USER_NOTICE);
+
return;
}
break;
case "agent":
- if(!empty($param_value)) {
+ if (!empty($param_value)) {
$agent = $param_value;
}
break;
case "referer":
- if(!empty($param_value)) {
+ if (!empty($param_value)) {
$referer = $param_value;
}
break;
case "timeout":
- if(!preg_match('!\D!', $param_value)) {
+ if (!preg_match('!\D!', $param_value)) {
$timeout = (int) $param_value;
} else {
- trigger_error("[plugin] invalid value for attribute '".$param_key."'",E_USER_NOTICE);
+ trigger_error("[plugin] invalid value for attribute '" . $param_key . "'", E_USER_NOTICE);
+
return;
}
break;
default:
- trigger_error("[plugin] unrecognized attribute '".$param_key."'",E_USER_NOTICE);
+ trigger_error("[plugin] unrecognized attribute '" . $param_key . "'", E_USER_NOTICE);
+
return;
}
}
- if(!empty($proxy_host) && !empty($proxy_port)) {
+ if (!empty($proxy_host) && !empty($proxy_port)) {
$_is_proxy = true;
- $fp = fsockopen($proxy_host,$proxy_port,$errno,$errstr,$timeout);
+ $fp = fsockopen($proxy_host, $proxy_port, $errno, $errstr, $timeout);
} else {
- $fp = fsockopen($server_name,$port,$errno,$errstr,$timeout);
+ $fp = fsockopen($server_name, $port, $errno, $errstr, $timeout);
}
- if(!$fp) {
- trigger_error("[plugin] unable to fetch: $errstr ($errno)",E_USER_NOTICE);
+ if (!$fp) {
+ trigger_error("[plugin] unable to fetch: $errstr ($errno)", E_USER_NOTICE);
+
return;
} else {
- if($_is_proxy) {
+ if ($_is_proxy) {
fputs($fp, 'GET ' . $params['file'] . " HTTP/1.0\r\n");
} else {
fputs($fp, "GET $uri HTTP/1.0\r\n");
}
- if(!empty($host)) {
+ if (!empty($host)) {
fputs($fp, "Host: $host\r\n");
}
- if(!empty($accept)) {
+ if (!empty($accept)) {
fputs($fp, "Accept: $accept\r\n");
}
- if(!empty($agent)) {
+ if (!empty($agent)) {
fputs($fp, "User-Agent: $agent\r\n");
}
- if(!empty($referer)) {
+ if (!empty($referer)) {
fputs($fp, "Referer: $referer\r\n");
}
- if(isset($extra_headers) && is_array($extra_headers)) {
- foreach($extra_headers as $curr_header) {
- fputs($fp, $curr_header."\r\n");
+ if (isset($extra_headers) && is_array($extra_headers)) {
+ foreach ($extra_headers as $curr_header) {
+ fputs($fp, $curr_header . "\r\n");
}
}
- if(!empty($user) && !empty($pass)) {
- fputs($fp, "Authorization: BASIC ".base64_encode("$user:$pass")."\r\n");
+ if (!empty($user) && !empty($pass)) {
+ fputs($fp, "Authorization: BASIC " . base64_encode("$user:$pass") . "\r\n");
}
fputs($fp, "\r\n");
- while(!feof($fp)) {
- $content .= fgets($fp,4096);
+ while (!feof($fp)) {
+ $content .= fgets($fp, 4096);
}
fclose($fp);
- $csplit = preg_split("!\r\n\r\n!",$content,2);
+ $csplit = preg_split("!\r\n\r\n!", $content, 2);
$content = $csplit[1];
- if(!empty($params['assign_headers'])) {
- $template->assign($params['assign_headers'],preg_split("!\r\n!",$csplit[0]));
+ if (!empty($params['assign_headers'])) {
+ $template->assign($params['assign_headers'], preg_split("!\r\n!", $csplit[0]));
}
}
} else {
- trigger_error("[plugin fetch] unable to parse URL, check syntax",E_USER_NOTICE);
+ trigger_error("[plugin fetch] unable to parse URL, check syntax", E_USER_NOTICE);
+
return;
}
} else {
$content = @file_get_contents($params['file']);
if ($content === false) {
- throw new SmartyException("{fetch} cannot read resource '" . $params['file'] ."'");
+ throw new SmartyException("{fetch} cannot read resource '" . $params['file'] . "'");
}
}
return $content;
}
}
-
-?>
\ No newline at end of file
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsFunction
*/
/**
* Smarty {html_checkboxes} function plugin
- *
* File: function.html_checkboxes.php<br>
* Type: function<br>
* Name: html_checkboxes<br>
* - escape (optional) - escape the content (not value), defaults to true
* </pre>
*
- * @link http://www.smarty.net/manual/en/language.function.html.checkboxes.php {html_checkboxes}
- * (Smarty online manual)
+ * @link http://www.smarty.net/manual/en/language.function.html.checkboxes.php {html_checkboxes}
+ * (Smarty online manual)
* @author Christopher Kvarme <christopher.kvarme@flashjab.com>
- * @author credits to Monte Ohrt <monte at ohrt dot com>
+ * @author credits to Monte Ohrt <monte at ohrt dot com>
* @version 1.0
- * @param array $params parameters
+ *
+ * @param array $params parameters
* @param object $template template object
+ *
* @return string
- * @uses smarty_function_escape_special_chars()
+ * @uses smarty_function_escape_special_chars()
*/
function smarty_function_html_checkboxes($params, $template)
{
$extra = '';
- foreach($params as $_key => $_val) {
- switch($_key) {
+ foreach ($params as $_key => $_val) {
+ switch ($_key) {
case 'name':
case 'separator':
$$_key = (string) $_val;
if (method_exists($_sel, "__toString")) {
$_sel = smarty_function_escape_special_chars((string) $_sel->__toString());
} else {
- trigger_error("html_checkboxes: selected attribute contains an object of class '". get_class($_sel) ."' without __toString() method", E_USER_NOTICE);
+ trigger_error("html_checkboxes: selected attribute contains an object of class '" . get_class($_sel) . "' without __toString() method", E_USER_NOTICE);
continue;
}
} else {
if (method_exists($_val, "__toString")) {
$selected = smarty_function_escape_special_chars((string) $_val->__toString());
} else {
- trigger_error("html_checkboxes: selected attribute is an object of class '". get_class($_val) ."' without __toString() method", E_USER_NOTICE);
+ trigger_error("html_checkboxes: selected attribute is an object of class '" . get_class($_val) . "' without __toString() method", E_USER_NOTICE);
}
} else {
$selected = smarty_function_escape_special_chars((string) $_val);
case 'assign':
break;
+ case 'strict':
+ break;
+
+ case 'disabled':
+ case 'readonly':
+ if (!empty($params['strict'])) {
+ if (!is_scalar($_val)) {
+ trigger_error("html_options: $_key attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute", E_USER_NOTICE);
+ }
+
+ if ($_val === true || $_val === $_key) {
+ $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"';
+ }
+
+ break;
+ }
+ // omit break; to fall through!
+
default:
- if(!is_array($_val)) {
- $extra .= ' '.$_key.'="'.smarty_function_escape_special_chars($_val).'"';
+ if (!is_array($_val)) {
+ $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
} else {
trigger_error("html_checkboxes: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
}
}
}
- if (!isset($options) && !isset($values))
- return ''; /* raise error here? */
+ if (!isset($options) && !isset($values)) {
+ return '';
+ } /* raise error here? */
$_html_result = array();
if (isset($options)) {
- foreach ($options as $_key=>$_val) {
+ foreach ($options as $_key => $_val) {
$_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids, $escape);
}
} else {
- foreach ($values as $_i=>$_key) {
+ foreach ($values as $_i => $_key) {
$_val = isset($output[$_i]) ? $output[$_i] : '';
$_html_result[] = smarty_function_html_checkboxes_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids, $escape);
}
}
- if(!empty($params['assign'])) {
+ if (!empty($params['assign'])) {
$template->assign($params['assign'], $_html_result);
} else {
return implode("\n", $_html_result);
}
-
}
-function smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids, $escape=true) {
+function smarty_function_html_checkboxes_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids, $escape = true)
+{
$_output = '';
-
+
if (is_object($value)) {
if (method_exists($value, "__toString")) {
$value = (string) $value->__toString();
} else {
- trigger_error("html_options: value is an object of class '". get_class($value) ."' without __toString() method", E_USER_NOTICE);
+ trigger_error("html_options: value is an object of class '" . get_class($value) . "' without __toString() method", E_USER_NOTICE);
+
return '';
}
} else {
$value = (string) $value;
}
-
+
if (is_object($output)) {
if (method_exists($output, "__toString")) {
$output = (string) $output->__toString();
} else {
- trigger_error("html_options: output is an object of class '". get_class($output) ."' without __toString() method", E_USER_NOTICE);
+ trigger_error("html_options: output is an object of class '" . get_class($output) . "' without __toString() method", E_USER_NOTICE);
+
return '';
}
} else {
$output = (string) $output;
}
-
+
if ($labels) {
if ($label_ids) {
$_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!' . Smarty::$_UTF8_MODIFIER, '_', $name . '_' . $value));
$_output .= '<label for="' . $_id . '">';
} else {
$_output .= '<label>';
- }
+ }
}
-
+
$name = smarty_function_escape_special_chars($name);
$value = smarty_function_escape_special_chars($value);
if ($escape) {
$output = smarty_function_escape_special_chars($output);
}
-
+
$_output .= '<input type="checkbox" name="' . $name . '[]" value="' . $value . '"';
-
+
if ($labels && $label_ids) {
$_output .= ' id="' . $_id . '"';
}
-
+
if (is_array($selected)) {
if (isset($selected[$value])) {
$_output .= ' checked="checked"';
} elseif ($value === $selected) {
$_output .= ' checked="checked"';
}
-
+
$_output .= $extra . ' />' . $output;
if ($labels) {
$_output .= '</label>';
}
-
- $_output .= $separator;
+
+ $_output .= $separator;
+
return $_output;
}
-
-?>
\ No newline at end of file
<?php
/**
* Smarty plugin
- *
- * @package Smarty
+ *
+ * @package Smarty
* @subpackage PluginsFunction
*/
/**
* Smarty {html_image} function plugin
- *
* Type: function<br>
* Name: html_image<br>
* Date: Feb 24, 2003<br>
* - basedir - (optional) - base directory for absolute paths, default is environment variable DOCUMENT_ROOT
* - path_prefix - prefix for path output (optional, default empty)
* </pre>
- *
- * @link http://www.smarty.net/manual/en/language.function.html.image.php {html_image}
- * (Smarty online manual)
- * @author Monte Ohrt <monte at ohrt dot com>
- * @author credits to Duda <duda@big.hu>
+ *
+ * @link http://www.smarty.net/manual/en/language.function.html.image.php {html_image}
+ * (Smarty online manual)
+ * @author Monte Ohrt <monte at ohrt dot com>
+ * @author credits to Duda <duda@big.hu>
* @version 1.0
+ *
* @param array $params parameters
* @param Smarty_Internal_Template $template template object
- * @return string
- * @uses smarty_function_escape_special_chars()
+ *
+ * @throws SmartyException
+ * @return string
+ * @uses smarty_function_escape_special_chars()
*/
function smarty_function_html_image($params, $template)
{
require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
-
+
$alt = '';
$file = '';
$height = '';
$suffix = '';
$path_prefix = '';
$basedir = isset($_SERVER['DOCUMENT_ROOT']) ? $_SERVER['DOCUMENT_ROOT'] : '';
- foreach($params as $_key => $_val) {
+ foreach ($params as $_key => $_val) {
switch ($_key) {
case 'file':
case 'height':
$$_key = smarty_function_escape_special_chars($_val);
} else {
throw new SmartyException ("html_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
- }
+ }
break;
case 'link':
$extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
} else {
throw new SmartyException ("html_image: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
- }
+ }
break;
- }
- }
+ }
+ }
if (empty($file)) {
trigger_error("html_image: missing 'file' parameter", E_USER_NOTICE);
+
return;
- }
+ }
if ($file[0] == '/') {
$_image_path = $basedir . $file;
} else {
$_image_path = $file;
}
-
+
// strip file protocol
if (stripos($params['file'], 'file://') === 0) {
$params['file'] = substr($params['file'], 7);
}
-
+
$protocol = strpos($params['file'], '://');
if ($protocol !== false) {
$protocol = strtolower(substr($params['file'], 0, $protocol));
}
-
+
if (isset($template->smarty->security_policy)) {
if ($protocol) {
// remote resource (or php stream, …)
- if(!$template->smarty->security_policy->isTrustedUri($params['file'])) {
+ if (!$template->smarty->security_policy->isTrustedUri($params['file'])) {
return;
}
} else {
// local file
- if(!$template->smarty->security_policy->isTrustedResourceDir($params['file'])) {
+ if (!$template->smarty->security_policy->isTrustedResourceDir($_image_path)) {
return;
}
}
if (!$_image_data = @getimagesize($_image_path)) {
if (!file_exists($_image_path)) {
trigger_error("html_image: unable to find '$_image_path'", E_USER_NOTICE);
+
return;
- } else if (!is_readable($_image_path)) {
+ } elseif (!is_readable($_image_path)) {
trigger_error("html_image: unable to read '$_image_path'", E_USER_NOTICE);
+
return;
} else {
trigger_error("html_image: '$_image_path' is not a valid image file", E_USER_NOTICE);
+
return;
- }
+ }
}
if (!isset($params['width'])) {
$width = $_image_data[0];
- }
+ }
if (!isset($params['height'])) {
$height = $_image_data[1];
- }
- }
+ }
+ }
if (isset($params['dpi'])) {
if (strstr($_SERVER['HTTP_USER_AGENT'], 'Mac')) {
$dpi_default = 72;
} else {
$dpi_default = 96;
- }
+ }
$_resize = $dpi_default / $params['dpi'];
$width = round($width * $_resize);
$height = round($height * $_resize);
- }
+ }
return $prefix . '<img src="' . $path_prefix . $file . '" alt="' . $alt . '" width="' . $width . '" height="' . $height . '"' . $extra . ' />' . $suffix;
-}
-
-?>
\ No newline at end of file
+}
<?php
/**
* Smarty plugin
- *
- * @package Smarty
+ *
+ * @package Smarty
* @subpackage PluginsFunction
*/
/**
* Smarty {html_options} function plugin
- *
* Type: function<br>
* Name: html_options<br>
* Purpose: Prints the list of <option> tags generated from
* - id (optional) - string default not set
* - class (optional) - string default not set
* </pre>
- *
- * @link http://www.smarty.net/manual/en/language.function.html.options.php {html_image}
- * (Smarty online manual)
- * @author Monte Ohrt <monte at ohrt dot com>
- * @author Ralf Strehle (minor optimization) <ralf dot strehle at yahoo dot de>
- * @param array $params parameters
- * @param Smarty_Internal_Template $template template object
- * @return string
- * @uses smarty_function_escape_special_chars()
+ *
+ * @link http://www.smarty.net/manual/en/language.function.html.options.php {html_image}
+ * (Smarty online manual)
+ * @author Monte Ohrt <monte at ohrt dot com>
+ * @author Ralf Strehle (minor optimization) <ralf dot strehle at yahoo dot de>
+ *
+ * @param array $params parameters
+ *
+ * @return string
+ * @uses smarty_function_escape_special_chars()
*/
-function smarty_function_html_options($params, $template)
+function smarty_function_html_options($params)
{
require_once(SMARTY_PLUGINS_DIR . 'shared.escape_special_chars.php');
if (method_exists($_sel, "__toString")) {
$_sel = smarty_function_escape_special_chars((string) $_sel->__toString());
} else {
- trigger_error("html_options: selected attribute contains an object of class '". get_class($_sel) ."' without __toString() method", E_USER_NOTICE);
+ trigger_error("html_options: selected attribute contains an object of class '" . get_class($_sel) . "' without __toString() method", E_USER_NOTICE);
continue;
}
} else {
if (method_exists($_val, "__toString")) {
$selected = smarty_function_escape_special_chars((string) $_val->__toString());
} else {
- trigger_error("html_options: selected attribute is an object of class '". get_class($_val) ."' without __toString() method", E_USER_NOTICE);
+ trigger_error("html_options: selected attribute is an object of class '" . get_class($_val) . "' without __toString() method", E_USER_NOTICE);
}
} else {
$selected = smarty_function_escape_special_chars((string) $_val);
}
break;
+ case 'strict':
+ break;
+
+ case 'disabled':
+ case 'readonly':
+ if (!empty($params['strict'])) {
+ if (!is_scalar($_val)) {
+ trigger_error("html_options: $_key attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute", E_USER_NOTICE);
+ }
+
+ if ($_val === true || $_val === $_key) {
+ $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"';
+ }
+
+ break;
+ }
+ // omit break; to fall through!
+
default:
if (!is_array($_val)) {
$extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
} else {
trigger_error("html_options: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
- }
+ }
break;
- }
+ }
}
if (!isset($options) && !isset($values)) {
/* raise error here? */
+
return '';
}
foreach ($values as $_i => $_key) {
$_val = isset($output[$_i]) ? $output[$_i] : '';
$_html_result .= smarty_function_html_options_optoutput($_key, $_val, $selected, $id, $class, $_idx);
- }
+ }
}
if (!empty($name)) {
- $_html_class = !empty($class) ? ' class="'.$class.'"' : '';
- $_html_id = !empty($id) ? ' id="'.$id.'"' : '';
+ $_html_class = !empty($class) ? ' class="' . $class . '"' : '';
+ $_html_id = !empty($id) ? ' id="' . $id . '"' : '';
$_html_result = '<select name="' . $name . '"' . $_html_class . $_html_id . $extra . '>' . "\n" . $_html_result . '</select>' . "\n";
- }
+ }
return $_html_result;
}
} elseif ($_key === $selected) {
$_html_result .= ' selected="selected"';
}
- $_html_class = !empty($class) ? ' class="'.$class.' option"' : '';
- $_html_id = !empty($id) ? ' id="'.$id.'-'.$idx.'"' : '';
+ $_html_class = !empty($class) ? ' class="' . $class . ' option"' : '';
+ $_html_id = !empty($id) ? ' id="' . $id . '-' . $idx . '"' : '';
if (is_object($value)) {
if (method_exists($value, "__toString")) {
$value = smarty_function_escape_special_chars((string) $value->__toString());
} else {
- trigger_error("html_options: value is an object of class '". get_class($value) ."' without __toString() method", E_USER_NOTICE);
+ trigger_error("html_options: value is an object of class '" . get_class($value) . "' without __toString() method", E_USER_NOTICE);
+
return '';
}
} else {
$value = smarty_function_escape_special_chars((string) $value);
}
$_html_result .= $_html_class . $_html_id . '>' . $value . '</option>' . "\n";
- $idx++;
+ $idx ++;
} else {
$_idx = 0;
- $_html_result = smarty_function_html_options_optgroup($key, $value, $selected, !empty($id) ? ($id.'-'.$idx) : null, $class, $_idx);
- $idx++;
+ $_html_result = smarty_function_html_options_optgroup($key, $value, $selected, !empty($id) ? ($id . '-' . $idx) : null, $class, $_idx);
+ $idx ++;
}
+
return $_html_result;
-}
+}
function smarty_function_html_options_optgroup($key, $values, $selected, $id, $class, &$idx)
{
$optgroup_html = '<optgroup label="' . smarty_function_escape_special_chars($key) . '">' . "\n";
foreach ($values as $key => $value) {
$optgroup_html .= smarty_function_html_options_optoutput($key, $value, $selected, $id, $class, $idx);
- }
+ }
$optgroup_html .= "</optgroup>\n";
- return $optgroup_html;
-}
-?>
\ No newline at end of file
+ return $optgroup_html;
+}
<?php
/**
* Smarty plugin
- *
- * @package Smarty
+ *
+ * @package Smarty
* @subpackage PluginsFunction
*/
/**
* Smarty {html_radios} function plugin
- *
* File: function.html_radios.php<br>
* Type: function<br>
* Name: html_radios<br>
* {html_radios values=$ids name='box' separator='<br>' output=$names}
* {html_radios values=$ids checked=$checked separator='<br>' output=$names}
* </pre>
- *
- * @link http://smarty.php.net/manual/en/language.function.html.radios.php {html_radios}
- * (Smarty online manual)
- * @author Christopher Kvarme <christopher.kvarme@flashjab.com>
- * @author credits to Monte Ohrt <monte at ohrt dot com>
+ *
+ * @link http://smarty.php.net/manual/en/language.function.html.radios.php {html_radios}
+ * (Smarty online manual)
+ * @author Christopher Kvarme <christopher.kvarme@flashjab.com>
+ * @author credits to Monte Ohrt <monte at ohrt dot com>
* @version 1.0
+ *
* @param array $params parameters
* @param Smarty_Internal_Template $template template object
- * @return string
- * @uses smarty_function_escape_special_chars()
+ *
+ * @return string
+ * @uses smarty_function_escape_special_chars()
*/
function smarty_function_html_radios($params, $template)
{
$output = null;
$extra = '';
- foreach($params as $_key => $_val) {
+ foreach ($params as $_key => $_val) {
switch ($_key) {
case 'name':
case 'separator':
if (method_exists($_val, "__toString")) {
$selected = smarty_function_escape_special_chars((string) $_val->__toString());
} else {
- trigger_error("html_radios: selected attribute is an object of class '". get_class($_val) ."' without __toString() method", E_USER_NOTICE);
+ trigger_error("html_radios: selected attribute is an object of class '" . get_class($_val) . "' without __toString() method", E_USER_NOTICE);
}
} else {
$selected = (string) $_val;
- }
+ }
break;
case 'escape':
case 'assign':
break;
+ case 'strict':
+ break;
+
+ case 'disabled':
+ case 'readonly':
+ if (!empty($params['strict'])) {
+ if (!is_scalar($_val)) {
+ trigger_error("html_options: $_key attribute must be a scalar, only boolean true or string '$_key' will actually add the attribute", E_USER_NOTICE);
+ }
+
+ if ($_val === true || $_val === $_key) {
+ $extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_key) . '"';
+ }
+
+ break;
+ }
+ // omit break; to fall through!
+
default:
if (!is_array($_val)) {
$extra .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_val) . '"';
} else {
trigger_error("html_radios: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
- }
+ }
break;
- }
- }
+ }
+ }
if (!isset($options) && !isset($values)) {
/* raise error here? */
+
return '';
}
foreach ($values as $_i => $_key) {
$_val = isset($output[$_i]) ? $output[$_i] : '';
$_html_result[] = smarty_function_html_radios_output($name, $_key, $_val, $selected, $extra, $separator, $labels, $label_ids, $escape);
- }
- }
+ }
+ }
if (!empty($params['assign'])) {
$template->assign($params['assign'], $_html_result);
} else {
return implode("\n", $_html_result);
- }
-}
+ }
+}
function smarty_function_html_radios_output($name, $value, $output, $selected, $extra, $separator, $labels, $label_ids, $escape)
{
$_output = '';
-
+
if (is_object($value)) {
if (method_exists($value, "__toString")) {
$value = (string) $value->__toString();
} else {
- trigger_error("html_options: value is an object of class '". get_class($value) ."' without __toString() method", E_USER_NOTICE);
+ trigger_error("html_options: value is an object of class '" . get_class($value) . "' without __toString() method", E_USER_NOTICE);
+
return '';
}
} else {
$value = (string) $value;
}
-
+
if (is_object($output)) {
if (method_exists($output, "__toString")) {
$output = (string) $output->__toString();
} else {
- trigger_error("html_options: output is an object of class '". get_class($output) ."' without __toString() method", E_USER_NOTICE);
+ trigger_error("html_options: output is an object of class '" . get_class($output) . "' without __toString() method", E_USER_NOTICE);
+
return '';
}
} else {
$output = (string) $output;
}
-
+
if ($labels) {
if ($label_ids) {
$_id = smarty_function_escape_special_chars(preg_replace('![^\w\-\.]!' . Smarty::$_UTF8_MODIFIER, '_', $name . '_' . $value));
$_output .= '<label for="' . $_id . '">';
} else {
$_output .= '<label>';
- }
+ }
}
-
+
$name = smarty_function_escape_special_chars($name);
$value = smarty_function_escape_special_chars($value);
if ($escape) {
$output = smarty_function_escape_special_chars($output);
}
-
+
$_output .= '<input type="radio" name="' . $name . '" value="' . $value . '"';
if ($labels && $label_ids) {
if ($value === $selected) {
$_output .= ' checked="checked"';
}
-
+
$_output .= $extra . ' />' . $output;
if ($labels) {
$_output .= '</label>';
}
-
+
$_output .= $separator;
- return $_output;
-}
-?>
\ No newline at end of file
+ return $_output;
+}
<?php
/**
* Smarty plugin
- *
- * @package Smarty
+ *
+ * @package Smarty
* @subpackage PluginsFunction
*/
/**
* Smarty {html_select_date} plugin
- *
* Type: function<br>
* Name: html_select_date<br>
* Purpose: Prints the dropdowns for date selection.
- *
* ChangeLog:
* <pre>
* - 1.0 initial release
* dropdown to include given date unless explicitly set (Monte)
* - 1.3.4 fix behaviour of 0000-00-00 00:00:00 dates to match that
* of 0000-00-00 dates (cybot, boots)
- * - 2.0 complete rewrite for performance,
+ * - 2.0 complete rewrite for performance,
* added attributes month_names, *_id
* </pre>
- *
- * @link http://www.smarty.net/manual/en/language.function.html.select.date.php {html_select_date}
- * (Smarty online manual)
- * @version 2.0
- * @author Andrei Zmievski
- * @author Monte Ohrt <monte at ohrt dot com>
- * @author Rodney Rehm
- * @param array $params parameters
- * @param Smarty_Internal_Template $template template object
- * @return string
+ *
+ * @link http://www.smarty.net/manual/en/language.function.html.select.date.php {html_select_date}
+ * (Smarty online manual)
+ * @version 2.0
+ * @author Andrei Zmievski
+ * @author Monte Ohrt <monte at ohrt dot com>
+ * @author Rodney Rehm
+ *
+ * @param array $params parameters
+ *
+ * @return string
*/
-function smarty_function_html_select_date($params, $template)
+function smarty_function_html_select_date($params)
{
// generate timestamps used for month names only
static $_month_timestamps = null;
if ($_month_timestamps === null) {
$_current_year = date('Y');
$_month_timestamps = array();
- for ($i = 1; $i <= 12; $i++) {
+ for ($i = 1; $i <= 12; $i ++) {
$_month_timestamps[$i] = mktime(0, 0, 0, $i, 1, 2000);
}
}
$time = smarty_make_timestamp($_value);
}
break;
-
+
case 'month_names':
if (is_array($_value) && count($_value) == 12) {
$$_key = $_value;
trigger_error("html_select_date: month_names must be an array of 12 strings", E_USER_NOTICE);
}
break;
-
+
case 'prefix':
case 'field_array':
case 'start_year':
case 'month_id':
case 'day_id':
case 'year_id':
- $$_key = (string)$_value;
+ $$_key = (string) $_value;
break;
case 'display_days':
case 'display_years':
case 'year_as_text':
case 'reverse_years':
- $$_key = (bool)$_value;
+ $$_key = (bool) $_value;
break;
default:
$extra_attrs .= ' ' . $_key . '="' . smarty_function_escape_special_chars($_value) . '"';
} else {
trigger_error("html_select_date: extra attribute '$_key' cannot be an array", E_USER_NOTICE);
- }
+ }
break;
- }
+ }
}
-
+
// Note: date() is faster than strftime()
// Note: explode(date()) is faster than date() date() date()
if (isset($params['time']) && is_array($params['time'])) {
if (isset($params['time'][$prefix . 'Year'])) {
// $_REQUEST[$field_array] given
- foreach (array('Y' => 'Year', 'm' => 'Month', 'd' => 'Day') as $_elementKey => $_elementName) {
+ foreach (array('Y' => 'Year', 'm' => 'Month', 'd' => 'Day') as $_elementKey => $_elementName) {
$_variableName = '_' . strtolower($_elementName);
$$_variableName = isset($params['time'][$prefix . $_elementName])
? $params['time'][$prefix . $_elementName]
: date($_elementKey);
}
- $time = mktime(0, 0, 0, $_month, $_day, $_year);
} elseif (isset($params['time'][$field_array][$prefix . 'Year'])) {
// $_REQUEST given
- foreach (array('Y' => 'Year', 'm' => 'Month', 'd' => 'Day') as $_elementKey => $_elementName) {
+ foreach (array('Y' => 'Year', 'm' => 'Month', 'd' => 'Day') as $_elementKey => $_elementName) {
$_variableName = '_' . strtolower($_elementName);
$$_variableName = isset($params['time'][$field_array][$prefix . $_elementName])
? $params['time'][$field_array][$prefix . $_elementName]
: date($_elementKey);
}
- $time = mktime(0, 0, 0, $_month, $_day, $_year);
} else {
// no date found, use NOW
list($_year, $_month, $_day) = $time = explode('-', date('Y-m-d'));
$key .= '_year';
$t = $$key;
if ($t === null) {
- $$key = (int)$_current_year;
- } else if ($t[0] == '+') {
- $$key = (int)($_current_year + trim(substr($t, 1)));
- } else if ($t[0] == '-') {
- $$key = (int)($_current_year - trim(substr($t, 1)));
+ $$key = (int) $_current_year;
+ } elseif ($t[0] == '+') {
+ $$key = (int) ($_current_year + (int)trim(substr($t, 1)));
+ } elseif ($t[0] == '-') {
+ $$key = (int) ($_current_year - (int)trim(substr($t, 1)));
} else {
- $$key = (int)$$key;
+ $$key = (int) $$key;
}
}
// generate year <select> or <input>
if ($display_years) {
- $_html_years = '';
$_extra = '';
$_name = $field_array ? ($field_array . '[' . $prefix . 'Year]') : ($prefix . 'Year');
if ($all_extra) {
$_extra .= ' ' . $all_extra;
- }
+ }
if ($year_extra) {
$_extra .= ' ' . $year_extra;
}
-
+
if ($year_as_text) {
$_html_years = '<input type="text" name="' . $_name . '" value="' . $_year . '" size="4" maxlength="4"' . $_extra . $extra_attrs . ' />';
} else {
$_html_years = '<select name="' . $_name . '"';
if ($year_id !== null || $all_id !== null) {
- $_html_years .= ' id="' . smarty_function_escape_special_chars(
- $year_id !== null ? ( $year_id ? $year_id : $_name ) : ( $all_id ? ($all_id . $_name) : $_name )
- ) . '"';
+ $_html_years .= ' id="' . smarty_function_escape_special_chars(
+ $year_id !== null ? ($year_id ? $year_id : $_name) : ($all_id ? ($all_id . $_name) : $_name)
+ ) . '"';
}
if ($year_size) {
$_html_years .= ' size="' . $year_size . '"';
- }
+ }
$_html_years .= $_extra . $extra_attrs . '>' . $option_separator;
-
+
if (isset($year_empty) || isset($all_empty)) {
- $_html_years .= '<option value="">' . ( isset($year_empty) ? $year_empty : $all_empty ) . '</option>' . $option_separator;
+ $_html_years .= '<option value="">' . (isset($year_empty) ? $year_empty : $all_empty) . '</option>' . $option_separator;
}
-
- $op = $start_year > $end_year ? -1 : 1;
- for ($i=$start_year; $op > 0 ? $i <= $end_year : $i >= $end_year; $i += $op) {
+
+ $op = $start_year > $end_year ? - 1 : 1;
+ for ($i = $start_year; $op > 0 ? $i <= $end_year : $i >= $end_year; $i += $op) {
$_html_years .= '<option value="' . $i . '"'
. ($_year == $i ? ' selected="selected"' : '')
. '>' . $i . '</option>' . $option_separator;
}
-
+
$_html_years .= '</select>';
}
}
-
+
// generate month <select> or <input>
if ($display_months) {
- $_html_month = '';
$_extra = '';
$_name = $field_array ? ($field_array . '[' . $prefix . 'Month]') : ($prefix . 'Month');
if ($all_extra) {
$_extra .= ' ' . $all_extra;
- }
+ }
if ($month_extra) {
$_extra .= ' ' . $month_extra;
}
-
+
$_html_months = '<select name="' . $_name . '"';
if ($month_id !== null || $all_id !== null) {
- $_html_months .= ' id="' . smarty_function_escape_special_chars(
- $month_id !== null ? ( $month_id ? $month_id : $_name ) : ( $all_id ? ($all_id . $_name) : $_name )
- ) . '"';
+ $_html_months .= ' id="' . smarty_function_escape_special_chars(
+ $month_id !== null ? ($month_id ? $month_id : $_name) : ($all_id ? ($all_id . $_name) : $_name)
+ ) . '"';
}
if ($month_size) {
$_html_months .= ' size="' . $month_size . '"';
- }
+ }
$_html_months .= $_extra . $extra_attrs . '>' . $option_separator;
-
+
if (isset($month_empty) || isset($all_empty)) {
- $_html_months .= '<option value="">' . ( isset($month_empty) ? $month_empty : $all_empty ) . '</option>' . $option_separator;
+ $_html_months .= '<option value="">' . (isset($month_empty) ? $month_empty : $all_empty) . '</option>' . $option_separator;
}
-
- for ($i = 1; $i <= 12; $i++) {
+
+ for ($i = 1; $i <= 12; $i ++) {
$_val = sprintf('%02d', $i);
$_text = isset($month_names) ? smarty_function_escape_special_chars($month_names[$i]) : ($month_format == "%m" ? $_val : strftime($month_format, $_month_timestamps[$i]));
$_value = $month_value_format == "%m" ? $_val : strftime($month_value_format, $_month_timestamps[$i]);
. ($_val == $_month ? ' selected="selected"' : '')
. '>' . $_text . '</option>' . $option_separator;
}
-
+
$_html_months .= '</select>';
}
-
+
// generate day <select> or <input>
if ($display_days) {
- $_html_day = '';
$_extra = '';
$_name = $field_array ? ($field_array . '[' . $prefix . 'Day]') : ($prefix . 'Day');
if ($all_extra) {
$_extra .= ' ' . $all_extra;
- }
+ }
if ($day_extra) {
$_extra .= ' ' . $day_extra;
}
-
+
$_html_days = '<select name="' . $_name . '"';
if ($day_id !== null || $all_id !== null) {
- $_html_days .= ' id="' . smarty_function_escape_special_chars(
- $day_id !== null ? ( $day_id ? $day_id : $_name ) : ( $all_id ? ($all_id . $_name) : $_name )
- ) . '"';
+ $_html_days .= ' id="' . smarty_function_escape_special_chars(
+ $day_id !== null ? ($day_id ? $day_id : $_name) : ($all_id ? ($all_id . $_name) : $_name)
+ ) . '"';
}
if ($day_size) {
$_html_days .= ' size="' . $day_size . '"';
- }
+ }
$_html_days .= $_extra . $extra_attrs . '>' . $option_separator;
-
+
if (isset($day_empty) || isset($all_empty)) {
- $_html_days .= '<option value="">' . ( isset($day_empty) ? $day_empty : $all_empty ) . '</option>' . $option_separator;
+ $_html_days .= '<option value="">' . (isset($day_empty) ? $day_empty : $all_empty) . '</option>' . $option_separator;
}
-
- for ($i = 1; $i <= 31; $i++) {
+
+ for ($i = 1; $i <= 31; $i ++) {
$_val = sprintf('%02d', $i);
$_text = $day_format == '%02d' ? $_val : sprintf($day_format, $i);
- $_value = $day_value_format == '%02d' ? $_val : sprintf($day_value_format, $i);
+ $_value = $day_value_format == '%02d' ? $_val : sprintf($day_value_format, $i);
$_html_days .= '<option value="' . $_value . '"'
. ($_val == $_day ? ' selected="selected"' : '')
. '>' . $_text . '</option>' . $option_separator;
}
-
+
$_html_days .= '</select>';
}
// order the fields for output
$_html = '';
- for ($i=0; $i <= 2; $i++) {
+ for ($i = 0; $i <= 2; $i ++) {
switch ($field_order[$i]) {
case 'Y':
case 'y':
}
$_html .= $_html_years;
}
- break;
-
+ break;
+
case 'm':
case 'M':
if (isset($_html_months)) {
}
$_html .= $_html_months;
}
- break;
-
+ break;
+
case 'd':
case 'D':
if (isset($_html_days)) {
}
$_html .= $_html_days;
}
- break;
+ break;
}
}
+
return $_html;
}
-
-?>
\ No newline at end of file
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsFunction
*/
/**
* Smarty {html_select_time} function plugin
- *
* Type: function<br>
* Name: html_select_time<br>
* Purpose: Prints the dropdowns for time selection
*
- * @link http://www.smarty.net/manual/en/language.function.html.select.time.php {html_select_time}
- * (Smarty online manual)
- * @author Roberto Berto <roberto@berto.net>
- * @author Monte Ohrt <monte AT ohrt DOT com>
- * @param array $params parameters
- * @param Smarty_Internal_Template $template template object
+ * @link http://www.smarty.net/manual/en/language.function.html.select.time.php {html_select_time}
+ * (Smarty online manual)
+ * @author Roberto Berto <roberto@berto.net>
+ * @author Monte Ohrt <monte AT ohrt DOT com>
+ *
+ * @param array $params parameters
+ *
* @return string
- * @uses smarty_make_timestamp()
+ * @uses smarty_make_timestamp()
*/
-function smarty_function_html_select_time($params, $template)
+function smarty_function_html_select_time($params)
{
$prefix = "Time_";
$field_array = null;
case 'minute_value_format':
case 'second_format':
case 'second_value_format':
- $$_key = (string)$_value;
+ $$_key = (string) $_value;
break;
case 'display_hours':
case 'display_seconds':
case 'display_meridian':
case 'use_24_hours':
- $$_key = (bool)$_value;
+ $$_key = (bool) $_value;
break;
case 'minute_interval':
case 'minute_size':
case 'second_size':
case 'meridian_size':
- $$_key = (int)$_value;
+ $$_key = (int) $_value;
break;
default:
if (isset($params['time']) && is_array($params['time'])) {
if (isset($params['time'][$prefix . 'Hour'])) {
// $_REQUEST[$field_array] given
- foreach (array('H' => 'Hour', 'i' => 'Minute', 's' => 'Second') as $_elementKey => $_elementName) {
+ foreach (array('H' => 'Hour', 'i' => 'Minute', 's' => 'Second') as $_elementKey => $_elementName) {
$_variableName = '_' . strtolower($_elementName);
$$_variableName = isset($params['time'][$prefix . $_elementName])
? $params['time'][$prefix . $_elementName]
$_meridian = isset($params['time'][$prefix . 'Meridian'])
? (' ' . $params['time'][$prefix . 'Meridian'])
: '';
- $time = strtotime( $_hour . ':' . $_minute . ':' . $_second . $_meridian );
+ $time = strtotime($_hour . ':' . $_minute . ':' . $_second . $_meridian);
list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s', $time));
} elseif (isset($params['time'][$field_array][$prefix . 'Hour'])) {
// $_REQUEST given
- foreach (array('H' => 'Hour', 'i' => 'Minute', 's' => 'Second') as $_elementKey => $_elementName) {
+ foreach (array('H' => 'Hour', 'i' => 'Minute', 's' => 'Second') as $_elementKey => $_elementName) {
$_variableName = '_' . strtolower($_elementName);
$$_variableName = isset($params['time'][$field_array][$prefix . $_elementName])
? $params['time'][$field_array][$prefix . $_elementName]
$_meridian = isset($params['time'][$field_array][$prefix . 'Meridian'])
? (' ' . $params['time'][$field_array][$prefix . 'Meridian'])
: '';
- $time = strtotime( $_hour . ':' . $_minute . ':' . $_second . $_meridian );
+ $time = strtotime($_hour . ':' . $_minute . ':' . $_second . $_meridian);
list($_hour, $_minute, $_second) = $time = explode('-', date('H-i-s', $time));
} else {
// no date found, use NOW
$_html_hours = '<select name="' . $_name . '"';
if ($hour_id !== null || $all_id !== null) {
$_html_hours .= ' id="' . smarty_function_escape_special_chars(
- $hour_id !== null ? ( $hour_id ? $hour_id : $_name ) : ( $all_id ? ($all_id . $_name) : $_name )
- ) . '"';
+ $hour_id !== null ? ($hour_id ? $hour_id : $_name) : ($all_id ? ($all_id . $_name) : $_name)
+ ) . '"';
}
if ($hour_size) {
$_html_hours .= ' size="' . $hour_size . '"';
$_html_hours .= $_extra . $extra_attrs . '>' . $option_separator;
if (isset($hour_empty) || isset($all_empty)) {
- $_html_hours .= '<option value="">' . ( isset($hour_empty) ? $hour_empty : $all_empty ) . '</option>' . $option_separator;
+ $_html_hours .= '<option value="">' . (isset($hour_empty) ? $hour_empty : $all_empty) . '</option>' . $option_separator;
}
$start = $use_24_hours ? 0 : 1;
$end = $use_24_hours ? 23 : 12;
- for ($i=$start; $i <= $end; $i++) {
+ for ($i = $start; $i <= $end; $i ++) {
$_val = sprintf('%02d', $i);
$_text = $hour_format == '%02d' ? $_val : sprintf($hour_format, $i);
$_value = $hour_value_format == '%02d' ? $_val : sprintf($hour_value_format, $i);
if (!$use_24_hours) {
$_hour12 = $_hour == 0
? 12
- : ($_hour <= 12 ? $_hour : $_hour -12);
+ : ($_hour <= 12 ? $_hour : $_hour - 12);
}
$selected = $_hour !== null ? ($use_24_hours ? $_hour == $_val : $_hour12 == $_val) : null;
$_html_minutes = '<select name="' . $_name . '"';
if ($minute_id !== null || $all_id !== null) {
$_html_minutes .= ' id="' . smarty_function_escape_special_chars(
- $minute_id !== null ? ( $minute_id ? $minute_id : $_name ) : ( $all_id ? ($all_id . $_name) : $_name )
- ) . '"';
+ $minute_id !== null ? ($minute_id ? $minute_id : $_name) : ($all_id ? ($all_id . $_name) : $_name)
+ ) . '"';
}
if ($minute_size) {
$_html_minutes .= ' size="' . $minute_size . '"';
$_html_minutes .= $_extra . $extra_attrs . '>' . $option_separator;
if (isset($minute_empty) || isset($all_empty)) {
- $_html_minutes .= '<option value="">' . ( isset($minute_empty) ? $minute_empty : $all_empty ) . '</option>' . $option_separator;
+ $_html_minutes .= '<option value="">' . (isset($minute_empty) ? $minute_empty : $all_empty) . '</option>' . $option_separator;
}
$selected = $_minute !== null ? ($_minute - $_minute % $minute_interval) : null;
- for ($i=0; $i <= 59; $i += $minute_interval) {
+ for ($i = 0; $i <= 59; $i += $minute_interval) {
$_val = sprintf('%02d', $i);
$_text = $minute_format == '%02d' ? $_val : sprintf($minute_format, $i);
$_value = $minute_value_format == '%02d' ? $_val : sprintf($minute_value_format, $i);
$_html_seconds = '<select name="' . $_name . '"';
if ($second_id !== null || $all_id !== null) {
$_html_seconds .= ' id="' . smarty_function_escape_special_chars(
- $second_id !== null ? ( $second_id ? $second_id : $_name ) : ( $all_id ? ($all_id . $_name) : $_name )
- ) . '"';
+ $second_id !== null ? ($second_id ? $second_id : $_name) : ($all_id ? ($all_id . $_name) : $_name)
+ ) . '"';
}
if ($second_size) {
$_html_seconds .= ' size="' . $second_size . '"';
$_html_seconds .= $_extra . $extra_attrs . '>' . $option_separator;
if (isset($second_empty) || isset($all_empty)) {
- $_html_seconds .= '<option value="">' . ( isset($second_empty) ? $second_empty : $all_empty ) . '</option>' . $option_separator;
+ $_html_seconds .= '<option value="">' . (isset($second_empty) ? $second_empty : $all_empty) . '</option>' . $option_separator;
}
$selected = $_second !== null ? ($_second - $_second % $second_interval) : null;
- for ($i=0; $i <= 59; $i += $second_interval) {
+ for ($i = 0; $i <= 59; $i += $second_interval) {
$_val = sprintf('%02d', $i);
$_text = $second_format == '%02d' ? $_val : sprintf($second_format, $i);
$_value = $second_value_format == '%02d' ? $_val : sprintf($second_value_format, $i);
$_html_meridian = '<select name="' . $_name . '"';
if ($meridian_id !== null || $all_id !== null) {
$_html_meridian .= ' id="' . smarty_function_escape_special_chars(
- $meridian_id !== null ? ( $meridian_id ? $meridian_id : $_name ) : ( $all_id ? ($all_id . $_name) : $_name )
- ) . '"';
+ $meridian_id !== null ? ($meridian_id ? $meridian_id : $_name) : ($all_id ? ($all_id . $_name) : $_name)
+ ) . '"';
}
if ($meridian_size) {
$_html_meridian .= ' size="' . $meridian_size . '"';
$_html_meridian .= $_extra . $extra_attrs . '>' . $option_separator;
if (isset($meridian_empty) || isset($all_empty)) {
- $_html_meridian .= '<option value="">' . ( isset($meridian_empty) ? $meridian_empty : $all_empty ) . '</option>' . $option_separator;
+ $_html_meridian .= '<option value="">' . (isset($meridian_empty) ? $meridian_empty : $all_empty) . '</option>' . $option_separator;
}
- $_html_meridian .= '<option value="am"'. ($_hour < 12 ? ' selected="selected"' : '') .'>AM</option>' . $option_separator
- . '<option value="pm"'. ($_hour < 12 ? '' : ' selected="selected"') .'>PM</option>' . $option_separator
+ $_html_meridian .= '<option value="am"' . ($_hour > 0 && $_hour < 12 ? ' selected="selected"' : '') . '>AM</option>' . $option_separator
+ . '<option value="pm"' . ($_hour < 12 ? '' : ' selected="selected"') . '>PM</option>' . $option_separator
. '</select>';
}
return $_html;
}
-
-?>
\ No newline at end of file
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsFunction
*/
/**
* Smarty {html_table} function plugin
- *
* Type: function<br>
* Name: html_table<br>
* Date: Feb 17, 2003<br>
* {table loop=$data cols="first,second,third" tr_attr=$colors}
* </pre>
*
- * @author Monte Ohrt <monte at ohrt dot com>
- * @author credit to Messju Mohr <messju at lammfellpuschen dot de>
- * @author credit to boots <boots dot smarty at yahoo dot com>
- * @version 1.1
- * @link http://www.smarty.net/manual/en/language.function.html.table.php {html_table}
- * (Smarty online manual)
- * @param array $params parameters
- * @param Smarty_Internal_Template $template template object
+ * @author Monte Ohrt <monte at ohrt dot com>
+ * @author credit to Messju Mohr <messju at lammfellpuschen dot de>
+ * @author credit to boots <boots dot smarty at yahoo dot com>
+ * @version 1.1
+ * @link http://www.smarty.net/manual/en/language.function.html.table.php {html_table}
+ * (Smarty online manual)
+ *
+ * @param array $params parameters
+ *
* @return string
*/
-function smarty_function_html_table($params, $template)
+function smarty_function_html_table($params)
{
$table_attr = 'border="1"';
$tr_attr = '';
$loop = null;
if (!isset($params['loop'])) {
- trigger_error("html_table: missing 'loop' parameter",E_USER_WARNING);
+ trigger_error("html_table: missing 'loop' parameter", E_USER_WARNING);
+
return;
}
foreach ($params as $_key => $_value) {
switch ($_key) {
case 'loop':
- $$_key = (array)$_value;
+ $$_key = (array) $_value;
break;
case 'cols':
$cols = explode(',', $_value);
$cols_count = count($cols);
} elseif (!empty($_value)) {
- $cols_count = (int)$_value;
+ $cols_count = (int) $_value;
} else {
$cols_count = $cols;
}
break;
case 'rows':
- $$_key = (int)$_value;
+ $$_key = (int) $_value;
break;
case 'table_attr':
case 'vdir':
case 'inner':
case 'caption':
- $$_key = (string)$_value;
+ $$_key = (string) $_value;
break;
case 'tr_attr':
$cols = ($hdir == 'right') ? $cols : array_reverse($cols);
$output .= "<thead><tr>\n";
- for ($r = 0; $r < $cols_count; $r++) {
+ for ($r = 0; $r < $cols_count; $r ++) {
$output .= '<th' . smarty_function_html_table_cycle('th', $th_attr, $r) . '>';
$output .= $cols[$r];
$output .= "</th>\n";
}
$output .= "<tbody>\n";
- for ($r = 0; $r < $rows; $r++) {
+ for ($r = 0; $r < $rows; $r ++) {
$output .= "<tr" . smarty_function_html_table_cycle('tr', $tr_attr, $r) . ">\n";
- $rx = ($vdir == 'down') ? $r * $cols_count : ($rows-1 - $r) * $cols_count;
+ $rx = ($vdir == 'down') ? $r * $cols_count : ($rows - 1 - $r) * $cols_count;
- for ($c = 0; $c < $cols_count; $c++) {
- $x = ($hdir == 'right') ? $rx + $c : $rx + $cols_count-1 - $c;
+ for ($c = 0; $c < $cols_count; $c ++) {
+ $x = ($hdir == 'right') ? $rx + $c : $rx + $cols_count - 1 - $c;
if ($inner != 'cols') {
/* shuffle x to loop over rows*/
$x = floor($x / $cols_count) + ($x % $cols_count) * $rows;
return ($ret) ? ' ' . $ret : '';
}
-
-?>
\ No newline at end of file
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsFunction
*/
/**
* Smarty {mailto} function plugin
- *
* Type: function<br>
* Name: mailto<br>
* Date: May 21, 2002
* {mailto address="me@domain.com" extra='class="mailto"'}
* </pre>
*
- * @link http://www.smarty.net/manual/en/language.function.mailto.php {mailto}
- * (Smarty online manual)
- * @version 1.2
- * @author Monte Ohrt <monte at ohrt dot com>
- * @author credits to Jason Sweat (added cc, bcc and subject functionality)
- * @param array $params parameters
- * @param Smarty_Internal_Template $template template object
+ * @link http://www.smarty.net/manual/en/language.function.mailto.php {mailto}
+ * (Smarty online manual)
+ * @version 1.2
+ * @author Monte Ohrt <monte at ohrt dot com>
+ * @author credits to Jason Sweat (added cc, bcc and subject functionality)
+ *
+ * @param array $params parameters
+ *
* @return string
*/
-function smarty_function_mailto($params, $template)
+function smarty_function_mailto($params)
{
static $_allowed_encoding = array('javascript' => true, 'javascript_charcode' => true, 'hex' => true, 'none' => true);
$extra = '';
if (empty($params['address'])) {
- trigger_error("mailto: missing 'address' parameter",E_USER_WARNING);
+ trigger_error("mailto: missing 'address' parameter", E_USER_WARNING);
+
return;
} else {
$address = $params['address'];
case 'cc':
case 'bcc':
case 'followupto':
- if (!empty($value))
- $mail_parms[] = $var . '=' . str_replace($search, $replace, rawurlencode($value));
+ if (!empty($value)) {
+ $mail_parms[] = $var . '=' . str_replace($search, $replace, rawurlencode($value));
+ }
break;
case 'subject':
if ($mail_parms) {
$address .= '?' . join('&', $mail_parms);
}
-
+
$encode = (empty($params['encode'])) ? 'none' : $params['encode'];
if (!isset($_allowed_encoding[$encode])) {
trigger_error("mailto: 'encode' parameter must be none, javascript, javascript_charcode or hex", E_USER_WARNING);
+
return;
}
// FIXME: (rodneyrehm) document.write() excues me what? 1998 has passed!
$string = 'document.write(\'<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>\');';
$js_encode = '';
- for ($x = 0, $_length = strlen($string); $x < $_length; $x++) {
+ for ($x = 0, $_length = strlen($string); $x < $_length; $x ++) {
$js_encode .= '%' . bin2hex($string[$x]);
}
} elseif ($encode == 'javascript_charcode') {
$string = '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>';
- for($x = 0, $y = strlen($string); $x < $y; $x++) {
+ for ($x = 0, $y = strlen($string); $x < $y; $x ++) {
$ord[] = ord($string[$x]);
}
} elseif ($encode == 'hex') {
preg_match('!^(.*)(\?.*)$!', $address, $match);
if (!empty($match[2])) {
- trigger_error("mailto: hex encoding does not work with extra attributes. Try javascript.",E_USER_WARNING);
+ trigger_error("mailto: hex encoding does not work with extra attributes. Try javascript.", E_USER_WARNING);
+
return;
}
$address_encode = '';
- for ($x = 0, $_length = strlen($address); $x < $_length; $x++) {
+ for ($x = 0, $_length = strlen($address); $x < $_length; $x ++) {
if (preg_match('!\w!' . Smarty::$_UTF8_MODIFIER, $address[$x])) {
$address_encode .= '%' . bin2hex($address[$x]);
} else {
}
}
$text_encode = '';
- for ($x = 0, $_length = strlen($text); $x < $_length; $x++) {
+ for ($x = 0, $_length = strlen($text); $x < $_length; $x ++) {
$text_encode .= '&#x' . bin2hex($text[$x]) . ';';
}
$mailto = "mailto:";
+
return '<a href="' . $mailto . $address_encode . '" ' . $extra . '>' . $text_encode . '</a>';
} else {
// no encoding
return '<a href="mailto:' . $address . '" ' . $extra . '>' . $text . '</a>';
}
}
-
-?>
\ No newline at end of file
<?php
/**
* Smarty plugin
- *
* This plugin is only for Smarty2 BC
- * @package Smarty
+ *
+ * @package Smarty
* @subpackage PluginsFunction
*/
/**
* Smarty {math} function plugin
- *
* Type: function<br>
* Name: math<br>
* Purpose: handle math computations in template
*
- * @link http://www.smarty.net/manual/en/language.function.math.php {math}
- * (Smarty online manual)
+ * @link http://www.smarty.net/manual/en/language.function.math.php {math}
+ * (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
+ *
* @param array $params parameters
* @param Smarty_Internal_Template $template template object
+ *
* @return string|null
*/
function smarty_function_math($params, $template)
{
static $_allowed_funcs = array(
- 'int' => true, 'abs' => true, 'ceil' => true, 'cos' => true, 'exp' => true, 'floor' => true,
- 'log' => true, 'log10' => true, 'max' => true, 'min' => true, 'pi' => true, 'pow' => true,
- 'rand' => true, 'round' => true, 'sin' => true, 'sqrt' => true, 'srand' => true ,'tan' => true
+ 'int' => true, 'abs' => true, 'ceil' => true, 'cos' => true, 'exp' => true, 'floor' => true,
+ 'log' => true, 'log10' => true, 'max' => true, 'min' => true, 'pi' => true, 'pow' => true,
+ 'rand' => true, 'round' => true, 'sin' => true, 'sqrt' => true, 'srand' => true, 'tan' => true
);
// be sure equation parameter is present
if (empty($params['equation'])) {
- trigger_error("math: missing equation parameter",E_USER_WARNING);
+ trigger_error("math: missing equation parameter", E_USER_WARNING);
+
return;
}
$equation = $params['equation'];
// make sure parenthesis are balanced
- if (substr_count($equation,"(") != substr_count($equation,")")) {
- trigger_error("math: unbalanced parenthesis",E_USER_WARNING);
+ if (substr_count($equation, "(") != substr_count($equation, ")")) {
+ trigger_error("math: unbalanced parenthesis", E_USER_WARNING);
+
return;
}
// match all vars in equation, make sure all are passed
- preg_match_all("!(?:0x[a-fA-F0-9]+)|([a-zA-Z][a-zA-Z0-9_]*)!",$equation, $match);
+ preg_match_all("!(?:0x[a-fA-F0-9]+)|([a-zA-Z][a-zA-Z0-9_]*)!", $equation, $match);
- foreach($match[1] as $curr_var) {
+ foreach ($match[1] as $curr_var) {
if ($curr_var && !isset($params[$curr_var]) && !isset($_allowed_funcs[$curr_var])) {
- trigger_error("math: function call $curr_var not allowed",E_USER_WARNING);
+ trigger_error("math: function call $curr_var not allowed", E_USER_WARNING);
+
return;
}
}
- foreach($params as $key => $val) {
+ foreach ($params as $key => $val) {
if ($key != "equation" && $key != "format" && $key != "assign") {
// make sure value is not empty
- if (strlen($val)==0) {
- trigger_error("math: parameter $key is empty",E_USER_WARNING);
+ if (strlen($val) == 0) {
+ trigger_error("math: parameter $key is empty", E_USER_WARNING);
+
return;
}
if (!is_numeric($val)) {
- trigger_error("math: parameter $key: is not numeric",E_USER_WARNING);
+ trigger_error("math: parameter $key: is not numeric", E_USER_WARNING);
+
return;
}
$equation = preg_replace("/\b$key\b/", " \$params['$key'] ", $equation);
}
}
$smarty_math_result = null;
- eval("\$smarty_math_result = ".$equation.";");
+ eval("\$smarty_math_result = " . $equation . ";");
if (empty($params['format'])) {
if (empty($params['assign'])) {
return $smarty_math_result;
} else {
- $template->assign($params['assign'],$smarty_math_result);
+ $template->assign($params['assign'], $smarty_math_result);
}
} else {
- if (empty($params['assign'])){
- printf($params['format'],$smarty_math_result);
+ if (empty($params['assign'])) {
+ printf($params['format'], $smarty_math_result);
} else {
- $template->assign($params['assign'],sprintf($params['format'],$smarty_math_result));
+ $template->assign($params['assign'], sprintf($params['format'], $smarty_math_result));
}
}
}
-
-?>
\ No newline at end of file
<?php
/**
* Smarty plugin
- *
- * @package Smarty
+ *
+ * @package Smarty
* @subpackage PluginsModifier
*/
/**
* Smarty capitalize modifier plugin
- *
* Type: modifier<br>
* Name: capitalize<br>
* Purpose: capitalize words in the string
- *
* {@internal {$string|capitalize:true:true} is the fastest option for MBString enabled systems }}
*
* @param string $string string to capitalize
* @param boolean $uc_digits also capitalize "x123" to "X123"
* @param boolean $lc_rest capitalize first letters, lowercase all following letters "aAa" to "Aaa"
+ *
* @return string capitalized string
- * @author Monte Ohrt <monte at ohrt dot com>
+ * @author Monte Ohrt <monte at ohrt dot com>
* @author Rodney Rehm
*/
function smarty_modifier_capitalize($string, $uc_digits = false, $lc_rest = false)
if (Smarty::$_MBSTRING) {
if ($lc_rest) {
// uppercase (including hyphenated words)
- $upper_string = mb_convert_case( $string, MB_CASE_TITLE, Smarty::$_CHARSET );
+ $upper_string = mb_convert_case($string, MB_CASE_TITLE, Smarty::$_CHARSET);
} else {
// uppercase word breaks
- $upper_string = preg_replace("!(^|[^\p{L}'])([\p{Ll}])!eS" . Smarty::$_UTF8_MODIFIER, "stripslashes('\\1').mb_convert_case(stripslashes('\\2'),MB_CASE_UPPER, '" . addslashes(Smarty::$_CHARSET) . "')", $string);
+ $upper_string = preg_replace_callback("!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_mbconvert_cb', $string);
}
// check uc_digits case
if (!$uc_digits) {
if (preg_match_all("!\b([\p{L}]*[\p{N}]+[\p{L}]*)\b!" . Smarty::$_UTF8_MODIFIER, $string, $matches, PREG_OFFSET_CAPTURE)) {
- foreach($matches[1] as $match) {
+ foreach ($matches[1] as $match) {
$upper_string = substr_replace($upper_string, mb_strtolower($match[0], Smarty::$_CHARSET), $match[1], strlen($match[0]));
}
- }
+ }
}
- $upper_string = preg_replace("!((^|\s)['\"])(\w)!e" . Smarty::$_UTF8_MODIFIER, "stripslashes('\\1').mb_convert_case(stripslashes('\\3'),MB_CASE_UPPER, '" . addslashes(Smarty::$_CHARSET) . "')", $upper_string);
+ $upper_string = preg_replace_callback("!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_mbconvert2_cb', $upper_string);
return $upper_string;
}
-
+
// lowercase first
if ($lc_rest) {
$string = strtolower($string);
}
// uppercase (including hyphenated words)
- $upper_string = preg_replace("!(^|[^\p{L}'])([\p{Ll}])!eS" . Smarty::$_UTF8_MODIFIER, "stripslashes('\\1').ucfirst(stripslashes('\\2'))", $string);
+ $upper_string = preg_replace_callback("!(^|[^\p{L}'])([\p{Ll}])!S" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_ucfirst_cb', $string);
// check uc_digits case
if (!$uc_digits) {
if (preg_match_all("!\b([\p{L}]*[\p{N}]+[\p{L}]*)\b!" . Smarty::$_UTF8_MODIFIER, $string, $matches, PREG_OFFSET_CAPTURE)) {
- foreach($matches[1] as $match) {
+ foreach ($matches[1] as $match) {
$upper_string = substr_replace($upper_string, strtolower($match[0]), $match[1], strlen($match[0]));
}
- }
+ }
}
- $upper_string = preg_replace("!((^|\s)['\"])(\w)!e" . Smarty::$_UTF8_MODIFIER, "stripslashes('\\1').strtoupper(stripslashes('\\3'))", $upper_string);
+ $upper_string = preg_replace_callback("!((^|\s)['\"])(\w)!" . Smarty::$_UTF8_MODIFIER, 'smarty_mod_cap_ucfirst2_cb', $upper_string);
return $upper_string;
-}
+}
+
+/*
+ *
+ * Bug: create_function() use exhausts memory when used in long loops
+ * Fix: use declared functions for callbacks instead of using create_function()
+ * Note: This can be fixed using anonymous functions instead, but that requires PHP >= 5.3
+ *
+ * @author Kyle Renfrow
+ */
+function smarty_mod_cap_mbconvert_cb($matches)
+{
+ return stripslashes($matches[1]) . mb_convert_case(stripslashes($matches[2]), MB_CASE_UPPER, Smarty::$_CHARSET);
+}
+
+function smarty_mod_cap_mbconvert2_cb($matches)
+{
+ return stripslashes($matches[1]) . mb_convert_case(stripslashes($matches[3]), MB_CASE_UPPER, Smarty::$_CHARSET);
+}
+
+function smarty_mod_cap_ucfirst_cb($matches)
+{
+ return stripslashes($matches[1]) . ucfirst(stripslashes($matches[2]));
+}
-?>
\ No newline at end of file
+function smarty_mod_cap_ucfirst2_cb($matches)
+{
+ return stripslashes($matches[1]) . ucfirst(stripslashes($matches[3]));
+}
<?php
/**
* Smarty plugin
- *
- * @package Smarty
+ *
+ * @package Smarty
* @subpackage PluginsModifier
*/
/**
* Smarty date_format modifier plugin
- *
* Type: modifier<br>
* Name: date_format<br>
* Purpose: format datestamps via strftime<br>
* - string: input date string
* - format: strftime format for output
* - default_date: default date if $string is empty
- *
- * @link http://www.smarty.net/manual/en/language.modifier.date.format.php date_format (Smarty online manual)
- * @author Monte Ohrt <monte at ohrt dot com>
+ *
+ * @link http://www.smarty.net/manual/en/language.modifier.date.format.php date_format (Smarty online manual)
+ * @author Monte Ohrt <monte at ohrt dot com>
+ *
* @param string $string input date string
* @param string $format strftime format for output
* @param string $default_date default date if $string is empty
* @param string $formatter either 'strftime' or 'auto'
+ *
* @return string |void
- * @uses smarty_make_timestamp()
+ * @uses smarty_make_timestamp()
*/
-function smarty_modifier_date_format($string, $format=null, $default_date='', $formatter='auto')
+function smarty_modifier_date_format($string, $format = null, $default_date = '', $formatter = 'auto')
{
if ($format === null) {
$format = Smarty::$_DATE_FORMAT;
}
/**
- * Include the {@link shared.make_timestamp.php} plugin
- */
+ * Include the {@link shared.make_timestamp.php} plugin
+ */
require_once(SMARTY_PLUGINS_DIR . 'shared.make_timestamp.php');
if ($string != '' && $string != '0000-00-00' && $string != '0000-00-00 00:00:00') {
$timestamp = smarty_make_timestamp($string);
$timestamp = smarty_make_timestamp($default_date);
} else {
return;
- }
- if($formatter=='strftime'||($formatter=='auto'&&strpos($format,'%')!==false)) {
+ }
+ if ($formatter == 'strftime' || ($formatter == 'auto' && strpos($format, '%') !== false)) {
if (DS == '\\') {
$_win_from = array('%D', '%h', '%n', '%r', '%R', '%t', '%T');
$_win_to = array('%m/%d/%y', '%b', "\n", '%I:%M:%S %p', '%H:%M', "\t", '%H:%M:%S');
if (strpos($format, '%e') !== false) {
$_win_from[] = '%e';
$_win_to[] = sprintf('%\' 2d', date('j', $timestamp));
- }
+ }
if (strpos($format, '%l') !== false) {
$_win_from[] = '%l';
$_win_to[] = sprintf('%\' 2d', date('h', $timestamp));
- }
+ }
$format = str_replace($_win_from, $_win_to, $format);
- }
+ }
+
return strftime($format, $timestamp);
} else {
return date($format, $timestamp);
}
-}
-
-?>
\ No newline at end of file
+}
<?php
/**
* Smarty plugin
- *
- * @package Smarty
+ *
+ * @package Smarty
* @subpackage Debug
*/
/**
* Smarty debug_print_var modifier plugin
- *
* Type: modifier<br>
* Name: debug_print_var<br>
* Purpose: formats variable contents for display in the console
*
- * @author Monte Ohrt <monte at ohrt dot com>
- * @param array|object $var variable to be formatted
- * @param integer $depth maximum recursion depth if $var is an array
- * @param integer $length maximum string length if $var is a string
- * @return string
+ * @author Monte Ohrt <monte at ohrt dot com>
+ *
+ * @param array|object $var variable to be formatted
+ * @param integer $depth maximum recursion depth if $var is an array
+ * @param integer $length maximum string length if $var is a string
+ *
+ * @return string
*/
-function smarty_modifier_debug_print_var ($var, $depth = 0, $length = 40)
+function smarty_modifier_debug_print_var($var, $depth = 0, $length = 40)
{
$_replace = array("\n" => '<i>\n</i>',
- "\r" => '<i>\r</i>',
- "\t" => '<i>\t</i>'
- );
+ "\r" => '<i>\r</i>',
+ "\t" => '<i>\t</i>'
+ );
switch (gettype($var)) {
case 'array' :
$results = '<b>Array (' . count($var) . ')</b>';
foreach ($var as $curr_key => $curr_val) {
$results .= '<br>' . str_repeat(' ', $depth * 2)
- . '<b>' . strtr($curr_key, $_replace) . '</b> => '
- . smarty_modifier_debug_print_var($curr_val, ++$depth, $length);
- $depth--;
- }
+ . '<b>' . strtr($curr_key, $_replace) . '</b> => '
+ . smarty_modifier_debug_print_var($curr_val, ++$depth, $length);
+ $depth --;
+ }
break;
-
+
case 'object' :
$object_vars = get_object_vars($var);
$results = '<b>' . get_class($var) . ' Object (' . count($object_vars) . ')</b>';
foreach ($object_vars as $curr_key => $curr_val) {
$results .= '<br>' . str_repeat(' ', $depth * 2)
- . '<b> ->' . strtr($curr_key, $_replace) . '</b> = '
- . smarty_modifier_debug_print_var($curr_val, ++$depth, $length);
- $depth--;
- }
+ . '<b> ->' . strtr($curr_key, $_replace) . '</b> = '
+ . smarty_modifier_debug_print_var($curr_val, ++$depth, $length);
+ $depth --;
+ }
break;
-
+
case 'boolean' :
case 'NULL' :
case 'resource' :
$results = 'null';
} else {
$results = htmlspecialchars((string) $var);
- }
+ }
$results = '<i>' . $results . '</i>';
break;
-
+
case 'integer' :
case 'float' :
$results = htmlspecialchars((string) $var);
break;
-
+
case 'string' :
$results = strtr($var, $_replace);
if (Smarty::$_MBSTRING) {
$results = htmlspecialchars('"' . $results . '"');
break;
-
+
case 'unknown type' :
default :
$results = strtr((string) $var, $_replace);
$results = substr($results, 0, $length - 3) . '...';
}
}
-
+
$results = htmlspecialchars($results);
- }
+ }
return $results;
-}
-
-?>
\ No newline at end of file
+}
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsModifier
*/
/**
* Smarty escape modifier plugin
- *
* Type: modifier<br>
* Name: escape<br>
* Purpose: escape string for output
*
- * @link http://www.smarty.net/manual/en/language.modifier.count.characters.php count_characters (Smarty online manual)
+ * @link http://www.smarty.net/manual/en/language.modifier.count.characters.php count_characters (Smarty online manual)
* @author Monte Ohrt <monte at ohrt dot com>
+ *
* @param string $string input string
* @param string $esc_type escape type
* @param string $char_set character set, used for htmlspecialchars() or htmlentities()
* @param boolean $double_encode encode already encoded entitites again, used for htmlspecialchars() or htmlentities()
+ *
* @return string escaped input string
*/
function smarty_modifier_escape($string, $esc_type = 'html', $char_set = null, $double_encode = true)
if ($_double_encode === null) {
$_double_encode = version_compare(PHP_VERSION, '5.2.3', '>=');
}
-
+
if (!$char_set) {
$char_set = Smarty::$_CHARSET;
}
return htmlspecialchars($string, ENT_QUOTES, $char_set, $double_encode);
} else {
if ($double_encode) {
- // php <5.3.2 - only handle double encoding
+ // php <5.2.3 - only handle double encoding
return htmlspecialchars($string, ENT_QUOTES, $char_set);
} else {
- // php <5.3.2 - prevent double encoding
+ // php <5.2.3 - prevent double encoding
$string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string);
$string = htmlspecialchars($string, ENT_QUOTES, $char_set);
$string = str_replace(array('%%%SMARTY_START%%%', '%%%SMARTY_END%%%'), array('&', ';'), $string);
+
return $string;
}
}
$string = htmlspecialchars($string, ENT_QUOTES, $char_set, $double_encode);
} else {
if ($double_encode) {
- // php <5.3.2 - only handle double encoding
+ // php <5.2.3 - only handle double encoding
$string = htmlspecialchars($string, ENT_QUOTES, $char_set);
} else {
- // php <5.3.2 - prevent double encoding
+ // php <5.2.3 - prevent double encoding
$string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string);
$string = htmlspecialchars($string, ENT_QUOTES, $char_set);
$string = str_replace(array('%%%SMARTY_START%%%', '%%%SMARTY_END%%%'), array('&', ';'), $string);
+
return $string;
}
}
-
+
// htmlentities() won't convert everything, so use mb_convert_encoding
return mb_convert_encoding($string, 'HTML-ENTITIES', $char_set);
}
$string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string);
$string = htmlentities($string, ENT_QUOTES, $char_set);
$string = str_replace(array('%%%SMARTY_START%%%', '%%%SMARTY_END%%%'), array('&', ';'), $string);
+
return $string;
}
}
// Note that the UTF-8 encoded character ä will be represented as %c3%a4
$return = '';
$_length = strlen($string);
- for ($x = 0; $x < $_length; $x++) {
+ for ($x = 0; $x < $_length; $x ++) {
$return .= '%' . bin2hex($string[$x]);
}
+
return $return;
case 'hexentity':
foreach (smarty_mb_to_unicode($string, Smarty::$_CHARSET) as $unicode) {
$return .= '&#x' . strtoupper(dechex($unicode)) . ';';
}
+
return $return;
}
// no MBString fallback
$_length = strlen($string);
- for ($x = 0; $x < $_length; $x++) {
+ for ($x = 0; $x < $_length; $x ++) {
$return .= '&#x' . bin2hex($string[$x]) . ';';
}
+
return $return;
case 'decentity':
foreach (smarty_mb_to_unicode($string, Smarty::$_CHARSET) as $unicode) {
$return .= '&#' . $unicode . ';';
}
+
return $return;
}
// no MBString fallback
$_length = strlen($string);
- for ($x = 0; $x < $_length; $x++) {
+ for ($x = 0; $x < $_length; $x ++) {
$return .= '&#' . ord($string[$x]) . ';';
}
+
return $return;
case 'javascript':
case 'mail':
if (Smarty::$_MBSTRING) {
require_once(SMARTY_PLUGINS_DIR . 'shared.mb_str_replace.php');
+
return smarty_mb_str_replace(array('@', '.'), array(' [AT] ', ' [DOT] '), $string);
}
// no MBString fallback
$return .= chr($unicode);
}
}
+
return $return;
}
$_length = strlen($string);
- for ($_i = 0; $_i < $_length; $_i++) {
+ for ($_i = 0; $_i < $_length; $_i ++) {
$_ord = ord(substr($string, $_i, 1));
// non-standard char, escape it
if ($_ord >= 126) {
$return .= substr($string, $_i, 1);
}
}
+
return $return;
default:
return $string;
}
}
-
-?>
\ No newline at end of file
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsModifier
*/
/**
* Smarty regex_replace modifier plugin
- *
* Type: modifier<br>
* Name: regex_replace<br>
* Purpose: regular expression search/replace
*
- * @link http://smarty.php.net/manual/en/language.modifier.regex.replace.php
+ * @link http://smarty.php.net/manual/en/language.modifier.regex.replace.php
* regex_replace (Smarty online manual)
- * @author Monte Ohrt <monte at ohrt dot com>
- * @param string $string input string
- * @param string|array $search regular expression(s) to search for
- * @param string|array $replace string(s) that should be replaced
+ * @author Monte Ohrt <monte at ohrt dot com>
+ *
+ * @param string $string input string
+ * @param string|array $search regular expression(s) to search for
+ * @param string|array $replace string(s) that should be replaced
+ *
* @return string
*/
function smarty_modifier_regex_replace($string, $search, $replace)
{
- if(is_array($search)) {
- foreach($search as $idx => $s) {
+ if (is_array($search)) {
+ foreach ($search as $idx => $s) {
$search[$idx] = _smarty_regex_replace_check($s);
}
} else {
$search = _smarty_regex_replace_check($search);
}
+
return preg_replace($search, $replace, $string);
}
/**
* @param string $search string(s) that should be replaced
+ *
* @return string
* @ignore
*/
{
// null-byte injection detection
// anything behind the first null-byte is ignored
- if (($pos = strpos($search,"\0")) !== false) {
- $search = substr($search,0,$pos);
+ if (($pos = strpos($search, "\0")) !== false) {
+ $search = substr($search, 0, $pos);
}
// remove eval-modifier from $search
if (preg_match('!([a-zA-Z\s]+)$!s', $search, $match) && (strpos($match[1], 'e') !== false)) {
- $search = substr($search, 0, -strlen($match[1])) . preg_replace('![e\s]+!', '', $match[1]);
+ $search = substr($search, 0, - strlen($match[1])) . preg_replace('![e\s]+!', '', $match[1]);
}
+
return $search;
}
-
-?>
\ No newline at end of file
<?php
/**
* Smarty plugin
- * @package Smarty
+ *
+ * @package Smarty
* @subpackage PluginsModifier
*/
/**
* Smarty replace modifier plugin
- *
* Type: modifier<br>
* Name: replace<br>
* Purpose: simple search/replace
- *
- * @link http://smarty.php.net/manual/en/language.modifier.replace.php replace (Smarty online manual)
- * @author Monte Ohrt <monte at ohrt dot com>
- * @author Uwe Tews
+ *
+ * @link http://smarty.php.net/manual/en/language.modifier.replace.php replace (Smarty online manual)
+ * @author Monte Ohrt <monte at ohrt dot com>
+ * @author Uwe Tews
+ *
* @param string $string input string
* @param string $search text to search for
* @param string $replace replacement text
- * @return string
+ *
+ * @return string
*/
function smarty_modifier_replace($string, $search, $replace)
{
if (Smarty::$_MBSTRING) {
require_once(SMARTY_PLUGINS_DIR . 'shared.mb_str_replace.php');
+
return smarty_mb_str_replace($search, $replace, $string);
}
-
- return str_replace($search, $replace, $string);
-}
-?>
\ No newline at end of file
+ return str_replace($search, $replace, $string);
+}
<?php
/**
* Smarty plugin
- * @package Smarty
+ *
+ * @package Smarty
* @subpackage PluginsModifier
*/
/**
* Smarty spacify modifier plugin
- *
* Type: modifier<br>
* Name: spacify<br>
* Purpose: add spaces between characters in a string
- *
- * @link http://smarty.php.net/manual/en/language.modifier.spacify.php spacify (Smarty online manual)
- * @author Monte Ohrt <monte at ohrt dot com>
+ *
+ * @link http://smarty.php.net/manual/en/language.modifier.spacify.php spacify (Smarty online manual)
+ * @author Monte Ohrt <monte at ohrt dot com>
+ *
* @param string $string input string
* @param string $spacify_char string to insert between characters.
+ *
* @return string
*/
function smarty_modifier_spacify($string, $spacify_char = ' ')
{
// well… what about charsets besides latin and UTF-8?
- return implode($spacify_char, preg_split('//' . Smarty::$_UTF8_MODIFIER, $string, -1, PREG_SPLIT_NO_EMPTY));
-}
-
-?>
\ No newline at end of file
+ return implode($spacify_char, preg_split('//' . Smarty::$_UTF8_MODIFIER, $string, - 1, PREG_SPLIT_NO_EMPTY));
+}
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsModifier
*/
-
+
/**
* Smarty truncate modifier plugin
- *
* Type: modifier<br>
* Name: truncate<br>
* Purpose: Truncate a string to a certain length if necessary,
* optionally splitting in the middle of a word, and
* appending the $etc string or inserting $etc into the middle.
- *
- * @link http://smarty.php.net/manual/en/language.modifier.truncate.php truncate (Smarty online manual)
- * @author Monte Ohrt <monte at ohrt dot com>
+ *
+ * @link http://smarty.php.net/manual/en/language.modifier.truncate.php truncate (Smarty online manual)
+ * @author Monte Ohrt <monte at ohrt dot com>
+ *
* @param string $string input string
* @param integer $length length of truncated text
* @param string $etc end string
* @param boolean $break_words truncate at word boundary
* @param boolean $middle truncate in the middle of text
+ *
* @return string truncated string
*/
-function smarty_modifier_truncate($string, $length = 80, $etc = '...', $break_words = false, $middle = false) {
- if ($length == 0)
+function smarty_modifier_truncate($string, $length = 80, $etc = '...', $break_words = false, $middle = false)
+{
+ if ($length == 0) {
return '';
+ }
if (Smarty::$_MBSTRING) {
if (mb_strlen($string, Smarty::$_CHARSET) > $length) {
$length -= min($length, mb_strlen($etc, Smarty::$_CHARSET));
if (!$break_words && !$middle) {
$string = preg_replace('/\s+?(\S+)?$/' . Smarty::$_UTF8_MODIFIER, '', mb_substr($string, 0, $length + 1, Smarty::$_CHARSET));
- }
+ }
if (!$middle) {
return mb_substr($string, 0, $length, Smarty::$_CHARSET) . $etc;
}
+
return mb_substr($string, 0, $length / 2, Smarty::$_CHARSET) . $etc . mb_substr($string, - $length / 2, $length, Smarty::$_CHARSET);
}
+
return $string;
}
-
+
// no MBString fallback
if (isset($string[$length])) {
$length -= min($length, strlen($etc));
if (!$break_words && !$middle) {
$string = preg_replace('/\s+?(\S+)?$/', '', substr($string, 0, $length + 1));
- }
+ }
if (!$middle) {
return substr($string, 0, $length) . $etc;
}
+
return substr($string, 0, $length / 2) . $etc . substr($string, - $length / 2);
}
- return $string;
-}
-?>
\ No newline at end of file
+ return $string;
+}
-<?php\r
-/**\r
- * Smarty plugin\r
- *\r
- * @package Smarty\r
- * @subpackage PluginsModifierCompiler\r
- */\r
-\r
-/**\r
- * Smarty cat modifier plugin\r
- *\r
- * Type: modifier<br>\r
- * Name: cat<br>\r
- * Date: Feb 24, 2003<br>\r
- * Purpose: catenate a value to a variable<br>\r
- * Input: string to catenate<br>\r
- * Example: {$var|cat:"foo"}\r
- *\r
- * @link http://smarty.php.net/manual/en/language.modifier.cat.php cat\r
- * (Smarty online manual)\r
- * @author Uwe Tews\r
- * @param array $params parameters\r
- * @return string with compiled code\r
- */\r
-function smarty_modifiercompiler_cat($params, $compiler)\r
-{\r
- return '('.implode(').(', $params).')';\r
-}\r
-\r
-?>
\ No newline at end of file
+<?php
+/**
+ * Smarty plugin
+ *
+ * @package Smarty
+ * @subpackage PluginsModifierCompiler
+ */
+
+/**
+ * Smarty cat modifier plugin
+ * Type: modifier<br>
+ * Name: cat<br>
+ * Date: Feb 24, 2003<br>
+ * Purpose: catenate a value to a variable<br>
+ * Input: string to catenate<br>
+ * Example: {$var|cat:"foo"}
+ *
+ * @link http://smarty.php.net/manual/en/language.modifier.cat.php cat
+ * (Smarty online manual)
+ * @author Uwe Tews
+ *
+ * @param array $params parameters
+ *
+ * @return string with compiled code
+ */
+function smarty_modifiercompiler_cat($params)
+{
+ return '(' . implode(').(', $params) . ')';
+}
-<?php\r
-/**\r
- * Smarty plugin\r
- *\r
- * @package Smarty\r
- * @subpackage PluginsModifierCompiler\r
- */\r
-\r
-/**\r
- * Smarty count_characters modifier plugin\r
- *\r
- * Type: modifier<br>\r
- * Name: count_characteres<br>\r
- * Purpose: count the number of characters in a text\r
- *\r
- * @link http://www.smarty.net/manual/en/language.modifier.count.characters.php count_characters (Smarty online manual)\r
- * @author Uwe Tews\r
- * @param array $params parameters\r
- * @return string with compiled code\r
- */\r
-function smarty_modifiercompiler_count_characters($params, $compiler)\r
-{\r
- if (!isset($params[1]) || $params[1] != 'true') {\r
- return 'preg_match_all(\'/[^\s]/' . Smarty::$_UTF8_MODIFIER . '\',' . $params[0] . ', $tmp)';\r
- }\r
- if (Smarty::$_MBSTRING) {\r
- return 'mb_strlen(' . $params[0] . ', \'' . addslashes(Smarty::$_CHARSET) . '\')';\r
- }\r
- // no MBString fallback\r
- return 'strlen(' . $params[0] . ')';\r
-}\r
-\r
-?>
\ No newline at end of file
+<?php
+/**
+ * Smarty plugin
+ *
+ * @package Smarty
+ * @subpackage PluginsModifierCompiler
+ */
+
+/**
+ * Smarty count_characters modifier plugin
+ * Type: modifier<br>
+ * Name: count_characteres<br>
+ * Purpose: count the number of characters in a text
+ *
+ * @link http://www.smarty.net/manual/en/language.modifier.count.characters.php count_characters (Smarty online manual)
+ * @author Uwe Tews
+ *
+ * @param array $params parameters
+ *
+ * @return string with compiled code
+ */
+function smarty_modifiercompiler_count_characters($params)
+{
+ if (!isset($params[1]) || $params[1] != 'true') {
+ return 'preg_match_all(\'/[^\s]/' . Smarty::$_UTF8_MODIFIER . '\',' . $params[0] . ', $tmp)';
+ }
+ if (Smarty::$_MBSTRING) {
+ return 'mb_strlen(' . $params[0] . ', \'' . addslashes(Smarty::$_CHARSET) . '\')';
+ }
+ // no MBString fallback
+ return 'strlen(' . $params[0] . ')';
+}
-<?php\r
-/**\r
- * Smarty plugin\r
- *\r
- * @package Smarty\r
- * @subpackage PluginsModifierCompiler\r
- */\r
-\r
-/**\r
- * Smarty count_paragraphs modifier plugin\r
- *\r
- * Type: modifier<br>\r
- * Name: count_paragraphs<br>\r
- * Purpose: count the number of paragraphs in a text\r
- *\r
- * @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php\r
- * count_paragraphs (Smarty online manual)\r
- * @author Uwe Tews\r
- * @param array $params parameters\r
- * @return string with compiled code\r
- */\r
-function smarty_modifiercompiler_count_paragraphs($params, $compiler)\r
-{\r
- // count \r or \n characters\r
- return '(preg_match_all(\'#[\r\n]+#\', ' . $params[0] . ', $tmp)+1)';\r
-}\r
-\r
-?>
\ No newline at end of file
+<?php
+/**
+ * Smarty plugin
+ *
+ * @package Smarty
+ * @subpackage PluginsModifierCompiler
+ */
+
+/**
+ * Smarty count_paragraphs modifier plugin
+ * Type: modifier<br>
+ * Name: count_paragraphs<br>
+ * Purpose: count the number of paragraphs in a text
+ *
+ * @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php
+ * count_paragraphs (Smarty online manual)
+ * @author Uwe Tews
+ *
+ * @param array $params parameters
+ *
+ * @return string with compiled code
+ */
+function smarty_modifiercompiler_count_paragraphs($params)
+{
+ // count \r or \n characters
+ return '(preg_match_all(\'#[\r\n]+#\', ' . $params[0] . ', $tmp)+1)';
+}
-<?php\r
-/**\r
- * Smarty plugin\r
- *\r
- * @package Smarty\r
- * @subpackage PluginsModifierCompiler\r
- */\r
-\r
-/**\r
- * Smarty count_sentences modifier plugin\r
- *\r
- * Type: modifier<br>\r
- * Name: count_sentences\r
- * Purpose: count the number of sentences in a text\r
- *\r
- * @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php\r
- * count_sentences (Smarty online manual)\r
- * @author Uwe Tews\r
- * @param array $params parameters\r
- * @return string with compiled code\r
- */\r
-function smarty_modifiercompiler_count_sentences($params, $compiler)\r
-{\r
- // find periods, question marks, exclamation marks with a word before but not after.\r
- return 'preg_match_all("#\w[\.\?\!](\W|$)#S' . Smarty::$_UTF8_MODIFIER . '", ' . $params[0] . ', $tmp)';\r
-}\r
-\r
-?>
\ No newline at end of file
+<?php
+/**
+ * Smarty plugin
+ *
+ * @package Smarty
+ * @subpackage PluginsModifierCompiler
+ */
+
+/**
+ * Smarty count_sentences modifier plugin
+ * Type: modifier<br>
+ * Name: count_sentences
+ * Purpose: count the number of sentences in a text
+ *
+ * @link http://www.smarty.net/manual/en/language.modifier.count.paragraphs.php
+ * count_sentences (Smarty online manual)
+ * @author Uwe Tews
+ *
+ * @param array $params parameters
+ *
+ * @return string with compiled code
+ */
+function smarty_modifiercompiler_count_sentences($params)
+{
+ // find periods, question marks, exclamation marks with a word before but not after.
+ return 'preg_match_all("#\w[\.\?\!](\W|$)#S' . Smarty::$_UTF8_MODIFIER . '", ' . $params[0] . ', $tmp)';
+}
-<?php\r
-/**\r
- * Smarty plugin\r
- *\r
- * @package Smarty\r
- * @subpackage PluginsModifierCompiler\r
- */\r
-\r
-/**\r
- * Smarty count_words modifier plugin\r
- *\r
- * Type: modifier<br>\r
- * Name: count_words<br>\r
- * Purpose: count the number of words in a text\r
- *\r
- * @link http://www.smarty.net/manual/en/language.modifier.count.words.php count_words (Smarty online manual)\r
- * @author Uwe Tews\r
- * @param array $params parameters\r
- * @return string with compiled code\r
-*/\r
-function smarty_modifiercompiler_count_words($params, $compiler)\r
-{\r
- if (Smarty::$_MBSTRING) {\r
- // return 'preg_match_all(\'#[\w\pL]+#' . Smarty::$_UTF8_MODIFIER . '\', ' . $params[0] . ', $tmp)';\r
- // expression taken from http://de.php.net/manual/en/function.str-word-count.php#85592\r
- return 'preg_match_all(\'/\p{L}[\p{L}\p{Mn}\p{Pd}\\\'\x{2019}]*/' . Smarty::$_UTF8_MODIFIER . '\', ' . $params[0] . ', $tmp)';\r
- }\r
- // no MBString fallback\r
- return 'str_word_count(' . $params[0] . ')';\r
-}\r
-\r
-?>
\ No newline at end of file
+<?php
+/**
+ * Smarty plugin
+ *
+ * @package Smarty
+ * @subpackage PluginsModifierCompiler
+ */
+
+/**
+ * Smarty count_words modifier plugin
+ * Type: modifier<br>
+ * Name: count_words<br>
+ * Purpose: count the number of words in a text
+ *
+ * @link http://www.smarty.net/manual/en/language.modifier.count.words.php count_words (Smarty online manual)
+ * @author Uwe Tews
+ *
+ * @param array $params parameters
+ *
+ * @return string with compiled code
+ */
+function smarty_modifiercompiler_count_words($params)
+{
+ if (Smarty::$_MBSTRING) {
+ // return 'preg_match_all(\'#[\w\pL]+#' . Smarty::$_UTF8_MODIFIER . '\', ' . $params[0] . ', $tmp)';
+ // expression taken from http://de.php.net/manual/en/function.str-word-count.php#85592
+ return 'preg_match_all(\'/\p{L}[\p{L}\p{Mn}\p{Pd}\\\'\x{2019}]*/' . Smarty::$_UTF8_MODIFIER . '\', ' . $params[0] . ', $tmp)';
+ }
+ // no MBString fallback
+ return 'str_word_count(' . $params[0] . ')';
+}
-<?php\r
-/**\r
- * Smarty plugin\r
- *\r
- * @package Smarty\r
- * @subpackage PluginsModifierCompiler\r
- */\r
-\r
-/**\r
- * Smarty default modifier plugin\r
- *\r
- * Type: modifier<br>\r
- * Name: default<br>\r
- * Purpose: designate default value for empty variables\r
- *\r
- * @link http://www.smarty.net/manual/en/language.modifier.default.php default (Smarty online manual)\r
- * @author Uwe Tews\r
- * @param array $params parameters\r
- * @return string with compiled code\r
- */\r
-function smarty_modifiercompiler_default ($params, $compiler)\r
-{\r
- $output = $params[0];\r
- if (!isset($params[1])) {\r
- $params[1] = "''";\r
- }\r
- \r
- array_shift($params);\r
- foreach ($params as $param) {\r
- $output = '(($tmp = @' . $output . ')===null||$tmp===\'\' ? ' . $param . ' : $tmp)';\r
- }\r
- return $output;\r
-}\r
-\r
-?>
\ No newline at end of file
+<?php
+/**
+ * Smarty plugin
+ *
+ * @package Smarty
+ * @subpackage PluginsModifierCompiler
+ */
+
+/**
+ * Smarty default modifier plugin
+ * Type: modifier<br>
+ * Name: default<br>
+ * Purpose: designate default value for empty variables
+ *
+ * @link http://www.smarty.net/manual/en/language.modifier.default.php default (Smarty online manual)
+ * @author Uwe Tews
+ *
+ * @param array $params parameters
+ *
+ * @return string with compiled code
+ */
+function smarty_modifiercompiler_default($params)
+{
+ $output = $params[0];
+ if (!isset($params[1])) {
+ $params[1] = "''";
+ }
+
+ array_shift($params);
+ foreach ($params as $param) {
+ $output = '(($tmp = @' . $output . ')===null||$tmp===\'\' ? ' . $param . ' : $tmp)';
+ }
+
+ return $output;
+}
-<?php\r
-/**\r
- * Smarty plugin\r
- *\r
- * @package Smarty\r
- * @subpackage PluginsModifierCompiler\r
- */\r
-\r
-/**\r
- * @ignore\r
- */\r
-require_once( SMARTY_PLUGINS_DIR .'shared.literal_compiler_param.php' );\r
-\r
-/**\r
- * Smarty escape modifier plugin\r
- *\r
- * Type: modifier<br>\r
- * Name: escape<br>\r
- * Purpose: escape string for output\r
- *\r
- * @link http://www.smarty.net/docsv2/en/language.modifier.escape count_characters (Smarty online manual)\r
- * @author Rodney Rehm\r
- * @param array $params parameters\r
- * @return string with compiled code\r
- */\r
-function smarty_modifiercompiler_escape($params, $compiler)\r
-{\r
- static $_double_encode = null;\r
- if ($_double_encode === null) {\r
- $_double_encode = version_compare(PHP_VERSION, '5.2.3', '>=');\r
- }\r
- \r
- try {\r
- $esc_type = smarty_literal_compiler_param($params, 1, 'html');\r
- $char_set = smarty_literal_compiler_param($params, 2, Smarty::$_CHARSET);\r
- $double_encode = smarty_literal_compiler_param($params, 3, true);\r
-\r
- if (!$char_set) {\r
- $char_set = Smarty::$_CHARSET;\r
- }\r
-\r
- switch ($esc_type) {\r
- case 'html':\r
- if ($_double_encode) {\r
- return 'htmlspecialchars('\r
- . $params[0] .', ENT_QUOTES, '\r
- . var_export($char_set, true) . ', '\r
- . var_export($double_encode, true) . ')';\r
- } else if ($double_encode) {\r
- return 'htmlspecialchars('\r
- . $params[0] .', ENT_QUOTES, '\r
- . var_export($char_set, true) . ')';\r
- } else {\r
- // fall back to modifier.escape.php\r
- }\r
-\r
- case 'htmlall':\r
- if (Smarty::$_MBSTRING) {\r
- if ($_double_encode) {\r
- // php >=5.3.2 - go native\r
- return 'mb_convert_encoding(htmlspecialchars('\r
- . $params[0] .', ENT_QUOTES, '\r
- . var_export($char_set, true) . ', '\r
- . var_export($double_encode, true)\r
- . '), "HTML-ENTITIES", '\r
- . var_export($char_set, true) . ')';\r
- } else if ($double_encode) {\r
- // php <5.3.2 - only handle double encoding\r
- return 'mb_convert_encoding(htmlspecialchars('\r
- . $params[0] .', ENT_QUOTES, '\r
- . var_export($char_set, true)\r
- . '), "HTML-ENTITIES", '\r
- . var_export($char_set, true) . ')';\r
- } else {\r
- // fall back to modifier.escape.php\r
- }\r
- }\r
-\r
- // no MBString fallback\r
- if ($_double_encode) {\r
- // php >=5.3.2 - go native\r
- return 'htmlentities('\r
- . $params[0] .', ENT_QUOTES, '\r
- . var_export($char_set, true) . ', '\r
- . var_export($double_encode, true) . ')';\r
- } else if ($double_encode) {\r
- // php <5.3.2 - only handle double encoding\r
- return 'htmlentities('\r
- . $params[0] .', ENT_QUOTES, '\r
- . var_export($char_set, true) . ')';\r
- } else {\r
- // fall back to modifier.escape.php\r
- }\r
-\r
- case 'url':\r
- return 'rawurlencode(' . $params[0] . ')';\r
-\r
- case 'urlpathinfo':\r
- return 'str_replace("%2F", "/", rawurlencode(' . $params[0] . '))';\r
-\r
- case 'quotes':\r
- // escape unescaped single quotes\r
- return 'preg_replace("%(?<!\\\\\\\\)\'%", "\\\'",' . $params[0] . ')';\r
-\r
- case 'javascript':\r
- // escape quotes and backslashes, newlines, etc.\r
- return 'strtr(' . $params[0] . ', array("\\\\" => "\\\\\\\\", "\'" => "\\\\\'", "\"" => "\\\\\"", "\\r" => "\\\\r", "\\n" => "\\\n", "</" => "<\/" ))';\r
-\r
- }\r
- } catch(SmartyException $e) {\r
- // pass through to regular plugin fallback\r
- }\r
-\r
- // could not optimize |escape call, so fallback to regular plugin\r
- if ($compiler->tag_nocache | $compiler->nocache) {\r
- $compiler->template->required_plugins['nocache']['escape']['modifier']['file'] = SMARTY_PLUGINS_DIR .'modifier.escape.php';\r
- $compiler->template->required_plugins['nocache']['escape']['modifier']['function'] = 'smarty_modifier_escape';\r
- } else {\r
- $compiler->template->required_plugins['compiled']['escape']['modifier']['file'] = SMARTY_PLUGINS_DIR .'modifier.escape.php';\r
- $compiler->template->required_plugins['compiled']['escape']['modifier']['function'] = 'smarty_modifier_escape';\r
- }\r
- return 'smarty_modifier_escape(' . join( ', ', $params ) . ')';\r
-}\r
-\r
-?>
\ No newline at end of file
+<?php
+/**
+ * Smarty plugin
+ *
+ * @package Smarty
+ * @subpackage PluginsModifierCompiler
+ */
+
+/**
+ * @ignore
+ */
+require_once(SMARTY_PLUGINS_DIR . 'shared.literal_compiler_param.php');
+
+/**
+ * Smarty escape modifier plugin
+ * Type: modifier<br>
+ * Name: escape<br>
+ * Purpose: escape string for output
+ *
+ * @link http://www.smarty.net/docsv2/en/language.modifier.escape count_characters (Smarty online manual)
+ * @author Rodney Rehm
+ *
+ * @param array $params parameters
+ * @param $compiler
+ *
+ * @return string with compiled code
+ */
+function smarty_modifiercompiler_escape($params, $compiler)
+{
+ static $_double_encode = null;
+ if ($_double_encode === null) {
+ $_double_encode = version_compare(PHP_VERSION, '5.2.3', '>=');
+ }
+
+ try {
+ $esc_type = smarty_literal_compiler_param($params, 1, 'html');
+ $char_set = smarty_literal_compiler_param($params, 2, Smarty::$_CHARSET);
+ $double_encode = smarty_literal_compiler_param($params, 3, true);
+
+ if (!$char_set) {
+ $char_set = Smarty::$_CHARSET;
+ }
+
+ switch ($esc_type) {
+ case 'html':
+ if ($_double_encode) {
+ return 'htmlspecialchars('
+ . $params[0] . ', ENT_QUOTES, '
+ . var_export($char_set, true) . ', '
+ . var_export($double_encode, true) . ')';
+ } elseif ($double_encode) {
+ return 'htmlspecialchars('
+ . $params[0] . ', ENT_QUOTES, '
+ . var_export($char_set, true) . ')';
+ } else {
+ // fall back to modifier.escape.php
+ }
+
+ case 'htmlall':
+ if (Smarty::$_MBSTRING) {
+ if ($_double_encode) {
+ // php >=5.2.3 - go native
+ return 'mb_convert_encoding(htmlspecialchars('
+ . $params[0] . ', ENT_QUOTES, '
+ . var_export($char_set, true) . ', '
+ . var_export($double_encode, true)
+ . '), "HTML-ENTITIES", '
+ . var_export($char_set, true) . ')';
+ } elseif ($double_encode) {
+ // php <5.2.3 - only handle double encoding
+ return 'mb_convert_encoding(htmlspecialchars('
+ . $params[0] . ', ENT_QUOTES, '
+ . var_export($char_set, true)
+ . '), "HTML-ENTITIES", '
+ . var_export($char_set, true) . ')';
+ } else {
+ // fall back to modifier.escape.php
+ }
+ }
+
+ // no MBString fallback
+ if ($_double_encode) {
+ // php >=5.2.3 - go native
+ return 'htmlentities('
+ . $params[0] . ', ENT_QUOTES, '
+ . var_export($char_set, true) . ', '
+ . var_export($double_encode, true) . ')';
+ } elseif ($double_encode) {
+ // php <5.2.3 - only handle double encoding
+ return 'htmlentities('
+ . $params[0] . ', ENT_QUOTES, '
+ . var_export($char_set, true) . ')';
+ } else {
+ // fall back to modifier.escape.php
+ }
+
+ case 'url':
+ return 'rawurlencode(' . $params[0] . ')';
+
+ case 'urlpathinfo':
+ return 'str_replace("%2F", "/", rawurlencode(' . $params[0] . '))';
+
+ case 'quotes':
+ // escape unescaped single quotes
+ return 'preg_replace("%(?<!\\\\\\\\)\'%", "\\\'",' . $params[0] . ')';
+
+ case 'javascript':
+ // escape quotes and backslashes, newlines, etc.
+ return 'strtr(' . $params[0] . ', array("\\\\" => "\\\\\\\\", "\'" => "\\\\\'", "\"" => "\\\\\"", "\\r" => "\\\\r", "\\n" => "\\\n", "</" => "<\/" ))';
+ }
+ }
+ catch (SmartyException $e) {
+ // pass through to regular plugin fallback
+ }
+
+ // could not optimize |escape call, so fallback to regular plugin
+ if ($compiler->template->caching && ($compiler->tag_nocache | $compiler->nocache)) {
+ $compiler->template->required_plugins['nocache']['escape']['modifier']['file'] = SMARTY_PLUGINS_DIR . 'modifier.escape.php';
+ $compiler->template->required_plugins['nocache']['escape']['modifier']['function'] = 'smarty_modifier_escape';
+ } else {
+ $compiler->template->required_plugins['compiled']['escape']['modifier']['file'] = SMARTY_PLUGINS_DIR . 'modifier.escape.php';
+ $compiler->template->required_plugins['compiled']['escape']['modifier']['function'] = 'smarty_modifier_escape';
+ }
+
+ return 'smarty_modifier_escape(' . join(', ', $params) . ')';
+}
-<?php\r
-/**\r
- * Smarty plugin\r
- *\r
- * @package Smarty\r
- * @subpackage PluginsModifierCompiler\r
- */\r
-\r
-/**\r
- * Smarty from_charset modifier plugin\r
- *\r
- * Type: modifier<br>\r
- * Name: from_charset<br>\r
- * Purpose: convert character encoding from $charset to internal encoding\r
- *\r
- * @author Rodney Rehm\r
- * @param array $params parameters\r
- * @return string with compiled code\r
- */\r
-function smarty_modifiercompiler_from_charset($params, $compiler)\r
-{\r
- if (!Smarty::$_MBSTRING) {\r
- // FIXME: (rodneyrehm) shouldn't this throw an error?\r
- return $params[0];\r
- }\r
-\r
- if (!isset($params[1])) {\r
- $params[1] = '"ISO-8859-1"';\r
- }\r
-\r
- return 'mb_convert_encoding(' . $params[0] . ', "' . addslashes(Smarty::$_CHARSET) . '", ' . $params[1] . ')';\r
-}\r
-\r
-?>
\ No newline at end of file
+<?php
+/**
+ * Smarty plugin
+ *
+ * @package Smarty
+ * @subpackage PluginsModifierCompiler
+ */
+
+/**
+ * Smarty from_charset modifier plugin
+ * Type: modifier<br>
+ * Name: from_charset<br>
+ * Purpose: convert character encoding from $charset to internal encoding
+ *
+ * @author Rodney Rehm
+ *
+ * @param array $params parameters
+ *
+ * @return string with compiled code
+ */
+function smarty_modifiercompiler_from_charset($params)
+{
+ if (!Smarty::$_MBSTRING) {
+ // FIXME: (rodneyrehm) shouldn't this throw an error?
+ return $params[0];
+ }
+
+ if (!isset($params[1])) {
+ $params[1] = '"ISO-8859-1"';
+ }
+
+ return 'mb_convert_encoding(' . $params[0] . ', "' . addslashes(Smarty::$_CHARSET) . '", ' . $params[1] . ')';
+}
-<?php\r
-/**\r
- * Smarty plugin\r
- * @package Smarty\r
- * @subpackage PluginsModifierCompiler\r
- */\r
-\r
-/**\r
- * Smarty indent modifier plugin\r
- *\r
- * Type: modifier<br>\r
- * Name: indent<br>\r
- * Purpose: indent lines of text\r
- *\r
- * @link http://www.smarty.net/manual/en/language.modifier.indent.php indent (Smarty online manual)\r
- * @author Uwe Tews\r
- * @param array $params parameters\r
- * @return string with compiled code\r
- */\r
-\r
-function smarty_modifiercompiler_indent($params, $compiler)\r
-{\r
- if (!isset($params[1])) {\r
- $params[1] = 4;\r
- }\r
- if (!isset($params[2])) {\r
- $params[2] = "' '";\r
- }\r
- return 'preg_replace(\'!^!m\',str_repeat(' . $params[2] . ',' . $params[1] . '),' . $params[0] . ')';\r
-}\r
-\r
-?>
\ No newline at end of file
+<?php
+/**
+ * Smarty plugin
+ *
+ * @package Smarty
+ * @subpackage PluginsModifierCompiler
+ */
+
+/**
+ * Smarty indent modifier plugin
+ * Type: modifier<br>
+ * Name: indent<br>
+ * Purpose: indent lines of text
+ *
+ * @link http://www.smarty.net/manual/en/language.modifier.indent.php indent (Smarty online manual)
+ * @author Uwe Tews
+ *
+ * @param array $params parameters
+ *
+ * @return string with compiled code
+ */
+
+function smarty_modifiercompiler_indent($params)
+{
+ if (!isset($params[1])) {
+ $params[1] = 4;
+ }
+ if (!isset($params[2])) {
+ $params[2] = "' '";
+ }
+
+ return 'preg_replace(\'!^!m\',str_repeat(' . $params[2] . ',' . $params[1] . '),' . $params[0] . ')';
+}
-<?php\r
-/**\r
- * Smarty plugin\r
- * @package Smarty\r
- * @subpackage PluginsModifierCompiler\r
- */\r
-\r
-/**\r
- * Smarty lower modifier plugin\r
- *\r
- * Type: modifier<br>\r
- * Name: lower<br>\r
- * Purpose: convert string to lowercase\r
- *\r
- * @link http://www.smarty.net/manual/en/language.modifier.lower.php lower (Smarty online manual)\r
- * @author Monte Ohrt <monte at ohrt dot com>\r
- * @author Uwe Tews\r
- * @param array $params parameters\r
- * @return string with compiled code\r
- */\r
-\r
-function smarty_modifiercompiler_lower($params, $compiler)\r
-{\r
- if (Smarty::$_MBSTRING) {\r
- return 'mb_strtolower(' . $params[0] . ', \'' . addslashes(Smarty::$_CHARSET) . '\')' ;\r
- }\r
- // no MBString fallback\r
- return 'strtolower(' . $params[0] . ')';\r
-}\r
-\r
-?>
\ No newline at end of file
+<?php
+/**
+ * Smarty plugin
+ *
+ * @package Smarty
+ * @subpackage PluginsModifierCompiler
+ */
+
+/**
+ * Smarty lower modifier plugin
+ * Type: modifier<br>
+ * Name: lower<br>
+ * Purpose: convert string to lowercase
+ *
+ * @link http://www.smarty.net/manual/en/language.modifier.lower.php lower (Smarty online manual)
+ * @author Monte Ohrt <monte at ohrt dot com>
+ * @author Uwe Tews
+ *
+ * @param array $params parameters
+ *
+ * @return string with compiled code
+ */
+
+function smarty_modifiercompiler_lower($params)
+{
+ if (Smarty::$_MBSTRING) {
+ return 'mb_strtolower(' . $params[0] . ', \'' . addslashes(Smarty::$_CHARSET) . '\')';
+ }
+ // no MBString fallback
+ return 'strtolower(' . $params[0] . ')';
+}
-<?php\r
-/**\r
- * Smarty plugin\r
- *\r
- * @package Smarty\r
- * @subpackage PluginsModifierCompiler\r
- */\r
-\r
-/**\r
- * Smarty noprint modifier plugin\r
- *\r
- * Type: modifier<br>\r
- * Name: noprint<br>\r
- * Purpose: return an empty string\r
- *\r
- * @author Uwe Tews\r
- * @param array $params parameters\r
- * @return string with compiled code\r
- */\r
-function smarty_modifiercompiler_noprint($params, $compiler)\r
-{\r
- return "''";\r
-}\r
-\r
-?>
\ No newline at end of file
+<?php
+/**
+ * Smarty plugin
+ *
+ * @package Smarty
+ * @subpackage PluginsModifierCompiler
+ */
+
+/**
+ * Smarty noprint modifier plugin
+ * Type: modifier<br>
+ * Name: noprint<br>
+ * Purpose: return an empty string
+ *
+ * @author Uwe Tews
+ * @return string with compiled code
+ */
+function smarty_modifiercompiler_noprint()
+{
+ return "''";
+}
-<?php\r
-/**\r
- * Smarty plugin\r
- *\r
- * @package Smarty\r
- * @subpackage PluginsModifierCompiler\r
- */\r
-\r
-/**\r
- * Smarty string_format modifier plugin\r
- *\r
- * Type: modifier<br>\r
- * Name: string_format<br>\r
- * Purpose: format strings via sprintf\r
- *\r
- * @link http://www.smarty.net/manual/en/language.modifier.string.format.php string_format (Smarty online manual)\r
- * @author Uwe Tews\r
- * @param array $params parameters\r
- * @return string with compiled code\r
- */\r
-function smarty_modifiercompiler_string_format($params, $compiler)\r
-{\r
- return 'sprintf(' . $params[1] . ',' . $params[0] . ')';\r
-}\r
-\r
-?>
\ No newline at end of file
+<?php
+/**
+ * Smarty plugin
+ *
+ * @package Smarty
+ * @subpackage PluginsModifierCompiler
+ */
+
+/**
+ * Smarty string_format modifier plugin
+ * Type: modifier<br>
+ * Name: string_format<br>
+ * Purpose: format strings via sprintf
+ *
+ * @link http://www.smarty.net/manual/en/language.modifier.string.format.php string_format (Smarty online manual)
+ * @author Uwe Tews
+ *
+ * @param array $params parameters
+ *
+ * @return string with compiled code
+ */
+function smarty_modifiercompiler_string_format($params)
+{
+ return 'sprintf(' . $params[1] . ',' . $params[0] . ')';
+}
-<?php\r
-/**\r
- * Smarty plugin\r
- *\r
- * @package Smarty\r
- * @subpackage PluginsModifierCompiler\r
- */\r
-\r
-/**\r
- * Smarty strip modifier plugin\r
- *\r
- * Type: modifier<br>\r
- * Name: strip<br>\r
- * Purpose: Replace all repeated spaces, newlines, tabs\r
- * with a single space or supplied replacement string.<br>\r
- * Example: {$var|strip} {$var|strip:" "}<br>\r
- * Date: September 25th, 2002\r
- *\r
- * @link http://www.smarty.net/manual/en/language.modifier.strip.php strip (Smarty online manual)\r
- * @author Uwe Tews\r
- * @param array $params parameters\r
- * @return string with compiled code\r
- */\r
-\r
-function smarty_modifiercompiler_strip($params, $compiler)\r
-{\r
- if (!isset($params[1])) {\r
- $params[1] = "' '";\r
- }\r
- return "preg_replace('!\s+!" . Smarty::$_UTF8_MODIFIER . "', {$params[1]},{$params[0]})";\r
-}\r
-\r
-?>
\ No newline at end of file
+<?php
+/**
+ * Smarty plugin
+ *
+ * @package Smarty
+ * @subpackage PluginsModifierCompiler
+ */
+
+/**
+ * Smarty strip modifier plugin
+ * Type: modifier<br>
+ * Name: strip<br>
+ * Purpose: Replace all repeated spaces, newlines, tabs
+ * with a single space or supplied replacement string.<br>
+ * Example: {$var|strip} {$var|strip:" "}<br>
+ * Date: September 25th, 2002
+ *
+ * @link http://www.smarty.net/manual/en/language.modifier.strip.php strip (Smarty online manual)
+ * @author Uwe Tews
+ *
+ * @param array $params parameters
+ *
+ * @return string with compiled code
+ */
+
+function smarty_modifiercompiler_strip($params)
+{
+ if (!isset($params[1])) {
+ $params[1] = "' '";
+ }
+
+ return "preg_replace('!\s+!" . Smarty::$_UTF8_MODIFIER . "', {$params[1]},{$params[0]})";
+}
-<?php\r
-/**\r
- * Smarty plugin\r
- *\r
- * @package Smarty\r
- * @subpackage PluginsModifierCompiler\r
- */\r
-\r
-/**\r
- * Smarty strip_tags modifier plugin\r
- *\r
- * Type: modifier<br>\r
- * Name: strip_tags<br>\r
- * Purpose: strip html tags from text\r
- *\r
- * @link http://www.smarty.net/manual/en/language.modifier.strip.tags.php strip_tags (Smarty online manual)\r
- * @author Uwe Tews\r
- * @param array $params parameters\r
- * @return string with compiled code\r
- */\r
-function smarty_modifiercompiler_strip_tags($params, $compiler)\r
-{\r
- if (!isset($params[1])) {\r
- $params[1] = true;\r
- }\r
- if ($params[1] === true) {\r
- return "preg_replace('!<[^>]*?>!', ' ', {$params[0]})";\r
- } else {\r
- return 'strip_tags(' . $params[0] . ')';\r
- }\r
-}\r
-\r
-?>
\ No newline at end of file
+<?php
+/**
+ * Smarty plugin
+ *
+ * @package Smarty
+ * @subpackage PluginsModifierCompiler
+ */
+
+/**
+ * Smarty strip_tags modifier plugin
+ * Type: modifier<br>
+ * Name: strip_tags<br>
+ * Purpose: strip html tags from text
+ *
+ * @link http://www.smarty.net/manual/en/language.modifier.strip.tags.php strip_tags (Smarty online manual)
+ * @author Uwe Tews
+ *
+ * @param array $params parameters
+ *
+ * @return string with compiled code
+ */
+function smarty_modifiercompiler_strip_tags($params)
+{
+ if (!isset($params[1]) || $params[1] === true || trim($params[1], '"') == 'true') {
+ return "preg_replace('!<[^>]*?>!', ' ', {$params[0]})";
+ } else {
+ return 'strip_tags(' . $params[0] . ')';
+ }
+}
-<?php\r
-/**\r
- * Smarty plugin\r
- *\r
- * @package Smarty\r
- * @subpackage PluginsModifierCompiler\r
- */\r
-\r
-/**\r
- * Smarty to_charset modifier plugin\r
- *\r
- * Type: modifier<br>\r
- * Name: to_charset<br>\r
- * Purpose: convert character encoding from internal encoding to $charset\r
- *\r
- * @author Rodney Rehm\r
- * @param array $params parameters\r
- * @return string with compiled code\r
- */\r
-function smarty_modifiercompiler_to_charset($params, $compiler)\r
-{\r
- if (!Smarty::$_MBSTRING) {\r
- // FIXME: (rodneyrehm) shouldn't this throw an error?\r
- return $params[0];\r
- }\r
-\r
- if (!isset($params[1])) {\r
- $params[1] = '"ISO-8859-1"';\r
- }\r
-\r
- return 'mb_convert_encoding(' . $params[0] . ', ' . $params[1] . ', "' . addslashes(Smarty::$_CHARSET) . '")';\r
-}\r
-\r
-?>
\ No newline at end of file
+<?php
+/**
+ * Smarty plugin
+ *
+ * @package Smarty
+ * @subpackage PluginsModifierCompiler
+ */
+
+/**
+ * Smarty to_charset modifier plugin
+ * Type: modifier<br>
+ * Name: to_charset<br>
+ * Purpose: convert character encoding from internal encoding to $charset
+ *
+ * @author Rodney Rehm
+ *
+ * @param array $params parameters
+ *
+ * @return string with compiled code
+ */
+function smarty_modifiercompiler_to_charset($params)
+{
+ if (!Smarty::$_MBSTRING) {
+ // FIXME: (rodneyrehm) shouldn't this throw an error?
+ return $params[0];
+ }
+
+ if (!isset($params[1])) {
+ $params[1] = '"ISO-8859-1"';
+ }
+
+ return 'mb_convert_encoding(' . $params[0] . ', ' . $params[1] . ', "' . addslashes(Smarty::$_CHARSET) . '")';
+}
-<?php\r
-/**\r
- * Smarty plugin\r
- *\r
- * @package Smarty\r
- * @subpackage PluginsModifierCompiler\r
- */\r
-\r
-/**\r
- * Smarty unescape modifier plugin\r
- *\r
- * Type: modifier<br>\r
- * Name: unescape<br>\r
- * Purpose: unescape html entities\r
- *\r
- * @author Rodney Rehm\r
- * @param array $params parameters\r
- * @return string with compiled code\r
- */\r
-function smarty_modifiercompiler_unescape($params, $compiler)\r
-{\r
- if (!isset($params[1])) {\r
- $params[1] = 'html';\r
- }\r
- if (!isset($params[2])) {\r
- $params[2] = '\'' . addslashes(Smarty::$_CHARSET) . '\'';\r
- } else {\r
- $params[2] = "'" . $params[2] . "'";\r
- }\r
-\r
- switch (trim($params[1], '"\'')) {\r
- case 'entity':\r
- case 'htmlall':\r
- if (Smarty::$_MBSTRING) {\r
- return 'mb_convert_encoding(' . $params[0] . ', ' . $params[2] . ', \'HTML-ENTITIES\')';\r
- }\r
-\r
- return 'html_entity_decode(' . $params[0] . ', ENT_NOQUOTES, ' . $params[2] . ')';\r
-\r
- case 'html':\r
- return 'htmlspecialchars_decode(' . $params[0] . ', ENT_QUOTES)';\r
-\r
- case 'url':\r
- return 'rawurldecode(' . $params[0] . ')';\r
-\r
- default:\r
- return $params[0];\r
- }\r
-}\r
-\r
-?>
\ No newline at end of file
+<?php
+/**
+ * Smarty plugin
+ *
+ * @package Smarty
+ * @subpackage PluginsModifierCompiler
+ */
+
+/**
+ * Smarty unescape modifier plugin
+ * Type: modifier<br>
+ * Name: unescape<br>
+ * Purpose: unescape html entities
+ *
+ * @author Rodney Rehm
+ *
+ * @param array $params parameters
+ *
+ * @return string with compiled code
+ */
+function smarty_modifiercompiler_unescape($params)
+{
+ if (!isset($params[1])) {
+ $params[1] = 'html';
+ }
+ if (!isset($params[2])) {
+ $params[2] = '\'' . addslashes(Smarty::$_CHARSET) . '\'';
+ } else {
+ $params[2] = "'" . $params[2] . "'";
+ }
+
+ switch (trim($params[1], '"\'')) {
+ case 'entity':
+ case 'htmlall':
+ if (Smarty::$_MBSTRING) {
+ return 'mb_convert_encoding(' . $params[0] . ', ' . $params[2] . ', \'HTML-ENTITIES\')';
+ }
+
+ return 'html_entity_decode(' . $params[0] . ', ENT_NOQUOTES, ' . $params[2] . ')';
+
+ case 'html':
+ return 'htmlspecialchars_decode(' . $params[0] . ', ENT_QUOTES)';
+
+ case 'url':
+ return 'rawurldecode(' . $params[0] . ')';
+
+ default:
+ return $params[0];
+ }
+}
-<?php\r
-/**\r
- * Smarty plugin\r
- *\r
- * @package Smarty\r
- * @subpackage PluginsModifierCompiler\r
- */\r
-\r
-/**\r
- * Smarty upper modifier plugin\r
- * \r
- * Type: modifier<br>\r
- * Name: lower<br>\r
- * Purpose: convert string to uppercase\r
- * \r
- * @link http://smarty.php.net/manual/en/language.modifier.upper.php lower (Smarty online manual)\r
- * @author Uwe Tews \r
- * @param array $params parameters\r
- * @return string with compiled code\r
- */\r
-function smarty_modifiercompiler_upper($params, $compiler)\r
-{\r
- if (Smarty::$_MBSTRING) {\r
- return 'mb_strtoupper(' . $params[0] . ', \'' . addslashes(Smarty::$_CHARSET) . '\')' ;\r
- }\r
- // no MBString fallback\r
- return 'strtoupper(' . $params[0] . ')';\r
-} \r
-\r
-?>
\ No newline at end of file
+<?php
+/**
+ * Smarty plugin
+ *
+ * @package Smarty
+ * @subpackage PluginsModifierCompiler
+ */
+
+/**
+ * Smarty upper modifier plugin
+ * Type: modifier<br>
+ * Name: lower<br>
+ * Purpose: convert string to uppercase
+ *
+ * @link http://smarty.php.net/manual/en/language.modifier.upper.php lower (Smarty online manual)
+ * @author Uwe Tews
+ *
+ * @param array $params parameters
+ *
+ * @return string with compiled code
+ */
+function smarty_modifiercompiler_upper($params)
+{
+ if (Smarty::$_MBSTRING) {
+ return 'mb_strtoupper(' . $params[0] . ', \'' . addslashes(Smarty::$_CHARSET) . '\')';
+ }
+ // no MBString fallback
+ return 'strtoupper(' . $params[0] . ')';
+}
-<?php\r
-/**\r
- * Smarty plugin\r
- *\r
- * @package Smarty\r
- * @subpackage PluginsModifierCompiler\r
- */\r
-\r
-/**\r
- * Smarty wordwrap modifier plugin\r
- * \r
- * Type: modifier<br>\r
- * Name: wordwrap<br>\r
- * Purpose: wrap a string of text at a given length\r
- * \r
- * @link http://smarty.php.net/manual/en/language.modifier.wordwrap.php wordwrap (Smarty online manual)\r
- * @author Uwe Tews \r
- * @param array $params parameters\r
- * @return string with compiled code\r
- */\r
-function smarty_modifiercompiler_wordwrap($params, $compiler)\r
-{\r
- if (!isset($params[1])) {\r
- $params[1] = 80;\r
- } \r
- if (!isset($params[2])) {\r
- $params[2] = '"\n"';\r
- } \r
- if (!isset($params[3])) {\r
- $params[3] = 'false';\r
- } \r
- $function = 'wordwrap';\r
- if (Smarty::$_MBSTRING) {\r
- if ($compiler->tag_nocache | $compiler->nocache) {\r
- $compiler->template->required_plugins['nocache']['wordwrap']['modifier']['file'] = SMARTY_PLUGINS_DIR .'shared.mb_wordwrap.php';\r
- $compiler->template->required_plugins['nocache']['wordwrap']['modifier']['function'] = 'smarty_mb_wordwrap';\r
- } else {\r
- $compiler->template->required_plugins['compiled']['wordwrap']['modifier']['file'] = SMARTY_PLUGINS_DIR .'shared.mb_wordwrap.php';\r
- $compiler->template->required_plugins['compiled']['wordwrap']['modifier']['function'] = 'smarty_mb_wordwrap';\r
- }\r
- $function = 'smarty_mb_wordwrap';\r
- }\r
- return $function . '(' . $params[0] . ',' . $params[1] . ',' . $params[2] . ',' . $params[3] . ')';\r
-} \r
-\r
-?>
\ No newline at end of file
+<?php
+/**
+ * Smarty plugin
+ *
+ * @package Smarty
+ * @subpackage PluginsModifierCompiler
+ */
+
+/**
+ * Smarty wordwrap modifier plugin
+ * Type: modifier<br>
+ * Name: wordwrap<br>
+ * Purpose: wrap a string of text at a given length
+ *
+ * @link http://smarty.php.net/manual/en/language.modifier.wordwrap.php wordwrap (Smarty online manual)
+ * @author Uwe Tews
+ *
+ * @param array $params parameters
+ * @param $compiler
+ *
+ * @return string with compiled code
+ */
+function smarty_modifiercompiler_wordwrap($params, $compiler)
+{
+ if (!isset($params[1])) {
+ $params[1] = 80;
+ }
+ if (!isset($params[2])) {
+ $params[2] = '"\n"';
+ }
+ if (!isset($params[3])) {
+ $params[3] = 'false';
+ }
+ $function = 'wordwrap';
+ if (Smarty::$_MBSTRING) {
+ if ($compiler->template->caching && ($compiler->tag_nocache | $compiler->nocache)) {
+ $compiler->template->required_plugins['nocache']['wordwrap']['modifier']['file'] = SMARTY_PLUGINS_DIR . 'shared.mb_wordwrap.php';
+ $compiler->template->required_plugins['nocache']['wordwrap']['modifier']['function'] = 'smarty_mb_wordwrap';
+ } else {
+ $compiler->template->required_plugins['compiled']['wordwrap']['modifier']['file'] = SMARTY_PLUGINS_DIR . 'shared.mb_wordwrap.php';
+ $compiler->template->required_plugins['compiled']['wordwrap']['modifier']['function'] = 'smarty_mb_wordwrap';
+ }
+ $function = 'smarty_mb_wordwrap';
+ }
+
+ return $function . '(' . $params[0] . ',' . $params[1] . ',' . $params[2] . ',' . $params[3] . ')';
+}
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsFilter
*/
/**
* Smarty trimwhitespace outputfilter plugin
- *
* Trim unnecessary whitespace from HTML markup.
*
* @author Rodney Rehm
- * @param string $source input string
- * @param Smarty_Internal_Template $smarty Smarty object
+ *
+ * @param string $source input string
+ *
* @return string filtered output
- * @todo substr_replace() is not overloaded by mbstring.func_overload - so this function might fail!
+ * @todo substr_replace() is not overloaded by mbstring.func_overload - so this function might fail!
*/
-function smarty_outputfilter_trimwhitespace($source, Smarty_Internal_Template $smarty)
+function smarty_outputfilter_trimwhitespace($source)
{
$store = array();
$_store = 0;
$source = substr_replace($source, $replace, $match[0][1] - $_offset, $_length);
$_offset += $_length - strlen($replace);
- $_store++;
+ $_store ++;
}
}
// Strip all HTML-Comments
// yes, even the ones in <script> - see http://stackoverflow.com/a/808850/515124
- $source = preg_replace( '#<!--.*?-->#ms', '', $source );
+ $source = preg_replace('#<!--.*?-->#ms', '', $source);
// capture html elements not to be messed with
$_offset = 0;
$source = substr_replace($source, $replace, $match[0][1] - $_offset, $_length);
$_offset += $_length - strlen($replace);
- $_store++;
+ $_store ++;
}
}
$expressions = array(
// replace multiple spaces between tags by a single space
// can't remove them entirely, becaue that might break poorly implemented CSS display:inline-block elements
- '#(:SMARTY@!@|>)\s+(?=@!@SMARTY:|<)#s' => '\1 \2',
+ '#(:SMARTY@!@|>)\s+(?=@!@SMARTY:|<)#s' => '\1 \2',
// remove spaces between attributes (but not in attribute values!)
'#(([a-z0-9]\s*=\s*(["\'])[^\3]*?\3)|<[a-z0-9_]+)\s+([a-z/>])#is' => '\1 \4',
// note: for some very weird reason trim() seems to remove spaces inside attributes.
// maybe a \0 byte or something is interfering?
- '#^\s+<#Ss' => '<',
- '#>\s+$#Ss' => '>',
+ '#^\s+<#Ss' => '<',
+ '#>\s+$#Ss' => '>',
);
- $source = preg_replace( array_keys($expressions), array_values($expressions), $source );
+ $source = preg_replace(array_keys($expressions), array_values($expressions), $source);
// note: for some very weird reason trim() seems to remove spaces inside attributes.
// maybe a \0 byte or something is interfering?
// $source = trim( $source );
- // capture html elements not to be messed with
$_offset = 0;
if (preg_match_all('#@!@SMARTY:([0-9]+):SMARTY@!@#is', $source, $matches, PREG_OFFSET_CAPTURE | PREG_SET_ORDER)) {
foreach ($matches as $match) {
- $store[] = $match[0][0];
$_length = strlen($match[0][0]);
- $replace = array_shift($store);
+ $replace = $store[$match[1][0]];
$source = substr_replace($source, $replace, $match[0][1] + $_offset, $_length);
$_offset += strlen($replace) - $_length;
- $_store++;
+ $_store ++;
}
}
return $source;
}
-
-?>
\ No newline at end of file
/**
* Smarty shared plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsShared
*/
if (version_compare(PHP_VERSION, '5.2.3', '>=')) {
/**
* escape_special_chars common function
- *
* Function: smarty_function_escape_special_chars<br>
* Purpose: used by other smarty functions to escape
* special chars except for already escaped ones
*
* @author Monte Ohrt <monte at ohrt dot com>
- * @param string $string text that should by escaped
+ *
+ * @param string $string text that should by escaped
+ *
* @return string
*/
function smarty_function_escape_special_chars($string)
if (!is_array($string)) {
$string = htmlspecialchars($string, ENT_COMPAT, Smarty::$_CHARSET, false);
}
+
return $string;
- }
-} else {
+ }
+} else {
/**
* escape_special_chars common function
- *
* Function: smarty_function_escape_special_chars<br>
* Purpose: used by other smarty functions to escape
* special chars except for already escaped ones
*
* @author Monte Ohrt <monte at ohrt dot com>
- * @param string $string text that should by escaped
+ *
+ * @param string $string text that should by escaped
+ *
* @return string
*/
function smarty_function_escape_special_chars($string)
if (!is_array($string)) {
$string = preg_replace('!&(#?\w+);!', '%%%SMARTY_START%%%\\1%%%SMARTY_END%%%', $string);
$string = htmlspecialchars($string);
- $string = str_replace(array('%%%SMARTY_START%%%', '%%%SMARTY_END%%%'), array('&', ';'), $string);
+ $string = str_replace(array('%%%SMARTY_START%%%', '%%%SMARTY_END%%%'), array('&', ';'), $string);
}
- return $string;
- }
-}
-?>
\ No newline at end of file
+ return $string;
+ }
+}
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsShared
*/
* @param array $params parameter array as given to the compiler function
* @param integer $index array index of the parameter to convert
* @param mixed $default value to be returned if the parameter is not present
+ *
* @return mixed evaluated value of parameter or $default
* @throws SmartyException if parameter is not a literal (but an expression, variable, …)
* @author Rodney Rehm
*/
-function smarty_literal_compiler_param($params, $index, $default=null)
+function smarty_literal_compiler_param($params, $index, $default = null)
{
// not set, go default
if (!isset($params[$index])) {
return $default;
}
// test if param is a literal
- if (!preg_match('/^([\'"]?)[a-zA-Z0-9]+(\\1)$/', $params[$index])) {
+ if (!preg_match('/^([\'"]?)[a-zA-Z0-9-]+(\\1)$/', $params[$index])) {
throw new SmartyException('$param[' . $index . '] is not a literal and is thus not evaluatable at compile time');
}
$t = null;
eval("\$t = " . $params[$index] . ";");
+
return $t;
}
/**
* Smarty shared plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsShared
*/
* Purpose: used by other smarty functions to make a timestamp from a string.
*
* @author Monte Ohrt <monte at ohrt dot com>
- * @param DateTime|int|string $string date object, timestamp or string that can be converted using strtotime()
+ *
+ * @param DateTime|int|string $string date object, timestamp or string that can be converted using strtotime()
+ *
* @return int
*/
function smarty_make_timestamp($string)
return $string->getTimestamp();
} elseif (strlen($string) == 14 && ctype_digit($string)) {
// it is mysql timestamp format of YYYYMMDDHHMMSS?
- return mktime(substr($string, 8, 2),substr($string, 10, 2),substr($string, 12, 2),
- substr($string, 4, 2),substr($string, 6, 2),substr($string, 0, 4));
+ return mktime(substr($string, 8, 2), substr($string, 10, 2), substr($string, 12, 2),
+ substr($string, 4, 2), substr($string, 6, 2), substr($string, 0, 4));
} elseif (is_numeric($string)) {
// it is a numeric string, we handle it as timestamp
return (int) $string;
} else {
// strtotime should handle it
$time = strtotime($string);
- if ($time == -1 || $time === false) {
+ if ($time == - 1 || $time === false) {
// strtotime() was not able to parse $string, use "now":
return time();
}
+
return $time;
}
}
-
-?>
/**
* Smarty shared plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsShared
*/
if (!function_exists('smarty_mb_str_replace')) {
/**
* Multibyte string replace
*
- * @param string $search the string to be searched
- * @param string $replace the replacement string
- * @param string $subject the source string
- * @param int &$count number of matches found
+ * @param string $search the string to be searched
+ * @param string $replace the replacement string
+ * @param string $subject the source string
+ * @param int &$count number of matches found
+ *
* @return string replaced string
* @author Rodney Rehm
*/
- function smarty_mb_str_replace($search, $replace, $subject, &$count=0)
+ function smarty_mb_str_replace($search, $replace, $subject, &$count = 0)
{
if (!is_array($search) && is_array($replace)) {
return false;
if (is_array($subject)) {
// call mb_replace for each single string in $subject
foreach ($subject as &$string) {
- $string = &smarty_mb_str_replace($search, $replace, $string, $c);
+ $string = & smarty_mb_str_replace($search, $replace, $string, $c);
$count += $c;
}
} elseif (is_array($search)) {
}
} else {
$n = max(count($search), count($replace));
- while ($n--) {
+ while ($n --) {
$subject = smarty_mb_str_replace(current($search), current($replace), $subject, $c);
$count += $c;
next($search);
$count = count($parts) - 1;
$subject = implode($replace, $parts);
}
+
return $subject;
}
-
}
-?>
\ No newline at end of file
/**
* Smarty shared plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsShared
*/
/**
* convert characters to their decimal unicode equivalents
*
- * @link http://www.ibm.com/developerworks/library/os-php-unicode/index.html#listing3 for inspiration
+ * @link http://www.ibm.com/developerworks/library/os-php-unicode/index.html#listing3 for inspiration
+ *
* @param string $string characters to calculate unicode of
* @param string $encoding encoding of $string, if null mb_internal_encoding() is used
+ *
* @return array sequence of unicodes
* @author Rodney Rehm
*/
-function smarty_mb_to_unicode($string, $encoding=null) {
+function smarty_mb_to_unicode($string, $encoding = null)
+{
if ($encoding) {
$expanded = mb_convert_encoding($string, "UTF-32BE", $encoding);
} else {
$expanded = mb_convert_encoding($string, "UTF-32BE");
}
+
return unpack("N*", $expanded);
}
/**
* convert unicodes to the character of given encoding
*
- * @link http://www.ibm.com/developerworks/library/os-php-unicode/index.html#listing3 for inspiration
+ * @link http://www.ibm.com/developerworks/library/os-php-unicode/index.html#listing3 for inspiration
+ *
* @param integer|array $unicode single unicode or list of unicodes to convert
* @param string $encoding encoding of returned string, if null mb_internal_encoding() is used
+ *
* @return string unicode as character sequence in given $encoding
* @author Rodney Rehm
*/
-function smarty_mb_from_unicode($unicode, $encoding=null) {
+function smarty_mb_from_unicode($unicode, $encoding = null)
+{
$t = '';
if (!$encoding) {
$encoding = mb_internal_encoding();
}
- foreach((array) $unicode as $utf32be) {
+ foreach ((array) $unicode as $utf32be) {
$character = pack("N*", $utf32be);
$t .= mb_convert_encoding($character, $encoding, "UTF-32BE");
}
+
return $t;
}
-
-?>
\ No newline at end of file
/**
* Smarty shared plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsShared
*/
-if(!function_exists('smarty_mb_wordwrap')) {
+if (!function_exists('smarty_mb_wordwrap')) {
/**
* Wrap a string to a given number of characters
*
- * @link http://php.net/manual/en/function.wordwrap.php for similarity
- * @param string $str the string to wrap
- * @param int $width the width of the output
- * @param string $break the character used to break the line
- * @param boolean $cut ignored parameter, just for the sake of
- * @return string wrapped string
+ * @link http://php.net/manual/en/function.wordwrap.php for similarity
+ *
+ * @param string $str the string to wrap
+ * @param int $width the width of the output
+ * @param string $break the character used to break the line
+ * @param boolean $cut ignored parameter, just for the sake of
+ *
+ * @return string wrapped string
* @author Rodney Rehm
*/
- function smarty_mb_wordwrap($str, $width=75, $break="\n", $cut=false)
+ function smarty_mb_wordwrap($str, $width = 75, $break = "\n", $cut = false)
{
// break words into tokens using white space as a delimiter
- $tokens = preg_split('!(\s)!S' . Smarty::$_UTF8_MODIFIER, $str, -1, PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE);
+ $tokens = preg_split('!(\s)!S' . Smarty::$_UTF8_MODIFIER, $str, - 1, PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE);
$length = 0;
$t = '';
$_previous = false;
$_tokens = array($_token);
if ($token_length > $width) {
// remove last space
- $t = mb_substr($t, 0, -1, Smarty::$_CHARSET);
+ $t = mb_substr($t, 0, - 1, Smarty::$_CHARSET);
$_previous = false;
$length = 0;
if ($cut) {
- $_tokens = preg_split('!(.{' . $width . '})!S' . Smarty::$_UTF8_MODIFIER, $_token, -1, PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE);
+ $_tokens = preg_split('!(.{' . $width . '})!S' . Smarty::$_UTF8_MODIFIER, $_token, - 1, PREG_SPLIT_NO_EMPTY + PREG_SPLIT_DELIM_CAPTURE);
// broken words go on a new line
$t .= $break;
}
if ($length > $width) {
// remove space before inserted break
if ($_previous && $token_length < $width) {
- $t = mb_substr($t, 0, -1, Smarty::$_CHARSET);
+ $t = mb_substr($t, 0, - 1, Smarty::$_CHARSET);
}
// add the break before the token
$length = 0;
continue;
}
- } else if ($token == "\n") {
+ } elseif ($token == "\n") {
// hard break must reset counters
$_previous = 0;
$length = 0;
return $t;
}
-
}
-?>
\ No newline at end of file
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsFilter
*/
/**
* Smarty htmlspecialchars variablefilter plugin
*
- * @param string $source input string
- * @param Smarty_Internal_Template $smarty Smarty object
+ * @param string $source input string
+ *
* @return string filtered output
*/
-function smarty_variablefilter_htmlspecialchars($source, $smarty)
+function smarty_variablefilter_htmlspecialchars($source)
{
return htmlspecialchars($source, ENT_QUOTES, Smarty::$_CHARSET);
}
-
-?>
\ No newline at end of file
<?php
/**
-* Smarty Internal Plugin
-*
-* @package Smarty
-* @subpackage Cacher
-*/
+ * Smarty Internal Plugin
+ *
+ * @package Smarty
+ * @subpackage Cacher
+ */
/**
-* Cache Handler API
-*
-* @package Smarty
-* @subpackage Cacher
-* @author Rodney Rehm
-*/
-abstract class Smarty_CacheResource {
+ * Cache Handler API
+ *
+ * @package Smarty
+ * @subpackage Cacher
+ * @author Rodney Rehm
+ */
+abstract class Smarty_CacheResource
+{
/**
- * cache for Smarty_CacheResource instances
- * @var array
- */
+ * cache for Smarty_CacheResource instances
+ *
+ * @var array
+ */
public static $resources = array();
/**
- * resource types provided by the core
- * @var array
- */
+ * resource types provided by the core
+ *
+ * @var array
+ */
protected static $sysplugins = array(
'file' => true,
);
/**
- * populate Cached Object with meta data from Resource
- *
- * @param Smarty_Template_Cached $cached cached object
- * @param Smarty_Internal_Template $_template template object
- * @return void
- */
- public abstract function populate(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template);
+ * populate Cached Object with meta data from Resource
+ *
+ * @param Smarty_Template_Cached $cached cached object
+ * @param Smarty_Internal_Template $_template template object
+ *
+ * @return void
+ */
+ abstract public function populate(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template);
/**
- * populate Cached Object with timestamp and exists from Resource
- *
- * @param Smarty_Template_Cached $source cached object
- * @return void
- */
- public abstract function populateTimestamp(Smarty_Template_Cached $cached);
+ * populate Cached Object with timestamp and exists from Resource
+ *
+ * @param Smarty_Template_Cached $cached
+ *
+ * @return void
+ */
+ abstract public function populateTimestamp(Smarty_Template_Cached $cached);
/**
- * Read the cached template and process header
- *
- * @param Smarty_Internal_Template $_template template object
- * @param Smarty_Template_Cached $cached cached object
- * @return booelan true or false if the cached content does not exist
- */
- public abstract function process(Smarty_Internal_Template $_template, Smarty_Template_Cached $cached=null);
+ * Read the cached template and process header
+ *
+ * @param Smarty_Internal_Template $_template template object
+ * @param Smarty_Template_Cached $cached cached object
+ *
+ * @return boolean true or false if the cached content does not exist
+ */
+ abstract public function process(Smarty_Internal_Template $_template, Smarty_Template_Cached $cached = null);
/**
- * Write the rendered template output to cache
- *
- * @param Smarty_Internal_Template $_template template object
- * @param string $content content to cache
- * @return boolean success
- */
- public abstract function writeCachedContent(Smarty_Internal_Template $_template, $content);
+ * Write the rendered template output to cache
+ *
+ * @param Smarty_Internal_Template $_template template object
+ * @param string $content content to cache
+ *
+ * @return boolean success
+ */
+ abstract public function writeCachedContent(Smarty_Internal_Template $_template, $content);
/**
- * Return cached content
- *
- * @param Smarty_Internal_Template $_template template object
- * @param string $content content of cache
- */
+ * Return cached content
+ *
+ * @param Smarty_Internal_Template $_template template object
+ *
+ * @return null|string
+ */
public function getCachedContent(Smarty_Internal_Template $_template)
{
if ($_template->cached->handler->process($_template)) {
ob_start();
$_template->properties['unifunc']($_template);
+
return ob_get_clean();
}
+
return null;
}
/**
- * Empty cache
- *
- * @param Smarty $smarty Smarty object
- * @param integer $exp_time expiration time (number of seconds, not timestamp)
- * @return integer number of cache files deleted
- */
- public abstract function clearAll(Smarty $smarty, $exp_time=null);
+ * Empty cache
+ *
+ * @param Smarty $smarty Smarty object
+ * @param integer $exp_time expiration time (number of seconds, not timestamp)
+ *
+ * @return integer number of cache files deleted
+ */
+ abstract public function clearAll(Smarty $smarty, $exp_time = null);
/**
- * Empty cache for a specific template
- *
- * @param Smarty $smarty Smarty object
- * @param string $resource_name template name
- * @param string $cache_id cache id
- * @param string $compile_id compile id
- * @param integer $exp_time expiration time (number of seconds, not timestamp)
- * @return integer number of cache files deleted
- */
- public abstract function clear(Smarty $smarty, $resource_name, $cache_id, $compile_id, $exp_time);
-
+ * Empty cache for a specific template
+ *
+ * @param Smarty $smarty Smarty object
+ * @param string $resource_name template name
+ * @param string $cache_id cache id
+ * @param string $compile_id compile id
+ * @param integer $exp_time expiration time (number of seconds, not timestamp)
+ *
+ * @return integer number of cache files deleted
+ */
+ abstract public function clear(Smarty $smarty, $resource_name, $cache_id, $compile_id, $exp_time);
+ /**
+ * @param Smarty $smarty
+ * @param Smarty_Template_Cached $cached
+ *
+ * @return bool|null
+ */
public function locked(Smarty $smarty, Smarty_Template_Cached $cached)
{
// theoretically locking_timeout should be checked against time_limit (max_execution_time)
}
sleep(1);
}
+
return $hadLock;
}
+ /**
+ * Check is cache is locked for this template
+ *
+ * @param Smarty $smarty
+ * @param Smarty_Template_Cached $cached
+ *
+ * @return bool
+ */
public function hasLock(Smarty $smarty, Smarty_Template_Cached $cached)
{
// check if lock exists
return false;
}
+ /**
+ * Lock cache for this template
+ *
+ * @param Smarty $smarty
+ * @param Smarty_Template_Cached $cached
+ *
+ * @return bool
+ */
public function acquireLock(Smarty $smarty, Smarty_Template_Cached $cached)
{
// create lock
return true;
}
+ /**
+ * Unlock cache for this template
+ *
+ * @param Smarty $smarty
+ * @param Smarty_Template_Cached $cached
+ *
+ * @return bool
+ */
public function releaseLock(Smarty $smarty, Smarty_Template_Cached $cached)
{
// release lock
return true;
}
-
/**
- * Load Cache Resource Handler
- *
- * @param Smarty $smarty Smarty object
- * @param string $type name of the cache resource
- * @return Smarty_CacheResource Cache Resource Handler
- */
+ * Load Cache Resource Handler
+ *
+ * @param Smarty $smarty Smarty object
+ * @param string $type name of the cache resource
+ *
+ * @throws SmartyException
+ * @return Smarty_CacheResource Cache Resource Handler
+ */
public static function load(Smarty $smarty, $type = null)
{
if (!isset($type)) {
if (isset($smarty->_cacheresource_handlers[$type])) {
return $smarty->_cacheresource_handlers[$type];
}
-
+
// try registered resource
if (isset($smarty->registered_cache_resources[$type])) {
// do not cache these instances as they may vary from instance to instance
$cache_resource_class = 'Smarty_Internal_CacheResource_' . ucfirst($type);
self::$resources[$type] = new $cache_resource_class();
}
+
return $smarty->_cacheresource_handlers[$type] = self::$resources[$type];
}
// try plugins dir
if (!isset(self::$resources[$type])) {
self::$resources[$type] = new $cache_resource_class();
}
+
return $smarty->_cacheresource_handlers[$type] = self::$resources[$type];
}
// give up
}
/**
- * Invalid Loaded Cache Files
- *
- * @param Smarty $smarty Smarty object
- */
+ * Invalid Loaded Cache Files
+ *
+ * @param Smarty $smarty Smarty object
+ */
public static function invalidLoadedCache(Smarty $smarty)
{
foreach ($smarty->template_objects as $tpl) {
}
/**
-* Smarty Resource Data Object
-*
-* Cache Data Container for Template Files
-*
-* @package Smarty
-* @subpackage TemplateResources
-* @author Rodney Rehm
-*/
-class Smarty_Template_Cached {
+ * Smarty Resource Data Object
+ * Cache Data Container for Template Files
+ *
+ * @package Smarty
+ * @subpackage TemplateResources
+ * @author Rodney Rehm
+ */
+class Smarty_Template_Cached
+{
/**
- * Source Filepath
- * @var string
- */
+ * Source Filepath
+ *
+ * @var string
+ */
public $filepath = false;
/**
- * Source Content
- * @var string
- */
+ * Source Content
+ *
+ * @var string
+ */
public $content = null;
/**
- * Source Timestamp
- * @var integer
- */
+ * Source Timestamp
+ *
+ * @var integer
+ */
public $timestamp = false;
/**
- * Source Existance
- * @var boolean
- */
+ * Source Existence
+ *
+ * @var boolean
+ */
public $exists = false;
/**
- * Cache Is Valid
- * @var boolean
- */
+ * Cache Is Valid
+ *
+ * @var boolean
+ */
public $valid = false;
/**
- * Cache was processed
- * @var boolean
- */
+ * Cache was processed
+ *
+ * @var boolean
+ */
public $processed = false;
/**
- * CacheResource Handler
- * @var Smarty_CacheResource
- */
+ * CacheResource Handler
+ *
+ * @var Smarty_CacheResource
+ */
public $handler = null;
/**
- * Template Compile Id (Smarty_Internal_Template::$compile_id)
- * @var string
- */
+ * Template Compile Id (Smarty_Internal_Template::$compile_id)
+ *
+ * @var string
+ */
public $compile_id = null;
/**
- * Template Cache Id (Smarty_Internal_Template::$cache_id)
- * @var string
- */
+ * Template Cache Id (Smarty_Internal_Template::$cache_id)
+ *
+ * @var string
+ */
public $cache_id = null;
/**
- * Id for cache locking
- * @var string
- */
+ * Id for cache locking
+ *
+ * @var string
+ */
public $lock_id = null;
/**
- * flag that cache is locked by this instance
- * @var bool
- */
+ * flag that cache is locked by this instance
+ *
+ * @var bool
+ */
public $is_locked = false;
/**
- * Source Object
- * @var Smarty_Template_Source
- */
+ * Source Object
+ *
+ * @var Smarty_Template_Source
+ */
public $source = null;
/**
- * create Cached Object container
- *
- * @param Smarty_Internal_Template $_template template object
- */
+ * create Cached Object container
+ *
+ * @param Smarty_Internal_Template $_template template object
+ */
public function __construct(Smarty_Internal_Template $_template)
{
$this->compile_id = $_template->compile_id;
//
if (!($_template->caching == Smarty::CACHING_LIFETIME_CURRENT || $_template->caching == Smarty::CACHING_LIFETIME_SAVED) || $_template->source->recompiled) {
$handler->populate($this, $_template);
+
return;
}
while (true) {
if ($smarty->debugging) {
Smarty_Internal_Debug::start_cache($_template);
}
- if($handler->process($_template, $this) === false) {
+ if ($handler->process($_template, $this) === false) {
$this->valid = false;
} else {
$this->processed = true;
}
if (!$this->valid && $_template->smarty->cache_locking) {
$this->handler->acquireLock($_template->smarty, $this);
+
return;
} else {
return;
}
/**
- * Write this cache object to handler
- *
- * @param Smarty_Internal_Template $_template template object
- * @param string $content content to cache
- * @return boolean success
- */
+ * Write this cache object to handler
+ *
+ * @param Smarty_Internal_Template $_template template object
+ * @param string $content content to cache
+ *
+ * @return boolean success
+ */
public function write(Smarty_Internal_Template $_template, $content)
{
if (!$_template->source->recompiled) {
if ($this->handler->writeCachedContent($_template, $content)) {
+ $this->content = null;
$this->timestamp = time();
$this->exists = true;
$this->valid = true;
if ($_template->smarty->cache_locking) {
$this->handler->releaseLock($_template->smarty, $this);
}
+
return true;
}
}
+
return false;
}
-
}
-?>
\ No newline at end of file
/**
* Smarty Internal Plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage Cacher
*/
/**
* Cache Handler API
*
- * @package Smarty
+ * @package Smarty
* @subpackage Cacher
- * @author Rodney Rehm
+ * @author Rodney Rehm
*/
-abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource {
-
+abstract class Smarty_CacheResource_Custom extends Smarty_CacheResource
+{
/**
* fetch cached content and its modification time from data source
*
- * @param string $id unique cache content identifier
- * @param string $name template name
- * @param string $cache_id cache id
- * @param string $compile_id compile id
- * @param string $content cached content
- * @param integer $mtime cache modification timestamp (epoch)
+ * @param string $id unique cache content identifier
+ * @param string $name template name
+ * @param string $cache_id cache id
+ * @param string $compile_id compile id
+ * @param string $content cached content
+ * @param integer $mtime cache modification timestamp (epoch)
+ *
* @return void
*/
- protected abstract function fetch($id, $name, $cache_id, $compile_id, &$content, &$mtime);
+ abstract protected function fetch($id, $name, $cache_id, $compile_id, &$content, &$mtime);
/**
* Fetch cached content's modification timestamp from data source
- *
* {@internal implementing this method is optional.
* Only implement it if modification times can be accessed faster than loading the complete cached content.}}
*
- * @param string $id unique cache content identifier
- * @param string $name template name
- * @param string $cache_id cache id
- * @param string $compile_id compile id
+ * @param string $id unique cache content identifier
+ * @param string $name template name
+ * @param string $cache_id cache id
+ * @param string $compile_id compile id
+ *
* @return integer|boolean timestamp (epoch) the template was modified, or false if not found
*/
protected function fetchTimestamp($id, $name, $cache_id, $compile_id)
/**
* Save content to cache
*
- * @param string $id unique cache content identifier
- * @param string $name template name
- * @param string $cache_id cache id
- * @param string $compile_id compile id
- * @param integer|null $exp_time seconds till expiration or null
- * @param string $content content to cache
- * @return boolean success
+ * @param string $id unique cache content identifier
+ * @param string $name template name
+ * @param string $cache_id cache id
+ * @param string $compile_id compile id
+ * @param integer|null $exp_time seconds till expiration or null
+ * @param string $content content to cache
+ *
+ * @return boolean success
*/
- protected abstract function save($id, $name, $cache_id, $compile_id, $exp_time, $content);
+ abstract protected function save($id, $name, $cache_id, $compile_id, $exp_time, $content);
/**
* Delete content from cache
*
- * @param string $name template name
- * @param string $cache_id cache id
- * @param string $compile_id compile id
- * @param integer|null $exp_time seconds till expiration time in seconds or null
- * @return integer number of deleted caches
+ * @param string $name template name
+ * @param string $cache_id cache id
+ * @param string $compile_id compile id
+ * @param integer|null $exp_time seconds till expiration time in seconds or null
+ *
+ * @return integer number of deleted caches
*/
- protected abstract function delete($name, $cache_id, $compile_id, $exp_time);
+ abstract protected function delete($name, $cache_id, $compile_id, $exp_time);
/**
* populate Cached Object with meta data from Resource
*
- * @param Smarty_Template_Cached $cached cached object
- * @param Smarty_Internal_Template $_template template object
+ * @param Smarty_Template_Cached $cached cached object
+ * @param Smarty_Internal_Template $_template template object
+ *
* @return void
*/
public function populate(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template)
/**
* populate Cached Object with timestamp and exists from Resource
*
- * @param Smarty_Template_Cached $source cached object
+ * @param Smarty_Template_Cached $cached
+ *
* @return void
*/
public function populateTimestamp(Smarty_Template_Cached $cached)
if ($mtime !== null) {
$cached->timestamp = $mtime;
$cached->exists = !!$cached->timestamp;
+
return;
}
$timestamp = null;
/**
* Read the cached template and process the header
*
- * @param Smarty_Internal_Template $_template template object
- * @param Smarty_Template_Cached $cached cached object
- * @return booelan true or false if the cached content does not exist
+ * @param Smarty_Internal_Template $_template template object
+ * @param Smarty_Template_Cached $cached cached object
+ *
+ * @return boolean true or false if the cached content does not exist
*/
- public function process(Smarty_Internal_Template $_template, Smarty_Template_Cached $cached=null)
+ public function process(Smarty_Internal_Template $_template, Smarty_Template_Cached $cached = null)
{
if (!$cached) {
$cached = $_template->cached;
);
}
if (isset($content)) {
+ /** @var Smarty_Internal_Template $_smarty_tpl
+ * used in evaluated code
+ */
$_smarty_tpl = $_template;
eval("?>" . $content);
+
return true;
}
+
return false;
}
/**
* Write the rendered template output to cache
*
- * @param Smarty_Internal_Template $_template template object
- * @param string $content content to cache
- * @return boolean success
+ * @param Smarty_Internal_Template $_template template object
+ * @param string $content content to cache
+ *
+ * @return boolean success
*/
public function writeCachedContent(Smarty_Internal_Template $_template, $content)
{
/**
* Empty cache
*
- * @param Smarty $smarty Smarty object
- * @param integer $exp_time expiration time (number of seconds, not timestamp)
+ * @param Smarty $smarty Smarty object
+ * @param integer $exp_time expiration time (number of seconds, not timestamp)
+ *
* @return integer number of cache files deleted
*/
- public function clearAll(Smarty $smarty, $exp_time=null)
+ public function clearAll(Smarty $smarty, $exp_time = null)
{
$this->cache = array();
+
return $this->delete(null, null, null, $exp_time);
}
/**
* Empty cache for a specific template
*
- * @param Smarty $smarty Smarty object
- * @param string $resource_name template name
- * @param string $cache_id cache id
- * @param string $compile_id compile id
- * @param integer $exp_time expiration time (number of seconds, not timestamp)
+ * @param Smarty $smarty Smarty object
+ * @param string $resource_name template name
+ * @param string $cache_id cache id
+ * @param string $compile_id compile id
+ * @param integer $exp_time expiration time (number of seconds, not timestamp)
+ *
* @return integer number of cache files deleted
*/
public function clear(Smarty $smarty, $resource_name, $cache_id, $compile_id, $exp_time)
{
$this->cache = array();
- return $this->delete($resource_name, $cache_id, $compile_id, $exp_time);
+ $cache_name = null;
+
+ if (isset($resource_name)) {
+ $_save_stat = $smarty->caching;
+ $smarty->caching = true;
+ $tpl = new $smarty->template_class($resource_name, $smarty);
+ $smarty->caching = $_save_stat;
+
+ if ($tpl->source->exists) {
+ $cache_name = $tpl->source->name;
+ } else {
+ return 0;
+ }
+ // remove from template cache
+ if ($smarty->allow_ambiguous_resources) {
+ $_templateId = $tpl->source->unique_resource . $tpl->cache_id . $tpl->compile_id;
+ } else {
+ $_templateId = $smarty->joined_template_dir . '#' . $resource_name . $tpl->cache_id . $tpl->compile_id;
+ }
+ if (isset($_templateId[150])) {
+ $_templateId = sha1($_templateId);
+ }
+ unset($smarty->template_objects[$_templateId]);
+ // template object no longer needed
+ unset($tpl);
+ }
+
+ return $this->delete($cache_name, $cache_id, $compile_id, $exp_time);
}
/**
* Check is cache is locked for this template
*
- * @param Smarty $smarty Smarty object
- * @param Smarty_Template_Cached $cached cached object
- * @return booelan true or false if cache is locked
+ * @param Smarty $smarty Smarty object
+ * @param Smarty_Template_Cached $cached cached object
+ *
+ * @return boolean true or false if cache is locked
*/
public function hasLock(Smarty $smarty, Smarty_Template_Cached $cached)
{
/**
* Lock cache for this template
*
- * @param Smarty $smarty Smarty object
+ * @param Smarty $smarty Smarty object
* @param Smarty_Template_Cached $cached cached object
+ *
+ * @return bool|void
*/
public function acquireLock(Smarty $smarty, Smarty_Template_Cached $cached)
{
/**
* Unlock cache for this template
*
- * @param Smarty $smarty Smarty object
+ * @param Smarty $smarty Smarty object
* @param Smarty_Template_Cached $cached cached object
+ *
+ * @return bool|void
*/
public function releaseLock(Smarty $smarty, Smarty_Template_Cached $cached)
{
$this->delete($name, null, null, null);
}
}
-?>
\ No newline at end of file
/**
* Smarty Internal Plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage Cacher
*/
/**
* Smarty Cache Handler Base for Key/Value Storage Implementations
- *
* This class implements the functionality required to use simple key/value stores
* for hierarchical cache groups. key/value stores like memcache or APC do not support
* wildcards in keys, therefore a cache group cannot be cleared like "a|*" - which
* is no problem to filesystem and RDBMS implementations.
- *
* This implementation is based on the concept of invalidation. While one specific cache
* can be identified and cleared, any range of caches cannot be identified. For this reason
* each level of the cache group hierarchy can have its own value in the store. These values
* are nothing but microtimes, telling us when a particular cache group was cleared for the
* last time. These keys are evaluated for every cache read to determine if the cache has
* been invalidated since it was created and should hence be treated as inexistent.
- *
* Although deep hierarchies are possible, they are not recommended. Try to keep your
* cache groups as shallow as possible. Anything up 3-5 parents should be ok. So
* »a|b|c« is a good depth where »a|b|c|d|e|f|g|h|i|j|k« isn't. Try to join correlating
* cache groups: if your cache groups look somewhat like »a|b|$page|$items|$whatever«
* consider using »a|b|c|$page-$items-$whatever« instead.
*
- * @package Smarty
+ * @package Smarty
* @subpackage Cacher
- * @author Rodney Rehm
+ * @author Rodney Rehm
*/
-abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource {
-
+abstract class Smarty_CacheResource_KeyValueStore extends Smarty_CacheResource
+{
/**
* cache for contents
+ *
* @var array
*/
protected $contents = array();
/**
* cache for timestamps
+ *
* @var array
*/
protected $timestamps = array();
/**
* populate Cached Object with meta data from Resource
*
- * @param Smarty_Template_Cached $cached cached object
- * @param Smarty_Internal_Template $_template template object
+ * @param Smarty_Template_Cached $cached cached object
+ * @param Smarty_Internal_Template $_template template object
+ *
* @return void
*/
public function populate(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template)
{
$cached->filepath = $_template->source->uid
- . '#' . $this->sanitize($cached->source->name)
- . '#' . $this->sanitize($cached->cache_id)
- . '#' . $this->sanitize($cached->compile_id);
+ . '#' . $this->sanitize($cached->source->resource)
+ . '#' . $this->sanitize($cached->cache_id)
+ . '#' . $this->sanitize($cached->compile_id);
$this->populateTimestamp($cached);
}
/**
* populate Cached Object with timestamp and exists from Resource
*
- * @param Smarty_Template_Cached $cached cached object
+ * @param Smarty_Template_Cached $cached cached object
+ *
* @return void
*/
public function populateTimestamp(Smarty_Template_Cached $cached)
/**
* Read the cached template and process the header
*
- * @param Smarty_Internal_Template $_template template object
- * @param Smarty_Template_Cached $cached cached object
- * @return booelan true or false if the cached content does not exist
+ * @param Smarty_Internal_Template $_template template object
+ * @param Smarty_Template_Cached $cached cached object
+ *
+ * @return boolean true or false if the cached content does not exist
*/
- public function process(Smarty_Internal_Template $_template, Smarty_Template_Cached $cached=null)
+ public function process(Smarty_Internal_Template $_template, Smarty_Template_Cached $cached = null)
{
if (!$cached) {
$cached = $_template->cached;
}
}
if (isset($content)) {
+ /** @var Smarty_Internal_Template $_smarty_tpl
+ * used in evaluated code
+ */
$_smarty_tpl = $_template;
eval("?>" . $content);
+
return true;
}
+
return false;
}
/**
* Write the rendered template output to cache
*
- * @param Smarty_Internal_Template $_template template object
- * @param string $content content to cache
- * @return boolean success
+ * @param Smarty_Internal_Template $_template template object
+ * @param string $content content to cache
+ *
+ * @return boolean success
*/
public function writeCachedContent(Smarty_Internal_Template $_template, $content)
{
$this->addMetaTimestamp($content);
+
return $this->write(array($_template->cached->filepath => $content), $_template->properties['cache_lifetime']);
}
/**
* Empty cache
- *
* {@internal the $exp_time argument is ignored altogether }}
*
- * @param Smarty $smarty Smarty object
- * @param integer $exp_time expiration time [being ignored]
+ * @param Smarty $smarty Smarty object
+ * @param integer $exp_time expiration time [being ignored]
+ *
* @return integer number of cache files deleted [always -1]
* @uses purge() to clear the whole store
* @uses invalidate() to mark everything outdated if purge() is inapplicable
*/
- public function clearAll(Smarty $smarty, $exp_time=null)
+ public function clearAll(Smarty $smarty, $exp_time = null)
{
if (!$this->purge()) {
$this->invalidate(null);
}
- return -1;
+
+ return - 1;
}
/**
* Empty cache for a specific template
- *
* {@internal the $exp_time argument is ignored altogether}}
*
- * @param Smarty $smarty Smarty object
- * @param string $resource_name template name
- * @param string $cache_id cache id
- * @param string $compile_id compile id
- * @param integer $exp_time expiration time [being ignored]
+ * @param Smarty $smarty Smarty object
+ * @param string $resource_name template name
+ * @param string $cache_id cache id
+ * @param string $compile_id compile id
+ * @param integer $exp_time expiration time [being ignored]
+ *
* @return integer number of cache files deleted [always -1]
* @uses buildCachedFilepath() to generate the CacheID
* @uses invalidate() to mark CacheIDs parent chain as outdated
$cid = $uid . '#' . $this->sanitize($resource_name) . '#' . $this->sanitize($cache_id) . '#' . $this->sanitize($compile_id);
$this->delete(array($cid));
$this->invalidate($cid, $resource_name, $cache_id, $compile_id, $uid);
- return -1;
+
+ return - 1;
}
+
/**
* Get template's unique ID
*
- * @param Smarty $smarty Smarty object
- * @param string $resource_name template name
- * @param string $cache_id cache id
- * @param string $compile_id compile id
+ * @param Smarty $smarty Smarty object
+ * @param string $resource_name template name
+ * @param string $cache_id cache id
+ * @param string $compile_id compile id
+ *
* @return string filepath of cache file
*/
protected function getTemplateUid(Smarty $smarty, $resource_name, $cache_id, $compile_id)
if ($tpl->source->exists) {
$uid = $tpl->source->uid;
}
-
+
// remove from template cache
if ($smarty->allow_ambiguous_resources) {
$_templateId = $tpl->source->unique_resource . $tpl->cache_id . $tpl->compile_id;
}
unset($smarty->template_objects[$_templateId]);
}
+
return $uid;
}
/**
* Sanitize CacheID components
*
- * @param string $string CacheID component to sanitize
+ * @param string $string CacheID component to sanitize
+ *
* @return string sanitized CacheID component
*/
protected function sanitize($string)
if (!$string) {
return null;
}
+
return preg_replace('#[^\w\|]+#S', '_', $string);
}
/**
* Fetch and prepare a cache object.
*
- * @param string $cid CacheID to fetch
- * @param string $resource_name template name
- * @param string $cache_id cache id
- * @param string $compile_id compile id
- * @param string $content cached content
- * @param integer &$timestamp cached timestamp (epoch)
- * @param string $resource_uid resource's uid
+ * @param string $cid CacheID to fetch
+ * @param string $resource_name template name
+ * @param string $cache_id cache id
+ * @param string $compile_id compile id
+ * @param string $content cached content
+ * @param integer &$timestamp cached timestamp (epoch)
+ * @param string $resource_uid resource's uid
+ *
* @return boolean success
*/
protected function fetch($cid, $resource_name = null, $cache_id = null, $compile_id = null, &$content = null, &$timestamp = null, $resource_uid = null)
/**
* Add current microtime to the beginning of $cache_content
- *
* {@internal the header uses 8 Bytes, the first 4 Bytes are the seconds, the second 4 Bytes are the microseconds}}
*
* @param string &$content the content to be cached
/**
* Extract the timestamp the $content was cached
*
- * @param string &$content the cached content
- * @return float the microtime the content was cached
+ * @param string &$content the cached content
+ *
+ * @return float the microtime the content was cached
*/
protected function getMetaTimestamp(&$content)
{
$s = unpack("N", substr($content, 0, 4));
$m = unpack("N", substr($content, 4, 4));
$content = substr($content, 8);
+
return $s[1] + ($m[1] / 100000000);
}
/**
* Invalidate CacheID
*
- * @param string $cid CacheID
- * @param string $resource_name template name
- * @param string $cache_id cache id
- * @param string $compile_id compile id
- * @param string $resource_uid source's uid
+ * @param string $cid CacheID
+ * @param string $resource_name template name
+ * @param string $cache_id cache id
+ * @param string $compile_id compile id
+ * @param string $resource_uid source's uid
+ *
* @return void
*/
protected function invalidate($cid = null, $resource_name = null, $cache_id = null, $compile_id = null, $resource_uid = null)
// invalidate everything
if (!$resource_name && !$cache_id && !$compile_id) {
$key = 'IVK#ALL';
- }
- // invalidate all caches by template
- else if ($resource_name && !$cache_id && !$compile_id) {
- $key = 'IVK#TEMPLATE#' . $resource_uid . '#' . $this->sanitize($resource_name);
- }
- // invalidate all caches by cache group
- else if (!$resource_name && $cache_id && !$compile_id) {
- $key = 'IVK#CACHE#' . $this->sanitize($cache_id);
- }
- // invalidate all caches by compile id
- else if (!$resource_name && !$cache_id && $compile_id) {
- $key = 'IVK#COMPILE#' . $this->sanitize($compile_id);
- }
- // invalidate by combination
+ } // invalidate all caches by template
else {
- $key = 'IVK#CID#' . $cid;
+ if ($resource_name && !$cache_id && !$compile_id) {
+ $key = 'IVK#TEMPLATE#' . $resource_uid . '#' . $this->sanitize($resource_name);
+ } // invalidate all caches by cache group
+ else {
+ if (!$resource_name && $cache_id && !$compile_id) {
+ $key = 'IVK#CACHE#' . $this->sanitize($cache_id);
+ } // invalidate all caches by compile id
+ else {
+ if (!$resource_name && !$cache_id && $compile_id) {
+ $key = 'IVK#COMPILE#' . $this->sanitize($compile_id);
+ } // invalidate by combination
+ else {
+ $key = 'IVK#CID#' . $cid;
+ }
+ }
+ }
}
$this->write(array($key => $now));
}
/**
* Determine the latest timestamp known to the invalidation chain
*
- * @param string $cid CacheID to determine latest invalidation timestamp of
- * @param string $resource_name template name
- * @param string $cache_id cache id
- * @param string $compile_id compile id
- * @param string $resource_uid source's filepath
- * @return float the microtime the CacheID was invalidated
+ * @param string $cid CacheID to determine latest invalidation timestamp of
+ * @param string $resource_name template name
+ * @param string $cache_id cache id
+ * @param string $compile_id compile id
+ * @param string $resource_uid source's filepath
+ *
+ * @return float the microtime the CacheID was invalidated
*/
protected function getLatestInvalidationTimestamp($cid, $resource_name = null, $cache_id = null, $compile_id = null, $resource_uid = null)
{
if (!($_cid = $this->listInvalidationKeys($cid, $resource_name, $cache_id, $compile_id, $resource_uid))) {
return 0;
}
-
+
// there are no InValidationKeys
if (!($values = $this->read($_cid))) {
return 0;
}
// make sure we're dealing with floats
$values = array_map('floatval', $values);
+
return max($values);
}
/**
* Translate a CacheID into the list of applicable InvalidationKeys.
- *
* Splits "some|chain|into|an|array" into array( '#clearAll#', 'some', 'some|chain', 'some|chain|into', ... )
*
- * @param string $cid CacheID to translate
- * @param string $resource_name template name
- * @param string $cache_id cache id
- * @param string $compile_id compile id
- * @param string $resource_uid source's filepath
- * @return array list of InvalidationKeys
+ * @param string $cid CacheID to translate
+ * @param string $resource_name template name
+ * @param string $cache_id cache id
+ * @param string $compile_id compile id
+ * @param string $resource_uid source's filepath
+ *
+ * @return array list of InvalidationKeys
* @uses $invalidationKeyPrefix to prepend to each InvalidationKey
*/
protected function listInvalidationKeys($cid, $resource_name = null, $cache_id = null, $compile_id = null, $resource_uid = null)
$t[] = 'IVK#CACHE#' . $part;
$t[] = 'IVK#CID' . $_name . $part . $_compile;
// skip past delimiter position
- $i++;
+ $i ++;
}
+
return $t;
}
/**
* Check is cache is locked for this template
*
- * @param Smarty $smarty Smarty object
- * @param Smarty_Template_Cached $cached cached object
- * @return booelan true or false if cache is locked
+ * @param Smarty $smarty Smarty object
+ * @param Smarty_Template_Cached $cached cached object
+ *
+ * @return boolean true or false if cache is locked
*/
public function hasLock(Smarty $smarty, Smarty_Template_Cached $cached)
{
$key = 'LOCK#' . $cached->filepath;
$data = $this->read(array($key));
+
return $data && time() - $data[$key] < $smarty->locking_timeout;
}
/**
* Lock cache for this template
*
- * @param Smarty $smarty Smarty object
+ * @param Smarty $smarty Smarty object
* @param Smarty_Template_Cached $cached cached object
+ *
+ * @return bool|void
*/
public function acquireLock(Smarty $smarty, Smarty_Template_Cached $cached)
{
/**
* Unlock cache for this template
*
- * @param Smarty $smarty Smarty object
+ * @param Smarty $smarty Smarty object
* @param Smarty_Template_Cached $cached cached object
+ *
+ * @return bool|void
*/
public function releaseLock(Smarty $smarty, Smarty_Template_Cached $cached)
{
/**
* Read values for a set of keys from cache
*
- * @param array $keys list of keys to fetch
+ * @param array $keys list of keys to fetch
+ *
* @return array list of values with the given keys used as indexes
*/
- protected abstract function read(array $keys);
+ abstract protected function read(array $keys);
/**
* Save values for a set of keys to cache
*
- * @param array $keys list of values to save
- * @param int $expire expiration time
+ * @param array $keys list of values to save
+ * @param int $expire expiration time
+ *
* @return boolean true on success, false on failure
*/
- protected abstract function write(array $keys, $expire=null);
+ abstract protected function write(array $keys, $expire = null);
/**
* Remove values from cache
*
- * @param array $keys list of keys to delete
+ * @param array $keys list of keys to delete
+ *
* @return boolean true on success, false on failure
*/
- protected abstract function delete(array $keys);
+ abstract protected function delete(array $keys);
/**
* Remove *all* values from cache
{
return false;
}
-
}
-
-?>
\ No newline at end of file
/**
* Smarty Internal Plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage TemplateResources
*/
/**
* Smarty Resource Data Object
- *
* Meta Data Container for Config Files
*
- * @package Smarty
+ * @package Smarty
* @subpackage TemplateResources
- * @author Rodney Rehm
- *
+ * @author Rodney Rehm
* @property string $content
* @property int $timestamp
* @property bool $exists
*/
-class Smarty_Config_Source extends Smarty_Template_Source {
-
+class Smarty_Config_Source extends Smarty_Template_Source
+{
/**
* create Config Object container
*
- * @param Smarty_Resource $handler Resource Handler this source object communicates with
- * @param Smarty $smarty Smarty instance this source object belongs to
- * @param string $resource full config_resource
- * @param string $type type of resource
- * @param string $name resource name
- * @param string $unique_resource unqiue resource name
+ * @param Smarty_Resource $handler Resource Handler this source object communicates with
+ * @param Smarty $smarty Smarty instance this source object belongs to
+ * @param string $resource full config_resource
+ * @param string $type type of resource
+ * @param string $name resource name
+ * @param string $unique_resource unqiue resource name
*/
public function __construct(Smarty_Resource $handler, Smarty $smarty, $resource, $type, $name, $unique_resource)
{
/**
* <<magic>> Generic setter.
*
- * @param string $property_name valid: content, timestamp, exists
- * @param mixed $value newly assigned value (not check for correct type)
+ * @param string $property_name valid: content, timestamp, exists
+ * @param mixed $value newly assigned value (not check for correct type)
+ *
* @throws SmartyException when the given property name is not valid
*/
public function __set($property_name, $value)
/**
* <<magic>> Generic getter.
*
- * @param string $property_name valid: content, timestamp, exists
+ * @param string $property_name valid: content, timestamp, exists
+ *
+ * @return mixed|void
* @throws SmartyException when the given property name is not valid
*/
public function __get($property_name)
case 'timestamp':
case 'exists':
$this->handler->populateTimestamp($this);
+
return $this->$property_name;
case 'content':
throw new SmartyException("config property '$property_name' does not exist.");
}
}
-
}
-
-?>
\ No newline at end of file
/**
* Smarty Internal Plugin CacheResource File
*
- * @package Smarty
+ * @package Smarty
* @subpackage Cacher
- * @author Uwe Tews
- * @author Rodney Rehm
+ * @author Uwe Tews
+ * @author Rodney Rehm
*/
/**
* This class does contain all necessary methods for the HTML cache on file system
- *
* Implements the file system as resource for the HTML cache Version ussing nocache inserts.
*
- * @package Smarty
+ * @package Smarty
* @subpackage Cacher
*/
-class Smarty_Internal_CacheResource_File extends Smarty_CacheResource {
-
+class Smarty_Internal_CacheResource_File extends Smarty_CacheResource
+{
/**
* populate Cached Object with meta data from Resource
*
* @param Smarty_Template_Cached $cached cached object
* @param Smarty_Internal_Template $_template template object
+ *
* @return void
*/
public function populate(Smarty_Template_Cached $cached, Smarty_Internal_Template $_template)
} else {
$_lock_dir = $_cache_dir;
}
- $cached->lock_id = $_lock_dir.sha1($_cache_id.$_compile_id.$_template->source->uid).'.lock';
+ $cached->lock_id = $_lock_dir . sha1($_cache_id . $_compile_id . $_template->source->uid) . '.lock';
}
$cached->filepath = $_cache_dir . $_cache_id . $_compile_id . $_filepath . '.' . basename($_source_file_path) . '.php';
$cached->timestamp = @filemtime($cached->filepath);
* populate Cached Object with timestamp and exists from Resource
*
* @param Smarty_Template_Cached $cached cached object
+ *
* @return void
*/
public function populateTimestamp(Smarty_Template_Cached $cached)
* Read the cached template and process its header
*
* @param Smarty_Internal_Template $_template template object
- * @param Smarty_Template_Cached $cached cached object
- * @return booelan true or false if the cached content does not exist
+ * @param Smarty_Template_Cached $cached cached object
+ *
+ * @return booleantrue or false if the cached content does not exist
*/
- public function process(Smarty_Internal_Template $_template, Smarty_Template_Cached $cached=null)
+ public function process(Smarty_Internal_Template $_template, Smarty_Template_Cached $cached = null)
{
+ /** @var Smarty_Internal_Template $_smarty_tpl
+ * used in included file
+ */
$_smarty_tpl = $_template;
+
return @include $_template->cached->filepath;
}
*
* @param Smarty_Internal_Template $_template template object
* @param string $content content to cache
+ *
* @return boolean success
*/
public function writeCachedContent(Smarty_Internal_Template $_template, $content)
return true;
}
}
+
return false;
}
/**
* Empty cache
*
- * @param Smarty_Internal_Template $_template template object
- * @param integer $exp_time expiration time (number of seconds, not timestamp)
+ * @param Smarty $smarty
+ * @param integer $exp_time expiration time (number of seconds, not timestamp)
+ *
* @return integer number of cache files deleted
*/
public function clearAll(Smarty $smarty, $exp_time = null)
/**
* Empty cache for a specific template
*
- * @param Smarty $_template template object
+ * @param Smarty $smarty
* @param string $resource_name template name
* @param string $cache_id cache id
* @param string $compile_id compile id
* @param integer $exp_time expiration time (number of seconds, not timestamp)
+ *
* @return integer number of cache files deleted
- */
+ */
public function clear(Smarty $smarty, $resource_name, $cache_id, $compile_id, $exp_time)
{
$_cache_id = isset($cache_id) ? preg_replace('![^\w\|]+!', '_', $cache_id) : null;
$_compile_id = isset($compile_id) ? preg_replace('![^\w\|]+!', '_', $compile_id) : null;
$_dir_sep = $smarty->use_sub_dirs ? '/' : '^';
$_compile_id_offset = $smarty->use_sub_dirs ? 3 : 0;
- $_dir = $smarty->getCacheDir();
+ $_dir = realpath($smarty->getCacheDir()) . '/';
$_dir_length = strlen($_dir);
if (isset($_cache_id)) {
$_cache_id_parts = explode('|', $_cache_id);
$_cacheDirs = new RecursiveDirectoryIterator($_dir);
$_cache = new RecursiveIteratorIterator($_cacheDirs, RecursiveIteratorIterator::CHILD_FIRST);
foreach ($_cache as $_file) {
- if (substr($_file->getBasename(),0,1) == '.' || strpos($_file, '.svn') !== false) continue;
+ if (substr(basename($_file->getPathname()), 0, 1) == '.' || strpos($_file, '.svn') !== false) {
+ continue;
+ }
// directory ?
if ($_file->isDir()) {
if (!$_cache->isDot()) {
@rmdir($_file->getPathname());
}
} else {
- $_parts = explode($_dir_sep, str_replace('\\', '/', substr((string)$_file, $_dir_length)));
+ $_parts = explode($_dir_sep, str_replace('\\', '/', substr((string) $_file, $_dir_length)));
$_parts_count = count($_parts);
// check name
if (isset($resource_name)) {
- if ($_parts[$_parts_count-1] != $_resourcename_parts) {
+ if ($_parts[$_parts_count - 1] != $_resourcename_parts) {
continue;
}
}
// check compile id
- if (isset($_compile_id) && (!isset($_parts[$_parts_count-2 - $_compile_id_offset]) || $_parts[$_parts_count-2 - $_compile_id_offset] != $_compile_id)) {
+ if (isset($_compile_id) && (!isset($_parts[$_parts_count - 2 - $_compile_id_offset]) || $_parts[$_parts_count - 2 - $_compile_id_offset] != $_compile_id)) {
continue;
}
// check cache id
if ($_parts_count < $_cache_id_parts_count) {
continue;
}
- for ($i = 0; $i < $_cache_id_parts_count; $i++) {
- if ($_parts[$i] != $_cache_id_parts[$i]) continue 2;
+ for ($i = 0; $i < $_cache_id_parts_count; $i ++) {
+ if ($_parts[$i] != $_cache_id_parts[$i]) {
+ continue 2;
+ }
}
}
// expired ?
- if (isset($exp_time) && $_time - @filemtime($_file) < $exp_time) {
- continue;
+ if (isset($exp_time)) {
+ if ($exp_time < 0) {
+ preg_match('#\'cache_lifetime\' =>\s*(\d*)#', file_get_contents($_file), $match);
+ if ($_time < (@filemtime($_file) + $match[1])) {
+ continue;
+ }
+ } else {
+ if ($_time - @filemtime($_file) < $exp_time) {
+ continue;
+ }
+ }
}
$_count += @unlink((string) $_file) ? 1 : 0;
}
}
}
+
return $_count;
}
/**
* Check is cache is locked for this template
*
- * @param Smarty $smarty Smarty object
+ * @param Smarty $smarty Smarty object
* @param Smarty_Template_Cached $cached cached object
- * @return booelan true or false if cache is locked
+ *
+ * @return boolean true or false if cache is locked
*/
public function hasLock(Smarty $smarty, Smarty_Template_Cached $cached)
{
clearstatcache();
}
$t = @filemtime($cached->lock_id);
+
return $t && (time() - $t < $smarty->locking_timeout);
}
/**
* Lock cache for this template
*
- * @param Smarty $smarty Smarty object
+ * @param Smarty $smarty Smarty object
* @param Smarty_Template_Cached $cached cached object
+ *
+ * @return bool|void
*/
public function acquireLock(Smarty $smarty, Smarty_Template_Cached $cached)
{
/**
* Unlock cache for this template
*
- * @param Smarty $smarty Smarty object
+ * @param Smarty $smarty Smarty object
* @param Smarty_Template_Cached $cached cached object
+ *
+ * @return bool|void
*/
public function releaseLock(Smarty $smarty, Smarty_Template_Cached $cached)
{
@unlink($cached->lock_id);
}
}
-
-?>
\ No newline at end of file
<?php
/**
* Smarty Internal Plugin Compile Append
- *
* Compiles the {append} tag
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
- * @author Uwe Tews
+ * @author Uwe Tews
*/
/**
* Smarty Internal Plugin Compile Append Class
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
*/
-class Smarty_Internal_Compile_Append extends Smarty_Internal_Compile_Assign {
-
+class Smarty_Internal_Compile_Append extends Smarty_Internal_Compile_Assign
+{
/**
* Compiles code for the {append} tag
*
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
- * @param array $parameter array with compilation parameter
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ * @param array $parameter array with compilation parameter
+ *
* @return string compiled code
*/
public function compile($args, $compiler, $parameter)
// call compile assign
return parent::compile($_new_attr, $compiler, $_params);
}
-
}
-
-?>
\ No newline at end of file
<?php
/**
* Smarty Internal Plugin Compile Assign
- *
* Compiles the {assign} tag
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
- * @author Uwe Tews
+ * @author Uwe Tews
*/
/**
* Smarty Internal Plugin Compile Assign Class
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
*/
-class Smarty_Internal_Compile_Assign extends Smarty_Internal_CompileBase {
-
+class Smarty_Internal_Compile_Assign extends Smarty_Internal_CompileBase
+{
/**
* Compiles code for the {assign} tag
*
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
- * @param array $parameter array with compilation parameter
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ * @param array $parameter array with compilation parameter
+ *
* @return string compiled code
*/
public function compile($args, $compiler, $parameter)
if ($compiler->tag_nocache || $compiler->nocache) {
$_nocache = 'true';
// create nocache var to make it know for further compiling
- $compiler->template->tpl_vars[trim($_attr['var'], "'")] = new Smarty_variable(null, true);
+ if (isset($compiler->template->tpl_vars[trim($_attr['var'], "'")])) {
+ $compiler->template->tpl_vars[trim($_attr['var'], "'")]->nocache = true;
+ } else {
+ $compiler->template->tpl_vars[trim($_attr['var'], "'")] = new Smarty_variable(null, true);
+ }
}
// scope setup
if (isset($_attr['scope'])) {
} elseif ($_scope == Smarty::SCOPE_ROOT || $_scope == Smarty::SCOPE_GLOBAL) {
$output .= "\n\$_ptr = \$_smarty_tpl->parent; while (\$_ptr != null) {\$_ptr->tpl_vars[$_attr[var]] = clone \$_smarty_tpl->tpl_vars[$_attr[var]]; \$_ptr = \$_ptr->parent; }";
}
- if ( $_scope == Smarty::SCOPE_GLOBAL) {
+ if ($_scope == Smarty::SCOPE_GLOBAL) {
$output .= "\nSmarty::\$global_tpl_vars[$_attr[var]] = clone \$_smarty_tpl->tpl_vars[$_attr[var]];";
}
$output .= '?>';
+
return $output;
}
-
}
-
-?>
\ No newline at end of file
/**
* Smarty Internal Plugin Compile Block
- *
* Compiles the {block}{/block} tags
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
- * @author Uwe Tews
+ * @author Uwe Tews
*/
/**
* Smarty Internal Plugin Compile Block Class
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
*/
-class Smarty_Internal_Compile_Block extends Smarty_Internal_CompileBase {
+class Smarty_Internal_Compile_Block extends Smarty_Internal_CompileBase
+{
+ const parent = '____SMARTY_BLOCK_PARENT____';
/**
* Attribute definition: Overwrites base class.
*
* @var array
* @see Smarty_Internal_CompileBase
*/
- public $shorttag_order = array('name', 'hide');
+ public $shorttag_order = array('name');
+
+ /**
+ * Attribute definition: Overwrites base class.
+ *
+ * @var array
+ * @see Smarty_Internal_CompileBase
+ */
+ public $option_flags = array('hide', 'append', 'prepend', 'nocache');
/**
* Attribute definition: Overwrites base class.
* @var array
* @see Smarty_Internal_CompileBase
*/
- public $optional_attributes = array('hide');
+ public $optional_attributes = array('internal_file', 'internal_uid', 'internal_line');
+ /**
+ * nested child block names
+ *
+ * @var array
+ */
+ public static $nested_block_names = array();
+
+ /**
+ * child block source buffer
+ *
+ * @var array
+ */
+ public static $block_data = array();
/**
* Compiles code for the {block} tag
*
* @param array $args array with attributes from parser
* @param object $compiler compiler object
+ *
* @return boolean true
*/
- public function compile($args, $compiler) {
+ public function compile($args, $compiler)
+ {
// check and get attributes
$_attr = $this->getAttributes($compiler, $args);
- $save = array($_attr, $compiler->parser->current_buffer, $compiler->nocache, $compiler->smarty->merge_compiled_includes, $compiler->merged_templates, $compiler->smarty->merged_templates_func, $compiler->template->properties, $compiler->template->has_nocache_code);
- $this->openTag($compiler, 'block', $save);
+ $_name = trim($_attr['name'], "\"'");
+
+ // check if we process an inheritance child template
+ if ($compiler->inheritance_child) {
+ array_unshift(self::$nested_block_names, $_name);
+ // build {block} for child block
+ self::$block_data[$_name]['source'] =
+ "{$compiler->smarty->left_delimiter}private_child_block name={$_attr['name']} file='{$compiler->template->source->filepath}' type='{$compiler->template->source->type}' resource='{$compiler->template->template_resource}'" .
+ " uid='{$compiler->template->source->uid}' line={$compiler->lex->line}";
+ if ($_attr['nocache']) {
+ self::$block_data[$_name]['source'] .= ' nocache';
+ }
+ self::$block_data[$_name]['source'] .= $compiler->smarty->right_delimiter;
+
+ $save = array($_attr, $compiler->inheritance);
+ $this->openTag($compiler, 'block', $save);
+ // set flag for {block} tag
+ $compiler->inheritance = true;
+ $compiler->lex->yypushstate(Smarty_Internal_Templatelexer::CHILDBLOCK);
+ $compiler->has_code = false;
+ return;
+ }
+ // must merge includes
if ($_attr['nocache'] == true) {
- $compiler->nocache = true;
+ $compiler->tag_nocache = true;
}
- // set flag for {block} tag
+ $save = array($_attr, $compiler->inheritance, $compiler->parser->current_buffer, $compiler->nocache);
+ $this->openTag($compiler, 'block', $save);
$compiler->inheritance = true;
- // must merge includes
- $compiler->smarty->merge_compiled_includes = true;
+ $compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
$compiler->parser->current_buffer = new _smarty_template_buffer($compiler->parser);
$compiler->has_code = false;
+
return true;
}
/**
- * Save or replace child block source by block name during parsing
+ * Compile saved child block source
+ *
+ * @param object $compiler compiler object
+ * @param string $_name optional name of child block
*
- * @param string $block_content block source content
- * @param string $block_tag opening block tag
- * @param object $template template object
- * @param string $filepath filepath of template source
+ * @return string compiled code of child block
*/
- public static function saveBlockData($block_content, $block_tag, $template, $filepath) {
- $_rdl = preg_quote($template->smarty->right_delimiter);
- $_ldl = preg_quote($template->smarty->left_delimiter);
- if ($template->smarty->auto_literal) {
- $al = '\s*';
- } else {
- $al = '';
- }
- if (0 == preg_match("!({$_ldl}{$al}block\s+)(name=)?(\w+|'.*'|\".*\")(\s*?)?((append|prepend|nocache)?(\s*)?(hide)?)?(\s*{$_rdl})!", $block_tag, $_match)) {
- $error_text = 'Syntax Error in template "' . $template->source->filepath . '" "' . htmlspecialchars($block_tag) . '" illegal options';
- throw new SmartyCompilerException($error_text);
- } else {
- $_name = trim($_match[3], '\'"');
- if ($_match[8] != 'hide' || isset($template->block_data[$_name])) { // replace {$smarty.block.child}
- // do we have {$smart.block.child} in nested {block} tags?
- if (0 != preg_match_all("!({$_ldl}{$al}block\s+)(name=)?(\w+|'.*'|\".*\")([\s\S]*?)(hide)?(\s*{$_rdl})([\s\S]*?)({$_ldl}{$al}\\\$smarty\.block\.child{$_rdl})([\s\S]*?{$_ldl}{$al}/block{$_rdl})!", $block_content, $_match2)) {
- foreach ($_match2[3] as $key => $name) {
- // get it's replacement
- $_name2 = trim($name, '\'"');
- if ($_match2[5][$key] != 'hide' || isset($template->block_data[$_name2])) {
- if (isset($template->block_data[$_name2])) {
- $replacement = $template->block_data[$_name2]['source'];
- } else {
- $replacement = '';
- }
- // replace {$smarty.block.child} tag
- $search = array("%({$_ldl}{$al}block[\s\S]*?{$name}[\s\S]*?{$_rdl})([\s\S]*?)({$_ldl}{$al}\\\$smarty\.block\.child{$_rdl})([\s\S]*?)({$_ldl}{$al}/block{$_rdl})%", "/§§§child§§§/");
- $replace = array('\2§§§child§§§\4', $replacement);
- $block_content = preg_replace($search, $replace, $block_content);
- } else {
- // remove hidden blocks
- $block_content = preg_replace("%({$_ldl}{$al}block[\s\S]*?{$name}[\s\S]*?{$_rdl}[\s\S]*?{$_ldl}{$al}/block{$_rdl})%", '', $block_content);
- }
- }
- }
- // do we have not nested {$smart.block.child}
- if (0 != preg_match("/({$_ldl}{$al}\\\$smarty\.block\.child{$_rdl})/", $block_content, $_match2)) {
- // get child replacement for this block
- if (isset($template->block_data[$_name])) {
- $replacement = $template->block_data[$_name]['source'];
- unset($template->block_data[$_name]);
- } else {
- $replacement = '';
- }
- $block_content = preg_replace("/({$_ldl}{$al}\\\$smarty\.block\.child{$_rdl})/", $replacement, $block_content);
- }
- if (isset($template->block_data[$_name])) {
- if (strpos($template->block_data[$_name]['source'], '%%%%SMARTY_PARENT%%%%') !== false) {
- $template->block_data[$_name]['source'] =
- str_replace('%%%%SMARTY_PARENT%%%%', $block_content, $template->block_data[$_name]['source']);
- } elseif ($template->block_data[$_name]['mode'] == 'prepend') {
- $template->block_data[$_name]['source'] .= $block_content;
- } elseif ($template->block_data[$_name]['mode'] == 'append') {
- $template->block_data[$_name]['source'] = $block_content . $template->block_data[$_name]['source'];
- }
- } else {
- $template->block_data[$_name]['source'] = $block_content;
- $template->block_data[$_name]['file'] = $filepath;
- }
- if ($_match[6] == 'append') {
- $template->block_data[$_name]['mode'] = 'append';
- } elseif ($_match[6] == 'prepend') {
- $template->block_data[$_name]['mode'] = 'prepend';
- } else {
- $template->block_data[$_name]['mode'] = 'replace';
- }
+ static function compileChildBlock($compiler, $_name = null)
+ {
+ if ($compiler->inheritance_child) {
+ $name1 = Smarty_Internal_Compile_Block::$nested_block_names[0];
+ if (isset($compiler->template->block_data[$name1])) {
+ // replace inner block name with generic
+ Smarty_Internal_Compile_Block::$block_data[$name1]['source'] .= $compiler->template->block_data[$name1]['source'];
+ Smarty_Internal_Compile_Block::$block_data[$name1]['child'] = true;
}
+ $compiler->lex->yypushstate(Smarty_Internal_Templatelexer::CHILDBLOCK);
+ $compiler->has_code = false;
+ return;
}
- }
-
- /**
- * Compile saved child block source
- *
- * @param object $compiler compiler object
- * @param string $_name optional name of child block
- * @return string compiled code of schild block
- */
- public static function compileChildBlock($compiler, $_name = null) {
- $_output = '';
// if called by {$smarty.block.child} we must search the name of enclosing {block}
if ($_name == null) {
$stack_count = count($compiler->_tag_stack);
while (--$stack_count >= 0) {
if ($compiler->_tag_stack[$stack_count][0] == 'block') {
- $_name = trim($compiler->_tag_stack[$stack_count][1][0]['name'], "'\"");
+ $_name = trim($compiler->_tag_stack[$stack_count][1][0]['name'], "\"'");
break;
}
}
- // flag that child is already compile by {$smarty.block.child} inclusion
- $compiler->template->block_data[$_name]['compiled'] = true;
}
if ($_name == null) {
- $compiler->trigger_template_error('{$smarty.block.child} used out of context', $compiler->lex->taglineno);
+ $compiler->trigger_template_error(' tag {$smarty.block.child} used outside {block} tags ', $compiler->lex->taglineno);
}
// undefined child?
if (!isset($compiler->template->block_data[$_name]['source'])) {
+ $compiler->popTrace();
return '';
}
+ // flag that child is already compile by {$smarty.block.child} inclusion
+ $compiler->template->block_data[$_name]['compiled'] = true;
$_tpl = new Smarty_Internal_template('string:' . $compiler->template->block_data[$_name]['source'], $compiler->smarty, $compiler->template, $compiler->template->cache_id,
- $compiler->template->compile_id = null, $compiler->template->caching, $compiler->template->cache_lifetime);
+ $compiler->template->compile_id, $compiler->template->caching, $compiler->template->cache_lifetime);
+ if ($compiler->smarty->debugging) {
+ Smarty_Internal_Debug::ignore($_tpl);
+ }
+ $_tpl->tpl_vars = $compiler->template->tpl_vars;
$_tpl->variable_filters = $compiler->template->variable_filters;
$_tpl->properties['nocache_hash'] = $compiler->template->properties['nocache_hash'];
- $_tpl->source->filepath = $compiler->template->block_data[$_name]['file'];
$_tpl->allow_relative_path = true;
- if ($compiler->nocache) {
- $_tpl->compiler->forceNocache = 2;
- } else {
- $_tpl->compiler->forceNocache = 1;
- }
+ $_tpl->compiler->inheritance = true;
$_tpl->compiler->suppressHeader = true;
+ $_tpl->compiler->suppressFilter = true;
$_tpl->compiler->suppressTemplatePropertyHeader = true;
$_tpl->compiler->suppressMergedTemplates = true;
- if (strpos($compiler->template->block_data[$_name]['source'], '%%%%SMARTY_PARENT%%%%') !== false) {
- $_output = str_replace('%%%%SMARTY_PARENT%%%%', $compiler->parser->current_buffer->to_smarty_php(), $_tpl->compiler->compileTemplate($_tpl));
+ $nocache = $compiler->nocache || $compiler->tag_nocache;
+ if (strpos($compiler->template->block_data[$_name]['source'], self::parent) !== false) {
+ $_output = str_replace(self::parent, $compiler->parser->current_buffer->to_smarty_php(), $_tpl->compiler->compileTemplate($_tpl, $nocache));
} elseif ($compiler->template->block_data[$_name]['mode'] == 'prepend') {
- $_output = $_tpl->compiler->compileTemplate($_tpl) . $compiler->parser->current_buffer->to_smarty_php();
+ $_output = $_tpl->compiler->compileTemplate($_tpl, $nocache) . $compiler->parser->current_buffer->to_smarty_php();
} elseif ($compiler->template->block_data[$_name]['mode'] == 'append') {
- $_output = $compiler->parser->current_buffer->to_smarty_php() . $_tpl->compiler->compileTemplate($_tpl);
+ $_output = $compiler->parser->current_buffer->to_smarty_php() . $_tpl->compiler->compileTemplate($_tpl, $nocache);
} elseif (!empty($compiler->template->block_data[$_name])) {
- $_output = $_tpl->compiler->compileTemplate($_tpl);
+ $_output = $_tpl->compiler->compileTemplate($_tpl, $nocache);
}
$compiler->template->properties['file_dependency'] = array_merge($compiler->template->properties['file_dependency'], $_tpl->properties['file_dependency']);
$compiler->template->properties['function'] = array_merge($compiler->template->properties['function'], $_tpl->properties['function']);
}
}
unset($_tpl);
+ $compiler->has_code = true;
return $_output;
}
+ /**
+ * Compile $smarty.block.parent
+ *
+ * @param object $compiler compiler object
+ * @param string $_name optional name of child block
+ *
+ * @return string compiled code of child block
+ */
+ static function compileParentBlock($compiler, $_name = null)
+ {
+ // if called by {$smarty.block.parent} we must search the name of enclosing {block}
+ if ($_name == null) {
+ $stack_count = count($compiler->_tag_stack);
+ while (--$stack_count >= 0) {
+ if ($compiler->_tag_stack[$stack_count][0] == 'block') {
+ $_name = trim($compiler->_tag_stack[$stack_count][1][0]['name'], "\"'");
+ break;
+ }
+ }
+ }
+ if ($_name == null) {
+ $compiler->trigger_template_error(' tag {$smarty.block.parent} used outside {block} tags ', $compiler->lex->taglineno);
+ }
+ if (empty(Smarty_Internal_Compile_Block::$nested_block_names)) {
+ $compiler->trigger_template_error(' illegal {$smarty.block.parent} in parent template ', $compiler->lex->taglineno);
+ }
+ Smarty_Internal_Compile_Block::$block_data[Smarty_Internal_Compile_Block::$nested_block_names[0]]['source'] .= Smarty_Internal_Compile_Block::parent;
+ $compiler->lex->yypushstate(Smarty_Internal_Templatelexer::CHILDBLOCK);
+ $compiler->has_code = false;
+ return;
+ }
+
+ /**
+ * Process block source
+ *
+ * @param $compiler
+ * @param string $source source text
+ *
+ */
+ static function blockSource($compiler, $source)
+ {
+ Smarty_Internal_Compile_Block::$block_data[Smarty_Internal_Compile_Block::$nested_block_names[0]]['source'] .= $source;
+ }
}
/**
* Smarty Internal Plugin Compile BlockClose Class
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
*/
-class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_CompileBase {
-
+class Smarty_Internal_Compile_Blockclose extends Smarty_Internal_CompileBase
+{
/**
* Compiles code for the {/block} tag
*
* @param array $args array with attributes from parser
* @param object $compiler compiler object
+ *
* @return string compiled code
*/
- public function compile($args, $compiler) {
+ public function compile($args, $compiler)
+ {
$compiler->has_code = true;
// check and get attributes
$_attr = $this->getAttributes($compiler, $args);
$saved_data = $this->closeTag($compiler, array('block'));
$_name = trim($saved_data[0]['name'], "\"'");
+ // reset flag for {block} tag
+ $compiler->inheritance = $saved_data[1];
+ // check if we process an inheritance child template
+ if ($compiler->inheritance_child) {
+ $name1 = Smarty_Internal_Compile_Block::$nested_block_names[0];
+ Smarty_Internal_Compile_Block::$block_data[$name1]['source'] .= "{$compiler->smarty->left_delimiter}/private_child_block{$compiler->smarty->right_delimiter}";
+ array_shift(Smarty_Internal_Compile_Block::$nested_block_names);
+ if (!empty(Smarty_Internal_Compile_Block::$nested_block_names)) {
+ $name2 = Smarty_Internal_Compile_Block::$nested_block_names[0];
+ if (isset($compiler->template->block_data[$name1]) || !$saved_data[0]['hide']) {
+ if (isset(Smarty_Internal_Compile_Block::$block_data[$name1]['child']) || !isset($compiler->template->block_data[$name1])) {
+ Smarty_Internal_Compile_Block::$block_data[$name2]['source'] .= Smarty_Internal_Compile_Block::$block_data[$name1]['source'];
+ } else {
+ if ($compiler->template->block_data[$name1]['mode'] == 'append') {
+ Smarty_Internal_Compile_Block::$block_data[$name2]['source'] .= Smarty_Internal_Compile_Block::$block_data[$name1]['source'] . $compiler->template->block_data[$name1]['source'];
+ } elseif ($compiler->template->block_data[$name1]['mode'] == 'prepend') {
+ Smarty_Internal_Compile_Block::$block_data[$name2]['source'] .= $compiler->template->block_data[$name1]['source'] . Smarty_Internal_Compile_Block::$block_data[$name1]['source'];
+ } else {
+ Smarty_Internal_Compile_Block::$block_data[$name2]['source'] .= $compiler->template->block_data[$name1]['source'];
+ }
+ }
+ }
+ unset(Smarty_Internal_Compile_Block::$block_data[$name1]);
+ $compiler->lex->yypushstate(Smarty_Internal_Templatelexer::CHILDBLOCK);
+ } else {
+ if (isset($compiler->template->block_data[$name1]) || !$saved_data[0]['hide']) {
+ if (isset($compiler->template->block_data[$name1]) && !isset(Smarty_Internal_Compile_Block::$block_data[$name1]['child'])) {
+ if (strpos($compiler->template->block_data[$name1]['source'], Smarty_Internal_Compile_Block::parent) !== false) {
+ $compiler->template->block_data[$name1]['source'] =
+ str_replace(Smarty_Internal_Compile_Block::parent, Smarty_Internal_Compile_Block::$block_data[$name1]['source'], $compiler->template->block_data[$name1]['source']);
+ } elseif ($compiler->template->block_data[$name1]['mode'] == 'prepend') {
+ $compiler->template->block_data[$name1]['source'] .= Smarty_Internal_Compile_Block::$block_data[$name1]['source'];
+ } elseif ($compiler->template->block_data[$name1]['mode'] == 'append') {
+ $compiler->template->block_data[$name1]['source'] = Smarty_Internal_Compile_Block::$block_data[$name1]['source'] . $compiler->template->block_data[$name1]['source'];
+ }
+ } else {
+ $compiler->template->block_data[$name1]['source'] = Smarty_Internal_Compile_Block::$block_data[$name1]['source'];
+ }
+ $compiler->template->block_data[$name1]['mode'] = 'replace';
+ if ($saved_data[0]['append']) {
+ $compiler->template->block_data[$name1]['mode'] = 'append';
+ }
+ if ($saved_data[0]['prepend']) {
+ $compiler->template->block_data[$name1]['mode'] = 'prepend';
+ }
+ }
+ unset(Smarty_Internal_Compile_Block::$block_data[$name1]);
+ $compiler->lex->yypushstate(Smarty_Internal_Templatelexer::CHILDBODY);
+ }
+ $compiler->has_code = false;
+ return;
+ }
if (isset($compiler->template->block_data[$_name]) && !isset($compiler->template->block_data[$_name]['compiled'])) {
- // restore to status before {block} tag as new subtemplate code of parent {block} is not needed
- // TODO: Below code was disabled in 3.1.8 because of problems with {include} in nested {block} tags in child templates
- // combined with append/prepend or $smarty.block.parent
- // For later versions it should be checked under which conditions it could run for optimisation
- //
- //$compiler->merged_templates = $saved_data[4];
- //$compiler->smarty->merged_templates_func = $saved_data[5];
- //$compiler->template->properties = $saved_data[6];
- //$compiler->template->has_nocache_code = $saved_data[7];
$_output = Smarty_Internal_Compile_Block::compileChildBlock($compiler, $_name);
} else {
- if (isset($saved_data[0]['hide']) && !isset($compiler->template->block_data[$_name]['source'])) {
+ if ($saved_data[0]['hide'] && !isset($compiler->template->block_data[$_name]['source'])) {
$_output = '';
} else {
$_output = $compiler->parser->current_buffer->to_smarty_php();
}
- unset($compiler->template->block_data[$_name]['compiled']);
}
+ unset($compiler->template->block_data[$_name]['compiled']);
// reset flags
- $compiler->parser->current_buffer = $saved_data[1];
- $compiler->nocache = $saved_data[2];
- $compiler->smarty->merge_compiled_includes = $saved_data[3];
- // reset flag for {block} tag
- $compiler->inheritance = false;
+ $compiler->parser->current_buffer = $saved_data[2];
+ if ($compiler->nocache) {
+ $compiler->tag_nocache = true;
+ }
+ $compiler->nocache = $saved_data[3];
// $_output content has already nocache code processed
$compiler->suppressNocacheProcessing = true;
+
return $_output;
}
+}
+
+/**
+ * Smarty Internal Plugin Compile Child Block Class
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ */
+class Smarty_Internal_Compile_Private_Child_Block extends Smarty_Internal_CompileBase
+{
+
+ /**
+ * Attribute definition: Overwrites base class.
+ *
+ * @var array
+ * @see Smarty_Internal_CompileBase
+ */
+ public $required_attributes = array('name', 'file', 'uid', 'line', 'type', 'resource');
+
+ /**
+ * Compiles code for the {private_child_block} tag
+ *
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ *
+ * @return boolean true
+ */
+ public function compile($args, $compiler)
+ {
+ // check and get attributes
+ $_attr = $this->getAttributes($compiler, $args);
+
+ // update template with original template resource of {block}
+ if (trim($_attr['type'], "'") == 'file') {
+ $compiler->template->template_resource = realpath(trim($_attr['file'], "'"));
+ } else {
+ $compiler->template->template_resource = trim($_attr['resource'], "'");
+ }
+ // source object
+ unset ($compiler->template->source);
+ $exists = $compiler->template->source->exists;
+
+ // must merge includes
+ if ($_attr['nocache'] == true) {
+ $compiler->tag_nocache = true;
+ }
+ $save = array($_attr, $compiler->nocache);
+
+ // set trace back to child block
+ $compiler->pushTrace(trim($_attr['file'], "\"'"), trim($_attr['uid'], "\"'"), $_attr['line'] - $compiler->lex->line);
+
+ $this->openTag($compiler, 'private_child_block', $save);
+
+ $compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
+ $compiler->has_code = false;
+ return true;
+ }
}
-?>
\ No newline at end of file
+/**
+ * Smarty Internal Plugin Compile Child Block Close Class
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ */
+class Smarty_Internal_Compile_Private_Child_Blockclose extends Smarty_Internal_CompileBase
+{
+
+ /**
+ * Compiles code for the {/private_child_block} tag
+ *
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ *
+ * @return boolean true
+ */
+ public function compile($args, $compiler)
+ {
+ // check and get attributes
+ $_attr = $this->getAttributes($compiler, $args);
+
+ $saved_data = $this->closeTag($compiler, array('private_child_block'));
+
+ // end of child block
+ $compiler->popTrace();
+
+ $compiler->nocache = $saved_data[1];
+ $compiler->has_code = false;
+
+ return true;
+ }
+}
-<?php\r
-/**\r
- * Smarty Internal Plugin Compile Break\r
- *\r
- * Compiles the {break} tag\r
- *\r
- * @package Smarty\r
- * @subpackage Compiler\r
- * @author Uwe Tews\r
- */\r
-/**\r
- * Smarty Internal Plugin Compile Break Class\r
- *\r
- * @package Smarty\r
- * @subpackage Compiler\r
- */\r
-class Smarty_Internal_Compile_Break extends Smarty_Internal_CompileBase {\r
-\r
- /**\r
- * Attribute definition: Overwrites base class.\r
- *\r
- * @var array\r
- * @see Smarty_Internal_CompileBase\r
- */\r
- public $optional_attributes = array('levels');\r
- /**\r
- * Attribute definition: Overwrites base class.\r
- *\r
- * @var array\r
- * @see Smarty_Internal_CompileBase\r
- */\r
- public $shorttag_order = array('levels');\r
-\r
- /**\r
- * Compiles code for the {break} tag\r
- *\r
- * @param array $args array with attributes from parser\r
- * @param object $compiler compiler object\r
- * @param array $parameter array with compilation parameter\r
- * @return string compiled code\r
- */\r
- public function compile($args, $compiler, $parameter)\r
- {\r
- static $_is_loopy = array('for' => true, 'foreach' => true, 'while' => true, 'section' => true);\r
- // check and get attributes\r
- $_attr = $this->getAttributes($compiler, $args);\r
-\r
- if ($_attr['nocache'] === true) {\r
- $compiler->trigger_template_error('nocache option not allowed', $compiler->lex->taglineno);\r
- }\r
-\r
- if (isset($_attr['levels'])) {\r
- if (!is_numeric($_attr['levels'])) {\r
- $compiler->trigger_template_error('level attribute must be a numeric constant', $compiler->lex->taglineno);\r
- }\r
- $_levels = $_attr['levels'];\r
- } else {\r
- $_levels = 1;\r
- }\r
- $level_count = $_levels;\r
- $stack_count = count($compiler->_tag_stack) - 1;\r
- while ($level_count > 0 && $stack_count >= 0) {\r
- if (isset($_is_loopy[$compiler->_tag_stack[$stack_count][0]])) {\r
- $level_count--;\r
- }\r
- $stack_count--;\r
- }\r
- if ($level_count != 0) {\r
- $compiler->trigger_template_error("cannot break {$_levels} level(s)", $compiler->lex->taglineno);\r
- }\r
- $compiler->has_code = true;\r
- return "<?php break {$_levels}?>";\r
- }\r
-\r
-}\r
-\r
-?>
\ No newline at end of file
+<?php
+/**
+ * Smarty Internal Plugin Compile Break
+ * Compiles the {break} tag
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @author Uwe Tews
+ */
+
+/**
+ * Smarty Internal Plugin Compile Break Class
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ */
+class Smarty_Internal_Compile_Break extends Smarty_Internal_CompileBase
+{
+ /**
+ * Attribute definition: Overwrites base class.
+ *
+ * @var array
+ * @see Smarty_Internal_CompileBase
+ */
+ public $optional_attributes = array('levels');
+ /**
+ * Attribute definition: Overwrites base class.
+ *
+ * @var array
+ * @see Smarty_Internal_CompileBase
+ */
+ public $shorttag_order = array('levels');
+
+ /**
+ * Compiles code for the {break} tag
+ *
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ * @param array $parameter array with compilation parameter
+ *
+ * @return string compiled code
+ */
+ public function compile($args, $compiler, $parameter)
+ {
+ static $_is_loopy = array('for' => true, 'foreach' => true, 'while' => true, 'section' => true);
+ // check and get attributes
+ $_attr = $this->getAttributes($compiler, $args);
+
+ if ($_attr['nocache'] === true) {
+ $compiler->trigger_template_error('nocache option not allowed', $compiler->lex->taglineno);
+ }
+
+ if (isset($_attr['levels'])) {
+ if (!is_numeric($_attr['levels'])) {
+ $compiler->trigger_template_error('level attribute must be a numeric constant', $compiler->lex->taglineno);
+ }
+ $_levels = $_attr['levels'];
+ } else {
+ $_levels = 1;
+ }
+ $level_count = $_levels;
+ $stack_count = count($compiler->_tag_stack) - 1;
+ while ($level_count > 0 && $stack_count >= 0) {
+ if (isset($_is_loopy[$compiler->_tag_stack[$stack_count][0]])) {
+ $level_count --;
+ }
+ $stack_count --;
+ }
+ if ($level_count != 0) {
+ $compiler->trigger_template_error("cannot break {$_levels} level(s)", $compiler->lex->taglineno);
+ }
+
+ return "<?php break {$_levels}?>";
+ }
+}
<?php
/**
* Smarty Internal Plugin Compile Function_Call
- *
* Compiles the calls of user defined tags defined by {function}
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
- * @author Uwe Tews
+ * @author Uwe Tews
*/
/**
* Smarty Internal Plugin Compile Function_Call Class
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
*/
-class Smarty_Internal_Compile_Call extends Smarty_Internal_CompileBase {
-
+class Smarty_Internal_Compile_Call extends Smarty_Internal_CompileBase
+{
/**
* Attribute definition: Overwrites base class.
*
/**
* Compiles the calls of user defined tags defined by {function}
*
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
- * @param array $parameter array with compilation parameter
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ *
* @return string compiled code
*/
public function compile($args, $compiler)
$_attr = $this->getAttributes($compiler, $args);
// save possible attributes
if (isset($_attr['assign'])) {
- // output will be stored in a smarty variable instead of beind displayed
+ // output will be stored in a smarty variable instead of being displayed
$_assign = $_attr['assign'];
}
$_name = $_attr['name'];
}
}
}
- //varibale name?
+ //variable name?
if (!(strpos($_name, '$') === false)) {
$call_cache = $_name;
$call_function = '$tmp = "smarty_template_function_".' . $_name . '; $tmp';
$_output = "<?php {$call_function}(\$_smarty_tpl,{$_params});?>\n";
}
}
+
return $_output;
}
-
}
-
-?>
\ No newline at end of file
<?php
/**
* Smarty Internal Plugin Compile Capture
- *
* Compiles the {capture} tag
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
- * @author Uwe Tews
+ * @author Uwe Tews
*/
/**
* Smarty Internal Plugin Compile Capture Class
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
*/
-class Smarty_Internal_Compile_Capture extends Smarty_Internal_CompileBase {
-
+class Smarty_Internal_Compile_Capture extends Smarty_Internal_CompileBase
+{
/**
* Attribute definition: Overwrites base class.
*
/**
* Compiles code for the {capture} tag
*
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ *
* @return string compiled code
*/
public function compile($args, $compiler)
return $_output;
}
-
}
/**
* Smarty Internal Plugin Compile Captureclose Class
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
*/
-class Smarty_Internal_Compile_CaptureClose extends Smarty_Internal_CompileBase {
-
+class Smarty_Internal_Compile_CaptureClose extends Smarty_Internal_CompileBase
+{
/**
* Compiles code for the {/capture} tag
*
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ *
* @return string compiled code
*/
public function compile($args, $compiler)
$_output .= " if (isset( \$_capture_append)) \$_smarty_tpl->append( \$_capture_append, ob_get_contents());\n";
$_output .= " Smarty::\$_smarty_vars['capture'][\$_capture_buffer]=ob_get_clean();\n";
$_output .= "} else \$_smarty_tpl->capture_error();?>";
+
return $_output;
}
-
}
-
-?>
\ No newline at end of file
<?php
/**
* Smarty Internal Plugin Compile Config Load
- *
* Compiles the {config load} tag
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
- * @author Uwe Tews
+ * @author Uwe Tews
*/
/**
* Smarty Internal Plugin Compile Config Load Class
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
*/
-class Smarty_Internal_Compile_Config_Load extends Smarty_Internal_CompileBase {
-
+class Smarty_Internal_Compile_Config_Load extends Smarty_Internal_CompileBase
+{
/**
* Attribute definition: Overwrites base class.
*
* @var array
* @see Smarty_Internal_CompileBase
*/
- public $shorttag_order = array('file','section');
+ public $shorttag_order = array('file', 'section');
/**
* Attribute definition: Overwrites base class.
*
/**
* Compiles code for the {config_load} tag
*
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ *
* @return string compiled code
*/
public function compile($args, $compiler)
{
- static $_is_legal_scope = array('local' => true,'parent' => true,'root' => true,'global' => true);
+ static $_is_legal_scope = array('local' => true, 'parent' => true, 'root' => true, 'global' => true);
// check and get attributes
$_attr = $this->getAttributes($compiler, $args);
$compiler->trigger_template_error('nocache option not allowed', $compiler->lex->taglineno);
}
-
- // save posible attributes
+ // save possible attributes
$conf_file = $_attr['file'];
if (isset($_attr['section'])) {
$section = $_attr['section'];
$_attr['scope'] = trim($_attr['scope'], "'\"");
if (isset($_is_legal_scope[$_attr['scope']])) {
$scope = $_attr['scope'];
- } else {
+ } else {
$compiler->trigger_template_error('illegal value for "scope" attribute', $compiler->lex->taglineno);
- }
+ }
}
// create config object
$_output = "<?php \$_config = new Smarty_Internal_Config($conf_file, \$_smarty_tpl->smarty, \$_smarty_tpl);";
$_output .= "\$_config->loadConfigVars($section, '$scope'); ?>";
+
return $_output;
}
-
}
-
-?>
\ No newline at end of file
-<?php\r
-/**\r
- * Smarty Internal Plugin Compile Continue\r
- *\r
- * Compiles the {continue} tag\r
- *\r
- * @package Smarty\r
- * @subpackage Compiler\r
- * @author Uwe Tews\r
- */\r
-\r
-/**\r
- * Smarty Internal Plugin Compile Continue Class\r
- *\r
- * @package Smarty\r
- * @subpackage Compiler\r
- */\r
-class Smarty_Internal_Compile_Continue extends Smarty_Internal_CompileBase {\r
-\r
- /**\r
- * Attribute definition: Overwrites base class.\r
- *\r
- * @var array\r
- * @see Smarty_Internal_CompileBase\r
- */\r
- public $optional_attributes = array('levels');\r
- /**\r
- * Attribute definition: Overwrites base class.\r
- *\r
- * @var array\r
- * @see Smarty_Internal_CompileBase\r
- */\r
- public $shorttag_order = array('levels');\r
-\r
- /**\r
- * Compiles code for the {continue} tag\r
- *\r
- * @param array $args array with attributes from parser\r
- * @param object $compiler compiler object\r
- * @param array $parameter array with compilation parameter\r
- * @return string compiled code\r
- */\r
- public function compile($args, $compiler, $parameter)\r
- {\r
- static $_is_loopy = array('for' => true, 'foreach' => true, 'while' => true, 'section' => true);\r
- // check and get attributes\r
- $_attr = $this->getAttributes($compiler, $args);\r
-\r
- if ($_attr['nocache'] === true) {\r
- $compiler->trigger_template_error('nocache option not allowed', $compiler->lex->taglineno);\r
- }\r
-\r
- if (isset($_attr['levels'])) {\r
- if (!is_numeric($_attr['levels'])) {\r
- $compiler->trigger_template_error('level attribute must be a numeric constant', $compiler->lex->taglineno);\r
- }\r
- $_levels = $_attr['levels'];\r
- } else {\r
- $_levels = 1;\r
- }\r
- $level_count = $_levels;\r
- $stack_count = count($compiler->_tag_stack) - 1;\r
- while ($level_count > 0 && $stack_count >= 0) {\r
- if (isset($_is_loopy[$compiler->_tag_stack[$stack_count][0]])) {\r
- $level_count--;\r
- }\r
- $stack_count--;\r
- }\r
- if ($level_count != 0) {\r
- $compiler->trigger_template_error("cannot continue {$_levels} level(s)", $compiler->lex->taglineno);\r
- }\r
- $compiler->has_code = true;\r
- return "<?php continue {$_levels}?>";\r
- }\r
-\r
-}\r
-\r
-?>
\ No newline at end of file
+<?php
+/**
+ * Smarty Internal Plugin Compile Continue
+ * Compiles the {continue} tag
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @author Uwe Tews
+ */
+
+/**
+ * Smarty Internal Plugin Compile Continue Class
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ */
+class Smarty_Internal_Compile_Continue extends Smarty_Internal_CompileBase
+{
+ /**
+ * Attribute definition: Overwrites base class.
+ *
+ * @var array
+ * @see Smarty_Internal_CompileBase
+ */
+ public $optional_attributes = array('levels');
+ /**
+ * Attribute definition: Overwrites base class.
+ *
+ * @var array
+ * @see Smarty_Internal_CompileBase
+ */
+ public $shorttag_order = array('levels');
+
+ /**
+ * Compiles code for the {continue} tag
+ *
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ * @param array $parameter array with compilation parameter
+ *
+ * @return string compiled code
+ */
+ public function compile($args, $compiler, $parameter)
+ {
+ static $_is_loopy = array('for' => true, 'foreach' => true, 'while' => true, 'section' => true);
+ // check and get attributes
+ $_attr = $this->getAttributes($compiler, $args);
+
+ if ($_attr['nocache'] === true) {
+ $compiler->trigger_template_error('nocache option not allowed', $compiler->lex->taglineno);
+ }
+
+ if (isset($_attr['levels'])) {
+ if (!is_numeric($_attr['levels'])) {
+ $compiler->trigger_template_error('level attribute must be a numeric constant', $compiler->lex->taglineno);
+ }
+ $_levels = $_attr['levels'];
+ } else {
+ $_levels = 1;
+ }
+ $level_count = $_levels;
+ $stack_count = count($compiler->_tag_stack) - 1;
+ while ($level_count > 0 && $stack_count >= 0) {
+ if (isset($_is_loopy[$compiler->_tag_stack[$stack_count][0]])) {
+ $level_count --;
+ }
+ $stack_count --;
+ }
+ if ($level_count != 0) {
+ $compiler->trigger_template_error("cannot continue {$_levels} level(s)", $compiler->lex->taglineno);
+ }
+
+ return "<?php continue {$_levels}?>";
+ }
+}
<?php
/**
* Smarty Internal Plugin Compile Debug
- *
* Compiles the {debug} tag.
* It opens a window the the Smarty Debugging Console.
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
- * @author Uwe Tews
+ * @author Uwe Tews
*/
/**
* Smarty Internal Plugin Compile Debug Class
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
*/
-class Smarty_Internal_Compile_Debug extends Smarty_Internal_CompileBase {
-
+class Smarty_Internal_Compile_Debug extends Smarty_Internal_CompileBase
+{
/**
* Compiles code for the {debug} tag
*
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ *
* @return string compiled code
*/
public function compile($args, $compiler)
// display debug template
$_output = "<?php \$_smarty_tpl->smarty->loadPlugin('Smarty_Internal_Debug'); Smarty_Internal_Debug::display_debug(\$_smarty_tpl); ?>";
+
return $_output;
}
-
}
-
-?>
\ No newline at end of file
<?php
/**
* Smarty Internal Plugin Compile Eval
- *
* Compiles the {eval} tag.
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
- * @author Uwe Tews
+ * @author Uwe Tews
*/
/**
* Smarty Internal Plugin Compile Eval Class
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
*/
-class Smarty_Internal_Compile_Eval extends Smarty_Internal_CompileBase {
-
+class Smarty_Internal_Compile_Eval extends Smarty_Internal_CompileBase
+{
/**
* Attribute definition: Overwrites base class.
*
* @var array
* @see Smarty_Internal_CompileBase
*/
- public $shorttag_order = array('var','assign');
+ public $shorttag_order = array('var', 'assign');
/**
* Compiles code for the {eval} tag
*
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ *
* @return string compiled code
*/
public function compile($args, $compiler)
// check and get attributes
$_attr = $this->getAttributes($compiler, $args);
if (isset($_attr['assign'])) {
- // output will be stored in a smarty variable instead of beind displayed
+ // output will be stored in a smarty variable instead of being displayed
$_assign = $_attr['assign'];
}
// create template object
- $_output = "\$_template = new {$compiler->smarty->template_class}('eval:'.".$_attr['var'].", \$_smarty_tpl->smarty, \$_smarty_tpl);";
+ $_output = "\$_template = new {$compiler->smarty->template_class}('eval:'." . $_attr['var'] . ", \$_smarty_tpl->smarty, \$_smarty_tpl);";
//was there an assign attribute?
if (isset($_assign)) {
$_output .= "\$_smarty_tpl->assign($_assign,\$_template->fetch());";
} else {
$_output .= "echo \$_template->fetch();";
}
+
return "<?php $_output ?>";
}
-
}
-
-?>
\ No newline at end of file
<?php
/**
-* Smarty Internal Plugin Compile extend
-*
-* Compiles the {extends} tag
-*
-* @package Smarty
-* @subpackage Compiler
-* @author Uwe Tews
-*/
+ * Smarty Internal Plugin Compile extend
+ * Compiles the {extends} tag
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @author Uwe Tews
+ */
/**
-* Smarty Internal Plugin Compile extend Class
-*
-* @package Smarty
-* @subpackage Compiler
-*/
-class Smarty_Internal_Compile_Extends extends Smarty_Internal_CompileBase {
-
+ * Smarty Internal Plugin Compile extend Class
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ */
+class Smarty_Internal_Compile_Extends extends Smarty_Internal_CompileBase
+{
/**
- * Attribute definition: Overwrites base class.
- *
- * @var array
- * @see Smarty_Internal_CompileBase
- */
+ * Attribute definition: Overwrites base class.
+ *
+ * @var array
+ * @see Smarty_Internal_CompileBase
+ */
public $required_attributes = array('file');
/**
- * Attribute definition: Overwrites base class.
- *
- * @var array
- * @see Smarty_Internal_CompileBase
- */
+ * Attribute definition: Overwrites base class.
+ *
+ * @var array
+ * @see Smarty_Internal_CompileBase
+ */
public $shorttag_order = array('file');
- /**
- * mbstring.overload flag
- *
- * @var int
- */
- public $mbstring_overload = 0;
/**
- * Compiles code for the {extends} tag
- *
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
- * @return string compiled code
- */
+ * Compiles code for the {extends} tag
+ *
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ *
+ * @return string compiled code
+ */
public function compile($args, $compiler)
{
- static $_is_stringy = array('string' => true, 'eval' => true);
- $this->_rdl = preg_quote($compiler->smarty->right_delimiter);
- $this->_ldl = preg_quote($compiler->smarty->left_delimiter);
- $filepath = $compiler->template->source->filepath;
- $this->mbstring_overload = ini_get('mbstring.func_overload') & 2;
// check and get attributes
$_attr = $this->getAttributes($compiler, $args);
if ($_attr['nocache'] === true) {
$compiler->trigger_template_error('nocache option not allowed', $compiler->lex->taglineno);
}
-
- $_smarty_tpl = $compiler->template;
- $include_file = null;
if (strpos($_attr['file'], '$_tmp') !== false) {
$compiler->trigger_template_error('illegal value for file attribute', $compiler->lex->taglineno);
}
- eval('$include_file = ' . $_attr['file'] . ';');
+
+ $name = $_attr['file'];
+ /** @var Smarty_Internal_Template $_smarty_tpl
+ * used in evaluated code
+ */
+ $_smarty_tpl = $compiler->template;
+ eval("\$tpl_name = $name;");
// create template object
- $_template = new $compiler->smarty->template_class($include_file, $compiler->smarty, $compiler->template);
- // save file dependency
- if (isset($_is_stringy[$_template->source->type])) {
- $template_sha1 = sha1($include_file);
- } else {
- $template_sha1 = sha1($_template->source->filepath);
- }
- if (isset($compiler->template->properties['file_dependency'][$template_sha1])) {
- $compiler->trigger_template_error("illegal recursive call of \"{$include_file}\"", $compiler->lex->line - 1);
- }
- $compiler->template->properties['file_dependency'][$template_sha1] = array($_template->source->filepath, $_template->source->timestamp, $_template->source->type);
- $_content = ($this->mbstring_overload ? mb_substr($compiler->template->source->content, $compiler->lex->counter - 1, 20000000, 'latin1') : substr($compiler->template->source->content, $compiler->lex->counter - 1));
- if (preg_match_all("!({$this->_ldl}block\s(.+?){$this->_rdl})!", $_content, $s) !=
- preg_match_all("!({$this->_ldl}/block{$this->_rdl})!", $_content, $c)) {
- $compiler->trigger_template_error('unmatched {block} {/block} pairs');
+ $_template = new $compiler->smarty->template_class($tpl_name, $compiler->smarty, $compiler->template);
+ // check for recursion
+ $uid = $_template->source->uid;
+ if (isset($compiler->extends_uid[$uid])) {
+ $compiler->trigger_template_error("illegal recursive call of \"$include_file\"", $compiler->lex->line - 1);
}
- preg_match_all("!{$this->_ldl}block\s(.+?){$this->_rdl}|{$this->_ldl}/block{$this->_rdl}|{$this->_ldl}\*([\S\s]*?)\*{$this->_rdl}!", $_content, $_result, PREG_OFFSET_CAPTURE);
- $_result_count = count($_result[0]);
- $_start = 0;
- while ($_start+1 < $_result_count) {
- $_end = 0;
- $_level = 1;
- if (($this->mbstring_overload ? mb_substr($_result[0][$_start][0],0,mb_strlen($compiler->smarty->left_delimiter,'latin1')+1, 'latin1') : substr($_result[0][$_start][0],0,strlen($compiler->smarty->left_delimiter)+1)) == $compiler->smarty->left_delimiter.'*') {
- $_start++;
- continue;
- }
- while ($_level != 0) {
- $_end++;
- if (($this->mbstring_overload ? mb_substr($_result[0][$_start + $_end][0],0,mb_strlen($compiler->smarty->left_delimiter,'latin1')+1, 'latin1') : substr($_result[0][$_start + $_end][0],0,strlen($compiler->smarty->left_delimiter)+1)) == $compiler->smarty->left_delimiter.'*') {
- continue;
- }
- if (!strpos($_result[0][$_start + $_end][0], '/')) {
- $_level++;
- } else {
- $_level--;
+ $compiler->extends_uid[$uid] = true;
+ if (empty($_template->source->components)) {
+ array_unshift($compiler->sources, $_template->source);
+ } else {
+ foreach ($_template->source->components as $source) {
+ array_unshift($compiler->sources, $source);
+ $uid = $source->uid;
+ if (isset($compiler->extends_uid[$uid])) {
+ $compiler->trigger_template_error("illegal recursive call of \"{$source->filepath}\"", $compiler->lex->line - 1);
}
- }
- $_block_content = str_replace($compiler->smarty->left_delimiter . '$smarty.block.parent' . $compiler->smarty->right_delimiter, '%%%%SMARTY_PARENT%%%%',
- ($this->mbstring_overload ? mb_substr($_content, $_result[0][$_start][1] + mb_strlen($_result[0][$_start][0], 'latin1'), $_result[0][$_start + $_end][1] - $_result[0][$_start][1] - + mb_strlen($_result[0][$_start][0], 'latin1'), 'latin1') : substr($_content, $_result[0][$_start][1] + strlen($_result[0][$_start][0]), $_result[0][$_start + $_end][1] - $_result[0][$_start][1] - + strlen($_result[0][$_start][0]))));
- Smarty_Internal_Compile_Block::saveBlockData($_block_content, $_result[0][$_start][0], $compiler->template, $filepath);
- $_start = $_start + $_end + 1;
- }
- if ($_template->source->type == 'extends') {
- $_template->block_data = $compiler->template->block_data;
- }
- $compiler->template->source->content = $_template->source->content;
- if ($_template->source->type == 'extends') {
- $compiler->template->block_data = $_template->block_data;
- foreach ($_template->source->components as $key => $component) {
- $compiler->template->properties['file_dependency'][$key] = array($component->filepath, $component->timestamp, $component->type);
+ $compiler->extends_uid[$uid] = true;
}
}
- $compiler->template->source->filepath = $_template->source->filepath;
- $compiler->abort_and_recompile = true;
+ unset ($_template);
+ $compiler->inheritance_child = true;
+ $compiler->lex->yypushstate(Smarty_Internal_Templatelexer::CHILDBODY);
return '';
}
-
}
-
-?>
\ No newline at end of file
<?php
/**
* Smarty Internal Plugin Compile For
- *
* Compiles the {for} {forelse} {/for} tags
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
- * @author Uwe Tews
+ * @author Uwe Tews
*/
/**
* Smarty Internal Plugin Compile For Class
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
*/
-class Smarty_Internal_Compile_For extends Smarty_Internal_CompileBase {
-
+class Smarty_Internal_Compile_For extends Smarty_Internal_CompileBase
+{
/**
* Compiles code for the {for} tag
- *
- * Smarty 3 does implement two different sytaxes:
- *
+ * Smarty 3 does implement two different syntax's:
* - {for $var in $array}
* For looping over arrays or iterators
- *
* - {for $x=0; $x<$y; $x++}
* For general loops
+ * The parser is generating different sets of attribute by which this compiler can
+ * determine which syntax is used.
*
- * The parser is gereration different sets of attribute by which this compiler can
- * determin which syntax is used.
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ * @param array $parameter array with compilation parameter
*
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
- * @param array $parameter array with compilation parameter
* @return string compiled code
*/
public function compile($args, $compiler, $parameter)
$output .= " \$_smarty_tpl->tpl_vars[$_statement[var]] = new Smarty_Variable;";
$output .= " \$_smarty_tpl->tpl_vars[$_statement[var]]->value = $_statement[value];\n";
}
- $output .= " if ($_attr[ifexp]){ for (\$_foo=true;$_attr[ifexp]; \$_smarty_tpl->tpl_vars[$_attr[var]]->value$_attr[step]){\n";
+ $output .= " if ($_attr[ifexp]) { for (\$_foo=true;$_attr[ifexp]; \$_smarty_tpl->tpl_vars[$_attr[var]]->value$_attr[step]) {\n";
} else {
$_statement = $_attr['start'];
$output .= "\$_smarty_tpl->tpl_vars[$_statement[var]] = new Smarty_Variable;";
$output .= "\$_smarty_tpl->tpl_vars[$_statement[var]]->step = 1;";
}
if (isset($_attr['max'])) {
- $output .= "\$_smarty_tpl->tpl_vars[$_statement[var]]->total = (int)min(ceil((\$_smarty_tpl->tpl_vars[$_statement[var]]->step > 0 ? $_attr[to]+1 - ($_statement[value]) : $_statement[value]-($_attr[to])+1)/abs(\$_smarty_tpl->tpl_vars[$_statement[var]]->step)),$_attr[max]);\n";
+ $output .= "\$_smarty_tpl->tpl_vars[$_statement[var]]->total = (int) min(ceil((\$_smarty_tpl->tpl_vars[$_statement[var]]->step > 0 ? $_attr[to]+1 - ($_statement[value]) : $_statement[value]-($_attr[to])+1)/abs(\$_smarty_tpl->tpl_vars[$_statement[var]]->step)),$_attr[max]);\n";
} else {
- $output .= "\$_smarty_tpl->tpl_vars[$_statement[var]]->total = (int)ceil((\$_smarty_tpl->tpl_vars[$_statement[var]]->step > 0 ? $_attr[to]+1 - ($_statement[value]) : $_statement[value]-($_attr[to])+1)/abs(\$_smarty_tpl->tpl_vars[$_statement[var]]->step));\n";
+ $output .= "\$_smarty_tpl->tpl_vars[$_statement[var]]->total = (int) ceil((\$_smarty_tpl->tpl_vars[$_statement[var]]->step > 0 ? $_attr[to]+1 - ($_statement[value]) : $_statement[value]-($_attr[to])+1)/abs(\$_smarty_tpl->tpl_vars[$_statement[var]]->step));\n";
}
- $output .= "if (\$_smarty_tpl->tpl_vars[$_statement[var]]->total > 0){\n";
- $output .= "for (\$_smarty_tpl->tpl_vars[$_statement[var]]->value = $_statement[value], \$_smarty_tpl->tpl_vars[$_statement[var]]->iteration = 1;\$_smarty_tpl->tpl_vars[$_statement[var]]->iteration <= \$_smarty_tpl->tpl_vars[$_statement[var]]->total;\$_smarty_tpl->tpl_vars[$_statement[var]]->value += \$_smarty_tpl->tpl_vars[$_statement[var]]->step, \$_smarty_tpl->tpl_vars[$_statement[var]]->iteration++){\n";
+ $output .= "if (\$_smarty_tpl->tpl_vars[$_statement[var]]->total > 0) {\n";
+ $output .= "for (\$_smarty_tpl->tpl_vars[$_statement[var]]->value = $_statement[value], \$_smarty_tpl->tpl_vars[$_statement[var]]->iteration = 1;\$_smarty_tpl->tpl_vars[$_statement[var]]->iteration <= \$_smarty_tpl->tpl_vars[$_statement[var]]->total;\$_smarty_tpl->tpl_vars[$_statement[var]]->value += \$_smarty_tpl->tpl_vars[$_statement[var]]->step, \$_smarty_tpl->tpl_vars[$_statement[var]]->iteration++) {\n";
$output .= "\$_smarty_tpl->tpl_vars[$_statement[var]]->first = \$_smarty_tpl->tpl_vars[$_statement[var]]->iteration == 1;";
$output .= "\$_smarty_tpl->tpl_vars[$_statement[var]]->last = \$_smarty_tpl->tpl_vars[$_statement[var]]->iteration == \$_smarty_tpl->tpl_vars[$_statement[var]]->total;";
}
// return compiled code
return $output;
}
-
}
/**
* Smarty Internal Plugin Compile Forelse Class
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
*/
-class Smarty_Internal_Compile_Forelse extends Smarty_Internal_CompileBase {
-
+class Smarty_Internal_Compile_Forelse extends Smarty_Internal_CompileBase
+{
/**
* Compiles code for the {forelse} tag
*
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
- * @param array $parameter array with compilation parameter
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ * @param array $parameter array with compilation parameter
+ *
* @return string compiled code
*/
public function compile($args, $compiler, $parameter)
{
// check and get attributes
- $_attr = $this->getAttributes($compiler, $args);
+ $_attr = $this->getAttributes($compiler, $args);
list($openTag, $nocache) = $this->closeTag($compiler, array('for'));
$this->openTag($compiler, 'forelse', array('forelse', $nocache));
+
return "<?php }} else { ?>";
}
-
}
/**
* Smarty Internal Plugin Compile Forclose Class
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
*/
-class Smarty_Internal_Compile_Forclose extends Smarty_Internal_CompileBase {
-
+class Smarty_Internal_Compile_Forclose extends Smarty_Internal_CompileBase
+{
/**
* Compiles code for the {/for} tag
*
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
- * @param array $parameter array with compilation parameter
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ * @param array $parameter array with compilation parameter
+ *
* @return string compiled code
*/
public function compile($args, $compiler, $parameter)
return "<?php }} ?>";
}
}
-
}
-
-?>
\ No newline at end of file
<?php
/**
* Smarty Internal Plugin Compile Foreach
- *
* Compiles the {foreach} {foreachelse} {/foreach} tags
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
- * @author Uwe Tews
+ * @author Uwe Tews
*/
/**
* Smarty Internal Plugin Compile Foreach Class
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
*/
-class Smarty_Internal_Compile_Foreach extends Smarty_Internal_CompileBase {
+class Smarty_Internal_Compile_Foreach extends Smarty_Internal_CompileBase
+{
/**
* Attribute definition: Overwrites base class.
*
* @var array
* @see Smarty_Internal_CompileBase
*/
- public $shorttag_order = array('from','item','key','name');
+ public $shorttag_order = array('from', 'item', 'key', 'name');
/**
* Compiles code for the {foreach} tag
*
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
- * @param array $parameter array with compilation parameter
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ * @param array $parameter array with compilation parameter
+ *
* @return string compiled code
*/
public function compile($args, $compiler, $parameter)
{
- $tpl = $compiler->template;
// check and get attributes
$_attr = $this->getAttributes($compiler, $args);
$ItemVarName = '$' . trim($item, '\'"') . '@';
// evaluates which Smarty variables and properties have to be computed
if ($has_name) {
- $usesSmartyFirst = strpos($tpl->source->content, $SmartyVarName . 'first') !== false;
- $usesSmartyLast = strpos($tpl->source->content, $SmartyVarName . 'last') !== false;
- $usesSmartyIndex = strpos($tpl->source->content, $SmartyVarName . 'index') !== false;
- $usesSmartyIteration = strpos($tpl->source->content, $SmartyVarName . 'iteration') !== false;
- $usesSmartyShow = strpos($tpl->source->content, $SmartyVarName . 'show') !== false;
- $usesSmartyTotal = strpos($tpl->source->content, $SmartyVarName . 'total') !== false;
+ $usesSmartyFirst = strpos($compiler->lex->data, $SmartyVarName . 'first') !== false;
+ $usesSmartyLast = strpos($compiler->lex->data, $SmartyVarName . 'last') !== false;
+ $usesSmartyIndex = strpos($compiler->lex->data, $SmartyVarName . 'index') !== false;
+ $usesSmartyIteration = strpos($compiler->lex->data, $SmartyVarName . 'iteration') !== false;
+ $usesSmartyShow = strpos($compiler->lex->data, $SmartyVarName . 'show') !== false;
+ $usesSmartyTotal = strpos($compiler->lex->data, $SmartyVarName . 'total') !== false;
} else {
$usesSmartyFirst = false;
$usesSmartyLast = false;
$usesSmartyShow = false;
}
- $usesPropFirst = $usesSmartyFirst || strpos($tpl->source->content, $ItemVarName . 'first') !== false;
- $usesPropLast = $usesSmartyLast || strpos($tpl->source->content, $ItemVarName . 'last') !== false;
- $usesPropIndex = $usesPropFirst || strpos($tpl->source->content, $ItemVarName . 'index') !== false;
- $usesPropIteration = $usesPropLast || strpos($tpl->source->content, $ItemVarName . 'iteration') !== false;
- $usesPropShow = strpos($tpl->source->content, $ItemVarName . 'show') !== false;
- $usesPropTotal = $usesSmartyTotal || $usesSmartyShow || $usesPropShow || $usesPropLast || strpos($tpl->source->content, $ItemVarName . 'total') !== false;
+ $usesPropFirst = $usesSmartyFirst || strpos($compiler->lex->data, $ItemVarName . 'first') !== false;
+ $usesPropLast = $usesSmartyLast || strpos($compiler->lex->data, $ItemVarName . 'last') !== false;
+ $usesPropIndex = $usesPropFirst || strpos($compiler->lex->data, $ItemVarName . 'index') !== false;
+ $usesPropIteration = $usesPropLast || strpos($compiler->lex->data, $ItemVarName . 'iteration') !== false;
+ $usesPropShow = strpos($compiler->lex->data, $ItemVarName . 'show') !== false;
+ $usesPropTotal = $usesSmartyTotal || $usesSmartyShow || $usesPropShow || $usesPropLast || strpos($compiler->lex->data, $ItemVarName . 'total') !== false;
// generate output code
$output = "<?php ";
$output .= " \$_smarty_tpl->tpl_vars[$item] = new Smarty_Variable; \$_smarty_tpl->tpl_vars[$item]->_loop = false;\n";
$output .= " \$_smarty_tpl->tpl_vars['smarty']->value['foreach'][$name]['show']=(\$_smarty_tpl->tpl_vars[$item]->total > 0);\n";
}
}
- $output .= "foreach (\$_from as \$_smarty_tpl->tpl_vars[$item]->key => \$_smarty_tpl->tpl_vars[$item]->value){\n\$_smarty_tpl->tpl_vars[$item]->_loop = true;\n";
+ $output .= "foreach (\$_from as \$_smarty_tpl->tpl_vars[$item]->key => \$_smarty_tpl->tpl_vars[$item]->value) {\n\$_smarty_tpl->tpl_vars[$item]->_loop = true;\n";
if ($key != null) {
$output .= " \$_smarty_tpl->tpl_vars[$key]->value = \$_smarty_tpl->tpl_vars[$item]->key;\n";
}
/**
* Smarty Internal Plugin Compile Foreachelse Class
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
*/
-class Smarty_Internal_Compile_Foreachelse extends Smarty_Internal_CompileBase {
-
+class Smarty_Internal_Compile_Foreachelse extends Smarty_Internal_CompileBase
+{
/**
* Compiles code for the {foreachelse} tag
*
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
- * @param array $parameter array with compilation parameter
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ * @param array $parameter array with compilation parameter
+ *
* @return string compiled code
*/
public function compile($args, $compiler, $parameter)
return "<?php }\nif (!\$_smarty_tpl->tpl_vars[$item]->_loop) {\n?>";
}
-
}
/**
* Smarty Internal Plugin Compile Foreachclose Class
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
*/
-class Smarty_Internal_Compile_Foreachclose extends Smarty_Internal_CompileBase {
-
+class Smarty_Internal_Compile_Foreachclose extends Smarty_Internal_CompileBase
+{
/**
* Compiles code for the {/foreach} tag
*
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
- * @param array $parameter array with compilation parameter
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ * @param array $parameter array with compilation parameter
+ *
* @return string compiled code
*/
public function compile($args, $compiler, $parameter)
return "<?php } ?>";
}
-
}
-
-?>
\ No newline at end of file
<?php
/**
* Smarty Internal Plugin Compile Function
- *
* Compiles the {function} {/function} tags
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
- * @author Uwe Tews
+ * @author Uwe Tews
*/
/**
* Smarty Internal Plugin Compile Function Class
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
*/
-class Smarty_Internal_Compile_Function extends Smarty_Internal_CompileBase {
-
+class Smarty_Internal_Compile_Function extends Smarty_Internal_CompileBase
+{
/**
* Attribute definition: Overwrites base class.
*
/**
* Compiles code for the {function} tag
*
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
- * @param array $parameter array with compilation parameter
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ * @param array $parameter array with compilation parameter
+ *
* @return boolean true
*/
public function compile($args, $compiler, $parameter)
}
unset($_attr['nocache']);
$save = array($_attr, $compiler->parser->current_buffer,
- $compiler->template->has_nocache_code, $compiler->template->required_plugins);
+ $compiler->template->has_nocache_code, $compiler->template->required_plugins);
$this->openTag($compiler, 'function', $save);
$_name = trim($_attr['name'], "'\"");
unset($_attr['name']);
// set flag that we are compiling a template function
$compiler->compiles_template_function = true;
$compiler->template->properties['function'][$_name]['parameter'] = array();
+ /** @var Smarty_Internal_Template $_smarty_tpl
+ * used in evaluated code
+ */
$_smarty_tpl = $compiler->template;
foreach ($_attr as $_key => $_data) {
- eval ('$tmp='.$_data.';');
+ eval ('$tmp=' . $_data . ';');
$compiler->template->properties['function'][$_name]['parameter'][$_key] = $tmp;
}
$compiler->smarty->template_functions[$_name]['parameter'] = $compiler->template->properties['function'][$_name]['parameter'];
foreach (\$_smarty_tpl->smarty->template_functions['{$_name}']['parameter'] as \$key => \$value) {\$_smarty_tpl->tpl_vars[\$key] = new Smarty_variable(\$value);};
foreach (\$params as \$key => \$value) {\$_smarty_tpl->tpl_vars[\$key] = new Smarty_variable(\$value);}?>";
}
- // Init temporay context
+ // Init temporary context
$compiler->template->required_plugins = array('compiled' => array(), 'nocache' => array());
$compiler->parser->current_buffer = new _smarty_template_buffer($compiler->parser);
$compiler->parser->current_buffer->append_subtree(new _smarty_tag($compiler->parser, $output));
$compiler->template->properties['function'][$_name]['compiled'] = '';
return true;
}
-
}
/**
* Smarty Internal Plugin Compile Functionclose Class
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
*/
-class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase {
-
+class Smarty_Internal_Compile_Functionclose extends Smarty_Internal_CompileBase
+{
/**
* Compiles code for the {/function} tag
*
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
- * @param array $parameter array with compilation parameter
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ * @param array $parameter array with compilation parameter
+ *
* @return boolean true
*/
public function compile($args, $compiler, $parameter)
$plugins_string = '';
if (!empty($compiler->template->required_plugins['compiled'])) {
$plugins_string = '<?php ';
- foreach($compiler->template->required_plugins['compiled'] as $tmp) {
- foreach($tmp as $data) {
+ foreach ($compiler->template->required_plugins['compiled'] as $tmp) {
+ foreach ($tmp as $data) {
$plugins_string .= "if (!is_callable('{$data['function']}')) include '{$data['file']}';\n";
}
}
}
if (!empty($compiler->template->required_plugins['nocache'])) {
$plugins_string .= "<?php echo '/*%%SmartyNocache:{$compiler->template->properties['nocache_hash']}%%*/<?php ";
- foreach($compiler->template->required_plugins['nocache'] as $tmp) {
- foreach($tmp as $data) {
+ foreach ($compiler->template->required_plugins['nocache'] as $tmp) {
+ foreach ($tmp as $data) {
$plugins_string .= "if (!is_callable(\'{$data['function']}\')) include \'{$data['file']}\';\n";
}
}
$plugins_string .= "?>/*/%%SmartyNocache:{$compiler->template->properties['nocache_hash']}%%*/';?>\n";
}
- // remove last line break from function definition
- $last = count($compiler->parser->current_buffer->subtrees) - 1;
- if ($compiler->parser->current_buffer->subtrees[$last] instanceof _smarty_linebreak) {
- unset($compiler->parser->current_buffer->subtrees[$last]);
- }
+ // remove last line break from function definition
+ $last = count($compiler->parser->current_buffer->subtrees) - 1;
+ if ($compiler->parser->current_buffer->subtrees[$last] instanceof _smarty_linebreak) {
+ unset($compiler->parser->current_buffer->subtrees[$last]);
+ }
// if caching save template function for possible nocache call
if ($compiler->template->caching) {
$compiler->template->properties['function'][$_name]['compiled'] .= $plugins_string
- . $compiler->parser->current_buffer->to_smarty_php();
+ . $compiler->parser->current_buffer->to_smarty_php();
$compiler->template->properties['function'][$_name]['nocache_hash'] = $compiler->template->properties['nocache_hash'];
$compiler->template->properties['function'][$_name]['has_nocache_code'] = $compiler->template->has_nocache_code;
$compiler->template->properties['function'][$_name]['called_functions'] = $compiler->called_functions;
$compiler->has_code = false;
$output = true;
} else {
- $output = $plugins_string . $compiler->parser->current_buffer->to_smarty_php() . "<?php \$_smarty_tpl->tpl_vars = \$saved_tpl_vars;}}?>\n";
+ $output = $plugins_string . $compiler->parser->current_buffer->to_smarty_php() . "<?php \$_smarty_tpl->tpl_vars = \$saved_tpl_vars;
+foreach (Smarty::\$global_tpl_vars as \$key => \$value) if(!isset(\$_smarty_tpl->tpl_vars[\$key])) \$_smarty_tpl->tpl_vars[\$key] = \$value;}}?>\n";
}
// reset flag that we are compiling a template function
$compiler->compiles_template_function = false;
$compiler->parser->current_buffer = $saved_data[1];
$compiler->template->has_nocache_code = $compiler->template->has_nocache_code | $saved_data[2];
$compiler->template->required_plugins = $saved_data[3];
+
return $output;
}
-
}
-
-?>
\ No newline at end of file
<?php
/**
-* Smarty Internal Plugin Compile If
-*
-* Compiles the {if} {else} {elseif} {/if} tags
-*
-* @package Smarty
-* @subpackage Compiler
-* @author Uwe Tews
-*/
+ * Smarty Internal Plugin Compile If
+ * Compiles the {if} {else} {elseif} {/if} tags
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @author Uwe Tews
+ */
/**
-* Smarty Internal Plugin Compile If Class
-*
-* @package Smarty
-* @subpackage Compiler
-*/
-class Smarty_Internal_Compile_If extends Smarty_Internal_CompileBase {
-
+ * Smarty Internal Plugin Compile If Class
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ */
+class Smarty_Internal_Compile_If extends Smarty_Internal_CompileBase
+{
/**
- * Compiles code for the {if} tag
- *
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
- * @param array $parameter array with compilation parameter
- * @return string compiled code
- */
+ * Compiles code for the {if} tag
+ *
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ * @param array $parameter array with compilation parameter
+ *
+ * @return string compiled code
+ */
public function compile($args, $compiler, $parameter)
{
// check and get attributes
// must whole block be nocache ?
$compiler->nocache = $compiler->nocache | $compiler->tag_nocache;
- if (!array_key_exists("if condition",$parameter)) {
+ if (!array_key_exists("if condition", $parameter)) {
$compiler->trigger_template_error("missing if condition", $compiler->lex->taglineno);
}
$_nocache = '';
}
if (is_array($parameter['if condition']['var'])) {
- $_output = "<?php if (!isset(\$_smarty_tpl->tpl_vars[".$parameter['if condition']['var']['var']."]) || !is_array(\$_smarty_tpl->tpl_vars[".$parameter['if condition']['var']['var']."]->value)) \$_smarty_tpl->createLocalArrayVariable(".$parameter['if condition']['var']['var']."$_nocache);\n";
- $_output .= "if (\$_smarty_tpl->tpl_vars[".$parameter['if condition']['var']['var']."]->value".$parameter['if condition']['var']['smarty_internal_index']." = ".$parameter['if condition']['value']."){?>";
+ $_output = "<?php if (!isset(\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var']['var'] . "]) || !is_array(\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var']['var'] . "]->value)) \$_smarty_tpl->createLocalArrayVariable(" . $parameter['if condition']['var']['var'] . "$_nocache);\n";
+ $_output .= "if (\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var']['var'] . "]->value" . $parameter['if condition']['var']['smarty_internal_index'] . " = " . $parameter['if condition']['value'] . ") {?>";
} else {
- $_output = "<?php if (!isset(\$_smarty_tpl->tpl_vars[".$parameter['if condition']['var']."])) \$_smarty_tpl->tpl_vars[".$parameter['if condition']['var']."] = new Smarty_Variable(null{$_nocache});";
- $_output .= "if (\$_smarty_tpl->tpl_vars[".$parameter['if condition']['var']."]->value = ".$parameter['if condition']['value']."){?>";
+ $_output = "<?php if (!isset(\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var'] . "])) \$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var'] . "] = new Smarty_Variable(null{$_nocache});";
+ $_output .= "if (\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var'] . "]->value = " . $parameter['if condition']['value'] . ") {?>";
}
+
return $_output;
} else {
- return "<?php if ({$parameter['if condition']}){?>";
+ return "<?php if ({$parameter['if condition']}) {?>";
}
}
-
}
/**
-* Smarty Internal Plugin Compile Else Class
-*
-* @package Smarty
-* @subpackage Compiler
-*/
-class Smarty_Internal_Compile_Else extends Smarty_Internal_CompileBase {
-
+ * Smarty Internal Plugin Compile Else Class
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ */
+class Smarty_Internal_Compile_Else extends Smarty_Internal_CompileBase
+{
/**
- * Compiles code for the {else} tag
- *
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
- * @param array $parameter array with compilation parameter
- * @return string compiled code
- */
+ * Compiles code for the {else} tag
+ *
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ * @param array $parameter array with compilation parameter
+ *
+ * @return string compiled code
+ */
public function compile($args, $compiler, $parameter)
{
list($nesting, $compiler->tag_nocache) = $this->closeTag($compiler, array('if', 'elseif'));
$this->openTag($compiler, 'else', array($nesting, $compiler->tag_nocache));
- return "<?php }else{ ?>";
+ return "<?php } else { ?>";
}
-
}
/**
-* Smarty Internal Plugin Compile ElseIf Class
-*
-* @package Smarty
-* @subpackage Compiler
-*/
-class Smarty_Internal_Compile_Elseif extends Smarty_Internal_CompileBase {
-
+ * Smarty Internal Plugin Compile ElseIf Class
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ */
+class Smarty_Internal_Compile_Elseif extends Smarty_Internal_CompileBase
+{
/**
- * Compiles code for the {elseif} tag
- *
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
- * @param array $parameter array with compilation parameter
- * @return string compiled code
- */
+ * Compiles code for the {elseif} tag
+ *
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ * @param array $parameter array with compilation parameter
+ *
+ * @return string compiled code
+ */
public function compile($args, $compiler, $parameter)
{
// check and get attributes
list($nesting, $compiler->tag_nocache) = $this->closeTag($compiler, array('if', 'elseif'));
- if (!array_key_exists("if condition",$parameter)) {
+ if (!array_key_exists("if condition", $parameter)) {
$compiler->trigger_template_error("missing elseif condition", $compiler->lex->taglineno);
}
if ($condition_by_assign) {
$this->openTag($compiler, 'elseif', array($nesting + 1, $compiler->tag_nocache));
if (is_array($parameter['if condition']['var'])) {
- $_output = "<?php }else{ if (!isset(\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var']['var'] . "]) || !is_array(\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var']['var'] . "]->value)) \$_smarty_tpl->createLocalArrayVariable(" . $parameter['if condition']['var']['var'] . "$_nocache);\n";
- $_output .= "if (\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var']['var'] . "]->value" . $parameter['if condition']['var']['smarty_internal_index'] . " = " . $parameter['if condition']['value'] . "){?>";
+ $_output = "<?php } else { if (!isset(\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var']['var'] . "]) || !is_array(\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var']['var'] . "]->value)) \$_smarty_tpl->createLocalArrayVariable(" . $parameter['if condition']['var']['var'] . "$_nocache);\n";
+ $_output .= "if (\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var']['var'] . "]->value" . $parameter['if condition']['var']['smarty_internal_index'] . " = " . $parameter['if condition']['value'] . ") {?>";
} else {
- $_output = "<?php }else{ if (!isset(\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var'] . "])) \$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var'] . "] = new Smarty_Variable(null{$_nocache});";
- $_output .= "if (\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var'] . "]->value = " . $parameter['if condition']['value'] . "){?>";
+ $_output = "<?php } else { if (!isset(\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var'] . "])) \$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var'] . "] = new Smarty_Variable(null{$_nocache});";
+ $_output .= "if (\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var'] . "]->value = " . $parameter['if condition']['value'] . ") {?>";
}
+
return $_output;
} else {
$this->openTag($compiler, 'elseif', array($nesting, $compiler->tag_nocache));
- return "<?php }elseif({$parameter['if condition']}){?>";
+
+ return "<?php } elseif ({$parameter['if condition']}) {?>";
}
} else {
$tmp = '';
- foreach ($compiler->prefix_code as $code)
- $tmp .= $code;
+ foreach ($compiler->prefix_code as $code) {
+ $tmp .= $code;
+ }
$compiler->prefix_code = array();
$this->openTag($compiler, 'elseif', array($nesting + 1, $compiler->tag_nocache));
if ($condition_by_assign) {
if (is_array($parameter['if condition']['var'])) {
- $_output = "<?php }else{?>{$tmp}<?php if (!isset(\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var']['var'] . "]) || !is_array(\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var']['var'] . "]->value)) \$_smarty_tpl->createLocalArrayVariable(" . $parameter['if condition']['var']['var'] . "$_nocache);\n";
- $_output .= "if (\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var']['var'] . "]->value" . $parameter['if condition']['var']['smarty_internal_index'] . " = " . $parameter['if condition']['value'] . "){?>";
+ $_output = "<?php } else {?>{$tmp}<?php if (!isset(\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var']['var'] . "]) || !is_array(\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var']['var'] . "]->value)) \$_smarty_tpl->createLocalArrayVariable(" . $parameter['if condition']['var']['var'] . "$_nocache);\n";
+ $_output .= "if (\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var']['var'] . "]->value" . $parameter['if condition']['var']['smarty_internal_index'] . " = " . $parameter['if condition']['value'] . ") {?>";
} else {
- $_output = "<?php }else{?>{$tmp}<?php if (!isset(\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var'] . "])) \$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var'] . "] = new Smarty_Variable(null{$_nocache});";
- $_output .= "if (\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var'] . "]->value = " . $parameter['if condition']['value'] . "){?>";
+ $_output = "<?php } else {?>{$tmp}<?php if (!isset(\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var'] . "])) \$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var'] . "] = new Smarty_Variable(null{$_nocache});";
+ $_output .= "if (\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var'] . "]->value = " . $parameter['if condition']['value'] . ") {?>";
}
+
return $_output;
} else {
- return "<?php }else{?>{$tmp}<?php if ({$parameter['if condition']}){?>";
+ return "<?php } else {?>{$tmp}<?php if ({$parameter['if condition']}) {?>";
}
}
}
-
}
/**
-* Smarty Internal Plugin Compile Ifclose Class
-*
-* @package Smarty
-* @subpackage Compiler
-*/
-class Smarty_Internal_Compile_Ifclose extends Smarty_Internal_CompileBase {
-
+ * Smarty Internal Plugin Compile Ifclose Class
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ */
+class Smarty_Internal_Compile_Ifclose extends Smarty_Internal_CompileBase
+{
/**
- * Compiles code for the {/if} tag
- *
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
- * @param array $parameter array with compilation parameter
- * @return string compiled code
- */
+ * Compiles code for the {/if} tag
+ *
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ * @param array $parameter array with compilation parameter
+ *
+ * @return string compiled code
+ */
public function compile($args, $compiler, $parameter)
{
// must endblock be nocache?
}
list($nesting, $compiler->nocache) = $this->closeTag($compiler, array('if', 'else', 'elseif'));
$tmp = '';
- for ($i = 0; $i < $nesting; $i++) {
+ for ($i = 0; $i < $nesting; $i ++) {
$tmp .= '}';
}
+
return "<?php {$tmp}?>";
}
-
}
-
-?>
\ No newline at end of file
<?php
/**
-* Smarty Internal Plugin Compile Include
-*
-* Compiles the {include} tag
-*
-* @package Smarty
-* @subpackage Compiler
-* @author Uwe Tews
-*/
+ * Smarty Internal Plugin Compile Include
+ * Compiles the {include} tag
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @author Uwe Tews
+ */
/**
-* Smarty Internal Plugin Compile Include Class
-*
-* @package Smarty
-* @subpackage Compiler
-*/
-class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase {
-
+ * Smarty Internal Plugin Compile Include Class
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ */
+class Smarty_Internal_Compile_Include extends Smarty_Internal_CompileBase
+{
/**
- * caching mode to create nocache code but no cache file
- */
+ * caching mode to create nocache code but no cache file
+ */
const CACHING_NOCACHE_CODE = 9999;
/**
- * Attribute definition: Overwrites base class.
- *
- * @var array
- * @see Smarty_Internal_CompileBase
- */
+ * Attribute definition: Overwrites base class.
+ *
+ * @var array
+ * @see Smarty_Internal_CompileBase
+ */
public $required_attributes = array('file');
/**
- * Attribute definition: Overwrites base class.
- *
- * @var array
- * @see Smarty_Internal_CompileBase
- */
+ * Attribute definition: Overwrites base class.
+ *
+ * @var array
+ * @see Smarty_Internal_CompileBase
+ */
public $shorttag_order = array('file');
/**
- * Attribute definition: Overwrites base class.
- *
- * @var array
- * @see Smarty_Internal_CompileBase
- */
+ * Attribute definition: Overwrites base class.
+ *
+ * @var array
+ * @see Smarty_Internal_CompileBase
+ */
public $option_flags = array('nocache', 'inline', 'caching');
/**
- * Attribute definition: Overwrites base class.
- *
- * @var array
- * @see Smarty_Internal_CompileBase
- */
+ * Attribute definition: Overwrites base class.
+ *
+ * @var array
+ * @see Smarty_Internal_CompileBase
+ */
public $optional_attributes = array('_any');
/**
- * Compiles code for the {include} tag
- *
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
- * @param array $parameter array with compilation parameter
+ * Compiles code for the {include} tag
+ *
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ * @param array $parameter array with compilation parameter
+ *
* @return string compiled code
*/
public function compile($args, $compiler, $parameter)
{
// check and get attributes
$_attr = $this->getAttributes($compiler, $args);
- // save posible attributes
+ // save possible attributes
$include_file = $_attr['file'];
if (isset($_attr['assign'])) {
- // output will be stored in a smarty variable instead of beind displayed
+ // output will be stored in a smarty variable instead of being displayed
$_assign = $_attr['assign'];
}
$_parent_scope = Smarty::SCOPE_GLOBAL;
}
}
- $_caching = 'null';
- if ($compiler->nocache || $compiler->tag_nocache) {
- $_caching = Smarty::CACHING_OFF;
- }
- // default for included templates
- if ($compiler->template->caching && !$compiler->nocache && !$compiler->tag_nocache) {
+
+ $_caching = Smarty::CACHING_OFF;
+
+ // flag if included template code should be merged into caller
+ $merge_compiled_includes = ($compiler->smarty->merge_compiled_includes || ($compiler->inheritance && $compiler->smarty->inheritance_merge_compiled_includes) || $_attr['inline'] === true) && !$compiler->template->source->recompiled;
+
+ // set default when in nocache mode
+ // if ($compiler->template->caching && ($compiler->nocache || $compiler->tag_nocache || $compiler->forceNocache == 2)) {
+ if ($compiler->template->caching && ((!$compiler->inheritance && !$compiler->nocache && !$compiler->tag_nocache) || ($compiler->inheritance && ($compiler->nocache || $compiler->tag_nocache)))) {
$_caching = self::CACHING_NOCACHE_CODE;
}
/*
}
if ($_attr['nocache'] === true) {
$compiler->tag_nocache = true;
- $_caching = Smarty::CACHING_OFF;
+ if ($merge_compiled_includes) {
+ $_caching = self::CACHING_NOCACHE_CODE;
+ } else {
+ $_caching = Smarty::CACHING_OFF;
+ }
}
$has_compiled_template = false;
- if (($compiler->smarty->merge_compiled_includes || $_attr['inline'] === true) && !$compiler->template->source->recompiled
- && !($compiler->template->caching && ($compiler->tag_nocache || $compiler->nocache)) && $_caching != Smarty::CACHING_LIFETIME_CURRENT) {
- // check if compiled code can be merged (contains no variable part)
- if (!$compiler->has_variable_string && (substr_count($include_file, '"') == 2 or substr_count($include_file, "'") == 2)
- and substr_count($include_file, '(') == 0 and substr_count($include_file, '$_smarty_tpl->') == 0) {
- $tpl_name = null;
- eval("\$tpl_name = $include_file;");
- if (!isset($compiler->smarty->merged_templates_func[$tpl_name]) || $compiler->inheritance) {
- $tpl = new $compiler->smarty->template_class ($tpl_name, $compiler->smarty, $compiler->template, $compiler->template->cache_id, $compiler->template->compile_id);
- // save unique function name
- $compiler->smarty->merged_templates_func[$tpl_name]['func'] = $tpl->properties['unifunc'] = 'content_'. str_replace('.', '_', uniqid('', true));
- // use current nocache hash for inlined code
- $compiler->smarty->merged_templates_func[$tpl_name]['nocache_hash'] = $tpl->properties['nocache_hash'] = $compiler->template->properties['nocache_hash'];
- if ($compiler->template->caching) {
- // needs code for cached page but no cache file
- $tpl->caching = self::CACHING_NOCACHE_CODE;
+ if ($merge_compiled_includes && $_attr['inline'] !== true) {
+ // variable template name ?
+ if ($compiler->has_variable_string || !((substr_count($include_file, '"') == 2 || substr_count($include_file, "'") == 2))
+ || substr_count($include_file, '(') != 0 || substr_count($include_file, '$_smarty_tpl->') != 0
+ ) {
+ $merge_compiled_includes = false;
+ if ($compiler->inheritance && $compiler->smarty->inheritance_merge_compiled_includes) {
+ $compiler->trigger_template_error(' variable template file names not allow within {block} tags');
+ }
+ }
+ // variable compile_id?
+ if (isset($_attr['compile_id'])) {
+ if (!((substr_count($_attr['compile_id'], '"') == 2 || substr_count($_attr['compile_id'], "'") == 2))
+ || substr_count($_attr['compile_id'], '(') != 0 || substr_count($_attr['compile_id'], '$_smarty_tpl->') != 0
+ ) {
+ $merge_compiled_includes = false;
+ if ($compiler->inheritance && $compiler->smarty->inheritance_merge_compiled_includes) {
+ $compiler->trigger_template_error(' variable compile_id not allow within {block} tags');
}
- // make sure whole chain gest compiled
- $tpl->mustCompile = true;
- if (!($tpl->source->uncompiled) && $tpl->source->exists) {
- // get compiled code
- $compiled_code = $tpl->compiler->compileTemplate($tpl);
- // release compiler object to free memory
- unset($tpl->compiler);
- // merge compiled code for {function} tags
- $compiler->template->properties['function'] = array_merge($compiler->template->properties['function'], $tpl->properties['function']);
- // merge filedependency
- $tpl->properties['file_dependency'][$tpl->source->uid] = array($tpl->source->filepath, $tpl->source->timestamp,$tpl->source->type);
- $compiler->template->properties['file_dependency'] = array_merge($compiler->template->properties['file_dependency'], $tpl->properties['file_dependency']);
- // remove header code
- $compiled_code = preg_replace("/(<\?php \/\*%%SmartyHeaderCode:{$tpl->properties['nocache_hash']}%%\*\/(.+?)\/\*\/%%SmartyHeaderCode%%\*\/\?>\n)/s", '', $compiled_code);
- if ($tpl->has_nocache_code) {
- // replace nocache_hash
- $compiled_code = str_replace("{$tpl->properties['nocache_hash']}", $compiler->template->properties['nocache_hash'], $compiled_code);
- $compiler->template->has_nocache_code = true;
- }
- $compiler->merged_templates[$tpl->properties['unifunc']] = $compiled_code;
- $has_compiled_template = true;
+ }
+ }
+ }
+ if ($merge_compiled_includes) {
+ if ($compiler->template->caching && ($compiler->tag_nocache || $compiler->nocache) && $_caching != self::CACHING_NOCACHE_CODE) {
+ $merge_compiled_includes = false;
+ if ($compiler->inheritance && $compiler->smarty->inheritance_merge_compiled_includes) {
+ $compiler->trigger_template_error(' invalid caching mode of subtemplate within {block} tags');
+ }
+ }
+ }
+ if ($merge_compiled_includes) {
+ // we must observe different compile_id
+ $uid = sha1($_compile_id);
+ $tpl_name = null;
+ $nocache = false;
+ /** @var Smarty_Internal_Template $_smarty_tpl
+ * used in evaluated code
+ */
+ $_smarty_tpl = $compiler->template;
+ eval("\$tpl_name = $include_file;");
+ if (!isset($compiler->smarty->merged_templates_func[$tpl_name][$uid])) {
+ $tpl = new $compiler->smarty->template_class ($tpl_name, $compiler->smarty, $compiler->template, $compiler->template->cache_id, $compiler->template->compile_id);
+ // save unique function name
+ $compiler->smarty->merged_templates_func[$tpl_name][$uid]['func'] = $tpl->properties['unifunc'] = 'content_' . str_replace(array('.', ','), '_', uniqid('', true));
+ // use current nocache hash for inlined code
+ $compiler->smarty->merged_templates_func[$tpl_name][$uid]['nocache_hash'] = $tpl->properties['nocache_hash'] = $compiler->template->properties['nocache_hash'];
+ if ($compiler->template->caching && $_caching == self::CACHING_NOCACHE_CODE) {
+ // all code must be nocache
+ $nocache = true;
+ }
+ if ($compiler->inheritance) {
+ $tpl->compiler->inheritance = true;
+ }
+ // make sure whole chain gets compiled
+ $tpl->mustCompile = true;
+ if (!($tpl->source->uncompiled) && $tpl->source->exists) {
+
+ // get compiled code
+ $compiled_code = $tpl->compiler->compileTemplate($tpl, $nocache);
+ // release compiler object to free memory
+ unset($tpl->compiler);
+ // merge compiled code for {function} tags
+ $compiler->template->properties['function'] = array_merge($compiler->template->properties['function'], $tpl->properties['function']);
+ // merge filedependency
+ $tpl->properties['file_dependency'][$tpl->source->uid] = array($tpl->source->filepath, $tpl->source->timestamp, $tpl->source->type);
+ $compiler->template->properties['file_dependency'] = array_merge($compiler->template->properties['file_dependency'], $tpl->properties['file_dependency']);
+ // remove header code
+ $compiled_code = preg_replace("/(<\?php \/\*%%SmartyHeaderCode:{$tpl->properties['nocache_hash']}%%\*\/(.+?)\/\*\/%%SmartyHeaderCode%%\*\/\?>\n)/s", '', $compiled_code);
+ if ($tpl->has_nocache_code) {
+ // replace nocache_hash
+ $compiled_code = str_replace("{$tpl->properties['nocache_hash']}", $compiler->template->properties['nocache_hash'], $compiled_code);
+ $compiler->template->has_nocache_code = true;
}
- } else {
+ $compiler->merged_templates[$tpl->properties['unifunc']] = $compiled_code;
$has_compiled_template = true;
+ unset ($tpl);
}
+ } else {
+ $has_compiled_template = true;
}
}
// delete {include} standard attributes
if (!empty($_attr)) {
if ($_parent_scope == Smarty::SCOPE_LOCAL) {
// create variables
+ $nccode = '';
foreach ($_attr as $key => $value) {
$_pairs[] = "'$key'=>$value";
+ $nccode .= "\$_smarty_tpl->tpl_vars['$key'] = new Smarty_variable($value);\n";
}
- $_vars = 'array('.join(',',$_pairs).')';
- $_has_vars = true;
+ $_vars = 'array(' . join(',', $_pairs) . ')';
} else {
$compiler->trigger_template_error('variable passing not allowed in parent/global scope', $compiler->lex->taglineno);
}
} else {
$_vars = 'array()';
- $_has_vars = false;
}
if ($has_compiled_template) {
- $_hash = $compiler->smarty->merged_templates_func[$tpl_name]['nocache_hash'];
+ // never call inline templates in nocache mode
+ $compiler->suppressNocacheProcessing = true;
+ $_hash = $compiler->smarty->merged_templates_func[$tpl_name][$uid]['nocache_hash'];
$_output = "<?php /* Call merged included template \"" . $tpl_name . "\" */\n";
$_output .= "\$_tpl_stack[] = \$_smarty_tpl;\n";
+ if (!empty($nccode) && $_caching == 9999 && $_smarty_tpl->caching) {
+ $compiler->suppressNocacheProcessing = false;
+ $_output .= substr($compiler->processNocacheCode('<?php ' .$nccode . "?>\n", true), 6, -3);
+ $compiler->suppressNocacheProcessing = true;
+ }
$_output .= " \$_smarty_tpl = \$_smarty_tpl->setupInlineSubTemplate($include_file, $_cache_id, $_compile_id, $_caching, $_cache_lifetime, $_vars, $_parent_scope, '$_hash');\n";
if (isset($_assign)) {
$_output .= 'ob_start(); ';
}
- $_output .= $compiler->smarty->merged_templates_func[$tpl_name]['func']. "(\$_smarty_tpl);\n";
+ $_output .= $compiler->smarty->merged_templates_func[$tpl_name][$uid]['func'] . "(\$_smarty_tpl);\n";
$_output .= "\$_smarty_tpl = array_pop(\$_tpl_stack); ";
if (isset($_assign)) {
$_output .= " \$_smarty_tpl->tpl_vars[$_assign] = new Smarty_variable(ob_get_clean());";
}
- $_output .= "/* End of included template \"" . $tpl_name . "\" */?>";
+ $_output .= "\n/* End of included template \"" . $tpl_name . "\" */?>";
+
return $_output;
}
} else {
$_output = "<?php echo \$_smarty_tpl->getSubTemplate ($include_file, $_cache_id, $_compile_id, $_caching, $_cache_lifetime, $_vars, $_parent_scope);?>\n";
}
+
return $_output;
}
-
}
-
-?>
\ No newline at end of file
<?php
/**
* Smarty Internal Plugin Compile Include PHP
- *
* Compiles the {include_php} tag
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
- * @author Uwe Tews
+ * @author Uwe Tews
*/
/**
* Smarty Internal Plugin Compile Insert Class
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
*/
-class Smarty_Internal_Compile_Include_Php extends Smarty_Internal_CompileBase {
-
+class Smarty_Internal_Compile_Include_Php extends Smarty_Internal_CompileBase
+{
/**
* Attribute definition: Overwrites base class.
*
/**
* Compiles code for the {include_php} tag
*
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ *
+ * @throws SmartyException
* @return string compiled code
*/
public function compile($args, $compiler)
// check and get attributes
$_attr = $this->getAttributes($compiler, $args);
- $_output = '<?php ';
-
+ /** @var Smarty_Internal_Template $_smarty_tpl
+ * used in evaluated code
+ */
$_smarty_tpl = $compiler->template;
$_filepath = false;
eval('$_file = ' . $_attr['file'] . ';');
$_dir = $compiler->smarty->trusted_dir;
}
if (!empty($_dir)) {
- foreach((array)$_dir as $_script_dir) {
+ foreach ((array) $_dir as $_script_dir) {
$_script_dir = rtrim($_script_dir, '/\\') . DS;
if (file_exists($_script_dir . $_file)) {
- $_filepath = $_script_dir . $_file;
+ $_filepath = $_script_dir . $_file;
break;
}
}
return "<?php include{$_once} ('{$_filepath}');?>\n";
}
}
-
}
-
-?>
\ No newline at end of file
/**
* Smarty Internal Plugin Compile Insert
- *
* Compiles the {insert} tag
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
- * @author Uwe Tews
+ * @author Uwe Tews
*/
/**
* Smarty Internal Plugin Compile Insert Class
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
*/
-class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase {
-
+class Smarty_Internal_Compile_Insert extends Smarty_Internal_CompileBase
+{
/**
* Attribute definition: Overwrites base class.
*
/**
* Compiles code for the {insert} tag
*
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ *
* @return string compiled code
*/
public function compile($args, $compiler)
$_script = null;
$_output = '<?php ';
- // save posible attributes
+ // save possible attributes
eval('$_name = ' . $_attr['name'] . ';');
if (isset($_attr['assign'])) {
// output will be stored in a smarty variable instead of being displayed
$_assign = $_attr['assign'];
- // create variable to make shure that the compiler knows about its nocache status
+ // create variable to make sure that the compiler knows about its nocache status
$compiler->template->tpl_vars[trim($_attr['assign'], "'")] = new Smarty_Variable(null, true);
}
if (isset($_attr['script'])) {
$_dir = $compiler->smarty->trusted_dir;
}
if (!empty($_dir)) {
- foreach((array)$_dir as $_script_dir) {
+ foreach ((array) $_dir as $_script_dir) {
$_script_dir = rtrim($_script_dir, '/\\') . DS;
if (file_exists($_script_dir . $_script)) {
$_filepath = $_script_dir . $_script;
$_output .= "echo {$_function}({$_params},\$_smarty_tpl);?>";
}
}
+
return $_output;
}
-
}
-
-?>
\ No newline at end of file
<?php
/**
* Smarty Internal Plugin Compile Ldelim
- *
* Compiles the {ldelim} tag
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
- * @author Uwe Tews
+ * @author Uwe Tews
*/
/**
* Smarty Internal Plugin Compile Ldelim Class
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
*/
-class Smarty_Internal_Compile_Ldelim extends Smarty_Internal_CompileBase {
-
+class Smarty_Internal_Compile_Ldelim extends Smarty_Internal_CompileBase
+{
/**
* Compiles code for the {ldelim} tag
- *
* This tag does output the left delimiter
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
+ *
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ *
* @return string compiled code
*/
public function compile($args, $compiler)
}
// this tag does not return compiled code
$compiler->has_code = true;
+
return $compiler->smarty->left_delimiter;
}
-
}
-
-?>
<?php
/**
* Smarty Internal Plugin Compile Nocache
- *
* Compiles the {nocache} {/nocache} tags.
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
- * @author Uwe Tews
+ * @author Uwe Tews
*/
/**
- * Smarty Internal Plugin Compile Nocache Classv
+ * Smarty Internal Plugin Compile Nocache Class
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
*/
-class Smarty_Internal_Compile_Nocache extends Smarty_Internal_CompileBase {
-
+class Smarty_Internal_Compile_Nocache extends Smarty_Internal_CompileBase
+{
/**
* Compiles code for the {nocache} tag
- *
* This tag does not generate compiled output. It only sets a compiler flag.
*
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ *
* @return bool
*/
public function compile($args, $compiler)
$compiler->nocache = true;
// this tag does not return compiled code
$compiler->has_code = false;
+
return true;
}
-
}
/**
* Smarty Internal Plugin Compile Nocacheclose Class
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
*/
-class Smarty_Internal_Compile_Nocacheclose extends Smarty_Internal_CompileBase {
-
+class Smarty_Internal_Compile_Nocacheclose extends Smarty_Internal_CompileBase
+{
/**
* Compiles code for the {/nocache} tag
- *
* This tag does not generate compiled output. It only sets a compiler flag.
*
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ *
* @return bool
*/
public function compile($args, $compiler)
$compiler->nocache = false;
// this tag does not return compiled code
$compiler->has_code = false;
+
return true;
}
-
}
-
-?>
\ No newline at end of file
<?php
/**
* Smarty Internal Plugin Compile Block Plugin
- *
* Compiles code for the execution of block plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
- * @author Uwe Tews
+ * @author Uwe Tews
*/
/**
* Smarty Internal Plugin Compile Block Plugin Class
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
*/
-class Smarty_Internal_Compile_Private_Block_Plugin extends Smarty_Internal_CompileBase {
-
+class Smarty_Internal_Compile_Private_Block_Plugin extends Smarty_Internal_CompileBase
+{
/**
* Attribute definition: Overwrites base class.
*
/**
* Compiles code for the execution of block plugin
*
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
- * @param array $parameter array with compilation parameter
- * @param string $tag name of block plugin
- * @param string $function PHP function name
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ * @param array $parameter array with compilation parameter
+ * @param string $tag name of block plugin
+ * @param string $function PHP function name
+ *
* @return string compiled code
*/
public function compile($args, $compiler, $parameter, $tag, $function)
{
- if (!isset($tag[5]) || substr($tag, -5) != 'close') {
+ if (!isset($tag[5]) || substr($tag, - 5) != 'close') {
// opening tag of block plugin
// check and get attributes
$_attr = $this->getAttributes($compiler, $args);
if ($_attr['nocache'] === true) {
$compiler->tag_nocache = true;
}
- unset($_attr['nocache']);
+ unset($_attr['nocache']);
// convert attributes into parameter array string
$_paramsArray = array();
foreach ($_attr as $_key => $_value) {
$compiler->tag_nocache = true;
}
// closing tag of block plugin, restore nocache
- list($_params, $compiler->nocache) = $this->closeTag($compiler, substr($tag, 0, -5));
+ list($_params, $compiler->nocache) = $this->closeTag($compiler, substr($tag, 0, - 5));
// This tag does create output
$compiler->has_output = true;
// compile code
if (!isset($parameter['modifier_list'])) {
- $mod_pre = $mod_post ='';
+ $mod_pre = $mod_post = '';
} else {
$mod_pre = ' ob_start(); ';
- $mod_post = 'echo '.$compiler->compileTag('private_modifier',array(),array('modifierlist'=>$parameter['modifier_list'],'value'=>'ob_get_clean()')).';';
+ $mod_post = 'echo ' . $compiler->compileTag('private_modifier', array(), array('modifierlist' => $parameter['modifier_list'], 'value' => 'ob_get_clean()')) . ';';
}
- $output = "<?php \$_block_content = ob_get_clean(); \$_block_repeat=false;".$mod_pre." echo {$function}({$_params}, \$_block_content, \$_smarty_tpl, \$_block_repeat); ".$mod_post." } array_pop(\$_smarty_tpl->smarty->_tag_stack);?>";
+ $output = "<?php \$_block_content = ob_get_clean(); \$_block_repeat=false;" . $mod_pre . " echo {$function}({$_params}, \$_block_content, \$_smarty_tpl, \$_block_repeat); " . $mod_post . " } array_pop(\$_smarty_tpl->smarty->_tag_stack);?>";
}
+
return $output . "\n";
}
-
}
-
-?>
\ No newline at end of file
<?php
/**
* Smarty Internal Plugin Compile Function Plugin
- *
* Compiles code for the execution of function plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
- * @author Uwe Tews
+ * @author Uwe Tews
*/
/**
* Smarty Internal Plugin Compile Function Plugin Class
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
*/
-class Smarty_Internal_Compile_Private_Function_Plugin extends Smarty_Internal_CompileBase {
-
+class Smarty_Internal_Compile_Private_Function_Plugin extends Smarty_Internal_CompileBase
+{
/**
* Attribute definition: Overwrites base class.
*
/**
* Compiles code for the execution of function plugin
*
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
- * @param array $parameter array with compilation parameter
- * @param string $tag name of function plugin
- * @param string $function PHP function name
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ * @param array $parameter array with compilation parameter
+ * @param string $tag name of function plugin
+ * @param string $function PHP function name
+ *
* @return string compiled code
*/
public function compile($args, $compiler, $parameter, $tag, $function)
$_params = 'array(' . implode(",", $_paramsArray) . ')';
// compile code
$output = "<?php echo {$function}({$_params},\$_smarty_tpl);?>\n";
+
return $output;
}
-
}
-
-?>
\ No newline at end of file
-<?php\r
-\r
-/**\r
- * Smarty Internal Plugin Compile Modifier\r
- *\r
- * Compiles code for modifier execution\r
- *\r
- * @package Smarty\r
- * @subpackage Compiler\r
- * @author Uwe Tews\r
- */\r
-\r
-/**\r
- * Smarty Internal Plugin Compile Modifier Class\r
- *\r
- * @package Smarty\r
- * @subpackage Compiler\r
- */\r
-class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBase {\r
-\r
- /**\r
- * Compiles code for modifier execution\r
- *\r
- * @param array $args array with attributes from parser\r
- * @param object $compiler compiler object\r
- * @param array $parameter array with compilation parameter\r
- * @return string compiled code\r
- */\r
- public function compile($args, $compiler, $parameter) {\r
- // check and get attributes\r
- $_attr = $this->getAttributes($compiler, $args);\r
- $output = $parameter['value'];\r
- // loop over list of modifiers\r
- foreach ($parameter['modifierlist'] as $single_modifier) {\r
- $modifier = $single_modifier[0];\r
- $single_modifier[0] = $output;\r
- $params = implode(',', $single_modifier);\r
- // check if we know already the type of modifier\r
- if (isset($compiler->known_modifier_type[$modifier])) {\r
- $modifier_types = array($compiler->known_modifier_type[$modifier]);\r
- } else {\r
- $modifier_types = array(1, 2, 3, 4, 5, 6);\r
- }\r
- foreach ($modifier_types as $type) {\r
- switch ($type) {\r
- case 1:\r
- // registered modifier\r
- if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][$modifier])) {\r
- $function = $compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][$modifier][0];\r
- if (!is_array($function)) {\r
- $output = "{$function}({$params})";\r
- } else {\r
- if (is_object($function[0])) {\r
- $output = '$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][\'' . $modifier . '\'][0][0]->' . $function[1] . '(' . $params . ')';\r
- } else {\r
- $output = $function[0] . '::' . $function[1] . '(' . $params . ')';\r
- }\r
- }\r
- $compiler->known_modifier_type[$modifier] = $type;\r
- break 2;\r
- }\r
- break;\r
- case 2:\r
- // registered modifier compiler\r
- if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIERCOMPILER][$modifier][0])) {\r
- $output = call_user_func($compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIERCOMPILER][$modifier][0], $single_modifier, $compiler->smarty);\r
- $compiler->known_modifier_type[$modifier] = $type;\r
- break 2;\r
- }\r
- break;\r
- case 3:\r
- // modifiercompiler plugin\r
- if ($compiler->smarty->loadPlugin('smarty_modifiercompiler_' . $modifier)) {\r
- // check if modifier allowed\r
- if (!is_object($compiler->smarty->security_policy) || $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)) {\r
- $plugin = 'smarty_modifiercompiler_' . $modifier;\r
- $output = $plugin($single_modifier, $compiler);\r
- }\r
- $compiler->known_modifier_type[$modifier] = $type;\r
- break 2;\r
- }\r
- break;\r
- case 4:\r
- // modifier plugin\r
- if ($function = $compiler->getPlugin($modifier, Smarty::PLUGIN_MODIFIER)) {\r
- // check if modifier allowed\r
- if (!is_object($compiler->smarty->security_policy) || $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)) {\r
- $output = "{$function}({$params})";\r
- }\r
- $compiler->known_modifier_type[$modifier] = $type;\r
- break 2;\r
- }\r
- break;\r
- case 5:\r
- // PHP function\r
- if (is_callable($modifier)) {\r
- // check if modifier allowed\r
- if (!is_object($compiler->smarty->security_policy) || $compiler->smarty->security_policy->isTrustedPhpModifier($modifier, $compiler)) {\r
- $output = "{$modifier}({$params})";\r
- }\r
- $compiler->known_modifier_type[$modifier] = $type;\r
- break 2;\r
- }\r
- break;\r
- case 6:\r
- // default plugin handler\r
- if (isset($compiler->default_handler_plugins[Smarty::PLUGIN_MODIFIER][$modifier]) || (is_callable($compiler->smarty->default_plugin_handler_func) && $compiler->getPluginFromDefaultHandler($modifier, Smarty::PLUGIN_MODIFIER))) {\r
- $function = $compiler->default_handler_plugins[Smarty::PLUGIN_MODIFIER][$modifier][0];\r
- // check if modifier allowed\r
- if (!is_object($compiler->smarty->security_policy) || $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)) {\r
- if (!is_array($function)) {\r
- $output = "{$function}({$params})";\r
- } else {\r
- if (is_object($function[0])) {\r
- $output = '$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][\'' . $modifier . '\'][0][0]->' . $function[1] . '(' . $params . ')';\r
- } else {\r
- $output = $function[0] . '::' . $function[1] . '(' . $params . ')';\r
- }\r
- }\r
- }\r
- if (isset($compiler->template->required_plugins['nocache'][$modifier][Smarty::PLUGIN_MODIFIER]['file']) || isset($compiler->template->required_plugins['compiled'][$modifier][Smarty::PLUGIN_MODIFIER]['file'])) {\r
- // was a plugin\r
- $compiler->known_modifier_type[$modifier] = 4;\r
- } else {\r
- $compiler->known_modifier_type[$modifier] = $type;\r
- }\r
- break 2;\r
- }\r
- }\r
- }\r
- if (!isset($compiler->known_modifier_type[$modifier])) {\r
- $compiler->trigger_template_error("unknown modifier \"" . $modifier . "\"", $compiler->lex->taglineno);\r
- }\r
- }\r
- return $output;\r
- }\r
-\r
-}\r
-\r
-?>
\ No newline at end of file
+<?php
+
+/**
+ * Smarty Internal Plugin Compile Modifier
+ * Compiles code for modifier execution
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @author Uwe Tews
+ */
+
+/**
+ * Smarty Internal Plugin Compile Modifier Class
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ */
+class Smarty_Internal_Compile_Private_Modifier extends Smarty_Internal_CompileBase
+{
+ /**
+ * Compiles code for modifier execution
+ *
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ * @param array $parameter array with compilation parameter
+ *
+ * @return string compiled code
+ */
+ public function compile($args, $compiler, $parameter)
+ {
+ // check and get attributes
+ $_attr = $this->getAttributes($compiler, $args);
+ $output = $parameter['value'];
+ // loop over list of modifiers
+ foreach ($parameter['modifierlist'] as $single_modifier) {
+ $modifier = $single_modifier[0];
+ $single_modifier[0] = $output;
+ $params = implode(',', $single_modifier);
+ // check if we know already the type of modifier
+ if (isset($compiler->known_modifier_type[$modifier])) {
+ $modifier_types = array($compiler->known_modifier_type[$modifier]);
+ } else {
+ $modifier_types = array(1, 2, 3, 4, 5, 6);
+ }
+ foreach ($modifier_types as $type) {
+ switch ($type) {
+ case 1:
+ // registered modifier
+ if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][$modifier])) {
+ $function = $compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][$modifier][0];
+ if (!is_array($function)) {
+ $output = "{$function}({$params})";
+ } else {
+ if (is_object($function[0])) {
+ $output = '$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][\'' . $modifier . '\'][0][0]->' . $function[1] . '(' . $params . ')';
+ } else {
+ $output = $function[0] . '::' . $function[1] . '(' . $params . ')';
+ }
+ }
+ $compiler->known_modifier_type[$modifier] = $type;
+ break 2;
+ }
+ break;
+ case 2:
+ // registered modifier compiler
+ if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIERCOMPILER][$modifier][0])) {
+ $output = call_user_func($compiler->smarty->registered_plugins[Smarty::PLUGIN_MODIFIERCOMPILER][$modifier][0], $single_modifier, $compiler->smarty);
+ $compiler->known_modifier_type[$modifier] = $type;
+ break 2;
+ }
+ break;
+ case 3:
+ // modifiercompiler plugin
+ if ($compiler->smarty->loadPlugin('smarty_modifiercompiler_' . $modifier)) {
+ // check if modifier allowed
+ if (!is_object($compiler->smarty->security_policy) || $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)) {
+ $plugin = 'smarty_modifiercompiler_' . $modifier;
+ $output = $plugin($single_modifier, $compiler);
+ }
+ $compiler->known_modifier_type[$modifier] = $type;
+ break 2;
+ }
+ break;
+ case 4:
+ // modifier plugin
+ if ($function = $compiler->getPlugin($modifier, Smarty::PLUGIN_MODIFIER)) {
+ // check if modifier allowed
+ if (!is_object($compiler->smarty->security_policy) || $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)) {
+ $output = "{$function}({$params})";
+ }
+ $compiler->known_modifier_type[$modifier] = $type;
+ break 2;
+ }
+ break;
+ case 5:
+ // PHP function
+ if (is_callable($modifier)) {
+ // check if modifier allowed
+ if (!is_object($compiler->smarty->security_policy) || $compiler->smarty->security_policy->isTrustedPhpModifier($modifier, $compiler)) {
+ $output = "{$modifier}({$params})";
+ }
+ $compiler->known_modifier_type[$modifier] = $type;
+ break 2;
+ }
+ break;
+ case 6:
+ // default plugin handler
+ if (isset($compiler->default_handler_plugins[Smarty::PLUGIN_MODIFIER][$modifier]) || (is_callable($compiler->smarty->default_plugin_handler_func) && $compiler->getPluginFromDefaultHandler($modifier, Smarty::PLUGIN_MODIFIER))) {
+ $function = $compiler->default_handler_plugins[Smarty::PLUGIN_MODIFIER][$modifier][0];
+ // check if modifier allowed
+ if (!is_object($compiler->smarty->security_policy) || $compiler->smarty->security_policy->isTrustedModifier($modifier, $compiler)) {
+ if (!is_array($function)) {
+ $output = "{$function}({$params})";
+ } else {
+ if (is_object($function[0])) {
+ $output = '$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_MODIFIER][\'' . $modifier . '\'][0][0]->' . $function[1] . '(' . $params . ')';
+ } else {
+ $output = $function[0] . '::' . $function[1] . '(' . $params . ')';
+ }
+ }
+ }
+ if (isset($compiler->template->required_plugins['nocache'][$modifier][Smarty::PLUGIN_MODIFIER]['file']) || isset($compiler->template->required_plugins['compiled'][$modifier][Smarty::PLUGIN_MODIFIER]['file'])) {
+ // was a plugin
+ $compiler->known_modifier_type[$modifier] = 4;
+ } else {
+ $compiler->known_modifier_type[$modifier] = $type;
+ }
+ break 2;
+ }
+ }
+ }
+ if (!isset($compiler->known_modifier_type[$modifier])) {
+ $compiler->trigger_template_error("unknown modifier \"" . $modifier . "\"", $compiler->lex->taglineno);
+ }
+ }
+
+ return $output;
+ }
+}
<?php
/**
* Smarty Internal Plugin Compile Object Block Function
- *
* Compiles code for registered objects as block function
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
- * @author Uwe Tews
+ * @author Uwe Tews
*/
/**
* Smarty Internal Plugin Compile Object Block Function Class
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
*/
-class Smarty_Internal_Compile_Private_Object_Block_Function extends Smarty_Internal_CompileBase {
-
+class Smarty_Internal_Compile_Private_Object_Block_Function extends Smarty_Internal_CompileBase
+{
/**
* Attribute definition: Overwrites base class.
*
/**
* Compiles code for the execution of block plugin
*
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
- * @param array $parameter array with compilation parameter
- * @param string $tag name of block object
- * @param string $method name of method to call
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ * @param array $parameter array with compilation parameter
+ * @param string $tag name of block object
+ * @param string $method name of method to call
+ *
* @return string compiled code
*/
public function compile($args, $compiler, $parameter, $tag, $method)
{
- if (!isset($tag[5]) || substr($tag, -5) != 'close') {
+ if (!isset($tag[5]) || substr($tag, - 5) != 'close') {
// opening tag of block plugin
// check and get attributes
$_attr = $this->getAttributes($compiler, $args);
// compile code
$output = "<?php \$_smarty_tpl->smarty->_tag_stack[] = array('{$tag}->{$method}', {$_params}); \$_block_repeat=true; echo \$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params}, null, \$_smarty_tpl, \$_block_repeat);while (\$_block_repeat) { ob_start();?>";
} else {
- $base_tag = substr($tag, 0, -5);
+ $base_tag = substr($tag, 0, - 5);
// must endblock be nocache?
if ($compiler->nocache) {
$compiler->tag_nocache = true;
}
$output = "<?php \$_block_content = ob_get_contents(); ob_end_clean(); \$_block_repeat=false;" . $mod_pre . " echo \$_smarty_tpl->smarty->registered_objects['{$base_tag}'][0]->{$method}({$_params}, \$_block_content, \$_smarty_tpl, \$_block_repeat); " . $mod_post . " } array_pop(\$_smarty_tpl->smarty->_tag_stack);?>";
}
+
return $output . "\n";
}
-
}
-
-?>
\ No newline at end of file
<?php
/**
- * Smarty Internal Plugin Compile Object Funtion
- *
+ * Smarty Internal Plugin Compile Object Function
* Compiles code for registered objects as function
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
- * @author Uwe Tews
+ * @author Uwe Tews
*/
/**
* Smarty Internal Plugin Compile Object Function Class
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
*/
-class Smarty_Internal_Compile_Private_Object_Function extends Smarty_Internal_CompileBase {
-
+class Smarty_Internal_Compile_Private_Object_Function extends Smarty_Internal_CompileBase
+{
/**
* Attribute definition: Overwrites base class.
*
/**
* Compiles code for the execution of function plugin
*
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
- * @param array $parameter array with compilation parameter
- * @param string $tag name of function
- * @param string $method name of method to call
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ * @param array $parameter array with compilation parameter
+ * @param string $tag name of function
+ * @param string $method name of method to call
+ *
* @return string compiled code
*/
public function compile($args, $compiler, $parameter, $tag, $method)
$_assign = $_attr['assign'];
unset($_attr['assign']);
}
- // convert attributes into parameter array string
- if ($compiler->smarty->registered_objects[$tag][2]) {
- $_paramsArray = array();
- foreach ($_attr as $_key => $_value) {
- if (is_int($_key)) {
- $_paramsArray[] = "$_key=>$_value";
- } else {
- $_paramsArray[] = "'$_key'=>$_value";
+ // method or property ?
+ if (method_exists($compiler->smarty->registered_objects[$tag][0], $method)) {
+ // convert attributes into parameter array string
+ if ($compiler->smarty->registered_objects[$tag][2]) {
+ $_paramsArray = array();
+ foreach ($_attr as $_key => $_value) {
+ if (is_int($_key)) {
+ $_paramsArray[] = "$_key=>$_value";
+ } else {
+ $_paramsArray[] = "'$_key'=>$_value";
+ }
}
+ $_params = 'array(' . implode(",", $_paramsArray) . ')';
+ $return = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params},\$_smarty_tpl)";
+ } else {
+ $_params = implode(",", $_attr);
+ $return = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params})";
}
- $_params = 'array(' . implode(",", $_paramsArray) . ')';
- $return = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params},\$_smarty_tpl)";
} else {
- $_params = implode(",", $_attr);
- $return = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}({$_params})";
+ // object property
+ $return = "\$_smarty_tpl->smarty->registered_objects['{$tag}'][0]->{$method}";
}
+
if (empty($_assign)) {
// This tag does create output
$compiler->has_output = true;
} else {
$output = "<?php \$_smarty_tpl->assign({$_assign},{$return});?>\n";
}
+
return $output;
}
-
}
-
-?>
\ No newline at end of file
<?php
/**
-* Smarty Internal Plugin Compile Print Expression
-*
-* Compiles any tag which will output an expression or variable
-*
-* @package Smarty
-* @subpackage Compiler
-* @author Uwe Tews
-*/
+ * Smarty Internal Plugin Compile Print Expression
+ * Compiles any tag which will output an expression or variable
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @author Uwe Tews
+ */
/**
-* Smarty Internal Plugin Compile Print Expression Class
-*
-* @package Smarty
-* @subpackage Compiler
-*/
-class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_CompileBase {
-
+ * Smarty Internal Plugin Compile Print Expression Class
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ */
+class Smarty_Internal_Compile_Private_Print_Expression extends Smarty_Internal_CompileBase
+{
/**
- * Attribute definition: Overwrites base class.
- *
- * @var array
- * @see Smarty_Internal_CompileBase
- */
+ * Attribute definition: Overwrites base class.
+ *
+ * @var array
+ * @see Smarty_Internal_CompileBase
+ */
public $optional_attributes = array('assign');
/**
- * Attribute definition: Overwrites base class.
- *
- * @var array
- * @see Smarty_Internal_CompileBase
- */
+ * Attribute definition: Overwrites base class.
+ *
+ * @var array
+ * @see Smarty_Internal_CompileBase
+ */
public $option_flags = array('nocache', 'nofilter');
/**
- * Compiles code for gererting output from any expression
- *
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
- * @param array $parameter array with compilation parameter
- * @return string compiled code
- */
+ * Compiles code for generating output from any expression
+ *
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ * @param array $parameter array with compilation parameter
+ *
+ * @throws SmartyException
+ * @return string compiled code
+ */
public function compile($args, $compiler, $parameter)
{
// check and get attributes
if ($_attr['nocache'] === true) {
$compiler->tag_nocache = true;
}
- // filter handling
- if ($_attr['nofilter'] === true) {
- $_filter = 'false';
- } else {
- $_filter = 'true';
- }
if (isset($_attr['assign'])) {
// assign output to variable
$output = "<?php \$_smarty_tpl->assign({$_attr['assign']},{$parameter['value']});?>";
$modifierlist = array();
foreach ($compiler->smarty->default_modifiers as $key => $single_default_modifier) {
preg_match_all('/(\'[^\'\\\\]*(?:\\\\.[^\'\\\\]*)*\'|"[^"\\\\]*(?:\\\\.[^"\\\\]*)*"|:|[^:]+)/', $single_default_modifier, $mod_array);
- for ($i = 0, $count = count($mod_array[0]);$i < $count;$i++) {
+ for ($i = 0, $count = count($mod_array[0]); $i < $count; $i ++) {
if ($mod_array[0][$i] != ':') {
$modifierlist[$key][] = $mod_array[0][$i];
}
}
}
- $compiler->default_modifier_list = $modifierlist;
+ $compiler->default_modifier_list = $modifierlist;
}
$output = $compiler->compileTag('private_modifier', array(), array('modifierlist' => $compiler->default_modifier_list, 'value' => $output));
}
if ($compiler->template->smarty->escape_html) {
$output = "htmlspecialchars({$output}, ENT_QUOTES, '" . addslashes(Smarty::$_CHARSET) . "')";
}
- // loop over registerd filters
+ // loop over registered filters
if (!empty($compiler->template->smarty->registered_filters[Smarty::FILTER_VARIABLE])) {
foreach ($compiler->template->smarty->registered_filters[Smarty::FILTER_VARIABLE] as $key => $function) {
if (!is_array($function)) {
$output = "{$function}({$output},\$_smarty_tpl)";
- } else if (is_object($function[0])) {
- $output = "\$_smarty_tpl->smarty->registered_filters[Smarty::FILTER_VARIABLE][{$key}][0]->{$function[1]}({$output},\$_smarty_tpl)";
+ } elseif (is_object($function[0])) {
+ $output = "\$_smarty_tpl->smarty->registered_filters[Smarty::FILTER_VARIABLE]['{$key}'][0]->{$function[1]}({$output},\$_smarty_tpl)";
} else {
$output = "{$function[0]}::{$function[1]}({$output},\$_smarty_tpl)";
}
}
// auto loaded filters
if (isset($compiler->smarty->autoload_filters[Smarty::FILTER_VARIABLE])) {
- foreach ((array)$compiler->template->smarty->autoload_filters[Smarty::FILTER_VARIABLE] as $name) {
+ foreach ((array) $compiler->template->smarty->autoload_filters[Smarty::FILTER_VARIABLE] as $name) {
$result = $this->compile_output_filter($compiler, $name, $output);
if ($result !== false) {
$output = $result;
$compiler->has_output = true;
$output = "<?php echo {$output};?>";
}
+
return $output;
}
/**
- * @param object $compiler compiler object
- * @param string $name name of variable filter
- * @param type $output embedded output
- * @return string
- */
+ * @param object $compiler compiler object
+ * @param string $name name of variable filter
+ * @param string $output embedded output
+ *
+ * @return string
+ */
private function compile_output_filter($compiler, $name, $output)
{
$plugin_name = "smarty_variablefilter_{$name}";
// not found
return false;
}
+
return "{$plugin_name}({$output},\$_smarty_tpl)";
}
-
}
-
-?>
\ No newline at end of file
-<?php\r
-/**\r
- * Smarty Internal Plugin Compile Registered Block\r
- *\r
- * Compiles code for the execution of a registered block function\r
- *\r
- * @package Smarty\r
- * @subpackage Compiler\r
- * @author Uwe Tews\r
- */\r
-\r
-/**\r
- * Smarty Internal Plugin Compile Registered Block Class\r
- *\r
- * @package Smarty\r
- * @subpackage Compiler\r
- */\r
-class Smarty_Internal_Compile_Private_Registered_Block extends Smarty_Internal_CompileBase {\r
-\r
- /**\r
- * Attribute definition: Overwrites base class.\r
- *\r
- * @var array\r
- * @see Smarty_Internal_CompileBase\r
- */\r
- public $optional_attributes = array('_any');\r
-\r
- /**\r
- * Compiles code for the execution of a block function\r
- *\r
- * @param array $args array with attributes from parser\r
- * @param object $compiler compiler object\r
- * @param array $parameter array with compilation parameter\r
- * @param string $tag name of block function\r
- * @return string compiled code\r
- */\r
- public function compile($args, $compiler, $parameter, $tag)\r
- {\r
- if (!isset($tag[5]) || substr($tag,-5) != 'close') {\r
- // opening tag of block plugin\r
- // check and get attributes\r
- $_attr = $this->getAttributes($compiler, $args);\r
- if ($_attr['nocache']) {\r
- $compiler->tag_nocache = true;\r
- }\r
- unset($_attr['nocache']);\r
- if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_BLOCK][$tag])) {\r
- $tag_info = $compiler->smarty->registered_plugins[Smarty::PLUGIN_BLOCK][$tag];\r
- } else {\r
- $tag_info = $compiler->default_handler_plugins[Smarty::PLUGIN_BLOCK][$tag];\r
- }\r
- // convert attributes into parameter array string\r
- $_paramsArray = array();\r
- foreach ($_attr as $_key => $_value) {\r
- if (is_int($_key)) {\r
- $_paramsArray[] = "$_key=>$_value";\r
- } elseif ($compiler->template->caching && in_array($_key,$tag_info[2])) {\r
- $_value = str_replace("'","^#^",$_value);\r
- $_paramsArray[] = "'$_key'=>^#^.var_export($_value,true).^#^";\r
- } else {\r
- $_paramsArray[] = "'$_key'=>$_value";\r
- }\r
- }\r
- $_params = 'array(' . implode(",", $_paramsArray) . ')';\r
-\r
- $this->openTag($compiler, $tag, array($_params, $compiler->nocache));\r
- // maybe nocache because of nocache variables or nocache plugin\r
- $compiler->nocache = !$tag_info[1] | $compiler->nocache | $compiler->tag_nocache;\r
- $function = $tag_info[0];\r
- // compile code\r
- if (!is_array($function)) {\r
- $output = "<?php \$_smarty_tpl->smarty->_tag_stack[] = array('{$tag}', {$_params}); \$_block_repeat=true; echo {$function}({$_params}, null, \$_smarty_tpl, \$_block_repeat);while (\$_block_repeat) { ob_start();?>";\r
- } else if (is_object($function[0])) {\r
- $output = "<?php \$_smarty_tpl->smarty->_tag_stack[] = array('{$tag}', {$_params}); \$_block_repeat=true; echo \$_smarty_tpl->smarty->registered_plugins['block']['{$tag}'][0][0]->{$function[1]}({$_params}, null, \$_smarty_tpl, \$_block_repeat);while (\$_block_repeat) { ob_start();?>";\r
- } else {\r
- $output = "<?php \$_smarty_tpl->smarty->_tag_stack[] = array('{$tag}', {$_params}); \$_block_repeat=true; echo {$function[0]}::{$function[1]}({$_params}, null, \$_smarty_tpl, \$_block_repeat);while (\$_block_repeat) { ob_start();?>";\r
- }\r
- } else {\r
- // must endblock be nocache?\r
- if ($compiler->nocache) {\r
- $compiler->tag_nocache = true;\r
- }\r
- $base_tag = substr($tag, 0, -5);\r
- // closing tag of block plugin, restore nocache\r
- list($_params, $compiler->nocache) = $this->closeTag($compiler, $base_tag);\r
- // This tag does create output\r
- $compiler->has_output = true;\r
- if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_BLOCK][$base_tag])) {\r
- $function = $compiler->smarty->registered_plugins[Smarty::PLUGIN_BLOCK][$base_tag][0];\r
- } else {\r
- $function = $compiler->default_handler_plugins[Smarty::PLUGIN_BLOCK][$base_tag][0];\r
- }\r
- // compile code\r
- if (!isset($parameter['modifier_list'])) {\r
- $mod_pre = $mod_post ='';\r
- } else {\r
- $mod_pre = ' ob_start(); ';\r
- $mod_post = 'echo '.$compiler->compileTag('private_modifier',array(),array('modifierlist'=>$parameter['modifier_list'],'value'=>'ob_get_clean()')).';';\r
- }\r
- if (!is_array($function)) {\r
- $output = "<?php \$_block_content = ob_get_clean(); \$_block_repeat=false;".$mod_pre." echo {$function}({$_params}, \$_block_content, \$_smarty_tpl, \$_block_repeat);".$mod_post." } array_pop(\$_smarty_tpl->smarty->_tag_stack);?>";\r
- } else if (is_object($function[0])) {\r
- $output = "<?php \$_block_content = ob_get_clean(); \$_block_repeat=false;".$mod_pre." echo \$_smarty_tpl->smarty->registered_plugins['block']['{$base_tag}'][0][0]->{$function[1]}({$_params}, \$_block_content, \$_smarty_tpl, \$_block_repeat); ".$mod_post."} array_pop(\$_smarty_tpl->smarty->_tag_stack);?>";\r
- } else {\r
- $output = "<?php \$_block_content = ob_get_clean(); \$_block_repeat=false;".$mod_pre." echo {$function[0]}::{$function[1]}({$_params}, \$_block_content, \$_smarty_tpl, \$_block_repeat); ".$mod_post."} array_pop(\$_smarty_tpl->smarty->_tag_stack);?>";\r
- }\r
- }\r
- return $output . "\n";\r
- }\r
-\r
-}\r
-\r
-?>
\ No newline at end of file
+<?php
+/**
+ * Smarty Internal Plugin Compile Registered Block
+ * Compiles code for the execution of a registered block function
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @author Uwe Tews
+ */
+
+/**
+ * Smarty Internal Plugin Compile Registered Block Class
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ */
+class Smarty_Internal_Compile_Private_Registered_Block extends Smarty_Internal_CompileBase
+{
+ /**
+ * Attribute definition: Overwrites base class.
+ *
+ * @var array
+ * @see Smarty_Internal_CompileBase
+ */
+ public $optional_attributes = array('_any');
+
+ /**
+ * Compiles code for the execution of a block function
+ *
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ * @param array $parameter array with compilation parameter
+ * @param string $tag name of block function
+ *
+ * @return string compiled code
+ */
+ public function compile($args, $compiler, $parameter, $tag)
+ {
+ if (!isset($tag[5]) || substr($tag, - 5) != 'close') {
+ // opening tag of block plugin
+ // check and get attributes
+ $_attr = $this->getAttributes($compiler, $args);
+ if ($_attr['nocache']) {
+ $compiler->tag_nocache = true;
+ }
+ unset($_attr['nocache']);
+ if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_BLOCK][$tag])) {
+ $tag_info = $compiler->smarty->registered_plugins[Smarty::PLUGIN_BLOCK][$tag];
+ } else {
+ $tag_info = $compiler->default_handler_plugins[Smarty::PLUGIN_BLOCK][$tag];
+ }
+ // convert attributes into parameter array string
+ $_paramsArray = array();
+ foreach ($_attr as $_key => $_value) {
+ if (is_int($_key)) {
+ $_paramsArray[] = "$_key=>$_value";
+ } elseif ($compiler->template->caching && in_array($_key, $tag_info[2])) {
+ $_value = str_replace("'", "^#^", $_value);
+ $_paramsArray[] = "'$_key'=>^#^.var_export($_value,true).^#^";
+ } else {
+ $_paramsArray[] = "'$_key'=>$_value";
+ }
+ }
+ $_params = 'array(' . implode(",", $_paramsArray) . ')';
+
+ $this->openTag($compiler, $tag, array($_params, $compiler->nocache));
+ // maybe nocache because of nocache variables or nocache plugin
+ $compiler->nocache = !$tag_info[1] | $compiler->nocache | $compiler->tag_nocache;
+ $function = $tag_info[0];
+ // compile code
+ if (!is_array($function)) {
+ $output = "<?php \$_smarty_tpl->smarty->_tag_stack[] = array('{$tag}', {$_params}); \$_block_repeat=true; echo {$function}({$_params}, null, \$_smarty_tpl, \$_block_repeat);while (\$_block_repeat) { ob_start();?>";
+ } elseif (is_object($function[0])) {
+ $output = "<?php \$_smarty_tpl->smarty->_tag_stack[] = array('{$tag}', {$_params}); \$_block_repeat=true; echo \$_smarty_tpl->smarty->registered_plugins['block']['{$tag}'][0][0]->{$function[1]}({$_params}, null, \$_smarty_tpl, \$_block_repeat);while (\$_block_repeat) { ob_start();?>";
+ } else {
+ $output = "<?php \$_smarty_tpl->smarty->_tag_stack[] = array('{$tag}', {$_params}); \$_block_repeat=true; echo {$function[0]}::{$function[1]}({$_params}, null, \$_smarty_tpl, \$_block_repeat);while (\$_block_repeat) { ob_start();?>";
+ }
+ } else {
+ // must endblock be nocache?
+ if ($compiler->nocache) {
+ $compiler->tag_nocache = true;
+ }
+ $base_tag = substr($tag, 0, - 5);
+ // closing tag of block plugin, restore nocache
+ list($_params, $compiler->nocache) = $this->closeTag($compiler, $base_tag);
+ // This tag does create output
+ $compiler->has_output = true;
+ if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_BLOCK][$base_tag])) {
+ $function = $compiler->smarty->registered_plugins[Smarty::PLUGIN_BLOCK][$base_tag][0];
+ } else {
+ $function = $compiler->default_handler_plugins[Smarty::PLUGIN_BLOCK][$base_tag][0];
+ }
+ // compile code
+ if (!isset($parameter['modifier_list'])) {
+ $mod_pre = $mod_post = '';
+ } else {
+ $mod_pre = ' ob_start(); ';
+ $mod_post = 'echo ' . $compiler->compileTag('private_modifier', array(), array('modifierlist' => $parameter['modifier_list'], 'value' => 'ob_get_clean()')) . ';';
+ }
+ if (!is_array($function)) {
+ $output = "<?php \$_block_content = ob_get_clean(); \$_block_repeat=false;" . $mod_pre . " echo {$function}({$_params}, \$_block_content, \$_smarty_tpl, \$_block_repeat);" . $mod_post . " } array_pop(\$_smarty_tpl->smarty->_tag_stack);?>";
+ } elseif (is_object($function[0])) {
+ $output = "<?php \$_block_content = ob_get_clean(); \$_block_repeat=false;" . $mod_pre . " echo \$_smarty_tpl->smarty->registered_plugins['block']['{$base_tag}'][0][0]->{$function[1]}({$_params}, \$_block_content, \$_smarty_tpl, \$_block_repeat); " . $mod_post . "} array_pop(\$_smarty_tpl->smarty->_tag_stack);?>";
+ } else {
+ $output = "<?php \$_block_content = ob_get_clean(); \$_block_repeat=false;" . $mod_pre . " echo {$function[0]}::{$function[1]}({$_params}, \$_block_content, \$_smarty_tpl, \$_block_repeat); " . $mod_post . "} array_pop(\$_smarty_tpl->smarty->_tag_stack);?>";
+ }
+ }
+
+ return $output . "\n";
+ }
+}
-<?php\r
-/**\r
- * Smarty Internal Plugin Compile Registered Function\r
- *\r
- * Compiles code for the execution of a registered function\r
- *\r
- * @package Smarty\r
- * @subpackage Compiler\r
- * @author Uwe Tews\r
- */\r
-\r
-/**\r
- * Smarty Internal Plugin Compile Registered Function Class\r
- *\r
- * @package Smarty\r
- * @subpackage Compiler\r
- */\r
-class Smarty_Internal_Compile_Private_Registered_Function extends Smarty_Internal_CompileBase {\r
-\r
- /**\r
- * Attribute definition: Overwrites base class.\r
- *\r
- * @var array\r
- * @see Smarty_Internal_CompileBase\r
- */\r
- public $optional_attributes = array('_any');\r
-\r
- /**\r
- * Compiles code for the execution of a registered function\r
- *\r
- * @param array $args array with attributes from parser\r
- * @param object $compiler compiler object\r
- * @param array $parameter array with compilation parameter\r
- * @param string $tag name of function\r
- * @return string compiled code\r
- */\r
- public function compile($args, $compiler, $parameter, $tag)\r
- {\r
- // This tag does create output\r
- $compiler->has_output = true;\r
- // check and get attributes\r
- $_attr = $this->getAttributes($compiler, $args);\r
- if ($_attr['nocache']) {\r
- $compiler->tag_nocache = true;\r
- }\r
- unset($_attr['nocache']);\r
- if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION][$tag])) {\r
- $tag_info = $compiler->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION][$tag];\r
- } else {\r
- $tag_info = $compiler->default_handler_plugins[Smarty::PLUGIN_FUNCTION][$tag];\r
- }\r
- // not cachable?\r
- $compiler->tag_nocache = $compiler->tag_nocache || !$tag_info[1];\r
- // convert attributes into parameter array string\r
- $_paramsArray = array();\r
- foreach ($_attr as $_key => $_value) {\r
- if (is_int($_key)) {\r
- $_paramsArray[] = "$_key=>$_value";\r
- } elseif ($compiler->template->caching && in_array($_key,$tag_info[2])) {\r
- $_value = str_replace("'","^#^",$_value);\r
- $_paramsArray[] = "'$_key'=>^#^.var_export($_value,true).^#^";\r
- } else {\r
- $_paramsArray[] = "'$_key'=>$_value";\r
- }\r
- }\r
- $_params = 'array(' . implode(",", $_paramsArray) . ')';\r
- $function = $tag_info[0];\r
- // compile code\r
- if (!is_array($function)) {\r
- $output = "<?php echo {$function}({$_params},\$_smarty_tpl);?>\n";\r
- } else if (is_object($function[0])) {\r
- $output = "<?php echo \$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['{$tag}'][0][0]->{$function[1]}({$_params},\$_smarty_tpl);?>\n";\r
- } else {\r
- $output = "<?php echo {$function[0]}::{$function[1]}({$_params},\$_smarty_tpl);?>\n";\r
- }\r
- return $output;\r
- }\r
-\r
-}\r
-\r
-?>
\ No newline at end of file
+<?php
+/**
+ * Smarty Internal Plugin Compile Registered Function
+ * Compiles code for the execution of a registered function
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @author Uwe Tews
+ */
+
+/**
+ * Smarty Internal Plugin Compile Registered Function Class
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ */
+class Smarty_Internal_Compile_Private_Registered_Function extends Smarty_Internal_CompileBase
+{
+ /**
+ * Attribute definition: Overwrites base class.
+ *
+ * @var array
+ * @see Smarty_Internal_CompileBase
+ */
+ public $optional_attributes = array('_any');
+
+ /**
+ * Compiles code for the execution of a registered function
+ *
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ * @param array $parameter array with compilation parameter
+ * @param string $tag name of function
+ *
+ * @return string compiled code
+ */
+ public function compile($args, $compiler, $parameter, $tag)
+ {
+ // This tag does create output
+ $compiler->has_output = true;
+ // check and get attributes
+ $_attr = $this->getAttributes($compiler, $args);
+ if ($_attr['nocache']) {
+ $compiler->tag_nocache = true;
+ }
+ unset($_attr['nocache']);
+ if (isset($compiler->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION][$tag])) {
+ $tag_info = $compiler->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION][$tag];
+ } else {
+ $tag_info = $compiler->default_handler_plugins[Smarty::PLUGIN_FUNCTION][$tag];
+ }
+ // not cachable?
+ $compiler->tag_nocache = $compiler->tag_nocache || !$tag_info[1];
+ // convert attributes into parameter array string
+ $_paramsArray = array();
+ foreach ($_attr as $_key => $_value) {
+ if (is_int($_key)) {
+ $_paramsArray[] = "$_key=>$_value";
+ } elseif ($compiler->template->caching && in_array($_key, $tag_info[2])) {
+ $_value = str_replace("'", "^#^", $_value);
+ $_paramsArray[] = "'$_key'=>^#^.var_export($_value,true).^#^";
+ } else {
+ $_paramsArray[] = "'$_key'=>$_value";
+ }
+ }
+ $_params = 'array(' . implode(",", $_paramsArray) . ')';
+ $function = $tag_info[0];
+ // compile code
+ if (!is_array($function)) {
+ $output = "<?php echo {$function}({$_params},\$_smarty_tpl);?>\n";
+ } elseif (is_object($function[0])) {
+ $output = "<?php echo \$_smarty_tpl->smarty->registered_plugins[Smarty::PLUGIN_FUNCTION]['{$tag}'][0][0]->{$function[1]}({$_params},\$_smarty_tpl);?>\n";
+ } else {
+ $output = "<?php echo {$function[0]}::{$function[1]}({$_params},\$_smarty_tpl);?>\n";
+ }
+
+ return $output;
+ }
+}
<?php
/**
* Smarty Internal Plugin Compile Special Smarty Variable
- *
* Compiles the special $smarty variables
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
- * @author Uwe Tews
+ * @author Uwe Tews
*/
/**
* Smarty Internal Plugin Compile special Smarty Variable Class
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
*/
-class Smarty_Internal_Compile_Private_Special_Variable extends Smarty_Internal_CompileBase {
-
+class Smarty_Internal_Compile_Private_Special_Variable extends Smarty_Internal_CompileBase
+{
/**
- * Compiles code for the speical $smarty variables
+ * Compiles code for the special $smarty variables
+ *
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ * @param $parameter
*
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
* @return string compiled code
*/
public function compile($args, $compiler, $parameter)
{
- $_index = preg_split("/\]\[/",substr($parameter, 1, strlen($parameter)-2));
+ $_index = preg_split("/\]\[/", substr($parameter, 1, strlen($parameter) - 2));
$compiled_ref = ' ';
$variable = trim($_index[0], "'");
switch ($variable) {
$compiler->trigger_template_error("(secure mode) super globals not permitted");
break;
}
- $compiled_ref = '$_'.strtoupper($variable);
+ $compiled_ref = '$_' . strtoupper($variable);
break;
case 'template':
case 'version':
$_version = Smarty::SMARTY_VERSION;
+
return "'$_version'";
case 'const':
$compiler->trigger_template_error("(secure mode) constants not permitted");
break;
}
- return '@' . trim($_index[1], "'");
+
+ return "@constant({$_index[1]})";
case 'config':
- return "\$_smarty_tpl->getConfigVariable($_index[1])";
+ if (isset($_index[2])) {
+ return "(is_array(\$tmp = \$_smarty_tpl->getConfigVariable($_index[1])) ? \$tmp[$_index[2]] : null)";
+ } else {
+ return "\$_smarty_tpl->getConfigVariable($_index[1])";
+ }
case 'ldelim':
$_ldelim = $compiler->smarty->left_delimiter;
+
return "'$_ldelim'";
case 'rdelim':
$_rdelim = $compiler->smarty->right_delimiter;
+
return "'$_rdelim'";
default:
$compiled_ref = $compiled_ref . "[$_ind]";
}
}
+
return $compiled_ref;
}
-
}
-
-?>
\ No newline at end of file
<?php
/**
* Smarty Internal Plugin Compile Rdelim
- *
* Compiles the {rdelim} tag
- * @package Smarty
+ *
+ * @package Smarty
* @subpackage Compiler
- * @author Uwe Tews
+ * @author Uwe Tews
*/
/**
* Smarty Internal Plugin Compile Rdelim Class
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
*/
-class Smarty_Internal_Compile_Rdelim extends Smarty_Internal_CompileBase {
-
+class Smarty_Internal_Compile_Rdelim extends Smarty_Internal_CompileBase
+{
/**
* Compiles code for the {rdelim} tag
- *
* This tag does output the right delimiter.
*
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ *
* @return string compiled code
*/
public function compile($args, $compiler)
}
// this tag does not return compiled code
$compiler->has_code = true;
+
return $compiler->smarty->right_delimiter;
}
-
}
-
-?>
\ No newline at end of file
<?php
/**
* Smarty Internal Plugin Compile Section
- *
* Compiles the {section} {sectionelse} {/section} tags
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
- * @author Uwe Tews
+ * @author Uwe Tews
*/
/**
* Smarty Internal Plugin Compile Section Class
- *
- * @package Smarty
+ *
+ * @package Smarty
* @subpackage Compiler
*/
-class Smarty_Internal_Compile_Section extends Smarty_Internal_CompileBase {
-
+class Smarty_Internal_Compile_Section extends Smarty_Internal_CompileBase
+{
/**
* Attribute definition: Overwrites base class.
*
/**
* Compiles code for the {section} tag
*
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ *
* @return string compiled code
*/
public function compile($args, $compiler)
foreach ($_attr as $attr_name => $attr_value) {
switch ($attr_name) {
case 'loop':
- $output .= "{$section_props}['loop'] = is_array(\$_loop=$attr_value) ? count(\$_loop) : max(0, (int)\$_loop); unset(\$_loop);\n";
+ $output .= "{$section_props}['loop'] = is_array(\$_loop=$attr_value) ? count(\$_loop) : max(0, (int) \$_loop); unset(\$_loop);\n";
break;
case 'show':
- if (is_bool($attr_value))
+ if (is_bool($attr_value)) {
$show_attr_value = $attr_value ? 'true' : 'false';
- else
- $show_attr_value = "(bool)$attr_value";
+ } else {
+ $show_attr_value = "(bool) $attr_value";
+ }
$output .= "{$section_props}['show'] = $show_attr_value;\n";
break;
case 'max':
case 'start':
- $output .= "{$section_props}['$attr_name'] = (int)$attr_value;\n";
+ $output .= "{$section_props}['$attr_name'] = (int) $attr_value;\n";
break;
case 'step':
- $output .= "{$section_props}['$attr_name'] = ((int)$attr_value) == 0 ? 1 : (int)$attr_value;\n";
+ $output .= "{$section_props}['$attr_name'] = ((int) $attr_value) == 0 ? 1 : (int) $attr_value;\n";
break;
}
}
- if (!isset($_attr['show']))
+ if (!isset($_attr['show'])) {
$output .= "{$section_props}['show'] = true;\n";
+ }
- if (!isset($_attr['loop']))
+ if (!isset($_attr['loop'])) {
$output .= "{$section_props}['loop'] = 1;\n";
+ }
- if (!isset($_attr['max']))
+ if (!isset($_attr['max'])) {
$output .= "{$section_props}['max'] = {$section_props}['loop'];\n";
- else
+ } else {
$output .= "if ({$section_props}['max'] < 0)\n" . " {$section_props}['max'] = {$section_props}['loop'];\n";
+ }
- if (!isset($_attr['step']))
+ if (!isset($_attr['step'])) {
$output .= "{$section_props}['step'] = 1;\n";
+ }
- if (!isset($_attr['start']))
+ if (!isset($_attr['start'])) {
$output .= "{$section_props}['start'] = {$section_props}['step'] > 0 ? 0 : {$section_props}['loop']-1;\n";
- else {
+ } else {
$output .= "if ({$section_props}['start'] < 0)\n" . " {$section_props}['start'] = max({$section_props}['step'] > 0 ? 0 : -1, {$section_props}['loop'] + {$section_props}['start']);\n" . "else\n" . " {$section_props}['start'] = min({$section_props}['start'], {$section_props}['step'] > 0 ? {$section_props}['loop'] : {$section_props}['loop']-1);\n";
}
$output .= "{$section_props}['last'] = ({$section_props}['iteration'] == {$section_props}['total']);\n";
$output .= "?>";
+
return $output;
}
-
}
/**
* Smarty Internal Plugin Compile Sectionelse Class
- *
- * @package Smarty
+ *
+ * @package Smarty
* @subpackage Compiler
*/
-class Smarty_Internal_Compile_Sectionelse extends Smarty_Internal_CompileBase {
-
+class Smarty_Internal_Compile_Sectionelse extends Smarty_Internal_CompileBase
+{
/**
* Compiles code for the {sectionelse} tag
*
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ *
* @return string compiled code
*/
public function compile($args, $compiler)
return "<?php endfor; else: ?>";
}
-
}
/**
* Smarty Internal Plugin Compile Sectionclose Class
- *
- * @package Smarty
+ *
+ * @package Smarty
* @subpackage Compiler
*/
-class Smarty_Internal_Compile_Sectionclose extends Smarty_Internal_CompileBase {
-
+class Smarty_Internal_Compile_Sectionclose extends Smarty_Internal_CompileBase
+{
/**
* Compiles code for the {/section} tag
*
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ *
* @return string compiled code
*/
public function compile($args, $compiler)
return "<?php endfor; endif; ?>";
}
}
-
}
-
-?>
\ No newline at end of file
-<?php\r
-/**\r
- * Smarty Internal Plugin Compile Setfilter\r
- *\r
- * Compiles code for setfilter tag\r
- *\r
- * @package Smarty\r
- * @subpackage Compiler\r
- * @author Uwe Tews\r
- */\r
-\r
-/**\r
- * Smarty Internal Plugin Compile Setfilter Class\r
- *\r
- * @package Smarty\r
- * @subpackage Compiler\r
- */\r
-class Smarty_Internal_Compile_Setfilter extends Smarty_Internal_CompileBase {\r
-\r
- /**\r
- * Compiles code for setfilter tag\r
- *\r
- * @param array $args array with attributes from parser\r
- * @param object $compiler compiler object\r
- * @param array $parameter array with compilation parameter\r
- * @return string compiled code\r
- */\r
- public function compile($args, $compiler, $parameter)\r
- {\r
- $compiler->variable_filter_stack[] = $compiler->template->variable_filters;\r
- $compiler->template->variable_filters = $parameter['modifier_list'];\r
- // this tag does not return compiled code\r
- $compiler->has_code = false;\r
- return true;\r
- }\r
-\r
-}\r
-\r
-/**\r
- * Smarty Internal Plugin Compile Setfilterclose Class\r
- *\r
- * @package Smarty\r
- * @subpackage Compiler\r
- */\r
-class Smarty_Internal_Compile_Setfilterclose extends Smarty_Internal_CompileBase {\r
-\r
- /**\r
- * Compiles code for the {/setfilter} tag\r
- *\r
- * This tag does not generate compiled output. It resets variable filter.\r
- *\r
- * @param array $args array with attributes from parser\r
- * @param object $compiler compiler object\r
- * @return string compiled code\r
- */\r
- public function compile($args, $compiler)\r
- {\r
- $_attr = $this->getAttributes($compiler, $args);\r
- // reset variable filter to previous state\r
- if (count($compiler->variable_filter_stack)) {\r
- $compiler->template->variable_filters = array_pop($compiler->variable_filter_stack);\r
- } else {\r
- $compiler->template->variable_filters = array();\r
- }\r
- // this tag does not return compiled code\r
- $compiler->has_code = false;\r
- return true;\r
- }\r
-\r
-}\r
-\r
-?>
\ No newline at end of file
+<?php
+/**
+ * Smarty Internal Plugin Compile Setfilter
+ * Compiles code for setfilter tag
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @author Uwe Tews
+ */
+
+/**
+ * Smarty Internal Plugin Compile Setfilter Class
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ */
+class Smarty_Internal_Compile_Setfilter extends Smarty_Internal_CompileBase
+{
+ /**
+ * Compiles code for setfilter tag
+ *
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ * @param array $parameter array with compilation parameter
+ *
+ * @return string compiled code
+ */
+ public function compile($args, $compiler, $parameter)
+ {
+ $compiler->variable_filter_stack[] = $compiler->template->variable_filters;
+ $compiler->template->variable_filters = $parameter['modifier_list'];
+ // this tag does not return compiled code
+ $compiler->has_code = false;
+
+ return true;
+ }
+}
+
+/**
+ * Smarty Internal Plugin Compile Setfilterclose Class
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ */
+class Smarty_Internal_Compile_Setfilterclose extends Smarty_Internal_CompileBase
+{
+ /**
+ * Compiles code for the {/setfilter} tag
+ * This tag does not generate compiled output. It resets variable filter.
+ *
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ *
+ * @return string compiled code
+ */
+ public function compile($args, $compiler)
+ {
+ $_attr = $this->getAttributes($compiler, $args);
+ // reset variable filter to previous state
+ if (count($compiler->variable_filter_stack)) {
+ $compiler->template->variable_filters = array_pop($compiler->variable_filter_stack);
+ } else {
+ $compiler->template->variable_filters = array();
+ }
+ // this tag does not return compiled code
+ $compiler->has_code = false;
+
+ return true;
+ }
+}
<?php
/**
* Smarty Internal Plugin Compile While
- *
* Compiles the {while} tag
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
- * @author Uwe Tews
+ * @author Uwe Tews
*/
/**
* Smarty Internal Plugin Compile While Class
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
*/
-class Smarty_Internal_Compile_While extends Smarty_Internal_CompileBase {
-
+class Smarty_Internal_Compile_While extends Smarty_Internal_CompileBase
+{
/**
* Compiles code for the {while} tag
*
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
- * @param array $parameter array with compilation parameter
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ * @param array $parameter array with compilation parameter
+ *
* @return string compiled code
*/
public function compile($args, $compiler, $parameter)
$_attr = $this->getAttributes($compiler, $args);
$this->openTag($compiler, 'while', $compiler->nocache);
- if (!array_key_exists("if condition",$parameter)) {
+ if (!array_key_exists("if condition", $parameter)) {
$compiler->trigger_template_error("missing while condition", $compiler->lex->taglineno);
}
}
if (is_array($parameter['if condition']['var'])) {
$_output = "<?php if (!isset(\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var']['var'] . "]) || !is_array(\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var']['var'] . "]->value)) \$_smarty_tpl->createLocalArrayVariable(" . $parameter['if condition']['var']['var'] . "$_nocache);\n";
- $_output .= "while (\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var']['var'] . "]->value" . $parameter['if condition']['var']['smarty_internal_index'] . " = " . $parameter['if condition']['value'] . "){?>";
+ $_output .= "while (\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var']['var'] . "]->value" . $parameter['if condition']['var']['smarty_internal_index'] . " = " . $parameter['if condition']['value'] . ") {?>";
} else {
$_output = "<?php if (!isset(\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var'] . "])) \$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var'] . "] = new Smarty_Variable(null{$_nocache});";
- $_output .= "while (\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var'] . "]->value = " . $parameter['if condition']['value'] . "){?>";
+ $_output .= "while (\$_smarty_tpl->tpl_vars[" . $parameter['if condition']['var'] . "]->value = " . $parameter['if condition']['value'] . ") {?>";
}
+
return $_output;
} else {
- return "<?php while ({$parameter['if condition']}){?>";
+ return "<?php while ({$parameter['if condition']}) {?>";
}
}
-
}
/**
* Smarty Internal Plugin Compile Whileclose Class
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
*/
-class Smarty_Internal_Compile_Whileclose extends Smarty_Internal_CompileBase {
-
+class Smarty_Internal_Compile_Whileclose extends Smarty_Internal_CompileBase
+{
/**
* Compiles code for the {/while} tag
*
- * @param array $args array with attributes from parser
- * @param object $compiler compiler object
+ * @param array $args array with attributes from parser
+ * @param object $compiler compiler object
+ *
* @return string compiled code
*/
public function compile($args, $compiler)
$compiler->tag_nocache = true;
}
$compiler->nocache = $this->closeTag($compiler, array('while'));
+
return "<?php }?>";
}
-
}
-
-?>
\ No newline at end of file
/**
* Smarty Internal Plugin CompileBase
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
- * @author Uwe Tews
+ * @author Uwe Tews
*/
/**
* This class does extend all internal compile plugins
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
*/
-abstract class Smarty_Internal_CompileBase {
-
+abstract class Smarty_Internal_CompileBase
+{
/**
* Array of names of required attribute required by tag
*
/**
* This function checks if the attributes passed are valid
- *
* The attributes passed for the tag to compile are checked against the list of required and
* optional attributes. Required attributes must be present. Optional attributes are check against
* the corresponding list. The keyword '_any' specifies that any attribute will be accepted
* as valid
*
- * @param object $compiler compiler object
- * @param array $attributes attributes applied to the tag
- * @return array of mapped attributes for further processing
+ * @param object $compiler compiler object
+ * @param array $attributes attributes applied to the tag
+ *
+ * @return array of mapped attributes for further processing
*/
public function getAttributes($compiler, $attributes)
{
if (in_array(trim($mixed, '\'"'), $this->option_flags)) {
$_indexed_attr[trim($mixed, '\'"')] = true;
// shorthand attribute ?
- } else if (isset($this->shorttag_order[$key])) {
+ } elseif (isset($this->shorttag_order[$key])) {
$_indexed_attr[$this->shorttag_order[$key]] = $mixed;
} else {
// too many shorthands
if (in_array($kv['key'], $this->option_flags)) {
if (is_bool($kv['value'])) {
$_indexed_attr[$kv['key']] = $kv['value'];
- } else if (is_string($kv['value']) && in_array(trim($kv['value'], '\'"'), array('true', 'false'))) {
+ } elseif (is_string($kv['value']) && in_array(trim($kv['value'], '\'"'), array('true', 'false'))) {
if (trim($kv['value']) == 'true') {
$_indexed_attr[$kv['key']] = true;
} else {
$_indexed_attr[$kv['key']] = false;
}
- } else if (is_numeric($kv['value']) && in_array($kv['value'], array(0, 1))) {
+ } elseif (is_numeric($kv['value']) && in_array($kv['value'], array(0, 1))) {
if ($kv['value'] == 1) {
$_indexed_attr[$kv['key']] = true;
} else {
$compiler->trigger_template_error("missing \"" . $attr . "\" attribute", $compiler->lex->taglineno);
}
}
- // check for unallowed attributes
+ // check for not allowed attributes
if ($this->optional_attributes != array('_any')) {
$tmp_array = array_merge($this->required_attributes, $this->optional_attributes, $this->option_flags);
foreach ($_indexed_attr as $key => $dummy) {
/**
* Push opening tag name on stack
- *
* Optionally additional data can be saved on stack
*
- * @param object $compiler compiler object
- * @param string $openTag the opening tag's name
- * @param mixed $data optional data saved
+ * @param object $compiler compiler object
+ * @param string $openTag the opening tag's name
+ * @param mixed $data optional data saved
*/
public function openTag($compiler, $openTag, $data = null)
{
/**
* Pop closing tag
- *
* Raise an error if this stack-top doesn't match with expected opening tags
*
- * @param object $compiler compiler object
- * @param array|string $expectedTag the expected opening tag names
- * @return mixed any type the opening tag's name or saved data
+ * @param object $compiler compiler object
+ * @param array|string $expectedTag the expected opening tag names
+ *
+ * @return mixed any type the opening tag's name or saved data
*/
public function closeTag($compiler, $expectedTag)
{
}
}
// wrong nesting of tags
- $compiler->trigger_template_error("unclosed {" . $_openTag . "} tag");
+ $compiler->trigger_template_error("unclosed {$compiler->smarty->left_delimiter}" . $_openTag . "{$compiler->smarty->right_delimiter} tag");
+
return;
}
// wrong nesting of tags
$compiler->trigger_template_error("unexpected closing tag", $compiler->lex->taglineno);
+
return;
}
-
}
-
-?>
\ No newline at end of file
/**
* Smarty Internal Plugin Config
*
- * @package Smarty
+ * @package Smarty
* @subpackage Config
- * @author Uwe Tews
+ * @author Uwe Tews
*/
/**
* Smarty Internal Plugin Config
- *
* Main class for config variables
*
- * @package Smarty
+ * @package Smarty
* @subpackage Config
- *
- * @property Smarty_Config_Source $source
- * @property Smarty_Config_Compiled $compiled
* @ignore
*/
-class Smarty_Internal_Config {
-
+class Smarty_Internal_Config
+{
/**
- * Samrty instance
+ * Smarty instance
*
* @var Smarty object
*/
public $data = null;
/**
* Config resource
+ *
* @var string
*/
public $config_resource = null;
public $compiled_timestamp = null;
/**
* flag if compiled config file is invalid and must be (re)compiled
+ *
* @var bool
*/
public $mustCompile = null;
* Constructor of config file object
*
* @param string $config_resource config file resource name
- * @param Smarty $smarty Smarty instance
- * @param object $data object for config vars storage
+ * @param Smarty $smarty Smarty instance
+ * @param object $data object for config vars storage
*/
public function __construct($config_resource, $smarty, $data = null)
{
public function getCompiledFilepath()
{
return $this->compiled_filepath === null ?
- ($this->compiled_filepath = $this->buildCompiledFilepath()) :
- $this->compiled_filepath;
+ ($this->compiled_filepath = $this->buildCompiledFilepath()) :
+ $this->compiled_filepath;
}
/**
{
$_compile_id = isset($this->smarty->compile_id) ? preg_replace('![^\w\|]+!', '_', $this->smarty->compile_id) : null;
$_flag = (int) $this->smarty->config_read_hidden + (int) $this->smarty->config_booleanize * 2
- + (int) $this->smarty->config_overwrite * 4;
- $_filepath = sha1($this->source->name . $_flag);
+ + (int) $this->smarty->config_overwrite * 4;
+ $_filepath = sha1(realpath($this->source->filepath) . $_flag);
// if use_sub_dirs, break file into directories
if ($this->smarty->use_sub_dirs) {
$_filepath = substr($_filepath, 0, 2) . DS
- . substr($_filepath, 2, 2) . DS
- . substr($_filepath, 4, 2) . DS
- . $_filepath;
+ . substr($_filepath, 2, 2) . DS
+ . substr($_filepath, 4, 2) . DS
+ . $_filepath;
}
$_compile_dir_sep = $this->smarty->use_sub_dirs ? DS : '^';
if (isset($_compile_id)) {
$_filepath = $_compile_id . $_compile_dir_sep . $_filepath;
}
$_compile_dir = $this->smarty->getCompileDir();
+
return $_compile_dir . $_filepath . '.' . basename($this->source->name) . '.config' . '.php';
}
/**
- * Returns the timpestamp of the compiled file
+ * Returns the timestamp of the compiled file
*
* @return integer the file timestamp
*/
/**
* Returns if the current config file must be compiled
- *
* It does compare the timestamps of config source and the compiled config and checks the force compile configuration
*
* @return boolean true if the file must be compiled
public function mustCompile()
{
return $this->mustCompile === null ?
- $this->mustCompile = ($this->smarty->force_compile || $this->getCompiledTimestamp () === false || $this->smarty->compile_check && $this->getCompiledTimestamp () < $this->source->timestamp):
+ $this->mustCompile = ($this->smarty->force_compile || $this->getCompiledTimestamp() === false || $this->smarty->compile_check && $this->getCompiledTimestamp() < $this->source->timestamp) :
$this->mustCompile;
}
/**
* Returns the compiled config file
- *
* It checks if the config file must be compiled or just read the compiled version
*
* @return string the compiled config file
$this->compiled_config = file_get_contents($this->getCompiledFilepath());
}
}
+
return $this->compiled_config;
}
// call compiler
try {
$this->compiler_object->compileSource($this);
- } catch (Exception $e) {
+ }
+ catch (Exception $e) {
// restore old timestamp in case of error
if ($this->smarty->compile_locking && $saved_timestamp) {
touch($this->getCompiledFilepath(), $saved_timestamp);
}
throw $e;
}
- // compiling succeded
+ // compiling succeeded
// write compiled template
Smarty_Internal_Write_File::writeFile($this->getCompiledFilepath(), $this->getCompiledConfig(), $this->smarty);
}
/**
* load config variables
*
- * @param mixed $sections array of section names, single section or null
- * @param object $scope global,parent or local
+ * @param mixed $sections array of section names, single section or null
+ * @param string $scope global,parent or local
+ *
+ * @throws Exception
*/
public function loadConfigVars($sections = null, $scope = 'local')
{
}
// scan sections
if (!empty($sections)) {
- $sections = array_flip((array) $sections);
- foreach ($_config_vars['sections'] as $this_section => $dummy) {
- if (isset($sections[$this_section])) {
+ foreach ((array) $sections as $this_section) {
+ if (isset($_config_vars['sections'][$this_section])) {
foreach ($_config_vars['sections'][$this_section]['vars'] as $variable => $value) {
if ($this->smarty->config_overwrite || !isset($scope_ptr->config_vars[$variable])) {
$scope_ptr->config_vars[$variable] = $value;
/**
* set Smarty property in template context
*
- * @param string $property_name property name
- * @param mixed $value value
+ * @param string $property_name property name
+ * @param mixed $value value
+ *
* @throws SmartyException if $property_name is not valid
*/
public function __set($property_name, $value)
case 'source':
case 'compiled':
$this->$property_name = $value;
+
return;
}
/**
* get Smarty property in template context
*
- * @param string $property_name property name
+ * @param string $property_name property name
+ *
+ * @return \Smarty_Config_Source|\Smarty_Template_Compiled
* @throws SmartyException if $property_name is not valid
*/
public function __get($property_name)
throw new SmartyException("Unable to parse resource name \"{$this->config_resource}\"");
}
$this->source = Smarty_Resource::config($this);
+
return $this->source;
case 'compiled':
$this->compiled = $this->source->getCompiled($this);
+
return $this->compiled;
}
throw new SmartyException("config attribute '$property_name' does not exist.");
}
-
}
-
-?>
\ No newline at end of file
<?php
/**
* Smarty Internal Plugin Config File Compiler
- *
* This is the config file compiler class. It calls the lexer and parser to
* perform the compiling.
*
- * @package Smarty
+ * @package Smarty
* @subpackage Config
- * @author Uwe Tews
+ * @author Uwe Tews
*/
/**
* Main config file compiler class
*
- * @package Smarty
+ * @package Smarty
* @subpackage Config
*/
-class Smarty_Internal_Config_File_Compiler {
-
+class Smarty_Internal_Config_File_Compiler
+{
/**
* Lexer object
*
* Method to compile a Smarty template.
*
* @param Smarty_Internal_Config $config config object
- * @return bool true if compiling succeeded, false if it failed
+ *
+ * @return bool true if compiling succeeded, false if it failed
*/
public function compileSource(Smarty_Internal_Config $config)
{
return true;
}
// init the lexer/parser to compile the config file
- $lex = new Smarty_Internal_Configfilelexer($_content, $this->smarty);
+ $lex = new Smarty_Internal_Configfilelexer($_content, $this);
$parser = new Smarty_Internal_Configfileparser($lex, $this);
- if ($this->smarty->_parserdebug) $parser->PrintTrace();
+
+ if (function_exists('mb_internal_encoding') && ((int) ini_get('mbstring.func_overload')) & 2) {
+ $mbEncoding = mb_internal_encoding();
+ mb_internal_encoding('ASCII');
+ } else {
+ $mbEncoding = null;
+ }
+
+
+ if ($this->smarty->_parserdebug) {
+ $parser->PrintTrace();
+ }
// get tokens from lexer and parse them
while ($lex->yylex()) {
- if ($this->smarty->_parserdebug) echo "<br>Parsing {$parser->yyTokenName[$lex->token]} Token {$lex->value} Line {$lex->line} \n";
+ if ($this->smarty->_parserdebug) {
+ echo "<br>Parsing {$parser->yyTokenName[$lex->token]} Token {$lex->value} Line {$lex->line} \n";
+ }
$parser->doParse($lex->token, $lex->value);
}
// finish parsing process
$parser->doParse(0, 0);
+
+ if ($mbEncoding) {
+ mb_internal_encoding($mbEncoding);
+ }
+
$config->compiled_config = '<?php $_config_vars = ' . var_export($this->config_data, true) . '; ?>';
}
/**
* display compiler error messages without dying
- *
* If parameter $args is empty it is a parser detected syntax error.
- * In this case the parser is called to obtain information about exspected tokens.
- *
+ * In this case the parser is called to obtain information about expected tokens.
* If parameter $args contains a string this is used as error message
*
* @param string $args individual error message or null
+ *
+ * @throws SmartyCompilerException
*/
public function trigger_config_file_error($args = null)
{
// $line--;
}
$match = preg_split("/\n/", $this->lex->data);
- $error_text = "Syntax error in config file '{$this->config->source->filepath}' on line {$line} '{$match[$line-1]}' ";
+ $error_text = "Syntax error in config file '{$this->config->source->filepath}' on line {$line} '{$match[$line - 1]}' ";
if (isset($args)) {
// individual error message
$error_text .= $args;
} else {
- // exspected token from parser
+ // expected token from parser
foreach ($this->parser->yy_get_expected_tokens($this->parser->yymajor) as $token) {
$exp_token = $this->parser->yyTokenName[$token];
if (isset($this->lex->smarty_token_names[$exp_token])) {
}
throw new SmartyCompilerException($error_text);
}
-
}
-
-?>
\ No newline at end of file
<?php
/**
-* Smarty Internal Plugin Configfilelexer
-*
-* This is the lexer to break the config file source into tokens
-* @package Smarty
-* @subpackage Config
-* @author Uwe Tews
-*/
+ * Smarty Internal Plugin Configfilelexer
+ * This is the lexer to break the config file source into tokens
+ *
+ * @package Smarty
+ * @subpackage Config
+ * @author Uwe Tews
+ */
+
/**
-* Smarty Internal Plugin Configfilelexer
-*/
+ * Smarty Internal Plugin Configfilelexer
+ */
class Smarty_Internal_Configfilelexer
{
public $node;
public $line;
private $state = 1;
- public $smarty_token_names = array ( // Text for parser error messages
- );
-
+ public $yyTraceFILE;
+ public $yyTracePrompt;
+ public $state_name = array(1 => 'START', 2 => 'VALUE', 3 => 'NAKED_STRING_VALUE', 4 => 'COMMENT', 5 => 'SECTION', 6 => 'TRIPPLE');
+ public $smarty_token_names = array( // Text for parser error messages
+ );
- function __construct($data, $smarty)
+ function __construct($data, $compiler)
{
// set instance object
self::instance($this);
$this->data = $data . "\n"; //now all lines are \n-terminated
$this->counter = 0;
$this->line = 1;
- $this->smarty = $smarty;
- $this->mbstring_overload = ini_get('mbstring.func_overload') & 2;
+ $this->compiler = $compiler;
+ $this->smarty = $compiler->smarty;
}
+
public static function &instance($new_instance = null)
{
static $instance = null;
- if (isset($new_instance) && is_object($new_instance))
+ if (isset($new_instance) && is_object($new_instance)) {
$instance = $new_instance;
+ }
return $instance;
}
-
+ public function PrintTrace()
+ {
+ $this->yyTraceFILE = fopen('php://output', 'w');
+ $this->yyTracePrompt = '<br>';
+ }
private $_yy_state = 1;
private $_yy_stack = array();
- function yylex()
+ public function yylex()
{
return $this->{'yylex' . $this->_yy_state}();
}
- function yypushstate($state)
+ public function yypushstate($state)
{
+ if ($this->yyTraceFILE) {
+ fprintf($this->yyTraceFILE, "%sState push %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state);
+ }
array_push($this->_yy_stack, $this->_yy_state);
$this->_yy_state = $state;
+ if ($this->yyTraceFILE) {
+ fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state);
+ }
}
- function yypopstate()
+ public function yypopstate()
{
+ if ($this->yyTraceFILE) {
+ fprintf($this->yyTraceFILE, "%sState pop %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state);
+ }
$this->_yy_state = array_pop($this->_yy_stack);
+ if ($this->yyTraceFILE) {
+ fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state);
+ }
}
- function yybegin($state)
+ public function yybegin($state)
{
$this->_yy_state = $state;
+ if ($this->yyTraceFILE) {
+ fprintf($this->yyTraceFILE, "%sState set %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state);
+ }
}
-
-
-
- function yylex1()
+ public function yylex1()
{
- $tokenMap = array (
- 1 => 0,
- 2 => 0,
- 3 => 0,
- 4 => 0,
- 5 => 0,
- 6 => 0,
- 7 => 0,
- 8 => 0,
- );
- if ($this->counter >= ($this->mbstring_overload ? mb_strlen($this->data,'latin1'): strlen($this->data))) {
+ $tokenMap = array(
+ 1 => 0,
+ 2 => 0,
+ 3 => 0,
+ 4 => 0,
+ 5 => 0,
+ 6 => 0,
+ 7 => 0,
+ 8 => 0,
+ );
+ if ($this->counter >= strlen($this->data)) {
return false; // end of input
}
$yy_global_pattern = "/\G(#|;)|\G(\\[)|\G(\\])|\G(=)|\G([ \t\r]+)|\G(\n)|\G([0-9]*[a-zA-Z_]\\w*)|\G([\S\s])/iS";
do {
- if ($this->mbstring_overload ? preg_match($yy_global_pattern, mb_substr($this->data, $this->counter,2000000000,'latin1'), $yymatches) : preg_match($yy_global_pattern,$this->data, $yymatches, null, $this->counter)) {
+ if (preg_match($yy_global_pattern, $this->data, $yymatches, null, $this->counter)) {
$yysubmatches = $yymatches;
$yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
if (!count($yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' .
- ' an empty string. Input "' . substr($this->data,
- $this->counter, 5) . '... state START');
+ ' an empty string. Input "' . substr($this->data,
+ $this->counter, 5) . '... state START');
}
next($yymatches); // skip global match
$this->token = key($yymatches); // token number
if ($tokenMap[$this->token]) {
// extract sub-patterns for passing to lex function
$yysubmatches = array_slice($yysubmatches, $this->token + 1,
- $tokenMap[$this->token]);
+ $tokenMap[$this->token]);
} else {
$yysubmatches = array();
}
$this->value = current($yymatches); // token value
$r = $this->{'yy_r1_' . $this->token}($yysubmatches);
if ($r === null) {
- $this->counter += ($this->mbstring_overload ? mb_strlen($this->value,'latin1'): strlen($this->value));
+ $this->counter += strlen($this->value);
$this->line += substr_count($this->value, "\n");
// accept this token
return true;
// process this token in the new state
return $this->yylex();
} elseif ($r === false) {
- $this->counter += ($this->mbstring_overload ? mb_strlen($this->value,'latin1'): strlen($this->value));
+ $this->counter += strlen($this->value);
$this->line += substr_count($this->value, "\n");
- if ($this->counter >= ($this->mbstring_overload ? mb_strlen($this->data,'latin1'): strlen($this->data))) {
+ if ($this->counter >= strlen($this->data)) {
return false; // end of input
}
// skip this token
continue;
- } } else {
+ }
+ } else {
throw new Exception('Unexpected input at line' . $this->line .
- ': ' . $this->data[$this->counter]);
+ ': ' . $this->data[$this->counter]);
}
break;
} while (true);
-
} // end function
-
const START = 1;
+
function yy_r1_1($yy_subpatterns)
{
- $this->token = Smarty_Internal_Configfileparser::TPC_COMMENTSTART;
- $this->yypushstate(self::COMMENT);
+ $this->token = Smarty_Internal_Configfileparser::TPC_COMMENTSTART;
+ $this->yypushstate(self::COMMENT);
}
+
function yy_r1_2($yy_subpatterns)
{
- $this->token = Smarty_Internal_Configfileparser::TPC_OPENB;
- $this->yypushstate(self::SECTION);
+ $this->token = Smarty_Internal_Configfileparser::TPC_OPENB;
+ $this->yypushstate(self::SECTION);
}
+
function yy_r1_3($yy_subpatterns)
{
- $this->token = Smarty_Internal_Configfileparser::TPC_CLOSEB;
+ $this->token = Smarty_Internal_Configfileparser::TPC_CLOSEB;
}
+
function yy_r1_4($yy_subpatterns)
{
- $this->token = Smarty_Internal_Configfileparser::TPC_EQUAL;
- $this->yypushstate(self::VALUE);
+ $this->token = Smarty_Internal_Configfileparser::TPC_EQUAL;
+ $this->yypushstate(self::VALUE);
}
+
function yy_r1_5($yy_subpatterns)
{
- return false;
+ return false;
}
+
function yy_r1_6($yy_subpatterns)
{
- $this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE;
+ $this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE;
}
+
function yy_r1_7($yy_subpatterns)
{
- $this->token = Smarty_Internal_Configfileparser::TPC_ID;
+ $this->token = Smarty_Internal_Configfileparser::TPC_ID;
}
+
function yy_r1_8($yy_subpatterns)
{
- $this->token = Smarty_Internal_Configfileparser::TPC_OTHER;
+ $this->token = Smarty_Internal_Configfileparser::TPC_OTHER;
}
-
-
- function yylex2()
+ public function yylex2()
{
- $tokenMap = array (
- 1 => 0,
- 2 => 0,
- 3 => 0,
- 4 => 0,
- 5 => 0,
- 6 => 0,
- 7 => 0,
- 8 => 0,
- 9 => 0,
- );
- if ($this->counter >= ($this->mbstring_overload ? mb_strlen($this->data,'latin1'): strlen($this->data))) {
+ $tokenMap = array(
+ 1 => 0,
+ 2 => 0,
+ 3 => 0,
+ 4 => 0,
+ 5 => 0,
+ 6 => 0,
+ 7 => 0,
+ 8 => 0,
+ 9 => 0,
+ );
+ if ($this->counter >= strlen($this->data)) {
return false; // end of input
}
$yy_global_pattern = "/\G([ \t\r]+)|\G(\\d+\\.\\d+(?=[ \t\r]*[\n#;]))|\G(\\d+(?=[ \t\r]*[\n#;]))|\G(\"\"\")|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*'(?=[ \t\r]*[\n#;]))|\G(\"[^\"\\\\]*(?:\\\\.[^\"\\\\]*)*\"(?=[ \t\r]*[\n#;]))|\G([a-zA-Z]+(?=[ \t\r]*[\n#;]))|\G([^\n]+?(?=[ \t\r]*\n))|\G(\n)/iS";
do {
- if ($this->mbstring_overload ? preg_match($yy_global_pattern, mb_substr($this->data, $this->counter,2000000000,'latin1'), $yymatches) : preg_match($yy_global_pattern,$this->data, $yymatches, null, $this->counter)) {
+ if (preg_match($yy_global_pattern, $this->data, $yymatches, null, $this->counter)) {
$yysubmatches = $yymatches;
$yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
if (!count($yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' .
- ' an empty string. Input "' . substr($this->data,
- $this->counter, 5) . '... state VALUE');
+ ' an empty string. Input "' . substr($this->data,
+ $this->counter, 5) . '... state VALUE');
}
next($yymatches); // skip global match
$this->token = key($yymatches); // token number
if ($tokenMap[$this->token]) {
// extract sub-patterns for passing to lex function
$yysubmatches = array_slice($yysubmatches, $this->token + 1,
- $tokenMap[$this->token]);
+ $tokenMap[$this->token]);
} else {
$yysubmatches = array();
}
$this->value = current($yymatches); // token value
$r = $this->{'yy_r2_' . $this->token}($yysubmatches);
if ($r === null) {
- $this->counter += ($this->mbstring_overload ? mb_strlen($this->value,'latin1'): strlen($this->value));
+ $this->counter += strlen($this->value);
$this->line += substr_count($this->value, "\n");
// accept this token
return true;
// process this token in the new state
return $this->yylex();
} elseif ($r === false) {
- $this->counter += ($this->mbstring_overload ? mb_strlen($this->value,'latin1'): strlen($this->value));
+ $this->counter += strlen($this->value);
$this->line += substr_count($this->value, "\n");
- if ($this->counter >= ($this->mbstring_overload ? mb_strlen($this->data,'latin1'): strlen($this->data))) {
+ if ($this->counter >= strlen($this->data)) {
return false; // end of input
}
// skip this token
continue;
- } } else {
+ }
+ } else {
throw new Exception('Unexpected input at line' . $this->line .
- ': ' . $this->data[$this->counter]);
+ ': ' . $this->data[$this->counter]);
}
break;
} while (true);
-
} // end function
-
const VALUE = 2;
+
function yy_r2_1($yy_subpatterns)
{
- return false;
+ return false;
}
+
function yy_r2_2($yy_subpatterns)
{
- $this->token = Smarty_Internal_Configfileparser::TPC_FLOAT;
- $this->yypopstate();
+ $this->token = Smarty_Internal_Configfileparser::TPC_FLOAT;
+ $this->yypopstate();
}
+
function yy_r2_3($yy_subpatterns)
{
- $this->token = Smarty_Internal_Configfileparser::TPC_INT;
- $this->yypopstate();
+ $this->token = Smarty_Internal_Configfileparser::TPC_INT;
+ $this->yypopstate();
}
+
function yy_r2_4($yy_subpatterns)
{
- $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES;
- $this->yypushstate(self::TRIPPLE);
+ $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES;
+ $this->yypushstate(self::TRIPPLE);
}
+
function yy_r2_5($yy_subpatterns)
{
- $this->token = Smarty_Internal_Configfileparser::TPC_SINGLE_QUOTED_STRING;
- $this->yypopstate();
+ $this->token = Smarty_Internal_Configfileparser::TPC_SINGLE_QUOTED_STRING;
+ $this->yypopstate();
}
+
function yy_r2_6($yy_subpatterns)
{
- $this->token = Smarty_Internal_Configfileparser::TPC_DOUBLE_QUOTED_STRING;
- $this->yypopstate();
+ $this->token = Smarty_Internal_Configfileparser::TPC_DOUBLE_QUOTED_STRING;
+ $this->yypopstate();
}
+
function yy_r2_7($yy_subpatterns)
{
- if (!$this->smarty->config_booleanize || !in_array(strtolower($this->value), Array("true", "false", "on", "off", "yes", "no")) ) {
- $this->yypopstate();
- $this->yypushstate(self::NAKED_STRING_VALUE);
- return true; //reprocess in new state
- } else {
- $this->token = Smarty_Internal_Configfileparser::TPC_BOOL;
- $this->yypopstate();
- }
+ if (!$this->smarty->config_booleanize || !in_array(strtolower($this->value), Array("true", "false", "on", "off", "yes", "no"))) {
+ $this->yypopstate();
+ $this->yypushstate(self::NAKED_STRING_VALUE);
+ return true; //reprocess in new state
+ } else {
+ $this->token = Smarty_Internal_Configfileparser::TPC_BOOL;
+ $this->yypopstate();
+ }
}
+
function yy_r2_8($yy_subpatterns)
{
- $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
- $this->yypopstate();
+ $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
+ $this->yypopstate();
}
+
function yy_r2_9($yy_subpatterns)
{
- $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
- $this->value = "";
- $this->yypopstate();
+ $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
+ $this->value = "";
+ $this->yypopstate();
}
-
-
- function yylex3()
+ public function yylex3()
{
- $tokenMap = array (
- 1 => 0,
- );
- if ($this->counter >= ($this->mbstring_overload ? mb_strlen($this->data,'latin1'): strlen($this->data))) {
+ $tokenMap = array(
+ 1 => 0,
+ );
+ if ($this->counter >= strlen($this->data)) {
return false; // end of input
}
$yy_global_pattern = "/\G([^\n]+?(?=[ \t\r]*\n))/iS";
do {
- if ($this->mbstring_overload ? preg_match($yy_global_pattern, mb_substr($this->data, $this->counter,2000000000,'latin1'), $yymatches) : preg_match($yy_global_pattern,$this->data, $yymatches, null, $this->counter)) {
+ if (preg_match($yy_global_pattern, $this->data, $yymatches, null, $this->counter)) {
$yysubmatches = $yymatches;
$yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
if (!count($yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' .
- ' an empty string. Input "' . substr($this->data,
- $this->counter, 5) . '... state NAKED_STRING_VALUE');
+ ' an empty string. Input "' . substr($this->data,
+ $this->counter, 5) . '... state NAKED_STRING_VALUE');
}
next($yymatches); // skip global match
$this->token = key($yymatches); // token number
if ($tokenMap[$this->token]) {
// extract sub-patterns for passing to lex function
$yysubmatches = array_slice($yysubmatches, $this->token + 1,
- $tokenMap[$this->token]);
+ $tokenMap[$this->token]);
} else {
$yysubmatches = array();
}
$this->value = current($yymatches); // token value
$r = $this->{'yy_r3_' . $this->token}($yysubmatches);
if ($r === null) {
- $this->counter += ($this->mbstring_overload ? mb_strlen($this->value,'latin1'): strlen($this->value));
+ $this->counter += strlen($this->value);
$this->line += substr_count($this->value, "\n");
// accept this token
return true;
// process this token in the new state
return $this->yylex();
} elseif ($r === false) {
- $this->counter += ($this->mbstring_overload ? mb_strlen($this->value,'latin1'): strlen($this->value));
+ $this->counter += strlen($this->value);
$this->line += substr_count($this->value, "\n");
- if ($this->counter >= ($this->mbstring_overload ? mb_strlen($this->data,'latin1'): strlen($this->data))) {
+ if ($this->counter >= strlen($this->data)) {
return false; // end of input
}
// skip this token
continue;
- } } else {
+ }
+ } else {
throw new Exception('Unexpected input at line' . $this->line .
- ': ' . $this->data[$this->counter]);
+ ': ' . $this->data[$this->counter]);
}
break;
} while (true);
-
} // end function
-
const NAKED_STRING_VALUE = 3;
+
function yy_r3_1($yy_subpatterns)
{
- $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
- $this->yypopstate();
+ $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
+ $this->yypopstate();
}
-
-
- function yylex4()
+ public function yylex4()
{
- $tokenMap = array (
- 1 => 0,
- 2 => 0,
- 3 => 0,
- );
- if ($this->counter >= ($this->mbstring_overload ? mb_strlen($this->data,'latin1'): strlen($this->data))) {
+ $tokenMap = array(
+ 1 => 0,
+ 2 => 0,
+ 3 => 0,
+ );
+ if ($this->counter >= strlen($this->data)) {
return false; // end of input
}
$yy_global_pattern = "/\G([ \t\r]+)|\G([^\n]+?(?=[ \t\r]*\n))|\G(\n)/iS";
do {
- if ($this->mbstring_overload ? preg_match($yy_global_pattern, mb_substr($this->data, $this->counter,2000000000,'latin1'), $yymatches) : preg_match($yy_global_pattern,$this->data, $yymatches, null, $this->counter)) {
+ if (preg_match($yy_global_pattern, $this->data, $yymatches, null, $this->counter)) {
$yysubmatches = $yymatches;
$yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
if (!count($yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' .
- ' an empty string. Input "' . substr($this->data,
- $this->counter, 5) . '... state COMMENT');
+ ' an empty string. Input "' . substr($this->data,
+ $this->counter, 5) . '... state COMMENT');
}
next($yymatches); // skip global match
$this->token = key($yymatches); // token number
if ($tokenMap[$this->token]) {
// extract sub-patterns for passing to lex function
$yysubmatches = array_slice($yysubmatches, $this->token + 1,
- $tokenMap[$this->token]);
+ $tokenMap[$this->token]);
} else {
$yysubmatches = array();
}
$this->value = current($yymatches); // token value
$r = $this->{'yy_r4_' . $this->token}($yysubmatches);
if ($r === null) {
- $this->counter += ($this->mbstring_overload ? mb_strlen($this->value,'latin1'): strlen($this->value));
+ $this->counter += strlen($this->value);
$this->line += substr_count($this->value, "\n");
// accept this token
return true;
// process this token in the new state
return $this->yylex();
} elseif ($r === false) {
- $this->counter += ($this->mbstring_overload ? mb_strlen($this->value,'latin1'): strlen($this->value));
+ $this->counter += strlen($this->value);
$this->line += substr_count($this->value, "\n");
- if ($this->counter >= ($this->mbstring_overload ? mb_strlen($this->data,'latin1'): strlen($this->data))) {
+ if ($this->counter >= strlen($this->data)) {
return false; // end of input
}
// skip this token
continue;
- } } else {
+ }
+ } else {
throw new Exception('Unexpected input at line' . $this->line .
- ': ' . $this->data[$this->counter]);
+ ': ' . $this->data[$this->counter]);
}
break;
} while (true);
-
} // end function
-
const COMMENT = 4;
+
function yy_r4_1($yy_subpatterns)
{
- return false;
+ return false;
}
+
function yy_r4_2($yy_subpatterns)
{
- $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
+ $this->token = Smarty_Internal_Configfileparser::TPC_NAKED_STRING;
}
+
function yy_r4_3($yy_subpatterns)
{
- $this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE;
- $this->yypopstate();
+ $this->token = Smarty_Internal_Configfileparser::TPC_NEWLINE;
+ $this->yypopstate();
}
-
-
- function yylex5()
+ public function yylex5()
{
- $tokenMap = array (
- 1 => 0,
- 2 => 0,
- );
- if ($this->counter >= ($this->mbstring_overload ? mb_strlen($this->data,'latin1'): strlen($this->data))) {
+ $tokenMap = array(
+ 1 => 0,
+ 2 => 0,
+ );
+ if ($this->counter >= strlen($this->data)) {
return false; // end of input
}
$yy_global_pattern = "/\G(\\.)|\G(.*?(?=[\.=[\]\r\n]))/iS";
do {
- if ($this->mbstring_overload ? preg_match($yy_global_pattern, mb_substr($this->data, $this->counter,2000000000,'latin1'), $yymatches) : preg_match($yy_global_pattern,$this->data, $yymatches, null, $this->counter)) {
+ if (preg_match($yy_global_pattern, $this->data, $yymatches, null, $this->counter)) {
$yysubmatches = $yymatches;
$yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
if (!count($yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' .
- ' an empty string. Input "' . substr($this->data,
- $this->counter, 5) . '... state SECTION');
+ ' an empty string. Input "' . substr($this->data,
+ $this->counter, 5) . '... state SECTION');
}
next($yymatches); // skip global match
$this->token = key($yymatches); // token number
if ($tokenMap[$this->token]) {
// extract sub-patterns for passing to lex function
$yysubmatches = array_slice($yysubmatches, $this->token + 1,
- $tokenMap[$this->token]);
+ $tokenMap[$this->token]);
} else {
$yysubmatches = array();
}
$this->value = current($yymatches); // token value
$r = $this->{'yy_r5_' . $this->token}($yysubmatches);
if ($r === null) {
- $this->counter += ($this->mbstring_overload ? mb_strlen($this->value,'latin1'): strlen($this->value));
+ $this->counter += strlen($this->value);
$this->line += substr_count($this->value, "\n");
// accept this token
return true;
// process this token in the new state
return $this->yylex();
} elseif ($r === false) {
- $this->counter += ($this->mbstring_overload ? mb_strlen($this->value,'latin1'): strlen($this->value));
+ $this->counter += strlen($this->value);
$this->line += substr_count($this->value, "\n");
- if ($this->counter >= ($this->mbstring_overload ? mb_strlen($this->data,'latin1'): strlen($this->data))) {
+ if ($this->counter >= strlen($this->data)) {
return false; // end of input
}
// skip this token
continue;
- } } else {
+ }
+ } else {
throw new Exception('Unexpected input at line' . $this->line .
- ': ' . $this->data[$this->counter]);
+ ': ' . $this->data[$this->counter]);
}
break;
} while (true);
-
} // end function
-
const SECTION = 5;
+
function yy_r5_1($yy_subpatterns)
{
- $this->token = Smarty_Internal_Configfileparser::TPC_DOT;
+ $this->token = Smarty_Internal_Configfileparser::TPC_DOT;
}
+
function yy_r5_2($yy_subpatterns)
{
- $this->token = Smarty_Internal_Configfileparser::TPC_SECTION;
- $this->yypopstate();
+ $this->token = Smarty_Internal_Configfileparser::TPC_SECTION;
+ $this->yypopstate();
}
-
- function yylex6()
+ public function yylex6()
{
- $tokenMap = array (
- 1 => 0,
- 2 => 0,
- );
- if ($this->counter >= ($this->mbstring_overload ? mb_strlen($this->data,'latin1'): strlen($this->data))) {
+ $tokenMap = array(
+ 1 => 0,
+ 2 => 0,
+ );
+ if ($this->counter >= strlen($this->data)) {
return false; // end of input
}
$yy_global_pattern = "/\G(\"\"\"(?=[ \t\r]*[\n#;]))|\G([\S\s])/iS";
do {
- if ($this->mbstring_overload ? preg_match($yy_global_pattern, mb_substr($this->data, $this->counter,2000000000,'latin1'), $yymatches) : preg_match($yy_global_pattern,$this->data, $yymatches, null, $this->counter)) {
+ if (preg_match($yy_global_pattern, $this->data, $yymatches, null, $this->counter)) {
$yysubmatches = $yymatches;
$yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
if (!count($yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' .
- ' an empty string. Input "' . substr($this->data,
- $this->counter, 5) . '... state TRIPPLE');
+ ' an empty string. Input "' . substr($this->data,
+ $this->counter, 5) . '... state TRIPPLE');
}
next($yymatches); // skip global match
$this->token = key($yymatches); // token number
if ($tokenMap[$this->token]) {
// extract sub-patterns for passing to lex function
$yysubmatches = array_slice($yysubmatches, $this->token + 1,
- $tokenMap[$this->token]);
+ $tokenMap[$this->token]);
} else {
$yysubmatches = array();
}
$this->value = current($yymatches); // token value
$r = $this->{'yy_r6_' . $this->token}($yysubmatches);
if ($r === null) {
- $this->counter += ($this->mbstring_overload ? mb_strlen($this->value,'latin1'): strlen($this->value));
+ $this->counter += strlen($this->value);
$this->line += substr_count($this->value, "\n");
// accept this token
return true;
// process this token in the new state
return $this->yylex();
} elseif ($r === false) {
- $this->counter += ($this->mbstring_overload ? mb_strlen($this->value,'latin1'): strlen($this->value));
+ $this->counter += strlen($this->value);
$this->line += substr_count($this->value, "\n");
- if ($this->counter >= ($this->mbstring_overload ? mb_strlen($this->data,'latin1'): strlen($this->data))) {
+ if ($this->counter >= strlen($this->data)) {
return false; // end of input
}
// skip this token
continue;
- } } else {
+ }
+ } else {
throw new Exception('Unexpected input at line' . $this->line .
- ': ' . $this->data[$this->counter]);
+ ': ' . $this->data[$this->counter]);
}
break;
} while (true);
-
} // end function
-
const TRIPPLE = 6;
+
function yy_r6_1($yy_subpatterns)
{
- $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES_END;
- $this->yypopstate();
- $this->yypushstate(self::START);
+ $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_QUOTES_END;
+ $this->yypopstate();
+ $this->yypushstate(self::START);
}
+
function yy_r6_2($yy_subpatterns)
{
- if ($this->mbstring_overload) {
- $to = mb_strlen($this->data,'latin1');
- } else {
- $to = strlen($this->data);
- }
- preg_match("/\"\"\"[ \t\r]*[\n#;]/",$this->data,$match,PREG_OFFSET_CAPTURE,$this->counter);
- if (isset($match[0][1])) {
- $to = $match[0][1];
- } else {
- $this->compiler->trigger_template_error ("missing or misspelled literal closing tag");
- }
- if ($this->mbstring_overload) {
- $this->value = mb_substr($this->data,$this->counter,$to-$this->counter,'latin1');
- } else {
- $this->value = substr($this->data,$this->counter,$to-$this->counter);
- }
- $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_TEXT;
+ $to = strlen($this->data);
+ preg_match("/\"\"\"[ \t\r]*[\n#;]/", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
+ if (isset($match[0][1])) {
+ $to = $match[0][1];
+ } else {
+ $this->compiler->trigger_template_error("missing or misspelled literal closing tag");
+ }
+ $this->value = substr($this->data, $this->counter, $to - $this->counter);
+ $this->token = Smarty_Internal_Configfileparser::TPC_TRIPPLE_TEXT;
}
-
-
}
-?>
\ No newline at end of file
+
<?php
-/**
-* Smarty Internal Plugin Configfileparser
-*
-* This is the config file parser.
-* It is generated from the internal.configfileparser.y file
-* @package Smarty
-* @subpackage Compiler
-* @author Uwe Tews
-*/
+/**
+ * Smarty Internal Plugin Configfileparser
+ * This is the config file parser.
+ * It is generated from the internal.configfileparser.y file
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @author Uwe Tews
+ */
class TPC_yyToken implements ArrayAccess
{
public $string = '';
public $metadata = array();
- function __construct($s, $m = array())
+ public function __construct($s, $m = array())
{
if ($s instanceof TPC_yyToken) {
$this->string = $s->string;
}
}
- function __toString()
+ public function __toString()
{
return $this->_string;
}
- function offsetExists($offset)
+ public function offsetExists($offset)
{
return isset($this->metadata[$offset]);
}
- function offsetGet($offset)
+ public function offsetGet($offset)
{
return $this->metadata[$offset];
}
- function offsetSet($offset, $value)
+ public function offsetSet($offset, $value)
{
if ($offset === null) {
if (isset($value[0])) {
$x = ($value instanceof TPC_yyToken) ?
$value->metadata : $value;
$this->metadata = array_merge($this->metadata, $x);
+
return;
}
$offset = count($this->metadata);
}
}
- function offsetUnset($offset)
+ public function offsetUnset($offset)
{
unset($this->metadata[$offset]);
}
class TPC_yyStackEntry
{
- public $stateno; /* The state-number */
- public $major; /* The major token value. This is the code
+ public $stateno; /* The state-number */
+ public $major; /* The major token value. This is the code
** number for the token at this stack level */
public $minor; /* The user-supplied minor token value. This
** is the value of the token */
-};
+}
+;
#line 12 "smarty_internal_configfileparser.y"
-class Smarty_Internal_Configfileparser#line 79 "smarty_internal_configfileparser.php"
+class Smarty_Internal_Configfileparser #line 80 "smarty_internal_configfileparser.php"
{
-#line 14 "smarty_internal_configfileparser.y"
+ #line 14 "smarty_internal_configfileparser.y"
// states whether the parse was successful or not
public $successful = true;
private $lex;
private $internalError = false;
- function __construct($lex, $compiler) {
+ function __construct($lex, $compiler)
+ {
// set instance object
self::instance($this);
$this->lex = $lex;
$this->smarty = $compiler->smarty;
$this->compiler = $compiler;
}
+
public static function &instance($new_instance = null)
{
static $instance = null;
- if (isset($new_instance) && is_object($new_instance))
+ if (isset($new_instance) && is_object($new_instance)) {
$instance = $new_instance;
+ }
return $instance;
}
- private function parse_bool($str) {
- if (in_array(strtolower($str) ,array('on','yes','true'))) {
+ private function parse_bool($str)
+ {
+ if (in_array(strtolower($str), array('on', 'yes', 'true'))) {
$res = true;
} else {
$res = false;
}
private static $escapes_single = Array('\\' => '\\',
- '\'' => '\'');
- private static function parse_single_quoted_string($qstr) {
- $escaped_string = substr($qstr, 1, strlen($qstr)-2); //remove outer quotes
+ '\'' => '\'');
+
+ private static function parse_single_quoted_string($qstr)
+ {
+ $escaped_string = substr($qstr, 1, strlen($qstr) - 2); //remove outer quotes
- $ss = preg_split('/(\\\\.)/', $escaped_string, -1, PREG_SPLIT_DELIM_CAPTURE);
+ $ss = preg_split('/(\\\\.)/', $escaped_string, - 1, PREG_SPLIT_DELIM_CAPTURE);
$str = "";
foreach ($ss as $s) {
if (isset(self::$escapes_single[$s[1]])) {
$s = self::$escapes_single[$s[1]];
}
- }
+ }
- $str .= $s;
+ $str .= $s;
}
return $str;
}
- private static function parse_double_quoted_string($qstr) {
- $inner_str = substr($qstr, 1, strlen($qstr)-2);
+ private static function parse_double_quoted_string($qstr)
+ {
+ $inner_str = substr($qstr, 1, strlen($qstr) - 2);
return stripcslashes($inner_str);
}
- private static function parse_tripple_double_quoted_string($qstr) {
+ private static function parse_tripple_double_quoted_string($qstr)
+ {
return stripcslashes($qstr);
}
- private function set_var(Array $var, Array &$target_array) {
+ private function set_var(Array $var, Array &$target_array)
+ {
$key = $var["key"];
$value = $var["value"];
}
}
- private function add_global_vars(Array $vars) {
+ private function add_global_vars(Array $vars)
+ {
if (!isset($this->compiler->config_data['vars'])) {
- $this->compiler->config_data['vars'] = Array();
+ $this->compiler->config_data['vars'] = Array();
}
foreach ($vars as $var) {
$this->set_var($var, $this->compiler->config_data);
}
}
- private function add_section_vars($section_name, Array $vars) {
+ private function add_section_vars($section_name, Array $vars)
+ {
if (!isset($this->compiler->config_data['sections'][$section_name]['vars'])) {
$this->compiler->config_data['sections'][$section_name]['vars'] = Array();
}
$this->set_var($var, $this->compiler->config_data['sections'][$section_name]);
}
}
-#line 173 "smarty_internal_configfileparser.php"
-
- const TPC_OPENB = 1;
- const TPC_SECTION = 2;
- const TPC_CLOSEB = 3;
- const TPC_DOT = 4;
- const TPC_ID = 5;
- const TPC_EQUAL = 6;
- const TPC_FLOAT = 7;
- const TPC_INT = 8;
- const TPC_BOOL = 9;
- const TPC_SINGLE_QUOTED_STRING = 10;
- const TPC_DOUBLE_QUOTED_STRING = 11;
- const TPC_TRIPPLE_QUOTES = 12;
- const TPC_TRIPPLE_TEXT = 13;
- const TPC_TRIPPLE_QUOTES_END = 14;
- const TPC_NAKED_STRING = 15;
- const TPC_OTHER = 16;
- const TPC_NEWLINE = 17;
- const TPC_COMMENTSTART = 18;
+
+ #line 174 "smarty_internal_configfileparser.php"
+
+ const TPC_OPENB = 1;
+ const TPC_SECTION = 2;
+ const TPC_CLOSEB = 3;
+ const TPC_DOT = 4;
+ const TPC_ID = 5;
+ const TPC_EQUAL = 6;
+ const TPC_FLOAT = 7;
+ const TPC_INT = 8;
+ const TPC_BOOL = 9;
+ const TPC_SINGLE_QUOTED_STRING = 10;
+ const TPC_DOUBLE_QUOTED_STRING = 11;
+ const TPC_TRIPPLE_QUOTES = 12;
+ const TPC_TRIPPLE_TEXT = 13;
+ const TPC_TRIPPLE_QUOTES_END = 14;
+ const TPC_NAKED_STRING = 15;
+ const TPC_OTHER = 16;
+ const TPC_NEWLINE = 17;
+ const TPC_COMMENTSTART = 18;
const YY_NO_ACTION = 60;
const YY_ACCEPT_ACTION = 59;
const YY_ERROR_ACTION = 58;
const YY_SZ_ACTTAB = 38;
-static public $yy_action = array(
- /* 0 */ 29, 30, 34, 33, 24, 13, 19, 25, 35, 21,
- /* 10 */ 59, 8, 3, 1, 20, 12, 14, 31, 20, 12,
- /* 20 */ 15, 17, 23, 18, 27, 26, 4, 5, 6, 32,
- /* 30 */ 2, 11, 28, 22, 16, 9, 7, 10,
+ static public $yy_action = array(
+ /* 0 */
+ 29, 30, 34, 33, 24, 13, 19, 25, 35, 21,
+ /* 10 */
+ 59, 8, 3, 1, 20, 12, 14, 31, 20, 12,
+ /* 20 */
+ 15, 17, 23, 18, 27, 26, 4, 5, 6, 32,
+ /* 30 */
+ 2, 11, 28, 22, 16, 9, 7, 10,
);
static public $yy_lookahead = array(
- /* 0 */ 7, 8, 9, 10, 11, 12, 5, 27, 15, 16,
- /* 10 */ 20, 21, 23, 23, 17, 18, 13, 14, 17, 18,
- /* 20 */ 15, 2, 17, 4, 25, 26, 6, 3, 3, 14,
- /* 30 */ 23, 1, 24, 17, 2, 25, 22, 25,
-);
- const YY_SHIFT_USE_DFLT = -8;
+ /* 0 */
+ 7, 8, 9, 10, 11, 12, 5, 27, 15, 16,
+ /* 10 */
+ 20, 21, 23, 23, 17, 18, 13, 14, 17, 18,
+ /* 20 */
+ 15, 2, 17, 4, 25, 26, 6, 3, 3, 14,
+ /* 30 */
+ 23, 1, 24, 17, 2, 25, 22, 25,
+ );
+ const YY_SHIFT_USE_DFLT = - 8;
const YY_SHIFT_MAX = 19;
static public $yy_shift_ofst = array(
- /* 0 */ -8, 1, 1, 1, -7, -3, -3, 30, -8, -8,
- /* 10 */ -8, 19, 5, 3, 15, 16, 24, 25, 32, 20,
-);
- const YY_REDUCE_USE_DFLT = -21;
+ /* 0 */
+ - 8, 1, 1, 1, - 7, - 3, - 3, 30, - 8, - 8,
+ /* 10 */
+ - 8, 19, 5, 3, 15, 16, 24, 25, 32, 20,
+ );
+ const YY_REDUCE_USE_DFLT = - 21;
const YY_REDUCE_MAX = 10;
static public $yy_reduce_ofst = array(
- /* 0 */ -10, -1, -1, -1, -20, 10, 12, 8, 14, 7,
- /* 10 */ -11,
-);
+ /* 0 */
+ - 10, - 1, - 1, - 1, - 20, 10, 12, 8, 14, 7,
+ /* 10 */
+ - 11,
+ );
static public $yyExpectedTokens = array(
- /* 0 */ array(),
- /* 1 */ array(5, 17, 18, ),
- /* 2 */ array(5, 17, 18, ),
- /* 3 */ array(5, 17, 18, ),
- /* 4 */ array(7, 8, 9, 10, 11, 12, 15, 16, ),
- /* 5 */ array(17, 18, ),
- /* 6 */ array(17, 18, ),
- /* 7 */ array(1, ),
- /* 8 */ array(),
- /* 9 */ array(),
- /* 10 */ array(),
- /* 11 */ array(2, 4, ),
- /* 12 */ array(15, 17, ),
- /* 13 */ array(13, 14, ),
- /* 14 */ array(14, ),
- /* 15 */ array(17, ),
- /* 16 */ array(3, ),
- /* 17 */ array(3, ),
- /* 18 */ array(2, ),
- /* 19 */ array(6, ),
- /* 20 */ array(),
- /* 21 */ array(),
- /* 22 */ array(),
- /* 23 */ array(),
- /* 24 */ array(),
- /* 25 */ array(),
- /* 26 */ array(),
- /* 27 */ array(),
- /* 28 */ array(),
- /* 29 */ array(),
- /* 30 */ array(),
- /* 31 */ array(),
- /* 32 */ array(),
- /* 33 */ array(),
- /* 34 */ array(),
- /* 35 */ array(),
-);
+ /* 0 */
+ array(),
+ /* 1 */
+ array(5, 17, 18,),
+ /* 2 */
+ array(5, 17, 18,),
+ /* 3 */
+ array(5, 17, 18,),
+ /* 4 */
+ array(7, 8, 9, 10, 11, 12, 15, 16,),
+ /* 5 */
+ array(17, 18,),
+ /* 6 */
+ array(17, 18,),
+ /* 7 */
+ array(1,),
+ /* 8 */
+ array(),
+ /* 9 */
+ array(),
+ /* 10 */
+ array(),
+ /* 11 */
+ array(2, 4,),
+ /* 12 */
+ array(15, 17,),
+ /* 13 */
+ array(13, 14,),
+ /* 14 */
+ array(14,),
+ /* 15 */
+ array(17,),
+ /* 16 */
+ array(3,),
+ /* 17 */
+ array(3,),
+ /* 18 */
+ array(2,),
+ /* 19 */
+ array(6,),
+ /* 20 */
+ array(),
+ /* 21 */
+ array(),
+ /* 22 */
+ array(),
+ /* 23 */
+ array(),
+ /* 24 */
+ array(),
+ /* 25 */
+ array(),
+ /* 26 */
+ array(),
+ /* 27 */
+ array(),
+ /* 28 */
+ array(),
+ /* 29 */
+ array(),
+ /* 30 */
+ array(),
+ /* 31 */
+ array(),
+ /* 32 */
+ array(),
+ /* 33 */
+ array(),
+ /* 34 */
+ array(),
+ /* 35 */
+ array(),
+ );
static public $yy_default = array(
- /* 0 */ 44, 37, 41, 40, 58, 58, 58, 36, 39, 44,
- /* 10 */ 44, 58, 58, 58, 58, 58, 58, 58, 58, 58,
- /* 20 */ 55, 54, 57, 56, 50, 45, 43, 42, 38, 46,
- /* 30 */ 47, 52, 51, 49, 48, 53,
-);
+ /* 0 */
+ 44, 37, 41, 40, 58, 58, 58, 36, 39, 44,
+ /* 10 */
+ 44, 58, 58, 58, 58, 58, 58, 58, 58, 58,
+ /* 20 */
+ 55, 54, 57, 56, 50, 45, 43, 42, 38, 46,
+ /* 30 */
+ 47, 52, 51, 49, 48, 53,
+ );
const YYNOCODE = 29;
const YYSTACKDEPTH = 100;
const YYNSTATE = 36;
const YYERRORSYMBOL = 19;
const YYERRSYMDT = 'yy0';
const YYFALLBACK = 0;
- static public $yyFallback = array(
- );
- static function Trace($TraceFILE, $zTracePrompt)
+ public static $yyFallback = array();
+
+ public function Trace($TraceFILE, $zTracePrompt)
{
if (!$TraceFILE) {
$zTracePrompt = 0;
} elseif (!$zTracePrompt) {
$TraceFILE = 0;
}
- self::$yyTraceFILE = $TraceFILE;
- self::$yyTracePrompt = $zTracePrompt;
+ $this->yyTraceFILE = $TraceFILE;
+ $this->yyTracePrompt = $zTracePrompt;
}
- static function PrintTrace()
+ public function PrintTrace()
{
- self::$yyTraceFILE = fopen('php://output', 'w');
- self::$yyTracePrompt = '<br>';
+ $this->yyTraceFILE = fopen('php://output', 'w');
+ $this->yyTracePrompt = '<br>';
}
- static public $yyTraceFILE;
- static public $yyTracePrompt;
- public $yyidx; /* Index of top element in stack */
- public $yyerrcnt; /* Shifts left before out of the error */
- public $yystack = array(); /* The parser's stack */
+ public $yyTraceFILE;
+ public $yyTracePrompt;
+ public $yyidx; /* Index of top element in stack */
+ public $yyerrcnt; /* Shifts left before out of the error */
+ public $yystack = array(); /* The parser's stack */
public $yyTokenName = array(
- '$', 'OPENB', 'SECTION', 'CLOSEB',
- 'DOT', 'ID', 'EQUAL', 'FLOAT',
- 'INT', 'BOOL', 'SINGLE_QUOTED_STRING', 'DOUBLE_QUOTED_STRING',
- 'TRIPPLE_QUOTES', 'TRIPPLE_TEXT', 'TRIPPLE_QUOTES_END', 'NAKED_STRING',
- 'OTHER', 'NEWLINE', 'COMMENTSTART', 'error',
- 'start', 'global_vars', 'sections', 'var_list',
- 'section', 'newline', 'var', 'value',
+ '$', 'OPENB', 'SECTION', 'CLOSEB',
+ 'DOT', 'ID', 'EQUAL', 'FLOAT',
+ 'INT', 'BOOL', 'SINGLE_QUOTED_STRING', 'DOUBLE_QUOTED_STRING',
+ 'TRIPPLE_QUOTES', 'TRIPPLE_TEXT', 'TRIPPLE_QUOTES_END', 'NAKED_STRING',
+ 'OTHER', 'NEWLINE', 'COMMENTSTART', 'error',
+ 'start', 'global_vars', 'sections', 'var_list',
+ 'section', 'newline', 'var', 'value',
);
- static public $yyRuleName = array(
- /* 0 */ "start ::= global_vars sections",
- /* 1 */ "global_vars ::= var_list",
- /* 2 */ "sections ::= sections section",
- /* 3 */ "sections ::=",
- /* 4 */ "section ::= OPENB SECTION CLOSEB newline var_list",
- /* 5 */ "section ::= OPENB DOT SECTION CLOSEB newline var_list",
- /* 6 */ "var_list ::= var_list newline",
- /* 7 */ "var_list ::= var_list var",
- /* 8 */ "var_list ::=",
- /* 9 */ "var ::= ID EQUAL value",
- /* 10 */ "value ::= FLOAT",
- /* 11 */ "value ::= INT",
- /* 12 */ "value ::= BOOL",
- /* 13 */ "value ::= SINGLE_QUOTED_STRING",
- /* 14 */ "value ::= DOUBLE_QUOTED_STRING",
- /* 15 */ "value ::= TRIPPLE_QUOTES TRIPPLE_TEXT TRIPPLE_QUOTES_END",
- /* 16 */ "value ::= TRIPPLE_QUOTES TRIPPLE_QUOTES_END",
- /* 17 */ "value ::= NAKED_STRING",
- /* 18 */ "value ::= OTHER",
- /* 19 */ "newline ::= NEWLINE",
- /* 20 */ "newline ::= COMMENTSTART NEWLINE",
- /* 21 */ "newline ::= COMMENTSTART NAKED_STRING NEWLINE",
+ public static $yyRuleName = array(
+ /* 0 */
+ "start ::= global_vars sections",
+ /* 1 */
+ "global_vars ::= var_list",
+ /* 2 */
+ "sections ::= sections section",
+ /* 3 */
+ "sections ::=",
+ /* 4 */
+ "section ::= OPENB SECTION CLOSEB newline var_list",
+ /* 5 */
+ "section ::= OPENB DOT SECTION CLOSEB newline var_list",
+ /* 6 */
+ "var_list ::= var_list newline",
+ /* 7 */
+ "var_list ::= var_list var",
+ /* 8 */
+ "var_list ::=",
+ /* 9 */
+ "var ::= ID EQUAL value",
+ /* 10 */
+ "value ::= FLOAT",
+ /* 11 */
+ "value ::= INT",
+ /* 12 */
+ "value ::= BOOL",
+ /* 13 */
+ "value ::= SINGLE_QUOTED_STRING",
+ /* 14 */
+ "value ::= DOUBLE_QUOTED_STRING",
+ /* 15 */
+ "value ::= TRIPPLE_QUOTES TRIPPLE_TEXT TRIPPLE_QUOTES_END",
+ /* 16 */
+ "value ::= TRIPPLE_QUOTES TRIPPLE_QUOTES_END",
+ /* 17 */
+ "value ::= NAKED_STRING",
+ /* 18 */
+ "value ::= OTHER",
+ /* 19 */
+ "newline ::= NEWLINE",
+ /* 20 */
+ "newline ::= COMMENTSTART NEWLINE",
+ /* 21 */
+ "newline ::= COMMENTSTART NAKED_STRING NEWLINE",
);
- function tokenName($tokenType)
+ public function tokenName($tokenType)
{
if ($tokenType === 0) {
return 'End of Input';
}
}
- static function yy_destructor($yymajor, $yypminor)
+ public static function yy_destructor($yymajor, $yypminor)
{
switch ($yymajor) {
- default: break; /* If no destructor action specified: do nothing */
+ default:
+ break; /* If no destructor action specified: do nothing */
}
}
- function yy_pop_parser_stack()
+ public function yy_pop_parser_stack()
{
if (!count($this->yystack)) {
return;
}
$yytos = array_pop($this->yystack);
- if (self::$yyTraceFILE && $this->yyidx >= 0) {
- fwrite(self::$yyTraceFILE,
- self::$yyTracePrompt . 'Popping ' . $this->yyTokenName[$yytos->major] .
- "\n");
+ if ($this->yyTraceFILE && $this->yyidx >= 0) {
+ fwrite($this->yyTraceFILE,
+ $this->yyTracePrompt . 'Popping ' . $this->yyTokenName[$yytos->major] .
+ "\n");
}
$yymajor = $yytos->major;
self::yy_destructor($yymajor, $yytos->minor);
- $this->yyidx--;
+ $this->yyidx --;
+
return $yymajor;
}
- function __destruct()
+ public function __destruct()
{
while ($this->yystack !== Array()) {
$this->yy_pop_parser_stack();
}
- if (is_resource(self::$yyTraceFILE)) {
- fclose(self::$yyTraceFILE);
+ if (is_resource($this->yyTraceFILE)) {
+ fclose($this->yyTraceFILE);
}
}
- function yy_get_expected_tokens($token)
+ public function yy_get_expected_tokens($token)
{
$state = $this->yystack[$this->yyidx]->stateno;
$expected = self::$yyExpectedTokens[$state];
// reduce action
$done = 0;
do {
- if ($done++ == 100) {
+ if ($done ++ == 100) {
$this->yyidx = $yyidx;
$this->yystack = $stack;
// too much recursion prevents proper detection
$this->yystack[$this->yyidx]->stateno,
self::$yyRuleInfo[$yyruleno]['lhs']);
if (isset(self::$yyExpectedTokens[$nextstate])) {
- $expected = array_merge($expected, self::$yyExpectedTokens[$nextstate]);
- if (in_array($token,
- self::$yyExpectedTokens[$nextstate], true)) {
+ $expected = array_merge($expected, self::$yyExpectedTokens[$nextstate]);
+ if (in_array($token,
+ self::$yyExpectedTokens[$nextstate], true)) {
$this->yyidx = $yyidx;
$this->yystack = $stack;
+
return array_unique($expected);
}
}
if ($nextstate < self::YYNSTATE) {
// we need to shift a non-terminal
- $this->yyidx++;
+ $this->yyidx ++;
$x = new TPC_yyStackEntry;
$x->stateno = $nextstate;
$x->major = self::$yyRuleInfo[$yyruleno]['lhs'];
}
break;
} while (true);
- $this->yyidx = $yyidx;
- $this->yystack = $stack;
+ $this->yyidx = $yyidx;
+ $this->yystack = $stack;
+
return array_unique($expected);
}
- function yy_is_expected_token($token)
+ public function yy_is_expected_token($token)
{
if ($token === 0) {
return true; // 0 is not part of this
// reduce action
$done = 0;
do {
- if ($done++ == 100) {
+ if ($done ++ == 100) {
$this->yyidx = $yyidx;
$this->yystack = $stack;
// too much recursion prevents proper detection
$this->yystack[$this->yyidx]->stateno,
self::$yyRuleInfo[$yyruleno]['lhs']);
if (isset(self::$yyExpectedTokens[$nextstate]) &&
- in_array($token, self::$yyExpectedTokens[$nextstate], true)) {
+ in_array($token, self::$yyExpectedTokens[$nextstate], true)
+ ) {
$this->yyidx = $yyidx;
$this->yystack = $stack;
+
return true;
}
if ($nextstate < self::YYNSTATE) {
// we need to shift a non-terminal
- $this->yyidx++;
+ $this->yyidx ++;
$x = new TPC_yyStackEntry;
$x->stateno = $nextstate;
$x->major = self::$yyRuleInfo[$yyruleno]['lhs'];
} while (true);
$this->yyidx = $yyidx;
$this->yystack = $stack;
+
return true;
}
- function yy_find_shift_action($iLookAhead)
+ public function yy_find_shift_action($iLookAhead)
{
$stateno = $this->yystack[$this->yyidx]->stateno;
}
$i += $iLookAhead;
if ($i < 0 || $i >= self::YY_SZ_ACTTAB ||
- self::$yy_lookahead[$i] != $iLookAhead) {
+ self::$yy_lookahead[$i] != $iLookAhead
+ ) {
if (count(self::$yyFallback) && $iLookAhead < count(self::$yyFallback)
- && ($iFallback = self::$yyFallback[$iLookAhead]) != 0) {
- if (self::$yyTraceFILE) {
- fwrite(self::$yyTraceFILE, self::$yyTracePrompt . "FALLBACK " .
+ && ($iFallback = self::$yyFallback[$iLookAhead]) != 0
+ ) {
+ if ($this->yyTraceFILE) {
+ fwrite($this->yyTraceFILE, $this->yyTracePrompt . "FALLBACK " .
$this->yyTokenName[$iLookAhead] . " => " .
$this->yyTokenName[$iFallback] . "\n");
}
+
return $this->yy_find_shift_action($iFallback);
}
+
return self::$yy_default[$stateno];
} else {
return self::$yy_action[$i];
}
}
- function yy_find_reduce_action($stateno, $iLookAhead)
+ public function yy_find_reduce_action($stateno, $iLookAhead)
{
/* $stateno = $this->yystack[$this->yyidx]->stateno; */
}
$i += $iLookAhead;
if ($i < 0 || $i >= self::YY_SZ_ACTTAB ||
- self::$yy_lookahead[$i] != $iLookAhead) {
+ self::$yy_lookahead[$i] != $iLookAhead
+ ) {
return self::$yy_default[$stateno];
} else {
return self::$yy_action[$i];
}
}
- function yy_shift($yyNewState, $yyMajor, $yypMinor)
+ public function yy_shift($yyNewState, $yyMajor, $yypMinor)
{
- $this->yyidx++;
+ $this->yyidx ++;
if ($this->yyidx >= self::YYSTACKDEPTH) {
- $this->yyidx--;
- if (self::$yyTraceFILE) {
- fprintf(self::$yyTraceFILE, "%sStack Overflow!\n", self::$yyTracePrompt);
+ $this->yyidx --;
+ if ($this->yyTraceFILE) {
+ fprintf($this->yyTraceFILE, "%sStack Overflow!\n", $this->yyTracePrompt);
}
while ($this->yyidx >= 0) {
$this->yy_pop_parser_stack();
}
-#line 125 "smarty_internal_configfileparser.y"
+ #line 125 "smarty_internal_configfileparser.y"
+
+ $this->internalError = true;
+ $this->compiler->trigger_config_file_error("Stack overflow in configfile parser");
+ #line 601 "smarty_internal_configfileparser.php"
- $this->internalError = true;
- $this->compiler->trigger_config_file_error("Stack overflow in configfile parser");
-#line 593 "smarty_internal_configfileparser.php"
return;
}
$yytos = new TPC_yyStackEntry;
$yytos->major = $yyMajor;
$yytos->minor = $yypMinor;
array_push($this->yystack, $yytos);
- if (self::$yyTraceFILE && $this->yyidx > 0) {
- fprintf(self::$yyTraceFILE, "%sShift %d\n", self::$yyTracePrompt,
- $yyNewState);
- fprintf(self::$yyTraceFILE, "%sStack:", self::$yyTracePrompt);
- for($i = 1; $i <= $this->yyidx; $i++) {
- fprintf(self::$yyTraceFILE, " %s",
- $this->yyTokenName[$this->yystack[$i]->major]);
+ if ($this->yyTraceFILE && $this->yyidx > 0) {
+ fprintf($this->yyTraceFILE, "%sShift %d\n", $this->yyTracePrompt,
+ $yyNewState);
+ fprintf($this->yyTraceFILE, "%sStack:", $this->yyTracePrompt);
+ for ($i = 1; $i <= $this->yyidx; $i ++) {
+ fprintf($this->yyTraceFILE, " %s",
+ $this->yyTokenName[$this->yystack[$i]->major]);
}
- fwrite(self::$yyTraceFILE,"\n");
- }
- }
-
- static public $yyRuleInfo = array(
- array( 'lhs' => 20, 'rhs' => 2 ),
- array( 'lhs' => 21, 'rhs' => 1 ),
- array( 'lhs' => 22, 'rhs' => 2 ),
- array( 'lhs' => 22, 'rhs' => 0 ),
- array( 'lhs' => 24, 'rhs' => 5 ),
- array( 'lhs' => 24, 'rhs' => 6 ),
- array( 'lhs' => 23, 'rhs' => 2 ),
- array( 'lhs' => 23, 'rhs' => 2 ),
- array( 'lhs' => 23, 'rhs' => 0 ),
- array( 'lhs' => 26, 'rhs' => 3 ),
- array( 'lhs' => 27, 'rhs' => 1 ),
- array( 'lhs' => 27, 'rhs' => 1 ),
- array( 'lhs' => 27, 'rhs' => 1 ),
- array( 'lhs' => 27, 'rhs' => 1 ),
- array( 'lhs' => 27, 'rhs' => 1 ),
- array( 'lhs' => 27, 'rhs' => 3 ),
- array( 'lhs' => 27, 'rhs' => 2 ),
- array( 'lhs' => 27, 'rhs' => 1 ),
- array( 'lhs' => 27, 'rhs' => 1 ),
- array( 'lhs' => 25, 'rhs' => 1 ),
- array( 'lhs' => 25, 'rhs' => 2 ),
- array( 'lhs' => 25, 'rhs' => 3 ),
+ fwrite($this->yyTraceFILE, "\n");
+ }
+ }
+
+ public static $yyRuleInfo = array(
+ array('lhs' => 20, 'rhs' => 2),
+ array('lhs' => 21, 'rhs' => 1),
+ array('lhs' => 22, 'rhs' => 2),
+ array('lhs' => 22, 'rhs' => 0),
+ array('lhs' => 24, 'rhs' => 5),
+ array('lhs' => 24, 'rhs' => 6),
+ array('lhs' => 23, 'rhs' => 2),
+ array('lhs' => 23, 'rhs' => 2),
+ array('lhs' => 23, 'rhs' => 0),
+ array('lhs' => 26, 'rhs' => 3),
+ array('lhs' => 27, 'rhs' => 1),
+ array('lhs' => 27, 'rhs' => 1),
+ array('lhs' => 27, 'rhs' => 1),
+ array('lhs' => 27, 'rhs' => 1),
+ array('lhs' => 27, 'rhs' => 1),
+ array('lhs' => 27, 'rhs' => 3),
+ array('lhs' => 27, 'rhs' => 2),
+ array('lhs' => 27, 'rhs' => 1),
+ array('lhs' => 27, 'rhs' => 1),
+ array('lhs' => 25, 'rhs' => 1),
+ array('lhs' => 25, 'rhs' => 2),
+ array('lhs' => 25, 'rhs' => 3),
);
- static public $yyReduceMap = array(
- 0 => 0,
- 2 => 0,
- 3 => 0,
+ public static $yyReduceMap = array(
+ 0 => 0,
+ 2 => 0,
+ 3 => 0,
19 => 0,
20 => 0,
21 => 0,
- 1 => 1,
- 4 => 4,
- 5 => 5,
- 6 => 6,
- 7 => 7,
- 8 => 8,
- 9 => 9,
+ 1 => 1,
+ 4 => 4,
+ 5 => 5,
+ 6 => 6,
+ 7 => 7,
+ 8 => 8,
+ 9 => 9,
10 => 10,
11 => 11,
12 => 12,
17 => 17,
18 => 17,
);
-#line 131 "smarty_internal_configfileparser.y"
- function yy_r0(){
- $this->_retvalue = null;
- }
-#line 666 "smarty_internal_configfileparser.php"
-#line 136 "smarty_internal_configfileparser.y"
- function yy_r1(){
- $this->add_global_vars($this->yystack[$this->yyidx + 0]->minor); $this->_retvalue = null;
- }
-#line 671 "smarty_internal_configfileparser.php"
-#line 149 "smarty_internal_configfileparser.y"
- function yy_r4(){
- $this->add_section_vars($this->yystack[$this->yyidx + -3]->minor, $this->yystack[$this->yyidx + 0]->minor);
- $this->_retvalue = null;
- }
-#line 677 "smarty_internal_configfileparser.php"
-#line 154 "smarty_internal_configfileparser.y"
- function yy_r5(){
- if ($this->smarty->config_read_hidden) {
- $this->add_section_vars($this->yystack[$this->yyidx + -3]->minor, $this->yystack[$this->yyidx + 0]->minor);
- }
- $this->_retvalue = null;
- }
-#line 685 "smarty_internal_configfileparser.php"
-#line 162 "smarty_internal_configfileparser.y"
- function yy_r6(){
- $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor;
- }
-#line 690 "smarty_internal_configfileparser.php"
-#line 166 "smarty_internal_configfileparser.y"
- function yy_r7(){
- $this->_retvalue = array_merge($this->yystack[$this->yyidx + -1]->minor, Array($this->yystack[$this->yyidx + 0]->minor));
- }
-#line 695 "smarty_internal_configfileparser.php"
-#line 170 "smarty_internal_configfileparser.y"
- function yy_r8(){
- $this->_retvalue = Array();
- }
-#line 700 "smarty_internal_configfileparser.php"
-#line 176 "smarty_internal_configfileparser.y"
- function yy_r9(){
- $this->_retvalue = Array("key" => $this->yystack[$this->yyidx + -2]->minor, "value" => $this->yystack[$this->yyidx + 0]->minor);
- }
-#line 705 "smarty_internal_configfileparser.php"
-#line 181 "smarty_internal_configfileparser.y"
- function yy_r10(){
- $this->_retvalue = (float) $this->yystack[$this->yyidx + 0]->minor;
- }
-#line 710 "smarty_internal_configfileparser.php"
-#line 185 "smarty_internal_configfileparser.y"
- function yy_r11(){
- $this->_retvalue = (int) $this->yystack[$this->yyidx + 0]->minor;
- }
-#line 715 "smarty_internal_configfileparser.php"
-#line 189 "smarty_internal_configfileparser.y"
- function yy_r12(){
- $this->_retvalue = $this->parse_bool($this->yystack[$this->yyidx + 0]->minor);
- }
-#line 720 "smarty_internal_configfileparser.php"
-#line 193 "smarty_internal_configfileparser.y"
- function yy_r13(){
- $this->_retvalue = self::parse_single_quoted_string($this->yystack[$this->yyidx + 0]->minor);
- }
-#line 725 "smarty_internal_configfileparser.php"
-#line 197 "smarty_internal_configfileparser.y"
- function yy_r14(){
- $this->_retvalue = self::parse_double_quoted_string($this->yystack[$this->yyidx + 0]->minor);
- }
-#line 730 "smarty_internal_configfileparser.php"
-#line 201 "smarty_internal_configfileparser.y"
- function yy_r15(){
- $this->_retvalue = self::parse_tripple_double_quoted_string($this->yystack[$this->yyidx + -1]->minor);
- }
-#line 735 "smarty_internal_configfileparser.php"
-#line 205 "smarty_internal_configfileparser.y"
- function yy_r16(){
- $this->_retvalue = '';
- }
-#line 740 "smarty_internal_configfileparser.php"
-#line 209 "smarty_internal_configfileparser.y"
- function yy_r17(){
- $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor;
- }
-#line 745 "smarty_internal_configfileparser.php"
+
+ #line 131 "smarty_internal_configfileparser.y"
+ function yy_r0()
+ {
+ $this->_retvalue = null;
+ }
+ #line 675 "smarty_internal_configfileparser.php"
+ #line 136 "smarty_internal_configfileparser.y"
+ function yy_r1()
+ {
+ $this->add_global_vars($this->yystack[$this->yyidx + 0]->minor);
+ $this->_retvalue = null;
+ }
+ #line 680 "smarty_internal_configfileparser.php"
+ #line 149 "smarty_internal_configfileparser.y"
+ function yy_r4()
+ {
+ $this->add_section_vars($this->yystack[$this->yyidx + - 3]->minor, $this->yystack[$this->yyidx + 0]->minor);
+ $this->_retvalue = null;
+ }
+ #line 686 "smarty_internal_configfileparser.php"
+ #line 154 "smarty_internal_configfileparser.y"
+ function yy_r5()
+ {
+ if ($this->smarty->config_read_hidden) {
+ $this->add_section_vars($this->yystack[$this->yyidx + - 3]->minor, $this->yystack[$this->yyidx + 0]->minor);
+ }
+ $this->_retvalue = null;
+ }
+ #line 694 "smarty_internal_configfileparser.php"
+ #line 162 "smarty_internal_configfileparser.y"
+ function yy_r6()
+ {
+ $this->_retvalue = $this->yystack[$this->yyidx + - 1]->minor;
+ }
+ #line 699 "smarty_internal_configfileparser.php"
+ #line 166 "smarty_internal_configfileparser.y"
+ function yy_r7()
+ {
+ $this->_retvalue = array_merge($this->yystack[$this->yyidx + - 1]->minor, Array($this->yystack[$this->yyidx + 0]->minor));
+ }
+ #line 704 "smarty_internal_configfileparser.php"
+ #line 170 "smarty_internal_configfileparser.y"
+ function yy_r8()
+ {
+ $this->_retvalue = Array();
+ }
+ #line 709 "smarty_internal_configfileparser.php"
+ #line 176 "smarty_internal_configfileparser.y"
+ function yy_r9()
+ {
+ $this->_retvalue = Array("key" => $this->yystack[$this->yyidx + - 2]->minor, "value" => $this->yystack[$this->yyidx + 0]->minor);
+ }
+ #line 714 "smarty_internal_configfileparser.php"
+ #line 181 "smarty_internal_configfileparser.y"
+ function yy_r10()
+ {
+ $this->_retvalue = (float) $this->yystack[$this->yyidx + 0]->minor;
+ }
+ #line 719 "smarty_internal_configfileparser.php"
+ #line 185 "smarty_internal_configfileparser.y"
+ function yy_r11()
+ {
+ $this->_retvalue = (int) $this->yystack[$this->yyidx + 0]->minor;
+ }
+ #line 724 "smarty_internal_configfileparser.php"
+ #line 189 "smarty_internal_configfileparser.y"
+ function yy_r12()
+ {
+ $this->_retvalue = $this->parse_bool($this->yystack[$this->yyidx + 0]->minor);
+ }
+ #line 729 "smarty_internal_configfileparser.php"
+ #line 193 "smarty_internal_configfileparser.y"
+ function yy_r13()
+ {
+ $this->_retvalue = self::parse_single_quoted_string($this->yystack[$this->yyidx + 0]->minor);
+ }
+ #line 734 "smarty_internal_configfileparser.php"
+ #line 197 "smarty_internal_configfileparser.y"
+ function yy_r14()
+ {
+ $this->_retvalue = self::parse_double_quoted_string($this->yystack[$this->yyidx + 0]->minor);
+ }
+ #line 739 "smarty_internal_configfileparser.php"
+ #line 201 "smarty_internal_configfileparser.y"
+ function yy_r15()
+ {
+ $this->_retvalue = self::parse_tripple_double_quoted_string($this->yystack[$this->yyidx + - 1]->minor);
+ }
+ #line 744 "smarty_internal_configfileparser.php"
+ #line 205 "smarty_internal_configfileparser.y"
+ function yy_r16()
+ {
+ $this->_retvalue = '';
+ }
+ #line 749 "smarty_internal_configfileparser.php"
+ #line 209 "smarty_internal_configfileparser.y"
+ function yy_r17()
+ {
+ $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor;
+ }
+
+ #line 754 "smarty_internal_configfileparser.php"
private $_retvalue;
- function yy_reduce($yyruleno)
+ public function yy_reduce($yyruleno)
{
$yymsp = $this->yystack[$this->yyidx];
- if (self::$yyTraceFILE && $yyruleno >= 0
- && $yyruleno < count(self::$yyRuleName)) {
- fprintf(self::$yyTraceFILE, "%sReduce (%d) [%s].\n",
- self::$yyTracePrompt, $yyruleno,
- self::$yyRuleName[$yyruleno]);
+ if ($this->yyTraceFILE && $yyruleno >= 0
+ && $yyruleno < count(self::$yyRuleName)
+ ) {
+ fprintf($this->yyTraceFILE, "%sReduce (%d) [%s].\n",
+ $this->yyTracePrompt, $yyruleno,
+ self::$yyRuleName[$yyruleno]);
}
$this->_retvalue = $yy_lefthand_side = null;
$yygoto = self::$yyRuleInfo[$yyruleno]['lhs'];
$yysize = self::$yyRuleInfo[$yyruleno]['rhs'];
$this->yyidx -= $yysize;
- for($i = $yysize; $i; $i--) {
+ for ($i = $yysize; $i; $i --) {
// pop all of the right-hand side parameters
array_pop($this->yystack);
}
$yyact = $this->yy_find_reduce_action($this->yystack[$this->yyidx]->stateno, $yygoto);
if ($yyact < self::YYNSTATE) {
- if (!self::$yyTraceFILE && $yysize) {
- $this->yyidx++;
+ if (!$this->yyTraceFILE && $yysize) {
+ $this->yyidx ++;
$x = new TPC_yyStackEntry;
$x->stateno = $yyact;
$x->major = $yygoto;
}
}
- function yy_parse_failed()
+ public function yy_parse_failed()
{
- if (self::$yyTraceFILE) {
- fprintf(self::$yyTraceFILE, "%sFail!\n", self::$yyTracePrompt);
+ if ($this->yyTraceFILE) {
+ fprintf($this->yyTraceFILE, "%sFail!\n", $this->yyTracePrompt);
}
while ($this->yyidx >= 0) {
$this->yy_pop_parser_stack();
}
}
- function yy_syntax_error($yymajor, $TOKEN)
+ public function yy_syntax_error($yymajor, $TOKEN)
{
-#line 118 "smarty_internal_configfileparser.y"
+ #line 118 "smarty_internal_configfileparser.y"
- $this->internalError = true;
- $this->yymajor = $yymajor;
- $this->compiler->trigger_config_file_error();
-#line 808 "smarty_internal_configfileparser.php"
+ $this->internalError = true;
+ $this->yymajor = $yymajor;
+ $this->compiler->trigger_config_file_error();
+ #line 816 "smarty_internal_configfileparser.php"
}
- function yy_accept()
+ public function yy_accept()
{
- if (self::$yyTraceFILE) {
- fprintf(self::$yyTraceFILE, "%sAccept!\n", self::$yyTracePrompt);
+ if ($this->yyTraceFILE) {
+ fprintf($this->yyTraceFILE, "%sAccept!\n", $this->yyTracePrompt);
}
while ($this->yyidx >= 0) {
$stack = $this->yy_pop_parser_stack();
}
-#line 110 "smarty_internal_configfileparser.y"
+ #line 110 "smarty_internal_configfileparser.y"
- $this->successful = !$this->internalError;
- $this->internalError = false;
- $this->retvalue = $this->_retvalue;
- //echo $this->retvalue."\n\n";
-#line 826 "smarty_internal_configfileparser.php"
+ $this->successful = !$this->internalError;
+ $this->internalError = false;
+ $this->retvalue = $this->_retvalue;
+ //echo $this->retvalue."\n\n";
+ #line 833 "smarty_internal_configfileparser.php"
}
- function doParse($yymajor, $yytokenvalue)
+ public function doParse($yymajor, $yytokenvalue)
{
- $yyerrorhit = 0; /* True if yymajor has invoked an error */
+ $yyerrorhit = 0; /* True if yymajor has invoked an error */
if ($this->yyidx === null || $this->yyidx < 0) {
$this->yyidx = 0;
- $this->yyerrcnt = -1;
+ $this->yyerrcnt = - 1;
$x = new TPC_yyStackEntry;
$x->stateno = 0;
$x->major = 0;
$this->yystack = array();
array_push($this->yystack, $x);
}
- $yyendofinput = ($yymajor==0);
+ $yyendofinput = ($yymajor == 0);
- if (self::$yyTraceFILE) {
- fprintf(self::$yyTraceFILE, "%sInput %s\n",
- self::$yyTracePrompt, $this->yyTokenName[$yymajor]);
+ if ($this->yyTraceFILE) {
+ fprintf($this->yyTraceFILE, "%sInput %s\n",
+ $this->yyTracePrompt, $this->yyTokenName[$yymajor]);
}
do {
$yyact = $this->yy_find_shift_action($yymajor);
if ($yymajor < self::YYERRORSYMBOL &&
- !$this->yy_is_expected_token($yymajor)) {
+ !$this->yy_is_expected_token($yymajor)
+ ) {
// force a syntax error
$yyact = self::YY_ERROR_ACTION;
}
if ($yyact < self::YYNSTATE) {
$this->yy_shift($yyact, $yymajor, $yytokenvalue);
- $this->yyerrcnt--;
+ $this->yyerrcnt --;
if ($yyendofinput && $this->yyidx >= 0) {
$yymajor = 0;
} else {
} elseif ($yyact < self::YYNSTATE + self::YYNRULE) {
$this->yy_reduce($yyact - self::YYNSTATE);
} elseif ($yyact == self::YY_ERROR_ACTION) {
- if (self::$yyTraceFILE) {
- fprintf(self::$yyTraceFILE, "%sSyntax Error!\n",
- self::$yyTracePrompt);
+ if ($this->yyTraceFILE) {
+ fprintf($this->yyTraceFILE, "%sSyntax Error!\n",
+ $this->yyTracePrompt);
}
if (self::YYERRORSYMBOL) {
if ($this->yyerrcnt < 0) {
$this->yy_syntax_error($yymajor, $yytokenvalue);
}
$yymx = $this->yystack[$this->yyidx]->major;
- if ($yymx == self::YYERRORSYMBOL || $yyerrorhit ){
- if (self::$yyTraceFILE) {
- fprintf(self::$yyTraceFILE, "%sDiscard input token %s\n",
- self::$yyTracePrompt, $this->yyTokenName[$yymajor]);
+ if ($yymx == self::YYERRORSYMBOL || $yyerrorhit) {
+ if ($this->yyTraceFILE) {
+ fprintf($this->yyTraceFILE, "%sDiscard input token %s\n",
+ $this->yyTracePrompt, $this->yyTokenName[$yymajor]);
}
$this->yy_destructor($yymajor, $yytokenvalue);
$yymajor = self::YYNOCODE;
} else {
while ($this->yyidx >= 0 &&
- $yymx != self::YYERRORSYMBOL &&
- ($yyact = $this->yy_find_shift_action(self::YYERRORSYMBOL)) >= self::YYNSTATE
- ){
+ $yymx != self::YYERRORSYMBOL &&
+ ($yyact = $this->yy_find_shift_action(self::YYERRORSYMBOL)) >= self::YYNSTATE
+ ) {
$this->yy_pop_parser_stack();
}
- if ($this->yyidx < 0 || $yymajor==0) {
+ if ($this->yyidx < 0 || $yymajor == 0) {
$this->yy_destructor($yymajor, $yytokenvalue);
$this->yy_parse_failed();
$yymajor = self::YYNOCODE;
} while ($yymajor != self::YYNOCODE && $this->yyidx >= 0);
}
}
-?>
\ No newline at end of file
<?php
/**
* Smarty Internal Plugin Data
+ * This file contains the basic classes and methods for template and variable creation
*
- * This file contains the basic classes and methodes for template and variable creation
- *
- * @package Smarty
+ * @package Smarty
* @subpackage Template
- * @author Uwe Tews
+ * @author Uwe Tews
*/
/**
- * Base class with template and variable methodes
+ * Base class with template and variable methods
*
- * @package Smarty
+ * @package Smarty
* @subpackage Template
*/
-class Smarty_Internal_Data {
-
+class Smarty_Internal_Data
+{
/**
* name of class used for templates
*
/**
* assigns a Smarty variable
*
- * @param array|string $tpl_var the template variable name(s)
- * @param mixed $value the value to assign
- * @param boolean $nocache if true any output of this variable will be not cached
- * @param boolean $scope the scope the variable will have (local,parent or root)
+ * @param array|string $tpl_var the template variable name(s)
+ * @param mixed $value the value to assign
+ * @param boolean $nocache if true any output of this variable will be not cached
+ *
* @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining
*/
public function assign($tpl_var, $value = null, $nocache = false)
/**
* assigns a global Smarty variable
*
- * @param string $varname the global variable name
- * @param mixed $value the value to assign
- * @param boolean $nocache if true any output of this variable will be not cached
+ * @param string $varname the global variable name
+ * @param mixed $value the value to assign
+ * @param boolean $nocache if true any output of this variable will be not cached
+ *
* @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining
*/
public function assignGlobal($varname, $value = null, $nocache = false)
{
if ($varname != '') {
Smarty::$global_tpl_vars[$varname] = new Smarty_variable($value, $nocache);
+ $ptr = $this;
+ while ($ptr instanceof Smarty_Internal_Template) {
+ $ptr->tpl_vars[$varname] = clone Smarty::$global_tpl_vars[$varname];
+ $ptr = $ptr->parent;
+ }
}
return $this;
}
+
/**
* assigns values to template variables by reference
*
- * @param string $tpl_var the template variable name
- * @param mixed $ &$value the referenced value to assign
- * @param boolean $nocache if true any output of this variable will be not cached
+ * @param string $tpl_var the template variable name
+ * @param $value
+ * @param boolean $nocache if true any output of this variable will be not cached
+ *
* @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining
*/
public function assignByRef($tpl_var, &$value, $nocache = false)
{
if ($tpl_var != '') {
$this->tpl_vars[$tpl_var] = new Smarty_variable(null, $nocache);
- $this->tpl_vars[$tpl_var]->value = &$value;
+ $this->tpl_vars[$tpl_var]->value = & $value;
}
return $this;
/**
* appends values to template variables
*
- * @param array|string $tpl_var the template variable name(s)
- * @param mixed $value the value to append
- * @param boolean $merge flag if array elements shall be merged
- * @param boolean $nocache if true any output of this variable will be not cached
+ * @param array|string $tpl_var the template variable name(s)
+ * @param mixed $value the value to append
+ * @param boolean $merge flag if array elements shall be merged
+ * @param boolean $nocache if true any output of this variable will be not cached
+ *
* @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining
*/
public function append($tpl_var, $value = null, $merge = false, $nocache = false)
settype($this->tpl_vars[$_key]->value, 'array');
}
if ($merge && is_array($_val)) {
- foreach($_val as $_mkey => $_mval) {
+ foreach ($_val as $_mkey => $_mval) {
$this->tpl_vars[$_key]->value[$_mkey] = $_mval;
}
} else {
settype($this->tpl_vars[$tpl_var]->value, 'array');
}
if ($merge && is_array($value)) {
- foreach($value as $_mkey => $_mval) {
+ foreach ($value as $_mkey => $_mval) {
$this->tpl_vars[$tpl_var]->value[$_mkey] = $_mval;
}
} else {
/**
* appends values to template variables by reference
*
- * @param string $tpl_var the template variable name
- * @param mixed &$value the referenced value to append
- * @param boolean $merge flag if array elements shall be merged
+ * @param string $tpl_var the template variable name
+ * @param mixed &$value the referenced value to append
+ * @param boolean $merge flag if array elements shall be merged
+ *
* @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining
*/
public function appendByRef($tpl_var, &$value, $merge = false)
settype($this->tpl_vars[$tpl_var]->value, 'array');
}
if ($merge && is_array($value)) {
- foreach($value as $_key => $_val) {
- $this->tpl_vars[$tpl_var]->value[$_key] = &$value[$_key];
+ foreach ($value as $_key => $_val) {
+ $this->tpl_vars[$tpl_var]->value[$_key] = & $value[$_key];
}
} else {
- $this->tpl_vars[$tpl_var]->value[] = &$value;
+ $this->tpl_vars[$tpl_var]->value[] = & $value;
}
}
/**
* Returns a single or all template variables
*
- * @param string $varname variable name or null
- * @param string $_ptr optional pointer to data object
- * @param boolean $search_parents include parent templates?
- * @return string variable value or or array of variables
+ * @param string $varname variable name or null
+ * @param object $_ptr optional pointer to data object
+ * @param boolean $search_parents include parent templates?
+ *
+ * @return string variable value or or array of variables
*/
public function getTemplateVars($varname = null, $_ptr = null, $search_parents = true)
{
$_result = array();
if ($_ptr === null) {
$_ptr = $this;
- } while ($_ptr !== null) {
+ }
+ while ($_ptr !== null) {
foreach ($_ptr->tpl_vars AS $key => $var) {
if (!array_key_exists($key, $_result)) {
$_result[$key] = $var->value;
}
}
}
+
return $_result;
}
}
/**
* clear the given assigned template variable.
*
- * @param string|array $tpl_var the template variable(s) to clear
+ * @param string|array $tpl_var the template variable(s) to clear
+ *
* @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining
*/
public function clearAssign($tpl_var)
/**
* clear all the assigned template variables.
+ *
* @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining
*/
public function clearAllAssign()
{
$this->tpl_vars = array();
+
return $this;
}
/**
* load a config file, optionally load just selected sections
*
- * @param string $config_file filename
- * @param mixed $sections array of section names, single section or null
+ * @param string $config_file filename
+ * @param mixed $sections array of section names, single section or null
+ *
* @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining
*/
public function configLoad($config_file, $sections = null)
// load Config class
$config = new Smarty_Internal_Config($config_file, $this->smarty, $this);
$config->loadConfigVars($sections);
+
return $this;
}
/**
* gets the object of a Smarty variable
*
- * @param string $variable the name of the Smarty variable
- * @param object $_ptr optional pointer to data object
- * @param boolean $search_parents search also in parent data
- * @return object the object of the variable
+ * @param string $variable the name of the Smarty variable
+ * @param object $_ptr optional pointer to data object
+ * @param boolean $search_parents search also in parent data
+ * @param bool $error_enable
+ *
+ * @return object the object of the variable
*/
public function getVariable($variable, $_ptr = null, $search_parents = true, $error_enable = true)
{
if ($_ptr === null) {
$_ptr = $this;
- } while ($_ptr !== null) {
+ }
+ while ($_ptr !== null) {
if (isset($_ptr->tpl_vars[$variable])) {
// found it, return it
return $_ptr->tpl_vars[$variable];
// force a notice
$x = $$variable;
}
+
return new Undefined_Smarty_Variable;
}
/**
* gets a config variable
*
- * @param string $variable the name of the config variable
- * @return mixed the value of the config variable
+ * @param string $variable the name of the config variable
+ * @param bool $error_enable
+ *
+ * @return mixed the value of the config variable
*/
public function getConfigVariable($variable, $error_enable = true)
{
// force a notice
$x = $$variable;
}
+
return null;
}
/**
* gets a stream variable
*
- * @param string $variable the stream of the variable
- * @return mixed the value of the stream variable
+ * @param string $variable the stream of the variable
+ *
+ * @throws SmartyException
+ * @return mixed the value of the stream variable
*/
public function getStreamVariable($variable)
{
$_result = '';
$fp = fopen($variable, 'r+');
if ($fp) {
- while (!feof($fp) && ($current_line = fgets($fp)) !== false ) {
+ while (!feof($fp) && ($current_line = fgets($fp)) !== false) {
$_result .= $current_line;
}
fclose($fp);
+
return $_result;
}
/**
* Returns a single or all config variables
*
- * @param string $varname variable name or null
+ * @param string $varname variable name or null
+ * @param bool $search_parents
+ *
* @return string variable value or or array of variables
*/
public function getConfigVars($varname = null, $search_parents = true)
} else {
$var_array = array_merge($_ptr->config_vars, $var_array);
}
- // not found, try at parent
+ // not found, try at parent
if ($search_parents) {
$_ptr = $_ptr->parent;
} else {
/**
* Deassigns a single or all config variables
*
- * @param string $varname variable name or null
+ * @param string $varname variable name or null
+ *
* @return Smarty_Internal_Data current Smarty_Internal_Data (or Smarty or Smarty_Internal_Template) instance for chaining
*/
public function clearConfig($varname = null)
} else {
$this->config_vars = array();
}
+
return $this;
}
-
}
/**
* class for the Smarty data object
- *
* The Smarty data object will hold Smarty variables in the current scope
*
- * @package Smarty
+ * @package Smarty
* @subpackage Template
*/
-class Smarty_Data extends Smarty_Internal_Data {
-
+class Smarty_Data extends Smarty_Internal_Data
+{
/**
* Smarty object
*
/**
* create Smarty data object
*
- * @param Smarty|array $_parent parent template
- * @param Smarty $smarty global smarty instance
+ * @param Smarty|array $_parent parent template
+ * @param Smarty|Smarty_Internal_Template $smarty global smarty instance
+ *
+ * @throws SmartyException
*/
- public function __construct ($_parent = null, $smarty = null)
+ public function __construct($_parent = null, $smarty = null)
{
$this->smarty = $smarty;
if (is_object($_parent)) {
throw new SmartyException("Wrong type for template variables");
}
}
-
}
/**
* class for the Smarty variable object
- *
* This class defines the Smarty variable object
*
- * @package Smarty
+ * @package Smarty
* @subpackage Template
*/
-class Smarty_Variable {
-
+class Smarty_Variable
+{
/**
* template variable
*
{
return (string) $this->value;
}
-
}
/**
* class for undefined variable object
- *
* This class defines an object for undefined variable handling
*
- * @package Smarty
+ * @package Smarty
* @subpackage Template
*/
-class Undefined_Smarty_Variable {
-
+class Undefined_Smarty_Variable
+{
/**
* Returns FALSE for 'nocache' and NULL otherwise.
*
- * @param string $name
+ * @param string $name
+ *
* @return bool
*/
public function __get($name)
{
return "";
}
-
}
-
-?>
\ No newline at end of file
<?php
/**
* Smarty Internal Plugin Debug
- *
* Class to collect data for the Smarty Debugging Consol
*
- * @package Smarty
+ * @package Smarty
* @subpackage Debug
- * @author Uwe Tews
+ * @author Uwe Tews
*/
/**
* Smarty Internal Plugin Debug Class
*
- * @package Smarty
+ * @package Smarty
* @subpackage Debug
*/
-class Smarty_Internal_Debug extends Smarty_Internal_Data {
-
+class Smarty_Internal_Debug extends Smarty_Internal_Data
+{
/**
* template data
*
*/
public static $template_data = array();
+ /**
+ * List of uid's which shall be ignored
+ *
+ * @var array
+ */
+ public static $ignore_uid = array();
+
+ /**
+ * Ignore template
+ *
+ * @param object $template
+ */
+ public static function ignore($template)
+ {
+ // calculate Uid if not already done
+ if ($template->source->uid == '') {
+ $template->source->filepath;
+ }
+ self::$ignore_uid[$template->source->uid] = true;
+ }
+
/**
* Start logging of compile time
*
*/
public static function start_compile($template)
{
- $key = self::get_key($template);
+ static $_is_stringy = array('string' => true, 'eval' => true);
+ if (!empty($template->compiler->trace_uid)) {
+ $key = $template->compiler->trace_uid;
+ if (!isset(self::$template_data[$key])) {
+ if (isset($_is_stringy[$template->source->type])) {
+ self::$template_data[$key]['name'] = '\'' . substr($template->source->name, 0, 25) . '...\'';
+ } else {
+ self::$template_data[$key]['name'] = $template->source->filepath;
+ }
+ self::$template_data[$key]['compile_time'] = 0;
+ self::$template_data[$key]['render_time'] = 0;
+ self::$template_data[$key]['cache_time'] = 0;
+ }
+ } else {
+ if (isset(self::$ignore_uid[$template->source->uid])) {
+ return;
+ }
+ $key = self::get_key($template);
+ }
self::$template_data[$key]['start_time'] = microtime(true);
}
*/
public static function end_compile($template)
{
- $key = self::get_key($template);
+ if (!empty($template->compiler->trace_uid)) {
+ $key = $template->compiler->trace_uid;
+ } else {
+ if (isset(self::$ignore_uid[$template->source->uid])) {
+ return;
+ }
+
+ $key = self::get_key($template);
+ }
self::$template_data[$key]['compile_time'] += microtime(true) - self::$template_data[$key]['start_time'];
}
$smarty->left_delimiter = '{';
$smarty->right_delimiter = '}';
$smarty->debugging = false;
+ $smarty->debugging_ctrl = 'NONE';
$smarty->force_compile = false;
$_template = new Smarty_Internal_Template($smarty->debug_tpl, $smarty);
$_template->caching = false;
/**
* Recursively gets variables from all template/data scopes
*
- * @param Smarty_Internal_Template|Smarty_Data $obj object to debug
+ * @param Smarty_Internal_Template|Smarty_Data $obj object to debug
+ *
* @return StdClass
*/
public static function get_debug_vars($obj)
}
}
}
+
return (object) array('tpl_vars' => $tpl_vars, 'config_vars' => $config_vars);
}
/**
* Return key into $template_data for template
*
- * @param object $template template object
- * @return string key into $template_data
+ * @param object $template template object
+ *
+ * @return string key into $template_data
*/
private static function get_key($template)
{
return $key;
} else {
if (isset($_is_stringy[$template->source->type])) {
- self::$template_data[$key]['name'] = '\''.substr($template->source->name,0,25).'...\'';
+ self::$template_data[$key]['name'] = '\'' . substr($template->source->name, 0, 25) . '...\'';
} else {
self::$template_data[$key]['name'] = $template->source->filepath;
}
self::$template_data[$key]['compile_time'] = 0;
self::$template_data[$key]['render_time'] = 0;
self::$template_data[$key]['cache_time'] = 0;
+
return $key;
}
}
-
}
-
-?>
\ No newline at end of file
<?php
/**
* Smarty Internal Plugin Filter Handler
- *
* Smarty filter handler class
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsInternal
- * @author Uwe Tews
+ * @author Uwe Tews
*/
/**
* Class for filter processing
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsInternal
*/
-class Smarty_Internal_Filter_Handler {
-
+class Smarty_Internal_Filter_Handler
+{
/**
* Run filters over content
- *
* The filters will be lazy loaded if required
* class name format: Smarty_FilterType_FilterName
* plugin filename format: filtertype.filtername.php
* Smarty2 filter plugins could be used
*
- * @param string $type the type of filter ('pre','post','output') which shall run
- * @param string $content the content which shall be processed by the filters
- * @param Smarty_Internal_Template $template template object
- * @return string the filtered content
+ * @param string $type the type of filter ('pre','post','output') which shall run
+ * @param string $content the content which shall be processed by the filters
+ * @param Smarty_Internal_Template $template template object
+ *
+ * @throws SmartyException
+ * @return string the filtered content
*/
public static function runFilter($type, $content, Smarty_Internal_Template $template)
{
$output = $content;
// loop over autoload filters of specified type
if (!empty($template->smarty->autoload_filters[$type])) {
- foreach ((array)$template->smarty->autoload_filters[$type] as $name) {
+ foreach ((array) $template->smarty->autoload_filters[$type] as $name) {
$plugin_name = "Smarty_{$type}filter_{$name}";
if ($template->smarty->loadPlugin($plugin_name)) {
if (function_exists($plugin_name)) {
// return filtered output
return $output;
}
-
}
-
-?>
\ No newline at end of file
-<?php\r
-/**\r
- * Smarty Internal Plugin Function Call Handler\r
- *\r
- * @package Smarty\r
- * @subpackage PluginsInternal\r
- * @author Uwe Tews\r
- */\r
-\r
-/**\r
- * This class does call function defined with the {function} tag\r
- *\r
- * @package Smarty\r
- * @subpackage PluginsInternal\r
- */\r
-class Smarty_Internal_Function_Call_Handler {\r
-\r
- /**\r
- * This function handles calls to template functions defined by {function}\r
- * It does create a PHP function at the first call\r
- *\r
- * @param string $_name template function name\r
- * @param Smarty_Internal_Template $_template template object\r
- * @param array $_params Smarty variables passed as call parameter\r
- * @param string $_hash nocache hash value\r
- * @param bool $_nocache nocache flag\r
- */\r
- public static function call($_name, Smarty_Internal_Template $_template, $_params, $_hash, $_nocache)\r
- {\r
- if ($_nocache) {\r
- $_function = "smarty_template_function_{$_name}_nocache";\r
- } else {\r
- $_function = "smarty_template_function_{$_hash}_{$_name}";\r
- }\r
- if (!is_callable($_function)) {\r
- $_code = "function {$_function}(\$_smarty_tpl,\$params) {\r
- \$saved_tpl_vars = \$_smarty_tpl->tpl_vars;\r
- foreach (\$_smarty_tpl->smarty->template_functions['{$_name}']['parameter'] as \$key => \$value) {\$_smarty_tpl->tpl_vars[\$key] = new Smarty_variable(\$value);};\r
- foreach (\$params as \$key => \$value) {\$_smarty_tpl->tpl_vars[\$key] = new Smarty_variable(\$value);}?>";\r
- if ($_nocache) {\r
- $_code .= preg_replace(array("!<\?php echo \\'/\*%%SmartyNocache:{$_template->smarty->template_functions[$_name]['nocache_hash']}%%\*/|/\*/%%SmartyNocache:{$_template->smarty->template_functions[$_name]['nocache_hash']}%%\*/\\';\?>!",\r
- "!\\\'!"), array('', "'"), $_template->smarty->template_functions[$_name]['compiled']);\r
- $_template->smarty->template_functions[$_name]['called_nocache'] = true;\r
- } else {\r
- $_code .= preg_replace("/{$_template->smarty->template_functions[$_name]['nocache_hash']}/", $_template->properties['nocache_hash'], $_template->smarty->template_functions[$_name]['compiled']);\r
- }\r
- $_code .= "<?php \$_smarty_tpl->tpl_vars = \$saved_tpl_vars;}";\r
- eval($_code);\r
- }\r
- $_function($_template, $_params);\r
- }\r
-\r
-}\r
-\r
-?>\r
+<?php
+/**
+ * Smarty Internal Plugin Function Call Handler
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Uwe Tews
+ */
+
+/**
+ * This class does call function defined with the {function} tag
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ */
+class Smarty_Internal_Function_Call_Handler
+{
+ /**
+ * This function handles calls to template functions defined by {function}
+ * It does create a PHP function at the first call
+ *
+ * @param string $_name template function name
+ * @param Smarty_Internal_Template $_template template object
+ * @param array $_params Smarty variables passed as call parameter
+ * @param string $_hash nocache hash value
+ * @param bool $_nocache nocache flag
+ */
+ public static function call($_name, Smarty_Internal_Template $_template, $_params, $_hash, $_nocache)
+ {
+ if ($_nocache) {
+ $_function = "smarty_template_function_{$_name}_nocache";
+ } else {
+ $_function = "smarty_template_function_{$_hash}_{$_name}";
+ }
+ if (!is_callable($_function)) {
+ $_code = "function {$_function}(\$_smarty_tpl,\$params) {
+ \$saved_tpl_vars = \$_smarty_tpl->tpl_vars;
+ foreach (\$_smarty_tpl->smarty->template_functions['{$_name}']['parameter'] as \$key => \$value) {\$_smarty_tpl->tpl_vars[\$key] = new Smarty_variable(\$value);};
+ foreach (\$params as \$key => \$value) {\$_smarty_tpl->tpl_vars[\$key] = new Smarty_variable(\$value);}?>";
+ if ($_nocache) {
+ $_code .= preg_replace(array("!<\?php echo \\'/\*%%SmartyNocache:{$_template->smarty->template_functions[$_name]['nocache_hash']}%%\*/|/\*/%%SmartyNocache:{$_template->smarty->template_functions[$_name]['nocache_hash']}%%\*/\\';\?>!",
+ "!\\\'!"), array('', "'"), $_template->smarty->template_functions[$_name]['compiled']);
+ $_template->smarty->template_functions[$_name]['called_nocache'] = true;
+ } else {
+ $_code .= preg_replace("/{$_template->smarty->template_functions[$_name]['nocache_hash']}/", $_template->properties['nocache_hash'], $_template->smarty->template_functions[$_name]['compiled']);
+ }
+ $_code .= "<?php \$_smarty_tpl->tpl_vars = \$saved_tpl_vars;}";
+ eval($_code);
+ }
+ $_function($_template, $_params);
+ }
+}
-<?php\r
-/**\r
- * Smarty read include path plugin\r
- *\r
- * @package Smarty\r
- * @subpackage PluginsInternal\r
- * @author Monte Ohrt\r
- */\r
-\r
-/**\r
- * Smarty Internal Read Include Path Class\r
- *\r
- * @package Smarty\r
- * @subpackage PluginsInternal\r
- */\r
-class Smarty_Internal_Get_Include_Path {\r
-\r
- /**\r
- * Return full file path from PHP include_path\r
- *\r
- * @param string $filepath filepath\r
- * @return string|boolean full filepath or false\r
- */\r
- public static function getIncludePath($filepath)\r
- {\r
- static $_include_path = null;\r
- \r
- if (function_exists('stream_resolve_include_path')) {\r
- // available since PHP 5.3.2\r
- return stream_resolve_include_path($filepath);\r
- }\r
-\r
- if ($_include_path === null) {\r
- $_include_path = explode(PATH_SEPARATOR, get_include_path());\r
- }\r
-\r
- foreach ($_include_path as $_path) {\r
- if (file_exists($_path . DS . $filepath)) {\r
- return $_path . DS . $filepath;\r
- }\r
- }\r
-\r
- return false;\r
- }\r
-\r
-}\r
-\r
-?>
\ No newline at end of file
+<?php
+/**
+ * Smarty read include path plugin
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ * @author Monte Ohrt
+ */
+
+/**
+ * Smarty Internal Read Include Path Class
+ *
+ * @package Smarty
+ * @subpackage PluginsInternal
+ */
+class Smarty_Internal_Get_Include_Path
+{
+ /**
+ * Return full file path from PHP include_path
+ *
+ * @param string $filepath filepath
+ *
+ * @return string|boolean full filepath or false
+ */
+ public static function getIncludePath($filepath)
+ {
+ static $_include_path = null;
+
+ if (function_exists('stream_resolve_include_path')) {
+ // available since PHP 5.3.2
+ return stream_resolve_include_path($filepath);
+ }
+
+ if ($_include_path === null) {
+ $_include_path = explode(PATH_SEPARATOR, get_include_path());
+ }
+
+ foreach ($_include_path as $_path) {
+ if (file_exists($_path . DS . $filepath)) {
+ return $_path . DS . $filepath;
+ }
+ }
+
+ return false;
+ }
+}
-<?php\r
-/**\r
- * Smarty Internal Plugin Nocache Insert\r
- *\r
- * Compiles the {insert} tag into the cache file\r
- *\r
- * @package Smarty\r
- * @subpackage Compiler\r
- * @author Uwe Tews\r
- */\r
-\r
-/**\r
- * Smarty Internal Plugin Compile Insert Class\r
- *\r
- * @package Smarty\r
- * @subpackage Compiler\r
- */\r
-class Smarty_Internal_Nocache_Insert {\r
-\r
- /**\r
- * Compiles code for the {insert} tag into cache file\r
- *\r
- * @param string $_function insert function name\r
- * @param array $_attr array with parameter\r
- * @param Smarty_Internal_Template $_template template object\r
- * @param string $_script script name to load or 'null'\r
- * @param string $_assign optional variable name\r
- * @return string compiled code\r
- */\r
- public static function compile($_function, $_attr, $_template, $_script, $_assign = null)\r
- {\r
- $_output = '<?php ';\r
- if ($_script != 'null') {\r
- // script which must be included\r
- // code for script file loading\r
- $_output .= "require_once '{$_script}';";\r
- }\r
- // call insert\r
- if (isset($_assign)) {\r
- $_output .= "\$_smarty_tpl->assign('{$_assign}' , {$_function} (" . var_export($_attr, true) . ",\$_smarty_tpl), true);?>";\r
- } else {\r
- $_output .= "echo {$_function}(" . var_export($_attr, true) . ",\$_smarty_tpl);?>";\r
- }\r
- $_tpl = $_template;\r
- while ($_tpl->parent instanceof Smarty_Internal_Template) {\r
- $_tpl = $_tpl->parent;\r
- }\r
- return "/*%%SmartyNocache:{$_tpl->properties['nocache_hash']}%%*/" . $_output . "/*/%%SmartyNocache:{$_tpl->properties['nocache_hash']}%%*/";\r
- }\r
-\r
-}\r
-\r
-?>\r
+<?php
+/**
+ * Smarty Internal Plugin Nocache Insert
+ * Compiles the {insert} tag into the cache file
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @author Uwe Tews
+ */
+
+/**
+ * Smarty Internal Plugin Compile Insert Class
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ */
+class Smarty_Internal_Nocache_Insert
+{
+ /**
+ * Compiles code for the {insert} tag into cache file
+ *
+ * @param string $_function insert function name
+ * @param array $_attr array with parameter
+ * @param Smarty_Internal_Template $_template template object
+ * @param string $_script script name to load or 'null'
+ * @param string $_assign optional variable name
+ *
+ * @return string compiled code
+ */
+ public static function compile($_function, $_attr, $_template, $_script, $_assign = null)
+ {
+ $_output = '<?php ';
+ if ($_script != 'null') {
+ // script which must be included
+ // code for script file loading
+ $_output .= "require_once '{$_script}';";
+ }
+ // call insert
+ if (isset($_assign)) {
+ $_output .= "\$_smarty_tpl->assign('{$_assign}' , {$_function} (" . var_export($_attr, true) . ",\$_smarty_tpl), true);?>";
+ } else {
+ $_output .= "echo {$_function}(" . var_export($_attr, true) . ",\$_smarty_tpl);?>";
+ }
+ $_tpl = $_template;
+ while ($_tpl->parent instanceof Smarty_Internal_Template) {
+ $_tpl = $_tpl->parent;
+ }
+
+ return "/*%%SmartyNocache:{$_tpl->properties['nocache_hash']}%%*/" . $_output . "/*/%%SmartyNocache:{$_tpl->properties['nocache_hash']}%%*/";
+ }
+}
-<?php\r
-/**\r
- * Smarty Internal Plugin Templateparser Parsetrees\r
- *\r
- * These are classes to build parsetrees in the template parser\r
- *\r
- * @package Smarty\r
- * @subpackage Compiler\r
- * @author Thue Kristensen\r
- * @author Uwe Tews\r
- */\r
-\r
-/**\r
- * @package Smarty\r
- * @subpackage Compiler\r
- * @ignore\r
- */\r
-abstract class _smarty_parsetree {\r
-\r
- /**\r
- * Parser object\r
- * @var object\r
- */\r
- public $parser;\r
- /**\r
- * Buffer content\r
- * @var mixed\r
- */\r
- public $data;\r
-\r
- /**\r
- * Return buffer\r
- *\r
- * @return string buffer content\r
- */\r
- abstract public function to_smarty_php();\r
-\r
-}\r
-\r
-/**\r
- * A complete smarty tag.\r
- *\r
- * @package Smarty\r
- * @subpackage Compiler\r
- * @ignore\r
- */\r
-class _smarty_tag extends _smarty_parsetree {\r
-\r
- /**\r
- * Saved block nesting level\r
- * @var int\r
- */\r
- public $saved_block_nesting;\r
-\r
- /**\r
- * Create parse tree buffer for Smarty tag\r
- *\r
- * @param object $parser parser object\r
- * @param string $data content\r
- */\r
- public function __construct($parser, $data)\r
- {\r
- $this->parser = $parser;\r
- $this->data = $data;\r
- $this->saved_block_nesting = $parser->block_nesting_level;\r
- }\r
-\r
- /**\r
- * Return buffer content\r
- *\r
- * @return string content\r
- */\r
- public function to_smarty_php()\r
- {\r
- return $this->data;\r
- }\r
-\r
- /**\r
- * Return complied code that loads the evaluated outout of buffer content into a temporary variable\r
- *\r
- * @return string template code\r
- */\r
- public function assign_to_var()\r
- {\r
- $var = sprintf('$_tmp%d', ++$this->parser->prefix_number);\r
- $this->parser->compiler->prefix_code[] = sprintf('<?php ob_start();?>%s<?php %s=ob_get_clean();?>', $this->data, $var);\r
- return $var;\r
- }\r
-\r
-}\r
-\r
-/**\r
- * Code fragment inside a tag.\r
- *\r
- * @package Smarty\r
- * @subpackage Compiler\r
- * @ignore\r
- */\r
-class _smarty_code extends _smarty_parsetree {\r
-\r
-\r
- /**\r
- * Create parse tree buffer for code fragment\r
- *\r
- * @param object $parser parser object\r
- * @param string $data content\r
- */\r
- public function __construct($parser, $data)\r
- {\r
- $this->parser = $parser;\r
- $this->data = $data;\r
- }\r
-\r
- /**\r
- * Return buffer content in parentheses\r
- *\r
- * @return string content\r
- */\r
- public function to_smarty_php()\r
- {\r
- return sprintf("(%s)", $this->data);\r
- }\r
-\r
-}\r
-\r
-/**\r
- * Double quoted string inside a tag.\r
- *\r
- * @package Smarty\r
- * @subpackage Compiler\r
- * @ignore\r
- */\r
-class _smarty_doublequoted extends _smarty_parsetree {\r
-\r
- /**\r
- * Create parse tree buffer for double quoted string subtrees\r
- *\r
- * @param object $parser parser object\r
- * @param _smarty_parsetree $subtree parsetree buffer\r
- */\r
- public function __construct($parser, _smarty_parsetree $subtree)\r
- {\r
- $this->parser = $parser;\r
- $this->subtrees[] = $subtree;\r
- if ($subtree instanceof _smarty_tag) {\r
- $this->parser->block_nesting_level = count($this->parser->compiler->_tag_stack);\r
- }\r
- }\r
-\r
- /**\r
- * Append buffer to subtree\r
- *\r
- * @param _smarty_parsetree $subtree parsetree buffer\r
- */\r
- public function append_subtree(_smarty_parsetree $subtree)\r
- {\r
- $last_subtree = count($this->subtrees) - 1;\r
- if ($last_subtree >= 0 && $this->subtrees[$last_subtree] instanceof _smarty_tag && $this->subtrees[$last_subtree]->saved_block_nesting < $this->parser->block_nesting_level) {\r
- if ($subtree instanceof _smarty_code) {\r
- $this->subtrees[$last_subtree]->data .= '<?php echo ' . $subtree->data . ';?>';\r
- } elseif ($subtree instanceof _smarty_dq_content) {\r
- $this->subtrees[$last_subtree]->data .= '<?php echo "' . $subtree->data . '";?>';\r
- } else {\r
- $this->subtrees[$last_subtree]->data .= $subtree->data;\r
- }\r
- } else {\r
- $this->subtrees[] = $subtree;\r
- }\r
- if ($subtree instanceof _smarty_tag) {\r
- $this->parser->block_nesting_level = count($this->parser->compiler->_tag_stack);\r
- }\r
- }\r
-\r
- /**\r
- * Merge subtree buffer content together\r
- *\r
- * @return string compiled template code\r
- */\r
- public function to_smarty_php()\r
- {\r
- $code = '';\r
- foreach ($this->subtrees as $subtree) {\r
- if ($code !== "") {\r
- $code .= ".";\r
- }\r
- if ($subtree instanceof _smarty_tag) {\r
- $more_php = $subtree->assign_to_var();\r
- } else {\r
- $more_php = $subtree->to_smarty_php();\r
- }\r
-\r
- $code .= $more_php;\r
-\r
- if (!$subtree instanceof _smarty_dq_content) {\r
- $this->parser->compiler->has_variable_string = true;\r
- }\r
- }\r
- return $code;\r
- }\r
-\r
-}\r
-\r
-/**\r
- * Raw chars as part of a double quoted string.\r
- *\r
- * @package Smarty\r
- * @subpackage Compiler\r
- * @ignore\r
- */\r
-class _smarty_dq_content extends _smarty_parsetree {\r
-\r
-\r
- /**\r
- * Create parse tree buffer with string content\r
- *\r
- * @param object $parser parser object\r
- * @param string $data string section\r
- */\r
- public function __construct($parser, $data)\r
- {\r
- $this->parser = $parser;\r
- $this->data = $data;\r
- }\r
-\r
- /**\r
- * Return content as double quoted string\r
- *\r
- * @return string doubled quoted string\r
- */\r
- public function to_smarty_php()\r
- {\r
- return '"' . $this->data . '"';\r
- }\r
-\r
-}\r
-\r
-/**\r
- * Template element\r
- *\r
- * @package Smarty\r
- * @subpackage Compiler\r
- * @ignore\r
- */\r
-class _smarty_template_buffer extends _smarty_parsetree {\r
-\r
- /**\r
- * Array of template elements\r
- *\r
- * @var array\r
- */\r
- public $subtrees = Array();\r
-\r
- /**\r
- * Create root of parse tree for template elements\r
- *\r
- * @param object $parser parse object\r
- */\r
- public function __construct($parser)\r
- {\r
- $this->parser = $parser;\r
- }\r
-\r
- /**\r
- * Append buffer to subtree\r
- *\r
- * @param _smarty_parsetree $subtree\r
- */\r
- public function append_subtree(_smarty_parsetree $subtree)\r
- {\r
- $this->subtrees[] = $subtree;\r
- }\r
-\r
- /**\r
- * Sanitize and merge subtree buffers together\r
- *\r
- * @return string template code content\r
- */\r
- public function to_smarty_php()\r
- {\r
- $code = '';\r
- for ($key = 0, $cnt = count($this->subtrees); $key < $cnt; $key++) {\r
- if ($key + 2 < $cnt) {\r
- if ($this->subtrees[$key] instanceof _smarty_linebreak && $this->subtrees[$key + 1] instanceof _smarty_tag && $this->subtrees[$key + 1]->data == '' && $this->subtrees[$key + 2] instanceof _smarty_linebreak) {\r
- $key = $key + 1;\r
- continue;\r
- }\r
- if (substr($this->subtrees[$key]->data, -1) == '<' && $this->subtrees[$key + 1]->data == '' && substr($this->subtrees[$key + 2]->data, -1) == '?') {\r
- $key = $key + 2;\r
- continue;\r
- }\r
- }\r
- if (substr($code, -1) == '<') {\r
- $subtree = $this->subtrees[$key]->to_smarty_php();\r
- if (substr($subtree, 0, 1) == '?') {\r
- $code = substr($code, 0, strlen($code) - 1) . '<<?php ?>?' . substr($subtree, 1);\r
- } elseif ($this->parser->asp_tags && substr($subtree, 0, 1) == '%') {\r
- $code = substr($code, 0, strlen($code) - 1) . '<<?php ?>%' . substr($subtree, 1);\r
- } else {\r
- $code .= $subtree;\r
- }\r
- continue;\r
- }\r
- if ($this->parser->asp_tags && substr($code, -1) == '%') {\r
- $subtree = $this->subtrees[$key]->to_smarty_php();\r
- if (substr($subtree, 0, 1) == '>') {\r
- $code = substr($code, 0, strlen($code) - 1) . '%<?php ?>>' . substr($subtree, 1);\r
- } else {\r
- $code .= $subtree;\r
- }\r
- continue;\r
- }\r
- if (substr($code, -1) == '?') {\r
- $subtree = $this->subtrees[$key]->to_smarty_php();\r
- if (substr($subtree, 0, 1) == '>') {\r
- $code = substr($code, 0, strlen($code) - 1) . '?<?php ?>>' . substr($subtree, 1);\r
- } else {\r
- $code .= $subtree;\r
- }\r
- continue;\r
- }\r
- $code .= $this->subtrees[$key]->to_smarty_php();\r
- }\r
- return $code;\r
- }\r
-\r
-}\r
-\r
-/**\r
- * template text\r
- *\r
- * @package Smarty\r
- * @subpackage Compiler\r
- * @ignore\r
- */\r
-class _smarty_text extends _smarty_parsetree {\r
-\r
-\r
- /**\r
- * Create template text buffer\r
- *\r
- * @param object $parser parser object\r
- * @param string $data text\r
- */\r
- public function __construct($parser, $data)\r
- {\r
- $this->parser = $parser;\r
- $this->data = $data;\r
- }\r
-\r
- /**\r
- * Return buffer content\r
- *\r
- * @return strint text\r
- */\r
- public function to_smarty_php()\r
- {\r
- return $this->data;\r
- }\r
-\r
-}\r
-\r
-/**\r
- * template linebreaks\r
- *\r
- * @package Smarty\r
- * @subpackage Compiler\r
- * @ignore\r
- */\r
-class _smarty_linebreak extends _smarty_parsetree {\r
-\r
- /**\r
- * Create buffer with linebreak content\r
- *\r
- * @param object $parser parser object\r
- * @param string $data linebreak string\r
- */\r
- public function __construct($parser, $data)\r
- {\r
- $this->parser = $parser;\r
- $this->data = $data;\r
- }\r
-\r
- /**\r
- * Return linebrak\r
- *\r
- * @return string linebreak\r
- */\r
- public function to_smarty_php()\r
- {\r
- return $this->data;\r
- }\r
-\r
-}\r
-\r
-?>
\ No newline at end of file
+<?php
+/**
+ * Smarty Internal Plugin Templateparser Parsetrees
+ * These are classes to build parsetrees in the template parser
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @author Thue Kristensen
+ * @author Uwe Tews
+ */
+
+/**
+ * @package Smarty
+ * @subpackage Compiler
+ * @ignore
+ */
+abstract class _smarty_parsetree
+{
+ /**
+ * Parser object
+ *
+ * @var object
+ */
+ public $parser;
+ /**
+ * Buffer content
+ *
+ * @var mixed
+ */
+ public $data;
+
+ /**
+ * Subtree array
+ *
+ * @var array
+ */
+ public $subtrees = array();
+
+ /**
+ * Return buffer
+ *
+ * @return string buffer content
+ */
+ abstract public function to_smarty_php();
+}
+
+/**
+ * A complete smarty tag.
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @ignore
+ */
+class _smarty_tag extends _smarty_parsetree
+{
+ /**
+ * Saved block nesting level
+ *
+ * @var int
+ */
+ public $saved_block_nesting;
+
+ /**
+ * Create parse tree buffer for Smarty tag
+ *
+ * @param object $parser parser object
+ * @param string $data content
+ */
+ public function __construct($parser, $data)
+ {
+ $this->parser = $parser;
+ $this->data = $data;
+ $this->saved_block_nesting = $parser->block_nesting_level;
+ }
+
+ /**
+ * Return buffer content
+ *
+ * @return string content
+ */
+ public function to_smarty_php()
+ {
+ return $this->data;
+ }
+
+ /**
+ * Return complied code that loads the evaluated output of buffer content into a temporary variable
+ *
+ * @return string template code
+ */
+ public function assign_to_var()
+ {
+ $var = sprintf('$_tmp%d', ++Smarty_Internal_Templateparser::$prefix_number);
+ $this->parser->compiler->prefix_code[] = sprintf('<?php ob_start();?>%s<?php %s=ob_get_clean();?>', $this->data, $var);
+
+ return $var;
+ }
+}
+
+/**
+ * Code fragment inside a tag.
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @ignore
+ */
+class _smarty_code extends _smarty_parsetree
+{
+ /**
+ * Create parse tree buffer for code fragment
+ *
+ * @param object $parser parser object
+ * @param string $data content
+ */
+ public function __construct($parser, $data)
+ {
+ $this->parser = $parser;
+ $this->data = $data;
+ }
+
+ /**
+ * Return buffer content in parentheses
+ *
+ * @return string content
+ */
+ public function to_smarty_php()
+ {
+ return sprintf("(%s)", $this->data);
+ }
+}
+
+/**
+ * Double quoted string inside a tag.
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @ignore
+ */
+class _smarty_doublequoted extends _smarty_parsetree
+{
+ /**
+ * Create parse tree buffer for double quoted string subtrees
+ *
+ * @param object $parser parser object
+ * @param _smarty_parsetree $subtree parsetree buffer
+ */
+ public function __construct($parser, _smarty_parsetree $subtree)
+ {
+ $this->parser = $parser;
+ $this->subtrees[] = $subtree;
+ if ($subtree instanceof _smarty_tag) {
+ $this->parser->block_nesting_level = count($this->parser->compiler->_tag_stack);
+ }
+ }
+
+ /**
+ * Append buffer to subtree
+ *
+ * @param _smarty_parsetree $subtree parsetree buffer
+ */
+ public function append_subtree(_smarty_parsetree $subtree)
+ {
+ $last_subtree = count($this->subtrees) - 1;
+ if ($last_subtree >= 0 && $this->subtrees[$last_subtree] instanceof _smarty_tag && $this->subtrees[$last_subtree]->saved_block_nesting < $this->parser->block_nesting_level) {
+ if ($subtree instanceof _smarty_code) {
+ $this->subtrees[$last_subtree]->data .= '<?php echo ' . $subtree->data . ';?>';
+ } elseif ($subtree instanceof _smarty_dq_content) {
+ $this->subtrees[$last_subtree]->data .= '<?php echo "' . $subtree->data . '";?>';
+ } else {
+ $this->subtrees[$last_subtree]->data .= $subtree->data;
+ }
+ } else {
+ $this->subtrees[] = $subtree;
+ }
+ if ($subtree instanceof _smarty_tag) {
+ $this->parser->block_nesting_level = count($this->parser->compiler->_tag_stack);
+ }
+ }
+
+ /**
+ * Merge subtree buffer content together
+ *
+ * @return string compiled template code
+ */
+ public function to_smarty_php()
+ {
+ $code = '';
+ foreach ($this->subtrees as $subtree) {
+ if ($code !== "") {
+ $code .= ".";
+ }
+ if ($subtree instanceof _smarty_tag) {
+ $more_php = $subtree->assign_to_var();
+ } else {
+ $more_php = $subtree->to_smarty_php();
+ }
+
+ $code .= $more_php;
+
+ if (!$subtree instanceof _smarty_dq_content) {
+ $this->parser->compiler->has_variable_string = true;
+ }
+ }
+
+ return $code;
+ }
+}
+
+/**
+ * Raw chars as part of a double quoted string.
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @ignore
+ */
+class _smarty_dq_content extends _smarty_parsetree
+{
+ /**
+ * Create parse tree buffer with string content
+ *
+ * @param object $parser parser object
+ * @param string $data string section
+ */
+ public function __construct($parser, $data)
+ {
+ $this->parser = $parser;
+ $this->data = $data;
+ }
+
+ /**
+ * Return content as double quoted string
+ *
+ * @return string doubled quoted string
+ */
+ public function to_smarty_php()
+ {
+ return '"' . $this->data . '"';
+ }
+}
+
+/**
+ * Template element
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @ignore
+ */
+class _smarty_template_buffer extends _smarty_parsetree
+{
+ /**
+ * Array of template elements
+ *
+ * @var array
+ */
+ public $subtrees = Array();
+
+ /**
+ * Create root of parse tree for template elements
+ *
+ * @param object $parser parse object
+ */
+ public function __construct($parser)
+ {
+ $this->parser = $parser;
+ }
+
+ /**
+ * Append buffer to subtree
+ *
+ * @param _smarty_parsetree $subtree
+ */
+ public function append_subtree(_smarty_parsetree $subtree)
+ {
+ $this->subtrees[] = $subtree;
+ }
+
+ /**
+ * Sanitize and merge subtree buffers together
+ *
+ * @return string template code content
+ */
+ public function to_smarty_php()
+ {
+ $code = '';
+ for ($key = 0, $cnt = count($this->subtrees); $key < $cnt; $key ++) {
+ if ($key + 2 < $cnt) {
+ if ($this->subtrees[$key] instanceof _smarty_linebreak && $this->subtrees[$key + 1] instanceof _smarty_tag && $this->subtrees[$key + 1]->data == '' && $this->subtrees[$key + 2] instanceof _smarty_linebreak) {
+ $key = $key + 1;
+ continue;
+ }
+ if (substr($this->subtrees[$key]->data, - 1) == '<' && $this->subtrees[$key + 1]->data == '' && substr($this->subtrees[$key + 2]->data, - 1) == '?') {
+ $key = $key + 2;
+ continue;
+ }
+ }
+ if (substr($code, - 1) == '<') {
+ $subtree = $this->subtrees[$key]->to_smarty_php();
+ if (substr($subtree, 0, 1) == '?') {
+ $code = substr($code, 0, strlen($code) - 1) . '<<?php ?>?' . substr($subtree, 1);
+ } elseif ($this->parser->asp_tags && substr($subtree, 0, 1) == '%') {
+ $code = substr($code, 0, strlen($code) - 1) . '<<?php ?>%' . substr($subtree, 1);
+ } else {
+ $code .= $subtree;
+ }
+ continue;
+ }
+ if ($this->parser->asp_tags && substr($code, - 1) == '%') {
+ $subtree = $this->subtrees[$key]->to_smarty_php();
+ if (substr($subtree, 0, 1) == '>') {
+ $code = substr($code, 0, strlen($code) - 1) . '%<?php ?>>' . substr($subtree, 1);
+ } else {
+ $code .= $subtree;
+ }
+ continue;
+ }
+ if (substr($code, - 1) == '?') {
+ $subtree = $this->subtrees[$key]->to_smarty_php();
+ if (substr($subtree, 0, 1) == '>') {
+ $code = substr($code, 0, strlen($code) - 1) . '?<?php ?>>' . substr($subtree, 1);
+ } else {
+ $code .= $subtree;
+ }
+ continue;
+ }
+ $code .= $this->subtrees[$key]->to_smarty_php();
+ }
+
+ return $code;
+ }
+}
+
+/**
+ * template text
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @ignore
+ */
+class _smarty_text extends _smarty_parsetree
+{
+ /**
+ * Create template text buffer
+ *
+ * @param object $parser parser object
+ * @param string $data text
+ */
+ public function __construct($parser, $data)
+ {
+ $this->parser = $parser;
+ $this->data = $data;
+ }
+
+ /**
+ * Return buffer content
+ *
+ * @return strint text
+ */
+ public function to_smarty_php()
+ {
+ return $this->data;
+ }
+}
+
+/**
+ * template linebreaks
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @ignore
+ */
+class _smarty_linebreak extends _smarty_parsetree
+{
+ /**
+ * Create buffer with linebreak content
+ *
+ * @param object $parser parser object
+ * @param string $data linebreak string
+ */
+ public function __construct($parser, $data)
+ {
+ $this->parser = $parser;
+ $this->data = $data;
+ }
+
+ /**
+ * Return linebrak
+ *
+ * @return string linebreak
+ */
+ public function to_smarty_php()
+ {
+ return $this->data;
+ }
+}
-<?php\r
-/**\r
- * Smarty Internal Plugin Resource Eval\r
- *\r
- * @package Smarty\r
- * @subpackage TemplateResources\r
- * @author Uwe Tews\r
- * @author Rodney Rehm\r
- */\r
-\r
-/**\r
- * Smarty Internal Plugin Resource Eval\r
- *\r
- * Implements the strings as resource for Smarty template\r
- *\r
- * {@internal unlike string-resources the compiled state of eval-resources is NOT saved for subsequent access}}\r
- *\r
- * @package Smarty\r
- * @subpackage TemplateResources\r
- */\r
-class Smarty_Internal_Resource_Eval extends Smarty_Resource_Recompiled {\r
-\r
- /**\r
- * populate Source Object with meta data from Resource\r
- *\r
- * @param Smarty_Template_Source $source source object\r
- * @param Smarty_Internal_Template $_template template object\r
- * @return void\r
- */\r
- public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)\r
- {\r
- $source->uid = $source->filepath = sha1($source->name);\r
- $source->timestamp = false;\r
- $source->exists = true;\r
- }\r
-\r
- /**\r
- * Load template's source from $resource_name into current template object\r
- *\r
- * @uses decode() to decode base64 and urlencoded template_resources\r
- * @param Smarty_Template_Source $source source object\r
- * @return string template source\r
- */\r
- public function getContent(Smarty_Template_Source $source)\r
- {\r
- return $this->decode($source->name);\r
- }\r
- \r
- /**\r
- * decode base64 and urlencode\r
- *\r
- * @param string $string template_resource to decode\r
- * @return string decoded template_resource\r
- */\r
- protected function decode($string)\r
- {\r
- // decode if specified\r
- if (($pos = strpos($string, ':')) !== false) {\r
- if (!strncmp($string, 'base64', 6)) {\r
- return base64_decode(substr($string, 7));\r
- } elseif (!strncmp($string, 'urlencode', 9)) {\r
- return urldecode(substr($string, 10));\r
- }\r
- }\r
- \r
- return $string;\r
- }\r
- \r
- /**\r
- * modify resource_name according to resource handlers specifications\r
- *\r
- * @param Smarty $smarty Smarty instance\r
- * @param string $resource_name resource_name to make unique\r
- * @return string unique resource name\r
- */\r
- protected function buildUniqueResourceName(Smarty $smarty, $resource_name)\r
- {\r
- return get_class($this) . '#' .$this->decode($resource_name);\r
- }\r
-\r
- /**\r
- * Determine basename for compiled filename\r
- *\r
- * @param Smarty_Template_Source $source source object\r
- * @return string resource's basename\r
- */\r
- protected function getBasename(Smarty_Template_Source $source)\r
- {\r
- return '';\r
- }\r
-\r
-}\r
-\r
-?>
\ No newline at end of file
+<?php
+/**
+ * Smarty Internal Plugin Resource Eval
+ *
+ * @package Smarty
+ * @subpackage TemplateResources
+ * @author Uwe Tews
+ * @author Rodney Rehm
+ */
+
+/**
+ * Smarty Internal Plugin Resource Eval
+ * Implements the strings as resource for Smarty template
+ * {@internal unlike string-resources the compiled state of eval-resources is NOT saved for subsequent access}}
+ *
+ * @package Smarty
+ * @subpackage TemplateResources
+ */
+class Smarty_Internal_Resource_Eval extends Smarty_Resource_Recompiled
+{
+ /**
+ * populate Source Object with meta data from Resource
+ *
+ * @param Smarty_Template_Source $source source object
+ * @param Smarty_Internal_Template $_template template object
+ *
+ * @return void
+ */
+ public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
+ {
+ $source->uid = $source->filepath = sha1($source->name);
+ $source->timestamp = false;
+ $source->exists = true;
+ }
+
+ /**
+ * Load template's source from $resource_name into current template object
+ *
+ * @uses decode() to decode base64 and urlencoded template_resources
+ *
+ * @param Smarty_Template_Source $source source object
+ *
+ * @return string template source
+ */
+ public function getContent(Smarty_Template_Source $source)
+ {
+ return $this->decode($source->name);
+ }
+
+ /**
+ * decode base64 and urlencode
+ *
+ * @param string $string template_resource to decode
+ *
+ * @return string decoded template_resource
+ */
+ protected function decode($string)
+ {
+ // decode if specified
+ if (($pos = strpos($string, ':')) !== false) {
+ if (!strncmp($string, 'base64', 6)) {
+ return base64_decode(substr($string, 7));
+ } elseif (!strncmp($string, 'urlencode', 9)) {
+ return urldecode(substr($string, 10));
+ }
+ }
+
+ return $string;
+ }
+
+ /**
+ * modify resource_name according to resource handlers specifications
+ *
+ * @param Smarty $smarty Smarty instance
+ * @param string $resource_name resource_name to make unique
+ * @param boolean $is_config flag for config resource
+ *
+ * @return string unique resource name
+ */
+ protected function buildUniqueResourceName(Smarty $smarty, $resource_name, $is_config = false)
+ {
+ return get_class($this) . '#' . $this->decode($resource_name);
+ }
+
+ /**
+ * Determine basename for compiled filename
+ *
+ * @param Smarty_Template_Source $source source object
+ *
+ * @return string resource's basename
+ */
+ protected function getBasename(Smarty_Template_Source $source)
+ {
+ return '';
+ }
+}
<?php
/**
-* Smarty Internal Plugin Resource Extends
-*
-* @package Smarty
-* @subpackage TemplateResources
-* @author Uwe Tews
-* @author Rodney Rehm
-*/
+ * Smarty Internal Plugin Resource Extends
+ *
+ * @package Smarty
+ * @subpackage TemplateResources
+ * @author Uwe Tews
+ * @author Rodney Rehm
+ */
/**
-* Smarty Internal Plugin Resource Extends
-*
-* Implements the file system as resource for Smarty which {extend}s a chain of template files templates
-*
-* @package Smarty
-* @subpackage TemplateResources
-*/
-class Smarty_Internal_Resource_Extends extends Smarty_Resource {
-
+ * Smarty Internal Plugin Resource Extends
+ * Implements the file system as resource for Smarty which {extend}s a chain of template files templates
+ *
+ * @package Smarty
+ * @subpackage TemplateResources
+ */
+class Smarty_Internal_Resource_Extends extends Smarty_Resource
+{
/**
- * mbstring.overload flag
- *
- * @var int
- */
+ * mbstring.overload flag
+ *
+ * @var int
+ */
public $mbstring_overload = 0;
/**
- * populate Source Object with meta data from Resource
- *
- * @param Smarty_Template_Source $source source object
- * @param Smarty_Internal_Template $_template template object
- */
- public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)
+ * populate Source Object with meta data from Resource
+ *
+ * @param Smarty_Template_Source $source source object
+ * @param Smarty_Internal_Template $_template template object
+ *
+ * @throws SmartyException
+ */
+ public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
{
$uid = '';
$sources = array();
}
$source->components = $sources;
$source->filepath = $s->filepath;
- $source->uid = sha1($uid);
+ $source->uid = sha1(realpath($uid));
if ($_template && $_template->smarty->compile_check) {
$source->timestamp = $s->timestamp;
$source->exists = $exists;
}
/**
- * populate Source Object with timestamp and exists from Resource
- *
- * @param Smarty_Template_Source $source source object
- */
+ * populate Source Object with timestamp and exists from Resource
+ *
+ * @param Smarty_Template_Source $source source object
+ */
public function populateTimestamp(Smarty_Template_Source $source)
{
$source->exists = true;
}
/**
- * Load template's source from files into current template object
- *
- * @param Smarty_Template_Source $source source object
- * @return string template source
- * @throws SmartyException if source cannot be loaded
- */
+ * Load template's source from files into current template object
+ *
+ * @param Smarty_Template_Source $source source object
+ *
+ * @return string template source
+ * @throws SmartyException if source cannot be loaded
+ */
public function getContent(Smarty_Template_Source $source)
{
if (!$source->exists) {
throw new SmartyException("Unable to read template {$source->type} '{$source->name}'");
}
- $this->mbstring_overload = ini_get('mbstring.func_overload') & 2;
- $_rdl = preg_quote($source->smarty->right_delimiter);
- $_ldl = preg_quote($source->smarty->left_delimiter);
$_components = array_reverse($source->components);
- $_first = reset($_components);
- $_last = end($_components);
+ $_content = '';
foreach ($_components as $_component) {
- // register dependency
- if ($_component != $_first) {
- $source->template->properties['file_dependency'][$_component->uid] = array($_component->filepath, $_component->timestamp, $_component->type);
- }
-
// read content
- $source->filepath = $_component->filepath;
- $_content = $_component->content;
-
- // extend sources
- if ($_component != $_last) {
- if (preg_match_all("!({$_ldl}block\s(.+?){$_rdl})!", $_content, $_open) !=
- preg_match_all("!({$_ldl}/block{$_rdl})!", $_content, $_close)) {
- throw new SmartyException("unmatched {block} {/block} pairs in template {$_component->type} '{$_component->name}'");
- }
- preg_match_all("!{$_ldl}block\s(.+?){$_rdl}|{$_ldl}/block{$_rdl}|{$_ldl}\*([\S\s]*?)\*{$_rdl}!", $_content, $_result, PREG_OFFSET_CAPTURE);
- $_result_count = count($_result[0]);
- $_start = 0;
- while ($_start+1 < $_result_count) {
- $_end = 0;
- $_level = 1;
- if (($this->mbstring_overload ? mb_substr($_result[0][$_start][0],0,mb_strlen($source->smarty->left_delimiter,'latin1')+1, 'latin1') : substr($_result[0][$_start][0],0,strlen($source->smarty->left_delimiter)+1)) == $source->smarty->left_delimiter.'*') {
- $_start++;
- continue;
- }
- while ($_level != 0) {
- $_end++;
- if (($this->mbstring_overload ? mb_substr($_result[0][$_start + $_end][0],0,mb_strlen($source->smarty->left_delimiter,'latin1')+1, 'latin1') : substr($_result[0][$_start + $_end][0],0,strlen($source->smarty->left_delimiter)+1)) == $source->smarty->left_delimiter.'*') {
- continue;
- }
- if (!strpos($_result[0][$_start + $_end][0], '/')) {
- $_level++;
- } else {
- $_level--;
- }
- }
- $_block_content = str_replace($source->smarty->left_delimiter . '$smarty.block.parent' . $source->smarty->right_delimiter, '%%%%SMARTY_PARENT%%%%',
- ($this->mbstring_overload ? mb_substr($_content, $_result[0][$_start][1] + mb_strlen($_result[0][$_start][0], 'latin1'), $_result[0][$_start + $_end][1] - $_result[0][$_start][1] - + mb_strlen($_result[0][$_start][0], 'latin1'), 'latin1') : substr($_content, $_result[0][$_start][1] + strlen($_result[0][$_start][0]), $_result[0][$_start + $_end][1] - $_result[0][$_start][1] - + strlen($_result[0][$_start][0]))));
- Smarty_Internal_Compile_Block::saveBlockData($_block_content, $_result[0][$_start][0], $source->template, $_component->filepath);
- $_start = $_start + $_end + 1;
- }
- } else {
- return $_content;
- }
+ $_content .= $_component->content;
}
+ return $_content;
}
/**
- * Determine basename for compiled filename
- *
- * @param Smarty_Template_Source $source source object
- * @return string resource's basename
- */
+ * Determine basename for compiled filename
+ *
+ * @param Smarty_Template_Source $source source object
+ *
+ * @return string resource's basename
+ */
public function getBasename(Smarty_Template_Source $source)
{
return str_replace(':', '.', basename($source->filepath));
}
-
}
-
-?>
\ No newline at end of file
/**
* Smarty Internal Plugin Resource File
*
- * @package Smarty
+ * @package Smarty
* @subpackage TemplateResources
- * @author Uwe Tews
- * @author Rodney Rehm
+ * @author Uwe Tews
+ * @author Rodney Rehm
*/
/**
* Smarty Internal Plugin Resource File
- *
* Implements the file system as resource for Smarty templates
*
- * @package Smarty
+ * @package Smarty
* @subpackage TemplateResources
*/
-class Smarty_Internal_Resource_File extends Smarty_Resource {
-
+class Smarty_Internal_Resource_File extends Smarty_Resource
+{
/**
* populate Source Object with meta data from Resource
*
* @param Smarty_Template_Source $source source object
* @param Smarty_Internal_Template $_template template object
*/
- public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)
+ public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
{
$source->filepath = $this->buildFilepath($source, $_template);
$source->smarty->security_policy->isTrustedResourceDir($source->filepath);
}
- $source->uid = sha1($source->filepath);
+ $source->uid = sha1(realpath($source->filepath));
if ($source->smarty->compile_check && !isset($source->timestamp)) {
$source->timestamp = @filemtime($source->filepath);
$source->exists = !!$source->timestamp;
/**
* Load template's source from file into current template object
*
- * @param Smarty_Template_Source $source source object
- * @return string template source
- * @throws SmartyException if source cannot be loaded
+ * @param Smarty_Template_Source $source source object
+ *
+ * @return string template source
+ * @throws SmartyException if source cannot be loaded
*/
public function getContent(Smarty_Template_Source $source)
{
/**
* Determine basename for compiled filename
*
- * @param Smarty_Template_Source $source source object
- * @return string resource's basename
+ * @param Smarty_Template_Source $source source object
+ *
+ * @return string resource's basename
*/
public function getBasename(Smarty_Template_Source $source)
{
if (($_pos = strpos($_file, ']')) !== false) {
$_file = substr($_file, $_pos + 1);
}
+
return basename($_file);
}
-
}
-
-?>
\ No newline at end of file
/**
* Smarty Internal Plugin Resource PHP
- *
* Implements the file system as resource for PHP templates
*
- * @package Smarty
+ * @package Smarty
* @subpackage TemplateResources
- * @author Uwe Tews
- * @author Rodney Rehm
+ * @author Uwe Tews
+ * @author Rodney Rehm
*/
-class Smarty_Internal_Resource_PHP extends Smarty_Resource_Uncompiled {
+class Smarty_Internal_Resource_PHP extends Smarty_Resource_Uncompiled
+{
/**
* container for short_open_tag directive's value before executing PHP templates
+ *
* @var string
*/
protected $short_open_tag;
/**
* Create a new PHP Resource
- *
+
*/
public function __construct()
{
- $this->short_open_tag = ini_get( 'short_open_tag' );
+ $this->short_open_tag = ini_get('short_open_tag');
}
/**
* populate Source Object with meta data from Resource
*
- * @param Smarty_Template_Source $source source object
- * @param Smarty_Internal_Template $_template template object
+ * @param Smarty_Template_Source $source source object
+ * @param Smarty_Internal_Template $_template template object
+ *
* @return void
*/
- public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)
+ public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
{
$source->filepath = $this->buildFilepath($source, $_template);
/**
* populate Source Object with timestamp and exists from Resource
*
- * @param Smarty_Template_Source $source source object
+ * @param Smarty_Template_Source $source source object
+ *
* @return void
*/
public function populateTimestamp(Smarty_Template_Source $source)
/**
* Load template's source from file into current template object
*
- * @param Smarty_Template_Source $source source object
- * @return string template source
- * @throws SmartyException if source cannot be loaded
+ * @param Smarty_Template_Source $source source object
+ *
+ * @return string template source
+ * @throws SmartyException if source cannot be loaded
*/
public function getContent(Smarty_Template_Source $source)
{
/**
* Render and output the template (without using the compiler)
*
- * @param Smarty_Template_Source $source source object
- * @param Smarty_Internal_Template $_template template object
+ * @param Smarty_Template_Source $source source object
+ * @param Smarty_Internal_Template $_template template object
+ *
* @return void
- * @throws SmartyException if template cannot be loaded or allow_php_templates is disabled
+ * @throws SmartyException if template cannot be loaded or allow_php_templates is disabled
*/
public function renderUncompiled(Smarty_Template_Source $source, Smarty_Internal_Template $_template)
{
- $_smarty_template = $_template;
-
if (!$source->smarty->allow_php_templates) {
throw new SmartyException("PHP templates are disabled");
}
extract($_template->getTemplateVars());
// include PHP template with short open tags enabled
- ini_set( 'short_open_tag', '1' );
+ ini_set('short_open_tag', '1');
+ /** @var Smarty_Internal_Template $_smarty_template
+ * used in included file
+ */
+ $_smarty_template = $_template;
include($source->filepath);
- ini_set( 'short_open_tag', $this->short_open_tag );
+ ini_set('short_open_tag', $this->short_open_tag);
}
}
-
-?>
\ No newline at end of file
/**
* Smarty Internal Plugin Resource Registered
*
- * @package Smarty
+ * @package Smarty
* @subpackage TemplateResources
- * @author Uwe Tews
- * @author Rodney Rehm
+ * @author Uwe Tews
+ * @author Rodney Rehm
*/
/**
* Smarty Internal Plugin Resource Registered
- *
* Implements the registered resource for Smarty template
*
- * @package Smarty
+ * @package Smarty
* @subpackage TemplateResources
* @deprecated
*/
-class Smarty_Internal_Resource_Registered extends Smarty_Resource {
-
+class Smarty_Internal_Resource_Registered extends Smarty_Resource
+{
/**
* populate Source Object with meta data from Resource
*
- * @param Smarty_Template_Source $source source object
- * @param Smarty_Internal_Template $_template template object
+ * @param Smarty_Template_Source $source source object
+ * @param Smarty_Internal_Template $_template template object
+ *
* @return void
*/
- public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)
+ public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
{
$source->filepath = $source->type . ':' . $source->name;
$source->uid = sha1($source->filepath);
/**
* populate Source Object with timestamp and exists from Resource
*
- * @param Smarty_Template_Source $source source object
+ * @param Smarty_Template_Source $source source object
+ *
* @return void
*/
public function populateTimestamp(Smarty_Template_Source $source)
/**
* Get timestamp (epoch) the template source was modified
*
- * @param Smarty_Template_Source $source source object
- * @return integer|boolean timestamp (epoch) the template was modified, false if resources has no timestamp
+ * @param Smarty_Template_Source $source source object
+ *
+ * @return integer|boolean timestamp (epoch) the template was modified, false if resources has no timestamp
*/
public function getTemplateTimestamp(Smarty_Template_Source $source)
{
// return timestamp
$time_stamp = false;
call_user_func_array($source->smarty->registered_resources[$source->type][0][1], array($source->name, &$time_stamp, $source->smarty));
+
return is_numeric($time_stamp) ? (int) $time_stamp : $time_stamp;
}
/**
* Load template's source by invoking the registered callback into current template object
*
- * @param Smarty_Template_Source $source source object
- * @return string template source
- * @throws SmartyException if source cannot be loaded
+ * @param Smarty_Template_Source $source source object
+ *
+ * @return string template source
+ * @throws SmartyException if source cannot be loaded
*/
public function getContent(Smarty_Template_Source $source)
{
if (is_bool($t) && !$t) {
throw new SmartyException("Unable to read template {$source->type} '{$source->name}'");
}
+
return $source->content;
}
/**
* Determine basename for compiled filename
*
- * @param Smarty_Template_Source $source source object
- * @return string resource's basename
+ * @param Smarty_Template_Source $source source object
+ *
+ * @return string resource's basename
*/
protected function getBasename(Smarty_Template_Source $source)
{
return basename($source->name);
}
-
}
-
-?>
\ No newline at end of file
<?php
/**
* Smarty Internal Plugin Resource Stream
- *
* Implements the streams as resource for Smarty template
*
- * @package Smarty
+ * @package Smarty
* @subpackage TemplateResources
- * @author Uwe Tews
- * @author Rodney Rehm
+ * @author Uwe Tews
+ * @author Rodney Rehm
*/
/**
* Smarty Internal Plugin Resource Stream
- *
* Implements the streams as resource for Smarty template
*
- * @link http://php.net/streams
- * @package Smarty
+ * @link http://php.net/streams
+ * @package Smarty
* @subpackage TemplateResources
*/
-class Smarty_Internal_Resource_Stream extends Smarty_Resource_Recompiled {
-
+class Smarty_Internal_Resource_Stream extends Smarty_Resource_Recompiled
+{
/**
* populate Source Object with meta data from Resource
*
* @param Smarty_Template_Source $source source object
* @param Smarty_Internal_Template $_template template object
+ *
* @return void
*/
- public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)
+ public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
{
- $source->filepath = str_replace(':', '://', $source->resource);
+ if (strpos($source->resource, '://') !== false) {
+ $source->filepath = $source->resource;
+ } else {
+ $source->filepath = str_replace(':', '://', $source->resource);
+ }
$source->uid = false;
$source->content = $this->getContent($source);
$source->timestamp = false;
* Load template's source from stream into current template object
*
* @param Smarty_Template_Source $source source object
+ *
* @return string template source
* @throws SmartyException if source cannot be loaded
*/
$t .= $current_line;
}
fclose($fp);
+
return $t;
} else {
return false;
}
}
-
+
/**
* modify resource_name according to resource handlers specifications
*
- * @param Smarty $smarty Smarty instance
- * @param string $resource_name resource_name to make unique
+ * @param Smarty $smarty Smarty instance
+ * @param string $resource_name resource_name to make unique
+ * @param boolean $is_config flag for config resource
+ *
* @return string unique resource name
*/
- protected function buildUniqueResourceName(Smarty $smarty, $resource_name)
+ protected function buildUniqueResourceName(Smarty $smarty, $resource_name, $is_config = false)
{
return get_class($this) . '#' . $resource_name;
}
}
-
-?>
\ No newline at end of file
/**
* Smarty Internal Plugin Resource String
*
- * @package Smarty
+ * @package Smarty
* @subpackage TemplateResources
- * @author Uwe Tews
- * @author Rodney Rehm
+ * @author Uwe Tews
+ * @author Rodney Rehm
*/
/**
* Smarty Internal Plugin Resource String
- *
* Implements the strings as resource for Smarty template
- *
* {@internal unlike eval-resources the compiled state of string-resources is saved for subsequent access}}
*
- * @package Smarty
+ * @package Smarty
* @subpackage TemplateResources
*/
-class Smarty_Internal_Resource_String extends Smarty_Resource {
-
+class Smarty_Internal_Resource_String extends Smarty_Resource
+{
/**
* populate Source Object with meta data from Resource
*
- * @param Smarty_Template_Source $source source object
- * @param Smarty_Internal_Template $_template template object
+ * @param Smarty_Template_Source $source source object
+ * @param Smarty_Internal_Template $_template template object
+ *
* @return void
*/
- public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)
+ public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
{
$source->uid = $source->filepath = sha1($source->name);
$source->timestamp = 0;
* Load template's source from $resource_name into current template object
*
* @uses decode() to decode base64 and urlencoded template_resources
- * @param Smarty_Template_Source $source source object
- * @return string template source
+ *
+ * @param Smarty_Template_Source $source source object
+ *
+ * @return string template source
*/
public function getContent(Smarty_Template_Source $source)
{
return $this->decode($source->name);
}
-
+
/**
* decode base64 and urlencode
*
- * @param string $string template_resource to decode
+ * @param string $string template_resource to decode
+ *
* @return string decoded template_resource
*/
protected function decode($string)
return urldecode(substr($string, 10));
}
}
-
+
return $string;
}
-
+
/**
* modify resource_name according to resource handlers specifications
*
- * @param Smarty $smarty Smarty instance
- * @param string $resource_name resource_name to make unique
+ * @param Smarty $smarty Smarty instance
+ * @param string $resource_name resource_name to make unique
+ * @param boolean $is_config flag for config resource
+ *
* @return string unique resource name
*/
- protected function buildUniqueResourceName(Smarty $smarty, $resource_name)
+ protected function buildUniqueResourceName(Smarty $smarty, $resource_name, $is_config = false)
{
- return get_class($this) . '#' .$this->decode($resource_name);
+ return get_class($this) . '#' . $this->decode($resource_name);
}
/**
* Determine basename for compiled filename
- *
* Always returns an empty string.
*
- * @param Smarty_Template_Source $source source object
- * @return string resource's basename
+ * @param Smarty_Template_Source $source source object
+ *
+ * @return string resource's basename
*/
protected function getBasename(Smarty_Template_Source $source)
{
return '';
}
-
}
-
-?>
\ No newline at end of file
<?php
/**
* Smarty Internal Plugin Smarty Template Compiler Base
+ * This file contains the basic classes and methods for compiling Smarty templates with lexer/parser
*
- * This file contains the basic classes and methodes for compiling Smarty templates with lexer/parser
- *
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
- * @author Uwe Tews
+ * @author Uwe Tews
*/
/**
* @ignore
*/
-include ("smarty_internal_parsetree.php");
+include 'smarty_internal_parsetree.php';
/**
* Class SmartyTemplateCompiler
*
- * @package Smarty
+ * @package Smarty
* @subpackage Compiler
*/
-class Smarty_Internal_SmartyTemplateCompiler extends Smarty_Internal_TemplateCompilerBase {
-
+class Smarty_Internal_SmartyTemplateCompiler extends Smarty_Internal_TemplateCompilerBase
+{
/**
* Lexer class name
*
}
/**
- * Methode to compile a Smarty template
+ * method to compile a Smarty template
*
* @param mixed $_content template source
- * @return bool true if compiling succeeded, false if it failed
+ *
+ * @return bool true if compiling succeeded, false if it failed
*/
protected function doCompile($_content)
{
// init the lexer/parser to compile the template
$this->lex = new $this->lexer_class($_content, $this);
$this->parser = new $this->parser_class($this->lex, $this);
- if ($this->smarty->_parserdebug)
+ if ($this->inheritance_child) {
+ // start state on child templates
+ $this->lex->yypushstate(Smarty_Internal_Templatelexer::CHILDBODY);
+ }
+ if (function_exists('mb_internal_encoding') && ((int) ini_get('mbstring.func_overload')) & 2) {
+ $mbEncoding = mb_internal_encoding();
+ mb_internal_encoding('ASCII');
+ } else {
+ $mbEncoding = null;
+ }
+
+ if ($this->smarty->_parserdebug) {
$this->parser->PrintTrace();
+ $this->lex->PrintTrace();
+ }
// get tokens from lexer and parse them
while ($this->lex->yylex() && !$this->abort_and_recompile) {
if ($this->smarty->_parserdebug) {
}
// finish parsing process
$this->parser->doParse(0, 0);
+ if ($mbEncoding) {
+ mb_internal_encoding($mbEncoding);
+ }
// check for unclosed tags
if (count($this->_tag_stack) > 0) {
// get stacked info
list($openTag, $_data) = array_pop($this->_tag_stack);
- $this->trigger_template_error("unclosed {" . $openTag . "} tag");
+ $this->trigger_template_error("unclosed {$this->smarty->left_delimiter}" . $openTag . "{$this->smarty->right_delimiter} tag");
}
// return compiled code
// return str_replace(array("? >\n<?php","? ><?php"), array('',''), $this->parser->retvalue);
return $this->parser->retvalue;
}
-
}
-
-?>
\ No newline at end of file
<?php
/**
* Smarty Internal Plugin Template
- *
* This file contains the Smarty template engine
*
- * @package Smarty
+ * @package Smarty
* @subpackage Template
- * @author Uwe Tews
+ * @author Uwe Tews
*/
/**
* Main class with template data structures and methods
*
- * @package Smarty
+ * @package Smarty
* @subpackage Template
- *
* @property Smarty_Template_Source $source
* @property Smarty_Template_Compiled $compiled
* @property Smarty_Template_Cached $cached
*/
-class Smarty_Internal_Template extends Smarty_Internal_TemplateBase {
-
+class Smarty_Internal_Template extends Smarty_Internal_TemplateBase
+{
/**
* cache_id
+ *
* @var string
*/
public $cache_id = null;
public $compile_id = null;
/**
* caching enabled
+ *
* @var boolean
*/
public $caching = null;
/**
* cache lifetime in seconds
+ *
* @var integer
*/
public $cache_lifetime = null;
/**
* Template resource
+ *
* @var string
*/
public $template_resource = null;
/**
* flag if compiled template is invalid and must be (re)compiled
+ *
* @var bool
*/
public $mustCompile = null;
/**
* flag if template does contain nocache code sections
+ *
* @var bool
*/
public $has_nocache_code = false;
/**
* special compiled and cached template properties
+ *
* @var array
*/
public $properties = array('file_dependency' => array(),
- 'nocache_hash' => '',
- 'function' => array());
+ 'nocache_hash' => '',
+ 'function' => array());
/**
* required plugins
+ *
* @var array
*/
public $required_plugins = array('compiled' => array(), 'nocache' => array());
/**
* Global smarty instance
+ *
* @var Smarty
*/
public $smarty = null;
/**
* blocks for template inheritance
+ *
* @var array
*/
public $block_data = array();
/**
* variable filters
+ *
* @var array
*/
public $variable_filters = array();
/**
* optional log of tag/attributes
+ *
* @var array
*/
public $used_tags = array();
/**
* internal flag to allow relative path in child template blocks
+ *
* @var bool
*/
public $allow_relative_path = false;
/**
* internal capture runtime stack
+ *
* @var array
*/
public $_capture_stack = array(0 => array());
/**
* Create template data object
- *
* Some of the global Smarty settings copied to template scope
* It load the required template resources and cacher plugins
*
* @param string $template_resource template resource string
* @param Smarty $smarty Smarty instance
* @param Smarty_Internal_Template $_parent back pointer to parent object with variables or null
- * @param mixed $_cache_id cache id or null
+ * @param mixed $_cache_id cache id or null
* @param mixed $_compile_id compile id or null
* @param bool $_caching use caching?
* @param int $_cache_lifetime cache life-time in seconds
*/
public function __construct($template_resource, $smarty, $_parent = null, $_cache_id = null, $_compile_id = null, $_caching = null, $_cache_lifetime = null)
{
- $this->smarty = &$smarty;
+ $this->smarty = & $smarty;
// Smarty parameter
$this->cache_id = $_cache_id === null ? $this->smarty->cache_id : $_cache_id;
$this->compile_id = $_compile_id === null ? $this->smarty->compile_id : $_compile_id;
$this->caching = $_caching === null ? $this->smarty->caching : $_caching;
- if ($this->caching === true)
+ if ($this->caching === true) {
$this->caching = Smarty::CACHING_LIFETIME_CURRENT;
+ }
$this->cache_lifetime = $_cache_lifetime === null ? $this->smarty->cache_lifetime : $_cache_lifetime;
$this->parent = $_parent;
// Template resource
/**
* Returns if the current template must be compiled by the Smarty compiler
- *
* It does compare the timestamps of template source and the compiled templates and checks the force compile configuration
*
+ * @throws SmartyException
* @return boolean true if the template must be compiled
*/
public function mustCompile()
$this->mustCompile = (!$this->source->uncompiled && ($this->smarty->force_compile || $this->source->recompiled || $this->compiled->timestamp === false ||
($this->smarty->compile_check && $this->compiled->timestamp < $this->source->timestamp)));
}
+
return $this->mustCompile;
}
/**
* Compiles the template
- *
* If the template is not evaluated the compiled template is saved on disk
*/
public function compileTemplateSource()
if (!$this->source->recompiled) {
$this->properties['file_dependency'] = array();
if ($this->source->components) {
+ // for the extends resource the compiler will fill it
// uses real resource for file dependency
- $source = end($this->source->components);
- $this->properties['file_dependency'][$this->source->uid] = array($this->source->filepath, $this->source->timestamp, $source->type);
+ // $source = end($this->source->components);
+ // $this->properties['file_dependency'][$this->source->uid] = array($this->source->filepath, $this->source->timestamp, $source->type);
} else {
$this->properties['file_dependency'][$this->source->uid] = array($this->source->filepath, $this->source->timestamp, $this->source->type);
}
}
- if ($this->smarty->debugging) {
- Smarty_Internal_Debug::start_compile($this);
- }
// compile locking
if ($this->smarty->compile_locking && !$this->source->recompiled) {
if ($saved_timestamp = $this->compiled->timestamp) {
// call compiler
try {
$code = $this->compiler->compileTemplate($this);
- } catch (Exception $e) {
+ }
+ catch (Exception $e) {
// restore old timestamp in case of error
if ($this->smarty->compile_locking && !$this->source->recompiled && $saved_timestamp) {
touch($this->compiled->filepath, $saved_timestamp);
if (!$this->source->recompiled && $this->compiler->write_compiled_code) {
// write compiled template
$_filepath = $this->compiled->filepath;
- if ($_filepath === false)
+ if ($_filepath === false) {
throw new SmartyException('getCompiledFilepath() did not return a destination to save the compiled template to');
+ }
Smarty_Internal_Write_File::writeFile($_filepath, $code, $this->smarty);
$this->compiled->exists = true;
$this->compiled->isCompiled = true;
}
- if ($this->smarty->debugging) {
- Smarty_Internal_Debug::end_compile($this);
- }
// release compiler object to free memory
unset($this->compiler);
}
/**
* Writes the cached template output
*
+ * @param string $content
+ *
* @return bool
*/
public function writeCachedContent($content)
return false;
}
$this->properties['cache_lifetime'] = $this->cache_lifetime;
- $this->properties['unifunc'] = 'content_' . str_replace('.', '_', uniqid('', true));
+ $this->properties['unifunc'] = 'content_' . str_replace(array('.', ','), '_', uniqid('', true));
$content = $this->createTemplateCodeFrame($content, true);
+ /** @var Smarty_Internal_Template $_smarty_tpl
+ * used in evaluated code
+ */
$_smarty_tpl = $this;
eval("?>" . $content);
$this->cached->valid = true;
$this->cached->processed = true;
+
return $this->cached->write($this, $content);
}
* @param mixed $compile_id compile id to be used with this template
* @param integer $caching cache mode
* @param integer $cache_lifetime life time of cache data
- * @param array $vars optional variables to assign
+ * @param $data
* @param int $parent_scope scope in which {include} should execute
+ *
* @returns string template content
*/
public function getSubTemplate($template, $cache_id, $compile_id, $caching, $cache_lifetime, $data, $parent_scope)
{
// already in template cache?
if ($this->smarty->allow_ambiguous_resources) {
- $_templateId = Smarty_Resource::getUniqueTemplateName($this->smarty, $template) . $cache_id . $compile_id;
+ $_templateId = Smarty_Resource::getUniqueTemplateName($this, $template) . $cache_id . $compile_id;
} else {
$_templateId = $this->smarty->joined_template_dir . '#' . $template . $cache_id . $compile_id;
}
$tpl->tpl_vars = $this->tpl_vars;
$tpl->tpl_vars['smarty'] = clone $this->tpl_vars['smarty'];
} elseif ($parent_scope == Smarty::SCOPE_PARENT) {
- $tpl->tpl_vars = &$this->tpl_vars;
+ $tpl->tpl_vars = & $this->tpl_vars;
} elseif ($parent_scope == Smarty::SCOPE_GLOBAL) {
- $tpl->tpl_vars = &Smarty::$global_tpl_vars;
+ $tpl->tpl_vars = & Smarty::$global_tpl_vars;
} elseif (($scope_ptr = $this->getScopePointer($parent_scope)) == null) {
- $tpl->tpl_vars = &$this->tpl_vars;
+ $tpl->tpl_vars = & $this->tpl_vars;
} else {
- $tpl->tpl_vars = &$scope_ptr->tpl_vars;
+ $tpl->tpl_vars = & $scope_ptr->tpl_vars;
}
$tpl->config_vars = $this->config_vars;
if (!empty($data)) {
$tpl->tpl_vars[$_key] = new Smarty_variable($_val);
}
}
+
return $tpl->fetch(null, null, null, null, false, false, true);
}
* @param mixed $compile_id compile id to be used with this template
* @param integer $caching cache mode
* @param integer $cache_lifetime life time of cache data
- * @param array $vars optional variables to assign
+ * @param $data
* @param int $parent_scope scope in which {include} should execute
* @param string $hash nocache hash code
+ *
* @returns string template content
*/
public function setupInlineSubTemplate($template, $cache_id, $compile_id, $caching, $cache_lifetime, $data, $parent_scope, $hash)
{
$tpl = new $this->smarty->template_class($template, $this->smarty, $this, $cache_id, $compile_id, $caching, $cache_lifetime);
- $tpl->properties['nocache_hash'] = $hash;
+ $tpl->properties['nocache_hash'] = $hash;
// get variables from calling scope
- if ($parent_scope == Smarty::SCOPE_LOCAL ) {
+ if ($parent_scope == Smarty::SCOPE_LOCAL) {
$tpl->tpl_vars = $this->tpl_vars;
$tpl->tpl_vars['smarty'] = clone $this->tpl_vars['smarty'];
} elseif ($parent_scope == Smarty::SCOPE_PARENT) {
- $tpl->tpl_vars = &$this->tpl_vars;
+ $tpl->tpl_vars = & $this->tpl_vars;
} elseif ($parent_scope == Smarty::SCOPE_GLOBAL) {
- $tpl->tpl_vars = &Smarty::$global_tpl_vars;
+ $tpl->tpl_vars = & Smarty::$global_tpl_vars;
} elseif (($scope_ptr = $this->getScopePointer($parent_scope)) == null) {
- $tpl->tpl_vars = &$this->tpl_vars;
+ $tpl->tpl_vars = & $this->tpl_vars;
} else {
- $tpl->tpl_vars = &$scope_ptr->tpl_vars;
+ $tpl->tpl_vars = & $scope_ptr->tpl_vars;
}
$tpl->config_vars = $this->config_vars;
if (!empty($data)) {
$tpl->tpl_vars[$_key] = new Smarty_variable($_val);
}
}
+
return $tpl;
}
-
/**
* Create code frame for compiled and cached templates
*
- * @param string $content optional template content
- * @param bool $cache flag for cache file
+ * @param string $content optional template content
+ * @param bool $cache flag for cache file
+ *
* @return string
*/
public function createTemplateCodeFrame($content = '', $cache = false)
foreach ($this->required_plugins['compiled'] as $tmp) {
foreach ($tmp as $data) {
$file = addslashes($data['file']);
- $plugins_string .= "if (!is_callable('{$data['function']}')) include '{$file}';\n";
+ if (is_Array($data['function'])) {
+ $plugins_string .= "if (!is_callable(array('{$data['function'][0]}','{$data['function'][1]}'))) include '{$file}';\n";
+ } else {
+ $plugins_string .= "if (!is_callable('{$data['function']}')) include '{$file}';\n";
+ }
}
}
$plugins_string .= '?>';
foreach ($this->required_plugins['nocache'] as $tmp) {
foreach ($tmp as $data) {
$file = addslashes($data['file']);
- $plugins_string .= addslashes("if (!is_callable('{$data['function']}')) include '{$file}';\n");
+ if (is_Array($data['function'])) {
+ $plugins_string .= addslashes("if (!is_callable(array('{$data['function'][0]}','{$data['function'][1]}'))) include '{$file}';\n");
+ } else {
+ $plugins_string .= addslashes("if (!is_callable('{$data['function']}')) include '{$file}';\n");
+ }
}
}
$plugins_string .= "?>/*/%%SmartyNocache:{$this->properties['nocache_hash']}%%*/';?>\n";
}
}
}
- foreach ($this->smarty->template_functions as $name => $function_data) {
+ foreach ($this->smarty->template_functions as $name => $function_data) {
if (isset($function_data['called_nocache'])) {
unset($function_data['called_nocache'], $function_data['called_functions'], $this->smarty->template_functions[$name]['called_nocache']);
$this->properties['function'][$name] = $function_data;
}
$this->properties['version'] = Smarty::SMARTY_VERSION;
if (!isset($this->properties['unifunc'])) {
- $this->properties['unifunc'] = 'content_' . str_replace('.', '_', uniqid('', true));
+ $this->properties['unifunc'] = 'content_' . str_replace(array('.', ','), '_', uniqid('', true));
}
if (!$this->source->recompiled) {
$output .= "\$_valid = \$_smarty_tpl->decodeProperties(" . var_export($this->properties, true) . ',' . ($cache ? 'true' : 'false') . "); /*/%%SmartyHeaderCode%%*/?>\n";
$output .= $plugins_string;
$output .= $content;
if (!$this->source->recompiled) {
- $output .= '<?php }} ?>';
+ $output .= "<?php }} ?>\n";
}
+
return $output;
}
/**
* This function is executed automatically when a compiled or cached template file is included
- *
* - Decode saved properties from compiled template and cache files
* - Check if compiled or cache file is valid
*
- * @param array $properties special template properties
- * @param bool $cache flag if called from cache file
- * @return bool flag if compiled or cache file is valid
+ * @param array $properties special template properties
+ * @param bool $cache flag if called from cache file
+ *
+ * @return bool flag if compiled or cache file is valid
*/
public function decodeProperties($properties, $cache = false)
{
$is_valid = true;
if ($this->properties['version'] != Smarty::SMARTY_VERSION) {
$is_valid = false;
- } else if (((!$cache && $this->smarty->compile_check && empty($this->compiled->_properties) && !$this->compiled->isCompiled) || $cache && ($this->smarty->compile_check === true || $this->smarty->compile_check === Smarty::COMPILECHECK_ON)) && !empty($this->properties['file_dependency'])) {
+ } elseif (((!$cache && $this->smarty->compile_check && empty($this->compiled->_properties) && !$this->compiled->isCompiled) || $cache && ($this->smarty->compile_check === true || $this->smarty->compile_check === Smarty::COMPILECHECK_ON)) && !empty($this->properties['file_dependency'])) {
foreach ($this->properties['file_dependency'] as $_file_to_check) {
if ($_file_to_check[2] == 'file' || $_file_to_check[2] == 'php') {
if ($this->source->filepath == $_file_to_check[0] && isset($this->source->timestamp)) {
}
}
if ($cache) {
+ // CACHING_LIFETIME_SAVED cache expiry has to be validated here since otherwise we'd define the unifunc
+ if ($this->caching === Smarty::CACHING_LIFETIME_SAVED &&
+ $this->properties['cache_lifetime'] >= 0 &&
+ (time() > ($this->cached->timestamp + $this->properties['cache_lifetime']))
+ ) {
+ $is_valid = false;
+ }
$this->cached->valid = $is_valid;
} else {
$this->mustCompile = !$is_valid;
if (!$cache) {
$this->compiled->_properties = $properties;
}
+
return $is_valid;
}
/**
* Template code runtime function to create a local Smarty variable for array assignments
*
- * @param string $tpl_var tempate variable name
- * @param bool $nocache cache mode of variable
- * @param int $scope scope of variable
+ * @param string $tpl_var tempate variable name
+ * @param bool $nocache cache mode of variable
+ * @param int $scope scope of variable
*/
public function createLocalArrayVariable($tpl_var, $nocache = false, $scope = Smarty::SCOPE_LOCAL)
{
/**
* Template code runtime function to get pointer to template variable array of requested scope
*
- * @param int $scope requested variable scope
- * @return array array of template variables
+ * @param int $scope requested variable scope
+ *
+ * @return array array of template variables
*/
public function &getScope($scope)
{
while (!empty($ptr->parent)) {
$ptr = $ptr->parent;
}
+
return $ptr->tpl_vars;
} elseif ($scope == Smarty::SCOPE_GLOBAL) {
return Smarty::$global_tpl_vars;
}
$null = null;
+
return $null;
}
/**
* Get parent or root of template parent chain
*
- * @param int $scope pqrent or root scope
+ * @param int $scope pqrent or root scope
+ *
* @return mixed object
*/
public function getScopePointer($scope)
while (!empty($ptr->parent)) {
$ptr = $ptr->parent;
}
+
return $ptr;
}
+
return null;
}
/**
* [util function] counts an array, arrayaccess/traversable or PDOStatement object
*
- * @param mixed $value
- * @return int the count for arrays and objects that implement countable, 1 for other objects that don't, and 0 for empty elements
+ * @param mixed $value
+ *
+ * @return int the count for arrays and objects that implement countable, 1 for other objects that don't, and 0 for empty elements
*/
public function _count($value)
{
} elseif (is_object($value)) {
return count($value);
}
+
return 0;
}
/**
* runtime error not matching capture tags
- *
+
*/
public function capture_error()
{
}
/**
- * Empty cache for this template
- *
- * @param integer $exp_time expiration time
- * @return integer number of cache files deleted
- */
- public function clearCache($exp_time=null)
+ * Empty cache for this template
+ *
+ * @param integer $exp_time expiration time
+ *
+ * @return integer number of cache files deleted
+ */
+ public function clearCache($exp_time = null)
{
Smarty_CacheResource::invalidLoadedCache($this->smarty);
+
return $this->cached->handler->clear($this->smarty, $this->template_name, $this->cache_id, $this->compile_id, $exp_time);
}
- /**
+ /**
* set Smarty property in template context
*
* @param string $property_name property name
* @param mixed $value value
+ *
+ * @throws SmartyException
*/
public function __set($property_name, $value)
{
case 'cached':
case 'compiler':
$this->$property_name = $value;
+
return;
// FIXME: routing of template -> smarty attributes
default:
if (property_exists($this->smarty, $property_name)) {
$this->smarty->$property_name = $value;
+
return;
}
}
* get Smarty property in template context
*
* @param string $property_name property name
+ *
+ * @throws SmartyException
*/
public function __get($property_name)
{
}
$this->smarty->template_objects[$_templateId] = $this;
}
+
return $this->source;
case 'compiled':
$this->compiled = $this->source->getCompiled($this);
+
return $this->compiled;
case 'cached':
include SMARTY_SYSPLUGINS_DIR . 'smarty_cacheresource.php';
}
$this->cached = new Smarty_Template_Cached($this);
+
return $this->cached;
case 'compiler':
$this->smarty->loadPlugin($this->source->compiler_class);
$this->compiler = new $this->source->compiler_class($this->source->template_lexer_class, $this->source->template_parser_class, $this->smarty);
+
return $this->compiler;
// FIXME: routing of template -> smarty attributes
}
/**
- * Template data object destrutor
- *
+ * Template data object destructor
+
*/
public function __destruct()
{
$this->cached->handler->releaseLock($this->smarty, $this->cached);
}
}
-
}
-
-?>
\ No newline at end of file
<?php\r
/**\r
* Smarty Internal Plugin Smarty Template Base\r
+ * This file contains the basic shared methods for template handling\r
*\r
- * This file contains the basic shared methodes for template handling\r
- *\r
- * @package Smarty\r
+ * @package Smarty\r
* @subpackage Template\r
- * @author Uwe Tews\r
+ * @author Uwe Tews\r
*/\r
\r
/**\r
- * Class with shared template methodes\r
+ * Class with shared template methods\r
*\r
- * @package Smarty\r
+ * @package Smarty\r
* @subpackage Template\r
*/\r
-abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data {\r
-\r
+abstract class Smarty_Internal_TemplateBase extends Smarty_Internal_Data\r
+{\r
/**\r
* fetches a rendered Smarty template\r
*\r
- * @param string $template the resource handle of the template file or template object\r
- * @param mixed $cache_id cache id to be used with this template\r
- * @param mixed $compile_id compile id to be used with this template\r
- * @param object $parent next higher level of Smarty variables\r
- * @param bool $display true: display, false: fetch\r
- * @param bool $merge_tpl_vars if true parent template variables merged in to local scope\r
- * @param bool $no_output_filter if true do not run output filter\r
+ * @param string $template the resource handle of the template file or template object\r
+ * @param mixed $cache_id cache id to be used with this template\r
+ * @param mixed $compile_id compile id to be used with this template\r
+ * @param object $parent next higher level of Smarty variables\r
+ * @param bool $display true: display, false: fetch\r
+ * @param bool $merge_tpl_vars if true parent template variables merged in to local scope\r
+ * @param bool $no_output_filter if true do not run output filter\r
+ *\r
+ * @throws Exception\r
+ * @throws SmartyException\r
* @return string rendered template output\r
*/\r
public function fetch($template = null, $cache_id = null, $compile_id = null, $parent = null, $display = false, $merge_tpl_vars = true, $no_output_filter = false)\r
if ($template === null && $this instanceof $this->template_class) {\r
$template = $this;\r
}\r
- if (!empty($cache_id) && is_object($cache_id)) {\r
+ if ($cache_id !== null && is_object($cache_id)) {\r
$parent = $cache_id;\r
$cache_id = null;\r
}\r
}\r
// create template object if necessary\r
$_template = ($template instanceof $this->template_class)\r
- ? $template\r
- : $this->smarty->createTemplate($template, $cache_id, $compile_id, $parent, false);\r
+ ? $template\r
+ : $this->smarty->createTemplate($template, $cache_id, $compile_id, $parent, false);\r
// if called by Smarty object make sure we use current caching status\r
if ($this instanceof Smarty) {\r
$_template->caching = $this->caching;\r
if (!($_template->caching == Smarty::CACHING_LIFETIME_CURRENT || $_template->caching == Smarty::CACHING_LIFETIME_SAVED) || !$_template->cached->valid) {\r
// render template (not loaded and not in cache)\r
if (!$_template->source->uncompiled) {\r
+ /** @var Smarty_Internal_Template $_smarty_tpl\r
+ * used in evaluated code\r
+ */\r
$_smarty_tpl = $_template;\r
if ($_template->source->recompiled) {\r
- if ($this->smarty->debugging) {\r
- Smarty_Internal_Debug::start_compile($_template);\r
- }\r
$code = $_template->compiler->compileTemplate($_template);\r
- if ($this->smarty->debugging) {\r
- Smarty_Internal_Debug::end_compile($_template);\r
- }\r
if ($this->smarty->debugging) {\r
Smarty_Internal_Debug::start_render($_template);\r
}\r
ob_start();\r
eval("?>" . $code);\r
unset($code);\r
- } catch (Exception $e) {\r
+ }\r
+ catch (Exception $e) {\r
ob_get_clean();\r
throw $e;\r
}\r
} else {\r
if (!$_template->compiled->exists || ($_template->smarty->force_compile && !$_template->compiled->isCompiled)) {\r
$_template->compileTemplateSource();\r
+ $code = file_get_contents($_template->compiled->filepath);\r
+ eval("?>" . $code);\r
+ unset($code);\r
+ $_template->compiled->loaded = true;\r
+ $_template->compiled->isCompiled = true;\r
}\r
if ($this->smarty->debugging) {\r
Smarty_Internal_Debug::start_render($_template);\r
if ($_template->mustCompile) {\r
// recompile and load again\r
$_template->compileTemplateSource();\r
- include($_template->compiled->filepath);\r
+ $code = file_get_contents($_template->compiled->filepath);\r
+ eval("?>" . $code);\r
+ unset($code);\r
+ $_template->compiled->isCompiled = true;\r
}\r
$_template->compiled->loaded = true;\r
} else {\r
if (empty($_template->properties['unifunc']) || !is_callable($_template->properties['unifunc'])) {\r
throw new SmartyException("Invalid compiled template for '{$_template->template_resource}'");\r
}\r
- array_unshift($_template->_capture_stack,array());\r
+ array_unshift($_template->_capture_stack, array());\r
//\r
// render compiled template\r
//\r
$_template->capture_error();\r
}\r
array_shift($_template->_capture_stack);\r
- } catch (Exception $e) {\r
+ }\r
+ catch (Exception $e) {\r
ob_get_clean();\r
throw $e;\r
}\r
try {\r
ob_start();\r
$_template->source->renderUncompiled($_template);\r
- } catch (Exception $e) {\r
+ }\r
+ catch (Exception $e) {\r
ob_get_clean();\r
throw $e;\r
}\r
// loop over items, stitch back together\r
foreach ($cache_split as $curr_idx => $curr_split) {\r
// escape PHP tags in template content\r
- $output .= preg_replace('/(<%|%>|<\?php|<\?|\?>)/', '<?php echo \'$1\'; ?>', $curr_split);\r
+ $output .= preg_replace('/(<%|%>|<\?php|<\?|\?>)/', "<?php echo '\$1'; ?>\n", $curr_split);\r
if (isset($cache_parts[0][$curr_idx])) {\r
$_template->properties['has_nocache_code'] = true;\r
// remove nocache tags from cache output\r
$output = Smarty_Internal_Filter_Handler::runFilter('output', $output, $_template);\r
}\r
// rendering (must be done before writing cache file because of {function} nocache handling)\r
+ /** @var Smarty_Internal_Template $_smarty_tpl\r
+ * used in evaluated code\r
+ */\r
$_smarty_tpl = $_template;\r
try {\r
ob_start();\r
eval("?>" . $output);\r
$_output = ob_get_clean();\r
- } catch (Exception $e) {\r
+ }\r
+ catch (Exception $e) {\r
ob_get_clean();\r
throw $e;\r
}\r
}\r
try {\r
ob_start();\r
- array_unshift($_template->_capture_stack,array());\r
+ array_unshift($_template->_capture_stack, array());\r
//\r
// render cached template\r
//\r
}\r
array_shift($_template->_capture_stack);\r
$_output = ob_get_clean();\r
- } catch (Exception $e) {\r
+ }\r
+ catch (Exception $e) {\r
ob_get_clean();\r
throw $e;\r
}\r
$_last_modified_date = @substr($_SERVER['HTTP_IF_MODIFIED_SINCE'], 0, strpos($_SERVER['HTTP_IF_MODIFIED_SINCE'], 'GMT') + 3);\r
if ($_isCached && $_template->cached->timestamp <= strtotime($_last_modified_date)) {\r
switch (PHP_SAPI) {\r
- case 'cgi': // php-cgi < 5.3\r
- case 'cgi-fcgi': // php-cgi >= 5.3\r
- case 'fpm-fcgi': // php-fpm >= 5.3.3\r
- header('Status: 304 Not Modified');\r
- break;\r
+ case 'cgi': // php-cgi < 5.3\r
+ case 'cgi-fcgi': // php-cgi >= 5.3\r
+ case 'fpm-fcgi': // php-fpm >= 5.3.3\r
+ header('Status: 304 Not Modified');\r
+ break;\r
\r
case 'cli':\r
- if (/* ^phpunit */!empty($_SERVER['SMARTY_PHPUNIT_DISABLE_HEADERS'])/* phpunit$ */) {\r
- $_SERVER['SMARTY_PHPUNIT_HEADERS'][] = '304 Not Modified';\r
- }\r
- break;\r
+ if ( /* ^phpunit */\r
+ !empty($_SERVER['SMARTY_PHPUNIT_DISABLE_HEADERS']) /* phpunit$ */\r
+ ) {\r
+ $_SERVER['SMARTY_PHPUNIT_HEADERS'][] = '304 Not Modified';\r
+ }\r
+ break;\r
\r
default:\r
- header($_SERVER['SERVER_PROTOCOL'].' 304 Not Modified');\r
- break;\r
+ header($_SERVER['SERVER_PROTOCOL'] . ' 304 Not Modified');\r
+ break;\r
}\r
} else {\r
switch (PHP_SAPI) {\r
case 'cli':\r
- if (/* ^phpunit */!empty($_SERVER['SMARTY_PHPUNIT_DISABLE_HEADERS'])/* phpunit$ */) {\r
- $_SERVER['SMARTY_PHPUNIT_HEADERS'][] = 'Last-Modified: ' . gmdate('D, d M Y H:i:s', $_template->cached->timestamp) . ' GMT';\r
- }\r
- break;\r
+ if ( /* ^phpunit */\r
+ !empty($_SERVER['SMARTY_PHPUNIT_DISABLE_HEADERS']) /* phpunit$ */\r
+ ) {\r
+ $_SERVER['SMARTY_PHPUNIT_HEADERS'][] = 'Last-Modified: ' . gmdate('D, d M Y H:i:s', $_template->cached->timestamp) . ' GMT';\r
+ }\r
+ break;\r
\r
default:\r
- header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $_template->cached->timestamp) . ' GMT');\r
- break;\r
+ header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $_template->cached->timestamp) . ' GMT');\r
+ break;\r
}\r
echo $_output;\r
}\r
}\r
// debug output\r
if ($this->smarty->debugging) {\r
- Smarty_Internal_Debug::display_debug($this);\r
+ Smarty_Internal_Debug::display_debug($_template);\r
}\r
if ($merge_tpl_vars) {\r
// restore local variables\r
$_template->tpl_vars = $save_tpl_vars;\r
- $_template->config_vars = $save_config_vars;\r
+ $_template->config_vars = $save_config_vars;\r
}\r
+\r
return;\r
} else {\r
if ($merge_tpl_vars) {\r
// restore local variables\r
$_template->tpl_vars = $save_tpl_vars;\r
- $_template->config_vars = $save_config_vars;\r
+ $_template->config_vars = $save_config_vars;\r
}\r
// return fetched content\r
return $_output;\r
/**\r
* test if cache is valid\r
*\r
- * @param string|object $template the resource handle of the template file or template object\r
- * @param mixed $cache_id cache id to be used with this template\r
- * @param mixed $compile_id compile id to be used with this template\r
- * @param object $parent next higher level of Smarty variables\r
- * @return boolean cache status\r
+ * @param string|object $template the resource handle of the template file or template object\r
+ * @param mixed $cache_id cache id to be used with this template\r
+ * @param mixed $compile_id compile id to be used with this template\r
+ * @param object $parent next higher level of Smarty variables\r
+ *\r
+ * @return boolean cache status\r
*/\r
public function isCached($template = null, $cache_id = null, $compile_id = null, $parent = null)\r
{\r
* creates a data object\r
*\r
* @param object $parent next higher level of Smarty variables\r
+ *\r
* @returns Smarty_Data data object\r
*/\r
public function createData($parent = null)\r
/**\r
* Registers plugin to be used in templates\r
*\r
- * @param string $type plugin type\r
- * @param string $tag name of template tag\r
- * @param callback $callback PHP callback to register\r
- * @param boolean $cacheable if true (default) this fuction is cachable\r
- * @param array $cache_attr caching attributes if any\r
+ * @param string $type plugin type\r
+ * @param string $tag name of template tag\r
+ * @param callback $callback PHP callback to register\r
+ * @param boolean $cacheable if true (default) this fuction is cachable\r
+ * @param array $cache_attr caching attributes if any\r
+ *\r
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining\r
- * @throws SmartyException when the plugin tag is invalid\r
+ * @throws SmartyException when the plugin tag is invalid\r
*/\r
public function registerPlugin($type, $tag, $callback, $cacheable = true, $cache_attr = null)\r
{\r
/**\r
* Unregister Plugin\r
*\r
- * @param string $type of plugin\r
- * @param string $tag name of plugin\r
+ * @param string $type of plugin\r
+ * @param string $tag name of plugin\r
+ *\r
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining\r
*/\r
public function unregisterPlugin($type, $tag)\r
/**\r
* Registers a resource to fetch a template\r
*\r
- * @param string $type name of resource type\r
- * @param Smarty_Resource|array $callback or instance of Smarty_Resource, or array of callbacks to handle resource (deprecated)\r
+ * @param string $type name of resource type\r
+ * @param Smarty_Resource|array $callback or instance of Smarty_Resource, or array of callbacks to handle resource (deprecated)\r
+ *\r
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining\r
*/\r
public function registerResource($type, $callback)\r
{\r
$this->smarty->registered_resources[$type] = $callback instanceof Smarty_Resource ? $callback : array($callback, false);\r
+\r
return $this;\r
}\r
\r
/**\r
* Unregisters a resource\r
*\r
- * @param string $type name of resource type\r
+ * @param string $type name of resource type\r
+ *\r
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining\r
*/\r
public function unregisterResource($type)\r
/**\r
* Registers a cache resource to cache a template's output\r
*\r
- * @param string $type name of cache resource type\r
- * @param Smarty_CacheResource $callback instance of Smarty_CacheResource to handle output caching\r
+ * @param string $type name of cache resource type\r
+ * @param Smarty_CacheResource $callback instance of Smarty_CacheResource to handle output caching\r
+ *\r
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining\r
*/\r
public function registerCacheResource($type, Smarty_CacheResource $callback)\r
{\r
$this->smarty->registered_cache_resources[$type] = $callback;\r
+\r
return $this;\r
}\r
\r
/**\r
* Unregisters a cache resource\r
*\r
- * @param string $type name of cache resource type\r
+ * @param string $type name of cache resource type\r
+ *\r
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining\r
*/\r
public function unregisterCacheResource($type)\r
/**\r
* Registers object to be used in templates\r
*\r
- * @param string $object name of template object\r
- * @param object $object_impl the referenced PHP object to register\r
- * @param array $allowed list of allowed methods (empty = all)\r
- * @param boolean $smarty_args smarty argument format, else traditional\r
- * @param array $block_methods list of block-methods\r
- * @param array $block_functs list of methods that are block format\r
+ * @param $object_name\r
+ * @param object $object_impl the referenced PHP object to register\r
+ * @param array $allowed list of allowed methods (empty = all)\r
+ * @param boolean $smarty_args smarty argument format, else traditional\r
+ * @param array $block_methods list of block-methods\r
+ *\r
+ * @throws SmartyException\r
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining\r
- * @throws SmartyException if any of the methods in $allowed or $block_methods are invalid\r
*/\r
public function registerObject($object_name, $object_impl, $allowed = array(), $smarty_args = true, $block_methods = array())\r
{\r
- // test if allowed methodes callable\r
+ // test if allowed methods callable\r
if (!empty($allowed)) {\r
foreach ((array) $allowed as $method) {\r
- if (!is_callable(array($object_impl, $method))) {\r
- throw new SmartyException("Undefined method '$method' in registered object");\r
+ if (!is_callable(array($object_impl, $method)) && !property_exists($object_impl, $method)) {\r
+ throw new SmartyException("Undefined method or property '$method' in registered object");\r
}\r
}\r
}\r
- // test if block methodes callable\r
+ // test if block methods callable\r
if (!empty($block_methods)) {\r
foreach ((array) $block_methods as $method) {\r
if (!is_callable(array($object_impl, $method))) {\r
}\r
// register the object\r
$this->smarty->registered_objects[$object_name] =\r
- array($object_impl, (array) $allowed, (boolean) $smarty_args, (array) $block_methods);\r
+ array($object_impl, (array) $allowed, (boolean) $smarty_args, (array) $block_methods);\r
+\r
return $this;\r
}\r
\r
/**\r
* return a reference to a registered object\r
*\r
- * @param string $name object name\r
+ * @param string $name object name\r
+ *\r
* @return object\r
* @throws SmartyException if no such object is found\r
*/\r
if (!is_object($this->smarty->registered_objects[$name][0])) {\r
throw new SmartyException("registered '$name' is not an object");\r
}\r
+\r
return $this->smarty->registered_objects[$name][0];\r
}\r
\r
/**\r
* unregister an object\r
*\r
- * @param string $name object name\r
+ * @param string $name object name\r
+ *\r
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining\r
*/\r
public function unregisterObject($name)\r
/**\r
* Registers static classes to be used in templates\r
*\r
- * @param string $class name of template class\r
- * @param string $class_impl the referenced PHP class to register\r
+ * @param $class_name\r
+ * @param string $class_impl the referenced PHP class to register\r
+ *\r
+ * @throws SmartyException\r
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining\r
- * @throws SmartyException if $class_impl does not refer to an existing class\r
*/\r
public function registerClass($class_name, $class_impl)\r
{\r
}\r
// register the class\r
$this->smarty->registered_classes[$class_name] = $class_impl;\r
+\r
return $this;\r
}\r
\r
/**\r
* Registers a default plugin handler\r
*\r
- * @param callable $callback class/method name\r
+ * @param callable $callback class/method name\r
+ *\r
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining\r
- * @throws SmartyException if $callback is not callable\r
+ * @throws SmartyException if $callback is not callable\r
*/\r
public function registerDefaultPluginHandler($callback)\r
{\r
/**\r
* Registers a default template handler\r
*\r
- * @param callable $callback class/method name\r
+ * @param callable $callback class/method name\r
+ *\r
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining\r
- * @throws SmartyException if $callback is not callable\r
+ * @throws SmartyException if $callback is not callable\r
*/\r
public function registerDefaultTemplateHandler($callback)\r
{\r
/**\r
* Registers a default template handler\r
*\r
- * @param callable $callback class/method name\r
+ * @param callable $callback class/method name\r
+ *\r
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining\r
- * @throws SmartyException if $callback is not callable\r
+ * @throws SmartyException if $callback is not callable\r
*/\r
public function registerDefaultConfigHandler($callback)\r
{\r
/**\r
* Registers a filter function\r
*\r
- * @param string $type filter type\r
- * @param callback $callback\r
+ * @param string $type filter type\r
+ * @param callback $callback\r
+ *\r
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining\r
*/\r
public function registerFilter($type, $callback)\r
{\r
$this->smarty->registered_filters[$type][$this->_get_filter_name($callback)] = $callback;\r
+\r
return $this;\r
}\r
\r
/**\r
* Unregisters a filter function\r
*\r
- * @param string $type filter type\r
- * @param callback $callback\r
+ * @param string $type filter type\r
+ * @param callback $callback\r
+ *\r
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining\r
*/\r
public function unregisterFilter($type, $callback)\r
/**\r
* Return internal filter name\r
*\r
- * @param callback $function_name\r
- * @return string internal filter name\r
+ * @param callback $function_name\r
+ *\r
+ * @return string internal filter name\r
*/\r
public function _get_filter_name($function_name)\r
{\r
if (is_array($function_name)) {\r
$_class_name = (is_object($function_name[0]) ?\r
- get_class($function_name[0]) : $function_name[0]);\r
+ get_class($function_name[0]) : $function_name[0]);\r
+\r
return $_class_name . '_' . $function_name[1];\r
} else {\r
return $function_name;\r
/**\r
* load a filter of specified type and name\r
*\r
- * @param string $type filter type\r
- * @param string $name filter name\r
+ * @param string $type filter type\r
+ * @param string $name filter name\r
+ *\r
* @throws SmartyException if filter could not be loaded\r
*/\r
public function loadFilter($type, $name)\r
}\r
if (is_callable($_plugin)) {\r
$this->smarty->registered_filters[$type][$_filter_name] = $_plugin;\r
+\r
return true;\r
}\r
}\r
/**\r
* unload a filter of specified type and name\r
*\r
- * @param string $type filter type\r
- * @param string $name filter name\r
+ * @param string $type filter type\r
+ * @param string $name filter name\r
+ *\r
* @return Smarty_Internal_Templatebase current Smarty_Internal_Templatebase (or Smarty or Smarty_Internal_Template) instance for chaining\r
*/\r
public function unloadFilter($type, $name)\r
/**\r
* preg_replace callback to convert camelcase getter/setter to underscore property names\r
*\r
- * @param string $match match string\r
+ * @param string $match match string\r
+ *\r
* @return string replacemant\r
*/\r
- private function replaceCamelcase($match) {\r
+ private function replaceCamelcase($match)\r
+ {\r
return "_" . strtolower($match[1]);\r
}\r
\r
*\r
* @param string $name unknown method-name\r
* @param array $args argument array\r
+ *\r
+ * @throws SmartyException\r
*/\r
public function __call($name, $args)\r
{\r
// lcfirst() not available < PHP 5.3.0, so improvise\r
$property_name = strtolower(substr($name, 3, 1)) . substr($name, 4);\r
// convert camel case to underscored name\r
- $property_name = preg_replace_callback('/([A-Z])/', array($this,'replaceCamelcase'), $property_name);\r
+ $property_name = preg_replace_callback('/([A-Z])/', array($this, 'replaceCamelcase'), $property_name);\r
$_resolved_property_name[$name] = $property_name;\r
}\r
if (isset($_resolved_property_source[$property_name])) {\r
$_is_this = null;\r
if (property_exists($this, $property_name)) {\r
$_is_this = true;\r
- } else if (property_exists($this->smarty, $property_name)) {\r
+ } elseif (property_exists($this->smarty, $property_name)) {\r
$_is_this = false;\r
}\r
$_resolved_property_source[$property_name] = $_is_this;\r
}\r
if ($_is_this) {\r
- if ($first3 == 'get')\r
- return $this->$property_name;\r
- else\r
- return $this->$property_name = $args[0];\r
- } else if ($_is_this === false) {\r
- if ($first3 == 'get')\r
- return $this->smarty->$property_name;\r
- else\r
- return $this->smarty->$property_name = $args[0];\r
+ if ($first3 == 'get') {\r
+ return $this->$property_name;\r
+ } else {\r
+ return $this->$property_name = $args[0];\r
+ }\r
+ } elseif ($_is_this === false) {\r
+ if ($first3 == 'get') {\r
+ return $this->smarty->$property_name;\r
+ } else {\r
+ return $this->smarty->$property_name = $args[0];\r
+ }\r
} else {\r
throw new SmartyException("property '$property_name' does not exist.");\r
- return false;\r
- }\r
+ }\r
}\r
if ($name == 'Smarty') {\r
throw new SmartyException("PHP5 requires you to call __construct() instead of Smarty()");\r
// must be unknown\r
throw new SmartyException("Call of unknown method '$name'.");\r
}\r
-\r
}\r
-\r
-?>
\ No newline at end of file
-<?php\r
-\r
-/**\r
- * Smarty Internal Plugin Smarty Template Compiler Base\r
- *\r
- * This file contains the basic classes and methodes for compiling Smarty templates with lexer/parser\r
- *\r
- * @package Smarty\r
- * @subpackage Compiler\r
- * @author Uwe Tews\r
- */\r
-\r
-/**\r
- * Main abstract compiler class\r
- *\r
- * @package Smarty\r
- * @subpackage Compiler\r
- */\r
-abstract class Smarty_Internal_TemplateCompilerBase {\r
-\r
- /**\r
- * hash for nocache sections\r
- *\r
- * @var mixed\r
- */\r
- private $nocache_hash = null;\r
-\r
- /**\r
- * suppress generation of nocache code\r
- *\r
- * @var bool\r
- */\r
- public $suppressNocacheProcessing = false;\r
-\r
- /**\r
- * suppress generation of merged template code\r
- *\r
- * @var bool\r
- */\r
- public $suppressMergedTemplates = false;\r
-\r
- /**\r
- * compile tag objects\r
- *\r
- * @var array\r
- */\r
- public static $_tag_objects = array();\r
-\r
- /**\r
- * tag stack\r
- *\r
- * @var array\r
- */\r
- public $_tag_stack = array();\r
-\r
- /**\r
- * current template\r
- *\r
- * @var Smarty_Internal_Template\r
- */\r
- public $template = null;\r
-\r
- /**\r
- * merged templates\r
- *\r
- * @var array\r
- */\r
- public $merged_templates = array();\r
-\r
- /**\r
- * flag when compiling {block}\r
- *\r
- * @var bool\r
- */\r
- public $inheritance = false;\r
-\r
- /**\r
- * plugins loaded by default plugin handler\r
- *\r
- * @var array\r
- */\r
- public $default_handler_plugins = array();\r
-\r
- /**\r
- * saved preprocessed modifier list\r
- *\r
- * @var mixed\r
- */\r
- public $default_modifier_list = null;\r
-\r
- /**\r
- * force compilation of complete template as nocache\r
- * @var boolean\r
- */\r
- public $forceNocache = false;\r
-\r
- /**\r
- * suppress Smarty header code in compiled template\r
- * @var bool\r
- */\r
- public $suppressHeader = false;\r
-\r
- /**\r
- * suppress template property header code in compiled template\r
- * @var bool\r
- */\r
- public $suppressTemplatePropertyHeader = false;\r
-\r
- /**\r
- * flag if compiled template file shall we written\r
- * @var bool\r
- */\r
- public $write_compiled_code = true;\r
-\r
- /**\r
- * flag if currently a template function is compiled\r
- * @var bool\r
- */\r
- public $compiles_template_function = false;\r
-\r
- /**\r
- * called subfuntions from template function\r
- * @var array\r
- */\r
- public $called_functions = array();\r
-\r
- /**\r
- * flags for used modifier plugins\r
- * @var array\r
- */\r
- public $modifier_plugins = array();\r
-\r
- /**\r
- * type of already compiled modifier\r
- * @var array\r
- */\r
- public $known_modifier_type = array();\r
-\r
- /**\r
- * Initialize compiler\r
- */\r
- public function __construct() {\r
- $this->nocache_hash = str_replace('.', '-', uniqid(rand(), true));\r
- }\r
-\r
- /**\r
- * Method to compile a Smarty template\r
- *\r
- * @param Smarty_Internal_Template $template template object to compile\r
- * @return bool true if compiling succeeded, false if it failed\r
- */\r
- public function compileTemplate(Smarty_Internal_Template $template) {\r
- if (empty($template->properties['nocache_hash'])) {\r
- $template->properties['nocache_hash'] = $this->nocache_hash;\r
- } else {\r
- $this->nocache_hash = $template->properties['nocache_hash'];\r
- }\r
- // flag for nochache sections\r
- $this->nocache = false;\r
- $this->tag_nocache = false;\r
- // save template object in compiler class\r
- $this->template = $template;\r
- // reset has noche code flag\r
- $this->template->has_nocache_code = false;\r
- $this->smarty->_current_file = $saved_filepath = $this->template->source->filepath;\r
- // template header code\r
- $template_header = '';\r
- if (!$this->suppressHeader) {\r
- $template_header .= "<?php /* Smarty version " . Smarty::SMARTY_VERSION . ", created on " . strftime("%Y-%m-%d %H:%M:%S") . "\n";\r
- $template_header .= " compiled from \"" . $this->template->source->filepath . "\" */ ?>\n";\r
- }\r
-\r
- do {\r
- // flag for aborting current and start recompile\r
- $this->abort_and_recompile = false;\r
- // get template source\r
- $_content = $template->source->content;\r
- // run prefilter if required\r
- if (isset($this->smarty->autoload_filters['pre']) || isset($this->smarty->registered_filters['pre'])) {\r
- $_content = Smarty_Internal_Filter_Handler::runFilter('pre', $_content, $template);\r
- }\r
- // on empty template just return header\r
- if ($_content == '') {\r
- if ($this->suppressTemplatePropertyHeader) {\r
- $code = '';\r
- } else {\r
- $code = $template_header . $template->createTemplateCodeFrame();\r
- }\r
- return $code;\r
- }\r
- // call compiler\r
- $_compiled_code = $this->doCompile($_content);\r
- } while ($this->abort_and_recompile);\r
- $this->template->source->filepath = $saved_filepath;\r
- // free memory\r
- unset($this->parser->root_buffer, $this->parser->current_buffer, $this->parser, $this->lex, $this->template);\r
- self::$_tag_objects = array();\r
- // return compiled code to template object\r
- $merged_code = '';\r
- if (!$this->suppressMergedTemplates && !empty($this->merged_templates)) {\r
- foreach ($this->merged_templates as $code) {\r
- $merged_code .= $code;\r
- }\r
- // run postfilter if required on merged code\r
- if (isset($this->smarty->autoload_filters['post']) || isset($this->smarty->registered_filters['post'])) {\r
- $merged_code = Smarty_Internal_Filter_Handler::runFilter('post', $merged_code, $template);\r
- }\r
- }\r
- // run postfilter if required on compiled template code\r
- if (isset($this->smarty->autoload_filters['post']) || isset($this->smarty->registered_filters['post'])) {\r
- $_compiled_code = Smarty_Internal_Filter_Handler::runFilter('post', $_compiled_code, $template);\r
- }\r
- if ($this->suppressTemplatePropertyHeader) {\r
- $code = $_compiled_code . $merged_code;\r
- } else {\r
- $code = $template_header . $template->createTemplateCodeFrame($_compiled_code) . $merged_code;\r
- }\r
- return $code;\r
- }\r
-\r
- /**\r
- * Compile Tag\r
- *\r
- * This is a call back from the lexer/parser\r
- * It executes the required compile plugin for the Smarty tag\r
- *\r
- * @param string $tag tag name\r
- * @param array $args array with tag attributes\r
- * @param array $parameter array with compilation parameter\r
- * @return string compiled code\r
- */\r
- public function compileTag($tag, $args, $parameter = array()) {\r
- // $args contains the attributes parsed and compiled by the lexer/parser\r
- // assume that tag does compile into code, but creates no HTML output\r
- $this->has_code = true;\r
- $this->has_output = false;\r
- // log tag/attributes\r
- if (isset($this->smarty->get_used_tags) && $this->smarty->get_used_tags) {\r
- $this->template->used_tags[] = array($tag, $args);\r
- }\r
- // check nocache option flag\r
- if (in_array("'nocache'", $args) || in_array(array('nocache' => 'true'), $args)\r
- || in_array(array('nocache' => '"true"'), $args) || in_array(array('nocache' => "'true'"), $args)) {\r
- $this->tag_nocache = true;\r
- }\r
- // compile the smarty tag (required compile classes to compile the tag are autoloaded)\r
- if (($_output = $this->callTagCompiler($tag, $args, $parameter)) === false) {\r
- if (isset($this->smarty->template_functions[$tag])) {\r
- // template defined by {template} tag\r
- $args['_attr']['name'] = "'" . $tag . "'";\r
- $_output = $this->callTagCompiler('call', $args, $parameter);\r
- }\r
- }\r
- if ($_output !== false) {\r
- if ($_output !== true) {\r
- // did we get compiled code\r
- if ($this->has_code) {\r
- // Does it create output?\r
- if ($this->has_output) {\r
- $_output .= "\n";\r
- }\r
- // return compiled code\r
- return $_output;\r
- }\r
- }\r
- // tag did not produce compiled code\r
- return '';\r
- } else {\r
- // map_named attributes\r
- if (isset($args['_attr'])) {\r
- foreach ($args['_attr'] as $key => $attribute) {\r
- if (is_array($attribute)) {\r
- $args = array_merge($args, $attribute);\r
- }\r
- }\r
- }\r
- // not an internal compiler tag\r
- if (strlen($tag) < 6 || substr($tag, -5) != 'close') {\r
- // check if tag is a registered object\r
- if (isset($this->smarty->registered_objects[$tag]) && isset($parameter['object_methode'])) {\r
- $methode = $parameter['object_methode'];\r
- if (!in_array($methode, $this->smarty->registered_objects[$tag][3]) &&\r
- (empty($this->smarty->registered_objects[$tag][1]) || in_array($methode, $this->smarty->registered_objects[$tag][1]))) {\r
- return $this->callTagCompiler('private_object_function', $args, $parameter, $tag, $methode);\r
- } elseif (in_array($methode, $this->smarty->registered_objects[$tag][3])) {\r
- return $this->callTagCompiler('private_object_block_function', $args, $parameter, $tag, $methode);\r
- } else {\r
- return $this->trigger_template_error('unallowed methode "' . $methode . '" in registered object "' . $tag . '"', $this->lex->taglineno);\r
- }\r
- }\r
- // check if tag is registered\r
- foreach (array(Smarty::PLUGIN_COMPILER, Smarty::PLUGIN_FUNCTION, Smarty::PLUGIN_BLOCK) as $plugin_type) {\r
- if (isset($this->smarty->registered_plugins[$plugin_type][$tag])) {\r
- // if compiler function plugin call it now\r
- if ($plugin_type == Smarty::PLUGIN_COMPILER) {\r
- $new_args = array();\r
- foreach ($args as $key => $mixed) {\r
- if (is_array($mixed)) {\r
- $new_args = array_merge($new_args, $mixed);\r
- } else {\r
- $new_args[$key] = $mixed;\r
- }\r
- }\r
- if (!$this->smarty->registered_plugins[$plugin_type][$tag][1]) {\r
- $this->tag_nocache = true;\r
- }\r
- $function = $this->smarty->registered_plugins[$plugin_type][$tag][0];\r
- if (!is_array($function)) {\r
- return $function($new_args, $this);\r
- } else if (is_object($function[0])) {\r
- return $this->smarty->registered_plugins[$plugin_type][$tag][0][0]->$function[1]($new_args, $this);\r
- } else {\r
- return call_user_func_array($function, array($new_args, $this));\r
- }\r
- }\r
- // compile registered function or block function\r
- if ($plugin_type == Smarty::PLUGIN_FUNCTION || $plugin_type == Smarty::PLUGIN_BLOCK) {\r
- return $this->callTagCompiler('private_registered_' . $plugin_type, $args, $parameter, $tag);\r
- }\r
- }\r
- }\r
- // check plugins from plugins folder\r
- foreach ($this->smarty->plugin_search_order as $plugin_type) {\r
- if ($plugin_type == Smarty::PLUGIN_BLOCK && $this->smarty->loadPlugin('smarty_compiler_' . $tag) && (!isset($this->smarty->security_policy) || $this->smarty->security_policy->isTrustedTag($tag, $this))) {\r
- $plugin = 'smarty_compiler_' . $tag;\r
- if (is_callable($plugin)) {\r
- // convert arguments format for old compiler plugins\r
- $new_args = array();\r
- foreach ($args as $key => $mixed) {\r
- if (is_array($mixed)) {\r
- $new_args = array_merge($new_args, $mixed);\r
- } else {\r
- $new_args[$key] = $mixed;\r
- }\r
- }\r
- return $plugin($new_args, $this->smarty);\r
- }\r
- if (class_exists($plugin, false)) {\r
- $plugin_object = new $plugin;\r
- if (method_exists($plugin_object, 'compile')) {\r
- return $plugin_object->compile($args, $this);\r
- }\r
- }\r
- throw new SmartyException("Plugin \"{$tag}\" not callable");\r
- } else {\r
- if ($function = $this->getPlugin($tag, $plugin_type)) {\r
- if (!isset($this->smarty->security_policy) || $this->smarty->security_policy->isTrustedTag($tag, $this)) {\r
- return $this->callTagCompiler('private_' . $plugin_type . '_plugin', $args, $parameter, $tag, $function);\r
- }\r
- }\r
- }\r
- }\r
- if (is_callable($this->smarty->default_plugin_handler_func)) {\r
- $found = false;\r
- // look for already resolved tags\r
- foreach ($this->smarty->plugin_search_order as $plugin_type) {\r
- if (isset($this->default_handler_plugins[$plugin_type][$tag])) {\r
- $found = true;\r
- break;\r
- }\r
- }\r
- if (!$found) {\r
- // call default handler\r
- foreach ($this->smarty->plugin_search_order as $plugin_type) {\r
- if ($this->getPluginFromDefaultHandler($tag, $plugin_type)) {\r
- $found = true;\r
- break;\r
- }\r
- }\r
- }\r
- if ($found) {\r
- // if compiler function plugin call it now\r
- if ($plugin_type == Smarty::PLUGIN_COMPILER) {\r
- $new_args = array();\r
- foreach ($args as $mixed) {\r
- $new_args = array_merge($new_args, $mixed);\r
- }\r
- $function = $this->default_handler_plugins[$plugin_type][$tag][0];\r
- if (!is_array($function)) {\r
- return $function($new_args, $this);\r
- } else if (is_object($function[0])) {\r
- return $this->default_handler_plugins[$plugin_type][$tag][0][0]->$function[1]($new_args, $this);\r
- } else {\r
- return call_user_func_array($function, array($new_args, $this));\r
- }\r
- } else {\r
- return $this->callTagCompiler('private_registered_' . $plugin_type, $args, $parameter, $tag);\r
- }\r
- }\r
- }\r
- } else {\r
- // compile closing tag of block function\r
- $base_tag = substr($tag, 0, -5);\r
- // check if closing tag is a registered object\r
- if (isset($this->smarty->registered_objects[$base_tag]) && isset($parameter['object_methode'])) {\r
- $methode = $parameter['object_methode'];\r
- if (in_array($methode, $this->smarty->registered_objects[$base_tag][3])) {\r
- return $this->callTagCompiler('private_object_block_function', $args, $parameter, $tag, $methode);\r
- } else {\r
- return $this->trigger_template_error('unallowed closing tag methode "' . $methode . '" in registered object "' . $base_tag . '"', $this->lex->taglineno);\r
- }\r
- }\r
- // registered block tag ?\r
- if (isset($this->smarty->registered_plugins[Smarty::PLUGIN_BLOCK][$base_tag]) || isset($this->default_handler_plugins[Smarty::PLUGIN_BLOCK][$base_tag])) {\r
- return $this->callTagCompiler('private_registered_block', $args, $parameter, $tag);\r
- }\r
- // block plugin?\r
- if ($function = $this->getPlugin($base_tag, Smarty::PLUGIN_BLOCK)) {\r
- return $this->callTagCompiler('private_block_plugin', $args, $parameter, $tag, $function);\r
- }\r
- // registered compiler plugin ?\r
- if (isset($this->smarty->registered_plugins[Smarty::PLUGIN_COMPILER][$tag])) {\r
- // if compiler function plugin call it now\r
- $args = array();\r
- if (!$this->smarty->registered_plugins[Smarty::PLUGIN_COMPILER][$tag][1]) {\r
- $this->tag_nocache = true;\r
- }\r
- $function = $this->smarty->registered_plugins[Smarty::PLUGIN_COMPILER][$tag][0];\r
- if (!is_array($function)) {\r
- return $function($args, $this);\r
- } else if (is_object($function[0])) {\r
- return $this->smarty->registered_plugins[Smarty::PLUGIN_COMPILER][$tag][0][0]->$function[1]($args, $this);\r
- } else {\r
- return call_user_func_array($function, array($args, $this));\r
- }\r
- }\r
- if ($this->smarty->loadPlugin('smarty_compiler_' . $tag)) {\r
- $plugin = 'smarty_compiler_' . $tag;\r
- if (is_callable($plugin)) {\r
- return $plugin($args, $this->smarty);\r
- }\r
- if (class_exists($plugin, false)) {\r
- $plugin_object = new $plugin;\r
- if (method_exists($plugin_object, 'compile')) {\r
- return $plugin_object->compile($args, $this);\r
- }\r
- }\r
- throw new SmartyException("Plugin \"{$tag}\" not callable");\r
- }\r
- }\r
- $this->trigger_template_error("unknown tag \"" . $tag . "\"", $this->lex->taglineno);\r
- }\r
- }\r
-\r
- /**\r
- * lazy loads internal compile plugin for tag and calls the compile methode\r
- *\r
- * compile objects cached for reuse.\r
- * class name format: Smarty_Internal_Compile_TagName\r
- * plugin filename format: Smarty_Internal_Tagname.php\r
- *\r
- * @param string $tag tag name\r
- * @param array $args list of tag attributes\r
- * @param mixed $param1 optional parameter\r
- * @param mixed $param2 optional parameter\r
- * @param mixed $param3 optional parameter\r
- * @return string compiled code\r
- */\r
- public function callTagCompiler($tag, $args, $param1 = null, $param2 = null, $param3 = null) {\r
- // re-use object if already exists\r
- if (isset(self::$_tag_objects[$tag])) {\r
- // compile this tag\r
- return self::$_tag_objects[$tag]->compile($args, $this, $param1, $param2, $param3);\r
- }\r
- // lazy load internal compiler plugin\r
- $class_name = 'Smarty_Internal_Compile_' . $tag;\r
- if ($this->smarty->loadPlugin($class_name)) {\r
- // check if tag allowed by security\r
- if (!isset($this->smarty->security_policy) || $this->smarty->security_policy->isTrustedTag($tag, $this)) {\r
- // use plugin if found\r
- self::$_tag_objects[$tag] = new $class_name;\r
- // compile this tag\r
- return self::$_tag_objects[$tag]->compile($args, $this, $param1, $param2, $param3);\r
- }\r
- }\r
- // no internal compile plugin for this tag\r
- return false;\r
- }\r
-\r
- /**\r
- * Check for plugins and return function name\r
- *\r
- * @param string $pugin_name name of plugin or function\r
- * @param string $plugin_type type of plugin\r
- * @return string call name of function\r
- */\r
- public function getPlugin($plugin_name, $plugin_type) {\r
- $function = null;\r
- if ($this->template->caching && ($this->nocache || $this->tag_nocache)) {\r
- if (isset($this->template->required_plugins['nocache'][$plugin_name][$plugin_type])) {\r
- $function = $this->template->required_plugins['nocache'][$plugin_name][$plugin_type]['function'];\r
- } else if (isset($this->template->required_plugins['compiled'][$plugin_name][$plugin_type])) {\r
- $this->template->required_plugins['nocache'][$plugin_name][$plugin_type] = $this->template->required_plugins['compiled'][$plugin_name][$plugin_type];\r
- $function = $this->template->required_plugins['nocache'][$plugin_name][$plugin_type]['function'];\r
- }\r
- } else {\r
- if (isset($this->template->required_plugins['compiled'][$plugin_name][$plugin_type])) {\r
- $function = $this->template->required_plugins['compiled'][$plugin_name][$plugin_type]['function'];\r
- } else if (isset($this->template->required_plugins['nocache'][$plugin_name][$plugin_type])) {\r
- $this->template->required_plugins['compiled'][$plugin_name][$plugin_type] = $this->template->required_plugins['nocache'][$plugin_name][$plugin_type];\r
- $function = $this->template->required_plugins['compiled'][$plugin_name][$plugin_type]['function'];\r
- }\r
- }\r
- if (isset($function)) {\r
- if ($plugin_type == 'modifier') {\r
- $this->modifier_plugins[$plugin_name] = true;\r
- }\r
- return $function;\r
- }\r
- // loop through plugin dirs and find the plugin\r
- $function = 'smarty_' . $plugin_type . '_' . $plugin_name;\r
- $file = $this->smarty->loadPlugin($function, false);\r
-\r
- if (is_string($file)) {\r
- if ($this->template->caching && ($this->nocache || $this->tag_nocache)) {\r
- $this->template->required_plugins['nocache'][$plugin_name][$plugin_type]['file'] = $file;\r
- $this->template->required_plugins['nocache'][$plugin_name][$plugin_type]['function'] = $function;\r
- } else {\r
- $this->template->required_plugins['compiled'][$plugin_name][$plugin_type]['file'] = $file;\r
- $this->template->required_plugins['compiled'][$plugin_name][$plugin_type]['function'] = $function;\r
- }\r
- if ($plugin_type == 'modifier') {\r
- $this->modifier_plugins[$plugin_name] = true;\r
- }\r
- return $function;\r
- }\r
- if (is_callable($function)) {\r
- // plugin function is defined in the script\r
- return $function;\r
- }\r
- return false;\r
- }\r
-\r
- /**\r
- * Check for plugins by default plugin handler\r
- *\r
- * @param string $tag name of tag\r
- * @param string $plugin_type type of plugin\r
- * @return boolean true if found\r
- */\r
- public function getPluginFromDefaultHandler($tag, $plugin_type) {\r
- $callback = null;\r
- $script = null;\r
- $cacheable = true;\r
- $result = call_user_func_array(\r
- $this->smarty->default_plugin_handler_func, array($tag, $plugin_type, $this->template, &$callback, &$script, &$cacheable)\r
- );\r
- if ($result) {\r
- $this->tag_nocache = $this->tag_nocache || !$cacheable;\r
- if ($script !== null) {\r
- if (is_file($script)) {\r
- if ($this->template->caching && ($this->nocache || $this->tag_nocache)) {\r
- $this->template->required_plugins['nocache'][$tag][$plugin_type]['file'] = $script;\r
- $this->template->required_plugins['nocache'][$tag][$plugin_type]['function'] = $callback;\r
- } else {\r
- $this->template->required_plugins['compiled'][$tag][$plugin_type]['file'] = $script;\r
- $this->template->required_plugins['compiled'][$tag][$plugin_type]['function'] = $callback;\r
- }\r
- include_once $script;\r
- } else {\r
- $this->trigger_template_error("Default plugin handler: Returned script file \"{$script}\" for \"{$tag}\" not found");\r
- }\r
- }\r
- if (!is_string($callback) && !(is_array($callback) && is_string($callback[0]) && is_string($callback[1]))) {\r
- $this->trigger_template_error("Default plugin handler: Returned callback for \"{$tag}\" must be a static function name or array of class and function name");\r
- }\r
- if (is_callable($callback)) {\r
- $this->default_handler_plugins[$plugin_type][$tag] = array($callback, true, array());\r
- return true;\r
- } else {\r
- $this->trigger_template_error("Default plugin handler: Returned callback for \"{$tag}\" not callable");\r
- }\r
- }\r
- return false;\r
- }\r
-\r
- /**\r
- * Inject inline code for nocache template sections\r
- *\r
- * This method gets the content of each template element from the parser.\r
- * If the content is compiled code and it should be not cached the code is injected\r
- * into the rendered output.\r
- *\r
- * @param string $content content of template element\r
- * @param boolean $is_code true if content is compiled code\r
- * @return string content\r
- */\r
- public function processNocacheCode($content, $is_code) {\r
- // If the template is not evaluated and we have a nocache section and or a nocache tag\r
- if ($is_code && !empty($content)) {\r
- // generate replacement code\r
- if ((!($this->template->source->recompiled) || $this->forceNocache) && $this->template->caching && !$this->suppressNocacheProcessing &&\r
- ($this->nocache || $this->tag_nocache || $this->forceNocache == 2)) {\r
- $this->template->has_nocache_code = true;\r
- $_output = str_replace("'", "\'", $content);\r
- $_output = str_replace('\\\\', '\\\\\\\\', $_output);\r
- $_output = str_replace("^#^", "'", $_output);\r
- $_output = "<?php echo '/*%%SmartyNocache:{$this->nocache_hash}%%*/" . $_output . "/*/%%SmartyNocache:{$this->nocache_hash}%%*/';?>\n";\r
- // make sure we include modifer plugins for nocache code\r
- foreach ($this->modifier_plugins as $plugin_name => $dummy) {\r
- if (isset($this->template->required_plugins['compiled'][$plugin_name]['modifier'])) {\r
- $this->template->required_plugins['nocache'][$plugin_name]['modifier'] = $this->template->required_plugins['compiled'][$plugin_name]['modifier'];\r
- }\r
- }\r
- } else {\r
- $_output = $content;\r
- }\r
- } else {\r
- $_output = $content;\r
- }\r
- $this->modifier_plugins = array();\r
- $this->suppressNocacheProcessing = false;\r
- $this->tag_nocache = false;\r
- return $_output;\r
- }\r
-\r
- /**\r
- * display compiler error messages without dying\r
- *\r
- * If parameter $args is empty it is a parser detected syntax error.\r
- * In this case the parser is called to obtain information about expected tokens.\r
- *\r
- * If parameter $args contains a string this is used as error message\r
- *\r
- * @param string $args individual error message or null\r
- * @param string $line line-number\r
- * @throws SmartyCompilerException when an unexpected token is found\r
- */\r
- public function trigger_template_error($args = null, $line = null) {\r
- // get template source line which has error\r
- if (!isset($line)) {\r
- $line = $this->lex->line;\r
- }\r
- $match = preg_split("/\n/", $this->lex->data);\r
- $error_text = 'Syntax Error in template "' . $this->template->source->filepath . '" on line ' . $line . ' "' . htmlspecialchars(trim(preg_replace('![\t\r\n]+!', ' ', $match[$line - 1]))) . '" ';\r
- if (isset($args)) {\r
- // individual error message\r
- $error_text .= $args;\r
- } else {\r
- // expected token from parser\r
- $error_text .= ' - Unexpected "' . $this->lex->value . '"';\r
- if (count($this->parser->yy_get_expected_tokens($this->parser->yymajor)) <= 4) {\r
- foreach ($this->parser->yy_get_expected_tokens($this->parser->yymajor) as $token) {\r
- $exp_token = $this->parser->yyTokenName[$token];\r
- if (isset($this->lex->smarty_token_names[$exp_token])) {\r
- // token type from lexer\r
- $expect[] = '"' . $this->lex->smarty_token_names[$exp_token] . '"';\r
- } else {\r
- // otherwise internal token name\r
- $expect[] = $this->parser->yyTokenName[$token];\r
- }\r
- }\r
- $error_text .= ', expected one of: ' . implode(' , ', $expect);\r
- }\r
- }\r
- throw new SmartyCompilerException($error_text);\r
- }\r
-\r
-}\r
-\r
-?>
\ No newline at end of file
+<?php
+
+/**
+ * Smarty Internal Plugin Smarty Template Compiler Base
+ * This file contains the basic classes and methods for compiling Smarty templates with lexer/parser
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @author Uwe Tews
+ */
+
+/**
+ * Main abstract compiler class
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ */
+abstract class Smarty_Internal_TemplateCompilerBase
+{
+ /**
+ * hash for nocache sections
+ *
+ * @var mixed
+ */
+ private $nocache_hash = null;
+
+ /**
+ * suppress generation of nocache code
+ *
+ * @var bool
+ */
+ public $suppressNocacheProcessing = false;
+
+ /**
+ * suppress generation of merged template code
+ *
+ * @var bool
+ */
+ public $suppressMergedTemplates = false;
+
+ /**
+ * compile tag objects
+ *
+ * @var array
+ */
+ public static $_tag_objects = array();
+
+ /**
+ * tag stack
+ *
+ * @var array
+ */
+ public $_tag_stack = array();
+
+ /**
+ * current template
+ *
+ * @var Smarty_Internal_Template
+ */
+ public $template = null;
+
+ /**
+ * merged templates
+ *
+ * @var array
+ */
+ public $merged_templates = array();
+
+ /**
+ * sources which must be compiled
+ *
+ * @var array
+ */
+ public $sources = array();
+
+ /**
+ * flag that we are inside {block}
+ *
+ * @var bool
+ */
+ public $inheritance = false;
+
+ /**
+ * flag when compiling inheritance child template
+ *
+ * @var bool
+ */
+ public $inheritance_child = false;
+
+ /**
+ * uid of templates called by {extends} for recursion check
+ *
+ * @var array
+ */
+ public $extends_uid = array();
+
+ /**
+ * source line offset for error messages
+ *
+ * @var int
+ */
+ public $trace_line_offset = 0;
+
+ /**
+ * trace uid
+ *
+ * @var string
+ */
+ public $trace_uid = '';
+
+ /**
+ * trace file path
+ *
+ * @var string
+ */
+ public $trace_filepath = '';
+ /**
+ * stack for tracing file and line of nested {block} tags
+ *
+ * @var array
+ */
+ public $trace_stack = array();
+
+ /**
+ * plugins loaded by default plugin handler
+ *
+ * @var array
+ */
+ public $default_handler_plugins = array();
+
+ /**
+ * saved preprocessed modifier list
+ *
+ * @var mixed
+ */
+ public $default_modifier_list = null;
+
+ /**
+ * force compilation of complete template as nocache
+ *
+ * @var boolean
+ */
+ public $forceNocache = false;
+
+ /**
+ * suppress Smarty header code in compiled template
+ *
+ * @var bool
+ */
+ public $suppressHeader = false;
+
+ /**
+ * suppress template property header code in compiled template
+ *
+ * @var bool
+ */
+ public $suppressTemplatePropertyHeader = false;
+
+ /**
+ * suppress pre and post filter
+ *
+ * @var bool
+ */
+ public $suppressFilter = false;
+
+ /**
+ * flag if compiled template file shall we written
+ *
+ * @var bool
+ */
+ public $write_compiled_code = true;
+
+ /**
+ * flag if currently a template function is compiled
+ *
+ * @var bool
+ */
+ public $compiles_template_function = false;
+
+ /**
+ * called subfuntions from template function
+ *
+ * @var array
+ */
+ public $called_functions = array();
+
+ /**
+ * flags for used modifier plugins
+ *
+ * @var array
+ */
+ public $modifier_plugins = array();
+
+ /**
+ * type of already compiled modifier
+ *
+ * @var array
+ */
+ public $known_modifier_type = array();
+
+ /**
+ * method to compile a Smarty template
+ *
+ * @param mixed $_content template source
+ *
+ * @return bool true if compiling succeeded, false if it failed
+ */
+ abstract protected function doCompile($_content);
+
+ /**
+ * Initialize compiler
+ */
+ public function __construct()
+ {
+ $this->nocache_hash = str_replace(array('.', ','), '-', uniqid(rand(), true));
+ }
+
+ /**
+ * Method to compile a Smarty template
+ *
+ * @param Smarty_Internal_Template $template template object to compile
+ * @param bool $nocache true is shall be compiled in nocache mode
+ *
+ * @return bool true if compiling succeeded, false if it failed
+ */
+ public function compileTemplate(Smarty_Internal_Template $template, $nocache = false)
+ {
+ if (empty($template->properties['nocache_hash'])) {
+ $template->properties['nocache_hash'] = $this->nocache_hash;
+ } else {
+ $this->nocache_hash = $template->properties['nocache_hash'];
+ }
+ // flag for nochache sections
+ $this->nocache = $nocache;
+ $this->tag_nocache = false;
+ // save template object in compiler class
+ $this->template = $template;
+ // reset has nocache code flag
+ $this->template->has_nocache_code = false;
+ $save_source = $this->template->source;
+ // template header code
+ $template_header = '';
+ if (!$this->suppressHeader) {
+ $template_header .= "<?php /* Smarty version " . Smarty::SMARTY_VERSION . ", created on " . strftime("%Y-%m-%d %H:%M:%S") . "\n";
+ $template_header .= " compiled from \"" . $this->template->source->filepath . "\" */ ?>\n";
+ }
+
+ if (empty($this->template->source->components)) {
+ $this->sources = array($template->source);
+ } else {
+ // we have array of inheritance templates by extends: resource
+ $this->sources = array_reverse($template->source->components);
+ }
+ $loop = 0;
+ // the $this->sources array can get additional elements while compiling by the {extends} tag
+ while ($this->template->source = array_shift($this->sources)) {
+ $this->smarty->_current_file = $this->template->source->filepath;
+ if ($this->smarty->debugging) {
+ Smarty_Internal_Debug::start_compile($this->template);
+ }
+ $no_sources = count($this->sources);
+ if ($loop || $no_sources) {
+ $this->template->properties['file_dependency'][$this->template->source->uid] = array($this->template->source->filepath, $this->template->source->timestamp, $this->template->source->type);
+ }
+ $loop ++;
+ if ($no_sources) {
+ $this->inheritance_child = true;
+ } else {
+ $this->inheritance_child = false;
+ }
+ do {
+ $_compiled_code = '';
+ // flag for aborting current and start recompile
+ $this->abort_and_recompile = false;
+ // get template source
+ $_content = $this->template->source->content;
+ if ($_content != '') {
+ // run prefilter if required
+ if ((isset($this->smarty->autoload_filters['pre']) || isset($this->smarty->registered_filters['pre'])) && !$this->suppressFilter) {
+ $_content = Smarty_Internal_Filter_Handler::runFilter('pre', $_content, $template);
+ }
+ // call compiler
+ $_compiled_code = $this->doCompile($_content);
+ }
+ } while ($this->abort_and_recompile);
+ if ($this->smarty->debugging) {
+ Smarty_Internal_Debug::end_compile($this->template);
+ }
+ }
+ // restore source
+ $this->template->source = $save_source;
+ unset($save_source);
+ $this->smarty->_current_file = $this->template->source->filepath;
+ // free memory
+ unset($this->parser->root_buffer, $this->parser->current_buffer, $this->parser, $this->lex, $this->template);
+ self::$_tag_objects = array();
+ // return compiled code to template object
+ $merged_code = '';
+ if (!$this->suppressMergedTemplates && !empty($this->merged_templates)) {
+ foreach ($this->merged_templates as $code) {
+ $merged_code .= $code;
+ }
+ }
+ // run postfilter if required on compiled template code
+ if ((isset($this->smarty->autoload_filters['post']) || isset($this->smarty->registered_filters['post'])) && !$this->suppressFilter && $_compiled_code != '') {
+ $_compiled_code = Smarty_Internal_Filter_Handler::runFilter('post', $_compiled_code, $template);
+ }
+ if ($this->suppressTemplatePropertyHeader) {
+ $code = $_compiled_code . $merged_code;
+ } else {
+ $code = $template_header . $template->createTemplateCodeFrame($_compiled_code) . $merged_code;
+ }
+ // unset content because template inheritance could have replace source with parent code
+ unset ($template->source->content);
+
+ return $code;
+ }
+
+ /**
+ * Compile Tag
+ * This is a call back from the lexer/parser
+ * It executes the required compile plugin for the Smarty tag
+ *
+ * @param string $tag tag name
+ * @param array $args array with tag attributes
+ * @param array $parameter array with compilation parameter
+ *
+ * @throws SmartyCompilerException
+ * @throws SmartyException
+ * @return string compiled code
+ */
+ public function compileTag($tag, $args, $parameter = array())
+ {
+ // $args contains the attributes parsed and compiled by the lexer/parser
+ // assume that tag does compile into code, but creates no HTML output
+ $this->has_code = true;
+ $this->has_output = false;
+ // log tag/attributes
+ if (isset($this->smarty->get_used_tags) && $this->smarty->get_used_tags) {
+ $this->template->used_tags[] = array($tag, $args);
+ }
+ // check nocache option flag
+ if (in_array("'nocache'", $args) || in_array(array('nocache' => 'true'), $args)
+ || in_array(array('nocache' => '"true"'), $args) || in_array(array('nocache' => "'true'"), $args)
+ ) {
+ $this->tag_nocache = true;
+ }
+ // compile the smarty tag (required compile classes to compile the tag are autoloaded)
+ if (($_output = $this->callTagCompiler($tag, $args, $parameter)) === false) {
+ if (isset($this->smarty->template_functions[$tag])) {
+ // template defined by {template} tag
+ $args['_attr']['name'] = "'" . $tag . "'";
+ $_output = $this->callTagCompiler('call', $args, $parameter);
+ }
+ }
+ if ($_output !== false) {
+ if ($_output !== true) {
+ // did we get compiled code
+ if ($this->has_code) {
+ // Does it create output?
+ if ($this->has_output) {
+ $_output .= "\n";
+ }
+ // return compiled code
+ return $_output;
+ }
+ }
+ // tag did not produce compiled code
+ return null;
+ } else {
+ // map_named attributes
+ if (isset($args['_attr'])) {
+ foreach ($args['_attr'] as $key => $attribute) {
+ if (is_array($attribute)) {
+ $args = array_merge($args, $attribute);
+ }
+ }
+ }
+ // not an internal compiler tag
+ if (strlen($tag) < 6 || substr($tag, - 5) != 'close') {
+ // check if tag is a registered object
+ if (isset($this->smarty->registered_objects[$tag]) && isset($parameter['object_method'])) {
+ $method = $parameter['object_method'];
+ if (!in_array($method, $this->smarty->registered_objects[$tag][3]) &&
+ (empty($this->smarty->registered_objects[$tag][1]) || in_array($method, $this->smarty->registered_objects[$tag][1]))
+ ) {
+ return $this->callTagCompiler('private_object_function', $args, $parameter, $tag, $method);
+ } elseif (in_array($method, $this->smarty->registered_objects[$tag][3])) {
+ return $this->callTagCompiler('private_object_block_function', $args, $parameter, $tag, $method);
+ } else {
+ // throw exception
+ $this->trigger_template_error('not allowed method "' . $method . '" in registered object "' . $tag . '"', $this->lex->taglineno);
+ }
+ }
+ // check if tag is registered
+ foreach (array(Smarty::PLUGIN_COMPILER, Smarty::PLUGIN_FUNCTION, Smarty::PLUGIN_BLOCK) as $plugin_type) {
+ if (isset($this->smarty->registered_plugins[$plugin_type][$tag])) {
+ // if compiler function plugin call it now
+ if ($plugin_type == Smarty::PLUGIN_COMPILER) {
+ $new_args = array();
+ foreach ($args as $key => $mixed) {
+ if (is_array($mixed)) {
+ $new_args = array_merge($new_args, $mixed);
+ } else {
+ $new_args[$key] = $mixed;
+ }
+ }
+ if (!$this->smarty->registered_plugins[$plugin_type][$tag][1]) {
+ $this->tag_nocache = true;
+ }
+ $function = $this->smarty->registered_plugins[$plugin_type][$tag][0];
+ if (!is_array($function)) {
+ return $function($new_args, $this);
+ } elseif (is_object($function[0])) {
+ return $this->smarty->registered_plugins[$plugin_type][$tag][0][0]->$function[1]($new_args, $this);
+ } else {
+ return call_user_func_array($function, array($new_args, $this));
+ }
+ }
+ // compile registered function or block function
+ if ($plugin_type == Smarty::PLUGIN_FUNCTION || $plugin_type == Smarty::PLUGIN_BLOCK) {
+ return $this->callTagCompiler('private_registered_' . $plugin_type, $args, $parameter, $tag);
+ }
+ }
+ }
+ // check plugins from plugins folder
+ foreach ($this->smarty->plugin_search_order as $plugin_type) {
+ if ($plugin_type == Smarty::PLUGIN_COMPILER && $this->smarty->loadPlugin('smarty_compiler_' . $tag) && (!isset($this->smarty->security_policy) || $this->smarty->security_policy->isTrustedTag($tag, $this))) {
+ $plugin = 'smarty_compiler_' . $tag;
+ if (is_callable($plugin)) {
+ // convert arguments format for old compiler plugins
+ $new_args = array();
+ foreach ($args as $key => $mixed) {
+ if (is_array($mixed)) {
+ $new_args = array_merge($new_args, $mixed);
+ } else {
+ $new_args[$key] = $mixed;
+ }
+ }
+
+ return $plugin($new_args, $this->smarty);
+ }
+ if (class_exists($plugin, false)) {
+ $plugin_object = new $plugin;
+ if (method_exists($plugin_object, 'compile')) {
+ return $plugin_object->compile($args, $this);
+ }
+ }
+ throw new SmartyException("Plugin \"{$tag}\" not callable");
+ } else {
+ if ($function = $this->getPlugin($tag, $plugin_type)) {
+ if (!isset($this->smarty->security_policy) || $this->smarty->security_policy->isTrustedTag($tag, $this)) {
+ return $this->callTagCompiler('private_' . $plugin_type . '_plugin', $args, $parameter, $tag, $function);
+ }
+ }
+ }
+ }
+ if (is_callable($this->smarty->default_plugin_handler_func)) {
+ $found = false;
+ // look for already resolved tags
+ foreach ($this->smarty->plugin_search_order as $plugin_type) {
+ if (isset($this->default_handler_plugins[$plugin_type][$tag])) {
+ $found = true;
+ break;
+ }
+ }
+ if (!$found) {
+ // call default handler
+ foreach ($this->smarty->plugin_search_order as $plugin_type) {
+ if ($this->getPluginFromDefaultHandler($tag, $plugin_type)) {
+ $found = true;
+ break;
+ }
+ }
+ }
+ if ($found) {
+ // if compiler function plugin call it now
+ if ($plugin_type == Smarty::PLUGIN_COMPILER) {
+ $new_args = array();
+ foreach ($args as $mixed) {
+ $new_args = array_merge($new_args, $mixed);
+ }
+ $function = $this->default_handler_plugins[$plugin_type][$tag][0];
+ if (!is_array($function)) {
+ return $function($new_args, $this);
+ } elseif (is_object($function[0])) {
+ return $this->default_handler_plugins[$plugin_type][$tag][0][0]->$function[1]($new_args, $this);
+ } else {
+ return call_user_func_array($function, array($new_args, $this));
+ }
+ } else {
+ return $this->callTagCompiler('private_registered_' . $plugin_type, $args, $parameter, $tag);
+ }
+ }
+ }
+ } else {
+ // compile closing tag of block function
+ $base_tag = substr($tag, 0, - 5);
+ // check if closing tag is a registered object
+ if (isset($this->smarty->registered_objects[$base_tag]) && isset($parameter['object_method'])) {
+ $method = $parameter['object_method'];
+ if (in_array($method, $this->smarty->registered_objects[$base_tag][3])) {
+ return $this->callTagCompiler('private_object_block_function', $args, $parameter, $tag, $method);
+ } else {
+ // throw exception
+ $this->trigger_template_error('not allowed closing tag method "' . $method . '" in registered object "' . $base_tag . '"', $this->lex->taglineno);
+ }
+ }
+ // registered block tag ?
+ if (isset($this->smarty->registered_plugins[Smarty::PLUGIN_BLOCK][$base_tag]) || isset($this->default_handler_plugins[Smarty::PLUGIN_BLOCK][$base_tag])) {
+ return $this->callTagCompiler('private_registered_block', $args, $parameter, $tag);
+ }
+ // block plugin?
+ if ($function = $this->getPlugin($base_tag, Smarty::PLUGIN_BLOCK)) {
+ return $this->callTagCompiler('private_block_plugin', $args, $parameter, $tag, $function);
+ }
+ // registered compiler plugin ?
+ if (isset($this->smarty->registered_plugins[Smarty::PLUGIN_COMPILER][$tag])) {
+ // if compiler function plugin call it now
+ $args = array();
+ if (!$this->smarty->registered_plugins[Smarty::PLUGIN_COMPILER][$tag][1]) {
+ $this->tag_nocache = true;
+ }
+ $function = $this->smarty->registered_plugins[Smarty::PLUGIN_COMPILER][$tag][0];
+ if (!is_array($function)) {
+ return $function($args, $this);
+ } elseif (is_object($function[0])) {
+ return $this->smarty->registered_plugins[Smarty::PLUGIN_COMPILER][$tag][0][0]->$function[1]($args, $this);
+ } else {
+ return call_user_func_array($function, array($args, $this));
+ }
+ }
+ if ($this->smarty->loadPlugin('smarty_compiler_' . $tag)) {
+ $plugin = 'smarty_compiler_' . $tag;
+ if (is_callable($plugin)) {
+ return $plugin($args, $this->smarty);
+ }
+ if (class_exists($plugin, false)) {
+ $plugin_object = new $plugin;
+ if (method_exists($plugin_object, 'compile')) {
+ return $plugin_object->compile($args, $this);
+ }
+ }
+ throw new SmartyException("Plugin \"{$tag}\" not callable");
+ }
+ }
+ $this->trigger_template_error("unknown tag \"" . $tag . "\"", $this->lex->taglineno);
+ }
+ }
+
+ /**
+ * lazy loads internal compile plugin for tag and calls the compile method
+ * compile objects cached for reuse.
+ * class name format: Smarty_Internal_Compile_TagName
+ * plugin filename format: Smarty_Internal_Tagname.php
+ *
+ * @param string $tag tag name
+ * @param array $args list of tag attributes
+ * @param mixed $param1 optional parameter
+ * @param mixed $param2 optional parameter
+ * @param mixed $param3 optional parameter
+ *
+ * @return string compiled code
+ */
+ public function callTagCompiler($tag, $args, $param1 = null, $param2 = null, $param3 = null)
+ {
+ // re-use object if already exists
+ if (isset(self::$_tag_objects[$tag])) {
+ // compile this tag
+ return self::$_tag_objects[$tag]->compile($args, $this, $param1, $param2, $param3);
+ }
+ // lazy load internal compiler plugin
+ $class_name = 'Smarty_Internal_Compile_' . $tag;
+ if ($this->smarty->loadPlugin($class_name)) {
+ // check if tag allowed by security
+ if (!isset($this->smarty->security_policy) || $this->smarty->security_policy->isTrustedTag($tag, $this)) {
+ // use plugin if found
+ self::$_tag_objects[$tag] = new $class_name;
+ // compile this tag
+ return self::$_tag_objects[$tag]->compile($args, $this, $param1, $param2, $param3);
+ }
+ }
+ // no internal compile plugin for this tag
+ return false;
+ }
+
+ /**
+ * Check for plugins and return function name
+ *
+ * @param $plugin_name
+ * @param string $plugin_type type of plugin
+ *
+ * @return string call name of function
+ */
+ public function getPlugin($plugin_name, $plugin_type)
+ {
+ $function = null;
+ if ($this->template->caching && ($this->nocache || $this->tag_nocache)) {
+ if (isset($this->template->required_plugins['nocache'][$plugin_name][$plugin_type])) {
+ $function = $this->template->required_plugins['nocache'][$plugin_name][$plugin_type]['function'];
+ } elseif (isset($this->template->required_plugins['compiled'][$plugin_name][$plugin_type])) {
+ $this->template->required_plugins['nocache'][$plugin_name][$plugin_type] = $this->template->required_plugins['compiled'][$plugin_name][$plugin_type];
+ $function = $this->template->required_plugins['nocache'][$plugin_name][$plugin_type]['function'];
+ }
+ } else {
+ if (isset($this->template->required_plugins['compiled'][$plugin_name][$plugin_type])) {
+ $function = $this->template->required_plugins['compiled'][$plugin_name][$plugin_type]['function'];
+ } elseif (isset($this->template->required_plugins['nocache'][$plugin_name][$plugin_type])) {
+ $this->template->required_plugins['compiled'][$plugin_name][$plugin_type] = $this->template->required_plugins['nocache'][$plugin_name][$plugin_type];
+ $function = $this->template->required_plugins['compiled'][$plugin_name][$plugin_type]['function'];
+ }
+ }
+ if (isset($function)) {
+ if ($plugin_type == 'modifier') {
+ $this->modifier_plugins[$plugin_name] = true;
+ }
+
+ return $function;
+ }
+ // loop through plugin dirs and find the plugin
+ $function = 'smarty_' . $plugin_type . '_' . $plugin_name;
+ $file = $this->smarty->loadPlugin($function, false);
+
+ if (is_string($file)) {
+ if ($this->template->caching && ($this->nocache || $this->tag_nocache)) {
+ $this->template->required_plugins['nocache'][$plugin_name][$plugin_type]['file'] = $file;
+ $this->template->required_plugins['nocache'][$plugin_name][$plugin_type]['function'] = $function;
+ } else {
+ $this->template->required_plugins['compiled'][$plugin_name][$plugin_type]['file'] = $file;
+ $this->template->required_plugins['compiled'][$plugin_name][$plugin_type]['function'] = $function;
+ }
+ if ($plugin_type == 'modifier') {
+ $this->modifier_plugins[$plugin_name] = true;
+ }
+
+ return $function;
+ }
+ if (is_callable($function)) {
+ // plugin function is defined in the script
+ return $function;
+ }
+
+ return false;
+ }
+
+ /**
+ * Check for plugins by default plugin handler
+ *
+ * @param string $tag name of tag
+ * @param string $plugin_type type of plugin
+ *
+ * @return boolean true if found
+ */
+ public function getPluginFromDefaultHandler($tag, $plugin_type)
+ {
+ $callback = null;
+ $script = null;
+ $cacheable = true;
+ $result = call_user_func_array(
+ $this->smarty->default_plugin_handler_func, array($tag, $plugin_type, $this->template, &$callback, &$script, &$cacheable)
+ );
+ if ($result) {
+ $this->tag_nocache = $this->tag_nocache || !$cacheable;
+ if ($script !== null) {
+ if (is_file($script)) {
+ if ($this->template->caching && ($this->nocache || $this->tag_nocache)) {
+ $this->template->required_plugins['nocache'][$tag][$plugin_type]['file'] = $script;
+ $this->template->required_plugins['nocache'][$tag][$plugin_type]['function'] = $callback;
+ } else {
+ $this->template->required_plugins['compiled'][$tag][$plugin_type]['file'] = $script;
+ $this->template->required_plugins['compiled'][$tag][$plugin_type]['function'] = $callback;
+ }
+ include_once $script;
+ } else {
+ $this->trigger_template_error("Default plugin handler: Returned script file \"{$script}\" for \"{$tag}\" not found");
+ }
+ }
+ if (!is_string($callback) && !(is_array($callback) && is_string($callback[0]) && is_string($callback[1]))) {
+ $this->trigger_template_error("Default plugin handler: Returned callback for \"{$tag}\" must be a static function name or array of class and function name");
+ }
+ if (is_callable($callback)) {
+ $this->default_handler_plugins[$plugin_type][$tag] = array($callback, true, array());
+
+ return true;
+ } else {
+ $this->trigger_template_error("Default plugin handler: Returned callback for \"{$tag}\" not callable");
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Inject inline code for nocache template sections
+ * This method gets the content of each template element from the parser.
+ * If the content is compiled code and it should be not cached the code is injected
+ * into the rendered output.
+ *
+ * @param string $content content of template element
+ * @param boolean $is_code true if content is compiled code
+ *
+ * @return string content
+ */
+ public function processNocacheCode($content, $is_code)
+ {
+ // If the template is not evaluated and we have a nocache section and or a nocache tag
+ if ($is_code && !empty($content)) {
+ // generate replacement code
+ if ((!($this->template->source->recompiled) || $this->forceNocache) && $this->template->caching && !$this->suppressNocacheProcessing &&
+ ($this->nocache || $this->tag_nocache)
+ ) {
+ $this->template->has_nocache_code = true;
+ $_output = addcslashes($content, '\'\\');
+ $_output = str_replace("^#^", "'", $_output);
+ $_output = "<?php echo '/*%%SmartyNocache:{$this->nocache_hash}%%*/" . $_output . "/*/%%SmartyNocache:{$this->nocache_hash}%%*/';?>\n";
+ // make sure we include modifier plugins for nocache code
+ foreach ($this->modifier_plugins as $plugin_name => $dummy) {
+ if (isset($this->template->required_plugins['compiled'][$plugin_name]['modifier'])) {
+ $this->template->required_plugins['nocache'][$plugin_name]['modifier'] = $this->template->required_plugins['compiled'][$plugin_name]['modifier'];
+ }
+ }
+ } else {
+ $_output = $content;
+ }
+ } else {
+ $_output = $content;
+ }
+ $this->modifier_plugins = array();
+ $this->suppressNocacheProcessing = false;
+ $this->tag_nocache = false;
+
+ return $_output;
+ }
+
+ /**
+ * push current file and line offset on stack for tracing {block} source lines
+ *
+ * @param string $file new filename
+ * @param string $uid uid of file
+ * @param int $line line offset to source
+ * @param bool $debug false debug end_compile shall not be called
+ */
+ public function pushTrace($file, $uid, $line, $debug = true)
+ {
+ if ($this->smarty->debugging && $debug) {
+ Smarty_Internal_Debug::end_compile($this->template);
+ }
+ array_push($this->trace_stack, array($this->smarty->_current_file, $this->trace_filepath, $this->trace_uid, $this->trace_line_offset));
+ $this->trace_filepath = $this->smarty->_current_file = $file;
+ $this->trace_uid = $uid;
+ $this->trace_line_offset = $line;
+ if ($this->smarty->debugging) {
+ Smarty_Internal_Debug::start_compile($this->template);
+ }
+ }
+
+ /**
+ * restore file and line offset
+
+ */
+ public function popTrace()
+ {
+ if ($this->smarty->debugging) {
+ Smarty_Internal_Debug::end_compile($this->template);
+ }
+ $r = array_pop($this->trace_stack);
+ $this->smarty->_current_file = $r[0];
+ $this->trace_filepath = $r[1];
+ $this->trace_uid = $r[2];
+ $this->trace_line_offset = $r[3];
+ if ($this->smarty->debugging) {
+ Smarty_Internal_Debug::start_compile($this->template);
+ }
+ }
+
+ /**
+ * display compiler error messages without dying
+ * If parameter $args is empty it is a parser detected syntax error.
+ * In this case the parser is called to obtain information about expected tokens.
+ * If parameter $args contains a string this is used as error message
+ *
+ * @param string $args individual error message or null
+ * @param string $line line-number
+ *
+ * @throws SmartyCompilerException when an unexpected token is found
+ */
+ public function trigger_template_error($args = null, $line = null)
+ {
+ // get template source line which has error
+ if (!isset($line)) {
+ $line = $this->lex->line;
+ }
+ // $line += $this->trace_line_offset;
+ $match = preg_split("/\n/", $this->lex->data);
+ $error_text = 'Syntax error in template "' . (empty($this->trace_filepath) ? $this->template->source->filepath : $this->trace_filepath) . '" on line ' . ($line + $this->trace_line_offset) . ' "' . trim(preg_replace('![\t\r\n]+!', ' ', $match[$line - 1])) . '" ';
+ if (isset($args)) {
+ // individual error message
+ $error_text .= $args;
+ } else {
+ // expected token from parser
+ $error_text .= ' - Unexpected "' . $this->lex->value . '"';
+ if (count($this->parser->yy_get_expected_tokens($this->parser->yymajor)) <= 4) {
+ foreach ($this->parser->yy_get_expected_tokens($this->parser->yymajor) as $token) {
+ $exp_token = $this->parser->yyTokenName[$token];
+ if (isset($this->lex->smarty_token_names[$exp_token])) {
+ // token type from lexer
+ $expect[] = '"' . $this->lex->smarty_token_names[$exp_token] . '"';
+ } else {
+ // otherwise internal token name
+ $expect[] = $this->parser->yyTokenName[$token];
+ }
+ }
+ $error_text .= ', expected one of: ' . implode(' , ', $expect);
+ }
+ }
+ $e = new SmartyCompilerException($error_text);
+ $e->line = $line;
+ $e->source = trim(preg_replace('![\t\r\n]+!', ' ', $match[$line - 1]));
+ $e->desc = $args;
+ $e->template = $this->template->source->filepath;
+ throw $e;
+ }
+}
<?php
/**
-* Smarty Internal Plugin Templatelexer
-*
-* This is the lexer to break the template source into tokens
-* @package Smarty
-* @subpackage Compiler
-* @author Uwe Tews
-*/
+ * Smarty Internal Plugin Templatelexer
+ * This is the lexer to break the template source into tokens
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @author Uwe Tews
+ */
+
/**
-* Smarty Internal Plugin Templatelexer
-*/
+ * Smarty Internal Plugin Templatelexer
+ */
class Smarty_Internal_Templatelexer
{
public $data;
public $taglineno;
public $state = 1;
private $heredoc_id_stack = Array();
- public $smarty_token_names = array ( // Text for parser error messages
- 'IDENTITY' => '===',
- 'NONEIDENTITY' => '!==',
- 'EQUALS' => '==',
- 'NOTEQUALS' => '!=',
- 'GREATEREQUAL' => '(>=,ge)',
- 'LESSEQUAL' => '(<=,le)',
- 'GREATERTHAN' => '(>,gt)',
- 'LESSTHAN' => '(<,lt)',
- 'MOD' => '(%,mod)',
- 'NOT' => '(!,not)',
- 'LAND' => '(&&,and)',
- 'LOR' => '(||,or)',
- 'LXOR' => 'xor',
- 'OPENP' => '(',
- 'CLOSEP' => ')',
- 'OPENB' => '[',
- 'CLOSEB' => ']',
- 'PTR' => '->',
- 'APTR' => '=>',
- 'EQUAL' => '=',
- 'NUMBER' => 'number',
- 'UNIMATH' => '+" , "-',
- 'MATH' => '*" , "/" , "%',
- 'INCDEC' => '++" , "--',
- 'SPACE' => ' ',
- 'DOLLAR' => '$',
- 'SEMICOLON' => ';',
- 'COLON' => ':',
- 'DOUBLECOLON' => '::',
- 'AT' => '@',
- 'HATCH' => '#',
- 'QUOTE' => '"',
- 'BACKTICK' => '`',
- 'VERT' => '|',
- 'DOT' => '.',
- 'COMMA' => '","',
- 'ANDSYM' => '"&"',
- 'QMARK' => '"?"',
- 'ID' => 'identifier',
- 'TEXT' => 'text',
- 'FAKEPHPSTARTTAG' => 'Fake PHP start tag',
- 'PHPSTARTTAG' => 'PHP start tag',
- 'PHPENDTAG' => 'PHP end tag',
- 'LITERALSTART' => 'Literal start',
- 'LITERALEND' => 'Literal end',
- 'LDELSLASH' => 'closing tag',
- 'COMMENT' => 'comment',
- 'AS' => 'as',
- 'TO' => 'to',
- );
-
-
- function __construct($data,$compiler)
- {
-// $this->data = preg_replace("/(\r\n|\r|\n)/", "\n", $data);
+ public $yyTraceFILE;
+ public $yyTracePrompt;
+ public $state_name = array(1 => 'TEXT', 2 => 'SMARTY', 3 => 'LITERAL', 4 => 'DOUBLEQUOTEDSTRING', 5 => 'CHILDBODY');
+ public $smarty_token_names = array( // Text for parser error messages
+ 'IDENTITY' => '===',
+ 'NONEIDENTITY' => '!==',
+ 'EQUALS' => '==',
+ 'NOTEQUALS' => '!=',
+ 'GREATEREQUAL' => '(>=,ge)',
+ 'LESSEQUAL' => '(<=,le)',
+ 'GREATERTHAN' => '(>,gt)',
+ 'LESSTHAN' => '(<,lt)',
+ 'MOD' => '(%,mod)',
+ 'NOT' => '(!,not)',
+ 'LAND' => '(&&,and)',
+ 'LOR' => '(||,or)',
+ 'LXOR' => 'xor',
+ 'OPENP' => '(',
+ 'CLOSEP' => ')',
+ 'OPENB' => '[',
+ 'CLOSEB' => ']',
+ 'PTR' => '->',
+ 'APTR' => '=>',
+ 'EQUAL' => '=',
+ 'NUMBER' => 'number',
+ 'UNIMATH' => '+" , "-',
+ 'MATH' => '*" , "/" , "%',
+ 'INCDEC' => '++" , "--',
+ 'SPACE' => ' ',
+ 'DOLLAR' => '$',
+ 'SEMICOLON' => ';',
+ 'COLON' => ':',
+ 'DOUBLECOLON' => '::',
+ 'AT' => '@',
+ 'HATCH' => '#',
+ 'QUOTE' => '"',
+ 'BACKTICK' => '`',
+ 'VERT' => '|',
+ 'DOT' => '.',
+ 'COMMA' => '","',
+ 'ANDSYM' => '"&"',
+ 'QMARK' => '"?"',
+ 'ID' => 'identifier',
+ 'TEXT' => 'text',
+ 'FAKEPHPSTARTTAG' => 'Fake PHP start tag',
+ 'PHPSTARTTAG' => 'PHP start tag',
+ 'PHPENDTAG' => 'PHP end tag',
+ 'LITERALSTART' => 'Literal start',
+ 'LITERALEND' => 'Literal end',
+ 'LDELSLASH' => 'closing tag',
+ 'COMMENT' => 'comment',
+ 'AS' => 'as',
+ 'TO' => 'to',
+ );
+
+ function __construct($data, $compiler)
+ {
+ // $this->data = preg_replace("/(\r\n|\r|\n)/", "\n", $data);
$this->data = $data;
$this->counter = 0;
$this->line = 1;
$this->smarty = $compiler->smarty;
$this->compiler = $compiler;
- $this->ldel = preg_quote($this->smarty->left_delimiter,'/');
+ $this->ldel = preg_quote($this->smarty->left_delimiter, '/');
$this->ldel_length = strlen($this->smarty->left_delimiter);
- $this->rdel = preg_quote($this->smarty->right_delimiter,'/');
- $this->smarty_token_names['LDEL'] = $this->smarty->left_delimiter;
- $this->smarty_token_names['RDEL'] = $this->smarty->right_delimiter;
- $this->mbstring_overload = ini_get('mbstring.func_overload') & 2;
- }
+ $this->rdel = preg_quote($this->smarty->right_delimiter, '/');
+ $this->rdel_length = strlen($this->smarty->right_delimiter);
+ $this->smarty_token_names['LDEL'] = $this->smarty->left_delimiter;
+ $this->smarty_token_names['RDEL'] = $this->smarty->right_delimiter;
+ }
+ public function PrintTrace()
+ {
+ $this->yyTraceFILE = fopen('php://output', 'w');
+ $this->yyTracePrompt = '<br>';
+ }
private $_yy_state = 1;
private $_yy_stack = array();
- function yylex()
+ public function yylex()
{
return $this->{'yylex' . $this->_yy_state}();
}
- function yypushstate($state)
+ public function yypushstate($state)
{
+ if ($this->yyTraceFILE) {
+ fprintf($this->yyTraceFILE, "%sState push %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state);
+ }
array_push($this->_yy_stack, $this->_yy_state);
$this->_yy_state = $state;
+ if ($this->yyTraceFILE) {
+ fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state);
+ }
}
- function yypopstate()
+ public function yypopstate()
{
+ if ($this->yyTraceFILE) {
+ fprintf($this->yyTraceFILE, "%sState pop %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state);
+ }
$this->_yy_state = array_pop($this->_yy_stack);
+ if ($this->yyTraceFILE) {
+ fprintf($this->yyTraceFILE, "%snew State %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state);
+ }
}
- function yybegin($state)
+ public function yybegin($state)
{
$this->_yy_state = $state;
+ if ($this->yyTraceFILE) {
+ fprintf($this->yyTraceFILE, "%sState set %s\n", $this->yyTracePrompt, isset($this->state_name[$this->_yy_state]) ? $this->state_name[$this->_yy_state] : $this->_yy_state);
+ }
}
-
-
- function yylex1()
- {
- $tokenMap = array (
- 1 => 0,
- 2 => 0,
- 3 => 1,
- 5 => 0,
- 6 => 0,
- 7 => 0,
- 8 => 0,
- 9 => 0,
- 10 => 0,
- 11 => 1,
- 13 => 0,
- 14 => 0,
- 15 => 0,
- 16 => 0,
- 17 => 0,
- 18 => 0,
- 19 => 0,
- 20 => 0,
- 21 => 0,
- 22 => 0,
- 23 => 0,
- );
- if ($this->counter >= ($this->mbstring_overload ? mb_strlen($this->data,'latin1'): strlen($this->data))) {
+ public function yylex1()
+ {
+ $tokenMap = array(
+ 1 => 0,
+ 2 => 1,
+ 4 => 0,
+ 5 => 0,
+ 6 => 0,
+ 7 => 1,
+ 9 => 0,
+ 10 => 0,
+ 11 => 0,
+ 12 => 0,
+ 13 => 0,
+ 14 => 0,
+ 15 => 0,
+ 16 => 0,
+ 17 => 0,
+ 18 => 0,
+ 19 => 0,
+ );
+ if ($this->counter >= strlen($this->data)) {
return false; // end of input
}
- $yy_global_pattern = "/\G(".$this->ldel."[$]smarty\\.block\\.child".$this->rdel.")|\G(\\{\\})|\G(".$this->ldel."\\*([\S\s]*?)\\*".$this->rdel.")|\G(".$this->ldel."strip".$this->rdel.")|\G(".$this->ldel."\\s{1,}strip\\s{1,}".$this->rdel.")|\G(".$this->ldel."\/strip".$this->rdel.")|\G(".$this->ldel."\\s{1,}\/strip\\s{1,}".$this->rdel.")|\G(".$this->ldel."\\s*literal\\s*".$this->rdel.")|\G(".$this->ldel."\\s{1,}\/)|\G(".$this->ldel."\\s*(if|elseif|else if|while)\\s+)|\G(".$this->ldel."\\s*for\\s+)|\G(".$this->ldel."\\s*foreach(?![^\s]))|\G(".$this->ldel."\\s*setfilter\\s+)|\G(".$this->ldel."\\s{1,})|\G(".$this->ldel."\/)|\G(".$this->ldel.")|\G(<\\?(?:php\\w+|=|[a-zA-Z]+)?)|\G(\\?>)|\G(<%)|\G(%>)|\G([\S\s])/iS";
+ $yy_global_pattern = "/\G(\\{\\})|\G(" . $this->ldel . "\\*([\S\s]*?)\\*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*strip\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*\/strip\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*literal\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*(if|elseif|else if|while)\\s+)|\G(" . $this->ldel . "\\s*for\\s+)|\G(" . $this->ldel . "\\s*foreach(?![^\s]))|\G(" . $this->ldel . "\\s*setfilter\\s+)|\G(" . $this->ldel . "\\s*\/)|\G(" . $this->ldel . "\\s*)|\G(<\\?(?:php\\w+|=|[a-zA-Z]+)?)|\G(\\?>)|\G(\\s*" . $this->rdel . ")|\G(<%)|\G(%>)|\G([\S\s])/iS";
do {
- if ($this->mbstring_overload ? preg_match($yy_global_pattern, mb_substr($this->data, $this->counter,2000000000,'latin1'), $yymatches) : preg_match($yy_global_pattern,$this->data, $yymatches, null, $this->counter)) {
+ if (preg_match($yy_global_pattern, $this->data, $yymatches, null, $this->counter)) {
$yysubmatches = $yymatches;
$yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
if (!count($yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' .
- ' an empty string. Input "' . substr($this->data,
- $this->counter, 5) . '... state TEXT');
+ ' an empty string. Input "' . substr($this->data,
+ $this->counter, 5) . '... state TEXT');
}
next($yymatches); // skip global match
$this->token = key($yymatches); // token number
if ($tokenMap[$this->token]) {
// extract sub-patterns for passing to lex function
$yysubmatches = array_slice($yysubmatches, $this->token + 1,
- $tokenMap[$this->token]);
+ $tokenMap[$this->token]);
} else {
$yysubmatches = array();
}
$this->value = current($yymatches); // token value
$r = $this->{'yy_r1_' . $this->token}($yysubmatches);
if ($r === null) {
- $this->counter += ($this->mbstring_overload ? mb_strlen($this->value,'latin1'): strlen($this->value));
+ $this->counter += strlen($this->value);
$this->line += substr_count($this->value, "\n");
// accept this token
return true;
// process this token in the new state
return $this->yylex();
} elseif ($r === false) {
- $this->counter += ($this->mbstring_overload ? mb_strlen($this->value,'latin1'): strlen($this->value));
+ $this->counter += strlen($this->value);
$this->line += substr_count($this->value, "\n");
- if ($this->counter >= ($this->mbstring_overload ? mb_strlen($this->data,'latin1'): strlen($this->data))) {
+ if ($this->counter >= strlen($this->data)) {
return false; // end of input
}
// skip this token
continue;
- } } else {
+ }
+ } else {
throw new Exception('Unexpected input at line' . $this->line .
- ': ' . $this->data[$this->counter]);
+ ': ' . $this->data[$this->counter]);
}
break;
} while (true);
-
} // end function
-
const TEXT = 1;
+
function yy_r1_1($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_SMARTYBLOCKCHILD;
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
}
+
function yy_r1_2($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ $this->token = Smarty_Internal_Templateparser::TP_COMMENT;
}
- function yy_r1_3($yy_subpatterns)
+
+ function yy_r1_4($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_COMMENT;
+ if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ } else {
+ $this->token = Smarty_Internal_Templateparser::TP_STRIPON;
+ }
}
+
function yy_r1_5($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_STRIPON;
+ if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ } else {
+ $this->token = Smarty_Internal_Templateparser::TP_STRIPOFF;
+ }
}
+
function yy_r1_6($yy_subpatterns)
{
- if ($this->smarty->auto_literal) {
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
- } else {
- $this->token = Smarty_Internal_Templateparser::TP_STRIPON;
- }
+ if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ } else {
+ $this->token = Smarty_Internal_Templateparser::TP_LITERALSTART;
+ $this->yypushstate(self::LITERAL);
+ }
}
+
function yy_r1_7($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_STRIPOFF;
+ if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ } else {
+ $this->token = Smarty_Internal_Templateparser::TP_LDELIF;
+ $this->yypushstate(self::SMARTY);
+ $this->taglineno = $this->line;
+ }
}
- function yy_r1_8($yy_subpatterns)
- {
- if ($this->smarty->auto_literal) {
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
- } else {
- $this->token = Smarty_Internal_Templateparser::TP_STRIPOFF;
- }
- }
function yy_r1_9($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_LITERALSTART;
- $this->yypushstate(self::LITERAL);
+ if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ } else {
+ $this->token = Smarty_Internal_Templateparser::TP_LDELFOR;
+ $this->yypushstate(self::SMARTY);
+ $this->taglineno = $this->line;
+ }
}
+
function yy_r1_10($yy_subpatterns)
{
- if ($this->smarty->auto_literal) {
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
- } else {
- $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
- $this->yypushstate(self::SMARTY);
- $this->taglineno = $this->line;
- }
+ if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ } else {
+ $this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH;
+ $this->yypushstate(self::SMARTY);
+ $this->taglineno = $this->line;
+ }
}
+
function yy_r1_11($yy_subpatterns)
{
- if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
- } else {
- $this->token = Smarty_Internal_Templateparser::TP_LDELIF;
- $this->yypushstate(self::SMARTY);
- $this->taglineno = $this->line;
- }
+ if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ } else {
+ $this->token = Smarty_Internal_Templateparser::TP_LDELSETFILTER;
+ $this->yypushstate(self::SMARTY);
+ $this->taglineno = $this->line;
+ }
+ }
+
+ function yy_r1_12($yy_subpatterns)
+ {
+
+ if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ } else {
+ $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
+ $this->yypushstate(self::SMARTY);
+ $this->taglineno = $this->line;
+ }
}
+
function yy_r1_13($yy_subpatterns)
{
- if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
- } else {
- $this->token = Smarty_Internal_Templateparser::TP_LDELFOR;
- $this->yypushstate(self::SMARTY);
- $this->taglineno = $this->line;
- }
+ if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ } else {
+ $this->token = Smarty_Internal_Templateparser::TP_LDEL;
+ $this->yypushstate(self::SMARTY);
+ $this->taglineno = $this->line;
+ }
}
+
function yy_r1_14($yy_subpatterns)
{
- if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
- } else {
- $this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH;
- $this->yypushstate(self::SMARTY);
- $this->taglineno = $this->line;
- }
+ if (in_array($this->value, Array('<?', '<?=', '<?php'))) {
+ $this->token = Smarty_Internal_Templateparser::TP_PHPSTARTTAG;
+ } elseif ($this->value == '<?xml') {
+ $this->token = Smarty_Internal_Templateparser::TP_XMLTAG;
+ } else {
+ $this->token = Smarty_Internal_Templateparser::TP_FAKEPHPSTARTTAG;
+ $this->value = substr($this->value, 0, 2);
+ }
}
+
function yy_r1_15($yy_subpatterns)
{
- if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
- } else {
- $this->token = Smarty_Internal_Templateparser::TP_LDELSETFILTER;
- $this->yypushstate(self::SMARTY);
- $this->taglineno = $this->line;
- }
+ $this->token = Smarty_Internal_Templateparser::TP_PHPENDTAG;
}
+
function yy_r1_16($yy_subpatterns)
{
- if ($this->smarty->auto_literal) {
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
- } else {
- $this->token = Smarty_Internal_Templateparser::TP_LDEL;
- $this->yypushstate(self::SMARTY);
- $this->taglineno = $this->line;
- }
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
}
+
function yy_r1_17($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
- $this->yypushstate(self::SMARTY);
- $this->taglineno = $this->line;
+ $this->token = Smarty_Internal_Templateparser::TP_ASPSTARTTAG;
}
+
function yy_r1_18($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_LDEL;
- $this->yypushstate(self::SMARTY);
- $this->taglineno = $this->line;
+ $this->token = Smarty_Internal_Templateparser::TP_ASPENDTAG;
}
+
function yy_r1_19($yy_subpatterns)
{
- if (in_array($this->value, Array('<?', '<?=', '<?php'))) {
- $this->token = Smarty_Internal_Templateparser::TP_PHPSTARTTAG;
- } elseif ($this->value == '<?xml') {
- $this->token = Smarty_Internal_Templateparser::TP_XMLTAG;
- } else {
- $this->token = Smarty_Internal_Templateparser::TP_FAKEPHPSTARTTAG;
- $this->value = substr($this->value, 0, 2);
- }
- }
- function yy_r1_20($yy_subpatterns)
- {
-
- $this->token = Smarty_Internal_Templateparser::TP_PHPENDTAG;
- }
- function yy_r1_21($yy_subpatterns)
- {
-
- $this->token = Smarty_Internal_Templateparser::TP_ASPSTARTTAG;
- }
- function yy_r1_22($yy_subpatterns)
- {
-
- $this->token = Smarty_Internal_Templateparser::TP_ASPENDTAG;
- }
- function yy_r1_23($yy_subpatterns)
- {
-
- if ($this->mbstring_overload) {
- $to = mb_strlen($this->data,'latin1');
- } else {
- $to = strlen($this->data);
- }
- preg_match("/{$this->ldel}|<\?|\?>|<%|%>/",$this->data,$match,PREG_OFFSET_CAPTURE,$this->counter);
- if (isset($match[0][1])) {
- $to = $match[0][1];
- }
- if ($this->mbstring_overload) {
- $this->value = mb_substr($this->data,$this->counter,$to-$this->counter,'latin1');
- } else {
- $this->value = substr($this->data,$this->counter,$to-$this->counter);
- }
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
- }
-
-
- function yylex2()
- {
- $tokenMap = array (
- 1 => 0,
- 2 => 0,
- 3 => 1,
- 5 => 0,
- 6 => 0,
- 7 => 0,
- 8 => 0,
- 9 => 0,
- 10 => 0,
- 11 => 0,
- 12 => 0,
- 13 => 0,
- 14 => 0,
- 15 => 0,
- 16 => 0,
- 17 => 0,
- 18 => 0,
- 19 => 0,
- 20 => 1,
- 22 => 1,
- 24 => 1,
- 26 => 0,
- 27 => 0,
- 28 => 0,
- 29 => 0,
- 30 => 0,
- 31 => 0,
- 32 => 0,
- 33 => 0,
- 34 => 0,
- 35 => 0,
- 36 => 0,
- 37 => 0,
- 38 => 0,
- 39 => 0,
- 40 => 0,
- 41 => 0,
- 42 => 0,
- 43 => 3,
- 47 => 0,
- 48 => 0,
- 49 => 0,
- 50 => 0,
- 51 => 0,
- 52 => 0,
- 53 => 0,
- 54 => 0,
- 55 => 1,
- 57 => 1,
- 59 => 0,
- 60 => 0,
- 61 => 0,
- 62 => 0,
- 63 => 0,
- 64 => 0,
- 65 => 0,
- 66 => 0,
- 67 => 0,
- 68 => 0,
- 69 => 0,
- 70 => 0,
- 71 => 0,
- 72 => 0,
- 73 => 0,
- 74 => 0,
- 75 => 0,
- 76 => 0,
- 77 => 0,
- );
- if ($this->counter >= ($this->mbstring_overload ? mb_strlen($this->data,'latin1'): strlen($this->data))) {
+ $to = strlen($this->data);
+ preg_match("/{$this->ldel}|<\?|\?>|<%|%>/", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
+ if (isset($match[0][1])) {
+ $to = $match[0][1];
+ }
+ $this->value = substr($this->data, $this->counter, $to - $this->counter);
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ }
+
+ public function yylex2()
+ {
+ $tokenMap = array(
+ 1 => 0,
+ 2 => 0,
+ 3 => 1,
+ 5 => 0,
+ 6 => 0,
+ 7 => 0,
+ 8 => 0,
+ 9 => 0,
+ 10 => 0,
+ 11 => 0,
+ 12 => 0,
+ 13 => 0,
+ 14 => 0,
+ 15 => 1,
+ 17 => 1,
+ 19 => 1,
+ 21 => 0,
+ 22 => 0,
+ 23 => 0,
+ 24 => 0,
+ 25 => 0,
+ 26 => 0,
+ 27 => 0,
+ 28 => 0,
+ 29 => 0,
+ 30 => 0,
+ 31 => 0,
+ 32 => 0,
+ 33 => 0,
+ 34 => 0,
+ 35 => 0,
+ 36 => 0,
+ 37 => 0,
+ 38 => 3,
+ 42 => 0,
+ 43 => 0,
+ 44 => 0,
+ 45 => 0,
+ 46 => 0,
+ 47 => 0,
+ 48 => 0,
+ 49 => 0,
+ 50 => 1,
+ 52 => 1,
+ 54 => 0,
+ 55 => 0,
+ 56 => 0,
+ 57 => 0,
+ 58 => 0,
+ 59 => 0,
+ 60 => 0,
+ 61 => 0,
+ 62 => 0,
+ 63 => 0,
+ 64 => 0,
+ 65 => 0,
+ 66 => 0,
+ 67 => 0,
+ 68 => 0,
+ 69 => 0,
+ 70 => 1,
+ 72 => 0,
+ 73 => 0,
+ 74 => 0,
+ 75 => 0,
+ 76 => 0,
+ );
+ if ($this->counter >= strlen($this->data)) {
return false; // end of input
}
- $yy_global_pattern = "/\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*')|\G(".$this->ldel."\\s{1,}\/)|\G(".$this->ldel."\\s*(if|elseif|else if|while)\\s+)|\G(".$this->ldel."\\s*for\\s+)|\G(".$this->ldel."\\s*foreach(?![^\s]))|\G(".$this->ldel."\\s{1,})|\G(\\s{1,}".$this->rdel.")|\G(".$this->ldel."\/)|\G(".$this->ldel.")|\G(".$this->rdel.")|\G(\\s+is\\s+in\\s+)|\G(\\s+as\\s+)|\G(\\s+to\\s+)|\G(\\s+step\\s+)|\G(\\s+instanceof\\s+)|\G(\\s*===\\s*)|\G(\\s*!==\\s*)|\G(\\s*==\\s*|\\s+eq\\s+)|\G(\\s*!=\\s*|\\s*<>\\s*|\\s+(ne|neq)\\s+)|\G(\\s*>=\\s*|\\s+(ge|gte)\\s+)|\G(\\s*<=\\s*|\\s+(le|lte)\\s+)|\G(\\s*>\\s*|\\s+gt\\s+)|\G(\\s*<\\s*|\\s+lt\\s+)|\G(\\s+mod\\s+)|\G(!\\s*|not\\s+)|\G(\\s*&&\\s*|\\s*and\\s+)|\G(\\s*\\|\\|\\s*|\\s*or\\s+)|\G(\\s*xor\\s+)|\G(\\s+is\\s+odd\\s+by\\s+)|\G(\\s+is\\s+not\\s+odd\\s+by\\s+)|\G(\\s+is\\s+odd)|\G(\\s+is\\s+not\\s+odd)|\G(\\s+is\\s+even\\s+by\\s+)|\G(\\s+is\\s+not\\s+even\\s+by\\s+)|\G(\\s+is\\s+even)|\G(\\s+is\\s+not\\s+even)|\G(\\s+is\\s+div\\s+by\\s+)|\G(\\s+is\\s+not\\s+div\\s+by\\s+)|\G(\\((int(eger)?|bool(ean)?|float|double|real|string|binary|array|object)\\)\\s*)|\G(\\s*\\(\\s*)|\G(\\s*\\))|\G(\\[\\s*)|\G(\\s*\\])|\G(\\s*->\\s*)|\G(\\s*=>\\s*)|\G(\\s*=\\s*)|\G(\\+\\+|--)|\G(\\s*(\\+|-)\\s*)|\G(\\s*(\\*|\/|%)\\s*)|\G(\\$)|\G(\\s*;)|\G(::)|\G(\\s*:\\s*)|\G(@)|\G(#)|\G(\")|\G(`)|\G(\\|)|\G(\\.)|\G(\\s*,\\s*)|\G(\\s*&\\s*)|\G(\\s*\\?\\s*)|\G(0[xX][0-9a-fA-F]+)|\G(\\s+[0-9]*[a-zA-Z_][a-zA-Z0-9_\-:]*\\s?=\\s?)|\G([0-9]*[a-zA-Z_]\\w*)|\G(\\d+)|\G(\\s+)|\G([\S\s])/iS";
+ $yy_global_pattern = "/\G(\")|\G('[^'\\\\]*(?:\\\\.[^'\\\\]*)*')|\G([$]smarty\\.block\\.(child|parent))|\G(\\$)|\G(\\s*" . $this->rdel . ")|\G(\\s+is\\s+in\\s+)|\G(\\s+as\\s+)|\G(\\s+to\\s+)|\G(\\s+step\\s+)|\G(\\s+instanceof\\s+)|\G(\\s*===\\s*)|\G(\\s*!==\\s*)|\G(\\s*==\\s*|\\s+eq\\s+)|\G(\\s*!=\\s*|\\s*<>\\s*|\\s+(ne|neq)\\s+)|\G(\\s*>=\\s*|\\s+(ge|gte)\\s+)|\G(\\s*<=\\s*|\\s+(le|lte)\\s+)|\G(\\s*>\\s*|\\s+gt\\s+)|\G(\\s*<\\s*|\\s+lt\\s+)|\G(\\s+mod\\s+)|\G(!\\s*|not\\s+)|\G(\\s*&&\\s*|\\s*and\\s+)|\G(\\s*\\|\\|\\s*|\\s*or\\s+)|\G(\\s*xor\\s+)|\G(\\s+is\\s+odd\\s+by\\s+)|\G(\\s+is\\s+not\\s+odd\\s+by\\s+)|\G(\\s+is\\s+odd)|\G(\\s+is\\s+not\\s+odd)|\G(\\s+is\\s+even\\s+by\\s+)|\G(\\s+is\\s+not\\s+even\\s+by\\s+)|\G(\\s+is\\s+even)|\G(\\s+is\\s+not\\s+even)|\G(\\s+is\\s+div\\s+by\\s+)|\G(\\s+is\\s+not\\s+div\\s+by\\s+)|\G(\\((int(eger)?|bool(ean)?|float|double|real|string|binary|array|object)\\)\\s*)|\G(\\s*\\(\\s*)|\G(\\s*\\))|\G(\\[\\s*)|\G(\\s*\\])|\G(\\s*->\\s*)|\G(\\s*=>\\s*)|\G(\\s*=\\s*)|\G(\\+\\+|--)|\G(\\s*(\\+|-)\\s*)|\G(\\s*(\\*|\/|%)\\s*)|\G(@)|\G(#)|\G(\\s+[0-9]*[a-zA-Z_][a-zA-Z0-9_\-:]*\\s*=\\s*)|\G([0-9]*[a-zA-Z_]\\w*)|\G(\\d+)|\G(`)|\G(\\|)|\G(\\.)|\G(\\s*,\\s*)|\G(\\s*;)|\G(::)|\G(\\s*:\\s*)|\G(\\s*&\\s*)|\G(\\s*\\?\\s*)|\G(0[xX][0-9a-fA-F]+)|\G(\\s+)|\G(" . $this->ldel . "\\s*(if|elseif|else if|while)\\s+)|\G(" . $this->ldel . "\\s*for\\s+)|\G(" . $this->ldel . "\\s*foreach(?![^\s]))|\G(" . $this->ldel . "\\s*\/)|\G(" . $this->ldel . "\\s*)|\G([\S\s])/iS";
do {
- if ($this->mbstring_overload ? preg_match($yy_global_pattern, mb_substr($this->data, $this->counter,2000000000,'latin1'), $yymatches) : preg_match($yy_global_pattern,$this->data, $yymatches, null, $this->counter)) {
+ if (preg_match($yy_global_pattern, $this->data, $yymatches, null, $this->counter)) {
$yysubmatches = $yymatches;
$yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
if (!count($yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' .
- ' an empty string. Input "' . substr($this->data,
- $this->counter, 5) . '... state SMARTY');
+ ' an empty string. Input "' . substr($this->data,
+ $this->counter, 5) . '... state SMARTY');
}
next($yymatches); // skip global match
$this->token = key($yymatches); // token number
if ($tokenMap[$this->token]) {
// extract sub-patterns for passing to lex function
$yysubmatches = array_slice($yysubmatches, $this->token + 1,
- $tokenMap[$this->token]);
+ $tokenMap[$this->token]);
} else {
$yysubmatches = array();
}
$this->value = current($yymatches); // token value
$r = $this->{'yy_r2_' . $this->token}($yysubmatches);
if ($r === null) {
- $this->counter += ($this->mbstring_overload ? mb_strlen($this->value,'latin1'): strlen($this->value));
+ $this->counter += strlen($this->value);
$this->line += substr_count($this->value, "\n");
// accept this token
return true;
// process this token in the new state
return $this->yylex();
} elseif ($r === false) {
- $this->counter += ($this->mbstring_overload ? mb_strlen($this->value,'latin1'): strlen($this->value));
+ $this->counter += strlen($this->value);
$this->line += substr_count($this->value, "\n");
- if ($this->counter >= ($this->mbstring_overload ? mb_strlen($this->data,'latin1'): strlen($this->data))) {
+ if ($this->counter >= strlen($this->data)) {
return false; // end of input
}
// skip this token
continue;
- } } else {
+ }
+ } else {
throw new Exception('Unexpected input at line' . $this->line .
- ': ' . $this->data[$this->counter]);
+ ': ' . $this->data[$this->counter]);
}
break;
} while (true);
-
} // end function
-
const SMARTY = 2;
+
function yy_r2_1($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_SINGLEQUOTESTRING;
+ $this->token = Smarty_Internal_Templateparser::TP_QUOTE;
+ $this->yypushstate(self::DOUBLEQUOTEDSTRING);
}
+
function yy_r2_2($yy_subpatterns)
{
- if ($this->smarty->auto_literal) {
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
- } else {
- $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
- $this->yypushstate(self::SMARTY);
- $this->taglineno = $this->line;
- }
+ $this->token = Smarty_Internal_Templateparser::TP_SINGLEQUOTESTRING;
}
+
function yy_r2_3($yy_subpatterns)
{
- if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
- } else {
- $this->token = Smarty_Internal_Templateparser::TP_LDELIF;
- $this->yypushstate(self::SMARTY);
- $this->taglineno = $this->line;
- }
+ $this->token = Smarty_Internal_Templateparser::TP_SMARTYBLOCKCHILDPARENT;
+ $this->taglineno = $this->line;
}
+
function yy_r2_5($yy_subpatterns)
{
- if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
- } else {
- $this->token = Smarty_Internal_Templateparser::TP_LDELFOR;
- $this->yypushstate(self::SMARTY);
- $this->taglineno = $this->line;
- }
+ $this->token = Smarty_Internal_Templateparser::TP_DOLLAR;
}
+
function yy_r2_6($yy_subpatterns)
{
- if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
- } else {
- $this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH;
- $this->yypushstate(self::SMARTY);
- $this->taglineno = $this->line;
- }
+ $this->token = Smarty_Internal_Templateparser::TP_RDEL;
+ $this->yypopstate();
}
+
function yy_r2_7($yy_subpatterns)
{
- if ($this->smarty->auto_literal) {
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
- } else {
- $this->token = Smarty_Internal_Templateparser::TP_LDEL;
- $this->yypushstate(self::SMARTY);
- $this->taglineno = $this->line;
- }
+ $this->token = Smarty_Internal_Templateparser::TP_ISIN;
}
+
function yy_r2_8($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_RDEL;
- $this->yypopstate();
+ $this->token = Smarty_Internal_Templateparser::TP_AS;
}
+
function yy_r2_9($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
- $this->yypushstate(self::SMARTY);
- $this->taglineno = $this->line;
+ $this->token = Smarty_Internal_Templateparser::TP_TO;
}
+
function yy_r2_10($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_LDEL;
- $this->yypushstate(self::SMARTY);
- $this->taglineno = $this->line;
+ $this->token = Smarty_Internal_Templateparser::TP_STEP;
}
+
function yy_r2_11($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_RDEL;
- $this->yypopstate();
+ $this->token = Smarty_Internal_Templateparser::TP_INSTANCEOF;
}
+
function yy_r2_12($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_ISIN;
+ $this->token = Smarty_Internal_Templateparser::TP_IDENTITY;
}
+
function yy_r2_13($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_AS;
+ $this->token = Smarty_Internal_Templateparser::TP_NONEIDENTITY;
}
+
function yy_r2_14($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_TO;
+ $this->token = Smarty_Internal_Templateparser::TP_EQUALS;
}
+
function yy_r2_15($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_STEP;
+ $this->token = Smarty_Internal_Templateparser::TP_NOTEQUALS;
}
- function yy_r2_16($yy_subpatterns)
- {
- $this->token = Smarty_Internal_Templateparser::TP_INSTANCEOF;
- }
function yy_r2_17($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_IDENTITY;
+ $this->token = Smarty_Internal_Templateparser::TP_GREATEREQUAL;
}
- function yy_r2_18($yy_subpatterns)
- {
- $this->token = Smarty_Internal_Templateparser::TP_NONEIDENTITY;
- }
function yy_r2_19($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_EQUALS;
+ $this->token = Smarty_Internal_Templateparser::TP_LESSEQUAL;
}
- function yy_r2_20($yy_subpatterns)
+
+ function yy_r2_21($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_NOTEQUALS;
+ $this->token = Smarty_Internal_Templateparser::TP_GREATERTHAN;
}
+
function yy_r2_22($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_GREATEREQUAL;
+ $this->token = Smarty_Internal_Templateparser::TP_LESSTHAN;
+ }
+
+ function yy_r2_23($yy_subpatterns)
+ {
+
+ $this->token = Smarty_Internal_Templateparser::TP_MOD;
}
+
function yy_r2_24($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_LESSEQUAL;
+ $this->token = Smarty_Internal_Templateparser::TP_NOT;
}
+
+ function yy_r2_25($yy_subpatterns)
+ {
+
+ $this->token = Smarty_Internal_Templateparser::TP_LAND;
+ }
+
function yy_r2_26($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_GREATERTHAN;
+ $this->token = Smarty_Internal_Templateparser::TP_LOR;
}
+
function yy_r2_27($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_LESSTHAN;
+ $this->token = Smarty_Internal_Templateparser::TP_LXOR;
}
+
function yy_r2_28($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_MOD;
+ $this->token = Smarty_Internal_Templateparser::TP_ISODDBY;
}
+
function yy_r2_29($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_NOT;
+ $this->token = Smarty_Internal_Templateparser::TP_ISNOTODDBY;
}
+
function yy_r2_30($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_LAND;
+ $this->token = Smarty_Internal_Templateparser::TP_ISODD;
}
+
function yy_r2_31($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_LOR;
+ $this->token = Smarty_Internal_Templateparser::TP_ISNOTODD;
}
+
function yy_r2_32($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_LXOR;
+ $this->token = Smarty_Internal_Templateparser::TP_ISEVENBY;
}
+
function yy_r2_33($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_ISODDBY;
+ $this->token = Smarty_Internal_Templateparser::TP_ISNOTEVENBY;
}
+
function yy_r2_34($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_ISNOTODDBY;
+ $this->token = Smarty_Internal_Templateparser::TP_ISEVEN;
}
+
function yy_r2_35($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_ISODD;
+ $this->token = Smarty_Internal_Templateparser::TP_ISNOTEVEN;
}
+
function yy_r2_36($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_ISNOTODD;
+ $this->token = Smarty_Internal_Templateparser::TP_ISDIVBY;
}
+
function yy_r2_37($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_ISEVENBY;
+ $this->token = Smarty_Internal_Templateparser::TP_ISNOTDIVBY;
}
+
function yy_r2_38($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_ISNOTEVENBY;
+ $this->token = Smarty_Internal_Templateparser::TP_TYPECAST;
}
- function yy_r2_39($yy_subpatterns)
+
+ function yy_r2_42($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_ISEVEN;
+ $this->token = Smarty_Internal_Templateparser::TP_OPENP;
}
- function yy_r2_40($yy_subpatterns)
+
+ function yy_r2_43($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_ISNOTEVEN;
+ $this->token = Smarty_Internal_Templateparser::TP_CLOSEP;
}
- function yy_r2_41($yy_subpatterns)
+
+ function yy_r2_44($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_ISDIVBY;
+ $this->token = Smarty_Internal_Templateparser::TP_OPENB;
}
- function yy_r2_42($yy_subpatterns)
+
+ function yy_r2_45($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_ISNOTDIVBY;
+ $this->token = Smarty_Internal_Templateparser::TP_CLOSEB;
}
- function yy_r2_43($yy_subpatterns)
+
+ function yy_r2_46($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_TYPECAST;
+ $this->token = Smarty_Internal_Templateparser::TP_PTR;
}
+
function yy_r2_47($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_OPENP;
+ $this->token = Smarty_Internal_Templateparser::TP_APTR;
}
+
function yy_r2_48($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_CLOSEP;
+ $this->token = Smarty_Internal_Templateparser::TP_EQUAL;
}
+
function yy_r2_49($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_OPENB;
+ $this->token = Smarty_Internal_Templateparser::TP_INCDEC;
}
+
function yy_r2_50($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_CLOSEB;
+ $this->token = Smarty_Internal_Templateparser::TP_UNIMATH;
}
- function yy_r2_51($yy_subpatterns)
- {
- $this->token = Smarty_Internal_Templateparser::TP_PTR;
- }
function yy_r2_52($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_APTR;
+ $this->token = Smarty_Internal_Templateparser::TP_MATH;
}
- function yy_r2_53($yy_subpatterns)
- {
- $this->token = Smarty_Internal_Templateparser::TP_EQUAL;
- }
function yy_r2_54($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_INCDEC;
+ $this->token = Smarty_Internal_Templateparser::TP_AT;
}
+
function yy_r2_55($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_UNIMATH;
+ $this->token = Smarty_Internal_Templateparser::TP_HATCH;
}
+
+ function yy_r2_56($yy_subpatterns)
+ {
+
+ // resolve conflicts with shorttag and right_delimiter starting with '='
+ if (substr($this->data, $this->counter + strlen($this->value) - 1, $this->rdel_length) == $this->smarty->right_delimiter) {
+ preg_match("/\s+/", $this->value, $match);
+ $this->value = $match[0];
+ $this->token = Smarty_Internal_Templateparser::TP_SPACE;
+ } else {
+ $this->token = Smarty_Internal_Templateparser::TP_ATTR;
+ }
+ }
+
function yy_r2_57($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_MATH;
+ $this->token = Smarty_Internal_Templateparser::TP_ID;
+ }
+
+ function yy_r2_58($yy_subpatterns)
+ {
+
+ $this->token = Smarty_Internal_Templateparser::TP_INTEGER;
}
+
function yy_r2_59($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_DOLLAR;
+ $this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
+ $this->yypopstate();
}
+
function yy_r2_60($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_SEMICOLON;
+ $this->token = Smarty_Internal_Templateparser::TP_VERT;
}
+
function yy_r2_61($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_DOUBLECOLON;
+ $this->token = Smarty_Internal_Templateparser::TP_DOT;
}
+
function yy_r2_62($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_COLON;
+ $this->token = Smarty_Internal_Templateparser::TP_COMMA;
}
+
function yy_r2_63($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_AT;
+ $this->token = Smarty_Internal_Templateparser::TP_SEMICOLON;
}
+
function yy_r2_64($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_HATCH;
+ $this->token = Smarty_Internal_Templateparser::TP_DOUBLECOLON;
}
+
function yy_r2_65($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_QUOTE;
- $this->yypushstate(self::DOUBLEQUOTEDSTRING);
+ $this->token = Smarty_Internal_Templateparser::TP_COLON;
}
+
function yy_r2_66($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
- $this->yypopstate();
+ $this->token = Smarty_Internal_Templateparser::TP_ANDSYM;
}
+
function yy_r2_67($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_VERT;
+ $this->token = Smarty_Internal_Templateparser::TP_QMARK;
}
+
function yy_r2_68($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_DOT;
+ $this->token = Smarty_Internal_Templateparser::TP_HEX;
}
+
function yy_r2_69($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_COMMA;
+ $this->token = Smarty_Internal_Templateparser::TP_SPACE;
}
+
function yy_r2_70($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_ANDSYM;
+ if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ } else {
+ $this->token = Smarty_Internal_Templateparser::TP_LDELIF;
+ $this->yypushstate(self::SMARTY);
+ $this->taglineno = $this->line;
+ }
}
- function yy_r2_71($yy_subpatterns)
- {
- $this->token = Smarty_Internal_Templateparser::TP_QMARK;
- }
function yy_r2_72($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_HEX;
+ if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ } else {
+ $this->token = Smarty_Internal_Templateparser::TP_LDELFOR;
+ $this->yypushstate(self::SMARTY);
+ $this->taglineno = $this->line;
+ }
}
+
function yy_r2_73($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_ATTR;
+ if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ } else {
+ $this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH;
+ $this->yypushstate(self::SMARTY);
+ $this->taglineno = $this->line;
+ }
}
+
function yy_r2_74($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_ID;
+ if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ } else {
+ $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
+ $this->yypushstate(self::SMARTY);
+ $this->taglineno = $this->line;
+ }
}
+
function yy_r2_75($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_INTEGER;
+ if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ } else {
+ $this->token = Smarty_Internal_Templateparser::TP_LDEL;
+ $this->yypushstate(self::SMARTY);
+ $this->taglineno = $this->line;
+ }
}
- function yy_r2_76($yy_subpatterns)
- {
- $this->token = Smarty_Internal_Templateparser::TP_SPACE;
- }
- function yy_r2_77($yy_subpatterns)
+ function yy_r2_76($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
}
-
-
- function yylex3()
+ public function yylex3()
{
- $tokenMap = array (
- 1 => 0,
- 2 => 0,
- 3 => 0,
- 4 => 0,
- 5 => 0,
- 6 => 0,
- 7 => 0,
- );
- if ($this->counter >= ($this->mbstring_overload ? mb_strlen($this->data,'latin1'): strlen($this->data))) {
+ $tokenMap = array(
+ 1 => 0,
+ 2 => 0,
+ 3 => 0,
+ 4 => 0,
+ 5 => 0,
+ 6 => 0,
+ 7 => 0,
+ );
+ if ($this->counter >= strlen($this->data)) {
return false; // end of input
}
- $yy_global_pattern = "/\G(".$this->ldel."\\s*literal\\s*".$this->rdel.")|\G(".$this->ldel."\\s*\/literal\\s*".$this->rdel.")|\G(<\\?(?:php\\w+|=|[a-zA-Z]+)?)|\G(\\?>)|\G(<%)|\G(%>)|\G([\S\s])/iS";
+ $yy_global_pattern = "/\G(" . $this->ldel . "\\s*literal\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*\/literal\\s*" . $this->rdel . ")|\G(<\\?(?:php\\w+|=|[a-zA-Z]+)?)|\G(\\?>)|\G(<%)|\G(%>)|\G([\S\s])/iS";
do {
- if ($this->mbstring_overload ? preg_match($yy_global_pattern, mb_substr($this->data, $this->counter,2000000000,'latin1'), $yymatches) : preg_match($yy_global_pattern,$this->data, $yymatches, null, $this->counter)) {
+ if (preg_match($yy_global_pattern, $this->data, $yymatches, null, $this->counter)) {
$yysubmatches = $yymatches;
$yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
if (!count($yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' .
- ' an empty string. Input "' . substr($this->data,
- $this->counter, 5) . '... state LITERAL');
+ ' an empty string. Input "' . substr($this->data,
+ $this->counter, 5) . '... state LITERAL');
}
next($yymatches); // skip global match
$this->token = key($yymatches); // token number
if ($tokenMap[$this->token]) {
// extract sub-patterns for passing to lex function
$yysubmatches = array_slice($yysubmatches, $this->token + 1,
- $tokenMap[$this->token]);
+ $tokenMap[$this->token]);
} else {
$yysubmatches = array();
}
$this->value = current($yymatches); // token value
$r = $this->{'yy_r3_' . $this->token}($yysubmatches);
if ($r === null) {
- $this->counter += ($this->mbstring_overload ? mb_strlen($this->value,'latin1'): strlen($this->value));
+ $this->counter += strlen($this->value);
$this->line += substr_count($this->value, "\n");
// accept this token
return true;
// process this token in the new state
return $this->yylex();
} elseif ($r === false) {
- $this->counter += ($this->mbstring_overload ? mb_strlen($this->value,'latin1'): strlen($this->value));
+ $this->counter += strlen($this->value);
$this->line += substr_count($this->value, "\n");
- if ($this->counter >= ($this->mbstring_overload ? mb_strlen($this->data,'latin1'): strlen($this->data))) {
+ if ($this->counter >= strlen($this->data)) {
return false; // end of input
}
// skip this token
continue;
- } } else {
+ }
+ } else {
throw new Exception('Unexpected input at line' . $this->line .
- ': ' . $this->data[$this->counter]);
+ ': ' . $this->data[$this->counter]);
}
break;
} while (true);
-
} // end function
-
const LITERAL = 3;
+
function yy_r3_1($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_LITERALSTART;
- $this->yypushstate(self::LITERAL);
+ if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ } else {
+ $this->token = Smarty_Internal_Templateparser::TP_LITERALSTART;
+ $this->yypushstate(self::LITERAL);
+ }
}
+
function yy_r3_2($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_LITERALEND;
- $this->yypopstate();
+ if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ } else {
+ $this->token = Smarty_Internal_Templateparser::TP_LITERALEND;
+ $this->yypopstate();
+ }
}
+
function yy_r3_3($yy_subpatterns)
{
- if (in_array($this->value, Array('<?', '<?=', '<?php'))) {
- $this->token = Smarty_Internal_Templateparser::TP_PHPSTARTTAG;
- } else {
- $this->token = Smarty_Internal_Templateparser::TP_FAKEPHPSTARTTAG;
- $this->value = substr($this->value, 0, 2);
- }
+ if (in_array($this->value, Array('<?', '<?=', '<?php'))) {
+ $this->token = Smarty_Internal_Templateparser::TP_PHPSTARTTAG;
+ } else {
+ $this->token = Smarty_Internal_Templateparser::TP_FAKEPHPSTARTTAG;
+ $this->value = substr($this->value, 0, 2);
+ }
}
+
function yy_r3_4($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_PHPENDTAG;
+ $this->token = Smarty_Internal_Templateparser::TP_PHPENDTAG;
}
+
function yy_r3_5($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_ASPSTARTTAG;
+ $this->token = Smarty_Internal_Templateparser::TP_ASPSTARTTAG;
}
+
function yy_r3_6($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_ASPENDTAG;
+ $this->token = Smarty_Internal_Templateparser::TP_ASPENDTAG;
}
+
function yy_r3_7($yy_subpatterns)
{
- if ($this->mbstring_overload) {
- $to = mb_strlen($this->data,'latin1');
- } else {
- $to = strlen($this->data);
- }
- preg_match("/{$this->ldel}\/?literal{$this->rdel}|<\?|<%|\?>|%>/",$this->data,$match,PREG_OFFSET_CAPTURE,$this->counter);
- if (isset($match[0][1])) {
- $to = $match[0][1];
- } else {
- $this->compiler->trigger_template_error ("missing or misspelled literal closing tag");
- }
- if ($this->mbstring_overload) {
- $this->value = mb_substr($this->data,$this->counter,$to-$this->counter,'latin1');
- } else {
- $this->value = substr($this->data,$this->counter,$to-$this->counter);
- }
- $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
- }
-
-
- function yylex4()
- {
- $tokenMap = array (
- 1 => 0,
- 2 => 1,
- 4 => 0,
- 5 => 0,
- 6 => 0,
- 7 => 0,
- 8 => 0,
- 9 => 0,
- 10 => 0,
- 11 => 0,
- 12 => 0,
- 13 => 3,
- 17 => 0,
- );
- if ($this->counter >= ($this->mbstring_overload ? mb_strlen($this->data,'latin1'): strlen($this->data))) {
+ $to = strlen($this->data);
+ preg_match("/{$this->ldel}\/?literal{$this->rdel}|<\?|<%|\?>|%>/", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
+ if (isset($match[0][1])) {
+ $to = $match[0][1];
+ } else {
+ $this->compiler->trigger_template_error("missing or misspelled literal closing tag");
+ }
+ $this->value = substr($this->data, $this->counter, $to - $this->counter);
+ $this->token = Smarty_Internal_Templateparser::TP_LITERAL;
+ }
+
+ public function yylex4()
+ {
+ $tokenMap = array(
+ 1 => 1,
+ 3 => 0,
+ 4 => 0,
+ 5 => 0,
+ 6 => 0,
+ 7 => 0,
+ 8 => 0,
+ 9 => 0,
+ 10 => 0,
+ 11 => 3,
+ 15 => 0,
+ );
+ if ($this->counter >= strlen($this->data)) {
return false; // end of input
}
- $yy_global_pattern = "/\G(".$this->ldel."\\s{1,}\/)|\G(".$this->ldel."\\s*(if|elseif|else if|while)\\s+)|\G(".$this->ldel."\\s*for\\s+)|\G(".$this->ldel."\\s*foreach(?![^\s]))|\G(".$this->ldel."\\s{1,})|\G(".$this->ldel."\/)|\G(".$this->ldel.")|\G(\")|\G(`\\$)|\G(\\$[0-9]*[a-zA-Z_]\\w*)|\G(\\$)|\G(([^\"\\\\]*?)((?:\\\\.[^\"\\\\]*?)*?)(?=(".$this->ldel."|\\$|`\\$|\")))|\G([\S\s])/iS";
+ $yy_global_pattern = "/\G(" . $this->ldel . "\\s*(if|elseif|else if|while)\\s+)|\G(" . $this->ldel . "\\s*for\\s+)|\G(" . $this->ldel . "\\s*foreach(?![^\s]))|\G(" . $this->ldel . "\\s*\/)|\G(" . $this->ldel . "\\s*)|\G(\")|\G(`\\$)|\G(\\$[0-9]*[a-zA-Z_]\\w*)|\G(\\$)|\G(([^\"\\\\]*?)((?:\\\\.[^\"\\\\]*?)*?)(?=(" . $this->ldel . "|\\$|`\\$|\")))|\G([\S\s])/iS";
do {
- if ($this->mbstring_overload ? preg_match($yy_global_pattern, mb_substr($this->data, $this->counter,2000000000,'latin1'), $yymatches) : preg_match($yy_global_pattern,$this->data, $yymatches, null, $this->counter)) {
+ if (preg_match($yy_global_pattern, $this->data, $yymatches, null, $this->counter)) {
$yysubmatches = $yymatches;
$yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
if (!count($yymatches)) {
throw new Exception('Error: lexing failed because a rule matched' .
- ' an empty string. Input "' . substr($this->data,
- $this->counter, 5) . '... state DOUBLEQUOTEDSTRING');
+ ' an empty string. Input "' . substr($this->data,
+ $this->counter, 5) . '... state DOUBLEQUOTEDSTRING');
}
next($yymatches); // skip global match
$this->token = key($yymatches); // token number
if ($tokenMap[$this->token]) {
// extract sub-patterns for passing to lex function
$yysubmatches = array_slice($yysubmatches, $this->token + 1,
- $tokenMap[$this->token]);
+ $tokenMap[$this->token]);
} else {
$yysubmatches = array();
}
$this->value = current($yymatches); // token value
$r = $this->{'yy_r4_' . $this->token}($yysubmatches);
if ($r === null) {
- $this->counter += ($this->mbstring_overload ? mb_strlen($this->value,'latin1'): strlen($this->value));
+ $this->counter += strlen($this->value);
$this->line += substr_count($this->value, "\n");
// accept this token
return true;
// process this token in the new state
return $this->yylex();
} elseif ($r === false) {
- $this->counter += ($this->mbstring_overload ? mb_strlen($this->value,'latin1'): strlen($this->value));
+ $this->counter += strlen($this->value);
$this->line += substr_count($this->value, "\n");
- if ($this->counter >= ($this->mbstring_overload ? mb_strlen($this->data,'latin1'): strlen($this->data))) {
+ if ($this->counter >= strlen($this->data)) {
return false; // end of input
}
// skip this token
continue;
- } } else {
+ }
+ } else {
throw new Exception('Unexpected input at line' . $this->line .
- ': ' . $this->data[$this->counter]);
+ ': ' . $this->data[$this->counter]);
}
break;
} while (true);
-
} // end function
-
const DOUBLEQUOTEDSTRING = 4;
+
function yy_r4_1($yy_subpatterns)
{
- if ($this->smarty->auto_literal) {
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
- } else {
- $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
- $this->yypushstate(self::SMARTY);
- $this->taglineno = $this->line;
- }
+ if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ } else {
+ $this->token = Smarty_Internal_Templateparser::TP_LDELIF;
+ $this->yypushstate(self::SMARTY);
+ $this->taglineno = $this->line;
+ }
}
- function yy_r4_2($yy_subpatterns)
+
+ function yy_r4_3($yy_subpatterns)
{
- if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
- } else {
- $this->token = Smarty_Internal_Templateparser::TP_LDELIF;
- $this->yypushstate(self::SMARTY);
- $this->taglineno = $this->line;
- }
+ if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ } else {
+ $this->token = Smarty_Internal_Templateparser::TP_LDELFOR;
+ $this->yypushstate(self::SMARTY);
+ $this->taglineno = $this->line;
+ }
}
+
function yy_r4_4($yy_subpatterns)
{
- if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
- } else {
- $this->token = Smarty_Internal_Templateparser::TP_LDELFOR;
- $this->yypushstate(self::SMARTY);
- $this->taglineno = $this->line;
- }
+ if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ } else {
+ $this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH;
+ $this->yypushstate(self::SMARTY);
+ $this->taglineno = $this->line;
+ }
}
+
function yy_r4_5($yy_subpatterns)
{
- if ($this->smarty->auto_literal && trim(substr($this->value,$this->ldel_length,1)) == '') {
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
- } else {
- $this->token = Smarty_Internal_Templateparser::TP_LDELFOREACH;
- $this->yypushstate(self::SMARTY);
- $this->taglineno = $this->line;
- }
+ if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ } else {
+ $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
+ $this->yypushstate(self::SMARTY);
+ $this->taglineno = $this->line;
+ }
}
+
function yy_r4_6($yy_subpatterns)
{
- if ($this->smarty->auto_literal) {
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
- } else {
- $this->token = Smarty_Internal_Templateparser::TP_LDEL;
- $this->yypushstate(self::SMARTY);
- $this->taglineno = $this->line;
- }
+ if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ } else {
+ $this->token = Smarty_Internal_Templateparser::TP_LDEL;
+ $this->yypushstate(self::SMARTY);
+ $this->taglineno = $this->line;
+ }
}
+
function yy_r4_7($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_LDELSLASH;
- $this->yypushstate(self::SMARTY);
- $this->taglineno = $this->line;
+ $this->token = Smarty_Internal_Templateparser::TP_QUOTE;
+ $this->yypopstate();
}
+
function yy_r4_8($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_LDEL;
- $this->yypushstate(self::SMARTY);
- $this->taglineno = $this->line;
+ $this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
+ $this->value = substr($this->value, 0, - 1);
+ $this->yypushstate(self::SMARTY);
+ $this->taglineno = $this->line;
}
+
function yy_r4_9($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_QUOTE;
- $this->yypopstate();
+ $this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
}
+
function yy_r4_10($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_BACKTICK;
- $this->value = substr($this->value,0,-1);
- $this->yypushstate(self::SMARTY);
- $this->taglineno = $this->line;
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
}
+
function yy_r4_11($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_DOLLARID;
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
}
- function yy_r4_12($yy_subpatterns)
+
+ function yy_r4_15($yy_subpatterns)
+ {
+
+ $to = strlen($this->data);
+ $this->value = substr($this->data, $this->counter, $to - $this->counter);
+ $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ }
+
+ public function yylex5()
+ {
+ $tokenMap = array(
+ 1 => 0,
+ 2 => 0,
+ 3 => 0,
+ 4 => 0,
+ );
+ if ($this->counter >= strlen($this->data)) {
+ return false; // end of input
+ }
+ $yy_global_pattern = "/\G(" . $this->ldel . "\\s*strip\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*\/strip\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*block)|\G([\S\s])/iS";
+
+ do {
+ if (preg_match($yy_global_pattern, $this->data, $yymatches, null, $this->counter)) {
+ $yysubmatches = $yymatches;
+ $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
+ if (!count($yymatches)) {
+ throw new Exception('Error: lexing failed because a rule matched' .
+ ' an empty string. Input "' . substr($this->data,
+ $this->counter, 5) . '... state CHILDBODY');
+ }
+ next($yymatches); // skip global match
+ $this->token = key($yymatches); // token number
+ if ($tokenMap[$this->token]) {
+ // extract sub-patterns for passing to lex function
+ $yysubmatches = array_slice($yysubmatches, $this->token + 1,
+ $tokenMap[$this->token]);
+ } else {
+ $yysubmatches = array();
+ }
+ $this->value = current($yymatches); // token value
+ $r = $this->{'yy_r5_' . $this->token}($yysubmatches);
+ if ($r === null) {
+ $this->counter += strlen($this->value);
+ $this->line += substr_count($this->value, "\n");
+ // accept this token
+ return true;
+ } elseif ($r === true) {
+ // we have changed state
+ // process this token in the new state
+ return $this->yylex();
+ } elseif ($r === false) {
+ $this->counter += strlen($this->value);
+ $this->line += substr_count($this->value, "\n");
+ if ($this->counter >= strlen($this->data)) {
+ return false; // end of input
+ }
+ // skip this token
+ continue;
+ }
+ } else {
+ throw new Exception('Unexpected input at line' . $this->line .
+ ': ' . $this->data[$this->counter]);
+ }
+ break;
+ } while (true);
+ } // end function
+
+ const CHILDBODY = 5;
+
+ function yy_r5_1($yy_subpatterns)
+ {
+
+ if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
+ return false;
+ } else {
+ $this->token = Smarty_Internal_Templateparser::TP_STRIPON;
+ }
+ }
+
+ function yy_r5_2($yy_subpatterns)
+ {
+
+ if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
+ return false;
+ } else {
+ $this->token = Smarty_Internal_Templateparser::TP_STRIPOFF;
+ }
+ }
+
+ function yy_r5_3($yy_subpatterns)
+ {
+
+ if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
+ return false;
+ } else {
+ $this->yypopstate();
+ return true;
+ }
+ }
+
+ function yy_r5_4($yy_subpatterns)
+ {
+
+ $to = strlen($this->data);
+ preg_match("/" . $this->ldel . "\s*((\/)?strip\s*" . $this->rdel . "|block\s+)/", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
+ if (isset($match[0][1])) {
+ $to = $match[0][1];
+ }
+ $this->value = substr($this->data, $this->counter, $to - $this->counter);
+ return false;
+ }
+
+ public function yylex6()
+ {
+ $tokenMap = array(
+ 1 => 0,
+ 2 => 0,
+ 3 => 0,
+ 4 => 1,
+ 6 => 0,
+ );
+ if ($this->counter >= strlen($this->data)) {
+ return false; // end of input
+ }
+ $yy_global_pattern = "/\G(" . $this->ldel . "\\s*literal\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*block)|\G(" . $this->ldel . "\\s*\/block)|\G(" . $this->ldel . "\\s*[$]smarty\\.block\\.(child|parent))|\G([\S\s])/iS";
+
+ do {
+ if (preg_match($yy_global_pattern, $this->data, $yymatches, null, $this->counter)) {
+ $yysubmatches = $yymatches;
+ $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
+ if (!count($yymatches)) {
+ throw new Exception('Error: lexing failed because a rule matched' .
+ ' an empty string. Input "' . substr($this->data,
+ $this->counter, 5) . '... state CHILDBLOCK');
+ }
+ next($yymatches); // skip global match
+ $this->token = key($yymatches); // token number
+ if ($tokenMap[$this->token]) {
+ // extract sub-patterns for passing to lex function
+ $yysubmatches = array_slice($yysubmatches, $this->token + 1,
+ $tokenMap[$this->token]);
+ } else {
+ $yysubmatches = array();
+ }
+ $this->value = current($yymatches); // token value
+ $r = $this->{'yy_r6_' . $this->token}($yysubmatches);
+ if ($r === null) {
+ $this->counter += strlen($this->value);
+ $this->line += substr_count($this->value, "\n");
+ // accept this token
+ return true;
+ } elseif ($r === true) {
+ // we have changed state
+ // process this token in the new state
+ return $this->yylex();
+ } elseif ($r === false) {
+ $this->counter += strlen($this->value);
+ $this->line += substr_count($this->value, "\n");
+ if ($this->counter >= strlen($this->data)) {
+ return false; // end of input
+ }
+ // skip this token
+ continue;
+ }
+ } else {
+ throw new Exception('Unexpected input at line' . $this->line .
+ ': ' . $this->data[$this->counter]);
+ }
+ break;
+ } while (true);
+ } // end function
+
+ const CHILDBLOCK = 6;
+
+ function yy_r6_1($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
+ $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
+ } else {
+ $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
+ $this->yypushstate(self::CHILDLITERAL);
+ }
}
- function yy_r4_13($yy_subpatterns)
+
+ function yy_r6_2($yy_subpatterns)
{
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
+ $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
+ } else {
+ $this->yypopstate();
+ return true;
+ }
}
- function yy_r4_17($yy_subpatterns)
+
+ function yy_r6_3($yy_subpatterns)
{
- if ($this->mbstring_overload) {
- $to = mb_strlen($this->data,'latin1');
- } else {
- $to = strlen($this->data);
- }
- if ($this->mbstring_overload) {
- $this->value = mb_substr($this->data,$this->counter,$to-$this->counter,'latin1');
- } else {
- $this->value = substr($this->data,$this->counter,$to-$this->counter);
- }
- $this->token = Smarty_Internal_Templateparser::TP_TEXT;
+ if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
+ $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
+ } else {
+ $this->yypopstate();
+ return true;
+ }
}
+ function yy_r6_4($yy_subpatterns)
+ {
+
+ if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
+ $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
+ } else {
+ $this->yypopstate();
+ return true;
+ }
+ }
+
+ function yy_r6_6($yy_subpatterns)
+ {
+
+ $to = strlen($this->data);
+ preg_match("/" . $this->ldel . "\s*(literal\s*" . $this->rdel . "|(\/)?block(\s|" . $this->rdel . ")|[\$]smarty\.block\.(child|parent))/", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
+ if (isset($match[0][1])) {
+ $to = $match[0][1];
+ }
+ $this->value = substr($this->data, $this->counter, $to - $this->counter);
+ $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
+ }
+
+ public function yylex7()
+ {
+ $tokenMap = array(
+ 1 => 0,
+ 2 => 0,
+ 3 => 0,
+ );
+ if ($this->counter >= strlen($this->data)) {
+ return false; // end of input
+ }
+ $yy_global_pattern = "/\G(" . $this->ldel . "\\s*literal\\s*" . $this->rdel . ")|\G(" . $this->ldel . "\\s*\/literal\\s*" . $this->rdel . ")|\G([\S\s])/iS";
+
+ do {
+ if (preg_match($yy_global_pattern, $this->data, $yymatches, null, $this->counter)) {
+ $yysubmatches = $yymatches;
+ $yymatches = array_filter($yymatches, 'strlen'); // remove empty sub-patterns
+ if (!count($yymatches)) {
+ throw new Exception('Error: lexing failed because a rule matched' .
+ ' an empty string. Input "' . substr($this->data,
+ $this->counter, 5) . '... state CHILDLITERAL');
+ }
+ next($yymatches); // skip global match
+ $this->token = key($yymatches); // token number
+ if ($tokenMap[$this->token]) {
+ // extract sub-patterns for passing to lex function
+ $yysubmatches = array_slice($yysubmatches, $this->token + 1,
+ $tokenMap[$this->token]);
+ } else {
+ $yysubmatches = array();
+ }
+ $this->value = current($yymatches); // token value
+ $r = $this->{'yy_r7_' . $this->token}($yysubmatches);
+ if ($r === null) {
+ $this->counter += strlen($this->value);
+ $this->line += substr_count($this->value, "\n");
+ // accept this token
+ return true;
+ } elseif ($r === true) {
+ // we have changed state
+ // process this token in the new state
+ return $this->yylex();
+ } elseif ($r === false) {
+ $this->counter += strlen($this->value);
+ $this->line += substr_count($this->value, "\n");
+ if ($this->counter >= strlen($this->data)) {
+ return false; // end of input
+ }
+ // skip this token
+ continue;
+ }
+ } else {
+ throw new Exception('Unexpected input at line' . $this->line .
+ ': ' . $this->data[$this->counter]);
+ }
+ break;
+ } while (true);
+ } // end function
+
+ const CHILDLITERAL = 7;
+
+ function yy_r7_1($yy_subpatterns)
+ {
+
+ if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
+ $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
+ } else {
+ $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
+ $this->yypushstate(self::CHILDLITERAL);
+ }
+ }
+
+ function yy_r7_2($yy_subpatterns)
+ {
+
+ if ($this->smarty->auto_literal && isset($this->value[$this->ldel_length]) ? strpos(" \n\t\r", $this->value[$this->ldel_length]) !== false : false) {
+ $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
+ } else {
+ $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
+ $this->yypopstate();
+ }
+ }
+
+ function yy_r7_3($yy_subpatterns)
+ {
+
+ $to = strlen($this->data);
+ preg_match("/{$this->ldel}\/?literal\s*{$this->rdel}/", $this->data, $match, PREG_OFFSET_CAPTURE, $this->counter);
+ if (isset($match[0][1])) {
+ $to = $match[0][1];
+ } else {
+ $this->compiler->trigger_template_error("missing or misspelled literal closing tag");
+ }
+ $this->value = substr($this->data, $this->counter, $to - $this->counter);
+ $this->token = Smarty_Internal_Templateparser::TP_BLOCKSOURCE;
+ }
}
-?>
\ No newline at end of file
+
+
\ No newline at end of file
<?php
-/**
-* Smarty Internal Plugin Templateparser
-*
-* This is the template parser.
-* It is generated from the internal.templateparser.y file
-* @package Smarty
-* @subpackage Compiler
-* @author Uwe Tews
-*/
+/**
+ * Smarty Internal Plugin Templateparser
+ * This is the template parser.
+ * It is generated from the internal.templateparser.y file
+ *
+ * @package Smarty
+ * @subpackage Compiler
+ * @author Uwe Tews
+ */
class TP_yyToken implements ArrayAccess
{
public $string = '';
public $metadata = array();
- function __construct($s, $m = array())
+ public function __construct($s, $m = array())
{
if ($s instanceof TP_yyToken) {
$this->string = $s->string;
}
}
- function __toString()
+ public function __toString()
{
return $this->_string;
}
- function offsetExists($offset)
+ public function offsetExists($offset)
{
return isset($this->metadata[$offset]);
}
- function offsetGet($offset)
+ public function offsetGet($offset)
{
return $this->metadata[$offset];
}
- function offsetSet($offset, $value)
+ public function offsetSet($offset, $value)
{
if ($offset === null) {
if (isset($value[0])) {
$x = ($value instanceof TP_yyToken) ?
$value->metadata : $value;
$this->metadata = array_merge($this->metadata, $x);
+
return;
}
$offset = count($this->metadata);
}
}
- function offsetUnset($offset)
+ public function offsetUnset($offset)
{
unset($this->metadata[$offset]);
}
class TP_yyStackEntry
{
- public $stateno; /* The state-number */
- public $major; /* The major token value. This is the code
+ public $stateno; /* The state-number */
+ public $major; /* The major token value. This is the code
** number for the token at this stack level */
public $minor; /* The user-supplied minor token value. This
** is the value of the token */
-};
+}
+;
-#line 12 "smarty_internal_templateparser.y"
-class Smarty_Internal_Templateparser#line 79 "smarty_internal_templateparser.php"
+#line 13 "smarty_internal_templateparser.y"
+class Smarty_Internal_Templateparser #line 80 "smarty_internal_templateparser.php"
{
-#line 14 "smarty_internal_templateparser.y"
+ #line 15 "smarty_internal_templateparser.y"
const Err1 = "Security error: Call to private object member not allowed";
const Err2 = "Security error: Call to dynamic object member not allowed";
// states whether the parse was successful or not
public $successful = true;
public $retvalue = 0;
+ public static $prefix_number = 0;
private $lex;
private $internalError = false;
private $strip = false;
- function __construct($lex, $compiler) {
+ function __construct($lex, $compiler)
+ {
$this->lex = $lex;
$this->compiler = $compiler;
$this->smarty = $this->compiler->smarty;
$this->template = $this->compiler->template;
$this->compiler->has_variable_string = false;
$this->compiler->prefix_code = array();
- $this->prefix_number = 0;
$this->block_nesting_level = 0;
if ($this->security = isset($this->smarty->security_policy)) {
$this->php_handling = $this->smarty->security_policy->php_handling;
$this->current_buffer = $this->root_buffer = new _smarty_template_buffer($this);
}
- public static function escape_start_tag($tag_text) {
- $tag = preg_replace('/\A<\?(.*)\z/', '<<?php ?>?\1', $tag_text, -1 , $count); //Escape tag
+ public static function escape_start_tag($tag_text)
+ {
+ $tag = preg_replace('/\A<\?(.*)\z/', '<<?php ?>?\1', $tag_text, - 1, $count); //Escape tag
return $tag;
}
- public static function escape_end_tag($tag_text) {
+ public static function escape_end_tag($tag_text)
+ {
return '?<?php ?>>';
}
- public function compileVariable($variable) {
- if (strpos($variable,'(') == 0) {
+ public function compileVariable($variable)
+ {
+ if (strpos($variable, '(') == 0) {
// not a variable variable
- $var = trim($variable,'\'');
- $this->compiler->tag_nocache=$this->compiler->tag_nocache|$this->template->getVariable($var, null, true, false)->nocache;
- $this->template->properties['variables'][$var] = $this->compiler->tag_nocache|$this->compiler->nocache;
+ $var = trim($variable, '\'');
+ $this->compiler->tag_nocache = $this->compiler->tag_nocache | $this->template->getVariable($var, null, true, false)->nocache;
+ $this->template->properties['variables'][$var] = $this->compiler->tag_nocache | $this->compiler->nocache;
}
-// return '(isset($_smarty_tpl->tpl_vars['. $variable .'])?$_smarty_tpl->tpl_vars['. $variable .']->value:$_smarty_tpl->getVariable('. $variable .')->value)';
- return '$_smarty_tpl->tpl_vars['. $variable .']->value';
+ // return '(isset($_smarty_tpl->tpl_vars['. $variable .'])?$_smarty_tpl->tpl_vars['. $variable .']->value:$_smarty_tpl->getVariable('. $variable .')->value)';
+ return '$_smarty_tpl->tpl_vars[' . $variable . ']->value';
}
-#line 132 "smarty_internal_templateparser.php"
- const TP_VERT = 1;
- const TP_COLON = 2;
- const TP_COMMENT = 3;
- const TP_PHPSTARTTAG = 4;
- const TP_PHPENDTAG = 5;
- const TP_ASPSTARTTAG = 6;
- const TP_ASPENDTAG = 7;
- const TP_FAKEPHPSTARTTAG = 8;
- const TP_XMLTAG = 9;
- const TP_TEXT = 10;
- const TP_STRIPON = 11;
- const TP_STRIPOFF = 12;
- const TP_LITERALSTART = 13;
- const TP_LITERALEND = 14;
- const TP_LITERAL = 15;
- const TP_LDEL = 16;
- const TP_RDEL = 17;
- const TP_DOLLAR = 18;
- const TP_ID = 19;
- const TP_EQUAL = 20;
- const TP_PTR = 21;
- const TP_LDELIF = 22;
- const TP_LDELFOR = 23;
- const TP_SEMICOLON = 24;
- const TP_INCDEC = 25;
- const TP_TO = 26;
- const TP_STEP = 27;
- const TP_LDELFOREACH = 28;
- const TP_SPACE = 29;
- const TP_AS = 30;
- const TP_APTR = 31;
- const TP_LDELSETFILTER = 32;
- const TP_SMARTYBLOCKCHILD = 33;
- const TP_LDELSLASH = 34;
- const TP_ATTR = 35;
- const TP_INTEGER = 36;
- const TP_COMMA = 37;
- const TP_OPENP = 38;
- const TP_CLOSEP = 39;
- const TP_MATH = 40;
- const TP_UNIMATH = 41;
- const TP_ANDSYM = 42;
- const TP_ISIN = 43;
- const TP_ISDIVBY = 44;
- const TP_ISNOTDIVBY = 45;
- const TP_ISEVEN = 46;
- const TP_ISNOTEVEN = 47;
- const TP_ISEVENBY = 48;
- const TP_ISNOTEVENBY = 49;
- const TP_ISODD = 50;
- const TP_ISNOTODD = 51;
- const TP_ISODDBY = 52;
- const TP_ISNOTODDBY = 53;
- const TP_INSTANCEOF = 54;
- const TP_QMARK = 55;
- const TP_NOT = 56;
- const TP_TYPECAST = 57;
- const TP_HEX = 58;
- const TP_DOT = 59;
- const TP_SINGLEQUOTESTRING = 60;
- const TP_DOUBLECOLON = 61;
- const TP_AT = 62;
- const TP_HATCH = 63;
- const TP_OPENB = 64;
- const TP_CLOSEB = 65;
- const TP_EQUALS = 66;
- const TP_NOTEQUALS = 67;
- const TP_GREATERTHAN = 68;
- const TP_LESSTHAN = 69;
- const TP_GREATEREQUAL = 70;
- const TP_LESSEQUAL = 71;
- const TP_IDENTITY = 72;
- const TP_NONEIDENTITY = 73;
- const TP_MOD = 74;
- const TP_LAND = 75;
- const TP_LOR = 76;
- const TP_LXOR = 77;
- const TP_QUOTE = 78;
- const TP_BACKTICK = 79;
- const TP_DOLLARID = 80;
- const YY_NO_ACTION = 593;
- const YY_ACCEPT_ACTION = 592;
- const YY_ERROR_ACTION = 591;
+ #line 133 "smarty_internal_templateparser.php"
+
+ const TP_VERT = 1;
+ const TP_COLON = 2;
+ const TP_RDEL = 3;
+ const TP_COMMENT = 4;
+ const TP_PHPSTARTTAG = 5;
+ const TP_PHPENDTAG = 6;
+ const TP_ASPSTARTTAG = 7;
+ const TP_ASPENDTAG = 8;
+ const TP_FAKEPHPSTARTTAG = 9;
+ const TP_XMLTAG = 10;
+ const TP_TEXT = 11;
+ const TP_STRIPON = 12;
+ const TP_STRIPOFF = 13;
+ const TP_BLOCKSOURCE = 14;
+ const TP_LITERALSTART = 15;
+ const TP_LITERALEND = 16;
+ const TP_LITERAL = 17;
+ const TP_LDEL = 18;
+ const TP_DOLLAR = 19;
+ const TP_ID = 20;
+ const TP_EQUAL = 21;
+ const TP_PTR = 22;
+ const TP_LDELIF = 23;
+ const TP_LDELFOR = 24;
+ const TP_SEMICOLON = 25;
+ const TP_INCDEC = 26;
+ const TP_TO = 27;
+ const TP_STEP = 28;
+ const TP_LDELFOREACH = 29;
+ const TP_SPACE = 30;
+ const TP_AS = 31;
+ const TP_APTR = 32;
+ const TP_LDELSETFILTER = 33;
+ const TP_SMARTYBLOCKCHILDPARENT = 34;
+ const TP_LDELSLASH = 35;
+ const TP_ATTR = 36;
+ const TP_INTEGER = 37;
+ const TP_COMMA = 38;
+ const TP_OPENP = 39;
+ const TP_CLOSEP = 40;
+ const TP_MATH = 41;
+ const TP_UNIMATH = 42;
+ const TP_ANDSYM = 43;
+ const TP_ISIN = 44;
+ const TP_ISDIVBY = 45;
+ const TP_ISNOTDIVBY = 46;
+ const TP_ISEVEN = 47;
+ const TP_ISNOTEVEN = 48;
+ const TP_ISEVENBY = 49;
+ const TP_ISNOTEVENBY = 50;
+ const TP_ISODD = 51;
+ const TP_ISNOTODD = 52;
+ const TP_ISODDBY = 53;
+ const TP_ISNOTODDBY = 54;
+ const TP_INSTANCEOF = 55;
+ const TP_QMARK = 56;
+ const TP_NOT = 57;
+ const TP_TYPECAST = 58;
+ const TP_HEX = 59;
+ const TP_DOT = 60;
+ const TP_SINGLEQUOTESTRING = 61;
+ const TP_DOUBLECOLON = 62;
+ const TP_AT = 63;
+ const TP_HATCH = 64;
+ const TP_OPENB = 65;
+ const TP_CLOSEB = 66;
+ const TP_EQUALS = 67;
+ const TP_NOTEQUALS = 68;
+ const TP_GREATERTHAN = 69;
+ const TP_LESSTHAN = 70;
+ const TP_GREATEREQUAL = 71;
+ const TP_LESSEQUAL = 72;
+ const TP_IDENTITY = 73;
+ const TP_NONEIDENTITY = 74;
+ const TP_MOD = 75;
+ const TP_LAND = 76;
+ const TP_LOR = 77;
+ const TP_LXOR = 78;
+ const TP_QUOTE = 79;
+ const TP_BACKTICK = 80;
+ const TP_DOLLARID = 81;
+ const YY_NO_ACTION = 570;
+ const YY_ACCEPT_ACTION = 569;
+ const YY_ERROR_ACTION = 568;
- const YY_SZ_ACTTAB = 2453;
-static public $yy_action = array(
- /* 0 */ 210, 320, 317, 316, 312, 311, 313, 314, 315, 322,
- /* 10 */ 323, 189, 191, 340, 43, 168, 292, 290, 161, 25,
- /* 20 */ 3, 108, 284, 29, 294, 199, 146, 294, 15, 15,
- /* 30 */ 244, 296, 243, 277, 18, 18, 285, 12, 127, 48,
- /* 40 */ 52, 50, 44, 9, 14, 384, 385, 17, 16, 386,
- /* 50 */ 283, 41, 39, 210, 592, 95, 260, 319, 321, 6,
- /* 60 */ 21, 194, 135, 374, 193, 387, 383, 382, 378, 377,
- /* 70 */ 379, 380, 381, 363, 362, 345, 344, 28, 31, 34,
- /* 80 */ 370, 15, 19, 237, 137, 187, 25, 18, 203, 284,
- /* 90 */ 29, 203, 48, 52, 50, 44, 9, 14, 384, 385,
- /* 100 */ 17, 16, 386, 283, 41, 39, 329, 324, 326, 327,
- /* 110 */ 325, 24, 288, 4, 4, 189, 332, 330, 387, 383,
- /* 120 */ 382, 378, 377, 379, 380, 381, 363, 362, 345, 344,
- /* 130 */ 210, 368, 231, 210, 251, 117, 139, 139, 84, 132,
- /* 140 */ 278, 25, 10, 162, 284, 359, 338, 302, 346, 459,
- /* 150 */ 226, 228, 369, 364, 15, 375, 230, 15, 15, 177,
- /* 160 */ 18, 459, 240, 18, 18, 212, 257, 459, 294, 48,
- /* 170 */ 52, 50, 44, 9, 14, 384, 385, 17, 16, 386,
- /* 180 */ 283, 41, 39, 131, 101, 159, 47, 196, 340, 371,
- /* 190 */ 25, 190, 340, 284, 294, 387, 383, 382, 378, 377,
- /* 200 */ 379, 380, 381, 363, 362, 345, 344, 210, 368, 208,
- /* 210 */ 210, 203, 140, 210, 8, 56, 123, 118, 210, 457,
- /* 220 */ 366, 261, 234, 343, 302, 346, 453, 147, 228, 369,
- /* 230 */ 364, 457, 375, 15, 342, 15, 231, 457, 15, 18,
- /* 240 */ 4, 18, 307, 37, 18, 195, 48, 52, 50, 44,
- /* 250 */ 9, 14, 384, 385, 17, 16, 386, 283, 41, 39,
- /* 260 */ 210, 25, 2, 139, 284, 11, 47, 185, 210, 45,
- /* 270 */ 266, 47, 387, 383, 382, 378, 377, 379, 380, 381,
- /* 280 */ 363, 362, 345, 344, 286, 242, 104, 166, 15, 210,
- /* 290 */ 276, 184, 188, 23, 18, 272, 294, 22, 162, 48,
- /* 300 */ 52, 50, 44, 9, 14, 384, 385, 17, 16, 386,
- /* 310 */ 283, 41, 39, 203, 106, 170, 13, 15, 203, 288,
- /* 320 */ 318, 319, 321, 18, 294, 387, 383, 382, 378, 377,
- /* 330 */ 379, 380, 381, 363, 362, 345, 344, 210, 131, 105,
- /* 340 */ 210, 203, 23, 368, 268, 130, 249, 152, 355, 25,
- /* 350 */ 197, 132, 284, 271, 32, 162, 287, 155, 354, 210,
- /* 360 */ 3, 108, 15, 228, 369, 364, 146, 375, 18, 252,
- /* 370 */ 244, 296, 243, 375, 303, 305, 48, 52, 50, 44,
- /* 380 */ 9, 14, 384, 385, 17, 16, 386, 283, 41, 39,
- /* 390 */ 103, 210, 36, 208, 109, 388, 303, 232, 8, 4,
- /* 400 */ 248, 246, 387, 383, 382, 378, 377, 379, 380, 381,
- /* 410 */ 363, 362, 345, 344, 198, 40, 361, 27, 353, 179,
- /* 420 */ 175, 20, 139, 236, 239, 211, 116, 18, 294, 294,
- /* 430 */ 48, 52, 50, 44, 9, 14, 384, 385, 17, 16,
- /* 440 */ 386, 283, 41, 39, 178, 200, 200, 23, 25, 267,
- /* 450 */ 351, 284, 186, 294, 285, 201, 387, 383, 382, 378,
- /* 460 */ 377, 379, 380, 381, 363, 362, 345, 344, 210, 368,
- /* 470 */ 200, 210, 210, 140, 301, 181, 69, 123, 238, 25,
- /* 480 */ 210, 147, 284, 347, 202, 302, 346, 459, 304, 228,
- /* 490 */ 369, 364, 15, 375, 241, 15, 297, 172, 18, 459,
- /* 500 */ 235, 18, 203, 306, 129, 459, 294, 48, 52, 50,
- /* 510 */ 44, 9, 14, 384, 385, 17, 16, 386, 283, 41,
- /* 520 */ 39, 210, 25, 200, 47, 229, 25, 134, 210, 233,
- /* 530 */ 120, 119, 210, 387, 383, 382, 378, 377, 379, 380,
- /* 540 */ 381, 363, 362, 345, 344, 373, 373, 143, 308, 180,
- /* 550 */ 236, 282, 25, 25, 42, 284, 216, 236, 238, 250,
- /* 560 */ 48, 52, 50, 44, 9, 14, 384, 385, 17, 16,
- /* 570 */ 386, 283, 41, 39, 210, 30, 203, 360, 182, 25,
- /* 580 */ 285, 47, 222, 126, 167, 303, 387, 383, 382, 378,
- /* 590 */ 377, 379, 380, 381, 363, 362, 345, 344, 245, 373,
- /* 600 */ 15, 372, 160, 334, 6, 333, 18, 247, 254, 35,
- /* 610 */ 255, 294, 114, 48, 52, 50, 44, 9, 14, 384,
- /* 620 */ 385, 17, 16, 386, 283, 41, 39, 373, 192, 281,
- /* 630 */ 253, 145, 38, 298, 300, 226, 94, 124, 102, 387,
- /* 640 */ 383, 382, 378, 377, 379, 380, 381, 363, 362, 345,
- /* 650 */ 344, 210, 368, 373, 210, 141, 140, 368, 336, 71,
- /* 660 */ 132, 149, 136, 7, 10, 132, 165, 204, 302, 346,
- /* 670 */ 456, 98, 228, 369, 364, 294, 375, 228, 369, 364,
- /* 680 */ 279, 375, 456, 220, 232, 335, 373, 285, 456, 162,
- /* 690 */ 48, 52, 50, 44, 9, 14, 384, 385, 17, 16,
- /* 700 */ 386, 283, 41, 39, 210, 210, 309, 47, 285, 200,
- /* 710 */ 371, 45, 162, 183, 144, 97, 387, 383, 382, 378,
- /* 720 */ 377, 379, 380, 381, 363, 362, 345, 344, 285, 131,
- /* 730 */ 373, 354, 331, 107, 110, 256, 376, 327, 327, 327,
- /* 740 */ 327, 327, 115, 48, 52, 50, 44, 9, 14, 384,
- /* 750 */ 385, 17, 16, 386, 283, 41, 39, 373, 327, 327,
- /* 760 */ 327, 327, 327, 327, 327, 327, 327, 327, 356, 387,
- /* 770 */ 383, 382, 378, 377, 379, 380, 381, 363, 362, 345,
- /* 780 */ 344, 210, 352, 368, 327, 210, 327, 140, 327, 327,
- /* 790 */ 71, 132, 327, 100, 339, 327, 138, 269, 337, 302,
- /* 800 */ 346, 328, 327, 228, 369, 364, 15, 375, 373, 327,
- /* 810 */ 15, 373, 18, 15, 219, 327, 18, 327, 327, 18,
- /* 820 */ 48, 52, 50, 44, 9, 14, 384, 385, 17, 16,
- /* 830 */ 386, 283, 41, 39, 210, 327, 327, 327, 47, 327,
- /* 840 */ 327, 327, 327, 327, 327, 327, 387, 383, 382, 378,
- /* 850 */ 377, 379, 380, 381, 363, 362, 345, 344, 327, 327,
- /* 860 */ 327, 327, 327, 327, 327, 327, 327, 327, 327, 327,
- /* 870 */ 327, 327, 274, 48, 52, 50, 44, 9, 14, 384,
- /* 880 */ 385, 17, 16, 386, 283, 41, 39, 210, 327, 327,
- /* 890 */ 327, 327, 327, 327, 327, 327, 327, 327, 327, 387,
- /* 900 */ 383, 382, 378, 377, 379, 380, 381, 363, 362, 345,
- /* 910 */ 344, 327, 327, 327, 327, 327, 327, 327, 327, 327,
- /* 920 */ 327, 327, 327, 327, 327, 327, 48, 52, 50, 44,
- /* 930 */ 9, 14, 384, 385, 17, 16, 386, 283, 41, 39,
- /* 940 */ 210, 327, 327, 327, 327, 327, 327, 327, 327, 327,
- /* 950 */ 327, 265, 387, 383, 382, 378, 377, 379, 380, 381,
- /* 960 */ 363, 362, 345, 344, 327, 327, 327, 327, 327, 224,
- /* 970 */ 327, 327, 327, 327, 327, 327, 327, 327, 327, 48,
- /* 980 */ 52, 50, 44, 9, 14, 384, 385, 17, 16, 386,
- /* 990 */ 283, 41, 39, 210, 327, 327, 327, 327, 327, 327,
- /* 1000 */ 327, 327, 327, 327, 327, 387, 383, 382, 378, 377,
- /* 1010 */ 379, 380, 381, 363, 362, 345, 344, 327, 327, 327,
- /* 1020 */ 327, 327, 327, 327, 327, 327, 327, 327, 327, 327,
- /* 1030 */ 327, 327, 48, 52, 50, 44, 9, 14, 384, 385,
- /* 1040 */ 17, 16, 386, 283, 41, 39, 327, 327, 327, 327,
- /* 1050 */ 327, 327, 327, 327, 327, 327, 327, 327, 387, 383,
- /* 1060 */ 382, 378, 377, 379, 380, 381, 363, 362, 345, 344,
- /* 1070 */ 327, 327, 327, 48, 52, 50, 44, 9, 14, 384,
- /* 1080 */ 385, 17, 16, 386, 283, 41, 39, 327, 327, 327,
- /* 1090 */ 327, 327, 327, 327, 327, 327, 327, 327, 327, 387,
- /* 1100 */ 383, 382, 378, 377, 379, 380, 381, 363, 362, 345,
- /* 1110 */ 344, 327, 327, 327, 327, 327, 43, 327, 142, 207,
- /* 1120 */ 327, 327, 3, 108, 327, 264, 327, 368, 146, 327,
- /* 1130 */ 327, 151, 244, 296, 243, 132, 227, 15, 33, 327,
- /* 1140 */ 327, 51, 327, 18, 367, 327, 368, 228, 369, 364,
- /* 1150 */ 150, 375, 327, 174, 132, 327, 49, 46, 299, 225,
- /* 1160 */ 365, 327, 294, 103, 1, 280, 228, 369, 364, 262,
- /* 1170 */ 375, 327, 327, 43, 285, 142, 218, 327, 96, 3,
- /* 1180 */ 108, 15, 289, 327, 327, 146, 327, 18, 327, 244,
- /* 1190 */ 296, 243, 327, 227, 15, 33, 327, 327, 51, 327,
- /* 1200 */ 18, 327, 368, 327, 327, 327, 121, 327, 327, 54,
- /* 1210 */ 132, 327, 327, 49, 46, 299, 225, 365, 302, 346,
- /* 1220 */ 103, 1, 228, 369, 364, 327, 375, 350, 327, 327,
- /* 1230 */ 43, 327, 142, 205, 327, 96, 3, 108, 327, 15,
- /* 1240 */ 169, 327, 146, 327, 358, 18, 244, 296, 243, 294,
- /* 1250 */ 227, 327, 33, 327, 327, 51, 15, 327, 327, 368,
- /* 1260 */ 327, 285, 18, 140, 327, 327, 66, 132, 327, 327,
- /* 1270 */ 49, 46, 299, 225, 365, 302, 346, 103, 1, 228,
- /* 1280 */ 369, 364, 327, 375, 295, 327, 327, 43, 327, 130,
- /* 1290 */ 218, 327, 96, 3, 108, 327, 15, 327, 327, 146,
- /* 1300 */ 327, 293, 18, 244, 296, 243, 327, 227, 327, 26,
- /* 1310 */ 327, 327, 51, 15, 327, 327, 368, 327, 327, 18,
- /* 1320 */ 140, 327, 327, 60, 132, 327, 327, 49, 46, 299,
- /* 1330 */ 225, 365, 302, 346, 103, 1, 228, 369, 364, 327,
- /* 1340 */ 375, 258, 327, 327, 43, 327, 128, 218, 327, 96,
- /* 1350 */ 3, 108, 327, 15, 327, 327, 146, 327, 291, 18,
- /* 1360 */ 244, 296, 243, 327, 227, 327, 5, 327, 327, 51,
- /* 1370 */ 15, 327, 327, 368, 327, 327, 18, 140, 327, 327,
- /* 1380 */ 75, 132, 327, 327, 49, 46, 299, 225, 365, 302,
- /* 1390 */ 346, 103, 1, 228, 369, 364, 327, 375, 259, 327,
- /* 1400 */ 327, 43, 327, 142, 209, 327, 96, 3, 108, 327,
- /* 1410 */ 15, 327, 327, 146, 327, 273, 18, 244, 296, 243,
- /* 1420 */ 327, 227, 327, 33, 327, 327, 51, 15, 327, 327,
- /* 1430 */ 368, 327, 327, 18, 140, 327, 327, 87, 132, 327,
- /* 1440 */ 327, 49, 46, 299, 225, 365, 302, 346, 103, 1,
- /* 1450 */ 228, 369, 364, 327, 375, 275, 327, 327, 43, 327,
- /* 1460 */ 125, 92, 327, 96, 3, 108, 327, 15, 327, 327,
- /* 1470 */ 146, 327, 310, 18, 244, 296, 243, 327, 227, 327,
- /* 1480 */ 33, 327, 327, 51, 15, 327, 327, 368, 327, 327,
- /* 1490 */ 18, 140, 327, 327, 58, 132, 327, 327, 49, 46,
- /* 1500 */ 299, 225, 365, 302, 346, 103, 1, 228, 369, 364,
- /* 1510 */ 327, 375, 341, 327, 327, 43, 327, 133, 218, 327,
- /* 1520 */ 96, 3, 108, 327, 15, 327, 327, 146, 327, 348,
- /* 1530 */ 18, 244, 296, 243, 327, 227, 327, 33, 327, 327,
- /* 1540 */ 51, 15, 327, 327, 368, 327, 327, 18, 140, 327,
- /* 1550 */ 327, 68, 132, 327, 327, 49, 46, 299, 225, 365,
- /* 1560 */ 302, 346, 103, 1, 215, 369, 364, 327, 375, 327,
- /* 1570 */ 327, 327, 43, 327, 142, 206, 327, 96, 3, 108,
- /* 1580 */ 327, 327, 327, 327, 146, 327, 327, 327, 244, 296,
- /* 1590 */ 243, 327, 213, 327, 33, 327, 327, 51, 327, 327,
- /* 1600 */ 327, 368, 327, 327, 327, 140, 327, 327, 89, 132,
- /* 1610 */ 327, 327, 49, 46, 299, 225, 365, 302, 346, 103,
- /* 1620 */ 1, 228, 369, 364, 327, 375, 327, 327, 327, 43,
- /* 1630 */ 327, 130, 214, 327, 96, 3, 108, 327, 327, 327,
- /* 1640 */ 327, 146, 327, 327, 327, 244, 296, 243, 327, 227,
- /* 1650 */ 327, 26, 327, 327, 51, 327, 327, 327, 368, 327,
- /* 1660 */ 327, 327, 93, 327, 327, 53, 122, 327, 327, 49,
- /* 1670 */ 46, 299, 225, 365, 302, 346, 103, 327, 221, 369,
- /* 1680 */ 364, 327, 375, 327, 327, 327, 43, 327, 130, 218,
- /* 1690 */ 327, 96, 3, 108, 327, 327, 327, 327, 146, 327,
- /* 1700 */ 327, 327, 244, 296, 243, 327, 227, 327, 26, 327,
- /* 1710 */ 327, 51, 327, 327, 327, 368, 327, 327, 327, 140,
- /* 1720 */ 327, 327, 71, 132, 327, 327, 49, 46, 299, 225,
- /* 1730 */ 365, 302, 346, 103, 327, 228, 369, 364, 327, 375,
- /* 1740 */ 327, 327, 327, 327, 502, 327, 217, 327, 96, 327,
- /* 1750 */ 327, 502, 327, 502, 502, 355, 502, 502, 327, 327,
- /* 1760 */ 327, 32, 502, 327, 502, 4, 502, 3, 108, 327,
- /* 1770 */ 99, 171, 327, 146, 327, 327, 327, 244, 296, 243,
- /* 1780 */ 294, 502, 327, 28, 31, 327, 327, 327, 139, 327,
- /* 1790 */ 327, 327, 502, 327, 368, 193, 163, 203, 117, 327,
- /* 1800 */ 327, 84, 132, 327, 327, 294, 502, 327, 28, 31,
- /* 1810 */ 302, 346, 327, 368, 228, 369, 364, 157, 375, 327,
- /* 1820 */ 327, 132, 203, 357, 27, 353, 327, 327, 327, 263,
- /* 1830 */ 270, 327, 368, 228, 369, 364, 140, 375, 327, 69,
- /* 1840 */ 132, 327, 210, 368, 327, 327, 327, 140, 302, 346,
- /* 1850 */ 79, 132, 228, 369, 364, 327, 375, 327, 349, 302,
- /* 1860 */ 346, 327, 223, 228, 369, 364, 327, 375, 327, 327,
- /* 1870 */ 15, 327, 327, 327, 368, 327, 18, 327, 140, 4,
- /* 1880 */ 327, 91, 132, 327, 327, 327, 327, 327, 327, 327,
- /* 1890 */ 302, 346, 327, 327, 228, 369, 364, 368, 375, 327,
- /* 1900 */ 327, 140, 139, 368, 76, 132, 327, 153, 327, 327,
- /* 1910 */ 327, 132, 327, 302, 346, 327, 327, 228, 369, 364,
- /* 1920 */ 327, 375, 368, 228, 369, 364, 140, 375, 327, 63,
- /* 1930 */ 132, 327, 327, 368, 327, 327, 327, 111, 302, 346,
- /* 1940 */ 62, 132, 228, 369, 364, 327, 375, 327, 327, 302,
- /* 1950 */ 346, 327, 327, 228, 369, 364, 327, 375, 327, 327,
- /* 1960 */ 368, 193, 176, 327, 140, 327, 327, 78, 132, 327,
- /* 1970 */ 327, 294, 327, 327, 28, 31, 302, 346, 327, 327,
- /* 1980 */ 228, 369, 364, 368, 375, 327, 327, 140, 203, 368,
- /* 1990 */ 64, 132, 327, 154, 327, 327, 327, 132, 327, 302,
- /* 2000 */ 346, 327, 327, 228, 369, 364, 327, 375, 368, 228,
- /* 2010 */ 369, 364, 140, 375, 327, 77, 132, 327, 327, 368,
- /* 2020 */ 327, 327, 327, 140, 302, 346, 80, 132, 228, 369,
- /* 2030 */ 364, 327, 375, 327, 327, 302, 346, 327, 327, 228,
- /* 2040 */ 369, 364, 327, 375, 327, 327, 368, 327, 327, 327,
- /* 2050 */ 140, 327, 327, 61, 132, 327, 327, 327, 327, 327,
- /* 2060 */ 327, 327, 302, 346, 327, 327, 228, 369, 364, 368,
- /* 2070 */ 375, 327, 327, 140, 327, 368, 65, 132, 327, 156,
- /* 2080 */ 327, 327, 327, 132, 327, 302, 346, 327, 327, 228,
- /* 2090 */ 369, 364, 327, 375, 368, 228, 369, 364, 140, 375,
- /* 2100 */ 327, 81, 132, 327, 327, 368, 327, 327, 327, 113,
- /* 2110 */ 302, 346, 88, 132, 228, 369, 364, 327, 375, 327,
- /* 2120 */ 327, 302, 346, 327, 327, 228, 369, 364, 327, 375,
- /* 2130 */ 327, 327, 368, 327, 327, 327, 140, 327, 327, 67,
- /* 2140 */ 132, 327, 327, 327, 327, 327, 327, 327, 302, 346,
- /* 2150 */ 327, 327, 228, 369, 364, 368, 375, 327, 327, 140,
- /* 2160 */ 327, 368, 86, 132, 327, 148, 327, 327, 327, 132,
- /* 2170 */ 327, 302, 346, 327, 327, 228, 369, 364, 327, 375,
- /* 2180 */ 368, 228, 369, 364, 140, 375, 327, 85, 132, 327,
- /* 2190 */ 327, 368, 327, 327, 327, 112, 302, 346, 73, 132,
- /* 2200 */ 228, 369, 364, 327, 375, 327, 327, 302, 346, 327,
- /* 2210 */ 327, 228, 369, 364, 327, 375, 327, 327, 368, 327,
- /* 2220 */ 327, 327, 140, 327, 327, 70, 132, 327, 327, 327,
- /* 2230 */ 327, 327, 327, 327, 302, 346, 327, 327, 228, 369,
- /* 2240 */ 364, 368, 375, 327, 327, 140, 327, 327, 57, 132,
- /* 2250 */ 327, 327, 327, 327, 327, 327, 327, 302, 346, 327,
- /* 2260 */ 327, 228, 369, 364, 327, 375, 368, 327, 327, 327,
- /* 2270 */ 140, 327, 327, 90, 132, 327, 327, 368, 327, 327,
- /* 2280 */ 327, 140, 302, 346, 83, 132, 228, 369, 364, 327,
- /* 2290 */ 375, 327, 327, 302, 346, 327, 327, 228, 369, 364,
- /* 2300 */ 327, 375, 327, 327, 368, 327, 327, 327, 140, 327,
- /* 2310 */ 327, 82, 132, 327, 327, 327, 327, 327, 327, 327,
- /* 2320 */ 302, 346, 327, 327, 228, 369, 364, 368, 375, 327,
- /* 2330 */ 327, 140, 327, 327, 55, 132, 327, 327, 327, 327,
- /* 2340 */ 327, 327, 327, 302, 346, 327, 327, 228, 369, 364,
- /* 2350 */ 327, 375, 368, 327, 327, 327, 140, 327, 327, 72,
- /* 2360 */ 132, 327, 327, 368, 327, 327, 327, 93, 302, 346,
- /* 2370 */ 59, 122, 228, 369, 364, 327, 375, 327, 327, 302,
- /* 2380 */ 346, 327, 327, 228, 369, 364, 327, 375, 327, 327,
- /* 2390 */ 368, 327, 327, 327, 140, 327, 327, 74, 132, 327,
- /* 2400 */ 327, 327, 327, 193, 158, 327, 302, 346, 327, 327,
- /* 2410 */ 228, 369, 364, 294, 375, 327, 28, 31, 193, 173,
- /* 2420 */ 327, 327, 327, 327, 327, 193, 164, 327, 294, 327,
- /* 2430 */ 203, 28, 31, 327, 327, 294, 327, 327, 28, 31,
- /* 2440 */ 327, 327, 327, 327, 327, 203, 327, 327, 327, 327,
- /* 2450 */ 327, 327, 203,
+ const YY_SZ_ACTTAB = 2407;
+ static public $yy_action = array(
+ /* 0 */
+ 219, 309, 305, 301, 302, 303, 304, 310, 311, 317,
+ /* 10 */
+ 318, 319, 201, 30, 273, 9, 33, 238, 280, 15,
+ /* 20 */
+ 5, 108, 235, 234, 220, 7, 126, 42, 30, 30,
+ /* 30 */
+ 259, 211, 256, 495, 15, 15, 10, 33, 495, 280,
+ /* 40 */
+ 46, 47, 51, 45, 24, 14, 352, 353, 39, 37,
+ /* 50 */
+ 278, 359, 12, 25, 219, 219, 326, 434, 219, 192,
+ /* 60 */
+ 434, 569, 95, 263, 227, 306, 360, 361, 358, 357,
+ /* 70 */
+ 354, 355, 356, 342, 341, 328, 329, 330, 292, 219,
+ /* 80 */
+ 202, 322, 242, 30, 434, 231, 207, 434, 143, 15,
+ /* 90 */
+ 434, 35, 158, 434, 46, 47, 51, 45, 24, 14,
+ /* 100 */
+ 352, 353, 39, 37, 278, 359, 12, 25, 219, 48,
+ /* 110 */
+ 32, 219, 48, 391, 196, 2, 31, 138, 321, 4,
+ /* 120 */
+ 360, 361, 358, 357, 354, 355, 356, 342, 341, 328,
+ /* 130 */
+ 329, 330, 127, 48, 290, 349, 251, 30, 145, 140,
+ /* 140 */
+ 30, 207, 264, 15, 200, 322, 15, 334, 46, 47,
+ /* 150 */
+ 51, 45, 24, 14, 352, 353, 39, 37, 278, 359,
+ /* 160 */
+ 12, 25, 219, 289, 219, 48, 431, 297, 219, 33,
+ /* 170 */
+ 396, 280, 18, 191, 360, 361, 358, 357, 354, 355,
+ /* 180 */
+ 356, 342, 341, 328, 329, 330, 300, 285, 286, 287,
+ /* 190 */
+ 299, 206, 219, 431, 428, 194, 201, 315, 314, 431,
+ /* 200 */
+ 207, 281, 46, 47, 51, 45, 24, 14, 352, 353,
+ /* 210 */
+ 39, 37, 278, 359, 12, 25, 219, 33, 48, 280,
+ /* 220 */
+ 34, 30, 48, 197, 322, 276, 158, 15, 360, 361,
+ /* 230 */
+ 358, 357, 354, 355, 356, 342, 341, 328, 329, 330,
+ /* 240 */
+ 230, 338, 16, 289, 103, 179, 244, 219, 295, 2,
+ /* 250 */
+ 41, 33, 265, 280, 283, 148, 46, 47, 51, 45,
+ /* 260 */
+ 24, 14, 352, 353, 39, 37, 278, 359, 12, 25,
+ /* 270 */
+ 219, 207, 145, 43, 132, 189, 109, 333, 307, 227,
+ /* 280 */
+ 306, 190, 360, 361, 358, 357, 354, 355, 356, 342,
+ /* 290 */
+ 341, 328, 329, 330, 20, 22, 248, 339, 219, 99,
+ /* 300 */
+ 174, 48, 324, 33, 346, 280, 18, 288, 207, 283,
+ /* 310 */
+ 46, 47, 51, 45, 24, 14, 352, 353, 39, 37,
+ /* 320 */
+ 278, 359, 12, 25, 219, 289, 207, 30, 41, 110,
+ /* 330 */
+ 275, 2, 41, 15, 272, 266, 360, 361, 358, 357,
+ /* 340 */
+ 354, 355, 356, 342, 341, 328, 329, 330, 242, 40,
+ /* 350 */
+ 236, 347, 104, 177, 145, 219, 44, 316, 148, 135,
+ /* 360 */
+ 228, 27, 283, 269, 46, 47, 51, 45, 24, 14,
+ /* 370 */
+ 352, 353, 39, 37, 278, 359, 12, 25, 219, 207,
+ /* 380 */
+ 208, 33, 7, 280, 245, 239, 136, 173, 241, 279,
+ /* 390 */
+ 360, 361, 358, 357, 354, 355, 356, 342, 341, 328,
+ /* 400 */
+ 329, 330, 29, 158, 106, 13, 122, 171, 181, 6,
+ /* 410 */
+ 33, 15, 226, 33, 219, 237, 283, 283, 46, 47,
+ /* 420 */
+ 51, 45, 24, 14, 352, 353, 39, 37, 278, 359,
+ /* 430 */
+ 12, 25, 219, 205, 205, 252, 313, 238, 312, 235,
+ /* 440 */
+ 232, 195, 97, 127, 360, 361, 358, 357, 354, 355,
+ /* 450 */
+ 356, 342, 341, 328, 329, 330, 28, 320, 230, 105,
+ /* 460 */
+ 182, 164, 176, 33, 279, 254, 282, 186, 207, 283,
+ /* 470 */
+ 283, 253, 46, 47, 51, 45, 24, 14, 352, 353,
+ /* 480 */
+ 39, 37, 278, 359, 12, 25, 219, 205, 260, 107,
+ /* 490 */
+ 235, 262, 33, 193, 214, 332, 166, 198, 360, 361,
+ /* 500 */
+ 358, 357, 354, 355, 356, 342, 341, 328, 329, 330,
+ /* 510 */
+ 137, 175, 167, 291, 308, 344, 185, 261, 267, 161,
+ /* 520 */
+ 283, 283, 128, 337, 124, 283, 46, 47, 51, 45,
+ /* 530 */
+ 24, 14, 352, 353, 39, 37, 278, 359, 12, 25,
+ /* 540 */
+ 219, 38, 205, 203, 141, 169, 257, 134, 35, 130,
+ /* 550 */
+ 156, 114, 360, 361, 358, 357, 354, 355, 356, 342,
+ /* 560 */
+ 341, 328, 329, 330, 320, 158, 320, 241, 36, 293,
+ /* 570 */
+ 298, 94, 21, 26, 284, 219, 292, 168, 271, 162,
+ /* 580 */
+ 46, 47, 51, 45, 24, 14, 352, 353, 39, 37,
+ /* 590 */
+ 278, 359, 12, 25, 219, 279, 229, 205, 44, 281,
+ /* 600 */
+ 187, 17, 270, 331, 98, 127, 360, 361, 358, 357,
+ /* 610 */
+ 354, 355, 356, 342, 341, 328, 329, 330, 199, 320,
+ /* 620 */
+ 331, 331, 331, 331, 331, 331, 331, 331, 331, 331,
+ /* 630 */
+ 331, 331, 331, 331, 46, 47, 51, 45, 24, 14,
+ /* 640 */
+ 352, 353, 39, 37, 278, 359, 12, 25, 219, 331,
+ /* 650 */
+ 268, 331, 331, 331, 331, 331, 331, 331, 125, 115,
+ /* 660 */
+ 360, 361, 358, 357, 354, 355, 356, 342, 341, 328,
+ /* 670 */
+ 329, 330, 279, 331, 320, 331, 331, 331, 331, 331,
+ /* 680 */
+ 331, 331, 331, 331, 331, 331, 331, 331, 46, 47,
+ /* 690 */
+ 51, 45, 24, 14, 352, 353, 39, 37, 278, 359,
+ /* 700 */
+ 12, 25, 219, 331, 204, 331, 331, 331, 331, 331,
+ /* 710 */
+ 331, 159, 100, 116, 360, 361, 358, 357, 354, 355,
+ /* 720 */
+ 356, 342, 341, 328, 329, 330, 320, 320, 320, 331,
+ /* 730 */
+ 331, 331, 331, 331, 331, 331, 331, 331, 331, 331,
+ /* 740 */
+ 331, 331, 46, 47, 51, 45, 24, 14, 352, 353,
+ /* 750 */
+ 39, 37, 278, 359, 12, 25, 219, 331, 331, 331,
+ /* 760 */
+ 331, 331, 331, 331, 331, 102, 117, 331, 360, 361,
+ /* 770 */
+ 358, 357, 354, 355, 356, 342, 341, 328, 329, 330,
+ /* 780 */
+ 320, 320, 331, 331, 331, 331, 331, 331, 331, 331,
+ /* 790 */
+ 331, 331, 331, 331, 331, 331, 46, 47, 51, 45,
+ /* 800 */
+ 24, 14, 352, 353, 39, 37, 278, 359, 12, 25,
+ /* 810 */
+ 331, 331, 331, 331, 331, 331, 331, 331, 331, 331,
+ /* 820 */
+ 158, 331, 360, 361, 358, 357, 354, 355, 356, 342,
+ /* 830 */
+ 341, 328, 329, 330, 331, 331, 331, 331, 46, 47,
+ /* 840 */
+ 51, 45, 24, 14, 352, 353, 39, 37, 278, 359,
+ /* 850 */
+ 12, 25, 331, 331, 331, 331, 331, 331, 211, 331,
+ /* 860 */
+ 331, 331, 331, 10, 360, 361, 358, 357, 354, 355,
+ /* 870 */
+ 356, 342, 341, 328, 329, 330, 331, 331, 331, 331,
+ /* 880 */
+ 331, 331, 331, 9, 142, 212, 331, 331, 5, 108,
+ /* 890 */
+ 331, 246, 331, 331, 126, 157, 183, 331, 259, 123,
+ /* 900 */
+ 256, 331, 250, 331, 23, 283, 331, 52, 277, 331,
+ /* 910 */
+ 331, 255, 350, 348, 331, 345, 331, 279, 180, 178,
+ /* 920 */
+ 331, 331, 49, 50, 296, 240, 351, 283, 283, 106,
+ /* 930 */
+ 1, 274, 331, 147, 331, 331, 331, 331, 331, 279,
+ /* 940 */
+ 279, 9, 144, 92, 96, 233, 5, 108, 331, 345,
+ /* 950 */
+ 331, 331, 126, 331, 331, 246, 259, 323, 256, 146,
+ /* 960 */
+ 250, 331, 23, 123, 184, 52, 331, 331, 331, 331,
+ /* 970 */
+ 246, 331, 343, 283, 153, 255, 350, 348, 123, 345,
+ /* 980 */
+ 49, 50, 296, 240, 351, 279, 331, 106, 1, 331,
+ /* 990 */
+ 255, 350, 348, 331, 345, 33, 331, 280, 331, 9,
+ /* 1000 */
+ 142, 224, 96, 331, 5, 108, 331, 30, 331, 247,
+ /* 1010 */
+ 126, 246, 331, 15, 259, 149, 256, 331, 250, 123,
+ /* 1020 */
+ 23, 331, 331, 52, 331, 331, 331, 331, 331, 331,
+ /* 1030 */
+ 331, 255, 350, 348, 331, 345, 331, 331, 49, 50,
+ /* 1040 */
+ 296, 240, 351, 331, 331, 106, 1, 331, 331, 331,
+ /* 1050 */
+ 331, 331, 33, 331, 280, 331, 331, 9, 135, 224,
+ /* 1060 */
+ 96, 331, 5, 108, 30, 246, 258, 331, 126, 151,
+ /* 1070 */
+ 15, 246, 259, 123, 256, 154, 250, 331, 11, 123,
+ /* 1080 */
+ 331, 52, 331, 331, 331, 255, 350, 348, 331, 345,
+ /* 1090 */
+ 331, 255, 350, 348, 331, 345, 49, 50, 296, 240,
+ /* 1100 */
+ 351, 331, 331, 106, 1, 331, 331, 331, 331, 331,
+ /* 1110 */
+ 331, 331, 331, 331, 331, 9, 142, 210, 96, 331,
+ /* 1120 */
+ 5, 108, 331, 331, 331, 331, 126, 246, 331, 331,
+ /* 1130 */
+ 259, 155, 256, 331, 216, 123, 23, 331, 331, 52,
+ /* 1140 */
+ 331, 331, 331, 331, 331, 331, 331, 255, 350, 348,
+ /* 1150 */
+ 331, 345, 331, 331, 49, 50, 296, 240, 351, 331,
+ /* 1160 */
+ 331, 106, 1, 331, 331, 331, 331, 331, 331, 331,
+ /* 1170 */
+ 331, 331, 331, 9, 131, 224, 96, 331, 5, 108,
+ /* 1180 */
+ 331, 331, 331, 331, 126, 246, 331, 331, 259, 152,
+ /* 1190 */
+ 256, 331, 250, 123, 3, 331, 331, 52, 331, 331,
+ /* 1200 */
+ 331, 331, 331, 331, 331, 255, 350, 348, 331, 345,
+ /* 1210 */
+ 331, 331, 49, 50, 296, 240, 351, 331, 331, 106,
+ /* 1220 */
+ 1, 331, 331, 331, 331, 331, 331, 331, 331, 331,
+ /* 1230 */
+ 331, 9, 142, 213, 96, 331, 5, 108, 331, 331,
+ /* 1240 */
+ 331, 331, 126, 246, 331, 331, 259, 150, 256, 331,
+ /* 1250 */
+ 250, 123, 23, 331, 331, 52, 331, 331, 331, 331,
+ /* 1260 */
+ 331, 331, 331, 255, 350, 348, 331, 345, 331, 331,
+ /* 1270 */
+ 49, 50, 296, 240, 351, 331, 331, 106, 1, 331,
+ /* 1280 */
+ 219, 331, 401, 331, 331, 331, 331, 331, 331, 9,
+ /* 1290 */
+ 142, 209, 96, 331, 5, 108, 331, 331, 331, 331,
+ /* 1300 */
+ 126, 249, 331, 331, 259, 331, 256, 331, 250, 30,
+ /* 1310 */
+ 23, 190, 163, 52, 331, 15, 331, 331, 2, 331,
+ /* 1320 */
+ 331, 283, 331, 331, 20, 22, 331, 331, 49, 50,
+ /* 1330 */
+ 296, 240, 351, 331, 331, 106, 1, 331, 207, 331,
+ /* 1340 */
+ 331, 145, 331, 331, 331, 432, 331, 9, 139, 224,
+ /* 1350 */
+ 96, 331, 5, 108, 331, 331, 331, 331, 126, 331,
+ /* 1360 */
+ 331, 331, 259, 243, 256, 331, 250, 331, 23, 190,
+ /* 1370 */
+ 188, 52, 432, 331, 331, 331, 331, 331, 432, 283,
+ /* 1380 */
+ 331, 2, 20, 22, 331, 331, 49, 50, 296, 240,
+ /* 1390 */
+ 351, 331, 331, 106, 1, 331, 207, 331, 331, 331,
+ /* 1400 */
+ 331, 331, 331, 331, 145, 9, 135, 224, 96, 331,
+ /* 1410 */
+ 5, 108, 331, 331, 331, 331, 126, 331, 331, 331,
+ /* 1420 */
+ 259, 331, 256, 331, 250, 331, 11, 101, 160, 52,
+ /* 1430 */
+ 331, 331, 331, 331, 331, 331, 331, 283, 331, 331,
+ /* 1440 */
+ 20, 22, 331, 331, 49, 50, 296, 240, 351, 331,
+ /* 1450 */
+ 331, 106, 331, 331, 207, 331, 331, 331, 331, 331,
+ /* 1460 */
+ 331, 331, 331, 9, 135, 225, 96, 331, 5, 108,
+ /* 1470 */
+ 331, 331, 331, 331, 126, 331, 331, 331, 259, 331,
+ /* 1480 */
+ 256, 331, 250, 331, 11, 331, 477, 52, 331, 331,
+ /* 1490 */
+ 331, 331, 331, 331, 331, 331, 331, 331, 331, 331,
+ /* 1500 */
+ 331, 331, 49, 50, 296, 240, 351, 331, 477, 106,
+ /* 1510 */
+ 477, 477, 331, 477, 477, 331, 331, 331, 331, 477,
+ /* 1520 */
+ 331, 477, 2, 477, 96, 331, 331, 331, 331, 331,
+ /* 1530 */
+ 331, 331, 331, 331, 331, 246, 331, 331, 477, 120,
+ /* 1540 */
+ 331, 331, 84, 123, 331, 145, 331, 331, 331, 477,
+ /* 1550 */
+ 331, 294, 327, 331, 331, 255, 350, 348, 331, 345,
+ /* 1560 */
+ 331, 331, 331, 477, 331, 331, 331, 246, 331, 218,
+ /* 1570 */
+ 362, 120, 331, 331, 84, 123, 331, 331, 331, 331,
+ /* 1580 */
+ 331, 331, 331, 294, 327, 331, 331, 255, 350, 348,
+ /* 1590 */
+ 246, 345, 331, 331, 129, 331, 331, 61, 119, 232,
+ /* 1600 */
+ 331, 246, 335, 331, 331, 129, 294, 327, 80, 123,
+ /* 1610 */
+ 255, 350, 348, 331, 345, 331, 331, 294, 327, 331,
+ /* 1620 */
+ 331, 255, 350, 348, 331, 345, 246, 331, 331, 331,
+ /* 1630 */
+ 129, 331, 215, 80, 123, 331, 331, 331, 331, 331,
+ /* 1640 */
+ 331, 331, 294, 327, 331, 331, 255, 350, 348, 331,
+ /* 1650 */
+ 345, 331, 331, 331, 246, 190, 170, 221, 129, 331,
+ /* 1660 */
+ 331, 55, 119, 133, 331, 283, 331, 331, 20, 22,
+ /* 1670 */
+ 294, 327, 331, 331, 255, 350, 348, 246, 345, 331,
+ /* 1680 */
+ 331, 129, 207, 331, 80, 123, 331, 331, 331, 331,
+ /* 1690 */
+ 331, 331, 331, 294, 327, 331, 246, 255, 350, 348,
+ /* 1700 */
+ 129, 345, 331, 89, 123, 331, 331, 331, 223, 331,
+ /* 1710 */
+ 331, 331, 294, 327, 331, 331, 255, 350, 348, 246,
+ /* 1720 */
+ 345, 331, 331, 129, 331, 331, 70, 123, 331, 331,
+ /* 1730 */
+ 246, 331, 331, 331, 111, 294, 327, 67, 123, 255,
+ /* 1740 */
+ 350, 348, 331, 345, 331, 331, 294, 327, 331, 246,
+ /* 1750 */
+ 255, 350, 348, 129, 345, 331, 86, 123, 331, 331,
+ /* 1760 */
+ 331, 331, 331, 331, 331, 294, 327, 331, 246, 255,
+ /* 1770 */
+ 350, 348, 129, 345, 331, 90, 123, 331, 331, 331,
+ /* 1780 */
+ 331, 331, 331, 331, 294, 327, 331, 246, 255, 350,
+ /* 1790 */
+ 348, 129, 345, 331, 77, 123, 331, 331, 331, 331,
+ /* 1800 */
+ 331, 331, 331, 294, 327, 331, 246, 255, 350, 348,
+ /* 1810 */
+ 129, 345, 331, 74, 123, 331, 331, 246, 331, 331,
+ /* 1820 */
+ 331, 129, 294, 327, 66, 123, 255, 350, 348, 331,
+ /* 1830 */
+ 345, 331, 331, 294, 327, 331, 246, 222, 350, 348,
+ /* 1840 */
+ 129, 345, 331, 69, 123, 331, 331, 331, 331, 331,
+ /* 1850 */
+ 331, 331, 294, 327, 331, 246, 255, 350, 348, 129,
+ /* 1860 */
+ 345, 331, 78, 123, 331, 331, 331, 331, 331, 331,
+ /* 1870 */
+ 331, 294, 327, 331, 246, 255, 350, 348, 129, 345,
+ /* 1880 */
+ 331, 60, 123, 331, 331, 331, 331, 331, 331, 331,
+ /* 1890 */
+ 294, 327, 331, 246, 255, 350, 348, 129, 345, 331,
+ /* 1900 */
+ 53, 123, 331, 331, 246, 331, 331, 331, 129, 294,
+ /* 1910 */
+ 327, 65, 123, 255, 350, 348, 331, 345, 331, 331,
+ /* 1920 */
+ 294, 327, 336, 331, 255, 350, 348, 331, 345, 8,
+ /* 1930 */
+ 331, 331, 331, 331, 5, 108, 331, 331, 331, 331,
+ /* 1940 */
+ 126, 331, 331, 246, 259, 331, 256, 129, 331, 331,
+ /* 1950 */
+ 72, 123, 331, 331, 331, 331, 331, 331, 331, 294,
+ /* 1960 */
+ 327, 331, 246, 255, 350, 348, 129, 345, 331, 85,
+ /* 1970 */
+ 123, 331, 331, 331, 331, 331, 331, 331, 294, 327,
+ /* 1980 */
+ 331, 246, 255, 350, 348, 129, 345, 331, 81, 123,
+ /* 1990 */
+ 331, 19, 340, 331, 331, 331, 331, 294, 327, 331,
+ /* 2000 */
+ 246, 255, 350, 348, 113, 345, 331, 82, 123, 331,
+ /* 2010 */
+ 331, 246, 331, 331, 331, 93, 294, 327, 54, 121,
+ /* 2020 */
+ 255, 350, 348, 331, 345, 331, 331, 294, 327, 331,
+ /* 2030 */
+ 246, 217, 350, 348, 129, 345, 331, 58, 123, 331,
+ /* 2040 */
+ 331, 331, 331, 331, 331, 331, 294, 327, 331, 336,
+ /* 2050 */
+ 255, 350, 348, 331, 345, 331, 8, 331, 331, 331,
+ /* 2060 */
+ 331, 5, 108, 331, 331, 331, 331, 126, 246, 331,
+ /* 2070 */
+ 331, 259, 129, 256, 331, 88, 123, 331, 331, 246,
+ /* 2080 */
+ 331, 331, 331, 129, 294, 327, 56, 123, 255, 350,
+ /* 2090 */
+ 348, 331, 345, 331, 331, 294, 327, 331, 331, 255,
+ /* 2100 */
+ 350, 348, 331, 345, 246, 331, 331, 331, 129, 331,
+ /* 2110 */
+ 331, 68, 123, 331, 331, 331, 331, 325, 19, 340,
+ /* 2120 */
+ 294, 327, 331, 331, 255, 350, 348, 331, 345, 331,
+ /* 2130 */
+ 331, 331, 331, 246, 331, 331, 331, 118, 331, 331,
+ /* 2140 */
+ 59, 123, 331, 331, 331, 331, 190, 172, 331, 294,
+ /* 2150 */
+ 327, 331, 331, 255, 350, 348, 283, 345, 246, 20,
+ /* 2160 */
+ 22, 331, 93, 331, 331, 57, 121, 331, 331, 331,
+ /* 2170 */
+ 331, 331, 331, 207, 294, 327, 331, 246, 255, 350,
+ /* 2180 */
+ 348, 129, 345, 331, 64, 123, 331, 331, 246, 331,
+ /* 2190 */
+ 331, 331, 129, 294, 327, 63, 123, 255, 350, 348,
+ /* 2200 */
+ 331, 345, 331, 331, 294, 327, 331, 246, 255, 350,
+ /* 2210 */
+ 348, 129, 345, 331, 73, 123, 331, 331, 331, 331,
+ /* 2220 */
+ 190, 165, 331, 294, 327, 331, 331, 255, 350, 348,
+ /* 2230 */
+ 283, 345, 331, 20, 22, 331, 246, 331, 331, 331,
+ /* 2240 */
+ 129, 331, 331, 87, 123, 331, 331, 207, 331, 331,
+ /* 2250 */
+ 331, 331, 294, 327, 331, 331, 255, 350, 348, 331,
+ /* 2260 */
+ 345, 246, 331, 331, 331, 129, 331, 331, 75, 123,
+ /* 2270 */
+ 331, 331, 246, 331, 331, 331, 129, 294, 327, 61,
+ /* 2280 */
+ 123, 255, 350, 348, 331, 345, 331, 331, 294, 327,
+ /* 2290 */
+ 331, 246, 255, 350, 348, 129, 345, 331, 71, 123,
+ /* 2300 */
+ 331, 331, 246, 331, 331, 331, 129, 294, 327, 83,
+ /* 2310 */
+ 123, 255, 350, 348, 331, 345, 331, 331, 294, 327,
+ /* 2320 */
+ 331, 331, 255, 350, 348, 331, 345, 246, 331, 331,
+ /* 2330 */
+ 331, 112, 331, 331, 76, 123, 331, 331, 331, 331,
+ /* 2340 */
+ 331, 331, 331, 294, 327, 331, 331, 255, 350, 348,
+ /* 2350 */
+ 331, 345, 246, 331, 331, 331, 129, 331, 331, 91,
+ /* 2360 */
+ 123, 331, 331, 246, 331, 331, 331, 129, 294, 327,
+ /* 2370 */
+ 62, 123, 255, 350, 348, 331, 345, 331, 331, 294,
+ /* 2380 */
+ 327, 331, 246, 255, 350, 348, 129, 345, 331, 79,
+ /* 2390 */
+ 123, 331, 331, 331, 331, 331, 331, 331, 294, 327,
+ /* 2400 */
+ 331, 331, 255, 350, 348, 331, 345,
);
static public $yy_lookahead = array(
- /* 0 */ 1, 3, 4, 5, 6, 7, 8, 9, 10, 11,
- /* 10 */ 12, 13, 113, 114, 16, 91, 17, 17, 91, 16,
- /* 20 */ 22, 23, 19, 20, 100, 24, 28, 100, 29, 29,
- /* 30 */ 32, 33, 34, 29, 35, 35, 112, 16, 37, 40,
- /* 40 */ 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
- /* 50 */ 51, 52, 53, 1, 82, 83, 84, 85, 86, 38,
- /* 60 */ 16, 90, 18, 19, 90, 66, 67, 68, 69, 70,
- /* 70 */ 71, 72, 73, 74, 75, 76, 77, 103, 104, 27,
- /* 80 */ 36, 29, 16, 96, 18, 19, 16, 35, 117, 19,
- /* 90 */ 20, 117, 40, 41, 42, 43, 44, 45, 46, 47,
- /* 100 */ 48, 49, 50, 51, 52, 53, 4, 5, 6, 7,
- /* 110 */ 8, 20, 118, 38, 38, 13, 14, 15, 66, 67,
- /* 120 */ 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
- /* 130 */ 1, 85, 62, 1, 59, 89, 61, 61, 92, 93,
- /* 140 */ 65, 16, 20, 21, 19, 17, 17, 101, 102, 17,
- /* 150 */ 59, 105, 106, 107, 29, 109, 31, 29, 29, 91,
- /* 160 */ 35, 29, 30, 35, 35, 119, 120, 35, 100, 40,
- /* 170 */ 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
- /* 180 */ 51, 52, 53, 61, 90, 91, 54, 113, 114, 111,
- /* 190 */ 16, 113, 114, 19, 100, 66, 67, 68, 69, 70,
- /* 200 */ 71, 72, 73, 74, 75, 76, 77, 1, 85, 59,
- /* 210 */ 1, 117, 89, 1, 64, 92, 93, 94, 1, 17,
- /* 220 */ 108, 17, 20, 17, 101, 102, 17, 115, 105, 106,
- /* 230 */ 107, 29, 109, 29, 17, 29, 62, 35, 29, 35,
- /* 240 */ 38, 35, 19, 31, 35, 99, 40, 41, 42, 43,
- /* 250 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
- /* 260 */ 1, 16, 37, 61, 19, 20, 54, 110, 1, 2,
- /* 270 */ 25, 54, 66, 67, 68, 69, 70, 71, 72, 73,
- /* 280 */ 74, 75, 76, 77, 17, 62, 90, 91, 29, 1,
- /* 290 */ 65, 90, 110, 37, 35, 39, 100, 20, 21, 40,
- /* 300 */ 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
- /* 310 */ 51, 52, 53, 117, 90, 91, 96, 29, 117, 118,
- /* 320 */ 84, 85, 86, 35, 100, 66, 67, 68, 69, 70,
- /* 330 */ 71, 72, 73, 74, 75, 76, 77, 1, 61, 99,
- /* 340 */ 1, 117, 37, 85, 39, 18, 19, 89, 10, 16,
- /* 350 */ 99, 93, 19, 17, 16, 21, 17, 93, 85, 1,
- /* 360 */ 22, 23, 29, 105, 106, 107, 28, 109, 35, 105,
- /* 370 */ 32, 33, 34, 109, 25, 17, 40, 41, 42, 43,
- /* 380 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
- /* 390 */ 63, 1, 31, 59, 121, 122, 25, 2, 64, 38,
- /* 400 */ 18, 19, 66, 67, 68, 69, 70, 71, 72, 73,
- /* 410 */ 74, 75, 76, 77, 24, 20, 78, 79, 80, 91,
- /* 420 */ 91, 29, 61, 93, 94, 95, 19, 35, 100, 100,
- /* 430 */ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
- /* 440 */ 50, 51, 52, 53, 91, 117, 117, 37, 16, 39,
- /* 450 */ 79, 19, 110, 100, 112, 19, 66, 67, 68, 69,
- /* 460 */ 70, 71, 72, 73, 74, 75, 76, 77, 1, 85,
- /* 470 */ 117, 1, 1, 89, 108, 90, 92, 93, 94, 16,
- /* 480 */ 1, 115, 19, 17, 17, 101, 102, 17, 17, 105,
- /* 490 */ 106, 107, 29, 109, 31, 29, 17, 91, 35, 29,
- /* 500 */ 21, 35, 117, 19, 18, 35, 100, 40, 41, 42,
- /* 510 */ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
- /* 520 */ 53, 1, 16, 117, 54, 19, 16, 18, 1, 19,
- /* 530 */ 97, 97, 1, 66, 67, 68, 69, 70, 71, 72,
- /* 540 */ 73, 74, 75, 76, 77, 112, 112, 38, 17, 90,
- /* 550 */ 93, 94, 16, 16, 26, 19, 19, 93, 94, 39,
- /* 560 */ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
- /* 570 */ 50, 51, 52, 53, 1, 2, 117, 17, 110, 16,
- /* 580 */ 112, 54, 19, 18, 97, 25, 66, 67, 68, 69,
- /* 590 */ 70, 71, 72, 73, 74, 75, 76, 77, 62, 112,
- /* 600 */ 29, 19, 91, 86, 38, 88, 35, 19, 63, 55,
- /* 610 */ 63, 100, 97, 40, 41, 42, 43, 44, 45, 46,
- /* 620 */ 47, 48, 49, 50, 51, 52, 53, 112, 19, 65,
- /* 630 */ 39, 18, 2, 36, 36, 59, 19, 18, 97, 66,
- /* 640 */ 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
- /* 650 */ 77, 1, 85, 112, 1, 18, 89, 85, 19, 92,
- /* 660 */ 93, 89, 19, 38, 20, 93, 91, 17, 101, 102,
- /* 670 */ 17, 97, 105, 106, 107, 100, 109, 105, 106, 107,
- /* 680 */ 19, 109, 29, 116, 2, 19, 112, 112, 35, 21,
- /* 690 */ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
- /* 700 */ 50, 51, 52, 53, 1, 1, 100, 54, 112, 117,
- /* 710 */ 111, 2, 21, 110, 98, 97, 66, 67, 68, 69,
- /* 720 */ 70, 71, 72, 73, 74, 75, 76, 77, 112, 61,
- /* 730 */ 112, 85, 14, 110, 87, 115, 114, 123, 123, 123,
- /* 740 */ 123, 123, 97, 40, 41, 42, 43, 44, 45, 46,
- /* 750 */ 47, 48, 49, 50, 51, 52, 53, 112, 123, 123,
- /* 760 */ 123, 123, 123, 123, 123, 123, 123, 123, 122, 66,
- /* 770 */ 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
- /* 780 */ 77, 1, 79, 85, 123, 1, 123, 89, 123, 123,
- /* 790 */ 92, 93, 123, 97, 17, 123, 97, 17, 17, 101,
- /* 800 */ 102, 17, 123, 105, 106, 107, 29, 109, 112, 123,
- /* 810 */ 29, 112, 35, 29, 116, 123, 35, 123, 123, 35,
- /* 820 */ 40, 41, 42, 43, 44, 45, 46, 47, 48, 49,
- /* 830 */ 50, 51, 52, 53, 1, 123, 123, 123, 54, 123,
- /* 840 */ 123, 123, 123, 123, 123, 123, 66, 67, 68, 69,
- /* 850 */ 70, 71, 72, 73, 74, 75, 76, 77, 123, 123,
- /* 860 */ 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
- /* 870 */ 123, 123, 39, 40, 41, 42, 43, 44, 45, 46,
- /* 880 */ 47, 48, 49, 50, 51, 52, 53, 1, 123, 123,
- /* 890 */ 123, 123, 123, 123, 123, 123, 123, 123, 123, 66,
- /* 900 */ 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
- /* 910 */ 77, 123, 123, 123, 123, 123, 123, 123, 123, 123,
- /* 920 */ 123, 123, 123, 123, 123, 123, 40, 41, 42, 43,
- /* 930 */ 44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
- /* 940 */ 1, 123, 123, 123, 123, 123, 123, 123, 123, 123,
- /* 950 */ 123, 65, 66, 67, 68, 69, 70, 71, 72, 73,
- /* 960 */ 74, 75, 76, 77, 123, 123, 123, 123, 123, 30,
- /* 970 */ 123, 123, 123, 123, 123, 123, 123, 123, 123, 40,
- /* 980 */ 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
- /* 990 */ 51, 52, 53, 1, 123, 123, 123, 123, 123, 123,
- /* 1000 */ 123, 123, 123, 123, 123, 66, 67, 68, 69, 70,
- /* 1010 */ 71, 72, 73, 74, 75, 76, 77, 123, 123, 123,
- /* 1020 */ 123, 123, 123, 123, 123, 123, 123, 123, 123, 123,
- /* 1030 */ 123, 123, 40, 41, 42, 43, 44, 45, 46, 47,
- /* 1040 */ 48, 49, 50, 51, 52, 53, 123, 123, 123, 123,
- /* 1050 */ 123, 123, 123, 123, 123, 123, 123, 123, 66, 67,
- /* 1060 */ 68, 69, 70, 71, 72, 73, 74, 75, 76, 77,
- /* 1070 */ 123, 123, 123, 40, 41, 42, 43, 44, 45, 46,
- /* 1080 */ 47, 48, 49, 50, 51, 52, 53, 123, 123, 123,
- /* 1090 */ 123, 123, 123, 123, 123, 123, 123, 123, 123, 66,
- /* 1100 */ 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
- /* 1110 */ 77, 123, 123, 123, 123, 123, 16, 123, 18, 19,
- /* 1120 */ 123, 123, 22, 23, 123, 17, 123, 85, 28, 123,
- /* 1130 */ 123, 89, 32, 33, 34, 93, 36, 29, 38, 123,
- /* 1140 */ 123, 41, 123, 35, 102, 123, 85, 105, 106, 107,
- /* 1150 */ 89, 109, 123, 91, 93, 123, 56, 57, 58, 59,
- /* 1160 */ 60, 123, 100, 63, 64, 65, 105, 106, 107, 17,
- /* 1170 */ 109, 123, 123, 16, 112, 18, 19, 123, 78, 22,
- /* 1180 */ 23, 29, 17, 123, 123, 28, 123, 35, 123, 32,
- /* 1190 */ 33, 34, 123, 36, 29, 38, 123, 123, 41, 123,
- /* 1200 */ 35, 123, 85, 123, 123, 123, 89, 123, 123, 92,
- /* 1210 */ 93, 123, 123, 56, 57, 58, 59, 60, 101, 102,
- /* 1220 */ 63, 64, 105, 106, 107, 123, 109, 17, 123, 123,
- /* 1230 */ 16, 123, 18, 19, 123, 78, 22, 23, 123, 29,
- /* 1240 */ 91, 123, 28, 123, 17, 35, 32, 33, 34, 100,
- /* 1250 */ 36, 123, 38, 123, 123, 41, 29, 123, 123, 85,
- /* 1260 */ 123, 112, 35, 89, 123, 123, 92, 93, 123, 123,
- /* 1270 */ 56, 57, 58, 59, 60, 101, 102, 63, 64, 105,
- /* 1280 */ 106, 107, 123, 109, 17, 123, 123, 16, 123, 18,
- /* 1290 */ 19, 123, 78, 22, 23, 123, 29, 123, 123, 28,
- /* 1300 */ 123, 17, 35, 32, 33, 34, 123, 36, 123, 38,
- /* 1310 */ 123, 123, 41, 29, 123, 123, 85, 123, 123, 35,
- /* 1320 */ 89, 123, 123, 92, 93, 123, 123, 56, 57, 58,
- /* 1330 */ 59, 60, 101, 102, 63, 64, 105, 106, 107, 123,
- /* 1340 */ 109, 17, 123, 123, 16, 123, 18, 19, 123, 78,
- /* 1350 */ 22, 23, 123, 29, 123, 123, 28, 123, 17, 35,
- /* 1360 */ 32, 33, 34, 123, 36, 123, 38, 123, 123, 41,
- /* 1370 */ 29, 123, 123, 85, 123, 123, 35, 89, 123, 123,
- /* 1380 */ 92, 93, 123, 123, 56, 57, 58, 59, 60, 101,
- /* 1390 */ 102, 63, 64, 105, 106, 107, 123, 109, 17, 123,
- /* 1400 */ 123, 16, 123, 18, 19, 123, 78, 22, 23, 123,
- /* 1410 */ 29, 123, 123, 28, 123, 17, 35, 32, 33, 34,
- /* 1420 */ 123, 36, 123, 38, 123, 123, 41, 29, 123, 123,
- /* 1430 */ 85, 123, 123, 35, 89, 123, 123, 92, 93, 123,
- /* 1440 */ 123, 56, 57, 58, 59, 60, 101, 102, 63, 64,
- /* 1450 */ 105, 106, 107, 123, 109, 17, 123, 123, 16, 123,
- /* 1460 */ 18, 19, 123, 78, 22, 23, 123, 29, 123, 123,
- /* 1470 */ 28, 123, 17, 35, 32, 33, 34, 123, 36, 123,
- /* 1480 */ 38, 123, 123, 41, 29, 123, 123, 85, 123, 123,
- /* 1490 */ 35, 89, 123, 123, 92, 93, 123, 123, 56, 57,
- /* 1500 */ 58, 59, 60, 101, 102, 63, 64, 105, 106, 107,
- /* 1510 */ 123, 109, 17, 123, 123, 16, 123, 18, 19, 123,
- /* 1520 */ 78, 22, 23, 123, 29, 123, 123, 28, 123, 17,
- /* 1530 */ 35, 32, 33, 34, 123, 36, 123, 38, 123, 123,
- /* 1540 */ 41, 29, 123, 123, 85, 123, 123, 35, 89, 123,
- /* 1550 */ 123, 92, 93, 123, 123, 56, 57, 58, 59, 60,
- /* 1560 */ 101, 102, 63, 64, 105, 106, 107, 123, 109, 123,
- /* 1570 */ 123, 123, 16, 123, 18, 19, 123, 78, 22, 23,
- /* 1580 */ 123, 123, 123, 123, 28, 123, 123, 123, 32, 33,
- /* 1590 */ 34, 123, 36, 123, 38, 123, 123, 41, 123, 123,
- /* 1600 */ 123, 85, 123, 123, 123, 89, 123, 123, 92, 93,
- /* 1610 */ 123, 123, 56, 57, 58, 59, 60, 101, 102, 63,
- /* 1620 */ 64, 105, 106, 107, 123, 109, 123, 123, 123, 16,
- /* 1630 */ 123, 18, 19, 123, 78, 22, 23, 123, 123, 123,
- /* 1640 */ 123, 28, 123, 123, 123, 32, 33, 34, 123, 36,
- /* 1650 */ 123, 38, 123, 123, 41, 123, 123, 123, 85, 123,
- /* 1660 */ 123, 123, 89, 123, 123, 92, 93, 123, 123, 56,
- /* 1670 */ 57, 58, 59, 60, 101, 102, 63, 123, 105, 106,
- /* 1680 */ 107, 123, 109, 123, 123, 123, 16, 123, 18, 19,
- /* 1690 */ 123, 78, 22, 23, 123, 123, 123, 123, 28, 123,
- /* 1700 */ 123, 123, 32, 33, 34, 123, 36, 123, 38, 123,
- /* 1710 */ 123, 41, 123, 123, 123, 85, 123, 123, 123, 89,
- /* 1720 */ 123, 123, 92, 93, 123, 123, 56, 57, 58, 59,
- /* 1730 */ 60, 101, 102, 63, 123, 105, 106, 107, 123, 109,
- /* 1740 */ 123, 123, 123, 123, 17, 123, 116, 123, 78, 123,
- /* 1750 */ 123, 24, 123, 26, 27, 10, 29, 30, 123, 123,
- /* 1760 */ 123, 16, 35, 123, 37, 38, 39, 22, 23, 123,
- /* 1770 */ 90, 91, 123, 28, 123, 123, 123, 32, 33, 34,
- /* 1780 */ 100, 54, 123, 103, 104, 123, 123, 123, 61, 123,
- /* 1790 */ 123, 123, 65, 123, 85, 90, 91, 117, 89, 123,
- /* 1800 */ 123, 92, 93, 123, 123, 100, 79, 123, 103, 104,
- /* 1810 */ 101, 102, 123, 85, 105, 106, 107, 89, 109, 123,
- /* 1820 */ 123, 93, 117, 78, 79, 80, 123, 123, 123, 120,
- /* 1830 */ 102, 123, 85, 105, 106, 107, 89, 109, 123, 92,
- /* 1840 */ 93, 123, 1, 85, 123, 123, 123, 89, 101, 102,
- /* 1850 */ 92, 93, 105, 106, 107, 123, 109, 123, 17, 101,
- /* 1860 */ 102, 123, 21, 105, 106, 107, 123, 109, 123, 123,
- /* 1870 */ 29, 123, 123, 123, 85, 123, 35, 123, 89, 38,
- /* 1880 */ 123, 92, 93, 123, 123, 123, 123, 123, 123, 123,
- /* 1890 */ 101, 102, 123, 123, 105, 106, 107, 85, 109, 123,
- /* 1900 */ 123, 89, 61, 85, 92, 93, 123, 89, 123, 123,
- /* 1910 */ 123, 93, 123, 101, 102, 123, 123, 105, 106, 107,
- /* 1920 */ 123, 109, 85, 105, 106, 107, 89, 109, 123, 92,
- /* 1930 */ 93, 123, 123, 85, 123, 123, 123, 89, 101, 102,
- /* 1940 */ 92, 93, 105, 106, 107, 123, 109, 123, 123, 101,
- /* 1950 */ 102, 123, 123, 105, 106, 107, 123, 109, 123, 123,
- /* 1960 */ 85, 90, 91, 123, 89, 123, 123, 92, 93, 123,
- /* 1970 */ 123, 100, 123, 123, 103, 104, 101, 102, 123, 123,
- /* 1980 */ 105, 106, 107, 85, 109, 123, 123, 89, 117, 85,
- /* 1990 */ 92, 93, 123, 89, 123, 123, 123, 93, 123, 101,
- /* 2000 */ 102, 123, 123, 105, 106, 107, 123, 109, 85, 105,
- /* 2010 */ 106, 107, 89, 109, 123, 92, 93, 123, 123, 85,
- /* 2020 */ 123, 123, 123, 89, 101, 102, 92, 93, 105, 106,
- /* 2030 */ 107, 123, 109, 123, 123, 101, 102, 123, 123, 105,
- /* 2040 */ 106, 107, 123, 109, 123, 123, 85, 123, 123, 123,
- /* 2050 */ 89, 123, 123, 92, 93, 123, 123, 123, 123, 123,
- /* 2060 */ 123, 123, 101, 102, 123, 123, 105, 106, 107, 85,
- /* 2070 */ 109, 123, 123, 89, 123, 85, 92, 93, 123, 89,
- /* 2080 */ 123, 123, 123, 93, 123, 101, 102, 123, 123, 105,
- /* 2090 */ 106, 107, 123, 109, 85, 105, 106, 107, 89, 109,
- /* 2100 */ 123, 92, 93, 123, 123, 85, 123, 123, 123, 89,
- /* 2110 */ 101, 102, 92, 93, 105, 106, 107, 123, 109, 123,
- /* 2120 */ 123, 101, 102, 123, 123, 105, 106, 107, 123, 109,
- /* 2130 */ 123, 123, 85, 123, 123, 123, 89, 123, 123, 92,
- /* 2140 */ 93, 123, 123, 123, 123, 123, 123, 123, 101, 102,
- /* 2150 */ 123, 123, 105, 106, 107, 85, 109, 123, 123, 89,
- /* 2160 */ 123, 85, 92, 93, 123, 89, 123, 123, 123, 93,
- /* 2170 */ 123, 101, 102, 123, 123, 105, 106, 107, 123, 109,
- /* 2180 */ 85, 105, 106, 107, 89, 109, 123, 92, 93, 123,
- /* 2190 */ 123, 85, 123, 123, 123, 89, 101, 102, 92, 93,
- /* 2200 */ 105, 106, 107, 123, 109, 123, 123, 101, 102, 123,
- /* 2210 */ 123, 105, 106, 107, 123, 109, 123, 123, 85, 123,
- /* 2220 */ 123, 123, 89, 123, 123, 92, 93, 123, 123, 123,
- /* 2230 */ 123, 123, 123, 123, 101, 102, 123, 123, 105, 106,
- /* 2240 */ 107, 85, 109, 123, 123, 89, 123, 123, 92, 93,
- /* 2250 */ 123, 123, 123, 123, 123, 123, 123, 101, 102, 123,
- /* 2260 */ 123, 105, 106, 107, 123, 109, 85, 123, 123, 123,
- /* 2270 */ 89, 123, 123, 92, 93, 123, 123, 85, 123, 123,
- /* 2280 */ 123, 89, 101, 102, 92, 93, 105, 106, 107, 123,
- /* 2290 */ 109, 123, 123, 101, 102, 123, 123, 105, 106, 107,
- /* 2300 */ 123, 109, 123, 123, 85, 123, 123, 123, 89, 123,
- /* 2310 */ 123, 92, 93, 123, 123, 123, 123, 123, 123, 123,
- /* 2320 */ 101, 102, 123, 123, 105, 106, 107, 85, 109, 123,
- /* 2330 */ 123, 89, 123, 123, 92, 93, 123, 123, 123, 123,
- /* 2340 */ 123, 123, 123, 101, 102, 123, 123, 105, 106, 107,
- /* 2350 */ 123, 109, 85, 123, 123, 123, 89, 123, 123, 92,
- /* 2360 */ 93, 123, 123, 85, 123, 123, 123, 89, 101, 102,
- /* 2370 */ 92, 93, 105, 106, 107, 123, 109, 123, 123, 101,
- /* 2380 */ 102, 123, 123, 105, 106, 107, 123, 109, 123, 123,
- /* 2390 */ 85, 123, 123, 123, 89, 123, 123, 92, 93, 123,
- /* 2400 */ 123, 123, 123, 90, 91, 123, 101, 102, 123, 123,
- /* 2410 */ 105, 106, 107, 100, 109, 123, 103, 104, 90, 91,
- /* 2420 */ 123, 123, 123, 123, 123, 90, 91, 123, 100, 123,
- /* 2430 */ 117, 103, 104, 123, 123, 100, 123, 123, 103, 104,
- /* 2440 */ 123, 123, 123, 123, 123, 117, 123, 123, 123, 123,
- /* 2450 */ 123, 123, 117,
-);
- const YY_SHIFT_USE_DFLT = -3;
- const YY_SHIFT_MAX = 252;
+ /* 0 */
+ 1, 4, 5, 6, 7, 8, 9, 10, 11, 12,
+ /* 10 */
+ 13, 14, 15, 30, 66, 18, 18, 2, 20, 36,
+ /* 20 */
+ 23, 24, 94, 95, 96, 39, 29, 28, 30, 30,
+ /* 30 */
+ 33, 60, 35, 60, 36, 36, 65, 18, 65, 20,
+ /* 40 */
+ 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
+ /* 50 */
+ 51, 52, 53, 54, 1, 1, 3, 3, 1, 91,
+ /* 60 */
+ 3, 83, 84, 85, 86, 87, 67, 68, 69, 70,
+ /* 70 */
+ 71, 72, 73, 74, 75, 76, 77, 78, 112, 1,
+ /* 80 */
+ 114, 115, 63, 30, 30, 31, 118, 30, 19, 36,
+ /* 90 */
+ 36, 21, 22, 36, 41, 42, 43, 44, 45, 46,
+ /* 100 */
+ 47, 48, 49, 50, 51, 52, 53, 54, 1, 55,
+ /* 110 */
+ 32, 1, 55, 3, 91, 39, 18, 19, 20, 38,
+ /* 120 */
+ 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
+ /* 130 */
+ 77, 78, 62, 55, 20, 37, 60, 30, 62, 20,
+ /* 140 */
+ 30, 118, 66, 36, 114, 115, 36, 66, 41, 42,
+ /* 150 */
+ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
+ /* 160 */
+ 53, 54, 1, 26, 1, 55, 3, 37, 1, 18,
+ /* 170 */
+ 3, 20, 21, 91, 67, 68, 69, 70, 71, 72,
+ /* 180 */
+ 73, 74, 75, 76, 77, 78, 5, 6, 7, 8,
+ /* 190 */
+ 9, 20, 1, 30, 3, 100, 15, 16, 17, 36,
+ /* 200 */
+ 118, 119, 41, 42, 43, 44, 45, 46, 47, 48,
+ /* 210 */
+ 49, 50, 51, 52, 53, 54, 1, 18, 55, 20,
+ /* 220 */
+ 21, 30, 55, 114, 115, 26, 22, 36, 67, 68,
+ /* 230 */
+ 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
+ /* 240 */
+ 86, 80, 32, 26, 91, 92, 31, 1, 109, 39,
+ /* 250 */
+ 38, 18, 40, 20, 101, 116, 41, 42, 43, 44,
+ /* 260 */
+ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
+ /* 270 */
+ 1, 118, 62, 18, 19, 20, 122, 123, 85, 86,
+ /* 280 */
+ 87, 91, 67, 68, 69, 70, 71, 72, 73, 74,
+ /* 290 */
+ 75, 76, 77, 78, 104, 105, 63, 80, 1, 91,
+ /* 300 */
+ 92, 55, 3, 18, 115, 20, 21, 20, 118, 101,
+ /* 310 */
+ 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
+ /* 320 */
+ 51, 52, 53, 54, 1, 26, 118, 30, 38, 88,
+ /* 330 */
+ 40, 39, 38, 36, 40, 66, 67, 68, 69, 70,
+ /* 340 */
+ 71, 72, 73, 74, 75, 76, 77, 78, 63, 21,
+ /* 350 */
+ 63, 109, 91, 92, 62, 1, 2, 16, 116, 19,
+ /* 360 */
+ 20, 18, 101, 40, 41, 42, 43, 44, 45, 46,
+ /* 370 */
+ 47, 48, 49, 50, 51, 52, 53, 54, 1, 118,
+ /* 380 */
+ 3, 18, 39, 20, 19, 20, 19, 111, 60, 113,
+ /* 390 */
+ 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
+ /* 400 */
+ 77, 78, 21, 22, 64, 30, 39, 92, 92, 39,
+ /* 410 */
+ 18, 36, 20, 18, 1, 20, 101, 101, 41, 42,
+ /* 420 */
+ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
+ /* 430 */
+ 53, 54, 1, 118, 118, 22, 87, 2, 89, 94,
+ /* 440 */
+ 95, 91, 98, 62, 67, 68, 69, 70, 71, 72,
+ /* 450 */
+ 73, 74, 75, 76, 77, 78, 21, 113, 86, 111,
+ /* 460 */
+ 92, 92, 111, 18, 113, 20, 20, 111, 118, 101,
+ /* 470 */
+ 101, 40, 41, 42, 43, 44, 45, 46, 47, 48,
+ /* 480 */
+ 49, 50, 51, 52, 53, 54, 1, 118, 3, 100,
+ /* 490 */
+ 94, 95, 18, 100, 20, 123, 111, 25, 67, 68,
+ /* 500 */
+ 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
+ /* 510 */
+ 38, 92, 92, 20, 3, 3, 92, 20, 40, 64,
+ /* 520 */
+ 101, 101, 19, 3, 19, 101, 41, 42, 43, 44,
+ /* 530 */
+ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
+ /* 540 */
+ 1, 2, 118, 20, 19, 64, 20, 19, 21, 98,
+ /* 550 */
+ 20, 98, 67, 68, 69, 70, 71, 72, 73, 74,
+ /* 560 */
+ 75, 76, 77, 78, 113, 22, 113, 60, 27, 20,
+ /* 570 */
+ 37, 20, 56, 2, 101, 1, 112, 111, 116, 111,
+ /* 580 */
+ 41, 42, 43, 44, 45, 46, 47, 48, 49, 50,
+ /* 590 */
+ 51, 52, 53, 54, 1, 113, 97, 118, 2, 119,
+ /* 600 */
+ 111, 97, 30, 124, 98, 62, 67, 68, 69, 70,
+ /* 610 */
+ 71, 72, 73, 74, 75, 76, 77, 78, 25, 113,
+ /* 620 */
+ 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
+ /* 630 */
+ 124, 124, 124, 124, 41, 42, 43, 44, 45, 46,
+ /* 640 */
+ 47, 48, 49, 50, 51, 52, 53, 54, 1, 124,
+ /* 650 */
+ 3, 124, 124, 124, 124, 124, 124, 124, 99, 98,
+ /* 660 */
+ 67, 68, 69, 70, 71, 72, 73, 74, 75, 76,
+ /* 670 */
+ 77, 78, 113, 124, 113, 124, 124, 124, 124, 124,
+ /* 680 */
+ 124, 124, 124, 124, 124, 124, 124, 124, 41, 42,
+ /* 690 */
+ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
+ /* 700 */
+ 53, 54, 1, 124, 3, 124, 124, 124, 124, 124,
+ /* 710 */
+ 124, 98, 98, 98, 67, 68, 69, 70, 71, 72,
+ /* 720 */
+ 73, 74, 75, 76, 77, 78, 113, 113, 113, 124,
+ /* 730 */
+ 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
+ /* 740 */
+ 124, 124, 41, 42, 43, 44, 45, 46, 47, 48,
+ /* 750 */
+ 49, 50, 51, 52, 53, 54, 1, 124, 124, 124,
+ /* 760 */
+ 124, 124, 124, 124, 124, 98, 98, 124, 67, 68,
+ /* 770 */
+ 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,
+ /* 780 */
+ 113, 113, 124, 124, 124, 124, 124, 124, 124, 124,
+ /* 790 */
+ 124, 124, 124, 124, 124, 124, 41, 42, 43, 44,
+ /* 800 */
+ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
+ /* 810 */
+ 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
+ /* 820 */
+ 22, 124, 67, 68, 69, 70, 71, 72, 73, 74,
+ /* 830 */
+ 75, 76, 77, 78, 124, 124, 124, 124, 41, 42,
+ /* 840 */
+ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
+ /* 850 */
+ 53, 54, 124, 124, 124, 124, 124, 124, 60, 124,
+ /* 860 */
+ 124, 124, 124, 65, 67, 68, 69, 70, 71, 72,
+ /* 870 */
+ 73, 74, 75, 76, 77, 78, 124, 124, 124, 124,
+ /* 880 */
+ 124, 124, 124, 18, 19, 20, 124, 124, 23, 24,
+ /* 890 */
+ 124, 86, 124, 124, 29, 90, 92, 124, 33, 94,
+ /* 900 */
+ 35, 124, 37, 124, 39, 101, 124, 42, 103, 124,
+ /* 910 */
+ 124, 106, 107, 108, 124, 110, 124, 113, 92, 92,
+ /* 920 */
+ 124, 124, 57, 58, 59, 60, 61, 101, 101, 64,
+ /* 930 */
+ 65, 66, 124, 94, 124, 124, 124, 124, 124, 113,
+ /* 940 */
+ 113, 18, 19, 20, 79, 106, 23, 24, 124, 110,
+ /* 950 */
+ 124, 124, 29, 124, 124, 86, 33, 34, 35, 90,
+ /* 960 */
+ 37, 124, 39, 94, 92, 42, 124, 124, 124, 124,
+ /* 970 */
+ 86, 124, 103, 101, 90, 106, 107, 108, 94, 110,
+ /* 980 */
+ 57, 58, 59, 60, 61, 113, 124, 64, 65, 124,
+ /* 990 */
+ 106, 107, 108, 124, 110, 18, 124, 20, 124, 18,
+ /* 1000 */
+ 19, 20, 79, 124, 23, 24, 124, 30, 124, 32,
+ /* 1010 */
+ 29, 86, 124, 36, 33, 90, 35, 124, 37, 94,
+ /* 1020 */
+ 39, 124, 124, 42, 124, 124, 124, 124, 124, 124,
+ /* 1030 */
+ 124, 106, 107, 108, 124, 110, 124, 124, 57, 58,
+ /* 1040 */
+ 59, 60, 61, 124, 124, 64, 65, 124, 124, 124,
+ /* 1050 */
+ 124, 124, 18, 124, 20, 124, 124, 18, 19, 20,
+ /* 1060 */
+ 79, 124, 23, 24, 30, 86, 32, 124, 29, 90,
+ /* 1070 */
+ 36, 86, 33, 94, 35, 90, 37, 124, 39, 94,
+ /* 1080 */
+ 124, 42, 124, 124, 124, 106, 107, 108, 124, 110,
+ /* 1090 */
+ 124, 106, 107, 108, 124, 110, 57, 58, 59, 60,
+ /* 1100 */
+ 61, 124, 124, 64, 65, 124, 124, 124, 124, 124,
+ /* 1110 */
+ 124, 124, 124, 124, 124, 18, 19, 20, 79, 124,
+ /* 1120 */
+ 23, 24, 124, 124, 124, 124, 29, 86, 124, 124,
+ /* 1130 */
+ 33, 90, 35, 124, 37, 94, 39, 124, 124, 42,
+ /* 1140 */
+ 124, 124, 124, 124, 124, 124, 124, 106, 107, 108,
+ /* 1150 */
+ 124, 110, 124, 124, 57, 58, 59, 60, 61, 124,
+ /* 1160 */
+ 124, 64, 65, 124, 124, 124, 124, 124, 124, 124,
+ /* 1170 */
+ 124, 124, 124, 18, 19, 20, 79, 124, 23, 24,
+ /* 1180 */
+ 124, 124, 124, 124, 29, 86, 124, 124, 33, 90,
+ /* 1190 */
+ 35, 124, 37, 94, 39, 124, 124, 42, 124, 124,
+ /* 1200 */
+ 124, 124, 124, 124, 124, 106, 107, 108, 124, 110,
+ /* 1210 */
+ 124, 124, 57, 58, 59, 60, 61, 124, 124, 64,
+ /* 1220 */
+ 65, 124, 124, 124, 124, 124, 124, 124, 124, 124,
+ /* 1230 */
+ 124, 18, 19, 20, 79, 124, 23, 24, 124, 124,
+ /* 1240 */
+ 124, 124, 29, 86, 124, 124, 33, 90, 35, 124,
+ /* 1250 */
+ 37, 94, 39, 124, 124, 42, 124, 124, 124, 124,
+ /* 1260 */
+ 124, 124, 124, 106, 107, 108, 124, 110, 124, 124,
+ /* 1270 */
+ 57, 58, 59, 60, 61, 124, 124, 64, 65, 124,
+ /* 1280 */
+ 1, 124, 3, 124, 124, 124, 124, 124, 124, 18,
+ /* 1290 */
+ 19, 20, 79, 124, 23, 24, 124, 124, 124, 124,
+ /* 1300 */
+ 29, 22, 124, 124, 33, 124, 35, 124, 37, 30,
+ /* 1310 */
+ 39, 91, 92, 42, 124, 36, 124, 124, 39, 124,
+ /* 1320 */
+ 124, 101, 124, 124, 104, 105, 124, 124, 57, 58,
+ /* 1330 */
+ 59, 60, 61, 124, 124, 64, 65, 124, 118, 124,
+ /* 1340 */
+ 124, 62, 124, 124, 124, 3, 124, 18, 19, 20,
+ /* 1350 */
+ 79, 124, 23, 24, 124, 124, 124, 124, 29, 124,
+ /* 1360 */
+ 124, 124, 33, 21, 35, 124, 37, 124, 39, 91,
+ /* 1370 */
+ 92, 42, 30, 124, 124, 124, 124, 124, 36, 101,
+ /* 1380 */
+ 124, 39, 104, 105, 124, 124, 57, 58, 59, 60,
+ /* 1390 */
+ 61, 124, 124, 64, 65, 124, 118, 124, 124, 124,
+ /* 1400 */
+ 124, 124, 124, 124, 62, 18, 19, 20, 79, 124,
+ /* 1410 */
+ 23, 24, 124, 124, 124, 124, 29, 124, 124, 124,
+ /* 1420 */
+ 33, 124, 35, 124, 37, 124, 39, 91, 92, 42,
+ /* 1430 */
+ 124, 124, 124, 124, 124, 124, 124, 101, 124, 124,
+ /* 1440 */
+ 104, 105, 124, 124, 57, 58, 59, 60, 61, 124,
+ /* 1450 */
+ 124, 64, 124, 124, 118, 124, 124, 124, 124, 124,
+ /* 1460 */
+ 124, 124, 124, 18, 19, 20, 79, 124, 23, 24,
+ /* 1470 */
+ 124, 124, 124, 124, 29, 124, 124, 124, 33, 124,
+ /* 1480 */
+ 35, 124, 37, 124, 39, 124, 3, 42, 124, 124,
+ /* 1490 */
+ 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
+ /* 1500 */
+ 124, 124, 57, 58, 59, 60, 61, 124, 25, 64,
+ /* 1510 */
+ 27, 28, 124, 30, 31, 124, 124, 124, 124, 36,
+ /* 1520 */
+ 124, 38, 39, 40, 79, 124, 124, 124, 124, 124,
+ /* 1530 */
+ 124, 124, 124, 124, 124, 86, 124, 124, 55, 90,
+ /* 1540 */
+ 124, 124, 93, 94, 124, 62, 124, 124, 124, 66,
+ /* 1550 */
+ 124, 102, 103, 124, 124, 106, 107, 108, 124, 110,
+ /* 1560 */
+ 124, 124, 124, 80, 124, 124, 124, 86, 124, 120,
+ /* 1570 */
+ 121, 90, 124, 124, 93, 94, 124, 124, 124, 124,
+ /* 1580 */
+ 124, 124, 124, 102, 103, 124, 124, 106, 107, 108,
+ /* 1590 */
+ 86, 110, 124, 124, 90, 124, 124, 93, 94, 95,
+ /* 1600 */
+ 124, 86, 121, 124, 124, 90, 102, 103, 93, 94,
+ /* 1610 */
+ 106, 107, 108, 124, 110, 124, 124, 102, 103, 124,
+ /* 1620 */
+ 124, 106, 107, 108, 124, 110, 86, 124, 124, 124,
+ /* 1630 */
+ 90, 124, 117, 93, 94, 124, 124, 124, 124, 124,
+ /* 1640 */
+ 124, 124, 102, 103, 124, 124, 106, 107, 108, 124,
+ /* 1650 */
+ 110, 124, 124, 124, 86, 91, 92, 117, 90, 124,
+ /* 1660 */
+ 124, 93, 94, 95, 124, 101, 124, 124, 104, 105,
+ /* 1670 */
+ 102, 103, 124, 124, 106, 107, 108, 86, 110, 124,
+ /* 1680 */
+ 124, 90, 118, 124, 93, 94, 124, 124, 124, 124,
+ /* 1690 */
+ 124, 124, 124, 102, 103, 124, 86, 106, 107, 108,
+ /* 1700 */
+ 90, 110, 124, 93, 94, 124, 124, 124, 117, 124,
+ /* 1710 */
+ 124, 124, 102, 103, 124, 124, 106, 107, 108, 86,
+ /* 1720 */
+ 110, 124, 124, 90, 124, 124, 93, 94, 124, 124,
+ /* 1730 */
+ 86, 124, 124, 124, 90, 102, 103, 93, 94, 106,
+ /* 1740 */
+ 107, 108, 124, 110, 124, 124, 102, 103, 124, 86,
+ /* 1750 */
+ 106, 107, 108, 90, 110, 124, 93, 94, 124, 124,
+ /* 1760 */
+ 124, 124, 124, 124, 124, 102, 103, 124, 86, 106,
+ /* 1770 */
+ 107, 108, 90, 110, 124, 93, 94, 124, 124, 124,
+ /* 1780 */
+ 124, 124, 124, 124, 102, 103, 124, 86, 106, 107,
+ /* 1790 */
+ 108, 90, 110, 124, 93, 94, 124, 124, 124, 124,
+ /* 1800 */
+ 124, 124, 124, 102, 103, 124, 86, 106, 107, 108,
+ /* 1810 */
+ 90, 110, 124, 93, 94, 124, 124, 86, 124, 124,
+ /* 1820 */
+ 124, 90, 102, 103, 93, 94, 106, 107, 108, 124,
+ /* 1830 */
+ 110, 124, 124, 102, 103, 124, 86, 106, 107, 108,
+ /* 1840 */
+ 90, 110, 124, 93, 94, 124, 124, 124, 124, 124,
+ /* 1850 */
+ 124, 124, 102, 103, 124, 86, 106, 107, 108, 90,
+ /* 1860 */
+ 110, 124, 93, 94, 124, 124, 124, 124, 124, 124,
+ /* 1870 */
+ 124, 102, 103, 124, 86, 106, 107, 108, 90, 110,
+ /* 1880 */
+ 124, 93, 94, 124, 124, 124, 124, 124, 124, 124,
+ /* 1890 */
+ 102, 103, 124, 86, 106, 107, 108, 90, 110, 124,
+ /* 1900 */
+ 93, 94, 124, 124, 86, 124, 124, 124, 90, 102,
+ /* 1910 */
+ 103, 93, 94, 106, 107, 108, 124, 110, 124, 124,
+ /* 1920 */
+ 102, 103, 11, 124, 106, 107, 108, 124, 110, 18,
+ /* 1930 */
+ 124, 124, 124, 124, 23, 24, 124, 124, 124, 124,
+ /* 1940 */
+ 29, 124, 124, 86, 33, 124, 35, 90, 124, 124,
+ /* 1950 */
+ 93, 94, 124, 124, 124, 124, 124, 124, 124, 102,
+ /* 1960 */
+ 103, 124, 86, 106, 107, 108, 90, 110, 124, 93,
+ /* 1970 */
+ 94, 124, 124, 124, 124, 124, 124, 124, 102, 103,
+ /* 1980 */
+ 124, 86, 106, 107, 108, 90, 110, 124, 93, 94,
+ /* 1990 */
+ 79, 80, 81, 124, 124, 124, 124, 102, 103, 124,
+ /* 2000 */
+ 86, 106, 107, 108, 90, 110, 124, 93, 94, 124,
+ /* 2010 */
+ 124, 86, 124, 124, 124, 90, 102, 103, 93, 94,
+ /* 2020 */
+ 106, 107, 108, 124, 110, 124, 124, 102, 103, 124,
+ /* 2030 */
+ 86, 106, 107, 108, 90, 110, 124, 93, 94, 124,
+ /* 2040 */
+ 124, 124, 124, 124, 124, 124, 102, 103, 124, 11,
+ /* 2050 */
+ 106, 107, 108, 124, 110, 124, 18, 124, 124, 124,
+ /* 2060 */
+ 124, 23, 24, 124, 124, 124, 124, 29, 86, 124,
+ /* 2070 */
+ 124, 33, 90, 35, 124, 93, 94, 124, 124, 86,
+ /* 2080 */
+ 124, 124, 124, 90, 102, 103, 93, 94, 106, 107,
+ /* 2090 */
+ 108, 124, 110, 124, 124, 102, 103, 124, 124, 106,
+ /* 2100 */
+ 107, 108, 124, 110, 86, 124, 124, 124, 90, 124,
+ /* 2110 */
+ 124, 93, 94, 124, 124, 124, 124, 79, 80, 81,
+ /* 2120 */
+ 102, 103, 124, 124, 106, 107, 108, 124, 110, 124,
+ /* 2130 */
+ 124, 124, 124, 86, 124, 124, 124, 90, 124, 124,
+ /* 2140 */
+ 93, 94, 124, 124, 124, 124, 91, 92, 124, 102,
+ /* 2150 */
+ 103, 124, 124, 106, 107, 108, 101, 110, 86, 104,
+ /* 2160 */
+ 105, 124, 90, 124, 124, 93, 94, 124, 124, 124,
+ /* 2170 */
+ 124, 124, 124, 118, 102, 103, 124, 86, 106, 107,
+ /* 2180 */
+ 108, 90, 110, 124, 93, 94, 124, 124, 86, 124,
+ /* 2190 */
+ 124, 124, 90, 102, 103, 93, 94, 106, 107, 108,
+ /* 2200 */
+ 124, 110, 124, 124, 102, 103, 124, 86, 106, 107,
+ /* 2210 */
+ 108, 90, 110, 124, 93, 94, 124, 124, 124, 124,
+ /* 2220 */
+ 91, 92, 124, 102, 103, 124, 124, 106, 107, 108,
+ /* 2230 */
+ 101, 110, 124, 104, 105, 124, 86, 124, 124, 124,
+ /* 2240 */
+ 90, 124, 124, 93, 94, 124, 124, 118, 124, 124,
+ /* 2250 */
+ 124, 124, 102, 103, 124, 124, 106, 107, 108, 124,
+ /* 2260 */
+ 110, 86, 124, 124, 124, 90, 124, 124, 93, 94,
+ /* 2270 */
+ 124, 124, 86, 124, 124, 124, 90, 102, 103, 93,
+ /* 2280 */
+ 94, 106, 107, 108, 124, 110, 124, 124, 102, 103,
+ /* 2290 */
+ 124, 86, 106, 107, 108, 90, 110, 124, 93, 94,
+ /* 2300 */
+ 124, 124, 86, 124, 124, 124, 90, 102, 103, 93,
+ /* 2310 */
+ 94, 106, 107, 108, 124, 110, 124, 124, 102, 103,
+ /* 2320 */
+ 124, 124, 106, 107, 108, 124, 110, 86, 124, 124,
+ /* 2330 */
+ 124, 90, 124, 124, 93, 94, 124, 124, 124, 124,
+ /* 2340 */
+ 124, 124, 124, 102, 103, 124, 124, 106, 107, 108,
+ /* 2350 */
+ 124, 110, 86, 124, 124, 124, 90, 124, 124, 93,
+ /* 2360 */
+ 94, 124, 124, 86, 124, 124, 124, 90, 102, 103,
+ /* 2370 */
+ 93, 94, 106, 107, 108, 124, 110, 124, 124, 102,
+ /* 2380 */
+ 103, 124, 86, 106, 107, 108, 90, 110, 124, 93,
+ /* 2390 */
+ 94, 124, 124, 124, 124, 124, 124, 124, 102, 103,
+ /* 2400 */
+ 124, 124, 106, 107, 108, 124, 110,
+ );
+ const YY_SHIFT_USE_DFLT = - 53;
+ const YY_SHIFT_MAX = 259;
static public $yy_shift_ofst = array(
- /* 0 */ -2, 1385, 1385, 1328, 1157, 1328, 1157, 1157, 1100, 1157,
- /* 10 */ 1157, 1157, 1157, 1157, 1157, 1556, 1157, 1157, 1157, 1157,
- /* 20 */ 1556, 1157, 1157, 1157, 1157, 1157, 1157, 1157, 1157, 1157,
- /* 30 */ 1157, 1157, 1442, 1157, 1157, 1499, 1157, 1157, 1214, 1157,
- /* 40 */ 1157, 1157, 1157, 1442, 1271, 1271, 1670, 1613, 1670, 1670,
- /* 50 */ 1670, 1670, 1670, 206, 129, 52, -1, 259, 259, 259,
- /* 60 */ 833, 886, 939, 780, 650, 390, 336, 467, 703, 520,
- /* 70 */ 573, 992, 992, 992, 992, 992, 992, 992, 992, 992,
- /* 80 */ 992, 992, 992, 992, 992, 992, 992, 992, 992, 992,
- /* 90 */ 1033, 1033, 1841, 784, 288, -2, 338, 125, 463, 209,
- /* 100 */ 333, 209, 333, 327, 288, 267, 288, 334, 509, 1745,
- /* 110 */ 102, 132, 470, 653, 70, 245, 479, 212, 204, 3,
- /* 120 */ 174, 217, 277, 122, 432, 537, 432, 509, 510, 432,
- /* 130 */ 432, 382, 668, 506, 432, 432, 531, 563, 432, 382,
- /* 140 */ 527, 432, 510, 509, 571, 432, 392, 691, 704, 704,
- /* 150 */ 704, 704, 704, 704, 704, 691, 704, -3, 1341, 1381,
- /* 160 */ 1284, 1267, 66, 1108, 1152, 1165, 1210, 536, 1438, 1398,
- /* 170 */ 1495, 1512, 466, 777, 0, 128, 781, 1324, 1455, 1227,
- /* 180 */ 471, 358, 150, 150, 339, 150, 150, 21, 150, 718,
- /* 190 */ 691, 691, 625, 704, 704, 709, 691, 709, 4, 4,
- /* 200 */ -3, -3, -3, -3, -3, 1727, 202, 75, 44, 361,
- /* 210 */ 223, 1, 225, 91, 76, 371, 395, 410, 76, 256,
- /* 220 */ 305, 560, 625, 617, 619, 598, 597, 576, 349, 630,
- /* 230 */ 637, 639, 666, 682, 661, 643, 644, 613, 591, 528,
- /* 240 */ 565, 486, 484, 407, 436, 582, 566, 564, 609, 547,
- /* 250 */ 554, 588, 545,
-);
- const YY_REDUCE_USE_DFLT = -102;
- const YY_REDUCE_MAX = 204;
+ /* 0 */
+ - 3, 1213, 981, 1155, 1213, 1155, 981, 981, 923, 923,
+ /* 10 */
+ 865, 981, 981, 1097, 981, 981, 981, 981, 981, 981,
+ /* 20 */
+ 981, 1329, 981, 981, 981, 981, 1271, 981, 981, 981,
+ /* 30 */
+ 1097, 981, 981, 981, 981, 981, 981, 981, 981, 981,
+ /* 40 */
+ 981, 981, 981, 981, 1039, 1039, 1387, 1387, 1445, 1387,
+ /* 50 */
+ 1387, 1387, 1387, - 1, 53, 107, 107, 107, 107, 107,
+ /* 60 */
+ 485, 431, 593, 647, 701, 323, 161, 215, 377, 269,
+ /* 70 */
+ 539, 755, 755, 755, 755, 755, 755, 755, 755, 755,
+ /* 80 */
+ 755, 755, 755, 755, 755, 755, 755, 755, 755, 755,
+ /* 90 */
+ 797, 797, 1279, 110, 297, - 3, 2038, 977, 1034, 191,
+ /* 100 */
+ - 2, 191, - 2, 297, 297, 798, 340, 354, 367, 1911,
+ /* 110 */
+ 181, 54, 57, 163, 199, 285, 19, 151, 167, 70,
+ /* 120 */
+ 78, 381, 367, 543, 363, - 17, 375, 365, 363, 246,
+ /* 130 */
+ 363, 395, 392, - 17, 363, 363, 363, 367, 363, 445,
+ /* 140 */
+ 413, 363, 395, 363, 474, 365, 574, 204, 204, 574,
+ /* 150 */
+ 574, 574, 574, 574, 574, 574, 574, - 53, 255, 233,
+ /* 160 */
+ - 17, - 27, - 29, - 17, - 17, - 17, - 29, - 17, - 29, - 27,
+ /* 170 */
+ - 17, - 17, - 17, - 29, - 17, - 17, - 29, - 17, - 17, - 17,
+ /* 180 */
+ - 17, - 17, - 17, - 17, - 17, - 17, - 29, - 29, - 17, 343,
+ /* 190 */
+ 574, 574, 574, 596, 596, 574, 574, 204, 572, 572,
+ /* 200 */
+ 204, 341, 204, 370, - 53, - 53, - 53, - 53, - 53, 1483,
+ /* 210 */
+ 1342, 98, 76, 210, 435, 212, 328, 299, 81, 287,
+ /* 220 */
+ 472, 294, 217, 290, 292, 292, 370, 511, 455, 505,
+ /* 230 */
+ 520, 528, 478, 481, 541, 527, 446, 15, 114, - 14,
+ /* 240 */
+ 533, 130, 493, 497, 503, 523, 512, 525, 549, 551,
+ /* 250 */
+ 507, 526, 530, 516, 571, 137, 119, - 52, 69, 171,
+ );
+ const YY_REDUCE_USE_DFLT = - 73;
+ const YY_REDUCE_MAX = 208;
static public $yy_reduce_ofst = array(
- /* 0 */ -28, 46, 1709, 123, 567, 384, 1630, 698, 1961, 1934,
- /* 10 */ 1923, 1875, 1898, 1984, 2009, 2106, 2095, 2070, 2020, 2047,
- /* 20 */ 1848, 1837, 1402, 1345, 1288, 1174, 1231, 1459, 1516, 1812,
- /* 30 */ 1789, 1758, 1573, 1747, 2156, 2133, 2305, 2267, 2181, 2192,
- /* 40 */ 1117, 2219, 2242, 2278, 1042, 1728, 258, 1061, 572, 2076,
- /* 50 */ 1990, 1904, 1818, 1680, 1871, 1705, 2313, 2335, 2328, 1680,
- /* 60 */ -26, -26, -26, -26, -26, -26, -26, -26, -26, -26,
- /* 70 */ -26, -26, -26, -26, -26, -26, -26, -26, -26, -26,
- /* 80 */ -26, -26, -26, -26, -26, -26, -26, -26, -26, -26,
- /* 90 */ -26, -26, 224, 94, 196, 236, 273, 1149, 1062, 406,
- /* 100 */ -76, 353, 575, 264, 328, 201, 329, 78, 330, 646,
- /* 110 */ 517, -29, -29, -29, 342, 616, 385, -29, 68, 342,
- /* 120 */ 342, -29, 74, 74, 618, 433, 574, 457, 515, 541,
- /* 130 */ 433, 112, 74, 433, 434, 487, 459, 699, 468, 366,
- /* 140 */ -29, 696, 433, 464, 511, 645, -73, -101, -29, -29,
- /* 150 */ -29, -29, -29, -29, -29, 74, -29, -29, 606, 606,
- /* 160 */ 606, 606, 620, 606, 606, 606, 606, 596, 606, 606,
- /* 170 */ 606, 606, 606, 606, 606, 606, 606, 606, 606, 606,
- /* 180 */ 592, 592, 599, 599, 592, 599, 599, 603, 599, 647,
- /* 190 */ 622, 622, 623, 592, 592, -6, 622, -6, -13, 220,
- /* 200 */ 251, 240, 182, 146, 157,
-);
+ /* 0 */
+ - 22, 1449, 1540, 1504, 1481, 1568, 1515, 1591, 1925, 2072,
+ /* 10 */
+ 1750, 1818, 1895, 1644, 1663, 1914, 2205, 2277, 1876, 1731,
+ /* 20 */
+ 1857, 1633, 1701, 2186, 2150, 2296, 2266, 2091, 2047, 1993,
+ /* 30 */
+ 2241, 2102, 1720, 1788, 1982, 1769, 1807, 1610, 1682, 2175,
+ /* 40 */
+ 2216, 2121, 1944, 2018, 805, 869, 884, 979, 925, 985,
+ /* 50 */
+ 1041, 1157, 1099, 1220, 1336, 2129, 1278, 1336, 1564, 2055,
+ /* 60 */
+ 190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
+ /* 70 */
+ 190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
+ /* 80 */
+ 190, 190, 190, 190, 190, 190, 190, 190, 190, 190,
+ /* 90 */
+ 190, 190, 261, 208, 153, 193, 154, 827, 826, 369,
+ /* 100 */
+ 804, 315, 872, 316, 424, - 34, 839, 82, - 72, 372,
+ /* 110 */
+ 349, - 32, - 32, - 32, 559, 351, 351, 351, - 32, 30,
+ /* 120 */
+ - 32, 30, 345, 30, 453, 420, 368, 242, 344, - 32,
+ /* 130 */
+ 276, 561, 451, 419, 506, 615, 668, 396, 613, 615,
+ /* 140 */
+ 350, 614, 615, 667, 615, 139, - 32, 30, 109, - 32,
+ /* 150 */
+ - 32, - 32, - 32, - 32, - 32, - 32, 23, - 32, 462, 482,
+ /* 160 */
+ 473, 466, 464, 473, 473, 473, 464, 473, 464, 468,
+ /* 170 */
+ 473, 473, 473, 464, 473, 473, 464, 473, 473, 473,
+ /* 180 */
+ 473, 473, 473, 473, 473, 473, 464, 464, 473, 489,
+ /* 190 */
+ 479, 479, 479, 480, 480, 479, 479, 189, 504, 499,
+ /* 200 */
+ 189, 241, 189, 348, 356, 393, 389, 95, 385,
+ );
static public $yyExpectedTokens = array(
- /* 0 */ array(3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16, 22, 23, 28, 32, 33, 34, ),
- /* 1 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 2 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 3 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 4 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 5 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 6 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 7 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 8 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 65, 78, ),
- /* 9 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 10 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 11 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 12 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 13 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 14 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 15 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 16 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 17 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 18 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 19 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 20 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 21 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 22 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 23 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 24 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 25 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 26 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 27 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 28 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 29 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 30 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 31 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 32 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 33 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 34 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 35 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 36 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 37 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 38 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 39 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 40 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 41 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 42 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 43 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 44 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 45 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 64, 78, ),
- /* 46 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 78, ),
- /* 47 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 78, ),
- /* 48 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 78, ),
- /* 49 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 78, ),
- /* 50 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 78, ),
- /* 51 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 78, ),
- /* 52 */ array(16, 18, 19, 22, 23, 28, 32, 33, 34, 36, 38, 41, 56, 57, 58, 59, 60, 63, 78, ),
- /* 53 */ array(1, 17, 29, 35, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),
- /* 54 */ array(1, 17, 29, 35, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),
- /* 55 */ array(1, 27, 29, 35, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),
- /* 56 */ array(1, 17, 29, 35, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),
- /* 57 */ array(1, 29, 35, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),
- /* 58 */ array(1, 29, 35, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),
- /* 59 */ array(1, 29, 35, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),
- /* 60 */ array(1, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),
- /* 61 */ array(1, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),
- /* 62 */ array(1, 30, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),
- /* 63 */ array(1, 17, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),
- /* 64 */ array(1, 17, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),
- /* 65 */ array(1, 24, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),
- /* 66 */ array(1, 17, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),
- /* 67 */ array(1, 17, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),
- /* 68 */ array(1, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 79, ),
- /* 69 */ array(1, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),
- /* 70 */ array(1, 2, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),
- /* 71 */ array(1, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),
- /* 72 */ array(1, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),
- /* 73 */ array(1, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),
- /* 74 */ array(1, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),
- /* 75 */ array(1, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),
- /* 76 */ array(1, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),
- /* 77 */ array(1, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),
- /* 78 */ array(1, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),
- /* 79 */ array(1, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),
- /* 80 */ array(1, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),
- /* 81 */ array(1, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),
- /* 82 */ array(1, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),
- /* 83 */ array(1, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),
- /* 84 */ array(1, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),
- /* 85 */ array(1, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),
- /* 86 */ array(1, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),
- /* 87 */ array(1, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),
- /* 88 */ array(1, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),
- /* 89 */ array(1, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),
- /* 90 */ array(40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),
- /* 91 */ array(40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, ),
- /* 92 */ array(1, 17, 21, 29, 35, 38, 61, ),
- /* 93 */ array(1, 17, 29, 35, 54, ),
- /* 94 */ array(1, 29, 35, ),
- /* 95 */ array(3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 16, 22, 23, 28, 32, 33, 34, ),
- /* 96 */ array(10, 16, 22, 23, 28, 32, 33, 34, 78, 79, 80, ),
- /* 97 */ array(16, 19, 29, 31, 35, ),
- /* 98 */ array(16, 19, 29, 31, 35, ),
- /* 99 */ array(1, 17, 29, 35, ),
- /* 100 */ array(16, 19, 29, 35, ),
- /* 101 */ array(1, 17, 29, 35, ),
- /* 102 */ array(16, 19, 29, 35, ),
- /* 103 */ array(18, 19, 63, ),
- /* 104 */ array(1, 29, 35, ),
- /* 105 */ array(1, 2, 17, ),
- /* 106 */ array(1, 29, 35, ),
- /* 107 */ array(21, 59, 64, ),
- /* 108 */ array(18, 38, ),
- /* 109 */ array(10, 16, 22, 23, 28, 32, 33, 34, 78, 79, 80, ),
- /* 110 */ array(4, 5, 6, 7, 8, 13, 14, 15, ),
- /* 111 */ array(1, 17, 29, 30, 35, 54, ),
- /* 112 */ array(1, 17, 29, 35, 54, ),
- /* 113 */ array(1, 17, 29, 35, 54, ),
- /* 114 */ array(16, 19, 20, 62, ),
- /* 115 */ array(16, 19, 20, 25, ),
- /* 116 */ array(1, 17, 21, ),
- /* 117 */ array(1, 31, 54, ),
- /* 118 */ array(17, 29, 35, ),
- /* 119 */ array(16, 19, 20, ),
- /* 120 */ array(16, 19, 62, ),
- /* 121 */ array(1, 17, 54, ),
- /* 122 */ array(20, 21, 61, ),
- /* 123 */ array(20, 21, 61, ),
- /* 124 */ array(16, 19, ),
- /* 125 */ array(16, 19, ),
- /* 126 */ array(16, 19, ),
- /* 127 */ array(18, 38, ),
- /* 128 */ array(16, 19, ),
- /* 129 */ array(16, 19, ),
- /* 130 */ array(16, 19, ),
- /* 131 */ array(18, 19, ),
- /* 132 */ array(21, 61, ),
- /* 133 */ array(16, 19, ),
- /* 134 */ array(16, 19, ),
- /* 135 */ array(16, 19, ),
- /* 136 */ array(1, 17, ),
- /* 137 */ array(16, 19, ),
- /* 138 */ array(16, 19, ),
- /* 139 */ array(18, 19, ),
- /* 140 */ array(1, 54, ),
- /* 141 */ array(16, 19, ),
- /* 142 */ array(16, 19, ),
- /* 143 */ array(18, 38, ),
- /* 144 */ array(29, 35, ),
- /* 145 */ array(16, 19, ),
- /* 146 */ array(29, 35, ),
- /* 147 */ array(21, ),
- /* 148 */ array(1, ),
- /* 149 */ array(1, ),
- /* 150 */ array(1, ),
- /* 151 */ array(1, ),
- /* 152 */ array(1, ),
- /* 153 */ array(1, ),
- /* 154 */ array(1, ),
- /* 155 */ array(21, ),
- /* 156 */ array(1, ),
- /* 157 */ array(),
- /* 158 */ array(17, 29, 35, ),
- /* 159 */ array(17, 29, 35, ),
- /* 160 */ array(17, 29, 35, ),
- /* 161 */ array(17, 29, 35, ),
- /* 162 */ array(16, 18, 19, ),
- /* 163 */ array(17, 29, 35, ),
- /* 164 */ array(17, 29, 35, ),
- /* 165 */ array(17, 29, 35, ),
- /* 166 */ array(17, 29, 35, ),
- /* 167 */ array(16, 19, 62, ),
- /* 168 */ array(17, 29, 35, ),
- /* 169 */ array(17, 29, 35, ),
- /* 170 */ array(17, 29, 35, ),
- /* 171 */ array(17, 29, 35, ),
- /* 172 */ array(17, 29, 35, ),
- /* 173 */ array(17, 29, 35, ),
- /* 174 */ array(17, 29, 35, ),
- /* 175 */ array(17, 29, 35, ),
- /* 176 */ array(17, 29, 35, ),
- /* 177 */ array(17, 29, 35, ),
- /* 178 */ array(17, 29, 35, ),
- /* 179 */ array(17, 29, 35, ),
- /* 180 */ array(1, 17, ),
- /* 181 */ array(1, 17, ),
- /* 182 */ array(59, 64, ),
- /* 183 */ array(59, 64, ),
- /* 184 */ array(1, 17, ),
- /* 185 */ array(59, 64, ),
- /* 186 */ array(59, 64, ),
- /* 187 */ array(16, 38, ),
- /* 188 */ array(59, 64, ),
- /* 189 */ array(14, ),
- /* 190 */ array(21, ),
- /* 191 */ array(21, ),
- /* 192 */ array(38, ),
- /* 193 */ array(1, ),
- /* 194 */ array(1, ),
- /* 195 */ array(2, ),
- /* 196 */ array(21, ),
- /* 197 */ array(2, ),
- /* 198 */ array(29, ),
- /* 199 */ array(29, ),
- /* 200 */ array(),
- /* 201 */ array(),
- /* 202 */ array(),
- /* 203 */ array(),
- /* 204 */ array(),
- /* 205 */ array(17, 24, 26, 27, 29, 30, 35, 37, 38, 39, 54, 61, 65, 79, ),
- /* 206 */ array(17, 20, 29, 35, 38, 61, ),
- /* 207 */ array(38, 59, 61, 65, ),
- /* 208 */ array(16, 18, 19, 36, ),
- /* 209 */ array(31, 38, 61, ),
- /* 210 */ array(19, 62, ),
- /* 211 */ array(24, 37, ),
- /* 212 */ array(37, 65, ),
- /* 213 */ array(20, 59, ),
- /* 214 */ array(38, 61, ),
- /* 215 */ array(25, 79, ),
- /* 216 */ array(2, 20, ),
- /* 217 */ array(37, 39, ),
- /* 218 */ array(38, 61, ),
- /* 219 */ array(37, 39, ),
- /* 220 */ array(37, 39, ),
- /* 221 */ array(17, 25, ),
- /* 222 */ array(38, ),
- /* 223 */ array(19, ),
- /* 224 */ array(18, ),
- /* 225 */ array(36, ),
- /* 226 */ array(36, ),
- /* 227 */ array(59, ),
- /* 228 */ array(25, ),
- /* 229 */ array(2, ),
- /* 230 */ array(18, ),
- /* 231 */ array(19, ),
- /* 232 */ array(19, ),
- /* 233 */ array(2, ),
- /* 234 */ array(19, ),
- /* 235 */ array(19, ),
- /* 236 */ array(20, ),
- /* 237 */ array(18, ),
- /* 238 */ array(39, ),
- /* 239 */ array(26, ),
- /* 240 */ array(18, ),
- /* 241 */ array(18, ),
- /* 242 */ array(19, ),
- /* 243 */ array(19, ),
- /* 244 */ array(19, ),
- /* 245 */ array(19, ),
- /* 246 */ array(38, ),
- /* 247 */ array(65, ),
- /* 248 */ array(19, ),
- /* 249 */ array(63, ),
- /* 250 */ array(55, ),
- /* 251 */ array(19, ),
- /* 252 */ array(63, ),
- /* 253 */ array(),
- /* 254 */ array(),
- /* 255 */ array(),
- /* 256 */ array(),
- /* 257 */ array(),
- /* 258 */ array(),
- /* 259 */ array(),
- /* 260 */ array(),
- /* 261 */ array(),
- /* 262 */ array(),
- /* 263 */ array(),
- /* 264 */ array(),
- /* 265 */ array(),
- /* 266 */ array(),
- /* 267 */ array(),
- /* 268 */ array(),
- /* 269 */ array(),
- /* 270 */ array(),
- /* 271 */ array(),
- /* 272 */ array(),
- /* 273 */ array(),
- /* 274 */ array(),
- /* 275 */ array(),
- /* 276 */ array(),
- /* 277 */ array(),
- /* 278 */ array(),
- /* 279 */ array(),
- /* 280 */ array(),
- /* 281 */ array(),
- /* 282 */ array(),
- /* 283 */ array(),
- /* 284 */ array(),
- /* 285 */ array(),
- /* 286 */ array(),
- /* 287 */ array(),
- /* 288 */ array(),
- /* 289 */ array(),
- /* 290 */ array(),
- /* 291 */ array(),
- /* 292 */ array(),
- /* 293 */ array(),
- /* 294 */ array(),
- /* 295 */ array(),
- /* 296 */ array(),
- /* 297 */ array(),
- /* 298 */ array(),
- /* 299 */ array(),
- /* 300 */ array(),
- /* 301 */ array(),
- /* 302 */ array(),
- /* 303 */ array(),
- /* 304 */ array(),
- /* 305 */ array(),
- /* 306 */ array(),
- /* 307 */ array(),
- /* 308 */ array(),
- /* 309 */ array(),
- /* 310 */ array(),
- /* 311 */ array(),
- /* 312 */ array(),
- /* 313 */ array(),
- /* 314 */ array(),
- /* 315 */ array(),
- /* 316 */ array(),
- /* 317 */ array(),
- /* 318 */ array(),
- /* 319 */ array(),
- /* 320 */ array(),
- /* 321 */ array(),
- /* 322 */ array(),
- /* 323 */ array(),
- /* 324 */ array(),
- /* 325 */ array(),
- /* 326 */ array(),
- /* 327 */ array(),
- /* 328 */ array(),
- /* 329 */ array(),
- /* 330 */ array(),
- /* 331 */ array(),
- /* 332 */ array(),
- /* 333 */ array(),
- /* 334 */ array(),
- /* 335 */ array(),
- /* 336 */ array(),
- /* 337 */ array(),
- /* 338 */ array(),
- /* 339 */ array(),
- /* 340 */ array(),
- /* 341 */ array(),
- /* 342 */ array(),
- /* 343 */ array(),
- /* 344 */ array(),
- /* 345 */ array(),
- /* 346 */ array(),
- /* 347 */ array(),
- /* 348 */ array(),
- /* 349 */ array(),
- /* 350 */ array(),
- /* 351 */ array(),
- /* 352 */ array(),
- /* 353 */ array(),
- /* 354 */ array(),
- /* 355 */ array(),
- /* 356 */ array(),
- /* 357 */ array(),
- /* 358 */ array(),
- /* 359 */ array(),
- /* 360 */ array(),
- /* 361 */ array(),
- /* 362 */ array(),
- /* 363 */ array(),
- /* 364 */ array(),
- /* 365 */ array(),
- /* 366 */ array(),
- /* 367 */ array(),
- /* 368 */ array(),
- /* 369 */ array(),
- /* 370 */ array(),
- /* 371 */ array(),
- /* 372 */ array(),
- /* 373 */ array(),
- /* 374 */ array(),
- /* 375 */ array(),
- /* 376 */ array(),
- /* 377 */ array(),
- /* 378 */ array(),
- /* 379 */ array(),
- /* 380 */ array(),
- /* 381 */ array(),
- /* 382 */ array(),
- /* 383 */ array(),
- /* 384 */ array(),
- /* 385 */ array(),
- /* 386 */ array(),
- /* 387 */ array(),
- /* 388 */ array(),
-);
+ /* 0 */
+ array(4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 18, 23, 24, 29, 33, 35,),
+ /* 1 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 2 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 3 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 4 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 5 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 6 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 7 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 8 */
+ array(18, 19, 20, 23, 24, 29, 33, 34, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 9 */
+ array(18, 19, 20, 23, 24, 29, 33, 34, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 10 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 66, 79,),
+ /* 11 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 12 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 13 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 14 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 15 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 16 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 17 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 18 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 19 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 20 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 21 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 22 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 23 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 24 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 25 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 26 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 27 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 28 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 29 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 30 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 31 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 32 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 33 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 34 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 35 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 36 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 37 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 38 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 39 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 40 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 41 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 42 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 43 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 44 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 45 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 65, 79,),
+ /* 46 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 79,),
+ /* 47 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 79,),
+ /* 48 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 79,),
+ /* 49 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 79,),
+ /* 50 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 79,),
+ /* 51 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 79,),
+ /* 52 */
+ array(18, 19, 20, 23, 24, 29, 33, 35, 37, 39, 42, 57, 58, 59, 60, 61, 64, 79,),
+ /* 53 */
+ array(1, 28, 30, 36, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,),
+ /* 54 */
+ array(1, 3, 30, 36, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,),
+ /* 55 */
+ array(1, 30, 36, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,),
+ /* 56 */
+ array(1, 30, 36, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,),
+ /* 57 */
+ array(1, 30, 36, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,),
+ /* 58 */
+ array(1, 30, 36, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,),
+ /* 59 */
+ array(1, 30, 36, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,),
+ /* 60 */
+ array(1, 3, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,),
+ /* 61 */
+ array(1, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,),
+ /* 62 */
+ array(1, 25, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,),
+ /* 63 */
+ array(1, 3, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,),
+ /* 64 */
+ array(1, 3, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,),
+ /* 65 */
+ array(1, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,),
+ /* 66 */
+ array(1, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 80,),
+ /* 67 */
+ array(1, 31, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,),
+ /* 68 */
+ array(1, 3, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,),
+ /* 69 */
+ array(1, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,),
+ /* 70 */
+ array(1, 2, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,),
+ /* 71 */
+ array(1, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,),
+ /* 72 */
+ array(1, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,),
+ /* 73 */
+ array(1, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,),
+ /* 74 */
+ array(1, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,),
+ /* 75 */
+ array(1, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,),
+ /* 76 */
+ array(1, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,),
+ /* 77 */
+ array(1, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,),
+ /* 78 */
+ array(1, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,),
+ /* 79 */
+ array(1, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,),
+ /* 80 */
+ array(1, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,),
+ /* 81 */
+ array(1, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,),
+ /* 82 */
+ array(1, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,),
+ /* 83 */
+ array(1, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,),
+ /* 84 */
+ array(1, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,),
+ /* 85 */
+ array(1, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,),
+ /* 86 */
+ array(1, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,),
+ /* 87 */
+ array(1, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,),
+ /* 88 */
+ array(1, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,),
+ /* 89 */
+ array(1, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,),
+ /* 90 */
+ array(41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,),
+ /* 91 */
+ array(41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78,),
+ /* 92 */
+ array(1, 3, 22, 30, 36, 39, 62,),
+ /* 93 */
+ array(1, 3, 30, 36, 55,),
+ /* 94 */
+ array(1, 30, 36,),
+ /* 95 */
+ array(4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 18, 23, 24, 29, 33, 35,),
+ /* 96 */
+ array(11, 18, 23, 24, 29, 33, 35, 79, 80, 81,),
+ /* 97 */
+ array(18, 20, 30, 32, 36,),
+ /* 98 */
+ array(18, 20, 30, 32, 36,),
+ /* 99 */
+ array(1, 3, 30, 36,),
+ /* 100 */
+ array(18, 20, 30, 36,),
+ /* 101 */
+ array(1, 3, 30, 36,),
+ /* 102 */
+ array(18, 20, 30, 36,),
+ /* 103 */
+ array(1, 30, 36,),
+ /* 104 */
+ array(1, 30, 36,),
+ /* 105 */
+ array(22, 60, 65,),
+ /* 106 */
+ array(19, 20, 64,),
+ /* 107 */
+ array(1, 2,),
+ /* 108 */
+ array(19, 39,),
+ /* 109 */
+ array(11, 18, 23, 24, 29, 33, 35, 79, 80, 81,),
+ /* 110 */
+ array(5, 6, 7, 8, 9, 15, 16, 17,),
+ /* 111 */
+ array(1, 3, 30, 31, 36, 55,),
+ /* 112 */
+ array(1, 3, 30, 36, 55,),
+ /* 113 */
+ array(1, 3, 30, 36, 55,),
+ /* 114 */
+ array(18, 20, 21, 26,),
+ /* 115 */
+ array(18, 20, 21, 63,),
+ /* 116 */
+ array(18, 20, 63,),
+ /* 117 */
+ array(18, 20, 21,),
+ /* 118 */
+ array(1, 3, 55,),
+ /* 119 */
+ array(21, 22, 62,),
+ /* 120 */
+ array(1, 32, 55,),
+ /* 121 */
+ array(21, 22, 62,),
+ /* 122 */
+ array(19, 39,),
+ /* 123 */
+ array(22, 62,),
+ /* 124 */
+ array(18, 20,),
+ /* 125 */
+ array(30, 36,),
+ /* 126 */
+ array(30, 36,),
+ /* 127 */
+ array(19, 20,),
+ /* 128 */
+ array(18, 20,),
+ /* 129 */
+ array(1, 55,),
+ /* 130 */
+ array(18, 20,),
+ /* 131 */
+ array(18, 20,),
+ /* 132 */
+ array(18, 20,),
+ /* 133 */
+ array(30, 36,),
+ /* 134 */
+ array(18, 20,),
+ /* 135 */
+ array(18, 20,),
+ /* 136 */
+ array(18, 20,),
+ /* 137 */
+ array(19, 39,),
+ /* 138 */
+ array(18, 20,),
+ /* 139 */
+ array(18, 20,),
+ /* 140 */
+ array(1, 22,),
+ /* 141 */
+ array(18, 20,),
+ /* 142 */
+ array(18, 20,),
+ /* 143 */
+ array(18, 20,),
+ /* 144 */
+ array(18, 20,),
+ /* 145 */
+ array(19, 20,),
+ /* 146 */
+ array(1,),
+ /* 147 */
+ array(22,),
+ /* 148 */
+ array(22,),
+ /* 149 */
+ array(1,),
+ /* 150 */
+ array(1,),
+ /* 151 */
+ array(1,),
+ /* 152 */
+ array(1,),
+ /* 153 */
+ array(1,),
+ /* 154 */
+ array(1,),
+ /* 155 */
+ array(1,),
+ /* 156 */
+ array(1,),
+ /* 157 */
+ array(),
+ /* 158 */
+ array(18, 19, 20,),
+ /* 159 */
+ array(18, 20, 63,),
+ /* 160 */
+ array(30, 36,),
+ /* 161 */
+ array(60, 65,),
+ /* 162 */
+ array(60, 65,),
+ /* 163 */
+ array(30, 36,),
+ /* 164 */
+ array(30, 36,),
+ /* 165 */
+ array(30, 36,),
+ /* 166 */
+ array(60, 65,),
+ /* 167 */
+ array(30, 36,),
+ /* 168 */
+ array(60, 65,),
+ /* 169 */
+ array(60, 65,),
+ /* 170 */
+ array(30, 36,),
+ /* 171 */
+ array(30, 36,),
+ /* 172 */
+ array(30, 36,),
+ /* 173 */
+ array(60, 65,),
+ /* 174 */
+ array(30, 36,),
+ /* 175 */
+ array(30, 36,),
+ /* 176 */
+ array(60, 65,),
+ /* 177 */
+ array(30, 36,),
+ /* 178 */
+ array(30, 36,),
+ /* 179 */
+ array(30, 36,),
+ /* 180 */
+ array(30, 36,),
+ /* 181 */
+ array(30, 36,),
+ /* 182 */
+ array(30, 36,),
+ /* 183 */
+ array(30, 36,),
+ /* 184 */
+ array(30, 36,),
+ /* 185 */
+ array(30, 36,),
+ /* 186 */
+ array(60, 65,),
+ /* 187 */
+ array(60, 65,),
+ /* 188 */
+ array(30, 36,),
+ /* 189 */
+ array(18, 39,),
+ /* 190 */
+ array(1,),
+ /* 191 */
+ array(1,),
+ /* 192 */
+ array(1,),
+ /* 193 */
+ array(2,),
+ /* 194 */
+ array(2,),
+ /* 195 */
+ array(1,),
+ /* 196 */
+ array(1,),
+ /* 197 */
+ array(22,),
+ /* 198 */
+ array(30,),
+ /* 199 */
+ array(30,),
+ /* 200 */
+ array(22,),
+ /* 201 */
+ array(16,),
+ /* 202 */
+ array(22,),
+ /* 203 */
+ array(39,),
+ /* 204 */
+ array(),
+ /* 205 */
+ array(),
+ /* 206 */
+ array(),
+ /* 207 */
+ array(),
+ /* 208 */
+ array(),
+ /* 209 */
+ array(3, 25, 27, 28, 30, 31, 36, 38, 39, 40, 55, 62, 66, 80,),
+ /* 210 */
+ array(3, 21, 30, 36, 39, 62,),
+ /* 211 */
+ array(18, 19, 20, 37,),
+ /* 212 */
+ array(39, 60, 62, 66,),
+ /* 213 */
+ array(32, 39, 62,),
+ /* 214 */
+ array(2, 21,),
+ /* 215 */
+ array(38, 40,),
+ /* 216 */
+ array(21, 60,),
+ /* 217 */
+ array(3, 26,),
+ /* 218 */
+ array(38, 66,),
+ /* 219 */
+ array(20, 63,),
+ /* 220 */
+ array(25, 38,),
+ /* 221 */
+ array(38, 40,),
+ /* 222 */
+ array(26, 80,),
+ /* 223 */
+ array(38, 40,),
+ /* 224 */
+ array(39, 62,),
+ /* 225 */
+ array(39, 62,),
+ /* 226 */
+ array(39,),
+ /* 227 */
+ array(3,),
+ /* 228 */
+ array(64,),
+ /* 229 */
+ array(19,),
+ /* 230 */
+ array(3,),
+ /* 231 */
+ array(19,),
+ /* 232 */
+ array(40,),
+ /* 233 */
+ array(64,),
+ /* 234 */
+ array(27,),
+ /* 235 */
+ array(21,),
+ /* 236 */
+ array(20,),
+ /* 237 */
+ array(2,),
+ /* 238 */
+ array(20,),
+ /* 239 */
+ array(39,),
+ /* 240 */
+ array(37,),
+ /* 241 */
+ array(37,),
+ /* 242 */
+ array(20,),
+ /* 243 */
+ array(20,),
+ /* 244 */
+ array(19,),
+ /* 245 */
+ array(20,),
+ /* 246 */
+ array(3,),
+ /* 247 */
+ array(19,),
+ /* 248 */
+ array(20,),
+ /* 249 */
+ array(20,),
+ /* 250 */
+ array(60,),
+ /* 251 */
+ array(20,),
+ /* 252 */
+ array(20,),
+ /* 253 */
+ array(56,),
+ /* 254 */
+ array(2,),
+ /* 255 */
+ array(26,),
+ /* 256 */
+ array(20,),
+ /* 257 */
+ array(66,),
+ /* 258 */
+ array(19,),
+ /* 259 */
+ array(20,),
+ /* 260 */
+ array(),
+ /* 261 */
+ array(),
+ /* 262 */
+ array(),
+ /* 263 */
+ array(),
+ /* 264 */
+ array(),
+ /* 265 */
+ array(),
+ /* 266 */
+ array(),
+ /* 267 */
+ array(),
+ /* 268 */
+ array(),
+ /* 269 */
+ array(),
+ /* 270 */
+ array(),
+ /* 271 */
+ array(),
+ /* 272 */
+ array(),
+ /* 273 */
+ array(),
+ /* 274 */
+ array(),
+ /* 275 */
+ array(),
+ /* 276 */
+ array(),
+ /* 277 */
+ array(),
+ /* 278 */
+ array(),
+ /* 279 */
+ array(),
+ /* 280 */
+ array(),
+ /* 281 */
+ array(),
+ /* 282 */
+ array(),
+ /* 283 */
+ array(),
+ /* 284 */
+ array(),
+ /* 285 */
+ array(),
+ /* 286 */
+ array(),
+ /* 287 */
+ array(),
+ /* 288 */
+ array(),
+ /* 289 */
+ array(),
+ /* 290 */
+ array(),
+ /* 291 */
+ array(),
+ /* 292 */
+ array(),
+ /* 293 */
+ array(),
+ /* 294 */
+ array(),
+ /* 295 */
+ array(),
+ /* 296 */
+ array(),
+ /* 297 */
+ array(),
+ /* 298 */
+ array(),
+ /* 299 */
+ array(),
+ /* 300 */
+ array(),
+ /* 301 */
+ array(),
+ /* 302 */
+ array(),
+ /* 303 */
+ array(),
+ /* 304 */
+ array(),
+ /* 305 */
+ array(),
+ /* 306 */
+ array(),
+ /* 307 */
+ array(),
+ /* 308 */
+ array(),
+ /* 309 */
+ array(),
+ /* 310 */
+ array(),
+ /* 311 */
+ array(),
+ /* 312 */
+ array(),
+ /* 313 */
+ array(),
+ /* 314 */
+ array(),
+ /* 315 */
+ array(),
+ /* 316 */
+ array(),
+ /* 317 */
+ array(),
+ /* 318 */
+ array(),
+ /* 319 */
+ array(),
+ /* 320 */
+ array(),
+ /* 321 */
+ array(),
+ /* 322 */
+ array(),
+ /* 323 */
+ array(),
+ /* 324 */
+ array(),
+ /* 325 */
+ array(),
+ /* 326 */
+ array(),
+ /* 327 */
+ array(),
+ /* 328 */
+ array(),
+ /* 329 */
+ array(),
+ /* 330 */
+ array(),
+ /* 331 */
+ array(),
+ /* 332 */
+ array(),
+ /* 333 */
+ array(),
+ /* 334 */
+ array(),
+ /* 335 */
+ array(),
+ /* 336 */
+ array(),
+ /* 337 */
+ array(),
+ /* 338 */
+ array(),
+ /* 339 */
+ array(),
+ /* 340 */
+ array(),
+ /* 341 */
+ array(),
+ /* 342 */
+ array(),
+ /* 343 */
+ array(),
+ /* 344 */
+ array(),
+ /* 345 */
+ array(),
+ /* 346 */
+ array(),
+ /* 347 */
+ array(),
+ /* 348 */
+ array(),
+ /* 349 */
+ array(),
+ /* 350 */
+ array(),
+ /* 351 */
+ array(),
+ /* 352 */
+ array(),
+ /* 353 */
+ array(),
+ /* 354 */
+ array(),
+ /* 355 */
+ array(),
+ /* 356 */
+ array(),
+ /* 357 */
+ array(),
+ /* 358 */
+ array(),
+ /* 359 */
+ array(),
+ /* 360 */
+ array(),
+ /* 361 */
+ array(),
+ /* 362 */
+ array(),
+ );
static public $yy_default = array(
- /* 0 */ 392, 574, 591, 591, 545, 591, 545, 545, 591, 591,
- /* 10 */ 591, 591, 591, 591, 591, 591, 591, 591, 591, 591,
- /* 20 */ 591, 591, 591, 591, 591, 591, 591, 591, 591, 591,
- /* 30 */ 591, 591, 591, 591, 591, 591, 591, 591, 591, 591,
- /* 40 */ 591, 591, 591, 591, 591, 591, 591, 591, 591, 591,
- /* 50 */ 591, 591, 591, 591, 591, 453, 591, 453, 453, 453,
- /* 60 */ 591, 591, 458, 591, 591, 591, 591, 591, 591, 591,
- /* 70 */ 591, 544, 575, 458, 576, 460, 463, 464, 435, 477,
- /* 80 */ 478, 479, 486, 487, 577, 483, 482, 543, 455, 474,
- /* 90 */ 490, 491, 502, 466, 453, 389, 591, 453, 453, 473,
- /* 100 */ 453, 510, 453, 591, 453, 591, 453, 557, 591, 591,
- /* 110 */ 591, 466, 466, 466, 518, 591, 591, 466, 591, 518,
- /* 120 */ 518, 466, 511, 511, 591, 591, 591, 591, 591, 591,
- /* 130 */ 591, 591, 511, 591, 591, 591, 591, 591, 518, 591,
- /* 140 */ 466, 591, 591, 591, 453, 591, 453, 554, 494, 469,
- /* 150 */ 489, 476, 495, 470, 493, 511, 471, 552, 591, 591,
- /* 160 */ 591, 591, 591, 591, 591, 591, 591, 519, 591, 591,
- /* 170 */ 591, 591, 591, 591, 591, 591, 591, 591, 591, 591,
- /* 180 */ 591, 591, 536, 535, 591, 538, 516, 518, 537, 408,
- /* 190 */ 558, 555, 518, 473, 510, 547, 532, 546, 590, 590,
- /* 200 */ 551, 551, 518, 551, 518, 468, 502, 502, 591, 502,
- /* 210 */ 591, 591, 591, 498, 488, 492, 530, 591, 502, 591,
- /* 220 */ 591, 492, 530, 591, 591, 591, 500, 498, 492, 530,
- /* 230 */ 591, 591, 591, 530, 591, 591, 591, 591, 591, 461,
- /* 240 */ 591, 591, 591, 591, 591, 591, 556, 591, 591, 591,
- /* 250 */ 504, 591, 591, 465, 515, 514, 539, 572, 433, 418,
- /* 260 */ 390, 432, 438, 573, 437, 526, 436, 541, 540, 523,
- /* 270 */ 553, 531, 542, 442, 504, 443, 571, 589, 524, 454,
- /* 280 */ 527, 525, 462, 485, 530, 529, 444, 445, 550, 441,
- /* 290 */ 440, 431, 430, 434, 452, 439, 446, 447, 499, 497,
- /* 300 */ 501, 507, 467, 496, 450, 448, 548, 549, 449, 451,
- /* 310 */ 417, 399, 398, 400, 401, 402, 397, 396, 391, 393,
- /* 320 */ 394, 395, 403, 404, 413, 412, 414, 415, 416, 411,
- /* 330 */ 410, 405, 406, 407, 409, 468, 512, 423, 422, 424,
- /* 340 */ 533, 425, 421, 586, 570, 569, 472, 419, 420, 426,
- /* 350 */ 427, 582, 583, 584, 587, 588, 580, 579, 429, 428,
- /* 360 */ 585, 578, 568, 567, 506, 505, 508, 475, 509, 503,
- /* 370 */ 522, 517, 520, 528, 521, 513, 534, 563, 562, 564,
- /* 380 */ 565, 566, 561, 560, 480, 481, 484, 559, 581,
-);
- const YYNOCODE = 124;
- const YYSTACKDEPTH = 100;
- const YYNSTATE = 389;
- const YYNRULE = 202;
- const YYERRORSYMBOL = 81;
+ /* 0 */
+ 366, 551, 522, 568, 568, 568, 522, 522, 568, 568,
+ /* 10 */
+ 568, 568, 568, 568, 568, 568, 568, 568, 568, 568,
+ /* 20 */
+ 568, 568, 568, 568, 568, 568, 568, 568, 568, 568,
+ /* 30 */
+ 568, 568, 568, 568, 568, 568, 568, 568, 568, 568,
+ /* 40 */
+ 568, 568, 568, 568, 568, 568, 568, 568, 568, 568,
+ /* 50 */
+ 568, 568, 568, 428, 568, 405, 428, 428, 428, 397,
+ /* 60 */
+ 568, 568, 568, 568, 568, 568, 568, 433, 568, 568,
+ /* 70 */
+ 568, 553, 449, 520, 552, 457, 433, 452, 439, 462,
+ /* 80 */
+ 521, 461, 430, 435, 554, 438, 454, 453, 410, 458,
+ /* 90 */
+ 466, 465, 477, 441, 428, 363, 568, 428, 428, 485,
+ /* 100 */
+ 428, 448, 428, 428, 428, 534, 568, 419, 568, 568,
+ /* 110 */
+ 568, 441, 441, 441, 568, 495, 495, 495, 441, 486,
+ /* 120 */
+ 441, 486, 568, 486, 568, 428, 428, 568, 568, 441,
+ /* 130 */
+ 495, 568, 568, 407, 568, 568, 568, 568, 568, 568,
+ /* 140 */
+ 422, 568, 568, 568, 568, 568, 451, 486, 531, 464,
+ /* 150 */
+ 446, 445, 468, 444, 469, 470, 424, 529, 568, 496,
+ /* 160 */
+ 395, 489, 492, 412, 392, 406, 514, 409, 490, 491,
+ /* 170 */
+ 413, 394, 398, 513, 393, 408, 493, 400, 417, 402,
+ /* 180 */
+ 415, 404, 414, 418, 416, 403, 515, 512, 399, 495,
+ /* 190 */
+ 448, 420, 485, 523, 524, 423, 425, 532, 567, 567,
+ /* 200 */
+ 509, 383, 535, 495, 495, 528, 528, 528, 495, 443,
+ /* 210 */
+ 477, 568, 477, 477, 507, 568, 473, 467, 568, 568,
+ /* 220 */
+ 568, 568, 467, 568, 477, 463, 507, 568, 568, 568,
+ /* 230 */
+ 568, 568, 568, 568, 436, 568, 568, 507, 568, 533,
+ /* 240 */
+ 568, 475, 568, 568, 568, 568, 568, 568, 568, 568,
+ /* 250 */
+ 473, 568, 568, 479, 507, 467, 568, 568, 568, 568,
+ /* 260 */
+ 508, 429, 437, 364, 501, 519, 503, 440, 500, 479,
+ /* 270 */
+ 566, 516, 517, 502, 504, 518, 411, 530, 459, 506,
+ /* 280 */
+ 507, 527, 525, 427, 426, 388, 389, 390, 526, 471,
+ /* 290 */
+ 443, 487, 494, 497, 442, 482, 472, 474, 476, 387,
+ /* 300 */
+ 386, 371, 372, 373, 374, 370, 369, 365, 367, 368,
+ /* 310 */
+ 375, 376, 382, 384, 385, 381, 380, 377, 378, 379,
+ /* 320 */
+ 505, 498, 510, 421, 562, 555, 563, 447, 545, 546,
+ /* 330 */
+ 547, 556, 557, 558, 548, 550, 565, 564, 560, 559,
+ /* 340 */
+ 561, 544, 543, 450, 484, 488, 511, 483, 481, 499,
+ /* 350 */
+ 478, 480, 455, 456, 540, 541, 542, 539, 538, 460,
+ /* 360 */
+ 536, 537, 549,
+ );
+ const YYNOCODE = 125;
+ const YYSTACKDEPTH = 500;
+ const YYNSTATE = 363;
+ const YYNRULE = 205;
+ const YYERRORSYMBOL = 82;
const YYERRSYMDT = 'yy0';
const YYFALLBACK = 0;
- static public $yyFallback = array(
- );
- static function Trace($TraceFILE, $zTracePrompt)
+ public static $yyFallback = array();
+
+ public function Trace($TraceFILE, $zTracePrompt)
{
if (!$TraceFILE) {
$zTracePrompt = 0;
} elseif (!$zTracePrompt) {
$TraceFILE = 0;
}
- self::$yyTraceFILE = $TraceFILE;
- self::$yyTracePrompt = $zTracePrompt;
+ $this->yyTraceFILE = $TraceFILE;
+ $this->yyTracePrompt = $zTracePrompt;
}
- static function PrintTrace()
+ public function PrintTrace()
{
- self::$yyTraceFILE = fopen('php://output', 'w');
- self::$yyTracePrompt = '<br>';
+ $this->yyTraceFILE = fopen('php://output', 'w');
+ $this->yyTracePrompt = '<br>';
}
- static public $yyTraceFILE;
- static public $yyTracePrompt;
- public $yyidx; /* Index of top element in stack */
- public $yyerrcnt; /* Shifts left before out of the error */
- public $yystack = array(); /* The parser's stack */
+ public $yyTraceFILE;
+ public $yyTracePrompt;
+ public $yyidx; /* Index of top element in stack */
+ public $yyerrcnt; /* Shifts left before out of the error */
+ public $yystack = array(); /* The parser's stack */
public $yyTokenName = array(
- '$', 'VERT', 'COLON', 'COMMENT',
- 'PHPSTARTTAG', 'PHPENDTAG', 'ASPSTARTTAG', 'ASPENDTAG',
- 'FAKEPHPSTARTTAG', 'XMLTAG', 'TEXT', 'STRIPON',
- 'STRIPOFF', 'LITERALSTART', 'LITERALEND', 'LITERAL',
- 'LDEL', 'RDEL', 'DOLLAR', 'ID',
- 'EQUAL', 'PTR', 'LDELIF', 'LDELFOR',
- 'SEMICOLON', 'INCDEC', 'TO', 'STEP',
- 'LDELFOREACH', 'SPACE', 'AS', 'APTR',
- 'LDELSETFILTER', 'SMARTYBLOCKCHILD', 'LDELSLASH', 'ATTR',
- 'INTEGER', 'COMMA', 'OPENP', 'CLOSEP',
- 'MATH', 'UNIMATH', 'ANDSYM', 'ISIN',
- 'ISDIVBY', 'ISNOTDIVBY', 'ISEVEN', 'ISNOTEVEN',
- 'ISEVENBY', 'ISNOTEVENBY', 'ISODD', 'ISNOTODD',
- 'ISODDBY', 'ISNOTODDBY', 'INSTANCEOF', 'QMARK',
- 'NOT', 'TYPECAST', 'HEX', 'DOT',
- 'SINGLEQUOTESTRING', 'DOUBLECOLON', 'AT', 'HATCH',
- 'OPENB', 'CLOSEB', 'EQUALS', 'NOTEQUALS',
- 'GREATERTHAN', 'LESSTHAN', 'GREATEREQUAL', 'LESSEQUAL',
- 'IDENTITY', 'NONEIDENTITY', 'MOD', 'LAND',
- 'LOR', 'LXOR', 'QUOTE', 'BACKTICK',
- 'DOLLARID', 'error', 'start', 'template',
- 'template_element', 'smartytag', 'literal', 'literal_elements',
- 'literal_element', 'value', 'modifierlist', 'attributes',
- 'expr', 'varindexed', 'statement', 'statements',
- 'optspace', 'varvar', 'foraction', 'modparameters',
- 'attribute', 'ternary', 'array', 'ifcond',
- 'lop', 'variable', 'function', 'doublequoted_with_quotes',
- 'static_class_access', 'object', 'arrayindex', 'indexdef',
- 'varvarele', 'objectchain', 'objectelement', 'method',
- 'params', 'modifier', 'modparameter', 'arrayelements',
- 'arrayelement', 'doublequoted', 'doublequotedcontent',
+ '$', 'VERT', 'COLON', 'RDEL',
+ 'COMMENT', 'PHPSTARTTAG', 'PHPENDTAG', 'ASPSTARTTAG',
+ 'ASPENDTAG', 'FAKEPHPSTARTTAG', 'XMLTAG', 'TEXT',
+ 'STRIPON', 'STRIPOFF', 'BLOCKSOURCE', 'LITERALSTART',
+ 'LITERALEND', 'LITERAL', 'LDEL', 'DOLLAR',
+ 'ID', 'EQUAL', 'PTR', 'LDELIF',
+ 'LDELFOR', 'SEMICOLON', 'INCDEC', 'TO',
+ 'STEP', 'LDELFOREACH', 'SPACE', 'AS',
+ 'APTR', 'LDELSETFILTER', 'SMARTYBLOCKCHILDPARENT', 'LDELSLASH',
+ 'ATTR', 'INTEGER', 'COMMA', 'OPENP',
+ 'CLOSEP', 'MATH', 'UNIMATH', 'ANDSYM',
+ 'ISIN', 'ISDIVBY', 'ISNOTDIVBY', 'ISEVEN',
+ 'ISNOTEVEN', 'ISEVENBY', 'ISNOTEVENBY', 'ISODD',
+ 'ISNOTODD', 'ISODDBY', 'ISNOTODDBY', 'INSTANCEOF',
+ 'QMARK', 'NOT', 'TYPECAST', 'HEX',
+ 'DOT', 'SINGLEQUOTESTRING', 'DOUBLECOLON', 'AT',
+ 'HATCH', 'OPENB', 'CLOSEB', 'EQUALS',
+ 'NOTEQUALS', 'GREATERTHAN', 'LESSTHAN', 'GREATEREQUAL',
+ 'LESSEQUAL', 'IDENTITY', 'NONEIDENTITY', 'MOD',
+ 'LAND', 'LOR', 'LXOR', 'QUOTE',
+ 'BACKTICK', 'DOLLARID', 'error', 'start',
+ 'template', 'template_element', 'smartytag', 'literal',
+ 'literal_elements', 'literal_element', 'value', 'modifierlist',
+ 'attributes', 'expr', 'varindexed', 'statement',
+ 'statements', 'optspace', 'varvar', 'foraction',
+ 'modparameters', 'attribute', 'ternary', 'array',
+ 'ifcond', 'lop', 'variable', 'function',
+ 'doublequoted_with_quotes', 'static_class_access', 'object', 'arrayindex',
+ 'indexdef', 'varvarele', 'objectchain', 'objectelement',
+ 'method', 'params', 'modifier', 'modparameter',
+ 'arrayelements', 'arrayelement', 'doublequoted', 'doublequotedcontent',
);
- static public $yyRuleName = array(
- /* 0 */ "start ::= template",
- /* 1 */ "template ::= template_element",
- /* 2 */ "template ::= template template_element",
- /* 3 */ "template ::=",
- /* 4 */ "template_element ::= smartytag",
- /* 5 */ "template_element ::= COMMENT",
- /* 6 */ "template_element ::= literal",
- /* 7 */ "template_element ::= PHPSTARTTAG",
- /* 8 */ "template_element ::= PHPENDTAG",
- /* 9 */ "template_element ::= ASPSTARTTAG",
- /* 10 */ "template_element ::= ASPENDTAG",
- /* 11 */ "template_element ::= FAKEPHPSTARTTAG",
- /* 12 */ "template_element ::= XMLTAG",
- /* 13 */ "template_element ::= TEXT",
- /* 14 */ "template_element ::= STRIPON",
- /* 15 */ "template_element ::= STRIPOFF",
- /* 16 */ "literal ::= LITERALSTART LITERALEND",
- /* 17 */ "literal ::= LITERALSTART literal_elements LITERALEND",
- /* 18 */ "literal_elements ::= literal_elements literal_element",
- /* 19 */ "literal_elements ::=",
- /* 20 */ "literal_element ::= literal",
- /* 21 */ "literal_element ::= LITERAL",
- /* 22 */ "literal_element ::= PHPSTARTTAG",
- /* 23 */ "literal_element ::= FAKEPHPSTARTTAG",
- /* 24 */ "literal_element ::= PHPENDTAG",
- /* 25 */ "literal_element ::= ASPSTARTTAG",
- /* 26 */ "literal_element ::= ASPENDTAG",
- /* 27 */ "smartytag ::= LDEL value RDEL",
- /* 28 */ "smartytag ::= LDEL value modifierlist attributes RDEL",
- /* 29 */ "smartytag ::= LDEL value attributes RDEL",
- /* 30 */ "smartytag ::= LDEL expr modifierlist attributes RDEL",
- /* 31 */ "smartytag ::= LDEL expr attributes RDEL",
- /* 32 */ "smartytag ::= LDEL DOLLAR ID EQUAL value RDEL",
- /* 33 */ "smartytag ::= LDEL DOLLAR ID EQUAL expr RDEL",
- /* 34 */ "smartytag ::= LDEL DOLLAR ID EQUAL expr attributes RDEL",
- /* 35 */ "smartytag ::= LDEL varindexed EQUAL expr attributes RDEL",
- /* 36 */ "smartytag ::= LDEL ID attributes RDEL",
- /* 37 */ "smartytag ::= LDEL ID RDEL",
- /* 38 */ "smartytag ::= LDEL ID PTR ID attributes RDEL",
- /* 39 */ "smartytag ::= LDEL ID modifierlist attributes RDEL",
- /* 40 */ "smartytag ::= LDEL ID PTR ID modifierlist attributes RDEL",
- /* 41 */ "smartytag ::= LDELIF expr RDEL",
- /* 42 */ "smartytag ::= LDELIF expr attributes RDEL",
- /* 43 */ "smartytag ::= LDELIF statement RDEL",
- /* 44 */ "smartytag ::= LDELIF statement attributes RDEL",
- /* 45 */ "smartytag ::= LDELFOR statements SEMICOLON optspace expr SEMICOLON optspace DOLLAR varvar foraction attributes RDEL",
- /* 46 */ "foraction ::= EQUAL expr",
- /* 47 */ "foraction ::= INCDEC",
- /* 48 */ "smartytag ::= LDELFOR statement TO expr attributes RDEL",
- /* 49 */ "smartytag ::= LDELFOR statement TO expr STEP expr attributes RDEL",
- /* 50 */ "smartytag ::= LDELFOREACH attributes RDEL",
- /* 51 */ "smartytag ::= LDELFOREACH SPACE value AS DOLLAR varvar attributes RDEL",
- /* 52 */ "smartytag ::= LDELFOREACH SPACE value AS DOLLAR varvar APTR DOLLAR varvar attributes RDEL",
- /* 53 */ "smartytag ::= LDELFOREACH SPACE expr AS DOLLAR varvar attributes RDEL",
- /* 54 */ "smartytag ::= LDELFOREACH SPACE expr AS DOLLAR varvar APTR DOLLAR varvar attributes RDEL",
- /* 55 */ "smartytag ::= LDELSETFILTER ID modparameters RDEL",
- /* 56 */ "smartytag ::= LDELSETFILTER ID modparameters modifierlist RDEL",
- /* 57 */ "smartytag ::= SMARTYBLOCKCHILD",
- /* 58 */ "smartytag ::= LDELSLASH ID RDEL",
- /* 59 */ "smartytag ::= LDELSLASH ID modifierlist RDEL",
- /* 60 */ "smartytag ::= LDELSLASH ID PTR ID RDEL",
- /* 61 */ "smartytag ::= LDELSLASH ID PTR ID modifierlist RDEL",
- /* 62 */ "attributes ::= attributes attribute",
- /* 63 */ "attributes ::= attribute",
- /* 64 */ "attributes ::=",
- /* 65 */ "attribute ::= SPACE ID EQUAL ID",
- /* 66 */ "attribute ::= ATTR expr",
- /* 67 */ "attribute ::= ATTR value",
- /* 68 */ "attribute ::= SPACE ID",
- /* 69 */ "attribute ::= SPACE expr",
- /* 70 */ "attribute ::= SPACE value",
- /* 71 */ "attribute ::= SPACE INTEGER EQUAL expr",
- /* 72 */ "statements ::= statement",
- /* 73 */ "statements ::= statements COMMA statement",
- /* 74 */ "statement ::= DOLLAR varvar EQUAL expr",
- /* 75 */ "statement ::= varindexed EQUAL expr",
- /* 76 */ "statement ::= OPENP statement CLOSEP",
- /* 77 */ "expr ::= value",
- /* 78 */ "expr ::= ternary",
- /* 79 */ "expr ::= DOLLAR ID COLON ID",
- /* 80 */ "expr ::= expr MATH value",
- /* 81 */ "expr ::= expr UNIMATH value",
- /* 82 */ "expr ::= expr ANDSYM value",
- /* 83 */ "expr ::= array",
- /* 84 */ "expr ::= expr modifierlist",
- /* 85 */ "expr ::= expr ifcond expr",
- /* 86 */ "expr ::= expr ISIN array",
- /* 87 */ "expr ::= expr ISIN value",
- /* 88 */ "expr ::= expr lop expr",
- /* 89 */ "expr ::= expr ISDIVBY expr",
- /* 90 */ "expr ::= expr ISNOTDIVBY expr",
- /* 91 */ "expr ::= expr ISEVEN",
- /* 92 */ "expr ::= expr ISNOTEVEN",
- /* 93 */ "expr ::= expr ISEVENBY expr",
- /* 94 */ "expr ::= expr ISNOTEVENBY expr",
- /* 95 */ "expr ::= expr ISODD",
- /* 96 */ "expr ::= expr ISNOTODD",
- /* 97 */ "expr ::= expr ISODDBY expr",
- /* 98 */ "expr ::= expr ISNOTODDBY expr",
- /* 99 */ "expr ::= value INSTANCEOF ID",
- /* 100 */ "expr ::= value INSTANCEOF value",
- /* 101 */ "ternary ::= OPENP expr CLOSEP QMARK DOLLAR ID COLON expr",
- /* 102 */ "ternary ::= OPENP expr CLOSEP QMARK expr COLON expr",
- /* 103 */ "value ::= variable",
- /* 104 */ "value ::= UNIMATH value",
- /* 105 */ "value ::= NOT value",
- /* 106 */ "value ::= TYPECAST value",
- /* 107 */ "value ::= variable INCDEC",
- /* 108 */ "value ::= HEX",
- /* 109 */ "value ::= INTEGER",
- /* 110 */ "value ::= INTEGER DOT INTEGER",
- /* 111 */ "value ::= INTEGER DOT",
- /* 112 */ "value ::= DOT INTEGER",
- /* 113 */ "value ::= ID",
- /* 114 */ "value ::= function",
- /* 115 */ "value ::= OPENP expr CLOSEP",
- /* 116 */ "value ::= SINGLEQUOTESTRING",
- /* 117 */ "value ::= doublequoted_with_quotes",
- /* 118 */ "value ::= ID DOUBLECOLON static_class_access",
- /* 119 */ "value ::= varindexed DOUBLECOLON static_class_access",
- /* 120 */ "value ::= smartytag",
- /* 121 */ "value ::= value modifierlist",
- /* 122 */ "variable ::= varindexed",
- /* 123 */ "variable ::= DOLLAR varvar AT ID",
- /* 124 */ "variable ::= object",
- /* 125 */ "variable ::= HATCH ID HATCH",
- /* 126 */ "variable ::= HATCH variable HATCH",
- /* 127 */ "varindexed ::= DOLLAR varvar arrayindex",
- /* 128 */ "arrayindex ::= arrayindex indexdef",
- /* 129 */ "arrayindex ::=",
- /* 130 */ "indexdef ::= DOT DOLLAR varvar",
- /* 131 */ "indexdef ::= DOT DOLLAR varvar AT ID",
- /* 132 */ "indexdef ::= DOT ID",
- /* 133 */ "indexdef ::= DOT INTEGER",
- /* 134 */ "indexdef ::= DOT LDEL expr RDEL",
- /* 135 */ "indexdef ::= OPENB ID CLOSEB",
- /* 136 */ "indexdef ::= OPENB ID DOT ID CLOSEB",
- /* 137 */ "indexdef ::= OPENB expr CLOSEB",
- /* 138 */ "indexdef ::= OPENB CLOSEB",
- /* 139 */ "varvar ::= varvarele",
- /* 140 */ "varvar ::= varvar varvarele",
- /* 141 */ "varvarele ::= ID",
- /* 142 */ "varvarele ::= LDEL expr RDEL",
- /* 143 */ "object ::= varindexed objectchain",
- /* 144 */ "objectchain ::= objectelement",
- /* 145 */ "objectchain ::= objectchain objectelement",
- /* 146 */ "objectelement ::= PTR ID arrayindex",
- /* 147 */ "objectelement ::= PTR DOLLAR varvar arrayindex",
- /* 148 */ "objectelement ::= PTR LDEL expr RDEL arrayindex",
- /* 149 */ "objectelement ::= PTR ID LDEL expr RDEL arrayindex",
- /* 150 */ "objectelement ::= PTR method",
- /* 151 */ "function ::= ID OPENP params CLOSEP",
- /* 152 */ "method ::= ID OPENP params CLOSEP",
- /* 153 */ "method ::= DOLLAR ID OPENP params CLOSEP",
- /* 154 */ "params ::= params COMMA expr",
- /* 155 */ "params ::= expr",
- /* 156 */ "params ::=",
- /* 157 */ "modifierlist ::= modifierlist modifier modparameters",
- /* 158 */ "modifierlist ::= modifier modparameters",
- /* 159 */ "modifier ::= VERT AT ID",
- /* 160 */ "modifier ::= VERT ID",
- /* 161 */ "modparameters ::= modparameters modparameter",
- /* 162 */ "modparameters ::=",
- /* 163 */ "modparameter ::= COLON value",
- /* 164 */ "modparameter ::= COLON array",
- /* 165 */ "static_class_access ::= method",
- /* 166 */ "static_class_access ::= method objectchain",
- /* 167 */ "static_class_access ::= ID",
- /* 168 */ "static_class_access ::= DOLLAR ID arrayindex",
- /* 169 */ "static_class_access ::= DOLLAR ID arrayindex objectchain",
- /* 170 */ "ifcond ::= EQUALS",
- /* 171 */ "ifcond ::= NOTEQUALS",
- /* 172 */ "ifcond ::= GREATERTHAN",
- /* 173 */ "ifcond ::= LESSTHAN",
- /* 174 */ "ifcond ::= GREATEREQUAL",
- /* 175 */ "ifcond ::= LESSEQUAL",
- /* 176 */ "ifcond ::= IDENTITY",
- /* 177 */ "ifcond ::= NONEIDENTITY",
- /* 178 */ "ifcond ::= MOD",
- /* 179 */ "lop ::= LAND",
- /* 180 */ "lop ::= LOR",
- /* 181 */ "lop ::= LXOR",
- /* 182 */ "array ::= OPENB arrayelements CLOSEB",
- /* 183 */ "arrayelements ::= arrayelement",
- /* 184 */ "arrayelements ::= arrayelements COMMA arrayelement",
- /* 185 */ "arrayelements ::=",
- /* 186 */ "arrayelement ::= value APTR expr",
- /* 187 */ "arrayelement ::= ID APTR expr",
- /* 188 */ "arrayelement ::= expr",
- /* 189 */ "doublequoted_with_quotes ::= QUOTE QUOTE",
- /* 190 */ "doublequoted_with_quotes ::= QUOTE doublequoted QUOTE",
- /* 191 */ "doublequoted ::= doublequoted doublequotedcontent",
- /* 192 */ "doublequoted ::= doublequotedcontent",
- /* 193 */ "doublequotedcontent ::= BACKTICK variable BACKTICK",
- /* 194 */ "doublequotedcontent ::= BACKTICK expr BACKTICK",
- /* 195 */ "doublequotedcontent ::= DOLLARID",
- /* 196 */ "doublequotedcontent ::= LDEL variable RDEL",
- /* 197 */ "doublequotedcontent ::= LDEL expr RDEL",
- /* 198 */ "doublequotedcontent ::= smartytag",
- /* 199 */ "doublequotedcontent ::= TEXT",
- /* 200 */ "optspace ::= SPACE",
- /* 201 */ "optspace ::=",
+ public static $yyRuleName = array(
+ /* 0 */
+ "start ::= template",
+ /* 1 */
+ "template ::= template_element",
+ /* 2 */
+ "template ::= template template_element",
+ /* 3 */
+ "template ::=",
+ /* 4 */
+ "template_element ::= smartytag RDEL",
+ /* 5 */
+ "template_element ::= COMMENT",
+ /* 6 */
+ "template_element ::= literal",
+ /* 7 */
+ "template_element ::= PHPSTARTTAG",
+ /* 8 */
+ "template_element ::= PHPENDTAG",
+ /* 9 */
+ "template_element ::= ASPSTARTTAG",
+ /* 10 */
+ "template_element ::= ASPENDTAG",
+ /* 11 */
+ "template_element ::= FAKEPHPSTARTTAG",
+ /* 12 */
+ "template_element ::= XMLTAG",
+ /* 13 */
+ "template_element ::= TEXT",
+ /* 14 */
+ "template_element ::= STRIPON",
+ /* 15 */
+ "template_element ::= STRIPOFF",
+ /* 16 */
+ "template_element ::= BLOCKSOURCE",
+ /* 17 */
+ "literal ::= LITERALSTART LITERALEND",
+ /* 18 */
+ "literal ::= LITERALSTART literal_elements LITERALEND",
+ /* 19 */
+ "literal_elements ::= literal_elements literal_element",
+ /* 20 */
+ "literal_elements ::=",
+ /* 21 */
+ "literal_element ::= literal",
+ /* 22 */
+ "literal_element ::= LITERAL",
+ /* 23 */
+ "literal_element ::= PHPSTARTTAG",
+ /* 24 */
+ "literal_element ::= FAKEPHPSTARTTAG",
+ /* 25 */
+ "literal_element ::= PHPENDTAG",
+ /* 26 */
+ "literal_element ::= ASPSTARTTAG",
+ /* 27 */
+ "literal_element ::= ASPENDTAG",
+ /* 28 */
+ "smartytag ::= LDEL value",
+ /* 29 */
+ "smartytag ::= LDEL value modifierlist attributes",
+ /* 30 */
+ "smartytag ::= LDEL value attributes",
+ /* 31 */
+ "smartytag ::= LDEL expr modifierlist attributes",
+ /* 32 */
+ "smartytag ::= LDEL expr attributes",
+ /* 33 */
+ "smartytag ::= LDEL DOLLAR ID EQUAL value",
+ /* 34 */
+ "smartytag ::= LDEL DOLLAR ID EQUAL expr",
+ /* 35 */
+ "smartytag ::= LDEL DOLLAR ID EQUAL expr attributes",
+ /* 36 */
+ "smartytag ::= LDEL varindexed EQUAL expr attributes",
+ /* 37 */
+ "smartytag ::= LDEL ID attributes",
+ /* 38 */
+ "smartytag ::= LDEL ID",
+ /* 39 */
+ "smartytag ::= LDEL ID PTR ID attributes",
+ /* 40 */
+ "smartytag ::= LDEL ID modifierlist attributes",
+ /* 41 */
+ "smartytag ::= LDEL ID PTR ID modifierlist attributes",
+ /* 42 */
+ "smartytag ::= LDELIF expr",
+ /* 43 */
+ "smartytag ::= LDELIF expr attributes",
+ /* 44 */
+ "smartytag ::= LDELIF statement",
+ /* 45 */
+ "smartytag ::= LDELIF statement attributes",
+ /* 46 */
+ "smartytag ::= LDELFOR statements SEMICOLON optspace expr SEMICOLON optspace DOLLAR varvar foraction attributes",
+ /* 47 */
+ "foraction ::= EQUAL expr",
+ /* 48 */
+ "foraction ::= INCDEC",
+ /* 49 */
+ "smartytag ::= LDELFOR statement TO expr attributes",
+ /* 50 */
+ "smartytag ::= LDELFOR statement TO expr STEP expr attributes",
+ /* 51 */
+ "smartytag ::= LDELFOREACH attributes",
+ /* 52 */
+ "smartytag ::= LDELFOREACH SPACE value AS DOLLAR varvar attributes",
+ /* 53 */
+ "smartytag ::= LDELFOREACH SPACE value AS DOLLAR varvar APTR DOLLAR varvar attributes",
+ /* 54 */
+ "smartytag ::= LDELFOREACH SPACE expr AS DOLLAR varvar attributes",
+ /* 55 */
+ "smartytag ::= LDELFOREACH SPACE expr AS DOLLAR varvar APTR DOLLAR varvar attributes",
+ /* 56 */
+ "smartytag ::= LDELSETFILTER ID modparameters",
+ /* 57 */
+ "smartytag ::= LDELSETFILTER ID modparameters modifierlist",
+ /* 58 */
+ "smartytag ::= LDEL SMARTYBLOCKCHILDPARENT",
+ /* 59 */
+ "smartytag ::= LDELSLASH ID",
+ /* 60 */
+ "smartytag ::= LDELSLASH ID modifierlist",
+ /* 61 */
+ "smartytag ::= LDELSLASH ID PTR ID",
+ /* 62 */
+ "smartytag ::= LDELSLASH ID PTR ID modifierlist",
+ /* 63 */
+ "attributes ::= attributes attribute",
+ /* 64 */
+ "attributes ::= attribute",
+ /* 65 */
+ "attributes ::=",
+ /* 66 */
+ "attribute ::= SPACE ID EQUAL ID",
+ /* 67 */
+ "attribute ::= ATTR expr",
+ /* 68 */
+ "attribute ::= ATTR value",
+ /* 69 */
+ "attribute ::= SPACE ID",
+ /* 70 */
+ "attribute ::= SPACE expr",
+ /* 71 */
+ "attribute ::= SPACE value",
+ /* 72 */
+ "attribute ::= SPACE INTEGER EQUAL expr",
+ /* 73 */
+ "statements ::= statement",
+ /* 74 */
+ "statements ::= statements COMMA statement",
+ /* 75 */
+ "statement ::= DOLLAR varvar EQUAL expr",
+ /* 76 */
+ "statement ::= varindexed EQUAL expr",
+ /* 77 */
+ "statement ::= OPENP statement CLOSEP",
+ /* 78 */
+ "expr ::= value",
+ /* 79 */
+ "expr ::= ternary",
+ /* 80 */
+ "expr ::= DOLLAR ID COLON ID",
+ /* 81 */
+ "expr ::= expr MATH value",
+ /* 82 */
+ "expr ::= expr UNIMATH value",
+ /* 83 */
+ "expr ::= expr ANDSYM value",
+ /* 84 */
+ "expr ::= array",
+ /* 85 */
+ "expr ::= expr modifierlist",
+ /* 86 */
+ "expr ::= expr ifcond expr",
+ /* 87 */
+ "expr ::= expr ISIN array",
+ /* 88 */
+ "expr ::= expr ISIN value",
+ /* 89 */
+ "expr ::= expr lop expr",
+ /* 90 */
+ "expr ::= expr ISDIVBY expr",
+ /* 91 */
+ "expr ::= expr ISNOTDIVBY expr",
+ /* 92 */
+ "expr ::= expr ISEVEN",
+ /* 93 */
+ "expr ::= expr ISNOTEVEN",
+ /* 94 */
+ "expr ::= expr ISEVENBY expr",
+ /* 95 */
+ "expr ::= expr ISNOTEVENBY expr",
+ /* 96 */
+ "expr ::= expr ISODD",
+ /* 97 */
+ "expr ::= expr ISNOTODD",
+ /* 98 */
+ "expr ::= expr ISODDBY expr",
+ /* 99 */
+ "expr ::= expr ISNOTODDBY expr",
+ /* 100 */
+ "expr ::= value INSTANCEOF ID",
+ /* 101 */
+ "expr ::= value INSTANCEOF value",
+ /* 102 */
+ "ternary ::= OPENP expr CLOSEP QMARK DOLLAR ID COLON expr",
+ /* 103 */
+ "ternary ::= OPENP expr CLOSEP QMARK expr COLON expr",
+ /* 104 */
+ "value ::= variable",
+ /* 105 */
+ "value ::= UNIMATH value",
+ /* 106 */
+ "value ::= NOT value",
+ /* 107 */
+ "value ::= TYPECAST value",
+ /* 108 */
+ "value ::= variable INCDEC",
+ /* 109 */
+ "value ::= HEX",
+ /* 110 */
+ "value ::= INTEGER",
+ /* 111 */
+ "value ::= INTEGER DOT INTEGER",
+ /* 112 */
+ "value ::= INTEGER DOT",
+ /* 113 */
+ "value ::= DOT INTEGER",
+ /* 114 */
+ "value ::= ID",
+ /* 115 */
+ "value ::= function",
+ /* 116 */
+ "value ::= OPENP expr CLOSEP",
+ /* 117 */
+ "value ::= SINGLEQUOTESTRING",
+ /* 118 */
+ "value ::= doublequoted_with_quotes",
+ /* 119 */
+ "value ::= ID DOUBLECOLON static_class_access",
+ /* 120 */
+ "value ::= varindexed DOUBLECOLON static_class_access",
+ /* 121 */
+ "value ::= smartytag RDEL",
+ /* 122 */
+ "value ::= value modifierlist",
+ /* 123 */
+ "variable ::= varindexed",
+ /* 124 */
+ "variable ::= DOLLAR varvar AT ID",
+ /* 125 */
+ "variable ::= object",
+ /* 126 */
+ "variable ::= HATCH ID HATCH",
+ /* 127 */
+ "variable ::= HATCH ID HATCH arrayindex",
+ /* 128 */
+ "variable ::= HATCH variable HATCH",
+ /* 129 */
+ "variable ::= HATCH variable HATCH arrayindex",
+ /* 130 */
+ "varindexed ::= DOLLAR varvar arrayindex",
+ /* 131 */
+ "arrayindex ::= arrayindex indexdef",
+ /* 132 */
+ "arrayindex ::=",
+ /* 133 */
+ "indexdef ::= DOT DOLLAR varvar",
+ /* 134 */
+ "indexdef ::= DOT DOLLAR varvar AT ID",
+ /* 135 */
+ "indexdef ::= DOT ID",
+ /* 136 */
+ "indexdef ::= DOT INTEGER",
+ /* 137 */
+ "indexdef ::= DOT LDEL expr RDEL",
+ /* 138 */
+ "indexdef ::= OPENB ID CLOSEB",
+ /* 139 */
+ "indexdef ::= OPENB ID DOT ID CLOSEB",
+ /* 140 */
+ "indexdef ::= OPENB expr CLOSEB",
+ /* 141 */
+ "indexdef ::= OPENB CLOSEB",
+ /* 142 */
+ "varvar ::= varvarele",
+ /* 143 */
+ "varvar ::= varvar varvarele",
+ /* 144 */
+ "varvarele ::= ID",
+ /* 145 */
+ "varvarele ::= LDEL expr RDEL",
+ /* 146 */
+ "object ::= varindexed objectchain",
+ /* 147 */
+ "objectchain ::= objectelement",
+ /* 148 */
+ "objectchain ::= objectchain objectelement",
+ /* 149 */
+ "objectelement ::= PTR ID arrayindex",
+ /* 150 */
+ "objectelement ::= PTR DOLLAR varvar arrayindex",
+ /* 151 */
+ "objectelement ::= PTR LDEL expr RDEL arrayindex",
+ /* 152 */
+ "objectelement ::= PTR ID LDEL expr RDEL arrayindex",
+ /* 153 */
+ "objectelement ::= PTR method",
+ /* 154 */
+ "function ::= ID OPENP params CLOSEP",
+ /* 155 */
+ "method ::= ID OPENP params CLOSEP",
+ /* 156 */
+ "method ::= DOLLAR ID OPENP params CLOSEP",
+ /* 157 */
+ "params ::= params COMMA expr",
+ /* 158 */
+ "params ::= expr",
+ /* 159 */
+ "params ::=",
+ /* 160 */
+ "modifierlist ::= modifierlist modifier modparameters",
+ /* 161 */
+ "modifierlist ::= modifier modparameters",
+ /* 162 */
+ "modifier ::= VERT AT ID",
+ /* 163 */
+ "modifier ::= VERT ID",
+ /* 164 */
+ "modparameters ::= modparameters modparameter",
+ /* 165 */
+ "modparameters ::=",
+ /* 166 */
+ "modparameter ::= COLON value",
+ /* 167 */
+ "modparameter ::= COLON array",
+ /* 168 */
+ "static_class_access ::= method",
+ /* 169 */
+ "static_class_access ::= method objectchain",
+ /* 170 */
+ "static_class_access ::= ID",
+ /* 171 */
+ "static_class_access ::= DOLLAR ID arrayindex",
+ /* 172 */
+ "static_class_access ::= DOLLAR ID arrayindex objectchain",
+ /* 173 */
+ "ifcond ::= EQUALS",
+ /* 174 */
+ "ifcond ::= NOTEQUALS",
+ /* 175 */
+ "ifcond ::= GREATERTHAN",
+ /* 176 */
+ "ifcond ::= LESSTHAN",
+ /* 177 */
+ "ifcond ::= GREATEREQUAL",
+ /* 178 */
+ "ifcond ::= LESSEQUAL",
+ /* 179 */
+ "ifcond ::= IDENTITY",
+ /* 180 */
+ "ifcond ::= NONEIDENTITY",
+ /* 181 */
+ "ifcond ::= MOD",
+ /* 182 */
+ "lop ::= LAND",
+ /* 183 */
+ "lop ::= LOR",
+ /* 184 */
+ "lop ::= LXOR",
+ /* 185 */
+ "array ::= OPENB arrayelements CLOSEB",
+ /* 186 */
+ "arrayelements ::= arrayelement",
+ /* 187 */
+ "arrayelements ::= arrayelements COMMA arrayelement",
+ /* 188 */
+ "arrayelements ::=",
+ /* 189 */
+ "arrayelement ::= value APTR expr",
+ /* 190 */
+ "arrayelement ::= ID APTR expr",
+ /* 191 */
+ "arrayelement ::= expr",
+ /* 192 */
+ "doublequoted_with_quotes ::= QUOTE QUOTE",
+ /* 193 */
+ "doublequoted_with_quotes ::= QUOTE doublequoted QUOTE",
+ /* 194 */
+ "doublequoted ::= doublequoted doublequotedcontent",
+ /* 195 */
+ "doublequoted ::= doublequotedcontent",
+ /* 196 */
+ "doublequotedcontent ::= BACKTICK variable BACKTICK",
+ /* 197 */
+ "doublequotedcontent ::= BACKTICK expr BACKTICK",
+ /* 198 */
+ "doublequotedcontent ::= DOLLARID",
+ /* 199 */
+ "doublequotedcontent ::= LDEL variable RDEL",
+ /* 200 */
+ "doublequotedcontent ::= LDEL expr RDEL",
+ /* 201 */
+ "doublequotedcontent ::= smartytag RDEL",
+ /* 202 */
+ "doublequotedcontent ::= TEXT",
+ /* 203 */
+ "optspace ::= SPACE",
+ /* 204 */
+ "optspace ::=",
);
- function tokenName($tokenType)
+ public function tokenName($tokenType)
{
if ($tokenType === 0) {
return 'End of Input';
}
}
- static function yy_destructor($yymajor, $yypminor)
+ public static function yy_destructor($yymajor, $yypminor)
{
switch ($yymajor) {
- default: break; /* If no destructor action specified: do nothing */
+ default:
+ break; /* If no destructor action specified: do nothing */
}
}
- function yy_pop_parser_stack()
+ public function yy_pop_parser_stack()
{
if (!count($this->yystack)) {
return;
}
$yytos = array_pop($this->yystack);
- if (self::$yyTraceFILE && $this->yyidx >= 0) {
- fwrite(self::$yyTraceFILE,
- self::$yyTracePrompt . 'Popping ' . $this->yyTokenName[$yytos->major] .
- "\n");
+ if ($this->yyTraceFILE && $this->yyidx >= 0) {
+ fwrite($this->yyTraceFILE,
+ $this->yyTracePrompt . 'Popping ' . $this->yyTokenName[$yytos->major] .
+ "\n");
}
$yymajor = $yytos->major;
self::yy_destructor($yymajor, $yytos->minor);
- $this->yyidx--;
+ $this->yyidx --;
+
return $yymajor;
}
- function __destruct()
+ public function __destruct()
{
while ($this->yystack !== Array()) {
$this->yy_pop_parser_stack();
}
- if (is_resource(self::$yyTraceFILE)) {
- fclose(self::$yyTraceFILE);
+ if (is_resource($this->yyTraceFILE)) {
+ fclose($this->yyTraceFILE);
}
}
- function yy_get_expected_tokens($token)
+ public function yy_get_expected_tokens($token)
{
$state = $this->yystack[$this->yyidx]->stateno;
$expected = self::$yyExpectedTokens[$state];
// reduce action
$done = 0;
do {
- if ($done++ == 100) {
+ if ($done ++ == 100) {
$this->yyidx = $yyidx;
$this->yystack = $stack;
// too much recursion prevents proper detection
$this->yystack[$this->yyidx]->stateno,
self::$yyRuleInfo[$yyruleno]['lhs']);
if (isset(self::$yyExpectedTokens[$nextstate])) {
- $expected = array_merge($expected, self::$yyExpectedTokens[$nextstate]);
- if (in_array($token,
- self::$yyExpectedTokens[$nextstate], true)) {
+ $expected = array_merge($expected, self::$yyExpectedTokens[$nextstate]);
+ if (in_array($token,
+ self::$yyExpectedTokens[$nextstate], true)) {
$this->yyidx = $yyidx;
$this->yystack = $stack;
+
return array_unique($expected);
}
}
if ($nextstate < self::YYNSTATE) {
// we need to shift a non-terminal
- $this->yyidx++;
+ $this->yyidx ++;
$x = new TP_yyStackEntry;
$x->stateno = $nextstate;
$x->major = self::$yyRuleInfo[$yyruleno]['lhs'];
}
break;
} while (true);
- $this->yyidx = $yyidx;
- $this->yystack = $stack;
+ $this->yyidx = $yyidx;
+ $this->yystack = $stack;
+
return array_unique($expected);
}
- function yy_is_expected_token($token)
+ public function yy_is_expected_token($token)
{
if ($token === 0) {
return true; // 0 is not part of this
// reduce action
$done = 0;
do {
- if ($done++ == 100) {
+ if ($done ++ == 100) {
$this->yyidx = $yyidx;
$this->yystack = $stack;
// too much recursion prevents proper detection
$this->yystack[$this->yyidx]->stateno,
self::$yyRuleInfo[$yyruleno]['lhs']);
if (isset(self::$yyExpectedTokens[$nextstate]) &&
- in_array($token, self::$yyExpectedTokens[$nextstate], true)) {
+ in_array($token, self::$yyExpectedTokens[$nextstate], true)
+ ) {
$this->yyidx = $yyidx;
$this->yystack = $stack;
+
return true;
}
if ($nextstate < self::YYNSTATE) {
// we need to shift a non-terminal
- $this->yyidx++;
+ $this->yyidx ++;
$x = new TP_yyStackEntry;
$x->stateno = $nextstate;
$x->major = self::$yyRuleInfo[$yyruleno]['lhs'];
} while (true);
$this->yyidx = $yyidx;
$this->yystack = $stack;
+
return true;
}
- function yy_find_shift_action($iLookAhead)
+ public function yy_find_shift_action($iLookAhead)
{
$stateno = $this->yystack[$this->yyidx]->stateno;
}
$i += $iLookAhead;
if ($i < 0 || $i >= self::YY_SZ_ACTTAB ||
- self::$yy_lookahead[$i] != $iLookAhead) {
+ self::$yy_lookahead[$i] != $iLookAhead
+ ) {
if (count(self::$yyFallback) && $iLookAhead < count(self::$yyFallback)
- && ($iFallback = self::$yyFallback[$iLookAhead]) != 0) {
- if (self::$yyTraceFILE) {
- fwrite(self::$yyTraceFILE, self::$yyTracePrompt . "FALLBACK " .
+ && ($iFallback = self::$yyFallback[$iLookAhead]) != 0
+ ) {
+ if ($this->yyTraceFILE) {
+ fwrite($this->yyTraceFILE, $this->yyTracePrompt . "FALLBACK " .
$this->yyTokenName[$iLookAhead] . " => " .
$this->yyTokenName[$iFallback] . "\n");
}
+
return $this->yy_find_shift_action($iFallback);
}
+
return self::$yy_default[$stateno];
} else {
return self::$yy_action[$i];
}
}
- function yy_find_reduce_action($stateno, $iLookAhead)
+ public function yy_find_reduce_action($stateno, $iLookAhead)
{
/* $stateno = $this->yystack[$this->yyidx]->stateno; */
}
$i += $iLookAhead;
if ($i < 0 || $i >= self::YY_SZ_ACTTAB ||
- self::$yy_lookahead[$i] != $iLookAhead) {
+ self::$yy_lookahead[$i] != $iLookAhead
+ ) {
return self::$yy_default[$stateno];
} else {
return self::$yy_action[$i];
}
}
- function yy_shift($yyNewState, $yyMajor, $yypMinor)
+ public function yy_shift($yyNewState, $yyMajor, $yypMinor)
{
- $this->yyidx++;
+ $this->yyidx ++;
if ($this->yyidx >= self::YYSTACKDEPTH) {
- $this->yyidx--;
- if (self::$yyTraceFILE) {
- fprintf(self::$yyTraceFILE, "%sStack Overflow!\n", self::$yyTracePrompt);
+ $this->yyidx --;
+ if ($this->yyTraceFILE) {
+ fprintf($this->yyTraceFILE, "%sStack Overflow!\n", $this->yyTracePrompt);
}
while ($this->yyidx >= 0) {
$this->yy_pop_parser_stack();
}
-#line 84 "smarty_internal_templateparser.y"
+ #line 85 "smarty_internal_templateparser.y"
+
+ $this->internalError = true;
+ $this->compiler->trigger_template_error("Stack overflow in template parser");
+ #line 1707 "smarty_internal_templateparser.php"
- $this->internalError = true;
- $this->compiler->trigger_template_error("Stack overflow in template parser");
-#line 1733 "smarty_internal_templateparser.php"
return;
}
$yytos = new TP_yyStackEntry;
$yytos->major = $yyMajor;
$yytos->minor = $yypMinor;
array_push($this->yystack, $yytos);
- if (self::$yyTraceFILE && $this->yyidx > 0) {
- fprintf(self::$yyTraceFILE, "%sShift %d\n", self::$yyTracePrompt,
- $yyNewState);
- fprintf(self::$yyTraceFILE, "%sStack:", self::$yyTracePrompt);
- for($i = 1; $i <= $this->yyidx; $i++) {
- fprintf(self::$yyTraceFILE, " %s",
- $this->yyTokenName[$this->yystack[$i]->major]);
+ if ($this->yyTraceFILE && $this->yyidx > 0) {
+ fprintf($this->yyTraceFILE, "%sShift %d\n", $this->yyTracePrompt,
+ $yyNewState);
+ fprintf($this->yyTraceFILE, "%sStack:", $this->yyTracePrompt);
+ for ($i = 1; $i <= $this->yyidx; $i ++) {
+ fprintf($this->yyTraceFILE, " %s",
+ $this->yyTokenName[$this->yystack[$i]->major]);
}
- fwrite(self::$yyTraceFILE,"\n");
+ fwrite($this->yyTraceFILE, "\n");
}
}
- static public $yyRuleInfo = array(
- array( 'lhs' => 82, 'rhs' => 1 ),
- array( 'lhs' => 83, 'rhs' => 1 ),
- array( 'lhs' => 83, 'rhs' => 2 ),
- array( 'lhs' => 83, 'rhs' => 0 ),
- array( 'lhs' => 84, 'rhs' => 1 ),
- array( 'lhs' => 84, 'rhs' => 1 ),
- array( 'lhs' => 84, 'rhs' => 1 ),
- array( 'lhs' => 84, 'rhs' => 1 ),
- array( 'lhs' => 84, 'rhs' => 1 ),
- array( 'lhs' => 84, 'rhs' => 1 ),
- array( 'lhs' => 84, 'rhs' => 1 ),
- array( 'lhs' => 84, 'rhs' => 1 ),
- array( 'lhs' => 84, 'rhs' => 1 ),
- array( 'lhs' => 84, 'rhs' => 1 ),
- array( 'lhs' => 84, 'rhs' => 1 ),
- array( 'lhs' => 84, 'rhs' => 1 ),
- array( 'lhs' => 86, 'rhs' => 2 ),
- array( 'lhs' => 86, 'rhs' => 3 ),
- array( 'lhs' => 87, 'rhs' => 2 ),
- array( 'lhs' => 87, 'rhs' => 0 ),
- array( 'lhs' => 88, 'rhs' => 1 ),
- array( 'lhs' => 88, 'rhs' => 1 ),
- array( 'lhs' => 88, 'rhs' => 1 ),
- array( 'lhs' => 88, 'rhs' => 1 ),
- array( 'lhs' => 88, 'rhs' => 1 ),
- array( 'lhs' => 88, 'rhs' => 1 ),
- array( 'lhs' => 88, 'rhs' => 1 ),
- array( 'lhs' => 85, 'rhs' => 3 ),
- array( 'lhs' => 85, 'rhs' => 5 ),
- array( 'lhs' => 85, 'rhs' => 4 ),
- array( 'lhs' => 85, 'rhs' => 5 ),
- array( 'lhs' => 85, 'rhs' => 4 ),
- array( 'lhs' => 85, 'rhs' => 6 ),
- array( 'lhs' => 85, 'rhs' => 6 ),
- array( 'lhs' => 85, 'rhs' => 7 ),
- array( 'lhs' => 85, 'rhs' => 6 ),
- array( 'lhs' => 85, 'rhs' => 4 ),
- array( 'lhs' => 85, 'rhs' => 3 ),
- array( 'lhs' => 85, 'rhs' => 6 ),
- array( 'lhs' => 85, 'rhs' => 5 ),
- array( 'lhs' => 85, 'rhs' => 7 ),
- array( 'lhs' => 85, 'rhs' => 3 ),
- array( 'lhs' => 85, 'rhs' => 4 ),
- array( 'lhs' => 85, 'rhs' => 3 ),
- array( 'lhs' => 85, 'rhs' => 4 ),
- array( 'lhs' => 85, 'rhs' => 12 ),
- array( 'lhs' => 98, 'rhs' => 2 ),
- array( 'lhs' => 98, 'rhs' => 1 ),
- array( 'lhs' => 85, 'rhs' => 6 ),
- array( 'lhs' => 85, 'rhs' => 8 ),
- array( 'lhs' => 85, 'rhs' => 3 ),
- array( 'lhs' => 85, 'rhs' => 8 ),
- array( 'lhs' => 85, 'rhs' => 11 ),
- array( 'lhs' => 85, 'rhs' => 8 ),
- array( 'lhs' => 85, 'rhs' => 11 ),
- array( 'lhs' => 85, 'rhs' => 4 ),
- array( 'lhs' => 85, 'rhs' => 5 ),
- array( 'lhs' => 85, 'rhs' => 1 ),
- array( 'lhs' => 85, 'rhs' => 3 ),
- array( 'lhs' => 85, 'rhs' => 4 ),
- array( 'lhs' => 85, 'rhs' => 5 ),
- array( 'lhs' => 85, 'rhs' => 6 ),
- array( 'lhs' => 91, 'rhs' => 2 ),
- array( 'lhs' => 91, 'rhs' => 1 ),
- array( 'lhs' => 91, 'rhs' => 0 ),
- array( 'lhs' => 100, 'rhs' => 4 ),
- array( 'lhs' => 100, 'rhs' => 2 ),
- array( 'lhs' => 100, 'rhs' => 2 ),
- array( 'lhs' => 100, 'rhs' => 2 ),
- array( 'lhs' => 100, 'rhs' => 2 ),
- array( 'lhs' => 100, 'rhs' => 2 ),
- array( 'lhs' => 100, 'rhs' => 4 ),
- array( 'lhs' => 95, 'rhs' => 1 ),
- array( 'lhs' => 95, 'rhs' => 3 ),
- array( 'lhs' => 94, 'rhs' => 4 ),
- array( 'lhs' => 94, 'rhs' => 3 ),
- array( 'lhs' => 94, 'rhs' => 3 ),
- array( 'lhs' => 92, 'rhs' => 1 ),
- array( 'lhs' => 92, 'rhs' => 1 ),
- array( 'lhs' => 92, 'rhs' => 4 ),
- array( 'lhs' => 92, 'rhs' => 3 ),
- array( 'lhs' => 92, 'rhs' => 3 ),
- array( 'lhs' => 92, 'rhs' => 3 ),
- array( 'lhs' => 92, 'rhs' => 1 ),
- array( 'lhs' => 92, 'rhs' => 2 ),
- array( 'lhs' => 92, 'rhs' => 3 ),
- array( 'lhs' => 92, 'rhs' => 3 ),
- array( 'lhs' => 92, 'rhs' => 3 ),
- array( 'lhs' => 92, 'rhs' => 3 ),
- array( 'lhs' => 92, 'rhs' => 3 ),
- array( 'lhs' => 92, 'rhs' => 3 ),
- array( 'lhs' => 92, 'rhs' => 2 ),
- array( 'lhs' => 92, 'rhs' => 2 ),
- array( 'lhs' => 92, 'rhs' => 3 ),
- array( 'lhs' => 92, 'rhs' => 3 ),
- array( 'lhs' => 92, 'rhs' => 2 ),
- array( 'lhs' => 92, 'rhs' => 2 ),
- array( 'lhs' => 92, 'rhs' => 3 ),
- array( 'lhs' => 92, 'rhs' => 3 ),
- array( 'lhs' => 92, 'rhs' => 3 ),
- array( 'lhs' => 92, 'rhs' => 3 ),
- array( 'lhs' => 101, 'rhs' => 8 ),
- array( 'lhs' => 101, 'rhs' => 7 ),
- array( 'lhs' => 89, 'rhs' => 1 ),
- array( 'lhs' => 89, 'rhs' => 2 ),
- array( 'lhs' => 89, 'rhs' => 2 ),
- array( 'lhs' => 89, 'rhs' => 2 ),
- array( 'lhs' => 89, 'rhs' => 2 ),
- array( 'lhs' => 89, 'rhs' => 1 ),
- array( 'lhs' => 89, 'rhs' => 1 ),
- array( 'lhs' => 89, 'rhs' => 3 ),
- array( 'lhs' => 89, 'rhs' => 2 ),
- array( 'lhs' => 89, 'rhs' => 2 ),
- array( 'lhs' => 89, 'rhs' => 1 ),
- array( 'lhs' => 89, 'rhs' => 1 ),
- array( 'lhs' => 89, 'rhs' => 3 ),
- array( 'lhs' => 89, 'rhs' => 1 ),
- array( 'lhs' => 89, 'rhs' => 1 ),
- array( 'lhs' => 89, 'rhs' => 3 ),
- array( 'lhs' => 89, 'rhs' => 3 ),
- array( 'lhs' => 89, 'rhs' => 1 ),
- array( 'lhs' => 89, 'rhs' => 2 ),
- array( 'lhs' => 105, 'rhs' => 1 ),
- array( 'lhs' => 105, 'rhs' => 4 ),
- array( 'lhs' => 105, 'rhs' => 1 ),
- array( 'lhs' => 105, 'rhs' => 3 ),
- array( 'lhs' => 105, 'rhs' => 3 ),
- array( 'lhs' => 93, 'rhs' => 3 ),
- array( 'lhs' => 110, 'rhs' => 2 ),
- array( 'lhs' => 110, 'rhs' => 0 ),
- array( 'lhs' => 111, 'rhs' => 3 ),
- array( 'lhs' => 111, 'rhs' => 5 ),
- array( 'lhs' => 111, 'rhs' => 2 ),
- array( 'lhs' => 111, 'rhs' => 2 ),
- array( 'lhs' => 111, 'rhs' => 4 ),
- array( 'lhs' => 111, 'rhs' => 3 ),
- array( 'lhs' => 111, 'rhs' => 5 ),
- array( 'lhs' => 111, 'rhs' => 3 ),
- array( 'lhs' => 111, 'rhs' => 2 ),
- array( 'lhs' => 97, 'rhs' => 1 ),
- array( 'lhs' => 97, 'rhs' => 2 ),
- array( 'lhs' => 112, 'rhs' => 1 ),
- array( 'lhs' => 112, 'rhs' => 3 ),
- array( 'lhs' => 109, 'rhs' => 2 ),
- array( 'lhs' => 113, 'rhs' => 1 ),
- array( 'lhs' => 113, 'rhs' => 2 ),
- array( 'lhs' => 114, 'rhs' => 3 ),
- array( 'lhs' => 114, 'rhs' => 4 ),
- array( 'lhs' => 114, 'rhs' => 5 ),
- array( 'lhs' => 114, 'rhs' => 6 ),
- array( 'lhs' => 114, 'rhs' => 2 ),
- array( 'lhs' => 106, 'rhs' => 4 ),
- array( 'lhs' => 115, 'rhs' => 4 ),
- array( 'lhs' => 115, 'rhs' => 5 ),
- array( 'lhs' => 116, 'rhs' => 3 ),
- array( 'lhs' => 116, 'rhs' => 1 ),
- array( 'lhs' => 116, 'rhs' => 0 ),
- array( 'lhs' => 90, 'rhs' => 3 ),
- array( 'lhs' => 90, 'rhs' => 2 ),
- array( 'lhs' => 117, 'rhs' => 3 ),
- array( 'lhs' => 117, 'rhs' => 2 ),
- array( 'lhs' => 99, 'rhs' => 2 ),
- array( 'lhs' => 99, 'rhs' => 0 ),
- array( 'lhs' => 118, 'rhs' => 2 ),
- array( 'lhs' => 118, 'rhs' => 2 ),
- array( 'lhs' => 108, 'rhs' => 1 ),
- array( 'lhs' => 108, 'rhs' => 2 ),
- array( 'lhs' => 108, 'rhs' => 1 ),
- array( 'lhs' => 108, 'rhs' => 3 ),
- array( 'lhs' => 108, 'rhs' => 4 ),
- array( 'lhs' => 103, 'rhs' => 1 ),
- array( 'lhs' => 103, 'rhs' => 1 ),
- array( 'lhs' => 103, 'rhs' => 1 ),
- array( 'lhs' => 103, 'rhs' => 1 ),
- array( 'lhs' => 103, 'rhs' => 1 ),
- array( 'lhs' => 103, 'rhs' => 1 ),
- array( 'lhs' => 103, 'rhs' => 1 ),
- array( 'lhs' => 103, 'rhs' => 1 ),
- array( 'lhs' => 103, 'rhs' => 1 ),
- array( 'lhs' => 104, 'rhs' => 1 ),
- array( 'lhs' => 104, 'rhs' => 1 ),
- array( 'lhs' => 104, 'rhs' => 1 ),
- array( 'lhs' => 102, 'rhs' => 3 ),
- array( 'lhs' => 119, 'rhs' => 1 ),
- array( 'lhs' => 119, 'rhs' => 3 ),
- array( 'lhs' => 119, 'rhs' => 0 ),
- array( 'lhs' => 120, 'rhs' => 3 ),
- array( 'lhs' => 120, 'rhs' => 3 ),
- array( 'lhs' => 120, 'rhs' => 1 ),
- array( 'lhs' => 107, 'rhs' => 2 ),
- array( 'lhs' => 107, 'rhs' => 3 ),
- array( 'lhs' => 121, 'rhs' => 2 ),
- array( 'lhs' => 121, 'rhs' => 1 ),
- array( 'lhs' => 122, 'rhs' => 3 ),
- array( 'lhs' => 122, 'rhs' => 3 ),
- array( 'lhs' => 122, 'rhs' => 1 ),
- array( 'lhs' => 122, 'rhs' => 3 ),
- array( 'lhs' => 122, 'rhs' => 3 ),
- array( 'lhs' => 122, 'rhs' => 1 ),
- array( 'lhs' => 122, 'rhs' => 1 ),
- array( 'lhs' => 96, 'rhs' => 1 ),
- array( 'lhs' => 96, 'rhs' => 0 ),
+ public static $yyRuleInfo = array(
+ array('lhs' => 83, 'rhs' => 1),
+ array('lhs' => 84, 'rhs' => 1),
+ array('lhs' => 84, 'rhs' => 2),
+ array('lhs' => 84, 'rhs' => 0),
+ array('lhs' => 85, 'rhs' => 2),
+ array('lhs' => 85, 'rhs' => 1),
+ array('lhs' => 85, 'rhs' => 1),
+ array('lhs' => 85, 'rhs' => 1),
+ array('lhs' => 85, 'rhs' => 1),
+ array('lhs' => 85, 'rhs' => 1),
+ array('lhs' => 85, 'rhs' => 1),
+ array('lhs' => 85, 'rhs' => 1),
+ array('lhs' => 85, 'rhs' => 1),
+ array('lhs' => 85, 'rhs' => 1),
+ array('lhs' => 85, 'rhs' => 1),
+ array('lhs' => 85, 'rhs' => 1),
+ array('lhs' => 85, 'rhs' => 1),
+ array('lhs' => 87, 'rhs' => 2),
+ array('lhs' => 87, 'rhs' => 3),
+ array('lhs' => 88, 'rhs' => 2),
+ array('lhs' => 88, 'rhs' => 0),
+ array('lhs' => 89, 'rhs' => 1),
+ array('lhs' => 89, 'rhs' => 1),
+ array('lhs' => 89, 'rhs' => 1),
+ array('lhs' => 89, 'rhs' => 1),
+ array('lhs' => 89, 'rhs' => 1),
+ array('lhs' => 89, 'rhs' => 1),
+ array('lhs' => 89, 'rhs' => 1),
+ array('lhs' => 86, 'rhs' => 2),
+ array('lhs' => 86, 'rhs' => 4),
+ array('lhs' => 86, 'rhs' => 3),
+ array('lhs' => 86, 'rhs' => 4),
+ array('lhs' => 86, 'rhs' => 3),
+ array('lhs' => 86, 'rhs' => 5),
+ array('lhs' => 86, 'rhs' => 5),
+ array('lhs' => 86, 'rhs' => 6),
+ array('lhs' => 86, 'rhs' => 5),
+ array('lhs' => 86, 'rhs' => 3),
+ array('lhs' => 86, 'rhs' => 2),
+ array('lhs' => 86, 'rhs' => 5),
+ array('lhs' => 86, 'rhs' => 4),
+ array('lhs' => 86, 'rhs' => 6),
+ array('lhs' => 86, 'rhs' => 2),
+ array('lhs' => 86, 'rhs' => 3),
+ array('lhs' => 86, 'rhs' => 2),
+ array('lhs' => 86, 'rhs' => 3),
+ array('lhs' => 86, 'rhs' => 11),
+ array('lhs' => 99, 'rhs' => 2),
+ array('lhs' => 99, 'rhs' => 1),
+ array('lhs' => 86, 'rhs' => 5),
+ array('lhs' => 86, 'rhs' => 7),
+ array('lhs' => 86, 'rhs' => 2),
+ array('lhs' => 86, 'rhs' => 7),
+ array('lhs' => 86, 'rhs' => 10),
+ array('lhs' => 86, 'rhs' => 7),
+ array('lhs' => 86, 'rhs' => 10),
+ array('lhs' => 86, 'rhs' => 3),
+ array('lhs' => 86, 'rhs' => 4),
+ array('lhs' => 86, 'rhs' => 2),
+ array('lhs' => 86, 'rhs' => 2),
+ array('lhs' => 86, 'rhs' => 3),
+ array('lhs' => 86, 'rhs' => 4),
+ array('lhs' => 86, 'rhs' => 5),
+ array('lhs' => 92, 'rhs' => 2),
+ array('lhs' => 92, 'rhs' => 1),
+ array('lhs' => 92, 'rhs' => 0),
+ array('lhs' => 101, 'rhs' => 4),
+ array('lhs' => 101, 'rhs' => 2),
+ array('lhs' => 101, 'rhs' => 2),
+ array('lhs' => 101, 'rhs' => 2),
+ array('lhs' => 101, 'rhs' => 2),
+ array('lhs' => 101, 'rhs' => 2),
+ array('lhs' => 101, 'rhs' => 4),
+ array('lhs' => 96, 'rhs' => 1),
+ array('lhs' => 96, 'rhs' => 3),
+ array('lhs' => 95, 'rhs' => 4),
+ array('lhs' => 95, 'rhs' => 3),
+ array('lhs' => 95, 'rhs' => 3),
+ array('lhs' => 93, 'rhs' => 1),
+ array('lhs' => 93, 'rhs' => 1),
+ array('lhs' => 93, 'rhs' => 4),
+ array('lhs' => 93, 'rhs' => 3),
+ array('lhs' => 93, 'rhs' => 3),
+ array('lhs' => 93, 'rhs' => 3),
+ array('lhs' => 93, 'rhs' => 1),
+ array('lhs' => 93, 'rhs' => 2),
+ array('lhs' => 93, 'rhs' => 3),
+ array('lhs' => 93, 'rhs' => 3),
+ array('lhs' => 93, 'rhs' => 3),
+ array('lhs' => 93, 'rhs' => 3),
+ array('lhs' => 93, 'rhs' => 3),
+ array('lhs' => 93, 'rhs' => 3),
+ array('lhs' => 93, 'rhs' => 2),
+ array('lhs' => 93, 'rhs' => 2),
+ array('lhs' => 93, 'rhs' => 3),
+ array('lhs' => 93, 'rhs' => 3),
+ array('lhs' => 93, 'rhs' => 2),
+ array('lhs' => 93, 'rhs' => 2),
+ array('lhs' => 93, 'rhs' => 3),
+ array('lhs' => 93, 'rhs' => 3),
+ array('lhs' => 93, 'rhs' => 3),
+ array('lhs' => 93, 'rhs' => 3),
+ array('lhs' => 102, 'rhs' => 8),
+ array('lhs' => 102, 'rhs' => 7),
+ array('lhs' => 90, 'rhs' => 1),
+ array('lhs' => 90, 'rhs' => 2),
+ array('lhs' => 90, 'rhs' => 2),
+ array('lhs' => 90, 'rhs' => 2),
+ array('lhs' => 90, 'rhs' => 2),
+ array('lhs' => 90, 'rhs' => 1),
+ array('lhs' => 90, 'rhs' => 1),
+ array('lhs' => 90, 'rhs' => 3),
+ array('lhs' => 90, 'rhs' => 2),
+ array('lhs' => 90, 'rhs' => 2),
+ array('lhs' => 90, 'rhs' => 1),
+ array('lhs' => 90, 'rhs' => 1),
+ array('lhs' => 90, 'rhs' => 3),
+ array('lhs' => 90, 'rhs' => 1),
+ array('lhs' => 90, 'rhs' => 1),
+ array('lhs' => 90, 'rhs' => 3),
+ array('lhs' => 90, 'rhs' => 3),
+ array('lhs' => 90, 'rhs' => 2),
+ array('lhs' => 90, 'rhs' => 2),
+ array('lhs' => 106, 'rhs' => 1),
+ array('lhs' => 106, 'rhs' => 4),
+ array('lhs' => 106, 'rhs' => 1),
+ array('lhs' => 106, 'rhs' => 3),
+ array('lhs' => 106, 'rhs' => 4),
+ array('lhs' => 106, 'rhs' => 3),
+ array('lhs' => 106, 'rhs' => 4),
+ array('lhs' => 94, 'rhs' => 3),
+ array('lhs' => 111, 'rhs' => 2),
+ array('lhs' => 111, 'rhs' => 0),
+ array('lhs' => 112, 'rhs' => 3),
+ array('lhs' => 112, 'rhs' => 5),
+ array('lhs' => 112, 'rhs' => 2),
+ array('lhs' => 112, 'rhs' => 2),
+ array('lhs' => 112, 'rhs' => 4),
+ array('lhs' => 112, 'rhs' => 3),
+ array('lhs' => 112, 'rhs' => 5),
+ array('lhs' => 112, 'rhs' => 3),
+ array('lhs' => 112, 'rhs' => 2),
+ array('lhs' => 98, 'rhs' => 1),
+ array('lhs' => 98, 'rhs' => 2),
+ array('lhs' => 113, 'rhs' => 1),
+ array('lhs' => 113, 'rhs' => 3),
+ array('lhs' => 110, 'rhs' => 2),
+ array('lhs' => 114, 'rhs' => 1),
+ array('lhs' => 114, 'rhs' => 2),
+ array('lhs' => 115, 'rhs' => 3),
+ array('lhs' => 115, 'rhs' => 4),
+ array('lhs' => 115, 'rhs' => 5),
+ array('lhs' => 115, 'rhs' => 6),
+ array('lhs' => 115, 'rhs' => 2),
+ array('lhs' => 107, 'rhs' => 4),
+ array('lhs' => 116, 'rhs' => 4),
+ array('lhs' => 116, 'rhs' => 5),
+ array('lhs' => 117, 'rhs' => 3),
+ array('lhs' => 117, 'rhs' => 1),
+ array('lhs' => 117, 'rhs' => 0),
+ array('lhs' => 91, 'rhs' => 3),
+ array('lhs' => 91, 'rhs' => 2),
+ array('lhs' => 118, 'rhs' => 3),
+ array('lhs' => 118, 'rhs' => 2),
+ array('lhs' => 100, 'rhs' => 2),
+ array('lhs' => 100, 'rhs' => 0),
+ array('lhs' => 119, 'rhs' => 2),
+ array('lhs' => 119, 'rhs' => 2),
+ array('lhs' => 109, 'rhs' => 1),
+ array('lhs' => 109, 'rhs' => 2),
+ array('lhs' => 109, 'rhs' => 1),
+ array('lhs' => 109, 'rhs' => 3),
+ array('lhs' => 109, 'rhs' => 4),
+ array('lhs' => 104, 'rhs' => 1),
+ array('lhs' => 104, 'rhs' => 1),
+ array('lhs' => 104, 'rhs' => 1),
+ array('lhs' => 104, 'rhs' => 1),
+ array('lhs' => 104, 'rhs' => 1),
+ array('lhs' => 104, 'rhs' => 1),
+ array('lhs' => 104, 'rhs' => 1),
+ array('lhs' => 104, 'rhs' => 1),
+ array('lhs' => 104, 'rhs' => 1),
+ array('lhs' => 105, 'rhs' => 1),
+ array('lhs' => 105, 'rhs' => 1),
+ array('lhs' => 105, 'rhs' => 1),
+ array('lhs' => 103, 'rhs' => 3),
+ array('lhs' => 120, 'rhs' => 1),
+ array('lhs' => 120, 'rhs' => 3),
+ array('lhs' => 120, 'rhs' => 0),
+ array('lhs' => 121, 'rhs' => 3),
+ array('lhs' => 121, 'rhs' => 3),
+ array('lhs' => 121, 'rhs' => 1),
+ array('lhs' => 108, 'rhs' => 2),
+ array('lhs' => 108, 'rhs' => 3),
+ array('lhs' => 122, 'rhs' => 2),
+ array('lhs' => 122, 'rhs' => 1),
+ array('lhs' => 123, 'rhs' => 3),
+ array('lhs' => 123, 'rhs' => 3),
+ array('lhs' => 123, 'rhs' => 1),
+ array('lhs' => 123, 'rhs' => 3),
+ array('lhs' => 123, 'rhs' => 3),
+ array('lhs' => 123, 'rhs' => 2),
+ array('lhs' => 123, 'rhs' => 1),
+ array('lhs' => 97, 'rhs' => 1),
+ array('lhs' => 97, 'rhs' => 0),
);
- static public $yyReduceMap = array(
- 0 => 0,
- 1 => 1,
- 2 => 1,
- 4 => 4,
- 5 => 5,
- 6 => 6,
- 7 => 7,
- 8 => 8,
- 9 => 9,
- 10 => 10,
- 11 => 11,
- 12 => 12,
- 13 => 13,
- 14 => 14,
- 15 => 15,
- 16 => 16,
- 19 => 16,
- 201 => 16,
- 17 => 17,
- 76 => 17,
- 18 => 18,
- 104 => 18,
- 106 => 18,
- 107 => 18,
- 128 => 18,
- 166 => 18,
- 20 => 20,
- 21 => 20,
- 47 => 20,
- 69 => 20,
- 70 => 20,
- 77 => 20,
- 78 => 20,
- 83 => 20,
- 103 => 20,
- 108 => 20,
- 109 => 20,
- 114 => 20,
- 116 => 20,
- 117 => 20,
- 124 => 20,
- 139 => 20,
- 165 => 20,
- 167 => 20,
- 183 => 20,
- 188 => 20,
- 200 => 20,
- 22 => 22,
- 23 => 22,
- 24 => 24,
- 25 => 25,
- 26 => 26,
- 27 => 27,
- 28 => 28,
- 29 => 29,
- 31 => 29,
- 30 => 30,
- 32 => 32,
- 33 => 32,
- 34 => 34,
- 35 => 35,
- 36 => 36,
- 37 => 37,
- 38 => 38,
- 39 => 39,
- 40 => 40,
- 41 => 41,
- 42 => 42,
- 44 => 42,
- 43 => 43,
- 45 => 45,
- 46 => 46,
- 48 => 48,
- 49 => 49,
- 50 => 50,
- 51 => 51,
- 52 => 52,
- 53 => 53,
- 54 => 54,
- 55 => 55,
- 56 => 56,
- 57 => 57,
- 58 => 58,
- 59 => 59,
- 60 => 60,
- 61 => 61,
- 62 => 62,
- 63 => 63,
- 72 => 63,
- 155 => 63,
- 159 => 63,
- 163 => 63,
- 164 => 63,
- 64 => 64,
- 156 => 64,
+ public static $yyReduceMap = array(
+ 0 => 0,
+ 1 => 1,
+ 2 => 1,
+ 4 => 4,
+ 5 => 5,
+ 6 => 6,
+ 7 => 7,
+ 8 => 8,
+ 9 => 9,
+ 10 => 10,
+ 11 => 11,
+ 12 => 12,
+ 13 => 13,
+ 14 => 14,
+ 15 => 15,
+ 16 => 16,
+ 17 => 17,
+ 20 => 17,
+ 204 => 17,
+ 18 => 18,
+ 77 => 18,
+ 19 => 19,
+ 105 => 19,
+ 107 => 19,
+ 108 => 19,
+ 131 => 19,
+ 169 => 19,
+ 21 => 21,
+ 22 => 21,
+ 48 => 21,
+ 70 => 21,
+ 71 => 21,
+ 78 => 21,
+ 79 => 21,
+ 84 => 21,
+ 104 => 21,
+ 109 => 21,
+ 110 => 21,
+ 115 => 21,
+ 117 => 21,
+ 118 => 21,
+ 125 => 21,
+ 142 => 21,
+ 168 => 21,
+ 170 => 21,
+ 186 => 21,
+ 191 => 21,
+ 203 => 21,
+ 23 => 23,
+ 24 => 23,
+ 25 => 25,
+ 26 => 26,
+ 27 => 27,
+ 28 => 28,
+ 29 => 29,
+ 30 => 30,
+ 32 => 30,
+ 31 => 31,
+ 33 => 33,
+ 34 => 33,
+ 35 => 35,
+ 36 => 36,
+ 37 => 37,
+ 38 => 38,
+ 39 => 39,
+ 40 => 40,
+ 41 => 41,
+ 42 => 42,
+ 43 => 43,
+ 45 => 43,
+ 44 => 44,
+ 46 => 46,
+ 47 => 47,
+ 49 => 49,
+ 50 => 50,
+ 51 => 51,
+ 52 => 52,
+ 54 => 52,
+ 53 => 53,
+ 55 => 53,
+ 56 => 56,
+ 57 => 57,
+ 58 => 58,
+ 59 => 59,
+ 60 => 60,
+ 61 => 61,
+ 62 => 62,
+ 63 => 63,
+ 64 => 64,
+ 73 => 64,
+ 158 => 64,
162 => 64,
- 65 => 65,
- 66 => 66,
- 67 => 66,
- 68 => 68,
- 71 => 71,
- 73 => 73,
- 74 => 74,
- 75 => 74,
- 79 => 79,
- 80 => 80,
- 81 => 80,
- 82 => 80,
- 84 => 84,
- 121 => 84,
- 85 => 85,
- 88 => 85,
- 99 => 85,
- 86 => 86,
- 87 => 87,
- 89 => 89,
- 90 => 90,
- 91 => 91,
- 96 => 91,
- 92 => 92,
- 95 => 92,
- 93 => 93,
- 98 => 93,
- 94 => 94,
- 97 => 94,
- 100 => 100,
+ 166 => 64,
+ 167 => 64,
+ 65 => 65,
+ 159 => 65,
+ 165 => 65,
+ 66 => 66,
+ 67 => 67,
+ 68 => 67,
+ 69 => 69,
+ 72 => 72,
+ 74 => 74,
+ 75 => 75,
+ 76 => 75,
+ 80 => 80,
+ 81 => 81,
+ 82 => 81,
+ 83 => 81,
+ 85 => 85,
+ 122 => 85,
+ 86 => 86,
+ 89 => 86,
+ 100 => 86,
+ 87 => 87,
+ 88 => 88,
+ 90 => 90,
+ 91 => 91,
+ 92 => 92,
+ 97 => 92,
+ 93 => 93,
+ 96 => 93,
+ 94 => 94,
+ 99 => 94,
+ 95 => 95,
+ 98 => 95,
101 => 101,
102 => 102,
- 105 => 105,
- 110 => 110,
+ 103 => 103,
+ 106 => 106,
111 => 111,
112 => 112,
113 => 113,
- 115 => 115,
- 118 => 118,
+ 114 => 114,
+ 116 => 116,
119 => 119,
120 => 120,
- 122 => 122,
+ 121 => 121,
123 => 123,
- 125 => 125,
+ 124 => 124,
126 => 126,
127 => 127,
+ 128 => 128,
129 => 129,
- 185 => 129,
130 => 130,
- 131 => 131,
132 => 132,
+ 188 => 132,
133 => 133,
134 => 134,
- 137 => 134,
135 => 135,
136 => 136,
+ 137 => 137,
+ 140 => 137,
138 => 138,
- 140 => 140,
+ 139 => 139,
141 => 141,
- 142 => 142,
143 => 143,
144 => 144,
145 => 145,
152 => 152,
153 => 153,
154 => 154,
+ 155 => 155,
+ 156 => 156,
157 => 157,
- 158 => 158,
160 => 160,
161 => 161,
- 168 => 168,
- 169 => 169,
- 170 => 170,
+ 163 => 163,
+ 164 => 164,
171 => 171,
172 => 172,
173 => 173,
180 => 180,
181 => 181,
182 => 182,
+ 183 => 183,
184 => 184,
- 186 => 186,
+ 185 => 185,
187 => 187,
189 => 189,
190 => 190,
- 191 => 191,
192 => 192,
193 => 193,
- 194 => 193,
- 196 => 193,
+ 194 => 194,
195 => 195,
- 197 => 197,
+ 196 => 196,
+ 197 => 196,
+ 199 => 196,
198 => 198,
- 199 => 199,
+ 200 => 200,
+ 201 => 201,
+ 202 => 202,
);
-#line 95 "smarty_internal_templateparser.y"
- function yy_r0(){
- $this->_retvalue = $this->root_buffer->to_smarty_php();
- }
-#line 2165 "smarty_internal_templateparser.php"
-#line 103 "smarty_internal_templateparser.y"
- function yy_r1(){
- $this->current_buffer->append_subtree($this->yystack[$this->yyidx + 0]->minor);
- }
-#line 2170 "smarty_internal_templateparser.php"
-#line 119 "smarty_internal_templateparser.y"
- function yy_r4(){
- if ($this->compiler->has_code) {
- $tmp =''; foreach ($this->compiler->prefix_code as $code) {$tmp.=$code;} $this->compiler->prefix_code=array();
- $this->_retvalue = new _smarty_tag($this, $this->compiler->processNocacheCode($tmp.$this->yystack[$this->yyidx + 0]->minor,true));
- } else {
- $this->_retvalue = new _smarty_tag($this, $this->yystack[$this->yyidx + 0]->minor);
- }
- $this->compiler->has_variable_string = false;
- $this->block_nesting_level = count($this->compiler->_tag_stack);
- }
-#line 2182 "smarty_internal_templateparser.php"
-#line 131 "smarty_internal_templateparser.y"
- function yy_r5(){
- $this->_retvalue = new _smarty_tag($this, '');
- }
-#line 2187 "smarty_internal_templateparser.php"
-#line 136 "smarty_internal_templateparser.y"
- function yy_r6(){
- $this->_retvalue = new _smarty_text($this, $this->yystack[$this->yyidx + 0]->minor);
- }
-#line 2192 "smarty_internal_templateparser.php"
-#line 141 "smarty_internal_templateparser.y"
- function yy_r7(){
- if ($this->php_handling == Smarty::PHP_PASSTHRU) {
- $this->_retvalue = new _smarty_text($this, self::escape_start_tag($this->yystack[$this->yyidx + 0]->minor));
- } elseif ($this->php_handling == Smarty::PHP_QUOTE) {
- $this->_retvalue = new _smarty_text($this, htmlspecialchars($this->yystack[$this->yyidx + 0]->minor, ENT_QUOTES));
- } elseif ($this->php_handling == Smarty::PHP_ALLOW) {
- if (!($this->smarty instanceof SmartyBC)) {
- $this->compiler->trigger_template_error (self::Err3);
+
+ #line 96 "smarty_internal_templateparser.y"
+ function yy_r0()
+ {
+ $this->_retvalue = $this->root_buffer->to_smarty_php();
+ }
+ #line 2146 "smarty_internal_templateparser.php"
+ #line 104 "smarty_internal_templateparser.y"
+ function yy_r1()
+ {
+ if ($this->yystack[$this->yyidx + 0]->minor != null) {
+ $this->current_buffer->append_subtree($this->yystack[$this->yyidx + 0]->minor);
+ }
+ }
+ #line 2153 "smarty_internal_templateparser.php"
+ #line 124 "smarty_internal_templateparser.y"
+ function yy_r4()
+ {
+ if ($this->compiler->has_code) {
+ $tmp = '';
+ foreach ($this->compiler->prefix_code as $code) {
+ $tmp .= $code;
+ }
+ $this->compiler->prefix_code = array();
+ $this->_retvalue = new _smarty_tag($this, $this->compiler->processNocacheCode($tmp . $this->yystack[$this->yyidx + - 1]->minor, true));
+ } else {
+ $this->_retvalue = null;
+ }
+ $this->compiler->has_variable_string = false;
+ $this->block_nesting_level = count($this->compiler->_tag_stack);
+ }
+ #line 2165 "smarty_internal_templateparser.php"
+ #line 136 "smarty_internal_templateparser.y"
+ function yy_r5()
+ {
+ $this->_retvalue = null;
+ }
+ #line 2170 "smarty_internal_templateparser.php"
+ #line 141 "smarty_internal_templateparser.y"
+ function yy_r6()
+ {
+ $this->_retvalue = new _smarty_text($this, $this->yystack[$this->yyidx + 0]->minor);
+ }
+ #line 2175 "smarty_internal_templateparser.php"
+ #line 146 "smarty_internal_templateparser.y"
+ function yy_r7()
+ {
+ if ($this->php_handling == Smarty::PHP_PASSTHRU) {
+ $this->_retvalue = new _smarty_text($this, self::escape_start_tag($this->yystack[$this->yyidx + 0]->minor));
+ } elseif ($this->php_handling == Smarty::PHP_QUOTE) {
+ $this->_retvalue = new _smarty_text($this, htmlspecialchars($this->yystack[$this->yyidx + 0]->minor, ENT_QUOTES));
+ } elseif ($this->php_handling == Smarty::PHP_ALLOW) {
+ if (!($this->smarty instanceof SmartyBC)) {
+ $this->compiler->trigger_template_error(self::Err3);
+ }
+ $this->_retvalue = new _smarty_text($this, $this->compiler->processNocacheCode('<?php', true));
+ } elseif ($this->php_handling == Smarty::PHP_REMOVE) {
+ $this->_retvalue = null;
+ }
+ }
+ #line 2191 "smarty_internal_templateparser.php"
+ #line 162 "smarty_internal_templateparser.y"
+ function yy_r8()
+ {
+ if ($this->is_xml) {
+ $this->compiler->tag_nocache = true;
+ $this->is_xml = false;
+ $save = $this->template->has_nocache_code;
+ $this->_retvalue = new _smarty_text($this, $this->compiler->processNocacheCode("<?php echo '?>';?>\n", $this->compiler, true));
+ $this->template->has_nocache_code = $save;
+ } elseif ($this->php_handling == Smarty::PHP_PASSTHRU) {
+ $this->_retvalue = new _smarty_text($this, '?<?php ?>>');
+ } elseif ($this->php_handling == Smarty::PHP_QUOTE) {
+ $this->_retvalue = new _smarty_text($this, htmlspecialchars('?>', ENT_QUOTES));
+ } elseif ($this->php_handling == Smarty::PHP_ALLOW) {
+ $this->_retvalue = new _smarty_text($this, $this->compiler->processNocacheCode('?>', true));
+ } elseif ($this->php_handling == Smarty::PHP_REMOVE) {
+ $this->_retvalue = null;
+ }
+ }
+ #line 2210 "smarty_internal_templateparser.php"
+ #line 181 "smarty_internal_templateparser.y"
+ function yy_r9()
+ {
+ if ($this->php_handling == Smarty::PHP_PASSTHRU) {
+ $this->_retvalue = new _smarty_text($this, '<<?php ?>%');
+ } elseif ($this->php_handling == Smarty::PHP_QUOTE) {
+ $this->_retvalue = new _smarty_text($this, htmlspecialchars($this->yystack[$this->yyidx + 0]->minor, ENT_QUOTES));
+ } elseif ($this->php_handling == Smarty::PHP_ALLOW) {
+ if ($this->asp_tags) {
+ if (!($this->smarty instanceof SmartyBC)) {
+ $this->compiler->trigger_template_error(self::Err3);
+ }
+ $this->_retvalue = new _smarty_text($this, $this->compiler->processNocacheCode('<%', true));
+ } else {
+ $this->_retvalue = new _smarty_text($this, '<<?php ?>%');
+ }
+ } elseif ($this->php_handling == Smarty::PHP_REMOVE) {
+ if ($this->asp_tags) {
+ $this->_retvalue = null;
+ } else {
+ $this->_retvalue = new _smarty_text($this, '<<?php ?>%');
+ }
}
- $this->_retvalue = new _smarty_text($this, $this->compiler->processNocacheCode('<?php', true));
- } elseif ($this->php_handling == Smarty::PHP_REMOVE) {
- $this->_retvalue = new _smarty_text($this, '');
}
+ #line 2234 "smarty_internal_templateparser.php"
+ #line 205 "smarty_internal_templateparser.y"
+ function yy_r10()
+ {
+ if ($this->php_handling == Smarty::PHP_PASSTHRU) {
+ $this->_retvalue = new _smarty_text($this, '%<?php ?>>');
+ } elseif ($this->php_handling == Smarty::PHP_QUOTE) {
+ $this->_retvalue = new _smarty_text($this, htmlspecialchars('%>', ENT_QUOTES));
+ } elseif ($this->php_handling == Smarty::PHP_ALLOW) {
+ if ($this->asp_tags) {
+ $this->_retvalue = new _smarty_text($this, $this->compiler->processNocacheCode('%>', true));
+ } else {
+ $this->_retvalue = new _smarty_text($this, '%<?php ?>>');
+ }
+ } elseif ($this->php_handling == Smarty::PHP_REMOVE) {
+ if ($this->asp_tags) {
+ $this->_retvalue = null;
+ } else {
+ $this->_retvalue = new _smarty_text($this, '%<?php ?>>');
+ }
+ }
}
-#line 2208 "smarty_internal_templateparser.php"
-#line 157 "smarty_internal_templateparser.y"
- function yy_r8(){
- if ($this->is_xml) {
+ #line 2255 "smarty_internal_templateparser.php"
+ #line 225 "smarty_internal_templateparser.y"
+ function yy_r11()
+ {
+ if ($this->strip) {
+ $this->_retvalue = new _smarty_text($this, preg_replace('![\t ]*[\r\n]+[\t ]*!', '', self::escape_start_tag($this->yystack[$this->yyidx + 0]->minor)));
+ } else {
+ $this->_retvalue = new _smarty_text($this, self::escape_start_tag($this->yystack[$this->yyidx + 0]->minor));
+ }
+ }
+ #line 2264 "smarty_internal_templateparser.php"
+ #line 234 "smarty_internal_templateparser.y"
+ function yy_r12()
+ {
$this->compiler->tag_nocache = true;
- $this->is_xml = false;
+ $this->is_xml = true;
$save = $this->template->has_nocache_code;
- $this->_retvalue = new _smarty_text($this, $this->compiler->processNocacheCode("<?php echo '?>';?>\n", $this->compiler, true));
+ $this->_retvalue = new _smarty_text($this, $this->compiler->processNocacheCode("<?php echo '<?xml';?>", $this->compiler, true));
$this->template->has_nocache_code = $save;
- } elseif ($this->php_handling == Smarty::PHP_PASSTHRU) {
- $this->_retvalue = new _smarty_text($this, '?<?php ?>>');
- } elseif ($this->php_handling == Smarty::PHP_QUOTE) {
- $this->_retvalue = new _smarty_text($this, htmlspecialchars('?>', ENT_QUOTES));
- } elseif ($this->php_handling == Smarty::PHP_ALLOW) {
- $this->_retvalue = new _smarty_text($this, $this->compiler->processNocacheCode('?>', true));
- } elseif ($this->php_handling == Smarty::PHP_REMOVE) {
- $this->_retvalue = new _smarty_text($this, '');
- }
- }
-#line 2227 "smarty_internal_templateparser.php"
-#line 176 "smarty_internal_templateparser.y"
- function yy_r9(){
- if ($this->php_handling == Smarty::PHP_PASSTHRU) {
- $this->_retvalue = new _smarty_text($this, '<<?php ?>%');
- } elseif ($this->php_handling == Smarty::PHP_QUOTE) {
- $this->_retvalue = new _smarty_text($this, htmlspecialchars($this->yystack[$this->yyidx + 0]->minor, ENT_QUOTES));
- } elseif ($this->php_handling == Smarty::PHP_ALLOW) {
- if ($this->asp_tags) {
- if (!($this->smarty instanceof SmartyBC)) {
- $this->compiler->trigger_template_error (self::Err3);
- }
- $this->_retvalue = new _smarty_text($this, $this->compiler->processNocacheCode('<%', true));
+ }
+ #line 2273 "smarty_internal_templateparser.php"
+ #line 243 "smarty_internal_templateparser.y"
+ function yy_r13()
+ {
+ if ($this->strip) {
+ $this->_retvalue = new _smarty_text($this, preg_replace('![\t ]*[\r\n]+[\t ]*!', '', $this->yystack[$this->yyidx + 0]->minor));
} else {
- $this->_retvalue = new _smarty_text($this, '<<?php ?>%');
+ $this->_retvalue = new _smarty_text($this, $this->yystack[$this->yyidx + 0]->minor);
}
- } elseif ($this->php_handling == Smarty::PHP_REMOVE) {
- if ($this->asp_tags) {
- $this->_retvalue = new _smarty_text($this, '');
+ }
+ #line 2282 "smarty_internal_templateparser.php"
+ #line 252 "smarty_internal_templateparser.y"
+ function yy_r14()
+ {
+ $this->strip = true;
+ }
+ #line 2287 "smarty_internal_templateparser.php"
+ #line 256 "smarty_internal_templateparser.y"
+ function yy_r15()
+ {
+ $this->strip = false;
+ }
+ #line 2292 "smarty_internal_templateparser.php"
+ #line 260 "smarty_internal_templateparser.y"
+ function yy_r16()
+ {
+ if ($this->strip) {
+ SMARTY_INTERNAL_COMPILE_BLOCK::blockSource($this->compiler, preg_replace('![\t ]*[\r\n]+[\t ]*!', '', $this->yystack[$this->yyidx + 0]->minor));
} else {
- $this->_retvalue = new _smarty_text($this, '<<?php ?>%');
+ SMARTY_INTERNAL_COMPILE_BLOCK::blockSource($this->compiler, $this->yystack[$this->yyidx + 0]->minor);
}
}
+ #line 2301 "smarty_internal_templateparser.php"
+ #line 269 "smarty_internal_templateparser.y"
+ function yy_r17()
+ {
+ $this->_retvalue = '';
+ }
+ #line 2306 "smarty_internal_templateparser.php"
+ #line 273 "smarty_internal_templateparser.y"
+ function yy_r18()
+ {
+ $this->_retvalue = $this->yystack[$this->yyidx + - 1]->minor;
}
-#line 2251 "smarty_internal_templateparser.php"
-#line 200 "smarty_internal_templateparser.y"
- function yy_r10(){
- if ($this->php_handling == Smarty::PHP_PASSTHRU) {
- $this->_retvalue = new _smarty_text($this, '%<?php ?>>');
- } elseif ($this->php_handling == Smarty::PHP_QUOTE) {
- $this->_retvalue = new _smarty_text($this, htmlspecialchars('%>', ENT_QUOTES));
- } elseif ($this->php_handling == Smarty::PHP_ALLOW) {
- if ($this->asp_tags) {
- $this->_retvalue = new _smarty_text($this, $this->compiler->processNocacheCode('%>', true));
+ #line 2311 "smarty_internal_templateparser.php"
+ #line 277 "smarty_internal_templateparser.y"
+ function yy_r19()
+ {
+ $this->_retvalue = $this->yystack[$this->yyidx + - 1]->minor . $this->yystack[$this->yyidx + 0]->minor;
+ }
+ #line 2316 "smarty_internal_templateparser.php"
+ #line 285 "smarty_internal_templateparser.y"
+ function yy_r21()
+ {
+ $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor;
+ }
+ #line 2321 "smarty_internal_templateparser.php"
+ #line 293 "smarty_internal_templateparser.y"
+ function yy_r23()
+ {
+ $this->_retvalue = self::escape_start_tag($this->yystack[$this->yyidx + 0]->minor);
+ }
+ #line 2326 "smarty_internal_templateparser.php"
+ #line 301 "smarty_internal_templateparser.y"
+ function yy_r25()
+ {
+ $this->_retvalue = self::escape_end_tag($this->yystack[$this->yyidx + 0]->minor);
+ }
+ #line 2331 "smarty_internal_templateparser.php"
+ #line 305 "smarty_internal_templateparser.y"
+ function yy_r26()
+ {
+ $this->_retvalue = '<<?php ?>%';
+ }
+ #line 2336 "smarty_internal_templateparser.php"
+ #line 309 "smarty_internal_templateparser.y"
+ function yy_r27()
+ {
+ $this->_retvalue = '%<?php ?>>';
+ }
+ #line 2341 "smarty_internal_templateparser.php"
+ #line 318 "smarty_internal_templateparser.y"
+ function yy_r28()
+ {
+ $this->_retvalue = $this->compiler->compileTag('private_print_expression', array(), array('value' => $this->yystack[$this->yyidx + 0]->minor));
+ }
+ #line 2346 "smarty_internal_templateparser.php"
+ #line 322 "smarty_internal_templateparser.y"
+ function yy_r29()
+ {
+ $this->_retvalue = $this->compiler->compileTag('private_print_expression', $this->yystack[$this->yyidx + 0]->minor, array('value' => $this->yystack[$this->yyidx + - 2]->minor, 'modifierlist' => $this->yystack[$this->yyidx + - 1]->minor));
+ }
+ #line 2351 "smarty_internal_templateparser.php"
+ #line 326 "smarty_internal_templateparser.y"
+ function yy_r30()
+ {
+ $this->_retvalue = $this->compiler->compileTag('private_print_expression', $this->yystack[$this->yyidx + 0]->minor, array('value' => $this->yystack[$this->yyidx + - 1]->minor));
+ }
+ #line 2356 "smarty_internal_templateparser.php"
+ #line 330 "smarty_internal_templateparser.y"
+ function yy_r31()
+ {
+ $this->_retvalue = $this->compiler->compileTag('private_print_expression', $this->yystack[$this->yyidx + 0]->minor, array('value' => $this->yystack[$this->yyidx + - 2]->minor, 'modifierlist' => $this->yystack[$this->yyidx + - 1]->minor));
+ }
+ #line 2361 "smarty_internal_templateparser.php"
+ #line 343 "smarty_internal_templateparser.y"
+ function yy_r33()
+ {
+ $this->_retvalue = $this->compiler->compileTag('assign', array(array('value' => $this->yystack[$this->yyidx + 0]->minor), array('var' => "'" . $this->yystack[$this->yyidx + - 2]->minor . "'")));
+ }
+ #line 2366 "smarty_internal_templateparser.php"
+ #line 351 "smarty_internal_templateparser.y"
+ function yy_r35()
+ {
+ $this->_retvalue = $this->compiler->compileTag('assign', array_merge(array(array('value' => $this->yystack[$this->yyidx + - 1]->minor), array('var' => "'" . $this->yystack[$this->yyidx + - 3]->minor . "'")), $this->yystack[$this->yyidx + 0]->minor));
+ }
+ #line 2371 "smarty_internal_templateparser.php"
+ #line 355 "smarty_internal_templateparser.y"
+ function yy_r36()
+ {
+ $this->_retvalue = $this->compiler->compileTag('assign', array_merge(array(array('value' => $this->yystack[$this->yyidx + - 1]->minor), array('var' => $this->yystack[$this->yyidx + - 3]->minor['var'])), $this->yystack[$this->yyidx + 0]->minor), array('smarty_internal_index' => $this->yystack[$this->yyidx + - 3]->minor['smarty_internal_index']));
+ }
+ #line 2376 "smarty_internal_templateparser.php"
+ #line 360 "smarty_internal_templateparser.y"
+ function yy_r37()
+ {
+ $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + - 1]->minor, $this->yystack[$this->yyidx + 0]->minor);
+ }
+ #line 2381 "smarty_internal_templateparser.php"
+ #line 364 "smarty_internal_templateparser.y"
+ function yy_r38()
+ {
+ $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + 0]->minor, array());
+ }
+ #line 2386 "smarty_internal_templateparser.php"
+ #line 369 "smarty_internal_templateparser.y"
+ function yy_r39()
+ {
+ $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + - 3]->minor, $this->yystack[$this->yyidx + 0]->minor, array('object_method' => $this->yystack[$this->yyidx + - 1]->minor));
+ }
+ #line 2391 "smarty_internal_templateparser.php"
+ #line 374 "smarty_internal_templateparser.y"
+ function yy_r40()
+ {
+ $this->_retvalue = '<?php ob_start();?>' . $this->compiler->compileTag($this->yystack[$this->yyidx + - 2]->minor, $this->yystack[$this->yyidx + 0]->minor) . '<?php echo ';
+ $this->_retvalue .= $this->compiler->compileTag('private_modifier', array(), array('modifierlist' => $this->yystack[$this->yyidx + - 1]->minor, 'value' => 'ob_get_clean()')) . '?>';
+ }
+ #line 2397 "smarty_internal_templateparser.php"
+ #line 380 "smarty_internal_templateparser.y"
+ function yy_r41()
+ {
+ $this->_retvalue = '<?php ob_start();?>' . $this->compiler->compileTag($this->yystack[$this->yyidx + - 4]->minor, $this->yystack[$this->yyidx + 0]->minor, array('object_method' => $this->yystack[$this->yyidx + - 2]->minor)) . '<?php echo ';
+ $this->_retvalue .= $this->compiler->compileTag('private_modifier', array(), array('modifierlist' => $this->yystack[$this->yyidx + - 1]->minor, 'value' => 'ob_get_clean()')) . '?>';
+ }
+ #line 2403 "smarty_internal_templateparser.php"
+ #line 386 "smarty_internal_templateparser.y"
+ function yy_r42()
+ {
+ $tag = trim(substr($this->yystack[$this->yyidx + - 1]->minor, $this->lex->ldel_length));
+ $this->_retvalue = $this->compiler->compileTag(($tag == 'else if') ? 'elseif' : $tag, array(), array('if condition' => $this->yystack[$this->yyidx + 0]->minor));
+ }
+ #line 2409 "smarty_internal_templateparser.php"
+ #line 391 "smarty_internal_templateparser.y"
+ function yy_r43()
+ {
+ $tag = trim(substr($this->yystack[$this->yyidx + - 2]->minor, $this->lex->ldel_length));
+ $this->_retvalue = $this->compiler->compileTag(($tag == 'else if') ? 'elseif' : $tag, $this->yystack[$this->yyidx + 0]->minor, array('if condition' => $this->yystack[$this->yyidx + - 1]->minor));
+ }
+ #line 2415 "smarty_internal_templateparser.php"
+ #line 396 "smarty_internal_templateparser.y"
+ function yy_r44()
+ {
+ $tag = trim(substr($this->yystack[$this->yyidx + - 1]->minor, $this->lex->ldel_length));
+ $this->_retvalue = $this->compiler->compileTag(($tag == 'else if') ? 'elseif' : $tag, array(), array('if condition' => $this->yystack[$this->yyidx + 0]->minor));
+ }
+ #line 2421 "smarty_internal_templateparser.php"
+ #line 407 "smarty_internal_templateparser.y"
+ function yy_r46()
+ {
+ $this->_retvalue = $this->compiler->compileTag('for', array_merge($this->yystack[$this->yyidx + 0]->minor, array(array('start' => $this->yystack[$this->yyidx + - 9]->minor), array('ifexp' => $this->yystack[$this->yyidx + - 6]->minor), array('var' => $this->yystack[$this->yyidx + - 2]->minor), array('step' => $this->yystack[$this->yyidx + - 1]->minor))), 1);
+ }
+ #line 2426 "smarty_internal_templateparser.php"
+ #line 411 "smarty_internal_templateparser.y"
+ function yy_r47()
+ {
+ $this->_retvalue = '=' . $this->yystack[$this->yyidx + 0]->minor;
+ }
+ #line 2431 "smarty_internal_templateparser.php"
+ #line 419 "smarty_internal_templateparser.y"
+ function yy_r49()
+ {
+ $this->_retvalue = $this->compiler->compileTag('for', array_merge($this->yystack[$this->yyidx + 0]->minor, array(array('start' => $this->yystack[$this->yyidx + - 3]->minor), array('to' => $this->yystack[$this->yyidx + - 1]->minor))), 0);
+ }
+ #line 2436 "smarty_internal_templateparser.php"
+ #line 423 "smarty_internal_templateparser.y"
+ function yy_r50()
+ {
+ $this->_retvalue = $this->compiler->compileTag('for', array_merge($this->yystack[$this->yyidx + 0]->minor, array(array('start' => $this->yystack[$this->yyidx + - 5]->minor), array('to' => $this->yystack[$this->yyidx + - 3]->minor), array('step' => $this->yystack[$this->yyidx + - 1]->minor))), 0);
+ }
+ #line 2441 "smarty_internal_templateparser.php"
+ #line 428 "smarty_internal_templateparser.y"
+ function yy_r51()
+ {
+ $this->_retvalue = $this->compiler->compileTag('foreach', $this->yystack[$this->yyidx + 0]->minor);
+ }
+ #line 2446 "smarty_internal_templateparser.php"
+ #line 433 "smarty_internal_templateparser.y"
+ function yy_r52()
+ {
+ $this->_retvalue = $this->compiler->compileTag('foreach', array_merge($this->yystack[$this->yyidx + 0]->minor, array(array('from' => $this->yystack[$this->yyidx + - 4]->minor), array('item' => $this->yystack[$this->yyidx + - 1]->minor))));
+ }
+ #line 2451 "smarty_internal_templateparser.php"
+ #line 437 "smarty_internal_templateparser.y"
+ function yy_r53()
+ {
+ $this->_retvalue = $this->compiler->compileTag('foreach', array_merge($this->yystack[$this->yyidx + 0]->minor, array(array('from' => $this->yystack[$this->yyidx + - 7]->minor), array('item' => $this->yystack[$this->yyidx + - 1]->minor), array('key' => $this->yystack[$this->yyidx + - 4]->minor))));
+ }
+ #line 2456 "smarty_internal_templateparser.php"
+ #line 450 "smarty_internal_templateparser.y"
+ function yy_r56()
+ {
+ $this->_retvalue = $this->compiler->compileTag('setfilter', array(), array('modifier_list' => array(array_merge(array($this->yystack[$this->yyidx + - 1]->minor), $this->yystack[$this->yyidx + 0]->minor))));
+ }
+ #line 2461 "smarty_internal_templateparser.php"
+ #line 454 "smarty_internal_templateparser.y"
+ function yy_r57()
+ {
+ $this->_retvalue = $this->compiler->compileTag('setfilter', array(), array('modifier_list' => array_merge(array(array_merge(array($this->yystack[$this->yyidx + - 2]->minor), $this->yystack[$this->yyidx + - 1]->minor)), $this->yystack[$this->yyidx + 0]->minor)));
+ }
+ #line 2466 "smarty_internal_templateparser.php"
+ #line 459 "smarty_internal_templateparser.y"
+ function yy_r58()
+ {
+ $j = strrpos($this->yystack[$this->yyidx + 0]->minor, '.');
+ if ($this->yystack[$this->yyidx + 0]->minor[$j + 1] == 'c') {
+ // {$smarty.block.child}
+ $this->_retvalue = SMARTY_INTERNAL_COMPILE_BLOCK::compileChildBlock($this->compiler);
} else {
- $this->_retvalue = new _smarty_text($this, '%<?php ?>>');
+ // {$smarty.block.parent}
+ $this->_retvalue = SMARTY_INTERNAL_COMPILE_BLOCK::compileParentBlock($this->compiler);
}
- } elseif ($this->php_handling == Smarty::PHP_REMOVE) {
- if ($this->asp_tags) {
- $this->_retvalue = new _smarty_text($this, '');
+ }
+ #line 2478 "smarty_internal_templateparser.php"
+ #line 472 "smarty_internal_templateparser.y"
+ function yy_r59()
+ {
+ $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + 0]->minor . 'close', array());
+ }
+ #line 2483 "smarty_internal_templateparser.php"
+ #line 476 "smarty_internal_templateparser.y"
+ function yy_r60()
+ {
+ $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + - 1]->minor . 'close', array(), array('modifier_list' => $this->yystack[$this->yyidx + 0]->minor));
+ }
+ #line 2488 "smarty_internal_templateparser.php"
+ #line 481 "smarty_internal_templateparser.y"
+ function yy_r61()
+ {
+ $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + - 2]->minor . 'close', array(), array('object_method' => $this->yystack[$this->yyidx + 0]->minor));
+ }
+ #line 2493 "smarty_internal_templateparser.php"
+ #line 485 "smarty_internal_templateparser.y"
+ function yy_r62()
+ {
+ $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + - 3]->minor . 'close', array(), array('object_method' => $this->yystack[$this->yyidx + - 1]->minor, 'modifier_list' => $this->yystack[$this->yyidx + 0]->minor));
+ }
+ #line 2498 "smarty_internal_templateparser.php"
+ #line 493 "smarty_internal_templateparser.y"
+ function yy_r63()
+ {
+ $this->_retvalue = $this->yystack[$this->yyidx + - 1]->minor;
+ $this->_retvalue[] = $this->yystack[$this->yyidx + 0]->minor;
+ }
+ #line 2504 "smarty_internal_templateparser.php"
+ #line 499 "smarty_internal_templateparser.y"
+ function yy_r64()
+ {
+ $this->_retvalue = array($this->yystack[$this->yyidx + 0]->minor);
+ }
+ #line 2509 "smarty_internal_templateparser.php"
+ #line 504 "smarty_internal_templateparser.y"
+ function yy_r65()
+ {
+ $this->_retvalue = array();
+ }
+ #line 2514 "smarty_internal_templateparser.php"
+ #line 509 "smarty_internal_templateparser.y"
+ function yy_r66()
+ {
+ if (preg_match('~^true$~i', $this->yystack[$this->yyidx + 0]->minor)) {
+ $this->_retvalue = array($this->yystack[$this->yyidx + - 2]->minor => 'true');
+ } elseif (preg_match('~^false$~i', $this->yystack[$this->yyidx + 0]->minor)) {
+ $this->_retvalue = array($this->yystack[$this->yyidx + - 2]->minor => 'false');
+ } elseif (preg_match('~^null$~i', $this->yystack[$this->yyidx + 0]->minor)) {
+ $this->_retvalue = array($this->yystack[$this->yyidx + - 2]->minor => 'null');
} else {
- $this->_retvalue = new _smarty_text($this, '%<?php ?>>');
+ $this->_retvalue = array($this->yystack[$this->yyidx + - 2]->minor => "'" . $this->yystack[$this->yyidx + 0]->minor . "'");
}
}
+ #line 2527 "smarty_internal_templateparser.php"
+ #line 521 "smarty_internal_templateparser.y"
+ function yy_r67()
+ {
+ $this->_retvalue = array(trim($this->yystack[$this->yyidx + - 1]->minor, " =\n\r\t") => $this->yystack[$this->yyidx + 0]->minor);
}
-#line 2272 "smarty_internal_templateparser.php"
-#line 220 "smarty_internal_templateparser.y"
- function yy_r11(){
- if ($this->strip) {
- $this->_retvalue = new _smarty_text($this, preg_replace('![\t ]*[\r\n]+[\t ]*!', '', self::escape_start_tag($this->yystack[$this->yyidx + 0]->minor)));
- } else {
- $this->_retvalue = new _smarty_text($this, self::escape_start_tag($this->yystack[$this->yyidx + 0]->minor));
- }
- }
-#line 2281 "smarty_internal_templateparser.php"
-#line 229 "smarty_internal_templateparser.y"
- function yy_r12(){
- $this->compiler->tag_nocache = true;
- $this->is_xml = true;
- $save = $this->template->has_nocache_code;
- $this->_retvalue = new _smarty_text($this, $this->compiler->processNocacheCode("<?php echo '<?xml';?>", $this->compiler, true));
- $this->template->has_nocache_code = $save;
- }
-#line 2290 "smarty_internal_templateparser.php"
-#line 238 "smarty_internal_templateparser.y"
- function yy_r13(){
- if ($this->strip) {
- $this->_retvalue = new _smarty_text($this, preg_replace('![\t ]*[\r\n]+[\t ]*!', '', $this->yystack[$this->yyidx + 0]->minor));
- } else {
- $this->_retvalue = new _smarty_text($this, $this->yystack[$this->yyidx + 0]->minor);
+ #line 2532 "smarty_internal_templateparser.php"
+ #line 529 "smarty_internal_templateparser.y"
+ function yy_r69()
+ {
+ $this->_retvalue = "'" . $this->yystack[$this->yyidx + 0]->minor . "'";
+ }
+ #line 2537 "smarty_internal_templateparser.php"
+ #line 541 "smarty_internal_templateparser.y"
+ function yy_r72()
+ {
+ $this->_retvalue = array($this->yystack[$this->yyidx + - 2]->minor => $this->yystack[$this->yyidx + 0]->minor);
+ }
+ #line 2542 "smarty_internal_templateparser.php"
+ #line 554 "smarty_internal_templateparser.y"
+ function yy_r74()
+ {
+ $this->yystack[$this->yyidx + - 2]->minor[] = $this->yystack[$this->yyidx + 0]->minor;
+ $this->_retvalue = $this->yystack[$this->yyidx + - 2]->minor;
+ }
+ #line 2548 "smarty_internal_templateparser.php"
+ #line 559 "smarty_internal_templateparser.y"
+ function yy_r75()
+ {
+ $this->_retvalue = array('var' => $this->yystack[$this->yyidx + - 2]->minor, 'value' => $this->yystack[$this->yyidx + 0]->minor);
+ }
+ #line 2553 "smarty_internal_templateparser.php"
+ #line 587 "smarty_internal_templateparser.y"
+ function yy_r80()
+ {
+ $this->_retvalue = '$_smarty_tpl->getStreamVariable(\'' . $this->yystack[$this->yyidx + - 2]->minor . '://' . $this->yystack[$this->yyidx + 0]->minor . '\')';
+ }
+ #line 2558 "smarty_internal_templateparser.php"
+ #line 592 "smarty_internal_templateparser.y"
+ function yy_r81()
+ {
+ $this->_retvalue = $this->yystack[$this->yyidx + - 2]->minor . trim($this->yystack[$this->yyidx + - 1]->minor) . $this->yystack[$this->yyidx + 0]->minor;
+ }
+ #line 2563 "smarty_internal_templateparser.php"
+ #line 611 "smarty_internal_templateparser.y"
+ function yy_r85()
+ {
+ $this->_retvalue = $this->compiler->compileTag('private_modifier', array(), array('value' => $this->yystack[$this->yyidx + - 1]->minor, 'modifierlist' => $this->yystack[$this->yyidx + 0]->minor));
+ }
+ #line 2568 "smarty_internal_templateparser.php"
+ #line 617 "smarty_internal_templateparser.y"
+ function yy_r86()
+ {
+ $this->_retvalue = $this->yystack[$this->yyidx + - 2]->minor . $this->yystack[$this->yyidx + - 1]->minor . $this->yystack[$this->yyidx + 0]->minor;
+ }
+ #line 2573 "smarty_internal_templateparser.php"
+ #line 621 "smarty_internal_templateparser.y"
+ function yy_r87()
+ {
+ $this->_retvalue = 'in_array(' . $this->yystack[$this->yyidx + - 2]->minor . ',' . $this->yystack[$this->yyidx + 0]->minor . ')';
}
+ #line 2578 "smarty_internal_templateparser.php"
+ #line 625 "smarty_internal_templateparser.y"
+ function yy_r88()
+ {
+ $this->_retvalue = 'in_array(' . $this->yystack[$this->yyidx + - 2]->minor . ',(array)' . $this->yystack[$this->yyidx + 0]->minor . ')';
+ }
+ #line 2583 "smarty_internal_templateparser.php"
+ #line 633 "smarty_internal_templateparser.y"
+ function yy_r90()
+ {
+ $this->_retvalue = '!(' . $this->yystack[$this->yyidx + - 2]->minor . ' % ' . $this->yystack[$this->yyidx + 0]->minor . ')';
+ }
+ #line 2588 "smarty_internal_templateparser.php"
+ #line 637 "smarty_internal_templateparser.y"
+ function yy_r91()
+ {
+ $this->_retvalue = '(' . $this->yystack[$this->yyidx + - 2]->minor . ' % ' . $this->yystack[$this->yyidx + 0]->minor . ')';
+ }
+ #line 2593 "smarty_internal_templateparser.php"
+ #line 641 "smarty_internal_templateparser.y"
+ function yy_r92()
+ {
+ $this->_retvalue = '!(1 & ' . $this->yystack[$this->yyidx + - 1]->minor . ')';
+ }
+ #line 2598 "smarty_internal_templateparser.php"
+ #line 645 "smarty_internal_templateparser.y"
+ function yy_r93()
+ {
+ $this->_retvalue = '(1 & ' . $this->yystack[$this->yyidx + - 1]->minor . ')';
+ }
+ #line 2603 "smarty_internal_templateparser.php"
+ #line 649 "smarty_internal_templateparser.y"
+ function yy_r94()
+ {
+ $this->_retvalue = '!(1 & ' . $this->yystack[$this->yyidx + - 2]->minor . ' / ' . $this->yystack[$this->yyidx + 0]->minor . ')';
+ }
+ #line 2608 "smarty_internal_templateparser.php"
+ #line 653 "smarty_internal_templateparser.y"
+ function yy_r95()
+ {
+ $this->_retvalue = '(1 & ' . $this->yystack[$this->yyidx + - 2]->minor . ' / ' . $this->yystack[$this->yyidx + 0]->minor . ')';
+ }
+ #line 2613 "smarty_internal_templateparser.php"
+ #line 677 "smarty_internal_templateparser.y"
+ function yy_r101()
+ {
+ self::$prefix_number ++;
+ $this->compiler->prefix_code[] = '<?php $_tmp' . self::$prefix_number . '=' . $this->yystack[$this->yyidx + 0]->minor . ';?>';
+ $this->_retvalue = $this->yystack[$this->yyidx + - 2]->minor . $this->yystack[$this->yyidx + - 1]->minor . '$_tmp' . self::$prefix_number;
+ }
+ #line 2620 "smarty_internal_templateparser.php"
+ #line 686 "smarty_internal_templateparser.y"
+ function yy_r102()
+ {
+ $this->_retvalue = $this->yystack[$this->yyidx + - 6]->minor . ' ? ' . $this->compileVariable("'" . $this->yystack[$this->yyidx + - 2]->minor . "'") . ' : ' . $this->yystack[$this->yyidx + 0]->minor;
+ }
+ #line 2625 "smarty_internal_templateparser.php"
+ #line 690 "smarty_internal_templateparser.y"
+ function yy_r103()
+ {
+ $this->_retvalue = $this->yystack[$this->yyidx + - 5]->minor . ' ? ' . $this->yystack[$this->yyidx + - 2]->minor . ' : ' . $this->yystack[$this->yyidx + 0]->minor;
+ }
+ #line 2630 "smarty_internal_templateparser.php"
+ #line 705 "smarty_internal_templateparser.y"
+ function yy_r106()
+ {
+ $this->_retvalue = '!' . $this->yystack[$this->yyidx + 0]->minor;
}
-#line 2299 "smarty_internal_templateparser.php"
-#line 247 "smarty_internal_templateparser.y"
- function yy_r14(){
- $this->strip = true;
- $this->_retvalue = new _smarty_text($this, '');
- }
-#line 2305 "smarty_internal_templateparser.php"
-#line 252 "smarty_internal_templateparser.y"
- function yy_r15(){
- $this->strip = false;
- $this->_retvalue = new _smarty_text($this, '');
- }
-#line 2311 "smarty_internal_templateparser.php"
-#line 258 "smarty_internal_templateparser.y"
- function yy_r16(){
- $this->_retvalue = '';
- }
-#line 2316 "smarty_internal_templateparser.php"
-#line 262 "smarty_internal_templateparser.y"
- function yy_r17(){
- $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor;
- }
-#line 2321 "smarty_internal_templateparser.php"
-#line 266 "smarty_internal_templateparser.y"
- function yy_r18(){
- $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor;
- }
-#line 2326 "smarty_internal_templateparser.php"
-#line 274 "smarty_internal_templateparser.y"
- function yy_r20(){
- $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor;
- }
-#line 2331 "smarty_internal_templateparser.php"
-#line 282 "smarty_internal_templateparser.y"
- function yy_r22(){
- $this->_retvalue = self::escape_start_tag($this->yystack[$this->yyidx + 0]->minor);
- }
-#line 2336 "smarty_internal_templateparser.php"
-#line 290 "smarty_internal_templateparser.y"
- function yy_r24(){
- $this->_retvalue = self::escape_end_tag($this->yystack[$this->yyidx + 0]->minor);
- }
-#line 2341 "smarty_internal_templateparser.php"
-#line 294 "smarty_internal_templateparser.y"
- function yy_r25(){
- $this->_retvalue = '<<?php ?>%';
- }
-#line 2346 "smarty_internal_templateparser.php"
-#line 298 "smarty_internal_templateparser.y"
- function yy_r26(){
- $this->_retvalue = '%<?php ?>>';
- }
-#line 2351 "smarty_internal_templateparser.php"
-#line 307 "smarty_internal_templateparser.y"
- function yy_r27(){
- $this->_retvalue = $this->compiler->compileTag('private_print_expression',array(),array('value'=>$this->yystack[$this->yyidx + -1]->minor));
- }
-#line 2356 "smarty_internal_templateparser.php"
-#line 311 "smarty_internal_templateparser.y"
- function yy_r28(){
- $this->_retvalue = $this->compiler->compileTag('private_print_expression',$this->yystack[$this->yyidx + -1]->minor,array('value'=>$this->yystack[$this->yyidx + -3]->minor, 'modifierlist'=>$this->yystack[$this->yyidx + -2]->minor));
- }
-#line 2361 "smarty_internal_templateparser.php"
-#line 315 "smarty_internal_templateparser.y"
- function yy_r29(){
- $this->_retvalue = $this->compiler->compileTag('private_print_expression',$this->yystack[$this->yyidx + -1]->minor,array('value'=>$this->yystack[$this->yyidx + -2]->minor));
- }
-#line 2366 "smarty_internal_templateparser.php"
-#line 319 "smarty_internal_templateparser.y"
- function yy_r30(){
- $this->_retvalue = $this->compiler->compileTag('private_print_expression',$this->yystack[$this->yyidx + -1]->minor,array('value'=>$this->yystack[$this->yyidx + -3]->minor,'modifierlist'=>$this->yystack[$this->yyidx + -2]->minor));
- }
-#line 2371 "smarty_internal_templateparser.php"
-#line 332 "smarty_internal_templateparser.y"
- function yy_r32(){
- $this->_retvalue = $this->compiler->compileTag('assign',array(array('value'=>$this->yystack[$this->yyidx + -1]->minor),array('var'=>"'".$this->yystack[$this->yyidx + -3]->minor."'")));
- }
-#line 2376 "smarty_internal_templateparser.php"
-#line 340 "smarty_internal_templateparser.y"
- function yy_r34(){
- $this->_retvalue = $this->compiler->compileTag('assign',array_merge(array(array('value'=>$this->yystack[$this->yyidx + -2]->minor),array('var'=>"'".$this->yystack[$this->yyidx + -4]->minor."'")),$this->yystack[$this->yyidx + -1]->minor));
- }
-#line 2381 "smarty_internal_templateparser.php"
-#line 344 "smarty_internal_templateparser.y"
- function yy_r35(){
- $this->_retvalue = $this->compiler->compileTag('assign',array_merge(array(array('value'=>$this->yystack[$this->yyidx + -2]->minor),array('var'=>$this->yystack[$this->yyidx + -4]->minor['var'])),$this->yystack[$this->yyidx + -1]->minor),array('smarty_internal_index'=>$this->yystack[$this->yyidx + -4]->minor['smarty_internal_index']));
- }
-#line 2386 "smarty_internal_templateparser.php"
-#line 349 "smarty_internal_templateparser.y"
- function yy_r36(){
- $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -2]->minor,$this->yystack[$this->yyidx + -1]->minor);
- }
-#line 2391 "smarty_internal_templateparser.php"
-#line 353 "smarty_internal_templateparser.y"
- function yy_r37(){
- $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -1]->minor,array());
- }
-#line 2396 "smarty_internal_templateparser.php"
-#line 358 "smarty_internal_templateparser.y"
- function yy_r38(){
- $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -4]->minor,$this->yystack[$this->yyidx + -1]->minor,array('object_methode'=>$this->yystack[$this->yyidx + -2]->minor));
- }
-#line 2401 "smarty_internal_templateparser.php"
-#line 363 "smarty_internal_templateparser.y"
- function yy_r39(){
- $this->_retvalue = '<?php ob_start();?>'.$this->compiler->compileTag($this->yystack[$this->yyidx + -3]->minor,$this->yystack[$this->yyidx + -1]->minor).'<?php echo ';
- $this->_retvalue .= $this->compiler->compileTag('private_modifier',array(),array('modifierlist'=>$this->yystack[$this->yyidx + -2]->minor,'value'=>'ob_get_clean()')).'?>';
- }
-#line 2407 "smarty_internal_templateparser.php"
-#line 369 "smarty_internal_templateparser.y"
- function yy_r40(){
- $this->_retvalue = '<?php ob_start();?>'.$this->compiler->compileTag($this->yystack[$this->yyidx + -5]->minor,$this->yystack[$this->yyidx + -1]->minor,array('object_methode'=>$this->yystack[$this->yyidx + -3]->minor)).'<?php echo ';
- $this->_retvalue .= $this->compiler->compileTag('private_modifier',array(),array('modifierlist'=>$this->yystack[$this->yyidx + -2]->minor,'value'=>'ob_get_clean()')).'?>';
- }
-#line 2413 "smarty_internal_templateparser.php"
-#line 375 "smarty_internal_templateparser.y"
- function yy_r41(){
- $tag = trim(substr($this->yystack[$this->yyidx + -2]->minor,$this->lex->ldel_length));
- $this->_retvalue = $this->compiler->compileTag(($tag == 'else if')? 'elseif' : $tag,array(),array('if condition'=>$this->yystack[$this->yyidx + -1]->minor));
- }
-#line 2419 "smarty_internal_templateparser.php"
-#line 380 "smarty_internal_templateparser.y"
- function yy_r42(){
- $tag = trim(substr($this->yystack[$this->yyidx + -3]->minor,$this->lex->ldel_length));
- $this->_retvalue = $this->compiler->compileTag(($tag == 'else if')? 'elseif' : $tag,$this->yystack[$this->yyidx + -1]->minor,array('if condition'=>$this->yystack[$this->yyidx + -2]->minor));
- }
-#line 2425 "smarty_internal_templateparser.php"
-#line 385 "smarty_internal_templateparser.y"
- function yy_r43(){
- $tag = trim(substr($this->yystack[$this->yyidx + -2]->minor,$this->lex->ldel_length));
- $this->_retvalue = $this->compiler->compileTag(($tag == 'else if')? 'elseif' : $tag,array(),array('if condition'=>$this->yystack[$this->yyidx + -1]->minor));
- }
-#line 2431 "smarty_internal_templateparser.php"
-#line 396 "smarty_internal_templateparser.y"
- function yy_r45(){
- $this->_retvalue = $this->compiler->compileTag('for',array_merge($this->yystack[$this->yyidx + -1]->minor,array(array('start'=>$this->yystack[$this->yyidx + -10]->minor),array('ifexp'=>$this->yystack[$this->yyidx + -7]->minor),array('var'=>$this->yystack[$this->yyidx + -3]->minor),array('step'=>$this->yystack[$this->yyidx + -2]->minor))),1);
- }
-#line 2436 "smarty_internal_templateparser.php"
-#line 400 "smarty_internal_templateparser.y"
- function yy_r46(){
- $this->_retvalue = '='.$this->yystack[$this->yyidx + 0]->minor;
- }
-#line 2441 "smarty_internal_templateparser.php"
-#line 408 "smarty_internal_templateparser.y"
- function yy_r48(){
- $this->_retvalue = $this->compiler->compileTag('for',array_merge($this->yystack[$this->yyidx + -1]->minor,array(array('start'=>$this->yystack[$this->yyidx + -4]->minor),array('to'=>$this->yystack[$this->yyidx + -2]->minor))),0);
- }
-#line 2446 "smarty_internal_templateparser.php"
-#line 412 "smarty_internal_templateparser.y"
- function yy_r49(){
- $this->_retvalue = $this->compiler->compileTag('for',array_merge($this->yystack[$this->yyidx + -1]->minor,array(array('start'=>$this->yystack[$this->yyidx + -6]->minor),array('to'=>$this->yystack[$this->yyidx + -4]->minor),array('step'=>$this->yystack[$this->yyidx + -2]->minor))),0);
- }
-#line 2451 "smarty_internal_templateparser.php"
-#line 417 "smarty_internal_templateparser.y"
- function yy_r50(){
- $this->_retvalue = $this->compiler->compileTag('foreach',$this->yystack[$this->yyidx + -1]->minor);
- }
-#line 2456 "smarty_internal_templateparser.php"
-#line 422 "smarty_internal_templateparser.y"
- function yy_r51(){
- $this->_retvalue = $this->compiler->compileTag('foreach',array_merge($this->yystack[$this->yyidx + -1]->minor,array(array('from'=>$this->yystack[$this->yyidx + -5]->minor),array('item'=>$this->yystack[$this->yyidx + -2]->minor))));
- }
-#line 2461 "smarty_internal_templateparser.php"
-#line 426 "smarty_internal_templateparser.y"
- function yy_r52(){
- $this->_retvalue = $this->compiler->compileTag('foreach',array_merge($this->yystack[$this->yyidx + -1]->minor,array(array('from'=>$this->yystack[$this->yyidx + -8]->minor),array('item'=>$this->yystack[$this->yyidx + -2]->minor),array('key'=>$this->yystack[$this->yyidx + -5]->minor))));
- }
-#line 2466 "smarty_internal_templateparser.php"
-#line 430 "smarty_internal_templateparser.y"
- function yy_r53(){
- $this->_retvalue = $this->compiler->compileTag('foreach',array_merge($this->yystack[$this->yyidx + -1]->minor,array(array('from'=>$this->yystack[$this->yyidx + -5]->minor),array('item'=>$this->yystack[$this->yyidx + -2]->minor))));
- }
-#line 2471 "smarty_internal_templateparser.php"
-#line 434 "smarty_internal_templateparser.y"
- function yy_r54(){
- $this->_retvalue = $this->compiler->compileTag('foreach',array_merge($this->yystack[$this->yyidx + -1]->minor,array(array('from'=>$this->yystack[$this->yyidx + -8]->minor),array('item'=>$this->yystack[$this->yyidx + -2]->minor),array('key'=>$this->yystack[$this->yyidx + -5]->minor))));
- }
-#line 2476 "smarty_internal_templateparser.php"
-#line 439 "smarty_internal_templateparser.y"
- function yy_r55(){
- $this->_retvalue = $this->compiler->compileTag('setfilter',array(),array('modifier_list'=>array(array_merge(array($this->yystack[$this->yyidx + -2]->minor),$this->yystack[$this->yyidx + -1]->minor))));
- }
-#line 2481 "smarty_internal_templateparser.php"
-#line 443 "smarty_internal_templateparser.y"
- function yy_r56(){
- $this->_retvalue = $this->compiler->compileTag('setfilter',array(),array('modifier_list'=>array_merge(array(array_merge(array($this->yystack[$this->yyidx + -3]->minor),$this->yystack[$this->yyidx + -2]->minor)),$this->yystack[$this->yyidx + -1]->minor)));
- }
-#line 2486 "smarty_internal_templateparser.php"
-#line 448 "smarty_internal_templateparser.y"
- function yy_r57(){
- $this->_retvalue = SMARTY_INTERNAL_COMPILE_BLOCK::compileChildBlock($this->compiler);
- }
-#line 2491 "smarty_internal_templateparser.php"
-#line 454 "smarty_internal_templateparser.y"
- function yy_r58(){
- $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -1]->minor.'close',array());
- }
-#line 2496 "smarty_internal_templateparser.php"
-#line 458 "smarty_internal_templateparser.y"
- function yy_r59(){
- $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -2]->minor.'close',array(),array('modifier_list'=>$this->yystack[$this->yyidx + -1]->minor));
- }
-#line 2501 "smarty_internal_templateparser.php"
-#line 463 "smarty_internal_templateparser.y"
- function yy_r60(){
- $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -3]->minor.'close',array(),array('object_methode'=>$this->yystack[$this->yyidx + -1]->minor));
- }
-#line 2506 "smarty_internal_templateparser.php"
-#line 467 "smarty_internal_templateparser.y"
- function yy_r61(){
- $this->_retvalue = $this->compiler->compileTag($this->yystack[$this->yyidx + -4]->minor.'close',array(),array('object_methode'=>$this->yystack[$this->yyidx + -2]->minor, 'modifier_list'=>$this->yystack[$this->yyidx + -1]->minor));
- }
-#line 2511 "smarty_internal_templateparser.php"
-#line 475 "smarty_internal_templateparser.y"
- function yy_r62(){
- $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor;
- $this->_retvalue[] = $this->yystack[$this->yyidx + 0]->minor;
- }
-#line 2517 "smarty_internal_templateparser.php"
-#line 481 "smarty_internal_templateparser.y"
- function yy_r63(){
- $this->_retvalue = array($this->yystack[$this->yyidx + 0]->minor);
- }
-#line 2522 "smarty_internal_templateparser.php"
-#line 486 "smarty_internal_templateparser.y"
- function yy_r64(){
- $this->_retvalue = array();
- }
-#line 2527 "smarty_internal_templateparser.php"
-#line 491 "smarty_internal_templateparser.y"
- function yy_r65(){
- if (preg_match('~^true$~i', $this->yystack[$this->yyidx + 0]->minor)) {
- $this->_retvalue = array($this->yystack[$this->yyidx + -2]->minor=>'true');
- } elseif (preg_match('~^false$~i', $this->yystack[$this->yyidx + 0]->minor)) {
- $this->_retvalue = array($this->yystack[$this->yyidx + -2]->minor=>'false');
- } elseif (preg_match('~^null$~i', $this->yystack[$this->yyidx + 0]->minor)) {
- $this->_retvalue = array($this->yystack[$this->yyidx + -2]->minor=>'null');
- } else {
- $this->_retvalue = array($this->yystack[$this->yyidx + -2]->minor=>"'".$this->yystack[$this->yyidx + 0]->minor."'");
- }
- }
-#line 2540 "smarty_internal_templateparser.php"
-#line 503 "smarty_internal_templateparser.y"
- function yy_r66(){
- $this->_retvalue = array(trim($this->yystack[$this->yyidx + -1]->minor," =\n\r\t")=>$this->yystack[$this->yyidx + 0]->minor);
- }
-#line 2545 "smarty_internal_templateparser.php"
-#line 511 "smarty_internal_templateparser.y"
- function yy_r68(){
- $this->_retvalue = "'".$this->yystack[$this->yyidx + 0]->minor."'";
- }
-#line 2550 "smarty_internal_templateparser.php"
-#line 523 "smarty_internal_templateparser.y"
- function yy_r71(){
- $this->_retvalue = array($this->yystack[$this->yyidx + -2]->minor=>$this->yystack[$this->yyidx + 0]->minor);
- }
-#line 2555 "smarty_internal_templateparser.php"
-#line 536 "smarty_internal_templateparser.y"
- function yy_r73(){
- $this->yystack[$this->yyidx + -2]->minor[]=$this->yystack[$this->yyidx + 0]->minor;
- $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor;
- }
-#line 2561 "smarty_internal_templateparser.php"
-#line 541 "smarty_internal_templateparser.y"
- function yy_r74(){
- $this->_retvalue = array('var' => $this->yystack[$this->yyidx + -2]->minor, 'value'=>$this->yystack[$this->yyidx + 0]->minor);
- }
-#line 2566 "smarty_internal_templateparser.php"
-#line 569 "smarty_internal_templateparser.y"
- function yy_r79(){
- $this->_retvalue = '$_smarty_tpl->getStreamVariable(\''. $this->yystack[$this->yyidx + -2]->minor .'://'. $this->yystack[$this->yyidx + 0]->minor . '\')';
- }
-#line 2571 "smarty_internal_templateparser.php"
-#line 574 "smarty_internal_templateparser.y"
- function yy_r80(){
- $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor . trim($this->yystack[$this->yyidx + -1]->minor) . $this->yystack[$this->yyidx + 0]->minor;
- }
-#line 2576 "smarty_internal_templateparser.php"
-#line 593 "smarty_internal_templateparser.y"
- function yy_r84(){
- $this->_retvalue = $this->compiler->compileTag('private_modifier',array(),array('value'=>$this->yystack[$this->yyidx + -1]->minor,'modifierlist'=>$this->yystack[$this->yyidx + 0]->minor));
- }
-#line 2581 "smarty_internal_templateparser.php"
-#line 599 "smarty_internal_templateparser.y"
- function yy_r85(){
- $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.$this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor;
- }
-#line 2586 "smarty_internal_templateparser.php"
-#line 603 "smarty_internal_templateparser.y"
- function yy_r86(){
- $this->_retvalue = 'in_array('.$this->yystack[$this->yyidx + -2]->minor.','.$this->yystack[$this->yyidx + 0]->minor.')';
- }
-#line 2591 "smarty_internal_templateparser.php"
-#line 607 "smarty_internal_templateparser.y"
- function yy_r87(){
- $this->_retvalue = 'in_array('.$this->yystack[$this->yyidx + -2]->minor.',(array)'.$this->yystack[$this->yyidx + 0]->minor.')';
- }
-#line 2596 "smarty_internal_templateparser.php"
-#line 615 "smarty_internal_templateparser.y"
- function yy_r89(){
- $this->_retvalue = '!('.$this->yystack[$this->yyidx + -2]->minor.' % '.$this->yystack[$this->yyidx + 0]->minor.')';
- }
-#line 2601 "smarty_internal_templateparser.php"
-#line 619 "smarty_internal_templateparser.y"
- function yy_r90(){
- $this->_retvalue = '('.$this->yystack[$this->yyidx + -2]->minor.' % '.$this->yystack[$this->yyidx + 0]->minor.')';
- }
-#line 2606 "smarty_internal_templateparser.php"
-#line 623 "smarty_internal_templateparser.y"
- function yy_r91(){
- $this->_retvalue = '!(1 & '.$this->yystack[$this->yyidx + -1]->minor.')';
- }
-#line 2611 "smarty_internal_templateparser.php"
-#line 627 "smarty_internal_templateparser.y"
- function yy_r92(){
- $this->_retvalue = '(1 & '.$this->yystack[$this->yyidx + -1]->minor.')';
- }
-#line 2616 "smarty_internal_templateparser.php"
-#line 631 "smarty_internal_templateparser.y"
- function yy_r93(){
- $this->_retvalue = '!(1 & '.$this->yystack[$this->yyidx + -2]->minor.' / '.$this->yystack[$this->yyidx + 0]->minor.')';
- }
-#line 2621 "smarty_internal_templateparser.php"
-#line 635 "smarty_internal_templateparser.y"
- function yy_r94(){
- $this->_retvalue = '(1 & '.$this->yystack[$this->yyidx + -2]->minor.' / '.$this->yystack[$this->yyidx + 0]->minor.')';
- }
-#line 2626 "smarty_internal_templateparser.php"
-#line 659 "smarty_internal_templateparser.y"
- function yy_r100(){
- $this->prefix_number++;
- $this->compiler->prefix_code[] = '<?php $_tmp'.$this->prefix_number.'='.$this->yystack[$this->yyidx + 0]->minor.';?>';
- $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.$this->yystack[$this->yyidx + -1]->minor.'$_tmp'.$this->prefix_number;
- }
-#line 2633 "smarty_internal_templateparser.php"
-#line 668 "smarty_internal_templateparser.y"
- function yy_r101(){
- $this->_retvalue = $this->yystack[$this->yyidx + -6]->minor.' ? '. $this->compileVariable("'".$this->yystack[$this->yyidx + -2]->minor."'") . ' : '.$this->yystack[$this->yyidx + 0]->minor;
- }
-#line 2638 "smarty_internal_templateparser.php"
-#line 672 "smarty_internal_templateparser.y"
- function yy_r102(){
- $this->_retvalue = $this->yystack[$this->yyidx + -5]->minor.' ? '.$this->yystack[$this->yyidx + -2]->minor.' : '.$this->yystack[$this->yyidx + 0]->minor;
- }
-#line 2643 "smarty_internal_templateparser.php"
-#line 687 "smarty_internal_templateparser.y"
- function yy_r105(){
- $this->_retvalue = '!'.$this->yystack[$this->yyidx + 0]->minor;
- }
-#line 2648 "smarty_internal_templateparser.php"
-#line 708 "smarty_internal_templateparser.y"
- function yy_r110(){
- $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.'.'.$this->yystack[$this->yyidx + 0]->minor;
- }
-#line 2653 "smarty_internal_templateparser.php"
-#line 712 "smarty_internal_templateparser.y"
- function yy_r111(){
- $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor.'.';
- }
-#line 2658 "smarty_internal_templateparser.php"
-#line 716 "smarty_internal_templateparser.y"
- function yy_r112(){
- $this->_retvalue = '.'.$this->yystack[$this->yyidx + 0]->minor;
- }
-#line 2663 "smarty_internal_templateparser.php"
-#line 721 "smarty_internal_templateparser.y"
- function yy_r113(){
- if (preg_match('~^true$~i', $this->yystack[$this->yyidx + 0]->minor)) {
- $this->_retvalue = 'true';
- } elseif (preg_match('~^false$~i', $this->yystack[$this->yyidx + 0]->minor)) {
- $this->_retvalue = 'false';
- } elseif (preg_match('~^null$~i', $this->yystack[$this->yyidx + 0]->minor)) {
- $this->_retvalue = 'null';
- } else {
- $this->_retvalue = "'".$this->yystack[$this->yyidx + 0]->minor."'";
- }
- }
-#line 2676 "smarty_internal_templateparser.php"
-#line 739 "smarty_internal_templateparser.y"
- function yy_r115(){
- $this->_retvalue = "(". $this->yystack[$this->yyidx + -1]->minor .")";
- }
-#line 2681 "smarty_internal_templateparser.php"
-#line 754 "smarty_internal_templateparser.y"
- function yy_r118(){
- if (!$this->security || isset($this->smarty->registered_classes[$this->yystack[$this->yyidx + -2]->minor]) || $this->smarty->security_policy->isTrustedStaticClass($this->yystack[$this->yyidx + -2]->minor, $this->compiler)) {
- if (isset($this->smarty->registered_classes[$this->yystack[$this->yyidx + -2]->minor])) {
- $this->_retvalue = $this->smarty->registered_classes[$this->yystack[$this->yyidx + -2]->minor].'::'.$this->yystack[$this->yyidx + 0]->minor;
+ #line 2635 "smarty_internal_templateparser.php"
+ #line 726 "smarty_internal_templateparser.y"
+ function yy_r111()
+ {
+ $this->_retvalue = $this->yystack[$this->yyidx + - 2]->minor . '.' . $this->yystack[$this->yyidx + 0]->minor;
+ }
+ #line 2640 "smarty_internal_templateparser.php"
+ #line 730 "smarty_internal_templateparser.y"
+ function yy_r112()
+ {
+ $this->_retvalue = $this->yystack[$this->yyidx + - 1]->minor . '.';
+ }
+ #line 2645 "smarty_internal_templateparser.php"
+ #line 734 "smarty_internal_templateparser.y"
+ function yy_r113()
+ {
+ $this->_retvalue = '.' . $this->yystack[$this->yyidx + 0]->minor;
+ }
+ #line 2650 "smarty_internal_templateparser.php"
+ #line 739 "smarty_internal_templateparser.y"
+ function yy_r114()
+ {
+ if (preg_match('~^true$~i', $this->yystack[$this->yyidx + 0]->minor)) {
+ $this->_retvalue = 'true';
+ } elseif (preg_match('~^false$~i', $this->yystack[$this->yyidx + 0]->minor)) {
+ $this->_retvalue = 'false';
+ } elseif (preg_match('~^null$~i', $this->yystack[$this->yyidx + 0]->minor)) {
+ $this->_retvalue = 'null';
} else {
- $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.'::'.$this->yystack[$this->yyidx + 0]->minor;
+ $this->_retvalue = "'" . $this->yystack[$this->yyidx + 0]->minor . "'";
}
- } else {
- $this->compiler->trigger_template_error ("static class '".$this->yystack[$this->yyidx + -2]->minor."' is undefined or not allowed by security setting");
- }
- }
-#line 2694 "smarty_internal_templateparser.php"
-#line 766 "smarty_internal_templateparser.y"
- function yy_r119(){
- if ($this->yystack[$this->yyidx + -2]->minor['var'] == '\'smarty\'') {
- $this->_retvalue = $this->compiler->compileTag('private_special_variable',array(),$this->yystack[$this->yyidx + -2]->minor['smarty_internal_index']).'::'.$this->yystack[$this->yyidx + 0]->minor;
- } else {
- $this->_retvalue = $this->compileVariable($this->yystack[$this->yyidx + -2]->minor['var']).$this->yystack[$this->yyidx + -2]->minor['smarty_internal_index'].'::'.$this->yystack[$this->yyidx + 0]->minor;
- }
- }
-#line 2703 "smarty_internal_templateparser.php"
-#line 775 "smarty_internal_templateparser.y"
- function yy_r120(){
- $this->prefix_number++;
- $this->compiler->prefix_code[] = '<?php ob_start();?>'.$this->yystack[$this->yyidx + 0]->minor.'<?php $_tmp'.$this->prefix_number.'=ob_get_clean();?>';
- $this->_retvalue = '$_tmp'.$this->prefix_number;
- }
-#line 2710 "smarty_internal_templateparser.php"
-#line 790 "smarty_internal_templateparser.y"
- function yy_r122(){
- if ($this->yystack[$this->yyidx + 0]->minor['var'] == '\'smarty\'') {
- $smarty_var = $this->compiler->compileTag('private_special_variable',array(),$this->yystack[$this->yyidx + 0]->minor['smarty_internal_index']);
- $this->_retvalue = $smarty_var;
- } else {
- // used for array reset,next,prev,end,current
- $this->last_variable = $this->yystack[$this->yyidx + 0]->minor['var'];
- $this->last_index = $this->yystack[$this->yyidx + 0]->minor['smarty_internal_index'];
- $this->_retvalue = $this->compileVariable($this->yystack[$this->yyidx + 0]->minor['var']).$this->yystack[$this->yyidx + 0]->minor['smarty_internal_index'];
- }
- }
-#line 2723 "smarty_internal_templateparser.php"
-#line 803 "smarty_internal_templateparser.y"
- function yy_r123(){
- $this->_retvalue = '$_smarty_tpl->tpl_vars['. $this->yystack[$this->yyidx + -2]->minor .']->'.$this->yystack[$this->yyidx + 0]->minor;
- }
-#line 2728 "smarty_internal_templateparser.php"
-#line 813 "smarty_internal_templateparser.y"
- function yy_r125(){
- $this->_retvalue = '$_smarty_tpl->getConfigVariable(\''. $this->yystack[$this->yyidx + -1]->minor .'\')';
- }
-#line 2733 "smarty_internal_templateparser.php"
-#line 817 "smarty_internal_templateparser.y"
- function yy_r126(){
- $this->_retvalue = '$_smarty_tpl->getConfigVariable('. $this->yystack[$this->yyidx + -1]->minor .')';
- }
-#line 2738 "smarty_internal_templateparser.php"
-#line 821 "smarty_internal_templateparser.y"
- function yy_r127(){
- $this->_retvalue = array('var'=>$this->yystack[$this->yyidx + -1]->minor, 'smarty_internal_index'=>$this->yystack[$this->yyidx + 0]->minor);
- }
-#line 2743 "smarty_internal_templateparser.php"
-#line 834 "smarty_internal_templateparser.y"
- function yy_r129(){
- return;
- }
-#line 2748 "smarty_internal_templateparser.php"
-#line 840 "smarty_internal_templateparser.y"
- function yy_r130(){
- $this->_retvalue = '['.$this->compileVariable($this->yystack[$this->yyidx + 0]->minor).']';
- }
-#line 2753 "smarty_internal_templateparser.php"
-#line 844 "smarty_internal_templateparser.y"
- function yy_r131(){
- $this->_retvalue = '['.$this->compileVariable($this->yystack[$this->yyidx + -2]->minor).'->'.$this->yystack[$this->yyidx + 0]->minor.']';
- }
-#line 2758 "smarty_internal_templateparser.php"
-#line 848 "smarty_internal_templateparser.y"
- function yy_r132(){
- $this->_retvalue = "['". $this->yystack[$this->yyidx + 0]->minor ."']";
- }
-#line 2763 "smarty_internal_templateparser.php"
-#line 852 "smarty_internal_templateparser.y"
- function yy_r133(){
- $this->_retvalue = "[". $this->yystack[$this->yyidx + 0]->minor ."]";
- }
-#line 2768 "smarty_internal_templateparser.php"
-#line 856 "smarty_internal_templateparser.y"
- function yy_r134(){
- $this->_retvalue = "[". $this->yystack[$this->yyidx + -1]->minor ."]";
- }
-#line 2773 "smarty_internal_templateparser.php"
-#line 861 "smarty_internal_templateparser.y"
- function yy_r135(){
- $this->_retvalue = '['.$this->compiler->compileTag('private_special_variable',array(),'[\'section\'][\''.$this->yystack[$this->yyidx + -1]->minor.'\'][\'index\']').']';
- }
-#line 2778 "smarty_internal_templateparser.php"
-#line 865 "smarty_internal_templateparser.y"
- function yy_r136(){
- $this->_retvalue = '['.$this->compiler->compileTag('private_special_variable',array(),'[\'section\'][\''.$this->yystack[$this->yyidx + -3]->minor.'\'][\''.$this->yystack[$this->yyidx + -1]->minor.'\']').']';
- }
-#line 2783 "smarty_internal_templateparser.php"
-#line 875 "smarty_internal_templateparser.y"
- function yy_r138(){
- $this->_retvalue = '[]';
- }
-#line 2788 "smarty_internal_templateparser.php"
-#line 888 "smarty_internal_templateparser.y"
- function yy_r140(){
- $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor.'.'.$this->yystack[$this->yyidx + 0]->minor;
- }
-#line 2793 "smarty_internal_templateparser.php"
-#line 893 "smarty_internal_templateparser.y"
- function yy_r141(){
- $this->_retvalue = '\''.$this->yystack[$this->yyidx + 0]->minor.'\'';
- }
-#line 2798 "smarty_internal_templateparser.php"
-#line 898 "smarty_internal_templateparser.y"
- function yy_r142(){
- $this->_retvalue = '('.$this->yystack[$this->yyidx + -1]->minor.')';
- }
-#line 2803 "smarty_internal_templateparser.php"
-#line 905 "smarty_internal_templateparser.y"
- function yy_r143(){
- if ($this->yystack[$this->yyidx + -1]->minor['var'] == '\'smarty\'') {
- $this->_retvalue = $this->compiler->compileTag('private_special_variable',array(),$this->yystack[$this->yyidx + -1]->minor['smarty_internal_index']).$this->yystack[$this->yyidx + 0]->minor;
- } else {
- $this->_retvalue = $this->compileVariable($this->yystack[$this->yyidx + -1]->minor['var']).$this->yystack[$this->yyidx + -1]->minor['smarty_internal_index'].$this->yystack[$this->yyidx + 0]->minor;
- }
- }
-#line 2812 "smarty_internal_templateparser.php"
-#line 914 "smarty_internal_templateparser.y"
- function yy_r144(){
- $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor;
- }
-#line 2817 "smarty_internal_templateparser.php"
-#line 919 "smarty_internal_templateparser.y"
- function yy_r145(){
- $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor;
- }
-#line 2822 "smarty_internal_templateparser.php"
-#line 924 "smarty_internal_templateparser.y"
- function yy_r146(){
- if ($this->security && substr($this->yystack[$this->yyidx + -1]->minor,0,1) == '_') {
- $this->compiler->trigger_template_error (self::Err1);
- }
- $this->_retvalue = '->'.$this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor;
- }
-#line 2830 "smarty_internal_templateparser.php"
-#line 931 "smarty_internal_templateparser.y"
- function yy_r147(){
- if ($this->security) {
- $this->compiler->trigger_template_error (self::Err2);
- }
- $this->_retvalue = '->{'.$this->compileVariable($this->yystack[$this->yyidx + -1]->minor).$this->yystack[$this->yyidx + 0]->minor.'}';
- }
-#line 2838 "smarty_internal_templateparser.php"
-#line 938 "smarty_internal_templateparser.y"
- function yy_r148(){
- if ($this->security) {
- $this->compiler->trigger_template_error (self::Err2);
- }
- $this->_retvalue = '->{'.$this->yystack[$this->yyidx + -2]->minor.$this->yystack[$this->yyidx + 0]->minor.'}';
- }
-#line 2846 "smarty_internal_templateparser.php"
-#line 945 "smarty_internal_templateparser.y"
- function yy_r149(){
- if ($this->security) {
- $this->compiler->trigger_template_error (self::Err2);
- }
- $this->_retvalue = '->{\''.$this->yystack[$this->yyidx + -4]->minor.'\'.'.$this->yystack[$this->yyidx + -2]->minor.$this->yystack[$this->yyidx + 0]->minor.'}';
- }
-#line 2854 "smarty_internal_templateparser.php"
-#line 953 "smarty_internal_templateparser.y"
- function yy_r150(){
- $this->_retvalue = '->'.$this->yystack[$this->yyidx + 0]->minor;
- }
-#line 2859 "smarty_internal_templateparser.php"
-#line 961 "smarty_internal_templateparser.y"
- function yy_r151(){
- if (!$this->security || $this->smarty->security_policy->isTrustedPhpFunction($this->yystack[$this->yyidx + -3]->minor, $this->compiler)) {
- if (strcasecmp($this->yystack[$this->yyidx + -3]->minor,'isset') === 0 || strcasecmp($this->yystack[$this->yyidx + -3]->minor,'empty') === 0 || strcasecmp($this->yystack[$this->yyidx + -3]->minor,'array') === 0 || is_callable($this->yystack[$this->yyidx + -3]->minor)) {
- $func_name = strtolower($this->yystack[$this->yyidx + -3]->minor);
- if ($func_name == 'isset') {
- if (count($this->yystack[$this->yyidx + -1]->minor) == 0) {
- $this->compiler->trigger_template_error ('Illegal number of paramer in "isset()"');
- }
- $par = implode(',',$this->yystack[$this->yyidx + -1]->minor);
- if (strncasecmp($par,'$_smarty_tpl->getConfigVariable',strlen('$_smarty_tpl->getConfigVariable')) === 0) {
- $this->prefix_number++;
- $this->compiler->prefix_code[] = '<?php $_tmp'.$this->prefix_number.'='.str_replace(')',', false)',$par).';?>';
- $isset_par = '$_tmp'.$this->prefix_number;
- } else {
- $isset_par=str_replace("')->value","',null,true,false)->value",$par);
- }
- $this->_retvalue = $this->yystack[$this->yyidx + -3]->minor . "(". $isset_par .")";
- } elseif (in_array($func_name,array('empty','reset','current','end','prev','next'))){
- if (count($this->yystack[$this->yyidx + -1]->minor) != 1) {
- $this->compiler->trigger_template_error ('Illegal number of paramer in "empty()"');
- }
- if ($func_name == 'empty') {
- $this->_retvalue = $func_name.'('.str_replace("')->value","',null,true,false)->value",$this->yystack[$this->yyidx + -1]->minor[0]).')';
+ }
+ #line 2663 "smarty_internal_templateparser.php"
+ #line 757 "smarty_internal_templateparser.y"
+ function yy_r116()
+ {
+ $this->_retvalue = "(" . $this->yystack[$this->yyidx + - 1]->minor . ")";
+ }
+ #line 2668 "smarty_internal_templateparser.php"
+ #line 772 "smarty_internal_templateparser.y"
+ function yy_r119()
+ {
+ if (!$this->security || isset($this->smarty->registered_classes[$this->yystack[$this->yyidx + - 2]->minor]) || $this->smarty->security_policy->isTrustedStaticClass($this->yystack[$this->yyidx + - 2]->minor, $this->compiler)) {
+ if (isset($this->smarty->registered_classes[$this->yystack[$this->yyidx + - 2]->minor])) {
+ $this->_retvalue = $this->smarty->registered_classes[$this->yystack[$this->yyidx + - 2]->minor] . '::' . $this->yystack[$this->yyidx + 0]->minor;
+ } else {
+ $this->_retvalue = $this->yystack[$this->yyidx + - 2]->minor . '::' . $this->yystack[$this->yyidx + 0]->minor;
+ }
+ } else {
+ $this->compiler->trigger_template_error("static class '" . $this->yystack[$this->yyidx + - 2]->minor . "' is undefined or not allowed by security setting");
+ }
+ }
+ #line 2681 "smarty_internal_templateparser.php"
+ #line 784 "smarty_internal_templateparser.y"
+ function yy_r120()
+ {
+ if ($this->yystack[$this->yyidx + - 2]->minor['var'] == '\'smarty\'') {
+ $this->_retvalue = $this->compiler->compileTag('private_special_variable', array(), $this->yystack[$this->yyidx + - 2]->minor['smarty_internal_index']) . '::' . $this->yystack[$this->yyidx + 0]->minor;
+ } else {
+ $this->_retvalue = $this->compileVariable($this->yystack[$this->yyidx + - 2]->minor['var']) . $this->yystack[$this->yyidx + - 2]->minor['smarty_internal_index'] . '::' . $this->yystack[$this->yyidx + 0]->minor;
+ }
+ }
+ #line 2690 "smarty_internal_templateparser.php"
+ #line 793 "smarty_internal_templateparser.y"
+ function yy_r121()
+ {
+ self::$prefix_number ++;
+ $this->compiler->prefix_code[] = '<?php ob_start();?>' . $this->yystack[$this->yyidx + - 1]->minor . '<?php $_tmp' . self::$prefix_number . '=ob_get_clean();?>';
+ $this->_retvalue = '$_tmp' . self::$prefix_number;
+ }
+ #line 2697 "smarty_internal_templateparser.php"
+ #line 808 "smarty_internal_templateparser.y"
+ function yy_r123()
+ {
+ if ($this->yystack[$this->yyidx + 0]->minor['var'] == '\'smarty\'') {
+ $smarty_var = $this->compiler->compileTag('private_special_variable', array(), $this->yystack[$this->yyidx + 0]->minor['smarty_internal_index']);
+ $this->_retvalue = $smarty_var;
+ } else {
+ // used for array reset,next,prev,end,current
+ $this->last_variable = $this->yystack[$this->yyidx + 0]->minor['var'];
+ $this->last_index = $this->yystack[$this->yyidx + 0]->minor['smarty_internal_index'];
+ $this->_retvalue = $this->compileVariable($this->yystack[$this->yyidx + 0]->minor['var']) . $this->yystack[$this->yyidx + 0]->minor['smarty_internal_index'];
+ }
+ }
+ #line 2710 "smarty_internal_templateparser.php"
+ #line 821 "smarty_internal_templateparser.y"
+ function yy_r124()
+ {
+ $this->_retvalue = '$_smarty_tpl->tpl_vars[' . $this->yystack[$this->yyidx + - 2]->minor . ']->' . $this->yystack[$this->yyidx + 0]->minor;
+ }
+ #line 2715 "smarty_internal_templateparser.php"
+ #line 831 "smarty_internal_templateparser.y"
+ function yy_r126()
+ {
+ $this->_retvalue = '$_smarty_tpl->getConfigVariable(\'' . $this->yystack[$this->yyidx + - 1]->minor . '\')';
+ }
+ #line 2720 "smarty_internal_templateparser.php"
+ #line 835 "smarty_internal_templateparser.y"
+ function yy_r127()
+ {
+ $this->_retvalue = '(is_array($tmp = $_smarty_tpl->getConfigVariable(\'' . $this->yystack[$this->yyidx + - 2]->minor . '\')) ? $tmp' . $this->yystack[$this->yyidx + 0]->minor . ' :null)';
+ }
+ #line 2725 "smarty_internal_templateparser.php"
+ #line 839 "smarty_internal_templateparser.y"
+ function yy_r128()
+ {
+ $this->_retvalue = '$_smarty_tpl->getConfigVariable(' . $this->yystack[$this->yyidx + - 1]->minor . ')';
+ }
+ #line 2730 "smarty_internal_templateparser.php"
+ #line 843 "smarty_internal_templateparser.y"
+ function yy_r129()
+ {
+ $this->_retvalue = '(is_array($tmp = $_smarty_tpl->getConfigVariable(' . $this->yystack[$this->yyidx + - 2]->minor . ')) ? $tmp' . $this->yystack[$this->yyidx + 0]->minor . ' : null)';
+ }
+ #line 2735 "smarty_internal_templateparser.php"
+ #line 847 "smarty_internal_templateparser.y"
+ function yy_r130()
+ {
+ $this->_retvalue = array('var' => $this->yystack[$this->yyidx + - 1]->minor, 'smarty_internal_index' => $this->yystack[$this->yyidx + 0]->minor);
+ }
+ #line 2740 "smarty_internal_templateparser.php"
+ #line 860 "smarty_internal_templateparser.y"
+ function yy_r132()
+ {
+ return;
+ }
+ #line 2745 "smarty_internal_templateparser.php"
+ #line 866 "smarty_internal_templateparser.y"
+ function yy_r133()
+ {
+ $this->_retvalue = '[' . $this->compileVariable($this->yystack[$this->yyidx + 0]->minor) . ']';
+ }
+ #line 2750 "smarty_internal_templateparser.php"
+ #line 870 "smarty_internal_templateparser.y"
+ function yy_r134()
+ {
+ $this->_retvalue = '[' . $this->compileVariable($this->yystack[$this->yyidx + - 2]->minor) . '->' . $this->yystack[$this->yyidx + 0]->minor . ']';
+ }
+ #line 2755 "smarty_internal_templateparser.php"
+ #line 874 "smarty_internal_templateparser.y"
+ function yy_r135()
+ {
+ $this->_retvalue = "['" . $this->yystack[$this->yyidx + 0]->minor . "']";
+ }
+ #line 2760 "smarty_internal_templateparser.php"
+ #line 878 "smarty_internal_templateparser.y"
+ function yy_r136()
+ {
+ $this->_retvalue = "[" . $this->yystack[$this->yyidx + 0]->minor . "]";
+ }
+ #line 2765 "smarty_internal_templateparser.php"
+ #line 882 "smarty_internal_templateparser.y"
+ function yy_r137()
+ {
+ $this->_retvalue = "[" . $this->yystack[$this->yyidx + - 1]->minor . "]";
+ }
+ #line 2770 "smarty_internal_templateparser.php"
+ #line 887 "smarty_internal_templateparser.y"
+ function yy_r138()
+ {
+ $this->_retvalue = '[' . $this->compiler->compileTag('private_special_variable', array(), '[\'section\'][\'' . $this->yystack[$this->yyidx + - 1]->minor . '\'][\'index\']') . ']';
+ }
+ #line 2775 "smarty_internal_templateparser.php"
+ #line 891 "smarty_internal_templateparser.y"
+ function yy_r139()
+ {
+ $this->_retvalue = '[' . $this->compiler->compileTag('private_special_variable', array(), '[\'section\'][\'' . $this->yystack[$this->yyidx + - 3]->minor . '\'][\'' . $this->yystack[$this->yyidx + - 1]->minor . '\']') . ']';
+ }
+ #line 2780 "smarty_internal_templateparser.php"
+ #line 901 "smarty_internal_templateparser.y"
+ function yy_r141()
+ {
+ $this->_retvalue = '[]';
+ }
+ #line 2785 "smarty_internal_templateparser.php"
+ #line 914 "smarty_internal_templateparser.y"
+ function yy_r143()
+ {
+ $this->_retvalue = $this->yystack[$this->yyidx + - 1]->minor . '.' . $this->yystack[$this->yyidx + 0]->minor;
+ }
+ #line 2790 "smarty_internal_templateparser.php"
+ #line 919 "smarty_internal_templateparser.y"
+ function yy_r144()
+ {
+ $this->_retvalue = '\'' . $this->yystack[$this->yyidx + 0]->minor . '\'';
+ }
+ #line 2795 "smarty_internal_templateparser.php"
+ #line 924 "smarty_internal_templateparser.y"
+ function yy_r145()
+ {
+ $this->_retvalue = '(' . $this->yystack[$this->yyidx + - 1]->minor . ')';
+ }
+ #line 2800 "smarty_internal_templateparser.php"
+ #line 931 "smarty_internal_templateparser.y"
+ function yy_r146()
+ {
+ if ($this->yystack[$this->yyidx + - 1]->minor['var'] == '\'smarty\'') {
+ $this->_retvalue = $this->compiler->compileTag('private_special_variable', array(), $this->yystack[$this->yyidx + - 1]->minor['smarty_internal_index']) . $this->yystack[$this->yyidx + 0]->minor;
+ } else {
+ $this->_retvalue = $this->compileVariable($this->yystack[$this->yyidx + - 1]->minor['var']) . $this->yystack[$this->yyidx + - 1]->minor['smarty_internal_index'] . $this->yystack[$this->yyidx + 0]->minor;
+ }
+ }
+ #line 2809 "smarty_internal_templateparser.php"
+ #line 940 "smarty_internal_templateparser.y"
+ function yy_r147()
+ {
+ $this->_retvalue = $this->yystack[$this->yyidx + 0]->minor;
+ }
+ #line 2814 "smarty_internal_templateparser.php"
+ #line 945 "smarty_internal_templateparser.y"
+ function yy_r148()
+ {
+ $this->_retvalue = $this->yystack[$this->yyidx + - 1]->minor . $this->yystack[$this->yyidx + 0]->minor;
+ }
+ #line 2819 "smarty_internal_templateparser.php"
+ #line 950 "smarty_internal_templateparser.y"
+ function yy_r149()
+ {
+ if ($this->security && substr($this->yystack[$this->yyidx + - 1]->minor, 0, 1) == '_') {
+ $this->compiler->trigger_template_error(self::Err1);
+ }
+ $this->_retvalue = '->' . $this->yystack[$this->yyidx + - 1]->minor . $this->yystack[$this->yyidx + 0]->minor;
+ }
+ #line 2827 "smarty_internal_templateparser.php"
+ #line 957 "smarty_internal_templateparser.y"
+ function yy_r150()
+ {
+ if ($this->security) {
+ $this->compiler->trigger_template_error(self::Err2);
+ }
+ $this->_retvalue = '->{' . $this->compileVariable($this->yystack[$this->yyidx + - 1]->minor) . $this->yystack[$this->yyidx + 0]->minor . '}';
+ }
+ #line 2835 "smarty_internal_templateparser.php"
+ #line 964 "smarty_internal_templateparser.y"
+ function yy_r151()
+ {
+ if ($this->security) {
+ $this->compiler->trigger_template_error(self::Err2);
+ }
+ $this->_retvalue = '->{' . $this->yystack[$this->yyidx + - 2]->minor . $this->yystack[$this->yyidx + 0]->minor . '}';
+ }
+ #line 2843 "smarty_internal_templateparser.php"
+ #line 971 "smarty_internal_templateparser.y"
+ function yy_r152()
+ {
+ if ($this->security) {
+ $this->compiler->trigger_template_error(self::Err2);
+ }
+ $this->_retvalue = '->{\'' . $this->yystack[$this->yyidx + - 4]->minor . '\'.' . $this->yystack[$this->yyidx + - 2]->minor . $this->yystack[$this->yyidx + 0]->minor . '}';
+ }
+ #line 2851 "smarty_internal_templateparser.php"
+ #line 979 "smarty_internal_templateparser.y"
+ function yy_r153()
+ {
+ $this->_retvalue = '->' . $this->yystack[$this->yyidx + 0]->minor;
+ }
+ #line 2856 "smarty_internal_templateparser.php"
+ #line 987 "smarty_internal_templateparser.y"
+ function yy_r154()
+ {
+ if (!$this->security || $this->smarty->security_policy->isTrustedPhpFunction($this->yystack[$this->yyidx + - 3]->minor, $this->compiler)) {
+ if (strcasecmp($this->yystack[$this->yyidx + - 3]->minor, 'isset') === 0 || strcasecmp($this->yystack[$this->yyidx + - 3]->minor, 'empty') === 0 || strcasecmp($this->yystack[$this->yyidx + - 3]->minor, 'array') === 0 || is_callable($this->yystack[$this->yyidx + - 3]->minor)) {
+ $func_name = strtolower($this->yystack[$this->yyidx + - 3]->minor);
+ if ($func_name == 'isset') {
+ if (count($this->yystack[$this->yyidx + - 1]->minor) == 0) {
+ $this->compiler->trigger_template_error('Illegal number of paramer in "isset()"');
+ }
+ $par = implode(',', $this->yystack[$this->yyidx + - 1]->minor);
+ if (strncasecmp($par, '$_smarty_tpl->getConfigVariable', strlen('$_smarty_tpl->getConfigVariable')) === 0) {
+ self::$prefix_number ++;
+ $this->compiler->prefix_code[] = '<?php $_tmp' . self::$prefix_number . '=' . str_replace(')', ', false)', $par) . ';?>';
+ $isset_par = '$_tmp' . self::$prefix_number;
+ } else {
+ $isset_par = str_replace("')->value", "',null,true,false)->value", $par);
+ }
+ $this->_retvalue = $this->yystack[$this->yyidx + - 3]->minor . "(" . $isset_par . ")";
+ } elseif (in_array($func_name, array('empty', 'reset', 'current', 'end', 'prev', 'next'))) {
+ if (count($this->yystack[$this->yyidx + - 1]->minor) != 1) {
+ $this->compiler->trigger_template_error('Illegal number of paramer in "empty()"');
+ }
+ if ($func_name == 'empty') {
+ $this->_retvalue = $func_name . '(' . str_replace("')->value", "',null,true,false)->value", $this->yystack[$this->yyidx + - 1]->minor[0]) . ')';
+ } else {
+ $this->_retvalue = $func_name . '(' . $this->yystack[$this->yyidx + - 1]->minor[0] . ')';
+ }
} else {
- $this->_retvalue = $func_name.'('.$this->yystack[$this->yyidx + -1]->minor[0].')';
+ $this->_retvalue = $this->yystack[$this->yyidx + - 3]->minor . "(" . implode(',', $this->yystack[$this->yyidx + - 1]->minor) . ")";
}
} else {
- $this->_retvalue = $this->yystack[$this->yyidx + -3]->minor . "(". implode(',',$this->yystack[$this->yyidx + -1]->minor) .")";
+ $this->compiler->trigger_template_error("unknown function \"" . $this->yystack[$this->yyidx + - 3]->minor . "\"");
}
- } else {
- $this->compiler->trigger_template_error ("unknown function \"" . $this->yystack[$this->yyidx + -3]->minor . "\"");
}
}
+ #line 2892 "smarty_internal_templateparser.php"
+ #line 1025 "smarty_internal_templateparser.y"
+ function yy_r155()
+ {
+ if ($this->security && substr($this->yystack[$this->yyidx + - 3]->minor, 0, 1) == '_') {
+ $this->compiler->trigger_template_error(self::Err1);
+ }
+ $this->_retvalue = $this->yystack[$this->yyidx + - 3]->minor . "(" . implode(',', $this->yystack[$this->yyidx + - 1]->minor) . ")";
+ }
+ #line 2900 "smarty_internal_templateparser.php"
+ #line 1032 "smarty_internal_templateparser.y"
+ function yy_r156()
+ {
+ if ($this->security) {
+ $this->compiler->trigger_template_error(self::Err2);
+ }
+ self::$prefix_number ++;
+ $this->compiler->prefix_code[] = '<?php $_tmp' . self::$prefix_number . '=' . $this->compileVariable("'" . $this->yystack[$this->yyidx + - 3]->minor . "'") . ';?>';
+ $this->_retvalue = '$_tmp' . self::$prefix_number . '(' . implode(',', $this->yystack[$this->yyidx + - 1]->minor) . ')';
+ }
+ #line 2910 "smarty_internal_templateparser.php"
+ #line 1043 "smarty_internal_templateparser.y"
+ function yy_r157()
+ {
+ $this->_retvalue = array_merge($this->yystack[$this->yyidx + - 2]->minor, array($this->yystack[$this->yyidx + 0]->minor));
+ }
+ #line 2915 "smarty_internal_templateparser.php"
+ #line 1060 "smarty_internal_templateparser.y"
+ function yy_r160()
+ {
+ $this->_retvalue = array_merge($this->yystack[$this->yyidx + - 2]->minor, array(array_merge($this->yystack[$this->yyidx + - 1]->minor, $this->yystack[$this->yyidx + 0]->minor)));
+ }
+ #line 2920 "smarty_internal_templateparser.php"
+ #line 1064 "smarty_internal_templateparser.y"
+ function yy_r161()
+ {
+ $this->_retvalue = array(array_merge($this->yystack[$this->yyidx + - 1]->minor, $this->yystack[$this->yyidx + 0]->minor));
+ }
+ #line 2925 "smarty_internal_templateparser.php"
+ #line 1072 "smarty_internal_templateparser.y"
+ function yy_r163()
+ {
+ $this->_retvalue = array($this->yystack[$this->yyidx + 0]->minor);
}
-#line 2895 "smarty_internal_templateparser.php"
-#line 999 "smarty_internal_templateparser.y"
- function yy_r152(){
- if ($this->security && substr($this->yystack[$this->yyidx + -3]->minor,0,1) == '_') {
- $this->compiler->trigger_template_error (self::Err1);
- }
- $this->_retvalue = $this->yystack[$this->yyidx + -3]->minor . "(". implode(',',$this->yystack[$this->yyidx + -1]->minor) .")";
- }
-#line 2903 "smarty_internal_templateparser.php"
-#line 1006 "smarty_internal_templateparser.y"
- function yy_r153(){
- if ($this->security) {
- $this->compiler->trigger_template_error (self::Err2);
- }
- $this->prefix_number++;
- $this->compiler->prefix_code[] = '<?php $_tmp'.$this->prefix_number.'='.$this->compileVariable("'".$this->yystack[$this->yyidx + -3]->minor."'").';?>';
- $this->_retvalue = '$_tmp'.$this->prefix_number.'('. implode(',',$this->yystack[$this->yyidx + -1]->minor) .')';
- }
-#line 2913 "smarty_internal_templateparser.php"
-#line 1017 "smarty_internal_templateparser.y"
- function yy_r154(){
- $this->_retvalue = array_merge($this->yystack[$this->yyidx + -2]->minor,array($this->yystack[$this->yyidx + 0]->minor));
- }
-#line 2918 "smarty_internal_templateparser.php"
-#line 1034 "smarty_internal_templateparser.y"
- function yy_r157(){
- $this->_retvalue = array_merge($this->yystack[$this->yyidx + -2]->minor,array(array_merge($this->yystack[$this->yyidx + -1]->minor,$this->yystack[$this->yyidx + 0]->minor)));
- }
-#line 2923 "smarty_internal_templateparser.php"
-#line 1038 "smarty_internal_templateparser.y"
- function yy_r158(){
- $this->_retvalue = array(array_merge($this->yystack[$this->yyidx + -1]->minor,$this->yystack[$this->yyidx + 0]->minor));
- }
-#line 2928 "smarty_internal_templateparser.php"
-#line 1046 "smarty_internal_templateparser.y"
- function yy_r160(){
- $this->_retvalue = array($this->yystack[$this->yyidx + 0]->minor);
- }
-#line 2933 "smarty_internal_templateparser.php"
-#line 1054 "smarty_internal_templateparser.y"
- function yy_r161(){
- $this->_retvalue = array_merge($this->yystack[$this->yyidx + -1]->minor,$this->yystack[$this->yyidx + 0]->minor);
- }
-#line 2938 "smarty_internal_templateparser.php"
-#line 1088 "smarty_internal_templateparser.y"
- function yy_r168(){
- $this->_retvalue = '$'.$this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor;
- }
-#line 2943 "smarty_internal_templateparser.php"
-#line 1093 "smarty_internal_templateparser.y"
- function yy_r169(){
- $this->_retvalue = '$'.$this->yystack[$this->yyidx + -2]->minor.$this->yystack[$this->yyidx + -1]->minor.$this->yystack[$this->yyidx + 0]->minor;
- }
-#line 2948 "smarty_internal_templateparser.php"
-#line 1099 "smarty_internal_templateparser.y"
- function yy_r170(){
- $this->_retvalue = '==';
- }
-#line 2953 "smarty_internal_templateparser.php"
-#line 1103 "smarty_internal_templateparser.y"
- function yy_r171(){
- $this->_retvalue = '!=';
- }
-#line 2958 "smarty_internal_templateparser.php"
-#line 1107 "smarty_internal_templateparser.y"
- function yy_r172(){
- $this->_retvalue = '>';
- }
-#line 2963 "smarty_internal_templateparser.php"
-#line 1111 "smarty_internal_templateparser.y"
- function yy_r173(){
- $this->_retvalue = '<';
- }
-#line 2968 "smarty_internal_templateparser.php"
-#line 1115 "smarty_internal_templateparser.y"
- function yy_r174(){
- $this->_retvalue = '>=';
- }
-#line 2973 "smarty_internal_templateparser.php"
-#line 1119 "smarty_internal_templateparser.y"
- function yy_r175(){
- $this->_retvalue = '<=';
- }
-#line 2978 "smarty_internal_templateparser.php"
-#line 1123 "smarty_internal_templateparser.y"
- function yy_r176(){
- $this->_retvalue = '===';
- }
-#line 2983 "smarty_internal_templateparser.php"
-#line 1127 "smarty_internal_templateparser.y"
- function yy_r177(){
- $this->_retvalue = '!==';
- }
-#line 2988 "smarty_internal_templateparser.php"
-#line 1131 "smarty_internal_templateparser.y"
- function yy_r178(){
- $this->_retvalue = '%';
- }
-#line 2993 "smarty_internal_templateparser.php"
-#line 1135 "smarty_internal_templateparser.y"
- function yy_r179(){
- $this->_retvalue = '&&';
- }
-#line 2998 "smarty_internal_templateparser.php"
-#line 1139 "smarty_internal_templateparser.y"
- function yy_r180(){
- $this->_retvalue = '||';
- }
-#line 3003 "smarty_internal_templateparser.php"
-#line 1143 "smarty_internal_templateparser.y"
- function yy_r181(){
- $this->_retvalue = ' XOR ';
- }
-#line 3008 "smarty_internal_templateparser.php"
-#line 1150 "smarty_internal_templateparser.y"
- function yy_r182(){
- $this->_retvalue = 'array('.$this->yystack[$this->yyidx + -1]->minor.')';
- }
-#line 3013 "smarty_internal_templateparser.php"
-#line 1158 "smarty_internal_templateparser.y"
- function yy_r184(){
- $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.','.$this->yystack[$this->yyidx + 0]->minor;
- }
-#line 3018 "smarty_internal_templateparser.php"
-#line 1166 "smarty_internal_templateparser.y"
- function yy_r186(){
- $this->_retvalue = $this->yystack[$this->yyidx + -2]->minor.'=>'.$this->yystack[$this->yyidx + 0]->minor;
- }
-#line 3023 "smarty_internal_templateparser.php"
-#line 1170 "smarty_internal_templateparser.y"
- function yy_r187(){
- $this->_retvalue = '\''.$this->yystack[$this->yyidx + -2]->minor.'\'=>'.$this->yystack[$this->yyidx + 0]->minor;
- }
-#line 3028 "smarty_internal_templateparser.php"
-#line 1182 "smarty_internal_templateparser.y"
- function yy_r189(){
- $this->_retvalue = "''";
- }
-#line 3033 "smarty_internal_templateparser.php"
-#line 1186 "smarty_internal_templateparser.y"
- function yy_r190(){
- $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor->to_smarty_php();
- }
-#line 3038 "smarty_internal_templateparser.php"
-#line 1191 "smarty_internal_templateparser.y"
- function yy_r191(){
- $this->yystack[$this->yyidx + -1]->minor->append_subtree($this->yystack[$this->yyidx + 0]->minor);
- $this->_retvalue = $this->yystack[$this->yyidx + -1]->minor;
- }
-#line 3044 "smarty_internal_templateparser.php"
-#line 1196 "smarty_internal_templateparser.y"
- function yy_r192(){
- $this->_retvalue = new _smarty_doublequoted($this, $this->yystack[$this->yyidx + 0]->minor);
- }
-#line 3049 "smarty_internal_templateparser.php"
-#line 1200 "smarty_internal_templateparser.y"
- function yy_r193(){
- $this->_retvalue = new _smarty_code($this, '(string)'.$this->yystack[$this->yyidx + -1]->minor);
- }
-#line 3054 "smarty_internal_templateparser.php"
-#line 1208 "smarty_internal_templateparser.y"
- function yy_r195(){
- $this->_retvalue = new _smarty_code($this, '(string)$_smarty_tpl->tpl_vars[\''. substr($this->yystack[$this->yyidx + 0]->minor,1) .'\']->value');
- }
-#line 3059 "smarty_internal_templateparser.php"
-#line 1216 "smarty_internal_templateparser.y"
- function yy_r197(){
- $this->_retvalue = new _smarty_code($this, '(string)('.$this->yystack[$this->yyidx + -1]->minor.')');
- }
-#line 3064 "smarty_internal_templateparser.php"
-#line 1220 "smarty_internal_templateparser.y"
- function yy_r198(){
- $this->_retvalue = new _smarty_tag($this, $this->yystack[$this->yyidx + 0]->minor);
- }
-#line 3069 "smarty_internal_templateparser.php"
-#line 1224 "smarty_internal_templateparser.y"
- function yy_r199(){
- $this->_retvalue = new _smarty_dq_content($this, $this->yystack[$this->yyidx + 0]->minor);
- }
-#line 3074 "smarty_internal_templateparser.php"
+ #line 2930 "smarty_internal_templateparser.php"
+ #line 1080 "smarty_internal_templateparser.y"
+ function yy_r164()
+ {
+ $this->_retvalue = array_merge($this->yystack[$this->yyidx + - 1]->minor, $this->yystack[$this->yyidx + 0]->minor);
+ }
+ #line 2935 "smarty_internal_templateparser.php"
+ #line 1114 "smarty_internal_templateparser.y"
+ function yy_r171()
+ {
+ $this->_retvalue = '$' . $this->yystack[$this->yyidx + - 1]->minor . $this->yystack[$this->yyidx + 0]->minor;
+ }
+ #line 2940 "smarty_internal_templateparser.php"
+ #line 1119 "smarty_internal_templateparser.y"
+ function yy_r172()
+ {
+ $this->_retvalue = '$' . $this->yystack[$this->yyidx + - 2]->minor . $this->yystack[$this->yyidx + - 1]->minor . $this->yystack[$this->yyidx + 0]->minor;
+ }
+ #line 2945 "smarty_internal_templateparser.php"
+ #line 1125 "smarty_internal_templateparser.y"
+ function yy_r173()
+ {
+ $this->_retvalue = '==';
+ }
+ #line 2950 "smarty_internal_templateparser.php"
+ #line 1129 "smarty_internal_templateparser.y"
+ function yy_r174()
+ {
+ $this->_retvalue = '!=';
+ }
+ #line 2955 "smarty_internal_templateparser.php"
+ #line 1133 "smarty_internal_templateparser.y"
+ function yy_r175()
+ {
+ $this->_retvalue = '>';
+ }
+ #line 2960 "smarty_internal_templateparser.php"
+ #line 1137 "smarty_internal_templateparser.y"
+ function yy_r176()
+ {
+ $this->_retvalue = '<';
+ }
+ #line 2965 "smarty_internal_templateparser.php"
+ #line 1141 "smarty_internal_templateparser.y"
+ function yy_r177()
+ {
+ $this->_retvalue = '>=';
+ }
+ #line 2970 "smarty_internal_templateparser.php"
+ #line 1145 "smarty_internal_templateparser.y"
+ function yy_r178()
+ {
+ $this->_retvalue = '<=';
+ }
+ #line 2975 "smarty_internal_templateparser.php"
+ #line 1149 "smarty_internal_templateparser.y"
+ function yy_r179()
+ {
+ $this->_retvalue = '===';
+ }
+ #line 2980 "smarty_internal_templateparser.php"
+ #line 1153 "smarty_internal_templateparser.y"
+ function yy_r180()
+ {
+ $this->_retvalue = '!==';
+ }
+ #line 2985 "smarty_internal_templateparser.php"
+ #line 1157 "smarty_internal_templateparser.y"
+ function yy_r181()
+ {
+ $this->_retvalue = '%';
+ }
+ #line 2990 "smarty_internal_templateparser.php"
+ #line 1161 "smarty_internal_templateparser.y"
+ function yy_r182()
+ {
+ $this->_retvalue = '&&';
+ }
+ #line 2995 "smarty_internal_templateparser.php"
+ #line 1165 "smarty_internal_templateparser.y"
+ function yy_r183()
+ {
+ $this->_retvalue = '||';
+ }
+ #line 3000 "smarty_internal_templateparser.php"
+ #line 1169 "smarty_internal_templateparser.y"
+ function yy_r184()
+ {
+ $this->_retvalue = ' XOR ';
+ }
+ #line 3005 "smarty_internal_templateparser.php"
+ #line 1176 "smarty_internal_templateparser.y"
+ function yy_r185()
+ {
+ $this->_retvalue = 'array(' . $this->yystack[$this->yyidx + - 1]->minor . ')';
+ }
+ #line 3010 "smarty_internal_templateparser.php"
+ #line 1184 "smarty_internal_templateparser.y"
+ function yy_r187()
+ {
+ $this->_retvalue = $this->yystack[$this->yyidx + - 2]->minor . ',' . $this->yystack[$this->yyidx + 0]->minor;
+ }
+ #line 3015 "smarty_internal_templateparser.php"
+ #line 1192 "smarty_internal_templateparser.y"
+ function yy_r189()
+ {
+ $this->_retvalue = $this->yystack[$this->yyidx + - 2]->minor . '=>' . $this->yystack[$this->yyidx + 0]->minor;
+ }
+ #line 3020 "smarty_internal_templateparser.php"
+ #line 1196 "smarty_internal_templateparser.y"
+ function yy_r190()
+ {
+ $this->_retvalue = '\'' . $this->yystack[$this->yyidx + - 2]->minor . '\'=>' . $this->yystack[$this->yyidx + 0]->minor;
+ }
+ #line 3025 "smarty_internal_templateparser.php"
+ #line 1208 "smarty_internal_templateparser.y"
+ function yy_r192()
+ {
+ $this->_retvalue = "''";
+ }
+ #line 3030 "smarty_internal_templateparser.php"
+ #line 1212 "smarty_internal_templateparser.y"
+ function yy_r193()
+ {
+ $this->_retvalue = $this->yystack[$this->yyidx + - 1]->minor->to_smarty_php();
+ }
+ #line 3035 "smarty_internal_templateparser.php"
+ #line 1217 "smarty_internal_templateparser.y"
+ function yy_r194()
+ {
+ $this->yystack[$this->yyidx + - 1]->minor->append_subtree($this->yystack[$this->yyidx + 0]->minor);
+ $this->_retvalue = $this->yystack[$this->yyidx + - 1]->minor;
+ }
+ #line 3041 "smarty_internal_templateparser.php"
+ #line 1222 "smarty_internal_templateparser.y"
+ function yy_r195()
+ {
+ $this->_retvalue = new _smarty_doublequoted($this, $this->yystack[$this->yyidx + 0]->minor);
+ }
+ #line 3046 "smarty_internal_templateparser.php"
+ #line 1226 "smarty_internal_templateparser.y"
+ function yy_r196()
+ {
+ $this->_retvalue = new _smarty_code($this, '(string)' . $this->yystack[$this->yyidx + - 1]->minor);
+ }
+ #line 3051 "smarty_internal_templateparser.php"
+ #line 1234 "smarty_internal_templateparser.y"
+ function yy_r198()
+ {
+ $this->_retvalue = new _smarty_code($this, '(string)$_smarty_tpl->tpl_vars[\'' . substr($this->yystack[$this->yyidx + 0]->minor, 1) . '\']->value');
+ }
+ #line 3056 "smarty_internal_templateparser.php"
+ #line 1242 "smarty_internal_templateparser.y"
+ function yy_r200()
+ {
+ $this->_retvalue = new _smarty_code($this, '(string)(' . $this->yystack[$this->yyidx + - 1]->minor . ')');
+ }
+ #line 3061 "smarty_internal_templateparser.php"
+ #line 1246 "smarty_internal_templateparser.y"
+ function yy_r201()
+ {
+ $this->_retvalue = new _smarty_tag($this, $this->yystack[$this->yyidx + - 1]->minor);
+ }
+ #line 3066 "smarty_internal_templateparser.php"
+ #line 1250 "smarty_internal_templateparser.y"
+ function yy_r202()
+ {
+ $this->_retvalue = new _smarty_dq_content($this, $this->yystack[$this->yyidx + 0]->minor);
+ }
+
+ #line 3071 "smarty_internal_templateparser.php"
private $_retvalue;
- function yy_reduce($yyruleno)
+ public function yy_reduce($yyruleno)
{
$yymsp = $this->yystack[$this->yyidx];
- if (self::$yyTraceFILE && $yyruleno >= 0
- && $yyruleno < count(self::$yyRuleName)) {
- fprintf(self::$yyTraceFILE, "%sReduce (%d) [%s].\n",
- self::$yyTracePrompt, $yyruleno,
- self::$yyRuleName[$yyruleno]);
+ if ($this->yyTraceFILE && $yyruleno >= 0
+ && $yyruleno < count(self::$yyRuleName)
+ ) {
+ fprintf($this->yyTraceFILE, "%sReduce (%d) [%s].\n",
+ $this->yyTracePrompt, $yyruleno,
+ self::$yyRuleName[$yyruleno]);
}
$this->_retvalue = $yy_lefthand_side = null;
$yygoto = self::$yyRuleInfo[$yyruleno]['lhs'];
$yysize = self::$yyRuleInfo[$yyruleno]['rhs'];
$this->yyidx -= $yysize;
- for($i = $yysize; $i; $i--) {
+ for ($i = $yysize; $i; $i --) {
// pop all of the right-hand side parameters
array_pop($this->yystack);
}
$yyact = $this->yy_find_reduce_action($this->yystack[$this->yyidx]->stateno, $yygoto);
if ($yyact < self::YYNSTATE) {
- if (!self::$yyTraceFILE && $yysize) {
- $this->yyidx++;
+ if (!$this->yyTraceFILE && $yysize) {
+ $this->yyidx ++;
$x = new TP_yyStackEntry;
$x->stateno = $yyact;
$x->major = $yygoto;
}
}
- function yy_parse_failed()
+ public function yy_parse_failed()
{
- if (self::$yyTraceFILE) {
- fprintf(self::$yyTraceFILE, "%sFail!\n", self::$yyTracePrompt);
+ if ($this->yyTraceFILE) {
+ fprintf($this->yyTraceFILE, "%sFail!\n", $this->yyTracePrompt);
}
while ($this->yyidx >= 0) {
$this->yy_pop_parser_stack();
}
}
- function yy_syntax_error($yymajor, $TOKEN)
+ public function yy_syntax_error($yymajor, $TOKEN)
{
-#line 77 "smarty_internal_templateparser.y"
+ #line 78 "smarty_internal_templateparser.y"
- $this->internalError = true;
- $this->yymajor = $yymajor;
- $this->compiler->trigger_template_error();
-#line 3137 "smarty_internal_templateparser.php"
+ $this->internalError = true;
+ $this->yymajor = $yymajor;
+ $this->compiler->trigger_template_error();
+ #line 3133 "smarty_internal_templateparser.php"
}
- function yy_accept()
+ public function yy_accept()
{
- if (self::$yyTraceFILE) {
- fprintf(self::$yyTraceFILE, "%sAccept!\n", self::$yyTracePrompt);
+ if ($this->yyTraceFILE) {
+ fprintf($this->yyTraceFILE, "%sAccept!\n", $this->yyTracePrompt);
}
while ($this->yyidx >= 0) {
$stack = $this->yy_pop_parser_stack();
}
-#line 69 "smarty_internal_templateparser.y"
+ #line 70 "smarty_internal_templateparser.y"
- $this->successful = !$this->internalError;
- $this->internalError = false;
- $this->retvalue = $this->_retvalue;
- //echo $this->retvalue."\n\n";
-#line 3155 "smarty_internal_templateparser.php"
+ $this->successful = !$this->internalError;
+ $this->internalError = false;
+ $this->retvalue = $this->_retvalue;
+ //echo $this->retvalue."\n\n";
+ #line 3150 "smarty_internal_templateparser.php"
}
- function doParse($yymajor, $yytokenvalue)
+ public function doParse($yymajor, $yytokenvalue)
{
- $yyerrorhit = 0; /* True if yymajor has invoked an error */
+ $yyerrorhit = 0; /* True if yymajor has invoked an error */
if ($this->yyidx === null || $this->yyidx < 0) {
$this->yyidx = 0;
- $this->yyerrcnt = -1;
+ $this->yyerrcnt = - 1;
$x = new TP_yyStackEntry;
$x->stateno = 0;
$x->major = 0;
$this->yystack = array();
array_push($this->yystack, $x);
}
- $yyendofinput = ($yymajor==0);
+ $yyendofinput = ($yymajor == 0);
- if (self::$yyTraceFILE) {
- fprintf(self::$yyTraceFILE, "%sInput %s\n",
- self::$yyTracePrompt, $this->yyTokenName[$yymajor]);
+ if ($this->yyTraceFILE) {
+ fprintf($this->yyTraceFILE, "%sInput %s\n",
+ $this->yyTracePrompt, $this->yyTokenName[$yymajor]);
}
do {
$yyact = $this->yy_find_shift_action($yymajor);
if ($yymajor < self::YYERRORSYMBOL &&
- !$this->yy_is_expected_token($yymajor)) {
+ !$this->yy_is_expected_token($yymajor)
+ ) {
// force a syntax error
$yyact = self::YY_ERROR_ACTION;
}
if ($yyact < self::YYNSTATE) {
$this->yy_shift($yyact, $yymajor, $yytokenvalue);
- $this->yyerrcnt--;
+ $this->yyerrcnt --;
if ($yyendofinput && $this->yyidx >= 0) {
$yymajor = 0;
} else {
} elseif ($yyact < self::YYNSTATE + self::YYNRULE) {
$this->yy_reduce($yyact - self::YYNSTATE);
} elseif ($yyact == self::YY_ERROR_ACTION) {
- if (self::$yyTraceFILE) {
- fprintf(self::$yyTraceFILE, "%sSyntax Error!\n",
- self::$yyTracePrompt);
+ if ($this->yyTraceFILE) {
+ fprintf($this->yyTraceFILE, "%sSyntax Error!\n",
+ $this->yyTracePrompt);
}
if (self::YYERRORSYMBOL) {
if ($this->yyerrcnt < 0) {
$this->yy_syntax_error($yymajor, $yytokenvalue);
}
$yymx = $this->yystack[$this->yyidx]->major;
- if ($yymx == self::YYERRORSYMBOL || $yyerrorhit ){
- if (self::$yyTraceFILE) {
- fprintf(self::$yyTraceFILE, "%sDiscard input token %s\n",
- self::$yyTracePrompt, $this->yyTokenName[$yymajor]);
+ if ($yymx == self::YYERRORSYMBOL || $yyerrorhit) {
+ if ($this->yyTraceFILE) {
+ fprintf($this->yyTraceFILE, "%sDiscard input token %s\n",
+ $this->yyTracePrompt, $this->yyTokenName[$yymajor]);
}
$this->yy_destructor($yymajor, $yytokenvalue);
$yymajor = self::YYNOCODE;
} else {
while ($this->yyidx >= 0 &&
- $yymx != self::YYERRORSYMBOL &&
- ($yyact = $this->yy_find_shift_action(self::YYERRORSYMBOL)) >= self::YYNSTATE
- ){
+ $yymx != self::YYERRORSYMBOL &&
+ ($yyact = $this->yy_find_shift_action(self::YYERRORSYMBOL)) >= self::YYNSTATE
+ ) {
$this->yy_pop_parser_stack();
}
- if ($this->yyidx < 0 || $yymajor==0) {
+ if ($this->yyidx < 0 || $yymajor == 0) {
$this->yy_destructor($yymajor, $yytokenvalue);
$this->yy_parse_failed();
$yymajor = self::YYNOCODE;
} while ($yymajor != self::YYNOCODE && $this->yyidx >= 0);
}
}
-?>
\ No newline at end of file
* Project: Smarty: the PHP compiling template engine
* File: smarty_internal_utility.php
* SVN: $Id: $
- *
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
- *
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
- *
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
- *
* For questions, help, comments, discussion, etc., please join the
* Smarty mailing list. Send a blank e-mail to
* smarty-discussion-subscribe@googlegroups.com
*
- * @link http://www.smarty.net/
- * @copyright 2008 New Digital Group, Inc.
- * @author Monte Ohrt <monte at ohrt dot com>
- * @author Uwe Tews
- * @package Smarty
+ * @link http://www.smarty.net/
+ * @copyright 2008 New Digital Group, Inc.
+ * @author Monte Ohrt <monte at ohrt dot com>
+ * @author Uwe Tews
+ * @package Smarty
* @subpackage PluginsInternal
- * @version 3-SVN$Rev: 3286 $
+ * @version 3-SVN$Rev: 3286 $
*/
-
/**
* Utility class
*
- * @package Smarty
+ * @package Smarty
* @subpackage Security
*/
-class Smarty_Internal_Utility {
-
+class Smarty_Internal_Utility
+{
/**
* private constructor to prevent calls creation of new instances
*/
- private final function __construct()
+ final private function __construct()
{
// intentionally left blank
}
/**
* Compile all template files
*
- * @param string $extension template file name extension
- * @param bool $force_compile force all to recompile
- * @param int $time_limit set maximum execution time
- * @param int $max_errors set maximum allowed errors
- * @param Smarty $smarty Smarty instance
+ * @param string $extension template file name extension
+ * @param bool $force_compile force all to recompile
+ * @param int $time_limit set maximum execution time
+ * @param int $max_errors set maximum allowed errors
+ * @param Smarty $smarty Smarty instance
+ *
* @return integer number of template files compiled
*/
- public static function compileAllTemplates($extention, $force_compile, $time_limit, $max_errors, Smarty $smarty)
+ public static function compileAllTemplates($extension, $force_compile, $time_limit, $max_errors, Smarty $smarty)
{
// switch off time limit
if (function_exists('set_time_limit')) {
$_count = 0;
$_error_count = 0;
// loop over array of template directories
- foreach($smarty->getTemplateDir() as $_dir) {
+ foreach ($smarty->getTemplateDir() as $_dir) {
$_compileDirs = new RecursiveDirectoryIterator($_dir);
$_compile = new RecursiveIteratorIterator($_compileDirs);
foreach ($_compile as $_fileinfo) {
- if (substr($_fileinfo->getBasename(),0,1) == '.' || strpos($_fileinfo, '.svn') !== false) continue;
$_file = $_fileinfo->getFilename();
- if (!substr_compare($_file, $extention, - strlen($extention)) == 0) continue;
- if ($_fileinfo->getPath() == substr($_dir, 0, -1)) {
- $_template_file = $_file;
+ if (substr(basename($_fileinfo->getPathname()), 0, 1) == '.' || strpos($_file, '.svn') !== false) {
+ continue;
+ }
+ if (!substr_compare($_file, $extension, - strlen($extension)) == 0) {
+ continue;
+ }
+ if ($_fileinfo->getPath() == substr($_dir, 0, - 1)) {
+ $_template_file = $_file;
} else {
- $_template_file = substr($_fileinfo->getPath(), strlen($_dir)) . DS . $_file;
+ $_template_file = substr($_fileinfo->getPath(), strlen($_dir)) . DS . $_file;
}
echo '<br>', $_dir, '---', $_template_file;
flush();
$_start_time = microtime(true);
try {
- $_tpl = $smarty->createTemplate($_template_file,null,null,null,false);
+ $_tpl = $smarty->createTemplate($_template_file, null, null, null, false);
if ($_tpl->mustCompile()) {
$_tpl->compileTemplateSource();
- $_count++;
+ $_count ++;
echo ' compiled in ', microtime(true) - $_start_time, ' seconds';
flush();
} else {
}
catch (Exception $e) {
echo 'Error: ', $e->getMessage(), "<br><br>";
- $_error_count++;
+ $_error_count ++;
}
// free memory
$smarty->template_objects = array();
}
}
}
+
return $_count;
}
/**
* Compile all config files
*
- * @param string $extension config file name extension
- * @param bool $force_compile force all to recompile
- * @param int $time_limit set maximum execution time
- * @param int $max_errors set maximum allowed errors
- * @param Smarty $smarty Smarty instance
+ * @param string $extension config file name extension
+ * @param bool $force_compile force all to recompile
+ * @param int $time_limit set maximum execution time
+ * @param int $max_errors set maximum allowed errors
+ * @param Smarty $smarty Smarty instance
+ *
* @return integer number of config files compiled
*/
- public static function compileAllConfig($extention, $force_compile, $time_limit, $max_errors, Smarty $smarty)
+ public static function compileAllConfig($extension, $force_compile, $time_limit, $max_errors, Smarty $smarty)
{
// switch off time limit
if (function_exists('set_time_limit')) {
$_count = 0;
$_error_count = 0;
// loop over array of template directories
- foreach($smarty->getConfigDir() as $_dir) {
+ foreach ($smarty->getConfigDir() as $_dir) {
$_compileDirs = new RecursiveDirectoryIterator($_dir);
$_compile = new RecursiveIteratorIterator($_compileDirs);
foreach ($_compile as $_fileinfo) {
- if (substr($_fileinfo->getBasename(),0,1) == '.' || strpos($_fileinfo, '.svn') !== false) continue;
$_file = $_fileinfo->getFilename();
- if (!substr_compare($_file, $extention, - strlen($extention)) == 0) continue;
- if ($_fileinfo->getPath() == substr($_dir, 0, -1)) {
+ if (substr(basename($_fileinfo->getPathname()), 0, 1) == '.' || strpos($_file, '.svn') !== false) {
+ continue;
+ }
+ if (!substr_compare($_file, $extension, - strlen($extension)) == 0) {
+ continue;
+ }
+ if ($_fileinfo->getPath() == substr($_dir, 0, - 1)) {
$_config_file = $_file;
} else {
$_config_file = substr($_fileinfo->getPath(), strlen($_dir)) . DS . $_file;
$_config = new Smarty_Internal_Config($_config_file, $smarty);
if ($_config->mustCompile()) {
$_config->compileConfigSource();
- $_count++;
+ $_count ++;
echo ' compiled in ', microtime(true) - $_start_time, ' seconds';
flush();
} else {
}
catch (Exception $e) {
echo 'Error: ', $e->getMessage(), "<br><br>";
- $_error_count++;
+ $_error_count ++;
}
if ($max_errors !== null && $_error_count == $max_errors) {
echo '<br><br>too many errors';
}
}
}
+
return $_count;
}
/**
* Delete compiled template file
*
- * @param string $resource_name template name
- * @param string $compile_id compile id
- * @param integer $exp_time expiration time
- * @param Smarty $smarty Smarty instance
+ * @param string $resource_name template name
+ * @param string $compile_id compile id
+ * @param integer $exp_time expiration time
+ * @param Smarty $smarty Smarty instance
+ *
* @return integer number of template files deleted
*/
public static function clearCompiledTemplate($resource_name, $compile_id, $exp_time, Smarty $smarty)
{
- $_compile_dir = $smarty->getCompileDir();
+ $_compile_dir = realpath($smarty->getCompileDir()) . '/';
$_compile_id = isset($compile_id) ? preg_replace('![^\w\|]+!', '_', $compile_id) : null;
- $_dir_sep = $smarty->use_sub_dirs ? DS : '^';
+ $_dir_sep = $smarty->use_sub_dirs ? '/' : '^';
if (isset($resource_name)) {
$_save_stat = $smarty->caching;
$smarty->caching = false;
unset($smarty->template_objects[$_templateId]);
if ($tpl->source->exists) {
- $_resource_part_1 = basename(str_replace('^', '/', $tpl->compiled->filepath));
- $_resource_part_1_length = strlen($_resource_part_1);
+ $_resource_part_1 = basename(str_replace('^', '/', $tpl->compiled->filepath));
+ $_resource_part_1_length = strlen($_resource_part_1);
} else {
return 0;
}
- $_resource_part_2 = str_replace('.php','.cache.php',$_resource_part_1);
+ $_resource_part_2 = str_replace('.php', '.cache.php', $_resource_part_1);
$_resource_part_2_length = strlen($_resource_part_2);
}
$_dir = $_compile_dir;
$_dir .= $_compile_id . $_dir_sep;
}
if (isset($_compile_id)) {
- $_compile_id_part = $_compile_dir . $_compile_id . $_dir_sep;
+ $_compile_id_part = str_replace('\\', '/', $_compile_dir . $_compile_id . $_dir_sep);
$_compile_id_part_length = strlen($_compile_id_part);
}
$_count = 0;
try {
$_compileDirs = new RecursiveDirectoryIterator($_dir);
- // NOTE: UnexpectedValueException thrown for PHP >= 5.3
- } catch (Exception $e) {
+ // NOTE: UnexpectedValueException thrown for PHP >= 5.3
+ }
+ catch (Exception $e) {
return 0;
}
$_compile = new RecursiveIteratorIterator($_compileDirs, RecursiveIteratorIterator::CHILD_FIRST);
foreach ($_compile as $_file) {
- if (substr($_file->getBasename(), 0, 1) == '.' || strpos($_file, '.svn') !== false)
+ if (substr(basename($_file->getPathname()), 0, 1) == '.' || strpos($_file, '.svn') !== false) {
continue;
+ }
- $_filepath = (string) $_file;
+ $_filepath = str_replace('\\', '/', (string) $_file);
if ($_file->isDir()) {
if (!$_compile->isDot()) {
}
} else {
$unlink = false;
- if ((!isset($_compile_id) || (isset($_filepath[$_compile_id_part_length]) && !strncmp($_filepath, $_compile_id_part, $_compile_id_part_length)))
+ if ((!isset($_compile_id) || (isset($_filepath[$_compile_id_part_length]) && $a = !strncmp($_filepath, $_compile_id_part, $_compile_id_part_length)))
&& (!isset($resource_name)
|| (isset($_filepath[$_resource_part_1_length])
- && substr_compare($_filepath, $_resource_part_1, -$_resource_part_1_length, $_resource_part_1_length) == 0)
+ && substr_compare($_filepath, $_resource_part_1, - $_resource_part_1_length, $_resource_part_1_length) == 0)
|| (isset($_filepath[$_resource_part_2_length])
- && substr_compare($_filepath, $_resource_part_2, -$_resource_part_2_length, $_resource_part_2_length) == 0))) {
+ && substr_compare($_filepath, $_resource_part_2, - $_resource_part_2_length, $_resource_part_2_length) == 0))
+ ) {
if (isset($exp_time)) {
if (time() - @filemtime($_filepath) >= $exp_time) {
$unlink = true;
}
if ($unlink && @unlink($_filepath)) {
- $_count++;
+ $_count ++;
}
}
}
// clear compiled cache
Smarty_Resource::$sources = array();
Smarty_Resource::$compileds = array();
+
return $_count;
}
/**
* Return array of tag/attributes of all tags used by an template
*
- * @param Smarty_Internal_Template $templae template object
- * @return array of tag/attributes
+ * @param Smarty_Internal_Template $template
+ *
+ * @throws Exception
+ * @throws SmartyException
+ * @return array of tag/attributes
*/
public static function getTags(Smarty_Internal_Template $template)
{
$template->smarty->get_used_tags = true;
$template->compileTemplateSource();
+
return $template->used_tags;
}
-
/**
* diagnose Smarty setup
- *
* If $errors is secified, the diagnostic report will be appended to the array, rather than being output.
*
- * @param Smarty $smarty Smarty instance to test
- * @param array $errors array to push results into rather than outputting them
- * @return bool status, true if everything is fine, false else
+ * @param Smarty $smarty Smarty instance to test
+ * @param array $errors array to push results into rather than outputting them
+ *
+ * @return bool status, true if everything is fine, false else
*/
- public static function testInstall(Smarty $smarty, &$errors=null)
+ public static function testInstall(Smarty $smarty, &$errors = null)
{
$status = true;
$_stream_resolve_include_path = function_exists('stream_resolve_include_path');
// test if all registered template_dir are accessible
- foreach($smarty->getTemplateDir() as $template_dir) {
+ foreach ($smarty->getTemplateDir() as $template_dir) {
$_template_dir = $template_dir;
$template_dir = realpath($template_dir);
- // resolve include_path or fail existance
+ // resolve include_path or fail existence
if (!$template_dir) {
if ($smarty->use_include_path && !preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $_template_dir)) {
// try PHP include_path
}
}
-
if ($errors === null) {
echo "Testing compile directory...\n";
}
}
}
-
if ($errors === null) {
echo "Testing plugins directory...\n";
}
// test if all registered plugins_dir are accessible
// and if core plugins directory is still registered
- $_core_plugins_dir = realpath(dirname(__FILE__) .'/../plugins');
+ $_core_plugins_dir = realpath(dirname(__FILE__) . '/../plugins');
$_core_plugins_available = false;
- foreach($smarty->getPluginsDir() as $plugin_dir) {
+ foreach ($smarty->getPluginsDir() as $plugin_dir) {
$_plugin_dir = $plugin_dir;
$plugin_dir = realpath($plugin_dir);
- // resolve include_path or fail existance
+ // resolve include_path or fail existence
if (!$plugin_dir) {
if ($smarty->use_include_path && !preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $_plugin_dir)) {
// try PHP include_path
echo "Testing cache directory...\n";
}
-
// test if all registered cache_dir is accessible
$__cache_dir = $smarty->getCacheDir();
$_cache_dir = realpath($__cache_dir);
}
}
-
if ($errors === null) {
echo "Testing configs directory...\n";
}
// test if all registered config_dir are accessible
- foreach($smarty->getConfigDir() as $config_dir) {
+ foreach ($smarty->getConfigDir() as $config_dir) {
$_config_dir = $config_dir;
$config_dir = realpath($config_dir);
- // resolve include_path or fail existance
+ // resolve include_path or fail existence
if (!$config_dir) {
if ($smarty->use_include_path && !preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $_config_dir)) {
// try PHP include_path
}
}
-
if ($errors === null) {
echo "Testing sysplugin files...\n";
}
$source = SMARTY_SYSPLUGINS_DIR;
if (is_dir($source)) {
$expected = array(
- "smarty_cacheresource.php" => true,
- "smarty_cacheresource_custom.php" => true,
- "smarty_cacheresource_keyvaluestore.php" => true,
- "smarty_config_source.php" => true,
- "smarty_internal_cacheresource_file.php" => true,
- "smarty_internal_compile_append.php" => true,
- "smarty_internal_compile_assign.php" => true,
- "smarty_internal_compile_block.php" => true,
- "smarty_internal_compile_break.php" => true,
- "smarty_internal_compile_call.php" => true,
- "smarty_internal_compile_capture.php" => true,
- "smarty_internal_compile_config_load.php" => true,
- "smarty_internal_compile_continue.php" => true,
- "smarty_internal_compile_debug.php" => true,
- "smarty_internal_compile_eval.php" => true,
- "smarty_internal_compile_extends.php" => true,
- "smarty_internal_compile_for.php" => true,
- "smarty_internal_compile_foreach.php" => true,
- "smarty_internal_compile_function.php" => true,
- "smarty_internal_compile_if.php" => true,
- "smarty_internal_compile_include.php" => true,
- "smarty_internal_compile_include_php.php" => true,
- "smarty_internal_compile_insert.php" => true,
- "smarty_internal_compile_ldelim.php" => true,
- "smarty_internal_compile_nocache.php" => true,
- "smarty_internal_compile_private_block_plugin.php" => true,
- "smarty_internal_compile_private_function_plugin.php" => true,
- "smarty_internal_compile_private_modifier.php" => true,
+ "smarty_cacheresource.php" => true,
+ "smarty_cacheresource_custom.php" => true,
+ "smarty_cacheresource_keyvaluestore.php" => true,
+ "smarty_config_source.php" => true,
+ "smarty_internal_cacheresource_file.php" => true,
+ "smarty_internal_compile_append.php" => true,
+ "smarty_internal_compile_assign.php" => true,
+ "smarty_internal_compile_block.php" => true,
+ "smarty_internal_compile_break.php" => true,
+ "smarty_internal_compile_call.php" => true,
+ "smarty_internal_compile_capture.php" => true,
+ "smarty_internal_compile_config_load.php" => true,
+ "smarty_internal_compile_continue.php" => true,
+ "smarty_internal_compile_debug.php" => true,
+ "smarty_internal_compile_eval.php" => true,
+ "smarty_internal_compile_extends.php" => true,
+ "smarty_internal_compile_for.php" => true,
+ "smarty_internal_compile_foreach.php" => true,
+ "smarty_internal_compile_function.php" => true,
+ "smarty_internal_compile_if.php" => true,
+ "smarty_internal_compile_include.php" => true,
+ "smarty_internal_compile_include_php.php" => true,
+ "smarty_internal_compile_insert.php" => true,
+ "smarty_internal_compile_ldelim.php" => true,
+ "smarty_internal_compile_nocache.php" => true,
+ "smarty_internal_compile_private_block_plugin.php" => true,
+ "smarty_internal_compile_private_function_plugin.php" => true,
+ "smarty_internal_compile_private_modifier.php" => true,
"smarty_internal_compile_private_object_block_function.php" => true,
- "smarty_internal_compile_private_object_function.php" => true,
- "smarty_internal_compile_private_print_expression.php" => true,
- "smarty_internal_compile_private_registered_block.php" => true,
- "smarty_internal_compile_private_registered_function.php" => true,
- "smarty_internal_compile_private_special_variable.php" => true,
- "smarty_internal_compile_rdelim.php" => true,
- "smarty_internal_compile_section.php" => true,
- "smarty_internal_compile_setfilter.php" => true,
- "smarty_internal_compile_while.php" => true,
- "smarty_internal_compilebase.php" => true,
- "smarty_internal_config.php" => true,
- "smarty_internal_config_file_compiler.php" => true,
- "smarty_internal_configfilelexer.php" => true,
- "smarty_internal_configfileparser.php" => true,
- "smarty_internal_data.php" => true,
- "smarty_internal_debug.php" => true,
- "smarty_internal_filter_handler.php" => true,
- "smarty_internal_function_call_handler.php" => true,
- "smarty_internal_get_include_path.php" => true,
- "smarty_internal_nocache_insert.php" => true,
- "smarty_internal_parsetree.php" => true,
- "smarty_internal_resource_eval.php" => true,
- "smarty_internal_resource_extends.php" => true,
- "smarty_internal_resource_file.php" => true,
- "smarty_internal_resource_registered.php" => true,
- "smarty_internal_resource_stream.php" => true,
- "smarty_internal_resource_string.php" => true,
- "smarty_internal_smartytemplatecompiler.php" => true,
- "smarty_internal_template.php" => true,
- "smarty_internal_templatebase.php" => true,
- "smarty_internal_templatecompilerbase.php" => true,
- "smarty_internal_templatelexer.php" => true,
- "smarty_internal_templateparser.php" => true,
- "smarty_internal_utility.php" => true,
- "smarty_internal_write_file.php" => true,
- "smarty_resource.php" => true,
- "smarty_resource_custom.php" => true,
- "smarty_resource_recompiled.php" => true,
- "smarty_resource_uncompiled.php" => true,
- "smarty_security.php" => true,
+ "smarty_internal_compile_private_object_function.php" => true,
+ "smarty_internal_compile_private_print_expression.php" => true,
+ "smarty_internal_compile_private_registered_block.php" => true,
+ "smarty_internal_compile_private_registered_function.php" => true,
+ "smarty_internal_compile_private_special_variable.php" => true,
+ "smarty_internal_compile_rdelim.php" => true,
+ "smarty_internal_compile_section.php" => true,
+ "smarty_internal_compile_setfilter.php" => true,
+ "smarty_internal_compile_while.php" => true,
+ "smarty_internal_compilebase.php" => true,
+ "smarty_internal_config.php" => true,
+ "smarty_internal_config_file_compiler.php" => true,
+ "smarty_internal_configfilelexer.php" => true,
+ "smarty_internal_configfileparser.php" => true,
+ "smarty_internal_data.php" => true,
+ "smarty_internal_debug.php" => true,
+ "smarty_internal_filter_handler.php" => true,
+ "smarty_internal_function_call_handler.php" => true,
+ "smarty_internal_get_include_path.php" => true,
+ "smarty_internal_nocache_insert.php" => true,
+ "smarty_internal_parsetree.php" => true,
+ "smarty_internal_resource_eval.php" => true,
+ "smarty_internal_resource_extends.php" => true,
+ "smarty_internal_resource_file.php" => true,
+ "smarty_internal_resource_registered.php" => true,
+ "smarty_internal_resource_stream.php" => true,
+ "smarty_internal_resource_string.php" => true,
+ "smarty_internal_smartytemplatecompiler.php" => true,
+ "smarty_internal_template.php" => true,
+ "smarty_internal_templatebase.php" => true,
+ "smarty_internal_templatecompilerbase.php" => true,
+ "smarty_internal_templatelexer.php" => true,
+ "smarty_internal_templateparser.php" => true,
+ "smarty_internal_utility.php" => true,
+ "smarty_internal_write_file.php" => true,
+ "smarty_resource.php" => true,
+ "smarty_resource_custom.php" => true,
+ "smarty_resource_recompiled.php" => true,
+ "smarty_resource_uncompiled.php" => true,
+ "smarty_security.php" => true,
);
$iterator = new DirectoryIterator($source);
foreach ($iterator as $file) {
}
if ($expected) {
$status = false;
- $message = "FAILED: files missing from libs/sysplugins: ". join(', ', array_keys($expected));
+ $message = "FAILED: files missing from libs/sysplugins: " . join(', ', array_keys($expected));
if ($errors === null) {
echo $message . ".\n";
} else {
}
} else {
$status = false;
- $message = "FAILED: ". SMARTY_SYSPLUGINS_DIR .' is not a directory';
+ $message = "FAILED: " . SMARTY_SYSPLUGINS_DIR . ' is not a directory';
if ($errors === null) {
echo $message . ".\n";
} else {
$source = SMARTY_PLUGINS_DIR;
if (is_dir($source)) {
$expected = array(
- "block.textformat.php" => true,
- "function.counter.php" => true,
- "function.cycle.php" => true,
- "function.fetch.php" => true,
- "function.html_checkboxes.php" => true,
- "function.html_image.php" => true,
- "function.html_options.php" => true,
- "function.html_radios.php" => true,
- "function.html_select_date.php" => true,
- "function.html_select_time.php" => true,
- "function.html_table.php" => true,
- "function.mailto.php" => true,
- "function.math.php" => true,
- "modifier.capitalize.php" => true,
- "modifier.date_format.php" => true,
- "modifier.debug_print_var.php" => true,
- "modifier.escape.php" => true,
- "modifier.regex_replace.php" => true,
- "modifier.replace.php" => true,
- "modifier.spacify.php" => true,
- "modifier.truncate.php" => true,
- "modifiercompiler.cat.php" => true,
+ "block.textformat.php" => true,
+ "function.counter.php" => true,
+ "function.cycle.php" => true,
+ "function.fetch.php" => true,
+ "function.html_checkboxes.php" => true,
+ "function.html_image.php" => true,
+ "function.html_options.php" => true,
+ "function.html_radios.php" => true,
+ "function.html_select_date.php" => true,
+ "function.html_select_time.php" => true,
+ "function.html_table.php" => true,
+ "function.mailto.php" => true,
+ "function.math.php" => true,
+ "modifier.capitalize.php" => true,
+ "modifier.date_format.php" => true,
+ "modifier.debug_print_var.php" => true,
+ "modifier.escape.php" => true,
+ "modifier.regex_replace.php" => true,
+ "modifier.replace.php" => true,
+ "modifier.spacify.php" => true,
+ "modifier.truncate.php" => true,
+ "modifiercompiler.cat.php" => true,
"modifiercompiler.count_characters.php" => true,
"modifiercompiler.count_paragraphs.php" => true,
- "modifiercompiler.count_sentences.php" => true,
- "modifiercompiler.count_words.php" => true,
- "modifiercompiler.default.php" => true,
- "modifiercompiler.escape.php" => true,
- "modifiercompiler.from_charset.php" => true,
- "modifiercompiler.indent.php" => true,
- "modifiercompiler.lower.php" => true,
- "modifiercompiler.noprint.php" => true,
- "modifiercompiler.string_format.php" => true,
- "modifiercompiler.strip.php" => true,
- "modifiercompiler.strip_tags.php" => true,
- "modifiercompiler.to_charset.php" => true,
- "modifiercompiler.unescape.php" => true,
- "modifiercompiler.upper.php" => true,
- "modifiercompiler.wordwrap.php" => true,
- "outputfilter.trimwhitespace.php" => true,
- "shared.escape_special_chars.php" => true,
- "shared.literal_compiler_param.php" => true,
- "shared.make_timestamp.php" => true,
- "shared.mb_str_replace.php" => true,
- "shared.mb_unicode.php" => true,
- "shared.mb_wordwrap.php" => true,
- "variablefilter.htmlspecialchars.php" => true,
+ "modifiercompiler.count_sentences.php" => true,
+ "modifiercompiler.count_words.php" => true,
+ "modifiercompiler.default.php" => true,
+ "modifiercompiler.escape.php" => true,
+ "modifiercompiler.from_charset.php" => true,
+ "modifiercompiler.indent.php" => true,
+ "modifiercompiler.lower.php" => true,
+ "modifiercompiler.noprint.php" => true,
+ "modifiercompiler.string_format.php" => true,
+ "modifiercompiler.strip.php" => true,
+ "modifiercompiler.strip_tags.php" => true,
+ "modifiercompiler.to_charset.php" => true,
+ "modifiercompiler.unescape.php" => true,
+ "modifiercompiler.upper.php" => true,
+ "modifiercompiler.wordwrap.php" => true,
+ "outputfilter.trimwhitespace.php" => true,
+ "shared.escape_special_chars.php" => true,
+ "shared.literal_compiler_param.php" => true,
+ "shared.make_timestamp.php" => true,
+ "shared.mb_str_replace.php" => true,
+ "shared.mb_unicode.php" => true,
+ "shared.mb_wordwrap.php" => true,
+ "variablefilter.htmlspecialchars.php" => true,
);
$iterator = new DirectoryIterator($source);
foreach ($iterator as $file) {
}
if ($expected) {
$status = false;
- $message = "FAILED: files missing from libs/plugins: ". join(', ', array_keys($expected));
+ $message = "FAILED: files missing from libs/plugins: " . join(', ', array_keys($expected));
if ($errors === null) {
echo $message . ".\n";
} else {
}
} else {
$status = false;
- $message = "FAILED: ". SMARTY_PLUGINS_DIR .' is not a directory';
+ $message = "FAILED: " . SMARTY_PLUGINS_DIR . ' is not a directory';
if ($errors === null) {
echo $message . ".\n";
} else {
return $status;
}
-
}
-
-?>
\ No newline at end of file
/**
* Smarty write file plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsInternal
- * @author Monte Ohrt
+ * @author Monte Ohrt
*/
/**
* Smarty Internal Write File Class
*
- * @package Smarty
+ * @package Smarty
* @subpackage PluginsInternal
*/
-class Smarty_Internal_Write_File {
-
+class Smarty_Internal_Write_File
+{
/**
* Writes file in a safe way to disk
*
- * @param string $_filepath complete filepath
- * @param string $_contents file content
- * @param Smarty $smarty smarty instance
+ * @param string $_filepath complete filepath
+ * @param string $_contents file content
+ * @param Smarty $smarty smarty instance
+ *
+ * @throws SmartyException
* @return boolean true
*/
public static function writeFile($_filepath, $_contents, Smarty $smarty)
}
// write to tmp file, then move to overt file lock race condition
- $_tmp_file = $_dirpath . DS . uniqid('wrt', true);
+ $_tmp_file = $_dirpath . DS . str_replace(array('.', ','), '_', uniqid('wrt', true));
if (!file_put_contents($_tmp_file, $_contents)) {
error_reporting($_error_reporting);
throw new SmartyException("unable to write file {$_tmp_file}");
- return false;
- }
-
+ }
+
/*
* Windows' rename() fails if the destination exists,
* Linux' rename() properly handles the overwrite.
- * Simply unlink()ing a file might cause other processes
+ * Simply unlink()ing a file might cause other processes
* currently reading that file to fail, but linux' rename()
* seems to be smart enough to handle that for us.
*/
if (!$success) {
error_reporting($_error_reporting);
throw new SmartyException("unable to write file {$_filepath}");
- return false;
}
if ($smarty->_file_perms !== null) {
umask($old_umask);
}
error_reporting($_error_reporting);
+
return true;
}
-
}
-
-?>
\ No newline at end of file
/**
* Smarty Resource Plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage TemplateResources
- * @author Rodney Rehm
+ * @author Rodney Rehm
*/
/**
* Smarty Resource Plugin
- *
* Base implementation for resource plugins
*
- * @package Smarty
+ * @package Smarty
* @subpackage TemplateResources
*/
-abstract class Smarty_Resource {
+abstract class Smarty_Resource
+{
/**
* cache for Smarty_Template_Source instances
+ *
* @var array
*/
public static $sources = array();
/**
* cache for Smarty_Template_Compiled instances
+ *
* @var array
*/
public static $compileds = array();
/**
* cache for Smarty_Resource instances
+ *
* @var array
*/
public static $resources = array();
/**
* resource types provided by the core
+ *
* @var array
*/
protected static $sysplugins = array(
- 'file' => true,
- 'string' => true,
+ 'file' => true,
+ 'string' => true,
'extends' => true,
- 'stream' => true,
- 'eval' => true,
- 'php' => true
+ 'stream' => true,
+ 'eval' => true,
+ 'php' => true
);
/**
* Name of the Class to compile this resource's contents with
+ *
* @var string
*/
public $compiler_class = 'Smarty_Internal_SmartyTemplateCompiler';
/**
* Name of the Class to tokenize this resource's contents with
+ *
* @var string
*/
public $template_lexer_class = 'Smarty_Internal_Templatelexer';
/**
* Name of the Class to parse this resource's contents with
+ *
* @var string
*/
public $template_parser_class = 'Smarty_Internal_Templateparser';
/**
* Load template's source into current template object
- *
* {@internal The loaded source is assigned to $_template->source->content directly.}}
*
- * @param Smarty_Template_Source $source source object
- * @return string template source
- * @throws SmartyException if source cannot be loaded
+ * @param Smarty_Template_Source $source source object
+ *
+ * @return string template source
+ * @throws SmartyException if source cannot be loaded
*/
- public abstract function getContent(Smarty_Template_Source $source);
+ abstract public function getContent(Smarty_Template_Source $source);
/**
* populate Source Object with meta data from Resource
*
- * @param Smarty_Template_Source $source source object
- * @param Smarty_Internal_Template $_template template object
+ * @param Smarty_Template_Source $source source object
+ * @param Smarty_Internal_Template $_template template object
*/
- public abstract function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null);
+ abstract public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null);
/**
* populate Source Object with timestamp and exists from Resource
// intentionally left blank
}
-
/**
* modify resource_name according to resource handlers specifications
*
- * @param Smarty $smarty Smarty instance
- * @param string $resource_name resource_name to make unique
+ * @param Smarty $smarty Smarty instance
+ * @param string $resource_name resource_name to make unique
+ * @param boolean $is_config flag for config resource
+ *
* @return string unique resource name
*/
- protected function buildUniqueResourceName(Smarty $smarty, $resource_name)
+ protected function buildUniqueResourceName(Smarty $smarty, $resource_name, $is_config = false)
{
- return get_class($this) . '#' . $smarty->joined_template_dir . '#' . $resource_name;
+ if ($is_config) {
+ return get_class($this) . '#' . $smarty->joined_config_dir . '#' . $resource_name;
+ } else {
+ return get_class($this) . '#' . $smarty->joined_template_dir . '#' . $resource_name;
+ }
}
/**
// if use_sub_dirs, break file into directories
if ($_template->smarty->use_sub_dirs) {
$_filepath = substr($_filepath, 0, 2) . DS
- . substr($_filepath, 2, 2) . DS
- . substr($_filepath, 4, 2) . DS
- . $_filepath;
+ . substr($_filepath, 2, 2) . DS
+ . substr($_filepath, 4, 2) . DS
+ . $_filepath;
}
$_compile_dir_sep = $_template->smarty->use_sub_dirs ? DS : '^';
if (isset($_compile_id)) {
// set basename if not specified
$_basename = $this->getBasename($compiled->source);
if ($_basename === null) {
- $_basename = basename( preg_replace('![^\w\/]+!', '_', $compiled->source->name) );
+ $_basename = basename(preg_replace('![^\w\/]+!', '_', $compiled->source->name));
}
// separate (optional) basename by dot
if ($_basename) {
$compiled->filepath = $_compile_dir . $_filepath . '.' . $compiled->source->type . $_basename . $_cache . '.php';
}
-
+
/**
- * Normalize Paths "foo/../bar" to "bar"
+ * Normalize Paths "foo/../bar" to "bar"
+ *
+ * @param string $_path path to normalize
+ * @param boolean $ds respect windows directory separator
*
- * @param string $_path path to normalize
- * @param boolean $ds respect windows directory separator
- * @return string normalized path
+ * @return string normalized path
*/
- protected function normalizePath($_path, $ds=true)
+ protected function normalizePath($_path, $ds = true)
{
if ($ds) {
// don't we all just love windows?
$_path = str_replace('\\', '/', $_path);
}
-
+
+ $offset = 0;
+
// resolve simples
- $_path = preg_replace('#(/\./(\./)*)|/{2,}#', '/', $_path);
+ $_path = preg_replace('#/\./(\./)*#', '/', $_path);
// resolve parents
while (true) {
- $_parent = strpos($_path, '/../');
- if ($_parent === false) {
- break;
- } else if ($_parent === 0) {
- $_path = substr($_path, 3);
+ $_parent = strpos($_path, '/../', $offset);
+ if (!$_parent) {
break;
+ } elseif ($_path[$_parent - 1] === '.') {
+ $offset = $_parent + 3;
+ continue;
}
-
+
$_pos = strrpos($_path, '/', $_parent - strlen($_path) - 1);
if ($_pos === false) {
// don't we all just love windows?
$_pos = $_parent;
}
-
+
$_path = substr_replace($_path, '', $_pos, $_parent + 3 - $_pos);
}
-
+
if ($ds && DS != '/') {
// don't we all just love windows?
$_path = str_replace('/', '\\', $_path);
}
-
+
return $_path;
}
-
+
/**
* build template filepath by traversing the template_dir array
*
- * @param Smarty_Template_Source $source source object
- * @param Smarty_Internal_Template $_template template object
- * @return string fully qualified filepath
- * @throws SmartyException if default template handler is registered but not callable
+ * @param Smarty_Template_Source $source source object
+ * @param Smarty_Internal_Template $_template template object
+ *
+ * @return string fully qualified filepath
+ * @throws SmartyException if default template handler is registered but not callable
*/
- protected function buildFilepath(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)
+ protected function buildFilepath(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
{
$file = $source->name;
if ($source instanceof Smarty_Config_Source) {
// resolve relative path
if (!preg_match('/^([\/\\\\]|[a-zA-Z]:[\/\\\\])/', $file)) {
// don't we all just love windows?
- $_path = str_replace('\\', '/', $file);
- $_was_relative_prefix = $file[0] == '.' ? substr($file, 0, strpos($_path, '/')) : null;
$_path = DS . trim($file, '/');
$_was_relative = true;
} else {
}
// revert to relative
if (isset($_was_relative)) {
- if (isset($_was_relative_prefix)){
- $_path = $_was_relative_prefix . $_path;
- } else {
- $_path = substr($_path, 1);
- }
+ $_path = substr($_path, 1);
}
// this is only required for directories
// try string indexes
if (isset($_directories[$match['key']])) {
$_directory = $_directories[$match['key']];
- } else if (is_numeric($match['key'])) {
+ } elseif (is_numeric($match['key'])) {
// try numeric index
$match['key'] = (int) $match['key'];
if (isset($_directories[$match['key']])) {
}
}
$_return = call_user_func_array($_default_handler,
- array($source->type, $source->name, &$_content, &$_timestamp, $source->smarty));
+ array($source->type, $source->name, &$_content, &$_timestamp, $source->smarty));
if (is_string($_return)) {
$source->timestamp = @filemtime($_return);
$source->exists = !!$source->timestamp;
+
return $_return;
} elseif ($_return === true) {
$source->content = $_content;
$source->timestamp = $_timestamp;
$source->exists = true;
+
return $_filepath;
}
}
/**
* test is file exists and save timestamp
*
- * @param Smarty_Template_Source $source source object
- * @param string $file file name
- * @return bool true if file exists
+ * @param Smarty_Template_Source $source source object
+ * @param string $file file name
+ *
+ * @return bool true if file exists
*/
protected function fileExists(Smarty_Template_Source $source, $file)
{
- $source->timestamp = @filemtime($file);
- return $source->exists = !!$source->timestamp;
+ $source->timestamp = is_file($file) ? @filemtime($file) : false;
+ return $source->exists = !!$source->timestamp;
}
/**
* Determine basename for compiled filename
*
- * @param Smarty_Template_Source $source source object
- * @return string resource's basename
+ * @param Smarty_Template_Source $source source object
+ *
+ * @return string resource's basename
*/
protected function getBasename(Smarty_Template_Source $source)
{
/**
* Load Resource Handler
*
- * @param Smarty $smarty smarty object
- * @param string $type name of the resource
+ * @param Smarty $smarty smarty object
+ * @param string $type name of the resource
+ *
+ * @throws SmartyException
* @return Smarty_Resource Resource Handler
*/
public static function load(Smarty $smarty, $type)
$_resource_class = 'Smarty_Internal_Resource_' . ucfirst($type);
self::$resources[$type] = new $_resource_class();
}
+
return $smarty->_resource_handlers[$type] = self::$resources[$type];
}
if (class_exists($_resource_class, false)) {
self::$resources[$type] = new $_resource_class();
+
return $smarty->_resource_handlers[$type] = self::$resources[$type];
} else {
$smarty->registerResource($type, array(
if (!isset(self::$resources['stream'])) {
self::$resources['stream'] = new Smarty_Internal_Resource_Stream();
}
+
return $smarty->_resource_handlers[$type] = self::$resources['stream'];
}
// TODO: try default_(template|config)_handler
// give up
- throw new SmartyException("Unkown resource type '{$type}'");
+ throw new SmartyException("Unknown resource type '{$type}'");
}
/**
* extract resource_type and resource_name from template_resource and config_resource
- *
* @note "C:/foo.tpl" was forced to file resource up till Smarty 3.1.3 (including).
- * @param string $resource_name template_resource or config_resource to parse
- * @param string $default_resource the default resource_type defined in $smarty
- * @param string &$name the parsed resource name
- * @param string &$type the parsed resource type
+ *
+ * @param string $resource_name template_resource or config_resource to parse
+ * @param string $default_resource the default resource_type defined in $smarty
+ * @param string &$name the parsed resource name
+ * @param string &$type the parsed resource type
+ *
* @return void
*/
protected static function parseResourceName($resource_name, $default_resource, &$name, &$type)
}
}
-
/**
* modify resource_name according to resource handlers specifications
*
- * @param Smarty $smarty Smarty instance
- * @param string $resource_name resource_name to make unique
+ * @param Smarty $smarty Smarty instance
+ * @param string $resource_name resource_name to make unique
+ *
* @return string unique resource name
*/
/**
* modify template_resource according to resource handlers specifications
*
- * @param string $smarty Smarty instance
- * @param string $template_resource template_resource to extracate resource handler and name of
+ * @param Smarty_Internal_template $template Smarty instance
+ * @param string $template_resource template_resource to extract resource handler and name of
+ *
* @return string unique resource name
*/
- public static function getUniqueTemplateName($smarty, $template_resource)
+ public static function getUniqueTemplateName($template, $template_resource)
{
- self::parseResourceName($template_resource, $smarty->default_resource_type, $name, $type);
+ self::parseResourceName($template_resource, $template->smarty->default_resource_type, $name, $type);
// TODO: optimize for Smarty's internal resource types
- $resource = Smarty_Resource::load($smarty, $type);
- return $resource->buildUniqueResourceName($smarty, $name);
+ $resource = Smarty_Resource::load($template->smarty, $type);
+ // go relative to a given template?
+ $_file_is_dotted = $name[0] == '.' && ($name[1] == '.' || $name[1] == '/' || $name[1] == "\\");
+ if ($template instanceof Smarty_Internal_Template && $_file_is_dotted && ($template->source->type == 'file' || $template->parent->source->type == 'extends')) {
+ $name = dirname($template->source->filepath) . DS . $name;
+ }
+ return $resource->buildUniqueResourceName($template->smarty, $name);
}
/**
* initialize Source Object for given resource
- *
* Either [$_template] or [$smarty, $template_resource] must be specified
*
- * @param Smarty_Internal_Template $_template template object
- * @param Smarty $smarty smarty object
- * @param string $template_resource resource identifier
- * @return Smarty_Template_Source Source Object
+ * @param Smarty_Internal_Template $_template template object
+ * @param Smarty $smarty smarty object
+ * @param string $template_resource resource identifier
+ *
+ * @return Smarty_Template_Source Source Object
*/
- public static function source(Smarty_Internal_Template $_template=null, Smarty $smarty=null, $template_resource=null)
+ public static function source(Smarty_Internal_Template $_template = null, Smarty $smarty = null, $template_resource = null)
{
if ($_template) {
$smarty = $_template->smarty;
// parse resource_name, load resource handler, identify unique resource name
self::parseResourceName($template_resource, $smarty->default_resource_type, $name, $type);
$resource = Smarty_Resource::load($smarty, $type);
- $unique_resource_name = $resource->buildUniqueResourceName($smarty, $name);
+ // go relative to a given template?
+ $_file_is_dotted = isset($name[0]) && $name[0] == '.' && ($name[1] == '.' || $name[1] == '/' || $name[1] == "\\");
+ if ($_file_is_dotted && isset($_template) && $_template->parent instanceof Smarty_Internal_Template && ($_template->parent->source->type == 'file' || $_template->parent->source->type == 'extends')) {
+ $name2 = dirname($_template->parent->source->filepath) . DS . $name;
+ } else {
+ $name2 = $name;
+ }
+ $unique_resource_name = $resource->buildUniqueResourceName($smarty, $name2);
// check runtime cache
$_cache_key = 'template|' . $unique_resource_name;
if ($smarty->compile_id) {
- $_cache_key .= '|'.$smarty->compile_id;
+ $_cache_key .= '|' . $smarty->compile_id;
}
if (isset(self::$sources[$_cache_key])) {
return self::$sources[$_cache_key];
// runtime cache
self::$sources[$_cache_key] = $source;
+
return $source;
}
/**
* initialize Config Source Object for given resource
*
- * @param Smarty_Internal_Config $_config config object
- * @return Smarty_Config_Source Source Object
+ * @param Smarty_Internal_Config $_config config object
+ *
+ * @throws SmartyException
+ * @return Smarty_Config_Source Source Object
*/
public static function config(Smarty_Internal_Config $_config)
{
// load resource handler, identify unique resource name
$resource = Smarty_Resource::load($smarty, $type);
- $unique_resource_name = $resource->buildUniqueResourceName($smarty, $name);
+ $unique_resource_name = $resource->buildUniqueResourceName($smarty, $name, true);
// check runtime cache
$_cache_key = 'config|' . $unique_resource_name;
// runtime cache
self::$sources[$_cache_key] = $source;
+
return $source;
}
-
}
/**
* Smarty Resource Data Object
- *
* Meta Data Container for Template Files
*
- * @package Smarty
+ * @package Smarty
* @subpackage TemplateResources
- * @author Rodney Rehm
- *
+ * @author Rodney Rehm
* @property integer $timestamp Source Timestamp
- * @property boolean $exists Source Existance
+ * @property boolean $exists Source Existence
* @property boolean $template Extended Template reference
* @property string $content Source Content
*/
-class Smarty_Template_Source {
-
+class Smarty_Template_Source
+{
/**
* Name of the Class to compile this resource's contents with
+ *
* @var string
*/
public $compiler_class = null;
/**
* Name of the Class to tokenize this resource's contents with
+ *
* @var string
*/
public $template_lexer_class = null;
/**
* Name of the Class to parse this resource's contents with
+ *
* @var string
*/
public $template_parser_class = null;
/**
* Unique Template ID
+ *
* @var string
*/
public $uid = null;
/**
* Template Resource (Smarty_Internal_Template::$template_resource)
+ *
* @var string
*/
public $resource = null;
/**
* Resource Type
+ *
* @var string
*/
public $type = null;
/**
* Resource Name
+ *
* @var string
*/
public $name = null;
/**
* Unique Resource Name
+ *
* @var string
*/
public $unique_resource = null;
/**
* Source Filepath
+ *
* @var string
*/
public $filepath = null;
/**
* Source is bypassing compiler
+ *
* @var boolean
*/
public $uncompiled = null;
/**
* Source must be recompiled on every occasion
+ *
* @var boolean
*/
public $recompiled = null;
/**
* The Components an extended template is made of
+ *
* @var array
*/
public $components = null;
/**
* Resource Handler
+ *
* @var Smarty_Resource
*/
public $handler = null;
/**
* Smarty instance
+ *
* @var Smarty
*/
public $smarty = null;
/**
* create Source Object container
*
- * @param Smarty_Resource $handler Resource Handler this source object communicates with
- * @param Smarty $smarty Smarty instance this source object belongs to
- * @param string $resource full template_resource
- * @param string $type type of resource
- * @param string $name resource name
- * @param string $unique_resource unqiue resource name
+ * @param Smarty_Resource $handler Resource Handler this source object communicates with
+ * @param Smarty $smarty Smarty instance this source object belongs to
+ * @param string $resource full template_resource
+ * @param string $type type of resource
+ * @param string $name resource name
+ * @param string $unique_resource unique resource name
*/
public function __construct(Smarty_Resource $handler, Smarty $smarty, $resource, $type, $name, $unique_resource)
{
/**
* get a Compiled Object of this source
*
- * @param Smarty_Internal_Template $_template template objet
+ * @param Smarty_Internal_Template|Smarty_Internal_Config $_template template object
+ *
* @return Smarty_Template_Compiled compiled object
*/
- public function getCompiled(Smarty_Internal_Template $_template)
+ public function getCompiled($_template)
{
// check runtime cache
$_cache_key = $this->unique_resource . '#' . $_template->compile_id;
/**
* <<magic>> Generic Setter.
*
- * @param string $property_name valid: timestamp, exists, content, template
- * @param mixed $value new value (is not checked)
+ * @param string $property_name valid: timestamp, exists, content, template
+ * @param mixed $value new value (is not checked)
+ *
* @throws SmartyException if $property_name is not valid
*/
public function __set($property_name, $value)
case 'timestamp':
case 'exists':
case 'content':
- // required for extends: only
+ // required for extends: only
case 'template':
$this->$property_name = $value;
break;
/**
* <<magic>> Generic getter.
*
- * @param string $property_name valid: timestamp, exists, content
+ * @param string $property_name valid: timestamp, exists, content
+ *
* @return mixed
* @throws SmartyException if $property_name is not valid
*/
case 'timestamp':
case 'exists':
$this->handler->populateTimestamp($this);
+
return $this->$property_name;
case 'content':
throw new SmartyException("source property '$property_name' does not exist.");
}
}
-
}
/**
* Smarty Resource Data Object
- *
* Meta Data Container for Template Files
*
- * @package Smarty
+ * @package Smarty
* @subpackage TemplateResources
- * @author Rodney Rehm
- *
+ * @author Rodney Rehm
* @property string $content compiled content
*/
-class Smarty_Template_Compiled {
-
+class Smarty_Template_Compiled
+{
/**
* Compiled Filepath
+ *
* @var string
*/
public $filepath = null;
/**
* Compiled Timestamp
+ *
* @var integer
*/
public $timestamp = null;
/**
- * Compiled Existance
+ * Compiled Existence
+ *
* @var boolean
*/
public $exists = false;
/**
* Compiled Content Loaded
+ *
* @var boolean
*/
public $loaded = false;
/**
* Template was compiled
+ *
* @var boolean
*/
public $isCompiled = false;
/**
* Source Object
+ *
* @var Smarty_Template_Source
*/
public $source = null;
/**
* Metadata properties
- *
* populated by Smarty_Internal_Template::decodeProperties()
+ *
* @var array
*/
public $_properties = null;
{
$this->source = $source;
}
-
}
-
-?>
\ No newline at end of file
/**
* Smarty Resource Plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage TemplateResources
- * @author Rodney Rehm
+ * @author Rodney Rehm
*/
/**
* Smarty Resource Plugin
- *
* Wrapper Implementation for custom resource plugins
*
- * @package Smarty
+ * @package Smarty
* @subpackage TemplateResources
*/
-abstract class Smarty_Resource_Custom extends Smarty_Resource {
-
+abstract class Smarty_Resource_Custom extends Smarty_Resource
+{
/**
* fetch template and its modification time from data source
*
* @param string &$source template source
* @param integer &$mtime template modification timestamp (epoch)
*/
- protected abstract function fetch($name, &$source, &$mtime);
+ abstract protected function fetch($name, &$source, &$mtime);
/**
* Fetch template's modification timestamp from data source
- *
* {@internal implementing this method is optional.
* Only implement it if modification times can be accessed faster than loading the complete template source.}}
*
- * @param string $name template name
+ * @param string $name template name
+ *
* @return integer|boolean timestamp (epoch) the template was modified, or false if not found
*/
protected function fetchTimestamp($name)
* @param Smarty_Template_Source $source source object
* @param Smarty_Internal_Template $_template template object
*/
- public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template=null)
+ public function populate(Smarty_Template_Source $source, Smarty_Internal_Template $_template = null)
{
- $source->filepath = strtolower($source->type . ':' . $source->name);
+ $source->filepath = $source->type . ':' . $source->name;
$source->uid = sha1($source->type . ':' . $source->name);
$mtime = $this->fetchTimestamp($source->name);
} else {
$this->fetch($source->name, $content, $timestamp);
$source->timestamp = isset($timestamp) ? $timestamp : false;
- if( isset($content) )
+ if (isset($content)) {
$source->content = $content;
+ }
}
$source->exists = !!$source->timestamp;
}
/**
* Load template's source into current template object
*
- * @param Smarty_Template_Source $source source object
- * @return string template source
- * @throws SmartyException if source cannot be loaded
+ * @param Smarty_Template_Source $source source object
+ *
+ * @return string template source
+ * @throws SmartyException if source cannot be loaded
*/
public function getContent(Smarty_Template_Source $source)
{
/**
* Determine basename for compiled filename
*
- * @param Smarty_Template_Source $source source object
- * @return string resource's basename
+ * @param Smarty_Template_Source $source source object
+ *
+ * @return string resource's basename
*/
protected function getBasename(Smarty_Template_Source $source)
{
return basename($source->name);
}
-
}
-
-?>
\ No newline at end of file
/**
* Smarty Resource Plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage TemplateResources
- * @author Rodney Rehm
+ * @author Rodney Rehm
*/
/**
* Smarty Resource Plugin
- *
* Base implementation for resource plugins that don't compile cache
*
- * @package Smarty
+ * @package Smarty
* @subpackage TemplateResources
*/
-abstract class Smarty_Resource_Recompiled extends Smarty_Resource {
-
+abstract class Smarty_Resource_Recompiled extends Smarty_Resource
+{
/**
* populate Compiled Object with compiled filepath
*
- * @param Smarty_Template_Compiled $compiled compiled object
- * @param Smarty_Internal_Template $_template template object
+ * @param Smarty_Template_Compiled $compiled compiled object
+ * @param Smarty_Internal_Template $_template template object
+ *
* @return void
*/
public function populateCompiledFilepath(Smarty_Template_Compiled $compiled, Smarty_Internal_Template $_template)
$compiled->timestamp = false;
$compiled->exists = false;
}
-
}
-
-?>
\ No newline at end of file
/**
* Smarty Resource Plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage TemplateResources
- * @author Rodney Rehm
+ * @author Rodney Rehm
*/
/**
* Smarty Resource Plugin
- *
* Base implementation for resource plugins that don't use the compiler
*
- * @package Smarty
+ * @package Smarty
* @subpackage TemplateResources
*/
-abstract class Smarty_Resource_Uncompiled extends Smarty_Resource {
-
+abstract class Smarty_Resource_Uncompiled extends Smarty_Resource
+{
/**
* Render and output the template (without using the compiler)
*
- * @param Smarty_Template_Source $source source object
- * @param Smarty_Internal_Template $_template template object
- * @throws SmartyException on failure
+ * @param Smarty_Template_Source $source source object
+ * @param Smarty_Internal_Template $_template template object
+ *
+ * @throws SmartyException on failure
*/
- public abstract function renderUncompiled(Smarty_Template_Source $source, Smarty_Internal_Template $_template);
+ abstract public function renderUncompiled(Smarty_Template_Source $source, Smarty_Internal_Template $_template);
/**
* populate compiled object with compiled filepath
$compiled->timestamp = false;
$compiled->exists = false;
}
-
}
-
-?>
\ No newline at end of file
/**
* Smarty plugin
*
- * @package Smarty
+ * @package Smarty
* @subpackage Security
- * @author Uwe Tews
+ * @author Uwe Tews
*/
-
+
/*
* FIXME: Smarty_Security API
* - getter and setter instead of public properties would allow cultivating an internal cache properly
* - current implementation of isTrustedResourceDir() assumes that Smarty::$template_dir and Smarty::$config_dir are immutable
* the cache is killed every time either of the variables change. That means that two distinct Smarty objects with differing
- * $template_dir or $config_dir should NOT share the same Smarty_Security instance,
- * as this would lead to (severe) performance penalty! how should this be handled?
+ * $template_dir or $config_dir should NOT share the same Smarty_Security instance,
+ * as this would lead to (severe) performance penalty! how should this be handled?
*/
/**
* This class does contain the security settings
*/
-class Smarty_Security {
-
+class Smarty_Security
+{
/**
* This determines how Smarty handles "<?php ... ?>" tags in templates.
* possible values:
public $trusted_uri = array();
/**
* This is an array of trusted static classes.
- *
* If empty access to all static classes is allowed.
* If set to 'none' none is allowed.
+ *
* @var array
*/
public $static_classes = array();
/**
* This is an array of trusted PHP functions.
- *
* If empty all functions are allowed.
* To disable all PHP functions set $php_functions = null.
+ *
* @var array
*/
public $php_functions = array(
'nl2br',
);
/**
- * This is an array of trusted PHP modifers.
- *
+ * This is an array of trusted PHP modifiers.
* If empty all modifiers are allowed.
* To disable all modifier set $modifiers = null.
+ *
* @var array
*/
public $php_modifiers = array(
);
/**
* This is an array of allowed tags.
- *
* If empty no restriction by allowed_tags.
+ *
* @var array
*/
public $allowed_tags = array();
/**
* This is an array of disabled tags.
- *
* If empty no restriction by disabled_tags.
+ *
* @var array
*/
public $disabled_tags = array();
/**
* This is an array of allowed modifier plugins.
- *
* If empty no restriction by allowed_modifiers.
+ *
* @var array
*/
public $allowed_modifiers = array();
/**
* This is an array of disabled modifier plugins.
- *
* If empty no restriction by disabled_modifiers.
+ *
* @var array
*/
public $disabled_modifiers = array();
/**
* This is an array of trusted streams.
- *
* If empty all streams are allowed.
* To disable all streams set $streams = null.
+ *
* @var array
*/
public $streams = array('file');
/**
* + flag if constants can be accessed from template
+ *
* @var boolean
*/
public $allow_constants = true;
/**
* + flag if super globals can be accessed from template
+ *
* @var boolean
*/
public $allow_super_globals = true;
/**
- * Cache for $resource_dir lookups
+ * Cache for $resource_dir lookup
+ *
* @var array
*/
protected $_resource_dir = null;
/**
- * Cache for $template_dir lookups
+ * Cache for $template_dir lookup
+ *
* @var array
*/
protected $_template_dir = null;
/**
- * Cache for $config_dir lookups
+ * Cache for $config_dir lookup
+ *
* @var array
*/
protected $_config_dir = null;
/**
- * Cache for $secure_dir lookups
+ * Cache for $secure_dir lookup
+ *
* @var array
*/
protected $_secure_dir = null;
/**
- * Cache for $php_resource_dir lookups
+ * Cache for $php_resource_dir lookup
+ *
* @var array
*/
protected $_php_resource_dir = null;
/**
- * Cache for $trusted_dir lookups
+ * Cache for $trusted_dir lookup
+ *
* @var array
*/
protected $_trusted_dir = null;
-
-
+
/**
* @param Smarty $smarty
*/
{
$this->smarty = $smarty;
}
-
+
/**
* Check if PHP function is trusted.
*
- * @param string $function_name
- * @param object $compiler compiler object
- * @return boolean true if function is trusted
+ * @param string $function_name
+ * @param object $compiler compiler object
+ *
+ * @return boolean true if function is trusted
* @throws SmartyCompilerException if php function is not trusted
*/
public function isTrustedPhpFunction($function_name, $compiler)
}
$compiler->trigger_template_error("PHP function '{$function_name}' not allowed by security setting");
+
return false; // should not, but who knows what happens to the compiler in the future?
}
/**
* Check if static class is trusted.
*
- * @param string $class_name
- * @param object $compiler compiler object
- * @return boolean true if class is trusted
+ * @param string $class_name
+ * @param object $compiler compiler object
+ *
+ * @return boolean true if class is trusted
* @throws SmartyCompilerException if static class is not trusted
*/
public function isTrustedStaticClass($class_name, $compiler)
}
$compiler->trigger_template_error("access to static class '{$class_name}' not allowed by security setting");
+
return false; // should not, but who knows what happens to the compiler in the future?
}
/**
* Check if PHP modifier is trusted.
*
- * @param string $modifier_name
- * @param object $compiler compiler object
- * @return boolean true if modifier is trusted
+ * @param string $modifier_name
+ * @param object $compiler compiler object
+ *
+ * @return boolean true if modifier is trusted
* @throws SmartyCompilerException if modifier is not trusted
*/
public function isTrustedPhpModifier($modifier_name, $compiler)
}
$compiler->trigger_template_error("modifier '{$modifier_name}' not allowed by security setting");
+
return false; // should not, but who knows what happens to the compiler in the future?
}
/**
* Check if tag is trusted.
*
- * @param string $tag_name
- * @param object $compiler compiler object
- * @return boolean true if tag is trusted
+ * @param string $tag_name
+ * @param object $compiler compiler object
+ *
+ * @return boolean true if tag is trusted
* @throws SmartyCompilerException if modifier is not trusted
*/
public function isTrustedTag($tag_name, $compiler)
{
// check for internal always required tags
if (in_array($tag_name, array('assign', 'call', 'private_filter', 'private_block_plugin', 'private_function_plugin', 'private_object_block_function',
- 'private_object_function', 'private_registered_function', 'private_registered_block', 'private_special_variable', 'private_print_expression', 'private_modifier'))) {
+ 'private_object_function', 'private_registered_function', 'private_registered_block', 'private_special_variable', 'private_print_expression', 'private_modifier'))
+ ) {
return true;
}
// check security settings
} else {
$compiler->trigger_template_error("tag '{$tag_name}' disabled by security setting", $compiler->lex->taglineno);
}
- } else if (in_array($tag_name, $this->allowed_tags) && !in_array($tag_name, $this->disabled_tags)) {
+ } elseif (in_array($tag_name, $this->allowed_tags) && !in_array($tag_name, $this->disabled_tags)) {
return true;
} else {
$compiler->trigger_template_error("tag '{$tag_name}' not allowed by security setting", $compiler->lex->taglineno);
}
+
return false; // should not, but who knows what happens to the compiler in the future?
}
/**
* Check if modifier plugin is trusted.
*
- * @param string $modifier_name
- * @param object $compiler compiler object
- * @return boolean true if tag is trusted
+ * @param string $modifier_name
+ * @param object $compiler compiler object
+ *
+ * @return boolean true if tag is trusted
* @throws SmartyCompilerException if modifier is not trusted
*/
public function isTrustedModifier($modifier_name, $compiler)
} else {
$compiler->trigger_template_error("modifier '{$modifier_name}' disabled by security setting", $compiler->lex->taglineno);
}
- } else if (in_array($modifier_name, $this->allowed_modifiers) && !in_array($modifier_name, $this->disabled_modifiers)) {
+ } elseif (in_array($modifier_name, $this->allowed_modifiers) && !in_array($modifier_name, $this->disabled_modifiers)) {
return true;
} else {
$compiler->trigger_template_error("modifier '{$modifier_name}' not allowed by security setting", $compiler->lex->taglineno);
}
+
return false; // should not, but who knows what happens to the compiler in the future?
}
/**
* Check if stream is trusted.
*
- * @param string $stream_name
- * @return boolean true if stream is trusted
+ * @param string $stream_name
+ *
+ * @return boolean true if stream is trusted
* @throws SmartyException if stream is not trusted
*/
public function isTrustedStream($stream_name)
/**
* Check if directory of file resource is trusted.
*
- * @param string $filepath
- * @return boolean true if directory is trusted
+ * @param string $filepath
+ *
+ * @return boolean true if directory is trusted
* @throws SmartyException if directory is not trusted
*/
public function isTrustedResourceDir($filepath)
// check if index is outdated
if ((!$this->_template_dir || $this->_template_dir !== $_template_dir)
- || (!$this->_config_dir || $this->_config_dir !== $_config_dir)
- || (!empty($this->secure_dir) && (!$this->_secure_dir || $this->_secure_dir !== $this->secure_dir))
+ || (!$this->_config_dir || $this->_config_dir !== $_config_dir)
+ || (!empty($this->secure_dir) && (!$this->_secure_dir || $this->_secure_dir !== $this->secure_dir))
) {
$this->_resource_dir = array();
$_template = true;
$_directory[$directory] = true;
// test if the directory is trusted
if (isset($this->_resource_dir[$directory])) {
- // merge sub directories of current $directory into _resource_dir to speed up subsequent lookups
+ // merge sub directories of current $directory into _resource_dir to speed up subsequent lookup
$this->_resource_dir = array_merge($this->_resource_dir, $_directory);
+
return true;
}
// abort if we've reached root
// give up
throw new SmartyException("directory '{$_filepath}' not allowed by security setting");
}
-
+
/**
* Check if URI (e.g. {fetch} or {html_image}) is trusted
- *
* To simplify things, isTrustedUri() resolves all input to "{$PROTOCOL}://{$HOSTNAME}".
* So "http://username:password@hello.world.example.org:8080/some-path?some=query-string"
* is reduced to "http://hello.world.example.org" prior to applying the patters from {@link $trusted_uri}.
- * @param string $uri
- * @return boolean true if URI is trusted
+ *
+ * @param string $uri
+ *
+ * @return boolean true if URI is trusted
* @throws SmartyException if URI is not trusted
* @uses $trusted_uri for list of patterns to match against $uri
*/
}
}
}
-
+
throw new SmartyException("URI '{$uri}' not allowed by security setting");
}
-
+
/**
* Check if directory of file resource is trusted.
*
- * @param string $filepath
- * @return boolean true if directory is trusted
+ * @param string $filepath
+ *
+ * @return boolean true if directory is trusted
* @throws SmartyException if PHP directory is not trusted
*/
public function isTrustedPHPDir($filepath)
$_directory[] = $directory;
// test if the directory is trusted
if (isset($this->_php_resource_dir[$directory])) {
- // merge sub directories of current $directory into _resource_dir to speed up subsequent lookups
+ // merge sub directories of current $directory into _resource_dir to speed up subsequent lookup
$this->_php_resource_dir = array_merge($this->_php_resource_dir, $_directory);
+
return true;
}
// abort if we've reached root
throw new SmartyException("directory '{$_filepath}' not allowed by security setting");
}
-
}
-
-?>
\ No newline at end of file
+++ /dev/null
-#fancybox-buttons {
- position: fixed;
- left: 0;
- width: 100%;
- z-index: 8050;
-}
-
-#fancybox-buttons.top {
- top: 10px;
-}
-
-#fancybox-buttons.bottom {
- bottom: 10px;
-}
-
-#fancybox-buttons ul {
- display: block;
- width: 166px;
- height: 30px;
- margin: 0 auto;
- padding: 0;
- list-style: none;
- border: 1px solid #111;
- border-radius: 3px;
- -webkit-box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
- -moz-box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
- box-shadow: inset 0 0 0 1px rgba(255,255,255,.05);
- background: rgb(50,50,50);
- background: -moz-linear-gradient(top, rgb(68,68,68) 0%, rgb(52,52,52) 50%, rgb(41,41,41) 50%, rgb(51,51,51) 100%);
- background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgb(68,68,68)), color-stop(50%,rgb(52,52,52)), color-stop(50%,rgb(41,41,41)), color-stop(100%,rgb(51,51,51)));
- background: -webkit-linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%);
- background: -o-linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%);
- background: -ms-linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%);
- background: linear-gradient(top, rgb(68,68,68) 0%,rgb(52,52,52) 50%,rgb(41,41,41) 50%,rgb(51,51,51) 100%);
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#444444', endColorstr='#222222',GradientType=0 );
-}
-
-#fancybox-buttons ul li {
- float: left;
- margin: 0;
- padding: 0;
-}
-
-#fancybox-buttons a {
- display: block;
- width: 30px;
- height: 30px;
- text-indent: -9999px;
- background-image: url('fancybox_buttons.png');
- background-repeat: no-repeat;
- outline: none;
- opacity: 0.8;
-}
-
-#fancybox-buttons a:hover {
- opacity: 1;
-}
-
-#fancybox-buttons a.btnPrev {
- background-position: 5px 0;
-}
-
-#fancybox-buttons a.btnNext {
- background-position: -33px 0;
- border-right: 1px solid #3e3e3e;
-}
-
-#fancybox-buttons a.btnPlay {
- background-position: 0 -30px;
-}
-
-#fancybox-buttons a.btnPlayOn {
- background-position: -30px -30px;
-}
-
-#fancybox-buttons a.btnToggle {
- background-position: 3px -60px;
- border-left: 1px solid #111;
- border-right: 1px solid #3e3e3e;
- width: 35px
-}
-
-#fancybox-buttons a.btnToggleOn {
- background-position: -27px -60px;
-}
-
-#fancybox-buttons a.btnClose {
- border-left: 1px solid #111;
- width: 35px;
- background-position: -56px 0px;
-}
-
-#fancybox-buttons a.btnDisabled {
- opacity : 0.4;
- cursor: default;
-}
\ No newline at end of file
+++ /dev/null
- /*!
- * Buttons helper for fancyBox
- * version: 1.0.5 (Mon, 15 Oct 2012)
- * @requires fancyBox v2.0 or later
- *
- * Usage:
- * $(".fancybox").fancybox({
- * helpers : {
- * buttons: {
- * position : 'top'
- * }
- * }
- * });
- *
- */
-(function ($) {
- //Shortcut for fancyBox object
- var F = $.fancybox;
-
- //Add helper object
- F.helpers.buttons = {
- defaults : {
- skipSingle : false, // disables if gallery contains single image
- position : 'top', // 'top' or 'bottom'
- tpl : '<div id="fancybox-buttons"><ul><li><a class="btnPrev" title="Previous" href="javascript:;"></a></li><li><a class="btnPlay" title="Start slideshow" href="javascript:;"></a></li><li><a class="btnNext" title="Next" href="javascript:;"></a></li><li><a class="btnToggle" title="Toggle size" href="javascript:;"></a></li><li><a class="btnClose" title="Close" href="javascript:jQuery.fancybox.close();"></a></li></ul></div>'
- },
-
- list : null,
- buttons: null,
-
- beforeLoad: function (opts, obj) {
- //Remove self if gallery do not have at least two items
-
- if (opts.skipSingle && obj.group.length < 2) {
- obj.helpers.buttons = false;
- obj.closeBtn = true;
-
- return;
- }
-
- //Increase top margin to give space for buttons
- obj.margin[ opts.position === 'bottom' ? 2 : 0 ] += 30;
- },
-
- onPlayStart: function () {
- if (this.buttons) {
- this.buttons.play.attr('title', 'Pause slideshow').addClass('btnPlayOn');
- }
- },
-
- onPlayEnd: function () {
- if (this.buttons) {
- this.buttons.play.attr('title', 'Start slideshow').removeClass('btnPlayOn');
- }
- },
-
- afterShow: function (opts, obj) {
- var buttons = this.buttons;
-
- if (!buttons) {
- this.list = $(opts.tpl).addClass(opts.position).appendTo('body');
-
- buttons = {
- prev : this.list.find('.btnPrev').click( F.prev ),
- next : this.list.find('.btnNext').click( F.next ),
- play : this.list.find('.btnPlay').click( F.play ),
- toggle : this.list.find('.btnToggle').click( F.toggle )
- }
- }
-
- //Prev
- if (obj.index > 0 || obj.loop) {
- buttons.prev.removeClass('btnDisabled');
- } else {
- buttons.prev.addClass('btnDisabled');
- }
-
- //Next / Play
- if (obj.loop || obj.index < obj.group.length - 1) {
- buttons.next.removeClass('btnDisabled');
- buttons.play.removeClass('btnDisabled');
-
- } else {
- buttons.next.addClass('btnDisabled');
- buttons.play.addClass('btnDisabled');
- }
-
- this.buttons = buttons;
-
- this.onUpdate(opts, obj);
- },
-
- onUpdate: function (opts, obj) {
- var toggle;
-
- if (!this.buttons) {
- return;
- }
-
- toggle = this.buttons.toggle.removeClass('btnDisabled btnToggleOn');
-
- //Size toggle button
- if (obj.canShrink) {
- toggle.addClass('btnToggleOn');
-
- } else if (!obj.canExpand) {
- toggle.addClass('btnDisabled');
- }
- },
-
- beforeClose: function () {
- if (this.list) {
- this.list.remove();
- }
-
- this.list = null;
- this.buttons = null;
- }
- };
-
-}(jQuery));
\ No newline at end of file
+++ /dev/null
-/*!
- * Media helper for fancyBox
- * version: 1.0.5 (Tue, 23 Oct 2012)
- * @requires fancyBox v2.0 or later
- *
- * Usage:
- * $(".fancybox").fancybox({
- * helpers : {
- * media: true
- * }
- * });
- *
- * Set custom URL parameters:
- * $(".fancybox").fancybox({
- * helpers : {
- * media: {
- * youtube : {
- * params : {
- * autoplay : 0
- * }
- * }
- * }
- * }
- * });
- *
- * Or:
- * $(".fancybox").fancybox({,
- * helpers : {
- * media: true
- * },
- * youtube : {
- * autoplay: 0
- * }
- * });
- *
- * Supports:
- *
- * Youtube
- * http://www.youtube.com/watch?v=opj24KnzrWo
- * http://www.youtube.com/embed/opj24KnzrWo
- * http://youtu.be/opj24KnzrWo
- * Vimeo
- * http://vimeo.com/40648169
- * http://vimeo.com/channels/staffpicks/38843628
- * http://vimeo.com/groups/surrealism/videos/36516384
- * http://player.vimeo.com/video/45074303
- * Metacafe
- * http://www.metacafe.com/watch/7635964/dr_seuss_the_lorax_movie_trailer/
- * http://www.metacafe.com/watch/7635964/
- * Dailymotion
- * http://www.dailymotion.com/video/xoytqh_dr-seuss-the-lorax-premiere_people
- * Twitvid
- * http://twitvid.com/QY7MD
- * Twitpic
- * http://twitpic.com/7p93st
- * Instagram
- * http://instagr.am/p/IejkuUGxQn/
- * http://instagram.com/p/IejkuUGxQn/
- * Google maps
- * http://maps.google.com/maps?q=Eiffel+Tower,+Avenue+Gustave+Eiffel,+Paris,+France&t=h&z=17
- * http://maps.google.com/?ll=48.857995,2.294297&spn=0.007666,0.021136&t=m&z=16
- * http://maps.google.com/?ll=48.859463,2.292626&spn=0.000965,0.002642&t=m&z=19&layer=c&cbll=48.859524,2.292532&panoid=YJ0lq28OOy3VT2IqIuVY0g&cbp=12,151.58,,0,-15.56
- */
-(function ($) {
- "use strict";
-
- //Shortcut for fancyBox object
- var F = $.fancybox,
- format = function( url, rez, params ) {
- params = params || '';
-
- if ( $.type( params ) === "object" ) {
- params = $.param(params, true);
- }
-
- $.each(rez, function(key, value) {
- url = url.replace( '$' + key, value || '' );
- });
-
- if (params.length) {
- url += ( url.indexOf('?') > 0 ? '&' : '?' ) + params;
- }
-
- return url;
- };
-
- //Add helper object
- F.helpers.media = {
- defaults : {
- youtube : {
- matcher : /(youtube\.com|youtu\.be)\/(watch\?v=|v\/|u\/|embed\/?)?(videoseries\?list=(.*)|[\w-]{11}|\?listType=(.*)&list=(.*)).*/i,
- params : {
- autoplay : 1,
- autohide : 1,
- fs : 1,
- rel : 0,
- hd : 1,
- wmode : 'opaque',
- enablejsapi : 1
- },
- type : 'iframe',
- url : '//www.youtube.com/embed/$3'
- },
- vimeo : {
- matcher : /(?:vimeo(?:pro)?.com)\/(?:[^\d]+)?(\d+)(?:.*)/,
- params : {
- autoplay : 1,
- hd : 1,
- show_title : 1,
- show_byline : 1,
- show_portrait : 0,
- fullscreen : 1
- },
- type : 'iframe',
- url : '//player.vimeo.com/video/$1'
- },
- metacafe : {
- matcher : /metacafe.com\/(?:watch|fplayer)\/([\w\-]{1,10})/,
- params : {
- autoPlay : 'yes'
- },
- type : 'swf',
- url : function( rez, params, obj ) {
- obj.swf.flashVars = 'playerVars=' + $.param( params, true );
-
- return '//www.metacafe.com/fplayer/' + rez[1] + '/.swf';
- }
- },
- dailymotion : {
- matcher : /dailymotion.com\/video\/(.*)\/?(.*)/,
- params : {
- additionalInfos : 0,
- autoStart : 1
- },
- type : 'swf',
- url : '//www.dailymotion.com/swf/video/$1'
- },
- twitvid : {
- matcher : /twitvid\.com\/([a-zA-Z0-9_\-\?\=]+)/i,
- params : {
- autoplay : 0
- },
- type : 'iframe',
- url : '//www.twitvid.com/embed.php?guid=$1'
- },
- twitpic : {
- matcher : /twitpic\.com\/(?!(?:place|photos|events)\/)([a-zA-Z0-9\?\=\-]+)/i,
- type : 'image',
- url : '//twitpic.com/show/full/$1/'
- },
- instagram : {
- matcher : /(instagr\.am|instagram\.com)\/p\/([a-zA-Z0-9_\-]+)\/?/i,
- type : 'image',
- url : '//$1/p/$2/media/'
- },
- google_maps : {
- matcher : /maps\.google\.([a-z]{2,3}(\.[a-z]{2})?)\/(\?ll=|maps\?)(.*)/i,
- type : 'iframe',
- url : function( rez ) {
- return '//maps.google.' + rez[1] + '/' + rez[3] + '' + rez[4] + '&output=' + (rez[4].indexOf('layer=c') > 0 ? 'svembed' : 'embed');
- }
- }
- },
-
- beforeLoad : function(opts, obj) {
- var url = obj.href || '',
- type = false,
- what,
- item,
- rez,
- params;
-
- for (what in opts) {
- item = opts[ what ];
- rez = url.match( item.matcher );
-
- if (rez) {
- type = item.type;
- params = $.extend(true, {}, item.params, obj[ what ] || ($.isPlainObject(opts[ what ]) ? opts[ what ].params : null));
-
- url = $.type( item.url ) === "function" ? item.url.call( this, rez, params, obj ) : format( item.url, rez, params );
-
- break;
- }
- }
-
- if (type) {
- obj.href = url;
- obj.type = type;
-
- obj.autoHeight = false;
- }
- }
- };
-
-}(jQuery));
\ No newline at end of file
+++ /dev/null
-#fancybox-thumbs {
- position: fixed;
- left: 0;
- width: 100%;
- overflow: hidden;
- z-index: 8050;
-}
-
-#fancybox-thumbs.bottom {
- bottom: 2px;
-}
-
-#fancybox-thumbs.top {
- top: 2px;
-}
-
-#fancybox-thumbs ul {
- position: relative;
- list-style: none;
- margin: 0;
- padding: 0;
-}
-
-#fancybox-thumbs ul li {
- float: left;
- padding: 1px;
- opacity: 0.5;
-}
-
-#fancybox-thumbs ul li.active {
- opacity: 0.75;
- padding: 0;
- border: 1px solid #fff;
-}
-
-#fancybox-thumbs ul li:hover {
- opacity: 1;
-}
-
-#fancybox-thumbs ul li a {
- display: block;
- position: relative;
- overflow: hidden;
- border: 1px solid #222;
- background: #111;
- outline: none;
-}
-
-#fancybox-thumbs ul li img {
- display: block;
- position: relative;
- border: 0;
- padding: 0;
-}
\ No newline at end of file
+++ /dev/null
- /*!
- * Thumbnail helper for fancyBox
- * version: 1.0.7 (Mon, 01 Oct 2012)
- * @requires fancyBox v2.0 or later
- *
- * Usage:
- * $(".fancybox").fancybox({
- * helpers : {
- * thumbs: {
- * width : 50,
- * height : 50
- * }
- * }
- * });
- *
- */
-(function ($) {
- //Shortcut for fancyBox object
- var F = $.fancybox;
-
- //Add helper object
- F.helpers.thumbs = {
- defaults : {
- width : 50, // thumbnail width
- height : 50, // thumbnail height
- position : 'bottom', // 'top' or 'bottom'
- source : function ( item ) { // function to obtain the URL of the thumbnail image
- var href;
-
- if (item.element) {
- href = $(item.element).find('img').attr('src');
- }
-
- if (!href && item.type === 'image' && item.href) {
- href = item.href;
- }
-
- return href;
- }
- },
-
- wrap : null,
- list : null,
- width : 0,
-
- init: function (opts, obj) {
- var that = this,
- list,
- thumbWidth = opts.width,
- thumbHeight = opts.height,
- thumbSource = opts.source;
-
- //Build list structure
- list = '';
-
- for (var n = 0; n < obj.group.length; n++) {
- list += '<li><a style="width:' + thumbWidth + 'px;height:' + thumbHeight + 'px;" href="javascript:jQuery.fancybox.jumpto(' + n + ');"></a></li>';
- }
-
- this.wrap = $('<div id="fancybox-thumbs"></div>').addClass(opts.position).appendTo('body');
- this.list = $('<ul>' + list + '</ul>').appendTo(this.wrap);
-
- //Load each thumbnail
- $.each(obj.group, function (i) {
- var href = thumbSource( obj.group[ i ] );
-
- if (!href) {
- return;
- }
-
- $("<img />").load(function () {
- var width = this.width,
- height = this.height,
- widthRatio, heightRatio, parent;
-
- if (!that.list || !width || !height) {
- return;
- }
-
- //Calculate thumbnail width/height and center it
- widthRatio = width / thumbWidth;
- heightRatio = height / thumbHeight;
-
- parent = that.list.children().eq(i).find('a');
-
- if (widthRatio >= 1 && heightRatio >= 1) {
- if (widthRatio > heightRatio) {
- width = Math.floor(width / heightRatio);
- height = thumbHeight;
-
- } else {
- width = thumbWidth;
- height = Math.floor(height / widthRatio);
- }
- }
-
- $(this).css({
- width : width,
- height : height,
- top : Math.floor(thumbHeight / 2 - height / 2),
- left : Math.floor(thumbWidth / 2 - width / 2)
- });
-
- parent.width(thumbWidth).height(thumbHeight);
-
- $(this).hide().appendTo(parent).fadeIn(300);
-
- }).attr('src', href);
- });
-
- //Set initial width
- this.width = this.list.children().eq(0).outerWidth(true);
-
- this.list.width(this.width * (obj.group.length + 1)).css('left', Math.floor($(window).width() * 0.5 - (obj.index * this.width + this.width * 0.5)));
- },
-
- beforeLoad: function (opts, obj) {
- //Remove self if gallery do not have at least two items
- if (obj.group.length < 2) {
- obj.helpers.thumbs = false;
-
- return;
- }
-
- //Increase bottom margin to give space for thumbs
- obj.margin[ opts.position === 'top' ? 0 : 2 ] += ((opts.height) + 15);
- },
-
- afterShow: function (opts, obj) {
- //Check if exists and create or update list
- if (this.list) {
- this.onUpdate(opts, obj);
-
- } else {
- this.init(opts, obj);
- }
-
- //Set active element
- this.list.children().removeClass('active').eq(obj.index).addClass('active');
- },
-
- //Center list
- onUpdate: function (opts, obj) {
- if (this.list) {
- this.list.stop(true).animate({
- 'left': Math.floor($(window).width() * 0.5 - (obj.index * this.width + this.width * 0.5))
- }, 150);
- }
- },
-
- beforeClose: function () {
- if (this.wrap) {
- this.wrap.remove();
- }
-
- this.wrap = null;
- this.list = null;
- this.width = 0;
- }
- }
-
-}(jQuery));
\ No newline at end of file
+++ /dev/null
-/*! fancyBox v2.1.4 fancyapps.com | fancyapps.com/fancybox/#license */
-.fancybox-wrap,
-.fancybox-skin,
-.fancybox-outer,
-.fancybox-inner,
-.fancybox-image,
-.fancybox-wrap iframe,
-.fancybox-wrap object,
-.fancybox-nav,
-.fancybox-nav span,
-.fancybox-tmp
-{
- padding: 0;
- margin: 0;
- border: 0;
- outline: none;
- vertical-align: top;
-}
-
-.fancybox-wrap {
- position: absolute;
- top: 0;
- left: 0;
- z-index: 8020;
-}
-
-.fancybox-skin {
- position: relative;
- background: #f9f9f9;
- color: #444;
- text-shadow: none;
- -webkit-border-radius: 4px;
- -moz-border-radius: 4px;
- border-radius: 4px;
-}
-
-.fancybox-opened {
- z-index: 8030;
-}
-
-.fancybox-opened .fancybox-skin {
- -webkit-box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
- -moz-box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
- box-shadow: 0 10px 25px rgba(0, 0, 0, 0.5);
-}
-
-.fancybox-outer, .fancybox-inner {
- position: relative;
-}
-
-.fancybox-inner {
- overflow: hidden;
-}
-
-.fancybox-type-iframe .fancybox-inner {
- -webkit-overflow-scrolling: touch;
-}
-
-.fancybox-error {
- color: #444;
- font: 14px/20px "Helvetica Neue",Helvetica,Arial,sans-serif;
- margin: 0;
- padding: 15px;
- white-space: nowrap;
-}
-
-.fancybox-image, .fancybox-iframe {
- display: block;
- width: 100%;
- height: 100%;
-}
-
-.fancybox-image {
- max-width: 100%;
- max-height: 100%;
-}
-
-#fancybox-loading, .fancybox-close, .fancybox-prev span, .fancybox-next span {
- background-image: url('fancybox_sprite.png');
-}
-
-#fancybox-loading {
- position: fixed;
- top: 50%;
- left: 50%;
- margin-top: -22px;
- margin-left: -22px;
- background-position: 0 -108px;
- opacity: 0.8;
- cursor: pointer;
- z-index: 8060;
-}
-
-#fancybox-loading div {
- width: 44px;
- height: 44px;
- background: url('fancybox_loading.gif') center center no-repeat;
-}
-
-.fancybox-close {
- position: absolute;
- top: -18px;
- right: -18px;
- width: 36px;
- height: 36px;
- cursor: pointer;
- z-index: 8040;
-}
-
-.fancybox-nav {
- position: absolute;
- top: 0;
- width: 40%;
- height: 100%;
- cursor: pointer;
- text-decoration: none;
- background: transparent url('blank.gif'); /* helps IE */
- -webkit-tap-highlight-color: rgba(0,0,0,0);
- z-index: 8040;
-}
-
-.fancybox-prev {
- left: 0;
-}
-
-.fancybox-next {
- right: 0;
-}
-
-.fancybox-nav span {
- position: absolute;
- top: 50%;
- width: 36px;
- height: 34px;
- margin-top: -18px;
- cursor: pointer;
- z-index: 8040;
- visibility: hidden;
-}
-
-.fancybox-prev span {
- left: 10px;
- background-position: 0 -36px;
-}
-
-.fancybox-next span {
- right: 10px;
- background-position: 0 -72px;
-}
-
-.fancybox-nav:hover span {
- visibility: visible;
-}
-
-.fancybox-tmp {
- position: absolute;
- top: -99999px;
- left: -99999px;
- visibility: hidden;
- max-width: 99999px;
- max-height: 99999px;
- overflow: visible !important;
-}
-
-/* Overlay helper */
-
-.fancybox-lock {
- overflow: hidden;
-}
-
-.fancybox-overlay {
- position: absolute;
- top: 0;
- left: 0;
- overflow: hidden;
- display: none;
- z-index: 8010;
- background: url('fancybox_overlay.png');
-}
-
-.fancybox-overlay-fixed {
- position: fixed;
- bottom: 0;
- right: 0;
-}
-
-.fancybox-lock .fancybox-overlay {
- overflow: auto;
- overflow-y: scroll;
-}
-
-/* Title helper */
-
-.fancybox-title {
- visibility: hidden;
- font: normal 13px/20px "Helvetica Neue",Helvetica,Arial,sans-serif;
- position: relative;
- text-shadow: none;
- z-index: 8050;
-}
-
-.fancybox-opened .fancybox-title {
- visibility: visible;
-}
-
-.fancybox-title-float-wrap {
- position: absolute;
- bottom: 0;
- right: 50%;
- margin-bottom: -35px;
- z-index: 8050;
- text-align: center;
-}
-
-.fancybox-title-float-wrap .child {
- display: inline-block;
- margin-right: -100%;
- padding: 2px 20px;
- background: transparent; /* Fallback for web browsers that doesn't support RGBa */
- background: rgba(0, 0, 0, 0.8);
- -webkit-border-radius: 15px;
- -moz-border-radius: 15px;
- border-radius: 15px;
- text-shadow: 0 1px 2px #222;
- color: #FFF;
- font-weight: bold;
- line-height: 24px;
- white-space: nowrap;
-}
-
-.fancybox-title-outside-wrap {
- position: relative;
- margin-top: 10px;
- color: #fff;
-}
-
-.fancybox-title-inside-wrap {
- padding-top: 10px;
-}
-
-.fancybox-title-over-wrap {
- position: absolute;
- bottom: 0;
- left: 0;
- color: #fff;
- padding: 10px;
- background: #000;
- background: rgba(0, 0, 0, .8);
-}
\ No newline at end of file
+++ /dev/null
-/*!
- * fancyBox - jQuery Plugin
- * version: 2.1.4 (Thu, 17 Jan 2013)
- * @requires jQuery v1.6 or later
- *
- * Examples at http://fancyapps.com/fancybox/
- * License: www.fancyapps.com/fancybox/#license
- *
- * Copyright 2012 Janis Skarnelis - janis@fancyapps.com
- *
- */
-
-(function (window, document, $, undefined) {
- "use strict";
-
- var W = $(window),
- D = $(document),
- F = $.fancybox = function () {
- F.open.apply( this, arguments );
- },
- IE = navigator.userAgent.match(/msie/i),
- didUpdate = null,
- isTouch = document.createTouch !== undefined,
-
- isQuery = function(obj) {
- return obj && obj.hasOwnProperty && obj instanceof $;
- },
- isString = function(str) {
- return str && $.type(str) === "string";
- },
- isPercentage = function(str) {
- return isString(str) && str.indexOf('%') > 0;
- },
- isScrollable = function(el) {
- return (el && !(el.style.overflow && el.style.overflow === 'hidden') && ((el.clientWidth && el.scrollWidth > el.clientWidth) || (el.clientHeight && el.scrollHeight > el.clientHeight)));
- },
- getScalar = function(orig, dim) {
- var value = parseInt(orig, 10) || 0;
-
- if (dim && isPercentage(orig)) {
- value = F.getViewport()[ dim ] / 100 * value;
- }
-
- return Math.ceil(value);
- },
- getValue = function(value, dim) {
- return getScalar(value, dim) + 'px';
- };
-
- $.extend(F, {
- // The current version of fancyBox
- version: '2.1.4',
-
- defaults: {
- padding : 15,
- margin : 20,
-
- width : 800,
- height : 600,
- minWidth : 100,
- minHeight : 100,
- maxWidth : 9999,
- maxHeight : 9999,
-
- autoSize : true,
- autoHeight : false,
- autoWidth : false,
-
- autoResize : true,
- autoCenter : !isTouch,
- fitToView : true,
- aspectRatio : false,
- topRatio : 0.5,
- leftRatio : 0.5,
-
- scrolling : 'auto', // 'auto', 'yes' or 'no'
- wrapCSS : '',
-
- arrows : true,
- closeBtn : true,
- closeClick : false,
- nextClick : false,
- mouseWheel : true,
- autoPlay : false,
- playSpeed : 3000,
- preload : 3,
- modal : false,
- loop : true,
-
- ajax : {
- dataType : 'html',
- headers : { 'X-fancyBox': true }
- },
- iframe : {
- scrolling : 'auto',
- preload : true
- },
- swf : {
- wmode: 'transparent',
- allowfullscreen : 'true',
- allowscriptaccess : 'always'
- },
-
- keys : {
- next : {
- 13 : 'left', // enter
- 34 : 'up', // page down
- 39 : 'left', // right arrow
- 40 : 'up' // down arrow
- },
- prev : {
- 8 : 'right', // backspace
- 33 : 'down', // page up
- 37 : 'right', // left arrow
- 38 : 'down' // up arrow
- },
- close : [27], // escape key
- play : [32], // space - start/stop slideshow
- toggle : [70] // letter "f" - toggle fullscreen
- },
-
- direction : {
- next : 'left',
- prev : 'right'
- },
-
- scrollOutside : true,
-
- // Override some properties
- index : 0,
- type : null,
- href : null,
- content : null,
- title : null,
-
- // HTML templates
- tpl: {
- wrap : '<div class="fancybox-wrap" tabIndex="-1"><div class="fancybox-skin"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div></div>',
- image : '<img class="fancybox-image" src="{href}" alt="" />',
- iframe : '<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" frameborder="0" vspace="0" hspace="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen' + (IE ? ' allowtransparency="true"' : '') + '></iframe>',
- error : '<p class="fancybox-error">The requested content cannot be loaded.<br/>Please try again later.</p>',
- closeBtn : '<a title="Close" class="fancybox-item fancybox-close" href="javascript:;"></a>',
- next : '<a title="Next" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',
- prev : '<a title="Previous" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'
- },
-
- // Properties for each animation type
- // Opening fancyBox
- openEffect : 'fade', // 'elastic', 'fade' or 'none'
- openSpeed : 250,
- openEasing : 'swing',
- openOpacity : true,
- openMethod : 'zoomIn',
-
- // Closing fancyBox
- closeEffect : 'fade', // 'elastic', 'fade' or 'none'
- closeSpeed : 250,
- closeEasing : 'swing',
- closeOpacity : true,
- closeMethod : 'zoomOut',
-
- // Changing next gallery item
- nextEffect : 'elastic', // 'elastic', 'fade' or 'none'
- nextSpeed : 250,
- nextEasing : 'swing',
- nextMethod : 'changeIn',
-
- // Changing previous gallery item
- prevEffect : 'elastic', // 'elastic', 'fade' or 'none'
- prevSpeed : 250,
- prevEasing : 'swing',
- prevMethod : 'changeOut',
-
- // Enable default helpers
- helpers : {
- overlay : true,
- title : true
- },
-
- // Callbacks
- onCancel : $.noop, // If canceling
- beforeLoad : $.noop, // Before loading
- afterLoad : $.noop, // After loading
- beforeShow : $.noop, // Before changing in current item
- afterShow : $.noop, // After opening
- beforeChange : $.noop, // Before changing gallery item
- beforeClose : $.noop, // Before closing
- afterClose : $.noop // After closing
- },
-
- //Current state
- group : {}, // Selected group
- opts : {}, // Group options
- previous : null, // Previous element
- coming : null, // Element being loaded
- current : null, // Currently loaded element
- isActive : false, // Is activated
- isOpen : false, // Is currently open
- isOpened : false, // Have been fully opened at least once
-
- wrap : null,
- skin : null,
- outer : null,
- inner : null,
-
- player : {
- timer : null,
- isActive : false
- },
-
- // Loaders
- ajaxLoad : null,
- imgPreload : null,
-
- // Some collections
- transitions : {},
- helpers : {},
-
- /*
- * Static methods
- */
-
- open: function (group, opts) {
- if (!group) {
- return;
- }
-
- if (!$.isPlainObject(opts)) {
- opts = {};
- }
-
- // Close if already active
- if (false === F.close(true)) {
- return;
- }
-
- // Normalize group
- if (!$.isArray(group)) {
- group = isQuery(group) ? $(group).get() : [group];
- }
-
- // Recheck if the type of each element is `object` and set content type (image, ajax, etc)
- $.each(group, function(i, element) {
- var obj = {},
- href,
- title,
- content,
- type,
- rez,
- hrefParts,
- selector;
-
- if ($.type(element) === "object") {
- // Check if is DOM element
- if (element.nodeType) {
- element = $(element);
- }
-
- if (isQuery(element)) {
- obj = {
- href : element.data('fancybox-href') || element.attr('href'),
- title : element.data('fancybox-title') || element.attr('title'),
- isDom : true,
- element : element
- };
-
- if ($.metadata) {
- $.extend(true, obj, element.metadata());
- }
-
- } else {
- obj = element;
- }
- }
-
- href = opts.href || obj.href || (isString(element) ? element : null);
- title = opts.title !== undefined ? opts.title : obj.title || '';
-
- content = opts.content || obj.content;
- type = content ? 'html' : (opts.type || obj.type);
-
- if (!type && obj.isDom) {
- type = element.data('fancybox-type');
-
- if (!type) {
- rez = element.prop('class').match(/fancybox\.(\w+)/);
- type = rez ? rez[1] : null;
- }
- }
-
- if (isString(href)) {
- // Try to guess the content type
- if (!type) {
- if (F.isImage(href)) {
- type = 'image';
-
- } else if (F.isSWF(href)) {
- type = 'swf';
-
- } else if (href.charAt(0) === '#') {
- type = 'inline';
-
- } else if (isString(element)) {
- type = 'html';
- content = element;
- }
- }
-
- // Split url into two pieces with source url and content selector, e.g,
- // "/mypage.html #my_id" will load "/mypage.html" and display element having id "my_id"
- if (type === 'ajax') {
- hrefParts = href.split(/\s+/, 2);
- href = hrefParts.shift();
- selector = hrefParts.shift();
- }
- }
-
- if (!content) {
- if (type === 'inline') {
- if (href) {
- content = $( isString(href) ? href.replace(/.*(?=#[^\s]+$)/, '') : href ); //strip for ie7
-
- } else if (obj.isDom) {
- content = element;
- }
-
- } else if (type === 'html') {
- content = href;
-
- } else if (!type && !href && obj.isDom) {
- type = 'inline';
- content = element;
- }
- }
-
- $.extend(obj, {
- href : href,
- type : type,
- content : content,
- title : title,
- selector : selector
- });
-
- group[ i ] = obj;
- });
-
- // Extend the defaults
- F.opts = $.extend(true, {}, F.defaults, opts);
-
- // All options are merged recursive except keys
- if (opts.keys !== undefined) {
- F.opts.keys = opts.keys ? $.extend({}, F.defaults.keys, opts.keys) : false;
- }
-
- F.group = group;
-
- return F._start(F.opts.index);
- },
-
- // Cancel image loading or abort ajax request
- cancel: function () {
- var coming = F.coming;
-
- if (!coming || false === F.trigger('onCancel')) {
- return;
- }
-
- F.hideLoading();
-
- if (F.ajaxLoad) {
- F.ajaxLoad.abort();
- }
-
- F.ajaxLoad = null;
-
- if (F.imgPreload) {
- F.imgPreload.onload = F.imgPreload.onerror = null;
- }
-
- if (coming.wrap) {
- coming.wrap.stop(true, true).trigger('onReset').remove();
- }
-
- F.coming = null;
-
- // If the first item has been canceled, then clear everything
- if (!F.current) {
- F._afterZoomOut( coming );
- }
- },
-
- // Start closing animation if is open; remove immediately if opening/closing
- close: function (event) {
- F.cancel();
-
- if (false === F.trigger('beforeClose')) {
- return;
- }
-
- F.unbindEvents();
-
- if (!F.isActive) {
- return;
- }
-
- if (!F.isOpen || event === true) {
- $('.fancybox-wrap').stop(true).trigger('onReset').remove();
-
- F._afterZoomOut();
-
- } else {
- F.isOpen = F.isOpened = false;
- F.isClosing = true;
-
- $('.fancybox-item, .fancybox-nav').remove();
-
- F.wrap.stop(true, true).removeClass('fancybox-opened');
-
- F.transitions[ F.current.closeMethod ]();
- }
- },
-
- // Manage slideshow:
- // $.fancybox.play(); - toggle slideshow
- // $.fancybox.play( true ); - start
- // $.fancybox.play( false ); - stop
- play: function ( action ) {
- var clear = function () {
- clearTimeout(F.player.timer);
- },
- set = function () {
- clear();
-
- if (F.current && F.player.isActive) {
- F.player.timer = setTimeout(F.next, F.current.playSpeed);
- }
- },
- stop = function () {
- clear();
-
- D.unbind('.player');
-
- F.player.isActive = false;
-
- F.trigger('onPlayEnd');
- },
- start = function () {
- if (F.current && (F.current.loop || F.current.index < F.group.length - 1)) {
- F.player.isActive = true;
-
- D.bind({
- 'onCancel.player beforeClose.player' : stop,
- 'onUpdate.player' : set,
- 'beforeLoad.player' : clear
- });
-
- set();
-
- F.trigger('onPlayStart');
- }
- };
-
- if (action === true || (!F.player.isActive && action !== false)) {
- start();
- } else {
- stop();
- }
- },
-
- // Navigate to next gallery item
- next: function ( direction ) {
- var current = F.current;
-
- if (current) {
- if (!isString(direction)) {
- direction = current.direction.next;
- }
-
- F.jumpto(current.index + 1, direction, 'next');
- }
- },
-
- // Navigate to previous gallery item
- prev: function ( direction ) {
- var current = F.current;
-
- if (current) {
- if (!isString(direction)) {
- direction = current.direction.prev;
- }
-
- F.jumpto(current.index - 1, direction, 'prev');
- }
- },
-
- // Navigate to gallery item by index
- jumpto: function ( index, direction, router ) {
- var current = F.current;
-
- if (!current) {
- return;
- }
-
- index = getScalar(index);
-
- F.direction = direction || current.direction[ (index >= current.index ? 'next' : 'prev') ];
- F.router = router || 'jumpto';
-
- if (current.loop) {
- if (index < 0) {
- index = current.group.length + (index % current.group.length);
- }
-
- index = index % current.group.length;
- }
-
- if (current.group[ index ] !== undefined) {
- F.cancel();
-
- F._start(index);
- }
- },
-
- // Center inside viewport and toggle position type to fixed or absolute if needed
- reposition: function (e, onlyAbsolute) {
- var current = F.current,
- wrap = current ? current.wrap : null,
- pos;
-
- if (wrap) {
- pos = F._getPosition(onlyAbsolute);
-
- if (e && e.type === 'scroll') {
- delete pos.position;
-
- wrap.stop(true, true).animate(pos, 200);
-
- } else {
- wrap.css(pos);
-
- current.pos = $.extend({}, current.dim, pos);
- }
- }
- },
-
- update: function (e) {
- var type = (e && e.type),
- anyway = !type || type === 'orientationchange';
-
- if (anyway) {
- clearTimeout(didUpdate);
-
- didUpdate = null;
- }
-
- if (!F.isOpen || didUpdate) {
- return;
- }
-
- didUpdate = setTimeout(function() {
- var current = F.current;
-
- if (!current || F.isClosing) {
- return;
- }
-
- F.wrap.removeClass('fancybox-tmp');
-
- if (anyway || type === 'load' || (type === 'resize' && current.autoResize)) {
- F._setDimension();
- }
-
- if (!(type === 'scroll' && current.canShrink)) {
- F.reposition(e);
- }
-
- F.trigger('onUpdate');
-
- didUpdate = null;
-
- }, (anyway && !isTouch ? 0 : 300));
- },
-
- // Shrink content to fit inside viewport or restore if resized
- toggle: function ( action ) {
- if (F.isOpen) {
- F.current.fitToView = $.type(action) === "boolean" ? action : !F.current.fitToView;
-
- // Help browser to restore document dimensions
- if (isTouch) {
- F.wrap.removeAttr('style').addClass('fancybox-tmp');
-
- F.trigger('onUpdate');
- }
-
- F.update();
- }
- },
-
- hideLoading: function () {
- D.unbind('.loading');
-
- $('#fancybox-loading').remove();
- },
-
- showLoading: function () {
- var el, viewport;
-
- F.hideLoading();
-
- el = $('<div id="fancybox-loading"><div></div></div>').click(F.cancel).appendTo('body');
-
- // If user will press the escape-button, the request will be canceled
- D.bind('keydown.loading', function(e) {
- if ((e.which || e.keyCode) === 27) {
- e.preventDefault();
-
- F.cancel();
- }
- });
-
- if (!F.defaults.fixed) {
- viewport = F.getViewport();
-
- el.css({
- position : 'absolute',
- top : (viewport.h * 0.5) + viewport.y,
- left : (viewport.w * 0.5) + viewport.x
- });
- }
- },
-
- getViewport: function () {
- var locked = (F.current && F.current.locked) || false,
- rez = {
- x: W.scrollLeft(),
- y: W.scrollTop()
- };
-
- if (locked) {
- rez.w = locked[0].clientWidth;
- rez.h = locked[0].clientHeight;
-
- } else {
- // See http://bugs.jquery.com/ticket/6724
- rez.w = isTouch && window.innerWidth ? window.innerWidth : W.width();
- rez.h = isTouch && window.innerHeight ? window.innerHeight : W.height();
- }
-
- return rez;
- },
-
- // Unbind the keyboard / clicking actions
- unbindEvents: function () {
- if (F.wrap && isQuery(F.wrap)) {
- F.wrap.unbind('.fb');
- }
-
- D.unbind('.fb');
- W.unbind('.fb');
- },
-
- bindEvents: function () {
- var current = F.current,
- keys;
-
- if (!current) {
- return;
- }
-
- // Changing document height on iOS devices triggers a 'resize' event,
- // that can change document height... repeating infinitely
- W.bind('orientationchange.fb' + (isTouch ? '' : ' resize.fb') + (current.autoCenter && !current.locked ? ' scroll.fb' : ''), F.update);
-
- keys = current.keys;
-
- if (keys) {
- D.bind('keydown.fb', function (e) {
- var code = e.which || e.keyCode,
- target = e.target || e.srcElement;
-
- // Skip esc key if loading, because showLoading will cancel preloading
- if (code === 27 && F.coming) {
- return false;
- }
-
- // Ignore key combinations and key events within form elements
- if (!e.ctrlKey && !e.altKey && !e.shiftKey && !e.metaKey && !(target && (target.type || $(target).is('[contenteditable]')))) {
- $.each(keys, function(i, val) {
- if (current.group.length > 1 && val[ code ] !== undefined) {
- F[ i ]( val[ code ] );
-
- e.preventDefault();
- return false;
- }
-
- if ($.inArray(code, val) > -1) {
- F[ i ] ();
-
- e.preventDefault();
- return false;
- }
- });
- }
- });
- }
-
- if ($.fn.mousewheel && current.mouseWheel) {
- F.wrap.bind('mousewheel.fb', function (e, delta, deltaX, deltaY) {
- var target = e.target || null,
- parent = $(target),
- canScroll = false;
-
- while (parent.length) {
- if (canScroll || parent.is('.fancybox-skin') || parent.is('.fancybox-wrap')) {
- break;
- }
-
- canScroll = isScrollable( parent[0] );
- parent = $(parent).parent();
- }
-
- if (delta !== 0 && !canScroll) {
- if (F.group.length > 1 && !current.canShrink) {
- if (deltaY > 0 || deltaX > 0) {
- F.prev( deltaY > 0 ? 'down' : 'left' );
-
- } else if (deltaY < 0 || deltaX < 0) {
- F.next( deltaY < 0 ? 'up' : 'right' );
- }
-
- e.preventDefault();
- }
- }
- });
- }
- },
-
- trigger: function (event, o) {
- var ret, obj = o || F.coming || F.current;
-
- if (!obj) {
- return;
- }
-
- if ($.isFunction( obj[event] )) {
- ret = obj[event].apply(obj, Array.prototype.slice.call(arguments, 1));
- }
-
- if (ret === false) {
- return false;
- }
-
- if (obj.helpers) {
- $.each(obj.helpers, function (helper, opts) {
- if (opts && F.helpers[helper] && $.isFunction(F.helpers[helper][event])) {
- opts = $.extend(true, {}, F.helpers[helper].defaults, opts);
-
- F.helpers[helper][event](opts, obj);
- }
- });
- }
-
- D.trigger(event);
- },
-
- isImage: function (str) {
- return isString(str) && str.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp)((\?|#).*)?$)/i);
- },
-
- isSWF: function (str) {
- return isString(str) && str.match(/\.(swf)((\?|#).*)?$/i);
- },
-
- _start: function (index) {
- var coming = {},
- obj,
- href,
- type,
- margin,
- padding;
-
- index = getScalar( index );
- obj = F.group[ index ] || null;
-
- if (!obj) {
- return false;
- }
-
- coming = $.extend(true, {}, F.opts, obj);
-
- // Convert margin and padding properties to array - top, right, bottom, left
- margin = coming.margin;
- padding = coming.padding;
-
- if ($.type(margin) === 'number') {
- coming.margin = [margin, margin, margin, margin];
- }
-
- if ($.type(padding) === 'number') {
- coming.padding = [padding, padding, padding, padding];
- }
-
- // 'modal' propery is just a shortcut
- if (coming.modal) {
- $.extend(true, coming, {
- closeBtn : false,
- closeClick : false,
- nextClick : false,
- arrows : false,
- mouseWheel : false,
- keys : null,
- helpers: {
- overlay : {
- closeClick : false
- }
- }
- });
- }
-
- // 'autoSize' property is a shortcut, too
- if (coming.autoSize) {
- coming.autoWidth = coming.autoHeight = true;
- }
-
- if (coming.width === 'auto') {
- coming.autoWidth = true;
- }
-
- if (coming.height === 'auto') {
- coming.autoHeight = true;
- }
-
- /*
- * Add reference to the group, so it`s possible to access from callbacks, example:
- * afterLoad : function() {
- * this.title = 'Image ' + (this.index + 1) + ' of ' + this.group.length + (this.title ? ' - ' + this.title : '');
- * }
- */
-
- coming.group = F.group;
- coming.index = index;
-
- // Give a chance for callback or helpers to update coming item (type, title, etc)
- F.coming = coming;
-
- if (false === F.trigger('beforeLoad')) {
- F.coming = null;
-
- return;
- }
-
- type = coming.type;
- href = coming.href;
-
- if (!type) {
- F.coming = null;
-
- //If we can not determine content type then drop silently or display next/prev item if looping through gallery
- if (F.current && F.router && F.router !== 'jumpto') {
- F.current.index = index;
-
- return F[ F.router ]( F.direction );
- }
-
- return false;
- }
-
- F.isActive = true;
-
- if (type === 'image' || type === 'swf') {
- coming.autoHeight = coming.autoWidth = false;
- coming.scrolling = 'visible';
- }
-
- if (type === 'image') {
- coming.aspectRatio = true;
- }
-
- if (type === 'iframe' && isTouch) {
- coming.scrolling = 'scroll';
- }
-
- // Build the neccessary markup
- coming.wrap = $(coming.tpl.wrap).addClass('fancybox-' + (isTouch ? 'mobile' : 'desktop') + ' fancybox-type-' + type + ' fancybox-tmp ' + coming.wrapCSS).appendTo( coming.parent || 'body' );
-
- $.extend(coming, {
- skin : $('.fancybox-skin', coming.wrap),
- outer : $('.fancybox-outer', coming.wrap),
- inner : $('.fancybox-inner', coming.wrap)
- });
-
- $.each(["Top", "Right", "Bottom", "Left"], function(i, v) {
- coming.skin.css('padding' + v, getValue(coming.padding[ i ]));
- });
-
- F.trigger('onReady');
-
- // Check before try to load; 'inline' and 'html' types need content, others - href
- if (type === 'inline' || type === 'html') {
- if (!coming.content || !coming.content.length) {
- return F._error( 'content' );
- }
-
- } else if (!href) {
- return F._error( 'href' );
- }
-
- if (type === 'image') {
- F._loadImage();
-
- } else if (type === 'ajax') {
- F._loadAjax();
-
- } else if (type === 'iframe') {
- F._loadIframe();
-
- } else {
- F._afterLoad();
- }
- },
-
- _error: function ( type ) {
- $.extend(F.coming, {
- type : 'html',
- autoWidth : true,
- autoHeight : true,
- minWidth : 0,
- minHeight : 0,
- scrolling : 'no',
- hasError : type,
- content : F.coming.tpl.error
- });
-
- F._afterLoad();
- },
-
- _loadImage: function () {
- // Reset preload image so it is later possible to check "complete" property
- var img = F.imgPreload = new Image();
-
- img.onload = function () {
- this.onload = this.onerror = null;
-
- F.coming.width = this.width;
- F.coming.height = this.height;
-
- F._afterLoad();
- };
-
- img.onerror = function () {
- this.onload = this.onerror = null;
-
- F._error( 'image' );
- };
-
- img.src = F.coming.href;
-
- if (img.complete !== true) {
- F.showLoading();
- }
- },
-
- _loadAjax: function () {
- var coming = F.coming;
-
- F.showLoading();
-
- F.ajaxLoad = $.ajax($.extend({}, coming.ajax, {
- url: coming.href,
- error: function (jqXHR, textStatus) {
- if (F.coming && textStatus !== 'abort') {
- F._error( 'ajax', jqXHR );
-
- } else {
- F.hideLoading();
- }
- },
- success: function (data, textStatus) {
- if (textStatus === 'success') {
- coming.content = data;
-
- F._afterLoad();
- }
- }
- }));
- },
-
- _loadIframe: function() {
- var coming = F.coming,
- iframe = $(coming.tpl.iframe.replace(/\{rnd\}/g, new Date().getTime()))
- .attr('scrolling', isTouch ? 'auto' : coming.iframe.scrolling)
- .attr('src', coming.href);
-
- // This helps IE
- $(coming.wrap).bind('onReset', function () {
- try {
- $(this).find('iframe').hide().attr('src', '//about:blank').end().empty();
- } catch (e) {}
- });
-
- if (coming.iframe.preload) {
- F.showLoading();
-
- iframe.one('load', function() {
- $(this).data('ready', 1);
-
- // iOS will lose scrolling if we resize
- if (!isTouch) {
- $(this).bind('load.fb', F.update);
- }
-
- // Without this trick:
- // - iframe won't scroll on iOS devices
- // - IE7 sometimes displays empty iframe
- $(this).parents('.fancybox-wrap').width('100%').removeClass('fancybox-tmp').show();
-
- F._afterLoad();
- });
- }
-
- coming.content = iframe.appendTo( coming.inner );
-
- if (!coming.iframe.preload) {
- F._afterLoad();
- }
- },
-
- _preloadImages: function() {
- var group = F.group,
- current = F.current,
- len = group.length,
- cnt = current.preload ? Math.min(current.preload, len - 1) : 0,
- item,
- i;
-
- for (i = 1; i <= cnt; i += 1) {
- item = group[ (current.index + i ) % len ];
-
- if (item.type === 'image' && item.href) {
- new Image().src = item.href;
- }
- }
- },
-
- _afterLoad: function () {
- var coming = F.coming,
- previous = F.current,
- placeholder = 'fancybox-placeholder',
- current,
- content,
- type,
- scrolling,
- href,
- embed;
-
- F.hideLoading();
-
- if (!coming || F.isActive === false) {
- return;
- }
-
- if (false === F.trigger('afterLoad', coming, previous)) {
- coming.wrap.stop(true).trigger('onReset').remove();
-
- F.coming = null;
-
- return;
- }
-
- if (previous) {
- F.trigger('beforeChange', previous);
-
- previous.wrap.stop(true).removeClass('fancybox-opened')
- .find('.fancybox-item, .fancybox-nav')
- .remove();
- }
-
- F.unbindEvents();
-
- current = coming;
- content = coming.content;
- type = coming.type;
- scrolling = coming.scrolling;
-
- $.extend(F, {
- wrap : current.wrap,
- skin : current.skin,
- outer : current.outer,
- inner : current.inner,
- current : current,
- previous : previous
- });
-
- href = current.href;
-
- switch (type) {
- case 'inline':
- case 'ajax':
- case 'html':
- if (current.selector) {
- content = $('<div>').html(content).find(current.selector);
-
- } else if (isQuery(content)) {
- if (!content.data(placeholder)) {
- content.data(placeholder, $('<div class="' + placeholder + '"></div>').insertAfter( content ).hide() );
- }
-
- content = content.show().detach();
-
- current.wrap.bind('onReset', function () {
- if ($(this).find(content).length) {
- content.hide().replaceAll( content.data(placeholder) ).data(placeholder, false);
- }
- });
- }
- break;
-
- case 'image':
- content = current.tpl.image.replace('{href}', href);
- break;
-
- case 'swf':
- content = '<object id="fancybox-swf" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%"><param name="movie" value="' + href + '"></param>';
- embed = '';
-
- $.each(current.swf, function(name, val) {
- content += '<param name="' + name + '" value="' + val + '"></param>';
- embed += ' ' + name + '="' + val + '"';
- });
-
- content += '<embed src="' + href + '" type="application/x-shockwave-flash" width="100%" height="100%"' + embed + '></embed></object>';
- break;
- }
-
- if (!(isQuery(content) && content.parent().is(current.inner))) {
- current.inner.append( content );
- }
-
- // Give a chance for helpers or callbacks to update elements
- F.trigger('beforeShow');
-
- // Set scrolling before calculating dimensions
- current.inner.css('overflow', scrolling === 'yes' ? 'scroll' : (scrolling === 'no' ? 'hidden' : scrolling));
-
- // Set initial dimensions and start position
- F._setDimension();
-
- F.reposition();
-
- F.isOpen = false;
- F.coming = null;
-
- F.bindEvents();
-
- if (!F.isOpened) {
- $('.fancybox-wrap').not( current.wrap ).stop(true).trigger('onReset').remove();
-
- } else if (previous.prevMethod) {
- F.transitions[ previous.prevMethod ]();
- }
-
- F.transitions[ F.isOpened ? current.nextMethod : current.openMethod ]();
-
- F._preloadImages();
- },
-
- _setDimension: function () {
- var viewport = F.getViewport(),
- steps = 0,
- canShrink = false,
- canExpand = false,
- wrap = F.wrap,
- skin = F.skin,
- inner = F.inner,
- current = F.current,
- width = current.width,
- height = current.height,
- minWidth = current.minWidth,
- minHeight = current.minHeight,
- maxWidth = current.maxWidth,
- maxHeight = current.maxHeight,
- scrolling = current.scrolling,
- scrollOut = current.scrollOutside ? current.scrollbarWidth : 0,
- margin = current.margin,
- wMargin = getScalar(margin[1] + margin[3]),
- hMargin = getScalar(margin[0] + margin[2]),
- wPadding,
- hPadding,
- wSpace,
- hSpace,
- origWidth,
- origHeight,
- origMaxWidth,
- origMaxHeight,
- ratio,
- width_,
- height_,
- maxWidth_,
- maxHeight_,
- iframe,
- body;
-
- // Reset dimensions so we could re-check actual size
- wrap.add(skin).add(inner).width('auto').height('auto').removeClass('fancybox-tmp');
-
- wPadding = getScalar(skin.outerWidth(true) - skin.width());
- hPadding = getScalar(skin.outerHeight(true) - skin.height());
-
- // Any space between content and viewport (margin, padding, border, title)
- wSpace = wMargin + wPadding;
- hSpace = hMargin + hPadding;
-
- origWidth = isPercentage(width) ? (viewport.w - wSpace) * getScalar(width) / 100 : width;
- origHeight = isPercentage(height) ? (viewport.h - hSpace) * getScalar(height) / 100 : height;
-
- if (current.type === 'iframe') {
- iframe = current.content;
-
- if (current.autoHeight && iframe.data('ready') === 1) {
- try {
- if (iframe[0].contentWindow.document.location) {
- inner.width( origWidth ).height(9999);
-
- body = iframe.contents().find('body');
-
- if (scrollOut) {
- body.css('overflow-x', 'hidden');
- }
-
- origHeight = body.height();
- }
-
- } catch (e) {}
- }
-
- } else if (current.autoWidth || current.autoHeight) {
- inner.addClass( 'fancybox-tmp' );
-
- // Set width or height in case we need to calculate only one dimension
- if (!current.autoWidth) {
- inner.width( origWidth );
- }
-
- if (!current.autoHeight) {
- inner.height( origHeight );
- }
-
- if (current.autoWidth) {
- origWidth = inner.width();
- }
-
- if (current.autoHeight) {
- origHeight = inner.height();
- }
-
- inner.removeClass( 'fancybox-tmp' );
- }
-
- width = getScalar( origWidth );
- height = getScalar( origHeight );
-
- ratio = origWidth / origHeight;
-
- // Calculations for the content
- minWidth = getScalar(isPercentage(minWidth) ? getScalar(minWidth, 'w') - wSpace : minWidth);
- maxWidth = getScalar(isPercentage(maxWidth) ? getScalar(maxWidth, 'w') - wSpace : maxWidth);
-
- minHeight = getScalar(isPercentage(minHeight) ? getScalar(minHeight, 'h') - hSpace : minHeight);
- maxHeight = getScalar(isPercentage(maxHeight) ? getScalar(maxHeight, 'h') - hSpace : maxHeight);
-
- // These will be used to determine if wrap can fit in the viewport
- origMaxWidth = maxWidth;
- origMaxHeight = maxHeight;
-
- if (current.fitToView) {
- maxWidth = Math.min(viewport.w - wSpace, maxWidth);
- maxHeight = Math.min(viewport.h - hSpace, maxHeight);
- }
-
- maxWidth_ = viewport.w - wMargin;
- maxHeight_ = viewport.h - hMargin;
-
- if (current.aspectRatio) {
- if (width > maxWidth) {
- width = maxWidth;
- height = getScalar(width / ratio);
- }
-
- if (height > maxHeight) {
- height = maxHeight;
- width = getScalar(height * ratio);
- }
-
- if (width < minWidth) {
- width = minWidth;
- height = getScalar(width / ratio);
- }
-
- if (height < minHeight) {
- height = minHeight;
- width = getScalar(height * ratio);
- }
-
- } else {
- width = Math.max(minWidth, Math.min(width, maxWidth));
-
- if (current.autoHeight && current.type !== 'iframe') {
- inner.width( width );
-
- height = inner.height();
- }
-
- height = Math.max(minHeight, Math.min(height, maxHeight));
- }
-
- // Try to fit inside viewport (including the title)
- if (current.fitToView) {
- inner.width( width ).height( height );
-
- wrap.width( width + wPadding );
-
- // Real wrap dimensions
- width_ = wrap.width();
- height_ = wrap.height();
-
- if (current.aspectRatio) {
- while ((width_ > maxWidth_ || height_ > maxHeight_) && width > minWidth && height > minHeight) {
- if (steps++ > 19) {
- break;
- }
-
- height = Math.max(minHeight, Math.min(maxHeight, height - 10));
- width = getScalar(height * ratio);
-
- if (width < minWidth) {
- width = minWidth;
- height = getScalar(width / ratio);
- }
-
- if (width > maxWidth) {
- width = maxWidth;
- height = getScalar(width / ratio);
- }
-
- inner.width( width ).height( height );
-
- wrap.width( width + wPadding );
-
- width_ = wrap.width();
- height_ = wrap.height();
- }
-
- } else {
- width = Math.max(minWidth, Math.min(width, width - (width_ - maxWidth_)));
- height = Math.max(minHeight, Math.min(height, height - (height_ - maxHeight_)));
- }
- }
-
- if (scrollOut && scrolling === 'auto' && height < origHeight && (width + wPadding + scrollOut) < maxWidth_) {
- width += scrollOut;
- }
-
- inner.width( width ).height( height );
-
- wrap.width( width + wPadding );
-
- width_ = wrap.width();
- height_ = wrap.height();
-
- canShrink = (width_ > maxWidth_ || height_ > maxHeight_) && width > minWidth && height > minHeight;
- canExpand = current.aspectRatio ? (width < origMaxWidth && height < origMaxHeight && width < origWidth && height < origHeight) : ((width < origMaxWidth || height < origMaxHeight) && (width < origWidth || height < origHeight));
-
- $.extend(current, {
- dim : {
- width : getValue( width_ ),
- height : getValue( height_ )
- },
- origWidth : origWidth,
- origHeight : origHeight,
- canShrink : canShrink,
- canExpand : canExpand,
- wPadding : wPadding,
- hPadding : hPadding,
- wrapSpace : height_ - skin.outerHeight(true),
- skinSpace : skin.height() - height
- });
-
- if (!iframe && current.autoHeight && height > minHeight && height < maxHeight && !canExpand) {
- inner.height('auto');
- }
- },
-
- _getPosition: function (onlyAbsolute) {
- var current = F.current,
- viewport = F.getViewport(),
- margin = current.margin,
- width = F.wrap.width() + margin[1] + margin[3],
- height = F.wrap.height() + margin[0] + margin[2],
- rez = {
- position: 'absolute',
- top : margin[0],
- left : margin[3]
- };
-
- if (current.autoCenter && current.fixed && !onlyAbsolute && height <= viewport.h && width <= viewport.w) {
- rez.position = 'fixed';
-
- } else if (!current.locked) {
- rez.top += viewport.y;
- rez.left += viewport.x;
- }
-
- rez.top = getValue(Math.max(rez.top, rez.top + ((viewport.h - height) * current.topRatio)));
- rez.left = getValue(Math.max(rez.left, rez.left + ((viewport.w - width) * current.leftRatio)));
-
- return rez;
- },
-
- _afterZoomIn: function () {
- var current = F.current;
-
- if (!current) {
- return;
- }
-
- F.isOpen = F.isOpened = true;
-
- F.wrap.css('overflow', 'visible').addClass('fancybox-opened');
-
- F.update();
-
- // Assign a click event
- if ( current.closeClick || (current.nextClick && F.group.length > 1) ) {
- F.inner.css('cursor', 'pointer').bind('click.fb', function(e) {
- if (!$(e.target).is('a') && !$(e.target).parent().is('a')) {
- e.preventDefault();
-
- F[ current.closeClick ? 'close' : 'next' ]();
- }
- });
- }
-
- // Create a close button
- if (current.closeBtn) {
- $(current.tpl.closeBtn).appendTo(F.skin).bind('click.fb', function(e) {
- e.preventDefault();
-
- F.close();
- });
- }
-
- // Create navigation arrows
- if (current.arrows && F.group.length > 1) {
- if (current.loop || current.index > 0) {
- $(current.tpl.prev).appendTo(F.outer).bind('click.fb', F.prev);
- }
-
- if (current.loop || current.index < F.group.length - 1) {
- $(current.tpl.next).appendTo(F.outer).bind('click.fb', F.next);
- }
- }
-
- F.trigger('afterShow');
-
- // Stop the slideshow if this is the last item
- if (!current.loop && current.index === current.group.length - 1) {
- F.play( false );
-
- } else if (F.opts.autoPlay && !F.player.isActive) {
- F.opts.autoPlay = false;
-
- F.play();
- }
- },
-
- _afterZoomOut: function ( obj ) {
- obj = obj || F.current;
-
- $('.fancybox-wrap').trigger('onReset').remove();
-
- $.extend(F, {
- group : {},
- opts : {},
- router : false,
- current : null,
- isActive : false,
- isOpened : false,
- isOpen : false,
- isClosing : false,
- wrap : null,
- skin : null,
- outer : null,
- inner : null
- });
-
- F.trigger('afterClose', obj);
- }
- });
-
- /*
- * Default transitions
- */
-
- F.transitions = {
- getOrigPosition: function () {
- var current = F.current,
- element = current.element,
- orig = current.orig,
- pos = {},
- width = 50,
- height = 50,
- hPadding = current.hPadding,
- wPadding = current.wPadding,
- viewport = F.getViewport();
-
- if (!orig && current.isDom && element.is(':visible')) {
- orig = element.find('img:first');
-
- if (!orig.length) {
- orig = element;
- }
- }
-
- if (isQuery(orig)) {
- pos = orig.offset();
-
- if (orig.is('img')) {
- width = orig.outerWidth();
- height = orig.outerHeight();
- }
-
- } else {
- pos.top = viewport.y + (viewport.h - height) * current.topRatio;
- pos.left = viewport.x + (viewport.w - width) * current.leftRatio;
- }
-
- if (F.wrap.css('position') === 'fixed' || current.locked) {
- pos.top -= viewport.y;
- pos.left -= viewport.x;
- }
-
- pos = {
- top : getValue(pos.top - hPadding * current.topRatio),
- left : getValue(pos.left - wPadding * current.leftRatio),
- width : getValue(width + wPadding),
- height : getValue(height + hPadding)
- };
-
- return pos;
- },
-
- step: function (now, fx) {
- var ratio,
- padding,
- value,
- prop = fx.prop,
- current = F.current,
- wrapSpace = current.wrapSpace,
- skinSpace = current.skinSpace;
-
- if (prop === 'width' || prop === 'height') {
- ratio = fx.end === fx.start ? 1 : (now - fx.start) / (fx.end - fx.start);
-
- if (F.isClosing) {
- ratio = 1 - ratio;
- }
-
- padding = prop === 'width' ? current.wPadding : current.hPadding;
- value = now - padding;
-
- F.skin[ prop ]( getScalar( prop === 'width' ? value : value - (wrapSpace * ratio) ) );
- F.inner[ prop ]( getScalar( prop === 'width' ? value : value - (wrapSpace * ratio) - (skinSpace * ratio) ) );
- }
- },
-
- zoomIn: function () {
- var current = F.current,
- startPos = current.pos,
- effect = current.openEffect,
- elastic = effect === 'elastic',
- endPos = $.extend({opacity : 1}, startPos);
-
- // Remove "position" property that breaks older IE
- delete endPos.position;
-
- if (elastic) {
- startPos = this.getOrigPosition();
-
- if (current.openOpacity) {
- startPos.opacity = 0.1;
- }
-
- } else if (effect === 'fade') {
- startPos.opacity = 0.1;
- }
-
- F.wrap.css(startPos).animate(endPos, {
- duration : effect === 'none' ? 0 : current.openSpeed,
- easing : current.openEasing,
- step : elastic ? this.step : null,
- complete : F._afterZoomIn
- });
- },
-
- zoomOut: function () {
- var current = F.current,
- effect = current.closeEffect,
- elastic = effect === 'elastic',
- endPos = {opacity : 0.1};
-
- if (elastic) {
- endPos = this.getOrigPosition();
-
- if (current.closeOpacity) {
- endPos.opacity = 0.1;
- }
- }
-
- F.wrap.animate(endPos, {
- duration : effect === 'none' ? 0 : current.closeSpeed,
- easing : current.closeEasing,
- step : elastic ? this.step : null,
- complete : F._afterZoomOut
- });
- },
-
- changeIn: function () {
- var current = F.current,
- effect = current.nextEffect,
- startPos = current.pos,
- endPos = { opacity : 1 },
- direction = F.direction,
- distance = 200,
- field;
-
- startPos.opacity = 0.1;
-
- if (effect === 'elastic') {
- field = direction === 'down' || direction === 'up' ? 'top' : 'left';
-
- if (direction === 'down' || direction === 'right') {
- startPos[ field ] = getValue(getScalar(startPos[ field ]) - distance);
- endPos[ field ] = '+=' + distance + 'px';
-
- } else {
- startPos[ field ] = getValue(getScalar(startPos[ field ]) + distance);
- endPos[ field ] = '-=' + distance + 'px';
- }
- }
-
- // Workaround for http://bugs.jquery.com/ticket/12273
- if (effect === 'none') {
- F._afterZoomIn();
-
- } else {
- F.wrap.css(startPos).animate(endPos, {
- duration : current.nextSpeed,
- easing : current.nextEasing,
- complete : F._afterZoomIn
- });
- }
- },
-
- changeOut: function () {
- var previous = F.previous,
- effect = previous.prevEffect,
- endPos = { opacity : 0.1 },
- direction = F.direction,
- distance = 200;
-
- if (effect === 'elastic') {
- endPos[ direction === 'down' || direction === 'up' ? 'top' : 'left' ] = ( direction === 'up' || direction === 'left' ? '-' : '+' ) + '=' + distance + 'px';
- }
-
- previous.wrap.animate(endPos, {
- duration : effect === 'none' ? 0 : previous.prevSpeed,
- easing : previous.prevEasing,
- complete : function () {
- $(this).trigger('onReset').remove();
- }
- });
- }
- };
-
- /*
- * Overlay helper
- */
-
- F.helpers.overlay = {
- defaults : {
- closeClick : true, // if true, fancyBox will be closed when user clicks on the overlay
- speedOut : 200, // duration of fadeOut animation
- showEarly : true, // indicates if should be opened immediately or wait until the content is ready
- css : {}, // custom CSS properties
- locked : !isTouch, // if true, the content will be locked into overlay
- fixed : true // if false, the overlay CSS position property will not be set to "fixed"
- },
-
- overlay : null, // current handle
- fixed : false, // indicates if the overlay has position "fixed"
-
- // Public methods
- create : function(opts) {
- opts = $.extend({}, this.defaults, opts);
-
- if (this.overlay) {
- this.close();
- }
-
- this.overlay = $('<div class="fancybox-overlay"></div>').appendTo( 'body' );
- this.fixed = false;
-
- if (opts.fixed && F.defaults.fixed) {
- this.overlay.addClass('fancybox-overlay-fixed');
-
- this.fixed = true;
- }
- },
-
- open : function(opts) {
- var that = this;
-
- opts = $.extend({}, this.defaults, opts);
-
- if (this.overlay) {
- this.overlay.unbind('.overlay').width('auto').height('auto');
-
- } else {
- this.create(opts);
- }
-
- if (!this.fixed) {
- W.bind('resize.overlay', $.proxy( this.update, this) );
-
- this.update();
- }
-
- if (opts.closeClick) {
- this.overlay.bind('click.overlay', function(e) {
- if ($(e.target).hasClass('fancybox-overlay')) {
- if (F.isActive) {
- F.close();
- } else {
- that.close();
- }
- }
- });
- }
-
- this.overlay.css( opts.css ).show();
- },
-
- close : function() {
- $('.fancybox-overlay').remove();
-
- W.unbind('resize.overlay');
-
- this.overlay = null;
-
- if (this.margin !== false) {
- $('body').css('margin-right', this.margin);
-
- this.margin = false;
- }
-
- if (this.el) {
- this.el.removeClass('fancybox-lock');
- }
- },
-
- // Private, callbacks
-
- update : function () {
- var width = '100%', offsetWidth;
-
- // Reset width/height so it will not mess
- this.overlay.width(width).height('100%');
-
- // jQuery does not return reliable result for IE
- if (IE) {
- offsetWidth = Math.max(document.documentElement.offsetWidth, document.body.offsetWidth);
-
- if (D.width() > offsetWidth) {
- width = D.width();
- }
-
- } else if (D.width() > W.width()) {
- width = D.width();
- }
-
- this.overlay.width(width).height(D.height());
- },
-
- // This is where we can manipulate DOM, because later it would cause iframes to reload
- onReady : function (opts, obj) {
- $('.fancybox-overlay').stop(true, true);
-
- if (!this.overlay) {
- this.margin = D.height() > W.height() || $('body').css('overflow-y') === 'scroll' ? $('body').css('margin-right') : false;
- this.el = document.all && !document.querySelector ? $('html') : $('body');
-
- this.create(opts);
- }
-
- if (opts.locked && this.fixed) {
- obj.locked = this.overlay.append( obj.wrap );
- obj.fixed = false;
- }
-
- if (opts.showEarly === true) {
- this.beforeShow.apply(this, arguments);
- }
- },
-
- beforeShow : function(opts, obj) {
- if (obj.locked) {
- this.el.addClass('fancybox-lock');
-
- if (this.margin !== false) {
- $('body').css('margin-right', getScalar( this.margin ) + obj.scrollbarWidth);
- }
- }
-
- this.open(opts);
- },
-
- onUpdate : function() {
- if (!this.fixed) {
- this.update();
- }
- },
-
- afterClose: function (opts) {
- // Remove overlay if exists and fancyBox is not opening
- // (e.g., it is not being open using afterClose callback)
- if (this.overlay && !F.isActive) {
- this.overlay.fadeOut(opts.speedOut, $.proxy( this.close, this ));
- }
- }
- };
-
- /*
- * Title helper
- */
-
- F.helpers.title = {
- defaults : {
- type : 'float', // 'float', 'inside', 'outside' or 'over',
- position : 'bottom' // 'top' or 'bottom'
- },
-
- beforeShow: function (opts) {
- var current = F.current,
- text = current.title,
- type = opts.type,
- title,
- target;
-
- if ($.isFunction(text)) {
- text = text.call(current.element, current);
- }
-
- if (!isString(text) || $.trim(text) === '') {
- return;
- }
-
- title = $('<div class="fancybox-title fancybox-title-' + type + '-wrap">' + text + '</div>');
-
- switch (type) {
- case 'inside':
- target = F.skin;
- break;
-
- case 'outside':
- target = F.wrap;
- break;
-
- case 'over':
- target = F.inner;
- break;
-
- default: // 'float'
- target = F.skin;
-
- title.appendTo('body');
-
- if (IE) {
- title.width( title.width() );
- }
-
- title.wrapInner('<span class="child"></span>');
-
- //Increase bottom margin so this title will also fit into viewport
- F.current.margin[2] += Math.abs( getScalar(title.css('margin-bottom')) );
- break;
- }
-
- title[ (opts.position === 'top' ? 'prependTo' : 'appendTo') ](target);
- }
- };
-
- // jQuery plugin initialization
- $.fn.fancybox = function (options) {
- var index,
- that = $(this),
- selector = this.selector || '',
- run = function(e) {
- var what = $(this).blur(), idx = index, relType, relVal;
-
- if (!(e.ctrlKey || e.altKey || e.shiftKey || e.metaKey) && !what.is('.fancybox-wrap')) {
- relType = options.groupAttr || 'data-fancybox-group';
- relVal = what.attr(relType);
-
- if (!relVal) {
- relType = 'rel';
- relVal = what.get(0)[ relType ];
- }
-
- if (relVal && relVal !== '' && relVal !== 'nofollow') {
- what = selector.length ? $(selector) : that;
- what = what.filter('[' + relType + '="' + relVal + '"]');
- idx = what.index(this);
- }
-
- options.index = idx;
-
- // Stop an event from bubbling if everything is fine
- if (F.open(what, options) !== false) {
- e.preventDefault();
- }
- }
- };
-
- options = options || {};
- index = options.index || 0;
-
- if (!selector || options.live === false) {
- that.unbind('click.fb-start').bind('click.fb-start', run);
-
- } else {
- D.undelegate(selector, 'click.fb-start').delegate(selector + ":not('.fancybox-item, .fancybox-nav')", 'click.fb-start', run);
- }
-
- this.filter('[data-fancybox-start=1]').trigger('click');
-
- return this;
- };
-
- // Tests that need a body at doc ready
- D.ready(function() {
- if ( $.scrollbarWidth === undefined ) {
- // http://benalman.com/projects/jquery-misc-plugins/#scrollbarwidth
- $.scrollbarWidth = function() {
- var parent = $('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo('body'),
- child = parent.children(),
- width = child.innerWidth() - child.height( 99 ).innerWidth();
-
- parent.remove();
-
- return width;
- };
- }
-
- if ( $.support.fixedPosition === undefined ) {
- $.support.fixedPosition = (function() {
- var elem = $('<div style="position:fixed;top:20px;"></div>').appendTo('body'),
- fixed = ( elem[0].offsetTop === 20 || elem[0].offsetTop === 15 );
-
- elem.remove();
-
- return fixed;
- }());
- }
-
- $.extend(F.defaults, {
- scrollbarWidth : $.scrollbarWidth(),
- fixed : $.support.fixedPosition,
- parent : $('body')
- });
- });
-
-}(window, document, jQuery));
\ No newline at end of file
+++ /dev/null
-(function(C,z,f,r){var q=f(C),n=f(z),b=f.fancybox=function(){b.open.apply(this,arguments)},H=navigator.userAgent.match(/msie/i),w=null,s=z.createTouch!==r,t=function(a){return a&&a.hasOwnProperty&&a instanceof f},p=function(a){return a&&"string"===f.type(a)},F=function(a){return p(a)&&0<a.indexOf("%")},l=function(a,d){var e=parseInt(a,10)||0;d&&F(a)&&(e*=b.getViewport()[d]/100);return Math.ceil(e)},x=function(a,b){return l(a,b)+"px"};f.extend(b,{version:"2.1.4",defaults:{padding:15,margin:20,width:800,
-height:600,minWidth:100,minHeight:100,maxWidth:9999,maxHeight:9999,autoSize:!0,autoHeight:!1,autoWidth:!1,autoResize:!0,autoCenter:!s,fitToView:!0,aspectRatio:!1,topRatio:0.5,leftRatio:0.5,scrolling:"auto",wrapCSS:"",arrows:!0,closeBtn:!0,closeClick:!1,nextClick:!1,mouseWheel:!0,autoPlay:!1,playSpeed:3E3,preload:3,modal:!1,loop:!0,ajax:{dataType:"html",headers:{"X-fancyBox":!0}},iframe:{scrolling:"auto",preload:!0},swf:{wmode:"transparent",allowfullscreen:"true",allowscriptaccess:"always"},keys:{next:{13:"left",
-34:"up",39:"left",40:"up"},prev:{8:"right",33:"down",37:"right",38:"down"},close:[27],play:[32],toggle:[70]},direction:{next:"left",prev:"right"},scrollOutside:!0,index:0,type:null,href:null,content:null,title:null,tpl:{wrap:'<div class="fancybox-wrap" tabIndex="-1"><div class="fancybox-skin"><div class="fancybox-outer"><div class="fancybox-inner"></div></div></div></div>',image:'<img class="fancybox-image" src="{href}" alt="" />',iframe:'<iframe id="fancybox-frame{rnd}" name="fancybox-frame{rnd}" class="fancybox-iframe" frameborder="0" vspace="0" hspace="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen'+
-(H?' allowtransparency="true"':"")+"></iframe>",error:'<p class="fancybox-error">The requested content cannot be loaded.<br/>Please try again later.</p>',closeBtn:'<a title="Close" class="fancybox-item fancybox-close" href="javascript:;"></a>',next:'<a title="Next" class="fancybox-nav fancybox-next" href="javascript:;"><span></span></a>',prev:'<a title="Previous" class="fancybox-nav fancybox-prev" href="javascript:;"><span></span></a>'},openEffect:"fade",openSpeed:250,openEasing:"swing",openOpacity:!0,
-openMethod:"zoomIn",closeEffect:"fade",closeSpeed:250,closeEasing:"swing",closeOpacity:!0,closeMethod:"zoomOut",nextEffect:"elastic",nextSpeed:250,nextEasing:"swing",nextMethod:"changeIn",prevEffect:"elastic",prevSpeed:250,prevEasing:"swing",prevMethod:"changeOut",helpers:{overlay:!0,title:!0},onCancel:f.noop,beforeLoad:f.noop,afterLoad:f.noop,beforeShow:f.noop,afterShow:f.noop,beforeChange:f.noop,beforeClose:f.noop,afterClose:f.noop},group:{},opts:{},previous:null,coming:null,current:null,isActive:!1,
-isOpen:!1,isOpened:!1,wrap:null,skin:null,outer:null,inner:null,player:{timer:null,isActive:!1},ajaxLoad:null,imgPreload:null,transitions:{},helpers:{},open:function(a,d){if(a&&(f.isPlainObject(d)||(d={}),!1!==b.close(!0)))return f.isArray(a)||(a=t(a)?f(a).get():[a]),f.each(a,function(e,c){var k={},g,h,j,m,l;"object"===f.type(c)&&(c.nodeType&&(c=f(c)),t(c)?(k={href:c.data("fancybox-href")||c.attr("href"),title:c.data("fancybox-title")||c.attr("title"),isDom:!0,element:c},f.metadata&&f.extend(!0,k,
-c.metadata())):k=c);g=d.href||k.href||(p(c)?c:null);h=d.title!==r?d.title:k.title||"";m=(j=d.content||k.content)?"html":d.type||k.type;!m&&k.isDom&&(m=c.data("fancybox-type"),m||(m=(m=c.prop("class").match(/fancybox\.(\w+)/))?m[1]:null));p(g)&&(m||(b.isImage(g)?m="image":b.isSWF(g)?m="swf":"#"===g.charAt(0)?m="inline":p(c)&&(m="html",j=c)),"ajax"===m&&(l=g.split(/\s+/,2),g=l.shift(),l=l.shift()));j||("inline"===m?g?j=f(p(g)?g.replace(/.*(?=#[^\s]+$)/,""):g):k.isDom&&(j=c):"html"===m?j=g:!m&&(!g&&
-k.isDom)&&(m="inline",j=c));f.extend(k,{href:g,type:m,content:j,title:h,selector:l});a[e]=k}),b.opts=f.extend(!0,{},b.defaults,d),d.keys!==r&&(b.opts.keys=d.keys?f.extend({},b.defaults.keys,d.keys):!1),b.group=a,b._start(b.opts.index)},cancel:function(){var a=b.coming;a&&!1!==b.trigger("onCancel")&&(b.hideLoading(),b.ajaxLoad&&b.ajaxLoad.abort(),b.ajaxLoad=null,b.imgPreload&&(b.imgPreload.onload=b.imgPreload.onerror=null),a.wrap&&a.wrap.stop(!0,!0).trigger("onReset").remove(),b.coming=null,b.current||
-b._afterZoomOut(a))},close:function(a){b.cancel();!1!==b.trigger("beforeClose")&&(b.unbindEvents(),b.isActive&&(!b.isOpen||!0===a?(f(".fancybox-wrap").stop(!0).trigger("onReset").remove(),b._afterZoomOut()):(b.isOpen=b.isOpened=!1,b.isClosing=!0,f(".fancybox-item, .fancybox-nav").remove(),b.wrap.stop(!0,!0).removeClass("fancybox-opened"),b.transitions[b.current.closeMethod]())))},play:function(a){var d=function(){clearTimeout(b.player.timer)},e=function(){d();b.current&&b.player.isActive&&(b.player.timer=
-setTimeout(b.next,b.current.playSpeed))},c=function(){d();f("body").unbind(".player");b.player.isActive=!1;b.trigger("onPlayEnd")};if(!0===a||!b.player.isActive&&!1!==a){if(b.current&&(b.current.loop||b.current.index<b.group.length-1))b.player.isActive=!0,f("body").bind({"afterShow.player onUpdate.player":e,"onCancel.player beforeClose.player":c,"beforeLoad.player":d}),e(),b.trigger("onPlayStart")}else c()},next:function(a){var d=b.current;d&&(p(a)||(a=d.direction.next),b.jumpto(d.index+1,a,"next"))},
-prev:function(a){var d=b.current;d&&(p(a)||(a=d.direction.prev),b.jumpto(d.index-1,a,"prev"))},jumpto:function(a,d,e){var c=b.current;c&&(a=l(a),b.direction=d||c.direction[a>=c.index?"next":"prev"],b.router=e||"jumpto",c.loop&&(0>a&&(a=c.group.length+a%c.group.length),a%=c.group.length),c.group[a]!==r&&(b.cancel(),b._start(a)))},reposition:function(a,d){var e=b.current,c=e?e.wrap:null,k;c&&(k=b._getPosition(d),a&&"scroll"===a.type?(delete k.position,c.stop(!0,!0).animate(k,200)):(c.css(k),e.pos=f.extend({},
-e.dim,k)))},update:function(a){var d=a&&a.type,e=!d||"orientationchange"===d;e&&(clearTimeout(w),w=null);b.isOpen&&!w&&(w=setTimeout(function(){var c=b.current;c&&!b.isClosing&&(b.wrap.removeClass("fancybox-tmp"),(e||"load"===d||"resize"===d&&c.autoResize)&&b._setDimension(),"scroll"===d&&c.canShrink||b.reposition(a),b.trigger("onUpdate"),w=null)},e&&!s?0:300))},toggle:function(a){b.isOpen&&(b.current.fitToView="boolean"===f.type(a)?a:!b.current.fitToView,s&&(b.wrap.removeAttr("style").addClass("fancybox-tmp"),
-b.trigger("onUpdate")),b.update())},hideLoading:function(){n.unbind(".loading");f("#fancybox-loading").remove()},showLoading:function(){var a,d;b.hideLoading();a=f('<div id="fancybox-loading"><div></div></div>').click(b.cancel).appendTo("body");n.bind("keydown.loading",function(a){if(27===(a.which||a.keyCode))a.preventDefault(),b.cancel()});b.defaults.fixed||(d=b.getViewport(),a.css({position:"absolute",top:0.5*d.h+d.y,left:0.5*d.w+d.x}))},getViewport:function(){var a=b.current&&b.current.locked||
-!1,d={x:q.scrollLeft(),y:q.scrollTop()};a?(d.w=a[0].clientWidth,d.h=a[0].clientHeight):(d.w=s&&C.innerWidth?C.innerWidth:q.width(),d.h=s&&C.innerHeight?C.innerHeight:q.height());return d},unbindEvents:function(){b.wrap&&t(b.wrap)&&b.wrap.unbind(".fb");n.unbind(".fb");q.unbind(".fb")},bindEvents:function(){var a=b.current,d;a&&(q.bind("orientationchange.fb"+(s?"":" resize.fb")+(a.autoCenter&&!a.locked?" scroll.fb":""),b.update),(d=a.keys)&&n.bind("keydown.fb",function(e){var c=e.which||e.keyCode,k=
-e.target||e.srcElement;if(27===c&&b.coming)return!1;!e.ctrlKey&&(!e.altKey&&!e.shiftKey&&!e.metaKey&&(!k||!k.type&&!f(k).is("[contenteditable]")))&&f.each(d,function(d,k){if(1<a.group.length&&k[c]!==r)return b[d](k[c]),e.preventDefault(),!1;if(-1<f.inArray(c,k))return b[d](),e.preventDefault(),!1})}),f.fn.mousewheel&&a.mouseWheel&&b.wrap.bind("mousewheel.fb",function(d,c,k,g){for(var h=f(d.target||null),j=!1;h.length&&!j&&!h.is(".fancybox-skin")&&!h.is(".fancybox-wrap");)j=h[0]&&!(h[0].style.overflow&&
-"hidden"===h[0].style.overflow)&&(h[0].clientWidth&&h[0].scrollWidth>h[0].clientWidth||h[0].clientHeight&&h[0].scrollHeight>h[0].clientHeight),h=f(h).parent();if(0!==c&&!j&&1<b.group.length&&!a.canShrink){if(0<g||0<k)b.prev(0<g?"down":"left");else if(0>g||0>k)b.next(0>g?"up":"right");d.preventDefault()}}))},trigger:function(a,d){var e,c=d||b.coming||b.current;if(c){f.isFunction(c[a])&&(e=c[a].apply(c,Array.prototype.slice.call(arguments,1)));if(!1===e)return!1;c.helpers&&f.each(c.helpers,function(d,
-e){e&&(b.helpers[d]&&f.isFunction(b.helpers[d][a]))&&(e=f.extend(!0,{},b.helpers[d].defaults,e),b.helpers[d][a](e,c))});f.event.trigger(a+".fb")}},isImage:function(a){return p(a)&&a.match(/(^data:image\/.*,)|(\.(jp(e|g|eg)|gif|png|bmp|webp)((\?|#).*)?$)/i)},isSWF:function(a){return p(a)&&a.match(/\.(swf)((\?|#).*)?$/i)},_start:function(a){var d={},e,c;a=l(a);e=b.group[a]||null;if(!e)return!1;d=f.extend(!0,{},b.opts,e);e=d.margin;c=d.padding;"number"===f.type(e)&&(d.margin=[e,e,e,e]);"number"===f.type(c)&&
-(d.padding=[c,c,c,c]);d.modal&&f.extend(!0,d,{closeBtn:!1,closeClick:!1,nextClick:!1,arrows:!1,mouseWheel:!1,keys:null,helpers:{overlay:{closeClick:!1}}});d.autoSize&&(d.autoWidth=d.autoHeight=!0);"auto"===d.width&&(d.autoWidth=!0);"auto"===d.height&&(d.autoHeight=!0);d.group=b.group;d.index=a;b.coming=d;if(!1===b.trigger("beforeLoad"))b.coming=null;else{c=d.type;e=d.href;if(!c)return b.coming=null,b.current&&b.router&&"jumpto"!==b.router?(b.current.index=a,b[b.router](b.direction)):!1;b.isActive=
-!0;if("image"===c||"swf"===c)d.autoHeight=d.autoWidth=!1,d.scrolling="visible";"image"===c&&(d.aspectRatio=!0);"iframe"===c&&s&&(d.scrolling="scroll");d.wrap=f(d.tpl.wrap).addClass("fancybox-"+(s?"mobile":"desktop")+" fancybox-type-"+c+" fancybox-tmp "+d.wrapCSS).appendTo(d.parent||"body");f.extend(d,{skin:f(".fancybox-skin",d.wrap),outer:f(".fancybox-outer",d.wrap),inner:f(".fancybox-inner",d.wrap)});f.each(["Top","Right","Bottom","Left"],function(a,b){d.skin.css("padding"+b,x(d.padding[a]))});b.trigger("onReady");
-if("inline"===c||"html"===c){if(!d.content||!d.content.length)return b._error("content")}else if(!e)return b._error("href");"image"===c?b._loadImage():"ajax"===c?b._loadAjax():"iframe"===c?b._loadIframe():b._afterLoad()}},_error:function(a){f.extend(b.coming,{type:"html",autoWidth:!0,autoHeight:!0,minWidth:0,minHeight:0,scrolling:"no",hasError:a,content:b.coming.tpl.error});b._afterLoad()},_loadImage:function(){var a=b.imgPreload=new Image;a.onload=function(){this.onload=this.onerror=null;b.coming.width=
-this.width;b.coming.height=this.height;b._afterLoad()};a.onerror=function(){this.onload=this.onerror=null;b._error("image")};a.src=b.coming.href;!0!==a.complete&&b.showLoading()},_loadAjax:function(){var a=b.coming;b.showLoading();b.ajaxLoad=f.ajax(f.extend({},a.ajax,{url:a.href,error:function(a,e){b.coming&&"abort"!==e?b._error("ajax",a):b.hideLoading()},success:function(d,e){"success"===e&&(a.content=d,b._afterLoad())}}))},_loadIframe:function(){var a=b.coming,d=f(a.tpl.iframe.replace(/\{rnd\}/g,
-(new Date).getTime())).attr("scrolling",s?"auto":a.iframe.scrolling).attr("src",a.href);f(a.wrap).bind("onReset",function(){try{f(this).find("iframe").hide().attr("src","//about:blank").end().empty()}catch(a){}});a.iframe.preload&&(b.showLoading(),d.one("load",function(){f(this).data("ready",1);s||f(this).bind("load.fb",b.update);f(this).parents(".fancybox-wrap").width("100%").removeClass("fancybox-tmp").show();b._afterLoad()}));a.content=d.appendTo(a.inner);a.iframe.preload||b._afterLoad()},_preloadImages:function(){var a=
-b.group,d=b.current,e=a.length,c=d.preload?Math.min(d.preload,e-1):0,f,g;for(g=1;g<=c;g+=1)f=a[(d.index+g)%e],"image"===f.type&&f.href&&((new Image).src=f.href)},_afterLoad:function(){var a=b.coming,d=b.current,e,c,k,g,h;b.hideLoading();if(a&&!1!==b.isActive)if(!1===b.trigger("afterLoad",a,d))a.wrap.stop(!0).trigger("onReset").remove(),b.coming=null;else{d&&(b.trigger("beforeChange",d),d.wrap.stop(!0).removeClass("fancybox-opened").find(".fancybox-item, .fancybox-nav").remove());b.unbindEvents();
-e=a.content;c=a.type;k=a.scrolling;f.extend(b,{wrap:a.wrap,skin:a.skin,outer:a.outer,inner:a.inner,current:a,previous:d});g=a.href;switch(c){case "inline":case "ajax":case "html":a.selector?e=f("<div>").html(e).find(a.selector):t(e)&&(e.data("fancybox-placeholder")||e.data("fancybox-placeholder",f('<div class="fancybox-placeholder"></div>').insertAfter(e).hide()),e=e.show().detach(),a.wrap.bind("onReset",function(){f(this).find(e).length&&e.hide().replaceAll(e.data("fancybox-placeholder")).data("fancybox-placeholder",
-!1)}));break;case "image":e=a.tpl.image.replace("{href}",g);break;case "swf":e='<object id="fancybox-swf" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="100%" height="100%"><param name="movie" value="'+g+'"></param>',h="",f.each(a.swf,function(a,b){e+='<param name="'+a+'" value="'+b+'"></param>';h+=" "+a+'="'+b+'"'}),e+='<embed src="'+g+'" type="application/x-shockwave-flash" width="100%" height="100%"'+h+"></embed></object>"}(!t(e)||!e.parent().is(a.inner))&&a.inner.append(e);b.trigger("beforeShow");
-a.inner.css("overflow","yes"===k?"scroll":"no"===k?"hidden":k);b._setDimension();b.reposition();b.isOpen=!1;b.coming=null;b.bindEvents();if(b.isOpened){if(d.prevMethod)b.transitions[d.prevMethod]()}else f(".fancybox-wrap").not(a.wrap).stop(!0).trigger("onReset").remove();b.transitions[b.isOpened?a.nextMethod:a.openMethod]();b._preloadImages()}},_setDimension:function(){var a=b.getViewport(),d=0,e=!1,c=!1,e=b.wrap,k=b.skin,g=b.inner,h=b.current,c=h.width,j=h.height,m=h.minWidth,u=h.minHeight,n=h.maxWidth,
-v=h.maxHeight,s=h.scrolling,q=h.scrollOutside?h.scrollbarWidth:0,y=h.margin,p=l(y[1]+y[3]),r=l(y[0]+y[2]),z,A,t,D,B,G,C,E,w;e.add(k).add(g).width("auto").height("auto").removeClass("fancybox-tmp");y=l(k.outerWidth(!0)-k.width());z=l(k.outerHeight(!0)-k.height());A=p+y;t=r+z;D=F(c)?(a.w-A)*l(c)/100:c;B=F(j)?(a.h-t)*l(j)/100:j;if("iframe"===h.type){if(w=h.content,h.autoHeight&&1===w.data("ready"))try{w[0].contentWindow.document.location&&(g.width(D).height(9999),G=w.contents().find("body"),q&&G.css("overflow-x",
-"hidden"),B=G.height())}catch(H){}}else if(h.autoWidth||h.autoHeight)g.addClass("fancybox-tmp"),h.autoWidth||g.width(D),h.autoHeight||g.height(B),h.autoWidth&&(D=g.width()),h.autoHeight&&(B=g.height()),g.removeClass("fancybox-tmp");c=l(D);j=l(B);E=D/B;m=l(F(m)?l(m,"w")-A:m);n=l(F(n)?l(n,"w")-A:n);u=l(F(u)?l(u,"h")-t:u);v=l(F(v)?l(v,"h")-t:v);G=n;C=v;h.fitToView&&(n=Math.min(a.w-A,n),v=Math.min(a.h-t,v));A=a.w-p;r=a.h-r;h.aspectRatio?(c>n&&(c=n,j=l(c/E)),j>v&&(j=v,c=l(j*E)),c<m&&(c=m,j=l(c/E)),j<u&&
-(j=u,c=l(j*E))):(c=Math.max(m,Math.min(c,n)),h.autoHeight&&"iframe"!==h.type&&(g.width(c),j=g.height()),j=Math.max(u,Math.min(j,v)));if(h.fitToView)if(g.width(c).height(j),e.width(c+y),a=e.width(),p=e.height(),h.aspectRatio)for(;(a>A||p>r)&&(c>m&&j>u)&&!(19<d++);)j=Math.max(u,Math.min(v,j-10)),c=l(j*E),c<m&&(c=m,j=l(c/E)),c>n&&(c=n,j=l(c/E)),g.width(c).height(j),e.width(c+y),a=e.width(),p=e.height();else c=Math.max(m,Math.min(c,c-(a-A))),j=Math.max(u,Math.min(j,j-(p-r)));q&&("auto"===s&&j<B&&c+y+
-q<A)&&(c+=q);g.width(c).height(j);e.width(c+y);a=e.width();p=e.height();e=(a>A||p>r)&&c>m&&j>u;c=h.aspectRatio?c<G&&j<C&&c<D&&j<B:(c<G||j<C)&&(c<D||j<B);f.extend(h,{dim:{width:x(a),height:x(p)},origWidth:D,origHeight:B,canShrink:e,canExpand:c,wPadding:y,hPadding:z,wrapSpace:p-k.outerHeight(!0),skinSpace:k.height()-j});!w&&(h.autoHeight&&j>u&&j<v&&!c)&&g.height("auto")},_getPosition:function(a){var d=b.current,e=b.getViewport(),c=d.margin,f=b.wrap.width()+c[1]+c[3],g=b.wrap.height()+c[0]+c[2],c={position:"absolute",
-top:c[0],left:c[3]};d.autoCenter&&d.fixed&&!a&&g<=e.h&&f<=e.w?c.position="fixed":d.locked||(c.top+=e.y,c.left+=e.x);c.top=x(Math.max(c.top,c.top+(e.h-g)*d.topRatio));c.left=x(Math.max(c.left,c.left+(e.w-f)*d.leftRatio));return c},_afterZoomIn:function(){var a=b.current;a&&(b.isOpen=b.isOpened=!0,b.wrap.css("overflow","visible").addClass("fancybox-opened"),b.update(),(a.closeClick||a.nextClick&&1<b.group.length)&&b.inner.css("cursor","pointer").bind("click.fb",function(d){!f(d.target).is("a")&&!f(d.target).parent().is("a")&&
-(d.preventDefault(),b[a.closeClick?"close":"next"]())}),a.closeBtn&&f(a.tpl.closeBtn).appendTo(b.skin).bind("click.fb",function(a){a.preventDefault();b.close()}),a.arrows&&1<b.group.length&&((a.loop||0<a.index)&&f(a.tpl.prev).appendTo(b.outer).bind("click.fb",b.prev),(a.loop||a.index<b.group.length-1)&&f(a.tpl.next).appendTo(b.outer).bind("click.fb",b.next)),b.trigger("afterShow"),!a.loop&&a.index===a.group.length-1?b.play(!1):b.opts.autoPlay&&!b.player.isActive&&(b.opts.autoPlay=!1,b.play()))},_afterZoomOut:function(a){a=
-a||b.current;f(".fancybox-wrap").trigger("onReset").remove();f.extend(b,{group:{},opts:{},router:!1,current:null,isActive:!1,isOpened:!1,isOpen:!1,isClosing:!1,wrap:null,skin:null,outer:null,inner:null});b.trigger("afterClose",a)}});b.transitions={getOrigPosition:function(){var a=b.current,d=a.element,e=a.orig,c={},f=50,g=50,h=a.hPadding,j=a.wPadding,m=b.getViewport();!e&&(a.isDom&&d.is(":visible"))&&(e=d.find("img:first"),e.length||(e=d));t(e)?(c=e.offset(),e.is("img")&&(f=e.outerWidth(),g=e.outerHeight())):
-(c.top=m.y+(m.h-g)*a.topRatio,c.left=m.x+(m.w-f)*a.leftRatio);if("fixed"===b.wrap.css("position")||a.locked)c.top-=m.y,c.left-=m.x;return c={top:x(c.top-h*a.topRatio),left:x(c.left-j*a.leftRatio),width:x(f+j),height:x(g+h)}},step:function(a,d){var e,c,f=d.prop;c=b.current;var g=c.wrapSpace,h=c.skinSpace;if("width"===f||"height"===f)e=d.end===d.start?1:(a-d.start)/(d.end-d.start),b.isClosing&&(e=1-e),c="width"===f?c.wPadding:c.hPadding,c=a-c,b.skin[f](l("width"===f?c:c-g*e)),b.inner[f](l("width"===
-f?c:c-g*e-h*e))},zoomIn:function(){var a=b.current,d=a.pos,e=a.openEffect,c="elastic"===e,k=f.extend({opacity:1},d);delete k.position;c?(d=this.getOrigPosition(),a.openOpacity&&(d.opacity=0.1)):"fade"===e&&(d.opacity=0.1);b.wrap.css(d).animate(k,{duration:"none"===e?0:a.openSpeed,easing:a.openEasing,step:c?this.step:null,complete:b._afterZoomIn})},zoomOut:function(){var a=b.current,d=a.closeEffect,e="elastic"===d,c={opacity:0.1};e&&(c=this.getOrigPosition(),a.closeOpacity&&(c.opacity=0.1));b.wrap.animate(c,
-{duration:"none"===d?0:a.closeSpeed,easing:a.closeEasing,step:e?this.step:null,complete:b._afterZoomOut})},changeIn:function(){var a=b.current,d=a.nextEffect,e=a.pos,c={opacity:1},f=b.direction,g;e.opacity=0.1;"elastic"===d&&(g="down"===f||"up"===f?"top":"left","down"===f||"right"===f?(e[g]=x(l(e[g])-200),c[g]="+=200px"):(e[g]=x(l(e[g])+200),c[g]="-=200px"));"none"===d?b._afterZoomIn():b.wrap.css(e).animate(c,{duration:a.nextSpeed,easing:a.nextEasing,complete:b._afterZoomIn})},changeOut:function(){var a=
-b.previous,d=a.prevEffect,e={opacity:0.1},c=b.direction;"elastic"===d&&(e["down"===c||"up"===c?"top":"left"]=("up"===c||"left"===c?"-":"+")+"=200px");a.wrap.animate(e,{duration:"none"===d?0:a.prevSpeed,easing:a.prevEasing,complete:function(){f(this).trigger("onReset").remove()}})}};b.helpers.overlay={defaults:{closeClick:!0,speedOut:200,showEarly:!0,css:{},locked:!s,fixed:!0},overlay:null,fixed:!1,create:function(a){a=f.extend({},this.defaults,a);this.overlay&&this.close();this.overlay=f('<div class="fancybox-overlay"></div>').appendTo("body");
-this.fixed=!1;a.fixed&&b.defaults.fixed&&(this.overlay.addClass("fancybox-overlay-fixed"),this.fixed=!0)},open:function(a){var d=this;a=f.extend({},this.defaults,a);this.overlay?this.overlay.unbind(".overlay").width("auto").height("auto"):this.create(a);this.fixed||(q.bind("resize.overlay",f.proxy(this.update,this)),this.update());a.closeClick&&this.overlay.bind("click.overlay",function(a){f(a.target).hasClass("fancybox-overlay")&&(b.isActive?b.close():d.close())});this.overlay.css(a.css).show()},
-close:function(){f(".fancybox-overlay").remove();q.unbind("resize.overlay");this.overlay=null;!1!==this.margin&&(f("body").css("margin-right",this.margin),this.margin=!1);this.el&&this.el.removeClass("fancybox-lock")},update:function(){var a="100%",b;this.overlay.width(a).height("100%");H?(b=Math.max(z.documentElement.offsetWidth,z.body.offsetWidth),n.width()>b&&(a=n.width())):n.width()>q.width()&&(a=n.width());this.overlay.width(a).height(n.height())},onReady:function(a,b){f(".fancybox-overlay").stop(!0,
-!0);this.overlay||(this.margin=n.height()>q.height()||"scroll"===f("body").css("overflow-y")?f("body").css("margin-right"):!1,this.el=z.all&&!z.querySelector?f("html"):f("body"),this.create(a));a.locked&&this.fixed&&(b.locked=this.overlay.append(b.wrap),b.fixed=!1);!0===a.showEarly&&this.beforeShow.apply(this,arguments)},beforeShow:function(a,b){b.locked&&(this.el.addClass("fancybox-lock"),!1!==this.margin&&f("body").css("margin-right",l(this.margin)+b.scrollbarWidth));this.open(a)},onUpdate:function(){this.fixed||
-this.update()},afterClose:function(a){this.overlay&&!b.isActive&&this.overlay.fadeOut(a.speedOut,f.proxy(this.close,this))}};b.helpers.title={defaults:{type:"float",position:"bottom"},beforeShow:function(a){var d=b.current,e=d.title,c=a.type;f.isFunction(e)&&(e=e.call(d.element,d));if(p(e)&&""!==f.trim(e)){d=f('<div class="fancybox-title fancybox-title-'+c+'-wrap">'+e+"</div>");switch(c){case "inside":c=b.skin;break;case "outside":c=b.wrap;break;case "over":c=b.inner;break;default:c=b.skin,d.appendTo("body"),
-H&&d.width(d.width()),d.wrapInner('<span class="child"></span>'),b.current.margin[2]+=Math.abs(l(d.css("margin-bottom")))}d["top"===a.position?"prependTo":"appendTo"](c)}}};f.fn.fancybox=function(a){var d,e=f(this),c=this.selector||"",k=function(g){var h=f(this).blur(),j=d,k,l;!g.ctrlKey&&(!g.altKey&&!g.shiftKey&&!g.metaKey)&&!h.is(".fancybox-wrap")&&(k=a.groupAttr||"data-fancybox-group",l=h.attr(k),l||(k="rel",l=h.get(0)[k]),l&&(""!==l&&"nofollow"!==l)&&(h=c.length?f(c):e,h=h.filter("["+k+'="'+l+
-'"]'),j=h.index(this)),a.index=j,!1!==b.open(h,a)&&g.preventDefault())};a=a||{};d=a.index||0;!c||!1===a.live?e.unbind("click.fb-start").bind("click.fb-start",k):n.undelegate(c,"click.fb-start").delegate(c+":not('.fancybox-item, .fancybox-nav')","click.fb-start",k);this.filter("[data-fancybox-start=1]").trigger("click");return this};n.ready(function(){f.scrollbarWidth===r&&(f.scrollbarWidth=function(){var a=f('<div style="width:50px;height:50px;overflow:auto"><div/></div>').appendTo("body"),b=a.children(),
-b=b.innerWidth()-b.height(99).innerWidth();a.remove();return b});if(f.support.fixedPosition===r){var a=f.support,d=f('<div style="position:fixed;top:20px;"></div>').appendTo("body"),e=20===d[0].offsetTop||15===d[0].offsetTop;d.remove();a.fixedPosition=e}f.extend(b.defaults,{scrollbarWidth:f.scrollbarWidth(),fixed:f.support.fixedPosition,parent:f("body")})})})(window,document,jQuery);
\ No newline at end of file
+++ /dev/null
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Lesser General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
+++ /dev/null
-Copyright (c) 2009 Adam Shaw
-
-Permission is hereby granted, free of charge, to any person obtaining
-a copy of this software and associated documentation files (the
-"Software"), to deal in the Software without restriction, including
-without limitation the rights to use, copy, modify, merge, publish,
-distribute, sublicense, and/or sell copies of the Software, and to
-permit persons to whom the Software is furnished to do so, subject to
-the following conditions:
-
-The above copyright notice and this permission notice shall be
-included in all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
-EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
-MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
-NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
-LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
-OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
-WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+version 1.6.4 (9/1/13)
+ - better algorithm for positioning timed agenda events (issue 1115)
+ - `slotEventOverlap` option to tweak timed agenda event overlapping (issue 218)
+ - selection bug when slot height is customized (issue 1035)
+ - supply view argument in `loading` callback (issue 1018)
+ - fixed week number not displaying in agenda views (issue 1951)
+ - fixed fullCalendar not initializing with no options (issue 1356)
+ - NPM's package.json, no more warnings or errors (issue 1762)
+ - building the bower component should output bower.json instead of component.json (PR 125)
+ - use bower internally for fetching new versions of jQuery and jQuery UI
+
+version 1.6.3 (8/10/13)
+ - viewRender callback (PR 15)
+ - viewDestroy callback (PR 15)
+ - eventDestroy callback (PR 111)
+ - handleWindowResize option (PR 54)
+ - eventStartEditable/startEditable options (PR 49)
+ - eventDurationEditable/durationEditable options (PR 49)
+ - specify function for $.ajax `data` parameter for JSON event sources (PR 59)
+ - fixed bug with agenda event dropping in wrong column (PR 55)
+ - easier event element z-index customization (PR 58)
+ - classNames on past/future days (PR 88)
+ - allow null/undefined event titles (PR 84)
+ - small optimize for agenda event rendering (PR 56)
+ - deprecated:
+ - viewDisplay
+ - disableDragging
+ - disableResizing
+ - bundled with latest jQuery (1.10.2) and jQuery UI (1.10.3)
+
+version 1.6.2 (7/18/13)
+ - hiddenDays option (issue 686)
+ - bugfix: when eventRender returns false, incorrect stacking of events (issue 762)
+ - bugfix: couldn't change event.backgroundImage when calling updateEvent (thx stephenharris)
+
+version 1.6.1 (4/14/13)
+ - fixed event inner content overflow bug (issue 1783)
+ - fixed table header className bug (1772)
+ - removed text-shadow on events (better for general use, thx tkrotoff)
+
+version 1.6.0 (3/18/13)
+ - visual facelift, with bootstrap-inspired buttons and colors
+ - simplified HTML/CSS for events and buttons
+ - dayRender, for modifying a day cell (issue 191, thx althaus)
+ - week numbers on side of calendar (issue 295)
+ - weekNumber
+ - weekNumberCalculation
+ - weekNumberTitle
+ - "W" formatting variable
+ - finer snapping granularity for agenda view events (issue 495, thx ms-doodle-com)
+ - eventAfterAllRender (issue 753, thx pdrakeweb)
+ - eventDataTransform (thx joeyspo)
+ - data-date attributes on cells (thx Jae)
+ - expose $.fullCalendar.dateFormatters
+ - when clicking fast on buttons, prevent text selection
+ - bundled with latest jQuery (1.9.1) and jQuery UI (1.10.2)
+ - Grunt/Lumbar build system for internal development
+ - build for Bower package manager
+ - build for jQuery plugin site
+
+version 1.5.4 (9/5/12)
+ - made compatible with jQuery 1.8.* (thx archaeron)
+ - bundled with jQuery 1.8.1 and jQuery UI 1.8.23
+
version 1.5.3 (2/6/12)
- fixed dragging issue with jQuery UI 1.8.16 (issue 1168)
- bundled with jQuery 1.7.1 and jQuery UI 1.8.17
-/*
- * FullCalendar v1.5.3 Stylesheet
- *
- * Copyright (c) 2011 Adam Shaw
- * Dual licensed under the MIT and GPL licenses, located in
- * MIT-LICENSE.txt and GPL-LICENSE.txt respectively.
- *
- * Date: Mon Feb 6 22:40:40 2012 -0800
- *
+/*!
+ * FullCalendar v1.6.4 Stylesheet
+ * Docs & License: http://arshaw.com/fullcalendar/
+ * (c) 2013 Adam Shaw
*/
margin-right: -1px;
}
-.fc-header .fc-corner-right {
- margin-right: 1px; /* back to normal */
- }
-
-.fc-header .ui-corner-right {
+.fc-header .fc-corner-right, /* non-theme */
+.fc-header .ui-corner-right { /* theme */
margin-right: 0; /* back to normal */
}
.fc-content {
clear: both;
+ zoom: 1; /* for IE7, gives accurate coordinates for [un]freezeContentHeight */
}
.fc-view {
- width: 100%; /* needed for view switching (when view is absolute) */
+ width: 100%;
overflow: hidden;
}
.fc-widget-header, /* <th>, usually */
.fc-widget-content { /* <td>, usually */
- border: 1px solid #ccc;
+ border: 1px solid #ddd;
}
.fc-state-highlight { /* <td> today cell */ /* TODO: add .fc-today to <th> */
- background: #ffc;
+ background: #fcf8e3;
}
.fc-cell-overlay { /* semi-transparent rectangle while dragging */
- background: #9cf;
- opacity: .2;
- filter: alpha(opacity=20); /* for IE */
+ background: #bce8f1;
+ opacity: .3;
+ filter: alpha(opacity=30); /* for IE */
}
.fc-button {
position: relative;
display: inline-block;
+ padding: 0 .6em;
+ overflow: hidden;
+ height: 1.9em;
+ line-height: 1.9em;
+ white-space: nowrap;
cursor: pointer;
}
.fc-state-default { /* non-theme */
- border-style: solid;
- border-width: 1px 0;
+ border: 1px solid;
}
-
-.fc-button-inner {
- position: relative;
- float: left;
- overflow: hidden;
+
+.fc-state-default.fc-corner-left { /* non-theme */
+ border-top-left-radius: 4px;
+ border-bottom-left-radius: 4px;
}
-
-.fc-state-default .fc-button-inner { /* non-theme */
- border-style: solid;
- border-width: 0 1px;
+
+.fc-state-default.fc-corner-right { /* non-theme */
+ border-top-right-radius: 4px;
+ border-bottom-right-radius: 4px;
}
-
-.fc-button-content {
- position: relative;
- float: left;
- height: 1.9em;
- line-height: 1.9em;
- padding: 0 .6em;
- white-space: nowrap;
+
+/*
+ Our default prev/next buttons use HTML entities like ‹ › « »
+ and we'll try to make them look good cross-browser.
+*/
+
+.fc-text-arrow {
+ margin: 0 .1em;
+ font-size: 2em;
+ font-family: "Courier New", Courier, monospace;
+ vertical-align: baseline; /* for IE7 */
+ }
+
+.fc-button-prev .fc-text-arrow,
+.fc-button-next .fc-text-arrow { /* for ‹ › */
+ font-weight: bold;
}
/* icon (for jquery ui) */
-.fc-button-content .fc-icon-wrap {
+.fc-button .fc-icon-wrap {
position: relative;
float: left;
top: 50%;
}
-.fc-button-content .ui-icon {
+.fc-button .ui-icon {
position: relative;
float: left;
margin-top: -50%;
*top: -50%;
}
-/* gloss effect */
-
-.fc-state-default .fc-button-effect {
- position: absolute;
- top: 50%;
- left: 0;
- }
-
-.fc-state-default .fc-button-effect span {
- position: absolute;
- top: -100px;
- left: 0;
- width: 500px;
- height: 100px;
- border-width: 100px 0 0 1px;
- border-style: solid;
- border-color: #fff;
- background: #444;
- opacity: .09;
- filter: alpha(opacity=9);
- }
-
-/* button states (determines colors) */
-
-.fc-state-default,
-.fc-state-default .fc-button-inner {
- border-style: solid;
- border-color: #ccc #bbb #aaa;
- background: #F3F3F3;
- color: #000;
+/*
+ button states
+ borrowed from twitter bootstrap (http://twitter.github.com/bootstrap/)
+*/
+
+.fc-state-default {
+ background-color: #f5f5f5;
+ background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6);
+ background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6));
+ background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6);
+ background-image: -o-linear-gradient(top, #ffffff, #e6e6e6);
+ background-image: linear-gradient(to bottom, #ffffff, #e6e6e6);
+ background-repeat: repeat-x;
+ border-color: #e6e6e6 #e6e6e6 #bfbfbf;
+ border-color: rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.1) rgba(0, 0, 0, 0.25);
+ color: #333;
+ text-shadow: 0 1px 1px rgba(255, 255, 255, 0.75);
+ box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.2), 0 1px 2px rgba(0, 0, 0, 0.05);
}
-
+
.fc-state-hover,
-.fc-state-hover .fc-button-inner {
- border-color: #999;
- }
-
.fc-state-down,
-.fc-state-down .fc-button-inner {
- border-color: #555;
- background: #777;
- }
-
.fc-state-active,
-.fc-state-active .fc-button-inner {
- border-color: #555;
- background: #777;
- color: #fff;
+.fc-state-disabled {
+ color: #333333;
+ background-color: #e6e6e6;
}
-
-.fc-state-disabled,
-.fc-state-disabled .fc-button-inner {
- color: #999;
- border-color: #ddd;
+
+.fc-state-hover {
+ color: #333333;
+ text-decoration: none;
+ background-position: 0 -15px;
+ -webkit-transition: background-position 0.1s linear;
+ -moz-transition: background-position 0.1s linear;
+ -o-transition: background-position 0.1s linear;
+ transition: background-position 0.1s linear;
}
-
+
+.fc-state-down,
+.fc-state-active {
+ background-color: #cccccc;
+ background-image: none;
+ outline: 0;
+ box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.15), 0 1px 2px rgba(0, 0, 0, 0.05);
+ }
+
.fc-state-disabled {
cursor: default;
+ background-image: none;
+ opacity: 0.65;
+ filter: alpha(opacity=65);
+ box-shadow: none;
}
-
-.fc-state-disabled .fc-button-effect {
- display: none;
- }
-
+
/* Global Event Styles
------------------------------------------------------------------------*/
+
+.fc-event-container > * {
+ z-index: 8;
+ }
+
+.fc-event-container > .ui-draggable-dragging,
+.fc-event-container > .ui-resizable-resizing {
+ z-index: 9;
+ }
.fc-event {
- border-style: solid;
- border-width: 0;
+ border: 1px solid #3a87ad; /* default BORDER color */
+ background-color: #3a87ad; /* default BACKGROUND color */
+ color: #fff; /* default TEXT color */
font-size: .85em;
cursor: default;
}
+
+a.fc-event {
+ text-decoration: none;
+ }
a.fc-event,
.fc-event-draggable {
cursor: pointer;
}
-a.fc-event {
- text-decoration: none;
- }
-
.fc-rtl .fc-event {
text-align: right;
}
-
-.fc-event-skin {
- border-color: #36c; /* default BORDER color */
- background-color: #36c; /* default BACKGROUND color */
- color: #fff; /* default TEXT color */
- }
-
+
.fc-event-inner {
- position: relative;
width: 100%;
height: 100%;
- border-style: solid;
- border-width: 0;
overflow: hidden;
}
padding: 0 1px;
}
-.fc .ui-resizable-handle { /*** TODO: don't use ui-resizable anymore, change class ***/
+.fc .ui-resizable-handle {
display: block;
position: absolute;
z-index: 99999;
border-width: 1px 0;
margin-bottom: 1px;
}
+
+.fc-ltr .fc-event-hori.fc-event-start,
+.fc-rtl .fc-event-hori.fc-event-end {
+ border-left-width: 1px;
+ border-top-left-radius: 3px;
+ border-bottom-left-radius: 3px;
+ }
+
+.fc-ltr .fc-event-hori.fc-event-end,
+.fc-rtl .fc-event-hori.fc-event-start {
+ border-right-width: 1px;
+ border-top-right-radius: 3px;
+ border-bottom-right-radius: 3px;
+ }
/* resizable */
-/* Fake Rounded Corners (for buttons and events)
-------------------------------------------------------------*/
-
-.fc-corner-left {
- margin-left: 1px;
- }
-
-.fc-corner-left .fc-button-inner,
-.fc-corner-left .fc-event-inner {
- margin-left: -1px;
- }
-
-.fc-corner-right {
- margin-right: 1px;
- }
-
-.fc-corner-right .fc-button-inner,
-.fc-corner-right .fc-event-inner {
- margin-right: -1px;
- }
-
-.fc-corner-top {
- margin-top: 1px;
- }
-
-.fc-corner-top .fc-event-inner {
- margin-top: -1px;
- }
-
-.fc-corner-bottom {
- margin-bottom: 1px;
- }
-
-.fc-corner-bottom .fc-event-inner {
- margin-bottom: -1px;
- }
-
-
-
-/* Fake Rounded Corners SPECIFICALLY FOR EVENTS
------------------------------------------------------------------*/
-
-.fc-corner-left .fc-event-inner {
- border-left-width: 1px;
- }
-
-.fc-corner-right .fc-event-inner {
- border-right-width: 1px;
- }
-
-.fc-corner-top .fc-event-inner {
- border-top-width: 1px;
- }
-
-.fc-corner-bottom .fc-event-inner {
- border-bottom-width: 1px;
- }
-
-
-
/* Reusable Separate-border Table
------------------------------------------------------------*/
.fc-grid th {
text-align: center;
}
+
+.fc .fc-week-number {
+ width: 22px;
+ text-align: center;
+ }
+
+.fc .fc-week-number div {
+ padding: 0 2px;
+ }
.fc-grid .fc-day-number {
float: right;
white-space: nowrap;
font-weight: normal;
}
+
+.fc-agenda .fc-week-number {
+ font-weight: bold;
+ }
.fc-agenda .fc-day-content {
padding: 2px 2px 1px;
.fc-event-vert {
border-width: 0 1px;
}
-
-.fc-event-vert .fc-event-head,
-.fc-event-vert .fc-event-content {
- position: relative;
- z-index: 2;
- width: 100%;
- overflow: hidden;
+
+.fc-event-vert.fc-event-start {
+ border-top-width: 1px;
+ border-top-left-radius: 3px;
+ border-top-right-radius: 3px;
+ }
+
+.fc-event-vert.fc-event-end {
+ border-bottom-width: 1px;
+ border-bottom-left-radius: 3px;
+ border-bottom-right-radius: 3px;
}
.fc-event-vert .fc-event-time {
white-space: nowrap;
font-size: 10px;
}
+
+.fc-event-vert .fc-event-inner {
+ position: relative;
+ z-index: 2;
+ }
.fc-event-vert .fc-event-bg { /* makes the event lighter w/ a semi-transparent overlay */
position: absolute;
width: 100%;
height: 100%;
background: #fff;
- opacity: .3;
- filter: alpha(opacity=30);
+ opacity: .25;
+ filter: alpha(opacity=25);
}
.fc .ui-draggable-dragging .fc-event-bg, /* TODO: something nicer like .fc-opacity */
-/**
- * @preserve
- * FullCalendar v1.5.3
- * http://arshaw.com/fullcalendar/
- *
+/*!
+ * FullCalendar v1.6.4
+ * Docs & License: http://arshaw.com/fullcalendar/
+ * (c) 2013 Adam Shaw
+ */
+
+/*
* Use fullcalendar.css for basic styling.
* For event drag & drop, requires jQuery UI draggable.
* For event resizing, requires jQuery UI resizable.
- *
- * Copyright (c) 2011 Adam Shaw
- * Dual licensed under the MIT and GPL licenses, located in
- * MIT-LICENSE.txt and GPL-LICENSE.txt respectively.
- *
- * Date: Mon Feb 6 22:40:40 2012 -0800
- *
*/
(function($, undefined) {
+;;
+
var defaults = {
// display
right: 'today prev,next'
},
weekends: true,
+ weekNumbers: false,
+ weekNumberCalculation: 'iso',
+ weekNumberTitle: 'W',
// editing
//editable: false,
dayNames: ['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],
dayNamesShort: ['Sun','Mon','Tue','Wed','Thu','Fri','Sat'],
buttonText: {
- prev: ' ◄ ',
- next: ' ► ',
- prevYear: ' << ',
- nextYear: ' >> ',
+ prev: "<span class='fc-text-arrow'>‹</span>",
+ next: "<span class='fc-text-arrow'>›</span>",
+ prevYear: "<span class='fc-text-arrow'>«</span>",
+ nextYear: "<span class='fc-text-arrow'>»</span>",
today: 'today',
month: 'month',
week: 'week',
//selectable: false,
unselectAuto: true,
- dropAccept: '*'
+ dropAccept: '*',
+
+ handleWindowResize: true
};
right: 'title'
},
buttonText: {
- prev: ' ► ',
- next: ' ◄ ',
- prevYear: ' >> ',
- nextYear: ' << '
+ prev: "<span class='fc-text-arrow'>›</span>",
+ next: "<span class='fc-text-arrow'>‹</span>",
+ prevYear: "<span class='fc-text-arrow'>»</span>",
+ nextYear: "<span class='fc-text-arrow'>«</span>"
},
buttonIcons: {
prev: 'circle-triangle-e',
-var fc = $.fullCalendar = { version: "1.5.3" };
+;;
+
+var fc = $.fullCalendar = { version: "1.6.4" };
var fcViews = fc.views = {};
}
return this;
}
-
+
+ options = options || {};
// would like to have this logic in EventManager, but needs to happen before options are recursively extended
var eventSources = options.eventSources || [];
+;;
+
function Calendar(element, options, eventSources) {
var t = this;
var content;
var tm; // for making theme classes
var currentView;
- var viewInstances = {};
var elementOuterWidth;
var suggestedViewHeight;
- var absoluteViewElement;
var resizeUID = 0;
var ignoreWindowResize = 0;
var date = new Date();
function render(inc) {
if (!content) {
initialRender();
- }else{
+ }
+ else if (elementVisible()) {
+ // mainly for the public API
calcSize();
- markSizesDirty();
- markEventsDirty();
- renderView(inc);
+ _renderView(inc);
}
}
if (options.isRTL) {
element.addClass('fc-rtl');
}
+ else {
+ element.addClass('fc-ltr');
+ }
if (options.theme) {
element.addClass('ui-widget');
}
+
content = $("<div class='fc-content' style='position:relative'/>")
.prependTo(element);
+
header = new Header(t, options);
headerElement = header.render();
if (headerElement) {
element.prepend(headerElement);
}
+
changeView(options.defaultView);
- $(window).resize(windowResize);
+
+ if (options.handleWindowResize) {
+ $(window).resize(windowResize);
+ }
+
// needed for IE in a 0x0 iframe, b/c when it is resized, never triggers a windowResize
if (!bodyVisible()) {
lateRender();
function destroy() {
+
+ if (currentView) {
+ trigger('viewDestroy', currentView, currentView, currentView.element);
+ currentView.triggerEventDestroy();
+ }
+
$(window).unbind('resize', windowResize);
+
header.destroy();
content.remove();
element.removeClass('fc fc-rtl ui-widget');
}
-
function elementVisible() {
- return _element.offsetWidth !== 0;
+ return element.is(':visible');
}
function bodyVisible() {
- return $('body')[0].offsetWidth !== 0;
+ return $('body').is(':visible');
}
/* View Rendering
-----------------------------------------------------------------------------*/
- // TODO: improve view switching (still weird transition in IE, and FF has whiteout problem)
-
+
function changeView(newViewName) {
if (!currentView || newViewName != currentView.name) {
- ignoreWindowResize++; // because setMinHeight might change the height before render (and subsequently setSize) is reached
+ _changeView(newViewName);
+ }
+ }
+
+
+ function _changeView(newViewName) {
+ ignoreWindowResize++;
+ if (currentView) {
+ trigger('viewDestroy', currentView, currentView, currentView.element);
unselect();
-
- var oldView = currentView;
- var newViewElement;
-
- if (oldView) {
- (oldView.beforeHide || noop)(); // called before changing min-height. if called after, scroll state is reset (in Opera)
- setMinHeight(content, content.height());
- oldView.element.hide();
- }else{
- setMinHeight(content, 1); // needs to be 1 (not 0) for IE7, or else view dimensions miscalculated
- }
- content.css('overflow', 'hidden');
-
- currentView = viewInstances[newViewName];
- if (currentView) {
- currentView.element.show();
- }else{
- currentView = viewInstances[newViewName] = new fcViews[newViewName](
- newViewElement = absoluteViewElement =
- $("<div class='fc-view fc-view-" + newViewName + "' style='position:absolute'/>")
- .appendTo(content),
- t // the calendar object
- );
- }
-
- if (oldView) {
- header.deactivateButton(oldView.name);
- }
- header.activateButton(newViewName);
-
- renderView(); // after height has been set, will make absoluteViewElement's position=relative, then set to null
-
- content.css('overflow', '');
- if (oldView) {
- setMinHeight(content, 1);
- }
-
- if (!newViewElement) {
- (currentView.afterShow || noop)(); // called after setting min-height/overflow, so in final scroll state (for Opera)
- }
-
- ignoreWindowResize--;
+ currentView.triggerEventDestroy(); // trigger 'eventDestroy' for each event
+ freezeContentHeight();
+ currentView.element.remove();
+ header.deactivateButton(currentView.name);
}
+
+ header.activateButton(newViewName);
+
+ currentView = new fcViews[newViewName](
+ $("<div class='fc-view fc-view-" + newViewName + "' style='position:relative'/>")
+ .appendTo(content),
+ t // the calendar object
+ );
+
+ renderView();
+ unfreezeContentHeight();
+
+ ignoreWindowResize--;
}
-
-
-
+
+
function renderView(inc) {
- if (elementVisible()) {
- ignoreWindowResize++; // because renderEvents might temporarily change the height before setSize is reached
+ if (
+ !currentView.start || // never rendered before
+ inc || date < currentView.start || date >= currentView.end // or new date range
+ ) {
+ if (elementVisible()) {
+ _renderView(inc);
+ }
+ }
+ }
+
+
+ function _renderView(inc) { // assumes elementVisible
+ ignoreWindowResize++;
+ if (currentView.start) { // already been rendered?
+ trigger('viewDestroy', currentView, currentView, currentView.element);
unselect();
-
- if (suggestedViewHeight === undefined) {
- calcSize();
- }
-
- var forceEventRender = false;
- if (!currentView.start || inc || date < currentView.start || date >= currentView.end) {
- // view must render an entire new date range (and refetch/render events)
- currentView.render(date, inc || 0); // responsible for clearing events
- setSize(true);
- forceEventRender = true;
- }
- else if (currentView.sizeDirty) {
- // view must resize (and rerender events)
- currentView.clearEvents();
- setSize();
- forceEventRender = true;
- }
- else if (currentView.eventsDirty) {
- currentView.clearEvents();
- forceEventRender = true;
- }
- currentView.sizeDirty = false;
- currentView.eventsDirty = false;
- updateEvents(forceEventRender);
-
- elementOuterWidth = element.outerWidth();
-
- header.updateTitle(currentView.title);
- var today = new Date();
- if (today >= currentView.start && today < currentView.end) {
- header.disableButton('today');
- }else{
- header.enableButton('today');
- }
-
- ignoreWindowResize--;
- currentView.trigger('viewDisplay', _element);
+ clearEvents();
}
+
+ freezeContentHeight();
+ currentView.render(date, inc || 0); // the view's render method ONLY renders the skeleton, nothing else
+ setSize();
+ unfreezeContentHeight();
+ (currentView.afterRender || noop)();
+
+ updateTitle();
+ updateTodayButton();
+
+ trigger('viewRender', currentView, currentView, currentView.element);
+ currentView.trigger('viewDisplay', _element); // deprecated
+
+ ignoreWindowResize--;
+
+ getAndRenderEvents();
}
-
+
/* Resizing
-----------------------------------------------------------------------------*/
function updateSize() {
- markSizesDirty();
if (elementVisible()) {
+ unselect();
+ clearEvents();
calcSize();
setSize();
- unselect();
- currentView.clearEvents();
- currentView.renderEvents(events);
- currentView.sizeDirty = false;
+ renderEvents();
}
}
- function markSizesDirty() {
- $.each(viewInstances, function(i, inst) {
- inst.sizeDirty = true;
- });
- }
-
-
- function calcSize() {
+ function calcSize() { // assumes elementVisible
if (options.contentHeight) {
suggestedViewHeight = options.contentHeight;
}
}
- function setSize(dateChanged) { // todo: dateChanged?
- ignoreWindowResize++;
- currentView.setHeight(suggestedViewHeight, dateChanged);
- if (absoluteViewElement) {
- absoluteViewElement.css('position', 'relative');
- absoluteViewElement = null;
+ function setSize() { // assumes elementVisible
+
+ if (suggestedViewHeight === undefined) {
+ calcSize(); // for first time
+ // NOTE: we don't want to recalculate on every renderView because
+ // it could result in oscillating heights due to scrollbars.
}
- currentView.setWidth(content.width(), dateChanged);
+
+ ignoreWindowResize++;
+ currentView.setHeight(suggestedViewHeight);
+ currentView.setWidth(content.width());
ignoreWindowResize--;
+
+ elementOuterWidth = element.outerWidth();
}
/* Event Fetching/Rendering
-----------------------------------------------------------------------------*/
+ // TODO: going forward, most of this stuff should be directly handled by the view
+
+
+ function refetchEvents() { // can be called as an API method
+ clearEvents();
+ fetchAndRenderEvents();
+ }
+
+
+ function rerenderEvents(modifiedEventID) { // can be called as an API method
+ clearEvents();
+ renderEvents(modifiedEventID);
+ }
+
+
+ function renderEvents(modifiedEventID) { // TODO: remove modifiedEventID hack
+ if (elementVisible()) {
+ currentView.setEventData(events); // for View.js, TODO: unify with renderEvents
+ currentView.renderEvents(events, modifiedEventID); // actually render the DOM elements
+ currentView.trigger('eventAfterAllRender');
+ }
+ }
+
+
+ function clearEvents() {
+ currentView.triggerEventDestroy(); // trigger 'eventDestroy' for each event
+ currentView.clearEvents(); // actually remove the DOM elements
+ currentView.clearEventData(); // for View.js, TODO: unify with clearEvents
+ }
-
- // fetches events if necessary, rerenders events if necessary (or if forced)
- function updateEvents(forceRender) {
+
+ function getAndRenderEvents() {
if (!options.lazyFetching || isFetchNeeded(currentView.visStart, currentView.visEnd)) {
- refetchEvents();
+ fetchAndRenderEvents();
}
- else if (forceRender) {
- rerenderEvents();
+ else {
+ renderEvents();
}
}
-
-
- function refetchEvents() {
- fetchEvents(currentView.visStart, currentView.visEnd); // will call reportEvents
+
+
+ function fetchAndRenderEvents() {
+ fetchEvents(currentView.visStart, currentView.visEnd);
+ // ... will call reportEvents
+ // ... which will call renderEvents
}
-
+
// called when event data arrives
function reportEvents(_events) {
events = _events;
- rerenderEvents();
+ renderEvents();
}
-
-
+
+
// called when a single event's data has been changed
function reportEventChange(eventID) {
rerenderEvents(eventID);
}
-
-
- // attempts to rerenderEvents
- function rerenderEvents(modifiedEventID) {
- markEventsDirty();
- if (elementVisible()) {
- currentView.clearEvents();
- currentView.renderEvents(events, modifiedEventID);
- currentView.eventsDirty = false;
- }
+
+
+
+ /* Header Updating
+ -----------------------------------------------------------------------------*/
+
+
+ function updateTitle() {
+ header.updateTitle(currentView.title);
}
-
-
- function markEventsDirty() {
- $.each(viewInstances, function(i, inst) {
- inst.eventsDirty = true;
- });
+
+
+ function updateTodayButton() {
+ var today = new Date();
+ if (today >= currentView.start && today < currentView.end) {
+ header.disableButton('today');
+ }
+ else {
+ header.enableButton('today');
+ }
}
function getDate() {
return cloneDate(date);
}
+
+
+
+ /* Height "Freezing"
+ -----------------------------------------------------------------------------*/
+
+
+ function freezeContentHeight() {
+ content.css({
+ width: '100%',
+ height: content.height(),
+ overflow: 'hidden'
+ });
+ }
+
+
+ function unfreezeContentHeight() {
+ content.css({
+ width: '',
+ height: '',
+ overflow: ''
+ });
+ }
}
+;;
+
function Header(calendar, options) {
var t = this;
var text = smartProperty(options.buttonText, buttonName); // why are we using smartProperty here?
var button = $(
"<span class='fc-button fc-button-" + buttonName + " " + tm + "-state-default'>" +
- "<span class='fc-button-inner'>" +
- "<span class='fc-button-content'>" +
- (icon ?
- "<span class='fc-icon-wrap'>" +
- "<span class='ui-icon ui-icon-" + icon + "'/>" +
- "</span>" :
- text
- ) +
- "</span>" +
- "<span class='fc-button-effect'><span></span></span>" +
- "</span>" +
+ (icon ?
+ "<span class='fc-icon-wrap'>" +
+ "<span class='ui-icon ui-icon-" + icon + "'/>" +
+ "</span>" :
+ text
+ ) +
"</span>"
- );
- if (button) {
- button
- .click(function() {
- if (!button.hasClass(tm + '-state-disabled')) {
- buttonClick();
- }
- })
- .mousedown(function() {
+ )
+ .click(function() {
+ if (!button.hasClass(tm + '-state-disabled')) {
+ buttonClick();
+ }
+ })
+ .mousedown(function() {
+ button
+ .not('.' + tm + '-state-active')
+ .not('.' + tm + '-state-disabled')
+ .addClass(tm + '-state-down');
+ })
+ .mouseup(function() {
+ button.removeClass(tm + '-state-down');
+ })
+ .hover(
+ function() {
button
.not('.' + tm + '-state-active')
.not('.' + tm + '-state-disabled')
- .addClass(tm + '-state-down');
- })
- .mouseup(function() {
- button.removeClass(tm + '-state-down');
- })
- .hover(
- function() {
- button
- .not('.' + tm + '-state-active')
- .not('.' + tm + '-state-disabled')
- .addClass(tm + '-state-hover');
- },
- function() {
- button
- .removeClass(tm + '-state-hover')
- .removeClass(tm + '-state-down');
- }
- )
- .appendTo(e);
- if (!prevButton) {
- button.addClass(tm + '-corner-left');
- }
- prevButton = button;
+ .addClass(tm + '-state-hover');
+ },
+ function() {
+ button
+ .removeClass(tm + '-state-hover')
+ .removeClass(tm + '-state-down');
+ }
+ )
+ .appendTo(e);
+ disableTextSelection(button);
+ if (!prevButton) {
+ button.addClass(tm + '-corner-left');
}
+ prevButton = button;
}
}
});
}
+;;
+
fc.sourceNormalizers = [];
fc.sourceFetchers = [];
_fetchEventSource(source, function(events) {
if (fetchID == currentFetchID) {
if (events) {
+
+ if (options.eventDataTransform) {
+ events = $.map(events, options.eventDataTransform);
+ }
+ if (source.eventDataTransform) {
+ events = $.map(events, source.eventDataTransform);
+ }
+ // TODO: this technique is not ideal for static array event sources.
+ // For arrays, we'll want to process all events right in the beginning, then never again.
+
for (var i=0; i<events.length; i++) {
events[i].source = source;
normalizeEvent(events[i]);
var success = source.success;
var error = source.error;
var complete = source.complete;
- var data = $.extend({}, source.data || {});
+
+ // retrieve any outbound GET/POST $.ajax data from the options
+ var customData;
+ if ($.isFunction(source.data)) {
+ // supplied as a function that returns a key/value object
+ customData = source.data();
+ }
+ else {
+ // supplied as a straight key/value object
+ customData = source.data;
+ }
+
+ // use a copy of the custom data so we can modify the parameters
+ // and not affect the passed-in object.
+ var data = $.extend({}, customData || {});
+
var startParam = firstDefined(source.startParam, options.startParam);
var endParam = firstDefined(source.endParam, options.endParam);
if (startParam) {
if (endParam) {
data[endParam] = Math.round(+rangeEnd / 1000);
}
+
pushLoading();
$.ajax($.extend({}, ajaxDefaults, source, {
data: data,
e.className = event.className;
e.editable = event.editable;
e.color = event.color;
- e.backgroudColor = event.backgroudColor;
+ e.backgroundColor = event.backgroundColor;
e.borderColor = event.borderColor;
e.textColor = event.textColor;
normalizeEvent(e);
function pushLoading() {
if (!loadingLevel++) {
- trigger('loading', null, true);
+ trigger('loading', null, true, getView());
}
}
function popLoading() {
if (!--loadingLevel) {
- trigger('loading', null, false);
+ trigger('loading', null, false, getView());
}
}
}
+;;
+
fc.addDays = addDays;
fc.cloneDate = cloneDate;
}
-function skipWeekend(date, inc, excl) {
- inc = inc || 1;
- while (!date.getDay() || (excl && date.getDay()==1 || !excl && date.getDay()==6)) {
- addDays(date, inc);
- }
- return date;
-}
-
-
function dayDiff(d1, d2) { // d1 - d2
return Math.round((cloneDate(d1, true) - cloneDate(d2, true)) / DAY_MS);
}
return 'th';
}
return ['st', 'nd', 'rd'][date%10-1] || 'th';
+ },
+ w : function(d, o) { // local
+ return o.weekNumberCalculation(d);
+ },
+ W : function(d) { // ISO
+ return iso8601Week(d);
}
};
+fc.dateFormatters = dateFormatters;
+
+
+/* thanks jQuery UI (https://github.com/jquery/jquery-ui/blob/master/ui/jquery.ui.datepicker.js)
+ *
+ * Set as calculateWeek to determine the week of the year based on the ISO 8601 definition.
+ * `date` - the date to get the week for
+ * `number` - the number of the week within the year that contains this date
+ */
+function iso8601Week(date) {
+ var time;
+ var checkDate = new Date(date.getTime());
+ // Find Thursday of this week starting on Monday
+ checkDate.setDate(checkDate.getDate() + 4 - (checkDate.getDay() || 7));
+
+ time = checkDate.getTime();
+ checkDate.setMonth(0); // Compare with Jan 1
+ checkDate.setDate(1);
+ return Math.floor(Math.round((time - checkDate) / 86400000) / 7) + 1;
+}
+;;
+
fc.applyAll = applyAll;
function _exclEndDay(end, allDay) {
end = cloneDate(end);
return allDay || end.getHours() || end.getMinutes() ? addDays(end, 1) : clearTime(end);
-}
-
-
-function segCmp(a, b) {
- return (b.msLength - a.msLength) * 100 + (a.event.start - b.event.start);
-}
-
-
-function segsCollide(seg1, seg2) {
- return seg1.end > seg2.start && seg1.start < seg2.end;
-}
-
-
-
-/* Event Sorting
------------------------------------------------------------------------------*/
-
-
-// event rendering utilities
-function sliceSegs(events, visEventEnds, start, end) {
- var segs = [],
- i, len=events.length, event,
- eventStart, eventEnd,
- segStart, segEnd,
- isStart, isEnd;
- for (i=0; i<len; i++) {
- event = events[i];
- eventStart = event.start;
- eventEnd = visEventEnds[i];
- if (eventEnd > start && eventStart < end) {
- if (eventStart < start) {
- segStart = cloneDate(start);
- isStart = false;
- }else{
- segStart = eventStart;
- isStart = true;
- }
- if (eventEnd > end) {
- segEnd = cloneDate(end);
- isEnd = false;
- }else{
- segEnd = eventEnd;
- isEnd = true;
- }
- segs.push({
- event: event,
- start: segStart,
- end: segEnd,
- isStart: isStart,
- isEnd: isEnd,
- msLength: segEnd - segStart
- });
- }
- }
- return segs.sort(segCmp);
-}
-
-
-// event rendering calculation utilities
-function stackSegs(segs) {
- var levels = [],
- i, len = segs.length, seg,
- j, collide, k;
- for (i=0; i<len; i++) {
- seg = segs[i];
- j = 0; // the level index where seg should belong
- while (true) {
- collide = false;
- if (levels[j]) {
- for (k=0; k<levels[j].length; k++) {
- if (segsCollide(levels[j][k], seg)) {
- collide = true;
- break;
- }
- }
- }
- if (collide) {
- j++;
- }else{
- break;
- }
- }
- if (levels[j]) {
- levels[j].push(seg);
- }else{
- levels[j] = [seg];
- }
- }
- return levels;
+ // why don't we check for seconds/ms too?
}
}
-// TODO: curCSS has been deprecated (jQuery 1.4.3 - 10/16/2010)
-
-
function hsides(element, includeMargins) {
return hpadding(element) + hborders(element) + (includeMargins ? hmargins(element) : 0);
}
function hpadding(element) {
- return (parseFloat($.curCSS(element[0], 'paddingLeft', true)) || 0) +
- (parseFloat($.curCSS(element[0], 'paddingRight', true)) || 0);
+ return (parseFloat($.css(element[0], 'paddingLeft', true)) || 0) +
+ (parseFloat($.css(element[0], 'paddingRight', true)) || 0);
}
function hmargins(element) {
- return (parseFloat($.curCSS(element[0], 'marginLeft', true)) || 0) +
- (parseFloat($.curCSS(element[0], 'marginRight', true)) || 0);
+ return (parseFloat($.css(element[0], 'marginLeft', true)) || 0) +
+ (parseFloat($.css(element[0], 'marginRight', true)) || 0);
}
function hborders(element) {
- return (parseFloat($.curCSS(element[0], 'borderLeftWidth', true)) || 0) +
- (parseFloat($.curCSS(element[0], 'borderRightWidth', true)) || 0);
+ return (parseFloat($.css(element[0], 'borderLeftWidth', true)) || 0) +
+ (parseFloat($.css(element[0], 'borderRightWidth', true)) || 0);
}
function vpadding(element) {
- return (parseFloat($.curCSS(element[0], 'paddingTop', true)) || 0) +
- (parseFloat($.curCSS(element[0], 'paddingBottom', true)) || 0);
+ return (parseFloat($.css(element[0], 'paddingTop', true)) || 0) +
+ (parseFloat($.css(element[0], 'paddingBottom', true)) || 0);
}
function vmargins(element) {
- return (parseFloat($.curCSS(element[0], 'marginTop', true)) || 0) +
- (parseFloat($.curCSS(element[0], 'marginBottom', true)) || 0);
+ return (parseFloat($.css(element[0], 'marginTop', true)) || 0) +
+ (parseFloat($.css(element[0], 'marginBottom', true)) || 0);
}
function vborders(element) {
- return (parseFloat($.curCSS(element[0], 'borderTopWidth', true)) || 0) +
- (parseFloat($.curCSS(element[0], 'borderBottomWidth', true)) || 0);
-}
-
-
-function setMinHeight(element, height) {
- height = (typeof height == 'number' ? height + 'px' : height);
- element.each(function(i, _element) {
- _element.style.cssText += ';min-height:' + height + ';_height:' + height;
- // why can't we just use .css() ? i forget
- });
+ return (parseFloat($.css(element[0], 'borderTopWidth', true)) || 0) +
+ (parseFloat($.css(element[0], 'borderBottomWidth', true)) || 0);
}
function noop() { }
-function cmp(a, b) {
+function dateCompare(a, b) {
return a - b;
}
}
-function cssKey(_element) {
- return _element.id + '/' + _element.className + '/' + _element.style.cssText.replace(/(^|;)\s*(top|left|width|height)\s*:[^;]*/ig, '');
-}
-
-
function disableTextSelection(element) {
element
.attr('unselectable', 'on')
}
+;;
fcViews.month = MonthView;
BasicView.call(t, element, calendar, 'month');
var opt = t.opt;
var renderBasic = t.renderBasic;
+ var skipHiddenDays = t.skipHiddenDays;
+ var getCellsPerWeek = t.getCellsPerWeek;
var formatDate = calendar.formatDate;
-
function render(date, delta) {
+
if (delta) {
addMonths(date, delta);
date.setDate(1);
}
+
+ var firstDay = opt('firstDay');
+
var start = cloneDate(date, true);
start.setDate(1);
+
var end = addMonths(cloneDate(start), 1);
+
var visStart = cloneDate(start);
+ addDays(visStart, -((visStart.getDay() - firstDay + 7) % 7));
+ skipHiddenDays(visStart);
+
var visEnd = cloneDate(end);
- var firstDay = opt('firstDay');
- var nwe = opt('weekends') ? 0 : 1;
- if (nwe) {
- skipWeekend(visStart);
- skipWeekend(visEnd, -1, true);
- }
- addDays(visStart, -((visStart.getDay() - Math.max(firstDay, nwe) + 7) % 7));
- addDays(visEnd, (7 - visEnd.getDay() + Math.max(firstDay, nwe)) % 7);
- var rowCnt = Math.round((visEnd - visStart) / (DAY_MS * 7));
+ addDays(visEnd, (7 - visEnd.getDay() + firstDay) % 7);
+ skipHiddenDays(visEnd, -1, true);
+
+ var colCnt = getCellsPerWeek();
+ var rowCnt = Math.round(dayDiff(visEnd, visStart) / 7); // should be no need for Math.round
+
if (opt('weekMode') == 'fixed') {
- addDays(visEnd, (6 - rowCnt) * 7);
+ addDays(visEnd, (6 - rowCnt) * 7); // add weeks to make up for it
rowCnt = 6;
}
+
t.title = formatDate(start, opt('titleFormat'));
+
t.start = start;
t.end = end;
t.visStart = visStart;
t.visEnd = visEnd;
- renderBasic(6, rowCnt, nwe ? 5 : 7, true);
+
+ renderBasic(rowCnt, colCnt, true);
}
}
+;;
+
fcViews.basicWeek = BasicWeekView;
function BasicWeekView(element, calendar) {
BasicView.call(t, element, calendar, 'basicWeek');
var opt = t.opt;
var renderBasic = t.renderBasic;
+ var skipHiddenDays = t.skipHiddenDays;
+ var getCellsPerWeek = t.getCellsPerWeek;
var formatDates = calendar.formatDates;
-
function render(date, delta) {
+
if (delta) {
addDays(date, delta * 7);
}
+
var start = addDays(cloneDate(date), -((date.getDay() - opt('firstDay') + 7) % 7));
var end = addDays(cloneDate(start), 7);
+
var visStart = cloneDate(start);
+ skipHiddenDays(visStart);
+
var visEnd = cloneDate(end);
- var weekends = opt('weekends');
- if (!weekends) {
- skipWeekend(visStart);
- skipWeekend(visEnd, -1, true);
- }
- t.title = formatDates(
- visStart,
- addDays(cloneDate(visEnd), -1),
- opt('titleFormat')
- );
+ skipHiddenDays(visEnd, -1, true);
+
+ var colCnt = getCellsPerWeek();
+
t.start = start;
t.end = end;
t.visStart = visStart;
t.visEnd = visEnd;
- renderBasic(1, 1, weekends ? 7 : 5, false);
+
+ t.title = formatDates(
+ visStart,
+ addDays(cloneDate(visEnd), -1),
+ opt('titleFormat')
+ );
+
+ renderBasic(1, colCnt, false);
}
}
-fcViews.basicDay = BasicDayView;
+;;
-//TODO: when calendar's date starts out on a weekend, shouldn't happen
+fcViews.basicDay = BasicDayView;
function BasicDayView(element, calendar) {
BasicView.call(t, element, calendar, 'basicDay');
var opt = t.opt;
var renderBasic = t.renderBasic;
+ var skipHiddenDays = t.skipHiddenDays;
var formatDate = calendar.formatDate;
-
function render(date, delta) {
+
if (delta) {
addDays(date, delta);
- if (!opt('weekends')) {
- skipWeekend(date, delta < 0 ? -1 : 1);
- }
}
+ skipHiddenDays(date, delta < 0 ? -1 : 1);
+
+ var start = cloneDate(date, true);
+ var end = addDays(cloneDate(start), 1);
+
t.title = formatDate(date, opt('titleFormat'));
- t.start = t.visStart = cloneDate(date, true);
- t.end = t.visEnd = addDays(cloneDate(t.start), 1);
- renderBasic(1, 1, 1, false);
+
+ t.start = t.visStart = start;
+ t.end = t.visEnd = end;
+
+ renderBasic(1, 1, false);
}
}
+;;
+
setDefaults({
weekMode: 'fixed'
});
t.dragStop = dragStop;
t.defaultEventEnd = defaultEventEnd;
t.getHoverListener = function() { return hoverListener };
+ t.colLeft = colLeft;
+ t.colRight = colRight;
t.colContentLeft = colContentLeft;
t.colContentRight = colContentRight;
- t.dayOfWeekCol = dayOfWeekCol;
- t.dateCell = dateCell;
- t.cellDate = cellDate;
- t.cellIsAllDay = function() { return true };
+ t.getIsCellAllDay = function() { return true };
t.allDayRow = allDayRow;
- t.allDayBounds = allDayBounds;
t.getRowCnt = function() { return rowCnt };
t.getColCnt = function() { return colCnt };
t.getColWidth = function() { return colWidth };
BasicEventRenderer.call(t);
var opt = t.opt;
var trigger = t.trigger;
- var clearEvents = t.clearEvents;
var renderOverlay = t.renderOverlay;
var clearOverlays = t.clearOverlays;
var daySelectionMousedown = t.daySelectionMousedown;
+ var cellToDate = t.cellToDate;
+ var dateToCell = t.dateToCell;
+ var rangeToSegments = t.rangeToSegments;
var formatDate = calendar.formatDate;
// locals
+ var table;
var head;
var headCells;
var body;
var bodyRows;
var bodyCells;
var bodyFirstCells;
- var bodyCellTopInners;
+ var firstRowCellInners;
+ var firstRowCellContentInners;
var daySegmentContainer;
var viewWidth;
var viewHeight;
var colWidth;
+ var weekNumberWidth;
var rowCnt, colCnt;
+ var showNumbers;
var coordinateGrid;
var hoverListener;
+ var colPositions;
var colContentPositions;
- var rtl, dis, dit;
- var firstDay;
- var nwe;
var tm;
var colFormat;
+ var showWeekNumbers;
+ var weekNumberTitle;
+ var weekNumberFormat;
disableTextSelection(element.addClass('fc-grid'));
- function renderBasic(maxr, r, c, showNumbers) {
- rowCnt = r;
- colCnt = c;
+ function renderBasic(_rowCnt, _colCnt, _showNumbers) {
+ rowCnt = _rowCnt;
+ colCnt = _colCnt;
+ showNumbers = _showNumbers;
updateOptions();
- var firstTime = !body;
- if (firstTime) {
- buildSkeleton(maxr, showNumbers);
- }else{
- clearEvents();
+
+ if (!body) {
+ buildEventContainer();
}
- updateCells(firstTime);
+
+ buildTable();
}
-
function updateOptions() {
- rtl = opt('isRTL');
- if (rtl) {
- dis = -1;
- dit = colCnt - 1;
- }else{
- dis = 1;
- dit = 0;
- }
- firstDay = opt('firstDay');
- nwe = opt('weekends') ? 0 : 1;
tm = opt('theme') ? 'ui' : 'fc';
colFormat = opt('columnFormat');
+
+ // week # options. (TODO: bad, logic also in other views)
+ showWeekNumbers = opt('weekNumbers');
+ weekNumberTitle = opt('weekNumberTitle');
+ if (opt('weekNumberCalculation') != 'iso') {
+ weekNumberFormat = "w";
+ }
+ else {
+ weekNumberFormat = "W";
+ }
}
+ function buildEventContainer() {
+ daySegmentContainer =
+ $("<div class='fc-event-container' style='position:absolute;z-index:8;top:0;left:0'/>")
+ .appendTo(element);
+ }
- function buildSkeleton(maxRowCnt, showNumbers) {
- var s;
- var headerClass = tm + "-widget-header";
- var contentClass = tm + "-widget-content";
- var i, j;
- var table;
-
- s =
- "<table class='fc-border-separate' style='width:100%' cellspacing='0'>" +
- "<thead>" +
- "<tr>";
- for (i=0; i<colCnt; i++) {
- s +=
- "<th class='fc- " + headerClass + "'/>"; // need fc- for setDayID
- }
- s +=
- "</tr>" +
- "</thead>" +
- "<tbody>";
- for (i=0; i<maxRowCnt; i++) {
- s +=
- "<tr class='fc-week" + i + "'>";
- for (j=0; j<colCnt; j++) {
- s +=
- "<td class='fc- " + contentClass + " fc-day" + (i*colCnt+j) + "'>" + // need fc- for setDayID
- "<div>" +
- (showNumbers ?
- "<div class='fc-day-number'/>" :
- ''
- ) +
- "<div class='fc-day-content'>" +
- "<div style='position:relative'> </div>" +
- "</div>" +
- "</div>" +
- "</td>";
- }
- s +=
- "</tr>";
+
+ function buildTable() {
+ var html = buildTableHTML();
+
+ if (table) {
+ table.remove();
}
- s +=
- "</tbody>" +
- "</table>";
- table = $(s).appendTo(element);
-
+ table = $(html).appendTo(element);
+
head = table.find('thead');
- headCells = head.find('th');
+ headCells = head.find('.fc-day-header');
body = table.find('tbody');
bodyRows = body.find('tr');
- bodyCells = body.find('td');
- bodyFirstCells = bodyCells.filter(':first-child');
- bodyCellTopInners = bodyRows.eq(0).find('div.fc-day-content div');
+ bodyCells = body.find('.fc-day');
+ bodyFirstCells = bodyRows.find('td:first-child');
+
+ firstRowCellInners = bodyRows.eq(0).find('.fc-day > div');
+ firstRowCellContentInners = bodyRows.eq(0).find('.fc-day-content > div');
markFirstLast(head.add(head.find('tr'))); // marks first+last tr/th's
markFirstLast(bodyRows); // marks first+last td's
- bodyRows.eq(0).addClass('fc-first'); // fc-last is done in updateCells
-
+ bodyRows.eq(0).addClass('fc-first');
+ bodyRows.filter(':last').addClass('fc-last');
+
+ bodyCells.each(function(i, _cell) {
+ var date = cellToDate(
+ Math.floor(i / colCnt),
+ i % colCnt
+ );
+ trigger('dayRender', t, date, $(_cell));
+ });
+
dayBind(bodyCells);
-
- daySegmentContainer =
- $("<div style='position:absolute;z-index:8;top:0;left:0'/>")
- .appendTo(element);
}
-
-
-
- function updateCells(firstTime) {
- var dowDirty = firstTime || rowCnt == 1; // could the cells' day-of-weeks need updating?
- var month = t.start.getMonth();
- var today = clearTime(new Date());
- var cell;
+
+
+
+ /* HTML Building
+ -----------------------------------------------------------*/
+
+
+ function buildTableHTML() {
+ var html =
+ "<table class='fc-border-separate' style='width:100%' cellspacing='0'>" +
+ buildHeadHTML() +
+ buildBodyHTML() +
+ "</table>";
+
+ return html;
+ }
+
+
+ function buildHeadHTML() {
+ var headerClass = tm + "-widget-header";
+ var html = '';
+ var col;
var date;
- var row;
-
- if (dowDirty) {
- headCells.each(function(i, _cell) {
- cell = $(_cell);
- date = indexDate(i);
- cell.html(formatDate(date, colFormat));
- setDayID(cell, date);
- });
+
+ html += "<thead><tr>";
+
+ if (showWeekNumbers) {
+ html +=
+ "<th class='fc-week-number " + headerClass + "'>" +
+ htmlEscape(weekNumberTitle) +
+ "</th>";
}
-
- bodyCells.each(function(i, _cell) {
- cell = $(_cell);
- date = indexDate(i);
- if (date.getMonth() == month) {
- cell.removeClass('fc-other-month');
- }else{
- cell.addClass('fc-other-month');
- }
- if (+date == +today) {
- cell.addClass(tm + '-state-highlight fc-today');
- }else{
- cell.removeClass(tm + '-state-highlight fc-today');
- }
- cell.find('div.fc-day-number').text(date.getDate());
- if (dowDirty) {
- setDayID(cell, date);
+
+ for (col=0; col<colCnt; col++) {
+ date = cellToDate(0, col);
+ html +=
+ "<th class='fc-day-header fc-" + dayIDs[date.getDay()] + " " + headerClass + "'>" +
+ htmlEscape(formatDate(date, colFormat)) +
+ "</th>";
+ }
+
+ html += "</tr></thead>";
+
+ return html;
+ }
+
+
+ function buildBodyHTML() {
+ var contentClass = tm + "-widget-content";
+ var html = '';
+ var row;
+ var col;
+ var date;
+
+ html += "<tbody>";
+
+ for (row=0; row<rowCnt; row++) {
+
+ html += "<tr class='fc-week'>";
+
+ if (showWeekNumbers) {
+ date = cellToDate(row, 0);
+ html +=
+ "<td class='fc-week-number " + contentClass + "'>" +
+ "<div>" +
+ htmlEscape(formatDate(date, weekNumberFormat)) +
+ "</div>" +
+ "</td>";
}
- });
-
- bodyRows.each(function(i, _row) {
- row = $(_row);
- if (i < rowCnt) {
- row.show();
- if (i == rowCnt-1) {
- row.addClass('fc-last');
- }else{
- row.removeClass('fc-last');
- }
- }else{
- row.hide();
+
+ for (col=0; col<colCnt; col++) {
+ date = cellToDate(row, col);
+ html += buildCellHTML(date);
}
- });
+
+ html += "</tr>";
+ }
+
+ html += "</tbody>";
+
+ return html;
}
-
+
+
+ function buildCellHTML(date) {
+ var contentClass = tm + "-widget-content";
+ var month = t.start.getMonth();
+ var today = clearTime(new Date());
+ var html = '';
+ var classNames = [
+ 'fc-day',
+ 'fc-' + dayIDs[date.getDay()],
+ contentClass
+ ];
+
+ if (date.getMonth() != month) {
+ classNames.push('fc-other-month');
+ }
+ if (+date == +today) {
+ classNames.push(
+ 'fc-today',
+ tm + '-state-highlight'
+ );
+ }
+ else if (date < today) {
+ classNames.push('fc-past');
+ }
+ else {
+ classNames.push('fc-future');
+ }
+
+ html +=
+ "<td" +
+ " class='" + classNames.join(' ') + "'" +
+ " data-date='" + formatDate(date, 'yyyy-MM-dd') + "'" +
+ ">" +
+ "<div>";
+
+ if (showNumbers) {
+ html += "<div class='fc-day-number'>" + date.getDate() + "</div>";
+ }
+
+ html +=
+ "<div class='fc-day-content'>" +
+ "<div style='position:relative'> </div>" +
+ "</div>" +
+ "</div>" +
+ "</td>";
+
+ return html;
+ }
+
+
+
+ /* Dimensions
+ -----------------------------------------------------------*/
function setHeight(height) {
bodyFirstCells.each(function(i, _cell) {
if (i < rowCnt) {
cell = $(_cell);
- setMinHeight(
- cell.find('> div'),
+ cell.find('> div').css(
+ 'min-height',
(i==rowCnt-1 ? rowHeightLast : rowHeight) - vsides(cell)
);
}
function setWidth(width) {
viewWidth = width;
+ colPositions.clear();
colContentPositions.clear();
- colWidth = Math.floor(viewWidth / colCnt);
+
+ weekNumberWidth = 0;
+ if (showWeekNumbers) {
+ weekNumberWidth = head.find('th.fc-week-number').outerWidth();
+ }
+
+ colWidth = Math.floor((viewWidth - weekNumberWidth) / colCnt);
setOuterWidth(headCells.slice(0, -1), colWidth);
}
function dayClick(ev) {
if (!opt('selectable')) { // if selectable, SelectionManager will worry about dayClick
- var index = parseInt(this.className.match(/fc\-day(\d+)/)[1]); // TODO: maybe use .data
- var date = indexDate(index);
+ var date = parseISO8601($(this).data('date'));
trigger('dayClick', this, date, true, ev);
}
}
/* Semi-transparent Overlay Helpers
------------------------------------------------------*/
-
-
+ // TODO: should be consolidated with AgendaView's methods
+
+
function renderDayOverlay(overlayStart, overlayEnd, refreshCoordinateGrid) { // overlayEnd is exclusive
+
if (refreshCoordinateGrid) {
coordinateGrid.build();
}
- var rowStart = cloneDate(t.visStart);
- var rowEnd = addDays(cloneDate(rowStart), colCnt);
- for (var i=0; i<rowCnt; i++) {
- var stretchStart = new Date(Math.max(rowStart, overlayStart));
- var stretchEnd = new Date(Math.min(rowEnd, overlayEnd));
- if (stretchStart < stretchEnd) {
- var colStart, colEnd;
- if (rtl) {
- colStart = dayDiff(stretchEnd, rowStart)*dis+dit+1;
- colEnd = dayDiff(stretchStart, rowStart)*dis+dit+1;
- }else{
- colStart = dayDiff(stretchStart, rowStart);
- colEnd = dayDiff(stretchEnd, rowStart);
- }
- dayBind(
- renderCellOverlay(i, colStart, i, colEnd-1)
- );
- }
- addDays(rowStart, 7);
- addDays(rowEnd, 7);
+
+ var segments = rangeToSegments(overlayStart, overlayEnd);
+
+ for (var i=0; i<segments.length; i++) {
+ var segment = segments[i];
+ dayBind(
+ renderCellOverlay(
+ segment.row,
+ segment.leftCol,
+ segment.row,
+ segment.rightCol
+ )
+ );
}
}
-
+
function renderCellOverlay(row0, col0, row1, col1) { // row1,col1 is inclusive
var rect = coordinateGrid.rect(row0, col0, row1, col1, element);
function reportDayClick(date, allDay, ev) {
- var cell = dateCell(date);
+ var cell = dateToCell(date);
var _element = bodyCells[cell.row*colCnt + cell.col];
trigger('dayClick', _element, date, allDay, ev);
}
var cell = hoverListener.stop();
clearOverlays();
if (cell) {
- var d = cellDate(cell);
+ var d = cellToDate(cell);
trigger('drop', _dragElement, d, true, ev, ui);
}
}
hoverListener = new HoverListener(coordinateGrid);
-
+ colPositions = new HorizontalPositionCache(function(col) {
+ return firstRowCellInners.eq(col);
+ });
+
colContentPositions = new HorizontalPositionCache(function(col) {
- return bodyCellTopInners.eq(col);
+ return firstRowCellContentInners.eq(col);
});
+
+
+ function colLeft(col) {
+ return colPositions.left(col);
+ }
+
+
+ function colRight(col) {
+ return colPositions.right(col);
+ }
function colContentLeft(col) {
}
-
-
- function dateCell(date) {
- return {
- row: Math.floor(dayDiff(date, t.visStart) / 7),
- col: dayOfWeekCol(date.getDay())
- };
- }
-
-
- function cellDate(cell) {
- return _cellDate(cell.row, cell.col);
- }
-
-
- function _cellDate(row, col) {
- return addDays(cloneDate(t.visStart), row*7 + col*dis+dit);
- // what about weekends in middle of week?
- }
-
-
- function indexDate(index) {
- return _cellDate(Math.floor(index/colCnt), index%colCnt);
- }
-
-
- function dayOfWeekCol(dayOfWeek) {
- return ((dayOfWeek - Math.max(firstDay, nwe) + colCnt) % colCnt) * dis + dit;
- }
-
-
-
-
function allDayRow(i) {
return bodyRows.eq(i);
}
-
- function allDayBounds(i) {
- return {
- left: 0,
- right: viewWidth
- };
- }
-
-
}
+;;
+
function BasicEventRenderer() {
var t = this;
// exports
t.renderEvents = renderEvents;
- t.compileDaySegs = compileSegs; // for DayEventRenderer
t.clearEvents = clearEvents;
- t.bindDaySeg = bindDaySeg;
-
+
// imports
DayEventRenderer.call(t);
- var opt = t.opt;
- var trigger = t.trigger;
- //var setOverflowHidden = t.setOverflowHidden;
- var isEventDraggable = t.isEventDraggable;
- var isEventResizable = t.isEventResizable;
- var reportEvents = t.reportEvents;
- var reportEventClear = t.reportEventClear;
- var eventElementHandlers = t.eventElementHandlers;
- var showEvents = t.showEvents;
- var hideEvents = t.hideEvents;
- var eventDrop = t.eventDrop;
- var getDaySegmentContainer = t.getDaySegmentContainer;
- var getHoverListener = t.getHoverListener;
- var renderDayOverlay = t.renderDayOverlay;
- var clearOverlays = t.clearOverlays;
- var getRowCnt = t.getRowCnt;
- var getColCnt = t.getColCnt;
- var renderDaySegs = t.renderDaySegs;
- var resizableDayEvent = t.resizableDayEvent;
-
-
-
- /* Rendering
- --------------------------------------------------------------------*/
-
+
function renderEvents(events, modifiedEventId) {
- reportEvents(events);
- renderDaySegs(compileSegs(events), modifiedEventId);
+ t.renderDayEvents(events, modifiedEventId);
}
function clearEvents() {
- reportEventClear();
- getDaySegmentContainer().empty();
- }
-
-
- function compileSegs(events) {
- var rowCnt = getRowCnt(),
- colCnt = getColCnt(),
- d1 = cloneDate(t.visStart),
- d2 = addDays(cloneDate(d1), colCnt),
- visEventsEnds = $.map(events, exclEndDay),
- i, row,
- j, level,
- k, seg,
- segs=[];
- for (i=0; i<rowCnt; i++) {
- row = stackSegs(sliceSegs(events, visEventsEnds, d1, d2));
- for (j=0; j<row.length; j++) {
- level = row[j];
- for (k=0; k<level.length; k++) {
- seg = level[k];
- seg.row = i;
- seg.level = j; // not needed anymore
- segs.push(seg);
- }
- }
- addDays(d1, 7);
- addDays(d2, 7);
- }
- return segs;
- }
-
-
- function bindDaySeg(event, eventElement, seg) {
- if (isEventDraggable(event)) {
- draggableDayEvent(event, eventElement);
- }
- if (seg.isEnd && isEventResizable(event)) {
- resizableDayEvent(event, eventElement, seg);
- }
- eventElementHandlers(event, eventElement);
- // needs to be after, because resizableDayEvent might stopImmediatePropagation on click
- }
-
-
-
- /* Dragging
- ----------------------------------------------------------------------------*/
-
-
- function draggableDayEvent(event, eventElement) {
- var hoverListener = getHoverListener();
- var dayDelta;
- eventElement.draggable({
- zIndex: 9,
- delay: 50,
- opacity: opt('dragOpacity'),
- revertDuration: opt('dragRevertDuration'),
- start: function(ev, ui) {
- trigger('eventDragStart', eventElement, event, ev, ui);
- hideEvents(event, eventElement);
- hoverListener.start(function(cell, origCell, rowDelta, colDelta) {
- eventElement.draggable('option', 'revert', !cell || !rowDelta && !colDelta);
- clearOverlays();
- if (cell) {
- //setOverflowHidden(true);
- dayDelta = rowDelta*7 + colDelta * (opt('isRTL') ? -1 : 1);
- renderDayOverlay(
- addDays(cloneDate(event.start), dayDelta),
- addDays(exclEndDay(event), dayDelta)
- );
- }else{
- //setOverflowHidden(false);
- dayDelta = 0;
- }
- }, ev, 'drag');
- },
- stop: function(ev, ui) {
- hoverListener.stop();
- clearOverlays();
- trigger('eventDragStop', eventElement, event, ev, ui);
- if (dayDelta) {
- eventDrop(this, event, dayDelta, 0, event.allDay, ev, ui);
- }else{
- eventElement.css('filter', ''); // clear IE opacity side-effects
- showEvents(event, eventElement);
- }
- //setOverflowHidden(false);
- }
- });
+ t.getDaySegmentContainer().empty();
}
+ // TODO: have this class (and AgendaEventRenderer) be responsible for creating the event container div
+
}
+;;
+
fcViews.agendaWeek = AgendaWeekView;
function AgendaWeekView(element, calendar) {
AgendaView.call(t, element, calendar, 'agendaWeek');
var opt = t.opt;
var renderAgenda = t.renderAgenda;
+ var skipHiddenDays = t.skipHiddenDays;
+ var getCellsPerWeek = t.getCellsPerWeek;
var formatDates = calendar.formatDates;
-
-
+
function render(date, delta) {
+
if (delta) {
addDays(date, delta * 7);
}
+
var start = addDays(cloneDate(date), -((date.getDay() - opt('firstDay') + 7) % 7));
var end = addDays(cloneDate(start), 7);
+
var visStart = cloneDate(start);
+ skipHiddenDays(visStart);
+
var visEnd = cloneDate(end);
- var weekends = opt('weekends');
- if (!weekends) {
- skipWeekend(visStart);
- skipWeekend(visEnd, -1, true);
- }
+ skipHiddenDays(visEnd, -1, true);
+
+ var colCnt = getCellsPerWeek();
+
t.title = formatDates(
visStart,
addDays(cloneDate(visEnd), -1),
opt('titleFormat')
);
+
t.start = start;
t.end = end;
t.visStart = visStart;
t.visEnd = visEnd;
- renderAgenda(weekends ? 7 : 5);
+
+ renderAgenda(colCnt);
}
-
}
+;;
+
fcViews.agendaDay = AgendaDayView;
+
function AgendaDayView(element, calendar) {
var t = this;
AgendaView.call(t, element, calendar, 'agendaDay');
var opt = t.opt;
var renderAgenda = t.renderAgenda;
+ var skipHiddenDays = t.skipHiddenDays;
var formatDate = calendar.formatDate;
-
function render(date, delta) {
+
if (delta) {
addDays(date, delta);
- if (!opt('weekends')) {
- skipWeekend(date, delta < 0 ? -1 : 1);
- }
}
+ skipHiddenDays(date, delta < 0 ? -1 : 1);
+
var start = cloneDate(date, true);
var end = addDays(cloneDate(start), 1);
+
t.title = formatDate(date, opt('titleFormat'));
+
t.start = t.visStart = start;
t.end = t.visEnd = end;
+
renderAgenda(1);
}
}
+;;
+
setDefaults({
allDaySlot: true,
allDayText: 'all-day',
agenda: .5
},
minTime: 0,
- maxTime: 24
+ maxTime: 24,
+ slotEventOverlap: true
});
t.renderAgenda = renderAgenda;
t.setWidth = setWidth;
t.setHeight = setHeight;
- t.beforeHide = beforeHide;
- t.afterShow = afterShow;
+ t.afterRender = afterRender;
t.defaultEventEnd = defaultEventEnd;
t.timePosition = timePosition;
- t.dayOfWeekCol = dayOfWeekCol;
- t.dateCell = dateCell;
- t.cellDate = cellDate;
- t.cellIsAllDay = cellIsAllDay;
+ t.getIsCellAllDay = getIsCellAllDay;
t.allDayRow = getAllDayRow;
- t.allDayBounds = allDayBounds;
+ t.getCoordinateGrid = function() { return coordinateGrid }; // specifically for AgendaEventRenderer
t.getHoverListener = function() { return hoverListener };
+ t.colLeft = colLeft;
+ t.colRight = colRight;
t.colContentLeft = colContentLeft;
t.colContentRight = colContentRight;
t.getDaySegmentContainer = function() { return daySegmentContainer };
t.getSlotSegmentContainer = function() { return slotSegmentContainer };
t.getMinMinute = function() { return minMinute };
t.getMaxMinute = function() { return maxMinute };
- t.getBodyContent = function() { return slotContent }; // !!??
+ t.getSlotContainer = function() { return slotContainer };
t.getRowCnt = function() { return 1 };
t.getColCnt = function() { return colCnt };
t.getColWidth = function() { return colWidth };
- t.getSlotHeight = function() { return slotHeight };
+ t.getSnapHeight = function() { return snapHeight };
+ t.getSnapMinutes = function() { return snapMinutes };
t.defaultSelectionEnd = defaultSelectionEnd;
t.renderDayOverlay = renderDayOverlay;
t.renderSelection = renderSelection;
AgendaEventRenderer.call(t);
var opt = t.opt;
var trigger = t.trigger;
- var clearEvents = t.clearEvents;
var renderOverlay = t.renderOverlay;
var clearOverlays = t.clearOverlays;
var reportSelection = t.reportSelection;
var unselect = t.unselect;
var daySelectionMousedown = t.daySelectionMousedown;
var slotSegHtml = t.slotSegHtml;
+ var cellToDate = t.cellToDate;
+ var dateToCell = t.dateToCell;
+ var rangeToSegments = t.rangeToSegments;
var formatDate = calendar.formatDate;
var dayBody;
var dayBodyCells;
var dayBodyCellInners;
+ var dayBodyCellContentInners;
var dayBodyFirstCell;
var dayBodyFirstCellStretcher;
var slotLayer;
var allDayTable;
var allDayRow;
var slotScroller;
- var slotContent;
+ var slotContainer;
var slotSegmentContainer;
var slotTable;
- var slotTableFirstInner;
- var axisFirstCells;
- var gutterCells;
var selectionHelper;
var viewWidth;
var colWidth;
var gutterWidth;
var slotHeight; // TODO: what if slotHeight changes? (see issue 650)
- var savedScrollTop;
+
+ var snapMinutes;
+ var snapRatio; // ratio of number of "selection" slots to normal slots. (ex: 1, 2, 4)
+ var snapHeight; // holds the pixel hight of a "selection" slot
var colCnt;
var slotCnt;
var coordinateGrid;
var hoverListener;
+ var colPositions;
var colContentPositions;
var slotTopCache = {};
var tm;
- var firstDay;
- var nwe; // no weekends (int)
- var rtl, dis, dit; // day index sign / translate
+ var rtl;
var minMinute, maxMinute;
var colFormat;
+ var showWeekNumbers;
+ var weekNumberTitle;
+ var weekNumberFormat;
function renderAgenda(c) {
colCnt = c;
updateOptions();
- if (!dayTable) {
- buildSkeleton();
- }else{
- clearEvents();
+
+ if (!dayTable) { // first time rendering?
+ buildSkeleton(); // builds day table, slot area, events containers
+ }
+ else {
+ buildDayTable(); // rebuilds day table
}
- updateCells();
}
-
function updateOptions() {
+
tm = opt('theme') ? 'ui' : 'fc';
- nwe = opt('weekends') ? 0 : 1;
- firstDay = opt('firstDay');
- if (rtl = opt('isRTL')) {
- dis = -1;
- dit = colCnt - 1;
- }else{
- dis = 1;
- dit = 0;
- }
+ rtl = opt('isRTL')
minMinute = parseTime(opt('minTime'));
maxMinute = parseTime(opt('maxTime'));
colFormat = opt('columnFormat');
+
+ // week # options. (TODO: bad, logic also in other views)
+ showWeekNumbers = opt('weekNumbers');
+ weekNumberTitle = opt('weekNumberTitle');
+ if (opt('weekNumberCalculation') != 'iso') {
+ weekNumberFormat = "w";
+ }
+ else {
+ weekNumberFormat = "W";
+ }
+
+ snapMinutes = opt('snapMinutes') || opt('slotMinutes');
}
-
-
-
+
+
+
+ /* Build DOM
+ -----------------------------------------------------------------------*/
+
+
function buildSkeleton() {
var headerClass = tm + "-widget-header";
var contentClass = tm + "-widget-content";
var s;
- var i;
var d;
+ var i;
var maxd;
var minutes;
var slotNormal = opt('slotMinutes') % 15 == 0;
- s =
- "<table style='width:100%' class='fc-agenda-days fc-border-separate' cellspacing='0'>" +
- "<thead>" +
- "<tr>" +
- "<th class='fc-agenda-axis " + headerClass + "'> </th>";
- for (i=0; i<colCnt; i++) {
- s +=
- "<th class='fc- fc-col" + i + ' ' + headerClass + "'/>"; // fc- needed for setDayID
- }
- s +=
- "<th class='fc-agenda-gutter " + headerClass + "'> </th>" +
- "</tr>" +
- "</thead>" +
- "<tbody>" +
- "<tr>" +
- "<th class='fc-agenda-axis " + headerClass + "'> </th>";
- for (i=0; i<colCnt; i++) {
- s +=
- "<td class='fc- fc-col" + i + ' ' + contentClass + "'>" + // fc- needed for setDayID
- "<div>" +
- "<div class='fc-day-content'>" +
- "<div style='position:relative'> </div>" +
- "</div>" +
- "</div>" +
- "</td>";
- }
- s +=
- "<td class='fc-agenda-gutter " + contentClass + "'> </td>" +
- "</tr>" +
- "</tbody>" +
- "</table>";
- dayTable = $(s).appendTo(element);
- dayHead = dayTable.find('thead');
- dayHeadCells = dayHead.find('th').slice(1, -1);
- dayBody = dayTable.find('tbody');
- dayBodyCells = dayBody.find('td').slice(0, -1);
- dayBodyCellInners = dayBodyCells.find('div.fc-day-content div');
- dayBodyFirstCell = dayBodyCells.eq(0);
- dayBodyFirstCellStretcher = dayBodyFirstCell.find('> div');
-
- markFirstLast(dayHead.add(dayHead.find('tr')));
- markFirstLast(dayBody.add(dayBody.find('tr')));
-
- axisFirstCells = dayHead.find('th:first');
- gutterCells = dayTable.find('.fc-agenda-gutter');
+ buildDayTable();
slotLayer =
$("<div style='position:absolute;z-index:2;left:0;width:100%'/>")
if (opt('allDaySlot')) {
daySegmentContainer =
- $("<div style='position:absolute;z-index:8;top:0;left:0'/>")
+ $("<div class='fc-event-container' style='position:absolute;z-index:8;top:0;left:0'/>")
.appendTo(slotLayer);
s =
dayBind(allDayRow.find('td'));
- axisFirstCells = axisFirstCells.add(allDayTable.find('th:first'));
- gutterCells = gutterCells.add(allDayTable.find('th.fc-agenda-gutter'));
-
slotLayer.append(
"<div class='fc-agenda-divider " + headerClass + "'>" +
"<div class='fc-agenda-divider-inner'/>" +
$("<div style='position:absolute;width:100%;overflow-x:hidden;overflow-y:auto'/>")
.appendTo(slotLayer);
- slotContent =
+ slotContainer =
$("<div style='position:relative;width:100%;overflow:hidden'/>")
.appendTo(slotScroller);
slotSegmentContainer =
- $("<div style='position:absolute;z-index:8;top:0;left:0'/>")
- .appendTo(slotContent);
+ $("<div class='fc-event-container' style='position:absolute;z-index:8;top:0;left:0'/>")
+ .appendTo(slotContainer);
s =
"<table class='fc-agenda-slots' style='width:100%' cellspacing='0'>" +
s +=
"</tbody>" +
"</table>";
- slotTable = $(s).appendTo(slotContent);
- slotTableFirstInner = slotTable.find('div:first');
+ slotTable = $(s).appendTo(slotContainer);
slotBind(slotTable.find('td'));
+ }
+
+
+
+ /* Build Day Table
+ -----------------------------------------------------------------------*/
+
+
+ function buildDayTable() {
+ var html = buildDayTableHTML();
+
+ if (dayTable) {
+ dayTable.remove();
+ }
+ dayTable = $(html).appendTo(element);
+
+ dayHead = dayTable.find('thead');
+ dayHeadCells = dayHead.find('th').slice(1, -1); // exclude gutter
+ dayBody = dayTable.find('tbody');
+ dayBodyCells = dayBody.find('td').slice(0, -1); // exclude gutter
+ dayBodyCellInners = dayBodyCells.find('> div');
+ dayBodyCellContentInners = dayBodyCells.find('.fc-day-content > div');
+
+ dayBodyFirstCell = dayBodyCells.eq(0);
+ dayBodyFirstCellStretcher = dayBodyCellInners.eq(0);
- axisFirstCells = axisFirstCells.add(slotTable.find('th:first'));
+ markFirstLast(dayHead.add(dayHead.find('tr')));
+ markFirstLast(dayBody.add(dayBody.find('tr')));
+
+ // TODO: now that we rebuild the cells every time, we should call dayRender
}
-
-
-
- function updateCells() {
- var i;
- var headCell;
- var bodyCell;
+
+
+ function buildDayTableHTML() {
+ var html =
+ "<table style='width:100%' class='fc-agenda-days fc-border-separate' cellspacing='0'>" +
+ buildDayTableHeadHTML() +
+ buildDayTableBodyHTML() +
+ "</table>";
+
+ return html;
+ }
+
+
+ function buildDayTableHeadHTML() {
+ var headerClass = tm + "-widget-header";
+ var date;
+ var html = '';
+ var weekText;
+ var col;
+
+ html +=
+ "<thead>" +
+ "<tr>";
+
+ if (showWeekNumbers) {
+ date = cellToDate(0, 0);
+ weekText = formatDate(date, weekNumberFormat);
+ if (rtl) {
+ weekText += weekNumberTitle;
+ }
+ else {
+ weekText = weekNumberTitle + weekText;
+ }
+ html +=
+ "<th class='fc-agenda-axis fc-week-number " + headerClass + "'>" +
+ htmlEscape(weekText) +
+ "</th>";
+ }
+ else {
+ html += "<th class='fc-agenda-axis " + headerClass + "'> </th>";
+ }
+
+ for (col=0; col<colCnt; col++) {
+ date = cellToDate(0, col);
+ html +=
+ "<th class='fc-" + dayIDs[date.getDay()] + " fc-col" + col + ' ' + headerClass + "'>" +
+ htmlEscape(formatDate(date, colFormat)) +
+ "</th>";
+ }
+
+ html +=
+ "<th class='fc-agenda-gutter " + headerClass + "'> </th>" +
+ "</tr>" +
+ "</thead>";
+
+ return html;
+ }
+
+
+ function buildDayTableBodyHTML() {
+ var headerClass = tm + "-widget-header"; // TODO: make these when updateOptions() called
+ var contentClass = tm + "-widget-content";
var date;
var today = clearTime(new Date());
- for (i=0; i<colCnt; i++) {
- date = colDate(i);
- headCell = dayHeadCells.eq(i);
- headCell.html(formatDate(date, colFormat));
- bodyCell = dayBodyCells.eq(i);
+ var col;
+ var cellsHTML;
+ var cellHTML;
+ var classNames;
+ var html = '';
+
+ html +=
+ "<tbody>" +
+ "<tr>" +
+ "<th class='fc-agenda-axis " + headerClass + "'> </th>";
+
+ cellsHTML = '';
+
+ for (col=0; col<colCnt; col++) {
+
+ date = cellToDate(0, col);
+
+ classNames = [
+ 'fc-col' + col,
+ 'fc-' + dayIDs[date.getDay()],
+ contentClass
+ ];
if (+date == +today) {
- bodyCell.addClass(tm + '-state-highlight fc-today');
- }else{
- bodyCell.removeClass(tm + '-state-highlight fc-today');
+ classNames.push(
+ tm + '-state-highlight',
+ 'fc-today'
+ );
+ }
+ else if (date < today) {
+ classNames.push('fc-past');
+ }
+ else {
+ classNames.push('fc-future');
}
- setDayID(headCell.add(bodyCell), date);
+
+ cellHTML =
+ "<td class='" + classNames.join(' ') + "'>" +
+ "<div>" +
+ "<div class='fc-day-content'>" +
+ "<div style='position:relative'> </div>" +
+ "</div>" +
+ "</div>" +
+ "</td>";
+
+ cellsHTML += cellHTML;
}
+
+ html += cellsHTML;
+ html +=
+ "<td class='fc-agenda-gutter " + contentClass + "'> </td>" +
+ "</tr>" +
+ "</tbody>";
+
+ return html;
}
+
+
+ // TODO: data-date on the cells
+
+ /* Dimensions
+ -----------------------------------------------------------------------*/
+
- function setHeight(height, dateChanged) {
+ function setHeight(height) {
if (height === undefined) {
height = viewHeight;
}
height - headHeight, // when scrollbars
slotTable.height() + allDayHeight + 1 // when no scrollbars. +1 for bottom border
);
-
+
dayBodyFirstCellStretcher
.height(bodyHeight - vsides(dayBodyFirstCell));
slotScroller.height(bodyHeight - allDayHeight - 1);
- slotHeight = slotTableFirstInner.height() + 1; // +1 for border
-
- if (dateChanged) {
- resetScroll();
- }
+ // the stylesheet guarantees that the first row has no border.
+ // this allows .height() to work well cross-browser.
+ slotHeight = slotTable.find('tr:first').height() + 1; // +1 for bottom border
+
+ snapRatio = opt('slotMinutes') / snapMinutes;
+ snapHeight = slotHeight / snapRatio;
}
-
function setWidth(width) {
viewWidth = width;
+ colPositions.clear();
colContentPositions.clear();
+
+ var axisFirstCells = dayHead.find('th:first');
+ if (allDayTable) {
+ axisFirstCells = axisFirstCells.add(allDayTable.find('th:first'));
+ }
+ axisFirstCells = axisFirstCells.add(slotTable.find('th:first'));
axisWidth = 0;
setOuterWidth(
axisWidth
);
- var slotTableWidth = slotScroller[0].clientWidth; // needs to be done after axisWidth (for IE7)
- //slotTable.width(slotTableWidth);
+ var gutterCells = dayTable.find('.fc-agenda-gutter');
+ if (allDayTable) {
+ gutterCells = gutterCells.add(allDayTable.find('th.fc-agenda-gutter'));
+ }
+
+ var slotTableWidth = slotScroller[0].clientWidth; // needs to be done after axisWidth (for IE7)
gutterWidth = slotScroller.width() - slotTableWidth;
if (gutterWidth) {
+ /* Scrolling
+ -----------------------------------------------------------------------*/
+
+
function resetScroll() {
var d0 = zeroDate();
var scrollDate = cloneDate(d0);
scroll();
setTimeout(scroll, 0); // overrides any previous scroll state made by the browser
}
-
-
- function beforeHide() {
- savedScrollTop = slotScroller.scrollTop();
- }
-
-
- function afterShow() {
- slotScroller.scrollTop(savedScrollTop);
+
+
+ function afterRender() { // after the view has been freshly rendered and sized
+ resetScroll();
}
function slotClick(ev) {
if (!opt('selectable')) { // if selectable, SelectionManager will worry about dayClick
var col = Math.min(colCnt-1, Math.floor((ev.pageX - dayTable.offset().left - axisWidth) / colWidth));
- var date = colDate(col);
+ var date = cellToDate(0, col);
var rowMatch = this.parentNode.className.match(/fc-slot(\d+)/); // TODO: maybe use data
if (rowMatch) {
var mins = parseInt(rowMatch[1]) * opt('slotMinutes');
/* Semi-transparent Overlay Helpers
-----------------------------------------------------*/
-
+ // TODO: should be consolidated with BasicView's methods
+
+
+ function renderDayOverlay(overlayStart, overlayEnd, refreshCoordinateGrid) { // overlayEnd is exclusive
- function renderDayOverlay(startDate, endDate, refreshCoordinateGrid) { // endDate is exclusive
if (refreshCoordinateGrid) {
coordinateGrid.build();
}
- var visStart = cloneDate(t.visStart);
- var startCol, endCol;
- if (rtl) {
- startCol = dayDiff(endDate, visStart)*dis+dit+1;
- endCol = dayDiff(startDate, visStart)*dis+dit+1;
- }else{
- startCol = dayDiff(startDate, visStart);
- endCol = dayDiff(endDate, visStart);
- }
- startCol = Math.max(0, startCol);
- endCol = Math.min(colCnt, endCol);
- if (startCol < endCol) {
+
+ var segments = rangeToSegments(overlayStart, overlayEnd);
+
+ for (var i=0; i<segments.length; i++) {
+ var segment = segments[i];
dayBind(
- renderCellOverlay(0, startCol, 0, endCol-1)
+ renderCellOverlay(
+ segment.row,
+ segment.leftCol,
+ segment.row,
+ segment.rightCol
+ )
);
}
}
function renderSlotOverlay(overlayStart, overlayEnd) {
- var dayStart = cloneDate(t.visStart);
- var dayEnd = addDays(cloneDate(dayStart), 1);
for (var i=0; i<colCnt; i++) {
+ var dayStart = cellToDate(0, i);
+ var dayEnd = addDays(cloneDate(dayStart), 1);
var stretchStart = new Date(Math.max(dayStart, overlayStart));
var stretchEnd = new Date(Math.min(dayEnd, overlayEnd));
if (stretchStart < stretchEnd) {
- var col = i*dis+dit;
- var rect = coordinateGrid.rect(0, col, 0, col, slotContent); // only use it for horizontal coords
+ var rect = coordinateGrid.rect(0, i, 0, i, slotContainer); // only use it for horizontal coords
var top = timePosition(dayStart, stretchStart);
var bottom = timePosition(dayStart, stretchEnd);
rect.top = top;
rect.height = bottom - top;
slotBind(
- renderOverlay(rect, slotContent)
+ renderOverlay(rect, slotContainer)
);
}
- addDays(dayStart, 1);
- addDays(dayEnd, 1);
}
}
n = e.offset().top;
rows[0] = [n, n+e.outerHeight()];
}
- var slotTableTop = slotContent.offset().top;
+ var slotTableTop = slotContainer.offset().top;
var slotScrollerTop = slotScroller.offset().top;
var slotScrollerBottom = slotScrollerTop + slotScroller.outerHeight();
function constrain(n) {
return Math.max(slotScrollerTop, Math.min(slotScrollerBottom, n));
}
- for (var i=0; i<slotCnt; i++) {
+ for (var i=0; i<slotCnt*snapRatio; i++) { // adapt slot count to increased/decreased selection slot count
rows.push([
- constrain(slotTableTop + slotHeight*i),
- constrain(slotTableTop + slotHeight*(i+1))
+ constrain(slotTableTop + snapHeight*i),
+ constrain(slotTableTop + snapHeight*(i+1))
]);
}
});
hoverListener = new HoverListener(coordinateGrid);
+ colPositions = new HorizontalPositionCache(function(col) {
+ return dayBodyCellInners.eq(col);
+ });
colContentPositions = new HorizontalPositionCache(function(col) {
- return dayBodyCellInners.eq(col);
+ return dayBodyCellContentInners.eq(col);
});
+ function colLeft(col) {
+ return colPositions.left(col);
+ }
+
+
function colContentLeft(col) {
return colContentPositions.left(col);
}
+
+
+ function colRight(col) {
+ return colPositions.right(col);
+ }
function colContentRight(col) {
return colContentPositions.right(col);
}
-
-
-
-
- function dateCell(date) { // "cell" terminology is now confusing
- return {
- row: Math.floor(dayDiff(date, t.visStart) / 7),
- col: dayOfWeekCol(date.getDay())
- };
+
+
+ function getIsCellAllDay(cell) {
+ return opt('allDaySlot') && !cell.row;
}
-
-
- function cellDate(cell) {
- var d = colDate(cell.col);
+
+
+ function realCellToDate(cell) { // ugh "real" ... but blame it on our abuse of the "cell" system
+ var d = cellToDate(0, cell.col);
var slotIndex = cell.row;
if (opt('allDaySlot')) {
slotIndex--;
}
if (slotIndex >= 0) {
- addMinutes(d, minMinute + slotIndex * opt('slotMinutes'));
+ addMinutes(d, minMinute + slotIndex * snapMinutes);
}
return d;
}
- function colDate(col) { // returns dates with 00:00:00
- return addDays(cloneDate(t.visStart), col*dis+dit);
- }
-
-
- function cellIsAllDay(cell) {
- return opt('allDaySlot') && !cell.row;
- }
-
-
- function dayOfWeekCol(dayOfWeek) {
- return ((dayOfWeek - Math.max(firstDay, nwe) + colCnt) % colCnt)*dis+dit;
- }
-
-
-
-
// get the Y coordinate of the given time on the given day (both Date objects)
function timePosition(day, time) { // both date objects. day holds 00:00 of current day
day = cloneDate(day, true);
slotI = Math.floor(minutes / slotMinutes),
slotTop = slotTopCache[slotI];
if (slotTop === undefined) {
- slotTop = slotTopCache[slotI] = slotTable.find('tr:eq(' + slotI + ') td div')[0].offsetTop; //.position().top; // need this optimization???
+ slotTop = slotTopCache[slotI] =
+ slotTable.find('tr').eq(slotI).find('td div')[0].offsetTop;
+ // .eq() is faster than ":eq()" selector
+ // [0].offsetTop is faster than .position().top (do we really need this optimization?)
+ // a better optimization would be to cache all these divs
}
return Math.max(0, Math.round(
slotTop - 1 + slotHeight * ((minutes % slotMinutes) / slotMinutes)
}
- function allDayBounds() {
- return {
- left: axisWidth,
- right: viewWidth - gutterWidth
- }
- }
-
-
function getAllDayRow(index) {
return allDayRow;
}
var helperOption = opt('selectHelper');
coordinateGrid.build();
if (helperOption) {
- var col = dayDiff(startDate, t.visStart) * dis + dit;
+ var col = dateToCell(startDate).col;
if (col >= 0 && col < colCnt) { // only works when times are on same day
- var rect = coordinateGrid.rect(0, col, 0, col, slotContent); // only for horizontal coords
+ var rect = coordinateGrid.rect(0, col, 0, col, slotContainer); // only for horizontal coords
var top = timePosition(startDate, startDate);
var bottom = timePosition(startDate, endDate);
if (bottom > top) { // protect against selections that are entirely before or after visible range
var helperRes = helperOption(startDate, endDate);
if (helperRes) {
rect.position = 'absolute';
- rect.zIndex = 8;
selectionHelper = $(helperRes)
.css(rect)
- .appendTo(slotContent);
+ .appendTo(slotContainer);
}
}else{
rect.isStart = true; // conside rect a "seg" now
}
if (selectionHelper) {
slotBind(selectionHelper);
- slotContent.append(selectionHelper);
+ slotContainer.append(selectionHelper);
setOuterWidth(selectionHelper, rect.width, true); // needs to be after appended
setOuterHeight(selectionHelper, rect.height, true);
}
var dates;
hoverListener.start(function(cell, origCell) {
clearSelection();
- if (cell && cell.col == origCell.col && !cellIsAllDay(cell)) {
- var d1 = cellDate(origCell);
- var d2 = cellDate(cell);
+ if (cell && cell.col == origCell.col && !getIsCellAllDay(cell)) {
+ var d1 = realCellToDate(origCell);
+ var d2 = realCellToDate(cell);
dates = [
d1,
- addMinutes(cloneDate(d1), opt('slotMinutes')),
+ addMinutes(cloneDate(d1), snapMinutes), // calculate minutes depending on selection slot minutes
d2,
- addMinutes(cloneDate(d2), opt('slotMinutes'))
- ].sort(cmp);
+ addMinutes(cloneDate(d2), snapMinutes)
+ ].sort(dateCompare);
renderSlotSelection(dates[0], dates[3]);
}else{
dates = null;
});
}
}
-
-
+
+
function reportDayClick(date, allDay, ev) {
- trigger('dayClick', dayBodyCells[dayOfWeekCol(date.getDay())], date, allDay, ev);
+ trigger('dayClick', dayBodyCells[dateToCell(date).col], date, allDay, ev);
}
hoverListener.start(function(cell) {
clearOverlays();
if (cell) {
- if (cellIsAllDay(cell)) {
+ if (getIsCellAllDay(cell)) {
renderCellOverlay(cell.row, cell.col, cell.row, cell.col);
}else{
- var d1 = cellDate(cell);
+ var d1 = realCellToDate(cell);
var d2 = addMinutes(cloneDate(d1), opt('defaultEventMinutes'));
renderSlotOverlay(d1, d2);
}
var cell = hoverListener.stop();
clearOverlays();
if (cell) {
- trigger('drop', _dragElement, cellDate(cell), cellIsAllDay(cell), ev, ui);
+ trigger('drop', _dragElement, realCellToDate(cell), getIsCellAllDay(cell), ev, ui);
}
}
-
+
}
+;;
+
function AgendaEventRenderer() {
var t = this;
// exports
t.renderEvents = renderEvents;
- t.compileDaySegs = compileDaySegs; // for DayEventRenderer
t.clearEvents = clearEvents;
t.slotSegHtml = slotSegHtml;
- t.bindDaySeg = bindDaySeg;
// imports
DayEventRenderer.call(t);
var opt = t.opt;
var trigger = t.trigger;
- //var setOverflowHidden = t.setOverflowHidden;
var isEventDraggable = t.isEventDraggable;
var isEventResizable = t.isEventResizable;
var eventEnd = t.eventEnd;
- var reportEvents = t.reportEvents;
- var reportEventClear = t.reportEventClear;
var eventElementHandlers = t.eventElementHandlers;
var setHeight = t.setHeight;
var getDaySegmentContainer = t.getDaySegmentContainer;
var getMaxMinute = t.getMaxMinute;
var getMinMinute = t.getMinMinute;
var timePosition = t.timePosition;
+ var getIsCellAllDay = t.getIsCellAllDay;
var colContentLeft = t.colContentLeft;
var colContentRight = t.colContentRight;
- var renderDaySegs = t.renderDaySegs;
- var resizableDayEvent = t.resizableDayEvent; // TODO: streamline binding architecture
+ var cellToDate = t.cellToDate;
var getColCnt = t.getColCnt;
var getColWidth = t.getColWidth;
- var getSlotHeight = t.getSlotHeight;
- var getBodyContent = t.getBodyContent;
+ var getSnapHeight = t.getSnapHeight;
+ var getSnapMinutes = t.getSnapMinutes;
+ var getSlotContainer = t.getSlotContainer;
var reportEventElement = t.reportEventElement;
var showEvents = t.showEvents;
var hideEvents = t.hideEvents;
var eventResize = t.eventResize;
var renderDayOverlay = t.renderDayOverlay;
var clearOverlays = t.clearOverlays;
+ var renderDayEvents = t.renderDayEvents;
var calendar = t.calendar;
var formatDate = calendar.formatDate;
var formatDates = calendar.formatDates;
-
+
+
+ // overrides
+ t.draggableDayEvent = draggableDayEvent;
+
/* Rendering
function renderEvents(events, modifiedEventId) {
- reportEvents(events);
var i, len=events.length,
dayEvents=[],
slotEvents=[];
slotEvents.push(events[i]);
}
}
+
if (opt('allDaySlot')) {
- renderDaySegs(compileDaySegs(dayEvents), modifiedEventId);
+ renderDayEvents(dayEvents, modifiedEventId);
setHeight(); // no params means set to viewHeight
}
+
renderSlotSegs(compileSlotSegs(slotEvents), modifiedEventId);
}
function clearEvents() {
- reportEventClear();
getDaySegmentContainer().empty();
getSlotSegmentContainer().empty();
}
-
-
- function compileDaySegs(events) {
- var levels = stackSegs(sliceSegs(events, $.map(events, exclEndDay), t.visStart, t.visEnd)),
- i, levelCnt=levels.length, level,
- j, seg,
- segs=[];
- for (i=0; i<levelCnt; i++) {
- level = levels[i];
- for (j=0; j<level.length; j++) {
- seg = level[j];
- seg.row = 0;
- seg.level = i; // not needed anymore
- segs.push(seg);
- }
- }
- return segs;
- }
-
+
function compileSlotSegs(events) {
var colCnt = getColCnt(),
minMinute = getMinMinute(),
maxMinute = getMaxMinute(),
- d = addMinutes(cloneDate(t.visStart), minMinute),
+ d,
visEventEnds = $.map(events, slotEventEnd),
- i, col,
- j, level,
- k, seg,
- segs=[];
+ i,
+ j, seg,
+ colSegs,
+ segs = [];
+
for (i=0; i<colCnt; i++) {
- col = stackSegs(sliceSegs(events, visEventEnds, d, addMinutes(cloneDate(d), maxMinute-minMinute)));
- countForwardSegs(col);
- for (j=0; j<col.length; j++) {
- level = col[j];
- for (k=0; k<level.length; k++) {
- seg = level[k];
- seg.col = i;
- seg.level = j;
- segs.push(seg);
- }
+
+ d = cellToDate(0, i);
+ addMinutes(d, minMinute);
+
+ colSegs = sliceSegs(
+ events,
+ visEventEnds,
+ d,
+ addMinutes(cloneDate(d), maxMinute-minMinute)
+ );
+
+ colSegs = placeSlotSegs(colSegs); // returns a new order
+
+ for (j=0; j<colSegs.length; j++) {
+ seg = colSegs[j];
+ seg.col = i;
+ segs.push(seg);
}
- addDays(d, 1, true);
}
+
return segs;
}
-
-
+
+
+ function sliceSegs(events, visEventEnds, start, end) {
+ var segs = [],
+ i, len=events.length, event,
+ eventStart, eventEnd,
+ segStart, segEnd,
+ isStart, isEnd;
+ for (i=0; i<len; i++) {
+ event = events[i];
+ eventStart = event.start;
+ eventEnd = visEventEnds[i];
+ if (eventEnd > start && eventStart < end) {
+ if (eventStart < start) {
+ segStart = cloneDate(start);
+ isStart = false;
+ }else{
+ segStart = eventStart;
+ isStart = true;
+ }
+ if (eventEnd > end) {
+ segEnd = cloneDate(end);
+ isEnd = false;
+ }else{
+ segEnd = eventEnd;
+ isEnd = true;
+ }
+ segs.push({
+ event: event,
+ start: segStart,
+ end: segEnd,
+ isStart: isStart,
+ isEnd: isEnd
+ });
+ }
+ }
+ return segs.sort(compareSlotSegs);
+ }
+
+
function slotEventEnd(event) {
if (event.end) {
return cloneDate(event.end);
// renders events in the 'time slots' at the bottom
+ // TODO: when we refactor this, when user returns `false` eventRender, don't have empty space
+ // TODO: refactor will include using pixels to detect collisions instead of dates (handy for seg cmp)
function renderSlotSegs(segs, modifiedEventId) {
var i, segCnt=segs.length, seg,
event,
- classes,
- top, bottom,
- colI, levelI, forward,
- leftmost,
- availWidth,
- outerWidth,
+ top,
+ bottom,
+ columnLeft,
+ columnRight,
+ columnWidth,
+ width,
left,
- html='',
+ right,
+ html = '',
eventElements,
eventElement,
triggerRes,
- vsideCache={},
- hsideCache={},
- key, val,
- contentElement,
+ titleElement,
height,
slotSegmentContainer = getSlotSegmentContainer(),
- rtl, dis, dit,
- colCnt = getColCnt();
-
- if (rtl = opt('isRTL')) {
- dis = -1;
- dit = colCnt - 1;
- }else{
- dis = 1;
- dit = 0;
- }
+ isRTL = opt('isRTL');
// calculate position/dimensions, create html
for (i=0; i<segCnt; i++) {
event = seg.event;
top = timePosition(seg.start, seg.start);
bottom = timePosition(seg.start, seg.end);
- colI = seg.col;
- levelI = seg.level;
- forward = seg.forward || 0;
- leftmost = colContentLeft(colI*dis + dit);
- availWidth = colContentRight(colI*dis + dit) - leftmost;
- availWidth = Math.min(availWidth-6, availWidth*.95); // TODO: move this to CSS
- if (levelI) {
- // indented and thin
- outerWidth = availWidth / (levelI + forward + 1);
- }else{
- if (forward) {
- // moderately wide, aligned left still
- outerWidth = ((availWidth / (forward + 1)) - (12/2)) * 2; // 12 is the predicted width of resizer =
- }else{
- // can be entire width, aligned left
- outerWidth = availWidth;
- }
+ columnLeft = colContentLeft(seg.col);
+ columnRight = colContentRight(seg.col);
+ columnWidth = columnRight - columnLeft;
+
+ // shave off space on right near scrollbars (2.5%)
+ // TODO: move this to CSS somehow
+ columnRight -= columnWidth * .025;
+ columnWidth = columnRight - columnLeft;
+
+ width = columnWidth * (seg.forwardCoord - seg.backwardCoord);
+
+ if (opt('slotEventOverlap')) {
+ // double the width while making sure resize handle is visible
+ // (assumed to be 20px wide)
+ width = Math.max(
+ (width - (20/2)) * 2,
+ width // narrow columns will want to make the segment smaller than
+ // the natural width. don't allow it
+ );
+ }
+
+ if (isRTL) {
+ right = columnRight - seg.backwardCoord * columnWidth;
+ left = right - width;
}
- left = leftmost + // leftmost possible
- (availWidth / (levelI + forward + 1) * levelI) // indentation
- * dis + (rtl ? availWidth - outerWidth : 0); // rtl
+ else {
+ left = columnLeft + seg.backwardCoord * columnWidth;
+ right = left + width;
+ }
+
+ // make sure horizontal coordinates are in bounds
+ left = Math.max(left, columnLeft);
+ right = Math.min(right, columnRight);
+ width = right - left;
+
seg.top = top;
seg.left = left;
- seg.outerWidth = outerWidth;
+ seg.outerWidth = width;
seg.outerHeight = bottom - top;
html += slotSegHtml(event, seg);
}
+
slotSegmentContainer[0].innerHTML = html; // faster than html()
eventElements = slotSegmentContainer.children();
for (i=0; i<segCnt; i++) {
seg = segs[i];
if (eventElement = seg.element) {
- val = vsideCache[key = seg.key = cssKey(eventElement[0])];
- seg.vsides = val === undefined ? (vsideCache[key] = vsides(eventElement, true)) : val;
- val = hsideCache[key];
- seg.hsides = val === undefined ? (hsideCache[key] = hsides(eventElement, true)) : val;
- contentElement = eventElement.find('div.fc-event-content');
- if (contentElement.length) {
- seg.contentTop = contentElement[0].offsetTop;
+ seg.vsides = vsides(eventElement, true);
+ seg.hsides = hsides(eventElement, true);
+ titleElement = eventElement.find('.fc-event-title');
+ if (titleElement.length) {
+ seg.contentTop = titleElement[0].offsetTop;
}
}
}
eventElement[0].style.height = height + 'px';
event = seg.event;
if (seg.contentTop !== undefined && height - seg.contentTop < 10) {
- // not enough room for title, put it in the time header
+ // not enough room for title, put it in the time (TODO: maybe make both display:inline instead)
eventElement.find('div.fc-event-time')
.text(formatDate(event.start, opt('timeFormat')) + ' - ' + event.title);
eventElement.find('div.fc-event-title')
var html = "<";
var url = event.url;
var skinCss = getSkinCss(event, opt);
- var skinCssAttr = (skinCss ? " style='" + skinCss + "'" : '');
- var classes = ['fc-event', 'fc-event-skin', 'fc-event-vert'];
+ var classes = ['fc-event', 'fc-event-vert'];
if (isEventDraggable(event)) {
classes.push('fc-event-draggable');
}
if (seg.isStart) {
- classes.push('fc-corner-top');
+ classes.push('fc-event-start');
}
if (seg.isEnd) {
- classes.push('fc-corner-bottom');
+ classes.push('fc-event-end');
}
classes = classes.concat(event.className);
if (event.source) {
}
html +=
" class='" + classes.join(' ') + "'" +
- " style='position:absolute;z-index:8;top:" + seg.top + "px;left:" + seg.left + "px;" + skinCss + "'" +
+ " style=" +
+ "'" +
+ "position:absolute;" +
+ "top:" + seg.top + "px;" +
+ "left:" + seg.left + "px;" +
+ skinCss +
+ "'" +
">" +
- "<div class='fc-event-inner fc-event-skin'" + skinCssAttr + ">" +
- "<div class='fc-event-head fc-event-skin'" + skinCssAttr + ">" +
+ "<div class='fc-event-inner'>" +
"<div class='fc-event-time'>" +
htmlEscape(formatDates(event.start, event.end, opt('timeFormat'))) +
"</div>" +
- "</div>" +
- "<div class='fc-event-content'>" +
"<div class='fc-event-title'>" +
- htmlEscape(event.title) +
+ htmlEscape(event.title || '') +
"</div>" +
"</div>" +
- "<div class='fc-event-bg'></div>" +
- "</div>"; // close inner
+ "<div class='fc-event-bg'></div>";
if (seg.isEnd && isEventResizable(event)) {
html +=
"<div class='ui-resizable-handle ui-resizable-s'>=</div>";
}
- function bindDaySeg(event, eventElement, seg) {
- if (isEventDraggable(event)) {
- draggableDayEvent(event, eventElement, seg.isStart);
- }
- if (seg.isEnd && isEventResizable(event)) {
- resizableDayEvent(event, eventElement, seg);
- }
- eventElementHandlers(event, eventElement);
- // needs to be after, because resizableDayEvent might stopImmediatePropagation on click
- }
-
-
function bindSlotSeg(event, eventElement, seg) {
var timeElement = eventElement.find('div.fc-event-time');
if (isEventDraggable(event)) {
// when event starts out FULL-DAY
+ // overrides DayEventRenderer's version because it needs to account for dragging elements
+ // to and from the slot area.
- function draggableDayEvent(event, eventElement, isStart) {
+ function draggableDayEvent(event, eventElement, seg) {
+ var isStart = seg.isStart;
var origWidth;
var revert;
- var allDay=true;
+ var allDay = true;
var dayDelta;
- var dis = opt('isRTL') ? -1 : 1;
var hoverListener = getHoverListener();
var colWidth = getColWidth();
- var slotHeight = getSlotHeight();
+ var snapHeight = getSnapHeight();
+ var snapMinutes = getSnapMinutes();
var minMinute = getMinMinute();
eventElement.draggable({
- zIndex: 9,
opacity: opt('dragOpacity', 'month'), // use whatever the month view was using
revertDuration: opt('dragRevertDuration'),
start: function(ev, ui) {
trigger('eventDragStart', eventElement, event, ev, ui);
hideEvents(event, eventElement);
origWidth = eventElement.width();
- hoverListener.start(function(cell, origCell, rowDelta, colDelta) {
+ hoverListener.start(function(cell, origCell) {
clearOverlays();
if (cell) {
- //setOverflowHidden(true);
revert = false;
- dayDelta = colDelta * dis;
+ var origDate = cellToDate(0, origCell.col);
+ var date = cellToDate(0, cell.col);
+ dayDelta = dayDiff(date, origDate);
if (!cell.row) {
// on full-days
renderDayOverlay(
eventElement.width(colWidth - 10); // don't use entire width
setOuterHeight(
eventElement,
- slotHeight * Math.round(
- (event.end ? ((event.end - event.start) / MINUTE_MS) : opt('defaultEventMinutes'))
- / opt('slotMinutes')
+ snapHeight * Math.round(
+ (event.end ? ((event.end - event.start) / MINUTE_MS) : opt('defaultEventMinutes')) /
+ snapMinutes
)
);
eventElement.draggable('option', 'grid', [colWidth, 1]);
revert = revert || (allDay && !dayDelta);
}else{
resetElement();
- //setOverflowHidden(false);
revert = true;
}
eventElement.draggable('option', 'revert', revert);
// changed!
var minuteDelta = 0;
if (!allDay) {
- minuteDelta = Math.round((eventElement.offset().top - getBodyContent().offset().top) / slotHeight)
- * opt('slotMinutes')
+ minuteDelta = Math.round((eventElement.offset().top - getSlotContainer().offset().top) / snapHeight)
+ * snapMinutes
+ minMinute
- (event.start.getHours() * 60 + event.start.getMinutes());
}
eventDrop(this, event, dayDelta, minuteDelta, allDay, ev, ui);
}
- //setOverflowHidden(false);
}
});
function resetElement() {
// when event starts out IN TIMESLOTS
function draggableSlotEvent(event, eventElement, timeElement) {
- var origPosition;
- var allDay=false;
- var dayDelta;
- var minuteDelta;
- var prevMinuteDelta;
- var dis = opt('isRTL') ? -1 : 1;
- var hoverListener = getHoverListener();
+ var coordinateGrid = t.getCoordinateGrid();
var colCnt = getColCnt();
var colWidth = getColWidth();
- var slotHeight = getSlotHeight();
+ var snapHeight = getSnapHeight();
+ var snapMinutes = getSnapMinutes();
+
+ // states
+ var origPosition; // original position of the element, not the mouse
+ var origCell;
+ var isInBounds, prevIsInBounds;
+ var isAllDay, prevIsAllDay;
+ var colDelta, prevColDelta;
+ var dayDelta; // derived from colDelta
+ var minuteDelta, prevMinuteDelta;
+
eventElement.draggable({
- zIndex: 9,
scroll: false,
- grid: [colWidth, slotHeight],
+ grid: [ colWidth, snapHeight ],
axis: colCnt==1 ? 'y' : false,
opacity: opt('dragOpacity'),
revertDuration: opt('dragRevertDuration'),
start: function(ev, ui) {
+
trigger('eventDragStart', eventElement, event, ev, ui);
hideEvents(event, eventElement);
+
+ coordinateGrid.build();
+
+ // initialize states
origPosition = eventElement.position();
+ origCell = coordinateGrid.cell(ev.pageX, ev.pageY);
+ isInBounds = prevIsInBounds = true;
+ isAllDay = prevIsAllDay = getIsCellAllDay(origCell);
+ colDelta = prevColDelta = 0;
+ dayDelta = 0;
minuteDelta = prevMinuteDelta = 0;
- hoverListener.start(function(cell, origCell, rowDelta, colDelta) {
- eventElement.draggable('option', 'revert', !cell);
- clearOverlays();
- if (cell) {
- dayDelta = colDelta * dis;
- if (opt('allDaySlot') && !cell.row) {
- // over full days
- if (!allDay) {
- // convert to temporary all-day event
- allDay = true;
- timeElement.hide();
- eventElement.draggable('option', 'grid', null);
- }
- renderDayOverlay(
- addDays(cloneDate(event.start), dayDelta),
- addDays(exclEndDay(event), dayDelta)
- );
- }else{
- // on slots
- resetElement();
- }
- }
- }, ev, 'drag');
+
},
drag: function(ev, ui) {
- minuteDelta = Math.round((ui.position.top - origPosition.top) / slotHeight) * opt('slotMinutes');
- if (minuteDelta != prevMinuteDelta) {
- if (!allDay) {
- updateTimeText(minuteDelta);
+
+ // NOTE: this `cell` value is only useful for determining in-bounds and all-day.
+ // Bad for anything else due to the discrepancy between the mouse position and the
+ // element position while snapping. (problem revealed in PR #55)
+ //
+ // PS- the problem exists for draggableDayEvent() when dragging an all-day event to a slot event.
+ // We should overhaul the dragging system and stop relying on jQuery UI.
+ var cell = coordinateGrid.cell(ev.pageX, ev.pageY);
+
+ // update states
+ isInBounds = !!cell;
+ if (isInBounds) {
+ isAllDay = getIsCellAllDay(cell);
+
+ // calculate column delta
+ colDelta = Math.round((ui.position.left - origPosition.left) / colWidth);
+ if (colDelta != prevColDelta) {
+ // calculate the day delta based off of the original clicked column and the column delta
+ var origDate = cellToDate(0, origCell.col);
+ var col = origCell.col + colDelta;
+ col = Math.max(0, col);
+ col = Math.min(colCnt-1, col);
+ var date = cellToDate(0, col);
+ dayDelta = dayDiff(date, origDate);
+ }
+
+ // calculate minute delta (only if over slots)
+ if (!isAllDay) {
+ minuteDelta = Math.round((ui.position.top - origPosition.top) / snapHeight) * snapMinutes;
}
+ }
+
+ // any state changes?
+ if (
+ isInBounds != prevIsInBounds ||
+ isAllDay != prevIsAllDay ||
+ colDelta != prevColDelta ||
+ minuteDelta != prevMinuteDelta
+ ) {
+
+ updateUI();
+
+ // update previous states for next time
+ prevIsInBounds = isInBounds;
+ prevIsAllDay = isAllDay;
+ prevColDelta = colDelta;
prevMinuteDelta = minuteDelta;
}
+
+ // if out-of-bounds, revert when done, and vice versa.
+ eventElement.draggable('option', 'revert', !isInBounds);
+
},
stop: function(ev, ui) {
- var cell = hoverListener.stop();
+
clearOverlays();
trigger('eventDragStop', eventElement, event, ev, ui);
- if (cell && (dayDelta || minuteDelta || allDay)) {
- // changed!
- eventDrop(this, event, dayDelta, allDay ? 0 : minuteDelta, allDay, ev, ui);
- }else{
- // either no change or out-of-bounds (draggable has already reverted)
- resetElement();
+
+ if (isInBounds && (isAllDay || dayDelta || minuteDelta)) { // changed!
+ eventDrop(this, event, dayDelta, isAllDay ? 0 : minuteDelta, isAllDay, ev, ui);
+ }
+ else { // either no change or out-of-bounds (draggable has already reverted)
+
+ // reset states for next time, and for updateUI()
+ isInBounds = true;
+ isAllDay = false;
+ colDelta = 0;
+ dayDelta = 0;
+ minuteDelta = 0;
+
+ updateUI();
eventElement.css('filter', ''); // clear IE opacity side-effects
- eventElement.css(origPosition); // sometimes fast drags make event revert to wrong position
- updateTimeText(0);
+
+ // sometimes fast drags make event revert to wrong position, so reset.
+ // also, if we dragged the element out of the area because of snapping,
+ // but the *mouse* is still in bounds, we need to reset the position.
+ eventElement.css(origPosition);
+
showEvents(event, eventElement);
}
}
});
+
+ function updateUI() {
+ clearOverlays();
+ if (isInBounds) {
+ if (isAllDay) {
+ timeElement.hide();
+ eventElement.draggable('option', 'grid', null); // disable grid snapping
+ renderDayOverlay(
+ addDays(cloneDate(event.start), dayDelta),
+ addDays(exclEndDay(event), dayDelta)
+ );
+ }
+ else {
+ updateTimeText(minuteDelta);
+ timeElement.css('display', ''); // show() was causing display=inline
+ eventElement.draggable('option', 'grid', [colWidth, snapHeight]); // re-enable grid snapping
+ }
+ }
+ }
+
function updateTimeText(minuteDelta) {
var newStart = addMinutes(cloneDate(event.start), minuteDelta);
var newEnd;
}
timeElement.text(formatDates(newStart, newEnd, opt('timeFormat')));
}
- function resetElement() {
- // convert back to original slot-event
- if (allDay) {
- timeElement.css('display', ''); // show() was causing display=inline
- eventElement.draggable('option', 'grid', [colWidth, slotHeight]);
- allDay = false;
- }
- }
+
}
function resizableSlotEvent(event, eventElement, timeElement) {
- var slotDelta, prevSlotDelta;
- var slotHeight = getSlotHeight();
+ var snapDelta, prevSnapDelta;
+ var snapHeight = getSnapHeight();
+ var snapMinutes = getSnapMinutes();
eventElement.resizable({
handles: {
- s: 'div.ui-resizable-s'
+ s: '.ui-resizable-handle'
},
- grid: slotHeight,
+ grid: snapHeight,
start: function(ev, ui) {
- slotDelta = prevSlotDelta = 0;
+ snapDelta = prevSnapDelta = 0;
hideEvents(event, eventElement);
- eventElement.css('z-index', 9);
trigger('eventResizeStart', this, event, ev, ui);
},
resize: function(ev, ui) {
// don't rely on ui.size.height, doesn't take grid into account
- slotDelta = Math.round((Math.max(slotHeight, eventElement.height()) - ui.originalSize.height) / slotHeight);
- if (slotDelta != prevSlotDelta) {
+ snapDelta = Math.round((Math.max(snapHeight, eventElement.height()) - ui.originalSize.height) / snapHeight);
+ if (snapDelta != prevSnapDelta) {
timeElement.text(
formatDates(
event.start,
- (!slotDelta && !event.end) ? null : // no change, so don't display time range
- addMinutes(eventEnd(event), opt('slotMinutes')*slotDelta),
+ (!snapDelta && !event.end) ? null : // no change, so don't display time range
+ addMinutes(eventEnd(event), snapMinutes*snapDelta),
opt('timeFormat')
)
);
- prevSlotDelta = slotDelta;
+ prevSnapDelta = snapDelta;
}
},
stop: function(ev, ui) {
trigger('eventResizeStop', this, event, ev, ui);
- if (slotDelta) {
- eventResize(this, event, 0, opt('slotMinutes')*slotDelta, ev, ui);
+ if (snapDelta) {
+ eventResize(this, event, 0, snapMinutes*snapDelta, ev, ui);
}else{
- eventElement.css('z-index', 8);
showEvents(event, eventElement);
// BUG: if event was really short, need to put title back in span
}
}
-function countForwardSegs(levels) {
- var i, j, k, level, segForward, segBack;
- for (i=levels.length-1; i>0; i--) {
+
+/* Agenda Event Segment Utilities
+-----------------------------------------------------------------------------*/
+
+
+// Sets the seg.backwardCoord and seg.forwardCoord on each segment and returns a new
+// list in the order they should be placed into the DOM (an implicit z-index).
+function placeSlotSegs(segs) {
+ var levels = buildSlotSegLevels(segs);
+ var level0 = levels[0];
+ var i;
+
+ computeForwardSlotSegs(levels);
+
+ if (level0) {
+
+ for (i=0; i<level0.length; i++) {
+ computeSlotSegPressures(level0[i]);
+ }
+
+ for (i=0; i<level0.length; i++) {
+ computeSlotSegCoords(level0[i], 0, 0);
+ }
+ }
+
+ return flattenSlotSegLevels(levels);
+}
+
+
+// Builds an array of segments "levels". The first level will be the leftmost tier of segments
+// if the calendar is left-to-right, or the rightmost if the calendar is right-to-left.
+function buildSlotSegLevels(segs) {
+ var levels = [];
+ var i, seg;
+ var j;
+
+ for (i=0; i<segs.length; i++) {
+ seg = segs[i];
+
+ // go through all the levels and stop on the first level where there are no collisions
+ for (j=0; j<levels.length; j++) {
+ if (!computeSlotSegCollisions(seg, levels[j]).length) {
+ break;
+ }
+ }
+
+ (levels[j] || (levels[j] = [])).push(seg);
+ }
+
+ return levels;
+}
+
+
+// For every segment, figure out the other segments that are in subsequent
+// levels that also occupy the same vertical space. Accumulate in seg.forwardSegs
+function computeForwardSlotSegs(levels) {
+ var i, level;
+ var j, seg;
+ var k;
+
+ for (i=0; i<levels.length; i++) {
level = levels[i];
+
for (j=0; j<level.length; j++) {
- segForward = level[j];
- for (k=0; k<levels[i-1].length; k++) {
- segBack = levels[i-1][k];
- if (segsCollide(segForward, segBack)) {
- segBack.forward = Math.max(segBack.forward||0, (segForward.forward||0)+1);
- }
+ seg = level[j];
+
+ seg.forwardSegs = [];
+ for (k=i+1; k<levels.length; k++) {
+ computeSlotSegCollisions(seg, levels[k], seg.forwardSegs);
}
}
}
}
+// Figure out which path forward (via seg.forwardSegs) results in the longest path until
+// the furthest edge is reached. The number of segments in this path will be seg.forwardPressure
+function computeSlotSegPressures(seg) {
+ var forwardSegs = seg.forwardSegs;
+ var forwardPressure = 0;
+ var i, forwardSeg;
+
+ if (seg.forwardPressure === undefined) { // not already computed
+
+ for (i=0; i<forwardSegs.length; i++) {
+ forwardSeg = forwardSegs[i];
+
+ // figure out the child's maximum forward path
+ computeSlotSegPressures(forwardSeg);
+
+ // either use the existing maximum, or use the child's forward pressure
+ // plus one (for the forwardSeg itself)
+ forwardPressure = Math.max(
+ forwardPressure,
+ 1 + forwardSeg.forwardPressure
+ );
+ }
+
+ seg.forwardPressure = forwardPressure;
+ }
+}
+
+
+// Calculate seg.forwardCoord and seg.backwardCoord for the segment, where both values range
+// from 0 to 1. If the calendar is left-to-right, the seg.backwardCoord maps to "left" and
+// seg.forwardCoord maps to "right" (via percentage). Vice-versa if the calendar is right-to-left.
+//
+// The segment might be part of a "series", which means consecutive segments with the same pressure
+// who's width is unknown until an edge has been hit. `seriesBackwardPressure` is the number of
+// segments behind this one in the current series, and `seriesBackwardCoord` is the starting
+// coordinate of the first segment in the series.
+function computeSlotSegCoords(seg, seriesBackwardPressure, seriesBackwardCoord) {
+ var forwardSegs = seg.forwardSegs;
+ var i;
+
+ if (seg.forwardCoord === undefined) { // not already computed
+
+ if (!forwardSegs.length) {
+
+ // if there are no forward segments, this segment should butt up against the edge
+ seg.forwardCoord = 1;
+ }
+ else {
+
+ // sort highest pressure first
+ forwardSegs.sort(compareForwardSlotSegs);
+
+ // this segment's forwardCoord will be calculated from the backwardCoord of the
+ // highest-pressure forward segment.
+ computeSlotSegCoords(forwardSegs[0], seriesBackwardPressure + 1, seriesBackwardCoord);
+ seg.forwardCoord = forwardSegs[0].backwardCoord;
+ }
+
+ // calculate the backwardCoord from the forwardCoord. consider the series
+ seg.backwardCoord = seg.forwardCoord -
+ (seg.forwardCoord - seriesBackwardCoord) / // available width for series
+ (seriesBackwardPressure + 1); // # of segments in the series
+
+ // use this segment's coordinates to computed the coordinates of the less-pressurized
+ // forward segments
+ for (i=0; i<forwardSegs.length; i++) {
+ computeSlotSegCoords(forwardSegs[i], 0, seg.forwardCoord);
+ }
+ }
+}
+
+
+// Outputs a flat array of segments, from lowest to highest level
+function flattenSlotSegLevels(levels) {
+ var segs = [];
+ var i, level;
+ var j;
+
+ for (i=0; i<levels.length; i++) {
+ level = levels[i];
+
+ for (j=0; j<level.length; j++) {
+ segs.push(level[j]);
+ }
+ }
+
+ return segs;
+}
+
+
+// Find all the segments in `otherSegs` that vertically collide with `seg`.
+// Append into an optionally-supplied `results` array and return.
+function computeSlotSegCollisions(seg, otherSegs, results) {
+ results = results || [];
+
+ for (var i=0; i<otherSegs.length; i++) {
+ if (isSlotSegCollision(seg, otherSegs[i])) {
+ results.push(otherSegs[i]);
+ }
+ }
+
+ return results;
+}
+
+
+// Do these segments occupy the same vertical space?
+function isSlotSegCollision(seg1, seg2) {
+ return seg1.end > seg2.start && seg1.start < seg2.end;
+}
+
+
+// A cmp function for determining which forward segment to rely on more when computing coordinates.
+function compareForwardSlotSegs(seg1, seg2) {
+ // put higher-pressure first
+ return seg2.forwardPressure - seg1.forwardPressure ||
+ // put segments that are closer to initial edge first (and favor ones with no coords yet)
+ (seg1.backwardCoord || 0) - (seg2.backwardCoord || 0) ||
+ // do normal sorting...
+ compareSlotSegs(seg1, seg2);
+}
+
+
+// A cmp function for determining which segment should be closer to the initial edge
+// (the left edge on a left-to-right calendar).
+function compareSlotSegs(seg1, seg2) {
+ return seg1.start - seg2.start || // earlier start time goes first
+ (seg2.end - seg2.start) - (seg1.end - seg1.start) || // tie? longer-duration goes first
+ (seg1.event.title || '').localeCompare(seg2.event.title); // tie? alphabetically by title
+}
+
+
+;;
function View(element, calendar, viewName) {
t.name = viewName;
t.opt = opt;
t.trigger = trigger;
- //t.setOverflowHidden = setOverflowHidden;
t.isEventDraggable = isEventDraggable;
t.isEventResizable = isEventResizable;
- t.reportEvents = reportEvents;
+ t.setEventData = setEventData;
+ t.clearEventData = clearEventData;
t.eventEnd = eventEnd;
t.reportEventElement = reportEventElement;
- t.reportEventClear = reportEventClear;
+ t.triggerEventDestroy = triggerEventDestroy;
t.eventElementHandlers = eventElementHandlers;
t.showEvents = showEvents;
t.hideEvents = hideEvents;
// locals
- var eventsByID = {};
- var eventElements = [];
- var eventElementsByID = {};
+ var eventsByID = {}; // eventID mapped to array of events (there can be multiple b/c of repeating events)
+ var eventElementsByID = {}; // eventID mapped to array of jQuery elements
+ var eventElementCouples = []; // array of objects, { event, element } // TODO: unify with segment system
var options = calendar.options;
function opt(name, viewNameOverride) {
var v = options[name];
- if (typeof v == 'object') {
+ if ($.isPlainObject(v)) {
return smartProperty(v, viewNameOverride || viewName);
}
return v;
);
}
-
- /*
- function setOverflowHidden(bool) {
- element.css('overflow', bool ? 'hidden' : '');
- }
- */
-
+
+
+ /* Event Editable Boolean Calculations
+ ------------------------------------------------------------------------------*/
+
function isEventDraggable(event) {
- return isEventEditable(event) && !opt('disableDragging');
+ var source = event.source || {};
+ return firstDefined(
+ event.startEditable,
+ source.startEditable,
+ opt('eventStartEditable'),
+ event.editable,
+ source.editable,
+ opt('editable')
+ )
+ && !opt('disableDragging'); // deprecated
}
function isEventResizable(event) { // but also need to make sure the seg.isEnd == true
- return isEventEditable(event) && !opt('disableResizing');
- }
-
-
- function isEventEditable(event) {
- return firstDefined(event.editable, (event.source || {}).editable, opt('editable'));
+ var source = event.source || {};
+ return firstDefined(
+ event.durationEditable,
+ source.durationEditable,
+ opt('eventDurationEditable'),
+ event.editable,
+ source.editable,
+ opt('editable')
+ )
+ && !opt('disableResizing'); // deprecated
}
------------------------------------------------------------------------------*/
- // report when view receives new events
- function reportEvents(events) { // events are already normalized at this point
+ function setEventData(events) { // events are already normalized at this point
eventsByID = {};
var i, len=events.length, event;
for (i=0; i<len; i++) {
}
}
}
+
+
+ function clearEventData() {
+ eventsByID = {};
+ eventElementsByID = {};
+ eventElementCouples = [];
+ }
// returns a Date object for an event's end
// report when view creates an element for an event
function reportEventElement(event, element) {
- eventElements.push(element);
+ eventElementCouples.push({ event: event, element: element });
if (eventElementsByID[event._id]) {
eventElementsByID[event._id].push(element);
}else{
eventElementsByID[event._id] = [element];
}
}
-
-
- function reportEventClear() {
- eventElements = [];
- eventElementsByID = {};
+
+
+ function triggerEventDestroy() {
+ $.each(eventElementCouples, function(i, couple) {
+ t.trigger('eventDestroy', couple.event, couple.event, couple.element);
+ });
}
function eachEventElement(event, exceptElement, funcName) {
+ // NOTE: there may be multiple events per ID (repeating events)
+ // and multiple segments per event
var elements = eventElementsByID[event._id],
i, len = elements.length;
for (i=0; i<len; i++) {
normalizeEvent(e, options);
}
}
+
+
+
+ // ====================================================================================================
+ // Utilities for day "cells"
+ // ====================================================================================================
+ // The "basic" views are completely made up of day cells.
+ // The "agenda" views have day cells at the top "all day" slot.
+ // This was the obvious common place to put these utilities, but they should be abstracted out into
+ // a more meaningful class (like DayEventRenderer).
+ // ====================================================================================================
+
+
+ // For determining how a given "cell" translates into a "date":
+ //
+ // 1. Convert the "cell" (row and column) into a "cell offset" (the # of the cell, cronologically from the first).
+ // Keep in mind that column indices are inverted with isRTL. This is taken into account.
+ //
+ // 2. Convert the "cell offset" to a "day offset" (the # of days since the first visible day in the view).
+ //
+ // 3. Convert the "day offset" into a "date" (a JavaScript Date object).
+ //
+ // The reverse transformation happens when transforming a date into a cell.
+
+
+ // exports
+ t.isHiddenDay = isHiddenDay;
+ t.skipHiddenDays = skipHiddenDays;
+ t.getCellsPerWeek = getCellsPerWeek;
+ t.dateToCell = dateToCell;
+ t.dateToDayOffset = dateToDayOffset;
+ t.dayOffsetToCellOffset = dayOffsetToCellOffset;
+ t.cellOffsetToCell = cellOffsetToCell;
+ t.cellToDate = cellToDate;
+ t.cellToCellOffset = cellToCellOffset;
+ t.cellOffsetToDayOffset = cellOffsetToDayOffset;
+ t.dayOffsetToDate = dayOffsetToDate;
+ t.rangeToSegments = rangeToSegments;
+
+
+ // internals
+ var hiddenDays = opt('hiddenDays') || []; // array of day-of-week indices that are hidden
+ var isHiddenDayHash = []; // is the day-of-week hidden? (hash with day-of-week-index -> bool)
+ var cellsPerWeek;
+ var dayToCellMap = []; // hash from dayIndex -> cellIndex, for one week
+ var cellToDayMap = []; // hash from cellIndex -> dayIndex, for one week
+ var isRTL = opt('isRTL');
+
+
+ // initialize important internal variables
+ (function() {
+
+ if (opt('weekends') === false) {
+ hiddenDays.push(0, 6); // 0=sunday, 6=saturday
+ }
+
+ // Loop through a hypothetical week and determine which
+ // days-of-week are hidden. Record in both hashes (one is the reverse of the other).
+ for (var dayIndex=0, cellIndex=0; dayIndex<7; dayIndex++) {
+ dayToCellMap[dayIndex] = cellIndex;
+ isHiddenDayHash[dayIndex] = $.inArray(dayIndex, hiddenDays) != -1;
+ if (!isHiddenDayHash[dayIndex]) {
+ cellToDayMap[cellIndex] = dayIndex;
+ cellIndex++;
+ }
+ }
+
+ cellsPerWeek = cellIndex;
+ if (!cellsPerWeek) {
+ throw 'invalid hiddenDays'; // all days were hidden? bad.
+ }
+
+ })();
+
+
+ // Is the current day hidden?
+ // `day` is a day-of-week index (0-6), or a Date object
+ function isHiddenDay(day) {
+ if (typeof day == 'object') {
+ day = day.getDay();
+ }
+ return isHiddenDayHash[day];
+ }
+
+
+ function getCellsPerWeek() {
+ return cellsPerWeek;
+ }
+
+
+ // Keep incrementing the current day until it is no longer a hidden day.
+ // If the initial value of `date` is not a hidden day, don't do anything.
+ // Pass `isExclusive` as `true` if you are dealing with an end date.
+ // `inc` defaults to `1` (increment one day forward each time)
+ function skipHiddenDays(date, inc, isExclusive) {
+ inc = inc || 1;
+ while (
+ isHiddenDayHash[ ( date.getDay() + (isExclusive ? inc : 0) + 7 ) % 7 ]
+ ) {
+ addDays(date, inc);
+ }
+ }
+
+
+ //
+ // TRANSFORMATIONS: cell -> cell offset -> day offset -> date
+ //
+
+ // cell -> date (combines all transformations)
+ // Possible arguments:
+ // - row, col
+ // - { row:#, col: # }
+ function cellToDate() {
+ var cellOffset = cellToCellOffset.apply(null, arguments);
+ var dayOffset = cellOffsetToDayOffset(cellOffset);
+ var date = dayOffsetToDate(dayOffset);
+ return date;
+ }
+
+ // cell -> cell offset
+ // Possible arguments:
+ // - row, col
+ // - { row:#, col:# }
+ function cellToCellOffset(row, col) {
+ var colCnt = t.getColCnt();
+
+ // rtl variables. wish we could pre-populate these. but where?
+ var dis = isRTL ? -1 : 1;
+ var dit = isRTL ? colCnt - 1 : 0;
+
+ if (typeof row == 'object') {
+ col = row.col;
+ row = row.row;
+ }
+ var cellOffset = row * colCnt + (col * dis + dit); // column, adjusted for RTL (dis & dit)
+
+ return cellOffset;
+ }
+
+ // cell offset -> day offset
+ function cellOffsetToDayOffset(cellOffset) {
+ var day0 = t.visStart.getDay(); // first date's day of week
+ cellOffset += dayToCellMap[day0]; // normlize cellOffset to beginning-of-week
+ return Math.floor(cellOffset / cellsPerWeek) * 7 // # of days from full weeks
+ + cellToDayMap[ // # of days from partial last week
+ (cellOffset % cellsPerWeek + cellsPerWeek) % cellsPerWeek // crazy math to handle negative cellOffsets
+ ]
+ - day0; // adjustment for beginning-of-week normalization
+ }
+
+ // day offset -> date (JavaScript Date object)
+ function dayOffsetToDate(dayOffset) {
+ var date = cloneDate(t.visStart);
+ addDays(date, dayOffset);
+ return date;
+ }
+
+
+ //
+ // TRANSFORMATIONS: date -> day offset -> cell offset -> cell
+ //
+
+ // date -> cell (combines all transformations)
+ function dateToCell(date) {
+ var dayOffset = dateToDayOffset(date);
+ var cellOffset = dayOffsetToCellOffset(dayOffset);
+ var cell = cellOffsetToCell(cellOffset);
+ return cell;
+ }
+
+ // date -> day offset
+ function dateToDayOffset(date) {
+ return dayDiff(date, t.visStart);
+ }
+
+ // day offset -> cell offset
+ function dayOffsetToCellOffset(dayOffset) {
+ var day0 = t.visStart.getDay(); // first date's day of week
+ dayOffset += day0; // normalize dayOffset to beginning-of-week
+ return Math.floor(dayOffset / 7) * cellsPerWeek // # of cells from full weeks
+ + dayToCellMap[ // # of cells from partial last week
+ (dayOffset % 7 + 7) % 7 // crazy math to handle negative dayOffsets
+ ]
+ - dayToCellMap[day0]; // adjustment for beginning-of-week normalization
+ }
+
+ // cell offset -> cell (object with row & col keys)
+ function cellOffsetToCell(cellOffset) {
+ var colCnt = t.getColCnt();
+
+ // rtl variables. wish we could pre-populate these. but where?
+ var dis = isRTL ? -1 : 1;
+ var dit = isRTL ? colCnt - 1 : 0;
+
+ var row = Math.floor(cellOffset / colCnt);
+ var col = ((cellOffset % colCnt + colCnt) % colCnt) * dis + dit; // column, adjusted for RTL (dis & dit)
+ return {
+ row: row,
+ col: col
+ };
+ }
+
+
+ //
+ // Converts a date range into an array of segment objects.
+ // "Segments" are horizontal stretches of time, sliced up by row.
+ // A segment object has the following properties:
+ // - row
+ // - cols
+ // - isStart
+ // - isEnd
+ //
+ function rangeToSegments(startDate, endDate) {
+ var rowCnt = t.getRowCnt();
+ var colCnt = t.getColCnt();
+ var segments = []; // array of segments to return
+
+ // day offset for given date range
+ var rangeDayOffsetStart = dateToDayOffset(startDate);
+ var rangeDayOffsetEnd = dateToDayOffset(endDate); // exclusive
+
+ // first and last cell offset for the given date range
+ // "last" implies inclusivity
+ var rangeCellOffsetFirst = dayOffsetToCellOffset(rangeDayOffsetStart);
+ var rangeCellOffsetLast = dayOffsetToCellOffset(rangeDayOffsetEnd) - 1;
+
+ // loop through all the rows in the view
+ for (var row=0; row<rowCnt; row++) {
+
+ // first and last cell offset for the row
+ var rowCellOffsetFirst = row * colCnt;
+ var rowCellOffsetLast = rowCellOffsetFirst + colCnt - 1;
+
+ // get the segment's cell offsets by constraining the range's cell offsets to the bounds of the row
+ var segmentCellOffsetFirst = Math.max(rangeCellOffsetFirst, rowCellOffsetFirst);
+ var segmentCellOffsetLast = Math.min(rangeCellOffsetLast, rowCellOffsetLast);
+
+ // make sure segment's offsets are valid and in view
+ if (segmentCellOffsetFirst <= segmentCellOffsetLast) {
+
+ // translate to cells
+ var segmentCellFirst = cellOffsetToCell(segmentCellOffsetFirst);
+ var segmentCellLast = cellOffsetToCell(segmentCellOffsetLast);
+
+ // view might be RTL, so order by leftmost column
+ var cols = [ segmentCellFirst.col, segmentCellLast.col ].sort();
+
+ // Determine if segment's first/last cell is the beginning/end of the date range.
+ // We need to compare "day offset" because "cell offsets" are often ambiguous and
+ // can translate to multiple days, and an edge case reveals itself when we the
+ // range's first cell is hidden (we don't want isStart to be true).
+ var isStart = cellOffsetToDayOffset(segmentCellOffsetFirst) == rangeDayOffsetStart;
+ var isEnd = cellOffsetToDayOffset(segmentCellOffsetLast) + 1 == rangeDayOffsetEnd; // +1 for comparing exclusively
+
+ segments.push({
+ row: row,
+ leftCol: cols[0],
+ rightCol: cols[1],
+ isStart: isStart,
+ isEnd: isEnd
+ });
+ }
+ }
+
+ return segments;
+ }
}
+;;
+
function DayEventRenderer() {
var t = this;
// exports
- t.renderDaySegs = renderDaySegs;
- t.resizableDayEvent = resizableDayEvent;
+ t.renderDayEvents = renderDayEvents;
+ t.draggableDayEvent = draggableDayEvent; // made public so that subclasses can override
+ t.resizableDayEvent = resizableDayEvent; // "
// imports
var isEventResizable = t.isEventResizable;
var eventEnd = t.eventEnd;
var reportEventElement = t.reportEventElement;
+ var eventElementHandlers = t.eventElementHandlers;
var showEvents = t.showEvents;
var hideEvents = t.hideEvents;
+ var eventDrop = t.eventDrop;
var eventResize = t.eventResize;
var getRowCnt = t.getRowCnt;
var getColCnt = t.getColCnt;
var getColWidth = t.getColWidth;
- var allDayRow = t.allDayRow;
- var allDayBounds = t.allDayBounds;
+ var allDayRow = t.allDayRow; // TODO: rename
+ var colLeft = t.colLeft;
+ var colRight = t.colRight;
var colContentLeft = t.colContentLeft;
var colContentRight = t.colContentRight;
- var dayOfWeekCol = t.dayOfWeekCol;
- var dateCell = t.dateCell;
- var compileDaySegs = t.compileDaySegs;
+ var dateToCell = t.dateToCell;
var getDaySegmentContainer = t.getDaySegmentContainer;
- var bindDaySeg = t.bindDaySeg; //TODO: streamline this
var formatDates = t.calendar.formatDates;
var renderDayOverlay = t.renderDayOverlay;
var clearOverlays = t.clearOverlays;
var clearSelection = t.clearSelection;
-
-
-
- /* Rendering
- -----------------------------------------------------------------------------*/
-
-
- function renderDaySegs(segs, modifiedEventId) {
- var segmentContainer = getDaySegmentContainer();
- var rowDivs;
- var rowCnt = getRowCnt();
- var colCnt = getColCnt();
- var i = 0;
- var rowI;
- var levelI;
- var colHeights;
- var j;
- var segCnt = segs.length;
- var seg;
- var top;
- var k;
- segmentContainer[0].innerHTML = daySegHTML(segs); // faster than .html()
- daySegElementResolve(segs, segmentContainer.children());
- daySegElementReport(segs);
- daySegHandlers(segs, segmentContainer, modifiedEventId);
- daySegCalcHSides(segs);
- daySegSetWidths(segs);
- daySegCalcHeights(segs);
- rowDivs = getRowDivs();
- // set row heights, calculate event tops (in relation to row top)
- for (rowI=0; rowI<rowCnt; rowI++) {
- levelI = 0;
- colHeights = [];
- for (j=0; j<colCnt; j++) {
- colHeights[j] = 0;
- }
- while (i<segCnt && (seg = segs[i]).row == rowI) {
- // loop through segs in a row
- top = arrayMax(colHeights.slice(seg.startCol, seg.endCol));
- seg.top = top;
- top += seg.outerHeight;
- for (k=seg.startCol; k<seg.endCol; k++) {
- colHeights[k] = top;
- }
- i++;
+ var getHoverListener = t.getHoverListener;
+ var rangeToSegments = t.rangeToSegments;
+ var cellToDate = t.cellToDate;
+ var cellToCellOffset = t.cellToCellOffset;
+ var cellOffsetToDayOffset = t.cellOffsetToDayOffset;
+ var dateToDayOffset = t.dateToDayOffset;
+ var dayOffsetToCellOffset = t.dayOffsetToCellOffset;
+
+
+ // Render `events` onto the calendar, attach mouse event handlers, and call the `eventAfterRender` callback for each.
+ // Mouse event will be lazily applied, except if the event has an ID of `modifiedEventId`.
+ // Can only be called when the event container is empty (because it wipes out all innerHTML).
+ function renderDayEvents(events, modifiedEventId) {
+
+ // do the actual rendering. Receive the intermediate "segment" data structures.
+ var segments = _renderDayEvents(
+ events,
+ false, // don't append event elements
+ true // set the heights of the rows
+ );
+
+ // report the elements to the View, for general drag/resize utilities
+ segmentElementEach(segments, function(segment, element) {
+ reportEventElement(segment.event, element);
+ });
+
+ // attach mouse handlers
+ attachHandlers(segments, modifiedEventId);
+
+ // call `eventAfterRender` callback for each event
+ segmentElementEach(segments, function(segment, element) {
+ trigger('eventAfterRender', segment.event, segment.event, element);
+ });
+ }
+
+
+ // Render an event on the calendar, but don't report them anywhere, and don't attach mouse handlers.
+ // Append this event element to the event container, which might already be populated with events.
+ // If an event's segment will have row equal to `adjustRow`, then explicitly set its top coordinate to `adjustTop`.
+ // This hack is used to maintain continuity when user is manually resizing an event.
+ // Returns an array of DOM elements for the event.
+ function renderTempDayEvent(event, adjustRow, adjustTop) {
+
+ // actually render the event. `true` for appending element to container.
+ // Recieve the intermediate "segment" data structures.
+ var segments = _renderDayEvents(
+ [ event ],
+ true, // append event elements
+ false // don't set the heights of the rows
+ );
+
+ var elements = [];
+
+ // Adjust certain elements' top coordinates
+ segmentElementEach(segments, function(segment, element) {
+ if (segment.row === adjustRow) {
+ element.css('top', adjustTop);
}
- rowDivs[rowI].height(arrayMax(colHeights));
- }
- daySegSetTops(segs, getRowTops(rowDivs));
+ elements.push(element[0]); // accumulate DOM nodes
+ });
+
+ return elements;
}
-
-
- function renderTempDaySegs(segs, adjustRow, adjustTop) {
- var tempContainer = $("<div/>");
+
+
+ // Render events onto the calendar. Only responsible for the VISUAL aspect.
+ // Not responsible for attaching handlers or calling callbacks.
+ // Set `doAppend` to `true` for rendering elements without clearing the existing container.
+ // Set `doRowHeights` to allow setting the height of each row, to compensate for vertical event overflow.
+ function _renderDayEvents(events, doAppend, doRowHeights) {
+
+ // where the DOM nodes will eventually end up
+ var finalContainer = getDaySegmentContainer();
+
+ // the container where the initial HTML will be rendered.
+ // If `doAppend`==true, uses a temporary container.
+ var renderContainer = doAppend ? $("<div/>") : finalContainer;
+
+ var segments = buildSegments(events);
+ var html;
var elements;
- var segmentContainer = getDaySegmentContainer();
- var i;
- var segCnt = segs.length;
- var element;
- tempContainer[0].innerHTML = daySegHTML(segs); // faster than .html()
- elements = tempContainer.children();
- segmentContainer.append(elements);
- daySegElementResolve(segs, elements);
- daySegCalcHSides(segs);
- daySegSetWidths(segs);
- daySegCalcHeights(segs);
- daySegSetTops(segs, getRowTops(getRowDivs()));
- elements = [];
- for (i=0; i<segCnt; i++) {
- element = segs[i].element;
- if (element) {
- if (segs[i].row === adjustRow) {
- element.css('top', adjustTop);
- }
- elements.push(element[0]);
- }
+
+ // calculate the desired `left` and `width` properties on each segment object
+ calculateHorizontals(segments);
+
+ // build the HTML string. relies on `left` property
+ html = buildHTML(segments);
+
+ // render the HTML. innerHTML is considerably faster than jQuery's .html()
+ renderContainer[0].innerHTML = html;
+
+ // retrieve the individual elements
+ elements = renderContainer.children();
+
+ // if we were appending, and thus using a temporary container,
+ // re-attach elements to the real container.
+ if (doAppend) {
+ finalContainer.append(elements);
+ }
+
+ // assigns each element to `segment.event`, after filtering them through user callbacks
+ resolveElements(segments, elements);
+
+ // Calculate the left and right padding+margin for each element.
+ // We need this for setting each element's desired outer width, because of the W3C box model.
+ // It's important we do this in a separate pass from acually setting the width on the DOM elements
+ // because alternating reading/writing dimensions causes reflow for every iteration.
+ segmentElementEach(segments, function(segment, element) {
+ segment.hsides = hsides(element, true); // include margins = `true`
+ });
+
+ // Set the width of each element
+ segmentElementEach(segments, function(segment, element) {
+ element.width(
+ Math.max(0, segment.outerWidth - segment.hsides)
+ );
+ });
+
+ // Grab each element's outerHeight (setVerticals uses this).
+ // To get an accurate reading, it's important to have each element's width explicitly set already.
+ segmentElementEach(segments, function(segment, element) {
+ segment.outerHeight = element.outerHeight(true); // include margins = `true`
+ });
+
+ // Set the top coordinate on each element (requires segment.outerHeight)
+ setVerticals(segments, doRowHeights);
+
+ return segments;
+ }
+
+
+ // Generate an array of "segments" for all events.
+ function buildSegments(events) {
+ var segments = [];
+ for (var i=0; i<events.length; i++) {
+ var eventSegments = buildSegmentsForEvent(events[i]);
+ segments.push.apply(segments, eventSegments); // append an array to an array
}
- return $(elements);
+ return segments;
}
-
-
- function daySegHTML(segs) { // also sets seg.left and seg.outerWidth
- var rtl = opt('isRTL');
- var i;
- var segCnt=segs.length;
- var seg;
- var event;
- var url;
- var classes;
- var bounds = allDayBounds();
- var minLeft = bounds.left;
- var maxLeft = bounds.right;
- var leftCol;
- var rightCol;
- var left;
- var right;
- var skinCss;
+
+
+ // Generate an array of segments for a single event.
+ // A "segment" is the same data structure that View.rangeToSegments produces,
+ // with the addition of the `event` property being set to reference the original event.
+ function buildSegmentsForEvent(event) {
+ var startDate = event.start;
+ var endDate = exclEndDay(event);
+ var segments = rangeToSegments(startDate, endDate);
+ for (var i=0; i<segments.length; i++) {
+ segments[i].event = event;
+ }
+ return segments;
+ }
+
+
+ // Sets the `left` and `outerWidth` property of each segment.
+ // These values are the desired dimensions for the eventual DOM elements.
+ function calculateHorizontals(segments) {
+ var isRTL = opt('isRTL');
+ for (var i=0; i<segments.length; i++) {
+ var segment = segments[i];
+
+ // Determine functions used for calulating the elements left/right coordinates,
+ // depending on whether the view is RTL or not.
+ // NOTE:
+ // colLeft/colRight returns the coordinate butting up the edge of the cell.
+ // colContentLeft/colContentRight is indented a little bit from the edge.
+ var leftFunc = (isRTL ? segment.isEnd : segment.isStart) ? colContentLeft : colLeft;
+ var rightFunc = (isRTL ? segment.isStart : segment.isEnd) ? colContentRight : colRight;
+
+ var left = leftFunc(segment.leftCol);
+ var right = rightFunc(segment.rightCol);
+ segment.left = left;
+ segment.outerWidth = right - left;
+ }
+ }
+
+
+ // Build a concatenated HTML string for an array of segments
+ function buildHTML(segments) {
+ var html = '';
+ for (var i=0; i<segments.length; i++) {
+ html += buildHTMLForSegment(segments[i]);
+ }
+ return html;
+ }
+
+
+ // Build an HTML string for a single segment.
+ // Relies on the following properties:
+ // - `segment.event` (from `buildSegmentsForEvent`)
+ // - `segment.left` (from `calculateHorizontals`)
+ function buildHTMLForSegment(segment) {
var html = '';
- // calculate desired position/dimensions, create html
- for (i=0; i<segCnt; i++) {
- seg = segs[i];
- event = seg.event;
- classes = ['fc-event', 'fc-event-skin', 'fc-event-hori'];
- if (isEventDraggable(event)) {
- classes.push('fc-event-draggable');
- }
- if (rtl) {
- if (seg.isStart) {
- classes.push('fc-corner-right');
- }
- if (seg.isEnd) {
- classes.push('fc-corner-left');
- }
- leftCol = dayOfWeekCol(seg.end.getDay()-1);
- rightCol = dayOfWeekCol(seg.start.getDay());
- left = seg.isEnd ? colContentLeft(leftCol) : minLeft;
- right = seg.isStart ? colContentRight(rightCol) : maxLeft;
- }else{
- if (seg.isStart) {
- classes.push('fc-corner-left');
- }
- if (seg.isEnd) {
- classes.push('fc-corner-right');
- }
- leftCol = dayOfWeekCol(seg.start.getDay());
- rightCol = dayOfWeekCol(seg.end.getDay()-1);
- left = seg.isStart ? colContentLeft(leftCol) : minLeft;
- right = seg.isEnd ? colContentRight(rightCol) : maxLeft;
- }
- classes = classes.concat(event.className);
- if (event.source) {
- classes = classes.concat(event.source.className || []);
- }
- url = event.url;
- skinCss = getSkinCss(event, opt);
- if (url) {
- html += "<a href='" + htmlEscape(url) + "'";
- }else{
- html += "<div";
- }
+ var isRTL = opt('isRTL');
+ var event = segment.event;
+ var url = event.url;
+
+ // generate the list of CSS classNames
+ var classNames = [ 'fc-event', 'fc-event-hori' ];
+ if (isEventDraggable(event)) {
+ classNames.push('fc-event-draggable');
+ }
+ if (segment.isStart) {
+ classNames.push('fc-event-start');
+ }
+ if (segment.isEnd) {
+ classNames.push('fc-event-end');
+ }
+ // use the event's configured classNames
+ // guaranteed to be an array via `normalizeEvent`
+ classNames = classNames.concat(event.className);
+ if (event.source) {
+ // use the event's source's classNames, if specified
+ classNames = classNames.concat(event.source.className || []);
+ }
+
+ // generate a semicolon delimited CSS string for any of the "skin" properties
+ // of the event object (`backgroundColor`, `borderColor` and such)
+ var skinCss = getSkinCss(event, opt);
+
+ if (url) {
+ html += "<a href='" + htmlEscape(url) + "'";
+ }else{
+ html += "<div";
+ }
+ html +=
+ " class='" + classNames.join(' ') + "'" +
+ " style=" +
+ "'" +
+ "position:absolute;" +
+ "left:" + segment.left + "px;" +
+ skinCss +
+ "'" +
+ ">" +
+ "<div class='fc-event-inner'>";
+ if (!event.allDay && segment.isStart) {
html +=
- " class='" + classes.join(' ') + "'" +
- " style='position:absolute;z-index:8;left:"+left+"px;" + skinCss + "'" +
- ">" +
- "<div" +
- " class='fc-event-inner fc-event-skin'" +
- (skinCss ? " style='" + skinCss + "'" : '') +
- ">";
- if (!event.allDay && seg.isStart) {
- html +=
- "<span class='fc-event-time'>" +
- htmlEscape(formatDates(event.start, event.end, opt('timeFormat'))) +
- "</span>";
- }
+ "<span class='fc-event-time'>" +
+ htmlEscape(
+ formatDates(event.start, event.end, opt('timeFormat'))
+ ) +
+ "</span>";
+ }
+ html +=
+ "<span class='fc-event-title'>" +
+ htmlEscape(event.title || '') +
+ "</span>" +
+ "</div>";
+ if (segment.isEnd && isEventResizable(event)) {
html +=
- "<span class='fc-event-title'>" + htmlEscape(event.title) + "</span>" +
+ "<div class='ui-resizable-handle ui-resizable-" + (isRTL ? 'w' : 'e') + "'>" +
+ " " + // makes hit area a lot better for IE6/7
"</div>";
- if (seg.isEnd && isEventResizable(event)) {
- html +=
- "<div class='ui-resizable-handle ui-resizable-" + (rtl ? 'w' : 'e') + "'>" +
- " " + // makes hit area a lot better for IE6/7
- "</div>";
- }
- html +=
- "</" + (url ? "a" : "div" ) + ">";
- seg.left = left;
- seg.outerWidth = right - left;
- seg.startCol = leftCol;
- seg.endCol = rightCol + 1; // needs to be exclusive
}
+ html += "</" + (url ? "a" : "div") + ">";
+
+ // TODO:
+ // When these elements are initially rendered, they will be briefly visibile on the screen,
+ // even though their widths/heights are not set.
+ // SOLUTION: initially set them as visibility:hidden ?
+
return html;
}
-
-
- function daySegElementResolve(segs, elements) { // sets seg.element
- var i;
- var segCnt = segs.length;
- var seg;
- var event;
- var element;
- var triggerRes;
- for (i=0; i<segCnt; i++) {
- seg = segs[i];
- event = seg.event;
- element = $(elements[i]); // faster than .eq()
- triggerRes = trigger('eventRender', event, event, element);
+
+
+ // Associate each segment (an object) with an element (a jQuery object),
+ // by setting each `segment.element`.
+ // Run each element through the `eventRender` filter, which allows developers to
+ // modify an existing element, supply a new one, or cancel rendering.
+ function resolveElements(segments, elements) {
+ for (var i=0; i<segments.length; i++) {
+ var segment = segments[i];
+ var event = segment.event;
+ var element = elements.eq(i);
+
+ // call the trigger with the original element
+ var triggerRes = trigger('eventRender', event, event, element);
+
if (triggerRes === false) {
+ // if `false`, remove the event from the DOM and don't assign it to `segment.event`
element.remove();
- }else{
+ }
+ else {
if (triggerRes && triggerRes !== true) {
+ // the trigger returned a new element, but not `true` (which means keep the existing element)
+
+ // re-assign the important CSS dimension properties that were already assigned in `buildHTMLForSegment`
triggerRes = $(triggerRes)
.css({
position: 'absolute',
- left: seg.left
+ left: segment.left
});
+
element.replaceWith(triggerRes);
element = triggerRes;
}
- seg.element = element;
+
+ segment.element = element;
}
}
}
-
-
- function daySegElementReport(segs) {
- var i;
- var segCnt = segs.length;
- var seg;
- var element;
- for (i=0; i<segCnt; i++) {
- seg = segs[i];
- element = seg.element;
- if (element) {
- reportEventElement(seg.event, element);
+
+
+
+ /* Top-coordinate Methods
+ -------------------------------------------------------------------------------------------------*/
+
+
+ // Sets the "top" CSS property for each element.
+ // If `doRowHeights` is `true`, also sets each row's first cell to an explicit height,
+ // so that if elements vertically overflow, the cell expands vertically to compensate.
+ function setVerticals(segments, doRowHeights) {
+ var rowContentHeights = calculateVerticals(segments); // also sets segment.top
+ var rowContentElements = getRowContentElements(); // returns 1 inner div per row
+ var rowContentTops = [];
+
+ // Set each row's height by setting height of first inner div
+ if (doRowHeights) {
+ for (var i=0; i<rowContentElements.length; i++) {
+ rowContentElements[i].height(rowContentHeights[i]);
}
}
+
+ // Get each row's top, relative to the views's origin.
+ // Important to do this after setting each row's height.
+ for (var i=0; i<rowContentElements.length; i++) {
+ rowContentTops.push(
+ rowContentElements[i].position().top
+ );
+ }
+
+ // Set each segment element's CSS "top" property.
+ // Each segment object has a "top" property, which is relative to the row's top, but...
+ segmentElementEach(segments, function(segment, element) {
+ element.css(
+ 'top',
+ rowContentTops[segment.row] + segment.top // ...now, relative to views's origin
+ );
+ });
}
-
-
- function daySegHandlers(segs, segmentContainer, modifiedEventId) {
- var i;
- var segCnt = segs.length;
- var seg;
- var element;
- var event;
- // retrieve elements, run through eventRender callback, bind handlers
- for (i=0; i<segCnt; i++) {
- seg = segs[i];
- element = seg.element;
- if (element) {
- event = seg.event;
- if (event._id === modifiedEventId) {
- bindDaySeg(event, element, seg);
- }else{
- element[0]._fci = i; // for lazySegBind
+
+
+ // Calculate the "top" coordinate for each segment, relative to the "top" of the row.
+ // Also, return an array that contains the "content" height for each row
+ // (the height displaced by the vertically stacked events in the row).
+ // Requires segments to have their `outerHeight` property already set.
+ function calculateVerticals(segments) {
+ var rowCnt = getRowCnt();
+ var colCnt = getColCnt();
+ var rowContentHeights = []; // content height for each row
+ var segmentRows = buildSegmentRows(segments); // an array of segment arrays, one for each row
+
+ for (var rowI=0; rowI<rowCnt; rowI++) {
+ var segmentRow = segmentRows[rowI];
+
+ // an array of running total heights for each column.
+ // initialize with all zeros.
+ var colHeights = [];
+ for (var colI=0; colI<colCnt; colI++) {
+ colHeights.push(0);
+ }
+
+ // loop through every segment
+ for (var segmentI=0; segmentI<segmentRow.length; segmentI++) {
+ var segment = segmentRow[segmentI];
+
+ // find the segment's top coordinate by looking at the max height
+ // of all the columns the segment will be in.
+ segment.top = arrayMax(
+ colHeights.slice(
+ segment.leftCol,
+ segment.rightCol + 1 // make exclusive for slice
+ )
+ );
+
+ // adjust the columns to account for the segment's height
+ for (var colI=segment.leftCol; colI<=segment.rightCol; colI++) {
+ colHeights[colI] = segment.top + segment.outerHeight;
}
}
+
+ // the tallest column in the row should be the "content height"
+ rowContentHeights.push(arrayMax(colHeights));
}
- lazySegBind(segmentContainer, segs, bindDaySeg);
+
+ return rowContentHeights;
}
-
-
- function daySegCalcHSides(segs) { // also sets seg.key
- var i;
- var segCnt = segs.length;
- var seg;
- var element;
- var key, val;
- var hsideCache = {};
- // record event horizontal sides
- for (i=0; i<segCnt; i++) {
- seg = segs[i];
- element = seg.element;
- if (element) {
- key = seg.key = cssKey(element[0]);
- val = hsideCache[key];
- if (val === undefined) {
- val = hsideCache[key] = hsides(element, true);
+
+
+ // Build an array of segment arrays, each representing the segments that will
+ // be in a row of the grid, sorted by which event should be closest to the top.
+ function buildSegmentRows(segments) {
+ var rowCnt = getRowCnt();
+ var segmentRows = [];
+ var segmentI;
+ var segment;
+ var rowI;
+
+ // group segments by row
+ for (segmentI=0; segmentI<segments.length; segmentI++) {
+ segment = segments[segmentI];
+ rowI = segment.row;
+ if (segment.element) { // was rendered?
+ if (segmentRows[rowI]) {
+ // already other segments. append to array
+ segmentRows[rowI].push(segment);
+ }
+ else {
+ // first segment in row. create new array
+ segmentRows[rowI] = [ segment ];
}
- seg.hsides = val;
}
}
+
+ // sort each row
+ for (rowI=0; rowI<rowCnt; rowI++) {
+ segmentRows[rowI] = sortSegmentRow(
+ segmentRows[rowI] || [] // guarantee an array, even if no segments
+ );
+ }
+
+ return segmentRows;
}
-
-
- function daySegSetWidths(segs) {
- var i;
- var segCnt = segs.length;
- var seg;
- var element;
- for (i=0; i<segCnt; i++) {
- seg = segs[i];
- element = seg.element;
- if (element) {
- element[0].style.width = Math.max(0, seg.outerWidth - seg.hsides) + 'px';
- }
+
+
+ // Sort an array of segments according to which segment should appear closest to the top
+ function sortSegmentRow(segments) {
+ var sortedSegments = [];
+
+ // build the subrow array
+ var subrows = buildSegmentSubrows(segments);
+
+ // flatten it
+ for (var i=0; i<subrows.length; i++) {
+ sortedSegments.push.apply(sortedSegments, subrows[i]); // append an array to an array
}
+
+ return sortedSegments;
}
-
-
- function daySegCalcHeights(segs) {
- var i;
- var segCnt = segs.length;
- var seg;
- var element;
- var key, val;
- var vmarginCache = {};
- // record event heights
- for (i=0; i<segCnt; i++) {
- seg = segs[i];
- element = seg.element;
- if (element) {
- key = seg.key; // created in daySegCalcHSides
- val = vmarginCache[key];
- if (val === undefined) {
- val = vmarginCache[key] = vmargins(element);
+
+
+ // Take an array of segments, which are all assumed to be in the same row,
+ // and sort into subrows.
+ function buildSegmentSubrows(segments) {
+
+ // Give preference to elements with certain criteria, so they have
+ // a chance to be closer to the top.
+ segments.sort(compareDaySegments);
+
+ var subrows = [];
+ for (var i=0; i<segments.length; i++) {
+ var segment = segments[i];
+
+ // loop through subrows, starting with the topmost, until the segment
+ // doesn't collide with other segments.
+ for (var j=0; j<subrows.length; j++) {
+ if (!isDaySegmentCollision(segment, subrows[j])) {
+ break;
}
- seg.outerHeight = element[0].offsetHeight + val;
+ }
+ // `j` now holds the desired subrow index
+ if (subrows[j]) {
+ subrows[j].push(segment);
+ }
+ else {
+ subrows[j] = [ segment ];
}
}
+
+ return subrows;
}
-
-
- function getRowDivs() {
+
+
+ // Return an array of jQuery objects for the placeholder content containers of each row.
+ // The content containers don't actually contain anything, but their dimensions should match
+ // the events that are overlaid on top.
+ function getRowContentElements() {
var i;
var rowCnt = getRowCnt();
var rowDivs = [];
for (i=0; i<rowCnt; i++) {
rowDivs[i] = allDayRow(i)
- .find('td:first div.fc-day-content > div'); // optimal selector?
+ .find('div.fc-day-content > div');
}
return rowDivs;
}
-
-
- function getRowTops(rowDivs) {
- var i;
- var rowCnt = rowDivs.length;
- var tops = [];
- for (i=0; i<rowCnt; i++) {
- tops[i] = rowDivs[i][0].offsetTop; // !!?? but this means the element needs position:relative if in a table cell!!!!
+
+
+
+ /* Mouse Handlers
+ ---------------------------------------------------------------------------------------------------*/
+ // TODO: better documentation!
+
+
+ function attachHandlers(segments, modifiedEventId) {
+ var segmentContainer = getDaySegmentContainer();
+
+ segmentElementEach(segments, function(segment, element, i) {
+ var event = segment.event;
+ if (event._id === modifiedEventId) {
+ bindDaySeg(event, element, segment);
+ }else{
+ element[0]._fci = i; // for lazySegBind
+ }
+ });
+
+ lazySegBind(segmentContainer, segments, bindDaySeg);
+ }
+
+
+ function bindDaySeg(event, eventElement, segment) {
+
+ if (isEventDraggable(event)) {
+ t.draggableDayEvent(event, eventElement, segment); // use `t` so subclasses can override
+ }
+
+ if (
+ segment.isEnd && // only allow resizing on the final segment for an event
+ isEventResizable(event)
+ ) {
+ t.resizableDayEvent(event, eventElement, segment); // use `t` so subclasses can override
}
- return tops;
+
+ // attach all other handlers.
+ // needs to be after, because resizableDayEvent might stopImmediatePropagation on click
+ eventElementHandlers(event, eventElement);
}
+
-
- function daySegSetTops(segs, rowTops) { // also triggers eventAfterRender
- var i;
- var segCnt = segs.length;
- var seg;
- var element;
- var event;
- for (i=0; i<segCnt; i++) {
- seg = segs[i];
- element = seg.element;
- if (element) {
- element[0].style.top = rowTops[seg.row] + (seg.top||0) + 'px';
- event = seg.event;
- trigger('eventAfterRender', event, event, element);
+ function draggableDayEvent(event, eventElement) {
+ var hoverListener = getHoverListener();
+ var dayDelta;
+ eventElement.draggable({
+ delay: 50,
+ opacity: opt('dragOpacity'),
+ revertDuration: opt('dragRevertDuration'),
+ start: function(ev, ui) {
+ trigger('eventDragStart', eventElement, event, ev, ui);
+ hideEvents(event, eventElement);
+ hoverListener.start(function(cell, origCell, rowDelta, colDelta) {
+ eventElement.draggable('option', 'revert', !cell || !rowDelta && !colDelta);
+ clearOverlays();
+ if (cell) {
+ var origDate = cellToDate(origCell);
+ var date = cellToDate(cell);
+ dayDelta = dayDiff(date, origDate);
+ renderDayOverlay(
+ addDays(cloneDate(event.start), dayDelta),
+ addDays(exclEndDay(event), dayDelta)
+ );
+ }else{
+ dayDelta = 0;
+ }
+ }, ev, 'drag');
+ },
+ stop: function(ev, ui) {
+ hoverListener.stop();
+ clearOverlays();
+ trigger('eventDragStop', eventElement, event, ev, ui);
+ if (dayDelta) {
+ eventDrop(this, event, dayDelta, 0, event.allDay, ev, ui);
+ }else{
+ eventElement.css('filter', ''); // clear IE opacity side-effects
+ showEvents(event, eventElement);
+ }
}
- }
+ });
}
+
-
-
- /* Resizing
- -----------------------------------------------------------------------------------*/
-
-
- function resizableDayEvent(event, element, seg) {
- var rtl = opt('isRTL');
- var direction = rtl ? 'w' : 'e';
- var handle = element.find('div.ui-resizable-' + direction);
+ function resizableDayEvent(event, element, segment) {
+ var isRTL = opt('isRTL');
+ var direction = isRTL ? 'w' : 'e';
+ var handle = element.find('.ui-resizable-' + direction); // TODO: stop using this class because we aren't using jqui for this
var isResizing = false;
// TODO: look into using jquery-ui mouse widget for this stuff
return; // needs to be left mouse button
}
isResizing = true;
- var hoverListener = t.getHoverListener();
+ var hoverListener = getHoverListener();
var rowCnt = getRowCnt();
var colCnt = getColCnt();
- var dis = rtl ? -1 : 1;
- var dit = rtl ? colCnt-1 : 0;
var elementTop = element.css('top');
var dayDelta;
var helpers;
var eventCopy = $.extend({}, event);
- var minCell = dateCell(event.start);
+ var minCellOffset = dayOffsetToCellOffset( dateToDayOffset(event.start) );
clearSelection();
$('body')
.css('cursor', direction + '-resize')
trigger('eventResizeStart', this, event, ev);
hoverListener.start(function(cell, origCell) {
if (cell) {
- var r = Math.max(minCell.row, cell.row);
- var c = cell.col;
- if (rowCnt == 1) {
- r = 0; // hack for all-day area in agenda views
- }
- if (r == minCell.row) {
- if (rtl) {
- c = Math.min(minCell.col, c);
- }else{
- c = Math.max(minCell.col, c);
- }
- }
- dayDelta = (r*7 + c*dis+dit) - (origCell.row*7 + origCell.col*dis+dit);
- var newEnd = addDays(eventEnd(event), dayDelta, true);
+
+ var origCellOffset = cellToCellOffset(origCell);
+ var cellOffset = cellToCellOffset(cell);
+
+ // don't let resizing move earlier than start date cell
+ cellOffset = Math.max(cellOffset, minCellOffset);
+
+ dayDelta =
+ cellOffsetToDayOffset(cellOffset) -
+ cellOffsetToDayOffset(origCellOffset);
+
if (dayDelta) {
- eventCopy.end = newEnd;
+ eventCopy.end = addDays(eventEnd(event), dayDelta, true);
var oldHelpers = helpers;
- helpers = renderTempDaySegs(compileDaySegs([eventCopy]), seg.row, elementTop);
+
+ helpers = renderTempDayEvent(eventCopy, segment.row, elementTop);
+ helpers = $(helpers); // turn array into a jQuery object
+
helpers.find('*').css('cursor', direction + '-resize');
if (oldHelpers) {
oldHelpers.remove();
}
+
hideEvents(event);
- }else{
+ }
+ else {
if (helpers) {
showEvents(event);
helpers.remove();
}
}
clearOverlays();
- renderDayOverlay(event.start, addDays(cloneDate(newEnd), 1)); // coordinate grid already rebuild at hoverListener.start
+ renderDayOverlay( // coordinate grid already rebuilt with hoverListener.start()
+ event.start,
+ addDays( exclEndDay(event), dayDelta )
+ // TODO: instead of calling renderDayOverlay() with dates,
+ // call _renderDayOverlay (or whatever) with cell offsets.
+ );
}
}, ev);
isResizing = false;
},0);
}
-
});
}
}
+
+
+/* Generalized Segment Utilities
+-------------------------------------------------------------------------------------------------*/
+
+
+function isDaySegmentCollision(segment, otherSegments) {
+ for (var i=0; i<otherSegments.length; i++) {
+ var otherSegment = otherSegments[i];
+ if (
+ otherSegment.leftCol <= segment.rightCol &&
+ otherSegment.rightCol >= segment.leftCol
+ ) {
+ return true;
+ }
+ }
+ return false;
+}
+
+
+function segmentElementEach(segments, callback) { // TODO: use in AgendaView?
+ for (var i=0; i<segments.length; i++) {
+ var segment = segments[i];
+ var element = segment.element;
+ if (element) {
+ callback(segment, element, i);
+ }
+ }
+}
+
+
+// A cmp function for determining which segments should appear higher up
+function compareDaySegments(a, b) {
+ return (b.rightCol - b.leftCol) - (a.rightCol - a.leftCol) || // put wider events first
+ b.event.allDay - a.event.allDay || // if tie, put all-day events first (booleans cast to 0/1)
+ a.event.start - b.event.start || // if a tie, sort by event start date
+ (a.event.title || '').localeCompare(b.event.title) // if a tie, sort by event title
+}
+
+
+;;
+
//BUG: unselect needs to be triggered when events are dragged+dropped
function SelectionManager() {
function daySelectionMousedown(ev) { // not really a generic manager method, oh well
- var cellDate = t.cellDate;
- var cellIsAllDay = t.cellIsAllDay;
+ var cellToDate = t.cellToDate;
+ var getIsCellAllDay = t.getIsCellAllDay;
var hoverListener = t.getHoverListener();
var reportDayClick = t.reportDayClick; // this is hacky and sort of weird
if (ev.which == 1 && opt('selectable')) { // which==1 means left mouse button
unselect(ev);
var _mousedownElement = this;
var dates;
- hoverListener.start(function(cell, origCell) { // TODO: maybe put cellDate/cellIsAllDay info in cell
+ hoverListener.start(function(cell, origCell) { // TODO: maybe put cellToDate/getIsCellAllDay info in cell
clearSelection();
- if (cell && cellIsAllDay(cell)) {
- dates = [ cellDate(origCell), cellDate(cell) ].sort(cmp);
+ if (cell && getIsCellAllDay(cell)) {
+ dates = [ cellToDate(origCell), cellToDate(cell) ].sort(dateCompare);
renderSelection(dates[0], dates[1], true);
}else{
dates = null;
}
+
+;;
function OverlayManager() {
var t = this;
}
+;;
+
function CoordinateGrid(buildFunc) {
var t = this;
}
+;;
+
function HoverListener(coordinateGrid) {
event.pageY = event.originalEvent.pageY;
}
}
+;;
+
function HorizontalPositionCache(getElement) {
var t = this,
};
}
-\r
-})(jQuery);
+
+;;
+
+})(jQuery);
\ No newline at end of file
-/*
-
- FullCalendar v1.5.3
- http://arshaw.com/fullcalendar/
-
- Use fullcalendar.css for basic styling.
- For event drag & drop, requires jQuery UI draggable.
- For event resizing, requires jQuery UI resizable.
-
- Copyright (c) 2011 Adam Shaw
- Dual licensed under the MIT and GPL licenses, located in
- MIT-LICENSE.txt and GPL-LICENSE.txt respectively.
-
- Date: Mon Feb 6 22:40:40 2012 -0800
-
-*/
-(function(m,ma){function wb(a){m.extend(true,Ya,a)}function Yb(a,b,e){function d(k){if(E){u();q();na();S(k)}else f()}function f(){B=b.theme?"ui":"fc";a.addClass("fc");b.isRTL&&a.addClass("fc-rtl");b.theme&&a.addClass("ui-widget");E=m("<div class='fc-content' style='position:relative'/>").prependTo(a);C=new Zb(X,b);(P=C.render())&&a.prepend(P);y(b.defaultView);m(window).resize(oa);t()||g()}function g(){setTimeout(function(){!n.start&&t()&&S()},0)}function l(){m(window).unbind("resize",oa);C.destroy();
-E.remove();a.removeClass("fc fc-rtl ui-widget")}function j(){return i.offsetWidth!==0}function t(){return m("body")[0].offsetWidth!==0}function y(k){if(!n||k!=n.name){F++;pa();var D=n,Z;if(D){(D.beforeHide||xb)();Za(E,E.height());D.element.hide()}else Za(E,1);E.css("overflow","hidden");if(n=Y[k])n.element.show();else n=Y[k]=new Ja[k](Z=s=m("<div class='fc-view fc-view-"+k+"' style='position:absolute'/>").appendTo(E),X);D&&C.deactivateButton(D.name);C.activateButton(k);S();E.css("overflow","");D&&
-Za(E,1);Z||(n.afterShow||xb)();F--}}function S(k){if(j()){F++;pa();o===ma&&u();var D=false;if(!n.start||k||r<n.start||r>=n.end){n.render(r,k||0);fa(true);D=true}else if(n.sizeDirty){n.clearEvents();fa();D=true}else if(n.eventsDirty){n.clearEvents();D=true}n.sizeDirty=false;n.eventsDirty=false;ga(D);W=a.outerWidth();C.updateTitle(n.title);k=new Date;k>=n.start&&k<n.end?C.disableButton("today"):C.enableButton("today");F--;n.trigger("viewDisplay",i)}}function Q(){q();if(j()){u();fa();pa();n.clearEvents();
-n.renderEvents(J);n.sizeDirty=false}}function q(){m.each(Y,function(k,D){D.sizeDirty=true})}function u(){o=b.contentHeight?b.contentHeight:b.height?b.height-(P?P.height():0)-Sa(E):Math.round(E.width()/Math.max(b.aspectRatio,0.5))}function fa(k){F++;n.setHeight(o,k);if(s){s.css("position","relative");s=null}n.setWidth(E.width(),k);F--}function oa(){if(!F)if(n.start){var k=++v;setTimeout(function(){if(k==v&&!F&&j())if(W!=(W=a.outerWidth())){F++;Q();n.trigger("windowResize",i);F--}},200)}else g()}function ga(k){if(!b.lazyFetching||
-ya(n.visStart,n.visEnd))ra();else k&&da()}function ra(){K(n.visStart,n.visEnd)}function sa(k){J=k;da()}function ha(k){da(k)}function da(k){na();if(j()){n.clearEvents();n.renderEvents(J,k);n.eventsDirty=false}}function na(){m.each(Y,function(k,D){D.eventsDirty=true})}function ua(k,D,Z){n.select(k,D,Z===ma?true:Z)}function pa(){n&&n.unselect()}function U(){S(-1)}function ca(){S(1)}function ka(){gb(r,-1);S()}function qa(){gb(r,1);S()}function G(){r=new Date;S()}function p(k,D,Z){if(k instanceof Date)r=
-N(k);else yb(r,k,D,Z);S()}function L(k,D,Z){k!==ma&&gb(r,k);D!==ma&&hb(r,D);Z!==ma&&ba(r,Z);S()}function c(){return N(r)}function z(){return n}function H(k,D){if(D===ma)return b[k];if(k=="height"||k=="contentHeight"||k=="aspectRatio"){b[k]=D;Q()}}function T(k,D){if(b[k])return b[k].apply(D||i,Array.prototype.slice.call(arguments,2))}var X=this;X.options=b;X.render=d;X.destroy=l;X.refetchEvents=ra;X.reportEvents=sa;X.reportEventChange=ha;X.rerenderEvents=da;X.changeView=y;X.select=ua;X.unselect=pa;
-X.prev=U;X.next=ca;X.prevYear=ka;X.nextYear=qa;X.today=G;X.gotoDate=p;X.incrementDate=L;X.formatDate=function(k,D){return Oa(k,D,b)};X.formatDates=function(k,D,Z){return ib(k,D,Z,b)};X.getDate=c;X.getView=z;X.option=H;X.trigger=T;$b.call(X,b,e);var ya=X.isFetchNeeded,K=X.fetchEvents,i=a[0],C,P,E,B,n,Y={},W,o,s,v=0,F=0,r=new Date,J=[],M;yb(r,b.year,b.month,b.date);b.droppable&&m(document).bind("dragstart",function(k,D){var Z=k.target,ja=m(Z);if(!ja.parents(".fc").length){var ia=b.dropAccept;if(m.isFunction(ia)?
-ia.call(Z,ja):ja.is(ia)){M=Z;n.dragStart(M,k,D)}}}).bind("dragstop",function(k,D){if(M){n.dragStop(M,k,D);M=null}})}function Zb(a,b){function e(){q=b.theme?"ui":"fc";if(b.header)return Q=m("<table class='fc-header' style='width:100%'/>").append(m("<tr/>").append(f("left")).append(f("center")).append(f("right")))}function d(){Q.remove()}function f(u){var fa=m("<td class='fc-header-"+u+"'/>");(u=b.header[u])&&m.each(u.split(" "),function(oa){oa>0&&fa.append("<span class='fc-header-space'/>");var ga;
-m.each(this.split(","),function(ra,sa){if(sa=="title"){fa.append("<span class='fc-header-title'><h2> </h2></span>");ga&&ga.addClass(q+"-corner-right");ga=null}else{var ha;if(a[sa])ha=a[sa];else if(Ja[sa])ha=function(){na.removeClass(q+"-state-hover");a.changeView(sa)};if(ha){ra=b.theme?jb(b.buttonIcons,sa):null;var da=jb(b.buttonText,sa),na=m("<span class='fc-button fc-button-"+sa+" "+q+"-state-default'><span class='fc-button-inner'><span class='fc-button-content'>"+(ra?"<span class='fc-icon-wrap'><span class='ui-icon ui-icon-"+
-ra+"'/></span>":da)+"</span><span class='fc-button-effect'><span></span></span></span></span>");if(na){na.click(function(){na.hasClass(q+"-state-disabled")||ha()}).mousedown(function(){na.not("."+q+"-state-active").not("."+q+"-state-disabled").addClass(q+"-state-down")}).mouseup(function(){na.removeClass(q+"-state-down")}).hover(function(){na.not("."+q+"-state-active").not("."+q+"-state-disabled").addClass(q+"-state-hover")},function(){na.removeClass(q+"-state-hover").removeClass(q+"-state-down")}).appendTo(fa);
-ga||na.addClass(q+"-corner-left");ga=na}}}});ga&&ga.addClass(q+"-corner-right")});return fa}function g(u){Q.find("h2").html(u)}function l(u){Q.find("span.fc-button-"+u).addClass(q+"-state-active")}function j(u){Q.find("span.fc-button-"+u).removeClass(q+"-state-active")}function t(u){Q.find("span.fc-button-"+u).addClass(q+"-state-disabled")}function y(u){Q.find("span.fc-button-"+u).removeClass(q+"-state-disabled")}var S=this;S.render=e;S.destroy=d;S.updateTitle=g;S.activateButton=l;S.deactivateButton=
-j;S.disableButton=t;S.enableButton=y;var Q=m([]),q}function $b(a,b){function e(c,z){return!ca||c<ca||z>ka}function d(c,z){ca=c;ka=z;L=[];c=++qa;G=z=U.length;for(var H=0;H<z;H++)f(U[H],c)}function f(c,z){g(c,function(H){if(z==qa){if(H){for(var T=0;T<H.length;T++){H[T].source=c;oa(H[T])}L=L.concat(H)}G--;G||ua(L)}})}function g(c,z){var H,T=Aa.sourceFetchers,X;for(H=0;H<T.length;H++){X=T[H](c,ca,ka,z);if(X===true)return;else if(typeof X=="object"){g(X,z);return}}if(H=c.events)if(m.isFunction(H)){u();
-H(N(ca),N(ka),function(C){z(C);fa()})}else m.isArray(H)?z(H):z();else if(c.url){var ya=c.success,K=c.error,i=c.complete;H=m.extend({},c.data||{});T=Ta(c.startParam,a.startParam);X=Ta(c.endParam,a.endParam);if(T)H[T]=Math.round(+ca/1E3);if(X)H[X]=Math.round(+ka/1E3);u();m.ajax(m.extend({},ac,c,{data:H,success:function(C){C=C||[];var P=$a(ya,this,arguments);if(m.isArray(P))C=P;z(C)},error:function(){$a(K,this,arguments);z()},complete:function(){$a(i,this,arguments);fa()}}))}else z()}function l(c){if(c=
-j(c)){G++;f(c,qa)}}function j(c){if(m.isFunction(c)||m.isArray(c))c={events:c};else if(typeof c=="string")c={url:c};if(typeof c=="object"){ga(c);U.push(c);return c}}function t(c){U=m.grep(U,function(z){return!ra(z,c)});L=m.grep(L,function(z){return!ra(z.source,c)});ua(L)}function y(c){var z,H=L.length,T,X=na().defaultEventEnd,ya=c.start-c._start,K=c.end?c.end-(c._end||X(c)):0;for(z=0;z<H;z++){T=L[z];if(T._id==c._id&&T!=c){T.start=new Date(+T.start+ya);T.end=c.end?T.end?new Date(+T.end+K):new Date(+X(T)+
-K):null;T.title=c.title;T.url=c.url;T.allDay=c.allDay;T.className=c.className;T.editable=c.editable;T.color=c.color;T.backgroudColor=c.backgroudColor;T.borderColor=c.borderColor;T.textColor=c.textColor;oa(T)}}oa(c);ua(L)}function S(c,z){oa(c);if(!c.source){if(z){pa.events.push(c);c.source=pa}L.push(c)}ua(L)}function Q(c){if(c){if(!m.isFunction(c)){var z=c+"";c=function(T){return T._id==z}}L=m.grep(L,c,true);for(H=0;H<U.length;H++)if(m.isArray(U[H].events))U[H].events=m.grep(U[H].events,c,true)}else{L=
-[];for(var H=0;H<U.length;H++)if(m.isArray(U[H].events))U[H].events=[]}ua(L)}function q(c){if(m.isFunction(c))return m.grep(L,c);else if(c){c+="";return m.grep(L,function(z){return z._id==c})}return L}function u(){p++||da("loading",null,true)}function fa(){--p||da("loading",null,false)}function oa(c){var z=c.source||{},H=Ta(z.ignoreTimezone,a.ignoreTimezone);c._id=c._id||(c.id===ma?"_fc"+bc++:c.id+"");if(c.date){if(!c.start)c.start=c.date;delete c.date}c._start=N(c.start=kb(c.start,H));c.end=kb(c.end,
-H);if(c.end&&c.end<=c.start)c.end=null;c._end=c.end?N(c.end):null;if(c.allDay===ma)c.allDay=Ta(z.allDayDefault,a.allDayDefault);if(c.className){if(typeof c.className=="string")c.className=c.className.split(/\s+/)}else c.className=[]}function ga(c){if(c.className){if(typeof c.className=="string")c.className=c.className.split(/\s+/)}else c.className=[];for(var z=Aa.sourceNormalizers,H=0;H<z.length;H++)z[H](c)}function ra(c,z){return c&&z&&sa(c)==sa(z)}function sa(c){return(typeof c=="object"?c.events||
-c.url:"")||c}var ha=this;ha.isFetchNeeded=e;ha.fetchEvents=d;ha.addEventSource=l;ha.removeEventSource=t;ha.updateEvent=y;ha.renderEvent=S;ha.removeEvents=Q;ha.clientEvents=q;ha.normalizeEvent=oa;var da=ha.trigger,na=ha.getView,ua=ha.reportEvents,pa={events:[]},U=[pa],ca,ka,qa=0,G=0,p=0,L=[];for(ha=0;ha<b.length;ha++)j(b[ha])}function gb(a,b,e){a.setFullYear(a.getFullYear()+b);e||Ka(a);return a}function hb(a,b,e){if(+a){b=a.getMonth()+b;var d=N(a);d.setDate(1);d.setMonth(b);a.setMonth(b);for(e||Ka(a);a.getMonth()!=
-d.getMonth();)a.setDate(a.getDate()+(a<d?1:-1))}return a}function ba(a,b,e){if(+a){b=a.getDate()+b;var d=N(a);d.setHours(9);d.setDate(b);a.setDate(b);e||Ka(a);lb(a,d)}return a}function lb(a,b){if(+a)for(;a.getDate()!=b.getDate();)a.setTime(+a+(a<b?1:-1)*cc)}function xa(a,b){a.setMinutes(a.getMinutes()+b);return a}function Ka(a){a.setHours(0);a.setMinutes(0);a.setSeconds(0);a.setMilliseconds(0);return a}function N(a,b){if(b)return Ka(new Date(+a));return new Date(+a)}function zb(){var a=0,b;do b=new Date(1970,
-a++,1);while(b.getHours());return b}function Fa(a,b,e){for(b=b||1;!a.getDay()||e&&a.getDay()==1||!e&&a.getDay()==6;)ba(a,b);return a}function Ca(a,b){return Math.round((N(a,true)-N(b,true))/Ab)}function yb(a,b,e,d){if(b!==ma&&b!=a.getFullYear()){a.setDate(1);a.setMonth(0);a.setFullYear(b)}if(e!==ma&&e!=a.getMonth()){a.setDate(1);a.setMonth(e)}d!==ma&&a.setDate(d)}function kb(a,b){if(typeof a=="object")return a;if(typeof a=="number")return new Date(a*1E3);if(typeof a=="string"){if(a.match(/^\d+(\.\d+)?$/))return new Date(parseFloat(a)*
-1E3);if(b===ma)b=true;return Bb(a,b)||(a?new Date(a):null)}return null}function Bb(a,b){a=a.match(/^([0-9]{4})(-([0-9]{2})(-([0-9]{2})([T ]([0-9]{2}):([0-9]{2})(:([0-9]{2})(\.([0-9]+))?)?(Z|(([-+])([0-9]{2})(:?([0-9]{2}))?))?)?)?)?$/);if(!a)return null;var e=new Date(a[1],0,1);if(b||!a[13]){b=new Date(a[1],0,1,9,0);if(a[3]){e.setMonth(a[3]-1);b.setMonth(a[3]-1)}if(a[5]){e.setDate(a[5]);b.setDate(a[5])}lb(e,b);a[7]&&e.setHours(a[7]);a[8]&&e.setMinutes(a[8]);a[10]&&e.setSeconds(a[10]);a[12]&&e.setMilliseconds(Number("0."+
-a[12])*1E3);lb(e,b)}else{e.setUTCFullYear(a[1],a[3]?a[3]-1:0,a[5]||1);e.setUTCHours(a[7]||0,a[8]||0,a[10]||0,a[12]?Number("0."+a[12])*1E3:0);if(a[14]){b=Number(a[16])*60+(a[18]?Number(a[18]):0);b*=a[15]=="-"?1:-1;e=new Date(+e+b*60*1E3)}}return e}function mb(a){if(typeof a=="number")return a*60;if(typeof a=="object")return a.getHours()*60+a.getMinutes();if(a=a.match(/(\d+)(?::(\d+))?\s*(\w+)?/)){var b=parseInt(a[1],10);if(a[3]){b%=12;if(a[3].toLowerCase().charAt(0)=="p")b+=12}return b*60+(a[2]?parseInt(a[2],
-10):0)}}function Oa(a,b,e){return ib(a,null,b,e)}function ib(a,b,e,d){d=d||Ya;var f=a,g=b,l,j=e.length,t,y,S,Q="";for(l=0;l<j;l++){t=e.charAt(l);if(t=="'")for(y=l+1;y<j;y++){if(e.charAt(y)=="'"){if(f){Q+=y==l+1?"'":e.substring(l+1,y);l=y}break}}else if(t=="(")for(y=l+1;y<j;y++){if(e.charAt(y)==")"){l=Oa(f,e.substring(l+1,y),d);if(parseInt(l.replace(/\D/,""),10))Q+=l;l=y;break}}else if(t=="[")for(y=l+1;y<j;y++){if(e.charAt(y)=="]"){t=e.substring(l+1,y);l=Oa(f,t,d);if(l!=Oa(g,t,d))Q+=l;l=y;break}}else if(t==
-"{"){f=b;g=a}else if(t=="}"){f=a;g=b}else{for(y=j;y>l;y--)if(S=dc[e.substring(l,y)]){if(f)Q+=S(f,d);l=y-1;break}if(y==l)if(f)Q+=t}}return Q}function Ua(a){return a.end?ec(a.end,a.allDay):ba(N(a.start),1)}function ec(a,b){a=N(a);return b||a.getHours()||a.getMinutes()?ba(a,1):Ka(a)}function fc(a,b){return(b.msLength-a.msLength)*100+(a.event.start-b.event.start)}function Cb(a,b){return a.end>b.start&&a.start<b.end}function nb(a,b,e,d){var f=[],g,l=a.length,j,t,y,S,Q;for(g=0;g<l;g++){j=a[g];t=j.start;
-y=b[g];if(y>e&&t<d){if(t<e){t=N(e);S=false}else{t=t;S=true}if(y>d){y=N(d);Q=false}else{y=y;Q=true}f.push({event:j,start:t,end:y,isStart:S,isEnd:Q,msLength:y-t})}}return f.sort(fc)}function ob(a){var b=[],e,d=a.length,f,g,l,j;for(e=0;e<d;e++){f=a[e];for(g=0;;){l=false;if(b[g])for(j=0;j<b[g].length;j++)if(Cb(b[g][j],f)){l=true;break}if(l)g++;else break}if(b[g])b[g].push(f);else b[g]=[f]}return b}function Db(a,b,e){a.unbind("mouseover").mouseover(function(d){for(var f=d.target,g;f!=this;){g=f;f=f.parentNode}if((f=
-g._fci)!==ma){g._fci=ma;g=b[f];e(g.event,g.element,g);m(d.target).trigger(d)}d.stopPropagation()})}function Va(a,b,e){for(var d=0,f;d<a.length;d++){f=m(a[d]);f.width(Math.max(0,b-pb(f,e)))}}function Eb(a,b,e){for(var d=0,f;d<a.length;d++){f=m(a[d]);f.height(Math.max(0,b-Sa(f,e)))}}function pb(a,b){return gc(a)+hc(a)+(b?ic(a):0)}function gc(a){return(parseFloat(m.curCSS(a[0],"paddingLeft",true))||0)+(parseFloat(m.curCSS(a[0],"paddingRight",true))||0)}function ic(a){return(parseFloat(m.curCSS(a[0],
-"marginLeft",true))||0)+(parseFloat(m.curCSS(a[0],"marginRight",true))||0)}function hc(a){return(parseFloat(m.curCSS(a[0],"borderLeftWidth",true))||0)+(parseFloat(m.curCSS(a[0],"borderRightWidth",true))||0)}function Sa(a,b){return jc(a)+kc(a)+(b?Fb(a):0)}function jc(a){return(parseFloat(m.curCSS(a[0],"paddingTop",true))||0)+(parseFloat(m.curCSS(a[0],"paddingBottom",true))||0)}function Fb(a){return(parseFloat(m.curCSS(a[0],"marginTop",true))||0)+(parseFloat(m.curCSS(a[0],"marginBottom",true))||0)}
-function kc(a){return(parseFloat(m.curCSS(a[0],"borderTopWidth",true))||0)+(parseFloat(m.curCSS(a[0],"borderBottomWidth",true))||0)}function Za(a,b){b=typeof b=="number"?b+"px":b;a.each(function(e,d){d.style.cssText+=";min-height:"+b+";_height:"+b})}function xb(){}function Gb(a,b){return a-b}function Hb(a){return Math.max.apply(Math,a)}function Pa(a){return(a<10?"0":"")+a}function jb(a,b){if(a[b]!==ma)return a[b];b=b.split(/(?=[A-Z])/);for(var e=b.length-1,d;e>=0;e--){d=a[b[e].toLowerCase()];if(d!==
-ma)return d}return a[""]}function Qa(a){return a.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""").replace(/\n/g,"<br />")}function Ib(a){return a.id+"/"+a.className+"/"+a.style.cssText.replace(/(^|;)\s*(top|left|width|height)\s*:[^;]*/ig,"")}function qb(a){a.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return false})}function ab(a){a.children().removeClass("fc-first fc-last").filter(":first-child").addClass("fc-first").end().filter(":last-child").addClass("fc-last")}
-function rb(a,b){a.each(function(e,d){d.className=d.className.replace(/^fc-\w*/,"fc-"+lc[b.getDay()])})}function Jb(a,b){var e=a.source||{},d=a.color,f=e.color,g=b("eventColor"),l=a.backgroundColor||d||e.backgroundColor||f||b("eventBackgroundColor")||g;d=a.borderColor||d||e.borderColor||f||b("eventBorderColor")||g;a=a.textColor||e.textColor||b("eventTextColor");b=[];l&&b.push("background-color:"+l);d&&b.push("border-color:"+d);a&&b.push("color:"+a);return b.join(";")}function $a(a,b,e){if(m.isFunction(a))a=
-[a];if(a){var d,f;for(d=0;d<a.length;d++)f=a[d].apply(b,e)||f;return f}}function Ta(){for(var a=0;a<arguments.length;a++)if(arguments[a]!==ma)return arguments[a]}function mc(a,b){function e(j,t){if(t){hb(j,t);j.setDate(1)}j=N(j,true);j.setDate(1);t=hb(N(j),1);var y=N(j),S=N(t),Q=f("firstDay"),q=f("weekends")?0:1;if(q){Fa(y);Fa(S,-1,true)}ba(y,-((y.getDay()-Math.max(Q,q)+7)%7));ba(S,(7-S.getDay()+Math.max(Q,q))%7);Q=Math.round((S-y)/(Ab*7));if(f("weekMode")=="fixed"){ba(S,(6-Q)*7);Q=6}d.title=l(j,
-f("titleFormat"));d.start=j;d.end=t;d.visStart=y;d.visEnd=S;g(6,Q,q?5:7,true)}var d=this;d.render=e;sb.call(d,a,b,"month");var f=d.opt,g=d.renderBasic,l=b.formatDate}function nc(a,b){function e(j,t){t&&ba(j,t*7);j=ba(N(j),-((j.getDay()-f("firstDay")+7)%7));t=ba(N(j),7);var y=N(j),S=N(t),Q=f("weekends");if(!Q){Fa(y);Fa(S,-1,true)}d.title=l(y,ba(N(S),-1),f("titleFormat"));d.start=j;d.end=t;d.visStart=y;d.visEnd=S;g(1,1,Q?7:5,false)}var d=this;d.render=e;sb.call(d,a,b,"basicWeek");var f=d.opt,g=d.renderBasic,
-l=b.formatDates}function oc(a,b){function e(j,t){if(t){ba(j,t);f("weekends")||Fa(j,t<0?-1:1)}d.title=l(j,f("titleFormat"));d.start=d.visStart=N(j,true);d.end=d.visEnd=ba(N(d.start),1);g(1,1,1,false)}var d=this;d.render=e;sb.call(d,a,b,"basicDay");var f=d.opt,g=d.renderBasic,l=b.formatDate}function sb(a,b,e){function d(w,I,R,V){v=I;F=R;f();(I=!C)?g(w,V):z();l(I)}function f(){if(k=L("isRTL")){D=-1;Z=F-1}else{D=1;Z=0}ja=L("firstDay");ia=L("weekends")?0:1;la=L("theme")?"ui":"fc";$=L("columnFormat")}function g(w,
-I){var R,V=la+"-widget-header",ea=la+"-widget-content",aa;R="<table class='fc-border-separate' style='width:100%' cellspacing='0'><thead><tr>";for(aa=0;aa<F;aa++)R+="<th class='fc- "+V+"'/>";R+="</tr></thead><tbody>";for(aa=0;aa<w;aa++){R+="<tr class='fc-week"+aa+"'>";for(V=0;V<F;V++)R+="<td class='fc- "+ea+" fc-day"+(aa*F+V)+"'><div>"+(I?"<div class='fc-day-number'/>":"")+"<div class='fc-day-content'><div style='position:relative'> </div></div></div></td>";R+="</tr>"}R+="</tbody></table>";w=
-m(R).appendTo(a);K=w.find("thead");i=K.find("th");C=w.find("tbody");P=C.find("tr");E=C.find("td");B=E.filter(":first-child");n=P.eq(0).find("div.fc-day-content div");ab(K.add(K.find("tr")));ab(P);P.eq(0).addClass("fc-first");y(E);Y=m("<div style='position:absolute;z-index:8;top:0;left:0'/>").appendTo(a)}function l(w){var I=w||v==1,R=p.start.getMonth(),V=Ka(new Date),ea,aa,va;I&&i.each(function(wa,Ga){ea=m(Ga);aa=ca(wa);ea.html(ya(aa,$));rb(ea,aa)});E.each(function(wa,Ga){ea=m(Ga);aa=ca(wa);aa.getMonth()==
-R?ea.removeClass("fc-other-month"):ea.addClass("fc-other-month");+aa==+V?ea.addClass(la+"-state-highlight fc-today"):ea.removeClass(la+"-state-highlight fc-today");ea.find("div.fc-day-number").text(aa.getDate());I&&rb(ea,aa)});P.each(function(wa,Ga){va=m(Ga);if(wa<v){va.show();wa==v-1?va.addClass("fc-last"):va.removeClass("fc-last")}else va.hide()})}function j(w){o=w;w=o-K.height();var I,R,V;if(L("weekMode")=="variable")I=R=Math.floor(w/(v==1?2:6));else{I=Math.floor(w/v);R=w-I*(v-1)}B.each(function(ea,
-aa){if(ea<v){V=m(aa);Za(V.find("> div"),(ea==v-1?R:I)-Sa(V))}})}function t(w){W=w;M.clear();s=Math.floor(W/F);Va(i.slice(0,-1),s)}function y(w){w.click(S).mousedown(X)}function S(w){if(!L("selectable")){var I=parseInt(this.className.match(/fc\-day(\d+)/)[1]);I=ca(I);c("dayClick",this,I,true,w)}}function Q(w,I,R){R&&r.build();R=N(p.visStart);for(var V=ba(N(R),F),ea=0;ea<v;ea++){var aa=new Date(Math.max(R,w)),va=new Date(Math.min(V,I));if(aa<va){var wa;if(k){wa=Ca(va,R)*D+Z+1;aa=Ca(aa,R)*D+Z+1}else{wa=
-Ca(aa,R);aa=Ca(va,R)}y(q(ea,wa,ea,aa-1))}ba(R,7);ba(V,7)}}function q(w,I,R,V){w=r.rect(w,I,R,V,a);return H(w,a)}function u(w){return N(w)}function fa(w,I){Q(w,ba(N(I),1),true)}function oa(){T()}function ga(w,I,R){var V=ua(w);c("dayClick",E[V.row*F+V.col],w,I,R)}function ra(w,I){J.start(function(R){T();R&&q(R.row,R.col,R.row,R.col)},I)}function sa(w,I,R){var V=J.stop();T();if(V){V=pa(V);c("drop",w,V,true,I,R)}}function ha(w){return N(w.start)}function da(w){return M.left(w)}function na(w){return M.right(w)}
-function ua(w){return{row:Math.floor(Ca(w,p.visStart)/7),col:ka(w.getDay())}}function pa(w){return U(w.row,w.col)}function U(w,I){return ba(N(p.visStart),w*7+I*D+Z)}function ca(w){return U(Math.floor(w/F),w%F)}function ka(w){return(w-Math.max(ja,ia)+F)%F*D+Z}function qa(w){return P.eq(w)}function G(){return{left:0,right:W}}var p=this;p.renderBasic=d;p.setHeight=j;p.setWidth=t;p.renderDayOverlay=Q;p.defaultSelectionEnd=u;p.renderSelection=fa;p.clearSelection=oa;p.reportDayClick=ga;p.dragStart=ra;p.dragStop=
-sa;p.defaultEventEnd=ha;p.getHoverListener=function(){return J};p.colContentLeft=da;p.colContentRight=na;p.dayOfWeekCol=ka;p.dateCell=ua;p.cellDate=pa;p.cellIsAllDay=function(){return true};p.allDayRow=qa;p.allDayBounds=G;p.getRowCnt=function(){return v};p.getColCnt=function(){return F};p.getColWidth=function(){return s};p.getDaySegmentContainer=function(){return Y};Kb.call(p,a,b,e);Lb.call(p);Mb.call(p);pc.call(p);var L=p.opt,c=p.trigger,z=p.clearEvents,H=p.renderOverlay,T=p.clearOverlays,X=p.daySelectionMousedown,
-ya=b.formatDate,K,i,C,P,E,B,n,Y,W,o,s,v,F,r,J,M,k,D,Z,ja,ia,la,$;qb(a.addClass("fc-grid"));r=new Nb(function(w,I){var R,V,ea;i.each(function(aa,va){R=m(va);V=R.offset().left;if(aa)ea[1]=V;ea=[V];I[aa]=ea});ea[1]=V+R.outerWidth();P.each(function(aa,va){if(aa<v){R=m(va);V=R.offset().top;if(aa)ea[1]=V;ea=[V];w[aa]=ea}});ea[1]=V+R.outerHeight()});J=new Ob(r);M=new Pb(function(w){return n.eq(w)})}function pc(){function a(U,ca){S(U);ua(e(U),ca)}function b(){Q();ga().empty()}function e(U){var ca=da(),ka=
-na(),qa=N(g.visStart);ka=ba(N(qa),ka);var G=m.map(U,Ua),p,L,c,z,H,T,X=[];for(p=0;p<ca;p++){L=ob(nb(U,G,qa,ka));for(c=0;c<L.length;c++){z=L[c];for(H=0;H<z.length;H++){T=z[H];T.row=p;T.level=c;X.push(T)}}ba(qa,7);ba(ka,7)}return X}function d(U,ca,ka){t(U)&&f(U,ca);ka.isEnd&&y(U)&&pa(U,ca,ka);q(U,ca)}function f(U,ca){var ka=ra(),qa;ca.draggable({zIndex:9,delay:50,opacity:l("dragOpacity"),revertDuration:l("dragRevertDuration"),start:function(G,p){j("eventDragStart",ca,U,G,p);fa(U,ca);ka.start(function(L,
-c,z,H){ca.draggable("option","revert",!L||!z&&!H);ha();if(L){qa=z*7+H*(l("isRTL")?-1:1);sa(ba(N(U.start),qa),ba(Ua(U),qa))}else qa=0},G,"drag")},stop:function(G,p){ka.stop();ha();j("eventDragStop",ca,U,G,p);if(qa)oa(this,U,qa,0,U.allDay,G,p);else{ca.css("filter","");u(U,ca)}}})}var g=this;g.renderEvents=a;g.compileDaySegs=e;g.clearEvents=b;g.bindDaySeg=d;Qb.call(g);var l=g.opt,j=g.trigger,t=g.isEventDraggable,y=g.isEventResizable,S=g.reportEvents,Q=g.reportEventClear,q=g.eventElementHandlers,u=g.showEvents,
-fa=g.hideEvents,oa=g.eventDrop,ga=g.getDaySegmentContainer,ra=g.getHoverListener,sa=g.renderDayOverlay,ha=g.clearOverlays,da=g.getRowCnt,na=g.getColCnt,ua=g.renderDaySegs,pa=g.resizableDayEvent}function qc(a,b){function e(j,t){t&&ba(j,t*7);j=ba(N(j),-((j.getDay()-f("firstDay")+7)%7));t=ba(N(j),7);var y=N(j),S=N(t),Q=f("weekends");if(!Q){Fa(y);Fa(S,-1,true)}d.title=l(y,ba(N(S),-1),f("titleFormat"));d.start=j;d.end=t;d.visStart=y;d.visEnd=S;g(Q?7:5)}var d=this;d.render=e;Rb.call(d,a,b,"agendaWeek");
-var f=d.opt,g=d.renderAgenda,l=b.formatDates}function rc(a,b){function e(j,t){if(t){ba(j,t);f("weekends")||Fa(j,t<0?-1:1)}t=N(j,true);var y=ba(N(t),1);d.title=l(j,f("titleFormat"));d.start=d.visStart=t;d.end=d.visEnd=y;g(1)}var d=this;d.render=e;Rb.call(d,a,b,"agendaDay");var f=d.opt,g=d.renderAgenda,l=b.formatDate}function Rb(a,b,e){function d(h){Ba=h;f();v?P():g();l()}function f(){Wa=i("theme")?"ui":"fc";Sb=i("weekends")?0:1;Tb=i("firstDay");if(Ub=i("isRTL")){Ha=-1;Ia=Ba-1}else{Ha=1;Ia=0}La=mb(i("minTime"));
-bb=mb(i("maxTime"));Vb=i("columnFormat")}function g(){var h=Wa+"-widget-header",O=Wa+"-widget-content",x,A,ta,za,Da,Ea=i("slotMinutes")%15==0;x="<table style='width:100%' class='fc-agenda-days fc-border-separate' cellspacing='0'><thead><tr><th class='fc-agenda-axis "+h+"'> </th>";for(A=0;A<Ba;A++)x+="<th class='fc- fc-col"+A+" "+h+"'/>";x+="<th class='fc-agenda-gutter "+h+"'> </th></tr></thead><tbody><tr><th class='fc-agenda-axis "+h+"'> </th>";for(A=0;A<Ba;A++)x+="<td class='fc- fc-col"+
-A+" "+O+"'><div><div class='fc-day-content'><div style='position:relative'> </div></div></div></td>";x+="<td class='fc-agenda-gutter "+O+"'> </td></tr></tbody></table>";v=m(x).appendTo(a);F=v.find("thead");r=F.find("th").slice(1,-1);J=v.find("tbody");M=J.find("td").slice(0,-1);k=M.find("div.fc-day-content div");D=M.eq(0);Z=D.find("> div");ab(F.add(F.find("tr")));ab(J.add(J.find("tr")));aa=F.find("th:first");va=v.find(".fc-agenda-gutter");ja=m("<div style='position:absolute;z-index:2;left:0;width:100%'/>").appendTo(a);
-if(i("allDaySlot")){ia=m("<div style='position:absolute;z-index:8;top:0;left:0'/>").appendTo(ja);x="<table style='width:100%' class='fc-agenda-allday' cellspacing='0'><tr><th class='"+h+" fc-agenda-axis'>"+i("allDayText")+"</th><td><div class='fc-day-content'><div style='position:relative'/></div></td><th class='"+h+" fc-agenda-gutter'> </th></tr></table>";la=m(x).appendTo(ja);$=la.find("tr");q($.find("td"));aa=aa.add(la.find("th:first"));va=va.add(la.find("th.fc-agenda-gutter"));ja.append("<div class='fc-agenda-divider "+
-h+"'><div class='fc-agenda-divider-inner'/></div>")}else ia=m([]);w=m("<div style='position:absolute;width:100%;overflow-x:hidden;overflow-y:auto'/>").appendTo(ja);I=m("<div style='position:relative;width:100%;overflow:hidden'/>").appendTo(w);R=m("<div style='position:absolute;z-index:8;top:0;left:0'/>").appendTo(I);x="<table class='fc-agenda-slots' style='width:100%' cellspacing='0'><tbody>";ta=zb();za=xa(N(ta),bb);xa(ta,La);for(A=tb=0;ta<za;A++){Da=ta.getMinutes();x+="<tr class='fc-slot"+A+" "+
-(!Da?"":"fc-minor")+"'><th class='fc-agenda-axis "+h+"'>"+(!Ea||!Da?s(ta,i("axisFormat")):" ")+"</th><td class='"+O+"'><div style='position:relative'> </div></td></tr>";xa(ta,i("slotMinutes"));tb++}x+="</tbody></table>";V=m(x).appendTo(I);ea=V.find("div:first");u(V.find("td"));aa=aa.add(V.find("th:first"))}function l(){var h,O,x,A,ta=Ka(new Date);for(h=0;h<Ba;h++){A=ua(h);O=r.eq(h);O.html(s(A,Vb));x=M.eq(h);+A==+ta?x.addClass(Wa+"-state-highlight fc-today"):x.removeClass(Wa+"-state-highlight fc-today");
-rb(O.add(x),A)}}function j(h,O){if(h===ma)h=Wb;Wb=h;ub={};var x=J.position().top,A=w.position().top;h=Math.min(h-x,V.height()+A+1);Z.height(h-Sa(D));ja.css("top",x);w.height(h-A-1);Xa=ea.height()+1;O&&y()}function t(h){Ga=h;cb.clear();Ma=0;Va(aa.width("").each(function(O,x){Ma=Math.max(Ma,m(x).outerWidth())}),Ma);h=w[0].clientWidth;if(vb=w.width()-h){Va(va,vb);va.show().prev().removeClass("fc-last")}else va.hide().prev().addClass("fc-last");db=Math.floor((h-Ma)/Ba);Va(r.slice(0,-1),db)}function y(){function h(){w.scrollTop(A)}
-var O=zb(),x=N(O);x.setHours(i("firstHour"));var A=ca(O,x)+1;h();setTimeout(h,0)}function S(){Xb=w.scrollTop()}function Q(){w.scrollTop(Xb)}function q(h){h.click(fa).mousedown(W)}function u(h){h.click(fa).mousedown(H)}function fa(h){if(!i("selectable")){var O=Math.min(Ba-1,Math.floor((h.pageX-v.offset().left-Ma)/db)),x=ua(O),A=this.parentNode.className.match(/fc-slot(\d+)/);if(A){A=parseInt(A[1])*i("slotMinutes");var ta=Math.floor(A/60);x.setHours(ta);x.setMinutes(A%60+La);C("dayClick",M[O],x,false,
-h)}else C("dayClick",M[O],x,true,h)}}function oa(h,O,x){x&&Na.build();var A=N(K.visStart);if(Ub){x=Ca(O,A)*Ha+Ia+1;h=Ca(h,A)*Ha+Ia+1}else{x=Ca(h,A);h=Ca(O,A)}x=Math.max(0,x);h=Math.min(Ba,h);x<h&&q(ga(0,x,0,h-1))}function ga(h,O,x,A){h=Na.rect(h,O,x,A,ja);return E(h,ja)}function ra(h,O){for(var x=N(K.visStart),A=ba(N(x),1),ta=0;ta<Ba;ta++){var za=new Date(Math.max(x,h)),Da=new Date(Math.min(A,O));if(za<Da){var Ea=ta*Ha+Ia;Ea=Na.rect(0,Ea,0,Ea,I);za=ca(x,za);Da=ca(x,Da);Ea.top=za;Ea.height=Da-za;u(E(Ea,
-I))}ba(x,1);ba(A,1)}}function sa(h){return cb.left(h)}function ha(h){return cb.right(h)}function da(h){return{row:Math.floor(Ca(h,K.visStart)/7),col:U(h.getDay())}}function na(h){var O=ua(h.col);h=h.row;i("allDaySlot")&&h--;h>=0&&xa(O,La+h*i("slotMinutes"));return O}function ua(h){return ba(N(K.visStart),h*Ha+Ia)}function pa(h){return i("allDaySlot")&&!h.row}function U(h){return(h-Math.max(Tb,Sb)+Ba)%Ba*Ha+Ia}function ca(h,O){h=N(h,true);if(O<xa(N(h),La))return 0;if(O>=xa(N(h),bb))return V.height();
-h=i("slotMinutes");O=O.getHours()*60+O.getMinutes()-La;var x=Math.floor(O/h),A=ub[x];if(A===ma)A=ub[x]=V.find("tr:eq("+x+") td div")[0].offsetTop;return Math.max(0,Math.round(A-1+Xa*(O%h/h)))}function ka(){return{left:Ma,right:Ga-vb}}function qa(){return $}function G(h){var O=N(h.start);if(h.allDay)return O;return xa(O,i("defaultEventMinutes"))}function p(h,O){if(O)return N(h);return xa(N(h),i("slotMinutes"))}function L(h,O,x){if(x)i("allDaySlot")&&oa(h,ba(N(O),1),true);else c(h,O)}function c(h,O){var x=
-i("selectHelper");Na.build();if(x){var A=Ca(h,K.visStart)*Ha+Ia;if(A>=0&&A<Ba){A=Na.rect(0,A,0,A,I);var ta=ca(h,h),za=ca(h,O);if(za>ta){A.top=ta;A.height=za-ta;A.left+=2;A.width-=5;if(m.isFunction(x)){if(h=x(h,O)){A.position="absolute";A.zIndex=8;wa=m(h).css(A).appendTo(I)}}else{A.isStart=true;A.isEnd=true;wa=m(o({title:"",start:h,end:O,className:["fc-select-helper"],editable:false},A));wa.css("opacity",i("dragOpacity"))}if(wa){u(wa);I.append(wa);Va(wa,A.width,true);Eb(wa,A.height,true)}}}}else ra(h,
-O)}function z(){B();if(wa){wa.remove();wa=null}}function H(h){if(h.which==1&&i("selectable")){Y(h);var O;Ra.start(function(x,A){z();if(x&&x.col==A.col&&!pa(x)){A=na(A);x=na(x);O=[A,xa(N(A),i("slotMinutes")),x,xa(N(x),i("slotMinutes"))].sort(Gb);c(O[0],O[3])}else O=null},h);m(document).one("mouseup",function(x){Ra.stop();if(O){+O[0]==+O[1]&&T(O[0],false,x);n(O[0],O[3],false,x)}})}}function T(h,O,x){C("dayClick",M[U(h.getDay())],h,O,x)}function X(h,O){Ra.start(function(x){B();if(x)if(pa(x))ga(x.row,
-x.col,x.row,x.col);else{x=na(x);var A=xa(N(x),i("defaultEventMinutes"));ra(x,A)}},O)}function ya(h,O,x){var A=Ra.stop();B();A&&C("drop",h,na(A),pa(A),O,x)}var K=this;K.renderAgenda=d;K.setWidth=t;K.setHeight=j;K.beforeHide=S;K.afterShow=Q;K.defaultEventEnd=G;K.timePosition=ca;K.dayOfWeekCol=U;K.dateCell=da;K.cellDate=na;K.cellIsAllDay=pa;K.allDayRow=qa;K.allDayBounds=ka;K.getHoverListener=function(){return Ra};K.colContentLeft=sa;K.colContentRight=ha;K.getDaySegmentContainer=function(){return ia};
-K.getSlotSegmentContainer=function(){return R};K.getMinMinute=function(){return La};K.getMaxMinute=function(){return bb};K.getBodyContent=function(){return I};K.getRowCnt=function(){return 1};K.getColCnt=function(){return Ba};K.getColWidth=function(){return db};K.getSlotHeight=function(){return Xa};K.defaultSelectionEnd=p;K.renderDayOverlay=oa;K.renderSelection=L;K.clearSelection=z;K.reportDayClick=T;K.dragStart=X;K.dragStop=ya;Kb.call(K,a,b,e);Lb.call(K);Mb.call(K);sc.call(K);var i=K.opt,C=K.trigger,
-P=K.clearEvents,E=K.renderOverlay,B=K.clearOverlays,n=K.reportSelection,Y=K.unselect,W=K.daySelectionMousedown,o=K.slotSegHtml,s=b.formatDate,v,F,r,J,M,k,D,Z,ja,ia,la,$,w,I,R,V,ea,aa,va,wa,Ga,Wb,Ma,db,vb,Xa,Xb,Ba,tb,Na,Ra,cb,ub={},Wa,Tb,Sb,Ub,Ha,Ia,La,bb,Vb;qb(a.addClass("fc-agenda"));Na=new Nb(function(h,O){function x(eb){return Math.max(Ea,Math.min(tc,eb))}var A,ta,za;r.each(function(eb,uc){A=m(uc);ta=A.offset().left;if(eb)za[1]=ta;za=[ta];O[eb]=za});za[1]=ta+A.outerWidth();if(i("allDaySlot")){A=
-$;ta=A.offset().top;h[0]=[ta,ta+A.outerHeight()]}for(var Da=I.offset().top,Ea=w.offset().top,tc=Ea+w.outerHeight(),fb=0;fb<tb;fb++)h.push([x(Da+Xa*fb),x(Da+Xa*(fb+1))])});Ra=new Ob(Na);cb=new Pb(function(h){return k.eq(h)})}function sc(){function a(o,s){sa(o);var v,F=o.length,r=[],J=[];for(v=0;v<F;v++)o[v].allDay?r.push(o[v]):J.push(o[v]);if(u("allDaySlot")){L(e(r),s);na()}g(d(J),s)}function b(){ha();ua().empty();pa().empty()}function e(o){o=ob(nb(o,m.map(o,Ua),q.visStart,q.visEnd));var s,v=o.length,
-F,r,J,M=[];for(s=0;s<v;s++){F=o[s];for(r=0;r<F.length;r++){J=F[r];J.row=0;J.level=s;M.push(J)}}return M}function d(o){var s=z(),v=ka(),F=ca(),r=xa(N(q.visStart),v),J=m.map(o,f),M,k,D,Z,ja,ia,la=[];for(M=0;M<s;M++){k=ob(nb(o,J,r,xa(N(r),F-v)));vc(k);for(D=0;D<k.length;D++){Z=k[D];for(ja=0;ja<Z.length;ja++){ia=Z[ja];ia.col=M;ia.level=D;la.push(ia)}}ba(r,1,true)}return la}function f(o){return o.end?N(o.end):xa(N(o.start),u("defaultEventMinutes"))}function g(o,s){var v,F=o.length,r,J,M,k,D,Z,ja,ia,la,
-$="",w,I,R={},V={},ea=pa(),aa;v=z();if(w=u("isRTL")){I=-1;aa=v-1}else{I=1;aa=0}for(v=0;v<F;v++){r=o[v];J=r.event;M=qa(r.start,r.start);k=qa(r.start,r.end);D=r.col;Z=r.level;ja=r.forward||0;ia=G(D*I+aa);la=p(D*I+aa)-ia;la=Math.min(la-6,la*0.95);D=Z?la/(Z+ja+1):ja?(la/(ja+1)-6)*2:la;Z=ia+la/(Z+ja+1)*Z*I+(w?la-D:0);r.top=M;r.left=Z;r.outerWidth=D;r.outerHeight=k-M;$+=l(J,r)}ea[0].innerHTML=$;w=ea.children();for(v=0;v<F;v++){r=o[v];J=r.event;$=m(w[v]);I=fa("eventRender",J,J,$);if(I===false)$.remove();
-else{if(I&&I!==true){$.remove();$=m(I).css({position:"absolute",top:r.top,left:r.left}).appendTo(ea)}r.element=$;if(J._id===s)t(J,$,r);else $[0]._fci=v;ya(J,$)}}Db(ea,o,t);for(v=0;v<F;v++){r=o[v];if($=r.element){J=R[s=r.key=Ib($[0])];r.vsides=J===ma?(R[s]=Sa($,true)):J;J=V[s];r.hsides=J===ma?(V[s]=pb($,true)):J;s=$.find("div.fc-event-content");if(s.length)r.contentTop=s[0].offsetTop}}for(v=0;v<F;v++){r=o[v];if($=r.element){$[0].style.width=Math.max(0,r.outerWidth-r.hsides)+"px";R=Math.max(0,r.outerHeight-
-r.vsides);$[0].style.height=R+"px";J=r.event;if(r.contentTop!==ma&&R-r.contentTop<10){$.find("div.fc-event-time").text(Y(J.start,u("timeFormat"))+" - "+J.title);$.find("div.fc-event-title").remove()}fa("eventAfterRender",J,J,$)}}}function l(o,s){var v="<",F=o.url,r=Jb(o,u),J=r?" style='"+r+"'":"",M=["fc-event","fc-event-skin","fc-event-vert"];oa(o)&&M.push("fc-event-draggable");s.isStart&&M.push("fc-corner-top");s.isEnd&&M.push("fc-corner-bottom");M=M.concat(o.className);if(o.source)M=M.concat(o.source.className||
-[]);v+=F?"a href='"+Qa(o.url)+"'":"div";v+=" class='"+M.join(" ")+"' style='position:absolute;z-index:8;top:"+s.top+"px;left:"+s.left+"px;"+r+"'><div class='fc-event-inner fc-event-skin'"+J+"><div class='fc-event-head fc-event-skin'"+J+"><div class='fc-event-time'>"+Qa(W(o.start,o.end,u("timeFormat")))+"</div></div><div class='fc-event-content'><div class='fc-event-title'>"+Qa(o.title)+"</div></div><div class='fc-event-bg'></div></div>";if(s.isEnd&&ga(o))v+="<div class='ui-resizable-handle ui-resizable-s'>=</div>";
-v+="</"+(F?"a":"div")+">";return v}function j(o,s,v){oa(o)&&y(o,s,v.isStart);v.isEnd&&ga(o)&&c(o,s,v);da(o,s)}function t(o,s,v){var F=s.find("div.fc-event-time");oa(o)&&S(o,s,F);v.isEnd&&ga(o)&&Q(o,s,F);da(o,s)}function y(o,s,v){function F(){if(!M){s.width(r).height("").draggable("option","grid",null);M=true}}var r,J,M=true,k,D=u("isRTL")?-1:1,Z=U(),ja=H(),ia=T(),la=ka();s.draggable({zIndex:9,opacity:u("dragOpacity","month"),revertDuration:u("dragRevertDuration"),start:function($,w){fa("eventDragStart",
-s,o,$,w);i(o,s);r=s.width();Z.start(function(I,R,V,ea){B();if(I){J=false;k=ea*D;if(I.row)if(v){if(M){s.width(ja-10);Eb(s,ia*Math.round((o.end?(o.end-o.start)/wc:u("defaultEventMinutes"))/u("slotMinutes")));s.draggable("option","grid",[ja,1]);M=false}}else J=true;else{E(ba(N(o.start),k),ba(Ua(o),k));F()}J=J||M&&!k}else{F();J=true}s.draggable("option","revert",J)},$,"drag")},stop:function($,w){Z.stop();B();fa("eventDragStop",s,o,$,w);if(J){F();s.css("filter","");K(o,s)}else{var I=0;M||(I=Math.round((s.offset().top-
-X().offset().top)/ia)*u("slotMinutes")+la-(o.start.getHours()*60+o.start.getMinutes()));C(this,o,k,I,M,$,w)}}})}function S(o,s,v){function F(I){var R=xa(N(o.start),I),V;if(o.end)V=xa(N(o.end),I);v.text(W(R,V,u("timeFormat")))}function r(){if(M){v.css("display","");s.draggable("option","grid",[$,w]);M=false}}var J,M=false,k,D,Z,ja=u("isRTL")?-1:1,ia=U(),la=z(),$=H(),w=T();s.draggable({zIndex:9,scroll:false,grid:[$,w],axis:la==1?"y":false,opacity:u("dragOpacity"),revertDuration:u("dragRevertDuration"),
-start:function(I,R){fa("eventDragStart",s,o,I,R);i(o,s);J=s.position();D=Z=0;ia.start(function(V,ea,aa,va){s.draggable("option","revert",!V);B();if(V){k=va*ja;if(u("allDaySlot")&&!V.row){if(!M){M=true;v.hide();s.draggable("option","grid",null)}E(ba(N(o.start),k),ba(Ua(o),k))}else r()}},I,"drag")},drag:function(I,R){D=Math.round((R.position.top-J.top)/w)*u("slotMinutes");if(D!=Z){M||F(D);Z=D}},stop:function(I,R){var V=ia.stop();B();fa("eventDragStop",s,o,I,R);if(V&&(k||D||M))C(this,o,k,M?0:D,M,I,R);
-else{r();s.css("filter","");s.css(J);F(0);K(o,s)}}})}function Q(o,s,v){var F,r,J=T();s.resizable({handles:{s:"div.ui-resizable-s"},grid:J,start:function(M,k){F=r=0;i(o,s);s.css("z-index",9);fa("eventResizeStart",this,o,M,k)},resize:function(M,k){F=Math.round((Math.max(J,s.height())-k.originalSize.height)/J);if(F!=r){v.text(W(o.start,!F&&!o.end?null:xa(ra(o),u("slotMinutes")*F),u("timeFormat")));r=F}},stop:function(M,k){fa("eventResizeStop",this,o,M,k);if(F)P(this,o,0,u("slotMinutes")*F,M,k);else{s.css("z-index",
-8);K(o,s)}}})}var q=this;q.renderEvents=a;q.compileDaySegs=e;q.clearEvents=b;q.slotSegHtml=l;q.bindDaySeg=j;Qb.call(q);var u=q.opt,fa=q.trigger,oa=q.isEventDraggable,ga=q.isEventResizable,ra=q.eventEnd,sa=q.reportEvents,ha=q.reportEventClear,da=q.eventElementHandlers,na=q.setHeight,ua=q.getDaySegmentContainer,pa=q.getSlotSegmentContainer,U=q.getHoverListener,ca=q.getMaxMinute,ka=q.getMinMinute,qa=q.timePosition,G=q.colContentLeft,p=q.colContentRight,L=q.renderDaySegs,c=q.resizableDayEvent,z=q.getColCnt,
-H=q.getColWidth,T=q.getSlotHeight,X=q.getBodyContent,ya=q.reportEventElement,K=q.showEvents,i=q.hideEvents,C=q.eventDrop,P=q.eventResize,E=q.renderDayOverlay,B=q.clearOverlays,n=q.calendar,Y=n.formatDate,W=n.formatDates}function vc(a){var b,e,d,f,g,l;for(b=a.length-1;b>0;b--){f=a[b];for(e=0;e<f.length;e++){g=f[e];for(d=0;d<a[b-1].length;d++){l=a[b-1][d];if(Cb(g,l))l.forward=Math.max(l.forward||0,(g.forward||0)+1)}}}}function Kb(a,b,e){function d(G,p){G=qa[G];if(typeof G=="object")return jb(G,p||e);
-return G}function f(G,p){return b.trigger.apply(b,[G,p||da].concat(Array.prototype.slice.call(arguments,2),[da]))}function g(G){return j(G)&&!d("disableDragging")}function l(G){return j(G)&&!d("disableResizing")}function j(G){return Ta(G.editable,(G.source||{}).editable,d("editable"))}function t(G){U={};var p,L=G.length,c;for(p=0;p<L;p++){c=G[p];if(U[c._id])U[c._id].push(c);else U[c._id]=[c]}}function y(G){return G.end?N(G.end):na(G)}function S(G,p){ca.push(p);if(ka[G._id])ka[G._id].push(p);else ka[G._id]=
-[p]}function Q(){ca=[];ka={}}function q(G,p){p.click(function(L){if(!p.hasClass("ui-draggable-dragging")&&!p.hasClass("ui-resizable-resizing"))return f("eventClick",this,G,L)}).hover(function(L){f("eventMouseover",this,G,L)},function(L){f("eventMouseout",this,G,L)})}function u(G,p){oa(G,p,"show")}function fa(G,p){oa(G,p,"hide")}function oa(G,p,L){G=ka[G._id];var c,z=G.length;for(c=0;c<z;c++)if(!p||G[c][0]!=p[0])G[c][L]()}function ga(G,p,L,c,z,H,T){var X=p.allDay,ya=p._id;sa(U[ya],L,c,z);f("eventDrop",
-G,p,L,c,z,function(){sa(U[ya],-L,-c,X);pa(ya)},H,T);pa(ya)}function ra(G,p,L,c,z,H){var T=p._id;ha(U[T],L,c);f("eventResize",G,p,L,c,function(){ha(U[T],-L,-c);pa(T)},z,H);pa(T)}function sa(G,p,L,c){L=L||0;for(var z,H=G.length,T=0;T<H;T++){z=G[T];if(c!==ma)z.allDay=c;xa(ba(z.start,p,true),L);if(z.end)z.end=xa(ba(z.end,p,true),L);ua(z,qa)}}function ha(G,p,L){L=L||0;for(var c,z=G.length,H=0;H<z;H++){c=G[H];c.end=xa(ba(y(c),p,true),L);ua(c,qa)}}var da=this;da.element=a;da.calendar=b;da.name=e;da.opt=
-d;da.trigger=f;da.isEventDraggable=g;da.isEventResizable=l;da.reportEvents=t;da.eventEnd=y;da.reportEventElement=S;da.reportEventClear=Q;da.eventElementHandlers=q;da.showEvents=u;da.hideEvents=fa;da.eventDrop=ga;da.eventResize=ra;var na=da.defaultEventEnd,ua=b.normalizeEvent,pa=b.reportEventChange,U={},ca=[],ka={},qa=b.options}function Qb(){function a(i,C){var P=z(),E=pa(),B=U(),n=0,Y,W,o=i.length,s,v;P[0].innerHTML=e(i);d(i,P.children());f(i);g(i,P,C);l(i);j(i);t(i);C=y();for(P=0;P<E;P++){Y=[];for(W=
-0;W<B;W++)Y[W]=0;for(;n<o&&(s=i[n]).row==P;){W=Hb(Y.slice(s.startCol,s.endCol));s.top=W;W+=s.outerHeight;for(v=s.startCol;v<s.endCol;v++)Y[v]=W;n++}C[P].height(Hb(Y))}Q(i,S(C))}function b(i,C,P){var E=m("<div/>"),B=z(),n=i.length,Y;E[0].innerHTML=e(i);E=E.children();B.append(E);d(i,E);l(i);j(i);t(i);Q(i,S(y()));E=[];for(B=0;B<n;B++)if(Y=i[B].element){i[B].row===C&&Y.css("top",P);E.push(Y[0])}return m(E)}function e(i){var C=fa("isRTL"),P,E=i.length,B,n,Y,W;P=ka();var o=P.left,s=P.right,v,F,r,J,M,k=
-"";for(P=0;P<E;P++){B=i[P];n=B.event;W=["fc-event","fc-event-skin","fc-event-hori"];ga(n)&&W.push("fc-event-draggable");if(C){B.isStart&&W.push("fc-corner-right");B.isEnd&&W.push("fc-corner-left");v=p(B.end.getDay()-1);F=p(B.start.getDay());r=B.isEnd?qa(v):o;J=B.isStart?G(F):s}else{B.isStart&&W.push("fc-corner-left");B.isEnd&&W.push("fc-corner-right");v=p(B.start.getDay());F=p(B.end.getDay()-1);r=B.isStart?qa(v):o;J=B.isEnd?G(F):s}W=W.concat(n.className);if(n.source)W=W.concat(n.source.className||
-[]);Y=n.url;M=Jb(n,fa);k+=Y?"<a href='"+Qa(Y)+"'":"<div";k+=" class='"+W.join(" ")+"' style='position:absolute;z-index:8;left:"+r+"px;"+M+"'><div class='fc-event-inner fc-event-skin'"+(M?" style='"+M+"'":"")+">";if(!n.allDay&&B.isStart)k+="<span class='fc-event-time'>"+Qa(T(n.start,n.end,fa("timeFormat")))+"</span>";k+="<span class='fc-event-title'>"+Qa(n.title)+"</span></div>";if(B.isEnd&&ra(n))k+="<div class='ui-resizable-handle ui-resizable-"+(C?"w":"e")+"'> </div>";k+="</"+(Y?
-"a":"div")+">";B.left=r;B.outerWidth=J-r;B.startCol=v;B.endCol=F+1}return k}function d(i,C){var P,E=i.length,B,n,Y;for(P=0;P<E;P++){B=i[P];n=B.event;Y=m(C[P]);n=oa("eventRender",n,n,Y);if(n===false)Y.remove();else{if(n&&n!==true){n=m(n).css({position:"absolute",left:B.left});Y.replaceWith(n);Y=n}B.element=Y}}}function f(i){var C,P=i.length,E,B;for(C=0;C<P;C++){E=i[C];(B=E.element)&&ha(E.event,B)}}function g(i,C,P){var E,B=i.length,n,Y,W;for(E=0;E<B;E++){n=i[E];if(Y=n.element){W=n.event;if(W._id===
-P)H(W,Y,n);else Y[0]._fci=E}}Db(C,i,H)}function l(i){var C,P=i.length,E,B,n,Y,W={};for(C=0;C<P;C++){E=i[C];if(B=E.element){n=E.key=Ib(B[0]);Y=W[n];if(Y===ma)Y=W[n]=pb(B,true);E.hsides=Y}}}function j(i){var C,P=i.length,E,B;for(C=0;C<P;C++){E=i[C];if(B=E.element)B[0].style.width=Math.max(0,E.outerWidth-E.hsides)+"px"}}function t(i){var C,P=i.length,E,B,n,Y,W={};for(C=0;C<P;C++){E=i[C];if(B=E.element){n=E.key;Y=W[n];if(Y===ma)Y=W[n]=Fb(B);E.outerHeight=B[0].offsetHeight+Y}}}function y(){var i,C=pa(),
-P=[];for(i=0;i<C;i++)P[i]=ca(i).find("td:first div.fc-day-content > div");return P}function S(i){var C,P=i.length,E=[];for(C=0;C<P;C++)E[C]=i[C][0].offsetTop;return E}function Q(i,C){var P,E=i.length,B,n;for(P=0;P<E;P++){B=i[P];if(n=B.element){n[0].style.top=C[B.row]+(B.top||0)+"px";B=B.event;oa("eventAfterRender",B,B,n)}}}function q(i,C,P){var E=fa("isRTL"),B=E?"w":"e",n=C.find("div.ui-resizable-"+B),Y=false;qb(C);C.mousedown(function(W){W.preventDefault()}).click(function(W){if(Y){W.preventDefault();
-W.stopImmediatePropagation()}});n.mousedown(function(W){function o(ia){oa("eventResizeStop",this,i,ia);m("body").css("cursor","");s.stop();ya();k&&ua(this,i,k,0,ia);setTimeout(function(){Y=false},0)}if(W.which==1){Y=true;var s=u.getHoverListener(),v=pa(),F=U(),r=E?-1:1,J=E?F-1:0,M=C.css("top"),k,D,Z=m.extend({},i),ja=L(i.start);K();m("body").css("cursor",B+"-resize").one("mouseup",o);oa("eventResizeStart",this,i,W);s.start(function(ia,la){if(ia){var $=Math.max(ja.row,ia.row);ia=ia.col;if(v==1)$=0;
-if($==ja.row)ia=E?Math.min(ja.col,ia):Math.max(ja.col,ia);k=$*7+ia*r+J-(la.row*7+la.col*r+J);la=ba(sa(i),k,true);if(k){Z.end=la;$=D;D=b(c([Z]),P.row,M);D.find("*").css("cursor",B+"-resize");$&&$.remove();na(i)}else if(D){da(i);D.remove();D=null}ya();X(i.start,ba(N(la),1))}},W)}})}var u=this;u.renderDaySegs=a;u.resizableDayEvent=q;var fa=u.opt,oa=u.trigger,ga=u.isEventDraggable,ra=u.isEventResizable,sa=u.eventEnd,ha=u.reportEventElement,da=u.showEvents,na=u.hideEvents,ua=u.eventResize,pa=u.getRowCnt,
-U=u.getColCnt,ca=u.allDayRow,ka=u.allDayBounds,qa=u.colContentLeft,G=u.colContentRight,p=u.dayOfWeekCol,L=u.dateCell,c=u.compileDaySegs,z=u.getDaySegmentContainer,H=u.bindDaySeg,T=u.calendar.formatDates,X=u.renderDayOverlay,ya=u.clearOverlays,K=u.clearSelection}function Mb(){function a(Q,q,u){b();q||(q=j(Q,u));t(Q,q,u);e(Q,q,u)}function b(Q){if(S){S=false;y();l("unselect",null,Q)}}function e(Q,q,u,fa){S=true;l("select",null,Q,q,u,fa)}function d(Q){var q=f.cellDate,u=f.cellIsAllDay,fa=f.getHoverListener(),
-oa=f.reportDayClick;if(Q.which==1&&g("selectable")){b(Q);var ga;fa.start(function(ra,sa){y();if(ra&&u(ra)){ga=[q(sa),q(ra)].sort(Gb);t(ga[0],ga[1],true)}else ga=null},Q);m(document).one("mouseup",function(ra){fa.stop();if(ga){+ga[0]==+ga[1]&&oa(ga[0],true,ra);e(ga[0],ga[1],true,ra)}})}}var f=this;f.select=a;f.unselect=b;f.reportSelection=e;f.daySelectionMousedown=d;var g=f.opt,l=f.trigger,j=f.defaultSelectionEnd,t=f.renderSelection,y=f.clearSelection,S=false;g("selectable")&&g("unselectAuto")&&m(document).mousedown(function(Q){var q=
-g("unselectCancel");if(q)if(m(Q.target).parents(q).length)return;b(Q)})}function Lb(){function a(g,l){var j=f.shift();j||(j=m("<div class='fc-cell-overlay' style='position:absolute;z-index:3'/>"));j[0].parentNode!=l[0]&&j.appendTo(l);d.push(j.css(g).show());return j}function b(){for(var g;g=d.shift();)f.push(g.hide().unbind())}var e=this;e.renderOverlay=a;e.clearOverlays=b;var d=[],f=[]}function Nb(a){var b=this,e,d;b.build=function(){e=[];d=[];a(e,d)};b.cell=function(f,g){var l=e.length,j=d.length,
-t,y=-1,S=-1;for(t=0;t<l;t++)if(g>=e[t][0]&&g<e[t][1]){y=t;break}for(t=0;t<j;t++)if(f>=d[t][0]&&f<d[t][1]){S=t;break}return y>=0&&S>=0?{row:y,col:S}:null};b.rect=function(f,g,l,j,t){t=t.offset();return{top:e[f][0]-t.top,left:d[g][0]-t.left,width:d[j][1]-d[g][0],height:e[l][1]-e[f][0]}}}function Ob(a){function b(j){xc(j);j=a.cell(j.pageX,j.pageY);if(!j!=!l||j&&(j.row!=l.row||j.col!=l.col)){if(j){g||(g=j);f(j,g,j.row-g.row,j.col-g.col)}else f(j,g);l=j}}var e=this,d,f,g,l;e.start=function(j,t,y){f=j;
-g=l=null;a.build();b(t);d=y||"mousemove";m(document).bind(d,b)};e.stop=function(){m(document).unbind(d,b);return l}}function xc(a){if(a.pageX===ma){a.pageX=a.originalEvent.pageX;a.pageY=a.originalEvent.pageY}}function Pb(a){function b(l){return d[l]=d[l]||a(l)}var e=this,d={},f={},g={};e.left=function(l){return f[l]=f[l]===ma?b(l).position().left:f[l]};e.right=function(l){return g[l]=g[l]===ma?e.left(l)+b(l).width():g[l]};e.clear=function(){d={};f={};g={}}}var Ya={defaultView:"month",aspectRatio:1.35,
-header:{left:"title",center:"",right:"today prev,next"},weekends:true,allDayDefault:true,ignoreTimezone:true,lazyFetching:true,startParam:"start",endParam:"end",titleFormat:{month:"MMMM yyyy",week:"MMM d[ yyyy]{ '—'[ MMM] d yyyy}",day:"dddd, MMM d, yyyy"},columnFormat:{month:"ddd",week:"ddd M/d",day:"dddd M/d"},timeFormat:{"":"h(:mm)t"},isRTL:false,firstDay:0,monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan",
-"Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],buttonText:{prev:" ◄ ",next:" ► ",prevYear:" << ",nextYear:" >> ",today:"today",month:"month",week:"week",day:"day"},theme:false,buttonIcons:{prev:"circle-triangle-w",next:"circle-triangle-e"},unselectAuto:true,dropAccept:"*"},yc=
-{header:{left:"next,prev today",center:"",right:"title"},buttonText:{prev:" ► ",next:" ◄ ",prevYear:" >> ",nextYear:" << "},buttonIcons:{prev:"circle-triangle-e",next:"circle-triangle-w"}},Aa=m.fullCalendar={version:"1.5.3"},Ja=Aa.views={};m.fn.fullCalendar=function(a){if(typeof a=="string"){var b=Array.prototype.slice.call(arguments,1),e;this.each(function(){var f=m.data(this,"fullCalendar");if(f&&m.isFunction(f[a])){f=f[a].apply(f,
-b);if(e===ma)e=f;a=="destroy"&&m.removeData(this,"fullCalendar")}});if(e!==ma)return e;return this}var d=a.eventSources||[];delete a.eventSources;if(a.events){d.push(a.events);delete a.events}a=m.extend(true,{},Ya,a.isRTL||a.isRTL===ma&&Ya.isRTL?yc:{},a);this.each(function(f,g){f=m(g);g=new Yb(f,a,d);f.data("fullCalendar",g);g.render()});return this};Aa.sourceNormalizers=[];Aa.sourceFetchers=[];var ac={dataType:"json",cache:false},bc=1;Aa.addDays=ba;Aa.cloneDate=N;Aa.parseDate=kb;Aa.parseISO8601=
-Bb;Aa.parseTime=mb;Aa.formatDate=Oa;Aa.formatDates=ib;var lc=["sun","mon","tue","wed","thu","fri","sat"],Ab=864E5,cc=36E5,wc=6E4,dc={s:function(a){return a.getSeconds()},ss:function(a){return Pa(a.getSeconds())},m:function(a){return a.getMinutes()},mm:function(a){return Pa(a.getMinutes())},h:function(a){return a.getHours()%12||12},hh:function(a){return Pa(a.getHours()%12||12)},H:function(a){return a.getHours()},HH:function(a){return Pa(a.getHours())},d:function(a){return a.getDate()},dd:function(a){return Pa(a.getDate())},
-ddd:function(a,b){return b.dayNamesShort[a.getDay()]},dddd:function(a,b){return b.dayNames[a.getDay()]},M:function(a){return a.getMonth()+1},MM:function(a){return Pa(a.getMonth()+1)},MMM:function(a,b){return b.monthNamesShort[a.getMonth()]},MMMM:function(a,b){return b.monthNames[a.getMonth()]},yy:function(a){return(a.getFullYear()+"").substring(2)},yyyy:function(a){return a.getFullYear()},t:function(a){return a.getHours()<12?"a":"p"},tt:function(a){return a.getHours()<12?"am":"pm"},T:function(a){return a.getHours()<
-12?"A":"P"},TT:function(a){return a.getHours()<12?"AM":"PM"},u:function(a){return Oa(a,"yyyy-MM-dd'T'HH:mm:ss'Z'")},S:function(a){a=a.getDate();if(a>10&&a<20)return"th";return["st","nd","rd"][a%10-1]||"th"}};Aa.applyAll=$a;Ja.month=mc;Ja.basicWeek=nc;Ja.basicDay=oc;wb({weekMode:"fixed"});Ja.agendaWeek=qc;Ja.agendaDay=rc;wb({allDaySlot:true,allDayText:"all-day",firstHour:6,slotMinutes:30,defaultEventMinutes:120,axisFormat:"h(:mm)tt",timeFormat:{agenda:"h:mm{ - h:mm}"},dragOpacity:{agenda:0.5},minTime:0,
-maxTime:24})})(jQuery);
+/*!
+ * FullCalendar v1.6.4
+ * Docs & License: http://arshaw.com/fullcalendar/
+ * (c) 2013 Adam Shaw
+ */
+(function(t,e){function n(e){t.extend(!0,Ce,e)}function r(n,r,c){function u(t){ae?p()&&(S(),M(t)):f()}function f(){oe=r.theme?"ui":"fc",n.addClass("fc"),r.isRTL?n.addClass("fc-rtl"):n.addClass("fc-ltr"),r.theme&&n.addClass("ui-widget"),ae=t("<div class='fc-content' style='position:relative'/>").prependTo(n),ne=new a(ee,r),re=ne.render(),re&&n.prepend(re),y(r.defaultView),r.handleWindowResize&&t(window).resize(x),m()||v()}function v(){setTimeout(function(){!ie.start&&m()&&C()},0)}function h(){ie&&(te("viewDestroy",ie,ie,ie.element),ie.triggerEventDestroy()),t(window).unbind("resize",x),ne.destroy(),ae.remove(),n.removeClass("fc fc-rtl ui-widget")}function p(){return n.is(":visible")}function m(){return t("body").is(":visible")}function y(t){ie&&t==ie.name||D(t)}function D(e){he++,ie&&(te("viewDestroy",ie,ie,ie.element),Y(),ie.triggerEventDestroy(),G(),ie.element.remove(),ne.deactivateButton(ie.name)),ne.activateButton(e),ie=new Se[e](t("<div class='fc-view fc-view-"+e+"' style='position:relative'/>").appendTo(ae),ee),C(),$(),he--}function C(t){(!ie.start||t||ie.start>ge||ge>=ie.end)&&p()&&M(t)}function M(t){he++,ie.start&&(te("viewDestroy",ie,ie,ie.element),Y(),N()),G(),ie.render(ge,t||0),T(),$(),(ie.afterRender||A)(),_(),P(),te("viewRender",ie,ie,ie.element),ie.trigger("viewDisplay",de),he--,z()}function E(){p()&&(Y(),N(),S(),T(),F())}function S(){le=r.contentHeight?r.contentHeight:r.height?r.height-(re?re.height():0)-R(ae):Math.round(ae.width()/Math.max(r.aspectRatio,.5))}function T(){le===e&&S(),he++,ie.setHeight(le),ie.setWidth(ae.width()),he--,se=n.outerWidth()}function x(){if(!he)if(ie.start){var t=++ve;setTimeout(function(){t==ve&&!he&&p()&&se!=(se=n.outerWidth())&&(he++,E(),ie.trigger("windowResize",de),he--)},200)}else v()}function k(){N(),W()}function H(t){N(),F(t)}function F(t){p()&&(ie.setEventData(pe),ie.renderEvents(pe,t),ie.trigger("eventAfterAllRender"))}function N(){ie.triggerEventDestroy(),ie.clearEvents(),ie.clearEventData()}function z(){!r.lazyFetching||ue(ie.visStart,ie.visEnd)?W():F()}function W(){fe(ie.visStart,ie.visEnd)}function O(t){pe=t,F()}function L(t){H(t)}function _(){ne.updateTitle(ie.title)}function P(){var t=new Date;t>=ie.start&&ie.end>t?ne.disableButton("today"):ne.enableButton("today")}function q(t,n,r){ie.select(t,n,r===e?!0:r)}function Y(){ie&&ie.unselect()}function B(){C(-1)}function j(){C(1)}function I(){i(ge,-1),C()}function X(){i(ge,1),C()}function J(){ge=new Date,C()}function V(t,e,n){t instanceof Date?ge=d(t):g(ge,t,e,n),C()}function U(t,n,r){t!==e&&i(ge,t),n!==e&&s(ge,n),r!==e&&l(ge,r),C()}function Z(){return d(ge)}function G(){ae.css({width:"100%",height:ae.height(),overflow:"hidden"})}function $(){ae.css({width:"",height:"",overflow:""})}function Q(){return ie}function K(t,n){return n===e?r[t]:(("height"==t||"contentHeight"==t||"aspectRatio"==t)&&(r[t]=n,E()),e)}function te(t,n){return r[t]?r[t].apply(n||de,Array.prototype.slice.call(arguments,2)):e}var ee=this;ee.options=r,ee.render=u,ee.destroy=h,ee.refetchEvents=k,ee.reportEvents=O,ee.reportEventChange=L,ee.rerenderEvents=H,ee.changeView=y,ee.select=q,ee.unselect=Y,ee.prev=B,ee.next=j,ee.prevYear=I,ee.nextYear=X,ee.today=J,ee.gotoDate=V,ee.incrementDate=U,ee.formatDate=function(t,e){return w(t,e,r)},ee.formatDates=function(t,e,n){return b(t,e,n,r)},ee.getDate=Z,ee.getView=Q,ee.option=K,ee.trigger=te,o.call(ee,r,c);var ne,re,ae,oe,ie,se,le,ce,ue=ee.isFetchNeeded,fe=ee.fetchEvents,de=n[0],ve=0,he=0,ge=new Date,pe=[];g(ge,r.year,r.month,r.date),r.droppable&&t(document).bind("dragstart",function(e,n){var a=e.target,o=t(a);if(!o.parents(".fc").length){var i=r.dropAccept;(t.isFunction(i)?i.call(a,o):o.is(i))&&(ce=a,ie.dragStart(ce,e,n))}}).bind("dragstop",function(t,e){ce&&(ie.dragStop(ce,t,e),ce=null)})}function a(n,r){function a(){v=r.theme?"ui":"fc";var n=r.header;return n?h=t("<table class='fc-header' style='width:100%'/>").append(t("<tr/>").append(i("left")).append(i("center")).append(i("right"))):e}function o(){h.remove()}function i(e){var a=t("<td class='fc-header-"+e+"'/>"),o=r.header[e];return o&&t.each(o.split(" "),function(e){e>0&&a.append("<span class='fc-header-space'/>");var o;t.each(this.split(","),function(e,i){if("title"==i)a.append("<span class='fc-header-title'><h2> </h2></span>"),o&&o.addClass(v+"-corner-right"),o=null;else{var s;if(n[i]?s=n[i]:Se[i]&&(s=function(){u.removeClass(v+"-state-hover"),n.changeView(i)}),s){var l=r.theme?P(r.buttonIcons,i):null,c=P(r.buttonText,i),u=t("<span class='fc-button fc-button-"+i+" "+v+"-state-default'>"+(l?"<span class='fc-icon-wrap'><span class='ui-icon ui-icon-"+l+"'/>"+"</span>":c)+"</span>").click(function(){u.hasClass(v+"-state-disabled")||s()}).mousedown(function(){u.not("."+v+"-state-active").not("."+v+"-state-disabled").addClass(v+"-state-down")}).mouseup(function(){u.removeClass(v+"-state-down")}).hover(function(){u.not("."+v+"-state-active").not("."+v+"-state-disabled").addClass(v+"-state-hover")},function(){u.removeClass(v+"-state-hover").removeClass(v+"-state-down")}).appendTo(a);Y(u),o||u.addClass(v+"-corner-left"),o=u}}}),o&&o.addClass(v+"-corner-right")}),a}function s(t){h.find("h2").html(t)}function l(t){h.find("span.fc-button-"+t).addClass(v+"-state-active")}function c(t){h.find("span.fc-button-"+t).removeClass(v+"-state-active")}function u(t){h.find("span.fc-button-"+t).addClass(v+"-state-disabled")}function f(t){h.find("span.fc-button-"+t).removeClass(v+"-state-disabled")}var d=this;d.render=a,d.destroy=o,d.updateTitle=s,d.activateButton=l,d.deactivateButton=c,d.disableButton=u,d.enableButton=f;var v,h=t([])}function o(n,r){function a(t,e){return!E||E>t||e>S}function o(t,e){E=t,S=e,W=[];var n=++R,r=F.length;N=r;for(var a=0;r>a;a++)i(F[a],n)}function i(e,r){s(e,function(a){if(r==R){if(a){n.eventDataTransform&&(a=t.map(a,n.eventDataTransform)),e.eventDataTransform&&(a=t.map(a,e.eventDataTransform));for(var o=0;a.length>o;o++)a[o].source=e,w(a[o]);W=W.concat(a)}N--,N||k(W)}})}function s(r,a){var o,i,l=Ee.sourceFetchers;for(o=0;l.length>o;o++){if(i=l[o](r,E,S,a),i===!0)return;if("object"==typeof i)return s(i,a),e}var c=r.events;if(c)t.isFunction(c)?(m(),c(d(E),d(S),function(t){a(t),y()})):t.isArray(c)?a(c):a();else{var u=r.url;if(u){var f,v=r.success,h=r.error,g=r.complete;f=t.isFunction(r.data)?r.data():r.data;var p=t.extend({},f||{}),w=X(r.startParam,n.startParam),b=X(r.endParam,n.endParam);w&&(p[w]=Math.round(+E/1e3)),b&&(p[b]=Math.round(+S/1e3)),m(),t.ajax(t.extend({},Te,r,{data:p,success:function(e){e=e||[];var n=I(v,this,arguments);t.isArray(n)&&(e=n),a(e)},error:function(){I(h,this,arguments),a()},complete:function(){I(g,this,arguments),y()}}))}else a()}}function l(t){t=c(t),t&&(N++,i(t,R))}function c(n){return t.isFunction(n)||t.isArray(n)?n={events:n}:"string"==typeof n&&(n={url:n}),"object"==typeof n?(b(n),F.push(n),n):e}function u(e){F=t.grep(F,function(t){return!D(t,e)}),W=t.grep(W,function(t){return!D(t.source,e)}),k(W)}function f(t){var e,n,r=W.length,a=x().defaultEventEnd,o=t.start-t._start,i=t.end?t.end-(t._end||a(t)):0;for(e=0;r>e;e++)n=W[e],n._id==t._id&&n!=t&&(n.start=new Date(+n.start+o),n.end=t.end?n.end?new Date(+n.end+i):new Date(+a(n)+i):null,n.title=t.title,n.url=t.url,n.allDay=t.allDay,n.className=t.className,n.editable=t.editable,n.color=t.color,n.backgroundColor=t.backgroundColor,n.borderColor=t.borderColor,n.textColor=t.textColor,w(n));w(t),k(W)}function v(t,e){w(t),t.source||(e&&(H.events.push(t),t.source=H),W.push(t)),k(W)}function h(e){if(e){if(!t.isFunction(e)){var n=e+"";e=function(t){return t._id==n}}W=t.grep(W,e,!0);for(var r=0;F.length>r;r++)t.isArray(F[r].events)&&(F[r].events=t.grep(F[r].events,e,!0))}else{W=[];for(var r=0;F.length>r;r++)t.isArray(F[r].events)&&(F[r].events=[])}k(W)}function g(e){return t.isFunction(e)?t.grep(W,e):e?(e+="",t.grep(W,function(t){return t._id==e})):W}function m(){z++||T("loading",null,!0,x())}function y(){--z||T("loading",null,!1,x())}function w(t){var r=t.source||{},a=X(r.ignoreTimezone,n.ignoreTimezone);t._id=t._id||(t.id===e?"_fc"+xe++:t.id+""),t.date&&(t.start||(t.start=t.date),delete t.date),t._start=d(t.start=p(t.start,a)),t.end=p(t.end,a),t.end&&t.end<=t.start&&(t.end=null),t._end=t.end?d(t.end):null,t.allDay===e&&(t.allDay=X(r.allDayDefault,n.allDayDefault)),t.className?"string"==typeof t.className&&(t.className=t.className.split(/\s+/)):t.className=[]}function b(t){t.className?"string"==typeof t.className&&(t.className=t.className.split(/\s+/)):t.className=[];for(var e=Ee.sourceNormalizers,n=0;e.length>n;n++)e[n](t)}function D(t,e){return t&&e&&C(t)==C(e)}function C(t){return("object"==typeof t?t.events||t.url:"")||t}var M=this;M.isFetchNeeded=a,M.fetchEvents=o,M.addEventSource=l,M.removeEventSource=u,M.updateEvent=f,M.renderEvent=v,M.removeEvents=h,M.clientEvents=g,M.normalizeEvent=w;for(var E,S,T=M.trigger,x=M.getView,k=M.reportEvents,H={events:[]},F=[H],R=0,N=0,z=0,W=[],A=0;r.length>A;A++)c(r[A])}function i(t,e,n){return t.setFullYear(t.getFullYear()+e),n||f(t),t}function s(t,e,n){if(+t){var r=t.getMonth()+e,a=d(t);for(a.setDate(1),a.setMonth(r),t.setMonth(r),n||f(t);t.getMonth()!=a.getMonth();)t.setDate(t.getDate()+(a>t?1:-1))}return t}function l(t,e,n){if(+t){var r=t.getDate()+e,a=d(t);a.setHours(9),a.setDate(r),t.setDate(r),n||f(t),c(t,a)}return t}function c(t,e){if(+t)for(;t.getDate()!=e.getDate();)t.setTime(+t+(e>t?1:-1)*Fe)}function u(t,e){return t.setMinutes(t.getMinutes()+e),t}function f(t){return t.setHours(0),t.setMinutes(0),t.setSeconds(0),t.setMilliseconds(0),t}function d(t,e){return e?f(new Date(+t)):new Date(+t)}function v(){var t,e=0;do t=new Date(1970,e++,1);while(t.getHours());return t}function h(t,e){return Math.round((d(t,!0)-d(e,!0))/He)}function g(t,n,r,a){n!==e&&n!=t.getFullYear()&&(t.setDate(1),t.setMonth(0),t.setFullYear(n)),r!==e&&r!=t.getMonth()&&(t.setDate(1),t.setMonth(r)),a!==e&&t.setDate(a)}function p(t,n){return"object"==typeof t?t:"number"==typeof t?new Date(1e3*t):"string"==typeof t?t.match(/^\d+(\.\d+)?$/)?new Date(1e3*parseFloat(t)):(n===e&&(n=!0),m(t,n)||(t?new Date(t):null)):null}function m(t,e){var n=t.match(/^([0-9]{4})(-([0-9]{2})(-([0-9]{2})([T ]([0-9]{2}):([0-9]{2})(:([0-9]{2})(\.([0-9]+))?)?(Z|(([-+])([0-9]{2})(:?([0-9]{2}))?))?)?)?)?$/);if(!n)return null;var r=new Date(n[1],0,1);if(e||!n[13]){var a=new Date(n[1],0,1,9,0);n[3]&&(r.setMonth(n[3]-1),a.setMonth(n[3]-1)),n[5]&&(r.setDate(n[5]),a.setDate(n[5])),c(r,a),n[7]&&r.setHours(n[7]),n[8]&&r.setMinutes(n[8]),n[10]&&r.setSeconds(n[10]),n[12]&&r.setMilliseconds(1e3*Number("0."+n[12])),c(r,a)}else if(r.setUTCFullYear(n[1],n[3]?n[3]-1:0,n[5]||1),r.setUTCHours(n[7]||0,n[8]||0,n[10]||0,n[12]?1e3*Number("0."+n[12]):0),n[14]){var o=60*Number(n[16])+(n[18]?Number(n[18]):0);o*="-"==n[15]?1:-1,r=new Date(+r+1e3*60*o)}return r}function y(t){if("number"==typeof t)return 60*t;if("object"==typeof t)return 60*t.getHours()+t.getMinutes();var e=t.match(/(\d+)(?::(\d+))?\s*(\w+)?/);if(e){var n=parseInt(e[1],10);return e[3]&&(n%=12,"p"==e[3].toLowerCase().charAt(0)&&(n+=12)),60*n+(e[2]?parseInt(e[2],10):0)}}function w(t,e,n){return b(t,null,e,n)}function b(t,e,n,r){r=r||Ce;var a,o,i,s,l=t,c=e,u=n.length,f="";for(a=0;u>a;a++)if(o=n.charAt(a),"'"==o){for(i=a+1;u>i;i++)if("'"==n.charAt(i)){l&&(f+=i==a+1?"'":n.substring(a+1,i),a=i);break}}else if("("==o){for(i=a+1;u>i;i++)if(")"==n.charAt(i)){var d=w(l,n.substring(a+1,i),r);parseInt(d.replace(/\D/,""),10)&&(f+=d),a=i;break}}else if("["==o){for(i=a+1;u>i;i++)if("]"==n.charAt(i)){var v=n.substring(a+1,i),d=w(l,v,r);d!=w(c,v,r)&&(f+=d),a=i;break}}else if("{"==o)l=e,c=t;else if("}"==o)l=t,c=e;else{for(i=u;i>a;i--)if(s=Ne[n.substring(a,i)]){l&&(f+=s(l,r)),a=i-1;break}i==a&&l&&(f+=o)}return f}function D(t){var e,n=new Date(t.getTime());return n.setDate(n.getDate()+4-(n.getDay()||7)),e=n.getTime(),n.setMonth(0),n.setDate(1),Math.floor(Math.round((e-n)/864e5)/7)+1}function C(t){return t.end?M(t.end,t.allDay):l(d(t.start),1)}function M(t,e){return t=d(t),e||t.getHours()||t.getMinutes()?l(t,1):f(t)}function E(n,r,a){n.unbind("mouseover").mouseover(function(n){for(var o,i,s,l=n.target;l!=this;)o=l,l=l.parentNode;(i=o._fci)!==e&&(o._fci=e,s=r[i],a(s.event,s.element,s),t(n.target).trigger(n)),n.stopPropagation()})}function S(e,n,r){for(var a,o=0;e.length>o;o++)a=t(e[o]),a.width(Math.max(0,n-x(a,r)))}function T(e,n,r){for(var a,o=0;e.length>o;o++)a=t(e[o]),a.height(Math.max(0,n-R(a,r)))}function x(t,e){return k(t)+F(t)+(e?H(t):0)}function k(e){return(parseFloat(t.css(e[0],"paddingLeft",!0))||0)+(parseFloat(t.css(e[0],"paddingRight",!0))||0)}function H(e){return(parseFloat(t.css(e[0],"marginLeft",!0))||0)+(parseFloat(t.css(e[0],"marginRight",!0))||0)}function F(e){return(parseFloat(t.css(e[0],"borderLeftWidth",!0))||0)+(parseFloat(t.css(e[0],"borderRightWidth",!0))||0)}function R(t,e){return N(t)+W(t)+(e?z(t):0)}function N(e){return(parseFloat(t.css(e[0],"paddingTop",!0))||0)+(parseFloat(t.css(e[0],"paddingBottom",!0))||0)}function z(e){return(parseFloat(t.css(e[0],"marginTop",!0))||0)+(parseFloat(t.css(e[0],"marginBottom",!0))||0)}function W(e){return(parseFloat(t.css(e[0],"borderTopWidth",!0))||0)+(parseFloat(t.css(e[0],"borderBottomWidth",!0))||0)}function A(){}function O(t,e){return t-e}function L(t){return Math.max.apply(Math,t)}function _(t){return(10>t?"0":"")+t}function P(t,n){if(t[n]!==e)return t[n];for(var r,a=n.split(/(?=[A-Z])/),o=a.length-1;o>=0;o--)if(r=t[a[o].toLowerCase()],r!==e)return r;return t[""]}function q(t){return t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/'/g,"'").replace(/"/g,""").replace(/\n/g,"<br />")}function Y(t){t.attr("unselectable","on").css("MozUserSelect","none").bind("selectstart.ui",function(){return!1})}function B(t){t.children().removeClass("fc-first fc-last").filter(":first-child").addClass("fc-first").end().filter(":last-child").addClass("fc-last")}function j(t,e){var n=t.source||{},r=t.color,a=n.color,o=e("eventColor"),i=t.backgroundColor||r||n.backgroundColor||a||e("eventBackgroundColor")||o,s=t.borderColor||r||n.borderColor||a||e("eventBorderColor")||o,l=t.textColor||n.textColor||e("eventTextColor"),c=[];return i&&c.push("background-color:"+i),s&&c.push("border-color:"+s),l&&c.push("color:"+l),c.join(";")}function I(e,n,r){if(t.isFunction(e)&&(e=[e]),e){var a,o;for(a=0;e.length>a;a++)o=e[a].apply(n,r)||o;return o}}function X(){for(var t=0;arguments.length>t;t++)if(arguments[t]!==e)return arguments[t]}function J(t,e){function n(t,e){e&&(s(t,e),t.setDate(1));var n=a("firstDay"),f=d(t,!0);f.setDate(1);var v=s(d(f),1),g=d(f);l(g,-((g.getDay()-n+7)%7)),i(g);var p=d(v);l(p,(7-p.getDay()+n)%7),i(p,-1,!0);var m=c(),y=Math.round(h(p,g)/7);"fixed"==a("weekMode")&&(l(p,7*(6-y)),y=6),r.title=u(f,a("titleFormat")),r.start=f,r.end=v,r.visStart=g,r.visEnd=p,o(y,m,!0)}var r=this;r.render=n,Z.call(r,t,e,"month");var a=r.opt,o=r.renderBasic,i=r.skipHiddenDays,c=r.getCellsPerWeek,u=e.formatDate}function V(t,e){function n(t,e){e&&l(t,7*e);var n=l(d(t),-((t.getDay()-a("firstDay")+7)%7)),u=l(d(n),7),f=d(n);i(f);var v=d(u);i(v,-1,!0);var h=s();r.start=n,r.end=u,r.visStart=f,r.visEnd=v,r.title=c(f,l(d(v),-1),a("titleFormat")),o(1,h,!1)}var r=this;r.render=n,Z.call(r,t,e,"basicWeek");var a=r.opt,o=r.renderBasic,i=r.skipHiddenDays,s=r.getCellsPerWeek,c=e.formatDates}function U(t,e){function n(t,e){e&&l(t,e),i(t,0>e?-1:1);var n=d(t,!0),c=l(d(n),1);r.title=s(t,a("titleFormat")),r.start=r.visStart=n,r.end=r.visEnd=c,o(1,1,!1)}var r=this;r.render=n,Z.call(r,t,e,"basicDay");var a=r.opt,o=r.renderBasic,i=r.skipHiddenDays,s=e.formatDate}function Z(e,n,r){function a(t,e,n){ee=t,ne=e,re=n,o(),j||i(),s()}function o(){le=he("theme")?"ui":"fc",ce=he("columnFormat"),ue=he("weekNumbers"),de=he("weekNumberTitle"),ve="iso"!=he("weekNumberCalculation")?"w":"W"}function i(){Z=t("<div class='fc-event-container' style='position:absolute;z-index:8;top:0;left:0'/>").appendTo(e)}function s(){var n=c();L&&L.remove(),L=t(n).appendTo(e),_=L.find("thead"),P=_.find(".fc-day-header"),j=L.find("tbody"),I=j.find("tr"),X=j.find(".fc-day"),J=I.find("td:first-child"),V=I.eq(0).find(".fc-day > div"),U=I.eq(0).find(".fc-day-content > div"),B(_.add(_.find("tr"))),B(I),I.eq(0).addClass("fc-first"),I.filter(":last").addClass("fc-last"),X.each(function(e,n){var r=Ee(Math.floor(e/ne),e%ne);ge("dayRender",O,r,t(n))}),y(X)}function c(){var t="<table class='fc-border-separate' style='width:100%' cellspacing='0'>"+u()+v()+"</table>";return t}function u(){var t,e,n=le+"-widget-header",r="";for(r+="<thead><tr>",ue&&(r+="<th class='fc-week-number "+n+"'>"+q(de)+"</th>"),t=0;ne>t;t++)e=Ee(0,t),r+="<th class='fc-day-header fc-"+ke[e.getDay()]+" "+n+"'>"+q(xe(e,ce))+"</th>";return r+="</tr></thead>"}function v(){var t,e,n,r=le+"-widget-content",a="";for(a+="<tbody>",t=0;ee>t;t++){for(a+="<tr class='fc-week'>",ue&&(n=Ee(t,0),a+="<td class='fc-week-number "+r+"'>"+"<div>"+q(xe(n,ve))+"</div>"+"</td>"),e=0;ne>e;e++)n=Ee(t,e),a+=h(n);a+="</tr>"}return a+="</tbody>"}function h(t){var e=le+"-widget-content",n=O.start.getMonth(),r=f(new Date),a="",o=["fc-day","fc-"+ke[t.getDay()],e];return t.getMonth()!=n&&o.push("fc-other-month"),+t==+r?o.push("fc-today",le+"-state-highlight"):r>t?o.push("fc-past"):o.push("fc-future"),a+="<td class='"+o.join(" ")+"'"+" data-date='"+xe(t,"yyyy-MM-dd")+"'"+">"+"<div>",re&&(a+="<div class='fc-day-number'>"+t.getDate()+"</div>"),a+="<div class='fc-day-content'><div style='position:relative'> </div></div></div></td>"}function g(e){Q=e;var n,r,a,o=Q-_.height();"variable"==he("weekMode")?n=r=Math.floor(o/(1==ee?2:6)):(n=Math.floor(o/ee),r=o-n*(ee-1)),J.each(function(e,o){ee>e&&(a=t(o),a.find("> div").css("min-height",(e==ee-1?r:n)-R(a)))})}function p(t){$=t,ie.clear(),se.clear(),te=0,ue&&(te=_.find("th.fc-week-number").outerWidth()),K=Math.floor(($-te)/ne),S(P.slice(0,-1),K)}function y(t){t.click(w).mousedown(Me)}function w(e){if(!he("selectable")){var n=m(t(this).data("date"));ge("dayClick",this,n,!0,e)}}function b(t,e,n){n&&ae.build();for(var r=Te(t,e),a=0;r.length>a;a++){var o=r[a];y(D(o.row,o.leftCol,o.row,o.rightCol))}}function D(t,n,r,a){var o=ae.rect(t,n,r,a,e);return be(o,e)}function C(t){return d(t)}function M(t,e){b(t,l(d(e),1),!0)}function E(){Ce()}function T(t,e,n){var r=Se(t),a=X[r.row*ne+r.col];ge("dayClick",a,t,e,n)}function x(t,e){oe.start(function(t){Ce(),t&&D(t.row,t.col,t.row,t.col)},e)}function k(t,e,n){var r=oe.stop();if(Ce(),r){var a=Ee(r);ge("drop",t,a,!0,e,n)}}function H(t){return d(t.start)}function F(t){return ie.left(t)}function N(t){return ie.right(t)}function z(t){return se.left(t)}function W(t){return se.right(t)}function A(t){return I.eq(t)}var O=this;O.renderBasic=a,O.setHeight=g,O.setWidth=p,O.renderDayOverlay=b,O.defaultSelectionEnd=C,O.renderSelection=M,O.clearSelection=E,O.reportDayClick=T,O.dragStart=x,O.dragStop=k,O.defaultEventEnd=H,O.getHoverListener=function(){return oe},O.colLeft=F,O.colRight=N,O.colContentLeft=z,O.colContentRight=W,O.getIsCellAllDay=function(){return!0},O.allDayRow=A,O.getRowCnt=function(){return ee},O.getColCnt=function(){return ne},O.getColWidth=function(){return K},O.getDaySegmentContainer=function(){return Z},fe.call(O,e,n,r),me.call(O),pe.call(O),G.call(O);var L,_,P,j,I,X,J,V,U,Z,$,Q,K,te,ee,ne,re,ae,oe,ie,se,le,ce,ue,de,ve,he=O.opt,ge=O.trigger,be=O.renderOverlay,Ce=O.clearOverlays,Me=O.daySelectionMousedown,Ee=O.cellToDate,Se=O.dateToCell,Te=O.rangeToSegments,xe=n.formatDate;Y(e.addClass("fc-grid")),ae=new ye(function(e,n){var r,a,o;P.each(function(e,i){r=t(i),a=r.offset().left,e&&(o[1]=a),o=[a],n[e]=o}),o[1]=a+r.outerWidth(),I.each(function(n,i){ee>n&&(r=t(i),a=r.offset().top,n&&(o[1]=a),o=[a],e[n]=o)}),o[1]=a+r.outerHeight()}),oe=new we(ae),ie=new De(function(t){return V.eq(t)}),se=new De(function(t){return U.eq(t)})}function G(){function t(t,e){n.renderDayEvents(t,e)}function e(){n.getDaySegmentContainer().empty()}var n=this;n.renderEvents=t,n.clearEvents=e,de.call(n)}function $(t,e){function n(t,e){e&&l(t,7*e);var n=l(d(t),-((t.getDay()-a("firstDay")+7)%7)),u=l(d(n),7),f=d(n);i(f);var v=d(u);i(v,-1,!0);var h=s();r.title=c(f,l(d(v),-1),a("titleFormat")),r.start=n,r.end=u,r.visStart=f,r.visEnd=v,o(h)}var r=this;r.render=n,K.call(r,t,e,"agendaWeek");var a=r.opt,o=r.renderAgenda,i=r.skipHiddenDays,s=r.getCellsPerWeek,c=e.formatDates}function Q(t,e){function n(t,e){e&&l(t,e),i(t,0>e?-1:1);var n=d(t,!0),c=l(d(n),1);r.title=s(t,a("titleFormat")),r.start=r.visStart=n,r.end=r.visEnd=c,o(1)}var r=this;r.render=n,K.call(r,t,e,"agendaDay");var a=r.opt,o=r.renderAgenda,i=r.skipHiddenDays,s=e.formatDate}function K(n,r,a){function o(t){We=t,i(),K?c():s()}function i(){qe=Ue("theme")?"ui":"fc",Ye=Ue("isRTL"),Be=y(Ue("minTime")),je=y(Ue("maxTime")),Ie=Ue("columnFormat"),Xe=Ue("weekNumbers"),Je=Ue("weekNumberTitle"),Ve="iso"!=Ue("weekNumberCalculation")?"w":"W",Re=Ue("snapMinutes")||Ue("slotMinutes")}function s(){var e,r,a,o,i,s=qe+"-widget-header",l=qe+"-widget-content",f=0==Ue("slotMinutes")%15;for(c(),ce=t("<div style='position:absolute;z-index:2;left:0;width:100%'/>").appendTo(n),Ue("allDaySlot")?(ue=t("<div class='fc-event-container' style='position:absolute;z-index:8;top:0;left:0'/>").appendTo(ce),e="<table style='width:100%' class='fc-agenda-allday' cellspacing='0'><tr><th class='"+s+" fc-agenda-axis'>"+Ue("allDayText")+"</th>"+"<td>"+"<div class='fc-day-content'><div style='position:relative'/></div>"+"</td>"+"<th class='"+s+" fc-agenda-gutter'> </th>"+"</tr>"+"</table>",de=t(e).appendTo(ce),ve=de.find("tr"),C(ve.find("td")),ce.append("<div class='fc-agenda-divider "+s+"'>"+"<div class='fc-agenda-divider-inner'/>"+"</div>")):ue=t([]),he=t("<div style='position:absolute;width:100%;overflow-x:hidden;overflow-y:auto'/>").appendTo(ce),ge=t("<div style='position:relative;width:100%;overflow:hidden'/>").appendTo(he),be=t("<div class='fc-event-container' style='position:absolute;z-index:8;top:0;left:0'/>").appendTo(ge),e="<table class='fc-agenda-slots' style='width:100%' cellspacing='0'><tbody>",r=v(),o=u(d(r),je),u(r,Be),Ae=0,a=0;o>r;a++)i=r.getMinutes(),e+="<tr class='fc-slot"+a+" "+(i?"fc-minor":"")+"'>"+"<th class='fc-agenda-axis "+s+"'>"+(f&&i?" ":on(r,Ue("axisFormat")))+"</th>"+"<td class='"+l+"'>"+"<div style='position:relative'> </div>"+"</td>"+"</tr>",u(r,Ue("slotMinutes")),Ae++;e+="</tbody></table>",Ce=t(e).appendTo(ge),M(Ce.find("td"))}function c(){var e=h();K&&K.remove(),K=t(e).appendTo(n),ee=K.find("thead"),ne=ee.find("th").slice(1,-1),re=K.find("tbody"),ae=re.find("td").slice(0,-1),oe=ae.find("> div"),ie=ae.find(".fc-day-content > div"),se=ae.eq(0),le=oe.eq(0),B(ee.add(ee.find("tr"))),B(re.add(re.find("tr")))}function h(){var t="<table style='width:100%' class='fc-agenda-days fc-border-separate' cellspacing='0'>"+g()+p()+"</table>";return t}function g(){var t,e,n,r=qe+"-widget-header",a="";for(a+="<thead><tr>",Xe?(t=nn(0,0),e=on(t,Ve),Ye?e+=Je:e=Je+e,a+="<th class='fc-agenda-axis fc-week-number "+r+"'>"+q(e)+"</th>"):a+="<th class='fc-agenda-axis "+r+"'> </th>",n=0;We>n;n++)t=nn(0,n),a+="<th class='fc-"+ke[t.getDay()]+" fc-col"+n+" "+r+"'>"+q(on(t,Ie))+"</th>";return a+="<th class='fc-agenda-gutter "+r+"'> </th>"+"</tr>"+"</thead>"}function p(){var t,e,n,r,a,o=qe+"-widget-header",i=qe+"-widget-content",s=f(new Date),l="";for(l+="<tbody><tr><th class='fc-agenda-axis "+o+"'> </th>",n="",e=0;We>e;e++)t=nn(0,e),a=["fc-col"+e,"fc-"+ke[t.getDay()],i],+t==+s?a.push(qe+"-state-highlight","fc-today"):s>t?a.push("fc-past"):a.push("fc-future"),r="<td class='"+a.join(" ")+"'>"+"<div>"+"<div class='fc-day-content'>"+"<div style='position:relative'> </div>"+"</div>"+"</div>"+"</td>",n+=r;return l+=n,l+="<td class='fc-agenda-gutter "+i+"'> </td>"+"</tr>"+"</tbody>"}function m(t){t===e&&(t=Se),Se=t,sn={};var n=re.position().top,r=he.position().top,a=Math.min(t-n,Ce.height()+r+1);le.height(a-R(se)),ce.css("top",n),he.height(a-r-1),Fe=Ce.find("tr:first").height()+1,Ne=Ue("slotMinutes")/Re,ze=Fe/Ne}function w(e){Ee=e,_e.clear(),Pe.clear();var n=ee.find("th:first");de&&(n=n.add(de.find("th:first"))),n=n.add(Ce.find("th:first")),Te=0,S(n.width("").each(function(e,n){Te=Math.max(Te,t(n).outerWidth())}),Te);var r=K.find(".fc-agenda-gutter");de&&(r=r.add(de.find("th.fc-agenda-gutter")));var a=he[0].clientWidth;He=he.width()-a,He?(S(r,He),r.show().prev().removeClass("fc-last")):r.hide().prev().addClass("fc-last"),xe=Math.floor((a-Te)/We),S(ne.slice(0,-1),xe)}function b(){function t(){he.scrollTop(r)}var e=v(),n=d(e);n.setHours(Ue("firstHour"));var r=_(e,n)+1;t(),setTimeout(t,0)}function D(){b()}function C(t){t.click(E).mousedown(tn)}function M(t){t.click(E).mousedown(U)}function E(t){if(!Ue("selectable")){var e=Math.min(We-1,Math.floor((t.pageX-K.offset().left-Te)/xe)),n=nn(0,e),r=this.parentNode.className.match(/fc-slot(\d+)/);if(r){var a=parseInt(r[1])*Ue("slotMinutes"),o=Math.floor(a/60);n.setHours(o),n.setMinutes(a%60+Be),Ze("dayClick",ae[e],n,!1,t)}else Ze("dayClick",ae[e],n,!0,t)}}function x(t,e,n){n&&Oe.build();for(var r=an(t,e),a=0;r.length>a;a++){var o=r[a];C(k(o.row,o.leftCol,o.row,o.rightCol))}}function k(t,e,n,r){var a=Oe.rect(t,e,n,r,ce);return Ge(a,ce)}function H(t,e){for(var n=0;We>n;n++){var r=nn(0,n),a=l(d(r),1),o=new Date(Math.max(r,t)),i=new Date(Math.min(a,e));if(i>o){var s=Oe.rect(0,n,0,n,ge),c=_(r,o),u=_(r,i);s.top=c,s.height=u-c,M(Ge(s,ge))}}}function F(t){return _e.left(t)}function N(t){return Pe.left(t)}function z(t){return _e.right(t)}function W(t){return Pe.right(t)}function A(t){return Ue("allDaySlot")&&!t.row}function L(t){var e=nn(0,t.col),n=t.row;return Ue("allDaySlot")&&n--,n>=0&&u(e,Be+n*Re),e}function _(t,n){if(t=d(t,!0),u(d(t),Be)>n)return 0;if(n>=u(d(t),je))return Ce.height();var r=Ue("slotMinutes"),a=60*n.getHours()+n.getMinutes()-Be,o=Math.floor(a/r),i=sn[o];return i===e&&(i=sn[o]=Ce.find("tr").eq(o).find("td div")[0].offsetTop),Math.max(0,Math.round(i-1+Fe*(a%r/r)))}function P(){return ve}function j(t){var e=d(t.start);return t.allDay?e:u(e,Ue("defaultEventMinutes"))}function I(t,e){return e?d(t):u(d(t),Ue("slotMinutes"))}function X(t,e,n){n?Ue("allDaySlot")&&x(t,l(d(e),1),!0):J(t,e)}function J(e,n){var r=Ue("selectHelper");if(Oe.build(),r){var a=rn(e).col;if(a>=0&&We>a){var o=Oe.rect(0,a,0,a,ge),i=_(e,e),s=_(e,n);if(s>i){if(o.top=i,o.height=s-i,o.left+=2,o.width-=5,t.isFunction(r)){var l=r(e,n);l&&(o.position="absolute",Me=t(l).css(o).appendTo(ge))}else o.isStart=!0,o.isEnd=!0,Me=t(en({title:"",start:e,end:n,className:["fc-select-helper"],editable:!1},o)),Me.css("opacity",Ue("dragOpacity"));Me&&(M(Me),ge.append(Me),S(Me,o.width,!0),T(Me,o.height,!0))}}}else H(e,n)}function V(){$e(),Me&&(Me.remove(),Me=null)}function U(e){if(1==e.which&&Ue("selectable")){Ke(e);var n;Le.start(function(t,e){if(V(),t&&t.col==e.col&&!A(t)){var r=L(e),a=L(t);n=[r,u(d(r),Re),a,u(d(a),Re)].sort(O),J(n[0],n[3])}else n=null},e),t(document).one("mouseup",function(t){Le.stop(),n&&(+n[0]==+n[1]&&Z(n[0],!1,t),Qe(n[0],n[3],!1,t))})}}function Z(t,e,n){Ze("dayClick",ae[rn(t).col],t,e,n)}function G(t,e){Le.start(function(t){if($e(),t)if(A(t))k(t.row,t.col,t.row,t.col);else{var e=L(t),n=u(d(e),Ue("defaultEventMinutes"));H(e,n)}},e)}function $(t,e,n){var r=Le.stop();$e(),r&&Ze("drop",t,L(r),A(r),e,n)}var Q=this;Q.renderAgenda=o,Q.setWidth=w,Q.setHeight=m,Q.afterRender=D,Q.defaultEventEnd=j,Q.timePosition=_,Q.getIsCellAllDay=A,Q.allDayRow=P,Q.getCoordinateGrid=function(){return Oe},Q.getHoverListener=function(){return Le},Q.colLeft=F,Q.colRight=z,Q.colContentLeft=N,Q.colContentRight=W,Q.getDaySegmentContainer=function(){return ue},Q.getSlotSegmentContainer=function(){return be},Q.getMinMinute=function(){return Be},Q.getMaxMinute=function(){return je},Q.getSlotContainer=function(){return ge},Q.getRowCnt=function(){return 1},Q.getColCnt=function(){return We},Q.getColWidth=function(){return xe},Q.getSnapHeight=function(){return ze},Q.getSnapMinutes=function(){return Re},Q.defaultSelectionEnd=I,Q.renderDayOverlay=x,Q.renderSelection=X,Q.clearSelection=V,Q.reportDayClick=Z,Q.dragStart=G,Q.dragStop=$,fe.call(Q,n,r,a),me.call(Q),pe.call(Q),te.call(Q);var K,ee,ne,re,ae,oe,ie,se,le,ce,ue,de,ve,he,ge,be,Ce,Me,Ee,Se,Te,xe,He,Fe,Re,Ne,ze,We,Ae,Oe,Le,_e,Pe,qe,Ye,Be,je,Ie,Xe,Je,Ve,Ue=Q.opt,Ze=Q.trigger,Ge=Q.renderOverlay,$e=Q.clearOverlays,Qe=Q.reportSelection,Ke=Q.unselect,tn=Q.daySelectionMousedown,en=Q.slotSegHtml,nn=Q.cellToDate,rn=Q.dateToCell,an=Q.rangeToSegments,on=r.formatDate,sn={};Y(n.addClass("fc-agenda")),Oe=new ye(function(e,n){function r(t){return Math.max(l,Math.min(c,t))}var a,o,i;ne.each(function(e,r){a=t(r),o=a.offset().left,e&&(i[1]=o),i=[o],n[e]=i}),i[1]=o+a.outerWidth(),Ue("allDaySlot")&&(a=ve,o=a.offset().top,e[0]=[o,o+a.outerHeight()]);for(var s=ge.offset().top,l=he.offset().top,c=l+he.outerHeight(),u=0;Ae*Ne>u;u++)e.push([r(s+ze*u),r(s+ze*(u+1))])}),Le=new we(Oe),_e=new De(function(t){return oe.eq(t)}),Pe=new De(function(t){return ie.eq(t)})}function te(){function n(t,e){var n,r=t.length,o=[],i=[];for(n=0;r>n;n++)t[n].allDay?o.push(t[n]):i.push(t[n]);y("allDaySlot")&&(te(o,e),k()),s(a(i),e)}function r(){H().empty(),F().empty()}function a(e){var n,r,a,s,l,c=Y(),f=W(),v=z(),h=t.map(e,i),g=[];for(r=0;c>r;r++)for(n=P(0,r),u(n,f),l=o(e,h,n,u(d(n),v-f)),l=ee(l),a=0;l.length>a;a++)s=l[a],s.col=r,g.push(s);return g}function o(t,e,n,r){var a,o,i,s,l,c,u,f,v=[],h=t.length;for(a=0;h>a;a++)o=t[a],i=o.start,s=e[a],s>n&&r>i&&(n>i?(l=d(n),u=!1):(l=i,u=!0),s>r?(c=d(r),f=!1):(c=s,f=!0),v.push({event:o,start:l,end:c,isStart:u,isEnd:f}));return v.sort(ue)}function i(t){return t.end?d(t.end):u(d(t.start),y("defaultEventMinutes"))}function s(n,r){var a,o,i,s,l,u,d,v,h,g,p,m,b,D,C,M,S=n.length,T="",k=F(),H=y("isRTL");for(a=0;S>a;a++)o=n[a],i=o.event,s=A(o.start,o.start),l=A(o.start,o.end),u=L(o.col),d=_(o.col),v=d-u,d-=.025*v,v=d-u,h=v*(o.forwardCoord-o.backwardCoord),y("slotEventOverlap")&&(h=Math.max(2*(h-10),h)),H?(p=d-o.backwardCoord*v,g=p-h):(g=u+o.backwardCoord*v,p=g+h),g=Math.max(g,u),p=Math.min(p,d),h=p-g,o.top=s,o.left=g,o.outerWidth=h,o.outerHeight=l-s,T+=c(i,o);for(k[0].innerHTML=T,m=k.children(),a=0;S>a;a++)o=n[a],i=o.event,b=t(m[a]),D=w("eventRender",i,i,b),D===!1?b.remove():(D&&D!==!0&&(b.remove(),b=t(D).css({position:"absolute",top:o.top,left:o.left}).appendTo(k)),o.element=b,i._id===r?f(i,b,o):b[0]._fci=a,V(i,b));for(E(k,n,f),a=0;S>a;a++)o=n[a],(b=o.element)&&(o.vsides=R(b,!0),o.hsides=x(b,!0),C=b.find(".fc-event-title"),C.length&&(o.contentTop=C[0].offsetTop));for(a=0;S>a;a++)o=n[a],(b=o.element)&&(b[0].style.width=Math.max(0,o.outerWidth-o.hsides)+"px",M=Math.max(0,o.outerHeight-o.vsides),b[0].style.height=M+"px",i=o.event,o.contentTop!==e&&10>M-o.contentTop&&(b.find("div.fc-event-time").text(re(i.start,y("timeFormat"))+" - "+i.title),b.find("div.fc-event-title").remove()),w("eventAfterRender",i,i,b))}function c(t,e){var n="<",r=t.url,a=j(t,y),o=["fc-event","fc-event-vert"];return b(t)&&o.push("fc-event-draggable"),e.isStart&&o.push("fc-event-start"),e.isEnd&&o.push("fc-event-end"),o=o.concat(t.className),t.source&&(o=o.concat(t.source.className||[])),n+=r?"a href='"+q(t.url)+"'":"div",n+=" class='"+o.join(" ")+"'"+" style="+"'"+"position:absolute;"+"top:"+e.top+"px;"+"left:"+e.left+"px;"+a+"'"+">"+"<div class='fc-event-inner'>"+"<div class='fc-event-time'>"+q(ae(t.start,t.end,y("timeFormat")))+"</div>"+"<div class='fc-event-title'>"+q(t.title||"")+"</div>"+"</div>"+"<div class='fc-event-bg'></div>",e.isEnd&&D(t)&&(n+="<div class='ui-resizable-handle ui-resizable-s'>=</div>"),n+="</"+(r?"a":"div")+">"}function f(t,e,n){var r=e.find("div.fc-event-time");b(t)&&g(t,e,r),n.isEnd&&D(t)&&p(t,e,r),S(t,e)}function v(t,e,n){function r(){c||(e.width(a).height("").draggable("option","grid",null),c=!0)}var a,o,i,s=n.isStart,c=!0,u=N(),f=B(),v=I(),g=X(),p=W();e.draggable({opacity:y("dragOpacity","month"),revertDuration:y("dragRevertDuration"),start:function(n,p){w("eventDragStart",e,t,n,p),Z(t,e),a=e.width(),u.start(function(n,a){if(K(),n){o=!1;var u=P(0,a.col),p=P(0,n.col);i=h(p,u),n.row?s?c&&(e.width(f-10),T(e,v*Math.round((t.end?(t.end-t.start)/Re:y("defaultEventMinutes"))/g)),e.draggable("option","grid",[f,1]),c=!1):o=!0:(Q(l(d(t.start),i),l(C(t),i)),r()),o=o||c&&!i
+}else r(),o=!0;e.draggable("option","revert",o)},n,"drag")},stop:function(n,a){if(u.stop(),K(),w("eventDragStop",e,t,n,a),o)r(),e.css("filter",""),U(t,e);else{var s=0;c||(s=Math.round((e.offset().top-J().offset().top)/v)*g+p-(60*t.start.getHours()+t.start.getMinutes())),G(this,t,i,s,c,n,a)}}})}function g(t,e,n){function r(){K(),s&&(f?(n.hide(),e.draggable("option","grid",null),Q(l(d(t.start),b),l(C(t),b))):(a(D),n.css("display",""),e.draggable("option","grid",[T,x])))}function a(e){var r,a=u(d(t.start),e);t.end&&(r=u(d(t.end),e)),n.text(ae(a,r,y("timeFormat")))}var o,i,s,c,f,v,g,p,b,D,M,E=m.getCoordinateGrid(),S=Y(),T=B(),x=I(),k=X();e.draggable({scroll:!1,grid:[T,x],axis:1==S?"y":!1,opacity:y("dragOpacity"),revertDuration:y("dragRevertDuration"),start:function(n,r){w("eventDragStart",e,t,n,r),Z(t,e),E.build(),o=e.position(),i=E.cell(n.pageX,n.pageY),s=c=!0,f=v=O(i),g=p=0,b=0,D=M=0},drag:function(t,n){var a=E.cell(t.pageX,t.pageY);if(s=!!a){if(f=O(a),g=Math.round((n.position.left-o.left)/T),g!=p){var l=P(0,i.col),u=i.col+g;u=Math.max(0,u),u=Math.min(S-1,u);var d=P(0,u);b=h(d,l)}f||(D=Math.round((n.position.top-o.top)/x)*k)}(s!=c||f!=v||g!=p||D!=M)&&(r(),c=s,v=f,p=g,M=D),e.draggable("option","revert",!s)},stop:function(n,a){K(),w("eventDragStop",e,t,n,a),s&&(f||b||D)?G(this,t,b,f?0:D,f,n,a):(s=!0,f=!1,g=0,b=0,D=0,r(),e.css("filter",""),e.css(o),U(t,e))}})}function p(t,e,n){var r,a,o=I(),i=X();e.resizable({handles:{s:".ui-resizable-handle"},grid:o,start:function(n,o){r=a=0,Z(t,e),w("eventResizeStart",this,t,n,o)},resize:function(s,l){r=Math.round((Math.max(o,e.height())-l.originalSize.height)/o),r!=a&&(n.text(ae(t.start,r||t.end?u(M(t),i*r):null,y("timeFormat"))),a=r)},stop:function(n,a){w("eventResizeStop",this,t,n,a),r?$(this,t,0,i*r,n,a):U(t,e)}})}var m=this;m.renderEvents=n,m.clearEvents=r,m.slotSegHtml=c,de.call(m);var y=m.opt,w=m.trigger,b=m.isEventDraggable,D=m.isEventResizable,M=m.eventEnd,S=m.eventElementHandlers,k=m.setHeight,H=m.getDaySegmentContainer,F=m.getSlotSegmentContainer,N=m.getHoverListener,z=m.getMaxMinute,W=m.getMinMinute,A=m.timePosition,O=m.getIsCellAllDay,L=m.colContentLeft,_=m.colContentRight,P=m.cellToDate,Y=m.getColCnt,B=m.getColWidth,I=m.getSnapHeight,X=m.getSnapMinutes,J=m.getSlotContainer,V=m.reportEventElement,U=m.showEvents,Z=m.hideEvents,G=m.eventDrop,$=m.eventResize,Q=m.renderDayOverlay,K=m.clearOverlays,te=m.renderDayEvents,ne=m.calendar,re=ne.formatDate,ae=ne.formatDates;m.draggableDayEvent=v}function ee(t){var e,n=ne(t),r=n[0];if(re(n),r){for(e=0;r.length>e;e++)ae(r[e]);for(e=0;r.length>e;e++)oe(r[e],0,0)}return ie(n)}function ne(t){var e,n,r,a=[];for(e=0;t.length>e;e++){for(n=t[e],r=0;a.length>r&&se(n,a[r]).length;r++);(a[r]||(a[r]=[])).push(n)}return a}function re(t){var e,n,r,a,o;for(e=0;t.length>e;e++)for(n=t[e],r=0;n.length>r;r++)for(a=n[r],a.forwardSegs=[],o=e+1;t.length>o;o++)se(a,t[o],a.forwardSegs)}function ae(t){var n,r,a=t.forwardSegs,o=0;if(t.forwardPressure===e){for(n=0;a.length>n;n++)r=a[n],ae(r),o=Math.max(o,1+r.forwardPressure);t.forwardPressure=o}}function oe(t,n,r){var a,o=t.forwardSegs;if(t.forwardCoord===e)for(o.length?(o.sort(ce),oe(o[0],n+1,r),t.forwardCoord=o[0].backwardCoord):t.forwardCoord=1,t.backwardCoord=t.forwardCoord-(t.forwardCoord-r)/(n+1),a=0;o.length>a;a++)oe(o[a],0,t.forwardCoord)}function ie(t){var e,n,r,a=[];for(e=0;t.length>e;e++)for(n=t[e],r=0;n.length>r;r++)a.push(n[r]);return a}function se(t,e,n){n=n||[];for(var r=0;e.length>r;r++)le(t,e[r])&&n.push(e[r]);return n}function le(t,e){return t.end>e.start&&t.start<e.end}function ce(t,e){return e.forwardPressure-t.forwardPressure||(t.backwardCoord||0)-(e.backwardCoord||0)||ue(t,e)}function ue(t,e){return t.start-e.start||e.end-e.start-(t.end-t.start)||(t.event.title||"").localeCompare(e.event.title)}function fe(n,r,a){function o(e,n){var r=V[e];return t.isPlainObject(r)?P(r,n||a):r}function i(t,e){return r.trigger.apply(r,[t,e||_].concat(Array.prototype.slice.call(arguments,2),[_]))}function s(t){var e=t.source||{};return X(t.startEditable,e.startEditable,o("eventStartEditable"),t.editable,e.editable,o("editable"))&&!o("disableDragging")}function c(t){var e=t.source||{};return X(t.durationEditable,e.durationEditable,o("eventDurationEditable"),t.editable,e.editable,o("editable"))&&!o("disableResizing")}function f(t){j={};var e,n,r=t.length;for(e=0;r>e;e++)n=t[e],j[n._id]?j[n._id].push(n):j[n._id]=[n]}function v(){j={},I={},J=[]}function g(t){return t.end?d(t.end):q(t)}function p(t,e){J.push({event:t,element:e}),I[t._id]?I[t._id].push(e):I[t._id]=[e]}function m(){t.each(J,function(t,e){_.trigger("eventDestroy",e.event,e.event,e.element)})}function y(t,n){n.click(function(r){return n.hasClass("ui-draggable-dragging")||n.hasClass("ui-resizable-resizing")?e:i("eventClick",this,t,r)}).hover(function(e){i("eventMouseover",this,t,e)},function(e){i("eventMouseout",this,t,e)})}function w(t,e){D(t,e,"show")}function b(t,e){D(t,e,"hide")}function D(t,e,n){var r,a=I[t._id],o=a.length;for(r=0;o>r;r++)e&&a[r][0]==e[0]||a[r][n]()}function C(t,e,n,r,a,o,s){var l=e.allDay,c=e._id;E(j[c],n,r,a),i("eventDrop",t,e,n,r,a,function(){E(j[c],-n,-r,l),B(c)},o,s),B(c)}function M(t,e,n,r,a,o){var s=e._id;S(j[s],n,r),i("eventResize",t,e,n,r,function(){S(j[s],-n,-r),B(s)},a,o),B(s)}function E(t,n,r,a){r=r||0;for(var o,i=t.length,s=0;i>s;s++)o=t[s],a!==e&&(o.allDay=a),u(l(o.start,n,!0),r),o.end&&(o.end=u(l(o.end,n,!0),r)),Y(o,V)}function S(t,e,n){n=n||0;for(var r,a=t.length,o=0;a>o;o++)r=t[o],r.end=u(l(g(r),e,!0),n),Y(r,V)}function T(t){return"object"==typeof t&&(t=t.getDay()),G[t]}function x(){return U}function k(t,e,n){for(e=e||1;G[(t.getDay()+(n?e:0)+7)%7];)l(t,e)}function H(){var t=F.apply(null,arguments),e=R(t),n=N(e);return n}function F(t,e){var n=_.getColCnt(),r=K?-1:1,a=K?n-1:0;"object"==typeof t&&(e=t.col,t=t.row);var o=t*n+(e*r+a);return o}function R(t){var e=_.visStart.getDay();return t+=$[e],7*Math.floor(t/U)+Q[(t%U+U)%U]-e}function N(t){var e=d(_.visStart);return l(e,t),e}function z(t){var e=W(t),n=A(e),r=O(n);return r}function W(t){return h(t,_.visStart)}function A(t){var e=_.visStart.getDay();return t+=e,Math.floor(t/7)*U+$[(t%7+7)%7]-$[e]}function O(t){var e=_.getColCnt(),n=K?-1:1,r=K?e-1:0,a=Math.floor(t/e),o=(t%e+e)%e*n+r;return{row:a,col:o}}function L(t,e){for(var n=_.getRowCnt(),r=_.getColCnt(),a=[],o=W(t),i=W(e),s=A(o),l=A(i)-1,c=0;n>c;c++){var u=c*r,f=u+r-1,d=Math.max(s,u),v=Math.min(l,f);if(v>=d){var h=O(d),g=O(v),p=[h.col,g.col].sort(),m=R(d)==o,y=R(v)+1==i;a.push({row:c,leftCol:p[0],rightCol:p[1],isStart:m,isEnd:y})}}return a}var _=this;_.element=n,_.calendar=r,_.name=a,_.opt=o,_.trigger=i,_.isEventDraggable=s,_.isEventResizable=c,_.setEventData=f,_.clearEventData=v,_.eventEnd=g,_.reportEventElement=p,_.triggerEventDestroy=m,_.eventElementHandlers=y,_.showEvents=w,_.hideEvents=b,_.eventDrop=C,_.eventResize=M;var q=_.defaultEventEnd,Y=r.normalizeEvent,B=r.reportEventChange,j={},I={},J=[],V=r.options;_.isHiddenDay=T,_.skipHiddenDays=k,_.getCellsPerWeek=x,_.dateToCell=z,_.dateToDayOffset=W,_.dayOffsetToCellOffset=A,_.cellOffsetToCell=O,_.cellToDate=H,_.cellToCellOffset=F,_.cellOffsetToDayOffset=R,_.dayOffsetToDate=N,_.rangeToSegments=L;var U,Z=o("hiddenDays")||[],G=[],$=[],Q=[],K=o("isRTL");(function(){o("weekends")===!1&&Z.push(0,6);for(var e=0,n=0;7>e;e++)$[e]=n,G[e]=-1!=t.inArray(e,Z),G[e]||(Q[n]=e,n++);if(U=n,!U)throw"invalid hiddenDays"})()}function de(){function e(t,e){var n=r(t,!1,!0);he(n,function(t,e){N(t.event,e)}),w(n,e),he(n,function(t,e){k("eventAfterRender",t.event,t.event,e)})}function n(t,e,n){var a=r([t],!0,!1),o=[];return he(a,function(t,r){t.row===e&&r.css("top",n),o.push(r[0])}),o}function r(e,n,r){var o,l,c=Z(),d=n?t("<div/>"):c,v=a(e);return i(v),o=s(v),d[0].innerHTML=o,l=d.children(),n&&c.append(l),u(v,l),he(v,function(t,e){t.hsides=x(e,!0)}),he(v,function(t,e){e.width(Math.max(0,t.outerWidth-t.hsides))}),he(v,function(t,e){t.outerHeight=e.outerHeight(!0)}),f(v,r),v}function a(t){for(var e=[],n=0;t.length>n;n++){var r=o(t[n]);e.push.apply(e,r)}return e}function o(t){for(var e=t.start,n=C(t),r=ee(e,n),a=0;r.length>a;a++)r[a].event=t;return r}function i(t){for(var e=T("isRTL"),n=0;t.length>n;n++){var r=t[n],a=(e?r.isEnd:r.isStart)?V:X,o=(e?r.isStart:r.isEnd)?U:J,i=a(r.leftCol),s=o(r.rightCol);r.left=i,r.outerWidth=s-i}}function s(t){for(var e="",n=0;t.length>n;n++)e+=c(t[n]);return e}function c(t){var e="",n=T("isRTL"),r=t.event,a=r.url,o=["fc-event","fc-event-hori"];H(r)&&o.push("fc-event-draggable"),t.isStart&&o.push("fc-event-start"),t.isEnd&&o.push("fc-event-end"),o=o.concat(r.className),r.source&&(o=o.concat(r.source.className||[]));var i=j(r,T);return e+=a?"<a href='"+q(a)+"'":"<div",e+=" class='"+o.join(" ")+"'"+" style="+"'"+"position:absolute;"+"left:"+t.left+"px;"+i+"'"+">"+"<div class='fc-event-inner'>",!r.allDay&&t.isStart&&(e+="<span class='fc-event-time'>"+q(G(r.start,r.end,T("timeFormat")))+"</span>"),e+="<span class='fc-event-title'>"+q(r.title||"")+"</span>"+"</div>",t.isEnd&&F(r)&&(e+="<div class='ui-resizable-handle ui-resizable-"+(n?"w":"e")+"'>"+" "+"</div>"),e+="</"+(a?"a":"div")+">"}function u(e,n){for(var r=0;e.length>r;r++){var a=e[r],o=a.event,i=n.eq(r),s=k("eventRender",o,o,i);s===!1?i.remove():(s&&s!==!0&&(s=t(s).css({position:"absolute",left:a.left}),i.replaceWith(s),i=s),a.element=i)}}function f(t,e){var n=v(t),r=y(),a=[];if(e)for(var o=0;r.length>o;o++)r[o].height(n[o]);for(var o=0;r.length>o;o++)a.push(r[o].position().top);he(t,function(t,e){e.css("top",a[t.row]+t.top)})}function v(t){for(var e=P(),n=B(),r=[],a=g(t),o=0;e>o;o++){for(var i=a[o],s=[],l=0;n>l;l++)s.push(0);for(var c=0;i.length>c;c++){var u=i[c];u.top=L(s.slice(u.leftCol,u.rightCol+1));for(var l=u.leftCol;u.rightCol>=l;l++)s[l]=u.top+u.outerHeight}r.push(L(s))}return r}function g(t){var e,n,r,a=P(),o=[];for(e=0;t.length>e;e++)n=t[e],r=n.row,n.element&&(o[r]?o[r].push(n):o[r]=[n]);for(r=0;a>r;r++)o[r]=p(o[r]||[]);return o}function p(t){for(var e=[],n=m(t),r=0;n.length>r;r++)e.push.apply(e,n[r]);return e}function m(t){t.sort(ge);for(var e=[],n=0;t.length>n;n++){for(var r=t[n],a=0;e.length>a&&ve(r,e[a]);a++);e[a]?e[a].push(r):e[a]=[r]}return e}function y(){var t,e=P(),n=[];for(t=0;e>t;t++)n[t]=I(t).find("div.fc-day-content > div");return n}function w(t,e){var n=Z();he(t,function(t,n,r){var a=t.event;a._id===e?b(a,n,t):n[0]._fci=r}),E(n,t,b)}function b(t,e,n){H(t)&&S.draggableDayEvent(t,e,n),n.isEnd&&F(t)&&S.resizableDayEvent(t,e,n),z(t,e)}function D(t,e){var n,r=te();e.draggable({delay:50,opacity:T("dragOpacity"),revertDuration:T("dragRevertDuration"),start:function(a,o){k("eventDragStart",e,t,a,o),A(t,e),r.start(function(r,a,o,i){if(e.draggable("option","revert",!r||!o&&!i),Q(),r){var s=ne(a),c=ne(r);n=h(c,s),$(l(d(t.start),n),l(C(t),n))}else n=0},a,"drag")},stop:function(a,o){r.stop(),Q(),k("eventDragStop",e,t,a,o),n?O(this,t,n,0,t.allDay,a,o):(e.css("filter",""),W(t,e))}})}function M(e,r,a){var o=T("isRTL"),i=o?"w":"e",s=r.find(".ui-resizable-"+i),c=!1;Y(r),r.mousedown(function(t){t.preventDefault()}).click(function(t){c&&(t.preventDefault(),t.stopImmediatePropagation())}),s.mousedown(function(o){function s(n){k("eventResizeStop",this,e,n),t("body").css("cursor",""),u.stop(),Q(),f&&_(this,e,f,0,n),setTimeout(function(){c=!1},0)}if(1==o.which){c=!0;var u=te();P(),B();var f,d,v=r.css("top"),h=t.extend({},e),g=ie(oe(e.start));K(),t("body").css("cursor",i+"-resize").one("mouseup",s),k("eventResizeStart",this,e,o),u.start(function(r,o){if(r){var s=re(o),c=re(r);if(c=Math.max(c,g),f=ae(c)-ae(s)){h.end=l(R(e),f,!0);var u=d;d=n(h,a.row,v),d=t(d),d.find("*").css("cursor",i+"-resize"),u&&u.remove(),A(e)}else d&&(W(e),d.remove(),d=null);Q(),$(e.start,l(C(e),f))}},o)}})}var S=this;S.renderDayEvents=e,S.draggableDayEvent=D,S.resizableDayEvent=M;var T=S.opt,k=S.trigger,H=S.isEventDraggable,F=S.isEventResizable,R=S.eventEnd,N=S.reportEventElement,z=S.eventElementHandlers,W=S.showEvents,A=S.hideEvents,O=S.eventDrop,_=S.eventResize,P=S.getRowCnt,B=S.getColCnt;S.getColWidth;var I=S.allDayRow,X=S.colLeft,J=S.colRight,V=S.colContentLeft,U=S.colContentRight;S.dateToCell;var Z=S.getDaySegmentContainer,G=S.calendar.formatDates,$=S.renderDayOverlay,Q=S.clearOverlays,K=S.clearSelection,te=S.getHoverListener,ee=S.rangeToSegments,ne=S.cellToDate,re=S.cellToCellOffset,ae=S.cellOffsetToDayOffset,oe=S.dateToDayOffset,ie=S.dayOffsetToCellOffset}function ve(t,e){for(var n=0;e.length>n;n++){var r=e[n];if(r.leftCol<=t.rightCol&&r.rightCol>=t.leftCol)return!0}return!1}function he(t,e){for(var n=0;t.length>n;n++){var r=t[n],a=r.element;a&&e(r,a,n)}}function ge(t,e){return e.rightCol-e.leftCol-(t.rightCol-t.leftCol)||e.event.allDay-t.event.allDay||t.event.start-e.event.start||(t.event.title||"").localeCompare(e.event.title)}function pe(){function e(t,e,a){n(),e||(e=l(t,a)),c(t,e,a),r(t,e,a)}function n(t){f&&(f=!1,u(),s("unselect",null,t))}function r(t,e,n,r){f=!0,s("select",null,t,e,n,r)}function a(e){var a=o.cellToDate,s=o.getIsCellAllDay,l=o.getHoverListener(),f=o.reportDayClick;if(1==e.which&&i("selectable")){n(e);var d;l.start(function(t,e){u(),t&&s(t)?(d=[a(e),a(t)].sort(O),c(d[0],d[1],!0)):d=null},e),t(document).one("mouseup",function(t){l.stop(),d&&(+d[0]==+d[1]&&f(d[0],!0,t),r(d[0],d[1],!0,t))})}}var o=this;o.select=e,o.unselect=n,o.reportSelection=r,o.daySelectionMousedown=a;var i=o.opt,s=o.trigger,l=o.defaultSelectionEnd,c=o.renderSelection,u=o.clearSelection,f=!1;i("selectable")&&i("unselectAuto")&&t(document).mousedown(function(e){var r=i("unselectCancel");r&&t(e.target).parents(r).length||n(e)})}function me(){function e(e,n){var r=o.shift();return r||(r=t("<div class='fc-cell-overlay' style='position:absolute;z-index:3'/>")),r[0].parentNode!=n[0]&&r.appendTo(n),a.push(r.css(e).show()),r}function n(){for(var t;t=a.shift();)o.push(t.hide().unbind())}var r=this;r.renderOverlay=e,r.clearOverlays=n;var a=[],o=[]}function ye(t){var e,n,r=this;r.build=function(){e=[],n=[],t(e,n)},r.cell=function(t,r){var a,o=e.length,i=n.length,s=-1,l=-1;for(a=0;o>a;a++)if(r>=e[a][0]&&e[a][1]>r){s=a;break}for(a=0;i>a;a++)if(t>=n[a][0]&&n[a][1]>t){l=a;break}return s>=0&&l>=0?{row:s,col:l}:null},r.rect=function(t,r,a,o,i){var s=i.offset();return{top:e[t][0]-s.top,left:n[r][0]-s.left,width:n[o][1]-n[r][0],height:e[a][1]-e[t][0]}}}function we(e){function n(t){be(t);var n=e.cell(t.pageX,t.pageY);(!n!=!i||n&&(n.row!=i.row||n.col!=i.col))&&(n?(o||(o=n),a(n,o,n.row-o.row,n.col-o.col)):a(n,o),i=n)}var r,a,o,i,s=this;s.start=function(s,l,c){a=s,o=i=null,e.build(),n(l),r=c||"mousemove",t(document).bind(r,n)},s.stop=function(){return t(document).unbind(r,n),i}}function be(t){t.pageX===e&&(t.pageX=t.originalEvent.pageX,t.pageY=t.originalEvent.pageY)}function De(t){function n(e){return a[e]=a[e]||t(e)}var r=this,a={},o={},i={};r.left=function(t){return o[t]=o[t]===e?n(t).position().left:o[t]},r.right=function(t){return i[t]=i[t]===e?r.left(t)+n(t).width():i[t]},r.clear=function(){a={},o={},i={}}}var Ce={defaultView:"month",aspectRatio:1.35,header:{left:"title",center:"",right:"today prev,next"},weekends:!0,weekNumbers:!1,weekNumberCalculation:"iso",weekNumberTitle:"W",allDayDefault:!0,ignoreTimezone:!0,lazyFetching:!0,startParam:"start",endParam:"end",titleFormat:{month:"MMMM yyyy",week:"MMM d[ yyyy]{ '—'[ MMM] d yyyy}",day:"dddd, MMM d, yyyy"},columnFormat:{month:"ddd",week:"ddd M/d",day:"dddd M/d"},timeFormat:{"":"h(:mm)t"},isRTL:!1,firstDay:0,monthNames:["January","February","March","April","May","June","July","August","September","October","November","December"],monthNamesShort:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"],dayNames:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],dayNamesShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],buttonText:{prev:"<span class='fc-text-arrow'>‹</span>",next:"<span class='fc-text-arrow'>›</span>",prevYear:"<span class='fc-text-arrow'>«</span>",nextYear:"<span class='fc-text-arrow'>»</span>",today:"today",month:"month",week:"week",day:"day"},theme:!1,buttonIcons:{prev:"circle-triangle-w",next:"circle-triangle-e"},unselectAuto:!0,dropAccept:"*",handleWindowResize:!0},Me={header:{left:"next,prev today",center:"",right:"title"},buttonText:{prev:"<span class='fc-text-arrow'>›</span>",next:"<span class='fc-text-arrow'>‹</span>",prevYear:"<span class='fc-text-arrow'>»</span>",nextYear:"<span class='fc-text-arrow'>«</span>"},buttonIcons:{prev:"circle-triangle-e",next:"circle-triangle-w"}},Ee=t.fullCalendar={version:"1.6.4"},Se=Ee.views={};t.fn.fullCalendar=function(n){if("string"==typeof n){var a,o=Array.prototype.slice.call(arguments,1);return this.each(function(){var r=t.data(this,"fullCalendar");if(r&&t.isFunction(r[n])){var i=r[n].apply(r,o);a===e&&(a=i),"destroy"==n&&t.removeData(this,"fullCalendar")}}),a!==e?a:this}n=n||{};var i=n.eventSources||[];return delete n.eventSources,n.events&&(i.push(n.events),delete n.events),n=t.extend(!0,{},Ce,n.isRTL||n.isRTL===e&&Ce.isRTL?Me:{},n),this.each(function(e,a){var o=t(a),s=new r(o,n,i);o.data("fullCalendar",s),s.render()}),this},Ee.sourceNormalizers=[],Ee.sourceFetchers=[];var Te={dataType:"json",cache:!1},xe=1;Ee.addDays=l,Ee.cloneDate=d,Ee.parseDate=p,Ee.parseISO8601=m,Ee.parseTime=y,Ee.formatDate=w,Ee.formatDates=b;var ke=["sun","mon","tue","wed","thu","fri","sat"],He=864e5,Fe=36e5,Re=6e4,Ne={s:function(t){return t.getSeconds()},ss:function(t){return _(t.getSeconds())},m:function(t){return t.getMinutes()},mm:function(t){return _(t.getMinutes())},h:function(t){return t.getHours()%12||12},hh:function(t){return _(t.getHours()%12||12)},H:function(t){return t.getHours()},HH:function(t){return _(t.getHours())},d:function(t){return t.getDate()},dd:function(t){return _(t.getDate())},ddd:function(t,e){return e.dayNamesShort[t.getDay()]},dddd:function(t,e){return e.dayNames[t.getDay()]},M:function(t){return t.getMonth()+1},MM:function(t){return _(t.getMonth()+1)},MMM:function(t,e){return e.monthNamesShort[t.getMonth()]},MMMM:function(t,e){return e.monthNames[t.getMonth()]},yy:function(t){return(t.getFullYear()+"").substring(2)},yyyy:function(t){return t.getFullYear()},t:function(t){return 12>t.getHours()?"a":"p"},tt:function(t){return 12>t.getHours()?"am":"pm"},T:function(t){return 12>t.getHours()?"A":"P"},TT:function(t){return 12>t.getHours()?"AM":"PM"},u:function(t){return w(t,"yyyy-MM-dd'T'HH:mm:ss'Z'")},S:function(t){var e=t.getDate();return e>10&&20>e?"th":["st","nd","rd"][e%10-1]||"th"},w:function(t,e){return e.weekNumberCalculation(t)},W:function(t){return D(t)}};Ee.dateFormatters=Ne,Ee.applyAll=I,Se.month=J,Se.basicWeek=V,Se.basicDay=U,n({weekMode:"fixed"}),Se.agendaWeek=$,Se.agendaDay=Q,n({allDaySlot:!0,allDayText:"all-day",firstHour:6,slotMinutes:30,defaultEventMinutes:120,axisFormat:"h(:mm)tt",timeFormat:{agenda:"h:mm{ - h:mm}"},dragOpacity:{agenda:.5},minTime:0,maxTime:24,slotEventOverlap:!0})})(jQuery);
\ No newline at end of file
+/*!
+ * FullCalendar v1.6.4 Print Stylesheet
+ * Docs & License: http://arshaw.com/fullcalendar/
+ * (c) 2013 Adam Shaw
+ */
+
/*
- * FullCalendar v1.5.3 Print Stylesheet
- *
* Include this stylesheet on your page to get a more printer-friendly calendar.
* When including this stylesheet, use the media='print' attribute of the <link> tag.
* Make sure to include this stylesheet IN ADDITION to the regular fullcalendar.css.
- *
- * Copyright (c) 2011 Adam Shaw
- * Dual licensed under the MIT and GPL licenses, located in
- * MIT-LICENSE.txt and GPL-LICENSE.txt respectively.
- *
- * Date: Mon Feb 6 22:40:40 2012 -0800
- *
*/
/* Events
-----------------------------------------------------*/
-.fc-event-skin {
- background: none !important;
+.fc-event {
+ background: #fff !important;
color: #000 !important;
}
-/* horizontal events */
-
-.fc-event-hori {
- border-width: 0 0 1px 0 !important;
- border-bottom-style: dotted !important;
- border-bottom-color: #000 !important;
- padding: 1px 0 0 0 !important;
- }
-
-.fc-event-hori .fc-event-inner {
- border-width: 0 !important;
- padding: 0 1px !important;
- }
-
-/* vertical events */
-
-.fc-event-vert {
- border-width: 0 0 0 1px !important;
- border-left-style: dotted !important;
- border-left-color: #000 !important;
- padding: 0 1px 0 0 !important;
- }
-
-.fc-event-vert .fc-event-inner {
- border-width: 0 !important;
- padding: 1px 0 !important;
- }
+/* for vertical events */
.fc-event-bg {
display: none !important;
-/*
- * FullCalendar v1.5.3 Google Calendar Plugin
- *
- * Copyright (c) 2011 Adam Shaw
- * Dual licensed under the MIT and GPL licenses, located in
- * MIT-LICENSE.txt and GPL-LICENSE.txt respectively.
- *
- * Date: Mon Feb 6 22:40:40 2012 -0800
- *
+/*!
+ * FullCalendar v1.6.4 Google Calendar Plugin
+ * Docs & License: http://arshaw.com/fullcalendar/
+ * (c) 2013 Adam Shaw
*/
(function($) {
--- /dev/null
+Copyright (c) 2013 Adam Shaw
+
+Permission is hereby granted, free of charge, to any person obtaining
+a copy of this software and associated documentation files (the
+"Software"), to deal in the Software without restriction, including
+without limitation the rights to use, copy, modify, merge, publish,
+distribute, sublicense, and/or sell copies of the Software, and to
+permit persons to whom the Software is furnished to do so, subject to
+the following conditions:
+
+The above copyright notice and this permission notice shall be
+included in all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
--- /dev/null
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
<base href="{{$baseurl}}/" />
<meta name="generator" content="{{$generator}}" />
<link rel="stylesheet" href="{{$baseurl}}/view/global.css" type="text/css" media="all" />
-{{*<!--<link rel="stylesheet" href="{{$baseurl}}/library/fancybox/jquery.fancybox.css" type="text/css" media="screen" />-->*}}
<link rel="stylesheet" href="{{$baseurl}}/library/colorbox/colorbox.css" type="text/css" media="screen" />
<link rel="stylesheet" href="{{$baseurl}}/library/jgrowl/jquery.jgrowl.css" type="text/css" media="screen" />
<script type="text/javascript" src="{{$baseurl}}/js/jquery-migrate.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/js/jquery.textinputs.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/js/fk.autocomplete.js" ></script>
-{{*<!--<script type="text/javascript" src="{{$baseurl}}/library/fancybox/jquery.fancybox.pack.js"></script>-->*}}
<script type="text/javascript" src="{{$baseurl}}/library/colorbox/jquery.colorbox-min.js"></script>
<script type="text/javascript" src="{{$baseurl}}/library/jgrowl/jquery.jgrowl_minimized.js"></script>
<script type="text/javascript" src="{{$baseurl}}/library/tinymce/jscripts/tiny_mce/tiny_mce_src.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/view/theme/decaf-mobile/js/jquery.divgrow-1.3.1.f1.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/js/jquery.textinputs.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/view/theme/decaf-mobile/js/fk.autocomplete.js" ></script>-->*}}
-{{*<!--<script type="text/javascript" src="{{$baseurl}}/library/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
-<script type="text/javascript" src="{{$baseurl}}/library/colorbox/jquery.colorbox-min.js"></script>-->*}}
+{{*<!--<script type="text/javascript" src="{{$baseurl}}/library/colorbox/jquery.colorbox-min.js"></script>-->*}}
{{*<!--<script type="text/javascript" src="{{$baseurl}}/library/tiptip/jquery.tipTip.minified.js"></script>-->*}}
{{*<!--<script type="text/javascript" src="{{$baseurl}}/library/jgrowl/jquery.jgrowl_minimized.js"></script>
<script type="text/javascript" src="{{$baseurl}}/view/theme/decaf-mobile/js/acl.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/js/jquery.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/view/theme/frost-mobile/js/jquery.divgrow-1.3.1.f1.min.js" ></script>
<script type="text/javascript" src="{{$baseurl}}/js/jquery.textinputs.js" ></script>
-{{*<!--<script type="text/javascript" src="{{$baseurl}}/library/fancybox/jquery.fancybox-1.3.4.pack.js"></script>
-<script type="text/javascript" src="{{$baseurl}}/library/colorbox/jquery.colorbox-min.js"></script>-->*}}
+{{*<!--<script type="text/javascript" src="{{$baseurl}}/library/colorbox/jquery.colorbox-min.js"></script>-->*}}
{{*<!--<script type="text/javascript" src="{{$baseurl}}/library/tiptip/jquery.tipTip.minified.js"></script>-->*}}
<script type="text/javascript" src="{{$baseurl}}/library/jgrowl/jquery.jgrowl_minimized.js"></script>