本文整理汇总了PHP中Language::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP Language::getInstance方法的具体用法?PHP Language::getInstance怎么用?PHP Language::getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Language
的用法示例。
在下文中一共展示了Language::getInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: renderTeaser
public function renderTeaser()
{
$returnvalue = "";
if (!empty($this->teaserArray))
{
$lang = Language::getInstance();
if ($this->maxcount!=0)
$count = $this->maxcount;
else
$count = count($this->teaserArray);
for ($counter=0; $counter<$count; $counter++)
{
if ($this->settings['Teaser']['Nummeriert']==0)
{
$this->teaserArray[$counter]['counter']="";
}
else
$this->teaserArray[$counter]['counter']=$counter+1;
if (!($this->teaserArray[$counter]['newsdate']=='0000-00-00' || $this->teaserArray[$counter]['newsdate']==""))
{
$date=explode("-",$this->teaserArray[$counter]['newsdate']);
$this->teaserArray[$counter]['newsdate'] = '<span class="date">'.$date[2].".".$date[1].".".$date[0]."</span>";
}
else
$this->teaserArray[$counter]['newsdate']="";
$this->teaserArray[$counter]['article_url'].= ".html";
$tp = new templateParser(PATH.'templates/FrontEnd/TeaserTemplate.htm');
$tp->parseTemplate($this->teaserArray[$counter]);
$returnvalue.=$tp->display();
}
}
return $returnvalue;
}
示例2: insertData
/**
* insert the data
*
* @since 2.4.0
*
* @param array $options options of the data
*/
public function insertData($options = null)
{
$language = Language::getInstance();
/* articles */
Db::forTablePrefix('articles')->create()->set(array('title' => 'Welcome', 'alias' => 'welcome', 'author' => $options['adminUser'], 'text' => file_get_contents('database/html/articles/welcome.phtml'), 'language' => '', 'category' => 1, 'rank' => 1))->save();
/* categories */
Db::forTablePrefix('categories')->create()->set(array('title' => 'Home', 'alias' => 'home', 'author' => $options['adminUser'], 'language' => '', 'rank' => 1))->save();
/* extras */
$extrasArray = array('categories' => array('status' => 1, 'headline' => 1), 'articles' => array('status' => 1, 'headline' => 1), 'comments' => array('status' => 1, 'headline' => 1), 'languages' => array('status' => 0, 'headline' => 1), 'templates' => array('status' => 0, 'headline' => 1), 'footer' => array('status' => 0, 'headline' => 0));
$extrasRank = 0;
/* process extras array */
foreach ($extrasArray as $key => $value) {
Db::forTablePrefix('extras')->create()->set(array('title' => ucfirst($key), 'alias' => $key, 'author' => $options['adminUser'], 'text' => file_get_contents('database/html/extras/' . $key . '.phtml'), 'language' => '', 'headline' => $value['headline'], 'status' => $value['status'], 'rank' => ++$extrasRank))->save();
}
/* groups */
Db::forTablePrefix('groups')->create()->set(array('name' => 'Administrators', 'alias' => 'administrators', 'description' => 'Unlimited access', 'categories' => '1, 2, 3', 'articles' => '1, 2, 3', 'extras' => '1, 2, 3', 'comments' => '1, 2, 3', 'groups' => '1, 2, 3', 'users' => '1, 2, 3', 'modules' => '1, 2, 3', 'settings' => 1, 'filter' => 0))->save();
Db::forTablePrefix('groups')->create()->set(array('name' => 'Members', 'alias' => 'members', 'description' => 'Default members group'))->save();
/* modules */
if (is_dir('modules/CallHome')) {
$callHome = new Modules\CallHome\CallHome();
$callHome->install();
}
/* settings */
$settingsArray = array('language' => 'detect', 'template' => 'default', 'title' => 'Redaxscript', 'author' => null, 'copyright' => null, 'description' => 'Ultra lightweight CMS', 'keywords' => null, 'robots' => 'all', 'email' => $options['adminEmail'], 'subject' => 'Redaxscript', 'notification' => 0, 'charset' => 'utf-8', 'divider' => ' - ', 'time' => 'H:i', 'date' => 'd.m.Y', 'homepage' => '0', 'limit' => 10, 'order' => 'asc', 'pagination' => '1', 'moderation' => '0', 'registration' => '1', 'verification' => '0', 'reminder' => '1', 'captcha' => '0', 'blocker' => '1', 'version' => $language->get('version', '_package'));
/* process settings array */
foreach ($settingsArray as $name => $value) {
Db::forTablePrefix('settings')->create()->set(array('name' => $name, 'value' => $value))->save();
}
/* users */
Db::forTablePrefix('users')->create()->set(array('name' => $options['adminName'], 'user' => $options['adminUser'], 'password' => sha1($options['adminPassword']) . $this->_config->get('dbSalt'), 'email' => $options['adminEmail'], 'description' => 'God admin', 'language' => '', 'groups' => '1'))->save();
}
示例3: __construct
/**
* Init
*/
public function __construct()
{
// Create instance of Language class
$this->language = Language::getInstance();
// Create instance of DB class
$this->db = DB::getInstance();
}
示例4: getLanguage
/**
* Get Text Language
*
* @return Language
*/
public static function getLanguage()
{
if (is_null(static::$lang)) {
static::$lang = Language::getInstance();
}
return static::$lang;
}
示例5: __construct
/**
* Init
*/
public function __construct()
{
// Create instance of Request class
$this->request = Request::getInstance();
// Create instance of Language class
$this->language = Language::getInstance();
// Create instance of View class
$this->view = new View();
}
示例6: __construct
public function __construct()
{
$this->_viewFilePath = NULL;
//$this->_path = PathService::getInstance();
$this->_languageService = Language::getInstance();
$existed = in_array("airy.view", stream_get_wrappers());
if ($existed) {
stream_wrapper_unregister("airy.view");
}
stream_wrapper_register('airy.view', 'StreamHelper');
}
示例7: init
/**
* init the class
*
* @since 2.4.0
*
* @param array $moduleArray custom module setup
*/
public function init($moduleArray = array())
{
/* merge module setup */
if (is_array($moduleArray)) {
static::$_moduleArray = array_merge(static::$_moduleArray, $moduleArray);
}
/* load the language */
if (array_key_exists('alias', static::$_moduleArray)) {
$registry = Registry::getInstance();
$language = Language::getInstance();
$language->load(array('modules/' . static::$_moduleArray['alias'] . '/languages/en.json', 'modules/' . static::$_moduleArray['alias'] . '/languages/' . $registry->get('language') . '.json'));
}
}
示例8: insertData
/**
* insert the data
*
* @since 2.4.0
*
* @param array $optionArray options of the installation
*/
public function insertData($optionArray = null)
{
$language = Language::getInstance();
$language->init();
/* articles */
Db::forTablePrefix('articles')->create()->set(['title' => 'Welcome', 'alias' => 'welcome', 'author' => $optionArray['adminUser'], 'text' => file_get_contents('database/html/articles/welcome.phtml'), 'category' => 1, 'comments' => 1, 'rank' => 1])->save();
/* categories */
Db::forTablePrefix('categories')->create()->set(['title' => 'Home', 'alias' => 'home', 'author' => $optionArray['adminUser'], 'rank' => 1])->save();
/* extras */
$extrasArray = ['categories' => ['category' => null, 'headline' => 1, 'status' => 1], 'articles' => ['category' => null, 'headline' => 1, 'status' => 1], 'comments' => ['category' => null, 'headline' => 1, 'status' => 1], 'languages' => ['category' => null, 'headline' => 1, 'status' => 0], 'templates' => ['category' => null, 'headline' => 1, 'status' => 0], 'teaser' => ['category' => 1, 'headline' => 0, 'status' => 0]];
$extrasRank = 0;
/* process extras array */
foreach ($extrasArray as $key => $value) {
Db::forTablePrefix('extras')->create()->set(['title' => ucfirst($key), 'alias' => $key, 'author' => $optionArray['adminUser'], 'text' => file_get_contents('database/html/extras/' . $key . '.phtml'), 'category' => $value['category'], 'headline' => $value['headline'], 'status' => $value['status'], 'rank' => ++$extrasRank])->save();
}
/* comments */
Db::forTablePrefix('comments')->create()->set(['author' => $optionArray['adminUser'], 'email' => $optionArray['adminEmail'], 'text' => file_get_contents('database/html/comments/hello.phtml'), 'article' => 1, 'rank' => 1])->save();
/* groups */
Db::forTablePrefix('groups')->create()->set(['name' => 'Administrators', 'alias' => 'administrators', 'description' => 'Unlimited access', 'categories' => '1, 2, 3', 'articles' => '1, 2, 3', 'extras' => '1, 2, 3', 'comments' => '1, 2, 3', 'groups' => '1, 2, 3', 'users' => '1, 2, 3', 'modules' => '1, 2, 3', 'settings' => 1, 'filter' => 0])->save();
Db::forTablePrefix('groups')->create()->set(['name' => 'Members', 'alias' => 'members', 'description' => 'Default members group'])->save();
/* modules */
if (is_dir('modules/CallHome')) {
$callHome = new Modules\CallHome\CallHome();
$callHome->install();
}
if (is_dir('modules/Validator')) {
$validator = new Modules\Validator\Validator();
$validator->install();
}
/* settings */
$settingArray = ['language' => 'detect', 'template' => 'default', 'title' => $language->get('name', '_package'), 'author' => $optionArray['adminName'], 'copyright' => null, 'description' => $language->get('description', '_package'), 'keywords' => null, 'robots' => null, 'email' => $optionArray['adminEmail'], 'subject' => $language->get('name', '_package'), 'notification' => 0, 'charset' => 'utf-8', 'divider' => ' - ', 'time' => 'H:i', 'date' => 'd.m.Y', 'homepage' => 0, 'limit' => 10, 'order' => 'asc', 'pagination' => 1, 'registration' => 1, 'verification' => 0, 'recovery' => 1, 'moderation' => 0, 'captcha' => 0, 'version' => $language->get('version', '_package')];
/* process settings array */
foreach ($settingArray as $name => $value) {
Db::forTablePrefix('settings')->create()->set(['name' => $name, 'value' => $value])->save();
}
/* users */
$passwordHash = new Hash(Config::getInstance());
$passwordHash->init($optionArray['adminPassword']);
Db::forTablePrefix('users')->create()->set(['name' => $optionArray['adminName'], 'user' => $optionArray['adminUser'], 'password' => $passwordHash->getHash(), 'email' => $optionArray['adminEmail'], 'description' => 'God admin', 'groups' => '1'])->save();
}
示例9: unset
unset($glob);
$GLOBALS['config']->merge('config', '', $config_default);
// Initialize debug
$GLOBALS['debug'] = Debug::getInstance();
//Initialize sessions
$GLOBALS['session'] = Session::getInstance();
//Initialize Smarty
$GLOBALS['smarty'] = new Smarty();
$GLOBALS['smarty']->muteExpectedErrors();
$GLOBALS['smarty']->error_reporting = E_ALL & ~E_NOTICE & ~E_WARNING;
$GLOBALS['smarty']->compile_dir = CC_SKIN_CACHE_DIR;
$GLOBALS['smarty']->config_dir = CC_SKIN_CACHE_DIR;
$GLOBALS['smarty']->cache_dir = CC_SKIN_CACHE_DIR;
$GLOBALS['smarty']->debugging = false;
//Initialize language
$GLOBALS['language'] = Language::getInstance();
//Initialize hooks
$GLOBALS['hooks'] = HookLoader::getInstance();
//Initialize SEO
$GLOBALS['seo'] = SEO::getInstance();
if (isset($_GET['seo_path']) && !empty($_GET['seo_path'])) {
$_GET['seo_path'] = preg_replace('/(\\/\\~[a-z0-9]{1,}\\/)/', '', $_GET['seo_path']);
// Remove /~username/ from seo_path
$GLOBALS['seo']->getItem($_GET['seo_path']);
}
//Initialize SSL
$GLOBALS['ssl'] = SSL::getInstance();
//Initialize GUI
$GLOBALS['gui'] = GUI::getInstance();
//Initialize Taxes
$GLOBALS['tax'] = Tax::getInstance();
示例10: __construct
/**
* Init
*/
public function __construct()
{
// Debug mode
if (RENDERPAGE_DEBUG) {
self::$forceCompile = true;
}
// Create instance of Language class
$this->language = Language::getInstance();
}
示例11: language
/**
* language
*
* @since 2.6.0
*
* @param string $key
* @param string $index
*
* @return string
*/
public static function language($key = null, $index = null)
{
$language = Language::getInstance();
return $language->get($key, $index);
}
示例12: showBreadCrumb
private function showBreadCrumb($leaf,$id)
{
$returnvalue=NULL;
$languageArray = Language::getInstance()->getLanguageArray();
if ($this->lang==1)
$language="";
else
$language = "";//$languageArray[$this->lang]['Name']."/";
if (empty($leaf))
{
return "";
}
else
{
$ulshow=false;
$returnvalue2=NULL;
for ($zaehler=0; $zaehler< count($leaf);$zaehler++ )
{
//echo $leaf[$zaehler]['article_id'].$leaf[$zaehler]['article_linktext'];
if ($leaf[$zaehler]['mark']==true && $leaf[$zaehler]['article_url']!='')
{
$ulshow=true;
$returnvalue2.="<li>"."";
$inaktive = false;
if (isset($this->flavourArray[$id]) && $leaf[$zaehler]['article_id']==$this->flavourArray[$id])
$inaktive=true;
if (isset($this->flavourArray2[$id])&& $leaf[$zaehler]['article_id']==$this->flavourArray2[$id])
$inaktive=true;
// if ($leaf[$zaehler]['article_id']==1000023)
// echo $leaf[$zaehler]['article_id'];
if ($leaf[$zaehler]['article_type']==4 && !empty($leaf[$zaehler]['alias_external_link']))
{
$returnvalue2.="<a href=\"".$leaf[$zaehler]['alias_external_link']."\" target=\"_blank\">".$leaf[$zaehler]['article_linktext']."</a>";
}
else
{
if ($id==$leaf[$zaehler]['article_id'] || $inaktive)
{
$parameter = "";
if (isset($leaf[$zaehler]['link_parameter']))
{
if (($leaf[$zaehler]['mark'] && !isset($leaf[$zaehler]['module_mark'])) || (isset($leaf[$zaehler]['module_mark'])&& $leaf[$zaehler]['module_mark']))
{
if ($this->settings['Menuestruktur']['showInactiveWithLink'])
$returnvalue2.='<span class="inactive"><a href="'.$language.($leaf[$zaehler]['article_url']=="/"?"/\"":$leaf[$zaehler]['article_url'].".html".$parameter."\"").'>'.$leaf[$zaehler]['article_linktext']."</a></span>";
else
$returnvalue2.='<span class="inactive">'.$leaf[$zaehler]['article_linktext']."</span>";
}
else
{
$parameter="?".$leaf[$zaehler]['link_parameter'];
$returnvalue2.="<a href=\"".$language.($leaf[$zaehler]['article_url']=="/"?"/\"":$leaf[$zaehler]['article_url'].".html".$parameter."\"").">".$leaf[$zaehler]['article_linktext']."</a>";
}
}
else
{
if ($this->settings['Menuestruktur']['showInactiveWithLink'])
$returnvalue2.='<span class="inactive"><a href="'.$language.($leaf[$zaehler]['article_url']=="/"?"/\"":$leaf[$zaehler]['article_url'].".html".$parameter."\"").'>'.$leaf[$zaehler]['article_linktext']."</a></span>";
else
$returnvalue2.='<span class="inactive">'.$leaf[$zaehler]['article_linktext']."</span>";
}
}
else
{
$parameter = "";
if (isset($temp[$zaehler]['link_parameter']))
$parameter="?".$temp[$zaehler]['link_parameter'];
$returnvalue2.="<a href=\"".$language.($leaf[$zaehler]['article_url']=="/"?"/\"":$leaf[$zaehler]['article_url'].".html\"").">".$leaf[$zaehler]['article_linktext']."</a>";
}
}
if (isset($leaf[$zaehler]['show_navi']) && $leaf[$zaehler]['show_navi'])
$returnvalue2.=$this->showBreadCrumb($leaf[$zaehler]['Child'], $id);
$returnvalue2.="</li>"."";
}
}
if ($ulshow)
{
$returnvalue.="<ul>";
$returnvalue.=$returnvalue2;
$returnvalue.="</ul>"."";
}
return $returnvalue;
}
}
示例13: updateArticleinDatabase
public function updateArticleinDatabase($myArray)
{
require_once(PATH."lib/article/GenerateInsertUpdateArray.php");
Logger::getInstance()->Log('updateArticleinDatabase', LOG_ABLAUF);
// [-] 22.07.2008 JA
$time=getdate();
$myArray['last_modified']=$time['year']."-".$time['mon']."-".$time['mday'];
if (isset($myArray['facebook']))
$myArray['facebook']=1;
else
$myArray['facebook']=0;
if (isset($myArray['twitter']))
$myArray['twitter']=1;
else
$myArray['twitter']=0;
if (isset($myArray['viewable']))
$myArray['viewable']=1;
else
$myArray['viewable']=0;
if (isset($myArray['published']))
$myArray['published']=1;
else
$myArray['published']=0;
Logger::getInstance()->Log("updateArticleinDatabase", LOG_ABLAUF);
Logger::getInstance()->Log($myArray, LOG_ABLAUF);
AGDO::getInstance()->AutoExecute(AGDO::getInstance()->getDBConnector()->getArticleTable(), $myArray, 'UPDATE', 'article_id = '.$myArray['ID']);
/*$SQLQuery="UPDATE `".AGDO::getInstance()->getDBConnector()->getArticleTable()."` SET " .(isset($myArray['publish'])?"`published` = '1'":"`published` = '0'")." , "
.(isset($myArray['viewable'])?"`viewable` = '1'":"`viewable` = '0'")
.(", `last_modified` = '".$today."'")
." WHERE `article_id` = '".$myArray['ID']."'";
$temp=AGDO::getInstance()->Execute($SQLQuery);*/
for ($counter=1; $counter <= Language::getInstance()->getNumberOfLanguages(); $counter++)
{
$myArray['article_id']=$myArray['ID'];
$generater = new GenerateInsertUpdateArray();
//$insertArray = $this->generateInsertUpdateArray($myArray,$this->languageArray[$counter]['short'], $counter, 'UPDATE');
$insertArray = $generater->generate($myArray,$this->languageArray[$counter]['short'], $counter, 'UPDATE');
Logger::getInstance()->Log('insertArchive', LOG_ABLAUF);
$article = AGDO::getInstance()->GetAll("SELECT * FROM ".AGDO::getInstance()->getDBConnector()->getDescriptionTable()." WHERE article_id = ".$myArray['ID']." and language_id = ".$counter);
AGDO::getInstance()->AutoExecute(AGDO::getInstance()->getDBConnector()->getArchiveTable(), $article['0'], 'INSERT');
AGDO::getInstance()->AutoExecute(AGDO::getInstance()->getDBConnector()->getDescriptionTable(),$insertArray,'UPDATE', '`article_id` = '.$myArray['ID'].' AND language_id = '.$counter);
if (isset($myArray['kopfbild_rekursiv_'.$this->languageArray[$counter]['short']]))
$this->updateRecursive($myArray['ID'], "kopfbild", $myArray['kopfbild_'.$this->languageArray[$counter]['short']], $counter);
if (isset($myArray['article_teaser_link_1_rekursiv_'.$this->languageArray[$counter]['short']])&& isset($myArray['article_teaser_link_1_'.$this->languageArray[$counter]['short']]))
$this->updateRecursive($myArray['ID'], "article_teaser_link_1", $myArray['article_teaser_link_1_'.$this->languageArray[$counter]['short']], $counter);
if (isset($myArray['article_teaser_link_2_rekursiv_'.$this->languageArray[$counter]['short']])&& isset($myArray['article_teaser_link_1_'.$this->languageArray[$counter]['short']]))
$this->updateRecursive($myArray['ID'], "article_teaser_link_2", $myArray['article_teaser_link_2_'.$this->languageArray[$counter]['short']], $counter);
if (isset($myArray['article_teaser_link_3_rekursiv_'.$this->languageArray[$counter]['short']])&& isset($myArray['article_teaser_link_1_'.$this->languageArray[$counter]['short']]))
$this->updateRecursive($myArray['ID'], "article_teaser_link_3", $myArray['article_teaser_link_3_'.$this->languageArray[$counter]['short']], $counter);
if (isset($myArray['article_teaser_link_4_rekursiv_'.$this->languageArray[$counter]['short']])&& isset($myArray['article_teaser_link_1_'.$this->languageArray[$counter]['short']]))
$this->updateRecursive($myArray['ID'], "article_teaser_link_4", $myArray['article_teaser_link_4_'.$this->languageArray[$counter]['short']], $counter);
if (isset($myArray['template_rekursiv']))
$this->updateRecursive($myArray['ID'], "template", $myArray['template'], $counter);
if (isset($myArray['farbe_rekursiv_de']))
$this->updateRecursive($myArray['ID'], "farbe", $myArray['farbe_de'], $counter);
if (isset($myArray['Additional_Content_rekursiv_'.$this->languageArray[$counter]['short']]))
{
if (isset($myArray['Additional_Content_'.$this->languageArray[$counter]['short']]))
$this->updateRecursive($myArray['ID'], "Additional_Content", $myArray['Additional_Content_'.$this->languageArray[$counter]['short']], $counter);
else
$this->updateRecursive($myArray['ID'], "Additional_Content", 0, $counter);
}
if (isset($myArray['Modul_rekursiv_'.$this->languageArray[$counter]['short']]))
{
$this->updateRecursive($myArray['ID'], "Module", $myArray['Modul_'.$this->languageArray[$counter]['short']], $counter);
}
if (isset($myArray['social_media_recursive']))
{
if (isset($myArray['facebook']) && $myArray['facebook']==1)
{
$this->updateRecursiveArticleTable($myArray['ID'], 'facebook', 1 , $counter);
$this->updateRecursive($myArray['ID'], 'facebook_type', $myArray['facebook_type_'.$this->languageArray[$counter]['short']], $counter);
}
else
{
$this->updateRecursiveArticleTable($myArray['ID'], 'facebook', 0 , $counter);
$this->updateRecursive($myArray['ID'], 'facebook_type', $myArray['facebook_type_'.$this->languageArray[$counter]['short']], $counter);
}
if (isset($myArray['twitter']) && $myArray['twitter']==1)
$this->updateRecursiveArticleTable($myArray['ID'], 'twitter', 1 , $counter);
else
$this->updateRecursiveArticleTable($myArray['ID'], 'twitter', 0 , $counter);
}
if (isset($myArray['login_rekursiv']))
{
if (isset($myArray['GroupID']))
$this->updateRecursive($myArray['ID'], "GroupID", $myArray['GroupID'], $counter);
else
$this->updateRecursive($myArray['ID'], "GroupID", 0, $counter);
if (isset($myArray['UserID']))
$this->updateRecursive($myArray['ID'], "UserID", $myArray['UserID'], $counter);
else
$this->updateRecursive($myArray['ID'], "UserID", 0, $counter);
}
//.........这里部分代码省略.........
示例14: define
<?php
try {
define('VERSION', '1.0.0a');
chdir(__DIR__);
require_once 'core/helper/error.php';
require_once 'core/autoloader.class.php';
if (file_exists('config.php')) {
require_once 'config.php';
}
$autoloader = Autoloader::getInstance();
$registry = Registry::getInstance();
$registry['load'] = $autoloader;
$registry['request'] = Request::getInstance();
$registry['response'] = Response::getInstance();
$registry['language'] = Language::getInstance();
$router = Router::getInstance();
$router->dispatch();
$registry->response->output();
} catch (Exception $e) {
ob_end_clean();
$backtrace = $e->getTrace();
include 'core/helper/error.tpl';
}
示例15: breadcrumb
/**
* breadcrumb
*
* @since 2.3.0
*
* @return string
*/
public static function breadcrumb()
{
$breadcrumb = new Breadcrumb(Registry::getInstance(), Language::getInstance());
$breadcrumb->init(array('className' => array('list' => 'list_breadcrumb', 'divider' => 'divider')));
return $breadcrumb->render();
}