예제 #1
0
==================== */
/**
 * Inserts translated categories into search category list
 *
 * @package I18n
 * @copyright (c) Cotonti Team
 * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
 */
defined('COT_CODE') or die('Wrong URL');
if (is_array($i18n_structure) && count($i18n_structure) > 0) {
    // Add translated categories into the multiselect
    foreach ($i18n_structure as $cat => $row) {
        if (isset($pages_cat_list[$cat])) {
            // Permissions to main category already checked
            foreach ($row as $lc => $x) {
                $pages_cat_list[$cat . ':' . $lc] = cot_breadcrumbs(cot_i18n_build_catpath('page', $cat, $lc), false, true, true);
            }
        }
    }
    // Extract previously selected options, they are handled separately
    $i18n_search_cats = array();
    if (is_array($rs['pag']['sub'])) {
        $subcnt = count($rs['pag']['sub']);
        $tmp = array();
        for ($i = 0; $i < $subcnt; $i++) {
            if (mb_strpos($rs['pag']['sub'][$i], ':') !== false) {
                list($cat, $lc) = explode(':', $rs['pag']['sub'][$i]);
                $i18n_search_cats[$lc][] = $cat;
            } else {
                $tmp[] = $rs['pag']['sub'][$i];
            }
예제 #2
0
<?php

/* ====================
[BEGIN_COT_EXT]
Hooks=tags.search.pages.loop
[END_COT_EXT]
==================== */
/**
 * Tag search for i18n pages
 *
 * @package I18n
 * @copyright (c) Cotonti Team
 * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
 */
defined('COT_CODE') or die('Wrong URL');
if (!empty($row['ipage_title'])) {
    $tags = cot_tag_list($row['page_id'], 'pages', array('tag_locale' => $row['ipage_locale']));
    $tag_list = '';
    $tag_i = 0;
    foreach ($tags as $tag) {
        $tag_t = $cfg['plugin']['tags']['title'] ? cot_tag_title($tag) : $tag;
        $tag_u = $cfg['plugin']['tags']['translit'] ? cot_translit_encode($tag) : $tag;
        $tl = $lang != 'en' && $tag_u != $tag ? 1 : null;
        if ($tag_i > 0) {
            $tag_list .= ', ';
        }
        $tag_list .= cot_rc_link(cot_url('plug', array('e' => 'tags', 'a' => 'pages', 't' => str_replace(' ', '-', $tag_u), 'tl' => $tl)), htmlspecialchars($tag_t), 'rel="nofollow"');
        $tag_i++;
    }
    $t->assign(array('TAGS_RESULT_ROW_URL' => empty($row['page_alias']) ? cot_url('page', 'c=' . $row['page_cat'] . '&id=' . $row['page_id'] . '&l=' . $row['ipage_locale']) : cot_url('page', 'c=' . $row['page_cat'] . '&al=' . $row['page_alias'] . '&l=' . $row['ipage_locale']), 'TAGS_RESULT_ROW_TITLE' => htmlspecialchars($row['ipage_title']), 'TAGS_RESULT_ROW_PATH' => cot_breadcrumbs(cot_i18n_build_catpath('page', $row['page_cat'], $row['ipage_locale']), false), 'TAGS_RESULT_ROW_TAGS' => $tag_list));
}
예제 #3
0
Hooks=page.list.tags
Tags=page.list.tpl:{I18N_LANG_ROW_URL},{I18N_LANG_ROW_CODE},{I18N_LANG_ROW_TITLE},{I18N_LANG_ROW_CLASS},{I18N_LANG_ROW_SELECTED}
[END_COT_EXT]
==================== */
/**
 * Redefines category tags and assings i18n tags
 *
 * @package I18n
 * @copyright (c) Cotonti Team
 * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
 */
defined('COT_CODE') or die('Wrong URL');
if ($i18n_enabled) {
    if ($cat_i18n && $i18n_notmain) {
        // Override category tags
        $catpath = cot_breadcrumbs(cot_i18n_build_catpath('page', $c, $i18n_locale), $cfg['homebreadcrumb']);
        $urlparams = !$cfg['plugin']['i18n']['omitmain'] || $i18n_locale != $cfg['defaultlang'] ? "c={$c}&l={$i18n_locale}" : "c={$c}";
        $t->assign(array('LIST_PAGETITLE' => $catpath, 'LIST_CATEGORY' => htmlspecialchars($cat_i18n['title']), 'LIST_CAT_RSS' => cot_url('rss', $urlparams), 'LIST_CATTITLE' => $cat_i18n['title'], 'LIST_CATPATH' => $catpath, 'LIST_CATDESC' => $cat_i18n['desc']));
    }
    // Render language selection
    $cat_i18n_locales = cot_i18n_list_cat_locales($c);
    if (count($cat_i18n_locales) > 0) {
        array_unshift($cat_i18n_locales, $cfg['defaultlang']);
        foreach ($cat_i18n_locales as $lc) {
            if ($lc == $i18n_locale) {
                $lc_class = 'selected';
                $lc_selected = 'selected="selected"';
            } else {
                $lc_class = '';
                $lc_selected = '';
            }
예제 #4
0
<?php

/* ====================
[BEGIN_COT_EXT]
Hooks=search.page.loop
[END_COT_EXT]
==================== */
/**
 * Displays translated pages in search results
 *
 * @package I18n
 * @copyright (c) Cotonti Team
 * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
 */
defined('COT_CODE') or die('Wrong URL');
if (!empty($row['ipage_title'])) {
    $page_url = empty($row['page_alias']) ? cot_url('page', 'c=' . $row['page_cat'] . '&id=' . $row['page_id'] . '&l=' . $row['ipage_locale'] . '&highlight=' . $hl) : cot_url('page', 'c=' . $row['page_cat'] . '&al=' . $row['page_alias'] . '&l=' . $row['ipage_locale'] . '&highlight=' . $hl);
    $t->assign(array('PLUGIN_PR_CATEGORY' => cot_breadcrumbs(cot_i18n_build_catpath('page', $row['page_cat'], $row['ipage_locale']), false), 'PLUGIN_PR_TITLE' => cot_rc_link($page_url, htmlspecialchars($row['ipage_title'])), 'PLUGIN_PR_TEXT' => cot_clear_mark($row['ipage_text'], $words), 'PLUGIN_PR_TIME' => cot_date('datetime_medium', $row['ipage_date']), 'PLUGIN_PR_TIMESTAMP' => $row['ipage_date']));
}
예제 #5
0
global $i18n_enabled, $i18n_notmain, $i18n_locale, $i18n_write, $i18n_admin;
if ($i18n_enabled && $i18n_notmain) {
    $i18n_array = array();
    $append_param = '';
    $urlparams = empty($page_data['page_alias']) ? array('c' => $page_data['page_cat'], 'id' => $page_data['page_id']) : array('c' => $page_data['page_cat'], 'al' => $page_data['page_alias']);
    if (!$cfg['plugin']['i18n']['omitmain'] || $i18n_locale != $cfg['defaultlang']) {
        $urlparams['l'] = $i18n_locale;
        $append_param = '&l=' . $i18n_locale;
    }
    $cat_i18n = cot_i18n_get_cat($page_data['page_cat'], $i18n_locale);
    if ($cat_i18n) {
        $cat_url = cot_url('page', 'c=' . $page_data['page_cat'] . $append_param);
        $validate_url = cot_url('admin', "m=page&a=validate&id={$page_data['page_id']}&x={$sys['xk']}{$append_param}");
        $unvalidate_url = cot_url('admin', "m=page&a=unvalidate&id={$page_data['page_id']}&x={$sys['xk']}{$append_param}");
        $edit_url = cot_url('page', "m=edit&id={$page_data['page_id']}{$append_param}");
        $pagepath = cot_i18n_build_catpath('page', $page_data['page_cat'], $i18n_locale);
        $catpath = cot_breadcrumbs($pagepath, $pagepath_home);
        $page_link = array(array(cot_url('page', $urlparams), $page_data['page_title']));
        $i18n_array = array_merge($i18n_array, array('TITLE' => cot_breadcrumbs(array_merge($pagepath, $page_link), $pagepath_home), 'CATTITLE' => htmlspecialchars($cat_i18n['title']), 'CATPATH' => $catpath, 'CATPATH_SHORT' => cot_rc_link(cot_url('page', 'c=' . $page_data['page_cat'] . $append_param), htmlspecialchars($cat_i18n['title'])), 'CATDESC' => htmlspecialchars($cat_i18n['desc'])));
        if ($admin_rights) {
            $i18n_array['ADMIN_EDIT'] = cot_rc_link($edit_url, $L['Edit']);
            $i18n_array['ADMIN_EDIT_URL'] = $edit_url;
            $i18n_array['ADMIN_UNVALIDATE'] = $page_data['page_state'] == 1 ? cot_rc_link($validate_url, $L['Validate']) : cot_rc_link($unvalidate_url, $L['Putinvalidationqueue']);
            $i18n_array['ADMIN_UNVALIDATE_URL'] = $page_data['page_state'] == 1 ? $validate_url : $unvalidate_url;
        } else {
            if ($usr['id'] == $page_data['page_ownerid']) {
                $i18n_array['ADMIN_EDIT'] = cot_rc_link($edit_url, $L['Edit']);
                $i18n_array['ADMIN_EDIT_URL'] = $edit_url;
            }
        }
    } else {
예제 #6
0
<?php

/* ====================
[BEGIN_COT_EXT]
Hooks=news.tags
[END_COT_EXT]
==================== */
/**
 * Modifies news selection to display
 * localized entries only
 *
 * @package I18n
 * @copyright (c) Cotonti Team
 * @license https://github.com/Cotonti/Cotonti/blob/master/License.txt
 */
defined('COT_CODE') or die('Wrong URL');
if ($i18n_enabled && $i18n_notmain) {
    // Overwrite some tags
    $news->assign(array('PAGE_CATPATH' => cot_breadcrumbs(cot_i18n_build_catpath('page', $cat, $i18n_locale), $cfg['homebreadcrumb']), 'PAGE_CATTITLE' => htmlspecialchars($cat_i18n['title'])));
}