mirror of
https://github.com/WordPress/WordPress.git
synced 2024-12-22 09:07:59 +01:00
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
@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php
|
||||
/* Short and sweet */
|
||||
define('WP_USE_THEMES', true);
|
||||
require('./wp-blog-header.php');
|
||||
|
@ -128,7 +128,7 @@ case 'add-category' : // On the Fly
|
||||
break;
|
||||
case 'add-cat' : // From Manage->Categories
|
||||
if ( !current_user_can( 'manage_categories' ) )
|
||||
die('-1');
|
||||
die('-1');
|
||||
if ( !$cat = wp_insert_category( $_POST ) )
|
||||
die('0');
|
||||
if ( !$cat = get_category( $cat ) )
|
||||
|
@ -48,7 +48,7 @@ function get_editable_user_ids( $user_id, $exclude_zeros = true ) {
|
||||
if ( ! $user->has_cap('edit_others_posts') ) {
|
||||
if ( $user->has_cap('edit_posts') || $exclude_zeros == false )
|
||||
return array($user->id);
|
||||
else
|
||||
else
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -96,7 +96,7 @@ function wp_insert_category($catarr) {
|
||||
$update = false;
|
||||
|
||||
$cat_name = apply_filters('pre_category_name', $cat_name);
|
||||
|
||||
|
||||
if (empty ($category_nicename))
|
||||
$category_nicename = sanitize_title($cat_name);
|
||||
else
|
||||
@ -198,7 +198,7 @@ function wp_delete_category($cat_ID) {
|
||||
$cats = array($default_cat);
|
||||
else
|
||||
$cats = array_diff($cats, array($cat_ID));
|
||||
wp_set_post_categories($post_id, $cats);
|
||||
wp_set_post_categories($post_id, $cats);
|
||||
}
|
||||
|
||||
$default_link_cat = get_option('default_link_category');
|
||||
@ -209,9 +209,9 @@ function wp_delete_category($cat_ID) {
|
||||
$cats = array($default_link_cat);
|
||||
else
|
||||
$cats = array_diff($cats, array($cat_ID));
|
||||
wp_set_link_cats($link_id, $cats);
|
||||
wp_set_link_cats($link_id, $cats);
|
||||
}
|
||||
|
||||
|
||||
wp_cache_delete($cat_ID, 'category');
|
||||
wp_cache_delete('all_category_ids', 'category');
|
||||
|
||||
@ -285,9 +285,9 @@ function wp_delete_user($id, $reassign = 'novalue') {
|
||||
|
||||
function wp_revoke_user($id) {
|
||||
$id = (int) $id;
|
||||
|
||||
|
||||
$user = new WP_User($id);
|
||||
$user->remove_all_caps();
|
||||
$user->remove_all_caps();
|
||||
}
|
||||
|
||||
function wp_insert_link($linkdata) {
|
||||
@ -385,15 +385,15 @@ function wp_update_link($linkdata) {
|
||||
$link = add_magic_quotes($link);
|
||||
|
||||
// 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']) )
|
||||
$link_cats = $linkdata['link_category'];
|
||||
else
|
||||
$link_cats = $link['link_category'];
|
||||
$link_cats = $linkdata['link_category'];
|
||||
else
|
||||
$link_cats = $link['link_category'];
|
||||
|
||||
// Merge old and new fields with new fields overwriting old ones.
|
||||
$linkdata = array_merge($link, $linkdata);
|
||||
$linkdata['link_category'] = $link_cats;
|
||||
$linkdata['link_category'] = $link_cats;
|
||||
|
||||
return wp_insert_link($linkdata);
|
||||
}
|
||||
@ -402,7 +402,7 @@ function wp_delete_link($link_id) {
|
||||
global $wpdb;
|
||||
|
||||
do_action('delete_link', $link_id);
|
||||
|
||||
|
||||
$categories = wp_get_link_cats($link_id);
|
||||
if( is_array( $categories ) ) {
|
||||
foreach ( $categories as $category ) {
|
||||
@ -418,9 +418,9 @@ function wp_delete_link($link_id) {
|
||||
function wp_get_link_cats($link_ID = 0) {
|
||||
global $wpdb;
|
||||
|
||||
$sql = "SELECT category_id
|
||||
FROM $wpdb->link2cat
|
||||
WHERE link_id = $link_ID
|
||||
$sql = "SELECT category_id
|
||||
FROM $wpdb->link2cat
|
||||
WHERE link_id = $link_ID
|
||||
ORDER BY category_id";
|
||||
|
||||
$result = $wpdb->get_col($sql);
|
||||
@ -441,8 +441,8 @@ function wp_set_link_cats($link_ID = 0, $link_categories = array()) {
|
||||
|
||||
// First the old categories
|
||||
$old_categories = $wpdb->get_col("
|
||||
SELECT category_id
|
||||
FROM $wpdb->link2cat
|
||||
SELECT category_id
|
||||
FROM $wpdb->link2cat
|
||||
WHERE link_id = $link_ID");
|
||||
|
||||
if (!$old_categories) {
|
||||
@ -457,9 +457,9 @@ function wp_set_link_cats($link_ID = 0, $link_categories = array()) {
|
||||
if ($delete_cats) {
|
||||
foreach ($delete_cats as $del) {
|
||||
$wpdb->query("
|
||||
DELETE FROM $wpdb->link2cat
|
||||
WHERE category_id = $del
|
||||
AND link_id = $link_ID
|
||||
DELETE FROM $wpdb->link2cat
|
||||
WHERE category_id = $del
|
||||
AND link_id = $link_ID
|
||||
");
|
||||
}
|
||||
}
|
||||
@ -470,11 +470,11 @@ function wp_set_link_cats($link_ID = 0, $link_categories = array()) {
|
||||
if ($add_cats) {
|
||||
foreach ($add_cats as $new_cat) {
|
||||
$wpdb->query("
|
||||
INSERT INTO $wpdb->link2cat (link_id, category_id)
|
||||
INSERT INTO $wpdb->link2cat (link_id, category_id)
|
||||
VALUES ($link_ID, $new_cat)");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Update category counts.
|
||||
$all_affected_cats = array_unique(array_merge($link_categories, $old_categories));
|
||||
foreach ( $all_affected_cats as $cat_id ) {
|
||||
|
@ -1139,10 +1139,10 @@ function touch_time( $edit = 1, $for_post = 1 ) {
|
||||
?>
|
||||
</select>
|
||||
<input type="text" id="jj" name="jj" value="<?php echo $jj; ?>" size="2" maxlength="2" onchange="edit_date.checked=true"/>
|
||||
<input type="text" id="aa" name="aa" value="<?php echo $aa ?>" size="4" maxlength="5" onchange="edit_date.checked=true" /> @
|
||||
<input type="text" id="hh" name="hh" value="<?php echo $hh ?>" size="2" maxlength="2" onchange="edit_date.checked=true" /> :
|
||||
<input type="text" id="mn" name="mn" value="<?php echo $mn ?>" size="2" maxlength="2" onchange="edit_date.checked=true" />
|
||||
<input type="hidden" id="ss" name="ss" value="<?php echo $ss ?>" size="2" maxlength="2" onchange="edit_date.checked=true" />
|
||||
<input type="text" id="aa" name="aa" value="<?php echo $aa ?>" size="4" maxlength="5" onchange="edit_date.checked=true" /> @
|
||||
<input type="text" id="hh" name="hh" value="<?php echo $hh ?>" size="2" maxlength="2" onchange="edit_date.checked=true" /> :
|
||||
<input type="text" id="mn" name="mn" value="<?php echo $mn ?>" size="2" maxlength="2" onchange="edit_date.checked=true" />
|
||||
<input type="hidden" id="ss" name="ss" value="<?php echo $ss ?>" size="2" maxlength="2" onchange="edit_date.checked=true" />
|
||||
<?php
|
||||
if ( $edit ) {
|
||||
_e( 'Existing timestamp' );
|
||||
@ -1387,7 +1387,7 @@ function user_can_access_admin_page() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -35,16 +35,16 @@ if (!empty($post_title))
|
||||
else
|
||||
$post->post_title = $popuptitle;
|
||||
|
||||
|
||||
|
||||
$content = wp_specialchars($_REQUEST['content']);
|
||||
$popupurl = wp_specialchars($_REQUEST['popupurl']);
|
||||
if ( !empty($content) ) {
|
||||
$post->post_content = wp_specialchars( stripslashes($_REQUEST['content']) );
|
||||
} else {
|
||||
$post->post_content = '<a href="'.$popupurl.'">'.$popuptitle.'</a>'."\n$text";
|
||||
}
|
||||
if ( !empty($content) ) {
|
||||
$post->post_content = wp_specialchars( stripslashes($_REQUEST['content']) );
|
||||
} else {
|
||||
$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">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||||
@ -77,15 +77,15 @@ $popupurl = wp_specialchars($_REQUEST['popupurl']);
|
||||
}
|
||||
|
||||
#wpbookmarklet .wrap {
|
||||
border: 0px;
|
||||
border: 0px;
|
||||
}
|
||||
|
||||
#wpbookmarklet #postdiv {
|
||||
margin-bottom: 0.5em;
|
||||
margin-bottom: 0.5em;
|
||||
}
|
||||
|
||||
#wpbookmarklet #titlediv {
|
||||
margin-bottom: 1em;
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
-->
|
||||
|
@ -48,10 +48,10 @@ break;
|
||||
|
||||
case 'edit':
|
||||
|
||||
require_once ('admin-header.php');
|
||||
$cat_ID = (int) $_GET['cat_ID'];
|
||||
$category = get_category_to_edit($cat_ID);
|
||||
include('edit-category-form.php');
|
||||
require_once ('admin-header.php');
|
||||
$cat_ID = (int) $_GET['cat_ID'];
|
||||
$category = get_category_to_edit($cat_ID);
|
||||
include('edit-category-form.php');
|
||||
|
||||
break;
|
||||
|
||||
|
@ -14,10 +14,10 @@ function customFieldsAddIn() {
|
||||
for ( var i=0; i < inputs.length; i++ ) {
|
||||
if ('text' == inputs[i].type) {
|
||||
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) {
|
||||
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); };
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@ switch ( $_GET['pagenow'] ) :
|
||||
break;
|
||||
case 'page.php' :
|
||||
case 'page-new.php' :
|
||||
$man = 'pagemeta';
|
||||
$man = 'pagemeta';
|
||||
break;
|
||||
case 'link.php' :
|
||||
$man = 'linkmeta';
|
||||
|
@ -22,8 +22,8 @@ if ( ! empty($cat_ID) ) {
|
||||
<?php wp_nonce_field($nonce_action); ?>
|
||||
<table class="editform" width="100%" cellspacing="2" cellpadding="5">
|
||||
<tr>
|
||||
<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>
|
||||
<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>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row" valign="top"><label for="category_nicename"><?php _e('Category slug:') ?></label></th>
|
||||
|
@ -143,7 +143,7 @@ $start = " start='$offset'";
|
||||
++$i; $class = '';
|
||||
$authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $comment->comment_post_ID"));
|
||||
$comment_status = wp_get_comment_status($comment->comment_ID);
|
||||
if ('unapproved' == $comment_status)
|
||||
if ('unapproved' == $comment_status)
|
||||
$class .= ' unapproved';
|
||||
if ($i % 2)
|
||||
$class .= ' alternate';
|
||||
@ -153,7 +153,7 @@ $start = " start='$offset'";
|
||||
|
||||
<?php comment_text() ?>
|
||||
|
||||
<p><?php comment_date('M j, g:i A'); ?> — [
|
||||
<p><?php comment_date('M j, g:i A'); ?> — [
|
||||
<?php
|
||||
if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
|
||||
echo " <a href='comment.php?action=editcomment&c=".$comment->comment_ID."'>" . __('Edit') . '</a>';
|
||||
@ -181,7 +181,7 @@ $post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title;
|
||||
|
||||
?>
|
||||
<p>
|
||||
<strong><?php _e('No comments found.') ?></strong></p>
|
||||
<strong><?php _e('No comments found.') ?></strong></p>
|
||||
|
||||
<?php
|
||||
} // end if ($comments)
|
||||
|
@ -8,8 +8,7 @@ $messages[3] = __('Custom field deleted.');
|
||||
<?php endif; ?>
|
||||
|
||||
<form name="post" action="post.php" method="post" id="post">
|
||||
<?php if ( (isset($mode) && 'bookmarklet' == $mode) ||
|
||||
isset($_GET['popupurl']) ): ?>
|
||||
<?php if ( (isset($mode) && 'bookmarklet' == $mode) || isset($_GET['popupurl']) ): ?>
|
||||
<input type="hidden" name="mode" value="bookmarklet" />
|
||||
<?php endif; ?>
|
||||
|
||||
@ -121,7 +120,7 @@ if ( $authors && count( $authors ) > 1 ) :
|
||||
<h3 class="dbx-handle"><?php _e('Post Author'); ?>:</h3>
|
||||
<div class="dbx-content">
|
||||
<select name="post_author_override" id="post_author_override">
|
||||
<?php
|
||||
<?php
|
||||
foreach ($authors as $o) :
|
||||
$o = get_userdata( $o->ID );
|
||||
if ( $post->post_author == $o->ID || ( empty($post_ID) && $user_ID == $o->ID ) ) $selected = 'selected="selected"';
|
||||
@ -140,8 +139,8 @@ endforeach;
|
||||
</div>
|
||||
|
||||
<fieldset id="titlediv">
|
||||
<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>
|
||||
<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>
|
||||
</fieldset>
|
||||
|
||||
<fieldset id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>">
|
||||
@ -208,7 +207,7 @@ if (current_user_can('upload_files')) {
|
||||
</div>
|
||||
<div class="dbx-content-wrapper">
|
||||
<div class="dbx-content"><?php _e('Send trackbacks to'); ?>: <?php echo $form_trackback; ?> (<?php _e('Separate multiple URIs with spaces'); ?>)
|
||||
<?php
|
||||
<?php
|
||||
if ( ! empty($pings) )
|
||||
echo $pings;
|
||||
?>
|
||||
@ -227,7 +226,7 @@ if ( ! empty($pings) )
|
||||
<table cellpadding="3">
|
||||
<?php
|
||||
$metadata = has_meta($post_ID);
|
||||
list_meta($metadata);
|
||||
list_meta($metadata);
|
||||
?>
|
||||
|
||||
</table>
|
||||
|
@ -54,8 +54,8 @@ addLoadEvent(focusit);
|
||||
<tr>
|
||||
<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 />
|
||||
<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_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>
|
||||
</tr>
|
||||
|
||||
<?php if ( current_user_can('edit_posts') ) : ?>
|
||||
|
@ -54,17 +54,17 @@ edCanvas = document.getElementById('content');
|
||||
<p><label for="trackback"> <?php printf(__('<a href="%s" title="Help on trackbacks"><strong>TrackBack</strong> a <abbr title="Universal Resource Locator">URL</abbr></a>:</label> (Separate multiple <abbr title="Universal Resource Locator">URL</abbr>s with spaces.)<br />'), 'http://wordpress.org/docs/reference/post/#trackback') ?>
|
||||
<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') ?>" />
|
||||
<input name="saveasprivate" type="submit" id="saveasprivate" tabindex="10" value="<?php _e('Save as Private') ?>" />
|
||||
<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') ?>" />
|
||||
|
||||
<?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 if ('bookmarklet' != $mode) {
|
||||
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()); ?>" />
|
||||
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()); ?>" />
|
||||
</p>
|
||||
|
||||
<?php do_action('simple_edit_form', ''); ?>
|
||||
|
@ -30,7 +30,7 @@ function xfn_check($class, $value = '', $type = 'check') {
|
||||
}
|
||||
?>
|
||||
|
||||
<div class="wrap">
|
||||
<div class="wrap">
|
||||
<h2><?php echo $heading ?></h2>
|
||||
<?php echo $form ?>
|
||||
<?php wp_nonce_field($nonce_action); ?>
|
||||
@ -48,7 +48,7 @@ function xfn_check($class, $value = '', $type = 'check') {
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="dbx-box">
|
||||
<h3 class="dbx-handle"><?php _e('Target') ?></h3>
|
||||
<h3 class="dbx-handle"><?php _e('Target') ?></h3>
|
||||
<div class="dbx-content">
|
||||
<label for="link_target_blank" class="selectit">
|
||||
<input id="link_target_blank" type="radio" name="link_target" value="_blank" <?php echo(($link->link_target == '_blank') ? 'checked="checked"' : ''); ?> />
|
||||
@ -63,7 +63,7 @@ function xfn_check($class, $value = '', $type = 'check') {
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="dbx-box">
|
||||
<h3 class="dbx-handle"><?php _e('Visible') ?></h3>
|
||||
<h3 class="dbx-handle"><?php _e('Visible') ?></h3>
|
||||
<div class="dbx-content">
|
||||
<label for="link_visible_yes" class="selectit">
|
||||
<input id="link_visible_yes" type="radio" name="link_visible" <?php if ($link->link_visible == 'Y') echo "checked='checked'"; ?> value="Y" />
|
||||
|
@ -16,7 +16,7 @@ if (0 == $post_ID) {
|
||||
$sendto = wp_get_referer();
|
||||
|
||||
if ( 0 != $post_ID && $sendto == get_permalink($post_ID) )
|
||||
$sendto = 'redo';
|
||||
$sendto = 'redo';
|
||||
$sendto = wp_specialchars( $sendto );
|
||||
|
||||
?>
|
||||
@ -27,7 +27,7 @@ $sendto = wp_specialchars( $sendto );
|
||||
wp_nonce_field($nonce_action);
|
||||
|
||||
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 ?>" />
|
||||
@ -103,7 +103,7 @@ addLoadEvent(focusit);
|
||||
<h3 class="dbx-handle"><?php _e('Page Author'); ?>:</h3>
|
||||
<div class="dbx-content">
|
||||
<select name="post_author_override" id="post_author_override">
|
||||
<?php
|
||||
<?php
|
||||
foreach ($authors as $o) :
|
||||
$o = get_userdata( $o->ID );
|
||||
if ( $post->post_author == $o->ID || ( empty($post_ID) && $user_ID == $o->ID ) ) $selected = 'selected="selected"';
|
||||
@ -117,7 +117,7 @@ endforeach;
|
||||
<?php endif; ?>
|
||||
|
||||
<fieldset id="pageorder" class="dbx-box">
|
||||
<h3 class="dbx-handle"><?php _e('Page Order') ?></h3>
|
||||
<h3 class="dbx-handle"><?php _e('Page Order') ?></h3>
|
||||
<div class="dbx-content"><p><input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo $post->menu_order ?>" /></p></div>
|
||||
</fieldset>
|
||||
|
||||
@ -168,9 +168,9 @@ if (current_user_can('upload_files')) {
|
||||
<h3 class="dbx-handle"><?php _e('Custom Fields') ?></h3>
|
||||
<div id="postcustomstuff" class="dbx-content">
|
||||
<table cellpadding="3">
|
||||
<?php
|
||||
<?php
|
||||
$metadata = has_meta($post_ID);
|
||||
list_meta($metadata);
|
||||
list_meta($metadata);
|
||||
?>
|
||||
|
||||
</table>
|
||||
@ -186,7 +186,7 @@ list_meta($metadata);
|
||||
</div>
|
||||
|
||||
<?php if ('edit' == $action) :
|
||||
$delete_nonce = wp_create_nonce( 'delete-page_' . $post_ID );
|
||||
$delete_nonce = wp_create_nonce( 'delete-page_' . $post_ID );
|
||||
if ( current_user_can('delete_page', $post->ID) ) ?>
|
||||
<input name="deletepost" class="button delete" type="submit" id="deletepost" tabindex="10" value="<?php _e('Delete this page') ?>" <?php echo "onclick=\"if ( confirm('" . sprintf(__("You are about to delete this page \'%s\'\\n \'Cancel\' to stop, \'OK\' to delete."), js_escape($post->post_title) ) . "') ) { document.forms.post._wpnonce.value = '$delete_nonce'; return true;}return false;\""; ?> />
|
||||
<?php endif; ?>
|
||||
|
@ -10,12 +10,12 @@ require_once('admin-header.php');
|
||||
<h2><?php _e('Page Management'); ?></h2>
|
||||
<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">
|
||||
<fieldset>
|
||||
<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="submit" name="submit" value="<?php _e('Search') ?>" />
|
||||
</fieldset>
|
||||
<form name="searchform" action="" method="get">
|
||||
<fieldset>
|
||||
<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="submit" name="submit" value="<?php _e('Search') ?>" />
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
<?php
|
||||
@ -53,10 +53,10 @@ page_rows(0, 0, $posts, $all);
|
||||
<p><?php _e('No pages yet.') ?></p>
|
||||
<?php
|
||||
} // end if ($posts)
|
||||
?>
|
||||
?>
|
||||
|
||||
<h3><a href="page-new.php"><?php _e('Create New Page »'); ?></a></h3>
|
||||
|
||||
</div>
|
||||
|
||||
<?php include('admin-footer.php'); ?>
|
||||
<?php include('admin-footer.php'); ?>
|
||||
|
@ -12,11 +12,11 @@ $drafts = get_users_drafts( $user_ID );
|
||||
$other_drafts = get_others_drafts( $user_ID);
|
||||
|
||||
if ($drafts || $other_drafts) {
|
||||
?>
|
||||
?>
|
||||
<div class="wrap">
|
||||
<?php if ($drafts) { ?>
|
||||
<p><strong><?php _e('Your Drafts:') ?></strong>
|
||||
<?php
|
||||
<p><strong><?php _e('Your Drafts:') ?></strong>
|
||||
<?php
|
||||
$i = 0;
|
||||
foreach ($drafts as $draft) {
|
||||
if (0 != $i)
|
||||
@ -27,13 +27,13 @@ if ($drafts || $other_drafts) {
|
||||
echo "<a href='post.php?action=edit&post=$draft->ID' title='" . __('Edit this draft') . "'>$draft->post_title</a>";
|
||||
++$i;
|
||||
}
|
||||
?>
|
||||
.</p>
|
||||
?>
|
||||
.</p>
|
||||
<?php } ?>
|
||||
|
||||
<?php if ($other_drafts) { ?>
|
||||
<p><strong><?php _e('Other’s Drafts:') ?></strong>
|
||||
<?php
|
||||
<?php if ($other_drafts) { ?>
|
||||
<p><strong><?php _e('Other’s Drafts:') ?></strong>
|
||||
<?php
|
||||
$i = 0;
|
||||
foreach ($other_drafts as $draft) {
|
||||
if (0 != $i)
|
||||
@ -44,8 +44,8 @@ if ($drafts || $other_drafts) {
|
||||
echo "<a href='post.php?action=edit&post=$draft->ID' title='" . __('Edit this draft') . "'>$draft->post_title</a>";
|
||||
++$i;
|
||||
}
|
||||
?>
|
||||
.</p>
|
||||
?>
|
||||
.</p>
|
||||
|
||||
<?php } ?>
|
||||
|
||||
@ -88,7 +88,7 @@ if ( count($arc_result) ) { ?>
|
||||
<form name="viewarc" id="viewarc" action="" method="get">
|
||||
<fieldset>
|
||||
<legend><?php _e('Browse Month…') ?></legend>
|
||||
<select name='m'>
|
||||
<select name='m'>
|
||||
<?php
|
||||
foreach ($arc_result as $arc_row) {
|
||||
if ( $arc_row->yyear == 0 )
|
||||
@ -127,12 +127,12 @@ if ( count($arc_result) ) { ?>
|
||||
<?php
|
||||
// define the columns to display, the syntax is 'internal name' => 'display name'
|
||||
$posts_columns = array(
|
||||
'id' => __('ID'),
|
||||
'date' => __('When'),
|
||||
'title' => __('Title'),
|
||||
'categories' => __('Categories'),
|
||||
'comments' => __('Comments'),
|
||||
'author' => __('Author')
|
||||
'id' => __('ID'),
|
||||
'date' => __('When'),
|
||||
'title' => __('Title'),
|
||||
'categories' => __('Categories'),
|
||||
'comments' => __('Comments'),
|
||||
'author' => __('Author')
|
||||
);
|
||||
$posts_columns = apply_filters('manage_posts_columns', $posts_columns);
|
||||
|
||||
@ -143,7 +143,7 @@ $posts_columns['control_delete'] = '';
|
||||
|
||||
?>
|
||||
|
||||
<table class="widefat">
|
||||
<table class="widefat">
|
||||
<thead>
|
||||
<tr>
|
||||
|
||||
@ -160,7 +160,7 @@ $bgcolor = '';
|
||||
while (have_posts()) : the_post();
|
||||
add_filter('the_title','wp_specialchars');
|
||||
$class = ('alternate' == $class) ? '' : 'alternate';
|
||||
?>
|
||||
?>
|
||||
<tr id='post-<?php echo $id; ?>' class='<?php echo $class; ?>'>
|
||||
|
||||
<?php
|
||||
@ -195,9 +195,9 @@ foreach($posts_columns as $column_name=>$column_display_name) {
|
||||
|
||||
case 'comments':
|
||||
?>
|
||||
<td style="text-align: center"><a href="edit.php?p=<?php echo $id ?>&c=1">
|
||||
<?php comments_number(__('0'), __('1'), __('%')) ?>
|
||||
</a></td>
|
||||
<td style="text-align: center"><a href="edit.php?p=<?php echo $id ?>&c=1">
|
||||
<?php comments_number(__('0'), __('1'), __('%')) ?>
|
||||
</a></td>
|
||||
<?php
|
||||
break;
|
||||
|
||||
@ -259,9 +259,9 @@ if ( 1 == count($posts) ) {
|
||||
|
||||
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date");
|
||||
if ($comments) {
|
||||
?>
|
||||
<h3 id="comments"><?php _e('Comments') ?></h3>
|
||||
<ol id="the-comment-list" class="commentlist">
|
||||
?>
|
||||
<h3 id="comments"><?php _e('Comments') ?></h3>
|
||||
<ol id="the-comment-list" class="commentlist">
|
||||
<?php
|
||||
$i = 0;
|
||||
foreach ($comments as $comment) {
|
||||
@ -269,7 +269,7 @@ foreach ($comments as $comment) {
|
||||
++$i; $class = '';
|
||||
$authordata = get_userdata($wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $comment->comment_post_ID"));
|
||||
$comment_status = wp_get_comment_status($comment->comment_ID);
|
||||
if ('unapproved' == $comment_status)
|
||||
if ('unapproved' == $comment_status)
|
||||
$class .= ' unapproved';
|
||||
if ($i % 2)
|
||||
$class .= ' alternate';
|
||||
@ -299,8 +299,8 @@ if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
|
||||
echo '</ol>';
|
||||
}//end if comments
|
||||
?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php
|
||||
<?php } ?>
|
||||
</div>
|
||||
<?php
|
||||
include('admin-footer.php');
|
||||
?>
|
||||
?>
|
||||
|
@ -72,7 +72,7 @@ $posts = $wpdb->get_results("SELECT * FROM $wpdb->posts $where ORDER BY post_dat
|
||||
<!-- You will be taken through the simple import procedure. -->
|
||||
|
||||
<!-- generator="wordpress/<?php bloginfo_rss('version') ?>" created="<?php echo date('Y-m-d H:m'); ?>"-->
|
||||
<rss version="2.0"
|
||||
<rss version="2.0"
|
||||
xmlns:content="http://purl.org/rss/1.0/modules/content/"
|
||||
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
@ -108,7 +108,7 @@ $posts = $wpdb->get_results("SELECT * FROM $wpdb->posts $where ORDER BY post_dat
|
||||
<wp:post_parent><?php echo $post->post_parent; ?></wp:post_parent>
|
||||
<wp:post_type><?php echo $post->post_type; ?></wp:post_type>
|
||||
<?php
|
||||
$postmeta = $wpdb->get_results("SELECT * FROM $wpdb->postmeta WHERE post_id = $post->ID");
|
||||
$postmeta = $wpdb->get_results("SELECT * FROM $wpdb->postmeta WHERE post_id = $post->ID");
|
||||
if ( $postmeta ) {
|
||||
?>
|
||||
<?php foreach( $postmeta as $meta ) { ?>
|
||||
@ -119,7 +119,7 @@ if ( $postmeta ) {
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<?php
|
||||
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $post->ID");
|
||||
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $post->ID");
|
||||
if ( $comments ) { foreach ( $comments as $c ) { ?>
|
||||
<wp:comment>
|
||||
<wp:comment_id><?php echo $c->comment_ID; ?></wp:comment_id>
|
||||
|
@ -517,7 +517,7 @@ class Blogger_Import {
|
||||
$did_one = true;
|
||||
}
|
||||
$output.= "<p>$archivename $status</p>\n";
|
||||
}
|
||||
}
|
||||
if ( ! $did_one )
|
||||
$this->set_next_step(7);
|
||||
die( $this->refresher(1000) . $output );
|
||||
|
@ -20,7 +20,7 @@ class BW_Import {
|
||||
$trans_tbl = array_flip($trans_tbl);
|
||||
return strtr($string, $trans_tbl);
|
||||
}
|
||||
|
||||
|
||||
function greet() {
|
||||
echo '<div class="narrow">';
|
||||
echo '<p>'.__('Howdy! This importer allows you to extract posts from Blogware XML export file into your blog. Pick a Blogware file to upload and click Import.').'</p>';
|
||||
@ -30,7 +30,7 @@ class BW_Import {
|
||||
|
||||
function import_posts() {
|
||||
global $wpdb, $current_user;
|
||||
|
||||
|
||||
set_magic_quotes_runtime(0);
|
||||
$importdata = file($this->file); // Read the file into an array
|
||||
$importdata = implode('', $importdata); // squish it
|
||||
@ -39,7 +39,7 @@ class BW_Import {
|
||||
preg_match_all('|(<item[^>]+>(.*?)</item>)|is', $importdata, $posts);
|
||||
$posts = $posts[1];
|
||||
unset($importdata);
|
||||
echo '<ol>';
|
||||
echo '<ol>';
|
||||
foreach ($posts as $post) {
|
||||
flush();
|
||||
preg_match('|<item type=\"(.*?)\">|is', $post, $post_type);
|
||||
@ -102,7 +102,7 @@ class BW_Import {
|
||||
|
||||
preg_match_all('|<comment>(.*?)</comment>|is', $post, $comments);
|
||||
$comments = $comments[1];
|
||||
|
||||
|
||||
if ( $comments ) {
|
||||
$comment_post_ID = $post_id;
|
||||
$num_comments = 0;
|
||||
@ -157,7 +157,7 @@ class BW_Import {
|
||||
$this->file = $file['file'];
|
||||
$this->import_posts();
|
||||
wp_import_cleanup($file['id']);
|
||||
|
||||
|
||||
echo '<h3>';
|
||||
printf(__('All done. <a href="%s">Have fun!</a>'), get_option('home'));
|
||||
echo '</h3>';
|
||||
@ -170,7 +170,7 @@ class BW_Import {
|
||||
$step = (int) $_GET['step'];
|
||||
|
||||
$this->header();
|
||||
|
||||
|
||||
switch ($step) {
|
||||
case 0 :
|
||||
$this->greet();
|
||||
@ -179,12 +179,12 @@ class BW_Import {
|
||||
$this->import();
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
$this->footer();
|
||||
}
|
||||
|
||||
function BW_Import() {
|
||||
// Nothing.
|
||||
// Nothing.
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
**/
|
||||
if(!function_exists('get_catbynicename'))
|
||||
{
|
||||
function get_catbynicename($category_nicename)
|
||||
function get_catbynicename($category_nicename)
|
||||
{
|
||||
global $wpdb;
|
||||
|
||||
@ -60,57 +60,58 @@ if(!function_exists('link_exists'))
|
||||
//
|
||||
// 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) {
|
||||
if(!is_int($char)) return false;
|
||||
return ($char & 0xE0) == 0xC0;
|
||||
}
|
||||
|
||||
function valid_3byte($char) {
|
||||
if(!is_int($char)) return false;
|
||||
return ($char & 0xF0) == 0xE0;
|
||||
}
|
||||
function valid_1byte($char) {
|
||||
if(!is_int($char)) return false;
|
||||
return ($char & 0x80) == 0x00;
|
||||
}
|
||||
|
||||
function valid_4byte($char) {
|
||||
if(!is_int($char)) return false;
|
||||
return ($char & 0xF8) == 0xF0;
|
||||
}
|
||||
|
||||
function valid_nextbyte($char) {
|
||||
if(!is_int($char)) return false;
|
||||
return ($char & 0xC0) == 0x80;
|
||||
}
|
||||
|
||||
function valid_utf8($string) {
|
||||
$len = strlen($string);
|
||||
$i = 0;
|
||||
while( $i < $len ) {
|
||||
$char = ord(substr($string, $i++, 1));
|
||||
if(valid_1byte($char)) { // continue
|
||||
continue;
|
||||
} else if(valid_2byte($char)) { // check 1 byte
|
||||
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
|
||||
return false;
|
||||
} else if(valid_3byte($char)) { // check 2 bytes
|
||||
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
|
||||
return false;
|
||||
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
|
||||
return false;
|
||||
} else if(valid_4byte($char)) { // check 3 bytes
|
||||
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
|
||||
return false;
|
||||
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
|
||||
return false;
|
||||
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
|
||||
return false;
|
||||
} // goto next char
|
||||
}
|
||||
return true; // done
|
||||
}
|
||||
function valid_2byte($char) {
|
||||
if(!is_int($char)) return false;
|
||||
return ($char & 0xE0) == 0xC0;
|
||||
}
|
||||
|
||||
function valid_3byte($char) {
|
||||
if(!is_int($char)) return false;
|
||||
return ($char & 0xF0) == 0xE0;
|
||||
}
|
||||
|
||||
function valid_4byte($char) {
|
||||
if(!is_int($char)) return false;
|
||||
return ($char & 0xF8) == 0xF0;
|
||||
}
|
||||
|
||||
function valid_nextbyte($char) {
|
||||
if(!is_int($char)) return false;
|
||||
return ($char & 0xC0) == 0x80;
|
||||
}
|
||||
|
||||
function valid_utf8($string) {
|
||||
$len = strlen($string);
|
||||
$i = 0;
|
||||
while( $i < $len ) {
|
||||
$char = ord(substr($string, $i++, 1));
|
||||
if(valid_1byte($char)) { // continue
|
||||
continue;
|
||||
} else if(valid_2byte($char)) { // check 1 byte
|
||||
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
|
||||
return false;
|
||||
} else if(valid_3byte($char)) { // check 2 bytes
|
||||
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
|
||||
return false;
|
||||
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
|
||||
return false;
|
||||
} else if(valid_4byte($char)) { // check 3 bytes
|
||||
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
|
||||
return false;
|
||||
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
|
||||
return false;
|
||||
if(!valid_nextbyte(ord(substr($string, $i++, 1))))
|
||||
return false;
|
||||
} // goto next char
|
||||
}
|
||||
return true; // done
|
||||
}
|
||||
|
||||
function csc ($s) {
|
||||
if (valid_utf8 ($s)) {
|
||||
@ -151,7 +152,7 @@ class Dotclear_Import {
|
||||
echo '</form></div>';
|
||||
}
|
||||
|
||||
function get_dc_cats()
|
||||
function get_dc_cats()
|
||||
{
|
||||
global $wpdb;
|
||||
// General Housekeeping
|
||||
@ -186,7 +187,7 @@ class Dotclear_Import {
|
||||
// Get Posts
|
||||
return $dcdb->get_results('SELECT '.$dbprefix.'post.*, '.$dbprefix.'categorie.cat_libelle_url AS post_cat_name
|
||||
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()
|
||||
@ -211,7 +212,7 @@ class Dotclear_Import {
|
||||
return $dcdb->get_results('SELECT * FROM '.$dbprefix.'link ORDER BY position', ARRAY_A);
|
||||
}
|
||||
|
||||
function cat2wp($categories='')
|
||||
function cat2wp($categories='')
|
||||
{
|
||||
// General Housekeeping
|
||||
global $wpdb;
|
||||
@ -221,7 +222,7 @@ class Dotclear_Import {
|
||||
if(is_array($categories))
|
||||
{
|
||||
echo '<p>'.__('Importing Categories...').'<br /><br /></p>';
|
||||
foreach ($categories as $category)
|
||||
foreach ($categories as $category)
|
||||
{
|
||||
$count++;
|
||||
extract($category);
|
||||
@ -283,7 +284,7 @@ class Dotclear_Import {
|
||||
'display_name' => $Realname)
|
||||
);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
$ret_id = wp_insert_user(array(
|
||||
'user_login' => $user_id,
|
||||
@ -384,7 +385,7 @@ class Dotclear_Import {
|
||||
'comment_count' => $post_nb_comment + $post_nb_trackback)
|
||||
);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
$ret_id = wp_insert_post(array(
|
||||
'post_author' => $authorid,
|
||||
@ -460,7 +461,7 @@ class Dotclear_Import {
|
||||
'comment_approved' => $comment_approved)
|
||||
);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
// Insert comments
|
||||
$ret_id = wp_insert_comment(array(
|
||||
@ -547,7 +548,7 @@ class Dotclear_Import {
|
||||
return false;
|
||||
}
|
||||
|
||||
function import_categories()
|
||||
function import_categories()
|
||||
{
|
||||
// Category Import
|
||||
$cats = $this->get_dc_cats();
|
||||
@ -565,7 +566,7 @@ class Dotclear_Import {
|
||||
function import_users()
|
||||
{
|
||||
// User Import
|
||||
$users = $this->get_dc_users();
|
||||
$users = $this->get_dc_users();
|
||||
$this->users2wp($users);
|
||||
|
||||
echo '<form action="admin.php?import=dotclear&step=3" method="post">';
|
||||
@ -655,7 +656,7 @@ class Dotclear_Import {
|
||||
echo '</table>';
|
||||
}
|
||||
|
||||
function dispatch()
|
||||
function dispatch()
|
||||
{
|
||||
|
||||
if (empty ($_GET['step']))
|
||||
@ -664,7 +665,7 @@ class Dotclear_Import {
|
||||
$step = (int) $_GET['step'];
|
||||
$this->header();
|
||||
|
||||
if ( $step > 0 )
|
||||
if ( $step > 0 )
|
||||
{
|
||||
if($_POST['dbuser'])
|
||||
{
|
||||
@ -689,25 +690,25 @@ class Dotclear_Import {
|
||||
{
|
||||
if(get_option('dchost'))
|
||||
delete_option('dchost');
|
||||
add_option('dchost',$_POST['dbhost']);
|
||||
add_option('dchost',$_POST['dbhost']);
|
||||
}
|
||||
if($_POST['dccharset'])
|
||||
{
|
||||
if(get_option('dccharset'))
|
||||
delete_option('dccharset');
|
||||
add_option('dccharset',$_POST['dccharset']);
|
||||
add_option('dccharset',$_POST['dccharset']);
|
||||
}
|
||||
if($_POST['dbprefix'])
|
||||
{
|
||||
if(get_option('dcdbprefix'))
|
||||
delete_option('dcdbprefix');
|
||||
add_option('dcdbprefix',$_POST['dbprefix']);
|
||||
add_option('dcdbprefix',$_POST['dbprefix']);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
switch ($step)
|
||||
switch ($step)
|
||||
{
|
||||
default:
|
||||
case 0 :
|
||||
@ -736,7 +737,7 @@ class Dotclear_Import {
|
||||
$this->footer();
|
||||
}
|
||||
|
||||
function Dotclear_Import()
|
||||
function Dotclear_Import()
|
||||
{
|
||||
// Nothing.
|
||||
}
|
||||
|
@ -66,10 +66,10 @@ class GM_Import {
|
||||
$string = str_replace("|*|","<br />\n",$string);
|
||||
return($string);
|
||||
}
|
||||
|
||||
|
||||
function import() {
|
||||
global $wpdb;
|
||||
|
||||
|
||||
$wpvarstoreset = array('gmpath', 'archivespath', 'lastentry');
|
||||
for ($i=0; $i<count($wpvarstoreset); $i += 1) {
|
||||
$wpvar = $wpvarstoreset[$i];
|
||||
@ -136,11 +136,11 @@ class GM_Import {
|
||||
<li><?php _e('importing posts, comments, and karma...') ?><br /><ul><?php
|
||||
|
||||
chdir($archivespath);
|
||||
|
||||
|
||||
for($i = 0; $i <= $lastentry; $i = $i + 1) {
|
||||
|
||||
|
||||
$entryfile = "";
|
||||
|
||||
|
||||
if ($i<10000000) {
|
||||
$entryfile .= "0";
|
||||
if ($i<1000000) {
|
||||
@ -194,7 +194,7 @@ class GM_Import {
|
||||
$post_status = 'publish'; //in greymatter, there are no drafts
|
||||
$comment_status = 'open';
|
||||
$ping_status = 'closed';
|
||||
|
||||
|
||||
if ($post_ID = post_exists($post_title, '', $post_date)) {
|
||||
echo ' ';
|
||||
_e('(already exists)');
|
||||
@ -303,7 +303,7 @@ class GM_Import {
|
||||
}
|
||||
|
||||
function GM_Import() {
|
||||
// Nothing.
|
||||
// Nothing.
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,9 +55,9 @@ class MT_Import {
|
||||
$pass = 'changeme';
|
||||
if (!(in_array($author, $this->mtnames))) { //a new mt author name is found
|
||||
++ $this->j;
|
||||
$this->mtnames[$this->j] = $author; //add that new mt author name to an array
|
||||
$this->mtnames[$this->j] = $author; //add that new mt author name to an array
|
||||
$user_id = username_exists($this->newauthornames[$this->j]); //check if the new author name defined by the user is a pre-existing wp user
|
||||
if (!$user_id) { //banging my head against the desk now.
|
||||
if (!$user_id) { //banging my head against the desk now.
|
||||
if ($newauthornames[$this->j] == 'left_blank') { //check if the user does not want to change the authorname
|
||||
$user_id = wp_create_user($author, $pass);
|
||||
$this->newauthornames[$this->j] = $author; //now we have a name, in the place of left_blank.
|
||||
@ -399,7 +399,7 @@ class MT_Import {
|
||||
|
||||
function import() {
|
||||
$this->id = (int) $_GET['id'];
|
||||
|
||||
|
||||
$this->file = get_attached_file($this->id);
|
||||
$this->get_authors_from_post();
|
||||
$this->get_entries();
|
||||
|
@ -4,7 +4,7 @@
|
||||
**/
|
||||
if(!function_exists('get_catbynicename'))
|
||||
{
|
||||
function get_catbynicename($category_nicename)
|
||||
function get_catbynicename($category_nicename)
|
||||
{
|
||||
global $wpdb;
|
||||
|
||||
@ -70,13 +70,13 @@ class Textpattern_Import {
|
||||
$prefix = get_option('tpre');
|
||||
|
||||
// Get Categories
|
||||
return $txpdb->get_results('SELECT
|
||||
id,
|
||||
name,
|
||||
title
|
||||
FROM '.$prefix.'txp_category
|
||||
WHERE type = "article"',
|
||||
ARRAY_A);
|
||||
return $txpdb->get_results('SELECT
|
||||
id,
|
||||
name,
|
||||
title
|
||||
FROM '.$prefix.'txp_category
|
||||
WHERE type = "article"',
|
||||
ARRAY_A);
|
||||
}
|
||||
|
||||
function get_txp_users()
|
||||
@ -90,12 +90,12 @@ class Textpattern_Import {
|
||||
// Get Users
|
||||
|
||||
return $txpdb->get_results('SELECT
|
||||
user_id,
|
||||
name,
|
||||
RealName,
|
||||
email,
|
||||
privs
|
||||
FROM '.$prefix.'txp_users', ARRAY_A);
|
||||
user_id,
|
||||
name,
|
||||
RealName,
|
||||
email,
|
||||
privs
|
||||
FROM '.$prefix.'txp_users', ARRAY_A);
|
||||
}
|
||||
|
||||
function get_txp_posts()
|
||||
@ -106,22 +106,22 @@ class Textpattern_Import {
|
||||
$prefix = get_option('tpre');
|
||||
|
||||
// Get Posts
|
||||
return $txpdb->get_results('SELECT
|
||||
ID,
|
||||
Posted,
|
||||
AuthorID,
|
||||
LastMod,
|
||||
Title,
|
||||
Body,
|
||||
Excerpt,
|
||||
Category1,
|
||||
Category2,
|
||||
Status,
|
||||
Keywords,
|
||||
url_title,
|
||||
comments_count
|
||||
FROM '.$prefix.'textpattern
|
||||
', ARRAY_A);
|
||||
return $txpdb->get_results('SELECT
|
||||
ID,
|
||||
Posted,
|
||||
AuthorID,
|
||||
LastMod,
|
||||
Title,
|
||||
Body,
|
||||
Excerpt,
|
||||
Category1,
|
||||
Category2,
|
||||
Status,
|
||||
Keywords,
|
||||
url_title,
|
||||
comments_count
|
||||
FROM '.$prefix.'textpattern
|
||||
', ARRAY_A);
|
||||
}
|
||||
|
||||
function get_txp_comments()
|
||||
@ -143,18 +143,18 @@ class Textpattern_Import {
|
||||
set_magic_quotes_runtime(0);
|
||||
$prefix = get_option('tpre');
|
||||
|
||||
return $txpdb->get_results('SELECT
|
||||
id,
|
||||
date,
|
||||
category,
|
||||
url,
|
||||
linkname,
|
||||
description
|
||||
FROM '.$prefix.'txp_link',
|
||||
ARRAY_A);
|
||||
return $txpdb->get_results('SELECT
|
||||
id,
|
||||
date,
|
||||
category,
|
||||
url,
|
||||
linkname,
|
||||
description
|
||||
FROM '.$prefix.'txp_link',
|
||||
ARRAY_A);
|
||||
}
|
||||
|
||||
function cat2wp($categories='')
|
||||
function cat2wp($categories='')
|
||||
{
|
||||
// General Housekeeping
|
||||
global $wpdb;
|
||||
@ -164,7 +164,7 @@ class Textpattern_Import {
|
||||
if(is_array($categories))
|
||||
{
|
||||
echo '<p>'.__('Importing Categories...').'<br /><br /></p>';
|
||||
foreach ($categories as $category)
|
||||
foreach ($categories as $category)
|
||||
{
|
||||
$count++;
|
||||
extract($category);
|
||||
@ -226,7 +226,7 @@ class Textpattern_Import {
|
||||
'display_name' => $name)
|
||||
);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
$ret_id = wp_insert_user(array(
|
||||
'user_login' => $name,
|
||||
@ -302,35 +302,35 @@ class Textpattern_Import {
|
||||
if($pinfo = post_exists($Title,$Body))
|
||||
{
|
||||
$ret_id = wp_insert_post(array(
|
||||
'ID' => $pinfo,
|
||||
'post_date' => $Posted,
|
||||
'post_date_gmt' => $post_date_gmt,
|
||||
'post_author' => $authorid,
|
||||
'post_modified' => $LastMod,
|
||||
'post_modified_gmt' => $post_modified_gmt,
|
||||
'post_title' => $Title,
|
||||
'post_content' => $Body,
|
||||
'post_excerpt' => $Excerpt,
|
||||
'post_status' => $post_status,
|
||||
'post_name' => $url_title,
|
||||
'comment_count' => $comments_count)
|
||||
);
|
||||
'ID' => $pinfo,
|
||||
'post_date' => $Posted,
|
||||
'post_date_gmt' => $post_date_gmt,
|
||||
'post_author' => $authorid,
|
||||
'post_modified' => $LastMod,
|
||||
'post_modified_gmt' => $post_modified_gmt,
|
||||
'post_title' => $Title,
|
||||
'post_content' => $Body,
|
||||
'post_excerpt' => $Excerpt,
|
||||
'post_status' => $post_status,
|
||||
'post_name' => $url_title,
|
||||
'comment_count' => $comments_count)
|
||||
);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
$ret_id = wp_insert_post(array(
|
||||
'post_date' => $Posted,
|
||||
'post_date_gmt' => $post_date_gmt,
|
||||
'post_author' => $authorid,
|
||||
'post_modified' => $LastMod,
|
||||
'post_modified_gmt' => $post_modified_gmt,
|
||||
'post_title' => $Title,
|
||||
'post_content' => $Body,
|
||||
'post_excerpt' => $Excerpt,
|
||||
'post_status' => $post_status,
|
||||
'post_name' => $url_title,
|
||||
'comment_count' => $comments_count)
|
||||
);
|
||||
'post_date' => $Posted,
|
||||
'post_date_gmt' => $post_date_gmt,
|
||||
'post_author' => $authorid,
|
||||
'post_modified' => $LastMod,
|
||||
'post_modified_gmt' => $post_modified_gmt,
|
||||
'post_title' => $Title,
|
||||
'post_content' => $Body,
|
||||
'post_excerpt' => $Excerpt,
|
||||
'post_status' => $post_status,
|
||||
'post_name' => $url_title,
|
||||
'comment_count' => $comments_count)
|
||||
);
|
||||
}
|
||||
$txpposts2wpposts[$ID] = $ret_id;
|
||||
|
||||
@ -379,29 +379,29 @@ class Textpattern_Import {
|
||||
{
|
||||
// Update comments
|
||||
$ret_id = wp_update_comment(array(
|
||||
'comment_ID' => $cinfo,
|
||||
'comment_post_ID' => $comment_post_ID,
|
||||
'comment_author' => $name,
|
||||
'comment_author_email' => $email,
|
||||
'comment_author_url' => $web,
|
||||
'comment_date' => $posted,
|
||||
'comment_content' => $message,
|
||||
'comment_approved' => $comment_approved)
|
||||
);
|
||||
'comment_ID' => $cinfo,
|
||||
'comment_post_ID' => $comment_post_ID,
|
||||
'comment_author' => $name,
|
||||
'comment_author_email' => $email,
|
||||
'comment_author_url' => $web,
|
||||
'comment_date' => $posted,
|
||||
'comment_content' => $message,
|
||||
'comment_approved' => $comment_approved)
|
||||
);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
// Insert comments
|
||||
$ret_id = wp_insert_comment(array(
|
||||
'comment_post_ID' => $comment_post_ID,
|
||||
'comment_author' => $name,
|
||||
'comment_author_email' => $email,
|
||||
'comment_author_url' => $web,
|
||||
'comment_author_IP' => $ip,
|
||||
'comment_date' => $posted,
|
||||
'comment_content' => $message,
|
||||
'comment_approved' => $comment_approved)
|
||||
);
|
||||
'comment_post_ID' => $comment_post_ID,
|
||||
'comment_author' => $name,
|
||||
'comment_author_email' => $email,
|
||||
'comment_author_url' => $web,
|
||||
'comment_author_IP' => $ip,
|
||||
'comment_date' => $posted,
|
||||
'comment_content' => $message,
|
||||
'comment_approved' => $comment_approved)
|
||||
);
|
||||
}
|
||||
$txpcm2wpcm[$comment_ID] = $ret_id;
|
||||
}
|
||||
@ -450,7 +450,7 @@ class Textpattern_Import {
|
||||
'link_updated' => $date)
|
||||
);
|
||||
}
|
||||
else
|
||||
else
|
||||
{
|
||||
$ret_id = wp_insert_link(array(
|
||||
'link_url' => $url,
|
||||
@ -472,7 +472,7 @@ class Textpattern_Import {
|
||||
return false;
|
||||
}
|
||||
|
||||
function import_categories()
|
||||
function import_categories()
|
||||
{
|
||||
// Category Import
|
||||
$cats = $this->get_txp_cats();
|
||||
@ -490,7 +490,7 @@ class Textpattern_Import {
|
||||
function import_users()
|
||||
{
|
||||
// User Import
|
||||
$users = $this->get_txp_users();
|
||||
$users = $this->get_txp_users();
|
||||
$this->users2wp($users);
|
||||
|
||||
echo '<form action="admin.php?import=textpattern&step=3" method="post">';
|
||||
@ -578,7 +578,7 @@ class Textpattern_Import {
|
||||
echo '</table>';
|
||||
}
|
||||
|
||||
function dispatch()
|
||||
function dispatch()
|
||||
{
|
||||
|
||||
if (empty ($_GET['step']))
|
||||
@ -587,7 +587,7 @@ class Textpattern_Import {
|
||||
$step = (int) $_GET['step'];
|
||||
$this->header();
|
||||
|
||||
if ( $step > 0 )
|
||||
if ( $step > 0 )
|
||||
{
|
||||
if($_POST['dbuser'])
|
||||
{
|
||||
@ -612,19 +612,19 @@ class Textpattern_Import {
|
||||
{
|
||||
if(get_option('txphost'))
|
||||
delete_option('txphost');
|
||||
add_option('txphost',$_POST['dbhost']);
|
||||
add_option('txphost',$_POST['dbhost']);
|
||||
}
|
||||
if($_POST['dbprefix'])
|
||||
{
|
||||
if(get_option('tpre'))
|
||||
delete_option('tpre');
|
||||
add_option('tpre',$_POST['dbprefix']);
|
||||
add_option('tpre',$_POST['dbprefix']);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
switch ($step)
|
||||
switch ($step)
|
||||
{
|
||||
default:
|
||||
case 0 :
|
||||
@ -653,7 +653,7 @@ class Textpattern_Import {
|
||||
$this->footer();
|
||||
}
|
||||
|
||||
function Textpattern_Import()
|
||||
function Textpattern_Import()
|
||||
{
|
||||
// Nothing.
|
||||
}
|
||||
|
@ -58,9 +58,9 @@ class WP_Import {
|
||||
$pass = 'changeme';
|
||||
if (!(in_array($author, $this->mtnames))) { //a new mt author name is found
|
||||
++ $this->j;
|
||||
$this->mtnames[$this->j] = $author; //add that new mt author name to an array
|
||||
$this->mtnames[$this->j] = $author; //add that new mt author name to an array
|
||||
$user_id = username_exists($this->newauthornames[$this->j]); //check if the new author name defined by the user is a pre-existing wp user
|
||||
if (!$user_id) { //banging my head against the desk now.
|
||||
if (!$user_id) { //banging my head against the desk now.
|
||||
if ($newauthornames[$this->j] == 'left_blank') { //check if the user does not want to change the authorname
|
||||
$user_id = wp_create_user($author, $pass);
|
||||
$this->newauthornames[$this->j] = $author; //now we have a name, in the place of left_blank.
|
||||
@ -273,7 +273,7 @@ class WP_Import {
|
||||
|
||||
function import() {
|
||||
$this->id = (int) $_GET['id'];
|
||||
|
||||
|
||||
$this->file = get_attached_file($this->id);
|
||||
$this->get_authors_from_post();
|
||||
$this->get_entries();
|
||||
|
@ -46,11 +46,11 @@ if ( $comments || $numcomments ) :
|
||||
<?php endif; ?>
|
||||
|
||||
<ul>
|
||||
<?php
|
||||
<?php
|
||||
if ( $comments ) {
|
||||
foreach ($comments as $comment) {
|
||||
echo '<li>' . sprintf(__('%1$s on %2$s'), get_comment_author_link(), '<a href="'. get_permalink($comment->comment_post_ID) . '#comment-' . $comment->comment_ID . '">' . get_the_title($comment->comment_post_ID) . '</a>');
|
||||
edit_comment_link(__("Edit"), ' <small>(', ')</small>');
|
||||
edit_comment_link(__("Edit"), ' <small>(', ')</small>');
|
||||
echo '</li>';
|
||||
}
|
||||
}
|
||||
@ -80,7 +80,7 @@ foreach ($recentposts as $post) {
|
||||
|
||||
<?php
|
||||
if ( $scheduled = $wpdb->get_results("SELECT ID, post_title, post_date_gmt FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'future' ORDER BY post_date ASC") ) :
|
||||
?>
|
||||
?>
|
||||
<div>
|
||||
<h3><?php _e('Scheduled Entries:') ?></h3>
|
||||
<ul>
|
||||
@ -90,7 +90,7 @@ foreach ($scheduled as $post) {
|
||||
$post->post_title = sprintf(__('Post #%s'), $post->ID);
|
||||
echo "<li>" . sprintf(__('%1$s in %2$s'), "<a href='post.php?action=edit&post=$post->ID' title='" . __('Edit this post') . "'>$post->post_title</a>", human_time_diff( current_time('timestamp', 1), strtotime($post->post_date_gmt. ' GMT') )) . "</li>";
|
||||
}
|
||||
?>
|
||||
?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
@ -99,7 +99,7 @@ foreach ($scheduled as $post) {
|
||||
<h3><?php _e('Blog Stats'); ?></h3>
|
||||
<?php
|
||||
$numposts = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'publish'");
|
||||
if (0 < $numposts) $numposts = number_format($numposts);
|
||||
if (0 < $numposts) $numposts = number_format($numposts);
|
||||
|
||||
$numcomms = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '1'");
|
||||
if (0 < $numcomms) $numcomms = number_format($numcomms);
|
||||
|
@ -9,21 +9,21 @@ $debug = 0;
|
||||
** false on error
|
||||
*/
|
||||
function maybe_create_table($table_name, $create_ddl) {
|
||||
global $wpdb;
|
||||
foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
|
||||
if ($table == $table_name) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//didn't find it try to create it.
|
||||
$q = $wpdb->query($create_ddl);
|
||||
// we cannot directly tell that whether this succeeded!
|
||||
foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
|
||||
if ($table == $table_name) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
global $wpdb;
|
||||
foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
|
||||
if ($table == $table_name) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//didn't find it try to create it.
|
||||
$q = $wpdb->query($create_ddl);
|
||||
// we cannot directly tell that whether this succeeded!
|
||||
foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
|
||||
if ($table == $table_name) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -33,22 +33,22 @@ function maybe_create_table($table_name, $create_ddl) {
|
||||
** false on error
|
||||
*/
|
||||
function maybe_add_column($table_name, $column_name, $create_ddl) {
|
||||
global $wpdb, $debug;
|
||||
foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
|
||||
if ($debug) echo("checking $column == $column_name<br />");
|
||||
if ($column == $column_name) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//didn't find it try to create it.
|
||||
$q = $wpdb->query($create_ddl);
|
||||
// we cannot directly tell that whether this succeeded!
|
||||
foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
|
||||
if ($column == $column_name) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
global $wpdb, $debug;
|
||||
foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
|
||||
if ($debug) echo("checking $column == $column_name<br />");
|
||||
if ($column == $column_name) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//didn't find it try to create it.
|
||||
$q = $wpdb->query($create_ddl);
|
||||
// we cannot directly tell that whether this succeeded!
|
||||
foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
|
||||
if ($column == $column_name) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -59,21 +59,21 @@ function maybe_add_column($table_name, $column_name, $create_ddl) {
|
||||
** false on error
|
||||
*/
|
||||
function maybe_drop_column($table_name, $column_name, $drop_ddl) {
|
||||
global $wpdb;
|
||||
foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
|
||||
if ($column == $column_name) {
|
||||
//found it try to drop it.
|
||||
$q = $wpdb->query($drop_ddl);
|
||||
// we cannot directly tell that whether this succeeded!
|
||||
foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
|
||||
if ($column == $column_name) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// else didn't find it
|
||||
return true;
|
||||
global $wpdb;
|
||||
foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
|
||||
if ($column == $column_name) {
|
||||
//found it try to drop it.
|
||||
$q = $wpdb->query($drop_ddl);
|
||||
// we cannot directly tell that whether this succeeded!
|
||||
foreach ($wpdb->get_col("DESC $table_name",0) as $column ) {
|
||||
if ($column == $column_name) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// else didn't find it
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@ -92,45 +92,45 @@ function maybe_drop_column($table_name, $column_name, $drop_ddl) {
|
||||
** Extra
|
||||
*/
|
||||
function check_column($table_name, $col_name, $col_type, $is_null = null, $key = null, $default = null, $extra = null) {
|
||||
global $wpdb, $debug;
|
||||
$diffs = 0;
|
||||
$results = $wpdb->get_results("DESC $table_name");
|
||||
|
||||
foreach ($results as $row ) {
|
||||
if ($debug > 1) print_r($row);
|
||||
if ($row->Field == $col_name) {
|
||||
// got our column, check the params
|
||||
if ($debug) echo ("checking $row->Type against $col_type\n");
|
||||
if (($col_type != null) && ($row->Type != $col_type)) {
|
||||
++$diffs;
|
||||
}
|
||||
if (($is_null != null) && ($row->Null != $is_null)) {
|
||||
++$diffs;
|
||||
}
|
||||
if (($key != null) && ($row->Key != $key)) {
|
||||
++$diffs;
|
||||
}
|
||||
if (($default != null) && ($row->Default != $default)) {
|
||||
++$diffs;
|
||||
}
|
||||
if (($extra != null) && ($row->Extra != $extra)) {
|
||||
++$diffs;
|
||||
}
|
||||
if ($diffs > 0) {
|
||||
if ($debug) echo ("diffs = $diffs returning false\n");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} // end if found our column
|
||||
}
|
||||
return false;
|
||||
global $wpdb, $debug;
|
||||
$diffs = 0;
|
||||
$results = $wpdb->get_results("DESC $table_name");
|
||||
|
||||
foreach ($results as $row ) {
|
||||
if ($debug > 1) print_r($row);
|
||||
if ($row->Field == $col_name) {
|
||||
// got our column, check the params
|
||||
if ($debug) echo ("checking $row->Type against $col_type\n");
|
||||
if (($col_type != null) && ($row->Type != $col_type)) {
|
||||
++$diffs;
|
||||
}
|
||||
if (($is_null != null) && ($row->Null != $is_null)) {
|
||||
++$diffs;
|
||||
}
|
||||
if (($key != null) && ($row->Key != $key)) {
|
||||
++$diffs;
|
||||
}
|
||||
if (($default != null) && ($row->Default != $default)) {
|
||||
++$diffs;
|
||||
}
|
||||
if (($extra != null) && ($row->Extra != $extra)) {
|
||||
++$diffs;
|
||||
}
|
||||
if ($diffs > 0) {
|
||||
if ($debug) echo ("diffs = $diffs returning false\n");
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
} // end if found our column
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
echo "<p>testing</p>";
|
||||
echo "<pre>";
|
||||
|
||||
//check_column('wp_links', 'link_description', 'mediumtext');
|
||||
//check_column('wp_links', 'link_description', 'mediumtext');
|
||||
//if (check_column($wpdb->comments, 'comment_author', 'tinytext'))
|
||||
// echo "ok\n";
|
||||
$error_count = 0;
|
||||
@ -138,14 +138,14 @@ $tablename = $wpdb->links;
|
||||
// check the column
|
||||
if (!check_column($wpdb->links, 'link_description', 'varchar(255)'))
|
||||
{
|
||||
$ddl = "ALTER TABLE $wpdb->links MODIFY COLUMN link_description varchar(255) NOT NULL DEFAULT '' ";
|
||||
$q = $wpdb->query($ddl);
|
||||
$ddl = "ALTER TABLE $wpdb->links MODIFY COLUMN link_description varchar(255) NOT NULL DEFAULT '' ";
|
||||
$q = $wpdb->query($ddl);
|
||||
}
|
||||
if (check_column($wpdb->links, 'link_description', 'varchar(255)')) {
|
||||
$res .= $tablename . ' - ok <br />';
|
||||
$res .= $tablename . ' - ok <br />';
|
||||
} else {
|
||||
$res .= 'There was a problem with ' . $tablename . '<br />';
|
||||
++$error_count;
|
||||
$res .= 'There was a problem with ' . $tablename . '<br />';
|
||||
++$error_count;
|
||||
}
|
||||
echo "</pre>";
|
||||
*/
|
||||
|
@ -7,9 +7,9 @@ $parent_file = 'link-manager.php';
|
||||
|
||||
|
||||
wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image',
|
||||
'description', 'visible', 'target', 'category', 'link_id',
|
||||
'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel',
|
||||
'notes', 'linkcheck[]'));
|
||||
'description', 'visible', 'target', 'category', 'link_id',
|
||||
'submit', 'order_by', 'links_show_cat_id', 'rating', 'rel',
|
||||
'notes', 'linkcheck[]'));
|
||||
|
||||
wp_enqueue_script( array('xfn', 'dbx-admin-key?pagenow=link.php') );
|
||||
if ( current_user_can( 'manage_categories' ) )
|
||||
|
@ -143,8 +143,8 @@ if ($links)
|
||||
echo $link->link_description . "</td>";
|
||||
echo "<td><a href=\"$link->link_url\" title=\"".sprintf(__('Visit %s'), $link->link_name)."\">$short_url</a></td>";
|
||||
?>
|
||||
<td>
|
||||
<?php
|
||||
<td>
|
||||
<?php
|
||||
|
||||
$cat_names = array();
|
||||
foreach ($link->link_category as $category) {
|
||||
@ -157,8 +157,8 @@ if ($links)
|
||||
echo implode(', ', $cat_names);
|
||||
?>
|
||||
</td>
|
||||
<td><?php echo $link->link_rel; ?></td>
|
||||
<td align='center'><?php echo $visible; ?></td>
|
||||
<td><?php echo $link->link_rel; ?></td>
|
||||
<td align='center'><?php echo $visible; ?></td>
|
||||
<?php
|
||||
|
||||
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
|
||||
// we need to map XML attribute names to our columns
|
||||
$opml_map = array('URL' => 'link_url',
|
||||
'HTMLURL' => 'link_url',
|
||||
'TEXT' => 'link_name',
|
||||
'TITLE' => 'link_name',
|
||||
'TARGET' => 'link_target',
|
||||
'DESCRIPTION' => 'link_description',
|
||||
'XMLURL' => 'link_rss'
|
||||
'HTMLURL' => 'link_url',
|
||||
'TEXT' => 'link_name',
|
||||
'TITLE' => 'link_name',
|
||||
'TARGET' => 'link_target',
|
||||
'DESCRIPTION' => 'link_description',
|
||||
'XMLURL' => 'link_rss'
|
||||
);
|
||||
|
||||
$map = $opml_map;
|
||||
@ -20,24 +20,24 @@ $map = $opml_map;
|
||||
**/
|
||||
function startElement($parser, $tagName, $attrs) {
|
||||
global $updated_timestamp, $all_links, $map;
|
||||
global $names, $urls, $targets, $descriptions, $feeds;
|
||||
global $names, $urls, $targets, $descriptions, $feeds;
|
||||
|
||||
if ($tagName == 'OUTLINE') {
|
||||
foreach (array_keys($map) as $key) {
|
||||
if (isset($attrs[$key])) {
|
||||
$$map[$key] = $attrs[$key];
|
||||
}
|
||||
}
|
||||
foreach (array_keys($map) as $key) {
|
||||
if (isset($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.
|
||||
$names[] = $link_name;
|
||||
$urls[] = $link_url;
|
||||
$targets[] = $link_target;
|
||||
// save the data away.
|
||||
$names[] = $link_name;
|
||||
$urls[] = $link_url;
|
||||
$targets[] = $link_target;
|
||||
$feeds[] = $link_rss;
|
||||
$descriptions[] = $link_description;
|
||||
} // end if outline
|
||||
$descriptions[] = $link_description;
|
||||
} // end if outline
|
||||
}
|
||||
|
||||
/**
|
||||
@ -55,9 +55,9 @@ $xml_parser = xml_parser_create();
|
||||
xml_set_element_handler($xml_parser, "startElement", "endElement");
|
||||
|
||||
if (!xml_parse($xml_parser, $opml, true)) {
|
||||
echo(sprintf(__('XML error: %1$s at line %2$s'),
|
||||
xml_error_string(xml_get_error_code($xml_parser)),
|
||||
xml_get_current_line_number($xml_parser)));
|
||||
echo(sprintf(__('XML error: %1$s at line %2$s'),
|
||||
xml_error_string(xml_get_error_code($xml_parser)),
|
||||
xml_get_current_line_number($xml_parser)));
|
||||
}
|
||||
|
||||
// Free up memory used by the XML parser
|
||||
|
@ -29,7 +29,7 @@ switch ($action) {
|
||||
$deleted = 0;
|
||||
foreach ($linkcheck as $link_id) {
|
||||
$link_id = (int) $link_id;
|
||||
|
||||
|
||||
if ( wp_delete_link($link_id) )
|
||||
$deleted++;
|
||||
}
|
||||
|
@ -34,8 +34,8 @@ foreach ($menu as $item) {
|
||||
if ( isset($submenu["$parent_file"]) ) :
|
||||
?>
|
||||
<ul id="submenu">
|
||||
<?php
|
||||
foreach ($submenu["$parent_file"] as $item) :
|
||||
<?php
|
||||
foreach ($submenu["$parent_file"] as $item) :
|
||||
if ( !current_user_can($item[1]) )
|
||||
continue;
|
||||
|
||||
@ -65,7 +65,7 @@ else :
|
||||
<div id="minisub"></div>
|
||||
<?php
|
||||
|
||||
endif;
|
||||
endif;
|
||||
|
||||
do_action('admin_notices');
|
||||
|
||||
|
@ -83,14 +83,14 @@ foreach ($submenu as $parent => $sub) {
|
||||
$_wp_submenu_nopriv[$parent][$data[2]] = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ( empty($submenu[$parent]) )
|
||||
unset($submenu[$parent]);
|
||||
}
|
||||
|
||||
// Loop over the top-level menu.
|
||||
// Menus for which the original parent is not acessible due to lack of privs will have the next
|
||||
// submenu in line be assigned as the new menu parent.
|
||||
// submenu in line be assigned as the new menu parent.
|
||||
foreach ( $menu as $id => $data ) {
|
||||
if ( empty($submenu[$data[2]]) )
|
||||
continue;
|
||||
|
@ -31,7 +31,7 @@ case 'update':
|
||||
foreach($comment as $key => $value) {
|
||||
if ($feelinglucky && 'later' == $value)
|
||||
$value = 'delete';
|
||||
switch($value) {
|
||||
switch($value) {
|
||||
case 'later':
|
||||
// do nothing with that comment
|
||||
// wp_set_comment_status($key, "hold");
|
||||
@ -41,10 +41,10 @@ case 'update':
|
||||
wp_set_comment_status($key, 'delete');
|
||||
++$item_deleted;
|
||||
break;
|
||||
case 'spam':
|
||||
wp_set_comment_status($key, 'spam');
|
||||
++$item_spam;
|
||||
break;
|
||||
case 'spam':
|
||||
wp_set_comment_status($key, 'spam');
|
||||
++$item_spam;
|
||||
break;
|
||||
case 'approve':
|
||||
wp_set_comment_status($key, 'approve');
|
||||
if ( get_option('comments_notify') == true ) {
|
||||
@ -52,7 +52,7 @@ case 'update':
|
||||
}
|
||||
++$item_approved;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$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";
|
||||
}
|
||||
}
|
||||
if ($spam) {
|
||||
if ('1' == $spam) {
|
||||
if ($spam) {
|
||||
if ('1' == $spam) {
|
||||
echo __("1 comment marked as spam") . " <br/>\n";
|
||||
} else {
|
||||
echo sprintf(__("%s comments marked as spam"), $spam) . " <br/>\n";
|
||||
}
|
||||
}
|
||||
} else {
|
||||
echo sprintf(__("%s comments marked as spam"), $spam) . " <br/>\n";
|
||||
}
|
||||
}
|
||||
if ($ignored) {
|
||||
if ('1' == $ignored) {
|
||||
echo __("1 comment unchanged") . " <br/>\n";
|
||||
@ -151,13 +151,13 @@ $post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title;
|
||||
|
||||
</li>
|
||||
<?php
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ol>
|
||||
</ol>
|
||||
|
||||
<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">
|
||||
// <![CDATA[
|
||||
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>
|
||||
</p>
|
||||
</noscript>
|
||||
</form>
|
||||
</form>
|
||||
<?php
|
||||
} else {
|
||||
// nothing to approve
|
||||
// nothing to approve
|
||||
echo '<p>'.__("Currently there are no comments for you to moderate.") . "</p>\n";
|
||||
}
|
||||
?>
|
||||
|
@ -7,9 +7,9 @@ $parent_file = 'options-general.php';
|
||||
include('admin-header.php');
|
||||
|
||||
?>
|
||||
|
||||
<div class="wrap">
|
||||
<h2><?php _e('Miscellaneous Options') ?></h2>
|
||||
|
||||
<div class="wrap">
|
||||
<h2><?php _e('Miscellaneous Options') ?></h2>
|
||||
<form method="post" action="options.php">
|
||||
<?php wp_nonce_field('update-options') ?>
|
||||
<p class="submit"><input type="submit" name="Submit" value="<?php _e('Update Options »') ?>" /></p>
|
||||
@ -43,10 +43,10 @@ include('admin-header.php');
|
||||
|
||||
<p class="submit">
|
||||
<input type="hidden" name="action" value="update" />
|
||||
<input type="hidden" name="page_options" value="hack_file,use_linksupdate,uploads_use_yearmonth_folders,upload_path" />
|
||||
<input type="hidden" name="page_options" value="hack_file,use_linksupdate,uploads_use_yearmonth_folders,upload_path" />
|
||||
<input type="submit" name="Submit" value="<?php _e('Update Options »') ?>" />
|
||||
</p>
|
||||
</form>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php include('./admin-footer.php'); ?>
|
@ -144,7 +144,7 @@ $structures = array(
|
||||
<?php if ( !in_array($permalink_structure, $structures) ) { ?>
|
||||
checked="checked"
|
||||
<?php } ?>
|
||||
/>
|
||||
/>
|
||||
<?php _e('Custom, specify below'); ?>
|
||||
</label>
|
||||
<br />
|
||||
|
@ -6,30 +6,30 @@ $parent_file = 'options-general.php';
|
||||
|
||||
include('./admin-header.php');
|
||||
?>
|
||||
|
||||
|
||||
<div class="wrap">
|
||||
<h2><?php _e('Privacy Options') ?></h2>
|
||||
<form method="post" action="options.php">
|
||||
<form method="post" action="options.php">
|
||||
<?php wp_nonce_field('update-options') ?>
|
||||
<table class="optiontable">
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('Blog visibility:') ?> </th>
|
||||
<table class="optiontable">
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('Blog visibility:') ?> </th>
|
||||
<td>
|
||||
<p><input id="blog-public" type="radio" name="blog_public" value="1" <?php checked('1', get_option('blog_public')); ?> />
|
||||
<label for="blog-public"><?php _e('I would like my blog to be visible to everyone, including search engines (like Google, Sphere, Technorati) and archivers');?></label></p>
|
||||
<p><input id="blog-norobots" type="radio" name="blog_public" value="0" <?php checked('0', get_option('blog_public')); ?> />
|
||||
<label for="blog-norobots"><?php _e('I would like to block search engines, but allow normal visitors'); ?></label></p>
|
||||
<?php do_action('blog_privacy_selector'); ?>
|
||||
</td>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</table>
|
||||
|
||||
<p class="submit"><input type="submit" name="Submit" value="<?php _e('Update Options »') ?>" />
|
||||
<input type="hidden" name="action" value="update" />
|
||||
<input type="hidden" name="page_options" value="blog_public" />
|
||||
<input type="hidden" name="action" value="update" />
|
||||
<input type="hidden" name="page_options" value="blog_public" />
|
||||
</p>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php include('./admin-footer.php') ?>
|
||||
|
@ -65,7 +65,7 @@ endforeach;
|
||||
<tr valign="top">
|
||||
<th scope="row"><?php _e('Mail server:') ?></th>
|
||||
<td><input name="mailserver_url" type="text" id="mailserver_url" value="<?php form_option('mailserver_url'); ?>" size="40" />
|
||||
<label for="mailserver_port"><?php _e('Port:') ?></label>
|
||||
<label for="mailserver_port"><?php _e('Port:') ?></label>
|
||||
<input name="mailserver_port" type="text" id="mailserver_port" value="<?php form_option('mailserver_port'); ?>" size="6" />
|
||||
</td>
|
||||
</tr>
|
||||
@ -113,11 +113,11 @@ endforeach;
|
||||
</fieldset>
|
||||
|
||||
<p class="submit">
|
||||
<input type="hidden" name="action" value="update" />
|
||||
<input type="hidden" name="page_options" value="default_post_edit_rows,use_smilies,rich_editing,ping_sites,mailserver_url,mailserver_port,mailserver_login,mailserver_pass,default_category,default_email_category,use_balanceTags,default_link_category" />
|
||||
<input type="submit" name="Submit" value="<?php _e('Update Options »') ?>" />
|
||||
<input type="hidden" name="action" value="update" />
|
||||
<input type="hidden" name="page_options" value="default_post_edit_rows,use_smilies,rich_editing,ping_sites,mailserver_url,mailserver_port,mailserver_login,mailserver_pass,default_category,default_email_category,use_balanceTags,default_link_category" />
|
||||
<input type="submit" name="Submit" value="<?php _e('Update Options »') ?>" />
|
||||
</p>
|
||||
</form>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<?php include('./admin-footer.php') ?>
|
@ -61,8 +61,8 @@ default:
|
||||
<?php if (isset($_GET['a'])) : ?>
|
||||
<div id="message" class="updated fade"><p><?php _e('File edited successfully.') ?></p></div>
|
||||
<?php endif; ?>
|
||||
<div class="wrap">
|
||||
<?php
|
||||
<div class="wrap">
|
||||
<?php
|
||||
if (is_writeable($real_file)) {
|
||||
echo '<h2>' . sprintf(__('Editing <strong>%s</strong>'), $file) . '</h2>';
|
||||
} else {
|
||||
@ -75,39 +75,39 @@ default:
|
||||
<?php
|
||||
if ($plugin_files) :
|
||||
?>
|
||||
<ul>
|
||||
<?php foreach($plugin_files as $plugin_file) : ?>
|
||||
<ul>
|
||||
<?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>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php if (!$error) { ?>
|
||||
<form name="template" id="template" action="plugin-editor.php" method="post">
|
||||
<?php wp_nonce_field('edit-plugin_' . $file) ?>
|
||||
<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="file" value="<?php echo $file ?>" />
|
||||
<?php if (!$error) { ?>
|
||||
<form name="template" id="template" action="plugin-editor.php" method="post">
|
||||
<?php wp_nonce_field('edit-plugin_' . $file) ?>
|
||||
<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="file" value="<?php echo $file ?>" />
|
||||
</div>
|
||||
<?php if ( is_writeable($real_file) ) : ?>
|
||||
<p class="submit">
|
||||
<?php
|
||||
echo "<input type='submit' name='submit' value=' " . __('Update File »') . "' tabindex='2' />";
|
||||
?>
|
||||
</p>
|
||||
<p class="submit">
|
||||
<?php
|
||||
echo "<input type='submit' name='submit' value=' " . __('Update File »') . "' tabindex='2' />";
|
||||
?>
|
||||
</p>
|
||||
<?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; ?>
|
||||
</form>
|
||||
<?php
|
||||
</form>
|
||||
<?php
|
||||
} else {
|
||||
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>
|
||||
</div>
|
||||
<?php
|
||||
break;
|
||||
}
|
||||
|
||||
include("admin-footer.php") ?>
|
||||
include("admin-footer.php") ?>
|
||||
|
@ -15,7 +15,7 @@ case 'post':
|
||||
$parent_file = 'post-new.php';
|
||||
$submenu_file = 'post-new.php';
|
||||
check_admin_referer('add-post');
|
||||
|
||||
|
||||
$post_ID = 'post' == $action ? write_post() : edit_post();
|
||||
|
||||
// Redirect.
|
||||
@ -89,7 +89,7 @@ case 'editattachment':
|
||||
case 'editpost':
|
||||
$post_ID = (int) $_POST['post_ID'];
|
||||
check_admin_referer('update-post_' . $post_ID);
|
||||
|
||||
|
||||
$post_ID = edit_post();
|
||||
|
||||
if ( 'post' == $_POST['originalaction'] ) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php
|
||||
require_once('admin.php');
|
||||
|
||||
$title = __('Profile');
|
||||
@ -121,13 +121,13 @@ if ( $show_password_fields ) :
|
||||
|
||||
<br clear="all" />
|
||||
|
||||
<table width="99%" border="0" cellspacing="2" cellpadding="3" class="editform">
|
||||
<?php
|
||||
if(count($profileuser->caps) > count($profileuser->roles)):
|
||||
?>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('Additional Capabilities:') ?></th>
|
||||
<td><?php
|
||||
<table width="99%" border="0" cellspacing="2" cellpadding="3" class="editform">
|
||||
<?php
|
||||
if(count($profileuser->caps) > count($profileuser->roles)):
|
||||
?>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('Additional Capabilities:') ?></th>
|
||||
<td><?php
|
||||
$output = '';
|
||||
foreach($profileuser->caps as $cap => $value) {
|
||||
if(!$wp_roles->is_role($cap)) {
|
||||
|
@ -2,7 +2,7 @@
|
||||
define('WP_INSTALLING', true);
|
||||
|
||||
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');
|
||||
|
||||
@ -82,103 +82,103 @@ if (file_exists('../wp-config.php'))
|
||||
|
||||
switch($step) {
|
||||
case 0:
|
||||
?>
|
||||
?>
|
||||
|
||||
<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>
|
||||
<li>Database name</li>
|
||||
<li>Database username</li>
|
||||
<li>Database password</li>
|
||||
<li>Database host</li>
|
||||
<li>Table prefix (if you want to run more than one WordPress in a single database) </li>
|
||||
</ol>
|
||||
<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>
|
||||
<li>Database name</li>
|
||||
<li>Database username</li>
|
||||
<li>Database password</li>
|
||||
<li>Database host</li>
|
||||
<li>Table prefix (if you want to run more than one WordPress in a single database) </li>
|
||||
</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>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>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 1:
|
||||
?>
|
||||
</p>
|
||||
?>
|
||||
</p>
|
||||
<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>
|
||||
<table>
|
||||
<tr>
|
||||
<th scope="row">Database Name</th>
|
||||
<td><input name="dbname" type="text" size="25" value="wordpress" /></td>
|
||||
<td>The name of the database you want to run WP in. </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">User Name</th>
|
||||
<td><input name="uname" type="text" size="25" value="username" /></td>
|
||||
<td>Your MySQL username</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Password</th>
|
||||
<td><input name="pwd" type="text" size="25" value="password" /></td>
|
||||
<td>...and MySQL password.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Database Host</th>
|
||||
<td><input name="dbhost" type="text" size="25" value="localhost" /></td>
|
||||
<td>99% chance you won't need to change this value.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Table Prefix</th>
|
||||
<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>
|
||||
</tr>
|
||||
</table>
|
||||
<h2 class="step">
|
||||
<input name="submit" type="submit" value="Submit" />
|
||||
</h2>
|
||||
</form>
|
||||
<p>Below you should enter your database connection details. If you're not sure about these, contact your host. </p>
|
||||
<table>
|
||||
<tr>
|
||||
<th scope="row">Database Name</th>
|
||||
<td><input name="dbname" type="text" size="25" value="wordpress" /></td>
|
||||
<td>The name of the database you want to run WP in. </td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">User Name</th>
|
||||
<td><input name="uname" type="text" size="25" value="username" /></td>
|
||||
<td>Your MySQL username</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Password</th>
|
||||
<td><input name="pwd" type="text" size="25" value="password" /></td>
|
||||
<td>...and MySQL password.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Database Host</th>
|
||||
<td><input name="dbhost" type="text" size="25" value="localhost" /></td>
|
||||
<td>99% chance you won't need to change this value.</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row">Table Prefix</th>
|
||||
<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>
|
||||
</tr>
|
||||
</table>
|
||||
<h2 class="step">
|
||||
<input name="submit" type="submit" value="Submit" />
|
||||
</h2>
|
||||
</form>
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 2:
|
||||
$dbname = trim($_POST['dbname']);
|
||||
$uname = trim($_POST['uname']);
|
||||
$passwrd = trim($_POST['pwd']);
|
||||
$dbhost = trim($_POST['dbhost']);
|
||||
$uname = trim($_POST['uname']);
|
||||
$passwrd = trim($_POST['pwd']);
|
||||
$dbhost = trim($_POST['dbhost']);
|
||||
$prefix = trim($_POST['prefix']);
|
||||
if (empty($prefix)) $prefix = 'wp_';
|
||||
|
||||
// Test the db connection.
|
||||
define('DB_NAME', $dbname);
|
||||
define('DB_USER', $uname);
|
||||
define('DB_PASSWORD', $passwrd);
|
||||
define('DB_HOST', $dbhost);
|
||||
// Test the db connection.
|
||||
define('DB_NAME', $dbname);
|
||||
define('DB_USER', $uname);
|
||||
define('DB_PASSWORD', $passwrd);
|
||||
define('DB_HOST', $dbhost);
|
||||
|
||||
// We'll fail here if the values are no good.
|
||||
require_once('../wp-includes/wp-db.php');
|
||||
// We'll fail here if the values are no good.
|
||||
require_once('../wp-includes/wp-db.php');
|
||||
$handle = fopen('../wp-config.php', 'w');
|
||||
|
||||
foreach ($configFile as $line_num => $line) {
|
||||
switch (substr($line,0,16)) {
|
||||
case "define('DB_NAME'":
|
||||
fwrite($handle, str_replace("wordpress", $dbname, $line));
|
||||
break;
|
||||
case "define('DB_USER'":
|
||||
fwrite($handle, str_replace("'username'", "'$uname'", $line));
|
||||
break;
|
||||
case "define('DB_PASSW":
|
||||
fwrite($handle, str_replace("'password'", "'$passwrd'", $line));
|
||||
break;
|
||||
case "define('DB_HOST'":
|
||||
fwrite($handle, str_replace("localhost", $dbhost, $line));
|
||||
break;
|
||||
foreach ($configFile as $line_num => $line) {
|
||||
switch (substr($line,0,16)) {
|
||||
case "define('DB_NAME'":
|
||||
fwrite($handle, str_replace("wordpress", $dbname, $line));
|
||||
break;
|
||||
case "define('DB_USER'":
|
||||
fwrite($handle, str_replace("'username'", "'$uname'", $line));
|
||||
break;
|
||||
case "define('DB_PASSW":
|
||||
fwrite($handle, str_replace("'password'", "'$passwrd'", $line));
|
||||
break;
|
||||
case "define('DB_HOST'":
|
||||
fwrite($handle, str_replace("localhost", $dbhost, $line));
|
||||
break;
|
||||
case '$table_prefix =':
|
||||
fwrite($handle, str_replace('wp_', $prefix, $line));
|
||||
break;
|
||||
default:
|
||||
fwrite($handle, $line);
|
||||
}
|
||||
}
|
||||
fclose($handle);
|
||||
default:
|
||||
fwrite($handle, $line);
|
||||
}
|
||||
}
|
||||
fclose($handle);
|
||||
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>
|
||||
<?php
|
||||
break;
|
||||
}
|
||||
|
@ -34,15 +34,15 @@ form {
|
||||
padding: 3px;
|
||||
}
|
||||
.sidebar-categories {
|
||||
display: block;
|
||||
height: 6.6em;
|
||||
overflow: auto;
|
||||
background-color: #f4f4f4;
|
||||
display: block;
|
||||
height: 6.6em;
|
||||
overflow: auto;
|
||||
background-color: #f4f4f4;
|
||||
}
|
||||
.sidebar-categories label {
|
||||
font-size: 10px;
|
||||
display: block;
|
||||
width: 90%;
|
||||
display: block;
|
||||
width: 90%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
@ -65,9 +65,9 @@ Post:
|
||||
<textarea rows="8" cols="12" style="width: 100%" name="content" tabindex="2"></textarea>
|
||||
</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') ) : ?>
|
||||
<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; ?>
|
||||
</p>
|
||||
</div>
|
||||
|
@ -82,7 +82,7 @@ default:
|
||||
<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
|
||||
if (is_writeable($real_file)) {
|
||||
echo '<h2>' . sprintf(__('Editing <strong>%s</strong>'), wp_specialchars($file) ) . '</h2>';
|
||||
@ -91,8 +91,8 @@ if (is_writeable($real_file)) {
|
||||
}
|
||||
?>
|
||||
<div id="templateside">
|
||||
<?php
|
||||
if ( $recents ) :
|
||||
<?php
|
||||
if ( $recents ) :
|
||||
?>
|
||||
<h3><?php _e('Recent'); ?></h3>
|
||||
<?php
|
||||
@ -110,21 +110,21 @@ endif;
|
||||
if (file_exists(ABSPATH . $old_file))
|
||||
$common_files[] = $old_file;
|
||||
} ?>
|
||||
<ul>
|
||||
<?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>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
<ul>
|
||||
<?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>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php if (!$error) { ?>
|
||||
<form name="template" id="template" action="templates.php" method="post">
|
||||
<?php wp_nonce_field('edit-file_' . $file) ?>
|
||||
<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="file" value="<?php echo $file ?>" />
|
||||
</div>
|
||||
<form name="template" id="template" action="templates.php" method="post">
|
||||
<?php wp_nonce_field('edit-file_' . $file) ?>
|
||||
<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="file" value="<?php echo $file ?>" />
|
||||
</div>
|
||||
<?php if ( is_writeable($real_file) ) : ?>
|
||||
<p class="submit">
|
||||
<p class="submit">
|
||||
<?php
|
||||
echo "<input type='submit' name='submit' value=' " . __('Update File »') . "' tabindex='2' />";
|
||||
?>
|
||||
@ -132,8 +132,8 @@ endif;
|
||||
<?php else : ?>
|
||||
<p><em><?php _e('If this file were writable you could edit it.'); ?></em></p>
|
||||
<?php endif; ?>
|
||||
</form>
|
||||
<?php
|
||||
</form>
|
||||
<?php
|
||||
} else {
|
||||
echo '<div class="error"><p>' . __('Oops, no such file exists! Double check the name and try again, merci.') . '</p></div>';
|
||||
}
|
||||
@ -143,14 +143,14 @@ endif;
|
||||
<div class="wrap">
|
||||
<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>
|
||||
<form name="file" action="templates.php" method="get">
|
||||
<input type="text" name="file" />
|
||||
<input type="submit" name="submit" value="<?php _e('Edit file »') ?>" />
|
||||
</form>
|
||||
<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">
|
||||
<input type="text" name="file" />
|
||||
<input type="submit" name="submit" value="<?php _e('Edit file »') ?>" />
|
||||
</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>
|
||||
</div>
|
||||
<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>
|
||||
<?php
|
||||
|
||||
break;
|
||||
|
@ -80,7 +80,7 @@ default:
|
||||
<div id="message" class="updated fade"><p><?php _e('File edited successfully.') ?></p></div>
|
||||
<?php endif; ?>
|
||||
<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:') ?>
|
||||
<select name="theme" id="theme">
|
||||
<?php
|
||||
@ -106,30 +106,30 @@ default:
|
||||
}
|
||||
?>
|
||||
<div id="templateside">
|
||||
<h3><?php printf(__("<strong>'%s'</strong> theme files"), $theme) ?></h3>
|
||||
<h3><?php printf(__("<strong>'%s'</strong> theme files"), $theme) ?></h3>
|
||||
|
||||
<?php
|
||||
if ($allowed_files) :
|
||||
?>
|
||||
<ul>
|
||||
<ul>
|
||||
<?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>
|
||||
<?php endforeach; ?>
|
||||
</ul>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
if (!$error) {
|
||||
?>
|
||||
<form name="template" id="template" action="theme-editor.php" method="post">
|
||||
<?php wp_nonce_field('edit-theme_' . $file . $theme) ?>
|
||||
<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="file" value="<?php echo $file ?>" />
|
||||
<input type="hidden" name="theme" value="<?php echo $theme ?>" />
|
||||
?>
|
||||
<form name="template" id="template" action="theme-editor.php" method="post">
|
||||
<?php wp_nonce_field('edit-theme_' . $file . $theme) ?>
|
||||
<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="file" value="<?php echo $file ?>" />
|
||||
<input type="hidden" name="theme" value="<?php echo $theme ?>" />
|
||||
</div>
|
||||
<?php if ( is_writeable($real_file) ) : ?>
|
||||
<p class="submit">
|
||||
<p class="submit">
|
||||
<?php
|
||||
echo "<input type='submit' name='submit' value=' " . __('Update File »') . "' tabindex='2' />";
|
||||
?>
|
||||
@ -137,16 +137,16 @@ if ($allowed_files) :
|
||||
<?php else : ?>
|
||||
<p><em><?php _e('If this file were writable you could edit it.'); ?></em></p>
|
||||
<?php endif; ?>
|
||||
</form>
|
||||
<?php
|
||||
</form>
|
||||
<?php
|
||||
} else {
|
||||
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>
|
||||
</div>
|
||||
<?php
|
||||
break;
|
||||
}
|
||||
|
||||
include("admin-footer.php") ?>
|
||||
include("admin-footer.php") ?>
|
||||
|
@ -112,10 +112,10 @@ if ( count($broken_themes) ) {
|
||||
|
||||
$theme = ('class="alternate"' == $theme) ? '' : 'class="alternate"';
|
||||
echo "
|
||||
<tr $theme>
|
||||
<td>$title</td>
|
||||
<td>$description</td>
|
||||
</tr>";
|
||||
<tr $theme>
|
||||
<td>$title</td>
|
||||
<td>$description</td>
|
||||
</tr>";
|
||||
}
|
||||
?>
|
||||
</table>
|
||||
|
@ -28,13 +28,13 @@ if ( false !== ( $fs = @fsockopen('api.pingomatic.com', 80, $errno, $errstr, 5)
|
||||
while ( !feof($fs) )
|
||||
$response .= fgets($fs, 1160); // One TCP-IP packet
|
||||
fclose($fs);
|
||||
|
||||
|
||||
$response = explode("\r\n\r\n", $response, 2);
|
||||
$body = trim( $response[1] );
|
||||
$body = str_replace(array("\r\n", "\r"), "\n", $body);
|
||||
|
||||
|
||||
$returns = explode("\n", $body);
|
||||
|
||||
|
||||
foreach ($returns as $return) :
|
||||
$time = $wpdb->escape( substr($return, 0, 19) );
|
||||
$uri = $wpdb->escape( preg_replace('/(.*?) | (.*?)/', '$2', $return) );
|
||||
|
@ -120,7 +120,7 @@ We hope you enjoy your new weblog. Thanks!
|
||||
http://wordpress.org/
|
||||
"), $blog_url, $name, $password);
|
||||
|
||||
@wp_mail($email, __('New WordPress Blog'), $message, $message_headers);
|
||||
@wp_mail($email, __('New WordPress Blog'), $message, $message_headers);
|
||||
}
|
||||
endif;
|
||||
|
||||
@ -137,7 +137,7 @@ function wp_upgrade() {
|
||||
wp_cache_flush();
|
||||
make_db_current_silent();
|
||||
upgrade_all();
|
||||
wp_cache_flush();
|
||||
wp_cache_flush();
|
||||
}
|
||||
endif;
|
||||
|
||||
@ -187,7 +187,7 @@ function upgrade_100() {
|
||||
$posts = $wpdb->get_results("SELECT ID, post_title, post_name FROM $wpdb->posts WHERE post_name = ''");
|
||||
if ($posts) {
|
||||
foreach($posts as $post) {
|
||||
if ('' == $post->post_name) {
|
||||
if ('' == $post->post_name) {
|
||||
$newtitle = sanitize_title($post->post_title);
|
||||
$wpdb->query("UPDATE $wpdb->posts SET post_name = '$newtitle' WHERE ID = '$post->ID'");
|
||||
}
|
||||
@ -196,7 +196,7 @@ function upgrade_100() {
|
||||
|
||||
$categories = $wpdb->get_results("SELECT cat_ID, cat_name, category_nicename FROM $wpdb->categories");
|
||||
foreach ($categories as $category) {
|
||||
if ('' == $category->category_nicename) {
|
||||
if ('' == $category->category_nicename) {
|
||||
$newtitle = sanitize_title($category->cat_name);
|
||||
$wpdb->query("UPDATE $wpdb->categories SET category_nicename = '$newtitle' WHERE cat_ID = '$category->cat_ID'");
|
||||
}
|
||||
@ -251,19 +251,19 @@ function upgrade_101() {
|
||||
function upgrade_110() {
|
||||
global $wpdb;
|
||||
|
||||
// Set user_nicename.
|
||||
// Set user_nicename.
|
||||
$users = $wpdb->get_results("SELECT ID, user_nickname, user_nicename FROM $wpdb->users");
|
||||
foreach ($users as $user) {
|
||||
if ('' == $user->user_nicename) {
|
||||
$newname = sanitize_title($user->user_nickname);
|
||||
$wpdb->query("UPDATE $wpdb->users SET user_nicename = '$newname' WHERE ID = '$user->ID'");
|
||||
}
|
||||
}
|
||||
foreach ($users as $user) {
|
||||
if ('' == $user->user_nicename) {
|
||||
$newname = sanitize_title($user->user_nickname);
|
||||
$wpdb->query("UPDATE $wpdb->users SET user_nicename = '$newname' WHERE ID = '$user->ID'");
|
||||
}
|
||||
}
|
||||
|
||||
$users = $wpdb->get_results("SELECT ID, user_pass from $wpdb->users");
|
||||
foreach ($users as $row) {
|
||||
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() {
|
||||
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");
|
||||
if ($posts) {
|
||||
foreach($posts as $post) {
|
||||
$post_content = addslashes(deslash($post->post_content));
|
||||
$post_title = addslashes(deslash($post->post_title));
|
||||
$post_excerpt = addslashes(deslash($post->post_excerpt));
|
||||
$post_content = addslashes(deslash($post->post_content));
|
||||
$post_title = addslashes(deslash($post->post_title));
|
||||
$post_excerpt = addslashes(deslash($post->post_excerpt));
|
||||
if ( empty($post->guid) )
|
||||
$guid = get_permalink($post->ID);
|
||||
else
|
||||
$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");
|
||||
if ($comments) {
|
||||
foreach($comments as $comment) {
|
||||
$comment_content = addslashes(deslash($comment->comment_content));
|
||||
$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'");
|
||||
$comment_content = addslashes(deslash($comment->comment_content));
|
||||
$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'");
|
||||
}
|
||||
}
|
||||
|
||||
// Remove extraneous backslashes.
|
||||
// Remove extraneous backslashes.
|
||||
$links = $wpdb->get_results("SELECT link_id, link_name, link_description FROM $wpdb->links");
|
||||
if ($links) {
|
||||
foreach($links as $link) {
|
||||
$link_name = addslashes(deslash($link->link_name));
|
||||
$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'");
|
||||
$link_name = addslashes(deslash($link->link_name));
|
||||
$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'");
|
||||
}
|
||||
}
|
||||
|
||||
// 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') {
|
||||
$wpdb->query("UPDATE $wpdb->options SET option_value = 'posts' WHERE option_name = 'what_to_show'");
|
||||
}
|
||||
// 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') {
|
||||
$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
|
||||
// newline separated format. Convert to new format.
|
||||
if ( !is_array( $active_plugins ) ) {
|
||||
$active_plugins = explode("\n", trim($active_plugins));
|
||||
update_option('active_plugins', $active_plugins);
|
||||
}
|
||||
// If plugins are not stored in an array, they're stored in the old
|
||||
// newline separated format. Convert to new format.
|
||||
if ( !is_array( $active_plugins ) ) {
|
||||
$active_plugins = explode("\n", trim($active_plugins));
|
||||
update_option('active_plugins', $active_plugins);
|
||||
}
|
||||
|
||||
// Obsolete tables
|
||||
$wpdb->query('DROP TABLE IF EXISTS ' . $wpdb->prefix . 'optionvalues');
|
||||
@ -499,7 +499,7 @@ function upgrade_210() {
|
||||
// Give future posts a post_status of future.
|
||||
$now = gmdate('Y-m-d H:i:59');
|
||||
$wpdb->query ("UPDATE $wpdb->posts SET post_status = 'future' WHERE post_status = 'publish' AND post_date_gmt > '$now'");
|
||||
|
||||
|
||||
$posts = $wpdb->get_results("SELECT ID, post_date FROM $wpdb->posts WHERE post_status ='future'");
|
||||
if ( !empty($posts) )
|
||||
foreach ( $posts as $post )
|
||||
@ -508,7 +508,7 @@ function upgrade_210() {
|
||||
if ( $wp_current_db_version < 3570 ) {
|
||||
// Create categories for link categories if a category with the same
|
||||
// name doesn't exist. Create a map of link cat IDs to cat IDs.
|
||||
$link_cats = $wpdb->get_results("SELECT cat_id, cat_name FROM $wpdb->linkcategories");
|
||||
$link_cats = $wpdb->get_results("SELECT cat_id, cat_name FROM $wpdb->linkcategories");
|
||||
foreach ( $link_cats as $link_cat) {
|
||||
if ( $cat_id = category_exists($link_cat->cat_name) ) {
|
||||
$link_cat_id_map[$link_cat->cat_id] = $cat_id;
|
||||
@ -527,9 +527,9 @@ function upgrade_210() {
|
||||
if (!$cat && 0 != $link->link_category) {
|
||||
$wpdb->query("INSERT INTO $wpdb->link2cat (link_id, category_id)
|
||||
VALUES ('$link->link_id', '$link_cat')");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Set default to the last category we grabbed during the upgrade loop.
|
||||
update_option('default_link_category', $default_link_cat);
|
||||
|
||||
@ -548,21 +548,21 @@ function upgrade_210() {
|
||||
|
||||
// General
|
||||
function maybe_create_table($table_name, $create_ddl) {
|
||||
global $wpdb;
|
||||
foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
|
||||
if ($table == $table_name) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//didn't find it try to create it.
|
||||
$q = $wpdb->query($create_ddl);
|
||||
// we cannot directly tell that whether this succeeded!
|
||||
foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
|
||||
if ($table == $table_name) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
global $wpdb;
|
||||
foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
|
||||
if ($table == $table_name) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//didn't find it try to create it.
|
||||
$q = $wpdb->query($create_ddl);
|
||||
// we cannot directly tell that whether this succeeded!
|
||||
foreach ($wpdb->get_col("SHOW TABLES",0) as $table ) {
|
||||
if ($table == $table_name) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
function drop_index($table, $index) {
|
||||
@ -591,22 +591,22 @@ function add_clean_index($table, $index) {
|
||||
** false on error
|
||||
*/
|
||||
function maybe_add_column($table_name, $column_name, $create_ddl) {
|
||||
global $wpdb, $debug;
|
||||
foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) {
|
||||
if ($debug) echo("checking $column == $column_name<br />");
|
||||
if ($column == $column_name) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//didn't find it try to create it.
|
||||
$q = $wpdb->query($create_ddl);
|
||||
// we cannot directly tell that whether this succeeded!
|
||||
foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) {
|
||||
if ($column == $column_name) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
global $wpdb, $debug;
|
||||
foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) {
|
||||
if ($debug) echo("checking $column == $column_name<br />");
|
||||
if ($column == $column_name) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
//didn't find it try to create it.
|
||||
$q = $wpdb->query($create_ddl);
|
||||
// we cannot directly tell that whether this succeeded!
|
||||
foreach ($wpdb->get_col("DESC $table_name", 0) as $column ) {
|
||||
if ($column == $column_name) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -615,7 +615,7 @@ function get_alloptions_110() {
|
||||
global $wpdb;
|
||||
if ($options = $wpdb->get_results("SELECT option_name, option_value FROM $wpdb->options")) {
|
||||
foreach ($options as $option) {
|
||||
// "When trying to design a foolproof system,
|
||||
// "When trying to design a foolproof system,
|
||||
// never underestimate the ingenuity of the fools :)" -- Dougal
|
||||
if ('siteurl' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value);
|
||||
if ('home' == $option->option_name) $option->option_value = preg_replace('|/+$|', '', $option->option_value);
|
||||
@ -646,20 +646,20 @@ function __get_option($setting) {
|
||||
}
|
||||
|
||||
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
|
||||
// a single quote.
|
||||
$content = preg_replace("/\\\+'/", "'", $content);
|
||||
// Replace one or more backslashes followed by a single quote with
|
||||
// a single quote.
|
||||
$content = preg_replace("/\\\+'/", "'", $content);
|
||||
|
||||
// Replace one or more backslashes followed by a double quote with
|
||||
// a double quote.
|
||||
$content = preg_replace('/\\\+"/', '"', $content);
|
||||
// Replace one or more backslashes followed by a double quote with
|
||||
// a double quote.
|
||||
$content = preg_replace('/\\\+"/', '"', $content);
|
||||
|
||||
// Replace one or more backslashes with one backslash.
|
||||
$content = preg_replace("/\\\+/", "\\", $content);
|
||||
// Replace one or more backslashes with one backslash.
|
||||
$content = preg_replace("/\\\+/", "\\", $content);
|
||||
|
||||
return $content;
|
||||
return $content;
|
||||
}
|
||||
|
||||
function dbDelta($queries, $execute = true) {
|
||||
@ -826,7 +826,7 @@ function dbDelta($queries, $execute = true) {
|
||||
$index_columns .= '('.$column_data['subpart'].')';
|
||||
}
|
||||
}
|
||||
// Add the column list to the index create string
|
||||
// Add the column list to the index create string
|
||||
$index_string .= ' ('.$index_columns.')';
|
||||
|
||||
if(!(($aindex = array_search($index_string, $indices)) === false)) {
|
||||
|
@ -223,7 +223,7 @@ function populate_options() {
|
||||
add_option('uploads_use_yearmonth_folders', 1);
|
||||
add_option('upload_path', 'wp-content/uploads');
|
||||
}
|
||||
|
||||
|
||||
// 2.0.3
|
||||
add_option('secret', md5(uniqid(microtime())));
|
||||
|
||||
|
@ -56,6 +56,6 @@ switch($step) {
|
||||
<?php
|
||||
break;
|
||||
}
|
||||
?>
|
||||
?>
|
||||
</body>
|
||||
</html>
|
@ -186,13 +186,13 @@ if ( $show_password_fields ) :
|
||||
<?php do_action('edit_user_profile'); ?>
|
||||
|
||||
<br clear="all" />
|
||||
<table width="99%" border="0" cellspacing="2" cellpadding="3" class="editform">
|
||||
<?php
|
||||
if(count($profileuser->caps) > count($profileuser->roles)):
|
||||
?>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('Additional Capabilities:') ?></th>
|
||||
<td><?php
|
||||
<table width="99%" border="0" cellspacing="2" cellpadding="3" class="editform">
|
||||
<?php
|
||||
if(count($profileuser->caps) > count($profileuser->roles)):
|
||||
?>
|
||||
<tr>
|
||||
<th scope="row"><?php _e('Additional Capabilities:') ?></th>
|
||||
<td><?php
|
||||
$output = '';
|
||||
foreach($profileuser->caps as $cap => $value) {
|
||||
if(!$wp_roles->is_role($cap)) {
|
||||
@ -202,15 +202,15 @@ if ( $show_password_fields ) :
|
||||
}
|
||||
echo $output;
|
||||
?></td>
|
||||
</tr>
|
||||
<?php
|
||||
endif;
|
||||
?>
|
||||
</table>
|
||||
</tr>
|
||||
<?php
|
||||
endif;
|
||||
?>
|
||||
</table>
|
||||
<p class="submit">
|
||||
<input type="hidden" name="action" value="update" />
|
||||
<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>
|
||||
</form>
|
||||
</div>
|
||||
|
@ -283,7 +283,7 @@ form#upload #post_content {
|
||||
}
|
||||
|
||||
.commentlist li {
|
||||
border-bottom: 1px solid #ccc;
|
||||
border-bottom: 1px solid #ccc;
|
||||
padding: 1em 1em .2em;
|
||||
margin: 0;
|
||||
}
|
||||
@ -954,8 +954,8 @@ input.delete:hover {
|
||||
}
|
||||
|
||||
/* A handy div class for hiding controls.
|
||||
Some browsers will disable them when you
|
||||
set display:none; */
|
||||
Some browsers will disable them when you
|
||||
set display:none; */
|
||||
.zerosize {
|
||||
height: 0px;
|
||||
width: 0px;
|
||||
@ -995,9 +995,9 @@ input.delete:hover {
|
||||
}
|
||||
|
||||
/****************************************************************
|
||||
avoid padding, margins or borders on dbx-box,
|
||||
to reduce visual discrepancies between it and the clone.
|
||||
overall, dbx-box is best left as visually unstyled as possible
|
||||
avoid padding, margins or borders on dbx-box,
|
||||
to reduce visual discrepancies between it and the clone.
|
||||
overall, dbx-box is best left as visually unstyled as possible
|
||||
*****************************************************************/
|
||||
.dbx-box {
|
||||
margin:0;
|
||||
|
@ -10,10 +10,10 @@ function GetElementsWithClassName(elementName, className) {
|
||||
}
|
||||
|
||||
function meChecked() {
|
||||
var undefined;
|
||||
var eMe = document.getElementById('me');
|
||||
if (eMe == undefined) return false;
|
||||
else return eMe.checked;
|
||||
var undefined;
|
||||
var eMe = document.getElementById('me');
|
||||
if (eMe == undefined) return false;
|
||||
else return eMe.checked;
|
||||
}
|
||||
|
||||
function upit() {
|
||||
|
14
wp-atom.php
14
wp-atom.php
@ -11,11 +11,11 @@ $more = 1;
|
||||
?>
|
||||
<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
|
||||
<feed version="0.3"
|
||||
xmlns="http://purl.org/atom/ns#"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xml:lang="<?php echo get_option('rss_language'); ?>"
|
||||
<?php do_action('atom_ns'); ?>
|
||||
>
|
||||
xmlns="http://purl.org/atom/ns#"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xml:lang="<?php echo get_option('rss_language'); ?>"
|
||||
<?php do_action('atom_ns'); ?>
|
||||
>
|
||||
<title><?php bloginfo_rss('name') ?></title>
|
||||
<link rel="alternate" type="text/html" href="<?php bloginfo_rss('home') ?>" />
|
||||
<tagline><?php bloginfo_rss("description") ?></tagline>
|
||||
@ -25,7 +25,7 @@ $more = 1;
|
||||
<?php do_action('atom_head'); ?>
|
||||
<?php while (have_posts()) : the_post(); ?>
|
||||
<entry>
|
||||
<author>
|
||||
<author>
|
||||
<name><?php the_author() ?></name>
|
||||
</author>
|
||||
<title type="text/html" mode="escaped"><![CDATA[<?php the_title_rss() ?>]]></title>
|
||||
@ -33,7 +33,7 @@ $more = 1;
|
||||
<id><?php the_guid(); ?></id>
|
||||
<modified><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></modified>
|
||||
<issued><?php echo get_post_time('Y-m-d\TH:i:s\Z', true); ?></issued>
|
||||
<?php the_category_rss('rdf') ?>
|
||||
<?php the_category_rss('rdf') ?>
|
||||
<summary type="text/plain" mode="escaped"><![CDATA[<?php the_excerpt_rss(); ?>]]></summary>
|
||||
<?php if ( !get_option('rss_use_excerpt') ) : ?>
|
||||
<content type="<?php bloginfo('html_type'); ?>" mode="escaped" xml:base="<?php permalink_single_rss() ?>"><![CDATA[<?php the_content('', 0, '') ?>]]></content>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php
|
||||
|
||||
if (empty($wp)) {
|
||||
require_once('wp-config.php');
|
||||
@ -64,7 +64,7 @@ if (have_posts()) :
|
||||
<author><?php echo get_comment_author_rss() ?></author>
|
||||
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_comment_time('Y-m-d H:i:s', true), false); ?></pubDate>
|
||||
<guid><?php comment_link() ?></guid>
|
||||
<?php
|
||||
<?php
|
||||
if (!empty($comment->post_password) && $_COOKIE['wp-postpass'] != $comment->post_password) {
|
||||
?>
|
||||
<description><?php _e('Protected Comments: Please enter your password to view comments.'); ?></description>
|
||||
@ -74,12 +74,12 @@ if (have_posts()) :
|
||||
?>
|
||||
<description><?php comment_text_rss() ?></description>
|
||||
<content:encoded><![CDATA[<?php comment_text() ?>]]></content:encoded>
|
||||
<?php
|
||||
} // close check for password
|
||||
<?php
|
||||
} // close check for password
|
||||
?>
|
||||
</item>
|
||||
<?php
|
||||
}
|
||||
<?php
|
||||
}
|
||||
}
|
||||
}
|
||||
endwhile; endif;
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php
|
||||
/* Don't remove these lines. */
|
||||
add_filter('comment_text', 'popuplinks');
|
||||
while( have_posts()) : the_post();
|
||||
@ -97,7 +97,7 @@ endwhile;
|
||||
?>
|
||||
|
||||
<!-- // this is just the end of the motor - don't touch that line either :) -->
|
||||
<?php //} ?>
|
||||
<?php //} ?>
|
||||
<p class="credit"><?php timer_stop(1); ?> <?php echo sprintf(__("<cite>Powered by <a href=\"http://wordpress.org\" title=\"%s\"><strong>Wordpress</strong></a></cite>"),__("Powered by WordPress, state-of-the-art semantic personal publishing platform.")); ?></p>
|
||||
<?php // Seen at http://www.mijnkopthee.nl/log2/archive/2003/05/28/esc(18) ?>
|
||||
<script type="text/javascript">
|
||||
|
@ -2,7 +2,7 @@
|
||||
<p><?php _e('Enter your password to view comments.'); ?></p>
|
||||
<?php return; endif; ?>
|
||||
|
||||
<h2 id="comments"><?php comments_number(__('No Comments'), __('1 Comment'), __('% Comments')); ?>
|
||||
<h2 id="comments"><?php comments_number(__('No Comments'), __('1 Comment'), __('% Comments')); ?>
|
||||
<?php if ( comments_open() ) : ?>
|
||||
<a href="#postcomment" title="<?php _e("Leave a comment"); ?>">»</a>
|
||||
<?php endif; ?>
|
||||
@ -25,7 +25,7 @@
|
||||
<p><?php _e('No comments yet.'); ?></p>
|
||||
<?php endif; ?>
|
||||
|
||||
<p><?php comments_rss_link(__('<abbr title="Really Simple Syndication">RSS</abbr> feed for comments on this post.')); ?>
|
||||
<p><?php comments_rss_link(__('<abbr title="Really Simple Syndication">RSS</abbr> feed for comments on this post.')); ?>
|
||||
<?php if ( pings_open() ) : ?>
|
||||
<a href="<?php trackback_url() ?>" rel="trackback"><?php _e('TrackBack <abbr title="Universal Resource Locator">URL</abbr>'); ?></a>
|
||||
<?php endif; ?>
|
||||
|
@ -17,7 +17,7 @@
|
||||
<link rel="alternate" type="application/atom+xml" title="Atom 0.3" href="<?php bloginfo('atom_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 wp_head(); ?>
|
||||
</head>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php
|
||||
get_header();
|
||||
?>
|
||||
|
||||
@ -15,8 +15,8 @@ get_header();
|
||||
</div>
|
||||
|
||||
<div class="feedback">
|
||||
<?php wp_link_pages(); ?>
|
||||
<?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)')); ?>
|
||||
<?php wp_link_pages(); ?>
|
||||
<?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)')); ?>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
@ -16,12 +16,12 @@
|
||||
</form>
|
||||
</li>
|
||||
<li id="archives"><?php _e('Archives:'); ?>
|
||||
<ul>
|
||||
<ul>
|
||||
<?php wp_get_archives('type=monthly'); ?>
|
||||
</ul>
|
||||
</ul>
|
||||
</li>
|
||||
<li id="meta"><?php _e('Meta:'); ?>
|
||||
<ul>
|
||||
<ul>
|
||||
<?php wp_register(); ?>
|
||||
<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>
|
||||
|
@ -40,7 +40,7 @@
|
||||
<?php the_content() ?>
|
||||
</div>
|
||||
|
||||
<p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
|
||||
<p class="postmetadata">Posted in <?php the_category(', ') ?> | <?php edit_post_link('Edit', '', ' | '); ?> <?php comments_popup_link('No Comments »', '1 Comment »', '% Comments »'); ?></p>
|
||||
|
||||
</div>
|
||||
|
||||
|
@ -11,14 +11,14 @@ Template Name: Archives
|
||||
<?php include (TEMPLATEPATH . '/searchform.php'); ?>
|
||||
|
||||
<h2>Archives by Month:</h2>
|
||||
<ul>
|
||||
<?php wp_get_archives('type=monthly'); ?>
|
||||
</ul>
|
||||
<ul>
|
||||
<?php wp_get_archives('type=monthly'); ?>
|
||||
</ul>
|
||||
|
||||
<h2>Archives by Subject:</h2>
|
||||
<ul>
|
||||
<?php wp_list_categories(); ?>
|
||||
</ul>
|
||||
<ul>
|
||||
<?php wp_list_categories(); ?>
|
||||
</ul>
|
||||
|
||||
</div>
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
<?php
|
||||
<?php
|
||||
/* Don't remove these lines. */
|
||||
add_filter('comment_text', 'popuplinks');
|
||||
while ( have_posts()) : the_post();
|
||||
@ -97,7 +97,7 @@ endwhile;
|
||||
?>
|
||||
|
||||
<!-- // this is just the end of the motor - don't touch that line either :) -->
|
||||
<?php //} ?>
|
||||
<?php //} ?>
|
||||
<p class="credit"><?php timer_stop(1); ?> <cite>Powered by <a href="http://wordpress.org/" title="Powered by WordPress, state-of-the-art semantic personal publishing platform"><strong>Wordpress</strong></a></cite></p>
|
||||
<?php // Seen at http://www.mijnkopthee.nl/log2/archive/2003/05/28/esc(18) ?>
|
||||
<script type="text/javascript">
|
||||
|
@ -2,25 +2,25 @@
|
||||
if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
|
||||
die ('Please do not load this page directly. Thanks!');
|
||||
|
||||
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 (!empty($post->post_password)) { // if there's a password
|
||||
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
|
||||
return;
|
||||
}
|
||||
}
|
||||
<?php
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* This variable is for alternating comment background */
|
||||
$oddcomment = 'alt';
|
||||
/* This variable is for alternating comment background */
|
||||
$oddcomment = 'alt';
|
||||
?>
|
||||
|
||||
<!-- You can start editing here. -->
|
||||
|
||||
<?php if ($comments) : ?>
|
||||
<h3 id="comments"><?php comments_number('No Responses', 'One Response', '% Responses' );?> to “<?php the_title(); ?>”</h3>
|
||||
<h3 id="comments"><?php comments_number('No Responses', 'One Response', '% Responses' );?> to “<?php the_title(); ?>”</h3>
|
||||
|
||||
<ol class="commentlist">
|
||||
|
||||
@ -50,7 +50,7 @@
|
||||
|
||||
<?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. -->
|
||||
|
||||
<?php else : // comments are closed ?>
|
||||
|
@ -3,7 +3,7 @@
|
||||
<div id="footer">
|
||||
<!-- If you'd like to support WordPress, having the "powered by" link someone on your blog is the best way, it's our only promotion or advertising. -->
|
||||
<p>
|
||||
<?php bloginfo('name'); ?> is proudly powered by
|
||||
<?php bloginfo('name'); ?> is proudly powered by
|
||||
<a href="http://wordpress.org/">WordPress</a>
|
||||
<br /><a href="feed:<?php bloginfo('rss2_url'); ?>">Entries (RSS)</a>
|
||||
and <a href="feed:<?php bloginfo('comments_rss2_url'); ?>">Comments (RSS)</a>.
|
||||
|
@ -14,13 +14,13 @@
|
||||
|
||||
<style type="text/css" media="screen">
|
||||
|
||||
<?php
|
||||
<?php
|
||||
// Checks to see whether it needs a sidebar or not
|
||||
if ( !$withcomments && !is_single() ) {
|
||||
if ( !$withcomments && !is_single() ) {
|
||||
?>
|
||||
#page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbg.jpg") repeat-y top; border: none; }
|
||||
<?php } else { // No sidebar ?>
|
||||
#page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbgwide.jpg") repeat-y top; border: none; }
|
||||
#page { background: url("<?php bloginfo('stylesheet_directory'); ?>/images/kubrickbgwide.jpg") repeat-y top; border: none; }
|
||||
<?php } ?>
|
||||
|
||||
</style>
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
<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(); ?>">
|
||||
<h2><?php the_title(); ?></h2>
|
||||
<div class="entry">
|
||||
@ -12,7 +12,7 @@
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<?php endwhile; endif; ?>
|
||||
<?php endwhile; endif; ?>
|
||||
<?php edit_post_link('Edit this entry.', '<p>', '</p>'); ?>
|
||||
</div>
|
||||
|
||||
|
@ -24,11 +24,11 @@
|
||||
<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>
|
||||
|
||||
<?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
|
||||
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
|
||||
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">
|
||||
|
||||
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
|
||||
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
|
||||
|
||||
<div class="navigation">
|
||||
<div class="alignleft"><?php previous_post_link('« %link') ?></div>
|
||||
@ -23,10 +23,10 @@
|
||||
<?php /* This is commented, because it requires a little adjusting sometimes.
|
||||
You'll need to download this plugin, and follow the instructions:
|
||||
http://binarybonsai.com/archives/2004/08/17/time-since-plugin/ */
|
||||
/* $entry_datetime = abs(strtotime($post->post_date) - (60*120)); echo time_since($entry_datetime); echo ' ago'; */ ?>
|
||||
/* $entry_datetime = abs(strtotime($post->post_date) - (60*120)); echo time_since($entry_datetime); echo ' ago'; */ ?>
|
||||
on <?php the_time('l, F jS, Y') ?> at <?php the_time() ?>
|
||||
and is filed under <?php the_category(', ') ?>.
|
||||
You can follow any responses to this entry through the <?php comments_rss_link('RSS 2.0'); ?> feed.
|
||||
You can follow any responses to this entry through the <?php comments_rss_link('RSS 2.0'); ?> feed.
|
||||
|
||||
<?php if (('open' == $post-> comment_status) && ('open' == $post->ping_status)) {
|
||||
// Both Comments and Pings are open ?>
|
||||
|
@ -1,8 +1,8 @@
|
||||
<?php
|
||||
|
||||
if (empty($doing_rss)) {
|
||||
$doing_rss = 1;
|
||||
require(dirname(__FILE__) . '/wp-blog-header.php');
|
||||
$doing_rss = 1;
|
||||
require(dirname(__FILE__) . '/wp-blog-header.php');
|
||||
}
|
||||
|
||||
do_feed();
|
||||
|
@ -146,7 +146,7 @@ function get_links($category = -1,
|
||||
}
|
||||
|
||||
function get_linkrating($link) {
|
||||
return apply_filters('link_rating', $link->link_rating);
|
||||
return apply_filters('link_rating', $link->link_rating);
|
||||
}
|
||||
|
||||
/** function get_linkcatname()
|
||||
|
@ -19,7 +19,7 @@ function get_bookmark($bookmark_id, $output = OBJECT) {
|
||||
|
||||
// Deprecate
|
||||
function get_link($bookmark_id, $output = OBJECT) {
|
||||
return get_bookmark($bookmark_id, $output);
|
||||
return get_bookmark($bookmark_id, $output);
|
||||
}
|
||||
|
||||
function get_bookmarks($args = '') {
|
||||
@ -50,7 +50,7 @@ function get_bookmarks($args = '') {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty($inclusions))
|
||||
if (!empty($inclusions))
|
||||
$inclusions .= ')';
|
||||
|
||||
$exclusions = '';
|
||||
@ -65,9 +65,9 @@ function get_bookmarks($args = '') {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty($exclusions))
|
||||
if (!empty($exclusions))
|
||||
$exclusions .= ')';
|
||||
|
||||
|
||||
if ( ! empty($category_name) ) {
|
||||
if ( $cat_id = $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE cat_name='$category_name' LIMIT 1") )
|
||||
$category = $cat_id;
|
||||
@ -87,7 +87,7 @@ function get_bookmarks($args = '') {
|
||||
}
|
||||
}
|
||||
if (!empty($category_query)) {
|
||||
$category_query .= ')';
|
||||
$category_query .= ')';
|
||||
$join = " LEFT JOIN $wpdb->link2cat ON ($wpdb->links.link_id = $wpdb->link2cat.link_id) ";
|
||||
}
|
||||
|
||||
|
@ -65,7 +65,7 @@ class WP_Object_Cache {
|
||||
var $secret = '';
|
||||
|
||||
function acquire_lock() {
|
||||
// Acquire a write lock.
|
||||
// Acquire a write lock.
|
||||
$this->mutex = @fopen($this->cache_dir.$this->flock_filename, 'w');
|
||||
if ( false == $this->mutex)
|
||||
return false;
|
||||
@ -237,11 +237,11 @@ class WP_Object_Cache {
|
||||
while ($index < count($stack)) {
|
||||
# Get indexed directory from stack
|
||||
$dir = $stack[$index];
|
||||
|
||||
|
||||
$dh = @ opendir($dir);
|
||||
if (!$dh)
|
||||
return false;
|
||||
|
||||
|
||||
while (($file = @ readdir($dh)) !== false) {
|
||||
if ($file == '.' or $file == '..')
|
||||
continue;
|
||||
|
@ -221,18 +221,18 @@ class WP_User {
|
||||
}
|
||||
|
||||
function level_reduction($max, $item) {
|
||||
if(preg_match('/^level_(10|[0-9])$/i', $item, $matches)) {
|
||||
$level = intval($matches[1]);
|
||||
return max($max, $level);
|
||||
} else {
|
||||
return $max;
|
||||
}
|
||||
if(preg_match('/^level_(10|[0-9])$/i', $item, $matches)) {
|
||||
$level = intval($matches[1]);
|
||||
return max($max, $level);
|
||||
} else {
|
||||
return $max;
|
||||
}
|
||||
}
|
||||
|
||||
function update_user_level_from_caps() {
|
||||
global $wpdb;
|
||||
$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);
|
||||
global $wpdb;
|
||||
$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);
|
||||
}
|
||||
|
||||
function add_cap($cap, $grant = true) {
|
||||
@ -298,7 +298,7 @@ function map_meta_cap($cap, $user_id) {
|
||||
$post = get_post($args[0]);
|
||||
if ( 'page' == $post->post_type ) {
|
||||
$args = array_merge(array('delete_page', $user_id), $args);
|
||||
return call_user_func_array('map_meta_cap', $args);
|
||||
return call_user_func_array('map_meta_cap', $args);
|
||||
}
|
||||
$post_author_data = get_userdata($post->post_author);
|
||||
//echo "current user id : $user_id, post author id: " . $post_author_data->ID . "<br/>";
|
||||
@ -352,7 +352,7 @@ function map_meta_cap($cap, $user_id) {
|
||||
$post = get_post($args[0]);
|
||||
if ( 'page' == $post->post_type ) {
|
||||
$args = array_merge(array('edit_page', $user_id), $args);
|
||||
return call_user_func_array('map_meta_cap', $args);
|
||||
return call_user_func_array('map_meta_cap', $args);
|
||||
}
|
||||
$post_author_data = get_userdata($post->post_author);
|
||||
//echo "current user id : $user_id, post author id: " . $post_author_data->ID . "<br/>";
|
||||
@ -402,7 +402,7 @@ function map_meta_cap($cap, $user_id) {
|
||||
$post = get_post($args[0]);
|
||||
if ( 'page' == $post->post_type ) {
|
||||
$args = array_merge(array('read_page', $user_id), $args);
|
||||
return call_user_func_array('map_meta_cap', $args);
|
||||
return call_user_func_array('map_meta_cap', $args);
|
||||
}
|
||||
|
||||
if ( 'private' != $post->post_status ) {
|
||||
|
@ -187,8 +187,8 @@ function wp_dropdown_categories($args = '') {
|
||||
$output .= "\t<option value='0'>$show_option_all</option>\n";
|
||||
}
|
||||
|
||||
if ( $show_option_none) {
|
||||
$show_option_none = apply_filters('list_cats', $show_option_none);
|
||||
if ( $show_option_none) {
|
||||
$show_option_none = apply_filters('list_cats', $show_option_none);
|
||||
$output .= "\t<option value='-1'>$show_option_none</option>\n";
|
||||
}
|
||||
|
||||
@ -226,7 +226,7 @@ function wp_list_categories($args = '') {
|
||||
extract($r);
|
||||
|
||||
$categories = get_categories($r);
|
||||
|
||||
|
||||
$output = '';
|
||||
if ( $title_li && 'list' == $style )
|
||||
$output = '<li class="categories">' . $r['title_li'] . '<ul>';
|
||||
@ -249,7 +249,7 @@ function wp_list_categories($args = '') {
|
||||
|
||||
if ( $title_li && 'list' == $style )
|
||||
$output .= '</ul></li>';
|
||||
|
||||
|
||||
echo apply_filters('list_cats', $output);
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ class WP {
|
||||
var $matched_rule;
|
||||
var $matched_query;
|
||||
var $did_permalink = false;
|
||||
|
||||
|
||||
function add_query_var($qv) {
|
||||
$this->public_query_vars[] = $qv;
|
||||
}
|
||||
@ -96,7 +96,7 @@ class WP {
|
||||
preg_match("!^$match!", urldecode($request_match), $matches)) {
|
||||
// Got a match.
|
||||
$this->matched_rule = $match;
|
||||
|
||||
|
||||
// Trim the query of everything up to the '?'.
|
||||
$query = preg_replace("!^.+\?!", '', $query);
|
||||
|
||||
@ -190,14 +190,14 @@ class WP {
|
||||
)
|
||||
)
|
||||
$wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastcommentmodified('GMT'), 0).' GMT';
|
||||
else
|
||||
else
|
||||
$wp_last_modified = mysql2date('D, d M Y H:i:s', get_lastpostmodified('GMT'), 0).' GMT';
|
||||
$wp_etag = '"' . md5($wp_last_modified) . '"';
|
||||
@header("Last-Modified: $wp_last_modified");
|
||||
@header("ETag: $wp_etag");
|
||||
|
||||
// Support for Conditional GET
|
||||
if (isset($_SERVER['HTTP_IF_NONE_MATCH']))
|
||||
if (isset($_SERVER['HTTP_IF_NONE_MATCH']))
|
||||
$client_etag = stripslashes(stripslashes($_SERVER['HTTP_IF_NONE_MATCH']));
|
||||
else $client_etag = false;
|
||||
|
||||
@ -321,7 +321,7 @@ class WP_Error {
|
||||
if ( empty($codes) )
|
||||
return '';
|
||||
|
||||
return $codes[0];
|
||||
return $codes[0];
|
||||
}
|
||||
|
||||
function get_error_messages($code = '') {
|
||||
@ -337,7 +337,7 @@ class WP_Error {
|
||||
if ( isset($this->errors[$code]) )
|
||||
return $this->errors[$code];
|
||||
else
|
||||
return array();
|
||||
return array();
|
||||
}
|
||||
|
||||
function get_error_message($code = '') {
|
||||
@ -381,29 +381,29 @@ function is_wp_error($thing) {
|
||||
|
||||
// A class for displaying various tree-like structures. Extend the Walker class to use it, see examples at the bottom
|
||||
|
||||
class Walker {
|
||||
class Walker {
|
||||
var $tree_type;
|
||||
var $db_fields;
|
||||
|
||||
|
||||
//abstract callbacks
|
||||
function start_lvl($output) { return $output; }
|
||||
function end_lvl($output) { return $output; }
|
||||
function start_el($output) { return $output; }
|
||||
function end_el($output) { return $output; }
|
||||
|
||||
|
||||
function walk($elements, $to_depth) {
|
||||
$args = array_slice(func_get_args(), 2); $parents = array(); $depth = 1; $previous_element = ''; $output = '';
|
||||
|
||||
|
||||
//padding at the end
|
||||
$last_element->post_parent = 0;
|
||||
$last_element->post_id = 0;
|
||||
$elements[] = $last_element;
|
||||
|
||||
|
||||
$id_field = $this->db_fields['id'];
|
||||
$parent_field = $this->db_fields['parent'];
|
||||
|
||||
|
||||
$flat = ($to_depth == -1) ? true : false;
|
||||
|
||||
|
||||
foreach ( $elements as $element ) {
|
||||
// If flat, start and end the element and skip the level checks.
|
||||
if ( $flat) {
|
||||
@ -443,7 +443,7 @@ class Walker {
|
||||
$cb_args = array_merge( array($output, $previous_element, $depth - 1), $args);
|
||||
$output = call_user_func_array(array(&$this, 'end_el'), $cb_args);
|
||||
}
|
||||
|
||||
|
||||
while ( $parent = array_shift($parents) ) {
|
||||
$depth--;
|
||||
if ( !$to_depth || ($depth < $to_depth) ) {
|
||||
@ -463,7 +463,7 @@ class Walker {
|
||||
$output = call_user_func_array(array(&$this, 'end_el'), $cb_args);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// Start the element.
|
||||
if ( !$to_depth || ($depth <= $to_depth) ) {
|
||||
if ( $element->$id_field != 0 ) {
|
||||
@ -471,10 +471,10 @@ class Walker {
|
||||
$output = call_user_func_array(array(&$this, 'start_el'), $cb_args);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$previous_element = $element;
|
||||
}
|
||||
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
@ -482,19 +482,19 @@ class Walker {
|
||||
class Walker_Page extends Walker {
|
||||
var $tree_type = 'page';
|
||||
var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID'); //TODO: decouple this
|
||||
|
||||
|
||||
function start_lvl($output, $depth) {
|
||||
$indent = str_repeat("\t", $depth);
|
||||
$output .= "$indent<ul>\n";
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
function end_lvl($output, $depth) {
|
||||
$indent = str_repeat("\t", $depth);
|
||||
$output .= "$indent</ul>\n";
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
function start_el($output, $page, $depth, $current_page, $show_date, $date_format) {
|
||||
if ( $depth )
|
||||
$indent = str_repeat("\t", $depth);
|
||||
@ -530,45 +530,45 @@ class Walker_PageDropdown extends Walker {
|
||||
var $db_fields = array ('parent' => 'post_parent', 'id' => 'ID'); //TODO: decouple this
|
||||
|
||||
function start_el($output, $page, $depth, $args) {
|
||||
$pad = str_repeat(' ', $depth * 3);
|
||||
$pad = str_repeat(' ', $depth * 3);
|
||||
|
||||
$output .= "\t<option value=\"$page->ID\"";
|
||||
if ( $page->ID == $args['selected'] )
|
||||
$output .= ' selected="selected"';
|
||||
$output .= '>';
|
||||
$title = wp_specialchars($page->post_title);
|
||||
$output .= "$pad$title";
|
||||
$output .= "</option>\n";
|
||||
$output .= "\t<option value=\"$page->ID\"";
|
||||
if ( $page->ID == $args['selected'] )
|
||||
$output .= ' selected="selected"';
|
||||
$output .= '>';
|
||||
$title = wp_specialchars($page->post_title);
|
||||
$output .= "$pad$title";
|
||||
$output .= "</option>\n";
|
||||
|
||||
return $output;
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
class Walker_Category extends Walker {
|
||||
var $tree_type = 'category';
|
||||
var $db_fields = array ('parent' => 'category_parent', 'id' => 'cat_ID'); //TODO: decouple this
|
||||
|
||||
|
||||
function start_lvl($output, $depth, $args) {
|
||||
if ( 'list' != $args['style'] )
|
||||
return $output;
|
||||
|
||||
|
||||
$indent = str_repeat("\t", $depth);
|
||||
$output .= "$indent<ul class='children'>\n";
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
function end_lvl($output, $depth, $args) {
|
||||
if ( 'list' != $args['style'] )
|
||||
return $output;
|
||||
|
||||
|
||||
$indent = str_repeat("\t", $depth);
|
||||
$output .= "$indent</ul>\n";
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
function start_el($output, $category, $depth, $args) {
|
||||
extract($args);
|
||||
|
||||
|
||||
$link = '<a href="' . get_category_link($category->cat_ID) . '" ';
|
||||
if ( $use_desc_for_title == 0 || empty($category->category_description) )
|
||||
$link .= 'title="'. sprintf(__("View all posts filed under %s"), wp_specialchars($category->cat_name, 1)) . '"';
|
||||
@ -576,24 +576,24 @@ class Walker_Category extends Walker {
|
||||
$link .= 'title="' . wp_specialchars(apply_filters('category_description',$category->category_description,$category),1) . '"';
|
||||
$link .= '>';
|
||||
$link .= apply_filters('list_cats', $category->cat_name, $category).'</a>';
|
||||
|
||||
|
||||
if ( (! empty($feed_image)) || (! empty($feed)) ) {
|
||||
$link .= ' ';
|
||||
|
||||
|
||||
if ( empty($feed_image) )
|
||||
$link .= '(';
|
||||
|
||||
|
||||
$link .= '<a href="' . get_category_rss_link(0, $category->cat_ID, $category->category_nicename) . '"';
|
||||
|
||||
|
||||
if ( !empty($feed) ) {
|
||||
$title = ' title="' . $feed . '"';
|
||||
$alt = ' alt="' . $feed . '"';
|
||||
$name = $feed;
|
||||
$link .= $title;
|
||||
}
|
||||
|
||||
|
||||
$link .= '>';
|
||||
|
||||
|
||||
if ( !empty($feed_image) )
|
||||
$link .= "<img src='$feed_image' $alt$title" . ' />';
|
||||
else
|
||||
@ -618,14 +618,14 @@ class Walker_Category extends Walker {
|
||||
} else {
|
||||
$output .= "\t$link<br />\n";
|
||||
}
|
||||
|
||||
|
||||
return $output;
|
||||
}
|
||||
|
||||
|
||||
function end_el($output, $page, $depth, $args) {
|
||||
if ( 'list' != $args['style'] )
|
||||
return $output;
|
||||
|
||||
|
||||
$output .= "</li>\n";
|
||||
return $output;
|
||||
}
|
||||
@ -635,10 +635,10 @@ class Walker_Category extends Walker {
|
||||
class Walker_CategoryDropdown extends Walker {
|
||||
var $tree_type = 'category';
|
||||
var $db_fields = array ('parent' => 'category_parent', 'id' => 'cat_ID'); //TODO: decouple this
|
||||
|
||||
function start_el($output, $category, $depth, $args) {
|
||||
|
||||
function start_el($output, $category, $depth, $args) {
|
||||
$pad = str_repeat(' ', $depth * 3);
|
||||
|
||||
|
||||
$cat_name = apply_filters('list_cats', $category->cat_name, $category);
|
||||
$output .= "\t<option value=\"".$category->cat_ID."\"";
|
||||
if ( $category->cat_ID == $args['selected'] )
|
||||
@ -652,7 +652,7 @@ class Walker_CategoryDropdown extends Walker {
|
||||
$output .= ' ' . gmdate($format, $category->last_update_timestamp);
|
||||
}
|
||||
$output .= "</option>\n";
|
||||
|
||||
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
@ -142,7 +142,7 @@ function get_comments_link() {
|
||||
}
|
||||
|
||||
function comments_link( $file = '', $echo = true ) {
|
||||
echo get_comments_link();
|
||||
echo get_comments_link();
|
||||
}
|
||||
|
||||
function get_comments_number( $post_id = 0 ) {
|
||||
@ -240,9 +240,9 @@ function trackback_url( $display = true ) {
|
||||
function trackback_rdf($timezone = 0) {
|
||||
global $id;
|
||||
if (!stristr($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator')) {
|
||||
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:trackback="http://madskills.com/public/xml/rss/module/trackback/">
|
||||
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:trackback="http://madskills.com/public/xml/rss/module/trackback/">
|
||||
<rdf:Description rdf:about="';
|
||||
the_permalink();
|
||||
echo '"'."\n";
|
||||
@ -265,7 +265,7 @@ function comments_open() {
|
||||
|
||||
function pings_open() {
|
||||
global $post;
|
||||
if ( 'open' == $post->ping_status )
|
||||
if ( 'open' == $post->ping_status )
|
||||
return true;
|
||||
else
|
||||
return false;
|
||||
@ -299,7 +299,7 @@ function comments_template( $file = '/comments.php' ) {
|
||||
}
|
||||
|
||||
function comments_popup_script($width=400, $height=400, $file='') {
|
||||
global $wpcommentspopupfile, $wptrackbackpopupfile, $wppingbackpopupfile, $wpcommentsjavascript;
|
||||
global $wpcommentspopupfile, $wptrackbackpopupfile, $wppingbackpopupfile, $wpcommentsjavascript;
|
||||
|
||||
if (empty ($file)) {
|
||||
$wpcommentspopupfile = ''; // Use the index.
|
||||
@ -307,9 +307,9 @@ function comments_popup_script($width=400, $height=400, $file='') {
|
||||
$wpcommentspopupfile = $file;
|
||||
}
|
||||
|
||||
$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";
|
||||
echo $javascript;
|
||||
$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";
|
||||
echo $javascript;
|
||||
}
|
||||
|
||||
function comments_popup_link($zero='No Comments', $one='1 Comment', $more='% Comments', $CSSclass='', $none='Comments Off') {
|
||||
|
@ -18,11 +18,11 @@ function check_comment($author, $email, $url, $comment, $user_ip, $user_agent, $
|
||||
// Skip empty lines
|
||||
if (empty($word)) { continue; }
|
||||
|
||||
// Do some escaping magic so that '#' chars in the
|
||||
// Do some escaping magic so that '#' chars in the
|
||||
// spam words don't break things:
|
||||
$word = preg_quote($word, '#');
|
||||
|
||||
$pattern = "#$word#i";
|
||||
$pattern = "#$word#i";
|
||||
if ( preg_match($pattern, $author) ) return false;
|
||||
if ( preg_match($pattern, $email) ) return false;
|
||||
if ( preg_match($pattern, $url) ) return false;
|
||||
@ -103,9 +103,9 @@ function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = fals
|
||||
if ($no_cache) {
|
||||
$query = "SELECT * FROM $wpdb->comments WHERE comment_ID = '$comment_ID'";
|
||||
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 {
|
||||
$myrow['comment_ID'] = $postc->comment_ID;
|
||||
$myrow['comment_post_ID'] = $postc->comment_post_ID;
|
||||
@ -157,7 +157,7 @@ function sanitize_comment_cookies() {
|
||||
if ( isset($_COOKIE['comment_author_email_'.COOKIEHASH]) ) {
|
||||
$comment_author_email = apply_filters('pre_comment_author_email', $_COOKIE['comment_author_email_'.COOKIEHASH]);
|
||||
$comment_author_email = stripslashes($comment_author_email);
|
||||
$comment_author_email = wp_specialchars($comment_author_email, true);
|
||||
$comment_author_email = wp_specialchars($comment_author_email, true);
|
||||
$_COOKIE['comment_author_email_'.COOKIEHASH] = $comment_author_email;
|
||||
}
|
||||
|
||||
@ -243,11 +243,11 @@ function wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_age
|
||||
// Skip empty lines
|
||||
if ( empty($word) ) { continue; }
|
||||
|
||||
// Do some escaping magic so that '#' chars in the
|
||||
// Do some escaping magic so that '#' chars in the
|
||||
// spam words don't break things:
|
||||
$word = preg_quote($word, '#');
|
||||
|
||||
$pattern = "#$word#i";
|
||||
$pattern = "#$word#i";
|
||||
if ( preg_match($pattern, $author ) ) return true;
|
||||
if ( preg_match($pattern, $email ) ) return true;
|
||||
if ( preg_match($pattern, $url ) ) return true;
|
||||
@ -328,9 +328,9 @@ function wp_insert_comment($commentdata) {
|
||||
if ( ! isset($user_id) )
|
||||
$user_id = 0;
|
||||
|
||||
$result = $wpdb->query("INSERT INTO $wpdb->comments
|
||||
$result = $wpdb->query("INSERT INTO $wpdb->comments
|
||||
(comment_post_ID, comment_author, comment_author_email, comment_author_url, comment_author_IP, comment_date, comment_date_gmt, comment_content, comment_approved, comment_agent, comment_type, comment_parent, user_id)
|
||||
VALUES
|
||||
VALUES
|
||||
('$comment_post_ID', '$comment_author', '$comment_author_email', '$comment_author_url', '$comment_author_IP', '$comment_date', '$comment_date_gmt', '$comment_content', '$comment_approved', '$comment_agent', '$comment_type', '$comment_parent', '$user_id')
|
||||
");
|
||||
|
||||
@ -397,26 +397,26 @@ function wp_new_comment( $commentdata ) {
|
||||
}
|
||||
|
||||
function wp_set_comment_status($comment_id, $comment_status) {
|
||||
global $wpdb;
|
||||
global $wpdb;
|
||||
|
||||
switch($comment_status) {
|
||||
switch($comment_status) {
|
||||
case 'hold':
|
||||
$query = "UPDATE $wpdb->comments SET comment_approved='0' WHERE comment_ID='$comment_id' LIMIT 1";
|
||||
break;
|
||||
case 'approve':
|
||||
$query = "UPDATE $wpdb->comments SET comment_approved='1' WHERE comment_ID='$comment_id' LIMIT 1";
|
||||
break;
|
||||
case 'spam':
|
||||
$query = "UPDATE $wpdb->comments SET comment_approved='spam' WHERE comment_ID='$comment_id' LIMIT 1";
|
||||
break;
|
||||
case 'spam':
|
||||
$query = "UPDATE $wpdb->comments SET comment_approved='spam' WHERE comment_ID='$comment_id' LIMIT 1";
|
||||
break;
|
||||
case 'delete':
|
||||
return wp_delete_comment($comment_id);
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($wpdb->query($query)) {
|
||||
}
|
||||
|
||||
if ($wpdb->query($query)) {
|
||||
do_action('wp_set_comment_status', $comment_id, $comment_status);
|
||||
|
||||
$comment = get_comment($comment_id);
|
||||
@ -425,9 +425,9 @@ function wp_set_comment_status($comment_id, $comment_status) {
|
||||
if( is_object( $c ) )
|
||||
$wpdb->query( "UPDATE $wpdb->posts SET comment_count = '$c->c' WHERE ID = '$comment_post_ID'" );
|
||||
return true;
|
||||
} else {
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function wp_update_comment($commentarr) {
|
||||
@ -582,7 +582,7 @@ function do_all_pings() {
|
||||
$wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE post_id = {$ping->ID} AND meta_key = '_pingme';");
|
||||
pingback($ping->post_content, $ping->ID);
|
||||
}
|
||||
|
||||
|
||||
// Do Enclosures
|
||||
while ($enclosure = $wpdb->get_row("SELECT * FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_encloseme' LIMIT 1")) {
|
||||
$wpdb->query("DELETE FROM {$wpdb->postmeta} WHERE post_id = {$enclosure->ID} AND meta_key = '_encloseme';");
|
||||
@ -705,7 +705,7 @@ function pingback($content, $post_ID) {
|
||||
$pingback_server_url = discover_pingback_server_uri($pagelinkedto, 2048);
|
||||
|
||||
if ($pingback_server_url) {
|
||||
@ set_time_limit( 60 );
|
||||
@ set_time_limit( 60 );
|
||||
// Now, the RPC call
|
||||
debug_fwrite($log, "Page Linked To: $pagelinkedto \n");
|
||||
debug_fwrite($log, 'Page Linked From: ');
|
||||
|
@ -36,13 +36,13 @@ if (!function_exists('ob_clean')) {
|
||||
/* Added in PHP 4.3.0 */
|
||||
|
||||
function printr($var, $do_not_echo = false) {
|
||||
// from php.net/print_r user contributed notes
|
||||
// from php.net/print_r user contributed notes
|
||||
ob_start();
|
||||
print_r($var);
|
||||
$code = htmlentities(ob_get_contents());
|
||||
ob_clean();
|
||||
if (!$do_not_echo) {
|
||||
echo "<pre>$code</pre>";
|
||||
echo "<pre>$code</pre>";
|
||||
}
|
||||
ob_end_clean();
|
||||
return $code;
|
||||
@ -57,11 +57,11 @@ if ( !function_exists('file_get_contents') ) {
|
||||
}
|
||||
|
||||
if (!defined('CASE_LOWER')) {
|
||||
define('CASE_LOWER', 0);
|
||||
define('CASE_LOWER', 0);
|
||||
}
|
||||
|
||||
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)
|
||||
*/
|
||||
if (!function_exists('array_change_key_case')) {
|
||||
function array_change_key_case($input, $case = CASE_LOWER)
|
||||
{
|
||||
if (!is_array($input)) {
|
||||
user_error('array_change_key_case(): The argument should be an array',
|
||||
E_USER_WARNING);
|
||||
return false;
|
||||
}
|
||||
function array_change_key_case($input, $case = CASE_LOWER)
|
||||
{
|
||||
if (!is_array($input)) {
|
||||
user_error('array_change_key_case(): The argument should be an array',
|
||||
E_USER_WARNING);
|
||||
return false;
|
||||
}
|
||||
|
||||
$output = array ();
|
||||
$keys = array_keys($input);
|
||||
$casefunc = ($case == CASE_LOWER) ? 'strtolower' : 'strtoupper';
|
||||
$output = array ();
|
||||
$keys = array_keys($input);
|
||||
$casefunc = ($case == CASE_LOWER) ? 'strtolower' : 'strtoupper';
|
||||
|
||||
foreach ($keys as $key) {
|
||||
$output[$casefunc($key)] = $input[$key];
|
||||
}
|
||||
foreach ($keys as $key) {
|
||||
$output[$casefunc($key)] = $input[$key];
|
||||
}
|
||||
|
||||
return $output;
|
||||
}
|
||||
return $output;
|
||||
}
|
||||
}
|
||||
|
||||
// From php.net
|
||||
if(!function_exists('http_build_query')) {
|
||||
function http_build_query( $formdata, $numeric_prefix = null, $key = null ) {
|
||||
$res = array();
|
||||
foreach ((array)$formdata as $k=>$v) {
|
||||
$tmp_key = urlencode(is_int($k) ? $numeric_prefix.$k : $k);
|
||||
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) );
|
||||
}
|
||||
$separator = ini_get('arg_separator.output');
|
||||
return implode($separator, $res);
|
||||
}
|
||||
function http_build_query( $formdata, $numeric_prefix = null, $key = null ) {
|
||||
$res = array();
|
||||
foreach ((array)$formdata as $k=>$v) {
|
||||
$tmp_key = urlencode(is_int($k) ? $numeric_prefix.$k : $k);
|
||||
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) );
|
||||
}
|
||||
$separator = ini_get('arg_separator.output');
|
||||
return implode($separator, $res);
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
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 >= 10) ) {
|
||||
|| ($author_data->user_level > $post_author_data->user_level)
|
||||
|| ($author_data->user_level >= 10) ) {
|
||||
return true;
|
||||
} else {
|
||||
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
|
||||
*/
|
||||
function get_linksbyname($cat_name = "noname", $before = '', $after = '<br />',
|
||||
$between = " ", $show_images = true, $orderby = 'id',
|
||||
$show_description = true, $show_rating = false,
|
||||
$limit = -1, $show_updated = 0) {
|
||||
global $wpdb;
|
||||
$cat_id = -1;
|
||||
$results = $wpdb->get_results("SELECT cat_ID FROM $wpdb->categories WHERE cat_name='$cat_name'");
|
||||
if ($results) {
|
||||
foreach ($results as $result) {
|
||||
$cat_id = $result->cat_ID;
|
||||
}
|
||||
}
|
||||
get_links($cat_id, $before, $after, $between, $show_images, $orderby,
|
||||
$show_description, $show_rating, $limit, $show_updated);
|
||||
$between = " ", $show_images = true, $orderby = 'id',
|
||||
$show_description = true, $show_rating = false,
|
||||
$limit = -1, $show_updated = 0) {
|
||||
global $wpdb;
|
||||
$cat_id = -1;
|
||||
$results = $wpdb->get_results("SELECT cat_ID FROM $wpdb->categories WHERE cat_name='$cat_name'");
|
||||
if ($results) {
|
||||
foreach ($results as $result) {
|
||||
$cat_id = $result->cat_ID;
|
||||
}
|
||||
}
|
||||
get_links($cat_id, $before, $after, $between, $show_images, $orderby,
|
||||
$show_description, $show_rating, $limit, $show_updated);
|
||||
}
|
||||
|
||||
/** function wp_get_linksbyname()
|
||||
@ -252,16 +252,16 @@ function wp_get_linksbyname($category, $args = '') {
|
||||
**/
|
||||
// Deprecate in favor of get_linkz().
|
||||
function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit = -1) {
|
||||
global $wpdb;
|
||||
$cat_id = -1;
|
||||
//$results = $wpdb->get_results("SELECT cat_id FROM $wpdb->linkcategories WHERE cat_name='$cat_name'");
|
||||
// TODO: Fix me.
|
||||
if ($results) {
|
||||
foreach ($results as $result) {
|
||||
$cat_id = $result->cat_id;
|
||||
}
|
||||
}
|
||||
return get_linkobjects($cat_id, $orderby, $limit);
|
||||
global $wpdb;
|
||||
$cat_id = -1;
|
||||
//$results = $wpdb->get_results("SELECT cat_id FROM $wpdb->linkcategories WHERE cat_name='$cat_name'");
|
||||
// TODO: Fix me.
|
||||
if ($results) {
|
||||
foreach ($results as $result) {
|
||||
$cat_id = $result->cat_id;
|
||||
}
|
||||
}
|
||||
return get_linkobjects($cat_id, $orderby, $limit);
|
||||
}
|
||||
|
||||
/** function get_linkobjects()
|
||||
@ -301,40 +301,40 @@ function get_linkobjectsbyname($cat_name = "noname" , $orderby = 'name', $limit
|
||||
**/
|
||||
// Deprecate in favor of get_linkz().
|
||||
function get_linkobjects($category = -1, $orderby = 'name', $limit = -1) {
|
||||
global $wpdb;
|
||||
global $wpdb;
|
||||
|
||||
$sql = "SELECT * FROM $wpdb->links WHERE link_visible = 'Y'";
|
||||
if ($category != -1) {
|
||||
$sql .= " AND link_category = $category ";
|
||||
}
|
||||
if ($orderby == '')
|
||||
$orderby = 'id';
|
||||
if (substr($orderby,0,1) == '_') {
|
||||
$direction = ' DESC';
|
||||
$orderby = substr($orderby,1);
|
||||
}
|
||||
if (strcasecmp('rand',$orderby) == 0) {
|
||||
$orderby = 'rand()';
|
||||
} else {
|
||||
$orderby = " link_" . $orderby;
|
||||
}
|
||||
$sql .= ' ORDER BY ' . $orderby;
|
||||
$sql .= $direction;
|
||||
/* The next 2 lines implement LIMIT TO processing */
|
||||
if ($limit != -1)
|
||||
$sql .= " LIMIT $limit";
|
||||
$sql = "SELECT * FROM $wpdb->links WHERE link_visible = 'Y'";
|
||||
if ($category != -1) {
|
||||
$sql .= " AND link_category = $category ";
|
||||
}
|
||||
if ($orderby == '')
|
||||
$orderby = 'id';
|
||||
if (substr($orderby,0,1) == '_') {
|
||||
$direction = ' DESC';
|
||||
$orderby = substr($orderby,1);
|
||||
}
|
||||
if (strcasecmp('rand',$orderby) == 0) {
|
||||
$orderby = 'rand()';
|
||||
} else {
|
||||
$orderby = " link_" . $orderby;
|
||||
}
|
||||
$sql .= ' ORDER BY ' . $orderby;
|
||||
$sql .= $direction;
|
||||
/* The next 2 lines implement LIMIT TO processing */
|
||||
if ($limit != -1)
|
||||
$sql .= " LIMIT $limit";
|
||||
|
||||
$results = $wpdb->get_results($sql);
|
||||
if ($results) {
|
||||
foreach ($results as $result) {
|
||||
$result->link_url = $result->link_url;
|
||||
$result->link_name = $result->link_name;
|
||||
$result->link_description = $result->link_description;
|
||||
$result->link_notes = $result->link_notes;
|
||||
$newresults[] = $result;
|
||||
}
|
||||
}
|
||||
return $newresults;
|
||||
$results = $wpdb->get_results($sql);
|
||||
if ($results) {
|
||||
foreach ($results as $result) {
|
||||
$result->link_url = $result->link_url;
|
||||
$result->link_name = $result->link_name;
|
||||
$result->link_description = $result->link_description;
|
||||
$result->link_notes = $result->link_notes;
|
||||
$newresults[] = $result;
|
||||
}
|
||||
}
|
||||
return $newresults;
|
||||
}
|
||||
|
||||
/** 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
|
||||
*/
|
||||
function get_linksbyname_withrating($cat_name = "noname", $before = '',
|
||||
$after = '<br />', $between = " ",
|
||||
$show_images = true, $orderby = 'id',
|
||||
$show_description = true, $limit = -1, $show_updated = 0) {
|
||||
$after = '<br />', $between = " ",
|
||||
$show_images = true, $orderby = 'id',
|
||||
$show_description = true, $limit = -1, $show_updated = 0) {
|
||||
|
||||
get_linksbyname($cat_name, $before, $after, $between, $show_images,
|
||||
$orderby, $show_description, true, $limit, $show_updated);
|
||||
get_linksbyname($cat_name, $before, $after, $between, $show_images,
|
||||
$orderby, $show_description, true, $limit, $show_updated);
|
||||
}
|
||||
|
||||
/** 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
|
||||
*/
|
||||
function get_links_withrating($category = -1, $before = '', $after = '<br />',
|
||||
$between = " ", $show_images = true,
|
||||
$orderby = 'id', $show_description = true,
|
||||
$limit = -1, $show_updated = 0) {
|
||||
$between = " ", $show_images = true,
|
||||
$orderby = 'id', $show_description = true,
|
||||
$limit = -1, $show_updated = 0) {
|
||||
|
||||
get_links($category, $before, $after, $between, $show_images, $orderby,
|
||||
$show_description, true, $limit, $show_updated);
|
||||
get_links($category, $before, $after, $between, $show_images, $orderby,
|
||||
$show_description, true, $limit, $show_updated);
|
||||
}
|
||||
|
||||
/** function get_get_autotoggle()
|
||||
@ -403,7 +403,7 @@ function get_links_withrating($category = -1, $before = '', $after = '<br />',
|
||||
** uses 0
|
||||
*/
|
||||
function get_autotoggle($id = 0) {
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
function list_cats($optionall = 1, $all = 'All', $sort_column = 'ID', $sort_order = 'asc', $file = '', $list = true, $optiondates = 0, $optioncount = 0, $hide_empty = 1, $use_desc_for_title = 1, $children=FALSE, $child_of=0, $categories=0, $recurse=0, $feed = '', $feed_image = '', $exclude = '', $hierarchical=FALSE) {
|
||||
@ -433,7 +433,7 @@ function wp_list_cats($args = '') {
|
||||
$r['style'] = 'break';
|
||||
$r['title_li'] = '';
|
||||
|
||||
return wp_list_categories($r);
|
||||
return wp_list_categories($r);
|
||||
}
|
||||
|
||||
function dropdown_cats($optionall = 1, $all = 'All', $orderby = 'ID', $order = 'asc',
|
||||
|
@ -65,18 +65,18 @@ function wpautop($pee, $br = 1) {
|
||||
$pee = $pee . "\n"; // just to make things a little easier, pad the end
|
||||
$pee = preg_replace('|<br />\s*<br />|', "\n\n", $pee);
|
||||
// Space things out a little
|
||||
$pee = preg_replace('!(<(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)!', "\n$1", $pee);
|
||||
$pee = preg_replace('!(<(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)!', "\n$1", $pee);
|
||||
$pee = preg_replace('!(</(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])>)!', "$1\n\n", $pee);
|
||||
$pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines
|
||||
$pee = str_replace(array("\r\n", "\r"), "\n", $pee); // cross-platform newlines
|
||||
$pee = preg_replace("/\n\n+/", "\n\n", $pee); // take care of duplicates
|
||||
$pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "<p>$1</p>\n", $pee); // make paragraphs, including one at the end
|
||||
$pee = preg_replace('|<p>\s*?</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace
|
||||
$pee = preg_replace('/\n?(.+?)(?:\n\s*\n|\z)/s', "<p>$1</p>\n", $pee); // make paragraphs, including one at the end
|
||||
$pee = preg_replace('|<p>\s*?</p>|', '', $pee); // under certain strange conditions it could create a P of entirely whitespace
|
||||
$pee = preg_replace('!<p>\s*(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|hr|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*</p>!', "$1", $pee); // don't pee all over a tag
|
||||
$pee = preg_replace("|<p>(<li.+?)</p>|", "$1", $pee); // problem with nested lists
|
||||
$pee = preg_replace('|<p><blockquote([^>]*)>|i', "<blockquote$1><p>", $pee);
|
||||
$pee = str_replace('</blockquote></p>', '</p></blockquote>', $pee);
|
||||
$pee = preg_replace('!<p>\s*(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|hr|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)!', "$1", $pee);
|
||||
$pee = preg_replace('!(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*</p>!', "$1", $pee);
|
||||
$pee = preg_replace('!(</?(?:table|thead|tfoot|caption|colgroup|tbody|tr|td|th|div|dl|dd|dt|ul|ol|li|pre|select|form|blockquote|address|math|p|h[1-6])[^>]*>)\s*</p>!', "$1", $pee);
|
||||
if ($br) {
|
||||
$pee = preg_replace('/<(script|style).*?<\/\\1>/se', 'str_replace("\n", "<WPPreserveNewline />", "\\0")', $pee);
|
||||
$pee = preg_replace('|(?<!<br />)\s*\n|', "<br />\n", $pee); // optionally make line breaks
|
||||
@ -86,7 +86,7 @@ function wpautop($pee, $br = 1) {
|
||||
$pee = preg_replace('!<br />(\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)[^>]*>)!', '$1', $pee);
|
||||
$pee = preg_replace('!(<pre.*?>)(.*?)</pre>!ise', " stripslashes('$1') . stripslashes(clean_pre('$2')) . '</pre>' ", $pee);
|
||||
|
||||
return $pee;
|
||||
return $pee;
|
||||
}
|
||||
|
||||
|
||||
@ -126,35 +126,35 @@ function wp_specialchars( $text, $quotes = 0 ) {
|
||||
}
|
||||
|
||||
function utf8_uri_encode( $utf8_string ) {
|
||||
$unicode = '';
|
||||
$values = array();
|
||||
$num_octets = 1;
|
||||
|
||||
for ($i = 0; $i < strlen( $utf8_string ); $i++ ) {
|
||||
$unicode = '';
|
||||
$values = array();
|
||||
$num_octets = 1;
|
||||
|
||||
$value = ord( $utf8_string[ $i ] );
|
||||
|
||||
if ( $value < 128 ) {
|
||||
$unicode .= chr($value);
|
||||
} else {
|
||||
if ( count( $values ) == 0 ) $num_octets = ( $value < 224 ) ? 2 : 3;
|
||||
|
||||
$values[] = $value;
|
||||
|
||||
if ( count( $values ) == $num_octets ) {
|
||||
for ($i = 0; $i < strlen( $utf8_string ); $i++ ) {
|
||||
|
||||
$value = ord( $utf8_string[ $i ] );
|
||||
|
||||
if ( $value < 128 ) {
|
||||
$unicode .= chr($value);
|
||||
} else {
|
||||
if ( count( $values ) == 0 ) $num_octets = ( $value < 224 ) ? 2 : 3;
|
||||
|
||||
$values[] = $value;
|
||||
|
||||
if ( count( $values ) == $num_octets ) {
|
||||
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 {
|
||||
$unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]);
|
||||
$unicode .= '%' . dechex($values[0]) . '%' . dechex($values[1]);
|
||||
}
|
||||
|
||||
$values = array();
|
||||
$num_octets = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $unicode;
|
||||
return $unicode;
|
||||
}
|
||||
|
||||
function remove_accents($string) {
|
||||
@ -339,7 +339,7 @@ function sanitize_title_with_dashes($title) {
|
||||
return $title;
|
||||
}
|
||||
|
||||
function convert_chars($content, $flag = 'obsolete') {
|
||||
function convert_chars($content, $flag = 'obsolete') {
|
||||
// Translation of invalid Unicode references range to valid range
|
||||
$wp_htmltranswinuni = array(
|
||||
'€' => '€', // the Euro sign
|
||||
@ -405,22 +405,22 @@ function funky_javascript_fix($text) {
|
||||
|
||||
/*
|
||||
balanceTags
|
||||
|
||||
|
||||
Balances Tags of string using a modified stack.
|
||||
|
||||
|
||||
@param text Text to be balanced
|
||||
@return Returns balanced text
|
||||
@author Leonard Lin (leonard@acm.org)
|
||||
@version v1.1
|
||||
@date November 4, 2001
|
||||
@license GPL v2.0
|
||||
@notes
|
||||
@changelog
|
||||
@notes
|
||||
@changelog
|
||||
--- Modified by Scott Reilly (coffee2code) 02 Aug 2004
|
||||
1.2 ***TODO*** Make better - change loop condition to $text
|
||||
1.1 Fixed handling of append/stack pop order of end text
|
||||
Added Cleaning Hooks
|
||||
1.0 First Version
|
||||
1.2 ***TODO*** Make better - change loop condition to $text
|
||||
1.1 Fixed handling of append/stack pop order of end text
|
||||
Added Cleaning Hooks
|
||||
1.0 First Version
|
||||
*/
|
||||
function balanceTags($text, $is_comment = 0, $force = false) {
|
||||
|
||||
@ -446,7 +446,7 @@ function balanceTags($text, $is_comment = 0, $force = false) {
|
||||
if ($regex[1][0] == "/") { // End Tag
|
||||
$tag = strtolower(substr($regex[1],1));
|
||||
// if too many closing tags
|
||||
if($stacksize <= 0) {
|
||||
if($stacksize <= 0) {
|
||||
$tag = '';
|
||||
//or close to be safe $tag = '/' . $tag;
|
||||
}
|
||||
@ -503,7 +503,7 @@ function balanceTags($text, $is_comment = 0, $force = false) {
|
||||
}
|
||||
$newtext .= substr($text,0,$i) . $tag;
|
||||
$text = substr($text,$i+$l);
|
||||
}
|
||||
}
|
||||
|
||||
// Clear Tag Queue
|
||||
$newtext .= $tagqueue;
|
||||
@ -552,10 +552,10 @@ function backslashit($string) {
|
||||
}
|
||||
|
||||
function trailingslashit($string) {
|
||||
if ( '/' != substr($string, -1)) {
|
||||
$string .= '/';
|
||||
}
|
||||
return $string;
|
||||
if ( '/' != substr($string, -1)) {
|
||||
$string .= '/';
|
||||
}
|
||||
return $string;
|
||||
}
|
||||
|
||||
function addslashes_gpc($gpc) {
|
||||
@ -571,11 +571,11 @@ function addslashes_gpc($gpc) {
|
||||
|
||||
function stripslashes_deep($value)
|
||||
{
|
||||
$value = is_array($value) ?
|
||||
array_map('stripslashes_deep', $value) :
|
||||
stripslashes($value);
|
||||
$value = is_array($value) ?
|
||||
array_map('stripslashes_deep', $value) :
|
||||
stripslashes($value);
|
||||
|
||||
return $value;
|
||||
return $value;
|
||||
}
|
||||
|
||||
function antispambot($emailaddy, $mailto=0) {
|
||||
@ -731,7 +731,7 @@ function sanitize_email($email) {
|
||||
return preg_replace('/[^a-z0-9+_.@-]/i', '', $email);
|
||||
}
|
||||
|
||||
function human_time_diff( $from, $to = '' ) {
|
||||
function human_time_diff( $from, $to = '' ) {
|
||||
if ( empty($to) )
|
||||
$to = time();
|
||||
$diff = (int) abs($to - $from);
|
||||
@ -745,7 +745,7 @@ function human_time_diff( $from, $to = '' ) {
|
||||
$hours = round($diff / 3600);
|
||||
if ($hours <= 1)
|
||||
$since = __('1 hour');
|
||||
else
|
||||
else
|
||||
$since = sprintf( __('%s hours'), $hours );
|
||||
} elseif ($diff >= 86400) {
|
||||
$days = round($diff / 86400);
|
||||
|
@ -12,7 +12,7 @@ function mysql2date($dateformatstring, $mysqlstring, $translate = true) {
|
||||
|
||||
if( 'U' == $dateformatstring )
|
||||
return $i;
|
||||
|
||||
|
||||
if ( -1 == $i || false == $i )
|
||||
$i = 0;
|
||||
|
||||
@ -462,7 +462,7 @@ function wp_get_http_headers( $url, $red = 1 ) {
|
||||
@set_time_limit( 60 );
|
||||
|
||||
if ( $red > 5 )
|
||||
return false;
|
||||
return false;
|
||||
|
||||
$parts = parse_url( $url );
|
||||
$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);
|
||||
$headers['response'] = $return[1]; // HTTP response code eg 204, 200, 404
|
||||
|
||||
$code = $headers['response'];
|
||||
if ( ('302' == $code || '301' == $code) && isset($headers['location']) )
|
||||
return wp_get_http_headers( $headers['location'], ++$red );
|
||||
$code = $headers['response'];
|
||||
if ( ('302' == $code || '301' == $code) && isset($headers['location']) )
|
||||
return wp_get_http_headers( $headers['location'], ++$red );
|
||||
|
||||
return $headers;
|
||||
}
|
||||
@ -801,8 +801,8 @@ function get_num_queries() {
|
||||
}
|
||||
|
||||
function bool_from_yn($yn) {
|
||||
if ($yn == 'Y') return 1;
|
||||
return 0;
|
||||
if ($yn == 'Y') return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
function do_feed() {
|
||||
@ -957,7 +957,7 @@ function wp_upload_dir() {
|
||||
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);
|
||||
}
|
||||
|
||||
|
@ -471,7 +471,7 @@ function get_calendar($initial = true) {
|
||||
FROM $wpdb->posts
|
||||
WHERE post_date > '$thisyear-$thismonth-01'
|
||||
AND MONTH( post_date ) != MONTH( '$thisyear-$thismonth-01' )
|
||||
AND post_type = 'post' AND post_status = 'publish'
|
||||
AND post_type = 'post' AND post_status = 'publish'
|
||||
ORDER BY post_date ASC
|
||||
LIMIT 1");
|
||||
|
||||
|
@ -17,7 +17,7 @@ function get_locale() {
|
||||
return $locale;
|
||||
}
|
||||
|
||||
// Return a translated string.
|
||||
// Return a translated string.
|
||||
function __($text, $domain = 'default') {
|
||||
global $l10n;
|
||||
|
||||
|
@ -63,7 +63,7 @@ function get_permalink($id = 0) {
|
||||
$authordata = get_userdata($post->post_author);
|
||||
$author = $authordata->user_nicename;
|
||||
$date = explode(" ",date('Y m d H i s', $unixtime));
|
||||
$rewritereplace =
|
||||
$rewritereplace =
|
||||
array(
|
||||
$date[0],
|
||||
$date[1],
|
||||
@ -282,7 +282,7 @@ function get_previous_post($in_same_cat = false, $excluded_categories = '') {
|
||||
for ( $i = 1; $i < (count($cat_array)); $i++ ) {
|
||||
$join .= ' OR category_id = ' . intval($cat_array[$i]->cat_ID);
|
||||
}
|
||||
$join .= ')';
|
||||
$join .= ')';
|
||||
}
|
||||
|
||||
$sql_exclude_cats = '';
|
||||
@ -315,7 +315,7 @@ function get_next_post($in_same_cat = false, $excluded_categories = '') {
|
||||
for ( $i = 1; $i < (count($cat_array)); $i++ ) {
|
||||
$join .= ' OR category_id = ' . intval($cat_array[$i]->cat_ID);
|
||||
}
|
||||
$join .= ')';
|
||||
$join .= ')';
|
||||
}
|
||||
|
||||
$sql_exclude_cats = '';
|
||||
@ -350,7 +350,7 @@ function previous_post_link($format='« %link', $link='%title', $in_same_ca
|
||||
|
||||
$format = str_replace('%link', $link, $format);
|
||||
|
||||
echo $format;
|
||||
echo $format;
|
||||
}
|
||||
|
||||
function next_post_link($format='%link »', $link='%title', $in_same_cat = false, $excluded_categories = '') {
|
||||
@ -365,7 +365,7 @@ function next_post_link($format='%link »', $link='%title', $in_same_cat =
|
||||
$link = $string . $link . '</a>';
|
||||
$format = str_replace('%link', $link, $format);
|
||||
|
||||
echo $format;
|
||||
echo $format;
|
||||
}
|
||||
|
||||
function get_pagenum_link($pagenum = 1) {
|
||||
@ -373,7 +373,7 @@ function get_pagenum_link($pagenum = 1) {
|
||||
|
||||
$qstr = wp_specialchars($_SERVER['REQUEST_URI']);
|
||||
|
||||
$page_querystring = "paged";
|
||||
$page_querystring = "paged";
|
||||
$page_modstring = "page/";
|
||||
$page_modregex = "page/?";
|
||||
$permalink = 0;
|
||||
@ -492,7 +492,7 @@ function posts_nav_link($sep=' — ', $prelabel='« Previous Page', $nx
|
||||
if ( !is_singular() ) {
|
||||
$max_num_pages = $wp_query->max_num_pages;
|
||||
$paged = get_query_var('paged');
|
||||
|
||||
|
||||
//only have sep if there's both prev and next results
|
||||
if ($paged < 2 || $paged >= $max_num_pages) {
|
||||
$sep = '';
|
||||
|
@ -46,7 +46,7 @@ function get_currentuserinfo() {
|
||||
if ( ! empty($current_user) )
|
||||
return;
|
||||
|
||||
if ( empty($_COOKIE[USER_COOKIE]) || empty($_COOKIE[PASS_COOKIE]) ||
|
||||
if ( empty($_COOKIE[USER_COOKIE]) || empty($_COOKIE[PASS_COOKIE]) ||
|
||||
!wp_login($_COOKIE[USER_COOKIE], $_COOKIE[PASS_COOKIE], true) ) {
|
||||
wp_set_current_user(0);
|
||||
return false;
|
||||
@ -212,7 +212,7 @@ endif;
|
||||
if ( !function_exists('auth_redirect') ) :
|
||||
function auth_redirect() {
|
||||
// Checks if a user is logged in, if not redirects them to the login page
|
||||
if ( (!empty($_COOKIE[USER_COOKIE]) &&
|
||||
if ( (!empty($_COOKIE[USER_COOKIE]) &&
|
||||
!wp_login($_COOKIE[USER_COOKIE], $_COOKIE[PASS_COOKIE], true)) ||
|
||||
(empty($_COOKIE[USER_COOKIE])) ) {
|
||||
nocache_headers();
|
||||
@ -331,7 +331,7 @@ endif;
|
||||
if ( ! function_exists('wp_notify_postauthor') ) :
|
||||
function wp_notify_postauthor($comment_id, $comment_type='') {
|
||||
global $wpdb;
|
||||
|
||||
|
||||
$comment = get_comment($comment_id);
|
||||
$post = get_post($comment->comment_post_ID);
|
||||
$user = get_userdata( $post->post_author );
|
||||
@ -378,11 +378,11 @@ function wp_notify_postauthor($comment_id, $comment_type='') {
|
||||
$from = "From: \"$blogname\" <$wp_email>";
|
||||
if ( '' != $comment->comment_author_email )
|
||||
$reply_to = "Reply-To: $comment->comment_author_email";
|
||||
} else {
|
||||
} else {
|
||||
$from = "From: \"$comment->comment_author\" <$wp_email>";
|
||||
if ( '' != $comment->comment_author_email )
|
||||
$reply_to = "Reply-To: \"$comment->comment_author_email\" <$comment->comment_author_email>";
|
||||
}
|
||||
}
|
||||
|
||||
$message_headers = "MIME-Version: 1.0\n"
|
||||
. "$from\n"
|
||||
@ -439,7 +439,7 @@ function wp_notify_moderator($comment_id) {
|
||||
$subject = apply_filters('comment_moderation_subject', $subject, $comment_id);
|
||||
|
||||
@wp_mail($admin_email, $subject, $notify_message);
|
||||
|
||||
|
||||
return true;
|
||||
}
|
||||
endif;
|
||||
@ -489,7 +489,7 @@ function wp_create_nonce($action = -1) {
|
||||
$uid = $user->id;
|
||||
|
||||
$i = ceil(time() / 43200);
|
||||
|
||||
|
||||
return substr(wp_hash($i . $action . $uid), -12, 10);
|
||||
}
|
||||
endif;
|
||||
|
@ -166,8 +166,8 @@ function get_posts($args) {
|
||||
$inclusions = '';
|
||||
if ( !empty($include) ) {
|
||||
$offset = 0; //ignore offset, category, exclude, meta_key, and meta_value params if using include
|
||||
$category = '';
|
||||
$exclude = '';
|
||||
$category = '';
|
||||
$exclude = '';
|
||||
$meta_key = '';
|
||||
$meta_value = '';
|
||||
$incposts = preg_split('/[\s,]+/',$include);
|
||||
@ -181,8 +181,8 @@ function get_posts($args) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty($inclusions))
|
||||
$inclusions .= ')';
|
||||
if (!empty($inclusions))
|
||||
$inclusions .= ')';
|
||||
|
||||
$exclusions = '';
|
||||
if ( !empty($exclude) ) {
|
||||
@ -196,12 +196,12 @@ function get_posts($args) {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty($exclusions))
|
||||
if (!empty($exclusions))
|
||||
$exclusions .= ')';
|
||||
|
||||
$query ="SELECT DISTINCT * FROM $wpdb->posts " ;
|
||||
$query .= ( empty( $category ) ? "" : ", $wpdb->post2cat " ) ;
|
||||
$query .= ( empty( $meta_key ) ? "" : ", $wpdb->postmeta " ) ;
|
||||
$query .= ( empty( $category ) ? "" : ", $wpdb->post2cat " ) ;
|
||||
$query .= ( empty( $meta_key ) ? "" : ", $wpdb->postmeta " ) ;
|
||||
$query .= " WHERE (post_type = 'post' AND post_status = 'publish') $exclusions $inclusions " ;
|
||||
$query .= ( empty( $category ) ? "" : "AND ($wpdb->posts.ID = $wpdb->post2cat.post_id AND $wpdb->post2cat.category_id = " . $category. ") " ) ;
|
||||
$query .= ( empty( $meta_key ) | empty($meta_value) ? "" : " AND ($wpdb->posts.ID = $wpdb->postmeta.post_id AND $wpdb->postmeta.meta_key = '$meta_key' AND $wpdb->postmeta.meta_value = '$meta_value' )" ) ;
|
||||
@ -400,9 +400,9 @@ function wp_get_post_categories($post_ID = 0) {
|
||||
|
||||
$post_ID = (int) $post_ID;
|
||||
|
||||
$sql = "SELECT category_id
|
||||
FROM $wpdb->post2cat
|
||||
WHERE post_id = '$post_ID'
|
||||
$sql = "SELECT category_id
|
||||
FROM $wpdb->post2cat
|
||||
WHERE post_id = '$post_ID'
|
||||
ORDER BY category_id";
|
||||
|
||||
$result = $wpdb->get_col($sql);
|
||||
@ -435,7 +435,7 @@ function wp_get_single_post($postid = 0, $mode = OBJECT) {
|
||||
// Set categories
|
||||
if($mode == OBJECT) {
|
||||
$post->post_category = wp_get_post_categories($postid);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$post['post_category'] = wp_get_post_categories($postid);
|
||||
}
|
||||
@ -635,13 +635,13 @@ function wp_insert_post($postarr = array()) {
|
||||
if ( !defined('WP_IMPORTING') ) {
|
||||
if ( $post_pingback )
|
||||
$result = $wpdb->query("
|
||||
INSERT INTO $wpdb->postmeta
|
||||
(post_id,meta_key,meta_value)
|
||||
INSERT INTO $wpdb->postmeta
|
||||
(post_id,meta_key,meta_value)
|
||||
VALUES ('$post_ID','_pingme','1')
|
||||
");
|
||||
$result = $wpdb->query("
|
||||
INSERT INTO $wpdb->postmeta
|
||||
(post_id,meta_key,meta_value)
|
||||
INSERT INTO $wpdb->postmeta
|
||||
(post_id,meta_key,meta_value)
|
||||
VALUES ('$post_ID','_encloseme','1')
|
||||
");
|
||||
wp_schedule_single_event(time(), 'do_pings');
|
||||
@ -653,7 +653,7 @@ function wp_insert_post($postarr = array()) {
|
||||
if ( !empty($page_template) )
|
||||
if ( ! update_post_meta($post_ID, '_wp_page_template', $page_template))
|
||||
add_post_meta($post_ID, '_wp_page_template', $page_template, true);
|
||||
|
||||
|
||||
if ( $post_status == 'publish' )
|
||||
do_action('publish_page', $post_ID);
|
||||
}
|
||||
@ -684,22 +684,22 @@ function wp_update_post($postarr = array()) {
|
||||
$post = add_magic_quotes($post);
|
||||
|
||||
// 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']) )
|
||||
$post_cats = $postarr['post_category'];
|
||||
else
|
||||
$post_cats = $post['post_category'];
|
||||
$post_cats = $postarr['post_category'];
|
||||
else
|
||||
$post_cats = $post['post_category'];
|
||||
|
||||
// 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']) &&
|
||||
('0000-00-00 00:00:00' == $post['post_date']) )
|
||||
if ( 'draft' == $post['post_status'] && empty($postarr['edit_date']) && empty($postarr['post_date']) &&
|
||||
('0000-00-00 00:00:00' == $post['post_date']) )
|
||||
$clear_date = true;
|
||||
else
|
||||
$clear_date = false;
|
||||
|
||||
// Merge old and new fields with new fields overwriting old ones.
|
||||
$postarr = array_merge($post, $postarr);
|
||||
$postarr['post_category'] = $post_cats;
|
||||
// Merge old and new fields with new fields overwriting old ones.
|
||||
$postarr = array_merge($post, $postarr);
|
||||
$postarr['post_category'] = $post_cats;
|
||||
if ( $clear_date ) {
|
||||
$postarr['post_date'] = '';
|
||||
$postarr['post_date_gmt'] = '';
|
||||
@ -733,8 +733,8 @@ function wp_set_post_categories($post_ID = 0, $post_categories = array()) {
|
||||
|
||||
// First the old categories
|
||||
$old_categories = $wpdb->get_col("
|
||||
SELECT category_id
|
||||
FROM $wpdb->post2cat
|
||||
SELECT category_id
|
||||
FROM $wpdb->post2cat
|
||||
WHERE post_id = $post_ID");
|
||||
|
||||
if (!$old_categories) {
|
||||
@ -749,9 +749,9 @@ function wp_set_post_categories($post_ID = 0, $post_categories = array()) {
|
||||
if ($delete_cats) {
|
||||
foreach ($delete_cats as $del) {
|
||||
$wpdb->query("
|
||||
DELETE FROM $wpdb->post2cat
|
||||
WHERE category_id = $del
|
||||
AND post_id = $post_ID
|
||||
DELETE FROM $wpdb->post2cat
|
||||
WHERE category_id = $del
|
||||
AND post_id = $post_ID
|
||||
");
|
||||
}
|
||||
}
|
||||
@ -848,10 +848,10 @@ function trackback_url_list($tb_list, $post_id) {
|
||||
|
||||
$trackback_urls = explode(',', $tb_list);
|
||||
foreach($trackback_urls as $tb_url) {
|
||||
$tb_url = trim($tb_url);
|
||||
trackback($tb_url, stripslashes($post_title), $excerpt, $post_id);
|
||||
$tb_url = trim($tb_url);
|
||||
trackback($tb_url, stripslashes($post_title), $excerpt, $post_id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
@ -928,7 +928,7 @@ function get_page_by_path($page_path, $output = OBJECT) {
|
||||
|
||||
$pages = $wpdb->get_results("SELECT ID, post_name, post_parent FROM $wpdb->posts WHERE post_name = '$leaf_path' AND post_type='page'");
|
||||
|
||||
if ( empty($pages) )
|
||||
if ( empty($pages) )
|
||||
return NULL;
|
||||
|
||||
foreach ($pages as $page) {
|
||||
@ -1018,8 +1018,8 @@ function &get_pages($args = '') {
|
||||
|
||||
$inclusions = '';
|
||||
if ( !empty($include) ) {
|
||||
$child_of = 0; //ignore child_of, exclude, meta_key, and meta_value params if using include
|
||||
$exclude = '';
|
||||
$child_of = 0; //ignore child_of, exclude, meta_key, and meta_value params if using include
|
||||
$exclude = '';
|
||||
$meta_key = '';
|
||||
$meta_value = '';
|
||||
$incpages = preg_split('/[\s,]+/',$include);
|
||||
@ -1032,8 +1032,8 @@ function &get_pages($args = '') {
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!empty($inclusions))
|
||||
$inclusions .= ')';
|
||||
if (!empty($inclusions))
|
||||
$inclusions .= ')';
|
||||
|
||||
$exclusions = '';
|
||||
if ( !empty($exclude) ) {
|
||||
@ -1196,7 +1196,7 @@ function wp_insert_attachment($object, $file = false, $post_parent = 0) {
|
||||
|
||||
if (empty($post_date))
|
||||
$post_date = current_time('mysql');
|
||||
if (empty($post_date_gmt))
|
||||
if (empty($post_date_gmt))
|
||||
$post_date_gmt = current_time('mysql', 1);
|
||||
|
||||
if ( empty($comment_status) ) {
|
||||
|
@ -3,7 +3,7 @@
|
||||
/*
|
||||
* The Big Query.
|
||||
*/
|
||||
|
||||
|
||||
function get_query_var($var) {
|
||||
global $wp_query;
|
||||
|
||||
@ -224,7 +224,7 @@ function is_404 () {
|
||||
/*
|
||||
* The Loop. Post loop control.
|
||||
*/
|
||||
|
||||
|
||||
function have_posts() {
|
||||
global $wp_query;
|
||||
|
||||
@ -416,8 +416,8 @@ class WP_Query {
|
||||
} elseif ( $qv['p'] ) {
|
||||
$this->is_single = true;
|
||||
} elseif (('' != $qv['hour']) && ('' != $qv['minute']) &&('' != $qv['second']) && ('' != $qv['year']) && ('' != $qv['monthnum']) && ('' != $qv['day'])) {
|
||||
// If year, month, day, hour, minute, and second are set, a single
|
||||
// post is being queried.
|
||||
// If year, month, day, hour, minute, and second are set, a single
|
||||
// post is being queried.
|
||||
$this->is_single = true;
|
||||
} elseif ('' != $qv['static'] || '' != $qv['pagename'] || (int) $qv['page_id']) {
|
||||
$this->is_page = true;
|
||||
@ -493,7 +493,7 @@ class WP_Query {
|
||||
if ('' != $qv['category_name']) {
|
||||
$this->is_category = true;
|
||||
}
|
||||
|
||||
|
||||
if ((empty($qv['author'])) || ($qv['author'] == '0')) {
|
||||
$this->is_author = false;
|
||||
} else {
|
||||
@ -771,7 +771,7 @@ class WP_Query {
|
||||
|
||||
// Category stuff
|
||||
|
||||
if ((empty($q['cat'])) || ($q['cat'] == '0') ||
|
||||
if ((empty($q['cat'])) || ($q['cat'] == '0') ||
|
||||
// Bypass cat checks if fetching specific posts
|
||||
( $this->is_single || $this->is_page )) {
|
||||
$whichcat='';
|
||||
@ -788,7 +788,7 @@ class WP_Query {
|
||||
if ( $in )
|
||||
$in_cats .= "$cat, " . get_category_children($cat, '', ', ');
|
||||
else
|
||||
$out_cats .= "$cat, " . get_category_children($cat, '', ', ');
|
||||
$out_cats .= "$cat, " . get_category_children($cat, '', ', ');
|
||||
}
|
||||
$in_cats = substr($in_cats, 0, -2);
|
||||
$out_cats = substr($out_cats, 0, -2);
|
||||
@ -831,7 +831,7 @@ class WP_Query {
|
||||
$reqcat = 0;
|
||||
|
||||
$q['cat'] = $reqcat;
|
||||
|
||||
|
||||
$tables = ", $wpdb->post2cat, $wpdb->categories";
|
||||
$join = " LEFT JOIN $wpdb->post2cat ON ($wpdb->posts.ID = $wpdb->post2cat.post_id) LEFT JOIN $wpdb->categories ON ($wpdb->post2cat.category_id = $wpdb->categories.cat_ID) ";
|
||||
$whichcat = " AND category_id IN ({$q['cat']}, ";
|
||||
@ -922,7 +922,7 @@ class WP_Query {
|
||||
|
||||
if ( is_admin() )
|
||||
$where .= " OR post_status = 'future' OR post_status = 'draft'";
|
||||
|
||||
|
||||
if ( is_user_logged_in() ) {
|
||||
if ( 'post' == $post_type )
|
||||
$cap = 'edit_private_posts';
|
||||
@ -1024,7 +1024,7 @@ class WP_Query {
|
||||
}
|
||||
|
||||
function next_post() {
|
||||
|
||||
|
||||
$this->current_post++;
|
||||
|
||||
$this->post = $this->posts[$this->current_post];
|
||||
@ -1060,7 +1060,7 @@ class WP_Query {
|
||||
$this->post = $this->posts[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function &query($query) {
|
||||
$this->parse_query($query);
|
||||
return $this->get_posts();
|
||||
|
@ -85,9 +85,9 @@ function wp_insert_user($userdata) {
|
||||
$wpdb->query( $query );
|
||||
$user_id = $ID;
|
||||
} else {
|
||||
$query = "INSERT INTO $wpdb->users
|
||||
$query = "INSERT INTO $wpdb->users
|
||||
(user_login, user_pass, user_email, user_url, user_registered, user_nicename, display_name)
|
||||
VALUES
|
||||
VALUES
|
||||
('$user_login', '$user_pass', '$user_email', '$user_url', '$user_registered', '$user_nicename', '$display_name')";
|
||||
$query = apply_filters('create_user_query', $query);
|
||||
$wpdb->query( $query );
|
||||
|
@ -16,15 +16,15 @@ function add_rewrite_tag($tagname, $regex) {
|
||||
if (strlen($tagname) < 3 || $tagname{0} != '%' || $tagname{strlen($tagname)-1} != '%') {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$qv = trim($tagname, '%');
|
||||
|
||||
|
||||
global $wp_rewrite, $wp;
|
||||
$wp->add_query_var($qv);
|
||||
$wp_rewrite->add_rewrite_tag($tagname, $regex, $qv . '=');
|
||||
}
|
||||
|
||||
//Add a new feed type like /atom1/
|
||||
//Add a new feed type like /atom1/
|
||||
function add_feed($feedname, $function) {
|
||||
global $wp_rewrite;
|
||||
if (!in_array($feedname, $wp_rewrite->feeds)) { //override the file if it is
|
||||
@ -169,7 +169,7 @@ class WP_Rewrite {
|
||||
var $non_wp_rules; //rules that don't redirect to WP's index.php
|
||||
var $endpoints;
|
||||
var $use_verbose_rules = false;
|
||||
var $rewritecode =
|
||||
var $rewritecode =
|
||||
array(
|
||||
'%year%',
|
||||
'%monthnum%',
|
||||
@ -185,7 +185,7 @@ class WP_Rewrite {
|
||||
'%search%'
|
||||
);
|
||||
|
||||
var $rewritereplace =
|
||||
var $rewritereplace =
|
||||
array(
|
||||
'([0-9]{4})',
|
||||
'([0-9]{1,2})',
|
||||
@ -201,7 +201,7 @@ class WP_Rewrite {
|
||||
'(.+)'
|
||||
);
|
||||
|
||||
var $queryreplace =
|
||||
var $queryreplace =
|
||||
array (
|
||||
'year=',
|
||||
'monthnum=',
|
||||
@ -218,7 +218,7 @@ class WP_Rewrite {
|
||||
);
|
||||
|
||||
var $feeds = array ( 'feed', 'rdf', 'rss', 'rss2', 'atom' );
|
||||
|
||||
|
||||
function using_permalinks() {
|
||||
if (empty($this->permalink_structure))
|
||||
return false;
|
||||
@ -235,7 +235,7 @@ class WP_Rewrite {
|
||||
if (preg_match('#^/*' . $this->index . '#', $this->permalink_structure)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -251,11 +251,11 @@ class WP_Rewrite {
|
||||
$match_suffix = '';
|
||||
|
||||
if (! empty($this->matches)) {
|
||||
$match_prefix = '$' . $this->matches . '[';
|
||||
$match_prefix = '$' . $this->matches . '[';
|
||||
$match_suffix = ']';
|
||||
}
|
||||
}
|
||||
|
||||
return "$match_prefix$number$match_suffix";
|
||||
return "$match_prefix$number$match_suffix";
|
||||
}
|
||||
|
||||
function page_rewrite_rules() {
|
||||
@ -301,13 +301,13 @@ class WP_Rewrite {
|
||||
$date_endian= $endian;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( empty($date_endian) )
|
||||
$date_endian = '%year%/%monthnum%/%day%';
|
||||
|
||||
// Do not allow the date tags and %post_id% to overlap in the permalink
|
||||
// structure. If they do, move the date tags to $front/date/.
|
||||
// structure. If they do, move the date tags to $front/date/.
|
||||
$front = $this->front;
|
||||
preg_match_all('/%.+?%/', $this->permalink_structure, $tokens);
|
||||
$tok_index = 1;
|
||||
@ -482,11 +482,11 @@ class WP_Rewrite {
|
||||
//build a regex to match the trackback and page/xx parts of URLs
|
||||
$trackbackregex = 'trackback/?$';
|
||||
$pageregex = 'page/?([0-9]{1,})/?$';
|
||||
|
||||
|
||||
//build up an array of endpoint regexes to append => queries to append
|
||||
if ($endpoints) {
|
||||
$ep_query_append = array ();
|
||||
foreach ($this->endpoints as $endpoint) {
|
||||
foreach ($this->endpoints as $endpoint) {
|
||||
//match everything after the endpoint name, but allow for nothing to appear there
|
||||
$epmatch = $endpoint[1] . '(/(.*))?/?$';
|
||||
//this will be appended on to the rest of the query for each dir
|
||||
@ -511,7 +511,7 @@ class WP_Rewrite {
|
||||
if (0 < $i) {
|
||||
$queries[$i] = $queries[$i - 1] . '&';
|
||||
}
|
||||
|
||||
|
||||
$query_token = str_replace($this->rewritecode, $this->queryreplace, $tokens[0][$i]) . $this->preg_index($i+1);
|
||||
$queries[$i] .= $query_token;
|
||||
}
|
||||
@ -548,7 +548,7 @@ class WP_Rewrite {
|
||||
$num_toks = preg_match_all('/%.+?%/', $struct, $toks);
|
||||
//get the 'tagname=$matches[i]'
|
||||
$query = $queries[$num_toks - 1];
|
||||
|
||||
|
||||
//set up $ep_mask_specific which is used to match more specific URL types
|
||||
switch ($dirs[$j]) {
|
||||
case '%year%': $ep_mask_specific = EP_YEAR; break;
|
||||
@ -580,15 +580,15 @@ class WP_Rewrite {
|
||||
$rewrite = array($feedmatch => $feedquery, $feedmatch2 => $feedquery2);
|
||||
if ($paged) //...and /page/xx ones
|
||||
$rewrite = array_merge($rewrite, array($pagematch => $pagequery));
|
||||
|
||||
|
||||
//if we've got some tags in this dir
|
||||
if ($num_toks) {
|
||||
$post = false;
|
||||
$page = false;
|
||||
|
||||
//check to see if this dir is permalink-level: i.e. the structure specifies an
|
||||
|
||||
//check to see if this dir is permalink-level: i.e. the structure specifies an
|
||||
//individual post. Do this by checking it contains at least one of 1) post name,
|
||||
//2) post ID, 3) page name, 4) timestamp (year, month, day, hour, second and
|
||||
//2) post ID, 3) page name, 4) timestamp (year, month, day, hour, second and
|
||||
//minute all present). Set these flags now as we need them for the endpoints.
|
||||
if (strstr($struct, '%postname%') || strstr($struct, '%post_id%')
|
||||
|| strstr($struct, '%pagename%')
|
||||
@ -597,7 +597,7 @@ class WP_Rewrite {
|
||||
if ( strstr($struct, '%pagename%') )
|
||||
$page = true;
|
||||
}
|
||||
|
||||
|
||||
//do endpoints
|
||||
if ($endpoints) {
|
||||
foreach ($ep_query_append as $regex => $ep) {
|
||||
@ -607,7 +607,7 @@ class WP_Rewrite {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//if we're creating rules for a permalink, do all the endpoints like attachments etc
|
||||
if ($post) {
|
||||
$post = true;
|
||||
@ -618,7 +618,7 @@ class WP_Rewrite {
|
||||
$match = rtrim($match, '/');
|
||||
//get rid of brackets
|
||||
$submatchbase = str_replace(array('(',')'),'',$match);
|
||||
|
||||
|
||||
//add a rule for at attachments, which take the form of <permalink>/some-text
|
||||
$sub1 = $submatchbase . '/([^/]+)/';
|
||||
$sub1tb = $sub1 . $trackbackregex; //add trackback regex <permalink>/trackback/...
|
||||
@ -626,19 +626,19 @@ class WP_Rewrite {
|
||||
$sub1feed2 = $sub1 . $feedregex2; //and <permalink>/(feed|atom...)
|
||||
//add an ? as we don't have to match that last slash, and finally a $ so we
|
||||
//match to the end of the URL
|
||||
|
||||
|
||||
//add another rule to match attachments in the explicit form:
|
||||
//<permalink>/attachment/some-text
|
||||
$sub2 = $submatchbase . '/attachment/([^/]+)/';
|
||||
$sub2tb = $sub2 . $trackbackregex; //and add trackbacks <permalink>/attachment/trackback
|
||||
$sub2feed = $sub2 . $feedregex; //feeds, <permalink>/attachment/feed/(atom|...)
|
||||
$sub2feed2 = $sub2 . $feedregex2; //and feeds again on to this <permalink>/attachment/(feed|atom...)
|
||||
|
||||
|
||||
//create queries for these extra tag-ons we've just dealt with
|
||||
$subquery = $index . '?attachment=' . $this->preg_index(1);
|
||||
$subtbquery = $subquery . '&tb=1';
|
||||
$subfeedquery = $subquery . '&feed=' . $this->preg_index(2);
|
||||
|
||||
|
||||
//do endpoints for attachments
|
||||
if ($endpoint) { foreach ($ep_query_append as $regex => $ep) {
|
||||
if ($ep[0] & EP_ATTACHMENT) {
|
||||
@ -646,11 +646,11 @@ class WP_Rewrite {
|
||||
$rewrite[$sub2 . $regex] = $subquery . '?' . $ep[1] . $this->preg_index(2);
|
||||
}
|
||||
} }
|
||||
|
||||
|
||||
//now we've finished with endpoints, finish off the $sub1 and $sub2 matches
|
||||
$sub1 .= '?$';
|
||||
$sub2 .= '?$';
|
||||
|
||||
|
||||
//allow URLs like <permalink>/2 for <permalink>/page/2
|
||||
$match = $match . '(/[0-9]+)?/?$';
|
||||
$query = $index . '?' . $query . '&page=' . $this->preg_index($num_toks + 1);
|
||||
@ -659,7 +659,7 @@ class WP_Rewrite {
|
||||
$match .= '?$';
|
||||
$query = $index . '?' . $query;
|
||||
}
|
||||
|
||||
|
||||
//create the final array for this dir by joining the $rewrite array (which currently
|
||||
//only contains rules/queries for trackback, pages etc) to the main regex/query for
|
||||
//this dir
|
||||
@ -669,7 +669,7 @@ class WP_Rewrite {
|
||||
if ($post) {
|
||||
//add trackback
|
||||
$rewrite = array_merge(array($trackbackmatch => $trackbackquery), $rewrite);
|
||||
|
||||
|
||||
//add regexes/queries for attachments, attachment trackbacks and so on
|
||||
if ( ! $page ) //require <permalink>/attachment/stuff form for pages because of confusion with subpages
|
||||
$rewrite = array_merge($rewrite, array($sub1 => $subquery, $sub1tb => $subtbquery, $sub1feed => $subfeedquery, $sub1feed2 => $subfeedquery));
|
||||
@ -763,11 +763,11 @@ class WP_Rewrite {
|
||||
|
||||
$home_root = parse_url(get_option('home'));
|
||||
$home_root = trailingslashit($home_root['path']);
|
||||
|
||||
|
||||
$rules = "<IfModule mod_rewrite.c>\n";
|
||||
$rules .= "RewriteEngine On\n";
|
||||
$rules .= "RewriteBase $home_root\n";
|
||||
|
||||
|
||||
//add in the rules that don't redirect to WP's index.php (and thus shouldn't be handled by WP at all)
|
||||
foreach ($this->non_wp_rules as $match => $query) {
|
||||
// Apache 1.3 does not support the reluctant (non-greedy) modifier.
|
||||
@ -819,7 +819,7 @@ class WP_Rewrite {
|
||||
|
||||
return $rules;
|
||||
}
|
||||
|
||||
|
||||
//Add a straight rewrite rule
|
||||
function add_rule($regex, $redirect) {
|
||||
//get everything up to the first ?
|
||||
@ -831,12 +831,12 @@ class WP_Rewrite {
|
||||
$this->extra_rules[$regex] = $redirect;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//add a rule that doesn't redirect to index.php
|
||||
function add_external_rule($regex, $redirect) {
|
||||
$this->non_wp_rules[$regex] = $redirect;
|
||||
}
|
||||
|
||||
|
||||
//add an endpoint, like /trackback/, to be inserted after certain URL types (specified in $places)
|
||||
function add_endpoint($name, $places) {
|
||||
global $wp;
|
||||
|
@ -11,7 +11,7 @@ define('RSS', 'RSS');
|
||||
define('ATOM', 'Atom');
|
||||
define('MAGPIE_USER_AGENT', 'WordPress/' . $wp_version);
|
||||
|
||||
class MagpieRSS {
|
||||
class MagpieRSS {
|
||||
var $parser;
|
||||
var $current_item = array(); // item currently being parsed
|
||||
var $items = array(); // collection of parsed items
|
||||
@ -25,7 +25,7 @@ class MagpieRSS {
|
||||
var $stack = array(); // parser stack
|
||||
var $inchannel = false;
|
||||
var $initem = false;
|
||||
var $incontent = false; // if in Atom <content mode="xml"> field
|
||||
var $incontent = false; // if in Atom <content mode="xml"> field
|
||||
var $intextinput = false;
|
||||
var $inimage = false;
|
||||
var $current_field = '';
|
||||
@ -54,10 +54,10 @@ class MagpieRSS {
|
||||
# setup handlers
|
||||
#
|
||||
xml_set_object( $this->parser, $this );
|
||||
xml_set_element_handler($this->parser,
|
||||
xml_set_element_handler($this->parser,
|
||||
'feed_start_element', 'feed_end_element' );
|
||||
|
||||
xml_set_character_data_handler( $this->parser, 'feed_cdata' );
|
||||
xml_set_character_data_handler( $this->parser, 'feed_cdata' );
|
||||
|
||||
$status = xml_parse( $this->parser, $source );
|
||||
|
||||
@ -85,7 +85,7 @@ class MagpieRSS {
|
||||
// check for a namespace, and split if found
|
||||
$ns = false;
|
||||
if ( strpos( $element, ':' ) ) {
|
||||
list($ns, $el) = split( ':', $element, 2);
|
||||
list($ns, $el) = split( ':', $element, 2);
|
||||
}
|
||||
if ( $ns and $ns != 'rdf' ) {
|
||||
$this->current_namespace = $ns;
|
||||
@ -111,11 +111,11 @@ class MagpieRSS {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( $el == 'channel' )
|
||||
if ( $el == 'channel' )
|
||||
{
|
||||
$this->inchannel = true;
|
||||
}
|
||||
elseif ($el == 'item' or $el == 'entry' )
|
||||
elseif ($el == 'item' or $el == 'entry' )
|
||||
{
|
||||
$this->initem = true;
|
||||
if ( isset($attrs['rdf:about']) ) {
|
||||
@ -125,18 +125,18 @@ class MagpieRSS {
|
||||
|
||||
// if we're in the default namespace of an RSS feed,
|
||||
// record textinput or image fields
|
||||
elseif (
|
||||
$this->feed_type == RSS and
|
||||
$this->current_namespace == '' and
|
||||
$el == 'textinput' )
|
||||
elseif (
|
||||
$this->feed_type == RSS and
|
||||
$this->current_namespace == '' and
|
||||
$el == 'textinput' )
|
||||
{
|
||||
$this->intextinput = true;
|
||||
}
|
||||
|
||||
elseif (
|
||||
$this->feed_type == RSS and
|
||||
$this->current_namespace == '' and
|
||||
$el == 'image' )
|
||||
$this->feed_type == RSS and
|
||||
$this->current_namespace == '' and
|
||||
$el == 'image' )
|
||||
{
|
||||
$this->inimage = true;
|
||||
}
|
||||
@ -155,12 +155,12 @@ class MagpieRSS {
|
||||
}
|
||||
|
||||
// if inside an Atom content construct (e.g. content or summary) field treat tags as text
|
||||
elseif ($this->feed_type == ATOM and $this->incontent )
|
||||
elseif ($this->feed_type == ATOM and $this->incontent )
|
||||
{
|
||||
// if tags are inlined, then flatten
|
||||
$attrs_str = join(' ',
|
||||
array_map('map_attrs',
|
||||
array_keys($attrs),
|
||||
$attrs_str = join(' ',
|
||||
array_map('map_attrs',
|
||||
array_keys($attrs),
|
||||
array_values($attrs) ) );
|
||||
|
||||
$this->append_content( "<$element $attrs_str>" );
|
||||
@ -172,9 +172,9 @@ class MagpieRSS {
|
||||
// Magpie treats link elements of type rel='alternate'
|
||||
// as being equivalent to RSS's simple link element.
|
||||
//
|
||||
elseif ($this->feed_type == ATOM and $el == 'link' )
|
||||
elseif ($this->feed_type == ATOM and $el == 'link' )
|
||||
{
|
||||
if ( isset($attrs['rel']) and $attrs['rel'] == 'alternate' )
|
||||
if ( isset($attrs['rel']) and $attrs['rel'] == 'alternate' )
|
||||
{
|
||||
$link_el = 'link';
|
||||
}
|
||||
@ -194,7 +194,7 @@ class MagpieRSS {
|
||||
|
||||
function feed_cdata ($p, $text) {
|
||||
|
||||
if ($this->feed_type == ATOM and $this->incontent)
|
||||
if ($this->feed_type == ATOM and $this->incontent)
|
||||
{
|
||||
$this->append_content( $text );
|
||||
}
|
||||
@ -207,17 +207,17 @@ class MagpieRSS {
|
||||
function feed_end_element ($p, $el) {
|
||||
$el = strtolower($el);
|
||||
|
||||
if ( $el == 'item' or $el == 'entry' )
|
||||
if ( $el == 'item' or $el == 'entry' )
|
||||
{
|
||||
$this->items[] = $this->current_item;
|
||||
$this->current_item = array();
|
||||
$this->initem = false;
|
||||
}
|
||||
elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'textinput' )
|
||||
elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'textinput' )
|
||||
{
|
||||
$this->intextinput = false;
|
||||
}
|
||||
elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'image' )
|
||||
elseif ($this->feed_type == RSS and $this->current_namespace == '' and $el == 'image' )
|
||||
{
|
||||
$this->inimage = false;
|
||||
}
|
||||
@ -225,14 +225,14 @@ class MagpieRSS {
|
||||
{
|
||||
$this->incontent = false;
|
||||
}
|
||||
elseif ($el == 'channel' or $el == 'feed' )
|
||||
elseif ($el == 'channel' or $el == 'feed' )
|
||||
{
|
||||
$this->inchannel = false;
|
||||
}
|
||||
elseif ($this->feed_type == ATOM and $this->incontent ) {
|
||||
// balance tags properly
|
||||
// note: i don't think this is actually neccessary
|
||||
if ( $this->stack[0] == $el )
|
||||
if ( $this->stack[0] == $el )
|
||||
{
|
||||
$this->append_content("</$el>");
|
||||
}
|
||||
@ -270,7 +270,7 @@ class MagpieRSS {
|
||||
if (!$el) {
|
||||
return;
|
||||
}
|
||||
if ( $this->current_namespace )
|
||||
if ( $this->current_namespace )
|
||||
{
|
||||
if ( $this->initem ) {
|
||||
$this->concat(
|
||||
@ -395,7 +395,7 @@ function fetch_rss ($url) {
|
||||
// error("Failed to fetch $url and cache is off");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
// else cache is ON
|
||||
else {
|
||||
// Flow
|
||||
@ -472,7 +472,7 @@ function fetch_rss ($url) {
|
||||
if ( $resp->error ) {
|
||||
# compensate for Snoopy's annoying habbit to tacking
|
||||
# on '\n'
|
||||
$http_error = substr($resp->error, 0, -2);
|
||||
$http_error = substr($resp->error, 0, -2);
|
||||
$errormsg .= "(HTTP Error: $http_error)";
|
||||
}
|
||||
else {
|
||||
@ -613,28 +613,28 @@ function init () {
|
||||
}
|
||||
}
|
||||
|
||||
function is_info ($sc) {
|
||||
return $sc >= 100 && $sc < 200;
|
||||
function is_info ($sc) {
|
||||
return $sc >= 100 && $sc < 200;
|
||||
}
|
||||
|
||||
function is_success ($sc) {
|
||||
return $sc >= 200 && $sc < 300;
|
||||
function is_success ($sc) {
|
||||
return $sc >= 200 && $sc < 300;
|
||||
}
|
||||
|
||||
function is_redirect ($sc) {
|
||||
return $sc >= 300 && $sc < 400;
|
||||
function is_redirect ($sc) {
|
||||
return $sc >= 300 && $sc < 400;
|
||||
}
|
||||
|
||||
function is_error ($sc) {
|
||||
return $sc >= 400 && $sc < 600;
|
||||
function is_error ($sc) {
|
||||
return $sc >= 400 && $sc < 600;
|
||||
}
|
||||
|
||||
function is_client_error ($sc) {
|
||||
return $sc >= 400 && $sc < 500;
|
||||
function is_client_error ($sc) {
|
||||
return $sc >= 400 && $sc < 500;
|
||||
}
|
||||
|
||||
function is_server_error ($sc) {
|
||||
return $sc >= 500 && $sc < 600;
|
||||
function is_server_error ($sc) {
|
||||
return $sc >= 500 && $sc < 600;
|
||||
}
|
||||
|
||||
class RSSCache {
|
||||
@ -685,7 +685,7 @@ class RSSCache {
|
||||
$cache_option = 'rss_' . $this->file_name( $url );
|
||||
|
||||
if ( ! get_option( $cache_option ) ) {
|
||||
$this->debug(
|
||||
$this->debug(
|
||||
"Cache doesn't contain: $url (cache option: $cache_option)"
|
||||
);
|
||||
return 0;
|
||||
@ -757,7 +757,7 @@ class RSSCache {
|
||||
\*=======================================================================*/
|
||||
function error ($errormsg, $lvl=E_USER_WARNING) {
|
||||
// append PHP's error message if track_errors enabled
|
||||
if ( isset($php_errormsg) ) {
|
||||
if ( isset($php_errormsg) ) {
|
||||
$errormsg .= " ($php_errormsg)";
|
||||
}
|
||||
$this->ERROR = $errormsg;
|
||||
@ -781,7 +781,7 @@ function parse_w3cdtf ( $date_str ) {
|
||||
$pat = "/(\d{4})-(\d{2})-(\d{2})T(\d{2}):(\d{2})(:(\d{2}))?(?:([-+])(\d{2}):?(\d{2})|(Z))?/";
|
||||
|
||||
if ( preg_match( $pat, $date_str, $match ) ) {
|
||||
list( $year, $month, $day, $hours, $minutes, $seconds) =
|
||||
list( $year, $month, $day, $hours, $minutes, $seconds) =
|
||||
array( $match[1], $match[2], $match[3], $match[4], $match[5], $match[6]);
|
||||
|
||||
# calc epoch for current date assuming GMT
|
||||
|
@ -73,7 +73,7 @@ class WP_Scripts {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Determines dependencies of scripts
|
||||
@ -159,7 +159,7 @@ class WP_Scripts {
|
||||
endswitch;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
class _WP_Script {
|
||||
|
@ -152,7 +152,7 @@ function setup_userdata($user_id = '') {
|
||||
|
||||
if ( '' == $user_id )
|
||||
$user = wp_get_current_user();
|
||||
else
|
||||
else
|
||||
$user = new WP_User($user_id);
|
||||
|
||||
if ( 0 == $user->ID )
|
||||
|
@ -90,7 +90,7 @@ class wpdb {
|
||||
function print_error($str = '') {
|
||||
global $EZSQL_ERROR;
|
||||
if (!$str) $str = mysql_error();
|
||||
$EZSQL_ERROR[] =
|
||||
$EZSQL_ERROR[] =
|
||||
array ('query' => $this->last_query, 'error_str' => $str);
|
||||
|
||||
$str = htmlspecialchars($str, ENT_QUOTES);
|
||||
|
@ -16,11 +16,11 @@ if ((empty ($link_cat)) || ($link_cat == 'all') || ($link_cat == '0')) {
|
||||
?><?php echo '<?xml version="1.0"?'.">\n"; ?>
|
||||
<!-- generator="wordpress/<?php bloginfo_rss('version') ?>" -->
|
||||
<opml version="1.0">
|
||||
<head>
|
||||
<title>Links for <?php echo get_bloginfo('name').$cat_name ?></title>
|
||||
<dateCreated><?php echo gmdate("D, d M Y H:i:s"); ?> GMT</dateCreated>
|
||||
</head>
|
||||
<body>
|
||||
<head>
|
||||
<title>Links for <?php echo get_bloginfo('name').$cat_name ?></title>
|
||||
<dateCreated><?php echo gmdate("D, d M Y H:i:s"); ?> GMT</dateCreated>
|
||||
</head>
|
||||
<body>
|
||||
<?php
|
||||
|
||||
if (empty ($link_cat))
|
||||
@ -36,7 +36,7 @@ foreach ((array) $cats as $cat) {
|
||||
$bookmarks = get_bookmarks("category={$cat->cat_ID}");
|
||||
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
|
||||
|
||||
}
|
||||
|
@ -274,7 +274,7 @@ case 'register' :
|
||||
<?php
|
||||
break;
|
||||
|
||||
case 'login' :
|
||||
case 'login' :
|
||||
default:
|
||||
$user_login = '';
|
||||
$user_pass = '';
|
||||
|
@ -12,7 +12,7 @@ $more = 1;
|
||||
<?php echo '<?xml version="1.0" encoding="'.get_option('blog_charset').'"?'.'>'; ?>
|
||||
|
||||
<!-- generator="wordpress/<?php bloginfo_rss('version') ?>" -->
|
||||
<rss version="2.0"
|
||||
<rss version="2.0"
|
||||
xmlns:content="http://purl.org/rss/1.0/modules/content/"
|
||||
xmlns:wfw="http://wellformedweb.org/CommentAPI/"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
|
@ -47,8 +47,8 @@ if ( function_exists('mb_convert_encoding') ) { // For international trackbacks
|
||||
$blog_name = mb_convert_encoding($blog_name, get_option('blog_charset'), $charset);
|
||||
}
|
||||
|
||||
if ( is_single() || is_page() )
|
||||
$tb_id = $posts[0]->ID;
|
||||
if ( is_single() || is_page() )
|
||||
$tb_id = $posts[0]->ID;
|
||||
|
||||
if ( !intval( $tb_id ) )
|
||||
trackback_response(1, 'I really need an ID for this to work.');
|
||||
|
610
xmlrpc.php
610
xmlrpc.php
@ -66,48 +66,48 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
|
||||
function wp_xmlrpc_server() {
|
||||
$this->methods = array(
|
||||
// Blogger API
|
||||
'blogger.getUsersBlogs' => 'this:blogger_getUsersBlogs',
|
||||
'blogger.getUserInfo' => 'this:blogger_getUserInfo',
|
||||
'blogger.getPost' => 'this:blogger_getPost',
|
||||
'blogger.getRecentPosts' => 'this:blogger_getRecentPosts',
|
||||
'blogger.getTemplate' => 'this:blogger_getTemplate',
|
||||
'blogger.setTemplate' => 'this:blogger_setTemplate',
|
||||
'blogger.newPost' => 'this:blogger_newPost',
|
||||
'blogger.editPost' => 'this:blogger_editPost',
|
||||
'blogger.deletePost' => 'this:blogger_deletePost',
|
||||
// Blogger API
|
||||
'blogger.getUsersBlogs' => 'this:blogger_getUsersBlogs',
|
||||
'blogger.getUserInfo' => 'this:blogger_getUserInfo',
|
||||
'blogger.getPost' => 'this:blogger_getPost',
|
||||
'blogger.getRecentPosts' => 'this:blogger_getRecentPosts',
|
||||
'blogger.getTemplate' => 'this:blogger_getTemplate',
|
||||
'blogger.setTemplate' => 'this:blogger_setTemplate',
|
||||
'blogger.newPost' => 'this:blogger_newPost',
|
||||
'blogger.editPost' => 'this:blogger_editPost',
|
||||
'blogger.deletePost' => 'this:blogger_deletePost',
|
||||
|
||||
// MetaWeblog API (with MT extensions to structs)
|
||||
'metaWeblog.newPost' => 'this:mw_newPost',
|
||||
'metaWeblog.editPost' => 'this:mw_editPost',
|
||||
'metaWeblog.getPost' => 'this:mw_getPost',
|
||||
'metaWeblog.getRecentPosts' => 'this:mw_getRecentPosts',
|
||||
'metaWeblog.getCategories' => 'this:mw_getCategories',
|
||||
'metaWeblog.newMediaObject' => 'this:mw_newMediaObject',
|
||||
// MetaWeblog API (with MT extensions to structs)
|
||||
'metaWeblog.newPost' => 'this:mw_newPost',
|
||||
'metaWeblog.editPost' => 'this:mw_editPost',
|
||||
'metaWeblog.getPost' => 'this:mw_getPost',
|
||||
'metaWeblog.getRecentPosts' => 'this:mw_getRecentPosts',
|
||||
'metaWeblog.getCategories' => 'this:mw_getCategories',
|
||||
'metaWeblog.newMediaObject' => 'this:mw_newMediaObject',
|
||||
|
||||
// MetaWeblog API aliases for Blogger API
|
||||
// see http://www.xmlrpc.com/stories/storyReader$2460
|
||||
'metaWeblog.deletePost' => 'this:blogger_deletePost',
|
||||
'metaWeblog.getTemplate' => 'this:blogger_getTemplate',
|
||||
'metaWeblog.setTemplate' => 'this:blogger_setTemplate',
|
||||
'metaWeblog.getUsersBlogs' => 'this:blogger_getUsersBlogs',
|
||||
// MetaWeblog API aliases for Blogger API
|
||||
// see http://www.xmlrpc.com/stories/storyReader$2460
|
||||
'metaWeblog.deletePost' => 'this:blogger_deletePost',
|
||||
'metaWeblog.getTemplate' => 'this:blogger_getTemplate',
|
||||
'metaWeblog.setTemplate' => 'this:blogger_setTemplate',
|
||||
'metaWeblog.getUsersBlogs' => 'this:blogger_getUsersBlogs',
|
||||
|
||||
// MovableType API
|
||||
'mt.getCategoryList' => 'this:mt_getCategoryList',
|
||||
'mt.getRecentPostTitles' => 'this:mt_getRecentPostTitles',
|
||||
'mt.getPostCategories' => 'this:mt_getPostCategories',
|
||||
'mt.setPostCategories' => 'this:mt_setPostCategories',
|
||||
'mt.supportedMethods' => 'this:mt_supportedMethods',
|
||||
'mt.supportedTextFilters' => 'this:mt_supportedTextFilters',
|
||||
'mt.getTrackbackPings' => 'this:mt_getTrackbackPings',
|
||||
'mt.publishPost' => 'this:mt_publishPost',
|
||||
// MovableType API
|
||||
'mt.getCategoryList' => 'this:mt_getCategoryList',
|
||||
'mt.getRecentPostTitles' => 'this:mt_getRecentPostTitles',
|
||||
'mt.getPostCategories' => 'this:mt_getPostCategories',
|
||||
'mt.setPostCategories' => 'this:mt_setPostCategories',
|
||||
'mt.supportedMethods' => 'this:mt_supportedMethods',
|
||||
'mt.supportedTextFilters' => 'this:mt_supportedTextFilters',
|
||||
'mt.getTrackbackPings' => 'this:mt_getTrackbackPings',
|
||||
'mt.publishPost' => 'this:mt_publishPost',
|
||||
|
||||
// PingBack
|
||||
'pingback.ping' => 'this:pingback_ping',
|
||||
'pingback.extensions.getPingbacks' => 'this:pingback_extensions_getPingbacks',
|
||||
// PingBack
|
||||
'pingback.ping' => 'this:pingback_ping',
|
||||
'pingback.extensions.getPingbacks' => 'this:pingback_extensions_getPingbacks',
|
||||
|
||||
'demo.sayHello' => 'this:sayHello',
|
||||
'demo.addTwoNumbers' => 'this:addTwoNumbers'
|
||||
'demo.sayHello' => 'this:sayHello',
|
||||
'demo.addTwoNumbers' => 'this:addTwoNumbers'
|
||||
);
|
||||
$this->methods = apply_filters('xmlrpc_methods', $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) {
|
||||
if (!user_pass_ok($user_login, $user_pass)) {
|
||||
$this->error = new IXR_Error(403, 'Bad login/pass combination.');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
if (!user_pass_ok($user_login, $user_pass)) {
|
||||
$this->error = new IXR_Error(403, 'Bad login/pass combination.');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
function escape(&$array) {
|
||||
@ -181,25 +181,25 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
|
||||
$this->escape($args);
|
||||
|
||||
$user_login = $args[1];
|
||||
$user_pass = $args[2];
|
||||
$user_login = $args[1];
|
||||
$user_pass = $args[2];
|
||||
|
||||
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
||||
return $this->error;
|
||||
}
|
||||
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
$user_data = get_userdatabylogin($user_login);
|
||||
$user_data = get_userdatabylogin($user_login);
|
||||
|
||||
$struct = array(
|
||||
'nickname' => $user_data->nickname,
|
||||
'userid' => $user_data->ID,
|
||||
'url' => $user_data->user_url,
|
||||
'email' => $user_data->user_email,
|
||||
'lastname' => $user_data->last_name,
|
||||
'firstname' => $user_data->first_name
|
||||
);
|
||||
$struct = array(
|
||||
'nickname' => $user_data->nickname,
|
||||
'userid' => $user_data->ID,
|
||||
'url' => $user_data->user_url,
|
||||
'email' => $user_data->user_email,
|
||||
'lastname' => $user_data->last_name,
|
||||
'firstname' => $user_data->first_name
|
||||
);
|
||||
|
||||
return $struct;
|
||||
return $struct;
|
||||
}
|
||||
|
||||
|
||||
@ -208,81 +208,81 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
|
||||
$this->escape($args);
|
||||
|
||||
$post_ID = $args[1];
|
||||
$user_login = $args[2];
|
||||
$user_pass = $args[3];
|
||||
$post_ID = $args[1];
|
||||
$user_login = $args[2];
|
||||
$user_pass = $args[3];
|
||||
|
||||
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
||||
return $this->error;
|
||||
}
|
||||
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
$user_data = get_userdatabylogin($user_login);
|
||||
$post_data = wp_get_single_post($post_ID, ARRAY_A);
|
||||
$user_data = get_userdatabylogin($user_login);
|
||||
$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 .= '<category>'.$categories.'</category>';
|
||||
$content .= stripslashes($post_data['post_content']);
|
||||
$content = '<title>'.stripslashes($post_data['post_title']).'</title>';
|
||||
$content .= '<category>'.$categories.'</category>';
|
||||
$content .= stripslashes($post_data['post_content']);
|
||||
|
||||
$struct = array(
|
||||
'userid' => $post_data['post_author'],
|
||||
'dateCreated' => new IXR_Date(mysql2date('Ymd\TH:i:s', $post_data['post_date'])),
|
||||
'content' => $content,
|
||||
'postid' => $post_data['ID']
|
||||
);
|
||||
$struct = array(
|
||||
'userid' => $post_data['post_author'],
|
||||
'dateCreated' => new IXR_Date(mysql2date('Ymd\TH:i:s', $post_data['post_date'])),
|
||||
'content' => $content,
|
||||
'postid' => $post_data['ID']
|
||||
);
|
||||
|
||||
return $struct;
|
||||
return $struct;
|
||||
}
|
||||
|
||||
|
||||
/* blogger.getRecentPosts ...gets recent posts */
|
||||
function blogger_getRecentPosts($args) {
|
||||
|
||||
global $wpdb;
|
||||
global $wpdb;
|
||||
|
||||
$this->escape($args);
|
||||
|
||||
$blog_ID = $args[1]; /* though we don't use it yet */
|
||||
$user_login = $args[2];
|
||||
$user_pass = $args[3];
|
||||
$num_posts = $args[4];
|
||||
$blog_ID = $args[1]; /* though we don't use it yet */
|
||||
$user_login = $args[2];
|
||||
$user_pass = $args[3];
|
||||
$num_posts = $args[4];
|
||||
|
||||
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
||||
return $this->error;
|
||||
}
|
||||
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
$posts_list = wp_get_recent_posts($num_posts);
|
||||
$posts_list = wp_get_recent_posts($num_posts);
|
||||
|
||||
if (!$posts_list) {
|
||||
$this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.');
|
||||
return $this->error;
|
||||
}
|
||||
if (!$posts_list) {
|
||||
$this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.');
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
foreach ($posts_list as $entry) {
|
||||
|
||||
$post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']);
|
||||
$categories = implode(',', wp_get_post_categories($entry['ID']));
|
||||
foreach ($posts_list as $entry) {
|
||||
|
||||
$content = '<title>'.stripslashes($entry['post_title']).'</title>';
|
||||
$content .= '<category>'.$categories.'</category>';
|
||||
$content .= stripslashes($entry['post_content']);
|
||||
$post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']);
|
||||
$categories = implode(',', wp_get_post_categories($entry['ID']));
|
||||
|
||||
$struct[] = array(
|
||||
'userid' => $entry['post_author'],
|
||||
'dateCreated' => new IXR_Date($post_date),
|
||||
'content' => $content,
|
||||
'postid' => $entry['ID'],
|
||||
);
|
||||
$content = '<title>'.stripslashes($entry['post_title']).'</title>';
|
||||
$content .= '<category>'.$categories.'</category>';
|
||||
$content .= stripslashes($entry['post_content']);
|
||||
|
||||
}
|
||||
$struct[] = array(
|
||||
'userid' => $entry['post_author'],
|
||||
'dateCreated' => new IXR_Date($post_date),
|
||||
'content' => $content,
|
||||
'postid' => $entry['ID'],
|
||||
);
|
||||
|
||||
$recent_posts = array();
|
||||
for ($j=0; $j<count($struct); $j++) {
|
||||
array_push($recent_posts, $struct[$j]);
|
||||
}
|
||||
}
|
||||
|
||||
return $recent_posts;
|
||||
$recent_posts = array();
|
||||
for ($j=0; $j<count($struct); $j++) {
|
||||
array_push($recent_posts, $struct[$j]);
|
||||
}
|
||||
|
||||
return $recent_posts;
|
||||
}
|
||||
|
||||
|
||||
@ -712,96 +712,96 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
|
||||
$this->escape($args);
|
||||
|
||||
$blog_ID = $args[0];
|
||||
$user_login = $args[1];
|
||||
$user_pass = $args[2];
|
||||
$num_posts = $args[3];
|
||||
$blog_ID = $args[0];
|
||||
$user_login = $args[1];
|
||||
$user_pass = $args[2];
|
||||
$num_posts = $args[3];
|
||||
|
||||
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
||||
return $this->error;
|
||||
}
|
||||
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
$posts_list = wp_get_recent_posts($num_posts);
|
||||
$posts_list = wp_get_recent_posts($num_posts);
|
||||
|
||||
if (!$posts_list) {
|
||||
$this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.');
|
||||
return $this->error;
|
||||
}
|
||||
if (!$posts_list) {
|
||||
$this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.');
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
foreach ($posts_list as $entry) {
|
||||
|
||||
$post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']);
|
||||
$categories = array();
|
||||
$catids = wp_get_post_categories($entry['ID']);
|
||||
foreach($catids as $catid) {
|
||||
$categories[] = get_cat_name($catid);
|
||||
}
|
||||
foreach ($posts_list as $entry) {
|
||||
|
||||
$post = get_extended($entry['post_content']);
|
||||
$link = post_permalink($entry['ID']);
|
||||
$post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']);
|
||||
$categories = array();
|
||||
$catids = wp_get_post_categories($entry['ID']);
|
||||
foreach($catids as $catid) {
|
||||
$categories[] = get_cat_name($catid);
|
||||
}
|
||||
|
||||
$allow_comments = ('open' == $entry['comment_status']) ? 1 : 0;
|
||||
$allow_pings = ('open' == $entry['ping_status']) ? 1 : 0;
|
||||
$post = get_extended($entry['post_content']);
|
||||
$link = post_permalink($entry['ID']);
|
||||
|
||||
$struct[] = array(
|
||||
'dateCreated' => new IXR_Date($post_date),
|
||||
'userid' => $entry['post_author'],
|
||||
'postid' => $entry['ID'],
|
||||
'description' => $post['main'],
|
||||
'title' => $entry['post_title'],
|
||||
'link' => $link,
|
||||
'permaLink' => $link,
|
||||
$allow_comments = ('open' == $entry['comment_status']) ? 1 : 0;
|
||||
$allow_pings = ('open' == $entry['ping_status']) ? 1 : 0;
|
||||
|
||||
$struct[] = array(
|
||||
'dateCreated' => new IXR_Date($post_date),
|
||||
'userid' => $entry['post_author'],
|
||||
'postid' => $entry['ID'],
|
||||
'description' => $post['main'],
|
||||
'title' => $entry['post_title'],
|
||||
'link' => $link,
|
||||
'permaLink' => $link,
|
||||
// commented out because no other tool seems to use this
|
||||
// 'content' => $entry['post_content'],
|
||||
'categories' => $categories,
|
||||
'mt_excerpt' => $entry['post_excerpt'],
|
||||
'mt_text_more' => $post['extended'],
|
||||
'mt_allow_comments' => $allow_comments,
|
||||
'mt_allow_pings' => $allow_pings
|
||||
);
|
||||
'categories' => $categories,
|
||||
'mt_excerpt' => $entry['post_excerpt'],
|
||||
'mt_text_more' => $post['extended'],
|
||||
'mt_allow_comments' => $allow_comments,
|
||||
'mt_allow_pings' => $allow_pings
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
$recent_posts = array();
|
||||
for ($j=0; $j<count($struct); $j++) {
|
||||
array_push($recent_posts, $struct[$j]);
|
||||
}
|
||||
|
||||
return $recent_posts;
|
||||
$recent_posts = array();
|
||||
for ($j=0; $j<count($struct); $j++) {
|
||||
array_push($recent_posts, $struct[$j]);
|
||||
}
|
||||
|
||||
return $recent_posts;
|
||||
}
|
||||
|
||||
|
||||
/* metaweblog.getCategories ...returns the list of categories on a given weblog */
|
||||
function mw_getCategories($args) {
|
||||
|
||||
global $wpdb;
|
||||
global $wpdb;
|
||||
|
||||
$this->escape($args);
|
||||
|
||||
$blog_ID = $args[0];
|
||||
$user_login = $args[1];
|
||||
$user_pass = $args[2];
|
||||
$blog_ID = $args[0];
|
||||
$user_login = $args[1];
|
||||
$user_pass = $args[2];
|
||||
|
||||
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
||||
return $this->error;
|
||||
}
|
||||
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
$categories_struct = array();
|
||||
$categories_struct = array();
|
||||
|
||||
// FIXME: can we avoid using direct SQL there?
|
||||
if ($cats = $wpdb->get_results("SELECT cat_ID,cat_name FROM $wpdb->categories", ARRAY_A)) {
|
||||
foreach ($cats as $cat) {
|
||||
$struct['categoryId'] = $cat['cat_ID'];
|
||||
$struct['description'] = $cat['cat_name'];
|
||||
$struct['categoryName'] = $cat['cat_name'];
|
||||
$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']));
|
||||
// FIXME: can we avoid using direct SQL there?
|
||||
if ($cats = $wpdb->get_results("SELECT cat_ID,cat_name FROM $wpdb->categories", ARRAY_A)) {
|
||||
foreach ($cats as $cat) {
|
||||
$struct['categoryId'] = $cat['cat_ID'];
|
||||
$struct['description'] = $cat['cat_name'];
|
||||
$struct['categoryName'] = $cat['cat_name'];
|
||||
$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']));
|
||||
|
||||
$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);
|
||||
|
||||
$blog_ID = $args[0];
|
||||
$user_login = $args[1];
|
||||
$user_pass = $args[2];
|
||||
$num_posts = $args[3];
|
||||
$blog_ID = $args[0];
|
||||
$user_login = $args[1];
|
||||
$user_pass = $args[2];
|
||||
$num_posts = $args[3];
|
||||
|
||||
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
||||
return $this->error;
|
||||
}
|
||||
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
$posts_list = wp_get_recent_posts($num_posts);
|
||||
$posts_list = wp_get_recent_posts($num_posts);
|
||||
|
||||
if (!$posts_list) {
|
||||
$this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.');
|
||||
return $this->error;
|
||||
}
|
||||
if (!$posts_list) {
|
||||
$this->error = new IXR_Error(500, 'Either there are no posts, or something went wrong.');
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
foreach ($posts_list as $entry) {
|
||||
|
||||
$post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']);
|
||||
foreach ($posts_list as $entry) {
|
||||
|
||||
$struct[] = array(
|
||||
'dateCreated' => new IXR_Date($post_date),
|
||||
'userid' => $entry['post_author'],
|
||||
'postid' => $entry['ID'],
|
||||
'title' => $entry['post_title'],
|
||||
);
|
||||
$post_date = mysql2date('Ymd\TH:i:s', $entry['post_date']);
|
||||
|
||||
}
|
||||
$struct[] = array(
|
||||
'dateCreated' => new IXR_Date($post_date),
|
||||
'userid' => $entry['post_author'],
|
||||
'postid' => $entry['ID'],
|
||||
'title' => $entry['post_title'],
|
||||
);
|
||||
|
||||
$recent_posts = array();
|
||||
for ($j=0; $j<count($struct); $j++) {
|
||||
array_push($recent_posts, $struct[$j]);
|
||||
}
|
||||
|
||||
return $recent_posts;
|
||||
}
|
||||
|
||||
$recent_posts = array();
|
||||
for ($j=0; $j<count($struct); $j++) {
|
||||
array_push($recent_posts, $struct[$j]);
|
||||
}
|
||||
|
||||
return $recent_posts;
|
||||
}
|
||||
|
||||
|
||||
/* mt.getCategoryList ...returns the list of categories on a given weblog */
|
||||
function mt_getCategoryList($args) {
|
||||
|
||||
global $wpdb;
|
||||
global $wpdb;
|
||||
|
||||
$this->escape($args);
|
||||
|
||||
$blog_ID = $args[0];
|
||||
$user_login = $args[1];
|
||||
$user_pass = $args[2];
|
||||
$blog_ID = $args[0];
|
||||
$user_login = $args[1];
|
||||
$user_pass = $args[2];
|
||||
|
||||
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
||||
return $this->error;
|
||||
}
|
||||
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
$categories_struct = array();
|
||||
$categories_struct = array();
|
||||
|
||||
// FIXME: can we avoid using direct SQL there?
|
||||
if ($cats = $wpdb->get_results("SELECT cat_ID, cat_name FROM $wpdb->categories", ARRAY_A)) {
|
||||
foreach ($cats as $cat) {
|
||||
$struct['categoryId'] = $cat['cat_ID'];
|
||||
$struct['categoryName'] = $cat['cat_name'];
|
||||
// FIXME: can we avoid using direct SQL there?
|
||||
if ($cats = $wpdb->get_results("SELECT cat_ID, cat_name FROM $wpdb->categories", ARRAY_A)) {
|
||||
foreach ($cats as $cat) {
|
||||
$struct['categoryId'] = $cat['cat_ID'];
|
||||
$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);
|
||||
|
||||
$post_ID = $args[0];
|
||||
$user_login = $args[1];
|
||||
$user_pass = $args[2];
|
||||
$post_ID = $args[0];
|
||||
$user_login = $args[1];
|
||||
$user_pass = $args[2];
|
||||
|
||||
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
||||
return $this->error;
|
||||
}
|
||||
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
$categories = array();
|
||||
$catids = wp_get_post_categories(intval($post_ID));
|
||||
// first listed category will be the primary category
|
||||
$isPrimary = true;
|
||||
foreach($catids as $catid) {
|
||||
$categories[] = array(
|
||||
'categoryName' => get_cat_name($catid),
|
||||
'categoryId' => $catid,
|
||||
'isPrimary' => $isPrimary
|
||||
);
|
||||
$isPrimary = false;
|
||||
}
|
||||
|
||||
return $categories;
|
||||
$categories = array();
|
||||
$catids = wp_get_post_categories(intval($post_ID));
|
||||
// first listed category will be the primary category
|
||||
$isPrimary = true;
|
||||
foreach($catids as $catid) {
|
||||
$categories[] = array(
|
||||
'categoryName' => get_cat_name($catid),
|
||||
'categoryId' => $catid,
|
||||
'isPrimary' => $isPrimary
|
||||
);
|
||||
$isPrimary = false;
|
||||
}
|
||||
|
||||
return $categories;
|
||||
}
|
||||
|
||||
|
||||
@ -956,81 +956,81 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
|
||||
$this->escape($args);
|
||||
|
||||
$post_ID = $args[0];
|
||||
$user_login = $args[1];
|
||||
$user_pass = $args[2];
|
||||
$categories = $args[3];
|
||||
$post_ID = $args[0];
|
||||
$user_login = $args[1];
|
||||
$user_pass = $args[2];
|
||||
$categories = $args[3];
|
||||
|
||||
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
||||
return $this->error;
|
||||
}
|
||||
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
set_current_user(0, $user_login);
|
||||
if ( !current_user_can('edit_post', $post_ID) )
|
||||
return new IXR_Error(401, 'Sorry, you can not edit this post.');
|
||||
set_current_user(0, $user_login);
|
||||
if ( !current_user_can('edit_post', $post_ID) )
|
||||
return new IXR_Error(401, 'Sorry, you can not edit this post.');
|
||||
|
||||
foreach($categories as $cat) {
|
||||
$catids[] = $cat['categoryId'];
|
||||
}
|
||||
foreach($categories as $cat) {
|
||||
$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 */
|
||||
function mt_supportedMethods($args) {
|
||||
|
||||
$supported_methods = array();
|
||||
foreach($this->methods as $key=>$value) {
|
||||
$supported_methods[] = $key;
|
||||
}
|
||||
$supported_methods = array();
|
||||
foreach($this->methods as $key=>$value) {
|
||||
$supported_methods[] = $key;
|
||||
}
|
||||
|
||||
return $supported_methods;
|
||||
return $supported_methods;
|
||||
}
|
||||
|
||||
|
||||
/* 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) {
|
||||
return array();
|
||||
return array();
|
||||
}
|
||||
|
||||
|
||||
/* mt.getTrackbackPings ...returns trackbacks sent to a given post */
|
||||
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) {
|
||||
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
|
||||
);
|
||||
if (!$actual_post) {
|
||||
return new IXR_Error(404, 'Sorry, no such post.');
|
||||
}
|
||||
}
|
||||
|
||||
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);
|
||||
|
||||
$post_ID = $args[0];
|
||||
$user_login = $args[1];
|
||||
$user_pass = $args[2];
|
||||
$post_ID = $args[0];
|
||||
$user_login = $args[1];
|
||||
$user_pass = $args[2];
|
||||
|
||||
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
||||
return $this->error;
|
||||
}
|
||||
if (!$this->login_pass_ok($user_login, $user_pass)) {
|
||||
return $this->error;
|
||||
}
|
||||
|
||||
set_current_user(0, $user_login);
|
||||
if ( !current_user_can('edit_post', $post_ID) )
|
||||
return new IXR_Error(401, 'Sorry, you can not edit this post.');
|
||||
set_current_user(0, $user_login);
|
||||
if ( !current_user_can('edit_post', $post_ID) )
|
||||
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
|
||||
$cats = wp_get_post_categories($post_ID);
|
||||
$postdata['post_category'] = $cats;
|
||||
// retain old cats
|
||||
$cats = wp_get_post_categories($post_ID);
|
||||
$postdata['post_category'] = $cats;
|
||||
$this->escape($postdata);
|
||||
|
||||
$result = wp_update_post($postdata);
|
||||
$result = wp_update_post($postdata);
|
||||
|
||||
return $result;
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
@ -1073,7 +1073,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
|
||||
/* pingback.ping gets a pingback and registers it */
|
||||
function pingback_ping($args) {
|
||||
global $wpdb, $wp_version;
|
||||
global $wpdb, $wp_version;
|
||||
|
||||
$this->escape($args);
|
||||
|
||||
@ -1090,7 +1090,7 @@ class wp_xmlrpc_server extends IXR_Server {
|
||||
// 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')));
|
||||
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
|
||||
// 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
|
||||
that pingbacked the given URL
|
||||
specs on http://www.aquarionics.com/misc/archives/blogite/0198.html */
|
||||
that pingbacked the given URL
|
||||
specs on http://www.aquarionics.com/misc/archives/blogite/0198.html */
|
||||
function pingback_extensions_getPingbacks($args) {
|
||||
|
||||
global $wpdb;
|
||||
|
Loading…
Reference in New Issue
Block a user