本文整理汇总了PHP中ZLanguage::getInstalledLanguages方法的典型用法代码示例。如果您正苦于以下问题:PHP ZLanguage::getInstalledLanguages方法的具体用法?PHP ZLanguage::getInstalledLanguages怎么用?PHP ZLanguage::getInstalledLanguages使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZLanguage
的用法示例。
在下文中一共展示了ZLanguage::getInstalledLanguages方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getDataFromInputPostProcess
public function getDataFromInputPostProcess($data = null)
{
if (!$data) {
$data =& $this->_objData;
}
if (!$data) {
return $data;
}
if (isset($data['status'])) {
$data['status'] = 'A';
} else {
$data['status'] = 'I';
}
if (!isset($data['is_locked'])) {
$data['is_locked'] = 0;
}
if (!isset($data['is_leaf'])) {
$data['is_leaf'] = 0;
}
$languages = ZLanguage::getInstalledLanguages();
foreach ($languages as $lang) {
if (!isset($data['display_name'][$lang]) || !$data['display_name'][$lang]) {
$data['display_name'][$lang] = $data['name'];
}
}
$this->_objData = $data;
return $data;
}
示例2: updateconfig
/**
* Update Config
*/
public function updateconfig()
{
// Confirm the forms authorisation key
$this->checkCsrfToken();
// Security check
$this->throwForbiddenUnless(SecurityUtil::checkPermission($this->name . '::', '::', ACCESS_ADMIN));
// retrieve the associative preferences array
$prefs = FormUtil::getPassedValue('preferences', null, 'POST');
$languages = ZLanguage::getInstalledLanguages();
// now for each perference entry, set the appropriate module variable
foreach ($languages as $language) {
ModUtil::setVar('AddressBook', 'abtitle_' . $language, isset($prefs['abtitle_' . $language]) ? $prefs['abtitle_' . $language] : '');
ModUtil::setVar('AddressBook', 'abmetatitle_' . $language, isset($prefs['abmetatitle_' . $language]) ? $prefs['abmetatitle_' . $language] : '');
ModUtil::setVar('AddressBook', 'abmetadescription_' . $language, isset($prefs['abmetadescription_' . $language]) ? $prefs['abmetadescription_' . $language] : '');
ModUtil::setVar('AddressBook', 'abmetakeyword_' . $language, isset($prefs['abmetakeyword_' . $language]) ? $prefs['abmetakeyword_' . $language] : '');
ModUtil::setVar('AddressBook', 'custom_tab_' . $language, isset($prefs['custom_tab_' . $language]) ? $prefs['custom_tab_' . $language] : '');
}
ModUtil::setVar('AddressBook', 'globalprotect', isset($prefs['globalprotect']) ? $prefs['globalprotect'] : 0);
ModUtil::setVar('AddressBook', 'allowprivate', isset($prefs['allowprivate']) ? $prefs['allowprivate'] : 0);
ModUtil::setVar('AddressBook', 'use_prefix', isset($prefs['use_prefix']) ? $prefs['use_prefix'] : 0);
ModUtil::setVar('AddressBook', 'use_img', isset($prefs['use_img']) ? $prefs['use_img'] : 0);
ModUtil::setVar('AddressBook', 'images_dir', isset($prefs['images_dir']) ? $prefs['images_dir'] : 'userdata/Addressbook');
ModUtil::setVar('AddressBook', 'images_manager', isset($prefs['images_manager']) ? $prefs['images_manager'] : 'kcfinder');
ModUtil::setVar('AddressBook', 'google_api_key', isset($prefs['google_api_key']) ? $prefs['google_api_key'] : '');
ModUtil::setVar('AddressBook', 'google_zoom', isset($prefs['google_zoom']) ? $prefs['google_zoom'] : 15);
ModUtil::setVar('AddressBook', 'itemsperpage', $prefs['itemsperpage'] > 1 ? $prefs['itemsperpage'] : 30);
ModUtil::setVar('AddressBook', 'addressbooktype', isset($prefs['addressbooktype']) ? $prefs['addressbooktype'] : 1);
ModUtil::setVar('AddressBook', 'showabcfilter', isset($prefs['showabcfilter']) ? $prefs['showabcfilter'] : 0);
// redirect back to to main admin page
LogUtil::registerStatus($this->__('Done! Configuration saved.'));
return System::redirect(ModUtil::url('AddressBook', 'admin', 'main'));
}
示例3: edit
public function edit($args = array())
{
$this->checkAjaxToken();
$mode = $this->request->request->get('mode', 'new');
$accessLevel = $mode == 'edit' ? ACCESS_EDIT : ACCESS_ADD;
$this->throwForbiddenUnless(SecurityUtil::checkPermission('Categories::', '::', $accessLevel));
$cid = isset($args['cid']) ? $args['cid'] : $this->request->request->get('cid', 0);
$parent = isset($args['parent']) ? $args['parent'] : $this->request->request->get('parent', 1);
$validationErrors = FormUtil::getValidationErrors();
$editCat = '';
$languages = ZLanguage::getInstalledLanguages();
if ($validationErrors) {
$category = new Categories_DBObject_Category(DBObject::GET_FROM_VALIDATION_FAILED); // need this for validation info
$editCat = $category->get();
$validationErrors = $validationErrors['category'];
} else {
// indicates that we're editing
if ($mode == 'edit') {
if (!$cid) {
return new Zikula_Response_Ajax_BadData($this->__('Error! Cannot determine valid \'cid\' for edit mode in \'Categories_admin_edit\'.'));
}
$category = new Categories_DBObject_Category();
$editCat = $category->select($cid);
$this->throwNotFoundUnless($editCat, $this->__('Sorry! No such item found.'));
} else {
// someone just pressen 'new' -> populate defaults
$category = new Categories_DBObject_Category(); // need this for validation info
$editCat['sort_value'] = '0';
$editCat['parent_id'] = $parent;
}
}
$attributes = isset($editCat['__ATTRIBUTES__']) ? $editCat['__ATTRIBUTES__'] : array();
Zikula_AbstractController::configureView();
$this->view->setCaching(Zikula_View::CACHE_DISABLED);
$this->view->assign('mode', $mode)
->assign('category', $editCat)
->assign('attributes', $attributes)
->assign('languages', $languages)
->assign('validation', $category->_objValidation);
$result = array(
'action' => $mode == 'new' ? 'add' : 'edit',
'result' => $this->view->fetch('categories_adminajax_edit.tpl'),
'validationErrors' => $validationErrors
);
if ($validationErrors) {
return new Zikula_Response_Ajax_BadData($validationErrors, $result);
}
return new Zikula_Response_Ajax($result);
}
示例4: setInstalled
public function setInstalled()
{
$installed_languages = \ZLanguage::getInstalledLanguages();
$installed = [];
foreach ($installed_languages as $langCode) {
$installed[$langCode]['name'] = \ZLanguage::getLanguageName($langCode);
$installed[$langCode]['data'] = new \ZLocale($langCode);
}
$this->installed = $installed;
return;
}
示例5: reloadMultilingualRoutingSettings
/**
* Reloads the multilingual routing settings by reading system variables and checking installed languages.
*
* @param array $args No arguments available.
*
* @return bool
*/
public function reloadMultilingualRoutingSettings($args)
{
unset($args);
$defaultLocale = \System::getVar('language_i18n', $this->getContainer()->getParameter('locale'));
$installedLanguages = \ZLanguage::getInstalledLanguages();
$isRequiredLangParameter = \System::getVar('languageurl', 0);
$configDumper = $this->get('zikula.dynamic_config_dumper');
$configDumper->setConfiguration('jms_i18n_routing', array('default_locale' => $defaultLocale, 'locales' => $installedLanguages, 'strategy' => $isRequiredLangParameter ? 'prefix' : 'prefix_except_default'));
$cacheClearer = $this->get('zikula.cache_clearer');
$cacheClearer->clear('symfony');
return true;
}
示例6: isNecessary
public function isNecessary()
{
if (version_compare(ZIKULACORE_CURRENT_INSTALLED_VERSION, UpgraderController::ZIKULACORE_MINIMUM_UPGRADE_VERSION, '<')) {
throw new AbortStageException(__f('The current installed version of Zikula is reporting (%1$s). You must upgrade to version (%2$s) before you can use this upgrade.', array(ZIKULACORE_CURRENT_INSTALLED_VERSION, UpgraderController::ZIKULACORE_MINIMUM_UPGRADE_VERSION)));
}
// make sure selected language is installed
if (!in_array(\ZLanguage::getLanguageCode(), \ZLanguage::getInstalledLanguages())) {
\System::setVar('language_i18n', 'en');
\System::setVar('language', 'eng');
\System::setVar('locale', 'en');
\ZLanguage::setLocale('en');
}
return true;
}
示例7: smarty_modifier_zikularoutesmodulePathToString
function smarty_modifier_zikularoutesmodulePathToString($path, \Zikula\RoutesModule\Entity\RouteEntity $route)
{
$options = $route->getOptions();
$prefix = '';
if (isset($options['i18n_prefix'])) {
$prefix = '/' . $options['i18n_prefix'];
}
if (!isset($options['i18n']) || $options['i18n']) {
$languages = ZLanguage::getInstalledLanguages();
$isRequiredLangParam = ZLanguage::isRequiredLangParam();
if (!$isRequiredLangParam) {
$defaultLanguage = System::getVar('language_i18n');
unset($languages[array_search($defaultLanguage, $languages)]);
}
if (count($languages) > 0) {
$prefix = ($isRequiredLangParam ? "/" : "{/") . implode('|', $languages) . ($isRequiredLangParam ? "" : "}");
}
}
$prefix = \DataUtil::formatForDisplay($prefix);
$path = \DataUtil::formatForDisplay($route->getPathWithBundlePrefix());
$container = \ServiceUtil::getManager();
$path = preg_replace_callback('#%(.*?)%#', function ($matches) use($container) {
return "<abbr title=\"" . \DataUtil::formatForDisplay($matches[0]) . "\">" . \DataUtil::formatForDisplay($container->getParameter($matches[1])) . "</abbr>";
}, $path);
$defaults = $route->getDefaults();
$requirements = $route->getRequirements();
$dom = ZLanguage::getModuleDomain('ZikulaRoutesModule');
$path = preg_replace_callback('#{(.*?)}#', function ($matches) use($container, $defaults, $requirements, $dom) {
$title = "";
if (isset($defaults[$matches[1]])) {
$title .= __f('Default: %s', array(\DataUtil::formatForDisplay($defaults[$matches[1]])), $dom);
}
if (isset($requirements[$matches[1]])) {
if ($title != "") {
$title .= " | ";
}
$title .= __f('Requirement: %s', array(\DataUtil::formatForDisplay($requirements[$matches[1]])), $dom);
}
if ($title == "") {
return $matches[0];
}
return "<abbr title=\"{$title}\">" . $matches[0] . "</abbr>";
}, $path);
return "{$prefix}<strong>{$path}</strong>";
}
示例8: isNecessary
public function isNecessary()
{
$installedLanguages = \ZLanguage::getInstalledLanguages();
if (count($installedLanguages) == 1) {
$this->writeParams(array('locale' => $installedLanguages[0]));
return false;
} else {
// see if the browser has a preference set
$detector = new \ZLanguageBrowser($installedLanguages);
$locale = $detector->discover();
if ($locale !== false && in_array($locale, $installedLanguages)) {
$this->writeParams(array('locale' => $locale));
return false;
} else {
return true;
}
}
}
示例9: dumpJsRoutes
/**
* Dump the routes exposed to javascript to '/web/js/fos_js_routes.js'
*
* @param null $lang
* @return string
* @throws \Exception
*/
public function dumpJsRoutes($lang = null)
{
// determine list of supported languages
$langs = array();
$installedLanguages = \ZLanguage::getInstalledLanguages();
if (isset($lang) && in_array($lang, $installedLanguages)) {
// use provided lang if available
$langs = array($lang);
} else {
$multilingual = (bool) \System::getVar('multilingual', 0);
if ($multilingual) {
// get all available locales
$langs = $installedLanguages;
} else {
// get only the default locale
$langs = array(\System::getVar('language_i18n', 'en'));
//$this->container->getParameter('locale');
}
}
$errors = '';
// force deletion of existing file
$targetPath = sprintf('%s/../web/js/fos_js_routes.js', $this->container->getParameter('kernel.root_dir'));
if (file_exists($targetPath)) {
try {
unlink($targetPath);
} catch (\Exception $e) {
$errors .= __f("Error: Could not delete '%s' because %s", array($targetPath, $e->getMessage()));
}
}
foreach ($langs as $lang) {
$command = new DumpCommand();
$command->setContainer($this->container);
$input = new ArrayInput(array('--locale' => $lang . I18nLoader::ROUTING_PREFIX));
$output = new NullOutput();
try {
$command->run($input, $output);
} catch (\RuntimeException $e) {
$errors .= $e->getMessage() . ". ";
}
}
return $errors;
}
示例10: modify
/**
* modify block settings
*
* @param array $blockinfo a blockinfo structure
* @return output the bock form
*/
public function modify($blockinfo)
{
// Break out options from our content field
$vars = BlockUtil::varsFromContent($blockinfo['content']);
$blockinfo['content'] = '';
// Defaults
if (empty($vars['displaymodules'])) {
$vars['displaymodules'] = 0;
}
// template to use
if (empty($vars['template'])) {
$vars['template'] = 'blocks_block_extmenu.tpl';
}
// create default block variables
if (!isset($vars['blocktitles'])) {
$vars['blocktitles'] = array();
}
if (!isset($vars['links'])) {
$vars['links'] = array();
}
if (!isset($vars['stylesheet'])) {
$vars['stylesheet'] = '';
}
if (!isset($vars['menuid'])) {
$vars['menuid'] = 0;
}
$languages = ZLanguage::getInstalledLanguages();
$userlanguage = ZLanguage::getLanguageCode();
// filter out invalid languages
foreach ($vars['blocktitles'] as $k => $v) {
if (!in_array($k, $languages)) {
unset($vars['blocktitles'][$k]);
unset($vars['links'][$k]);
}
}
// check if the users wants to add a new link via the "Add current url" link in the block
$addurl = FormUtil::getPassedValue('addurl', 0, 'GET');
// or if we come from the normal "edit this block" link
$fromblock = FormUtil::getPassedValue('fromblock', null, 'GET');
$redirect = '';
if ($addurl == 1) {
// set a marker for redirection later on
$newurl = System::serverGetVar('HTTP_REFERER');
$redirect = urlencode($newurl);
$newurl = str_replace(System::getBaseUrl(), '', $newurl);
if (empty($newurl)) {
$newurl = System::getHomepageUrl();
}
foreach ($languages as $singlelanguage) {
$vars['links'][$singlelanguage][] = array('name' => $this->__('--New link--'), 'url' => $newurl, 'title' => $this->__('--New link--'), 'level' => 0, 'parentid' => null, 'image' => '', 'active' => 1);
}
} elseif (isset($fromblock)) {
$redirect = urlencode(System::serverGetVar('HTTP_REFERER'));
}
// add new languages to the blocktitles and link arrays
// we need to know which language has the most links, this language will be the "master"
// for new languages to be added. this ensures that all links for the new language
// are prepared.
$link_master = array();
foreach ($languages as $lang) {
if (isset($vars['links'][$lang]) && count($link_master) < count($vars['links'][$lang])) {
$link_master = $vars['links'][$lang];
}
}
foreach ($languages as $lang) {
// create an empty blocktitle string
if (!array_key_exists($lang, $vars['blocktitles'])) {
$vars['blocktitles'][$lang] = '';
}
if (!array_key_exists($lang, $vars['links'])) {
$vars['links'][$lang] = $link_master;
}
}
// menuitems are sorted by language per default for easier
// access when showing them (which is more often necessary than
// editing them), but for editing them we need them sorted by id
$menuitems = array();
foreach ($vars['links'] as $lang => $langlinks) {
// langlinks now contains an array of links for a certain language
// sorted by key=id
foreach ($langlinks as $linkid => $link) {
// pre zk1.2 check
if (!isset($link['id'])) {
$link['id'] = $linkid;
}
$link['errors'] = array();
$this->checkImage($link);
$menuitems[$linkid][$lang] = $link;
}
}
$vars['links'] = $menuitems;
$this->view->setCaching(Zikula_View::CACHE_DISABLED);
// assign the vars
$this->view->assign($vars)->assign('languages', $languages)->assign('userlanguage', $userlanguage)->assign('redirect', $redirect)->assign('blockinfo', $blockinfo);
//.........这里部分代码省略.........
示例11: new_sub
/**
* Show a form needed to create a new menu item
* @author: Albert Pérez Monfort (aperezm@xtec.cat)
* @param:
* @return: The form needed to create a new item
*/
public function new_sub($args) {
// Get parameters from whatever input we need.
$mid = FormUtil::getPassedValue('mid', isset($args['mid']) ? $args['mid'] : null, 'GETPOST');
// Security check
if (!SecurityUtil::checkPermission('IWmenu::', '::', ACCESS_ADMIN)) {
throw new Zikula_Exception_Forbidden();
}
// Get a menu item
if ($mid != null && $mid > 0) {
$registre = ModUtil::apiFunc('IWmenu', 'admin', 'get', array('mid' => $mid));
if (!$registre) {
return LogUtil::registerError($this->__('Menu option not found'));
}
}
// get the intranet groups
$sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
$grups = ModUtil::func('IWmain', 'user', 'getAllGroups', array('plus' => $this->__('All'),
'less' => ModUtil::getVar('IWmyrole', 'rolegroup'),
'sv' => $sv));
$grups[] = array('id' => '-1',
'name' => $this->__('Unregistered'));
// checks if the module IWwebbox is available in order to include the webbox as a target possibility
$iwwebbox = (ModUtil::available('IWwebbox')) ? true : false;
$filesPath = ModUtil::getVar('IWmain', 'documentRoot') . '/' . ModUtil::getVar('IWmenu', 'imagedir');
$folderExists = (file_exists($filesPath)) ? true : false;
$writeable = (is_writeable($filesPath)) ? true : false;
$folder = $folderExists && $writeable;
// get available languages
$languages = ZLanguage::getInstalledLanguages();
return $this->view->assign('mid', $mid)
->assign('folder', $folder)
->assign('iwwebbox', $iwwebbox)
->assign('initImagePath', ModUtil::getVar('IWmenu', 'imagedir'))
->assign('grups', $grups)
->assign('languages', $languages)
->fetch('IWmenu_admin_new_sub.htm');
}
示例12: newBlockPositions
protected function newBlockPositions()
{
$positions = ModUtil::apiFunc('Blocks', 'user', 'getallpositions');
// create the search block position if doesn't exists
if (!isset($positions['search'])) {
$searchpid = ModUtil::apiFunc('Blocks', 'admin', 'createposition', array('name' => 'search', 'description' => $this->__('Search block')));
} else {
$searchpid = $positions['search']['pid'];
}
// restores the search block if not present
$dbtable = DBUtil::getTables();
$blockscolumn = $dbtable['blocks_column'];
$searchblocks = DBUtil::selectObjectArray('blocks', "$blockscolumn[bkey] = 'Search'");
if (empty($searchblocks)) {
$block = array('bkey' => 'Search', 'collapsable' => 1, 'defaultstate' => 1, 'language' => '', 'mid' => ModUtil::getIdFromName('Search'), 'title' => $this->__('Search box'), 'description' => '', 'positions' => array($searchpid));
$block['bid'] = ModUtil::apiFunc('Blocks', 'admin', 'create', $block);
ModUtil::apiFunc('Blocks', 'admin', 'update', $block);
} else {
// assign the block to the search position
$blockplacement = array('bid' => $searchblocks[0]['bid'], 'pid' => $searchpid);
DBUtil::insertObject($blockplacement, 'block_placements');
}
// create new block positions if they don't exist
if (!isset($positions['header'])) {
$header = ModUtil::apiFunc('Blocks', 'admin', 'createposition', array('name' => 'header', 'description' => $this->__('Header block')));
}
if (!isset($positions['footer'])) {
$footer = ModUtil::apiFunc('Blocks', 'admin', 'createposition', array('name' => 'footer', 'description' => $this->__('Footer block')));
}
if (!isset($positions['bottomnav'])) {
$bottomnav = ModUtil::apiFunc('Blocks', 'admin', 'createposition', array('name' => 'bottomnav', 'description' => $this->__('Bottom navigation block')));
}
if (!isset($positions['topnav'])) {
$topnav = ModUtil::apiFunc('Blocks', 'admin', 'createposition', array('name' => 'topnav', 'description' => $this->__('Top navigation block')));
// Build content for the top navigation menu
$languages = ZLanguage::getInstalledLanguages();
$saveLanguage = ZLanguage::getLanguageCode();
foreach ($languages as $lang) {
ZLanguage::setLocale($lang);
ZLanguage::bindCoreDomain();
$topnavcontent = array();
$topnavcontent['displaymodules'] = '0';
$topnavcontent['stylesheet'] = 'extmenu.css';
$topnavcontent['template'] = 'blocks_block_extmenu_topnav.tpl';
$topnavcontent['blocktitles'][$lang] = $this->__('Top navigation');
$topnavcontent['links'][$lang][] = array('name' => $this->__('Home'), 'url' => '{homepage}', 'title' => $this->__("Go to the site's home page"), 'level' => 0, 'parentid' => null, 'image' => '', 'active' => '1');
$topnavcontent['links'][$lang][] = array('name' => $this->__('My Account'), 'url' => '{Users}', 'title' => $this->__('Go to your account panel'), 'level' => 0, 'parentid' => null, 'image' => '', 'active' => '1');
$topnavcontent['links'][$lang][] = array('name' => $this->__('Site search'), 'url' => '{Search}', 'title' => $this->__('Search this site'), 'level' => 0, 'parentid' => null, 'image' => '', 'active' => '1');
}
ZLanguage::setLocale($saveLanguage);
$topnavcontent = serialize($topnavcontent);
$topnavblock = array('bkey' => 'Extmenu', 'collapsable' => 1, 'defaultstate' => 1, 'language' => '', 'mid' => ModUtil::getIdFromName('Blocks'), 'title' => $this->__('Top navigation'), 'description' => '', 'content' => $topnavcontent, 'positions' => array($topnav));
$topnavblock['bid'] = ModUtil::apiFunc('Blocks', 'admin', 'create', $topnavblock);
ModUtil::apiFunc('Blocks', 'admin', 'update', $topnavblock);
}
}
示例13: url
/**
* Generate a module function URL.
*
* If the module is non-API compliant (type 1) then
* a) $func is ignored.
* b) $type=admin will generate admin.php?module=... and $type=user will generate index.php?name=...
*
* @param string $modname The name of the module.
* @param string $type The type of function to run.
* @param string $func The specific function to run.
* @param array $args The array of arguments to put on the URL.
* @param boolean|null $ssl Set to constant null,true,false $ssl = true not $ssl = 'true' null - leave the current status untouched,
* true - create a ssl url, false - create a non-ssl url.
* @param string $fragment The framgment to target within the URL.
* @param boolean|null $fqurl Fully Qualified URL. True to get full URL, eg for Redirect, else gets root-relative path unless SSL.
* @param boolean $forcelongurl Force ModUtil::url to not create a short url even if the system is configured to do so.
* @param boolean|string $forcelang Force the inclusion of the $forcelang or default system language in the generated url.
*
* @return string Absolute URL for call.
*/
public static function url($modname, $type = null, $func = null, $args = array(), $ssl = null, $fragment = null, $fqurl = null, $forcelongurl = false, $forcelang = false)
{
// define input, all numbers and booleans to strings
$modname = isset($modname) ? (string) $modname : '';
// note - when this legacy is to be removed, change method signature $type = null to $type making it a required argument.
if (!$type) {
if (System::isLegacyMode()) {
$type = 'user';
LogUtil::log('ModUtil::url() - $type is a required argument, you must specify it explicitly.', E_USER_DEPRECATED);
} else {
throw new UnexpectedValueException('ModUtil::url() - $type is a required argument, you must specify it explicitly.');
}
}
// note - when this legacy is to be removed, change method signature $func = null to $func making it a required argument.
if (!$func) {
if (System::isLegacyMode()) {
$func = 'main';
LogUtil::log('ModUtil::url() - $func is a required argument, you must specify it explicitly.', E_USER_DEPRECATED);
} else {
throw new UnexpectedValueException('ModUtil::url() - $func is a required argument, you must specify it explicitly.');
}
}
// validate
if (!System::varValidate($modname, 'mod')) {
return null;
}
// Remove from 1.4
if (System::isLegacyMode() && $modname == 'Modules') {
LogUtil::log(__('Warning! "Modules" module has been renamed to "Extensions". Please update your ModUtil::url() or {modurl} calls with $module = "Extensions".'));
$modname = 'Extensions';
}
//get the module info
$modinfo = self::getInfo(self::getIDFromName($modname));
// set the module name to the display name if this is present
if (isset($modinfo['url']) && !empty($modinfo['url'])) {
$modname = rawurlencode($modinfo['url']);
}
$entrypoint = System::getVar('entrypoint');
$host = System::serverGetVar('HTTP_HOST');
if (empty($host)) {
return false;
}
$baseuri = System::getBaseUri();
$https = System::serverGetVar('HTTPS');
$shorturls = System::getVar('shorturls');
$shorturlsstripentrypoint = System::getVar('shorturlsstripentrypoint');
$shorturlsdefaultmodule = System::getVar('shorturlsdefaultmodule');
// Don't encode URLs with escaped characters, like return urls.
foreach ($args as $v) {
if (!is_array($v)) {
if (strpos($v, '%') !== false) {
$shorturls = false;
break;
}
} else {
foreach ($v as $vv) {
if (is_array($vv)) {
foreach ($vv as $vvv) {
if (!is_array($vvv) && strpos($vvv, '%') !== false) {
$shorturls = false;
break;
}
}
} elseif (strpos($vv, '%') !== false) {
$shorturls = false;
break;
}
}
break;
}
}
// Setup the language code to use
if (is_array($args) && isset($args['lang'])) {
if (in_array($args['lang'], ZLanguage::getInstalledLanguages())) {
$language = $args['lang'];
}
unset($args['lang']);
}
if (!isset($language)) {
$language = ZLanguage::getLanguageCode();
//.........这里部分代码省略.........
示例14: processCategoryDisplayName
/**
* Process the display name of a category
*
* @param array $displayname The display name of the category.
* @param array $name The name of the category.
*
* @return array the processed display name.
*/
public static function processCategoryDisplayName($displayname, $name)
{
$languages = \ZLanguage::getInstalledLanguages();
foreach ($languages as $lang) {
if (!isset($displayname[$lang]) || !$displayname[$lang]) {
$displayname[$lang] = $name;
}
}
return $displayname;
}
示例15: getAll
/**
* Return an array of items to show in the the user's account panel.
*
* @param mixed $args Not used.
*
* @return array Indexed array of items.
*/
public function getAll($args)
{
$items = array();
// Show change password action only if the account record contains a password, and the password is not the
// special marker for an account created without a Users module authentication password.
$pass = UserUtil::getVar('pass');
if (!empty($pass) && ($pass != Users_Constant::PWD_NO_USERS_AUTHENTICATION)) {
// show edit password link
$items['1'] = array(
'url' => ModUtil::url($this->name, 'user', 'changePassword'),
'module'=> $this->name,
'title' => $this->__('Password changer'),
'icon' => 'password.png'
);
}
// show edit email link if configured to manage email address
if ($this->getVar('changeemail', true)) {
$items['2'] = array(
'url' => ModUtil::url($this->name, 'user', 'changeEmail'),
'module'=> $this->name,
'title' => $this->__('E-mail address manager'),
'icon' => 'message.png'
);
}
// check if the users block exists
$blocks = ModUtil::apiFunc('Blocks', 'user', 'getall');
$usersModuleID = ModUtil::getIdFromName($this->name);
$found = false;
if (is_array($blocks)) {
foreach ($blocks as $block) {
if (($block['mid'] == $usersModuleID) && ($block['bkey'] == 'user')) {
$found = true;
break;
}
}
}
if ($found) {
$items['3'] = array(
'url' => ModUtil::url($this->name, 'user', 'usersBlock'),
'module'=> $this->name,
'title' => $this->__('Personal custom block'),
'icon' => 'folder_home.png'
);
}
if (System::getVar('multilingual')) {
if (count(ZLanguage::getInstalledLanguages()) > 1) {
$items['4'] = array(
'url' => ModUtil::url($this->name, 'user', 'changeLang'),
'module'=> $this->name,
'title' => $this->__('Language switcher'),
'icon' => 'locale.png'
);
}
}
$items['5'] = array(
'url' => ModUtil::url($this->name, 'user', 'logout'),
'module'=> $this->name,
'title' => $this->__('Log out'),
'icon' => 'exit.png'
);
// Return the items
return $items;
}