本文整理汇总了PHP中getLanguage函数的典型用法代码示例。如果您正苦于以下问题:PHP getLanguage函数的具体用法?PHP getLanguage怎么用?PHP getLanguage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getLanguage函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getImgSrc
function getImgSrc($array = "")
{
global $web_img_upload_path;
// return $array['filename'];
// mydump ($array);
if ($array['filename'] == "") {
if (!is_array($array)) {
$array = array("imgTag" => imgTagThumb, "type" => "article");
}
$array['filename'] = "archive/no_image_" . getLanguage() . ".gif";
}
// different types can have different settings
switch (strtolower($array['type'])) {
case tOffersType_Article:
case "article":
case tOffersType_Service:
case "service":
$addition = "";
if (strtolower(substr($array["imgTag"], 0, 6)) == "imgtag") {
$tag = $array["imgTag"];
eval("\$addition = {$tag};");
} else {
$addition = $array["imgTag"];
}
$path = $web_img_upload_path;
// add special file code for different size images in articles
$file = $web_img_upload_path . "/" . ereg_replace("(.[a-z0-9]{2,5})\$", $addition . "\\1", $array["filename"]);
break;
default:
$path = $web_img_upload_path;
$file = $path . "/" . $array["filename"];
}
// switch
return $file;
}
示例2: __construct
public function __construct()
{
$this->language = getLanguage();
$this->pdo = new PDO('mysql:host=' . DATABASE_HOST . ';dbname=' . DATABASE_NAME, DATABASE_USERNAME, DATABASE_PASSWORD);
global $router;
$this->router = $router;
$this->userProfile = new stdClass();
$this->userProfile->type = 'guest';
if (isset($_COOKIE['user_id'])) {
$id = $_COOKIE['user_id'];
$sql = "SELECT * FROM users WHERE `id`=:id LIMIT 1";
$query = $this->pdo->prepare($sql);
$query->bindValue(':id', $id);
$query->execute();
$user = $query->fetch(PDO::FETCH_OBJ);
if ($user != false) {
$this->userId = $user->id;
$this->userProfile = $user;
$this->userProfile->name = ucfirst($user->first_name) . ' ' . ucfirst($user->last_name);
$birthday = strtotime($this->userProfile->birthday);
$this->userProfile->age = date('md', $birthday) > date('md') ? date('Y') - date('Y', $birthday) - 1 : date('Y') - date('Y', $birthday);
$this->setUserChildren();
// TO-DO..
// Current stuff (what's the current height, weight) to particular date...
} else {
setcookie('user_id', '', time() - 3600, '/');
// TO-DO..set the path right
}
}
}
示例3: show
public function show()
{
require_once _base_ . '/lib/lib.navbar.php';
require_once _lms_ . '/lib/lib.middlearea.php';
$ma = new Man_MiddleArea();
$block_list = array();
//if($ma->currentCanAccessObj('user_details_short')) $block_list['user_details_short'] = true;
if ($ma->currentCanAccessObj('user_details_full')) {
$block_list['user_details_full'] = true;
}
if ($ma->currentCanAccessObj('credits')) {
$block_list['credits'] = true;
}
if ($ma->currentCanAccessObj('news')) {
$block_list['news'] = true;
}
$query_home = "SELECT title, description FROM learning_webpages where publish=1 and in_home = 1 AND language = '" . getLanguage() . "' LIMIT 1";
$re_home = sql_query($query_home);
list($titolo, $descrizione) = sql_fetch_row($re_home);
if (!empty($block_list)) {
$this->render('_tabs_block', array('active_tab' => 'home', '_content' => "<div id=\"tabhome_title\"><h1>" . $titolo . "</h1></div><div id=\"tabhome_description\">" . $descrizione . "</div>", 'block_list' => $block_list));
} else {
$this->render('_tabs', array('active_tab' => 'home', '_content' => "<div id=\"tabhome_title\"><h1>" . $titolo . "</h1></div><div id=\"tabhome_description\">" . $descrizione . "</div>"));
}
}
示例4: run
public function run()
{
require_once _lms_ . '/lib/lib.kbres.php';
$kbres = new KbRes();
$data = false;
if ($this->res_id > 0) {
$data = $kbres->getResource($this->res_id, true, true);
} else {
if (!empty($this->r_item_id) && !empty($this->r_type)) {
$data = $kbres->getResourceFromItem($this->r_item_id, $this->r_type, $this->r_env, true, true);
}
}
if ($data == false) {
$data = array('res_id' => 0, 'r_name' => '', 'original_name' => '', 'r_desc' => '', 'r_item_id' => $this->r_item_id, 'r_type' => $this->r_type, 'r_env' => $this->r_env, 'r_env_parent_id' => $this->r_env_parent_id, 'r_param' => $this->r_param, 'r_alt_desc' => '', 'r_lang' => !empty($this->language) ? $this->language : getLanguage(), 'force_visible' => 0, 'is_mobile' => 0, 'folders' => array(), 'tags' => array());
}
if (!empty($this->original_name)) {
$data['original_name'] = $this->original_name;
}
$c_folders = array_keys($data['folders']);
unset($data['folders']);
$c_tags = $data['tags'];
unset($data['tags']);
$json = new Services_JSON();
$this->render('kbcategorize', array('selected_node' => $this->_getSelectedNode(), 'back_url' => $this->back_url, 'form_url' => $this->form_url, 'form_extra_hidden' => $this->form_extra_hidden, 'data' => $data, 'c_folders' => $c_folders, 'c_tags_json' => $json->encode(array_values($c_tags)), 'all_tags_json' => $json->encode(array_values($kbres->getAllTags()))));
}
示例5: l
/**
* get language text
* @param String $paramText text to convert
* @param array/string $paramArgs sprintf args
*/
function l($paramText, $paramArgs = null)
{
if (!function_exists('getLanguage')) {
return "!!LANGUAGE_NOT_LOADED!!";
}
return getLanguage()->getText($paramText, $paramArgs);
}
示例6: __
function __($str = '')
{
$lang = getLanguage();
if (file_exists(APPLICATION_PATH . 'languages/' . $lang . '.php')) {
$translations = (include APPLICATION_PATH . 'languages/' . $lang . '.php');
if (isset($translations) && isset($translations[$str])) {
$str = $translations[$str];
}
}
return $str;
}
示例7: news
/**
* The news link for the home pages
* @return <html>
*/
public static function news($hnumber = 2)
{
$html = '<div id="news">';
$textQuery = "\r\n\t\tSELECT idNews, publish_date, title, short_desc\r\n\t\tFROM " . $GLOBALS['prefix_lms'] . "_news\r\n\t\tWHERE language = '" . getLanguage() . "'\r\n\t\tORDER BY important DESC, publish_date DESC\r\n\t\tLIMIT 0," . Get::sett('visuNewsHomePage');
//do query
$result = sql_query($textQuery);
if (sql_num_rows($hnumber)) {
$html .= '<p>' . Lang::set('_NO_CONTENT', 'login') . '</p>';
}
while (list($idNews, $publish_date, $title, $short_desc) = sql_fetch_row($result)) {
$html .= '<h' . $hnumber . '>' . '<a href="index.php?modname=login&op=readnews&idNews=' . $idNews . '">' . $title . '</a>' . '</h' . $hnumber . '>' . '<p class="news_textof">' . '<span class="news_data">' . Format::date($publish_date) . ' - </span>' . $short_desc . '</p>';
}
$html .= '</div>';
return $html;
}
示例8: loadNewsBlock
function loadNewsBlock()
{
$lang = DoceboLanguage::createInstance('login');
$textQuery = "\r\n\tSELECT idNews, publish_date, title, short_desc \r\n\tFROM " . $GLOBALS['prefix_lms'] . "_news \r\n\tWHERE language = '" . getLanguage() . "'\r\n\tORDER BY important DESC, publish_date DESC";
$result = sql_query($textQuery);
$html = '<div class="home_news_block">' . '<h1>' . $lang->def('_NEWS') . '</h1>';
while (list($idNews, $publish_date, $title, $short_desc) = sql_fetch_row($result)) {
$html .= '<h2>' . '<a href="index.php?modname=login&op=readnews&idNews=' . $idNews . '">' . $title . '</a></h2>' . '<p><span class="news_data">' . $lang->def('_DATE') . ' ' . Format::date($publish_date, 'date') . ': </span>' . $short_desc . '</p>';
}
if (mysql_num_rows($result) == 0) {
$html .= $lang->def('_NO_CONTENT');
}
$html .= '</div>';
return $html;
}
示例9: news
function news()
{
$textQuery = "\r\n\tSELECT idNews, publish_date, title, short_desc\r\n\tFROM " . $GLOBALS['prefix_lms'] . "_news\r\n\tWHERE language = '" . getLanguage() . "'\r\n\tORDER BY important DESC, publish_date DESC";
$lang = DoceboLanguage::createInstance('login');
$GLOBALS['page']->add(getTitleArea($lang->def('_NEWS'), 'news', $lang->def('_NEWS')) . '<div class="news_block">' . getBackUi('index.php', $lang->def('_BACK')), 'content');
//do query
$result = sql_query($textQuery);
while (list($idNews, $publish_date, $title, $short_desc) = sql_fetch_row($result)) {
$GLOBALS['page']->add('<div class="news_title">' . '<a href="index.php?modname=login&op=readnews&idNews=' . $idNews . '">' . $title . '</a></div>' . '<div class="news_textof">' . '<span class="news_data">' . $lang->def('_DATE') . ' ' . $publish_date . ' - </span>' . $short_desc . '</div>', 'content');
}
if (mysql_num_rows($result) == 0) {
$GLOBALS['page']->add($lang->def('_NO_CONTENT'), 'content');
} elseif (mysql_num_rows($result) >= 3) {
$GLOBALS['page']->add(getBackUi('index.php', $lang->def('_BACK')) . '</div>', 'content');
}
$GLOBALS['page']->add('</div>', 'content');
}
示例10: mycompetences
function mycompetences(&$url)
{
checkPerm('view');
$html = "";
$html .= getTitleArea(Lang::t('_COMPETENCES'), 'competences');
$html .= '<div class="std_block">';
$cmodel = new CompetencesAdm();
$fmodel = new FunctionalrolesAdm();
$id_user = getLogUserId();
$ucomps = $cmodel->getUserCompetences($id_user);
$rcomps = $fmodel->getUserRequiredCompetences($id_user);
$ucomps_info = $cmodel->getCompetencesInfo(array_keys($ucomps));
$language = getLanguage();
$_typologies = $cmodel->getCompetenceTypologies();
$_types = $cmodel->getCompetenceTypes();
$icon_actv = '<span class="ico-sprite subs_actv"><span>' . Lang::t('_COMPETENCE_OBTAINED', 'competences') . '</span></span>';
$icon_req = '<span class="ico-sprite subs_actv"><span>' . Lang::t('_MANDATORY', 'competences') . '</span></span>';
//*******************
require_once _base_ . '/lib/lib.table.php';
$table = new Table(Get::sett('visuItem'), Lang::t('_COMPETENCES'), Lang::t('_COMPETENCES'));
$style_h = array('', '', 'image', 'image', 'image', 'image', 'image');
$label_h = array(Lang::t('_NAME', 'competences'), Lang::t('_TYPOLOGY', 'competences'), Lang::t('_TYPE', 'standard'), Lang::t('_SCORE', 'competences'), Lang::t('_DATE_LAST_COMPLETE', 'subscribe'), Lang::t('_COMPETENCES_REQUIRED', 'competences'));
$table->addHead($label_h, $style_h);
foreach ($ucomps_info as $id_competence => $cinfo) {
$line = array();
$line[] = $cinfo->langs[$language]['name'];
$line[] = $_typologies[$cinfo->typology];
$line[] = $_types[$cinfo->type];
$line[] = $cinfo->type == 'score' ? '<b>' . $ucomps[$id_competence]->score_got . '</b>' : $icon_actv;
$line[] = Format::date($ucomps[$id_competence]->last_assign_date, 'datetime');
$line[] = array_key_exists($id_competence, $rcomps) ? $icon_req : '';
$table->addBody($line);
}
$html .= $table->getTable();
$html .= '</div>';
$html .= Form::openForm('beck_url', 'index.php');
$html .= Form::openButtonSpace();
$html .= Form::getButton('close', 'close', Lang::t('_CLOSE', 'standard'));
$html .= Form::closeButtonSpace();
$html .= Form::closeform();
cout($html, 'content');
}
示例11: __construct
public function __construct($viewFile = null)
{
if (null !== $viewFile) {
$this->_module = 'www';
if (strstr($viewFile, DS)) {
$this->_viewFile = $viewFile;
} else {
$file = CACHE_PATH . DS . md5($this->_viewFile . time() . Utils::UUID()) . '.fake';
File::create($file);
$fp = fopen($file, 'a');
fwrite($fp, '<?php echo $this->content; ?>');
$this->_viewFile = $file;
}
} else {
$route = Utils::get('appDispatch');
/* polymorphism */
$route = !$route instanceof Container ? container()->getRoute() : $route;
if ($route instanceof Container) {
$module = $route->getModule();
$controller = $route->getController();
$action = $route->getAction();
$this->_module = $module;
$isTranslate = Utils::get('isTranslate');
if (true === $isTranslate) {
$lng = getLanguage();
if (true === container()->getMultiSite()) {
$this->_viewFile = APPLICATION_PATH . DS . SITE_NAME . DS . 'modules' . DS . $module . DS . 'views' . DS . 'scripts' . DS . Inflector::lower($controller) . DS . Inflector::lower($lng) . DS . Inflector::lower($action) . '.phtml';
} else {
$this->_viewFile = APPLICATION_PATH . DS . 'modules' . DS . SITE_NAME . DS . $module . DS . 'views' . DS . 'scripts' . DS . Inflector::lower($controller) . DS . Inflector::lower($lng) . DS . Inflector::lower($action) . '.phtml';
}
} else {
if (true === container()->getMultiSite()) {
$this->_viewFile = APPLICATION_PATH . DS . SITE_NAME . DS . 'modules' . DS . $module . DS . 'views' . DS . 'scripts' . DS . Inflector::lower($controller) . DS . Inflector::lower($action) . '.phtml';
} else {
$this->_viewFile = APPLICATION_PATH . DS . 'modules' . DS . SITE_NAME . DS . $module . DS . 'views' . DS . 'scripts' . DS . Inflector::lower($controller) . DS . Inflector::lower($action) . '.phtml';
}
}
}
}
Utils::set('appView', $this);
Utils::set('showStats', true);
}
示例12: isLanguageKey
function isLanguageKey($key, $language = null)
{
global $lang;
if (!$language) {
$language = getLanguage();
}
if (!count($lang)) {
$directoryHandler = dir("language/" . $language);
while (($fileEntry = $directoryHandler->read()) !== false) {
if ($fileEntry != '.' && $fileEntry != '..' && strpos($fileEntry, ".php")) {
include_once "language/" . $language . "/" . $fileEntry;
}
}
$directoryHandler->close();
// Uncomment if you're not in UTF-8
// $lang = changeCharset($lang);
}
if (array_key_exists($key, $lang)) {
return true;
}
return false;
}
示例13: getLanguage
<?php
include "../includes/config.php";
include "../includes/classes.php";
include getLanguage(null, !empty($_GET['lang']) ? $_GET['lang'] : $_COOKIE['lang'], 2);
session_start();
$db = new mysqli($CONF['host'], $CONF['user'], $CONF['pass'], $CONF['name']);
if ($db->connect_errno) {
echo "Failed to connect to MySQL: (" . $db->connect_errno . ") " . $db->connect_error;
}
$db->set_charset("utf8");
$resultSettings = $db->query(getSettings());
$settings = $resultSettings->fetch_assoc();
if (isset($_SESSION['usernameAdmin']) && isset($_SESSION['passwordAdmin'])) {
$loggedInAdmin = new loggedInAdmin();
$loggedInAdmin->db = $db;
$loggedInAdmin->url = $CONF['url'];
$loggedInAdmin->username = $_SESSION['usernameAdmin'];
$loggedInAdmin->password = $_SESSION['passwordAdmin'];
$loggedIn = $loggedInAdmin->verify();
if ($loggedIn['username']) {
$managePayments = new managePayments();
$managePayments->db = $db;
$managePayments->url = $CONF['url'];
$managePayments->per_page = $settings['rperpage'];
if (isset($_POST['start'])) {
echo $managePayments->getPayments($_POST['start']);
}
}
}
示例14: getLanguage
<?php
include "../includes/config.php";
include "../includes/classes.php";
require_once getLanguage(null, !empty($_GET['lang']) ? $_GET['lang'] : $_COOKIE['lang'], 2);
session_start();
$db = new mysqli($CONF['host'], $CONF['user'], $CONF['pass'], $CONF['name']);
if ($db->connect_errno) {
echo "Failed to connect to MySQL: (" . $db->connect_errno . ") " . $db->connect_error;
}
$db->set_charset("utf8");
$resultSettings = $db->query(getSettings());
$settings = $resultSettings->fetch_assoc();
// The theme complete url
$CONF['theme_url'] = $CONF['theme_path'] . '/' . $settings['theme'];
if (isset($_POST['start']) && isset($_POST['q']) && ctype_digit($_POST['start'])) {
$feed = new feed();
$feed->db = $db;
$feed->url = $CONF['url'];
if (isset($_SESSION['username']) && isset($_SESSION['password']) || isset($_COOKIE['username']) && isset($_COOKIE['password'])) {
$loggedIn = new loggedIn();
$loggedIn->db = $db;
$loggedIn->url = $CONF['url'];
$loggedIn->username = isset($_SESSION['username']) ? $_SESSION['username'] : $_COOKIE['username'];
$loggedIn->password = isset($_SESSION['password']) ? $_SESSION['password'] : $_COOKIE['password'];
$verify = $loggedIn->verify();
$feed->username = $verify['username'];
$feed->id = $verify['idu'];
$feed->online_time = $settings['conline'];
if (!empty($_POST['list'])) {
echo $feed->onlineUsers(2, $_POST['q']);
return;
示例15: createNewAlert
/**
* This function encapsulate a set of common instruction for event notification generation
* @param string $class The class name ho event (eg. UserMod)
* @param string $module The module generator (eg. directory)
* @param string $section The section in module that generate event (eg. edit)
* @param int $priority The priority level of event
* @param string $description The description of the event
* @param array $recipients An array of userid that should be notified
* @param EventMessageComposer $msg_composer a class for message composition
* @param bool $force_email_send if true the message is sent to all the user in $recipients ignoring their settings for email
**/
function createNewAlert($class, $module, $section, $priority, $description, $recipients, $msg_composer, $force_email_send = false)
{
$event =& DoceboEventManager::newEvent($class, $module, $section, $priority, $description);
$event->deleteOldProperty();
if (is_array($recipients["to"]) && is_array($recipients["cc"]) && is_array($recipients["bcc"])) {
$event->setProperty('recipientid', implode(',', $recipients["to"]));
$event->setProperty('recipientcc', implode(',', $recipients["cc"]));
$event->setProperty('recipientbcc', implode(',', $recipients["bcc"]));
} else {
$event->setProperty('recipientid', implode(',', $recipients));
}
$event->setProperty('subject', addslashes($msg_composer->getSubject('email', getLanguage())));
$event->setProperty('body', addslashes($msg_composer->getBody('email', getLanguage())));
$msg_composer->prepare_serialize();
// __sleep is preferred but i preferr this method
$event->setProperty('MessageComposer', addslashes(rawurlencode(serialize($msg_composer))));
$event->setProperty('force_email_send', $force_email_send === false ? 'false' : 'true');
DoceboEventManager::dispatch($event);
}