Remove trailing spaces and convert spaces to tabs. Props Nazgul. fixes #986
git-svn-id: http://svn.automattic.com/wordpress/trunk@4495 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
38e868257a
commit
9f534ebae6
|
@ -128,7 +128,7 @@ case 'add-category' : // On the Fly
|
||||||
break;
|
break;
|
||||||
case 'add-cat' : // From Manage->Categories
|
case 'add-cat' : // From Manage->Categories
|
||||||
if ( !current_user_can( 'manage_categories' ) )
|
if ( !current_user_can( 'manage_categories' ) )
|
||||||
die('-1');
|
die('-1');
|
||||||
if ( !$cat = wp_insert_category( $_POST ) )
|
if ( !$cat = wp_insert_category( $_POST ) )
|
||||||
die('0');
|
die('0');
|
||||||
if ( !$cat = get_category( $cat ) )
|
if ( !$cat = get_category( $cat ) )
|
||||||
|
|
|
@ -385,15 +385,15 @@ function wp_update_link($linkdata) {
|
||||||
$link = add_magic_quotes($link);
|
$link = add_magic_quotes($link);
|
||||||
|
|
||||||
// Passed link category list overwrites existing category list if not empty.
|
// Passed link category list overwrites existing category list if not empty.
|
||||||
if ( isset($linkdata['link_category']) && is_array($linkdata['link_category'])
|
if ( isset($linkdata['link_category']) && is_array($linkdata['link_category'])
|
||||||
&& 0 != count($linkdata['link_category']) )
|
&& 0 != count($linkdata['link_category']) )
|
||||||
$link_cats = $linkdata['link_category'];
|
$link_cats = $linkdata['link_category'];
|
||||||
else
|
else
|
||||||
$link_cats = $link['link_category'];
|
$link_cats = $link['link_category'];
|
||||||
|
|
||||||
// Merge old and new fields with new fields overwriting old ones.
|
// Merge old and new fields with new fields overwriting old ones.
|
||||||
$linkdata = array_merge($link, $linkdata);
|
$linkdata = array_merge($link, $linkdata);
|
||||||
$linkdata['link_category'] = $link_cats;
|
$linkdata['link_category'] = $link_cats;
|
||||||
|
|
||||||
return wp_insert_link($linkdata);
|
return wp_insert_link($linkdata);
|
||||||
}
|
}
|
||||||
|
|
|
@ -38,13 +38,13 @@ else
|
||||||
|
|
||||||
$content = wp_specialchars($_REQUEST['content']);
|
$content = wp_specialchars($_REQUEST['content']);
|
||||||
$popupurl = wp_specialchars($_REQUEST['popupurl']);
|
$popupurl = wp_specialchars($_REQUEST['popupurl']);
|
||||||
if ( !empty($content) ) {
|
if ( !empty($content) ) {
|
||||||
$post->post_content = wp_specialchars( stripslashes($_REQUEST['content']) );
|
$post->post_content = wp_specialchars( stripslashes($_REQUEST['content']) );
|
||||||
} else {
|
} else {
|
||||||
$post->post_content = '<a href="'.$popupurl.'">'.$popuptitle.'</a>'."\n$text";
|
$post->post_content = '<a href="'.$popupurl.'">'.$popuptitle.'</a>'."\n$text";
|
||||||
}
|
}
|
||||||
|
|
||||||
/* /big funky fixes */
|
/* /big funky fixes */
|
||||||
|
|
||||||
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
@ -77,15 +77,15 @@ $popupurl = wp_specialchars($_REQUEST['popupurl']);
|
||||||
}
|
}
|
||||||
|
|
||||||
#wpbookmarklet .wrap {
|
#wpbookmarklet .wrap {
|
||||||
border: 0px;
|
border: 0px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#wpbookmarklet #postdiv {
|
#wpbookmarklet #postdiv {
|
||||||
margin-bottom: 0.5em;
|
margin-bottom: 0.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
#wpbookmarklet #titlediv {
|
#wpbookmarklet #titlediv {
|
||||||
margin-bottom: 1em;
|
margin-bottom: 1em;
|
||||||
}
|
}
|
||||||
|
|
||||||
-->
|
-->
|
||||||
|
|
|
@ -48,10 +48,10 @@ break;
|
||||||
|
|
||||||
case 'edit':
|
case 'edit':
|
||||||
|
|
||||||
require_once ('admin-header.php');
|
require_once ('admin-header.php');
|
||||||
$cat_ID = (int) $_GET['cat_ID'];
|
$cat_ID = (int) $_GET['cat_ID'];
|
||||||
$category = get_category_to_edit($cat_ID);
|
$category = get_category_to_edit($cat_ID);
|
||||||
include('edit-category-form.php');
|
include('edit-category-form.php');
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -14,10 +14,10 @@ function customFieldsAddIn() {
|
||||||
for ( var i=0; i < inputs.length; i++ ) {
|
for ( var i=0; i < inputs.length; i++ ) {
|
||||||
if ('text' == inputs[i].type) {
|
if ('text' == inputs[i].type) {
|
||||||
inputs[i].setAttribute('autocomplete', 'off');
|
inputs[i].setAttribute('autocomplete', 'off');
|
||||||
inputs[i].onkeypress = function(e) {return killSubmit('theList.ajaxUpdater("meta", "meta-' + parseInt(this.name.slice(5),10) + '");', e); };
|
inputs[i].onkeypress = function(e) {return killSubmit('theList.ajaxUpdater("meta", "meta-' + parseInt(this.name.slice(5),10) + '");', e); };
|
||||||
}
|
}
|
||||||
if ('updatemeta' == inputs[i].className) {
|
if ('updatemeta' == inputs[i].className) {
|
||||||
inputs[i].onclick = function(e) {return killSubmit('theList.ajaxUpdater("meta", "meta-' + parseInt(this.parentNode.parentNode.id.slice(5),10) + '");', e); };
|
inputs[i].onclick = function(e) {return killSubmit('theList.ajaxUpdater("meta", "meta-' + parseInt(this.parentNode.parentNode.id.slice(5),10) + '");', e); };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,8 +22,8 @@ if ( ! empty($cat_ID) ) {
|
||||||
<?php wp_nonce_field($nonce_action); ?>
|
<?php wp_nonce_field($nonce_action); ?>
|
||||||
<table class="editform" width="100%" cellspacing="2" cellpadding="5">
|
<table class="editform" width="100%" cellspacing="2" cellpadding="5">
|
||||||
<tr>
|
<tr>
|
||||||
<th width="33%" scope="row" valign="top"><label for="cat_name"><?php _e('Category name:') ?></label></th>
|
<th width="33%" scope="row" valign="top"><label for="cat_name"><?php _e('Category name:') ?></label></th>
|
||||||
<td width="67%"><input name="cat_name" id="cat_name" type="text" value="<?php echo wp_specialchars($category->cat_name); ?>" size="40" /></td>
|
<td width="67%"><input name="cat_name" id="cat_name" type="text" value="<?php echo wp_specialchars($category->cat_name); ?>" size="40" /></td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row" valign="top"><label for="category_nicename"><?php _e('Category slug:') ?></label></th>
|
<th scope="row" valign="top"><label for="category_nicename"><?php _e('Category slug:') ?></label></th>
|
||||||
|
|
|
@ -181,7 +181,7 @@ $post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title;
|
||||||
|
|
||||||
?>
|
?>
|
||||||
<p>
|
<p>
|
||||||
<strong><?php _e('No comments found.') ?></strong></p>
|
<strong><?php _e('No comments found.') ?></strong></p>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
} // end if ($comments)
|
} // end if ($comments)
|
||||||
|
|
|
@ -8,8 +8,7 @@ $messages[3] = __('Custom field deleted.');
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<form name="post" action="post.php" method="post" id="post">
|
<form name="post" action="post.php" method="post" id="post">
|
||||||
<?php if ( (isset($mode) && 'bookmarklet' == $mode) ||
|
<?php if ( (isset($mode) && 'bookmarklet' == $mode) || isset($_GET['popupurl']) ): ?>
|
||||||
isset($_GET['popupurl']) ): ?>
|
|
||||||
<input type="hidden" name="mode" value="bookmarklet" />
|
<input type="hidden" name="mode" value="bookmarklet" />
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
|
@ -140,8 +139,8 @@ endforeach;
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<fieldset id="titlediv">
|
<fieldset id="titlediv">
|
||||||
<legend><?php _e('Title') ?></legend>
|
<legend><?php _e('Title') ?></legend>
|
||||||
<div><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo $post->post_title; ?>" id="title" /></div>
|
<div><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo $post->post_title; ?>" id="title" /></div>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
|
|
||||||
<fieldset id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>">
|
<fieldset id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>">
|
||||||
|
|
|
@ -54,8 +54,8 @@ addLoadEvent(focusit);
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row" valign="top"><?php _e('Comment Status') ?>:</th>
|
<th scope="row" valign="top"><?php _e('Comment Status') ?>:</th>
|
||||||
<td><label for="comment_status_approved" class="selectit"><input id="comment_status_approved" name="comment_status" type="radio" value="1" <?php checked($comment->comment_approved, '1'); ?> /> <?php _e('Approved') ?></label><br />
|
<td><label for="comment_status_approved" class="selectit"><input id="comment_status_approved" name="comment_status" type="radio" value="1" <?php checked($comment->comment_approved, '1'); ?> /> <?php _e('Approved') ?></label><br />
|
||||||
<label for="comment_status_moderated" class="selectit"><input id="comment_status_moderated" name="comment_status" type="radio" value="0" <?php checked($comment->comment_approved, '0'); ?> /> <?php _e('Moderated') ?></label><br />
|
<label for="comment_status_moderated" class="selectit"><input id="comment_status_moderated" name="comment_status" type="radio" value="0" <?php checked($comment->comment_approved, '0'); ?> /> <?php _e('Moderated') ?></label><br />
|
||||||
<label for="comment_status_spam" class="selectit"><input id="comment_status_spam" name="comment_status" type="radio" value="spam" <?php checked($comment->comment_approved, 'spam'); ?> /> <?php _e('Spam') ?></label></td>
|
<label for="comment_status_spam" class="selectit"><input id="comment_status_spam" name="comment_status" type="radio" value="spam" <?php checked($comment->comment_approved, 'spam'); ?> /> <?php _e('Spam') ?></label></td>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<?php if ( current_user_can('edit_posts') ) : ?>
|
<?php if ( current_user_can('edit_posts') ) : ?>
|
||||||
|
|
|
@ -55,16 +55,16 @@ edCanvas = document.getElementById('content');
|
||||||
<input type="text" name="trackback_url" style="width: 360px" id="trackback" tabindex="7" /></p>
|
<input type="text" name="trackback_url" style="width: 360px" id="trackback" tabindex="7" /></p>
|
||||||
|
|
||||||
<p class="submit"><input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" value="<?php _e('Save as Draft') ?>" />
|
<p class="submit"><input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" value="<?php _e('Save as Draft') ?>" />
|
||||||
<input name="saveasprivate" type="submit" id="saveasprivate" tabindex="10" value="<?php _e('Save as Private') ?>" />
|
<input name="saveasprivate" type="submit" id="saveasprivate" tabindex="10" value="<?php _e('Save as Private') ?>" />
|
||||||
|
|
||||||
<?php if ( current_user_can('edit_posts') ) : ?>
|
<?php if ( current_user_can('edit_posts') ) : ?>
|
||||||
<input name="publish" type="submit" id="publish" tabindex="6" style="font-weight: bold;" value="<?php _e('Publish') ?>" />
|
<input name="publish" type="submit" id="publish" tabindex="6" style="font-weight: bold;" value="<?php _e('Publish') ?>" />
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php if ('bookmarklet' != $mode) {
|
<?php if ('bookmarklet' != $mode) {
|
||||||
echo '<input name="advanced" type="submit" id="advancededit" tabindex="7" value="' . __('Advanced Editing »') . '" />';
|
echo '<input name="advanced" type="submit" id="advancededit" tabindex="7" value="' . __('Advanced Editing »') . '" />';
|
||||||
} ?>
|
} ?>
|
||||||
<input name="referredby" type="hidden" id="referredby" value="<?php if ( wp_get_referer() ) echo urlencode(wp_get_referer()); ?>" />
|
<input name="referredby" type="hidden" id="referredby" value="<?php if ( wp_get_referer() ) echo urlencode(wp_get_referer()); ?>" />
|
||||||
</p>
|
</p>
|
||||||
|
|
||||||
<?php do_action('simple_edit_form', ''); ?>
|
<?php do_action('simple_edit_form', ''); ?>
|
||||||
|
|
|
@ -16,7 +16,7 @@ if (0 == $post_ID) {
|
||||||
$sendto = wp_get_referer();
|
$sendto = wp_get_referer();
|
||||||
|
|
||||||
if ( 0 != $post_ID && $sendto == get_permalink($post_ID) )
|
if ( 0 != $post_ID && $sendto == get_permalink($post_ID) )
|
||||||
$sendto = 'redo';
|
$sendto = 'redo';
|
||||||
$sendto = wp_specialchars( $sendto );
|
$sendto = wp_specialchars( $sendto );
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
@ -27,7 +27,7 @@ $sendto = wp_specialchars( $sendto );
|
||||||
wp_nonce_field($nonce_action);
|
wp_nonce_field($nonce_action);
|
||||||
|
|
||||||
if (isset($mode) && 'bookmarklet' == $mode) {
|
if (isset($mode) && 'bookmarklet' == $mode) {
|
||||||
echo '<input type="hidden" name="mode" value="bookmarklet" />';
|
echo '<input type="hidden" name="mode" value="bookmarklet" />';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" />
|
<input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" />
|
||||||
|
|
|
@ -11,11 +11,11 @@ require_once('admin-header.php');
|
||||||
<p><?php _e('Pages are like posts except they live outside of the normal blog chronology and can be hierarchical. You can use pages to organize and manage any amount of content.'); ?> <a href="page-new.php"><?php _e('Create a new page »'); ?></a></p>
|
<p><?php _e('Pages are like posts except they live outside of the normal blog chronology and can be hierarchical. You can use pages to organize and manage any amount of content.'); ?> <a href="page-new.php"><?php _e('Create a new page »'); ?></a></p>
|
||||||
|
|
||||||
<form name="searchform" action="" method="get">
|
<form name="searchform" action="" method="get">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend><?php _e('Search Pages…') ?></legend>
|
<legend><?php _e('Search Pages…') ?></legend>
|
||||||
<input type="text" name="s" value="<?php if (isset($_GET['s'])) echo wp_specialchars($_GET['s'], 1); ?>" size="17" />
|
<input type="text" name="s" value="<?php if (isset($_GET['s'])) echo wp_specialchars($_GET['s'], 1); ?>" size="17" />
|
||||||
<input type="submit" name="submit" value="<?php _e('Search') ?>" />
|
<input type="submit" name="submit" value="<?php _e('Search') ?>" />
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
|
|
|
@ -15,8 +15,8 @@ if ($drafts || $other_drafts) {
|
||||||
?>
|
?>
|
||||||
<div class="wrap">
|
<div class="wrap">
|
||||||
<?php if ($drafts) { ?>
|
<?php if ($drafts) { ?>
|
||||||
<p><strong><?php _e('Your Drafts:') ?></strong>
|
<p><strong><?php _e('Your Drafts:') ?></strong>
|
||||||
<?php
|
<?php
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($drafts as $draft) {
|
foreach ($drafts as $draft) {
|
||||||
if (0 != $i)
|
if (0 != $i)
|
||||||
|
@ -28,12 +28,12 @@ if ($drafts || $other_drafts) {
|
||||||
++$i;
|
++$i;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
.</p>
|
.</p>
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
<?php if ($other_drafts) { ?>
|
<?php if ($other_drafts) { ?>
|
||||||
<p><strong><?php _e('Other’s Drafts:') ?></strong>
|
<p><strong><?php _e('Other’s Drafts:') ?></strong>
|
||||||
<?php
|
<?php
|
||||||
$i = 0;
|
$i = 0;
|
||||||
foreach ($other_drafts as $draft) {
|
foreach ($other_drafts as $draft) {
|
||||||
if (0 != $i)
|
if (0 != $i)
|
||||||
|
@ -45,7 +45,7 @@ if ($drafts || $other_drafts) {
|
||||||
++$i;
|
++$i;
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
.</p>
|
.</p>
|
||||||
|
|
||||||
<?php } ?>
|
<?php } ?>
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ if ( count($arc_result) ) { ?>
|
||||||
<form name="viewarc" id="viewarc" action="" method="get">
|
<form name="viewarc" id="viewarc" action="" method="get">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend><?php _e('Browse Month…') ?></legend>
|
<legend><?php _e('Browse Month…') ?></legend>
|
||||||
<select name='m'>
|
<select name='m'>
|
||||||
<?php
|
<?php
|
||||||
foreach ($arc_result as $arc_row) {
|
foreach ($arc_result as $arc_row) {
|
||||||
if ( $arc_row->yyear == 0 )
|
if ( $arc_row->yyear == 0 )
|
||||||
|
@ -127,12 +127,12 @@ if ( count($arc_result) ) { ?>
|
||||||
<?php
|
<?php
|
||||||
// define the columns to display, the syntax is 'internal name' => 'display name'
|
// define the columns to display, the syntax is 'internal name' => 'display name'
|
||||||
$posts_columns = array(
|
$posts_columns = array(
|
||||||
'id' => __('ID'),
|
'id' => __('ID'),
|
||||||
'date' => __('When'),
|
'date' => __('When'),
|
||||||
'title' => __('Title'),
|
'title' => __('Title'),
|
||||||
'categories' => __('Categories'),
|
'categories' => __('Categories'),
|
||||||
'comments' => __('Comments'),
|
'comments' => __('Comments'),
|
||||||
'author' => __('Author')
|
'author' => __('Author')
|
||||||
);
|
);
|
||||||
$posts_columns = apply_filters('manage_posts_columns', $posts_columns);
|
$posts_columns = apply_filters('manage_posts_columns', $posts_columns);
|
||||||
|
|
||||||
|
@ -196,8 +196,8 @@ foreach($posts_columns as $column_name=>$column_display_name) {
|
||||||
case 'comments':
|
case 'comments':
|
||||||
?>
|
?>
|
||||||
<td style="text-align: center"><a href="edit.php?p=<?php echo $id ?>&c=1">
|
<td style="text-align: center"><a href="edit.php?p=<?php echo $id ?>&c=1">
|
||||||
<?php comments_number(__('0'), __('1'), __('%')) ?>
|
<?php comments_number(__('0'), __('1'), __('%')) ?>
|
||||||
</a></td>
|
</a></td>
|
||||||
<?php
|
<?php
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -517,7 +517,7 @@ class Blogger_Import {
|
||||||
$did_one = true;
|
$did_one = true;
|
||||||
}
|
}
|
||||||
$output.= "<p>$archivename $status</p>\n";
|
$output.= "<p>$archivename $status</p>\n";
|
||||||
}
|
}
|
||||||
if ( ! $did_one )
|
if ( ! $did_one )
|
||||||
$this->set_next_step(7);
|
$this->set_next_step(7);
|
||||||
die( $this->refresher(1000) . $output );
|
die( $this->refresher(1000) . $output );
|
||||||
|
|
|
@ -60,57 +60,58 @@ if(!function_exists('link_exists'))
|
||||||
//
|
//
|
||||||
// This cries out for a C-implementation to be included in PHP core
|
// This cries out for a C-implementation to be included in PHP core
|
||||||
//
|
//
|
||||||
function valid_1byte($char) {
|
|
||||||
if(!is_int($char)) return false;
|
|
||||||
return ($char & 0x80) == 0x00;
|
|
||||||
}
|
|
||||||
|
|
||||||
function valid_2byte($char) {
|
function valid_1byte($char) {
|
||||||
if(!is_int($char)) return false;
|
if(!is_int($char)) return false;
|
||||||
return ($char & 0xE0) == 0xC0;
|
return ($char & 0x80) == 0x00;
|
||||||
}
|
}
|
||||||
|
|
||||||
function valid_3byte($char) {
|
function valid_2byte($char) {
|
||||||
if(!is_int($char)) return false;
|
if(!is_int($char)) return false;
|
||||||
return ($char & 0xF0) == 0xE0;
|
return ($char & 0xE0) == 0xC0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function valid_4byte($char) {
|
function valid_3byte($char) {
|
||||||
if(!is_int($char)) return false;
|
if(!is_int($char)) return false;
|
||||||
return ($char & 0xF8) == 0xF0;
|
return ($char & 0xF0) == 0xE0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function valid_nextbyte($char) {
|
function valid_4byte($char) {
|
||||||
if(!is_int($char)) return false;
|
if(!is_int($char)) return false;
|
||||||
return ($char & 0xC0) == 0x80;
|
return ($char & 0xF8) == 0xF0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function valid_utf8($string) {
|
function valid_nextbyte($char) {
|
||||||
$len = strlen($string);
|
if(!is_int($char)) return false;
|
||||||
$i = 0;
|
return ($char & 0xC0) == 0x80;
|
||||||
while( $i < $len ) {
|
}
|
||||||
$char = ord(substr($string, $i++, 1));
|
|
||||||
if(valid_1byte($char)) { // continue
|
function valid_utf8($string) {
|
||||||
continue;
|
$len = strlen($string);
|
||||||
} else if(valid_2byte($char)) { // check 1 byte
|
$i = 0;
|
||||||
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
|
while( $i < $len ) {
|
||||||
return false;
|
$char = ord(substr($string, $i++, 1));
|
||||||
} else if(valid_3byte($char)) { // check 2 bytes
|
if(valid_1byte($char)) { // continue
|
||||||
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
|
continue;
|
||||||
return false;
|
} else if(valid_2byte($char)) { // check 1 byte
|
||||||
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
|
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
|
||||||
return false;
|
return false;
|
||||||
} else if(valid_4byte($char)) { // check 3 bytes
|
} else if(valid_3byte($char)) { // check 2 bytes
|
||||||
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
|
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
|
||||||
return false;
|
return false;
|
||||||
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
|
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
|
||||||
return false;
|
return false;
|
||||||
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
|
} else if(valid_4byte($char)) { // check 3 bytes
|
||||||
return false;
|
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
|
||||||
} // goto next char
|
return false;
|
||||||
}
|
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
|
||||||
return true; // done
|
return false;
|
||||||
}
|
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
|
||||||
|
return false;
|
||||||
|
} // goto next char
|
||||||
|
}
|
||||||
|
return true; // done
|
||||||
|
}
|
||||||
|
|
||||||
function csc ($s) {
|
function csc ($s) {
|
||||||
if (valid_utf8 ($s)) {
|
if (valid_utf8 ($s)) {
|
||||||
|
@ -186,7 +187,7 @@ class Dotclear_Import {
|
||||||
// Get Posts
|
// Get Posts
|
||||||
return $dcdb->get_results('SELECT '.$dbprefix.'post.*, '.$dbprefix.'categorie.cat_libelle_url AS post_cat_name
|
return $dcdb->get_results('SELECT '.$dbprefix.'post.*, '.$dbprefix.'categorie.cat_libelle_url AS post_cat_name
|
||||||
FROM '.$dbprefix.'post INNER JOIN '.$dbprefix.'categorie
|
FROM '.$dbprefix.'post INNER JOIN '.$dbprefix.'categorie
|
||||||
ON '.$dbprefix.'post.cat_id = '.$dbprefix.'categorie.cat_id', ARRAY_A);
|
ON '.$dbprefix.'post.cat_id = '.$dbprefix.'categorie.cat_id', ARRAY_A);
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_dc_comments()
|
function get_dc_comments()
|
||||||
|
|
|
@ -71,12 +71,12 @@ class Textpattern_Import {
|
||||||
|
|
||||||
// Get Categories
|
// Get Categories
|
||||||
return $txpdb->get_results('SELECT
|
return $txpdb->get_results('SELECT
|
||||||
id,
|
id,
|
||||||
name,
|
name,
|
||||||
title
|
title
|
||||||
FROM '.$prefix.'txp_category
|
FROM '.$prefix.'txp_category
|
||||||
WHERE type = "article"',
|
WHERE type = "article"',
|
||||||
ARRAY_A);
|
ARRAY_A);
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_txp_users()
|
function get_txp_users()
|
||||||
|
@ -90,12 +90,12 @@ class Textpattern_Import {
|
||||||
// Get Users
|
// Get Users
|
||||||
|
|
||||||
return $txpdb->get_results('SELECT
|
return $txpdb->get_results('SELECT
|
||||||
user_id,
|
user_id,
|
||||||
name,
|
name,
|
||||||
RealName,
|
RealName,
|
||||||
email,
|
email,
|
||||||
privs
|
privs
|
||||||
FROM '.$prefix.'txp_users', ARRAY_A);
|
FROM '.$prefix.'txp_users', ARRAY_A);
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_txp_posts()
|
function get_txp_posts()
|
||||||
|
@ -107,21 +107,21 @@ class Textpattern_Import {
|
||||||
|
|
||||||
// Get Posts
|
// Get Posts
|
||||||
return $txpdb->get_results('SELECT
|
return $txpdb->get_results('SELECT
|
||||||
ID,
|
ID,
|
||||||
Posted,
|
Posted,
|
||||||
AuthorID,
|
AuthorID,
|
||||||
LastMod,
|
LastMod,
|
||||||
Title,
|
Title,
|
||||||
Body,
|
Body,
|
||||||
Excerpt,
|
Excerpt,
|
||||||
Category1,
|
Category1,
|
||||||
Category2,
|
Category2,
|
||||||
Status,
|
Status,
|
||||||
Keywords,
|
Keywords,
|
||||||
url_title,
|
url_title,
|
||||||
comments_count
|
comments_count
|
||||||
FROM '.$prefix.'textpattern
|
FROM '.$prefix.'textpattern
|
||||||
', ARRAY_A);
|
', ARRAY_A);
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_txp_comments()
|
function get_txp_comments()
|
||||||
|
@ -144,14 +144,14 @@ class Textpattern_Import {
|
||||||
$prefix = get_option('tpre');
|
$prefix = get_option('tpre');
|
||||||
|
|
||||||
return $txpdb->get_results('SELECT
|
return $txpdb->get_results('SELECT
|
||||||
id,
|
id,
|
||||||
date,
|
date,
|
||||||
category,
|
category,
|
||||||
url,
|
url,
|
||||||
linkname,
|
linkname,
|
||||||
description
|
description
|
||||||
FROM '.$prefix.'txp_link',
|
FROM '.$prefix.'txp_link',
|
||||||
ARRAY_A);
|
ARRAY_A);
|
||||||
}
|
}
|
||||||
|
|
||||||
function cat2wp($categories='')
|
function cat2wp($categories='')
|
||||||
|
@ -302,35 +302,35 @@ class Textpattern_Import {
|
||||||
if($pinfo = post_exists($Title,$Body))
|
if($pinfo = post_exists($Title,$Body))
|
||||||
{
|
{
|
||||||
$ret_id = wp_insert_post(array(
|
$ret_id = wp_insert_post(array(
|
||||||
'ID' => $pinfo,
|
'ID' => $pinfo,
|
||||||
'post_date' => $Posted,
|
'post_date' => $Posted,
|
||||||
'post_date_gmt' => $post_date_gmt,
|
'post_date_gmt' => $post_date_gmt,
|
||||||
'post_author' => $authorid,
|
'post_author' => $authorid,
|
||||||
'post_modified' => $LastMod,
|
'post_modified' => $LastMod,
|
||||||
'post_modified_gmt' => $post_modified_gmt,
|
'post_modified_gmt' => $post_modified_gmt,
|
||||||
'post_title' => $Title,
|
'post_title' => $Title,
|
||||||
'post_content' => $Body,
|
'post_content' => $Body,
|
||||||
'post_excerpt' => $Excerpt,
|
'post_excerpt' => $Excerpt,
|
||||||
'post_status' => $post_status,
|
'post_status' => $post_status,
|
||||||
'post_name' => $url_title,
|
'post_name' => $url_title,
|
||||||
'comment_count' => $comments_count)
|
'comment_count' => $comments_count)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$ret_id = wp_insert_post(array(
|
$ret_id = wp_insert_post(array(
|
||||||
'post_date' => $Posted,
|
'post_date' => $Posted,
|
||||||
'post_date_gmt' => $post_date_gmt,
|
'post_date_gmt' => $post_date_gmt,
|
||||||
'post_author' => $authorid,
|
'post_author' => $authorid,
|
||||||
'post_modified' => $LastMod,
|
'post_modified' => $LastMod,
|
||||||
'post_modified_gmt' => $post_modified_gmt,
|
'post_modified_gmt' => $post_modified_gmt,
|
||||||
'post_title' => $Title,
|
'post_title' => $Title,
|
||||||
'post_content' => $Body,
|
'post_content' => $Body,
|
||||||
'post_excerpt' => $Excerpt,
|
'post_excerpt' => $Excerpt,
|
||||||
'post_status' => $post_status,
|
'post_status' => $post_status,
|
||||||
'post_name' => $url_title,
|
'post_name' => $url_title,
|
||||||
'comment_count' => $comments_count)
|
'comment_count' => $comments_count)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$txpposts2wpposts[$ID] = $ret_id;
|
$txpposts2wpposts[$ID] = $ret_id;
|
||||||
|
|
||||||
|
@ -379,29 +379,29 @@ class Textpattern_Import {
|
||||||
{
|
{
|
||||||
// Update comments
|
// Update comments
|
||||||
$ret_id = wp_update_comment(array(
|
$ret_id = wp_update_comment(array(
|
||||||
'comment_ID' => $cinfo,
|
'comment_ID' => $cinfo,
|
||||||
'comment_post_ID' => $comment_post_ID,
|
'comment_post_ID' => $comment_post_ID,
|
||||||
'comment_author' => $name,
|
'comment_author' => $name,
|
||||||
'comment_author_email' => $email,
|
'comment_author_email' => $email,
|
||||||
'comment_author_url' => $web,
|
'comment_author_url' => $web,
|
||||||
'comment_date' => $posted,
|
'comment_date' => $posted,
|
||||||
'comment_content' => $message,
|
'comment_content' => $message,
|
||||||
'comment_approved' => $comment_approved)
|
'comment_approved' => $comment_approved)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Insert comments
|
// Insert comments
|
||||||
$ret_id = wp_insert_comment(array(
|
$ret_id = wp_insert_comment(array(
|
||||||
'comment_post_ID' => $comment_post_ID,
|
'comment_post_ID' => $comment_post_ID,
|
||||||
'comment_author' => $name,
|
'comment_author' => $name,
|
||||||
'comment_author_email' => $email,
|
'comment_author_email' => $email,
|
||||||
'comment_author_url' => $web,
|
'comment_author_url' => $web,
|
||||||
'comment_author_IP' => $ip,
|
'comment_author_IP' => $ip,
|
||||||
'comment_date' => $posted,
|
'comment_date' => $posted,
|
||||||
'comment_content' => $message,
|
'comment_content' => $message,
|
||||||
'comment_approved' => $comment_approved)
|
'comment_approved' => $comment_approved)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
$txpcm2wpcm[$comment_ID] = $ret_id;
|
$txpcm2wpcm[$comment_ID] = $ret_id;
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,21 +9,21 @@ $debug = 0;
|
||||||
** false on error
|
** false on error
|
||||||
*/
|
*/
|
||||||
function maybe_create_table($table_name, $create_ddl) {
|
function maybe_create_table($table_name, $create_ddl) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
|
foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
|
||||||
if ($table == $table_name) {
|
if ($table == $table_name) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//didn't find it try to create it.
|
//didn't find it try to create it.
|
||||||
$q = $wpdb->query($create_ddl);
|
$q = $wpdb->query($create_ddl);
|
||||||
// we cannot directly tell that whether this succeeded!
|
// we cannot directly tell that whether this succeeded!
|
||||||
foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
|
foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
|
||||||
if ($table == $table_name) {
|
if ($table == $table_name) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -33,22 +33,22 @@ function maybe_create_table($table_name, $create_ddl) {
|
||||||
** false on error
|
** false on error
|
||||||
*/
|
*/
|
||||||
function maybe_add_column($table_name, $column_name, $create_ddl) {
|
function maybe_add_column($table_name, $column_name, $create_ddl) {
|
||||||
global $wpdb, $debug;
|
global $wpdb, $debug;
|
||||||
foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
|
foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
|
||||||
if ($debug) echo("checking $column == $column_name<br />");
|
if ($debug) echo("checking $column == $column_name<br />");
|
||||||
if ($column == $column_name) {
|
if ($column == $column_name) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//didn't find it try to create it.
|
//didn't find it try to create it.
|
||||||
$q = $wpdb->query($create_ddl);
|
$q = $wpdb->query($create_ddl);
|
||||||
// we cannot directly tell that whether this succeeded!
|
// we cannot directly tell that whether this succeeded!
|
||||||
foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
|
foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
|
||||||
if ($column == $column_name) {
|
if ($column == $column_name) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,21 +59,21 @@ function maybe_add_column($table_name, $column_name, $create_ddl) {
|
||||||
** false on error
|
** false on error
|
||||||
*/
|
*/
|
||||||
function maybe_drop_column($table_name, $column_name, $drop_ddl) {
|
function maybe_drop_column($table_name, $column_name, $drop_ddl) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
|
foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
|
||||||
if ($column == $column_name) {
|
if ($column == $column_name) {
|
||||||
//found it try to drop it.
|
//found it try to drop it.
|
||||||
$q = $wpdb->query($drop_ddl);
|
$q = $wpdb->query($drop_ddl);
|
||||||
// we cannot directly tell that whether this succeeded!
|
// we cannot directly tell that whether this succeeded!
|
||||||
foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
|
foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
|
||||||
if ($column == $column_name) {
|
if ($column == $column_name) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// else didn't find it
|
// else didn't find it
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -92,38 +92,38 @@ function maybe_drop_column($table_name, $column_name, $drop_ddl) {
|
||||||
** Extra
|
** Extra
|
||||||
*/
|
*/
|
||||||
function check_column($table_name, $col_name, $col_type, $is_null = null, $key = null, $default = null, $extra = null) {
|
function check_column($table_name, $col_name, $col_type, $is_null = null, $key = null, $default = null, $extra = null) {
|
||||||
global $wpdb, $debug;
|
global $wpdb, $debug;
|
||||||
$diffs = 0;
|
$diffs = 0;
|
||||||
$results = $wpdb->get_results("DESC $table_name");
|
$results = $wpdb->get_results("DESC $table_name");
|
||||||
|
|
||||||
foreach ($results as $row ) {
|
foreach ($results as $row ) {
|
||||||
if ($debug > 1) print_r($row);
|
if ($debug > 1) print_r($row);
|
||||||
if ($row->Field == $col_name) {
|
if ($row->Field == $col_name) {
|
||||||
// got our column, check the params
|
// got our column, check the params
|
||||||
if ($debug) echo ("checking $row->Type against $col_type\n");
|
if ($debug) echo ("checking $row->Type against $col_type\n");
|
||||||
if (($col_type != null) && ($row->Type != $col_type)) {
|
if (($col_type != null) && ($row->Type != $col_type)) {
|
||||||
++$diffs;
|
++$diffs;
|
||||||
}
|
}
|
||||||
if (($is_null != null) && ($row->Null != $is_null)) {
|
if (($is_null != null) && ($row->Null != $is_null)) {
|
||||||
++$diffs;
|
++$diffs;
|
||||||
}
|
}
|
||||||
if (($key != null) && ($row->Key != $key)) {
|
if (($key != null) && ($row->Key != $key)) {
|
||||||
++$diffs;
|
++$diffs;
|
||||||
}
|
}
|
||||||
if (($default != null) && ($row->Default != $default)) {
|
if (($default != null) && ($row->Default != $default)) {
|
||||||
++$diffs;
|
++$diffs;
|
||||||
}
|
}
|
||||||
if (($extra != null) && ($row->Extra != $extra)) {
|
if (($extra != null) && ($row->Extra != $extra)) {
|
||||||
++$diffs;
|
++$diffs;
|
||||||
}
|
}
|
||||||
if ($diffs > 0) {
|
if ($diffs > 0) {
|
||||||
if ($debug) echo ("diffs = $diffs returning false\n");
|
if ($debug) echo ("diffs = $diffs returning false\n");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
} // end if found our column
|
} // end if found our column
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -138,14 +138,14 @@ $tablename = $wpdb->links;
|
||||||
// check the column
|
// check the column
|
||||||
if (!check_column($wpdb->links, 'link_description', 'varchar(255)'))
|
if (!check_column($wpdb->links, 'link_description', 'varchar(255)'))
|
||||||
{
|
{
|
||||||
$ddl = "ALTER TABLE $wpdb->links MODIFY COLUMN link_description varchar(255) NOT NULL DEFAULT '' ";
|
$ddl = "ALTER TABLE $wpdb->links MODIFY COLUMN link_description varchar(255) NOT NULL DEFAULT '' ";
|
||||||
$q = $wpdb->query($ddl);
|
$q = $wpdb->query($ddl);
|
||||||
}
|
}
|
||||||
if (check_column($wpdb->links, 'link_description', 'varchar(255)')) {
|
if (check_column($wpdb->links, 'link_description', 'varchar(255)')) {
|
||||||
$res .= $tablename . ' - ok <br />';
|
$res .= $tablename . ' - ok <br />';
|
||||||
} else {
|
} else {
|
||||||
$res .= 'There was a problem with ' . $tablename . '<br />';
|
$res .= 'There was a problem with ' . $tablename . '<br />';
|
||||||
++$error_count;
|
++$error_count;
|
||||||
}
|
}
|
||||||
echo "</pre>";
|
echo "</pre>";
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -7,9 +7,9 @@ $parent_file = 'link-manager.php';
|
||||||
|
|
||||||
|
|
||||||
wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image',
|
wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image',
|
||||||
'description', 'visible', 'target', 'category', 'link_id',
|
'description', 'visible', 'target', 'category', 'link_id',
|
||||||
'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel',
|
'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel',
|
||||||
'notes', 'linkcheck[]'));
|
'notes', 'linkcheck[]'));
|
||||||
|
|
||||||
wp_enqueue_script( array('xfn', 'dbx-admin-key?pagenow=link.php') );
|
wp_enqueue_script( array('xfn', 'dbx-admin-key?pagenow=link.php') );
|
||||||
if ( current_user_can( 'manage_categories' ) )
|
if ( current_user_can( 'manage_categories' ) )
|
||||||
|
|
|
@ -143,8 +143,8 @@ if ($links)
|
||||||
echo $link->link_description . "</td>";
|
echo $link->link_description . "</td>";
|
||||||
echo "<td><a href=\"$link->link_url\" title=\"".sprintf(__('Visit %s'), $link->link_name)."\">$short_url</a></td>";
|
echo "<td><a href=\"$link->link_url\" title=\"".sprintf(__('Visit %s'), $link->link_name)."\">$short_url</a></td>";
|
||||||
?>
|
?>
|
||||||
<td>
|
<td>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
$cat_names = array();
|
$cat_names = array();
|
||||||
foreach ($link->link_category as $category) {
|
foreach ($link->link_category as $category) {
|
||||||
|
@ -157,8 +157,8 @@ if ($links)
|
||||||
echo implode(', ', $cat_names);
|
echo implode(', ', $cat_names);
|
||||||
?>
|
?>
|
||||||
</td>
|
</td>
|
||||||
<td><?php echo $link->link_rel; ?></td>
|
<td><?php echo $link->link_rel; ?></td>
|
||||||
<td align='center'><?php echo $visible; ?></td>
|
<td align='center'><?php echo $visible; ?></td>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
echo '<td><a href="link.php?link_id='.$link->link_id.'&action=edit" class="edit">'.__('Edit').'</a></td>';
|
echo '<td><a href="link.php?link_id='.$link->link_id.'&action=edit" class="edit">'.__('Edit').'</a></td>';
|
||||||
|
|
|
@ -4,12 +4,12 @@ require_once('../wp-config.php');
|
||||||
// columns we wish to find are: link_url, link_name, link_target, link_description
|
// columns we wish to find are: link_url, link_name, link_target, link_description
|
||||||
// we need to map XML attribute names to our columns
|
// we need to map XML attribute names to our columns
|
||||||
$opml_map = array('URL' => 'link_url',
|
$opml_map = array('URL' => 'link_url',
|
||||||
'HTMLURL' => 'link_url',
|
'HTMLURL' => 'link_url',
|
||||||
'TEXT' => 'link_name',
|
'TEXT' => 'link_name',
|
||||||
'TITLE' => 'link_name',
|
'TITLE' => 'link_name',
|
||||||
'TARGET' => 'link_target',
|
'TARGET' => 'link_target',
|
||||||
'DESCRIPTION' => 'link_description',
|
'DESCRIPTION' => 'link_description',
|
||||||
'XMLURL' => 'link_rss'
|
'XMLURL' => 'link_rss'
|
||||||
);
|
);
|
||||||
|
|
||||||
$map = $opml_map;
|
$map = $opml_map;
|
||||||
|
@ -20,24 +20,24 @@ $map = $opml_map;
|
||||||
**/
|
**/
|
||||||
function startElement($parser, $tagName, $attrs) {
|
function startElement($parser, $tagName, $attrs) {
|
||||||
global $updated_timestamp, $all_links, $map;
|
global $updated_timestamp, $all_links, $map;
|
||||||
global $names, $urls, $targets, $descriptions, $feeds;
|
global $names, $urls, $targets, $descriptions, $feeds;
|
||||||
|
|
||||||
if ($tagName == 'OUTLINE') {
|
if ($tagName == 'OUTLINE') {
|
||||||
foreach (array_keys($map) as $key) {
|
foreach (array_keys($map) as $key) {
|
||||||
if (isset($attrs[$key])) {
|
if (isset($attrs[$key])) {
|
||||||
$$map[$key] = $attrs[$key];
|
$$map[$key] = $attrs[$key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//echo("got data: link_url = [$link_url], link_name = [$link_name], link_target = [$link_target], link_description = [$link_description]<br />\n");
|
//echo("got data: link_url = [$link_url], link_name = [$link_name], link_target = [$link_target], link_description = [$link_description]<br />\n");
|
||||||
|
|
||||||
// save the data away.
|
// save the data away.
|
||||||
$names[] = $link_name;
|
$names[] = $link_name;
|
||||||
$urls[] = $link_url;
|
$urls[] = $link_url;
|
||||||
$targets[] = $link_target;
|
$targets[] = $link_target;
|
||||||
$feeds[] = $link_rss;
|
$feeds[] = $link_rss;
|
||||||
$descriptions[] = $link_description;
|
$descriptions[] = $link_description;
|
||||||
} // end if outline
|
} // end if outline
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -55,9 +55,9 @@ $xml_parser = xml_parser_create();
|
||||||
xml_set_element_handler($xml_parser, "startElement", "endElement");
|
xml_set_element_handler($xml_parser, "startElement", "endElement");
|
||||||
|
|
||||||
if (!xml_parse($xml_parser, $opml, true)) {
|
if (!xml_parse($xml_parser, $opml, true)) {
|
||||||
echo(sprintf(__('XML error: %1$s at line %2$s'),
|
echo(sprintf(__('XML error: %1$s at line %2$s'),
|
||||||
xml_error_string(xml_get_error_code($xml_parser)),
|
xml_error_string(xml_get_error_code($xml_parser)),
|
||||||
xml_get_current_line_number($xml_parser)));
|
xml_get_current_line_number($xml_parser)));
|
||||||
}
|
}
|
||||||
|
|
||||||
// Free up memory used by the XML parser
|
// Free up memory used by the XML parser
|
||||||
|
|
|
@ -31,7 +31,7 @@ case 'update':
|
||||||
foreach($comment as $key => $value) {
|
foreach($comment as $key => $value) {
|
||||||
if ($feelinglucky && 'later' == $value)
|
if ($feelinglucky && 'later' == $value)
|
||||||
$value = 'delete';
|
$value = 'delete';
|
||||||
switch($value) {
|
switch($value) {
|
||||||
case 'later':
|
case 'later':
|
||||||
// do nothing with that comment
|
// do nothing with that comment
|
||||||
// wp_set_comment_status($key, "hold");
|
// wp_set_comment_status($key, "hold");
|
||||||
|
@ -41,10 +41,10 @@ case 'update':
|
||||||
wp_set_comment_status($key, 'delete');
|
wp_set_comment_status($key, 'delete');
|
||||||
++$item_deleted;
|
++$item_deleted;
|
||||||
break;
|
break;
|
||||||
case 'spam':
|
case 'spam':
|
||||||
wp_set_comment_status($key, 'spam');
|
wp_set_comment_status($key, 'spam');
|
||||||
++$item_spam;
|
++$item_spam;
|
||||||
break;
|
break;
|
||||||
case 'approve':
|
case 'approve':
|
||||||
wp_set_comment_status($key, 'approve');
|
wp_set_comment_status($key, 'approve');
|
||||||
if ( get_option('comments_notify') == true ) {
|
if ( get_option('comments_notify') == true ) {
|
||||||
|
@ -52,7 +52,7 @@ case 'update':
|
||||||
}
|
}
|
||||||
++$item_approved;
|
++$item_approved;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$file = basename(__FILE__);
|
$file = basename(__FILE__);
|
||||||
|
@ -85,13 +85,13 @@ if ( isset($_GET['deleted']) || isset($_GET['approved']) || isset($_GET['ignored
|
||||||
echo sprintf(__("%s comments deleted"), $deleted) . " <br/>\n";
|
echo sprintf(__("%s comments deleted"), $deleted) . " <br/>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($spam) {
|
if ($spam) {
|
||||||
if ('1' == $spam) {
|
if ('1' == $spam) {
|
||||||
echo __("1 comment marked as spam") . " <br/>\n";
|
echo __("1 comment marked as spam") . " <br/>\n";
|
||||||
} else {
|
} else {
|
||||||
echo sprintf(__("%s comments marked as spam"), $spam) . " <br/>\n";
|
echo sprintf(__("%s comments marked as spam"), $spam) . " <br/>\n";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ($ignored) {
|
if ($ignored) {
|
||||||
if ('1' == $ignored) {
|
if ('1' == $ignored) {
|
||||||
echo __("1 comment unchanged") . " <br/>\n";
|
echo __("1 comment unchanged") . " <br/>\n";
|
||||||
|
@ -151,13 +151,13 @@ $post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title;
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</ol>
|
</ol>
|
||||||
|
|
||||||
<div id="ajax-response"></div>
|
<div id="ajax-response"></div>
|
||||||
|
|
||||||
<p class="submit"><input type="submit" name="submit" value="<?php _e('Bulk Moderate Comments »') ?>" /></p>
|
<p class="submit"><input type="submit" name="submit" value="<?php _e('Bulk Moderate Comments »') ?>" /></p>
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
// <![CDATA[
|
// <![CDATA[
|
||||||
function markAllForDelete() {
|
function markAllForDelete() {
|
||||||
|
@ -197,10 +197,10 @@ document.write('<ul><li><a href="javascript:markAllForApprove()"><?php _e('Mark
|
||||||
<input name="feelinglucky" type="checkbox" id="feelinglucky" value="true" /> <label for="feelinglucky"><?php _e('Delete every comment marked "defer." <strong>Warning: This can’t be undone.</strong>'); ?></label>
|
<input name="feelinglucky" type="checkbox" id="feelinglucky" value="true" /> <label for="feelinglucky"><?php _e('Delete every comment marked "defer." <strong>Warning: This can’t be undone.</strong>'); ?></label>
|
||||||
</p>
|
</p>
|
||||||
</noscript>
|
</noscript>
|
||||||
</form>
|
</form>
|
||||||
<?php
|
<?php
|
||||||
} else {
|
} else {
|
||||||
// nothing to approve
|
// nothing to approve
|
||||||
echo '<p>'.__("Currently there are no comments for you to moderate.") . "</p>\n";
|
echo '<p>'.__("Currently there are no comments for you to moderate.") . "</p>\n";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
|
|
|
@ -62,7 +62,7 @@ default:
|
||||||
<div id="message" class="updated fade"><p><?php _e('File edited successfully.') ?></p></div>
|
<div id="message" class="updated fade"><p><?php _e('File edited successfully.') ?></p></div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<div class="wrap">
|
<div class="wrap">
|
||||||
<?php
|
<?php
|
||||||
if (is_writeable($real_file)) {
|
if (is_writeable($real_file)) {
|
||||||
echo '<h2>' . sprintf(__('Editing <strong>%s</strong>'), $file) . '</h2>';
|
echo '<h2>' . sprintf(__('Editing <strong>%s</strong>'), $file) . '</h2>';
|
||||||
} else {
|
} else {
|
||||||
|
@ -75,35 +75,35 @@ default:
|
||||||
<?php
|
<?php
|
||||||
if ($plugin_files) :
|
if ($plugin_files) :
|
||||||
?>
|
?>
|
||||||
<ul>
|
<ul>
|
||||||
<?php foreach($plugin_files as $plugin_file) : ?>
|
<?php foreach($plugin_files as $plugin_file) : ?>
|
||||||
<li><a href="plugin-editor.php?file=<?php echo "$plugin_file"; ?>"><?php echo $plugins[$plugin_file]['Name']; ?></a></li>
|
<li><a href="plugin-editor.php?file=<?php echo "$plugin_file"; ?>"><?php echo $plugins[$plugin_file]['Name']; ?></a></li>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</ul>
|
</ul>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
<?php if (!$error) { ?>
|
<?php if (!$error) { ?>
|
||||||
<form name="template" id="template" action="plugin-editor.php" method="post">
|
<form name="template" id="template" action="plugin-editor.php" method="post">
|
||||||
<?php wp_nonce_field('edit-plugin_' . $file) ?>
|
<?php wp_nonce_field('edit-plugin_' . $file) ?>
|
||||||
<div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1"><?php echo $content ?></textarea>
|
<div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1"><?php echo $content ?></textarea>
|
||||||
<input type="hidden" name="action" value="update" />
|
<input type="hidden" name="action" value="update" />
|
||||||
<input type="hidden" name="file" value="<?php echo $file ?>" />
|
<input type="hidden" name="file" value="<?php echo $file ?>" />
|
||||||
</div>
|
</div>
|
||||||
<?php if ( is_writeable($real_file) ) : ?>
|
<?php if ( is_writeable($real_file) ) : ?>
|
||||||
<p class="submit">
|
<p class="submit">
|
||||||
<?php
|
<?php
|
||||||
echo "<input type='submit' name='submit' value=' " . __('Update File »') . "' tabindex='2' />";
|
echo "<input type='submit' name='submit' value=' " . __('Update File »') . "' tabindex='2' />";
|
||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
<p><em><?php _e('If this file were writable you could edit it.'); ?></em></p>
|
<p><em><?php _e('If this file were writable you could edit it.'); ?></em></p>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</form>
|
</form>
|
||||||
<?php
|
<?php
|
||||||
} else {
|
} else {
|
||||||
echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>';
|
echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>';
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<div class="clear"> </div>
|
<div class="clear"> </div>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
|
|
|
@ -121,13 +121,13 @@ if ( $show_password_fields ) :
|
||||||
|
|
||||||
<br clear="all" />
|
<br clear="all" />
|
||||||
|
|
||||||
<table width="99%" border="0" cellspacing="2" cellpadding="3" class="editform">
|
<table width="99%" border="0" cellspacing="2" cellpadding="3" class="editform">
|
||||||
<?php
|
<?php
|
||||||
if(count($profileuser->caps) > count($profileuser->roles)):
|
if(count($profileuser->caps) > count($profileuser->roles)):
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row"><?php _e('Additional Capabilities:') ?></th>
|
<th scope="row"><?php _e('Additional Capabilities:') ?></th>
|
||||||
<td><?php
|
<td><?php
|
||||||
$output = '';
|
$output = '';
|
||||||
foreach($profileuser->caps as $cap => $value) {
|
foreach($profileuser->caps as $cap => $value) {
|
||||||
if(!$wp_roles->is_role($cap)) {
|
if(!$wp_roles->is_role($cap)) {
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
define('WP_INSTALLING', true);
|
define('WP_INSTALLING', true);
|
||||||
|
|
||||||
if (!file_exists('../wp-config-sample.php'))
|
if (!file_exists('../wp-config-sample.php'))
|
||||||
die('Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.');
|
die('Sorry, I need a wp-config-sample.php file to work from. Please re-upload this file from your WordPress installation.');
|
||||||
|
|
||||||
$configFile = file('../wp-config-sample.php');
|
$configFile = file('../wp-config-sample.php');
|
||||||
|
|
||||||
|
@ -86,11 +86,11 @@ switch($step) {
|
||||||
|
|
||||||
<p>Welcome to WordPress. Before getting started, we need some information on the database. You will need to know the following items before proceeding.</p>
|
<p>Welcome to WordPress. Before getting started, we need some information on the database. You will need to know the following items before proceeding.</p>
|
||||||
<ol>
|
<ol>
|
||||||
<li>Database name</li>
|
<li>Database name</li>
|
||||||
<li>Database username</li>
|
<li>Database username</li>
|
||||||
<li>Database password</li>
|
<li>Database password</li>
|
||||||
<li>Database host</li>
|
<li>Database host</li>
|
||||||
<li>Table prefix (if you want to run more than one WordPress in a single database) </li>
|
<li>Table prefix (if you want to run more than one WordPress in a single database) </li>
|
||||||
</ol>
|
</ol>
|
||||||
<p><strong>If for any reason this automatic file creation doesn't work, don't worry. All this does is fill in the database information to a configuration file. You may also simply open <code>wp-config-sample.php</code> in a text editor, fill in your information, and save it as <code>wp-config.php</code>. </strong></p>
|
<p><strong>If for any reason this automatic file creation doesn't work, don't worry. All this does is fill in the database information to a configuration file. You may also simply open <code>wp-config-sample.php</code> in a text editor, fill in your information, and save it as <code>wp-config.php</code>. </strong></p>
|
||||||
<p>In all likelihood, these items were supplied to you by your ISP. If you do not have this information, then you will need to contact them before you can continue. If you’re all ready, <a href="setup-config.php?step=1">let’s go</a>! </p>
|
<p>In all likelihood, these items were supplied to you by your ISP. If you do not have this information, then you will need to contact them before you can continue. If you’re all ready, <a href="setup-config.php?step=1">let’s go</a>! </p>
|
||||||
|
@ -101,81 +101,81 @@ switch($step) {
|
||||||
?>
|
?>
|
||||||
</p>
|
</p>
|
||||||
<form method="post" action="setup-config.php?step=2">
|
<form method="post" action="setup-config.php?step=2">
|
||||||
<p>Below you should enter your database connection details. If you're not sure about these, contact your host. </p>
|
<p>Below you should enter your database connection details. If you're not sure about these, contact your host. </p>
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Database Name</th>
|
<th scope="row">Database Name</th>
|
||||||
<td><input name="dbname" type="text" size="25" value="wordpress" /></td>
|
<td><input name="dbname" type="text" size="25" value="wordpress" /></td>
|
||||||
<td>The name of the database you want to run WP in. </td>
|
<td>The name of the database you want to run WP in. </td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">User Name</th>
|
<th scope="row">User Name</th>
|
||||||
<td><input name="uname" type="text" size="25" value="username" /></td>
|
<td><input name="uname" type="text" size="25" value="username" /></td>
|
||||||
<td>Your MySQL username</td>
|
<td>Your MySQL username</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Password</th>
|
<th scope="row">Password</th>
|
||||||
<td><input name="pwd" type="text" size="25" value="password" /></td>
|
<td><input name="pwd" type="text" size="25" value="password" /></td>
|
||||||
<td>...and MySQL password.</td>
|
<td>...and MySQL password.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Database Host</th>
|
<th scope="row">Database Host</th>
|
||||||
<td><input name="dbhost" type="text" size="25" value="localhost" /></td>
|
<td><input name="dbhost" type="text" size="25" value="localhost" /></td>
|
||||||
<td>99% chance you won't need to change this value.</td>
|
<td>99% chance you won't need to change this value.</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row">Table Prefix</th>
|
<th scope="row">Table Prefix</th>
|
||||||
<td><input name="prefix" type="text" id="prefix" value="wp_" size="25" /></td>
|
<td><input name="prefix" type="text" id="prefix" value="wp_" size="25" /></td>
|
||||||
<td>If you want to run multiple WordPress installations in a single database, change this.</td>
|
<td>If you want to run multiple WordPress installations in a single database, change this.</td>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<h2 class="step">
|
<h2 class="step">
|
||||||
<input name="submit" type="submit" value="Submit" />
|
<input name="submit" type="submit" value="Submit" />
|
||||||
</h2>
|
</h2>
|
||||||
</form>
|
</form>
|
||||||
<?php
|
<?php
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
$dbname = trim($_POST['dbname']);
|
$dbname = trim($_POST['dbname']);
|
||||||
$uname = trim($_POST['uname']);
|
$uname = trim($_POST['uname']);
|
||||||
$passwrd = trim($_POST['pwd']);
|
$passwrd = trim($_POST['pwd']);
|
||||||
$dbhost = trim($_POST['dbhost']);
|
$dbhost = trim($_POST['dbhost']);
|
||||||
$prefix = trim($_POST['prefix']);
|
$prefix = trim($_POST['prefix']);
|
||||||
if (empty($prefix)) $prefix = 'wp_';
|
if (empty($prefix)) $prefix = 'wp_';
|
||||||
|
|
||||||
// Test the db connection.
|
// Test the db connection.
|
||||||
define('DB_NAME', $dbname);
|
define('DB_NAME', $dbname);
|
||||||
define('DB_USER', $uname);
|
define('DB_USER', $uname);
|
||||||
define('DB_PASSWORD', $passwrd);
|
define('DB_PASSWORD', $passwrd);
|
||||||
define('DB_HOST', $dbhost);
|
define('DB_HOST', $dbhost);
|
||||||
|
|
||||||
// We'll fail here if the values are no good.
|
// We'll fail here if the values are no good.
|
||||||
require_once('../wp-includes/wp-db.php');
|
require_once('../wp-includes/wp-db.php');
|
||||||
$handle = fopen('../wp-config.php', 'w');
|
$handle = fopen('../wp-config.php', 'w');
|
||||||
|
|
||||||
foreach ($configFile as $line_num => $line) {
|
foreach ($configFile as $line_num => $line) {
|
||||||
switch (substr($line,0,16)) {
|
switch (substr($line,0,16)) {
|
||||||
case "define('DB_NAME'":
|
case "define('DB_NAME'":
|
||||||
fwrite($handle, str_replace("wordpress", $dbname, $line));
|
fwrite($handle, str_replace("wordpress", $dbname, $line));
|
||||||
break;
|
break;
|
||||||
case "define('DB_USER'":
|
case "define('DB_USER'":
|
||||||
fwrite($handle, str_replace("'username'", "'$uname'", $line));
|
fwrite($handle, str_replace("'username'", "'$uname'", $line));
|
||||||
break;
|
break;
|
||||||
case "define('DB_PASSW":
|
case "define('DB_PASSW":
|
||||||
fwrite($handle, str_replace("'password'", "'$passwrd'", $line));
|
fwrite($handle, str_replace("'password'", "'$passwrd'", $line));
|
||||||
break;
|
break;
|
||||||
case "define('DB_HOST'":
|
case "define('DB_HOST'":
|
||||||
fwrite($handle, str_replace("localhost", $dbhost, $line));
|
fwrite($handle, str_replace("localhost", $dbhost, $line));
|
||||||
break;
|
break;
|
||||||
case '$table_prefix =':
|
case '$table_prefix =':
|
||||||
fwrite($handle, str_replace('wp_', $prefix, $line));
|
fwrite($handle, str_replace('wp_', $prefix, $line));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
fwrite($handle, $line);
|
fwrite($handle, $line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fclose($handle);
|
fclose($handle);
|
||||||
chmod('../wp-config.php', 0666);
|
chmod('../wp-config.php', 0666);
|
||||||
?>
|
?>
|
||||||
<p>All right sparky! You've made it through this part of the installation. WordPress can now communicate with your database. If you are ready, time now to <a href="install.php">run the install!</a></p>
|
<p>All right sparky! You've made it through this part of the installation. WordPress can now communicate with your database. If you are ready, time now to <a href="install.php">run the install!</a></p>
|
||||||
|
|
|
@ -34,15 +34,15 @@ form {
|
||||||
padding: 3px;
|
padding: 3px;
|
||||||
}
|
}
|
||||||
.sidebar-categories {
|
.sidebar-categories {
|
||||||
display: block;
|
display: block;
|
||||||
height: 6.6em;
|
height: 6.6em;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
background-color: #f4f4f4;
|
background-color: #f4f4f4;
|
||||||
}
|
}
|
||||||
.sidebar-categories label {
|
.sidebar-categories label {
|
||||||
font-size: 10px;
|
font-size: 10px;
|
||||||
display: block;
|
display: block;
|
||||||
width: 90%;
|
width: 90%;
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
|
@ -65,9 +65,9 @@ Post:
|
||||||
<textarea rows="8" cols="12" style="width: 100%" name="content" tabindex="2"></textarea>
|
<textarea rows="8" cols="12" style="width: 100%" name="content" tabindex="2"></textarea>
|
||||||
</p>
|
</p>
|
||||||
<p>
|
<p>
|
||||||
<input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" value="Save as Draft" />
|
<input name="saveasdraft" type="submit" id="saveasdraft" tabindex="9" value="Save as Draft" />
|
||||||
<?php if ( current_user_can('publish_posts') ) : ?>
|
<?php if ( current_user_can('publish_posts') ) : ?>
|
||||||
<input name="publish" type="submit" id="publish" tabindex="6" style="font-weight: bold;" value="Publish" />
|
<input name="publish" type="submit" id="publish" tabindex="6" style="font-weight: bold;" value="Publish" />
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -110,21 +110,21 @@ endif;
|
||||||
if (file_exists(ABSPATH . $old_file))
|
if (file_exists(ABSPATH . $old_file))
|
||||||
$common_files[] = $old_file;
|
$common_files[] = $old_file;
|
||||||
} ?>
|
} ?>
|
||||||
<ul>
|
<ul>
|
||||||
<?php foreach ($common_files as $common_file) : ?>
|
<?php foreach ($common_files as $common_file) : ?>
|
||||||
<li><a href="templates.php?file=<?php echo $common_file?>"><?php echo get_file_description($common_file); ?></a></li>
|
<li><a href="templates.php?file=<?php echo $common_file?>"><?php echo get_file_description($common_file); ?></a></li>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
<?php if (!$error) { ?>
|
<?php if (!$error) { ?>
|
||||||
<form name="template" id="template" action="templates.php" method="post">
|
<form name="template" id="template" action="templates.php" method="post">
|
||||||
<?php wp_nonce_field('edit-file_' . $file) ?>
|
<?php wp_nonce_field('edit-file_' . $file) ?>
|
||||||
<div><textarea cols="70" rows="25" name="newcontent" id='newcontent' tabindex="1"><?php echo $content ?></textarea>
|
<div><textarea cols="70" rows="25" name="newcontent" id='newcontent' tabindex="1"><?php echo $content ?></textarea>
|
||||||
<input type="hidden" name="action" value="update" />
|
<input type="hidden" name="action" value="update" />
|
||||||
<input type="hidden" name="file" value="<?php echo $file ?>" />
|
<input type="hidden" name="file" value="<?php echo $file ?>" />
|
||||||
</div>
|
</div>
|
||||||
<?php if ( is_writeable($real_file) ) : ?>
|
<?php if ( is_writeable($real_file) ) : ?>
|
||||||
<p class="submit">
|
<p class="submit">
|
||||||
<?php
|
<?php
|
||||||
echo "<input type='submit' name='submit' value=' " . __('Update File »') . "' tabindex='2' />";
|
echo "<input type='submit' name='submit' value=' " . __('Update File »') . "' tabindex='2' />";
|
||||||
?>
|
?>
|
||||||
|
@ -132,8 +132,8 @@ endif;
|
||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
<p><em><?php _e('If this file were writable you could edit it.'); ?></em></p>
|
<p><em><?php _e('If this file were writable you could edit it.'); ?></em></p>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</form>
|
</form>
|
||||||
<?php
|
<?php
|
||||||
} else {
|
} else {
|
||||||
echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>';
|
echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>';
|
||||||
}
|
}
|
||||||
|
@ -143,13 +143,13 @@ endif;
|
||||||
<div class="wrap">
|
<div class="wrap">
|
||||||
<h2><?php _e('Other Files') ?></h2>
|
<h2><?php _e('Other Files') ?></h2>
|
||||||
|
|
||||||
<p><?php _e('To edit a file, type its name here. You can edit any file <a href="http://codex.wordpress.org/Changing_File_Permissions" title="Read more about making files writable">writable by the server</a>, e.g. CHMOD 666.') ?></p>
|
<p><?php _e('To edit a file, type its name here. You can edit any file <a href="http://codex.wordpress.org/Changing_File_Permissions" title="Read more about making files writable">writable by the server</a>, e.g. CHMOD 666.') ?></p>
|
||||||
<form name="file" action="templates.php" method="get">
|
<form name="file" action="templates.php" method="get">
|
||||||
<input type="text" name="file" />
|
<input type="text" name="file" />
|
||||||
<input type="submit" name="submit" value="<?php _e('Edit file »') ?>" />
|
<input type="submit" name="submit" value="<?php _e('Edit file »') ?>" />
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<p><?php _e('Note: of course, you can also edit the files/templates in your text editor of choice and upload them. This online editor is only meant to be used when you don’t have access to a text editor or FTP client.') ?></p>
|
<p><?php _e('Note: of course, you can also edit the files/templates in your text editor of choice and upload them. This online editor is only meant to be used when you don’t have access to a text editor or FTP client.') ?></p>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
|
|
@ -80,7 +80,7 @@ default:
|
||||||
<div id="message" class="updated fade"><p><?php _e('File edited successfully.') ?></p></div>
|
<div id="message" class="updated fade"><p><?php _e('File edited successfully.') ?></p></div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<div class="wrap">
|
<div class="wrap">
|
||||||
<form name="theme" action="theme-editor.php" method="post">
|
<form name="theme" action="theme-editor.php" method="post">
|
||||||
<?php _e('Select theme to edit:') ?>
|
<?php _e('Select theme to edit:') ?>
|
||||||
<select name="theme" id="theme">
|
<select name="theme" id="theme">
|
||||||
<?php
|
<?php
|
||||||
|
@ -106,30 +106,30 @@ default:
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<div id="templateside">
|
<div id="templateside">
|
||||||
<h3><?php printf(__("<strong>'%s'</strong> theme files"), $theme) ?></h3>
|
<h3><?php printf(__("<strong>'%s'</strong> theme files"), $theme) ?></h3>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
if ($allowed_files) :
|
if ($allowed_files) :
|
||||||
?>
|
?>
|
||||||
<ul>
|
<ul>
|
||||||
<?php foreach($allowed_files as $allowed_file) : ?>
|
<?php foreach($allowed_files as $allowed_file) : ?>
|
||||||
<li><a href="theme-editor.php?file=<?php echo "$allowed_file"; ?>&theme=<?php echo urlencode($theme) ?>"><?php echo get_file_description($allowed_file); ?></a></li>
|
<li><a href="theme-editor.php?file=<?php echo "$allowed_file"; ?>&theme=<?php echo urlencode($theme) ?>"><?php echo get_file_description($allowed_file); ?></a></li>
|
||||||
<?php endforeach; ?>
|
<?php endforeach; ?>
|
||||||
</ul>
|
</ul>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
if (!$error) {
|
if (!$error) {
|
||||||
?>
|
?>
|
||||||
<form name="template" id="template" action="theme-editor.php" method="post">
|
<form name="template" id="template" action="theme-editor.php" method="post">
|
||||||
<?php wp_nonce_field('edit-theme_' . $file . $theme) ?>
|
<?php wp_nonce_field('edit-theme_' . $file . $theme) ?>
|
||||||
<div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1"><?php echo $content ?></textarea>
|
<div><textarea cols="70" rows="25" name="newcontent" id="newcontent" tabindex="1"><?php echo $content ?></textarea>
|
||||||
<input type="hidden" name="action" value="update" />
|
<input type="hidden" name="action" value="update" />
|
||||||
<input type="hidden" name="file" value="<?php echo $file ?>" />
|
<input type="hidden" name="file" value="<?php echo $file ?>" />
|
||||||
<input type="hidden" name="theme" value="<?php echo $theme ?>" />
|
<input type="hidden" name="theme" value="<?php echo $theme ?>" />
|
||||||
</div>
|
</div>
|
||||||
<?php if ( is_writeable($real_file) ) : ?>
|
<?php if ( is_writeable($real_file) ) : ?>
|
||||||
<p class="submit">
|
<p class="submit">
|
||||||
<?php
|
<?php
|
||||||
echo "<input type='submit' name='submit' value=' " . __('Update File »') . "' tabindex='2' />";
|
echo "<input type='submit' name='submit' value=' " . __('Update File »') . "' tabindex='2' />";
|
||||||
?>
|
?>
|
||||||
|
@ -137,8 +137,8 @@ if ($allowed_files) :
|
||||||
<?php else : ?>
|
<?php else : ?>
|
||||||
<p><em><?php _e('If this file were writable you could edit it.'); ?></em></p>
|
<p><em><?php _e('If this file were writable you could edit it.'); ?></em></p>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
</form>
|
</form>
|
||||||
<?php
|
<?php
|
||||||
} else {
|
} else {
|
||||||
echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>';
|
echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>';
|
||||||
}
|
}
|
||||||
|
|
|
@ -112,10 +112,10 @@ if ( count($broken_themes) ) {
|
||||||
|
|
||||||
$theme = ('class="alternate"' == $theme) ? '' : 'class="alternate"';
|
$theme = ('class="alternate"' == $theme) ? '' : 'class="alternate"';
|
||||||
echo "
|
echo "
|
||||||
<tr $theme>
|
<tr $theme>
|
||||||
<td>$title</td>
|
<td>$title</td>
|
||||||
<td>$description</td>
|
<td>$description</td>
|
||||||
</tr>";
|
</tr>";
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -251,19 +251,19 @@ function upgrade_101() {
|
||||||
function upgrade_110() {
|
function upgrade_110() {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
// Set user_nicename.
|
// Set user_nicename.
|
||||||
$users = $wpdb->get_results("SELECT ID, user_nickname, user_nicename FROM $wpdb->users");
|
$users = $wpdb->get_results("SELECT ID, user_nickname, user_nicename FROM $wpdb->users");
|
||||||
foreach ($users as $user) {
|
foreach ($users as $user) {
|
||||||
if ('' == $user->user_nicename) {
|
if ('' == $user->user_nicename) {
|
||||||
$newname = sanitize_title($user->user_nickname);
|
$newname = sanitize_title($user->user_nickname);
|
||||||
$wpdb->query("UPDATE $wpdb->users SET user_nicename = '$newname' WHERE ID = '$user->ID'");
|
$wpdb->query("UPDATE $wpdb->users SET user_nicename = '$newname' WHERE ID = '$user->ID'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$users = $wpdb->get_results("SELECT ID, user_pass from $wpdb->users");
|
$users = $wpdb->get_results("SELECT ID, user_pass from $wpdb->users");
|
||||||
foreach ($users as $row) {
|
foreach ($users as $row) {
|
||||||
if (!preg_match('/^[A-Fa-f0-9]{32}$/', $row->user_pass)) {
|
if (!preg_match('/^[A-Fa-f0-9]{32}$/', $row->user_pass)) {
|
||||||
$wpdb->query('UPDATE '.$wpdb->users.' SET user_pass = MD5(\''.$row->user_pass.'\') WHERE ID = \''.$row->ID.'\'');
|
$wpdb->query('UPDATE '.$wpdb->users.' SET user_pass = MD5(\''.$row->user_pass.'\') WHERE ID = \''.$row->ID.'\'');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -305,57 +305,57 @@ function upgrade_110() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function upgrade_130() {
|
function upgrade_130() {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
// Remove extraneous backslashes.
|
// Remove extraneous backslashes.
|
||||||
$posts = $wpdb->get_results("SELECT ID, post_title, post_content, post_excerpt, guid, post_date, post_name, post_status, post_author FROM $wpdb->posts");
|
$posts = $wpdb->get_results("SELECT ID, post_title, post_content, post_excerpt, guid, post_date, post_name, post_status, post_author FROM $wpdb->posts");
|
||||||
if ($posts) {
|
if ($posts) {
|
||||||
foreach($posts as $post) {
|
foreach($posts as $post) {
|
||||||
$post_content = addslashes(deslash($post->post_content));
|
$post_content = addslashes(deslash($post->post_content));
|
||||||
$post_title = addslashes(deslash($post->post_title));
|
$post_title = addslashes(deslash($post->post_title));
|
||||||
$post_excerpt = addslashes(deslash($post->post_excerpt));
|
$post_excerpt = addslashes(deslash($post->post_excerpt));
|
||||||
if ( empty($post->guid) )
|
if ( empty($post->guid) )
|
||||||
$guid = get_permalink($post->ID);
|
$guid = get_permalink($post->ID);
|
||||||
else
|
else
|
||||||
$guid = $post->guid;
|
$guid = $post->guid;
|
||||||
|
|
||||||
$wpdb->query("UPDATE $wpdb->posts SET post_title = '$post_title', post_content = '$post_content', post_excerpt = '$post_excerpt', guid = '$guid' WHERE ID = '$post->ID'");
|
$wpdb->query("UPDATE $wpdb->posts SET post_title = '$post_title', post_content = '$post_content', post_excerpt = '$post_excerpt', guid = '$guid' WHERE ID = '$post->ID'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove extraneous backslashes.
|
// Remove extraneous backslashes.
|
||||||
$comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_content FROM $wpdb->comments");
|
$comments = $wpdb->get_results("SELECT comment_ID, comment_author, comment_content FROM $wpdb->comments");
|
||||||
if ($comments) {
|
if ($comments) {
|
||||||
foreach($comments as $comment) {
|
foreach($comments as $comment) {
|
||||||
$comment_content = addslashes(deslash($comment->comment_content));
|
$comment_content = addslashes(deslash($comment->comment_content));
|
||||||
$comment_author = addslashes(deslash($comment->comment_author));
|
$comment_author = addslashes(deslash($comment->comment_author));
|
||||||
$wpdb->query("UPDATE $wpdb->comments SET comment_content = '$comment_content', comment_author = '$comment_author' WHERE comment_ID = '$comment->comment_ID'");
|
$wpdb->query("UPDATE $wpdb->comments SET comment_content = '$comment_content', comment_author = '$comment_author' WHERE comment_ID = '$comment->comment_ID'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove extraneous backslashes.
|
// Remove extraneous backslashes.
|
||||||
$links = $wpdb->get_results("SELECT link_id, link_name, link_description FROM $wpdb->links");
|
$links = $wpdb->get_results("SELECT link_id, link_name, link_description FROM $wpdb->links");
|
||||||
if ($links) {
|
if ($links) {
|
||||||
foreach($links as $link) {
|
foreach($links as $link) {
|
||||||
$link_name = addslashes(deslash($link->link_name));
|
$link_name = addslashes(deslash($link->link_name));
|
||||||
$link_description = addslashes(deslash($link->link_description));
|
$link_description = addslashes(deslash($link->link_description));
|
||||||
$wpdb->query("UPDATE $wpdb->links SET link_name = '$link_name', link_description = '$link_description' WHERE link_id = '$link->link_id'");
|
$wpdb->query("UPDATE $wpdb->links SET link_name = '$link_name', link_description = '$link_description' WHERE link_id = '$link->link_id'");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// The "paged" option for what_to_show is no more.
|
// The "paged" option for what_to_show is no more.
|
||||||
if ($wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = 'what_to_show'") == 'paged') {
|
if ($wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = 'what_to_show'") == 'paged') {
|
||||||
$wpdb->query("UPDATE $wpdb->options SET option_value = 'posts' WHERE option_name = 'what_to_show'");
|
$wpdb->query("UPDATE $wpdb->options SET option_value = 'posts' WHERE option_name = 'what_to_show'");
|
||||||
}
|
}
|
||||||
|
|
||||||
$active_plugins = __get_option('active_plugins');
|
$active_plugins = __get_option('active_plugins');
|
||||||
|
|
||||||
// If plugins are not stored in an array, they're stored in the old
|
// If plugins are not stored in an array, they're stored in the old
|
||||||
// newline separated format. Convert to new format.
|
// newline separated format. Convert to new format.
|
||||||
if ( !is_array( $active_plugins ) ) {
|
if ( !is_array( $active_plugins ) ) {
|
||||||
$active_plugins = explode("\n", trim($active_plugins));
|
$active_plugins = explode("\n", trim($active_plugins));
|
||||||
update_option('active_plugins', $active_plugins);
|
update_option('active_plugins', $active_plugins);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Obsolete tables
|
// Obsolete tables
|
||||||
$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optionvalues');
|
$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optionvalues');
|
||||||
|
@ -548,21 +548,21 @@ function upgrade_210() {
|
||||||
|
|
||||||
// General
|
// General
|
||||||
function maybe_create_table($table_name, $create_ddl) {
|
function maybe_create_table($table_name, $create_ddl) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
|
foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
|
||||||
if ($table == $table_name) {
|
if ($table == $table_name) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//didn't find it try to create it.
|
//didn't find it try to create it.
|
||||||
$q = $wpdb->query($create_ddl);
|
$q = $wpdb->query($create_ddl);
|
||||||
// we cannot directly tell that whether this succeeded!
|
// we cannot directly tell that whether this succeeded!
|
||||||
foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
|
foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
|
||||||
if ($table == $table_name) {
|
if ($table == $table_name) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
function drop_index($table, $index) {
|
function drop_index($table, $index) {
|
||||||
|
@ -591,22 +591,22 @@ function add_clean_index($table, $index) {
|
||||||
** false on error
|
** false on error
|
||||||
*/
|
*/
|
||||||
function maybe_add_column($table_name, $column_name, $create_ddl) {
|
function maybe_add_column($table_name, $column_name, $create_ddl) {
|
||||||
global $wpdb, $debug;
|
global $wpdb, $debug;
|
||||||
foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) {
|
foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) {
|
||||||
if ($debug) echo("checking $column == $column_name<br />");
|
if ($debug) echo("checking $column == $column_name<br />");
|
||||||
if ($column == $column_name) {
|
if ($column == $column_name) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//didn't find it try to create it.
|
//didn't find it try to create it.
|
||||||
$q = $wpdb->query($create_ddl);
|
$q = $wpdb->query($create_ddl);
|
||||||
// we cannot directly tell that whether this succeeded!
|
// we cannot directly tell that whether this succeeded!
|
||||||
foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) {
|
foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) {
|
||||||
if ($column == $column_name) {
|
if ($column == $column_name) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -646,20 +646,20 @@ function __get_option($setting) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function deslash($content) {
|
function deslash($content) {
|
||||||
// Note: \\\ inside a regex denotes a single backslash.
|
// Note: \\\ inside a regex denotes a single backslash.
|
||||||
|
|
||||||
// Replace one or more backslashes followed by a single quote with
|
// Replace one or more backslashes followed by a single quote with
|
||||||
// a single quote.
|
// a single quote.
|
||||||
$content = preg_replace("/\\\+'/", "'", $content);
|
$content = preg_replace("/\\\+'/", "'", $content);
|
||||||
|
|
||||||
// Replace one or more backslashes followed by a double quote with
|
// Replace one or more backslashes followed by a double quote with
|
||||||
// a double quote.
|
// a double quote.
|
||||||
$content = preg_replace('/\\\+"/', '"', $content);
|
$content = preg_replace('/\\\+"/', '"', $content);
|
||||||
|
|
||||||
// Replace one or more backslashes with one backslash.
|
// Replace one or more backslashes with one backslash.
|
||||||
$content = preg_replace("/\\\+/", "\\", $content);
|
$content = preg_replace("/\\\+/", "\\", $content);
|
||||||
|
|
||||||
return $content;
|
return $content;
|
||||||
}
|
}
|
||||||
|
|
||||||
function dbDelta($queries, $execute = true) {
|
function dbDelta($queries, $execute = true) {
|
||||||
|
|
|
@ -186,13 +186,13 @@ if ( $show_password_fields ) :
|
||||||
<?php do_action('edit_user_profile'); ?>
|
<?php do_action('edit_user_profile'); ?>
|
||||||
|
|
||||||
<br clear="all" />
|
<br clear="all" />
|
||||||
<table width="99%" border="0" cellspacing="2" cellpadding="3" class="editform">
|
<table width="99%" border="0" cellspacing="2" cellpadding="3" class="editform">
|
||||||
<?php
|
<?php
|
||||||
if(count($profileuser->caps) > count($profileuser->roles)):
|
if(count($profileuser->caps) > count($profileuser->roles)):
|
||||||
?>
|
?>
|
||||||
<tr>
|
<tr>
|
||||||
<th scope="row"><?php _e('Additional Capabilities:') ?></th>
|
<th scope="row"><?php _e('Additional Capabilities:') ?></th>
|
||||||
<td><?php
|
<td><?php
|
||||||
$output = '';
|
$output = '';
|
||||||
foreach($profileuser->caps as $cap => $value) {
|
foreach($profileuser->caps as $cap => $value) {
|
||||||
if(!$wp_roles->is_role($cap)) {
|
if(!$wp_roles->is_role($cap)) {
|
||||||
|
@ -202,15 +202,15 @@ if ( $show_password_fields ) :
|
||||||
}
|
}
|
||||||
echo $output;
|
echo $output;
|
||||||
?></td>
|
?></td>
|
||||||
</tr>
|
</tr>
|
||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
</table>
|
</table>
|
||||||
<p class="submit">
|
<p class="submit">
|
||||||
<input type="hidden" name="action" value="update" />
|
<input type="hidden" name="action" value="update" />
|
||||||
<input type="hidden" name="user_id" id="user_id" value="<?php echo $user_id; ?>" />
|
<input type="hidden" name="user_id" id="user_id" value="<?php echo $user_id; ?>" />
|
||||||
<input type="submit" value="<?php _e('Update User »') ?>" name="submit" />
|
<input type="submit" value="<?php _e('Update User »') ?>" name="submit" />
|
||||||
</p>
|
</p>
|
||||||
</form>
|
</form>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -954,8 +954,8 @@ input.delete:hover {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* A handy div class for hiding controls.
|
/* A handy div class for hiding controls.
|
||||||
Some browsers will disable them when you
|
Some browsers will disable them when you
|
||||||
set display:none; */
|
set display:none; */
|
||||||
.zerosize {
|
.zerosize {
|
||||||
height: 0px;
|
height: 0px;
|
||||||
width: 0px;
|
width: 0px;
|
||||||
|
@ -995,9 +995,9 @@ input.delete:hover {
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************
|
/****************************************************************
|
||||||
avoid padding, margins or borders on dbx-box,
|
avoid padding, margins or borders on dbx-box,
|
||||||
to reduce visual discrepancies between it and the clone.
|
to reduce visual discrepancies between it and the clone.
|
||||||
overall, dbx-box is best left as visually unstyled as possible
|
overall, dbx-box is best left as visually unstyled as possible
|
||||||
*****************************************************************/
|
*****************************************************************/
|
||||||
.dbx-box {
|
.dbx-box {
|
||||||
margin:0;
|
margin:0;
|
||||||
|
|
|
@ -10,10 +10,10 @@ function GetElementsWithClassName(elementName, className) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function meChecked() {
|
function meChecked() {
|
||||||
var undefined;
|
var undefined;
|
||||||
var eMe = document.getElementById('me');
|
var eMe = document.getElementById('me');
|
||||||
if (eMe == undefined) return false;
|
if (eMe == undefined) return false;
|
||||||
else return eMe.checked;
|
else return eMe.checked;
|
||||||
}
|
}
|
||||||
|
|
||||||
function upit() {
|
function upit() {
|
||||||
|
|
12
wp-atom.php
12
wp-atom.php
|
@ -11,11 +11,11 @@ $more = 1;
|
||||||
?>
|
?>
|
||||||
<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
|
<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
|
||||||
<feed version="0.3"
|
<feed version="0.3"
|
||||||
xmlns="http://purl.org/atom/ns#"
|
xmlns="http://purl.org/atom/ns#"
|
||||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
xml:lang="<?php echo get_option('rss_language'); ?>"
|
xml:lang="<?php echo get_option('rss_language'); ?>"
|
||||||
<?php do_action('atom_ns'); ?>
|
<?php do_action('atom_ns'); ?>
|
||||||
>
|
>
|
||||||
<title><?php bloginfo_rss('name') ?></title>
|
<title><?php bloginfo_rss('name') ?></title>
|
||||||
<link rel="alternate" type="text/html" href="<?php bloginfo_rss('home') ?>" />
|
<link rel="alternate" type="text/html" href="<?php bloginfo_rss('home') ?>" />
|
||||||
<tagline><?php bloginfo_rss("description") ?></tagline>
|
<tagline><?php bloginfo_rss("description") ?></tagline>
|
||||||
|
@ -25,7 +25,7 @@ $more = 1;
|
||||||
<?php do_action('atom_head'); ?>
|
<?php do_action('atom_head'); ?>
|
||||||
<?php while (have_posts()) : the_post(); ?>
|
<?php while (have_posts()) : the_post(); ?>
|
||||||
<entry>
|
<entry>
|
||||||
<author>
|
<author>
|
||||||
<name><?php the_author() ?></name>
|
<name><?php the_author() ?></name>
|
||||||
</author>
|
</author>
|
||||||
<title type="text/html" mode="escaped"><![CDATA[<?php the_title_rss() ?>]]></title>
|
<title type="text/html" mode="escaped"><![CDATA[<?php the_title_rss() ?>]]></title>
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
<link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" />
|
<link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_url'); ?>" />
|
||||||
|
|
||||||
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
|
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" />
|
||||||
<?php wp_get_archives('type=monthly&format=link'); ?>
|
<?php wp_get_archives('type=monthly&format=link'); ?>
|
||||||
<?php //comments_popup_script(); // off by default ?>
|
<?php //comments_popup_script(); // off by default ?>
|
||||||
<?php wp_head(); ?>
|
<?php wp_head(); ?>
|
||||||
</head>
|
</head>
|
||||||
|
|
|
@ -15,8 +15,8 @@ get_header();
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="feedback">
|
<div class="feedback">
|
||||||
<?php wp_link_pages(); ?>
|
<?php wp_link_pages(); ?>
|
||||||
<?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)')); ?>
|
<?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)')); ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -16,12 +16,12 @@
|
||||||
</form>
|
</form>
|
||||||
</li>
|
</li>
|
||||||
<li id="archives"><?php _e('Archives:'); ?>
|
<li id="archives"><?php _e('Archives:'); ?>
|
||||||
<ul>
|
<ul>
|
||||||
<?php wp_get_archives('type=monthly'); ?>
|
<?php wp_get_archives('type=monthly'); ?>
|
||||||
</ul>
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li id="meta"><?php _e('Meta:'); ?>
|
<li id="meta"><?php _e('Meta:'); ?>
|
||||||
<ul>
|
<ul>
|
||||||
<?php wp_register(); ?>
|
<?php wp_register(); ?>
|
||||||
<li><?php wp_loginout(); ?></li>
|
<li><?php wp_loginout(); ?></li>
|
||||||
<li><a href="feed:<?php bloginfo('rss2_url'); ?>" title="<?php _e('Syndicate this site using RSS'); ?>"><?php _e('<abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>
|
<li><a href="feed:<?php bloginfo('rss2_url'); ?>" title="<?php _e('Syndicate this site using RSS'); ?>"><?php _e('<abbr title="Really Simple Syndication">RSS</abbr>'); ?></a></li>
|
||||||
|
|
|
@ -11,14 +11,14 @@ Template Name: Archives
|
||||||
<?php include (TEMPLATEPATH . '/searchform.php'); ?>
|
<?php include (TEMPLATEPATH . '/searchform.php'); ?>
|
||||||
|
|
||||||
<h2>Archives by Month:</h2>
|
<h2>Archives by Month:</h2>
|
||||||
<ul>
|
<ul>
|
||||||
<?php wp_get_archives('type=monthly'); ?>
|
<?php wp_get_archives('type=monthly'); ?>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<h2>Archives by Subject:</h2>
|
<h2>Archives by Subject:</h2>
|
||||||
<ul>
|
<ul>
|
||||||
<?php wp_list_categories(); ?>
|
<?php wp_list_categories(); ?>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -2,19 +2,19 @@
|
||||||
if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
|
if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
|
||||||
die ('Please do not load this page directly. Thanks!');
|
die ('Please do not load this page directly. Thanks!');
|
||||||
|
|
||||||
if (!empty($post->post_password)) { // if there's a password
|
if (!empty($post->post_password)) { // if there's a password
|
||||||
if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie
|
if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<p class="nocomments">This post is password protected. Enter the password to view comments.<p>
|
<p class="nocomments">This post is password protected. Enter the password to view comments.<p>
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* This variable is for alternating comment background */
|
/* This variable is for alternating comment background */
|
||||||
$oddcomment = 'alt';
|
$oddcomment = 'alt';
|
||||||
?>
|
?>
|
||||||
|
|
||||||
<!-- You can start editing here. -->
|
<!-- You can start editing here. -->
|
||||||
|
@ -50,7 +50,7 @@
|
||||||
|
|
||||||
<?php else : // this is displayed if there are no comments so far ?>
|
<?php else : // this is displayed if there are no comments so far ?>
|
||||||
|
|
||||||
<?php if ('open' == $post->comment_status) : ?>
|
<?php if ('open' == $post->comment_status) : ?>
|
||||||
<!-- If comments are open, but there are no comments. -->
|
<!-- If comments are open, but there are no comments. -->
|
||||||
|
|
||||||
<?php else : // comments are closed ?>
|
<?php else : // comments are closed ?>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<div id="content" class="narrowcolumn">
|
<div id="content" class="narrowcolumn">
|
||||||
|
|
||||||
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
|
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
|
||||||
<div class="post" id="post-<?php the_ID(); ?>">
|
<div class="post" id="post-<?php the_ID(); ?>">
|
||||||
<h2><?php the_title(); ?></h2>
|
<h2><?php the_title(); ?></h2>
|
||||||
<div class="entry">
|
<div class="entry">
|
||||||
|
@ -12,7 +12,7 @@
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<?php endwhile; endif; ?>
|
<?php endwhile; endif; ?>
|
||||||
<?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
|
<?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -24,11 +24,11 @@
|
||||||
<p>You are currently browsing the <a href="<?php bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives
|
<p>You are currently browsing the <a href="<?php bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives
|
||||||
for <?php the_time('F, Y'); ?>.</p>
|
for <?php the_time('F, Y'); ?>.</p>
|
||||||
|
|
||||||
<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
|
<?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
|
||||||
<p>You are currently browsing the <a href="<?php bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives
|
<p>You are currently browsing the <a href="<?php bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives
|
||||||
for the year <?php the_time('Y'); ?>.</p>
|
for the year <?php the_time('Y'); ?>.</p>
|
||||||
|
|
||||||
<?php /* If this is a monthly archive */ } elseif (is_search()) { ?>
|
<?php /* If this is a monthly archive */ } elseif (is_search()) { ?>
|
||||||
<p>You have searched the <a href="<?php echo bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives
|
<p>You have searched the <a href="<?php echo bloginfo('home'); ?>/"><?php echo bloginfo('name'); ?></a> weblog archives
|
||||||
for <strong>'<?php the_search_query(); ?>'</strong>. If you are unable to find anything in these search results, you can try one of these links.</p>
|
for <strong>'<?php the_search_query(); ?>'</strong>. If you are unable to find anything in these search results, you can try one of these links.</p>
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<div id="content" class="widecolumn">
|
<div id="content" class="widecolumn">
|
||||||
|
|
||||||
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
|
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
|
||||||
|
|
||||||
<div class="navigation">
|
<div class="navigation">
|
||||||
<div class="alignleft"><?php previous_post_link('« %link') ?></div>
|
<div class="alignleft"><?php previous_post_link('« %link') ?></div>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (empty($doing_rss)) {
|
if (empty($doing_rss)) {
|
||||||
$doing_rss = 1;
|
$doing_rss = 1;
|
||||||
require(dirname(__FILE__) . '/wp-blog-header.php');
|
require(dirname(__FILE__) . '/wp-blog-header.php');
|
||||||
}
|
}
|
||||||
|
|
||||||
do_feed();
|
do_feed();
|
||||||
|
|
|
@ -146,7 +146,7 @@ function get_links($category = -1,
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_linkrating($link) {
|
function get_linkrating($link) {
|
||||||
return apply_filters('link_rating', $link->link_rating);
|
return apply_filters('link_rating', $link->link_rating);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** function get_linkcatname()
|
/** function get_linkcatname()
|
||||||
|
|
|
@ -221,18 +221,18 @@ class WP_User {
|
||||||
}
|
}
|
||||||
|
|
||||||
function level_reduction($max, $item) {
|
function level_reduction($max, $item) {
|
||||||
if(preg_match('/^level_(10|[0-9])$/i', $item, $matches)) {
|
if(preg_match('/^level_(10|[0-9])$/i', $item, $matches)) {
|
||||||
$level = intval($matches[1]);
|
$level = intval($matches[1]);
|
||||||
return max($max, $level);
|
return max($max, $level);
|
||||||
} else {
|
} else {
|
||||||
return $max;
|
return $max;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function update_user_level_from_caps() {
|
function update_user_level_from_caps() {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
$this->user_level = array_reduce(array_keys($this->allcaps), array(&$this, 'level_reduction'), 0);
|
$this->user_level = array_reduce(array_keys($this->allcaps), array(&$this, 'level_reduction'), 0);
|
||||||
update_usermeta($this->id, $wpdb->prefix.'user_level', $this->user_level);
|
update_usermeta($this->id, $wpdb->prefix.'user_level', $this->user_level);
|
||||||
}
|
}
|
||||||
|
|
||||||
function add_cap($cap, $grant = true) {
|
function add_cap($cap, $grant = true) {
|
||||||
|
|
|
@ -530,17 +530,17 @@ class Walker_PageDropdown extends Walker {
|
||||||
var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID'); //TODO: decouple this
|
var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID'); //TODO: decouple this
|
||||||
|
|
||||||
function start_el($output, $page, $depth, $args) {
|
function start_el($output, $page, $depth, $args) {
|
||||||
$pad = str_repeat(' ', $depth * 3);
|
$pad = str_repeat(' ', $depth * 3);
|
||||||
|
|
||||||
$output .= "\t<option value=\"$page->ID\"";
|
$output .= "\t<option value=\"$page->ID\"";
|
||||||
if ( $page->ID == $args['selected'] )
|
if ( $page->ID == $args['selected'] )
|
||||||
$output .= ' selected="selected"';
|
$output .= ' selected="selected"';
|
||||||
$output .= '>';
|
$output .= '>';
|
||||||
$title = wp_specialchars($page->post_title);
|
$title = wp_specialchars($page->post_title);
|
||||||
$output .= "$pad$title";
|
$output .= "$pad$title";
|
||||||
$output .= "</option>\n";
|
$output .= "</option>\n";
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -142,7 +142,7 @@ function get_comments_link() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function comments_link( $file = '', $echo = true ) {
|
function comments_link( $file = '', $echo = true ) {
|
||||||
echo get_comments_link();
|
echo get_comments_link();
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_comments_number( $post_id = 0 ) {
|
function get_comments_number( $post_id = 0 ) {
|
||||||
|
@ -241,8 +241,8 @@ function trackback_rdf($timezone = 0) {
|
||||||
global $id;
|
global $id;
|
||||||
if (!stristr($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator')) {
|
if (!stristr($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator')) {
|
||||||
echo '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
echo '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||||
xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
|
xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
|
||||||
<rdf:Description rdf:about="';
|
<rdf:Description rdf:about="';
|
||||||
the_permalink();
|
the_permalink();
|
||||||
echo '"'."\n";
|
echo '"'."\n";
|
||||||
|
@ -299,7 +299,7 @@ function comments_template( $file = '/comments.php' ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function comments_popup_script($width=400, $height=400, $file='') {
|
function comments_popup_script($width=400, $height=400, $file='') {
|
||||||
global $wpcommentspopupfile, $wptrackbackpopupfile, $wppingbackpopupfile, $wpcommentsjavascript;
|
global $wpcommentspopupfile, $wptrackbackpopupfile, $wppingbackpopupfile, $wpcommentsjavascript;
|
||||||
|
|
||||||
if (empty ($file)) {
|
if (empty ($file)) {
|
||||||
$wpcommentspopupfile = ''; // Use the index.
|
$wpcommentspopupfile = ''; // Use the index.
|
||||||
|
@ -307,9 +307,9 @@ function comments_popup_script($width=400, $height=400, $file='') {
|
||||||
$wpcommentspopupfile = $file;
|
$wpcommentspopupfile = $file;
|
||||||
}
|
}
|
||||||
|
|
||||||
$wpcommentsjavascript = 1;
|
$wpcommentsjavascript = 1;
|
||||||
$javascript = "<script type='text/javascript'>\nfunction wpopen (macagna) {\n window.open(macagna, '_blank', 'width=$width,height=$height,scrollbars=yes,status=yes');\n}\n</script>\n";
|
$javascript = "<script type='text/javascript'>\nfunction wpopen (macagna) {\n window.open(macagna, '_blank', 'width=$width,height=$height,scrollbars=yes,status=yes');\n}\n</script>\n";
|
||||||
echo $javascript;
|
echo $javascript;
|
||||||
}
|
}
|
||||||
|
|
||||||
function comments_popup_link($zero='No Comments', $one='1 Comment', $more='% Comments', $CSSclass='', $none='Comments Off') {
|
function comments_popup_link($zero='No Comments', $one='1 Comment', $more='% Comments', $CSSclass='', $none='Comments Off') {
|
||||||
|
|
|
@ -103,9 +103,9 @@ function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = fals
|
||||||
if ($no_cache) {
|
if ($no_cache) {
|
||||||
$query = "SELECT * FROM $wpdb->comments WHERE comment_ID = '$comment_ID'";
|
$query = "SELECT * FROM $wpdb->comments WHERE comment_ID = '$comment_ID'";
|
||||||
if (false == $include_unapproved) {
|
if (false == $include_unapproved) {
|
||||||
$query .= " AND comment_approved = '1'";
|
$query .= " AND comment_approved = '1'";
|
||||||
}
|
}
|
||||||
$myrow = $wpdb->get_row($query, ARRAY_A);
|
$myrow = $wpdb->get_row($query, ARRAY_A);
|
||||||
} else {
|
} else {
|
||||||
$myrow['comment_ID'] = $postc->comment_ID;
|
$myrow['comment_ID'] = $postc->comment_ID;
|
||||||
$myrow['comment_post_ID'] = $postc->comment_post_ID;
|
$myrow['comment_post_ID'] = $postc->comment_post_ID;
|
||||||
|
@ -397,26 +397,26 @@ function wp_new_comment( $commentdata ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function wp_set_comment_status($comment_id, $comment_status) {
|
function wp_set_comment_status($comment_id, $comment_status) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
switch($comment_status) {
|
switch($comment_status) {
|
||||||
case 'hold':
|
case 'hold':
|
||||||
$query = "UPDATE $wpdb->comments SET comment_approved='0' WHERE comment_ID='$comment_id' LIMIT 1";
|
$query = "UPDATE $wpdb->comments SET comment_approved='0' WHERE comment_ID='$comment_id' LIMIT 1";
|
||||||
break;
|
break;
|
||||||
case 'approve':
|
case 'approve':
|
||||||
$query = "UPDATE $wpdb->comments SET comment_approved='1' WHERE comment_ID='$comment_id' LIMIT 1";
|
$query = "UPDATE $wpdb->comments SET comment_approved='1' WHERE comment_ID='$comment_id' LIMIT 1";
|
||||||
break;
|
break;
|
||||||
case 'spam':
|
case 'spam':
|
||||||
$query = "UPDATE $wpdb->comments SET comment_approved='spam' WHERE comment_ID='$comment_id' LIMIT 1";
|
$query = "UPDATE $wpdb->comments SET comment_approved='spam' WHERE comment_ID='$comment_id' LIMIT 1";
|
||||||
break;
|
break;
|
||||||
case 'delete':
|
case 'delete':
|
||||||
return wp_delete_comment($comment_id);
|
return wp_delete_comment($comment_id);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($wpdb->query($query)) {
|
if ($wpdb->query($query)) {
|
||||||
do_action('wp_set_comment_status', $comment_id, $comment_status);
|
do_action('wp_set_comment_status', $comment_id, $comment_status);
|
||||||
|
|
||||||
$comment = get_comment($comment_id);
|
$comment = get_comment($comment_id);
|
||||||
|
@ -425,9 +425,9 @@ function wp_set_comment_status($comment_id, $comment_status) {
|
||||||
if( is_object( $c ) )
|
if( is_object( $c ) )
|
||||||
$wpdb->query( "UPDATE $wpdb->posts SET comment_count = '$c->c' WHERE ID = '$comment_post_ID'" );
|
$wpdb->query( "UPDATE $wpdb->posts SET comment_count = '$c->c' WHERE ID = '$comment_post_ID'" );
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function wp_update_comment($commentarr) {
|
function wp_update_comment($commentarr) {
|
||||||
|
|
|
@ -42,7 +42,7 @@ function printr($var, $do_not_echo = false) {
|
||||||
$code = htmlentities(ob_get_contents());
|
$code = htmlentities(ob_get_contents());
|
||||||
ob_clean();
|
ob_clean();
|
||||||
if (!$do_not_echo) {
|
if (!$do_not_echo) {
|
||||||
echo "<pre>$code</pre>";
|
echo "<pre>$code</pre>";
|
||||||
}
|
}
|
||||||
ob_end_clean();
|
ob_end_clean();
|
||||||
return $code;
|
return $code;
|
||||||
|
@ -57,11 +57,11 @@ if ( !function_exists('file_get_contents') ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!defined('CASE_LOWER')) {
|
if (!defined('CASE_LOWER')) {
|
||||||
define('CASE_LOWER', 0);
|
define('CASE_LOWER', 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!defined('CASE_UPPER')) {
|
if (!defined('CASE_UPPER')) {
|
||||||
define('CASE_UPPER', 1);
|
define('CASE_UPPER', 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -78,38 +78,38 @@ if (!defined('CASE_UPPER')) {
|
||||||
* @require PHP 4.0.0 (user_error)
|
* @require PHP 4.0.0 (user_error)
|
||||||
*/
|
*/
|
||||||
if (!function_exists('array_change_key_case')) {
|
if (!function_exists('array_change_key_case')) {
|
||||||
function array_change_key_case($input, $case = CASE_LOWER)
|
function array_change_key_case($input, $case = CASE_LOWER)
|
||||||
{
|
{
|
||||||
if (!is_array($input)) {
|
if (!is_array($input)) {
|
||||||
user_error('array_change_key_case(): The argument should be an array',
|
user_error('array_change_key_case(): The argument should be an array',
|
||||||
E_USER_WARNING);
|
E_USER_WARNING);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$output = array ();
|
$output = array ();
|
||||||
$keys = array_keys($input);
|
$keys = array_keys($input);
|
||||||
$casefunc = ($case == CASE_LOWER) ? 'strtolower' : 'strtoupper';
|
$casefunc = ($case == CASE_LOWER) ? 'strtolower' : 'strtoupper';
|
||||||
|
|
||||||
foreach ($keys as $key) {
|
foreach ($keys as $key) {
|
||||||
$output[$casefunc($key)] = $input[$key];
|
$output[$casefunc($key)] = $input[$key];
|
||||||
}
|
}
|
||||||
|
|
||||||
return $output;
|
return $output;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// From php.net
|
// From php.net
|
||||||
if(!function_exists('http_build_query')) {
|
if(!function_exists('http_build_query')) {
|
||||||
function http_build_query( $formdata, $numeric_prefix = null, $key = null ) {
|
function http_build_query( $formdata, $numeric_prefix = null, $key = null ) {
|
||||||
$res = array();
|
$res = array();
|
||||||
foreach ((array)$formdata as $k=>$v) {
|
foreach ((array)$formdata as $k=>$v) {
|
||||||
$tmp_key = urlencode(is_int($k) ? $numeric_prefix.$k : $k);
|
$tmp_key = urlencode(is_int($k) ? $numeric_prefix.$k : $k);
|
||||||
if ($key) $tmp_key = $key.'['.$tmp_key.']';
|
if ($key) $tmp_key = $key.'['.$tmp_key.']';
|
||||||
$res[] = ( ( is_array($v) || is_object($v) ) ? http_build_query($v, null, $tmp_key) : $tmp_key."=".urlencode($v) );
|
$res[] = ( ( is_array($v) || is_object($v) ) ? http_build_query($v, null, $tmp_key) : $tmp_key."=".urlencode($v) );
|
||||||
}
|
}
|
||||||
$separator = ini_get('arg_separator.output');
|
$separator = ini_get('arg_separator.output');
|
||||||
return implode($separator, $res);
|
return implode($separator, $res);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !function_exists('_') ) {
|
if ( !function_exists('_') ) {
|
||||||
|
|
|
@ -129,8 +129,8 @@ function user_can_edit_post($user_id, $post_id, $blog_id = 1) {
|
||||||
$post_author_data = get_userdata($post->post_author);
|
$post_author_data = get_userdata($post->post_author);
|
||||||
|
|
||||||
if ( (($user_id == $post_author_data->ID) && !($post->post_status == 'publish' && $author_data->user_level < 2))
|
if ( (($user_id == $post_author_data->ID) && !($post->post_status == 'publish' && $author_data->user_level < 2))
|
||||||
|| ($author_data->user_level > $post_author_data->user_level)
|
|| ($author_data->user_level > $post_author_data->user_level)
|
||||||
|| ($author_data->user_level >= 10) ) {
|
|| ($author_data->user_level >= 10) ) {
|
||||||
return true;
|
return true;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
@ -199,19 +199,19 @@ function user_can_edit_user($user_id, $other_user) {
|
||||||
** show_updated (default 0) - whether to show last updated timestamp
|
** show_updated (default 0) - whether to show last updated timestamp
|
||||||
*/
|
*/
|
||||||
function get_linksbyname($cat_name = "noname", $before = '', $after = '<br />',
|
function get_linksbyname($cat_name = "noname", $before = '', $after = '<br />',
|
||||||
$between = " ", $show_images = true, $orderby = 'id',
|
$between = " ", $show_images = true, $orderby = 'id',
|
||||||
$show_description = true, $show_rating = false,
|
$show_description = true, $show_rating = false,
|
||||||
$limit = -1, $show_updated = 0) {
|
$limit = -1, $show_updated = 0) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
$cat_id = -1;
|
$cat_id = -1;
|
||||||
$results = $wpdb->get_results("SELECT cat_ID FROM $wpdb->categories WHERE cat_name='$cat_name'");
|
$results = $wpdb->get_results("SELECT cat_ID FROM $wpdb->categories WHERE cat_name='$cat_name'");
|
||||||
if ($results) {
|
if ($results) {
|
||||||
foreach ($results as $result) {
|
foreach ($results as $result) {
|
||||||
$cat_id = $result->cat_ID;
|
$cat_id = $result->cat_ID;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
get_links($cat_id, $before, $after, $between, $show_images, $orderby,
|
get_links($cat_id, $before, $after, $between, $show_images, $orderby,
|
||||||
$show_description, $show_rating, $limit, $show_updated);
|
$show_description, $show_rating, $limit, $show_updated);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** function wp_get_linksbyname()
|
/** function wp_get_linksbyname()
|
||||||
|
@ -252,16 +252,16 @@ function wp_get_linksbyname($category, $args = '') {
|
||||||
**/
|
**/
|
||||||
// Deprecate in favor of get_linkz().
|
// Deprecate in favor of get_linkz().
|
||||||
function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit = -1) {
|
function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit = -1) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
$cat_id = -1;
|
$cat_id = -1;
|
||||||
//$results = $wpdb->get_results("SELECT cat_id FROM $wpdb->linkcategories WHERE cat_name='$cat_name'");
|
//$results = $wpdb->get_results("SELECT cat_id FROM $wpdb->linkcategories WHERE cat_name='$cat_name'");
|
||||||
// TODO: Fix me.
|
// TODO: Fix me.
|
||||||
if ($results) {
|
if ($results) {
|
||||||
foreach ($results as $result) {
|
foreach ($results as $result) {
|
||||||
$cat_id = $result->cat_id;
|
$cat_id = $result->cat_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return get_linkobjects($cat_id, $orderby, $limit);
|
return get_linkobjects($cat_id, $orderby, $limit);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** function get_linkobjects()
|
/** function get_linkobjects()
|
||||||
|
@ -301,40 +301,40 @@ function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit
|
||||||
**/
|
**/
|
||||||
// Deprecate in favor of get_linkz().
|
// Deprecate in favor of get_linkz().
|
||||||
function get_linkobjects($category = -1, $orderby = 'name', $limit = -1) {
|
function get_linkobjects($category = -1, $orderby = 'name', $limit = -1) {
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
$sql = "SELECT * FROM $wpdb->links WHERE link_visible = 'Y'";
|
$sql = "SELECT * FROM $wpdb->links WHERE link_visible = 'Y'";
|
||||||
if ($category != -1) {
|
if ($category != -1) {
|
||||||
$sql .= " AND link_category = $category ";
|
$sql .= " AND link_category = $category ";
|
||||||
}
|
}
|
||||||
if ($orderby == '')
|
if ($orderby == '')
|
||||||
$orderby = 'id';
|
$orderby = 'id';
|
||||||
if (substr($orderby,0,1) == '_') {
|
if (substr($orderby,0,1) == '_') {
|
||||||
$direction = ' DESC';
|
$direction = ' DESC';
|
||||||
$orderby = substr($orderby,1);
|
$orderby = substr($orderby,1);
|
||||||
}
|
}
|
||||||
if (strcasecmp('rand',$orderby) == 0) {
|
if (strcasecmp('rand',$orderby) == 0) {
|
||||||
$orderby = 'rand()';
|
$orderby = 'rand()';
|
||||||
} else {
|
} else {
|
||||||
$orderby = " link_" . $orderby;
|
$orderby = " link_" . $orderby;
|
||||||
}
|
}
|
||||||
$sql .= ' ORDER BY ' . $orderby;
|
$sql .= ' ORDER BY ' . $orderby;
|
||||||
$sql .= $direction;
|
$sql .= $direction;
|
||||||
/* The next 2 lines implement LIMIT TO processing */
|
/* The next 2 lines implement LIMIT TO processing */
|
||||||
if ($limit != -1)
|
if ($limit != -1)
|
||||||
$sql .= " LIMIT $limit";
|
$sql .= " LIMIT $limit";
|
||||||
|
|
||||||
$results = $wpdb->get_results($sql);
|
$results = $wpdb->get_results($sql);
|
||||||
if ($results) {
|
if ($results) {
|
||||||
foreach ($results as $result) {
|
foreach ($results as $result) {
|
||||||
$result->link_url = $result->link_url;
|
$result->link_url = $result->link_url;
|
||||||
$result->link_name = $result->link_name;
|
$result->link_name = $result->link_name;
|
||||||
$result->link_description = $result->link_description;
|
$result->link_description = $result->link_description;
|
||||||
$result->link_notes = $result->link_notes;
|
$result->link_notes = $result->link_notes;
|
||||||
$newresults[] = $result;
|
$newresults[] = $result;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $newresults;
|
return $newresults;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** function get_linksbyname_withrating()
|
/** function get_linksbyname_withrating()
|
||||||
|
@ -359,12 +359,12 @@ function get_linkobjects($category = -1, $orderby = 'name', $limit = -1) {
|
||||||
** show_updated (default 0) - whether to show last updated timestamp
|
** show_updated (default 0) - whether to show last updated timestamp
|
||||||
*/
|
*/
|
||||||
function get_linksbyname_withrating($cat_name = "noname", $before = '',
|
function get_linksbyname_withrating($cat_name = "noname", $before = '',
|
||||||
$after = '<br />', $between = " ",
|
$after = '<br />', $between = " ",
|
||||||
$show_images = true, $orderby = 'id',
|
$show_images = true, $orderby = 'id',
|
||||||
$show_description = true, $limit = -1, $show_updated = 0) {
|
$show_description = true, $limit = -1, $show_updated = 0) {
|
||||||
|
|
||||||
get_linksbyname($cat_name, $before, $after, $between, $show_images,
|
get_linksbyname($cat_name, $before, $after, $between, $show_images,
|
||||||
$orderby, $show_description, true, $limit, $show_updated);
|
$orderby, $show_description, true, $limit, $show_updated);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** function get_links_withrating()
|
/** function get_links_withrating()
|
||||||
|
@ -389,12 +389,12 @@ function get_linksbyname_withrating($cat_name = "noname", $before = '',
|
||||||
** show_updated (default 0) - whether to show last updated timestamp
|
** show_updated (default 0) - whether to show last updated timestamp
|
||||||
*/
|
*/
|
||||||
function get_links_withrating($category = -1, $before = '', $after = '<br />',
|
function get_links_withrating($category = -1, $before = '', $after = '<br />',
|
||||||
$between = " ", $show_images = true,
|
$between = " ", $show_images = true,
|
||||||
$orderby = 'id', $show_description = true,
|
$orderby = 'id', $show_description = true,
|
||||||
$limit = -1, $show_updated = 0) {
|
$limit = -1, $show_updated = 0) {
|
||||||
|
|
||||||
get_links($category, $before, $after, $between, $show_images, $orderby,
|
get_links($category, $before, $after, $between, $show_images, $orderby,
|
||||||
$show_description, true, $limit, $show_updated);
|
$show_description, true, $limit, $show_updated);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** function get_get_autotoggle()
|
/** function get_get_autotoggle()
|
||||||
|
|
|
@ -126,35 +126,35 @@ function wp_specialchars( $text, $quotes = 0 ) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function utf8_uri_encode( $utf8_string ) {
|
function utf8_uri_encode( $utf8_string ) {
|
||||||
$unicode = '';
|
$unicode = '';
|
||||||
$values = array();
|
$values = array();
|
||||||
$num_octets = 1;
|
$num_octets = 1;
|
||||||
|
|
||||||
for ($i = 0; $i < strlen( $utf8_string ); $i++ ) {
|
for ($i = 0; $i < strlen( $utf8_string ); $i++ ) {
|
||||||
|
|
||||||
$value = ord( $utf8_string[ $i ] );
|
$value = ord( $utf8_string[ $i ] );
|
||||||
|
|
||||||
if ( $value < 128 ) {
|
if ( $value < 128 ) {
|
||||||
$unicode .= chr($value);
|
$unicode .= chr($value);
|
||||||
} else {
|
} else {
|
||||||
if ( count( $values ) == 0 ) $num_octets = ( $value < 224 ) ? 2 : 3;
|
if ( count( $values ) == 0 ) $num_octets = ( $value < 224 ) ? 2 : 3;
|
||||||
|
|
||||||
$values[] = $value;
|
$values[] = $value;
|
||||||
|
|
||||||
if ( count( $values ) == $num_octets ) {
|
if ( count( $values ) == $num_octets ) {
|
||||||
if ($num_octets == 3) {
|
if ($num_octets == 3) {
|
||||||
$unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]) . '%' . dechex($values[2]);
|
$unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]) . '%' . dechex($values[2]);
|
||||||
} else {
|
} else {
|
||||||
$unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]);
|
$unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$values = array();
|
$values = array();
|
||||||
$num_octets = 1;
|
$num_octets = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $unicode;
|
return $unicode;
|
||||||
}
|
}
|
||||||
|
|
||||||
function remove_accents($string) {
|
function remove_accents($string) {
|
||||||
|
@ -417,10 +417,10 @@ function funky_javascript_fix($text) {
|
||||||
@notes
|
@notes
|
||||||
@changelog
|
@changelog
|
||||||
--- Modified by Scott Reilly (coffee2code) 02 Aug 2004
|
--- Modified by Scott Reilly (coffee2code) 02 Aug 2004
|
||||||
1.2 ***TODO*** Make better - change loop condition to $text
|
1.2 ***TODO*** Make better - change loop condition to $text
|
||||||
1.1 Fixed handling of append/stack pop order of end text
|
1.1 Fixed handling of append/stack pop order of end text
|
||||||
Added Cleaning Hooks
|
Added Cleaning Hooks
|
||||||
1.0 First Version
|
1.0 First Version
|
||||||
*/
|
*/
|
||||||
function balanceTags($text, $is_comment = 0, $force = false) {
|
function balanceTags($text, $is_comment = 0, $force = false) {
|
||||||
|
|
||||||
|
@ -552,10 +552,10 @@ function backslashit($string) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function trailingslashit($string) {
|
function trailingslashit($string) {
|
||||||
if ( '/' != substr($string, -1)) {
|
if ( '/' != substr($string, -1)) {
|
||||||
$string .= '/';
|
$string .= '/';
|
||||||
}
|
}
|
||||||
return $string;
|
return $string;
|
||||||
}
|
}
|
||||||
|
|
||||||
function addslashes_gpc($gpc) {
|
function addslashes_gpc($gpc) {
|
||||||
|
@ -571,11 +571,11 @@ function addslashes_gpc($gpc) {
|
||||||
|
|
||||||
function stripslashes_deep($value)
|
function stripslashes_deep($value)
|
||||||
{
|
{
|
||||||
$value = is_array($value) ?
|
$value = is_array($value) ?
|
||||||
array_map('stripslashes_deep', $value) :
|
array_map('stripslashes_deep', $value) :
|
||||||
stripslashes($value);
|
stripslashes($value);
|
||||||
|
|
||||||
return $value;
|
return $value;
|
||||||
}
|
}
|
||||||
|
|
||||||
function antispambot($emailaddy, $mailto=0) {
|
function antispambot($emailaddy, $mailto=0) {
|
||||||
|
|
|
@ -462,7 +462,7 @@ function wp_get_http_headers( $url, $red = 1 ) {
|
||||||
@set_time_limit( 60 );
|
@set_time_limit( 60 );
|
||||||
|
|
||||||
if ( $red > 5 )
|
if ( $red > 5 )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
$parts = parse_url( $url );
|
$parts = parse_url( $url );
|
||||||
$file = $parts['path'] . ($parts['query'] ? '?'.$parts['query'] : '');
|
$file = $parts['path'] . ($parts['query'] ? '?'.$parts['query'] : '');
|
||||||
|
@ -491,9 +491,9 @@ function wp_get_http_headers( $url, $red = 1 ) {
|
||||||
preg_match('/.*([0-9]{3}).*/', $response, $return);
|
preg_match('/.*([0-9]{3}).*/', $response, $return);
|
||||||
$headers['response'] = $return[1]; // HTTP response code eg 204, 200, 404
|
$headers['response'] = $return[1]; // HTTP response code eg 204, 200, 404
|
||||||
|
|
||||||
$code = $headers['response'];
|
$code = $headers['response'];
|
||||||
if ( ('302' == $code || '301' == $code) && isset($headers['location']) )
|
if ( ('302' == $code || '301' == $code) && isset($headers['location']) )
|
||||||
return wp_get_http_headers( $headers['location'], ++$red );
|
return wp_get_http_headers( $headers['location'], ++$red );
|
||||||
|
|
||||||
return $headers;
|
return $headers;
|
||||||
}
|
}
|
||||||
|
@ -801,8 +801,8 @@ function get_num_queries() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function bool_from_yn($yn) {
|
function bool_from_yn($yn) {
|
||||||
if ($yn == 'Y') return 1;
|
if ($yn == 'Y') return 1;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function do_feed() {
|
function do_feed() {
|
||||||
|
@ -957,7 +957,7 @@ function wp_upload_dir() {
|
||||||
return array('error' => $message);
|
return array('error' => $message);
|
||||||
}
|
}
|
||||||
|
|
||||||
$uploads = array('path' => $dir, 'url' => $url, 'error' => false);
|
$uploads = array('path' => $dir, 'url' => $url, 'error' => false);
|
||||||
return apply_filters('upload_dir', $uploads);
|
return apply_filters('upload_dir', $uploads);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -378,11 +378,11 @@ function wp_notify_postauthor($comment_id, $comment_type='') {
|
||||||
$from = "From: \"$blogname\" <$wp_email>";
|
$from = "From: \"$blogname\" <$wp_email>";
|
||||||
if ( '' != $comment->comment_author_email )
|
if ( '' != $comment->comment_author_email )
|
||||||
$reply_to = "Reply-To: $comment->comment_author_email";
|
$reply_to = "Reply-To: $comment->comment_author_email";
|
||||||
} else {
|
} else {
|
||||||
$from = "From: \"$comment->comment_author\" <$wp_email>";
|
$from = "From: \"$comment->comment_author\" <$wp_email>";
|
||||||
if ( '' != $comment->comment_author_email )
|
if ( '' != $comment->comment_author_email )
|
||||||
$reply_to = "Reply-To: \"$comment->comment_author_email\" <$comment->comment_author_email>";
|
$reply_to = "Reply-To: \"$comment->comment_author_email\" <$comment->comment_author_email>";
|
||||||
}
|
}
|
||||||
|
|
||||||
$message_headers = "MIME-Version: 1.0\n"
|
$message_headers = "MIME-Version: 1.0\n"
|
||||||
. "$from\n"
|
. "$from\n"
|
||||||
|
|
|
@ -684,22 +684,22 @@ function wp_update_post($postarr = array()) {
|
||||||
$post = add_magic_quotes($post);
|
$post = add_magic_quotes($post);
|
||||||
|
|
||||||
// Passed post category list overwrites existing category list if not empty.
|
// Passed post category list overwrites existing category list if not empty.
|
||||||
if ( isset($postarr['post_category']) && is_array($postarr['post_category'])
|
if ( isset($postarr['post_category']) && is_array($postarr['post_category'])
|
||||||
&& 0 != count($postarr['post_category']) )
|
&& 0 != count($postarr['post_category']) )
|
||||||
$post_cats = $postarr['post_category'];
|
$post_cats = $postarr['post_category'];
|
||||||
else
|
else
|
||||||
$post_cats = $post['post_category'];
|
$post_cats = $post['post_category'];
|
||||||
|
|
||||||
// Drafts shouldn't be assigned a date unless explicitly done so by the user
|
// Drafts shouldn't be assigned a date unless explicitly done so by the user
|
||||||
if ( 'draft' == $post['post_status'] && empty($postarr['edit_date']) && empty($postarr['post_date']) &&
|
if ( 'draft' == $post['post_status'] && empty($postarr['edit_date']) && empty($postarr['post_date']) &&
|
||||||
('0000-00-00 00:00:00' == $post['post_date']) )
|
('0000-00-00 00:00:00' == $post['post_date']) )
|
||||||
$clear_date = true;
|
$clear_date = true;
|
||||||
else
|
else
|
||||||
$clear_date = false;
|
$clear_date = false;
|
||||||
|
|
||||||
// Merge old and new fields with new fields overwriting old ones.
|
// Merge old and new fields with new fields overwriting old ones.
|
||||||
$postarr = array_merge($post, $postarr);
|
$postarr = array_merge($post, $postarr);
|
||||||
$postarr['post_category'] = $post_cats;
|
$postarr['post_category'] = $post_cats;
|
||||||
if ( $clear_date ) {
|
if ( $clear_date ) {
|
||||||
$postarr['post_date'] = '';
|
$postarr['post_date'] = '';
|
||||||
$postarr['post_date_gmt'] = '';
|
$postarr['post_date_gmt'] = '';
|
||||||
|
@ -848,10 +848,10 @@ function trackback_url_list($tb_list, $post_id) {
|
||||||
|
|
||||||
$trackback_urls = explode(',', $tb_list);
|
$trackback_urls = explode(',', $tb_list);
|
||||||
foreach($trackback_urls as $tb_url) {
|
foreach($trackback_urls as $tb_url) {
|
||||||
$tb_url = trim($tb_url);
|
$tb_url = trim($tb_url);
|
||||||
trackback($tb_url, stripslashes($post_title), $excerpt, $post_id);
|
trackback($tb_url, stripslashes($post_title), $excerpt, $post_id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
|
|
@ -16,11 +16,11 @@ if ((empty ($link_cat)) || ($link_cat == 'all') || ($link_cat == '0')) {
|
||||||
?><?php echo '<?xml version="1.0"?'.">\n"; ?>
|
?><?php echo '<?xml version="1.0"?'.">\n"; ?>
|
||||||
<!-- generator="wordpress/<?php bloginfo_rss('version') ?>" -->
|
<!-- generator="wordpress/<?php bloginfo_rss('version') ?>" -->
|
||||||
<opml version="1.0">
|
<opml version="1.0">
|
||||||
<head>
|
<head>
|
||||||
<title>Links for <?php echo get_bloginfo('name').$cat_name ?></title>
|
<title>Links for <?php echo get_bloginfo('name').$cat_name ?></title>
|
||||||
<dateCreated><?php echo gmdate("D, d M Y H:i:s"); ?> GMT</dateCreated>
|
<dateCreated><?php echo gmdate("D, d M Y H:i:s"); ?> GMT</dateCreated>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
if (empty ($link_cat))
|
if (empty ($link_cat))
|
||||||
|
@ -36,7 +36,7 @@ foreach ((array) $cats as $cat) {
|
||||||
$bookmarks = get_bookmarks("category={$cat->cat_ID}");
|
$bookmarks = get_bookmarks("category={$cat->cat_ID}");
|
||||||
foreach ((array) $bookmarks as $bookmark) {
|
foreach ((array) $bookmarks as $bookmark) {
|
||||||
?>
|
?>
|
||||||
<outline text="<?php echo wp_specialchars($bookmark->link_name); ?>" type="link" xmlUrl="<?php echo wp_specialchars($bookmark->link_rss); ?>" htmlUrl="<?php echo wp_specialchars($bookmark->link_url); ?>" updated="<?php if ('0000-00-00 00:00:00' != $bookmark->link_updated) echo $bookmark->link_updated; ?>" />
|
<outline text="<?php echo wp_specialchars($bookmark->link_name); ?>" type="link" xmlUrl="<?php echo wp_specialchars($bookmark->link_rss); ?>" htmlUrl="<?php echo wp_specialchars($bookmark->link_url); ?>" updated="<?php if ('0000-00-00 00:00:00' != $bookmark->link_updated) echo $bookmark->link_updated; ?>" />
|
||||||
<?php
|
<?php
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ if ( function_exists('mb_convert_encoding') ) { // For international trackbacks
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( is_single() || is_page() )
|
if ( is_single() || is_page() )
|
||||||
$tb_id = $posts[0]->ID;
|
$tb_id = $posts[0]->ID;
|
||||||
|
|
||||||
if ( !intval( $tb_id ) )
|
if ( !intval( $tb_id ) )
|
||||||
trackback_response(1, 'I really need an ID for this to work.');
|
trackback_response(1, 'I really need an ID for this to work.');
|
||||||
|
|
596
xmlrpc.php
596
xmlrpc.php
|
@ -66,48 +66,48 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||||
|
|
||||||
function wp_xmlrpc_server() {
|
function wp_xmlrpc_server() {
|
||||||
$this->methods = array(
|
$this->methods = array(
|
||||||
// Blogger API
|
// Blogger API
|
||||||
'blogger.getUsersBlogs' => 'this:blogger_getUsersBlogs',
|
'blogger.getUsersBlogs' => 'this:blogger_getUsersBlogs',
|
||||||
'blogger.getUserInfo' => 'this:blogger_getUserInfo',
|
'blogger.getUserInfo' => 'this:blogger_getUserInfo',
|
||||||
'blogger.getPost' => 'this:blogger_getPost',
|
'blogger.getPost' => 'this:blogger_getPost',
|
||||||
'blogger.getRecentPosts' => 'this:blogger_getRecentPosts',
|
'blogger.getRecentPosts' => 'this:blogger_getRecentPosts',
|
||||||
'blogger.getTemplate' => 'this:blogger_getTemplate',
|
'blogger.getTemplate' => 'this:blogger_getTemplate',
|
||||||
'blogger.setTemplate' => 'this:blogger_setTemplate',
|
'blogger.setTemplate' => 'this:blogger_setTemplate',
|
||||||
'blogger.newPost' => 'this:blogger_newPost',
|
'blogger.newPost' => 'this:blogger_newPost',
|
||||||
'blogger.editPost' => 'this:blogger_editPost',
|
'blogger.editPost' => 'this:blogger_editPost',
|
||||||
'blogger.deletePost' => 'this:blogger_deletePost',
|
'blogger.deletePost' => 'this:blogger_deletePost',
|
||||||
|
|
||||||
// MetaWeblog API (with MT extensions to structs)
|
// MetaWeblog API (with MT extensions to structs)
|
||||||
'metaWeblog.newPost' => 'this:mw_newPost',
|
'metaWeblog.newPost' => 'this:mw_newPost',
|
||||||
'metaWeblog.editPost' => 'this:mw_editPost',
|
'metaWeblog.editPost' => 'this:mw_editPost',
|
||||||
'metaWeblog.getPost' => 'this:mw_getPost',
|
'metaWeblog.getPost' => 'this:mw_getPost',
|
||||||
'metaWeblog.getRecentPosts' => 'this:mw_getRecentPosts',
|
'metaWeblog.getRecentPosts' => 'this:mw_getRecentPosts',
|
||||||
'metaWeblog.getCategories' => 'this:mw_getCategories',
|
'metaWeblog.getCategories' => 'this:mw_getCategories',
|
||||||
'metaWeblog.newMediaObject' => 'this:mw_newMediaObject',
|
'metaWeblog.newMediaObject' => 'this:mw_newMediaObject',
|
||||||
|
|
||||||
// MetaWeblog API aliases for Blogger API
|
// MetaWeblog API aliases for Blogger API
|
||||||
// see http://www.xmlrpc.com/stories/storyReader$2460
|
// see http://www.xmlrpc.com/stories/storyReader$2460
|
||||||
'metaWeblog.deletePost' => 'this:blogger_deletePost',
|
'metaWeblog.deletePost' => 'this:blogger_deletePost',
|
||||||
'metaWeblog.getTemplate' => 'this:blogger_getTemplate',
|
'metaWeblog.getTemplate' => 'this:blogger_getTemplate',
|
||||||
'metaWeblog.setTemplate' => 'this:blogger_setTemplate',
|
'metaWeblog.setTemplate' => 'this:blogger_setTemplate',
|
||||||
'metaWeblog.getUsersBlogs' => 'this:blogger_getUsersBlogs',
|
'metaWeblog.getUsersBlogs' => 'this:blogger_getUsersBlogs',
|
||||||
|
|
||||||
// MovableType API
|
// MovableType API
|
||||||
'mt.getCategoryList' => 'this:mt_getCategoryList',
|
'mt.getCategoryList' => 'this:mt_getCategoryList',
|
||||||
'mt.getRecentPostTitles' => 'this:mt_getRecentPostTitles',
|
'mt.getRecentPostTitles' => 'this:mt_getRecentPostTitles',
|
||||||
'mt.getPostCategories' => 'this:mt_getPostCategories',
|
'mt.getPostCategories' => 'this:mt_getPostCategories',
|
||||||
'mt.setPostCategories' => 'this:mt_setPostCategories',
|
'mt.setPostCategories' => 'this:mt_setPostCategories',
|
||||||
'mt.supportedMethods' => 'this:mt_supportedMethods',
|
'mt.supportedMethods' => 'this:mt_supportedMethods',
|
||||||
'mt.supportedTextFilters' => 'this:mt_supportedTextFilters',
|
'mt.supportedTextFilters' => 'this:mt_supportedTextFilters',
|
||||||
'mt.getTrackbackPings' => 'this:mt_getTrackbackPings',
|
'mt.getTrackbackPings' => 'this:mt_getTrackbackPings',
|
||||||
'mt.publishPost' => 'this:mt_publishPost',
|
'mt.publishPost' => 'this:mt_publishPost',
|
||||||
|
|
||||||
// PingBack
|
// PingBack
|
||||||
'pingback.ping' => 'this:pingback_ping',
|
'pingback.ping' => 'this:pingback_ping',
|
||||||
'pingback.extensions.getPingbacks' => 'this:pingback_extensions_getPingbacks',
|
'pingback.extensions.getPingbacks' => 'this:pingback_extensions_getPingbacks',
|
||||||
|
|
||||||
'demo.sayHello' => 'this:sayHello',
|
'demo.sayHello' => 'this:sayHello',
|
||||||
'demo.addTwoNumbers' => 'this:addTwoNumbers'
|
'demo.addTwoNumbers' => 'this:addTwoNumbers'
|
||||||
);
|
);
|
||||||
$this->methods = apply_filters('xmlrpc_methods', $this->methods);
|
$this->methods = apply_filters('xmlrpc_methods', $this->methods);
|
||||||
$this->IXR_Server($this->methods);
|
$this->IXR_Server($this->methods);
|
||||||
|
@ -124,11 +124,11 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||||
}
|
}
|
||||||
|
|
||||||
function login_pass_ok($user_login, $user_pass) {
|
function login_pass_ok($user_login, $user_pass) {
|
||||||
if (!user_pass_ok($user_login, $user_pass)) {
|
if (!user_pass_ok($user_login, $user_pass)) {
|
||||||
$this->error = new IXR_Error(403, 'Bad login/pass combination.');
|
$this->error = new IXR_Error(403, 'Bad login/pass combination.');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function escape(&$array) {
|
function escape(&$array) {
|
||||||
|
@ -181,25 +181,25 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||||
|
|
||||||
$this->escape($args);
|
$this->escape($args);
|
||||||
|
|
||||||
$user_login = $args[1];
|
$user_login = $args[1];
|
||||||
$user_pass = $args[2];
|
$user_pass = $args[2];
|
||||||
|
|
||||||
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
||||||
return $this->error;
|
return $this->error;
|
||||||
}
|
}
|
||||||
|
|
||||||
$user_data = get_userdatabylogin($user_login);
|
$user_data = get_userdatabylogin($user_login);
|
||||||
|
|
||||||
$struct = array(
|
$struct = array(
|
||||||
'nickname' => $user_data->nickname,
|
'nickname' => $user_data->nickname,
|
||||||
'userid' => $user_data->ID,
|
'userid' => $user_data->ID,
|
||||||
'url' => $user_data->user_url,
|
'url' => $user_data->user_url,
|
||||||
'email' => $user_data->user_email,
|
'email' => $user_data->user_email,
|
||||||
'lastname' => $user_data->last_name,
|
'lastname' => $user_data->last_name,
|
||||||
'firstname' => $user_data->first_name
|
'firstname' => $user_data->first_name
|
||||||
);
|
);
|
||||||
|
|
||||||
return $struct;
|
return $struct;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -208,81 +208,81 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||||
|
|
||||||
$this->escape($args);
|
$this->escape($args);
|
||||||
|
|
||||||
$post_ID = $args[1];
|
$post_ID = $args[1];
|
||||||
$user_login = $args[2];
|
$user_login = $args[2];
|
||||||
$user_pass = $args[3];
|
$user_pass = $args[3];
|
||||||
|
|
||||||
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
||||||
return $this->error;
|
return $this->error;
|
||||||
}
|
}
|
||||||
|
|
||||||
$user_data = get_userdatabylogin($user_login);
|
$user_data = get_userdatabylogin($user_login);
|
||||||
$post_data = wp_get_single_post($post_ID, ARRAY_A);
|
$post_data = wp_get_single_post($post_ID, ARRAY_A);
|
||||||
|
|
||||||
$categories = implode(',', wp_get_post_categories($post_ID));
|
$categories = implode(',', wp_get_post_categories($post_ID));
|
||||||
|
|
||||||
$content = '<title>'.stripslashes($post_data['post_title']).'</title>';
|
$content = '<title>'.stripslashes($post_data['post_title']).'</title>';
|
||||||
$content .= '<category>'.$categories.'</category>';
|
$content .= '<category>'.$categories.'</category>';
|
||||||
$content .= stripslashes($post_data['post_content']);
|
$content .= stripslashes($post_data['post_content']);
|
||||||
|
|
||||||
$struct = array(
|
$struct = array(
|
||||||
'userid' => $post_data['post_author'],
|
'userid' => $post_data['post_author'],
|
||||||
'dateCreated' => new IXR_Date(mysql2date('Ymd\TH:i:s', $post_data['post_date'])),
|
'dateCreated' => new IXR_Date(mysql2date('Ymd\TH:i:s', $post_data['post_date'])),
|
||||||
'content' => $content,
|
'content' => $content,
|
||||||
'postid' => $post_data['ID']
|
'postid' => $post_data['ID']
|
||||||
);
|
);
|
||||||
|
|
||||||
return $struct;
|
return $struct;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* blogger.getRecentPosts ...gets recent posts */
|
/* blogger.getRecentPosts ...gets recent posts */
|
||||||
function blogger_getRecentPosts($args) {
|
function blogger_getRecentPosts($args) {
|
||||||
|
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
$this->escape($args);
|
$this->escape($args);
|
||||||
|
|
||||||
$blog_ID = $args[1]; /* though we don't use it yet */
|
$blog_ID = $args[1]; /* though we don't use it yet */
|
||||||
$user_login = $args[2];
|
$user_login = $args[2];
|
||||||
$user_pass = $args[3];
|
$user_pass = $args[3];
|
||||||
$num_posts = $args[4];
|
$num_posts = $args[4];
|
||||||
|
|
||||||
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
||||||
return $this->error;
|
return $this->error;
|
||||||
}
|
}
|
||||||
|
|
||||||
$posts_list = wp_get_recent_posts($num_posts);
|
$posts_list = wp_get_recent_posts($num_posts);
|
||||||
|
|
||||||
if (!$posts_list) {
|
if (!$posts_list) {
|
||||||
$this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.');
|
$this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.');
|
||||||
return $this->error;
|
return $this->error;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($posts_list as $entry) {
|
foreach ($posts_list as $entry) {
|
||||||
|
|
||||||
$post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']);
|
$post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']);
|
||||||
$categories = implode(',', wp_get_post_categories($entry['ID']));
|
$categories = implode(',', wp_get_post_categories($entry['ID']));
|
||||||
|
|
||||||
$content = '<title>'.stripslashes($entry['post_title']).'</title>';
|
$content = '<title>'.stripslashes($entry['post_title']).'</title>';
|
||||||
$content .= '<category>'.$categories.'</category>';
|
$content .= '<category>'.$categories.'</category>';
|
||||||
$content .= stripslashes($entry['post_content']);
|
$content .= stripslashes($entry['post_content']);
|
||||||
|
|
||||||
$struct[] = array(
|
$struct[] = array(
|
||||||
'userid' => $entry['post_author'],
|
'userid' => $entry['post_author'],
|
||||||
'dateCreated' => new IXR_Date($post_date),
|
'dateCreated' => new IXR_Date($post_date),
|
||||||
'content' => $content,
|
'content' => $content,
|
||||||
'postid' => $entry['ID'],
|
'postid' => $entry['ID'],
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$recent_posts = array();
|
$recent_posts = array();
|
||||||
for ($j=0; $j<count($struct); $j++) {
|
for ($j=0; $j<count($struct); $j++) {
|
||||||
array_push($recent_posts, $struct[$j]);
|
array_push($recent_posts, $struct[$j]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $recent_posts;
|
return $recent_posts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -712,96 +712,96 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||||
|
|
||||||
$this->escape($args);
|
$this->escape($args);
|
||||||
|
|
||||||
$blog_ID = $args[0];
|
$blog_ID = $args[0];
|
||||||
$user_login = $args[1];
|
$user_login = $args[1];
|
||||||
$user_pass = $args[2];
|
$user_pass = $args[2];
|
||||||
$num_posts = $args[3];
|
$num_posts = $args[3];
|
||||||
|
|
||||||
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
||||||
return $this->error;
|
return $this->error;
|
||||||
}
|
}
|
||||||
|
|
||||||
$posts_list = wp_get_recent_posts($num_posts);
|
$posts_list = wp_get_recent_posts($num_posts);
|
||||||
|
|
||||||
if (!$posts_list) {
|
if (!$posts_list) {
|
||||||
$this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.');
|
$this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.');
|
||||||
return $this->error;
|
return $this->error;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($posts_list as $entry) {
|
foreach ($posts_list as $entry) {
|
||||||
|
|
||||||
$post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']);
|
$post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']);
|
||||||
$categories = array();
|
$categories = array();
|
||||||
$catids = wp_get_post_categories($entry['ID']);
|
$catids = wp_get_post_categories($entry['ID']);
|
||||||
foreach($catids as $catid) {
|
foreach($catids as $catid) {
|
||||||
$categories[] = get_cat_name($catid);
|
$categories[] = get_cat_name($catid);
|
||||||
}
|
}
|
||||||
|
|
||||||
$post = get_extended($entry['post_content']);
|
$post = get_extended($entry['post_content']);
|
||||||
$link = post_permalink($entry['ID']);
|
$link = post_permalink($entry['ID']);
|
||||||
|
|
||||||
$allow_comments = ('open' == $entry['comment_status']) ? 1 : 0;
|
$allow_comments = ('open' == $entry['comment_status']) ? 1 : 0;
|
||||||
$allow_pings = ('open' == $entry['ping_status']) ? 1 : 0;
|
$allow_pings = ('open' == $entry['ping_status']) ? 1 : 0;
|
||||||
|
|
||||||
$struct[] = array(
|
$struct[] = array(
|
||||||
'dateCreated' => new IXR_Date($post_date),
|
'dateCreated' => new IXR_Date($post_date),
|
||||||
'userid' => $entry['post_author'],
|
'userid' => $entry['post_author'],
|
||||||
'postid' => $entry['ID'],
|
'postid' => $entry['ID'],
|
||||||
'description' => $post['main'],
|
'description' => $post['main'],
|
||||||
'title' => $entry['post_title'],
|
'title' => $entry['post_title'],
|
||||||
'link' => $link,
|
'link' => $link,
|
||||||
'permaLink' => $link,
|
'permaLink' => $link,
|
||||||
// commented out because no other tool seems to use this
|
// commented out because no other tool seems to use this
|
||||||
// 'content' => $entry['post_content'],
|
// 'content' => $entry['post_content'],
|
||||||
'categories' => $categories,
|
'categories' => $categories,
|
||||||
'mt_excerpt' => $entry['post_excerpt'],
|
'mt_excerpt' => $entry['post_excerpt'],
|
||||||
'mt_text_more' => $post['extended'],
|
'mt_text_more' => $post['extended'],
|
||||||
'mt_allow_comments' => $allow_comments,
|
'mt_allow_comments' => $allow_comments,
|
||||||
'mt_allow_pings' => $allow_pings
|
'mt_allow_pings' => $allow_pings
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$recent_posts = array();
|
$recent_posts = array();
|
||||||
for ($j=0; $j<count($struct); $j++) {
|
for ($j=0; $j<count($struct); $j++) {
|
||||||
array_push($recent_posts, $struct[$j]);
|
array_push($recent_posts, $struct[$j]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $recent_posts;
|
return $recent_posts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* metaweblog.getCategories ...returns the list of categories on a given weblog */
|
/* metaweblog.getCategories ...returns the list of categories on a given weblog */
|
||||||
function mw_getCategories($args) {
|
function mw_getCategories($args) {
|
||||||
|
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
$this->escape($args);
|
$this->escape($args);
|
||||||
|
|
||||||
$blog_ID = $args[0];
|
$blog_ID = $args[0];
|
||||||
$user_login = $args[1];
|
$user_login = $args[1];
|
||||||
$user_pass = $args[2];
|
$user_pass = $args[2];
|
||||||
|
|
||||||
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
||||||
return $this->error;
|
return $this->error;
|
||||||
}
|
}
|
||||||
|
|
||||||
$categories_struct = array();
|
$categories_struct = array();
|
||||||
|
|
||||||
// FIXME: can we avoid using direct SQL there?
|
// FIXME: can we avoid using direct SQL there?
|
||||||
if ($cats = $wpdb->get_results("SELECT cat_ID,cat_name FROM $wpdb->categories", ARRAY_A)) {
|
if ($cats = $wpdb->get_results("SELECT cat_ID,cat_name FROM $wpdb->categories", ARRAY_A)) {
|
||||||
foreach ($cats as $cat) {
|
foreach ($cats as $cat) {
|
||||||
$struct['categoryId'] = $cat['cat_ID'];
|
$struct['categoryId'] = $cat['cat_ID'];
|
||||||
$struct['description'] = $cat['cat_name'];
|
$struct['description'] = $cat['cat_name'];
|
||||||
$struct['categoryName'] = $cat['cat_name'];
|
$struct['categoryName'] = $cat['cat_name'];
|
||||||
$struct['htmlUrl'] = wp_specialchars(get_category_link($cat['cat_ID']));
|
$struct['htmlUrl'] = wp_specialchars(get_category_link($cat['cat_ID']));
|
||||||
$struct['rssUrl'] = wp_specialchars(get_category_rss_link(false, $cat['cat_ID'], $cat['cat_name']));
|
$struct['rssUrl'] = wp_specialchars(get_category_rss_link(false, $cat['cat_ID'], $cat['cat_name']));
|
||||||
|
|
||||||
$categories_struct[] = $struct;
|
$categories_struct[] = $struct;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $categories_struct;
|
return $categories_struct;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -852,72 +852,72 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||||
|
|
||||||
$this->escape($args);
|
$this->escape($args);
|
||||||
|
|
||||||
$blog_ID = $args[0];
|
$blog_ID = $args[0];
|
||||||
$user_login = $args[1];
|
$user_login = $args[1];
|
||||||
$user_pass = $args[2];
|
$user_pass = $args[2];
|
||||||
$num_posts = $args[3];
|
$num_posts = $args[3];
|
||||||
|
|
||||||
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
||||||
return $this->error;
|
return $this->error;
|
||||||
}
|
}
|
||||||
|
|
||||||
$posts_list = wp_get_recent_posts($num_posts);
|
$posts_list = wp_get_recent_posts($num_posts);
|
||||||
|
|
||||||
if (!$posts_list) {
|
if (!$posts_list) {
|
||||||
$this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.');
|
$this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.');
|
||||||
return $this->error;
|
return $this->error;
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach ($posts_list as $entry) {
|
foreach ($posts_list as $entry) {
|
||||||
|
|
||||||
$post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']);
|
$post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']);
|
||||||
|
|
||||||
$struct[] = array(
|
$struct[] = array(
|
||||||
'dateCreated' => new IXR_Date($post_date),
|
'dateCreated' => new IXR_Date($post_date),
|
||||||
'userid' => $entry['post_author'],
|
'userid' => $entry['post_author'],
|
||||||
'postid' => $entry['ID'],
|
'postid' => $entry['ID'],
|
||||||
'title' => $entry['post_title'],
|
'title' => $entry['post_title'],
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$recent_posts = array();
|
$recent_posts = array();
|
||||||
for ($j=0; $j<count($struct); $j++) {
|
for ($j=0; $j<count($struct); $j++) {
|
||||||
array_push($recent_posts, $struct[$j]);
|
array_push($recent_posts, $struct[$j]);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $recent_posts;
|
return $recent_posts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* mt.getCategoryList ...returns the list of categories on a given weblog */
|
/* mt.getCategoryList ...returns the list of categories on a given weblog */
|
||||||
function mt_getCategoryList($args) {
|
function mt_getCategoryList($args) {
|
||||||
|
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
$this->escape($args);
|
$this->escape($args);
|
||||||
|
|
||||||
$blog_ID = $args[0];
|
$blog_ID = $args[0];
|
||||||
$user_login = $args[1];
|
$user_login = $args[1];
|
||||||
$user_pass = $args[2];
|
$user_pass = $args[2];
|
||||||
|
|
||||||
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
||||||
return $this->error;
|
return $this->error;
|
||||||
}
|
}
|
||||||
|
|
||||||
$categories_struct = array();
|
$categories_struct = array();
|
||||||
|
|
||||||
// FIXME: can we avoid using direct SQL there?
|
// FIXME: can we avoid using direct SQL there?
|
||||||
if ($cats = $wpdb->get_results("SELECT cat_ID, cat_name FROM $wpdb->categories", ARRAY_A)) {
|
if ($cats = $wpdb->get_results("SELECT cat_ID, cat_name FROM $wpdb->categories", ARRAY_A)) {
|
||||||
foreach ($cats as $cat) {
|
foreach ($cats as $cat) {
|
||||||
$struct['categoryId'] = $cat['cat_ID'];
|
$struct['categoryId'] = $cat['cat_ID'];
|
||||||
$struct['categoryName'] = $cat['cat_name'];
|
$struct['categoryName'] = $cat['cat_name'];
|
||||||
|
|
||||||
$categories_struct[] = $struct;
|
$categories_struct[] = $struct;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $categories_struct;
|
return $categories_struct;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -926,28 +926,28 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||||
|
|
||||||
$this->escape($args);
|
$this->escape($args);
|
||||||
|
|
||||||
$post_ID = $args[0];
|
$post_ID = $args[0];
|
||||||
$user_login = $args[1];
|
$user_login = $args[1];
|
||||||
$user_pass = $args[2];
|
$user_pass = $args[2];
|
||||||
|
|
||||||
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
||||||
return $this->error;
|
return $this->error;
|
||||||
}
|
}
|
||||||
|
|
||||||
$categories = array();
|
$categories = array();
|
||||||
$catids = wp_get_post_categories(intval($post_ID));
|
$catids = wp_get_post_categories(intval($post_ID));
|
||||||
// first listed category will be the primary category
|
// first listed category will be the primary category
|
||||||
$isPrimary = true;
|
$isPrimary = true;
|
||||||
foreach($catids as $catid) {
|
foreach($catids as $catid) {
|
||||||
$categories[] = array(
|
$categories[] = array(
|
||||||
'categoryName' => get_cat_name($catid),
|
'categoryName' => get_cat_name($catid),
|
||||||
'categoryId' => $catid,
|
'categoryId' => $catid,
|
||||||
'isPrimary' => $isPrimary
|
'isPrimary' => $isPrimary
|
||||||
);
|
);
|
||||||
$isPrimary = false;
|
$isPrimary = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $categories;
|
return $categories;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -956,81 +956,81 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||||
|
|
||||||
$this->escape($args);
|
$this->escape($args);
|
||||||
|
|
||||||
$post_ID = $args[0];
|
$post_ID = $args[0];
|
||||||
$user_login = $args[1];
|
$user_login = $args[1];
|
||||||
$user_pass = $args[2];
|
$user_pass = $args[2];
|
||||||
$categories = $args[3];
|
$categories = $args[3];
|
||||||
|
|
||||||
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
||||||
return $this->error;
|
return $this->error;
|
||||||
}
|
}
|
||||||
|
|
||||||
set_current_user(0, $user_login);
|
set_current_user(0, $user_login);
|
||||||
if ( !current_user_can('edit_post', $post_ID) )
|
if ( !current_user_can('edit_post', $post_ID) )
|
||||||
return new IXR_Error(401, 'Sorry, you can not edit this post.');
|
return new IXR_Error(401, 'Sorry, you can not edit this post.');
|
||||||
|
|
||||||
foreach($categories as $cat) {
|
foreach($categories as $cat) {
|
||||||
$catids[] = $cat['categoryId'];
|
$catids[] = $cat['categoryId'];
|
||||||
}
|
}
|
||||||
|
|
||||||
wp_set_post_categories($post_ID, $catids);
|
wp_set_post_categories($post_ID, $catids);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* mt.supportedMethods ...returns an array of methods supported by this server */
|
/* mt.supportedMethods ...returns an array of methods supported by this server */
|
||||||
function mt_supportedMethods($args) {
|
function mt_supportedMethods($args) {
|
||||||
|
|
||||||
$supported_methods = array();
|
$supported_methods = array();
|
||||||
foreach($this->methods as $key=>$value) {
|
foreach($this->methods as $key=>$value) {
|
||||||
$supported_methods[] = $key;
|
$supported_methods[] = $key;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $supported_methods;
|
return $supported_methods;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* mt.supportedTextFilters ...returns an empty array because we don't
|
/* mt.supportedTextFilters ...returns an empty array because we don't
|
||||||
support per-post text filters yet */
|
support per-post text filters yet */
|
||||||
function mt_supportedTextFilters($args) {
|
function mt_supportedTextFilters($args) {
|
||||||
return array();
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* mt.getTrackbackPings ...returns trackbacks sent to a given post */
|
/* mt.getTrackbackPings ...returns trackbacks sent to a given post */
|
||||||
function mt_getTrackbackPings($args) {
|
function mt_getTrackbackPings($args) {
|
||||||
|
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
||||||
$post_ID = intval($args);
|
$post_ID = intval($args);
|
||||||
|
|
||||||
$actual_post = wp_get_single_post($post_ID, ARRAY_A);
|
$actual_post = wp_get_single_post($post_ID, ARRAY_A);
|
||||||
|
|
||||||
if (!$actual_post) {
|
if (!$actual_post) {
|
||||||
return new IXR_Error(404, 'Sorry, no such post.');
|
return new IXR_Error(404, 'Sorry, no such post.');
|
||||||
}
|
|
||||||
|
|
||||||
$comments = $wpdb->get_results("SELECT comment_author_url, comment_content, comment_author_IP, comment_type FROM $wpdb->comments WHERE comment_post_ID = $post_ID");
|
|
||||||
|
|
||||||
if (!$comments) {
|
|
||||||
return array();
|
|
||||||
}
|
|
||||||
|
|
||||||
$trackback_pings = array();
|
|
||||||
foreach($comments as $comment) {
|
|
||||||
if ( 'trackback' == $comment->comment_type ) {
|
|
||||||
$content = $comment->comment_content;
|
|
||||||
$title = substr($content, 8, (strpos($content, '</strong>') - 8));
|
|
||||||
$trackback_pings[] = array(
|
|
||||||
'pingTitle' => $title,
|
|
||||||
'pingURL' => $comment->comment_author_url,
|
|
||||||
'pingIP' => $comment->comment_author_IP
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return $trackback_pings;
|
$comments = $wpdb->get_results("SELECT comment_author_url, comment_content, comment_author_IP, comment_type FROM $wpdb->comments WHERE comment_post_ID = $post_ID");
|
||||||
|
|
||||||
|
if (!$comments) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
|
$trackback_pings = array();
|
||||||
|
foreach($comments as $comment) {
|
||||||
|
if ( 'trackback' == $comment->comment_type ) {
|
||||||
|
$content = $comment->comment_content;
|
||||||
|
$title = substr($content, 8, (strpos($content, '</strong>') - 8));
|
||||||
|
$trackback_pings[] = array(
|
||||||
|
'pingTitle' => $title,
|
||||||
|
'pingURL' => $comment->comment_author_url,
|
||||||
|
'pingIP' => $comment->comment_author_IP
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return $trackback_pings;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1039,30 +1039,30 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||||
|
|
||||||
$this->escape($args);
|
$this->escape($args);
|
||||||
|
|
||||||
$post_ID = $args[0];
|
$post_ID = $args[0];
|
||||||
$user_login = $args[1];
|
$user_login = $args[1];
|
||||||
$user_pass = $args[2];
|
$user_pass = $args[2];
|
||||||
|
|
||||||
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
||||||
return $this->error;
|
return $this->error;
|
||||||
}
|
}
|
||||||
|
|
||||||
set_current_user(0, $user_login);
|
set_current_user(0, $user_login);
|
||||||
if ( !current_user_can('edit_post', $post_ID) )
|
if ( !current_user_can('edit_post', $post_ID) )
|
||||||
return new IXR_Error(401, 'Sorry, you can not edit this post.');
|
return new IXR_Error(401, 'Sorry, you can not edit this post.');
|
||||||
|
|
||||||
$postdata = wp_get_single_post($post_ID,ARRAY_A);
|
$postdata = wp_get_single_post($post_ID,ARRAY_A);
|
||||||
|
|
||||||
$postdata['post_status'] = 'publish';
|
$postdata['post_status'] = 'publish';
|
||||||
|
|
||||||
// retain old cats
|
// retain old cats
|
||||||
$cats = wp_get_post_categories($post_ID);
|
$cats = wp_get_post_categories($post_ID);
|
||||||
$postdata['post_category'] = $cats;
|
$postdata['post_category'] = $cats;
|
||||||
$this->escape($postdata);
|
$this->escape($postdata);
|
||||||
|
|
||||||
$result = wp_update_post($postdata);
|
$result = wp_update_post($postdata);
|
||||||
|
|
||||||
return $result;
|
return $result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1090,7 +1090,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||||
// Check if the page linked to is in our site
|
// Check if the page linked to is in our site
|
||||||
$pos1 = strpos($pagelinkedto, str_replace(array('http://www.','http://','https://www.','https://'), '', get_option('home')));
|
$pos1 = strpos($pagelinkedto, str_replace(array('http://www.','http://','https://www.','https://'), '', get_option('home')));
|
||||||
if( !$pos1 )
|
if( !$pos1 )
|
||||||
return new IXR_Error(0, 'Is there no link to us?');
|
return new IXR_Error(0, 'Is there no link to us?');
|
||||||
|
|
||||||
// let's find which post is linked to
|
// let's find which post is linked to
|
||||||
// FIXME: does url_to_postid() cover all these cases already?
|
// FIXME: does url_to_postid() cover all these cases already?
|
||||||
|
@ -1223,8 +1223,8 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||||
|
|
||||||
|
|
||||||
/* pingback.extensions.getPingbacks returns an array of URLs
|
/* pingback.extensions.getPingbacks returns an array of URLs
|
||||||
that pingbacked the given URL
|
that pingbacked the given URL
|
||||||
specs on http://www.aquarionics.com/misc/archives/blogite/0198.html */
|
specs on http://www.aquarionics.com/misc/archives/blogite/0198.html */
|
||||||
function pingback_extensions_getPingbacks($args) {
|
function pingback_extensions_getPingbacks($args) {
|
||||||
|
|
||||||
global $wpdb;
|
global $wpdb;
|
||||||
|
|
Loading…
Reference in New Issue