? follow-D7-619276-6.patch
? follow-D7-619276-7.patch
Index: follow.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/follow/follow.install,v
retrieving revision 1.2
diff -u -p -r1.2 follow.install
--- follow.install	30 Oct 2009 21:09:28 -0000	1.2
+++ follow.install	2 Nov 2009 17:15:55 -0000
@@ -18,20 +18,20 @@ function follow_install() {
  */
 function follow_schema() {
   $schema['follow_links'] = array(
-    'description' => t('Stores sitewide and user follow links.'),
+    'description' => 'Stores sitewide and user follow links.',
     'fields' => array(
       'lid' => array(
         'type' => 'serial',
         'unsigned' => TRUE,
         'not null' => TRUE,
-        'description' => t('Unique identifier for the {follow_links}.'),
+        'description' => 'Unique identifier for the {follow_links}.',
       ),
       'name' => array(
         'type' => 'varchar',
         'length' => 255,
         'not null' => TRUE,
         'default' => '',
-        'description' => t("The machine name of the {follow_links}."),
+        'description' => "The machine name of the {follow_links}.",
       ),
       'uid' => array(
         'type' => 'int',
@@ -51,7 +51,7 @@ function follow_schema() {
         'not null' => TRUE,
         'default' => 0,
         'size' => 'tiny',
-        'description' => t('The weight of this {follow_links}.'),
+        'description' => 'The weight of this {follow_links}.',
       ),
     ),
     'primary key' => array('lid'),
Index: follow.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/follow/follow.module,v
retrieving revision 1.5
diff -u -p -r1.5 follow.module
--- follow.module	30 Oct 2009 22:00:08 -0000	1.5
+++ follow.module	2 Nov 2009 17:15:55 -0000
@@ -259,7 +259,7 @@ function _follow_block_content($uid = 0)
   $output = '';
 
   if ($links = follow_links_load($uid)) {
-    $output = theme('follow_links', $links, follow_networks_load());
+    $output = theme('follow_links', array('links' => $links, 'networks' => follow_networks_load($uid)));
     $output .= _follow_block_config_links($uid);
   }
 
@@ -276,7 +276,7 @@ function _follow_block_content($uid = 0)
  *
  * @ingroup themeable
  */
-function theme_follow_links($variables) {
+function theme_follow_links($variables) {drupal_set_message(print_r($variables,1));
   $links = $variables['links'];
   $networks = $variables['networks'];
   $output = '<div class="follow-links clear-block">';
@@ -365,12 +365,12 @@ function _follow_block_config_links($uid
  */
  function follow_links_form($form, &$form_state, $uid = 0) {
   $form = array();
-
+  $form['#theme'] = 'follow_links_form';
   $form['uid'] = array('#type' => 'hidden', '#value' => $uid);
   $form['follow_links']['#tree'] = TRUE;
 
   $links = follow_links_load($uid);
-  $networks = follow_networks_load(TRUE);
+  $networks = follow_networks_load($uid, TRUE);
 
   // Put all our existing links at the top, sorted by weight.
   if (is_array($links)) {
@@ -399,8 +399,7 @@ function _follow_links_form_link($link, 
   $elements = array();
 
   $elements['name'] = array(
-    '#type' => 'markup',
-    '#value' => $title,
+    '#markup' => $title,
   );
   if (isset($link->lid)) {
     $elements['lid'] = array(
@@ -426,7 +425,7 @@ function _follow_links_form_link($link, 
  */
 function follow_url_validate($form) {
   $url = trim($form['#value']);
-  if($url && !preg_match("/^[a-zA-Z]+[:\/\/]+[A-Za-z0-9\-_]+\\.+[A-Za-z0-9\.\/%&=\?\-_]+$/i", $url)) {
+  if($url && !preg_match('@^[a-zA-Z]+://[A-Za-z0-9\-_]+\\.+[A-Za-z0-9\\./%&=\?\-_]+$@i', $url)) {
     form_error($form, t('The specified url is invalid.'));
   }
 }
@@ -575,7 +574,6 @@ function follow_link_delete($lid) {
     ->execute();
 }
 
-
 /**
  * Loads all follow networks
  *
@@ -585,29 +583,22 @@ function follow_link_delete($lid) {
  * @return
  *   An array of network names, keys are machine names, values are visible titles.
  */
-function follow_networks_load($reset = FALSE) {
+function follow_networks_load($uid, $reset = FALSE) {
   static $networks = array();
 
   // Clear cache if $reset is TRUE;
   if ($reset) {
     $networks = array();
-    cache_clear_all('follow:networks', 'cache');
   }
   // Return presets if the array is populated.
-  if (!empty($networks)) {
-    return $networks;
+  if (empty($networks[$uid])) {
+    // We don't have an API to create new networks yet, so for now, we only
+    // call hook_follow_networks_alter().
+    $networks[$uid] = follow_default_networks($uid);
+    drupal_alter('follow_networks', $networks, $uid);
   }
 
-  // Grab from cache or build the array of networks.
-  if (($cache = cache_get('follow:networks', 'cache')) && is_array($cache->data)) {
-    $networks = $cache->data;
-  }
-  else {
-    // We don't have an API to create new networks yet, so for now, we only call hook_follow_networks().
-    $networks = module_invoke_all('follow_networks');
-    cache_set('follow:networks', $networks);
-  }
-  return $networks;
+  return $networks[$uid];
 }
 
 /**
@@ -616,8 +607,8 @@ function follow_networks_load($reset = F
  * @return
  *   An array of network names, keys are machine names, values are visible titles.
  */
-function follow_follow_networks() {
-  return array(
+function follow_default_networks($uid) {
+  $networks = array(
     'facebook'  => t('Facebook'),
     'virb'      => t('Virb'),
     'myspace'   => t('MySpace'),
@@ -632,4 +623,8 @@ function follow_follow_networks() {
     'delicious' => t('Delicious'),
     'tumblr'    => t('Tumblr'),
   );
+  if ($uid == 0) {
+    $networks['self'] = t('This site (RSS)');
+  }
+  return $networks;
 }
