本文整理汇总了PHP中Resources::getCurrentLocale方法的典型用法代码示例。如果您正苦于以下问题:PHP Resources::getCurrentLocale方法的具体用法?PHP Resources::getCurrentLocale怎么用?PHP Resources::getCurrentLocale使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Resources
的用法示例。
在下文中一共展示了Resources::getCurrentLocale方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getImageNameFromParam
public static function getImageNameFromParam($pImage, $pDepartmentKey = null, $pLang = null, $pImagePostfix = null, $hasOnline = null)
{
if (!preg_match('/\\.(gif|jpg|png)$/i', $pImage)) {
$image = $pImage . '.gif';
} else {
$image = $pImage;
}
if (empty($pLang) || !Resources::IsLocaleAvailable($pLang)) {
$lang = Resources::getCurrentLocale();
} else {
$lang = $pLang;
}
if (empty($pImagePostfix)) {
if (empty($hasOnline)) {
$image_postfix = Operator::getInstance()->hasOnlineOperators($pDepartmentKey, $lang) ? 'on' : 'off';
} else {
$image_postfix = $hasOnline ? 'on' : 'off';
}
} else {
$image_postfix = $pImagePostfix;
}
$image = preg_replace('/\\.(gif|jpg|png)/i', '_' . $image_postfix . '.\\1', $image);
return "/themes/.buttons/{$lang}/{$image}";
}
示例2: date
$tmlPage['formendday'] = date('d', $currTime);
$tmlPage['formendmonth'] = date('m.y', $currTime);
}
}
//
// This function should be defined before it's used otherwise on
// some PHP verions it can fail with Fatal error: Call to undefined function
//
function get_operators_list()
{
$operators = Operator::getInstance()->GetAllAccessedOperators();
$result = array();
$result[''] = Resources::Get('search.any.operator');
if (!empty($operators)) {
foreach ($operators as $op) {
$result[$op['operatorid']] = $op['fullname'];
}
}
return $result;
}
$tmlPage['availableDays'] = range(1, 31);
$currTime = getCurrentTime();
$tmlPage['availableMonth'] = get_month_selection($currTime - 400 * 24 * 60 * 60, $currTime);
$tmlPage['operatorList'] = get_operators_list();
$TML->assign('departments', Operator::getInstance()->enumAvailableDepartmentsForOperator($operator['operatorid'], Resources::getCurrentLocale()));
$TML->assign('locales', getAvailableLocalesForChat());
$tmlPage['show_empty'] = $show_empty;
$TML->assign('page_settings', $tmlPage);
$TML->assign('advanced', true);
$TML->display('thread_search.tpl');
require_once dirname(__FILE__) . '/inc/admin_epilog.php';
示例3: SmartyClass
require_once '../classes/class.smartyclass.php';
$TML = new SmartyClass();
$operator = Operator::getInstance()->GetLoggedOperator();
$threadid = verify_param("thread", "/^\\d{1,8}\$/");
$token = verify_param("token", "/^\\d{1,8}\$/");
$thread = Thread::getInstance()->GetThreadById($threadid);
$visitSession = VisitSession::GetInstance()->GetVisitSessionById($thread['visitsessionid']);
$TML->assign('visit_session', $visitSession);
if (!$thread || !isset($thread['token']) || $token != $thread['token']) {
die("wrong thread");
}
$nextid = verify_param("nextoperatorid", "/^\\d{1,8}\$/");
$nextdepartmentid = verify_param("nextdepartmentid", "/^\\d{1,8}\$/");
$page = array();
if (!empty($nextid)) {
$nextOperator = Operator::getInstance()->GetOperatorById($nextid);
$TML->assign('nextoperator', $nextOperator);
}
if (!empty($nextdepartmentid)) {
$nextdepartment = Department::getInstance()->getById($nextdepartmentid, Resources::getCurrentLocale());
$TML->assign('nextdepartment', $nextdepartment);
}
$errors = array();
ThreadProcessor::getInstance()->ProcessThread($threadid, 'redirect', array('nextoperatorid' => $nextid, 'nextdepartmentid' => $nextdepartmentid, 'operator' => Operator::getInstance()->GetLoggedOperator()));
$TML->assign('page_settings', $page);
if (count($errors) > 0) {
$TML->assign('errors', $errors);
$TML->display('chat_error.tpl');
} else {
$TML->display('redirected.tpl');
}
示例4: verify_param
$image = verify_param('image', "/^[\\w\\.]+\$/", 'webim');
$theme = verify_param('theme', "/^\\w+\$/", 'default');
$TML->assign('theme', $theme);
//$TML->assign('availableImages', Button::enumAvailableImages(WEBIM_CURRENT_LOCALE));
//$TML->assign('availableThemes', enumAvailableThemes());
//$TML->assign('availableDepartments', MapperFactory::getMapper("Department")->enumDepartments(Resources::getCurrentLocale()));
$TML->assign('params', Button::getParameters());
$lang = Resources::getCurrentLocale();
$showhost = verify_param('include_host_url', '/^y$/', '') == 'y';
$includeTracker = verify_param('add_track_code', '/^y$/', '') == 'y';
$forcesecure = verify_param('secure', '/^y$/', '') == 'y';
$chooseoperator = verify_param('choose_operator', "/^\\w+\$/", '');
$chatimmediately = verify_param('chat_immediately', '/^y$/', '') == 'y';
$departmentkey = verify_param('department_key', "/^\\w+\$/");
$choosedepartment = verify_param('choose_department', '/^y$/', '') == 'y';
$locale = verify_param('locale', '/^([a-z]{2})$/', Resources::getCurrentLocale());
$size = array();
if (function_exists('gd_info')) {
// TODO: for other file types
$info = gd_info();
$filename = dirname(__FILE__) . '/../' . Button::getImageNameFromParam($image, null, $lang, null, true);
if (file_exists($filename)) {
// isset($info['GIF Read Support']) && $info['GIF Read Support'] && TODO check other file types
$size = @getimagesize($filename);
}
}
$location = WEBIM_ROOT;
if ($showhost) {
$location = ($forcesecure ? 'https://' : 'http://') . $_SERVER['HTTP_HOST'] . WEBIM_ROOT;
}
$alt = Resources::Get('webim.online.consultant');
示例5: verify_param
$image = verify_param("image", "/^[\\w\\.]+\$/", "webim");
$theme = verify_param("theme", "/^\\w+\$/", "default");
$TML->assign('theme', $theme);
//$TML->assign('availableImages', Button::enumAvailableImages(WEBIM_CURRENT_LOCALE));
//$TML->assign('availableThemes', enumAvailableThemes());
//$TML->assign('availableDepartments', MapperFactory::getMapper("Department")->enumDepartments(Resources::getCurrentLocale()));
$TML->assign('params', Button::getParameters());
$lang = Resources::getCurrentLocale();
$showhost = verify_param("include_host_url", "/^y\$/", "") == "y";
$includeTracker = verify_param("add_track_code", "/^y\$/", "") == "y";
$forcesecure = verify_param("secure", "/^y\$/", "") == "y";
$chooseoperator = verify_param("choose_operator", "/^\\w+\$/", "");
$chatimmediately = verify_param("chat_immediately", "/^y\$/", "") == "y";
$departmentkey = verify_param("department_key", "/^\\w+\$/");
$choosedepartment = verify_param("choose_department", "/^y\$/", "") == "y";
$locale = verify_param("locale", "/^([a-z]{2})\$/", Resources::getCurrentLocale());
$size = array();
if (function_exists('gd_info')) {
// TODO: for other file types
$info = gd_info();
$filename = dirname(__FILE__) . "/../" . Button::getImageNameFromParam($image, null, $lang, null, true);
if (file_exists($filename)) {
// isset($info['GIF Read Support']) && $info['GIF Read Support'] && TODO check other file types
$size = @getimagesize($filename);
}
}
$location = WEBIM_ROOT;
if ($showhost) {
$location = ($forcesecure ? "https://" : "http://") . $_SERVER['HTTP_HOST'] . WEBIM_ROOT;
}
$alt = Resources::Get('webim.online.consultant');
示例6: dirname
*
*/
$TITLE_KEY = 'statistics.title';
require_once dirname(__FILE__) . '/inc/admin_prolog.php';
require_once '../classes/functions.php';
require_once '../classes/class.thread.php';
require_once '../classes/class.operator.php';
require_once '../classes/class.smartyclass.php';
Operator::getInstance()->IsCurrentUserAdminOrRedirect();
$tmlPage = null;
$TML = new SmartyClass($TITLE_KEY);
$tmlPage['availableDays'] = range(1, 31);
$currTime = getCurrentTime();
$tmlPage['availableMonth'] = get_month_selection($currTime - 400 * 24 * 60 * 60, $currTime + 50 * 24 * 60 * 60);
$tmlPage['showresults'] = false;
$tmlPage['departments'] = MapperFactory::getMapper("Department")->enumDepartments(Resources::getCurrentLocale());
$tmlPage['locales'] = getAvailableLocalesForChat();
Operator::getInstance()->ensureOperatorsAreInLastAccess();
$errors = array();
if (isset($_GET['startday'])) {
$startday = verify_param("startday", "/^\\d+\$/");
$startmonth = verify_param("startmonth", "/^\\d{2}.\\d{2}\$/");
$endday = verify_param("endday", "/^\\d+\$/");
$endmonth = verify_param("endmonth", "/^\\d{2}.\\d{2}\$/");
$start = get_form_date($startday, $startmonth);
$end = get_form_date($endday, $endmonth) + 24 * 60 * 60;
$locale = verify_param("locale", "/^(en|ru)\$/");
$departmentid = verify_param("departmentid", "/^\\d+\$/");
if ($start > $end) {
$errors[] = Resources::Get("statistics.wrong.dates");
}
示例7: enumAvailableDepartmentsForOperator
public function enumAvailableDepartmentsForOperator($operatorid, $locale)
{
$departmentsExist = MapperFactory::getMapper('Department')->departmentsExist();
return MapperFactory::getMapper('OperatorDepartment')->enumAvailableDepartmentsForOperator($operatorid, Resources::getCurrentLocale(), $departmentsExist);
}
示例8: dirname
<?php
/*
*
* Данный файл является частью проекта Веб Мессенджер.
*
* Все права защищены. (c) 2005-2009 ООО "ТОП".
* Данное программное обеспечение и все сопутствующие материалы
* предоставляются на условиях лицензии, доступной по адресу
* http://webim.ru/license.html
*
*/
$TITLE_KEY = 'leftMenu.departments';
require_once dirname(__FILE__) . '/inc/admin_prolog.php';
require_once '../classes/functions.php';
require_once '../classes/class.operator.php';
require_once '../classes/class.smartyclass.php';
require_once '../classes/models/generic/class.mapperfactory.php';
Operator::getInstance()->IsCurrentUserAdminOrRedirect();
$TML = new SmartyClass($TITLE_KEY);
$departments = MapperFactory::getMapper('Department')->enumDepartments(Resources::getCurrentLocale());
$TML->assign('departments', $departments);
$TML->display('departments.tpl');
require_once dirname(__FILE__) . '/inc/admin_epilog.php';
示例9: SetLocaleLanguage
static function SetLocaleLanguage()
{
if (Resources::getCurrentLocale() == 'ru') {
$locale = 'ru_RU';
} else {
$locale = 'en_EN';
}
if (setlocale(LC_ALL, $locale . '.' . (defined('WEBIM_ENCODING') ? WEBIM_ENCODING : 'UTF-8')) === false) {
setlocale(LC_ALL, Resources::getCurrentLocale());
}
}
示例10: getListThreads
public function getListThreads($currentoperatorid, $q, $show_empty = true, $checkDepartmentsAccess = true, $start_date = null, $end_date = null, $operatorid = null, $offset = null, $limit = null, $departmentid = null, $locale = null, $rate = null)
{
$departmentsExist = count(MapperFactory::getMapper("Department")->enumDepartments(Resources::getCurrentLocale()));
// TODO probably not the best place
$query_params = array();
$sql = '
SELECT
WM_UNIX_TIMESTAMP(t."created") "created",
WM_UNIX_TIMESTAMP(t."modified") "modified",
t."threadid",
t."operatorfullname",
t."visitormessagecount" as "size",
v."ip" as "remote",
v."remotehost",
v."visitorname"
FROM "{thread}" t
LEFT JOIN "{visitsession}" v
ON v."visitsessionid" = t."visitsessionid"
WHERE
1=1';
if (!empty($q)) {
$query_params['query'] = "%%{$q}%%";
$sql .= ' AND (t."threadid" IN (
SELECT "threadid"
FROM "{message}" m
WHERE m."sendername" LIKE :query
OR m."message" LIKE :query
)
OR v."visitorid" LIKE :query
OR v."ip" LIKE :query
OR v."remotehost" LIKE :query
OR t."operatorfullname" LIKE :query
)';
}
if (!empty($rate)) {
$sign = $rate == 'positive' ? '>' : '<';
$sql .= ' AND EXISTS(SELECT * FROM "{rate}" r WHERE r."threadid"=t."threadid" AND r."rate" ' . $sign . ' 0 AND r."deldate" IS NULL)';
}
if ($checkDepartmentsAccess) {
$sql .= ' AND (t."departmentid" IS NULL OR EXISTS(SELECT * FROM "{operatordepartment}" od WHERE od."operatorid"=:currentoperatorid AND od."departmentid"=t."departmentid"))';
$query_params['currentoperatorid'] = $currentoperatorid;
}
if (!$show_empty) {
$sql .= ' AND t."visitormessagecount" > 0 ';
}
if ($start_date !== null) {
$query_params['start_date'] = $start_date;
$sql .= ' AND WM_UNIX_TIMESTAMP(t."created") >= :start_date';
}
if ($end_date !== null) {
$query_params['end_date'] = $end_date;
$sql .= ' AND WM_UNIX_TIMESTAMP(t."created") < :end_date';
}
if ($operatorid !== null) {
$query_params['operatorid'] = $operatorid;
$sql .= ' AND (:operatorid IS NULL OR t."operatorid"=:operatorid)';
}
if (!empty($departmentid)) {
$query_params['departmentid'] = $departmentid;
$sql .= ' AND t."departmentid" = :departmentid ';
}
if (!empty($locale)) {
$query_params['locale'] = $locale;
$sql .= ' AND t."locale" = :locale ';
}
if ($limit !== null && $offset !== null) {
$query_params['limit'] = $limit;
$query_params['offset'] = $offset;
$sql .= " AND rownum BETWEEN :offset AND :limit";
}
$sql .= ' ORDER BY t."created" DESC';
try {
$this->db->query($sql, $query_params);
$result = $this->db->getArrayOfRows();
} catch (Exception $e) {
return array();
}
foreach ($result as $k => $v) {
$geodata = GeoIPLookup::getGeoDataByIP($v['remote']);
//for testing purpose
//$geodata = GeoIPLookup::getGeoDataByIP('89.113.218.99');
if ($geodata == NULL) {
$geodata = array('city' => null, 'country' => null, 'lat' => null, 'lng' => null);
}
$result[$k] = array_merge($v, $geodata);
$result[$k]['created'] = date(getDateTimeFormat(), $v['created']);
$result[$k]['modified'] = date(getDateTimeFormat(), $v['modified']);
$result[$k]['diff'] = webim_date_diff($v['modified'] - $v['created']);
}
return $result;
}
示例11: setAllDepartments
function setAllDepartments()
{
global $TML;
$operator = Operator::getInstance()->GetLoggedOperator(false);
$departments = MapperFactory::getMapper("OperatorDepartment")->enumDepartmentsWithOperator($operator['operatorid'], Resources::getCurrentLocale());
$TML->assign('departments', $departments);
}
示例12: getListThreadsCount
public function getListThreadsCount($currentoperatorid, $q, $show_empty = true, $checkDepartmentsAccess = true, $start_date = null, $end_date = null, $operatorid = null, $departmentid = null, $locale = null, $rate = null, $offline = null)
{
$departmentsExist = count(MapperFactory::getMapper('Department')->enumDepartments(Resources::getCurrentLocale()));
// TODO probably not the best place
$query_params = array();
$sWhere = '';
$nTotal = 0;
$sCountSql = 'SELECT COUNT(*) AS cnt FROM {thread} as t
LEFT JOIN {visitsession} as v ON v.visitsessionid = t.visitsessionid
WHERE 1';
if (!empty($q)) {
$query_params['query'] = "%%{$q}%%";
$sWhere .= ' AND (t.threadid IN (
SELECT threadid
FROM {message} as m
WHERE m.sendername LIKE :query
OR m.message LIKE :query
)
OR v.visitorid LIKE :query
OR v.ip LIKE :query
OR v.remotehost LIKE :query
OR t.operatorfullname LIKE :query
)';
}
if (!empty($rate)) {
$sign = $rate == 'positive' ? '>' : '<';
$sWhere .= " AND EXISTS (SELECT * FROM {rate} r WHERE r.threadid=t.threadid AND r.rate {$sign} 0 AND r.deldate IS NULL) ";
}
if ($checkDepartmentsAccess) {
$sWhere .= ' AND (t.departmentid IS NULL OR EXISTS(SELECT * FROM {operatordepartment} od WHERE od.operatorid=:currentoperatorid AND od.departmentid=t.departmentid)) ';
$query_params['currentoperatorid'] = $currentoperatorid;
}
if (!$show_empty) {
$sWhere .= ' AND t.visitormessagecount > 0 ';
}
if ($start_date !== null) {
$query_params['start_date'] = $start_date;
$sWhere .= ' AND unix_timestamp(t.created) >= :start_date';
}
if ($end_date !== null) {
$query_params['end_date'] = $end_date;
$sWhere .= ' AND unix_timestamp(t.created) < :end_date';
}
if ($operatorid !== null) {
$query_params['operatorid'] = $operatorid;
$sWhere .= ' AND (:operatorid IS NULL OR t.operatorid=:operatorid)';
}
if (!empty($departmentid)) {
$query_params['departmentid'] = $departmentid;
$sWhere .= ' AND t.departmentid = :departmentid ';
}
if (!empty($locale)) {
$query_params['locale'] = $locale;
$sWhere .= ' AND t.locale = :locale ';
}
if ($offline !== null) {
$query_params['offline'] = $offline;
$sWhere .= ' AND t.offline=:offline';
}
$sCountSql .= $sWhere;
try {
$this->db->query($sCountSql, $query_params);
$this->db->nextRecord();
$nTotal = $this->db->getRow('cnt');
} catch (Exception $e) {
return 0;
}
return $nTotal;
}
示例13: verify_param
require_once('../classes/models/generic/class.mapperfactory.php');
require_once('../classes/class.json.php');
require_once('../classes/class.thread.php');
if(!session_id()) {
session_start();
}
$theme = verify_param("theme", "/^\w+$/", "default");
$isSecure = verify_param("issecure", "/^\d+$/", 0) == 1;
$location = get_app_location(true, $isSecure);
$lang = Resources::getCurrentLocale();
$link = $location."/client.php?theme=$theme".(!empty($lang) ? "&lang=".$lang : "");
$temp = get_popup_onclick($link, "webim_".getWindowNameSuffix(), "toolbar=0, scrollbars=0, location=0, menubar=0, width=528, height=456, resizable=1", true);
// папка online в мэмкэш --------------------
//$operators = Operator::getInstance()->getOnlineOperatorsFromFiles();
$operators = Operator::getInstance()->getOnlineOperatorsFromMemBuff();
$operators_count = count($operators);
$no_operators = false;
if($operators_count == 0) {
$no_operators = true;
}
if(!isset($_COOKIE[WEBIM_COOKIE_VISITOR_IN_CHAT])) {
$visitor = GetVisitorFromRequestAndSetCookie();
示例14: departmentSubmitted
function departmentSubmitted()
{
global $TITLE_KEY;
$TML = new SmartyClass($TITLE_KEY);
setDepartment($TML);
$isNew = empty($_REQUEST['id']);
$toCheck = array('departmentname' => 'form.field.departmentname');
foreach ($toCheck as $field => $res) {
if (empty($_REQUEST[$field])) {
$errors[] = Resources::Get("errors.required", array(Resources::Get($res)));
}
}
if (empty($errors) && !preg_match("/^[a-z_\\.\\d]*\$/", $_REQUEST['departmentkey'])) {
$errors[] = Resources::Get("page_department.error.wrong_departmentkey");
}
if (empty($errors) && !empty($_REQUEST['departmentkey'])) {
$existing = MapperFactory::getMapper("Department")->getByDepartmentKey($_REQUEST['departmentkey']);
$exists = !empty($existing);
if ($exists) {
if ($isNew || !$isNew && $_REQUEST['id'] != $existing['departmentid']) {
$errors[] = Resources::Get('page_department.error.duplicate_department_departmentkey');
}
}
}
$hash = array();
$department_key = empty($_REQUEST['departmentkey']) ? makeKeyUnique(generateDepartmentKey()) : makeKeyUnique($_REQUEST['departmentkey'], !empty($_REQUEST['id']) ? $_REQUEST['id'] : null);
if (!$department_key) {
$errors[] = Resources::Get('page_department.error.unable_make_unique_key');
}
if (empty($errors)) {
$hash['departmentkey'] = $department_key;
// $hash['departmentkey'] = empty($_REQUEST['departmentkey']) ? iconv(WEBIM_ENCODING, 'latin-1', $_REQUEST['departmentname']) : $_REQUEST['departmentkey']; // translit
$hash['departmentname'] = $_REQUEST['departmentname'];
if (isset($_REQUEST['id'])) {
$hash['departmentid'] = $_REQUEST['id'];
}
$id = Department::getInstance()->save($hash, Resources::getCurrentLocale());
$url = AdminURL::getInstance()->getURL('departments');
header("Location: " . $url);
}
foreach (array('departmentkey', 'departmentname') as $f) {
if (!empty($_REQUEST[$f])) {
$TML->assign($f, $_REQUEST[$f]);
}
}
$TML->assign('errors', $errors);
$TML->display('department.tpl');
exit;
}
示例15: Init
static function Init()
{
Resources::SetLocaleLanguage();
session_start();
// if (isset($_SESSION['WEBIM_TRACELOG']) && strlen($_SESSION['WEBIM_TRACELOG']) > 200*200) {
// }
$locale = Resources::getCurrentLocale();
define('WEBIM_CURRENT_LOCALE', $locale);
self::initRequests();
if (function_exists("date_default_timezone_set") and function_exists("date_default_timezone_get")) {
@date_default_timezone_set(@date_default_timezone_get());
}
}