<?php
-/* Short and sweet */
+/**
+ * Front to the WordPress application. This file doesn't do anything, but loads
+ * wp-blog-header.php which does and tells WordPress to load the theme.
+ *
+ * @package WordPress
+ */
+
+/**
+ * Tells WordPress to load the WordPress theme and output it.
+ *
+ * @var bool
+ */
define('WP_USE_THEMES', true);
+
+/** Loads the WordPress Environment and Template */
require('./wp-blog-header.php');
?>
\ No newline at end of file
<body>
<h1 id="logo" style="text-align: center">
<img alt="WordPress" src="wp-admin/images/wordpress-logo.png" />
- <br /> Version 2.5
+ <br /> Version 2.6.1
</h1>
<p style="text-align: center">Semantic Personal Publishing Platform</p>
<h1>Upgrading</h1>
<p>Before you upgrade anything, make sure you have backup copies of any files you may have modified such as <code>index.php</code>.</p>
-<h2>Upgrading from any previous WordPress to 2.5:</h2>
+<h2>Upgrading from any previous WordPress to 2.6.1:</h2>
<ol>
<li>Delete your old WP files, saving ones you've modified.</li>
<li>Upload the new files.</li>
<?php
define('DOING_AJAX', true);
-require_once('../wp-config.php');
+require_once('../wp-load.php');
require_once('includes/admin.php');
if ( !is_user_logged_in() )
$s = $_GET['q']; // is this slashed already?
- if ( strstr( $s, ',' ) )
- die; // it's a multiple tag insert, we won't find anything
- $results = $wpdb->get_col( "SELECT name FROM $wpdb->terms WHERE name LIKE ('%$s%')" );
+ if ( strstr( $s, ',' ) ) {
+ $s = explode( ',', $s );
+ $s = $s[count( $s ) - 1];
+ }
+ $s = trim( $s );
+ if ( strlen( $s ) < 2 )
+ die; // require 2 chars for matching
+ $results = $wpdb->get_col( "SELECT name FROM $wpdb->terms WHERE name LIKE ('%". $s . "%')" );
echo join( $results, "\n" );
die;
}
case 'delete-comment' :
check_ajax_referer( "delete-comment_$id" );
if ( !$comment = get_comment( $id ) )
- die('0');
+ die('1');
if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) )
die('-1');
- if ( isset($_POST['spam']) && 1 == $_POST['spam'] )
+ if ( isset($_POST['spam']) && 1 == $_POST['spam'] ) {
+ if ( 'spam' == wp_get_comment_status( $comment->comment_ID ) )
+ die('1');
$r = wp_set_comment_status( $comment->comment_ID, 'spam' );
- else
+ } else {
$r = wp_delete_comment( $comment->comment_ID );
+ }
die( $r ? '1' : '0' );
break;
if ( !current_user_can( 'manage_categories' ) )
die('-1');
+ $cat = get_category( $id );
+ if ( !$cat || is_wp_error( $cat ) )
+ die('1');
+
if ( wp_delete_category( $id ) )
die('1');
- else die('0');
+ else
+ die('0');
break;
case 'delete-tag' :
check_ajax_referer( "delete-tag_$id" );
if ( !current_user_can( 'manage_categories' ) )
die('-1');
+ $tag = get_term( $id, 'post_tag' );
+ if ( !$tag || is_wp_error( $tag ) )
+ die('1');
+
if ( wp_delete_term($id, 'post_tag'))
die('1');
- else die('0');
+ else
+ die('0');
break;
case 'delete-link-cat' :
check_ajax_referer( "delete-link-category_$id" );
if ( !current_user_can( 'manage_categories' ) )
die('-1');
+ $cat = get_term( $id, 'link_category' );
+ if ( !$cat || is_wp_error( $cat ) )
+ die('1');
+
$cat_name = get_term_field('name', $id, 'link_category');
// Don't delete the default cats.
if ( !current_user_can( 'manage_links' ) )
die('-1');
+ $link = get_bookmark( $id );
+ if ( !$link || is_wp_error( $link ) )
+ die('1');
+
if ( wp_delete_link( $id ) )
die('1');
- else die('0');
+ else
+ die('0');
break;
case 'delete-meta' :
check_ajax_referer( "delete-meta_$id" );
if ( !$meta = get_post_meta_by_id( $id ) )
- die('0');
+ die('1');
+
if ( !current_user_can( 'edit_post', $meta->post_id ) )
die('-1');
if ( delete_meta( $meta->meta_id ) )
if ( !current_user_can( 'delete_post', $id ) )
die('-1');
+ if ( !get_post( $id ) )
+ die('1');
+
if ( wp_delete_post( $id ) )
die('1');
else
if ( !current_user_can( 'delete_page', $id ) )
die('-1');
+ if ( !get_page( $id ) )
+ die('1');
+
if ( wp_delete_post( $id ) )
die('1');
- else die('0');
+ else
+ die('0');
break;
case 'dim-comment' :
if ( !$comment = get_comment( $id ) )
die('0');
+
if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) )
die('-1');
if ( !current_user_can( 'moderate_comments' ) )
die('-1');
- if ( 'unapproved' == wp_get_comment_status($comment->comment_ID) ) {
+ $current = wp_get_comment_status( $comment->comment_ID );
+ if ( $_POST['new'] == $current )
+ die('1');
+
+ if ( 'unapproved' == $current ) {
check_ajax_referer( "approve-comment_$id" );
if ( wp_set_comment_status( $comment->comment_ID, 'approve' ) )
die('1');
$parent = 0;
$post_category = isset($_POST['post_category'])? (array) $_POST['post_category'] : array();
$checked_categories = array_map( 'absint', (array) $post_category );
+ $popular_ids = isset( $_POST['popular_ids'] ) ?
+ array_map( 'absint', explode( ',', $_POST['popular_ids'] ) ) :
+ false;
$x = new WP_Ajax_Response();
foreach ( $names as $cat_name ) {
continue;
$category = get_category( $cat_id );
ob_start();
- wp_category_checklist( 0, $cat_id, $checked_categories );
+ wp_category_checklist( 0, $cat_id, $checked_categories, $popular_ids );
$data = ob_get_contents();
ob_end_clean();
$x->add( array(
list($comments, $total) = _wp_get_comment_list( $status, $search, $start, 1 );
+ if ( get_option('show_avatars') )
+ add_filter( 'comment_author', 'floated_admin_avatar' );
+
if ( !$comments )
die('1');
$x = new WP_Ajax_Response();
foreach ( (array) $comments as $comment ) {
get_comment( $comment );
ob_start();
- _wp_comment_row( $comment->comment_ID, $mode, false );
+ _wp_comment_row( $comment->comment_ID, $mode, $status );
$comment_list_item = ob_get_contents();
ob_end_clean();
$x->add( array(
$x->send();
break;
case 'autosave' : // The name of this action is hardcoded in edit_post()
- $nonce_age = check_ajax_referer( 'autosave', 'autosavenonce');
+ define( 'DOING_AUTOSAVE', true );
+
+ $nonce_age = check_ajax_referer( 'autosave', 'autosavenonce' );
global $current_user;
- $_POST['post_status'] = 'draft';
$_POST['post_category'] = explode(",", $_POST['catslist']);
$_POST['tags_input'] = explode(",", $_POST['tags_input']);
if($_POST['post_type'] == 'page' || empty($_POST['post_category']))
$supplemental = array();
- $id = 0;
+ $id = $revision_id = 0;
if($_POST['post_ID'] < 0) {
+ $_POST['post_status'] = 'draft';
$_POST['temp_ID'] = $_POST['post_ID'];
if ( $do_autosave ) {
$id = wp_write_post();
if ( !current_user_can('edit_post', $post_ID) )
die(__('You are not allowed to edit this post.'));
}
+
if ( $do_autosave ) {
- $id = edit_post();
+ // Drafts are just overwritten by autosave
+ if ( 'draft' == $post->post_status ) {
+ $id = edit_post();
+ } else { // Non drafts are not overwritten. The autosave is stored in a special post revision.
+ $revision_id = wp_create_post_autosave( $post->ID );
+ if ( is_wp_error($revision_id) )
+ $id = $revision_id;
+ else
+ $id = $post->ID;
+ }
$data = $message;
} else {
$id = $post->ID;
if ( user_can_richedit() )
wp_enqueue_script( 'wp_tiny_mce' );
}
+wp_enqueue_script( 'wp-gears' );
$min_width_pages = array( 'post.php', 'post-new.php', 'page.php', 'page-new.php', 'widgets.php', 'comment.php', 'link.php' );
$the_current_page = preg_replace('|^.*/wp-admin/|i', '', $_SERVER['PHP_SELF']);
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
<title><?php bloginfo('name') ?> › <?php echo wp_specialchars( strip_tags( $title ) ); ?> — WordPress</title>
<?php
+
wp_admin_css( 'css/global' );
wp_admin_css();
wp_admin_css( 'css/colors' );
+wp_admin_css( 'css/ie' );
+
?>
-<!--[if gte IE 6]>
-<?php wp_admin_css( 'css/ie' );
-?>
-<![endif]-->
<script type="text/javascript">
//<![CDATA[
addLoadEvent = function(func) {if (typeof jQuery != "undefined") jQuery(document).ready(func); else if (typeof wpOnload!='function'){wpOnload=func;} else {var oldonload=wpOnload; wpOnload=function(){oldonload();func();}}};
<?php if ( ($parent_file != 'link-manager.php') && ($parent_file != 'options-general.php') && $ie6_no_scrollbar ) : ?>
<style type="text/css">* html { overflow-x: hidden; }</style>
<?php endif;
-if ( isset($page_hook) )
- do_action('admin_print_scripts-' . $page_hook);
-else if ( isset($plugin_page) )
- do_action('admin_print_scripts-' . $plugin_page);
-do_action('admin_print_scripts');
+
+$hook_suffixes = array();
if ( isset($page_hook) )
- do_action('admin_head-' . $page_hook);
+ $hook_suffixes[] = "-$page_hook";
else if ( isset($plugin_page) )
- do_action('admin_head-' . $plugin_page);
-do_action('admin_head');
+ $hook_suffixes[] = "-$plugin_page";
+else if ( isset($pagenow) )
+ $hook_suffixes[] = "-$pagenow";
+
+$hook_suffixes[] = '';
+
+foreach ( $hook_suffixes as $hook_suffix )
+ do_action("admin_print_styles$hook_suffix"); // do_action( 'admin_print_styles-XXX' ); do_action( 'admin_print_styles' );
+foreach ( $hook_suffixes as $hook_suffix )
+ do_action("admin_print_scripts$hook_suffix"); // do_action( 'admin_print_scripts-XXX' ); do_action( 'admin_print_scripts' );
+foreach ( $hook_suffixes as $hook_suffix )
+ do_action("admin_head$hook_suffix"); // do_action( 'admin_head-XXX' ); do_action( 'admin_head' );
+unset($hook_suffixes, $hook_suffix);
+
?>
</head>
<body class="wp-admin <?php echo apply_filters( 'admin_body_class', '' ); ?>">
<div id="wpwrap">
<div id="wpcontent">
<div id="wphead">
-<h1><?php bloginfo('name'); ?><span id="viewsite"><a href="<?php echo trailingslashit( get_option('home') ); ?>"><?php _e('Visit Site') ?></a></span></h1>
+<h1><?php if ( '' == get_bloginfo('name', 'display') ) echo ' '; else echo get_bloginfo('name', 'display'); ?><span id="viewsite"><a href="<?php echo trailingslashit( get_option('home') ); ?>"><?php _e('Visit Site') ?></a></span></h1>
</div>
-<div id="user_info"><p><?php printf(__('Howdy, <a href="%1$s">%2$s</a>!'), 'profile.php', $user_identity) ?> | <a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="<?php _e('Log Out') ?>"><?php _e('Log Out'); ?></a> | <?php _e('<a href="http://codex.wordpress.org/">Help</a>') ?> | <?php _e('<a href="http://wordpress.org/support/">Forums</a>') ?></p></div>
+
+<?php
+if ( ! $is_opera ) {
+?>
+ <div id="gears-info-box" class="info-box" style="display:none;">
+ <img src="images/gear.png" title="Gear" alt="" class="gears-img" />
+ <div id="gears-msg1">
+ <h3 class="info-box-title"><?php _e('Speed up WordPress'); ?></h3>
+ <p><?php _e('WordPress now has support for Gears, which adds new features to your web browser.'); ?><br />
+ <a href="http://gears.google.com/" target="_blank" style="font-weight:normal;"><?php _e('More information...'); ?></a></p>
+ <p><?php _e('After you install and enable Gears most of WordPress’ images, scripts, and CSS files will be stored locally on your computer. This speeds up page load time.'); ?></p>
+ <p><strong><?php _e('Don’t install on a public or shared computer.'); ?></strong></p> <div class="submit"><button onclick="window.location = 'http://gears.google.com/?action=install&return=<?php echo urlencode( admin_url() ); ?>';" class="button"><?php _e('Install Now'); ?></button>
+ <button class="button" style="margin-left:10px;" onclick="document.getElementById('gears-info-box').style.display='none';"><?php _e('Cancel'); ?></button></div>
+ </div>
+
+ <div id="gears-msg2" style="display:none;">
+ <h3 class="info-box-title"><?php _e('Gears Status'); ?></h3>
+ <p><?php _e('Gears is installed on this computer but is not enabled for use with WordPress.'); ?></p>
+ <p><?php
+
+ if ( $is_safari )
+ _e('To enable it, make sure this web site is not on the denied list in Gears Settings under the Safari menu, then click the button below.');
+ else
+ _e('To enable it, make sure this web site is not on the denied list in Gears Settings under your browser Tools menu, then click the button below.');
+
+ ?></p>
+ <p><strong><?php _e('However if this is a public or shared computer, Gears should not be enabled.'); ?></strong></p>
+ <div class="submit"><button class="button" onclick="wpGears.getPermission();"><?php _e('Enable Gears'); ?></button>
+ <button class="button" style="margin-left:10px;" onclick="document.getElementById('gears-info-box').style.display='none';"><?php _e('Cancel'); ?></button></div>
+ </div>
+
+ <div id="gears-msg3" style="display:none;">
+ <h3 class="info-box-title"><?php _e('Gears Status'); ?></h3>
+ <p><?php
+
+ if ( $is_safari )
+ _e('Gears is installed and enabled on this computer. You can disable it from the Safari menu.');
+ else
+ _e('Gears is installed and enabled on this computer. You can disable it from your browser Tools menu.');
+
+ ?></p>
+ <p><?php _e('If there are any errors, try disabling Gears, then reload the page and enable it again.'); ?></p>
+ <p><?php _e('Local storage status:'); ?> <span id="gears-wait"><span style="color:#f00;"><?php _e('Please wait! Updating files:'); ?></span> <span id="gears-upd-number"></span></span></p>
+ <div class="submit"><button class="button" onclick="document.getElementById('gears-info-box').style.display='none';"><?php _e('Close'); ?></button></div>
+ </div>
+ </div>
+<?php } ?>
+
+<div id="user_info"><p><?php printf(__('Howdy, <a href="%1$s">%2$s</a>!'), 'profile.php', $user_identity) ?> | <a href="<?php echo site_url('wp-login.php?action=logout', 'login') ?>" title="<?php _e('Log Out') ?>"><?php _e('Log Out'); ?></a> | <?php _e('<a href="http://codex.wordpress.org/">Help</a>') ?> | <?php _e('<a href="http://wordpress.org/support/">Forums</a>'); if ( ! $is_opera ) { ?> | <span id="gears-menu"><a href="#" onclick="wpGears.message(1);return false;"><?php _e('Turbo') ?></a></span><?php } ?></p></div>
<?php
require(ABSPATH . 'wp-admin/menu-header.php');
--- /dev/null
+<?php
+define('WP_ADMIN', TRUE);
+
+if ( defined('ABSPATH') )
+ require_once(ABSPATH . 'wp-load.php');
+else
+ require_once('../wp-load.php');
+
+require_once(ABSPATH . 'wp-admin/includes/admin.php');
+
+if ( !wp_validate_auth_cookie() )
+ wp_die(__('Cheatin’ uh?'));
+
+nocache_headers();
+
+do_action('admin_init');
+
+$action = 'admin_post';
+if ( !empty($_REQUEST['action']) )
+ $action .= '_' . $_REQUEST['action'];
+
+do_action($action);
+
+?>
\ No newline at end of file
define('WP_ADMIN', TRUE);
if ( defined('ABSPATH') )
- require_once( ABSPATH . 'wp-config.php');
+ require_once(ABSPATH . 'wp-load.php');
else
- require_once('../wp-config.php');
+ require_once('../wp-load.php');
if ( get_option('db_version') != $wp_db_version ) {
- wp_redirect(get_option('siteurl') . '/wp-admin/upgrade.php?_wp_http_referer=' . urlencode(stripslashes($_SERVER['REQUEST_URI'])));
+ wp_redirect(admin_url('upgrade.php?_wp_http_referer=' . urlencode(stripslashes($_SERVER['REQUEST_URI']))));
exit;
}
wp_reset_vars(array('profile', 'redirect', 'redirect_url', 'a', 'popuptitle', 'popupurl', 'text', 'trackback', 'pingback'));
-wp_admin_css_color('classic', __('Classic'), get_option( 'siteurl' ) . "/wp-admin/css/colors-classic.css", array('#07273E', '#14568A', '#D54E21', '#2683AE'));
-wp_admin_css_color('fresh', __('Fresh'), get_option( 'siteurl' ) . "/wp-admin/css/colors-fresh.css", array('#464646', '#CEE1EF', '#D54E21', '#2683AE'));
+wp_admin_css_color('classic', __('Classic'), admin_url("css/colors-classic.css"), array('#07273E', '#14568A', '#D54E21', '#2683AE'));
+wp_admin_css_color('fresh', __('Fresh'), admin_url("css/colors-fresh.css"), array('#464646', '#CEE1EF', '#D54E21', '#2683AE'));
wp_enqueue_script( 'common' );
wp_enqueue_script( 'jquery-color' );
wp_die(__('Invalid plugin page'));
}
- if (! ( file_exists(ABSPATH . PLUGINDIR . "/$plugin_page") && is_file( ABSPATH . PLUGINDIR . "/$plugin_page") ) )
+ if (! ( file_exists(WP_PLUGIN_DIR . "/$plugin_page") && is_file(WP_PLUGIN_DIR . "/$plugin_page") ) )
wp_die(sprintf(__('Cannot load %s.'), htmlentities($plugin_page)));
do_action('load-' . $plugin_page);
if (! isset($_GET['noheader']))
require_once(ABSPATH . 'wp-admin/admin-header.php');
- include(ABSPATH . PLUGINDIR . "/$plugin_page");
+ include(WP_PLUGIN_DIR . "/$plugin_page");
}
include(ABSPATH . 'wp-admin/admin-footer.php');
do_action("load-$pagenow");
}
+if ( !empty($_REQUEST['action']) )
+ do_action('admin_action_' . $_REQUEST['action']);
+
?>
*/
if ( defined('ABSPATH') )
- require_once( ABSPATH . 'wp-config.php');
+ require_once(ABSPATH . 'wp-load.php');
else
- require_once('../wp-config.php');
+ require_once('../wp-load.php');
// Flash often fails to send cookies with the POST or upload, so we need to pass it in GET or POST instead
-if ( empty($_COOKIE[AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) )
+if ( is_ssl() && empty($_COOKIE[SECURE_AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) )
+ $_COOKIE[SECURE_AUTH_COOKIE] = $_REQUEST['auth_cookie'];
+elseif ( empty($_COOKIE[AUTH_COOKIE]) && !empty($_REQUEST['auth_cookie']) )
$_COOKIE[AUTH_COOKIE] = $_REQUEST['auth_cookie'];
unset($current_user);
require_once('admin.php');
-header('Content-Type: text/plain');
+header('Content-Type: text/plain; charset=' . get_option('blog_charset'));
if ( !current_user_can('upload_files') )
wp_die(__('You do not have permission to upload files.'));
exit;
}
+check_admin_referer('media-form');
+
$id = media_handle_upload('async-upload', $_REQUEST['post_id']);
if (is_wp_error($id)) {
echo '<div id="media-upload-error">'.wp_specialchars($id->get_error_message()).'</div>';
+++ /dev/null
-<?php
-$mode = 'bookmarklet';
-require_once('admin.php');
-
-if ( ! current_user_can('edit_posts') )
- wp_die(__('Cheatin’ uh?'));
-
-if ('b' == $a):
-?><!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">
-<head>
-<script type="text/javascript">
-<!--
-window.close()
--->
-</script>
-</head>
-<body></body>
-</html>
-<?php
-exit;
-endif;
-
-$post = get_default_post_to_edit();
-
-$popuptitle = wp_specialchars(stripslashes($popuptitle));
-$text = wp_specialchars(stripslashes(urldecode($text)));
-
-$popuptitle = funky_javascript_fix($popuptitle);
-$text = funky_javascript_fix($text);
-
-$post_title = wp_specialchars($_REQUEST['post_title']);
-if (!empty($post_title))
- $post->post_title = stripslashes($post_title);
-else
- $post->post_title = $popuptitle;
-
-
-$content = wp_specialchars($_REQUEST['content']);
-$popupurl = clean_url($_REQUEST['popupurl']);
-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 */
-
-?><!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">
-<head>
-<title><?php bloginfo('name') ?> › Bookmarklet — WordPress</title>
-<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
-<?php
-wp_admin_css( 'css/global' );
-wp_admin_css();
-?>
-
-<style type="text/css">
-<!--
-
-#wpbookmarklet textarea,input,select {
- border-width: 1px;
- border-color: #cccccc;
- border-style: solid;
- padding: 2px;
- margin: 1px;
-}
-
-#wpbookmarklet .checkbox {
- background-color: #ffffff;
- border-width: 0px;
- padding: 0px;
- margin: 0px;
-}
-
-#wpbookmarklet textarea {
- font-family: Verdana, Geneva, Arial, Helvetica;
- font-size: 0.9em;
-}
-
-#wpbookmarklet .wrap {
- border: 0px;
-}
-
-#wpbookmarklet #postdiv {
- margin-bottom: 0.5em;
-}
-
-#wpbookmarklet #titlediv {
- margin-bottom: 1em;
-}
-
--->
-</style>
-</head>
-<body id="wpbookmarklet">
-<div id="wphead">
-<h1><?php bloginfo('name') ?></h1>
-</div>
-
-<?php require('edit-form.php'); ?>
-
-<?php do_action('admin_footer', ''); ?>
-
-</body>
-</html>
<?php endif; ?>
<p id="post-search">
+ <label class="hidden" for="post-search-input"><?php _e('Search Categories'); ?>:</label>
<input type="text" id="post-search-input" name="s" value="<?php echo attribute_escape(stripslashes($_GET['s'])); ?>" />
<input type="submit" value="<?php _e( 'Search Categories' ); ?>" class="button" />
</p>
<div class="tablenav">
+<?php
+$pagenum = absint( $_GET['pagenum'] );
+if ( empty($pagenum) )
+ $pagenum = 1;
+if( !$catsperpage || $catsperpage < 0 )
+ $catsperpage = 20;
+
+$page_links = paginate_links( array(
+ 'base' => add_query_arg( 'pagenum', '%#%' ),
+ 'format' => '',
+ 'total' => ceil(wp_count_terms('category') / $catsperpage),
+ 'current' => $pagenum
+));
+
+if ( $page_links )
+ echo "<div class='tablenav-pages'>$page_links</div>";
+?>
+
<div class="alignleft">
<input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" class="button-secondary delete" />
<?php wp_nonce_field('bulk-categories'); ?>
<table class="widefat">
<thead>
<tr>
- <th scope="col" class="check-column"><input type="checkbox" onclick="checkAll(document.getElementById('posts-filter'));" /></th>
+ <th scope="col" class="check-column"><input type="checkbox" /></th>
<th scope="col"><?php _e('Name') ?></th>
<th scope="col"><?php _e('Description') ?></th>
<th scope="col" class="num"><?php _e('Posts') ?></th>
</thead>
<tbody id="the-list" class="list:cat">
<?php
-cat_rows();
+cat_rows(0, 0, 0, $pagenum, $catsperpage);
?>
</tbody>
</table>
</form>
<div class="tablenav">
+
+<?php
+if ( $page_links )
+ echo "<div class='tablenav-pages'>$page_links</div>";
+?>
<br class="clear" />
</div>
<br class="clear" />
$title = __('Edit Comment');
wp_enqueue_script('comment');
- //wp_enqueue_script('thickbox');
+
require_once('admin-header.php');
$comment_id = absint( $_GET['c'] );
<table width="100%">
<tr>
-<td><input type='button' class="button" value='<?php _e('No'); ?>' onclick="self.location='<?php echo get_option('siteurl'); ?>/wp-admin/edit-comments.php';" /></td>
+<td><input type='button' class="button" value='<?php _e('No'); ?>' onclick="self.location='<?php echo admin_url('edit-comments.php'); ?>" /></td>
<td class="textright"><input type='submit' class="button" value='<?php echo $button; ?>' /></td>
</tr>
</table>
else if ( '' != wp_get_original_referer() && false == $noredir )
wp_redirect( wp_get_original_referer() );
else
- wp_redirect( get_option('siteurl') . '/wp-admin/edit-comments.php' );
+ wp_redirect( admin_url('edit-comments.php') );
die;
break;
if ( '' != wp_get_referer() && false == $noredir )
wp_redirect( wp_get_referer() );
else
- wp_redirect( get_option('siteurl') . '/wp-admin/edit.php?p=' . absint( $comment->comment_post_ID ) . '#comments' );
+ wp_redirect( admin_url('edit.php?p=' . absint( $comment->comment_post_ID ) . '#comments') );
exit();
break;
wp_set_comment_status( $comment->comment_ID, 'approve' );
- if ( true == get_option('comments_notify') )
- wp_notify_postauthor( $comment->comment_ID );
-
-
if ( '' != wp_get_referer() && false == $noredir )
wp_redirect( wp_get_referer() );
else
- wp_redirect( get_option('siteurl') . '/wp-admin/edit.php?p=' . absint( $comment->comment_post_ID ) . '#comments' );
+ wp_redirect( admin_url('edit.php?p=' . absint( $comment->comment_post_ID ) . '#comments') );
exit();
break;
include('admin-footer.php');
-?>
\ No newline at end of file
+?>
+.post-com-count {
+}
+#adminmenu li a #awaiting-mod, #sidemenu li a #update-plugins {
+ background-image: url(../images/comment-stalk-rtl.gif);
+ background-position:right bottom;
+}
+#footer {
+ background-position:99% 10px;
+}
#poststuff .closed .togbox, #poststuff .togbox {
-background-image: url(../images/toggle-arrow-rtl.gif) !important;
-}
\ No newline at end of file
+ background-image: url(../images/toggle-arrow-rtl.gif) !important;
+}
+.bar {
+ border-right-color: transparent;
+ border-left-color: #99d;
+}
+.plugins .togl {
+ border-right-color: transparent;
+ border-left-color: #ccc;
+}
+#upload-menu li.current {
+ border-right-color: transparent;
+ border-left-color: #448abd;
+}
border-color: #999;
}
-body {
+body, .form-table .pre {
background-color: #fff;
color: #333;
}
color: #fff;
}
-ul#category-tabs li.ui-tabs-selected, li.widget-list-control-item, div.nav, .tablenav, .submitbox, h3.dashboard-widget-title, h3.dashboard-widget-title span, h3.dashboard-widget-title small, ul.view-switch li.current, .form-table tr, #poststuff h3, .login form {
+ul#category-tabs li.ui-tabs-selected, li.widget-list-control-item, div.nav, .tablenav, .submitbox, h3.dashboard-widget-title, h3.dashboard-widget-title span, h3.dashboard-widget-title small, ul.view-switch li.current, .form-table tr, #poststuff h3, .login form, h3.info-box-title {
background-color: #cfebf7;
}
color: #000;
}
-ul.widget-control-list .sorthelper {
+.sorthelper {
background-color: #ccf3fa;
}
border-color: #535353;
}
-.submit input:hover, .button:hover, .button-secondary:hover, #wphead #viewsite a:hover, #submenu a.current, #submenu a:hover, .submitbox #previewview a:hover, #the-comment-list .comment a:hover, #rightnow a:hover, a:hover, .subsubsub a:hover, .subsubsub a.current:hover, #login form .submit input:hover, div.dashboard-widget-submit input:hover, #edit-slug-buttons a.save:hover {
+.submit input:hover, .button:hover, .button-secondary:hover, #wphead #viewsite a:hover, #submenu a.current, #submenu a:hover, .submitbox #previewview a:hover, #the-comment-list .comment a:hover, #rightnow a:hover, a:hover, .subsubsub a:hover, .subsubsub a.current:hover, #login form .submit input:hover, div.dashboard-widget-submit input:hover, #edit-slug-buttons a.save:hover, #media-upload a.del-link:hover {
color: #d54e21;
}
-#adminmenu a:hover, #sidemenu a:hover {
+#adminmenu a:hover, #sidemenu a:hover, .ui-tabs-nav a:hover {
color: #97c4d8;
}
border-bottom-color: #999;
}
-.submitbox .submitdelete:hover {
+.submitbox .submitdelete:hover,
+#media-upload a.delete:hover {
color: #fff;
background-color: #f00;
border-bottom-color: #f00;
color: #5a5a5a;
}
-#poststuff #edButtonPreview, #poststuff #edButtonHTML, #the-comment-list p.comment-author strong a, a {
+#poststuff #edButtonPreview, #poststuff #edButtonHTML, #the-comment-list p.comment-author strong a, #media-upload a.del-link, #media-upload a.delete, a {
color: #2e7ca0;
}
-#adminmenu a {
+#adminmenu a, .ui-tabs-nav a {
color: #cfebf6;
}
color: #2782af
}
/* Because we don't want visited on these links */
-#adminmenu a.current, #sidemenu a.current {
+#adminmenu a.current, #sidemenu a.current, body.press-this .ui-tabs-selected a, body.press-this .ui-tabs-selected a:hover {
background-color: #fff;
border-color: #07273e;
border-bottom-color: #fff;
font-weight: bold;
}
-#adminmenu li a #awaiting-mod {
+#adminmenu li a #awaiting-mod, #sidemenu li a #update-plugins {
background-image: url(../images/comment-stalk-classic.gif);
}
-#adminmenu li a #awaiting-mod span {
+#adminmenu li a #awaiting-mod span, #sidemenu li a #update-plugins span {
background-color: #d54e21;
color: #fff;
}
}
-#adminmenu li a:hover #awaiting-mod span {
+#adminmenu li a:hover #awaiting-mod span, #sidemenu li a:hover #update-plugins span {
background-color: #07273E;
}
background-color: #fff;
}
-#plugins .active {
+.plugins .active {
background-color: #BBEEBB;
}
-#plugins .togl {
+.plugins .togl {
border-right-color: #ccc;
}
background-color: #ffffe0;
}
-#plugins tr {
+.plugins tr {
background-color: #fff;
}
color: #f00;
}
-#media-upload a.delete {
- color: #888;
-}
-
-
/* TinyMCE */
.wp_themeSkin *,
.wp_themeSkin a:hover,
}
/* Containers */
-.wp_themeSkin table {
+.wp_themeSkin table, #wp_editbtns {
background: #83B4D5;
}
background-color: #ddd;
color: #333;
}
+
+/* Diff */
+
+table.diff .diff-deletedline {
+ background-color: #ffdddd;
+}
+table.diff .diff-deletedline del {
+ background-color: #ff9999;
+}
+table.diff .diff-addedline {
+ background-color: #ddffdd;
+}
+table.diff .diff-addedline ins {
+ background-color: #99ff99;
+}
+.bar {
+ border-right-color: transparent;
+ border-left-color: #99d;
+}
+.post-com-count {
+}
+#adminmenu li a #awaiting-mod, #sidemenu li a #update-plugins {
+ background-image: url(../images/comment-stalk-rtl.gif);
+ background-position:right bottom;
+}
+#footer {
+ background-position:99% 10px;
+}
+.plugins .togl {
+ border-right-color: transparent;
+ border-left-color: #ccc;
+}
#poststuff .closed .togbox, #poststuff .togbox {
-background-image: url(../images/toggle-arrow-rtl.gif) !important;
-}
\ No newline at end of file
+ background-image: url(../images/toggle-arrow-rtl.gif);
+}
+#upload-menu li.current {
+ border-right-color:transparent;
+ border-left-color: #448abd;
+}
border-color: #999;
}
-body {
+body, .form-table .pre {
background-color: #fff;
color: #333;
}
color: #fff;
}
-li.widget-list-control-item, div.nav, .tablenav, .submitbox, h3.dashboard-widget-title, h3.dashboard-widget-title span, h3.dashboard-widget-title small, ul.view-switch li.current, .form-table tr, #poststuff h3, .login form {
+li.widget-list-control-item, div.nav, .tablenav, .submitbox, h3.dashboard-widget-title, h3.dashboard-widget-title span, h3.dashboard-widget-title small, ul.view-switch li.current, .form-table tr, #poststuff h3, .login form, h3.info-box-title {
background-color: #eaf3fa;
}
color: #000;
}
-ul.widget-control-list .sorthelper {
+.sorthelper {
background-color: #ccf3fa;
}
border-color: #535353;
}
-.submit input:hover, .button:hover, .button-secondary:hover, #wphead #viewsite a:hover, #adminmenu a:hover, #sidemenu a:hover, #submenu a.current, #submenu a:hover, .submitbox #previewview a:hover, #the-comment-list .comment a:hover, #rightnow a:hover, a:hover, .subsubsub a:hover, .subsubsub a.current:hover, #login form .submit input:hover, div.dashboard-widget-submit input:hover, #edit-slug-buttons a.save:hover, #media-upload a.delete:hover {
+.submit input:hover, .button:hover, .button-secondary:hover, #wphead #viewsite a:hover, #adminmenu a:hover, #sidemenu a:hover, #submenu a.current, #submenu a:hover, .submitbox #previewview a:hover, #the-comment-list .comment a:hover, #rightnow a:hover, a:hover, .subsubsub a:hover, .subsubsub a.current:hover, #login form .submit input:hover, div.dashboard-widget-submit input:hover, #edit-slug-buttons a.save:hover, #media-upload a.delete:hover, #media-upload a.del-link:hover, .ui-tabs-nav a:hover {
color: #d54e21;
}
border-bottom-color: #999;
}
-.submitbox .submitdelete:hover {
+.submitbox .submitdelete:hover,
+#media-upload a.delete:hover {
color: #fff;
background-color: #f00;
border-bottom-color: #f00;
color: #666;
}
-#adminmenu a, #submenu a, #poststuff #edButtonPreview, #poststuff #edButtonHTML, #the-comment-list p.comment-author strong a, a {
+#adminmenu a, #submenu a, #poststuff #edButtonPreview, #poststuff #edButtonHTML, #the-comment-list p.comment-author strong a, #media-upload a.del-link, #media-upload a.delete, .ui-tabs-nav a, a {
color: #2583ad;
}
/* Because we don't want visited on these links */
-#adminmenu a.current, #sidemenu a.current {
+#adminmenu a.current, #sidemenu a.current, body.press-this .ui-tabs-selected a, body.press-this .ui-tabs-selected a:hover {
background-color: #fff;
border-color: #c6d9e9;
border-bottom-color: #fff;
color: #d54e21;
}
-#adminmenu li a #awaiting-mod {
+#adminmenu li a #awaiting-mod, #sidemenu li a #update-plugins {
background-image: url(../images/comment-stalk-fresh.gif);
}
-#adminmenu li a #awaiting-mod span, #rightnow .reallynow {
+#adminmenu li a #awaiting-mod span, #sidemenu li a #update-plugins span, #rightnow .reallynow {
background-color: #d54e21;
color: #fff;
}
-#adminmenu li a:hover #awaiting-mod span {
+#adminmenu li a:hover #awaiting-mod span, #sidemenu li a:hover #update-plugins span {
background-color: #264761;
}
background-color: #fff;
}
-#plugins .active {
+.plugins .active {
background-color: #e7f7d3;
}
-#plugins .togl {
+.plugins .togl {
border-right-color: #ccc;
}
background-color: #ffffe0;
}
-#plugins tr {
+.plugins tr {
background-color: #fff;
}
}
/* Containers */
-.wp_themeSkin table {
+.wp_themeSkin table, #wp_editbtns {
background: #cee1ef;
}
background-color: #ddd;
color: #333;
}
+
+/* Diff */
+
+table.diff .diff-deletedline {
+ background-color: #ffdddd;
+}
+table.diff .diff-deletedline del {
+ background-color: #ff9999;
+}
+table.diff .diff-addedline {
+ background-color: #ddffdd;
+}
+table.diff .diff-addedline ins {
+ background-color: #99ff99;
+}
+/* Right Now */
#rightnow {
- margin-left: 15px;
+ margin-right:0;
+ margin-left: 7px;
}
-
#rightnow .reallynow span {
text-align: right;
float: right;
}
-
#rightnow .reallynow a {
text-align: left;
float: left;
margin: 1px 0 0 6px;
}
-
-h3.dashboard-widget-title span {
- text-align: right;
- float: right;
+/* Widgets */
+div#dashboard-widgets-wrap {
+ margin-right:0;
+ margin-left:-13px;
}
-
-#dashboard-widgets .widget_rss ul li a {
+div.dashboard-widget-holder {
float:right;
- font-weight:bold;
- margin:0pt 0pt 0.2em 0.5em;
}
-
-#dashboard-widgets .widget_rss ul li span.rss-date {
+div.dashboard-widget {
+ margin-right:0;
+ margin-left: 20px;
+}
+h3.dashboard-widget-title span {
+ text-align: right;
float: right;
}
-
h3.dashboard-widget-title small {
text-align: left;
- float: left;
+ float:left;
}
-div.dashboard-widget-content ul,
-div.dashboard-widget-content ol,
-div.dashboard-widget-content dl {
+div.dashboard-widget-submit input {
+ font-family: Tahoma;
+}
+div.dashboard-widget-content ul, div.dashboard-widget-content ol, div.dashboard-widget-content dl {
padding-left:0;
padding-right:15px;
}
-div#dashboard-widgets-wrap
-{
- margin-right:0;
- margin-left:-10px;
+#dashboard_secondary div.dashboard-widget-content ul li {
+ float:right;
}
-
-div.dashboard-widget {
- margin-right:0;
- margin-left:20px;
+#dashboard_secondary div.dashboard-widget-content ul li .post {
+ font-family:arial;
+}
+#dashboard_secondary div.dashboard-widget-content ul li a {
+ border-right:0 none;
+ border-left: 1px solid #dadada;
+ height:110px;
+}
+#dashboard_secondary div.dashboard-widget-content ul li a cite {
+ font-family: Tahoma;
}
-
#dashboard-widgets .widget_rss ul li span.rss-date {
float:right;
}
#dashboard-widgets .widget_rss ul li a {
- float:right;
- margin:0 0 0.2em 0.5em;
+ float: right;
+ margin: 0 0 .2em .5em;
}
-#dashboard_secondary div.dashboard-widget-content ul li a {
- border-right:0 none;
- border-left:1px solid #DADADA;
-}
\ No newline at end of file
--- /dev/null
+body, td {
+ font-family: Tahoma;
+}
+textarea, input, select {
+ font-family: Tahoma;
+}
+h1, h2, h3 {
+ font-family:arial;
+}
+.widefat td {
+ padding: 7px 10px 9px 15px;
+}
+.widefat th {
+ padding: 9px 10px 6px 15px;
+ text-align: right;
+}
+.widefat th input {
+ margin: 0 8px 0 0;
+}
+.widefat .check-column {
+ text-align: left;
+}
+.wrap h2 {
+ font-family:arial;
+ margin: 5px -4px 0 0;
+ padding-right:0;
+ padding-left: 280px;
+}
+.wrap h2.long-header {
+ padding-left: 0;
+}
padding-bottom: 7px;
padding-right: 280px;
}
+
+.wrap h2.long-header {
+ padding-right: 0;
+}
-/* footer */
-body, td {
- font-family: Tahoma,Verdana,sans-serif;
+#poststuff .postbox h3 {
+ padding-left:0;
+ padding-right: 23px;
}
-
-.wrap {
- text-align: right;
+* html #poststuff .postarea, * html #poststuff #titlediv {
+ margin-left:0;
+ margin-right: 3%;
}
-
-.wrap h2 {
- margin: 5px 0 0 4px;
-}
-
-#footer {
- padding-left:50px;
+* html #poststuff h2 {
+ margin-right: 0;
}
-#footer p {
- background:none;
- height:auto;
- padding: 5px 5px 0;
-}
-
#bh {
+ padding-right:0;
padding-left: 15px;
- padding-right: 0px;
}
-/* write post */
+div#dashboard-widgets {
+ padding-right:0;
+ padding-left: 1px;
+}
+#tagchecklist span a {
+ margin: 4px -9px 0 0;
+}
#poststuff .togbox {
- margin-right:-16px;
+ margin-left:0;
+ margin-right: -19px;
}
-#poststuff h3 {
- padding-right:20px;
+.widefat th input {
+ margin: 0 5px 0 0;
}
-
-p#widget-search, p#post-search {
- padding-left: 15px;
+/* ---------- add by navid */
+#dashmenu { /* fix top right bottom in admin */
+ direction:ltr;
+}
+#sidemenu a { /* fix left admin buttom ex. plugins, options */
+ float:left;
}
-
-.widefat th {
- padding-bottom: 8px;
+.wrap h2 {
+ margin:5px 4px 0 0;
+}
+#editor-toolbar {/* fix hover in media uploader icon */
+ direction:ltr;
+}
+#TB_window { /* fix theme preview */
+ left:2%;
+}
+/* fix widget page */
+form#widgets-filter {
+ position:static;
}
-
-/* template editor */
-#template textarea {
+#widget-search {
+ display:none;
+}
+/* fix manage comment page */
+ul.view-switch li {
float:left;
}
-
-/* Editor */
-
-.mceToolbar {
- direction: ltr;
- text-align: left;
-}
\ No newline at end of file
+form#posts-filter {
+ position:static;
+}
+#post-search {
+ display:none;
+}
+#submenu {
+ margin-right: 20px;
+}
+/* Fixes for media-upload window */
+/* Center media-upload panel on screen */
+#TB_window {
+ width: 670px;
+ position: absolute;
+ top: 50%;
+ left: 50%;
+ margin-right: 335px !important; }
.tablenav-pages {
display: block;
margin-top: -3px;
+}
+table.ie-fixed {
+ table-layout: fixed;
}
#post-search .button, #widget-search .button {
body {
- font-size: 11px;;
+ font-family: Tahoma;
+}
+/* Half the page disapears on IE6 */
+* html body {
+ width: 700px;
+ position: absolute;
+ left: 50%;
+ margin-right: 350px;
}
ul, ol {
padding: 5px 22px 5px 5px;
}
-.form-table th {
- text-align: right;
+.step, th {
+ text-align:right;
}
-input {
- padding: 1px
+.submit input, .button, .button-secondary {
+ font-family: Tahoma;
+ margin-right:0;
+}
+.form-table th {
+ text-align:right;
}
-#logo {
- text-align: left;
+h1 {
+ font-family:arial;
+ margin: 5px -4px 0 0;
}
-#admin_email {
- direction: ltr;
- text-align: left;
-}
\ No newline at end of file
margin: 2em auto 0 auto;
width: 700px;
padding: 1em 2em;
+ -moz-border-radius: 12px;
+ -khtml-border-radius: 12px;
-webkit-border-radius: 12px;
- font-size: 62.5%;
+ border-radius: 12px;
}
a { color: #2583ad; text-decoration: none; }
p, li {
padding-bottom: 2px;
- font-size: 1.3em;
- line-height: 1.8em;
+ font-size: 13px;
+ line-height: 18px;
}
code {
- font-size: 1.3em;
+ font-size: 13px;
}
ul, ol { padding: 5px 5px 5px 22px; }
#logo { margin: 6px 0 14px 0px; border-bottom: none;}
-.step a, .step input { font-size: 2em; }
+.step {
+ margin: 20px 0 15px;
+}
-td input { font-size: 1.5em; }
+.step input {
+ font-size: 18px;
+}
+
+a.button {
+ font-size: 18px;
+}
.step, th { text-align: left; padding: 0; }
.submit input, .button, .button-secondary {
font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
- padding: 6px;
- border: none;
+ padding: 5px 7px 7px;
+ border: 1px solid #a3a3a3;
margin-left: 0;
- font-size: 13px !important;
- -moz-border-radius: 2px;
- -khtml-border-radius: 2px;
- -webkit-border-radius: 2px;
- border-radius: 2px;
+ -moz-border-radius: 3px;
+ -khtml-border-radius: 3px;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
color: #246;
background: #e5e5e5;
}
.submit input:hover, .button:hover, .button-secondary:hover {
color: #d54e21;
+ border-color: #535353;
}
.form-table {
margin-bottom: 9px;
padding: 10px;
border-bottom: 8px solid #fff;
+ font-size: 12px;
}
.form-table th {
- font-size: 12px;
+ font-size: 13px;
text-align: left;
- padding: 12px 10px 10px 10px;
+ padding: 16px 10px 10px 10px;
border-bottom: 8px solid #fff;
width: 110px;
vertical-align: top;
font-size: 11px;
}
+.form-table input {
+ line-height: 20px;
+ font-size: 15px;
+ padding: 2px;
+}
+
h1 {
border-bottom: 1px solid #dadada;
clear: both;
#error-page p {
font-size: 14px;
- line-height: 1.6em;
+ line-height: 16px;
+ margin: 25px 0 20px;
}
#error-page code {
- font-size: 1em;
+ font-size: 15px;
}
\ No newline at end of file
body {
- font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
- direction: rtl;
+ font-family: Tahoma;
}
form {
margin-left:0;
- margin-right:8px;
+ margin-right: 8px;
}
form .forgetmenot {
float:right;
}
+#login form .submit input {
+ font-family: Tahoma;
+}
form .submit {
float:left;
}
+#backtoblog a {
+ left:auto;
+ right:15px;
+}
#login_error, .message {
- margin:0 8px 16px 0;
+ margin: 0 8px 16px 0;
}
#nav {
- margin: 0 8px 0 0;
+ margin:0 8px 0 0;
}
#user_pass, #user_login, #user_email {
margin-right:0;
margin-left: 6px;
- direction:ltr;
}
h1 a {
text-decoration:none;
}
-#backtoblog a {
- left: auto;
- right: 15px;
-}
\ No newline at end of file
+/* ltr input */
+#user_login, #user_pass {
+ direction:ltr;
+}
-ul#sidemenu {
- left: auto;
- right: 0;
+body#media-upload ul#sidemenu {
+ left:auto;
+ right:0;
+ width: 620px;
+}
+#search-filter {
+ text-align:left;
}
.align .field label {
- display: block;
+ padding: 0 28px 0 0;
+ margin: 0 0 0 1em;
+}
+.image-align-none-label, .image-align-left-label, .image-align-center-label, .image-align-right-label {
+ background-position:center right;
+}
+tr.image-size label {
+ margin: 0 0 0 1em;
+}
+.filename.original {
float: right;
- padding: 0 25px 0 0;
- margin: 5px 3px 5px 5px;
}
-.align .field input {
- display: block;
+.crunching {
+ text-align: left;
+ margin-right:0;
+ margin-left: 5px;
+}
+button.dismiss {
+ right:auto;
+ left:5px;
+}
+.file-error {
+ margin: 0 50px 5px 0;
+}
+.progress {
+ left:auto;
+ right:0;
+}
+.bar {
+ border-right-width:0;
+ border-left-width: 3px;
+ border-left-style: solid;
+}
+.media-item .pinkynail {
+ float:right;
+}
+.describe-toggle-on, .describe-toggle-off {
+ float: left;
+ margin-right:0;
+ margin-left: 20px;
+}
+/* Specific to Uploader */
+
+#media-upload .media-upload-form p {
+ margin: 0 0 1em 1em;
+}
+.filename {
float: right;
- margin: 5px 15px 5px 0;
-}
-.image-align-none-label,
-.image-align-left-label,
-.image-align-center-label,
-.image-align-right-label {
- background-position: center right;
-}
\ No newline at end of file
+ margin-left:0;
+ margin-right: 10px;
+}
+#media-upload .describe th.label {
+ text-align:right;
+}
+.menu_order {
+ float:left;
+}
.media-upload-form label, .media-upload-form legend {
display:block;
font-weight: bold;
+ font-size: 13px;
margin-bottom: 0.5em;
margin: 0 0 0.5em 0;
}
#media-upload .media-upload-form p {
margin: 0 1em 1em 0;
}
+
+#media-upload .media-upload-form p.ml-submit {
+ padding: 1em 0;
+}
+
#media-upload p.help {
font-style: italic;
font-weight: normal;
min-height: 36px;
width: 100%;
}
+
+#media-upload .ui-sortable .media-item {
+ cursor: move;
+}
+
.filename {
+ float: left;
line-height: 36px;
margin-left: 10px;
- float: left;
+ overflow: hidden;
+ max-width: 430px;
}
#media-upload .describe {
border-top-width: 1px;
padding: 5px;
width: 100%;
clear: both;
+ cursor: default;
}
#media-upload .describe th.label {
padding-top: .5em;
margin-bottom: 1em;
height: 3em;
}
+
+#media-upload #filter {
+ width: 623px;
+}
+
+#media-upload #filter .subsubsub {
+ margin: 8px 0;
+}
+
+#filter .tablenav select {
+ border-style:solid;
+ border-width:1px;
+ padding:2px;
+ vertical-align:top;
+}
+
+#media-upload a.delete,
+#media-upload a.del-link {
+ padding: 0 3px 1px;
+}
+
+#media-upload .del-attachment {
+ display: none;
+ margin: 5px 0;
+}
+
+.menu_order {
+ float: right;
+ font-size: 11px;
+ margin: 10px 10px 0;
+}
+
+.menu_order_input {
+ border: 1px solid #DDDDDD;
+ font-size: 10px;
+ padding: 1px;
+ width: 23px;
+}
+
+.ui-sortable-helper {
+ background-color: #fff;
+ border: 1px solid #aaa;
+ opacity: 0.6;
+ filter: alpha(opacity=60);
+}
+
+#media-upload th.order-head {
+ width: 25%;
+ text-align: center;
+}
+
+#media-upload .widefat {
+ width: 626px;
+ border-style: solid solid none;
+}
+
+.sorthelper {
+ z-index: -1;
+}
--- /dev/null
+.ui-tabs-nav {
+ margin-right: 0;
+}
--- /dev/null
+#posting {
+ position: static !important;
+}
+ .ui-tabs-nav {
+ margin-left: 0;
+ border: 0 !important;
+}
--- /dev/null
+body {
+ font-family: Tahoma;
+}
+.ui-tabs-nav {
+ padding-left:0;
+ padding-right:8px;
+}
+.ui-tabs-nav li {
+ float: right;
+}
+.button {
+ font-family: Tahoma;
+ margin-left:0;
+ margin-right: 5px;
+}
+#wphead #viewsite {
+ margin-left:0;
+ margin-right: 10px;
+}
+#viewsite {
+ right:auto;
+ left: 8px;
+}
+#wphead #viewsite a {
+ font-family: Tahoma;
+}
+h1 {
+ right:auto;
+ left:0;
+}
+div#posting {
+ padding-left:0;
+ padding-right: 16px;
+}
+#photo_directions span {
+ right:auto;
+ left:3px;
+}
+#img_container a {
+ float:right;
+}
+#img_container a, #img_container a:link, #img_container a:visited {
+ margin:0 0 4px 4px;
+}
+div#categories {
+ right:auto;
+ left:16px;
+}
+div#categories h2 {
+ margin: .5em 1em .5em 0;
+}
+#tagsdiv #newtag {
+ margin-right:0;
+ margin-left: 5px;
+}
+#jaxtag {
+ padding-left:0;
+ padding-right: 1em;
+}
+#tagchecklist {
+ padding-left:0;
+ padding-right: 1em;
+}
+#tagchecklist span {
+ margin-right: 10px;
+ margin-left: .5em;
+ float: right;
+}
+#tagchecklist span a {
+ margin: 6px -9px 0pt 0;
+ float: right;
+}
+.submitbox {
+ float: left;
+}
+.submitbox .submit input {
+ text-align:right;
+}
+.video_split #extra_fields {
+ float:right;
+}
+.video_split .editor_area {
+ float: left;
+}
+.ac_results li {
+ text-align:right;
+}
+#TB_ajaxContent #options {
+ right:auto;
+ left:25px;
+}
+#post_status {
+ margin-left:0;
+ margin-right: 10px;
+}
+#footer {
+ padding: 10px 60px 0 0;
+}
--- /dev/null
+body {
+ font: 13px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
+ color: #333;
+ margin: 0px;
+ padding: 0px;
+}
+
+img { border: 0; }
+/* Tabs */
+@media projection , screen {
+ .ui-tabs-hide {
+ display: none;
+ }
+}
+
+@media print {
+ .ui-tabs-nav {
+ display: none;
+ }
+}
+
+.ui-tabs-nav {
+ list-style: none;
+ border-bottom: 1px solid #C6D9E9;
+ padding-left: 8px;
+ margin-bottom: .5em;
+ margin-top: -2em;
+}
+
+/* Additional IE specific bug fixes... */
+* html .ui-tabs-nav { /* auto clear, @ IE 6 & IE 7 Quirks Mode */
+ display: inline-block;
+}
+
+* :first-child+html .ui-tabs-nav {
+ /* @ IE 7 Standards Mode - do not group selectors, otherwise IE 6 will ignore complete rule (because of the unknown + combinator)... */
+ display: inline-block;
+}
+
+.ui-tabs-nav:after {
+ /* clearing without presentational markup, IE gets extra treatment */
+ display: block;
+ clear: both;
+ content: " ";
+}
+
+.ui-tabs-nav li {
+ float: left;
+ margin: 0;
+ height: 2em;
+ line-height: 2em;
+}
+
+.ui-tabs-nav a,.ui-tabs-nav a span {
+ display: block;
+}
+
+.ui-tabs-nav a {
+ margin: 1px 0 0;
+ /* position: relative makes opacity fail for disabled tab in IE */
+ padding-left: 0;
+ color: #27537a;
+ font-weight: bold;
+ line-height: 2em;
+ text-align: center;
+ text-decoration: none;
+ white-space: nowrap; /* required in IE 6 */
+ outline: 0; /* prevent dotted border in Firefox */
+ padding: 0 1em;
+}
+
+.ui-tabs-nav .ui-tabs-selected a {
+ position: relative;
+ top: 1px;
+ z-index: 2;
+ margin-top: 0;
+ -moz-border-radius-topleft: 4px;
+ -moz-border-radius-topright: 4px;
+ -webkit-border-top-left-radius: 4px;
+ -webkit-border-top-right-radius: 4px;
+ border-style: solid;
+ border-width: 1px;
+ background: white;
+ border-bottom-width: 2px;
+ margin-top: -2px;
+}
+
+.ui-tabs-nav a:hover,.ui-tabs-nav a:focus,.ui-tabs-nav a:active,
+.ui-tabs-nav .ui-tabs-selected a:link,.ui-tabs-nav .ui-tabs-selected a:visited {
+ cursor: pointer;
+}
+
+/* Header */
+#wphead {
+ border-top: none;
+ height: 2em;
+ padding-top: 8px;
+}
+
+.button {
+ font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
+ padding: 3px 5px;
+ font-size: 12px;
+ line-height: 1.5em;
+ border-width: 1px;
+ border-style: solid;
+ -moz-border-radius: 3px;
+ -khtml-border-radius: 3px;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ cursor: pointer;
+ margin-left: 5px;
+ text-decoration: none;
+}
+
+.howto {
+ font-size: 11px;
+ font-style: italic;
+ display: block;
+}
+
+#wphead #viewsite {
+ position: absolute;
+ margin-top: 12px;
+ margin-left: 10px;
+}
+
+#viewsite {
+ position: relative;
+ right: 8px;
+ top: 6px;
+ margin: 0 !important;
+}
+
+#wphead #viewsite a {
+ font: 12px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
+ padding: 3px 4px;
+ display: block;
+ letter-spacing: normal;
+ border-width: 1px;
+ border-style: solid;
+ -moz-border-radius: 3px;
+ -khtml-border-radius: 3px;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ text-decoration: none;
+}
+
+#previewview {
+ padding-top: 8px !important;
+ padding-bottom: 8px !important;
+}
+
+h1 {
+ font-size: .75em;
+ line-height: 2.666em;
+ top: .5em;
+ right: 0;
+ margin: 0 !important;
+ padding: 0 !important;
+ width: 236px;
+ background: none;
+}
+
+input.text {
+ border: 0pt none;
+ outline-color: -moz-use-text-color;
+ outline-style: none;
+ outline-width: medium;
+ padding: 0pt;
+ width: 100%;
+ border-style: solid;
+ color: #333333;
+}
+
+/* Editor/Main Column */
+
+div#container {
+ margin: 0;
+ min-width: 500px;
+}
+
+div#container form {
+ margin: 0px;
+ padding: 0px;
+}
+
+div#posting {
+ padding-left: 16px;
+ position: absolute;
+ z-index: 1;
+ width: 66%;
+}
+
+#post_title {
+ width: 99%;
+}
+
+.titlewrap {
+ border-style: solid;
+ border-width: 1px;
+ padding: 2px 3px;
+ border-color: #CCCCCC;
+}
+
+div#posting h2 {
+ margin: .5em 0 .25em 0;
+ font-size: 12px;
+ padding: 3px;
+ background: ;
+}
+
+.editor-container {
+ border-width: 1px;
+ border-color: #ccc;
+ border-style: solid;
+ margin-bottom: 1em;
+}
+
+/* Photo Styles */
+
+#photo_directions {
+ margin-top: .25em;
+ display: block;
+ position: relative;
+}
+
+#photo_directions span {
+ display: block;
+ position: absolute;
+ top: 0;
+ right: 3px;
+}
+
+#photo_saving {
+ margin: 0 8px 8px;
+ vertical-align: middle;
+}
+
+#img_container {
+ background-color: #fff;
+ overflow: auto;
+ height: 100px;
+}
+
+#img_container a {
+ display: block;
+ width: 79px;
+ height: 79px;
+ float: left;
+}
+
+#img_container img {
+ width: 75px;
+ height: 75px;
+ border: 0px;
+ padding: 2px;
+ background-color: #f4f4f4;
+ cursor: pointer;
+}
+#img_container a, #img_container a:link, #img_container a:visited {
+ border: 2px solid #ccc;
+ margin: 0 4px 4px 0;
+}
+#img_container a:hover, #img_container a:active {
+ border: 2px solid #000;
+}
+
+/* Submit Column */
+
+div#categories {
+ font-size: 85%;
+ position: absolute;
+ top: 50px;
+ right: 16px;
+ width: 27%;
+ z-index: 2;
+}
+
+div#categories h2 {
+ color: #333;
+ font-size: 12px;
+ margin: .5em 0 .5em 1em;
+ padding: 0;
+}
+
+#categories-all {
+ overflow: auto;
+ padding: 0 1em 1em 1em;
+ height: 15em;
+}
+
+#categories ul {
+ list-style: none;
+ padding: 0;
+ margin: 0;
+}
+
+#tagsdiv #newtag {
+ padding: 3px;
+ margin-right: 5px;
+ width: 16em;
+}
+
+#jaxtag {
+ clear: both;
+ padding-left: 1em;
+ margin: 0;
+}
+
+#tagchecklist {
+ padding-left: 1em;
+ margin-bottom: 1em;
+ font-size: 12px;
+ overflow: auto;
+}
+
+#tagchecklist strong {
+ position: absolute;
+ font-size: .75em;
+}
+
+#tagchecklist span {
+ margin-right: .5em;
+ margin-left: 10px;
+ display: block;
+ float: left;
+ font-size: 11px;
+ line-height: 1.8em;
+ white-space: nowrap;
+ cursor: default;
+}
+
+#tagchecklist span a {
+ margin: 6px 0pt 0pt -9px;
+ cursor: pointer;
+ width: 10px;
+ height: 10px;
+ display: block;
+ float: left;
+ text-indent: -9999px;
+ overflow: hidden;
+ position: absolute;
+}
+.submit {
+ -moz-border-radius-bottomleft: 3px;
+ -khtml-border-bottom-left-radius: 3px;
+ -webkit-border-bottom-left-radius: 3px;
+ border-bottom-left-radius: 3px;
+ -moz-border-radius-bottomright: 3px;
+ -khtml-border-bottom-right-radius: 3px;
+ -webkit-border-bottom-right-radius: 3px;
+ border-bottom-right-radius: 3px;
+ margin: 0;
+ padding: 10px;
+}
+.submitbox {
+ width: 100%;
+ float: right;
+}
+
+.submitbox .submit a:hover {
+ border-bottom-width: 1px;
+ border-bottom-style: solid;
+}
+
+.submitbox .submit input {
+ border: none;
+ text-align: left;
+ padding: 6px 4px;
+ font-size: 12px;
+ margin: 2px;
+ -moz-border-radius: 3px;
+ -khtml-border-radius: 3px;
+ -webkit-border-radius: 3px;
+ border-radius: 3px;
+ cursor: pointer;
+}
+
+.submitbox #previewview {
+ padding: 15px 10px;
+ -moz-border-radius-topleft: 3px;
+ -khtml-border-top-left-radius: 3px;
+ -webkit-border-top-left-radius: 3px;
+ border-top-left-radius: 3px;
+ -moz-border-radius-topright: 3px;
+ -khtml-border-top-right-radius: 3px;
+ -webkit-border-top-right-radius: 3px;
+ border-top-right-radius: 3px;
+}
+
+/* Video Styles */
+.video_split #extra_fields {
+ width: 27%;
+ height: 300px;
+ float: left;
+}
+
+#embed_code {
+ border: 0;
+ width: 99%;
+ height: 200px;
+}
+.video_split .editor_area {
+ width: 70%;
+ float: right;
+}
+
+.ac_results {
+ padding: 0;
+ margin: 0;
+ list-style: none;
+ position: absolute;
+ z-index: 10000;
+ display: none;
+ border-width: 1px;
+ border-style: solid;
+}
+
+.ac_results li {
+ padding: 2px 5px;
+ white-space: nowrap;
+ text-align: left;
+}
+
+.ac_over {
+ cursor: pointer;
+}
+
+.ac_match {
+ text-decoration: underline;
+}
+
+.photolist {
+ display: none;
+}
+
+#extra_fields small {
+ display: block;
+ margin-top: .5em;
+ padding-bottom: .25em;
+}
+
+#TB_ajaxContent #options {
+ position: absolute;
+ top: 20px;
+ right: 25px;
+ padding: 5px;
+}
+#TB_ajaxContent h3 {
+ margin-bottom: .25em;
+}
+
+.updated {
+ margin: 0;
+ margin-left: 15px;
+ margin-right: 15px;
+ padding: 0;
+ max-width: 980px;
+ border-width: 1px;
+ border-style: solid;
+ padding: 0 0.6em;
+ max-width: 950px;
+ margin-top: 1em;
+ margin-bottom: 1em;
+}
+
+.updated p, .error p {
+ margin: 0.6em 0;
+}
+
+.updated a, .error a {
+ text-decoration: underline;
+}
+
+.updated a {
+ text-decoration: none;
+ padding-bottom: 2px;
+}
+
+#post_status {
+ margin-left: 10px;
+ margin-bottom: 1em;
+ display: block;
+}
+
+/* Footer */
+
+#footer {
+ height: 65px;
+ display: block;
+ width: 640px;
+ padding: 10px 0 0 60px;
+ margin: 0;
+ position: absolute;
+ bottom: 0;
+ font-size: 12px;
+}
+
+#footer p {
+ margin: 0;
+ padding: 7px 0;
+}
+
+#footer p a {
+ text-decoration: none;
+}
+
+#footer p a:hover {
+ text-decoration: underline;
+}
+
+
+/* Utility Classes */
+.centered {
+ text-align: center;
+}
+
+.hidden {
+ display: none;
+}
\ No newline at end of file
+#template textarea {
+ font-family:monospace;
+}
#templateside {
float:left;
}
#themeselector {
padding-right:0;
- padding-left:5px;
+ padding-left: 5px;
+ float: left;
}
div.tablenav {
- margin-left:210px;
margin-right:0;
-}
\ No newline at end of file
+ margin-left: 210px;
+}
+/* 2 column liquid layout */
div.widget-liquid-left-holder {
- clear:right;
- float:right;
+ float: right;
+ clear: right;
margin-right:0;
- margin-left:-310px;
+ margin-left: -310px;
}
div.widget-liquid-left {
margin-right:0;
- margin-left:310px;
+ margin-left: 320px;
}
div.widget-liquid-right {
- clear:left;
- float:left;
+ float: left;
+ clear: left;
}
p#widget-search {
+ right:auto;
left:0;
- right:auto
+}
+h4.widget-title span {
+ float: right;
+}
+h4.widget-title a {
+ float: left;
+ margin-left:0;
+ margin-right: 1em;
}
ul#widget-list li.widget-list-item h4.widget-title {
float:right;
- text-align:right;
}
ul#widget-list li.widget-list-item div.widget-description {
- margin:0 200px 0 0;
- padding:0 4em 0 0;
+ margin: 0 200px 0 0;
+ padding: 0 4em 0 0;
}
.widget-control-save, .widget-control-remove {
- float:right;
margin-right:0;
- margin-left:8px;
+ margin-left: 8px;
+ float: right;
}
-h4.widget-title a {
- right:auto;
- left:1em;
-}
-li.widget-list-control-item h4.widget-title a, #dragHelper li.widget-list-control-item h4.widget-title a, #draghelper li.widget-list-control-item h4.widget-title a:visited {
+li.widget-list-control-item h4.widget-title a,
+#dragHelper li.widget-list-control-item h4.widget-title a,
+#draghelper li.widget-list-control-item h4.widget-title a:visited {
right:auto;
- left:1em;
-}
-
-li.widget-list-control-item div.widget-control {
- padding:0 0 0 10px;
-}
-ul.widget-control-list div.widget-control-actions {
- margin-right:0;
- margin-left:-10px;
+ left: 1em;
}
-ul.widget-control-list .widget-title {
- text-align:right;
-}
\ No newline at end of file
margin: 0;
border-bottom-width: 1px;
border-bottom-style: solid;
- background-color: transparent;
line-height: 1;
}
+h4.widget-title span {
+ float: left;
+}
+
+h4.widget-title a {
+ float: right;
+ text-decoration: underline;
+ border-bottom: none;
+ margin-left: 1em;
+}
+
ul#widget-list li.widget-list-item h4.widget-title {
position: relative;
margin: 0;
-moz-border-radius: 3px;
-khtml-border-radius: 3px;
-webkit-border-radius: 3px;
- border-radius: 3px;;
+ border-radius: 3px;
}
#dragHelper h4.widget-title {
font-size: 11px;
}
-
ul#widget-list li.widget-list-item ul.widget-control-info {
display: none;
}
padding: 0 1em;
}
-ul.widget-control-list li {
- position: relative;
-}
-
div#current-widgets p.submit {
padding: 1em;
}
li.widget-list-control-item {
- margin: 0 0 1em;
+ margin: 1em 0;
-moz-border-radius: 3px;
-khtml-border-radius: 3px;
-webkit-border-radius: 3px;
border-radius: 3px;
}
-li.widget-list-control-item h4, #dragHelper li.widget-list-control-item h4, li.widget-sortable h4 {
+li.widget-list-control-item h4,
+#dragHelper li.widget-list-control-item h4,
+li.widget-sortable h4 {
margin: 0;
- padding: 0.4em 2.5em 0.4em 0.8em;
cursor: move;
font-size: 13px;
+ padding: 0.4em 0.8em;
+ position: relative;
-moz-border-radius: 3px;
-khtml-border-radius: 3px;
-webkit-border-radius: 3px;
text-decoration: none;
}
-h4.widget-title a {
- position: absolute;
- right: 1em;
- text-decoration: underline;
- border-bottom: none;
-}
-
li.widget-list-control-item h4.widget-title a,
#dragHelper li.widget-list-control-item h4.widget-title a,
#draghelper li.widget-list-control-item h4.widget-title a:visited {
}
li.widget-list-control-item h4.widget-title a:hover {
-
text-decoration: none;
border-bottom: none;
}
li.widget-list-control-item div.widget-control {
display: none;
- margin: 1em;
- padding: 0 10px 0 7px; /* Correction for padding, margin, border of inputs */
+ padding: 15px;
font-size: 11px;
+ position: relative;
}
li.widget-list-control-item div.widget-control p {
}
ul.widget-control-list div.widget-control-actions {
- margin-right: -10px; /* Correction for padding, margin, border of inputs */
- margin-left: -6px;
border-top-width: 1px;
border-top-style: solid;
- padding: 0.5em 0 0.8em;
-}
-
-ul.widget-control-list .widget-title {
-
+ padding: 0.5em 0 0;
}
.widget-control-edit {
<div id="desc"><?php bloginfo('description');?></div>
</div>
<?php if ( !defined( 'NO_HEADER_TEXT' ) ) { ?>
-<form method="post" action="<?php echo get_option('siteurl') ?>/wp-admin/themes.php?page=custom-header&updated=true">
+<form method="post" action="<?php echo admin_url('themes.php?page=custom-header&updated=true') ?>">
<input type="button" value="<?php _e('Hide Text'); ?>" onclick="hide_text()" id="hidetext" />
<input type="button" value="<?php _e('Select a Text Color'); ?>" onclick="colorSelect($('textcolor'), 'pickcolor')" id="pickcolor" /><input type="button" value="<?php _e('Use Original Color'); ?>" onclick="colorDefault()" id="defaultcolor" />
<?php wp_nonce_field('custom-header') ?>
<table class="form-table">
<tr class="form-field form-required">
<th scope="row" valign="top"><label for="cat_name"><?php _e('Category Name') ?></label></th>
- <td><input name="cat_name" id="cat_name" type="text" value="<?php echo attribute_escape($category->name); ?>" size="40" /><br />
+ <td><input name="cat_name" id="cat_name" type="text" value="<?php echo attribute_escape($category->name); ?>" size="40" aria-required="true" /><br />
<?php _e('The name is used to identify the category almost everywhere, for example under the post or in the category widget.'); ?></td>
</tr>
<tr class="form-field">
<th scope="row" valign="top"><label for="category_nicename"><?php _e('Category Slug') ?></label></th>
- <td><input name="category_nicename" id="category_nicename" type="text" value="<?php echo attribute_escape($category->slug); ?>" size="40" /><br />
+ <td><input name="category_nicename" id="category_nicename" type="text" value="<?php echo attribute_escape(apply_filters('editable_slug', $category->slug)); ?>" size="40" /><br />
<?php _e('The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></td>
</tr>
<tr class="form-field">
<th scope="row" valign="top"><label for="category_parent"><?php _e('Category Parent') ?></label></th>
<td>
- <?php wp_dropdown_categories('hide_empty=0&name=category_parent&orderby=name&selected=' . $category->parent . '&hierarchical=1&show_option_none=' . __('None')); ?><br />
+ <?php wp_dropdown_categories(array('hide_empty' => 0, 'name' => 'category_parent', 'orderby' => 'name', 'selected' => $category->parent, 'hierarchical' => true, 'show_option_none' => __('None'))); ?><br />
<?php _e('Categories, unlike tags, can have a hierarchy. You might have a Jazz category, and under that have children categories for Bebop and Big Band. Totally optional.'); ?>
</td>
</tr>
$comments_deleted = $comments_approved = $comments_unapproved = $comments_spammed = 0;
foreach ($_REQUEST['delete_comments'] as $comment) : // Check the permissions on each
$comment = (int) $comment;
- $post_id = (int) $wpdb->get_var("SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = $comment");
- // $authordata = get_userdata( $wpdb->get_var("SELECT post_author FROM $wpdb->posts WHERE ID = $post_id") );
+ $post_id = (int) $wpdb->get_var( $wpdb->prepare( "SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = %d", $comment) );
if ( !current_user_can('edit_post', $post_id) )
continue;
if ( !empty( $_REQUEST['spamit'] ) ) {
}
endforeach;
$redirect_to = basename( __FILE__ ) . '?deleted=' . $comments_deleted . '&approved=' . $comments_approved . '&spam=' . $comments_spammed . '&unapproved=' . $comments_unapproved;
+ if ( isset($_REQUEST['apage']) )
+ $redirect_to = add_query_arg( 'apage', absint($_REQUEST['apage']), $redirect_to );
if ( !empty($_REQUEST['mode']) )
$redirect_to = add_query_arg('mode', $_REQUEST['mode'], $redirect_to);
if ( !empty($_REQUEST['comment_status']) )
<?php
$status_links = array();
$num_comments = wp_count_comments();
-$stati = array('moderated' => sprintf(__ngettext('Awaiting Moderation (%s)', 'Awaiting Moderation (%s)', $num_comments->moderated), "<span class='comment-count'>$num_comments->moderated</span>"), 'approved' => _c('Approved|plural'));
+$stati = array('moderated' => sprintf(__ngettext('Awaiting Moderation (%s)', 'Awaiting Moderation (%s)', number_format_i18n($num_comments->moderated) ), "<span class='comment-count'>" . number_format_i18n($num_comments->moderated) . "</span>"), 'approved' => _c('Approved|plural'));
$class = ( '' === $comment_status ) ? ' class="current"' : '';
$status_links[] = "<li><a href=\"edit-comments.php\"$class>".__('Show All Comments')."</a>";
foreach ( $stati as $status => $label ) {
</ul>
<p id="post-search">
+ <label class="hidden" for="post-search-input"><?php _e( 'Search Comments' ); ?>:</label>
<input type="text" id="post-search-input" name="s" value="<?php echo $search; ?>" />
<input type="submit" value="<?php _e( 'Search Comments' ); ?>" class="button" />
</p>
<?php
+$comments_per_page = apply_filters('comments_per_page', 20, $comment_status);
+
if ( isset( $_GET['apage'] ) )
$page = abs( (int) $_GET['apage'] );
else
$page = 1;
-$start = $offset = ( $page - 1 ) * 20;
+$start = $offset = ( $page - 1 ) * $comments_per_page;
-list($_comments, $total) = _wp_get_comment_list( $comment_status, $search_dirty, $start, 25 ); // Grab a few extra
+list($_comments, $total) = _wp_get_comment_list( $comment_status, $search_dirty, $start, $comments_per_page + 5 ); // Grab a few extra
-$comments = array_slice($_comments, 0, 20);
-$extra_comments = array_slice($_comments, 20);
+$comments = array_slice($_comments, 0, $comments_per_page);
+$extra_comments = array_slice($_comments, $comments_per_page);
$page_links = paginate_links( array(
'base' => add_query_arg( 'apage', '%#%' ),
'format' => '',
- 'total' => ceil($total / 20),
+ 'total' => ceil($total / $comments_per_page),
'current' => $page
));
<input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" class="button-secondary delete" />
<?php do_action('manage_comments_nav', $comment_status); ?>
<?php wp_nonce_field('bulk-comments'); ?>
+<?php if ( isset($_GET['apage']) ) { ?>
+ <input type="hidden" name="apage" value="<?php echo absint( $_GET['apage'] ); ?>" />
+<?php } ?>
</div>
<br class="clear" />
<table class="widefat">
<thead>
<tr>
- <th scope="col" class="check-column"><input type="checkbox" onclick="checkAll(document.getElementById('comments-form'));" /></th>
+ <th scope="col" class="check-column"><input type="checkbox" /></th>
<th scope="col"><?php _e('Comment') ?></th>
<th scope="col"><?php _e('Date') ?></th>
<th scope="col" class="action-links"><?php _e('Actions') ?></th>
- <?php
-$action = isset($action)? $action : '';
+<?php
+
+$action = isset($action) ? $action : '';
if ( isset($_GET['message']) )
$_GET['message'] = absint( $_GET['message'] );
$messages[1] = sprintf( __( 'Post updated. Continue editing below or <a href="%s">go back</a>.' ), attribute_escape( stripslashes( $_GET['_wp_original_http_referer'] ) ) );
$messages[2] = __('Custom field updated.');
$messages[3] = __('Custom field deleted.');
$messages[4] = __('Post updated.');
+
+if ( isset($_GET['revision']) )
+ $messages[5] = sprintf( __('Post restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) );
+
+$notice = false;
+$notices[1] = __( 'There is an autosave of this post that is more recent than the version below. <a href="%s">View the autosave</a>.' );
+
+if ( !isset($post_ID) || 0 == $post_ID ) {
+ $form_action = 'post';
+ $temp_ID = -1 * time(); // don't change this formula without looking at wp_write_post()
+ $form_extra = "<input type='hidden' id='post_ID' name='temp_ID' value='$temp_ID' />";
+ $autosave = false;
+} else {
+ $post_ID = (int) $post_ID;
+ $form_action = 'editpost';
+ $form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />";
+ $autosave = wp_get_post_autosave( $post_id );
+
+ // Detect if there exists an autosave newer than the post and if that autosave is different than the post
+ if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt ) > mysql2date( 'U', $post->post_modified_gmt ) ) {
+ foreach ( _wp_post_revision_fields() as $autosave_field => $_autosave_field ) {
+ if ( wp_text_diff( $autosave->$autosave_field, $post->$autosave_field ) ) {
+ $notice = sprintf( $notices[1], get_edit_post_link( $autosave->ID ) );
+ break;
+ }
+ }
+ unset($autosave_field, $_autosave_field);
+ }
+}
+
?>
+<?php if ( $notice ) : ?>
+<div id="notice" class="error"><p><?php echo $notice ?></p></div>
+<?php endif; ?>
<?php if (isset($_GET['message'])) : ?>
<div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
<?php endif; ?>
<h2><?php _e('Write Post') ?></h2>
<?php
-if (!isset($post_ID) || 0 == $post_ID) {
- $form_action = 'post';
- $temp_ID = -1 * time(); // don't change this formula without looking at wp_write_post()
- $form_extra = "<input type='hidden' id='post_ID' name='temp_ID' value='$temp_ID' />";
+if ( !isset($post_ID) || 0 == $post_ID)
wp_nonce_field('add-post');
-} else {
- $post_ID = (int) $post_ID;
- $form_action = 'editpost';
- $form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />";
+else
wp_nonce_field('update-post_' . $post_ID);
-}
$form_pingback = '<input type="hidden" name="post_pingback" value="' . (int) get_option('default_pingback_flag') . '" id="post_pingback" />';
$form_prevstatus = '<input type="hidden" name="prev_status" value="' . attribute_escape( $post->post_status ) . '" />';
-$form_trackback = '<input type="text" name="trackback_url" style="width: 415px" id="trackback" tabindex="7" value="'. attribute_escape( str_replace("\n", ' ', $post->to_ping) ) .'" />';
-
-if ('' != $post->pinged) {
- $pings = '<p>'. __('Already pinged:') . '</p><ul>';
- $already_pinged = explode("\n", trim($post->pinged));
- foreach ($already_pinged as $pinged_url) {
- $pings .= "\n\t<li>" . wp_specialchars($pinged_url) . "</li>";
- }
- $pings .= '</ul>';
-}
-
$saveasdraft = '<input name="save" type="submit" id="save" class="button" tabindex="3" value="' . attribute_escape( __('Save and Continue Editing') ) . '" />';
?>
<input type="hidden" id="post_author" name="post_author" value="<?php echo attribute_escape( $post->post_author ); ?>" />
<input type="hidden" id="post_type" name="post_type" value="<?php echo $post->post_type ?>" />
<input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo $post->post_status ?>" />
-<input name="referredby" type="hidden" id="referredby" value="<?php
-if ( !empty($_REQUEST['popupurl']) )
- echo clean_url(stripslashes($_REQUEST['popupurl']));
-else if ( strpos( wp_get_referer(), '/wp-admin/' ) === false && $post_ID && url_to_postid(wp_get_referer()) === $post_ID )
- echo 'redo';
-else
- echo clean_url(stripslashes(wp_get_referer()));
-?>" />
+<input name="referredby" type="hidden" id="referredby" value="<?php echo clean_url(stripslashes(wp_get_referer())); ?>" />
<?php if ( 'draft' != $post->post_status ) wp_original_referer_field(true, 'previous'); ?>
<?php echo $form_extra ?>
<div class="inside">
-<p><strong><?php _e('Publish Status') ?></strong></p>
+<p><strong><label for='post_status'><?php _e('Publish Status') ?></label></strong></p>
<p>
-<select name='post_status' tabindex='4'>
-<?php if ( current_user_can('publish_posts') ) : // Contributors only get "Unpublished" and "Pending Review" ?>
+<select name='post_status' id='post_status' tabindex='4'>
+<?php
+// only show the publish menu item if they are allowed to publish posts or they are allowed to edit this post (accounts for 'edit_published_posts' capability)
+if ( current_user_can('publish_posts') OR ( $post->post_status == 'publish' AND current_user_can('edit_post', $post->ID) ) ) :
+?>
<option<?php selected( $post->post_status, 'publish' ); selected( $post->post_status, 'private' );?> value='publish'><?php _e('Published') ?></option>
<?php if ( 'future' == $post->post_status ) : ?>
<option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Scheduled') ?></option>
</p>
<?php if ( current_user_can( 'publish_posts' ) ) : ?>
-<p><label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="checkbox" value="private" <?php checked($post->post_status, 'private'); ?> tabindex="4" /> <?php _e('Keep this post private') ?></label></p>
+<p id="private-checkbox"><label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="checkbox" value="private" <?php checked($post->post_status, 'private'); ?> tabindex="4" /> <?php _e('Keep this post private') ?></label></p>
<?php endif; ?>
<?php
if ($post_ID) {
<br class="clear" />
<?php endif; ?>
<span id="autosave"></span>
+<span id="wp-word-count"></span>
</p>
<div class="side-info">
<li><a href="edit.php?post_status=draft"><?php _e('View Drafts'); ?></a></li>
<?php do_action('post_relatedlinks_list'); ?>
</ul>
+
+<h5><?php _e('Shortcuts') ?></h5>
+<p><?php _e('Drag-and-drop the following link to your bookmarks bar or right click it and add it to your favorites for a posting shortcut.') ?> <a href="<?php echo get_shortcut_link(); ?>" title="<?php echo attribute_escape(__('Press This')) ?>"><?php _e('Press This') ?></a></p>
</div>
<?php do_action('submitpost_box'); ?>
<div id="post-body">
<div id="titlediv">
-<h3><?php _e('Title') ?></h3>
+<h3><label for="title"><?php _e('Title') ?></label></h3>
<div id="titlewrap">
<input type="text" name="post_title" size="30" tabindex="1" value="<?php echo attribute_escape($post->post_title); ?>" id="title" autocomplete="off" />
</div>
</div>
<div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea">
-<h3><?php _e('Post') ?></h3>
+<h3><label for="content"><?php _e('Post') ?></label></h3>
<?php the_editor($post->post_content); ?>
<?php wp_nonce_field( 'autosave', 'autosavenonce', false ); ?>
<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
<?php echo $form_pingback ?>
<?php echo $form_prevstatus ?>
-<div id="tagsdiv" class="postbox <?php echo postbox_classes('tagsdiv', 'post'); ?>">
-<h3><?php _e('Tags'); ?></h3>
-<div class="inside">
-<p id="jaxtag"><input type="text" name="tags_input" class="tags-input" id="tags-input" size="40" tabindex="3" value="<?php echo get_tags_to_edit( $post_ID ); ?>" /></p>
+<?php
+function post_tags_meta_box($post) {
+?>
+<p id="jaxtag"><label class="hidden" for="newtag"><?php _e('Tags'); ?></label><input type="text" name="tags_input" class="tags-input" id="tags-input" size="40" tabindex="3" value="<?php echo get_tags_to_edit( $post->ID ); ?>" /></p>
<div id="tagchecklist"></div>
-</div>
-</div>
-
-<div id="categorydiv" class="postbox <?php echo postbox_classes('categorydiv', 'post'); ?>">
-<h3><?php _e('Categories') ?></h3>
-<div class="inside">
+<?php
+}
+add_meta_box('tagsdiv', __('Tags'), 'post_tags_meta_box', 'post', 'normal', 'core');
+function post_categories_meta_box($post) {
+?>
<div id="category-adder" class="wp-hidden-children">
<h4><a id="category-add-toggle" href="#category-add" class="hide-if-no-js" tabindex="3"><?php _e( '+ Add New Category' ); ?></a></h4>
<p id="category-add" class="wp-hidden-child">
- <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" tabindex="3" />
- <?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?>
+ <label class="hidden" for="newcat"><?php _e( 'Add New Category' ); ?></label><input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" tabindex="3" aria-required="true"/>
+ <label class="hidden" for="newcat_parent"><?php _e('Parent category'); ?>:</label><?php wp_dropdown_categories( array( 'hide_empty' => 0, 'name' => 'newcat_parent', 'orderby' => 'name', 'hierarchical' => 1, 'show_option_none' => __('Parent category'), 'tab_index' => 3 ) ); ?>
<input type="button" id="category-add-sumbit" class="add:categorychecklist:category-add button" value="<?php _e( 'Add' ); ?>" tabindex="3" />
<?php wp_nonce_field( 'add-category', '_ajax_nonce', false ); ?>
<span id="category-ajax-response"></span>
<div id="categories-all" class="ui-tabs-panel">
<ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
- <?php wp_category_checklist($post_ID) ?>
+ <?php wp_category_checklist($post->ID, false, false, $popular_ids) ?>
</ul>
</div>
-
-</div>
-</div>
+<?php
+}
+add_meta_box('categorydiv', __('Categories'), 'post_categories_meta_box', 'post', 'normal', 'core');
+?>
<?php do_meta_boxes('post', 'normal', $post); ?>
<h2><?php _e('Advanced Options'); ?></h2>
-<div id="postexcerpt" class="postbox <?php echo postbox_classes('postexcerpt', 'post'); ?>">
-<h3><?php _e('Excerpt') ?></h3>
-<div class="inside"><textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt"><?php echo $post->post_excerpt ?></textarea>
+<?php
+function post_excerpt_meta_box($post) {
+?>
+<label class="hidden" for="excerpt"><?php _e('Excerpt') ?></label><textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt"><?php echo $post->post_excerpt ?></textarea>
<p><?php _e('Excerpts are optional hand-crafted summaries of your content. You can <a href="http://codex.wordpress.org/Template_Tags/the_excerpt" target="_blank">use them in your template</a>'); ?></p>
-</div>
-</div>
+<?php
+}
+add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', 'post', 'advanced', 'core');
+
+function post_trackback_meta_box($post) {
+ $form_trackback = '<input type="text" name="trackback_url" style="width: 415px" id="trackback" tabindex="7" value="'. attribute_escape( str_replace("\n", ' ', $post->to_ping) ) .'" />';
+ if ('' != $post->pinged) {
+ $pings = '<p>'. __('Already pinged:') . '</p><ul>';
+ $already_pinged = explode("\n", trim($post->pinged));
+ foreach ($already_pinged as $pinged_url) {
+ $pings .= "\n\t<li>" . wp_specialchars($pinged_url) . "</li>";
+ }
+ $pings .= '</ul>';
+ }
-<div id="trackbacksdiv" class="postbox <?php echo postbox_classes('trackbacksdiv', 'post'); ?>">
-<h3><?php _e('Trackbacks') ?></h3>
-<div class="inside">
-<p><?php _e('Send trackbacks to:'); ?> <?php echo $form_trackback; ?><br /> (<?php _e('Separate multiple URLs with spaces'); ?>)</p>
+?>
+<p><label for="trackback"><?php _e('Send trackbacks to:'); ?></label> <?php echo $form_trackback; ?><br /> (<?php _e('Separate multiple URLs with spaces'); ?>)</p>
<p><?php _e('Trackbacks are a way to notify legacy blog systems that you’ve linked to them. If you link other WordPress blogs they’ll be notified automatically using <a href="http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments" target="_blank">pingbacks</a>, no other action necessary.'); ?></p>
<?php
if ( ! empty($pings) )
echo $pings;
-?>
-</div>
-</div>
+}
+add_meta_box('trackbacksdiv', __('Trackbacks'), 'post_trackback_meta_box', 'post', 'advanced', 'core');
-<div id="postcustom" class="postbox <?php echo postbox_classes('postcustom', 'post'); ?>">
-<h3><?php _e('Custom Fields') ?></h3>
-<div class="inside">
+function post_custom_meta_box($post) {
+?>
<div id="postcustomstuff">
<table cellpadding="3">
<?php
-$metadata = has_meta($post_ID);
+$metadata = has_meta($post->ID);
list_meta($metadata);
?>
<div id="ajax-response"></div>
</div>
<p><?php _e('Custom fields can be used to add extra metadata to a post that you can <a href="http://codex.wordpress.org/Using_Custom_Fields" target="_blank">use in your theme</a>.'); ?></p>
-</div>
-</div>
+<?php
+}
+add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', 'post', 'advanced', 'core');
-<?php do_action('dbx_post_advanced'); ?>
+do_action('dbx_post_advanced');
-<div id="commentstatusdiv" class="postbox <?php echo postbox_classes('commentstatusdiv', 'post'); ?>">
-<h3><?php _e('Comments & Pings') ?></h3>
-<div class="inside">
+function post_comment_status_meta_box($post) {
+?>
<input name="advanced_view" type="hidden" value="1" />
<p><label for="comment_status" class="selectit">
<input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> />
<?php _e('Allow Comments') ?></label></p>
<p><label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php _e('Allow Pings') ?></label></p>
<p><?php _e('These settings apply to this post only. “Pings” are <a href="http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments" target="_blank">trackbacks and pingbacks</a>.'); ?></p>
-</div>
-</div>
+<?php
+}
+add_meta_box('commentstatusdiv', __('Comments & Pings'), 'post_comment_status_meta_box', 'post', 'advanced', 'core');
-<div id="passworddiv" class="postbox <?php echo postbox_classes('passworddiv', 'post'); ?>">
-<h3><?php _e('Password Protect This Post') ?></h3>
-<div class="inside">
-<p><input name="post_password" type="text" size="25" id="post_password" value="<?php echo attribute_escape( $post->post_password ); ?>" /></p>
+function post_password_meta_box($post) {
+?>
+<p><label class="hidden" for="post_password"><?php _e('Password Protect This Post') ?></label><input name="post_password" type="text" size="25" id="post_password" value="<?php echo attribute_escape( $post->post_password ); ?>" /></p>
<p><?php _e('Setting a password will require people who visit your blog to enter the above password to view this post and its comments.'); ?></p>
-</div>
-</div>
-
-<div id="slugdiv" class="postbox <?php echo postbox_classes('slugdiv', 'post'); ?>">
-<h3><?php _e('Post Slug') ?></h3>
-<div class="inside">
-<input name="post_name" type="text" size="13" id="post_name" value="<?php echo attribute_escape( $post->post_name ); ?>" />
-</div>
-</div>
+<?php
+}
+add_meta_box('passworddiv', __('Password Protect This Post'), 'post_password_meta_box', 'post', 'advanced', 'core');
+function post_slug_meta_box($post) {
+?>
+<label class="hidden" for="post_name"><?php _e('Post Slug') ?></label><input name="post_name" type="text" size="13" id="post_name" value="<?php echo attribute_escape( $post->post_name ); ?>" />
<?php
+}
+add_meta_box('slugdiv', __('Post Slug'), 'post_slug_meta_box', 'post', 'advanced', 'core');
+
$authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM
if ( $post->post_author && !in_array($post->post_author, $authors) )
$authors[] = $post->post_author;
if ( $authors && count( $authors ) > 1 ) :
+function post_author_meta_box($post) {
+ global $current_user, $user_ID;
+ $authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM
+ if ( $post->post_author && !in_array($post->post_author, $authors) )
+ $authors[] = $post->post_author;
?>
-<div id="authordiv" class="postbox <?php echo postbox_classes('authordiv', 'post'); ?>">
-<h3><?php _e('Post Author'); ?></h3>
-<div class="inside">
-<?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post_ID) ? $user_ID : $post->post_author) ); ?>
-</div>
-</div>
-<?php endif; ?>
+<label class="hidden" for="post_author_override"><?php _e('Post Author'); ?></label><?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post->ID) ? $user_ID : $post->post_author) ); ?>
+<?php
+}
+add_meta_box('authordiv', __('Post Author'), 'post_author_meta_box', 'post', 'advanced', 'core');
+endif;
-<?php do_meta_boxes('post', 'advanced', $post); ?>
+if ( isset($post_ID) && 0 < $post_ID && wp_get_post_revisions( $post_ID ) ) :
+function post_revisions_meta_box($post) {
+ wp_list_post_revisions();
+}
+add_meta_box('revisionsdiv', __('Post Revisions'), 'post_revisions_meta_box', 'post', 'advanced', 'core');
+endif;
-<?php do_action('dbx_post_sidebar'); ?>
+do_meta_boxes('post', 'advanced', $post);
+
+do_action('dbx_post_sidebar');
+?>
</div>
</div>
<div class="inside">
-<p><strong><?php _e('Approval Status') ?></strong></p>
+<p><strong><label for='comment_status'><?php _e('Approval Status') ?></label></strong></p>
<p>
-<select name='comment_status'>
+<select name='comment_status' id='comment_status'>
<option<?php selected( $comment->comment_approved, '1' ); ?> value='1'><?php _e('Approved') ?></option>
<option<?php selected( $comment->comment_approved, '0' ); ?> value='0'><?php _e('Moderated') ?></option>
<option<?php selected( $comment->comment_approved, 'spam' ); ?> value='spam'><?php _e('Spam') ?></option>
<div id="post-body">
<div id="namediv" class="stuffbox">
-<h3><?php _e('Name') ?></h3>
+<h3><label for="name"><?php _e('Name') ?></label></h3>
<div class="inside">
<input type="text" name="newcomment_author" size="30" value="<?php echo attribute_escape( $comment->comment_author ); ?>" tabindex="1" id="name" />
</div>
</div>
<div id="emaildiv" class="stuffbox">
-<h3><?php _e('E-mail') ?></h3>
+<h3><label for="email"><?php _e('E-mail') ?></label></h3>
<div class="inside">
<input type="text" name="newcomment_author_email" size="30" value="<?php echo attribute_escape( $comment->comment_author_email ); ?>" tabindex="2" id="email" />
</div>
</div>
<div id="uridiv" class="stuffbox">
-<h3><?php _e('URL') ?></h3>
+<h3><label for="newcomment_author_url"><?php _e('URL') ?></label></h3>
<div class="inside">
<input type="text" id="newcomment_author_url" name="newcomment_author_url" size="30" value="<?php echo attribute_escape( $comment->comment_author_url ); ?>" tabindex="3" />
</div>
</div>
<div id="postdiv" class="postarea">
-<h3><?php _e('Comment') ?></h3>
+<h3><label for="content"><?php _e('Comment') ?></label></h3>
<?php the_editor($comment->comment_content, 'content', 'newcomment_author_url', false, 4); ?>
<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
</div>
foreach( (array) $_GET['delete'] as $cat_ID ) {
$cat_name = get_term_field('name', $cat_ID, 'link_category');
-
+ $default_cat_id = get_option('default_link_category');
+
// Don't delete the default cats.
- if ( $cat_ID == get_option('default_link_category') )
+ if ( $cat_ID == $default_cat_id )
wp_die(sprintf(__("Can’t delete the <strong>%s</strong> category: this is the default one"), $cat_name));
- wp_delete_term($cat_ID, 'link_category');
+ wp_delete_term($cat_ID, 'link_category', array('default' => $default_cat_id));
}
$location = 'edit-link-categories.php';
<?php endif; ?>
<p id="post-search">
+ <label class="hidden" for="post-search-input"><?php _e( 'Search Categories' ); ?>:</label>
<input type="text" id="post-search-input" name="s" value="<?php echo attribute_escape(stripslashes($_GET['s'])); ?>" />
<input type="submit" value="<?php _e( 'Search Categories' ); ?>" class="button" />
</p>
<table class="widefat">
<thead>
<tr>
- <th scope="col" class="check-column"><input type="checkbox" onclick="checkAll(document.getElementById('posts-filter'));" /></th>
+ <th scope="col" class="check-column"><input type="checkbox" /></th>
<th scope="col"><?php _e('Name') ?></th>
<th scope="col"><?php _e('Description') ?></th>
<th scope="col" class="num" style="width: 90px;"><?php _e('Links') ?></th>
<table class="form-table">
<tr class="form-field form-required">
<th scope="row" valign="top"><label for="name"><?php _e('Category name') ?></label></th>
- <td><input name="name" id="name" type="text" value="<?php echo $category->name; ?>" size="40" /></td>
+ <td><input name="name" id="name" type="text" value="<?php echo $category->name; ?>" size="40" aria-required="true" /></td>
</tr>
<tr class="form-field">
<th scope="row" valign="top"><label for="slug"><?php _e('Category slug') ?></label></th>
- <td><input name="slug" id="slug" type="text" value="<?php echo $category->slug; ?>" size="40" />
+ <td><input name="slug" id="slug" type="text" value="<?php echo attribute_escape(apply_filters('editable_slug', $category->slug)); ?>" size="40" />
<?php _e('The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></td>
</tr>
<tr class="form-field">
<div id="post-body">
<div id="namediv" class="stuffbox">
-<h3><?php _e('Name') ?></h3>
+<h3><label for="link_name"><?php _e('Name') ?></label></h3>
<div class="inside">
<input type="text" name="link_name" size="30" tabindex="1" value="<?php echo $link->link_name; ?>" id="link_name" /><br />
<?php _e('Example: Nifty blogging software'); ?>
</div>
<div id="addressdiv" class="stuffbox">
-<h3><?php _e('Web Address') ?></h3>
+<h3><label for="link_url"><?php _e('Web Address') ?></label></h3>
<div class="inside">
<input type="text" name="link_url" size="30" tabindex="1" value="<?php echo $link->link_url; ?>" id="link_url" /><br />
<?php _e('Example: <code>http://wordpress.org/</code> — don’t forget the <code>http://</code>'); ?>
</div>
<div id="descriptiondiv" class="stuffbox">
-<h3><?php _e('Description') ?></h3>
+<h3><label for="link_description"><?php _e('Description') ?></label></h3>
<div class="inside">
<input type="text" name="link_description" size="30" tabindex="1" value="<?php echo $link->link_description; ?>" id="link_description" /><br />
<?php _e('This will be shown when someone hovers over the link in the blogroll, or optionally below the link.'); ?>
</div>
</div>
-<div id="linkcategorydiv" class="postbox <?php echo postbox_classes('linkcategorydiv', 'link'); ?>">
-<h3><?php _e('Categories') ?></h3>
-<div class="inside">
-
+<?php function link_categories_meta_box($link) { ?>
<div id="category-adder" class="wp-hidden-children">
<h4><a id="category-add-toggle" href="#category-add"><?php _e( '+ Add New Category' ); ?></a></h4>
<p id="link-category-add" class="wp-hidden-child">
- <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" />
+ <label class="hidden" for="newcat"><?php _e( '+ Add New Category' ); ?></label>
+ <input type="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" aria-required="true" />
<input type="button" id="category-add-sumbit" class="add:categorychecklist:linkcategorydiv button" value="<?php _e( 'Add' ); ?>" />
<?php wp_nonce_field( 'add-link-category', '_ajax_nonce', false ); ?>
<span id="category-ajax-response"></span>
<div id="categories-all" class="ui-tabs-panel">
<ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
- <?php wp_link_category_checklist($link_id); ?>
+ <?php wp_link_category_checklist($link->link_id); ?>
</ul>
</div>
<?php wp_popular_terms_checklist('link_category'); ?>
</ul>
</div>
-
-</div>
-</div>
+<?php
+}
+add_meta_box('linkcategorydiv', __('Categories'), 'link_categories_meta_box', 'link', 'normal', 'core');
+?>
<?php do_meta_boxes('link', 'normal', $link); ?>
<h2><?php _e('Advanced Options'); ?></h2>
-<div id="linktargetdiv" class="postbox <?php echo postbox_classes('linktargetdiv', 'link'); ?>">
-<h3><?php _e('Target') ?></h3>
-<div class="inside">
+<?php function link_target_meta_box($link) { ?>
+<fieldset><legend class="hidden"><?php _e('Target') ?></legend>
<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"' : ''); ?> />
<code>_blank</code></label><br />
<label for="link_target_none" class="selectit">
<input id="link_target_none" type="radio" name="link_target" value="" <?php echo(($link->link_target == '') ? 'checked="checked"' : ''); ?> />
<?php _e('none') ?></label>
+</fieldset>
<p><?php _e('Choose the frame your link targets. Essentially this means if you choose <code>_blank</code> your link will open in a new window.'); ?></p>
-</div>
-</div>
+<?php
+}
+add_meta_box('linktargetdiv', __('Target'), 'link_target_meta_box', 'link', 'advanced', 'core');
-<div id="linkxfndiv" class="postbox <?php echo postbox_classes('linkxfndiv', 'link'); ?>">
-<h3><?php _e('Link Relationship (XFN)') ?></h3>
-<div class="inside">
+function link_xfn_meta_box($link) {
+?>
<table class="editform" style="width: 100%;" cellspacing="2" cellpadding="5">
<tr>
- <th style="width: 20%;" scope="row"><?php _e('rel:') ?></th>
+ <th style="width: 20%;" scope="row"><label for="link_rel"><?php _e('rel:') ?></label></th>
<td style="width: 80%;"><input type="text" name="link_rel" id="link_rel" size="50" value="<?php echo $link->link_rel; ?>" /></td>
</tr>
<tr>
<table cellpadding="3" cellspacing="5" class="form-table">
<tr>
<th scope="row"> <?php _e('identity') ?> </th>
- <td>
+ <td><fieldset><legend class="hidden"> <?php _e('identity') ?> </legend>
<label for="me">
<input type="checkbox" name="identity" value="me" id="me" <?php xfn_check('identity', 'me'); ?> />
<?php _e('another web address of mine') ?></label>
- </td>
+ </fieldset></td>
</tr>
<tr>
<th scope="row"> <?php _e('friendship') ?> </th>
- <td>
+ <td><fieldset><legend class="hidden"> <?php _e('friendship') ?> </legend>
<label for="contact">
<input class="valinp" type="radio" name="friendship" value="contact" id="contact" <?php xfn_check('friendship', 'contact', 'radio'); ?> /> <?php _e('contact') ?></label>
<label for="acquaintance">
<input class="valinp" type="radio" name="friendship" value="friend" id="friend" <?php xfn_check('friendship', 'friend', 'radio'); ?> /> <?php _e('friend') ?></label>
<label for="friendship">
<input name="friendship" type="radio" class="valinp" value="" id="friendship" <?php xfn_check('friendship', '', 'radio'); ?> /> <?php _e('none') ?></label>
- </td>
+ </fieldset></td>
</tr>
<tr>
<th scope="row"> <?php _e('physical') ?> </th>
- <td>
+ <td><fieldset><legend class="hidden"> <?php _e('physical') ?> </legend>
<label for="met">
<input class="valinp" type="checkbox" name="physical" value="met" id="met" <?php xfn_check('physical', 'met'); ?> />
<?php _e('met') ?></label>
- </td>
+ </fieldset></td>
</tr>
<tr>
<th scope="row"> <?php _e('professional') ?> </th>
- <td>
+ <td><fieldset><legend class="hidden"> <?php _e('professional') ?> </legend>
<label for="co-worker">
<input class="valinp" type="checkbox" name="professional" value="co-worker" id="co-worker" <?php xfn_check('professional', 'co-worker'); ?> />
<?php _e('co-worker') ?></label>
<label for="colleague">
<input class="valinp" type="checkbox" name="professional" value="colleague" id="colleague" <?php xfn_check('professional', 'colleague'); ?> />
<?php _e('colleague') ?></label>
- </td>
+ </fieldset></td>
</tr>
<tr>
<th scope="row"> <?php _e('geographical') ?> </th>
- <td>
+ <td><fieldset><legend class="hidden"> <?php _e('geographical') ?> </legend>
<label for="co-resident">
<input class="valinp" type="radio" name="geographical" value="co-resident" id="co-resident" <?php xfn_check('geographical', 'co-resident', 'radio'); ?> />
<?php _e('co-resident') ?></label>
<label for="geographical">
<input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check('geographical', '', 'radio'); ?> />
<?php _e('none') ?></label>
- </td>
+ </fieldset></td>
</tr>
<tr>
<th scope="row"> <?php _e('family') ?> </th>
- <td>
+ <td><fieldset><legend class="hidden"> <?php _e('family') ?> </legend>
<label for="child">
<input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check('family', 'child', 'radio'); ?> />
<?php _e('child') ?></label>
<label for="family">
<input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check('family', '', 'radio'); ?> />
<?php _e('none') ?></label>
- </td>
+ </fieldset></td>
</tr>
<tr>
<th scope="row"> <?php _e('romantic') ?> </th>
- <td>
+ <td><fieldset><legend class="hidden"> <?php _e('romantic') ?> </legend>
<label for="muse">
<input class="valinp" type="checkbox" name="romantic" value="muse" id="muse" <?php xfn_check('romantic', 'muse'); ?> />
<?php _e('muse') ?></label>
<label for="romantic">
<input class="valinp" type="checkbox" name="romantic" value="sweetheart" id="romantic" <?php xfn_check('romantic', 'sweetheart'); ?> />
<?php _e('sweetheart') ?></label>
- </td>
+ </fieldset></td>
</tr>
</table>
</td>
</tr>
</table>
<p><?php _e('If the link is to a person, you can specify your relationship with them using the above form. If you would like to learn more about the idea check out <a href="http://gmpg.org/xfn/">XFN</a>.'); ?></p>
-</div>
-</div>
+<?php
+}
+add_meta_box('linkxfndiv', __('Link Relationship (XFN)'), 'link_xfn_meta_box', 'link', 'advanced', 'core');
-<div id="linkadvanceddiv" class="postbox <?php echo postbox_classes('linkadvanceddiv', 'link'); ?>">
-<h3><?php _e('Advanced') ?></h3>
-<div class="inside">
+function link_advanced_meta_box($link) {
+?>
<table class="form-table" style="width: 100%;" cellspacing="2" cellpadding="5">
<tr class="form-field">
<th valign="top" scope="row"><label for="link_image"><?php _e('Image Address') ?></label></th>
</td>
</tr>
</table>
-</div>
-</div>
+<?php
+}
+add_meta_box('linkadvanceddiv', __('Advanced'), 'link_advanced_meta_box', 'link', 'advanced', 'core');
-<?php do_meta_boxes('link', 'advanced', $link); ?>
+do_meta_boxes('link', 'advanced', $link);
-<?php if ( $link_id ) : ?>
+if ( $link_id ) : ?>
<input type="hidden" name="action" value="save" />
<input type="hidden" name="link_id" value="<?php echo (int) $link_id; ?>" />
<input type="hidden" name="order_by" value="<?php echo attribute_escape($order_by); ?>" />
$messages[2] = __('Custom field updated.');
$messages[3] = __('Custom field deleted.');
$messages[4] = __('Page updated.');
-?>
-<?php if (isset($_GET['message'])) : ?>
-<div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
-<?php endif;
+
+if ( isset($_GET['revision']) )
+ $messages[5] = sprintf( __('Page restored to revision from %s'), wp_post_revision_title( (int) $_GET['revision'], false ) );
+
+$notice = false;
+$notices[1] = __( 'There is an autosave of this page that is more recent than the version below. <a href="%s">View the autosave</a>.' );
if (!isset($post_ID) || 0 == $post_ID) {
$form_action = 'post';
$form_action = 'editpost';
$nonce_action = 'update-page_' . $post_ID;
$form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />";
+ $autosave = wp_get_post_autosave( $post_id );
+ if ( $autosave && mysql2date( 'U', $autosave->post_modified_gmt ) > mysql2date( 'U', $post->post_modified_gmt ) )
+ $notice = sprintf( $notices[1], get_edit_post_link( $autosave->ID ) );
}
$temp_ID = (int) $temp_ID;
$user_ID = (int) $user_ID;
-$sendto = clean_url(stripslashes(wp_get_referer()));
-
-if ( 0 != $post_ID && $sendto == get_permalink($post_ID) )
- $sendto = 'redo';
?>
+<?php if ( $notice ) : ?>
+<div id="notice" class="error"><p><?php echo $notice ?></p></div>
+<?php endif; ?>
+<?php if (isset($_GET['message'])) : ?>
+<div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
+<?php endif; ?>
+
<form name="post" action="page.php" method="post" id="post">
<div class="wrap">
<h2><?php _e('Write Page') ?></h2>
<input type="hidden" id="user-id" name="user_ID" value="<?php echo $user_ID ?>" />
<input type="hidden" id="hiddenaction" name="action" value='<?php echo $form_action ?>' />
<input type="hidden" id="originalaction" name="originalaction" value="<?php echo $form_action ?>" />
+<input type="hidden" id="post_author" name="post_author" value="<?php echo attribute_escape( $post->post_author ); ?>" />
<?php echo $form_extra ?>
<input type="hidden" id="post_type" name="post_type" value="<?php echo $post->post_type ?>" />
<input type="hidden" id="original_post_status" name="original_post_status" value="<?php echo $post->post_status ?>" />
-<input name="referredby" type="hidden" id="referredby" value="<?php
-if ( strpos( wp_get_referer(), '/wp-admin/' ) === false && $post_ID && url_to_postid(wp_get_referer()) === $post_ID )
- echo 'redo';
-else
- echo clean_url(stripslashes(wp_get_referer()));
-?>" />
+<input name="referredby" type="hidden" id="referredby" value="<?php echo clean_url(stripslashes(wp_get_referer())); ?>" />
<?php if ( 'draft' != $post->post_status ) wp_original_referer_field(true, 'previous'); ?>
<div id="poststuff">
</div>
<div class="inside">
-
-<p><strong><?php _e('Publish Status') ?></strong></p>
+<p><strong><label for='post_status'><?php _e('Publish Status') ?></label></strong></p>
<p>
-<select name='post_status' tabindex='4'>
-<?php if ( current_user_can('publish_pages') ) : ?>
+<select name='post_status' tabindex='4' id='post_status'>
+<?php // Show publish in dropdown if user can publish or if they can re-publish this page ('edit_published_pages')
+// 'publish' option will be selected for published AND private posts (checkbox overrides dropdown)
+if ( current_user_can('publish_pages') OR ( $post->post_status == 'publish' AND current_user_can('edit_page', $post->ID) ) ) :
+?>
<option<?php selected( $post->post_status, 'publish' ); selected( $post->post_status, 'private' );?> value='publish'><?php _e('Published') ?></option>
-<?php else: ?>
-<option<?php selected( $post->post_status, 'private' ); ?> value='private'><?php _e('Published') ?></option>
<?php endif; ?>
<?php if ( 'future' == $post->post_status ) : ?>
<option<?php selected( $post->post_status, 'future' ); ?> value='future'><?php _e('Pending') ?></option>
<option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Unpublished') ?></option>
</select>
</p>
+<?php if ( current_user_can( 'publish_posts' ) ) : ?>
+<p id="private-checkbox"><label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="checkbox" value="private" <?php checked($post->post_status, 'private'); ?> tabindex='4' /> <?php _e('Keep this page private') ?></label></p>
+<?php endif; ?>
-<p><label for="post_status_private" class="selectit"><input id="post_status_private" name="post_status" type="checkbox" value="private" <?php checked($post->post_status, 'private'); ?> tabindex='4' /> <?php _e('Keep this page private') ?></label></p>
<?php
if ($post_ID) {
if ( 'future' == $post->post_status ) { // scheduled for publishing at a future date
<br class="clear" />
<?php endif; ?>
<span id="autosave"></span>
+<span id="wp-word-count"></span>
</p>
<div class="side-info">
<div id="post-body">
<div id="titlediv">
-<h3><?php _e('Title') ?></h3>
+<h3><label for="title"><?php _e('Title') ?></label></h3>
<div id="titlewrap">
<input type="text" name="post_title" size="30" tabindex="1" value="<?php echo attribute_escape( $post->post_title ); ?>" id="title" autocomplete="off" />
</div>
</div>
<div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea">
-<h3><?php _e('Page') ?></h3>
+<h3><label for="content"><?php _e('Page') ?></label></h3>
<?php the_editor($post->post_content); ?>
<?php wp_nonce_field( 'autosave', 'autosavenonce', false ); ?>
<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
<h2><?php _e('Advanced Options'); ?></h2>
-<div id="pagepostcustom" class="postbox <?php echo postbox_classes('pagepostcustom', 'page'); ?>">
-<h3><?php _e('Custom Fields') ?></h3>
-<div class="inside">
+
+<?php
+function page_custom_meta_box($post){
+?>
<div id="postcustomstuff">
<table cellpadding="3">
<?php
-$metadata = has_meta($post_ID);
+$metadata = has_meta($post->ID);
list_meta($metadata);
?>
<div id="ajax-response"></div>
</div>
<p><?php _e('Custom fields can be used to add extra metadata to a post that you can <a href="http://codex.wordpress.org/Using_Custom_Fields" target="_blank">use in your theme</a>.'); ?></p>
-</div>
-</div>
+<?php
+}
+add_meta_box('pagecustomdiv', __('Custom Fields'), 'page_custom_meta_box', 'page', 'advanced', 'core');
-<div id="pagecommentstatusdiv" class="postbox <?php echo postbox_classes('pagecommentstatusdiv', 'page'); ?>">
-<h3><?php _e('Comments & Pings') ?></h3>
-<div class="inside">
+function page_comments_status_meta_box($post){
+?>
<input name="advanced_view" type="hidden" value="1" />
<p><label for="comment_status" class="selectit">
<input name="comment_status" type="checkbox" id="comment_status" value="open" <?php checked($post->comment_status, 'open'); ?> />
<?php _e('Allow Comments') ?></label></p>
<p><label for="ping_status" class="selectit"><input name="ping_status" type="checkbox" id="ping_status" value="open" <?php checked($post->ping_status, 'open'); ?> /> <?php _e('Allow Pings') ?></label></p>
<p><?php _e('These settings apply to this page only. “Pings” are <a href="http://codex.wordpress.org/Introduction_to_Blogging#Managing_Comments" target="_blank">trackbacks and pingbacks</a>.'); ?></p>
-</div>
-</div>
+<?php
+}
+add_meta_box('pagecommentstatusdiv', __('Comments & Pings'), 'page_comments_status_meta_box', 'page', 'advanced', 'core');
-<div id="pagepassworddiv" class="postbox <?php echo postbox_classes('pagepassworddiv', 'page'); ?>">
-<h3><?php _e('Password Protect This Page') ?></h3>
-<div class="inside">
-<p><input name="post_password" type="text" size="25" id="post_password" value="<?php echo attribute_escape( $post->post_password ); ?>" /></p>
+function page_password_meta_box($post){
+?>
+<p><label class="hidden" for="post_password"><?php _e('Password Protect This Page') ?></label><input name="post_password" type="text" size="25" id="post_password" value="<?php echo attribute_escape( $post->post_password ); ?>" /></p>
<p><?php _e('Setting a password will require people who visit your blog to enter the above password to view this page and its comments.'); ?></p>
-</div>
-</div>
+<?php
+}
+add_meta_box('pagepassworddiv', __('Password Protect This Page'), 'page_password_meta_box', 'page', 'advanced', 'core');
-<div id="pageslugdiv" class="postbox <?php echo postbox_classes('pageslugdiv', 'page'); ?>">
-<h3><?php _e('Page Slug') ?></h3>
-<div class="inside">
-<input name="post_name" type="text" size="13" id="post_name" value="<?php echo attribute_escape( $post->post_name ); ?>" />
-</div>
-</div>
+function page_slug_meta_box($post){
+?>
+<label class="hidden" for="post_name"><?php _e('Page Slug') ?></label><input name="post_name" type="text" size="13" id="post_name" value="<?php echo attribute_escape( $post->post_name ); ?>" />
+<?php
+}
+add_meta_box('pageslugdiv', __('Page Slug'), 'page_slug_meta_box', 'page', 'advanced', 'core');
-<div id="pageparentdiv" class="postbox <?php echo postbox_classes('pageparentdiv', 'page'); ?>">
-<h3><?php _e('Page Parent') ?></h3>
-<div class="inside">
-<select name="parent_id">
+function page_parent_meta_box($post){
+?>
+<label class="hidden" for="parent_id"><?php _e('Page Parent') ?></label>
+<select name="parent_id" id="parent_id">
<option value='0'><?php _e('Main Page (no parent)'); ?></option>
<?php parent_dropdown($post->post_parent); ?>
</select>
<p><?php _e('You can arrange your pages in hierarchies, for example you could have an “About” page that has “Life Story” and “My Dog” pages under it. There are no limits to how deeply nested you can make pages.'); ?></p>
-</div>
-</div>
+<?php
+}
+add_meta_box('pageparentdiv', __('Page Parent'), 'page_parent_meta_box', 'page', 'advanced', 'core');
-<?php if ( 0 != count( get_page_templates() ) ) { ?>
-<div id="pagetemplatediv" class="postbox <?php echo postbox_classes('pagetemplatediv', 'page'); ?>">
-<h3><?php _e('Page Template') ?></h3>
-<div class="inside">
-<select name="page_template">
+if ( 0 != count( get_page_templates() ) ) {
+ function page_template_meta_box($post){
+?>
+<label class="hidden" for="page_template"><?php _e('Page Template') ?></label><select name="page_template" id="page_template">
<option value='default'><?php _e('Default Template'); ?></option>
<?php page_template_dropdown($post->page_template); ?>
</select>
<p><?php _e('Some themes have custom templates you can use for certain pages that might have additional features or custom layouts. If so, you’ll see them above.'); ?></p>
-</div>
-</div>
-<?php } ?>
+<?php
+ }
+ add_meta_box('pagetemplatediv', __('Page Template'), 'page_template_meta_box', 'page', 'advanced', 'core');
+}
-<div id="pageorderdiv" class="postbox <?php echo postbox_classes('pageorderdiv', 'page'); ?>">
-<h3><?php _e('Page Order') ?></h3>
-<div class="inside">
-<p><input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo $post->menu_order ?>" /></p>
+function page_order_meta_box($post){
+?>
+<p><label class="hidden" for="menu_order"><?php _e('Page Order') ?></label><input name="menu_order" type="text" size="4" id="menu_order" value="<?php echo $post->menu_order ?>" /></p>
<p><?php _e('Pages are usually ordered alphabetically, but you can put a number above to change the order pages appear in. (We know this is a little janky, it’ll be better in future releases.)'); ?></p>
-</div>
-</div>
-
<?php
+}
+add_meta_box('pageorderdiv', __('Page Order'), 'page_order_meta_box', 'page', 'advanced', 'core');
+
+
$authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM
if ( $post->post_author && !in_array($post->post_author, $authors) )
$authors[] = $post->post_author;
-if ( $authors && count( $authors ) > 1 ) :
+if ( $authors && count( $authors ) > 1 ) {
+ function page_author_meta_box($post){
+ global $current_user, $user_ID;
+ $authors = get_editable_user_ids( $current_user->id ); // TODO: ROLE SYSTEM
+ if ( $post->post_author && !in_array($post->post_author, $authors) )
+ $authors[] = $post->post_author;
?>
-<div id="pageauthordiv" class="postbox <?php echo postbox_classes('pageauthordiv', 'page'); ?>">
-<h3><?php _e('Page Author'); ?></h3>
-<div class="inside">
-<?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post_ID) ? $user_ID : $post->post_author) ); ?>
-</div>
-</div>
-<?php endif; ?>
+<label class="hidden" for="post_author_override"><?php _e('Page Author'); ?></label><?php wp_dropdown_users( array('include' => $authors, 'name' => 'post_author_override', 'selected' => empty($post->ID) ? $user_ID : $post->post_author) ); ?>
+<?php
+ }
+ add_meta_box('pageauthordiv', __('Page Author'), 'page_author_meta_box', 'page', 'advanced', 'core');
+}
-<?php do_meta_boxes('page', 'advanced', $post); ?>
+
+if ( isset($post_ID) && 0 < $post_ID && wp_get_post_revisions( $post_ID ) ) :
+function page_revisions_meta_box($post) {
+ wp_list_post_revisions();
+}
+add_meta_box('revisionsdiv', __('Page Revisions'), 'page_revisions_meta_box', 'page', 'advanced', 'core');
+endif;
+
+do_meta_boxes('page', 'advanced', $post);
+?>
</div>
</div>
}
$sendback = wp_get_referer();
- if (strpos($sendback, 'page.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/page-new.php';
- elseif (strpos($sendback, 'attachments.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/attachments.php';
+ if (strpos($sendback, 'page.php') !== false) $sendback = admin_url('page-new.php');
+ elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
$sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
wp_redirect($sendback);
?>
<p id="post-search">
+ <label class="hidden" for="post-search-input"><?php _e( 'Search Pages' ); ?>:</label>
<input type="text" id="post-search-input" name="s" value="<?php echo attribute_escape(stripslashes($_GET['s'])); ?>" />
<input type="submit" value="<?php _e( 'Search Pages' ); ?>" class="button" />
</p>
<div class="tablenav">
+<?php
+$pagenum = absint( $_GET['pagenum'] );
+if ( empty($pagenum) )
+ $pagenum = 1;
+if( !$per_page || $per_page < 0 )
+ $per_page = 20;
+
+$num_pages = ceil(count($posts) / $per_page);
+$page_links = paginate_links( array(
+ 'base' => add_query_arg( 'pagenum', '%#%' ),
+ 'format' => '',
+ 'total' => $num_pages,
+ 'current' => $pagenum
+));
+
+if ( $page_links )
+ echo "<div class='tablenav-pages'>$page_links</div>";
+?>
+
<div class="alignleft">
<input type="submit" value="<?php _e('Delete'); ?>" name="deleteit" class="button-secondary delete" />
<?php wp_nonce_field('bulk-pages'); ?>
</tr>
</thead>
<tbody>
- <?php page_rows($posts); ?>
+ <?php page_rows($posts, $pagenum, $per_page); ?>
</tbody>
</table>
?>
<div class="tablenav">
+<?php
+if ( $page_links )
+ echo "<div class='tablenav-pages'>$page_links</div>";
+?>
<br class="clear" />
</div>
if ( 1 == count($posts) && is_singular() ) :
- $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date");
+ $comments = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved != 'spam' ORDER BY comment_date", $id) );
if ( $comments ) :
// Make sure comments, post, and post_author are cached
update_comment_cache($comments);
<table class="form-table">
<tr class="form-field form-required">
<th scope="row" valign="top"><label for="name"><?php _e('Tag name') ?></label></th>
- <td><input name="name" id="name" type="text" value="<?php echo attribute_escape($tag->name); ?>" size="40" />
+ <td><input name="name" id="name" type="text" value="<?php echo attribute_escape($tag->name); ?>" size="40" aria-required="true" />
<p><?php _e('The name is how the tag appears on your site.'); ?></p></td>
</tr>
<tr class="form-field">
<th scope="row" valign="top"><label for="slug"><?php _e('Tag slug') ?></label></th>
- <td><input name="slug" id="slug" type="text" value="<?php echo attribute_escape($tag->slug); ?>" size="40" />
+ <td><input name="slug" id="slug" type="text" value="<?php echo attribute_escape(apply_filters('editable_slug', $tag->slug)); ?>" size="40" />
<p><?php _e('The “slug” is the URL-friendly version of the name. It is usually all lowercase and contains only letters, numbers, and hyphens.'); ?></p></td>
</tr>
</table>
<?php endif; ?>
<p id="post-search">
+ <label class="hidden" for="post-search-input"><?php _e( 'Search Tags' ); ?>:</label>
<input type="text" id="post-search-input" name="s" value="<?php echo attribute_escape(stripslashes($_GET['s'])); ?>" />
<input type="submit" value="<?php _e( 'Search Tags' ); ?>" class="button" />
</p>
<table class="widefat">
<thead>
<tr>
- <th scope="col" class="check-column"><input type="checkbox" onclick="checkAll(document.getElementById('posts-filter'));" /></th>
+ <th scope="col" class="check-column"><input type="checkbox" /></th>
<th scope="col"><?php _e('Name') ?></th>
<th scope="col" class="num" style="width: 90px"><?php _e('Posts') ?></th>
</tr>
}
$sendback = wp_get_referer();
- if (strpos($sendback, 'post.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/post-new.php';
- elseif (strpos($sendback, 'attachments.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/attachments.php';
+ if (strpos($sendback, 'post.php') !== false) $sendback = admin_url('post-new.php');
+ elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
$sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
wp_redirect($sendback);
?>
<p id="post-search">
+ <label class="hidden" for="post-search-input"><?php _e( 'Search Posts' ); ?>:</label>
<input type="text" id="post-search-input" name="s" value="<?php the_search_query(); ?>" />
<input type="submit" value="<?php _e( 'Search Posts' ); ?>" class="button" />
</p>
if ( 1 == count($posts) && is_singular() ) :
- $comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date");
+ $comments = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved != 'spam' ORDER BY comment_date", $id) );
if ( $comments ) :
// Make sure comments, post, and post_author are cached
update_comment_cache($comments);
<table class="form-table">
<tr>
-<th><?php _e('Restrict Author'); ?></th>
+<th><label for="author"><?php _e('Restrict Author'); ?></label></th>
<td>
-<select name="author">
+<select name="author" id="author">
<option value="all" selected="selected"><?php _e('All Authors'); ?></option>
<?php
$authors = $wpdb->get_col( "SELECT post_author FROM $wpdb->posts GROUP BY post_author" );
--- /dev/null
+<?php
+
+define( 'ABSPATH', dirname(dirname(__FILE__)) );
+define( 'WPINC', '/wp-includes' );
+
+function __() {}
+function add_filter() {}
+function attribute_escape() {}
+function apply_filters() {}
+function get_option() {}
+function is_lighttpd_before_150() {}
+function add_action() {}
+function do_action_ref_array() {}
+function get_bloginfo() {}
+function is_admin() {return true;}
+function site_url() {}
+function admin_url() {}
+function wp_guess_url() {}
+
+require(ABSPATH . '/wp-includes/script-loader.php');
+require(ABSPATH . '/wp-includes/version.php');
+
+$wp_scripts = new WP_Scripts();
+wp_default_scripts($wp_scripts);
+
+$wp_styles = new WP_Styles();
+wp_default_styles($wp_styles);
+
+$defaults = $man_version = '';
+foreach ( $wp_scripts->registered as $script ) {
+ if ( empty($script->src) || strpos($script->src, 'tiny_mce_config.php') ) continue;
+ $ver = empty($script->ver) ? $wp_version : $script->ver;
+ $src = str_replace( array( '/wp-admin/', '/wp-includes/' ), array( '', '../wp-includes/' ), $script->src );
+ $defaults .= '{ "url" : "' . $src . '?ver=' . $ver . '" },' . "\n";
+ $man_version .= $ver;
+}
+
+foreach ( $wp_styles->registered as $style ) {
+ if ( empty($style->src) ) continue;
+
+ $ver = empty($style->ver) ? $wp_version : $style->ver;
+ $src = str_replace( array( '/wp-admin/', '/wp-includes/' ), array( '', '../wp-includes/' ), $style->src );
+ if ( 'colors' == $style->handle ) $src = 'css/colors-classic.css';
+ $defaults .= '{ "url" : "' . $src . '?ver=' . $ver . '" },' . "\n";
+
+ if ( isset($style->extra['rtl']) && $style->extra['rtl'] ) {
+ if ( is_bool( $style->extra['rtl'] ) )
+ $rtl_href = str_replace( '.css', '-rtl.css', $src );
+ else
+ $rtl_href = str_replace( array( '/wp-admin/', '/wp-includes/' ), array( '', '../wp-includes/' ), $style->extra['rtl'] );
+
+ $defaults .= '{ "url" : "' . $rtl_href . '?ver=' . $ver . '" },' . "\n";
+ }
+ $man_version .= $ver;
+}
+
+$man_version = md5($man_version);
+
+header( 'Expires: Wed, 11 Jan 1984 05:00:00 GMT' );
+header( 'Last-Modified: ' . gmdate( 'D, d M Y H:i:s' ) . ' GMT' );
+header( 'Cache-Control: no-cache, must-revalidate, max-age=0' );
+header( 'Pragma: no-cache' );
+header( 'Content-Type: application/x-javascript; charset=UTF-8' );
+?>
+{
+"betaManifestVersion" : 1,
+"version" : "<?php echo $man_version; ?>_20080810",
+"entries" : [
+<?php echo $defaults; ?>
+
+{ "url" : "images/align-center.png" },
+{ "url" : "images/align-left.png" },
+{ "url" : "images/align-none.png" },
+{ "url" : "images/align-right.png" },
+{ "url" : "images/browse-happy.gif" },
+{ "url" : "images/bubble_bg.gif" },
+{ "url" : "images/comment-grey-bubble.png" },
+{ "url" : "images/comment-pill.gif" },
+{ "url" : "images/comment-stalk-classic.gif" },
+{ "url" : "images/comment-stalk-fresh.gif" },
+{ "url" : "images/comment-stalk-rtl.gif" },
+{ "url" : "images/date-button.gif" },
+{ "url" : "images/fade-butt.png" },
+{ "url" : "images/gear.png" },
+{ "url" : "images/logo-ghost.png" },
+{ "url" : "images/logo-login.gif" },
+{ "url" : "images/logo.gif" },
+{ "url" : "images/media-button-gallery.gif" },
+{ "url" : "images/media-button-image.gif" },
+{ "url" : "images/media-button-music.gif" },
+{ "url" : "images/media-button-other.gif" },
+{ "url" : "images/media-button-video.gif" },
+{ "url" : "images/media-buttons.gif" },
+{ "url" : "images/tab.png" },
+{ "url" : "images/tail.gif" },
+{ "url" : "images/toggle-arrow-rtl.gif" },
+{ "url" : "images/toggle-arrow.gif" },
+{ "url" : "images/wordpress-logo.png" },
+{ "url" : "images/xit.gif" },
+{ "url" : "images/loading-publish.gif" },
+{ "url" : "images/loading.gif" },
+{ "url" : "images/required.gif" },
+{ "url" : "images/no.png" },
+{ "url" : "images/yes.png" },
+
+<?php if ( is_file(ABSPATH.'/wp-includes/js/tinymce/tiny_mce.js') ) { ?>
+{ "url" : "../wp-includes/js/tinymce/tiny_mce_popup.js?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/utils/mctabs.js?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/utils/validate.js?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/utils/form_utils.js?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/utils/editable_selects.js?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/plugins/paste/js/pasteword.js?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/plugins/paste/js/pastetext.js?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/plugins/media/js/media.js?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/color_picker.js?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/charmap.js?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/image.js?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/link.js?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/source_editor.js?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/js/anchor.js?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/js/editimage.js?ver=311g" },
+{ "url" : "../wp-includes/js/tinymce/tiny_mce.js?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/editor_template.js?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/editor_plugin.js?ver=311" },
+
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/source_editor.htm?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/anchor.htm?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/image.htm?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/link.htm?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/color_picker.htm?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/charmap.htm?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/plugins/media/media.htm?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/plugins/paste/pasteword.htm?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/plugins/paste/blank.htm?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/plugins/paste/pastetext.htm?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/plugins/fullscreen/fullscreen.htm?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/template.htm?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/editimage.html?ver=311g" },
+{ "url" : "../wp-includes/js/tinymce/wp-mce-help.php?ver=311" },
+
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/ui.css?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/content.css?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/dialog.css?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/window.css?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/plugins/spellchecker/css/content.css?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/css/content.css?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/plugins/media/css/content.css?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/plugins/media/css/media.css?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/plugins/paste/css/pasteword.css?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/plugins/paste/css/blank.css?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/css/editimage.css?ver=311g" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/css/editimage-rtl.css?ver=311" },
+{ "url" : "../wp-includes/js/tinymce/wordpress.css?ver=311" },
+
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/img/icons.gif" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/img/colorpicker.jpg" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/img/fm.gif" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/img/gotmoxie.png" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/img/sflogo.png" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/butt2.png" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/fade-butt.png" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/tabs.gif" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/wp_theme/img/down_arrow.gif" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/default/img/progress.gif" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/default/img/menu_check.gif" },
+{ "url" : "../wp-includes/js/tinymce/themes/advanced/skins/default/img/menu_arrow.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/drag.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/corners.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/buttons.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/horizontal.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/alert.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/button.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/confirm.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/inlinepopups/skins/clearlooks2/img/vertical.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/media/img/flash.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/media/img/flv_player.swf" },
+{ "url" : "../wp-includes/js/tinymce/plugins/media/img/quicktime.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/media/img/realmedia.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/media/img/shockwave.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/media/img/windowsmedia.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/media/img/trans.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/more.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/more_bug.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/page.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/page_bug.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/toolbars.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/img/image.png" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wpeditimage/img/delete.png" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/help.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/image.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/media.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/video.gif" },
+{ "url" : "../wp-includes/js/tinymce/plugins/wordpress/img/audio.gif" },
+<?php } ?>
+
+{ "url" : "../wp-includes/images/crystal/archive.png" },
+{ "url" : "../wp-includes/images/crystal/audio.png" },
+{ "url" : "../wp-includes/images/crystal/code.png" },
+{ "url" : "../wp-includes/images/crystal/default.png" },
+{ "url" : "../wp-includes/images/crystal/document.png" },
+{ "url" : "../wp-includes/images/crystal/interactive.png" },
+{ "url" : "../wp-includes/images/crystal/text.png" },
+{ "url" : "../wp-includes/images/crystal/video.png" },
+{ "url" : "../wp-includes/images/crystal/spreadsheet.png" },
+{ "url" : "../wp-includes/images/rss.png" },
+{ "url" : "../wp-includes/js/thickbox/loadingAnimation.gif" },
+{ "url" : "../wp-includes/js/thickbox/tb-close.png" },
+{ "url" : "../wp-includes/js/swfupload/swfupload_f9.swf" }
+]}
$host = $this->blogs[$importing_blog]['host'];
// Get an array of posts => authors
- $post_ids = (array) $wpdb->get_col("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = 'blogger_blog' AND meta_value = '$host'");
+ $post_ids = (array) $wpdb->get_col( $wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = 'blogger_blog' AND meta_value = %s", $host) );
$post_ids = join( ',', $post_ids );
$results = (array) $wpdb->get_results("SELECT post_id, meta_value FROM $wpdb->postmeta WHERE meta_key = 'blogger_author' AND post_id IN ($post_ids)");
foreach ( $results as $row )
$post_ids = (array) array_keys( $authors_posts, $this->blogs[$importing_blog]['authors'][$author][0] );
$post_ids = join( ',', $post_ids);
- $wpdb->query("UPDATE $wpdb->posts SET post_author = $user_id WHERE id IN ($post_ids)");
+ $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_author = %d WHERE id IN ($post_ids)", $user_id) );
$this->blogs[$importing_blog]['authors'][$author][1] = $user_id;
}
$this->save_vars();
function get_comment_count($post_ID)
{
global $wpdb;
- return $wpdb->get_var('SELECT count(*) FROM '.$wpdb->comments.' WHERE comment_post_ID = '.$post_ID);
+ return $wpdb->get_var( $wpdb->prepare("SELECT count(*) FROM $wpdb->comments WHERE comment_post_ID = %d", $post_ID) );
}
}
function link_exists($linkname)
{
global $wpdb;
- return $wpdb->get_var('SELECT link_id FROM '.$wpdb->links.' WHERE link_name = "'.$linkname.'"');
+ return $wpdb->get_var( $wpdb->prepare("SELECT link_id FROM $wpdb->links WHERE link_name = %s", $linkname) );
}
}
<h3><?php _e('Second step: GreyMatter details:') ?></h3>
<table class="form-table">
<tr>
-<td><?php _e('Path to GM files:') ?></td>
-<td><input type="text" style="width:300px" name="gmpath" value="/home/my/site/cgi-bin/greymatter/" /></td>
+<td><label for="gmpath"><?php _e('Path to GM files:') ?></label></td>
+<td><input type="text" style="width:300px" name="gmpath" id="gmpath" value="/home/my/site/cgi-bin/greymatter/" /></td>
</tr>
<tr>
-<td><?php _e('Path to GM entries:') ?></td>
-<td><input type="text" style="width:300px" name="archivespath" value="/home/my/site/cgi-bin/greymatter/archives/" /></td>
+<td><label for="archivespath"><?php _e('Path to GM entries:') ?></label></td>
+<td><input type="text" style="width:300px" name="archivespath" id="archivespath" value="/home/my/site/cgi-bin/greymatter/archives/" /></td>
</tr>
<tr>
-<td><?php _e("Last entry's number:") ?></td>
-<td><input type="text" name="lastentry" value="00000001" /><br />
+<td><label for="lastentry"><?php _e("Last entry's number:") ?></label></td>
+<td><input type="text" name="lastentry" id="lastentry" value="00000001" /><br />
<?php _e("This importer will search for files 00000001.cgi to 000-whatever.cgi,<br />so you need to enter the number of the last GM post here.<br />(if you don't know that number, just log into your FTP and look it out<br />in the entries' folder)") ?></td>
</tr>
</table>
$j = -1;
foreach ($authors as $author) {
++ $j;
- echo '<li>'.__('Current author:').' <strong>'.$author.'</strong><br />'.sprintf(__('Create user %1$s or map to existing'), ' <input type="text" value="'.$author.'" name="'.'user[]'.'" maxlength="30"> <br />');
+ echo '<li><label>'.__('Current author:').' <strong>'.$author.'</strong><br />'.sprintf(__('Create user %1$s or map to existing'), ' <input type="text" value="'.$author.'" name="'.'user[]'.'" maxlength="30"> <br />');
$this->users_form($j);
- echo '</li>';
+ echo '</label></li>';
}
echo '<input type="submit" value="'.__('Submit').'">'.'<br />';
function select_authors() {
if ( $_POST['upload_type'] === 'ftp' ) {
- $file['file'] = ABSPATH . 'wp-content/mt-export.txt';
+ $file['file'] = WP_CONTENT_DIR . '/mt-export.txt';
if ( !file_exists($file['file']) )
$file['error'] = __('<code>mt-export.txt</code> does not exist');
} else {
function import() {
$this->id = (int) $_GET['id'];
if ( $this->id == 0 )
- $this->file = ABSPATH . 'wp-content/mt-export.txt';
+ $this->file = WP_CONTENT_DIR . '/mt-export.txt';
else
$this->file = get_attached_file($this->id);
$this->get_authors_from_post();
function get_comment_count($post_ID)
{
global $wpdb;
- return $wpdb->get_var('SELECT count(*) FROM '.$wpdb->comments.' WHERE comment_post_ID = '.$post_ID);
+ return $wpdb->get_var( $wpdb->prepare("SELECT count(*) FROM $wpdb->comments WHERE comment_post_ID = %d", $post_ID) );
}
}
function link_exists($linkname)
{
global $wpdb;
- return $wpdb->get_var('SELECT link_id FROM '.$wpdb->links.' WHERE link_name = "'.$wpdb->escape($linkname).'"');
+ return $wpdb->get_var( $wpdb->prepare("SELECT link_id FROM $wpdb->links WHERE link_name = %s", $linkname) );
}
}
$category1 = get_category_by_slug($Category1);
$category1 = $category1->term_id;
$category2 = get_category_by_slug($Category2);
- $category2 = $category1->term_id;
+ $category2 = $category2->term_id;
if($cat1 = $category1) { $cats[1] = $cat1; }
if($cat2 = $category2) { $cats[2] = $cat2; }
function users_form($n, $author) {
if ( $this->allow_create_users() ) {
- printf(__('Create user %1$s or map to existing'), ' <input type="text" value="'.$author.'" name="'.'user_create['.intval($n).']'.'" maxlength="30"> <br />');
+ printf('<label>'.__('Create user %1$s or map to existing'), ' <input type="text" value="'.$author.'" name="'.'user_create['.intval($n).']'.'" maxlength="30"></label> <br />');
}
else {
echo __('Map to existing').'<br />';
$guid = $this->get_tag( $post, 'guid' );
$post_author = $this->get_tag( $post, 'dc:creator' );
+ $post_excerpt = $this->get_tag( $post, 'excerpt:encoded' );
+ $post_excerpt = preg_replace('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $post_excerpt);
+ $post_excerpt = str_replace('<br>', '<br />', $post_excerpt);
+ $post_excerpt = str_replace('<hr>', '<hr />', $post_excerpt);
+
$post_content = $this->get_tag( $post, 'content:encoded' );
$post_content = preg_replace('|<(/?[A-Z]+)|e', "'<' . strtolower('$1')", $post_content);
$post_content = str_replace('<br>', '<br />', $post_content);
$post_author = $this->checkauthor($post_author); //just so that if a post already exists, new users are not created by checkauthor
- $postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_title', 'post_status', 'post_name', 'comment_status', 'ping_status', 'guid', 'post_parent', 'menu_order', 'post_type', 'post_password');
+ $postdata = compact('post_author', 'post_date', 'post_date_gmt', 'post_content', 'post_excerpt', 'post_title', 'post_status', 'post_name', 'comment_status', 'ping_status', 'guid', 'post_parent', 'menu_order', 'post_type', 'post_password');
if ($post_type == 'attachment') {
$remote_url = $this->get_tag( $post, 'wp:attachment_url' );
if ( !$remote_url )
class WP_Categories_to_Tags {
var $categories_to_convert = array();
var $all_categories = array();
+ var $tags_to_convert = array();
+ var $all_tags = array();
+ var $hybrids_ids = array();
function header() {
echo '<div class="wrap">';
- echo '<h2>' . __('Convert Categories to Tags') . '</h2>';
+ if ( ! current_user_can('manage_categories') ) {
+ echo '<div class="narrow">';
+ echo '<p>' . __('Cheatin’ uh?') . '</p>';
+ echo '</div>';
+ } else { ?>
+ <div class="tablenav"><p style="margin:4px"><a style="display:inline;" class="button-secondary" href="admin.php?import=wp-cat2tag"><?php _e( "Categories to Tags" ); ?></a>
+ <a style="display:inline;" class="button-secondary" href="admin.php?import=wp-cat2tag&step=3"><?php _e( "Tags to Categories" ); ?></a></p></div>
+<?php }
}
function footer() {
echo '</div>';
}
- function populate_all_categories() {
- global $wpdb;
+ function populate_cats() {
$categories = get_categories('get=all');
foreach ( $categories as $category ) {
- if ( !tag_exists($wpdb->escape($category->name)) )
- $this->all_categories[] = $category;
+ $this->all_categories[] = $category;
+ if ( is_term( $category->slug, 'post_tag' ) )
+ $this->hybrids_ids[] = $category->term_id;
+ }
+ }
+
+ function populate_tags() {
+
+ $tags = get_terms( array('post_tag'), 'get=all' );
+ foreach ( $tags as $tag ) {
+ $this->all_tags[] = $tag;
+ if ( is_term( $tag->slug, 'category' ) )
+ $this->hybrids_ids[] = $tag->term_id;
}
}
- function welcome() {
- $this->populate_all_categories();
+ function categories_tab() {
+ $this->populate_cats();
+ $cat_num = count($this->all_categories);
- echo '<div class="narrow">';
+ echo '<br class="clear" />';
- if (count($this->all_categories) > 0) {
- echo '<p>' . __('Hey there. Here you can selectively converts existing categories to tags. To get started, check the categories you wish to be converted, then click the Convert button.') . '</p>';
- echo '<p>' . __('Keep in mind that if you convert a category with child categories, the children become top-level orphans.') . '</p>';
+ if ( $cat_num > 0 ) {
+ echo '<h2>' . sprintf( __ngettext( 'Convert Category to Tag.', 'Convert Categories (%d) to Tags.', $cat_num ), $cat_num ) . '</h2>';
+ echo '<div class="narrow">';
+ echo '<p>' . __('Hey there. Here you can selectively convert existing categories to tags. To get started, check the categories you wish to be converted, then click the Convert button.') . '</p>';
+ echo '<p>' . __('Keep in mind that if you convert a category with child categories, the children become top-level orphans.') . '</p></div>';
$this->categories_form();
} else {
echo '<p>'.__('You have no categories to convert!').'</p>';
}
-
- echo '</div>';
}
- function categories_form() {
-?>
+ function categories_form() { ?>
+
<script type="text/javascript">
-<!--
+/* <![CDATA[ */
var checkflag = "false";
function check_all_rows() {
- field = document.formlist;
+ field = document.catlist;
if ( 'false' == checkflag ) {
for ( i = 0; i < field.length; i++ ) {
if ( 'cats_to_convert[]' == field[i].name )
return '<?php _e('Check All') ?>';
}
}
-
-// -->
+/* ]]> */
</script>
-<?php
- echo '<form name="formlist" id="formlist" action="admin.php?import=wp-cat2tag&step=2" method="post">
- <p><input type="button" class="button-secondary" value="' . __('Check All') . '"' . ' onClick="this.value=check_all_rows()"></p>';
- wp_nonce_field('import-cat2tag');
- echo '<ul style="list-style:none">';
- $hier = _get_term_hierarchy('category');
+<form name="catlist" id="catlist" action="admin.php?import=wp-cat2tag&step=2" method="post">
+<p><input type="button" class="button-secondary" value="<?php _e('Check All'); ?>" onclick="this.value=check_all_rows()" />
+<?php wp_nonce_field('import-cat2tag'); ?></p>
+<ul style="list-style:none">
+
+<?php $hier = _get_term_hierarchy('category');
foreach ($this->all_categories as $category) {
$category = sanitize_term( $category, 'category', 'display' );
- if ((int) $category->parent == 0) {
- echo '<li><label><input type="checkbox" name="cats_to_convert[]" value="' . intval($category->term_id) . '" /> ' . $category->name . ' (' . $category->count . ')</label>';
+ if ( (int) $category->parent == 0 ) { ?>
- if (isset($hier[$category->term_id])) {
- $this->_category_children($category, $hier);
- }
+ <li><label><input type="checkbox" name="cats_to_convert[]" value="<?php echo intval($category->term_id); ?>" /> <?php echo $category->name . ' (' . $category->count . ')'; ?></label><?php
- echo '</li>';
- }
- }
+ if ( in_array( intval($category->term_id), $this->hybrids_ids ) )
+ echo ' <a href="#note"> * </a>';
+
+ if ( isset($hier[$category->term_id]) )
+ $this->_category_children($category, $hier); ?></li>
+<?php }
+ } ?>
+</ul>
- echo '</ul>';
+<?php if ( ! empty($this->hybrids_ids) )
+ echo '<p><a name="note"></a>' . __('* This category is also a tag. Converting it will add that tag to all posts that are currently in the category.') . '</p>'; ?>
- echo '<p class="submit"><input type="submit" name="submit" class="button" value="' . __('Convert Tags') . '" /></p>';
+<p class="submit"><input type="submit" name="submit" class="button" value="<?php _e('Convert Categories to Tags'); ?>" /></p>
+</form>
- echo '</form>';
- }
+<?php }
- function _category_children($parent, $hier) {
- echo '<ul style="list-style:none">';
+ function tags_tab() {
+ $this->populate_tags();
+ $tags_num = count($this->all_tags);
- foreach ($hier[$parent->term_id] as $child_id) {
- $child =& get_category($child_id);
+ echo '<br class="clear" />';
- echo '<li><label><input type="checkbox" name="cats_to_convert[]" value="' . intval($child->term_id) . '" /> ' . $child->name . ' (' . $child->count . ')</label>';
+ if ( $tags_num > 0 ) {
+ echo '<h2>' . sprintf( __ngettext( 'Convert Tag to Category.', 'Convert Tags (%d) to Categories.', $tags_num ), $tags_num ) . '</h2>';
+ echo '<div class="narrow">';
+ echo '<p>' . __('Here you can selectively converts existing tags to categories. To get started, check the tags you wish to be converted, then click the Convert button.') . '</p>';
+ echo '<p>' . __('The newly created categories will still be associated with the same posts.') . '</p></div>';
- if (isset($hier[$child->term_id])) {
- $this->_category_children($child, $hier);
- }
+ $this->tags_form();
+ } else {
+ echo '<p>'.__('You have no tags to convert!').'</p>';
+ }
+ }
+
+ function tags_form() { ?>
- echo '</li>';
+<script type="text/javascript">
+/* <![CDATA[ */
+var checktags = "false";
+function check_all_tagrows() {
+ field = document.taglist;
+ if ( 'false' == checktags ) {
+ for ( i = 0; i < field.length; i++ ) {
+ if ( 'tags_to_convert[]' == field[i].name )
+ field[i].checked = true;
}
+ checktags = 'true';
+ return '<?php _e('Uncheck All') ?>';
+ } else {
+ for ( i = 0; i < field.length; i++ ) {
+ if ( 'tags_to_convert[]' == field[i].name )
+ field[i].checked = false;
+ }
+ checktags = 'false';
+ return '<?php _e('Check All') ?>';
+ }
+}
+/* ]]> */
+</script>
- echo '</ul>';
+<form name="taglist" id="taglist" action="admin.php?import=wp-cat2tag&step=4" method="post">
+<p><input type="button" class="button-secondary" value="<?php _e('Check All'); ?>" onclick="this.value=check_all_tagrows()" />
+<?php wp_nonce_field('import-cat2tag'); ?></p>
+<ul style="list-style:none">
+
+<?php foreach ( $this->all_tags as $tag ) { ?>
+ <li><label><input type="checkbox" name="tags_to_convert[]" value="<?php echo intval($tag->term_id); ?>" /> <?php echo attribute_escape($tag->name) . ' (' . $tag->count . ')'; ?></label><?php if ( in_array( intval($tag->term_id), $this->hybrids_ids ) ) echo ' <a href="#note"> * </a>'; ?></li>
+
+<?php } ?>
+</ul>
+
+<?php if ( ! empty($this->hybrids_ids) )
+ echo '<p><a name="note"></a>' . __('* This tag is also a category. When converted, all posts associated with the tag will also be in the category.') . '</p>'; ?>
+
+<p class="submit"><input type="submit" name="submit_tags" class="button" value="<?php _e('Convert Tags to Categories'); ?>" /></p>
+</form>
+
+<?php }
+
+ function _category_children($parent, $hier) { ?>
+
+ <ul style="list-style:none">
+<?php foreach ($hier[$parent->term_id] as $child_id) {
+ $child =& get_category($child_id); ?>
+ <li><label><input type="checkbox" name="cats_to_convert[]" value="<?php echo intval($child->term_id); ?>" /> <?php echo $child->name . ' (' . $child->count . ')'; ?></label><?php
+
+ if ( in_array( intval($child->term_id), $this->hybrids_ids ) )
+ echo ' <a href="#note"> * </a>';
+
+ if ( isset($hier[$child->term_id]) )
+ $this->_category_children($child, $hier); ?></li>
+<?php } ?>
+ </ul><?php
}
function _category_exists($cat_id) {
}
}
- function convert_them() {
+ function convert_categories() {
global $wpdb;
- if ( (!isset($_POST['cats_to_convert']) || !is_array($_POST['cats_to_convert'])) && empty($this->categories_to_convert)) {
- echo '<div class="narrow">';
- echo '<p>' . sprintf(__('Uh, oh. Something didn’t work. Please <a href="%s">try again</a>.'), 'admin.php?import=wp-cat2tag') . '</p>';
- echo '</div>';
- return;
+ if ( (!isset($_POST['cats_to_convert']) || !is_array($_POST['cats_to_convert'])) && empty($this->categories_to_convert)) { ?>
+ <div class="narrow">
+ <p><?php printf(__('Uh, oh. Something didn’t work. Please <a href="%s">try again</a>.'), 'admin.php?import=wp-cat2tag'); ?></p>
+ </div>
+<?php return;
}
-
if ( empty($this->categories_to_convert) )
$this->categories_to_convert = $_POST['cats_to_convert'];
+
$hier = _get_term_hierarchy('category');
+ $hybrid_cats = $clear_parents = $parents = false;
+ $clean_term_cache = $clean_cat_cache = array();
+ $default_cat = get_option('default_category');
echo '<ul>';
foreach ( (array) $this->categories_to_convert as $cat_id) {
$cat_id = (int) $cat_id;
- echo '<li>' . sprintf(__('Converting category #%s ... '), $cat_id);
-
- if (!$this->_category_exists($cat_id)) {
- _e('Category doesn\'t exist!');
+ if ( ! $this->_category_exists($cat_id) ) {
+ echo '<li>' . sprintf( __('Category %s doesn\'t exist!'), $cat_id ) . "</li>\n";
} else {
$category =& get_category($cat_id);
-
- if ( tag_exists($wpdb->escape($category->name)) ) {
- _e('Category is already a tag.');
- echo '</li>';
- continue;
- }
+ echo '<li>' . sprintf(__('Converting category <strong>%s</strong> ... '), $category->name);
// If the category is the default, leave category in place and create tag.
- if ( get_option('default_category') == $category->term_id ) {
- $id = wp_insert_term($category->name, 'post_tag', array('slug' => $category->slug));
+ if ( $default_cat == $category->term_id ) {
+
+ if ( ! ($id = is_term( $category->slug, 'post_tag' ) ) )
+ $id = wp_insert_term($category->name, 'post_tag', array('slug' => $category->slug));
+
$id = $id['term_taxonomy_id'];
$posts = get_objects_in_term($category->term_id, 'category');
+ $term_order = 0;
+
foreach ( $posts as $post ) {
- if ( !$wpdb->get_var("SELECT object_id FROM $wpdb->term_relationships WHERE object_id = '$post' AND term_taxonomy_id = '$id'") )
- $wpdb->query("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id) VALUES ('$post', '$id')");
+ $values[] = $wpdb->prepare( "(%d, %d, %d)", $post, $id, $term_order);
clean_post_cache($post);
}
- } else {
- $tt_ids = $wpdb->get_col("SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE term_id = '{$category->term_id}' AND taxonomy = 'category'");
- if ( $tt_ids ) {
- $posts = $wpdb->get_col("SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id IN (" . join(',', $tt_ids) . ") GROUP BY object_id");
- foreach ( (array) $posts as $post )
- clean_post_cache($post);
+
+ if ( $values ) {
+ $wpdb->query("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id, term_order) VALUES " . join(',', $values) . " ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)");
+
+ $wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET count = %d WHERE term_id = %d AND taxonomy = 'post_tag'", $category->count, $category->term_id) );
+ }
+
+ echo __('Converted successfully.') . "</li>\n";
+ continue;
+ }
+
+ // if tag already exists, add it to all posts in the category
+ if ( $tag_ttid = $wpdb->get_var( $wpdb->prepare("SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE term_id = %d AND taxonomy = 'post_tag'", $category->term_id) ) ) {
+ $objects_ids = get_objects_in_term($category->term_id, 'category');
+ $tag_ttid = (int) $tag_ttid;
+ $term_order = 0;
+
+ foreach ( $objects_ids as $object_id )
+ $values[] = $wpdb->prepare( "(%d, %d, %d)", $object_id, $tag_ttid, $term_order);
+
+ if ( $values ) {
+ $wpdb->query("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id, term_order) VALUES " . join(',', $values) . " ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)");
+
+ $count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $tag_ttid) );
+ $wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET count = %d WHERE term_id = %d AND taxonomy = 'post_tag'", $count, $category->term_id) );
}
+ echo __('Tag added to all posts in this category.') . " *</li>\n";
- // Change the category to a tag.
- $wpdb->query("UPDATE $wpdb->term_taxonomy SET taxonomy = 'post_tag' WHERE term_id = '{$category->term_id}' AND taxonomy = 'category'");
+ $hybrid_cats = true;
+ $clean_term_cache[] = $category->term_id;
+ $clean_cat_cache[] = $category->term_id;
- $terms = $wpdb->get_col("SELECT term_id FROM $wpdb->term_taxonomy WHERE parent = '{$category->term_id}' AND taxonomy = 'category'");
- foreach ( (array) $terms as $term )
- clean_category_cache($term);
+ continue;
+ }
- // Set all parents to 0 (root-level) if their parent was the converted tag
- $wpdb->query("UPDATE $wpdb->term_taxonomy SET parent = 0 WHERE parent = '{$category->term_id}' AND taxonomy = 'category'");
+ $tt_ids = $wpdb->get_col( $wpdb->prepare("SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE term_id = %d AND taxonomy = 'category'", $category->term_id) );
+ if ( $tt_ids ) {
+ $posts = $wpdb->get_col("SELECT object_id FROM $wpdb->term_relationships WHERE term_taxonomy_id IN (" . join(',', $tt_ids) . ") GROUP BY object_id");
+ foreach ( (array) $posts as $post )
+ clean_post_cache($post);
}
- // Clean the cache
- clean_category_cache($category->term_id);
- _e('Converted successfully.');
+ // Change the category to a tag.
+ $wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET taxonomy = 'post_tag' WHERE term_id = %d AND taxonomy = 'category'", $category->term_id) );
+
+ // Set all parents to 0 (root-level) if their parent was the converted tag
+ $parents = $wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET parent = 0 WHERE parent = %d AND taxonomy = 'category'", $category->term_id) );
+
+ if ( $parents ) $clear_parents = true;
+ $clean_cat_cache[] = $category->term_id;
+ echo __('Converted successfully.') . "</li>\n";
}
+ }
+ echo '</ul>';
- echo '</li>';
+ if ( ! empty($clean_term_cache) ) {
+ $clean_term_cache = array_unique(array_values($clean_term_cache));
+ foreach ( $clean_term_cache as $id )
+ wp_cache_delete($id, 'post_tag');
}
- echo '</ul>';
+ if ( ! empty($clean_cat_cache) ) {
+ $clean_cat_cache = array_unique(array_values($clean_cat_cache));
+ foreach ( $clean_cat_cache as $id )
+ wp_cache_delete($id, 'category');
+ }
+
+ if ( $clear_parents ) delete_option('category_children');
+
+ if ( $hybrid_cats )
+ echo '<p>' . sprintf( __('* This category is also a tag. The converter has added that tag to all posts currently in the category. If you want to remove it, please confirm that all tags were added successfully, then delete it from the <a href="%s">Manage Categories</a> page.'), 'categories.php') . '</p>';
echo '<p>' . sprintf( __('We’re all done here, but you can always <a href="%s">convert more</a>.'), 'admin.php?import=wp-cat2tag' ) . '</p>';
}
+ function convert_tags() {
+ global $wpdb;
+
+ if ( (!isset($_POST['tags_to_convert']) || !is_array($_POST['tags_to_convert'])) && empty($this->tags_to_convert)) {
+ echo '<div class="narrow">';
+ echo '<p>' . sprintf(__('Uh, oh. Something didn’t work. Please <a href="%s">try again</a>.'), 'admin.php?import=wp-cat2tag&step=3') . '</p>';
+ echo '</div>';
+ return;
+ }
+
+ if ( empty($this->tags_to_convert) )
+ $this->tags_to_convert = $_POST['tags_to_convert'];
+
+ $hybrid_tags = $clear_parents = false;
+ $clean_cat_cache = $clean_term_cache = array();
+ $default_cat = get_option('default_category');
+ echo '<ul>';
+
+ foreach ( (array) $this->tags_to_convert as $tag_id) {
+ $tag_id = (int) $tag_id;
+
+ if ( $tag = get_term( $tag_id, 'post_tag' ) ) {
+ printf('<li>' . __('Converting tag <strong>%s</strong> ... '), $tag->name);
+
+ if ( $cat_ttid = $wpdb->get_var( $wpdb->prepare("SELECT term_taxonomy_id FROM $wpdb->term_taxonomy WHERE term_id = %d AND taxonomy = 'category'", $tag->term_id) ) ) {
+ $objects_ids = get_objects_in_term($tag->term_id, 'post_tag');
+ $cat_ttid = (int) $cat_ttid;
+ $term_order = 0;
+
+ foreach ( $objects_ids as $object_id ) {
+ $values[] = $wpdb->prepare( "(%d, %d, %d)", $object_id, $cat_ttid, $term_order);
+ clean_post_cache($object_id);
+ }
+
+ if ( $values ) {
+ $wpdb->query("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id, term_order) VALUES " . join(',', $values) . " ON DUPLICATE KEY UPDATE term_order = VALUES(term_order)");
+
+ if ( $default_cat != $tag->term_id ) {
+ $count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $tag->term_id) );
+ $wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET count = %d WHERE term_id = %d AND taxonomy = 'category'", $count, $tag->term_id) );
+ }
+ }
+
+ $hybrid_tags = true;
+ $clean_term_cache[] = $tag->term_id;
+ $clean_cat_cache[] = $tag->term_id;
+ echo __('All posts were added to the category with the same name.') . " *</li>\n";
+
+ continue;
+ }
+
+ // Change the tag to a category.
+ $parent = $wpdb->get_var( $wpdb->prepare("SELECT parent FROM $wpdb->term_taxonomy WHERE term_id = %d AND taxonomy = 'post_tag'", $tag->term_id) );
+ if ( 0 == $parent || (0 < (int) $parent && $this->_category_exists($parent)) ) {
+ $reset_parent = '';
+ $clear_parents = true;
+ } else
+ $reset_parent = ", parent = '0'";
+
+ $wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET taxonomy = 'category' $reset_parent WHERE term_id = %d AND taxonomy = 'post_tag'", $tag->term_id) );
+
+ $clean_term_cache[] = $tag->term_id;
+ $clean_cat_cache[] = $cat['term_id'];
+ echo __('Converted successfully.') . "</li>\n";
+
+ } else {
+ printf( '<li>' . __('Tag #%s doesn\'t exist!') . "</li>\n", $tag_id );
+ }
+ }
+
+ if ( ! empty($clean_term_cache) ) {
+ $clean_term_cache = array_unique(array_values($clean_term_cache));
+ foreach ( $clean_term_cache as $id )
+ wp_cache_delete($id, 'post_tag');
+ }
+
+ if ( ! empty($clean_cat_cache) ) {
+ $clean_cat_cache = array_unique(array_values($clean_cat_cache));
+ foreach ( $clean_cat_cache as $id )
+ wp_cache_delete($id, 'category');
+ }
+
+ if ( $clear_parents ) delete_option('category_children');
+
+ echo '</ul>';
+ if ( $hybrid_tags )
+ echo '<p>' . sprintf( __('* This tag is also a category. The converter has added all posts from it to the category. If you want to remove it, please confirm that all posts were added successfully, then delete it from the <a href="%s">Manage Tags</a> page.'), 'edit-tags.php') . '</p>';
+ echo '<p>' . sprintf( __('We’re all done here, but you can always <a href="%s">convert more</a>.'), 'admin.php?import=wp-cat2tag&step=3' ) . '</p>';
+ }
+
function init() {
$step = (isset($_GET['step'])) ? (int) $_GET['step'] : 1;
$this->header();
- if (!current_user_can('manage_categories')) {
- echo '<div class="narrow">';
- echo '<p>' . __('Cheatin’ uh?') . '</p>';
- echo '</div>';
- } else {
- if ( $step > 1 )
- check_admin_referer('import-cat2tag');
+ if ( current_user_can('manage_categories') ) {
switch ($step) {
case 1 :
- $this->welcome();
+ $this->categories_tab();
break;
case 2 :
- $this->convert_them();
+ check_admin_referer('import-cat2tag');
+ $this->convert_categories();
+ break;
+
+ case 3 :
+ $this->tags_tab();
+ break;
+
+ case 4 :
+ check_admin_referer('import-cat2tag');
+ $this->convert_tags();
break;
}
}
$wp_cat2tag_importer = new WP_Categories_to_Tags();
-register_importer('wp-cat2tag', __('Categories to Tags Converter'), __('Convert existing categories to tags, selectively.'), array(&$wp_cat2tag_importer, 'init'));
+register_importer('wp-cat2tag', __('Categories and Tags Converter'), __('Convert existing categories to tags or tags to categories, selectively.'), array(&$wp_cat2tag_importer, 'init'));
-?>
\ No newline at end of file
+?>
wp_delete_object_term_relationships($link_id, 'link_category');
- $wpdb->query("DELETE FROM $wpdb->links WHERE link_id = '$link_id'");
+ $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->links WHERE link_id = %d", $link_id) );
do_action('deleted_link', $link_id);
$linkdata = wp_parse_args($linkdata, $defaults);
$linkdata = sanitize_bookmark($linkdata, 'db');
- extract($linkdata, EXTR_SKIP);
+ extract(stripslashes_deep($linkdata), EXTR_SKIP);
$update = false;
}
if ( $update ) {
- $wpdb->query("UPDATE $wpdb->links SET link_url='$link_url',
- link_name='$link_name', link_image='$link_image',
- link_target='$link_target',
- link_visible='$link_visible', link_description='$link_description',
- link_rating='$link_rating', link_rel='$link_rel',
- link_notes='$link_notes', link_rss = '$link_rss'
- WHERE link_id='$link_id'");
+ $wpdb->query( $wpdb->prepare("UPDATE $wpdb->links SET link_url = %s,
+ link_name = %s, link_image = %s, link_target = %s,
+ link_visible = %s, link_description = %s, link_rating = %s,
+ link_rel = %s, link_notes = %s, link_rss = %s
+ WHERE link_id = %s", $link_url, $link_name, $link_image, $link_target, $link_visible, $link_description, $link_rating, $link_rel, $link_notes, $link_rss, $link_id) );
} else {
- $wpdb->query("INSERT INTO $wpdb->links (link_url, link_name, link_image, link_target, link_description, link_visible, link_owner, link_rating, link_rel, link_notes, link_rss) VALUES('$link_url','$link_name', '$link_image', '$link_target', '$link_description', '$link_visible', '$link_owner', '$link_rating', '$link_rel', '$link_notes', '$link_rss')");
+ $wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->links (link_url, link_name, link_image, link_target, link_description, link_visible, link_owner, link_rating, link_rel, link_notes, link_rss) VALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)",
+ $link_url,$link_name, $link_image, $link_target, $link_description, $link_visible, $link_owner, $link_rating, $link_rel, $link_notes, $link_rss) );
$link_id = (int) $wpdb->insert_id;
}
--- /dev/null
+<?php
+class WP_Filesystem_Base{
+ var $verbose = false;
+ var $cache = array();
+
+ var $method = '';
+
+ function abspath() {
+ if ( defined('FTP_BASE') && strpos($this->method, 'ftp') !== false )
+ return FTP_BASE;
+ return $this->find_folder(ABSPATH);
+ }
+ function wp_content_dir() {
+ if ( defined('FTP_CONTENT_DIR') && strpos($this->method, 'ftp') !== false )
+ return FTP_CONTENT_DIR;
+ return $this->find_folder(WP_CONTENT_DIR);
+ }
+ function wp_plugins_dir() {
+ if ( defined('FTP_PLUGIN_DIR') && strpos($this->method, 'ftp') !== false )
+ return FTP_PLUGIN_DIR;
+ return $this->find_folder(WP_PLUGIN_DIR);
+ }
+ function wp_themes_dir() {
+ return $this->wp_content_dir() . '/themes';
+ }
+ //Back compat: use abspath() or wp_*_dir
+ function find_base_dir($base = '.', $echo = false) {
+ $this->verbose = $echo;
+ return $this->abspath();
+ }
+ //Back compat: use ::abspath() or ::wp_*_dir
+ function get_base_dir($base = '.', $echo = false) {
+ $this->verbose = $echo;
+ return $this->abspath();
+ }
+
+ function find_folder($folder) {
+ $folder = str_replace('\\', '/', $folder); //Windows Sanitiation
+ if ( isset($this->cache[ $folder ] ) )
+ return $this->cache[ $folder ];
+
+ if ( $this->exists($folder) ) { //Folder exists at that absolute path.
+ $this->cache[ $folder ] = $folder;
+ return $folder;
+ }
+ if( $return = $this->search_for_folder($folder) )
+ $this->cache[ $folder ] = $return;
+ return $return;
+ }
+
+ // Assumes $folder is windows sanitized;
+ // Assumes that the drive letter is safe to be stripped off, Should not be a problem for windows servers.
+ function search_for_folder($folder, $base = '.', $loop = false ) {
+ if ( empty( $base ) || '.' == $base )
+ $base = trailingslashit($this->cwd());
+
+ $folder = preg_replace('|^([a-z]{1}):|i', '', $folder); //Strip out windows driveletter if its there.
+
+ $folder_parts = explode('/', $folder);
+ $last_path = $folder_parts[ count($folder_parts) - 1 ];
+
+ $files = $this->dirlist( $base );
+
+ foreach ( $folder_parts as $key ) {
+ if ( $key == $last_path )
+ continue; //We want this to be caught by the next code block.
+
+ //Working from /home/ to /user/ to /wordpress/ see if that file exists within the current folder,
+ // If its found, change into it and follow through looking for it.
+ // If it cant find WordPress down that route, it'll continue onto the next folder level, and see if that matches, and so on.
+ // If it reaches the end, and still cant find it, it'll return false for the entire function.
+ if( isset($files[ $key ]) ){
+ //Lets try that folder:
+ $newdir = trailingslashit(path_join($base, $key));
+ if( $this->verbose )
+ printf( __('Changing to %s') . '<br/>', $newdir );
+ if( $ret = $this->search_for_folder( $folder, $newdir, $loop) )
+ return $ret;
+ }
+ }
+
+ //Only check this as a last resort, to prevent locating the incorrect install. All above proceeedures will fail quickly if this is the right branch to take.
+ if(isset( $files[ $last_path ] ) ) {
+ if( $this->verbose )
+ printf( __('Found %s') . '<br/>', $base . $last_path );
+ return $base . $last_path;
+ }
+ if( $loop )
+ return false;//Prevent tihs function looping again.
+ //As an extra last resort, Change back to / if the folder wasnt found. This comes into effect when the CWD is /home/user/ but WP is at /var/www/.... mainly dedicated setups.
+ return $this->search_for_folder($folder, '/', true);
+
+ }
+
+ //Common Helper functions.
+ function gethchmod($file){
+ //From the PHP.net page for ...?
+ $perms = $this->getchmod($file);
+ if (($perms & 0xC000) == 0xC000) // Socket
+ $info = 's';
+ elseif (($perms & 0xA000) == 0xA000) // Symbolic Link
+ $info = 'l';
+ elseif (($perms & 0x8000) == 0x8000) // Regular
+ $info = '-';
+ elseif (($perms & 0x6000) == 0x6000) // Block special
+ $info = 'b';
+ elseif (($perms & 0x4000) == 0x4000) // Directory
+ $info = 'd';
+ elseif (($perms & 0x2000) == 0x2000) // Character special
+ $info = 'c';
+ elseif (($perms & 0x1000) == 0x1000)// FIFO pipe
+ $info = 'p';
+ else // Unknown
+ $info = 'u';
+
+ // Owner
+ $info .= (($perms & 0x0100) ? 'r' : '-');
+ $info .= (($perms & 0x0080) ? 'w' : '-');
+ $info .= (($perms & 0x0040) ?
+ (($perms & 0x0800) ? 's' : 'x' ) :
+ (($perms & 0x0800) ? 'S' : '-'));
+
+ // Group
+ $info .= (($perms & 0x0020) ? 'r' : '-');
+ $info .= (($perms & 0x0010) ? 'w' : '-');
+ $info .= (($perms & 0x0008) ?
+ (($perms & 0x0400) ? 's' : 'x' ) :
+ (($perms & 0x0400) ? 'S' : '-'));
+
+ // World
+ $info .= (($perms & 0x0004) ? 'r' : '-');
+ $info .= (($perms & 0x0002) ? 'w' : '-');
+ $info .= (($perms & 0x0001) ?
+ (($perms & 0x0200) ? 't' : 'x' ) :
+ (($perms & 0x0200) ? 'T' : '-'));
+ return $info;
+ }
+ function getnumchmodfromh($mode) {
+ $realmode = "";
+ $legal = array("", "w", "r", "x", "-");
+ $attarray = preg_split("//", $mode);
+
+ for($i=0; $i < count($attarray); $i++)
+ if($key = array_search($attarray[$i], $legal))
+ $realmode .= $legal[$key];
+
+ $mode = str_pad($realmode, 9, '-');
+ $trans = array('-'=>'0', 'r'=>'4', 'w'=>'2', 'x'=>'1');
+ $mode = strtr($mode,$trans);
+
+ $newmode = '';
+ $newmode .= $mode[0] + $mode[1] + $mode[2];
+ $newmode .= $mode[3] + $mode[4] + $mode[5];
+ $newmode .= $mode[6] + $mode[7] + $mode[8];
+ return $newmode;
+ }
+}
+?>
<?php
-class WP_Filesystem_Direct{
+class WP_Filesystem_Direct extends WP_Filesystem_Base {
var $permission = null;
var $errors = array();
- function WP_Filesystem_Direct($arg){
+ function WP_Filesystem_Direct($arg) {
+ $this->method = 'direct';
$this->errors = new WP_Error();
$this->permission = umask();
}
- function connect(){
+ function connect() {
return true;
}
- function setDefaultPermissions($perm){
+ function setDefaultPermissions($perm) {
$this->permission = $perm;
}
- function find_base_dir($base = '.', $echo = false){
- return str_replace('\\','/',ABSPATH);
- }
- function get_base_dir($base = '.', $echo = false){
- return $this->find_base_dir($base, $echo);
- }
- function get_contents($file){
+ function get_contents($file) {
return @file_get_contents($file);
}
- function get_contents_array($file){
+ function get_contents_array($file) {
return @file($file);
}
- function put_contents($file,$contents,$mode=false,$type=''){
- if ( ! ($fp = @fopen($file,'w'.$type)) )
+ function put_contents($file, $contents, $mode = false, $type = '') {
+ if ( ! ($fp = @fopen($file, 'w' . $type)) )
return false;
- @fwrite($fp,$contents);
+ @fwrite($fp, $contents);
@fclose($fp);
$this->chmod($file,$mode);
return true;
}
- function cwd(){
+ function cwd() {
return @getcwd();
}
- function chdir($dir){
+ function chdir($dir) {
return @chdir($dir);
}
- function chgrp($file,$group,$recursive=false){
+ function chgrp($file, $group, $recursive = false) {
if( ! $this->exists($file) )
return false;
if( ! $recursive )
- return @chgrp($file,$group);
+ return @chgrp($file, $group);
if( ! $this->is_dir($file) )
- return @chgrp($file,$group);
+ return @chgrp($file, $group);
//Is a directory, and we want recursive
$file = trailingslashit($file);
$filelist = $this->dirlist($file);
return true;
}
- function chmod($file,$mode=false,$recursive=false){
+ function chmod($file, $mode = false, $recursive = false) {
if( ! $mode )
$mode = $this->permission;
if( ! $this->exists($file) )
if( ! $recursive )
return @chmod($file,$mode);
if( ! $this->is_dir($file) )
- return @chmod($file,$mode);
+ return @chmod($file, $mode);
//Is a directory, and we want recursive
$file = trailingslashit($file);
$filelist = $this->dirlist($file);
return true;
}
- function chown($file,$owner,$recursive=false){
+ function chown($file, $owner, $recursive = false) {
if( ! $this->exists($file) )
return false;
if( ! $recursive )
- return @chown($file,$owner);
+ return @chown($file, $owner);
if( ! $this->is_dir($file) )
- return @chown($file,$owner);
+ return @chown($file, $owner);
//Is a directory, and we want recursive
$filelist = $this->dirlist($file);
foreach($filelist as $filename){
- $this->chown($file.'/'.$filename,$owner,$recursive);
+ $this->chown($file . '/' . $filename, $owner, $recursive);
}
return true;
}
- function owner($file){
+ function owner($file) {
$owneruid = @fileowner($file);
if( ! $owneruid )
return false;
- if( !function_exists('posix_getpwuid') )
+ if( ! function_exists('posix_getpwuid') )
return $owneruid;
$ownerarray = posix_getpwuid($owneruid);
return $ownerarray['name'];
}
- function getchmod($file){
+ function getchmod($file) {
return @fileperms($file);
}
- function gethchmod($file){
- //From the PHP.net page for ...?
- $perms = $this->getchmod($file);
- if (($perms & 0xC000) == 0xC000) {
- // Socket
- $info = 's';
- } elseif (($perms & 0xA000) == 0xA000) {
- // Symbolic Link
- $info = 'l';
- } elseif (($perms & 0x8000) == 0x8000) {
- // Regular
- $info = '-';
- } elseif (($perms & 0x6000) == 0x6000) {
- // Block special
- $info = 'b';
- } elseif (($perms & 0x4000) == 0x4000) {
- // Directory
- $info = 'd';
- } elseif (($perms & 0x2000) == 0x2000) {
- // Character special
- $info = 'c';
- } elseif (($perms & 0x1000) == 0x1000) {
- // FIFO pipe
- $info = 'p';
- } else {
- // Unknown
- $info = 'u';
- }
-
- // Owner
- $info .= (($perms & 0x0100) ? 'r' : '-');
- $info .= (($perms & 0x0080) ? 'w' : '-');
- $info .= (($perms & 0x0040) ?
- (($perms & 0x0800) ? 's' : 'x' ) :
- (($perms & 0x0800) ? 'S' : '-'));
-
- // Group
- $info .= (($perms & 0x0020) ? 'r' : '-');
- $info .= (($perms & 0x0010) ? 'w' : '-');
- $info .= (($perms & 0x0008) ?
- (($perms & 0x0400) ? 's' : 'x' ) :
- (($perms & 0x0400) ? 'S' : '-'));
-
- // World
- $info .= (($perms & 0x0004) ? 'r' : '-');
- $info .= (($perms & 0x0002) ? 'w' : '-');
- $info .= (($perms & 0x0001) ?
- (($perms & 0x0200) ? 't' : 'x' ) :
- (($perms & 0x0200) ? 'T' : '-'));
- return $info;
- }
- function getnumchmodfromh($mode) {
- $realmode = "";
- $legal = array("","w","r","x","-");
- $attarray = preg_split("//",$mode);
- for($i=0;$i<count($attarray);$i++){
- if($key = array_search($attarray[$i],$legal)){
- $realmode .= $legal[$key];
- }
- }
- $mode = str_pad($realmode,9,'-');
- $trans = array('-'=>'0','r'=>'4','w'=>'2','x'=>'1');
- $mode = strtr($mode,$trans);
- $newmode = '';
- $newmode .= $mode[0]+$mode[1]+$mode[2];
- $newmode .= $mode[3]+$mode[4]+$mode[5];
- $newmode .= $mode[6]+$mode[7]+$mode[8];
- return $newmode;
- }
- function group($file){
+ function group($file) {
$gid = @filegroup($file);
if( ! $gid )
return false;
- if( !function_exists('posix_getgrgid') )
+ if( ! function_exists('posix_getgrgid') )
return $gid;
$grouparray = posix_getgrgid($gid);
return $grouparray['name'];
}
- function copy($source,$destination,$overwrite=false){
+ function copy($source, $destination, $overwrite = false) {
if( ! $overwrite && $this->exists($destination) )
return false;
- return copy($source,$destination);
+ return copy($source, $destination);
}
- function move($source,$destination,$overwrite=false){
+ function move($source, $destination, $overwrite = false) {
//Possible to use rename()?
- if( $this->copy($source,$destination,$overwrite) && $this->exists($destination) ){
+ if( $this->copy($source, $destination, $overwrite) && $this->exists($destination) ){
$this->delete($source);
return true;
} else {
}
}
- function delete($file, $recursive=false){
- $file = str_replace('\\','/',$file); //for win32, occasional problems deleteing files otherwise
+ function delete($file, $recursive = false) {
+ $file = str_replace('\\', '/', $file); //for win32, occasional problems deleteing files otherwise
if( $this->is_file($file) )
return @unlink($file);
- if( !$recursive && $this->is_dir($file) )
+ if( ! $recursive && $this->is_dir($file) )
return @rmdir($file);
//At this point its a folder, and we're in recursive mode
$retval = true;
if( is_array($filelist) ) //false if no files, So check first.
- foreach($filelist as $filename=>$fileinfo)
+ foreach($filelist as $filename => $fileinfo)
if( ! $this->delete($file . $filename, $recursive) )
$retval = false;
return $retval;
}
- function exists($file){
+ function exists($file) {
return @file_exists($file);
}
- function is_file($file){
+ function is_file($file) {
return @is_file($file);
}
- function is_dir($path){
+ function is_dir($path) {
return @is_dir($path);
}
- function is_readable($file){
+ function is_readable($file) {
return @is_readable($file);
}
- function is_writable($file){
+ function is_writable($file) {
return @is_writable($file);
}
- function atime($file){
+ function atime($file) {
return @fileatime($file);
}
- function mtime($file){
+ function mtime($file) {
return @filemtime($file);
}
- function size($file){
+ function size($file) {
return @filesize($file);
}
$time = time();
if($atime == 0)
$atime = time();
- return @touch($file,$time,$atime);
+ return @touch($file, $time, $atime);
}
function mkdir($path, $chmod = false, $chown = false, $chgrp = false){
if( ! $chmod)
$chmod = $this->permission;
- if( !@mkdir($path,$chmod) )
+ if( ! @mkdir($path, $chmod) )
return false;
if( $chown )
- $this->chown($path,$chown);
+ $this->chown($path, $chown);
if( $chgrp )
- $this->chgrp($path,$chgrp);
+ $this->chgrp($path, $chgrp);
return true;
}
- function rmdir($path,$recursive=false){
+ function rmdir($path, $recursive = false) {
//Currently unused and untested, Use delete() instead.
if( ! $recursive )
return @rmdir($path);
//recursive:
$filelist = $this->dirlist($path);
- foreach($filelist as $filename=>$det){
- if ( '/' == substr($filename,-1,1) )
- $this->rmdir($path.'/'.$filename,$recursive);
+ foreach($filelist as $filename => $det) {
+ if ( '/' == substr($filename, -1, 1) )
+ $this->rmdir($path . '/' . $filename, $recursive);
@rmdir($filename);
}
return @rmdir($path);
}
- function dirlist($path,$incdot=false,$recursive=false){
- if( $this->is_file($path) ){
+ function dirlist($path, $incdot = false, $recursive = false) {
+ if( $this->is_file($path) ) {
$limitFile = basename($path);
$path = dirname($path);
} else {
$ret = array();
$dir = dir($path);
- while (false !== ($entry = $dir->read())) {
+ while (false !== ($entry = $dir->read()) ) {
$struc = array();
- $struc['name'] = $entry;
+ $struc['name'] = $entry;
if( '.' == $struc['name'] || '..' == $struc['name'] )
continue; //Do not care about these folders.
$struc['time'] = date('h:i:s',$struc['lastmodunix']);
$struc['type'] = $this->is_dir($path.'/'.$entry) ? 'd' : 'f';
- if ('d' == $struc['type'] ){
+ if ( 'd' == $struc['type'] ) {
if( $recursive )
- $struc['files'] = $this->dirlist($path.'/'.$struc['name'], $incdot, $recursive);
+ $struc['files'] = $this->dirlist($path . '/' . $struc['name'], $incdot, $recursive);
else
$struc['files'] = array();
}
unset($dir);
return $ret;
}
-
- function __destruct(){
- return;
- }
}
?>
<?php
-class WP_Filesystem_FTPext{
+class WP_Filesystem_FTPext extends WP_Filesystem_Base{
var $link;
var $timeout = 5;
var $errors = array();
var $options = array();
- var $wp_base = '';
var $permission = null;
var $filetypes = array(
);
function WP_Filesystem_FTPext($opt='') {
+ $this->method = 'ftpext';
$this->errors = new WP_Error();
//Check if possible to use ftp functions.
$this->options['ssl'] = ( !empty($opt['ssl']) );
}
- function connect(){
- if ( $this->options['ssl'] && function_exists('ftp_ssl_connect') ) {
+ function connect() {
+ if ( $this->options['ssl'] && function_exists('ftp_ssl_connect') )
$this->link = @ftp_ssl_connect($this->options['hostname'], $this->options['port'],$this->timeout);
- } else {
+ else
$this->link = @ftp_connect($this->options['hostname'], $this->options['port'],$this->timeout);
- }
if ( ! $this->link ) {
$this->errors->add('connect', sprintf(__('Failed to connect to FTP Server %1$s:%2$s'), $this->options['hostname'], $this->options['port']));
return true;
}
- function setDefaultPermissions($perm){
+ function setDefaultPermissions($perm) {
$this->permission = $perm;
}
-
- function find_base_dir($base = '.',$echo = false, $loop = false) {
- //Sanitize the Windows path formats, This allows easier conparison and aligns it to FTP output.
- $abspath = str_replace('\\','/',ABSPATH); //windows: Straighten up the paths..
- if( strpos($abspath, ':') ){ //Windows, Strip out the driveletter
- if( preg_match("|.{1}\:(.+)|i", $abspath, $mat) )
- $abspath = $mat[1];
- }
- //Set up the base directory (Which unless specified, is the current one)
- if( empty( $base ) || '.' == $base ) $base = $this->cwd();
- $base = trailingslashit($base);
-
- //Can we see the Current directory as part of the ABSPATH?
- $location = strpos($abspath, $base);
- if( false !== $location ) {
- $newbase = path_join($base, substr($abspath, $location + strlen($base)));
-
- if( false !== $this->chdir($newbase) ){ //chdir sometimes returns null under certain circumstances, even when its changed correctly, FALSE will be returned if it doesnt change correctly.
- if($echo) printf( __('Changing to %s') . '<br/>', $newbase );
- //Check to see if it exists in that folder.
- if( $this->exists($newbase . 'wp-settings.php') ){
- if($echo) printf( __('Found %s'), $newbase . 'wp-settings.php<br/>' );
- return $newbase;
- }
- }
- }
-
- //Ok, Couldnt do a magic location from that particular folder level
-
- //Get a list of the files in the current directory, See if we can locate where we are in the folder stucture.
- $files = $this->dirlist($base);
-
- $arrPath = explode('/', $abspath);
- foreach($arrPath as $key){
- //Working from /home/ to /user/ to /wordpress/ see if that file exists within the current folder,
- // If its found, change into it and follow through looking for it.
- // If it cant find WordPress down that route, it'll continue onto the next folder level, and see if that matches, and so on.
- // If it reaches the end, and still cant find it, it'll return false for the entire function.
- if( isset($files[ $key ]) ){
- //Lets try that folder:
- $folder = path_join($base, $key);
- if($echo) printf( __('Changing to %s') . '<br/>', $folder );
- $ret = $this->find_base_dir( $folder, $echo, $loop);
- if( $ret )
- return $ret;
- }
- }
- //Only check this as a last resort, to prevent locating the incorrect install. All above proceeedures will fail quickly if this is the right branch to take.
- if(isset( $files[ 'wp-settings.php' ]) ){
- if($echo) printf( __('Found %s'), $base . 'wp-settings.php<br/>' );
- return $base;
- }
- if( $loop )
- return false;//Prevent tihs function looping again.
- //As an extra last resort, Change back to / if the folder wasnt found. This comes into effect when the CWD is /home/user/ but WP is at /var/www/.... mainly dedicated setups.
- return $this->find_base_dir('/', $echo, true);
- }
-
- function get_base_dir($base = '.', $echo = false){
- if( defined('FTP_BASE') )
- $this->wp_base = FTP_BASE;
- if( empty($this->wp_base) )
- $this->wp_base = $this->find_base_dir($base,$echo);
- return $this->wp_base;
- }
- function get_contents($file,$type='',$resumepos=0){
+ function get_contents($file, $type = '', $resumepos = 0 ){
if( empty($type) ){
$extension = substr(strrchr($file, "."), 1);
$type = isset($this->filetypes[ $extension ]) ? $this->filetypes[ $extension ] : FTP_ASCII;
$temp = tmpfile();
if ( ! $temp )
return false;
- if( ! @ftp_fget($this->link,$temp,$file,$type,$resumepos) )
+ if( ! @ftp_fget($this->link, $temp, $file, $type, $resumepos) )
return false;
fseek($temp, 0); //Skip back to the start of the file being written to
$contents = '';
fclose($temp);
return $contents;
}
- function get_contents_array($file){
- return explode("\n",$this->get_contents($file));
+ function get_contents_array($file) {
+ return explode("\n", $this->get_contents($file));
}
- function put_contents($file,$contents,$type=''){
- if( empty($type) ){
+ function put_contents($file, $contents, $type = '' ) {
+ if( empty($type) ) {
$extension = substr(strrchr($file, "."), 1);
$type = isset($this->filetypes[ $extension ]) ? $this->filetypes[ $extension ] : FTP_ASCII;
}
$temp = tmpfile();
if ( ! $temp )
return false;
- fwrite($temp,$contents);
+ fwrite($temp, $contents);
fseek($temp, 0); //Skip back to the start of the file being written to
- $ret = @ftp_fput($this->link,$file,$temp,$type);
+ $ret = @ftp_fput($this->link, $file, $temp, $type);
fclose($temp);
return $ret;
}
- function cwd(){
+ function cwd() {
$cwd = ftp_pwd($this->link);
if( $cwd )
$cwd = trailingslashit($cwd);
return $cwd;
}
- function chdir($dir){
+ function chdir($dir) {
return @ftp_chdir($dir);
}
- function chgrp($file,$group,$recursive=false){
+ function chgrp($file, $group, $recursive = false ) {
return false;
}
- function chmod($file,$mode=false,$recursive=false){
+ function chmod($file, $mode = false, $recursive = false) {
if( ! $mode )
$mode = $this->permission;
if( ! $mode )
return false;
if ( ! $this->exists($file) )
return false;
- if ( ! $recursive || ! $this->is_dir($file) ){
- if (!function_exists('ftp_chmod'))
+ if ( ! $recursive || ! $this->is_dir($file) ) {
+ if ( ! function_exists('ftp_chmod') )
return @ftp_site($this->link, sprintf('CHMOD %o %s', $mode, $file));
- return @ftp_chmod($this->link,$mode,$file);
+ return @ftp_chmod($this->link, $mode, $file);
}
//Is a directory, and we want recursive
$filelist = $this->dirlist($file);
foreach($filelist as $filename){
- $this->chmod($file.'/'.$filename,$mode,$recursive);
+ $this->chmod($file . '/' . $filename, $mode, $recursive);
}
return true;
}
- function chown($file,$owner,$recursive=false){
+ function chown($file, $owner, $recursive = false ) {
return false;
}
- function owner($file){
+ function owner($file) {
$dir = $this->dirlist($file);
return $dir[$file]['owner'];
}
- function getchmod($file){
+ function getchmod($file) {
$dir = $this->dirlist($file);
return $dir[$file]['permsn'];
}
- function gethchmod($file){
- //From the PHP.net page for ...?
- $perms = $this->getchmod($file);
- if (($perms & 0xC000) == 0xC000) {
- // Socket
- $info = 's';
- } elseif (($perms & 0xA000) == 0xA000) {
- // Symbolic Link
- $info = 'l';
- } elseif (($perms & 0x8000) == 0x8000) {
- // Regular
- $info = '-';
- } elseif (($perms & 0x6000) == 0x6000) {
- // Block special
- $info = 'b';
- } elseif (($perms & 0x4000) == 0x4000) {
- // Directory
- $info = 'd';
- } elseif (($perms & 0x2000) == 0x2000) {
- // Character special
- $info = 'c';
- } elseif (($perms & 0x1000) == 0x1000) {
- // FIFO pipe
- $info = 'p';
- } else {
- // Unknown
- $info = 'u';
- }
-
- // Owner
- $info .= (($perms & 0x0100) ? 'r' : '-');
- $info .= (($perms & 0x0080) ? 'w' : '-');
- $info .= (($perms & 0x0040) ?
- (($perms & 0x0800) ? 's' : 'x' ) :
- (($perms & 0x0800) ? 'S' : '-'));
-
- // Group
- $info .= (($perms & 0x0020) ? 'r' : '-');
- $info .= (($perms & 0x0010) ? 'w' : '-');
- $info .= (($perms & 0x0008) ?
- (($perms & 0x0400) ? 's' : 'x' ) :
- (($perms & 0x0400) ? 'S' : '-'));
-
- // World
- $info .= (($perms & 0x0004) ? 'r' : '-');
- $info .= (($perms & 0x0002) ? 'w' : '-');
- $info .= (($perms & 0x0001) ?
- (($perms & 0x0200) ? 't' : 'x' ) :
- (($perms & 0x0200) ? 'T' : '-'));
- return $info;
- }
- function getnumchmodfromh($mode) {
- $realmode = "";
- $legal = array("","w","r","x","-");
- $attarray = preg_split("//",$mode);
- for($i=0;$i<count($attarray);$i++){
- if($key = array_search($attarray[$i],$legal)){
- $realmode .= $legal[$key];
- }
- }
- $mode = str_pad($realmode,9,'-');
- $trans = array('-'=>'0','r'=>'4','w'=>'2','x'=>'1');
- $mode = strtr($mode,$trans);
- $newmode = '';
- $newmode .= $mode[0]+$mode[1]+$mode[2];
- $newmode .= $mode[3]+$mode[4]+$mode[5];
- $newmode .= $mode[6]+$mode[7]+$mode[8];
- return $newmode;
- }
- function group($file){
+ function group($file) {
$dir = $this->dirlist($file);
return $dir[$file]['group'];
}
- function copy($source,$destination,$overwrite=false){
+ function copy($source, $destination, $overwrite = false ) {
if( ! $overwrite && $this->exists($destination) )
return false;
$content = $this->get_contents($source);
if( false === $content)
return false;
- return $this->put_contents($destination,$content);
+ return $this->put_contents($destination, $content);
}
- function move($source,$destination,$overwrite=false){
- return ftp_rename($this->link,$source,$destination);
+ function move($source, $destination, $overwrite = false) {
+ return ftp_rename($this->link, $source, $destination);
}
function delete($file,$recursive=false) {
if ( $this->is_file($file) )
- return @ftp_delete($this->link,$file);
+ return @ftp_delete($this->link, $file);
if ( !$recursive )
- return @ftp_rmdir($this->link,$file);
+ return @ftp_rmdir($this->link, $file);
$filelist = $this->dirlist($file);
foreach ((array) $filelist as $filename => $fileinfo) {
- $this->delete($file.'/'.$filename,$recursive);
+ $this->delete($file . '/' . $filename, $recursive);
}
- return @ftp_rmdir($this->link,$file);
+ return @ftp_rmdir($this->link, $file);
}
- function exists($file){
- $list = ftp_rawlist($this->link,$file,false);
+ function exists($file) {
+ $list = ftp_rawlist($this->link, $file, false);
if( ! $list )
return false;
return count($list) == 1 ? true : false;
}
- function is_file($file){
+ function is_file($file) {
return $this->is_dir($file) ? false : true;
}
- function is_dir($path){
+ function is_dir($path) {
$cwd = $this->cwd();
$result = @ftp_chdir($this->link, $path);
- if( $result && $path == $this->cwd() ||
- $this->cwd() != $cwd ) {
+ if( $result && $path == $this->cwd() || $this->cwd() != $cwd ) {
@ftp_chdir($this->link, $cwd);
return true;
}
return false;
}
- function is_readable($file){
+ function is_readable($file) {
//Get dir list, Check if the file is writable by the current user??
return true;
}
- function is_writable($file){
+ function is_writable($file) {
//Get dir list, Check if the file is writable by the current user??
return true;
}
- function atime($file){
+ function atime($file) {
return false;
}
- function mtime($file){
+ function mtime($file) {
return ftp_mdtm($this->link, $file);
}
- function size($file){
+ function size($file) {
return ftp_size($this->link, $file);
}
- function touch($file,$time=0,$atime=0){
+ function touch($file, $time = 0, $atime = 0) {
return false;
}
- function mkdir($path,$chmod=false,$chown=false,$chgrp=false){
+ function mkdir($path, $chmod = false, $chown = false, $chgrp = false) {
if( !@ftp_mkdir($this->link, $path) )
return false;
if( $chmod )
$this->chgrp($path, $chgrp);
return true;
}
- function rmdir($path,$recursive=false){
+ function rmdir($path, $recursive = false) {
if( ! $recursive )
return @ftp_rmdir($this->link, $path);
function parselisting($line) {
$is_windows = ($this->OS_remote == FTP_OS_Windows);
- if ($is_windows && preg_match("/([0-9]{2})-([0-9]{2})-([0-9]{2}) +([0-9]{2}):([0-9]{2})(AM|PM) +([0-9]+|<DIR>) +(.+)/",$line,$lucifer)) {
+ if ($is_windows && preg_match("/([0-9]{2})-([0-9]{2})-([0-9]{2}) +([0-9]{2}):([0-9]{2})(AM|PM) +([0-9]+|<DIR>) +(.+)/", $line, $lucifer)) {
$b = array();
- if ($lucifer[3]<70) { $lucifer[3]+=2000; } else { $lucifer[3]+=1900; } // 4digit year fix
+ if ($lucifer[3]<70) { $lucifer[3] +=2000; } else { $lucifer[3]+=1900; } // 4digit year fix
$b['isdir'] = ($lucifer[7]=="<DIR>");
if ( $b['isdir'] )
$b['type'] = 'd';
return $b;
}
- function dirlist($path='.',$incdot=false,$recursive=false){
- if( $this->is_file($path) ){
+ function dirlist($path = '.', $incdot = false, $recursive = false) {
+ if( $this->is_file($path) ) {
$limitFile = basename($path);
$path = dirname($path) . '/';
} else {
$limitFile = false;
}
- $list = @ftp_rawlist($this->link , '-a ' . $path, false);
+ $list = @ftp_rawlist($this->link, '-a ' . $path, false);
if ( $list === false )
return false;
if ( empty($entry) )
continue;
- if ( $entry["name"]=="." or $entry["name"]==".." )
+ if ( '.' == $entry["name"] || '..' == $entry["name"] )
continue;
- $dirlist[$entry['name']] = $entry;
+ $dirlist[ $entry['name'] ] = $entry;
}
if ( ! $dirlist )
//We're including the doted starts
if( '.' != $struc['name'] && '..' != $struc['name'] ){ //Ok, It isnt a special folder
if ($recursive)
- $struc['files'] = $this->dirlist($path.'/'.$struc['name'],$incdot,$recursive);
+ $struc['files'] = $this->dirlist($path . '/' . $struc['name'], $incdot, $recursive);
}
} else { //No dots
if ($recursive)
- $struc['files'] = $this->dirlist($path.'/'.$struc['name'],$incdot,$recursive);
+ $struc['files'] = $this->dirlist($path . '/' . $struc['name'], $incdot, $recursive);
}
}
//File
<?php
-class WP_Filesystem_ftpsockets{
+class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
var $ftp = false;
var $timeout = 5;
var $errors;
var $options = array();
- var $wp_base = '';
var $permission = null;
var $filetypes = array(
- 'php'=>FTP_ASCII,
- 'css'=>FTP_ASCII,
- 'txt'=>FTP_ASCII,
- 'js'=>FTP_ASCII,
- 'html'=>FTP_ASCII,
- 'htm'=>FTP_ASCII,
- 'xml'=>FTP_ASCII,
-
- 'jpg'=>FTP_BINARY,
- 'png'=>FTP_BINARY,
- 'gif'=>FTP_BINARY,
- 'bmp'=>FTP_BINARY
+ 'php' => FTP_ASCII,
+ 'css' => FTP_ASCII,
+ 'txt' => FTP_ASCII,
+ 'js' => FTP_ASCII,
+ 'html'=> FTP_ASCII,
+ 'htm' => FTP_ASCII,
+ 'xml' => FTP_ASCII,
+
+ 'jpg' => FTP_BINARY,
+ 'png' => FTP_BINARY,
+ 'gif' => FTP_BINARY,
+ 'bmp' => FTP_BINARY
);
function WP_Filesystem_ftpsockets($opt='') {
+ $this->method = 'ftpsockets';
$this->errors = new WP_Error();
//Check if possible to use ftp functions.
$this->permission = $perm;
}
- function find_base_dir($base = '.',$echo = false, $loop = false) {
- //Sanitize the Windows path formats, This allows easier conparison and aligns it to FTP output.
- $abspath = str_replace('\\','/',ABSPATH); //windows: Straighten up the paths..
- if( strpos($abspath, ':') ){ //Windows, Strip out the driveletter
- if( preg_match("|.{1}\:(.+)|i", $abspath, $mat) )
- $abspath = $mat[1];
- }
-
- //Set up the base directory (Which unless specified, is the current one)
- if( empty( $base ) || '.' == $base ) $base = $this->cwd();
- $base = trailingslashit($base);
-
- //Can we see the Current directory as part of the ABSPATH?
- $location = strpos($abspath, $base);
- if( false !== $location ) {
- $newbase = path_join($base, substr($abspath, $location + strlen($base)));
-
- if( false !== $this->chdir($newbase) ){ //chdir sometimes returns null under certain circumstances, even when its changed correctly, FALSE will be returned if it doesnt change correctly.
- if($echo) printf( __('Changing to %s') . '<br/>', $newbase );
- //Check to see if it exists in that folder.
- if( $this->exists($newbase . 'wp-settings.php') ){
- if($echo) printf( __('Found %s'), $newbase . 'wp-settings.php<br/>' );