|
|
|
@@ -12,14 +12,14 @@ class serendipity_plugin_syndication extends serendipity_plugin {
|
|
|
|
|
$propbag->add('version', '2.2.2');
|
|
|
|
|
$propbag->add('configuration', array(
|
|
|
|
|
'title',
|
|
|
|
|
'big_img',
|
|
|
|
|
'feed_format',
|
|
|
|
|
'subToMe',
|
|
|
|
|
'show_comment_feed',
|
|
|
|
|
'seperator',
|
|
|
|
|
'iconURL',
|
|
|
|
|
'feed_name',
|
|
|
|
|
'comment_name',
|
|
|
|
|
'seperator',
|
|
|
|
|
'subToMe',
|
|
|
|
|
'big_img',
|
|
|
|
|
'seperator2',
|
|
|
|
|
'fb_id',
|
|
|
|
|
'custom_url'
|
|
|
|
@@ -41,11 +41,11 @@ class serendipity_plugin_syndication extends serendipity_plugin {
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case 'feed_format':
|
|
|
|
|
$propbag->add('type', 'radio');
|
|
|
|
|
$propbag->add('name', SYNDICATION_PLUGIN_FEEDFORMAT);
|
|
|
|
|
$propbag->add('type', 'radio');
|
|
|
|
|
$propbag->add('name', SYNDICATION_PLUGIN_FEEDFORMAT);
|
|
|
|
|
$propbag->add('description', SYNDICATION_PLUGIN_FEEDFORMAT_DESC);
|
|
|
|
|
$propbag->add('default', 'rss');
|
|
|
|
|
$propbag->add('radio', array(
|
|
|
|
|
$propbag->add('default', 'rss');
|
|
|
|
|
$propbag->add('radio', array(
|
|
|
|
|
'value' => array('rss', 'atom', 'rssatom'),
|
|
|
|
|
'desc' => array(SYNDICATION_PLUGIN_20, sprintf(SYNDICATION_PLUGIN_GENERIC_FEED, 'Atom 1.0'), SYNDICATION_PLUGIN_20 .' + '. sprintf(SYNDICATION_PLUGIN_GENERIC_FEED, 'Atom 1.0'))
|
|
|
|
|
));
|
|
|
|
@@ -124,15 +124,17 @@ class serendipity_plugin_syndication extends serendipity_plugin {
|
|
|
|
|
{
|
|
|
|
|
global $serendipity;
|
|
|
|
|
|
|
|
|
|
// temporary fix for serendipity_getTemplateFile() path reset between S9y v.2.0 and 2.0.2 - remove later
|
|
|
|
|
$subimg = str_replace($serendipity['serendipityHTTPPath'].'templates/2k11/', '', $this->get_config('big_img', 'empty'), $count); // check and fix correct path
|
|
|
|
|
if ($count > 0) $this->set_config('big_img', $subimg); // fix in config
|
|
|
|
|
|
|
|
|
|
$title = $this->get_config('title');
|
|
|
|
|
$small_icon = serendipity_getTemplateFile($this->get_config('iconURL', 'img/xml.gif'));
|
|
|
|
|
$title = $this->get_config('title');
|
|
|
|
|
$iconURL = $this->get_config('iconURL', 'img/xml.gif');
|
|
|
|
|
if ($iconURL != 'none') {
|
|
|
|
|
$small_icon = serendipity_getTemplateFile($iconURL);
|
|
|
|
|
}
|
|
|
|
|
$custom_feed = trim($this->get_config('feed_name'));
|
|
|
|
|
$custom_comm = trim($this->get_config('comment_name'));
|
|
|
|
|
$custom_img = serendipity_getTemplateFile(trim($this->get_config('big_img', 'empty')));
|
|
|
|
|
$custom_img = trim($this->get_config('big_img', 'img/subtome.png'));
|
|
|
|
|
if ($custom_img != 'none' && $custom_img != "feedburner") {
|
|
|
|
|
$custom_img = serendipity_getTemplateFile($custom_img);
|
|
|
|
|
}
|
|
|
|
|
$subtome = serendipity_db_bool($this->get_config('subToMe', true));
|
|
|
|
|
$fbid = $this->get_config('fb_id');
|
|
|
|
|
$custom_url = serendipity_db_bool($this->get_config('custom_url', false));
|
|
|
|
@@ -150,7 +152,7 @@ class serendipity_plugin_syndication extends serendipity_plugin {
|
|
|
|
|
|
|
|
|
|
$icon = $small_icon;
|
|
|
|
|
if (!empty($custom_img) && $custom_img != 'default' && $custom_img != 'none' && $custom_img != 'empty') {
|
|
|
|
|
if ($subtome) $icon = $custom_img;
|
|
|
|
|
$icon = $custom_img;
|
|
|
|
|
if ($fbid != "" && $custom_img == 'feedburner') {
|
|
|
|
|
$icon = "http://feeds.feedburner.com/~fc/$fbid?bg=99CCFF&fg=444444&anim=0";
|
|
|
|
|
}
|
|
|
|
@@ -190,7 +192,7 @@ class serendipity_plugin_syndication extends serendipity_plugin {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
echo "\n".'<ul id="serendipity_syndication_list" class="plainList">';
|
|
|
|
|
echo $this->generateFeedButton($mainFeed, ($icon == $small_icon ? ($useRss ? "RSS $FEED" : "Atom $FEED") : ""), $onclick, $icon);
|
|
|
|
|
echo $this->generateFeedButton($mainFeed, ($icon == $small_icon ? ($useRss ? "RSS $FEED" : "Atom $FEED") : ""), $onclick, $icon, $icon == $small_icon);
|
|
|
|
|
|
|
|
|
|
if ($useRss && $useAtom) {
|
|
|
|
|
echo $this->generateFeedButton(serendipity_rewriteURL(PATH_FEEDS .'/atom10.xml'), "Atom $FEED",
|
|
|
|
@@ -206,25 +208,21 @@ class serendipity_plugin_syndication extends serendipity_plugin {
|
|
|
|
|
echo "</ul>\n";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function generateFeedButton($feed, $label, $onclick, $icon) {
|
|
|
|
|
$link = 'href="'.$feed.'" '. $onclick;
|
|
|
|
|
$path = $icon ? $icon : serendipity_getTemplateFile($this->get_config('iconURL', 'img/xml.gif'));
|
|
|
|
|
$output = "<li>\n";
|
|
|
|
|
if (serendipity_db_bool($this->get_config('subToMe', true))) {
|
|
|
|
|
if ($path != 'none' && !empty($path)) {
|
|
|
|
|
$output .= '<a class="serendipity_subtome" ' . $link . '><img src="' . $path . '" alt="XML" style="border: 0px" /></a>'."\n";
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
if ($path != 'none' && !empty($path)) {
|
|
|
|
|
$output .= '<a class="serendipity_xml_icon" ' . $link . '><img src="' . $path . '" alt="XML" style="border: 0px" /></a>'."\n";
|
|
|
|
|
}
|
|
|
|
|
function generateFeedButton($feed, $label, $onclick, $icon, $small = false) {
|
|
|
|
|
$link = 'href="'.$feed.'" '. $onclick;
|
|
|
|
|
$output = '<li>';
|
|
|
|
|
$class = "";
|
|
|
|
|
if ($onclick != "") { # this might be not a good solution, but right now works to add the subtome-class only when subtome is on
|
|
|
|
|
$class = "subtome";
|
|
|
|
|
}
|
|
|
|
|
if (!empty($label)) {
|
|
|
|
|
if ($path == 'none') {
|
|
|
|
|
$output .= '<a class="serendipity_subtome" ' . $link . '>' . $label . '</a>'."\n";
|
|
|
|
|
} else {
|
|
|
|
|
$output .= '<a class="serendipity_subtome serendipity_xml_plain" ' . $link . '>' . $label . '</a>'."\n";
|
|
|
|
|
}
|
|
|
|
|
if ($small) {
|
|
|
|
|
$class .= " serendipity_xml_icon";
|
|
|
|
|
}
|
|
|
|
|
if ($icon) {
|
|
|
|
|
$output .= '<a class="'. $class .'" ' . $link . '><img src="' . $icon . '" alt="XML" style="border: 0px" /></a>'."\n";
|
|
|
|
|
}
|
|
|
|
|
if (! empty($label)) {
|
|
|
|
|
$output .= " <a $link>$label</a>\n";
|
|
|
|
|
}
|
|
|
|
|
return $output .= "</li>\n";
|
|
|
|
|
}
|
|
|
|
|