HDVinnie
2021-05-15 13:28:50 -04:00
parent 50214612d9
commit bd6008a900
23 changed files with 213 additions and 213 deletions
+2 -2
View File
@@ -67,7 +67,7 @@ class FetchReleaseYears extends Command
$meta = null;
if ($torrent->category->tv_meta && $torrent->tmdb && $torrent->tmdb != 0) {
$meta = Tv::where('id', '=', $torrent->tmdb)->first();
if (isset($meta->first_air_date) && \substr($meta->first_air_date, 0, 4) > '1900') {
if (\property_exists($meta, 'first_air_date') && $meta->first_air_date !== null && \substr($meta->first_air_date, 0, 4) > '1900') {
$torrent->release_year = \substr($meta->first_air_date, 0, 4);
$torrent->save();
$this->info(\sprintf('(%s) Release Year Fetched For Torrent %s ', $torrent->category->name, $torrent->name));
@@ -77,7 +77,7 @@ class FetchReleaseYears extends Command
}
if ($torrent->category->movie_meta && $torrent->tmdb && $torrent->tmdb != 0) {
$meta = Movie::where('id', '=', $torrent->tmdb)->first();
if (isset($meta->release_date) && \substr($meta->release_date, 0, 4) > '1900') {
if (\property_exists($meta, 'release_date') && $meta->release_date !== null && \substr($meta->release_date, 0, 4) > '1900') {
$torrent->release_year = \substr($meta->release_date, 0, 4);
$torrent->save();
$this->info(\sprintf('(%s) Release Year Fetched For Torrent %s ', $torrent->category->name, $torrent->name));
+133 -133
View File
@@ -24,7 +24,7 @@ class Markdown
$markup = $this->elements($Elements);
// trim line breaks
return trim($markup, "\n");
return \trim($markup, "\n");
}
protected function textElements($text)
@@ -33,13 +33,13 @@ class Markdown
$this->DefinitionData = [];
// standardize line breaks
$text = str_replace(["\r\n", "\r"], "\n", $text);
$text = \str_replace(["\r\n", "\r"], "\n", $text);
// remove surrounding line breaks
$text = trim($text, "\n");
$text = \trim($text, "\n");
// split text into lines
$lines = explode("\n", $text);
$lines = \explode("\n", $text);
// iterate through lines to identify blocks
return $this->linesElements($lines);
@@ -163,7 +163,7 @@ class Markdown
$CurrentBlock = null;
foreach ($lines as $line) {
if (rtrim($line) === '') {
if (\rtrim($line) === '') {
if (isset($CurrentBlock)) {
$CurrentBlock['interrupted'] = (isset($CurrentBlock['interrupted'])
? $CurrentBlock['interrupted'] + 1 : 1
@@ -173,17 +173,17 @@ class Markdown
continue;
}
while (($beforeTab = strstr($line, "\t", true)) !== false) {
$shortage = 4 - mb_strlen($beforeTab, 'utf-8') % 4;
while (($beforeTab = \strstr($line, "\t", true)) !== false) {
$shortage = 4 - \mb_strlen($beforeTab, 'utf-8') % 4;
$line = $beforeTab
.str_repeat(' ', $shortage)
.substr($line, strlen($beforeTab) + 1);
.\str_repeat(' ', $shortage)
.\substr($line, \strlen($beforeTab) + 1);
}
$indent = strspn($line, ' ');
$indent = \strspn($line, ' ');
$text = $indent > 0 ? substr($line, $indent) : $line;
$text = $indent > 0 ? \substr($line, $indent) : $line;
// ~
@@ -225,7 +225,7 @@ class Markdown
// ~
foreach ($blockTypes as $blockType) {
$Block = $this->{sprintf('block%s', $blockType)}($Line, $CurrentBlock);
$Block = $this->{\sprintf('block%s', $blockType)}($Line, $CurrentBlock);
if (isset($Block)) {
$Block['type'] = $blockType;
@@ -300,12 +300,12 @@ class Markdown
protected function isBlockContinuable($Type)
{
return method_exists($this, 'block'.$Type.'Continue');
return \method_exists($this, 'block'.$Type.'Continue');
}
protected function isBlockCompletable($Type)
{
return method_exists($this, 'block'.$Type.'Complete');
return \method_exists($this, 'block'.$Type.'Complete');
}
//
@@ -318,7 +318,7 @@ class Markdown
}
if ($Line['indent'] >= 4) {
$text = substr($Line['body'], 4);
$text = \substr($Line['body'], 4);
return [
'element' => [
@@ -336,14 +336,14 @@ class Markdown
{
if ($Line['indent'] >= 4) {
if (isset($Block['interrupted'])) {
$Block['element']['element']['text'] .= str_repeat("\n", $Block['interrupted']);
$Block['element']['element']['text'] .= \str_repeat("\n", $Block['interrupted']);
unset($Block['interrupted']);
}
$Block['element']['element']['text'] .= "\n";
$text = substr($Line['body'], 4);
$text = \substr($Line['body'], 4);
$Block['element']['element']['text'] .= $text;
@@ -365,7 +365,7 @@ class Markdown
return;
}
if (str_starts_with($Line['text'], '<!--')) {
if (\str_starts_with($Line['text'], '<!--')) {
$Block = [
'element' => [
'rawHtml' => $Line['body'],
@@ -373,7 +373,7 @@ class Markdown
],
];
if (str_contains($Line['text'], '-->')) {
if (\str_contains($Line['text'], '-->')) {
$Block['closed'] = true;
}
@@ -389,7 +389,7 @@ class Markdown
$Block['element']['rawHtml'] .= "\n".$Line['body'];
if (str_contains($Line['text'], '-->')) {
if (\str_contains($Line['text'], '-->')) {
$Block['closed'] = true;
}
@@ -403,15 +403,15 @@ class Markdown
{
$marker = $Line['text'][0];
$openerLength = strspn($Line['text'], $marker);
$openerLength = \strspn($Line['text'], $marker);
if ($openerLength < 3) {
return;
}
$infostring = trim(substr($Line['text'], $openerLength), "\t ");
$infostring = \trim(\substr($Line['text'], $openerLength), "\t ");
if (str_contains($infostring, '`')) {
if (\str_contains($infostring, '`')) {
return;
}
@@ -433,9 +433,9 @@ class Markdown
* U+000A LINE FEED (LF), U+000C FORM FEED (FF), and
* U+000D CARRIAGE RETURN (CR).
*/
$language = substr($infostring, 0, strcspn($infostring, " \t\n\f\r"));
$language = \substr($infostring, 0, \strcspn($infostring, " \t\n\f\r"));
$Element['attributes'] = ['class' => sprintf('language-%s', $language)];
$Element['attributes'] = ['class' => \sprintf('language-%s', $language)];
}
return [
@@ -455,14 +455,14 @@ class Markdown
}
if (isset($Block['interrupted'])) {
$Block['element']['element']['text'] .= str_repeat("\n", $Block['interrupted']);
$Block['element']['element']['text'] .= \str_repeat("\n", $Block['interrupted']);
unset($Block['interrupted']);
}
if (($len = strspn($Line['text'], $Block['char'])) >= $Block['openerLength'] && rtrim(substr($Line['text'], $len), ' ') === ''
if (($len = \strspn($Line['text'], $Block['char'])) >= $Block['openerLength'] && \rtrim(\substr($Line['text'], $len), ' ') === ''
) {
$Block['element']['element']['text'] = substr($Block['element']['element']['text'], 1);
$Block['element']['element']['text'] = \substr($Block['element']['element']['text'], 1);
$Block['complete'] = true;
@@ -484,19 +484,19 @@ class Markdown
protected function blockHeader($Line)
{
$level = strspn($Line['text'], '#');
$level = \strspn($Line['text'], '#');
if ($level > 6) {
return;
}
$text = trim($Line['text'], '#');
$text = \trim($Line['text'], '#');
if ($this->strictMode && isset($text[0]) && $text[0] !== ' ') {
return;
}
$text = trim($text, ' ');
$text = \trim($text, ' ');
return [
'element' => [
@@ -517,18 +517,18 @@ class Markdown
{
[$name, $pattern] = $Line['text'][0] <= '-' ? ['ul', '[*+-]'] : ['ol', '[0-9]{1,9}+[.\)]'];
if (preg_match('/^('.$pattern.'([ ]++|$))(.*+)/', $Line['text'], $matches)) {
$contentIndent = strlen($matches[2]);
if (\preg_match('/^('.$pattern.'([ ]++|$))(.*+)/', $Line['text'], $matches)) {
$contentIndent = \strlen($matches[2]);
if ($contentIndent >= 5) {
$contentIndent--;
$matches[1] = substr($matches[1], 0, -$contentIndent);
$matches[3] = str_repeat(' ', $contentIndent).$matches[3];
$matches[1] = \substr($matches[1], 0, -$contentIndent);
$matches[3] = \str_repeat(' ', $contentIndent).$matches[3];
} elseif ($contentIndent === 0) {
$matches[1] .= ' ';
}
$markerWithoutWhitespace = strstr($matches[1], ' ', true);
$markerWithoutWhitespace = \strstr($matches[1], ' ', true);
$Block = [
'indent' => $Line['indent'],
@@ -536,17 +536,17 @@ class Markdown
'data' => [
'type' => $name,
'marker' => $matches[1],
'markerType' => ($name === 'ul' ? $markerWithoutWhitespace : substr($markerWithoutWhitespace, -1)),
'markerType' => ($name === 'ul' ? $markerWithoutWhitespace : \substr($markerWithoutWhitespace, -1)),
],
'element' => [
'name' => $name,
'elements' => [],
],
];
$Block['data']['markerTypeRegex'] = preg_quote($Block['data']['markerType'], '/');
$Block['data']['markerTypeRegex'] = \preg_quote($Block['data']['markerType'], '/');
if ($name === 'ol') {
$listStart = ltrim(strstr($matches[1], $Block['data']['markerType'], true), '0') ?: '0';
$listStart = \ltrim(\strstr($matches[1], $Block['data']['markerType'], true), '0') ?: '0';
if ($listStart !== '1') {
if (
@@ -580,9 +580,9 @@ class Markdown
return null;
}
$requiredIndent = ($Block['indent'] + strlen($Block['data']['marker']));
$requiredIndent = ($Block['indent'] + \strlen($Block['data']['marker']));
if ($Line['indent'] < $requiredIndent && ($Block['data']['type'] === 'ol' && preg_match('/^[0-9]++'.$Block['data']['markerTypeRegex'].'(?:[ ]++(.*)|$)/', $Line['text'], $matches) || $Block['data']['type'] === 'ul' && preg_match('/^'.$Block['data']['markerTypeRegex'].'(?:[ ]++(.*)|$)/', $Line['text'], $matches))) {
if ($Line['indent'] < $requiredIndent && ($Block['data']['type'] === 'ol' && \preg_match('/^[0-9]++'.$Block['data']['markerTypeRegex'].'(?:[ ]++(.*)|$)/', $Line['text'], $matches) || $Block['data']['type'] === 'ul' && \preg_match('/^'.$Block['data']['markerTypeRegex'].'(?:[ ]++(.*)|$)/', $Line['text'], $matches))) {
if (isset($Block['interrupted'])) {
$Block['li']['handler']['argument'][] = '';
@@ -629,7 +629,7 @@ class Markdown
unset($Block['interrupted']);
}
$text = substr($Line['body'], $requiredIndent);
$text = \substr($Line['body'], $requiredIndent);
$Block['li']['handler']['argument'][] = $text;
@@ -637,7 +637,7 @@ class Markdown
}
if (! isset($Block['interrupted'])) {
$text = preg_replace('/^[ ]{0,'.$requiredIndent.'}+/', '', $Line['body']);
$text = \preg_replace('/^[ ]{0,'.$requiredIndent.'}+/', '', $Line['body']);
$Block['li']['handler']['argument'][] = $text;
@@ -649,7 +649,7 @@ class Markdown
{
if (isset($Block['loose'])) {
foreach ($Block['element']['elements'] as &$li) {
if (end($li['handler']['argument']) !== '') {
if (\end($li['handler']['argument']) !== '') {
$li['handler']['argument'][] = '';
}
}
@@ -663,7 +663,7 @@ class Markdown
protected function blockQuote($Line)
{
if (preg_match('#^>[ ]?+(.*+)#', $Line['text'], $matches)) {
if (\preg_match('#^>[ ]?+(.*+)#', $Line['text'], $matches)) {
return [
'element' => [
'name' => 'blockquote',
@@ -683,7 +683,7 @@ class Markdown
return;
}
if ($Line['text'][0] === '>' && preg_match('#^>[ ]?+(.*+)#', $Line['text'], $matches)) {
if ($Line['text'][0] === '>' && \preg_match('#^>[ ]?+(.*+)#', $Line['text'], $matches)) {
$Block['element']['handler']['argument'][] = $matches[1];
return $Block;
@@ -703,7 +703,7 @@ class Markdown
{
$marker = $Line['text'][0];
if (substr_count($Line['text'], $marker) >= 3 && rtrim($Line['text'], sprintf(' %s', $marker)) === '') {
if (\substr_count($Line['text'], $marker) >= 3 && \rtrim($Line['text'], \sprintf(' %s', $marker)) === '') {
return [
'element' => [
'name' => 'hr',
@@ -721,7 +721,7 @@ class Markdown
return;
}
if ($Line['indent'] < 4 && rtrim(rtrim($Line['text'], ' '), $Line['text'][0]) === '') {
if ($Line['indent'] < 4 && \rtrim(\rtrim($Line['text'], ' '), $Line['text'][0]) === '') {
$Block['element']['name'] = $Line['text'][0] === '=' ? 'h1' : 'h2';
return $Block;
@@ -737,10 +737,10 @@ class Markdown
return;
}
if (preg_match('/^<[\/]?+(\w*)(?:[ ]*+'.$this->regexHtmlAttribute.')*+[ ]*+(\/)?>/', $Line['text'], $matches)) {
$element = strtolower($matches[1]);
if (\preg_match('/^<[\/]?+(\w*)(?:[ ]*+'.$this->regexHtmlAttribute.')*+[ ]*+(\/)?>/', $Line['text'], $matches)) {
$element = \strtolower($matches[1]);
if (in_array($element, $this->textLevelElements)) {
if (\in_array($element, $this->textLevelElements)) {
return;
}
@@ -770,9 +770,9 @@ class Markdown
protected function blockReference($Line)
{
if (str_contains($Line['text'], ']') && preg_match('#^\[(.+?)\]:[ ]*+<?(\S+?)>?(?:[ ]+["\'(](.+)["\')])?[ ]*+$#', $Line['text'], $matches)
if (\str_contains($Line['text'], ']') && \preg_match('#^\[(.+?)\]:[ ]*+<?(\S+?)>?(?:[ ]+["\'(](.+)["\')])?[ ]*+$#', $Line['text'], $matches)
) {
$id = strtolower($matches[1]);
$id = \strtolower($matches[1]);
$Data = [
'url' => $matches[2],
@@ -797,13 +797,13 @@ class Markdown
}
if (
(! str_contains($Block['element']['handler']['argument'], '|') && ! str_contains($Line['text'], '|') && ! str_contains($Line['text'],
':')) || str_contains($Block['element']['handler']['argument'], "\n")
(! \str_contains($Block['element']['handler']['argument'], '|') && ! \str_contains($Line['text'], '|') && ! \str_contains($Line['text'],
':')) || \str_contains($Block['element']['handler']['argument'], "\n")
) {
return;
}
if (rtrim($Line['text'], ' -:|') !== '') {
if (\rtrim($Line['text'], ' -:|') !== '') {
return;
}
@@ -811,13 +811,13 @@ class Markdown
$divider = $Line['text'];
$divider = trim($divider);
$divider = trim($divider, '|');
$divider = \trim($divider);
$divider = \trim($divider, '|');
$dividerCells = explode('|', $divider);
$dividerCells = \explode('|', $divider);
foreach ($dividerCells as $dividerCell) {
$dividerCell = trim($dividerCell);
$dividerCell = \trim($dividerCell);
if ($dividerCell === '') {
return;
@@ -829,7 +829,7 @@ class Markdown
$alignment = 'left';
}
if (substr($dividerCell, -1) === ':') {
if (\substr($dividerCell, -1) === ':') {
$alignment = $alignment === 'left' ? 'center' : 'right';
}
@@ -842,17 +842,17 @@ class Markdown
$header = $Block['element']['handler']['argument'];
$header = trim($header);
$header = trim($header, '|');
$header = \trim($header);
$header = \trim($header, '|');
$headerCells = explode('|', $header);
$headerCells = \explode('|', $header);
if (count($headerCells) !== count($alignments)) {
if (\count($headerCells) !== \count($alignments)) {
return;
}
foreach ($headerCells as $index => $headerCell) {
$headerCell = trim($headerCell);
$headerCell = \trim($headerCell);
$HeaderElement = [
'name' => 'th',
@@ -867,7 +867,7 @@ class Markdown
$alignment = $alignments[$index];
$HeaderElement['attributes'] = [
'style' => sprintf('text-align: %s;', $alignment),
'style' => \sprintf('text-align: %s;', $alignment),
];
}
@@ -908,20 +908,20 @@ class Markdown
return;
}
if (count($Block['alignments']) === 1 || $Line['text'][0] === '|' || strpos($Line['text'], '|')) {
if (\count($Block['alignments']) === 1 || $Line['text'][0] === '|' || \strpos($Line['text'], '|')) {
$Elements = [];
$row = $Line['text'];
$row = trim($row);
$row = trim($row, '|');
$row = \trim($row);
$row = \trim($row, '|');
preg_match_all('#(?:(\\\[|])|[^|`]|`[^`]++`|`)++#', $row, $matches);
\preg_match_all('#(?:(\\\[|])|[^|`]|`[^`]++`|`)++#', $row, $matches);
$cells = array_slice($matches[0], 0, count($Block['alignments']));
$cells = \array_slice($matches[0], 0, \count($Block['alignments']));
foreach ($cells as $index => $cell) {
$cell = trim($cell);
$cell = \trim($cell);
$Element = [
'name' => 'td',
@@ -1015,21 +1015,21 @@ class Markdown
protected function lineElements($text, $nonNestables = [])
{
// standardize line breaks
$text = str_replace(["\r\n", "\r"], "\n", $text);
$text = \str_replace(["\r\n", "\r"], "\n", $text);
$Elements = [];
$nonNestables = (empty($nonNestables)
? []
: array_combine($nonNestables, $nonNestables)
: \array_combine($nonNestables, $nonNestables)
);
// $excerpt is based on the first occurrence of a marker
while ($excerpt = strpbrk($text, $this->inlineMarkerList)) {
while ($excerpt = \strpbrk($text, $this->inlineMarkerList)) {
$marker = $excerpt[0];
$markerPosition = strlen($text) - strlen($excerpt);
$markerPosition = \strlen($text) - \strlen($excerpt);
$Excerpt = ['text' => $excerpt, 'context' => $text];
@@ -1040,7 +1040,7 @@ class Markdown
continue;
}
$Inline = $this->{sprintf('inline%s', $inlineType)}($Excerpt);
$Inline = $this->{\sprintf('inline%s', $inlineType)}($Excerpt);
if (! isset($Inline)) {
continue;
@@ -1061,11 +1061,11 @@ class Markdown
// cause the new element to 'inherit' our non nestables
$Inline['element']['nonNestables'] = isset($Inline['element']['nonNestables'])
? array_merge($Inline['element']['nonNestables'], $nonNestables)
? \array_merge($Inline['element']['nonNestables'], $nonNestables)
: $nonNestables;
// the text that comes before the inline
$unmarkedText = substr($text, 0, $Inline['position']);
$unmarkedText = \substr($text, 0, $Inline['position']);
// compile the unmarked text
$InlineText = $this->inlineText($unmarkedText);
@@ -1075,19 +1075,19 @@ class Markdown
$Elements[] = $this->extractElement($Inline);
// remove the examined text
$text = substr($text, $Inline['position'] + $Inline['extent']);
$text = \substr($text, $Inline['position'] + $Inline['extent']);
continue 2;
}
// the marker does not belong to an inline
$unmarkedText = substr($text, 0, $markerPosition + 1);
$unmarkedText = \substr($text, 0, $markerPosition + 1);
$InlineText = $this->inlineText($unmarkedText);
$Elements[] = $InlineText['element'];
$text = substr($text, $markerPosition + 1);
$text = \substr($text, $markerPosition + 1);
}
$InlineText = $this->inlineText($text);
@@ -1109,7 +1109,7 @@ class Markdown
protected function inlineText($text)
{
$Inline = [
'extent' => strlen($text),
'extent' => \strlen($text),
'element' => [],
];
@@ -1129,12 +1129,12 @@ class Markdown
{
$marker = $Excerpt['text'][0];
if (preg_match('/^(['.$marker.']++)[ ]*+(.+?)[ ]*+(?<!['.$marker.'])\1(?!'.$marker.')/s', $Excerpt['text'], $matches)) {
if (\preg_match('/^(['.$marker.']++)[ ]*+(.+?)[ ]*+(?<!['.$marker.'])\1(?!'.$marker.')/s', $Excerpt['text'], $matches)) {
$text = $matches[2];
$text = preg_replace('#[ ]*+\n#', ' ', $text);
$text = \preg_replace('#[ ]*+\n#', ' ', $text);
return [
'extent' => strlen($matches[0]),
'extent' => \strlen($matches[0]),
'element' => [
'name' => 'code',
'text' => $text,
@@ -1150,16 +1150,16 @@ class Markdown
$commonMarkEmail = '[a-zA-Z0-9.!#$%&\'*+\/=?^_`{|}~-]++@'
.$hostnameLabel.'(?:\.'.$hostnameLabel.')*';
if (str_contains($Excerpt['text'], '>') && preg_match(sprintf('/^<((mailto:)?%s)>/i', $commonMarkEmail), $Excerpt['text'], $matches)
if (\str_contains($Excerpt['text'], '>') && \preg_match(\sprintf('/^<((mailto:)?%s)>/i', $commonMarkEmail), $Excerpt['text'], $matches)
) {
$url = $matches[1];
if (! isset($matches[2])) {
$url = sprintf('mailto:%s', $url);
$url = \sprintf('mailto:%s', $url);
}
return [
'extent' => strlen($matches[0]),
'extent' => \strlen($matches[0]),
'element' => [
'name' => 'a',
'text' => $matches[1],
@@ -1179,16 +1179,16 @@ class Markdown
$marker = $Excerpt['text'][0];
if ($Excerpt['text'][1] === $marker && preg_match($this->StrongRegex[$marker], $Excerpt['text'], $matches)) {
if ($Excerpt['text'][1] === $marker && \preg_match($this->StrongRegex[$marker], $Excerpt['text'], $matches)) {
$emphasis = 'strong';
} elseif (preg_match($this->EmRegex[$marker], $Excerpt['text'], $matches)) {
} elseif (\preg_match($this->EmRegex[$marker], $Excerpt['text'], $matches)) {
$emphasis = 'em';
} else {
return;
}
return [
'extent' => strlen($matches[0]),
'extent' => \strlen($matches[0]),
'element' => [
'name' => $emphasis,
'handler' => [
@@ -1202,7 +1202,7 @@ class Markdown
protected function inlineEscapeSequence($Excerpt)
{
if (isset($Excerpt['text'][1]) && in_array($Excerpt['text'][1], $this->specialCharacters)) {
if (isset($Excerpt['text'][1]) && \in_array($Excerpt['text'][1], $this->specialCharacters)) {
return [
'element' => ['rawHtml' => $Excerpt['text'][1]],
'extent' => 2,
@@ -1216,7 +1216,7 @@ class Markdown
return;
}
$Excerpt['text'] = substr($Excerpt['text'], 1);
$Excerpt['text'] = \substr($Excerpt['text'], 1);
$Link = $this->inlineLink($Excerpt);
@@ -1263,32 +1263,32 @@ class Markdown
$remainder = $Excerpt['text'];
if (preg_match('#\[((?:[^][]++|(?R))*+)\]#', $remainder, $matches)) {
if (\preg_match('#\[((?:[^][]++|(?R))*+)\]#', $remainder, $matches)) {
$Element['handler']['argument'] = $matches[1];
$extent += strlen($matches[0]);
$extent += \strlen($matches[0]);
$remainder = substr($remainder, $extent);
$remainder = \substr($remainder, $extent);
} else {
return;
}
if (preg_match('#^[(]\s*+((?:[^ ()]++|[(][^ )]+[)])++)(?:[ ]+("[^"]*+"|\'[^\']*+\'))?\s*+[)]#', $remainder, $matches)) {
if (\preg_match('#^[(]\s*+((?:[^ ()]++|[(][^ )]+[)])++)(?:[ ]+("[^"]*+"|\'[^\']*+\'))?\s*+[)]#', $remainder, $matches)) {
$Element['attributes']['href'] = $matches[1];
if (isset($matches[2])) {
$Element['attributes']['title'] = substr($matches[2], 1, -1);
$Element['attributes']['title'] = \substr($matches[2], 1, -1);
}
$extent += strlen($matches[0]);
$extent += \strlen($matches[0]);
} else {
if (preg_match('#^\s*\[(.*?)\]#', $remainder, $matches)) {
if (\preg_match('#^\s*\[(.*?)\]#', $remainder, $matches)) {
$definition = $matches[1] != '' ? $matches[1] : $Element['handler']['argument'];
$definition = strtolower($definition);
$definition = \strtolower($definition);
$extent += strlen($matches[0]);
$extent += \strlen($matches[0]);
} else {
$definition = strtolower($Element['handler']['argument']);
$definition = \strtolower($Element['handler']['argument']);
}
if (! isset($this->DefinitionData['Reference'][$definition])) {
@@ -1309,39 +1309,39 @@ class Markdown
protected function inlineMarkup($Excerpt)
{
if ($this->markupEscaped || $this->safeMode || ! str_contains($Excerpt['text'], '>')) {
if ($this->markupEscaped || $this->safeMode || ! \str_contains($Excerpt['text'], '>')) {
return;
}
if ($Excerpt['text'][1] === '/' && preg_match('#^<\/\w[\w-]*+[ ]*+>#s', $Excerpt['text'], $matches)) {
if ($Excerpt['text'][1] === '/' && \preg_match('#^<\/\w[\w-]*+[ ]*+>#s', $Excerpt['text'], $matches)) {
return [
'element' => ['rawHtml' => $matches[0]],
'extent' => strlen($matches[0]),
'extent' => \strlen($matches[0]),
];
}
if ($Excerpt['text'][1] === '!' && preg_match('#^<!---?[^>-](?:-?+[^-])*-->#s', $Excerpt['text'], $matches)) {
if ($Excerpt['text'][1] === '!' && \preg_match('#^<!---?[^>-](?:-?+[^-])*-->#s', $Excerpt['text'], $matches)) {
return [
'element' => ['rawHtml' => $matches[0]],
'extent' => strlen($matches[0]),
'extent' => \strlen($matches[0]),
];
}
if ($Excerpt['text'][1] !== ' ' && preg_match('/^<\w[\w-]*+(?:[ ]*+'.$this->regexHtmlAttribute.')*+[ ]*+\/?>/s', $Excerpt['text'], $matches)) {
if ($Excerpt['text'][1] !== ' ' && \preg_match('/^<\w[\w-]*+(?:[ ]*+'.$this->regexHtmlAttribute.')*+[ ]*+\/?>/s', $Excerpt['text'], $matches)) {
return [
'element' => ['rawHtml' => $matches[0]],
'extent' => strlen($matches[0]),
'extent' => \strlen($matches[0]),
];
}
}
protected function inlineSpecialCharacter($Excerpt)
{
if (substr($Excerpt['text'], 1, 1) !== ' ' && str_contains($Excerpt['text'], ';') && preg_match('#^&(#?+[0-9a-zA-Z]++);#', $Excerpt['text'], $matches)
if (\substr($Excerpt['text'], 1, 1) !== ' ' && \str_contains($Excerpt['text'], ';') && \preg_match('#^&(#?+[0-9a-zA-Z]++);#', $Excerpt['text'], $matches)
) {
return [
'element' => ['rawHtml' => '&'.$matches[1].';'],
'extent' => strlen($matches[0]),
'extent' => \strlen($matches[0]),
];
}
}
@@ -1352,9 +1352,9 @@ class Markdown
return;
}
if ($Excerpt['text'][1] === '~' && preg_match('#^~~(?=\S)(.+?)(?<=\S)~~#', $Excerpt['text'], $matches)) {
if ($Excerpt['text'][1] === '~' && \preg_match('#^~~(?=\S)(.+?)(?<=\S)~~#', $Excerpt['text'], $matches)) {
return [
'extent' => strlen($matches[0]),
'extent' => \strlen($matches[0]),
'element' => [
'name' => 'del',
'handler' => [
@@ -1373,12 +1373,12 @@ class Markdown
return;
}
if (str_contains($Excerpt['context'], 'http') && preg_match('#\bhttps?+:[\/]{2}[^\s<]+\b\/*+#ui', $Excerpt['context'], $matches, PREG_OFFSET_CAPTURE)
if (\str_contains($Excerpt['context'], 'http') && \preg_match('#\bhttps?+:[\/]{2}[^\s<]+\b\/*+#ui', $Excerpt['context'], $matches, PREG_OFFSET_CAPTURE)
) {
$url = $matches[0][0];
return [
'extent' => strlen($matches[0][0]),
'extent' => \strlen($matches[0][0]),
'position' => $matches[0][1],
'element' => [
'name' => 'a',
@@ -1393,11 +1393,11 @@ class Markdown
protected function inlineUrlTag($Excerpt)
{
if (str_contains($Excerpt['text'], '>') && preg_match('#^<(\w++:\/{2}[^ >]++)>#i', $Excerpt['text'], $matches)) {
if (\str_contains($Excerpt['text'], '>') && \preg_match('#^<(\w++:\/{2}[^ >]++)>#i', $Excerpt['text'], $matches)) {
$url = $matches[1];
return [
'extent' => strlen($matches[0]),
'extent' => \strlen($matches[0]),
'element' => [
'name' => 'a',
'text' => $url,
@@ -1429,7 +1429,7 @@ class Markdown
$Element['nonNestables'] = [];
}
if (is_string($Element['handler'])) {
if (\is_string($Element['handler'])) {
$function = $Element['handler'];
$argument = $Element['text'];
unset($Element['text']);
@@ -1530,7 +1530,7 @@ class Markdown
continue;
}
$markup .= sprintf(' %s="', $name).self::escape($value).'"';
$markup .= \sprintf(' %s="', $name).self::escape($value).'"';
}
}
}
@@ -1601,7 +1601,7 @@ class Markdown
{
$Elements = $this->linesElements($lines);
if (isset($Elements[0], $Elements[0]['name']) && ! in_array('', $lines) && $Elements[0]['name'] === 'p'
if (isset($Elements[0], $Elements[0]['name']) && ! \in_array('', $lines) && $Elements[0]['name'] === 'p'
) {
unset($Elements[0]['name']);
}
@@ -1627,10 +1627,10 @@ class Markdown
{
$newElements = [];
while (preg_match($regexp, $text, $matches, PREG_OFFSET_CAPTURE)) {
while (\preg_match($regexp, $text, $matches, PREG_OFFSET_CAPTURE)) {
$offset = $matches[0][1];
$before = substr($text, 0, $offset);
$after = substr($text, $offset + strlen($matches[0][0]));
$before = \substr($text, 0, $offset);
$after = \substr($text, $offset + \strlen($matches[0][0]));
$newElements[] = ['text' => $before];
@@ -1674,9 +1674,9 @@ class Markdown
}
if (! empty($Element['attributes'])) {
foreach (array_keys($Element['attributes']) as $att) {
foreach (\array_keys($Element['attributes']) as $att) {
// filter out badly parsed attribute
if (! preg_match($goodAttribute, $att)) {
if (! \preg_match($goodAttribute, $att)) {
unset($Element['attributes'][$att]);
}
// dump onevent attribute
@@ -1697,7 +1697,7 @@ class Markdown
}
}
$Element['attributes'][$attribute] = str_replace(':', '%3A', $Element['attributes'][$attribute]);
$Element['attributes'][$attribute] = \str_replace(':', '%3A', $Element['attributes'][$attribute]);
return $Element;
}
@@ -1708,18 +1708,18 @@ class Markdown
protected static function escape($text, $allowQuotes = false)
{
return htmlspecialchars($text, $allowQuotes ? ENT_NOQUOTES : ENT_QUOTES, 'UTF-8');
return \htmlspecialchars($text, $allowQuotes ? ENT_NOQUOTES : ENT_QUOTES, 'UTF-8');
}
protected static function striAtStart($string, $needle)
{
$len = strlen($needle);
$len = \strlen($needle);
if ($len > strlen($string)) {
if ($len > \strlen($string)) {
return false;
}
return stripos($string, strtolower($needle)) === 0;
return \stripos($string, \strtolower($needle)) === 0;
}
public static function instance($name = 'default')
+47 -47
View File
@@ -25,10 +25,10 @@ class MarkdownExtra extends Markdown
$this->BlockTypes['*'][] = 'Abbreviation';
// identify footnote definitions before reference definitions
array_unshift($this->BlockTypes['['], 'Footnote');
\array_unshift($this->BlockTypes['['], 'Footnote');
// identify footnote markers before before links
array_unshift($this->InlineTypes['['], 'FootnoteMarker');
\array_unshift($this->InlineTypes['['], 'FootnoteMarker');
}
public function text($text)
@@ -39,11 +39,11 @@ class MarkdownExtra extends Markdown
$markup = $this->elements($Elements);
// trim line breaks
$markup = trim($markup, "\n");
$markup = \trim($markup, "\n");
// merge consecutive dl elements
$markup = preg_replace('#<\/dl>\s+<dl>\s+#', '', $markup);
$markup = \preg_replace('#<\/dl>\s+<dl>\s+#', '', $markup);
// add footnotes
@@ -65,7 +65,7 @@ class MarkdownExtra extends Markdown
protected function blockAbbreviation($Line)
{
if (preg_match('#^\*\[(.+?)\]:[ ]*(.+?)[ ]*$#', $Line['text'], $matches)) {
if (\preg_match('#^\*\[(.+?)\]:[ ]*(.+?)[ ]*$#', $Line['text'], $matches)) {
$this->DefinitionData['Abbreviation'][$matches[1]] = $matches[2];
return [
@@ -79,7 +79,7 @@ class MarkdownExtra extends Markdown
protected function blockFootnote($Line)
{
if (preg_match('#^\[\^(.+?)\]:[ ]?(.*)$#', $Line['text'], $matches)) {
if (\preg_match('#^\[\^(.+?)\]:[ ]?(.*)$#', $Line['text'], $matches)) {
return [
'label' => $matches[1],
'text' => $matches[2],
@@ -90,7 +90,7 @@ class MarkdownExtra extends Markdown
protected function blockFootnoteContinue($Line, $Block)
{
if ($Line['text'][0] === '[' && preg_match('#^\[\^(.+?)\]:#', $Line['text'])) {
if ($Line['text'][0] === '[' && \preg_match('#^\[\^(.+?)\]:#', $Line['text'])) {
return;
}
@@ -132,7 +132,7 @@ class MarkdownExtra extends Markdown
'elements' => [],
];
$terms = explode("\n", $Block['element']['handler']['argument']);
$terms = \explode("\n", $Block['element']['handler']['argument']);
foreach ($terms as $term) {
$Element['elements'][] = [
@@ -169,7 +169,7 @@ class MarkdownExtra extends Markdown
unset($Block['interrupted']);
}
$text = substr($Line['body'], min($Line['indent'], 4));
$text = \substr($Line['body'], \min($Line['indent'], 4));
$Block['dd']['handler']['argument'] .= "\n".$text;
@@ -183,12 +183,12 @@ class MarkdownExtra extends Markdown
{
$Block = parent::blockHeader($Line);
if ($Block !== null && preg_match('/[ #]*{('.$this->regexAttribute.'+)}[ ]*$/', $Block['element']['handler']['argument'], $matches, PREG_OFFSET_CAPTURE)) {
if ($Block !== null && \preg_match('/[ #]*{('.$this->regexAttribute.'+)}[ ]*$/', $Block['element']['handler']['argument'], $matches, PREG_OFFSET_CAPTURE)) {
$attributeString = $matches[1][0];
$Block['element']['attributes'] = $this->parseAttributeData($attributeString);
$Block['element']['handler']['argument'] = substr($Block['element']['handler']['argument'], 0, $matches[0][1]);
$Block['element']['handler']['argument'] = \substr($Block['element']['handler']['argument'], 0, $matches[0][1]);
}
return $Block;
@@ -203,10 +203,10 @@ class MarkdownExtra extends Markdown
return;
}
if (preg_match('/^<(\w[\w-]*)(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*(\/)?>/', $Line['text'], $matches)) {
$element = strtolower($matches[1]);
if (\preg_match('/^<(\w[\w-]*)(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*(\/)?>/', $Line['text'], $matches)) {
$element = \strtolower($matches[1]);
if (in_array($element, $this->textLevelElements)) {
if (\in_array($element, $this->textLevelElements)) {
return;
}
@@ -219,19 +219,19 @@ class MarkdownExtra extends Markdown
],
];
$length = strlen($matches[0]);
$remainder = substr($Line['text'], $length);
$length = \strlen($matches[0]);
$remainder = \substr($Line['text'], $length);
if (trim($remainder) === '') {
if (isset($matches[2]) || in_array($matches[1], $this->voidElements)) {
if (\trim($remainder) === '') {
if (isset($matches[2]) || \in_array($matches[1], $this->voidElements)) {
$Block['closed'] = true;
$Block['void'] = true;
}
} else {
if (isset($matches[2]) || in_array($matches[1], $this->voidElements)) {
if (isset($matches[2]) || \in_array($matches[1], $this->voidElements)) {
return;
}
if (preg_match('/<\/'.$matches[1].'>[ ]*$/i', $remainder)) {
if (\preg_match('/<\/'.$matches[1].'>[ ]*$/i', $remainder)) {
$Block['closed'] = true;
}
}
@@ -246,11 +246,11 @@ class MarkdownExtra extends Markdown
return;
}
if (preg_match('/^<'.$Block['name'].'(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*>/i', $Line['text'])) { // open
if (\preg_match('/^<'.$Block['name'].'(?:[ ]*'.$this->regexHtmlAttribute.')*[ ]*>/i', $Line['text'])) { // open
$Block['depth']++;
}
if (preg_match('/(.*?)<\/'.$Block['name'].'>[ ]*$/i', $Line['text'], $matches)) { // close
if (\preg_match('/(.*?)<\/'.$Block['name'].'>[ ]*$/i', $Line['text'], $matches)) { // close
if ($Block['depth'] > 0) {
$Block['depth']--;
} else {
@@ -284,12 +284,12 @@ class MarkdownExtra extends Markdown
{
$Block = parent::blockSetextHeader($Line, $Block);
if ($Block !== null && preg_match('/[ ]*{('.$this->regexAttribute.'+)}[ ]*$/', $Block['element']['handler']['argument'], $matches, PREG_OFFSET_CAPTURE)) {
if ($Block !== null && \preg_match('/[ ]*{('.$this->regexAttribute.'+)}[ ]*$/', $Block['element']['handler']['argument'], $matches, PREG_OFFSET_CAPTURE)) {
$attributeString = $matches[1][0];
$Block['element']['attributes'] = $this->parseAttributeData($attributeString);
$Block['element']['handler']['argument'] = substr($Block['element']['handler']['argument'], 0, $matches[0][1]);
$Block['element']['handler']['argument'] = \substr($Block['element']['handler']['argument'], 0, $matches[0][1]);
}
return $Block;
@@ -304,7 +304,7 @@ class MarkdownExtra extends Markdown
protected function inlineFootnoteMarker($Excerpt)
{
if (preg_match('#^\[\^(.+?)\]#', $Excerpt['text'], $matches)) {
if (\preg_match('#^\[\^(.+?)\]#', $Excerpt['text'], $matches)) {
$name = $matches[1];
if (! isset($this->DefinitionData['Footnote'][$name])) {
@@ -328,7 +328,7 @@ class MarkdownExtra extends Markdown
];
return [
'extent' => strlen($matches[0]),
'extent' => \strlen($matches[0]),
'element' => $Element,
];
}
@@ -343,12 +343,12 @@ class MarkdownExtra extends Markdown
{
$Link = parent::inlineLink($Excerpt);
$remainder = $Link !== null ? substr($Excerpt['text'], $Link['extent']) : '';
$remainder = $Link !== null ? \substr($Excerpt['text'], $Link['extent']) : '';
if (preg_match('/^[ ]*{('.$this->regexAttribute.'+)}/', $remainder, $matches)) {
if (\preg_match('/^[ ]*{('.$this->regexAttribute.'+)}/', $remainder, $matches)) {
$Link['element']['attributes'] += $this->parseAttributeData($matches[1]);
$Link['extent'] += strlen($matches[0]);
$Link['extent'] += \strlen($matches[0]);
}
return $Link;
@@ -365,7 +365,7 @@ class MarkdownExtra extends Markdown
{
if (isset($Element['text'])) {
$Element['elements'] = self::pregReplaceElements(
'/\b'.preg_quote($this->currentAbreviation, '/').'\b/',
'/\b'.\preg_quote($this->currentAbreviation, '/').'\b/',
[
[
'name' => 'abbr',
@@ -411,8 +411,8 @@ class MarkdownExtra extends Markdown
protected function addDdElement(array $Line, array $Block)
{
$text = substr($Line['text'], 1);
$text = trim($text);
$text = \substr($Line['text'], 1);
$text = \trim($text);
unset($Block['dd']);
@@ -450,7 +450,7 @@ class MarkdownExtra extends Markdown
],
];
uasort($this->DefinitionData['Footnote'], 'self::sortFootnotes');
\uasort($this->DefinitionData['Footnote'], 'self::sortFootnotes');
foreach ($this->DefinitionData['Footnote'] as $definitionId => $DefinitionData) {
if (! isset($DefinitionData['number'])) {
@@ -461,7 +461,7 @@ class MarkdownExtra extends Markdown
$textElements = $this->textElements($text);
$numbers = range(1, $DefinitionData['count']);
$numbers = \range(1, $DefinitionData['count']);
$backLinkElements = [];
@@ -470,7 +470,7 @@ class MarkdownExtra extends Markdown
$backLinkElements[] = [
'name' => 'a',
'attributes' => [
'href' => sprintf('#fnref%s:%s', $number, $definitionId),
'href' => \sprintf('#fnref%s:%s', $number, $definitionId),
'rev' => 'footnote',
'class' => 'footnote-backref',
],
@@ -482,10 +482,10 @@ class MarkdownExtra extends Markdown
unset($backLinkElements[0]);
$n = count($textElements) - 1;
$n = \count($textElements) - 1;
if ($textElements[$n]['name'] === 'p') {
$backLinkElements = array_merge(
$backLinkElements = \array_merge(
[
[
'rawHtml' => '&#160;',
@@ -499,7 +499,7 @@ class MarkdownExtra extends Markdown
$textElements[$n] = [
'name' => 'p',
'elements' => array_merge(
'elements' => \array_merge(
[$textElements[$n]],
$backLinkElements
),
@@ -514,7 +514,7 @@ class MarkdownExtra extends Markdown
$Element['elements'][1]['elements'][] = [
'name' => 'li',
'attributes' => ['id' => 'fn:'.$definitionId],
'elements' => array_merge(
'elements' => \array_merge(
$textElements
),
];
@@ -529,18 +529,18 @@ class MarkdownExtra extends Markdown
{
$Data = [];
$attributes = preg_split('#[ ]+#', $attributeString, -1, PREG_SPLIT_NO_EMPTY);
$attributes = \preg_split('#[ ]+#', $attributeString, -1, PREG_SPLIT_NO_EMPTY);
foreach ($attributes as $attribute) {
if ($attribute[0] === '#') {
$Data['id'] = substr($attribute, 1);
$Data['id'] = \substr($attribute, 1);
} else { // "."
$classes[] = substr($attribute, 1);
$classes[] = \substr($attribute, 1);
}
}
if (isset($classes)) {
$Data['class'] = implode(' ', $classes);
$Data['class'] = \implode(' ', $classes);
}
return $Data;
@@ -551,12 +551,12 @@ class MarkdownExtra extends Markdown
protected function processTag($elementMarkup) // recursive
{
// http://stackoverflow.com/q/1148928/200145
libxml_use_internal_errors(true);
\libxml_use_internal_errors(true);
$DOMDocument = new DOMDocument();
// http://stackoverflow.com/q/11309194/200145
$elementMarkup = mb_convert_encoding($elementMarkup, 'HTML-ENTITIES', 'UTF-8');
$elementMarkup = \mb_convert_encoding($elementMarkup, 'HTML-ENTITIES', 'UTF-8');
// http://stackoverflow.com/q/4879946/200145
$DOMDocument->loadHTML($elementMarkup);
@@ -577,7 +577,7 @@ class MarkdownExtra extends Markdown
foreach ($DOMDocument->documentElement->childNodes as $Node) {
$nodeMarkup = $DOMDocument->saveHTML($Node);
if ($Node instanceof DOMElement && ! in_array($Node->nodeName, $this->textLevelElements)) {
if ($Node instanceof DOMElement && ! \in_array($Node->nodeName, $this->textLevelElements)) {
$elementText .= $this->processTag($nodeMarkup);
} else {
$elementText .= $nodeMarkup;
@@ -590,7 +590,7 @@ class MarkdownExtra extends Markdown
$markup = $DOMDocument->saveHTML($DOMDocument->documentElement);
return str_replace('placeholder\x1A', $elementText, $markup);
return \str_replace('placeholder\x1A', $elementText, $markup);
}
// ~
+5 -5
View File
@@ -26,9 +26,9 @@ class Nfo
{
$cf = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 8962, 199, 252, 233, 226, 228, 224, 229, 231, 234, 235, 232, 239, 238, 236, 196, 197, 201, 230, 198, 244, 246, 242, 251, 249, 255, 214, 220, 162, 163, 165, 8359, 402, 225, 237, 243, 250, 241, 209, 170, 186, 191, 8976, 172, 189, 188, 161, 171, 187, 9617, 9618, 9619, 9474, 9508, 9569, 9570, 9558, 9557, 9571, 9553, 9559, 9565, 9564, 9563, 9488, 9492, 9524, 9516, 9500, 9472, 9532, 9566, 9567, 9562, 9556, 9577, 9574, 9568, 9552, 9580, 9575, 9576, 9572, 9573, 9561, 9560, 9554, 9555, 9579, 9578, 9496, 9484, 9608, 9604, 9612, 9616, 9600, 945, 223, 915, 960, 931, 963, 181, 964, 934, 920, 937, 948, 8734, 966, 949, 8745, 8801, 177, 8805, 8804, 8992, 8993, 247, 8776, 176, 8729, 183, 8730, 8319, 178, 9632, 160];
$s = '';
for ($c = 0, $cMax = strlen($nfo); $c < $cMax; $c++) { // cyctle through the whole file doing a byte at a time.
for ($c = 0, $cMax = \strlen($nfo); $c < $cMax; $c++) { // cyctle through the whole file doing a byte at a time.
$byte = $nfo[$c];
$ob = ord($byte);
$ob = \ord($byte);
if ($ob >= 127) { // is it in the normal ascii range
$s .= '&#'.$cf[$ob].';';
} else {
@@ -36,17 +36,17 @@ class Nfo
}
}
$s = str_replace( // Code windows to dos
$s = \str_replace( // Code windows to dos
["\345", "\344", "\366", "\311", "\351"], // ['å','ä','ö','É','é']
["\206", "\204", "\224", "\220", "\202"], // ['†','„','”','','‚']
$s);
$s = preg_replace(
$s = \preg_replace(
["/([ -~])\305([ -~])/", "/([ -~])\304([ -~])/", "/([ -~])\326([ -~])/"],
["\\1\217\\2", "\\1\216\\2", "\\1\231\\2"],
$s
);
return mb_convert_encoding($s, 'UTF-8', 'ASCII');
return \mb_convert_encoding($s, 'UTF-8', 'ASCII');
}
}
+1 -1
View File
@@ -166,7 +166,7 @@ class AnnounceController extends Controller
}
// Block Blacklisted Clients
if (in_array($request->header('User-Agent'), config('client-blacklist.clients'))) {
if (\in_array($request->header('User-Agent'), \config('client-blacklist.clients'))) {
throw new TrackerException(128, [':ua' => $request->header('User-Agent')]);
}
}
+5 -5
View File
@@ -121,7 +121,7 @@ class CommentController extends Controller
$comment
);
} else {
$sender = $comment->anon ? 'Anonymous' : $user->username;
$sender = $comment->anon !== 0 ? 'Anonymous' : $user->username;
$this->taggedUserRepository->messageTaggedCommentUsers(
'collection',
$request->input('content'),
@@ -213,7 +213,7 @@ class CommentController extends Controller
$comment
);
} else {
$sender = $comment->anon ? 'Anonymous' : $user->username;
$sender = $comment->anon !== 0 ? 'Anonymous' : $user->username;
$this->taggedUserRepository->messageTaggedCommentUsers(
'article',
$request->input('content'),
@@ -304,7 +304,7 @@ class CommentController extends Controller
$comment
);
} else {
$sender = $comment->anon ? 'Anonymous' : $user->username;
$sender = $comment->anon !== 0 ? 'Anonymous' : $user->username;
$this->taggedUserRepository->messageTaggedCommentUsers(
'playlist',
$request->input('content'),
@@ -399,7 +399,7 @@ class CommentController extends Controller
$comment
);
} else {
$sender = $comment->anon ? 'Anonymous' : $user->username;
$sender = $comment->anon !== 0 ? 'Anonymous' : $user->username;
$this->taggedUserRepository->messageTaggedCommentUsers(
'torrent',
$request->input('content'),
@@ -494,7 +494,7 @@ class CommentController extends Controller
$comment
);
} else {
$sender = $comment->anon ? 'Anonymous' : $user->username;
$sender = $comment->anon !== 0 ? 'Anonymous' : $user->username;
$this->taggedUserRepository->messageTaggedCommentUsers(
'request',
$request->input('content'),
+1 -1
View File
@@ -46,7 +46,7 @@ class ContactController extends Controller
$user = User::where('username', \config('unit3d.owner-username'))->first();
$input = $request->all();
Mail::to($user->email, $user->username)->send(new Contact($input));
Mail::to($user->email)->send(new Contact($input));
return \redirect()->route('home.index')
->withSuccess('Your Message Was Successfully Sent');
+2 -2
View File
@@ -44,7 +44,7 @@ class TicketController extends Controller
$categories = TicketCategory::all()->sortBy('position');
$priorities = TicketPriority::all()->sortBy('position');
return view('ticket.create', [
return \view('ticket.create', [
'categories' => $categories,
'priorities' => $priorities,
]);
@@ -111,7 +111,7 @@ class TicketController extends Controller
$ticket->save();
}
return view('ticket.show', [
return \view('ticket.show', [
'user' => $user,
'ticket' => $ticket,
]);
+1 -1
View File
@@ -54,6 +54,6 @@ class DislikeButton extends Component
final public function render(): \Illuminate\Contracts\View\Factory | \Illuminate\Contracts\View\View | \Illuminate\Contracts\Foundation\Application
{
return view('livewire.dislike-button');
return \view('livewire.dislike-button');
}
}
@@ -34,7 +34,7 @@ class RedirectIfAuthenticated
foreach ($guards as $guard) {
if (\auth()->guard($guard)->check()) {
return redirect(RouteServiceProvider::HOME);
return \redirect(RouteServiceProvider::HOME);
}
}
+1 -1
View File
@@ -38,6 +38,6 @@ class NotifyUserTicketIsStale
public function handle(TicketWentStale $event)
{
$event->ticket->user->notify(new UserTicketStale($event->ticket));
$event->ticket->update(['reminded_at' => time()]);
$event->ticket->update(['reminded_at' => \time()]);
}
}
+3 -3
View File
@@ -152,11 +152,11 @@ class Comment extends Model
*/
public static function checkForStale(Ticket $ticket)
{
if (empty($ticket->reminded_at) || strtotime($ticket->reminded_at) < strtotime('+ 3 days')) {
if (empty($ticket->reminded_at) || \strtotime($ticket->reminded_at) < \strtotime('+ 3 days')) {
$last_comment = $ticket->comments()->orderBy('id', 'desc')->first();
if (isset($last_comment->id) && ! $last_comment->user->is_modo && strtotime($last_comment->created_at) < strtotime('- 3 days')) {
event(new TicketWentStale($last_comment->ticket));
if (\property_exists($last_comment, 'id') && $last_comment->id !== null && ! $last_comment->user->is_modo && \strtotime($last_comment->created_at) < \strtotime('- 3 days')) {
\event(new TicketWentStale($last_comment->ticket));
}
}
}
+1 -1
View File
@@ -33,7 +33,7 @@ class Ticket extends Model
$query->orderBy('id', 'desc');
}, 'comments.user'])
->has('comments')
->where('reminded_at', '<', strtotime('+ 3 days'))
->where('reminded_at', '<', \strtotime('+ 3 days'))
->orWhereNull('reminded_at');
}
+1 -1
View File
@@ -60,7 +60,7 @@ class StaffCommentCreated extends Notification
return (new MailMessage())
->subject('A comment was added (Staff)')
->line('A comment was added')
->action('View Ticket', route('tickets.show', ['id' => $this->comment->ticket->id]));
->action('View Ticket', \route('tickets.show', ['id' => $this->comment->ticket->id]));
}
/**
+1 -1
View File
@@ -60,7 +60,7 @@ class StaffTicketAssigned extends Notification
return (new MailMessage())
->subject('A ticket was assigned (Ticket # '.$this->ticket->id.')')
->line('A ticket was assigned to '.$this->ticket->staff->username)
->action('View Ticket', route('tickets.show', ['id' => $this->ticket->id]));
->action('View Ticket', \route('tickets.show', ['id' => $this->ticket->id]));
}
/**
+1 -1
View File
@@ -60,7 +60,7 @@ class StaffTicketClosed extends Notification
return (new MailMessage())
->subject('A ticket was closed (Staff)')
->line('A ticket was closed')
->action('View Ticket', route('tickets.show', ['id' => $this->ticket->id]));
->action('View Ticket', \route('tickets.show', ['id' => $this->ticket->id]));
}
/**
+1 -1
View File
@@ -60,7 +60,7 @@ class StaffTicketCreated extends Notification
return (new MailMessage())
->subject('A ticket was created (Ticket # '.$this->ticket->id.')')
->line('A ticket was created.')
->action('View Ticket', route('tickets.show', ['id' => $this->ticket->id]));
->action('View Ticket', \route('tickets.show', ['id' => $this->ticket->id]));
}
/**
+1 -1
View File
@@ -60,7 +60,7 @@ class UserCommentCreated extends Notification
return (new MailMessage())
->subject('A comment was added (User)')
->line('A comment was added')
->action('View Ticket', route('tickets.show', ['id' => $this->comment->ticket->id]));
->action('View Ticket', \route('tickets.show', ['id' => $this->comment->ticket->id]));
}
/**
+1 -1
View File
@@ -60,7 +60,7 @@ class UserTicketAssigned extends Notification
return (new MailMessage())
->subject('Your ticket was assigned (Ticket # '.$this->ticket->id.')')
->line('Your ticket was assigned to '.$this->ticket->user->username)
->action('View Ticket', route('tickets.show', ['id' => $this->ticket->id]));
->action('View Ticket', \route('tickets.show', ['id' => $this->ticket->id]));
}
/**
+1 -1
View File
@@ -60,7 +60,7 @@ class UserTicketClosed extends Notification
return (new MailMessage())
->subject('Your ticket was closed (User)')
->line('Your ticket was closed')
->action('View Ticket', route('tickets.show', ['id' => $this->ticket->id]));
->action('View Ticket', \route('tickets.show', ['id' => $this->ticket->id]));
}
/**
+1 -1
View File
@@ -60,7 +60,7 @@ class UserTicketCreated extends Notification
return (new MailMessage())
->subject('Your ticket was created (Ticket # '.$this->ticket->id.')')
->line('Your ticket was created.')
->action('View Ticket', route('tickets.show', ['id' => $this->ticket->id]));
->action('View Ticket', \route('tickets.show', ['id' => $this->ticket->id]));
}
/**
+1 -1
View File
@@ -61,7 +61,7 @@ class UserTicketStale extends Notification
->cc($this->ticket->staff->email)
->subject('Your ticket is still open')
->line('This is a reminder that your ticket is still open')
->action('View Ticket', route('tickets.show', ['id' => $this->ticket->id]));
->action('View Ticket', \route('tickets.show', ['id' => $this->ticket->id]));
}
/**
+1 -1
View File
@@ -73,7 +73,7 @@ class RouteServiceProvider extends ServiceProvider
protected function configureRateLimiting()
{
RateLimiter::for('api', function (Request $request) {
return Limit::perMinute(60)->by(optional($request->user())->id ?: $request->ip());
return Limit::perMinute(60)->by(\optional($request->user())->id ?: $request->ip());
});
}
}