Skip to content
Browse files

version 0.1 commit

  • Loading branch information...
0 parents commit bd1b623715edbc3a0696f3eec6c28d80916e81fb @yots committed Mar 9, 2011
0 README
No changes.
14 serendipity_plugin_pinboard/UTF-8/lang_de.inc.php
@@ -0,0 +1,14 @@
+<?php
+@define('PLUGIN_DELICIOUS_N', 'del.icio.us Plugin');
+@define('PLUGIN_DELICIOUS_D', 'Ein Plugin um besuchte Links und Blogmarks mittels dem Freien del.icio.us Service darzustellen.');
+@define('PLUGIN_DELICIOUS_TITLE_N', 'Titel der Seitenleiste');
+@define('PLUGIN_DELICIOUS_TITLE_D', 'Der Titel für die del.icio.us Seitenleiste');
+@define('PLUGIN_DELICIOUS_USERNAME_N', 'Benutzername');
+@define('PLUGIN_DELICIOUS_USERNAME_D', 'Der Benutzername des del.icio.us Zugangs. Hinweis: Falls Sie Tags darstellen wollen benutzen Sie die tag/<tag name> Methode, z.B. "tag/delicious". Tag-Kreuzungen sind auch mittels "tag/web+css" unterstützt.');
+@define('PLUGIN_DELICIOUS_DISPLAYNUMBER_N', 'Anzahl der darzustellenden Links');
+@define('PLUGIN_DELICIOUS_DISPLAYNUMBER_D', 'Wie viele del.icio.us Links sollen dargestellt werden (Standard ist die maximale Feed-Größe, 30)');
+@define('PLUGIN_DELICIOUS_CACHETIME_N', 'Wann soll der Feed aktualisiert werden?');
+@define('PLUGIN_DELICIOUS_CACHETIME_D', 'Der Inhalt des Feeds wird in einem Cache gespeichert, der aktualisiert wird sobald er älter als X Stunden ist (Standard: 1 Stunde)');
+@define('PLUGIN_DELICIOUS_MORELINK_N', 'Zeig "mehr"-Verknüpfung');
+@define('PLUGIN_DELICIOUS_MORELINK_D', 'Zeige Verknüpfung zum ausgewählten del.icio.us-Profil');
+@define('PLUGIN_DELICIOUS_MORELINK', 'Mehr');
14 serendipity_plugin_pinboard/lang_de.inc.php
@@ -0,0 +1,14 @@
+<?php
+@define('PLUGIN_PINBOARD_N', 'pinboard.in Plugin');
+@define('PLUGIN_PINBOARD_D', 'Ein Plugin um besuchte Links und Blogmarks des pinboard.in Service darzustellen.');
+@define('PLUGIN_PINBOARD_TITLE_N', 'Titel der Seitenleiste');
+@define('PLUGIN_PINBOARD_TITLE_D', 'Der Titel für die pinboard.in Seitenleiste');
+@define('PLUGIN_PINBOARD_USERNAME_N', 'Benutzername');
+@define('PLUGIN_PINBOARD_USERNAME_D', 'Der Benutzername des pinboard.in Zugangs. Hinweis: Falls Sie Tags darstellen wollen benutzen Sie die /t:<tag name> Methode, z.B. "/t:pinboard". Tag-Kreuzungen sind auch mittels "t:web+css" unterstützt.');
+@define('PLUGIN_PINBOARD_DISPLAYNUMBER_N', 'Anzahl der darzustellenden Links');
+@define('PLUGIN_PINBOARD_DISPLAYNUMBER_D', 'Wie viele pinboard.in Links sollen dargestellt werden (Standard ist die maximale Feed-Größe, 10)');
+@define('PLUGIN_PINBOARD_CACHETIME_N', 'Wann soll der Feed aktualisiert werden?');
+@define('PLUGIN_PINBOARD_CACHETIME_D', 'Der Inhalt des Feeds wird in einem Cache gespeichert, der aktualisiert wird sobald er älter als X Stunden ist (Standard: 1 Stunde)');
+@define('PLUGIN_PINBOARD_MORELINK_N', 'Zeig "mehr"-Verknüpfung');
+@define('PLUGIN_PINBOARD_MORELINK_D', 'Zeige Verknüpfung zum ausgewählten Pinboard.in-Profil');
+@define('PLUGIN_PINBOARD_MORELINK', 'Mehr');
184 serendipity_plugin_pinboard/serendipity_plugin_pinboard.php
@@ -0,0 +1,184 @@
+<?php
+/*
+ A pinboard.in plug-in - v0.1 (feed edition) Notations
+ -------------------------------------------------
+ email: nicolai.stoy@googlemail.com
+ //download: http://riscky.info:8080/serendipity/archives/4-A-del.icio.us-plug-in-v0.2-feed-edition-notations.html
+ //forum announcement: http://s9y.info/forums/viewtopic.php?p=2880
+ -------------------------------------------------
+ About:
+ A pinboard plug-in (feed edition) provides a basic dumbed down del.icio.us integration into Serendipity.
+ This plug-in based on the source of del.icio.us plug-in from riscky
+ download: http://riscky.info:8080/serendipity/archives/4-A-del.icio.us-plug-in-v0.2-feed-edition-notations.html
+ forum announcement: http://s9y.info/forums/viewtopic.php?p=2880
+
+ This plug-in should work; any comments etc can be directed towards nicolai\[dot\]stoy\{\@\}-googlemail-\[dot\]-com
+*/
+
+// Probe for a language include with constants. Still include defines later on, if some constants were missing
+$probelang = dirname(__FILE__) . '/' . $serendipity['charset'] . 'lang_' . $serendipity['lang'] . '.inc.php';
+
+if (IN_serendipity !== true) {
+ die ("Don't hack!");
+}
+
+if (file_exists($probelang)) {
+ include $probelang;
+}
+
+include dirname(__FILE__) . '/lang_de.inc.php';
+
+class serendipity_plugin_pinboard extends serendipity_plugin {
+
+ function introspect(&$propbag) {
+ $propbag->add('name', PLUGIN_PINBOARD_N);
+ $propbag->add('description', PLUGIN_PINBOARD_D);
+ $propbag->add('author', 'Nicolai Stoy');
+ $propbag->add('version', '0.1');
+ $propbag->add('requirements', array(
+ 'serendipity' => '0.8',
+ 'smarty' => '2.6.7',
+ 'php' => '4.1.0'
+ ));
+ $propbag->add('stackable', true);
+ $propbag->add('configuration',
+ array( 'sidebarTitle',
+ 'pinboardID',
+ 'displayNumber',
+ 'cacheTime',
+ 'moreLink',
+ 'morelink_text'
+ ));
+ $propbag->add('groups', array('FRONTEND_EXTERNAL_SERVICES'));
+ }
+
+ function introspect_config_item($name, &$propbag) {
+ switch($name) {
+ case 'sidebarTitle':
+ $propbag->add('type', 'string');
+ $propbag->add('name', PLUGIN_PINBOARD_TITLE_N);
+ $propbag->add('description', PLUGIN_PINBOARD_TITLE_D);
+ $propbag->add('default', 'My pinboard.in');
+ break;
+
+ case 'pinboardID':
+ $propbag->add('type', 'string');
+ $propbag->add('name', PLUGIN_PINBOARD_USERNAME_N);
+ $propbag->add('description', PLUGIN_PINBOARD_USERNAME_D);
+ $propbag->add('default', 'yots');
+ break;
+
+ case 'morelink_text':
+ $propbag->add('type', 'string');
+ $propbag->add('name', PLUGIN_PINBOARD_MORELINK_T);
+ $propbag->add('description', '');
+ $propbag->add('default', PLUGIN_PINBOARD_MORELINK);
+ break;
+
+ case 'displayNumber':
+ $propbag->add('type', 'string');
+ $propbag->add('name', PLUGIN_PINBOARD_DISPLAYNUMBER_N);
+ $propbag->add('description', PLUGIN_PINBOARD_DISPLAYNUMBER_D);
+ $propbag->add('default', '10');
+ break;
+
+ case 'cacheTime':
+ $propbag->add('type', 'string');
+ $propbag->add('name', PLUGIN_PINBOARD_CACHETIME_N);
+ $propbag->add('description', PLUGIN_PINBOARD_CACHETIME_D);
+ $propbag->add('default', 1);
+ break;
+
+ case 'moreLink':
+ $propbag->add('type', 'boolean');
+ $propbag->add('name', PLUGIN_PINBOARD_MORELINK_N);
+ $propbag->add('description', PLUGIN_PINBOARD_MORELINK_D);
+ $propbag->add('default', 'true');
+ break;
+
+ default:
+ return false;
+ }
+ return true;
+ }
+
+ function generate_content(&$title) {
+
+ global $serendipity;
+ $title = $this->get_config('sidebarTitle');
+ $pinboardID = $this->get_config('pinboardID');
+ $moreLink = $this->get_config('moreLink');
+
+ if (empty($pinboardID)) {
+ return false;
+ }
+
+ if ($this->get_config('displayNumber') < 10 && $this->get_config('displayNumber') >= 1) {
+ $displayNumber = $this->get_config('displayNumber');
+ } else {
+ $displayNumber = 10;
+ }
+
+ if ($this->get_config('cacheTime') > 0) {
+ $cacheTime = ($this->get_config('cacheTime') * 3600);
+ } else {
+ $cacheTime = 3600 + 1 ;
+ }
+
+ $gPinboardURL = 'http://feeds.pinboard.in/';
+ $gPinboardCacheLoc = $serendipity['serendipityPath'] . '/templates_c/pinboard_';
+
+ // safe write location... need to have local abilit
+
+ $parsedCache = $gPinboardCacheLoc . md5($pinboardID) . '.cache';
+
+ if(!is_file($parsedCache) || ((mktime() - filectime($parsedCache)) > $cacheTime)) {
+ if (!is_dir($gPinboardCacheLoc) && !mkdir($gPinboardCacheLoc, 0775)) {
+ print 'Try to chmod go+rwx - permissions are wrong.';
+ }
+
+ require_once 'Onyx/RSS.php';
+ $pinboardFeed = new Onyx_RSS();
+ //$pinboardFeed->setCachePath($gPinboardCacheLoc);
+ //$pinboardFeed->setExpiryTime($cacheTime);
+ //$pinboardFeed->parse($gPinboardURL .'rss/' . $pinboardID, md5($pinboardID) . '.dat');
+ $pinboardFeed->parse($gPinboardURL . 'rss/u:' . $pinboardID);
+
+ if( $pinboardFeed->numItems() >= 1 ) {
+ $fileHandle = @fopen($parsedCache, 'w');
+ if ($fileHandle) {
+
+ $pinboardContent = '<ul class="plainList">';
+ for($i = 0; ($item = $pinboardFeed->getNextItem()) && ($i < $displayNumber); $i++) {
+ $pinboardContent .=
+ '<li>' .
+ '<a href="' . pinboard_clean_htmlspecialchars($item['link']) .
+ '" title="' . $item['description'] . '" rel="external">' . pinboard_clean_htmlspecialchars($item['title']) . '</a></li>';
+ }
+
+ $pinboardContent .= '</ul>';
+ fwrite($fileHandle, $pinboardContent);
+ fclose($fileHandle);
+ print $pinboardContent;
+ } else {
+ print '<p>A pinboard.in error occured! <br />' . 'Error Message: unable to make a pinboard.in cache file: ' . $parsedCache . '!</p>';
+ }
+ } elseif (is_file($parsedCache)) {
+ print file_get_contents($parsedCache);
+ } else {
+ print '<p>A pinboard.in error occured! <br />' . 'Error Message: rss failed</p>';
+ }
+ } else {
+ print file_get_contents($parsedCache);
+ }
+
+ if (serendipity_db_bool($moreLink)) {
+ print '<p><a href="' . $gPinboardURL . $pinboardID . '/">' . $this->get_config('morelink_text') . '</a></p>';
+ }
+ }
+}
+
+function pinboard_clean_htmlspecialchars($given, $quote_style = ENT_QUOTES) {
+ return htmlspecialchars(html_entity_decode($given, $quote_style), $quote_style);
+}
+?>

0 comments on commit bd1b623

Please sign in to comment.
Something went wrong with that request. Please try again.