本文整理汇总了PHP中BL::getActiveLanguages方法的典型用法代码示例。如果您正苦于以下问题:PHP BL::getActiveLanguages方法的具体用法?PHP BL::getActiveLanguages怎么用?PHP BL::getActiveLanguages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类BL
的用法示例。
在下文中一共展示了BL::getActiveLanguages方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCheckboxValues
/**
* Get all active languages in a format usable by SpoonForm's addRadioButton
*
* @return array
*/
public static function getCheckboxValues()
{
$languages = BL::getActiveLanguages();
$results = array();
// stop here if no languages are present
if (empty($languages)) {
return array();
}
// addRadioButton requires an array with keys 'value' and 'label'
foreach ($languages as $abbreviation) {
$results[] = array('value' => $abbreviation, 'label' => BL::lbl(strtoupper($abbreviation)));
}
return $results;
}
示例2: checkForGroups
/**
* Checks if any groups are made yet. Depending on the client that is linked to Fork, it will creates default groups if none were found in CampaignMonitor.
* If they were, the user is presented with an overview to import all groups and their subscribers in Fork.
*
* @return void
*/
private function checkForGroups()
{
// groups are already set
if (BackendModel::getModuleSetting('mailmotor', 'cm_groups_set')) {
return false;
}
// no CM data found
if (!BackendMailmotorCMHelper::checkAccount()) {
return false;
}
// check if there are external groups present in CampaignMonitor
if ($this->checkForExternalGroups()) {
// external groups were found, so redirect to the import_groups action
SpoonHTTP::redirect(BackendModel::createURLForAction('import_groups', 'mailmotor'));
}
// fetch the default groups, language abbreviation is the array key
$groups = BackendMailmotorModel::getDefaultGroups();
// loop languages
foreach (BL::getActiveLanguages() as $language) {
// this language does not have a default group set
if (!isset($groups[$language])) {
// set group record
$group['name'] = 'Website (' . strtoupper($language) . ')';
$group['language'] = $language;
$group['is_default'] = 'Y';
$group['created_on'] = date('Y-m-d H:i:s');
try {
// insert the group in CampaignMonitor
BackendMailmotorCMHelper::insertGroup($group);
} catch (CampaignMonitorException $e) {
// ignore
}
}
}
// we have groups set, and default groups chosen
BackendModel::setModuleSetting('mailmotor', 'cm_groups_set', true);
BackendModel::setModuleSetting('mailmotor', 'cm_groups_defaults_set', true);
}
示例3: getLanguagesForCheckboxes
/**
* Get all active languages in a format acceptable for SpoonForm::addRadioButton() and SpoonForm::addMultiCheckbox()
*
* @return array
*/
public static function getLanguagesForCheckboxes()
{
// get the active languages
$languages = BL::getActiveLanguages();
// no languages found
if (empty($languages)) {
return array();
}
// init results
$results = array();
// loop the languages
foreach ($languages as $abbreviation) {
// build new value
$results[] = array('value' => $abbreviation, 'label' => BL::lbl(strtoupper($abbreviation)));
}
return $results;
}
示例4: installModule
/**
* Install a module.
*
* @param string $module The name of the module to be installed.
* @param array $information Warnings from the upload of the module.
*/
public static function installModule($module, array $warnings = array())
{
// we need the installer
require_once BACKEND_CORE_PATH . '/installer/installer.php';
require_once BACKEND_MODULES_PATH . '/' . $module . '/installer/installer.php';
// installer class name
$class = SpoonFilter::toCamelCase($module) . 'Installer';
// possible variables available for the module installers
$variables = array();
// run installer
$installer = new $class(BackendModel::getDB(true), BL::getActiveLanguages(), array_keys(BL::getInterfaceLanguages()), false, $variables);
// execute installation
$installer->install();
// add the warnings
foreach ($warnings as $warning) {
$installer->addWarning($warning);
}
// save the warnings in session for later use
if ($installer->getWarnings()) {
$warnings = SpoonSession::exists('installer_warnings') ? SpoonSession::get('installer_warnings') : array();
$warnings = array_merge($warnings, array('module' => $module, 'warnings' => $installer->getWarnings()));
SpoonSession::set('installer_warnings', $warnings);
}
// clear the cache so locale (and so much more) gets rebuilt
self::clearCache();
}