[wp-cvs] wordpress/wp-admin edit-form-advanced.php, 1.37, 1.38 post.php, 1.92, 1.93

Donncha O Caoimh donncha at users.sourceforge.net
Tue Oct 12 15:52:31 UTC 2004


Update of /cvsroot/cafelog/wordpress/wp-admin
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31426/wp-admin

Modified Files:
	edit-form-advanced.php post.php 
Log Message:
Added enclosure support.


Index: post.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/post.php,v
retrieving revision 1.92
retrieving revision 1.93
diff -C2 -d -r1.92 -r1.93
*** post.php	11 Oct 2004 22:13:40 -0000	1.92
--- post.php	12 Oct 2004 15:52:29 -0000	1.93
***************
*** 21,25 ****
  }
  
! $wpvarstoreset = array('action', 'safe_mode', 'withcomments', 'posts', 'poststart', 'postend', 'content', 'edited_post_title', 'comment_error', 'profile', 'trackback_url', 'excerpt', 'showcomments', 'commentstart', 'commentend', 'commentorder');
  
  for ($i=0; $i<count($wpvarstoreset); $i += 1) {
--- 21,25 ----
  }
  
! $wpvarstoreset = array('action', 'safe_mode', 'withcomments', 'posts', 'poststart', 'postend', 'content', 'edited_post_title', 'comment_error', 'profile', 'trackback_url', 'excerpt', 'showcomments', 'commentstart', 'commentend', 'commentorder', 'enclosure_url' );
  
  for ($i=0; $i<count($wpvarstoreset); $i += 1) {
***************
*** 39,46 ****
  
  switch($action) {
- 
- 
  case 'post':
- 
  		$standalone = 1;
  		require_once('admin-header.php');
--- 39,43 ----
***************
*** 413,416 ****
--- 410,452 ----
  	}
  
+         // Enclosures
+         $enclosures = split( "   ", $enclosure_url );
+         if( is_array( $enclosures ) ) {
+             while( list( $key, $url ) = each( $enclosures ) ) {
+                 if( $url != '' ) {
+                     // READ INFO FROM REMOTE HOST
+                     $file = str_replace( "http://", "", $url );
+                     $host = substr( $file, 0, strpos( $file, "/" ) );
+                     $file = substr( $file, strpos( $file, "/" ) );
+                     $headers = "HEAD $file HTTP/1.1\r\nHOST: $host\r\n\r\n";
+                     $port    = 80;
+                     $timeout = 3;
+                     // Open a socket connection to the host
+                     $fp = fsockopen($host, $port, &$err_num, &$err_msg, $timeout);
+                     if( $fp ) {
+                         // Send request for the page
+                         fputs($fp, $headers );
+ 
+                         // Get the response
+                         $response = '';
+                         while (!feof($fp))
+                             $response .= fgets($fp, 2048);
+                     } else {
+                         $response = '';
+                     }
+                     if( $response != '' ) {
+                         $len = substr( $response, strpos( $response, "Content-Length:" ) + 16 );
+                         $len = substr( $len, 0, strpos( $len, "\n" ) );
+                         $type = substr( $response, strpos( $response, "Content-Type:" ) + 14 );
+                         $type = substr( $type, 0, strpos( $type, "\n" ) + 1 );
+                         $meta_value = "$url\n$len\n$type\n";
+                         $query = "INSERT INTO `".$wpdb->postmeta."` ( `meta_id` , `post_id` , `meta_key` , `meta_value` )
+                                   VALUES ( NULL, '$post_ID', 'enclosure' , '".$meta_value."')";
+                         $wpdb->query( $query );
+                     }
+                 }
+             } 
+         }
+ 
  	// are we going from draft/private to published?
  	if ($prev_status != 'publish' && $post_status == 'publish') {
***************
*** 775,779 ****
  
  <?php
! $bookmarklet_height= 420;
  
  if ($is_NS4 || $is_gecko) {
--- 811,815 ----
  
  <?php
! $bookmarklet_height= (get_settings('use_trackback')) ? 460 : 420;
  
  if ($is_NS4 || $is_gecko) {

Index: edit-form-advanced.php
===================================================================
RCS file: /cvsroot/cafelog/wordpress/wp-admin/edit-form-advanced.php,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** edit-form-advanced.php	8 Oct 2004 16:33:10 -0000	1.37
--- edit-form-advanced.php	12 Oct 2004 15:52:29 -0000	1.38
***************
*** 21,37 ****
  $form_prevstatus = '<input type="hidden" name="prev_status" value="'.$post_status.'" />';
  
! 	$form_trackback = '<p><label for="trackback"><a href="http://wordpress.org/docs/reference/post/#trackback" title="' . __('Help on trackbacks') . '">' . __('<strong>TrackBack</strong> a <abbr title="Universal Resource Identifier">URI</abbr></a>') . '</label> ' . __('(Separate multiple <abbr title="Universal Resource Identifier">URI</abbr>s with spaces.)') . '<br />
! 	<input type="text" name="trackback_url" style="width: 415px" id="trackback" tabindex="7" value="'. str_replace("\n", ' ', $to_ping) .'" /></p>';
! 	if ('' != $pinged) {
! 		$pings .= '<p>'. __('Already pinged:') . '</p><ul>';
! 		$already_pinged = explode("\n", trim($pinged));
! 		foreach ($already_pinged as $pinged_url) {
! 			$pings .= "\n\t<li>$pinged_url</li>";
! 		}
! 		$pings .= '</ul>';
  	}
  
  $saveasdraft = '<input name="save" type="submit" id="save" tabindex="6" value="' . __('Save and Continue Editing') . '" />';
  
  if (empty($post_status)) $post_status = 'draft';
  
--- 21,40 ----
  $form_prevstatus = '<input type="hidden" name="prev_status" value="'.$post_status.'" />';
  
! $form_trackback = '<p><label for="trackback"><a href="http://wordpress.org/docs/reference/post/#trackback" title="' . __('Help on trackbacks') . '">' . __('<strong>TrackBack</strong> a <abbr title="Universal Resource Identifier">URI</abbr></a>') . '</label> ' . __('(Separate multiple <abbr title="Universal Resource Identifier">URI</abbr>s with spaces.)') . '<br />
! <input type="text" name="trackback_url" style="width: 415px" id="trackback" tabindex="7" value="'. str_replace("\n", ' ', $to_ping) .'" /></p>';
! if ('' != $pinged) {
! 	$pings .= '<p>'. __('Already pinged:') . '</p><ul>';
! 	$already_pinged = explode("\n", trim($pinged));
! 	foreach ($already_pinged as $pinged_url) {
! 		$pings .= "\n\t<li>$pinged_url</li>";
  	}
+ 	$pings .= '</ul>';
+ }
  
  $saveasdraft = '<input name="save" type="submit" id="save" tabindex="6" value="' . __('Save and Continue Editing') . '" />';
  
+ $form_enclosure = '<p><label for="enclosure"><a href="http://www.thetwowayweb.com/payloadsforrss" title="' . __('Help on enclosures') . '">' . __('<strong>Enclosures</strong></a>') . '</label> ' . __('(Separate multiple <abbr title="Universal Resource Identifier">URI</abbr>s with spaces.)') . '<br />
+ <input type="text" name="enclosure_url" style="width: 415px" id="enclosure" tabindex="8" value="'. str_replace("\n", ' ', $enclosure_url) .'" /></p>';
+ 
  if (empty($post_status)) $post_status = 'draft';
  
***************
*** 122,130 ****
  <input onclick='ReloadTextDiv();' name="use_instant_preview" type="checkbox" id="use_instant_preview" value="1" checked /> <label for='use_instant_preview'>Use Instant Preview</label> <br />
  </fieldset>
- <fieldset id="previewdiv">
- <legend><a href="http://wordpress.org/docs/reference/post/#post" title="Help with post field">Preview</a></legend>
- <div><p id="TextDisplay"></p></div>
- </fieldset>
- 
  <?php
  ?>
--- 125,128 ----
***************
*** 139,143 ****
  <?php echo $form_trackback; ?>
  
- 
  <p class="submit"><?php echo $saveasdraft; ?> <input type="submit" name="submit" value="<?php _e('Save') ?>" style="font-weight: bold;" tabindex="6" /> 
  <?php 
--- 137,140 ----
***************
*** 152,155 ****
--- 149,158 ----
  	<input name="referredby" type="hidden" id="referredby" value="<?php echo htmlspecialchars($_SERVER['HTTP_REFERER']); ?>" />
  </p>
+ <fieldset id="previewdiv">
+ <legend><a href="http://wordpress.org/docs/reference/post/#post" title="Help with post field">Preview</a></legend>
+ <div><p id="TextDisplay"></p></div>
+ </fieldset>
+ <?php echo $form_enclosure; ?>
+ 
  <?php
  if ('' != $pinged) {




More information about the cvs mailing list