mirror of
https://github.com/Mibew/mibew.git
synced 2025-03-03 02:18:31 +03:00
Remove getstring* functions
This commit is contained in:
parent
24c50487d2
commit
98fe748bef
@ -146,7 +146,7 @@ sub process_php($) {
|
|||||||
|
|
||||||
while( $content =~ s/<\?(?!xml)(.*?)\?>//s ) {
|
while( $content =~ s/<\?(?!xml)(.*?)\?>//s ) {
|
||||||
my $inner = $1;
|
my $inner = $1;
|
||||||
while($inner =~ s/(getlocal|getstring|no_field)2?_?\((.*?)[,\)]//s) {
|
while($inner =~ s/(getlocal|no_field)2?_?\((.*?)[,\)]//s) {
|
||||||
my $firstarg = $2;
|
my $firstarg = $2;
|
||||||
if( $firstarg =~ /^["']([\w\.]+)['"]$/) {
|
if( $firstarg =~ /^["']([\w\.]+)['"]$/) {
|
||||||
usemsg($1);
|
usemsg($1);
|
||||||
|
@ -310,7 +310,7 @@ function add_canned_messages($link){
|
|||||||
$result = array();
|
$result = array();
|
||||||
foreach (get_available_locales() as $locale) {
|
foreach (get_available_locales() as $locale) {
|
||||||
if (! in_array($locale, $existlocales)) {
|
if (! in_array($locale, $existlocales)) {
|
||||||
foreach (explode("\n", getstring_('chat.predefined_answers', $locale)) as $answer) {
|
foreach (explode("\n", getlocal_('chat.predefined_answers', $locale)) as $answer) {
|
||||||
$result[] = array('locale' => $locale, 'vctitle' => cut_string($answer, 97, '...'), 'vcvalue' => $answer);
|
$result[] = array('locale' => $locale, 'vctitle' => cut_string($answer, 97, '...'), 'vcvalue' => $answer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -518,7 +518,7 @@ function setup_chatview_for_user(Thread $thread)
|
|||||||
$data['chat']['user'] = array(
|
$data['chat']['user'] = array(
|
||||||
'name' => htmlspecialchars($thread->userName),
|
'name' => htmlspecialchars($thread->userName),
|
||||||
'canChangeName' => (bool) (Settings::get('usercanchangename') == "1"),
|
'canChangeName' => (bool) (Settings::get('usercanchangename') == "1"),
|
||||||
'defaultName' => (bool) (getstring("chat.default.username") != $thread->userName),
|
'defaultName' => (bool) (getlocal("chat.default.username") != $thread->userName),
|
||||||
'canPost' => true,
|
'canPost' => true,
|
||||||
'isAgent' => false,
|
'isAgent' => false,
|
||||||
);
|
);
|
||||||
@ -641,7 +641,7 @@ function ban_for_addr($addr)
|
|||||||
*/
|
*/
|
||||||
function visitor_from_request()
|
function visitor_from_request()
|
||||||
{
|
{
|
||||||
$default_name = getstring("chat.default.username");
|
$default_name = getlocal("chat.default.username");
|
||||||
$user_name = $default_name;
|
$user_name = $default_name;
|
||||||
if (isset($_COOKIE[USERNAME_COOKIE_NAME])) {
|
if (isset($_COOKIE[USERNAME_COOKIE_NAME])) {
|
||||||
$data = base64_decode(strtr($_COOKIE[USERNAME_COOKIE_NAME], '-_,', '+/='));
|
$data = base64_decode(strtr($_COOKIE[USERNAME_COOKIE_NAME], '-_,', '+/='));
|
||||||
@ -766,7 +766,7 @@ function chat_start_for_user(
|
|||||||
$operator_name = get_operator_name($operator);
|
$operator_name = get_operator_name($operator);
|
||||||
$thread->postMessage(
|
$thread->postMessage(
|
||||||
Thread::KIND_FOR_AGENT,
|
Thread::KIND_FOR_AGENT,
|
||||||
getstring2(
|
getlocal2(
|
||||||
'chat.visitor.invitation.accepted',
|
'chat.visitor.invitation.accepted',
|
||||||
array($operator_name),
|
array($operator_name),
|
||||||
true
|
true
|
||||||
@ -776,20 +776,20 @@ function chat_start_for_user(
|
|||||||
if ($referrer) {
|
if ($referrer) {
|
||||||
$thread->postMessage(
|
$thread->postMessage(
|
||||||
Thread::KIND_FOR_AGENT,
|
Thread::KIND_FOR_AGENT,
|
||||||
getstring2('chat.came.from', array($referrer), true)
|
getlocal2('chat.came.from', array($referrer), true)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if ($requested_operator && !$requested_operator_online) {
|
if ($requested_operator && !$requested_operator_online) {
|
||||||
$thread->postMessage(
|
$thread->postMessage(
|
||||||
Thread::KIND_INFO,
|
Thread::KIND_INFO,
|
||||||
getstring2(
|
getlocal2(
|
||||||
'chat.requested_operator.offline',
|
'chat.requested_operator.offline',
|
||||||
array(get_operator_name($requested_operator)),
|
array(get_operator_name($requested_operator)),
|
||||||
true
|
true
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$thread->postMessage(Thread::KIND_INFO, getstring('chat.wait', true));
|
$thread->postMessage(Thread::KIND_INFO, getlocal('chat.wait', true));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -797,7 +797,7 @@ function chat_start_for_user(
|
|||||||
if ($info) {
|
if ($info) {
|
||||||
$thread->postMessage(
|
$thread->postMessage(
|
||||||
Thread::KIND_FOR_AGENT,
|
Thread::KIND_FOR_AGENT,
|
||||||
getstring2('chat.visitor.info', array($info), true)
|
getlocal2('chat.visitor.info', array($info), true)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -37,7 +37,7 @@ class BanController extends AbstractController
|
|||||||
public function indexAction(Request $request)
|
public function indexAction(Request $request)
|
||||||
{
|
{
|
||||||
set_csrf_token();
|
set_csrf_token();
|
||||||
setlocale(LC_TIME, getstring('time.locale'));
|
setlocale(LC_TIME, getlocal('time.locale'));
|
||||||
|
|
||||||
$operator = $this->getOperator();
|
$operator = $this->getOperator();
|
||||||
$page = array(
|
$page = array(
|
||||||
|
@ -40,7 +40,7 @@ class ButtonController extends AbstractController
|
|||||||
if ($referer && isset($_SESSION['threadid'])) {
|
if ($referer && isset($_SESSION['threadid'])) {
|
||||||
$thread = Thread::load($_SESSION['threadid']);
|
$thread = Thread::load($_SESSION['threadid']);
|
||||||
if ($thread && $thread->state != Thread::STATE_CLOSED) {
|
if ($thread && $thread->state != Thread::STATE_CLOSED) {
|
||||||
$msg = getstring2_(
|
$msg = getlocal2_(
|
||||||
"chat.client.visited.page",
|
"chat.client.visited.page",
|
||||||
array($referer),
|
array($referer),
|
||||||
$thread->locale,
|
$thread->locale,
|
||||||
|
@ -110,8 +110,8 @@ class MailController extends AbstractController
|
|||||||
$history .= message_to_text($msg);
|
$history .= message_to_text($msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
$subject = getstring('mail.user.history.subject', true);
|
$subject = getlocal('mail.user.history.subject', true);
|
||||||
$body = getstring2(
|
$body = getlocal2(
|
||||||
'mail.user.history.body',
|
'mail.user.history.body',
|
||||||
array($thread->userName,
|
array($thread->userName,
|
||||||
$history,
|
$history,
|
||||||
|
@ -167,7 +167,7 @@ class RedirectController extends AbstractController
|
|||||||
// Send notification message
|
// Send notification message
|
||||||
$thread->postMessage(
|
$thread->postMessage(
|
||||||
Thread::KIND_EVENTS,
|
Thread::KIND_EVENTS,
|
||||||
getstring2_(
|
getlocal2_(
|
||||||
'chat.status.operator.redirect',
|
'chat.status.operator.redirect',
|
||||||
array(get_operator_name($this->getOperator())),
|
array(get_operator_name($this->getOperator())),
|
||||||
$thread->locale,
|
$thread->locale,
|
||||||
@ -221,7 +221,7 @@ class RedirectController extends AbstractController
|
|||||||
// Send notification message
|
// Send notification message
|
||||||
$thread->postMessage(
|
$thread->postMessage(
|
||||||
Thread::KIND_EVENTS,
|
Thread::KIND_EVENTS,
|
||||||
getstring2_(
|
getlocal2_(
|
||||||
'chat.status.operator.redirect',
|
'chat.status.operator.redirect',
|
||||||
array(get_operator_name($this->getOperator())),
|
array(get_operator_name($this->getOperator())),
|
||||||
$thread->locale,
|
$thread->locale,
|
||||||
|
@ -36,7 +36,7 @@ class HistoryController extends AbstractController
|
|||||||
*/
|
*/
|
||||||
public function indexAction(Request $request)
|
public function indexAction(Request $request)
|
||||||
{
|
{
|
||||||
setlocale(LC_TIME, getstring("time.locale"));
|
setlocale(LC_TIME, getlocal("time.locale"));
|
||||||
|
|
||||||
$page = array();
|
$page = array();
|
||||||
$operator = $this->getOperator();
|
$operator = $this->getOperator();
|
||||||
@ -177,7 +177,7 @@ class HistoryController extends AbstractController
|
|||||||
*/
|
*/
|
||||||
public function threadAction(Request $request)
|
public function threadAction(Request $request)
|
||||||
{
|
{
|
||||||
setlocale(LC_TIME, getstring("time.locale"));
|
setlocale(LC_TIME, getlocal("time.locale"));
|
||||||
|
|
||||||
$operator = $this->getOperator();
|
$operator = $this->getOperator();
|
||||||
$page = array();
|
$page = array();
|
||||||
@ -216,7 +216,7 @@ class HistoryController extends AbstractController
|
|||||||
*/
|
*/
|
||||||
public function userAction(Request $request)
|
public function userAction(Request $request)
|
||||||
{
|
{
|
||||||
setlocale(LC_TIME, getstring("time.locale"));
|
setlocale(LC_TIME, getlocal("time.locale"));
|
||||||
|
|
||||||
$operator = $this->getOperator();
|
$operator = $this->getOperator();
|
||||||
$user_id = $request->attributes->get('user_id', '');
|
$user_id = $request->attributes->get('user_id', '');
|
||||||
@ -280,7 +280,7 @@ class HistoryController extends AbstractController
|
|||||||
*/
|
*/
|
||||||
public function userTrackAction(Request $request)
|
public function userTrackAction(Request $request)
|
||||||
{
|
{
|
||||||
setlocale(LC_TIME, getstring('time.locale'));
|
setlocale(LC_TIME, getlocal('time.locale'));
|
||||||
|
|
||||||
if (Settings::get('enabletracking') == '0') {
|
if (Settings::get('enabletracking') == '0') {
|
||||||
throw new BadRequestException('Tracking is disabled.');
|
throw new BadRequestException('Tracking is disabled.');
|
||||||
|
@ -35,7 +35,7 @@ class ManagementController extends AbstractController
|
|||||||
public function indexAction(Request $request)
|
public function indexAction(Request $request)
|
||||||
{
|
{
|
||||||
set_csrf_token();
|
set_csrf_token();
|
||||||
setlocale(LC_TIME, getstring('time.locale'));
|
setlocale(LC_TIME, getlocal('time.locale'));
|
||||||
|
|
||||||
$operator = $this->getOperator();
|
$operator = $this->getOperator();
|
||||||
$page = array(
|
$page = array(
|
||||||
|
@ -93,8 +93,8 @@ class PasswordRecoveryController extends AbstractController
|
|||||||
mibew_mail(
|
mibew_mail(
|
||||||
$email,
|
$email,
|
||||||
$email,
|
$email,
|
||||||
getstring('restore.mailsubj'),
|
getlocal('restore.mailsubj'),
|
||||||
getstring2(
|
getlocal2(
|
||||||
'restore.mailtext',
|
'restore.mailtext',
|
||||||
array(get_operator_name($to_restore), $href)
|
array(get_operator_name($to_restore), $href)
|
||||||
)
|
)
|
||||||
|
@ -41,7 +41,7 @@ class StatisticsController extends AbstractController
|
|||||||
{
|
{
|
||||||
$operator = $this->getOperator();
|
$operator = $this->getOperator();
|
||||||
$statistics_type = $request->attributes->get('type');
|
$statistics_type = $request->attributes->get('type');
|
||||||
setlocale(LC_TIME, getstring("time.locale"));
|
setlocale(LC_TIME, getlocal("time.locale"));
|
||||||
|
|
||||||
$page = array();
|
$page = array();
|
||||||
$page['operator'] = get_operator_name($operator);
|
$page['operator'] = get_operator_name($operator);
|
||||||
|
@ -503,7 +503,7 @@ class ThreadProcessor extends ClientSideProcessor
|
|||||||
if ($email) {
|
if ($email) {
|
||||||
$thread->postMessage(
|
$thread->postMessage(
|
||||||
Thread::KIND_FOR_AGENT,
|
Thread::KIND_FOR_AGENT,
|
||||||
getstring2('chat.visitor.email', array($email), true)
|
getlocal2('chat.visitor.email', array($email), true)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -617,19 +617,19 @@ class ThreadProcessor extends ClientSideProcessor
|
|||||||
if ($referrer) {
|
if ($referrer) {
|
||||||
$thread->postMessage(
|
$thread->postMessage(
|
||||||
Thread::KIND_FOR_AGENT,
|
Thread::KIND_FOR_AGENT,
|
||||||
getstring2('chat.came.from', array($referrer), true)
|
getlocal2('chat.came.from', array($referrer), true)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if ($email) {
|
if ($email) {
|
||||||
$thread->postMessage(
|
$thread->postMessage(
|
||||||
Thread::KIND_FOR_AGENT,
|
Thread::KIND_FOR_AGENT,
|
||||||
getstring2('chat.visitor.email', array($email), true)
|
getlocal2('chat.visitor.email', array($email), true)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
if ($info) {
|
if ($info) {
|
||||||
$thread->postMessage(
|
$thread->postMessage(
|
||||||
Thread::KIND_FOR_AGENT,
|
Thread::KIND_FOR_AGENT,
|
||||||
getstring2('chat.visitor.info', array($info), true)
|
getlocal2('chat.visitor.info', array($info), true)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$thread->postMessage(Thread::KIND_USER, $message, array('name' => $name));
|
$thread->postMessage(Thread::KIND_USER, $message, array('name' => $name));
|
||||||
@ -644,12 +644,12 @@ class ThreadProcessor extends ClientSideProcessor
|
|||||||
// Send email
|
// Send email
|
||||||
if ($inbox_mail) {
|
if ($inbox_mail) {
|
||||||
// Prepare message to send by email
|
// Prepare message to send by email
|
||||||
$subject = getstring2_(
|
$subject = getlocal2_(
|
||||||
"leavemail.subject",
|
"leavemail.subject",
|
||||||
array($args['name']),
|
array($args['name']),
|
||||||
$message_locale
|
$message_locale
|
||||||
);
|
);
|
||||||
$body = getstring2_(
|
$body = getlocal2_(
|
||||||
"leavemail.body",
|
"leavemail.body",
|
||||||
array(
|
array(
|
||||||
$args['name'],
|
$args['name'],
|
||||||
|
@ -364,7 +364,7 @@ class Thread
|
|||||||
// Send message
|
// Send message
|
||||||
$thread->postMessage(
|
$thread->postMessage(
|
||||||
self::KIND_EVENTS,
|
self::KIND_EVENTS,
|
||||||
getstring_("chat.status.user.reopenedthread", $thread->locale, true)
|
getlocal_("chat.status.user.reopenedthread", $thread->locale, true)
|
||||||
);
|
);
|
||||||
|
|
||||||
return $thread;
|
return $thread;
|
||||||
@ -600,7 +600,7 @@ class Thread
|
|||||||
// Check if user chatting at the moment
|
// Check if user chatting at the moment
|
||||||
if ($this->state == self::STATE_CHATTING) {
|
if ($this->state == self::STATE_CHATTING) {
|
||||||
// Send message to user
|
// Send message to user
|
||||||
$message_to_post = getstring_(
|
$message_to_post = getlocal_(
|
||||||
"chat.status.operator.dead",
|
"chat.status.operator.dead",
|
||||||
$this->locale,
|
$this->locale,
|
||||||
true
|
true
|
||||||
@ -625,7 +625,7 @@ class Thread
|
|||||||
$this->lastPingUser = 0;
|
$this->lastPingUser = 0;
|
||||||
|
|
||||||
// And send a message to operator
|
// And send a message to operator
|
||||||
$message_to_post = getstring_(
|
$message_to_post = getlocal_(
|
||||||
"chat.status.user.dead",
|
"chat.status.user.dead",
|
||||||
$this->locale,
|
$this->locale,
|
||||||
true
|
true
|
||||||
@ -707,14 +707,14 @@ class Thread
|
|||||||
|
|
||||||
// Prepare message
|
// Prepare message
|
||||||
if ($this->nextAgent == $operator['operatorid']) {
|
if ($this->nextAgent == $operator['operatorid']) {
|
||||||
$message_to_post = getstring2_(
|
$message_to_post = getlocal2_(
|
||||||
"chat.status.operator.changed",
|
"chat.status.operator.changed",
|
||||||
array($operator_name, $this->agentName),
|
array($operator_name, $this->agentName),
|
||||||
$this->locale,
|
$this->locale,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$message_to_post = getstring2_(
|
$message_to_post = getlocal2_(
|
||||||
"chat.status.operator.returned",
|
"chat.status.operator.returned",
|
||||||
array($operator_name),
|
array($operator_name),
|
||||||
$this->locale,
|
$this->locale,
|
||||||
@ -854,7 +854,7 @@ class Thread
|
|||||||
if ($is_user) {
|
if ($is_user) {
|
||||||
$this->postMessage(
|
$this->postMessage(
|
||||||
self::KIND_EVENTS,
|
self::KIND_EVENTS,
|
||||||
getstring2_(
|
getlocal2_(
|
||||||
"chat.status.user.left",
|
"chat.status.user.left",
|
||||||
array($this->userName),
|
array($this->userName),
|
||||||
$this->locale,
|
$this->locale,
|
||||||
@ -865,7 +865,7 @@ class Thread
|
|||||||
if ($this->state == self::STATE_INVITED) {
|
if ($this->state == self::STATE_INVITED) {
|
||||||
$this->postMessage(
|
$this->postMessage(
|
||||||
self::KIND_FOR_AGENT,
|
self::KIND_FOR_AGENT,
|
||||||
getstring_(
|
getlocal_(
|
||||||
"chat.visitor.invitation.canceled",
|
"chat.visitor.invitation.canceled",
|
||||||
$this->locale,
|
$this->locale,
|
||||||
true
|
true
|
||||||
@ -874,7 +874,7 @@ class Thread
|
|||||||
} else {
|
} else {
|
||||||
$this->postMessage(
|
$this->postMessage(
|
||||||
self::KIND_EVENTS,
|
self::KIND_EVENTS,
|
||||||
getstring2_(
|
getlocal2_(
|
||||||
"chat.status.operator.left",
|
"chat.status.operator.left",
|
||||||
array($this->agentName),
|
array($this->agentName),
|
||||||
$this->locale,
|
$this->locale,
|
||||||
@ -932,14 +932,14 @@ class Thread
|
|||||||
$take_thread = true;
|
$take_thread = true;
|
||||||
if ($this->state == self::STATE_WAITING) {
|
if ($this->state == self::STATE_WAITING) {
|
||||||
if ($operator['operatorid'] != $this->agentId) {
|
if ($operator['operatorid'] != $this->agentId) {
|
||||||
$message = getstring2_(
|
$message = getlocal2_(
|
||||||
"chat.status.operator.changed",
|
"chat.status.operator.changed",
|
||||||
array($operator_name, $this->agentName),
|
array($operator_name, $this->agentName),
|
||||||
$this->locale,
|
$this->locale,
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
$message = getstring2_(
|
$message = getlocal2_(
|
||||||
"chat.status.operator.returned",
|
"chat.status.operator.returned",
|
||||||
array($operator_name),
|
array($operator_name),
|
||||||
$this->locale,
|
$this->locale,
|
||||||
@ -947,7 +947,7 @@ class Thread
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
$message = getstring2_(
|
$message = getlocal2_(
|
||||||
"chat.status.operator.joined",
|
"chat.status.operator.joined",
|
||||||
array($operator_name),
|
array($operator_name),
|
||||||
$this->locale,
|
$this->locale,
|
||||||
@ -958,7 +958,7 @@ class Thread
|
|||||||
// User chatting
|
// User chatting
|
||||||
if ($operator['operatorid'] != $this->agentId) {
|
if ($operator['operatorid'] != $this->agentId) {
|
||||||
$take_thread = true;
|
$take_thread = true;
|
||||||
$message = getstring2_(
|
$message = getlocal2_(
|
||||||
"chat.status.operator.changed",
|
"chat.status.operator.changed",
|
||||||
array($operator_name, $this->agentName),
|
array($operator_name, $this->agentName),
|
||||||
$this->locale,
|
$this->locale,
|
||||||
@ -1009,7 +1009,7 @@ class Thread
|
|||||||
$this->save();
|
$this->save();
|
||||||
|
|
||||||
// Send message about renaming
|
// Send message about renaming
|
||||||
$message = getstring2_(
|
$message = getlocal2_(
|
||||||
"chat.status.user.changedname",
|
"chat.status.user.changedname",
|
||||||
array($old_name, $new_name),
|
array($old_name, $new_name),
|
||||||
$this->locale,
|
$this->locale,
|
||||||
|
@ -232,7 +232,12 @@ function read_locale_file($path)
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getstring_($text, $locale, $raw = false)
|
function getlocal($text, $raw = false)
|
||||||
|
{
|
||||||
|
return getlocal_($text, CURRENT_LOCALE, $raw);
|
||||||
|
}
|
||||||
|
|
||||||
|
function getlocal_($text, $locale, $raw = false)
|
||||||
{
|
{
|
||||||
$localized = load_messages($locale);
|
$localized = load_messages($locale);
|
||||||
if (isset($localized[$text])) {
|
if (isset($localized[$text])) {
|
||||||
@ -241,32 +246,15 @@ function getstring_($text, $locale, $raw = false)
|
|||||||
: sanitize_string($localized[$text], 'low', 'moderate');
|
: sanitize_string($localized[$text], 'low', 'moderate');
|
||||||
}
|
}
|
||||||
if ($locale != 'en') {
|
if ($locale != 'en') {
|
||||||
return getstring_($text, 'en', $raw);
|
return getlocal_($text, 'en', $raw);
|
||||||
}
|
}
|
||||||
|
|
||||||
return "!" . ($raw ? $text : sanitize_string($text, 'low', 'moderate'));
|
return "!" . ($raw ? $text : sanitize_string($text, 'low', 'moderate'));
|
||||||
}
|
}
|
||||||
|
|
||||||
function getstring($text, $raw = false)
|
function getlocal2_($text, $params, $locale, $raw = false)
|
||||||
{
|
{
|
||||||
return getstring_($text, CURRENT_LOCALE, $raw);
|
$string = getlocal_($text, $locale, true);
|
||||||
}
|
|
||||||
|
|
||||||
function getlocal($text, $raw = false)
|
|
||||||
{
|
|
||||||
return getlocal_($text, CURRENT_LOCALE, $raw);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getlocal_($text, $locale, $raw = false)
|
|
||||||
{
|
|
||||||
$string = getstring_($text, $locale, true);
|
|
||||||
|
|
||||||
return $raw ? $string : sanitize_string($string, 'low', 'moderate');
|
|
||||||
}
|
|
||||||
|
|
||||||
function getstring2_($text, $params, $locale, $raw = false)
|
|
||||||
{
|
|
||||||
$string = getstring_($text, $locale, true);
|
|
||||||
for ($i = 0; $i < count($params); $i++) {
|
for ($i = 0; $i < count($params); $i++) {
|
||||||
$string = str_replace("{" . $i . "}", $params[$i], $string);
|
$string = str_replace("{" . $i . "}", $params[$i], $string);
|
||||||
}
|
}
|
||||||
@ -274,14 +262,9 @@ function getstring2_($text, $params, $locale, $raw = false)
|
|||||||
return $raw ? $string : sanitize_string($string, 'low', 'moderate');
|
return $raw ? $string : sanitize_string($string, 'low', 'moderate');
|
||||||
}
|
}
|
||||||
|
|
||||||
function getstring2($text, $params, $raw = false)
|
|
||||||
{
|
|
||||||
return getstring2_($text, $params, CURRENT_LOCALE, $raw);
|
|
||||||
}
|
|
||||||
|
|
||||||
function getlocal2($text, $params, $raw = false)
|
function getlocal2($text, $params, $raw = false)
|
||||||
{
|
{
|
||||||
$string = getstring_($text, CURRENT_LOCALE, true);
|
$string = getlocal_($text, CURRENT_LOCALE, true);
|
||||||
|
|
||||||
for ($i = 0; $i < count($params); $i++) {
|
for ($i = 0; $i < count($params); $i++) {
|
||||||
$string = str_replace("{" . $i . "}", $params[$i], $string);
|
$string = str_replace("{" . $i . "}", $params[$i], $string);
|
||||||
@ -293,7 +276,7 @@ function getlocal2($text, $params, $raw = false)
|
|||||||
/* prepares for Javascript string */
|
/* prepares for Javascript string */
|
||||||
function get_local_for_js($text, $params)
|
function get_local_for_js($text, $params)
|
||||||
{
|
{
|
||||||
$string = getstring_($text, CURRENT_LOCALE);
|
$string = getlocal_($text, CURRENT_LOCALE);
|
||||||
$string = str_replace("\"", "\\\"", str_replace("\n", "\\n", $string));
|
$string = str_replace("\"", "\\\"", str_replace("\n", "\\n", $string));
|
||||||
for ($i = 0; $i < count($params); $i++) {
|
for ($i = 0; $i < count($params); $i++) {
|
||||||
$string = str_replace("{" . $i . "}", $params[$i], $string);
|
$string = str_replace("{" . $i . "}", $params[$i], $string);
|
||||||
|
@ -271,7 +271,7 @@ function invitation_close_old()
|
|||||||
$thread = Thread::createFromDbInfo($thread_info);
|
$thread = Thread::createFromDbInfo($thread_info);
|
||||||
$thread->postMessage(
|
$thread->postMessage(
|
||||||
Thread::KIND_FOR_AGENT,
|
Thread::KIND_FOR_AGENT,
|
||||||
getstring_('chat.visitor.invitation.ignored', $thread->locale, true)
|
getlocal_('chat.visitor.invitation.ignored', $thread->locale, true)
|
||||||
);
|
);
|
||||||
unset($thread);
|
unset($thread);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user