Compare commits
125 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ee9cfcb2ab | ||
|
|
5146ea6235 | ||
|
|
e4d91883ca | ||
|
|
f5cfd43ba7 | ||
|
|
6c50df7ee0 | ||
|
|
99854603b7 | ||
|
|
abaf6b5f7c | ||
|
|
a84a617c5f | ||
|
|
ca6163154c | ||
|
|
80e08c043d | ||
|
|
9eaee46376 | ||
|
|
89ff8f4c43 | ||
|
|
ea8a8fdb9f | ||
|
|
53a8c38817 | ||
|
|
9a44de8001 | ||
|
|
72e90ed56b | ||
|
|
28fa29542d | ||
|
|
bbcc199661 | ||
|
|
6847a0faff | ||
|
|
ace86d3f26 | ||
|
|
61a86c831f | ||
|
|
30023b503b | ||
|
|
7b31ea2f06 | ||
|
|
d391388a17 | ||
|
|
493c35109c | ||
|
|
8d276f74b9 | ||
|
|
5394649f2c | ||
|
|
664fd8d96a | ||
|
|
7f12fcc775 | ||
|
|
0ad2ea5a73 | ||
|
|
e136d41287 | ||
|
|
3ccb4b4c1e | ||
|
|
67fcce65a5 | ||
|
|
6f22f9fa1e | ||
|
|
5ea09d46ed | ||
|
|
5e7617335c | ||
|
|
1bfa1265c6 | ||
|
|
43b4658332 | ||
|
|
d20ece66d0 | ||
|
|
2594a95ca1 | ||
|
|
0231cb3c54 | ||
|
|
988a8b90f2 | ||
|
|
d46ca509a4 | ||
|
|
7db1ac2f8c | ||
|
|
b7187caeec | ||
|
|
317f80dbac | ||
|
|
c8a7c7e0ab | ||
|
|
e1d35a3bdb | ||
|
|
1f0591aa48 | ||
|
|
4104bcd7d0 | ||
|
|
962900ab2e | ||
|
|
b015c52d5e | ||
|
|
d45f98f405 | ||
|
|
fba8028ae0 | ||
|
|
109916a11f | ||
|
|
6a16fd5e6d | ||
|
|
51d6103a9a | ||
|
|
455722693d | ||
|
|
abeb8a544e | ||
|
|
b386194ffa | ||
|
|
60cec12950 | ||
|
|
fba5ed50ab | ||
|
|
1e3a2e2aa4 | ||
|
|
98a8c05902 | ||
|
|
24521ef451 | ||
|
|
ab9e1dda9e | ||
|
|
8f99a7edf6 | ||
|
|
3e12c10654 | ||
|
|
7f74c32450 | ||
|
|
39ad2fdc45 | ||
|
|
a86a856e4f | ||
|
|
bb7f1cfb34 | ||
|
|
cf10270400 | ||
|
|
6fba83e3ed | ||
|
|
aa2e5fd539 | ||
|
|
71298d2ec2 | ||
|
|
9533faa4a9 | ||
|
|
af10e900ae | ||
|
|
c305d50e22 | ||
|
|
d9237d0a99 | ||
|
|
b85ba2cded | ||
|
|
15ab45a62e | ||
|
|
58ce006767 | ||
|
|
9d1b502247 | ||
|
|
984f638db5 | ||
|
|
d74b5402a4 | ||
|
|
9004e197b8 | ||
|
|
c425a9ffde | ||
|
|
968fe5782f | ||
|
|
7fa9696c0f | ||
|
|
18edbf6cee | ||
|
|
6ac1b6f6a3 | ||
|
|
a35f472fa8 | ||
|
|
3098d9bd6d | ||
|
|
4ee4d53a91 | ||
|
|
9e92916a50 | ||
|
|
fd295cab5c | ||
|
|
0107ebf65b | ||
|
|
661f1173eb | ||
|
|
c57249747c | ||
|
|
2e9d8ff9f1 | ||
|
|
3d05cf0bb8 | ||
|
|
9c0dc30258 | ||
|
|
092da00763 | ||
|
|
f4ac245297 | ||
|
|
df5d98e6f5 | ||
|
|
0c8c6a81bd | ||
|
|
2fe8b23805 | ||
|
|
67b2b82081 | ||
|
|
face47fad7 | ||
|
|
9867d494e2 | ||
|
|
e102a5962f | ||
|
|
9aa5cf72cd | ||
|
|
24479c7989 | ||
|
|
3c443ed481 | ||
|
|
c0adade2cc | ||
|
|
2e6d301d43 | ||
|
|
dcd9f8b4e6 | ||
|
|
fe65f84555 | ||
|
|
b46f5fa6cc | ||
|
|
660d4771a9 | ||
|
|
74b520ad62 | ||
|
|
0454882f71 | ||
|
|
31a2e8a94d | ||
|
|
9f64b0278f |
15
index.php
@@ -1,18 +1,5 @@
|
||||
<?php
|
||||
/**
|
||||
* 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
|
||||
*/
|
||||
/* Short and sweet */
|
||||
define('WP_USE_THEMES', true);
|
||||
|
||||
/** Loads the WordPress Environment and Template */
|
||||
require('./wp-blog-header.php');
|
||||
?>
|
||||
@@ -8,7 +8,7 @@
|
||||
<body>
|
||||
<h1 id="logo" style="text-align: center">
|
||||
<img alt="WordPress" src="wp-admin/images/wordpress-logo.png" />
|
||||
<br /> Version 2.6
|
||||
<br /> Version 2.5
|
||||
</h1>
|
||||
<p style="text-align: center">Semantic Personal Publishing Platform</p>
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
<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.6:</h2>
|
||||
<h2>Upgrading from any previous WordPress to 2.5:</h2>
|
||||
<ol>
|
||||
<li>Delete your old WP files, saving ones you've modified.</li>
|
||||
<li>Upload the new files.</li>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
define('DOING_AJAX', true);
|
||||
|
||||
require_once('../wp-load.php');
|
||||
require_once('../wp-config.php');
|
||||
require_once('includes/admin.php');
|
||||
|
||||
if ( !is_user_logged_in() )
|
||||
@@ -13,14 +13,9 @@ if ( isset($_GET['action']) && 'ajax-tag-search' == $_GET['action'] ) {
|
||||
|
||||
$s = $_GET['q']; // is this slashed already?
|
||||
|
||||
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 . "%')" );
|
||||
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%')" );
|
||||
echo join( $results, "\n" );
|
||||
die;
|
||||
}
|
||||
@@ -30,17 +25,14 @@ switch ( $action = $_POST['action'] ) :
|
||||
case 'delete-comment' :
|
||||
check_ajax_referer( "delete-comment_$id" );
|
||||
if ( !$comment = get_comment( $id ) )
|
||||
die('1');
|
||||
die('0');
|
||||
if ( !current_user_can( 'edit_post', $comment->comment_post_ID ) )
|
||||
die('-1');
|
||||
|
||||
if ( isset($_POST['spam']) && 1 == $_POST['spam'] ) {
|
||||
if ( 'spam' == wp_get_comment_status( $comment->comment_ID ) )
|
||||
die('1');
|
||||
if ( isset($_POST['spam']) && 1 == $_POST['spam'] )
|
||||
$r = wp_set_comment_status( $comment->comment_ID, 'spam' );
|
||||
} else {
|
||||
else
|
||||
$r = wp_delete_comment( $comment->comment_ID );
|
||||
}
|
||||
|
||||
die( $r ? '1' : '0' );
|
||||
break;
|
||||
@@ -49,38 +41,24 @@ case 'delete-cat' :
|
||||
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.
|
||||
@@ -111,20 +89,14 @@ case 'delete-link' :
|
||||
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('1');
|
||||
|
||||
die('0');
|
||||
if ( !current_user_can( 'edit_post', $meta->post_id ) )
|
||||
die('-1');
|
||||
if ( delete_meta( $meta->meta_id ) )
|
||||
@@ -136,9 +108,6 @@ case 'delete-post' :
|
||||
if ( !current_user_can( 'delete_post', $id ) )
|
||||
die('-1');
|
||||
|
||||
if ( !get_post( $id ) )
|
||||
die('1');
|
||||
|
||||
if ( wp_delete_post( $id ) )
|
||||
die('1');
|
||||
else
|
||||
@@ -149,28 +118,19 @@ case 'delete-page' :
|
||||
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');
|
||||
|
||||
$current = wp_get_comment_status( $comment->comment_ID );
|
||||
if ( $_POST['new'] == $current )
|
||||
die('1');
|
||||
|
||||
if ( 'unapproved' == $current ) {
|
||||
if ( 'unapproved' == wp_get_comment_status($comment->comment_ID) ) {
|
||||
check_ajax_referer( "approve-comment_$id" );
|
||||
if ( wp_set_comment_status( $comment->comment_ID, 'approve' ) )
|
||||
die('1');
|
||||
@@ -190,9 +150,6 @@ case 'add-category' : // On the Fly
|
||||
$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 ) {
|
||||
@@ -206,7 +163,7 @@ case 'add-category' : // On the Fly
|
||||
continue;
|
||||
$category = get_category( $cat_id );
|
||||
ob_start();
|
||||
wp_category_checklist( 0, $cat_id, $checked_categories, $popular_ids );
|
||||
wp_category_checklist( 0, $cat_id, $checked_categories );
|
||||
$data = ob_get_contents();
|
||||
ob_end_clean();
|
||||
$x->add( array(
|
||||
@@ -502,11 +459,10 @@ case 'add-user' :
|
||||
$x->send();
|
||||
break;
|
||||
case 'autosave' : // The name of this action is hardcoded in edit_post()
|
||||
define( 'DOING_AUTOSAVE', true );
|
||||
|
||||
$nonce_age = check_ajax_referer( 'autosave', 'autosavenonce' );
|
||||
$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']))
|
||||
@@ -520,9 +476,8 @@ case 'autosave' : // The name of this action is hardcoded in edit_post()
|
||||
|
||||
$supplemental = array();
|
||||
|
||||
$id = $revision_id = 0;
|
||||
$id = 0;
|
||||
if($_POST['post_ID'] < 0) {
|
||||
$_POST['post_status'] = 'draft';
|
||||
$_POST['temp_ID'] = $_POST['post_ID'];
|
||||
if ( $do_autosave ) {
|
||||
$id = wp_write_post();
|
||||
@@ -553,18 +508,8 @@ case 'autosave' : // The name of this action is hardcoded in edit_post()
|
||||
if ( !current_user_can('edit_post', $post_ID) )
|
||||
die(__('You are not allowed to edit this post.'));
|
||||
}
|
||||
|
||||
if ( $do_autosave ) {
|
||||
// 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;
|
||||
}
|
||||
$id = edit_post();
|
||||
$data = $message;
|
||||
} else {
|
||||
$id = $post->ID;
|
||||
|
||||
@@ -5,7 +5,6 @@ if ( $editing ) {
|
||||
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']);
|
||||
@@ -29,13 +28,14 @@ get_admin_page_title();
|
||||
<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();}}};
|
||||
@@ -44,73 +44,26 @@ addLoadEvent = function(func) {if (typeof jQuery != "undefined") jQuery(document
|
||||
<?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;
|
||||
|
||||
$hook_suffixes = array();
|
||||
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');
|
||||
|
||||
if ( isset($page_hook) )
|
||||
$hook_suffixes[] = "-$page_hook";
|
||||
do_action('admin_head-' . $page_hook);
|
||||
else if ( isset($plugin_page) )
|
||||
$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);
|
||||
|
||||
do_action('admin_head-' . $plugin_page);
|
||||
do_action('admin_head');
|
||||
?>
|
||||
</head>
|
||||
<body class="wp-admin <?php echo apply_filters( 'admin_body_class', '' ); ?>">
|
||||
<div id="wpwrap">
|
||||
<div id="wpcontent">
|
||||
<div id="wphead">
|
||||
<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>
|
||||
<h1><?php bloginfo('name'); ?><span id="viewsite"><a href="<?php echo trailingslashit( get_option('home') ); ?>"><?php _e('Visit Site') ?></a></span></h1>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
$gears_compat = false;
|
||||
|
||||
if ( ($is_gecko || $is_winIE) && strpos(strtolower($_SERVER['HTTP_USER_AGENT']), 'webkit') === false ) {
|
||||
$gears_compat = true;
|
||||
?>
|
||||
<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 _e('To enable it, make sure this web site is not on the denied list in Gears Settings under your browser\'s 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 _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 ( $gears_compat ) { ?> | <span id="gears-menu"><a href="#" onclick="wpGears.message(1);return false;"><?php _e('Turbo') ?></a></span><?php } ?></p></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
|
||||
require(ABSPATH . 'wp-admin/menu-header.php');
|
||||
|
||||
@@ -1,24 +0,0 @@
|
||||
<?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);
|
||||
|
||||
?>
|
||||
@@ -2,12 +2,12 @@
|
||||
define('WP_ADMIN', TRUE);
|
||||
|
||||
if ( defined('ABSPATH') )
|
||||
require_once(ABSPATH . 'wp-load.php');
|
||||
require_once( ABSPATH . 'wp-config.php');
|
||||
else
|
||||
require_once('../wp-load.php');
|
||||
require_once('../wp-config.php');
|
||||
|
||||
if ( get_option('db_version') != $wp_db_version ) {
|
||||
wp_redirect(admin_url('upgrade.php?_wp_http_referer=' . urlencode(stripslashes($_SERVER['REQUEST_URI']))));
|
||||
wp_redirect(get_option('siteurl') . '/wp-admin/upgrade.php?_wp_http_referer=' . urlencode(stripslashes($_SERVER['REQUEST_URI'])));
|
||||
exit;
|
||||
}
|
||||
|
||||
@@ -26,8 +26,8 @@ $time_format = get_option('time_format');
|
||||
|
||||
wp_reset_vars(array('profile', 'redirect', 'redirect_url', 'a', 'popuptitle', 'popupurl', 'text', 'trackback', 'pingback'));
|
||||
|
||||
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_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_enqueue_script( 'common' );
|
||||
wp_enqueue_script( 'jquery-color' );
|
||||
@@ -58,7 +58,7 @@ if (isset($plugin_page)) {
|
||||
wp_die(__('Invalid plugin page'));
|
||||
}
|
||||
|
||||
if (! ( file_exists(WP_PLUGIN_DIR . "/$plugin_page") && is_file(WP_PLUGIN_DIR . "/$plugin_page") ) )
|
||||
if (! ( file_exists(ABSPATH . PLUGINDIR . "/$plugin_page") && is_file( ABSPATH . PLUGINDIR . "/$plugin_page") ) )
|
||||
wp_die(sprintf(__('Cannot load %s.'), htmlentities($plugin_page)));
|
||||
|
||||
do_action('load-' . $plugin_page);
|
||||
@@ -66,7 +66,7 @@ if (isset($plugin_page)) {
|
||||
if (! isset($_GET['noheader']))
|
||||
require_once(ABSPATH . 'wp-admin/admin-header.php');
|
||||
|
||||
include(WP_PLUGIN_DIR . "/$plugin_page");
|
||||
include(ABSPATH . PLUGINDIR . "/$plugin_page");
|
||||
}
|
||||
|
||||
include(ABSPATH . 'wp-admin/admin-footer.php');
|
||||
@@ -113,7 +113,4 @@ if (isset($plugin_page)) {
|
||||
do_action("load-$pagenow");
|
||||
}
|
||||
|
||||
if ( !empty($_REQUEST['action']) )
|
||||
do_action('admin_action_' . $_REQUEST['action']);
|
||||
|
||||
?>
|
||||
|
||||
@@ -5,19 +5,17 @@
|
||||
*/
|
||||
|
||||
if ( defined('ABSPATH') )
|
||||
require_once(ABSPATH . 'wp-load.php');
|
||||
require_once( ABSPATH . 'wp-config.php');
|
||||
else
|
||||
require_once('../wp-load.php');
|
||||
require_once('../wp-config.php');
|
||||
|
||||
// Flash often fails to send cookies with the POST or upload, so we need to pass it in GET or POST instead
|
||||
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']) )
|
||||
if ( 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; charset=' . get_option('blog_charset'));
|
||||
header('Content-Type: text/plain');
|
||||
|
||||
if ( !current_user_can('upload_files') )
|
||||
wp_die(__('You do not have permission to upload files.'));
|
||||
@@ -28,8 +26,6 @@ if ( ($id = intval($_REQUEST['attachment_id'])) && $_REQUEST['fetch'] ) {
|
||||
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>';
|
||||
|
||||
107
wp-admin/bookmarklet.php
Normal file
@@ -0,0 +1,107 @@
|
||||
<?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>
|
||||
@@ -126,7 +126,6 @@ endif; ?>
|
||||
<?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>
|
||||
@@ -135,24 +134,6 @@ endif; ?>
|
||||
|
||||
<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'); ?>
|
||||
@@ -166,7 +147,7 @@ if ( $page_links )
|
||||
<table class="widefat">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
||||
<th scope="col" class="check-column"><input type="checkbox" onclick="checkAll(document.getElementById('posts-filter'));" /></th>
|
||||
<th scope="col"><?php _e('Name') ?></th>
|
||||
<th scope="col"><?php _e('Description') ?></th>
|
||||
<th scope="col" class="num"><?php _e('Posts') ?></th>
|
||||
@@ -174,18 +155,13 @@ if ( $page_links )
|
||||
</thead>
|
||||
<tbody id="the-list" class="list:cat">
|
||||
<?php
|
||||
cat_rows(0, 0, 0, $pagenum, $catsperpage);
|
||||
cat_rows();
|
||||
?>
|
||||
</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" />
|
||||
|
||||
@@ -21,7 +21,7 @@ case 'editcomment' :
|
||||
$title = __('Edit Comment');
|
||||
|
||||
wp_enqueue_script('comment');
|
||||
|
||||
//wp_enqueue_script('thickbox');
|
||||
require_once('admin-header.php');
|
||||
|
||||
$comment_id = absint( $_GET['c'] );
|
||||
@@ -78,7 +78,7 @@ if ( 'spam' == $_GET['dt'] ) {
|
||||
|
||||
<table width="100%">
|
||||
<tr>
|
||||
<td><input type='button' class="button" value='<?php _e('No'); ?>' onclick="self.location='<?php echo admin_url('edit-comments.php'); ?>" /></td>
|
||||
<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 class="textright"><input type='submit' class="button" value='<?php echo $button; ?>' /></td>
|
||||
</tr>
|
||||
</table>
|
||||
@@ -146,7 +146,7 @@ case 'deletecomment' :
|
||||
else if ( '' != wp_get_original_referer() && false == $noredir )
|
||||
wp_redirect( wp_get_original_referer() );
|
||||
else
|
||||
wp_redirect( admin_url('edit-comments.php') );
|
||||
wp_redirect( get_option('siteurl') . '/wp-admin/edit-comments.php' );
|
||||
|
||||
die;
|
||||
break;
|
||||
@@ -171,7 +171,7 @@ case 'unapprovecomment' :
|
||||
if ( '' != wp_get_referer() && false == $noredir )
|
||||
wp_redirect( wp_get_referer() );
|
||||
else
|
||||
wp_redirect( admin_url('edit.php?p=' . absint( $comment->comment_post_ID ) . '#comments') );
|
||||
wp_redirect( get_option('siteurl') . '/wp-admin/edit.php?p=' . absint( $comment->comment_post_ID ) . '#comments' );
|
||||
|
||||
exit();
|
||||
break;
|
||||
@@ -193,10 +193,14 @@ case 'approvecomment' :
|
||||
|
||||
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( admin_url('edit.php?p=' . absint( $comment->comment_post_ID ) . '#comments') );
|
||||
wp_redirect( get_option('siteurl') . '/wp-admin/edit.php?p=' . absint( $comment->comment_post_ID ) . '#comments' );
|
||||
|
||||
exit();
|
||||
break;
|
||||
@@ -225,4 +229,4 @@ default:
|
||||
|
||||
include('admin-footer.php');
|
||||
|
||||
?>
|
||||
?>
|
||||
@@ -2,7 +2,7 @@ a.page-numbers:hover {
|
||||
border-color: #999;
|
||||
}
|
||||
|
||||
body, .form-table .pre {
|
||||
body {
|
||||
background-color: #fff;
|
||||
color: #333;
|
||||
}
|
||||
@@ -37,7 +37,7 @@ input.disabled, textarea.disabled {
|
||||
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, h3.info-box-title {
|
||||
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 {
|
||||
background-color: #cfebf7;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ ul#widget-list li.widget-list-item h4.widget-title {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.sorthelper {
|
||||
ul.widget-control-list .sorthelper {
|
||||
background-color: #ccf3fa;
|
||||
}
|
||||
|
||||
@@ -204,11 +204,11 @@ ul#widget-list li.widget-list-item h4.widget-title {
|
||||
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, #media-upload a.del-link: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 {
|
||||
color: #d54e21;
|
||||
}
|
||||
|
||||
#adminmenu a:hover, #sidemenu a:hover, .ui-tabs-nav a:hover {
|
||||
#adminmenu a:hover, #sidemenu a:hover {
|
||||
color: #97c4d8;
|
||||
}
|
||||
|
||||
@@ -239,8 +239,7 @@ ul#widget-list li.widget-list-item h4.widget-title {
|
||||
border-bottom-color: #999;
|
||||
}
|
||||
|
||||
.submitbox .submitdelete:hover,
|
||||
#media-upload a.delete:hover {
|
||||
.submitbox .submitdelete:hover {
|
||||
color: #fff;
|
||||
background-color: #f00;
|
||||
border-bottom-color: #f00;
|
||||
@@ -292,11 +291,11 @@ ul#widget-list li.widget-list-item h4.widget-title {
|
||||
color: #5a5a5a;
|
||||
}
|
||||
|
||||
#poststuff #edButtonPreview, #poststuff #edButtonHTML, #the-comment-list p.comment-author strong a, #media-upload a.del-link, #media-upload a.delete, a {
|
||||
#poststuff #edButtonPreview, #poststuff #edButtonHTML, #the-comment-list p.comment-author strong a, a {
|
||||
color: #2e7ca0;
|
||||
}
|
||||
|
||||
#adminmenu a, .ui-tabs-nav a {
|
||||
#adminmenu a {
|
||||
color: #cfebf6;
|
||||
}
|
||||
|
||||
@@ -304,7 +303,7 @@ ul#widget-list li.widget-list-item h4.widget-title {
|
||||
color: #2782af
|
||||
}
|
||||
/* Because we don't want visited on these links */
|
||||
#adminmenu a.current, #sidemenu a.current, body.press-this .ui-tabs-selected a, body.press-this .ui-tabs-selected a:hover {
|
||||
#adminmenu a.current, #sidemenu a.current {
|
||||
background-color: #fff;
|
||||
border-color: #07273e;
|
||||
border-bottom-color: #fff;
|
||||
@@ -312,11 +311,11 @@ ul#widget-list li.widget-list-item h4.widget-title {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#adminmenu li a #awaiting-mod, #sidemenu li a #update-plugins {
|
||||
#adminmenu li a #awaiting-mod {
|
||||
background-image: url(../images/comment-stalk-classic.gif);
|
||||
}
|
||||
|
||||
#adminmenu li a #awaiting-mod span, #sidemenu li a #update-plugins span {
|
||||
#adminmenu li a #awaiting-mod span {
|
||||
background-color: #d54e21;
|
||||
color: #fff;
|
||||
}
|
||||
@@ -327,7 +326,7 @@ ul#widget-list li.widget-list-item h4.widget-title {
|
||||
}
|
||||
|
||||
|
||||
#adminmenu li a:hover #awaiting-mod span, #sidemenu li a:hover #update-plugins span {
|
||||
#adminmenu li a:hover #awaiting-mod span {
|
||||
background-color: #07273E;
|
||||
}
|
||||
|
||||
@@ -415,11 +414,11 @@ input.readonly {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.plugins .active {
|
||||
#plugins .active {
|
||||
background-color: #BBEEBB;
|
||||
}
|
||||
|
||||
.plugins .togl {
|
||||
#plugins .togl {
|
||||
border-right-color: #ccc;
|
||||
}
|
||||
|
||||
@@ -427,7 +426,7 @@ input.readonly {
|
||||
background-color: #ffffe0;
|
||||
}
|
||||
|
||||
.plugins tr {
|
||||
#plugins tr {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
@@ -551,6 +550,11 @@ div#media-upload-error, .file-error, abbr.required, .widget-control-remove:hover
|
||||
color: #f00;
|
||||
}
|
||||
|
||||
#media-upload a.delete {
|
||||
color: #888;
|
||||
}
|
||||
|
||||
|
||||
/* TinyMCE */
|
||||
.wp_themeSkin *,
|
||||
.wp_themeSkin a:hover,
|
||||
@@ -561,7 +565,7 @@ div#media-upload-error, .file-error, abbr.required, .widget-control-remove:hover
|
||||
}
|
||||
|
||||
/* Containers */
|
||||
.wp_themeSkin table, #wp_editbtns {
|
||||
.wp_themeSkin table {
|
||||
background: #83B4D5;
|
||||
}
|
||||
|
||||
@@ -713,18 +717,3 @@ div#media-upload-error, .file-error, abbr.required, .widget-control-remove:hover
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ a.page-numbers:hover {
|
||||
border-color: #999;
|
||||
}
|
||||
|
||||
body, .form-table .pre {
|
||||
body {
|
||||
background-color: #fff;
|
||||
color: #333;
|
||||
}
|
||||
@@ -41,7 +41,7 @@ input.disabled, textarea.disabled {
|
||||
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, h3.info-box-title {
|
||||
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 {
|
||||
background-color: #eaf3fa;
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ ul#widget-list li.widget-list-item h4.widget-title {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
.sorthelper {
|
||||
ul.widget-control-list .sorthelper {
|
||||
background-color: #ccf3fa;
|
||||
}
|
||||
|
||||
@@ -196,7 +196,7 @@ ul#widget-list li.widget-list-item h4.widget-title {
|
||||
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, #media-upload a.del-link:hover, .ui-tabs-nav a: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 {
|
||||
color: #d54e21;
|
||||
}
|
||||
|
||||
@@ -226,8 +226,7 @@ ul#widget-list li.widget-list-item h4.widget-title {
|
||||
border-bottom-color: #999;
|
||||
}
|
||||
|
||||
.submitbox .submitdelete:hover,
|
||||
#media-upload a.delete:hover {
|
||||
.submitbox .submitdelete:hover {
|
||||
color: #fff;
|
||||
background-color: #f00;
|
||||
border-bottom-color: #f00;
|
||||
@@ -279,28 +278,28 @@ ul#widget-list li.widget-list-item h4.widget-title {
|
||||
color: #666;
|
||||
}
|
||||
|
||||
#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 {
|
||||
#adminmenu a, #submenu a, #poststuff #edButtonPreview, #poststuff #edButtonHTML, #the-comment-list p.comment-author strong a, a {
|
||||
color: #2583ad;
|
||||
}
|
||||
|
||||
/* Because we don't want visited on these links */
|
||||
#adminmenu a.current, #sidemenu a.current, body.press-this .ui-tabs-selected a, body.press-this .ui-tabs-selected a:hover {
|
||||
#adminmenu a.current, #sidemenu a.current {
|
||||
background-color: #fff;
|
||||
border-color: #c6d9e9;
|
||||
border-bottom-color: #fff;
|
||||
color: #d54e21;
|
||||
}
|
||||
|
||||
#adminmenu li a #awaiting-mod, #sidemenu li a #update-plugins {
|
||||
#adminmenu li a #awaiting-mod {
|
||||
background-image: url(../images/comment-stalk-fresh.gif);
|
||||
}
|
||||
|
||||
#adminmenu li a #awaiting-mod span, #sidemenu li a #update-plugins span, #rightnow .reallynow {
|
||||
#adminmenu li a #awaiting-mod span, #rightnow .reallynow {
|
||||
background-color: #d54e21;
|
||||
color: #fff;
|
||||
}
|
||||
|
||||
#adminmenu li a:hover #awaiting-mod span, #sidemenu li a:hover #update-plugins span {
|
||||
#adminmenu li a:hover #awaiting-mod span {
|
||||
background-color: #264761;
|
||||
}
|
||||
|
||||
@@ -384,11 +383,11 @@ input.readonly {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
.plugins .active {
|
||||
#plugins .active {
|
||||
background-color: #e7f7d3;
|
||||
}
|
||||
|
||||
.plugins .togl {
|
||||
#plugins .togl {
|
||||
border-right-color: #ccc;
|
||||
}
|
||||
|
||||
@@ -396,7 +395,7 @@ input.readonly {
|
||||
background-color: #ffffe0;
|
||||
}
|
||||
|
||||
.plugins tr {
|
||||
#plugins tr {
|
||||
background-color: #fff;
|
||||
}
|
||||
|
||||
@@ -533,7 +532,7 @@ div#media-upload-error, .file-error, abbr.required, .widget-control-remove:hover
|
||||
}
|
||||
|
||||
/* Containers */
|
||||
.wp_themeSkin table, #wp_editbtns {
|
||||
.wp_themeSkin table {
|
||||
background: #cee1ef;
|
||||
}
|
||||
|
||||
@@ -689,18 +688,3 @@ div#media-upload-error, .file-error, abbr.required, .widget-control-remove:hover
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -13,19 +13,11 @@
|
||||
margin: 1px 0 0 6px;
|
||||
}
|
||||
|
||||
div.dashboard-widget-holder {
|
||||
float: right;
|
||||
}
|
||||
|
||||
h3.dashboard-widget-title span {
|
||||
text-align: right;
|
||||
float: right;
|
||||
}
|
||||
|
||||
div.dashboard-widget-submit input {
|
||||
font-family: sans-serif !important;
|
||||
}
|
||||
|
||||
#dashboard-widgets .widget_rss ul li a {
|
||||
float:right;
|
||||
font-weight:bold;
|
||||
@@ -64,16 +56,7 @@ div.dashboard-widget {
|
||||
float:right;
|
||||
margin:0 0 0.2em 0.5em;
|
||||
}
|
||||
#dashboard_secondary div.dashboard-widget-content ul li {
|
||||
float: right;
|
||||
}
|
||||
#dashboard_secondary div.dashboard-widget-content ul li .post {
|
||||
font-family: sans-serif !important;
|
||||
}
|
||||
#dashboard_secondary div.dashboard-widget-content ul li a {
|
||||
border-right:0 none;
|
||||
border-left:1px solid #DADADA;
|
||||
}
|
||||
#dashboard_secondary div.dashboard-widget-content ul li a cite {
|
||||
font-family: sans-serif;
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
//* styles for use by people extending the WordPress interface */
|
||||
body, td { font-family: sans-serif; }
|
||||
|
||||
textarea, input, select { font-family: sans-serif; }
|
||||
|
||||
.alignleft { float: right; }
|
||||
.alignright { float: left; }
|
||||
|
||||
.textleft { text-align: right; }
|
||||
.textright { text-align: left; }
|
||||
|
||||
.wrap h2 { font-family: sans-serif; }
|
||||
|
||||
.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 {
|
||||
margin: 5px -4px 0 0;
|
||||
padding: 0 0 7px 280px;
|
||||
}
|
||||
@@ -194,7 +194,3 @@ th.check-column + th, th.check-column + td {
|
||||
padding-bottom: 7px;
|
||||
padding-right: 280px;
|
||||
}
|
||||
|
||||
.wrap h2.long-header {
|
||||
padding-right: 0;
|
||||
}
|
||||
|
||||
@@ -111,10 +111,7 @@ div#dashboard-widgets {
|
||||
.tablenav-pages {
|
||||
display: block;
|
||||
margin-top: -3px;
|
||||
}
|
||||
|
||||
table.ie-fixed {
|
||||
table-layout: fixed;
|
||||
}
|
||||
|
||||
#post-search .button, #widget-search .button {
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
body {
|
||||
font-size: 11px;
|
||||
font-family: sans-serif !important;
|
||||
font-size: 11px;;
|
||||
}
|
||||
ul, ol {
|
||||
padding: 5px 22px 5px 5px;
|
||||
@@ -17,10 +16,4 @@ input {
|
||||
#admin_email {
|
||||
direction: ltr;
|
||||
text-align: left;
|
||||
}
|
||||
.submit input, .button, .button-secondary {
|
||||
font-family: sans-serif !important;
|
||||
}
|
||||
h1 {
|
||||
font-family: sans-serif;
|
||||
}
|
||||
@@ -7,10 +7,8 @@ body {
|
||||
margin: 2em auto 0 auto;
|
||||
width: 700px;
|
||||
padding: 1em 2em;
|
||||
-moz-border-radius: 12px;
|
||||
-khtml-border-radius: 12px;
|
||||
-webkit-border-radius: 12px;
|
||||
border-radius: 12px;
|
||||
font-size: 62.5%;
|
||||
}
|
||||
|
||||
a { color: #2583ad; text-decoration: none; }
|
||||
@@ -27,41 +25,34 @@ h2 { font-size: 16px; }
|
||||
|
||||
p, li {
|
||||
padding-bottom: 2px;
|
||||
font-size: 13px;
|
||||
line-height: 18px;
|
||||
font-size: 1.3em;
|
||||
line-height: 1.8em;
|
||||
}
|
||||
|
||||
code {
|
||||
font-size: 13px;
|
||||
font-size: 1.3em;
|
||||
}
|
||||
|
||||
ul, ol { padding: 5px 5px 5px 22px; }
|
||||
|
||||
#logo { margin: 6px 0 14px 0px; border-bottom: none;}
|
||||
|
||||
.step {
|
||||
margin: 20px 0 15px;
|
||||
}
|
||||
.step a, .step input { font-size: 2em; }
|
||||
|
||||
.step input {
|
||||
font-size: 18px;
|
||||
}
|
||||
|
||||
a.button {
|
||||
font-size: 18px;
|
||||
}
|
||||
td input { font-size: 1.5em; }
|
||||
|
||||
.step, th { text-align: left; padding: 0; }
|
||||
|
||||
.submit input, .button, .button-secondary {
|
||||
font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
|
||||
padding: 5px 7px 7px;
|
||||
border: 1px solid #a3a3a3;
|
||||
padding: 6px;
|
||||
border: none;
|
||||
margin-left: 0;
|
||||
-moz-border-radius: 3px;
|
||||
-khtml-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
font-size: 13px !important;
|
||||
-moz-border-radius: 2px;
|
||||
-khtml-border-radius: 2px;
|
||||
-webkit-border-radius: 2px;
|
||||
border-radius: 2px;
|
||||
color: #246;
|
||||
background: #e5e5e5;
|
||||
}
|
||||
@@ -72,7 +63,6 @@ a.button {
|
||||
|
||||
.submit input:hover, .button:hover, .button-secondary:hover {
|
||||
color: #d54e21;
|
||||
border-color: #535353;
|
||||
}
|
||||
|
||||
.form-table {
|
||||
@@ -85,13 +75,12 @@ a.button {
|
||||
margin-bottom: 9px;
|
||||
padding: 10px;
|
||||
border-bottom: 8px solid #fff;
|
||||
font-size: 12px;
|
||||
}
|
||||
|
||||
.form-table th {
|
||||
font-size: 13px;
|
||||
font-size: 12px;
|
||||
text-align: left;
|
||||
padding: 16px 10px 10px 10px;
|
||||
padding: 12px 10px 10px 10px;
|
||||
border-bottom: 8px solid #fff;
|
||||
width: 110px;
|
||||
vertical-align: top;
|
||||
@@ -111,12 +100,6 @@ a.button {
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
.form-table input {
|
||||
line-height: 20px;
|
||||
font-size: 15px;
|
||||
padding: 2px;
|
||||
}
|
||||
|
||||
h1 {
|
||||
border-bottom: 1px solid #dadada;
|
||||
clear: both;
|
||||
@@ -133,10 +116,9 @@ h1 {
|
||||
|
||||
#error-page p {
|
||||
font-size: 14px;
|
||||
line-height: 16px;
|
||||
margin: 25px 0 20px;
|
||||
line-height: 1.6em;
|
||||
}
|
||||
|
||||
#error-page code {
|
||||
font-size: 15px;
|
||||
font-size: 1em;
|
||||
}
|
||||
@@ -1,10 +1,7 @@
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
font-family: "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
|
||||
direction: rtl;
|
||||
}
|
||||
#login form .submit input {
|
||||
font-family: sans-serif !important;
|
||||
}
|
||||
form {
|
||||
margin-left:0;
|
||||
margin-right:8px;
|
||||
|
||||
@@ -32,7 +32,6 @@ form {
|
||||
.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;
|
||||
}
|
||||
@@ -197,11 +196,6 @@ abbr.required {
|
||||
#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;
|
||||
@@ -223,17 +217,10 @@ abbr.required {
|
||||
min-height: 36px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
#media-upload .ui-sortable .media-item {
|
||||
cursor: move;
|
||||
}
|
||||
|
||||
.filename {
|
||||
float: left;
|
||||
line-height: 36px;
|
||||
margin-left: 10px;
|
||||
overflow: hidden;
|
||||
max-width: 430px;
|
||||
float: left;
|
||||
}
|
||||
#media-upload .describe {
|
||||
border-top-width: 1px;
|
||||
@@ -241,7 +228,6 @@ abbr.required {
|
||||
padding: 5px;
|
||||
width: 100%;
|
||||
clear: both;
|
||||
cursor: default;
|
||||
}
|
||||
#media-upload .describe th.label {
|
||||
padding-top: .5em;
|
||||
@@ -254,62 +240,3 @@ abbr.required {
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
#menu { margin-right: 8px !important; }
|
||||
|
||||
p.submit input { text-align: right !important; }
|
||||
|
||||
li.ui-tabs-selected a { height: 25px; }
|
||||
|
||||
#photo_directions span { right: 200px; left: auto; height: 8px; }
|
||||
@@ -1,8 +0,0 @@
|
||||
|
||||
#posting {
|
||||
position: static !important;
|
||||
}
|
||||
.ui-tabs-nav {
|
||||
margin-left: 0;
|
||||
border: 0 !important;
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
body {
|
||||
font-family: sans-serif;
|
||||
}
|
||||
|
||||
#viewsite {
|
||||
right:auto; left: 8px;
|
||||
}
|
||||
|
||||
ul#menu {
|
||||
padding-right: 8px;
|
||||
}
|
||||
|
||||
.ui-tabs-nav li {
|
||||
float: right;
|
||||
}
|
||||
|
||||
div#posting {
|
||||
padding-right:16px; padding-left: 0;
|
||||
}
|
||||
|
||||
div#categories {
|
||||
right: auto; left: 16px;
|
||||
}
|
||||
|
||||
div#categories h2 {
|
||||
margin:0.5em 1em 0.5em 0;
|
||||
}
|
||||
|
||||
#jaxtag {
|
||||
padding-right :1em; padding-left: 0;
|
||||
}
|
||||
|
||||
input#newtag {
|
||||
margin-left: 4px; width: 100px;
|
||||
}
|
||||
|
||||
#photo_directions span {
|
||||
right: auto; left: 3px
|
||||
}
|
||||
|
||||
#TB_ajaxContent #options {
|
||||
right: auto; left: 25px;
|
||||
}
|
||||
|
||||
#TB_ajaxContent {
|
||||
text-align: right;
|
||||
}
|
||||
|
||||
#TB_ajaxContent #this_photo {
|
||||
direction: ltr;
|
||||
}
|
||||
|
||||
.video_split #extra_fields {
|
||||
float: right;
|
||||
}
|
||||
|
||||
.video_split .editor_area {
|
||||
float: left;
|
||||
}
|
||||
@@ -1,519 +0,0 @@
|
||||
body {
|
||||
font: 13px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif;
|
||||
color: #333;
|
||||
margin: 0px;
|
||||
padding: 0px;
|
||||
}
|
||||
/* 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;
|
||||
}
|
||||
@@ -1,6 +1,3 @@
|
||||
#template textarea {
|
||||
font-family: monospace !important;
|
||||
}
|
||||
#templateside {
|
||||
float:left;
|
||||
}
|
||||
|
||||
@@ -29,23 +29,22 @@ ul#widget-list li.widget-list-item div.widget-description {
|
||||
margin-right:0;
|
||||
margin-left:8px;
|
||||
}
|
||||
h4.widget-title span {
|
||||
float: right;
|
||||
}
|
||||
h4.widget-title a {
|
||||
float: left;
|
||||
margin: 0 1em 0 0;
|
||||
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 {
|
||||
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;
|
||||
}
|
||||
ul.widget-control-list h4.widget-title,
|
||||
#dragHelper h4.widget-title {
|
||||
text-align: right;
|
||||
ul.widget-control-list .widget-title {
|
||||
text-align:right;
|
||||
}
|
||||
@@ -45,20 +45,10 @@ ul#widget-list li.widget-list-item {
|
||||
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;
|
||||
@@ -69,7 +59,7 @@ ul#widget-list li.widget-list-item h4.widget-title {
|
||||
-moz-border-radius: 3px;
|
||||
-khtml-border-radius: 3px;
|
||||
-webkit-border-radius: 3px;
|
||||
border-radius: 3px;
|
||||
border-radius: 3px;;
|
||||
}
|
||||
|
||||
#dragHelper h4.widget-title {
|
||||
@@ -84,6 +74,7 @@ ul#widget-list li.widget-list-item div.widget-description {
|
||||
font-size: 11px;
|
||||
}
|
||||
|
||||
|
||||
ul#widget-list li.widget-list-item ul.widget-control-info {
|
||||
display: none;
|
||||
}
|
||||
@@ -100,26 +91,27 @@ ul.widget-control-list {
|
||||
padding: 0 1em;
|
||||
}
|
||||
|
||||
ul.widget-control-list li {
|
||||
position: relative;
|
||||
}
|
||||
|
||||
div#current-widgets p.submit {
|
||||
padding: 1em;
|
||||
}
|
||||
|
||||
li.widget-list-control-item {
|
||||
margin: 1em 0;
|
||||
margin: 0 0 1em;
|
||||
-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;
|
||||
@@ -137,6 +129,13 @@ li.widget-sortable h4 {
|
||||
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 {
|
||||
@@ -144,15 +143,16 @@ li.widget-list-control-item h4.widget-title a,
|
||||
}
|
||||
|
||||
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;
|
||||
padding: 15px;
|
||||
margin: 1em;
|
||||
padding: 0 10px 0 7px; /* Correction for padding, margin, border of inputs */
|
||||
font-size: 11px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
li.widget-list-control-item div.widget-control p {
|
||||
@@ -161,9 +161,15 @@ 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;
|
||||
padding: 0.5em 0 0.8em;
|
||||
}
|
||||
|
||||
ul.widget-control-list .widget-title {
|
||||
|
||||
}
|
||||
|
||||
.widget-control-edit {
|
||||
|
||||
@@ -189,7 +189,7 @@ Event.observe( window, 'load', hide_text );
|
||||
<div id="desc"><?php bloginfo('description');?></div>
|
||||
</div>
|
||||
<?php if ( !defined( 'NO_HEADER_TEXT' ) ) { ?>
|
||||
<form method="post" action="<?php echo admin_url('themes.php?page=custom-header&updated=true') ?>">
|
||||
<form method="post" action="<?php echo get_option('siteurl') ?>/wp-admin/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') ?>
|
||||
|
||||
@@ -26,18 +26,18 @@ if ( ! empty($cat_ID) ) {
|
||||
<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" aria-required="true" /><br />
|
||||
<td><input name="cat_name" id="cat_name" type="text" value="<?php echo attribute_escape($category->name); ?>" size="40" /><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(apply_filters('editable_slug', $category->slug)); ?>" size="40" /><br />
|
||||
<td><input name="category_nicename" id="category_nicename" type="text" value="<?php echo attribute_escape($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(array('hide_empty' => 0, 'name' => 'category_parent', 'orderby' => 'name', 'selected' => $category->parent, 'hierarchical' => true, 'show_option_none' => __('None'))); ?><br />
|
||||
<?php wp_dropdown_categories('hide_empty=0&name=category_parent&orderby=name&selected=' . $category->parent . '&hierarchical=1&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>
|
||||
|
||||
@@ -12,7 +12,8 @@ if ( !empty( $_REQUEST['delete_comments'] ) ) {
|
||||
$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( $wpdb->prepare( "SELECT comment_post_ID FROM $wpdb->comments WHERE comment_ID = %d", $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") );
|
||||
if ( !current_user_can('edit_post', $post_id) )
|
||||
continue;
|
||||
if ( !empty( $_REQUEST['spamit'] ) ) {
|
||||
@@ -96,7 +97,7 @@ if ( isset( $_GET['approved'] ) || isset( $_GET['deleted'] ) || isset( $_GET['sp
|
||||
<?php
|
||||
$status_links = array();
|
||||
$num_comments = wp_count_comments();
|
||||
$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'));
|
||||
$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'));
|
||||
$class = ( '' === $comment_status ) ? ' class="current"' : '';
|
||||
$status_links[] = "<li><a href=\"edit-comments.php\"$class>".__('Show All Comments')."</a>";
|
||||
foreach ( $stati as $status => $label ) {
|
||||
@@ -116,7 +117,6 @@ unset($status_links);
|
||||
</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>
|
||||
@@ -132,24 +132,22 @@ unset($status_links);
|
||||
|
||||
<?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 ) * $comments_per_page;
|
||||
$start = $offset = ( $page - 1 ) * 20;
|
||||
|
||||
list($_comments, $total) = _wp_get_comment_list( $comment_status, $search_dirty, $start, $comments_per_page + 5 ); // Grab a few extra
|
||||
list($_comments, $total) = _wp_get_comment_list( $comment_status, $search_dirty, $start, 25 ); // Grab a few extra
|
||||
|
||||
$comments = array_slice($_comments, 0, $comments_per_page);
|
||||
$extra_comments = array_slice($_comments, $comments_per_page);
|
||||
$comments = array_slice($_comments, 0, 20);
|
||||
$extra_comments = array_slice($_comments, 20);
|
||||
|
||||
$page_links = paginate_links( array(
|
||||
'base' => add_query_arg( 'apage', '%#%' ),
|
||||
'format' => '',
|
||||
'total' => ceil($total / $comments_per_page),
|
||||
'total' => ceil($total / 20),
|
||||
'current' => $page
|
||||
));
|
||||
|
||||
@@ -188,7 +186,7 @@ if ($comments) {
|
||||
<table class="widefat">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
||||
<th scope="col" class="check-column"><input type="checkbox" onclick="checkAll(document.getElementById('comments-form'));" /></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>
|
||||
|
||||
@@ -1,44 +1,12 @@
|
||||
<?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.');
|
||||
$messages[5] = sprintf( __('Post restored to revision from %s'), wp_post_revision_title( $_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; ?>
|
||||
@@ -52,15 +20,33 @@ if ( !isset($post_ID) || 0 == $post_ID ) {
|
||||
<h2><?php _e('Write Post') ?></h2>
|
||||
<?php
|
||||
|
||||
if ( !isset($post_ID) || 0 == $post_ID)
|
||||
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' />";
|
||||
wp_nonce_field('add-post');
|
||||
else
|
||||
} else {
|
||||
$post_ID = (int) $post_ID;
|
||||
$form_action = 'editpost';
|
||||
$form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />";
|
||||
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') ) . '" />';
|
||||
|
||||
?>
|
||||
@@ -97,13 +83,10 @@ else
|
||||
|
||||
<div class="inside">
|
||||
|
||||
<p><strong><label for='post_status'><?php _e('Publish Status') ?></label></strong></p>
|
||||
<p><strong><?php _e('Publish Status') ?></strong></p>
|
||||
<p>
|
||||
<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) ) ) :
|
||||
?>
|
||||
<select name='post_status' tabindex='4'>
|
||||
<?php if ( current_user_can('publish_posts') ) : // Contributors only get "Unpublished" and "Pending Review" ?>
|
||||
<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>
|
||||
@@ -173,7 +156,6 @@ if ( ( 'edit' == $action) && current_user_can('delete_post', $post_ID) )
|
||||
<br class="clear" />
|
||||
<?php endif; ?>
|
||||
<span id="autosave"></span>
|
||||
<span id="wp-word-count"></span>
|
||||
</p>
|
||||
|
||||
<div class="side-info">
|
||||
@@ -190,9 +172,6 @@ if ( ( 'edit' == $action) && current_user_can('delete_post', $post_ID) )
|
||||
<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'); ?>
|
||||
@@ -200,7 +179,7 @@ if ( ( 'edit' == $action) && current_user_can('delete_post', $post_ID) )
|
||||
|
||||
<div id="post-body">
|
||||
<div id="titlediv">
|
||||
<h3><label for="title"><?php _e('Title') ?></label></h3>
|
||||
<h3><?php _e('Title') ?></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>
|
||||
@@ -215,7 +194,7 @@ endif; ?>
|
||||
</div>
|
||||
|
||||
<div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea">
|
||||
<h3><label for="content"><?php _e('Post') ?></label></h3>
|
||||
<h3><?php _e('Post') ?></h3>
|
||||
<?php the_editor($post->post_content); ?>
|
||||
<?php wp_nonce_field( 'autosave', 'autosavenonce', false ); ?>
|
||||
<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
|
||||
@@ -226,22 +205,23 @@ endif; ?>
|
||||
<?php echo $form_pingback ?>
|
||||
<?php echo $form_prevstatus ?>
|
||||
|
||||
<?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="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>
|
||||
<div id="tagchecklist"></div>
|
||||
<?php
|
||||
}
|
||||
add_meta_box('tagsdiv', __('Tags'), 'post_tags_meta_box', 'post', 'normal', 'core');
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="categorydiv" class="postbox <?php echo postbox_classes('categorydiv', 'post'); ?>">
|
||||
<h3><?php _e('Categories') ?></h3>
|
||||
<div class="inside">
|
||||
|
||||
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">
|
||||
<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="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 ) ); ?>
|
||||
<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>
|
||||
@@ -261,13 +241,12 @@ function post_categories_meta_box($post) {
|
||||
|
||||
<div id="categories-all" class="ui-tabs-panel">
|
||||
<ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
|
||||
<?php wp_category_checklist($post->ID, false, false, $popular_ids) ?>
|
||||
<?php wp_category_checklist($post_ID) ?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
add_meta_box('categorydiv', __('Categories'), 'post_categories_meta_box', 'post', 'normal', 'core');
|
||||
?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php do_meta_boxes('post', 'normal', $post); ?>
|
||||
|
||||
@@ -275,41 +254,32 @@ add_meta_box('categorydiv', __('Categories'), 'post_categories_meta_box', 'post'
|
||||
|
||||
<h2><?php _e('Advanced Options'); ?></h2>
|
||||
|
||||
<?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>
|
||||
<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>
|
||||
<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>
|
||||
<?php
|
||||
}
|
||||
add_meta_box('postexcerpt', __('Excerpt'), 'post_excerpt_meta_box', 'post', 'advanced', 'core');
|
||||
</div>
|
||||
</div>
|
||||
|
||||
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>';
|
||||
}
|
||||
|
||||
?>
|
||||
<p><label for="trackback"><?php _e('Send trackbacks to:'); ?></label> <?php echo $form_trackback; ?><br /> (<?php _e('Separate multiple URLs with spaces'); ?>)</p>
|
||||
<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><?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;
|
||||
}
|
||||
add_meta_box('trackbacksdiv', __('Trackbacks'), 'post_trackback_meta_box', 'post', 'advanced', 'core');
|
||||
|
||||
function post_custom_meta_box($post) {
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="postcustom" class="postbox <?php echo postbox_classes('postcustom', 'post'); ?>">
|
||||
<h3><?php _e('Custom Fields') ?></h3>
|
||||
<div class="inside">
|
||||
<div id="postcustomstuff">
|
||||
<table cellpadding="3">
|
||||
<?php
|
||||
$metadata = has_meta($post->ID);
|
||||
$metadata = has_meta($post_ID);
|
||||
list_meta($metadata);
|
||||
?>
|
||||
|
||||
@@ -320,66 +290,55 @@ 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>
|
||||
<?php
|
||||
}
|
||||
add_meta_box('postcustom', __('Custom Fields'), 'post_custom_meta_box', 'post', 'advanced', 'core');
|
||||
</div>
|
||||
</div>
|
||||
|
||||
do_action('dbx_post_advanced');
|
||||
<?php do_action('dbx_post_advanced'); ?>
|
||||
|
||||
function post_comment_status_meta_box($post) {
|
||||
?>
|
||||
<div id="commentstatusdiv" class="postbox <?php echo postbox_classes('commentstatusdiv', 'post'); ?>">
|
||||
<h3><?php _e('Comments & Pings') ?></h3>
|
||||
<div class="inside">
|
||||
<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>
|
||||
<?php
|
||||
}
|
||||
add_meta_box('commentstatusdiv', __('Comments & Pings'), 'post_comment_status_meta_box', 'post', 'advanced', 'core');
|
||||
</div>
|
||||
</div>
|
||||
|
||||
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>
|
||||
<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>
|
||||
<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>
|
||||
<?php
|
||||
}
|
||||
add_meta_box('passworddiv', __('Password Protect This Post'), 'post_password_meta_box', 'post', 'advanced', 'core');
|
||||
</div>
|
||||
</div>
|
||||
|
||||
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');
|
||||
<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
|
||||
$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;
|
||||
?>
|
||||
<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;
|
||||
<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; ?>
|
||||
|
||||
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_meta_boxes('post', 'advanced', $post); ?>
|
||||
|
||||
do_meta_boxes('post', 'advanced', $post);
|
||||
|
||||
do_action('dbx_post_sidebar');
|
||||
?>
|
||||
<?php do_action('dbx_post_sidebar'); ?>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
@@ -22,9 +22,9 @@ $form_extra = "' />\n<input type='hidden' name='comment_ID' value='" . $comment-
|
||||
|
||||
<div class="inside">
|
||||
|
||||
<p><strong><label for='comment_status'><?php _e('Approval Status') ?></label></strong></p>
|
||||
<p><strong><?php _e('Approval Status') ?></strong></p>
|
||||
<p>
|
||||
<select name='comment_status' id='comment_status'>
|
||||
<select name='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>
|
||||
@@ -64,28 +64,28 @@ echo "<a class='submitdelete' href='" . wp_nonce_url("comment.php?action=deletec
|
||||
|
||||
<div id="post-body">
|
||||
<div id="namediv" class="stuffbox">
|
||||
<h3><label for="name"><?php _e('Name') ?></label></h3>
|
||||
<h3><?php _e('Name') ?></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><label for="email"><?php _e('E-mail') ?></label></h3>
|
||||
<h3><?php _e('E-mail') ?></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><label for="newcomment_author_url"><?php _e('URL') ?></label></h3>
|
||||
<h3><?php _e('URL') ?></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><label for="content"><?php _e('Comment') ?></label></h3>
|
||||
<h3><?php _e('Comment') ?></h3>
|
||||
<?php the_editor($comment->comment_content, 'content', 'newcomment_author_url', false, 4); ?>
|
||||
<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
|
||||
</div>
|
||||
|
||||
@@ -62,7 +62,6 @@ endif; ?>
|
||||
<?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>
|
||||
@@ -102,7 +101,7 @@ if ( $page_links )
|
||||
<table class="widefat">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
||||
<th scope="col" class="check-column"><input type="checkbox" onclick="checkAll(document.getElementById('posts-filter'));" /></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>
|
||||
|
||||
@@ -26,11 +26,11 @@ if ( ! empty($cat_ID) ) {
|
||||
<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" aria-required="true" /></td>
|
||||
<td><input name="name" id="name" type="text" value="<?php echo $category->name; ?>" size="40" /></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 attribute_escape(apply_filters('editable_slug', $category->slug)); ?>" size="40" />
|
||||
<td><input name="slug" id="slug" type="text" value="<?php echo $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">
|
||||
|
||||
@@ -74,7 +74,7 @@ if ( ( 'edit' == $action) && current_user_can('manage_links') )
|
||||
|
||||
<div id="post-body">
|
||||
<div id="namediv" class="stuffbox">
|
||||
<h3><label for="link_name"><?php _e('Name') ?></label></h3>
|
||||
<h3><?php _e('Name') ?></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'); ?>
|
||||
@@ -82,7 +82,7 @@ if ( ( 'edit' == $action) && current_user_can('manage_links') )
|
||||
</div>
|
||||
|
||||
<div id="addressdiv" class="stuffbox">
|
||||
<h3><label for="link_url"><?php _e('Web Address') ?></label></h3>
|
||||
<h3><?php _e('Web Address') ?></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>'); ?>
|
||||
@@ -90,19 +90,21 @@ if ( ( 'edit' == $action) && current_user_can('manage_links') )
|
||||
</div>
|
||||
|
||||
<div id="descriptiondiv" class="stuffbox">
|
||||
<h3><label for="link_description"><?php _e('Description') ?></label></h3>
|
||||
<h3><?php _e('Description') ?></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>
|
||||
|
||||
<?php function link_categories_meta_box($link) { ?>
|
||||
<div id="linkcategorydiv" class="postbox <?php echo postbox_classes('linkcategorydiv', 'link'); ?>">
|
||||
<h3><?php _e('Categories') ?></h3>
|
||||
<div class="inside">
|
||||
|
||||
<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">
|
||||
<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="text" name="newcat" id="newcat" class="form-required form-input-tip" value="<?php _e( 'New category name' ); ?>" />
|
||||
<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>
|
||||
@@ -116,7 +118,7 @@ if ( ( 'edit' == $action) && current_user_can('manage_links') )
|
||||
|
||||
<div id="categories-all" class="ui-tabs-panel">
|
||||
<ul id="categorychecklist" class="list:category categorychecklist form-no-clear">
|
||||
<?php wp_link_category_checklist($link->link_id); ?>
|
||||
<?php wp_link_category_checklist($link_id); ?>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
@@ -125,17 +127,17 @@ if ( ( 'edit' == $action) && current_user_can('manage_links') )
|
||||
<?php wp_popular_terms_checklist('link_category'); ?>
|
||||
</ul>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
add_meta_box('linkcategorydiv', __('Categories'), 'link_categories_meta_box', 'link', 'normal', 'core');
|
||||
?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php do_meta_boxes('link', 'normal', $link); ?>
|
||||
|
||||
<h2><?php _e('Advanced Options'); ?></h2>
|
||||
|
||||
<?php function link_target_meta_box($link) { ?>
|
||||
<fieldset><legend class="hidden"><?php _e('Target') ?></legend>
|
||||
<div id="linktargetdiv" class="postbox <?php echo postbox_classes('linktargetdiv', 'link'); ?>">
|
||||
<h3><?php _e('Target') ?></h3>
|
||||
<div class="inside">
|
||||
<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 />
|
||||
@@ -145,17 +147,16 @@ add_meta_box('linkcategorydiv', __('Categories'), 'link_categories_meta_box', 'l
|
||||
<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>
|
||||
<?php
|
||||
}
|
||||
add_meta_box('linktargetdiv', __('Target'), 'link_target_meta_box', 'link', 'advanced', 'core');
|
||||
</div>
|
||||
</div>
|
||||
|
||||
function link_xfn_meta_box($link) {
|
||||
?>
|
||||
<div id="linkxfndiv" class="postbox <?php echo postbox_classes('linkxfndiv', 'link'); ?>">
|
||||
<h3><?php _e('Link Relationship (XFN)') ?></h3>
|
||||
<div class="inside">
|
||||
<table class="editform" style="width: 100%;" cellspacing="2" cellpadding="5">
|
||||
<tr>
|
||||
<th style="width: 20%;" scope="row"><label for="link_rel"><?php _e('rel:') ?></label></th>
|
||||
<th style="width: 20%;" scope="row"><?php _e('rel:') ?></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>
|
||||
@@ -163,15 +164,15 @@ function link_xfn_meta_box($link) {
|
||||
<table cellpadding="3" cellspacing="5" class="form-table">
|
||||
<tr>
|
||||
<th scope="row"> <?php _e('identity') ?> </th>
|
||||
<td><fieldset><legend class="hidden"> <?php _e('identity') ?> </legend>
|
||||
<td>
|
||||
<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>
|
||||
</fieldset></td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"> <?php _e('friendship') ?> </th>
|
||||
<td><fieldset><legend class="hidden"> <?php _e('friendship') ?> </legend>
|
||||
<td>
|
||||
<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">
|
||||
@@ -180,30 +181,30 @@ function link_xfn_meta_box($link) {
|
||||
<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>
|
||||
</fieldset></td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"> <?php _e('physical') ?> </th>
|
||||
<td><fieldset><legend class="hidden"> <?php _e('physical') ?> </legend>
|
||||
<td>
|
||||
<label for="met">
|
||||
<input class="valinp" type="checkbox" name="physical" value="met" id="met" <?php xfn_check('physical', 'met'); ?> />
|
||||
<?php _e('met') ?></label>
|
||||
</fieldset></td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"> <?php _e('professional') ?> </th>
|
||||
<td><fieldset><legend class="hidden"> <?php _e('professional') ?> </legend>
|
||||
<td>
|
||||
<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>
|
||||
</fieldset></td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"> <?php _e('geographical') ?> </th>
|
||||
<td><fieldset><legend class="hidden"> <?php _e('geographical') ?> </legend>
|
||||
<td>
|
||||
<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>
|
||||
@@ -213,11 +214,11 @@ function link_xfn_meta_box($link) {
|
||||
<label for="geographical">
|
||||
<input class="valinp" type="radio" name="geographical" value="" id="geographical" <?php xfn_check('geographical', '', 'radio'); ?> />
|
||||
<?php _e('none') ?></label>
|
||||
</fieldset></td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"> <?php _e('family') ?> </th>
|
||||
<td><fieldset><legend class="hidden"> <?php _e('family') ?> </legend>
|
||||
<td>
|
||||
<label for="child">
|
||||
<input class="valinp" type="radio" name="family" value="child" id="child" <?php xfn_check('family', 'child', 'radio'); ?> />
|
||||
<?php _e('child') ?></label>
|
||||
@@ -236,11 +237,11 @@ function link_xfn_meta_box($link) {
|
||||
<label for="family">
|
||||
<input class="valinp" type="radio" name="family" value="" id="family" <?php xfn_check('family', '', 'radio'); ?> />
|
||||
<?php _e('none') ?></label>
|
||||
</fieldset></td>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row"> <?php _e('romantic') ?> </th>
|
||||
<td><fieldset><legend class="hidden"> <?php _e('romantic') ?> </legend>
|
||||
<td>
|
||||
<label for="muse">
|
||||
<input class="valinp" type="checkbox" name="romantic" value="muse" id="muse" <?php xfn_check('romantic', 'muse'); ?> />
|
||||
<?php _e('muse') ?></label>
|
||||
@@ -253,19 +254,19 @@ function link_xfn_meta_box($link) {
|
||||
<label for="romantic">
|
||||
<input class="valinp" type="checkbox" name="romantic" value="sweetheart" id="romantic" <?php xfn_check('romantic', 'sweetheart'); ?> />
|
||||
<?php _e('sweetheart') ?></label>
|
||||
</fieldset></td>
|
||||
</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>
|
||||
<?php
|
||||
}
|
||||
add_meta_box('linkxfndiv', __('Link Relationship (XFN)'), 'link_xfn_meta_box', 'link', 'advanced', 'core');
|
||||
</div>
|
||||
</div>
|
||||
|
||||
function link_advanced_meta_box($link) {
|
||||
?>
|
||||
<div id="linkadvanceddiv" class="postbox <?php echo postbox_classes('linkadvanceddiv', 'link'); ?>">
|
||||
<h3><?php _e('Advanced') ?></h3>
|
||||
<div class="inside">
|
||||
<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>
|
||||
@@ -293,13 +294,12 @@ function link_advanced_meta_box($link) {
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<?php
|
||||
}
|
||||
add_meta_box('linkadvanceddiv', __('Advanced'), 'link_advanced_meta_box', 'link', 'advanced', 'core');
|
||||
</div>
|
||||
</div>
|
||||
|
||||
do_meta_boxes('link', 'advanced', $link);
|
||||
<?php do_meta_boxes('link', 'advanced', $link); ?>
|
||||
|
||||
if ( $link_id ) : ?>
|
||||
<?php 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); ?>" />
|
||||
|
||||
@@ -5,9 +5,10 @@ $messages[1] = sprintf( __( 'Page updated. Continue editing below or <a href="%s
|
||||
$messages[2] = __('Custom field updated.');
|
||||
$messages[3] = __('Custom field deleted.');
|
||||
$messages[4] = __('Page updated.');
|
||||
|
||||
$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>.' );
|
||||
?>
|
||||
<?php if (isset($_GET['message'])) : ?>
|
||||
<div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div>
|
||||
<?php endif;
|
||||
|
||||
if (!isset($post_ID) || 0 == $post_ID) {
|
||||
$form_action = 'post';
|
||||
@@ -19,9 +20,6 @@ if (!isset($post_ID) || 0 == $post_ID) {
|
||||
$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;
|
||||
@@ -33,13 +31,6 @@ 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>
|
||||
@@ -53,7 +44,6 @@ if (isset($mode) && 'bookmarklet' == $mode)
|
||||
<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 ?>" />
|
||||
@@ -78,14 +68,14 @@ else
|
||||
</div>
|
||||
|
||||
<div class="inside">
|
||||
<p><strong><label for='post_status'><?php _e('Publish Status') ?></label></strong></p>
|
||||
|
||||
<p><strong><?php _e('Publish Status') ?></strong></p>
|
||||
<p>
|
||||
<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) ) ) :
|
||||
?>
|
||||
<select name='post_status' tabindex='4'>
|
||||
<?php if ( current_user_can('publish_pages') ) : ?>
|
||||
<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>
|
||||
@@ -94,10 +84,8 @@ if ( current_user_can('publish_pages') OR ( $post->post_status == 'publish' AND
|
||||
<option<?php selected( $post->post_status, 'draft' ); ?> value='draft'><?php _e('Unpublished') ?></option>
|
||||
</select>
|
||||
</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 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
|
||||
@@ -152,7 +140,6 @@ if ( ('edit' == $action) && current_user_can('delete_page', $post_ID) )
|
||||
<br class="clear" />
|
||||
<?php endif; ?>
|
||||
<span id="autosave"></span>
|
||||
<span id="wp-word-count"></span>
|
||||
</p>
|
||||
|
||||
<div class="side-info">
|
||||
@@ -172,7 +159,7 @@ if ( ('edit' == $action) && current_user_can('delete_page', $post_ID) )
|
||||
|
||||
<div id="post-body">
|
||||
<div id="titlediv">
|
||||
<h3><label for="title"><?php _e('Title') ?></label></h3>
|
||||
<h3><?php _e('Title') ?></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>
|
||||
@@ -187,7 +174,7 @@ endif; ?>
|
||||
</div>
|
||||
|
||||
<div id="<?php echo user_can_richedit() ? 'postdivrich' : 'postdiv'; ?>" class="postarea">
|
||||
<h3><label for="content"><?php _e('Page') ?></label></h3>
|
||||
<h3><?php _e('Page') ?></h3>
|
||||
<?php the_editor($post->post_content); ?>
|
||||
<?php wp_nonce_field( 'autosave', 'autosavenonce', false ); ?>
|
||||
<?php wp_nonce_field( 'closedpostboxes', 'closedpostboxesnonce', false ); ?>
|
||||
@@ -201,14 +188,13 @@ endif; ?>
|
||||
|
||||
<h2><?php _e('Advanced Options'); ?></h2>
|
||||
|
||||
|
||||
<?php
|
||||
function page_custom_meta_box($post){
|
||||
?>
|
||||
<div id="pagepostcustom" class="postbox <?php echo postbox_classes('pagepostcustom', 'page'); ?>">
|
||||
<h3><?php _e('Custom Fields') ?></h3>
|
||||
<div class="inside">
|
||||
<div id="postcustomstuff">
|
||||
<table cellpadding="3">
|
||||
<?php
|
||||
$metadata = has_meta($post->ID);
|
||||
$metadata = has_meta($post_ID);
|
||||
list_meta($metadata);
|
||||
?>
|
||||
|
||||
@@ -219,97 +205,83 @@ 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>
|
||||
<?php
|
||||
}
|
||||
add_meta_box('pagecustomdiv', __('Custom Fields'), 'page_custom_meta_box', 'page', 'advanced', 'core');
|
||||
</div>
|
||||
</div>
|
||||
|
||||
function page_comments_status_meta_box($post){
|
||||
?>
|
||||
<div id="pagecommentstatusdiv" class="postbox <?php echo postbox_classes('pagecommentstatusdiv', 'page'); ?>">
|
||||
<h3><?php _e('Comments & Pings') ?></h3>
|
||||
<div class="inside">
|
||||
<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>
|
||||
<?php
|
||||
}
|
||||
add_meta_box('pagecommentstatusdiv', __('Comments & Pings'), 'page_comments_status_meta_box', 'page', 'advanced', 'core');
|
||||
</div>
|
||||
</div>
|
||||
|
||||
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>
|
||||
<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>
|
||||
<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>
|
||||
<?php
|
||||
}
|
||||
add_meta_box('pagepassworddiv', __('Password Protect This Page'), 'page_password_meta_box', 'page', 'advanced', 'core');
|
||||
</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="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_parent_meta_box($post){
|
||||
?>
|
||||
<label class="hidden" for="parent_id"><?php _e('Page Parent') ?></label>
|
||||
<select name="parent_id" id="parent_id">
|
||||
<div id="pageparentdiv" class="postbox <?php echo postbox_classes('pageparentdiv', 'page'); ?>">
|
||||
<h3><?php _e('Page Parent') ?></h3>
|
||||
<div class="inside">
|
||||
<select name="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>
|
||||
<?php
|
||||
}
|
||||
add_meta_box('pageparentdiv', __('Page Parent'), 'page_parent_meta_box', 'page', 'advanced', 'core');
|
||||
</div>
|
||||
</div>
|
||||
|
||||
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">
|
||||
<?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">
|
||||
<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>
|
||||
<?php
|
||||
}
|
||||
add_meta_box('pagetemplatediv', __('Page Template'), 'page_template_meta_box', 'page', 'advanced', 'core');
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
<?php } ?>
|
||||
|
||||
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>
|
||||
<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>
|
||||
<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 ) {
|
||||
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;
|
||||
if ( $authors && count( $authors ) > 1 ) :
|
||||
?>
|
||||
<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');
|
||||
}
|
||||
<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; ?>
|
||||
|
||||
|
||||
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);
|
||||
?>
|
||||
<?php do_meta_boxes('page', 'advanced', $post); ?>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -20,8 +20,8 @@ if ( isset($_GET['deleteit']) && isset($_GET['delete']) ) {
|
||||
}
|
||||
|
||||
$sendback = wp_get_referer();
|
||||
if (strpos($sendback, 'page.php') !== false) $sendback = admin_url('page-new.php');
|
||||
elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
|
||||
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';
|
||||
$sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
|
||||
|
||||
wp_redirect($sendback);
|
||||
@@ -111,32 +111,12 @@ endif;
|
||||
?>
|
||||
|
||||
<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 || $pre_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'); ?>
|
||||
@@ -170,7 +150,7 @@ if ($posts) {
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php page_rows($posts, $pagenum, $per_page); ?>
|
||||
<?php page_rows($posts); ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
@@ -188,10 +168,6 @@ if ($posts) {
|
||||
?>
|
||||
|
||||
<div class="tablenav">
|
||||
<?php
|
||||
if ( $page_links )
|
||||
echo "<div class='tablenav-pages'>$page_links</div>";
|
||||
?>
|
||||
<br class="clear" />
|
||||
</div>
|
||||
|
||||
@@ -199,7 +175,7 @@ if ( $page_links )
|
||||
|
||||
if ( 1 == count($posts) && is_singular() ) :
|
||||
|
||||
$comments = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved != 'spam' ORDER BY comment_date", $id) );
|
||||
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date");
|
||||
if ( $comments ) :
|
||||
// Make sure comments, post, and post_author are cached
|
||||
update_comment_cache($comments);
|
||||
|
||||
@@ -26,12 +26,12 @@ if ( ! empty($tag_ID) ) {
|
||||
<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" aria-required="true" />
|
||||
<td><input name="name" id="name" type="text" value="<?php echo attribute_escape($tag->name); ?>" size="40" />
|
||||
<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(apply_filters('editable_slug', $tag->slug)); ?>" size="40" />
|
||||
<td><input name="slug" id="slug" type="text" value="<?php echo attribute_escape($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>
|
||||
|
||||
@@ -133,7 +133,6 @@ endif; ?>
|
||||
<?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>
|
||||
@@ -173,7 +172,7 @@ if ( $page_links )
|
||||
<table class="widefat">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
||||
<th scope="col" class="check-column"><input type="checkbox" onclick="checkAll(document.getElementById('posts-filter'));" /></th>
|
||||
<th scope="col"><?php _e('Name') ?></th>
|
||||
<th scope="col" class="num" style="width: 90px"><?php _e('Posts') ?></th>
|
||||
</tr>
|
||||
|
||||
@@ -20,8 +20,8 @@ if ( isset($_GET['deleteit']) && isset($_GET['delete']) ) {
|
||||
}
|
||||
|
||||
$sendback = wp_get_referer();
|
||||
if (strpos($sendback, 'post.php') !== false) $sendback = admin_url('post-new.php');
|
||||
elseif (strpos($sendback, 'attachments.php') !== false) $sendback = admin_url('attachments.php');
|
||||
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';
|
||||
$sendback = preg_replace('|[^a-z0-9-~+_.?#=&;,/:]|i', '', $sendback);
|
||||
|
||||
wp_redirect($sendback);
|
||||
@@ -116,7 +116,6 @@ endif;
|
||||
?>
|
||||
|
||||
<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>
|
||||
@@ -206,7 +205,7 @@ if ( $page_links )
|
||||
|
||||
if ( 1 == count($posts) && is_singular() ) :
|
||||
|
||||
$comments = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved != 'spam' ORDER BY comment_date", $id) );
|
||||
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $id AND comment_approved != 'spam' ORDER BY comment_date");
|
||||
if ( $comments ) :
|
||||
// Make sure comments, post, and post_author are cached
|
||||
update_comment_cache($comments);
|
||||
|
||||
@@ -22,9 +22,9 @@ require_once ('admin-header.php');
|
||||
|
||||
<table class="form-table">
|
||||
<tr>
|
||||
<th><label for="author"><?php _e('Restrict Author'); ?></label></th>
|
||||
<th><?php _e('Restrict Author'); ?></th>
|
||||
<td>
|
||||
<select name="author" id="author">
|
||||
<select name="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" );
|
||||
|
||||
@@ -1,207 +0,0 @@
|
||||
<?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; ?>_20080710a",
|
||||
"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" },
|
||||
|
||||
{ "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" },
|
||||
|
||||
{ "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=311d" },
|
||||
{ "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=311d" },
|
||||
{ "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=311d" },
|
||||
{ "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" }
|
||||
]}
|
||||
|
Before Width: | Height: | Size: 16 KiB |
|
Before Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 1.2 KiB |
|
Before Width: | Height: | Size: 792 B |
|
Before Width: | Height: | Size: 62 B |
|
Before Width: | Height: | Size: 1006 B |
|
Before Width: | Height: | Size: 612 B |
@@ -641,7 +641,7 @@ class Blogger_Import {
|
||||
$host = $this->blogs[$importing_blog]['host'];
|
||||
|
||||
// Get an array of posts => authors
|
||||
$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 = (array) $wpdb->get_col("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = 'blogger_blog' AND meta_value = '$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 )
|
||||
@@ -658,7 +658,7 @@ class Blogger_Import {
|
||||
$post_ids = (array) array_keys( $authors_posts, $this->blogs[$importing_blog]['authors'][$author][0] );
|
||||
$post_ids = join( ',', $post_ids);
|
||||
|
||||
$wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_author = %d WHERE id IN ($post_ids)", $user_id) );
|
||||
$wpdb->query("UPDATE $wpdb->posts SET post_author = $user_id WHERE id IN ($post_ids)");
|
||||
$this->blogs[$importing_blog]['authors'][$author][1] = $user_id;
|
||||
}
|
||||
$this->save_vars();
|
||||
|
||||
@@ -13,7 +13,7 @@ if(!function_exists('get_comment_count'))
|
||||
function get_comment_count($post_ID)
|
||||
{
|
||||
global $wpdb;
|
||||
return $wpdb->get_var( $wpdb->prepare("SELECT count(*) FROM $wpdb->comments WHERE comment_post_ID = %d", $post_ID) );
|
||||
return $wpdb->get_var('SELECT count(*) FROM '.$wpdb->comments.' WHERE comment_post_ID = '.$post_ID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,7 +22,7 @@ if(!function_exists('link_exists'))
|
||||
function link_exists($linkname)
|
||||
{
|
||||
global $wpdb;
|
||||
return $wpdb->get_var( $wpdb->prepare("SELECT link_id FROM $wpdb->links WHERE link_name = %s", $linkname) );
|
||||
return $wpdb->get_var('SELECT link_id FROM '.$wpdb->links.' WHERE link_name = "'.$linkname.'"');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,16 +38,16 @@ class GM_Import {
|
||||
<h3><?php _e('Second step: GreyMatter details:') ?></h3>
|
||||
<table class="form-table">
|
||||
<tr>
|
||||
<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>
|
||||
<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>
|
||||
</tr>
|
||||
<tr>
|
||||
<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>
|
||||
<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>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="lastentry"><?php _e("Last entry's number:") ?></label></td>
|
||||
<td><input type="text" name="lastentry" id="lastentry" value="00000001" /><br />
|
||||
<td><?php _e("Last entry's number:") ?></td>
|
||||
<td><input type="text" name="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>
|
||||
|
||||
@@ -166,9 +166,9 @@ class MT_Import {
|
||||
$j = -1;
|
||||
foreach ($authors as $author) {
|
||||
++ $j;
|
||||
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 />');
|
||||
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 />');
|
||||
$this->users_form($j);
|
||||
echo '</label></li>';
|
||||
echo '</li>';
|
||||
}
|
||||
|
||||
echo '<input type="submit" value="'.__('Submit').'">'.'<br />';
|
||||
@@ -179,7 +179,7 @@ class MT_Import {
|
||||
|
||||
function select_authors() {
|
||||
if ( $_POST['upload_type'] === 'ftp' ) {
|
||||
$file['file'] = WP_CONTENT_DIR . '/mt-export.txt';
|
||||
$file['file'] = ABSPATH . 'wp-content/mt-export.txt';
|
||||
if ( !file_exists($file['file']) )
|
||||
$file['error'] = __('<code>mt-export.txt</code> does not exist');
|
||||
} else {
|
||||
@@ -426,7 +426,7 @@ class MT_Import {
|
||||
function import() {
|
||||
$this->id = (int) $_GET['id'];
|
||||
if ( $this->id == 0 )
|
||||
$this->file = WP_CONTENT_DIR . '/mt-export.txt';
|
||||
$this->file = ABSPATH . 'wp-content/mt-export.txt';
|
||||
else
|
||||
$this->file = get_attached_file($this->id);
|
||||
$this->get_authors_from_post();
|
||||
|
||||
@@ -8,7 +8,7 @@ if(!function_exists('get_comment_count'))
|
||||
function get_comment_count($post_ID)
|
||||
{
|
||||
global $wpdb;
|
||||
return $wpdb->get_var( $wpdb->prepare("SELECT count(*) FROM $wpdb->comments WHERE comment_post_ID = %d", $post_ID) );
|
||||
return $wpdb->get_var('SELECT count(*) FROM '.$wpdb->comments.' WHERE comment_post_ID = '.$post_ID);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ if(!function_exists('link_exists'))
|
||||
function link_exists($linkname)
|
||||
{
|
||||
global $wpdb;
|
||||
return $wpdb->get_var( $wpdb->prepare("SELECT link_id FROM $wpdb->links WHERE link_name = %s", $linkname) );
|
||||
return $wpdb->get_var('SELECT link_id FROM '.$wpdb->links.' WHERE link_name = "'.$wpdb->escape($linkname).'"');
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -218,7 +218,7 @@ class WP_Import {
|
||||
function users_form($n, $author) {
|
||||
|
||||
if ( $this->allow_create_users() ) {
|
||||
printf('<label>'.__('Create user %1$s or map to existing'), ' <input type="text" value="'.$author.'" name="'.'user_create['.intval($n).']'.'" maxlength="30"></label> <br />');
|
||||
printf(__('Create user %1$s or map to existing'), ' <input type="text" value="'.$author.'" name="'.'user_create['.intval($n).']'.'" maxlength="30"> <br />');
|
||||
}
|
||||
else {
|
||||
echo __('Map to existing').'<br />';
|
||||
@@ -357,11 +357,6 @@ class WP_Import {
|
||||
$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);
|
||||
@@ -409,7 +404,7 @@ class WP_Import {
|
||||
|
||||
$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_excerpt', '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_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 )
|
||||
|
||||
@@ -3,71 +3,50 @@
|
||||
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">';
|
||||
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 }
|
||||
echo '<h2>' . __('Convert Categories to Tags') . '</h2>';
|
||||
}
|
||||
|
||||
function footer() {
|
||||
echo '</div>';
|
||||
}
|
||||
|
||||
function populate_cats() {
|
||||
function populate_all_categories() {
|
||||
global $wpdb;
|
||||
|
||||
$categories = get_categories('get=all');
|
||||
foreach ( $categories as $category ) {
|
||||
$this->all_categories[] = $category;
|
||||
if ( is_term( $category->slug, 'post_tag' ) )
|
||||
$this->hybrids_ids[] = $category->term_id;
|
||||
if ( !tag_exists($wpdb->escape($category->name)) )
|
||||
$this->all_categories[] = $category;
|
||||
}
|
||||
}
|
||||
|
||||
function populate_tags() {
|
||||
function welcome() {
|
||||
$this->populate_all_categories();
|
||||
|
||||
$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;
|
||||
}
|
||||
}
|
||||
echo '<div class="narrow">';
|
||||
|
||||
function categories_tab() {
|
||||
$this->populate_cats();
|
||||
$cat_num = count($this->all_categories);
|
||||
|
||||
echo '<br class="clear" />';
|
||||
|
||||
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>';
|
||||
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>';
|
||||
|
||||
$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.catlist;
|
||||
field = document.formlist;
|
||||
if ( 'false' == checkflag ) {
|
||||
for ( i = 0; i < field.length; i++ ) {
|
||||
if ( 'cats_to_convert[]' == field[i].name )
|
||||
@@ -84,117 +63,54 @@ function check_all_rows() {
|
||||
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">';
|
||||
|
||||
<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');
|
||||
$hier = _get_term_hierarchy('category');
|
||||
|
||||
foreach ($this->all_categories as $category) {
|
||||
$category = sanitize_term( $category, 'category', 'display' );
|
||||
|
||||
if ( (int) $category->parent == 0 ) { ?>
|
||||
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>';
|
||||
|
||||
<li><label><input type="checkbox" name="cats_to_convert[]" value="<?php echo intval($category->term_id); ?>" /> <?php echo $category->name . ' (' . $category->count . ')'; ?></label><?php
|
||||
if (isset($hier[$category->term_id])) {
|
||||
$this->_category_children($category, $hier);
|
||||
}
|
||||
|
||||
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>
|
||||
|
||||
<?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>'; ?>
|
||||
|
||||
<p class="submit"><input type="submit" name="submit" class="button" value="<?php _e('Convert Categories to Tags'); ?>" /></p>
|
||||
</form>
|
||||
|
||||
<?php }
|
||||
|
||||
function tags_tab() {
|
||||
$this->populate_tags();
|
||||
$tags_num = count($this->all_tags);
|
||||
|
||||
echo '<br class="clear" />';
|
||||
|
||||
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>';
|
||||
|
||||
$this->tags_form();
|
||||
} else {
|
||||
echo '<p>'.__('You have no tags to convert!').'</p>';
|
||||
echo '</li>';
|
||||
}
|
||||
}
|
||||
|
||||
echo '</ul>';
|
||||
|
||||
echo '<p class="submit"><input type="submit" name="submit" class="button" value="' . __('Convert Tags') . '" /></p>';
|
||||
|
||||
echo '</form>';
|
||||
}
|
||||
|
||||
function tags_form() { ?>
|
||||
function _category_children($parent, $hier) {
|
||||
echo '<ul style="list-style:none">';
|
||||
|
||||
<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;
|
||||
foreach ($hier[$parent->term_id] as $child_id) {
|
||||
$child =& get_category($child_id);
|
||||
|
||||
echo '<li><label><input type="checkbox" name="cats_to_convert[]" value="' . intval($child->term_id) . '" /> ' . $child->name . ' (' . $child->count . ')</label>';
|
||||
|
||||
if (isset($hier[$child->term_id])) {
|
||||
$this->_category_children($child, $hier);
|
||||
}
|
||||
|
||||
echo '</li>';
|
||||
}
|
||||
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>
|
||||
|
||||
<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
|
||||
echo '</ul>';
|
||||
}
|
||||
|
||||
function _category_exists($cat_id) {
|
||||
@@ -209,238 +125,101 @@ function check_all_tagrows() {
|
||||
}
|
||||
}
|
||||
|
||||
function convert_categories() {
|
||||
function convert_them() {
|
||||
global $wpdb;
|
||||
|
||||
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 ( (!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 ( 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;
|
||||
|
||||
if ( ! $this->_category_exists($cat_id) ) {
|
||||
echo '<li>' . sprintf( __('Category %s doesn\'t exist!'), $cat_id ) . "</li>\n";
|
||||
echo '<li>' . sprintf(__('Converting category #%s ... '), $cat_id);
|
||||
|
||||
if (!$this->_category_exists($cat_id)) {
|
||||
_e('Category doesn\'t exist!');
|
||||
} else {
|
||||
$category =& get_category($cat_id);
|
||||
echo '<li>' . sprintf(__('Converting category <strong>%s</strong> ... '), $category->name);
|
||||
|
||||
if ( tag_exists($wpdb->escape($category->name)) ) {
|
||||
_e('Category is already a tag.');
|
||||
echo '</li>';
|
||||
continue;
|
||||
}
|
||||
|
||||
// If the category is the default, leave category in place and create tag.
|
||||
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));
|
||||
|
||||
if ( get_option('default_category') == $category->term_id ) {
|
||||
$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 ) {
|
||||
$values[] = $wpdb->prepare( "(%d, %d, %d)", $post, $id, $term_order);
|
||||
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')");
|
||||
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) );
|
||||
} 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);
|
||||
}
|
||||
|
||||
echo __('Converted successfully.') . "</li>\n";
|
||||
continue;
|
||||
// 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'");
|
||||
|
||||
$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);
|
||||
|
||||
// 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'");
|
||||
}
|
||||
|
||||
// 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;
|
||||
// Clean the cache
|
||||
clean_category_cache($category->term_id);
|
||||
|
||||
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";
|
||||
|
||||
$hybrid_cats = true;
|
||||
$clean_term_cache[] = $category->term_id;
|
||||
$clean_cat_cache[] = $category->term_id;
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
$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);
|
||||
}
|
||||
|
||||
// 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";
|
||||
_e('Converted successfully.');
|
||||
}
|
||||
|
||||
echo '</li>';
|
||||
}
|
||||
|
||||
echo '</ul>';
|
||||
|
||||
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');
|
||||
|
||||
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') ) {
|
||||
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');
|
||||
|
||||
switch ($step) {
|
||||
case 1 :
|
||||
$this->categories_tab();
|
||||
$this->welcome();
|
||||
break;
|
||||
|
||||
case 2 :
|
||||
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();
|
||||
$this->convert_them();
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -455,6 +234,6 @@ function check_all_tagrows() {
|
||||
|
||||
$wp_cat2tag_importer = new WP_Categories_to_Tags();
|
||||
|
||||
register_importer('wp-cat2tag', __('Categories and Tags Converter'), __('Convert existing categories to tags or tags to categories, selectively.'), array(&$wp_cat2tag_importer, 'init'));
|
||||
register_importer('wp-cat2tag', __('Categories to Tags Converter'), __('Convert existing categories to tags, selectively.'), array(&$wp_cat2tag_importer, 'init'));
|
||||
|
||||
?>
|
||||
?>
|
||||
@@ -47,7 +47,7 @@ function wp_delete_link($link_id) {
|
||||
|
||||
wp_delete_object_term_relationships($link_id, 'link_category');
|
||||
|
||||
$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->links WHERE link_id = %d", $link_id) );
|
||||
$wpdb->query("DELETE FROM $wpdb->links WHERE link_id = '$link_id'");
|
||||
|
||||
do_action('deleted_link', $link_id);
|
||||
|
||||
@@ -73,7 +73,7 @@ function wp_insert_link($linkdata) {
|
||||
$linkdata = wp_parse_args($linkdata, $defaults);
|
||||
$linkdata = sanitize_bookmark($linkdata, 'db');
|
||||
|
||||
extract(stripslashes_deep($linkdata), EXTR_SKIP);
|
||||
extract($linkdata, EXTR_SKIP);
|
||||
|
||||
$update = false;
|
||||
|
||||
@@ -119,14 +119,15 @@ function wp_insert_link($linkdata) {
|
||||
}
|
||||
|
||||
if ( $update ) {
|
||||
$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) );
|
||||
$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'");
|
||||
} else {
|
||||
$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) );
|
||||
$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')");
|
||||
$link_id = (int) $wpdb->insert_id;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,158 +0,0 @@
|
||||
<?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;
|
||||
}
|
||||
}
|
||||
?>
|
||||
@@ -1,46 +1,51 @@
|
||||
<?php
|
||||
|
||||
class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
||||
class WP_Filesystem_Direct{
|
||||
var $permission = null;
|
||||
var $errors = array();
|
||||
function WP_Filesystem_Direct($arg) {
|
||||
$this->method = 'direct';
|
||||
function WP_Filesystem_Direct($arg){
|
||||
$this->errors = new WP_Error();
|
||||
$this->permission = umask();
|
||||
}
|
||||
function connect() {
|
||||
function connect(){
|
||||
return true;
|
||||
}
|
||||
function setDefaultPermissions($perm) {
|
||||
function setDefaultPermissions($perm){
|
||||
$this->permission = $perm;
|
||||
}
|
||||
function get_contents($file) {
|
||||
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){
|
||||
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);
|
||||
@@ -49,7 +54,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
||||
|
||||
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) )
|
||||
@@ -57,7 +62,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
||||
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);
|
||||
@@ -66,51 +71,120 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
||||
|
||||
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 group($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){
|
||||
$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 {
|
||||
@@ -118,12 +192,12 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
@@ -132,7 +206,7 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
||||
|
||||
$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;
|
||||
|
||||
@@ -141,34 +215,34 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -177,38 +251,38 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
||||
$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 {
|
||||
@@ -219,9 +293,9 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
||||
|
||||
$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.
|
||||
@@ -241,9 +315,9 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
||||
$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();
|
||||
}
|
||||
@@ -254,5 +328,9 @@ class WP_Filesystem_Direct extends WP_Filesystem_Base {
|
||||
unset($dir);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function __destruct(){
|
||||
return;
|
||||
}
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
<?php
|
||||
class WP_Filesystem_FTPext extends WP_Filesystem_Base{
|
||||
class WP_Filesystem_FTPext{
|
||||
var $link;
|
||||
var $timeout = 5;
|
||||
var $errors = array();
|
||||
var $options = array();
|
||||
|
||||
var $wp_base = '';
|
||||
var $permission = null;
|
||||
|
||||
var $filetypes = array(
|
||||
@@ -23,7 +24,6 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base{
|
||||
);
|
||||
|
||||
function WP_Filesystem_FTPext($opt='') {
|
||||
$this->method = 'ftpext';
|
||||
$this->errors = new WP_Error();
|
||||
|
||||
//Check if possible to use ftp functions.
|
||||
@@ -60,11 +60,12 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base{
|
||||
$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']));
|
||||
@@ -79,11 +80,76 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base{
|
||||
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];
|
||||
}
|
||||
|
||||
function get_contents($file, $type = '', $resumepos = 0 ){
|
||||
//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){
|
||||
if( empty($type) ){
|
||||
$extension = substr(strrchr($file, "."), 1);
|
||||
$type = isset($this->filetypes[ $extension ]) ? $this->filetypes[ $extension ] : FTP_ASCII;
|
||||
@@ -91,7 +157,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base{
|
||||
$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 = '';
|
||||
@@ -101,132 +167,202 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base{
|
||||
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 group($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){
|
||||
$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 )
|
||||
@@ -237,7 +373,7 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base{
|
||||
$this->chgrp($path, $chgrp);
|
||||
return true;
|
||||
}
|
||||
function rmdir($path, $recursive = false) {
|
||||
function rmdir($path,$recursive=false){
|
||||
if( ! $recursive )
|
||||
return @ftp_rmdir($this->link, $path);
|
||||
|
||||
@@ -249,9 +385,9 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base{
|
||||
|
||||
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';
|
||||
@@ -309,15 +445,15 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base{
|
||||
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;
|
||||
@@ -328,10 +464,10 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base{
|
||||
if ( empty($entry) )
|
||||
continue;
|
||||
|
||||
if ( '.' == $entry["name"] || '..' == $entry["name"] )
|
||||
if ( $entry["name"]=="." or $entry["name"]==".." )
|
||||
continue;
|
||||
|
||||
$dirlist[ $entry['name'] ] = $entry;
|
||||
$dirlist[$entry['name']] = $entry;
|
||||
}
|
||||
|
||||
if ( ! $dirlist )
|
||||
@@ -349,11 +485,11 @@ class WP_Filesystem_FTPext extends WP_Filesystem_Base{
|
||||
//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
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
<?php
|
||||
class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
|
||||
class WP_Filesystem_ftpsockets{
|
||||
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,
|
||||
'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
|
||||
'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.
|
||||
@@ -86,109 +86,241 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
|
||||
$this->permission = $perm;
|
||||
}
|
||||
|
||||
function get_contents($file, $type = '', $resumepos = 0){
|
||||
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){
|
||||
if( ! $this->exists($file) )
|
||||
return false;
|
||||
|
||||
if( empty($type) ){
|
||||
$extension = substr(strrchr($file, '.'), 1);
|
||||
$extension = substr(strrchr($file, "."), 1);
|
||||
$type = isset($this->filetypes[ $extension ]) ? $this->filetypes[ $extension ] : FTP_AUTOASCII;
|
||||
}
|
||||
$this->ftp->SetType($type);
|
||||
$temp = wp_tempnam( $file );
|
||||
if ( ! $temphandle = fopen($temp, 'w+') )
|
||||
$temp = tmpfile();
|
||||
if ( ! $temp )
|
||||
return false;
|
||||
if ( ! $this->ftp->fget($temphandle, $file) ) {
|
||||
fclose($temphandle);
|
||||
unlink($temp);
|
||||
if ( ! $this->ftp->fget($temp, $file) ) {
|
||||
fclose($temp);
|
||||
return ''; //Blank document, File does exist, Its just blank.
|
||||
}
|
||||
fseek($temphandle, 0); //Skip back to the start of the file being written to
|
||||
fseek($temp, 0); //Skip back to the start of the file being written to
|
||||
$contents = '';
|
||||
while ( ! feof($temphandle) )
|
||||
$contents .= fread($temphandle, 8192);
|
||||
fclose($temphandle);
|
||||
unlink($temp);
|
||||
while ( !feof($temp) )
|
||||
$contents .= fread($temp, 8192);
|
||||
fclose($temp);
|
||||
return $contents;
|
||||
}
|
||||
|
||||
function get_contents_array($file){
|
||||
return explode("\n", $this->get_contents($file) );
|
||||
return explode("\n",$this->get_contents($file));
|
||||
}
|
||||
|
||||
function put_contents($file, $contents, $type = '' ) {
|
||||
function put_contents($file,$contents,$type=''){
|
||||
if( empty($type) ){
|
||||
$extension = substr(strrchr($file, '.'), 1);
|
||||
$type = isset($this->filetypes[ $extension ]) ? $this->filetypes[ $extension ] : FTP_AUTOASCII;
|
||||
$extension = substr(strrchr($file, "."), 1);
|
||||
$type = isset($this->filetypes[ $extension ]) ? $this->filetypes[ $extension ] : FTP_ASCII;
|
||||
}
|
||||
$this->ftp->SetType($type);
|
||||
|
||||
$temp = wp_tempnam( $file );
|
||||
if ( ! $temphandle = fopen($temp, 'w+') ){
|
||||
unlink($temp);
|
||||
$temp = tmpfile();
|
||||
if ( ! $temp )
|
||||
return false;
|
||||
}
|
||||
fwrite($temphandle, $contents);
|
||||
fseek($temphandle, 0); //Skip back to the start of the file being written to
|
||||
$ret = $this->ftp->fput($file, $temphandle);
|
||||
fclose($temphandle);
|
||||
unlink($temp);
|
||||
fwrite($temp,$contents);
|
||||
fseek($temp, 0); //Skip back to the start of the file being written to
|
||||
$ret = $this->ftp->fput($file, $temp);
|
||||
fclose($temp);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
function cwd() {
|
||||
function cwd(){
|
||||
$cwd = $this->ftp->pwd();
|
||||
if( $cwd )
|
||||
$cwd = trailingslashit($cwd);
|
||||
return $cwd;
|
||||
}
|
||||
|
||||
function chdir($file) {
|
||||
function chdir($file){
|
||||
return $this->ftp->chdir($file);
|
||||
}
|
||||
|
||||
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( ! $recursive || ! $this->is_dir($file) ){
|
||||
return $this->ftp->chmod($file,$mode);
|
||||
}
|
||||
//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 group($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){
|
||||
$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;
|
||||
|
||||
@@ -196,14 +328,14 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
|
||||
if ( false === $content )
|
||||
return false;
|
||||
|
||||
return $this->put_contents($destination, $content);
|
||||
return $this->put_contents($destination,$content);
|
||||
}
|
||||
|
||||
function move($source, $destination, $overwrite = false ) {
|
||||
return $this->ftp->rename($source, $destination);
|
||||
function move($source,$destination,$overwrite=false){
|
||||
return $this->ftp->rename($source,$destination);
|
||||
}
|
||||
|
||||
function delete($file, $recursive = false ) {
|
||||
function delete($file,$recursive=false) {
|
||||
if ( $this->is_file($file) )
|
||||
return $this->ftp->delete($file);
|
||||
if ( !$recursive )
|
||||
@@ -212,15 +344,15 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
|
||||
return $this->ftp->mdel($file);
|
||||
}
|
||||
|
||||
function exists($file) {
|
||||
function exists($file){
|
||||
return $this->ftp->is_exists($file);
|
||||
}
|
||||
|
||||
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();
|
||||
if ( $this->chdir($path) ) {
|
||||
$this->chdir($cwd);
|
||||
@@ -229,33 +361,33 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
|
||||
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 $this->ftp->mdtm($file);
|
||||
}
|
||||
|
||||
function size($file) {
|
||||
function size($file){
|
||||
return $this->ftp->filesize($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( ! $this->ftp->mkdir($path) )
|
||||
return false;
|
||||
if( $chmod )
|
||||
@@ -267,15 +399,15 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
|
||||
return true;
|
||||
}
|
||||
|
||||
function rmdir($path, $recursive = false ) {
|
||||
function rmdir($path,$recursive=false){
|
||||
if( ! $recursive )
|
||||
return $this->ftp->rmdir($path);
|
||||
|
||||
return $this->ftp->mdel($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 {
|
||||
@@ -298,11 +430,11 @@ class WP_Filesystem_ftpsockets extends WP_Filesystem_Base {
|
||||
//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
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
function comment_exists($comment_author, $comment_date) {
|
||||
global $wpdb;
|
||||
|
||||
return $wpdb->get_var( $wpdb->prepare("SELECT comment_post_ID FROM $wpdb->comments
|
||||
WHERE comment_author = %s AND comment_date = %s", $comment_author, $comment_date) );
|
||||
return $wpdb->get_var("SELECT comment_post_ID FROM $wpdb->comments
|
||||
WHERE comment_author = '$comment_author' AND comment_date = '$comment_date'");
|
||||
}
|
||||
|
||||
function edit_comment() {
|
||||
|
||||
@@ -23,9 +23,7 @@ function wp_dashboard_setup() {
|
||||
/* Register Widgets and Controls */
|
||||
|
||||
// Recent Comments Widget
|
||||
$mod_comments = wp_count_comments();
|
||||
$mod_comments = $mod_comments->moderated;
|
||||
if ( current_user_can( 'moderate_comments' ) && $mod_comments ) {
|
||||
if ( current_user_can( 'moderate_comments' ) && $mod_comments = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_approved = '0'") ) {
|
||||
$notice = sprintf( __ngettext( '%d comment awaiting moderation', '%d comments awaiting moderation', $mod_comments ), $mod_comments );
|
||||
$notice = "<a href='edit-comments.php?comment_status=moderated'>$notice</a>";
|
||||
} else {
|
||||
@@ -36,10 +34,9 @@ function wp_dashboard_setup() {
|
||||
);
|
||||
|
||||
// Incoming Links Widget
|
||||
if ( !isset( $widget_options['dashboard_incoming_links'] ) || !isset( $widget_options['dashboard_incoming_links']['home'] ) || $widget_options['dashboard_incoming_links']['home'] != get_option('home') ) {
|
||||
if ( !isset( $widget_options['dashboard_incoming_links'] ) ) {
|
||||
$update = true;
|
||||
$widget_options['dashboard_incoming_links'] = array(
|
||||
'home' => get_option('home'),
|
||||
'link' => apply_filters( 'dashboard_incoming_links_link', 'http://blogsearch.google.com/blogsearch?hl=en&scoring=d&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ),
|
||||
'url' => apply_filters( 'dashboard_incoming_links_feed', 'http://blogsearch.google.com/blogsearch_feeds?hl=en&scoring=d&ie=utf-8&num=10&output=rss&partner=wordpress&q=link:' . trailingslashit( get_option('home') ) ),
|
||||
'items' => 5,
|
||||
@@ -217,16 +214,16 @@ function wp_dashboard_dynamic_sidebar_params( $params ) {
|
||||
$wp_registered_widgets[$widget_id]['callback'] = 'wp_dashboard_empty';
|
||||
$sidebar_widget_name = $wp_registered_widget_controls[$widget_id]['name'];
|
||||
$params[1] = 'wp_dashboard_trigger_widget_control';
|
||||
$sidebar_before_widget .= '<form action="' . clean_url(remove_query_arg( 'edit' )) . '" method="post">';
|
||||
$sidebar_before_widget .= '<form action="' . remove_query_arg( 'edit' ) . '" method="post">';
|
||||
$sidebar_after_widget = "<div class='dashboard-widget-submit'><input type='hidden' name='sidebar' value='wp_dashboard' /><input type='hidden' name='widget_id' value='$widget_id' /><input type='submit' value='" . __( 'Save' ) . "' /></div></form>$sidebar_after_widget";
|
||||
$links[] = '<a href="' . clean_url(remove_query_arg( 'edit' )) . '">' . __( 'Cancel' ) . '</a>';
|
||||
$links[] = '<a href="' . remove_query_arg( 'edit' ) . '">' . __( 'Cancel' ) . '</a>';
|
||||
} else {
|
||||
$links[] = '<a href="' . clean_url(add_query_arg( 'edit', $widget_id )) . "#$widget_id" . '">' . __( 'Edit' ) . '</a>';
|
||||
$links[] = '<a href="' . add_query_arg( 'edit', $widget_id ) . "#$widget_id" . '">' . __( 'Edit' ) . '</a>';
|
||||
}
|
||||
}
|
||||
|
||||
if ( $widget_feed_link )
|
||||
$links[] = '<img class="rss-icon" src="' . includes_url('images/rss.png') . '" alt="' . __( 'rss icon' ) . '" /> <a href="' . clean_url( $widget_feed_link ) . '">' . __( 'RSS' ) . '</a>';
|
||||
$links[] = '<img class="rss-icon" src="' . get_option( 'siteurl' ) . '/' . WPINC . '/images/rss.png" alt="' . __( 'rss icon' ) . '" /> <a href="' . clean_url( $widget_feed_link ) . '">' . __( 'RSS' ) . '</a>';
|
||||
|
||||
$links = apply_filters( "wp_dashboard_widget_links_$widget_id", $links );
|
||||
|
||||
@@ -270,7 +267,7 @@ function wp_dashboard_recent_comments( $sidebar_args ) {
|
||||
|
||||
$lambda = create_function( '', 'return 5;' );
|
||||
add_filter( 'option_posts_per_rss', $lambda ); // hack - comments query doesn't accept per_page parameter
|
||||
$comments_query = new WP_Query(array('feed' => 'rss2', 'withcomments' => 1));
|
||||
$comments_query = new WP_Query('feed=rss2&withcomments=1');
|
||||
remove_filter( 'option_posts_per_rss', $lambda );
|
||||
|
||||
$is_first = true;
|
||||
@@ -316,7 +313,7 @@ function wp_dashboard_incoming_links_output() {
|
||||
$widgets = get_option( 'dashboard_widget_options' );
|
||||
@extract( @$widgets['dashboard_incoming_links'], EXTR_SKIP );
|
||||
$rss = @fetch_rss( $url );
|
||||
if ( isset($rss->items) && 0 < count($rss->items) ) {
|
||||
if ( isset($rss->items) && 1 < count($rss->items) ) {// Technorati returns a 1-item feed when it has no results
|
||||
|
||||
echo "<ul>\n";
|
||||
|
||||
@@ -390,7 +387,8 @@ function wp_dashboard_secondary_output() {
|
||||
$rss->items = array_slice($rss->items, 0, $items);
|
||||
foreach ($rss->items as $item ) {
|
||||
$title = wp_specialchars($item['title']);
|
||||
list($author,$post) = explode( ':', $title, 2 );
|
||||
$author = preg_replace( '|(.+?):.+|s', '$1', $item['title'] );
|
||||
$post = preg_replace( '|.+?:(.+)|s', '$1', $item['title'] );
|
||||
$link = clean_url($item['link']);
|
||||
|
||||
echo "\t<li><a href='$link'><span class='post'>$post</span><span class='hidden'> - </span><cite>$author</cite></a></li>\n";
|
||||
|
||||
@@ -17,7 +17,7 @@ header('Content-Type: text/xml; charset=' . get_option('blog_charset'), true);
|
||||
$where = '';
|
||||
if ( $author and $author != 'all' ) {
|
||||
$author_id = (int) $author;
|
||||
$where = $wpdb->prepare(" WHERE post_author = %d ", $author_id);
|
||||
$where = " WHERE post_author = '$author_id' ";
|
||||
}
|
||||
|
||||
// grab a snapshot of post IDs, just in case it changes during the export
|
||||
@@ -201,7 +201,6 @@ echo '<?xml version="1.0" encoding="' . get_bloginfo('charset') . '"?' . ">\n";
|
||||
<guid isPermaLink="false"><?php the_guid(); ?></guid>
|
||||
<description></description>
|
||||
<content:encoded><?php echo wxr_cdata( apply_filters('the_content_export', $post->post_content) ); ?></content:encoded>
|
||||
<excerpt:encoded><?php echo wxr_cdata( apply_filters('the_excerpt_export', $post->post_excerpt) ); ?></excerpt:encoded>
|
||||
<wp:post_id><?php echo $post->ID; ?></wp:post_id>
|
||||
<wp:post_date><?php echo $post->post_date; ?></wp:post_date>
|
||||
<wp:post_date_gmt><?php echo $post->post_date_gmt; ?></wp:post_date_gmt>
|
||||
@@ -218,7 +217,7 @@ if ($post->post_type == 'attachment') { ?>
|
||||
<wp:attachment_url><?php echo wp_get_attachment_url($post->ID); ?></wp:attachment_url>
|
||||
<?php } ?>
|
||||
<?php
|
||||
$postmeta = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->postmeta WHERE post_id = %d", $post->ID) );
|
||||
$postmeta = $wpdb->get_results("SELECT * FROM $wpdb->postmeta WHERE post_id = $post->ID");
|
||||
if ( $postmeta ) {
|
||||
?>
|
||||
<?php foreach( $postmeta as $meta ) { ?>
|
||||
@@ -229,7 +228,7 @@ if ( $postmeta ) {
|
||||
<?php } ?>
|
||||
<?php } ?>
|
||||
<?php
|
||||
$comments = $wpdb->get_results( $wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d", $post->ID) );
|
||||
$comments = $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = $post->ID");
|
||||
if ( $comments ) { foreach ( $comments as $c ) { ?>
|
||||
<wp:comment>
|
||||
<wp:comment_id><?php echo $c->comment_ID; ?></wp:comment_id>
|
||||
@@ -253,4 +252,4 @@ if ( $comments ) { foreach ( $comments as $c ) { ?>
|
||||
<?php
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
@@ -34,47 +34,19 @@ function get_home_path() {
|
||||
|
||||
function get_real_file_to_edit( $file ) {
|
||||
if ('index.php' == $file || '.htaccess' == $file ) {
|
||||
$real_file = get_home_path() . $file;
|
||||
$real_file = get_home_path().$file;
|
||||
} else {
|
||||
$real_file = WP_CONTENT_DIR . $file;
|
||||
$real_file = ABSPATH.$file;
|
||||
}
|
||||
|
||||
return $real_file;
|
||||
}
|
||||
//$folder = Full path to folder
|
||||
//$levels = Levels of folders to follow, Default: 100 (PHP Loop limit)
|
||||
function list_files( $folder = '', $levels = 100 ) {
|
||||
if( empty($folder) )
|
||||
return false;
|
||||
|
||||
if( ! $levels )
|
||||
return false;
|
||||
|
||||
$files = array();
|
||||
if ( $dir = @opendir( $folder ) ) {
|
||||
while (($file = readdir( $dir ) ) !== false ) {
|
||||
if ( in_array($file, array('.', '..') ) )
|
||||
continue;
|
||||
if ( is_dir( $folder . '/' . $file ) ) {
|
||||
$files2 = list_files( $folder . '/' . $file, $levels - 1);
|
||||
if( $files2 )
|
||||
$files = array_merge($files, $files2 );
|
||||
else
|
||||
$files[] = $folder . '/' . $file . '/';
|
||||
} else {
|
||||
$files[] = $folder . '/' . $file;
|
||||
}
|
||||
}
|
||||
}
|
||||
@closedir( $dir );
|
||||
return $files;
|
||||
}
|
||||
|
||||
function get_temp_dir() {
|
||||
if ( defined('WP_TEMP_DIR') )
|
||||
return trailingslashit(WP_TEMP_DIR);
|
||||
|
||||
$temp = WP_CONTENT_DIR . '/';
|
||||
$temp = ABSPATH . 'wp-content/';
|
||||
if ( is_dir($temp) && is_writable($temp) )
|
||||
return $temp;
|
||||
|
||||
@@ -84,16 +56,20 @@ function get_temp_dir() {
|
||||
return '/tmp/';
|
||||
}
|
||||
|
||||
function wp_tempnam($filename = '', $dir = ''){
|
||||
if ( empty($dir) )
|
||||
$dir = get_temp_dir();
|
||||
$filename = basename($filename);
|
||||
if ( empty($filename) )
|
||||
$filename = time();
|
||||
function validate_file( $file, $allowed_files = '' ) {
|
||||
if ( false !== strpos( $file, '..' ))
|
||||
return 1;
|
||||
|
||||
$filename = $dir . wp_unique_filename($dir, $filename);
|
||||
touch($filename);
|
||||
return $filename;
|
||||
if ( false !== strpos( $file, './' ))
|
||||
return 1;
|
||||
|
||||
if (':' == substr( $file, 1, 1 ))
|
||||
return 2;
|
||||
|
||||
if (!empty ( $allowed_files ) && (!in_array( $file, $allowed_files ) ) )
|
||||
return 3;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
function validate_file_to_edit( $file, $allowed_files = '' ) {
|
||||
@@ -212,102 +188,6 @@ function wp_handle_upload( &$file, $overrides = false ) {
|
||||
|
||||
return $return;
|
||||
}
|
||||
// Pass this function an array similar to that of a $_FILES POST array.
|
||||
function wp_handle_sideload( &$file, $overrides = false ) {
|
||||
// The default error handler.
|
||||
if (! function_exists( 'wp_handle_upload_error' ) ) {
|
||||
function wp_handle_upload_error( &$file, $message ) {
|
||||
return array( 'error'=>$message );
|
||||
}
|
||||
}
|
||||
|
||||
// You may define your own function and pass the name in $overrides['upload_error_handler']
|
||||
$upload_error_handler = 'wp_handle_upload_error';
|
||||
|
||||
// $_POST['action'] must be set and its value must equal $overrides['action'] or this:
|
||||
$action = 'wp_handle_sideload';
|
||||
|
||||
// Courtesy of php.net, the strings that describe the error indicated in $_FILES[{form field}]['error'].
|
||||
$upload_error_strings = array( false,
|
||||
__( "The file exceeds the <code>upload_max_filesize</code> directive in <code>php.ini</code>." ),
|
||||
__( "The file exceeds the <em>MAX_FILE_SIZE</em> directive that was specified in the HTML form." ),
|
||||
__( "The file was only partially uploaded." ),
|
||||
__( "No file was sent." ),
|
||||
__( "Missing a temporary folder." ),
|
||||
__( "Failed to write file to disk." ));
|
||||
|
||||
// All tests are on by default. Most can be turned off by $override[{test_name}] = false;
|
||||
$test_form = true;
|
||||
$test_size = true;
|
||||
|
||||
// If you override this, you must provide $ext and $type!!!!
|
||||
$test_type = true;
|
||||
$mimes = false;
|
||||
|
||||
// Install user overrides. Did we mention that this voids your warranty?
|
||||
if ( is_array( $overrides ) )
|
||||
extract( $overrides, EXTR_OVERWRITE );
|
||||
|
||||
// A correct form post will pass this test.
|
||||
if ( $test_form && (!isset( $_POST['action'] ) || ($_POST['action'] != $action ) ) )
|
||||
return $upload_error_handler( $file, __( 'Invalid form submission.' ));
|
||||
|
||||
// A successful upload will pass this test. It makes no sense to override this one.
|
||||
if ( $file['error'] > 0 )
|
||||
return $upload_error_handler( $file, $upload_error_strings[$file['error']] );
|
||||
|
||||
// A non-empty file will pass this test.
|
||||
if ( $test_size && !(filesize($file['tmp_name']) > 0 ) )
|
||||
return $upload_error_handler( $file, __( 'File is empty. Please upload something more substantial. This error could also be caused by uploads being disabled in your php.ini.' ));
|
||||
|
||||
// A properly uploaded file will pass this test. There should be no reason to override this one.
|
||||
if (! @ is_file( $file['tmp_name'] ) )
|
||||
return $upload_error_handler( $file, __( 'Specified file does not exist.' ));
|
||||
|
||||
// A correct MIME type will pass this test. Override $mimes or use the upload_mimes filter.
|
||||
if ( $test_type ) {
|
||||
$wp_filetype = wp_check_filetype( $file['name'], $mimes );
|
||||
|
||||
extract( $wp_filetype );
|
||||
|
||||
if ( ( !$type || !$ext ) && !current_user_can( 'unfiltered_upload' ) )
|
||||
return $upload_error_handler( $file, __( 'File type does not meet security guidelines. Try another.' ));
|
||||
|
||||
if ( !$ext )
|
||||
$ext = ltrim(strrchr($file['name'], '.'), '.');
|
||||
|
||||
if ( !$type )
|
||||
$type = $file['type'];
|
||||
}
|
||||
|
||||
// A writable uploads dir will pass this test. Again, there's no point overriding this one.
|
||||
if ( ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) )
|
||||
return $upload_error_handler( $file, $uploads['error'] );
|
||||
|
||||
$filename = wp_unique_filename( $uploads['path'], $file['name'], $unique_filename_callback );
|
||||
|
||||
// Strip the query strings.
|
||||
$filename = str_replace('?','-', $filename);
|
||||
$filename = str_replace('&','-', $filename);
|
||||
|
||||
// Move the file to the uploads dir
|
||||
$new_file = $uploads['path'] . "/$filename";
|
||||
if ( false === @ rename( $file['tmp_name'], $new_file ) ) {
|
||||
return $upload_error_handler( $file, sprintf( __('The uploaded file could not be moved to %s.' ), $uploads['path'] ) );
|
||||
}
|
||||
|
||||
// Set correct file permissions
|
||||
$stat = stat( dirname( $new_file ));
|
||||
$perms = $stat['mode'] & 0000666;
|
||||
@ chmod( $new_file, $perms );
|
||||
|
||||
// Compute the URL
|
||||
$url = $uploads['url'] . "/$filename";
|
||||
|
||||
$return = apply_filters( 'wp_handle_upload', array( 'file' => $new_file, 'url' => $url, 'type' => $type ) );
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Downloads a url to a local file using the Snoopy HTTP Class
|
||||
@@ -320,7 +200,7 @@ function download_url( $url ) {
|
||||
if( ! $url )
|
||||
return new WP_Error('http_no_url', __('Invalid URL Provided'));
|
||||
|
||||
$tmpfname = wp_tempnam($url);
|
||||
$tmpfname = tempnam(get_temp_dir(), 'wpupdate');
|
||||
if( ! $tmpfname )
|
||||
return new WP_Error('http_no_file', __('Could not create Temporary file'));
|
||||
|
||||
@@ -380,13 +260,13 @@ function unzip_file($file, $to) {
|
||||
$tmppath .= $path[$j] . '/';
|
||||
if ( ! $fs->is_dir($to . $tmppath) )
|
||||
if ( !$fs->mkdir($to . $tmppath, 0755) )
|
||||
return new WP_Error('mkdir_failed', __('Could not create directory'), $to . $tmppath);
|
||||
return new WP_Error('mkdir_failed', __('Could not create directory'));
|
||||
}
|
||||
|
||||
// We've made sure the folders are there, so let's extract the file now:
|
||||
if ( ! $file['folder'] )
|
||||
if ( !$fs->put_contents( $to . $file['filename'], $file['content']) )
|
||||
return new WP_Error('copy_failed', __('Could not copy file'), $to . $file['filename']);
|
||||
return new WP_Error('copy_failed', __('Could not copy file'));
|
||||
$fs->chmod($to . $file['filename'], 0644);
|
||||
}
|
||||
|
||||
@@ -404,33 +284,27 @@ function copy_dir($from, $to) {
|
||||
foreach ( (array) $dirlist as $filename => $fileinfo ) {
|
||||
if ( 'f' == $fileinfo['type'] ) {
|
||||
if ( ! $wp_filesystem->copy($from . $filename, $to . $filename, true) )
|
||||
return new WP_Error('copy_failed', __('Could not copy file'), $to . $filename);
|
||||
return false;
|
||||
$wp_filesystem->chmod($to . $filename, 0644);
|
||||
} elseif ( 'd' == $fileinfo['type'] ) {
|
||||
if ( !$wp_filesystem->mkdir($to . $filename, 0755) )
|
||||
return new WP_Error('mkdir_failed', __('Could not create directory'), $to . $filename);
|
||||
$result = copy_dir($from . $filename, $to . $filename);
|
||||
if ( is_wp_error($result) )
|
||||
return $result;
|
||||
return false;
|
||||
if ( !copy_dir($from . $filename, $to . $filename) )
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function WP_Filesystem( $args = false ) {
|
||||
function WP_Filesystem( $args = false, $preference = false ) {
|
||||
global $wp_filesystem;
|
||||
|
||||
require_once(ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php');
|
||||
|
||||
$method = get_filesystem_method();
|
||||
|
||||
$method = get_filesystem_method($preference);
|
||||
if ( ! $method )
|
||||
return false;
|
||||
|
||||
$abstraction_file = apply_filters('filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-'.$method.'.php', $method);
|
||||
if( ! file_exists($abstraction_file) )
|
||||
return;
|
||||
|
||||
require_once($abstraction_file);
|
||||
require_once('class-wp-filesystem-'.$method.'.php');
|
||||
$method = "WP_Filesystem_$method";
|
||||
|
||||
$wp_filesystem = new $method($args);
|
||||
@@ -445,17 +319,18 @@ function WP_Filesystem( $args = false ) {
|
||||
}
|
||||
|
||||
function get_filesystem_method() {
|
||||
$method = false;
|
||||
if( function_exists('getmyuid') && function_exists('fileowner') ){
|
||||
$temp_file = wp_tempnam();
|
||||
if ( getmyuid() == fileowner($temp_file) )
|
||||
$method = 'direct';
|
||||
unlink($temp_file);
|
||||
$tempFile = tempnam(get_temp_dir(), 'WPU');
|
||||
|
||||
if ( getmyuid() == fileowner($tempFile) ) {
|
||||
unlink($tempFile);
|
||||
return 'direct';
|
||||
} else {
|
||||
unlink($tempFile);
|
||||
}
|
||||
|
||||
if ( ! $method && extension_loaded('ftp') ) $method = 'ftpext';
|
||||
if ( ! $method && ( extension_loaded('sockets') || function_exists('fsockopen') ) ) $method = 'ftpsockets'; //Sockets: Socket extension; PHP Mode: FSockopen / fwrite / fread
|
||||
return apply_filters('filesystem_method', $method);
|
||||
if ( extension_loaded('ftp') ) return 'ftpext';
|
||||
if ( extension_loaded('sockets') || function_exists('fsockopen') ) return 'ftpsockets'; //Sockets: Socket extension; PHP Mode: FSockopen / fwrite / fread
|
||||
return false;
|
||||
}
|
||||
|
||||
?>
|
||||
?>
|
||||
|
||||
@@ -26,14 +26,11 @@ function update_gallery_tab($tabs) {
|
||||
add_filter('media_upload_tabs', 'update_gallery_tab');
|
||||
|
||||
function the_media_upload_tabs() {
|
||||
global $redir_tab;
|
||||
$tabs = media_upload_tabs();
|
||||
|
||||
if ( !empty($tabs) ) {
|
||||
echo "<ul id='sidemenu'>\n";
|
||||
if ( isset($redir_tab) && array_key_exists($redir_tab, $tabs) )
|
||||
$current = $redir_tab;
|
||||
elseif ( isset($_GET['tab']) && array_key_exists($_GET['tab'], $tabs) )
|
||||
if ( isset($_GET['tab']) && array_key_exists($_GET['tab'], $tabs) )
|
||||
$current = $_GET['tab'];
|
||||
else {
|
||||
$keys = array_keys($tabs);
|
||||
@@ -44,8 +41,8 @@ function the_media_upload_tabs() {
|
||||
if ( $current == $callback )
|
||||
$class = " class='current'";
|
||||
$href = add_query_arg(array('tab'=>$callback, 's'=>false, 'paged'=>false, 'post_mime_type'=>false, 'm'=>false));
|
||||
$link = "<a href='" . clean_url($href) . "'$class>$text</a>";
|
||||
echo "\t<li id='" . attribute_escape("tab-$callback") . "'>$link</li>\n";
|
||||
$link = "<a href='$href'$class>$text</a>";
|
||||
echo "\t<li id='tab-$callback'>$link</li>\n";
|
||||
}
|
||||
echo "</ul>\n";
|
||||
}
|
||||
@@ -58,40 +55,20 @@ function get_image_send_to_editor($id, $alt, $title, $align, $url='', $rel = fal
|
||||
$rel = $rel ? ' rel="attachment wp-att-'.attribute_escape($id).'"' : '';
|
||||
|
||||
if ( $url )
|
||||
$html = '<a href="' . clean_url($url) . "\"$rel>$html</a>";
|
||||
$html = "<a href='".attribute_escape($url)."'$rel>$html</a>";
|
||||
|
||||
$html = apply_filters( 'image_send_to_editor', $html, $id, $alt, $title, $align, $url, $size );
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
function image_add_caption( $html, $id, $alt, $title, $align, $url, $size ) {
|
||||
|
||||
// CAPTIONS_OFF is temporary. Do not use it.
|
||||
if ( empty($alt) || ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF ) ) return $html;
|
||||
$id = ( 0 < (int) $id ) ? 'attachment_' . $id : '';
|
||||
|
||||
preg_match( '/width="([0-9]+)/', $html, $matches );
|
||||
if ( ! isset($matches[1]) ) return $html;
|
||||
$width = $matches[1];
|
||||
|
||||
$html = preg_replace( '/align[^\s\'"]+\s?/', '', $html );
|
||||
if ( empty($align) ) $align = 'none';
|
||||
|
||||
$shcode = '[caption id="' . $id . '" align="align' . $align
|
||||
. '" width="' . $width . '" caption="' . $alt . '"]' . $html . '[/caption]';
|
||||
|
||||
return apply_filters( 'image_add_caption_shortcode', $shcode, $html );
|
||||
}
|
||||
add_filter( 'image_send_to_editor', 'image_add_caption', 20, 7 );
|
||||
|
||||
function media_send_to_editor($html) {
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
var win = window.dialogArguments || opener || parent || top;
|
||||
win.send_to_editor('<?php echo addslashes($html); ?>');
|
||||
/* ]]> */
|
||||
<!--
|
||||
top.send_to_editor('<?php echo addslashes($html); ?>');
|
||||
top.tb_remove();
|
||||
-->
|
||||
</script>
|
||||
<?php
|
||||
exit;
|
||||
@@ -138,47 +115,6 @@ function media_handle_upload($file_id, $post_id, $post_data = array()) {
|
||||
|
||||
}
|
||||
|
||||
function media_handle_sideload($file_array, $post_id, $desc = null, $post_data = array()) {
|
||||
$overrides = array('test_form'=>false);
|
||||
$file = wp_handle_sideload($file_array, $overrides);
|
||||
|
||||
if ( isset($file['error']) )
|
||||
return new wp_error( 'upload_error', $file['error'] );
|
||||
|
||||
$url = $file['url'];
|
||||
$type = $file['type'];
|
||||
$file = $file['file'];
|
||||
$title = preg_replace('/\.[^.]+$/', '', basename($file));
|
||||
$content = '';
|
||||
|
||||
// use image exif/iptc data for title and caption defaults if possible
|
||||
if ( $image_meta = @wp_read_image_metadata($file) ) {
|
||||
if ( trim($image_meta['title']) )
|
||||
$title = $image_meta['title'];
|
||||
if ( trim($image_meta['caption']) )
|
||||
$content = $image_meta['caption'];
|
||||
}
|
||||
|
||||
$title = @$desc;
|
||||
|
||||
// Construct the attachment array
|
||||
$attachment = array_merge( array(
|
||||
'post_mime_type' => $type,
|
||||
'guid' => $url,
|
||||
'post_parent' => $post_id,
|
||||
'post_title' => $title,
|
||||
'post_content' => $content,
|
||||
), $post_data );
|
||||
|
||||
// Save the data
|
||||
$id = wp_insert_attachment($attachment, $file, $post_parent);
|
||||
if ( !is_wp_error($id) ) {
|
||||
wp_update_attachment_metadata( $id, wp_generate_attachment_metadata( $id, $file ) );
|
||||
return $url;
|
||||
}
|
||||
return $id;
|
||||
}
|
||||
|
||||
|
||||
// wrap iframe content (produced by $content_func) in a doctype, html head/body etc
|
||||
// any additional function args will be passed to content_func
|
||||
@@ -190,12 +126,9 @@ function wp_iframe($content_func /* ... */) {
|
||||
<meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?>; charset=<?php echo get_option('blog_charset'); ?>" />
|
||||
<title><?php bloginfo('name') ?> › <?php _e('Uploads'); ?> — <?php _e('WordPress'); ?></title>
|
||||
<?php
|
||||
wp_enqueue_style( 'global' );
|
||||
wp_enqueue_style( 'wp-admin' );
|
||||
wp_enqueue_style( 'colors' );
|
||||
if ( 0 === strpos( $content_func, 'media' ) )
|
||||
wp_enqueue_style( 'media' );
|
||||
|
||||
wp_admin_css( 'css/global' );
|
||||
wp_admin_css();
|
||||
wp_admin_css( 'css/colors' );
|
||||
?>
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
@@ -203,7 +136,6 @@ function addLoadEvent(func) {if ( typeof wpOnload!='function'){wpOnload=func;}el
|
||||
//]]>
|
||||
</script>
|
||||
<?php
|
||||
do_action('admin_print_styles');
|
||||
do_action('admin_print_scripts');
|
||||
do_action('admin_head');
|
||||
if ( is_string($content_func) )
|
||||
@@ -235,15 +167,36 @@ function media_buttons() {
|
||||
$audio_title = __('Add Audio');
|
||||
$out = <<<EOF
|
||||
|
||||
<a href="{$image_upload_iframe_src}&TB_iframe=true" id="add_image" class="thickbox" title='$image_title'><img src='images/media-button-image.gif' alt='$image_title' /></a>
|
||||
<a href="{$video_upload_iframe_src}&TB_iframe=true" id="add_video" class="thickbox" title='$video_title'><img src='images/media-button-video.gif' alt='$video_title' /></a>
|
||||
<a href="{$audio_upload_iframe_src}&TB_iframe=true" id="add_audio" class="thickbox" title='$audio_title'><img src='images/media-button-music.gif' alt='$audio_title' /></a>
|
||||
<a href="{$media_upload_iframe_src}&TB_iframe=true" id="add_media" class="thickbox" title='$media_title'><img src='images/media-button-other.gif' alt='$media_title' /></a>
|
||||
<a href="{$image_upload_iframe_src}&TB_iframe=true&height=500&width=640" class="thickbox" title='$image_title'><img src='images/media-button-image.gif' alt='$image_title' /></a>
|
||||
<a href="{$video_upload_iframe_src}&TB_iframe=true&height=500&width=640" class="thickbox" title='$video_title'><img src='images/media-button-video.gif' alt='$video_title' /></a>
|
||||
<a href="{$audio_upload_iframe_src}&TB_iframe=true&height=500&width=640" class="thickbox" title='$audio_title'><img src='images/media-button-music.gif' alt='$audio_title' /></a>
|
||||
<a href="{$media_upload_iframe_src}&TB_iframe=true&height=500&width=640" class="thickbox" title='$media_title'><img src='images/media-button-other.gif' alt='$media_title' /></a>
|
||||
|
||||
EOF;
|
||||
printf($context, $out);
|
||||
}
|
||||
add_action( 'media_buttons', 'media_buttons' );
|
||||
|
||||
function media_buttons_head() {
|
||||
$siteurl = get_option('siteurl');
|
||||
echo "<style type='text/css' media='all'>
|
||||
@import '{$siteurl}/wp-includes/js/thickbox/thickbox.css?1';
|
||||
div#TB_title {
|
||||
background-color: #222222;
|
||||
color: #cfcfcf;
|
||||
}
|
||||
div#TB_title a, div#TB_title a:visited {
|
||||
color: #cfcfcf;
|
||||
}
|
||||
</style>\n";
|
||||
}
|
||||
|
||||
add_action( 'admin_print_scripts', 'media_buttons_head' );
|
||||
|
||||
function media_admin_css() {
|
||||
wp_admin_css('css/media');
|
||||
}
|
||||
|
||||
add_action('media_upload_media', 'media_upload_handler');
|
||||
|
||||
function media_upload_form_handler() {
|
||||
@@ -257,8 +210,6 @@ function media_upload_form_handler() {
|
||||
$post['post_title'] = $attachment['post_title'];
|
||||
if ( isset($attachment['post_excerpt']) )
|
||||
$post['post_excerpt'] = $attachment['post_excerpt'];
|
||||
if ( isset($attachment['menu_order']) )
|
||||
$post['menu_order'] = $attachment['menu_order'];
|
||||
|
||||
$post = apply_filters('attachment_fields_to_save', $post, $attachment);
|
||||
|
||||
@@ -329,36 +280,12 @@ function media_upload_image() {
|
||||
$errors = $return;
|
||||
}
|
||||
|
||||
if ( isset($_POST['save']) ) {
|
||||
if ( isset($_POST['save']) )
|
||||
$errors['upload_notice'] = __('Saved.');
|
||||
return media_upload_gallery();
|
||||
}
|
||||
|
||||
return wp_iframe( 'media_upload_type_form', 'image', $errors, $id );
|
||||
}
|
||||
|
||||
function media_sideload_image($file, $post_id, $desc = null) {
|
||||
if (!empty($file) ) {
|
||||
$file_array['name'] = basename($file);
|
||||
$file_array['tmp_name'] = download_url($file);
|
||||
$desc = @$desc;
|
||||
|
||||
$id = media_handle_sideload($file_array, $post_id, $desc);
|
||||
$src = $id;
|
||||
|
||||
if ( is_wp_error($id) ) {
|
||||
@unlink($file_array['tmp_name']);
|
||||
return $id;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !empty($src) ) {
|
||||
$alt = @$desc;
|
||||
$html = "<img src='$src' alt='$alt' />";
|
||||
return $html;
|
||||
}
|
||||
}
|
||||
|
||||
function media_upload_audio() {
|
||||
if ( isset($_POST['html-upload']) && !empty($_FILES) ) {
|
||||
// Upload File button was clicked
|
||||
@@ -391,10 +318,8 @@ function media_upload_audio() {
|
||||
$errors = $return;
|
||||
}
|
||||
|
||||
if ( isset($_POST['save']) ) {
|
||||
if ( isset($_POST['save']) )
|
||||
$errors['upload_notice'] = __('Saved.');
|
||||
return media_upload_gallery();
|
||||
}
|
||||
|
||||
return wp_iframe( 'media_upload_type_form', 'audio', $errors, $id );
|
||||
}
|
||||
@@ -431,10 +356,8 @@ function media_upload_video() {
|
||||
$errors = $return;
|
||||
}
|
||||
|
||||
if ( isset($_POST['save']) ) {
|
||||
if ( isset($_POST['save']) )
|
||||
$errors['upload_notice'] = __('Saved.');
|
||||
return media_upload_gallery();
|
||||
}
|
||||
|
||||
return wp_iframe( 'media_upload_type_form', 'video', $errors, $id );
|
||||
}
|
||||
@@ -471,10 +394,8 @@ function media_upload_file() {
|
||||
$errors = $return;
|
||||
}
|
||||
|
||||
if ( isset($_POST['save']) ) {
|
||||
if ( isset($_POST['save']) )
|
||||
$errors['upload_notice'] = __('Saved.');
|
||||
return media_upload_gallery();
|
||||
}
|
||||
|
||||
return wp_iframe( 'media_upload_type_form', 'file', $errors, $id );
|
||||
}
|
||||
@@ -489,7 +410,6 @@ function media_upload_gallery() {
|
||||
$errors = $return;
|
||||
}
|
||||
|
||||
wp_enqueue_script('admin-gallery');
|
||||
return wp_iframe( 'media_upload_gallery_form', $errors );
|
||||
}
|
||||
|
||||
@@ -509,15 +429,8 @@ function media_upload_library() {
|
||||
function image_attachment_fields_to_edit($form_fields, $post) {
|
||||
if ( substr($post->post_mime_type, 0, 5) == 'image' ) {
|
||||
$form_fields['post_title']['required'] = true;
|
||||
|
||||
// CAPTIONS_OFF is temporary. Do not use it.
|
||||
if ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF ) {
|
||||
$form_fields['post_excerpt']['label'] = __('Alternate Text');
|
||||
$form_fields['post_excerpt']['helps'][] = __('Alt text for the image, e.g. "The Mona Lisa"');
|
||||
} else {
|
||||
$form_fields['post_excerpt']['label'] = __('Caption');
|
||||
$form_fields['post_excerpt']['helps'][] = __('Also used as alternate text for the image');
|
||||
}
|
||||
$form_fields['post_excerpt']['label'] = __('Caption');
|
||||
$form_fields['post_excerpt']['helps'][] = __('Alternate text, e.g. "The Mona Lisa"');
|
||||
|
||||
$form_fields['post_content']['label'] = __('Description');
|
||||
|
||||
@@ -606,19 +519,13 @@ function get_attachment_fields_to_edit($post, $errors = null) {
|
||||
$file = wp_get_attachment_url($post->ID);
|
||||
$link = get_attachment_link($post->ID);
|
||||
|
||||
// CAPTIONS_OFF is temporary. Do not use it.
|
||||
if ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF )
|
||||
$alt = __('Alternate Text');
|
||||
else
|
||||
$alt = __('Caption');
|
||||
|
||||
$form_fields = array(
|
||||
'post_title' => array(
|
||||
'label' => __('Title'),
|
||||
'value' => $edit_post->post_title,
|
||||
),
|
||||
'post_excerpt' => array(
|
||||
'label' => $alt,
|
||||
'label' => __('Caption'),
|
||||
'value' => $edit_post->post_excerpt,
|
||||
),
|
||||
'post_content' => array(
|
||||
@@ -639,10 +546,6 @@ function get_attachment_fields_to_edit($post, $errors = null) {
|
||||
</script>\n",
|
||||
'helps' => __('Enter a link URL or click above for presets.'),
|
||||
),
|
||||
'menu_order' => array(
|
||||
'label' => __('Order'),
|
||||
'value' => $edit_post->menu_order
|
||||
),
|
||||
);
|
||||
|
||||
foreach ( get_attachment_taxonomies($post) as $taxonomy ) {
|
||||
@@ -680,7 +583,7 @@ function get_media_items( $post_id, $errors ) {
|
||||
if ( $post && $post->post_type == 'attachment' )
|
||||
$attachments = array($post->ID => $post);
|
||||
else
|
||||
$attachments = get_children( array( 'post_parent' => $post_id, 'post_type' => 'attachment', 'orderby' => 'menu_order ASC, ID', 'order' => 'DESC') );
|
||||
$attachments = get_children("post_parent=$post_id&post_type=attachment&orderby=menu_order ASC, ID&order=DESC");
|
||||
} else {
|
||||
if ( is_array($GLOBALS['wp_the_query']->posts) )
|
||||
foreach ( $GLOBALS['wp_the_query']->posts as $attachment )
|
||||
@@ -698,8 +601,6 @@ function get_media_items( $post_id, $errors ) {
|
||||
}
|
||||
|
||||
function get_media_item( $attachment_id, $args = null ) {
|
||||
global $redir_tab;
|
||||
|
||||
$default_args = array( 'errors' => null, 'send' => true, 'delete' => true, 'toggle' => true );
|
||||
$args = wp_parse_args( $args, $default_args );
|
||||
extract( $args, EXTR_SKIP );
|
||||
@@ -747,27 +648,10 @@ function get_media_item( $attachment_id, $args = null ) {
|
||||
}
|
||||
|
||||
$display_title = ( !empty( $title ) ) ? $title : $filename; // $title shouldn't ever be empty, but just in case
|
||||
$display_title = wp_html_excerpt($display_title, 60);
|
||||
|
||||
$gallery = ( (isset($_REQUEST['tab']) && 'gallery' == $_REQUEST['tab']) || (isset($redir_tab) && 'gallery' == $redir_tab) ) ? true : false;
|
||||
$order = '';
|
||||
|
||||
foreach ( $form_fields as $key => $val ) {
|
||||
if ( 'menu_order' == $key ) {
|
||||
if ( $gallery )
|
||||
$order = '<div class="menu_order"> <input class="menu_order_input" type="text" id="attachments['.$attachment_id.'][menu_order]" name="attachments['.$attachment_id.'][menu_order]" value="'.$val['value'].'" /></div>';
|
||||
else
|
||||
$order = '<input type="hidden" name="attachments['.$attachment_id.'][menu_order]" value="'.$val['value'].'" />';
|
||||
|
||||
unset($form_fields['menu_order']);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$item = "
|
||||
$type
|
||||
$toggle_links
|
||||
$order
|
||||
<div class='filename new'>$display_title</div>
|
||||
<table class='slidetoggle describe $class'>
|
||||
<thead class='media-item-info'>
|
||||
@@ -792,11 +676,9 @@ function get_media_item( $attachment_id, $args = null ) {
|
||||
if ( $send )
|
||||
$send = "<input type='submit' class='button' name='send[$attachment_id]' value='" . attribute_escape( __( 'Insert into Post' ) ) . "' />";
|
||||
if ( $delete )
|
||||
$delete = "<a href=\"#\" class=\"del-link\" onclick=\"document.getElementById('del_attachment_$attachment_id').style.display='block';return false;\">" . __('Delete') . "</a>";
|
||||
$delete = "<a href='$delete_href' id='del[$attachment_id]' disabled='disabled' class='delete'>" . __('Delete') . "</button>";
|
||||
if ( ( $send || $delete ) && !isset($form_fields['buttons']) )
|
||||
$form_fields['buttons'] = array('tr' => "\t\t<tr class='submit'><td></td><td class='savesend'>$send $delete
|
||||
<div id=\"del_attachment_$attachment_id\" class=\"del-attachment\" style=\"display:none;\">" . sprintf(__("You are about to delete <strong>%s</strong>."), $filename) . " <a href=\"$delete_href\" id=\"del[$attachment_id]\" class=\"delete\">" . __('Continue') . "</a>
|
||||
<a href=\"#\" class=\"del-link\" onclick=\"this.parentNode.style.display='none';return false;\">" . __('Cancel') . "</a></div></td></tr>\n");
|
||||
$form_fields['buttons'] = array('tr' => "\t\t<tr class='submit'><td></td><td class='savesend'>$send $delete</td></tr>\n");
|
||||
|
||||
$hidden_fields = array();
|
||||
|
||||
@@ -818,7 +700,6 @@ function get_media_item( $attachment_id, $args = null ) {
|
||||
}
|
||||
|
||||
$required = $field['required'] ? '<abbr title="required" class="required">*</abbr>' : '';
|
||||
$aria_required = $field['required'] ? " aria-required='true' " : '';
|
||||
$class = $id;
|
||||
$class .= $field['required'] ? ' form-required' : '';
|
||||
|
||||
@@ -826,9 +707,9 @@ function get_media_item( $attachment_id, $args = null ) {
|
||||
if ( !empty($field[$field['input']]) )
|
||||
$item .= $field[$field['input']];
|
||||
elseif ( $field['input'] == 'textarea' ) {
|
||||
$item .= "<textarea type='text' id='$name' name='$name'>" . attribute_escape( $field['value'] ) . $aria_required . "</textarea>";
|
||||
$item .= "<textarea type='text' id='$name' name='$name'>" . attribute_escape( $field['value'] ) . "</textarea>";
|
||||
} else {
|
||||
$item .= "<input type='text' id='$name' name='$name' value='" . attribute_escape( $field['value'] ) . "'" . $aria_required . "/>";
|
||||
$item .= "<input type='text' id='$name' name='$name' value='" . attribute_escape( $field['value'] ) . "' />";
|
||||
}
|
||||
if ( !empty($field['helps']) )
|
||||
$item .= "<p class='help'>" . join( "</p>\n<p class='help'>", array_unique((array) $field['helps']) ) . '</p>';
|
||||
@@ -873,7 +754,7 @@ function media_upload_header() {
|
||||
function media_upload_form( $errors = null ) {
|
||||
global $type, $tab;
|
||||
|
||||
$flash_action_url = admin_url('async-upload.php');
|
||||
$flash_action_url = get_option('siteurl') . "/wp-admin/async-upload.php";
|
||||
|
||||
// If Mac and mod_security, no Flash. :(
|
||||
$flash = true;
|
||||
@@ -895,22 +776,18 @@ function media_upload_form( $errors = null ) {
|
||||
<?php echo $errors['upload_error']->get_error_message(); ?>
|
||||
<?php } ?>
|
||||
</div>
|
||||
|
||||
<?php do_action('pre-upload-ui'); ?>
|
||||
|
||||
<?php if ( $flash ) : ?>
|
||||
<script type="text/javascript">
|
||||
<!--
|
||||
jQuery(function($){
|
||||
swfu = new SWFUpload({
|
||||
upload_url : "<?php echo attribute_escape( $flash_action_url ); ?>",
|
||||
flash_url : "<?php echo includes_url('js/swfupload/swfupload_f9.swf'); ?>",
|
||||
flash_url : "<?php echo get_option('siteurl').'/wp-includes/js/swfupload/swfupload_f9.swf'; ?>",
|
||||
file_post_name: "async-upload",
|
||||
file_types: "<?php echo apply_filters('upload_file_glob', '*.*'); ?>",
|
||||
post_params : {
|
||||
"post_id" : "<?php echo $post_id; ?>",
|
||||
"auth_cookie" : "<?php if ( is_ssl() ) echo $_COOKIE[SECURE_AUTH_COOKIE]; else echo $_COOKIE[AUTH_COOKIE]; ?>",
|
||||
"_wpnonce" : "<?php echo wp_create_nonce('media-form'); ?>",
|
||||
"auth_cookie" : "<?php echo $_COOKIE[AUTH_COOKIE]; ?>",
|
||||
"type" : "<?php echo $type; ?>",
|
||||
"tab" : "<?php echo $tab; ?>",
|
||||
"short" : "1"
|
||||
@@ -935,17 +812,15 @@ jQuery(function($){
|
||||
//-->
|
||||
</script>
|
||||
|
||||
|
||||
<div id="flash-upload-ui">
|
||||
<?php do_action('pre-flash-upload-ui'); ?>
|
||||
<p><input id="flash-browse-button" type="button" value="<?php echo attribute_escape( __( 'Choose files to upload' ) ); ?>" class="button" /></p>
|
||||
<?php do_action('post-flash-upload-ui'); ?>
|
||||
<p class="howto"><?php _e('After a file has been uploaded, you can add titles and descriptions.'); ?></p>
|
||||
<p><?php _e('After a file has been uploaded, you can add titles and descriptions.'); ?></p>
|
||||
</div>
|
||||
|
||||
<?php endif; // $flash ?>
|
||||
|
||||
<div id="html-upload-ui">
|
||||
<?php do_action('pre-html-upload-ui'); ?>
|
||||
<p>
|
||||
<input type="file" name="async-upload" id="async-upload" /> <input type="submit" class="button" name="html-upload" value="<?php echo attribute_escape(__('Upload')); ?>" /> <a href="#" onClick="return top.tb_remove();"><?php _e('Cancel'); ?></a>
|
||||
</p>
|
||||
@@ -954,9 +829,7 @@ jQuery(function($){
|
||||
<?php if ( is_lighttpd_before_150() ): ?>
|
||||
<p><?php _e('If you want to use all capabilities of the uploader, like uploading multiple files at once, please upgrade to lighttpd 1.5.'); ?></p>
|
||||
<?php endif;?>
|
||||
<?php do_action('post-html-upload-ui'); ?>
|
||||
</div>
|
||||
<?php do_action('post-upload-ui'); ?>
|
||||
<?php
|
||||
}
|
||||
|
||||
@@ -965,8 +838,7 @@ function media_upload_type_form($type = 'file', $errors = null, $id = null) {
|
||||
|
||||
$post_id = intval($_REQUEST['post_id']);
|
||||
|
||||
$form_action_url = admin_url("media-upload.php?type=$type&tab=type&post_id=$post_id");
|
||||
$form_action_url = apply_filters('media_upload_form_url', $form_action_url, $type);
|
||||
$form_action_url = get_option('siteurl') . "/wp-admin/media-upload.php?type=$type&tab=type&post_id=$post_id";
|
||||
|
||||
$callback = "type_form_$type";
|
||||
?>
|
||||
@@ -1001,81 +873,6 @@ jQuery(function($){
|
||||
<h3><?php _e('From URL'); ?></h3>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
//<![CDATA[
|
||||
var addExtImage = {
|
||||
|
||||
width : '',
|
||||
height : '',
|
||||
align : 'alignnone',
|
||||
|
||||
insert : function() {
|
||||
var t = this, html, f = document.forms[0], cls, title = '', alt = '', caption = null;
|
||||
|
||||
if ( '' == f.src.value || '' == t.width ) return false;
|
||||
|
||||
if ( f.title.value ) {
|
||||
title = f.title.value.replace(/['"<>]+/g, '');
|
||||
title = ' title="'+title+'"';
|
||||
}
|
||||
|
||||
if ( f.alt.value ) {
|
||||
alt = f.alt.value.replace(/['"<>]+/g, '');
|
||||
<?php if ( ! defined('CAPTIONS_OFF') || true != CAPTIONS_OFF ) { // CAPTIONS_OFF is temporary. Do not use it. ?>
|
||||
caption = f.alt.value.replace(/'/g, ''').replace(/"/g, '"').replace(/</g, '<').replace(/>/g, '>');
|
||||
<?php } ?>
|
||||
}
|
||||
|
||||
cls = caption ? '' : ' class="'+t.align+'"';
|
||||
|
||||
html = '<img alt="'+alt+'" src="'+f.src.value+'"'+title+cls+' width="'+t.width+'" height="'+t.height+'" />';
|
||||
|
||||
if ( f.url.value )
|
||||
html = '<a href="'+f.url.value+'">'+html+'</a>';
|
||||
|
||||
if ( caption )
|
||||
html = '[caption id="" align="'+t.align+'" width="'+t.width+'" caption="'+caption+'"]'+html+'[/caption]';
|
||||
|
||||
var win = window.dialogArguments || opener || parent || top;
|
||||
win.send_to_editor(html);
|
||||
},
|
||||
|
||||
resetImageData : function() {
|
||||
var t = addExtImage;
|
||||
|
||||
t.width = t.height = '';
|
||||
document.getElementById('go_button').style.color = '#bbb';
|
||||
if ( ! document.forms[0].src.value )
|
||||
document.getElementById('status_img').src = 'images/required.gif';
|
||||
else document.getElementById('status_img').src = 'images/no.png';
|
||||
},
|
||||
|
||||
updateImageData : function() {
|
||||
var t = addExtImage;
|
||||
|
||||
t.width = t.preloadImg.width;
|
||||
t.height = t.preloadImg.height;
|
||||
document.getElementById('go_button').style.color = '#333';
|
||||
document.getElementById('status_img').src = 'images/yes.png';
|
||||
},
|
||||
|
||||
getImageData : function() {
|
||||
var t = addExtImage, src = document.forms[0].src.value;
|
||||
|
||||
if ( ! src ) {
|
||||
t.resetImageData();
|
||||
return false;
|
||||
}
|
||||
document.getElementById('status_img').src = 'images/loading.gif';
|
||||
t.preloadImg = new Image();
|
||||
t.preloadImg.onload = t.updateImageData;
|
||||
t.preloadImg.onerror = t.resetImageData;
|
||||
t.preloadImg.src = src;
|
||||
}
|
||||
}
|
||||
//]]>
|
||||
</script>
|
||||
|
||||
<div id="media-items">
|
||||
<div class="media-item media-blank">
|
||||
<?php echo call_user_func($callback); ?>
|
||||
@@ -1087,13 +884,12 @@ var addExtImage = {
|
||||
}
|
||||
|
||||
function media_upload_gallery_form($errors) {
|
||||
global $redir_tab;
|
||||
|
||||
$redir_tab = 'gallery';
|
||||
media_upload_header();
|
||||
|
||||
$post_id = intval($_REQUEST['post_id']);
|
||||
$form_action_url = admin_url("media-upload.php?type={$GLOBALS['type']}&tab=gallery&post_id=$post_id");
|
||||
|
||||
$form_action_url = get_option('siteurl') . "/wp-admin/media-upload.php?type={$GLOBALS['type']}&tab=gallery&post_id=$post_id";
|
||||
|
||||
?>
|
||||
|
||||
<script type="text/javascript">
|
||||
@@ -1111,22 +907,15 @@ jQuery(function($){
|
||||
<form enctype="multipart/form-data" method="post" action="<?php echo attribute_escape($form_action_url); ?>" class="media-upload-form validate" id="gallery-form">
|
||||
<?php wp_nonce_field('media-form'); ?>
|
||||
<?php //media_upload_form( $errors ); ?>
|
||||
<table class="widefat">
|
||||
<thead><tr>
|
||||
<th><?php _e('Media'); ?></th>
|
||||
<th class="order-head"><?php _e('Order'); ?></th>
|
||||
</tr></thead>
|
||||
</table>
|
||||
|
||||
<div id="media-items">
|
||||
<?php echo get_media_items($post_id, $errors); ?>
|
||||
</div>
|
||||
<p class="ml-submit">
|
||||
<input type="submit" class="button savebutton" name="save" value="<?php echo attribute_escape( __( 'Save all changes' ) ); ?>" />
|
||||
<input type="submit" class="button insert-gallery" name="insert-gallery" value="<?php echo attribute_escape( __( 'Insert gallery into post' ) ); ?>" />
|
||||
<input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
|
||||
<input type="hidden" name="type" value="<?php echo attribute_escape( $GLOBALS['type'] ); ?>" />
|
||||
<input type="hidden" name="tab" value="<?php echo attribute_escape( $GLOBALS['tab'] ); ?>" />
|
||||
</p>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
@@ -1138,7 +927,7 @@ function media_upload_library_form($errors) {
|
||||
|
||||
$post_id = intval($_REQUEST['post_id']);
|
||||
|
||||
$form_action_url = admin_url("media-upload.php?type={$GLOBALS['type']}&tab=library&post_id=$post_id");
|
||||
$form_action_url = get_option('siteurl') . "/wp-admin/media-upload.php?type={$GLOBALS['type']}&tab=library&post_id=$post_id";
|
||||
|
||||
$_GET['paged'] = intval($_GET['paged']);
|
||||
if ( $_GET['paged'] < 1 )
|
||||
@@ -1159,11 +948,11 @@ function media_upload_library_form($errors) {
|
||||
<input type="hidden" name="post_mime_type" value="<?php echo attribute_escape( $_GET['post_mime_type'] ); ?>" />
|
||||
|
||||
<div id="search-filter">
|
||||
<label class="hidden" for="post-search-input"><?php _e('Search Media');?>:</label>
|
||||
<input type="text" id="post-search-input" name="s" value="<?php the_search_query(); ?>" />
|
||||
<input type="submit" value="<?php echo attribute_escape( __( 'Search Media' ) ); ?>" class="button" />
|
||||
</div>
|
||||
|
||||
<p>
|
||||
<ul class="subsubsub">
|
||||
<?php
|
||||
$type_links = array();
|
||||
@@ -1179,7 +968,7 @@ if ( empty($_GET['post_mime_type']) && !empty($num_posts[$type]) ) {
|
||||
}
|
||||
if ( empty($_GET['post_mime_type']) || $_GET['post_mime_type'] == 'all' )
|
||||
$class = ' class="current"';
|
||||
$type_links[] = "<li><a href='" . clean_url(add_query_arg(array('post_mime_type'=>'all', 'paged'=>false, 'm'=>false))) . "'$class>".__('All Types')."</a>";
|
||||
$type_links[] = "<li><a href='" . add_query_arg(array('post_mime_type'=>'all', 'paged'=>false, 'm'=>false)) . "'$class>".__('All Types')."</a>";
|
||||
foreach ( $post_mime_types as $mime_type => $label ) {
|
||||
$class = '';
|
||||
|
||||
@@ -1189,12 +978,13 @@ foreach ( $post_mime_types as $mime_type => $label ) {
|
||||
if ( wp_match_mime_types($mime_type, $_GET['post_mime_type']) )
|
||||
$class = ' class="current"';
|
||||
|
||||
$type_links[] = "<li><a href='" . clean_url(add_query_arg(array('post_mime_type'=>$mime_type, 'paged'=>false))) . "'$class>" . sprintf(__ngettext($label[2][0], $label[2][1], $num_posts[$mime_type]), "<span id='$mime_type-counter'>" . number_format_i18n( $num_posts[$mime_type] ) . '</span>') . '</a>';
|
||||
$type_links[] = "<li><a href='" . add_query_arg(array('post_mime_type'=>$mime_type, 'paged'=>false)) . "'$class>" . sprintf(__ngettext($label[2][0], $label[2][1], $num_posts[$mime_type]), "<span id='$mime_type-counter'>" . number_format_i18n( $num_posts[$mime_type] ) . '</span>') . '</a>';
|
||||
}
|
||||
echo implode(' | </li>', $type_links) . '</li>';
|
||||
unset($type_links);
|
||||
?>
|
||||
</ul>
|
||||
</p>
|
||||
|
||||
<div class="tablenav">
|
||||
|
||||
@@ -1269,92 +1059,51 @@ jQuery(function($){
|
||||
<div id="media-items">
|
||||
<?php echo get_media_items(null, $errors); ?>
|
||||
</div>
|
||||
<p class="ml-submit">
|
||||
<input type="submit" class="button savebutton" name="save" value="<?php echo attribute_escape( __( 'Save all changes' ) ); ?>" />
|
||||
<input type="hidden" name="post_id" id="post_id" value="<?php echo (int) $post_id; ?>" />
|
||||
</p>
|
||||
</form>
|
||||
<?php
|
||||
}
|
||||
|
||||
function type_form_image() {
|
||||
$form = '
|
||||
return '
|
||||
<table class="describe"><tbody>
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label" style="width:120px;">
|
||||
<span class="alignleft"><label for="src">' . __('Source') . '</label></span>
|
||||
<span class="alignright"><img id="status_img" src="images/required.gif" title="required" alt="required" /></span>
|
||||
</th>
|
||||
<td class="field"><input id="src" name="src" value="" type="text" aria-required="true" onblur="addExtImage.getImageData()"></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label">
|
||||
<span class="alignleft"><label for="title">' . __('Image Title') . '</label></span>
|
||||
<span class="alignleft"><label for="insertonly[src]">' . __('Image URL') . '</label></span>
|
||||
<span class="alignright"><abbr title="required" class="required">*</abbr></span>
|
||||
</th>
|
||||
<td class="field"><p><input id="title" name="title" value="" type="text" aria-required="true" /></p></td>
|
||||
<td class="field"><input id="insertonly[src]" name="insertonly[src]" value="" type="text"></td>
|
||||
</tr>
|
||||
';
|
||||
// CAPTIONS_OFF is temporary. Do not use it.
|
||||
if ( defined('CAPTIONS_OFF') && true == CAPTIONS_OFF ) {
|
||||
$form .= '
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label">
|
||||
<span class="alignleft"><label for="alt">' . __('Alternate Text') . '</label></span>
|
||||
<span class="alignleft"><label for="insertonly[alt]">' . __('Description') . '</label></span>
|
||||
<span class="alignright"><abbr title="required" class="required">*</abbr></span>
|
||||
</th>
|
||||
<td class="field"><input id="alt" name="alt" value="" type="text" aria-required="true" />
|
||||
<p class="help">' . __('Alt text for the image, e.g. "The Mona Lisa"') . '</p></td>
|
||||
<td class="field"><input id="insertonly[alt]" name="insertonly[alt]" value="" type="text"></td>
|
||||
</tr>
|
||||
';
|
||||
|
||||
} else {
|
||||
$form .= '
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label">
|
||||
<span class="alignleft"><label for="alt">' . __('Image Caption') . '</label></span>
|
||||
</th>
|
||||
<td class="field"><input id="alt" name="alt" value="" type="text" aria-required="true" />
|
||||
<p class="help">' . __('Also used as alternate text for the image') . '</p></td>
|
||||
</tr>
|
||||
';
|
||||
}
|
||||
$form .= '
|
||||
<tr><td></td><td class="help">' . __('Alternate text, e.g. "The Mona Lisa"') . '</td></tr>
|
||||
<tr class="align">
|
||||
<th valign="top" scope="row" class="label"><p><label for="align">' . __('Alignment') . '</label></p></th>
|
||||
<th valign="top" scope="row" class="label"><label for="insertonly[align]">' . __('Alignment') . '</label></th>
|
||||
<td class="field">
|
||||
<input name="align" id="align-none" value="alignnone" onclick="addExtImage.align=this.value" type="radio" checked="checked" />
|
||||
<label for="align-none" class="align image-align-none-label">' . __('None') . '</label>
|
||||
<input name="align" id="align-left" value="alignleft" onclick="addExtImage.align=this.value" type="radio" />
|
||||
<label for="align-left" class="align image-align-left-label">' . __('Left') . '</label>
|
||||
<input name="align" id="align-center" value="aligncenter" onclick="addExtImage.align=this.value" type="radio" />
|
||||
<label for="align-center" class="align image-align-center-label">' . __('Center') . '</label>
|
||||
<input name="align" id="align-right" value="alignright" onclick="addExtImage.align=this.value" type="radio" />
|
||||
<label for="align-right" class="align image-align-right-label">' . __('Right') . '</label>
|
||||
<input name="insertonly[align]" id="image-align-none-0" value="none" type="radio" checked="checked" />
|
||||
<label for="image-align-none-0" class="align image-align-none-label">' . __('None') . '</label>
|
||||
<input name="insertonly[align]" id="image-align-left-0" value="left" type="radio" />
|
||||
<label for="image-align-left-0" class="align image-align-left-label">' . __('Left') . '</label>
|
||||
<input name="insertonly[align]" id="image-align-center-0" value="center" type="radio" />
|
||||
<label for="image-align-center-0" class="align image-align-center-label">' . __('Center') . '</label>
|
||||
<input name="insertonly[align]" id="image-align-right-0" value="right" type="radio" />
|
||||
<label for="image-align-right-0" class="align image-align-right-label">' . __('Right') . '</label>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label">
|
||||
<span class="alignleft"><label for="url">' . __('Link URL') . '</label></span>
|
||||
</th>
|
||||
<td class="field"><input id="url" name="url" value="" type="text" /><br />
|
||||
|
||||
<button type="button" class="button" value="" onclick="document.forms[0].url.value=null">' . __('None') . '</button>
|
||||
<button type="button" class="button" value="" onclick="document.forms[0].url.value=document.forms[0].src.value">' . __('Link to image') . '</button>
|
||||
<p class="help">' . __('Enter a link URL or click above for presets.') . '</p></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<input type="button" class="button" id="go_button" style="color:#bbb;" onclick="addExtImage.insert()" value="' . attribute_escape(__('Insert into Post')) . '" />
|
||||
<input type="submit" class="button" name="insertonlybutton" value="' . attribute_escape(__('Insert into Post')) . '" />
|
||||
</td>
|
||||
</tr>
|
||||
</tbody></table>
|
||||
';
|
||||
|
||||
return $form;
|
||||
}
|
||||
|
||||
function type_form_audio() {
|
||||
@@ -1365,14 +1114,14 @@ function type_form_audio() {
|
||||
<span class="alignleft"><label for="insertonly[href]">' . __('Audio File URL') . '</label></span>
|
||||
<span class="alignright"><abbr title="required" class="required">*</abbr></span>
|
||||
</th>
|
||||
<td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text" aria-required="true"></td>
|
||||
<td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label">
|
||||
<span class="alignleft"><label for="insertonly[title]">' . __('Title') . '</label></span>
|
||||
<span class="alignright"><abbr title="required" class="required">*</abbr></span>
|
||||
</th>
|
||||
<td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text" aria-required="true"></td>
|
||||
<td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text"></td>
|
||||
</tr>
|
||||
<tr><td></td><td class="help">' . __('Link text, e.g. "Still Alive by Jonathan Coulton"') . '</td></tr>
|
||||
<tr>
|
||||
@@ -1393,14 +1142,14 @@ function type_form_video() {
|
||||
<span class="alignleft"><label for="insertonly[href]">' . __('Video URL') . '</label></span>
|
||||
<span class="alignright"><abbr title="required" class="required">*</abbr></span>
|
||||
</th>
|
||||
<td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text" aria-required="true"></td>
|
||||
<td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label">
|
||||
<span class="alignleft"><label for="insertonly[title]">' . __('Title') . '</label></span>
|
||||
<span class="alignright"><abbr title="required" class="required">*</abbr></span>
|
||||
</th>
|
||||
<td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text" aria-required="true"></td>
|
||||
<td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text"></td>
|
||||
</tr>
|
||||
<tr><td></td><td class="help">' . __('Link text, e.g. "Lucy on YouTube"') . '</td></tr>
|
||||
<tr>
|
||||
@@ -1421,14 +1170,14 @@ function type_form_file() {
|
||||
<span class="alignleft"><label for="insertonly[href]">' . __('URL') . '</label></span>
|
||||
<span class="alignright"><abbr title="required" class="required">*</abbr></span>
|
||||
</th>
|
||||
<td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text" aria-required="true"></td>
|
||||
<td class="field"><input id="insertonly[href]" name="insertonly[href]" value="" type="text"></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th valign="top" scope="row" class="label">
|
||||
<span class="alignleft"><label for="insertonly[title]">' . __('Title') . '</label></span>
|
||||
<span class="alignright"><abbr title="required" class="required">*</abbr></span>
|
||||
</th>
|
||||
<td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text" aria-required="true"></td>
|
||||
<td class="field"><input id="insertonly[title]" name="insertonly[title]" value="" type="text"></td>
|
||||
</tr>
|
||||
<tr><td></td><td class="help">' . __('Link text, e.g. "Ransom Demands (PDF)"') . '</td></tr>
|
||||
<tr>
|
||||
@@ -1441,49 +1190,6 @@ function type_form_file() {
|
||||
';
|
||||
}
|
||||
|
||||
// support a GET parameter for disabling the flash uploader
|
||||
function media_upload_use_flash($flash) {
|
||||
if ( array_key_exists('flash', $_REQUEST) )
|
||||
$flash = !empty($_REQUEST['flash']);
|
||||
return $flash;
|
||||
}
|
||||
|
||||
add_filter('flash_uploader', 'media_upload_use_flash');
|
||||
|
||||
function media_upload_flash_bypass() {
|
||||
echo '<p class="upload-flash-bypass">';
|
||||
printf( __('You are using the Flash uploader. Problems? Try the <a href="%s">Browser uploader</a> instead.'), clean_url(add_query_arg('flash', 0)) );
|
||||
echo '</p>';
|
||||
}
|
||||
|
||||
add_action('post-flash-upload-ui', 'media_upload_flash_bypass');
|
||||
|
||||
function media_upload_html_bypass() {
|
||||
echo '<p class="upload-html-bypass">';
|
||||
if ( array_key_exists('flash', $_REQUEST) )
|
||||
// the user manually selected the browser uploader, so let them switch back to Flash
|
||||
printf( __('You are using the Browser uploader. Try the <a href="%s">Flash uploader</a> instead.'), clean_url(add_query_arg('flash', 1)) );
|
||||
else
|
||||
// the user probably doesn't have Flash
|
||||
printf( __('You are using the Browser uploader.') );
|
||||
|
||||
echo '</p>';
|
||||
}
|
||||
|
||||
add_action('post-flash-upload-ui', 'media_upload_flash_bypass');
|
||||
add_action('post-html-upload-ui', 'media_upload_html_bypass');
|
||||
|
||||
// make sure the GET parameter sticks when we submit a form
|
||||
function media_upload_bypass_url($url) {
|
||||
if ( array_key_exists('flash', $_REQUEST) )
|
||||
$url = add_query_arg('flash', intval($_REQUEST['flash']));
|
||||
return $url;
|
||||
}
|
||||
|
||||
add_filter('media_upload_form_url', 'media_upload_bypass_url');
|
||||
|
||||
|
||||
|
||||
add_filter('async_upload_image', 'get_media_item', 10, 2);
|
||||
add_filter('async_upload_audio', 'get_media_item', 10, 2);
|
||||
add_filter('async_upload_video', 'get_media_item', 10, 2);
|
||||
@@ -1493,9 +1199,12 @@ add_action('media_upload_image', 'media_upload_image');
|
||||
add_action('media_upload_audio', 'media_upload_audio');
|
||||
add_action('media_upload_video', 'media_upload_video');
|
||||
add_action('media_upload_file', 'media_upload_file');
|
||||
add_action('admin_head_media_upload_type_form', 'media_admin_css');
|
||||
|
||||
add_filter('media_upload_gallery', 'media_upload_gallery');
|
||||
add_action('admin_head_media_upload_gallery_form', 'media_admin_css');
|
||||
|
||||
add_filter('media_upload_library', 'media_upload_library');
|
||||
add_action('admin_head_media_upload_library_form', 'media_admin_css');
|
||||
|
||||
?>
|
||||
|
||||
@@ -67,7 +67,7 @@ function insert_with_markers( $filename, $marker, $insertion ) {
|
||||
}
|
||||
}
|
||||
if (!$foundit) {
|
||||
fwrite( $f, "\n# BEGIN {$marker}\n" );
|
||||
fwrite( $f, "# BEGIN {$marker}\n" );
|
||||
foreach ( $insertion as $insertline )
|
||||
fwrite( $f, "{$insertline}\n" );
|
||||
fwrite( $f, "# END {$marker}\n" );
|
||||
|
||||
@@ -32,15 +32,14 @@ function get_plugin_data( $plugin_file ) {
|
||||
}
|
||||
|
||||
function get_plugins($plugin_folder = '') {
|
||||
|
||||
if ( ! $cache_plugins = wp_cache_get('plugins', 'plugins') )
|
||||
$cached_plugins = array();
|
||||
|
||||
if ( isset($cache_plugins[ $plugin_folder ]) )
|
||||
return $cache_plugins[ $plugin_folder ];
|
||||
|
||||
global $wp_plugins;
|
||||
|
||||
if ( isset( $wp_plugins ) ) {
|
||||
return $wp_plugins;
|
||||
}
|
||||
|
||||
$wp_plugins = array ();
|
||||
$plugin_root = WP_PLUGIN_DIR;
|
||||
$plugin_root = ABSPATH . PLUGINDIR;
|
||||
if( !empty($plugin_folder) )
|
||||
$plugin_root .= $plugin_folder;
|
||||
|
||||
@@ -86,9 +85,6 @@ function get_plugins($plugin_folder = '') {
|
||||
|
||||
uasort( $wp_plugins, create_function( '$a, $b', 'return strnatcasecmp( $a["Name"], $b["Name"] );' ));
|
||||
|
||||
$cache_plugins[ $plugin_folder ] = $wp_plugins;
|
||||
wp_cache_set('plugins', $cache_plugins, 'plugins');
|
||||
|
||||
return $wp_plugins;
|
||||
}
|
||||
|
||||
@@ -108,7 +104,7 @@ function activate_plugin($plugin, $redirect = '') {
|
||||
if ( !empty($redirect) )
|
||||
wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect)); // we'll override this later if the plugin can be included without fatal error
|
||||
ob_start();
|
||||
@include(WP_PLUGIN_DIR . '/' . $plugin);
|
||||
@include(ABSPATH . PLUGINDIR . '/' . $plugin);
|
||||
$current[] = $plugin;
|
||||
sort($current);
|
||||
update_option('active_plugins', $current);
|
||||
@@ -136,99 +132,40 @@ function deactivate_plugins($plugins, $silent= false) {
|
||||
update_option('active_plugins', $current);
|
||||
}
|
||||
|
||||
function activate_plugins($plugins, $redirect = '') {
|
||||
if ( !is_array($plugins) )
|
||||
$plugins = array($plugins);
|
||||
function deactivate_all_plugins() {
|
||||
$current = get_option('active_plugins');
|
||||
if ( empty($current) )
|
||||
return;
|
||||
|
||||
deactivate_plugins($current);
|
||||
|
||||
update_option('deactivated_plugins', $current);
|
||||
}
|
||||
|
||||
function reactivate_all_plugins($redirect = '') {
|
||||
$plugins = get_option('deactivated_plugins');
|
||||
|
||||
if ( empty($plugins) )
|
||||
return;
|
||||
|
||||
if ( !empty($redirect) )
|
||||
wp_redirect(add_query_arg('_error_nonce', wp_create_nonce('plugin-activation-error_' . $plugin), $redirect));
|
||||
|
||||
$errors = array();
|
||||
foreach ( (array) $plugins as $plugin ) {
|
||||
if ( !empty($redirect) )
|
||||
$redirect = add_query_arg('plugin', $plugin, $redirect);
|
||||
$result = activate_plugin($plugin, $redirect);
|
||||
$result = activate_plugin($plugin);
|
||||
if ( is_wp_error($result) )
|
||||
$errors[$plugin] = $result;
|
||||
}
|
||||
|
||||
delete_option('deactivated_plugins');
|
||||
|
||||
if ( !empty($errors) )
|
||||
return new WP_Error('plugins_invalid', __('One of the plugins is invalid.'), $errors);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function delete_plugins($plugins, $redirect = '' ) {
|
||||
global $wp_filesystem;
|
||||
|
||||
if( empty($plugins) )
|
||||
return false;
|
||||
|
||||
$checked = array();
|
||||
foreach( $plugins as $plugin )
|
||||
$checked[] = 'checked[]=' . $plugin;
|
||||
|
||||
ob_start();
|
||||
$url = wp_nonce_url('plugins.php?action=delete-selected&verify-delete=1&' . implode('&', $checked), 'bulk-manage-plugins');
|
||||
if ( false === ($credentials = request_filesystem_credentials($url)) ) {
|
||||
$data = ob_get_contents();
|
||||
ob_end_clean();
|
||||
if( ! empty($data) ){
|
||||
include_once( ABSPATH . 'wp-admin/admin-header.php');
|
||||
echo $data;
|
||||
include( ABSPATH . 'wp-admin/admin-footer.php');
|
||||
exit;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if ( ! WP_Filesystem($credentials) ) {
|
||||
request_filesystem_credentials($url, '', true); //Failed to connect, Error and request again
|
||||
$data = ob_get_contents();
|
||||
ob_end_clean();
|
||||
if( ! empty($data) ){
|
||||
include_once( ABSPATH . 'wp-admin/admin-header.php');
|
||||
echo $data;
|
||||
include( ABSPATH . 'wp-admin/admin-footer.php');
|
||||
exit;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if ( $wp_filesystem->errors->get_error_code() ) {
|
||||
return $wp_filesystem->errors;
|
||||
}
|
||||
|
||||
if ( ! is_object($wp_filesystem) )
|
||||
return new WP_Error('fs_unavailable', __('Could not access filesystem.'));
|
||||
|
||||
if ( $wp_filesystem->errors->get_error_code() )
|
||||
return new WP_Error('fs_error', __('Filesystem error'), $wp_filesystem->errors);
|
||||
|
||||
//Get the base plugin folder
|
||||
$plugins_dir = $wp_filesystem->wp_plugins_dir();
|
||||
if ( empty($plugins_dir) )
|
||||
return new WP_Error('fs_no_plugins_dir', __('Unable to locate WordPress Plugin directory.'));
|
||||
|
||||
$plugins_dir = trailingslashit( $plugins_dir );
|
||||
|
||||
$errors = array();
|
||||
|
||||
foreach( $plugins as $plugin_file ) {
|
||||
$this_plugin_dir = trailingslashit( dirname($plugins_dir . $plugin_file) );
|
||||
// If plugin is in its own directory, recursively delete the directory.
|
||||
if ( strpos($plugin_file, '/') && $this_plugin_dir != $plugins_dir ) //base check on if plugin includes directory seperator AND that its not the root plugin folder
|
||||
$deleted = $wp_filesystem->delete($this_plugin_dir, true);
|
||||
else
|
||||
$deleted = $wp_filesystem->delete($plugins_dir . $plugin_file);
|
||||
|
||||
if ( ! $deleted )
|
||||
$errors[] = $plugin_file;
|
||||
}
|
||||
|
||||
if( ! empty($errors) )
|
||||
return new WP_Error('could_not_remove_plugin', sprintf(__('Could not fully remove the plugin(s) %s'), implode(', ', $errors)) );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
function validate_active_plugins() {
|
||||
$check_plugins = get_option('active_plugins');
|
||||
|
||||
@@ -242,9 +179,13 @@ function validate_active_plugins() {
|
||||
// If a plugin file does not exist, remove it from the list of active
|
||||
// plugins.
|
||||
foreach ( $check_plugins as $check_plugin ) {
|
||||
$result = validate_plugin($check_plugin);
|
||||
if ( is_wp_error( $result ) ) {
|
||||
deactivate_plugins( $check_plugin, true);
|
||||
if ( !file_exists(ABSPATH . PLUGINDIR . '/' . $check_plugin) ) {
|
||||
$current = get_option('active_plugins');
|
||||
$key = array_search($check_plugin, $current);
|
||||
if ( false !== $key && NULL !== $key ) {
|
||||
unset($current[$key]);
|
||||
update_option('active_plugins', $current);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -252,7 +193,7 @@ function validate_active_plugins() {
|
||||
function validate_plugin($plugin) {
|
||||
if ( validate_file($plugin) )
|
||||
return new WP_Error('plugin_invalid', __('Invalid plugin.'));
|
||||
if ( ! file_exists(WP_PLUGIN_DIR . '/' . $plugin) )
|
||||
if ( ! file_exists(ABSPATH . PLUGINDIR . '/' . $plugin) )
|
||||
return new WP_Error('plugin_not_found', __('Plugin file does not exist.'));
|
||||
|
||||
return 0;
|
||||
@@ -470,16 +411,18 @@ function get_plugin_page_hookname( $plugin_page, $parent_page ) {
|
||||
|
||||
$parent = get_admin_page_parent();
|
||||
|
||||
$page_type = 'admin';
|
||||
if ( empty ( $parent_page ) || 'admin.php' == $parent_page ) {
|
||||
if ( isset( $admin_page_hooks[$plugin_page] ))
|
||||
$page_type = 'toplevel';
|
||||
else
|
||||
if ( isset( $admin_page_hooks[$parent] ))
|
||||
$page_type = $admin_page_hooks[$parent];
|
||||
} else if ( isset( $admin_page_hooks[$parent_page] ) ) {
|
||||
$page_type = $admin_page_hooks[$parent_page];
|
||||
}
|
||||
} else
|
||||
if ( isset( $admin_page_hooks[$parent_page] ) ) {
|
||||
$page_type = $admin_page_hooks[$parent_page];
|
||||
} else {
|
||||
$page_type = 'admin';
|
||||
}
|
||||
|
||||
$plugin_name = preg_replace( '!\.php!', '', $plugin_page );
|
||||
|
||||
|
||||
@@ -1,113 +1,5 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* _wp_translate_postdata() - Rename $_POST data from form names to DB post columns.
|
||||
*
|
||||
* Manipulates $_POST directly.
|
||||
*
|
||||
* @package WordPress
|
||||
* @since 2.6
|
||||
*
|
||||
* @param bool $update Are we updating a pre-existing post?
|
||||
* @return object|bool WP_Error on failure, true on success.
|
||||
*/
|
||||
function _wp_translate_postdata( $update = false ) {
|
||||
if ( $update )
|
||||
$_POST['ID'] = (int) $_POST['post_ID'];
|
||||
$_POST['post_content'] = $_POST['content'];
|
||||
$_POST['post_excerpt'] = $_POST['excerpt'];
|
||||
$_POST['post_parent'] = isset($_POST['parent_id'])? $_POST['parent_id'] : '';
|
||||
$_POST['to_ping'] = $_POST['trackback_url'];
|
||||
|
||||
if (!empty ( $_POST['post_author_override'] ) ) {
|
||||
$_POST['post_author'] = (int) $_POST['post_author_override'];
|
||||
} else {
|
||||
if (!empty ( $_POST['post_author'] ) ) {
|
||||
$_POST['post_author'] = (int) $_POST['post_author'];
|
||||
} else {
|
||||
$_POST['post_author'] = (int) $_POST['user_ID'];
|
||||
}
|
||||
}
|
||||
|
||||
if ( $_POST['post_author'] != $_POST['user_ID'] ) {
|
||||
if ( 'page' == $_POST['post_type'] ) {
|
||||
if ( !current_user_can( 'edit_others_pages' ) ) {
|
||||
return new WP_Error( 'edit_others_pages', $update ?
|
||||
__( 'You are not allowed to edit pages as this user.' ) :
|
||||
__( 'You are not allowed to create pages as this user.' )
|
||||
);
|
||||
}
|
||||
} else {
|
||||
if ( !current_user_can( 'edit_others_posts' ) ) {
|
||||
return new WP_Error( 'edit_others_posts', $update ?
|
||||
__( 'You are not allowed to edit posts as this user.' ) :
|
||||
__( 'You are not allowed to post as this user.' )
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// What to do based on which button they pressed
|
||||
if ( isset($_POST['saveasdraft']) && '' != $_POST['saveasdraft'] )
|
||||
$_POST['post_status'] = 'draft';
|
||||
if ( isset($_POST['saveasprivate']) && '' != $_POST['saveasprivate'] )
|
||||
$_POST['post_status'] = 'private';
|
||||
if ( isset($_POST['publish']) && ( '' != $_POST['publish'] ) && ( $_POST['post_status'] != 'private' ) )
|
||||
$_POST['post_status'] = 'publish';
|
||||
if ( isset($_POST['advanced']) && '' != $_POST['advanced'] )
|
||||
$_POST['post_status'] = 'draft';
|
||||
|
||||
$previous_status = get_post_field('post_status', $_POST['ID']);
|
||||
|
||||
// Posts 'submitted for approval' present are submitted to $_POST the same as if they were being published.
|
||||
// Change status from 'publish' to 'pending' if user lacks permissions to publish or to resave published posts.
|
||||
if ( 'page' == $_POST['post_type'] ) {
|
||||
if ( 'publish' == $_POST['post_status'] && !current_user_can( 'publish_pages' ) )
|
||||
if ( $previous_status != 'publish' OR !current_user_can( 'edit_published_pages') )
|
||||
$_POST['post_status'] = 'pending';
|
||||
} else {
|
||||
if ( 'publish' == $_POST['post_status'] && !current_user_can( 'publish_posts' ) ) :
|
||||
// Stop attempts to publish new posts, but allow already published posts to be saved if appropriate.
|
||||
if ( $previous_status != 'publish' OR !current_user_can( 'edit_published_posts') )
|
||||
$_POST['post_status'] = 'pending';
|
||||
endif;
|
||||
}
|
||||
|
||||
if (!isset( $_POST['comment_status'] ))
|
||||
$_POST['comment_status'] = 'closed';
|
||||
|
||||
if (!isset( $_POST['ping_status'] ))
|
||||
$_POST['ping_status'] = 'closed';
|
||||
|
||||
foreach ( array('aa', 'mm', 'jj', 'hh', 'mn') as $timeunit ) {
|
||||
if ( !empty( $_POST['hidden_' . $timeunit] ) && $_POST['hidden_' . $timeunit] != $_POST[$timeunit] ) {
|
||||
$_POST['edit_date'] = '1';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if ( !empty( $_POST['edit_date'] ) ) {
|
||||
$aa = $_POST['aa'];
|
||||
$mm = $_POST['mm'];
|
||||
$jj = $_POST['jj'];
|
||||
$hh = $_POST['hh'];
|
||||
$mn = $_POST['mn'];
|
||||
$ss = $_POST['ss'];
|
||||
$aa = ($aa <= 0 ) ? date('Y') : $aa;
|
||||
$mm = ($mm <= 0 ) ? date('n') : $mm;
|
||||
$jj = ($jj > 31 ) ? 31 : $jj;
|
||||
$jj = ($jj <= 0 ) ? date('j') : $jj;
|
||||
$hh = ($hh > 23 ) ? $hh -24 : $hh;
|
||||
$mn = ($mn > 59 ) ? $mn -60 : $mn;
|
||||
$ss = ($ss > 59 ) ? $ss -60 : $ss;
|
||||
$_POST['post_date'] = sprintf( "%04d-%02d-%02d %02d:%02d:%02d", $aa, $mm, $jj, $hh, $mn, $ss );
|
||||
$_POST['post_date_gmt'] = get_gmt_from_date( $_POST['post_date'] );
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
// Update an existing post with values provided in $_POST.
|
||||
function edit_post() {
|
||||
|
||||
@@ -131,9 +23,78 @@ function edit_post() {
|
||||
return $post_ID;
|
||||
}
|
||||
|
||||
$translated = _wp_translate_postdata( true );
|
||||
if ( is_wp_error($translated) )
|
||||
wp_die( $translated->get_error_message() );
|
||||
// Rename.
|
||||
$_POST['ID'] = (int) $_POST['post_ID'];
|
||||
$_POST['post_content'] = $_POST['content'];
|
||||
$_POST['post_excerpt'] = $_POST['excerpt'];
|
||||
$_POST['post_parent'] = isset($_POST['parent_id'])? $_POST['parent_id'] : '';
|
||||
$_POST['to_ping'] = $_POST['trackback_url'];
|
||||
|
||||
if (!empty ( $_POST['post_author_override'] ) ) {
|
||||
$_POST['post_author'] = (int) $_POST['post_author_override'];
|
||||
} else
|
||||
if (!empty ( $_POST['post_author'] ) ) {
|
||||
$_POST['post_author'] = (int) $_POST['post_author'];
|
||||
} else {
|
||||
$_POST['post_author'] = (int) $_POST['user_ID'];
|
||||
}
|
||||
|
||||
if ( $_POST['post_author'] != $_POST['user_ID'] ) {
|
||||
if ( 'page' == $_POST['post_type'] ) {
|
||||
if ( !current_user_can( 'edit_others_pages' ) )
|
||||
wp_die( __('You are not allowed to edit pages as this user.' ));
|
||||
} else {
|
||||
if ( !current_user_can( 'edit_others_posts' ) )
|
||||
wp_die( __('You are not allowed to edit posts as this user.' ));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// What to do based on which button they pressed
|
||||
if ( isset($_POST['saveasdraft']) && '' != $_POST['saveasdraft'] )
|
||||
$_POST['post_status'] = 'draft';
|
||||
if ( isset($_POST['saveasprivate']) && '' != $_POST['saveasprivate'] )
|
||||
$_POST['post_status'] = 'private';
|
||||
if ( isset($_POST['publish']) && ( '' != $_POST['publish'] ) && ( $_POST['post_status'] != 'private' ) )
|
||||
$_POST['post_status'] = 'publish';
|
||||
if ( isset($_POST['advanced']) && '' != $_POST['advanced'] )
|
||||
$_POST['post_status'] = 'draft';
|
||||
|
||||
if ( 'page' == $_POST['post_type'] ) {
|
||||
if ('publish' == $_POST['post_status'] && !current_user_can( 'publish_pages' ))
|
||||
$_POST['post_status'] = 'pending';
|
||||
} else {
|
||||
if ('publish' == $_POST['post_status'] && !current_user_can( 'publish_posts' ))
|
||||
$_POST['post_status'] = 'pending';
|
||||
}
|
||||
|
||||
if (!isset( $_POST['comment_status'] ))
|
||||
$_POST['comment_status'] = 'closed';
|
||||
|
||||
if (!isset( $_POST['ping_status'] ))
|
||||
$_POST['ping_status'] = 'closed';
|
||||
|
||||
foreach ( array ('aa', 'mm', 'jj', 'hh', 'mn') as $timeunit ) {
|
||||
if ( !empty( $_POST['hidden_' . $timeunit] ) && $_POST['hidden_' . $timeunit] != $_POST[$timeunit] ) {
|
||||
$_POST['edit_date'] = '1';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty ( $_POST['edit_date'] ) ) {
|
||||
$aa = $_POST['aa'];
|
||||
$mm = $_POST['mm'];
|
||||
$jj = $_POST['jj'];
|
||||
$hh = $_POST['hh'];
|
||||
$mn = $_POST['mn'];
|
||||
$ss = $_POST['ss'];
|
||||
$jj = ($jj > 31 ) ? 31 : $jj;
|
||||
$hh = ($hh > 23 ) ? $hh -24 : $hh;
|
||||
$mn = ($mn > 59 ) ? $mn -60 : $mn;
|
||||
$ss = ($ss > 59 ) ? $ss -60 : $ss;
|
||||
$_POST['post_date'] = "$aa-$mm-$jj $hh:$mn:$ss";
|
||||
$_POST['post_date_gmt'] = get_gmt_from_date( "$aa-$mm-$jj $hh:$mn:$ss" );
|
||||
}
|
||||
|
||||
// Meta Stuff
|
||||
if ( isset($_POST['meta']) && $_POST['meta'] ) {
|
||||
@@ -233,13 +194,13 @@ function post_exists($title, $content = '', $post_date = '') {
|
||||
global $wpdb;
|
||||
|
||||
if (!empty ($post_date))
|
||||
$post_date = $wpdb->prepare("AND post_date = %s", $post_date);
|
||||
$post_date = "AND post_date = '$post_date'";
|
||||
|
||||
if (!empty ($title))
|
||||
return $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_title = %s $post_date", $title) );
|
||||
return $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_title = '$title' $post_date");
|
||||
else
|
||||
if (!empty ($content))
|
||||
return $wpdb->get_var( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_content = %s $post_date", $content) );
|
||||
return $wpdb->get_var("SELECT ID FROM $wpdb->posts WHERE post_content = '$content' $post_date");
|
||||
|
||||
return 0;
|
||||
}
|
||||
@@ -275,9 +236,79 @@ function wp_write_post() {
|
||||
}
|
||||
}
|
||||
|
||||
$translated = _wp_translate_postdata( false );
|
||||
if ( is_wp_error($translated) )
|
||||
return $translated;
|
||||
// Rename.
|
||||
$_POST['post_content'] = $_POST['content'];
|
||||
$_POST['post_excerpt'] = $_POST['excerpt'];
|
||||
$_POST['post_parent'] = isset($_POST['parent_id'])? $_POST['parent_id'] : '';
|
||||
$_POST['to_ping'] = $_POST['trackback_url'];
|
||||
|
||||
if (!empty ( $_POST['post_author_override'] ) ) {
|
||||
$_POST['post_author'] = (int) $_POST['post_author_override'];
|
||||
} else {
|
||||
if (!empty ( $_POST['post_author'] ) ) {
|
||||
$_POST['post_author'] = (int) $_POST['post_author'];
|
||||
} else {
|
||||
$_POST['post_author'] = (int) $_POST['user_ID'];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if ( $_POST['post_author'] != $_POST['user_ID'] ) {
|
||||
if ( 'page' == $_POST['post_type'] ) {
|
||||
if ( !current_user_can( 'edit_others_pages' ) )
|
||||
return new WP_Error( 'edit_others_pages', __( 'You are not allowed to create pages as this user.' ) );
|
||||
} else {
|
||||
if ( !current_user_can( 'edit_others_posts' ) )
|
||||
return new WP_Error( 'edit_others_posts', __( 'You are not allowed to post as this user.' ) );
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
// What to do based on which button they pressed
|
||||
if ( isset($_POST['saveasdraft']) && '' != $_POST['saveasdraft'] )
|
||||
$_POST['post_status'] = 'draft';
|
||||
if ( isset($_POST['saveasprivate']) && '' != $_POST['saveasprivate'] )
|
||||
$_POST['post_status'] = 'private';
|
||||
if ( isset($_POST['publish']) && ( '' != $_POST['publish'] ) && ( $_POST['post_status'] != 'private' ) )
|
||||
$_POST['post_status'] = 'publish';
|
||||
if ( isset($_POST['advanced']) && '' != $_POST['advanced'] )
|
||||
$_POST['post_status'] = 'draft';
|
||||
|
||||
if ( 'page' == $_POST['post_type'] ) {
|
||||
if ('publish' == $_POST['post_status'] && !current_user_can( 'publish_pages' ) )
|
||||
$_POST['post_status'] = 'pending';
|
||||
} else {
|
||||
if ('publish' == $_POST['post_status'] && !current_user_can( 'publish_posts' ) )
|
||||
$_POST['post_status'] = 'pending';
|
||||
}
|
||||
|
||||
if (!isset( $_POST['comment_status'] ))
|
||||
$_POST['comment_status'] = 'closed';
|
||||
|
||||
if (!isset( $_POST['ping_status'] ))
|
||||
$_POST['ping_status'] = 'closed';
|
||||
|
||||
foreach ( array ('aa', 'mm', 'jj', 'hh', 'mn') as $timeunit ) {
|
||||
if ( !empty( $_POST['hidden_' . $timeunit] ) && $_POST['hidden_' . $timeunit] != $_POST[$timeunit] ) {
|
||||
$_POST['edit_date'] = '1';
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!empty ( $_POST['edit_date'] ) ) {
|
||||
$aa = $_POST['aa'];
|
||||
$mm = $_POST['mm'];
|
||||
$jj = $_POST['jj'];
|
||||
$hh = $_POST['hh'];
|
||||
$mn = $_POST['mn'];
|
||||
$ss = $_POST['ss'];
|
||||
$jj = ($jj > 31 ) ? 31 : $jj;
|
||||
$hh = ($hh > 23 ) ? $hh -24 : $hh;
|
||||
$mn = ($mn > 59 ) ? $mn -60 : $mn;
|
||||
$ss = ($ss > 59 ) ? $ss -60 : $ss;
|
||||
$_POST['post_date'] = sprintf( "%04d-%02d-%02d %02d:%02d:%02d", $aa, $mm, $jj, $hh, $mn, $ss );
|
||||
$_POST['post_date_gmt'] = get_gmt_from_date( $_POST['post_date'] );
|
||||
}
|
||||
|
||||
// Create the post.
|
||||
$post_ID = wp_insert_post( $_POST );
|
||||
@@ -349,9 +380,11 @@ function add_meta( $post_ID ) {
|
||||
|
||||
wp_cache_delete($post_ID, 'post_meta');
|
||||
|
||||
$wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->postmeta
|
||||
(post_id,meta_key,meta_value ) VALUES (%s, %s, %s)",
|
||||
$post_ID, $metakey, $metavalue) );
|
||||
$wpdb->query( "
|
||||
INSERT INTO $wpdb->postmeta
|
||||
(post_id,meta_key,meta_value )
|
||||
VALUES ('$post_ID','$metakey','$metavalue' )
|
||||
" );
|
||||
return $wpdb->insert_id;
|
||||
}
|
||||
return false;
|
||||
@@ -361,10 +394,10 @@ function delete_meta( $mid ) {
|
||||
global $wpdb;
|
||||
$mid = (int) $mid;
|
||||
|
||||
$post_id = $wpdb->get_var( $wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_id = %d", $mid) );
|
||||
$post_id = $wpdb->get_var("SELECT post_id FROM $wpdb->postmeta WHERE meta_id = '$mid'");
|
||||
wp_cache_delete($post_id, 'post_meta');
|
||||
|
||||
return $wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->postmeta WHERE meta_id = %d", $mid) );
|
||||
return $wpdb->query( "DELETE FROM $wpdb->postmeta WHERE meta_id = '$mid'" );
|
||||
}
|
||||
|
||||
// Get a list of previously defined keys
|
||||
@@ -384,7 +417,7 @@ function get_post_meta_by_id( $mid ) {
|
||||
global $wpdb;
|
||||
$mid = (int) $mid;
|
||||
|
||||
$meta = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->postmeta WHERE meta_id = %d", $mid) );
|
||||
$meta = $wpdb->get_row( "SELECT * FROM $wpdb->postmeta WHERE meta_id = '$mid'" );
|
||||
if ( is_serialized_string( $meta->meta_value ) )
|
||||
$meta->meta_value = maybe_unserialize( $meta->meta_value );
|
||||
return $meta;
|
||||
@@ -394,30 +427,29 @@ function get_post_meta_by_id( $mid ) {
|
||||
function has_meta( $postid ) {
|
||||
global $wpdb;
|
||||
|
||||
return $wpdb->get_results( $wpdb->prepare("SELECT meta_key, meta_value, meta_id, post_id
|
||||
FROM $wpdb->postmeta WHERE post_id = %d
|
||||
ORDER BY meta_key,meta_id", $postid), ARRAY_A );
|
||||
return $wpdb->get_results( "
|
||||
SELECT meta_key, meta_value, meta_id, post_id
|
||||
FROM $wpdb->postmeta
|
||||
WHERE post_id = '$postid'
|
||||
ORDER BY meta_key,meta_id", ARRAY_A );
|
||||
|
||||
}
|
||||
|
||||
function update_meta( $meta_id, $meta_key, $meta_value ) {
|
||||
function update_meta( $mid, $mkey, $mvalue ) {
|
||||
global $wpdb;
|
||||
|
||||
$protected = array( '_wp_attached_file', '_wp_attachment_metadata', '_wp_old_slug', '_wp_page_template' );
|
||||
|
||||
if ( in_array($meta_key, $protected) )
|
||||
if ( in_array($mkey, $protected) )
|
||||
return false;
|
||||
|
||||
$post_id = $wpdb->get_var( $wpdb->prepare("SELECT post_id FROM $wpdb->postmeta WHERE meta_id = %d", $meta_id) );
|
||||
$post_id = $wpdb->get_var("SELECT post_id FROM $wpdb->postmeta WHERE meta_id = '$mid'");
|
||||
wp_cache_delete($post_id, 'post_meta');
|
||||
|
||||
$meta_value = maybe_serialize( stripslashes( $meta_value ));
|
||||
$meta_id = (int) $meta_id;
|
||||
|
||||
$data = compact( 'meta_key', 'meta_value' );
|
||||
$where = compact( 'meta_id' );
|
||||
|
||||
return $wpdb->update( $wpdb->postmeta, $data, $where );
|
||||
$mvalue = maybe_serialize( stripslashes( $mvalue ));
|
||||
$mvalue = $wpdb->escape( $mvalue );
|
||||
$mid = (int) $mid;
|
||||
return $wpdb->query( "UPDATE $wpdb->postmeta SET meta_key = '$mkey', meta_value = '$mvalue' WHERE meta_id = '$mid'" );
|
||||
}
|
||||
|
||||
//
|
||||
@@ -470,7 +502,7 @@ function _relocate_children( $old_ID, $new_ID ) {
|
||||
global $wpdb;
|
||||
$old_ID = (int) $old_ID;
|
||||
$new_ID = (int) $new_ID;
|
||||
return $wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_parent = %d WHERE post_parent = %d", $new_ID, $old_ID) );
|
||||
return $wpdb->query( "UPDATE $wpdb->posts SET post_parent = $new_ID WHERE post_parent = $old_ID" );
|
||||
}
|
||||
|
||||
function get_available_post_statuses($type = 'post') {
|
||||
@@ -599,7 +631,7 @@ function get_sample_permalink($id, $title=null, $name = null) {
|
||||
$permalink = str_replace('%pagename%', "${uri}%pagename%", $permalink);
|
||||
}
|
||||
|
||||
$permalink = array($permalink, apply_filters('editable_slug', $post->post_name));
|
||||
$permalink = array($permalink, $post->post_name);
|
||||
$post->post_status = $original_status;
|
||||
$post->post_date = $original_date;
|
||||
$post->post_name = $original_name;
|
||||
@@ -659,28 +691,4 @@ function wp_set_post_lock( $post_id ) {
|
||||
update_post_meta( $post->ID, '_edit_last', $current_user->ID );
|
||||
}
|
||||
|
||||
/**
|
||||
* wp_create_post_autosave() - creates autosave data for the specified post from $_POST data
|
||||
*
|
||||
* @package WordPress
|
||||
* @subpackage Post Revisions
|
||||
* @since 2.6
|
||||
*
|
||||
* @uses _wp_translate_postdata()
|
||||
* @uses _wp_post_revision_fields()
|
||||
*/
|
||||
function wp_create_post_autosave( $post_id ) {
|
||||
$translated = _wp_translate_postdata( true );
|
||||
if ( is_wp_error( $translated ) )
|
||||
return $translated;
|
||||
|
||||
// Only store one autosave. If there is already an autosave, overwrite it.
|
||||
if ( $old_autosave = wp_get_post_autosave( $post_id ) ) {
|
||||
$new_autosave = _wp_post_revision_fields( $_POST, true );
|
||||
$new_autosave['ID'] = $old_autosave->ID;
|
||||
return wp_update_post( $new_autosave );
|
||||
}
|
||||
|
||||
// Otherwise create the new autosave as a special post revision
|
||||
return _wp_put_post_revision( $_POST, true );
|
||||
}
|
||||
?>
|
||||
|
||||
@@ -153,11 +153,9 @@ CREATE TABLE $wpdb->usermeta (
|
||||
|
||||
function populate_options() {
|
||||
global $wpdb, $wp_db_version;
|
||||
|
||||
$guessurl = wp_guess_url();
|
||||
|
||||
do_action('populate_options');
|
||||
|
||||
|
||||
$schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
|
||||
$guessurl = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
|
||||
add_option('siteurl', $guessurl);
|
||||
add_option('blogname', __('My Blog'));
|
||||
add_option('blogdescription', __('Just another WordPress weblog'));
|
||||
@@ -225,10 +223,10 @@ function populate_options() {
|
||||
if ( ini_get('safe_mode') ) {
|
||||
// Safe mode screws up mkdir(), so we must use a flat structure.
|
||||
add_option('uploads_use_yearmonth_folders', 0);
|
||||
add_option('upload_path', WP_CONTENT_DIR);
|
||||
add_option('upload_path', 'wp-content');
|
||||
} else {
|
||||
add_option('uploads_use_yearmonth_folders', 1);
|
||||
add_option('upload_path', WP_CONTENT_DIR . '/uploads');
|
||||
add_option('upload_path', 'wp-content/uploads');
|
||||
}
|
||||
|
||||
// 2.0.3
|
||||
@@ -252,13 +250,8 @@ function populate_options() {
|
||||
add_option('medium_size_w', 300);
|
||||
add_option('medium_size_h', 300);
|
||||
|
||||
// 2.6
|
||||
add_option('avatar_default', 'mystery');
|
||||
add_option('enable_app', 0);
|
||||
add_option('enable_xmlrpc', 0);
|
||||
|
||||
// Delete unused options
|
||||
$unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', '_wp_http_referer', 'Update', 'action', 'rich_editing', 'autosave_interval', 'deactivated_plugins');
|
||||
$unusedoptions = array ('blodotgsping_url', 'bodyterminator', 'emailtestonly', 'phoneemail_separator', 'smilies_directory', 'subjectprefix', 'use_bbcode', 'use_blodotgsping', 'use_phoneemail', 'use_quicktags', 'use_weblogsping', 'weblogs_cache_file', 'use_preview', 'use_htmltrans', 'smilies_directory', 'fileupload_allowedusers', 'use_phoneemail', 'default_post_status', 'default_post_category', 'archive_mode', 'time_difference', 'links_minadminlevel', 'links_use_adminlevels', 'links_rating_type', 'links_rating_char', 'links_rating_ignore_zero', 'links_rating_single_image', 'links_rating_image0', 'links_rating_image1', 'links_rating_image2', 'links_rating_image3', 'links_rating_image4', 'links_rating_image5', 'links_rating_image6', 'links_rating_image7', 'links_rating_image8', 'links_rating_image9', 'weblogs_cacheminutes', 'comment_allowed_tags', 'search_engine_friendly_urls', 'default_geourl_lat', 'default_geourl_lon', 'use_default_geourl', 'weblogs_xml_url', 'new_users_can_blog', '_wpnonce', '_wp_http_referer', 'Update', 'action', 'rich_editing', 'autosave_interval');
|
||||
foreach ($unusedoptions as $option) :
|
||||
delete_option($option);
|
||||
endforeach;
|
||||
@@ -275,7 +268,6 @@ function populate_roles() {
|
||||
populate_roles_210();
|
||||
populate_roles_230();
|
||||
populate_roles_250();
|
||||
populate_roles_260();
|
||||
}
|
||||
|
||||
function populate_roles_160() {
|
||||
@@ -431,13 +423,4 @@ function populate_roles_250() {
|
||||
}
|
||||
}
|
||||
|
||||
function populate_roles_260() {
|
||||
$role = get_role( 'administrator' );
|
||||
|
||||
if ( !empty( $role ) ) {
|
||||
$role->add_cap( 'update_plugins' );
|
||||
$role->add_cap( 'delete_plugins' );
|
||||
}
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -47,7 +47,7 @@ function wp_delete_category($cat_ID) {
|
||||
if ( $cat_ID == $default )
|
||||
return 0;
|
||||
|
||||
return wp_delete_term($cat_ID, 'category', array('default' => $default));
|
||||
return wp_delete_term($cat_ID, 'category', "default=$default");
|
||||
}
|
||||
|
||||
function wp_insert_category($catarr, $wp_error = false) {
|
||||
|
||||
@@ -4,73 +4,35 @@
|
||||
// Big Mess
|
||||
//
|
||||
|
||||
// Ugly recursive category stuff.
|
||||
function cat_rows( $parent = 0, $level = 0, $categories = 0, $page = 1, $per_page = 20 ) {
|
||||
$count = 0;
|
||||
_cat_rows($categories, $count, $parent, $level, $page, $per_page);
|
||||
}
|
||||
|
||||
function _cat_rows( $categories, &$count, $parent = 0, $level = 0, $page = 1, $per_page = 20 ) {
|
||||
if ( empty($categories) ) {
|
||||
// Dandy new recursive multiple category stuff.
|
||||
function cat_rows( $parent = 0, $level = 0, $categories = 0 ) {
|
||||
if ( !$categories ) {
|
||||
$args = array('hide_empty' => 0);
|
||||
if ( !empty($_GET['s']) )
|
||||
$args['search'] = $_GET['s'];
|
||||
$categories = get_categories( $args );
|
||||
}
|
||||
|
||||
if ( !$categories )
|
||||
return false;
|
||||
|
||||
$children = _get_term_hierarchy('category');
|
||||
|
||||
$start = ($page - 1) * $per_page;
|
||||
$end = $start + $per_page;
|
||||
$i = -1;
|
||||
ob_start();
|
||||
foreach ( $categories as $category ) {
|
||||
if ( $count >= $end )
|
||||
break;
|
||||
|
||||
$i++;
|
||||
|
||||
if ( $category->parent != $parent )
|
||||
continue;
|
||||
|
||||
// If the page starts in a subtree, print the parents.
|
||||
if ( $count == $start && $category->parent > 0 ) {
|
||||
$my_parents = array();
|
||||
$my_parent = $category->parent;
|
||||
while ( $my_parent) {
|
||||
$my_parent = get_category($my_parent);
|
||||
$my_parents[] = $my_parent;
|
||||
if ( !$my_parent->parent )
|
||||
break;
|
||||
$my_parent = $my_parent->parent;
|
||||
}
|
||||
$num_parents = count($my_parents);
|
||||
while( $my_parent = array_pop($my_parents) ) {
|
||||
echo "\t" . _cat_row( $my_parent, $level - $num_parents );
|
||||
$num_parents--;
|
||||
if ( $categories ) {
|
||||
ob_start();
|
||||
foreach ( $categories as $category ) {
|
||||
if ( $category->parent == $parent) {
|
||||
echo "\t" . _cat_row( $category, $level );
|
||||
if ( isset($children[$category->term_id]) )
|
||||
cat_rows( $category->term_id, $level +1, $categories );
|
||||
}
|
||||
}
|
||||
$output = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
if ( $count >= $start )
|
||||
echo "\t" . _cat_row( $category, $level );
|
||||
|
||||
unset($categories[$i]); // Prune the working set
|
||||
$count++;
|
||||
|
||||
if ( isset($children[$category->term_id]) )
|
||||
_cat_rows( $categories, $count, $category->term_id, $level + 1, $page, $per_page );
|
||||
$output = apply_filters('cat_rows', $output);
|
||||
|
||||
echo $output;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
$output = ob_get_contents();
|
||||
ob_end_clean();
|
||||
|
||||
$output = apply_filters('cat_rows', $output);
|
||||
|
||||
echo $output;
|
||||
}
|
||||
|
||||
function _cat_row( $category, $level, $name_override = false ) {
|
||||
@@ -186,24 +148,19 @@ class Walker_Category_Checklist extends Walker {
|
||||
}
|
||||
}
|
||||
|
||||
function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false, $popular_cats = false ) {
|
||||
function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $selected_cats = false ) {
|
||||
$walker = new Walker_Category_Checklist;
|
||||
$descendants_and_self = (int) $descendants_and_self;
|
||||
|
||||
$args = array();
|
||||
|
||||
if ( is_array( $selected_cats ) )
|
||||
$args['selected_cats'] = $selected_cats;
|
||||
elseif ( $post_id )
|
||||
if ( $post_id )
|
||||
$args['selected_cats'] = wp_get_post_categories($post_id);
|
||||
else
|
||||
$args['selected_cats'] = array();
|
||||
|
||||
if ( is_array( $popular_cats ) )
|
||||
$args['popular_cats'] = $popular_cats;
|
||||
else
|
||||
$args['popular_cats'] = get_terms( 'category', array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) );
|
||||
|
||||
if ( is_array( $selected_cats ) )
|
||||
$args['selected_cats'] = $selected_cats;
|
||||
$args['popular_cats'] = get_terms( 'category', array( 'fields' => 'ids', 'orderby' => 'count', 'order' => 'DESC', 'number' => 10, 'hierarchical' => false ) );
|
||||
if ( $descendants_and_self ) {
|
||||
$categories = get_categories( "child_of=$descendants_and_self&hierarchical=0&hide_empty=0" );
|
||||
$self = get_category( $descendants_and_self );
|
||||
@@ -212,22 +169,13 @@ function wp_category_checklist( $post_id = 0, $descendants_and_self = 0, $select
|
||||
$categories = get_categories('get=all');
|
||||
}
|
||||
|
||||
// Post process $categories rather than adding an exclude to the get_terms() query to keep the query the same across all posts (for any query cache)
|
||||
$checked_categories = array();
|
||||
for ( $i = 0; isset($categories[$i]); $i++ ) {
|
||||
if ( in_array($categories[$i]->term_id, $args['selected_cats']) ) {
|
||||
$checked_categories[] = $categories[$i];
|
||||
unset($categories[$i]);
|
||||
}
|
||||
}
|
||||
$args = array($categories, 0, $args);
|
||||
$output = call_user_func_array(array(&$walker, 'walk'), $args);
|
||||
|
||||
// Put checked cats on top
|
||||
echo call_user_func_array(array(&$walker, 'walk'), array($checked_categories, 0, $args));
|
||||
// Then the rest of them
|
||||
echo call_user_func_array(array(&$walker, 'walk'), array($categories, 0, $args));
|
||||
echo $output;
|
||||
}
|
||||
|
||||
function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $echo = true ) {
|
||||
function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10 ) {
|
||||
global $post_ID;
|
||||
if ( $post_ID )
|
||||
$checked_categories = wp_get_post_categories($post_ID);
|
||||
@@ -238,8 +186,6 @@ function wp_popular_terms_checklist( $taxonomy, $default = 0, $number = 10, $ech
|
||||
$popular_ids = array();
|
||||
foreach ( (array) $categories as $category ) {
|
||||
$popular_ids[] = $category->term_id;
|
||||
if ( !$echo ) // hack for AJAX use
|
||||
continue;
|
||||
$id = "popular-category-$category->term_id";
|
||||
?>
|
||||
|
||||
@@ -340,7 +286,7 @@ function tag_rows( $page = 1, $pagesize = 20, $searchterms = '' ) {
|
||||
// define the columns to display, the syntax is 'internal name' => 'display name'
|
||||
function wp_manage_posts_columns() {
|
||||
$posts_columns = array();
|
||||
$posts_columns['cb'] = '<input type="checkbox" />';
|
||||
$posts_columns['cb'] = '<input type="checkbox" onclick="checkAll(document.getElementById(\'posts-filter\'));" />';
|
||||
if ( 'draft' === $_GET['post_status'] )
|
||||
$posts_columns['modified'] = __('Modified');
|
||||
elseif ( 'pending' === $_GET['post_status'] )
|
||||
@@ -362,7 +308,7 @@ function wp_manage_posts_columns() {
|
||||
// define the columns to display, the syntax is 'internal name' => 'display name'
|
||||
function wp_manage_media_columns() {
|
||||
$posts_columns = array();
|
||||
$posts_columns['cb'] = '<input type="checkbox" />';
|
||||
$posts_columns['cb'] = '<input type="checkbox" onclick="checkAll(document.getElementById(\'posts-filter\'));" />';
|
||||
$posts_columns['icon'] = '';
|
||||
$posts_columns['media'] = _c('Media|media column header');
|
||||
$posts_columns['desc'] = _c('Description|media column header');
|
||||
@@ -377,7 +323,7 @@ function wp_manage_media_columns() {
|
||||
|
||||
function wp_manage_pages_columns() {
|
||||
$posts_columns = array();
|
||||
$posts_columns['cb'] = '<input type="checkbox" />';
|
||||
$posts_columns['cb'] = '<input type="checkbox" onclick="checkAll(document.getElementById(\'posts-filter\'));" />';
|
||||
if ( 'draft' === $_GET['post_status'] )
|
||||
$posts_columns['modified'] = __('Modified');
|
||||
elseif ( 'pending' === $_GET['post_status'] )
|
||||
@@ -398,7 +344,7 @@ function wp_manage_pages_columns() {
|
||||
* display one row if the page doesn't have any children
|
||||
* otherwise, display the row and its children in subsequent rows
|
||||
*/
|
||||
function display_page_row( $page, $level = 0 ) {
|
||||
function display_page_row( $page, &$children_pages, $level = 0 ) {
|
||||
global $post;
|
||||
static $class;
|
||||
|
||||
@@ -522,126 +468,66 @@ foreach ($posts_columns as $column_name=>$column_display_name) {
|
||||
</tr>
|
||||
|
||||
<?php
|
||||
|
||||
if ( ! $children_pages )
|
||||
return true;
|
||||
|
||||
for ( $i = 0; $i < count($children_pages); $i++ ) {
|
||||
|
||||
$child = $children_pages[$i];
|
||||
|
||||
if ( $child->post_parent == $id ) {
|
||||
array_splice($children_pages, $i, 1);
|
||||
display_page_row($child, $children_pages, $level+1);
|
||||
$i = -1; //as numeric keys in $children_pages are not preserved after splice
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* displays pages in hierarchical order with paging support
|
||||
* displays pages in hierarchical order
|
||||
*/
|
||||
function page_rows($pages, $pagenum = 1, $per_page = 20) {
|
||||
$level = 0;
|
||||
function page_rows( $pages ) {
|
||||
if ( ! $pages )
|
||||
$pages = get_pages( 'sort_column=menu_order' );
|
||||
|
||||
if ( ! $pages ) {
|
||||
$pages = get_pages( array('sort_column' => 'menu_order') );
|
||||
if ( ! $pages )
|
||||
return false;
|
||||
|
||||
if ( ! $pages )
|
||||
return false;
|
||||
}
|
||||
// splice pages into two parts: those without parent and those with parent
|
||||
|
||||
/*
|
||||
* arrange pages into two parts: top level pages and children_pages
|
||||
* children_pages is two dimensional array, eg.
|
||||
* children_pages[10][] contains all sub-pages whose parent is 10.
|
||||
* It only takes O(N) to arrange this and it takes O(1) for subsequent lookup operations
|
||||
* If searching, ignore hierarchy and treat everything as top level
|
||||
*/
|
||||
if ( empty($_GET['s']) ) {
|
||||
|
||||
$top_level_pages = array();
|
||||
$children_pages = array();
|
||||
|
||||
foreach ( $pages as $page ) {
|
||||
|
||||
// catch and repair bad pages
|
||||
if ( $page->post_parent == $page->ID ) {
|
||||
$page->post_parent = 0;
|
||||
$wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_parent = '0' WHERE ID = %d", $page->ID) );
|
||||
clean_page_cache( $page->ID );
|
||||
}
|
||||
|
||||
if ( 0 == $page->post_parent )
|
||||
$top_level_pages[] = $page;
|
||||
else
|
||||
$children_pages[ $page->post_parent ][] = $page;
|
||||
}
|
||||
$top_level_pages = array();
|
||||
$children_pages = array();
|
||||
|
||||
$pages = &$top_level_pages;
|
||||
}
|
||||
|
||||
$count = 0;
|
||||
$start = ($pagenum - 1) * $per_page;
|
||||
$end = $start + $per_page;
|
||||
|
||||
foreach ( $pages as $page ) {
|
||||
if ( $count >= $end )
|
||||
break;
|
||||
|
||||
if ( $count >= $start )
|
||||
echo "\t" . display_page_row( $page, $level );
|
||||
|
||||
$count++;
|
||||
|
||||
if ( isset($children_pages) )
|
||||
_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page );
|
||||
}
|
||||
|
||||
// if it is the last pagenum and there are orphaned pages, display them with paging as well
|
||||
if ( isset($children_pages) && $count < $end ){
|
||||
foreach( $children_pages as $orphans ){
|
||||
foreach ( $orphans as $op ) {
|
||||
if ( $count >= $end )
|
||||
break;
|
||||
if ( $count >= $start )
|
||||
echo "\t" . display_page_row( $op, 0 );
|
||||
$count++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Given a top level page ID, display the nested hierarchy of sub-pages
|
||||
* together with paging support
|
||||
*/
|
||||
function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_page ) {
|
||||
|
||||
if ( ! isset( $children_pages[$parent] ) )
|
||||
return;
|
||||
|
||||
$start = ($pagenum - 1) * $per_page;
|
||||
$end = $start + $per_page;
|
||||
|
||||
foreach ( $children_pages[$parent] as $page ) {
|
||||
|
||||
if ( $count >= $end )
|
||||
break;
|
||||
|
||||
// If the page starts in a subtree, print the parents.
|
||||
if ( $count == $start && $page->post_parent > 0 ) {
|
||||
$my_parents = array();
|
||||
$my_parent = $page->post_parent;
|
||||
while ( $my_parent) {
|
||||
$my_parent = get_post($my_parent);
|
||||
$my_parents[] = $my_parent;
|
||||
if ( !$my_parent->post_parent )
|
||||
break;
|
||||
$my_parent = $my_parent->post_parent;
|
||||
}
|
||||
$num_parents = count($my_parents);
|
||||
while( $my_parent = array_pop($my_parents) ) {
|
||||
echo "\t" . display_page_row( $my_parent, $level - $num_parents );
|
||||
$num_parents--;
|
||||
}
|
||||
// catch and repair bad pages
|
||||
if ( $page->post_parent == $page->ID ) {
|
||||
$page->post_parent = 0;
|
||||
$wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_parent = '0' WHERE ID = %d", $page->ID) );
|
||||
clean_page_cache( $page->ID );
|
||||
}
|
||||
|
||||
if ( $count >= $start )
|
||||
echo "\t" . display_page_row( $page, $level );
|
||||
|
||||
$count++;
|
||||
|
||||
_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page );
|
||||
if ( 0 == $page->post_parent )
|
||||
$top_level_pages[] = $page;
|
||||
else
|
||||
$children_pages[] = $page;
|
||||
}
|
||||
|
||||
unset( $children_pages[$parent] ); //required in order to keep track of orphans
|
||||
|
||||
foreach ( $top_level_pages as $page )
|
||||
display_page_row($page, $children_pages, 0);
|
||||
|
||||
/*
|
||||
* display the remaining children_pages which are orphans
|
||||
* having orphan requires parental attention
|
||||
*/
|
||||
if ( count($children_pages) > 0 ) {
|
||||
$empty_array = array();
|
||||
foreach ( $children_pages as $orphan_page ) {
|
||||
clean_page_cache( $orphan_page->ID);
|
||||
display_page_row( $orphan_page, $empty_array, 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function user_row( $user_object, $style = '', $role = '' ) {
|
||||
@@ -789,22 +675,21 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true
|
||||
|
||||
$actions = array();
|
||||
|
||||
if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
|
||||
$actions['approve'] = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=approved' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a> | ';
|
||||
$actions['unapprove'] = "<a href='$unapprove_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3:new=unapproved' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a> | ';
|
||||
$actions['approve'] = "<a href='$approve_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a> | ';
|
||||
$actions['unapprove'] = "<a href='$unapprove_url' class='dim:the-comment-list:comment-$comment->comment_ID:unapproved:e7e7d3:e7e7d3' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a> | ';
|
||||
|
||||
// we're looking at list of only approved or only unapproved comments
|
||||
if ( 'moderated' == $comment_status ) {
|
||||
$actions['approve'] = "<a href='$approve_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&new=approved' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a> | ';
|
||||
$actions['approve'] = "<a href='$approve_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment' title='" . __( 'Approve this comment' ) . "'>" . __( 'Approve' ) . '</a> | ';
|
||||
unset($actions['unapprove']);
|
||||
} elseif ( 'approved' == $comment_status ) {
|
||||
$actions['unapprove'] = "<a href='$unapprove_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment&new=unapproved' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a> | ';
|
||||
$actions['unapprove'] = "<a href='$unapprove_url' class='delete:the-comment-list:comment-$comment->comment_ID:e7e7d3:action=dim-comment' title='" . __( 'Unapprove this comment' ) . "'>" . __( 'Unapprove' ) . '</a> | ';
|
||||
unset($actions['approve']);
|
||||
}
|
||||
|
||||
if ( current_user_can('edit_post', $comment->comment_post_ID) ) {
|
||||
$actions['spam'] = "<a href='$spam_url' class='delete:the-comment-list:comment-$comment->comment_ID::spam=1' title='" . __( 'Mark this comment as spam' ) . "'>" . __( 'Spam' ) . '</a> | ';
|
||||
$actions['delete'] = "<a href='$delete_url' class='delete:the-comment-list:comment-$comment->comment_ID delete'>" . __('Delete') . '</a>';
|
||||
$actions = apply_filters( 'comment_row_actions', $actions, $comment );
|
||||
foreach ( $actions as $action => $link )
|
||||
echo "<span class='$action'>$link</span>";
|
||||
}
|
||||
@@ -816,7 +701,7 @@ function _wp_comment_row( $comment_id, $mode, $comment_status, $checkbox = true
|
||||
|
||||
function wp_dropdown_cats( $currentcat = 0, $currentparent = 0, $parent = 0, $level = 0, $categories = 0 ) {
|
||||
if (!$categories )
|
||||
$categories = get_categories( array('hide_empty' => 0) );
|
||||
$categories = get_categories( 'hide_empty=0' );
|
||||
|
||||
if ( $categories ) {
|
||||
foreach ( $categories as $category ) {
|
||||
@@ -889,8 +774,8 @@ function _list_meta_row( $entry, &$count ) {
|
||||
$delete_nonce = wp_create_nonce( 'delete-meta_' . $entry['meta_id'] );
|
||||
|
||||
$r .= "\n\t<tr id='meta-{$entry['meta_id']}' class='$style'>";
|
||||
$r .= "\n\t\t<td valign='top'><label class='hidden' for='meta[{$entry['meta_id']}][key]'>" . __( 'Key' ) . "</label><input name='meta[{$entry['meta_id']}][key]' id='meta[{$entry['meta_id']}][key]' tabindex='6' type='text' size='20' value='{$entry['meta_key']}' /></td>";
|
||||
$r .= "\n\t\t<td><label class='hidden' for='meta[{$entry['meta_id']}][value]'>" . __( 'Value' ) . "</label><textarea name='meta[{$entry['meta_id']}][value]' id='meta[{$entry['meta_id']}][value]' tabindex='6' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>";
|
||||
$r .= "\n\t\t<td valign='top'><input name='meta[{$entry['meta_id']}][key]' tabindex='6' type='text' size='20' value='{$entry['meta_key']}' /></td>";
|
||||
$r .= "\n\t\t<td><textarea name='meta[{$entry['meta_id']}][value]' tabindex='6' rows='2' cols='30'>{$entry['meta_value']}</textarea></td>";
|
||||
$r .= "\n\t\t<td style='text-align: center;'><input name='updatemeta' type='submit' tabindex='6' value='".attribute_escape(__( 'Update' ))."' class='add:the-list:meta-{$entry['meta_id']}::_ajax_nonce=$update_nonce updatemeta' /><br />";
|
||||
$r .= "\n\t\t<input name='deletemeta[{$entry['meta_id']}]' type='submit' ";
|
||||
$r .= "class='delete:the-list:meta-{$entry['meta_id']}::_ajax_nonce=$delete_nonce deletemeta' tabindex='6' value='".attribute_escape(__( 'Delete' ))."' />";
|
||||
@@ -915,8 +800,8 @@ function meta_form() {
|
||||
<p><strong><?php _e( 'Add a new custom field:' ) ?></strong></p>
|
||||
<table id="newmeta" cellspacing="3" cellpadding="3">
|
||||
<tr>
|
||||
<th colspan="2"><label <?php if ( $keys ) : ?> for="metakeyselect" <?php else : ?> for="metakeyinput" <?php endif; ?>><?php _e( 'Key' ) ?></label></th>
|
||||
<th><label for="metavalue"><?php _e( 'Value' ) ?></label></th>
|
||||
<th colspan="2"><?php _e( 'Key' ) ?></th>
|
||||
<th><?php _e( 'Value' ) ?></th>
|
||||
</tr>
|
||||
<tr valign="top">
|
||||
<td style="width: 18%;" class="textright">
|
||||
@@ -930,7 +815,7 @@ function meta_form() {
|
||||
echo "\n\t<option value='$key'>$key</option>";
|
||||
}
|
||||
?>
|
||||
</select> <label for="metakeyinput"><?php _e( 'or' ); ?></label>
|
||||
</select> <?php _e( 'or' ); ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td><input type="text" id="metakeyinput" name="metakeyinput" tabindex="7" /></td>
|
||||
@@ -938,7 +823,7 @@ function meta_form() {
|
||||
</tr>
|
||||
<tr class="submit"><td colspan="3">
|
||||
<?php wp_nonce_field( 'add-meta', '_ajax_nonce', false ); ?>
|
||||
<input type="submit" id="addmetasub" name="addmeta" class="add:the-list:newmeta" tabindex="9" value="<?php _e( 'Add Custom Field' ) ?>" />
|
||||
<input type="submit" id="addmetasub" name="addmeta" class="add:the-list:newmeta::post_id=<?php echo $GLOBALS['post_ID'] ? $GLOBALS['post_ID'] : $GLOBALS['temp_ID']; ?>" tabindex="9" value="<?php _e( 'Add Custom Field' ) ?>" />
|
||||
</td></tr>
|
||||
</table>
|
||||
<?php
|
||||
@@ -1003,7 +888,7 @@ function page_template_dropdown( $default = '' ) {
|
||||
|
||||
function parent_dropdown( $default = 0, $parent = 0, $level = 0 ) {
|
||||
global $wpdb, $post_ID;
|
||||
$items = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = %d AND post_type = 'page' ORDER BY menu_order", $parent) );
|
||||
$items = $wpdb->get_results( "SELECT ID, post_parent, post_title FROM $wpdb->posts WHERE post_parent = $parent AND post_type = 'page' ORDER BY menu_order" );
|
||||
|
||||
if ( $items ) {
|
||||
foreach ( $items as $item ) {
|
||||
@@ -1156,12 +1041,10 @@ function wp_remember_old_slug() {
|
||||
* @param string $callback Function that fills the box with the desired content. The function should echo its output.
|
||||
* @param string $page The type of edit page on which to show the box (post, page, link)
|
||||
* @param string $context The context within the page where the boxes should show ('normal', 'advanced')
|
||||
* @param string $priority The priority within the context where the boxes should show ('high', 'low')
|
||||
*/
|
||||
function add_meta_box($id, $title, $callback, $page, $context = 'advanced', $priority = 'default') {
|
||||
function add_meta_box($id, $title, $callback, $page, $context = 'advanced') {
|
||||
global $wp_meta_boxes;
|
||||
|
||||
|
||||
if ( !isset($wp_meta_boxes) )
|
||||
$wp_meta_boxes = array();
|
||||
if ( !isset($wp_meta_boxes[$page]) )
|
||||
@@ -1169,81 +1052,23 @@ function add_meta_box($id, $title, $callback, $page, $context = 'advanced', $pri
|
||||
if ( !isset($wp_meta_boxes[$page][$context]) )
|
||||
$wp_meta_boxes[$page][$context] = array();
|
||||
|
||||
foreach ( array('high', 'core', 'default', 'low') as $a_priority ) {
|
||||
if ( !isset($wp_meta_boxes[$page][$context][$a_priority][$id]) )
|
||||
continue;
|
||||
// If a core box was previously added or removed by a plugin, don't add.
|
||||
if ( 'core' == $priority ) {
|
||||
// If core box previously deleted, don't add
|
||||
if ( false === $wp_meta_boxes[$page][$context][$a_priority][$id] )
|
||||
return;
|
||||
// If box was added with default priority, give it core priority to maintain sort order
|
||||
if ( 'default' == $a_priority ) {
|
||||
$wp_meta_boxes[$page][$context]['core'][$id] = $wp_meta_boxes[$page][$context]['default'][$id];
|
||||
unset($wp_meta_boxes[$page][$context]['default'][$id]);
|
||||
}
|
||||
return;
|
||||
}
|
||||
// If no priority given and id already present, use existing priority
|
||||
if ( empty($priority) )
|
||||
$priority = $a_priority;
|
||||
// An id can be in only one priority
|
||||
if ( $priority != $a_priority )
|
||||
unset($wp_meta_boxes[$page][$context][$a_priority][$id]);
|
||||
}
|
||||
|
||||
if ( empty($priority) )
|
||||
$priority = low;
|
||||
|
||||
if ( !isset($wp_meta_boxes[$page][$context][$priority]) )
|
||||
$wp_meta_boxes[$page][$context][$priority] = array();
|
||||
|
||||
$wp_meta_boxes[$page][$context][$priority][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback);
|
||||
$wp_meta_boxes[$page][$context][$id] = array('id' => $id, 'title' => $title, 'callback' => $callback);
|
||||
}
|
||||
|
||||
function do_meta_boxes($page, $context, $object) {
|
||||
global $wp_meta_boxes;
|
||||
|
||||
do_action('do_meta_boxes', $page, $context, $object);
|
||||
|
||||
if ( !isset($wp_meta_boxes) || !isset($wp_meta_boxes[$page]) || !isset($wp_meta_boxes[$page][$context]) )
|
||||
return;
|
||||
|
||||
foreach ( array('high', 'core', 'default', 'low') as $priority ) {
|
||||
foreach ( (array) $wp_meta_boxes[$page][$context][$priority] as $box ) {
|
||||
if ( false === $box )
|
||||
continue;
|
||||
echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . '">' . "\n";
|
||||
echo "<h3>{$box['title']}</h3>\n";
|
||||
echo '<div class="inside">' . "\n";
|
||||
call_user_func($box['callback'], $object, $box);
|
||||
echo "</div>\n";
|
||||
echo "</div>\n";
|
||||
}
|
||||
foreach ( (array) $wp_meta_boxes[$page][$context] as $box ) {
|
||||
echo '<div id="' . $box['id'] . '" class="postbox ' . postbox_classes($box['id'], $page) . '">' . "\n";
|
||||
echo "<h3>{$box['title']}</h3>\n";
|
||||
echo '<div class="inside">' . "\n";
|
||||
call_user_func($box['callback'], $object, $box);
|
||||
echo "</div>\n";
|
||||
echo "</div>\n";
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* remove_meta_box() - Remove a meta box from an edit form
|
||||
*
|
||||
* @since 2.6
|
||||
*
|
||||
* @param string $id String for use in the 'id' attribute of tags.
|
||||
* @param string $page The type of edit page on which to show the box (post, page, link)
|
||||
* @param string $context The context within the page where the boxes should show ('normal', 'advanced')
|
||||
*/
|
||||
function remove_meta_box($id, $page, $context) {
|
||||
global $wp_meta_boxes;
|
||||
|
||||
if ( !isset($wp_meta_boxes) )
|
||||
$wp_meta_boxes = array();
|
||||
if ( !isset($wp_meta_boxes[$page]) )
|
||||
$wp_meta_boxes[$page] = array();
|
||||
if ( !isset($wp_meta_boxes[$page][$context]) )
|
||||
$wp_meta_boxes[$page][$context] = array();
|
||||
|
||||
foreach ( array('high', 'core', 'default', 'low') as $priority )
|
||||
$wp_meta_boxes[$page][$context][$priority][$id] = false;
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -33,7 +33,7 @@ function get_page_templates() {
|
||||
|
||||
if ( is_array( $templates ) ) {
|
||||
foreach ( $templates as $template ) {
|
||||
$template_data = implode( '', file( WP_CONTENT_DIR.$template ));
|
||||
$template_data = implode( '', file( ABSPATH.$template ));
|
||||
|
||||
preg_match( '|Template Name:(.*)$|mi', $template_data, $name );
|
||||
preg_match( '|Description:(.*)$|mi', $template_data, $description );
|
||||
|
||||
@@ -53,24 +53,90 @@ function update_right_now_message() {
|
||||
echo "<span id='wp-version-message'>$msg</span>";
|
||||
}
|
||||
|
||||
function wp_plugin_update_row( $file, $plugin_data ) {
|
||||
function wp_update_plugins() {
|
||||
global $wp_version;
|
||||
|
||||
if ( !function_exists('fsockopen') )
|
||||
return false;
|
||||
|
||||
$plugins = get_plugins();
|
||||
$active = get_option( 'active_plugins' );
|
||||
$current = get_option( 'update_plugins' );
|
||||
|
||||
$new_option = '';
|
||||
$new_option->last_checked = time();
|
||||
|
||||
$plugin_changed = false;
|
||||
foreach ( $plugins as $file => $p ) {
|
||||
$new_option->checked[ $file ] = $p['Version'];
|
||||
|
||||
if ( !isset( $current->checked[ $file ] ) ) {
|
||||
$plugin_changed = true;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ( strval($current->checked[ $file ]) !== strval($p['Version']) )
|
||||
$plugin_changed = true;
|
||||
}
|
||||
|
||||
if (
|
||||
isset( $current->last_checked ) &&
|
||||
43200 > ( time() - $current->last_checked ) &&
|
||||
!$plugin_changed
|
||||
)
|
||||
return false;
|
||||
|
||||
$to_send->plugins = $plugins;
|
||||
$to_send->active = $active;
|
||||
$send = serialize( $to_send );
|
||||
|
||||
$request = 'plugins=' . urlencode( $send );
|
||||
$http_request = "POST /plugins/update-check/1.0/ HTTP/1.0\r\n";
|
||||
$http_request .= "Host: api.wordpress.org\r\n";
|
||||
$http_request .= "Content-Type: application/x-www-form-urlencoded; charset=" . get_option('blog_charset') . "\r\n";
|
||||
$http_request .= "Content-Length: " . strlen($request) . "\r\n";
|
||||
$http_request .= 'User-Agent: WordPress/' . $wp_version . '; ' . get_bloginfo('url') . "\r\n";
|
||||
$http_request .= "\r\n";
|
||||
$http_request .= $request;
|
||||
|
||||
$response = '';
|
||||
if( false != ( $fs = @fsockopen( 'api.wordpress.org', 80, $errno, $errstr, 3) ) && is_resource($fs) ) {
|
||||
fwrite($fs, $http_request);
|
||||
|
||||
while ( !feof($fs) )
|
||||
$response .= fgets($fs, 1160); // One TCP-IP packet
|
||||
fclose($fs);
|
||||
$response = explode("\r\n\r\n", $response, 2);
|
||||
}
|
||||
|
||||
$response = unserialize( $response[1] );
|
||||
|
||||
if ( $response )
|
||||
$new_option->response = $response;
|
||||
|
||||
update_option( 'update_plugins', $new_option );
|
||||
}
|
||||
add_action( 'load-plugins.php', 'wp_update_plugins' );
|
||||
|
||||
function wp_plugin_update_row( $file ) {
|
||||
global $plugin_data;
|
||||
$current = get_option( 'update_plugins' );
|
||||
if ( !isset( $current->response[ $file ] ) )
|
||||
return false;
|
||||
|
||||
$r = $current->response[ $file ];
|
||||
|
||||
echo '<tr><td colspan="5" class="plugin-update">';
|
||||
if ( ! current_user_can('update_plugins') )
|
||||
echo "<tr><td colspan='5' class='plugin-update'>";
|
||||
if ( !current_user_can('edit_plugins') )
|
||||
printf( __('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a>.'), $plugin_data['Name'], $r->url, $r->new_version);
|
||||
else if ( empty($r->package) )
|
||||
printf( __('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a> <em>automatic upgrade unavailable for this plugin</em>.'), $plugin_data['Name'], $r->url, $r->new_version);
|
||||
else
|
||||
printf( __('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a> or <a href="%4$s">upgrade automatically</a>.'), $plugin_data['Name'], $r->url, $r->new_version, wp_nonce_url('update.php?action=upgrade-plugin&plugin=' . $file, 'upgrade-plugin_' . $file) );
|
||||
printf( __('There is a new version of %1$s available. <a href="%2$s">Download version %3$s here</a> or <a href="%4$s">upgrade automatically</a>.'), $plugin_data['Name'], $r->url, $r->new_version, wp_nonce_url("update.php?action=upgrade-plugin&plugin=$file", 'upgrade-plugin_' . $file) );
|
||||
|
||||
echo '</td></tr>';
|
||||
echo "</td></tr>";
|
||||
}
|
||||
add_action( 'after_plugin_row', 'wp_plugin_update_row', 10, 2 );
|
||||
add_action( 'after_plugin_row', 'wp_plugin_update_row' );
|
||||
|
||||
function wp_update_plugin($plugin, $feedback = '') {
|
||||
global $wp_filesystem;
|
||||
@@ -84,7 +150,7 @@ function wp_update_plugin($plugin, $feedback = '') {
|
||||
return new WP_Error('up_to_date', __('The plugin is at the latest version.'));
|
||||
|
||||
// Is a filesystem accessor setup?
|
||||
if ( ! $wp_filesystem || ! is_object($wp_filesystem) )
|
||||
if ( ! $wp_filesystem || !is_object($wp_filesystem) )
|
||||
WP_Filesystem();
|
||||
|
||||
if ( ! is_object($wp_filesystem) )
|
||||
@@ -93,18 +159,11 @@ function wp_update_plugin($plugin, $feedback = '') {
|
||||
if ( $wp_filesystem->errors->get_error_code() )
|
||||
return new WP_Error('fs_error', __('Filesystem error'), $wp_filesystem->errors);
|
||||
|
||||
//Get the base plugin folder
|
||||
$plugins_dir = $wp_filesystem->wp_plugins_dir();
|
||||
if ( empty($plugins_dir) )
|
||||
return new WP_Error('fs_no_plugins_dir', __('Unable to locate WordPress Plugin directory.'));
|
||||
|
||||
//And the same for the Content directory.
|
||||
$content_dir = $wp_filesystem->wp_content_dir();
|
||||
if( empty($content_dir) )
|
||||
return new WP_Error('fs_no_content_dir', __('Unable to locate WordPress Content directory (wp-content).'));
|
||||
//Get the Base folder
|
||||
$base = $wp_filesystem->get_base_dir();
|
||||
|
||||
$plugins_dir = trailingslashit( $plugins_dir );
|
||||
$content_dir = trailingslashit( $content_dir );
|
||||
if ( empty($base) )
|
||||
return new WP_Error('fs_nowordpress', __('Unable to locate WordPress directory.'));
|
||||
|
||||
// Get the URL to the zip file
|
||||
$r = $current->response[ $plugin ];
|
||||
@@ -115,12 +174,12 @@ function wp_update_plugin($plugin, $feedback = '') {
|
||||
// Download the package
|
||||
$package = $r->package;
|
||||
apply_filters('update_feedback', sprintf(__('Downloading update from %s'), $package));
|
||||
$download_file = download_url($package);
|
||||
$file = download_url($package);
|
||||
|
||||
if ( is_wp_error($download_file) )
|
||||
return new WP_Error('download_failed', __('Download failed.'), $download_file->get_error_message());
|
||||
if ( is_wp_error($file) )
|
||||
return new WP_Error('download_failed', __('Download failed.'), $file->get_error_message());
|
||||
|
||||
$working_dir = $content_dir . 'upgrade/' . basename($plugin, '.php');
|
||||
$working_dir = $base . 'wp-content/upgrade/' . basename($plugin, '.php');
|
||||
|
||||
// Clean up working directory
|
||||
if ( $wp_filesystem->is_dir($working_dir) )
|
||||
@@ -128,16 +187,16 @@ function wp_update_plugin($plugin, $feedback = '') {
|
||||
|
||||
apply_filters('update_feedback', __('Unpacking the update'));
|
||||
// Unzip package to working directory
|
||||
$result = unzip_file($download_file, $working_dir);
|
||||
|
||||
// Once extracted, delete the package
|
||||
unlink($download_file);
|
||||
|
||||
$result = unzip_file($file, $working_dir);
|
||||
if ( is_wp_error($result) ) {
|
||||
unlink($file);
|
||||
$wp_filesystem->delete($working_dir, true);
|
||||
return $result;
|
||||
}
|
||||
|
||||
// Once extracted, delete the package
|
||||
unlink($file);
|
||||
|
||||
if ( is_plugin_active($plugin) ) {
|
||||
//Deactivate the plugin silently, Prevent deactivation hooks from running.
|
||||
apply_filters('update_feedback', __('Deactivating the plugin'));
|
||||
@@ -146,25 +205,25 @@ function wp_update_plugin($plugin, $feedback = '') {
|
||||
|
||||
// Remove the existing plugin.
|
||||
apply_filters('update_feedback', __('Removing the old version of the plugin'));
|
||||
$this_plugin_dir = trailingslashit( dirname($plugins_dir . $plugin) );
|
||||
$plugin_dir = dirname($base . PLUGINDIR . "/$plugin");
|
||||
$plugin_dir = trailingslashit($plugin_dir);
|
||||
|
||||
// If plugin is in its own directory, recursively delete the directory.
|
||||
if ( strpos($plugin, '/') && $this_plugin_dir != $plugins_dir ) //base check on if plugin includes directory seperator AND that its not the root plugin folder
|
||||
$deleted = $wp_filesystem->delete($this_plugin_dir, true);
|
||||
if ( strpos($plugin, '/') && $plugin_dir != $base . PLUGINDIR . '/' ) //base check on if plugin includes directory seperator AND that its not the root plugin folder
|
||||
$deleted = $wp_filesystem->delete($plugin_dir, true);
|
||||
else
|
||||
$deleted = $wp_filesystem->delete($plugins_dir . $plugin);
|
||||
$deleted = $wp_filesystem->delete($base . PLUGINDIR . "/$plugin");
|
||||
|
||||
if ( ! $deleted ) {
|
||||
if ( !$deleted ) {
|
||||
$wp_filesystem->delete($working_dir, true);
|
||||
return new WP_Error('delete_failed', __('Could not remove the old plugin'));
|
||||
}
|
||||
|
||||
apply_filters('update_feedback', __('Installing the latest version'));
|
||||
// Copy new version of plugin into place.
|
||||
$result = copy_dir($working_dir, $plugins_dir);
|
||||
if ( is_wp_error($result) ) {
|
||||
if ( !copy_dir($working_dir, $base . PLUGINDIR) ) {
|
||||
//$wp_filesystem->delete($working_dir, true); //TODO: Uncomment? This DOES mean that the new files are available in the upgrade folder if it fails.
|
||||
return $result;
|
||||
return new WP_Error('install_failed', __('Installation failed'));
|
||||
}
|
||||
|
||||
//Get a list of the directories in the working directory before we delete it, We need to know the new folder for the plugin
|
||||
@@ -177,13 +236,13 @@ function wp_update_plugin($plugin, $feedback = '') {
|
||||
delete_option('update_plugins');
|
||||
|
||||
if( empty($filelist) )
|
||||
return false; //We couldnt find any files in the working dir, therefor no plugin installed? Failsafe backup.
|
||||
return false; //We couldnt find any files in the working dir
|
||||
|
||||
$folder = $filelist[0];
|
||||
$plugin = get_plugins('/' . $folder); //Ensure to pass with leading slash
|
||||
$plugin = get_plugins('/' . $folder); //Pass it with a leading slash, search out the plugins in the folder,
|
||||
$pluginfiles = array_keys($plugin); //Assume the requested plugin is the first in the list
|
||||
|
||||
return $folder . '/' . $pluginfiles[0];
|
||||
return $folder . '/' . $pluginfiles[0]; //Pass it without a leading slash as WP requires
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<?php
|
||||
|
||||
if ( file_exists(WP_CONTENT_DIR . '/install.php') )
|
||||
require (WP_CONTENT_DIR . '/install.php');
|
||||
if ( file_exists(ABSPATH . 'wp-content/install.php') )
|
||||
require (ABSPATH . 'wp-content/install.php');
|
||||
require_once(ABSPATH . 'wp-admin/includes/admin.php');
|
||||
require_once(ABSPATH . 'wp-admin/includes/schema.php');
|
||||
|
||||
@@ -18,8 +18,12 @@ function wp_install($blog_title, $user_name, $user_email, $public, $deprecated='
|
||||
update_option('blogname', $blog_title);
|
||||
update_option('admin_email', $user_email);
|
||||
update_option('blog_public', $public);
|
||||
$schema = ( isset($_SERVER['HTTPS']) && strtolower($_SERVER['HTTPS']) == 'on' ) ? 'https://' : 'http://';
|
||||
|
||||
$guessurl = wp_guess_url();
|
||||
if ( defined('WP_SITEURL') && '' != WP_SITEURL )
|
||||
$guessurl = WP_SITEURL;
|
||||
else
|
||||
$guessurl = preg_replace('|/wp-admin/.*|i', '', $schema . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI']);
|
||||
|
||||
update_option('siteurl', $guessurl);
|
||||
|
||||
@@ -201,12 +205,6 @@ function upgrade_all() {
|
||||
if ( $wp_current_db_version < 7796 )
|
||||
upgrade_251();
|
||||
|
||||
if ( $wp_current_db_version < 7935 )
|
||||
upgrade_252();
|
||||
|
||||
if ( $wp_current_db_version < 8201 )
|
||||
upgrade_260();
|
||||
|
||||
maybe_disable_automattic_widgets();
|
||||
|
||||
$wp_rewrite->flush_rules();
|
||||
@@ -223,7 +221,7 @@ function upgrade_100() {
|
||||
foreach($posts as $post) {
|
||||
if ('' == $post->post_name) {
|
||||
$newtitle = sanitize_title($post->post_title);
|
||||
$wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_name = %s WHERE ID = %d", $newtitle, $post->ID) );
|
||||
$wpdb->query("UPDATE $wpdb->posts SET post_name = '$newtitle' WHERE ID = '$post->ID'");
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -232,7 +230,7 @@ function upgrade_100() {
|
||||
foreach ($categories as $category) {
|
||||
if ('' == $category->category_nicename) {
|
||||
$newtitle = sanitize_title($category->cat_name);
|
||||
$wpdb->query( $wpdb->prepare("UPDATE $wpdb->categories SET category_nicename = %s WHERE cat_ID = %d", $newtitle, $category->cat_ID) );
|
||||
$wpdb->query("UPDATE $wpdb->categories SET category_nicename = '$newtitle' WHERE cat_ID = '$category->cat_ID'");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,12 +253,14 @@ function upgrade_100() {
|
||||
if ($allposts) :
|
||||
foreach ($allposts as $post) {
|
||||
// Check to see if it's already been imported
|
||||
$cat = $wpdb->get_row( $wpdb->prepare("SELECT * FROM $wpdb->post2cat WHERE post_id = %d AND category_id = %d", $post->ID, $post->post_category) );
|
||||
$cat = $wpdb->get_row("SELECT * FROM $wpdb->post2cat WHERE post_id = $post->ID AND category_id = $post->post_category");
|
||||
if (!$cat && 0 != $post->post_category) { // If there's no result
|
||||
$wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->post2cat
|
||||
$wpdb->query("
|
||||
INSERT INTO $wpdb->post2cat
|
||||
(post_id, category_id)
|
||||
VALUES (%s, %s)
|
||||
", $post->ID, $post->post_category) );
|
||||
VALUES
|
||||
('$post->ID', '$post->post_category')
|
||||
");
|
||||
}
|
||||
}
|
||||
endif;
|
||||
@@ -288,7 +288,7 @@ function upgrade_110() {
|
||||
foreach ($users as $user) {
|
||||
if ('' == $user->user_nicename) {
|
||||
$newname = sanitize_title($user->user_nickname);
|
||||
$wpdb->query( $wpdb->prepare("UPDATE $wpdb->users SET user_nicename = %s WHERE ID = %d", $newname, $user->ID) );
|
||||
$wpdb->query("UPDATE $wpdb->users SET user_nicename = '$newname' WHERE ID = '$user->ID'");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -404,7 +404,7 @@ function upgrade_130() {
|
||||
foreach ( $options as $option ) {
|
||||
if ( 1 != $option->dupes ) { // Could this be done in the query?
|
||||
$limit = $option->dupes - 1;
|
||||
$dupe_ids = $wpdb->get_col( $wpdb->prepare("SELECT option_id FROM $wpdb->options WHERE option_name = %s LIMIT %d", $option->option_name, $limit) );
|
||||
$dupe_ids = $wpdb->get_col("SELECT option_id FROM $wpdb->options WHERE option_name = '$option->option_name' LIMIT $limit");
|
||||
$dupe_ids = join($dupe_ids, ',');
|
||||
$wpdb->query("DELETE FROM $wpdb->options WHERE option_id IN ($dupe_ids)");
|
||||
}
|
||||
@@ -448,7 +448,8 @@ function upgrade_160() {
|
||||
if ($idmode == 'namefl') $id = $user->user_firstname.' '.$user->user_lastname;
|
||||
if ($idmode == 'namelf') $id = $user->user_lastname.' '.$user->user_firstname;
|
||||
if (!$idmode) $id = $user->user_nickname;
|
||||
$wpdb->query( $wpdb->prepare("UPDATE $wpdb->users SET display_name = %s WHERE ID = %d", $id, $user->ID) );
|
||||
$id = $wpdb->escape( $id );
|
||||
$wpdb->query("UPDATE $wpdb->users SET display_name = '$id' WHERE ID = '$user->ID'");
|
||||
endif;
|
||||
|
||||
// FIXME: RESET_CAPS is temporary code to reset roles and caps if flag is set.
|
||||
@@ -470,7 +471,7 @@ function upgrade_160() {
|
||||
$comments = $wpdb->get_results( "SELECT comment_post_ID, COUNT(*) as c FROM $wpdb->comments WHERE comment_approved = '1' GROUP BY comment_post_ID" );
|
||||
if( is_array( $comments ) ) {
|
||||
foreach ($comments as $comment) {
|
||||
$wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET comment_count = %d WHERE ID = %d", $comment->c, $comment->comment_post_ID) );
|
||||
$wpdb->query( "UPDATE $wpdb->posts SET comment_count = $comment->c WHERE ID = '$comment->comment_post_ID'" );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -479,10 +480,10 @@ function upgrade_160() {
|
||||
if ( $wp_current_db_version > 2541 && $wp_current_db_version <= 3091 ) {
|
||||
$objects = $wpdb->get_results("SELECT ID, post_type FROM $wpdb->posts WHERE post_status = 'object'");
|
||||
foreach ($objects as $object) {
|
||||
$wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_status = 'attachment',
|
||||
post_mime_type = %s,
|
||||
$wpdb->query("UPDATE $wpdb->posts SET post_status = 'attachment',
|
||||
post_mime_type = '$object->post_type',
|
||||
post_type = ''
|
||||
WHERE ID = %d", $object->post_type, $object->ID) );
|
||||
WHERE ID = $object->ID");
|
||||
|
||||
$meta = get_post_meta($object->ID, 'imagedata', true);
|
||||
if ( ! empty($meta['file']) )
|
||||
@@ -510,7 +511,7 @@ function upgrade_210() {
|
||||
$type = 'attachment';
|
||||
}
|
||||
|
||||
$wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_status = %s, post_type = %s WHERE ID = %d", $status, $type, $post->ID) );
|
||||
$wpdb->query("UPDATE $wpdb->posts SET post_status = '$status', post_type = '$type' WHERE ID = '$post->ID'");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -543,42 +544,45 @@ function upgrade_230() {
|
||||
$categories = $wpdb->get_results("SELECT * FROM $wpdb->categories ORDER BY cat_ID");
|
||||
foreach ($categories as $category) {
|
||||
$term_id = (int) $category->cat_ID;
|
||||
$name = $wpdb->escape($category->cat_name);
|
||||
$description = $wpdb->escape($category->category_description);
|
||||
$slug = $wpdb->escape($category->category_nicename);
|
||||
$parent = $wpdb->escape($category->category_parent);
|
||||
$term_group = 0;
|
||||
|
||||
// Associate terms with the same slug in a term group and make slugs unique.
|
||||
if ( $exists = $wpdb->get_results( $wpdb->prepare("SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $slug) ) ) {
|
||||
if ( $exists = $wpdb->get_results("SELECT term_id, term_group FROM $wpdb->terms WHERE slug = '$slug'") ) {
|
||||
$term_group = $exists[0]->term_group;
|
||||
$id = $exists[0]->term_id;
|
||||
$num = 2;
|
||||
do {
|
||||
$alt_slug = $slug . "-$num";
|
||||
$num++;
|
||||
$slug_check = $wpdb->get_var( $wpdb->prepare("SELECT slug FROM $wpdb->terms WHERE slug = %s", $alt_slug) );
|
||||
$slug_check = $wpdb->get_var("SELECT slug FROM $wpdb->terms WHERE slug = '$alt_slug'");
|
||||
} while ( $slug_check );
|
||||
|
||||
$slug = $alt_slug;
|
||||
|
||||
if ( empty( $term_group ) ) {
|
||||
$term_group = $wpdb->get_var("SELECT MAX(term_group) FROM $wpdb->terms GROUP BY term_group") + 1;
|
||||
$wpdb->query( $wpdb->prepare("UPDATE $wpdb->terms SET term_group = %d WHERE term_id = %d", $term_group, $id) );
|
||||
$wpdb->query("UPDATE $wpdb->terms SET term_group = '$term_group' WHERE term_id = '$id'");
|
||||
}
|
||||
}
|
||||
|
||||
$wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->terms (term_id, name, slug, term_group) VALUES
|
||||
(%d, %s, %s, %d)", $term_id, $name, $slug, $term_group) );
|
||||
$wpdb->query("INSERT INTO $wpdb->terms (term_id, name, slug, term_group) VALUES ('$term_id', '$name', '$slug', '$term_group')");
|
||||
|
||||
$count = 0;
|
||||
if ( !empty($category->category_count) ) {
|
||||
$count = (int) $category->category_count;
|
||||
$taxonomy = 'category';
|
||||
$wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ( %d, %s, %s, %d, %d)", $term_id, $taxonomy, $description, $parent, $count) );
|
||||
$wpdb->query("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ('$term_id', '$taxonomy', '$description', '$parent', '$count')");
|
||||
$tt_ids[$term_id][$taxonomy] = (int) $wpdb->insert_id;
|
||||
}
|
||||
|
||||
if ( !empty($category->link_count) ) {
|
||||
$count = (int) $category->link_count;
|
||||
$taxonomy = 'link_category';
|
||||
$wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ( %d, %s, %s, %d, %d)", $term_id, $taxonomy, $description, $parent, $count) );
|
||||
$wpdb->query("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ('$term_id', '$taxonomy', '$description', '$parent', '$count')");
|
||||
$tt_ids[$term_id][$taxonomy] = (int) $wpdb->insert_id;
|
||||
}
|
||||
|
||||
@@ -586,14 +590,14 @@ function upgrade_230() {
|
||||
$have_tags = true;
|
||||
$count = (int) $category->tag_count;
|
||||
$taxonomy = 'post_tag';
|
||||
$wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ( %d, %s, %s, %d, %d)", $term_id, $taxonomy, $description, $parent, $count) );
|
||||
$wpdb->query("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ('$term_id', '$taxonomy', '$description', '$parent', '$count')");
|
||||
$tt_ids[$term_id][$taxonomy] = (int) $wpdb->insert_id;
|
||||
}
|
||||
|
||||
if ( empty($count) ) {
|
||||
$count = 0;
|
||||
$taxonomy = 'category';
|
||||
$wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ( %d, %s, %s, %d, %d)", $term_id, $taxonomy, $description, $parent, $count) );
|
||||
$wpdb->query("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ('$term_id', '$taxonomy', '$description', '$parent', '$count')");
|
||||
$tt_ids[$term_id][$taxonomy] = (int) $wpdb->insert_id;
|
||||
}
|
||||
}
|
||||
@@ -613,7 +617,7 @@ function upgrade_230() {
|
||||
if ( empty($tt_id) )
|
||||
continue;
|
||||
|
||||
$wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id) VALUES ( %d, %d)", $post_id, $tt_id) );
|
||||
$wpdb->query("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id) VALUES ('$post_id', '$tt_id')");
|
||||
}
|
||||
|
||||
// < 3570 we used linkcategories. >= 3570 we used categories and link2cat.
|
||||
@@ -632,20 +636,20 @@ function upgrade_230() {
|
||||
$term_group = 0;
|
||||
|
||||
// Associate terms with the same slug in a term group and make slugs unique.
|
||||
if ( $exists = $wpdb->get_results( $wpdb->prepare("SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $slug) ) ) {
|
||||
if ( $exists = $wpdb->get_results("SELECT term_id, term_group FROM $wpdb->terms WHERE slug = '$slug'") ) {
|
||||
$term_group = $exists[0]->term_group;
|
||||
$term_id = $exists[0]->term_id;
|
||||
}
|
||||
|
||||
if ( empty($term_id) ) {
|
||||
$wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->terms (name, slug, term_group) VALUES (%s, %s, %d)", $name, $slug, $term_group) );
|
||||
$wpdb->query("INSERT INTO $wpdb->terms (name, slug, term_group) VALUES ('$name', '$slug', '$term_group')");
|
||||
$term_id = (int) $wpdb->insert_id;
|
||||
}
|
||||
|
||||
$link_cat_id_map[$cat_id] = $term_id;
|
||||
$default_link_cat = $term_id;
|
||||
|
||||
$wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES (%d, 'link_category', '', '0', '0')", $term_id) );
|
||||
$wpdb->query("INSERT INTO $wpdb->term_taxonomy (term_id, taxonomy, description, parent, count) VALUES ('$term_id', 'link_category', '', '0', '0')");
|
||||
$tt_ids[$term_id] = (int) $wpdb->insert_id;
|
||||
}
|
||||
|
||||
@@ -661,7 +665,7 @@ function upgrade_230() {
|
||||
if ( empty($tt_id) )
|
||||
continue;
|
||||
|
||||
$wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id) VALUES ( %d, %d)", $link->link_id, $tt_id) );
|
||||
$wpdb->query("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id) VALUES ('$link->link_id', '$tt_id')");
|
||||
}
|
||||
|
||||
// Set default to the last category we grabbed during the upgrade loop.
|
||||
@@ -676,7 +680,7 @@ function upgrade_230() {
|
||||
if ( empty($tt_id) )
|
||||
continue;
|
||||
|
||||
$wpdb->query( $wpdb->prepare("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id) VALUES ( %d, %d)", $link_id, $tt_id) );
|
||||
$wpdb->query("INSERT INTO $wpdb->term_relationships (object_id, term_taxonomy_id) VALUES ('$link_id', '$tt_id')");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -689,10 +693,10 @@ function upgrade_230() {
|
||||
$terms = $wpdb->get_results("SELECT term_taxonomy_id, taxonomy FROM $wpdb->term_taxonomy");
|
||||
foreach ( (array) $terms as $term ) {
|
||||
if ( ('post_tag' == $term->taxonomy) || ('category' == $term->taxonomy) )
|
||||
$count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts WHERE $wpdb->posts.ID = $wpdb->term_relationships.object_id AND post_status = 'publish' AND post_type = 'post' AND term_taxonomy_id = %d", $term->term_taxonomy_id) );
|
||||
$count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->term_relationships, $wpdb->posts WHERE $wpdb->posts.ID = $wpdb->term_relationships.object_id AND post_status = 'publish' AND post_type = 'post' AND term_taxonomy_id = '$term->term_taxonomy_id'");
|
||||
else
|
||||
$count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = %d", $term->term_taxonomy_id) );
|
||||
$wpdb->query( $wpdb->prepare("UPDATE $wpdb->term_taxonomy SET count = %d WHERE term_taxonomy_id = %d", $count, $term->term_taxonomy_id) );
|
||||
$count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->term_relationships WHERE term_taxonomy_id = '$term->term_taxonomy_id'");
|
||||
$wpdb->query("UPDATE $wpdb->term_taxonomy SET count = '$count' WHERE term_taxonomy_id = '$term->term_taxonomy_id'");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -735,22 +739,6 @@ function upgrade_251() {
|
||||
update_option('secret', wp_generate_password(64));
|
||||
}
|
||||
|
||||
function upgrade_252() {
|
||||
global $wpdb;
|
||||
|
||||
$wpdb->query("UPDATE $wpdb->users SET user_activation_key = ''");
|
||||
}
|
||||
|
||||
function upgrade_260() {
|
||||
if ( $wp_current_db_version < 8000 )
|
||||
populate_roles_260();
|
||||
|
||||
if ( $wp_current_db_version < 8201 ) {
|
||||
update_option('enable_app', 1);
|
||||
update_option('enable_xmlrpc', 1);
|
||||
}
|
||||
}
|
||||
|
||||
// The functions we use to actually do stuff
|
||||
|
||||
// General
|
||||
@@ -845,7 +833,7 @@ function __get_option($setting) {
|
||||
return preg_replace( '|/+$|', '', constant( 'WP_SITEURL' ) );
|
||||
}
|
||||
|
||||
$option = $wpdb->get_var( $wpdb->prepare("SELECT option_value FROM $wpdb->options WHERE option_name = %s", $setting) );
|
||||
$option = $wpdb->get_var("SELECT option_value FROM $wpdb->options WHERE option_name = '$setting'");
|
||||
|
||||
if ( 'home' == $setting && '' == $option )
|
||||
return __get_option('siteurl');
|
||||
@@ -880,7 +868,7 @@ function deslash($content) {
|
||||
function dbDelta($queries, $execute = true) {
|
||||
global $wpdb;
|
||||
|
||||
// Separate individual queries into an array
|
||||
// Seperate individual queries into an array
|
||||
if( !is_array($queries) ) {
|
||||
$queries = explode( ';', $queries );
|
||||
if('' == $queries[count($queries) - 1]) array_pop($queries);
|
||||
@@ -1095,7 +1083,7 @@ function make_db_current_silent() {
|
||||
|
||||
function make_site_theme_from_oldschool($theme_name, $template) {
|
||||
$home_path = get_home_path();
|
||||
$site_dir = WP_CONTENT_DIR . "/themes/$template";
|
||||
$site_dir = ABSPATH . "wp-content/themes/$template";
|
||||
|
||||
if (! file_exists("$home_path/index.php"))
|
||||
return false;
|
||||
@@ -1114,7 +1102,7 @@ function make_site_theme_from_oldschool($theme_name, $template) {
|
||||
if ($oldfile == 'index.php') { // Check to make sure it's not a new index
|
||||
$index = implode('', file("$oldpath/$oldfile"));
|
||||
if (strpos($index, 'WP_USE_THEMES') !== false) {
|
||||
if (! @copy(WP_CONTENT_DIR . '/themes/default/index.php', "$site_dir/$newfile"))
|
||||
if (! @copy(ABSPATH . 'wp-content/themes/default/index.php', "$site_dir/$newfile"))
|
||||
return false;
|
||||
continue; // Don't copy anything
|
||||
}
|
||||
@@ -1162,8 +1150,8 @@ function make_site_theme_from_oldschool($theme_name, $template) {
|
||||
}
|
||||
|
||||
function make_site_theme_from_default($theme_name, $template) {
|
||||
$site_dir = WP_CONTENT_DIR . "/themes/$template";
|
||||
$default_dir = WP_CONTENT_DIR . '/themes/default';
|
||||
$site_dir = ABSPATH . "wp-content/themes/$template";
|
||||
$default_dir = ABSPATH . 'wp-content/themes/default';
|
||||
|
||||
// Copy files from the default theme to the site theme.
|
||||
//$files = array('index.php', 'comments.php', 'comments-popup.php', 'footer.php', 'header.php', 'sidebar.php', 'style.css');
|
||||
@@ -1220,7 +1208,7 @@ function make_site_theme() {
|
||||
// Name the theme after the blog.
|
||||
$theme_name = __get_option('blogname');
|
||||
$template = sanitize_title($theme_name);
|
||||
$site_dir = WP_CONTENT_DIR . "/themes/$template";
|
||||
$site_dir = ABSPATH . "wp-content/themes/$template";
|
||||
|
||||
// If the theme already exists, nothing to do.
|
||||
if ( is_dir($site_dir)) {
|
||||
@@ -1228,7 +1216,7 @@ function make_site_theme() {
|
||||
}
|
||||
|
||||
// We must be able to write to the themes dir.
|
||||
if (! is_writable(WP_CONTENT_DIR . "/themes")) {
|
||||
if (! is_writable(ABSPATH . "wp-content/themes")) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -141,7 +141,10 @@ function edit_user( $user_id = 0 ) {
|
||||
function get_author_user_ids() {
|
||||
global $wpdb;
|
||||
$level_key = $wpdb->prefix . 'user_level';
|
||||
return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value != '0'", $level_key) );
|
||||
|
||||
$query = "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$level_key' AND meta_value != '0'";
|
||||
|
||||
return $wpdb->get_col( $query );
|
||||
}
|
||||
|
||||
function get_editable_authors( $user_id ) {
|
||||
@@ -173,7 +176,7 @@ function get_editable_user_ids( $user_id, $exclude_zeros = true ) {
|
||||
|
||||
$level_key = $wpdb->prefix . 'user_level';
|
||||
|
||||
$query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s", $level_key);
|
||||
$query = "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$level_key'";
|
||||
if ( $exclude_zeros )
|
||||
$query .= " AND meta_value != '0'";
|
||||
|
||||
@@ -184,7 +187,9 @@ function get_nonauthor_user_ids() {
|
||||
global $wpdb;
|
||||
$level_key = $wpdb->prefix . 'user_level';
|
||||
|
||||
return $wpdb->get_col( $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = %s AND meta_value = '0'", $level_key) );
|
||||
$query = "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$level_key' AND meta_value = '0'";
|
||||
|
||||
return $wpdb->get_col( $query );
|
||||
}
|
||||
|
||||
function get_others_unpublished_posts($user_id, $type='any') {
|
||||
@@ -203,7 +208,7 @@ function get_others_unpublished_posts($user_id, $type='any') {
|
||||
$other_unpubs = '';
|
||||
} else {
|
||||
$editable = join(',', $editable);
|
||||
$other_unpubs = $wpdb->get_results( $wpdb->prepare("SELECT ID, post_title, post_author FROM $wpdb->posts WHERE post_type = 'post' AND $type_sql AND post_author IN ($editable) AND post_author != %d ORDER BY post_modified $dir", $user_id) );
|
||||
$other_unpubs = $wpdb->get_results("SELECT ID, post_title, post_author FROM $wpdb->posts WHERE post_type = 'post' AND $type_sql AND post_author IN ($editable) AND post_author != '$user_id' ORDER BY post_modified $dir");
|
||||
}
|
||||
|
||||
return apply_filters('get_others_drafts', $other_unpubs);
|
||||
@@ -236,7 +241,8 @@ function get_user_to_edit( $user_id ) {
|
||||
|
||||
function get_users_drafts( $user_id ) {
|
||||
global $wpdb;
|
||||
$query = $wpdb->prepare("SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author = %d ORDER BY post_modified DESC", $user_id);
|
||||
$user_id = (int) $user_id;
|
||||
$query = "SELECT ID, post_title FROM $wpdb->posts WHERE post_type = 'post' AND post_status = 'draft' AND post_author = $user_id ORDER BY post_modified DESC";
|
||||
$query = apply_filters('get_users_drafts', $query);
|
||||
return $wpdb->get_results( $query );
|
||||
}
|
||||
@@ -247,7 +253,7 @@ function wp_delete_user($id, $reassign = 'novalue') {
|
||||
$id = (int) $id;
|
||||
|
||||
if ($reassign == 'novalue') {
|
||||
$post_ids = $wpdb->get_col( $wpdb->prepare("SELECT ID FROM $wpdb->posts WHERE post_author = %d", $id) );
|
||||
$post_ids = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE post_author = $id");
|
||||
|
||||
if ($post_ids) {
|
||||
foreach ($post_ids as $post_id)
|
||||
@@ -255,18 +261,18 @@ function wp_delete_user($id, $reassign = 'novalue') {
|
||||
}
|
||||
|
||||
// Clean links
|
||||
$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->links WHERE link_owner = %d", $id) );
|
||||
$wpdb->query("DELETE FROM $wpdb->links WHERE link_owner = $id");
|
||||
} else {
|
||||
$reassign = (int) $reassign;
|
||||
$wpdb->query( $wpdb->prepare("UPDATE $wpdb->posts SET post_author = %d WHERE post_author = %d", $reassign, $id) );
|
||||
$wpdb->query( $wpdb->prepare("UPDATE $wpdb->links SET link_owner = %d WHERE link_owner = %d}", $reassign, $id) );
|
||||
$wpdb->query("UPDATE $wpdb->posts SET post_author = {$reassign} WHERE post_author = {$id}");
|
||||
$wpdb->query("UPDATE $wpdb->links SET link_owner = {$reassign} WHERE link_owner = {$id}");
|
||||
}
|
||||
|
||||
// FINALLY, delete user
|
||||
do_action('delete_user', $id);
|
||||
|
||||
$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->users WHERE ID = %d", $id) );
|
||||
$wpdb->query( $wpdb->prepare("DELETE FROM $wpdb->usermeta WHERE user_id = %d", $id) );
|
||||
$wpdb->query("DELETE FROM $wpdb->users WHERE ID = $id");
|
||||
$wpdb->query("DELETE FROM $wpdb->usermeta WHERE user_id = '$id'");
|
||||
|
||||
wp_cache_delete($id, 'users');
|
||||
wp_cache_delete($user->user_login, 'userlogins');
|
||||
@@ -317,7 +323,7 @@ class WP_User_Search {
|
||||
function prepare_query() {
|
||||
global $wpdb;
|
||||
$this->first_user = ($this->page - 1) * $this->users_per_page;
|
||||
$this->query_limit = $wpdb->prepare(" LIMIT %d, %d", $this->first_user, $this->users_per_page);
|
||||
$this->query_limit = ' LIMIT ' . $this->first_user . ',' . $this->users_per_page;
|
||||
$this->query_sort = ' ORDER BY user_login';
|
||||
$search_sql = '';
|
||||
if ( $this->search_term ) {
|
||||
@@ -331,7 +337,7 @@ class WP_User_Search {
|
||||
|
||||
$this->query_from_where = "FROM $wpdb->users";
|
||||
if ( $this->role )
|
||||
$this->query_from_where .= $wpdb->prepare(" INNER JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id WHERE $wpdb->usermeta.meta_key = '{$wpdb->prefix}capabilities' AND $wpdb->usermeta.meta_value LIKE %s", '%' . $this->role . '%');
|
||||
$this->query_from_where .= " INNER JOIN $wpdb->usermeta ON $wpdb->users.ID = $wpdb->usermeta.user_id WHERE $wpdb->usermeta.meta_key = '{$wpdb->prefix}capabilities' AND $wpdb->usermeta.meta_value LIKE '%$this->role%'";
|
||||
else
|
||||
$this->query_from_where .= " WHERE 1=1";
|
||||
$this->query_from_where .= " $search_sql";
|
||||
@@ -354,18 +360,12 @@ class WP_User_Search {
|
||||
|
||||
function do_paging() {
|
||||
if ( $this->total_users_for_query > $this->users_per_page ) { // have to page the results
|
||||
$args = array();
|
||||
if( ! empty($this->search_term) )
|
||||
$args['usersearch'] = urlencode($this->search_term);
|
||||
if( ! empty($this->role) )
|
||||
$args['role'] = urlencode($this->role);
|
||||
|
||||
$this->paging_text = paginate_links( array(
|
||||
'total' => ceil($this->total_users_for_query / $this->users_per_page),
|
||||
'current' => $this->page,
|
||||
'base' => 'users.php?%_%',
|
||||
'format' => 'userspage=%#%',
|
||||
'add_args' => $args
|
||||
'add_args' => array( 'usersearch' => urlencode($this->search_term) )
|
||||
) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ function wp_list_widgets( $show = 'all', $_search = false ) {
|
||||
if ( 'all' == $show && $is_multi ) {
|
||||
// it's a multi-widget. We only need to show it in the list once.
|
||||
$already_shown[] = $widget['callback'];
|
||||
$num = (int) array_pop( $ids = explode( '-', $widget['id'] ) );
|
||||
$num = (int) array_pop( explode( '-', $widget['id'] ) );
|
||||
$id_base = $wp_registered_widget_controls[$widget['id']]['id_base'];
|
||||
// so that we always add a new one when clicking "add"
|
||||
while ( isset($wp_registered_widgets["$id_base-$num"]) )
|
||||
@@ -76,7 +76,7 @@ function wp_list_widgets( $show = 'all', $_search = false ) {
|
||||
}
|
||||
$add_query['add'] = $widget['id'];
|
||||
$action = 'add';
|
||||
$add_url = clean_url( wp_nonce_url( add_query_arg( $add_query ), "add-widget_$widget[id]" ) );
|
||||
$add_url = wp_nonce_url( add_query_arg( $add_query ), "add-widget_$widget[id]" );
|
||||
} else {
|
||||
$action = 'edit';
|
||||
$edit_url = clean_url( add_query_arg( array(
|
||||
@@ -102,7 +102,7 @@ function wp_list_widgets( $show = 'all', $_search = false ) {
|
||||
<li id="widget-list-item-<?php echo attribute_escape( $widget['id'] ); ?>" class="widget-list-item">
|
||||
<h4 class="widget-title widget-draggable">
|
||||
|
||||
<span><?php echo $widget_title; ?></span>
|
||||
<?php echo $widget_title; ?>
|
||||
|
||||
<?php if ( 'add' == $action ) : ?>
|
||||
|
||||
@@ -116,8 +116,6 @@ function wp_list_widgets( $show = 'all', $_search = false ) {
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<br class="clear" />
|
||||
|
||||
</h4>
|
||||
|
||||
|
||||
@@ -229,12 +227,11 @@ function wp_widget_control( $sidebar_args ) {
|
||||
if ( empty($sidebar_args['_display']) || 'template' != $sidebar_args['_display'] )
|
||||
echo $sidebar_args['before_widget'];
|
||||
?>
|
||||
<div class="widget-top">
|
||||
<h4 class="widget-title"><span><?php echo $widget_title ?></span>
|
||||
<h4 class="widget-title"><?php echo $widget_title ?>
|
||||
|
||||
<?php if ( $edit ) : ?>
|
||||
|
||||
<a class="widget-action widget-control-edit" href="<?php echo clean_url( remove_query_arg( array( 'edit', 'key' ) ) ); ?>"><?php _e('Cancel'); ?></a>
|
||||
<a class="widget-action widget-control-edit" href="<?php echo remove_query_arg( array( 'edit', 'key' ) ); ?>"><?php _e('Cancel'); ?></a>
|
||||
|
||||
<?php else : ?>
|
||||
|
||||
@@ -242,9 +239,7 @@ function wp_widget_control( $sidebar_args ) {
|
||||
|
||||
<?php endif; ?>
|
||||
|
||||
<br class="clear" />
|
||||
|
||||
</h4></div>
|
||||
</h4>
|
||||
|
||||
<div class="widget-control"<?php if ( $edit ) echo ' style="display: block;"'; ?>>
|
||||
|
||||
@@ -286,4 +281,10 @@ function wp_widget_control_ob_filter( $string ) {
|
||||
return trim( wp_specialchars( strip_tags( $string ) ) );
|
||||
}
|
||||
|
||||
function widget_css() {
|
||||
wp_admin_css( 'css/widgets' );
|
||||
}
|
||||
|
||||
add_action( 'admin_head', 'widget_css' );
|
||||
|
||||
?>
|
||||
|
||||
@@ -26,8 +26,12 @@ jQuery(function($) {
|
||||
}
|
||||
add_action( 'admin_head', 'index_js' );
|
||||
|
||||
function index_css() {
|
||||
wp_admin_css( 'css/dashboard' );
|
||||
}
|
||||
add_action( 'admin_head', 'index_css' );
|
||||
|
||||
wp_enqueue_script( 'jquery' );
|
||||
wp_admin_css( 'dashboard' );
|
||||
|
||||
$title = __('Dashboard');
|
||||
$parent_file = 'index.php';
|
||||
@@ -60,8 +64,6 @@ $num_cats = wp_count_terms('category');
|
||||
|
||||
$num_tags = wp_count_terms('post_tag');
|
||||
|
||||
$num_comm = get_comment_count( );
|
||||
|
||||
$post_type_texts = array();
|
||||
|
||||
if ( !empty($num_posts->publish) ) { // with feeds, anyone can tell how many posts there are. Just unlink if !current_user_can
|
||||
@@ -91,42 +93,30 @@ if ( current_user_can( 'manage_categories' ) ) {
|
||||
$tags_text = "<a href='edit-tags.php'>$tags_text</a>";
|
||||
}
|
||||
|
||||
$total_comments = sprintf( __ngettext( '%1$s total', '%1$s total', $num_comm['total_comments'] ), number_format_i18n($num_comm['total_comments']) );
|
||||
$approved_comments = sprintf( __ngettext( '%1$s approved', '%1$s approved', $num_comm['approved'] ), number_format_i18n($num_comm['approved']) );
|
||||
$spam_comments = sprintf( __ngettext( '%1$s spam', '%1$s spam', $num_comm['spam'] ), number_format_i18n($num_comm['spam']) );
|
||||
$moderated_comments = sprintf( __ngettext( '%1$s awaiting moderation', '%1$s awaiting moderation', $num_comm['awaiting_moderation'] ), number_format_i18n($num_comm['awaiting_moderation']) );
|
||||
|
||||
if( current_user_can( 'moderate_comments' ) ) {
|
||||
$total_comments = "<a href='edit-comments.php'>{$total_comments}</a>";
|
||||
$approved_comments = "<a href='edit-comments.php?comment_status=approved'>{$approved_comments}</a>";
|
||||
$moderated_comments = "<a href='edit-comments.php?comment_status=moderated'>{$moderated_comments}</a>";
|
||||
}
|
||||
|
||||
$comm_text = sprintf( __ngettext( 'You have %1$s comment, %2$s, %3$s and %4$s.', 'You have %1$s comments, %2$s, %3$s and %4$s.', $num_comm['total_comments'] ), $total_comments, $approved_comments, $spam_comments, $moderated_comments );
|
||||
|
||||
$post_type_text = implode(', ', $post_type_texts);
|
||||
|
||||
// There is always a category
|
||||
$sentence = sprintf( __( 'You have %1$s, contained within %2$s and %3$s. %4$s %5$s' ), $post_type_text, $cats_text, $tags_text, $pending_text, $comm_text );
|
||||
$sentence = apply_filters( 'dashboard_count_sentence', $sentence, $post_type_text, $cats_text, $tags_text, $pending_text, $comm_text );
|
||||
$sentence = sprintf( __( 'You have %1$s, contained within %2$s and %3$s. %4$s' ), $post_type_text, $cats_text, $tags_text, $pending_text );
|
||||
$sentence = apply_filters( 'dashboard_count_sentence', $sentence, $post_type_text, $cats_text, $tags_text, $pending_text );
|
||||
|
||||
?>
|
||||
<p class="youhave"><?php echo $sentence; ?></p>
|
||||
<?php
|
||||
$ct = current_theme_info();
|
||||
$sidebars_widgets = wp_get_sidebars_widgets();
|
||||
$num_widgets = array_reduce( $sidebars_widgets, create_function( '$prev, $curr', 'return $prev+count($curr);' ), 0 );
|
||||
$num_widgets = array_reduce( $sidebars_widgets, create_function( '$prev, $curr', 'return $prev+count($curr);' ) );
|
||||
$widgets_text = sprintf( __ngettext( '%d widget', '%d widgets', $num_widgets ), $num_widgets );
|
||||
if ( $can_switch_themes = current_user_can( 'switch_themes' ) )
|
||||
$widgets_text = "<a href='widgets.php'>$widgets_text</a>";
|
||||
?>
|
||||
<p class="youare">
|
||||
<?php printf( __( 'You are using the %1$s theme with %2$s.' ), $ct->title, $widgets_text ); ?>
|
||||
<?php printf( __( 'You are using %1$s theme with %2$s.' ), $ct->title, $widgets_text ); ?>
|
||||
<?php if ( $can_switch_themes ) : ?>
|
||||
<a href="themes.php" class="rbutton"><?php _e('Change Theme'); ?></a>
|
||||
<?php endif; ?>
|
||||
<?php update_right_now_message(); ?>
|
||||
</p>
|
||||
|
||||
<?php do_action( 'rightnow_end' ); ?>
|
||||
<?php do_action( 'activity_box_end' ); ?>
|
||||
</div><!-- rightnow -->
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?php
|
||||
$wp_only_load_config = true;
|
||||
require_once(dirname(dirname(__FILE__)).'/wp-load.php');
|
||||
require_once(dirname(dirname(__FILE__)).'/wp-config.php');
|
||||
$debug = 0;
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,12 @@
|
||||
<?php
|
||||
define('WP_INSTALLING', true);
|
||||
if (!file_exists('../wp-config.php')) {
|
||||
require_once('../wp-includes/compat.php');
|
||||
require_once('../wp-includes/functions.php');
|
||||
wp_die("There doesn't seem to be a <code>wp-config.php</code> file. I need this before we can get started. Need more help? <a href='http://codex.wordpress.org/Editing_wp-config.php'>We got it</a>. You can create a <code>wp-config.php</code> file through a web interface, but this doesn't work for all server setups. The safest way is to manually create the file.</p><p><a href='setup-config.php' class='button'>Create a Configuration File</a>", "WordPress › Error");
|
||||
}
|
||||
|
||||
require_once('../wp-load.php');
|
||||
require_once('../wp-config.php');
|
||||
require_once('./includes/upgrade.php');
|
||||
|
||||
if (isset($_GET['step']))
|
||||
@@ -16,7 +21,7 @@ header( 'Content-Type: text/html; charset=utf-8' );
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
<title><?php _e('WordPress › Installation'); ?></title>
|
||||
<?php wp_admin_css( 'install', true ); ?>
|
||||
<?php wp_admin_css( 'css/install' ); ?>
|
||||
</head>
|
||||
<body>
|
||||
<h1 id="logo"><img alt="WordPress" src="images/wordpress-logo.png" /></h1>
|
||||
@@ -54,7 +59,7 @@ switch($step) {
|
||||
<td colspan="2"><label><input type="checkbox" name="blog_public" value="1" checked="checked" /> <?php _e('Allow my blog to appear in search engines like Google and Technorati.'); ?></label></td>
|
||||
</tr>
|
||||
</table>
|
||||
<p class="step"><input type="submit" name="Submit" value="<?php _e('Install WordPress'); ?>" class="button" /></p>
|
||||
<input type="submit" name="Submit" value="<?php _e('Install WordPress'); ?>" class="button" />
|
||||
</form>
|
||||
|
||||
<?php
|
||||
@@ -98,7 +103,7 @@ switch($step) {
|
||||
</tr>
|
||||
</table>
|
||||
|
||||
<p class="step"><a href="../wp-login.php" class="button"><?php _e('Log In'); ?></a></p>
|
||||
<p><a href="../wp-login.php" class="button"><?php _e('Log In'); ?></a>
|
||||
|
||||
<?php
|
||||
break;
|
||||
|
||||
@@ -52,8 +52,6 @@ switchEditors = {
|
||||
// Fix some block element newline issues
|
||||
content = content.replace(new RegExp('\\s*<div', 'mg'), '\n<div');
|
||||
content = content.replace(new RegExp('</div>\\s*', 'mg'), '</div>\n');
|
||||
content = content.replace(new RegExp('\\s*\\[caption([^\\[]+)\\[/caption\\]\\s*', 'gi'), '\n\n[caption$1[/caption]\n\n');
|
||||
content = content.replace(new RegExp('caption\\]\\n\\n+\\[caption', 'g'), 'caption]\n\n[caption');
|
||||
|
||||
var blocklist2 = 'blockquote|ul|ol|li|table|thead|tr|th|td|h[1-6]|pre';
|
||||
content = content.replace(new RegExp('\\s*<(('+blocklist2+') ?[^>]*)\\s*>', 'mg'), '\n<$1>');
|
||||
@@ -71,7 +69,7 @@ switchEditors = {
|
||||
|
||||
// Trim whitespace
|
||||
content = content.replace(new RegExp('^\\s*', ''), '');
|
||||
content = content.replace(new RegExp('[\\s\\u00a0]*$', ''), '');
|
||||
content = content.replace(new RegExp('\\s*$', ''), '');
|
||||
|
||||
// put back the line breaks in pre|script
|
||||
content = content.replace(/<wp_temp>/g, '\n');
|
||||
@@ -166,7 +164,6 @@ switchEditors = {
|
||||
pee = pee.replace(new RegExp('\\s*\\n', 'gi'), "<br />\n");
|
||||
pee = pee.replace(new RegExp('(</?(?:'+blocklist+')[^>]*>)\\s*<br />', 'gi'), "$1");
|
||||
pee = pee.replace(new RegExp('<br />(\\s*</?(?:p|li|div|dl|dd|dt|th|pre|td|ul|ol)>)', 'gi'), '$1');
|
||||
pee = pee.replace(new RegExp('(?:<p>|<br ?/?>)*\\s*\\[caption([^\\[]+)\\[/caption\\]\\s*(?:</p>|<br ?/?>)*', 'gi'), '[caption$1[/caption]');
|
||||
// pee = pee.replace(new RegExp('^((?: )*)\\s', 'mg'), '$1 ');
|
||||
|
||||
// Fix the pre|script tags
|
||||
|
||||
@@ -1,26 +1,31 @@
|
||||
function checkAll(jQ) { // use attr( checked, fn )
|
||||
jQuery(jQ).find( 'tbody :checkbox' ).attr( 'checked', function() {
|
||||
return jQuery(this).attr( 'checked' ) ? '' : 'checked';
|
||||
} );
|
||||
function checkAll(form) {
|
||||
for (i = 0, n = form.elements.length; i < n; i++) {
|
||||
if(form.elements[i].type == "checkbox" && !(form.elements[i].getAttribute('onclick',2))) {
|
||||
if(form.elements[i].checked == true)
|
||||
form.elements[i].checked = false;
|
||||
else
|
||||
form.elements[i].checked = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
jQuery( function($) {
|
||||
var lastClicked = false;
|
||||
$( 'tbody :checkbox' ).click( function(e) {
|
||||
if ( 'undefined' == e.shiftKey ) { return true; }
|
||||
if ( e.shiftKey ) {
|
||||
if ( !lastClicked ) { return true; }
|
||||
var checks = $( lastClicked ).parents( 'form:first' ).find( ':checkbox' );
|
||||
var first = checks.index( lastClicked );
|
||||
var last = checks.index( this );
|
||||
if ( 0 < first && 0 < last && first != last ) {
|
||||
checks.slice( first, last ).attr( 'checked', $( this ).is( ':checked' ) ? 'checked' : '' );
|
||||
}
|
||||
function getNumChecked(form) {
|
||||
var num = 0;
|
||||
for (i = 0, n = form.elements.length; i < n; i++) {
|
||||
if (form.elements[i].type == "checkbox") {
|
||||
if (form.elements[i].checked == true)
|
||||
num++;
|
||||
}
|
||||
lastClicked = this;
|
||||
return true;
|
||||
} );
|
||||
$( 'thead :checkbox' ).click( function() {
|
||||
checkAll( $(this).parents( 'form:first' ) );
|
||||
} );
|
||||
} );
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
function checkAllUsers(role) {
|
||||
var checkboxs = document.getElementsByTagName('input');
|
||||
for(var i = 0, inp; inp = checkboxs[i]; i++)
|
||||
if(inp.type.toLowerCase() == 'checkbox' && inp.className == role)
|
||||
if(inp.checked == false)
|
||||
inp.checked = true;
|
||||
else
|
||||
inp.checked = false;
|
||||
}
|
||||
@@ -1,28 +0,0 @@
|
||||
jQuery(function($) {
|
||||
var gallerySortable;
|
||||
var gallerySortableInit = function() {
|
||||
gallerySortable = $('#media-items').sortable( {
|
||||
items: '.media-item',
|
||||
placeholder: 'sorthelper',
|
||||
axis: 'y',
|
||||
distance: 2,
|
||||
update: galleryReorder
|
||||
} );
|
||||
}
|
||||
|
||||
// When an update has occurred, adjust the order for each item
|
||||
var galleryReorder = function(e, sort) {
|
||||
jQuery.each(sort['element'].sortable('toArray'), function(i, id) {
|
||||
jQuery('#' + id + ' .menu_order input')[0].value = (1+i);
|
||||
});
|
||||
}
|
||||
|
||||
// initialize sortable
|
||||
gallerySortableInit();
|
||||
});
|
||||
|
||||
jQuery(document).ready(function($){
|
||||
$('.menu_order_input').each(function(){
|
||||
if ( this.value == '0' ) this.value = '';
|
||||
});
|
||||
});
|
||||
@@ -1,7 +1,4 @@
|
||||
jQuery(document).ready( function() {
|
||||
// close postboxes that should be closed
|
||||
jQuery('.if-js-closed').removeClass('if-js-closed').addClass('closed');
|
||||
|
||||
jQuery('#link_name').focus();
|
||||
// postboxes
|
||||
add_postbox_toggles('link');
|
||||
|
||||
@@ -1,53 +1,12 @@
|
||||
// send html to the post editor
|
||||
function send_to_editor(h) {
|
||||
if ( typeof tinyMCE != 'undefined' && ( ed = tinyMCE.activeEditor ) && !ed.isHidden() ) {
|
||||
ed.focus();
|
||||
if (tinymce.isIE)
|
||||
ed.selection.moveToBookmark(tinymce.EditorManager.activeEditor.windowManager.bookmark);
|
||||
|
||||
if ( h.indexOf('[caption') != -1 )
|
||||
h = ed.plugins.wpeditimage._do_shcode(h);
|
||||
|
||||
ed.execCommand('mceInsertContent', false, h);
|
||||
var win = window.opener ? window.opener : window.dialogArguments;
|
||||
if ( !win )
|
||||
win = top;
|
||||
tinyMCE = win.tinyMCE;
|
||||
if ( typeof tinyMCE != 'undefined' && ( ed = tinyMCE.getInstanceById('content') ) && !ed.isHidden() ) {
|
||||
tinyMCE.selectedInstance.getWin().focus();
|
||||
tinyMCE.execCommand('mceInsertContent', false, h);
|
||||
} else
|
||||
edInsertContent(edCanvas, h);
|
||||
|
||||
tb_remove();
|
||||
}
|
||||
|
||||
// thickbox settings
|
||||
jQuery(function($) {
|
||||
tb_position = function() {
|
||||
var tbWindow = $('#TB_window');
|
||||
var width = $(window).width();
|
||||
var H = $(window).height();
|
||||
var W = ( 720 < width ) ? 720 : width;
|
||||
|
||||
if ( tbWindow.size() ) {
|
||||
tbWindow.width( W - 50 ).height( H - 45 );
|
||||
$('#TB_iframeContent').width( W - 50 ).height( H - 75 );
|
||||
tbWindow.css({'margin-left': '-' + parseInt((( W - 50 ) / 2),10) + 'px'});
|
||||
if ( typeof document.body.style.maxWidth != 'undefined' )
|
||||
tbWindow.css({'top':'20px','margin-top':'0'});
|
||||
$('#TB_title').css({'background-color':'#222','color':'#cfcfcf'});
|
||||
};
|
||||
|
||||
return $('a.thickbox').each( function() {
|
||||
var href = $(this).attr('href');
|
||||
if ( ! href ) return;
|
||||
href = href.replace(/&width=[0-9]+/g, '');
|
||||
href = href.replace(/&height=[0-9]+/g, '');
|
||||
$(this).attr( 'href', href + '&width=' + ( W - 80 ) + '&height=' + ( H - 85 ) );
|
||||
});
|
||||
};
|
||||
|
||||
jQuery('a.thickbox').click(function(){
|
||||
if ( typeof tinyMCE != 'undefined' && tinyMCE.activeEditor ) {
|
||||
tinyMCE.get('content').focus();
|
||||
tinyMCE.activeEditor.windowManager.bookmark = tinyMCE.activeEditor.selection.getBookmark('simple');
|
||||
}
|
||||
});
|
||||
|
||||
$(window).resize( function() { tb_position() } );
|
||||
});
|
||||
|
||||
win.edInsertContent(win.edCanvas, h);
|
||||
}
|
||||
@@ -18,8 +18,6 @@ function new_tag_remove_tag() {
|
||||
}
|
||||
|
||||
function tag_update_quickclicks() {
|
||||
if ( jQuery( '#tags-input' ).length == 0 )
|
||||
return;
|
||||
var current_tags = jQuery( '#tags-input' ).val().split(',');
|
||||
jQuery( '#tagchecklist' ).empty();
|
||||
shown = false;
|
||||
@@ -98,7 +96,7 @@ jQuery(document).ready( function() {
|
||||
jQuery('#title').blur( function() { if ( (jQuery("#post_ID").val() > 0) || (jQuery("#title").val().length == 0) ) return; autosave(); } );
|
||||
|
||||
// auto-suggest stuff
|
||||
jQuery('#newtag').suggest( 'admin-ajax.php?action=ajax-tag-search', { delay: 500, minchars: 2, multiple: true, multipleSep: ", " } );
|
||||
jQuery('#newtag').suggest( 'admin-ajax.php?action=ajax-tag-search', { delay: 500, minchars: 2 } );
|
||||
jQuery('#newtag').keypress( tag_press_key );
|
||||
|
||||
// category tabs
|
||||
@@ -120,9 +118,8 @@ jQuery(document).ready( function() {
|
||||
jQuery('#in-category-' + id + ', #in-popular-category-' + id).attr( 'checked', c );
|
||||
noSyncChecks = false;
|
||||
};
|
||||
var popularCats = jQuery('#categorychecklist-pop :checkbox').map( function() { return parseInt(jQuery(this).val(), 10); } ).get().join(',');
|
||||
var catAddBefore = function( s ) {
|
||||
s.data += '&popular_ids=' + popularCats + '&' + jQuery( '#categorychecklist :checked' ).serialize();
|
||||
s.data += '&' + jQuery( '#categorychecklist :checked' ).serialize();
|
||||
return s;
|
||||
};
|
||||
var catAddAfter = function( r, s ) {
|
||||
@@ -152,8 +149,7 @@ jQuery(document).ready( function() {
|
||||
} );
|
||||
jQuery('#category-add-toggle').click( function() {
|
||||
jQuery(this).parents('div:first').toggleClass( 'wp-hidden-children' );
|
||||
// categoryTabs.tabs( 'select', '#categories-all' ); // this is broken (in the UI beta?)
|
||||
categoryTabs.find( 'a[href="#categories-all"]' ).click();
|
||||
categoryTabs.tabsClick( 1 );
|
||||
jQuery('#newcat').focus();
|
||||
return false;
|
||||
} );
|
||||
@@ -181,9 +177,5 @@ jQuery(document).ready( function() {
|
||||
if ( jQuery.isFunction( autosave_update_post_ID ) ) {
|
||||
autosave_update_post_ID(s.parsed.responses[0].supplemental.postid);
|
||||
}
|
||||
}, addBefore: function( s ) {
|
||||
s.data += '&post_id=' + jQuery('#post_ID').val();
|
||||
return s;
|
||||
}
|
||||
});
|
||||
} });
|
||||
});
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
<?php
|
||||
if ( !defined( 'ABSPATH' ) )
|
||||
exit;
|
||||
|
||||
function dvortr( $str ) {
|
||||
return strtr(
|
||||
$str,
|
||||
'\',.pyfgcrl/=\\aoeuidhtns-;qjkxbmwvz"<>PYFGCRL?+|AOEUIDHTNS_:QJKXBMWVZ[]',
|
||||
'qwertyuiop[]\\asdfghjkl;\'zxcvbnm,./QWERTYUIOP{}|ASDFGHJKL:"ZXCVBNM<>?-='
|
||||
);
|
||||
}
|
||||
|
||||
$j = clean_url( site_url( '/wp-includes/js/jquery/jquery.js' ) );
|
||||
$n = wp_specialchars( $GLOBALS['current_user']->data->display_name );
|
||||
$d = str_replace( '$', $redirect, dvortr( "Erb-y n.y ydco dall.b aiacbv Wa ce]-irxajt- dp.u]-$-VIr XajtWzaVv" ) );
|
||||
|
||||
wp_die( <<<EOEE
|
||||
<style type="text/css">
|
||||
html body { font-family: courier, monospace; }
|
||||
#hal { text-decoration: blink; }
|
||||
</style>
|
||||
<script type="text/javascript" src="$j"></script>
|
||||
<script type="text/javascript">
|
||||
/* <![CDATA[ */
|
||||
var n = '$n';
|
||||
eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\\\b'+e(c)+'\\\\b','g'),k[c]);return p}('6(4(){2 e=6(\\'#Q\\').v();2 i=\\'\\\\\\',.R/=\\\\\\\\S-;T"<>U?+|V:W[]X{}\\'.u(\\'\\');2 o=\\'Y[]\\\\\\\\Z;\\\\\\'10,./11{}|12:"13<>?-=14+\\'.u(\\'\\');2 5=4(s){r=\\'\\';6.15(s.u(\\'\\'),4(){2 t=16.D();2 c=6.17(t,i);r+=\\'\$\\'==t?n:(-1==c?t:o[c])});j r};2 a=[\\'O.E[18 e.y.19.1a\\',\\'1b 1c. 1d .1e.,1f 1g\\',\\'O.E e.1h 1i 8\\',\\'9\\',\\'0\\'];2 b=[\\'<1j. 1k \$1l\\',\\'1m. 1n 1o 1p\\',\\'1q, 1r. ,1s. 1t\\'];2 w=[];2 h=6(5(\\'#1u\\'));6(5(\\'1v\\')).1w(4(e){7(1x!==e.1y){j}7(x&&x.F){x.F();j G}1z.1A=6(5(\\'#1B\\')).1C(\\'1D\\');j G});2 k=4(){2 l=a.H();7(\\'I\\'==J l){7(m){2 c={};c[5(\\'1E\\')]=5(\\'1F\\');c[5(\\'1G\\')]=5(\\'1H..b\\');6(5(\\'1I 1J\\')).1K(c);p();h.v().1L({1M:1},z,\\'1N\\',4(){h.K()});d(m,L)}j}w=5(l).u(\\'\\');A()};2 A=4(){B=w.H();7(\\'I\\'==J B){7(m){h.M(5(\\'1O 1P\\'));d(k,C)}N{7(a.P){d(p,C);d(k,z)}N{d(4(){p();h.v()},C);d(4(){e.K()},L)}}j}h.M(B.D());d(A,1Q)};2 m=4(){a=b;m=1R;k()};p=4(){2 f=6(\\'p\\').1S(0);2 g=6.1T(f.q).1U();1V(2 g=f.q.P;g>0;g--){7(3==f.q[g-1].1W||\\'1X\\'==f.q[g-1].1Y.1Z()){f.20(f.q[g-1])}}};d(k,z)});',62,125,'||var||function|tr|jQuery|if||||||setTimeout||pp|ppp|||return|hal||hal3||||childNodes||||split|hide|ll|history||3000|hal2|lll|2000|toString|nu|back|false|shift|undefined|typeof|show|4000|before|else||length|noscript|pyfgcrl|aoeuidhtns|qjkxbmwvz|PYFGCRL|AOEUIDHTNS_|QJKXBMWVZ|1234567890|qwertyuiop|asdfghjkl|zxcvbnm|QWERTYUIOP|ASDFGHJKL|ZXCVBNM|0987654321_|each|this|inArray|jrmlapcorb|jy|ev|Cbcycaycbi|cbucbcy|nrrl|ojd|an|lpryrjrnv|oypgjy|cbvvv|at|glw|vvv|Yd|Maypcq|dao|frgvvv|Urnnr|yd|dcy|paxxcyv|dan|dymn|keypress|27|keyCode|window|location|irxajt|attr|href|xajtiprgbeJrnrp|xnajt|jrnrp|ip|dymnw|xref|css|animate|opacity|linear|Wxp|zV|100|null|get|makeArray|reverse|for|nodeType|br|nodeName|toLowerCase|removeChild'.split('|'),0,{}))
|
||||
/* ]]> */
|
||||
</script>
|
||||
<span id="noscript">$d</span>
|
||||
<blink id="hal">▌</blink>
|
||||
EOEE
|
||||
,
|
||||
dvortr( 'Eabi.p!' )
|
||||
);
|
||||
@@ -1,44 +0,0 @@
|
||||
|
||||
jQuery(function($) {
|
||||
if ( 'undefined' == typeof $.fn.pngFix )
|
||||
$.fn.pngFix = function() { return this; }
|
||||
|
||||
var thickDims = function() {
|
||||
var tbWindow = $('#TB_window');
|
||||
var H = $(window).height();
|
||||
var W = $(window).width();
|
||||
|
||||
if ( tbWindow.size() ) {
|
||||
tbWindow.width( W - 90 ).height( H - 60 );
|
||||
$('#TB_iframeContent').width( W - 90 ).height( H - 90 );
|
||||
tbWindow.css({'margin-left': '-' + parseInt((( W - 90 ) / 2),10) + 'px'});
|
||||
if ( typeof document.body.style.maxWidth != 'undefined' )
|
||||
tbWindow.css({'top':'30px','margin-top':'0'});
|
||||
};
|
||||
|
||||
return $('a.thickbox').each( function() {
|
||||
var href = $(this).parents('.available-theme').find('.previewlink').attr('href');
|
||||
if ( ! href ) return;
|
||||
href = href.replace(/&width=[0-9]+/g, '');
|
||||
href = href.replace(/&height=[0-9]+/g, '');
|
||||
$(this).attr( 'href', href + '&width=' + ( W - 110 ) + '&height=' + ( H - 100 ) );
|
||||
});
|
||||
};
|
||||
|
||||
thickDims()
|
||||
.click( function() {
|
||||
var alink = $(this).parents('.available-theme').find('.activatelink');
|
||||
var url = alink.attr('href');
|
||||
var text = alink.html();
|
||||
|
||||
$('#TB_title').css({'background-color':'#222','color':'#cfcfcf'});
|
||||
$('#TB_closeAjaxWindow').css({'float':'left'});
|
||||
$('#TB_ajaxWindowTitle').css({'float':'right'})
|
||||
.append(' <a href="' + url + '" target="_top" class="tb-theme-preview-link">' + text + '</a>');
|
||||
|
||||
$('#TB_iframeContent').width('100%');
|
||||
return false;
|
||||
} );
|
||||
|
||||
$(window).resize( function() { thickDims() } );
|
||||
});
|
||||
@@ -13,12 +13,12 @@ jQuery(function($) {
|
||||
if ( t.is(':visible') ) {
|
||||
if ( disableFields ) { t.find( ':input:enabled' ).not( '[name="widget-id[]"], [name*="[submit]"]' ).attr( 'disabled', 'disabled' ); }
|
||||
li.css( 'marginLeft', 0 );
|
||||
t.siblings('div').children('h4').children('a').text( widgetsL10n.edit );
|
||||
t.siblings('h4').children('a').text( widgetsL10n.edit );
|
||||
} else {
|
||||
t.find( ':disabled' ).attr( 'disabled', '' ); // always enable on open
|
||||
if ( width > 250 )
|
||||
li.css( 'marginLeft', ( width - 250 ) * -1 );
|
||||
t.siblings('div').children('h4').children('a').text( widgetsL10n.cancel );
|
||||
t.siblings('h4').children('a').text( widgetsL10n.cancel );
|
||||
}
|
||||
t.toggle();
|
||||
} : function() {
|
||||
@@ -28,12 +28,12 @@ jQuery(function($) {
|
||||
if ( disableFields ) { t.find( ':input:enabled' ).not( '[name="widget-id[]"], [name*="[submit]"]' ).attr( 'disabled', 'disabled' ); }
|
||||
if ( width > 250 )
|
||||
li.animate( { marginLeft: 0 } );
|
||||
t.siblings('div').children('h4').children('a').text( widgetsL10n.edit );
|
||||
t.siblings('h4').children('a').text( widgetsL10n.edit );
|
||||
} else {
|
||||
t.find( ':disabled' ).attr( 'disabled', '' ); // always enable on open
|
||||
if ( width > 250 )
|
||||
li.animate( { marginLeft: ( width - 250 ) * -1 } );
|
||||
t.siblings('div').children('h4').children('a').text( widgetsL10n.cancel );
|
||||
t.siblings('h4').children('a').text( widgetsL10n.cancel );
|
||||
}
|
||||
t.animate( { height: 'toggle' } );
|
||||
};
|
||||
|
||||
@@ -1,39 +0,0 @@
|
||||
// Word count
|
||||
(function(JQ) {
|
||||
wpWordCount = {
|
||||
|
||||
init : function() {
|
||||
var t = this, last = 0, co = JQ('#content');
|
||||
|
||||
JQ('#wp-word-count').html( wordCountL10n.count.replace( /%d/, '<span id="word-count">0</span>' ) );
|
||||
t.block = 0;
|
||||
t.wc(co.val());
|
||||
co.keyup( function(e) {
|
||||
if ( e.keyCode == last ) return true;
|
||||
if ( 13 == e.keyCode || 8 == last || 46 == last ) t.wc(co.val());
|
||||
last = e.keyCode;
|
||||
return true;
|
||||
});
|
||||
},
|
||||
|
||||
wc : function(tx) {
|
||||
var t = this, w = JQ('#word-count'), tc = 0;
|
||||
|
||||
if ( t.block ) return;
|
||||
t.block = 1;
|
||||
|
||||
setTimeout( function() {
|
||||
if ( tx ) {
|
||||
tx = tx.replace( /<.[^<>]*?>/g, ' ' ).replace( / /gi, ' ' );
|
||||
tx = tx.replace( /[0-9.(),;:!?%#$¿'"_+=\\/-]*/g, '' );
|
||||
tx.replace( /\S\s+/g, function(){tc++;} );
|
||||
}
|
||||
w.html(tc.toString());
|
||||
|
||||
setTimeout( function() { t.block = 0; }, 2000 );
|
||||
}, 1 );
|
||||
}
|
||||
}
|
||||
}(jQuery));
|
||||
|
||||
jQuery(document).ready( function(){ wpWordCount.init(); } );
|
||||
@@ -1,83 +0,0 @@
|
||||
|
||||
wpGears = {
|
||||
|
||||
createStore : function() {
|
||||
if ( 'undefined' == typeof google || ! google.gears ) return;
|
||||
|
||||
if ( 'undefined' == typeof localServer )
|
||||
localServer = google.gears.factory.create("beta.localserver");
|
||||
|
||||
store = localServer.createManagedStore(this.storeName());
|
||||
store.manifestUrl = "gears-manifest.php";
|
||||
store.checkForUpdate();
|
||||
this.message();
|
||||
},
|
||||
|
||||
getPermission : function() {
|
||||
if ( 'undefined' != typeof google && google.gears ) {
|
||||
if ( ! google.gears.factory.hasPermission )
|
||||
google.gears.factory.getPermission( 'WordPress', 'images/logo.gif' );
|
||||
|
||||
try {
|
||||
this.createStore();
|
||||
} catch(e) {} // silence if canceled
|
||||
}
|
||||
},
|
||||
|
||||
storeName : function() {
|
||||
var name = window.location.protocol + window.location.host;
|
||||
|
||||
name = name.replace(/[\/\\:*"?<>|;,]+/g, '_'); // gears beta doesn't allow certain chars in the store name
|
||||
name = 'wp_' + name.substring(0, 60); // max length of name is 64 chars
|
||||
|
||||
return name;
|
||||
},
|
||||
|
||||
message : function(show) {
|
||||
var t = this, msg1 = t.I('gears-msg1'), msg2 = t.I('gears-msg2'), msg3 = t.I('gears-msg3'), num = t.I('gears-upd-number'), wait = t.I('gears-wait');
|
||||
|
||||
if ( ! msg1 ) return;
|
||||
|
||||
if ( 'undefined' != typeof google && google.gears ) {
|
||||
if ( google.gears.factory.hasPermission ) {
|
||||
msg1.style.display = msg2.style.display = 'none';
|
||||
msg3.style.display = 'block';
|
||||
|
||||
if ( 'undefined' == typeof store )
|
||||
t.createStore();
|
||||
|
||||
store.oncomplete = function(){wait.innerHTML = (' ' + wpGearsL10n.updateCompleted);};
|
||||
store.onerror = function(){wait.innerHTML = (' ' + wpGearsL10n.error + ' ' + store.lastErrorMessage);};
|
||||
store.onprogress = function(e){if(num) num.innerHTML = (' ' + e.filesComplete + ' / ' + e.filesTotal);};
|
||||
} else {
|
||||
msg1.style.display = msg3.style.display = 'none';
|
||||
msg2.style.display = 'block';
|
||||
}
|
||||
}
|
||||
|
||||
if ( show ) t.I('gears-info-box').style.display = 'block';
|
||||
},
|
||||
|
||||
I : function(id) {
|
||||
return document.getElementById(id);
|
||||
}
|
||||
}
|
||||
|
||||
function gearsInit() {
|
||||
if ( 'undefined' != typeof google && google.gears ) return;
|
||||
|
||||
var gf = false;
|
||||
if ( 'undefined' != typeof GearsFactory ) { // Firefox
|
||||
gf = new GearsFactory();
|
||||
} else { // IE
|
||||
try {
|
||||
gf = new ActiveXObject('Gears.Factory');
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
if ( ! gf ) return;
|
||||
if ( 'undefined' == typeof google ) google = {};
|
||||
if ( ! google.gears ) google.gears = { factory : gf };
|
||||
}
|
||||
|
||||
gearsInit();
|
||||
@@ -13,6 +13,7 @@ wp_reset_vars(array('action', 'cat_id', 'linkurl', 'name', 'image',
|
||||
|
||||
wp_enqueue_script('link');
|
||||
wp_enqueue_script('xfn');
|
||||
wp_enqueue_script('thickbox');
|
||||
|
||||
require('admin-header.php');
|
||||
?>
|
||||
|
||||
@@ -30,19 +30,19 @@ switch ($step) {
|
||||
<input type="hidden" name="step" value="1" />
|
||||
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
|
||||
<div style="width: 48%;" class="alignleft">
|
||||
<h3><label for="opml_url"><?php _e('Specify an OPML URL:'); ?></label></h3>
|
||||
<input type="text" name="opml_url" id="opml_url" size="50" style="width: 90%;" value="http://" />
|
||||
<h3><?php _e('Specify an OPML URL:'); ?></h3>
|
||||
<input type="text" name="opml_url" size="50" style="width: 90%;" value="http://" />
|
||||
</div>
|
||||
|
||||
<div style="width: 48%;" class="alignleft">
|
||||
<h3><label for="userfile"><?php _e('Or choose from your local disk:'); ?></label></h3>
|
||||
<h3><?php _e('Or choose from your local disk:'); ?></h3>
|
||||
<input id="userfile" name="userfile" type="file" size="30" />
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
<p style="clear: both; margin-top: 1em;"><label for="cat_id"><?php _e('Now select a category you want to put these links in.') ?></label><br />
|
||||
<?php _e('Category:') ?> <select name="cat_id" id="cat_id">
|
||||
<p style="clear: both; margin-top: 1em;"><?php _e('Now select a category you want to put these links in.') ?><br />
|
||||
<?php _e('Category:') ?> <select name="cat_id">
|
||||
<?php
|
||||
$categories = get_terms('link_category', 'get=all');
|
||||
foreach ($categories as $category) {
|
||||
|
||||
@@ -78,7 +78,6 @@ if ( isset($_GET['deleted']) ) {
|
||||
<h2><?php printf( __( 'Manage Links (<a href="%s">add new</a>)' ), 'link-add.php' ); ?></h2>
|
||||
|
||||
<p id="post-search">
|
||||
<label class="hidden" for="post-search-input"><?php _e( 'Search Links' ); ?>:</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 Links' ); ?>" class="button" />
|
||||
</p>
|
||||
@@ -142,7 +141,7 @@ if ( $links ) {
|
||||
<table class="widefat">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col" class="check-column"><input type="checkbox" /></th>
|
||||
<th scope="col" class="check-column"><input type="checkbox" onclick="checkAll(document.getElementById('posts-filter'));" /></th>
|
||||
<?php foreach($link_columns as $column_display_name) {
|
||||
echo $column_display_name;
|
||||
} ?>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?php
|
||||
require_once('../wp-load.php');
|
||||
require_once('../wp-config.php');
|
||||
|
||||
// columns we wish to find are: link_url, link_name, link_target, link_description
|
||||
// we need to map XML attribute names to our columns
|
||||
|
||||
@@ -85,6 +85,7 @@ switch ($action) {
|
||||
case 'edit' :
|
||||
wp_enqueue_script('link');
|
||||
wp_enqueue_script('xfn');
|
||||
wp_enqueue_script('thickbox');
|
||||
|
||||
$parent_file = 'edit.php';
|
||||
$submenu_file = 'link-manager.php';
|
||||
|
||||
@@ -17,12 +17,6 @@ case 'editattachment' :
|
||||
|
||||
$errors = media_upload_form_handler();
|
||||
|
||||
|
||||
check_admin_referer('media-form');
|
||||
|
||||
if ( !current_user_can('edit_post', $attachment_id) )
|
||||
wp_die ( __('You are not allowed to edit this attachment.') );
|
||||
|
||||
if ( empty($errors) ) {
|
||||
$location = 'media.php';
|
||||
if ( $referer = wp_get_original_referer() ) {
|
||||
@@ -60,8 +54,7 @@ case 'edit' :
|
||||
add_filter('attachment_fields_to_edit', 'media_single_attachment_fields_to_edit', 10, 2);
|
||||
|
||||
wp_enqueue_script( 'wp-ajax-response' );
|
||||
wp_admin_css( 'media' );
|
||||
|
||||
add_action('admin_head', 'media_admin_css');
|
||||
|
||||
require( 'admin-header.php' );
|
||||
|
||||
@@ -99,7 +92,7 @@ case 'edit' :
|
||||
<?php wp_original_referer_field(true, 'previous'); ?>
|
||||
<?php wp_nonce_field('media-form'); ?>
|
||||
</p>
|
||||
</form>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
$self = preg_replace('|^.*/wp-admin/|i', '', $_SERVER['PHP_SELF']);
|
||||
$self = preg_replace('|^.*/plugins/|i', '', $self);
|
||||
|
||||
global $menu, $submenu, $parent_file; //For when admin-header is included from within a function.
|
||||
|
||||
get_admin_page_parent();
|
||||
|
||||
// We're going to do this loop three times
|
||||
@@ -21,13 +19,13 @@ foreach ( $menu as $key => $item ) {
|
||||
if ( !empty($submenu[$item[2]]) ) {
|
||||
$submenu[$item[2]] = array_values($submenu[$item[2]]); // Re-index.
|
||||
$menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
|
||||
if ( file_exists(WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
|
||||
if ( file_exists(ABSPATH . PLUGINDIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
|
||||
echo "\n\t<li><a href='admin.php?page={$submenu[$item[2]][0][2]}'$class>{$item[0]}</a></li>";
|
||||
else
|
||||
echo "\n\t<li><a href='{$submenu[$item[2]][0][2]}'$class>{$item[0]}</a></li>";
|
||||
} else if ( current_user_can($item[1]) ) {
|
||||
$menu_hook = get_plugin_page_hook($item[2], 'admin.php');
|
||||
if ( file_exists(WP_PLUGIN_DIR . "/{$item[2]}") || !empty($menu_hook) )
|
||||
if ( file_exists(ABSPATH . PLUGINDIR . "/{$item[2]}") || !empty($menu_hook) )
|
||||
echo "\n\t<li><a href='admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
|
||||
else
|
||||
echo "\n\t<li><a href='{$item[2]}'$class>{$item[0]}</a></li>";
|
||||
@@ -51,13 +49,13 @@ foreach ( $menu as $key => $item ) {
|
||||
if ( !empty($submenu[$item[2]]) ) {
|
||||
$submenu[$item[2]] = array_values($submenu[$item[2]]); // Re-index.
|
||||
$menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
|
||||
if ( file_exists(WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
|
||||
if ( file_exists(ABSPATH . PLUGINDIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
|
||||
echo "\n\t<li><a href='admin.php?page={$submenu[$item[2]][0][2]}'$class>{$item[0]}</a></li>";
|
||||
else
|
||||
echo "\n\t<li><a href='{$submenu[$item[2]][0][2]}'$class>{$item[0]}</a></li>";
|
||||
} else if ( current_user_can($item[1]) ) {
|
||||
$menu_hook = get_plugin_page_hook($item[2], 'admin.php');
|
||||
if ( file_exists(WP_PLUGIN_DIR . "/{$item[2]}") || !empty($menu_hook) )
|
||||
if ( file_exists(ABSPATH . PLUGINDIR . "/{$item[2]}") || !empty($menu_hook) )
|
||||
echo "\n\t<li><a href='admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
|
||||
else
|
||||
echo "\n\t<li><a href='{$item[2]}'$class>{$item[0]}</a></li>";
|
||||
@@ -76,13 +74,13 @@ foreach ( $menu as $key => $item ) {
|
||||
if ( !empty($submenu[$item[2]]) ) {
|
||||
$submenu[$item[2]] = array_values($submenu[$item[2]]); // Re-index.
|
||||
$menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
|
||||
if ( file_exists(WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
|
||||
if ( file_exists(ABSPATH . PLUGINDIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
|
||||
echo "\n\t<li><a href='admin.php?page={$submenu[$item[2]][0][2]}'$class>{$item[0]}</a></li>";
|
||||
else
|
||||
echo "\n\t<li><a href='{$submenu[$item[2]][0][2]}'$class>{$item[0]}</a></li>";
|
||||
} else if ( current_user_can($item[1]) ) {
|
||||
$menu_hook = get_plugin_page_hook($item[2], 'admin.php');
|
||||
if ( file_exists(WP_PLUGIN_DIR . "/{$item[2]}") || !empty($menu_hook) )
|
||||
if ( file_exists(ABSPATH . PLUGINDIR . "/{$item[2]}") || !empty($menu_hook) )
|
||||
echo "\n\t<li><a href='admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
|
||||
else
|
||||
echo "\n\t<li><a href='{$item[2]}'$class>{$item[0]}</a></li>";
|
||||
@@ -108,13 +106,13 @@ foreach ( $menu as $key => $item ) {
|
||||
if ( !empty($submenu[$item[2]]) ) {
|
||||
$submenu[$item[2]] = array_values($submenu[$item[2]]); // Re-index.
|
||||
$menu_hook = get_plugin_page_hook($submenu[$item[2]][0][2], $item[2]);
|
||||
if ( file_exists(WP_PLUGIN_DIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
|
||||
if ( file_exists(ABSPATH . PLUGINDIR . "/{$submenu[$item[2]][0][2]}") || !empty($menu_hook))
|
||||
$side_items[] = "\n\t<li><a href='admin.php?page={$submenu[$item[2]][0][2]}'$class>{$item[0]}</a>";
|
||||
else
|
||||
$side_items[] = "\n\t<li><a href='{$submenu[$item[2]][0][2]}'$class>{$item[0]}</a>";
|
||||
} else if ( current_user_can($item[1]) ) {
|
||||
$menu_hook = get_plugin_page_hook($item[2], 'admin.php');
|
||||
if ( file_exists(WP_PLUGIN_DIR . "/{$item[2]}") || !empty($menu_hook) )
|
||||
if ( file_exists(ABSPATH . PLUGINDIR . "/{$item[2]}") || !empty($menu_hook) )
|
||||
$side_items[] = "\n\t<li><a href='admin.php?page={$item[2]}'$class>{$item[0]}</a>";
|
||||
else
|
||||
$side_items[] = "\n\t<li><a href='{$item[2]}'$class>{$item[0]}</a>";
|
||||
@@ -145,7 +143,7 @@ else $class = '';
|
||||
|
||||
$menu_hook = get_plugin_page_hook($item[2], $parent_file);
|
||||
|
||||
if (file_exists(WP_PLUGIN_DIR . "/{$item[2]}") || ! empty($menu_hook)) {
|
||||
if (file_exists(ABSPATH . PLUGINDIR . "/{$item[2]}") || ! empty($menu_hook)) {
|
||||
if ( 'admin.php' == $pagenow )
|
||||
echo "\n\t<li><a href='admin.php?page={$item[2]}'$class>{$item[0]}</a></li>";
|
||||
else
|
||||
|
||||
@@ -23,12 +23,9 @@ else
|
||||
$awaiting_mod = wp_count_comments();
|
||||
$awaiting_mod = $awaiting_mod->moderated;
|
||||
$menu[15] = array(__('Design'), 'switch_themes', 'themes.php');
|
||||
$menu[20] = array( sprintf( __('Comments %s'), "<span id='awaiting-mod' class='count-$awaiting_mod'><span class='comment-count'>" . number_format_i18n($awaiting_mod) . "</span></span>" ), 'edit_posts', 'edit-comments.php');
|
||||
$menu[20] = array( sprintf( __('Comments %s'), "<span id='awaiting-mod' class='count-$awaiting_mod'><span class='comment-count'>$awaiting_mod</span></span>" ), 'edit_posts', 'edit-comments.php');
|
||||
$menu[30] = array(__('Settings'), 'manage_options', 'options-general.php');
|
||||
|
||||
$update_plugins = get_option( 'update_plugins' );
|
||||
$update_count = count( $update_plugins->response );
|
||||
$menu[35] = array( sprintf( __('Plugins %s'), "<span id='update-plugins' class='count-$update_count'><span class='plugin-count'>" . number_format_i18n($update_count) . "</span></span>" ), 'activate_plugins', 'plugins.php');
|
||||
$menu[35] = array(__('Plugins'), 'activate_plugins', 'plugins.php');
|
||||
if ( current_user_can('edit_users') )
|
||||
$menu[40] = array(__('Users'), 'edit_users', 'users.php');
|
||||
else
|
||||
|
||||