diff --git a/application/controller/indexController.php b/application/controller/indexController.php index 54c12f7..05ad232 100644 --- a/application/controller/indexController.php +++ b/application/controller/indexController.php @@ -1,6 +1,5 @@ - - - - - - - - - - - {$title} - - {foreach item=style from=$css} - - {/foreach} - - - - +{include 'shared/header.tpl'}
@@ -34,10 +7,9 @@
-
Dashboards
-

Order history

+
Rapid Prototyping Framework
+

Nibiru

-
@@ -45,223 +17,6 @@
- -
-
-
- - -
-
-
-
- - -
-
-
- -
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
OrderCustomer nameDescriptionDateTotal
#10001First LastAdmin theme, marketing theme01/01/2015$200.00
#10002Firstname LastnameAdmin theme01/01/2015$100.00
#10003Name AnotherPersonal blog theme01/01/2015$100.00
#10004One MoreMarketing theme, personal blog theme, admin theme01/01/2015$300.00
#10005Name Right HerePersonal blog theme, admin theme01/02/2015$200.00
#10006First LastAdmin theme, marketing theme01/01/2015$200.00
#10007Firstname LastnameAdmin theme01/01/2015$100.00
#10008Name AnotherPersonal blog theme01/01/2015$100.00
#10009One MoreMarketing theme, personal blog theme, admin theme01/01/2015$300.00
#10010Name Right HerePersonal blog theme, admin theme01/02/2015$200.00
#10011First LastAdmin theme, marketing theme01/01/2015$200.00
#10012Firstname LastnameAdmin theme01/01/2015$100.00
#10013Name AnotherPersonal blog theme01/01/2015$100.00
#10014One MoreMarketing theme, personal blog theme, admin theme01/01/2015$300.00
#10015Name Right HerePersonal blog theme, admin theme01/02/2015$200.00
#10016First LastAdmin theme, marketing theme01/01/2015$200.00
#10017Firstname LastnameAdmin theme01/01/2015$100.00
#10018Name AnotherPersonal blog theme01/01/2015$100.00
#10019One MoreMarketing theme, personal blog theme, admin theme01/01/2015$300.00
#10020Name Right HerePersonal blog theme, admin theme01/02/2015$200.00
-
-
- -
- -
@@ -282,19 +37,9 @@
-{foreach item=script from=$js} - -{/foreach} - -{include file="debugbar.tpl"} + +{include 'shared/footer.tpl'} + diff --git a/core/l/Smarty/debug.tpl b/application/view/templates/shared/debug.tpl similarity index 76% rename from core/l/Smarty/debug.tpl rename to application/view/templates/shared/debug.tpl index 37975ba..8ea8b83 100644 --- a/core/l/Smarty/debug.tpl +++ b/application/view/templates/shared/debug.tpl @@ -19,14 +19,14 @@ {foreach $assigned_vars as $vars} - - - - - {/foreach} + + + + + {/foreach}

${$vars@key}

- {if isset($vars['nocache'])}Nocache
{/if} - {if isset($vars['scope'])}Origin: {$vars['scope']|debug_print_var nofilter}{/if} -

Value

{$vars['value']|debug_print_var:10:80 nofilter}
{if isset($vars['attributes'])}

Attributes

{$vars['attributes']|debug_print_var nofilter} {/if}

${$vars@key}

+ {if isset($vars['nocache'])}Nocache
{/if} + {if isset($vars['scope'])}Origin: {$vars['scope']|debug_print_var nofilter}{/if} +

Value

{$vars['value']|debug_print_var:10:80 nofilter}
{if isset($vars['attributes'])}

Attributes

{$vars['attributes']|debug_print_var nofilter} {/if}

assigned config file variables

@@ -46,9 +46,8 @@ + \ No newline at end of file diff --git a/application/view/templates/debugbar.tpl b/application/view/templates/shared/debugbar.tpl similarity index 100% rename from application/view/templates/debugbar.tpl rename to application/view/templates/shared/debugbar.tpl diff --git a/application/view/templates/shared/footer.tpl b/application/view/templates/shared/footer.tpl new file mode 100644 index 0000000..1157d6c --- /dev/null +++ b/application/view/templates/shared/footer.tpl @@ -0,0 +1,13 @@ +{foreach item=script from=$js} + +{/foreach} + +{include file="./debugbar.tpl"} \ No newline at end of file diff --git a/application/view/templates/shared/header.tpl b/application/view/templates/shared/header.tpl new file mode 100644 index 0000000..50adfdf --- /dev/null +++ b/application/view/templates/shared/header.tpl @@ -0,0 +1,26 @@ + + + + + + + + + + + + {$title} + + {foreach item=style from=$css} + + {/foreach} + + \ No newline at end of file diff --git a/composer.json b/composer.json index 070e046..036e972 100644 --- a/composer.json +++ b/composer.json @@ -8,12 +8,18 @@ "authors": [ { "name": "Stephan Kasdorf", - "email": "skasdorf@alllinux.de", - "homepage": "http://www.alllinux.de", + "email": "stephan.kasdorf@bittomine.com", + "homepage": "https://www.nibiru-framework.com", "role": "Developer" } ], + "config": { + "vendor-dir": "core/l" + }, "require": { - "php": ">=7.1.0" + "php": ">=7.1.0", + "smarty/smarty": "^3.1", + "phpmailer/phpmailer": "^6.1", + "carbondate/carbon": "^2.0@beta" } -} +} \ No newline at end of file diff --git a/core/a/controller.php b/core/a/controller.php new file mode 100644 index 0000000..ade1c97 --- /dev/null +++ b/core/a/controller.php @@ -0,0 +1,29 @@ +getConfig()[View::NIBIRU_SECURITY]["password_hash"] . "') AS ".self::TABLE['field']['user_pass']." FROM user WHERE " . self::TABLE['field']['user_name']. " = '" . $user_name . "';"); return array_shift($result); } - + + /** + * @return mixed + */ public function loadTableAsArray() { $result = Pdo::fetchTableAsArray( self::getTable()['table'] ); return $result; } - + + /** + * @param bool $id + * @return mixed|void + */ public function selectRowsetById($id = false) { // TODO: Implement selectRowsetById() method. } + /** + * @param array $rowset + * @param bool $id + * @return mixed|void + */ public function insertRowsetById($rowset = array(), $id = false) { // TODO: Implement insertRowsetById() method. } + /** + * @param bool $min + * @param bool $max + * @return mixed|void + */ public function selectDatasetByMinMax($min = false, $max = false) { // TODO: Implement selectDatasetByMinMax() method. diff --git a/core/a/pageination.php b/core/a/pageination.php index a179c1e..55cfe86 100755 --- a/core/a/pageination.php +++ b/core/a/pageination.php @@ -12,8 +12,10 @@ use Nibiru\Config; use Nibiru\Controller; use Nibiru\Router; use Nibiru\View; +use Nibiru\IPageination; +use Nibiru\Adapter\IDb; -abstract class Pageination implements \Nibiru\IPageination +abstract class Pageination implements IPageination { use Attributes\Pageination; @@ -33,7 +35,10 @@ abstract class Pageination implements \Nibiru\IPageination self::$_uri_pagination_path = '/' . Router::getInstance()->currentPage() . '/' . Controller::getInstance()->getRequest()['_action'] . '/'; } - private static function getUriPaginationPath() + /** + * @return string + */ + private static function getUriPaginationPath(): string { return self::$_uri_pagination_path; } @@ -56,7 +61,7 @@ abstract class Pageination implements \Nibiru\IPageination /** * @return int */ - private static function getMaxPageEntries() + private static function getMaxPageEntries(): int { return self::$_max_page_entries; } @@ -64,12 +69,15 @@ abstract class Pageination implements \Nibiru\IPageination /** * @param int $max_page_entries */ - private static function setMaxPageEntries( $max_page_entries ) + private static function setMaxPageEntries( int $max_page_entries ) { self::$_max_page_entries = $max_page_entries; } - private static function currentPageEntryLimit( ) + /** + * @return mixed + */ + private static function currentPageEntryLimit( ): ?array { return self::getPageEntryIndex()[self::getCurrentNumber()]; } @@ -83,7 +91,7 @@ abstract class Pageination implements \Nibiru\IPageination } /** - * @param array $page_entry_index + * will set the current page entry index */ private static function setPageEntryIndex( ) { @@ -128,13 +136,13 @@ abstract class Pageination implements \Nibiru\IPageination /** * @return int */ - private static function getEntriesPerPage() + private static function getEntriesPerPage(): int { return self::$_entries_per_page; } /** - * @param int $entries_per_page + * will set the entries per page */ private static function setEntriesPerPage( ) { @@ -144,7 +152,7 @@ abstract class Pageination implements \Nibiru\IPageination /** * @return int */ - public static function getMaxPages( ) + public static function getMaxPages( ): int { return self::$_max_pages; } @@ -153,7 +161,7 @@ abstract class Pageination implements \Nibiru\IPageination * @desc if you have deactivated pages you can set a filter here * @param string $where */ - private static function setMaxPages( $where = '' ) + private static function setMaxPages( string $where = '' ) { $tableinfo = self::getTable()->loadAllTableFieldNames(); self::setMaxPageEntries( self::getTable()->loadTableRowCount( $tableinfo[0], $where )); @@ -163,15 +171,16 @@ abstract class Pageination implements \Nibiru\IPageination /** * @return boolean */ - private static function getTable( ) + private static function getTable( ): IDb { return self::$_table; } /** - * @param boolean $table + * @param IDb $table + * @param string $where */ - public static function setTable( Adapter\IDb $table, $where = '' ) + public static function setTable( IDb $table, string $where = '' ) { if(is_object( $table )) { @@ -185,13 +194,13 @@ abstract class Pageination implements \Nibiru\IPageination /** * @return array */ - protected static function pageContent() + protected static function pageContent(): array { return self::$_current_page_content; } /** - * @param array $current_page_content + * will set the current page content */ protected static function setCurrentPageContent( ) { @@ -211,7 +220,7 @@ abstract class Pageination implements \Nibiru\IPageination /** * @return int */ - protected static function getCurrentNumber() + protected static function getCurrentNumber(): int { return self::$_current_number; } @@ -221,7 +230,6 @@ abstract class Pageination implements \Nibiru\IPageination * is also used without the pagination, so in order to avoid the * settings not to work, it is possible to skip the currentNumber * setup. - * @param int $current_number */ protected static function setCurrentNumber( ) { @@ -270,13 +278,13 @@ abstract class Pageination implements \Nibiru\IPageination /** * @return int */ - protected static function getNextPageNumber() + protected static function getNextPageNumber(): int { return self::$_next_page_number; } /** - * @param int $next_page_number + * Will set the next page number up */ protected static function setNextPageNumber( ) { @@ -295,13 +303,13 @@ abstract class Pageination implements \Nibiru\IPageination /** * @return int */ - public static function getPreviousPageNumber() + public static function getPreviousPageNumber(): int { return self::$_previous_page_number; } /** - * @param int $previous_page_number + * will set the previous page number before */ public static function setPreviousPageNumber( ) { diff --git a/core/a/postgres.db.php b/core/a/postgres.db.php index a079975..a19e09d 100644 --- a/core/a/postgres.db.php +++ b/core/a/postgres.db.php @@ -34,7 +34,7 @@ abstract class Db implements IDb * @desc getter for the table constant array * @return array */ - private static function getTable() + private static function getTable(): array { return self::$table; } diff --git a/core/c/auth.php b/core/c/auth.php index eeca611..b485687 100644 --- a/core/c/auth.php +++ b/core/c/auth.php @@ -104,4 +104,22 @@ class Auth extends Controller implements IAuth $this->_password = $password; } + /** + * This should be part of any extended controller + * class in order to implement a page structure + * @return array + */ + public function pageAction() + { + // TODO: Implement pageAction() method. + } + + /** + * This is the part where you can add titles to + * your page navigation. + */ + public function navigationAction() + { + // TODO: Implement navigationAction() method. + } } \ No newline at end of file diff --git a/core/c/autoloader.php b/core/c/autoloader.php index e88f6c4..b552286 100644 --- a/core/c/autoloader.php +++ b/core/c/autoloader.php @@ -156,7 +156,16 @@ class Autoloader { return self::$_modules; } - + + /** + * @param string $folderPath + * @return \RecursiveIteratorIterator + */ + private static function folderContent( string $folderPath ): \RecursiveIteratorIterator + { + return new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator( $folderPath )); + } + /** * @param array $filesInFoler */ @@ -172,7 +181,7 @@ class Autoloader { foreach ( Config::getInstance()->getConfig()[View::NIBIRU_SETTINGS][self::DB_MODEL_FOLDER] as $modelfolder ) { - $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator( __DIR__ . $modelfolder )); + $iterator = self::folderContent( __DIR__ . $modelfolder ); foreach ( $iterator as $item ) { if($item->getFileName()!= self::MY_FILE_NAME && $item->getFileName()!="." && $item->getFileName()!="..") @@ -184,7 +193,7 @@ class Autoloader } else { - $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(__DIR__ . Config::getInstance()->getConfig()[View::NIBIRU_SETTINGS][self::DB_MODEL_FOLDER] )); + $iterator = self::folderContent(__DIR__ . Config::getInstance()->getConfig()[View::NIBIRU_SETTINGS][self::DB_MODEL_FOLDER] ); foreach ( $iterator as $item ) { if($item->getFileName()!= self::MY_FILE_NAME && $item->getFileName()!="." && $item->getFileName()!="..") @@ -196,7 +205,7 @@ class Autoloader /** * @desc run check on modules that should provide an interface as well as a trait */ - $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(__DIR__ . Config::getInstance()->getConfig()[View::NIBIRU_SETTINGS][self::INTERFACE_FOLDER] )); + $iterator = self::folderContent(__DIR__ . Config::getInstance()->getConfig()[View::NIBIRU_SETTINGS][self::INTERFACE_FOLDER] ); foreach ( $iterator as $item ) { if($item->getFileName()!= self::MY_FILE_NAME && $item->getFileName()!="." && $item->getFileName()!="..") @@ -214,7 +223,7 @@ class Autoloader self::$_filesInFoler[] = $interface['filepathname']; } - $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(__DIR__ . Config::getInstance()->getConfig()[View::NIBIRU_SETTINGS][self::TRAIT_FOLDER] )); + $iterator = self::folderContent(__DIR__ . Config::getInstance()->getConfig()[View::NIBIRU_SETTINGS][self::TRAIT_FOLDER] ); foreach ( $iterator as $item ) { if($item->getFileName()!= self::MY_FILE_NAME && $item->getFileName()!="." && $item->getFileName()!="..") @@ -232,7 +241,7 @@ class Autoloader self::$_filesInFoler[] = $trait['filepathname']; } - $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator(__DIR__ . Config::getInstance()->getConfig()[View::NIBIRU_SETTINGS][self::MODULE_FOLDER] )); + $iterator = self::folderContent(__DIR__ . Config::getInstance()->getConfig()[View::NIBIRU_SETTINGS][self::MODULE_FOLDER] ); foreach ( $iterator as $item ) { if($item->getFileName()!= self::MY_FILE_NAME && $item->getFileName()!="." && $item->getFileName()!="..") diff --git a/core/c/controller.php b/core/c/controller.php index 2420572..5373046 100644 --- a/core/c/controller.php +++ b/core/c/controller.php @@ -1,6 +1,5 @@ _setConfig(Config::getInstance()->getConfig()); - $this->_setTemplateEngine(); } public static function getInstance() @@ -42,59 +40,6 @@ class Engine implements IEngine { $this->_config = $config; } - - /** - * @return mixed - */ - public function getTemplateEngine() - { - return self::$_template_engine; - } - - /** - * @desc set the template engine implementation and make it - * known class wide - * @param mixed $template_engine - */ - protected function _setTemplateEngine( ) - { - switch(self::getConfig()[self::T_ENGINE][self::T_ENGINE_NAME]) - { - case self::T_ENGINE_DWOO: - $this->_template_engine = self::T_ENGINE_DWOO; - require_once __DIR__ . '/../l/Dwoo/IDataProvider.php'; - require_once __DIR__ . '/../l/Dwoo/Data.php'; - require_once __DIR__ . '/../l/Dwoo/ICompiler.php'; - require_once __DIR__ . '/../l/Dwoo/Compiler.php'; - require_once __DIR__ . '/../l/Dwoo/ITemplate.php'; - require_once __DIR__ . '/../l/Dwoo/Template/Str.php'; - require_once __DIR__ . '/../l/Dwoo/Template/File.php'; - require_once __DIR__ . '/../l/Dwoo/Exception.php'; - require_once __DIR__ . '/../l/Dwoo/Plugin.php'; - require_once __DIR__ . '/../l/Dwoo/ICompilable.php'; - require_once __DIR__ . '/../l/Dwoo/ICompilable/Block.php'; - require_once __DIR__ . '/../l/Dwoo/IElseable.php'; - require_once __DIR__ . '/../l/Dwoo/Plugins/'; - require_once __DIR__ . '/../l/Dwoo/Block/Plugin.php'; - require_once __DIR__ . '/../l/Dwoo/Plugins/Blocks/PluginTopLevelBlock.php'; - require_once __DIR__ . '/../l/Dwoo/Exception.php'; - require_once __DIR__ . '/../l/Dwoo/ILoader.php'; - require_once __DIR__ . '/../l/Dwoo/Loader.php'; - require_once __DIR__ . '/../l/Dwoo/Core.php'; - - require_once __DIR__ . '/../l/Dwoo/Smarty/Adapter.php'; - break; - case self::T_ENGINE_TWIG: - $this->_template_engine = self::T_ENGINE_TWIG; - require_once __DIR__ . '/../l/Twig/Autoloader.php'; - break; - case self::T_ENGINE_SMARTY: - default: - $this->_template_engine = self::T_ENGINE_SMARTY; - require_once __DIR__ . '/../l/Smarty/Smarty.class.php'; - break; - } - } } Engine::getInstance(); \ No newline at end of file diff --git a/core/c/view.php b/core/c/view.php index 4a0db6a..d451e5f 100755 --- a/core/c/view.php +++ b/core/c/view.php @@ -8,7 +8,7 @@ namespace Nibiru; * @category - [PLEASE SPECIFIY] * @license - BSD License */ -class View extends Controller implements IView +class View implements IView { private static $_instance; @@ -49,44 +49,28 @@ class View extends Controller implements IView /** * @return array */ - public function getEngine() + public function getEngine(): \Smarty { return self::$engine; } /** - * @param array $engine + * Will setup the template engine */ public static function _setEngine( ) { - switch(Config::getInstance()->getConfig()[Engine::T_ENGINE][Engine::T_ENGINE_NAME]) - { - case Engine::T_ENGINE_SMARTY: - self::$engine = new \Smarty(); - self::$engine->setTemplateDir(__DIR__ . Config::getInstance()->getConfig()[Engine::T_ENGINE]["templates"]); - self::$engine->setCompileDir(__DIR__ . Config::getInstance()->getConfig()[Engine::T_ENGINE]["templates_c"]); - self::$engine->setCacheDir(__DIR__ . Config::getInstance()->getConfig()[Engine::T_ENGINE]["cache"]); - self::$engine->setConfigDir(__DIR__ . Config::getInstance()->getConfig()[Engine::T_ENGINE]["config_dir"]); - self::$engine->assign('debuging', Config::getInstance()->getConfig()[Engine::T_ENGINE]["debugbar"]); - break; - case Engine::T_ENGINE_TWIG: - $twig = new \Twig_Autoloader(); - $twig::register(); - self::$engine = new \Twig_Environment(new \Twig_Loader_Filesystem(Config::getInstance()->getConfig()[Engine::T_ENGINE]["templates"]), array( - 'cache' => Config::getInstance()->getConfig()[Engine::T_ENGINE]["cache"], - )); - break; - case Engine::T_ENGINE_DWOO: - // Implement Dwoo Template Engine - self::$engine = new \Dwoo\Core(); - self::$engine->setCacheDir(Config::getInstance()->getConfig()[Engine::T_ENGINE]["cache"]); - self::$engine->setCompileDir(Config::getInstance()->getConfig()[Engine::T_ENGINE]["templates_c"]); - self::$engine->setTemplateDir(Config::getInstance()->getConfig()[Engine::T_ENGINE]["templates"]); - self::$engine->get('debugbar.tpl', array('debuging' => Config::getInstance()->getConfig()[Engine::T_ENGINE]["debugbar"])); - break; - } + self::$engine = new \Smarty(); + self::$engine->setTemplateDir(__DIR__ . Config::getInstance()->getConfig()[Engine::T_ENGINE]["templates"]); + self::$engine->setCompileDir(__DIR__ . Config::getInstance()->getConfig()[Engine::T_ENGINE]["templates_c"]); + self::$engine->setCacheDir(__DIR__ . Config::getInstance()->getConfig()[Engine::T_ENGINE]["cache"]); + self::$engine->setConfigDir(__DIR__ . Config::getInstance()->getConfig()[Engine::T_ENGINE]["config_dir"]); + self::$engine->setDebugTemplate(__DIR__ . Config::getInstance()->getConfig()[Engine::T_ENGINE]["debug_template"] ); + self::$engine->assign('debuging', Config::getInstance()->getConfig()[Engine::T_ENGINE]["debugbar"]); } + /** + * @param array $varname + */ public function assign( $varname = array() ) { if(is_array($varname)) @@ -95,12 +79,18 @@ class View extends Controller implements IView } } + /** + * @param $page + */ public static function forwardTo( $page ) { header('Location: ' . $page); exit(); } + /** + * @param $page + */ public function display( $page ) { preg_match_all("/".self::NIBIRU_FILE_END."/", $page, $matches); @@ -126,7 +116,12 @@ class View extends Controller implements IView { return $this->xmlPos; } - + + /** + * @param $stuff + * @param bool $die + * @return string + */ protected static function printStuffToScreen( $stuff, $die = false ) { $output = "
" . print_r( $stuff, true ) . "
"; diff --git a/core/framework.php b/core/framework.php index b0afef8..587eccd 100644 --- a/core/framework.php +++ b/core/framework.php @@ -21,6 +21,7 @@ require_once __DIR__ . '/c/config.php'; require_once __DIR__ . '/c/router.php'; require_once __DIR__ . '/i/engine.php'; require_once __DIR__ . '/c/engine.php'; +require_once __DIR__ . '/l/autoload.php'; /** * @desc Database connectivity */ @@ -79,10 +80,11 @@ require_once __DIR__ . '/c/typeselect.php'; require_once __DIR__ . '/c/typerange.php'; require_once __DIR__ . '/c/typeurl.php'; require_once __DIR__ . '/c/typelabel.php'; -require_once __DIR__ . '/i/controller.php'; -require_once __DIR__ . '/c/controller.php'; require_once __DIR__ . '/i/view.php'; require_once __DIR__ . '/c/view.php'; +require_once __DIR__ . '/i/controller.php'; +require_once __DIR__ . '/c/controller.php'; +require_once __DIR__ . '/a/controller.php'; require_once __DIR__ . '/c/jsonnavigation.php'; /** * @desc currently unfinished diff --git a/core/i/auth.php b/core/i/auth.php index e7a9c4d..53967df 100644 --- a/core/i/auth.php +++ b/core/i/auth.php @@ -10,8 +10,5 @@ namespace Nibiru; */ interface IAuth { - const NIBIRU_SECURITY = "SECURITY"; - public function auth( $username, $password ); - } \ No newline at end of file diff --git a/core/i/engine.php b/core/i/engine.php index fe2b075..e5a886d 100644 --- a/core/i/engine.php +++ b/core/i/engine.php @@ -9,8 +9,4 @@ namespace Nibiru; interface IEngine { const T_ENGINE = "ENGINE"; - const T_ENGINE_NAME = "name"; - const T_ENGINE_TWIG = "Twig"; - const T_ENGINE_SMARTY = "Smarty"; - const T_ENGINE_DWOO = "Dwoo"; } \ No newline at end of file diff --git a/core/l/.gitkeep b/core/l/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/core/l/Dwoo/Block/Plugin.php b/core/l/Dwoo/Block/Plugin.php deleted file mode 100644 index b05447c..0000000 --- a/core/l/Dwoo/Block/Plugin.php +++ /dev/null @@ -1,119 +0,0 @@ - - * @author David Sanchez - * @copyright 2008-2013 Jordi Boggiano - * @copyright 2013-2016 David Sanchez - * @license http://dwoo.org/LICENSE Modified BSD License - * @version 1.3.0 - * @date 2016-09-23 - * @link http://dwoo.org/ - */ - -namespace Dwoo\Block; - -use Dwoo\Plugin as DwooPlugin; -use Dwoo\Compiler as DwooCompiler; - -/** - * Base class for block plugins. - * you have to implement the init() method, it will receive the parameters that - * are in the template code and is called when the block starts - * This software is provided 'as-is', without any express or implied warranty. - * In no event will the authors be held liable for any damages arising from the use of this software. - */ -abstract class Plugin extends DwooPlugin -{ - /** - * Stores the contents of the block while it runs. - * - * @var string - */ - protected $buffer = ''; - - /** - * Buffers input, override only if necessary. - * - * @var string the content that must be buffered - */ - public function buffer($input) - { - $this->buffer .= $input; - } - - // initialization code, receives the parameters from {block param1 param2} - // public function init($arg, $arg, ...); - - /** - * Called when the block ends, this is most of the time followed right away by a call - * of process() but not always, so this should be used to do any shutdown operations on the - * block object, if required. - */ - public function end() - { - } - - /** - * Called when the block output is required by a parent block. - * this must read $this->buffer and return it processed - * - * @return string - */ - public function process() - { - return $this->buffer; - } - - /** - * Called at compile time to define what the block should output in the compiled template code, happens when the - * block is declared basically this will replace the {block arg arg arg} tag in the template. - * - * @param DwooCompiler $compiler the compiler instance that calls this function - * @param array $params an array containing original and compiled parameters - * @param string $prepend that is just meant to allow a child class to call - * parent::postProcessing($compiler, $params, "foo();") to add a command before the - * default commands are executed parent::postProcessing($compiler, $params, "foo();") - * to add a command before the default commands are executed - * @param string $append that is just meant to allow a child class to call - * parent::postProcessing($compiler, $params, null, "foo();") to add a command after - * the default commands are executed parent::postProcessing($compiler, $params, null, - * "foo();") to add a command after the default commands are executed - * @param string $type the type is the plugin class name used - * - * @return string - */ - public static function preProcessing(DwooCompiler $compiler, array $params, $prepend, $append, $type) - { - return DwooCompiler::PHP_OPEN . $prepend . '$this->addStack("' . $type . '", array(' . DwooCompiler::implode_r($compiler->getCompiledParams($params)) . '));' . $append . DwooCompiler::PHP_CLOSE; - } - - /** - * Called at compile time to define what the block should output in the compiled template code, happens when the - * block is ended basically this will replace the {/block} tag in the template. - * - * @see preProcessing - * - * @param DwooCompiler $compiler the compiler instance that calls this function - * @param array $params an array containing original and compiled parameters, see preProcessing() for more - * details more details - * @param string $prepend that is just meant to allow a child class to call - * parent::postProcessing($compiler, $params, "foo();") to add a command before the - * default commands are executed parent::postProcessing($compiler, $params, "foo();") - * to add a command before the default commands are executed - * @param string $append that is just meant to allow a child class to call - * parent::postProcessing($compiler, $params, null, "foo();") to add a command after - * the default commands are executed parent::postProcessing($compiler, $params, null, - * "foo();") to add a command after the default commands are executed - * @param string $content the entire content of the block being closed - * - * @return string - */ - public static function postProcessing(DwooCompiler $compiler, array $params, $prepend, $append, $content) - { - return $content . DwooCompiler::PHP_OPEN . $prepend . '$this->delStack();' . $append . DwooCompiler::PHP_CLOSE; - } -} diff --git a/core/l/Dwoo/Compilation/Exception.php b/core/l/Dwoo/Compilation/Exception.php deleted file mode 100644 index 732a8d4..0000000 --- a/core/l/Dwoo/Compilation/Exception.php +++ /dev/null @@ -1,60 +0,0 @@ - - * @author David Sanchez - * @copyright 2008-2013 Jordi Boggiano - * @copyright 2013-2017 David Sanchez - * @license http://dwoo.org/LICENSE LGPLv3 - * @version 1.3.6 - * @date 2017-03-21 - * @link http://dwoo.org/ - */ - -namespace Dwoo\Compilation; - -use Dwoo\Exception as DwooException; -use Dwoo\Compiler as DwooCompiler; - -/** - * Dwoo compilation exception class. - * This software is provided 'as-is', without any express or implied warranty. - * In no event will the authors be held liable for any damages arising from the use of this software. - */ -class Exception extends DwooException -{ - protected $compiler; - protected $template; - - /** - * Exception constructor. - * - * @param DwooCompiler $compiler - * @param int $message - */ - public function __construct(DwooCompiler $compiler, $message) - { - $this->compiler = $compiler; - $this->template = $compiler->getCore()->getTemplate(); - parent::__construct('Compilation error at line ' . $compiler->getLine() . ' in "' . $this->template->getResourceName() . ':' . $this->template->getResourceIdentifier() . '" : ' . $message); - } - - /** - * @return DwooCompiler - */ - public function getCompiler() - { - return $this->compiler; - } - - /** - * @return \Dwoo\ITemplate|null - */ - public function getTemplate() - { - return $this->template; - } -} diff --git a/core/l/Dwoo/Compiler.php b/core/l/Dwoo/Compiler.php deleted file mode 100644 index fff2e05..0000000 --- a/core/l/Dwoo/Compiler.php +++ /dev/null @@ -1,3671 +0,0 @@ - - * @author David Sanchez - * @copyright 2008-2013 Jordi Boggiano - * @copyright 2013-2017 David Sanchez - * @license http://dwoo.org/LICENSE LGPLv3 - * @version 1.3.6 - * @date 2017-03-22 - * @link http://dwoo.org/ - */ - -namespace Dwoo; - -use Closure; -use Dwoo\Plugins\Blocks\PluginIf; -use Dwoo\Security\Exception as SecurityException; -use Dwoo\Security\Policy as SecurityPolicy; -use Dwoo\Compilation\Exception as CompilationException; -use ReflectionFunction; -use ReflectionMethod; - -/** - * Default dwoo compiler class, compiles dwoo templates into php. - * This software is provided 'as-is', without any express or implied warranty. - * In no event will the authors be held liable for any damages arising from the use of this software. - */ -class Compiler implements ICompiler -{ - /** - * Constant that represents a php opening tag. - * use it in case it needs to be adjusted - * - * @var string - */ - const PHP_OPEN = ''; - - /** - * Boolean flag to enable or disable debugging output. - * - * @var bool - */ - public $debug = false; - - /** - * Left script delimiter. - * - * @var string - */ - protected $ld = '{'; - - /** - * Left script delimiter with escaped regex meta characters. - * - * @var string - */ - protected $ldr = '\\{'; - - /** - * Right script delimiter. - * - * @var string - */ - protected $rd = '}'; - - /** - * Right script delimiter with escaped regex meta characters. - * - * @var string - */ - protected $rdr = '\\}'; - - /** - * Defines whether the nested comments should be parsed as nested or not. - * defaults to false (classic block comment parsing as in all languages) - * - * @var bool - */ - protected $allowNestedComments = false; - - /** - * Defines whether opening and closing tags can contain spaces before valid data or not. - * turn to true if you want to be sloppy with the syntax, but when set to false it allows - * to skip javascript and css tags as long as they are in the form "{ something", which is - * nice. default is false. - * - * @var bool - */ - protected $allowLooseOpenings = false; - - /** - * Defines whether the compiler will automatically html-escape variables or not. - * default is false - * - * @var bool - */ - protected $autoEscape = false; - - /** - * Security policy object. - * - * @var SecurityPolicy - */ - protected $securityPolicy; - - /** - * Stores the custom plugins registered with this compiler. - * - * @var array - */ - protected $customPlugins = array(); - - /** - * Stores the template plugins registered with this compiler. - * - * @var array - */ - protected $templatePlugins = array(); - - /** - * Stores the pre- and post-processors callbacks. - * - * @var array - */ - protected $processors = array('pre' => array(), 'post' => array()); - - /** - * Stores a list of plugins that are used in the currently compiled - * template, and that are not compilable. these plugins will be loaded - * during the template's runtime if required. - * it is a 1D array formatted as key:pluginName value:pluginType - * - * @var array - */ - protected $usedPlugins; - - /** - * Stores the template undergoing compilation. - * - * @var string - */ - protected $template; - - /** - * Stores the current pointer position inside the template. - * - * @var int - */ - protected $pointer; - - /** - * Stores the current line count inside the template for debugging purposes. - * - * @var int - */ - protected $line; - - /** - * Stores the current template source while compiling it. - * - * @var string - */ - protected $templateSource; - - /** - * Stores the data within which the scope moves. - * - * @var array - */ - protected $data; - - /** - * Variable scope of the compiler, set to null if - * it can not be resolved to a static string (i.e. if some - * plugin defines a new scope based on a variable array key). - * - * @var mixed - */ - protected $scope; - - /** - * Variable scope tree, that allows to rebuild the current - * scope if required, i.e. when going to a parent level. - * - * @var array - */ - protected $scopeTree; - - /** - * Block plugins stack, accessible through some methods. - * - * @see findBlock - * @see getCurrentBlock - * @see addBlock - * @see addCustomBlock - * @see injectBlock - * @see removeBlock - * @see removeTopBlock - * @var array - */ - protected $stack = array(); - - /** - * Current block at the top of the block plugins stack, - * accessible through getCurrentBlock. - * - * @see getCurrentBlock - * @var array - */ - protected $curBlock; - - /** - * Current dwoo object that uses this compiler, or null. - * - * @var Core - */ - public $core; - - /** - * Holds an instance of this class, used by getInstance when you don't - * provide a custom compiler in order to save resources. - * - * @var Compiler - */ - protected static $instance; - - /** - * Token types. - * - * @var int - */ - const T_UNQUOTED_STRING = 1; - const T_NUMERIC = 2; - const T_NULL = 4; - const T_BOOL = 8; - const T_MATH = 16; - const T_BREAKCHAR = 32; - - /** - * Compiler constructor. - * saves the created instance so that child templates get the same one - */ - public function __construct() - { - self::$instance = $this; - } - - /** - * Sets the delimiters to use in the templates. - * delimiters can be multi-character strings but should not be one of those as they will - * make it very hard to work with templates or might even break the compiler entirely : "\", "$", "|", ":" and - * finally "#" only if you intend to use config-vars with the #var# syntax. - * - * @param string $left left delimiter - * @param string $right right delimiter - */ - public function setDelimiters($left, $right) - { - $this->ld = $left; - $this->rd = $right; - $this->ldr = preg_quote($left, '/'); - $this->rdr = preg_quote($right, '/'); - } - - /** - * Returns the left and right template delimiters. - * - * @return array containing the left and the right delimiters - */ - public function getDelimiters() - { - return array($this->ld, $this->rd); - } - - /** - * Sets the way to handle nested comments, if set to true - * {* foo {* some other *} comment *} will be stripped correctly. - * if false it will remove {* foo {* some other *} and leave "comment *}" alone, - * this is the default behavior - * - * @param bool $allow allow nested comments or not, defaults to true (but the default internal value is false) - */ - public function setNestedCommentsHandling($allow = true) - { - $this->allowNestedComments = (bool)$allow; - } - - /** - * Returns the nested comments handling setting. - * - * @see setNestedCommentsHandling - * @return bool true if nested comments are allowed - */ - public function getNestedCommentsHandling() - { - return $this->allowNestedComments; - } - - /** - * Sets the tag openings handling strictness, if set to true, template tags can - * contain spaces before the first function/string/variable such as { $foo} is valid. - * if set to false (default setting), { $foo} is invalid but that is however a good thing - * as it allows css (i.e. #foo { color:red; }) to be parsed silently without triggering - * an error, same goes for javascript. - * - * @param bool $allow true to allow loose handling, false to restore default setting - */ - public function setLooseOpeningHandling($allow = false) - { - $this->allowLooseOpenings = (bool)$allow; - } - - /** - * Returns the tag openings handling strictness setting. - * - * @see setLooseOpeningHandling - * @return bool true if loose tags are allowed - */ - public function getLooseOpeningHandling() - { - return $this->allowLooseOpenings; - } - - /** - * Changes the auto escape setting. - * if enabled, the compiler will automatically html-escape variables, - * unless they are passed through the safe function such as {$var|safe} - * or {safe $var} - * default setting is disabled/false - * - * @param bool $enabled set to true to enable, false to disable - */ - public function setAutoEscape($enabled) - { - $this->autoEscape = (bool)$enabled; - } - - /** - * Returns the auto escape setting. - * default setting is disabled/false - * - * @return bool - */ - public function getAutoEscape() - { - return $this->autoEscape; - } - - /** - * Adds a preprocessor to the compiler, it will be called - * before the template is compiled. - * - * @param mixed $callback either a valid callback to the preprocessor or a simple name if the autoload is set to - * true - * @param bool $autoload if set to true, the preprocessor is auto-loaded from one of the plugin directories, else - * you must provide a valid callback - */ - public function addPreProcessor($callback, $autoload = false) - { - if ($autoload) { - $name = str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '', Core::toCamelCase($callback)); - $class = Core::NAMESPACE_PLUGINS_PROCESSORS . $name; - - if (class_exists($class)) { - $callback = array(new $class($this), 'process'); - } elseif (function_exists($class)) { - $callback = $class; - } else { - $callback = array('autoload' => true, 'class' => $class, 'name' => $name); - } - - $this->processors['pre'][] = $callback; - } else { - $this->processors['pre'][] = $callback; - } - } - - /** - * Removes a preprocessor from the compiler. - * - * @param mixed $callback either a valid callback to the preprocessor or a simple name if it was autoloaded - */ - public function removePreProcessor($callback) - { - if (($index = array_search($callback, $this->processors['pre'], true)) !== false) { - unset($this->processors['pre'][$index]); - } elseif (($index = array_search(Core::NAMESPACE_PLUGINS_PROCESSORS . str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '', - $callback), - $this->processors['pre'], true)) !== false) { - unset($this->processors['pre'][$index]); - } else { - $class = Core::NAMESPACE_PLUGINS_PROCESSORS . str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '', $callback); - foreach ($this->processors['pre'] as $index => $proc) { - if (is_array($proc) && ($proc[0] instanceof $class) || (isset($proc['class']) && $proc['class'] == $class)) { - unset($this->processors['pre'][$index]); - break; - } - } - } - } - - /** - * Adds a postprocessor to the compiler, it will be called - * before the template is compiled. - * - * @param mixed $callback either a valid callback to the postprocessor or a simple name if the autoload is set to - * true - * @param bool $autoload if set to true, the postprocessor is auto-loaded from one of the plugin directories, else - * you must provide a valid callback - */ - public function addPostProcessor($callback, $autoload = false) - { - if ($autoload) { - $name = str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '', $callback); - $class = Core::NAMESPACE_PLUGINS_PROCESSORS . Core::toCamelCase($name); - - if (class_exists($class)) { - $callback = array(new $class($this), 'process'); - } elseif (function_exists($class)) { - $callback = $class; - } else { - $callback = array('autoload' => true, 'class' => $class, 'name' => $name); - } - - $this->processors['post'][] = $callback; - } else { - $this->processors['post'][] = $callback; - } - } - - /** - * Removes a postprocessor from the compiler. - * - * @param mixed $callback either a valid callback to the postprocessor or a simple name if it was autoloaded - */ - public function removePostProcessor($callback) - { - if (($index = array_search($callback, $this->processors['post'], true)) !== false) { - unset($this->processors['post'][$index]); - } elseif (($index = array_search(Core::NAMESPACE_PLUGINS_PROCESSORS . str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '', - $callback), - $this->processors['post'], true)) !== false) { - unset($this->processors['post'][$index]); - } else { - $class = Core::NAMESPACE_PLUGINS_PROCESSORS . str_replace(Core::NAMESPACE_PLUGINS_PROCESSORS, '', $callback); - foreach ($this->processors['post'] as $index => $proc) { - if (is_array($proc) && ($proc[0] instanceof $class) || (isset($proc['class']) && $proc['class'] == $class)) { - unset($this->processors['post'][$index]); - break; - } - } - } - } - - /** - * Internal function to autoload processors at runtime if required. - * - * @param string $class the class/function name - * @param string $name the plugin name (without Dwoo_Plugin_ prefix) - * - * @return array|string - * @throws Exception - */ - protected function loadProcessor($class, $name) - { - if (!class_exists($class) && !function_exists($class)) { - try { - $this->getCore()->getLoader()->loadPlugin($name); - } - catch (Exception $e) { - throw new Exception('Processor ' . $name . ' could not be found in your plugin directories, please ensure it is in a file named ' . $name . '.php in the plugin directory'); - } - } - - if (class_exists($class)) { - return array(new $class($this), 'process'); - } - - if (function_exists($class)) { - return $class; - } - - throw new Exception('Wrong processor name, when using autoload the processor must be in one of your plugin dir as "name.php" containg a class or function named "Dwoo_Processor_name"'); - } - - /** - * Adds an used plugin, this is reserved for use by the {template} plugin. - * this is required so that plugin loading bubbles up from loaded - * template files to the current one - * - * @private - * - * @param string $name function name - * @param int $type plugin type (Core::*_PLUGIN) - */ - public function addUsedPlugin($name, $type) - { - $this->usedPlugins[$name] = $type; - } - - /** - * Returns all the plugins this template uses. - * - * @private - * @return array the list of used plugins in the parsed template - */ - public function getUsedPlugins() - { - return $this->usedPlugins; - } - - /** - * Adds a template plugin, this is reserved for use by the {template} plugin. - * this is required because the template functions are not declared yet - * during compilation, so we must have a way of validating their argument - * signature without using the reflection api - * - * @private - * - * @param string $name function name - * @param array $params parameter array to help validate the function call - * @param string $uuid unique id of the function - * @param string $body function php code - */ - public function addTemplatePlugin($name, array $params, $uuid, $body = null) - { - $this->templatePlugins[$name] = array('params' => $params, 'body' => $body, 'uuid' => $uuid); - } - - /** - * Returns all the parsed sub-templates. - * - * @private - * @return array the parsed sub-templates - */ - public function getTemplatePlugins() - { - return $this->templatePlugins; - } - - /** - * Marks a template plugin as being called, which means its source must be included in the compiled template. - * - * @param string $name function name - */ - public function useTemplatePlugin($name) - { - $this->templatePlugins[$name]['called'] = true; - } - - /** - * Adds the custom plugins loaded into Dwoo to the compiler so it can load them. - * - * @see Core::addPlugin - * - * @param array $customPlugins an array of custom plugins - */ - public function setCustomPlugins(array $customPlugins) - { - $this->customPlugins = $customPlugins; - } - - /** - * Sets the security policy object to enforce some php security settings. - * use this if untrusted persons can modify templates, - * set it on the Dwoo object as it will be passed onto the compiler automatically - * - * @param SecurityPolicy $policy the security policy object - */ - public function setSecurityPolicy(SecurityPolicy $policy = null) - { - $this->securityPolicy = $policy; - } - - /** - * Returns the current security policy object or null by default. - * - * @return SecurityPolicy|null the security policy object if any - */ - public function getSecurityPolicy() - { - return $this->securityPolicy; - } - - /** - * Sets the pointer position. - * - * @param int $position the new pointer position - * @param bool $isOffset if set to true, the position acts as an offset and not an absolute position - */ - public function setPointer($position, $isOffset = false) - { - if ($isOffset) { - $this->pointer += $position; - } else { - $this->pointer = $position; - } - } - - /** - * Returns the current pointer position, only available during compilation of a template. - * - * @return int - */ - public function getPointer() - { - return $this->pointer; - } - - /** - * Sets the line number. - * - * @param int $number the new line number - * @param bool $isOffset if set to true, the position acts as an offset and not an absolute position - */ - public function setLine($number, $isOffset = false) - { - if ($isOffset) { - $this->line += $number; - } else { - $this->line = $number; - } - } - - /** - * Returns the current line number, only available during compilation of a template. - * - * @return int - */ - public function getLine() - { - return $this->line; - } - - /** - * Returns the dwoo object that initiated this template compilation, only available during compilation of a - * template. - * - * @return Core - */ - public function getCore() - { - return $this->core; - } - - /** - * Overwrites the template that is being compiled. - * - * @param string $newSource the template source that must replace the current one - * @param bool $fromPointer if set to true, only the source from the current pointer position is replaced - * - * @return void - */ - public function setTemplateSource($newSource, $fromPointer = false) - { - if ($fromPointer === true) { - $this->templateSource = substr($this->templateSource, 0, $this->pointer) . $newSource; - } else { - $this->templateSource = $newSource; - } - } - - /** - * Returns the template that is being compiled. - * - * @param mixed $fromPointer if set to true, only the source from the current pointer - * position is returned, if a number is given it overrides the current pointer - * - * @return string the template or partial template - */ - public function getTemplateSource($fromPointer = false) - { - if ($fromPointer === true) { - return substr($this->templateSource, $this->pointer); - } elseif (is_numeric($fromPointer)) { - return substr($this->templateSource, $fromPointer); - } else { - return $this->templateSource; - } - } - - /** - * Resets the compilation pointer, effectively restarting the compilation process. - * this is useful if a plugin modifies the template source since it might need to be recompiled - */ - public function recompile() - { - $this->setPointer(0); - } - - /** - * Compiles the provided string down to php code. - * - * @param Core $core - * @param ITemplate $template the template to compile - * - * @return string a compiled php string - * @throws CompilationException - */ - public function compile(Core $core, ITemplate $template) - { - // init vars - // $compiled = ''; - $tpl = $template->getSource(); - $ptr = 0; - $this->core = $core; - $this->template = $template; - $this->templateSource = &$tpl; - $this->pointer = &$ptr; - - while (true) { - // if pointer is at the beginning, reset everything, that allows a plugin to externally reset the compiler if everything must be reparsed - if ($ptr === 0) { - // resets variables - $this->usedPlugins = array(); - $this->data = array(); - $this->scope = &$this->data; - $this->scopeTree = array(); - $this->stack = array(); - $this->line = 1; - $this->templatePlugins = array(); - // add top level block - $compiled = $this->addBlock('TopLevelBlock', array(), 0); - $this->stack[0]['buffer'] = ''; - - if ($this->debug) { - echo "\n"; - echo 'COMPILER INIT' . "\n"; - } - - if ($this->debug) { - echo 'PROCESSING PREPROCESSORS (' . count($this->processors['pre']) . ')' . "\n"; - } - - // runs preprocessors - foreach ($this->processors['pre'] as $preProc) { - if (is_array($preProc) && isset($preProc['autoload'])) { - $preProc = $this->loadProcessor($preProc['class'], $preProc['name']); - } - if (is_array($preProc) && $preProc[0] instanceof Processor) { - $tpl = call_user_func($preProc, $tpl); - } else { - $tpl = call_user_func($preProc, $this, $tpl); - } - } - unset($preProc); - - // show template source if debug - if ($this->debug) { - echo '
'.print_r(htmlentities($tpl), true).'
'."\n"; - } - - // strips php tags if required by the security policy - if ($this->securityPolicy !== null) { - $search = array('{<\?php.*?\?>}'); - if (ini_get('short_open_tags')) { - $search = array('{<\?.*?\?>}', '{<%.*?%>}'); - } - switch ($this->securityPolicy->getPhpHandling()) { - case SecurityPolicy::PHP_ALLOW: - break; - case SecurityPolicy::PHP_ENCODE: - $tpl = preg_replace_callback($search, array($this, 'phpTagEncodingHelper'), $tpl); - break; - case SecurityPolicy::PHP_REMOVE: - $tpl = preg_replace($search, '', $tpl); - } - } - } - - $pos = strpos($tpl, $this->ld, $ptr); - - if ($pos === false) { - $this->push(substr($tpl, $ptr), 0); - break; - } elseif (substr($tpl, $pos - 1, 1) === '\\' && substr($tpl, $pos - 2, 1) !== '\\') { - $this->push(substr($tpl, $ptr, $pos - $ptr - 1) . $this->ld); - $ptr = $pos + strlen($this->ld); - } elseif (preg_match('/^' . $this->ldr . ($this->allowLooseOpenings ? '\s*' : '') . 'literal' . ($this->allowLooseOpenings ? '\s*' : '') . $this->rdr . '/s', substr($tpl, $pos), $litOpen)) { - if (!preg_match('/' . $this->ldr . ($this->allowLooseOpenings ? '\s*' : '') . '\/literal' . ($this->allowLooseOpenings ? '\s*' : '') . $this->rdr . '/s', $tpl, $litClose, PREG_OFFSET_CAPTURE, $pos)) { - throw new CompilationException($this, 'The {literal} blocks must be closed explicitly with {/literal}'); - } - $endpos = $litClose[0][1]; - $this->push(substr($tpl, $ptr, $pos - $ptr) . substr($tpl, $pos + strlen($litOpen[0]), $endpos - $pos - strlen($litOpen[0]))); - $ptr = $endpos + strlen($litClose[0][0]); - } else { - if (substr($tpl, $pos - 2, 1) === '\\' && substr($tpl, $pos - 1, 1) === '\\') { - $this->push(substr($tpl, $ptr, $pos - $ptr - 1)); - $ptr = $pos; - } - - $this->push(substr($tpl, $ptr, $pos - $ptr)); - $ptr = $pos; - - $pos += strlen($this->ld); - if ($this->allowLooseOpenings) { - while (substr($tpl, $pos, 1) === ' ') { - $pos += 1; - } - } else { - if (substr($tpl, $pos, 1) === ' ' || substr($tpl, $pos, 1) === "\r" || substr($tpl, $pos, 1) === "\n" || substr($tpl, $pos, 1) === "\t") { - $ptr = $pos; - $this->push($this->ld); - continue; - } - } - - // check that there is an end tag present - if (strpos($tpl, $this->rd, $pos) === false) { - throw new CompilationException($this, 'A template tag was not closed, started with "' . substr($tpl, $ptr, 30) . '"'); - } - - $ptr += strlen($this->ld); - $subptr = $ptr; - - while (true) { - $parsed = $this->parse($tpl, $subptr, null, false, 'root', $subptr); - - // reload loop if the compiler was reset - if ($ptr === 0) { - continue 2; - } - - $len = $subptr - $ptr; - $this->push($parsed, substr_count(substr($tpl, $ptr, $len), "\n")); - $ptr += $len; - - if ($parsed === false) { - break; - } - } - } - } - - $compiled .= $this->removeBlock('TopLevelBlock'); - - if ($this->debug) { - echo 'PROCESSING POSTPROCESSORS' . "\n"; - } - - foreach ($this->processors['post'] as $postProc) { - if (is_array($postProc) && isset($postProc['autoload'])) { - $postProc = $this->loadProcessor($postProc['class'], $postProc['name']); - } - if (is_array($postProc) && $postProc[0] instanceof Processor) { - $compiled = call_user_func($postProc, $compiled); - } else { - $compiled = call_user_func($postProc, $this, $compiled); - } - } - unset($postProc); - - if ($this->debug) { - echo 'COMPILATION COMPLETE : MEM USAGE : ' . memory_get_usage() . "\n"; - } - - $output = "getUsedPlugins() as $plugin => $type) { - if ($type & Core::CUSTOM_PLUGIN) { - continue; - } - - switch ($type) { - case Core::CLASS_PLUGIN: - case Core::CLASS_PLUGIN + Core::BLOCK_PLUGIN: - if (class_exists('Plugin' . $plugin) !== false) { - $output .= "if (class_exists('" . "Plugin" . $plugin . "')===false)". - "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n"; - } else { - $output .= "if (class_exists('" . Core::NAMESPACE_PLUGINS_BLOCKS . "Plugin" . $plugin . "')===false)". - "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n"; - } - break; - case Core::CLASS_PLUGIN + Core::FUNC_PLUGIN: - if (class_exists('Plugin' . $plugin) !== false) { - $output .= "if (class_exists('" . "Plugin" . $plugin . "')===false)". - "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n"; - } else { - $output .= "if (class_exists('" . Core::NAMESPACE_PLUGINS_FUNCTIONS . "Plugin" . $plugin . "')===false)". - "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n"; - } - break; - case Core::FUNC_PLUGIN: - if (function_exists('Plugin' . $plugin) !== false) { - $output .= "if (function_exists('" . "Plugin" . $plugin . "')===false)". - "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n"; - } else { - $output .= "if (function_exists('" . Core::NAMESPACE_PLUGINS_FUNCTIONS . "Plugin" . $plugin . "')===false)". - "\n\t\$this->getLoader()->loadPlugin('Plugin$plugin');\n"; - } - break; - case Core::SMARTY_MODIFIER: - $output .= "if (function_exists('smarty_modifier_$plugin')===false)". - "\n\t\$this->getLoader()->loadPlugin('$plugin');\n"; - break; - case Core::SMARTY_FUNCTION: - $output .= "if (function_exists('smarty_function_$plugin')===false)". - "\n\t\$this->getLoader()->loadPlugin('$plugin');\n"; - break; - case Core::SMARTY_BLOCK: - $output .= "if (function_exists('smarty_block_$plugin')===false)". - "\n\t\$this->getLoader()->loadPlugin('$plugin');\n"; - break; - case Core::PROXY_PLUGIN: - $output .= $this->getCore()->getPluginProxy()->getLoader($plugin); - break; - default: - throw new CompilationException($this, 'Type error for ' . $plugin . ' with type' . $type); - } - } - - foreach ($this->templatePlugins as $function => $attr) { - if (isset($attr['called']) && $attr['called'] === true && !isset($attr['checked'])) { - $this->resolveSubTemplateDependencies($function); - } - } - foreach ($this->templatePlugins as $function) { - if (isset($function['called']) && $function['called'] === true) { - $output .= $function['body'] . PHP_EOL; - } - } - - $output .= $compiled . "\n?>"; - - $output = preg_replace('/(?\s*)<\?xml#is', '$1', $output); - - // add another line break after PHP closing tags that have a line break following, - // as we do not know whether it's intended, and PHP will strip it otherwise - $output = preg_replace('/(?\n/', '$0' . "\n", $output); - - if ($this->debug) { - echo '=============================================================================================' . "\n"; - $lines = preg_split('{\r\n|\n|
}', $output); - array_shift($lines); - foreach ($lines as $i => $line) { - echo ($i + 1) . '. ' . $line . "\r\n"; - } - echo '=============================================================================================' . "\n"; - } - - $this->template = $this->dwoo = null; - $tpl = null; - - return $output; - } - - /** - * Checks what sub-templates are used in every sub-template so that we're sure they are all compiled. - * - * @param string $function the sub-template name - */ - protected function resolveSubTemplateDependencies($function) - { - if ($this->debug) { - echo 'Compiler::' . __FUNCTION__ . "\n"; - } - - $body = $this->templatePlugins[$function]['body']; - foreach ($this->templatePlugins as $func => $attr) { - if ($func !== $function && !isset($attr['called']) && strpos($body, Core::NAMESPACE_PLUGINS_FUNCTIONS . - 'Plugin' . Core::toCamelCase($func)) !== false) { - $this->templatePlugins[$func]['called'] = true; - $this->resolveSubTemplateDependencies($func); - } - } - $this->templatePlugins[$function]['checked'] = true; - } - - /** - * Adds compiled content to the current block. - * - * @param string $content the content to push - * @param int $lineCount newlines count in content, optional - * - * @throws CompilationException - */ - public function push($content, $lineCount = null) - { - if ($lineCount === null) { - $lineCount = substr_count($content, "\n"); - } - - if ($this->curBlock['buffer'] === null && count($this->stack) > 1) { - // buffer is not initialized yet (the block has just been created) - $this->stack[count($this->stack) - 2]['buffer'] .= (string)$content; - $this->curBlock['buffer'] = ''; - } else { - if (!isset($this->curBlock['buffer'])) { - throw new CompilationException($this, 'The template has been closed too early, you probably have an extra block-closing tag somewhere'); - } - // append current content to current block's buffer - $this->curBlock['buffer'] .= (string)$content; - } - $this->line += $lineCount; - } - - /** - * Sets the scope. - * set to null if the scope becomes "unstable" (i.e. too variable or unknown) so that - * variables are compiled in a more evaluative way than just $this->scope['key'] - * - * @param mixed $scope a string i.e. "level1.level2" or an array i.e. array("level1", "level2") - * @param bool $absolute if true, the scope is set from the top level scope and not from the current scope - * - * @return array the current scope tree - */ - public function setScope($scope, $absolute = false) - { - $old = $this->scopeTree; - - if ($scope === null) { - unset($this->scope); - $this->scope = null; - } - - if (is_array($scope) === false) { - $scope = explode('.', $scope); - } - - if ($absolute === true) { - $this->scope = &$this->data; - $this->scopeTree = array(); - } - - while (($bit = array_shift($scope)) !== null) { - if ($bit === '_parent' || $bit === '_') { - array_pop($this->scopeTree); - reset($this->scopeTree); - $this->scope = &$this->data; - $cnt = count($this->scopeTree); - for ($i = 0; $i < $cnt; ++ $i) { - $this->scope = &$this->scope[$this->scopeTree[$i]]; - } - } elseif ($bit === '_root' || $bit === '__') { - $this->scope = &$this->data; - $this->scopeTree = array(); - } elseif (isset($this->scope[$bit])) { - $this->scope = &$this->scope[$bit]; - $this->scopeTree[] = $bit; - } else { - $this->scope[$bit] = array(); - $this->scope = &$this->scope[$bit]; - $this->scopeTree[] = $bit; - } - } - - return $old; - } - - /** - * Adds a block to the top of the block stack. - * - * @param string $type block type (name) - * @param array $params the parameters array - * @param int $paramtype the parameters type (see mapParams), 0, 1 or 2 - * - * @return string the preProcessing() method's output - */ - public function addBlock($type, array $params, $paramtype) - { - if ($this->debug) { - echo 'Compiler::' . __FUNCTION__ . "\n"; - } - - $class = Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($type); - if (class_exists($class) === false) { - $this->getCore()->getLoader()->loadPlugin($type); - } - $params = $this->mapParams($params, array($class, 'init'), $paramtype); - - $this->stack[] = array( - 'type' => $type, - 'params' => $params, - 'custom' => false, - 'class' => $class, - 'buffer' => null - ); - $this->curBlock = &$this->stack[count($this->stack) - 1]; - - return call_user_func(array($class, 'preProcessing'), $this, $params, '', '', $type); - } - - /** - * Adds a custom block to the top of the block stack. - * - * @param string $type block type (name) - * @param array $params the parameters array - * @param int $paramtype the parameters type (see mapParams), 0, 1 or 2 - * - * @return string the preProcessing() method's output - */ - public function addCustomBlock($type, array $params, $paramtype) - { - $callback = $this->customPlugins[$type]['callback']; - if (is_array($callback)) { - $class = is_object($callback[0]) ? get_class($callback[0]) : $callback[0]; - } else { - $class = $callback; - } - - $params = $this->mapParams($params, array($class, 'init'), $paramtype); - - $this->stack[] = array( - 'type' => $type, - 'params' => $params, - 'custom' => true, - 'class' => $class, - 'buffer' => null - ); - $this->curBlock = &$this->stack[count($this->stack) - 1]; - - return call_user_func(array($class, 'preProcessing'), $this, $params, '', '', $type); - } - - /** - * Injects a block at the top of the plugin stack without calling its preProcessing method. - * used by {else} blocks to re-add themselves after having closed everything up to their parent - * - * @param string $type block type (name) - * @param array $params parameters array - */ - public function injectBlock($type, array $params) - { - if ($this->debug) { - echo 'Compiler::' . __FUNCTION__ . "\n"; - } - - $class = Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($type); - if (class_exists($class) === false) { - $this->getCore()->getLoader()->loadPlugin($type); - } - $this->stack[] = array( - 'type' => $type, - 'params' => $params, - 'custom' => false, - 'class' => $class, - 'buffer' => null - ); - $this->curBlock = &$this->stack[count($this->stack) - 1]; - } - - /** - * Removes the closest-to-top block of the given type and all other - * blocks encountered while going down the block stack. - * - * @param string $type block type (name) - * - * @return string the output of all postProcessing() method's return values of the closed blocks - * @throws CompilationException - */ - public function removeBlock($type) - { - if ($this->debug) { - echo 'Compiler::' . __FUNCTION__ . "\n"; - } - - $output = ''; - - $pluginType = $this->getPluginType($type); - if ($pluginType & Core::SMARTY_BLOCK) { - $type = 'Smartyinterface'; - } - while (true) { - while ($top = array_pop($this->stack)) { - if ($top['custom']) { - $class = $top['class']; - } else { - $class = Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($top['type']); - } - if (count($this->stack)) { - $this->curBlock = &$this->stack[count($this->stack) - 1]; - $this->push(call_user_func(array( - $class, - 'postProcessing' - ), $this, $top['params'], '', '', $top['buffer']), 0); - } else { - $null = null; - $this->curBlock = &$null; - $output = call_user_func( - array( - $class, - 'postProcessing' - ), $this, $top['params'], '', '', $top['buffer'] - ); - } - - if ($top['type'] === $type) { - break 2; - } - } - - throw new CompilationException($this, 'Syntax malformation, a block of type "' . $type . '" was closed but was not opened'); - } - - return $output; - } - - /** - * Returns a reference to the first block of the given type encountered and - * optionally closes all blocks until it finds it - * this is mainly used by {else} plugins to close everything that was opened - * between their parent and themselves. - * - * @param string $type the block type (name) - * @param bool $closeAlong whether to close all blocks encountered while going down the block stack or not - * - * @return mixed &array the array is as such: array('type'=>pluginName, 'params'=>parameter array, - * 'custom'=>bool defining whether it's a custom plugin or not, for internal use) - * @throws CompilationException - */ - public function &findBlock($type, $closeAlong = false) - { - if ($closeAlong === true) { - while ($b = end($this->stack)) { - if ($b['type'] === $type) { - return $this->stack[key($this->stack)]; - } - $this->push($this->removeTopBlock(), 0); - } - } else { - end($this->stack); - while ($b = current($this->stack)) { - if ($b['type'] === $type) { - return $this->stack[key($this->stack)]; - } - prev($this->stack); - } - } - - throw new CompilationException($this, 'A parent block of type "' . $type . '" is required and can not be found'); - } - - /** - * Returns a reference to the current block array. - * - * @return array the array is as such: array('type'=>pluginName, 'params'=>parameter array, - * 'custom'=>bool defining whether it's a custom plugin or not, for internal use) - */ - public function &getCurrentBlock() - { - return $this->curBlock; - } - - /** - * Removes the block at the top of the stack and calls its postProcessing() method. - * - * @return string the postProcessing() method's output - * @throws CompilationException - */ - public function removeTopBlock() - { - if ($this->debug) { - echo 'Compiler::' . __FUNCTION__ . "\n"; - } - - $o = array_pop($this->stack); - if ($o === null) { - throw new CompilationException($this, 'Syntax malformation, a block of unknown type was closed but was not opened.'); - } - if ($o['custom']) { - $class = $o['class']; - } else { - $class = Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($o['type']); - } - - $this->curBlock = &$this->stack[count($this->stack) - 1]; - - return call_user_func(array($class, 'postProcessing'), $this, $o['params'], '', '', $o['buffer']); - } - - /** - * Returns the compiled parameters (for example a variable's compiled parameter will be "$this->scope['key']") out - * of the given parameter array. - * - * @param array $params parameter array - * - * @return array filtered parameters - */ - public function getCompiledParams(array $params) - { - foreach ($params as $k => $p) { - if (is_array($p)) { - $params[$k] = $p[0]; - } - } - - return $params; - } - - /** - * Returns the real parameters (for example a variable's real parameter will be its key, etc) out of the given - * parameter array. - * - * @param array $params parameter array - * - * @return array filtered parameters - */ - public function getRealParams(array $params) - { - foreach ($params as $k => $p) { - if (is_array($p)) { - $params[$k] = $p[1]; - } - } - - return $params; - } - - /** - * Returns the token of each parameter out of the given parameter array. - * - * @param array $params parameter array - * - * @return array tokens - */ - public function getParamTokens(array $params) - { - foreach ($params as $k => $p) { - if (is_array($p)) { - $params[$k] = isset($p[2]) ? $p[2] : 0; - } - } - - return $params; - } - - /** - * Entry point of the parser, it redirects calls to other parse* functions. - * - * @param string $in the string within which we must parse something - * @param int $from the starting offset of the parsed area - * @param int $to the ending offset of the parsed area - * @param mixed $parsingParams must be an array if we are parsing a function or modifier's parameters, or false by - * default - * @param string $curBlock the current parser-block being processed - * @param mixed $pointer a reference to a pointer that will be increased by the amount of characters parsed, - * or null by default - * - * @return string parsed values - * @throws CompilationException - */ - protected function parse($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null) - { - if ($this->debug) { - echo 'Compiler::' . __FUNCTION__ . "\n"; - } - - if ($to === null) { - $to = strlen($in); - } - $first = substr($in, $from, 1); - - if ($first === false) { - throw new CompilationException($this, 'Unexpected EOF, a template tag was not closed'); - } - - while ($first === ' ' || $first === "\n" || $first === "\t" || $first === "\r") { - if ($curBlock === 'root' && substr($in, $from, strlen($this->rd)) === $this->rd) { - // end template tag - $pointer += strlen($this->rd); - if ($this->debug) { - echo 'TEMPLATE PARSING ENDED' . "\n"; - } - - return false; - } - ++ $from; - if ($pointer !== null) { - ++ $pointer; - } - if ($from >= $to) { - if (is_array($parsingParams)) { - return $parsingParams; - } else { - return ''; - } - } - $first = $in[$from]; - } - - $substr = substr($in, $from, $to - $from); - - if ($this->debug) { - echo 'PARSE CALL : PARSING "' . htmlentities(substr($in, $from, min($to - $from, 50))) . (($to - $from) > 50 ? '...' : '') . '" @ ' . $from . ':' . $to . ' in ' . $curBlock . ' : pointer=' . $pointer . "\n"; - } - $parsed = ''; - - if ($curBlock === 'root' && $first === '*') { - $src = $this->getTemplateSource(); - $startpos = $this->getPointer() - strlen($this->ld); - if (substr($src, $startpos, strlen($this->ld)) === $this->ld) { - if ($startpos > 0) { - do { - $char = substr($src, -- $startpos, 1); - if ($char == "\n") { - ++ $startpos; - $whitespaceStart = true; - break; - } - } - while ($startpos > 0 && ($char == ' ' || $char == "\t")); - } - - if (!isset($whitespaceStart)) { - $startpos = $this->getPointer(); - } else { - $pointer -= $this->getPointer() - $startpos; - } - - if ($this->allowNestedComments && strpos($src, $this->ld . '*', $this->getPointer()) !== false) { - $comOpen = $this->ld . '*'; - $comClose = '*' . $this->rd; - $level = 1; - $ptr = $this->getPointer(); - - while ($level > 0 && $ptr < strlen($src)) { - $open = strpos($src, $comOpen, $ptr); - $close = strpos($src, $comClose, $ptr); - - if ($open !== false && $close !== false) { - if ($open < $close) { - $ptr = $open + strlen($comOpen); - ++ $level; - } else { - $ptr = $close + strlen($comClose); - -- $level; - } - } elseif ($open !== false) { - $ptr = $open + strlen($comOpen); - ++ $level; - } elseif ($close !== false) { - $ptr = $close + strlen($comClose); - -- $level; - } else { - $ptr = strlen($src); - } - } - $endpos = $ptr - strlen('*' . $this->rd); - } else { - $endpos = strpos($src, '*' . $this->rd, $startpos); - if ($endpos == false) { - throw new CompilationException($this, 'Un-ended comment'); - } - } - $pointer += $endpos - $startpos + strlen('*' . $this->rd); - if (isset($whitespaceStart) && preg_match('#^[\t ]*\r?\n#', substr($src, $endpos + strlen('*' . $this->rd)), $m)) { - $pointer += strlen($m[0]); - $this->curBlock['buffer'] = substr($this->curBlock['buffer'], 0, strlen($this->curBlock['buffer']) - ($this->getPointer() - $startpos - strlen($this->ld))); - } - - return false; - } - } - - if ($first === '$') { - // var - $out = $this->parseVar($in, $from, $to, $parsingParams, $curBlock, $pointer); - $parsed = 'var'; - } elseif ($first === '%' && preg_match('#^%[a-z_\\\\]#i', $substr)) { - // Short constant - $out = $this->parseConst($in, $from, $to, $parsingParams, $curBlock, $pointer); - } elseif (($first === '"' || $first === "'") && !(is_array($parsingParams) && preg_match('#^([\'"])[a-z0-9_]+\1\s*=>?(?:\s+|[^=])#i', $substr))) { - // string - $out = $this->parseString($in, $from, $to, $parsingParams, $curBlock, $pointer); - } elseif (preg_match('/^\\\\?[a-z_](?:\\\\?[a-z0-9_]+)*(?:::[a-z_][a-z0-9_]*)?(' . (is_array($parsingParams) || $curBlock != 'root' ? '' : '\s+[^(]|') . '\s*\(|\s*' . $this->rdr . '|\s*;)/i', $substr)) { - // func - $out = $this->parseFunction($in, $from, $to, $parsingParams, $curBlock, $pointer); - $parsed = 'func'; - } elseif ($first === ';') { - // instruction end - if ($this->debug) { - echo 'END OF INSTRUCTION' . "\n"; - } - if ($pointer !== null) { - ++ $pointer; - } - - return $this->parse($in, $from + 1, $to, false, 'root', $pointer); - } elseif ($curBlock === 'root' && preg_match('#^/([a-z_][a-z0-9_]*)?#i', $substr, $match)) { - // close block - if (!empty($match[1]) && $match[1] == 'else') { - throw new CompilationException($this, 'Else blocks must not be closed explicitly, they are automatically closed when their parent block is closed'); - } - if (!empty($match[1]) && $match[1] == 'elseif') { - throw new CompilationException($this, 'Elseif blocks must not be closed explicitly, they are automatically closed when their parent block is closed or a new else/elseif block is declared after them'); - } - if ($pointer !== null) { - $pointer += strlen($match[0]); - } - if (empty($match[1])) { - if ($this->curBlock['type'] == 'else' || $this->curBlock['type'] == 'elseif') { - $pointer -= strlen($match[0]); - } - if ($this->debug) { - echo 'TOP BLOCK CLOSED' . "\n"; - } - - return $this->removeTopBlock(); - } else { - if ($this->debug) { - echo 'BLOCK OF TYPE ' . $match[1] . ' CLOSED' . "\n"; - } - - return $this->removeBlock($match[1]); - } - } elseif ($curBlock === 'root' && substr($substr, 0, strlen($this->rd)) === $this->rd) { - // end template tag - if ($this->debug) { - echo 'TAG PARSING ENDED' . "\n"; - } - $pointer += strlen($this->rd); - - return false; - } elseif (is_array($parsingParams) && preg_match('#^(([\'"]?)[a-z0-9_]+\2\s*=' . ($curBlock === 'array' ? '>?' : '') . ')(?:\s+|[^=]).*#i', $substr, $match)) { - // named parameter - if ($this->debug) { - echo 'NAMED PARAM FOUND' . "\n"; - } - $len = strlen($match[1]); - while (substr($in, $from + $len, 1) === ' ') { - ++ $len; - } - if ($pointer !== null) { - $pointer += $len; - } - - $output = array( - trim($match[1], " \t\r\n=>'\""), - $this->parse($in, $from + $len, $to, false, 'namedparam', $pointer) - ); - - $parsingParams[] = $output; - - return $parsingParams; - } elseif (preg_match('#^(\\\\?[a-z_](?:\\\\?[a-z0-9_]+)*::\$[a-z0-9_]+)#i', $substr, $match)) { - // static member access - $parsed = 'var'; - if (is_array($parsingParams)) { - $parsingParams[] = array($match[1], $match[1]); - $out = $parsingParams; - } else { - $out = $match[1]; - } - $pointer += strlen($match[1]); - } elseif ($substr !== '' && (is_array($parsingParams) || $curBlock === 'namedparam' || $curBlock === 'condition' || $curBlock === 'expression')) { - // unquoted string, bool or number - $out = $this->parseOthers($in, $from, $to, $parsingParams, $curBlock, $pointer); - } else { - // parse error - throw new CompilationException($this, 'Parse error in "' . substr($in, $from, $to - $from) . '"'); - } - - if (empty($out)) { - return ''; - } - - $substr = substr($in, $pointer, $to - $pointer); - - // var parsed, check if any var-extension applies - if ($parsed === 'var') { - if (preg_match('#^\s*([/%+*-])\s*([a-z0-9]|\$)#i', $substr, $match)) { - if ($this->debug) { - echo 'PARSING POST-VAR EXPRESSION ' . $substr . "\n"; - } - // parse expressions - $pointer += strlen($match[0]) - 1; - if (is_array($parsingParams)) { - if ($match[2] == '$') { - $expr = $this->parseVar($in, $pointer, $to, array(), $curBlock, $pointer); - } else { - $expr = $this->parse($in, $pointer, $to, array(), 'expression', $pointer); - } - $out[count($out) - 1][0] .= $match[1] . $expr[0][0]; - $out[count($out) - 1][1] .= $match[1] . $expr[0][1]; - } else { - if ($match[2] == '$') { - $expr = $this->parseVar($in, $pointer, $to, false, $curBlock, $pointer); - } else { - $expr = $this->parse($in, $pointer, $to, false, 'expression', $pointer); - } - if (is_array($out) && is_array($expr)) { - $out[0] .= $match[1] . $expr[0]; - $out[1] .= $match[1] . $expr[1]; - } elseif (is_array($out)) { - $out[0] .= $match[1] . $expr; - $out[1] .= $match[1] . $expr; - } elseif (is_array($expr)) { - $out .= $match[1] . $expr[0]; - } else { - $out .= $match[1] . $expr; - } - } - } elseif ($curBlock === 'root' && preg_match('#^(\s*(?:[+/*%-.]=|=|\+\+|--)\s*)(.*)#s', $substr, $match)) { - if ($this->debug) { - echo 'PARSING POST-VAR ASSIGNMENT ' . $substr . "\n"; - } - // parse assignment - $value = $match[2]; - $operator = trim($match[1]); - if (substr($value, 0, 1) == '=') { - throw new CompilationException($this, 'Unexpected "=" in ' . $substr . ''); - } - - if ($pointer !== null) { - $pointer += strlen($match[1]); - } - - if ($operator !== '++' && $operator !== '--') { - $parts = array(); - $ptr = 0; - $parts = $this->parse($value, 0, strlen($value), $parts, 'condition', $ptr); - $pointer += $ptr; - - // load if plugin - try { - $this->getPluginType('if'); - } - catch (Exception $e) { - throw new CompilationException($this, 'Assignments require the "if" plugin to be accessible'); - } - - $parts = $this->mapParams($parts, array(Core::NAMESPACE_PLUGINS_BLOCKS . 'PluginIf', 'init'), 1); - $tokens = $this->getParamTokens($parts); - $parts = $this->getCompiledParams($parts); - - $value = PluginIf::replaceKeywords($parts['*'], $tokens['*'], $this); - $echo = ''; - } else { - $value = array(); - $echo = 'echo '; - } - - if ($this->autoEscape) { - $out = preg_replace('#\(is_string\(\$tmp=(.+?)\) \? htmlspecialchars\(\$tmp, ENT_QUOTES, \$this->charset\) : \$tmp\)#', '$1', $out); - } - $out = self::PHP_OPEN . $echo . $out . $operator . implode(' ', $value) . self::PHP_CLOSE; - } elseif ($curBlock === 'array' && is_array($parsingParams) && preg_match('#^(\s*=>?\s*)#', $substr, $match)) { - // parse namedparam with var as name (only for array) - if ($this->debug) { - echo 'VARIABLE NAMED PARAM (FOR ARRAY) FOUND' . "\n"; - } - $len = strlen($match[1]); - $var = $out[count($out) - 1]; - $pointer += $len; - - $output = array($var[0], $this->parse($substr, $len, null, false, 'namedparam', $pointer)); - - $parsingParams[] = $output; - - return $parsingParams; - } - } - - if ($curBlock !== 'modifier' && ($parsed === 'func' || $parsed === 'var') && preg_match('#^(\|@?[a-z0-9_]+(:.*)?)+#i', $substr, $match)) { - // parse modifier on funcs or vars - $srcPointer = $pointer; - if (is_array($parsingParams)) { - $tmp = $this->replaceModifiers( - array( - null, - null, - $out[count($out) - 1][0], - $match[0] - ), $curBlock, $pointer - ); - $out[count($out) - 1][0] = $tmp; - $out[count($out) - 1][1] .= substr($substr, $srcPointer, $srcPointer - $pointer); - } else { - $out = $this->replaceModifiers(array(null, null, $out, $match[0]), $curBlock, $pointer); - } - } - - // func parsed, check if any func-extension applies - if ($parsed === 'func' && preg_match('#^->[a-z0-9_]+(\s*\(.+|->[a-z_].*)?#is', $substr, $match)) { - // parse method call or property read - $ptr = 0; - - if (is_array($parsingParams)) { - $output = $this->parseMethodCall($out[count($out) - 1][1], $match[0], $curBlock, $ptr); - - $out[count($out) - 1][0] = $output; - $out[count($out) - 1][1] .= substr($match[0], 0, $ptr); - } else { - $out = $this->parseMethodCall($out, $match[0], $curBlock, $ptr); - } - - $pointer += $ptr; - } - - if ($curBlock === 'root' && substr($out, 0, strlen(self::PHP_OPEN)) !== self::PHP_OPEN) { - return self::PHP_OPEN . 'echo ' . $out . ';' . self::PHP_CLOSE; - } - - return $out; - } - - /** - * Parses a function call. - * - * @param string $in the string within which we must parse something - * @param int $from the starting offset of the parsed area - * @param int $to the ending offset of the parsed area - * @param mixed $parsingParams must be an array if we are parsing a function or modifier's parameters, or false by - * default - * @param string $curBlock the current parser-block being processed - * @param mixed $pointer a reference to a pointer that will be increased by the amount of characters parsed, - * or null by default - * - * @return string parsed values - * @throws CompilationException - * @throws Exception - * @throws SecurityException - */ - protected function parseFunction($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null) - { - $output = ''; - $cmdstr = substr($in, $from, $to - $from); - preg_match('/^(\\\\?[a-z_](?:\\\\?[a-z0-9_]+)*(?:::[a-z_][a-z0-9_]*)?)(\s*' . $this->rdr . '|\s*;)?/i', $cmdstr, $match); - - if (empty($match[1])) { - throw new CompilationException($this, 'Parse error, invalid function name : ' . substr($cmdstr, 0, 15)); - } - - $func = $match[1]; - - if (!empty($match[2])) { - $cmdstr = $match[1]; - } - - if ($this->debug) { - echo 'FUNC FOUND (' . $func . ')' . "\n"; - } - - $paramsep = ''; - - if (is_array($parsingParams) || $curBlock != 'root') { - $paramspos = strpos($cmdstr, '('); - $paramsep = ')'; - } elseif (preg_match_all('#^\s*[\\\\:a-z0-9_]+(\s*\(|\s+[^(])#i', $cmdstr, $match, PREG_OFFSET_CAPTURE)) { - $paramspos = $match[1][0][1]; - $paramsep = substr($match[1][0][0], - 1) === '(' ? ')' : ''; - if ($paramsep === ')') { - $paramspos += strlen($match[1][0][0]) - 1; - if (substr($cmdstr, 0, 2) === 'if' || substr($cmdstr, 0, 6) === 'elseif') { - $paramsep = ''; - if (strlen($match[1][0][0]) > 1) { - -- $paramspos; - } - } - } - } else { - $paramspos = false; - } - - $state = 0; - - if ($paramspos === false) { - $params = array(); - - if ($curBlock !== 'root') { - return $this->parseOthers($in, $from, $to, $parsingParams, $curBlock, $pointer); - } - } else { - if ($curBlock === 'condition') { - // load if plugin - $this->getPluginType('if'); - - if (PluginIf::replaceKeywords(array($func), array(self::T_UNQUOTED_STRING), $this) !== array($func)) { - return $this->parseOthers($in, $from, $to, $parsingParams, $curBlock, $pointer); - } - } - $whitespace = strlen(substr($cmdstr, strlen($func), $paramspos - strlen($func))); - $paramstr = substr($cmdstr, $paramspos + 1); - if (substr($paramstr, - 1, 1) === $paramsep) { - $paramstr = substr($paramstr, 0, - 1); - } - - if (strlen($paramstr) === 0) { - $params = array(); - $paramstr = ''; - } else { - $ptr = 0; - $params = array(); - if ($func === 'empty') { - $params = $this->parseVar($paramstr, $ptr, strlen($paramstr), $params, 'root', $ptr); - } else { - while ($ptr < strlen($paramstr)) { - while (true) { - if ($ptr >= strlen($paramstr)) { - break 2; - } - - if ($func !== 'if' && $func !== 'elseif' && $paramstr[$ptr] === ')') { - if ($this->debug) { - echo 'PARAM PARSING ENDED, ")" FOUND, POINTER AT ' . $ptr . "\n"; - } - break 2; - } elseif ($paramstr[$ptr] === ';') { - ++ $ptr; - if ($this->debug) { - echo 'PARAM PARSING ENDED, ";" FOUND, POINTER AT ' . $ptr . "\n"; - } - break 2; - } elseif ($func !== 'if' && $func !== 'elseif' && $paramstr[$ptr] === '/') { - if ($this->debug) { - echo 'PARAM PARSING ENDED, "/" FOUND, POINTER AT ' . $ptr . "\n"; - } - break 2; - } elseif (substr($paramstr, $ptr, strlen($this->rd)) === $this->rd) { - if ($this->debug) { - echo 'PARAM PARSING ENDED, RIGHT DELIMITER FOUND, POINTER AT ' . $ptr . "\n"; - } - break 2; - } - - if ($paramstr[$ptr] === ' ' || $paramstr[$ptr] === ',' || $paramstr[$ptr] === "\r" || $paramstr[$ptr] === "\n" || $paramstr[$ptr] === "\t") { - ++ $ptr; - } else { - break; - } - } - - if ($this->debug) { - echo 'FUNC START PARAM PARSING WITH POINTER AT ' . $ptr . "\n"; - } - - if ($func === 'if' || $func === 'elseif' || $func === 'tif') { - $params = $this->parse($paramstr, $ptr, strlen($paramstr), $params, 'condition', $ptr); - } elseif ($func === 'array') { - $params = $this->parse($paramstr, $ptr, strlen($paramstr), $params, 'array', $ptr); - } else { - $params = $this->parse($paramstr, $ptr, strlen($paramstr), $params, 'function', $ptr); - } - - if ($this->debug) { - echo 'PARAM PARSED, POINTER AT ' . $ptr . ' (' . substr($paramstr, $ptr - 1, 3) . ')' . "\n"; - } - } - } - $paramstr = substr($paramstr, 0, $ptr); - $state = 0; - foreach ($params as $k => $p) { - if (is_array($p) && is_array($p[1])) { - $state |= 2; - } else { - if (($state & 2) && preg_match('#^(["\'])(.+?)\1$#', $p[0], $m) && $func !== 'array') { - $params[$k] = array($m[2], array('true', 'true')); - } else { - if ($state & 2 && $func !== 'array') { - throw new CompilationException($this, 'You can not use an unnamed parameter after a named one'); - } - $state |= 1; - } - } - } - } - } - - if ($pointer !== null) { - $pointer += (isset($paramstr) ? strlen($paramstr) : 0) + (')' === $paramsep ? 2 : ($paramspos === false ? 0 : 1)) + strlen($func) + (isset($whitespace) ? $whitespace : 0); - if ($this->debug) { - echo 'FUNC ADDS ' . ((isset($paramstr) ? strlen($paramstr) : 0) + (')' === $paramsep ? 2 : ($paramspos === false ? 0 : 1)) + strlen($func)) . ' TO POINTER' . "\n"; - } - } - - if ($curBlock === 'method' || $func === 'do' || strstr($func, '::') !== false) { - // handle static method calls with security policy - if (strstr($func, '::') !== false && $this->securityPolicy !== null && $this->securityPolicy->isMethodAllowed(explode('::', strtolower($func))) !== true) { - throw new SecurityException('Call to a disallowed php function : ' . $func); - } - $pluginType = Core::NATIVE_PLUGIN; - } else { - $pluginType = $this->getPluginType($func); - } - - // Blocks plugin - if ($pluginType & Core::BLOCK_PLUGIN) { - if ($curBlock !== 'root' || is_array($parsingParams)) { - throw new CompilationException($this, 'Block plugins can not be used as other plugin\'s arguments'); - } - if ($pluginType & Core::CUSTOM_PLUGIN) { - return $this->addCustomBlock($func, $params, $state); - } else { - return $this->addBlock($func, $params, $state); - } - } elseif ($pluginType & Core::SMARTY_BLOCK) { - if ($curBlock !== 'root' || is_array($parsingParams)) { - throw new CompilationException($this, 'Block plugins can not be used as other plugin\'s arguments'); - } - - if ($state & 2) { - array_unshift($params, array('__functype', array($pluginType, $pluginType))); - array_unshift($params, array('__funcname', array($func, $func))); - } else { - array_unshift($params, array($pluginType, $pluginType)); - array_unshift($params, array($func, $func)); - } - - return $this->addBlock('smartyinterface', $params, $state); - } - - // Native & Smarty plugins - if ($pluginType & Core::NATIVE_PLUGIN || $pluginType & Core::SMARTY_FUNCTION || $pluginType & Core::SMARTY_BLOCK) { - $params = $this->mapParams($params, null, $state); - } // PHP class plugin - elseif ($pluginType & Core::CLASS_PLUGIN) { - if ($pluginType & Core::CUSTOM_PLUGIN) { - $params = $this->mapParams( - $params, array( - $this->customPlugins[$func]['class'], - $this->customPlugins[$func]['function'] - ), $state); - } else { - if (class_exists('Plugin' . Core::toCamelCase($func)) !== false) { - $params = $this->mapParams($params, array( - 'Plugin' . Core::toCamelCase($func), - ($pluginType & Core::COMPILABLE_PLUGIN) ? 'compile' : 'process' - ), $state); - } elseif (class_exists(Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func)) !== false) { - $params = $this->mapParams($params, array( - Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func), - ($pluginType & Core::COMPILABLE_PLUGIN) ? 'compile' : 'process' - ), $state); - } else { - $params = $this->mapParams($params, array( - Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func), - ($pluginType & Core::COMPILABLE_PLUGIN) ? 'compile' : 'process' - ), $state); - } - } - } // PHP function plugin - elseif ($pluginType & Core::FUNC_PLUGIN) { - if ($pluginType & Core::CUSTOM_PLUGIN) { - $params = $this->mapParams($params, $this->customPlugins[$func]['callback'], $state); - } else { - // Custom plugin - if (function_exists('Plugin' . Core::toCamelCase($func) . (($pluginType & Core::COMPILABLE_PLUGIN) ? - 'Compile' : '')) !== false) { - $params = $this->mapParams($params, 'Plugin' . Core::toCamelCase($func) . (($pluginType & - Core::COMPILABLE_PLUGIN) ? 'Compile' : ''), $state); - } // Builtin helper plugin - elseif (function_exists(Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func) . ( - ($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : '')) !== false) { - $params = $this->mapParams($params, Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase - ($func) . (($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : ''), $state); - } // Builtin function plugin - else { - $params = $this->mapParams($params, Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase - ($func) . (($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : ''), $state); - } - } - } // Smarty modifier - elseif ($pluginType & Core::SMARTY_MODIFIER) { - $output = 'smarty_modifier_' . $func . '(' . implode(', ', $params) . ')'; - } // Proxy plugin - elseif ($pluginType & Core::PROXY_PLUGIN) { - $params = $this->mapParams($params, $this->getCore()->getPluginProxy()->getCallback($func), $state); - } // Template plugin - elseif ($pluginType & Core::TEMPLATE_PLUGIN) { - // transforms the parameter array from (x=>array('paramname'=>array(values))) to (paramname=>array(values)) - $map = array(); - foreach ($this->templatePlugins[$func]['params'] as $param => $defValue) { - if ($param == 'rest') { - $param = '*'; - } - $hasDefault = $defValue !== null; - if ($defValue === 'null') { - $defValue = null; - } elseif ($defValue === 'false') { - $defValue = false; - } elseif ($defValue === 'true') { - $defValue = true; - } elseif (preg_match('#^([\'"]).*?\1$#', $defValue)) { - $defValue = substr($defValue, 1, - 1); - } - $map[] = array($param, $hasDefault, $defValue); - } - - $params = $this->mapParams($params, null, $state, $map); - } - - // only keep php-syntax-safe values for non-block plugins - $tokens = array(); - foreach ($params as $k => $p) { - $tokens[$k] = isset($p[2]) ? $p[2] : 0; - $params[$k] = $p[0]; - } - - // Native plugin - if ($pluginType & Core::NATIVE_PLUGIN) { - if ($func === 'do') { - $output = ''; - if (isset($params['*'])) { - $output = implode(';', $params['*']) . ';'; - } - - if (is_array($parsingParams) || $curBlock !== 'root') { - throw new CompilationException($this, 'Do can not be used inside another function or block'); - } - - return self::PHP_OPEN . $output . self::PHP_CLOSE; - } else { - if (isset($params['*'])) { - $output = $func . '(' . implode(', ', $params['*']) . ')'; - } else { - $output = $func . '()'; - } - } - } // Block class OR Function class - elseif ($pluginType & Core::CLASS_PLUGIN || ($pluginType & Core::FUNC_PLUGIN && $pluginType & Core::CLASS_PLUGIN)) { - if ($pluginType & Core::COMPILABLE_PLUGIN) { - if ($pluginType & Core::CUSTOM_PLUGIN) { - $callback = $this->customPlugins[$func]['callback']; - if (!is_array($callback)) { - if (!method_exists($callback, 'compile')) { - throw new Exception('Custom plugin ' . $func . ' must implement the "compile" method to be compilable, or you should provide a full callback to the method to use'); - } - if (($ref = new ReflectionMethod($callback, 'compile')) && $ref->isStatic()) { - $funcCompiler = array($callback, 'compile'); - } else { - $funcCompiler = array(new $callback(), 'compile'); - } - } else { - $funcCompiler = $callback; - } - } else { - if (class_exists('Plugin' . Core::toCamelCase($func)) !== false) { - $funcCompiler = array('Plugin' . Core::toCamelCase($func), 'compile'); - } elseif (class_exists(Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func)) !== false) { - $funcCompiler = array(Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func), 'compile'); - } else { - $funcCompiler = array( - Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func), - 'compile' - ); - } - array_unshift($params, $this); - } - // @TODO: Is it a real fix ? - if ($func === 'tif') { - $params[] = $tokens; - } - $output = call_user_func_array($funcCompiler, $params); - } else { - $params = self::implode_r($params); - if ($pluginType & Core::CUSTOM_PLUGIN) { - $callback = $this->customPlugins[$func]['callback']; - if (!is_array($callback)) { - if (!method_exists($callback, 'process')) { - throw new Exception('Custom plugin ' . $func . ' must implement the "process" method to be usable, or you should provide a full callback to the method to use'); - } - if (is_object($callback)) { - $callback = get_class($callback); - } - if (($ref = new ReflectionMethod($callback, 'process')) && $ref->isStatic()) { - $output = 'call_user_func(array(\'' . $callback . '\', \'process\'), ' . $params . ')'; - } else { - $output = 'call_user_func(array($this->getObjectPlugin(\'' . $callback . '\'), \'process\'), ' . $params . ')'; - } - } elseif (is_object($callback[0])) { - $output = 'call_user_func(array($this->plugins[\'' . $func . '\'][\'callback\'][0], \'' . $callback[1] . '\'), ' . $params . ')'; - } elseif (($ref = new ReflectionMethod($callback[0], $callback[1])) && $ref->isStatic()) { - $output = 'call_user_func(array(\'' . $callback[0] . '\', \'' . $callback[1] . '\'), ' . $params . ')'; - } else { - $output = 'call_user_func(array($this->getObjectPlugin(\'' . $callback[0] . '\'), \'' . $callback[1] . '\'), ' . $params . ')'; - } - if (empty($params)) { - $output = substr($output, 0, - 3) . ')'; - } - } else { - if (class_exists('Plugin' . Core::toCamelCase($func)) !== false) { - $output = '$this->classCall(\'Plugin' . $func . '\', array(' . $params . '))'; - } elseif (class_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func)) !== false) { - $output = '$this->classCall(\'' . Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . $func . '\', - array(' . $params . '))'; - } else { - $output = '$this->classCall(\'' . $func . '\', array(' . $params . '))'; - } - } - } - } // Function plugin only (cannot be a class) - elseif ($pluginType & Core::FUNC_PLUGIN) { - if ($pluginType & Core::COMPILABLE_PLUGIN) { - if ($pluginType & Core::CUSTOM_PLUGIN) { - $funcCompiler = $this->customPlugins[$func]['callback']; - } else { - // Custom plugin - if (function_exists('Plugin' . Core::toCamelCase($func) . 'Compile') !== false) { - $funcCompiler = 'Plugin' . Core::toCamelCase($func) . 'Compile'; - } // Builtin helper plugin - elseif (function_exists(Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func) . 'Compile') !== false) { - $funcCompiler = Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func) . - 'Compile'; - } // Builtin function plugin - else { - $funcCompiler = Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func) . - 'Compile'; - } - } - array_unshift($params, $this); - // @TODO: Is it a real fix ? - if ($func === 'tif') { - $params[] = $tokens; - } - $output = call_user_func_array($funcCompiler, $params); - } else { - array_unshift($params, '$this'); - $params = self::implode_r($params); - if ($pluginType & Core::CUSTOM_PLUGIN) { - $callback = $this->customPlugins[$func]['callback']; - if ($callback instanceof Closure) { - $output = 'call_user_func($this->getCustomPlugin(\'' . $func . '\'), ' . $params . ')'; - } else { - $output = 'call_user_func(\'' . $callback . '\', ' . $params . ')'; - } - } else { - // Custom plugin - if (function_exists('Plugin' . Core::toCamelCase($func)) !== false) { - $output = 'Plugin' . Core::toCamelCase($func) . '(' . $params . - ')'; - } // Builtin helper plugin - elseif(function_exists(Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func)) !== - false) { - $output = Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($func) . '(' . - $params . ')'; - } // Builtin function plugin - else { - $output = Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func) . '(' . - $params . ')'; - } - } - } - } // Proxy plugin - elseif ($pluginType & Core::PROXY_PLUGIN) { - $output = call_user_func(array($this->getCore()->getPluginProxy(), 'getCode'), $func, $params); - } // Smarty function (@deprecated) - elseif ($pluginType & Core::SMARTY_FUNCTION) { - $params = ''; - if (isset($params['*'])) { - $params = self::implode_r($params['*'], true); - } - - if ($pluginType & Core::CUSTOM_PLUGIN) { - $callback = $this->customPlugins[$func]['callback']; - if (is_array($callback)) { - if (is_object($callback[0])) { - $output = 'call_user_func_array(array($this->getCustomPlugin(\'' . $func . '\'), \'' . $callback[1] . '\'), array(array(' . $params . '), $this))'; - } else { - $output = 'call_user_func_array(array(\'' . $callback[0] . '\', \'' . $callback[1] . '\'), array(array(' . $params . '), $this))'; - } - } else { - $output = $callback . '(array(' . $params . '), $this)'; - } - } else { - $output = 'smarty_function_' . $func . '(array(' . $params . '), $this)'; - } - } // Template plugin - elseif ($pluginType & Core::TEMPLATE_PLUGIN) { - array_unshift($params, '$this'); - $params = self::implode_r($params); - $output = 'Plugin' . Core::toCamelCase($func) . - $this->templatePlugins[$func]['uuid'] . '(' . $params . ')'; - $this->templatePlugins[$func]['called'] = true; - } - - if (is_array($parsingParams)) { - $parsingParams[] = array($output, $output); - - return $parsingParams; - } elseif ($curBlock === 'namedparam') { - return array($output, $output); - } - - return $output; - } - - /** - * Parses a string. - * - * @param string $in the string within which we must parse something - * @param int $from the starting offset of the parsed area - * @param int $to the ending offset of the parsed area - * @param mixed $parsingParams must be an array if we are parsing a function or modifier's parameters, or false by - * default - * @param string $curBlock the current parser-block being processed - * @param mixed $pointer a reference to a pointer that will be increased by the amount of characters parsed, - * or null by default - * - * @return string parsed values - * @throws CompilationException - */ - protected function parseString($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null) - { - $substr = substr($in, $from, $to - $from); - $first = $substr[0]; - - if ($this->debug) { - echo 'STRING FOUND (in ' . htmlentities(substr($in, $from, min($to - $from, 50))) . (($to - $from) > 50 ? '...' : '') . ')' . "\n"; - } - $strend = false; - $o = $from + 1; - while ($strend === false) { - $strend = strpos($in, $first, $o); - if ($strend === false) { - throw new CompilationException($this, 'Unfinished string, started with ' . substr($in, $from, $to - $from)); - } - if (substr($in, $strend - 1, 1) === '\\') { - $o = $strend + 1; - $strend = false; - } - } - if ($this->debug) { - echo 'STRING DELIMITED: ' . substr($in, $from, $strend + 1 - $from) . "\n"; - } - - $srcOutput = substr($in, $from, $strend + 1 - $from); - - if ($pointer !== null) { - $pointer += strlen($srcOutput); - } - - $output = $this->replaceStringVars($srcOutput, $first); - - // handle modifiers - if ($curBlock !== 'modifier' && preg_match('#^((?:\|(?:@?[a-z0-9_]+(?::.*)*))+)#i', substr($substr, $strend + 1 - $from), $match)) { - $modstr = $match[1]; - - if ($curBlock === 'root' && substr($modstr, - 1) === '}') { - $modstr = substr($modstr, 0, - 1); - } - $modstr = str_replace('\\' . $first, $first, $modstr); - $ptr = 0; - $output = $this->replaceModifiers(array(null, null, $output, $modstr), 'string', $ptr); - - $strend += $ptr; - if ($pointer !== null) { - $pointer += $ptr; - } - $srcOutput .= substr($substr, $strend + 1 - $from, $ptr); - } - - if (is_array($parsingParams)) { - $parsingParams[] = array($output, substr($srcOutput, 1, - 1)); - - return $parsingParams; - } elseif ($curBlock === 'namedparam') { - return array($output, substr($srcOutput, 1, - 1)); - } - - return $output; - } - - /** - * Parses a constant. - * - * @param string $in the string within which we must parse something - * @param int $from the starting offset of the parsed area - * @param int $to the ending offset of the parsed area - * @param mixed $parsingParams must be an array if we are parsing a function or modifier's parameters, or false by - * default - * @param string $curBlock the current parser-block being processed - * @param mixed $pointer a reference to a pointer that will be increased by the amount of characters parsed, - * or null by default - * - * @return string parsed values - * @throws CompilationException - */ - protected function parseConst($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null) - { - $substr = substr($in, $from, $to - $from); - - if ($this->debug) { - echo 'CONST FOUND : ' . $substr . "\n"; - } - - if (!preg_match('#^%([\\\\a-z0-9_:]+)#i', $substr, $m)) { - throw new CompilationException($this, 'Invalid constant'); - } - - if ($pointer !== null) { - $pointer += strlen($m[0]); - } - - $output = $this->parseConstKey($m[1], $curBlock); - - if (is_array($parsingParams)) { - $parsingParams[] = array($output, $m[1]); - - return $parsingParams; - } elseif ($curBlock === 'namedparam') { - return array($output, $m[1]); - } - - return $output; - } - - /** - * Parses a constant. - * - * @param string $key the constant to parse - * @param string $curBlock the current parser-block being processed - * - * @return string parsed constant - */ - protected function parseConstKey($key, $curBlock) - { - $key = str_replace('\\\\', '\\', $key); - - if ($this->securityPolicy !== null && $this->securityPolicy->getConstantHandling() === SecurityPolicy::CONST_DISALLOW) { - return 'null'; - } - - if ($curBlock !== 'root') { - return '(defined("' . $key . '") ? ' . $key . ' : null)'; - } - - return $key; - } - - /** - * Parses a variable. - * - * @param string $in the string within which we must parse something - * @param int $from the starting offset of the parsed area - * @param int $to the ending offset of the parsed area - * @param mixed $parsingParams must be an array if we are parsing a function or modifier's parameters, or false by - * default - * @param string $curBlock the current parser-block being processed - * @param mixed $pointer a reference to a pointer that will be increased by the amount of characters parsed, - * or null by default - * - * @return string parsed values - * @throws CompilationException - */ - protected function parseVar($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null) - { - $substr = substr($in, $from, $to - $from); - - // var key - $varRegex = '(\\$?\\.?[a-z0-9\\\\_:]*(?:(?:(?:\\.|->)(?:[a-z0-9\\\\_:]+|(?R))|\\[(?:[a-z0-9\\\\_:]+|(?R)|(["\'])[^\\2]*?\\2)\\]))*)'; - // method call - $methodCall = ($curBlock === 'root' || $curBlock === 'function' || $curBlock === 'namedparam' || $curBlock === 'condition' || $curBlock === 'variable' || $curBlock === 'expression' || $curBlock === 'delimited_string' ? '(\(.*)?' : '()'); - // simple math expressions - $simpleMathExpressions = ($curBlock === 'root' || $curBlock === 'function' || $curBlock === 'namedparam' || $curBlock === 'condition' || $curBlock === 'variable' || $curBlock === 'delimited_string' ? '((?:(?:[+\/*%=-])(?:(?_:-]+(?:\([^)]*\))?|(?'))); - $key = substr($match[1], 1, strrpos($match[1], '->') - 1); - $methodCall = substr($match[1], strrpos($match[1], '->')) . $match[3]; - } - - if ($hasModifiers) { - $matchedLength -= strlen($match[5]); - } - - if ($pointer !== null) { - $pointer += $matchedLength; - } - - // replace useless brackets by dot accessed vars and strip enclosing quotes if present - $key = preg_replace('#\[(["\']?)([^$%\[.>-]+)\1\]#', '.$2', $key); - - if ($this->debug) { - if ($hasMethodCall) { - echo 'METHOD CALL FOUND : $' . $key . substr($methodCall, 0, 30) . "\n"; - } else { - echo 'VAR FOUND : $' . $key . "\n"; - } - } - - $key = str_replace('"', '\\"', $key); - - $cnt = substr_count($key, '$'); - if ($cnt > 0) { - $uid = 0; - $parsed = array($uid => ''); - $current = &$parsed; - $curTxt = &$parsed[$uid ++]; - $tree = array(); - $chars = str_split($key, 1); - $inSplittedVar = false; - $bracketCount = 0; - - while (($char = array_shift($chars)) !== null) { - if ($char === '[') { - if (count($tree) > 0) { - ++ $bracketCount; - } else { - $tree[] = &$current; - $current[$uid] = array($uid + 1 => ''); - $current = &$current[$uid ++]; - $curTxt = &$current[$uid ++]; - continue; - } - } elseif ($char === ']') { - if ($bracketCount > 0) { - -- $bracketCount; - } else { - $current = &$tree[count($tree) - 1]; - array_pop($tree); - if (current($chars) !== '[' && current($chars) !== false && current($chars) !== ']') { - $current[$uid] = ''; - $curTxt = &$current[$uid ++]; - } - continue; - } - } elseif ($char === '$') { - if (count($tree) == 0) { - $curTxt = &$current[$uid ++]; - $inSplittedVar = true; - } - } elseif (($char === '.' || $char === '-') && count($tree) == 0 && $inSplittedVar) { - $curTxt = &$current[$uid ++]; - $inSplittedVar = false; - } - - $curTxt .= $char; - } - unset($uid, $current, $curTxt, $tree, $chars); - - if ($this->debug) { - echo 'RECURSIVE VAR REPLACEMENT : ' . $key . "\n"; - } - - $key = $this->flattenVarTree($parsed); - - if ($this->debug) { - echo 'RECURSIVE VAR REPLACEMENT DONE : ' . $key . "\n"; - } - - $output = preg_replace('#(^""\.|""\.|\.""$|(\()""\.|\.""(\)))#', '$2$3', '$this->readVar("' . $key . '")'); - } else { - $output = $this->parseVarKey($key, $hasModifiers ? 'modifier' : $curBlock); - } - - - // methods - if ($hasMethodCall) { - $ptr = 0; - - $output = $this->parseMethodCall($output, $methodCall, $curBlock, $ptr); - - if ($pointer !== null) { - $pointer += $ptr; - } - $matchedLength += $ptr; - } - - if ($hasExpression) { - // expressions - preg_match_all('#(?:([+/*%=-])(=?-?[%$][a-z0-9\\\\.[\]>_:-]+(?:\([^)]*\))?|=?-?[0-9.,]+|\1))#i', $match[4], $expMatch); - foreach ($expMatch[1] as $k => $operator) { - if (substr($expMatch[2][$k], 0, 1) === '=') { - $assign = true; - if ($operator === '=') { - throw new CompilationException($this, 'Invalid expression ' . $substr . ', can not use "==" in expressions'); - } - if ($curBlock !== 'root') { - throw new CompilationException($this, 'Invalid expression ' . $substr . ', assignments can only be used in top level expressions like {$foo+=3} or {$foo="bar"}'); - } - $operator .= '='; - $expMatch[2][$k] = substr($expMatch[2][$k], 1); - } - - if (substr($expMatch[2][$k], 0, 1) === '-' && strlen($expMatch[2][$k]) > 1) { - $operator .= '-'; - $expMatch[2][$k] = substr($expMatch[2][$k], 1); - } - if (($operator === '+' || $operator === '-') && $expMatch[2][$k] === $operator) { - $output = '(' . $output . $operator . $operator . ')'; - break; - } elseif (substr($expMatch[2][$k], 0, 1) === '$') { - $output = '(' . $output . ' ' . $operator . ' ' . $this->parseVar($expMatch[2][$k], 0, strlen($expMatch[2][$k]), false, 'expression') . ')'; - } elseif (substr($expMatch[2][$k], 0, 1) === '%') { - $output = '(' . $output . ' ' . $operator . ' ' . $this->parseConst($expMatch[2][$k], 0, strlen($expMatch[2][$k]), false, 'expression') . ')'; - } elseif (!empty($expMatch[2][$k])) { - $output = '(' . $output . ' ' . $operator . ' ' . str_replace(',', '.', $expMatch[2][$k]) . ')'; - } else { - throw new CompilationException($this, 'Unfinished expression ' . $substr . ', missing var or number after math operator'); - } - } - } - - if ($this->autoEscape === true && $curBlock !== 'condition') { - $output = '(is_string($tmp=' . $output . ') ? htmlspecialchars($tmp, ENT_QUOTES, $this->charset) : $tmp)'; - } - - // handle modifiers - if ($curBlock !== 'modifier' && $hasModifiers) { - $ptr = 0; - $output = $this->replaceModifiers(array(null, null, $output, $match[5]), 'var', $ptr); - if ($pointer !== null) { - $pointer += $ptr; - } - $matchedLength += $ptr; - } - - if (is_array($parsingParams)) { - $parsingParams[] = array($output, $key); - - return $parsingParams; - } elseif ($curBlock === 'namedparam') { - return array($output, $key); - } elseif ($curBlock === 'string' || $curBlock === 'delimited_string') { - return array($matchedLength, $output); - } elseif ($curBlock === 'expression' || $curBlock === 'variable') { - return $output; - } elseif (isset($assign)) { - return self::PHP_OPEN . $output . ';' . self::PHP_CLOSE; - } - - return $output; - } else { - if ($curBlock === 'string' || $curBlock === 'delimited_string') { - return array(0, ''); - } - throw new CompilationException($this, 'Invalid variable name ' . $substr . ''); - } - } - - /** - * Parses any number of chained method calls/property reads. - * - * @param string $output the variable or whatever upon which the method are called - * @param string $methodCall method call source, starting at "->" - * @param string $curBlock the current parser-block being processed - * @param int $pointer a reference to a pointer that will be increased by the amount of characters parsed - * - * @return string parsed call(s)/read(s) - */ - protected function parseMethodCall($output, $methodCall, $curBlock, &$pointer) - { - $ptr = 0; - $len = strlen($methodCall); - - while ($ptr < $len) { - if (strpos($methodCall, '->', $ptr) === $ptr) { - $ptr += 2; - } - - if (in_array( - $methodCall[$ptr], array( - ';', - ',', - '/', - ' ', - "\t", - "\r", - "\n", - ')', - '+', - '*', - '%', - '=', - '-', - '|' - ) - ) || substr($methodCall, $ptr, strlen($this->rd)) === $this->rd - ) { - // break char found - break; - } - - if (!preg_match('/^([a-z0-9_]+)(\(.*?\))?/i', substr($methodCall, $ptr), $methMatch)) { - break; - } - - if (empty($methMatch[2])) { - // property - if ($curBlock === 'root') { - $output .= '->' . $methMatch[1]; - } else { - $output = '(($tmp = ' . $output . ') ? $tmp->' . $methMatch[1] . ' : null)'; - } - $ptr += strlen($methMatch[1]); - } else { - // method - if (substr($methMatch[2], 0, 2) === '()') { - $parsedCall = $methMatch[1] . '()'; - $ptr += strlen($methMatch[1]) + 2; - } else { - $parsedCall = $this->parseFunction($methodCall, $ptr, strlen($methodCall), false, 'method', $ptr); - } - if ($this->securityPolicy !== null) { - $argPos = strpos($parsedCall, '('); - $method = strtolower(substr($parsedCall, 0, $argPos)); - $args = substr($parsedCall, $argPos); - if ($curBlock === 'root') { - $output = '$this->getSecurityPolicy()->callMethod($this, ' . $output . ', ' . var_export($method, true) . ', array' . $args . ')'; - } else { - $output = '(($tmp = ' . $output . ') ? $this->getSecurityPolicy()->callMethod($this, $tmp, ' . var_export($method, true) . ', array' . $args . ') : null)'; - } - } else { - if ($curBlock === 'root') { - $output .= '->' . $parsedCall; - } else { - $output = '(($tmp = ' . $output . ') ? $tmp->' . $parsedCall . ' : null)'; - } - } - } - } - - $pointer += $ptr; - - return $output; - } - - /** - * Parses a constant variable (a variable that doesn't contain another variable) and preprocesses it to save - * runtime processing time. - * - * @param string $key the variable to parse - * @param string $curBlock the current parser-block being processed - * - * @return string parsed variable - */ - protected function parseVarKey($key, $curBlock) - { - if ($key === '') { - return '$this->scope'; - } - if (substr($key, 0, 1) === '.') { - $key = 'dwoo' . $key; - } - if (preg_match('#dwoo\.(get|post|server|cookies|session|env|request)((?:\.[a-z0-9_-]+)+)#i', $key, $m)) { - $global = strtoupper($m[1]); - if ($global === 'COOKIES') { - $global = 'COOKIE'; - } - $key = '$_' . $global; - foreach (explode('.', ltrim($m[2], '.')) as $part) { - $key .= '[' . var_export($part, true) . ']'; - } - if ($curBlock === 'root') { - $output = $key; - } else { - $output = '(isset(' . $key . ')?' . $key . ':null)'; - } - } elseif (preg_match('#dwoo\\.const\\.([a-z0-9\\\\_:]+)#i', $key, $m)) { - return $this->parseConstKey($m[1], $curBlock); - } elseif ($this->scope !== null) { - if (strstr($key, '.') === false && strstr($key, '[') === false && strstr($key, '->') === false) { - if ($key === 'dwoo') { - $output = '$this->globals'; - } elseif ($key === '_root' || $key === '__') { - $output = '$this->data'; - } elseif ($key === '_parent' || $key === '_') { - $output = '$this->readParentVar(1)'; - } elseif ($key === '_key') { - $output = '$tmp_key'; - } else { - if ($curBlock === 'root') { - $output = '$this->scope["' . $key . '"]'; - } else { - $output = '(isset($this->scope["' . $key . '"]) ? $this->scope["' . $key . '"] : null)'; - } - } - } else { - preg_match_all('#(\[|->|\.)?((?:[a-z0-9_]|-(?!>))+|(\\\?[\'"])[^\3]*?\3)\]?#i', $key, $m); - - $i = $m[2][0]; - if ($i === '_parent' || $i === '_') { - $parentCnt = 0; - - while (true) { - ++ $parentCnt; - array_shift($m[2]); - array_shift($m[1]); - if (current($m[2]) === '_parent') { - continue; - } - break; - } - - $output = '$this->readParentVar(' . $parentCnt . ')'; - } else { - if ($i === 'dwoo') { - $output = '$this->globals'; - array_shift($m[2]); - array_shift($m[1]); - } elseif ($i === '_root' || $i === '__') { - $output = '$this->data'; - array_shift($m[2]); - array_shift($m[1]); - } elseif ($i === '_key') { - $output = '$tmp_key'; - } else { - $output = '$this->scope'; - } - - while (count($m[1]) && $m[1][0] !== '->') { - $m[2][0] = preg_replace('/(^\\\([\'"])|\\\([\'"])$)/x', '$2$3', $m[2][0]); - if (substr($m[2][0], 0, 1) == '"' || substr($m[2][0], 0, 1) == "'") { - $output .= '[' . $m[2][0] . ']'; - } else { - $output .= '["' . $m[2][0] . '"]'; - } - array_shift($m[2]); - array_shift($m[1]); - } - - if ($curBlock !== 'root') { - $output = '(isset(' . $output . ') ? ' . $output . ':null)'; - } - } - - if (count($m[2])) { - unset($m[0]); - $output = '$this->readVarInto(' . str_replace("\n", '', var_export($m, true)) . ', ' . $output . ', ' . ($curBlock == 'root' ? 'false' : 'true') . ')'; - } - } - } else { - preg_match_all('#(\[|->|\.)?((?:[a-z0-9_]|-(?!>))+)\]?#i', $key, $m); - unset($m[0]); - $output = '$this->readVar(' . str_replace("\n", '', var_export($m, true)) . ')'; - } - - return $output; - } - - /** - * Flattens a variable tree, this helps in parsing very complex variables such as $var.foo[$foo.bar->baz].baz, - * it computes the contents of the brackets first and works out from there. - * - * @param array $tree the variable tree parsed by he parseVar() method that must be flattened - * @param bool $recursed leave that to false by default, it is only for internal use - * - * @return string flattened tree - */ - protected function flattenVarTree(array $tree, $recursed = false) - { - $out = $recursed ? '".$this->readVarInto(' : ''; - foreach ($tree as $bit) { - if (is_array($bit)) { - $out .= '.' . $this->flattenVarTree($bit, false); - } else { - $key = str_replace('"', '\\"', $bit); - - if (substr($key, 0, 1) === '$') { - $out .= '".' . $this->parseVar($key, 0, strlen($key), false, 'variable') . '."'; - } else { - $cnt = substr_count($key, '$'); - - if ($this->debug) { - echo 'PARSING SUBVARS IN : ' . $key . "\n"; - } - if ($cnt > 0) { - while (-- $cnt >= 0) { - if (isset($last)) { - $last = strrpos($key, '$', - (strlen($key) - $last + 1)); - } else { - $last = strrpos($key, '$'); - } - preg_match('#\$[a-z0-9_]+((?:(?:\.|->)(?:[a-z0-9_]+|(?R))|\[(?:[a-z0-9_]+|(?R))\]))*' . '((?:(?:[+/*%-])(?:\$[a-z0-9.[\]>_:-]+(?:\([^)]*\))?|[0-9.,]*))*)#i', substr($key, $last), $submatch); - - $len = strlen($submatch[0]); - $key = substr_replace( - $key, preg_replace_callback( - '#(\$[a-z0-9_]+((?:(?:\.|->)(?:[a-z0-9_]+|(?R))|\[(?:[a-z0-9_]+|(?R))\]))*)' . '((?:(?:[+/*%-])(?:\$[a-z0-9.[\]>_:-]+(?:\([^)]*\))?|[0-9.,]*))*)#i', array( - $this, - 'replaceVarKeyHelper' - ), substr($key, $last, $len) - ), $last, $len - ); - if ($this->debug) { - echo 'RECURSIVE VAR REPLACEMENT DONE : ' . $key . "\n"; - } - } - unset($last); - - $out .= $key; - } else { - $out .= $key; - } - } - } - } - $out .= $recursed ? ', true)."' : ''; - - return $out; - } - - /** - * Helper function that parses a variable. - * - * @param array $match the matched variable, array(1=>"string match") - * - * @return string parsed variable - */ - protected function replaceVarKeyHelper($match) - { - return '".' . $this->parseVar($match[0], 0, strlen($match[0]), false, 'variable') . '."'; - } - - /** - * Parses various constants, operators or non-quoted strings. - * - * @param string $in the string within which we must parse something - * @param int $from the starting offset of the parsed area - * @param int $to the ending offset of the parsed area - * @param mixed $parsingParams must be an array if we are parsing a function or modifier's parameters, or false by - * default - * @param string $curBlock the current parser-block being processed - * @param mixed $pointer a reference to a pointer that will be increased by the amount of characters parsed, - * or null by default - * - * @return string parsed values - * @throws Exception - */ - protected function parseOthers($in, $from, $to, $parsingParams = false, $curBlock = '', &$pointer = null) - { - $substr = substr($in, $from, $to - $from); - - $end = strlen($substr); - - if ($curBlock === 'condition') { - $breakChars = array( - '(', - ')', - ' ', - '||', - '&&', - '|', - '&', - '>=', - '<=', - '===', - '==', - '=', - '!==', - '!=', - '<<', - '<', - '>>', - '>', - '^', - '~', - ',', - '+', - '-', - '*', - '/', - '%', - '!', - '?', - ':', - $this->rd, - ';' - ); - } elseif ($curBlock === 'modifier') { - $breakChars = array(' ', ',', ')', ':', '|', "\r", "\n", "\t", ';', $this->rd); - } elseif ($curBlock === 'expression') { - $breakChars = array('/', '%', '+', '-', '*', ' ', ',', ')', "\r", "\n", "\t", ';', $this->rd); - } else { - $breakChars = array(' ', ',', ')', "\r", "\n", "\t", ';', $this->rd); - } - - $breaker = false; - foreach ($breakChars as $k => $char) { - $test = strpos($substr, $char); - if ($test !== false && $test < $end) { - $end = $test; - $breaker = $k; - } - } - - if ($curBlock === 'condition') { - if ($end === 0 && $breaker !== false) { - $end = strlen($breakChars[$breaker]); - } - } - - if ($end !== false) { - $substr = substr($substr, 0, $end); - } - - if ($pointer !== null) { - $pointer += strlen($substr); - } - - $src = $substr; - $substr = trim($substr); - - if (strtolower($substr) === 'false' || strtolower($substr) === 'no' || strtolower($substr) === 'off') { - if ($this->debug) { - echo 'BOOLEAN(FALSE) PARSED' . "\n"; - } - $substr = 'false'; - $type = self::T_BOOL; - } elseif (strtolower($substr) === 'true' || strtolower($substr) === 'yes' || strtolower($substr) === 'on') { - if ($this->debug) { - echo 'BOOLEAN(TRUE) PARSED' . "\n"; - } - $substr = 'true'; - $type = self::T_BOOL; - } elseif ($substr === 'null' || $substr === 'NULL') { - if ($this->debug) { - echo 'NULL PARSED' . "\n"; - } - $substr = 'null'; - $type = self::T_NULL; - } elseif (is_numeric($substr)) { - $substr = (float)$substr; - if ((int)$substr == $substr) { - $substr = (int)$substr; - } - $type = self::T_NUMERIC; - if ($this->debug) { - echo 'NUMBER (' . $substr . ') PARSED' . "\n"; - } - } elseif (preg_match('{^-?(\d+|\d*(\.\d+))\s*([/*%+-]\s*-?(\d+|\d*(\.\d+)))+$}', $substr)) { - if ($this->debug) { - echo 'SIMPLE MATH PARSED . "\n"'; - } - $type = self::T_MATH; - $substr = '(' . $substr . ')'; - } elseif ($curBlock === 'condition' && array_search($substr, $breakChars, true) !== false) { - if ($this->debug) { - echo 'BREAKCHAR (' . $substr . ') PARSED' . "\n"; - } - $type = self::T_BREAKCHAR; - //$substr = '"'.$substr.'"'; - } else { - $substr = $this->replaceStringVars('\'' . str_replace('\'', '\\\'', $substr) . '\'', '\'', $curBlock); - $type = self::T_UNQUOTED_STRING; - if ($this->debug) { - echo 'BLABBER (' . $substr . ') CASTED AS STRING' . "\n"; - } - } - - if (is_array($parsingParams)) { - $parsingParams[] = array($substr, $src, $type); - - return $parsingParams; - } elseif ($curBlock === 'namedparam') { - return array($substr, $src, $type); - } elseif ($curBlock === 'expression') { - return $substr; - } else { - throw new Exception('Something went wrong'); - } - } - - /** - * Replaces variables within a parsed string. - * - * @param string $string the parsed string - * @param string $first the first character parsed in the string, which is the string delimiter (' or ") - * @param string $curBlock the current parser-block being processed - * - * @return string the original string with variables replaced - */ - protected function replaceStringVars($string, $first, $curBlock = '') - { - $pos = 0; - if ($this->debug) { - echo 'STRING VAR REPLACEMENT : ' . $string . "\n"; - } - // replace vars - while (($pos = strpos($string, '$', $pos)) !== false) { - $prev = substr($string, $pos - 1, 1); - if ($prev === '\\') { - ++ $pos; - continue; - } - - $var = $this->parse($string, $pos, null, false, ($curBlock === 'modifier' ? 'modifier' : ($prev === '`' ? 'delimited_string' : 'string'))); - $len = $var[0]; - $var = $this->parse(str_replace('\\' . $first, $first, $string), $pos, null, false, ($curBlock === 'modifier' ? 'modifier' : ($prev === '`' ? 'delimited_string' : 'string'))); - - if ($prev === '`' && substr($string, $pos + $len, 1) === '`') { - $string = substr_replace($string, $first . '.' . $var[1] . '.' . $first, $pos - 1, $len + 2); - } else { - $string = substr_replace($string, $first . '.' . $var[1] . '.' . $first, $pos, $len); - } - $pos += strlen($var[1]) + 2; - if ($this->debug) { - echo 'STRING VAR REPLACEMENT DONE : ' . $string . "\n"; - } - } - - // handle modifiers - // TODO Obsolete? - $string = preg_replace_callback( - '#("|\')\.(.+?)\.\1((?:\|(?:@?[a-z0-9_]+(?:(?::("|\').+?\4|:[^`]*))*))+)#i', array( - $this, - 'replaceModifiers' - ), $string - ); - - // replace escaped dollar operators by unescaped ones if required - if ($first === "'") { - $string = str_replace('\\$', '$', $string); - } - - return $string; - } - - /** - * Replaces the modifiers applied to a string or a variable. - * - * @param array $m the regex matches that must be array(1=>"double or single quotes enclosing a string, - * when applicable", 2=>"the string or var", 3=>"the modifiers matched") - * @param string $curBlock the current parser-block being processed - * @param null $pointer - * - * @return string the input enclosed with various function calls according to the modifiers found - * @throws CompilationException - * @throws Exception - */ - protected function replaceModifiers(array $m, $curBlock = null, &$pointer = null) - { - if ($this->debug) { - echo 'PARSING MODIFIERS : ' . $m[3] . "\n"; - } - - if ($pointer !== null) { - $pointer += strlen($m[3]); - } - // remove first pipe - $cmdstrsrc = substr($m[3], 1); - // remove last quote if present - if (substr($cmdstrsrc, - 1, 1) === $m[1]) { - $cmdstrsrc = substr($cmdstrsrc, 0, - 1); - $add = $m[1]; - } - - $output = $m[2]; - - $continue = true; - while (strlen($cmdstrsrc) > 0 && $continue) { - if ($cmdstrsrc[0] === '|') { - $cmdstrsrc = substr($cmdstrsrc, 1); - continue; - } - if ($cmdstrsrc[0] === ' ' || $cmdstrsrc[0] === ';' || substr($cmdstrsrc, 0, strlen($this->rd)) === $this->rd) { - if ($this->debug) { - echo 'MODIFIER PARSING ENDED, RIGHT DELIMITER or ";" FOUND' . "\n"; - } - $continue = false; - if ($pointer !== null) { - $pointer -= strlen($cmdstrsrc); - } - break; - } - $cmdstr = $cmdstrsrc; - $paramsep = ':'; - if (!preg_match('/^(@{0,2}[a-z_][a-z0-9_]*)(:)?/i', $cmdstr, $match)) { - throw new CompilationException($this, 'Invalid modifier name, started with : ' . substr($cmdstr, 0, 10)); - } - $paramspos = !empty($match[2]) ? strlen($match[1]) : false; - $func = $match[1]; - - $state = 0; - if ($paramspos === false) { - $cmdstrsrc = substr($cmdstrsrc, strlen($func)); - $params = array(); - if ($this->debug) { - echo 'MODIFIER (' . $func . ') CALLED WITH NO PARAMS' . "\n"; - } - } else { - $paramstr = substr($cmdstr, $paramspos + 1); - if (substr($paramstr, - 1, 1) === $paramsep) { - $paramstr = substr($paramstr, 0, - 1); - } - - $ptr = 0; - $params = array(); - while ($ptr < strlen($paramstr)) { - if ($this->debug) { - echo 'MODIFIER (' . $func . ') START PARAM PARSING WITH POINTER AT ' . $ptr . "\n"; - } - if ($this->debug) { - echo $paramstr . '--' . $ptr . '--' . strlen($paramstr) . '--modifier' . "\n"; - } - $params = $this->parse($paramstr, $ptr, strlen($paramstr), $params, 'modifier', $ptr); - if ($this->debug) { - echo 'PARAM PARSED, POINTER AT ' . $ptr . "\n"; - } - - if ($ptr >= strlen($paramstr)) { - if ($this->debug) { - echo 'PARAM PARSING ENDED, PARAM STRING CONSUMED' . "\n"; - } - break; - } - - if ($paramstr[$ptr] === ' ' || $paramstr[$ptr] === '|' || $paramstr[$ptr] === ';' || substr($paramstr, $ptr, strlen($this->rd)) === $this->rd) { - if ($this->debug) { - echo 'PARAM PARSING ENDED, " ", "|", RIGHT DELIMITER or ";" FOUND, POINTER AT ' . $ptr . "\n"; - } - if ($paramstr[$ptr] !== '|') { - $continue = false; - if ($pointer !== null) { - $pointer -= strlen($paramstr) - $ptr; - } - } - ++ $ptr; - break; - } - if ($ptr < strlen($paramstr) && $paramstr[$ptr] === ':') { - ++ $ptr; - } - } - $cmdstrsrc = substr($cmdstrsrc, strlen($func) + 1 + $ptr); - foreach ($params as $k => $p) { - if (is_array($p) && is_array($p[1])) { - $state |= 2; - } else { - if (($state & 2) && preg_match('#^(["\'])(.+?)\1$#', $p[0], $m)) { - $params[$k] = array($m[2], array('true', 'true')); - } else { - if ($state & 2) { - throw new CompilationException($this, 'You can not use an unnamed parameter after a named one'); - } - $state |= 1; - } - } - } - } - - // check if we must use array_map with this plugin or not - $mapped = false; - if (substr($func, 0, 1) === '@') { - $func = substr($func, 1); - $mapped = true; - } - - $pluginType = $this->getPluginType($func); - - if ($state & 2) { - array_unshift($params, array('value', is_array($output) ? $output : array($output, $output))); - } else { - array_unshift($params, is_array($output) ? $output : array($output, $output)); - } - - if ($pluginType & Core::NATIVE_PLUGIN) { - $params = $this->mapParams($params, null, $state); - - $params = $params['*'][0]; - - $params = self::implode_r($params); - - if ($mapped) { - $output = '$this->arrayMap(\'' . $func . '\', array(' . $params . '))'; - } else { - $output = $func . '(' . $params . ')'; - } - } elseif ($pluginType & Core::PROXY_PLUGIN) { - $params = $this->mapParams($params, $this->getCore()->getPluginProxy()->getCallback($func), $state); - foreach ($params as &$p) { - $p = $p[0]; - } - $output = call_user_func(array($this->getCore()->getPluginProxy(), 'getCode'), $func, $params); - } elseif ($pluginType & Core::SMARTY_MODIFIER) { - $params = $this->mapParams($params, null, $state); - $params = $params['*'][0]; - - $params = self::implode_r($params); - - if ($pluginType & Core::CUSTOM_PLUGIN) { - $callback = $this->customPlugins[$func]['callback']; - if (is_array($callback)) { - if (is_object($callback[0])) { - $output = ($mapped ? '$this->arrayMap' : 'call_user_func_array') . '(array($this->getCustomPlugin(\'' . $func . '\'), \'' . $callback[1] . '\'), array(' . $params . '))'; - } else { - $output = ($mapped ? '$this->arrayMap' : 'call_user_func_array') . '(array(\'' . $callback[0] . '\', \'' . $callback[1] . '\'), array(' . $params . '))'; - } - } elseif ($mapped) { - $output = '$this->arrayMap(\'' . $callback . '\', array(' . $params . '))'; - } else { - $output = $callback . '(' . $params . ')'; - } - } elseif ($mapped) { - $output = '$this->arrayMap(\'smarty_modifier_' . $func . '\', array(' . $params . '))'; - } else { - $output = 'smarty_modifier_' . $func . '(' . $params . ')'; - } - } else { - if ($pluginType & Core::CUSTOM_PLUGIN) { - $pluginName = $callback = $this->customPlugins[$func]['callback']; - if (($pluginType & Core::CLASS_PLUGIN) && !is_array($callback)) { - $pluginName = $this->customPlugins[$func]['callback']; - $callback = array($pluginName, ($pluginType & Core::COMPILABLE_PLUGIN) ? 'compile' : 'process'); - } - } else { - if (class_exists('Plugin' . Core::toCamelCase($func)) !== false || function_exists('Plugin' . - Core::toCamelCase($func) . (($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : '')) - !== false) { - $pluginName = 'Plugin' . Core::toCamelCase($func); - } else { - $pluginName = Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func); - } - if ($pluginType & Core::CLASS_PLUGIN) { - $callback = array($pluginName, ($pluginType & Core::COMPILABLE_PLUGIN) ? 'compile' : 'process'); - } else { - $callback = $pluginName . (($pluginType & Core::COMPILABLE_PLUGIN) ? 'Compile' : ''); - } - } - $params = $this->mapParams($params, $callback, $state); - - foreach ($params as &$p) { - $p = $p[0]; - } - - // Only for PHP function, who is not a PHP class - if ($pluginType & Core::FUNC_PLUGIN && !($pluginType & Core::CLASS_PLUGIN)) { - if ($pluginType & Core::COMPILABLE_PLUGIN) { - if ($mapped) { - throw new CompilationException($this, 'The @ operator can not be used on compiled plugins.'); - } - if ($pluginType & Core::CUSTOM_PLUGIN) { - $funcCompiler = $this->customPlugins[$func]['callback']; - } else { - if (function_exists('Plugin' . Core::toCamelCase($func) . 'Compile') !== false) { - $funcCompiler = 'Plugin' . Core::toCamelCase($func) . 'Compile'; - } else { - $funcCompiler = Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func) . - 'Compile'; - } - } - array_unshift($params, $this); - $output = call_user_func_array($funcCompiler, $params); - } else { - array_unshift($params, '$this'); - - $params = self::implode_r($params); - if ($mapped) { - $output = '$this->arrayMap(\'' . $pluginName . '\', array(' . $params . '))'; - } else { - $output = $pluginName . '(' . $params . ')'; - } - } - } else { - if ($pluginType & Core::COMPILABLE_PLUGIN) { - if ($mapped) { - throw new CompilationException($this, 'The @ operator can not be used on compiled plugins.'); - } - if ($pluginType & Core::CUSTOM_PLUGIN) { - $callback = $this->customPlugins[$func]['callback']; - if (!is_array($callback)) { - if (!method_exists($callback, 'compile')) { - throw new Exception('Custom plugin ' . $func . ' must implement the "compile" method to be compilable, or you should provide a full callback to the method to use'); - } - if (($ref = new ReflectionMethod($callback, 'compile')) && $ref->isStatic()) { - $funcCompiler = array($callback, 'compile'); - } else { - $funcCompiler = array(new $callback(), 'compile'); - } - } else { - $funcCompiler = $callback; - } - } else { - if (class_exists('Plugin' . Core::toCamelCase($func)) !== false) { - $funcCompiler = array('Plugin' . Core::toCamelCase($func), 'compile'); - } else { - $funcCompiler = array(Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func), 'compile'); - } - array_unshift($params, $this); - } - $output = call_user_func_array($funcCompiler, $params); - } else { - $params = self::implode_r($params); - - if ($pluginType & Core::CUSTOM_PLUGIN) { - if (is_object($callback[0])) { - if (is_array($this->getCore()->getCustomPlugin($func))) { - $output = ($mapped ? '$this->arrayMap' : 'call_user_func_array') . '(array($this->plugins[\'' . $func . '\'][\'callback\'][0], \'' . $callback[1] . '\'), array(' . $params . '))'; - } else { - $output = ($mapped ? '$this->arrayMap' : 'call_user_func_array') . '(array($this->getCustomPlugin(\'' . $func . '\'), \'' . $callback[1] . '\'), array(' . $params . '))'; - } - } else { - $output = ($mapped ? '$this->arrayMap' : 'call_user_func_array') . '(array(\'' . $callback[0] . '\', \'' . $callback[1] . '\'), array(' . $params . '))'; - } - } elseif ($mapped) { - $output = '$this->arrayMap(array($this->getObjectPlugin(\''. - Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func) . '\'), - \'process\'), array(' . $params . '))'; - } else { - if (class_exists('Plugin' . Core::toCamelCase($func)) !== false) { - $output = '$this->classCall(\'Plugin' . Core::toCamelCase($func) . '\', array(' . $params . '))'; - } elseif (class_exists(Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($func)) !== false) { - $output = '$this->classCall(\'' . Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . $func . '\', array(' . $params . '))'; - } elseif (class_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($func)) !== false) { - $output = '$this->classCall(\'' . Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . $func . '\', array(' . $params . '))'; - } else { - $output = '$this->classCall(\'' . $func . '\', array(' . $params . '))'; - } - } - } - } - } - } - - if ($curBlock === 'namedparam') { - return array($output, $output); - } elseif ($curBlock === 'var' || $m[1] === null) { - return $output; - } elseif ($curBlock === 'string' || $curBlock === 'root') { - return $m[1] . '.' . $output . '.' . $m[1] . (isset($add) ? $add : null); - } - - return ''; - } - - /** - * Recursively implodes an array in a similar manner as var_export() does but with some tweaks - * to handle pre-compiled values and the fact that we do not need to enclose everything with - * "array" and do not require top-level keys to be displayed. - * - * @param array $params the array to implode - * @param bool $recursiveCall if set to true, the function outputs key names for the top level - * - * @return string the imploded array - */ - public static function implode_r(array $params, $recursiveCall = false) - { - $out = ''; - foreach ($params as $k => $p) { - if (is_array($p)) { - $out2 = 'array('; - foreach ($p as $k2 => $v) { - $out2 .= var_export($k2, true) . ' => ' . (is_array($v) ? 'array(' . self::implode_r($v, true) . ')' : $v) . ', '; - } - $p = rtrim($out2, ', ') . ')'; - } - if ($recursiveCall) { - $out .= var_export($k, true) . ' => ' . $p . ', '; - } else { - $out .= $p . ', '; - } - } - - return rtrim($out, ', '); - } - - /** - * Returns the plugin type of a plugin and adds it to the used plugins array if required. - * - * @param string $name plugin name, as found in the template - * - * @return int type as a multi bit flag composed of the Dwoo plugin types constants - * @throws Exception - * @throws SecurityException - * @throws Exception - */ - protected function getPluginType($name) - { - $pluginType = - 1; - - if (($this->securityPolicy === null && (function_exists($name) || strtolower($name) === 'isset' || strtolower($name) === 'empty')) || ($this->securityPolicy !== null && array_key_exists(strtolower($name), $this->securityPolicy->getAllowedPhpFunctions()) !== false)) { - $phpFunc = true; - } elseif ($this->securityPolicy !== null && function_exists($name) && array_key_exists(strtolower($name), $this->securityPolicy->getAllowedPhpFunctions()) === false) { - throw new SecurityException('Call to a disallowed php function : ' . $name); - } - - while ($pluginType <= 0) { - // Template plugin compilable - if (isset($this->templatePlugins[$name])) { - $pluginType = Core::TEMPLATE_PLUGIN | Core::COMPILABLE_PLUGIN; - } // Custom plugin - elseif (isset($this->customPlugins[$name])) { - $pluginType = $this->customPlugins[$name]['type'] | Core::CUSTOM_PLUGIN; - } // Class blocks plugin - elseif (class_exists(Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($name)) !== false) { - $pluginType = Core::CLASS_PLUGIN; - if (is_subclass_of(Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($name), 'Dwoo\Block\Plugin')) { - $pluginType += Core::BLOCK_PLUGIN; - } - $interfaces = class_implements(Core::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . Core::toCamelCase($name)); - if (in_array('Dwoo\ICompilable', $interfaces) !== false || in_array('Dwoo\ICompilable\Block', $interfaces) !== false) { - $pluginType |= Core::COMPILABLE_PLUGIN; - } - } // Class functions plugin - elseif (class_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($name)) !== false) { - $pluginType = Core::FUNC_PLUGIN + Core::CLASS_PLUGIN; - $interfaces = class_implements(Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($name)); - if (in_array('Dwoo\ICompilable', $interfaces) !== false || in_array('Dwoo\ICompilable\Block', $interfaces) !== false) { - $pluginType |= Core::COMPILABLE_PLUGIN; - } - } // Class without namespace - elseif (class_exists('Plugin' . Core::toCamelCase($name)) !== false) { - $pluginType = Core::CLASS_PLUGIN; - $interfaces = class_implements('Plugin' . Core::toCamelCase($name)); - if (in_array('Dwoo\ICompilable', $interfaces) !== false || in_array('Dwoo\ICompilable\Block', $interfaces) !== false) { - $pluginType |= Core::COMPILABLE_PLUGIN; - } - } // Function plugin (with/without namespaces) - elseif (function_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase ($name)) !== - false || function_exists('Plugin' . Core::toCamelCase($name)) !== false) { - $pluginType = Core::FUNC_PLUGIN; - } // Function plugin compile (with/without namespaces) - elseif (function_exists(Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin' . Core::toCamelCase($name) . - 'Compile') !== false || function_exists('Plugin' . Core::toCamelCase($name) . 'Compile') !== - false) { - $pluginType = Core::FUNC_PLUGIN | Core::COMPILABLE_PLUGIN; - } // Helper plugin class compile - elseif (class_exists(Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($name)) !== false) { - $pluginType = Core::CLASS_PLUGIN | Core::COMPILABLE_PLUGIN; - } // Helper plugin function compile - elseif (function_exists(Core::NAMESPACE_PLUGINS_HELPERS . 'Plugin' . Core::toCamelCase($name) . 'Compile') !== false) { - $pluginType = Core::FUNC_PLUGIN | Core::COMPILABLE_PLUGIN; - } // Smarty modifier - elseif (function_exists('smarty_modifier_' . $name) !== false) { - $pluginType = Core::SMARTY_MODIFIER; - } // Smarty function - elseif (function_exists('smarty_function_' . $name) !== false) { - $pluginType = Core::SMARTY_FUNCTION; - } // Smarty block - elseif (function_exists('smarty_block_' . $name) !== false) { - $pluginType = Core::SMARTY_BLOCK; - } // Everything else - else { - if ($pluginType === - 1) { - try { - $this->getCore()->getLoader()->loadPlugin('Plugin' . Core::toCamelCase($name)); - } - catch (Exception $e) { - if (isset($phpFunc)) { - $pluginType = Core::NATIVE_PLUGIN; - } elseif (is_object($this->getCore()->getPluginProxy()) && $this->getCore()->getPluginProxy()->handles($name)) { - $pluginType = Core::PROXY_PLUGIN; - break; - } else { - throw $e; - } - } - } else { - throw new Exception('Plugin "' . $name . '" could not be found, type:' . $pluginType); - } - ++ $pluginType; - } - } - - if (($pluginType & Core::COMPILABLE_PLUGIN) === 0 && ($pluginType & Core::NATIVE_PLUGIN) === 0 && ($pluginType & Core::PROXY_PLUGIN) === 0) { - $this->addUsedPlugin(Core::toCamelCase($name), $pluginType); - } - - return $pluginType; - } - - /** - * Allows a plugin to load another one at compile time, this will also mark - * it as used by this template so it will be loaded at runtime (which can be - * useful for compiled plugins that rely on another plugin when their compiled - * code runs). - * - * @param string $name the plugin name - * - * @return void - */ - public function loadPlugin($name) - { - $this->getPluginType($name); - } - - /** - * Runs htmlentities over the matched blocks when the security policy enforces that. - * - * @param array $match matched php block - * - * @return string the htmlentities-converted string - */ - protected function phpTagEncodingHelper($match) - { - return htmlspecialchars($match[0]); - } - - /** - * Maps the parameters received from the template onto the parameters required by the given callback. - * - * @param array $params the array of parameters - * @param callback $callback the function or method to reflect on to find out the required parameters - * @param int $callType the type of call in the template, 0 = no params, 1 = php-style call, 2 = named - * parameters call - * @param array $map the parameter map to use, if not provided it will be built from the callback - * - * @return array parameters sorted in the correct order with missing optional parameters filled - * @throws CompilationException - */ - protected function mapParams(array $params, $callback, $callType = 2, $map = null) - { - if (!$map) { - $map = $this->getParamMap($callback); - } - - $paramlist = array(); - - // transforms the parameter array from (x=>array('paramname'=>array(values))) to (paramname=>array(values)) - $ps = array(); - foreach ($params as $p) { - if (is_array($p[1])) { - $ps[$p[0]] = $p[1]; - } else { - $ps[] = $p; - } - } - - // loops over the param map and assigns values from the template or default value for unset optional params - foreach ($map as $k => $v){ - if ($v[0] === '*') { - // "rest" array parameter, fill every remaining params in it and then break - if (count($ps) === 0) { - if ($v[1] === false) { - throw new CompilationException( - $this, 'Rest argument missing for ' . str_replace( - array( - Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin', - 'Compile' - ), '', (is_array($callback) ? $callback[0] : $callback) - ) - ); - } else { - break; - } - } - $tmp = array(); - $tmp2 = array(); - $tmp3 = array(); - foreach ($ps as $i => $p) { - $tmp[$i] = $p[0]; - $tmp2[$i] = $p[1]; - $tmp3[$i] = isset($p[2]) ? $p[2] : 0; - unset($ps[$i]); - } - $paramlist[$v[0]] = array($tmp, $tmp2, $tmp3); - unset($tmp, $tmp2, $i, $p); - break; - } elseif (isset($ps[$v[0]])) { - // parameter is defined as named param - $paramlist[$v[0]] = $ps[$v[0]]; - unset($ps[$v[0]]); - } elseif (isset($ps[$k])) { - // parameter is defined as ordered param - $paramlist[$v[0]] = $ps[$k]; - unset($ps[$k]); - } elseif ($v[1] === false) { - // parameter is not defined and not optional, throw error - if (is_array($callback)) { - if (is_object($callback[0])) { - $name = get_class($callback[0]) . '::' . $callback[1]; - } else { - $name = $callback[0]; - } - } else { - $name = $callback; - } - - throw new CompilationException( - $this, 'Argument ' . $k . '/' . $v[0] . ' missing for ' . str_replace( - array( - Core::NAMESPACE_PLUGINS_FUNCTIONS . 'Plugin', - 'Compile' - ), '', $name - ) - ); - } elseif ($v[2] === null) { - // enforce lowercased null if default value is null (php outputs NULL with var export) - $paramlist[$v[0]] = array('null', null, self::T_NULL); - } else { - // outputs default value with var_export - $paramlist[$v[0]] = array(var_export($v[2], true), $v[2]); - } - } - - if (count($ps)) { - foreach ($ps as $i => $p) { - array_push($paramlist, $p); - } - } - - return $paramlist; - } - - /** - * Returns the parameter map of the given callback, it filters out entries typed as Dwoo and Compiler and turns the - * rest parameter into a "*". - * - * @param callback $callback the function/method to reflect on - * - * @return array processed parameter map - */ - protected function getParamMap($callback) - { - if (is_null($callback)) { - return array(array('*', true)); - } - if (is_array($callback)) { - $ref = new ReflectionMethod($callback[0], $callback[1]); - } else { - $ref = new ReflectionFunction($callback); - } - - $out = array(); - foreach ($ref->getParameters() as $param) { - if (($class = $param->getClass()) !== null && $class->name === 'Dwoo\Core') { - continue; - } - if (($class = $param->getClass()) !== null && $class->name === 'Dwoo\Compiler') { - continue; - } - if ($param->getName() === 'rest' && $param->isArray() === true) { - $out[] = array('*', $param->isOptional(), null); - continue; - } - $out[] = array( - $param->getName(), - $param->isOptional(), - $param->isOptional() ? $param->getDefaultValue() : null - ); - } - - return $out; - } - - /** - * Returns a default instance of this compiler, used by default by all Dwoo templates that do not have a - * specific compiler assigned and when you do not override the default compiler factory function. - * - * @see Core::setDefaultCompilerFactory() - * @return Compiler - */ - public static function compilerFactory() - { - if (self::$instance === null) { - self::$instance = new self(); - } - - return self::$instance; - } -} diff --git a/core/l/Dwoo/Core.php b/core/l/Dwoo/Core.php deleted file mode 100644 index a0386c0..0000000 --- a/core/l/Dwoo/Core.php +++ /dev/null @@ -1,1792 +0,0 @@ - - * @author David Sanchez - * @copyright 2008-2013 Jordi Boggiano - * @copyright 2013-2017 David Sanchez - * @license http://dwoo.org/LICENSE LGPLv3 - * @version 1.3.6 - * @date 2017-03-23 - * @link http://dwoo.org/ - */ - -namespace Dwoo; - -use ArrayAccess; -use Closure; -use Countable; -use Dwoo\Plugins\Blocks\PluginDynamic; -use Dwoo\Security\Policy as SecurityPolicy; -use Dwoo\Block\Plugin as BlockPlugin; -use Dwoo\Template\File as TemplateFile; -use Iterator; -use stdClass; -use Traversable; - -/** - * Main dwoo class, allows communication between the compiler, template and data classes. - *
- * requirements :
- *  php 5.3.0 or above (might work below, it's a rough estimate)
- *  SPL and PCRE extensions (for php versions prior to 5.3.0)
- *  mbstring extension for some string manipulation plugins (especially if you intend to use UTF-8)
- * recommended :
- *  hash extension (for Dwoo\Template\Str - minor performance boost)
- * project created :
- *  2008-01-05
- * 
- * This software is provided 'as-is', without any express or implied warranty. - * In no event will the authors be held liable for any damages arising from the use of this software. - */ -class Core -{ - /** - * Current version number. - * - * @var string - */ - const VERSION = '1.3.6'; - - /** - * Unique number of this dwoo release, based on version number. - * this can be used by templates classes to check whether the compiled template - * has been compiled before this release or not, so that old templates are - * recompiled automatically when Dwoo is updated - */ - const RELEASE_TAG = 136; - - /** - * Constants that represents all plugin types - * these are bitwise-operation-safe values to allow multiple types - * on a single plugin - * - * @var int - */ - const CLASS_PLUGIN = 1; - const FUNC_PLUGIN = 2; - const NATIVE_PLUGIN = 4; - const BLOCK_PLUGIN = 8; - const COMPILABLE_PLUGIN = 16; - const CUSTOM_PLUGIN = 32; - const SMARTY_MODIFIER = 64; - const SMARTY_BLOCK = 128; - const SMARTY_FUNCTION = 256; - const PROXY_PLUGIN = 512; - const TEMPLATE_PLUGIN = 1024; - - /** - * Constant to default namespaces of builtin plugins - * - * @var string - */ - const NAMESPACE_PLUGINS_BLOCKS = 'Dwoo\Plugins\Blocks\\'; - const NAMESPACE_PLUGINS_FILTERS = 'Dwoo\Plugins\Filters\\'; - const NAMESPACE_PLUGINS_FUNCTIONS = 'Dwoo\Plugins\Functions\\'; - const NAMESPACE_PLUGINS_HELPERS = 'Dwoo\Plugins\Helpers\\'; - const NAMESPACE_PLUGINS_PROCESSORS = 'Dwoo\Plugins\Processors\\'; - - /** - * Character set of the template, used by string manipulation plugins. - * it must be lowercase, but setCharset() will take care of that - * - * @see setCharset - * @see getCharset - * @var string - */ - protected $charset = 'UTF-8'; - - /** - * Global variables that are accessible through $dwoo.* in the templates. - * default values include: - * $dwoo.version - current version number - * $dwoo.ad - a Powered by Dwoo link pointing to dwoo.org - * $dwoo.now - the current time - * $dwoo.template - the current template filename - * $dwoo.charset - the character set used by the template - * on top of that, foreach and other plugins can store special values in there, - * see their documentation for more details. - * - * @var array - */ - protected $globals = array(); - - /** - * Directory where the compiled templates are stored. - * defaults to DWOO_COMPILEDIR (= dwoo_dir/compiled by default) - * - * @var string - */ - protected $compileDir; - - /** - * Directory where the cached templates are stored. - * defaults to DWOO_CACHEDIR (= dwoo_dir/cache by default) - * - * @var string - */ - protected $cacheDir; - - /** - * Directory where the template files are stored - * - * @var array - */ - protected $templateDir = array(); - - /** - * Defines how long (in seconds) the cached files must remain valid. - * can be overridden on a per-template basis - * -1 = never delete - * 0 = disabled - * >0 = duration in seconds - * - * @var int - */ - protected $cacheTime = 0; - - /** - * Security policy object. - * - * @var SecurityPolicy - */ - protected $securityPolicy = null; - - /** - * Stores the custom plugins callbacks. - * - * @see addPlugin - * @see removePlugin - * @var array - */ - protected $plugins = array(); - - /** - * Stores the filter callbacks. - * - * @see addFilter - * @see removeFilter - * @var array - */ - protected $filters = array(); - - /** - * Stores the resource types and associated - * classes / compiler classes. - * - * @var array - */ - protected $resources = array( - 'file' => array( - 'class' => 'Dwoo\Template\File', - 'compiler' => null, - ), - 'string' => array( - 'class' => 'Dwoo\Template\Str', - 'compiler' => null, - ), - ); - - /** - * The dwoo loader object used to load plugins by this dwoo instance. - * - * @var ILoader - */ - protected $loader = null; - - /** - * Currently rendered template, set to null when not-rendering. - * - * @var ITemplate - */ - protected $template = null; - - /** - * Stores the instances of the class plugins during template runtime. - * - * @var array - */ - protected $runtimePlugins = array(); - - /** - * Stores the returned values during template runtime. - * - * @var array - */ - protected $returnData = array(); - - /** - * Stores the data during template runtime. - * - * @var array - */ - protected $data = array(); - - /** - * Stores the current scope during template runtime. - * this should ideally not be accessed directly from outside template code - * - * @var mixed - */ - public $scope; - - /** - * Stores the scope tree during template runtime. - * - * @var array - */ - protected $scopeTree = array(); - - /** - * Stores the block plugins stack during template runtime. - * - * @var array - */ - protected $stack = array(); - - /** - * Stores the current block plugin at the top of the stack during template runtime. - * - * @var BlockPlugin - */ - protected $curBlock; - - /** - * Stores the output buffer during template runtime. - * - * @var string - */ - protected $buffer; - - /** - * Stores plugin proxy. - * - * @var IPluginProxy - */ - protected $pluginProxy; - - /** - * Constructor, sets the cache and compile dir to the default values if not provided. - * - * @param string $compileDir path to the compiled directory, defaults to lib/compiled - * @param string $cacheDir path to the cache directory, defaults to lib/cache - */ - public function __construct($compileDir = null, $cacheDir = null) - { - if ($compileDir !== null) { - $this->setCompileDir($compileDir); - } - if ($cacheDir !== null) { - $this->setCacheDir($cacheDir); - } - $this->initGlobals(); - } - - /** - * Resets some runtime variables to allow a cloned object to be used to render sub-templates. - * - * @return void - */ - public function __clone() - { - $this->template = null; - unset($this->data); - unset($this->returnData); - } - - /** - * Returns the given template rendered using the provided data and optional compiler. - * - * @param mixed $_tpl template, can either be a ITemplate object (i.e. TemplateFile), a - * valid path to a template, or a template as a string it is recommended to - * provide a ITemplate as it will probably make things faster, especially if - * you render a template multiple times - * @param mixed $data the data to use, can either be a IDataProvider object (i.e. Data) or - * an associative array. if you're rendering the template from cache, it can be - * left null - * @param ICompiler $_compiler the compiler that must be used to compile the template, if left empty a default - * Compiler will be used - * - * @return string|void or the template output if $output is false - * @throws Exception - */ - public function get($_tpl, $data = array(), $_compiler = null) - { - // a render call came from within a template, so we need a new dwoo instance in order to avoid breaking this one - if ($this->template instanceof ITemplate) { - $clone = clone $this; - - return $clone->get($_tpl, $data, $_compiler); - } - - // auto-create template if required - if ($_tpl instanceof ITemplate) { - // valid, skip - } elseif (is_string($_tpl)) { - $_tpl = new TemplateFile($_tpl); - $_tpl->setIncludePath($this->getTemplateDir()); - } else { - throw new Exception('Dwoo->get\'s first argument must be a ITemplate (i.e. TemplateFile) or a valid path to a template file', E_USER_NOTICE); - } - - // save the current template, enters render mode at the same time - // if another rendering is requested it will be proxied to a new Core(instance - $this->template = $_tpl; - - // load data - if ($data instanceof IDataProvider) { - $this->data = $data->getData(); - } elseif (is_array($data)) { - $this->data = $data; - } elseif ($data instanceof ArrayAccess) { - $this->data = $data; - } else { - throw new Exception('Dwoo->get/Dwoo->output\'s data argument must be a IDataProvider object (i.e. Data) or an associative array', E_USER_NOTICE); - } - - $this->addGlobal('template', $_tpl->getName()); - $this->initRuntimeVars($_tpl); - - // try to get cached template - $file = $_tpl->getCachedTemplate($this); - $doCache = $file === true; - $cacheLoaded = is_string($file); - - if ($cacheLoaded === true) { - // cache is present, run it - ob_start(); - include $file; - $this->template = null; - - return ob_get_clean(); - } else { - $dynamicId = uniqid(); - - // render template - $compiledTemplate = $_tpl->getCompiledTemplate($this, $_compiler); - $out = include $compiledTemplate; - - // template returned false so it needs to be recompiled - if ($out === false) { - $_tpl->forceCompilation(); - $compiledTemplate = $_tpl->getCompiledTemplate($this, $_compiler); - $out = include $compiledTemplate; - } - - if ($doCache === true) { - $out = preg_replace('/(<%|%>|<\?php|<\?|\?>)/', '', $out); - if (!class_exists(self::NAMESPACE_PLUGINS_BLOCKS . 'PluginDynamic')) { - $this->getLoader()->loadPlugin('PluginDynamic'); - } - $out = PluginDynamic::unescape($out, $dynamicId, $compiledTemplate); - } - - // process filters - foreach ($this->filters as $filter) { - if (is_array($filter) && $filter[0] instanceof Filter) { - $out = call_user_func($filter, $out); - } else { - $out = call_user_func($filter, $this, $out); - } - } - - if ($doCache === true) { - // building cache - $file = $_tpl->cache($this, $out); - - // run it from the cache to be sure dynamics are rendered - ob_start(); - include $file; - // exit render mode - $this->template = null; - - return ob_get_clean(); - } else { - // no need to build cache - // exit render mode - $this->template = null; - - return $out; - } - } - } - - /** - * Registers a Global. - * New globals can be added before compiling or rendering a template - * but after, you can only update existing globals. - * - * @param string $name - * @param mixed $value - * - * @return $this - * @throws Exception - */ - public function addGlobal($name, $value) - { - if (null === $this->globals) { - $this->initGlobals(); - } - - $this->globals[$name] = $value; - - return $this; - } - - /** - * Gets the registered Globals. - * - * @return array - */ - public function getGlobals() - { - return $this->globals; - } - - /** - * Re-initializes the globals array before each template run. - * this method is only callede once when the Dwoo object is created - * - * @return void - */ - protected function initGlobals() - { - $this->globals = array( - 'version' => self::VERSION, - 'ad' => 'Powered by Dwoo', - 'now' => $_SERVER['REQUEST_TIME'], - 'charset' => $this->getCharset(), - ); - } - - /** - * Re-initializes the runtime variables before each template run. - * override this method to inject data in the globals array if needed, this - * method is called before each template execution - * - * @param ITemplate $tpl the template that is going to be rendered - * - * @return void - */ - protected function initRuntimeVars(ITemplate $tpl) - { - $this->runtimePlugins = array(); - $this->scope = &$this->data; - $this->scopeTree = array(); - $this->stack = array(); - $this->curBlock = null; - $this->buffer = ''; - $this->returnData = array(); - } - - /** - * Adds a custom plugin that is not in one of the plugin directories. - * - * @param string $name the plugin name to be used in the templates - * @param callback $callback the plugin callback, either a function name, - * a class name or an array containing an object - * or class name and a method name - * @param bool $compilable if set to true, the plugin is assumed to be compilable - * - * @return void - * @throws Exception - */ - public function addPlugin($name, $callback, $compilable = false) - { - $compilable = $compilable ? self::COMPILABLE_PLUGIN : 0; - if (is_array($callback)) { - if (is_subclass_of(is_object($callback[0]) ? get_class($callback[0]) : $callback[0], 'Dwoo\Block\Plugin')) { - $this->plugins[$name] = array( - 'type' => self::BLOCK_PLUGIN | $compilable, - 'callback' => $callback, - 'class' => (is_object($callback[0]) ? get_class($callback[0]) : $callback[0]) - ); - } else { - $this->plugins[$name] = array( - 'type' => self::CLASS_PLUGIN | $compilable, - 'callback' => $callback, - 'class' => (is_object($callback[0]) ? get_class($callback[0]) : $callback[0]), - 'function' => $callback[1] - ); - } - } elseif (is_string($callback)) { - if (class_exists($callback)) { - if (is_subclass_of($callback, 'Dwoo\Block\Plugin')) { - $this->plugins[$name] = array( - 'type' => self::BLOCK_PLUGIN | $compilable, - 'callback' => $callback, - 'class' => $callback - ); - } else { - $this->plugins[$name] = array( - 'type' => self::CLASS_PLUGIN | $compilable, - 'callback' => $callback, - 'class' => $callback, - 'function' => ($compilable ? 'compile' : 'process') - ); - } - } elseif (function_exists($callback)) { - $this->plugins[$name] = array( - 'type' => self::FUNC_PLUGIN | $compilable, - 'callback' => $callback - ); - } else { - throw new Exception('Callback could not be processed correctly, please check that the function/class you used exists'); - } - } elseif ($callback instanceof Closure) { - $this->plugins[$name] = array( - 'type' => self::FUNC_PLUGIN | $compilable, - 'callback' => $callback - ); - } elseif (is_object($callback)) { - if (is_subclass_of($callback, 'Dwoo\Block\Plugin')) { - $this->plugins[$name] = array( - 'type' => self::BLOCK_PLUGIN | $compilable, - 'callback' => get_class($callback), - 'class' => $callback - ); - } else { - $this->plugins[$name] = array( - 'type' => self::CLASS_PLUGIN | $compilable, - 'callback' => $callback, - 'class' => $callback, - 'function' => ($compilable ? 'compile' : 'process') - ); - } - } else { - throw new Exception('Callback could not be processed correctly, please check that the function/class you used exists'); - } - } - - /** - * Removes a custom plugin. - * - * @param string $name the plugin name - * - * @return void - */ - public function removePlugin($name) - { - if (isset($this->plugins[$name])) { - unset($this->plugins[$name]); - } - } - - /** - * Adds a filter to this Dwoo instance, it will be used to filter the output of all the templates rendered by this - * instance. - * - * @param mixed $callback a callback or a filter name if it is autoloaded from a plugin directory - * @param bool $autoload if true, the first parameter must be a filter name from one of the plugin directories - * - * @return void - * @throws Exception - */ - public function addFilter($callback, $autoload = false) - { - if ($autoload) { - $class = self::NAMESPACE_PLUGINS_FILTERS . self::toCamelCase($callback); - if (!class_exists($class) && !function_exists($class)) { - try { - $this->getLoader()->loadPlugin($callback); - } - catch (Exception $e) { - if (strstr($callback, self::NAMESPACE_PLUGINS_FILTERS)) { - throw new Exception('Wrong filter name : ' . $callback . ', the "Filter" prefix should not be used, please only use "' . str_replace('Filter', '', $callback) . '"'); - } else { - throw new Exception('Wrong filter name : ' . $callback . ', when using autoload the filter must be in one of your plugin dir as "name.php" containig a class or function named "Filter"'); - } - } - } - - if (class_exists($class)) { - $callback = array(new $class($this), 'process'); - } elseif (function_exists($class)) { - $callback = $class; - } else { - throw new Exception('Wrong filter name : ' . $callback . ', when using autoload the filter must be in one of your plugin dir as "name.php" containig a class or function named "Filter"'); - } - - $this->filters[] = $callback; - } else { - $this->filters[] = $callback; - } - } - - /** - * Removes a filter. - * - * @param mixed $callback callback or filter name if it was autoloaded - * - * @return void - */ - public function removeFilter($callback) - { - if (($index = array_search(self::NAMESPACE_PLUGINS_FILTERS. 'Filter' . self::toCamelCase($callback), $this->filters, - true)) !== - false) { - unset($this->filters[$index]); - } elseif (($index = array_search($callback, $this->filters, true)) !== false) { - unset($this->filters[$index]); - } else { - $class = self::NAMESPACE_PLUGINS_FILTERS . 'Filter' . $callback; - foreach ($this->filters as $index => $filter) { - if (is_array($filter) && $filter[0] instanceof $class) { - unset($this->filters[$index]); - break; - } - } - } - } - - /** - * Adds a resource or overrides a default one. - * - * @param string $name the resource name - * @param string $class the resource class (which must implement ITemplate) - * @param callback $compilerFactory the compiler factory callback, a function that must return a compiler instance - * used to compile this resource, if none is provided. by default it will produce - * a Compiler object - * - * @return void - * @throws Exception - */ - public function addResource($name, $class, $compilerFactory = null) - { - if (strlen($name) < 2) { - throw new Exception('Resource names must be at least two-character long to avoid conflicts with Windows paths'); - } - - if (!class_exists($class)) { - throw new Exception(sprintf('Resource class %s does not exist', $class)); - } - - $interfaces = class_implements($class); - if (in_array('Dwoo\ITemplate', $interfaces) === false) { - throw new Exception('Resource class must implement ITemplate'); - } - - $this->resources[$name] = array( - 'class' => $class, - 'compiler' => $compilerFactory - ); - } - - /** - * Removes a custom resource. - * - * @param string $name the resource name - * - * @return void - */ - public function removeResource($name) - { - unset($this->resources[$name]); - if ($name === 'file') { - $this->resources['file'] = array( - 'class' => 'Dwoo\Template\File', - 'compiler' => null - ); - } - } - - /** - * Sets the loader object to use to load plugins. - * - * @param ILoader $loader loader - * - * @return void - */ - public function setLoader(ILoader $loader) - { - $this->loader = $loader; - } - - /** - * Returns the current loader object or a default one if none is currently found. - * - * @return ILoader|Loader - */ - public function getLoader() - { - if ($this->loader === null) { - $this->loader = new Loader($this->getCompileDir()); - } - - return $this->loader; - } - - /** - * Returns the custom plugins loaded. - * Used by the ITemplate classes to pass the custom plugins to their ICompiler instance. - * - * @return array - */ - public function getCustomPlugins() - { - return $this->plugins; - } - - /** - * Return a specified custom plugin loaded by his name. - * Used by the compiler, for executing a Closure. - * - * @param string $name - * - * @return mixed|null - */ - public function getCustomPlugin($name) - { - if (isset($this->plugins[$name])) { - return $this->plugins[$name]['callback']; - } - - return null; - } - - /** - * Returns the cache directory with a trailing DIRECTORY_SEPARATOR. - * - * @return string - */ - public function getCacheDir() - { - if ($this->cacheDir === null) { - $this->setCacheDir(dirname(__DIR__) . DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR); - } - - return $this->cacheDir; - } - - /** - * Sets the cache directory and automatically appends a DIRECTORY_SEPARATOR. - * - * @param string $dir the cache directory - * - * @return void - * @throws Exception - */ - public function setCacheDir($dir) - { - $this->cacheDir = rtrim($dir, '/\\') . DIRECTORY_SEPARATOR; - if (!file_exists($this->cacheDir)) { - mkdir($this->cacheDir, 0777, true); - } - if (is_writable($this->cacheDir) === false) { - throw new Exception('The cache directory must be writable, chmod "' . $this->cacheDir . '" to make it writable'); - } - } - - /** - * Returns the compile directory with a trailing DIRECTORY_SEPARATOR. - * - * @return string - */ - public function getCompileDir() - { - if ($this->compileDir === null) { - $this->setCompileDir(dirname(__DIR__) . DIRECTORY_SEPARATOR . DIRECTORY_SEPARATOR); - } - - return $this->compileDir; - } - - /** - * Sets the compile directory and automatically appends a DIRECTORY_SEPARATOR. - * - * @param string $dir the compile directory - * - * @return void - * @throws Exception - */ - public function setCompileDir($dir) - { - $this->compileDir = rtrim($dir, '/\\') . DIRECTORY_SEPARATOR; - if (!file_exists($this->compileDir)) { - mkdir($this->compileDir, 0777, true); - } - if (is_writable($this->compileDir) === false) { - throw new Exception('The compile directory must be writable, chmod "' . $this->compileDir . '" to make it writable'); - } - } - - /** - * Returns an array of the template directory with a trailing DIRECTORY_SEPARATOR - * - * @return array - */ - public function getTemplateDir() - { - return $this->templateDir; - } - - /** - * sets the template directory and automatically appends a DIRECTORY_SEPARATOR - * template directory is stored in an array - * - * @param string $dir - * - * @throws Exception - */ - public function setTemplateDir($dir) - { - $tmpDir = rtrim($dir, '/\\') . DIRECTORY_SEPARATOR; - if (is_dir($tmpDir) === false) { - throw new Exception('The template directory: "' . $tmpDir . '" does not exists, create the directory or specify an other location !'); - } - $this->templateDir[] = $tmpDir; - } - - /** - * Returns the default cache time that is used with templates that do not have a cache time set. - * - * @return int the duration in seconds - */ - public function getCacheTime() - { - return $this->cacheTime; - } - - /** - * Sets the default cache time to use with templates that do not have a cache time set. - * - * @param int $seconds the duration in seconds - * - * @return void - */ - public function setCacheTime($seconds) - { - $this->cacheTime = (int)$seconds; - } - - /** - * Returns the character set used by the string manipulation plugins. - * the charset is automatically lowercased - * - * @return string - */ - public function getCharset() - { - return $this->charset; - } - - /** - * Sets the character set used by the string manipulation plugins. - * the charset will be automatically lowercased - * - * @param string $charset the character set - * - * @return void - */ - public function setCharset($charset) - { - $this->charset = strtolower((string)$charset); - } - - /** - * Returns the current template being rendered, when applicable, or null. - * - * @return ITemplate|null - */ - public function getTemplate() - { - return $this->template; - } - - /** - * Sets the current template being rendered. - * - * @param ITemplate $tpl template object - * - * @return void - */ - public function setTemplate(ITemplate $tpl) - { - $this->template = $tpl; - } - - /** - * Sets the default compiler factory function for the given resource name. - * a compiler factory must return a ICompiler object pre-configured to fit your needs - * - * @param string $resourceName the resource name (i.e. file, string) - * @param callback $compilerFactory the compiler factory callback - * - * @return void - */ - public function setDefaultCompilerFactory($resourceName, $compilerFactory) - { - $this->resources[$resourceName]['compiler'] = $compilerFactory; - } - - /** - * Returns the default compiler factory function for the given resource name. - * - * @param string $resourceName the resource name - * - * @return callback the compiler factory callback - */ - public function getDefaultCompilerFactory($resourceName) - { - return $this->resources[$resourceName]['compiler']; - } - - /** - * Sets the security policy object to enforce some php security settings. - * use this if untrusted persons can modify templates - * - * @param SecurityPolicy $policy the security policy object - * - * @return void - */ - public function setSecurityPolicy(SecurityPolicy $policy = null) - { - $this->securityPolicy = $policy; - } - - /** - * Returns the current security policy object or null by default. - * - * @return SecurityPolicy|null the security policy object if any - */ - public function getSecurityPolicy() - { - return $this->securityPolicy; - } - - /** - * Sets the object that must be used as a plugin proxy when plugin can't be found - * by dwoo's loader. - * - * @param IPluginProxy $pluginProxy the proxy object - * - * @return void - */ - public function setPluginProxy(IPluginProxy $pluginProxy) - { - $this->pluginProxy = $pluginProxy; - } - - /** - * Returns the current plugin proxy object or null by default. - * - * @return IPluginProxy - */ - public function getPluginProxy() - { - return $this->pluginProxy; - } - - /** - * Checks whether the given template is cached or not. - * - * @param ITemplate $tpl the template object - * - * @return bool - */ - public function isCached(ITemplate $tpl) - { - return is_string($tpl->getCachedTemplate($this)); - } - - /** - * Clear templates inside the compiled directory. - * - * @return int - */ - public function clearCompiled() - { - $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->getCompileDir()), \RecursiveIteratorIterator::SELF_FIRST); - $count = 0; - foreach ($iterator as $file) { - if ($file->isFile()) { - $count += unlink($file->__toString()) ? 1 : 0; - } - } - - return $count; - } - - /** - * Clears the cached templates if they are older than the given time. - * - * @param int $olderThan minimum time (in seconds) required for a cached template to be cleared - * - * @return int the amount of templates cleared - */ - public function clearCache($olderThan = - 1) - { - $iterator = new \RecursiveIteratorIterator(new \RecursiveDirectoryIterator($this->getCacheDir()), \RecursiveIteratorIterator::SELF_FIRST); - $expired = time() - $olderThan; - $count = 0; - foreach ($iterator as $file) { - if ($file->isFile() && $file->getCTime() < $expired) { - $count += unlink((string)$file) ? 1 : 0; - } - } - - return $count; - } - - /** - * Fetches a template object of the given resource. - * - * @param string $resourceName the resource name (i.e. file, string) - * @param string $resourceId the resource identifier (i.e. file path) - * @param int $cacheTime the cache time setting for this resource - * @param string $cacheId the unique cache identifier - * @param string $compileId the unique compiler identifier - * @param ITemplate $parentTemplate the parent template - * - * @return ITemplate - * @throws Exception - */ - public function templateFactory($resourceName, $resourceId, $cacheTime = null, $cacheId = null, $compileId = null, ITemplate $parentTemplate = null) - { - if (isset($this->resources[$resourceName])) { - /** - * Interface ITemplate - * - * @var ITemplate $class - */ - $class = $this->resources[$resourceName]['class']; - - return $class::templateFactory($this, $resourceId, $cacheTime, $cacheId, $compileId, $parentTemplate); - } - - throw new Exception('Unknown resource type : ' . $resourceName); - } - - /** - * Checks if the input is an array or arrayaccess object, optionally it can also check if it's - * empty. - * - * @param mixed $value the variable to check - * @param bool $checkIsEmpty if true, the function will also check if the array|arrayaccess is empty, - * and return true only if it's not empty - * - * @return int|bool true if it's an array|arrayaccess (or the item count if $checkIsEmpty is true) or false if it's - * not an array|arrayaccess (or 0 if $checkIsEmpty is true) - */ - public function isArray($value, $checkIsEmpty = false) - { - if (is_array($value) === true || $value instanceof ArrayAccess) { - if ($checkIsEmpty === false) { - return true; - } - - return $this->count($value); - } - - return false; - } - - /** - * Checks if the input is an array or a traversable object, optionally it can also check if it's - * empty. - * - * @param mixed $value the variable to check - * @param bool $checkIsEmpty if true, the function will also check if the array|traversable is empty, - * and return true only if it's not empty - * - * @return int|bool true if it's an array|traversable (or the item count if $checkIsEmpty is true) or false if it's - * not an array|traversable (or 0 if $checkIsEmpty is true) - */ - public function isTraversable($value, $checkIsEmpty = false) - { - if (is_array($value) === true) { - if ($checkIsEmpty === false) { - return true; - } else { - return count($value) > 0; - } - } elseif ($value instanceof Traversable) { - if ($checkIsEmpty === false) { - return true; - } else { - return $this->count($value); - } - } - - return false; - } - - /** - * Counts an array or arrayaccess/traversable object. - * - * @param mixed $value the value to count - * - * @return int|bool the count for arrays and objects that implement countable, true for other objects that don't, - * and 0 for empty elements - */ - public function count($value) - { - if (is_array($value) === true || $value instanceof Countable) { - return count($value); - } elseif ($value instanceof ArrayAccess) { - if ($value->offsetExists(0)) { - return true; - } - } elseif ($value instanceof Iterator) { - $value->rewind(); - if ($value->valid()) { - return true; - } - } elseif ($value instanceof Traversable) { - foreach ($value as $dummy) { - return true; - } - } - - return 0; - } - - /** - * Triggers a dwoo error. - * - * @param string $message the error message - * @param int $level the error level, one of the PHP's E_* constants - * - * @return void - */ - public function triggerError($message, $level = E_USER_NOTICE) - { - if (!($tplIdentifier = $this->template->getResourceIdentifier())) { - $tplIdentifier = $this->template->getResourceName(); - } - trigger_error('Dwoo error (in ' . $tplIdentifier . ') : ' . $message, $level); - } - - /** - * Adds a block to the block stack. - * - * @param string $blockName the block name (without `Plugin` prefix) - * @param array $args the arguments to be passed to the block's init() function - * - * @return BlockPlugin the newly created block - */ - public function addStack($blockName, array $args = array()) - { - if (isset($this->plugins[$blockName])) { - $class = $this->plugins[$blockName]['class']; - } else { - $class = self::NAMESPACE_PLUGINS_BLOCKS . 'Plugin' . self::toCamelCase($blockName); - } - - if ($this->curBlock !== null) { - $this->curBlock->buffer(ob_get_contents()); - ob_clean(); - } else { - $this->buffer .= ob_get_contents(); - ob_clean(); - } - - $block = new $class($this); - - call_user_func_array(array($block, 'init'), $args); - - $this->stack[] = $this->curBlock = $block; - - return $block; - } - - /** - * Removes the plugin at the top of the block stack. - * Calls the block buffer() function, followed by a call to end() and finally a call to process() - * - * @return void - */ - public function delStack() - { - $args = func_get_args(); - - $this->curBlock->buffer(ob_get_contents()); - ob_clean(); - - call_user_func_array(array($this->curBlock, 'end'), $args); - - $tmp = array_pop($this->stack); - - if (count($this->stack) > 0) { - $this->curBlock = end($this->stack); - $this->curBlock->buffer($tmp->process()); - } else { - if ($this->buffer !== '') { - echo $this->buffer; - $this->buffer = ''; - } - $this->curBlock = null; - echo $tmp->process(); - } - - unset($tmp); - } - - /** - * Returns the parent block of the given block. - * - * @param BlockPlugin $block the block class plugin - * - * @return BlockPlugin|false if the given block isn't in the stack - */ - public function getParentBlock(BlockPlugin $block) - { - $index = array_search($block, $this->stack, true); - if ($index !== false && $index > 0) { - return $this->stack[$index - 1]; - } - - return false; - } - - /** - * Finds the closest block of the given type, starting at the top of the stack. - * - * @param string $type the type of plugin you want to find - * - * @return BlockPlugin|false if no plugin of such type is in the stack - */ - public function findBlock($type) - { - if (isset($this->plugins[$type])) { - $type = $this->plugins[$type]['class']; - } else { - $type = self::NAMESPACE_PLUGINS_BLOCKS . 'Plugin_' . str_replace(self::NAMESPACE_PLUGINS_BLOCKS.'Plugin', - '', $type); - } - - $keys = array_keys($this->stack); - while (($key = array_pop($keys)) !== false) { - if ($this->stack[$key] instanceof $type) { - return $this->stack[$key]; - } - } - - return false; - } - - /** - * Returns a Plugin of the given class. - * this is so a single instance of every class plugin is created at each template run, - * allowing class plugins to have "per-template-run" static variables - * - * @param string $class the class name - * - * @return mixed an object of the given class - */ - public function getObjectPlugin($class) - { - if (isset($this->runtimePlugins[$class])) { - return $this->runtimePlugins[$class]; - } - - return $this->runtimePlugins[$class] = new $class($this); - } - - /** - * Calls the process() method of the given class-plugin name. - * - * @param string $plugName the class plugin name (without `Plugin` prefix) - * @param array $params an array of parameters to send to the process() method - * - * @return string the process() return value - */ - public function classCall($plugName, array $params = array()) - { - $class = self::toCamelCase($plugName); - $plugin = $this->getObjectPlugin($class); - - return call_user_func_array(array($plugin, 'process'), $params); - } - - /** - * Calls a php function. - * - * @param string $callback the function to call - * @param array $params an array of parameters to send to the function - * - * @return mixed the return value of the called function - */ - public function arrayMap($callback, array $params) - { - if ($params[0] === $this) { - $addThis = true; - array_shift($params); - } - if ((is_array($params[0]) || ($params[0] instanceof Iterator && $params[0] instanceof ArrayAccess))) { - if (empty($params[0])) { - return $params[0]; - } - - // array map - $out = array(); - $cnt = count($params); - - if (isset($addThis)) { - array_unshift($params, $this); - $items = $params[1]; - $keys = array_keys($items); - - if (is_string($callback) === false) { - while (($i = array_shift($keys)) !== null) { - $out[] = call_user_func_array($callback, array(1 => $items[$i]) + $params); - } - } elseif ($cnt === 1) { - while (($i = array_shift($keys)) !== null) { - $out[] = $callback($this, $items[$i]); - } - } elseif ($cnt === 2) { - while (($i = array_shift($keys)) !== null) { - $out[] = $callback($this, $items[$i], $params[2]); - } - } elseif ($cnt === 3) { - while (($i = array_shift($keys)) !== null) { - $out[] = $callback($this, $items[$i], $params[2], $params[3]); - } - } else { - while (($i = array_shift($keys)) !== null) { - $out[] = call_user_func_array($callback, array(1 => $items[$i]) + $params); - } - } - } else { - $items = $params[0]; - $keys = array_keys($items); - - if (is_string($callback) === false) { - while (($i = array_shift($keys)) !== null) { - $out[] = call_user_func_array($callback, array($items[$i]) + $params); - } - } elseif ($cnt === 1) { - while (($i = array_shift($keys)) !== null) { - $out[] = $callback($items[$i]); - } - } elseif ($cnt === 2) { - while (($i = array_shift($keys)) !== null) { - $out[] = $callback($items[$i], $params[1]); - } - } elseif ($cnt === 3) { - while (($i = array_shift($keys)) !== null) { - $out[] = $callback($items[$i], $params[1], $params[2]); - } - } elseif ($cnt === 4) { - while (($i = array_shift($keys)) !== null) { - $out[] = $callback($items[$i], $params[1], $params[2], $params[3]); - } - } else { - while (($i = array_shift($keys)) !== null) { - $out[] = call_user_func_array($callback, array($items[$i]) + $params); - } - } - } - - return $out; - } else { - return $params[0]; - } - } - - /** - * Reads a variable into the given data array. - * - * @param string $varstr the variable string, using dwoo variable syntax (i.e. "var.subvar[subsubvar]->property") - * @param mixed $data the data array or object to read from - * @param bool $safeRead if true, the function will check whether the index exists to prevent any notices from - * being output - * - * @return mixed - */ - public function readVarInto($varstr, $data, $safeRead = false) - { - if ($data === null) { - return null; - } - - if (is_array($varstr) === false) { - preg_match_all('#(\[|->|\.)?((?:[^.[\]-]|-(?!>))+)\]?#i', $varstr, $m); - } else { - $m = $varstr; - } - unset($varstr); - - foreach ($m[1] as $k => $sep) { - if ($sep === '.' || $sep === '[' || $sep === '') { - // strip enclosing quotes if present - $m[2][$k] = preg_replace('#^(["\']?)(.*?)\1$#', '$2', $m[2][$k]); - - if ((is_array($data) || $data instanceof ArrayAccess) && ($safeRead === false || isset($data[$m[2][$k]]))) { - $data = $data[$m[2][$k]]; - } else { - return null; - } - } else { - if (is_object($data) && ($safeRead === false || isset($data->{$m[2][$k]}))) { - $data = $data->{$m[2][$k]}; - } else { - return null; - } - } - } - - return $data; - } - - /** - * Reads a variable into the parent scope. - * - * @param int $parentLevels the amount of parent levels to go from the current scope - * @param string $varstr the variable string, using dwoo variable syntax (i.e. - * "var.subvar[subsubvar]->property") - * - * @return mixed - */ - public function readParentVar($parentLevels, $varstr = null) - { - $tree = $this->scopeTree; - $cur = $this->data; - - while ($parentLevels -- !== 0) { - array_pop($tree); - } - - while (($i = array_shift($tree)) !== null) { - if (is_object($cur)) { - $cur = $cur->{$i}; - } else { - $cur = $cur[$i]; - } - } - - if ($varstr !== null) { - return $this->readVarInto($varstr, $cur); - } else { - return $cur; - } - } - - /** - * Reads a variable into the current scope. - * - * @param string $varstr the variable string, using dwoo variable syntax (i.e. "var.subvar[subsubvar]->property") - * - * @return mixed - */ - public function readVar($varstr) - { - if (is_array($varstr) === true) { - $m = $varstr; - unset($varstr); - } else { - if (strstr($varstr, '.') === false && strstr($varstr, '[') === false && strstr($varstr, '->') === false) { - if ($varstr === 'dwoo') { - return $this->getGlobals(); - } elseif ($varstr === '__' || $varstr === '_root') { - return $this->data; - } elseif ($varstr === '_' || $varstr === '_parent') { - $varstr = '.' . $varstr; - $tree = $this->scopeTree; - $cur = $this->data; - array_pop($tree); - - while (($i = array_shift($tree)) !== null) { - if (is_object($cur)) { - $cur = $cur->{$i}; - } else { - $cur = $cur[$i]; - } - } - - return $cur; - } - - $cur = $this->scope; - - if (isset($cur[$varstr])) { - return $cur[$varstr]; - } else { - return null; - } - } - - if (substr($varstr, 0, 1) === '.') { - $varstr = 'dwoo' . $varstr; - } - - preg_match_all('#(\[|->|\.)?((?:[^.[\]-]|-(?!>))+)\]?#i', $varstr, $m); - } - - $i = $m[2][0]; - if ($i === 'dwoo') { - $cur = $this->getGlobals(); - array_shift($m[2]); - array_shift($m[1]); - switch ($m[2][0]) { - case 'get': - $cur = $_GET; - break; - case 'post': - $cur = $_POST; - break; - case 'session': - $cur = $_SESSION; - break; - case 'cookies': - case 'cookie': - $cur = $_COOKIE; - break; - case 'server': - $cur = $_SERVER; - break; - case 'env': - $cur = $_ENV; - break; - case 'request': - $cur = $_REQUEST; - break; - case 'const': - array_shift($m[2]); - if (defined($m[2][0])) { - return constant($m[2][0]); - } else { - return null; - } - } - if ($cur !== $this->getGlobals()) { - array_shift($m[2]); - array_shift($m[1]); - } - } elseif ($i === '__' || $i === '_root') { - $cur = $this->data; - array_shift($m[2]); - array_shift($m[1]); - } elseif ($i === '_' || $i === '_parent') { - $tree = $this->scopeTree; - $cur = $this->data; - - while (true) { - array_pop($tree); - array_shift($m[2]); - array_shift($m[1]); - if (current($m[2]) === '_' || current($m[2]) === '_parent') { - continue; - } - - while (($i = array_shift($tree)) !== null) { - if (is_object($cur)) { - $cur = $cur->{$i}; - } else { - $cur = $cur[$i]; - } - } - break; - } - } else { - $cur = $this->scope; - } - - foreach ($m[1] as $k => $sep) { - if ($sep === '.' || $sep === '[' || $sep === '') { - if ((is_array($cur) || $cur instanceof ArrayAccess) && isset($cur[$m[2][$k]])) { - $cur = $cur[$m[2][$k]]; - } else { - return null; - } - } elseif ($sep === '->') { - if (is_object($cur)) { - $cur = $cur->{$m[2][$k]}; - } else { - return null; - } - } else { - return null; - } - } - - return $cur; - } - - /** - * Assign the value to the given variable. - * - * @param mixed $value the value to assign - * @param string $scope the variable string, using dwoo variable syntax (i.e. "var.subvar[subsubvar]->property") - * - * @return bool true if assigned correctly or false if a problem occured while parsing the var string - */ - public function assignInScope($value, $scope) - { - if (!is_string($scope)) { - $this->triggerError('Assignments must be done into strings, (' . gettype($scope) . ') ' . var_export($scope, true) . ' given', E_USER_ERROR); - } - if (strstr($scope, '.') === false && strstr($scope, '->') === false) { - $this->scope[$scope] = $value; - } else { - // TODO handle _root/_parent scopes ? - preg_match_all('#(\[|->|\.)?([^.[\]-]+)\]?#i', $scope, $m); - - $cur = &$this->scope; - $last = array( - array_pop($m[1]), - array_pop($m[2]) - ); - - foreach ($m[1] as $k => $sep) { - if ($sep === '.' || $sep === '[' || $sep === '') { - if (is_array($cur) === false) { - $cur = array(); - } - $cur = &$cur[$m[2][$k]]; - } elseif ($sep === '->') { - if (is_object($cur) === false) { - $cur = new stdClass(); - } - $cur = &$cur->{$m[2][$k]}; - } else { - return false; - } - } - - if ($last[0] === '.' || $last[0] === '[' || $last[0] === '') { - if (is_array($cur) === false) { - $cur = array(); - } - $cur[$last[1]] = $value; - } elseif ($last[0] === '->') { - if (is_object($cur) === false) { - $cur = new stdClass(); - } - $cur->{$last[1]} = $value; - } else { - return false; - } - } - } - - /** - * Sets the scope to the given scope string or array. - * - * @param mixed $scope a string i.e. "level1.level2" or an array i.e. array("level1", "level2") - * @param bool $absolute if true, the scope is set from the top level scope and not from the current scope - * - * @return array the current scope tree - */ - public function setScope($scope, $absolute = false) - { - $old = $this->scopeTree; - - if (is_string($scope) === true) { - $scope = explode('.', $scope); - } - - if ($absolute === true) { - $this->scope = &$this->data; - $this->scopeTree = array(); - } - - while (($bit = array_shift($scope)) !== null) { - if ($bit === '_' || $bit === '_parent') { - array_pop($this->scopeTree); - $this->scope = &$this->data; - $cnt = count($this->scopeTree); - for ($i = 0; $i < $cnt; ++ $i) { - $this->scope = &$this->scope[$this->scopeTree[$i]]; - } - } elseif ($bit === '__' || $bit === '_root') { - $this->scope = &$this->data; - $this->scopeTree = array(); - } elseif (isset($this->scope[$bit])) { - if ($this->scope instanceof ArrayAccess) { - $tmp = $this->scope[$bit]; - $this->scope = &$tmp; - } else { - $this->scope = &$this->scope[$bit]; - } - $this->scopeTree[] = $bit; - } else { - unset($this->scope); - $this->scope = null; - } - } - - return $old; - } - - /** - * Returns the entire data array. - * - * @return array - */ - public function getData() - { - return $this->data; - } - - /** - * Sets a return value for the currently running template. - * - * @param string $name var name - * @param mixed $value var value - * - * @return void - */ - public function setReturnValue($name, $value) - { - $this->returnData[$name] = $value; - } - - /** - * Retrieves the return values set by the template. - * - * @return array - */ - public function getReturnValues() - { - return $this->returnData; - } - - /** - * Returns a reference to the current scope. - * - * @return mixed - */ - public function &getScope() - { - return $this->scope; - } - - /** - * Redirects all calls to unexisting to plugin proxy. - * - * @param string $method the method name - * @param array $args array of arguments - * - * @return mixed - * @throws Exception - */ - public function __call($method, $args) - { - $proxy = $this->getPluginProxy(); - if (!$proxy) { - throw new Exception('Call to undefined method ' . __CLASS__ . '::' . $method . '()'); - } - - return call_user_func_array($proxy->getCallback($method), $args); - } - - /** - * Convert plugin name from `auto_escape` to `AutoEscape`. - * @param string $input - * @param string $separator - * - * @return mixed - */ - public static function toCamelCase($input, $separator = '_') - { - return join(array_map('ucfirst', explode($separator, $input))); - - // TODO >= PHP5.4.32 - //return str_replace($separator, '', ucwords($input, $separator)); - } -} diff --git a/core/l/Dwoo/Data.php b/core/l/Dwoo/Data.php deleted file mode 100644 index 85226e7..0000000 --- a/core/l/Dwoo/Data.php +++ /dev/null @@ -1,264 +0,0 @@ - - * @author David Sanchez - * @copyright 2008-2013 Jordi Boggiano - * @copyright 2013-2017 David Sanchez - * @license http://dwoo.org/LICENSE Modified BSD License - * @version 1.3.4 - * @date 2017-03-01 - * @link http://dwoo.org/ - */ - -namespace Dwoo; - -/** - * Dwoo data object, use it for complex data assignments or if you want to easily pass it - * around multiple functions to avoid passing an array by reference. - * This software is provided 'as-is', without any express or implied warranty. - * In no event will the authors be held liable for any damages arising from the use of this software. - */ -class Data implements IDataProvider -{ - /** - * Data array. - * - * @var array - */ - protected $data = array(); - - /** - * Returns the data array. - * - * @return array - */ - public function getData() - { - return $this->data; - } - - /** - * Clears a the entire data or only the given key. - * - * @param array|string $name clears only one value if you give a name, multiple values if - * you give an array of names, or the entire data if left null - */ - public function clear($name = null) - { - if ($name === null) { - $this->data = array(); - } elseif (is_array($name)) { - foreach ($name as $index) { - unset($this->data[$index]); - } - } else { - unset($this->data[$name]); - } - } - - /** - * Overwrites the entire data with the given array. - * - * @param array $data the new data array to use - */ - public function setData(array $data) - { - $this->data = $data; - } - - /** - * merges the given array(s) with the current data with array_merge. - * - * @param array $data the array to merge - */ - public function mergeData(array $data) - { - $args = func_get_args(); - foreach ($args as $key => $v) { - if (is_array($v)) { - $this->data = array_merge($this->data, $v); - } - } - } - - /** - * Assigns a value or an array of values to the data object. - * - * @param array|string $name an associative array of multiple (index=>value) or a string - * that is the index to use, i.e. a value assigned to "foo" will be - * accessible in the template through {$foo} - * @param mixed $val the value to assign, or null if $name was an array - */ - public function assign($name, $val = null) - { - if (is_array($name)) { - reset($name); - foreach ($name as $k => $v){ - $this->data[$k] = $v; - } - } else { - $this->data[$name] = $val; - } - } - - /** - * Allows to assign variables using the object syntax. - * - * @param string $name the variable name - * @param string $value the value to assign to it - */ - public function __set($name, $value) - { - $this->assign($name, $value); - } - - /** - * Assigns a value by reference to the data object. - * - * @param string $name the index to use, i.e. a value assigned to "foo" will be - * accessible in the template through {$foo} - * @param mixed $val the value to assign by reference - */ - public function assignByRef($name, &$val) - { - $this->data[$name] = &$val; - } - - /** - * Appends values or an array of values to the data object. - * - * @param array|string $name an associative array of multiple (index=>value) or a string - * that is the index to use, i.e. a value assigned to "foo" will be - * accessible in the template through {$foo} - * @param mixed $val the value to assign, or null if $name was an array - * @param bool $merge true to merge data or false to append, defaults to false - */ - public function append($name, $val = null, $merge = false) - { - if (is_array($name)) { - foreach ($name as $key => $val) { - if (isset($this->data[$key]) && !is_array($this->data[$key])) { - settype($this->data[$key], 'array'); - } - - if ($merge === true && is_array($val)) { - $this->data[$key] = $val + $this->data[$key]; - } else { - $this->data[$key][] = $val; - } - } - } elseif ($val !== null) { - if (isset($this->data[$name]) && !is_array($this->data[$name])) { - settype($this->data[$name], 'array'); - } elseif (!isset($this->data[$name])) { - $this->data[$name] = array(); - } - - if ($merge === true && is_array($val)) { - $this->data[$name] = $val + $this->data[$name]; - } else { - $this->data[$name][] = $val; - } - } - } - - /** - * Appends a value by reference to the data object. - * - * @param string $name the index to use, i.e. a value assigned to "foo" will be - * accessible in the template through {$foo} - * @param mixed $val the value to append by reference - * @param bool $merge true to merge data or false to append, defaults to false - */ - public function appendByRef($name, &$val, $merge = false) - { - if (isset($this->data[$name]) && !is_array($this->data[$name])) { - settype($this->data[$name], 'array'); - } - - if ($merge === true && is_array($val)) { - foreach ($val as $key => &$value) { - $this->data[$name][$key] = &$value; - } - } else { - $this->data[$name][] = &$val; - } - } - - /** - * Returns true if the variable has been assigned already, false otherwise. - * - * @param string $name the variable name - * - * @return bool - */ - public function isAssigned($name) - { - return isset($this->data[$name]); - } - - /** - * Supports calls to isset($dwoo->var). - * - * @param string $name the variable name - * - * @return bool - */ - public function __isset($name) - { - return isset($this->data[$name]); - } - - /** - * Unassigns/removes a variable. - * - * @param string $name the variable name - */ - public function unassign($name) - { - unset($this->data[$name]); - } - - /** - * Supports unsetting variables using the object syntax. - * - * @param string $name the variable name - */ - public function __unset($name) - { - unset($this->data[$name]); - } - - /** - * Returns a variable if it was assigned. - * - * @param string $name the variable name - * - * @return mixed - */ - public function get($name) - { - return $this->__get($name); - } - - /** - * Allows to read variables using the object syntax. - * - * @param string $name the variable name - * - * @return mixed - * @throws Exception - */ - public function __get($name) - { - if (isset($this->data[$name])) { - return $this->data[$name]; - } else { - throw new Exception('Tried to read a value that was not assigned yet : "' . $name . '"'); - } - } -} diff --git a/core/l/Dwoo/Exception.php b/core/l/Dwoo/Exception.php deleted file mode 100644 index f61795f..0000000 --- a/core/l/Dwoo/Exception.php +++ /dev/null @@ -1,26 +0,0 @@ - - * @author David Sanchez - * @copyright 2008-2013 Jordi Boggiano - * @copyright 2013-2016 David Sanchez - * @license http://dwoo.org/LICENSE Modified BSD License - * @version 1.3.0 - * @date 2016-09-19 - * @link http://dwoo.org/ - */ - -namespace Dwoo; - -/** - * Main dwoo exception class. - * This software is provided 'as-is', without any express or implied warranty. - * In no event will the authors be held liable for any damages arising from the use of this software. - */ -class Exception extends \Exception -{ -} diff --git a/core/l/Dwoo/Filter.php b/core/l/Dwoo/Filter.php deleted file mode 100644 index 5fdb4ed..0000000 --- a/core/l/Dwoo/Filter.php +++ /dev/null @@ -1,52 +0,0 @@ - - * @author David Sanchez - * @copyright 2008-2013 Jordi Boggiano - * @copyright 2013-2016 David Sanchez - * @license http://dwoo.org/LICENSE Modified BSD License - * @version 1.3.0 - * @date 2016-09-19 - * @link http://dwoo.org/ - */ - -namespace Dwoo; - -/** - * Base class for filters. - * This software is provided 'as-is', without any express or implied warranty. - * In no event will the authors be held liable for any damages arising from the use of this software. - */ -abstract class Filter -{ - /** - * The dwoo instance that runs this filter. - * - * @var Core - */ - protected $dwoo; - - /** - * Constructor, if you override it, call parent::__construct($dwoo); or assign - * the dwoo instance yourself if you need it. - * - * @param Core $dwoo the dwoo instance that runs this plugin - */ - public function __construct(Core $dwoo) - { - $this->dwoo = $dwoo; - } - - /** - * Processes the input and returns it filtered. - * - * @param string $input the template to process - * - * @return string - */ - abstract public function process($input); -} diff --git a/core/l/Dwoo/ICompilable.php b/core/l/Dwoo/ICompilable.php deleted file mode 100644 index 40e1155..0000000 --- a/core/l/Dwoo/ICompilable.php +++ /dev/null @@ -1,31 +0,0 @@ - - * @author David Sanchez - * @copyright 2008-2013 Jordi Boggiano - * @copyright 2013-2016 David Sanchez - * @license http://dwoo.org/LICENSE Modified BSD License - * @version 1.3.0 - * @date 2016-09-23 - * @link http://dwoo.org/ - */ - -namespace Dwoo; - -/** - * Interface that represents a compilable plugin. - * implement this to notify the compiler that this plugin does not need to be loaded at runtime. - * to implement it right, you must implement public static function compile(Compiler $compiler, $arg, $arg, - * ...), which replaces the process() method (that means compile() should have all arguments it - * requires). This software is provided 'as-is', without any express or implied warranty. In no event will the authors - * be held liable for any damages arising from the use of this software. - */ -interface ICompilable -{ - // this replaces the process function - //public static function compile(Compiler $compiler, $arg, $arg, ...); -} diff --git a/core/l/Dwoo/ICompilable/Block.php b/core/l/Dwoo/ICompilable/Block.php deleted file mode 100644 index 241db4e..0000000 --- a/core/l/Dwoo/ICompilable/Block.php +++ /dev/null @@ -1,27 +0,0 @@ - - * @author David Sanchez - * @copyright 2008-2013 Jordi Boggiano - * @copyright 2013-2016 David Sanchez - * @license http://dwoo.org/LICENSE Modified BSD License - * @version 1.3.0 - * @date 2016-09-19 - * @link http://dwoo.org/ - */ - -namespace Dwoo\ICompilable; - -/** - * Interface that represents a compilable block plugin. - * implement this to notify the compiler that this plugin does not need to be loaded at runtime. - * This software is provided 'as-is', without any express or implied warranty. - * In no event will the authors be held liable for any damages arising from the use of this software. - */ -interface Block -{ -} diff --git a/core/l/Dwoo/ICompiler.php b/core/l/Dwoo/ICompiler.php deleted file mode 100644 index 619aaab..0000000 --- a/core/l/Dwoo/ICompiler.php +++ /dev/null @@ -1,59 +0,0 @@ - - * @author David Sanchez - * @copyright 2008-2013 Jordi Boggiano - * @copyright 2013-2017 David Sanchez - * @license http://dwoo.org/LICENSE LGPLv3 - * @version 1.3.6 - * @date 2017-03-21 - * @link http://dwoo.org/ - */ - -namespace Dwoo; - -use Dwoo\Security\Policy as SecurityPolicy; - -/** - * Interface that represents a dwoo compiler. - * while implementing this is enough to interact with Dwoo/Templates, it is not - * sufficient to interact with Dwoo/Plugins, however the main purpose of creating a - * new compiler would be to interact with other/different plugins, that is why this - * interface has been left with the minimum requirements. - * This software is provided 'as-is', without any express or implied warranty. - * In no event will the authors be held liable for any damages arising from the use of this software. - */ -interface ICompiler -{ - /** - * Compiles the provided string down to php code. - * - * @param Core $core - * @param ITemplate $template the template to compile - * - * @return string a compiled php code string - */ - public function compile(Core $core, ITemplate $template); - - /** - * Adds the custom plugins loaded into Dwoo to the compiler so it can load them. - * - * @see Core::addPlugin - * - * @param array $customPlugins an array of custom plugins - */ - public function setCustomPlugins(array $customPlugins); - - /** - * Sets the security policy object to enforce some php security settings. - * use this if untrusted persons can modify templates, - * set it on the Dwoo object as it will be passed onto the compiler automatically - * - * @param SecurityPolicy $policy the security policy object - */ - public function setSecurityPolicy(SecurityPolicy $policy = null); -} diff --git a/core/l/Dwoo/IDataProvider.php b/core/l/Dwoo/IDataProvider.php deleted file mode 100644 index 9392b2d..0000000 --- a/core/l/Dwoo/IDataProvider.php +++ /dev/null @@ -1,32 +0,0 @@ - - * @author David Sanchez - * @copyright 2008-2013 Jordi Boggiano - * @copyright 2013-2016 David Sanchez - * @license http://dwoo.org/LICENSE Modified BSD License - * @version 1.3.0 - * @date 2016-09-23 - * @link http://dwoo.org/ - */ - -namespace Dwoo; - -/** - * Interface that represents a dwoo data object. - * This software is provided 'as-is', without any express or implied warranty. - * In no event will the authors be held liable for any damages arising from the use of this software. - */ -interface IDataProvider -{ - /** - * Returns the data as an associative array that will be used in the template. - * - * @return array - */ - public function getData(); -} diff --git a/core/l/Dwoo/IElseable.php b/core/l/Dwoo/IElseable.php deleted file mode 100644 index b8f3483..0000000 --- a/core/l/Dwoo/IElseable.php +++ /dev/null @@ -1,30 +0,0 @@ - - * @author David Sanchez - * @copyright 2008-2013 Jordi Boggiano - * @copyright 2013-2016 David Sanchez - * @license http://dwoo.org/LICENSE Modified BSD License - * @version 1.3.0 - * @date 2016-09-19 - * @link http://dwoo.org/ - */ - -namespace Dwoo; - -/** - * Interface that represents a block plugin that supports the else functionality. - * the else block will enter an "hasElse" parameter inside the parameters array - * of the closest parent implementing this interface, the hasElse parameter contains - * the else output that should be appended to the block's content (see foreach or other - * block for examples) - * This software is provided 'as-is', without any express or implied warranty. - * In no event will the authors be held liable for any damages arising from the use of this software. - */ -interface IElseable -{ -} diff --git a/core/l/Dwoo/ILoader.php b/core/l/Dwoo/ILoader.php deleted file mode 100644 index febf202..0000000 --- a/core/l/Dwoo/ILoader.php +++ /dev/null @@ -1,37 +0,0 @@ - - * @author David Sanchez - * @copyright 2008-2013 Jordi Boggiano - * @copyright 2013-2016 David Sanchez - * @license http://dwoo.org/LICENSE Modified BSD License - * @version 1.3.0 - * @date 2016-09-23 - * @link http://dwoo.org/ - */ - -namespace Dwoo; - -/** - * Interface for dwoo plugin loaders. - * This software is provided 'as-is', without any express or implied warranty. - * In no event will the authors be held liable for any damages arising from the use of this software. - */ -interface ILoader -{ - /** - * Loads a plugin file. - * the second parameter is used to avoid permanent rehashing when using php functions, - * however this means that if you have add a plugin that overrides a php function you have - * to delete the classpath.cache file(s) by hand to force a rehash of the plugins - * - * @param string $class the plugin name, without the `Plugin` prefix - * @param bool $forceRehash if true, the class path caches will be rebuilt if the plugin is not found, in case it - * has just been added, defaults to true - */ - public function loadPlugin($class, $forceRehash = true); -} diff --git a/core/l/Dwoo/IPluginProxy.php b/core/l/Dwoo/IPluginProxy.php deleted file mode 100644 index d20f3f7..0000000 --- a/core/l/Dwoo/IPluginProxy.php +++ /dev/null @@ -1,74 +0,0 @@ - - * @author David Sanchez - * @copyright 2008-2013 Jordi Boggiano - * @copyright 2013-2016 David Sanchez - * @license http://dwoo.org/LICENSE Modified BSD License - * @version 1.3.0 - * @date 2016-09-23 - * @link http://dwoo.org/ - */ - -namespace Dwoo; - -/** - * Interface that represents a dwoo plugin proxy. - * This software is provided 'as-is', without any express or implied warranty. - * In no event will the authors be held liable for any damages arising from the use of this software. - */ -interface IPluginProxy -{ - /** - * Returns true or false to say whether the given plugin is handled by this proxy or not. - * - * @param string $name the plugin name - * - * @return bool true if the plugin is known and usable, otherwise false - */ - public function handles($name); - - /** - * Returns the code (as a string) to call the plugin - * (this will be executed at runtime inside the Dwoo class). - * - * @param string $name the plugin name - * @param array $params a parameter array, array key "*" is the rest array - * - * @return string - */ - public function getCode($name, $params); - - /** - * Returns a callback to the plugin, this is used with the reflection API to - * find out about the plugin's parameter names etc. - * should you need a rest array without the possibility to edit the - * plugin's code, you can provide a callback to some - * other function with the correct parameter signature, i.e. : - * - * return array($this, "callbackHelper"); - * // and callbackHelper would be as such: - * public function callbackHelper(array $rest=array()){} - * - * - * @param string $name the plugin name - * - * @return callback - */ - public function getCallback($name); - - /** - * Returns some code that will check if the plugin is loaded and if not load it - * this is optional, if your plugins are autoloaded or whatever, just return an - * empty string. - * - * @param string $name the plugin name - * - * @return string - */ - public function getLoader($name); -} diff --git a/core/l/Dwoo/ITemplate.php b/core/l/Dwoo/ITemplate.php deleted file mode 100644 index 6fa65f3..0000000 --- a/core/l/Dwoo/ITemplate.php +++ /dev/null @@ -1,161 +0,0 @@ - - * @author David Sanchez - * @copyright 2008-2013 Jordi Boggiano - * @copyright 2013-2017 David Sanchez - * @license http://dwoo.org/LICENSE Modified BSD License - * @version 1.3.4 - * @date 2017-03-07 - * @link http://dwoo.org/ - */ - -namespace Dwoo; - -/** - * Interface that represents a dwoo template. - * This software is provided 'as-is', without any express or implied warranty. - * In no event will the authors be held liable for any damages arising from the use of this software. - */ -interface ITemplate -{ - /** - * Returns the cache duration for this template. - * defaults to null if it was not provided - * - * @return int|null - */ - public function getCacheTime(); - - /** - * Sets the cache duration for this template. - * can be used to set it after the object is created if you did not provide - * it in the constructor - * - * @param int $seconds duration of the cache validity for this template, if - * null it defaults to the Dwoo instance's cache time. 0 = disable and - * -1 = infinite cache - */ - public function setCacheTime($seconds = null); - - /** - * Returns the cached template output file name, true if it's cache-able but not cached - * or false if it's not cached. - * - * @param Core $core the dwoo instance that requests it - * - * @return string|bool - */ - public function getCachedTemplate(Core $core); - - /** - * Caches the provided output into the cache file. - * - * @param Core $core the dwoo instance that requests it - * @param string $output the template output - * - * @return mixed full path of the cached file or false upon failure - */ - public function cache(Core $core, $output); - - /** - * Clears the cached template if it's older than the given time. - * - * @param Core $core the dwoo instance that was used to cache that template - * @param int $olderThan minimum time (in seconds) required for the cache to be cleared - * - * @return bool true if the cache was not present or if it was deleted, false if it remains there - */ - public function clearCache(Core $core, $olderThan = - 1); - - /** - * Returns the compiled template file name. - * - * @param Core $core the dwoo instance that requests it - * @param ICompiler $compiler the compiler that must be used - * - * @return string - */ - public function getCompiledTemplate(Core $core, ICompiler $compiler = null); - - /** - * Returns the template name. - * - * @return string - */ - public function getName(); - - /** - * Returns the resource name for this template class. - * - * @return string - */ - public function getResourceName(); - - /** - * Returns the resource identifier for this template or false if it has no identifier. - * - * @return string|false - */ - public function getResourceIdentifier(); - - /** - * Returns the template source of this template. - * - * @return string - */ - public function getSource(); - - /** - * Returns an unique string identifying the current version of this template, - * for example a timestamp of the last modified date or a hash of the template source. - * - * @return string - */ - public function getUid(); - - /** - * Returns the compiler used by this template, if it was just compiled, or null. - * - * @return ICompiler - */ - public function getCompiler(); - - /** - * Returns some php code that will check if this template has been modified or not. - * if the function returns null, the template will be instanciated and then the Uid checked - * - * @return string - */ - public function getIsModifiedCode(); - - /** - * Returns a new template object from the given resource identifier, null if no include is - * possible (resource not found), or false if include is not permitted by this resource type. - * this method should also check if $dwoo->getSecurityPolicy() is null or not and do the - * necessary permission checks if required, if the security policy prevents the template - * generation it should throw a new Security\Exception with a relevant message - * - * @param Core $core - * @param mixed $resourceId the resource identifier - * @param int $cacheTime duration of the cache validity for this template, if null it defaults to the - * Dwoo instance that will render this template if null it defaults to the Dwoo - * instance that will render this template - * @param string $cacheId the unique cache identifier of this page or anything else that makes this - * template's content unique, if null it defaults to the current url makes this - * template's content unique, if null it defaults to the current url - * @param string $compileId the unique compiled identifier, which is used to distinguish this template from - * others, if null it defaults to the filename+bits of the path template from - * others, if null it defaults to the filename+bits of the path - * @param ITemplate $parentTemplate the template that is requesting a new template object (through an include, - * extends or any other plugin) an include, extends or any other plugin) - * - * @return ITemplate|false|null - */ - public static function templateFactory(Core $core, $resourceId, $cacheTime = null, $cacheId = null, - $compileId = null, ITemplate $parentTemplate = null); -} diff --git a/core/l/Dwoo/Loader.php b/core/l/Dwoo/Loader.php deleted file mode 100644 index db6f88a..0000000 --- a/core/l/Dwoo/Loader.php +++ /dev/null @@ -1,181 +0,0 @@ - - * @author David Sanchez - * @copyright 2008-2013 Jordi Boggiano - * @copyright 2013-2017 David Sanchez - * @license http://dwoo.org/LICENSE LGPLv3 - * @version 1.4.0 - * @date 2017-03-16 - * @link http://dwoo.org/ - */ - -namespace Dwoo; - -/** - * Handles plugin loading and caching of plugins names/paths relationships. - * This software is provided 'as-is', without any express or implied warranty. - * In no event will the authors be held liable for any damages arising from the use of this software. - */ -class Loader implements ILoader -{ - /** - * Stores the plugin directories. - * - * @see addDirectory - * @var array - */ - protected $paths = array(); - - /** - * Stores the plugins names/paths relationships - * don't edit this on your own, use addDirectory. - * - * @see addDirectory - * @var array - */ - protected $classPath = array(); - - /** - * Path where class paths cache files are written. - * - * @var string - */ - protected $cacheDir; - - /** - * Path where builtin plugins are stored. - * - * @var string - */ - protected $corePluginDir; - - /** - * Loader constructor. - * - * @param $cacheDir - */ - public function __construct($cacheDir) - { - $this->corePluginDir = __DIR__ . DIRECTORY_SEPARATOR; - $this->cacheDir = rtrim($cacheDir, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR; - - // include class paths or rebuild paths if the cache file isn't there - $cacheFile = $this->cacheDir . 'classpath.cache.d' . Core::RELEASE_TAG . '.php'; - if (file_exists($cacheFile)) { - $classpath = file_get_contents($cacheFile); - $this->classPath = unserialize($classpath) + $this->classPath; - } else { - $this->rebuildClassPathCache($this->corePluginDir, $cacheFile); - } - } - - /** - * Rebuilds class paths, scans the given directory recursively and saves all paths in the given file. - * - * @param string $path the plugin path to scan - * @param string|boolean $cacheFile the file where to store the plugin paths cache, it will be overwritten - * - * @throws Exception - */ - protected function rebuildClassPathCache($path, $cacheFile) - { - $tmp = array(); - if ($cacheFile !== false) { - $tmp = $this->classPath; - $this->classPath = array(); - } - - // iterates over all files/folders - foreach (new \DirectoryIterator($path) as $fileInfo) { - if (!$fileInfo->isDot()) { - if ($fileInfo->isDir()) { - $this->rebuildClassPathCache($fileInfo->getPathname(), false); - } else { - $this->classPath[$fileInfo->getBasename('.php')] = $fileInfo->getPathname(); - } - } - } - - // save in file if it's the first call (not recursed) - if ($cacheFile !== false) { - if (!file_put_contents($cacheFile, serialize($this->classPath))) { - throw new Exception('Could not write into ' . $cacheFile . ', either because the folder is not there (create it) or because of the chmod configuration (please ensure this directory is writable by php), alternatively you can change the directory used with $dwoo->setCompileDir() or provide a custom loader object with $dwoo->setLoader()'); - } - $this->classPath += $tmp; - } - } - - /** - * Loads a plugin file. - * - * @param string $class the plugin name, without the `Plugin` prefix - * @param bool $forceRehash if true, the class path caches will be rebuilt if the plugin is not found, in case it - * has just been added, defaults to true - * - * @throws Exception - */ - public function loadPlugin($class, $forceRehash = true) - { - /** - * An unknown class was requested (maybe newly added) or the - * include failed so we rebuild the cache. include() will fail - * with an uncatchable error if the file doesn't exist, which - * usually means that the cache is stale and must be rebuilt, - * so we check for that before trying to include() the plugin. - */ - if ((!isset($this->classPath[$class]) || !is_readable($this->classPath[$class])) || (!isset - ($this->classPath[$class . 'Compile']) || !is_readable($this->classPath[$class . 'Compile']))) { - if ($forceRehash) { - $this->rebuildClassPathCache($this->corePluginDir, $this->cacheDir . 'classpath.cache.d' . - Core::RELEASE_TAG . '.php'); - foreach ($this->paths as $path => $file) { - $this->rebuildClassPathCache($path, $file); - } - if (isset($this->classPath[$class])) { - include_once $this->classPath[$class]; - } elseif (isset($this->classPath[$class . 'Compile'])) { - include_once $this->classPath[$class . 'Compile']; - } else { - throw new Exception('Plugin "' . $class . '" can not be found, maybe you forgot to bind it if it\'s a custom plugin ?', E_USER_NOTICE); - } - } else { - throw new Exception('Plugin "' . $class . '" can not be found, maybe you forgot to bind it if it\'s a custom plugin ?', E_USER_NOTICE); - } - } - } - - /** - * Adds a plugin directory, the plugins found in the new plugin directory - * will take precedence over the other directories (including the default - * dwoo plugin directory), you can use this for example to override plugins - * in a specific directory for a specific application while keeping all your - * usual plugins in the same place for all applications. - * TOCOM don't forget that php functions overrides are not rehashed so you - * need to clear the classpath caches by hand when adding those. - * - * @param string $pluginDirectory the plugin path to scan - * - * @throws Exception - */ - public function addDirectory($pluginDirectory) - { - $pluginDir = realpath($pluginDirectory); - if (!$pluginDir) { - throw new Exception('Plugin directory does not exist or can not be read : ' . $pluginDirectory); - } - $cacheFile = $this->cacheDir . 'classpath-' . substr(strtr($pluginDir, '/\\:' . PATH_SEPARATOR, '----'), - strlen($pluginDir) > 80 ? - 80 : 0) . '.d' . Core::RELEASE_TAG . '.php'; - $this->paths[$pluginDir] = $cacheFile; - if (file_exists($cacheFile)) { - $classpath = file_get_contents($cacheFile); - $this->classPath = unserialize($classpath) + $this->classPath; - } else { - $this->rebuildClassPathCache($pluginDir, $cacheFile); - } - } -} diff --git a/core/l/Dwoo/Plugin.php b/core/l/Dwoo/Plugin.php deleted file mode 100644 index c607806..0000000 --- a/core/l/Dwoo/Plugin.php +++ /dev/null @@ -1,105 +0,0 @@ - - * @author David Sanchez - * @copyright 2008-2013 Jordi Boggiano - * @copyright 2013-2016 David Sanchez - * @license http://dwoo.org/LICENSE Modified BSD License - * @version 1.3.0 - * @date 2016-09-23 - * @link http://dwoo.org/ - */ - -namespace Dwoo; - -/** - * Base plugin class. - * you have to implement the process() method, it will receive the parameters that - * are in the template code - * This software is provided 'as-is', without any express or implied warranty. - * In no event will the authors be held liable for any damages arising from the use of this software. - */ -abstract class Plugin -{ - /** - * The dwoo instance that runs this plugin. - * - * @var Core - */ - protected $core; - - /** - * Constructor, if you override it, call parent::__construct($core); or assign - * the dwoo instance yourself if you need it. - * - * @param Core $core the dwoo instance that runs this plugin - */ - public function __construct(Core $core) - { - $this->core = $core; - } - - // plugins should always implement : - // public function process($arg, $arg, ...) - // or for block plugins : - // public function init($arg, $arg, ...) - - // this could be enforced with : - // abstract public function process(...); - // if my feature request gets enough interest one day - // see => http://bugs.php.net/bug.php?id=44043 - - /** - * Utility function that converts an array of compiled parameters (or rest array) to a string of xml/html tag - * attributes. this is to be used in preProcessing or postProcessing functions, example : - * $p = $compiler->getCompiledParams($params); - * // get only the rest array as attributes - * $attributes = Plugin::paramsToAttributes($p['*']); - * // get all the parameters as attributes (if there is a rest array, it will be included) - * $attributes = Plugin::paramsToAttributes($p); - * - * @param array $params an array of attributeName=>value items that will be compiled to be ready for inclusion in a php string - * inclusion in a php string - * @param string $delim the string delimiter you want to use (defaults to ') - * @param Compiler $compiler the compiler instance (optional for BC, but recommended to pass it for proper escaping behavior) - * escaping behavior) - * - * @return string - */ - public static function paramsToAttributes(array $params, $delim = '\'', Compiler $compiler = null) - { - if (isset($params['*'])) { - $params = array_merge($params, $params['*']); - unset($params['*']); - } - - $out = ''; - foreach ($params as $attr => $val) { - $out .= ' ' . $attr . '='; - if (trim($val, '"\'') == '' || $val == 'null') { - $out .= str_replace($delim, '\\' . $delim, '""'); - } elseif (substr($val, 0, 1) === $delim && substr($val, - 1) === $delim) { - $out .= str_replace($delim, '\\' . $delim, '"' . substr($val, 1, - 1) . '"'); - } else { - if (!$compiler) { - // disable double encoding since it can not be determined if it was encoded - $escapedVal = '.(is_string($tmp2=' . $val . ') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset, false) : $tmp2).'; - } elseif (!$compiler->getAutoEscape() || false === strpos($val, 'isset($this->scope')) { - // escape if auto escaping is disabled, or there was no variable in the string - $escapedVal = '.(is_string($tmp2=' . $val . ') ? htmlspecialchars($tmp2, ENT_QUOTES, $this->charset) : $tmp2).'; - } else { - // print as is - $escapedVal = '.' . $val . '.'; - } - - $out .= str_replace($delim, '\\' . $delim, '"') . $delim . $escapedVal . $delim . str_replace($delim, '\\' . $delim, '"'); - } - } - - return ltrim($out); - } -} diff --git a/core/l/Dwoo/Plugins/Blocks/PluginA.php b/core/l/Dwoo/Plugins/Blocks/PluginA.php deleted file mode 100644 index 6210d84..0000000 --- a/core/l/Dwoo/Plugins/Blocks/PluginA.php +++ /dev/null @@ -1,95 +0,0 @@ - - * @author David Sanchez - * @copyright 2008-2013 Jordi Boggiano - * @copyright 2013-2016 David Sanchez - * @license http://dwoo.org/LICENSE Modified BSD License - * @version 1.3.0 - * @date 2016-09-19 - * @link http://dwoo.org/ - */ - -namespace Dwoo\Plugins\Blocks; - -use Dwoo\Compiler; -use Dwoo\Block\Plugin as BlockPlugin; -use Dwoo\ICompilable\Block as ICompilableBlock; - -/** - * Outputs a html <a> tag - *
- *  * href : the target URI where the link must point
- *  * rest : any other attributes you want to add to the tag can be added as named parameters
- * 
. - * Example : - * - * {* Create a simple link out of an url variable and add a special class attribute: *} - * {a $url class="external" /} - * {* Mark a link as active depending on some other variable : *} - * {a $link.url class=tif($link.active "active"); $link.title /} - * {* This is similar to: {$link.title} *} - * - * This software is provided 'as-is', without any express or implied warranty. - * In no event will the authors be held liable for any damages arising from the use of this software. - */ -class PluginA extends BlockPlugin implements ICompilableBlock -{ - /** - * @param $href - * @param array $rest - */ - public function init($href, array $rest = array()) - { - } - - /** - * @param Compiler $compiler - * @param array $params - * @param string $prepend - * @param string $append - * @param string $type - * - * @return string - */ - public static function preProcessing(Compiler $compiler, array $params, $prepend, $append, $type) - { - $p = $compiler->getCompiledParams($params); - - $out = Compiler::PHP_OPEN . 'echo \'\';' . Compiler::PHP_CLOSE; - } - - /** - * @param Compiler $compiler - * @param array $params - * @param string $prepend - * @param string $append - * @param string $content - * - * @return string - */ - public static function postProcessing(Compiler $compiler, array $params, $prepend, $append, $content) - { - $p = $compiler->getCompiledParams($params); - - // no content was provided so use the url as display text - if ($content == '') { - // merge into the href if href is a string - if (substr($p['href'], - 1) === '"' || substr($p['href'], - 1) === '\'') { - return Compiler::PHP_OPEN . 'echo ' . substr($p['href'], 0, - 1) . '' . substr($p['href'], - 1) . ';' . Compiler::PHP_CLOSE; - } - - // otherwise append - return Compiler::PHP_OPEN . 'echo ' . $p['href'] . '.\'\';' . Compiler::PHP_CLOSE; - } - - // return content - return $content . ''; - } -} diff --git a/core/l/Dwoo/Plugins/Blocks/PluginAutoEscape.php b/core/l/Dwoo/Plugins/Blocks/PluginAutoEscape.php deleted file mode 100644 index 7b45ec9..0000000 --- a/core/l/Dwoo/Plugins/Blocks/PluginAutoEscape.php +++ /dev/null @@ -1,98 +0,0 @@ - - * @author David Sanchez - * @copyright 2008-2013 Jordi Boggiano - * @copyright 2013-2016 David Sanchez - * @license http://dwoo.org/LICENSE Modified BSD License - * @version 1.3.0 - * @date 2016-09-19 - * @link http://dwoo.org/ - */ - -namespace Dwoo\Plugins\Blocks; - -use Dwoo\Compiler; -use Dwoo\Block\Plugin as BlockPlugin; -use Dwoo\ICompilable\Block as ICompilableBlock; -use Dwoo\Compilation\Exception as CompilationException; - -/** - * Overrides the compiler auto-escape setting within the block - *
- *  * enabled : if set to "on", "enable", true or 1 then the compiler autoescaping is enabled inside this block. set to
- *  "off", "disable", false or 0 to disable it
- * 
- * This software is provided 'as-is', without any express or implied warranty. - * In no event will the authors be held liable for any damages arising from the use of this software. - */ -class PluginAutoEscape extends BlockPlugin implements ICompilableBlock -{ - protected static $stack = array(); - - /** - * @param $enabled - */ - public function init($enabled) - { - } - - /** - * @param Compiler $compiler - * @param array $params - * @param string $prepend - * @param string $append - * @param string $type - * - * @return string - * @throws CompilationException - */ - public static function preProcessing(Compiler $compiler, array $params, $prepend, $append, $type) - { - $params = $compiler->getCompiledParams($params); - switch (strtolower(trim((string)$params['enabled'], '"\''))) { - - case 'on': - case 'true': - case 'enabled': - case 'enable': - case '1': - $enable = true; - break; - case 'off': - case 'false': - case 'disabled': - case 'disable': - case '0': - $enable = false; - break; - default: - throw new CompilationException($compiler, 'Auto_Escape : Invalid parameter (' . $params['enabled'] . '), valid parameters are "enable"/true or "disable"/false'); - } - - self::$stack[] = $compiler->getAutoEscape(); - $compiler->setAutoEscape($enable); - - return ''; - } - - /** - * @param Compiler $compiler - * @param array $params - * @param string $prepend - * @param string $append - * @param string $content - * - * @return string - */ - public static function postProcessing(Compiler $compiler, array $params, $prepend, $append, $content) - { - $compiler->setAutoEscape(array_pop(self::$stack)); - - return $content; - } -} diff --git a/core/l/Dwoo/Plugins/Blocks/PluginBlock.php b/core/l/Dwoo/Plugins/Blocks/PluginBlock.php deleted file mode 100644 index 7e66182..0000000 --- a/core/l/Dwoo/Plugins/Blocks/PluginBlock.php +++ /dev/null @@ -1,66 +0,0 @@ - - * @author David Sanchez - * @copyright 2008-2013 Jordi Boggiano - * @copyright 2013-2016 David Sanchez - * @license http://dwoo.org/LICENSE Modified BSD License - * @version 1.3.0 - * @date 2016-09-19 - * @link http://dwoo.org/ - */ - -namespace Dwoo\Plugins\Blocks; - -use Dwoo\Compiler; -use Dwoo\Block\Plugin as BlockPlugin; -use Dwoo\ICompilable\Block as ICompilableBlock; - -/** - * This is used only when rendering a template that has blocks but is not extending anything, - * it doesn't do anything by itself and should not be used outside of template inheritance context, - * see {@link http://wiki.dwoo.org/index.php/TemplateInheritance} to read more about it. - * This software is provided 'as-is', without any express or implied warranty. - * In no event will the authors be held liable for any damages arising from the use of this software. - */ -class PluginBlock extends BlockPlugin implements ICompilableBlock -{ - /** - * @param string $name - */ - public function init($name = '') - { - } - - /** - * @param Compiler $compiler - * @param array $params - * @param string $prepend - * @param string $append - * @param string $type - * - * @return string - */ - public static function preProcessing(Compiler $compiler, array $params, $prepend, $append, $type) - { - return ''; - } - - /** - * @param Compiler $compiler - * @param array $params - * @param string $prepend - * @param string $append - * @param string $content - * - * @return string - */ - public static function postProcessing(Compiler $compiler, array $params, $prepend, $append, $content) - { - return $content; - } -} diff --git a/core/l/Dwoo/Plugins/Blocks/PluginCapture.php b/core/l/Dwoo/Plugins/Blocks/PluginCapture.php deleted file mode 100644 index f8c9c03..0000000 --- a/core/l/Dwoo/Plugins/Blocks/PluginCapture.php +++ /dev/null @@ -1,95 +0,0 @@ - - * @author David Sanchez - * @copyright 2008-2013 Jordi Boggiano - * @copyright 2013-2016 David Sanchez - * @license http://dwoo.org/LICENSE Modified BSD License - * @version 1.3.0 - * @date 2016-09-19 - * @link http://dwoo.org/ - */ - -namespace Dwoo\Plugins\Blocks; - -use Dwoo\Compiler; -use Dwoo\Block\Plugin as BlockPlugin; -use Dwoo\ICompilable\Block as ICompilableBlock; - -/** - * Captures all the output within this block and saves it into {$.capture.default} by default, - * or {$.capture.name} if you provide another name. - *
- *  * name : capture name, used to read the value afterwards
- *  * assign : if set, the value is also saved in the given variable
- *  * cat : if true, the value is appended to the previous one (if any) instead of overwriting it
- * 
- * If the cat parameter is true, the content - * will be appended to the existing content. - * Example : - * - * {capture "foo"} - * Anything in here won't show, it will be saved for later use.. - * {/capture} - * Output was : {$.capture.foo} - * - * This software is provided 'as-is', without any express or implied warranty. - * In no event will the authors be held liable for any damages arising from the use of this software. - */ -class PluginCapture extends BlockPlugin implements ICompilableBlock -{ - /** - * @param string $name - * @param null $assign - * @param bool $cat - * @param bool $trim - */ - public function init($name = 'default', $assign = null, $cat = false, $trim = false) - { - } - - /** - * @param Compiler $compiler - * @param array $params - * @param string $prepend - * @param string $append - * @param string $type - * - * @return string - */ - public static function preProcessing(Compiler $compiler, array $params, $prepend, $append, $type) - { - return Compiler::PHP_OPEN . $prepend . 'ob_start();' . $append . Compiler::PHP_CLOSE; - } - - /** - * @param Compiler $compiler - * @param array $params - * @param string $prepend - * @param string $append - * @param string $content - * - * @return string - */ - public static function postProcessing(Compiler $compiler, array $params, $prepend, $append, $content) - { - $params = $compiler->getCompiledParams($params); - - $out = $content . Compiler::PHP_OPEN . $prepend . "\n" . '$tmp = ob_get_clean();'; - if ($params['trim'] !== 'false' && $params['trim'] !== 0) { - $out .= "\n" . '$tmp = trim($tmp);'; - } - if ($params['cat'] === 'true' || $params['cat'] === 1) { - $out .= "\n" . '$tmp = $this->readVar(\'dwoo.capture.\'.' . $params['name'] . ') . $tmp;'; - } - if ($params['assign'] !== 'null') { - $out .= "\n" . '$this->scope[' . $params['assign'] . '] = $tmp;'; - } - - return $out . "\n" . '$this->globals[\'capture\'][' . $params['name'] . '] = $tmp;' . $append . Compiler::PHP_CLOSE; - } -} diff --git a/core/l/Dwoo/Plugins/Blocks/PluginDynamic.php b/core/l/Dwoo/Plugins/Blocks/PluginDynamic.php deleted file mode 100644 index 3b1f61a..0000000 --- a/core/l/Dwoo/Plugins/Blocks/PluginDynamic.php +++ /dev/null @@ -1,116 +0,0 @@ - - * @author David Sanchez - * @copyright 2008-2013 Jordi Boggiano - * @copyright 2013-2016 David Sanchez - * @license http://dwoo.org/LICENSE Modified BSD License - * @version 1.3.0 - * @date 2016-09-19 - * @link http://dwoo.org/ - */ - -namespace Dwoo\Plugins\Blocks; - -use Dwoo\Compiler; -use Dwoo\Block\Plugin as BlockPlugin; -use Dwoo\ICompilable\Block as ICompilableBlock; -use Dwoo\Compilation\Exception as CompilationException; - -/** - * Marks the contents of the block as dynamic. Which means that it will not be cached. - * This software is provided 'as-is', without any express or implied warranty. - * In no event will the authors be held liable for any damages arising from the use of this software. - */ -class PluginDynamic extends BlockPlugin implements ICompilableBlock -{ - /** - * - */ - public function init() - { - } - - /** - * @param Compiler $compiler - * @param array $params - * @param string $prepend - * @param string $append - * @param string $type - * - * @return string - */ - public static function preProcessing(Compiler $compiler, array $params, $prepend, $append, $type) - { - return ''; - } - - /** - * @param Compiler $compiler - * @param array $params - * @param string $prepend - * @param string $append - * @param string $content - * - * @return string - */ - public static function postProcessing(Compiler $compiler, array $params, $prepend, $append, $content) - { - try { - $compiler->findBlock('dynamic'); - - return $content; - } - catch (CompilationException $e) { - } - $output = Compiler::PHP_OPEN . 'if($doCache) {' . "\n\t" . 'echo \'' . str_replace('\'', '\\\'', $content) . '\';' . "\n} else {\n\t"; - if (substr($content, 0, strlen(Compiler::PHP_OPEN)) == Compiler::PHP_OPEN) { - $output .= substr($content, strlen(Compiler::PHP_OPEN)); - } else { - $output .= Compiler::PHP_CLOSE . $content; - } - if (substr($output, - strlen(Compiler::PHP_CLOSE)) == Compiler::PHP_CLOSE) { - $output = substr($output, 0, - strlen(Compiler::PHP_CLOSE)); - } else { - $output .= Compiler::PHP_OPEN; - } - $output .= "\n}" . Compiler::PHP_CLOSE; - - return $output; - } - - /** - * @param $output - * @param $dynamicId - * @param $compiledFile - * - * @return mixed|string - */ - public static function unescape($output, $dynamicId, $compiledFile) - { - $output = preg_replace_callback('/(.+?)<\/dwoo:dynamic_' . $dynamicId . '>/s', array( - 'self', - 'unescapePhp' - ), $output, - 1, $count); - // re-add the includes on top of the file - if ($count && preg_match('#/\* template head \*/(.+?)/\* end template head \*/#s', file_get_contents($compiledFile), $m)) { - $output = '' . $output; - } - - return $output; - } - - /** - * @param $match - * - * @return mixed - */ - public static function unescapePhp($match) - { - return preg_replace('{<\?php /\*' . $match[1] . '\*/ echo \'(.+?)\'; \?>}s', '$1', $match[2]); - } -} diff --git a/core/l/Dwoo/Plugins/Blocks/PluginElse.php b/core/l/Dwoo/Plugins/Blocks/PluginElse.php deleted file mode 100644 index 14143a2..0000000 --- a/core/l/Dwoo/Plugins/Blocks/PluginElse.php +++ /dev/null @@ -1,96 +0,0 @@ - - * @author David Sanchez - * @copyright 2008-2013 Jordi Boggiano - * @copyright 2013-2016 David Sanchez - * @license http://dwoo.org/LICENSE Modified BSD License - * @version 1.3.0 - * @date 2016-09-19 - * @link http://dwoo.org/ - */ - -namespace Dwoo\Plugins\Blocks; - -use Dwoo\Compiler; -use Dwoo\Block\Plugin as BlockPlugin; -use Dwoo\ICompilable\Block as ICompilableBlock; -use Dwoo\Compilation\Exception as CompilationException; - -/** - * Generic else block, it supports all builtin optional-display blocks which are if/for/foreach/loop/with. - * If any of those block contains an else statement, the content between {else} and {/block} (you do not - * need to close the else block) will be shown if the block's condition has no been met - * Example : - * - * {foreach $array val} - * $array is not empty so we display it's values : {$val} - * {else} - * if this shows, it means that $array is empty or doesn't exist. - * {/foreach} - * - * This software is provided 'as-is', without any express or implied warranty. - * In no event will the authors be held liable for any damages arising from the use of this software. - */ -class PluginElse extends BlockPlugin implements ICompilableBlock -{ - public function init() - { - } - - /** - * @param Compiler $compiler - * @param array $params - * @param string $prepend - * @param string $append - * @param string $type - * - * @return string - * @throws CompilationException - */ - public static function preProcessing(Compiler $compiler, array $params, $prepend, $append, $type) - { - $preContent = ''; - while (true) { - $preContent .= $compiler->removeTopBlock(); - $block = &$compiler->getCurrentBlock(); - if (!$block) { - throw new CompilationException($compiler, 'An else block was found but it was not preceded by an if or other else-able construct'); - } - $interfaces = class_implements($block['class']); - if (in_array('Dwoo\IElseable', $interfaces) !== false) { - break; - } - } - - $params['initialized'] = true; - $compiler->injectBlock($type, $params); - - return $preContent; - } - - /** - * @param Compiler $compiler - * @param array $params - * @param string $prepend - * @param string $append - * @param string $content - * - * @return string - */ - public static function postProcessing(Compiler $compiler, array $params, $prepend, $append, $content) - { - if (!isset($params['initialized'])) { - return ''; - } - - $block = &$compiler->getCurrentBlock(); - $block['params']['hasElse'] = Compiler::PHP_OPEN . "else {\n" . Compiler::PHP_CLOSE . $content . Compiler::PHP_OPEN . "\n}" . Compiler::PHP_CLOSE; - - return ''; - } -} diff --git a/core/l/Dwoo/Plugins/Blocks/PluginElseif.php b/core/l/Dwoo/Plugins/Blocks/PluginElseif.php deleted file mode 100644 index 033aa59..0000000 --- a/core/l/Dwoo/Plugins/Blocks/PluginElseif.php +++ /dev/null @@ -1,95 +0,0 @@ - - * @author David Sanchez - * @copyright 2008-2013 Jordi Boggiano - * @copyright 2013-2016 David Sanchez - * @license http://dwoo.org/LICENSE Modified BSD License - * @version 1.3.0 - * @date 2016-09-19 - * @link http://dwoo.org/ - */ - -namespace Dwoo\Plugins\Blocks; - -use Dwoo\Compiler; -use Dwoo\IElseable; -use Dwoo\ICompilable\Block as ICompilableBlock; - -/** - * Acts as a php elseif block, allowing you to add one more condition - * if the previous one(s) didn't match. See the {if} plugin for syntax details. - * This software is provided 'as-is', without any express or implied warranty. - * In no event will the authors be held liable for any damages arising from the use of this software. - */ -class PluginElseif extends PluginIf implements ICompilableBlock, IElseable -{ - /** - * @param array $rest - */ - public function init(array $rest) - { - } - - /** - * @param Compiler $compiler - * @param array $params - * @param string $prepend - * @param string $append - * @param string $type - * - * @return string - */ - public static function preProcessing(Compiler $compiler, array $params, $prepend, $append, $type) - { - $preContent = ''; - while (true) { - $preContent .= $compiler->removeTopBlock(); - $block = &$compiler->getCurrentBlock(); - $interfaces = class_implements($block['class']); - if (in_array('Dwoo\IElseable', $interfaces) !== false) { - break; - } - } - - $params['initialized'] = true; - $compiler->injectBlock($type, $params); - - return $preContent; - } - - /** - * @param Compiler $compiler - * @param array $params - * @param string $prepend - * @param string $append - * @param string $content - * - * @return string - */ - public static function postProcessing(Compiler $compiler, array $params, $prepend, $append, $content) - { - if (!isset($params['initialized'])) { - return ''; - } - - $tokens = $compiler->getParamTokens($params); - $params = $compiler->getCompiledParams($params); - - $pre = Compiler::PHP_OPEN . 'elseif (' . implode(' ', self::replaceKeywords($params['*'], $tokens['*'], $compiler)) . ") {\n" . Compiler::PHP_CLOSE; - $post = Compiler::PHP_OPEN . "\n}" . Compiler::PHP_CLOSE; - - if (isset($params['hasElse'])) { - $post .= $params['hasElse']; - } - - $block = &$compiler->getCurrentBlock(); - $block['params']['hasElse'] = $pre . $content . $post; - - return ''; - } -} diff --git a/core/l/Dwoo/Plugins/Blocks/PluginFor.php b/core/l/Dwoo/Plugins/Blocks/PluginFor.php deleted file mode 100644 index b696094..0000000 --- a/core/l/Dwoo/Plugins/Blocks/PluginFor.php +++ /dev/null @@ -1,192 +0,0 @@ - - * @author David Sanchez - * @copyright 2008-2013 Jordi Boggiano - * @copyright 2013-2016 David Sanchez - * @license http://dwoo.org/LICENSE Modified BSD License - * @version 1.3.0 - * @date 2016-09-19 - * @link http://dwoo.org/ - */ - -namespace Dwoo\Plugins\Blocks; - -use Dwoo\Compiler; -use Dwoo\IElseable; -use Dwoo\Block\Plugin as BlockPlugin; -use Dwoo\ICompilable\Block as ICompilableBlock; - -/** - * Similar to the php for block - *
- *  * name : for name to access it's iterator variables through {$.for.name.var} see {@link
- *  http://wiki.dwoo.org/index.php/IteratorVariables} for details
- *  * from : array to iterate from (which equals 0) or a number as a start value
- *  * to : value to stop iterating at (equals count($array) by default if you set an array in from)
- *  * step : defines the incrementation of the pointer at each iteration
- * 
- * This software is provided 'as-is', without any express or implied warranty. - * In no event will the authors be held liable for any damages arising from the use of this software. - */ -class PluginFor extends BlockPlugin implements ICompilableBlock, IElseable -{ - public static $cnt = 0; - - /** - * @param $name - * @param $from - * @param null $to - * @param int $step - * @param int $skip - */ - public function init($name, $from, $to = null, $step = 1, $skip = 0) - { - } - - /** - * @param Compiler $compiler - * @param array $params - * @param string $prepend - * @param string $append - * @param string $type - * - * @return string - */ - public static function preProcessing(Compiler $compiler, array $params, $prepend, $append, $type) - { - // get block params and save the current template pointer to use it in the postProcessing method - $currentBlock = &$compiler->getCurrentBlock(); - $currentBlock['params']['tplPointer'] = $compiler->getPointer(); - - return ''; - } - - /** - * @param Compiler $compiler - * @param array $params - * @param string $prepend - * @param string $append - * @param string $content - * - * @return string - */ - public static function postProcessing(Compiler $compiler, array $params, $prepend, $append, $content) - { - $params = $compiler->getCompiledParams($params); - $tpl = $compiler->getTemplateSource($params['tplPointer']); - - // assigns params - $from = $params['from']; - $name = $params['name']; - $step = $params['step']; - $to = $params['to']; - - // evaluates which global variables have to be computed - $varName = '$dwoo.for.' . trim($name, '"\'') . '.'; - $shortVarName = '$.for.' . trim($name, '"\'') . '.'; - $usesAny = strpos($tpl, $varName) !== false || strpos($tpl, $shortVarName) !== false; - $usesFirst = strpos($tpl, $varName . 'first') !== false || strpos($tpl, $shortVarName . 'first') !== false; - $usesLast = strpos($tpl, $varName . 'last') !== false || strpos($tpl, $shortVarName . 'last') !== false; - $usesIndex = strpos($tpl, $varName . 'index') !== false || strpos($tpl, $shortVarName . 'index') !== false; - $usesIteration = $usesFirst || $usesLast || strpos($tpl, $varName . 'iteration') !== false || strpos($tpl, $shortVarName . 'iteration') !== false; - $usesShow = strpos($tpl, $varName . 'show') !== false || strpos($tpl, $shortVarName . 'show') !== false; - $usesTotal = $usesLast || strpos($tpl, $varName . 'total') !== false || strpos($tpl, $shortVarName . 'total') !== false; - - if (strpos($name, '$this->scope[') !== false) { - $usesAny = $usesFirst = $usesLast = $usesIndex = $usesIteration = $usesShow = $usesTotal = true; - } - - // gets foreach id - $cnt = self::$cnt ++; - - // builds pre processing output for - $out = Compiler::PHP_OPEN . "\n" . '$_for' . $cnt . '_from = ' . $from . ';' . "\n" . '$_for' . $cnt . '_to = ' . $to . ';' . "\n" . '$_for' . $cnt . '_step = abs(' . $step . ');' . "\n" . 'if (is_numeric($_for' . $cnt . '_from) && !is_numeric($_for' . $cnt . '_to)) { $this->triggerError(\'For requires the to parameter when using a numerical from\'); }' . "\n" . '$tmp_shows = $this->isArray($_for' . $cnt . '_from, true) || (is_numeric($_for' . $cnt . '_from) && (abs(($_for' . $cnt . '_from - $_for' . $cnt . '_to)/$_for' . $cnt . '_step) !== 0 || $_for' . $cnt . '_from == $_for' . $cnt . '_to));'; - // adds for properties - if ($usesAny) { - $out .= "\n" . '$this->globals["for"][' . $name . '] = array' . "\n("; - if ($usesIndex) { - $out .= "\n\t" . '"index" => 0,'; - } - if ($usesIteration) { - $out .= "\n\t" . '"iteration" => 1,'; - } - if ($usesFirst) { - $out .= "\n\t" . '"first" => null,'; - } - if ($usesLast) { - $out .= "\n\t" . '"last" => null,'; - } - if ($usesShow) { - $out .= "\n\t" . '"show" => $tmp_shows,'; - } - if ($usesTotal) { - $out .= "\n\t" . '"total" => $this->isArray($_for' . $cnt . '_from) ? floor($this->count($_for' . $cnt . '_from) / $_for' . $cnt . '_step) : (is_numeric($_for' . $cnt . '_from) ? abs(($_for' . $cnt . '_to + 1 - $_for' . $cnt . '_from)/$_for' . $cnt . '_step) : 0),'; - } - $out .= "\n);\n" . '$_for' . $cnt . '_glob =& $this->globals["for"][' . $name . '];'; - } - // checks if for must be looped - $out .= "\n" . 'if ($tmp_shows)' . "\n{"; - // set from/to to correct values if an array was given - $out .= "\n\t" . 'if ($this->isArray($_for' . $cnt . '_from' . (isset($params['hasElse']) ? ', true' : '') . ') == true) { - $_for' . $cnt . '_to = is_numeric($_for' . $cnt . '_to) ? $_for' . $cnt . '_to - $_for' . $cnt . '_step : $this->count($_for' . $cnt . '_from) - 1; - $_for' . $cnt . '_from = 0; - }'; - - // if input are pure numbers it shouldn't reorder them, if it's variables it gets too messy though so in that case a counter should be used - $reverse = false; - $condition = '<='; - $incrementer = '+'; - - if (preg_match('{^(["\']?)([0-9]+)\1$}', $from, $mN1) && preg_match('{^(["\']?)([0-9]+)\1$}', $to, $mN2)) { - $from = (int)$mN1[2]; - $to = (int)$mN2[2]; - if ($from > $to) { - $reverse = true; - $condition = '>='; - $incrementer = '-'; - } - } - - // reverse from and to if needed - if (!$reverse) { - $out .= "\n\t" . 'if ($_for' . $cnt . '_from > $_for' . $cnt . '_to) { - $tmp = $_for' . $cnt . '_from; - $_for' . $cnt . '_from = $_for' . $cnt . '_to; - $_for' . $cnt . '_to = $tmp; - }'; - } - - $out .= "\n\t" . 'for ($this->scope[' . $name . '] = $_for' . $cnt . '_from; $this->scope[' . $name . '] ' . $condition . ' $_for' . $cnt . '_to; $this->scope[' . $name . '] ' . $incrementer . '= $_for' . $cnt . '_step)' . "\n\t{"; - // updates properties - if ($usesIndex) { - $out .= "\n\t\t" . '$_for' . $cnt . '_glob["index"] = $this->scope[' . $name . '];'; - } - if ($usesFirst) { - $out .= "\n\t\t" . '$_for' . $cnt . '_glob["first"] = (string) ($_for' . $cnt . '_glob["iteration"] === 1);'; - } - if ($usesLast) { - $out .= "\n\t\t" . '$_for' . $cnt . '_glob["last"] = (string) ($_for' . $cnt . '_glob["iteration"] === $_for' . $cnt . '_glob["total"]);'; - } - $out .= "\n/* -- for start output */\n" . Compiler::PHP_CLOSE; - - // build post processing output and cache it - $postOut = Compiler::PHP_OPEN . '/* -- for end output */'; - // update properties - if ($usesIteration) { - $postOut .= "\n\t\t" . '$_for' . $cnt . '_glob["iteration"]+=1;'; - } - // end loop - $postOut .= "\n\t}\n}\n" . Compiler::PHP_CLOSE; - - if (isset($params['hasElse'])) { - $postOut .= $params['hasElse']; - } - - return $out . $content . $postOut; - } -} diff --git a/core/l/Dwoo/Plugins/Blocks/PluginForeach.php b/core/l/Dwoo/Plugins/Blocks/PluginForeach.php deleted file mode 100644 index 3817d7f..0000000 --- a/core/l/Dwoo/Plugins/Blocks/PluginForeach.php +++ /dev/null @@ -1,201 +0,0 @@ - - * @author David Sanchez - * @copyright 2008-2013 Jordi Boggiano - * @copyright 2013-2016 David Sanchez - * @license http://dwoo.org/LICENSE Modified BSD License - * @version 1.3.0 - * @date 2016-09-19 - * @link http://dwoo.org/ - */ - -namespace Dwoo\Plugins\Blocks; - -use Dwoo\Compiler; -use Dwoo\IElseable; -use Dwoo\Block\Plugin as BlockPlugin; -use Dwoo\ICompilable\Block as ICompilableBlock; -use Dwoo\Compilation\Exception as CompilationException; - -/** - * Similar to the php foreach block, loops over an array. - * Note that if you don't provide the item parameter, the key will act as item - *
- *  * from : the array that you want to iterate over
- *  * key : variable name for the key (or for the item if item is not defined)
- *  * item : variable name for each item
- *  * name : foreach name to access it's iterator variables through {$.foreach.name.var} see {@link
- *  http://wiki.dwoo.org/index.php/IteratorVariables} for details
- * 
- * Example : - * - * {foreach $array val} - * {$val.something} - * {/foreach} - * - * This software is provided 'as-is', without any express or implied warranty. - * In no event will the authors be held liable for any damages arising from the use of this software. - */ -class PluginForeach extends BlockPlugin implements ICompilableBlock, IElseable -{ - public static $cnt = 0; - - /** - * @param $from - * @param null $key - * @param null $item - * @param string $name - * @param null $implode - */ - public function init($from, $key = null, $item = null, $name = 'default', $implode = null) - { - } - - /** - * @param Compiler $compiler - * @param array $params - * @param string $prepend - * @param string $append - * @param string $type - * - * @return string - */ - public static function preProcessing(Compiler $compiler, array $params, $prepend, $append, $type) - { - // get block params and save the current template pointer to use it in the postProcessing method - $currentBlock = &$compiler->getCurrentBlock(); - $currentBlock['params']['tplPointer'] = $compiler->getPointer(); - - return ''; - } - - /** - * @param Compiler $compiler - * @param array $params - * @param string $prepend - * @param string $append - * @param string $content - * - * @return string - * @throws CompilationException - */ - public static function postProcessing(Compiler $compiler, array $params, $prepend, $append, $content) - { - $params = $compiler->getCompiledParams($params); - $tpl = $compiler->getTemplateSource($params['tplPointer']); - - // assigns params - $src = $params['from']; - - if ($params['item'] !== 'null') { - if ($params['key'] !== 'null') { - $key = $params['key']; - } - $val = $params['item']; - } elseif ($params['key'] !== 'null') { - $val = $params['key']; - } else { - throw new CompilationException($compiler, 'Foreach item parameter missing'); - } - $name = $params['name']; - - if (substr($val, 0, 1) !== '"' && substr($val, 0, 1) !== '\'') { - throw new CompilationException($compiler, 'Foreach item parameter must be of type string'); - } - if (isset($key) && substr($val, 0, 1) !== '"' && substr($val, 0, 1) !== '\'') { - throw new CompilationException($compiler, 'Foreach key parameter must be of type string'); - } - - // evaluates which global variables have to be computed - $varName = '$dwoo.foreach.' . trim($name, '"\'') . '.'; - $shortVarName = '$.foreach.' . trim($name, '"\'') . '.'; - $usesAny = strpos($tpl, $varName) !== false || strpos($tpl, $shortVarName) !== false; - $usesFirst = strpos($tpl, $varName . 'first') !== false || strpos($tpl, $shortVarName . 'first') !== false; - $usesLast = strpos($tpl, $varName . 'last') !== false || strpos($tpl, $shortVarName . 'last') !== false; - $usesIndex = $usesFirst || strpos($tpl, $varName . 'index') !== false || strpos($tpl, $shortVarName . 'index') !== false; - $usesIteration = $usesLast || strpos($tpl, $varName . 'iteration') !== false || strpos($tpl, $shortVarName . 'iteration') !== false; - $usesShow = strpos($tpl, $varName . 'show') !== false || strpos($tpl, $shortVarName . 'show') !== false; - $usesTotal = $usesLast || strpos($tpl, $varName . 'total') !== false || strpos($tpl, $shortVarName . 'total') !== false; - - if (strpos($name, '$this->scope[') !== false) { - $usesAny = $usesFirst = $usesLast = $usesIndex = $usesIteration = $usesShow = $usesTotal = true; - } - - // override globals vars if implode is used - if ($params['implode'] !== 'null') { - $implode = $params['implode']; - $usesAny = true; - $usesLast = true; - $usesIteration = true; - $usesTotal = true; - } - - // gets foreach id - $cnt = self::$cnt ++; - - // build pre content output - $pre = Compiler::PHP_OPEN . "\n" . '$_fh' . $cnt . '_data = ' . $src . ';'; - // adds foreach properties - if ($usesAny) { - $pre .= "\n" . '$this->globals["foreach"][' . $name . '] = array' . "\n("; - if ($usesIndex) { - $pre .= "\n\t" . '"index" => 0,'; - } - if ($usesIteration) { - $pre .= "\n\t" . '"iteration" => 1,'; - } - if ($usesFirst) { - $pre .= "\n\t" . '"first" => null,'; - } - if ($usesLast) { - $pre .= "\n\t" . '"last" => null,'; - } - if ($usesShow) { - $pre .= "\n\t" . '"show" => $this->isArray($_fh' . $cnt . '_data, true),'; - } - if ($usesTotal) { - $pre .= "\n\t" . '"total" => $this->count($_fh' . $cnt . '_data),'; - } - $pre .= "\n);\n" . '$_fh' . $cnt . '_glob =& $this->globals["foreach"][' . $name . '];'; - } - // checks if foreach must be looped - $pre .= "\n" . 'if ($this->isTraversable($_fh' . $cnt . '_data' . (isset($params['hasElse']) ? ', true' : '') . ') == true)' . "\n{"; - // iterates over keys - $pre .= "\n\t" . 'foreach ($_fh' . $cnt . '_data as ' . (isset($key) ? '$this->scope[' . $key . ']=>' : '') . '$this->scope[' . $val . '])' . "\n\t{"; - // updates properties - if ($usesFirst) { - $pre .= "\n\t\t" . '$_fh' . $cnt . '_glob["first"] = (string) ($_fh' . $cnt . '_glob["index"] === 0);'; - } - if ($usesLast) { - $pre .= "\n\t\t" . '$_fh' . $cnt . '_glob["last"] = (string) ($_fh' . $cnt . '_glob["iteration"] === $_fh' . $cnt . '_glob["total"]);'; - } - $pre .= "\n/* -- foreach start output */\n" . Compiler::PHP_CLOSE; - - // build post content output - $post = Compiler::PHP_OPEN . "\n"; - - if (isset($implode)) { - $post .= '/* -- implode */' . "\n" . 'if (!$_fh' . $cnt . '_glob["last"]) {' . "\n\t" . 'echo ' . $implode . ";\n}\n"; - } - $post .= '/* -- foreach end output */'; - // update properties - if ($usesIndex) { - $post .= "\n\t\t" . '$_fh' . $cnt . '_glob["index"]+=1;'; - } - if ($usesIteration) { - $post .= "\n\t\t" . '$_fh' . $cnt . '_glob["iteration"]+=1;'; - } - // end loop - $post .= "\n\t}\n}" . Compiler::PHP_CLOSE; - if (isset($params['hasElse'])) { - $post .= $params['hasElse']; - } - - return $pre . $content . $post; - } -} diff --git a/core/l/Dwoo/Plugins/Blocks/PluginForeachelse.php b/core/l/Dwoo/Plugins/Blocks/PluginForeachelse.php deleted file mode 100644 index 5a09327..0000000 --- a/core/l/Dwoo/Plugins/Blocks/PluginForeachelse.php +++ /dev/null @@ -1,73 +0,0 @@ - - * @author David Sanchez - * @copyright 2008-2013 Jordi Boggiano - * @copyright 2013-2016 David Sanchez - * @license http://dwoo.org/LICENSE Modified BSD License - * @version 1.3.0 - * @date 2016-09-19 - * @link http://dwoo.org/ - */ - -namespace Dwoo\Plugins\Blocks; - -use Dwoo\Compiler; -use Dwoo\Block\Plugin as BlockPlugin; -use Dwoo\ICompilable\Block as ICompilableBlock; - -/** - * This plugin serves as a {else} block specifically for the {foreach} plugin. - * This software is provided 'as-is', without any express or implied warranty. - * In no event will the authors be held liable for any damages arising from the use of this software. - */ -class PluginForeachelse extends BlockPlugin implements ICompilableBlock -{ - public function init() - { - } - - /** - * @param Compiler $compiler - * @param array $params - * @param string $prepend - * @param string $append - * @param string $type - * - * @return string - */ - public static function preProcessing(Compiler $compiler, array $params, $prepend, $append, $type) - { - $with = &$compiler->findBlock('foreach', true); - - $params['initialized'] = true; - $compiler->injectBlock($type, $params); - - return ''; - } - - /** - * @param Compiler $compiler - * @param array $params - * @param string $prepend - * @param string $append - * @param string $content - * - * @return string - */ - public static function postProcessing(Compiler $compiler, array $params, $prepend, $append, $content) - { - if (!isset($params['initialized'])) { - return ''; - } - - $block = &$compiler->getCurrentBlock(); - $block['params']['hasElse'] = Compiler::PHP_OPEN . "else {\n" . Compiler::PHP_CLOSE . $content . Compiler::PHP_OPEN . "\n}" . Compiler::PHP_CLOSE; - - return ''; - } -} diff --git a/core/l/Dwoo/Plugins/Blocks/PluginForelse.php b/core/l/Dwoo/Plugins/Blocks/PluginForelse.php deleted file mode 100644 index 4d4a588..0000000 --- a/core/l/Dwoo/Plugins/Blocks/PluginForelse.php +++ /dev/null @@ -1,73 +0,0 @@ - - * @author David Sanchez - * @copyright 2008-2013 Jordi Boggiano - * @copyright 2013-2016 David Sanchez - * @license http://dwoo.org/LICENSE Modified BSD License - * @version 1.3.0 - * @date 2016-09-19 - * @link http://dwoo.org/ - */ - -namespace Dwoo\Plugins\Blocks; - -use Dwoo\Compiler; -use Dwoo\Block\Plugin as BlockPlugin; -use Dwoo\ICompilable\Block as ICompilableBlock; - -/** - * This plugin serves as a {else} block specifically for the {for} plugin. - * This software is provided 'as-is', without any express or implied warranty. - * In no event will the authors be held liable for any damages arising from the use of this software. - */ -class PluginForelse extends BlockPlugin implements ICompilableBlock -{ - public function init() - { - } - - /** - * @param Compiler $compiler - * @param array $params - * @param string $prepend - * @param string $append - * @param string $type - * - * @return string - */ - public static function preProcessing(Compiler $compiler, array $params, $prepend, $append, $type) - { - $with = &$compiler->findBlock('for', true); - - $params['initialized'] = true; - $compiler->injectBlock($type, $params); - - return ''; - } - - /** - * @param Compiler $compiler - * @param array $params - * @param string $prepend - * @param string $append - * @param string $content - * - * @return string - */ - public static function postProcessing(Compiler $compiler, array $params, $prepend, $append, $content) - { - if (!isset($params['initialized'])) { - return ''; - } - - $block = &$compiler->getCurrentBlock(); - $block['params']['hasElse'] = Compiler::PHP_OPEN . "else {\n" . Compiler::PHP_CLOSE . $content . Compiler::PHP_OPEN . "\n}" . Compiler::PHP_CLOSE; - - return ''; - } -} diff --git a/core/l/Dwoo/Plugins/Blocks/PluginIf.php b/core/l/Dwoo/Plugins/Blocks/PluginIf.php deleted file mode 100644 index d982327..0000000 --- a/core/l/Dwoo/Plugins/Blocks/PluginIf.php +++ /dev/null @@ -1,274 +0,0 @@ - - * @author David Sanchez - * @copyright 2008-2013 Jordi Boggiano - * @copyright 2013-2016 David Sanchez - * @license http://dwoo.org/LICENSE Modified BSD License - * @version 1.3.0 - * @date 2016-09-19 - * @link http://dwoo.org/ - */ - -namespace Dwoo\Plugins\Blocks; - -use Dwoo\Compiler; -use Dwoo\IElseable; -use Dwoo\Block\Plugin as BlockPlugin; -use Dwoo\ICompilable\Block as ICompilableBlock; -use Dwoo\Compilation\Exception as CompilationException; - -/** - * Conditional block, the syntax is very similar to the php one, allowing () || && and - * other php operators. Additional operators and their equivalent php syntax are as follow :. - * eq -> == - * neq or ne -> != - * gte or ge -> >= - * lte or le -> <= - * gt -> > - * lt -> < - * mod -> % - * not -> ! - * X is [not] div by Y -> (X % Y) == 0 - * X is [not] even [by Y] -> (X % 2) == 0 or ((X/Y) % 2) == 0 - * X is [not] odd [by Y] -> (X % 2) != 0 or ((X/Y) % 2) != 0 - * This software is provided 'as-is', without any express or implied warranty. - * In no event will the authors be held liable for any damages arising from the use of this software. - */ -class PluginIf extends BlockPlugin implements ICompilableBlock, IElseable -{ - /** - * @param array $rest - */ - public function init(array $rest) - { - } - - /** - * @param array $params - * @param array $tokens - * @param Compiler $compiler - * - * @return array - * @throws CompilationException - */ - public static function replaceKeywords(array $params, array $tokens, Compiler $compiler) - { - $p = array(); - - reset($params); - while (list($k, $v) = each($params)) { - $v = (string)$v; - if (substr($v, 0, 1) === '"' || substr($v, 0, 1) === '\'') { - $vmod = strtolower(substr($v, 1, - 1)); - } else { - $vmod = strtolower($v); - } - switch ($vmod) { - - case 'and': - if ($tokens[$k] === Compiler::T_UNQUOTED_STRING) { - $p[] = '&&'; - } else { - $p[] = $v; - } - break; - case 'or': - if ($tokens[$k] === Compiler::T_UNQUOTED_STRING) { - $p[] = '||'; - } else { - $p[] = $v; - } - break; - case 'xor': - if ($tokens[$k] === Compiler::T_UNQUOTED_STRING) { - $p[] = '^'; - } else { - $p[] = $v; - } - break; - case 'eq': - if ($tokens[$k] === Compiler::T_UNQUOTED_STRING) { - $p[] = '=='; - } else { - $p[] = $v; - } - break; - case 'ne': - case 'neq': - if ($tokens[$k] === Compiler::T_UNQUOTED_STRING) { - $p[] = '!='; - } else { - $p[] = $v; - } - break; - case 'gte': - case 'ge': - if ($tokens[$k] === Compiler::T_UNQUOTED_STRING) { - $p[] = '>='; - } else { - $p[] = $v; - } - break; - case 'lte': - case 'le': - if ($tokens[$k] === Compiler::T_UNQUOTED_STRING) { - $p[] = '<='; - } else { - $p[] = $v; - } - break; - case 'gt': - if ($tokens[$k] === Compiler::T_UNQUOTED_STRING) { - $p[] = '>'; - } else { - $p[] = $v; - } - break; - case 'lt': - if ($tokens[$k] === Compiler::T_UNQUOTED_STRING) { - $p[] = '<'; - } else { - $p[] = $v; - } - break; - case 'mod': - if ($tokens[$k] === Compiler::T_UNQUOTED_STRING) { - $p[] = '%'; - } else { - $p[] = $v; - } - break; - case 'not': - if ($tokens[$k] === Compiler::T_UNQUOTED_STRING) { - $p[] = '!'; - } else { - $p[] = $v; - } - break; - case '<>': - $p[] = '!='; - break; - case '==': - case '!=': - case '>=': - case '<=': - case '>': - case '<': - case '===': - case '!==': - case '%': - case '!': - case '^': - $p[] = $vmod; - break; - case 'is': - if ($tokens[$k] !== Compiler::T_UNQUOTED_STRING) { - $p[] = $v; - break; - } - if (isset($params[$k + 1]) && strtolower(trim($params[$k + 1], '"\'')) === 'not' && $tokens[$k + 1] === Compiler::T_UNQUOTED_STRING) { - $negate = true; - next($params); - } else { - $negate = false; - } - $ptr = 1 + (int)$negate; - if ($tokens[$k + $ptr] !== Compiler::T_UNQUOTED_STRING) { - break; - } - if (!isset($params[$k + $ptr])) { - $params[$k + $ptr] = ''; - } else { - $params[$k + $ptr] = trim($params[$k + $ptr], '"\''); - } - switch ($params[$k + $ptr]) { - - case 'div': - if (isset($params[$k + $ptr + 1]) && strtolower(trim($params[$k + $ptr + 1], '"\'')) === 'by') { - $p[] = ' % ' . $params[$k + $ptr + 2] . ' ' . ($negate ? '!' : '=') . '== 0'; - next($params); - next($params); - next($params); - } else { - throw new CompilationException($compiler, 'If : Syntax error : syntax should be "if $a is [not] div by $b", found ' . $params[$k - 1] . ' is ' . ($negate ? 'not ' : '') . 'div ' . $params[$k + $ptr + 1] . ' ' . $params[$k + $ptr + 2]); - } - break; - case 'even': - $a = array_pop($p); - if (isset($params[$k + $ptr + 1]) && strtolower(trim($params[$k + $ptr + 1], '"\'')) === 'by') { - $b = $params[$k + $ptr + 2]; - $p[] = '(' . $a . ' / ' . $b . ') % 2 ' . ($negate ? '!' : '=') . '== 0'; - next($params); - next($params); - } else { - $p[] = $a . ' % 2 ' . ($negate ? '!' : '=') . '== 0'; - } - next($params); - break; - case 'odd': - $a = array_pop($p); - if (isset($params[$k + $ptr + 1]) && strtolower(trim($params[$k + $ptr + 1], '"\'')) === 'by') { - $b = $params[$k + $ptr + 2]; - $p[] = '(' . $a . ' / ' . $b . ') % 2 ' . ($negate ? '=' : '!') . '== 0'; - next($params); - next($params); - } else { - $p[] = $a . ' % 2 ' . ($negate ? '=' : '!') . '== 0'; - } - next($params); - break; - default: - throw new CompilationException($compiler, 'If : Syntax error : syntax should be "if $a is [not] (div|even|odd) [by $b]", found ' . $params[$k - 1] . ' is ' . $params[$k + $ptr + 1]); - } - break; - default: - $p[] = $v; - } - } - - return $p; - } - - /** - * @param Compiler $compiler - * @param array $params - * @param string $prepend - * @param string $append - * @param string $type - * - * @return string - */ - public static function preProcessing(Compiler $compiler, array $params, $prepend, $append, $type) - { - return ''; - } - - /** - * @param Compiler $compiler - * @param array $params - * @param string $prepend - * @param string $append - * @param string $content - * - * @return string - */ - public static function postProcessing(Compiler $compiler, array $params, $prepend, $append, $content) - { - $tokens = $compiler->getParamTokens($params); - $params = $compiler->getCompiledParams($params); - $pre = Compiler::PHP_OPEN . 'if (' . implode(' ', self::replaceKeywords($params['*'], $tokens['*'], $compiler)) . ") {\n" . Compiler::PHP_CLOSE; - - $post = Compiler::PHP_OPEN . "\n}" . Compiler::PHP_CLOSE; - - if (isset($params['hasElse'])) { - $post .= $params['hasElse']; - } - - return $pre . $content . $post; - } -} diff --git a/core/l/Dwoo/Plugins/Blocks/PluginLoop.php b/core/l/Dwoo/Plugins/Blocks/PluginLoop.php deleted file mode 100644 index 5efbf43..0000000 --- a/core/l/Dwoo/Plugins/Blocks/PluginLoop.php +++ /dev/null @@ -1,170 +0,0 @@ - - * @author David Sanchez - * @copyright 2008-2013 Jordi Boggiano - * @copyright 2013-2016 David Sanchez - * @license http://dwoo.org/LICENSE Modified BSD License - * @version 1.3.0 - * @date 2016-09-19 - * @link http://dwoo.org/ - */ - -namespace Dwoo\Plugins\Blocks; - -use Dwoo\Compiler; -use Dwoo\IElseable; -use Dwoo\Block\Plugin as BlockPlugin; -use Dwoo\ICompilable\Block as ICompilableBlock; - -/** - * Loops over an array and moves the scope into each value, allowing for shorter loop constructs. - * Note that to access the array key within a loop block, you have to use the {$_key} variable, - * you can not specify it yourself. - *
- *  * from : the array that you want to iterate over
- *  * name : loop name to access it's iterator variables through {$.loop.name.var} see {@link
- *  http://wiki.dwoo.org/index.php/IteratorVariables} for details
- * 
- * Example : - * instead of a foreach block such as : - * - * {foreach $variable value} - * {$value.foo} {$value.bar} - * {/foreach} - * - * you can do : - * - * {loop $variable} - * {$foo} {$bar} - * {/loop} - * - * This software is provided 'as-is', without any express or implied warranty. - * In no event will the authors be held liable for any damages arising from the use of this software. - */ -class PluginLoop extends BlockPlugin implements ICompilableBlock, IElseable -{ - public static $cnt = 0; - - /** - * @param $from - * @param string $name - */ - public function init($from, $name = 'default') - { - } - - /** - * @param Compiler $compiler - * @param array $params - * @param string $prepend - * @param string $append - * @param string $type - * - * @return string - */ - public static function preProcessing(Compiler $compiler, array $params, $prepend, $append, $type) - { - // get block params and save the current template pointer to use it in the postProcessing method - $currentBlock = &$compiler->getCurrentBlock(); - $currentBlock['params']['tplPointer'] = $compiler->getPointer(); - - return ''; - } - - /** - * @param Compiler $compiler - * @param array $params - * @param string $prepend - * @param string $append - * @param string $content - * - * @return string - */ - public static function postProcessing(Compiler $compiler, array $params, $prepend, $append, $content) - { - $params = $compiler->getCompiledParams($params); - $tpl = $compiler->getTemplateSource($params['tplPointer']); - - // assigns params - $src = $params['from']; - $name = $params['name']; - - // evaluates which global variables have to be computed - $varName = '$dwoo.loop.' . trim($name, '"\'') . '.'; - $shortVarName = '$.loop.' . trim($name, '"\'') . '.'; - $usesAny = strpos($tpl, $varName) !== false || strpos($tpl, $shortVarName) !== false; - $usesFirst = strpos($tpl, $varName . 'first') !== false || strpos($tpl, $shortVarName . 'first') !== false; - $usesLast = strpos($tpl, $varName . 'last') !== false || strpos($tpl, $shortVarName . 'last') !== false; - $usesIndex = $usesFirst || strpos($tpl, $varName . 'index') !== false || strpos($tpl, $shortVarName . 'index') !== false; - $usesIteration = $usesLast || strpos($tpl, $varName . 'iteration') !== false || strpos($tpl, $shortVarName . 'iteration') !== false; - $usesShow = strpos($tpl, $varName . 'show') !== false || strpos($tpl, $shortVarName . 'show') !== false; - $usesTotal = $usesLast || strpos($tpl, $varName . 'total') !== false || strpos($tpl, $shortVarName . 'total') !== false; - - if (strpos($name, '$this->scope[') !== false) { - $usesAny = $usesFirst = $usesLast = $usesIndex = $usesIteration = $usesShow = $usesTotal = true; - } - - // gets foreach id - $cnt = self::$cnt ++; - - // builds pre processing output - $pre = Compiler::PHP_OPEN . "\n" . '$_loop' . $cnt . '_data = ' . $src . ';'; - // adds foreach properties - if ($usesAny) { - $pre .= "\n" . '$this->globals["loop"][' . $name . '] = array' . "\n("; - if ($usesIndex) { - $pre .= "\n\t" . '"index" => 0,'; - } - if ($usesIteration) { - $pre .= "\n\t" . '"iteration" => 1,'; - } - if ($usesFirst) { - $pre .= "\n\t" . '"first" => null,'; - } - if ($usesLast) { - $pre .= "\n\t" . '"last" => null,'; - } - if ($usesShow) { - $pre .= "\n\t" . '"show" => $this->isTraversable($_loop' . $cnt . '_data, true),'; - } - if ($usesTotal) { - $pre .= "\n\t" . '"total" => $this->count($_loop' . $cnt . '_data),'; - } - $pre .= "\n);\n" . '$_loop' . $cnt . '_glob =& $this->globals["loop"][' . $name . '];'; - } - // checks if the loop must be looped - $pre .= "\n" . 'if ($this->isTraversable($_loop' . $cnt . '_data' . (isset($params['hasElse']) ? ', true' : '') . ') == true)' . "\n{"; - // iterates over keys - $pre .= "\n\t" . 'foreach ($_loop' . $cnt . '_data as $tmp_key => $this->scope["-loop-"])' . "\n\t{"; - // updates properties - if ($usesFirst) { - $pre .= "\n\t\t" . '$_loop' . $cnt . '_glob["first"] = (string) ($_loop' . $cnt . '_glob["index"] === 0);'; - } - if ($usesLast) { - $pre .= "\n\t\t" . '$_loop' . $cnt . '_glob["last"] = (string) ($_loop' . $cnt . '_glob["iteration"] === $_loop' . $cnt . '_glob["total"]);'; - } - $pre .= "\n\t\t" . '$_loop' . $cnt . '_scope = $this->setScope(array("-loop-"));' . "\n/* -- loop start output */\n" . Compiler::PHP_CLOSE; - - // build post processing output and cache it - $post = Compiler::PHP_OPEN . "\n" . '/* -- loop end output */' . "\n\t\t" . '$this->setScope($_loop' . $cnt . '_scope, true);'; - // update properties - if ($usesIndex) { - $post .= "\n\t\t" . '$_loop' . $cnt . '_glob["index"]+=1;'; - } - if ($usesIteration) { - $post .= "\n\t\t" . '$_loop' . $cnt . '_glob["iteration"]+=1;'; - } - // end loop - $post .= "\n\t}\n}\n" . Compiler::PHP_CLOSE; - if (isset($params['hasElse'])) { - $post .= $params['hasElse']; - } - - return $pre . $content . $post; - } -} diff --git a/core/l/Dwoo/Plugins/Blocks/PluginSection.php b/core/l/Dwoo/Plugins/Blocks/PluginSection.php deleted file mode 100644 index 4f75b26..0000000 --- a/core/l/Dwoo/Plugins/Blocks/PluginSection.php +++ /dev/null @@ -1,159 +0,0 @@ - - * @author David Sanchez - * @copyright 2008-2013 Jordi Boggiano - * @copyright 2013-2016 David Sanchez - * @license http://dwoo.org/LICENSE Modified BSD License - * @version 1.3.0 - * @date 2016-09-19 - * @link http://dwoo.org/ - */ - -namespace Dwoo\Plugins\Blocks; - -use Dwoo\Compiler; -use Dwoo\IElseable; -use Dwoo\Block\Plugin as BlockPlugin; -use Dwoo\ICompilable\Block as ICompilableBlock; - -/** - * Compatibility plugin for smarty templates, do not use otherwise, this is deprecated. - * This software is provided 'as-is', without any express or implied warranty. - * In no event will the authors be held liable for any damages arising from the use of this software. - */ -class PluginSection extends BlockPlugin implements ICompilableBlock, IElseable -{ - public static $cnt = 0; - - /** - * @param $name - * @param $loop - * @param null $start - * @param null $step - * @param null $max - * @param bool $show - */ - public function init($name, $loop, $start = null, $step = null, $max = null, $show = true) - { - } - - /** - * @param Compiler $compiler - * @param array $params - * @param string $prepend - * @param string $append - * @param string $type - * - * @return string - */ - public static function preProcessing(Compiler $compiler, array $params, $prepend, $append, $type) - { - return ''; - } - - /** - * @param Compiler $compiler - * @param array $params - * @param string $prepend - * @param string $append - * @param string $content - * - * @return string - */ - public static function postProcessing(Compiler $compiler, array $params, $prepend, $append, $content) - { - $output = Compiler::PHP_OPEN; - $params = $compiler->getCompiledParams($params); - - // assigns params - $loop = $params['loop']; - $start = $params['start']; - $max = $params['max']; - $name = $params['name']; - $step = $params['step']; - $show = $params['show']; - - // gets unique id - $cnt = self::$cnt ++; - - $output .= '$this->globals[\'section\'][' . $name . '] = array();' . "\n" . '$_section' . $cnt . ' =& $this->globals[\'section\'][' . $name . '];' . "\n"; - - if ($loop !== 'null') { - $output .= '$_section' . $cnt . '[\'loop\'] = is_array($tmp = ' . $loop . ') ? count($tmp) : max(0, (int) $tmp);' . "\n"; - } else { - $output .= '$_section' . $cnt . '[\'loop\'] = 1;' . "\n"; - } - - if ($show !== 'null') { - $output .= '$_section' . $cnt . '[\'show\'] = ' . $show . ";\n"; - } else { - $output .= '$_section' . $cnt . '[\'show\'] = true;' . "\n"; - } - - if ($name !== 'null') { - $output .= '$_section' . $cnt . '[\'name\'] = ' . $name . ";\n"; - } else { - $output .= '$_section' . $cnt . '[\'name\'] = true;' . "\n"; - } - - if ($max !== 'null') { - $output .= '$_section' . $cnt . '[\'max\'] = (int)' . $max . ";\n" . 'if($_section' . $cnt . '[\'max\'] < 0) { $_section' . $cnt . '[\'max\'] = $_section' . $cnt . '[\'loop\']; }' . "\n"; - } else { - $output .= '$_section' . $cnt . '[\'max\'] = $_section' . $cnt . '[\'loop\'];' . "\n"; - } - - if ($step !== 'null') { - $output .= '$_section' . $cnt . '[\'step\'] = (int)' . $step . ' == 0 ? 1 : (int) ' . $step . ";\n"; - } else { - $output .= '$_section' . $cnt . '[\'step\'] = 1;' . "\n"; - } - - if ($start !== 'null') { - $output .= '$_section' . $cnt . '[\'start\'] = (int)' . $start . ";\n"; - } else { - $output .= '$_section' . $cnt . '[\'start\'] = $_section' . $cnt . '[\'step\'] > 0 ? 0 : $_section' . $cnt . '[\'loop\'] - 1;' . "\n" . 'if ($_section' . $cnt . '[\'start\'] < 0) { $_section' . $cnt . '[\'start\'] = max($_section' . $cnt . '[\'step\'] > 0 ? 0 : -1, $_section' . $cnt . '[\'loop\'] + $_section' . $cnt . '[\'start\']); } ' . "\n" . 'else { $_section' . $cnt . '[\'start\'] = min($_section' . $cnt . '[\'start\'], $_section' . $cnt . '[\'step\'] > 0 ? $_section' . $cnt . '[\'loop\'] : $_section' . $cnt . '[\'loop\'] -1); }' . "\n"; - } - - /* if ($usesAny) { - $output .= "\n".'$this->globals["section"]['.$name.'] = array'."\n("; - if ($usesIndex) $output .="\n\t".'"index" => 0,'; - if ($usesIteration) $output .="\n\t".'"iteration" => 1,'; - if ($usesFirst) $output .="\n\t".'"first" => null,'; - if ($usesLast) $output .="\n\t".'"last" => null,'; - if ($usesShow) $output .="\n\t".'"show" => ($this->isArray($_for'.$cnt.'_from, true)) || (is_numeric($_for'.$cnt.'_from) && $_for'.$cnt.'_from != $_for'.$cnt.'_to),'; - if ($usesTotal) $output .="\n\t".'"total" => $this->isArray($_for'.$cnt.'_from) ? $this->count($_for'.$cnt.'_from) - $_for'.$cnt.'_skip : (is_numeric($_for'.$cnt.'_from) ? abs(($_for'.$cnt.'_to + 1 - $_for'.$cnt.'_from)/$_for'.$cnt.'_step) : 0),'; - $out.="\n);\n".'$_section'.$cnt.'[\'glob\'] =& $this->globals["section"]['.$name.'];'."\n\n"; - } - */ - - $output .= 'if ($_section' . $cnt . '[\'show\']) {' . "\n"; - if ($start === 'null' && $step === 'null' && $max === 'null') { - $output .= ' $_section' . $cnt . '[\'total\'] = $_section' . $cnt . '[\'loop\'];' . "\n"; - } else { - $output .= ' $_section' . $cnt . '[\'total\'] = min(ceil(($_section' . $cnt . '[\'step\'] > 0 ? $_section' . $cnt . '[\'loop\'] - $_section' . $cnt . '[\'start\'] : $_section' . $cnt . '[\'start\'] + 1) / abs($_section' . $cnt . '[\'step\'])), $_section' . $cnt . '[\'max\']);' . "\n"; - } - $output .= ' if ($_section' . $cnt . '[\'total\'] == 0) {' . "\n" . ' $_section' . $cnt . '[\'show\'] = false;' . "\n" . ' }' . "\n" . '} else {' . "\n" . ' $_section' . $cnt . '[\'total\'] = 0;' . "\n}\n"; - $output .= 'if ($_section' . $cnt . '[\'show\']) {' . "\n"; - $output .= "\t" . 'for ($this->scope[' . $name . '] = $_section' . $cnt . '[\'start\'], $_section' . $cnt . '[\'iteration\'] = 1; ' . '$_section' . $cnt . '[\'iteration\'] <= $_section' . $cnt . '[\'total\']; ' . '$this->scope[' . $name . '] += $_section' . $cnt . '[\'step\'], $_section' . $cnt . '[\'iteration\']++) {' . "\n"; - $output .= "\t\t" . '$_section' . $cnt . '[\'rownum\'] = $_section' . $cnt . '[\'iteration\'];' . "\n"; - $output .= "\t\t" . '$_section' . $cnt . '[\'index_prev\'] = $this->scope[' . $name . '] - $_section' . $cnt . '[\'step\'];' . "\n"; - $output .= "\t\t" . '$_section' . $cnt . '[\'index_next\'] = $this->scope[' . $name . '] + $_section' . $cnt . '[\'step\'];' . "\n"; - $output .= "\t\t" . '$_section' . $cnt . '[\'first\'] = ($_section' . $cnt . '[\'iteration\'] == 1);' . "\n"; - $output .= "\t\t" . '$_section' . $cnt . '[\'last\'] = ($_section' . $cnt . '[\'iteration\'] == $_section' . $cnt . '[\'total\']);' . "\n"; - - $output .= Compiler::PHP_CLOSE . $content . Compiler::PHP_OPEN; - - $output .= "\n\t}\n} " . Compiler::PHP_CLOSE; - - if (isset($params['hasElse'])) { - $output .= $params['hasElse']; - } - - return $output; - } -} diff --git a/core/l/Dwoo/Plugins/Blocks/PluginSmartyinterface.php b/core/l/Dwoo/Plugins/Blocks/PluginSmartyinterface.php deleted file mode 100644 index 14211e1..0000000 --- a/core/l/Dwoo/Plugins/Blocks/PluginSmartyinterface.php +++ /dev/null @@ -1,96 +0,0 @@ - - * @author David Sanchez - * @copyright 2008-2013 Jordi Boggiano - * @copyright 2013-2017 David Sanchez - * @license http://dwoo.org/LICENSE LGPLv3 - * @version 1.3.6 - * @date 2017-03-21 - * @link http://dwoo.org/ - */ - -namespace Dwoo\Plugins\Blocks; - -use Dwoo\Core; -use Dwoo\Compiler; -use Dwoo\Block\Plugin as BlockPlugin; -use Dwoo\ICompilable\Block as ICompilableBlock; - -/** - * Smarty compatibility layer for block plugins, this is used internally and you should not call it. - * This software is provided 'as-is', without any express or implied warranty. - * In no event will the authors be held liable for any damages arising from the use of this software. - */ -class PluginSmartyinterface extends BlockPlugin implements ICompilableBlock -{ - /** - * @param $__funcname - * @param $__functype - * @param array $rest - */ - public function init($__funcname, $__functype, array $rest = array()) - { - } - - /** - * @param Compiler $compiler - * @param array $params - * @param string $prepend - * @param string $append - * @param string $type - * - * @return string - */ - public static function preProcessing(Compiler $compiler, array $params, $prepend, $append, $type) - { - $params = $compiler->getCompiledParams($params); - $func = $params['__funcname']; - $pluginType = $params['__functype']; - $params = $params['*']; - - if ($pluginType & Core::CUSTOM_PLUGIN) { - $customPlugins = $compiler->getCore()->getCustomPlugins(); - $callback = $customPlugins[$func]['callback']; - if (is_array($callback)) { - if (is_object($callback[0])) { - $callback = '$this->customPlugins[\'' . $func . '\'][0]->' . $callback[1] . '('; - } else { - $callback = '' . $callback[0] . '::' . $callback[1] . '('; - } - } else { - $callback = $callback . '('; - } - } else { - $callback = 'smarty_block_' . $func . '('; - } - - $paramsOut = ''; - foreach ($params as $i => $p) { - $paramsOut .= var_export($i, true) . ' => ' . $p . ','; - } - - $curBlock = &$compiler->getCurrentBlock(); - $curBlock['params']['postOut'] = Compiler::PHP_OPEN . ' $_block_content = ob_get_clean(); $_block_repeat=false; echo ' . $callback . '$_tag_stack[count($_tag_stack)-1], $_block_content, $this, $_block_repeat); } array_pop($_tag_stack);' . Compiler::PHP_CLOSE; - - return Compiler::PHP_OPEN . $prepend . ' if (!isset($_tag_stack)){ $_tag_stack = array(); } $_tag_stack[] = array(' . $paramsOut . '); $_block_repeat=true; ' . $callback . '$_tag_stack[count($_tag_stack)-1], null, $this, $_block_repeat); while ($_block_repeat) { ob_start();' . Compiler::PHP_CLOSE; - } - - /** - * @param Compiler $compiler - * @param array $params - * @param string $prepend - * @param string $append - * @param string $content - * - * @return string - */ - public static function postProcessing(Compiler $compiler, array $params, $prepend, $append, $content) - { - return $content . $params['postOut']; - } -} diff --git a/core/l/Dwoo/Plugins/Blocks/PluginStrip.php b/core/l/Dwoo/Plugins/Blocks/PluginStrip.php deleted file mode 100644 index 5ee726d..0000000 --- a/core/l/Dwoo/Plugins/Blocks/PluginStrip.php +++ /dev/null @@ -1,89 +0,0 @@ - - * @author David Sanchez - * @copyright 2008-2013 Jordi Boggiano - * @copyright 2013-2016 David Sanchez - * @license http://dwoo.org/LICENSE Modified BSD License - * @version 1.3.0 - * @date 2016-09-19 - * @link http://dwoo.org/ - */ - -namespace Dwoo\Plugins\Blocks; - -use Dwoo\Compiler; -use Dwoo\Block\Plugin as BlockPlugin; -use Dwoo\ICompilable\Block as ICompilableBlock; - -/** - * Strips the spaces at the beginning and end of each line and also the line breaks - *
- *  * mode : sets the content being stripped, available mode are 'default' or 'js'
- *    for javascript, which strips the comments to prevent syntax errors
- * 
. - * This software is provided 'as-is', without any express or implied warranty. - * In no event will the authors be held liable for any damages arising from the use of this software. - */ -class PluginStrip extends BlockPlugin implements ICompilableBlock -{ - /** - * @param string $mode - */ - public function init($mode = 'default') - { - } - - /** - * @param Compiler $compiler - * @param array $params - * @param string $prepend - * @param string $append - * @param string $type - * - * @return string - */ - public static function preProcessing(Compiler $compiler, array $params, $prepend, $append, $type) - { - return ''; - } - - /** - * @param Compiler $compiler - * @param array $params - * @param string $prepend - * @param string $append - * @param string $content - * - * @return mixed|string - */ - public static function postProcessing(Compiler $compiler, array $params, $prepend, $append, $content) - { - $params = $compiler->getCompiledParams($params); - - $mode = trim($params['mode'], '"\''); - switch ($mode) { - case 'js': - case 'javascript': - $content = preg_replace('#(? - * @author David Sanchez - * @copyright 2008-2013 Jordi Boggiano - * @copyright 2013-2016 David Sanchez - * @license http://dwoo.org/LICENSE Modified BSD License - * @version 1.3.0 - * @date 2016-09-20 - * @link http://dwoo.org/ - */ - -namespace Dwoo\Plugins\Blocks; - -use Dwoo\Core; -use Dwoo\Compiler; -use Dwoo\Block\Plugin as BlockPlugin; -use Dwoo\ICompilable\Block as ICompilableBlock; -use Dwoo\Compilation\Exception as CompilationException; - -/** - * Defines a sub-template that can then be called (even recursively) with the defined arguments - *
- *  * name : template name
- *  * rest : list of arguments and optional default values
- * 
- * This software is provided 'as-is', without any express or implied warranty. - * In no event will the authors be held liable for any damages arising from the use of this software. - */ -class PluginTemplate extends BlockPlugin implements ICompilableBlock -{ - /** - * @param Compiler $compiler - * @param array $params - * @param string $prepend - * @param string $append - * @param string $type - * - * @return string - * @throws CompilationException - */ - public static function preProcessing(Compiler $compiler, array $params, $prepend, $append, $type) - { - $params = $compiler->getCompiledParams($params); - $parsedParams = array(); - if (!isset($params['*'])) { - $params['*'] = array(); - } - foreach ($params['*'] as $param => $defValue) { - if (is_numeric($param)) { - $param = $defValue; - $defValue = null; - } - $param = trim($param, '\'"'); - if (!preg_match('#^[a-z0-9_]+$#i', $param)) { - throw new CompilationException($compiler, 'Function : parameter names must contain only A-Z, 0-9 or _'); - } - $parsedParams[$param] = $defValue; - } - $params['name'] = substr($params['name'], 1, - 1); - $params['*'] = $parsedParams; - $params['uuid'] = uniqid(); - $compiler->addTemplatePlugin($params['name'], $parsedParams, $params['uuid']); - $currentBlock = &$compiler->getCurrentBlock(); - $currentBlock['params'] = $params; - - return ''; - } - - /** - * @param Compiler $compiler - * @param array $params - * @param string $prepend - * @param string $append - * @param string $content - * - * @return string|void - */ - public static function postProcessing(Compiler $compiler, array $params, $prepend, $append, $content) - { - $paramstr = 'Dwoo\Core $dwoo'; - $init = 'static $_callCnt = 0;' . "\n" . '$dwoo->scope[\' ' . $params['uuid'] . '\'.$_callCnt] = array();' . "\n" . '$_scope = $dwoo->setScope(array(\' ' . $params['uuid'] . '\'.($_callCnt++)));' . "\n"; - $cleanup = '/* -- template end output */ $dwoo->setScope($_scope, true);'; - foreach ($params['*'] as $param => $defValue) { - if ($defValue === null) { - $paramstr .= ', $' . $param; - } else { - $paramstr .= ', $' . $param . ' = ' . $defValue; - } - $init .= '$dwoo->scope[\'' . $param . '\'] = $' . $param . ";\n"; - } - $init .= '/* -- template start output */'; - - $funcName = 'Plugin' . Core::toCamelCase($params['name']) . Core::toCamelCase($params['uuid']); - - $search = array('$this->charset', '$this->', '$this,',); - $replacement = array('$dwoo->getCharset()', '$dwoo->', '$dwoo,',); - $content = str_replace($search, $replacement, $content); - - $body = 'if (!function_exists(\'' . $funcName . "')) {\nfunction " . $funcName . '(' . $paramstr . ') {' . "\n$init" . Compiler::PHP_CLOSE . $prepend . $content . $append . Compiler::PHP_OPEN . $cleanup . "\n}\n}"; - $compiler->addTemplatePlugin($params['name'], $params['*'], $params['uuid'], $body); - } - - /** - * @param $name - * @param array $rest - */ - public function init($name, array $rest = array()) - { - } -} diff --git a/core/l/Dwoo/Plugins/Blocks/PluginTextformat.php b/core/l/Dwoo/Plugins/Blocks/PluginTextformat.php deleted file mode 100644 index 09fc056..0000000 --- a/core/l/Dwoo/Plugins/Blocks/PluginTextformat.php +++ /dev/null @@ -1,119 +0,0 @@ - - * @author David Sanchez - * @copyright 2008-2013 Jordi Boggiano - * @copyright 2013-2016 David Sanchez - * @license http://dwoo.org/LICENSE Modified BSD License - * @version 1.3.0 - * @date 2016-09-19 - * @link http://dwoo.org/ - */ - -namespace Dwoo\Plugins\Blocks; - -use Dwoo\Block\Plugin as BlockPlugin; - -/** - * Formats a string to the given format, you can wrap lines at a certain - * length and indent them - *
- *  * wrap : maximum line length
- *  * wrap_char : the character(s) to use to break the line
- *  * wrap_cut : if true, the words that are longer than $wrap are cut instead of overflowing
- *  * indent : amount of $indent_char to insert before every line
- *  * indent_char : character(s) to insert before every line
- *  * indent_first : amount of additional $indent_char to insert before the first line of each paragraphs
- *  * style : some predefined formatting styles that set up every required variables, can be "email" or "html"
- *  * assign : if set, the formatted text is assigned to that variable instead of being output
- * 
- * This software is provided 'as-is', without any express or implied warranty. - * In no event will the authors be held liable for any damages arising from the use of this software. - */ -class PluginTextformat extends BlockPlugin -{ - protected $wrap; - protected $wrapChar; - protected $wrapCut; - protected $indent; - protected $indChar; - protected $indFirst; - protected $assign; - - /** - * @param int $wrap - * @param string $wrap_char - * @param bool $wrap_cut - * @param int $indent - * @param string $indent_char - * @param int $indent_first - * @param string $style - * @param string $assign - */ - public function init($wrap = 80, $wrap_char = "\r\n", $wrap_cut = false, $indent = 0, $indent_char = ' ', $indent_first = 0, $style = '', $assign = '') - { - if ($indent_char === 'tab') { - $indent_char = "\t"; - } - - switch ($style) { - - case 'email': - $wrap = 72; - $indent_first = 0; - break; - case 'html': - $wrap_char = '
'; - $indent_char = $indent_char == "\t" ? '    ' : ' '; - break; - } - - $this->wrap = (int)$wrap; - $this->wrapChar = (string)$wrap_char; - $this->wrapCut = (bool)$wrap_cut; - $this->indent = (int)$indent; - $this->indChar = (string)$indent_char; - $this->indFirst = (int)$indent_first + $this->indent; - $this->assign = (string)$assign; - } - - /** - * @return string - */ - public function process() - { - // gets paragraphs - $pgs = explode("\n", str_replace(array( - "\r\n", - "\r" - ), "\n", $this->buffer)); - - while (list($i) = each($pgs)) { - if (empty($pgs[$i])) { - continue; - } - - // removes line breaks and extensive white space - $pgs[$i] = preg_replace(array( - '#\s+#', - '#^\s*(.+?)\s*$#m' - ), array( - ' ', - '$1' - ), str_replace("\n", '', $pgs[$i])); - - // wordwraps + indents lines - $pgs[$i] = str_repeat($this->indChar, $this->indFirst) . wordwrap($pgs[$i], max($this->wrap - $this->indent, 1), $this->wrapChar . str_repeat($this->indChar, $this->indent), $this->wrapCut); - } - - if ($this->assign !== '') { - $this->core->assignInScope(implode($this->wrapChar . $this->wrapChar, $pgs), $this->assign); - } else { - return implode($this->wrapChar . $this->wrapChar, $pgs); - } - } -} diff --git a/core/l/Dwoo/Plugins/Blocks/PluginTopLevelBlock.php b/core/l/Dwoo/Plugins/Blocks/PluginTopLevelBlock.php deleted file mode 100644 index 2694be2..0000000 --- a/core/l/Dwoo/Plugins/Blocks/PluginTopLevelBlock.php +++ /dev/null @@ -1,60 +0,0 @@ - - * @author David Sanchez - * @copyright 2008-2013 Jordi Boggiano - * @copyright 2013-2016 David Sanchez - * @license http://dwoo.org/LICENSE Modified BSD License - * @version 1.3.0 - * @date 2016-09-19 - * @link http://dwoo.org/ - */ - -namespace Dwoo\Plugins\Blocks; - -use Dwoo\Compiler; -use Dwoo\Block\Plugin as BlockPlugin; -use Dwoo\ICompilable\Block as ICompilableBlock; - -/** - * Internal plugin used to wrap the template output, do not use in your templates as it will break them. - * This software is provided 'as-is', without any express or implied warranty. - */ -final class PluginTopLevelBlock extends BlockPlugin implements ICompilableBlock -{ - public function init() - { - } - - /** - * @param Compiler $compiler - * @param array $params - * @param string $prepend - * @param string $append - * @param string $type - * - * @return string - */ - public static function preProcessing(Compiler $compiler, array $params, $prepend, $append, $type) - { - return '/* end template head */ ob_start(); /* template body */ ' . Compiler::PHP_CLOSE; - } - - /** - * @param Compiler $compiler - * @param array $params - * @param string $prepend - * @param string $append - * @param string $content - * - * @return string - */ - public static function postProcessing(Compiler $compiler, array $params, $prepend, $append, $content) - { - return $content . Compiler::PHP_OPEN . ' /* end template body */' . "\n" . 'return $this->buffer . ob_get_clean();'; - } -} diff --git a/core/l/Dwoo/Plugins/Blocks/PluginWith.php b/core/l/Dwoo/Plugins/Blocks/PluginWith.php deleted file mode 100644 index f5e94fc..0000000 --- a/core/l/Dwoo/Plugins/Blocks/PluginWith.php +++ /dev/null @@ -1,99 +0,0 @@ - - * @author David Sanchez - * @copyright 2008-2013 Jordi Boggiano - * @copyright 2013-2016 David Sanchez - * @license http://dwoo.org/LICENSE Modified BSD License - * @version 1.3.0 - * @date 2016-09-19 - * @link http://dwoo.org/ - */ - -namespace Dwoo\Plugins\Blocks; - -use Dwoo\IElseable; -use Dwoo\Compiler; -use Dwoo\Block\Plugin as BlockPlugin; -use Dwoo\ICompilable\Block as ICompilableBlock; - -/** - * Moves the scope down into the provided variable, allowing you to use shorter - * variable names if you repeatedly access values into a single array. - * The with block won't display anything at all if the provided scope is empty, - * so in effect it acts as {if $var}*content*{/if} - *
- *  * var : the variable name to move into
- * 
- * Example : - * instead of the following : - * - * {if $long.boring.prefix} - * {$long.boring.prefix.val} - {$long.boring.prefix.secondVal} - {$long.boring.prefix.thirdVal} - * {/if} - * - * you can use : - * - * {with $long.boring.prefix} - * {$val} - {$secondVal} - {$thirdVal} - * {/with} - * - * This software is provided 'as-is', without any express or implied warranty. - * In no event will the authors be held liable for any damages arising from the use of this software. - */ -class PluginWith extends BlockPlugin implements ICompilableBlock, IElseable -{ - protected static $cnt = 0; - - /** - * @param $var - */ - public function init($var) - { - } - - /** - * @param Compiler $compiler - * @param array $params - * @param string $prepend - * @param string $append - * @param string $type - * - * @return string - */ - public static function preProcessing(Compiler $compiler, array $params, $prepend, $append, $type) - { - return ''; - } - - /** - * @param Compiler $compiler - * @param array $params - * @param string $prepend - * @param string $append - * @param string $content - * - * @return string - */ - public static function postProcessing(Compiler $compiler, array $params, $prepend, $append, $content) - { - $rparams = $compiler->getRealParams($params); - $cparams = $compiler->getCompiledParams($params); - - $compiler->setScope($rparams['var']); - - $pre = Compiler::PHP_OPEN . 'if (' . $cparams['var'] . ')' . "\n{\n" . '$_with' . (self::$cnt) . ' = $this->setScope("' . $rparams['var'] . '");' . "\n/* -- start with output */\n" . Compiler::PHP_CLOSE; - - $post = Compiler::PHP_OPEN . "\n/* -- end with output */\n" . '$this->setScope($_with' . (self::$cnt ++) . ', true);' . "\n}\n" . Compiler::PHP_CLOSE; - - if (isset($params['hasElse'])) { - $post .= $params['hasElse']; - } - - return $pre . $content . $post; - } -} diff --git a/core/l/Dwoo/Plugins/Blocks/PluginWithelse.php b/core/l/Dwoo/Plugins/Blocks/PluginWithelse.php deleted file mode 100644 index a614322..0000000 --- a/core/l/Dwoo/Plugins/Blocks/PluginWithelse.php +++ /dev/null @@ -1,73 +0,0 @@ - - * @author David Sanchez - * @copyright 2008-2013 Jordi Boggiano - * @copyright 2013-2016 David Sanchez - * @license http://dwoo.org/LICENSE Modified BSD License - * @version 1.3.0 - * @date 2016-09-19 - * @link http://dwoo.org/ - */ - -namespace Dwoo\Plugins\Blocks; - -use Dwoo\Compiler; -use Dwoo\Block\Plugin as BlockPlugin; -use Dwoo\ICompilable\Block as ICompilableBlock; - -/** - * This plugin serves as a {else} block specifically for the {with} plugin. - * This software is provided 'as-is', without any express or implied warranty. - * In no event will the authors be held liable for any damages arising from the use of this software. - */ -class PluginWithelse extends BlockPlugin implements ICompilableBlock -{ - public function init() - { - } - - /** - * @param Compiler $compiler - * @param array $params - * @param string $prepend - * @param string $append - * @param string $type - * - * @return string - */ - public static function preProcessing(Compiler $compiler, array $params, $prepend, $append, $type) - { - $with = &$compiler->findBlock('with', true); - - $params['initialized'] = true; - $compiler->injectBlock($type, $params); - - return ''; - } - - /** - * @param Compiler $compiler - * @param array $params - * @param string $prepend - * @param string $append - * @param string $content - * - * @return string - */ - public static function postProcessing(Compiler $compiler, array $params, $prepend, $append, $content) - { - if (!isset($params['initialized'])) { - return ''; - } - - $block = &$compiler->getCurrentBlock(); - $block['params']['hasElse'] = Compiler::PHP_OPEN . "else {\n" . Compiler::PHP_CLOSE . $content . Compiler::PHP_OPEN . "\n}" . Compiler::PHP_CLOSE; - - return ''; - } -} diff --git a/core/l/Dwoo/Plugins/Filters/PluginHtmlFormat.php b/core/l/Dwoo/Plugins/Filters/PluginHtmlFormat.php deleted file mode 100644 index f923de4..0000000 --- a/core/l/Dwoo/Plugins/Filters/PluginHtmlFormat.php +++ /dev/null @@ -1,190 +0,0 @@ - - * @author David Sanchez - * @copyright 2008-2013 Jordi Boggiano - * @copyright 2013-2016 David Sanchez - * @license http://dwoo.org/LICENSE Modified BSD License - * @version 1.3.0 - * @date 2016-09-18 - * @link http://dwoo.org/ - */ - -namespace Dwoo\Plugins\Filters; - -use Dwoo\Filter; - -/** - * Formats any html output (must be valid xml where every tag opened is closed) - * using a single tab for indenting. 'pre' and other whitespace sensitive - * tags should not be affected. - * It is not recommended to use this on every template if you render multiple - * templates per page, you should only use it once on the main page template so that - * everything is formatted in one pass. - * This software is provided 'as-is', without any express or implied warranty. - * In no event will the authors be held liable for any damages arising from the use of this software. - */ -class PluginHtmlFormat extends Filter -{ - /** - * tab count to auto-indent the source. - * - * @var int - */ - protected static $tabCount = - 1; - - /** - * stores the additional data (following a tag) of the last call to open/close/singleTag. - * - * @var string - */ - protected static $lastCallAdd = ''; - - /** - * formats the input using the singleTag/closeTag/openTag functions. - * It is auto indenting the whole code, excluding
- - - - diff --git a/core/l/PHPMailer/examples/contents.html b/core/l/PHPMailer/examples/contents.html deleted file mode 100755 index dc3fc66..0000000 --- a/core/l/PHPMailer/examples/contents.html +++ /dev/null @@ -1,17 +0,0 @@ - - - - - PHPMailer Test - - -
-

This is a test of PHPMailer.

-
- PHPMailer rocks -
-

This example uses HTML.

-

ISO-8859-1 text: éèîüçÅñæß

-
- - diff --git a/core/l/PHPMailer/examples/contentsutf8.html b/core/l/PHPMailer/examples/contentsutf8.html deleted file mode 100755 index 4c722c1..0000000 --- a/core/l/PHPMailer/examples/contentsutf8.html +++ /dev/null @@ -1,23 +0,0 @@ - - - - - PHPMailer Test - - -
-

This is a test of PHPMailer.

-
- PHPMailer rocks -
-

This example uses HTML with the UTF-8 unicode charset.

-

Chinese text: 郵件內容為空

-

Russian text: ПуÑтое тело ÑообщениÑ

-

Armenian text: Õ€Õ¡Õ²Õ¸Ö€Õ¤Õ¡Õ£Ö€Õ¸Ö‚Õ©ÕµÕ¸Ö‚Õ¶Õ¨ Õ¤Õ¡Õ¿Õ¡Ö€Õ¯ Õ§

-

Czech text: Prázdné tělo zprávy

-

Emoji: 😂 🦄 💥 📤 📧

-

Image data URL (base64)#

-

Image data URL (URL-encoded)#

-
- - diff --git a/core/l/PHPMailer/examples/exceptions.phps b/core/l/PHPMailer/examples/exceptions.phps deleted file mode 100755 index a053edd..0000000 --- a/core/l/PHPMailer/examples/exceptions.phps +++ /dev/null @@ -1,39 +0,0 @@ -setFrom('from@example.com', 'First Last'); - //Set an alternative reply-to address - $mail->addReplyTo('replyto@example.com', 'First Last'); - //Set who the message is to be sent to - $mail->addAddress('whoto@example.com', 'John Doe'); - //Set the subject line - $mail->Subject = 'PHPMailer Exceptions test'; - //Read an HTML message body from an external file, convert referenced images to embedded, - //and convert the HTML into a basic plain-text alternative body - $mail->msgHTML(file_get_contents('contents.html'), __DIR__); - //Replace the plain text body with one created manually - $mail->AltBody = 'This is a plain-text message body'; - //Attach an image file - $mail->addAttachment('images/phpmailer_mini.png'); - //send the message - //Note that we don't need check the response from this because it will throw an exception if it has trouble - $mail->send(); - echo 'Message sent!'; -} catch (Exception $e) { - echo $e->errorMessage(); //Pretty error messages from PHPMailer -} catch (\Exception $e) { //The leading slash means the Global PHP Exception class will be caught - echo $e->getMessage(); //Boring error messages from anything else! -} diff --git a/core/l/PHPMailer/examples/extending.phps b/core/l/PHPMailer/examples/extending.phps deleted file mode 100755 index e7b2d88..0000000 --- a/core/l/PHPMailer/examples/extending.phps +++ /dev/null @@ -1,70 +0,0 @@ -setFrom('joe@example.com', 'Joe User'); - //Send via SMTP - $this->isSMTP(); - //Equivalent to setting `Host`, `Port` and `SMTPSecure` all at once - $this->Host = 'tls://smtp.example.com:587'; - //Set an HTML and plain-text body, import relative image references - $this->msgHTML($body, './images/'); - //Show debug output - $this->SMTPDebug = 2; - //Inject a new debug output handler - $this->Debugoutput = function ($str, $level) { - echo "Debug level $level; message: $str\n"; - }; - } - - //Extend the send function - public function send() - { - $this->Subject = '[Yay for me!] ' . $this->Subject; - $r = parent::send(); - echo "I sent a message with subject " . $this->Subject; - - return $r; - } -} - -//Now creating and sending a message becomes simpler when you use this class in your app code -try { - //Instantiate your new class, making use of the new `$body` parameter - $mail = new myPHPMailer(true, 'This is the message body'); - // Now you only need to set things that are different from the defaults you defined - $mail->addAddress('jane@example.com', 'Jane User'); - $mail->Subject = 'Here is the subject'; - $mail->addAttachment(__FILE__, 'myPHPMailer.php'); - $mail->send(); //no need to check for errors - the exception handler will do it -} catch (Exception $e) { - //Note that this is catching the PHPMailer Exception class, not the global \Exception type! - echo "Caught a " . get_class($e) . ": " . $e->getMessage(); -} diff --git a/core/l/PHPMailer/examples/gmail.phps b/core/l/PHPMailer/examples/gmail.phps deleted file mode 100755 index 349c4b4..0000000 --- a/core/l/PHPMailer/examples/gmail.phps +++ /dev/null @@ -1,98 +0,0 @@ -isSMTP(); - -//Enable SMTP debugging -// 0 = off (for production use) -// 1 = client messages -// 2 = client and server messages -$mail->SMTPDebug = 2; - -//Set the hostname of the mail server -$mail->Host = 'smtp.gmail.com'; -// use -// $mail->Host = gethostbyname('smtp.gmail.com'); -// if your network does not support SMTP over IPv6 - -//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission -$mail->Port = 587; - -//Set the encryption system to use - ssl (deprecated) or tls -$mail->SMTPSecure = 'tls'; - -//Whether to use SMTP authentication -$mail->SMTPAuth = true; - -//Username to use for SMTP authentication - use full email address for gmail -$mail->Username = "username@gmail.com"; - -//Password to use for SMTP authentication -$mail->Password = "yourpassword"; - -//Set who the message is to be sent from -$mail->setFrom('from@example.com', 'First Last'); - -//Set an alternative reply-to address -$mail->addReplyTo('replyto@example.com', 'First Last'); - -//Set who the message is to be sent to -$mail->addAddress('whoto@example.com', 'John Doe'); - -//Set the subject line -$mail->Subject = 'PHPMailer GMail SMTP test'; - -//Read an HTML message body from an external file, convert referenced images to embedded, -//convert HTML into a basic plain-text alternative body -$mail->msgHTML(file_get_contents('contents.html'), __DIR__); - -//Replace the plain text body with one created manually -$mail->AltBody = 'This is a plain-text message body'; - -//Attach an image file -$mail->addAttachment('images/phpmailer_mini.png'); - -//send the message, check for errors -if (!$mail->send()) { - echo "Mailer Error: " . $mail->ErrorInfo; -} else { - echo "Message sent!"; - //Section 2: IMAP - //Uncomment these to save your message in the 'Sent Mail' folder. - #if (save_mail($mail)) { - # echo "Message saved!"; - #} -} - -//Section 2: IMAP -//IMAP commands requires the PHP IMAP Extension, found at: https://php.net/manual/en/imap.setup.php -//Function to call which uses the PHP imap_*() functions to save messages: https://php.net/manual/en/book.imap.php -//You can use imap_getmailboxes($imapStream, '/imap/ssl') to get a list of available folders or labels, this can -//be useful if you are trying to get this working on a non-Gmail IMAP server. -function save_mail($mail) -{ - //You can change 'Sent Mail' to any other folder or tag - $path = "{imap.gmail.com:993/imap/ssl}[Gmail]/Sent Mail"; - - //Tell your server to open an IMAP connection using the same username and password as you used for SMTP - $imapStream = imap_open($path, $mail->Username, $mail->Password); - - $result = imap_append($imapStream, $path, $mail->getSentMIMEMessage()); - imap_close($imapStream); - - return $result; -} diff --git a/core/l/PHPMailer/examples/gmail_xoauth.phps b/core/l/PHPMailer/examples/gmail_xoauth.phps deleted file mode 100755 index f2cc1e8..0000000 --- a/core/l/PHPMailer/examples/gmail_xoauth.phps +++ /dev/null @@ -1,105 +0,0 @@ -isSMTP(); - -//Enable SMTP debugging -// 0 = off (for production use) -// 1 = client messages -// 2 = client and server messages -$mail->SMTPDebug = 2; - -//Set the hostname of the mail server -$mail->Host = 'smtp.gmail.com'; - -//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission -$mail->Port = 587; - -//Set the encryption system to use - ssl (deprecated) or tls -$mail->SMTPSecure = 'tls'; - -//Whether to use SMTP authentication -$mail->SMTPAuth = true; - -//Set AuthType to use XOAUTH2 -$mail->AuthType = 'XOAUTH2'; - -//Fill in authentication details here -//Either the gmail account owner, or the user that gave consent -$email = 'someone@gmail.com'; -$clientId = 'RANDOMCHARS-----duv1n2.apps.googleusercontent.com'; -$clientSecret = 'RANDOMCHARS-----lGyjPcRtvP'; - -//Obtained by configuring and running get_oauth_token.php -//after setting up an app in Google Developer Console. -$refreshToken = 'RANDOMCHARS-----DWxgOvPT003r-yFUV49TQYag7_Aod7y0'; - -//Create a new OAuth2 provider instance -$provider = new Google( - [ - 'clientId' => $clientId, - 'clientSecret' => $clientSecret, - ] -); - -//Pass the OAuth provider instance to PHPMailer -$mail->setOAuth( - new OAuth( - [ - 'provider' => $provider, - 'clientId' => $clientId, - 'clientSecret' => $clientSecret, - 'refreshToken' => $refreshToken, - 'userName' => $email, - ] - ) -); - -//Set who the message is to be sent from -//For gmail, this generally needs to be the same as the user you logged in as -$mail->setFrom($email, 'First Last'); - -//Set who the message is to be sent to -$mail->addAddress('someone@gmail.com', 'John Doe'); - -//Set the subject line -$mail->Subject = 'PHPMailer GMail XOAUTH2 SMTP test'; - -//Read an HTML message body from an external file, convert referenced images to embedded, -//convert HTML into a basic plain-text alternative body -$mail->CharSet = 'utf-8'; -$mail->msgHTML(file_get_contents('contentsutf8.html'), __DIR__); - -//Replace the plain text body with one created manually -$mail->AltBody = 'This is a plain-text message body'; - -//Attach an image file -$mail->addAttachment('images/phpmailer_mini.png'); - -//send the message, check for errors -if (!$mail->send()) { - echo "Mailer Error: " . $mail->ErrorInfo; -} else { - echo "Message sent!"; -} diff --git a/core/l/PHPMailer/examples/images/phpmailer.png b/core/l/PHPMailer/examples/images/phpmailer.png deleted file mode 100755 index 9bdd83c..0000000 Binary files a/core/l/PHPMailer/examples/images/phpmailer.png and /dev/null differ diff --git a/core/l/PHPMailer/examples/images/phpmailer_mini.png b/core/l/PHPMailer/examples/images/phpmailer_mini.png deleted file mode 100755 index e6915f4..0000000 Binary files a/core/l/PHPMailer/examples/images/phpmailer_mini.png and /dev/null differ diff --git a/core/l/PHPMailer/examples/mail.phps b/core/l/PHPMailer/examples/mail.phps deleted file mode 100755 index 35d331f..0000000 --- a/core/l/PHPMailer/examples/mail.phps +++ /dev/null @@ -1,34 +0,0 @@ -setFrom('from@example.com', 'First Last'); -//Set an alternative reply-to address -$mail->addReplyTo('replyto@example.com', 'First Last'); -//Set who the message is to be sent to -$mail->addAddress('whoto@example.com', 'John Doe'); -//Set the subject line -$mail->Subject = 'PHPMailer mail() test'; -//Read an HTML message body from an external file, convert referenced images to embedded, -//convert HTML into a basic plain-text alternative body -$mail->msgHTML(file_get_contents('contents.html'), __DIR__); -//Replace the plain text body with one created manually -$mail->AltBody = 'This is a plain-text message body'; -//Attach an image file -$mail->addAttachment('images/phpmailer_mini.png'); - -//send the message, check for errors -if (!$mail->send()) { - echo "Mailer Error: " . $mail->ErrorInfo; -} else { - echo "Message sent!"; -} diff --git a/core/l/PHPMailer/examples/mailing_list.phps b/core/l/PHPMailer/examples/mailing_list.phps deleted file mode 100755 index 828be19..0000000 --- a/core/l/PHPMailer/examples/mailing_list.phps +++ /dev/null @@ -1,65 +0,0 @@ -isSMTP(); -$mail->Host = 'smtp.example.com'; -$mail->SMTPAuth = true; -$mail->SMTPKeepAlive = true; // SMTP connection will not close after each email sent, reduces SMTP overhead -$mail->Port = 25; -$mail->Username = 'yourname@example.com'; -$mail->Password = 'yourpassword'; -$mail->setFrom('list@example.com', 'List manager'); -$mail->addReplyTo('list@example.com', 'List manager'); - -$mail->Subject = "PHPMailer Simple database mailing list test"; - -//Same body for all messages, so set this before the sending loop -//If you generate a different body for each recipient (e.g. you're using a templating system), -//set it inside the loop -$mail->msgHTML($body); -//msgHTML also sets AltBody, but if you want a custom one, set it afterwards -$mail->AltBody = 'To view the message, please use an HTML compatible email viewer!'; - -//Connect to the database and select the recipients from your mailing list that have not yet been sent to -//You'll need to alter this to match your database -$mysql = mysqli_connect('localhost', 'username', 'password'); -mysqli_select_db($mysql, 'mydb'); -$result = mysqli_query($mysql, 'SELECT full_name, email, photo FROM mailinglist WHERE sent = FALSE'); - -foreach ($result as $row) { - $mail->addAddress($row['email'], $row['full_name']); - if (!empty($row['photo'])) { - $mail->addStringAttachment($row['photo'], 'YourPhoto.jpg'); //Assumes the image data is stored in the DB - } - - if (!$mail->send()) { - echo "Mailer Error (" . str_replace("@", "@", $row["email"]) . ') ' . $mail->ErrorInfo . '
'; - break; //Abandon sending - } else { - echo "Message sent to :" . $row['full_name'] . ' (' . str_replace("@", "@", $row['email']) . ')
'; - //Mark it as sent in the DB - mysqli_query( - $mysql, - "UPDATE mailinglist SET sent = TRUE WHERE email = '" . - mysqli_real_escape_string($mysql, $row['email']) . "'" - ); - } - // Clear all addresses and attachments for next loop - $mail->clearAddresses(); - $mail->clearAttachments(); -} diff --git a/core/l/PHPMailer/examples/pop_before_smtp.phps b/core/l/PHPMailer/examples/pop_before_smtp.phps deleted file mode 100755 index 94222d8..0000000 --- a/core/l/PHPMailer/examples/pop_before_smtp.phps +++ /dev/null @@ -1,58 +0,0 @@ -isSMTP(); - //Enable SMTP debugging - // 0 = off (for production use) - // 1 = client messages - // 2 = client and server messages - $mail->SMTPDebug = 2; - //Set the hostname of the mail server - $mail->Host = 'mail.example.com'; - //Set the SMTP port number - likely to be 25, 465 or 587 - $mail->Port = 25; - //Whether to use SMTP authentication - $mail->SMTPAuth = false; - //Set who the message is to be sent from - $mail->setFrom('from@example.com', 'First Last'); - //Set an alternative reply-to address - $mail->addReplyTo('replyto@example.com', 'First Last'); - //Set who the message is to be sent to - $mail->addAddress('whoto@example.com', 'John Doe'); - //Set the subject line - $mail->Subject = 'PHPMailer POP-before-SMTP test'; - //Read an HTML message body from an external file, convert referenced images to embedded, - //and convert the HTML into a basic plain-text alternative body - $mail->msgHTML(file_get_contents('contents.html'), __DIR__); - //Replace the plain text body with one created manually - $mail->AltBody = 'This is a plain-text message body'; - //Attach an image file - $mail->addAttachment('images/phpmailer_mini.png'); - //send the message - //Note that we don't need check the response from this because it will throw an exception if it has trouble - $mail->send(); - echo 'Message sent!'; -} catch (Exception $e) { - echo $e->errorMessage(); //Pretty error messages from PHPMailer -} catch (\Exception $e) { - echo $e->getMessage(); //Boring error messages from anything else! -} diff --git a/core/l/PHPMailer/examples/send_file_upload.phps b/core/l/PHPMailer/examples/send_file_upload.phps deleted file mode 100755 index 2ba3e41..0000000 --- a/core/l/PHPMailer/examples/send_file_upload.phps +++ /dev/null @@ -1,52 +0,0 @@ -setFrom('from@example.com', 'First Last'); - $mail->addAddress('whoto@example.com', 'John Doe'); - $mail->Subject = 'PHPMailer file sender'; - $mail->Body = 'My message body'; - // Attach the uploaded file - $mail->addAttachment($uploadfile, 'My uploaded file'); - if (!$mail->send()) { - $msg .= "Mailer Error: " . $mail->ErrorInfo; - } else { - $msg .= "Message sent!"; - } - } else { - $msg .= 'Failed to move file to ' . $uploadfile; - } -} -?> - - - - - PHPMailer Upload - - - -
- Send this file: - -
- - - \ No newline at end of file diff --git a/core/l/PHPMailer/examples/send_multiple_file_upload.phps b/core/l/PHPMailer/examples/send_multiple_file_upload.phps deleted file mode 100755 index 1c96b10..0000000 --- a/core/l/PHPMailer/examples/send_multiple_file_upload.phps +++ /dev/null @@ -1,53 +0,0 @@ -setFrom('from@example.com', 'First Last'); - $mail->addAddress('whoto@example.com', 'John Doe'); - $mail->Subject = 'PHPMailer file sender'; - $mail->Body = 'My message body'; - //Attach multiple files one by one - for ($ct = 0; $ct < count($_FILES['userfile']['tmp_name']); $ct++) { - $uploadfile = tempnam(sys_get_temp_dir(), hash('sha256', $_FILES['userfile']['name'][$ct])); - $filename = $_FILES['userfile']['name'][$ct]; - if (move_uploaded_file($_FILES['userfile']['tmp_name'][$ct], $uploadfile)) { - $mail->addAttachment($uploadfile, $filename); - } else { - $msg .= 'Failed to move file to ' . $uploadfile; - } - } - if (!$mail->send()) { - $msg .= "Mailer Error: " . $mail->ErrorInfo; - } else { - $msg .= "Message sent!"; - } -} -?> - - - - - PHPMailer Upload - - - -
- - Select one or more files: - - -
- - - diff --git a/core/l/PHPMailer/examples/sendmail.phps b/core/l/PHPMailer/examples/sendmail.phps deleted file mode 100755 index c05649b..0000000 --- a/core/l/PHPMailer/examples/sendmail.phps +++ /dev/null @@ -1,36 +0,0 @@ -isSendmail(); -//Set who the message is to be sent from -$mail->setFrom('from@example.com', 'First Last'); -//Set an alternative reply-to address -$mail->addReplyTo('replyto@example.com', 'First Last'); -//Set who the message is to be sent to -$mail->addAddress('whoto@example.com', 'John Doe'); -//Set the subject line -$mail->Subject = 'PHPMailer sendmail test'; -//Read an HTML message body from an external file, convert referenced images to embedded, -//convert HTML into a basic plain-text alternative body -$mail->msgHTML(file_get_contents('contents.html'), __DIR__); -//Replace the plain text body with one created manually -$mail->AltBody = 'This is a plain-text message body'; -//Attach an image file -$mail->addAttachment('images/phpmailer_mini.png'); - -//send the message, check for errors -if (!$mail->send()) { - echo "Mailer Error: " . $mail->ErrorInfo; -} else { - echo "Message sent!"; -} diff --git a/core/l/PHPMailer/examples/simple_contact_form.phps b/core/l/PHPMailer/examples/simple_contact_form.phps deleted file mode 100755 index 650364c..0000000 --- a/core/l/PHPMailer/examples/simple_contact_form.phps +++ /dev/null @@ -1,101 +0,0 @@ -isSMTP(); - $mail->Host = 'localhost'; - $mail->Port = 2500; - $mail->CharSet = 'utf-8'; - //It's important not to use the submitter's address as the from address as it's forgery, - //which will cause your messages to fail SPF checks. - //Use an address in your own domain as the from address, put the submitter's address in a reply-to - $mail->setFrom('contact@example.com', (empty($name) ? 'Contact form' : $name)); - $mail->addAddress($to); - $mail->addReplyTo($email, $name); - $mail->Subject = 'Contact form: ' . $subject; - $mail->Body = "Contact form submission\n\n" . $query; - if (!$mail->send()) { - $msg .= "Mailer Error: " . $mail->ErrorInfo; - } else { - $msg .= "Message sent!"; - } - } -} ?> - - - - - PHPMailer Contact Form - - -

Contact us

- -
- -
-
-
-
-
-
- -
- - - \ No newline at end of file diff --git a/core/l/PHPMailer/examples/smime_signed_mail.phps b/core/l/PHPMailer/examples/smime_signed_mail.phps deleted file mode 100755 index 1951f7a..0000000 --- a/core/l/PHPMailer/examples/smime_signed_mail.phps +++ /dev/null @@ -1,98 +0,0 @@ -setFrom('from@example.com', 'First Last'); -//Set an alternative reply-to address -$mail->addReplyTo('replyto@example.com', 'First Last'); -//Set who the message is to be sent to -$mail->addAddress('whoto@example.com', 'John Doe'); -//Set the subject line -$mail->Subject = 'PHPMailer mail() test'; -//Read an HTML message body from an external file, convert referenced images to embedded, -//Convert HTML into a basic plain-text alternative body -$mail->msgHTML(file_get_contents('contents.html'), __DIR__); -//Replace the plain text body with one created manually -$mail->AltBody = 'This is a plain-text message body'; -//Attach an image file -$mail->addAttachment('images/phpmailer_mini.png'); - -//Configure message signing (the actual signing does not occur until sending) -$mail->sign( - '/path/to/cert.crt', //The location of your certificate file - '/path/to/cert.key', //The location of your private key file - //The password you protected your private key with (not the Import Password! - //May be empty but the parameter must not be omitted! - 'yourSecretPrivateKeyPassword', - '/path/to/certchain.pem' //The location of your chain file -); - -//Send the message, check for errors -if (!$mail->send()) { - echo "Mailer Error: " . $mail->ErrorInfo; -} else { - echo "Message sent!"; -} -/* - * REMARKS: - * If your email client does not support S/MIME it will most likely just show an attachment smime.p7s, - * which is the signature contained in the email. - * Other clients, such as Thunderbird support S/MIME natively and will validate the signature - * automatically and report the result in some way. - */ diff --git a/core/l/PHPMailer/examples/smtp.phps b/core/l/PHPMailer/examples/smtp.phps deleted file mode 100755 index 792d8d9..0000000 --- a/core/l/PHPMailer/examples/smtp.phps +++ /dev/null @@ -1,55 +0,0 @@ -isSMTP(); -//Enable SMTP debugging -// 0 = off (for production use) -// 1 = client messages -// 2 = client and server messages -$mail->SMTPDebug = 2; -//Set the hostname of the mail server -$mail->Host = 'mail.example.com'; -//Set the SMTP port number - likely to be 25, 465 or 587 -$mail->Port = 25; -//Whether to use SMTP authentication -$mail->SMTPAuth = true; -//Username to use for SMTP authentication -$mail->Username = 'yourname@example.com'; -//Password to use for SMTP authentication -$mail->Password = 'yourpassword'; -//Set who the message is to be sent from -$mail->setFrom('from@example.com', 'First Last'); -//Set an alternative reply-to address -$mail->addReplyTo('replyto@example.com', 'First Last'); -//Set who the message is to be sent to -$mail->addAddress('whoto@example.com', 'John Doe'); -//Set the subject line -$mail->Subject = 'PHPMailer SMTP test'; -//Read an HTML message body from an external file, convert referenced images to embedded, -//convert HTML into a basic plain-text alternative body -$mail->msgHTML(file_get_contents('contents.html'), __DIR__); -//Replace the plain text body with one created manually -$mail->AltBody = 'This is a plain-text message body'; -//Attach an image file -$mail->addAttachment('images/phpmailer_mini.png'); - -//send the message, check for errors -if (!$mail->send()) { - echo 'Mailer Error: ' . $mail->ErrorInfo; -} else { - echo 'Message sent!'; -} diff --git a/core/l/PHPMailer/examples/smtp_check.phps b/core/l/PHPMailer/examples/smtp_check.phps deleted file mode 100755 index 93a2807..0000000 --- a/core/l/PHPMailer/examples/smtp_check.phps +++ /dev/null @@ -1,59 +0,0 @@ -do_debug = SMTP::DEBUG_CONNECTION; - -try { - //Connect to an SMTP server - if (!$smtp->connect('mail.example.com', 25)) { - throw new Exception('Connect failed'); - } - //Say hello - if (!$smtp->hello(gethostname())) { - throw new Exception('EHLO failed: ' . $smtp->getError()['error']); - } - //Get the list of ESMTP services the server offers - $e = $smtp->getServerExtList(); - //If server can do TLS encryption, use it - if (is_array($e) && array_key_exists('STARTTLS', $e)) { - $tlsok = $smtp->startTLS(); - if (!$tlsok) { - throw new Exception('Failed to start encryption: ' . $smtp->getError()['error']); - } - //Repeat EHLO after STARTTLS - if (!$smtp->hello(gethostname())) { - throw new Exception('EHLO (2) failed: ' . $smtp->getError()['error']); - } - //Get new capabilities list, which will usually now include AUTH if it didn't before - $e = $smtp->getServerExtList(); - } - //If server supports authentication, do it (even if no encryption) - if (is_array($e) && array_key_exists('AUTH', $e)) { - if ($smtp->authenticate('username', 'password')) { - echo "Connected ok!"; - } else { - throw new Exception('Authentication failed: ' . $smtp->getError()['error']); - } - } -} catch (Exception $e) { - echo 'SMTP error: ' . $e->getMessage(), "\n"; -} -//Whatever happened, close the connection. -$smtp->quit(true); diff --git a/core/l/PHPMailer/examples/smtp_low_memory.phps b/core/l/PHPMailer/examples/smtp_low_memory.phps deleted file mode 100755 index 9c0ff0a..0000000 --- a/core/l/PHPMailer/examples/smtp_low_memory.phps +++ /dev/null @@ -1,130 +0,0 @@ -sendCommand('DATA', 'DATA', 354)) { - return false; - } - - /* The server is ready to accept data! - * According to rfc821 we should not send more than 1000 characters on a single line (including the LE) - * so we will break the data up into lines by \r and/or \n then if needed we will break each of those into - * smaller lines to fit within the limit. - * We will also look for lines that start with a '.' and prepend an additional '.'. - * NOTE: this does not count towards line-length limit. - */ - - // Normalize line breaks - $msg_data = str_replace(["\r\n", "\r"], "\n", $msg_data); - - /* To distinguish between a complete RFC822 message and a plain message body, we check if the first field - * of the first line (':' separated) does not contain a space then it _should_ be a header and we will - * process all lines before a blank line as headers. - */ - - $firstline = substr($msg_data, 0, strcspn($msg_data, "\n", 0)); - $field = substr($firstline, 0, strpos($firstline, ':')); - $in_headers = false; - if (!empty($field) && strpos($field, ' ') === false) { - $in_headers = true; - } - - $offset = 0; - $len = strlen($msg_data); - while ($offset < $len) { - //Get position of next line break - $linelen = strcspn($msg_data, "\n", $offset); - //Get the next line - $line = substr($msg_data, $offset, $linelen); - //Remember where we have got to - $offset += ($linelen + 1); - $lines_out = []; - if ($in_headers and $line == '') { - $in_headers = false; - } - //We need to break this line up into several smaller lines - //This is a small micro-optimisation: isset($str[$len]) is equivalent to (strlen($str) > $len) - while (isset($line[self::MAX_LINE_LENGTH])) { - //Working backwards, try to find a space within the last MAX_LINE_LENGTH chars of the line to break on - //so as to avoid breaking in the middle of a word - $pos = strrpos(substr($line, 0, self::MAX_LINE_LENGTH), ' '); - //Deliberately matches both false and 0 - if (!$pos) { - //No nice break found, add a hard break - $pos = self::MAX_LINE_LENGTH - 1; - $lines_out[] = substr($line, 0, $pos); - $line = substr($line, $pos); - } else { - //Break at the found point - $lines_out[] = substr($line, 0, $pos); - //Move along by the amount we dealt with - $line = substr($line, $pos + 1); - } - //If processing headers add a LWSP-char to the front of new line RFC822 section 3.1.1 - if ($in_headers) { - $line = "\t" . $line; - } - } - $lines_out[] = $line; - - //Send the lines to the server - foreach ($lines_out as $line_out) { - //RFC2821 section 4.5.2 - if (!empty($line_out) and $line_out[0] == '.') { - $line_out = '.' . $line_out; - } - $this->client_send($line_out . self::LE); - } - } - - //Message data has been sent, complete the command - //Increase timelimit for end of DATA command - $savetimelimit = $this->Timelimit; - $this->Timelimit = $this->Timelimit * 2; - $result = $this->sendCommand('DATA END', '.', 250); - //Restore timelimit - $this->Timelimit = $savetimelimit; - - return $result; - } -} - -/** - * We need to use a PHPMailer subclass to make it use our SMTP implementation. - * @package PHPMailer\PHPMailer - */ -class PHPMailerLowMemory extends PHPMailer -{ - /** - * Patch in the new SMTP class. - * @return SMTP - */ - public function getSMTPInstance() - { - if (!is_object($this->smtp)) { - $this->smtp = new SMTPLowMemory; - } - - return $this->smtp; - } -} diff --git a/core/l/PHPMailer/examples/smtp_no_auth.phps b/core/l/PHPMailer/examples/smtp_no_auth.phps deleted file mode 100755 index c635434..0000000 --- a/core/l/PHPMailer/examples/smtp_no_auth.phps +++ /dev/null @@ -1,51 +0,0 @@ -isSMTP(); -//Enable SMTP debugging -// 0 = off (for production use) -// 1 = client messages -// 2 = client and server messages -$mail->SMTPDebug = 2; -//Set the hostname of the mail server -$mail->Host = 'mail.example.com'; -//Set the SMTP port number - likely to be 25, 465 or 587 -$mail->Port = 25; -//We don't need to set this as it's the default value -//$mail->SMTPAuth = false; -//Set who the message is to be sent from -$mail->setFrom('from@example.com', 'First Last'); -//Set an alternative reply-to address -$mail->addReplyTo('replyto@example.com', 'First Last'); -//Set who the message is to be sent to -$mail->addAddress('whoto@example.com', 'John Doe'); -//Set the subject line -$mail->Subject = 'PHPMailer SMTP without auth test'; -//Read an HTML message body from an external file, convert referenced images to embedded, -//convert HTML into a basic plain-text alternative body -$mail->msgHTML(file_get_contents('contents.html'), __DIR__); -//Replace the plain text body with one created manually -$mail->AltBody = 'This is a plain-text message body'; -//Attach an image file -$mail->addAttachment('images/phpmailer_mini.png'); - -//send the message, check for errors -if (!$mail->send()) { - echo "Mailer Error: " . $mail->ErrorInfo; -} else { - echo "Message sent!"; -} diff --git a/core/l/PHPMailer/examples/ssl_options.phps b/core/l/PHPMailer/examples/ssl_options.phps deleted file mode 100755 index 1cfc25c..0000000 --- a/core/l/PHPMailer/examples/ssl_options.phps +++ /dev/null @@ -1,75 +0,0 @@ -isSMTP(); - -//Enable SMTP debugging -// 0 = off (for production use) -// 1 = client messages -// 2 = client and server messages -$mail->SMTPDebug = 2; - -//Set the hostname of the mail server -$mail->Host = 'smtp.example.com'; - -//Set the SMTP port number - 587 for authenticated TLS, a.k.a. RFC4409 SMTP submission -$mail->Port = 587; - -//Set the encryption system to use - ssl (deprecated) or tls -$mail->SMTPSecure = 'tls'; - -//Custom connection options -//Note that these settings are INSECURE -$mail->SMTPOptions = array( - 'ssl' => [ - 'verify_peer' => true, - 'verify_depth' => 3, - 'allow_self_signed' => true, - 'peer_name' => 'smtp.example.com', - 'cafile' => '/etc/ssl/ca_cert.pem', - ], -); - -//Whether to use SMTP authentication -$mail->SMTPAuth = true; - -//Username to use for SMTP authentication - use full email address for gmail -$mail->Username = 'username@example.com'; - -//Password to use for SMTP authentication -$mail->Password = 'yourpassword'; - -//Set who the message is to be sent from -$mail->setFrom('from@example.com', 'First Last'); - -//Set who the message is to be sent to -$mail->addAddress('whoto@example.com', 'John Doe'); - -//Set the subject line -$mail->Subject = 'PHPMailer SMTP options test'; - -//Read an HTML message body from an external file, convert referenced images to embedded, -//convert HTML into a basic plain-text alternative body -$mail->msgHTML(file_get_contents('contents.html'), __DIR__); - -//Send the message, check for errors -if (!$mail->send()) { - echo 'Mailer Error: ' . $mail->ErrorInfo; -} else { - echo 'Message sent!'; -} diff --git a/core/l/PHPMailer/get_oauth_token.php b/core/l/PHPMailer/get_oauth_token.php deleted file mode 100755 index 1237b57..0000000 --- a/core/l/PHPMailer/get_oauth_token.php +++ /dev/null @@ -1,144 +0,0 @@ - - * @author Jim Jagielski (jimjag) - * @author Andy Prevost (codeworxtech) - * @author Brent R. Matzelle (original founder) - * @copyright 2012 - 2017 Marcus Bointon - * @copyright 2010 - 2012 Jim Jagielski - * @copyright 2004 - 2009 Andy Prevost - * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License - * @note This program is distributed in the hope that it will be useful - WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. - */ -/** - * Get an OAuth2 token from an OAuth2 provider. - * * Install this script on your server so that it's accessible - * as [https/http]:////get_oauth_token.php - * e.g.: http://localhost/phpmailer/get_oauth_token.php - * * Ensure dependencies are installed with 'composer install' - * * Set up an app in your Google/Yahoo/Microsoft account - * * Set the script address as the app's redirect URL - * If no refresh token is obtained when running this file, - * revoke access to your app and run the script again. - */ - -namespace PHPMailer\PHPMailer; - -/** - * Aliases for League Provider Classes - * Make sure you have added these to your composer.json and run `composer install` - * Plenty to choose from here: - * @see http://oauth2-client.thephpleague.com/providers/thirdparty/ - */ -// @see https://github.com/thephpleague/oauth2-google -use League\OAuth2\Client\Provider\Google; -// @see https://packagist.org/packages/hayageek/oauth2-yahoo -use Hayageek\OAuth2\Client\Provider\Yahoo; -// @see https://github.com/stevenmaguire/oauth2-microsoft -use Stevenmaguire\OAuth2\Client\Provider\Microsoft; - -if (!isset($_GET['code']) && !isset($_GET['provider'])) { -?> - -Select Provider:
-Google
-Yahoo
-Microsoft/Outlook/Hotmail/Live/Office365
- - - $clientId, - 'clientSecret' => $clientSecret, - 'redirectUri' => $redirectUri, - 'accessType' => 'offline' -]; - -$options = []; -$provider = null; - -switch ($providerName) { - case 'Google': - $provider = new Google($params); - $options = [ - 'scope' => [ - 'https://mail.google.com/' - ] - ]; - break; - case 'Yahoo': - $provider = new Yahoo($params); - break; - case 'Microsoft': - $provider = new Microsoft($params); - $options = [ - 'scope' => [ - 'wl.imap', - 'wl.offline_access' - ] - ]; - break; -} - -if (null === $provider) { - exit('Provider missing'); -} - -if (!isset($_GET['code'])) { - // If we don't have an authorization code then get one - $authUrl = $provider->getAuthorizationUrl($options); - $_SESSION['oauth2state'] = $provider->getState(); - header('Location: ' . $authUrl); - exit; -// Check given state against previously stored one to mitigate CSRF attack -} elseif (empty($_GET['state']) || ($_GET['state'] !== $_SESSION['oauth2state'])) { - unset($_SESSION['oauth2state']); - unset($_SESSION['provider']); - exit('Invalid state'); -} else { - unset($_SESSION['provider']); - // Try to get an access token (using the authorization code grant) - $token = $provider->getAccessToken( - 'authorization_code', - [ - 'code' => $_GET['code'] - ] - ); - // Use this to interact with an API on the users behalf - // Use this to get a new access token if the old one expires - echo 'Refresh Token: ', $token->getRefreshToken(); -} diff --git a/core/l/PHPMailer/language/phpmailer.lang-am.php b/core/l/PHPMailer/language/phpmailer.lang-am.php deleted file mode 100755 index ff2a969..0000000 --- a/core/l/PHPMailer/language/phpmailer.lang-am.php +++ /dev/null @@ -1,26 +0,0 @@ - - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP -Õ« Õ½Õ­Õ¡Õ¬: Õ¹Õ°Õ¡Õ»Õ¸Õ²Õ¾Õ¥Ö Õ½Õ¿Õ¸Ö‚Õ£Õ¥Õ¬ Õ«Õ½Õ¯Õ¸Ö‚Õ©ÕµÕ¸Ö‚Õ¶Õ¨.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP -Õ« Õ½Õ­Õ¡Õ¬: Õ¹Õ°Õ¡Õ»Õ¸Õ²Õ¾Õ¥Ö Õ¯Õ¡Õº Õ°Õ¡Õ½Õ¿Õ¡Õ¿Õ¥Õ¬ SMTP Õ½Õ¥Ö€Õ¾Õ¥Ö€Õ« Õ°Õ¥Õ¿.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP -Õ« Õ½Õ­Õ¡Õ¬: Õ¿Õ¾ÕµÕ¡Õ¬Õ¶Õ¥Ö€Õ¨ Õ¨Õ¶Õ¤Õ¸Ö‚Õ¶Õ¾Õ¡Õ® Õ¹Õ¥Õ¶.'; -$PHPMAILER_LANG['empty_message'] = 'Õ€Õ¡Õ²Õ¸Ö€Õ¤Õ¡Õ£Ö€Õ¸Ö‚Õ©ÕµÕ¸Ö‚Õ¶Õ¨ Õ¤Õ¡Õ¿Õ¡Ö€Õ¯ Õ§'; -$PHPMAILER_LANG['encoding'] = 'Ô¿Õ¸Õ¤Õ¡Õ¾Õ¸Ö€Õ´Õ¡Õ¶ Õ¡Õ¶Õ°Õ¡ÕµÕ¿ Õ¿Õ¥Õ½Õ¡Õ¯: '; -$PHPMAILER_LANG['execute'] = 'Õ‰Õ°Õ¡Õ»Õ¸Õ²Õ¾Õ¥Ö Õ«Ö€Õ¡Õ¯Õ¡Õ¶Õ¡ÖÕ¶Õ¥Õ¬ Õ°Ö€Õ¡Õ´Õ¡Õ¶Õ¨: '; -$PHPMAILER_LANG['file_access'] = 'Õ–Õ¡ÕµÕ¬Õ¨ Õ°Õ¡Õ½Õ¡Õ¶Õ¥Õ¬Õ« Õ¹Õ§: '; -$PHPMAILER_LANG['file_open'] = 'Õ–Õ¡ÕµÕ¬Õ« Õ½Õ­Õ¡Õ¬: Ö†Õ¡ÕµÕ¬Õ¨ Õ¹Õ°Õ¡Õ»Õ¸Õ²Õ¾Õ¥Ö Õ¢Õ¡ÖÕ¥Õ¬: '; -$PHPMAILER_LANG['from_failed'] = 'ÕˆÖ‚Õ²Õ¡Ö€Õ¯Õ¸Õ²Õ« Õ°Õ¥Õ¿Ö‡ÕµÕ¡Õ¬ Õ°Õ¡Õ½ÖÕ¥Õ¶ Õ½Õ­Õ¡Õ¬ Õ§: '; -$PHPMAILER_LANG['instantiate'] = 'Õ€Õ¶Õ¡Ö€Õ¡Õ¾Õ¸Ö€ Õ¹Õ§ Õ¯Õ¡Õ¶Õ¹Õ¥Õ¬ mail Ö†Õ¸Ö‚Õ¶Õ¯ÖÕ«Õ¡Õ¶.'; -$PHPMAILER_LANG['invalid_address'] = 'Õ€Õ¡Õ½ÖÕ¥Õ¶ Õ½Õ­Õ¡Õ¬ Õ§: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' ÖƒÕ¸Õ½Õ¿Õ¡ÕµÕ«Õ¶ Õ½Õ¥Ö€Õ¾Õ¥Ö€Õ« Õ°Õ¥Õ¿ Õ¹Õ« Õ¡Õ·Õ­Õ¡Õ¿Õ¸Ö‚Õ´.'; -$PHPMAILER_LANG['provide_address'] = 'Ô±Õ¶Õ°Ö€Õ¡ÕªÕ¥Õ·Õ¿ Õ§ Õ¿Ö€Õ¡Õ´Õ¡Õ¤Ö€Õ¥Õ¬ Õ£Õ¸Õ¶Õ¥ Õ´Õ¥Õ¯ Õ½Õ¿Õ¡ÖÕ¸Õ²Õ« e-mail Õ°Õ¡Õ½ÖÕ¥.'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP -Õ« Õ½Õ­Õ¡Õ¬: Õ¹Õ« Õ°Õ¡Õ»Õ¸Õ²Õ¾Õ¥Õ¬ Õ¸Ö‚Õ²Õ¡Ö€Õ¯Õ¥Õ¬ Õ°Õ¥Õ¿Ö‡ÕµÕ¡Õ¬ Õ½Õ¿Õ¡ÖÕ¸Õ²Õ¶Õ¥Ö€Õ« Õ°Õ¡Õ½ÖÕ¥Õ¶Õ¥Ö€Õ«Õ¶: '; -$PHPMAILER_LANG['signing'] = 'ÕÕ¿Õ¸Ö€Õ¡Õ£Ö€Õ´Õ¡Õ¶ Õ½Õ­Õ¡Õ¬: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP -Õ« connect() Ö†Õ¸Ö‚Õ¶Õ¯ÖÕ«Õ¡Õ¶ Õ¹Õ« Õ°Õ¡Õ»Õ¸Õ²Õ¾Õ¥Õ¬'; -$PHPMAILER_LANG['smtp_error'] = 'SMTP Õ½Õ¥Ö€Õ¾Õ¥Ö€Õ« Õ½Õ­Õ¡Õ¬: '; -$PHPMAILER_LANG['variable_set'] = 'Õ‰Õ« Õ°Õ¡Õ»Õ¸Õ²Õ¾Õ¸Ö‚Õ´ Õ½Õ¿Õ¥Õ²Õ®Õ¥Õ¬ Õ¯Õ¡Õ´ Õ¾Õ¥Ö€Õ¡ÖƒÕ¸Õ­Õ¥Õ¬ ÖƒÕ¸ÖƒÕ¸Õ­Õ¡Õ¯Õ¡Õ¶Õ¨: '; -$PHPMAILER_LANG['extension_missing'] = 'Õ€Õ¡Õ¾Õ¥Õ¬Õ¾Õ¡Õ®Õ¨ Õ¢Õ¡ÖÕ¡Õ¯Õ¡ÕµÕ¸Ö‚Õ´ Õ§: '; diff --git a/core/l/PHPMailer/language/phpmailer.lang-ar.php b/core/l/PHPMailer/language/phpmailer.lang-ar.php deleted file mode 100755 index 790e2a5..0000000 --- a/core/l/PHPMailer/language/phpmailer.lang-ar.php +++ /dev/null @@ -1,27 +0,0 @@ - - */ - -$PHPMAILER_LANG['authenticate'] = 'خطأ SMTP : لا يمكن تأكيد الهوية.'; -$PHPMAILER_LANG['connect_host'] = 'خطأ SMTP: لا يمكن الاتصال بالخادم SMTP.'; -$PHPMAILER_LANG['data_not_accepted'] = 'خطأ SMTP: لم يتم قبول المعلومات .'; -$PHPMAILER_LANG['empty_message'] = 'نص الرسالة ÙØ§Ø±Øº'; -$PHPMAILER_LANG['encoding'] = 'ترميز غير معروÙ: '; -$PHPMAILER_LANG['execute'] = 'لا يمكن تنÙيذ : '; -$PHPMAILER_LANG['file_access'] = 'لا يمكن الوصول للملÙ: '; -$PHPMAILER_LANG['file_open'] = 'خطأ ÙÙŠ الملÙ: لا يمكن ÙØªØ­Ù‡: '; -$PHPMAILER_LANG['from_failed'] = 'خطأ على مستوى عنوان المرسل : '; -$PHPMAILER_LANG['instantiate'] = 'لا يمكن توÙير خدمة البريد.'; -$PHPMAILER_LANG['invalid_address'] = 'الإرسال غير ممكن لأن عنوان البريد الإلكتروني غير صالح: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' برنامج الإرسال غير مدعوم.'; -$PHPMAILER_LANG['provide_address'] = 'يجب توÙير عنوان البريد الإلكتروني لمستلم واحد على الأقل.'; -$PHPMAILER_LANG['recipients_failed'] = 'خطأ SMTP: الأخطاء التالية ' . - 'ÙØ´Ù„ ÙÙŠ الارسال لكل من : '; -$PHPMAILER_LANG['signing'] = 'خطأ ÙÙŠ التوقيع: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() غير ممكن.'; -$PHPMAILER_LANG['smtp_error'] = 'خطأ على مستوى الخادم SMTP: '; -$PHPMAILER_LANG['variable_set'] = 'لا يمكن تعيين أو إعادة تعيين متغير: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; diff --git a/core/l/PHPMailer/language/phpmailer.lang-az.php b/core/l/PHPMailer/language/phpmailer.lang-az.php deleted file mode 100755 index 3749d83..0000000 --- a/core/l/PHPMailer/language/phpmailer.lang-az.php +++ /dev/null @@ -1,26 +0,0 @@ - - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP GreÅ¡ka: Neuspjela prijava.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP GreÅ¡ka: Nije moguće spojiti se sa SMTP serverom.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP GreÅ¡ka: Podatci nisu prihvaćeni.'; -$PHPMAILER_LANG['empty_message'] = 'Sadržaj poruke je prazan.'; -$PHPMAILER_LANG['encoding'] = 'Nepoznata kriptografija: '; -$PHPMAILER_LANG['execute'] = 'Nije moguće izvrÅ¡iti naredbu: '; -$PHPMAILER_LANG['file_access'] = 'Nije moguće pristupiti datoteci: '; -$PHPMAILER_LANG['file_open'] = 'Nije moguće otvoriti datoteku: '; -$PHPMAILER_LANG['from_failed'] = 'SMTP GreÅ¡ka: Slanje sa navedenih e-mail adresa nije uspjelo: '; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP GreÅ¡ka: Slanje na navedene e-mail adrese nije uspjelo: '; -$PHPMAILER_LANG['instantiate'] = 'Ne mogu pokrenuti mail funkcionalnost.'; -$PHPMAILER_LANG['invalid_address'] = 'E-mail nije poslan. Neispravna e-mail adresa: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' mailer nije podržan.'; -$PHPMAILER_LANG['provide_address'] = 'DefiniÅ¡ite barem jednu adresu primaoca.'; -$PHPMAILER_LANG['signing'] = 'GreÅ¡ka prilikom prijave: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'Spajanje na SMTP server nije uspjelo.'; -$PHPMAILER_LANG['smtp_error'] = 'SMTP greÅ¡ka: '; -$PHPMAILER_LANG['variable_set'] = 'Nije moguće postaviti varijablu ili je vratiti nazad: '; -$PHPMAILER_LANG['extension_missing'] = 'Nedostaje ekstenzija: '; \ No newline at end of file diff --git a/core/l/PHPMailer/language/phpmailer.lang-be.php b/core/l/PHPMailer/language/phpmailer.lang-be.php deleted file mode 100755 index e2f98f0..0000000 --- a/core/l/PHPMailer/language/phpmailer.lang-be.php +++ /dev/null @@ -1,26 +0,0 @@ - - */ - -$PHPMAILER_LANG['authenticate'] = 'Памылка SMTP: памылка ідÑнтыфікацыі.'; -$PHPMAILER_LANG['connect_host'] = 'Памылка SMTP: нельга ÑžÑтанавіць ÑувÑзь з SMTP-Ñерверам.'; -$PHPMAILER_LANG['data_not_accepted'] = 'Памылка SMTP: звеÑткі непрынÑтыÑ.'; -$PHPMAILER_LANG['empty_message'] = 'ПуÑтое паведамленне.'; -$PHPMAILER_LANG['encoding'] = 'ÐевÑÐ´Ð¾Ð¼Ð°Ñ ÐºÐ°Ð´Ñ‹Ñ€Ð¾ÑžÐºÐ° Ñ‚ÑкÑту: '; -$PHPMAILER_LANG['execute'] = 'Ðельга выканаць каманду: '; -$PHPMAILER_LANG['file_access'] = 'ÐÑма доÑтупу да файла: '; -$PHPMAILER_LANG['file_open'] = 'Ðельга адкрыць файл: '; -$PHPMAILER_LANG['from_failed'] = 'ÐÑправільны Ð°Ð´Ñ€Ð°Ñ Ð°Ð´Ð¿Ñ€Ð°ÑžÐ½Ñ–ÐºÐ°: '; -$PHPMAILER_LANG['instantiate'] = 'Ðельга прымÑніць функцыю mail().'; -$PHPMAILER_LANG['invalid_address'] = 'Ðельга даÑлаць паведамленне, нÑправільны email атрымальніка: '; -$PHPMAILER_LANG['provide_address'] = 'Запоўніце, калі лаÑка, правільны email атрымальніка.'; -$PHPMAILER_LANG['mailer_not_supported'] = ' - паштовы Ñервер не падтрымліваецца.'; -$PHPMAILER_LANG['recipients_failed'] = 'Памылка SMTP: нÑÐ¿Ñ€Ð°Ð²Ñ–Ð»ÑŒÐ½Ñ‹Ñ Ð°Ñ‚Ñ€Ñ‹Ð¼Ð°Ð»ÑŒÐ½Ñ–ÐºÑ–: '; -$PHPMAILER_LANG['signing'] = 'Памылка подпіÑу паведамленнÑ: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'Памылка ÑувÑзі з SMTP-Ñерверам.'; -$PHPMAILER_LANG['smtp_error'] = 'Памылка SMTP: '; -$PHPMAILER_LANG['variable_set'] = 'Ðельга ÑžÑтанавіць або перамÑніць значÑнне пераменнай: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; diff --git a/core/l/PHPMailer/language/phpmailer.lang-bg.php b/core/l/PHPMailer/language/phpmailer.lang-bg.php deleted file mode 100755 index b22941f..0000000 --- a/core/l/PHPMailer/language/phpmailer.lang-bg.php +++ /dev/null @@ -1,26 +0,0 @@ - - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP грешка: Ðе може да Ñе удоÑтовери пред Ñървъра.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP грешка: Ðе може да Ñе Ñвърже Ñ SMTP хоÑта.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP грешка: данните не Ñа приети.'; -$PHPMAILER_LANG['empty_message'] = 'Съдържанието на Ñъобщението е празно'; -$PHPMAILER_LANG['encoding'] = 'ÐеизвеÑтно кодиране: '; -$PHPMAILER_LANG['execute'] = 'Ðе може да Ñе изпълни: '; -$PHPMAILER_LANG['file_access'] = 'ÐÑма доÑтъп до файл: '; -$PHPMAILER_LANG['file_open'] = 'Файлова грешка: Ðе може да Ñе отвори файл: '; -$PHPMAILER_LANG['from_failed'] = 'Следните адреÑи за подател Ñа невалидни: '; -$PHPMAILER_LANG['instantiate'] = 'Ðе може да Ñе инÑтанцира функциÑта mail.'; -$PHPMAILER_LANG['invalid_address'] = 'Ðевалиден адреÑ: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' - пощенÑки Ñървър не Ñе поддържа.'; -$PHPMAILER_LANG['provide_address'] = 'ТрÑбва да предоÑтавите поне един email Ð°Ð´Ñ€ÐµÑ Ð·Ð° получател.'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP грешка: Следните адреÑи за Получател Ñа невалидни: '; -$PHPMAILER_LANG['signing'] = 'Грешка при подпиÑване: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP провален connect().'; -$PHPMAILER_LANG['smtp_error'] = 'SMTP Ñървърна грешка: '; -$PHPMAILER_LANG['variable_set'] = 'Ðе може да Ñе уÑтанови или възÑтанови променлива: '; -$PHPMAILER_LANG['extension_missing'] = 'ЛипÑва разширение: '; diff --git a/core/l/PHPMailer/language/phpmailer.lang-ca.php b/core/l/PHPMailer/language/phpmailer.lang-ca.php deleted file mode 100755 index 4117596..0000000 --- a/core/l/PHPMailer/language/phpmailer.lang-ca.php +++ /dev/null @@ -1,26 +0,0 @@ - - */ - -$PHPMAILER_LANG['authenticate'] = 'Error SMTP: No s’ha pogut autenticar.'; -$PHPMAILER_LANG['connect_host'] = 'Error SMTP: No es pot connectar al servidor SMTP.'; -$PHPMAILER_LANG['data_not_accepted'] = 'Error SMTP: Dades no acceptades.'; -$PHPMAILER_LANG['empty_message'] = 'El cos del missatge està buit.'; -$PHPMAILER_LANG['encoding'] = 'Codificació desconeguda: '; -$PHPMAILER_LANG['execute'] = 'No es pot executar: '; -$PHPMAILER_LANG['file_access'] = 'No es pot accedir a l’arxiu: '; -$PHPMAILER_LANG['file_open'] = 'Error d’Arxiu: No es pot obrir l’arxiu: '; -$PHPMAILER_LANG['from_failed'] = 'La(s) següent(s) adreces de remitent han fallat: '; -$PHPMAILER_LANG['instantiate'] = 'No s’ha pogut crear una instància de la funció Mail.'; -$PHPMAILER_LANG['invalid_address'] = 'Adreça d’email invalida: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' mailer no està suportat'; -$PHPMAILER_LANG['provide_address'] = 'S’ha de proveir almenys una adreça d’email com a destinatari.'; -$PHPMAILER_LANG['recipients_failed'] = 'Error SMTP: Els següents destinataris han fallat: '; -$PHPMAILER_LANG['signing'] = 'Error al signar: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'Ha fallat el SMTP Connect().'; -$PHPMAILER_LANG['smtp_error'] = 'Error del servidor SMTP: '; -$PHPMAILER_LANG['variable_set'] = 'No s’ha pogut establir o restablir la variable: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; diff --git a/core/l/PHPMailer/language/phpmailer.lang-ch.php b/core/l/PHPMailer/language/phpmailer.lang-ch.php deleted file mode 100755 index 4fda6b8..0000000 --- a/core/l/PHPMailer/language/phpmailer.lang-ch.php +++ /dev/null @@ -1,26 +0,0 @@ - - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP 错误:身份验è¯å¤±è´¥ã€‚'; -$PHPMAILER_LANG['connect_host'] = 'SMTP 错误: ä¸èƒ½è¿žæŽ¥SMTP主机。'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP 错误: æ•°æ®ä¸å¯æŽ¥å—。'; -//$PHPMAILER_LANG['empty_message'] = 'Message body empty'; -$PHPMAILER_LANG['encoding'] = '未知编ç ï¼š'; -$PHPMAILER_LANG['execute'] = 'ä¸èƒ½æ‰§è¡Œ: '; -$PHPMAILER_LANG['file_access'] = 'ä¸èƒ½è®¿é—®æ–‡ä»¶ï¼š'; -$PHPMAILER_LANG['file_open'] = '文件错误:ä¸èƒ½æ‰“开文件:'; -$PHPMAILER_LANG['from_failed'] = '下é¢çš„å‘é€åœ°å€é‚®ä»¶å‘é€å¤±è´¥äº†ï¼š '; -$PHPMAILER_LANG['instantiate'] = 'ä¸èƒ½å®žçްmail方法。'; -//$PHPMAILER_LANG['invalid_address'] = 'Invalid address: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' 您所选择的å‘é€é‚®ä»¶çš„æ–¹æ³•并䏿”¯æŒã€‚'; -$PHPMAILER_LANG['provide_address'] = '您必须æä¾›è‡³å°‘一个 收信人的email地å€ã€‚'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP 错误: 下é¢çš„ æ”¶ä»¶äººå¤±è´¥äº†ï¼š '; -//$PHPMAILER_LANG['signing'] = 'Signing Error: '; -//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; -//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: '; -//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; diff --git a/core/l/PHPMailer/language/phpmailer.lang-cs.php b/core/l/PHPMailer/language/phpmailer.lang-cs.php deleted file mode 100755 index 1160cf0..0000000 --- a/core/l/PHPMailer/language/phpmailer.lang-cs.php +++ /dev/null @@ -1,25 +0,0 @@ - - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP fejl: Kunne ikke logge pÃ¥.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP fejl: Kunne ikke tilslutte SMTP serveren.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP fejl: Data kunne ikke accepteres.'; -//$PHPMAILER_LANG['empty_message'] = 'Message body empty'; -$PHPMAILER_LANG['encoding'] = 'Ukendt encode-format: '; -$PHPMAILER_LANG['execute'] = 'Kunne ikke køre: '; -$PHPMAILER_LANG['file_access'] = 'Ingen adgang til fil: '; -$PHPMAILER_LANG['file_open'] = 'Fil fejl: Kunne ikke Ã¥bne filen: '; -$PHPMAILER_LANG['from_failed'] = 'Følgende afsenderadresse er forkert: '; -$PHPMAILER_LANG['instantiate'] = 'Kunne ikke initialisere email funktionen.'; -//$PHPMAILER_LANG['invalid_address'] = 'Invalid address: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' mailer understøttes ikke.'; -$PHPMAILER_LANG['provide_address'] = 'Du skal indtaste mindst en modtagers emailadresse.'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP fejl: Følgende modtagere er forkerte: '; -//$PHPMAILER_LANG['signing'] = 'Signing Error: '; -//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; -//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: '; -//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; diff --git a/core/l/PHPMailer/language/phpmailer.lang-de.php b/core/l/PHPMailer/language/phpmailer.lang-de.php deleted file mode 100755 index aa987a9..0000000 --- a/core/l/PHPMailer/language/phpmailer.lang-de.php +++ /dev/null @@ -1,25 +0,0 @@ - - */ - -$PHPMAILER_LANG['authenticate'] = 'Error SMTP: Imposible autentificar.'; -$PHPMAILER_LANG['connect_host'] = 'Error SMTP: Imposible conectar al servidor SMTP.'; -$PHPMAILER_LANG['data_not_accepted'] = 'Error SMTP: Datos no aceptados.'; -$PHPMAILER_LANG['empty_message'] = 'El cuerpo del mensaje está vacío.'; -$PHPMAILER_LANG['encoding'] = 'Codificación desconocida: '; -$PHPMAILER_LANG['execute'] = 'Imposible ejecutar: '; -$PHPMAILER_LANG['file_access'] = 'Imposible acceder al archivo: '; -$PHPMAILER_LANG['file_open'] = 'Error de Archivo: Imposible abrir el archivo: '; -$PHPMAILER_LANG['from_failed'] = 'La(s) siguiente(s) direcciones de remitente fallaron: '; -$PHPMAILER_LANG['instantiate'] = 'Imposible crear una instancia de la función Mail.'; -$PHPMAILER_LANG['invalid_address'] = 'Imposible enviar: dirección de email inválido: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' mailer no está soportado.'; -$PHPMAILER_LANG['provide_address'] = 'Debe proporcionar al menos una dirección de email de destino.'; -$PHPMAILER_LANG['recipients_failed'] = 'Error SMTP: Los siguientes destinos fallaron: '; -$PHPMAILER_LANG['signing'] = 'Error al firmar: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() falló.'; -$PHPMAILER_LANG['smtp_error'] = 'Error del servidor SMTP: '; -$PHPMAILER_LANG['variable_set'] = 'No se pudo configurar la variable: '; -$PHPMAILER_LANG['extension_missing'] = 'Extensión faltante: '; diff --git a/core/l/PHPMailer/language/phpmailer.lang-et.php b/core/l/PHPMailer/language/phpmailer.lang-et.php deleted file mode 100755 index 7e06da1..0000000 --- a/core/l/PHPMailer/language/phpmailer.lang-et.php +++ /dev/null @@ -1,27 +0,0 @@ - - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP Viga: Autoriseerimise viga.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP Viga: Ei õnnestunud luua ühendust SMTP serveriga.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Viga: Vigased andmed.'; -$PHPMAILER_LANG['empty_message'] = 'Tühi kirja sisu'; -$PHPMAILER_LANG["encoding"] = 'Tundmatu kodeering: '; -$PHPMAILER_LANG['execute'] = 'Tegevus ebaõnnestus: '; -$PHPMAILER_LANG['file_access'] = 'Pole piisavalt õiguseid järgneva faili avamiseks: '; -$PHPMAILER_LANG['file_open'] = 'Faili Viga: Faili avamine ebaõnnestus: '; -$PHPMAILER_LANG['from_failed'] = 'Järgnev saatja e-posti aadress on vigane: '; -$PHPMAILER_LANG['instantiate'] = 'mail funktiooni käivitamine ebaõnnestus.'; -$PHPMAILER_LANG['invalid_address'] = 'Saatmine peatatud, e-posti address vigane: '; -$PHPMAILER_LANG['provide_address'] = 'Te peate määrama vähemalt ühe saaja e-posti aadressi.'; -$PHPMAILER_LANG['mailer_not_supported'] = ' maileri tugi puudub.'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP Viga: Järgnevate saajate e-posti aadressid on vigased: '; -$PHPMAILER_LANG["signing"] = 'Viga allkirjastamisel: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() ebaõnnestus.'; -$PHPMAILER_LANG['smtp_error'] = 'SMTP serveri viga: '; -$PHPMAILER_LANG['variable_set'] = 'Ei õnnestunud määrata või lähtestada muutujat: '; -$PHPMAILER_LANG['extension_missing'] = 'Nõutud laiendus on puudu: '; diff --git a/core/l/PHPMailer/language/phpmailer.lang-fa.php b/core/l/PHPMailer/language/phpmailer.lang-fa.php deleted file mode 100755 index ad0745c..0000000 --- a/core/l/PHPMailer/language/phpmailer.lang-fa.php +++ /dev/null @@ -1,27 +0,0 @@ - - * @author Mohammad Hossein Mojtahedi - */ - -$PHPMAILER_LANG['authenticate'] = 'خطای SMTP: احراز هویت با شکست مواجه شد.'; -$PHPMAILER_LANG['connect_host'] = 'خطای SMTP: اتصال به سرور SMTP برقرار نشد.'; -$PHPMAILER_LANG['data_not_accepted'] = 'خطای SMTP: داده‌ها نا‌درست هستند.'; -$PHPMAILER_LANG['empty_message'] = 'بخش متن پیام خالی است.'; -$PHPMAILER_LANG['encoding'] = 'کد‌گذاری نا‌شناخته: '; -$PHPMAILER_LANG['execute'] = 'امکان اجرا وجود ندارد: '; -$PHPMAILER_LANG['file_access'] = 'امکان دسترسی به ÙØ§ÛŒÙ„ وجود ندارد: '; -$PHPMAILER_LANG['file_open'] = 'خطای File: امکان بازکردن ÙØ§ÛŒÙ„ وجود ندارد: '; -$PHPMAILER_LANG['from_failed'] = 'آدرس ÙØ±Ø³ØªÙ†Ø¯Ù‡ اشتباه است: '; -$PHPMAILER_LANG['instantiate'] = 'امکان معرÙÛŒ تابع ایمیل وجود ندارد.'; -$PHPMAILER_LANG['invalid_address'] = 'آدرس ایمیل معتبر نیست: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' mailer پشتیبانی نمی‌شود.'; -$PHPMAILER_LANG['provide_address'] = 'باید حداقل یک آدرس گیرنده وارد کنید.'; -$PHPMAILER_LANG['recipients_failed'] = 'خطای SMTP: ارسال به آدرس گیرنده با خطا مواجه شد: '; -$PHPMAILER_LANG['signing'] = 'خطا در امضا: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'خطا در اتصال به SMTP.'; -$PHPMAILER_LANG['smtp_error'] = 'خطا در SMTP Server: '; -$PHPMAILER_LANG['variable_set'] = 'امکان ارسال یا ارسال مجدد متغیر‌ها وجود ندارد: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; diff --git a/core/l/PHPMailer/language/phpmailer.lang-fi.php b/core/l/PHPMailer/language/phpmailer.lang-fi.php deleted file mode 100755 index ec4e752..0000000 --- a/core/l/PHPMailer/language/phpmailer.lang-fi.php +++ /dev/null @@ -1,27 +0,0 @@ - - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP feilur: Kundi ikki góðkenna.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP feilur: Kundi ikki knýta samband við SMTP vert.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP feilur: Data ikki góðkent.'; -//$PHPMAILER_LANG['empty_message'] = 'Message body empty'; -$PHPMAILER_LANG['encoding'] = 'Ókend encoding: '; -$PHPMAILER_LANG['execute'] = 'Kundi ikki útføra: '; -$PHPMAILER_LANG['file_access'] = 'Kundi ikki tilganga fílu: '; -$PHPMAILER_LANG['file_open'] = 'Fílu feilur: Kundi ikki opna fílu: '; -$PHPMAILER_LANG['from_failed'] = 'fylgjandi Frá/From adressa miseydnaðist: '; -$PHPMAILER_LANG['instantiate'] = 'Kuni ikki instantiera mail funktión.'; -//$PHPMAILER_LANG['invalid_address'] = 'Invalid address: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' er ikki supporterað.'; -$PHPMAILER_LANG['provide_address'] = 'Tú skal uppgeva minst móttakara-emailadressu(r).'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP Feilur: Fylgjandi móttakarar miseydnaðust: '; -//$PHPMAILER_LANG['signing'] = 'Signing Error: '; -//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; -//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: '; -//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; diff --git a/core/l/PHPMailer/language/phpmailer.lang-fr.php b/core/l/PHPMailer/language/phpmailer.lang-fr.php deleted file mode 100755 index af68c92..0000000 --- a/core/l/PHPMailer/language/phpmailer.lang-fr.php +++ /dev/null @@ -1,29 +0,0 @@ - - */ - -$PHPMAILER_LANG['authenticate'] = 'Erro SMTP: Non puido ser autentificado.'; -$PHPMAILER_LANG['connect_host'] = 'Erro SMTP: Non puido conectar co servidor SMTP.'; -$PHPMAILER_LANG['data_not_accepted'] = 'Erro SMTP: Datos non aceptados.'; -$PHPMAILER_LANG['empty_message'] = 'Corpo da mensaxe vacía'; -$PHPMAILER_LANG['encoding'] = 'Codificación descoñecida: '; -$PHPMAILER_LANG['execute'] = 'Non puido ser executado: '; -$PHPMAILER_LANG['file_access'] = 'Nob puido acceder ó arquivo: '; -$PHPMAILER_LANG['file_open'] = 'Erro de Arquivo: No puido abrir o arquivo: '; -$PHPMAILER_LANG['from_failed'] = 'A(s) seguinte(s) dirección(s) de remitente(s) deron erro: '; -$PHPMAILER_LANG['instantiate'] = 'Non puido crear unha instancia da función Mail.'; -$PHPMAILER_LANG['invalid_address'] = 'Non puido envia-lo correo: dirección de email inválida: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' mailer non está soportado.'; -$PHPMAILER_LANG['provide_address'] = 'Debe engadir polo menos unha dirección de email coma destino.'; -$PHPMAILER_LANG['recipients_failed'] = 'Erro SMTP: Os seguintes destinos fallaron: '; -$PHPMAILER_LANG['signing'] = 'Erro ó firmar: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() fallou.'; -$PHPMAILER_LANG['smtp_error'] = 'Erro do servidor SMTP: '; -$PHPMAILER_LANG['variable_set'] = 'Non puidemos axustar ou reaxustar a variábel: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; diff --git a/core/l/PHPMailer/language/phpmailer.lang-he.php b/core/l/PHPMailer/language/phpmailer.lang-he.php deleted file mode 100755 index 70eb717..0000000 --- a/core/l/PHPMailer/language/phpmailer.lang-he.php +++ /dev/null @@ -1,26 +0,0 @@ - - */ - -$PHPMAILER_LANG['authenticate'] = 'שגי×ת SMTP: פעולת ×”×ימות נכשלה.'; -$PHPMAILER_LANG['connect_host'] = 'שגי×ת SMTP: ×œ× ×”×¦×œ×—×ª×™ להתחבר לשרת SMTP.'; -$PHPMAILER_LANG['data_not_accepted'] = 'שגי×ת SMTP: מידע ×œ× ×”×ª×§×‘×œ.'; -$PHPMAILER_LANG['empty_message'] = 'גוף ההודעה ריק'; -$PHPMAILER_LANG['invalid_address'] = 'כתובת שגויה: '; -$PHPMAILER_LANG['encoding'] = 'קידוד ×œ× ×ž×•×›×¨: '; -$PHPMAILER_LANG['execute'] = '×œ× ×”×¦×œ×—×ª×™ להפעיל ×ת: '; -$PHPMAILER_LANG['file_access'] = '×œ× × ×™×ª×Ÿ לגשת לקובץ: '; -$PHPMAILER_LANG['file_open'] = 'שגי×ת קובץ: ×œ× × ×™×ª×Ÿ לגשת לקובץ: '; -$PHPMAILER_LANG['from_failed'] = 'כתובות ×”× ×ž×¢× ×™× ×”×‘×ות נכשלו: '; -$PHPMAILER_LANG['instantiate'] = '×œ× ×”×¦×œ×—×ª×™ להפעיל ×ת פונקציית המייל.'; -$PHPMAILER_LANG['mailer_not_supported'] = ' ××™× ×” נתמכת.'; -$PHPMAILER_LANG['provide_address'] = 'חובה לספק לפחות כתובת ×חת של מקבל המייל.'; -$PHPMAILER_LANG['recipients_failed'] = 'שגי×ת SMTP: ×”× ×ž×¢× ×™× ×”×‘××™× × ×›×©×œ×•: '; -$PHPMAILER_LANG['signing'] = 'שגי×ת חתימה: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; -$PHPMAILER_LANG['smtp_error'] = 'שגי×ת שרת SMTP: '; -$PHPMAILER_LANG['variable_set'] = '×œ× × ×™×ª×Ÿ לקבוע ×ו לשנות ×ת המשתנה: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; diff --git a/core/l/PHPMailer/language/phpmailer.lang-hi.php b/core/l/PHPMailer/language/phpmailer.lang-hi.php deleted file mode 100755 index 607a5ee..0000000 --- a/core/l/PHPMailer/language/phpmailer.lang-hi.php +++ /dev/null @@ -1,26 +0,0 @@ - - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP तà¥à¤°à¥à¤Ÿà¤¿: पà¥à¤°à¤¾à¤®à¤¾à¤£à¤¿à¤•ता की जांच नहीं हो सका। '; -$PHPMAILER_LANG['connect_host'] = 'SMTP तà¥à¤°à¥à¤Ÿà¤¿: SMTP सरà¥à¤µà¤° से कनेकà¥à¤Ÿ नहीं हो सका। '; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP तà¥à¤°à¥à¤Ÿà¤¿: डेटा सà¥à¤µà¥€à¤•ार नहीं किया जाता है। '; -$PHPMAILER_LANG['empty_message'] = 'संदेश खाली है। '; -$PHPMAILER_LANG['encoding'] = 'अजà¥à¤žà¤¾à¤¤ à¤à¤¨à¥à¤•ोडिंग पà¥à¤°à¤•ार। '; -$PHPMAILER_LANG['execute'] = 'आदेश को निषà¥à¤ªà¤¾à¤¦à¤¿à¤¤ करने में विफल। '; -$PHPMAILER_LANG['file_access'] = 'फ़ाइल उपलबà¥à¤§ नहीं है। '; -$PHPMAILER_LANG['file_open'] = 'फ़ाइल तà¥à¤°à¥à¤Ÿà¤¿: फाइल को खोला नहीं जा सका। '; -$PHPMAILER_LANG['from_failed'] = 'पà¥à¤°à¥‡à¤·à¤• का पता गलत है। '; -$PHPMAILER_LANG['instantiate'] = 'मेल फ़ंकà¥à¤¶à¤¨ कॉल नहीं कर सकता है।'; -$PHPMAILER_LANG['invalid_address'] = 'पता गलत है। '; -$PHPMAILER_LANG['mailer_not_supported'] = 'मेल सरà¥à¤µà¤° के साथ काम नहीं करता है। '; -$PHPMAILER_LANG['provide_address'] = 'आपको कम से कम à¤à¤• पà¥à¤°à¤¾à¤ªà¥à¤¤à¤•रà¥à¤¤à¤¾ का ई-मेल पता पà¥à¤°à¤¦à¤¾à¤¨ करना होगा।'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP तà¥à¤°à¥à¤Ÿà¤¿: निमà¥à¤¨ पà¥à¤°à¤¾à¤ªà¥à¤¤à¤•रà¥à¤¤à¤¾à¤“ं को पते भेजने में विफल। '; -$PHPMAILER_LANG['signing'] = 'साइनअप तà¥à¤°à¥à¤Ÿà¤¿:। '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP का connect () फ़ंकà¥à¤¶à¤¨ विफल हà¥à¤†à¥¤ '; -$PHPMAILER_LANG['smtp_error'] = 'SMTP सरà¥à¤µà¤° तà¥à¤°à¥à¤Ÿà¤¿à¥¤ '; -$PHPMAILER_LANG['variable_set'] = 'चर को बना या संशोधित नहीं किया जा सकता। '; -$PHPMAILER_LANG['extension_missing'] = 'à¤à¤•à¥à¤¸à¤Ÿà¥‡à¤¨à¥à¤·à¤¨ गायब है: '; diff --git a/core/l/PHPMailer/language/phpmailer.lang-hr.php b/core/l/PHPMailer/language/phpmailer.lang-hr.php deleted file mode 100755 index 3822920..0000000 --- a/core/l/PHPMailer/language/phpmailer.lang-hr.php +++ /dev/null @@ -1,26 +0,0 @@ - - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP GreÅ¡ka: Neuspjela autentikacija.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP GreÅ¡ka: Ne mogu se spojiti na SMTP poslužitelj.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP GreÅ¡ka: Podatci nisu prihvaćeni.'; -$PHPMAILER_LANG['empty_message'] = 'Sadržaj poruke je prazan.'; -$PHPMAILER_LANG['encoding'] = 'Nepoznati encoding: '; -$PHPMAILER_LANG['execute'] = 'Nije moguće izvrÅ¡iti naredbu: '; -$PHPMAILER_LANG['file_access'] = 'Nije moguće pristupiti datoteci: '; -$PHPMAILER_LANG['file_open'] = 'Nije moguće otvoriti datoteku: '; -$PHPMAILER_LANG['from_failed'] = 'SMTP GreÅ¡ka: Slanje s navedenih e-mail adresa nije uspjelo: '; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP GreÅ¡ka: Slanje na navedenih e-mail adresa nije uspjelo: '; -$PHPMAILER_LANG['instantiate'] = 'Ne mogu pokrenuti mail funkcionalnost.'; -$PHPMAILER_LANG['invalid_address'] = 'E-mail nije poslan. Neispravna e-mail adresa: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' mailer nije podržan.'; -$PHPMAILER_LANG['provide_address'] = 'Definirajte barem jednu adresu primatelja.'; -$PHPMAILER_LANG['signing'] = 'GreÅ¡ka prilikom prijave: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'Spajanje na SMTP poslužitelj nije uspjelo.'; -$PHPMAILER_LANG['smtp_error'] = 'GreÅ¡ka SMTP poslužitelja: '; -$PHPMAILER_LANG['variable_set'] = 'Ne mogu postaviti varijablu niti ju vratiti nazad: '; -$PHPMAILER_LANG['extension_missing'] = 'Nedostaje proÅ¡irenje: '; diff --git a/core/l/PHPMailer/language/phpmailer.lang-hu.php b/core/l/PHPMailer/language/phpmailer.lang-hu.php deleted file mode 100755 index d7ca888..0000000 --- a/core/l/PHPMailer/language/phpmailer.lang-hu.php +++ /dev/null @@ -1,26 +0,0 @@ - - * @author @januridp - */ - -$PHPMAILER_LANG['authenticate'] = 'Kesalahan SMTP: Tidak dapat mengotentikasi.'; -$PHPMAILER_LANG['connect_host'] = 'Kesalahan SMTP: Tidak dapat terhubung ke host SMTP.'; -$PHPMAILER_LANG['data_not_accepted'] = 'Kesalahan SMTP: Data tidak diterima peladen.'; -$PHPMAILER_LANG['empty_message'] = 'Isi pesan kosong'; -$PHPMAILER_LANG['encoding'] = 'Pengkodean karakter tidak dikenali: '; -$PHPMAILER_LANG['execute'] = 'Tidak dapat menjalankan proses : '; -$PHPMAILER_LANG['file_access'] = 'Tidak dapat mengakses berkas : '; -$PHPMAILER_LANG['file_open'] = 'Kesalahan File: Berkas tidak bisa dibuka : '; -$PHPMAILER_LANG['from_failed'] = 'Alamat pengirim berikut mengakibatkan kesalahan : '; -$PHPMAILER_LANG['instantiate'] = 'Tidak dapat menginisialisasi fungsi surel'; -$PHPMAILER_LANG['invalid_address'] = 'Gagal terkirim, alamat surel tidak benar : '; -$PHPMAILER_LANG['provide_address'] = 'Harus disediakan minimal satu alamat tujuan'; -$PHPMAILER_LANG['mailer_not_supported'] = 'Pengirim tidak didukung'; -$PHPMAILER_LANG['recipients_failed'] = 'Kesalahan SMTP: Alamat tujuan berikut menghasilkan kesalahan : '; -$PHPMAILER_LANG['signing'] = 'Kesalahan dalam tanda tangan : '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() gagal.'; -$PHPMAILER_LANG['smtp_error'] = 'Kesalahan pada pelayan SMTP : '; -$PHPMAILER_LANG['variable_set'] = 'Tidak berhasil mengatur atau mengatur ulang variable : '; -$PHPMAILER_LANG['extension_missing'] = 'Ekstensi hilang: '; diff --git a/core/l/PHPMailer/language/phpmailer.lang-it.php b/core/l/PHPMailer/language/phpmailer.lang-it.php deleted file mode 100755 index d2f4643..0000000 --- a/core/l/PHPMailer/language/phpmailer.lang-it.php +++ /dev/null @@ -1,27 +0,0 @@ - - * @author Stefano Sabatini - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP Error: Impossibile autenticarsi.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP Error: Impossibile connettersi all\'host SMTP.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Error: Dati non accettati dal server.'; -$PHPMAILER_LANG['empty_message'] = 'Il corpo del messaggio è vuoto'; -$PHPMAILER_LANG['encoding'] = 'Codifica dei caratteri sconosciuta: '; -$PHPMAILER_LANG['execute'] = 'Impossibile eseguire l\'operazione: '; -$PHPMAILER_LANG['file_access'] = 'Impossibile accedere al file: '; -$PHPMAILER_LANG['file_open'] = 'File Error: Impossibile aprire il file: '; -$PHPMAILER_LANG['from_failed'] = 'I seguenti indirizzi mittenti hanno generato errore: '; -$PHPMAILER_LANG['instantiate'] = 'Impossibile istanziare la funzione mail'; -$PHPMAILER_LANG['invalid_address'] = 'Impossibile inviare, l\'indirizzo email non è valido: '; -$PHPMAILER_LANG['provide_address'] = 'Deve essere fornito almeno un indirizzo ricevente'; -$PHPMAILER_LANG['mailer_not_supported'] = 'Mailer non supportato'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP Error: I seguenti indirizzi destinatari hanno generato un errore: '; -$PHPMAILER_LANG['signing'] = 'Errore nella firma: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() fallita.'; -$PHPMAILER_LANG['smtp_error'] = 'Errore del server SMTP: '; -$PHPMAILER_LANG['variable_set'] = 'Impossibile impostare o resettare la variabile: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; diff --git a/core/l/PHPMailer/language/phpmailer.lang-ja.php b/core/l/PHPMailer/language/phpmailer.lang-ja.php deleted file mode 100755 index 2d77872..0000000 --- a/core/l/PHPMailer/language/phpmailer.lang-ja.php +++ /dev/null @@ -1,27 +0,0 @@ - - * @author Yoshi Sakai - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTPエラー: èªè¨¼ã§ãã¾ã›ã‚“ã§ã—ãŸã€‚'; -$PHPMAILER_LANG['connect_host'] = 'SMTPエラー: SMTPãƒ›ã‚¹ãƒˆã«æŽ¥ç¶šã§ãã¾ã›ã‚“ã§ã—ãŸã€‚'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTPエラー: データãŒå—ã‘付ã‘られã¾ã›ã‚“ã§ã—ãŸã€‚'; -//$PHPMAILER_LANG['empty_message'] = 'Message body empty'; -$PHPMAILER_LANG['encoding'] = '䏿˜Žãªã‚¨ãƒ³ã‚³ãƒ¼ãƒ‡ã‚£ãƒ³ã‚°: '; -$PHPMAILER_LANG['execute'] = '実行ã§ãã¾ã›ã‚“ã§ã—ãŸ: '; -$PHPMAILER_LANG['file_access'] = 'ファイルã«ã‚¢ã‚¯ã‚»ã‚¹ã§ãã¾ã›ã‚“: '; -$PHPMAILER_LANG['file_open'] = 'ファイルエラー: ファイルを開ã‘ã¾ã›ã‚“: '; -$PHPMAILER_LANG['from_failed'] = 'Fromアドレスを登録ã™ã‚‹éš›ã«ã‚¨ãƒ©ãƒ¼ãŒç™ºç”Ÿã—ã¾ã—ãŸ: '; -$PHPMAILER_LANG['instantiate'] = 'ãƒ¡ãƒ¼ãƒ«é–¢æ•°ãŒæ­£å¸¸ã«å‹•作ã—ã¾ã›ã‚“ã§ã—ãŸã€‚'; -//$PHPMAILER_LANG['invalid_address'] = 'Invalid address: '; -$PHPMAILER_LANG['provide_address'] = 'å°‘ãªãã¨ã‚‚1ã¤ãƒ¡ãƒ¼ãƒ«ã‚¢ãƒ‰ãƒ¬ã‚¹ã‚’ 指定ã™ã‚‹å¿…è¦ãŒã‚りã¾ã™ã€‚'; -$PHPMAILER_LANG['mailer_not_supported'] = ' メーラーãŒã‚µãƒãƒ¼ãƒˆã•れã¦ã„ã¾ã›ã‚“。'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTPエラー: 次ã®å—信者アドレス㫠間é•ã„ãŒã‚りã¾ã™: '; -//$PHPMAILER_LANG['signing'] = 'Signing Error: '; -//$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() failed.'; -//$PHPMAILER_LANG['smtp_error'] = 'SMTP server error: '; -//$PHPMAILER_LANG['variable_set'] = 'Cannot set or reset variable: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; diff --git a/core/l/PHPMailer/language/phpmailer.lang-ka.php b/core/l/PHPMailer/language/phpmailer.lang-ka.php deleted file mode 100755 index dd1af8a..0000000 --- a/core/l/PHPMailer/language/phpmailer.lang-ka.php +++ /dev/null @@ -1,26 +0,0 @@ - - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP შეცდáƒáƒ›áƒ: áƒáƒ•ტáƒáƒ áƒ˜áƒ–áƒáƒªáƒ˜áƒ შეუძლებელიáƒ.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP შეცდáƒáƒ›áƒ: SMTP სერვერთáƒáƒœ დáƒáƒ™áƒáƒ•შირებრშეუძლებელიáƒ.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP შეცდáƒáƒ›áƒ: მáƒáƒœáƒáƒªáƒ”მები áƒáƒ  იქნრმიღებული.'; -$PHPMAILER_LANG['encoding'] = 'კáƒáƒ“ირების უცნáƒáƒ‘ი ტიპი: '; -$PHPMAILER_LANG['execute'] = 'შეუძლებელირშემდეგი ბრძáƒáƒœáƒ”ბის შესრულებáƒ: '; -$PHPMAILER_LANG['file_access'] = 'შეუძლებელირწვდáƒáƒ›áƒ ფáƒáƒ˜áƒšáƒ—áƒáƒœ: '; -$PHPMAILER_LANG['file_open'] = 'ფáƒáƒ˜áƒšáƒ£áƒ áƒ˜ სისტემის შეცდáƒáƒ›áƒ: áƒáƒ  იხსნებრფáƒáƒ˜áƒšáƒ˜: '; -$PHPMAILER_LANG['from_failed'] = 'გáƒáƒ›áƒ’ზáƒáƒ•ნის áƒáƒ áƒáƒ¡áƒ¬áƒáƒ áƒ˜ მისáƒáƒ›áƒáƒ áƒ—ი: '; -$PHPMAILER_LANG['instantiate'] = 'mail ფუნქციის გáƒáƒ¨áƒ•ებრვერ ხერხდებáƒ.'; -$PHPMAILER_LANG['provide_address'] = 'გთხáƒáƒ•თ მიუთითáƒáƒ— ერთი áƒáƒ“რესáƒáƒ¢áƒ˜áƒ¡ e-mail მისáƒáƒ›áƒáƒ áƒ—ი მáƒáƒ˜áƒœáƒª.'; -$PHPMAILER_LANG['mailer_not_supported'] = ' - სáƒáƒ¤áƒáƒ¡áƒ¢áƒ სერვერის მხáƒáƒ áƒ“áƒáƒ­áƒ”რრáƒáƒ  áƒáƒ áƒ˜áƒ¡.'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP შეცდáƒáƒ›áƒ: შემდეგ მისáƒáƒ›áƒáƒ áƒ—ებზე გáƒáƒ’ზáƒáƒ•ნრვერ მáƒáƒ®áƒ”რხდáƒ: '; -$PHPMAILER_LANG['empty_message'] = 'შეტყáƒáƒ‘ინებრცáƒáƒ áƒ˜áƒ”ლიáƒ'; -$PHPMAILER_LANG['invalid_address'] = 'áƒáƒ  გáƒáƒ˜áƒ’ზáƒáƒ•ნáƒ, e-mail მისáƒáƒ›áƒáƒ áƒ—ის áƒáƒ áƒáƒ¡áƒ¬áƒáƒ áƒ˜ ფáƒáƒ áƒ›áƒáƒ¢áƒ˜: '; -$PHPMAILER_LANG['signing'] = 'ხელმáƒáƒ¬áƒ”რის შეცდáƒáƒ›áƒ: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'შეცდáƒáƒ›áƒ SMTP სერვერთáƒáƒœ დáƒáƒ™áƒáƒ•შირებისáƒáƒ¡'; -$PHPMAILER_LANG['smtp_error'] = 'SMTP სერვერის შეცდáƒáƒ›áƒ: '; -$PHPMAILER_LANG['variable_set'] = 'შეუძლებელირშემდეგი ცვლáƒáƒ“ის შექმნრáƒáƒœ შეცვლáƒ: '; -$PHPMAILER_LANG['extension_missing'] = 'ბიბლიáƒáƒ—ეკრáƒáƒ  áƒáƒ áƒ¡áƒ”ბáƒáƒ‘ს: '; diff --git a/core/l/PHPMailer/language/phpmailer.lang-ko.php b/core/l/PHPMailer/language/phpmailer.lang-ko.php deleted file mode 100755 index 9599fa6..0000000 --- a/core/l/PHPMailer/language/phpmailer.lang-ko.php +++ /dev/null @@ -1,26 +0,0 @@ - - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP 오류: ì¸ì¦í•  수 없습니다.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP 오류: SMTP í˜¸ìŠ¤íŠ¸ì— ì ‘ì†í•  수 없습니다.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP 오류: ë°ì´í„°ê°€ 받아들여지지 않았습니다.'; -$PHPMAILER_LANG['empty_message'] = '메세지 ë‚´ìš©ì´ ì—†ìŠµë‹ˆë‹¤'; -$PHPMAILER_LANG['encoding'] = '알 수 없는 ì¸ì½”딩: '; -$PHPMAILER_LANG['execute'] = '실행 불가: '; -$PHPMAILER_LANG['file_access'] = 'íŒŒì¼ ì ‘ê·¼ 불가: '; -$PHPMAILER_LANG['file_open'] = 'íŒŒì¼ ì˜¤ë¥˜: 파ì¼ì„ ì—´ 수 없습니다: '; -$PHPMAILER_LANG['from_failed'] = 'ë‹¤ìŒ From 주소ì—서 오류가 ë°œìƒí–ˆìŠµë‹ˆë‹¤: '; -$PHPMAILER_LANG['instantiate'] = 'mail 함수를 ì¸ìŠ¤í„´ìŠ¤í™”í•  수 없습니다'; -$PHPMAILER_LANG['invalid_address'] = 'ìž˜ëª»ëœ ì£¼ì†Œ: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' ë©”ì¼ëŸ¬ëŠ” ì§€ì›ë˜ì§€ 않습니다.'; -$PHPMAILER_LANG['provide_address'] = 'ì ì–´ë„ 한 ê°œ ì´ìƒì˜ ìˆ˜ì‹ ìž ë©”ì¼ ì£¼ì†Œë¥¼ 제공해야 합니다.'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP 오류: ë‹¤ìŒ ìˆ˜ì‹ ìžì—서 오류가 ë°œìƒí–ˆìŠµë‹ˆë‹¤: '; -$PHPMAILER_LANG['signing'] = '서명 오류: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP ì—°ê²°ì„ ì‹¤íŒ¨í•˜ì˜€ìŠµë‹ˆë‹¤.'; -$PHPMAILER_LANG['smtp_error'] = 'SMTP 서버 오류: '; -$PHPMAILER_LANG['variable_set'] = '변수 설정 ë° ì´ˆê¸°í™” 불가: '; -$PHPMAILER_LANG['extension_missing'] = 'í™•ìž¥ìž ì—†ìŒ: '; diff --git a/core/l/PHPMailer/language/phpmailer.lang-lt.php b/core/l/PHPMailer/language/phpmailer.lang-lt.php deleted file mode 100755 index 1253a4f..0000000 --- a/core/l/PHPMailer/language/phpmailer.lang-lt.php +++ /dev/null @@ -1,26 +0,0 @@ - - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP klaida: autentifikacija nepavyko.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP klaida: nepavyksta prisijungti prie SMTP stoties.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP klaida: duomenys nepriimti.'; -$PHPMAILER_LANG['empty_message'] = 'LaiÅ¡ko turinys tuÅ¡Äias'; -$PHPMAILER_LANG['encoding'] = 'Neatpažinta koduotÄ—: '; -$PHPMAILER_LANG['execute'] = 'Nepavyko įvykdyti komandos: '; -$PHPMAILER_LANG['file_access'] = 'Byla nepasiekiama: '; -$PHPMAILER_LANG['file_open'] = 'Bylos klaida: Nepavyksta atidaryti: '; -$PHPMAILER_LANG['from_failed'] = 'Neteisingas siuntÄ—jo adresas: '; -$PHPMAILER_LANG['instantiate'] = 'Nepavyko paleisti mail funkcijos.'; -$PHPMAILER_LANG['invalid_address'] = 'Neteisingas adresas: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' paÅ¡to stotis nepalaikoma.'; -$PHPMAILER_LANG['provide_address'] = 'Nurodykite bent vienÄ… gavÄ—jo adresÄ….'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP klaida: nepavyko iÅ¡siųsti Å¡iems gavÄ—jams: '; -$PHPMAILER_LANG['signing'] = 'Prisijungimo klaida: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP susijungimo klaida'; -$PHPMAILER_LANG['smtp_error'] = 'SMTP stoties klaida: '; -$PHPMAILER_LANG['variable_set'] = 'Nepavyko priskirti reikÅ¡mÄ—s kintamajam: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; diff --git a/core/l/PHPMailer/language/phpmailer.lang-lv.php b/core/l/PHPMailer/language/phpmailer.lang-lv.php deleted file mode 100755 index 39bf9a1..0000000 --- a/core/l/PHPMailer/language/phpmailer.lang-lv.php +++ /dev/null @@ -1,26 +0,0 @@ - - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP kļūda: AutorizÄcija neizdevÄs.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP Kļūda: Nevar izveidot savienojumu ar SMTP serveri.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Kļūda: Nepieņem informÄciju.'; -$PHPMAILER_LANG['empty_message'] = 'Ziņojuma teksts ir tukÅ¡s'; -$PHPMAILER_LANG['encoding'] = 'NeatpazÄ«ts kodÄ“jums: '; -$PHPMAILER_LANG['execute'] = 'NeizdevÄs izpildÄ«t komandu: '; -$PHPMAILER_LANG['file_access'] = 'Fails nav pieejams: '; -$PHPMAILER_LANG['file_open'] = 'Faila kļūda: Nevar atvÄ“rt failu: '; -$PHPMAILER_LANG['from_failed'] = 'Nepareiza sÅ«tÄ«tÄja adrese: '; -$PHPMAILER_LANG['instantiate'] = 'Nevar palaist sÅ«tīšanas funkciju.'; -$PHPMAILER_LANG['invalid_address'] = 'Nepareiza adrese: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' sÅ«tÄ«tÄjs netiek atbalstÄ«ts.'; -$PHPMAILER_LANG['provide_address'] = 'LÅ«dzu, norÄdiet vismaz vienu adresÄtu.'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP kļūda: neizdevÄs nosÅ«tÄ«t Å¡Ädiem saņēmÄ“jiem: '; -$PHPMAILER_LANG['signing'] = 'AutorizÄcijas kļūda: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP savienojuma kļūda'; -$PHPMAILER_LANG['smtp_error'] = 'SMTP servera kļūda: '; -$PHPMAILER_LANG['variable_set'] = 'Nevar piešķirt mainÄ«gÄ vÄ“rtÄ«bu: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; diff --git a/core/l/PHPMailer/language/phpmailer.lang-ms.php b/core/l/PHPMailer/language/phpmailer.lang-ms.php deleted file mode 100755 index 4e2c340..0000000 --- a/core/l/PHPMailer/language/phpmailer.lang-ms.php +++ /dev/null @@ -1,26 +0,0 @@ - - */ - -$PHPMAILER_LANG['authenticate'] = 'Ralat SMTP: Tidak dapat pengesahan.'; -$PHPMAILER_LANG['connect_host'] = 'Ralat SMTP: Tidak dapat menghubungi hos pelayan SMTP.'; -$PHPMAILER_LANG['data_not_accepted'] = 'Ralat SMTP: Data tidak diterima oleh pelayan.'; -$PHPMAILER_LANG['empty_message'] = 'Tiada isi untuk mesej'; -$PHPMAILER_LANG['encoding'] = 'Pengekodan tidak diketahui: '; -$PHPMAILER_LANG['execute'] = 'Tidak dapat melaksanakan: '; -$PHPMAILER_LANG['file_access'] = 'Tidak dapat mengakses fail: '; -$PHPMAILER_LANG['file_open'] = 'Ralat Fail: Tidak dapat membuka fail: '; -$PHPMAILER_LANG['from_failed'] = 'Berikut merupakan ralat dari alamat e-mel: '; -$PHPMAILER_LANG['instantiate'] = 'Tidak dapat memberi contoh fungsi e-mel.'; -$PHPMAILER_LANG['invalid_address'] = 'Alamat emel tidak sah: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' jenis penghantar emel tidak disokong.'; -$PHPMAILER_LANG['provide_address'] = 'Anda perlu menyediakan sekurang-kurangnya satu alamat e-mel penerima.'; -$PHPMAILER_LANG['recipients_failed'] = 'Ralat SMTP: Penerima e-mel berikut telah gagal: '; -$PHPMAILER_LANG['signing'] = 'Ralat pada tanda tangan: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() telah gagal.'; -$PHPMAILER_LANG['smtp_error'] = 'Ralat pada pelayan SMTP: '; -$PHPMAILER_LANG['variable_set'] = 'Tidak boleh menetapkan atau menetapkan semula pembolehubah: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; diff --git a/core/l/PHPMailer/language/phpmailer.lang-nb.php b/core/l/PHPMailer/language/phpmailer.lang-nb.php deleted file mode 100755 index 4461054..0000000 --- a/core/l/PHPMailer/language/phpmailer.lang-nb.php +++ /dev/null @@ -1,25 +0,0 @@ - - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP-fout: authenticatie mislukt.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP-fout: kon niet verbinden met SMTP-host.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP-fout: data niet geaccepteerd.'; -$PHPMAILER_LANG['empty_message'] = 'Berichttekst is leeg'; -$PHPMAILER_LANG['encoding'] = 'Onbekende codering: '; -$PHPMAILER_LANG['execute'] = 'Kon niet uitvoeren: '; -$PHPMAILER_LANG['file_access'] = 'Kreeg geen toegang tot bestand: '; -$PHPMAILER_LANG['file_open'] = 'Bestandsfout: kon bestand niet openen: '; -$PHPMAILER_LANG['from_failed'] = 'Het volgende afzendersadres is mislukt: '; -$PHPMAILER_LANG['instantiate'] = 'Kon mailfunctie niet initialiseren.'; -$PHPMAILER_LANG['invalid_address'] = 'Ongeldig adres: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' mailer wordt niet ondersteund.'; -$PHPMAILER_LANG['provide_address'] = 'Er moet minstens één ontvanger worden opgegeven.'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP-fout: de volgende ontvangers zijn mislukt: '; -$PHPMAILER_LANG['signing'] = 'Signeerfout: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Verbinding mislukt.'; -$PHPMAILER_LANG['smtp_error'] = 'SMTP-serverfout: '; -$PHPMAILER_LANG['variable_set'] = 'Kan de volgende variabele niet instellen of resetten: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; diff --git a/core/l/PHPMailer/language/phpmailer.lang-pl.php b/core/l/PHPMailer/language/phpmailer.lang-pl.php deleted file mode 100755 index 3da0dee..0000000 --- a/core/l/PHPMailer/language/phpmailer.lang-pl.php +++ /dev/null @@ -1,26 +0,0 @@ - - */ - -$PHPMAILER_LANG['authenticate'] = 'Erro do SMTP: Não foi possível realizar a autenticação.'; -$PHPMAILER_LANG['connect_host'] = 'Erro do SMTP: Não foi possível realizar ligação com o servidor SMTP.'; -$PHPMAILER_LANG['data_not_accepted'] = 'Erro do SMTP: Os dados foram rejeitados.'; -$PHPMAILER_LANG['empty_message'] = 'A mensagem no e-mail está vazia.'; -$PHPMAILER_LANG['encoding'] = 'Codificação desconhecida: '; -$PHPMAILER_LANG['execute'] = 'Não foi possível executar: '; -$PHPMAILER_LANG['file_access'] = 'Não foi possível aceder o ficheiro: '; -$PHPMAILER_LANG['file_open'] = 'Abertura do ficheiro: Não foi possível abrir o ficheiro: '; -$PHPMAILER_LANG['from_failed'] = 'Ocorreram falhas nos endereços dos seguintes remententes: '; -$PHPMAILER_LANG['instantiate'] = 'Não foi possível iniciar uma instância da função mail.'; -$PHPMAILER_LANG['invalid_address'] = 'Não foi enviado nenhum e-mail para o endereço de e-mail inválido: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' mailer não é suportado.'; -$PHPMAILER_LANG['provide_address'] = 'Tem de fornecer pelo menos um endereço como destinatário do e-mail.'; -$PHPMAILER_LANG['recipients_failed'] = 'Erro do SMTP: O endereço do seguinte destinatário falhou: '; -$PHPMAILER_LANG['signing'] = 'Erro ao assinar: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() falhou.'; -$PHPMAILER_LANG['smtp_error'] = 'Erro de servidor SMTP: '; -$PHPMAILER_LANG['variable_set'] = 'Não foi possível definir ou redefinir a variável: '; -$PHPMAILER_LANG['extension_missing'] = 'Extensão em falta: '; diff --git a/core/l/PHPMailer/language/phpmailer.lang-pt_br.php b/core/l/PHPMailer/language/phpmailer.lang-pt_br.php deleted file mode 100755 index 4ec10f7..0000000 --- a/core/l/PHPMailer/language/phpmailer.lang-pt_br.php +++ /dev/null @@ -1,29 +0,0 @@ - - * @author Lucas Guimarães - * @author Phelipe Alves - * @author Fabio Beneditto - */ - -$PHPMAILER_LANG['authenticate'] = 'Erro de SMTP: Não foi possível autenticar.'; -$PHPMAILER_LANG['connect_host'] = 'Erro de SMTP: Não foi possível conectar ao servidor SMTP.'; -$PHPMAILER_LANG['data_not_accepted'] = 'Erro de SMTP: Dados rejeitados.'; -$PHPMAILER_LANG['empty_message'] = 'Mensagem vazia'; -$PHPMAILER_LANG['encoding'] = 'Codificação desconhecida: '; -$PHPMAILER_LANG['execute'] = 'Não foi possível executar: '; -$PHPMAILER_LANG['file_access'] = 'Não foi possível acessar o arquivo: '; -$PHPMAILER_LANG['file_open'] = 'Erro de Arquivo: Não foi possível abrir o arquivo: '; -$PHPMAILER_LANG['from_failed'] = 'Os seguintes remetentes falharam: '; -$PHPMAILER_LANG['instantiate'] = 'Não foi possível instanciar a função mail.'; -$PHPMAILER_LANG['invalid_address'] = 'Endereço de e-mail inválido: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' mailer não é suportado.'; -$PHPMAILER_LANG['provide_address'] = 'Você deve informar pelo menos um destinatário.'; -$PHPMAILER_LANG['recipients_failed'] = 'Erro de SMTP: Os seguintes destinatários falharam: '; -$PHPMAILER_LANG['signing'] = 'Erro de Assinatura: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() falhou.'; -$PHPMAILER_LANG['smtp_error'] = 'Erro de servidor SMTP: '; -$PHPMAILER_LANG['variable_set'] = 'Não foi possível definir ou redefinir a variável: '; -$PHPMAILER_LANG['extension_missing'] = 'Extensão ausente: '; diff --git a/core/l/PHPMailer/language/phpmailer.lang-ro.php b/core/l/PHPMailer/language/phpmailer.lang-ro.php deleted file mode 100755 index fa100ea..0000000 --- a/core/l/PHPMailer/language/phpmailer.lang-ro.php +++ /dev/null @@ -1,26 +0,0 @@ - - */ - -$PHPMAILER_LANG['authenticate'] = 'Eroare SMTP: Autentificarea a eÈ™uat.'; -$PHPMAILER_LANG['connect_host'] = 'Eroare SMTP: Conectarea la serverul SMTP a eÈ™uat.'; -$PHPMAILER_LANG['data_not_accepted'] = 'Eroare SMTP: Datele nu au fost acceptate.'; -$PHPMAILER_LANG['empty_message'] = 'Mesajul este gol.'; -$PHPMAILER_LANG['encoding'] = 'Encodare necunoscută: '; -$PHPMAILER_LANG['execute'] = 'Nu se poate executa următoarea comandă: '; -$PHPMAILER_LANG['file_access'] = 'Nu se poate accesa următorul fiÈ™ier: '; -$PHPMAILER_LANG['file_open'] = 'Eroare fiÈ™ier: Nu se poate deschide următorul fiÈ™ier: '; -$PHPMAILER_LANG['from_failed'] = 'Următoarele adrese From au dat eroare: '; -$PHPMAILER_LANG['instantiate'] = 'FuncÈ›ia mail nu a putut fi iniÈ›ializată.'; -$PHPMAILER_LANG['invalid_address'] = 'Adresa de email nu este validă: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' mailer nu este suportat.'; -$PHPMAILER_LANG['provide_address'] = 'Trebuie să adăugaÈ›i cel puÈ›in o adresă de email.'; -$PHPMAILER_LANG['recipients_failed'] = 'Eroare SMTP: Următoarele adrese de email au eÈ™uat: '; -$PHPMAILER_LANG['signing'] = 'A aparut o problemă la semnarea emailului. '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'Conectarea la serverul SMTP a eÈ™uat.'; -$PHPMAILER_LANG['smtp_error'] = 'Eroare server SMTP: '; -$PHPMAILER_LANG['variable_set'] = 'Nu se poate seta/reseta variabila. '; -$PHPMAILER_LANG['extension_missing'] = 'LipseÈ™te extensia: '; diff --git a/core/l/PHPMailer/language/phpmailer.lang-rs.php b/core/l/PHPMailer/language/phpmailer.lang-rs.php deleted file mode 100755 index 0502f02..0000000 --- a/core/l/PHPMailer/language/phpmailer.lang-rs.php +++ /dev/null @@ -1,26 +0,0 @@ - - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP грешка: аутентификација није уÑпела.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP грешка: није могуће повезивање Ñа SMTP Ñервером.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP грешка: подаци ниÑу прихваћени.'; -$PHPMAILER_LANG['empty_message'] = 'Садржај поруке је празан.'; -$PHPMAILER_LANG['encoding'] = 'Ðепознато кодовање: '; -$PHPMAILER_LANG['execute'] = 'Ðије могуће извршити наредбу: '; -$PHPMAILER_LANG['file_access'] = 'Ðије могуће приÑтупити датотеци: '; -$PHPMAILER_LANG['file_open'] = 'Ðије могуће отворити датотеку: '; -$PHPMAILER_LANG['from_failed'] = 'SMTP грешка: Ñлање Ñа Ñледећих адреÑа није уÑпело: '; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP грешка: Ñлање на Ñледеће адреÑе није уÑпело: '; -$PHPMAILER_LANG['instantiate'] = 'Ðије могуће покренути mail функцију.'; -$PHPMAILER_LANG['invalid_address'] = 'Порука није поÑлата због неиÑправне адреÑе: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' мејлер није подржан.'; -$PHPMAILER_LANG['provide_address'] = 'Потребно је задати најмање једну адреÑу.'; -$PHPMAILER_LANG['signing'] = 'Грешка приликом пријављивања: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'Повезивање Ñа SMTP Ñервером није уÑпело.'; -$PHPMAILER_LANG['smtp_error'] = 'Грешка SMTP Ñервера: '; -$PHPMAILER_LANG['variable_set'] = 'Ðије могуће задати променљиву, нити је вратити уназад: '; -$PHPMAILER_LANG['extension_missing'] = 'ÐедоÑтаје проширење: '; diff --git a/core/l/PHPMailer/language/phpmailer.lang-ru.php b/core/l/PHPMailer/language/phpmailer.lang-ru.php deleted file mode 100755 index 4066f6b..0000000 --- a/core/l/PHPMailer/language/phpmailer.lang-ru.php +++ /dev/null @@ -1,27 +0,0 @@ - - * @author Foster Snowhill - */ - -$PHPMAILER_LANG['authenticate'] = 'Ошибка SMTP: ошибка авторизации.'; -$PHPMAILER_LANG['connect_host'] = 'Ошибка SMTP: не удаетÑÑ Ð¿Ð¾Ð´ÐºÐ»ÑŽÑ‡Ð¸Ñ‚ÑŒÑÑ Ðº Ñерверу SMTP.'; -$PHPMAILER_LANG['data_not_accepted'] = 'Ошибка SMTP: данные не принÑты.'; -$PHPMAILER_LANG['encoding'] = 'ÐеизвеÑтный вид кодировки: '; -$PHPMAILER_LANG['execute'] = 'Ðевозможно выполнить команду: '; -$PHPMAILER_LANG['file_access'] = 'Ðет доÑтупа к файлу: '; -$PHPMAILER_LANG['file_open'] = 'Ð¤Ð°Ð¹Ð»Ð¾Ð²Ð°Ñ Ð¾ÑˆÐ¸Ð±ÐºÐ°: не удаетÑÑ Ð¾Ñ‚ÐºÑ€Ñ‹Ñ‚ÑŒ файл: '; -$PHPMAILER_LANG['from_failed'] = 'Ðеверный Ð°Ð´Ñ€ÐµÑ Ð¾Ñ‚Ð¿Ñ€Ð°Ð²Ð¸Ñ‚ÐµÐ»Ñ: '; -$PHPMAILER_LANG['instantiate'] = 'Ðевозможно запуÑтить функцию mail.'; -$PHPMAILER_LANG['provide_address'] = 'ПожалуйÑта, введите Ñ…Ð¾Ñ‚Ñ Ð±Ñ‹ один Ð°Ð´Ñ€ÐµÑ e-mail получателÑ.'; -$PHPMAILER_LANG['mailer_not_supported'] = ' — почтовый Ñервер не поддерживаетÑÑ.'; -$PHPMAILER_LANG['recipients_failed'] = 'Ошибка SMTP: отправка по Ñледующим адреÑам получателей не удалаÑÑŒ: '; -$PHPMAILER_LANG['empty_message'] = 'ПуÑтое Ñообщение'; -$PHPMAILER_LANG['invalid_address'] = 'Ðе отоÑлано, неправильный формат email адреÑа: '; -$PHPMAILER_LANG['signing'] = 'Ошибка подпиÑи: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'Ошибка ÑÐ¾ÐµÐ´Ð¸Ð½ÐµÐ½Ð¸Ñ Ñ SMTP-Ñервером'; -$PHPMAILER_LANG['smtp_error'] = 'Ошибка SMTP-Ñервера: '; -$PHPMAILER_LANG['variable_set'] = 'Ðевозможно уÑтановить или переуÑтановить переменную: '; -$PHPMAILER_LANG['extension_missing'] = 'РаÑширение отÑутÑтвует: '; diff --git a/core/l/PHPMailer/language/phpmailer.lang-sk.php b/core/l/PHPMailer/language/phpmailer.lang-sk.php deleted file mode 100755 index a38f4e5..0000000 --- a/core/l/PHPMailer/language/phpmailer.lang-sk.php +++ /dev/null @@ -1,26 +0,0 @@ - - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP Error: Chyba autentifikácie.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP Error: Nebolo možné nadviazaÅ¥ spojenie so SMTP serverom.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP Error: Dáta neboli prijaté'; -$PHPMAILER_LANG['empty_message'] = 'Prázdne telo správy.'; -$PHPMAILER_LANG['encoding'] = 'Neznáme kódovanie: '; -$PHPMAILER_LANG['execute'] = 'Nedá sa vykonaÅ¥: '; -$PHPMAILER_LANG['file_access'] = 'Súbor nebol nájdený: '; -$PHPMAILER_LANG['file_open'] = 'File Error: Súbor sa otvoriÅ¥ pre Äítanie: '; -$PHPMAILER_LANG['from_failed'] = 'Následujúca adresa From je nesprávna: '; -$PHPMAILER_LANG['instantiate'] = 'Nedá sa vytvoriÅ¥ inÅ¡tancia emailovej funkcie.'; -$PHPMAILER_LANG['invalid_address'] = 'Neodoslané, emailová adresa je nesprávna: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' emailový klient nieje podporovaný.'; -$PHPMAILER_LANG['provide_address'] = 'Musíte zadaÅ¥ aspoň jednu emailovú adresu príjemcu.'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP Error: Adresy príjemcov niesu správne '; -$PHPMAILER_LANG['signing'] = 'Chyba prihlasovania: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() zlyhalo.'; -$PHPMAILER_LANG['smtp_error'] = 'SMTP chyba serveru: '; -$PHPMAILER_LANG['variable_set'] = 'Nemožno nastaviÅ¥ alebo resetovaÅ¥ premennú: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; diff --git a/core/l/PHPMailer/language/phpmailer.lang-sl.php b/core/l/PHPMailer/language/phpmailer.lang-sl.php deleted file mode 100755 index 54c9572..0000000 --- a/core/l/PHPMailer/language/phpmailer.lang-sl.php +++ /dev/null @@ -1,26 +0,0 @@ - - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP napaka: Avtentikacija ni uspela.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP napaka: Ne morem vzpostaviti povezave s SMTP gostiteljem.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP napaka: Strežnik zavraÄa podatke.'; -$PHPMAILER_LANG['empty_message'] = 'E-poÅ¡tno sporoÄilo nima vsebine.'; -$PHPMAILER_LANG['encoding'] = 'Nepoznan tip kodiranja: '; -$PHPMAILER_LANG['execute'] = 'Operacija ni uspela: '; -$PHPMAILER_LANG['file_access'] = 'Nimam dostopa do datoteke: '; -$PHPMAILER_LANG['file_open'] = 'Ne morem odpreti datoteke: '; -$PHPMAILER_LANG['from_failed'] = 'Neveljaven e-naslov poÅ¡iljatelja: '; -$PHPMAILER_LANG['instantiate'] = 'Ne morem inicializirati mail funkcije.'; -$PHPMAILER_LANG['invalid_address'] = 'E-poÅ¡tno sporoÄilo ni bilo poslano. E-naslov je neveljaven: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' mailer ni podprt.'; -$PHPMAILER_LANG['provide_address'] = 'Prosim vnesite vsaj enega naslovnika.'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP napaka: SledeÄi naslovniki so neveljavni: '; -$PHPMAILER_LANG['signing'] = 'Napaka pri podpisovanju: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'Ne morem vzpostaviti povezave s SMTP strežnikom.'; -$PHPMAILER_LANG['smtp_error'] = 'Napaka SMTP strežnika: '; -$PHPMAILER_LANG['variable_set'] = 'Ne morem nastaviti oz. ponastaviti spremenljivke: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; diff --git a/core/l/PHPMailer/language/phpmailer.lang-sv.php b/core/l/PHPMailer/language/phpmailer.lang-sv.php deleted file mode 100755 index 4408e63..0000000 --- a/core/l/PHPMailer/language/phpmailer.lang-sv.php +++ /dev/null @@ -1,26 +0,0 @@ - - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP fel: Kunde inte autentisera.'; -$PHPMAILER_LANG['connect_host'] = 'SMTP fel: Kunde inte ansluta till SMTP-server.'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP fel: Data accepterades inte.'; -//$PHPMAILER_LANG['empty_message'] = 'Message body empty'; -$PHPMAILER_LANG['encoding'] = 'Okänt encode-format: '; -$PHPMAILER_LANG['execute'] = 'Kunde inte köra: '; -$PHPMAILER_LANG['file_access'] = 'Ingen Ã¥tkomst till fil: '; -$PHPMAILER_LANG['file_open'] = 'Fil fel: Kunde inte öppna fil: '; -$PHPMAILER_LANG['from_failed'] = 'Följande avsändaradress är felaktig: '; -$PHPMAILER_LANG['instantiate'] = 'Kunde inte initiera e-postfunktion.'; -$PHPMAILER_LANG['invalid_address'] = 'Felaktig adress: '; -$PHPMAILER_LANG['provide_address'] = 'Du mÃ¥ste ange minst en mottagares e-postadress.'; -$PHPMAILER_LANG['mailer_not_supported'] = ' mailer stöds inte.'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP fel: Följande mottagare är felaktig: '; -$PHPMAILER_LANG['signing'] = 'Signerings fel: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP Connect() misslyckades.'; -$PHPMAILER_LANG['smtp_error'] = 'SMTP server fel: '; -$PHPMAILER_LANG['variable_set'] = 'Kunde inte definiera eller Ã¥terställa variabel: '; -$PHPMAILER_LANG['extension_missing'] = 'Tillägg ej tillgängligt: '; diff --git a/core/l/PHPMailer/language/phpmailer.lang-tr.php b/core/l/PHPMailer/language/phpmailer.lang-tr.php deleted file mode 100755 index cfe8eaa..0000000 --- a/core/l/PHPMailer/language/phpmailer.lang-tr.php +++ /dev/null @@ -1,30 +0,0 @@ - - * @fixed by Boris Yurchenko - */ - -$PHPMAILER_LANG['authenticate'] = 'Помилка SMTP: помилка авторизації.'; -$PHPMAILER_LANG['connect_host'] = 'Помилка SMTP: не вдаєтьÑÑ Ð¿Ñ–Ð´\'єднатиÑÑ Ð´Ð¾ Ñерверу SMTP.'; -$PHPMAILER_LANG['data_not_accepted'] = 'Помилка SMTP: дані не прийнÑті.'; -$PHPMAILER_LANG['encoding'] = 'Ðевідомий тип кодуваннÑ: '; -$PHPMAILER_LANG['execute'] = 'Ðеможливо виконати команду: '; -$PHPMAILER_LANG['file_access'] = 'Ðемає доÑтупу до файлу: '; -$PHPMAILER_LANG['file_open'] = 'Помилка файлової ÑиÑтеми: не вдаєтьÑÑ Ð²Ñ–Ð´ÐºÑ€Ð¸Ñ‚Ð¸ файл: '; -$PHPMAILER_LANG['from_failed'] = 'Ðевірна адреÑа відправника: '; -$PHPMAILER_LANG['instantiate'] = 'Ðеможливо запуÑтити функцію mail.'; -$PHPMAILER_LANG['provide_address'] = 'Будь-лаÑка, введіть хоча б одну адреÑу e-mail отримувача.'; -$PHPMAILER_LANG['mailer_not_supported'] = ' - поштовий Ñервер не підтримуєтьÑÑ.'; -$PHPMAILER_LANG['recipients_failed'] = 'Помилка SMTP: Ð²Ñ–Ð´Ð¿Ñ€Ð°Ð²Ð»ÐµÐ½Ð½Ñ Ð½Ð°Ñтупним отримувачам не вдалоÑÑ: '; -$PHPMAILER_LANG['empty_message'] = 'ПуÑте тіло повідомленнÑ'; -$PHPMAILER_LANG['invalid_address'] = 'Ðе відправлено, невірний формат адреÑи e-mail: '; -$PHPMAILER_LANG['signing'] = 'Помилка підпиÑу: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'Помилка з\'Ñ”Ð´Ð½Ð°Ð½Ð½Ñ Ñ–Ð· SMTP-Ñервером'; -$PHPMAILER_LANG['smtp_error'] = 'Помилка SMTP-Ñервера: '; -$PHPMAILER_LANG['variable_set'] = 'Ðеможливо вÑтановити або перевÑтановити змінну: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; diff --git a/core/l/PHPMailer/language/phpmailer.lang-vi.php b/core/l/PHPMailer/language/phpmailer.lang-vi.php deleted file mode 100755 index c60dade..0000000 --- a/core/l/PHPMailer/language/phpmailer.lang-vi.php +++ /dev/null @@ -1,26 +0,0 @@ - - */ - -$PHPMAILER_LANG['authenticate'] = 'Lá»—i SMTP: Không thể xác thá»±c.'; -$PHPMAILER_LANG['connect_host'] = 'Lá»—i SMTP: Không thể kết nối máy chá»§ SMTP.'; -$PHPMAILER_LANG['data_not_accepted'] = 'Lá»—i SMTP: Dữ liệu không được chấp nhận.'; -$PHPMAILER_LANG['empty_message'] = 'Không có ná»™i dung'; -$PHPMAILER_LANG['encoding'] = 'Mã hóa không xác định: '; -$PHPMAILER_LANG['execute'] = 'Không thá»±c hiện được: '; -$PHPMAILER_LANG['file_access'] = 'Không thể truy cập tệp tin '; -$PHPMAILER_LANG['file_open'] = 'Lá»—i Tập tin: Không thể mở tệp tin: '; -$PHPMAILER_LANG['from_failed'] = 'Lá»—i địa chỉ gá»­i Ä‘i: '; -$PHPMAILER_LANG['instantiate'] = 'Không dùng được các hàm gá»­i thư.'; -$PHPMAILER_LANG['invalid_address'] = 'Äại chỉ emai không đúng: '; -$PHPMAILER_LANG['mailer_not_supported'] = ' trình gá»­i thư không được há»— trợ.'; -$PHPMAILER_LANG['provide_address'] = 'Bạn phải cung cấp ít nhất má»™t địa chỉ ngưá»i nhận.'; -$PHPMAILER_LANG['recipients_failed'] = 'Lá»—i SMTP: lá»—i địa chỉ ngưá»i nhận: '; -$PHPMAILER_LANG['signing'] = 'Lá»—i đăng nhập: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'Lá»—i kết nối vá»›i SMTP'; -$PHPMAILER_LANG['smtp_error'] = 'Lá»—i máy chá»§ smtp '; -$PHPMAILER_LANG['variable_set'] = 'Không thể thiết lập hoặc thiết lập lại biến: '; -//$PHPMAILER_LANG['extension_missing'] = 'Extension missing: '; diff --git a/core/l/PHPMailer/language/phpmailer.lang-zh.php b/core/l/PHPMailer/language/phpmailer.lang-zh.php deleted file mode 100755 index 3e9e358..0000000 --- a/core/l/PHPMailer/language/phpmailer.lang-zh.php +++ /dev/null @@ -1,28 +0,0 @@ - - * @author Peter Dave Hello <@PeterDaveHello/> - * @author Jason Chiang - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP 錯誤:登入失敗。'; -$PHPMAILER_LANG['connect_host'] = 'SMTP 錯誤:無法連線到 SMTP 主機。'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP 錯誤:無法接å—的資料。'; -$PHPMAILER_LANG['empty_message'] = '郵件內容為空'; -$PHPMAILER_LANG['encoding'] = '未知編碼: '; -$PHPMAILER_LANG['execute'] = '無法執行:'; -$PHPMAILER_LANG['file_access'] = 'ç„¡æ³•å­˜å–æª”案:'; -$PHPMAILER_LANG['file_open'] = '檔案錯誤:無法開啟檔案:'; -$PHPMAILER_LANG['from_failed'] = '發é€åœ°å€éŒ¯èª¤ï¼š'; -$PHPMAILER_LANG['instantiate'] = '未知函數呼å«ã€‚'; -$PHPMAILER_LANG['invalid_address'] = '因為電å­éƒµä»¶åœ°å€ç„¡æ•ˆï¼Œç„¡æ³•傳é€: '; -$PHPMAILER_LANG['mailer_not_supported'] = '䏿”¯æ´çš„發信客戶端。'; -$PHPMAILER_LANG['provide_address'] = 'å¿…é ˆæä¾›è‡³å°‘一個收件人地å€ã€‚'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP 錯誤:以下收件人地å€éŒ¯èª¤ï¼š'; -$PHPMAILER_LANG['signing'] = 'é›»å­ç°½ç« éŒ¯èª¤: '; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTP 連線失敗'; -$PHPMAILER_LANG['smtp_error'] = 'SMTP 伺æœå™¨éŒ¯èª¤: '; -$PHPMAILER_LANG['variable_set'] = '無法設定或é‡è¨­è®Šæ•¸: '; -$PHPMAILER_LANG['extension_missing'] = 'éºå¤±æ¨¡çµ„ Extension: '; diff --git a/core/l/PHPMailer/language/phpmailer.lang-zh_cn.php b/core/l/PHPMailer/language/phpmailer.lang-zh_cn.php deleted file mode 100755 index 3753780..0000000 --- a/core/l/PHPMailer/language/phpmailer.lang-zh_cn.php +++ /dev/null @@ -1,28 +0,0 @@ - - * @author young - * @author Teddysun - */ - -$PHPMAILER_LANG['authenticate'] = 'SMTP 错误:登录失败。'; -$PHPMAILER_LANG['connect_host'] = 'SMTP 错误:无法连接到 SMTP 主机。'; -$PHPMAILER_LANG['data_not_accepted'] = 'SMTP 错误:数æ®ä¸è¢«æŽ¥å—。'; -$PHPMAILER_LANG['empty_message'] = '邮件正文为空。'; -$PHPMAILER_LANG['encoding'] = '未知编ç ï¼š'; -$PHPMAILER_LANG['execute'] = '无法执行:'; -$PHPMAILER_LANG['file_access'] = '无法访问文件:'; -$PHPMAILER_LANG['file_open'] = '文件错误:无法打开文件:'; -$PHPMAILER_LANG['from_failed'] = 'å‘é€åœ°å€é”™è¯¯ï¼š'; -$PHPMAILER_LANG['instantiate'] = '未知函数调用。'; -$PHPMAILER_LANG['invalid_address'] = 'å‘é€å¤±è´¥ï¼Œç”µå­é‚®ç®±åœ°å€æ˜¯æ— æ•ˆçš„:'; -$PHPMAILER_LANG['mailer_not_supported'] = 'å‘信客户端ä¸è¢«æ”¯æŒã€‚'; -$PHPMAILER_LANG['provide_address'] = 'å¿…é¡»æä¾›è‡³å°‘一个收件人地å€ã€‚'; -$PHPMAILER_LANG['recipients_failed'] = 'SMTP 错误:收件人地å€é”™è¯¯ï¼š'; -$PHPMAILER_LANG['signing'] = '登录失败:'; -$PHPMAILER_LANG['smtp_connect_failed'] = 'SMTPæœåŠ¡å™¨è¿žæŽ¥å¤±è´¥ã€‚'; -$PHPMAILER_LANG['smtp_error'] = 'SMTPæœåŠ¡å™¨å‡ºé”™ï¼š'; -$PHPMAILER_LANG['variable_set'] = '无法设置或é‡ç½®å˜é‡ï¼š'; -$PHPMAILER_LANG['extension_missing'] = 'ä¸¢å¤±æ¨¡å— Extension:'; diff --git a/core/l/PHPMailer/phpdoc.dist.xml b/core/l/PHPMailer/phpdoc.dist.xml deleted file mode 100755 index a9d582a..0000000 --- a/core/l/PHPMailer/phpdoc.dist.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - PHPMailer - - docs - utf8 - - TODO - - - - docs - - -