Changeset 816

Show
Ignore:
Timestamp:
11/30/06 18:54:22 (2 years ago)
Author:
donncha
Message:

WP Merge to 4559

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/wp-admin/admin-functions.php

    r810 r816  
    445445        if ( isset( $_POST['url'] ) ) { 
    446446                $user->user_url = wp_specialchars( trim( $_POST['url'] )); 
    447                 $user->user_url = preg_match( '/^(https?|ftps?|mailto|news|gopher):/is', $user->user_url ) ? $user->user_url : 'http://'.$user->user_url; 
     447                $user->user_url = preg_match('/^(https?|ftps?|mailto|news|irc|gopher|nntp|feed|telnet):/is', $user->user_url) ? $user->user_url : 'http://'.$user->user_url; 
    448448        } 
    449449        if ( isset( $_POST['first_name'] )) 
     
    559559 
    560560        $_POST['link_url'] = wp_specialchars( $_POST['link_url'] ); 
    561         $_POST['link_url'] = preg_match( '/^(https?|ftps?|mailto|news|gopher):/is', $_POST['link_url'] ) ? $_POST['link_url'] : 'http://' . $_POST['link_url']; 
     561        $_POST['link_url'] = preg_match('/^(https?|ftps?|mailto|news|irc|gopher|nntp|feed|telnet):/is', $_POST['link_url']) ? $_POST['link_url'] : 'http://' . $_POST['link_url']; 
    562562        $_POST['link_name'] = wp_specialchars( $_POST['link_name'] ); 
    563563        $_POST['link_image'] = wp_specialchars( $_POST['link_image'] ); 
     
    599599 
    600600function sort_cats( $cat1, $cat2 ) { 
    601         return strcasecmp( $cat1['cat_name'], $cat2['cat_name'] ); 
     601        if ( $cat1['checked'] || $cat2['checked'] ) 
     602                return ( $cat1['checked'] && !$cat2['checked'] ) ? -1 : 1; 
     603        else 
     604                return strcasecmp( $cat1['cat_name'], $cat2['cat_name'] ); 
    602605} 
    603606 
     
    759762                <td>" . ( $name_override ? $name_override : $pad . ' ' . $category->cat_name ) . "</td> 
    760763                <td>$category->category_description</td> 
    761                 <td align='center'>$category->category_count</td> 
     764                <td align='center'><a href='edit.php?cat=$category->cat_ID'>$category->category_count</a></td> 
    762765                <td align='center'>$category->link_count</td> 
    763766                <td>$edit</td>\n\t</tr>\n"; 
     
    10381041                ORDER BY meta_id DESC 
    10391042                LIMIT $limit" ); 
    1040         natcasesort( $keys ); 
     1043        if ( $keys ) 
     1044                natcasesort($keys); 
    10411045?> 
    10421046<h3><?php _e( 'Add a new custom field:' ) ?></h3> 
     
    19921996 
    19931997        $url = $file['url']; 
     1998        $type = $file['type']; 
    19941999        $file = addslashes( $file['file'] ); 
    19952000        $filename = basename( $file ); 
     
    19982003        $object = array( 'post_title' => $filename, 
    19992004                'post_content' => $url, 
    2000                 'post_mime_type' => 'import'
     2005                'post_mime_type' => $type
    20012006                'guid' => $url 
    20022007        ); 
     
    20782083} 
    20792084 
     2085 
     2086function wp_check_for_changed_slugs($post_id) { 
     2087        if ( !strlen($_POST['wp-old-slug']) ) 
     2088                return $post_id; 
     2089 
     2090        $post = &get_post($post_id); 
     2091 
     2092        // we're only concerned with published posts 
     2093        if ( $post->post_status != 'publish' || $post->post_type != 'post' ) 
     2094                return $post_id; 
     2095 
     2096        // only bother if the slug has changed 
     2097        if ( $post->post_name == $_POST['wp-old-slug'] ) 
     2098                return $post_id; 
     2099 
     2100        $old_slugs = get_post_meta($post_id, '_wp_old_slug'); 
     2101 
     2102        // if we haven't added this old slug before, add it now 
     2103        if ( !count($old_slugs) || !in_array($_POST['wp-old-slug'], $old_slugs) ) 
     2104                add_post_meta($post_id, '_wp_old_slug', $_POST['wp-old-slug']); 
     2105 
     2106        // if the new slug was used previously, delete it from the list 
     2107        if ( in_array($post->post_name, $old_slugs) ) 
     2108                delete_post_meta($post_id, '_wp_old_slug', $post->post_name); 
     2109 
     2110        return $post_id; 
     2111} 
     2112 
     2113 
     2114function wp_remember_old_slug() { 
     2115        global $post; 
     2116        $name = wp_specialchars($post->post_name); // just in case 
     2117        if ( strlen($name) ) 
     2118                echo '<input type="hidden" id="wp-old-slug" name="wp-old-slug" value="' . $name . '" />'; 
     2119} 
     2120 
     2121 
    20802122// If siteurl or home changed, reset cookies and flush rewrite rules. 
    20812123function update_home_siteurl( $old_value, $value ) { 
  • trunk/wp-admin/cat-js.php

    r753 r816  
    99        if ( !jaxcat ) 
    1010                return false; 
    11         jaxcat.update('<span id="ajaxcat"><input type="text" name="newcat" id="newcat" size="16" autocomplete="off"/><input type="button" name="Button" id="catadd" value="<?php _e('Add'); ?>"/><span id="howto"><?php _e('Separate multiple categories with commas.'); ?></span></span>'); 
     11        jaxcat.update('<span id="ajaxcat"><input type="text" name="newcat" id="newcat" size="16" autocomplete="off"/><input type="button" name="Button" id="catadd" value="<?php echo js_escape(__('Add')); ?>"/><span id="howto"><?php js_escape(__('Separate multiple categories with commas.')); ?></span></span>'); 
    1212        $('newcat').onkeypress = function(e) { return killSubmit("catList.ajaxAdder('category','jaxcat');", e); }; 
    1313        $('catadd').onclick = function() { catList.ajaxAdder('category', 'jaxcat'); }; 
  • trunk/wp-admin/comment.php

    r810 r816  
    1919 
    2020        if ( ! $comment = get_comment($comment) ) 
    21                 wp_die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'javascript:history.go(-1)')); 
     21                wp_die(__('Oops, no comment with this ID.').sprintf(' <a href="%s">'.__('Go back').'</a>!', 'javascript:history.go(-1)')); 
    2222 
    2323        if ( !current_user_can('edit_post', $comment->comment_post_ID) ) 
     
    4141 
    4242        if ( ! $comment = get_comment($comment) ) 
    43                 wp_die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 
     43                wp_die(__('Oops, no comment with this ID.').sprintf(' <a href="%s">'.__('Go back').'</a>!', 'edit.php')); 
    4444 
    4545        if ( !current_user_can('edit_post', $comment->comment_post_ID) ) 
     
    5050<div class="narrow"> 
    5151<?php if ( 'spam' == $_GET['dt'] ) { ?> 
    52 <p><?php _e('<strong>Caution:</strong> You are about to mark the following comment as spam:'); ?></p> 
     52<p><?php echo '<strong>'.__('Caution:').'</strong> '.__('You are about to mark the following comment as spam:'); ?></p> 
    5353<?php } elseif ( 'cdc' == $action ) { ?> 
    54 <p><?php _e('<strong>Caution:</strong> You are about to delete the following comment:'); ?></p> 
     54<p><?php echo '<strong>'.__('Caution:').'</strong> '.__('You are about to delete the following comment:'); ?></p> 
    5555<?php } else { ?> 
    56 <p><?php _e('<strong>Caution:</strong> You are about to approve the following comment:'); ?></p> 
     56<p><?php echo '<strong>'.__('Caution:').'</strong> '.__('You are about to approve the following comment:'); ?></p> 
    5757<?php } ?> 
    5858 
     
    117117 
    118118        if ( ! $comment = get_comment($comment) ) 
    119                          wp_die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit-comments.php')); 
     119                         wp_die(__('Oops, no comment with this ID.').sprintf(' <a href="%s">'.__('Go back').'</a>!', 'edit-comments.php')); 
    120120 
    121121        if ( !current_user_can('edit_post', $comment->comment_post_ID) ) 
     
    146146 
    147147        if ( ! $comment = get_comment($comment) ) 
    148                 wp_die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 
     148                wp_die(__('Oops, no comment with this ID.').sprintf(' <a href="%s">'.__('Go back').'</a>!', 'edit.php')); 
    149149 
    150150        if ( !current_user_can('edit_post', $comment->comment_post_ID) ) 
     
    172172 
    173173        if ( ! $comment = get_comment($comment) ) 
    174                 wp_die(sprintf(__('Oops, no comment with this ID. <a href="%s">Go back</a>!'), 'edit.php')); 
     174                wp_die(__('Oops, no comment with this ID.').sprintf(' <a href="%s">'.__('Go back').'</a>!', 'edit.php')); 
    175175 
    176176        if ( !current_user_can('edit_post', $comment->comment_post_ID) ) 
  • trunk/wp-admin/dbx-admin-key-js.php

    r810 r816  
    3333                'yes',                  // include open/close toggle buttons ['yes'|'no'] 
    3434                'closed',               // default state ['open'|'closed'] 
    35                 'open',               // word for "open", as in "open this box" 
    36                 'close',              // word for "close", as in "close this box" 
    37                 'click-down and drag to move this box', // sentence for "move this box" by mouse 
    38                 'click to %toggle% this box', // pattern-match sentence for "(open|close) this box" by mouse 
    39                 'use the arrow keys to move this box', // sentence for "move this box" by keyboard 
    40                 ', or press the enter key to %toggle% it',  // pattern-match sentence-fragment for "(open|close) this box" by keyboard 
     35                '<?php echo js_escape(__('open')); ?>',               // word for "open", as in "open this box" 
     36                '<?php echo js_escape(__('close')); ?>',              // word for "close", as in "close this box" 
     37                '<?php echo js_escape(__('click-down and drag to move this box')); ?>', // sentence for "move this box" by mouse 
     38                '<?php echo js_escape(__('click to %toggle% this box')); ?>', // pattern-match sentence for "(open|close) this box" by mouse 
     39                '<?php echo js_escape(__('use the arrow keys to move this box')); ?>', // sentence for "move this box" by keyboard 
     40                '<?php echo js_escape(__(', or press the enter key to %toggle% it')); ?>',  // pattern-match sentence-fragment for "(open|close) this box" by keyboard 
    4141                '%mytitle%  [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts 
    4242                ); 
     
    5858                'yes',                  // include open/close toggle buttons ['yes'|'no'] 
    5959                'closed',               // default state ['open'|'closed'] 
    60                 'open',               // word for "open", as in "open this box" 
    61                 'close',              // word for "close", as in "close this box" 
    62                 'click-down and drag to move this box', // sentence for "move this box" by mouse 
    63                 'click to %toggle% this box', // pattern-match sentence for "(open|close) this box" by mouse 
    64                 'use the arrow keys to move this box', // sentence for "move this box" by keyboard 
    65                 ', or press the enter key to %toggle% it',  // pattern-match sentence-fragment for "(open|close) this box" by keyboard 
     60                '<?php echo js_escape(__('open')); ?>',               // word for "open", as in "open this box" 
     61                '<?php echo js_escape(__('close')); ?>',              // word for "close", as in "close this box" 
     62                '<?php echo js_escape(__('click-down and drag to move this box')); ?>', // sentence for "move this box" by mouse 
     63                '<?php echo js_escape(__('click to %toggle% this box')); ?>', // pattern-match sentence for "(open|close) this box" by mouse 
     64                '<?php echo js_escape(__('use the arrow keys to move this box')); ?>', // sentence for "move this box" by keyboard 
     65                '<?php echo js_escape(__(', or press the enter key to %toggle% it')); ?>',  // pattern-match sentence-fragment for "(open|close) this box" by keyboard 
    6666                '%mytitle%  [%dbxtitle%]' // pattern-match syntax for title-attribute conflicts 
    6767                ); 
  • trunk/wp-admin/edit-comments.php

    r810 r816  
    158158if ( current_user_can('edit_post', $comment->comment_post_ID) ) { 
    159159        echo " <a href='comment.php?action=editcomment&amp;c=".$comment->comment_ID."'>" .  __('Edit') . '</a>'; 
    160         echo ' | <a href="' . wp_nonce_url('comment.php?action=deletecomment&amp;p=' . $comment->comment_post_ID . '&amp;c=' . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . '" onclick="return deleteSomething( \'comment\', ' . $comment->comment_ID . ', \'' . sprintf(__("You are about to delete this comment by &quot;%s&quot;.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to delete."), js_escape($comment->comment_author)) . "', theCommentList );\">" . __('Delete') . '</a> '; 
     160        echo ' | <a href="' . wp_nonce_url('comment.php?action=deletecomment&amp;p=' . $comment->comment_post_ID . '&amp;c=' . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . '" onclick="return deleteSomething( \'comment\', ' . $comment->comment_ID . ', \'' . js_escape(sprintf(__("You are about to delete this comment by &quot;%s&quot;.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to delete."), $comment->comment_author)) . "', theCommentList );\">" . __('Delete') . '</a> '; 
    161161        if ( ('none' != $comment_status) && ( current_user_can('moderate_comments') ) ) { 
    162162                echo '<span class="unapprove"> | <a href="' . wp_nonce_url('comment.php?action=unapprovecomment&amp;p=' . $comment->comment_post_ID . '&amp;c=' . $comment->comment_ID, 'unapprove-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Unapprove') . '</a> </span>'; 
    163163                echo '<span class="approve"> | <a href="' . wp_nonce_url('comment.php?action=approvecomment&amp;p=' . $comment->comment_post_ID . '&amp;c=' . $comment->comment_ID, 'approve-comment_' . $comment->comment_ID) . '" onclick="return dimSomething( \'comment\', ' . $comment->comment_ID . ', \'unapproved\', theCommentList );">' . __('Approve') . '</a> </span>'; 
    164164        } 
    165         echo " | <a href=\"" . wp_nonce_url("comment.php?action=deletecomment&amp;dt=spam&amp;p=" . $comment->comment_post_ID . "&amp;c=" . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . "\" onclick=\"return deleteSomething( 'comment-as-spam', $comment->comment_ID, '" . sprintf(__("You are about to mark as spam this comment by &quot;%s&quot;.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to mark as spam."), js_escape( $comment->comment_author))  . "', theCommentList );\">" . __('Spam') . "</a> "; 
     165        echo " | <a href=\"" . wp_nonce_url("comment.php?action=deletecomment&amp;dt=spam&amp;p=" . $comment->comment_post_ID . "&amp;c=" . $comment->comment_ID, 'delete-comment_' . $comment->comment_ID) . "\" onclick=\"return deleteSomething( 'comment-as-spam', $comment->comment_ID, '" . js_escape(sprintf(__("You are about to mark as spam this comment by &quot;%s&quot;.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to mark as spam."), $comment->comment_author))  . "', theCommentList );\">" . __('Spam') . "</a> "; 
    166166} 
    167167$post = get_post($comment->comment_post_ID); 
     
    224224        echo "<a href='comment.php?action=editcomment&amp;c=$comment->comment_ID' class='edit'>" .  __('Edit') . "</a>"; } ?></td> 
    225225    <td><?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) { 
    226                 echo "<a href=\"comment.php?action=deletecomment&amp;p=".$comment->comment_post_ID."&amp;c=".$comment->comment_ID."\" onclick=\"return deleteSomething( 'comment', $comment->comment_ID, '" . sprintf(__("You are about to delete this comment by &quot;%s&quot;.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to delete."), js_escape( $comment->comment_author ))  . "', theCommentList );\" class='delete'>" . __('Delete') . "</a> "; 
     226                echo "<a href=\"comment.php?action=deletecomment&amp;p=".$comment->comment_post_ID."&amp;c=".$comment->comment_ID."\" onclick=\"return deleteSomething( 'comment', $comment->comment_ID, '" . js_escape(sprintf(__("You are about to delete this comment by &quot;%s&quot;.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to delete."), $comment->comment_author ))  . "', theCommentList );\" class='delete'>" . __('Delete') . "</a> "; 
    227227                } ?></td> 
    228228  </tr> 
     
    230230                } // end foreach 
    231231        ?></table> 
    232 <p class="submit"><input type="submit" name="delete_button" class="delete" value="<?php _e('Delete Checked Comments &raquo;') ?>" onclick="var numchecked = getNumChecked(document.getElementById('deletecomments')); if(numchecked < 1) { alert('<?php _e("Please select some comments to delete"); ?>'); return false } return confirm('<?php printf(__("You are about to delete %s comments permanently \\n  \'Cancel\' to stop, \'OK\' to delete."), "' + numchecked + '"); ?>')" /> 
    233                         <input type="submit" name="spam_button" value="<?php _e('Mark Checked Comments as Spam &raquo;') ?>" onclick="return confirm('<?php _e("You are about to mark these comments as spam \\n  \'Cancel\' to stop, \'OK\' to mark as spam.") ?>')" /></p> 
     232<p class="submit"><input type="submit" name="delete_button" class="delete" value="<?php _e('Delete Checked Comments &raquo;') ?>" onclick="var numchecked = getNumChecked(document.getElementById('deletecomments')); if(numchecked < 1) { alert('<?php echo js_escape(__("Please select some comments to delete")); ?>'); return false } return confirm('<?php echo js_escape(sprintf(__("You are about to delete %s comments permanently \\n  \'Cancel\' to stop, \'OK\' to delete.")), "' + numchecked + '"); ?>')" /> 
     233                        <input type="submit" name="spam_button" value="<?php _e('Mark Checked Comments as Spam &raquo;') ?>" onclick="return confirm('<?php echo js_escape(__("You are about to mark these comments as spam \\n  \'Cancel\' to stop, \'OK\' to mark as spam.")); ?>')" /></p> 
    234234  </form> 
    235235<div id="ajax-response"></div> 
  • trunk/wp-admin/edit-page-form.php

    r810 r816  
    189189        $delete_nonce = wp_create_nonce( 'delete-page_' . $post_ID ); 
    190190        if ( current_user_can('delete_page', $post->ID) ) ?> 
    191                 <input name="deletepost" class="button delete" type="submit" id="deletepost" tabindex="10" value="<?php _e('Delete this page') ?>" <?php echo "onclick=\"if ( confirm('" . sprintf(__("You are about to delete this page \'%s\'\\n  \'Cancel\' to stop, \'OK\' to delete."), js_escape($post->post_title) ) . "') ) { document.forms.post._wpnonce.value = '$delete_nonce'; return true;}return false;\""; ?> /> 
     191                <input name="deletepost" class="button delete" type="submit" id="deletepost" tabindex="10" value="<?php _e('Delete this page') ?>" <?php echo "onclick=\"if ( confirm('" . js_escape(sprintf(__("You are about to delete this page \'%s\'\\n  \'Cancel\' to stop, \'OK\' to delete."), $post->post_title )) . "') ) { document.forms.post._wpnonce.value = '$delete_nonce'; return true;}return false;\""; ?> /> 
    192192<?php endif; ?> 
    193193</div> 
  • trunk/wp-admin/edit.php

    r810 r816  
    128128// define the columns to display, the syntax is 'internal name' => 'display name' 
    129129$posts_columns = array( 
    130         'id'         => __('ID')
     130        'id'         => '<div style="text-align: center">' . __('ID') . '</div>'
    131131        'date'       => __('When'), 
    132132        'title'      => __('Title'), 
    133133        'categories' => __('Categories'), 
    134         'comments'   => __('Comments')
     134        'comments'   => '<div style="text-align: center">' . __('Comments') . '</div>'
    135135        'author'     => __('Author') 
    136136); 
  • trunk/wp-admin/export.php

    r810 r816  
    6262 
    6363$posts = $wpdb->get_results("SELECT * FROM $wpdb->posts $where ORDER BY post_date_gmt ASC"); 
     64 
     65$categories = (array) $wpdb->get_results("SELECT cat_ID, cat_name, category_nicename, category_description, category_parent, posts_private, links_private FROM $wpdb->categories LEFT JOIN $wpdb->post2cat ON (category_id = cat_id) LEFT JOIN $wpdb->posts ON (post_id <=> id) $where GROUP BY cat_id"); 
     66 
     67function wxr_missing_parents($categories) { 
     68        if ( !is_array($categories) || empty($categories) ) 
     69                return array(); 
     70 
     71        foreach ( $categories as $category ) 
     72                $parents[$category->cat_ID] = $category->category_parent; 
     73 
     74        $parents = array_unique(array_diff($parents, array_keys($parents))); 
     75 
     76        if ( $zero = array_search('0', $parents) ) 
     77                unset($parents[$zero]); 
     78 
     79        return $parents; 
     80} 
     81 
     82while ( $parents = wxr_missing_parents($categories) ) { 
     83        $found_parents = $wpdb->get_results("SELECT cat_ID, cat_name, category_nicename, category_description, category_parent, posts_private, links_private FROM $wpdb->categories WHERE cat_ID IN (" . join(', ', $parents) . ")"); 
     84        if ( is_array($found_parents) && count($found_parents) ) 
     85                $categories = array_merge($categories, $found_parents); 
     86        else 
     87                break; 
     88} 
     89 
     90// Put them in order to be inserted with no child going before its parent 
     91$pass = 0; 
     92$passes = 1000 + count($categories); 
     93while ( ( $cat = array_shift($categories) ) && ++$pass < $passes ) { 
     94        if ( $cat->category_parent == 0 || isset($cats[$cat->category_parent]) ) { 
     95                $cats[$cat->cat_ID] = $cat; 
     96        } else { 
     97                $categories[] = $cat; 
     98        } 
     99} 
     100unset($categories); 
     101 
     102function wxr_cdata($str) { 
     103        if ( seems_utf8($str) == false ) 
     104                $str = utf8_encode($str); 
     105 
     106        // $str = ent2ncr(wp_specialchars($str)); 
     107 
     108        $str = "<![CDATA[$str" . ( ( substr($str, -1) == ']' ) ? ' ' : '') . "]]>"; 
     109 
     110        return $str; 
     111} 
     112 
     113function wxr_cat_name($c) { 
     114        if ( empty($c->cat_name) ) 
     115                return; 
     116 
     117        echo '<wp:cat_name>' . wxr_cdata($c->cat_name) . '</wp:cat_name>'; 
     118} 
     119 
     120function wxr_category_description($c) { 
     121        if ( empty($c->category_description) ) 
     122                return; 
     123 
     124        echo '<wp:category_description>' . wxr_cdata($c->category_description) . '</wp:category_description>'; 
     125} 
    64126?> 
    65127<!-- This is a WordPress eXtended RSS file generated by WordPress as an export of your blog. --> 
     
    88150        <generator>http://wordpress.org/?v=<?php bloginfo_rss('version'); ?></generator> 
    89151        <language><?php echo get_option('rss_language'); ?></language> 
     152<?php if ( $cats ) : foreach ( $cats as $c ) : ?> 
     153        <wp:category><wp:category_nicename><?php echo $c->category_nicename; ?></wp:category_nicename><wp:category_parent><?php echo $c->category_parent ? $cats[$c->category_parent]->cat_name : ''; ?></wp:category_parent><wp:posts_private><?php echo $c->posts_private ? '1' : '0'; ?></wp:posts_private><wp:links_private><?php echo $c->links_private ? '1' : '0'; ?></wp:links_private><?php wxr_cat_name($c); ?><?php wxr_category_description($c); ?></wp:category> 
     154<?php endforeach; endif; ?> 
    90155        <?php do_action('rss2_head'); ?> 
    91156        <?php if ($posts) { foreach ($posts as $post) { start_wp(); ?> 
  • trunk/wp-admin/import/blogger.php

    r810 r816  
    1111                $welcome = __('Howdy! This importer allows you to import posts and comments from your Blogger account into your WordPress blog.'); 
    1212                $noiframes = __('This feature requires iframe support.'); 
    13                 $warning = __('This will delete everything saved by the Blogger importer except your posts and comments. Are you sure you want to do this?'); 
     13                $warning = js_escape(__('This will delete everything saved by the Blogger importer except your posts and comments. Are you sure you want to do this?')); 
    1414                $reset = __('Reset this importer'); 
    1515                $incompat = __('Your web server is not properly configured to use this importer. Please enable the CURL extension for PHP and then reload this page.'); 
     
    256256                                        'blog-options-archiving' => array('archiveFrequency' => 'm'), 
    257257                                        'blog-publishing' => array('publishMode'=>'0', 'blogID' => "$id", 'subdomain' => mt_rand().mt_rand(), 'pingWeblogs' => 'false'), 
    258                                         'blog-formatting' => array('timeStampFormat' => '0', 'convertLineBreaks'=>'false', 'floatAlignment'=>'false'), 
     258                                        'blog-formatting' => array('timeStampFormat' => '0', 'encoding'=>'UTF-8', 'convertLineBreaks'=>'false', 'floatAlignment'=>'false'), 
    259259                                        'blog-comments' => array('commentsTimeStampFormat' => '0'), 
    260260                                        'template-edit' => array( 'templateText' =>  str_replace('%title%', trim($blogsary[2][$key]), $template) ) 
     
    350350                                $form.= $body; 
    351351                                $form.= "</div><script type='text/javascript'>forms=document.getElementsByTagName('form');for(i=0;i<forms.length;i++){if(forms[i].action.search('{$blog_opt}')){forms[i].submit();break;}}</script>"; 
    352                                 $output.= '<p>'.sprintf('<strong>%s</strong> in progress, please wait...', $blog_opt)."</p>\n"; 
     352                                $output.= '<p>'.sprintf(__('<strong>%s</strong> in progress, please wait...'), $blog_opt)."</p>\n"; 
    353353                        } else { 
    354354                                $output.= "<p>$blog_opt</p>\n"; 
     
    429429                                                        $user_password = substr(md5(uniqid(microtime())), 0, 6); 
    430430                                                        $result = wp_create_user( $user_login, $user_password, $user_email ); 
    431                                                         $status.= sprintf('Registered user <strong>%s</strong>.', $user_login); 
     431                                                        $status.= sprintf(__('Registered user <strong>%s</strong>.'), $user_login); 
    432432                                                        $this->import['blogs'][$_GET['blog']]['newusers'][] = $user_login; 
    433433                                                } 
  • trunk/wp-admin/import/wordpress.php

    r810 r816  
    7070                preg_match_all('|<item>(.*?)</item>|is', $importdata, $this->posts); 
    7171                $this->posts = $this->posts[1]; 
     72                preg_match_all('|<wp:category>(.*?)</wp:category>|is', $importdata, $this->categories); 
     73                $this->categories = $this->categories[1]; 
    7274        } 
    7375 
     
    159161                $this->get_entries(); 
    160162                $this->wp_authors_form(); 
     163        } 
     164 
     165        function process_categories() { 
     166                global $wpdb; 
     167 
     168                $cat_names = (array) $wpdb->get_col("SELECT cat_name FROM $wpdb->categories"); 
     169 
     170                while ( $c = array_shift($this->categories) ) { 
     171                        $cat_name = trim(str_replace(array ('<![CDATA[', ']]>'), '', $this->get_tag( $c, 'wp:cat_name' ))); 
     172 
     173                        // If the category exists we leave it alone 
     174                        if ( in_array($cat_name, $cat_names) ) 
     175                                continue; 
     176 
     177                        $category_nicename      = $this->get_tag( $c, 'wp:category_nicename' ); 
     178                        $posts_private          = (int) $this->get_tag( $c, 'wp:posts_private' ); 
     179                        $links_private          = (int) $this->get_tag( $c, 'wp:links_private' ); 
     180 
     181                        $parent = $this->get_tag( $c, 'wp:category_parent' ); 
     182 
     183                        if ( empty($parent) ) 
     184                                $category_parent = '0'; 
     185                        else 
     186                                $category_parent = (int) category_exists($parent); 
     187 
     188                        $catarr = compact('category_nicename', 'category_parent', 'posts_private', 'links_private', 'posts_private', 'cat_name'); 
     189 
     190                        $cat_ID = wp_insert_category($catarr); 
     191                } 
    161192        } 
    162193 
     
    190221                        $cat_index = 0; 
    191222                        foreach ($categories as $category) { 
    192                                 $categories[$cat_index] = $wpdb->escape($this->unhtmlentities($category)); 
     223                                $categories[$cat_index] = $wpdb->escape($this->unhtmlentities(str_replace(array ('<![CDATA[', ']]>'), '', $category))); 
    193224                                $cat_index++; 
    194225                        } 
     
    261292                $this->get_authors_from_post(); 
    262293                $this->get_entries(); 
     294                $this->process_categories(); 
    263295                $this->process_posts(); 
    264296        } 
  • trunk/wp-admin/link-add.php

    r810 r816  
    3030<h3><?php _e('Add Link Bookmarklet'); ?></h3> 
    3131<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> 
    32 <?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&amp;linkurl='+escape(location.href)+'&amp;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();") ?> 
     32<?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&amp;linkurl='+escape(location.href)+'&amp;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();") ?> 
    3333</div> 
    3434 
  • trunk/wp-admin/link-manager.php

    r810 r816  
    162162 
    163163                echo '<td><a href="link.php?link_id='.$link->link_id.'&amp;action=edit" class="edit">'.__('Edit').'</a></td>'; 
    164                 echo '<td><a href="' . wp_nonce_url('link.php?link_id='.$link->link_id.'&amp;action=delete', 'delete-bookmark_' . $link->link_id ) . '"'." onclick=\"return deleteSomething( 'link', $link->link_id , '".sprintf(__("You are about to delete the &quot;%s&quot; link to %s.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to delete."), js_escape($link->link_name), js_escape($link->link_url)).'\' );" class="delete">'.__('Delete').'</a></td>'; 
     164                echo '<td><a href="' . wp_nonce_url('link.php?link_id='.$link->link_id.'&amp;action=delete', 'delete-bookmark_' . $link->link_id ) . '"'." onclick=\"return deleteSomething( 'link', $link->link_id , '".js_escape(sprintf(__("You are about to delete the &quot;%s&quot; link to %s.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to delete."), $link->link_name, $link->link_url )).'\' );" class="delete">'.__('Delete').'</a></td>'; 
    165165                echo '<td align="center"><input type="checkbox" name="linkcheck[]" value="'.$link->link_id.'" /></td>'; 
    166166                echo "\n    </tr>\n"; 
     
    172172<div id="ajax-response"></div> 
    173173 
    174 <p class="submit"><input type="submit" class="button" name="deletebookmarks" id="deletebookmarks" value="<?php _e('Delete Checked Links') ?> &raquo;" onclick="return confirm('<?php _e("You are about to delete these links permanently \\n  \'Cancel\' to stop, \'OK\' to delete.") ?>')" /></p> 
     174<p class="submit"><input type="submit" class="button" name="deletebookmarks" id="deletebookmarks" value="<?php _e('Delete Checked Links') ?> &raquo;" onclick="return confirm('<?php echo js_escape(__("You are about to delete these links permanently \\n  \'Cancel\' to stop, \'OK\' to delete.")); ?>')" /></p> 
    175175</form> 
    176176</div> 
  • trunk/wp-admin/moderation.php

    r810 r816  
    136136<p><?php comment_date('M j, g:i A'); ?> &#8212; [ <?php 
    137137echo '<a href="comment.php?action=editcomment&amp;c='.$comment->comment_ID.'">' . __('Edit') . '</a> | '; 
    138 echo " <a href=\"post.php?action=deletecomment&amp;p=".$comment->comment_post_ID."&amp;comment=".$comment->comment_ID."\" onclick=\"return deleteSomething( 'comment', $comment->comment_ID, '" . sprintf(__("You are about to delete this comment by &quot;%s&quot;.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to delete."), js_escape($comment->comment_author)) . "', theCommentList );\">" . __('Delete ') . "</a> | "; ?> 
     138echo " <a href=\"post.php?action=deletecomment&amp;p=".$comment->comment_post_ID."&amp;comment=".$comment->comment_ID."\" onclick=\"return deleteSomething( 'comment', $comment->comment_ID, '" . js_escape(sprintf(__("You are about to delete this comment by &quot;%s&quot;.\\n&quot;Cancel&quot; to stop, &quot;OK&quot; to delete."), $comment->comment_author )) . "', theCommentList );\">" . __('Delete ') . "</a> | "; ?> 
    139139<?php 
    140140$post = get_post($comment->comment_post_ID); 
  • trunk/wp-admin/plugins.php

    r810 r816  
    113113                        $toggle = "<a href='" . wp_nonce_url("plugins.php?action=activate&amp;plugin=$plugin_file", 'activate-plugin_' . $plugin_file) . "' title='".__('Activate this plugin')."' class='edit'>".__('Activate')."</a>"; 
    114114                } 
    115                 $plugin_data['Description'] = wp_kses($plugin_data['Description'], array('a' => array('href' => array(),'title' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array()) ); ; 
     115 
     116                $plugins_allowedtags = array('a' => array('href' => array(),'title' => array()),'abbr' => array('title' => array()),'acronym' => array('title' => array()),'code' => array(),'em' => array(),'strong' => array()); 
     117 
     118                // Sanitize all displayed data 
     119                $plugin_data['Title']       = wp_kses($plugin_data['Title'], $plugins_allowedtags); 
     120                $plugin_data['Version']     = wp_kses($plugin_data['Version'], $plugins_allowedtags); 
     121                $plugin_data['Description'] = wp_kses($plugin_data['Description'], $plugins_allowedtags); 
     122                $plugin_data['Author']      = wp_kses($plugin_data['Author'], $plugins_allowedtags); 
     123 
    116124                if ( $style != '' ) 
    117125                        $style = 'class="' . $style . '"'; 
  • trunk/wp-admin/upgrade-functions.php

    r810 r816  
    175175        if ( $wp_current_db_version < 3845 ) 
    176176                upgrade_210(); 
     177 
     178        if ( $wp_current_db_version < 4351 ) 
     179                upgrade_old_slugs(); 
    177180 
    178181        $wp_rewrite->flush_rules(); 
  • trunk/wp-admin/upload-js.php

    r810 r816  
    9898                        h += "<table>"; 
    9999                        if ( this.currentImage.thumb ) { 
    100                                 h += "<tr><th style='padding-bottom:.5em'><?php echo addslashes(__('Show:')); ?></th><td style='padding-bottom:.5em'>"; 
    101                                 h += "<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' checked='checked' /> <?php echo addslashes(__('Thumbnail')); ?></label><br />"; 
    102                                 h += "<label for='display-full'><input type='radio' name='display' id='display-full' value='full' /> <?php echo addslashes(__('Full size')); ?></label>"; 
     100                                h += "<tr><th style='padding-bottom:.5em'><?php echo js_escape(__('Show:')); ?></th><td style='padding-bottom:.5em'>"; 
     101                                h += "<label for='display-thumb'><input type='radio' name='display' id='display-thumb' value='thumb' checked='checked' /> <?php echo js_escape(__('Thumbnail')); ?></label><br />"; 
     102                                h += "<label for='display-full'><input type='radio' name='display' id='display-full' value='full' /> <?php echo js_escape(__('Full size')); ?></label>"; 
    103103                                h += "</td></tr>"; 
    104104                        } 
    105105 
    106                         h += "<tr><th><?php echo addslashes(__('Link to:')); ?></th><td>"; 
    107                         h += "<label for='link-file'><input type='radio' name='link' id='link-file' value='file' checked='checked'/> <?php echo addslashes(__('File')); ?></label><br />"; 
    108                         h += "<label for='link-page'><input type='radio' name='link' id='link-page' value='page' /> <?php echo addslashes(__('Page')); ?></label><br />"; 
    109                         h += "<label for='link-none'><input type='radio' name='link' id='link-none' value='none' /> <?php echo addslashes(__('None')); ?></label>"; 
     106                        h += "<tr><th><?php echo js_escape(__('Link to:')); ?></th><td>"; 
     107                        h += "<label for='link-file'><input type='radio' name='link' id='link-file' value='file' checked='checked'/> <?php echo js_escape(__('File')); ?></label><br />"; 
     108                        h += "<label for='link-page'><input type='radio' name='link' id='link-page' value='page' /> <?php echo js_escape(__('Page')); ?></label><br />"; 
     109                        h += "<label for='link-none'><input type='radio' name='link' id='link-none' value='none' /> <?php echo js_escape(__('None')); ?></label>"; 
    110110                        h += "</td></tr>"; 
    111111 
    112112                        h += "<tr><td colspan='2'><p class='submit'>"; 
    113                         h += "<input type='button' class='button' name='send' onclick='theFileList.sendToEditor(" + id + ")' value='<?php echo addslashes(__('Send to editor')); ?> &raquo;' />"; 
     113                        h += "<input type='button' class='button' name='send' onclick='theFileList.sendToEditor(" + id + ")' value='<?php echo js_escape(__('Send to editor &raquo;')); ?>' />"; 
    114114                        h += "</p></td></tr></table>"; 
    115115                        h += "</form>"; 
     
    135135                                params.ID = ''; 
    136136                                params.action = ''; 
    137                                 h += "<a href='" + this.urlData[0] + '?' + params.toQueryString() + "'  title='Browse your files' class='back'>&laquo; Back</a>"; 
    138                         } else { 
    139                                 h += "<a href='#' onclick='return theFileList.cancelView();'  title='Browse your files' class='back'>&laquo; Back</a>"; 
     137                                h += "<a href='" + this.urlData[0] + '?' + params.toQueryString() + "'  title='<?php echo js_escape(__('Browse your files')); ?>' class='back'>&laquo;  <?php echo js_escape(__('Back')); ?></a>"; 
     138                        } else { 
     139                                h += "<a href='#' onclick='return theFileList.cancelView();'  title='<?php echo js_escape(__('Browse your files')); ?>' class='back'>&laquo; <?php echo js_escape(__('Back')); ?></a>"; 
    140140                        } 
    141141                        h += "<div id='file-title'>" 
    142142                        if ( !this.currentImage.isImage ) 
    143                                 h += "<h2><a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='Direct link to file'>" + this.currentImage.title + "</a></h2>"; 
     143                                h += "<h2><a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='<?php echo js_escape(__('Direct link to file')); ?>'>" + this.currentImage.title + "</a></h2>"; 
    144144                        else 
    145145                                h += "<h2>" + this.currentImage.title + "</h2>"; 
    146146                        h += " &#8212; <span>"; 
    147                         h += "<a href='#' onclick='return theFileList.imageView(" + id + ");'>Insert</a>" 
     147                        h += "<a href='#' onclick='return theFileList.imageView(" + id + ");'><?php js_escape(__('Insert')); ?></a>" 
    148148                        h += "</span>"; 
    149149                        h += '</div>' 
    150150                        h += "<div id='upload-file-view' class='alignleft'>"; 
    151151                        if ( this.currentImage.isImage ) { 
    152                                 h += "<a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='Direct link to file'>"; 
     152                                h += "<a href='" + this.currentImage.srcBase + this.currentImage.src + "' onclick='return false;' title='<?php echo js_escape(__('Direct link to file')); ?>'>"; 
    153153                                h += "<img src='" + ( this.currentImage.thumb ? this.currentImage.thumb : this.currentImage.src ) + "' alt='" + this.currentImage.title + "' width='" + this.currentImage.width + "' height='" + this.currentImage.height + "' />"; 
    154154                                h += "</a>"; 
     
    159159 
    160160                        h += "<table><col /><col class='widefat' /><tr>" 
    161                         h += "<th scope='row'><label for='url'>URL</label></th>"; 
     161                        h += "<th scope='row'><label for='url'><?php echo js_escape(__('URL')); ?></label></th>"; 
    162162                        h += "<td><input type='text' id='url' class='readonly' value='" + this.currentImage.srcBase + this.currentImage.src + "' readonly='readonly' /></td>"; 
    163163                        h += "</tr><tr>"; 
    164                         h += "<th scope='row'><label for='post_title'>Title</label></th>"; 
     164                        h += "<th scope='row'><label for='post_title'><?php echo js_escape(__('Title')); ?></label></th>"; 
    165165                        h += "<td><input type='text' id='post_title' name='post_title' value='" + this.currentImage.title + "' /></td>"; 
    166166                        h += "</tr><tr>"; 
    167                         h += "<th scope='row'><label for='post_content'>Description</label></th>"; 
     167                        h += "<th scope='row'><label for='post_content'><?php echo js_escape(__('Description')); ?></label></th>"; 
    168168                        h += "<td><textarea name='post_content' id='post_content'>" + this.currentImage.description + "</textarea></td>"; 
    169                         h += "</tr><tr id='buttons' class='submit'><td colspan='2'><input type='button' id='delete' name='delete' class='delete alignleft' value='Delete File' onclick='theFileList.deleteFile(" + id + ");' />"; 
     169                        h += "</tr><tr id='buttons' class='submit'><td colspan='2'><input type='button' id='delete' name='delete' class='delete alignleft' value='<?php echo js_escape(__('Delete File')); ?>' onclick='theFileList.deleteFile(" + id + ");' />"; 
    170170                        h += "<input type='hidden' name='from_tab' value='" + this.tab + "' />"; 
    171171                        h += "<input type='hidden' name='action' id='action-value' value='save' />"; 
    172172                        h += "<input type='hidden' name='ID' value='" + id + "' />"; 
    173173                        h += "<input type='hidden' name='_wpnonce' value='" + this.nonce + "' />"; 
    174                         h += "<div class='submit'><input type='submit' value='Save &raquo;' /></div>"; 
     174                        h += "<div class='submit'><input type='submit' value='<?php echo js_escape(__('Save &raquo;')); ?>' /></div>"; 
    175175                        h += "</td></tr></table></form>"; 
    176176 
  • trunk/wp-admin/upload.css

    r810 r816  
    144144 
    145145#upload-files a.file-link.image { 
    146         line-height: 128px; 
    147146        font-size: 2px; 
    148147        letter-spacing: 0; 
  • trunk/wp-admin/users.php

    r810 r816  
    33require_once( ABSPATH . WPINC . '/registration.php'); 
    44 
     5if ( !current_user_can('edit_users') ) 
     6        wp_die(__('Cheatin&#8217; uh?')); 
     7 
    58$title = __('Users'); 
    6 if ( current_user_can('edit_users') ) 
    7         $parent_file = 'users.php'; 
    8 else 
    9         $parent_file = 'profile.php'; 
     9$parent_file = 'users.php'; 
    1010 
    1111$action = $_REQUEST['actio