['filter' => FILTER_CALLBACK, 'options' => [Locale::class, 'tryFromDomain']] ); public function __construct(private string $rawParam) { parent::__construct($rawParam); if (!Cfg::get('PROFILER_ENABLE')) $this->generate404(); // temp locale if ($this->_get['domain']) Lang::load($this->_get['domain']); $this->getSubjectFromUrl($rawParam); if ($this->subjectName) // rawParam is fully defined profiler string { // pending rename if (preg_match('/([^\-]+)-(\d+)/i', $this->subjectName, $m)) [, $this->subjectName, $renameItr] = $m; if ($x = DB::Aowow()->selectCell('SELECT `id` FROM ::profiler_profiles WHERE `realm` = %i AND `custom` = 0 AND `name` = %s AND `renameItr` = %i', $this->realmId, Util::ucWords($this->subjectName), $renameItr ?? 0)) $this->typeId = $x; } if (!$this->typeId) $this->generate404(); } protected function generate() : void { $profile = new LocalProfileList(array(['id', $this->typeId])); if ($profile->error || !$profile->isVisibleToUser()) $this->cacheType = CACHE_TYPE_NONE; else { $n = $profile->getField('name'); $r = $profile->getField('race'); $c = $profile->getField('class'); $g = $profile->getField('gender'); $l = $profile->getField('level'); if (!$this->subjectName) // implicit isCustom $n .= Lang::profiler('customProfile'); else if ($_ = $profile->getField('title')) if ($title = (new TitleList(array(['id', $_])))?->getField($g ? 'female' : 'male', true)) $n = sprintf($title, $n); $opts = array( 'name' => $n, 'tooltip' => $profile->renderTooltip(), 'icon' => '$$WH.g_getProfileIcon('.$r.', '.$c.', '.$g.', '.$l.', \''.$profile->getIcon().'\')' ); } if ($_ = $profile->getField('renameItr')) $ri = '-'.$_; // the 'id' must be exactly as the js requested it or the tooltip won't register if ($this->subjectName) $id = urlencode($this->rawParam) . ($ri ?? ''); else $id = $this->typeId; $this->result = new Tooltip(self::POWER_TEMPLATE, $id, $opts ?? []); } } ?>