/[drupal]/contributions/modules/feedbuttons/feedbuttons.module
ViewVC logotype

Contents of /contributions/modules/feedbuttons/feedbuttons.module

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.5 - (show annotations) (download) (as text)
Mon May 29 01:57:45 2006 UTC (3 years, 6 months ago) by antinomia
Branch: MAIN
CVS Tags: DRUPAL-4-7--1-0, HEAD
Branch point for: DRUPAL-5, DRUPAL-4-7
Changes since 1.4: +58 -52 lines
File MIME type: text/x-php
fixed image paths, readme
1 <?php
2 /**
3 * This module enables a block which shows button-links
4 * which allow users to subscribe to your feed in their
5 * favorite RSS reader (Google, Bloglines, Newsgator,
6 * Pluck, etc).
7 */
8
9 /**
10 * Display help and module information
11 * @param section which section of the site we're displaying help
12 * @return help text for section
13 */
14 function feedbuttons_help($section='') {
15 $output = '';
16 switch ($section) {
17 case "admin/modules#name":
18 $output = t("Feed Buttons");
19 break;
20 case "admin/modules#description":
21 $output = t("Enables block with RSS subscripton buttons");
22 break;
23 }
24 return $output;
25 } // function feedbuttons_help
26
27
28 /**
29 * Valid permissions for this module
30 * @return An array of valid permissions for the onthisdate module
31 */
32 function feedbuttons_perm() {
33 return array('administer feedbuttons');
34 } // function feedbuttons_perm()
35
36
37 /**
38 * Declare the name of this block, later we'll generate HTML for the onthisdate block
39 * @param op the operation from the URL
40 * @param delta offset
41 * @returns block HTML
42 */
43 function feedbuttons_block($op='list', $delta=0) {
44 // listing of blocks, such as on the admin/block page
45 if ($op == "list") {
46 $block[0]["info"] = t("Subscribe Buttons");
47 return $block;
48 } else if ($op == 'view') {
49 // our block content
50 // content variable that will be returned for display
51 $block_content = '';
52
53 if (arg(0) == 'node') {
54 $currentpage = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
55 }
56
57 // $blogname = variable_get('feedbuttons_blog_title', variable_get('site_name', 'drupal'));
58 // $blogurl = variable_get('feedbuttons_blog_url', url('blog',NULL,NULL,TRUE));
59 $feedurl = variable_get('feedbuttons_feed_url', url('node/feed',NULL,NULL,TRUE));
60 if ($buttons = variable_get('feedbuttons_show_items','')) {
61 foreach ($buttons as $button) {
62 if ($button === 'feediconlg') { $block_content .= '<a href="' . $feedurl . '"><img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/feed-icon32x32.png" alt="Feed Icon" /></a><br />'; }
63 if ($button === 'feedicon') { $block_content .= '<a href="' . $feedurl . '"><img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/feed-icon.gif" alt="Feed Icon" /></a><br />'; }
64 if ($button === 'xml') { $block_content .= '<a href="' . $feedurl . '"><img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/xml.gif" alt="XML Icon" /></a><br />'; }
65 if ($button === 'google') { $block_content .= '<a href="http://fusion.google.com/add?feedurl=' . $feedurl . '"><img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/google-all.gif" alt="Google" /></a><br />'; }
66 if ($button === 'delicious') { $block_content .= '<a href="http://del.icio.us/post?url=' . $currentpage . '"><img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/delicious.gif" alt="Delicious" /></a><br />'; }
67 if ($button === 'yahoo') { $block_content .= '<a href="http://add.my.yahoo.com/rss?url=' . $feedurl . '"><img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/yahoo.gif" alt="Yahoo!" /></a><br />'; }
68 if ($button === 'bloglines') { $block_content .= '<a href="http://www.bloglines.com/sub/' . $feedurl . '"><img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/bloglines.gif" alt="Bloglines" /></a><br />'; }
69 if ($button === 'newsgator') { $block_content .= '<a href="http://www.newsgator.com/ngs/subscriber/subext.aspx?url=' . $feedurl . '"><img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/newsgator.gif" alt="Newsgator" /></a><br />'; }
70 if ($button === 'msn') { $block_content .= '<a href="http://my.msn.com/addtomymsn.armx?id=rss&ut=' . $feedurl . '"><img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/msn.gif" alt="MSN" /></a><br />'; }
71 if ($button === 'feedster') { $block_content .= '<a href="http://www.feedster.com/myfeedster.php?action=addrss&rssurl=' . $feedurl . '&confirm=no"><img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/addmyfeedster.gif" alt="Feedster" /></a><br />'; }
72 if ($button === 'aol') { $block_content .= '<a href="http://feeds.my.aol.com/add.jsp?url=' . $feedurl . '"><img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/aol.gif" alt="AOL" /></a><br />'; }
73 if ($button === 'furl') { $block_content .= '<a href="http://www.furl.net/storeIt.jsp?u=' . $feedurl . '"><img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/furl.gif" alt="Furl" /></a><br />'; }
74 if ($button === 'rojo') { $block_content .= '<a href="http://www.rojo.com/add-subscription?resource=' . $feedurl . '"><img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/rojo.gif" alt="Rojo" /></a><br />'; }
75 if ($button === 'newsburst') { $block_content .= '<a href="http://www.newsburst.com/Source/?add=' . $feedurl . '"><img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/newsburst.gif" alt="Newsburst" /></a><br />'; }
76 if ($button === 'pluck') { $block_content .= '<a href="http://client.pluck.com/pluckit/prompt.aspx?GCID=C12286x053&a=' . $feedurl . '"><img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/pluck.png" alt="Pluck" /></a><br />'; }
77 if ($button === 'feedfeeds') { $block_content .= '<a href="http://www.feedfeeds.com/add?feed=' . $feedurl . '"><img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/addfeedfeeds.gif" alt="FeedFeeds" /></a><br />'; }
78 if ($button === 'addkinja') { $block_content .= '<a href="http://www.kinja.com/checksiteform.knj?pop=y&add=' . $feedurl . '"><img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/addkinja.gif" alt="Add Kinja" /></a><br />'; }
79 if ($button === 'solosub') { $block_content .= '<a href="http://solosub.com/sub/' . $feedurl . '"><img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/solosub.gif" alt="SoloSub" /></a><br />'; }
80 if ($button === 'multirss') { $block_content .= '<a href="http://www.multirss.com/rss/' . $feedurl . '"><img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/multirss.gif" alt="MultiRSS" /></a><br />'; }
81 if ($button === 'rmail') { $block_content .= '<a href="http://www.r-mail.org/bm.aspx?rss=' . $feedurl . '"><img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/rmail.jpg" alt="rMail" /></a><br />'; }
82 if ($button === 'rssfwd') { $block_content .= '<a href="http://www.rssfwd.com/rssfwd/preview?url=' . $feedurl . '"><img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/rssfwd.png" alt="RSSFwd" /></a><br />'; }
83 if ($button === 'blogarithm') { $block_content .= '<a href="http://www.blogarithm.com/subrequest.php?BlogURL=' . $feedurl . '"><img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/blogarithm.gif" alt="Blogarithm" /></a><br />'; }
84 if ($button === 'eskobo') { $block_content .= '<a href="http://www.eskobo.com/?AddToMyPage=' . $feedurl . '"><img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/eskobo.gif" alt="Eskobo" /></a><br />'; }
85 if ($button === 'gritwire') { $block_content .= '<a href="http://my.gritwire.com/feeds/addExternalFeed.aspx?FeedUrl=' . $feedurl . '"><img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/addToMyGritwire.gif" alt="GritWire" /></a><br />'; }
86 if ($button === 'botablog') { $block_content .= '<a href="http://www.botablog.com/botthisblog.php?blog=' . $feedurl . '"><img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/botablog.gif" alt="BotABlog" /></a><br />'; }
87 if ($button === 'monitorthis') { $block_content .= '<a href="http://immedi.at/accounts/discover?feed_url=' . $feedurl . '"><img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/monitor_this.png" alt="Monitor This" /></a><br />'; }
88 if ($button === 'simplify') { $block_content .= '<a href="http://www.simpy.com/simpy/LinkAdd.do?href=' . $feedurl . '"><img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/simpify-white-56x24.png" alt="Simplify" /></a><br />'; }
89 }
90 }
91
92 // check to see if there was any content before setting up the block
93 if ($block_content == '') {
94 // no content from a week ago, return nothing.
95 return;
96 }
97
98 // set up the block
99 $block['subject'] = variable_get('feedbuttons_block_title', 'Subscribe Buttons');
100 $block['content'] = $block_content;
101 return $block;
102 }
103 } // end onthisdate_block
104
105 /**
106 * Implementation of hook_settings().
107 */
108
109 function feedbuttons_settings() {
110
111 $form['feedbuttons_block_title'] = array(
112 '#type' => 'textfield', '#title' => t('Block Title'), '#size' => 40, '#maxlength' => 64,
113 '#default_value' => variable_get('feedbuttons_block_title', 'Subscribe Buttons'),
114 '#description' => t('The title of the feeds block')
115 );
116
117 // $form['feedbuttons_blog_title'] = array(
118 // '#type' => 'textfield', '#title' => t('Blog Title'), '#size' => 40, '#maxlength' => 255,
119 // '#default_value' => variable_get('feedbuttons_blog_title', variable_get('site_name', 'drupal')),
120 // '#description' => t('The title of your blog')
121 // );
122
123 // $form['feedbuttons_blog_url'] = array(
124 // '#type' => 'textfield', '#title' => t('Blog URL'), '#size' => 40, '#maxlength' => 255,
125 // '#default_value' => variable_get('feedbuttons_blog_url', url('blog',NULL,NULL,TRUE)),
126 // '#description' => t('The URL of your blog (not the feed URL)')
127 // );
128
129 $form['feedbuttons_feed_url'] = array(
130 '#type' => 'textfield', '#title' => t('Feed URL'), '#size' => 40, '#maxlength' => 255,
131 '#default_value' => variable_get('feedbuttons_feed_url', url('node/feed',NULL,NULL,TRUE)),
132 '#description' => t('The URL of your feed')
133 );
134
135 $form['feedbuttons_show_items'] = array(
136 '#type' => 'checkboxes',
137 '#title' => t('Show the following buttons in my block'),
138 '#default_value' => variable_get('feedbuttons_show_items', array('status', 'promote')),
139 '#options' => array(
140 'feediconlg' => t('<img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/feed-icon32x32.png" alt="Feed Icon" />'),
141 'feedicon' => t('<img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/feed-icon.gif" alt="Feed Icon" />'),
142 'xml' => t('<img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/xml.gif" alt="XML Icon" />'),
143 'google' => t('<img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/google-all.gif" alt="Google" />'),
144 'delicious' => t('<img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/delicious.gif" alt="Delicious" />'),
145 'yahoo' => t('<img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/yahoo.gif" alt="Yahoo!" />'),
146 'bloglines' => t('<img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/bloglines.gif" alt="Bloglines" />'),
147 'newsgator' => t('<img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/newsgator.gif" alt="Newsgator" />'),
148 'msn' => t('<img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/msn.gif" alt="MSN" />'),
149 'feedster' => t('<img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/addmyfeedster.gif" alt="Feedster" />'),
150 'aol' => t('<img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/aol.gif" alt="AOL" />'),
151 'furl' => t('<img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/furl.gif" alt="Furl" />'),
152 'rojo' => t('<img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/rojo.gif" alt="Rojo" />'),
153 'newsburst' => t('<img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/newsburst.gif" alt="Newsburst" />'),
154 'pluck' => t('<img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/pluck.png" alt="Pluck" />'),
155 'feedfeeds' => t('<img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/addfeedfeeds.gif" alt="FeedFeeds" />'),
156 'addkinja' => t('<img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/addkinja.gif" alt="Add Kinja" />'),
157 'solosub' => t('<img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/solosub.gif" alt="SoloSub" />'),
158 'multirss' => t('<img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/multirss.gif" alt="MultiRSS" />'),
159 'rmail' => t('<img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/rmail.jpg" alt="rMail" />'),
160 'rssfwd' => t('<img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/rssfwd.png" alt="RSSFwd" />'),
161 'blogarithm' => t('<img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/blogarithm.gif" alt="Blogarithm" />'),
162 'eskobo' => t('<img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/eskobo.gif" alt="Eskobo" />'),
163 'gritwire' => t('<img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/addToMyGritwire.gif" alt="GritWire" />'),
164 'botablog' => t('<img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/botablog.gif" alt="BotABlog" />'),
165 'monitorthis' => t('<img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/monitor_this.png" alt="Monitor This" />'),
166 'simplify' => t('<img src="/' . drupal_get_path('module', 'feedbuttons') . '/buttons/simpify-white-56x24.png" alt="Simplify" />'),
167 ),
168 );
169 return $form;
170 }
171
172 function feedbuttons_menu($may_cache) {
173 $items = array();
174 if (!$may_cache) {
175 $items[] = array('path' => 'admin/settings/feedbuttons', 'title' => t('feedbuttons settings'),
176 'access' => user_access('administer feedbuttons'));
177 }
178 return $items;
179 }
180 ?>

  ViewVC Help
Powered by ViewVC 1.1.2