From 8263dbae7f84356c6709be1d522038468a97a6cb Mon Sep 17 00:00:00 2001 From: DariusIII Date: Mon, 8 Feb 2016 12:39:29 +0100 Subject: [PATCH] Add custom plugins directory, update BasePage to handle it --- www/pages/BasePage.php | 4 + www/plugins/block.php.php | 25 +++ www/plugins/function.getcatval.php | 35 ++++ .../function.html_options_multiple.php | 174 ++++++++++++++++++ www/plugins/modifier.daysago.php | 41 +++++ www/plugins/modifier.fsize_format.php | 57 ++++++ www/plugins/modifier.magicurl.php | 20 ++ www/plugins/modifier.nl2br.php | 31 ++++ www/plugins/modifier.parray.php | 9 + www/plugins/modifier.phpdate_format.php | 88 +++++++++ www/plugins/modifier.strtotime.php | 6 + www/plugins/modifier.timeago.php | 49 +++++ 12 files changed, 539 insertions(+) create mode 100755 www/plugins/block.php.php create mode 100755 www/plugins/function.getcatval.php create mode 100755 www/plugins/function.html_options_multiple.php create mode 100755 www/plugins/modifier.daysago.php create mode 100755 www/plugins/modifier.fsize_format.php create mode 100755 www/plugins/modifier.magicurl.php create mode 100755 www/plugins/modifier.nl2br.php create mode 100755 www/plugins/modifier.parray.php create mode 100755 www/plugins/modifier.phpdate_format.php create mode 100755 www/plugins/modifier.strtotime.php create mode 100755 www/plugins/modifier.timeago.php diff --git a/www/pages/BasePage.php b/www/pages/BasePage.php index 1ab7b3b62..0fa583f17 100644 --- a/www/pages/BasePage.php +++ b/www/pages/BasePage.php @@ -103,6 +103,10 @@ class BasePage $this->smarty->setCompileDir(SMARTY_DIR . 'templates_c/'); $this->smarty->setConfigDir(SMARTY_DIR . 'configs/'); $this->smarty->setCacheDir(SMARTY_DIR . 'cache/'); + $this->smarty->setPluginsDir([ + NN_WWW . 'plugins/', + SMARTY_DIR . 'plugins/', + ]); $this->smarty->error_reporting = ((NN_DEBUG ? E_ALL : E_ALL - E_NOTICE)); if (isset($_SERVER['SERVER_NAME'])) { diff --git a/www/plugins/block.php.php b/www/plugins/block.php.php new file mode 100755 index 000000000..4a0aa3dd7 --- /dev/null +++ b/www/plugins/block.php.php @@ -0,0 +1,25 @@ +allow_php_tag) { + throw new SmartyException("{php} is deprecated, set allow_php_tag = true to enable"); + } + eval($content); + return ''; +} +?> \ No newline at end of file diff --git a/www/plugins/function.getcatval.php b/www/plugins/function.getcatval.php new file mode 100755 index 000000000..89b7220fb --- /dev/null +++ b/www/plugins/function.getcatval.php @@ -0,0 +1,35 @@ +. + * @author niel + * @copyright 2016 nZEDb + */ + +use newznab\Category; + +/** + * Returns the value of the specified Category constant. + * @usage {getcatval category=BOOKS_COMICS} + * + *@param string $category Name of constant whose value to return. + * + *@return Value of the specified Category constant. + */ +function smarty_function_getcatval($params) +{ + return Category::getCategoryValue($params['category']); +} + +?> diff --git a/www/plugins/function.html_options_multiple.php b/www/plugins/function.html_options_multiple.php new file mode 100755 index 000000000..3446dd9a3 --- /dev/null +++ b/www/plugins/function.html_options_multiple.php @@ -0,0 +1,174 @@ + + * Name: html_options_multiple
+ * Purpose: Prints the list of