<?php fof_add_item_widget('fof_sharing'); function fof_sharing($item) { $prefs = fof_prefs(); $sharing = $prefs['sharing']; if ($sharing != "tagged") { return false; } $tags = $item['tags']; $id = $item['item_id']; $shared = in_array("shared", $tags) ? true : false; $shared_image = $shared ? "plugins/share-on.gif" : "plugins/share-off.gif"; $shared_link = $shared ? "javascript:remove_tag({$id}, 'shared')" : "javascript:add_tag({$id}, 'shared')"; $shared_text = $shared ? "shared" : "not shared"; return "<a href=\"{$shared_link}\"><img src=\"{$shared_image}\" width=\"12\" height=\"12\" border=\"0\"/></a> <a href=\"{$shared_link}\">{$shared_text}</a> "; }
<?php fof_add_item_widget('fof_twitter'); function fof_twitter($item) { $url = html_entity_decode($item['item_link']); $tcolen = 23; $maxlen = 140 - $tcolen; $via = ' (via ' . $item['feed_title'] . ')'; $title = $item['item_title']; $text = $title . $via; # first try making the via shorter if (strlen($text) > $maxlen) { $via = ' via ' . $item['feed_title']; $text = $title . $via; } # then try truncating the title if (strlen($text) > $maxlen) { $text = substr($title, 0, $maxlen - strlen($via) - 3) . '...' . $via; } # then try truncating the source as well if (strlen($text) > $maxlen) { $text = substr($title, 0, $maxlen * strlen($title) / strlen($text) - 3) . '...' . substr($via, 0, $maxlen * strlen($via) / strlen($text) - 3) . '...'; } $posturl = 'http://twitter.com/home?status=' . urlencode("{$text} {$url}"); $linktag = '<a href="' . $posturl . '" onClick="window.open(\'' . $posturl . '\',\'post to twitter\',\'width=800,height=500,status=0,toolbar=0,location=0,menubar=0,resizeable=1\');return false;">'; return $linktag . '<img src="https://twitter.com/favicons/favicon.ico" height=16 width=16 /></a> ' . $linktag . 'tweet</a>'; } ?>
<?php fof_add_item_widget('fof_wordpress'); fof_add_pref('WordPress URL', 'plugin_wordpressurl'); function fof_wordpress($item) { $prefs = fof_prefs(); $wordpress = $prefs['plugin_wordpressurl']; if (!$wordpress) { return false; } $url = urlencode(html_entity_decode($item['item_link'])); $title = urlencode($item['item_title']); $text = urlencode('<blockquote>' . $item['item_content'] . '</blockquote>'); $link = "{$wordpress}/wp-admin/post-new.php?text={$text}&popupurl={$url}&popuptitle={$title}"; return "<a href='{$link}'><img src='plugins/wordpress.png' height=12 width=12 border=0 /></a> <a href='{$link}'>blog it</a>"; }
<?php fof_add_item_widget('fof_delicious'); function fof_delicious($item) { $url = urlencode(html_entity_decode($item['item_link'])); $title = urlencode($item['item_title']); return "<a href='http://del.icio.us/post?v=4;url={$url};title={$title}'><img src='plugins/delicious.png' height=12 width=12 border=0 /></a> <a href='http://del.icio.us/post?v=4;url={$url};title={$title}'>bookmark</a>"; } ?>
<?php fof_add_item_widget('fof_permalink'); function fof_permalink($item) { $url = html_entity_decode($item['item_link']); return '<a href="' . $url . '">permalink</a>'; } ?>