Skip to content

Commit

Permalink
Merge pull request #808 from HDInnovations/analysis-zR9J7x
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
HDVinnie authored Jun 12, 2019
2 parents b8a661a + 9a735ba commit 471fdd8
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 18 deletions.
34 changes: 17 additions & 17 deletions app/Helpers/Bbcode.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,37 +22,37 @@ class Bbcode
'h1' => [
'pattern' => '/\[h1\](.*?)\[\/h1\]/s',
'replace' => '<h1>$1</h1>',
'content' => '$1'
'content' => '$1',
],

'h2' => [
'pattern' => '/\[h2\](.*?)\[\/h2\]/s',
'replace' => '<h2>$1</h2>',
'content' => '$1'
'content' => '$1',
],

'h3' => [
'pattern' => '/\[h3\](.*?)\[\/h3\]/s',
'replace' => '<h3>$1</h3>',
'content' => '$1'
'content' => '$1',
],

'h4' => [
'pattern' => '/\[h4\](.*?)\[\/h4\]/s',
'replace' => '<h4>$1</h4>',
'content' => '$1'
'content' => '$1',
],

'h5' => [
'pattern' => '/\[h5\](.*?)\[\/h5\]/s',
'replace' => '<h5>$1</h5>',
'content' => '$1'
'content' => '$1',
],

'h6' => [
'pattern' => '/\[h6\](.*?)\[\/h6\]/s',
'replace' => '<h6>$1</h6>',
'content' => '$1'
'content' => '$1',
],

'bold' => [
Expand Down Expand Up @@ -215,19 +215,19 @@ class Bbcode
'sub' => [
'pattern' => '/\[sub\](.*?)\[\/sub\]/s',
'replace' => '<sub>$1</sub>',
'content' => '$1'
'content' => '$1',
],

'sup' => [
'pattern' => '/\[sup\](.*?)\[\/sup\]/s',
'replace' => '<sup>$1</sup>',
'content' => '$1'
'content' => '$1',
],

'small' => [
'pattern' => '/\[small\](.*?)\[\/small\]/s',
'replace' => '<small>$1</small>',
'content' => '$1'
'content' => '$1',
],

'table' => [
Expand Down Expand Up @@ -309,7 +309,7 @@ public function __construct()
}

/**
* Parses the BBCode string
* Parses the BBCode string.
*
* @param $source
* @param bool $caseInsensitive
Expand All @@ -318,7 +318,7 @@ public function __construct()
public function parse($source, $caseInsensitive = false)
{
foreach ($this->enabledParsers as $name => $parser) {
$pattern = ($caseInsensitive) ? $parser['pattern'] . 'i' : $parser['pattern'];
$pattern = ($caseInsensitive) ? $parser['pattern'].'i' : $parser['pattern'];

$source = $this->searchAndReplace($pattern, $parser['replace'], $source);
}
Expand All @@ -327,22 +327,22 @@ public function parse($source, $caseInsensitive = false)
}

/**
* Remove all BBCode
* Remove all BBCode.
*
* @param string $source
* @return string Parsed text
*/
public function stripBBCodeTags($source)
{
foreach ($this->parsers as $name => $parser) {
$source = $this->searchAndReplace($parser['pattern'] . 'i', $parser['content'], $source);
$source = $this->searchAndReplace($parser['pattern'].'i', $parser['content'], $source);
}

return $source;
}

/**
* Searches after a specified pattern and replaces it with provided structure
* Searches after a specified pattern and replaces it with provided structure.
*
* @param string $pattern Search pattern
* @param string $replace Replacement structure
Expand All @@ -359,7 +359,7 @@ protected function searchAndReplace($pattern, $replace, $source)
}

/**
* Helper function to parse case sensitive
* Helper function to parse case sensitive.
*
* @param string $source String containing the BBCode
* @return string Parsed text
Expand All @@ -370,7 +370,7 @@ public function parseCaseSensitive($source)
}

/**
* Helper function to parse case insensitive
* Helper function to parse case insensitive.
*
* @param string $source String containing the BBCode
* @return string Parsed text
Expand All @@ -381,7 +381,7 @@ public function parseCaseInsensitive($source)
}

/**
* List of chosen parsers
* List of chosen parsers.
*
* @return array array of parsers
*/
Expand Down
1 change: 1 addition & 0 deletions app/Models/Article.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,7 @@ public function getBrief($length = 100, $ellipses = true, $strip_html = false)
public function getContentHtml()
{
$bbcode = new Bbcode();

return $bbcode->parse($this->content, true);
}
}
1 change: 1 addition & 0 deletions app/Models/Comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ public function user()
public function getContentHtml()
{
$bbcode = new Bbcode();

return $bbcode->parse($this->content, true);
}
}
1 change: 1 addition & 0 deletions app/Models/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ public function chatroom()
public static function getMessageHtml($message)
{
$bbcode = new Bbcode();

return $bbcode->parse($message, true);
}
}
1 change: 1 addition & 0 deletions app/Models/Page.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ class Page extends Model
public function getContentHtml()
{
$bbcode = new Bbcode();

return $bbcode->parse($this->content, true);
}
}
1 change: 1 addition & 0 deletions app/Models/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public function tips()
public function getContentHtml()
{
$bbcode = new Bbcode();

return $bbcode->parse($this->content, true);
}

Expand Down
1 change: 1 addition & 0 deletions app/Models/PrivateMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ public function receiver()
public function getMessageHtml()
{
$bbcode = new Bbcode();

return $bbcode->parse($this->message, true);
}
}
2 changes: 1 addition & 1 deletion app/Models/Torrent.php
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,8 @@ public function request()
public function getDescriptionHtml()
{
$bbcode = new Bbcode();
return $bbcode->parse($this->description, true);

return $bbcode->parse($this->description, true);
}

/**
Expand Down
1 change: 1 addition & 0 deletions app/Models/TorrentRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ public function requestBounty()
public function getDescriptionHtml()
{
$bbcode = new Bbcode();

return $bbcode->parse($this->description, true);
}

Expand Down
2 changes: 2 additions & 0 deletions app/Models/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -939,6 +939,7 @@ public function untilRatio($ratio)
public function getSignature()
{
$bbcode = new Bbcode();

return $bbcode->parse($this->signature, true);
}

Expand All @@ -953,6 +954,7 @@ public function getAboutHtml()
return 'N/A';
} else {
$bbcode = new Bbcode();

return $bbcode->parse($this->about, true);
}
}
Expand Down

0 comments on commit 471fdd8

Please sign in to comment.