--- youtube_api.module	2008-07-23 01:04:01.000000000 -0400
+++ youtube_apiNew.module	2010-03-10 15:12:44.000000000 -0500
@@ -1,6 +1,67 @@
 <?php
 // $Id: youtube_api.module,v 1.13 2008/07/23 05:04:01 beeradb Exp $
 
+/* TODO FormAPI image buttons are now supported.
+   FormAPI now offers the 'image_button' element type, allowing developers to
+   use icons or other custom images in place of traditional HTML submit buttons.
+
+$form['my_image_button'] = array(
+  '#type'         => 'image_button',
+  '#title'        => t('My button'),
+  '#return_value' => 'my_data',
+  '#src'          => 'my/image/path.jpg',
+); */
+
+/* TODO New user_mail_tokens() method may be useful.
+   user.module now provides a user_mail_tokens() function to return an array
+   of the tokens available for the email notification messages it sends when
+   accounts are created, activated, blocked, etc. Contributed modules that
+   wish to make use of the same tokens for their own needs are encouraged
+   to use this function. */
+
+/* TODO
+   There is a new hook_watchdog in core. This means that contributed modules
+   can implement hook_watchdog to log Drupal events to custom destinations.
+   Two core modules are included, dblog.module (formerly known as watchdog.module),
+   and syslog.module. Other modules in contrib include an emaillog.module,
+   included in the logging_alerts module. See syslog or emaillog for an
+   example on how to implement hook_watchdog.
+function example_watchdog($log = array()) {
+  if ($log['severity'] == WATCHDOG_ALERT) {
+    mysms_send($log['user']->uid,
+      $log['type'],
+      $log['message'],
+      $log['variables'],
+      $log['severity'],
+      $log['referer'],
+      $log['ip'],
+      format_date($log['timestamp']));
+  }
+} */
+
+/* TODO Implement the hook_theme registry. Combine all theme registry entries
+   into one hook_theme function in each corresponding module file.
+function youtube_api_theme() {
+  return array(
+    'youtube_api_comment' => array(
+      'file' => 'youtube_api.module',
+      'arguments' => array(
+        'comment' => NULL,
+      ),
+    ),
+    'youtube_api_embed' => array(
+      'file' => 'youtube_api.module',
+      'arguments' => array(
+        'meta' => NULL,
+        'video' => NULL,
+        'width' => 350,
+        'height' => 250,
+        'print_comments' => FALSE,
+      ),
+    ),
+  );
+} */
+
 /**
  * @file
  * Provides integration to the YouTube Public API.
@@ -9,18 +70,17 @@
 /**
  *  Implement hook_menu.
  */
-function youtube_api_menu($may_cache) {
-  if ($may_cache) {
-    $items[] = array(
-      'path' => 'admin/settings/youtube_api',
-      'title' => t('YouTube API Settings'),
-      'description' => t('Edit YouTube API Settings'),
-      'callback' => 'drupal_get_form',
-      'callback arguments' => array('youtube_api_admin_form'),
-      'access' => user_access('administer youtube api'),
+function youtube_api_menu() {
+  
+    $items['admin/settings/youtube_api'] = array(
+      'title' => 'YouTube API Settings',
+      'description' => 'Edit YouTube API Settings',
+      'page callback' => 'drupal_get_form',
+      'page arguments' => array('youtube_api_admin_form'),
+      'access arguments' => array('administer youtube api'),
       'type' => MENU_NORMAL_ITEM,
     );
-  }
+  
   return $items;
 }
 
@@ -120,7 +180,7 @@ function youtube_api_admin_form() {
 function youtube_api_login($login, $password) {
   $response = drupal_http_request(variable_get('youtube_api_login_location', 'https://www.google.com/youtube/accounts/ClientLogin') .'?Email='. urlencode($login) .'&Passwd='. urlencode($password) .'&source='. urlencode($_SERVER['HTTP_HOST']) .'&service=youtube', array('Content-Type' => 'application/x-www-form-urlencoded'), 'POST');
   if ($response->code == 200) {
-    watchdog('youtube_api', t("User %email logged into youtube successfully", array('%email' => $email)), WATCHDOG_NOTICE);
+    watchdog('youtube_api', "User %email logged into youtube successfully", array('%email' => $email), WATCHDOG_NOTICE);
     $parts = split("\n", $response->data);
     $auth_parts = split('=', $parts[0]);
     $user_parts = split('=', $parts[1]);
@@ -129,7 +189,7 @@ function youtube_api_login($login, $pass
     return TRUE;
   }
 
-  watchdog('youtube_api', t("User %email login to youtube failed with %error.", array('%email' => $email, '%error' => $response->code .' '. $response->error)), WATCHDOG_NOTICE);
+  watchdog('youtube_api', "User %email login to youtube failed with %error.", array('%email' => $email, '%error' => $response->code .' '. $response->error), WATCHDOG_NOTICE);
   return FALSE;
 }
 
@@ -158,8 +218,8 @@ function youtube_api_logout() {
  */
 function youtube_api_video_upload($xml, $filepath, $filename) {
   if (!file_exists($filepath)) {
-    watchdog('video_upload', t("File: %filepath doesn't exist.", array('%filepath' => $filepath)), WATCHDOG_NOTICE);
-    watchdog('youtube_api', t("Video upload of %filename failed, as file: %filepath doesn't exist.", array('%filepath' => $filepath)), WATCHDOG_NOTICE);
+    watchdog('video_upload', "File: %filepath doesn't exist.", array('%filepath' => $filepath), WATCHDOG_NOTICE);
+    watchdog('youtube_api', "Video upload of %filename failed, as file: %filepath doesn't exist.", array('%filepath' => $filepath), WATCHDOG_NOTICE);
     return FALSE;
   }
 
@@ -170,7 +230,7 @@ function youtube_api_video_upload($xml, 
   $data .= '--'. $boundary ."\r\n";
   $data .= "Content-Type: video/mp4"."\r\n";
   $data .= "Content-Transfer-Encoding: binary"."\r\n\r\n";
-  watchdog('video_upload', t("Opening %filepath.", array('%filepath' => $filepath)), WATCHDOG_NOTICE);
+  watchdog('video_upload', "Opening %filepath.", array('%filepath' => $filepath), WATCHDOG_NOTICE);
 
   $fr = fopen($filepath, 'rb');
   while (!feof($fr)) {
@@ -178,7 +238,7 @@ function youtube_api_video_upload($xml, 
   }
   fclose($fr);
 
-  watchdog('video_upload', t("Read file from %filepath.", array('%filepath' => $filepath)), WATCHDOG_NOTICE);
+  watchdog('video_upload', "Read file from %filepath.", array('%filepath' => $filepath), WATCHDOG_NOTICE);
   $data .= "\r\n--". $boundary ."--";
 
   $headers = array(
@@ -191,17 +251,17 @@ function youtube_api_video_upload($xml, 
   );
   $location = 'http://uploads.gdata.youtube.com/feeds/api/users/default/uploads';
 
-  watchdog('video_upload', t("Sending payload to youtube..."), WATCHDOG_NOTICE);
+  watchdog('video_upload', "Sending payload to youtube...", WATCHDOG_NOTICE);
   $result = drupal_http_request($location, $headers, 'POST', $data);
 
-  watchdog('video_upload', t("Payload returned from youtube: [ %data ]", array('%data' => $result->data)), WATCHDOG_NOTICE);
+  watchdog('video_upload', "Payload returned from youtube: [ %data ]", array('%data' => $result->data), WATCHDOG_NOTICE);
   if ($result->code == 201) {
-    watchdog('youtube_api', t("Video upload of %filename successful.", array('%filename' => $filename)), WATCHDOG_NOTICE);
+    watchdog('youtube_api', "Video upload of %filename successful.", array('%filename' => $filename), WATCHDOG_NOTICE);
     $dom = simplexml_load_string($result->data);
     return youtube_api_get_video_object($dom);
   }
   else {
-    watchdog('youtube_api', t("Video upload of {$filename} failed with error code %error.", array('%error' => $result->code .' '. $result->error)), WATCHDOG_ERROR);
+    watchdog('youtube_api', "Video upload of {$filename} failed with error code %error.", array('%error' => $result->code .' '. $result->error), WATCHDOG_ERROR);
     return FALSE;
   }
 }
@@ -635,11 +695,11 @@ function youtube_api_update_video($xml, 
 
   $result = drupal_http_request($feed, $headers, 'PUT', $xml);
   if ($result->code ==200) {
-    watchdog('youtube_api', t("Video %video_id updated successfully.", array('%video_id' => $video_id)), WATCHDOG_NOTICE);
+    watchdog('youtube_api', "Video %video_id updated successfully.", array('%video_id' => $video_id), WATCHDOG_NOTICE);
     return TRUE;
   }
   else {
-    watchdog('youtube_api', t("Video %video_id could not be updated. ". $result->data, array('%video_id' => $video_id)), WATCHDOG_NOTICE);
+    watchdog('youtube_api', "Video %video_id could not be updated. ". $result->data, array('%video_id' => $video_id), WATCHDOG_NOTICE);
     return FALSE;
   }
 }
@@ -692,7 +752,7 @@ function youtube_api_video_search($term,
 function youtube_api_get_video($vid) {
   $feed = variable_get('youtube_api_category_feed', 'http://gdata.youtube.com/feeds/api/videos') .'/'. $vid;
 
-  if ($result = youtube_api_get_feed($feed, null, null)) {
+  if ($result = youtube_api_get_feed($feed, NULL, NULL)) {
     return youtube_api_get_video_object($result);
   }
   else {
