### Eclipse Workspace Patch 1.0 #P sanduhrs Index: feed_node/feed_node.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/sandbox/sanduhrs/feed_node/feed_node.module,v retrieving revision 1.1 diff -u -r1.1 feed_node.module --- feed_node/feed_node.module 9 Apr 2007 09:40:50 -0000 1.1 +++ feed_node/feed_node.module 9 Apr 2007 09:54:37 -0000 @@ -26,11 +26,11 @@ function feed_node_help($section) { switch ($section) { case 'admin/modules#description': - $output = t('The feed node module enables a node to have an aggregator feed associated with it.'); - break; - case "admin/settings/feed_node": - $output = '
' . t('The feed node module allows you to associate an aggregator feed with a particular node so that aggregator feed items can be displayed within the node body.') . '
'; - break; + $output = t('The feed node module enables a node to have an aggregator feed associated with it.'); + break; + case "admin/settings/feed_node": + $output = ''. t('The feed node module allows you to associate an aggregator feed with a particular node so that aggregator feed items can be displayed within the node body.') .'
'; + break; } return $output; @@ -40,8 +40,8 @@ * Implementation of hook_menu(). */ function feed_node_menu($may_cache) { - $items = array(); - + $items = array(); + if ($may_cache) { $items[] = array( 'path' => 'admin/settings/feed_node', @@ -53,7 +53,7 @@ ); } - return $items; + return $items; } /** @@ -69,41 +69,41 @@ */ function feed_node_settings() { - $form = array(); - $form['feed_node_allowed_html_tags'] = array( - '#type' => 'textfield', - '#title' => t('Allowed HTML tags'), - '#size' => 80, - '#maxlength' => 255, - '#default_value' => variable_get("feed_node_allowed_html_tags", ' -
-
- '),
- '#description' => t('The list of tags which are allowed in feed items, i.e., which will not be stripped out.')
- );
-
- $form['feed_node_teaser_length'] = array(
- '#type' => 'textfield',
- '#title' => t('Teaser length'),
- '#size' => 10,
- '#maxlength' => 5,
- '#default_value' => variable_get('feed_node_teaser_length', 200),
- '#description' => t('The maximum length for feed items. Feed items longer than this will be truncated.')
- );
-
- $form['feed_node_delete_flag'] = array(
- '#type' => 'checkbox',
- '#title' => t('Delete aggregator feed on node delete'),
- '#default_value' => variable_get('feed_node_delete_flag', 1),
- '#description' => t('Each feed enabled node is associated with a corresponding aggregator feed. If this is checked, then when the node is deleted, the corresponding aggregator feed is also deleted.')
- );
-
- // we could just to a standard 4.7 forms API returning of the $form variable,
- // but the only way to get a admin/settings menu title that says "feed node" instead
- // of "feed_node" is to specify a custom menu callback hook to this settings method, where
- // we now have to do some more traditional form stuff... like create a corresponding
- // submit method
- $form['submit'] = array('#type' => 'submit', '#value' => t('Save configuration'));
- $form['clear'] = array('#type' => 'submit', '#value' => t('Reset to defaults'));
-
- return system_settings_form($form);
+ $form = array();
+ $form['feed_node_allowed_html_tags'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Allowed HTML tags'),
+ '#size' => 80,
+ '#maxlength' => 255,
+ '#default_value' => variable_get("feed_node_allowed_html_tags", '
-
-
- '),
+ '#description' => t('The list of tags which are allowed in feed items, i.e., which will not be stripped out.'),
+ );
+
+ $form['feed_node_teaser_length'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Teaser length'),
+ '#size' => 10,
+ '#maxlength' => 5,
+ '#default_value' => variable_get('feed_node_teaser_length', 200),
+ '#description' => t('The maximum length for feed items. Feed items longer than this will be truncated.'),
+ );
+
+ $form['feed_node_delete_flag'] = array(
+ '#type' => 'checkbox',
+ '#title' => t('Delete aggregator feed on node delete'),
+ '#default_value' => variable_get('feed_node_delete_flag', 1),
+ '#description' => t('Each feed enabled node is associated with a corresponding aggregator feed. If this is checked, then when the node is deleted, the corresponding aggregator feed is also deleted.'),
+ );
+
+ // we could just to a standard 4.7 forms API returning of the $form variable,
+ // but the only way to get a admin/settings menu title that says "feed node" instead
+ // of "feed_node" is to specify a custom menu callback hook to this settings method, where
+ // we now have to do some more traditional form stuff... like create a corresponding
+ // submit method
+ $form['submit'] = array('#type' => 'submit', '#value' => t('Save configuration'));
+ $form['clear'] = array('#type' => 'submit', '#value' => t('Reset to defaults'));
+
+ return system_settings_form($form);
}
@@ -117,18 +117,15 @@
// if only one of feedtitle or feedurl exist, error
// if both exist, then numitems must exist
- if (trim($form->feed_node['aggregator_feed']['title'])
- && !trim($form->feed_node['aggregator_feed']['url'])) {
- form_set_error('feed_node][aggregator_feed][url', t('If you specify a feed title, you must also specify a feed URL.'));
- }
- if (!trim($form->feed_node['aggregator_feed']['title'])
- && trim($form->feed_node['aggregator_feed']['url'])) {
- form_set_error('feed_node][aggregator_feed][title', t('If you specify a feed URL, you must also specify a feed title.'));
+ if (trim($form->feed_node['aggregator_feed']['title']) && !trim($form->feed_node['aggregator_feed']['url'])) {
+ form_set_error('feed_node][aggregator_feed][url', t('If you specify a feed title, you must also specify a feed URL.'));
+ }
+ if (!trim($form->feed_node['aggregator_feed']['title']) && trim($form->feed_node['aggregator_feed']['url'])) {
+ form_set_error('feed_node][aggregator_feed][title', t('If you specify a feed URL, you must also specify a feed title.'));
}
- if (trim($form->feed_node['aggregator_feed']['title'])
- && trim($form->feed_node['aggregator_feed']['url']) && !trim($form->feed_node['numItems'])) {
- form_set_error('feed_node][numItems', t('If you specify a feed, you must also specify how many feed items to list.'));
+ if (trim($form->feed_node['aggregator_feed']['title']) && trim($form->feed_node['aggregator_feed']['url']) && !trim($form->feed_node['numItems'])) {
+ form_set_error('feed_node][numItems', t('If you specify a feed, you must also specify how many feed items to list.'));
}
// check to see that we don't have a conflict with an existing feed
@@ -149,10 +146,10 @@
* @param $op
*/
function feed_node_nodeapi(&$node, $op) {
-
+
switch ($op) {
case 'validate':
- _feed_node_validate($node);
+ _feed_node_validate($node);
break;
// load the extended node attributes
@@ -160,50 +157,50 @@
// fetch the feed node
$feed_node = db_fetch_array(db_query('SELECT * FROM {feed_node} WHERE nid = %d', $node->nid));
-
- // if no feed attached to the node, nothing to do...
- if ($feed_node) {
- // fetch the aggregator feed
- $aggregator_feed = aggregation_get_feed_by_id($feed_node['fid']);
-
- // fetch the aggregator items for the feed
- $result = db_query('SELECT * FROM {aggregator_item} WHERE fid = %d ORDER BY timestamp DESC, iid DESC LIMIT %d', $feed_node['fid'], $feed_node['numItems']);
- while ($data = db_fetch_array($result)) {
- $aggregator_items[] = $data;
- }
-
- // tack on the feed and feed items
- $feed_node['aggregator_feed'] = $aggregator_feed;
- $feed_node['aggregator_items'] = $aggregator_items;
-
- // return the additional node attributes
- return array('feed_node' => $feed_node);
- }
+
+ // if no feed attached to the node, nothing to do...
+ if ($feed_node) {
+ // fetch the aggregator feed
+ $aggregator_feed = aggregation_get_feed_by_id($feed_node['fid']);
+
+ // fetch the aggregator items for the feed
+ $result = db_query('SELECT * FROM {aggregator_item} WHERE fid = %d ORDER BY timestamp DESC, iid DESC LIMIT %d', $feed_node['fid'], $feed_node['numItems']);
+ while ($data = db_fetch_array($result)) {
+ $aggregator_items[] = $data;
+ }
+
+ // tack on the feed and feed items
+ $feed_node['aggregator_feed'] = $aggregator_feed;
+ $feed_node['aggregator_items'] = $aggregator_items;
+
+ // return the additional node attributes
+ return array('feed_node' => $feed_node);
+ }
break;
// insert the extended feed node attributes, only if we a feed title or feed url
case 'insert':
case 'update':
if ($op == "update") {
- // do a fresh insert
- db_query('DELETE FROM {feed_node} WHERE nid = %d', $node->nid);
- }
-
- // if we have a feed, ensure it is synced with the aggregator feed. Syncing ensures that
- // the feed exists in the aggregator table. If it doesn't, a new entry is created. If the
- // title or URL matches an existing entry, then the call to aggregation_sync_feed() ensures that
- // the aggregator feed item is updated so that the title and URL specified are updated for that
- // feed.
- if (trim($node->feed_node['aggregator_feed']['title']) && trim($node->feed_node['aggregator_feed']['url'])) {
- $fid = aggregation_sync_feed($node->feed_node['aggregator_feed']['title'], $node->feed_node['aggregator_feed']['url']);
- if ($fid != -1) {
- db_query('INSERT INTO {feed_node} (nid, fid, numItems, displayStyle) VALUES (%d, %d, %d, %d)', $node->nid, $fid, $node->feed_node['numItems'], $node->feed_node['displayStyle']);
- }
- else {
-
- }
- }
-
+ // do a fresh insert
+ db_query('DELETE FROM {feed_node} WHERE nid = %d', $node->nid);
+ }
+
+ // if we have a feed, ensure it is synced with the aggregator feed. Syncing ensures that
+ // the feed exists in the aggregator table. If it doesn't, a new entry is created. If the
+ // title or URL matches an existing entry, then the call to aggregation_sync_feed() ensures that
+ // the aggregator feed item is updated so that the title and URL specified are updated for that
+ // feed.
+ if (trim($node->feed_node['aggregator_feed']['title']) && trim($node->feed_node['aggregator_feed']['url'])) {
+ $fid = aggregation_sync_feed($node->feed_node['aggregator_feed']['title'], $node->feed_node['aggregator_feed']['url']);
+ if ($fid != -1) {
+ db_query('INSERT INTO {feed_node} (nid, fid, numItems, displayStyle) VALUES (%d, %d, %d, %d)', $node->nid, $fid, $node->feed_node['numItems'], $node->feed_node['displayStyle']);
+ }
+ else {
+
+ }
+ }
+
break;
// delete the extended feed node attributes
@@ -213,7 +210,7 @@
// if this node has an associated feed and the delete flag is set,
// delete the feed and feed items
if (aggregation_get_feed_by_id($node->feed_node['fid']) && variable_get('feed_node_delete_flag', 1)) {
- aggregation_delete_feed($node->feed_node['fid']);
+ aggregation_delete_feed($node->feed_node['fid']);
}
break;
@@ -261,61 +258,61 @@
case $type .'_node_form':
- // If the feed is enabled for this node type, we insert our control
+ // If the feed is enabled for this node type, we insert our control
// into the form.
if ($enabled) {
-
- // if we have a feed, body isn't mandatory, we override the
- // default of a mandatory body.
- $form['body_filter']['body']['#required'] = 0;
-
- $form['feed_node'] = array(
- '#type' => 'fieldset',
- '#title' => t('Feed information'),
- '#collapsible' => TRUE,
- '#collapsed' => TRUE,
- '#tree' => TRUE,
- '#weight' => 1
- );
-
- // fetch feed data to populate title and url form elements
- $feed = aggregation_get_feed_by_id($form['#node']->feed_node['fid']);
-
- $form['feed_node']['aggregator_feed']['title'] = array(
- '#type' => 'textfield',
- '#title' => t('Title of feed'),
- '#default_value' => $feed['title'],
- '#required' => FALSE,
- '#maxlength' => 255,
- '#tree' => TRUE,
- '#weight' => 0,
- );
-
- $form['feed_node']['aggregator_feed']['url'] = array(
- '#type' => 'textfield',
- '#title' => t('Feed URL'),
- '#default_value' => $feed['url'],
- '#required' => FALSE,
- '#maxlength' => 255,
- '#weight' => 0,
- );
-
- $numItems = $form['#node']->feed_node['numItems'];
- $form['feed_node']['numItems'] = array(
- '#type' => 'textfield',
- '#title' => t('Number of feed items to display'),
- '#default_value' => $numItems ? $numItems : 10 ,
- '#required' => FALSE,
- '#maxlength' => 10,
- '#weight' => 1,
- );
-
- $form['feed_node']['displayStyle'] = array(
- '#type' => 'radios',
- '#title' => t('Display style'),
- '#default_value' => $form['#node']->feed_node['displayStyle'],
- '#options' => array(t('Title + Teaser'), t('Title only')),
- );
+
+ // if we have a feed, body isn't mandatory, we override the
+ // default of a mandatory body.
+ $form['body_filter']['body']['#required'] = 0;
+
+ $form['feed_node'] = array(
+ '#type' => 'fieldset',
+ '#title' => t('Feed information'),
+ '#collapsible' => TRUE,
+ '#collapsed' => TRUE,
+ '#tree' => TRUE,
+ '#weight' => 1,
+ );
+
+ // fetch feed data to populate title and url form elements
+ $feed = aggregation_get_feed_by_id($form['#node']->feed_node['fid']);
+
+ $form['feed_node']['aggregator_feed']['title'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Title of feed'),
+ '#default_value' => $feed['title'],
+ '#required' => FALSE,
+ '#maxlength' => 255,
+ '#tree' => TRUE,
+ '#weight' => 0,
+ );
+
+ $form['feed_node']['aggregator_feed']['url'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Feed URL'),
+ '#default_value' => $feed['url'],
+ '#required' => FALSE,
+ '#maxlength' => 255,
+ '#weight' => 0,
+ );
+
+ $numItems = $form['#node']->feed_node['numItems'];
+ $form['feed_node']['numItems'] = array(
+ '#type' => 'textfield',
+ '#title' => t('Number of feed items to display'),
+ '#default_value' => $numItems ? $numItems : 10,
+ '#required' => FALSE,
+ '#maxlength' => 10,
+ '#weight' => 1,
+ );
+
+ $form['feed_node']['displayStyle'] = array(
+ '#type' => 'radios',
+ '#title' => t('Display style'),
+ '#default_value' => $form['#node']->feed_node['displayStyle'],
+ '#options' => array(t('Title + Teaser'), t('Title only')),
+ );
} // endif
break;
@@ -343,14 +340,14 @@
function _feed_node_fetch_unique_feed_items($result) {
$item_tracker = array();
- if (db_num_rows($result)) {
- while ($item = db_fetch_array($result)) {
- if ($item_tracker[$item['timestamp']] != md5($item['description'])) {
- $item_tracker[$item['timestamp']] = md5($item['description']);
- $items[] = $item;
- }
- }
- }
+ if (db_num_rows($result)) {
+ while ($item = db_fetch_array($result)) {
+ if ($item_tracker[$item['timestamp']] != md5($item['description'])) {
+ $item_tracker[$item['timestamp']] = md5($item['description']);
+ $items[] = $item;
+ }
+ }
+ }
return $items;
}
@@ -369,9 +366,9 @@
$output .= '
'. t($feed['title']) .'
';
if ($feed['link']) {
- $output .= ''. t('URL:') .' '. l($feed['link'], $feed['link'], array(), NULL, NULL, TRUE) ."\n";
+ $output .= ''. t('URL:') .' '. l($feed['link'], $feed['link'], array(), NULL, NULL, TRUE) ."\n";
}
-
+
if ($feed['checked']) {
$updated = t('!time ago', array('!time' => format_interval(time() - $feed['checked'])));
}
@@ -383,19 +380,17 @@
$updated = l($updated, 'admin/content/aggregator');
}
- $output .= ''. t('Updated:') . " $updated";
+ $output .= ''. t('Updated:') ." $updated";
// output individual feed items
$aggregator_items = $feed_node['aggregator_items'];
if ($aggregator_items) {
- foreach ($aggregator_items as $aggregator_item) {
- $item_outputs[] = $feed_node['displayStyle']
- ? theme('feed_node_item_summary', $aggregator_item)
- : theme('feed_node_item', $aggregator_item);
- }
+ foreach ($aggregator_items as $aggregator_item) {
+ $item_outputs[] = $feed_node['displayStyle'] ? theme('feed_node_item_summary', $aggregator_item) : theme('feed_node_item', $aggregator_item);
+ }
}
else {
- $item_outputs[] = t("No feed items available.");
+ $item_outputs[] = t("No feed items available.");
}
// if title only, theme as a list, else concatenate item outputs.
@@ -403,23 +398,19 @@
$output .= '';
- return $output;
+ return $output;
}
/**
* Returns a themed summary display for an individual aggregator feed item.
*
* @param $item
- * The item array from the aggregator module.
+ * The item array from the aggregator module.
* @return
- * A string containing the HTML fragment.
+ * A string containing the HTML fragment.
*/
function theme_feed_node_item_summary($item) {
- $output = '' .
- check_plain($item['title']) .
- ' '.
- t('%age old', array('%age' => format_interval(time() - $item['timestamp']))) .'';
+ $output = ''. check_plain($item['title']) .' '. t('%age old', array('%age' => format_interval(time() - $item['timestamp']))) .'';
return $output ."\n";
}
@@ -428,9 +419,9 @@
* Returns a themed detail display for an individual aggregator feed item.
*
* @param $item
- * The item array from the aggregator module.
+ * The item array from the aggregator module.
* @return
- * A string containing the HTML fragment.
+ * A string containing the HTML fragment.
*/
function theme_feed_node_item($item) {
@@ -471,29 +462,29 @@
* to the specified length.
*
* @param $html
- * The HTML fragment to summarize
+ * The HTML fragment to summarize
* @param $length
- * The maximum length the truncated fragment should be.
+ * The maximum length the truncated fragment should be.
* @return
- * The truncated HTMl fragment.
+ * The truncated HTMl fragment.
*/
function _feed_node_truncate($html, $length = 200) {
- // similar to feedburner summarize feature, strips out links, then truncates to approximate
- // length.
- $html = filter_xss($html, preg_split('/\s+|<|>/', variable_get("feed_node_allowed_html_tags", ' -
-
- '), -1, PREG_SPLIT_NO_EMPTY));
-
- // zip in $length chars, then skip to the next word boundary
- if (preg_match("/(.{" . $length . "})(.*?)\W/", $html, $m)) {
- $html = $m[1] . $m[2] . "...";
- }
-
- // if still over the length due to extremely long word, chop it
- if (strlen($html) > $length) {
- $html = substr($html, 0, $length) . "...";
- }
-
- return $html;
+ // similar to feedburner summarize feature, strips out links, then truncates to approximate
+ // length.
+ $html = filter_xss($html, preg_split('/\s+|<|>/', variable_get("feed_node_allowed_html_tags", '
-
-
- '), -1, PREG_SPLIT_NO_EMPTY));
+
+ // zip in $length chars, then skip to the next word boundary
+ if (preg_match("/(.{". $length ."})(.*?)\W/", $html, $m)) {
+ $html = $m[1] . $m[2] ."...";
+ }
+
+ // if still over the length due to extremely long word, chop it
+ if (strlen($html) > $length) {
+ $html = substr($html, 0, $length) ."...";
+ }
+
+ return $html;
}
Index: feed_node/feed_node.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/sandbox/sanduhrs/feed_node/feed_node.install,v
retrieving revision 1.1
diff -u -r1.1 feed_node.install
--- feed_node/feed_node.install 9 Apr 2007 09:40:50 -0000 1.1
+++ feed_node/feed_node.install 9 Apr 2007 09:54:37 -0000
@@ -9,20 +9,20 @@
case 'mysql':
case 'mysqli':
db_query("CREATE TABLE feed_node (
- nid int(10) unsigned NOT NULL default '0',
- fid int(10) NOT NULL default '0',
- numItems int(10) NOT NULL default '0',
- displayStyle tinyint(1) NOT NULL default '0',
- PRIMARY KEY (nid,fid)
- ) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;");
+ nid int(10) unsigned NOT NULL default '0',
+ fid int(10) NOT NULL default '0',
+ numItems int(10) NOT NULL default '0',
+ displayStyle tinyint(1) NOT NULL default '0',
+ PRIMARY KEY (nid,fid)
+ ) TYPE=MyISAM /*!40100 DEFAULT CHARACTER SET utf8 */;");
break;
}
if (!db_error()) {
- drupal_set_message("The feed node module has been installed successfully.");
+ drupal_set_message("The feed node module has been installed successfully.");
}
else {
- drupal_set_message(t("A database error occured installing the feed node DB schema. Feed node may not work."), "error");
+ drupal_set_message(t("A database error occured installing the feed node DB schema. Feed node may not work."), "error");
}
}
Index: feed_node/aggregation_api.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/sandbox/sanduhrs/feed_node/aggregation_api.inc,v
retrieving revision 1.1
diff -u -r1.1 aggregation_api.inc
--- feed_node/aggregation_api.inc 9 Apr 2007 09:40:50 -0000 1.1
+++ feed_node/aggregation_api.inc 9 Apr 2007 09:54:37 -0000
@@ -39,7 +39,7 @@
* @param $title
* @param $url
* @return
- * Returns the id for the corresponding aggregator feed in the database or
+ * Returns the id for the corresponding aggregator feed in the database or
* -1 if a conflict exists with an existing feed in the database.
*/
function aggregation_sync_feed($title, $url) {
@@ -50,9 +50,9 @@
// if there is no feed with the given url or title, we have an insert
if (!$urlfeed && !$titlefeed) {
- $newfeed['url']=$url;
- $newfeed['title']=$title;
- return _aggregation_insert_feed($newfeed);
+ $newfeed['url'] = $url;
+ $newfeed['title'] = $title;
+ return _aggregation_insert_feed($newfeed);
}
// if a feed exists with the URL, but none with the given title,
// we update the title
@@ -67,14 +67,14 @@
return _aggregation_update_feed($titlefeed);
}
- // if feeds exists with the given url and title and they are the same,
- // then there is nothing to update
- if ($urlfeed['fid'] == $titlefeed['fid']) {
- return $urlfeed['fid'];
- }
+ // if feeds exists with the given url and title and they are the same,
+ // then there is nothing to update
+ if ($urlfeed['fid'] == $titlefeed['fid']) {
+ return $urlfeed['fid'];
+ }
- // else a feed exists with the given URL, and a different feed exists with
- // the given title, so we have a conflict the user must resolve
+ // else a feed exists with the given URL, and a different feed exists with
+ // the given title, so we have a conflict the user must resolve
return -1;
}
@@ -107,7 +107,7 @@
*
* @param $fid
*/
-function aggregation_remove_feed_items($fid){
+function aggregation_remove_feed_items($fid) {
aggregator_remove($fid);
}
@@ -141,7 +141,7 @@
*
* @param $title
* @return
- * A array of aggregator feed information.
+ * A array of aggregator feed information.
*/
function aggregation_get_feed_by_title($title) {
if (!$title) return FALSE;
@@ -159,7 +159,7 @@
* @param $fid Feed Id
* @param $categories An array of categories to assign
*/
- function aggregation_set_feed_categories($fid,$categories){
+ function aggregation_set_feed_categories($fid, $categories) {
aggregation_clear_feed_categories($fid);
if (is_array($categories)) {
foreach ($categories as $cid) {
@@ -173,7 +173,7 @@
*
* @param $fid Feed Id
*/
- function aggregation_clear_feed_categories($fid){
+ function aggregation_clear_feed_categories($fid) {
db_query('DELETE FROM {aggregator_category_feed} WHERE fid=%d', $fid);
}
@@ -185,10 +185,10 @@
* @return
* An array of category IDs
*/
- function aggregation_get_assigned_feed_categories($fid){
+ function aggregation_get_assigned_feed_categories($fid) {
$result=db_query('SELECT cid FROM {aggregator_category_feed} WHERE fid = %d', $fid);
- while($category=db_fetch_array($result)) {
- $values[]=$category[cid];
+ while ($category = db_fetch_array($result)) {
+ $values[] = $category[cid];
}
return $values;
}
@@ -199,16 +199,16 @@
*
* @return A list of options, Id as key, title as value
*/
- function aggregation_get_all_feed_categories(){
+ function aggregation_get_all_feed_categories() {
static $options;
if (!$options) {
// get aggregator categories
$result = db_query('SELECT title, cid FROM {aggregator_category} ORDER BY title');
while ($category = db_fetch_array($result)) {
- $options[$category['cid']]=$category['title'];
+ $options[$category['cid']] = $category['title'];
}
}
- return $options;
+ return $options;
}
@@ -227,16 +227,11 @@
* @return
* A feed id for the inserted feed
*/
- function _aggregation_insert_feed($feed){
+ function _aggregation_insert_feed($feed) {
$fid = db_next_id('{aggregator_feed}_fid');
- $feed['refresh'] or $feed['refresh']=3600;
- $feed['block_id'] or $feed['block_id']=5;
- db_query("INSERT INTO {aggregator_feed} (fid, title, url, refresh, block) VALUES (%d, '%s', '%s', %d, %d)",
- $fid,
- $feed['title'],
- $feed['url'],
- $feed['refresh'],
- $feed['block_id']);
+ $feed['refresh'] or $feed['refresh'] = 3600;
+ $feed['block_id'] or $feed['block_id'] = 5;
+ db_query("INSERT INTO {aggregator_feed} (fid, title, url, refresh, block) VALUES (%d, '%s', '%s', %d, %d)", $fid, $feed['title'], $feed['url'], $feed['refresh'], $feed['block_id']);
if (!db_error()) {
drupal_set_message(t('A new aggregator feed "%title" was created', array('%title' => $feed['title'])));
@@ -254,13 +249,8 @@
* @return
* A feed id for the updated feed
*/
- function _aggregation_update_feed($feed){
- $feed['refresh'] or $feed['refresh']=3600;
- db_query("UPDATE {aggregator_feed} SET title = '%s', url = '%s', refresh = %d WHERE fid = %d",
- $feed['title'],
- $feed['url'],
- $feed['refresh'],
- $feed['fid']);
+ function _aggregation_update_feed($feed) {
+ $feed['refresh'] or $feed['refresh'] = 3600;
+ db_query("UPDATE {aggregator_feed} SET title = '%s', url = '%s', refresh = %d WHERE fid = %d", $feed['title'], $feed['url'], $feed['refresh'], $feed['fid']);
return $feed['fid'];
}
-?>
\ No newline at end of file