diff options
author | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-03-09 15:17:25 +0000 |
---|---|---|
committer | donncha <donncha@7be80a69-a1ef-0310-a953-fb0f7c49ff36> | 2007-03-09 15:17:25 +0000 |
commit | 492aa4ee7086ed94cb2f37a2bce3b52905841659 (patch) | |
tree | 825b6d0ae66246bae7a65c1f610a65b59789a6b5 /wp-admin | |
parent | 359223a4711934ea6ec20e4c7613832e1f1132b5 (diff) | |
download | wordpress-mu-492aa4ee7086ed94cb2f37a2bce3b52905841659.tar.gz wordpress-mu-492aa4ee7086ed94cb2f37a2bce3b52905841659.tar.xz wordpress-mu-492aa4ee7086ed94cb2f37a2bce3b52905841659.zip |
WP Merge to rev 5007
git-svn-id: http://svn.automattic.com/wordpress-mu/trunk@909 7be80a69-a1ef-0310-a953-fb0f7c49ff36
Diffstat (limited to 'wp-admin')
-rw-r--r-- | wp-admin/admin-functions.php | 27 | ||||
-rw-r--r-- | wp-admin/admin-header.php | 2 | ||||
-rw-r--r-- | wp-admin/cat.js | 10 | ||||
-rw-r--r-- | wp-admin/custom-header.php | 6 | ||||
-rw-r--r-- | wp-admin/dbx-admin-key.js | 47 | ||||
-rw-r--r-- | wp-admin/edit-comments.php | 14 | ||||
-rw-r--r-- | wp-admin/edit-form-advanced.php | 2 | ||||
-rw-r--r-- | wp-admin/edit-link-form.php | 6 | ||||
-rw-r--r-- | wp-admin/edit.php | 8 | ||||
-rw-r--r-- | wp-admin/import/blogger.php | 4 | ||||
-rw-r--r-- | wp-admin/link-add.php | 2 | ||||
-rw-r--r-- | wp-admin/menu.php | 4 | ||||
-rw-r--r-- | wp-admin/moderation.php | 2 | ||||
-rw-r--r-- | wp-admin/options-general.php | 16 | ||||
-rw-r--r-- | wp-admin/options-misc.php | 2 | ||||
-rw-r--r-- | wp-admin/options-writing.php | 2 | ||||
-rw-r--r-- | wp-admin/options.php | 2 | ||||
-rw-r--r-- | wp-admin/page.php | 4 | ||||
-rw-r--r-- | wp-admin/plugins.php | 2 | ||||
-rw-r--r-- | wp-admin/post.php | 4 | ||||
-rw-r--r-- | wp-admin/setup-config.php | 6 | ||||
-rw-r--r-- | wp-admin/templates.php | 2 | ||||
-rw-r--r-- | wp-admin/themes.php | 10 | ||||
-rw-r--r-- | wp-admin/upgrade-functions.php | 16 | ||||
-rw-r--r-- | wp-admin/upload-functions.php | 2 | ||||
-rw-r--r-- | wp-admin/upload.js | 273 |
26 files changed, 405 insertions, 70 deletions
diff --git a/wp-admin/admin-functions.php b/wp-admin/admin-functions.php index 7e89d3b..79fe7e4 100644 --- a/wp-admin/admin-functions.php +++ b/wp-admin/admin-functions.php @@ -1156,7 +1156,7 @@ function insert_with_markers( $filename, $marker, $insertion ) { if ( $markerdata ) { $state = true; foreach ( $markerdata as $n => $markerline ) { - if ( strstr( $markerline, "# BEGIN {$marker}" )) + if (strpos($markerline, '# BEGIN ' . $marker) !== false) $state = false; if ( $state ) { if ( $n + 1 < count( $markerdata ) ) @@ -1164,7 +1164,7 @@ function insert_with_markers( $filename, $marker, $insertion ) { else fwrite( $f, "{$markerline}" ); } - if ( strstr( $markerline, "# END {$marker}" ) ) { + if (strpos($markerline, '# END ' . $marker) !== false) { fwrite( $f, "# BEGIN {$marker}\n" ); if ( is_array( $insertion )) foreach ( $insertion as $insertline ) @@ -1202,11 +1202,11 @@ function extract_from_markers( $filename, $marker ) { { $state = false; foreach ( $markerdata as $markerline ) { - if ( strstr( $markerline, "# END {$marker}" )) + if (strpos($markerline, '# END ' . $marker) !== false) $state = false; if ( $state ) $result[] = $markerline; - if ( strstr( $markerline, "# BEGIN {$marker}" )) + if (strpos($markerline, '# BEGIN ' . $marker) !== false) $state = true; } } @@ -1558,6 +1558,14 @@ function add_theme_page( $page_title, $menu_title, $access_level, $file, $functi return add_submenu_page( 'themes.php', $page_title, $menu_title, $access_level, $file, $function ); } +function add_users_page( $page_title, $menu_title, $access_level, $file, $function = '' ) { + if ( current_user_can('edit_users') ) + $parent = 'users.php'; + else + $parent = 'profile.php'; + return add_submenu_page( $parent, $page_title, $menu_title, $access_level, $file, $function ); +} + function validate_file( $file, $allowed_files = '' ) { if ( false !== strpos( $file, './' )) return 1; @@ -1771,7 +1779,8 @@ function browse_happy() { <p id="bh" style="text-align: center;"><a href="http://browsehappy.com/" title="'.$getit.'"><img src="images/browse-happy.gif" alt="Browse Happy" /></a></p> '; } -if ( strstr( $_SERVER['HTTP_USER_AGENT'], 'MSIE' )) + +if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE') !== false) add_action( 'admin_footer', 'browse_happy' ); function documentation_link( $for ) { @@ -1932,14 +1941,14 @@ function wp_import_cleanup( $id ) { function wp_import_upload_form( $action ) { $size = strtolower( ini_get( 'upload_max_filesize' ) ); $bytes = 0; - if ( strstr( $size, 'k' ) ) + if (strpos($size, 'k') !== false) $bytes = $size * 1024; - if ( strstr( $size, 'm' ) ) + if (strpos($size, 'm') !== false) $bytes = $size * 1024 * 1024; - if ( strstr( $size, 'g' ) ) + if (strpos($size, 'g') !== false) $bytes = $size * 1024 * 1024 * 1024; ?> -<form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php echo $action ?>"> +<form enctype="multipart/form-data" id="import-upload-form" method="post" action="<?php echo attribute_escape($action) ?>"> <p> <label for="upload"><?php _e( 'Choose a file from your computer:' ); ?></label> (<?php printf( __('Maximum size: %s' ), $size ); ?> ) <input type="file" id="upload" name="import" size="25" /> diff --git a/wp-admin/admin-header.php b/wp-admin/admin-header.php index 30afb3a..34f6d7d 100644 --- a/wp-admin/admin-header.php +++ b/wp-admin/admin-header.php @@ -44,7 +44,7 @@ do_action('admin_head'); </head> <body> <div id="wphead"> -<h1><?php echo wptexturize(get_option(('blogname'))); ?> <span>(<a href="<?php echo get_option('home') . '/'; ?>"><?php _e('View site »') ?></a>)</span></h1> +<h1><?php echo wptexturize(get_bloginfo(('name'))); ?> <span>(<a href="<?php echo get_option('home') . '/'; ?>"><?php _e('View site »') ?></a>)</span></h1> </div> <div id="user_info"><p><?php printf(__('Howdy, <strong>%s</strong>.'), $user_identity) ?> [<a href="<?php echo get_option('siteurl'); ?>/wp-login.php?action=logout" title="<?php _e('Log out of this account') ?>"><?php _e('Sign Out'); ?></a>, <a href="profile.php"><?php _e('My Profile'); ?></a>] </p></div> diff --git a/wp-admin/cat.js b/wp-admin/cat.js new file mode 100644 index 0000000..ab94d4c --- /dev/null +++ b/wp-admin/cat.js @@ -0,0 +1,10 @@ +addLoadEvent(function(){catList=new listMan('categorychecklist');catList.ajaxRespEl='jaxcat';catList.topAdder=1;catList.alt=0;catList.showLink=0;}); +addLoadEvent(newCatAddIn); +function newCatAddIn() { + var jaxcat = $('jaxcat'); + if ( !jaxcat ) + return false; + Element.update(jaxcat,'<span id="ajaxcat"><input type="text" name="newcat" id="newcat" size="16" autocomplete="off"/><input type="button" name="Button" id="catadd" value="' + catL10n.add + '"/><span id="howto">' + catL10n.how + '</span></span>'); + $('newcat').onkeypress = function(e) { return killSubmit("catList.ajaxAdder('category','jaxcat');", e); }; + $('catadd').onclick = function() { catList.ajaxAdder('category', 'jaxcat'); }; +} diff --git a/wp-admin/custom-header.php b/wp-admin/custom-header.php index 1b913c2..5daad1e 100644 --- a/wp-admin/custom-header.php +++ b/wp-admin/custom-header.php @@ -174,7 +174,7 @@ Event.observe( window, 'load', hide_text ); <h2><?php _e('Upload New Header Image'); ?></h2><p><?php _e('Here you can upload a custom header image to be shown at the top of your blog instead of the default one. On the next screen you will be able to crop the image.'); ?></p> <p><?php printf(__('Images of exactly <strong>%1$d x %2$d pixels</strong> will be used as-is.'), HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT); ?></p> -<form enctype="multipart/form-data" id="uploadForm" method="POST" action="<?php echo add_query_arg('step', 2) ?>" style="margin: auto; width: 50%;"> +<form enctype="multipart/form-data" id="uploadForm" method="POST" action="<?php echo attribute_escape(add_query_arg('step', 2)) ?>" style="margin: auto; width: 50%;"> <label for="upload"><?php _e('Choose an image from your computer:'); ?></label><br /><input type="file" id="upload" name="import" /> <input type="hidden" name="action" value="save" /> <p class="submit"> @@ -188,7 +188,7 @@ Event.observe( window, 'load', hide_text ); <div class="wrap"> <h2><?php _e('Reset Header Image and Color'); ?></h2> <p><?php _e('This will restore the original header image and color. You will not be able to retrieve any customizations.') ?></p> -<form method="post" action="<?php echo add_query_arg('step', 1) ?>"> +<form method="post" action="<?php echo attribute_escape(add_query_arg('step', 1)) ?>"> <input type="submit" name="resetheader" value="<?php _e('Restore Original Header'); ?>" /> </form> </div> @@ -240,7 +240,7 @@ Event.observe( window, 'load', hide_text ); <div class="wrap"> -<form method="POST" action="<?php echo add_query_arg('step', 3) ?>"> +<form method="POST" action="<?php echo attribute_escape(add_query_arg('step', 3)) ?>"> <p><?php _e('Choose the part of the image you want to use as your header.'); ?></p> <div id="testWrap"> diff --git a/wp-admin/dbx-admin-key.js b/wp-admin/dbx-admin-key.js new file mode 100644 index 0000000..9ea666c --- /dev/null +++ b/wp-admin/dbx-admin-key.js @@ -0,0 +1,47 @@ +addLoadEvent( function() {var manager = new dbxManager( dbxL10n.mananger );} ); + +addLoadEvent( function() +{ + //create new docking boxes group + var meta = new dbxGroup( + 'grabit', // container ID [/-_a-zA-Z0-9/] + 'vertical', // orientation ['vertical'|'horizontal'] + '10', // drag threshold ['n' pixels] + 'no', // restrict drag movement to container axis ['yes'|'no'] + '10', // animate re-ordering [frames per transition, or '0' for no effect] + 'yes', // include open/close toggle buttons ['yes'|'no'] + 'closed', // default state ['open'|'closed'] + dbxL10n.open, // word for "open", as in "open this box" + dbxL10n.close, // word for "close", as in "close this box" + dbxL10n.moveMouse, // sentence for "move this box" by mouse + dbxL10n.toggleMouse, // pattern-match sentence for "(open|close) this box" by mouse + dbxL10n.moveKey, // sentence for "move this box" by keyboard + dbxL10n.toggleKey, // pattern-match sentence-fragment for "(open|close) this box" by keyboard + '%mytitle% [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts + ); + + // Boxes are closed by default. Open the Category box if the cookie isn't already set. + var catdiv = document.getElementById('categorydiv'); + if ( catdiv ) { + var button = catdiv.getElementsByTagName('A')[0]; + if ( dbx.cookiestate == null && /dbx\-toggle\-closed/.test(button.className) ) + meta.toggleBoxState(button, true); + } + + var advanced = new dbxGroup( + 'advancedstuff', + 'vertical', + '10', + 'yes', // restrict drag movement to container axis ['yes'|'no'] + '10', + 'yes', + 'closed', + dbxL10n.open, + dbxL10n.close, + dbxL10n.moveMouse, + dbxL10n.toggleMouse, + dbxL10n.moveKey, + dbxL10n.toggleKey, + '%mytitle% [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts + ); +}); diff --git a/wp-admin/edit-comments.php b/wp-admin/edit-comments.php index 5d1d8f5..4ba2479 100644 --- a/wp-admin/edit-comments.php +++ b/wp-admin/edit-comments.php @@ -101,7 +101,7 @@ $total_pages = ceil( $total / 20 ); $r = ''; if ( 1 < $page ) { $args['apage'] = ( 1 == $page - 1 ) ? FALSE : $page - 1; - $r .= '<a class="prev" href="' . add_query_arg( $args ) . '">« '. __('Previous Page') .'</a>' . "\n"; + $r .= '<a class="prev" href="' . attribute_escape(add_query_arg( $args )) . '">« '. __('Previous Page') .'</a>' . "\n"; } if ( ( $total_pages = ceil( $total / 20 ) ) > 1 ) { for ( $page_num = 1; $page_num <= $total_pages; $page_num++ ) : @@ -111,7 +111,7 @@ if ( ( $total_pages = ceil( $total / 20 ) ) > 1 ) { $p = false; if ( $page_num < 3 || ( $page_num >= $page - 3 && $page_num <= $page + 3 ) || $page_num > $total_pages - 3 ) : $args['apage'] = ( 1 == $page_num ) ? FALSE : $page_num; - $r .= '<a class="page-numbers" href="' . add_query_arg($args) . '">' . ( $page_num ) . "</a>\n"; + $r .= '<a class="page-numbers" href="' . attribute_escape(add_query_arg($args)) . '">' . ( $page_num ) . "</a>\n"; $in = true; elseif ( $in == true ) : $r .= "...\n"; @@ -122,7 +122,7 @@ if ( ( $total_pages = ceil( $total / 20 ) ) > 1 ) { } if ( ( $page ) * 20 < $total || -1 == $total ) { $args['apage'] = $page + 1; - $r .= '<a class="next" href="' . add_query_arg($args) . '">'. __('Next Page') .' »</a>' . "\n"; + $r .= '<a class="next" href="' . attribute_escape(add_query_arg($args)) . '">'. __('Next Page') .' »</a>' . "\n"; } echo "<p class='pagenav'>$r</p>"; ?> @@ -153,7 +153,7 @@ $start = " start='$offset'"; <?php comment_text() ?> -<p><?php comment_date('M j, g:i A'); ?> — [ +<p><?php comment_date(__('M j, g:i A')); ?> — [ <?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) { echo " <a href='comment.php?action=editcomment&c=".$comment->comment_ID."'>" . __('Edit') . '</a>'; @@ -248,7 +248,7 @@ $total_pages = ceil( $total / 20 ); $r = ''; if ( 1 < $page ) { $args['apage'] = ( 1 == $page - 1 ) ? FALSE : $page - 1; - $r .= '<a class="prev" href="' . add_query_arg( $args ) . '">« '. __('Previous Page') .'</a>' . "\n"; + $r .= '<a class="prev" href="' . attribute_escape(add_query_arg( $args )) . '">« '. __('Previous Page') .'</a>' . "\n"; } if ( ( $total_pages = ceil( $total / 20 ) ) > 1 ) { for ( $page_num = 1; $page_num <= $total_pages; $page_num++ ) : @@ -258,7 +258,7 @@ if ( ( $total_pages = ceil( $total / 20 ) ) > 1 ) { $p = false; if ( $page_num < 3 || ( $page_num >= $page - 3 && $page_num <= $page + 3 ) || $page_num > $total_pages - 3 ) : $args['apage'] = ( 1 == $page_num ) ? FALSE : $page_num; - $r .= '<a class="page-numbers" href="' . add_query_arg($args) . '">' . ( $page_num ) . "</a>\n"; + $r .= '<a class="page-numbers" href="' . attribute_escape(add_query_arg($args)) . '">' . ( $page_num ) . "</a>\n"; $in = true; elseif ( $in == true ) : $r .= "...\n"; @@ -269,7 +269,7 @@ if ( ( $total_pages = ceil( $total / 20 ) ) > 1 ) { } if ( ( $page ) * 20 < $total || -1 == $total ) { $args['apage'] = $page + 1; - $r .= '<a class="next" href="' . add_query_arg($args) . '">'. __('Next Page') .' »</a>' . "\n"; + $r .= '<a class="next" href="' . attribute_escape(add_query_arg($args)) . '">'. __('Next Page') .' »</a>' . "\n"; } echo "<p class='pagenav'>$r</p>"; ?> diff --git a/wp-admin/edit-form-advanced.php b/wp-admin/edit-form-advanced.php index 1426ece..520bfbd 100644 --- a/wp-admin/edit-form-advanced.php +++ b/wp-admin/edit-form-advanced.php @@ -244,7 +244,7 @@ list_meta($metadata); </div> <?php if ('edit' == $action) : $delete_nonce = wp_create_nonce( 'delete-post_' . $post_ID ); ?> -<input name="deletepost" class="button delete" type="submit" id="deletepost" tabindex="10" value="<?php _e('Delete this post') ?>" <?php echo "onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this post '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { document.forms.post._wpnonce.value = '$delete_nonce'; return true;}return false;\""; ?> /> +<input name="deletepost" class="button delete" type="submit" id="deletepost" tabindex="10" value="<?php echo ( 'draft' == $post->post_status ) ? __('Delete this draft') : __('Delete this post'); ?>" <?php echo "onclick=\"if ( confirm('" . js_escape(sprintf( ('draft' == $post->post_status) ? __("You are about to delete this draft '%s'\n 'Cancel' to stop, 'OK' to delete.") : __("You are about to delete this post '%s'\n 'Cancel' to stop, 'OK' to delete."), $post->post_title )) . "') ) { document.forms.post._wpnonce.value = '$delete_nonce'; return true;}return false;\""; ?> /> <?php endif; ?> </div> diff --git a/wp-admin/edit-link-form.php b/wp-admin/edit-link-form.php index 3935584..41381d9 100644 --- a/wp-admin/edit-link-form.php +++ b/wp-admin/edit-link-form.php @@ -22,9 +22,9 @@ function xfn_check($class, $value = '', $type = 'check') { }
if ('' == $value) {
- if ('family' == $class && !strstr($link_rel, 'child') && !strstr($link_rel, 'parent') && !strstr($link_rel, 'sibling') && !strstr($link_rel, 'spouse') && !strstr($link_rel, 'kin')) echo ' checked="checked"';
- if ('friendship' == $class && !strstr($link_rel, 'friend') && !strstr($link_rel, 'acquaintance') && !strstr($link_rel, 'contact') ) echo ' checked="checked"';
- if ('geographical' == $class && !strstr($link_rel, 'co-resident') && !strstr($link_rel, 'neighbor') ) echo ' checked="checked"';
+ if ('family' == $class && strpos($link_rel, 'child') === false && strpos($link_rel, 'parent') === false && strpos($link_rel, 'sibling') === false && strpos($link_rel, 'spouse') === false && strpos($link_rel, 'kin') === false) echo ' checked="checked"';
+ if ('friendship' == $class && strpos($link_rel, 'friend') === false && strpos($link_rel, 'acquaintance') === false && strpos($link_rel, 'contact') === false) echo ' checked="checked"';
+ if ('geographical' == $class && strpos($link_rel, 'co-resident') === false && strpos($link_rel, 'neighbor') === false) echo ' checked="checked"';
if ('identity' == $class && in_array('me', $rels) ) echo ' checked="checked"';
}
}
diff --git a/wp-admin/edit.php b/wp-admin/edit.php index 6b47fe4..44a3ddb 100644 --- a/wp-admin/edit.php +++ b/wp-admin/edit.php @@ -21,14 +21,14 @@ if ($drafts || $other_drafts) { foreach ($drafts as $draft) { if (0 != $i) echo ', '; - $draft->post_title = stripslashes($draft->post_title); + $draft->post_title = apply_filters('the_title', stripslashes($draft->post_title)); if ($draft->post_title == '') $draft->post_title = sprintf(__('Post #%s'), $draft->ID); echo "<a href='post.php?action=edit&post=$draft->ID' title='" . __('Edit this draft') . "'>$draft->post_title</a>"; ++$i; } ?> - .</p> +.</p> <?php } ?> <?php if ($other_drafts) { ?> @@ -38,7 +38,7 @@ if ($drafts || $other_drafts) { foreach ($other_drafts as $draft) { if (0 != $i) echo ', '; - $draft->post_title = stripslashes($draft->post_title); + $draft->post_title = apply_filters('the_title', stripslashes($draft->post_title)); if ($draft->post_title == '') $draft->post_title = sprintf(__('Post #%s'), $draft->ID); echo "<a href='post.php?action=edit&post=$draft->ID' title='" . __('Edit this draft') . "'>$draft->post_title</a>"; @@ -177,7 +177,7 @@ foreach($posts_columns as $column_name=>$column_display_name) { case 'date': ?> - <td><?php if ( '0000-00-00 00:00:00' ==$post->post_modified ) _e('Unpublished'); else the_time(_('Y-m-d \<\b\r \/\> g:i:s a')); ?></td> + <td><?php if ( '0000-00-00 00:00:00' ==$post->post_modified ) _e('Unpublished'); else the_time(__('Y-m-d \<\b\r \/\> g:i:s a')); ?></td> <?php break; case 'title': diff --git a/wp-admin/import/blogger.php b/wp-admin/import/blogger.php index 2908bbc..1890c16 100644 --- a/wp-admin/import/blogger.php +++ b/wp-admin/import/blogger.php @@ -941,7 +941,7 @@ class AtomParser { $this->in_content = array();
} else {
$endtag = $this->ns_to_prefix($name);
- if(strstr($this->in_content[count($this->in_content)-1], "<$endtag")) {
+ if (strpos($this->in_content[count($this->in_content)-1], '<' . $endtag) !== false) {
array_push($this->in_content, "/>");
} else {
array_push($this->in_content, "</$endtag>");
@@ -969,7 +969,7 @@ class AtomParser { #print str_repeat(" ", $this->depth * $this->indent) . "data: #" . $data . "#\n";
if(!empty($this->in_content)) {
// handle self-closing tags (case: text node found, need to close element started)
- if(strstr($this->in_content[count($this->in_content)-1], "<")) {
+ if (strpos($this->in_content[count($this->in_content)-1], '<') !== false) {
array_push($this->in_content, ">");
}
array_push($this->in_content, $this->xml_escape($data));
diff --git a/wp-admin/link-add.php b/wp-admin/link-add.php index fca6c3e..1e48fe8 100644 --- a/wp-admin/link-add.php +++ b/wp-admin/link-add.php @@ -28,7 +28,7 @@ require('admin-header.php'); <div id="wp-link-bookmarklet" class="wrap"> <h3><?php _e('Add Link Bookmarklet'); ?></h3> -<p><?php _e('Right click on the following link and choose "Bookmark This Link..." to create an add link shortcut. Right now this only works on Mozilla or Netscape, but we’re working on it.'); ?></p> +<p><?php _e('Right click on the following link and choose “Bookmark This Link...” or “Add to Favorites...” to create a Link This shortcut.'); ?></p> <?php printf('<p><a href="%s" title="'.__('Link add bookmarklet').'">'.__('Link This').'</a></p>', "javascript:void(linkmanpopup=window.open('" . get_option('siteurl') . "/wp-admin/link-add.php?action=popup&linkurl='+escape(location.href)+'&name='+escape(document.title),'LinkManager','scrollbars=yes,width=750,height=550,left=15,top=15,status=yes,resizable=yes'));linkmanpopup.focus();window.focus();linkmanpopup.focus();") ?> </div> diff --git a/wp-admin/menu.php b/wp-admin/menu.php index 8c67b4a..37e9714 100644 --- a/wp-admin/menu.php +++ b/wp-admin/menu.php @@ -6,11 +6,11 @@ // The URL of the item's file $menu[0] = array(__('Dashboard'), 'read', 'index.php'); -if ( strstr($_SERVER['REQUEST_URI'], 'edit-pages.php') ) +if (strpos($_SERVER['REQUEST_URI'], 'edit-pages.php') !== false) $menu[5] = array(__('Write'), 'edit_pages', 'page-new.php'); else $menu[5] = array(__('Write'), 'edit_posts', 'post-new.php'); -if ( strstr($_SERVER['REQUEST_URI'], 'page-new.php') ) +if (strpos($_SERVER['REQUEST_URI'], 'page-new.php') !== false) $menu[10] = array(__('Manage'), 'edit_pages', 'edit-pages.php'); else $menu[10] = array(__('Manage'), 'edit_posts', 'edit.php'); diff --git a/wp-admin/moderation.php b/wp-admin/moderation.php index e6d735b..e24a9a1 100644 --- a/wp-admin/moderation.php +++ b/wp-admin/moderation.php @@ -121,7 +121,7 @@ $i = 0; ?> <p><strong><?php comment_author() ?></strong> <?php if ($comment->comment_author_email) { ?>| <?php comment_author_email_link() ?> <?php } if ($comment->comment_author_url && 'http://' != $comment->comment_author_url) { ?> | <?php comment_author_url_link() ?> <?php } ?>| <?php _e('IP:') ?> <a href="http://ws.arin.net/cgi-bin/whois.pl?queryinput=<?php comment_author_IP() ?>"><?php comment_author_IP() ?></a></p> <?php comment_text() ?> -<p><?php comment_date('M j, g:i A'); ?> — [ <?php +<p><?php comment_date(__('M j, g:i A')); ?> — [ <?php echo '<a href="comment.php?action=editcomment&c='.$comment->comment_ID.'">' . __('Edit') . '</a> | '; echo " <a href=\"post.php?action=deletecomment&p=".$comment->comment_post_ID."&comment=".$comment->comment_ID."\" onclick=\"return deleteSomething( 'comment', $comment->comment_ID, '" . js_escape(sprintf(__("You are about to delete this comment by '%s'.\n'Cancel' to stop, 'OK' to delete."), $comment->comment_author )) . "', theCommentList );\">" . __('Delete') . "</a> | "; ?> <?php diff --git a/wp-admin/options-general.php b/wp-admin/options-general.php index 8a8fe3b..2142f73 100644 --- a/wp-admin/options-general.php +++ b/wp-admin/options-general.php @@ -42,18 +42,14 @@ include('./admin-header.php'); <?php $lang_files = glob( ABSPATH . WPINC . "/languages/*" ); $lang = get_option( "WPLANG" ); -if( $lang == false ) { - $lang = get_site_option( "WPLANG" ); - add_option( "WPLANG", $lang ); -} -if( is_array( $lang_files ) && count($lang_files) => 1 ) { +if( is_array( $lang_files ) && count($lang_files) >= 1 ) { ?> - <tr valign="top"> - <th width="33%" scope="row"><?php _e('Language:') ?></th> - <td><select name="WPLANG" id="WPLANG"> - <?php - echo "<option value=''>Default</option>"; + <tr valign="top"> + <th width="33%" scope="row"><?php _e('Language:') ?></th> + <td><select name="WPLANG" id="WPLANG"> + <?php + echo "<option value=''>Default</option>"; while( list( $key, $val ) = each( $lang_files ) ) { $l = basename( $val, ".mo" ); echo "<option value='$l'"; diff --git a/wp-admin/options-misc.php b/wp-admin/options-misc.php index 4b6a875..f12d91f 100644 --- a/wp-admin/options-misc.php +++ b/wp-admin/options-misc.php @@ -37,7 +37,7 @@ include('admin-header.php'); </fieldset> <p><input name="use_linksupdate" type="checkbox" id="use_linksupdate" value="1" <?php checked('1', get_option('use_linksupdate')); ?> /> -<label for="use_linksupdate"><?php _e('Track Bookmarks’ Update Times') ?></label></p> +<label for="use_linksupdate"><?php _e('Track Links’ Update Times') ?></label></p> <p> <label><input type="checkbox" name="hack_file" value="1" <?php checked('1', get_option('hack_file')); ?> /> <?php _e('Use legacy <code>my-hacks.php</code> file support') ?></label> </p> diff --git a/wp-admin/options-writing.php b/wp-admin/options-writing.php index 59e1c49..1f70b74 100644 --- a/wp-admin/options-writing.php +++ b/wp-admin/options-writing.php @@ -41,7 +41,7 @@ endforeach; </select></td> </tr> <tr valign="top"> -<th scope="row"><?php _e('Default bookmark category:') ?></th> +<th scope="row"><?php _e('Default link category:') ?></th> <td><select name="default_link_category" id="default_link_category"> <?php foreach ($categories as $category) : diff --git a/wp-admin/options.php b/wp-admin/options.php index 8dbd161..db3c88e 100644 --- a/wp-admin/options.php +++ b/wp-admin/options.php @@ -167,7 +167,7 @@ foreach ( (array) $options as $option) : <th scope='row'><label for='$option->option_name'>$option->option_name</label></th> <td>"; - if (stristr($value, "\n")) echo "<textarea class='$class' name='$option->option_name' id='$option->option_name' cols='30' rows='5'>$value</textarea>"; + if (strpos($value, "\n") !== false) echo "<textarea class='$class' name='$option->option_name' id='$option->option_name' cols='30' rows='5'>$value</textarea>"; else echo "<input class='$class' type='text' name='$option->option_name' id='$option->option_name' size='30' value='" . $value . "'$disabled />"; echo "</td> diff --git a/wp-admin/page.php b/wp-admin/page.php index d5bb932..4a29c37 100644 --- a/wp-admin/page.php +++ b/wp-admin/page.php @@ -149,8 +149,8 @@ case 'delete': } $sendback = wp_get_referer(); - if (strstr($sendback, 'page.php')) $sendback = get_option('siteurl') .'/wp-admin/page.php'; - elseif (strstr($sendback, 'attachments.php')) $sendback = get_option('siteurl') .'/wp-admin/attachments.php'; + if (strpos($sendback, 'page.php') !== false) $sendback = get_option('siteurl') .'/wp-admin/page.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); exit(); diff --git a/wp-admin/plugins.php b/wp-admin/plugins.php index bd80c2e..b2d9be3 100644 --- a/wp-admin/plugins.php +++ b/wp-admin/plugins.php @@ -123,7 +123,7 @@ if (empty($plugins)) { if ( $style != '' ) $style = 'class="' . $style . '"'; - if ( is_writable(ABSPATH . 'wp-content/plugins/' . $plugin_file) ) + if ( is_writable(ABSPATH . PLUGINDIR . '/' . $plugin_file) ) $edit = "<a href='plugin-editor.php?file=$plugin_file' title='".__('Open this file in the Plugin Editor')."' class='edit'>".__('Edit')."</a>"; else $edit = ''; diff --git a/wp-admin/post.php b/wp-admin/post.php index 163e220..b191661 100644 --- a/wp-admin/post.php +++ b/wp-admin/post.php @@ -160,8 +160,8 @@ case 'delete': } $sendback = wp_get_referer(); - if (strstr($sendback, 'post.php')) $sendback = get_option('siteurl') .'/wp-admin/post-new.php'; - elseif (strstr($sendback, 'attachments.php')) $sendback = get_option('siteurl') .'/wp-admin/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); exit(); diff --git a/wp-admin/setup-config.php b/wp-admin/setup-config.php index 17846d6..41e9787 100644 --- a/wp-admin/setup-config.php +++ b/wp-admin/setup-config.php @@ -158,13 +158,13 @@ switch($step) { foreach ($configFile as $line_num => $line) { switch (substr($line,0,16)) { case "define('DB_NAME'": - fwrite($handle, str_replace("wordpress", $dbname, $line)); + fwrite($handle, str_replace("putyourdbnamehere", $dbname, $line)); break; case "define('DB_USER'": - fwrite($handle, str_replace("'username'", "'$uname'", $line)); + fwrite($handle, str_replace("'usernamehere'", "'$uname'", $line)); break; case "define('DB_PASSW": - fwrite($handle, str_replace("'password'", "'$passwrd'", $line)); + fwrite($handle, str_replace("'yourpasswordhere'", "'$passwrd'", $line)); break; case "define('DB_HOST'": fwrite($handle, str_replace("localhost", $dbhost, $line)); diff --git a/wp-admin/templates.php b/wp-admin/templates.php index 7453992..7f9063f 100644 --- a/wp-admin/templates.php +++ b/wp-admin/templates.php @@ -53,7 +53,7 @@ default: if ( ! current_user_can('edit_files') ) wp_die('<p>'.__('You do not have sufficient permissions to edit templates for this blog.').'</p>'); - if ( strstr( $file, 'wp-config.php' ) ) + if (strpos($file, 'wp-config.php') !== false) wp_die('<p>'.__('The config file cannot be edited or viewed through the web interface. Sorry!').'</p>'); update_recently_edited($file); diff --git a/wp-admin/themes.php b/wp-admin/themes.php index ee244db..af7791f 100644 --- a/wp-admin/themes.php +++ b/wp-admin/themes.php @@ -61,7 +61,7 @@ require_once('admin-header.php'); <?php if ( ! validate_current_theme() ) : ?> <div id="message1" class="updated fade"><p><?php _e('The active theme is broken. Reverting to the default theme.'); ?></p></div> <?php elseif ( isset($_GET['activated']) ) : ?> -<div id="message2" class="updated fade"><p><?php printf(__('New theme activated. <a href="%s">View site »</a>'), get_bloginfo('home') . '/'); ?></p></div> +<div id="message2" class="updated fade"><p><?php printf(__('New theme activated. <a href="%s">View site »</a>'), get_bloginfo('url') . '/'); ?></p></div> <?php endif; ?> @@ -69,9 +69,9 @@ require_once('admin-header.php'); <h2><?php _e('Current Theme'); ?></h2> <div id="currenttheme"> <?php if ( $ct->screenshot ) : ?> -<img src="../<?php echo $ct->stylesheet_dir . '/' . $ct->screenshot; ?>" alt="<?php _e('Current theme preview'); ?>" /> +<img src="<?php echo get_option('siteurl') . '/' . $ct->stylesheet_dir . '/' . $ct->screenshot; ?>" alt="<?php _e('Current theme preview'); ?>" /> <?php endif; ?> -<h3><?php printf(__('%1$s %2$s by %3$s'), $ct->title, '', $ct->author) ; ?></h3> +<h3><?php printf(__('%1$s %2$s by %3$s'), $ct->title, $ct->version, $ct->author) ; ?></h3> <p><?php echo $ct->description; ?></p> </div> @@ -98,11 +98,11 @@ foreach ($theme_names as $theme_name) { $activate_link = wp_nonce_url("themes.php?action=activate&template=$template&stylesheet=$stylesheet", 'switch-theme_' . $template); ?> <div class="available-theme"> -<h3><a href="<?php echo $activate_link; ?>"><?php echo "$title"; ?></a></h3> +<h3><a href="<?php echo $activate_link; ?>"><?php echo "$title $version"; ?></a></h3> <a href="<?php echo $activate_link; ?>" class="screenshot"> <?php if ( $screenshot ) : ?> -<img src="../<?php echo $stylesheet_dir . '/' . $screenshot; ?>" alt="" /> +<img src="<?php echo get_option('siteurl') . '/' . $stylesheet_dir . '/' . $screenshot; ?>" alt="" /> <?php endif; ?> </a> diff --git a/wp-admin/upgrade-functions.php b/wp-admin/upgrade-functions.php index e0c347c..b7a1f93 100644 --- a/wp-admin/upgrade-functions.php +++ b/wp-admin/upgrade-functions.php @@ -451,7 +451,7 @@ function upgrade_160() { if ( 0 == $wpdb->get_var("SELECT SUM(category_count) FROM $wpdb->categories") ) { // Create counts $categories = $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories"); foreach ( $categories as $cat_id ) { - $count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->post2cat, $wpdb->posts WHERE $wpdb->posts.ID=$wpdb->post2cat.post_id AND post_type='post' AND post_status='publish' AND category_id = '$cat_id'"); + $count = $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->post2cat, $wpdb->posts WHERE $wpdb->posts.ID=$wpdb->post2cat.post_id AND post_status='publish' AND category_id = '$cat_id'"); $wpdb->query("UPDATE $wpdb->categories SET category_count = '$count' WHERE cat_ID = '$cat_id'"); } } @@ -931,7 +931,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 ( strstr( $index, 'WP_USE_THEMES' ) ) { + if (strpos($index, 'WP_USE_THEMES') !== false) { if (! @copy(ABSPATH . 'wp-content/themes/default/index.php', "$site_dir/$newfile")) return false; continue; // Don't copy anything @@ -1003,12 +1003,12 @@ function make_site_theme_from_default($theme_name, $template) { $f = fopen("$site_dir/style.css", 'w'); foreach ($stylelines as $line) { - if (strstr($line, "Theme Name:")) $line = "Theme Name: $theme_name"; - elseif (strstr($line, "Theme URI:")) $line = "Theme URI: " . __get_option('siteurl'); - elseif (strstr($line, "Description:")) $line = "Description: Your theme"; - elseif (strstr($line, "Version:")) $line = "Version: 1"; - elseif (strstr($line, "Author:")) $line = "Author: You"; - fwrite($f, "{$line}\n"); + if (strpos($line, 'Theme Name:') !== false) $line = 'Theme Name: ' . $theme_name; + elseif (strpos($line, 'Theme URI:') !== false) $line = 'Theme URI: ' . __get_option('url'); + elseif (strpos($line, 'Description:') !== false) $line = 'Description: Your theme.'; + elseif (strpos($line, 'Version:') !== false) $line = 'Version: 1'; + elseif (strpos($line, 'Author:') !== false) $line = 'Author: You'; + fwrite($f, $line . "\n"); } fclose($f); } diff --git a/wp-admin/upload-functions.php b/wp-admin/upload-functions.php index c2b5519..1f79fb7 100644 --- a/wp-admin/upload-functions.php +++ b/wp-admin/upload-functions.php @@ -18,7 +18,7 @@ function wp_upload_display( $dims = false, $href = '' ) { the_title(); $post_title = attribute_escape(ob_get_contents()); ob_end_clean(); - $post_content = apply_filters( 'content_edit_pre', $post->post_content ); + $post_content = attribute_escape(apply_filters( 'content_edit_pre', $post->post_content )); $class = 'text'; $innerHTML = get_attachment_innerHTML( $id, false, $dims ); diff --git a/wp-admin/upload.js b/wp-admin/upload.js new file mode 100644 index 0000000..a77e9d1 --- /dev/null +++ b/wp-admin/upload.js @@ -0,0 +1,273 @@ +addLoadEvent( function() { + theFileList = { + currentImage: {ID: 0}, + nonce: '', + tab: '', + postID: 0, + + initializeVars: function() { + this.urlData = document.location.href.split('?'); + this.params = this.urlData[1].toQueryParams(); + this.postID = this.params['post_id']; + this.tab = this.params['tab']; + this.style = this.params['style']; + this.ID = this.params['ID']; + if ( !this.style ) + this.style = 'default'; + var nonceEl = $('nonce-value'); + if ( nonceEl ) + this.nonce = nonceEl.value; + if ( this.ID ) { + this.grabImageData( this.ID ); + this.imageView( this.ID ); + } + }, + + initializeLinks: function() { + if ( this.ID ) + return; + $$('a.file-link').each( function(i) { + var id = i.id.split('-').pop(); + i.onclick = function(e) { theFileList[ 'inline' == theFileList.style ? 'imageView' : 'editView' ](id, e); } + } ); + }, + + grabImageData: function(id) { + if ( id == this.currentImage.ID ) + return; + var thumbEl = $('attachment-thumb-url-' + id); + if ( thumbEl ) { + this.currentImage.thumb = ( 0 == id ? '' : thumbEl.value ); + this.currentImage.thumbBase = ( 0 == id ? '' : $('attachment-thumb-url-base-' + id).value ); + } else { + this.currentImage.thumb = false; + } + this.currentImage.src = ( 0 == id ? '' : $('attachment-url-' + id).value ); + this.currentImage.srcBase = ( 0 == id ? '' : $('attachment-url-base-' + id).value ); + this.currentImage.page = ( 0 == id ? '' : $('attachment-page-url-' + id).value ); + this.currentImage.title = ( 0 == id ? '' : $('attachment-title-' + id).value ); + this.currentImage.description = ( 0 == id ? '' : $('attachment-description-' + id).value ); + var widthEl = $('attachment-width-' + id); + if ( widthEl ) { + this.currentImage.width = ( 0 == id ? '' : widthEl.value ); + this.currentImage.height = ( 0 == id ? '' : $('attachment-height-' + id).value ); + } else { + this.currentImage.width = false; + this.currentImage.height = false; + } + this.currentImage.isImage = ( 0 == id ? 0 : $('attachment-is-image-' + id).value ); + this.currentImage.ID = id; + }, + + imageView: function(id, e) { + this.prepView(id); + var h = ''; + + h += "<div id='upload-file'>" + if ( this.ID ) { + var params = $H(this.params); + params.ID = ''; + params.action = ''; + h += "<a href='" + this.urlData[0] + '?' + params.toQueryString() + "'"; + } else { + h += "<a href='#' onclick='return theFileList.cancelView();'"; + } + h += " title='" + this.browseTitle + "' class='back'>" + this.back + "</a>"; + h += "<div id='file-title'>" + if ( 0 == this.currentImage.isImage ) + h += "<h2><a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='" + this.directTitle + "'>" + this.currentImage.title + "</a></h2>"; + else + h += "<h2>" + this.currentImage.title + "</h2>"; + h += " — <span>"; + h += "<a href='#' onclick='return theFileList.editView(" + id + ");'>" + this.edit + "</a>" + h += "</span>"; + h += '</div>' + h += "<div id='upload-file-view' class='alignleft'>"; + if ( 1 == this.currentImage.isImage ) { + h += "<a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='" + this.directTitle + "'>"; + h += "<img src='" + ( this.currentImage.thumb ? this.currentImage.thumb : this.currentImage.src ) + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' />"; + h += "</a>"; + } else + h += ' '; + h += "</div>"; + + h += "<form name='uploadoptions' id='uploadoptions' class='alignleft'>"; + h += "<table>"; + var display = []; + var checked = 'display-title'; + if ( 1 == this.currentImage.isImage ) { + checked = 'display-full'; + if ( this.currentImage.thumb ) { + display.push("<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' /> " + this.thumb + "</label><br />"); + checked = 'display-thumb'; + } + display.push("<label for='display-full'><input type='radio' name='display' id='display-full' value='full' /> " + this.full + "</label>"); + } else if ( this.currentImage.thumb ) { + display.push("<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' /> " + this.icon + "</label>"); + } + if ( display.length ) { + display.push("<br /><label for='display-title'><input type='radio' name='display' id='display-title' value='title' /> " + this.title + "</label>"); + h += "<tr><th style='padding-bottom:.5em'>" + this.show + "</th><td style='padding-bottom:.5em'>"; + $A(display).each( function(i) { h += i; } ); + h += "</td></tr>"; + } + + h += "<tr><th>" + this.link + "</th><td>"; + h += "<label for='link-file'><input type='radio' name='link' id='link-file' value='file' checked='checked'/> " + this.file + "</label><br />"; + h += "<label for='link-page'><input type='radio' name='link' id='link-page' value='page' /> " + this.page + "</label><br />"; + h += "<label for='link-none'><input type='radio' name='link' id='link-none' value='none' /> " + this.none + "</label>"; + h += "</td></tr>"; + + h += "<tr><td colspan='2'><p class='submit'>"; + h += "<input type='button' class='button' name='send' onclick='theFileList.sendToEditor(" + id + ")' value='" + this.editorText + "' />"; + h += "</p></td></tr></table>"; + h += "</form>"; + + h += "</div>"; + + new Insertion.Top('upload-content', h); + var displayEl = $(checked); + if ( displayEl ) + displayEl.checked = true; + + if (e) Event.stop(e); + return false; + }, + + editView: function(id, e) { + this.prepView(id); + var h = ''; + + var action = 'upload.php?style=' + this.style + '&tab=upload'; + if ( this.postID ) + action += '&post_id=' + this.postID; + + h += "<form id='upload-file' method='post' action='" + action + "'>"; + if ( this.ID ) { + var params = $H(this.params); + params.ID = ''; + params.action = ''; + h += "<a href='" + this.urlData[0] + '?' + params.toQueryString() + "'"; + } else { + h += "<a href='#' onclick='return theFileList.cancelView();'"; + } + h += " title='" + this.browseTitle + "' class='back'>" + this.back + "</a>"; + h += "<div id='file-title'>" + if ( 0 == this.currentImage.isImage ) + h += "<h2><a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='" + this.directTitle + "'>" + this.currentImage.title + "</a></h2>"; + else + h += "<h2>" + this.currentImage.title + "</h2>"; + h += " — <span>"; + h += "<a href='#' onclick='return theFileList.imageView(" + id + ");'>" + this.insert + "</a>"; + h += "</span>"; + h += '</div>' + h += "<div id='upload-file-view' class='alignleft'>"; + if ( 1 == this.currentImage.isImage ) { + h += "<a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='" + this.directTitle + "'>"; + h += "<img src='" + ( this.currentImage.thumb ? this.currentImage.thumb : this.currentImage.src ) + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' />"; + h += "</a>"; + } else + h += ' '; + h += "</div>"; + + + h += "<table><col /><col class='widefat' /><tr>"; + h += "<th scope='row'><label for='url'>" + this.urlText + "</label></th>"; + h += "<td><input type='text' id='url' class='readonly' value='" + this.currentImage.srcBase + this.currentImage.src + "' readonly='readonly' /></td>"; + h += "</tr><tr>"; + h += "<th scope='row'><label for='post_title'>" + this.title + "</label></th>"; + h += "<td><input type='text' id='post_title' name='post_title' value='" + this.currentImage.title + "' /></td>"; + h += "</tr><tr>"; + h += "<th scope='row'><label for='post_content'>" + this.desc + "</label></th>"; + h += "<td><textarea name='post_content' id='post_content'>" + this.currentImage.description + "</textarea></td>"; + h += "</tr><tr id='buttons' class='submit'><td colspan='2'><input type='button' id='delete' name='delete' class='delete alignleft' value='" + this.deleteText + "' onclick='theFileList.deleteFile(" + id + ");' />"; + h += "<input type='hidden' name='from_tab' value='" + this.tab + "' />"; + h += "<input type='hidden' name='action' id='action-value' value='save' />"; + h += "<input type='hidden' name='ID' value='" + id + "' />"; + h += "<input type='hidden' name='_wpnonce' value='" + this.nonce + "' />"; + h += "<div class='submit'><input type='submit' value='" + this.saveText + "' /></div>"; + h += "</td></tr></table></form>"; + + new Insertion.Top('upload-content', h); + if (e) Event.stop(e); + return false; + }, + + prepView: function(id) { + this.cancelView( true ); + var filesEl = $('upload-files'); + if ( filesEl ) + filesEl.hide(); + var navEl = $('current-tab-nav'); + if ( navEl ) + navEl.hide(); + this.grabImageData(id); + }, + + cancelView: function( prep ) { + if ( !prep ) { + var filesEl = $('upload-files'); + if ( filesEl ) + Element.show(filesEl); + var navEl = $('current-tab-nav'); + if ( navEl ) + Element.show(navEl); + } + if ( !this.ID ) + this.grabImageData(0); + var div = $('upload-file'); + if ( div ) + Element.remove(div); + return false; + }, + + sendToEditor: function(id) { + this.grabImageData(id); + var link = ''; + var display = ''; + var h = ''; + + link = $A(document.forms.uploadoptions.elements.link).detect( function(i) { return i.checked; } ).value; + displayEl = $A(document.forms.uploadoptions.elements.display).detect( function(i) { return i.checked; } ) + if ( displayEl ) + display = displayEl.value; + else if ( 1 == this.currentImage.isImage ) + display = 'full'; + + if ( 'none' != link ) + h += "<a href='" + ( 'file' == link ? ( this.currentImage.srcBase + this.currentImage.src ) : ( this.currentImage.page + "' rel='attachment wp-att-" + this.currentImage.ID ) ) + "' title='" + this.currentImage.title + "'>"; + if ( display && 'title' != display ) + h += "<img src='" + ( 'thumb' == display ? ( this.currentImage.thumbBase + this.currentImage.thumb ) : ( this.currentImage.srcBase + this.currentImage.src ) ) + "' alt='" + this.currentImage.title + "' />"; + else + h += this.currentImage.title; + if ( 'none' != link ) + h += "</a>"; + + var win = window.opener ? window.opener : window.dialogArguments; + if ( !win ) + win = top; + tinyMCE = win.tinyMCE; + if ( typeof tinyMCE != 'undefined' && tinyMCE.getInstanceById('content') ) { + tinyMCE.selectedInstance.getWin().focus(); + tinyMCE.execCommand('mceInsertContent', false, h); + } else + win.edInsertContent(win.edCanvas, h); + if ( !this.ID ) + this.cancelView(); + return false; + }, + + deleteFile: function(id) { + if ( confirm( this.confirmText.replace(/%title%/g, this.currentImage.title) ) ) { + $('action-value').value = 'delete'; + $('upload-file').submit(); + return true; + } + return false; + } + + }; + Object.extend( theFileList, uploadL10n ); + theFileList.initializeVars(); + theFileList.initializeLinks(); +} ); |