Exemplo n.º 1
0
 public static function displayRSSLink($params)
 {
     global $url, $parent, $SITEURL;
     if (!@$params['name']) {
         return;
     }
     $href = function_exists('find_i18n_url') ? find_i18n_url($url, $parent) : find_url($url, $parent);
     $href .= (strpos($url, '?') === false ? '?' : '&') . $params['name'];
     echo '<a href="' . htmlspecialchars($href) . '"><img src="' . $SITEURL . 'plugins/i18n_search/images/rss.gif" alt="rss" width="12" height="12"/> ' . htmlspecialchars(@$params['title']) . '</a>';
 }
Exemplo n.º 2
0
 public static function generateSitemapWithoutPing()
 {
     global $SITEURL;
     $filenames = getFiles(GSDATAPAGESPATH);
     if (count($filenames)) {
         foreach ($filenames as $file) {
             if (isFile($file, GSDATAPAGESPATH, 'xml')) {
                 $data = getXML(GSDATAPAGESPATH . $file);
                 if ($data->url != '404' && $data->private != 'Y') {
                     $pagesArray[] = array('url' => (string) $data->url, 'parent' => (string) $data->parent, 'date' => (string) $data->pubDate, 'menuStatus' => (string) $data->menuStatus);
                 }
             }
         }
     }
     $pagesSorted = subval_sort($pagesArray, 'menuStatus');
     $languages = return_i18n_available_languages();
     $deflang = return_i18n_default_language();
     $xml = new SimpleXMLElement('<?xml version="1.0" encoding="UTF-8"?><urlset></urlset>');
     $xml->addAttribute('xsi:schemaLocation', 'http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd', 'http://www.w3.org/2001/XMLSchema-instance');
     $xml->addAttribute('xmlns', 'http://www.sitemaps.org/schemas/sitemap/0.9');
     if (count($pagesSorted)) {
         foreach ($pagesSorted as $page) {
             // set <loc>
             if (count($languages) > 1) {
                 $pos = strrpos($page['url'], '_');
                 if ($pos !== false) {
                     $pageLoc = find_i18n_url(substr($page['url'], 0, $pos), $page['parent'], substr($page['url'], $pos + 1));
                 } else {
                     $pageLoc = find_i18n_url($page['url'], $page['parent'], $deflang);
                 }
             } else {
                 $pageLoc = find_i18n_url($page['url'], $page['parent']);
             }
             // set <lastmod>
             $pageLastMod = makeIso8601TimeStamp(date("Y-m-d H:i:s", strtotime($page['date'])));
             // set <changefreq>
             $pageChangeFreq = 'weekly';
             // set <priority>
             $pagePriority = $page['menuStatus'] == 'Y' ? '1.0' : '0.5';
             //add to sitemap
             $url_item = $xml->addChild('url');
             $url_item->addChild('loc', htmlspecialchars($pageLoc));
             $url_item->addChild('lastmod', $pageLastMod);
             $url_item->addChild('changefreq', $pageChangeFreq);
             $url_item->addChild('priority', $pagePriority);
         }
     }
     //create xml file
     $file = GSROOTPATH . 'sitemap.xml';
     XMLsave($xml, $file);
 }
Exemplo n.º 3
0
 public static function outputLink($gallery)
 {
     include_once GSPLUGINPATH . 'i18n_gallery/helper.php';
     $url = @$gallery['url'] ? $gallery['url'] : 'index';
     $parent = @$gallery['parent'] ? $gallery['parent'] : null;
     $tags = @$gallery['tags'] ? $gallery['tags'] : null;
     $thumb = i18n_gallery_thumb($gallery);
     $title = $gallery['title'];
     if (function_exists('return_i18n_languages')) {
         $languages = return_i18n_languages();
         $deflang = return_i18n_default_language();
         foreach ($languages as $language) {
             $fullkey = 'title' . ($language == $deflang ? '' : '_' . $language);
             if (isset($gallery[$fullkey])) {
                 $title = $gallery[$fullkey];
                 break;
             }
         }
     }
     $link = function_exists('find_i18n_url') ? find_i18n_url($url, $parent) : find_url($url, $parent);
     if ($tags) {
         $link .= (strpos($link, '?') !== false ? '&' : '?') . 'imagetags=' . urlencode($tags);
     }
     if (isset($thumb)) {
         $item = @$gallery['items'][$thumb];
         if (!$item) {
             $item = $gallery['items'][0];
         }
         echo '<div class="gallery-link">';
         echo '<a href="' . htmlspecialchars($link) . '" class="gallery-thumb-link">';
         echo '<img src="';
         i18n_gallery_thumb_link($gallery, $item);
         echo '" alt="' . htmlspecialchars($title) . '" title="' . htmlspecialchars($title) . '"/>';
         echo '</a>';
         echo '<span class="gallery-title">' . htmlspecialchars($title) . '</span>';
         echo '</div>';
     } else {
         echo '<a href="' . htmlspecialchars($link) . '" class="gallery-title-link">';
         echo htmlspecialchars($title);
         echo '</a>';
     }
 }
Exemplo n.º 4
0
function i18n_customfields_list_pages_json()
{
    if (function_exists('find_i18n_url') && class_exists('I18nNavigationFrontend')) {
        $slug = isset($_GET['id']) ? $_GET['id'] : (isset($_GET['newid']) ? $_GET['newid'] : '');
        $pos = strpos($slug, '_');
        $lang = $pos !== false ? substr($slug, $pos + 1) : null;
        $structure = I18nNavigationFrontend::getPageStructure(null, false, null, $lang);
        $pages = array();
        $nbsp = html_entity_decode('&nbsp;', ENT_QUOTES, 'UTF-8');
        $lfloor = html_entity_decode('&lfloor;', ENT_QUOTES, 'UTF-8');
        foreach ($structure as $page) {
            $text = ($page['level'] > 0 ? str_repeat($nbsp, 5 * $page['level'] - 2) . $lfloor . $nbsp : '') . cl($page['title']);
            $link = find_i18n_url($page['url'], $page['parent'], $lang ? $lang : return_i18n_default_language());
            $pages[] = array($text, $link);
        }
        return json_encode($pages);
    } else {
        return list_pages_json();
    }
}
Exemplo n.º 5
0
/**
 * bootstrap_get_navigation()
 *
 * This creates the menu structure for use with the main navigation
 * This function supports drop down menus when the i18n navigation
 * plugin is installed.
 * 
 * @param $slug (string) : The page 'slug' to get the navigation for
 * @return (string) : String containing HTML <ul> list of menu data
 */
function bootstrap_get_navigation($slug)
{
    if (function_exists('get_i18n_navigation')) {
        # i18n Navigation plugin installed
        $mdata = return_i18n_menu_data($slug, 0, 99, I18N_SHOW_MENU);
        foreach ($mdata as $item) {
            $url = function_exists('find_i18n_url') ? find_i18n_url($item['url'], $item['parent']) : find_url($item['url'], $item['parent']);
            $title = $item['menu'] ? $item['menu'] : $item['title'];
            $class = $item['url'];
            if ($item['current']) {
                $class .= ' active';
            }
            if ($item['haschildren']) {
                $class .= ' dropdown';
            }
            echo '<li class="' . $class . '">';
            if (is_array($item['children'])) {
                echo '<a href="" class="dropdown-toggle" data-toggle="dropdown">' . $title . '<b class="caret"></b></a>';
                echo '<ul class="dropdown-menu">';
                echo '<li><a href="' . $url . '">' . $title . '</a></li><li class="divider"></li>';
                foreach ($item['children'] as $k => $v) {
                    $c_url = function_exists('find_i18n_url') ? find_i18n_url($v['url'], $v['parent']) : find_url($v['url'], $v['parent']);
                    $c_title = $v['menu'] ? $v['menu'] : $v['title'];
                    echo '<li><a href="' . $c_url . '">' . $c_title . '</a></li>';
                }
                echo '</ul>';
                echo '</li>';
            } else {
                echo '<a href="' . $url . '">' . $title . '</a></li>';
            }
        }
    } else {
        # GetSimple core navigation
        get_navigation($slug);
    }
}
Exemplo n.º 6
0
        ?>
">&gt;</a></td>
            <td class="secondarylink"><a href="#" class="toggleMenu" title="<?php 
        i18n('i18n_navigation/TOGGLE_MENU');
        ?>
">M</a></td>
            <td class="secondarylink"><a href="#" class="togglePrivate" title="<?php 
        i18n('i18n_navigation/TOGGLE_PRIVATE');
        ?>
">P</a></td>
	          <td class="secondarylink">
	            <a title="<?php 
        echo i18n_r('VIEWPAGE_TITLE') . ': ' . stripslashes($page['title']);
        ?>
" target="_blank" href="<?php 
        echo $i18n_url ? find_i18n_url($page['url'], $page['parent'], $def_language) : find_url($page['url'], $page['parent']);
        ?>
">#</a>
	          </td>
           </tr>
        <?php 
        $i++;
    }
}
?>
        </tbody>
			</table>
      <input type="submit" name="save" value="<?php 
i18n('i18n_navigation/SAVE_NAVIGATION');
?>
" class="submit"/>
Exemplo n.º 7
0
 public static function outputHeader($full = true, $omit = null)
 {
     global $metad, $metak, $title, $content, $url, $parent, $language;
     include GSADMININCPATH . 'configuration.php';
     if ($metad != '') {
         $description = stripslashes(htmlspecialchars_decode($metad, ENT_QUOTES));
     } else {
         if (function_exists('mb_substr')) {
             $description = trim(mb_substr(html_entity_decode(strip_tags(stripslashes(htmlspecialchars_decode($content, ENT_QUOTES))), ENT_QUOTES, 'UTF-8'), 0, 160));
         } else {
             $description = trim(substr(html_entity_decode(strip_tags(stripslashes(htmlspecialchars_decode($content, ENT_QUOTES))), ENT_QUOTES, 'UTF-8'), 0, 160));
         }
         $description = preg_replace('/\\(%.*?%\\)/', " ", $description);
         $description = preg_replace('/\\{%.*?%\\}/', " ", $description);
         $description = preg_replace('/\\n/', " ", $description);
         $description = preg_replace('/\\r/', " ", $description);
         $description = preg_replace('/\\t/', " ", $description);
         $description = preg_replace('/ +/', " ", $description);
     }
     $keywords = array();
     $tags = preg_split("/\\s*,\\s*/", stripslashes(htmlspecialchars_decode($metak, ENT_QUOTES)));
     if (count($tags) > 0) {
         foreach ($tags as $tag) {
             if (substr(trim($tag), 0, 1) != '_') {
                 $keywords[] = trim($tag);
             }
         }
     }
     if (!$omit || !in_array('description', $omit)) {
         echo '<meta name="description" content="' . htmlspecialchars(trim($description)) . '" />' . "\n";
     }
     if (!$omit || !in_array('keywords', $omit)) {
         echo '<meta name="keywords" content="' . htmlspecialchars(implode(', ', $keywords)) . '" />' . "\n";
     }
     if ($full) {
         if (!$omit || !in_array('generator', $omit)) {
             echo '<meta name="generator" content="' . $site_full_name . '" />' . "\n";
         }
         if (!$omit || !in_array('canonical', $omit)) {
             echo '<link rel="canonical" href="' . find_i18n_url($url, $parent, $language) . '" />' . "\n";
         }
     }
     if (function_exists('get_scripts_frontend')) {
         get_scripts_frontend();
     }
     exec_action('theme-header');
 }
Exemplo n.º 8
0
 public function __get($name)
 {
     switch ($name) {
         case 'id':
         case 'url':
         case 'slug':
             return $this->item['url'];
         case 'parent':
             return $this->item['parent'];
         case 'classes':
             return $this->classes;
         case 'text':
             return $this->text;
         case 'title':
             return $this->title;
         case 'current':
         case 'iscurrent':
         case 'isCurrent':
             return $this->item['current'];
         case 'currentpath':
         case 'currentPath':
         case 'iscurrentpath':
         case 'isCurrentPath':
             return $this->item['currentpath'];
         case 'haschildren':
         case 'hasChildren':
             return $this->item['haschildren'];
         case 'open':
         case 'isOpen':
             return isset($this->item['children']) && count($this->item['children']) > 0;
         case 'closed':
         case 'isClosed':
             return $this->item['haschildren'] && (!isset($this->item['children']) || count($this->item['children']) <= 0);
         case 'titles':
         case 'showtitles':
         case 'showTitles':
             return $this->showTitles;
         case 'link':
             if (@$this->item['link']) {
                 return $this->item['link'];
             } else {
                 if (function_exists('find_i18n_url')) {
                     return find_i18n_url($this->item['url'], $this->item['parent']);
                 } else {
                     return find_url($this->item['url'], $this->item['parent']);
                 }
             }
         case 'simplelink':
         case 'simpleLink':
             if (@$this->item['link']) {
                 return $this->item['link'];
             } else {
                 return find_url($this->item['url'], $this->item['parent']);
             }
         case 'content':
             return html_entity_decode(stripslashes((string) $this->getProp('content')), ENT_QUOTES, 'UTF-8');
         case 'tags':
             return preg_split('/\\s*,\\s*/', trim(html_entity_decode(stripslashes((string) $this->getProp('meta')), ENT_QUOTES, 'UTF-8')));
         default:
             return (string) $this->getProp($name);
     }
 }
Exemplo n.º 9
0
 protected function get($name)
 {
     if (!$this->data) {
         $this->data = getXML(GSDATAPAGESPATH . $this->fullId . '.xml');
         if (!$this->data) {
             return null;
         }
     }
     switch ($name) {
         case 'tags':
             if ($this->tags == null) {
                 $metak = html_entity_decode(strip_tags(stripslashes(htmlspecialchars_decode($this->data->meta))), ENT_QUOTES, 'UTF-8');
                 $this->tags = preg_split("/\\s*,\\s*/", trim($metak), -1, PREG_SPLIT_NO_EMPTY);
             }
             return $this->tags;
         case 'title':
             if ($this->title == null) {
                 $this->title = stripslashes(html_entity_decode($this->data->title, ENT_QUOTES, 'UTF-8'));
             }
             return $this->title;
         case 'content':
             if ($this->content == null) {
                 $this->content = stripslashes(htmlspecialchars_decode($this->data->content, ENT_QUOTES));
             }
             return $this->content;
         case 'contenttext':
             if ($this->content == null) {
                 $this->content = stripslashes(htmlspecialchars_decode($this->data->content, ENT_QUOTES));
             }
             return trim(strip_tags($this->content));
         case 'url':
             return $this->id;
         case 'slug':
             return $this->fullId;
         case 'parent':
             return (string) $this->data->parent;
         case 'link':
             if (function_exists('find_i18n_url')) {
                 return find_i18n_url($this->id, $this->parent, $this->language);
             } else {
                 return find_url($this->fullId, $this->parent);
             }
         case 'simplelink':
             return find_url($this->fullId, $this->parent);
         case 'menuOrder':
             if ($this->id != $this->fullId) {
                 return $this->getDefaultDataProp($name);
             }
             return (int) $this->data->{$name};
         case 'parent':
         case 'menuStatus':
         case 'private':
             if ($this->id != $this->fullId) {
                 return $this->getDefaultDataProp($name);
             }
         default:
             return (string) $this->data->{$name};
     }
 }
Exemplo n.º 10
0
function i18n_gallery_page_url()
{
    global $url, $parent;
    return function_exists('find_i18n_url') ? find_i18n_url($url, $parent) : find_url($url, $parent);
}
Exemplo n.º 11
0
                    $gallery = return_i18n_gallery(@$_POST['post-name']);
                    // reread
                    $name = @$_POST['post-name'];
                } else {
                    $msg = i18n_r('i18n_gallery/SAVE_FAILURE');
                }
            }
        } else {
            $gallery = return_i18n_gallery(@$_GET['name']);
        }
    }
}
$settings = i18n_gallery_settings();
$w = intval(@$settings['adminthumbwidth']) > 0 ? intval($settings['adminthumbwidth']) : I18N_GALLERY_DEFAULT_THUMB_WIDTH;
$h = intval(@$settings['adminthumbheight']) > 0 ? intval($settings['adminthumbheight']) : I18N_GALLERY_DEFAULT_THUMB_HEIGHT;
$viewlink = function_exists('find_i18n_url') ? find_i18n_url('index', null) : find_url('index', null);
$viewlink .= (strpos($viewlink, '?') === false ? '?' : '&amp;') . 'name=' . $name . '&amp;preview-gallery';
$plugins = i18n_gallery_plugins();
$plugins = subval_sort($plugins, 'name');
// default gallery type
if (!@$gallery['type']) {
    $gallery['type'] = @$settings['type'] ? $settings['type'] : I18N_GALLERY_DEFAULT_TYPE;
}
?>
		<h3 class="floated" style="float:left"><?php 
$name ? i18n('i18n_gallery/EDIT_HEADER') : i18n('i18n_gallery/CREATE_HEADER');
?>
</h3>

		<div class="edit-nav" >
      <p>
Exemplo n.º 12
0
<?php

global $SITEURL;
require_once GSPLUGINPATH . 'i18n_search/viewer.class.php';
$i18n =& $params;
// alias for i18n parsing
$slug = array_key_exists('slug', $params) ? $params['slug'] : return_page_slug();
$showTags = array_key_exists('showTags', $params) ? $params['showTags'] : true;
$minTagSizePercent = array_key_exists('minTagSize', $params) ? (int) $params['minTagSize'] : 100;
$maxTagSizePercent = array_key_exists('maxTagSize', $params) ? (int) $params['maxTagSize'] : 250;
$addTags = array_key_exists('addTags', $params) ? $params['addTags'] : '';
$goText = @$i18n['GO'];
$is_ajax = !isset($params['ajax']) || $params['ajax'];
$live = $is_ajax && isset($params['live']) && $params['live'];
$url = function_exists('find_i18n_url') ? find_i18n_url($slug, null) : find_url($slug, null);
$method = strpos($url, '?') !== false ? 'POST' : 'GET';
// with GET the parameters are not submitted!
$language = isset($params['lang']) ? $params['lang'] : null;
$placeholderText = @$params['PLACEHOLDER'];
// languages
$reqlangs = null;
if (function_exists('return_i18n_languages')) {
    $deflang = return_i18n_default_language();
    $languages = $language ? array($language) : return_i18n_languages();
    foreach ($languages as $lang) {
        if ($lang == $deflang) {
            $lang = '';
        }
        $reqlangs = $reqlangs === null ? $lang : $reqlangs . ',' . $lang;
    }
}
Exemplo n.º 13
0
                echo i18n_r('EDITPAGE_TITLE') . ': ' . stripslashes($variant['title']) . ' - ' . shtDate($variant['date']);
                ?>
" href="edit.php?id=<?php 
                echo $variant['url'];
                ?>
" class="title"><?php 
                echo stripslashes($variant['title']);
                ?>
</a>
            </td>
	          <td class="secondarylink">
	            <a title="<?php 
                echo i18n_r('VIEWPAGE_TITLE') . ': ' . stripslashes($variant['title']);
                ?>
" target="_blank" href="<?php 
                echo find_i18n_url($page['url'], $page['parent'], $lang);
                ?>
">#</a>
	          </td>
	          <td class="delete" >
              <a class="i18n-delconfirm" href="deletefile.php?id=<?php 
                echo $variant['url'];
                ?>
&nonce=<?php 
                echo get_nonce("delete", "deletefile.php");
                ?>
" title="<?php 
                echo i18n_r('DELETEPAGE_TITLE') . ': ' . stripslashes($variant['title']);
                ?>
"><?php 
                echo $is31 ? '&times;' : 'X';
Exemplo n.º 14
0
<?php

global $id, $parent;
if (isset($_GET['id'])) {
    if (($pos = strrpos($id, '_')) !== false) {
        $viewlink = find_i18n_url(substr($id, 0, $pos), (string) $parent, substr($id, $pos + 1));
    } else {
        $viewlink = find_i18n_url($id, (string) $parent, return_i18n_default_language());
    }
}
?>
<script type="text/javascript">
  // <![CDATA[
  $(function() {
<?php 
if (isset($_GET['id'])) {
    ?>
    $('.edit-nav a[target=_blank]').attr('href', <?php 
    echo json_encode($viewlink);
    ?>
);
<?php 
}
if (!$id && isset($_GET['newid'])) {
    ?>
    $('#post-id').val(<?php 
    echo json_encode($_GET['newid']);
    ?>
);
<?php 
}
Exemplo n.º 15
0
<?php

if (function_exists('find_i18n_url')) {
    $slug = isset($_GET['id']) ? $_GET['id'] : (isset($_GET['newid']) ? $_GET['newid'] : '');
    $pos = strpos($slug, '_');
    $lang = $pos !== false ? substr($slug, $pos + 1) : null;
    $structure = I18nNavigationFrontend::getPageStructure(null, false, null, $lang);
    $pages = array();
    $nbsp = html_entity_decode('&nbsp;', ENT_QUOTES, 'UTF-8');
    $lfloor = html_entity_decode('&lfloor;', ENT_QUOTES, 'UTF-8');
    foreach ($structure as $page) {
        $text = ($page['level'] > 0 ? str_repeat($nbsp, 5 * $page['level'] - 2) . $lfloor . $nbsp : '') . cl($page['title']);
        $link = find_i18n_url($page['url'], $page['parent'], '(' . ($lang ? $lang : return_i18n_default_language()) . ')');
        $pages[] = array($text, $link);
    }
    ?>
<script type="text/javascript">
  //<![CDATA[
  // modify existing Link dialog
  CKEDITOR.on( 'dialogDefinition', function( ev ) {
    if ((ev.editor != editor) || (ev.data.name != 'link')) return;

    var definition = ev.data.definition;
    var infoTab = definition.getContents('info');
    
    for (var i=0; i<infoTab.elements.length; i++) {
      var element = infoTab.elements[i];
      if ('id' in element && element.id == 'localPageOptions') {
        element.children[0].items = <?php 
    echo json_encode($pages);
    ?>
Exemplo n.º 16
0
}
// get URLs that match the already selected tags
$filteredurls = null;
if ($reqtags) {
    foreach ($reqtags as $tag) {
        if (isset($alltags[$tag])) {
            $filteredurls = $filteredurls ? array_values(array_intersect($filteredurls, $alltags[$tag])) : $alltags[$tag];
        } else {
            $filteredurls = array();
        }
    }
}
$numPages = count($allurls);
$diffPercent = $maxPercent - $minPercent;
if (@$slug) {
    $pagedata = getXML(GSDATAPAGESPATH . $slug . '.xml');
    $link = function_exists('find_i18n_url') ? find_i18n_url($slug, (string) $pagedata->parent) : find_url($slug, (string) $pagedata->parent);
    $link .= (strpos($link, '?') !== false ? '&' : '?') . 'tags=';
}
foreach ($alltags as $tag => &$urls) {
    if (substr($tag, 0, 1) == '_') {
        continue;
    }
    $tagurls = array_intersect($urls, $allurls);
    if ($addtags && count($tagurls) <= 0) {
        continue;
    }
    $unavailable = $filteredurls && count(array_intersect($tagurls, $filteredurls)) <= 0;
    $classes = @$link || !$unavailable ? 'tag' : 'tag unavailable';
    echo (@$link ? '<a href="' . htmlspecialchars($link) . urlencode($tag) . '" ' : '<span ') . 'style="font-size:' . (int) ($minPercent + $diffPercent * count($tagurls) / $numPages) . '%" class="' . $classes . '">' . htmlspecialchars(trim(preg_replace('/_+/', ' ', $tag))) . (@$link ? '</a> ' : '</span> ');
}