diff options
l--------- | bin/apigen.php | 1 | ||||
l--------- | bin/phing | 1 | ||||
l--------- | bin/phpunit | 1 | ||||
-rw-r--r-- | composer.lock | 782 | ||||
-rw-r--r-- | framework/pradolite.php | 861 |
5 files changed, 923 insertions, 723 deletions
diff --git a/bin/apigen.php b/bin/apigen.php new file mode 120000 index 00000000..36dafc2a --- /dev/null +++ b/bin/apigen.php @@ -0,0 +1 @@ +../vendor/apigen/apigen/apigen.php
\ No newline at end of file diff --git a/bin/phing b/bin/phing new file mode 120000 index 00000000..c5270ef2 --- /dev/null +++ b/bin/phing @@ -0,0 +1 @@ +../vendor/phing/phing/bin/phing
\ No newline at end of file diff --git a/bin/phpunit b/bin/phpunit new file mode 120000 index 00000000..02269f4e --- /dev/null +++ b/bin/phpunit @@ -0,0 +1 @@ +../vendor/phpunit/phpunit/composer/bin/phpunit
\ No newline at end of file diff --git a/composer.lock b/composer.lock new file mode 100644 index 00000000..0ff02aa0 --- /dev/null +++ b/composer.lock @@ -0,0 +1,782 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at http://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file" + ], + "hash": "92f9baf7b1cb6dae31ca84cd9e544fec", + "packages": [ + + ], + "packages-dev": [ + { + "name": "andrewsville/php-token-reflection", + "version": "1.3.1", + "source": { + "type": "git", + "url": "https://github.com/Andrewsville/PHP-Token-Reflection.git", + "reference": "3e3a36de17f32889fd2d4b8108af16d3033ce9bf" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/Andrewsville/PHP-Token-Reflection/zipball/3e3a36de17f32889fd2d4b8108af16d3033ce9bf", + "reference": "3e3a36de17f32889fd2d4b8108af16d3033ce9bf", + "shasum": "" + }, + "require": { + "php": ">=5.3" + }, + "type": "library", + "autoload": { + "psr-0": { + "TokenReflection": "./" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3" + ], + "authors": [ + { + "name": "Ondřej Nešpor", + "homepage": "https://github.com/Andrewsville" + }, + { + "name": "Jaroslav Hanslík", + "homepage": "https://github.com/kukulich" + } + ], + "description": "Library emulating the PHP internal reflection using just the tokenized source code.", + "homepage": "http://andrewsville.github.com/PHP-Token-Reflection/", + "keywords": [ + "library", + "reflection", + "tokenizer" + ], + "time": "2012-08-25 21:26:44" + }, + { + "name": "apigen/apigen", + "version": "2.8.0", + "source": { + "type": "git", + "url": "https://github.com/apigen/apigen", + "reference": "2.8.0" + }, + "dist": { + "type": "zip", + "url": "https://github.com/apigen/apigen/zipball/2.8.0", + "reference": "2.8.0", + "shasum": "" + }, + "require": { + "andrewsville/php-token-reflection": ">=1.3.1", + "dg/texy": ">=2.1.0", + "kukulich/fshl": ">=2.1.0", + "nette/nette": ">=2.0.5", + "php": ">=5.3.0" + }, + "suggest": { + "ext-bz2": "*", + "ext-phar": "*", + "ext-zip": "*", + "ext-zlib": "*" + }, + "bin": [ + "apigen.php" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-develop": "3.0.0-dev" + } + }, + "autoload": { + "psr-0": { + "ApiGen": "./" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "http://davidgrudl.com" + }, + { + "name": "Ondřej Nešpor", + "homepage": "https://github.com/Andrewsville" + }, + { + "name": "Jaroslav Hanslík", + "homepage": "https://github.com/kukulich" + } + ], + "description": "API documentation generator for PHP 5.3+", + "homepage": "http://apigen.org/", + "keywords": [ + "api", + "docblock", + "documentation", + "generator", + "phpDocumentor", + "phpdoc" + ], + "time": "2012-09-29 10:34:02" + }, + { + "name": "dg/texy", + "version": "v2.3", + "source": { + "type": "git", + "url": "https://github.com/dg/texy.git", + "reference": "11c34e6df7846ff1e02e6ef7c0ef4a1e3af40847" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dg/texy/zipball/11c34e6df7846ff1e02e6ef7c0ef4a1e3af40847", + "reference": "11c34e6df7846ff1e02e6ef7c0ef4a1e3af40847", + "shasum": "" + }, + "require": { + "php": ">=5.0.0" + }, + "require-dev": { + "nette/tester": "0.9.*" + }, + "type": "library", + "autoload": { + "files": [ + "src/texy.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "http://davidgrudl.com" + } + ], + "description": "Texy converts plain text in easy to read Texy syntax into structurally valid (X)HTML. It supports adding of images, links, nested lists, tables and has full support for CSS. Texy supports hyphenation of long words (which reflects language rules), clickable emails and URL (emails are obfuscated against spambots), national typographic single and double quotation marks, ellipses, em dashes, dimension sign, nonbreakable spaces (e.g. in phone numbers), acronyms, arrows and many others. Texy code can optionally contain HTML tags.", + "homepage": "http://texy.info", + "keywords": [ + "html", + "markdown", + "markup language", + "plain text", + "text", + "textile", + "texy", + "wiki", + "xhtml" + ], + "time": "2013-07-19 22:05:37" + }, + { + "name": "kukulich/fshl", + "version": "2.1.0", + "source": { + "type": "git", + "url": "https://github.com/kukulich/fshl.git", + "reference": "974c294ade5d76c0c16b6fe3fd3a584ba999b24f" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kukulich/fshl/zipball/974c294ade5d76c0c16b6fe3fd3a584ba999b24f", + "reference": "974c294ade5d76c0c16b6fe3fd3a584ba999b24f", + "shasum": "" + }, + "require": { + "php": ">=5.3" + }, + "type": "library", + "autoload": { + "psr-0": { + "FSHL": "./" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "GPL-2.0+" + ], + "authors": [ + { + "name": "Jaroslav Hanslík", + "homepage": "https://github.com/kukulich" + } + ], + "description": "FSHL is a free, open source, universal, fast syntax highlighter written in PHP.", + "homepage": "http://fshl.kukulich.cz/", + "keywords": [ + "highlight", + "library", + "syntax" + ], + "time": "2012-09-08 19:00:07" + }, + { + "name": "nette/nette", + "version": "v2.0.12", + "source": { + "type": "git", + "url": "https://github.com/nette/nette.git", + "reference": "80a7e460badc3d71b1469bb23810ebf235b06b11" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/nette/nette/zipball/80a7e460badc3d71b1469bb23810ebf235b06b11", + "reference": "80a7e460badc3d71b1469bb23810ebf235b06b11", + "shasum": "" + }, + "require": { + "ext-iconv": "*", + "ext-tokenizer": "*", + "php": ">=5.3.0" + }, + "require-dev": { + "nette/tester": "0.9.*" + }, + "suggest": { + "ext-fileinfo": "*", + "ext-gd": "*", + "ext-mbstring": "*", + "ext-memcache": "*", + "ext-pdo": "*" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.1-dev" + } + }, + "autoload": { + "files": [ + "Nette/loader.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause", + "GPL-2.0", + "GPL-3.0" + ], + "authors": [ + { + "name": "David Grudl", + "homepage": "http://davidgrudl.com" + }, + { + "name": "Nette Community", + "homepage": "http://nette.org/contributors" + } + ], + "description": "Nette Framework - innovative framework for fast and easy development of secured web applications in PHP. Write less, have cleaner code and your work will bring you joy.", + "homepage": "http://nette.org", + "keywords": [ + "Forms", + "database", + "dbal", + "debugging", + "framework", + "images", + "latte", + "mailing", + "micro", + "mvc", + "neon", + "templating" + ], + "time": "2013-08-07 23:14:19" + }, + { + "name": "phing/phing", + "version": "2.4.14", + "source": { + "type": "git", + "url": "https://github.com/phingofficial/phing.git", + "reference": "41075d93ca254f1c90c79ec7ce81be2b2629e138" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phingofficial/phing/zipball/41075d93ca254f1c90c79ec7ce81be2b2629e138", + "reference": "41075d93ca254f1c90c79ec7ce81be2b2629e138", + "shasum": "" + }, + "require": { + "php": ">=5.2.0" + }, + "bin": [ + "bin/phing" + ], + "type": "library", + "autoload": { + "classmap": [ + "classes/phing/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "classes" + ], + "license": [ + "LGPL3" + ], + "authors": [ + { + "name": "Michiel Rook", + "email": "mrook@php.net" + }, + { + "name": "Phing Community", + "homepage": "http://www.phing.info/trac/wiki/Development/Contributors" + } + ], + "description": "PHing Is Not GNU make; it's a PHP project build system or build tool based on Apache Ant.", + "homepage": "http://www.phing.info/", + "keywords": [ + "build", + "task", + "tool" + ], + "time": "2012-11-29 21:23:47" + }, + { + "name": "phpunit/php-code-coverage", + "version": "1.2.13", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-code-coverage.git", + "reference": "466e7cd2554b4e264c9e3f31216d25ac0e5f3d94" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/466e7cd2554b4e264c9e3f31216d25ac0e5f3d94", + "reference": "466e7cd2554b4e264c9e3f31216d25ac0e5f3d94", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "phpunit/php-file-iterator": ">=1.3.0@stable", + "phpunit/php-text-template": ">=1.1.1@stable", + "phpunit/php-token-stream": ">=1.1.3@stable" + }, + "require-dev": { + "phpunit/phpunit": "3.7.*@dev" + }, + "suggest": { + "ext-dom": "*", + "ext-xdebug": ">=2.0.5" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2.x-dev" + } + }, + "autoload": { + "classmap": [ + "PHP/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.", + "homepage": "https://github.com/sebastianbergmann/php-code-coverage", + "keywords": [ + "coverage", + "testing", + "xunit" + ], + "time": "2013-09-10 08:14:32" + }, + { + "name": "phpunit/php-file-iterator", + "version": "1.3.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-file-iterator.git", + "reference": "16a78140ed2fc01b945cfa539665fadc6a038029" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/16a78140ed2fc01b945cfa539665fadc6a038029", + "reference": "16a78140ed2fc01b945cfa539665fadc6a038029", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "File/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "FilterIterator implementation that filters files based on a list of suffixes.", + "homepage": "http://www.phpunit.de/", + "keywords": [ + "filesystem", + "iterator" + ], + "time": "2012-10-11 11:44:38" + }, + { + "name": "phpunit/php-text-template", + "version": "1.1.4", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-text-template.git", + "reference": "5180896f51c5b3648ac946b05f9ec02be78a0b23" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/5180896f51c5b3648ac946b05f9ec02be78a0b23", + "reference": "5180896f51c5b3648ac946b05f9ec02be78a0b23", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "Text/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Simple template engine.", + "homepage": "https://github.com/sebastianbergmann/php-text-template/", + "keywords": [ + "template" + ], + "time": "2012-10-31 18:15:28" + }, + { + "name": "phpunit/php-timer", + "version": "1.0.5", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-timer.git", + "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/19689d4354b295ee3d8c54b4f42c3efb69cbc17c", + "reference": "19689d4354b295ee3d8c54b4f42c3efb69cbc17c", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "PHP/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Utility class for timing", + "homepage": "https://github.com/sebastianbergmann/php-timer/", + "keywords": [ + "timer" + ], + "time": "2013-08-02 07:42:54" + }, + { + "name": "phpunit/php-token-stream", + "version": "1.2.0", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/php-token-stream.git", + "reference": "31babf400e5b5868573bf49a000a3519d3978233" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/php-token-stream/zipball/31babf400e5b5868573bf49a000a3519d3978233", + "reference": "31babf400e5b5868573bf49a000a3519d3978233", + "shasum": "" + }, + "require": { + "ext-tokenizer": "*", + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.2-dev" + } + }, + "autoload": { + "classmap": [ + "PHP/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Wrapper around PHP's tokenizer extension.", + "homepage": "https://github.com/sebastianbergmann/php-token-stream/", + "keywords": [ + "tokenizer" + ], + "time": "2013-08-04 05:57:48" + }, + { + "name": "phpunit/phpunit", + "version": "3.7.25", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit.git", + "reference": "162da5b9efbf2d483d4ee93dc54b7266d30beae2" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/162da5b9efbf2d483d4ee93dc54b7266d30beae2", + "reference": "162da5b9efbf2d483d4ee93dc54b7266d30beae2", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "ext-pcre": "*", + "ext-reflection": "*", + "ext-spl": "*", + "php": ">=5.3.3", + "phpunit/php-code-coverage": "~1.2.1", + "phpunit/php-file-iterator": ">=1.3.1", + "phpunit/php-text-template": ">=1.1.1", + "phpunit/php-timer": ">=1.0.4", + "phpunit/phpunit-mock-objects": "~1.2.0", + "symfony/yaml": "~2.0" + }, + "require-dev": { + "pear-pear/pear": "1.9.4" + }, + "suggest": { + "ext-json": "*", + "ext-simplexml": "*", + "ext-tokenizer": "*", + "phpunit/php-invoker": ">=1.1.0,<1.2.0" + }, + "bin": [ + "composer/bin/phpunit" + ], + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.7.x-dev" + } + }, + "autoload": { + "classmap": [ + "PHPUnit/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "", + "../../symfony/yaml/" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de", + "role": "lead" + } + ], + "description": "The PHP Unit Testing framework.", + "homepage": "http://www.phpunit.de/", + "keywords": [ + "phpunit", + "testing", + "xunit" + ], + "time": "2013-09-10 08:23:58" + }, + { + "name": "phpunit/phpunit-mock-objects", + "version": "1.2.3", + "source": { + "type": "git", + "url": "https://github.com/sebastianbergmann/phpunit-mock-objects.git", + "reference": "5794e3c5c5ba0fb037b11d8151add2a07fa82875" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/sebastianbergmann/phpunit-mock-objects/zipball/5794e3c5c5ba0fb037b11d8151add2a07fa82875", + "reference": "5794e3c5c5ba0fb037b11d8151add2a07fa82875", + "shasum": "" + }, + "require": { + "php": ">=5.3.3", + "phpunit/php-text-template": ">=1.1.1@stable" + }, + "suggest": { + "ext-soap": "*" + }, + "type": "library", + "autoload": { + "classmap": [ + "PHPUnit/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "include-path": [ + "" + ], + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Sebastian Bergmann", + "email": "sb@sebastian-bergmann.de", + "role": "lead" + } + ], + "description": "Mock Object library for PHPUnit", + "homepage": "https://github.com/sebastianbergmann/phpunit-mock-objects/", + "keywords": [ + "mock", + "xunit" + ], + "time": "2013-01-13 10:24:48" + }, + { + "name": "symfony/yaml", + "version": "v2.3.4", + "target-dir": "Symfony/Component/Yaml", + "source": { + "type": "git", + "url": "https://github.com/symfony/Yaml.git", + "reference": "5a279f1b5f5e1045a6c432354d9ea727ff3a9847" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/Yaml/zipball/5a279f1b5f5e1045a6c432354d9ea727ff3a9847", + "reference": "5a279f1b5f5e1045a6c432354d9ea727ff3a9847", + "shasum": "" + }, + "require": { + "php": ">=5.3.3" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "2.3-dev" + } + }, + "autoload": { + "psr-0": { + "Symfony\\Component\\Yaml\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + }, + { + "name": "Symfony Community", + "homepage": "http://symfony.com/contributors" + } + ], + "description": "Symfony Yaml Component", + "homepage": "http://symfony.com", + "time": "2013-08-24 15:26:22" + } + ], + "aliases": [ + + ], + "minimum-stability": "stable", + "stability-flags": [ + + ], + "platform": { + "php": ">=5.3.3", + "ext-ctype": "*", + "ext-dom": "*", + "ext-json": "*", + "ext-pcre": "*", + "ext-spl": "*" + }, + "platform-dev": [ + + ] +} diff --git a/framework/pradolite.php b/framework/pradolite.php index 1e117149..2b75df89 100644 --- a/framework/pradolite.php +++ b/framework/pradolite.php @@ -1,7 +1,7 @@ <?php /** * File Name: pradolite.php - * Last Update: 2012/11/26 11:38:32 + * Last Update: 2013/09/11 16:01:18 * Generated By: buildscripts/phpbuilder/build.php * * This file is used in lieu of prado.php to boost PRADO application performance. @@ -25,7 +25,7 @@ class PradoBase protected static $classExists = array(); public static function getVersion() { - return '3.2.0'; + return '3.2.2'; } public static function initErrorHandlers() { @@ -34,9 +34,10 @@ class PradoBase } public static function autoload($className) { - include_once($className.self::CLASS_FILE_EXT); - if(!class_exists($className,false) && !interface_exists($className,false)) - self::fatalError("Class file for '$className' cannot be found."); + if ((@include($className.self::CLASS_FILE_EXT)) !== false) { + return true; + } + return false; } public static function poweredByPrado($logoType=0) { @@ -1248,377 +1249,6 @@ class TTextWriter extends TComponent implements ITextWriter $this->write($str."\n"); } } -class TPriorityList extends TList -{ - private $_d=array(); - private $_o=false; - private $_fd=null; - private $_c=0; - private $_dp=10; - private $_p=8; - public function __construct($data=null,$readOnly=false,$defaultPriority=10,$precision=8) - { - parent::__construct(); - if($data!==null) - $this->copyFrom($data); - $this->setReadOnly($readOnly); - $this->setPrecision($precision); - $this->setDefaultPriority($defaultPriority); - } - public function count() - { - return $this->getCount(); - } - public function getCount() - { - return $this->_c; - } - public function getPriorityCount($priority=null) - { - if($priority===null) - $priority=$this->getDefaultPriority(); - $priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p); - if(!isset($this->_d[$priority]) || !is_array($this->_d[$priority])) - return false; - return count($this->_d[$priority]); - } - public function getDefaultPriority() - { - return $this->_dp; - } - protected function setDefaultPriority($value) - { - $this->_dp=(string)round(TPropertyValue::ensureFloat($value),$this->_p); - } - public function getPrecision() - { - return $this->_p; - } - protected function setPrecision($value) - { - $this->_p=TPropertyValue::ensureInteger($value); - } - public function getIterator() - { - return new ArrayIterator($this->flattenPriorities()); - } - public function getPriorities() - { - $this->sortPriorities(); - return array_keys($this->_d); - } - protected function sortPriorities() { - if(!$this->_o) { - ksort($this->_d,SORT_NUMERIC); - $this->_o=true; - } - } - protected function flattenPriorities() { - if(is_array($this->_fd)) - return $this->_fd; - $this->sortPriorities(); - $this->_fd=array(); - foreach($this->_d as $priority => $itemsatpriority) - $this->_fd=array_merge($this->_fd,$itemsatpriority); - return $this->_fd; - } - public function itemAt($index) - { - if($index>=0&&$index<$this->getCount()) { - $arr=$this->flattenPriorities(); - return $arr[$index]; - } else - throw new TInvalidDataValueException('list_index_invalid',$index); - } - public function itemsAtPriority($priority=null) - { - if($priority===null) - $priority=$this->getDefaultPriority(); - $priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p); - return isset($this->_d[$priority])?$this->_d[$priority]:null; - } - public function itemAtIndexInPriority($index,$priority=null) - { - if($priority===null) - $priority=$this->getDefaultPriority(); - $priority=(string)round(TPropertyValue::ensureFloat($priority), $this->_p); - return !isset($this->_d[$priority])?false:( - isset($this->_d[$priority][$index])?$this->_d[$priority][$index]:false - ); - } - public function add($item,$priority=null) - { - if($this->getReadOnly()) - throw new TInvalidOperationException('list_readonly',get_class($this)); - return $this->insertAtIndexInPriority($item,false,$priority,true); - } - public function insertAt($index,$item) - { - if($this->getReadOnly()) - throw new TInvalidOperationException('list_readonly',get_class($this)); - if(($priority=$this->priorityAt($index,true))!==false) - $this->insertAtIndexInPriority($item,$priority[1],$priority[0]); - else - throw new TInvalidDataValueException('list_index_invalid',$index); - } - public function insertAtIndexInPriority($item,$index=false,$priority=null,$preserveCache=false) - { - if($this->getReadOnly()) - throw new TInvalidOperationException('list_readonly',get_class($this)); - if($priority===null) - $priority=$this->getDefaultPriority(); - $priority=(string)round(TPropertyValue::ensureFloat($priority), $this->_p); - if($preserveCache) { - $this->sortPriorities(); - $cc=0; - foreach($this->_d as $prioritykey=>$items) - if($prioritykey>=$priority) - break; - else - $cc+=count($items); - if($index===false&&isset($this->_d[$priority])) { - $c=count($this->_d[$priority]); - $c+=$cc; - $this->_d[$priority][]=$item; - } else if(isset($this->_d[$priority])) { - $c=$index+$cc; - array_splice($this->_d[$priority],$index,0,array($item)); - } else { - $c = $cc; - $this->_o = false; - $this->_d[$priority]=array($item); - } - if($this->_fd&&is_array($this->_fd)) array_splice($this->_fd,$c,0,array($item)); - } else { - $c=null; - if($index===false&&isset($this->_d[$priority])) { - $cc=count($this->_d[$priority]); - $this->_d[$priority][]=$item; - } else if(isset($this->_d[$priority])) { - $cc=$index; - array_splice($this->_d[$priority],$index,0,array($item)); - } else { - $cc=0; - $this->_o=false; - $this->_d[$priority]=array($item); - } - if($this->_fd&&is_array($this->_fd)&&count($this->_d)==1) - array_splice($this->_fd,$cc,0,array($item)); - else - $this->_fd=null; - } - $this->_c++; - return $c; - } - public function remove($item,$priority=false) - { - if($this->getReadOnly()) - throw new TInvalidOperationException('list_readonly',get_class($this)); - if(($p=$this->priorityOf($item,true))!==false) - { - if($priority!==false) { - if($priority===null) - $priority=$this->getDefaultPriority(); - $priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p); - if($p[0]!=$priority) - throw new TInvalidDataValueException('list_item_inexistent'); - } - $this->removeAtIndexInPriority($p[1],$p[0]); - return $p[2]; - } - else - throw new TInvalidDataValueException('list_item_inexistent'); - } - public function removeAt($index) - { - if($this->getReadOnly()) - throw new TInvalidOperationException('list_readonly',get_class($this)); - if(($priority=$this->priorityAt($index, true))!==false) - return $this->removeAtIndexInPriority($priority[1],$priority[0]); - throw new TInvalidDataValueException('list_index_invalid',$index); - } - public function removeAtIndexInPriority($index, $priority=null) - { - if($this->getReadOnly()) - throw new TInvalidOperationException('list_readonly',get_class($this)); - if($priority===null) - $priority=$this->getDefaultPriority(); - $priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p); - if(!isset($this->_d[$priority])||$index<0||$index>=count($this->_d[$priority])) - throw new TInvalidDataValueException('list_item_inexistent'); - $value=array_splice($this->_d[$priority],$index,1); - $value=$value[0]; - if(!count($this->_d[$priority])) - unset($this->_d[$priority]); - $this->_c--; - $this->_fd=null; - return $value; - } - public function clear() - { - if($this->getReadOnly()) - throw new TInvalidOperationException('list_readonly',get_class($this)); - $d=array_reverse($this->_d,true); - foreach($this->_d as $priority=>$items) { - for($index=count($items)-1;$index>=0;$index--) - $this->removeAtIndexInPriority($index,$priority); - unset($this->_d[$priority]); - } - } - public function contains($item) - { - return $this->indexOf($item)>=0; - } - public function indexOf($item) - { - if(($index=array_search($item,$this->flattenPriorities(),true))===false) - return -1; - else - return $index; - } - public function priorityOf($item,$withindex = false) - { - $this->sortPriorities(); - $absindex = 0; - foreach($this->_d as $priority=>$items) { - if(($index=array_search($item,$items,true))!==false) { - $absindex+=$index; - return $withindex?array($priority,$index,$absindex, - 'priority'=>$priority,'index'=>$index,'absindex'=>$absindex):$priority; - } else - $absindex+=count($items); - } - return false; - } - public function priorityAt($index,$withindex = false) - { - if($index<0||$index>=$this->getCount()) - throw new TInvalidDataValueException('list_index_invalid',$index); - $absindex=$index; - $this->sortPriorities(); - foreach($this->_d as $priority=>$items) { - if($index>=($c=count($items))) - $index-=$c; - else - return $withindex?array($priority,$index,$absindex, - 'priority'=>$priority,'index'=>$index,'absindex'=>$absindex):$priority; - } - return false; - } - public function insertBefore($indexitem, $item) - { - if($this->getReadOnly()) - throw new TInvalidOperationException('list_readonly',get_class($this)); - if(($priority=$this->priorityOf($indexitem,true))===false) - throw new TInvalidDataValueException('list_item_inexistent'); - $this->insertAtIndexInPriority($item,$priority[1],$priority[0]); - return $priority[2]; - } - public function insertAfter($indexitem, $item) - { - if($this->getReadOnly()) - throw new TInvalidOperationException('list_readonly',get_class($this)); - if(($priority=$this->priorityOf($indexitem,true))===false) - throw new TInvalidDataValueException('list_item_inexistent'); - $this->insertAtIndexInPriority($item,$priority[1]+1,$priority[0]); - return $priority[2]+1; - } - public function toArray() - { - return $this->flattenPriorities(); - } - public function toPriorityArray() - { - $this->sortPriorities(); - return $this->_d; - } - public function toArrayBelowPriority($priority,$inclusive=false) - { - $this->sortPriorities(); - $items=array(); - foreach($this->_d as $itemspriority=>$itemsatpriority) - { - if((!$inclusive&&$itemspriority>=$priority)||$itemspriority>$priority) - break; - $items=array_merge($items,$itemsatpriority); - } - return $items; - } - public function toArrayAbovePriority($priority,$inclusive=true) - { - $this->sortPriorities(); - $items=array(); - foreach($this->_d as $itemspriority=>$itemsatpriority) - { - if((!$inclusive&&$itemspriority<=$priority)||$itemspriority<$priority) - continue; - $items=array_merge($items,$itemsatpriority); - } - return $items; - } - public function copyFrom($data) - { - if($data instanceof TPriorityList) - { - if($this->getCount()>0) - $this->clear(); - foreach($data->getPriorities() as $priority) - { - foreach($data->itemsAtPriority($priority) as $index=>$item) - $this->insertAtIndexInPriority($item,$index,$priority); - } - } else if(is_array($data)||$data instanceof Traversable) { - if($this->getCount()>0) - $this->clear(); - foreach($data as $key=>$item) - $this->add($item); - } else if($data!==null) - throw new TInvalidDataTypeException('map_data_not_iterable'); - } - public function mergeWith($data) - { - if($data instanceof TPriorityList) - { - foreach($data->getPriorities() as $priority) - { - foreach($data->itemsAtPriority($priority) as $index=>$item) - $this->insertAtIndexInPriority($item,false,$priority); - } - } - else if(is_array($data)||$data instanceof Traversable) - { - foreach($data as $priority=>$item) - $this->add($item); - } - else if($data!==null) - throw new TInvalidDataTypeException('map_data_not_iterable'); - } - public function offsetExists($offset) - { - return ($offset>=0&&$offset<$this->getCount()); - } - public function offsetGet($offset) - { - return $this->itemAt($offset); - } - public function offsetSet($offset,$item) - { - if($offset===null) - return $this->add($item); - if($offset===$this->getCount()) { - $priority=$this->priorityAt($offset-1,true); - $priority[1]++; - } else { - $priority=$this->priorityAt($offset,true); - $this->removeAtIndexInPriority($priority[1],$priority[0]); - } - $this->insertAtIndexInPriority($item,$priority[1],$priority[0]); - } - public function offsetUnset($offset) - { - $this->removeAt($offset); - } -} class TMap extends TComponent implements IteratorAggregate,ArrayAccess,Countable { private $_d=array(); @@ -1763,310 +1393,6 @@ class TMapIterator implements Iterator return $this->_key!==false; } } -class TPriorityMap extends TMap -{ - private $_d=array(); - private $_r=false; - private $_o=false; - private $_fd=null; - private $_c=0; - private $_dp=10; - private $_p=8; - public function __construct($data=null,$readOnly=false,$defaultPriority=10,$precision=8) - { - if($data!==null) - $this->copyFrom($data); - $this->setReadOnly($readOnly); - $this->setPrecision($precision); - $this->setDefaultPriority($defaultPriority); - } - public function getReadOnly() - { - return $this->_r; - } - protected function setReadOnly($value) - { - $this->_r=TPropertyValue::ensureBoolean($value); - } - public function getDefaultPriority() - { - return $this->_dp; - } - protected function setDefaultPriority($value) - { - $this->_dp = (string)round(TPropertyValue::ensureFloat($value), $this->_p); - } - public function getPrecision() - { - return $this->_p; - } - protected function setPrecision($value) - { - $this->_p=TPropertyValue::ensureInteger($value); - } - public function getIterator() - { - return new ArrayIterator($this->flattenPriorities()); - } - protected function sortPriorities() { - if(!$this->_o) { - ksort($this->_d, SORT_NUMERIC); - $this->_o=true; - } - } - protected function flattenPriorities() { - if(is_array($this->_fd)) - return $this->_fd; - $this->sortPriorities(); - $this->_fd = array(); - foreach($this->_d as $priority => $itemsatpriority) - $this->_fd = array_merge($this->_fd, $itemsatpriority); - return $this->_fd; - } - public function count() - { - return $this->getCount(); - } - public function getCount() - { - return $this->_c; - } - public function getPriorityCount($priority=null) - { - if($priority===null) - $priority=$this->getDefaultPriority(); - $priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p); - if(!isset($this->_d[$priority])||!is_array($this->_d[$priority])) - return false; - return count($this->_d[$priority]); - } - public function getPriorities() - { - $this->sortPriorities(); - return array_keys($this->_d); - } - public function getKeys() - { - return array_keys($this->flattenPriorities()); - } - public function itemAt($key,$priority=false) - { - if($priority===false){ - $map=$this->flattenPriorities(); - return isset($map[$key])?$map[$key]:null; - } else { - if($priority===null) - $priority=$this->getDefaultPriority(); - $priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p); - return (isset($this->_d[$priority])&&isset($this->_d[$priority][$key]))?$this->_d[$priority][$key]:null; - } - } - public function setPriorityAt($key,$priority=null) - { - if($priority===null) - $priority=$this->getDefaultPriority(); - $priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p); - $oldpriority=$this->priorityAt($key); - if($oldpriority!==false&&$oldpriority!=$priority) { - $value=$this->remove($key,$oldpriority); - $this->add($key,$value,$priority); - } - return $oldpriority; - } - public function itemsAtPriority($priority=null) - { - if($priority===null) - $priority=$this->getDefaultPriority(); - $priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p); - return isset($this->_d[$priority])?$this->_d[$priority]:null; - } - public function priorityOf($item) - { - $this->sortPriorities(); - foreach($this->_d as $priority=>$items) - if(($index=array_search($item,$items,true))!==false) - return $priority; - return false; - } - public function priorityAt($key) - { - $this->sortPriorities(); - foreach($this->_d as $priority=>$items) - if(array_key_exists($key,$items)) - return $priority; - return false; - } - public function add($key,$value,$priority=null) - { - if($priority===null) - $priority=$this->getDefaultPriority(); - $priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p); - if(!$this->_r) - { - foreach($this->_d as $innerpriority=>$items) - if(array_key_exists($key,$items)) - { - unset($this->_d[$innerpriority][$key]); - $this->_c--; - if(count($this->_d[$innerpriority])===0) - unset($this->_d[$innerpriority]); - } - if(!isset($this->_d[$priority])) { - $this->_d[$priority]=array($key=>$value); - $this->_o=false; - } - else - $this->_d[$priority][$key]=$value; - $this->_c++; - $this->_fd=null; - } - else - throw new TInvalidOperationException('map_readonly',get_class($this)); - return $priority; - } - public function remove($key,$priority=false) - { - if(!$this->_r) - { - if($priority===null) - $priority=$this->getDefaultPriority(); - if($priority===false) - { - $this->sortPriorities(); - foreach($this->_d as $priority=>$items) - if(array_key_exists($key,$items)) - { - $value=$this->_d[$priority][$key]; - unset($this->_d[$priority][$key]); - $this->_c--; - if(count($this->_d[$priority])===0) - { - unset($this->_d[$priority]); - $this->_o=false; - } - $this->_fd=null; - return $value; - } - return null; - } - else - { - $priority=(string)round(TPropertyValue::ensureFloat($priority),$this->_p); - if(isset($this->_d[$priority])&&(isset($this->_d[$priority][$key])||array_key_exists($key,$this->_d[$priority]))) - { - $value=$this->_d[$priority][$key]; - unset($this->_d[$priority][$key]); - $this->_c--; - if(count($this->_d[$priority])===0) { - unset($this->_d[$priority]); - $this->_o=false; - } - $this->_fd=null; - return $value; - } - else - return null; - } - } - else - throw new TInvalidOperationException('map_readonly',get_class($this)); - } - public function clear() - { - foreach($this->_d as $priority=>$items) - foreach(array_keys($items) as $key) - $this->remove($key); - } - public function contains($key) - { - $map=$this->flattenPriorities(); - return isset($map[$key])||array_key_exists($key,$map); - } - public function toArray() - { - return $this->flattenPriorities(); - } - public function toArrayBelowPriority($priority,$inclusive=false) - { - $this->sortPriorities(); - $items=array(); - foreach($this->_d as $itemspriority=>$itemsatpriority) - { - if((!$inclusive&&$itemspriority>=$priority)||$itemspriority>$priority) - break; - $items=array_merge($items,$itemsatpriority); - } - return $items; - } - public function toArrayAbovePriority($priority,$inclusive=true) - { - $this->sortPriorities(); - $items=array(); - foreach($this->_d as $itemspriority=>$itemsatpriority) - { - if((!$inclusive&&$itemspriority<=$priority)||$itemspriority<$priority) - continue; - $items=array_merge($items,$itemsatpriority); - } - return $items; - } - public function copyFrom($data) - { - if($data instanceof TPriorityMap) - { - if($this->getCount()>0) - $this->clear(); - foreach($data->getPriorities() as $priority) { - foreach($data->itemsAtPriority($priority) as $key => $value) { - $this->add($key,$value,$priority); - } - } - } - else if(is_array($data)||$data instanceof Traversable) - { - if($this->getCount()>0) - $this->clear(); - foreach($data as $key=>$value) - $this->add($key,$value); - } - else if($data!==null) - throw new TInvalidDataTypeException('map_data_not_iterable'); - } - public function mergeWith($data) - { - if($data instanceof TPriorityMap) - { - foreach($data->getPriorities() as $priority) - { - foreach($data->itemsAtPriority($priority) as $key => $value) - $this->add($key,$value,$priority); - } - } - else if(is_array($data)||$data instanceof Traversable) - { - foreach($data as $key=>$value) - $this->add($key,$value); - } - else if($data!==null) - throw new TInvalidDataTypeException('map_data_not_iterable'); - } - public function offsetExists($offset) - { - return $this->contains($offset); - } - public function offsetGet($offset) - { - return $this->itemAt($offset); - } - public function offsetSet($offset,$item) - { - $this->add($offset,$item); - } - public function offsetUnset($offset) - { - $this->remove($offset); - } -} class TStack extends TComponent implements IteratorAggregate,Countable { private $_d=array(); @@ -2899,13 +2225,13 @@ class TJavaScript ($g=Prado::getApplication()->getGlobalization(false))!==null && strtoupper($enc=$g->getCharset())!='UTF-8') $value=iconv($enc, 'UTF-8', $value); - $s = json_encode($value,$options); + $s = @json_encode($value,$options); self::checkJsonError(); return $s; } public static function jsonDecode($value, $assoc = false, $depth = 512) { - $s= json_decode($value, $assoc, $depth); + $s= @json_decode($value, $assoc, $depth); self::checkJsonError(); return $s; } @@ -2980,16 +2306,23 @@ class TUrlManager extends TModule } } } - if($request->getUrlFormat()===THttpRequestUrlFormat::Path) - return $request->getApplicationUrl().'/'.strtr($url,array($amp=>'/','?'=>'/','='=>$request->getUrlParamSeparator())); - else - return $request->getApplicationUrl().'?'.$url; + switch($request->getUrlFormat()) + { + case THttpRequestUrlFormat::Path: + return $request->getApplicationUrl().'/'.strtr($url,array($amp=>'/','?'=>'/','='=>$request->getUrlParamSeparator())); + case THttpRequestUrlFormat::HiddenPath: + return rtrim(dirname($request->getApplicationUrl()), '/').'/'.strtr($url,array($amp=>'/','?'=>'/','='=>$request->getUrlParamSeparator())); + default: + return $request->getApplicationUrl().'?'.$url; + } } public function parseUrl() { $request=$this->getRequest(); $pathInfo=trim($request->getPathInfo(),'/'); - if($request->getUrlFormat()===THttpRequestUrlFormat::Path && $pathInfo!=='') + if(($request->getUrlFormat()===THttpRequestUrlFormat::Path || + $request->getUrlFormat()===THttpRequestUrlFormat::HiddenPath) && + $pathInfo!=='') { $separator=$request->getUrlParamSeparator(); $paths=explode('/',$pathInfo); @@ -3035,6 +2368,7 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar private $_requestResolved=false; private $_enableCookieValidation=false; private $_cgiFix=0; + private $_enableCache=false; private $_url=null; private $_id; private $_items=array(); @@ -3048,19 +2382,6 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar } public function init($config) { - if(empty($this->_urlManagerID)) - { - $this->_urlManager=new TUrlManager; - $this->_urlManager->init(null); - } - else - { - $this->_urlManager=$this->getApplication()->getModule($this->_urlManagerID); - if($this->_urlManager===null) - throw new TConfigurationException('httprequest_urlmanager_inexist',$this->_urlManagerID); - if(!($this->_urlManager instanceof TUrlManager)) - throw new TConfigurationException('httprequest_urlmanager_invalid',$this->_urlManagerID); - } if(php_sapi_name()==='cli') { $_SERVER['REMOTE_ADDR']='127.0.0.1'; @@ -3117,6 +2438,51 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar } return $this->_url; } + public function setEnableCache($value) + { + $this->_enableCache = TPropertyValue::ensureBoolean($value); + } + public function getEnableCache() + { + return $this->_enableCache; + } + protected function getCacheKey() + { + return $this->getID(); + } + protected function cacheUrlManager($manager) + { + if($this->getEnableCache()) + { + $cache = $this->getApplication()->getCache(); + if($cache !== null) + { + $dependencies = null; + if($this->getApplication()->getMode() !== TApplicationMode::Performance) + if ($manager instanceof TUrlMapping && $fn = $manager->getConfigFile()) + { + $fn = Prado::getPathOfNamespace($fn,$this->getApplication()->getConfigurationFileExt()); + $dependencies = new TFileCacheDependency($fn); + } + return $cache->set($this->getCacheKey(), $manager, 0, $dependencies); + } + } + return false; + } + protected function loadCachedUrlManager() + { + if($this->getEnableCache()) + { + $cache = $this->getApplication()->getCache(); + if($cache !== null) + { + $manager = $cache->get($this->getCacheKey()); + if($manager instanceof TUrlManager) + return $manager; + } + } + return null; + } public function getUrlManager() { return $this->_urlManagerID; @@ -3127,6 +2493,26 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar } public function getUrlManagerModule() { + if($this->_urlManager===null) + { + if(($this->_urlManager = $this->loadCachedUrlManager())===null) + { + if(empty($this->_urlManagerID)) + { + $this->_urlManager=new TUrlManager; + $this->_urlManager->init(null); + } + else + { + $this->_urlManager=$this->getApplication()->getModule($this->_urlManagerID); + if($this->_urlManager===null) + throw new TConfigurationException('httprequest_urlmanager_inexist',$this->_urlManagerID); + if(!($this->_urlManager instanceof TUrlManager)) + throw new TConfigurationException('httprequest_urlmanager_invalid',$this->_urlManagerID); + } + $this->cacheUrlManager($this->_urlManager); + } + } return $this->_urlManager; } public function getUrlFormat() @@ -3317,7 +2703,7 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar { if ($this->_cookieOnly===null) $this->_cookieOnly=(int)ini_get('session.use_cookies') && (int)ini_get('session.use_only_cookies'); - $url=$this->_urlManager->constructUrl($serviceID,$serviceParam,$getItems,$encodeAmpersand,$encodeGetItems); + $url=$this->getUrlManagerModule()->constructUrl($serviceID,$serviceParam,$getItems,$encodeAmpersand,$encodeGetItems); if(defined('SID') && SID != '' && !$this->_cookieOnly) return $url . (strpos($url,'?')===false? '?' : ($encodeAmpersand?'&':'&')) . SID; else @@ -3325,7 +2711,7 @@ class THttpRequest extends TApplicationComponent implements IteratorAggregate,Ar } protected function parseUrl() { - return $this->_urlManager->parseUrl(); + return $this->getUrlManagerModule()->parseUrl(); } public function resolveRequest($serviceIDs) { @@ -3622,6 +3008,7 @@ class THttpRequestUrlFormat extends TEnumerable { const Get='Get'; const Path='Path'; + const HiddenPath='HiddenPath'; } class THttpResponseAdapter extends TApplicationComponent { @@ -7049,7 +6436,14 @@ class TClientScriptManager extends TApplicationComponent } public function getStyleSheetUrls() { - $stylesheets = array_values(array_merge($this->_styleSheetFiles, $this->_styleSheets)); + $stylesheets = array_values( + array_merge( + array_map( + create_function('$e', 'return is_array($e) ? $e[0] : $e;'), + $this->_styleSheetFiles), + $this->_styleSheets + ) + ); foreach(Prado::getApplication()->getAssetManager()->getPublished() as $path=>$url) if (substr($url,strlen($url)-4)=='.css') $stylesheets[] = $url; @@ -7250,10 +6644,6 @@ class TClientScriptManager extends TApplicationComponent abstract class TClientSideOptions extends TComponent { private $_options; - public function __construct() - { - $this->_options = Prado::createComponent('System.Collections.TMap'); - } protected function setFunction($name, $code) { if(!TJavaScript::isJsLiteral($code)) @@ -7262,14 +6652,19 @@ abstract class TClientSideOptions extends TComponent } protected function getOption($name) { - return $this->_options->itemAt($name); + if ($this->_options) + return $this->_options->itemAt($name); + else + return null; } protected function setOption($name, $value) { - $this->_options->add($name, $value); + $this->getOptions()->add($name, $value); } public function getOptions() { + if (!$this->_options) + $this->_options = Prado::createComponent('System.Collections.TMap'); return $this->_options; } protected function ensureFunction($javascript) @@ -8632,7 +8027,7 @@ class TTemplate extends TApplicationComponent implements ITemplate else if($str[2]==='~') $tpl[$c++]=array($container,array(TCompositeLiteral::TYPE_EXPRESSION,"\$this->publishFilePath('$this->_contextPath/$literal')")); else if($str[2]==='/') - $tpl[$c++]=array($container,array(TCompositeLiteral::TYPE_EXPRESSION,"dirname(\$this->getApplication()->getRequest()->getApplicationUrl()).'/$literal'")); + $tpl[$c++]=array($container,array(TCompositeLiteral::TYPE_EXPRESSION,"rtrim(dirname(\$this->getApplication()->getRequest()->getApplicationUrl()), '/').'/$literal'")); else if($str[2]==='[') { $literal=strtr(trim(substr($literal,0,strlen($literal)-1)),array("'"=>"\'","\\"=>"\\\\")); @@ -8849,7 +8244,7 @@ class TTemplate extends TApplicationComponent implements ITemplate return array(self::CONFIG_PARAMETER,trim(substr($value,3,strlen($value)-5))); elseif($value[2]==='/') { $literal = trim(substr($value,3,strlen($value)-5)); - return array(self::CONFIG_EXPRESSION,"dirname(\$this->getApplication()->getRequest()->getApplicationUrl()).'/$literal'"); + return array(self::CONFIG_EXPRESSION,"rtrim(dirname(\$this->getApplication()->getRequest()->getApplicationUrl()), '/').'/$literal'"); } } else @@ -10133,6 +9528,7 @@ class TApplication extends TComponent private $_services; private $_service; private $_modules=array(); + private $_lazyModules=array(); private $_parameters; private $_configFile; private $_configFileExt; @@ -10365,7 +9761,7 @@ class TApplication extends TComponent { $this->_service=$value; } - public function setModule($id,IModule $module) + public function setModule($id,IModule $module=null) { if(isset($this->_modules[$id])) throw new TConfigurationException('application_moduleid_duplicated',$id); @@ -10374,7 +9770,14 @@ class TApplication extends TComponent } public function getModule($id) { - return isset($this->_modules[$id])?$this->_modules[$id]:null; + if(!array_key_exists($id, $this->_modules)) + return null; + if($this->_modules[$id]===null) + { + $module = $this->internalLoadModule($id, true); + $module[0]->init($module[1]); + } + return $this->_modules[$id]; } public function getModules() { @@ -10514,6 +9917,24 @@ class TApplication extends TComponent { return 'TApplicationConfiguration'; } + protected function internalLoadModule($id, $force=false) + { + list($moduleClass, $initProperties, $configElement)=$this->_lazyModules[$id]; + if(isset($initProperties['lazy']) && $initProperties['lazy'] && !$force) + { + $this->setModule($id, null); + return null; + } + $module=Prado::createComponent($moduleClass); + foreach($initProperties as $name=>$value) + { + if($name==='lazy') continue; + $module->setSubProperty($name,$value); + } + $this->setModule($id,$module); + $this->_lazyModules[$id]=null; + return array($module,$configElement); + } public function applyConfiguration($config,$withinService=false) { if($config->getIsEmpty()) @@ -10544,17 +9965,11 @@ class TApplication extends TComponent $modules=array(); foreach($config->getModules() as $id=>$moduleConfig) { - list($moduleClass, $initProperties, $configElement)=$moduleConfig; - $module=Prado::createComponent($moduleClass); if(!is_string($id)) - { - $id='_module'.count($this->_modules); - $initProperties['id']=$id; - } - $this->setModule($id,$module); - foreach($initProperties as $name=>$value) - $module->setSubProperty($name,$value); - $modules[]=array($module,$configElement); + $id='_module'.count($this->_lazyModules); + $this->_lazyModules[$id]=$moduleConfig; + if($module = $this->internalLoadModule($id)) + $modules[]=$module; } foreach($modules as $module) $module[0]->init($module[1]); |