本文整理汇总了PHP中Locales::GetConstString方法的典型用法代码示例。如果您正苦于以下问题:PHP Locales::GetConstString方法的具体用法?PHP Locales::GetConstString怎么用?PHP Locales::GetConstString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Locales
的用法示例。
在下文中一共展示了Locales::GetConstString方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: On_Compiler_BuiltTemplate
function On_Compiler_BuiltTemplate($a_data)
{
// Get Template_Document from event data
$doc = $a_data->doc;
// Find body container
$nodes = $doc->getElementsByTag('CMS_BODY');
// There is only one body node (unless someone messed with templates) so get first element
$node = $nodes[0];
// Iterate over all locales
$langs = '';
foreach (Locales::$m_locales as $locale) {
$langs .= '<a style="margin-left: 5px;" href="?locale=' . $locale . '"><img src="' . Locales::GetConstString('ICO', $locale) . '"/></a>';
}
// Add container div
$langbar = '<div style="position: absolute; right: 0; top: 0; padding: 5px; z-index: 10000;">' . $langs . '</div>';
// Replace
$node->addChild(new Template_TextNode($langbar));
}
示例2: GetPage
public static function GetPage($a_id)
{
$id = Database::Escape($a_id);
$result = Database::Query("SELECT * FROM `" . DB_TBL_PAGES . "` WHERE `id` = '" . $id . "'");
if (!$result->HasData()) {
die('Unknown page id');
}
self::$m_pagename = unserialize($result->GetValue('name'));
$doc = unserialize($result->GetValue('compiled'));
if (!$doc) {
$compiler = new Compiler();
$doc = $compiler->CompilePage($id);
}
// Plugin Hook
$data_object = new stdClass();
$data_object->doc = $doc;
ObjMgr::GetPluginMgr()->ExecuteHook("On_PrepareTemplate", $data_object);
// Title
Content::AddTitle($doc, Locales::GetConstString("PAGE_TITLE", NULL, self::$m_pagename[Locales::$m_locale]));
return $doc->getHtml();
}
示例3: On_PrepareTemplate
public function On_PrepareTemplate($a_data)
{
$doc = $a_data->doc;
// Load all strings
$strings = $doc->getElementsByTag('CMS_STRING');
foreach ($strings as $string) {
$html = "";
switch ($string->getAttribute('type')) {
case "const":
$html = Locales::GetConstString($string->getAttribute("name"));
break;
default:
// Process data in plugin
$plugin = $this->m_pluginmgr->GetPlugin("input_" . $string->getAttribute('type'));
if (!$plugin) {
die('Plugin_cms_string::On_Editor_LoadedPageTemplate(): No valid generators found for string type "' . $string->getAttribute('type') . '".');
}
$html = $plugin->GetContent($string->attributes());
break;
}
$string->replaceWith(new Template_TextNode($html));
}
}
示例4: GetPage
public static function GetPage($a_id)
{
self::$m_pageid = $a_id;
$result = Database::Query("SELECT * FROM `" . DB_TBL_PAGES . "` WHERE `id` = '" . Database::Escape($a_id) . "'");
if (!$result->HasData()) {
die("Page with id #" . $a_id . " not found!");
}
Content::$m_pagename = unserialize($result->GetValue('name'));
$compiler = new Compiler();
$doc = $compiler->CompilePage(self::$m_pageid, COMPILER_MODE_EDITOR);
// Plugin Hook
$data_object = new stdClass();
$data_object->doc = $doc;
ObjMgr::GetPluginMgr()->ExecuteHook("On_PrepareTemplate", $data_object);
//Content::ProcessStrings($doc);
// Add neccessary data
$locale_list = array();
foreach (Locales::$m_locales as $locale) {
$loc_data = array();
$loc_data['name'] = $locale;
$loc_data['ico'] = Locales::GetConstString('ICO', $locale);
$locale_list[] = $loc_data;
}
self::AddData(DATA_LOCALES, array('default' => Locales::$m_locale, 'list' => $locale_list));
self::AddData(DATA_STRINGS, Locales::$m_const_strings[Locales::$m_locale]);
self::GeneratePageData();
self::GenerateModulesData();
self::InsertHeadContent($doc);
self::GenerateToolBar($doc);
// Title
Content::AddTitle($doc, Locales::GetConstString("PAGE_TITLE", NULL, Content::$m_pagename[Locales::$m_locale]));
return $doc->getHtml();
}