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'); }
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'); }
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>'; }