/** * @see wcf\page\IPage::readParameters() */ public function readParameters() { parent::readParameters(); I18nHandler::getInstance()->register('title'); I18nHandler::getInstance()->register('subTitle'); I18nHandler::getInstance()->register('description'); // get available styles $this->availableStyles = StyleHandler::getInstance()->getStyles(); $this->objectTypeID = ACLHandler::getInstance()->getObjectTypeID('info.codingcorner.ict.project'); }
/** * @see \wcf\page\IPage::readParameters() */ public function readParameters() { parent::readParameters(); if (isset($_REQUEST['parentID'])) { $this->parentID = intval($_REQUEST['parentID']); } $this->objectTypeID = ACLHandler::getInstance()->getObjectTypeID('de.codequake.cms.page'); // register i18n-values I18nHandler::getInstance()->register('title'); I18nHandler::getInstance()->register('description'); I18nHandler::getInstance()->register('metaDescription'); I18nHandler::getInstance()->register('metaKeywords'); // get available styles $this->availableStyles = StyleHandler::getInstance()->getStyles(); }
/** * Changes user style. * * @return array<string> */ public function changeStyle() { StyleHandler::getInstance()->changeStyle($this->style->styleID); if (StyleHandler::getInstance()->getStyle()->styleID == $this->style->styleID) { WCF::getSession()->setStyleID($this->style->styleID); } }
/** * Returns style handler. * * @return \wcf\system\style\StyleHandler */ public function getStyleHandler() { return StyleHandler::getInstance(); }
/** * @see \wcf\page\AbstractPage::readParameters() */ public function readParameters() { parent::readParameters(); if (!empty($_REQUEST['category'])) { $this->category = $_REQUEST['category']; // validate category if (UserOptionCategory::getCategoryByName('settings.' . $this->category) === null) { throw new IllegalLinkException(); } } $this->optionHandler = new UserOptionHandler(false, '', 'settings.' . $this->category); $this->optionHandler->setUser(WCF::getUser()); if ($this->category == 'general') { $this->availableContentLanguages = LanguageFactory::getInstance()->getContentLanguages(); $this->availableLanguages = LanguageFactory::getInstance()->getLanguages(); $this->availableStyles = StyleHandler::getInstance()->getAvailableStyles(); } }
/** * Compiles LESS stylesheets. * * @param \cms\data\stylesheet\Stylesheet $stylesheet * @param integer $styleID */ public function compile(Stylesheet $stylesheet, $styleID = null) { $styles = StyleHandler::getInstance()->getStyles(); // compile stylesheet for all installed styles if ($styleID === null) { foreach ($styles as $style) { $this->compile($stylesheet, $style->styleID); } return; } $style = $styles[$styleID]; // get style variables $variables = $style->getVariables(); if (isset($variables['individualLess'])) { unset($variables['individualLess']); } // add style image path $imagePath = '../images/'; if ($style->imagePath) { $imagePath = FileUtil::getRelativePath(WCF_DIR . 'style/', WCF_DIR . $style->imagePath); $imagePath = FileUtil::addTrailingSlash(FileUtil::unifyDirSeparator($imagePath)); } $variables['style_image_path'] = "'{$imagePath}'"; // apply overrides if (isset($variables['overrideLess'])) { $lines = explode("\n", StringUtil::unifyNewlines($variables['overrideLess'])); foreach ($lines as $line) { if (preg_match('~^@([a-zA-Z]+): ?([@a-zA-Z0-9 ,\\.\\(\\)\\%\\#-]+);$~', $line, $matches)) { $variables[$matches[1]] = $matches[2]; } } unset($variables['overrideLess']); } // add options as LESS variables foreach (Option::getOptions() as $constantName => $option) { if (in_array($option->optionType, array('boolean', 'integer'))) { $variables['wcf_option_' . mb_strtolower($constantName)] = '~"' . $option->optionValue . '"'; } } // compile $this->compiler->setVariables($variables); $content = "/* stylesheet for '" . $stylesheet->getTitle() . "', generated on " . gmdate('r') . " -- DO NOT EDIT */\n\n"; $content .= $this->compiler->compile($stylesheet->less); // compress stylesheet $lines = explode("\n", $content); $content = $lines[0] . "\n" . $lines[1] . "\n"; for ($i = 2, $length = count($lines); $i < $length; $i++) { $line = trim($lines[$i]); $content .= $line; switch (substr($line, -1)) { case ',': $content .= ' '; break; case '}': $content .= "\n"; break; } if (substr($line, 0, 6) == '@media') { $content .= "\n"; } } // write stylesheet $filename = $stylesheet->getLocation($styleID); file_put_contents($filename, $content); FileUtil::makeWritable($filename); // write rtl stylesheet $content = StyleUtil::convertCSSToRTL($content); $filename = $stylesheet->getLocation($styleID, true); file_put_contents($filename, $content); FileUtil::makeWritable($filename); }
/** * @see \wcf\page\IPage::readData() */ public function readData() { parent::readData(); // set active menu item CMSCore::setActiveMenuItem($this->page); // set breadcrumbs CMSCore::setBreadcrumbs($this->page); // change style if ($this->page->styleID && StyleHandler::getInstance()->getStyle()->styleID != $this->page->styleID) { StyleHandler::getInstance()->changeStyle($this->page->styleID, true); } // get contents $contents = $this->page->getContents(); $this->contentNodeTree = $contents['body']; $this->sidebarNodeTree = $contents['sidebar']; // comments if ($this->page->isCommentable) { $this->commentObjectTypeID = CommentHandler::getInstance()->getObjectTypeID('de.codequake.cms.page.comment'); $this->commentManager = CommentHandler::getInstance()->getObjectType($this->commentObjectTypeID)->getProcessor(); $this->commentList = CommentHandler::getInstance()->getCommentList($this->commentManager, $this->commentObjectTypeID, $this->page->pageID); } // meta tags if ($this->page->metaKeywords !== '') { MetaTagHandler::getInstance()->addTag('keywords', 'keywords', WCF::getLanguage()->get($this->page->metaKeywords)); } if ($this->page->metaDescription !== '') { MetaTagHandler::getInstance()->addTag('description', 'description', WCF::getLanguage()->get($this->page->metaDescription)); } if ($this->page->metaDescription !== '') { MetaTagHandler::getInstance()->addTag('og:description', 'og:description', WCF::getLanguage()->get($this->page->metaDescription), true); } MetaTagHandler::getInstance()->addTag('generator', 'generator', 'Fireball CMS'); MetaTagHandler::getInstance()->addTag('og:title', 'og:title', $this->page->getTitle() . ' - ' . WCF::getLanguage()->get(PAGE_TITLE), true); MetaTagHandler::getInstance()->addTag('og:url', 'og:url', $this->page->getLink(false), true); if (FACEBOOK_PUBLIC_KEY != '') { MetaTagHandler::getInstance()->addTag('fb:app_id', 'fb:app_id', FACEBOOK_PUBLIC_KEY, true); } MetaTagHandler::getInstance()->addTag('og:type', 'og:type', 'website', true); }
private static function getIconPath($iconName) { if (class_exists('wcf\\system\\WCFACP', false)) { return RELATIVE_WCF_DIR . 'icon/' . $iconName . '.svg'; } else { return StyleHandler::getInstance()->getStyle()->getIconPath($iconName, 'S'); } }