本文整理汇总了PHP中ModuleLoader类的典型用法代码示例。如果您正苦于以下问题:PHP ModuleLoader类的具体用法?PHP ModuleLoader怎么用?PHP ModuleLoader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ModuleLoader类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadModule
private function loadModule($module)
{
$loader = new ModuleLoader();
if (!$loader->isModuleExists($module)) {
throw new Exception("{$module} not found");
}
return $loader->loadModule($module);
}
示例2: loadModule
/**
* 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();
}
示例3: loadAll
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();
}
示例4: 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';
}
}
示例5: 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;
}
示例6: 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);
}
}
示例7: 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;
}
}
示例8: 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!');
}
示例9: 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;
}
示例10: 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]);
}
}
示例11: 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';
}
}
}
示例12: 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));
}
}
}
示例13: 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();
}
示例14: 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']);
}
}
示例15: 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;
}