Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
fusiondirectory
fusiondirectory
Commits
286bbad0
Commit
286bbad0
authored
11 years ago
by
Benoit Mortier
Browse files
Options
Download
Patches
Plain Diff
Fixes: #28121 remove included smarty gettext
parent
b502e5df
dev
6342-update-the-locales-for-1-5
6344-template-issue-when-creating-a-template-with-empty-password-error-message-should-not-be-seen
6365-core-locking-mechanism-is-not-changing-the-mail-ressource-it-does-lock-the-mail-account
6365-core-when-lock-mechanism-is-trigger-the-user-should-not-be-editable-if-not-unlock
6378-orcid-test-method-is-wrong-and-break-orcid-saving
core-php8
master
fusiondirectory-1.5
fusiondirectory-1.4
fusiondirectory-1.3.1
fusiondirectory-1.3
fusiondirectory-1.2.3
fusiondirectory-1.2.2
fusiondirectory-1.2.1
fusiondirectory-1.2
fusiondirectory-1.1.1
fusiondirectory-1.1
fusiondirectory-1.0.20
fusiondirectory-1.0.19
fusiondirectory-1.0.18
fusiondirectory-1.0.17
fusiondirectory-1.0.16
fusiondirectory-1.0.15
fusiondirectory-1.0.14
fusiondirectory-1.0.13
fusiondirectory-1.0.12
fusiondirectory-1.0.11
fusiondirectory-1.0.10
fusiondirectory-1.0.9.3
fusiondirectory-1.0.9.2
fusiondirectory-1.0.9.1
fusiondirectory-1.0.9
fusiondirectory-1.0.8.9
fusiondirectory-1.0.8.8
fusiondirectory-1.0.8.7
fusiondirectory-1.0.8.6
fusiondirectory-1.0.8.5
fusiondirectory-1.0.8.4
fusiondirectory-1.0.8.3
fusiondirectory-1.0.8.2
fusiondirectory-1.0.8.1
fusiondirectory-1.0.8
fusiondirectory-1.0.7.5
fusiondirectory-1.0.7.4
fusiondirectory-1.0.7.3
fusiondirectory-1.0.7.2
fusiondirectory-1.0.7.1
fusiondirectory-1.0.7
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
contrib/smarty/plugins/block.t.php
+0
-129
contrib/smarty/plugins/block.t.php
with
0 additions
and
129 deletions
+0
-129
contrib/smarty/plugins/block.t.php
deleted
100644 → 0
+
0
−
129
View file @
b502e5df
<?php
/**
* block.t.php - Smarty gettext block plugin
*
* ------------------------------------------------------------------------- *
* This library is free software; you can redistribute it and/or *
* modify it under the terms of the GNU Lesser General Public *
* License as published by the Free Software Foundation; either *
* version 2.1 of the License, or (at your option) any later version. *
* *
* This library is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU *
* Lesser General Public License for more details. *
* *
* You should have received a copy of the GNU Lesser General Public *
* License along with this library; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA *
* ------------------------------------------------------------------------- *
*
* Installation: simply copy this file to the smarty plugins directory.
*
* @package smarty-gettext
* @version $Id: block.t.php,v 1.1 2005/07/27 17:58:56 sagi Exp $
* @link http://smarty-gettext.sourceforge.net/
* @author Sagi Bashari <sagi@boom.org.il>
* @copyright 2004-2005 Sagi Bashari
*/
/**
* Replaces arguments in a string with their values.
* Arguments are represented by % followed by their number.
*
* @param string Source string
* @param mixed Arguments, can be passed in an array or through single variables.
* @returns string Modified string
*/
function
smarty_gettext_strarg
(
$str
)
{
$tr
=
array
();
$p
=
0
;
for
(
$i
=
1
;
$i
<
func_num_args
();
$i
++
)
{
$arg
=
func_get_arg
(
$i
);
if
(
is_array
(
$arg
))
{
foreach
(
$arg
as
$aarg
)
{
$tr
[
'%'
.
++
$p
]
=
$aarg
;
}
}
else
{
$tr
[
'%'
.
++
$p
]
=
$arg
;
}
}
return
strtr
(
$str
,
$tr
);
}
/**
* Smarty block function, provides gettext support for smarty.
*
* The block content is the text that should be translated.
*
* Any parameter that is sent to the function will be represented as %n in the translation text,
* where n is 1 for the first parameter. The following parameters are reserved:
* - escape - sets escape mode:
* - 'html' for HTML escaping, this is the default.
* - 'js' for javascript escaping.
* - 'url' for url escaping.
* - 'no'/'off'/0 - turns off escaping
* - plural - The plural version of the text (2nd parameter of ngettext())
* - count - The item count for plural mode (3rd parameter of ngettext())
*/
function
smarty_block_t
(
$params
,
$text
,
&
$smarty
)
{
if
(
$text
===
NULL
)
{
return
;
}
$text
=
stripslashes
(
$text
);
// set escape mode
if
(
isset
(
$params
[
'escape'
]))
{
$escape
=
$params
[
'escape'
];
unset
(
$params
[
'escape'
]);
}
// set plural version
if
(
isset
(
$params
[
'plural'
]))
{
$plural
=
$params
[
'plural'
];
unset
(
$params
[
'plural'
]);
// set count
if
(
isset
(
$params
[
'count'
]))
{
$count
=
$params
[
'count'
];
unset
(
$params
[
'count'
]);
}
}
// use plural if required parameters are set
if
(
isset
(
$count
)
&&
isset
(
$plural
))
{
$text
=
ngettext
(
$text
,
$plural
,
$count
);
}
else
{
// use normal
$text
=
gettext
(
$text
);
}
// run strarg if there are parameters
if
(
count
(
$params
))
{
$text
=
smarty_gettext_strarg
(
$text
,
$params
);
}
if
(
!
isset
(
$escape
)
||
$escape
==
'html'
)
{
// html escape, default
$text
=
nl2br
(
htmlspecialchars
(
$text
));
}
elseif
(
isset
(
$escape
))
{
switch
(
$escape
)
{
case
'javascript'
:
case
'js'
:
// javascript escape
$text
=
str_replace
(
'\''
,
'\\\''
,
stripslashes
(
$text
));
break
;
case
'url'
:
// url escape
$text
=
urlencode
(
$text
);
break
;
}
}
return
$text
;
}
?>
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets