private function loadModule($module) { $loader = new ModuleLoader(); if (!$loader->isModuleExists($module)) { throw new Exception("{$module} not found"); } return $loader->loadModule($module); }
/** * load module from the modules/$module/ directory * * @return void */ public function loadModule($module) { $loader = new ModuleLoader($module); $loader->debug = false; if (!$loader->loadModule()) { $this->m_Errors[] = nl2br($this->GetMessage("MODULE_LOAD_ERROR") . "\n" . $loader->errors . "\n" . $loader->logs); } else { $this->m_Notices[] = $this->GetMessage("MODULE_LOAD_COMPLETE"); //." ".$loader->logs; } $this->rerender(); }
public function loadAll() { include_once Openbiz::$app->getModulePath() . "/system/lib/ModuleLoader.php"; $_moduleArr = glob(Openbiz::$app->getModulePath() . "/*"); $moduleArr[0] = "system"; $moduleArr[1] = "menu"; foreach ($_moduleArr as $_module) { $_module = basename($_module); $moduleArr[] = $_module; } foreach ($moduleArr as $moduleName) { $loader = new ModuleLoader($moduleName); $loader->loadChangeLog(); } $this->updateForm(); }
public function setLog(\Nethgui\Log\LogInterface $log) { if (isset($this->childLoader)) { $this->childLoader->setLog($log); } return parent::setLog($log); }
/** * Load a set of DCA files * * @param boolean $blnNoCache If true, the cache will be bypassed */ public function load($blnNoCache = false) { // Return if the data has been loaded already if (isset($GLOBALS['loadDataContainer'][$this->strTable]) && !$blnNoCache) { return; } $GLOBALS['loadDataContainer'][$this->strTable] = true; // see #6145 $strCacheFile = 'system/cache/dca/' . $this->strTable . '.php'; // Try to load from cache if (!\Config::get('bypassCache') && file_exists(TL_ROOT . '/' . $strCacheFile)) { include TL_ROOT . '/' . $strCacheFile; } else { foreach (\ModuleLoader::getActive() as $strModule) { $strFile = 'system/modules/' . $strModule . '/dca/' . $this->strTable . '.php'; if (file_exists(TL_ROOT . '/' . $strFile)) { include TL_ROOT . '/' . $strFile; } } } // HOOK: allow to load custom settings if (isset($GLOBALS['TL_HOOKS']['loadDataContainer']) && is_array($GLOBALS['TL_HOOKS']['loadDataContainer'])) { foreach ($GLOBALS['TL_HOOKS']['loadDataContainer'] as $callback) { $this->import($callback[0]); $this->{$callback}[0]->{$callback}[1]($this->strTable); } } // Local configuration file if (file_exists(TL_ROOT . '/system/config/dcaconfig.php')) { include TL_ROOT . '/system/config/dcaconfig.php'; } }
/** * Return all excluded fields as HTML drop down menu * * @return array */ public function getExcludedFields() { $included = array(); foreach (ModuleLoader::getActive() as $strModule) { $strDir = 'system/modules/' . $strModule . '/dca'; if (!is_dir(TL_ROOT . '/' . $strDir)) { continue; } foreach (scan(TL_ROOT . '/' . $strDir) as $strFile) { // Ignore non PHP files and files which have been included before if (substr($strFile, -4) != '.php' || in_array($strFile, $included)) { continue; } $included[] = $strFile; $strTable = substr($strFile, 0, -4); System::loadLanguageFile($strTable); $this->loadDataContainer($strTable); } } $arrReturn = array(); // Get all excluded fields foreach ($GLOBALS['TL_DCA'] as $k => $v) { if (is_array($v['fields'])) { foreach ($v['fields'] as $kk => $vv) { if ($vv['exclude'] || $vv['orig_exclude']) { $arrReturn[$k][specialchars($k . '::' . $kk)] = $vv['label'][0] ?: $kk; } } } } ksort($arrReturn); return $arrReturn; }
protected function afterSubmitCallback(\DataContainer $dc) { // remove previously created locks if (in_array('entity_lock', \ModuleLoader::getActive()) && $this->addEntityLock) { \HeimrichHannot\EntityLock\EntityLockModel::deleteLocks($this->formHybridDataContainer, $this->intId); } }
/** * Send a registration e-mail * @param integer * @param array * @param object */ public function sendRegistrationEmail($intId, $arrData, &$objModule) { if (!$objModule->nc_notification) { return; } $arrTokens = array(); $arrTokens['admin_email'] = $GLOBALS['TL_ADMIN_EMAIL']; $arrTokens['domain'] = \Environment::get('host'); $arrTokens['link'] = \Environment::get('base') . \Environment::get('request') . ($GLOBALS['TL_CONFIG']['disableAlias'] || strpos(\Environment::get('request'), '?') !== false ? '&' : '?') . 'token=' . $arrData['activation']; // Support newsletters if (in_array('newsletter', \ModuleLoader::getActive())) { if (!is_array($arrData['newsletter'])) { if ($arrData['newsletter'] != '') { $objChannels = \Database::getInstance()->execute("SELECT title FROM tl_newsletter_channel WHERE id IN(" . implode(',', array_map('intval', (array) $arrData['newsletter'])) . ")"); $arrTokens['member_newsletter'] = implode("\n", $objChannels->fetchEach('title')); } else { $arrTokens['member_newsletter'] = ''; } } } // translate/format values foreach ($arrData as $strFieldName => $strFieldValue) { $arrTokens['member_' . $strFieldName] = \Haste\Util\Format::dcaValue('tl_member', $strFieldName, $strFieldValue); } $objNotification = \NotificationCenter\Model\Notification::findByPk($objModule->nc_notification); if ($objNotification !== null) { $objNotification->send($arrTokens); // Disable the email to admin because no core notification has been sent $objModule->reg_activate = true; } }
protected function buildFileDir($objEntity = null) { if ($this->fileDir && ($objFolder = \FilesModel::findByUuid($this->fileDir))) { $objMember = \FrontendUser::getInstance(); $strDir = $objFolder->path; if ($this->useHomeDir && FE_USER_LOGGED_IN && $objMember->assignDir && $objMember->homeDir) { $strDir = Files::getPathFromUuid($objMember->homeDir); } if (in_array('protected_homedirs', \ModuleLoader::getActive())) { if ($this->useProtectedHomeDir && $objMember->assignProtectedDir && $objMember->protectedHomeDir) { $strDir = Files::getPathFromUuid($objMember->protectedHomeDir); } } if ($this->fileSubDirName) { $strDir .= '/' . $this->fileSubDirName; } if (isset($GLOBALS['TL_HOOKS']['exporter_modifyFileDir']) && is_array($GLOBALS['TL_HOOKS']['exporter_modifyFileDir'])) { foreach ($GLOBALS['TL_HOOKS']['exporter_modifyFileDir'] as $callback) { $objCallback = \System::importStatic($callback[0]); $strFixedDir = $objCallback->{$callback}[1]($strDir, $this); $strDir = $strFixedDir ?: $strDir; } } return $strDir; } throw new \Exception('No exporter fileDir defined!'); }
/** * @param string $dir directory name (views, i18n, classes, extensions, etc.) * @param string $file filename with subdirectory * @param string $ext extension to search for * @param boolean $array return an array of files? * @return array a list of files when $array is TRUE * @return string single file path */ public function findFile($dir, $file, $ext = null, $array = false) { if ($ext === null) { // Use the default extension $ext = '.php'; } elseif ($ext) { // Prefix the extension with a period $ext = ".{$ext}"; } else { // Use no extension $ext = ''; } // Create a partial path of the filename $path = normalize_path("{$dir}/{$file}{$ext}"); if (isset($this->files[$path . ($array ? '_array' : '_path')])) { // This path has been cached return $this->files[$path . ($array ? '_array' : '_path')]; } if ($array) { // Array of files that have been found $found = []; foreach ($this->moduleLoader->getRegisteredModules() as $module) { $dir = $module->getPath() . DIRECTORY_SEPARATOR; if (is_file($dir . $path)) { // This path has a file, add it to the list $found[] = $dir . $path; } } } else { // The file has not been found yet $found = false; foreach ($this->moduleLoader->getRegisteredModules() as $module) { $dir = $module->getPath() . DIRECTORY_SEPARATOR; if (is_file($dir . $path)) { // A path has been found $found = $dir . $path; // Stop searching break; } } } // Add the path to the cache $this->files[$path . ($array ? '_array' : '_path')] = $found; // Files have been changed $this->filesChanged = true; return $found; }
/** * Return true if the notification_center is installed and can be supported * * @param bool $checkOptions Enable to check for available form notifications * * @return bool */ public static function available($checkOptions = false) { $result = in_array('notification_center', \ModuleLoader::getActive()); if ($result && $checkOptions && \NotificationCenter\Model\Notification::countBy('type', 'core_form') === 0) { $result = false; } return $result; }
/** * Check permissions to edit table tl_faq */ public function checkPermission() { // HOOK: comments extension required if (!in_array('comments', ModuleLoader::getActive())) { $key = array_search('allowComments', $GLOBALS['TL_DCA']['tl_faq']['list']['sorting']['headerFields']); unset($GLOBALS['TL_DCA']['tl_faq']['list']['sorting']['headerFields'][$key]); } }
public function modifyDC(&$arrDca = null) { foreach ($this->arrEditable as $strField) { if (in_array('bootstrapper', \ModuleLoader::getActive())) { $arrDca['fields'][$strField]['eval']['invisible'] = true; } else { $arrDca['fields'][$strField]['inputType'] = 'hidden'; } } }
/** * Disable inactive modules. * * @return void */ private function disableInactiveModules() { $disabled = deserialize(\Config::get('inactiveModules'), true); $active = \ModuleLoader::getActive(); foreach ($disabled as $module) { if (in_array($module, $active)) { new \File(sprintf('system/modules/%s/.skip', $module)); } } }
protected function runAfterSaving(&$objItem, $objTypoItem) { $objItem->alias = $this->generateAlias($objItem->alias ? $objItem->alias : $objItem->headline, $objItem); $objItem->source = 'default'; $objItem->floating = 'above'; $this->createContentElements($objItem); $this->createEnclosures($objItem); // news_categories module support if (in_array('news_categories', \ModuleLoader::getActive())) { $this->setCategories($objItem, $objTypoItem); } // $objItem->teaser = "<p>" . strip_tags($objItem->teaser) . "</p>"; $objItem->save(); }
public function modifyPalette() { $objModule = \ModuleModel::findByPk(\Input::get('id')); $arrDc =& $GLOBALS['TL_DCA']['tl_module']; // submission -> already done in formhybrid // confirmation $arrFieldsToHide = array('formHybridConfirmationMailSender', 'formHybridConfirmationMailSubject', 'formHybridConfirmationMailText', 'formHybridConfirmationMailTemplate', 'formHybridConfirmationMailAttachment'); if (in_array('avisota-core', \ModuleLoader::getActive()) && $objModule->reg_activate_plus && $objModule->formHybridConfirmationAvisotaMessage) { $arrDc['subpalettes']['reg_activate_plus'] = str_replace($arrFieldsToHide, array_map(function () { return ''; }, $arrFieldsToHide), $arrDc['subpalettes']['reg_activate_plus']); $arrDc['subpalettes']['reg_activate_plus'] = str_replace('formHybridConfirmationAvisotaMessage', 'formHybridConfirmationAvisotaMessage,formHybridConfirmationAvisotaSalutationGroup', $arrDc['subpalettes']['reg_activate_plus']); } }
/** * Instantiate the object (Factory) * * @return \Files The files object */ public static function getInstance() { if (self::$objInstance === null) { // Use FTP to modify files if (\Config::get('useFTP')) { self::$objInstance = new \Files\Ftp(); } elseif (\Config::get('useSmhExtended') && in_array('smhextended', \ModuleLoader::getActive())) { self::$objInstance = new \SMHExtended(); } else { self::$objInstance = new \Files\Php(); } } return self::$objInstance; }
/** * Export data * * @access public * @param string * @return void */ public static function run($dc = null, $strName = 'formsubmissions', $blnHeaders = true) { if (!in_array('!composer', \ModuleLoader::getActive())) { \Message::addError($GLOBALS['TL_LANG']['ERR']['exportExcelNoComposer']); \System::redirect(str_ireplace('&key=exportExcel', '', \Environment::get('request'))); return; } if (!is_file(TL_ROOT . '/composer/vendor/phpoffice/phpexcel/Classes/PHPExcel.php')) { \Message::addError($GLOBALS['TL_LANG']['ERR']['exportExcelNoPHPExcel']); \System::redirect(str_ireplace('&key=exportExcel', '', \Environment::get('request'))); return; } parent::run($dc, $strName, $blnHeaders); }
/** * Load all data containers */ protected function loadDataContainers() { foreach (\ModuleLoader::getActive() as $module) { $dir = 'system/modules/' . $module . '/dca'; if (!is_dir(TL_ROOT . '/' . $dir)) { continue; } foreach (scan(TL_ROOT . '/' . $dir) as $file) { if (substr($file, -4) != '.php') { continue; } \Controller::loadDataContainer(substr($file, 0, -4)); } } }
public function addTokens($objMessage, &$arrTokens, $strLanguage, $objGatewayModel) { if (!isset($arrTokens['salutation_user'])) { $arrTokens['salutation_user'] = static::createSalutation($strLanguage, \FrontendUser::getInstance()); } if (!isset($arrTokens['salutation_form'])) { $arrTokens['salutation_form'] = static::createSalutation($strLanguage, array('gender' => $arrTokens['form_value_gender'], 'title' => $arrTokens['form_title'] ?: $arrTokens['form_academicTitle'], 'lastname' => $arrTokens['form_lastname'])); } if (in_array('isotope', \ModuleLoader::getActive())) { if (!isset($arrTokens['billing_address_form'])) { $arrTokens['salutation_billing_address'] = static::createSalutation($strLanguage, array('gender' => $arrTokens['billing_address_gender'], 'title' => $arrTokens['billing_address_title'], 'lastname' => $arrTokens['billing_address_lastname'])); } } $this->addContextTokens($objMessage, $arrTokens, $strLanguage); return true; }
/** * @param string|null $namespace * * @return string */ public function getModuleNameByNamespace($namespace = null) { $defaultNamespace = 'app'; $currentRoute = app('router')->getCurrentRoute(); if (is_null($namespace) and !is_null($currentRoute)) { $namespace = $currentRoute->getAction()['namespace']; } if (is_null($namespace)) { return $defaultNamespace; } foreach ($this->moduleLoader->getRegisteredModules() as $module) { if (!empty($moduleNamespace = $module->getNamespace())) { if (strpos($namespace, $moduleNamespace) === 0) { return $module->getKey(); } } } return $defaultNamespace; }
public function languageLabels($row, $label, $dc = null, $imageAttribute = '', $blnReturnImage = false, $blnProtected = false) { // generate the default label $objDcaClass = null; if (in_array('cacheicon', ModuleLoader::getActive())) { $objDcaClass = new tl_page_cacheicon(); } elseif (in_array('Avisota', ModuleLoader::getActive())) { $objDcaClass = new tl_page_avisota(); } else { $objDcaClass = new tl_page(); } $label = $objDcaClass->addIcon($row, $label, $dc, $imageAttribute, $blnReturnImage, $blnProtected); // return the label for root or folder page if ($row['type'] == 'root' || $row['type'] == 'folder') { return $label; } // load the current page $objPage = PageModel::findWithDetails($row['id']); // prepare alternate pages $objAlternates = null; if ($objPage->languageMain) { // get all pages referencing the same fallback page $t = \PageModel::getTable(); $objAlternates = PageModel::findBy(array("{$t}.languageMain = ? OR {$t}.id = ?"), array($objPage->languageMain, $objPage->languageMain)); } else { // get all pages referencing the current page as its fallback $objAlternates = PageModel::findByLanguageMain($objPage->id); } // check if alternates were found if ($objAlternates !== null) { $label .= '<ul class="tl_page_language_alternates">'; // go through each page and add link while ($objAlternates->next()) { if ($objAlternates->id == $objPage->id) { continue; } $objAlternates->current()->loadDetails(); $label .= '<li><a href="contao/main.php?do=page&node=' . $objAlternates->id . '&ref=' . TL_REFERER_ID . '">' . $objAlternates->language . '</a></li>'; } $label .= '</ul>'; } return $label; }
public function modifyFieldPalette() { if (($objFieldPalette = \HeimrichHannot\FieldPalette\FieldPaletteModel::findByPk(\Input::get('id'))) === null) { return; } $objModule = \ModuleModel::findByPk($objFieldPalette->pid); $arrDca =& $GLOBALS['TL_DCA']['tl_fieldpalette']; switch ($objModule->type) { case 'iso_direct_checkout': if (in_array('isotope_plus', \ModuleLoader::getActive())) { $arrDca['subpalettes']['iso_addSubscription'] = str_replace('iso_subscriptionArchive', 'iso_subscriptionArchive,iso_addSubscriptionCheckbox', $arrDca['subpalettes']['iso_addSubscription']); } // no break! // no break! case 'iso_checkout': if ($objFieldPalette->iso_addActivation) { $arrDca['subpalettes']['iso_addSubscription'] = str_replace('iso_addActivation', 'iso_addActivation,iso_activationNotification,iso_activationJumpTo', $arrDca['subpalettes']['iso_addSubscription']); } break; } }
/** * Return all template files of a particular group as array. * * @param string $prefix The string prefix to use. * * @param integer $themeId The theme in which to search. * * @return array */ public static function getTemplateGroup($prefix, $themeId = 0) { $folders = array(); // Add the templates root directory $folders['/templates'] = TL_ROOT . '/templates'; // Add the theme templates folder if ($themeId > 0) { $resultSet = Database::getInstance()->prepare('SELECT templates FROM tl_theme WHERE id=?')->limit(1)->execute($themeId); if ($resultSet->numRows > 0 && $resultSet->templates != '') { $folders[$resultSet->title] = TL_ROOT . '/' . $resultSet->templates; } } // Add the module templates folders if they exist $activeModules = \ModuleLoader::getActive(); foreach ($activeModules as $module) { $folder = TL_ROOT . '/system/modules/' . $module . '/templates'; if (is_dir($folder)) { $folders['system/modules/' . $module] = $folder; } } return static::getTemplateGroupInFolders($prefix, $folders); }
protected function generateFields($objItem) { $arrItem = parent::generateFields($objItem); if (in_array('member_content_archives', \ModuleLoader::getActive())) { $arrFilterTags = deserialize($this->memberContentArchiveTags, true); $arrItem['fields']['memberContent'] = ''; if (($objMemberContentArchives = \HeimrichHannot\MemberContentArchives\MemberContentArchiveModel::findBy(array('mid=?', 'published=?'), array($objItem->memberId ?: $objItem->id, true))) !== null) { while ($objMemberContentArchives->next()) { if (in_array($objMemberContentArchives->tag, $arrFilterTags)) { $arrItem['fields']['memberContentId'] = $objMemberContentArchives->id; $objElement = \ContentModel::findPublishedByPidAndTable($objMemberContentArchives->id, 'tl_member_content_archive'); if ($objElement !== null) { while ($objElement->next()) { $arrItem['fields']['memberContent'] .= \Controller::getContentElement($objElement->current()); } } } } if ($objMemberContentArchives->tag == $this->memberContentArchiveTeaserTag) { $arrItem['fields']['memberContentTitle'] = $objMemberContentArchives->title; $arrItem['fields']['memberContentTeaser'] = $objMemberContentArchives->teaser; } // override member fields $arrOverridableMemberFields = deserialize(\Config::get('overridableMemberFields')); if (!empty($arrOverridableMemberFields)) { foreach ($arrOverridableMemberFields as $strField) { $strFieldOverride = 'member' . ucfirst($strField); if ($objMemberContentArchives->{$strFieldOverride}) { if (\Validator::isUuid($objMemberContentArchives->{$strFieldOverride})) { $objMemberContentArchives->{$strFieldOverride} = Files::getPathFromUuid($objMemberContentArchives->{$strFieldOverride}); } $arrItem['fields'][$strField] = $objMemberContentArchives->{$strFieldOverride}; } } } } } return $arrItem; }
protected function parseItem($objItem, $strClass = '', $intCount = 0) { if (in_array('member_content_archives', \ModuleLoader::getActive())) { $arrFilterTags = deserialize($this->memberContentArchiveTags, true); $objItem->memberContent = ''; if (($objMemberContentArchives = \HeimrichHannot\MemberContentArchives\MemberContentArchiveModel::findBy('mid', $objItem->memberId ?: $objItem->id)) !== null) { while ($objMemberContentArchives->next()) { if (in_array($objMemberContentArchives->tag, $arrFilterTags)) { $objItem->memberContentId = $objMemberContentArchives->id; $objElement = \ContentModel::findPublishedByPidAndTable($objMemberContentArchives->id, 'tl_member_content_archive'); if ($objElement !== null) { while ($objElement->next()) { $objItem->memberContent .= \Controller::getContentElement($objElement->current()); } } } } if ($objMemberContentArchives->tag == $this->memberContentArchiveTeaserTag) { $objItem->memberContentTitle = $objMemberContentArchives->title; $objItem->memberContentTeaser = $objMemberContentArchives->teaser; } // override member fields $arrOverridableMemberFields = deserialize(\Config::get('overridableMemberFields')); if (!empty($arrOverridableMemberFields)) { foreach ($arrOverridableMemberFields as $strField) { $strFieldOverride = 'member' . ucfirst($strField); if ($objMemberContentArchives->{$strFieldOverride}) { if (\Validator::isUuid($objMemberContentArchives->{$strFieldOverride})) { $objMemberContentArchives->{$strFieldOverride} = Files::getPathFromUuid($objMemberContentArchives->{$strFieldOverride}); } $objItem->{$strField} = $objMemberContentArchives->{$strFieldOverride}; } } } } } return parent::parseItem($objItem, $strClass, $intCount); }
/** * getPageIdFromUrl Hook * checks if the URL fragment is a news alias and sets the page alias and auto item accordingly * @param array the URL fragments */ public function getPageIdFromUrl($arrFragments) { // extract alias from fragments $alias = null; // handle special case with i18nl10n (see #4) if (in_array('i18nl10n', \ModuleLoader::getActive()) && count($arrFragments) == 3) { if ($arrFragments[0] == null && $arrFragments[1] == 'language') { $alias = $arrFragments[2]; } } elseif (count($arrFragments) == 1) { $alias = $arrFragments[0]; } // check if an alias was extracted if ($alias) { // check if news item exists if (($objNews = \NewsModel::findByAlias($alias)) !== null) { // check if jumpTo page exists if (($objTarget = \PageModel::findWithDetails($objNews->getRelated('pid')->jumpTo)) !== null) { // check if target page is in the right language if (\Config::get('addLanguageToUrl') && $objTarget->rootLanguage != \Input::get('language')) { // return fragments without change return $arrFragments; } // check if target page is in the right domain if ($objTarget->domain && stripos(\Environment::get('host'), $objTarget->domain) === false) { // return fragments without change return $arrFragments; } // return changed fragments return array($objTarget->alias, 'auto_item', $objNews->alias); } } } // return fragments without change return $arrFragments; }
function loadModules() { include_once Openbiz::$app->getModulePath() . "/system/lib/ModuleLoader.php"; $modules = array('system', 'menu', 'help', 'contact', 'cronjob'); foreach (glob(Openbiz::$app->getModulePath() . DIRECTORY_SEPARATOR . "*") as $dir) { $modName = str_replace(Openbiz::$app->getModulePath() . DIRECTORY_SEPARATOR, "", $dir); if (!in_array($modName, $modules)) { array_push($modules, $modName); } } $logs = ""; // find all modules foreach ($modules as $mod) { $logs .= "Loading Module: {$mod}\n"; $loader = new ModuleLoader($mod); $loader->debug = 0; $loader->loadModule(true); $logs .= $loader->logs; $logs .= $loader->errors; $logs .= "\n"; } giveActionAccess("", 1); // admin to access all actions //giveActionAccess("module='user'", 2); file_put_contents(OPENBIZ_APP_FILE_PATH . '/install.log', $logs); echo "SUCCESS. Modules are loaded in Cubi. ###\n" . $logs; }
/** * Generate the module */ protected function compile() { /** @var \PageModel $objPage */ global $objPage; $this->Template->articles = ''; $this->Template->referer = 'javascript:history.go(-1)'; $this->Template->back = $GLOBALS['TL_LANG']['MSC']['goBack']; // Get the news item $objArticle = \NewsModel::findPublishedByParentAndIdOrAlias(\Input::get('items'), $this->news_archives); if (null === $objArticle) { /** @var \PageError404 $objHandler */ $objHandler = new $GLOBALS['TL_PTY']['error_404'](); $objHandler->generate($objPage->id); } $arrArticle = $this->parseArticle($objArticle); $this->Template->articles = $arrArticle; // Overwrite the page title (see #2853 and #4955) if ($objArticle->headline != '') { $objPage->pageTitle = strip_tags(strip_insert_tags($objArticle->headline)); } // Overwrite the page description if ($objArticle->teaser != '') { $objPage->description = $this->prepareMetaDescription($objArticle->teaser); } // HOOK: comments extension required if ($objArticle->noComments || !in_array('comments', \ModuleLoader::getActive())) { $this->Template->allowComments = false; return; } /** @var \NewsArchiveModel $objArchive */ $objArchive = $objArticle->getRelated('pid'); $this->Template->allowComments = $objArchive->allowComments; // Comments are not allowed if (!$objArchive->allowComments) { return; } // Adjust the comments headline level $intHl = min(intval(str_replace('h', '', $this->hl)), 5); $this->Template->hlc = 'h' . ($intHl + 1); $this->import('Comments'); $arrNotifies = array(); // Notify the system administrator if ($objArchive->notify != 'notify_author') { $arrNotifies[] = $GLOBALS['TL_ADMIN_EMAIL']; } // Notify the author if ($objArchive->notify != 'notify_admin') { /** @var \UserModel $objAuthor */ if (($objAuthor = $objArticle->getRelated('author')) !== null && $objAuthor->email != '') { $arrNotifies[] = $objAuthor->email; } } $objConfig = new \stdClass(); $objConfig->perPage = $objArchive->perPage; $objConfig->order = $objArchive->sortOrder; $objConfig->template = $this->com_template; $objConfig->requireLogin = $objArchive->requireLogin; $objConfig->disableCaptcha = $objArchive->disableCaptcha; $objConfig->bbcode = $objArchive->bbcode; $objConfig->moderate = $objArchive->moderate; $this->Comments->addCommentsToTemplate($this->Template, $objConfig, 'tl_news', $objArticle->id, $arrNotifies); }
/** * @return bool true if dlh_googlemaps is available, otherwise false */ private static function init() { if (!in_array('dlh_googlemaps', \ModuleLoader::getActive())) { return false; } \Controller::loadLanguageFile('tl_dlh_googlemaps'); return true; }