protected function getHead() { $monospaced = null; $request = $this->getRequest(); if ($request) { $user = $request->getUser(); if ($user) { $monospaced = $user->getUserSetting(PhabricatorMonospacedFontSetting::SETTINGKEY); } } $response = CelerityAPI::getStaticResourceResponse(); $font_css = null; if (!empty($monospaced)) { // We can't print this normally because escaping quotation marks will // break the CSS. Instead, filter it strictly and then mark it as safe. $monospaced = new PhutilSafeHTML(PhabricatorMonospacedFontSetting::filterMonospacedCSSRule($monospaced)); $font_css = hsprintf('<style type="text/css">' . '.PhabricatorMonospaced, ' . '.phabricator-remarkup .remarkup-code-block ' . '.remarkup-code { font: %s !important; } ' . '</style>', $monospaced); } return hsprintf('%s%s%s', parent::getHead(), $font_css, $response->renderSingleResource('javelin-magical-init', 'phabricator')); }
protected function getHead() { $monospaced = PhabricatorEnv::getEnvConfig('style.monospace'); $monospaced_win = PhabricatorEnv::getEnvConfig('style.monospace.windows'); $request = $this->getRequest(); if ($request) { $user = $request->getUser(); if ($user) { $pref = $user->loadPreferences()->getPreference(PhabricatorUserPreferences::PREFERENCE_MONOSPACED); $monospaced = nonempty($pref, $monospaced); $monospaced_win = nonempty($pref, $monospaced_win); } } $response = CelerityAPI::getStaticResourceResponse(); return hsprintf('%s<style type="text/css">' . '.PhabricatorMonospaced, ' . '.phabricator-remarkup .remarkup-code-block { font: %s; } ' . '.platform-windows .PhabricatorMonospaced, ' . '.platform-windows .phabricator-remarkup ' . '.remarkup-code-block { font: %s; }' . '</style>%s', parent::getHead(), phutil_safe_html($monospaced), phutil_safe_html($monospaced_win), $response->renderSingleResource('javelin-magical-init', 'phabricator')); }