Пример #1
0
 public static function initWidgets(&$w)
 {
     $w->create('links', __('Blogroll'), array('tplBlogroll', 'linksWidget'));
     $w->links->setting('title', __('Title:'), __('Links'));
     $br = new dcBlogroll($GLOBALS['core']->blog);
     $h = $br->getLinksHierarchy($br->getLinks());
     $h = array_keys($h);
     $categories = array(__('All categories') => '');
     foreach ($h as $v) {
         if ($v) {
             $categories[$v] = $v;
         }
     }
     unset($br, $h);
     $w->links->setting('category', __('Category'), '', 'combo', $categories);
     $w->links->setting('homeonly', __('Home page only'), 1, 'check');
 }
Пример #2
0
 public static function initWidgets($w)
 {
     $w->create('links', __('Blogroll'), array('tplBlogroll', 'linksWidget'), null, 'Blogroll list');
     $w->links->setting('title', __('Title (optional)') . ' :', __('Links'));
     $br = new dcBlogroll($GLOBALS['core']->blog);
     $h = $br->getLinksHierarchy($br->getLinks());
     $h = array_keys($h);
     $categories = array(__('All categories') => '');
     foreach ($h as $v) {
         if ($v) {
             $categories[$v] = $v;
         }
     }
     unset($br, $h);
     $w->links->setting('category', __('Category'), '', 'combo', $categories);
     $w->links->setting('homeonly', __('Display on:'), 1, 'combo', array(__('All pages') => 0, __('Home page only') => 1, __('Except on home page') => 2));
     $w->links->setting('content_only', __('Content only'), 0, 'check');
     $w->links->setting('class', __('CSS class:'), '');
     $w->links->setting('offline', __('Offline'), 0, 'check');
 }
Пример #3
0
<?php

# -- BEGIN LICENSE BLOCK ---------------------------------------
#
# This file is part of Dotclear 2.
#
# Copyright (c) 2003-2013 Olivier Meunier & Association Dotclear
# Licensed under the GPL version 2.0 license.
# See LICENSE file or
# http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
#
# -- END LICENSE BLOCK -----------------------------------------
if (!defined('DC_CONTEXT_ADMIN')) {
    return;
}
$blogroll = new dcBlogroll($core->blog);
if (!empty($_REQUEST['edit']) && !empty($_REQUEST['id'])) {
    include dirname(__FILE__) . '/edit.php';
    return;
}
$default_tab = '';
$link_title = $link_href = $link_desc = $link_lang = '';
$cat_title = '';
# Import links
if (!empty($_POST['import_links']) && !empty($_FILES['links_file'])) {
    $default_tab = 'import-links';
    try {
        files::uploadStatus($_FILES['links_file']);
        $ifile = DC_TPL_CACHE . '/' . md5(uniqid());
        if (!move_uploaded_file($_FILES['links_file']['tmp_name'], $ifile)) {
            throw new Exception(__('Unable to move uploaded file.'));
Пример #4
0
 public static function xbel($args)
 {
     $blogroll = new dcBlogroll($GLOBALS['core']->blog);
     try {
         $links = $blogroll->getLinks();
     } catch (Exception $e) {
         self::p404();
         return;
     }
     if ($args) {
         self::p404();
         return;
     }
     http::cache($GLOBALS['mod_files'], $GLOBALS['mod_ts']);
     header('Content-Type: text/xml; charset=UTF-8');
     echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n" . '<!DOCTYPE xbel PUBLIC "+//IDN python.org//DTD XML Bookmark Exchange ' . 'Language 1.0//EN//XML"' . "\n" . '"http://www.python.org/topics/xml/dtds/xbel-1.0.dtd">' . "\n" . '<xbel version="1.0">' . "\n" . '<title>' . html::escapeHTML($GLOBALS['core']->blog->name) . " blogroll</title>\n";
     $i = 1;
     foreach ($blogroll->getLinksHierarchy($links) as $cat_title => $links) {
         if ($cat_title != '') {
             echo '<folder>' . "\n" . "<title>" . html::escapeHTML($cat_title) . "</title>\n";
         }
         foreach ($links as $k => $v) {
             $lang = $v['link_lang'] ? ' xml:lang="' . $v['link_lang'] . '"' : '';
             echo '<bookmark href="' . $v['link_href'] . '"' . $lang . '>' . "\n" . '<title>' . html::escapeHTML($v['link_title']) . "</title>\n";
             if ($v['link_desc']) {
                 echo '<desc>' . html::escapeHTML($v['link_desc']) . "</desc>\n";
             }
             if ($v['link_xfn']) {
                 echo "<info>\n" . '<metadata owner="http://gmpg.org/xfn/">' . $v['link_xfn'] . "</metadata>\n" . "</info>\n";
             }
             echo "</bookmark>\n";
         }
         if ($cat_title != '') {
             echo "</folder>\n";
         }
         $i++;
     }
     echo '</xbel>';
 }