本文整理汇总了PHP中ModuleLoader::getActive方法的典型用法代码示例。如果您正苦于以下问题:PHP ModuleLoader::getActive方法的具体用法?PHP ModuleLoader::getActive怎么用?PHP ModuleLoader::getActive使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ModuleLoader
的用法示例。
在下文中一共展示了ModuleLoader::getActive方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: load
/**
* 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';
}
}
示例2: getExcludedFields
/**
* 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;
}
示例3: sendRegistrationEmail
/**
* 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;
}
}
示例4: afterSubmitCallback
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);
}
}
示例5: buildFileDir
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!');
}
示例6: checkPermission
/**
* 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]);
}
}
示例7: available
/**
* 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;
}
示例8: disableInactiveModules
/**
* 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));
}
}
}
示例9: modifyDC
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';
}
}
}
示例10: runAfterSaving
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();
}
示例11: run
/**
* 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);
}
示例12: modifyPalette
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']);
}
}
示例13: getInstance
/**
* 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;
}
示例14: loadDataContainers
/**
* 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));
}
}
}
示例15: addTokens
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;
}