本文整理汇总了PHP中Translator::get_by_source方法的典型用法代码示例。如果您正苦于以下问题:PHP Translator::get_by_source方法的具体用法?PHP Translator::get_by_source怎么用?PHP Translator::get_by_source使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Translator
的用法示例。
在下文中一共展示了Translator::get_by_source方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
$empty = isset($_GET['empty']) && $_GET['empty'] == 1 ? true : false;
if (!$empty) {
$_GET['empty'] = '';
}
$info = $i18n->languages[$lang];
$page->title = __('Editing language') . ': ' . $info['name'];
$all = unserialize(file_get_contents('lang/_index.php'));
$sources = Translator::get_sources($all);
require_once 'apps/translator/lib/Functions.php';
if (isset($_GET['contains']) && !empty($_GET['contains'])) {
$tr = new Translator();
$all = $tr->translations($lang, $all);
$items = Translator::get_by_search($all, $_GET['contains']);
echo $tpl->render('translator/edit_search', array('items' => $items, 'name' => $info['name'], 'lang' => $lang, 'sources' => $sources, 'contains' => $_GET['contains'], 'empty' => $empty));
} elseif (isset($_GET['source']) && !empty($_GET['source'])) {
$items = Translator::get_by_source($all, $_GET['source']);
$tr = new Translator();
$items = $tr->translations($lang, $items);
echo $tpl->render('translator/edit_source', array('items' => $items, 'name' => $info['name'], 'lang' => $lang, 'sources' => $sources, 'source' => $_GET['source'], 'empty' => $empty));
} else {
$num = isset($this->params[1]) ? $this->params[1] : 1;
$limit = 40;
$offset = ($num - 1) * $limit;
if ($empty) {
$tr = new Translator();
$all = $tr->translations($lang, $all);
foreach ($all as $k => $v) {
if ($v['trans'] !== '') {
unset($all[$k]);
}
}