Added enclosure support.
git-svn-id: http://svn.automattic.com/wordpress/trunk@1786 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a00764ed8e
commit
dad5defb99
|
@ -20,19 +20,22 @@ $form_pingback = '<input type="hidden" name="post_pingback" value="1" id="post_p
|
||||||
|
|
||||||
$form_prevstatus = '<input type="hidden" name="prev_status" value="'.$post_status.'" />';
|
$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 />
|
$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>';
|
<input type="text" name="trackback_url" style="width: 415px" id="trackback" tabindex="7" value="'. str_replace("\n", ' ', $to_ping) .'" /></p>';
|
||||||
if ('' != $pinged) {
|
if ('' != $pinged) {
|
||||||
$pings .= '<p>'. __('Already pinged:') . '</p><ul>';
|
$pings .= '<p>'. __('Already pinged:') . '</p><ul>';
|
||||||
$already_pinged = explode("\n", trim($pinged));
|
$already_pinged = explode("\n", trim($pinged));
|
||||||
foreach ($already_pinged as $pinged_url) {
|
foreach ($already_pinged as $pinged_url) {
|
||||||
$pings .= "\n\t<li>$pinged_url</li>";
|
$pings .= "\n\t<li>$pinged_url</li>";
|
||||||
}
|
|
||||||
$pings .= '</ul>';
|
|
||||||
}
|
}
|
||||||
|
$pings .= '</ul>';
|
||||||
|
}
|
||||||
|
|
||||||
$saveasdraft = '<input name="save" type="submit" id="save" tabindex="6" value="' . __('Save and Continue Editing') . '" />';
|
$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';
|
if (empty($post_status)) $post_status = 'draft';
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -121,11 +124,6 @@ function ReloadTextDiv()
|
||||||
<div><textarea rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="5" onkeyup="ReloadTextDiv();" id="content"><?php echo $content ?></textarea></div>
|
<div><textarea rows="<?php echo $rows; ?>" cols="40" name="content" tabindex="5" onkeyup="ReloadTextDiv();" id="content"><?php echo $content ?></textarea></div>
|
||||||
<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 />
|
<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>
|
||||||
<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
|
<?php
|
||||||
?>
|
?>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
|
@ -138,7 +136,6 @@ edCanvas = document.getElementById('content');
|
||||||
<?php echo $form_prevstatus ?>
|
<?php echo $form_prevstatus ?>
|
||||||
<?php echo $form_trackback; ?>
|
<?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" />
|
<p class="submit"><?php echo $saveasdraft; ?> <input type="submit" name="submit" value="<?php _e('Save') ?>" style="font-weight: bold;" tabindex="6" />
|
||||||
<?php
|
<?php
|
||||||
if ('publish' != $post_status || 0 == $post_ID) {
|
if ('publish' != $post_status || 0 == $post_ID) {
|
||||||
|
@ -151,6 +148,12 @@ if ('publish' != $post_status || 0 == $post_ID) {
|
||||||
?>
|
?>
|
||||||
<input name="referredby" type="hidden" id="referredby" value="<?php echo htmlspecialchars($_SERVER['HTTP_REFERER']); ?>" />
|
<input name="referredby" type="hidden" id="referredby" value="<?php echo htmlspecialchars($_SERVER['HTTP_REFERER']); ?>" />
|
||||||
</p>
|
</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
|
<?php
|
||||||
if ('' != $pinged) {
|
if ('' != $pinged) {
|
||||||
echo $pings;
|
echo $pings;
|
||||||
|
|
|
@ -20,7 +20,7 @@ $_POST = add_magic_quotes($_POST);
|
||||||
$_COOKIE = add_magic_quotes($_COOKIE);
|
$_COOKIE = add_magic_quotes($_COOKIE);
|
||||||
}
|
}
|
||||||
|
|
||||||
$wpvarstoreset = array('action', 'safe_mode', 'withcomments', 'posts', 'poststart', 'postend', 'content', 'edited_post_title', 'comment_error', 'profile', 'trackback_url', 'excerpt', 'showcomments', 'commentstart', 'commentend', 'commentorder');
|
$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) {
|
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
|
||||||
$wpvar = $wpvarstoreset[$i];
|
$wpvar = $wpvarstoreset[$i];
|
||||||
|
@ -38,10 +38,7 @@ if (!isset($$wpvar)) {
|
||||||
}
|
}
|
||||||
|
|
||||||
switch($action) {
|
switch($action) {
|
||||||
|
|
||||||
|
|
||||||
case 'post':
|
case 'post':
|
||||||
|
|
||||||
$standalone = 1;
|
$standalone = 1;
|
||||||
require_once('admin-header.php');
|
require_once('admin-header.php');
|
||||||
|
|
||||||
|
@ -412,6 +409,45 @@ $now_gmt = current_time('mysql', 1);
|
||||||
sleep($sleep_after_edit);
|
sleep($sleep_after_edit);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 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?
|
// are we going from draft/private to published?
|
||||||
if ($prev_status != 'publish' && $post_status == 'publish') {
|
if ($prev_status != 'publish' && $post_status == 'publish') {
|
||||||
if ($post_pingback) {
|
if ($post_pingback) {
|
||||||
|
@ -774,7 +810,7 @@ default:
|
||||||
<p>
|
<p>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
$bookmarklet_height= 420;
|
$bookmarklet_height= (get_settings('use_trackback')) ? 460 : 420;
|
||||||
|
|
||||||
if ($is_NS4 || $is_gecko) {
|
if ($is_NS4 || $is_gecko) {
|
||||||
?>
|
?>
|
||||||
|
|
12
wp-rss2.php
12
wp-rss2.php
|
@ -41,6 +41,18 @@ $more = 1;
|
||||||
<content:encoded><![CDATA[<?php the_content('', 0, '') ?>]]></content:encoded>
|
<content:encoded><![CDATA[<?php the_content('', 0, '') ?>]]></content:encoded>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<wfw:commentRSS><?php echo comments_rss(); ?></wfw:commentRSS>
|
<wfw:commentRSS><?php echo comments_rss(); ?></wfw:commentRSS>
|
||||||
|
<?php
|
||||||
|
$custom_fields = get_post_custom();
|
||||||
|
if( is_array( $custom_fields ) ) {
|
||||||
|
while( list( $key, $val ) = each( $custom_fields ) ) {
|
||||||
|
if( $key == 'enclosure' ) {
|
||||||
|
$enclosure = $val[ 0 ];
|
||||||
|
$enclosure = split( "\n", $enclosure );
|
||||||
|
print "<enclosure url='".trim( $enclosure[ 0 ] )."' length='".trim( $enclosure[ 1 ] )."' type='".trim( $enclosure[ 2 ] )."'/>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
</item>
|
</item>
|
||||||
<?php $items_count++; if (($items_count == get_settings('posts_per_rss')) && empty($m)) { break; } } } ?>
|
<?php $items_count++; if (($items_count == get_settings('posts_per_rss')) && empty($m)) { break; } } } ?>
|
||||||
</channel>
|
</channel>
|
||||||
|
|
Loading…
Reference in New Issue