Skip to content

Commit

Permalink
Update return types (#26225)
Browse files Browse the repository at this point in the history
  • Loading branch information
SharkyKZ authored and wilsonge committed Sep 11, 2019
1 parent fad4f65 commit 21c74a1
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 24 deletions.
12 changes: 5 additions & 7 deletions plugins/content/contact/contact.php
Expand Up @@ -38,33 +38,33 @@ class PlgContentContact extends CMSPlugin
* @param mixed $params Additional parameters. See {@see PlgContentContent()}.
* @param integer $page Optional page number. Unused. Defaults to zero.
*
* @return boolean True on success.
* @return void
*/
public function onContentPrepare($context, &$row, $params, $page = 0)
{
$allowed_contexts = array('com_content.category', 'com_content.article', 'com_content.featured');

if (!in_array($context, $allowed_contexts))
{
return true;
return;
}

// Return if we don't have valid params or don't link the author
if (!($params instanceof Registry) || !$params->get('link_author'))
{
return true;
return;
}

// Return if an alias is used
if ((int) $this->params->get('link_to_alias', 0) === 0 && $row->created_by_alias != '')
{
return true;
return;
}

// Return if we don't have a valid article id
if (!isset($row->id) || !(int) $row->id)
{
return true;
return;
}

$contact = $this->getContactData($row->created_by);
Expand All @@ -90,8 +90,6 @@ public function onContentPrepare($context, &$row, $params, $page = 0)
{
$row->contact_link = '';
}

return true;
}

/**
Expand Down
18 changes: 10 additions & 8 deletions plugins/content/emailcloak/emailcloak.php
Expand Up @@ -28,22 +28,24 @@ class PlgContentEmailcloak extends CMSPlugin
* @param mixed &$params Additional parameters. See {@see PlgContentEmailcloak()}.
* @param integer $page Optional page number. Unused. Defaults to zero.
*
* @return boolean True on success.
* @return void
*/
public function onContentPrepare($context, &$row, &$params, $page = 0)
{
// Don't run this plugin when the content is being indexed
if ($context === 'com_finder.indexer')
{
return true;
return;
}

if (is_object($row))
{
return $this->_cloak($row->text, $params);
$this->_cloak($row->text, $params);

return;
}

return $this->_cloak($row, $params);
$this->_cloak($row, $params);
}

/**
Expand All @@ -68,7 +70,7 @@ protected function _getPattern($link, $text)
* @param mixed &$params Additional parameters. Parameter "mode" (integer, default 1)
* replaces addresses with "mailto:" links if nonzero.
*
* @return boolean True on success.
* @return void
*/
protected function _cloak(&$text, &$params)
{
Expand All @@ -80,13 +82,13 @@ protected function _cloak(&$text, &$params)
{
$text = StringHelper::str_ireplace('{emailcloak=off}', '', $text);

return true;
return;
}

// Simple performance check to determine whether bot should process further.
if (StringHelper::strpos($text, '@') === false)
{
return true;
return;
}

$mode = (int) $this->params->def('mode', 1);
Expand Down Expand Up @@ -426,6 +428,6 @@ protected function _cloak(&$text, &$params)
$text = substr_replace($text, $replacement, $regs[1][1], strlen($mail));
}

return true;
return;
}
}
6 changes: 3 additions & 3 deletions plugins/content/loadmodule/loadmodule.php
Expand Up @@ -33,7 +33,7 @@ class PlgContentLoadmodule extends CMSPlugin
* @param mixed &$params The article params
* @param integer $page The 'page' number
*
* @return mixed true if there is an error. Void otherwise.
* @return void
*
* @since 1.6
*/
Expand All @@ -42,13 +42,13 @@ public function onContentPrepare($context, &$article, &$params, $page = 0)
// Don't run this plugin when the content is being indexed
if ($context === 'com_finder.indexer')
{
return true;
return;
}

// Simple performance check to determine whether bot should process further
if (strpos($article->text, 'loadposition') === false && strpos($article->text, 'loadmodule') === false)
{
return true;
return;
}

// Expression to search for (positions)
Expand Down
10 changes: 4 additions & 6 deletions plugins/content/pagebreak/pagebreak.php
Expand Up @@ -46,7 +46,7 @@ class PlgContentPagebreak extends CMSPlugin
* @param mixed &$params The article params
* @param integer $page The 'page' number
*
* @return mixed Always returns void or true
* @return void
*
* @since 1.6
*/
Expand Down Expand Up @@ -78,7 +78,7 @@ public function onContentPrepare($context, &$row, &$params, $page = 0)
{
$row->text = preg_replace($regex, '<br>', $row->text);

return true;
return;
}

// Simple performance check to determine whether bot should process further.
Expand All @@ -89,7 +89,7 @@ public function onContentPrepare($context, &$row, &$params, $page = 0)
throw new Exception(Text::_('JERROR_PAGE_NOT_FOUND'), 404);
}

return true;
return;
}

$view = $input->getString('view');
Expand Down Expand Up @@ -131,7 +131,7 @@ public function onContentPrepare($context, &$row, &$params, $page = 0)

$row->text = preg_replace($regex, '<br>', $row->text);

return true;
return;
}

// Split the text around the plugin.
Expand Down Expand Up @@ -278,8 +278,6 @@ public function onContentPrepare($context, &$row, &$params, $page = 0)
$row->text = implode(' ', $t);
}
}

return true;
}

/**
Expand Down

0 comments on commit 21c74a1

Please sign in to comment.