* @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',
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)) {
$this->callback = $callback;
}
- protected function run(PlPage &$page, array $args)
+ protected function run(PlPage $page, array $args)
{
global $session, $platal;
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);
$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.
parent::__construct($auth, $perms, $type);
}
- protected function run(PlPage &$page, array $args)
+ protected function run(PlPage $page, array $args)
{
return PL_WIKI;
}
return $url;
}
- private function call_hook(PlPage &$page)
+ private function call_hook(PlPage $page)
{
$hook = $this->find_hook();
if (empty($hook)) {
/** Show the authentication form.
*/
- abstract public function force_login(PlPage& $page);
+ abstract public function force_login(PlPage $page);
public function run()
{
/** Fetch the feed for the given user.
*/
- abstract protected function fetch(PlUser &$user);
+ abstract protected function fetch(PlUser $user);
public function next()
{
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;
$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) {
}
/** 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";
}
* {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));
}
* {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));
}
* {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));
}
* {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));
}
/** template function : subject.
* {subject text=...}
*/
- public function setSubject($params, &$smarty)
+ public function setSubject($params, $smarty)
{
$smarty->mailer->setSubject($params['text']);
}
/** 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']);
}
}
}
- 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);
}
}
- public function sendTo(PlUser &$user)
+ public function sendTo(PlUser $user)
{
$this->setTo($user);
$this->assign_by_ref('user', $user);
* 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);
}
// }}}
// {{{ function trimwhitespace
-function trimwhitespace($source, &$smarty)
+function trimwhitespace($source, $smarty)
{
$tags = '(script|pre|textarea)';
preg_match_all("!<$tags.*?>.*?</(\\1)>!ius", $source, $tagsmatches);
// }}}
// {{{ function wiki_include
-function wiki_include($source, &$smarty)
+function wiki_include($source, $smarty)
{
global $globals;
return preg_replace('/\{include( [^}]*)? wiki=([^} ]+)(.*?)\}/ui',
$source);
}
-function core_include($source, &$smarty)
+function core_include($source, $smarty)
{
global $globals;
return preg_replace('/\{include( [^}]*)? core=([^} ]+)(.*?)\}/ui',
// }}}
//{{{ 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?\(([^)]+)\)([^}]*)\}/',
// }}}
// {{{
-function form_force_encodings($source, &$smarty)
+function form_force_encodings($source, $smarty)
{
return preg_replace('/<form[^\w]/',
'\0 accept-charset="utf-8" ',
'//]]></script>';
}
-function hide_emails($source, &$smarty)
+function hide_emails($source, $smarty)
{
if (!strpos($source, '@')) {
return $source;
// 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;
/** 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);
}
* @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;
* @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)) {
* @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.
* @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.
* @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);
/** 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) {
*/
abstract protected function getBoundValue($obj);
- public function apply(PlPage &$page)
+ public function apply(PlPage $page)
{
foreach ($this->order() as $order) {
if (!is_null($order)) {
}
// 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;
/** 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.
*/
/** 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.
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];
$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:
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');
* 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');
* 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)) {
* 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));
* 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) {
* 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)) {
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;
}
* 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);
* 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', '');
}
* 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 '<div style="display: none"><input type="hidden" name="token" value="' . S::v('xsrf_token') . '" /></div>';
}
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';
}
}
- 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';