mirror of
https://github.com/Sarjuuk/aowow.git
synced 2025-11-29 15:58:16 +08:00
Guides/Fixups
* fix urls in user menu * strip anchors from tooltip title * prevent line breaks in description * make only in english info popup modular
This commit is contained in:
@@ -44,7 +44,7 @@ class GuidePage extends GenericPage
|
||||
'submit' => ['filter' => FILTER_CALLBACK, 'options' => 'GenericPage::checkEmptySet'],
|
||||
'title' => ['filter' => FILTER_CALLBACK, 'options' => 'GenericPage::checkTextLine'],
|
||||
'name' => ['filter' => FILTER_CALLBACK, 'options' => 'GenericPage::checkTextLine'],
|
||||
'description' => ['filter' => FILTER_CALLBACK, 'options' => 'GenericPage::checkTextBlob'],
|
||||
'description' => ['filter' => FILTER_CALLBACK, 'options' => 'GuidePage::checkDescription'],
|
||||
'changelog' => ['filter' => FILTER_CALLBACK, 'options' => 'GenericPage::checkTextBlob'],
|
||||
'body' => ['filter' => FILTER_CALLBACK, 'options' => 'GenericPage::checkTextBlob'],
|
||||
'locale' => ['filter' => FILTER_CALLBACK, 'options' => 'GenericPage::checkInt'],
|
||||
@@ -521,7 +521,7 @@ class GuidePage extends GenericPage
|
||||
$power = new StdClass();
|
||||
if (!$this->subject->error)
|
||||
{
|
||||
$power->{'name_'.User::$localeString} = $this->name;
|
||||
$power->{'name_'.User::$localeString} = strip_tags($this->name);
|
||||
$power->{'tooltip_'.User::$localeString} = $this->subject->renderTooltip();
|
||||
}
|
||||
|
||||
@@ -550,6 +550,16 @@ class GuidePage extends GenericPage
|
||||
if ($this->subject?->getField('status') == GUIDE_STATUS_APPROVED)
|
||||
DB::Aowow()->query('UPDATE ?_guides SET `views` = `views` + 1 WHERE `id` = ?d', $this->typeId);
|
||||
}
|
||||
|
||||
protected static function checkDescription(string $str) : string
|
||||
{
|
||||
// run checkTextBlob and also replace \n => \s and \s+ => \s
|
||||
$str = preg_replace(parent::$PATTERN_TEXT_BLOB, '', $str);
|
||||
|
||||
$str = strtr($str, ["\n" => ' ', "\r" => ' ']);
|
||||
|
||||
return preg_replace('/\s+/', ' ', trim($str));
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
Reference in New Issue
Block a user