/** * Gets theme settings from following places: * - theme designer ($wgOasisThemeSettings) * - theme chosen using usetheme URL param */ public static function getOasisSettings() { wfProfileIn(__METHOD__); // Load the 5 deafult colors by theme here (eg: in case the wiki has an override but the user doesn't have overrides). static $oasisSettings = array(); if (empty($oasisSettings)) { $themeSettings = new ThemeSettings(); $settings = $themeSettings->getSettings(); $oasisSettings['color-body'] = self::sanitizeColor($settings['color-body']); $oasisSettings['color-body-middle'] = self::sanitizeColor($settings['color-body-middle']); $oasisSettings['color-page'] = self::sanitizeColor($settings['color-page']); $oasisSettings['color-buttons'] = self::sanitizeColor($settings['color-buttons']); $oasisSettings['color-links'] = self::sanitizeColor($settings['color-links']); $oasisSettings['color-header'] = self::sanitizeColor($settings['color-header']); $oasisSettings["background-image"] = $themeSettings->getBackgroundUrl(); // sending width and height of background image to SASS if (!empty($settings['background-image-width']) && !empty($settings['background-image-height'])) { // strip 'px' from previously cached settings since we removed 'px' (sanity check) $oasisSettings['background-image-width'] = str_replace('px', '', $settings['background-image-width']); $oasisSettings['background-image-height'] = str_replace('px', '', $settings['background-image-height']); } else { // if not cached in theme settings $bgImage = wfFindFile(ThemeSettings::BackgroundImageName); if (!empty($bgImage)) { $settings['background-image-width'] = $oasisSettings['background-image-width'] = $bgImage->getWidth(); $settings['background-image-height'] = $oasisSettings['background-image-height'] = $bgImage->getHeight(); $themeSettings->saveSettings($settings); } } $oasisSettings['background-dynamic'] = $settings['background-dynamic']; $oasisSettings['page-opacity'] = $settings['page-opacity']; if (!empty($settings['wordmark-font']) && $settings['wordmark-font'] != 'default') { $oasisSettings['wordmark-font'] = $settings['wordmark-font']; } // RTL if (self::isRTL()) { $oasisSettings['rtl'] = 'true'; } wfRunHooks('AfterOasisSettingsInitialized', [&$oasisSettings]); // RT:70673 foreach ($oasisSettings as $key => $val) { if (!empty($val)) { $oasisSettings[$key] = trim($val); } } } wfDebug(__METHOD__ . ': ' . json_encode($oasisSettings) . "\n"); wfProfileOut(__METHOD__); return $oasisSettings; }