/** * Execute the extra */ public function execute() { parent::execute(); $this->loadData(); $widgetTemplatesPath = FRONTEND_MODULES_PATH . '/Pages/Layout/Widgets'; // check if the given template exists try { $template = FrontendTheme::getPath($widgetTemplatesPath . '/' . $this->data['template']); } catch (FrontendException $e) { // template does not exist; assume subpages_default.tpl $template = FrontendTheme::getPath($widgetTemplatesPath . '/PreviousNextNavigation.tpl'); } $this->loadTemplate($template); $this->parse(); }
/** * Assign the template path * * @return string */ private function assignTemplate() { $template = FrontendTheme::getPath(FRONTEND_MODULES_PATH . '/ContentBlocks/Layout/Widgets/Default.tpl'); // is the content block visible? if (!empty($this->item)) { // check if the given template exists try { $template = FrontendTheme::getPath(FRONTEND_MODULES_PATH . '/ContentBlocks/Layout/Widgets/' . $this->item['template']); } catch (FrontendException $e) { // do nothing } } else { // set a default text so we don't see the template data $this->item['text'] = ''; } return $template; }
/** * Set the path for the template * * @param string $path The path to set. */ private function setTemplatePath($path) { $this->templatePath = FrontendTheme::getPath($path); }
/** * Parse Facebook related header-data */ private function parseFacebook() { $parseFacebook = false; $facebookAdminIds = $this->get('fork.settings')->get('Core', 'facebook_admin_ids', null); $facebookAppId = $this->get('fork.settings')->get('Core', 'facebook_app_id', null); // check if facebook admins are set if ($facebookAdminIds !== null) { $this->addMetaData(array('property' => 'fb:admins', 'content' => $facebookAdminIds), true, array('property')); $parseFacebook = true; } // check if no facebook admin is set but an app is configured we use the application as an admin if ($facebookAdminIds == '' && $facebookAppId !== null) { $this->addMetaData(array('property' => 'fb:app_id', 'content' => $facebookAppId), true, array('property')); $parseFacebook = true; } // should we add extra open-graph data? if ($parseFacebook) { // build correct locale switch (FRONTEND_LANGUAGE) { case 'en': $locale = 'en_US'; break; case 'zh': $locale = 'zh_CN'; break; case 'cs': $locale = 'cs_CZ'; break; case 'el': $locale = 'el_GR'; break; case 'ja': $locale = 'ja_JP'; break; case 'sv': $locale = 'sv_SE'; break; case 'uk': $locale = 'uk_UA'; break; default: $locale = strtolower(FRONTEND_LANGUAGE) . '_' . strtoupper(FRONTEND_LANGUAGE); } $this->addOpenGraphData('locale', $locale); // if a default image has been set for facebook, assign it $this->addOpenGraphImage('/frontend/themes/' . Theme::getTheme() . '/facebook.png'); $this->addOpenGraphImage('/facebook.png'); } }
/** * Get path to map styles * * @param boolean $backend * @return string */ public static function getPathToMapStyles($backend = true) { $path = 'src/Frontend'; $jsFile = 'Location/Js/LocationMapStyles.js'; $moveToPath = '../../../../..'; // User can override the map styles in the frontend if (file_exists($path . '/Themes/' . FrontendTheme::getTheme() . '/Modules/' . $jsFile)) { if ($backend) { return $moveToPath . '/' . $path . '/Themes/' . FrontendTheme::getTheme() . '/Modules/' . $jsFile; } return '/' . $path . '/Themes/' . FrontendTheme::getTheme() . '/Modules/' . $jsFile; } if ($backend) { return $moveToPath . '/' . $path . '/Modules/' . $jsFile; } return '/' . $path . '/Modules/' . $jsFile; }
/** * Fetch the path for an include (theme file if available, core file otherwise) * syntax: {{ getpath($file) }} * * @param string $file The base path. * * @return string */ public static function getPath($file) { return Theme::getPath($file); }