From ed4f7de016bb136fae9f72256c827ef09d4ea863 Mon Sep 17 00:00:00 2001 From: =?utf8?q?St=C3=A9phane=20Jacob?= Date: Wed, 16 Feb 2011 15:17:16 +0100 Subject: [PATCH] Fixes deprecated features in PHP 5.3.x. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Stéphane Jacob --- classes/csvimporter.php | 2 +- classes/platal.php | 16 ++++++++-------- classes/plfeed.php | 4 ++-- classes/plmailer.php | 20 ++++++++++---------- classes/plpage.php | 14 +++++++------- classes/plset.php | 24 ++++++++++++------------ classes/pltableeditor.php | 2 +- classes/plwizard.php | 8 ++++---- modules/core.php | 6 +++--- plugins/block.tidy.php | 2 +- plugins/compiler.checkpasswd.php | 2 +- plugins/compiler.icon.php | 2 +- plugins/compiler.iterate.php | 4 ++-- plugins/compiler.javascript.php | 2 +- plugins/function.select_db_table.php | 2 +- plugins/function.valid_date.php | 2 +- plugins/function.xsrf_token.php | 2 +- plugins/function.xsrf_token_field.php | 2 +- ut/enginetest.php | 8 ++++---- 19 files changed, 62 insertions(+), 62 deletions(-) diff --git a/classes/csvimporter.php b/classes/csvimporter.php index 52fd2b5..6acb2c7 100644 --- a/classes/csvimporter.php +++ b/classes/csvimporter.php @@ -243,7 +243,7 @@ class CSVImporter * @param $url URI of the page * @param $field Editable fields */ - public function apply(&$page, $url, $fields = null) + public function apply($page, $url, $fields = null) { $sesfields = array('csv_value', 'csv_user_value', 'csv_cond_field', 'csv_update', 'csv_action', 'csv_cond_field', diff --git a/classes/platal.php b/classes/platal.php index eeafbb9..5d33287 100644 --- a/classes/platal.php +++ b/classes/platal.php @@ -54,9 +54,9 @@ abstract class PlHook return ($this->type & $type) == $type; } - abstract protected function run(PlPage &$page, array $args); + abstract protected function run(PlPage $page, array $args); - public function call(PlPage &$page, array $args) + public function call(PlPage $page, array $args) { global $globals, $session, $platal; if (!$session->checkAuth($this->auth)) { @@ -92,7 +92,7 @@ class PlStdHook extends PlHook $this->callback = $callback; } - protected function run(PlPage &$page, array $args) + protected function run(PlPage $page, array $args) { global $session, $platal; @@ -152,7 +152,7 @@ class PlApiHook extends PlHook return empty($encodedPayload) ? array() : json_decode($encodedPayload, true); } - protected function run(PlPage &$page, array $args) + protected function run(PlPage $page, array $args) { $method = $_SERVER['REQUEST_METHOD']; $encodedPayload = $this->getEncodedPayload($method); @@ -215,7 +215,7 @@ class PlTokenHook extends PlHook $this->callback = $callback; } - protected function run(PlPage &$page, array $args) + protected function run(PlPage $page, array $args) { // Retrieve the user, either from the session (less expensive, as it is // already there), or from the in-path (user, token) pair. @@ -250,7 +250,7 @@ class PlWikiHook extends PlHook parent::__construct($auth, $perms, $type); } - protected function run(PlPage &$page, array $args) + protected function run(PlPage $page, array $args) { return PL_WIKI; } @@ -467,7 +467,7 @@ abstract class Platal return $url; } - private function call_hook(PlPage &$page) + private function call_hook(PlPage $page) { $hook = $this->find_hook(); if (empty($hook)) { @@ -483,7 +483,7 @@ abstract class Platal /** Show the authentication form. */ - abstract public function force_login(PlPage& $page); + abstract public function force_login(PlPage $page); public function run() { diff --git a/classes/plfeed.php b/classes/plfeed.php index a8c51f2..74d6bea 100644 --- a/classes/plfeed.php +++ b/classes/plfeed.php @@ -69,7 +69,7 @@ abstract class PlFeed implements PlIterator /** Fetch the feed for the given user. */ - abstract protected function fetch(PlUser &$user); + abstract protected function fetch(PlUser $user); public function next() { @@ -95,7 +95,7 @@ abstract class PlFeed implements PlIterator return $this->iterator->last(); } - public function run(PlPage& $page, PlUser& $user, $require_auth = true, $type = 'rss2') + public function run(PlPage $page, PlUser $user, $require_auth = true, $type = 'rss2') { if (empty($user) && $require_auth) { return PL_FORBIDDEN; diff --git a/classes/plmailer.php b/classes/plmailer.php index fbcf852..e928a0a 100644 --- a/classes/plmailer.php +++ b/classes/plmailer.php @@ -50,7 +50,7 @@ class PlMail extends Smarty $this->assign_by_ref('globals', $globals); } - public static function &get(&$mailer, $tpl) + public static function &get($mailer, $tpl) { static $plmail; if (!isset($plmail) || $plmail->tpl != $tpl) { @@ -71,7 +71,7 @@ class PlMail extends Smarty } /** used to remove the empty lines due to {from ...}, {to ...} ... functions */ - static public function mail_format($output, &$smarty) + static public function mail_format($output, $smarty) { return "\n".trim($output)."\n"; } @@ -91,7 +91,7 @@ class PlMail extends Smarty * {from full=...} for an already formatted address * {from addr=... [text=...]} else */ - public function setFrom($params, &$smarty) + public function setFrom($params, $smarty) { $smarty->mailer->setFrom(PlMail::format_addr($params)); } @@ -100,7 +100,7 @@ class PlMail extends Smarty * {to full=...} for an already formatted address * {to addr=... [text=...]} else */ - public function addTo($params, &$smarty) + public function addTo($params, $smarty) { $smarty->mailer->addTo(PlMail::format_addr($params)); } @@ -109,7 +109,7 @@ class PlMail extends Smarty * {cc full=...} for an already formatted address * {cc addr=... [text=...]} else */ - public function addCc($params, &$smarty) + public function addCc($params, $smarty) { $smarty->mailer->addCc(PlMail::format_addr($params)); } @@ -118,7 +118,7 @@ class PlMail extends Smarty * {bcc full=...} for an already formatted address * {bcc addr=... [text=...]} else */ - public function addBcc($params, &$smarty) + public function addBcc($params, $smarty) { $smarty->mailer->addBcc(PlMail::format_addr($params)); } @@ -126,7 +126,7 @@ class PlMail extends Smarty /** template function : subject. * {subject text=...} */ - public function setSubject($params, &$smarty) + public function setSubject($params, $smarty) { $smarty->mailer->setSubject($params['text']); } @@ -134,7 +134,7 @@ class PlMail extends Smarty /** template function : add_header. * {add_header name=... value=...} */ - public function addHeader($params, &$smarty) + public function addHeader($params, $smarty) { $smarty->mailer->addHeader($params['name'], $params['value']); } @@ -261,7 +261,7 @@ class PlMailer extends Mail_Mime { } } - public function addUploadAttachment(PlUpload &$upload, $name) + public function addUploadAttachment(PlUpload $upload, $name) { $encoding = $upload->isType('text') ? 'quoted-printable' : 'base64'; $this->addAttachment($upload->getContents(), $upload->contentType(), $name, false, $encoding); @@ -331,7 +331,7 @@ class PlMailer extends Mail_Mime { } } - public function sendTo(PlUser &$user) + public function sendTo(PlUser $user) { $this->setTo($user); $this->assign_by_ref('user', $user); diff --git a/classes/plpage.php b/classes/plpage.php index c7a3006..516378b 100644 --- a/classes/plpage.php +++ b/classes/plpage.php @@ -453,7 +453,7 @@ function _to_globals($s) { * compilation plugin used to import $globals confing through #globals.foo.bar# directives */ -function at_to_globals($tpl_source, &$smarty) +function at_to_globals($tpl_source, $smarty) { return preg_replace('/#globals\.([a-zA-Z0-9_.]+?)#/e', '_to_globals(\'\\1\')', $tpl_source); } @@ -461,7 +461,7 @@ function at_to_globals($tpl_source, &$smarty) // }}} // {{{ function trimwhitespace -function trimwhitespace($source, &$smarty) +function trimwhitespace($source, $smarty) { $tags = '(script|pre|textarea)'; preg_match_all("!<$tags.*?>.*?!ius", $source, $tagsmatches); @@ -478,7 +478,7 @@ function trimwhitespace($source, &$smarty) // }}} // {{{ function wiki_include -function wiki_include($source, &$smarty) +function wiki_include($source, $smarty) { global $globals; return preg_replace('/\{include( [^}]*)? wiki=([^} ]+)(.*?)\}/ui', @@ -486,7 +486,7 @@ function wiki_include($source, &$smarty) $source); } -function core_include($source, &$smarty) +function core_include($source, $smarty) { global $globals; return preg_replace('/\{include( [^}]*)? core=([^} ]+)(.*?)\}/ui', @@ -497,7 +497,7 @@ function core_include($source, &$smarty) // }}} //{{{ function hasPerm -function if_rewrites($source, &$smarty) +function if_rewrites($source, $smarty) { $perms = 'isset($smarty.session.user|smarty:nodefaults) && $smarty.session.user'; return preg_replace(array('/\{(else)?if([^}]*) (\!?)hasPerms?\(([^)]+)\)([^}]*)\}/', @@ -510,7 +510,7 @@ function if_rewrites($source, &$smarty) // }}} // {{{ -function form_force_encodings($source, &$smarty) +function form_force_encodings($source, $smarty) { return preg_replace('/'; } -function hide_emails($source, &$smarty) +function hide_emails($source, $smarty) { if (!strpos($source, '@')) { return $source; diff --git a/classes/plset.php b/classes/plset.php index 7b156a2..6a48c78 100644 --- a/classes/plset.php +++ b/classes/plset.php @@ -41,7 +41,7 @@ abstract class PlSet // The default view name private $default = null; - public function __construct(PlFilterCondition &$cond, $orders = null) + public function __construct(PlFilterCondition $cond, $orders = null) { if ($cond instanceof PFC_And) { $this->conds = $cond; @@ -83,14 +83,14 @@ abstract class PlSet /** Adds a new sort (on the PlFilter) */ - public function addSort(PlFilterOrder &$order) + public function addSort(PlFilterOrder $order) { $this->orders[] = $order; } /** Adds a new condition to the PlFilter */ - public function addCond(PlFilterCondition &$cond) + public function addCond(PlFilterCondition $cond) { $this->conds->addChild($cond); } @@ -99,15 +99,15 @@ abstract class PlSet * @param $cond The PlFilterCondition for the filter * @param $orders An array of PlFilterOrder for the filter */ - abstract protected function buildFilter(PlFilterCondition &$cond, $orders); + abstract protected function buildFilter(PlFilterCondition $cond, $orders); /** This function returns the results of the given filter * wihtin $limit; can be use to replace the default $pf->get call. - * @param &$pf The filter + * @param $pf The filter * @param $limit The PlLimit * @return The results of the filter */ - protected function &getFilterResults(PlFilter &$pf, PlLimit $limit) + protected function &getFilterResults(PlFilter $pf, PlLimit $limit) { $res = $pf->get($limit); return $res; @@ -225,7 +225,7 @@ abstract class PlSet * @param $page The page in which the view should be loaded * @param $view The name of the view; if null, the default one will be used. */ - public function apply($baseurl, PlPage &$page, $view = null) + public function apply($baseurl, PlPage $page, $view = null) { $view =& $this->buildView($view); if (is_null($view)) { @@ -253,7 +253,7 @@ interface PlView * @param $set The set * @param $params Parameters to tune the view (sort by score, include promo...) */ - public function __construct(PlSet &$set, array $params); + public function __construct(PlSet $set, array $params); /** Applies the view to a page * The content of the set is fetched here. @@ -261,7 +261,7 @@ interface PlView * @return The name of the global view template (for displaying the view, * not the items of the set) */ - public function apply(PlPage &$page); + public function apply(PlPage $page); /** As PlSet->args(), returns the ?foo=bar part of the URL for generating * this PlSet, after adding the necessary components and removing useless ones. @@ -317,7 +317,7 @@ abstract class MultipageView implements PlView * @param $set The associated PlSet * @param $params Parameters of the view */ - public function __construct(PlSet &$set, array $params) + public function __construct(PlSet $set, array $params) { $this->set =& $set; $this->page = Env::i('page', 1); @@ -327,7 +327,7 @@ abstract class MultipageView implements PlView /** Add an order to the view */ - protected function addSort(PlViewOrder &$pvo, $default = false) + protected function addSort(PlViewOrder $pvo, $default = false) { $this->sortkeys[$pvo->name] = $pvo; if (!$this->defaultkey || $default) { @@ -382,7 +382,7 @@ abstract class MultipageView implements PlView */ abstract protected function getBoundValue($obj); - public function apply(PlPage &$page) + public function apply(PlPage $page) { foreach ($this->order() as $order) { if (!is_null($order)) { diff --git a/classes/pltableeditor.php b/classes/pltableeditor.php index 7a13fc7..fea0c34 100644 --- a/classes/pltableeditor.php +++ b/classes/pltableeditor.php @@ -230,7 +230,7 @@ class PLTableEditor } // call when done - public function apply(PlPage &$page, $action, $id = false, $id2 = false) + public function apply(PlPage $page, $action, $id = false, $id2 = false) { $page->coreTpl('table-editor.tpl'); $list = true; diff --git a/classes/plwizard.php b/classes/plwizard.php index ad3bb2a..656b957 100644 --- a/classes/plwizard.php +++ b/classes/plwizard.php @@ -29,7 +29,7 @@ interface PlWizardPage /** Build a new instance of the class * associated with the given wizard master. */ - public function __construct(PlWizard &$wiz); + public function __construct(PlWizard $wiz); /** Return the name of the templace describing the page. */ @@ -37,7 +37,7 @@ interface PlWizardPage /** Prepare the page by assigning to it any useful value. */ - public function prepare(PlPage &$page, $id); + public function prepare(PlPage $page, $id); /** Process information resulting of the application of the page. * This function must return a clue indicating the next page to show. @@ -156,7 +156,7 @@ class PlWizard return new $page($this); } - public function apply(PlPage &$smarty, $baseurl, $pgid = null, $mode = 'normal') + public function apply(PlPage $smarty, $baseurl, $pgid = null, $mode = 'normal') { if ($this->stateless && (isset($this->lookup[$pgid]) || isset($this->pages[$pgid]))) { $curpage = is_numeric($pgid) ? $pgid : $this->lookup[$pgid]; @@ -174,7 +174,7 @@ class PlWizard $page = $this->getPage(Post::i('valid_page')); $curpage = Post::i('valid_page'); $success = false; - $next = $page->process(&$success); + $next = $page->process($success); $last = $curpage; switch ($next) { case PlWizard::FIRST_PAGE: diff --git a/modules/core.php b/modules/core.php index f3d9386..8be36c0 100644 --- a/modules/core.php +++ b/modules/core.php @@ -71,21 +71,21 @@ class CoreModule extends PLModule exit; } - function handler_400(PlPage& $page) + function handler_400(PlPage $page) { header($_SERVER['SERVER_PROTOCOL'] . ' 400 Bad Request'); $page->coreTpl('40x.tpl'); $page->trigError('Ta requête est invalide.'); } - function handler_403(PlPage& $page) + function handler_403(PlPage $page) { header($_SERVER['SERVER_PROTOCOL'] . ' 403 Forbidden'); $page->coreTpl('40x.tpl'); $page->trigError('Tu n\'as pas les permissions nécessaires pour accéder à cette page.'); } - function handler_404(PlPage& $page) + function handler_404(PlPage $page) { global $platal; header($_SERVER['SERVER_PROTOCOL'] . ' 404 Not Found'); diff --git a/plugins/block.tidy.php b/plugins/block.tidy.php index 8cc8422..2e1ff55 100644 --- a/plugins/block.tidy.php +++ b/plugins/block.tidy.php @@ -44,7 +44,7 @@ $tidy_config = array( * Purpose: * ------------------------------------------------------------- */ -function smarty_block_tidy($params, $content, &$smarty) +function smarty_block_tidy($params, $content, $smarty) { global $tidy_config; return tidy_repair_string($content, $tidy_config, 'utf8'); diff --git a/plugins/compiler.checkpasswd.php b/plugins/compiler.checkpasswd.php index d396b23..f4ad12c 100644 --- a/plugins/compiler.checkpasswd.php +++ b/plugins/compiler.checkpasswd.php @@ -19,7 +19,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ -function smarty_compiler_checkpasswd($tag_attrs, &$compiler) +function smarty_compiler_checkpasswd($tag_attrs, $compiler) { extract($compiler->_parse_attrs($tag_attrs)); if (!isset($width)) { diff --git a/plugins/compiler.icon.php b/plugins/compiler.icon.php index 58bbec4..bdf7325 100644 --- a/plugins/compiler.icon.php +++ b/plugins/compiler.icon.php @@ -19,7 +19,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ -function smarty_compiler_icon($tag_attrs, &$compiler) +function smarty_compiler_icon($tag_attrs, $compiler) { extract($compiler->_parse_attrs($tag_attrs)); diff --git a/plugins/compiler.iterate.php b/plugins/compiler.iterate.php index bb20238..3cbf3f2 100644 --- a/plugins/compiler.iterate.php +++ b/plugins/compiler.iterate.php @@ -19,11 +19,11 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ -function iterate_end($tag_attrs, &$compiler) { +function iterate_end($tag_attrs, $compiler) { return 'endwhile;'; } -function smarty_compiler_iterate($tag_attrs, &$compiler) +function smarty_compiler_iterate($tag_attrs, $compiler) { static $reg = false; if (!$reg) { diff --git a/plugins/compiler.javascript.php b/plugins/compiler.javascript.php index 53b8241..8f4ab90 100644 --- a/plugins/compiler.javascript.php +++ b/plugins/compiler.javascript.php @@ -19,7 +19,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ -function smarty_compiler_javascript($tag_attrs, &$compiler) +function smarty_compiler_javascript($tag_attrs, $compiler) { extract($compiler->_parse_attrs($tag_attrs)); if (!isset($name)) { diff --git a/plugins/function.select_db_table.php b/plugins/function.select_db_table.php index ea1a1b3..5ebf848 100644 --- a/plugins/function.select_db_table.php +++ b/plugins/function.select_db_table.php @@ -56,7 +56,7 @@ function select_options($table, $value, $field, $pad, $where, $join, $group) return $html; } -function smarty_function_select_db_table($params, &$smarty) { +function smarty_function_select_db_table($params, $smarty) { if (empty($params['table']) || !array_key_exists('valeur', $params)) { return; } diff --git a/plugins/function.valid_date.php b/plugins/function.valid_date.php index ee0c65f..9224d3f 100644 --- a/plugins/function.valid_date.php +++ b/plugins/function.valid_date.php @@ -19,7 +19,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ -function smarty_function_valid_date($params, &$smarty) +function smarty_function_valid_date($params, $smarty) { extract($params); diff --git a/plugins/function.xsrf_token.php b/plugins/function.xsrf_token.php index 14455db..eed18f9 100644 --- a/plugins/function.xsrf_token.php +++ b/plugins/function.xsrf_token.php @@ -19,7 +19,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ -function smarty_function_xsrf_token($params, &$smarty) { +function smarty_function_xsrf_token($params, $smarty) { return S::v('xsrf_token', ''); } diff --git a/plugins/function.xsrf_token_field.php b/plugins/function.xsrf_token_field.php index 68d5e90..943d5c4 100644 --- a/plugins/function.xsrf_token_field.php +++ b/plugins/function.xsrf_token_field.php @@ -19,7 +19,7 @@ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * ***************************************************************************/ -function smarty_function_xsrf_token_field($params, &$smarty) { +function smarty_function_xsrf_token_field($params, $smarty) { if (S::has('xsrf_token')) { return '
'; } diff --git a/ut/enginetest.php b/ut/enginetest.php index b8e1122..1aeed16 100644 --- a/ut/enginetest.php +++ b/ut/enginetest.php @@ -30,19 +30,19 @@ class TestPage extends PlPage class EngineTest extends PlTestCase { - public static function blahCallback(PlPage &$page) + public static function blahCallback(PlPage $page) { return 'blah'; } - public static function blihCallback(PlPage &$page) + public static function blihCallback(PlPage $page) { $args = func_get_args(); array_shift($args); return 'blih-' . implode('-', $args); } - public static function fooCallback(PlPage &$page, $arg1 = null) + public static function fooCallback(PlPage $page, $arg1 = null) { if (is_null($arg1)) { return 'foo'; @@ -51,7 +51,7 @@ class EngineTest extends PlTestCase } } - public static function barCallback(PlPage &$page, $arg1 = null, $arg2 = null) + public static function barCallback(PlPage $page, $arg1 = null, $arg2 = null) { if (is_null($arg1)) { return 'bar'; -- 2.1.4