本文整理汇总了PHP中ZLanguage::bindCoreDomain方法的典型用法代码示例。如果您正苦于以下问题:PHP ZLanguage::bindCoreDomain方法的具体用法?PHP ZLanguage::bindCoreDomain怎么用?PHP ZLanguage::bindCoreDomain使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZLanguage
的用法示例。
在下文中一共展示了ZLanguage::bindCoreDomain方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: time
<?php
//1. Init zikula engine
$time = time();
include 'lib/bootstrap.php';
$core->init();
ModUtil::load('IWmain', 'admin');
$langcode = ModUtil::getVar('ZConfig', 'language_i18n');
ZLanguage::setLocale($langcode);
ZLanguage::bindCoreDomain();
$dom = ZLanguage::getModuleDomain('IWmain');
//2. Checking cron password
$passwordActive = ModUtil::getVar('IWmain','cronPasswordActive');
if ($passwordActive) {
$passwordString = ModUtil::getVar('IWmain','cronPasswordString');
$passwordSended = FormUtil::getPassedValue('password',null,'GET');
if ($passwordString !== $passwordSended) {
print __("You can't execute iwcron", $dom);
cronShutdown();
}
}
//3. Cron actions
$sv = ModUtil::func('IWmain', 'user', 'genSecurityValue');
$lastCronSuccessfull = ModUtil::func('IWmain', 'user', 'userGetVar', array('uid' => -100,
'name' => 'lastCronSuccessfull',
'module' => 'IWmain_cron',
'sv' => $sv));
$dateTimeFrom = (int)$lastCronSuccessfull;
示例2: 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);
}
}
示例3: display
/**
* Display the block
*
* @param row blockinfo array
*/
public function display($blockinfo)
{
// security check
if (!SecurityUtil::checkPermission('Languageblock::', "$blockinfo[title]::", ACCESS_OVERVIEW)) {
return;
}
// if the site's not an ML site don't display the block
if (!System::getVar('multilingual')) {
return;
}
$currentlanguage = ZLanguage::getLanguageCode();
$languages = ZLanguage::getInstalledLanguages();
// Get current content
$vars = BlockUtil::varsFromContent($blockinfo['content']);
$vars['bid'] = $blockinfo['bid'];
// Defaults
if (empty($vars['format'])) {
$vars['format'] = 2;
}
if (empty($vars['fulltranslation'])) {
$vars['fulltranslation'] = 1;
}
if ($vars['fulltranslation'] == 2) {
foreach ($languages as $code) {
// bind all languages, we'll need them later.
ZLanguage::setLocale($code);
ZLanguage::bindCoreDomain();
}
ZLanguage::setLocale($currentlanguage);
}
if (!isset($vars['languages']) || empty($vars['languages']) || !is_array($vars['languages'])) {
$vars['languages'] = $this->getAvailableLanguages($vars['fulltranslation']);
}
$this->view->setCaching(Zikula_View::CACHE_DISABLED);
// assign the block vars
$this->view->assign($vars);
$this->view->assign('currentlanguage', $currentlanguage);
// set a block title
if (empty($blockinfo['title'])) {
$blockinfo['title'] = $this->__('Choose a language');
}
// prepare vars for ModUtil::url
$module = FormUtil::getPassedValue('module', null, 'GET', FILTER_SANITIZE_STRING);
$type = FormUtil::getPassedValue('type', null, 'GET', FILTER_SANITIZE_STRING);
$func = FormUtil::getPassedValue('func', null, 'GET', FILTER_SANITIZE_STRING);
$get = $_GET;
if (isset($get['module'])) {
unset($get['module']);
}
if (isset($get['type'])) {
unset($get['type']);
}
if (isset($get['func'])) {
unset($get['func']);
}
if (isset($get['lang'])) {
unset($get['lang']);
}
if (System::isLegacyMode()) {
if (!isset($type)) {
$type = 'user';
}
if (!isset($func)) {
$func = 'main';
}
}
// make homepage calculations
$shorturls = System::getVar('shorturls', false);
if ($shorturls) {
$homepage = System::getBaseUrl().System::getVar('entrypoint', 'index.php');
$forcefqdn = true;
} else {
$homepage = System::getVar('entrypoint', 'index.php');
$forcefqdn = false;
}
// build URLS
$urls = array();
foreach ($languages as $code) {
if (isset($module) && isset($type) && isset($func)) {
//.........这里部分代码省略.........