Changeset 1005

Show
Ignore:
Timestamp:
06/21/07 16:41:02 (2 years ago)
Author:
donncha
Message:

WP Merge to WP 2.2.1

Files:

Legend:

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

    r987 r1005  
    8484        global $wpdb; 
    8585 
    86         extract($catarr); 
     86        extract($catarr, EXTR_SKIP); 
    8787 
    8888        if( trim( $cat_name ) == '' ) 
     
    125125        else 
    126126                $links_private = 0; 
    127  
    128  
    129         // Let's check if we have this category already, if so just do an update 
    130         if ( !$update && $cat_ID = category_object_exists( $category_nicename ) ) 
    131                 $update = true; 
    132127 
    133128        if (!$update) { 
     
    256251} 
    257252 
    258 function category_object_exists($cat_name) { 
    259         global $wpdb; 
    260         if (!$category_nicename = sanitize_title($cat_name)) 
    261                 return 0; 
    262  
    263         return (int) $wpdb->get_var("SELECT cat_ID FROM $wpdb->categories WHERE category_nicename = '$category_nicename'"); 
    264 } 
    265  
    266253function category_exists($cat_name) { 
    267254        global $wpdb; 
     
    315302        global $wpdb, $current_user; 
    316303 
    317         extract($linkdata); 
     304        extract($linkdata, EXTR_SKIP); 
    318305 
    319306        $update = false; 
  • trunk/wp-admin/admin-footer.php

    r972 r1005  
    33<p class="logo"><a href="http://wordpress.org/" id="wordpress-logo"><img src="images/wordpress-logo.png" alt="WordPress" /></a></p> 
    44<p class="docs"><?php _e('<a href="http://codex.wordpress.org/">Documentation</a>'); ?> &#8212; <?php _e('<a href="http://wordpress.org/support/">Support Forums</a>'); ?><br /> 
    5 <?php printf( __('Version %s'), get_bloginfo('version') ); ?></p> 
     5<?php bloginfo('version'); ?> &#8212; <?php printf(__('%s seconds'), timer_stop(0, 2)); ?></p> 
    66</div> 
    77<?php do_action('admin_footer', ''); ?> 
  • trunk/wp-admin/admin-functions.php

    r989 r1005  
    348348 
    349349        $post->post_password = format_to_edit( $post->post_password ); 
     350         
     351        $post->menu_order = (int) $post->menu_order; 
    350352 
    351353        if ( $post->post_type == 'page' ) 
     
    397399function get_comment_to_edit( $id ) { 
    398400        $comment = get_comment( $id ); 
    399  
    400         $comment->comment_content = format_to_edit( $comment->comment_content, user_can_richedit() ); 
     401         
     402        $comment->comment_ID = (int) $comment->comment_ID; 
     403        $comment->comment_post_ID = (int) $comment->comment_post_ID; 
     404 
     405        $comment->comment_content = format_to_edit( $comment->comment_content ); 
    401406        $comment->comment_content = apply_filters( 'comment_edit_pre', $comment->comment_content); 
    402407 
    403408        $comment->comment_author = format_to_edit( $comment->comment_author ); 
    404409        $comment->comment_author_email = format_to_edit( $comment->comment_author_email ); 
     410        $comment->comment_author_url = clean_url($comment->comment_author_url); 
    405411        $comment->comment_author_url = format_to_edit( $comment->comment_author_url ); 
    406412 
     
    410416function get_category_to_edit( $id ) { 
    411417        $category = get_category( $id ); 
     418         
     419        $category->term_id = (int) $category->term_id; 
     420        $category->parent = (int) $category->parent; 
    412421 
    413422        return $category; 
     
    820829        $class = ( ( defined( 'DOING_AJAX' ) && DOING_AJAX ) || " class='alternate'" == $class ) ? '' : " class='alternate'"; 
    821830 
    822         $category->category_count = number_format_i18n( $category->category_count ); 
    823         $category->link_count = number_format_i18n( $category->link_count ); 
     831        $category->category_count = number_format( $category->category_count ); 
     832        $category->link_count = number_format( $category->link_count ); 
    824833        $posts_count = ( $category->category_count > 0 ) ? "<a href='edit.php?cat=$category->cat_ID'>$category->category_count</a>" : $category->category_count; 
    825834        return "<tr id='cat-$category->cat_ID'$class> 
     
    949958if ( current_user_can('edit_post', $comment->comment_post_ID) ) { 
    950959        echo " <a href='comment.php?action=editcomment&amp;c=".$comment->comment_ID."'>" .  __('Edit') . '</a>'; 
    951         echo ' | <a href="' . wp_nonce_url('ocomment.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 '%s'.\n'Cancel' to stop, 'OK' to delete."), $comment->comment_author)) . "', theCommentList );\">" . __('Delete') . '</a> '; 
     960        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 '%s'.\n'Cancel' to stop, 'OK' to delete."), $comment->comment_author)) . "', theCommentList );\">" . __('Delete') . '</a> '; 
    952961        if ( ('none' != $comment_status) && ( current_user_can('moderate_comments') ) ) { 
    953962                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>'; 
     
    10401049                $entry['meta_key']   = attribute_escape($entry['meta_key']); 
    10411050                $entry['meta_value'] = attribute_escape($entry['meta_value']); 
     1051                $entry['meta_id'] = (int) $entry['meta_id']; 
    10421052                $r .= "\n\t<tr id='meta-{$entry['meta_id']}' class='$style'>"; 
    10431053                $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>"; 
     
    10921102 
    10931103        foreach ( $keys as $key ) { 
    1094                 $key = attribute_escape( $key); 
     1104                $key = attribute_escape( $key ); 
    10951105                echo "\n\t<option value='$key'>$key</option>"; 
    10961106        } 
     
    11131123        $post_ID = (int) $post_ID; 
    11141124 
     1125        $protected = array( '_wp_attached_file', '_wp_attachment_metadata', '_wp_old_slug', '_wp_page_template' ); 
     1126 
    11151127        $metakeyselect = $wpdb->escape( stripslashes( trim( $_POST['metakeyselect'] ) ) ); 
    11161128        $metakeyinput = $wpdb->escape( stripslashes( trim( $_POST['metakeyinput'] ) ) ); 
     
    11271139                if ( $metakeyinput) 
    11281140                        $metakey = $metakeyinput; // default 
     1141 
     1142                if ( in_array($metakey, $protected) ) 
     1143                        return false; 
    11291144 
    11301145                $result = $wpdb->query( " 
     
    11471162function update_meta( $mid, $mkey, $mvalue ) { 
    11481163        global $wpdb; 
     1164 
     1165        $protected = array( '_wp_attached_file', '_wp_attachment_metadata', '_wp_old_slug', '_wp_page_template' ); 
     1166 
     1167        if ( in_array($mkey, $protected) ) 
     1168                return false; 
     1169 
    11491170        $mvalue = maybe_serialize( stripslashes( $mvalue )); 
    11501171        $mvalue = $wpdb->escape( $mvalue ); 
     
    13461367function page_template_dropdown( $default = '' ) { 
    13471368        $templates = get_page_templates(); 
    1348         ksort( $templates ); 
    13491369        foreach (array_keys( $templates ) as $template ) 
    13501370                : if ( $default == $templates[$template] ) 
     
    19461966                extract( $wp_filetype ); 
    19471967 
    1948                 if ( ( !$type || !$ext ) && !current_user_can( 'unfiltered_upload' )
     1968                if ( !$type || !$ext
    19491969                        return $upload_error_handler( $file, __( 'File type does not meet security guidelines. Try another.' )); 
    1950                  
    1951                 if ( !$ext ) 
    1952                         $ext = strrchr($file['name'], '.'); 
    19531970        } 
    19541971 
  • trunk/wp-admin/categories.php

    r972 r1005  
    119119 
    120120<?php include('edit-category-form.php'); ?> 
    121  
    122121<?php endif; ?> 
    123122 
  • trunk/wp-admin/comment.php

    r972 r1005  
    4040        $nonce_action .= $comment; 
    4141 
    42         if ( ! $comment = get_comment($comment) ) 
     42        if ( ! $comment = get_comment_to_edit($comment) ) 
    4343                wp_die(__('Oops, no comment with this ID.').sprintf(' <a href="%s">'.__('Go back').'</a>!', 'edit.php')); 
    4444 
     
    9292<tr> 
    9393<th scope="row"><?php _e('URL:'); ?></th> 
    94 <td><?php echo "<a href='$comment->comment_author_url'>$comment->comment_author_url</a>"; ?></td> 
     94<td><?php echo $comment->comment_author_url; ?></td> 
    9595</tr> 
    9696<?php } ?> 
    9797<tr> 
    9898<th scope="row" valign="top"><p><?php _e('Comment:'); ?></p></th> 
    99 <td><?php echo apply_filters( 'comment_text', $comment->comment_content ); ?></td> 
     99<td><?php echo $comment->comment_content; ?></td> 
    100100</tr> 
    101101</table> 
     
    156156                wp_redirect(wp_get_referer()); 
    157157        } else { 
    158                 wp_redirect(get_option('siteurl') .'/wp-admin/edit.php?p='.$comment->comment_post_ID.'&c=1#comments'); 
     158                wp_redirect(get_option('siteurl') .'/wp-admin/edit.php?p='. (int) $comment->comment_post_ID.'&c=1#comments'); 
    159159        } 
    160160        exit(); 
     
    186186                wp_redirect(wp_get_referer()); 
    187187        } else { 
    188                 wp_redirect(get_option('siteurl') .'/wp-admin/edit.php?p='.$comment->comment_post_ID.'&c=1#comments'); 
     188                wp_redirect(get_option('siteurl') .'/wp-admin/edit.php?p='. (int) $comment->comment_post_ID.'&c=1#comments'); 
    189189        } 
    190190        exit(); 
  • trunk/wp-admin/edit-comments.php

    r976 r1005  
    158158?> 
    159159  <tr id="comment-<?php echo $comment->comment_ID; ?>" class='<?php echo $class; ?>'> 
    160     <td style="text-align: center"><?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) { ?><input type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" /><?php } ?></td> 
     160    <td><?php if ( current_user_can('edit_post', $comment->comment_post_ID) ) { ?><input type="checkbox" name="delete_comments[]" value="<?php echo $comment->comment_ID; ?>" /><?php } ?></td> 
    161161    <td><?php comment_author_link() ?></td> 
    162162    <td><?php comment_author_email_link() ?></td> 
  • trunk/wp-admin/edit-form-advanced.php

    r972 r1005  
    11<?php 
     2if ( isset($_GET['message']) ) 
     3          $_GET['message'] = (int) $_GET['message']; 
    24$messages[1] = __('Post updated'); 
    35$messages[2] = __('Custom field updated'); 
     
    57?> 
    68<?php if (isset($_GET['message'])) : ?> 
    7 <div id="message" class="updated fade"><p><?php echo $messages[$_GET['message']]; ?></p></div> 
     9<div id="message" class="updated fade"><p><?php echo wp_specialchars($messages[$_GET['message']]); ?></p></div> 
    810<?php endif; ?> 
    911 
     
    2224        wp_nonce_field('add-post'); 
    2325} else { 
     26        $post_ID = (int) $post_ID; 
    2427        $form_action = 'editpost'; 
    2528        $form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />"; 
     
    2730} 
    2831 
    29 $form_pingback = '<input type="hidden" name="post_pingback" value="' . get_option('default_pingback_flag') . '" id="post_pingback" />'; 
    30  
    31 $form_prevstatus = '<input type="hidden" name="prev_status" value="' . $post->post_status . '" />'; 
    32  
    33 $form_trackback = '<input type="text" name="trackback_url" style="width: 415px" id="trackback" tabindex="7" value="'. str_replace("\n", ' ', $post->to_ping) .'" />'; 
     32$form_pingback = '<input type="hidden" name="post_pingback" value="' . (int) get_option('default_pingback_flag') . '" id="post_pingback" />'; 
     33 
     34$form_prevstatus = '<input type="hidden" name="prev_status" value="' . attribute_escape( $post->post_status ) . '" />'; 
     35 
     36$form_trackback = '<input type="text" name="trackback_url" style="width: 415px" id="trackback" tabindex="7" value="'. attribute_escape( str_replace("\n", ' ', $post->to_ping) ) .'" />'; 
    3437 
    3538if ('' != $post->pinged) { 
     
    4245} 
    4346 
    44 $saveasdraft = '<input name="save" type="submit" id="save" tabindex="3" value="' . __('Save and Continue Editing') . '" />'; 
     47$saveasdraft = '<input name="save" type="submit" id="save" tabindex="3" value="' . attribute_escape( __('Save and Continue Editing') ) . '" />'; 
    4548 
    4649if (empty($post->post_status)) $post->post_status = 'draft'; 
     
    4851?> 
    4952 
    50 <input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" /> 
     53<input type="hidden" name="user_ID" value="<?php echo (int) $user_ID ?>" /> 
    5154<input type="hidden" id="hiddenaction" name="action" value="<?php echo $form_action ?>" /> 
    5255<input type="hidden" id="originalaction" name="originalaction" value="<?php echo $form_action ?>" /> 
    53 <input type="hidden" name="post_author" value="<?php echo $post->post_author ?>" /> 
     56<input type="hidden" name="post_author" value="<?php echo attribute_escape( $post->post_author ); ?>" /> 
    5457<input type="hidden" id="post_type" name="post_type" value="post" /> 
    5558 
     
    8992<fieldset id="passworddiv" class="dbx-box"> 
    9093<h3 class="dbx-handle"><?php _e('Post Password') ?></h3>  
    91 <div class="dbx-content"><input name="post_password" type="text" size="13" id="post_password" value="<?php echo $post->post_password ?>" /></div> 
     94<div class="dbx-content"><input name="post_password" type="text" size="13" id="post_password" value="<?php echo attribute_escape( $post->post_password ); ?>" /></div> 
    9295</fieldset> 
    9396 
    9497<fieldset id="slugdiv" class="dbx-box"> 
    9598<h3 class="dbx-handle"><?php _e('Post Slug') ?></h3>  
    96 <div class="dbx-content"><input name="post_name" type="text" size="13" id="post_name" value="<?php echo $post->post_name ?>" /></div> 
     99<div class="dbx-content"><input name="post_name" type="text" size="13" id="post_name" value="<?php echo attribute_escape( $post->post_name ); ?>" /></div> 
    97100</fieldset> 
    98101 
     
    126129if ( $post->post_author == $o->ID || ( empty($post_ID) && $user_ID == $o->ID ) ) $selected = 'selected="selected"'; 
    127130else $selected = ''; 
    128 echo "<option value='$o->ID' $selected>$o->display_name</option>"; 
     131echo "<option value='" . (int) $o->ID . "' $selected>" . wp_specialchars( $o->display_name ) . "</option>"; 
    129132endforeach; 
    130133?> 
     
    141144<fieldset id="titlediv"> 
    142145        <legend><?php _e('Title') ?></legend> 
    143         <div><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo $post->post_title; ?>" id="title" /></div> 
     146        <div><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo attribute_escape($post->post_title); ?>" id="title" /></div> 
    144147</fieldset> 
    145148 
     
    169172?> 
    170173<?php if ( current_user_can('publish_posts') ) : ?> 
    171         <input name="publish" type="submit" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish') ?>" />  
     174        <input name="publish" type="submit" id="publish" tabindex="5" accesskey="p" value="<?php _e('Publish'); ?>" />  
    172175<?php endif; ?> 
    173176<?php 
     
    187190<?php 
    188191if (current_user_can('upload_files')) { 
    189         $uploading_iframe_ID = (0 == $post_ID ? $temp_ID : $post_ID); 
     192        $uploading_iframe_ID = (int) (0 == $post_ID ? $temp_ID : $post_ID); 
    190193        $uploading_iframe_src = wp_nonce_url("upload.php?style=inline&amp;tab=upload&amp;post_id=$uploading_iframe_ID", 'inlineuploading'); 
    191194        $uploading_iframe_src = apply_filters('uploading_iframe_src', $uploading_iframe_src); 
    192195        if ( false != $uploading_iframe_src ) 
    193                 echo '<iframe id="uploading" name="uploading" frameborder="0" src="' . $uploading_iframe_src . '">' . __('This feature requires iframe support.') . '</iframe>'; 
     196                echo '<iframe id="uploading" frameborder="0" src="' . $uploading_iframe_src . '">' . __('This feature requires iframe support.') . '</iframe>'; 
    194197} 
    195198?> 
  • trunk/wp-admin/edit-form-comment.php

    r972 r1005  
    33$toprow_title = sprintf(__('Editing Comment # %s'), $comment->comment_ID); 
    44$form_action = 'editedcomment'; 
    5 $form_extra = "' />\n<input type='hidden' name='comment_ID' value='" . $comment->comment_ID . "' />\n<input type='hidden' name='comment_post_ID' value='".$comment->comment_post_ID; 
     5$form_extra = "' />\n<input type='hidden' name='comment_ID' value='" . $comment->comment_ID . "' />\n<input type='hidden' name='comment_post_ID' value='" . $comment->comment_post_ID; 
    66?> 
    77 
     
    99<?php wp_nonce_field('update-comment_' . $comment->comment_ID) ?> 
    1010<div class="wrap"> 
    11 <input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" /> 
     11<input type="hidden" name="user_ID" value="<?php echo (int) $user_ID ?>" /> 
    1212<input type="hidden" name="action" value='<?php echo $form_action . $form_extra ?>' /> 
    1313 
     
    2121    <legend><label for="name"><?php _e('Name:') ?></label></legend> 
    2222        <div> 
    23           <input type="text" name="newcomment_author" size="25" value="<?php echo $comment->comment_author ?>" tabindex="1" id="name" /> 
     23          <input type="text" name="newcomment_author" size="25" value="<?php echo attribute_escape( $comment->comment_author ); ?>" tabindex="1" id="name" /> 
    2424    </div> 
    2525</fieldset> 
     
    2727        <legend><label for="email"><?php _e('E-mail:') ?></label></legend> 
    2828                <div> 
    29                   <input type="text" name="newcomment_author_email" size="20" value="<?php echo $comment->comment_author_email ?>" tabindex="2" id="email" /> 
     29                  <input type="text" name="newcomment_author_email" size="20" value="<?php echo attribute_escape( $comment->comment_author_email ); ?>" tabindex="2" id="email" /> 
    3030    </div> 
    3131</fieldset> 
     
    3333        <legend><label for="newcomment_author_url"><?php _e('URL:') ?></label></legend> 
    3434                <div> 
    35                   <input type="text" id="newcomment_author_url" name="newcomment_author_url" size="35" value="<?php echo $comment->comment_author_url ?>" tabindex="3" /> 
     35                  <input type="text" id="newcomment_author_url" name="newcomment_author_url" size="35" value="<?php echo attribute_escape( $comment->comment_author_url ); ?>" tabindex="3" /> 
    3636    </div> 
    3737</fieldset> 
  • trunk/wp-admin/edit-form.php

    r828 r1005  
    77<input type="hidden" name="mode" value="bookmarklet" /> 
    88<?php endif; ?> 
    9 <input type="hidden" name="user_ID" value="<?php echo $user_ID ?>" /> 
     9<input type="hidden" name="user_ID" value="<?php echo (int) $user_ID ?>" /> 
    1010<input type="hidden" name="action" value='post' /> 
    1111 
     
    2222    <fieldset id="titlediv"> 
    2323      <legend><a href="http://wordpress.org/docs/reference/post/#title" title="<?php _e('Help on titles') ?>"><?php _e('Title') ?></a></legend>  
    24           <div><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo $post->post_title; ?>" id="title" /></div> 
     24          <div><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo attribute_escape( $post->post_title ); ?>" id="title" /></div> 
    2525    </fieldset> 
    2626 
     
    5050</script> 
    5151 
    52 <input type="hidden" name="post_pingback" value="<?php echo get_option('default_pingback_flag') ?>" id="post_pingback" /> 
     52<input type="hidden" name="post_pingback" value="<?php echo (int) get_option('default_pingback_flag') ?>" id="post_pingback" /> 
    5353 
    5454<p><label for="trackback"> <?php printf(__('<a href="%s" title="Help on trackbacks"><strong>TrackBack</strong> a <abbr title="Universal Resource Locator">URL</abbr></a>:</label> (Separate multiple <abbr title="Universal Resource Locator">URL</abbr>s with spaces.)'), 'http://wordpress.org/docs/reference/post/#trackback'); echo '<br />'; ?> 
     
    6565                echo '<input name="advanced" type="submit" id="advancededit" tabindex="7" value="' .  __('Advanced Editing &raquo;') . '" />'; 
    6666        } ?> 
    67         <input name="referredby" type="hidden" id="referredby" value="<?php if ( wp_get_referer() ) echo urlencode(wp_get_referer()); ?>" /> 
     67        <input name="referredby" type="hidden" id="referredby" value="<?php if ( $refby = wp_get_referer() ) echo urlencode($refby); ?>" /> 
    6868</p> 
    6969 
  • trunk/wp-admin/edit-link-form.php

    r972 r1005  
    8181<tr> 
    8282<th scope="row" valign="top"><label for="link_name"><?php _e('Name:') ?></label></th> 
    83 <td><input type="text" name="link_name" id="link_name" value="<?php echo $link->link_name; ?>" style="width: 95%" /></td> 
     83<td><input type="text" name="link_name" value="<?php echo $link->link_name; ?>" style="width: 95%" /></td> 
    8484</tr> 
    8585<tr> 
    8686<th width="20%" scope="row" valign="top"><label for="link_url"><?php _e('Address:') ?></label></th> 
    87 <td width="80%"><input type="text" name="link_url" id="link_url" value="<?php echo $link->link_url; if ( empty( $link->link_url ) ) echo 'http://'; ?>" style="width: 95%" /></td> 
     87<td width="80%"><input type="text" name="link_url" value="<?php echo $link->link_url; if ( empty( $link->link_url ) ) echo 'http://'; ?>" style="width: 95%" /></td> 
    8888</tr> 
    8989<tr> 
    9090<th scope="row" valign="top"><label for="link_description"><?php _e('Description:') ?></label></th> 
    91 <td><input type="text" name="link_description" id="link_description" value="<?php echo $link->link_description; ?>" style="width: 95%" /></td> 
     91<td><input type="text" name="link_description" value="<?php echo $link->link_description; ?>" style="width: 95%" /></td> 
    9292</tr> 
    9393</table> 
  • trunk/wp-admin/edit-page-form.php

    r972 r1005  
    33<h2 id="write-post"><?php _e('Write Page'); ?></h2> 
    44<?php 
     5 
    56if (0 == $post_ID) { 
    67        $form_action = 'post'; 
     
    910        $form_extra = "<input type='hidden' id='post_ID' name='temp_ID' value='$temp_ID' />"; 
    1011} else { 
     12        $post_ID = (int) $post_ID; 
    1113        $form_action = 'editpost'; 
    1214        $nonce_action = 'update-page_' . $post_ID; 
    1315        $form_extra = "<input type='hidden' id='post_ID' name='post_ID' value='$post_ID' />"; 
    1416} 
     17 
     18$temp_ID = (int) $temp_ID; 
     19$user_ID = (int) $user_ID; 
    1520 
    1621$sendto = clean_url(stripslashes(wp_get_referer())); 
     
    6974<fieldset id="passworddiv" class="dbx-box"> 
    7075<h3 class="dbx-handle"><?php _e('Page Password') ?></h3> 
    71 <div class="dbx-content"><input name="post_password" type="text" size="13" id="post_password" value="<?php echo $post->post_password ?>" /></div> 
     76<div class="dbx-content"><input name="post_password" type="text" size="13" id="post_password" value="<?php echo attribute_escape( $post->post_password ); ?>" /></div> 
    7277</fieldset> 
    7378 
     
    9499<fieldset id="slugdiv" class="dbx-box"> 
    95100<h3 class="dbx-handle"><?php _e('Page Slug') ?></h3> 
    96 <div class="dbx-content"><input name="post_name" type="text" size="13" id="post_name" value="<?php echo $post->post_name ?>" /></div> 
     101<div class="dbx-content"><input name="post_name" type="text" size="13" id="post_name" value="<?php echo attribute_escape( $post->post_name ); ?>" /></div> 
    97102</fieldset> 
    98103 
     
    107112if ( $post->post_author == $o->ID || ( empty($post_ID) && $user_ID == $o->ID ) ) $selected = 'selected="selected"'; 
    108113else $selected = ''; 
     114$o->ID = (int) $o->ID; 
     115$o->display_name = wp_specialchars( $o->display_name ); 
    109116echo "<option value='$o->ID' $selected>$o->display_name</option>"; 
    110117endforeach; 
     
    127134<fieldset id="titlediv"> 
    128135  <legend><?php _e('Page Title') ?></legend> 
    129   <div><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo $post->post_title; ?>" id="title" /></div> 
     136  <div><input type="text" name="post_title" size="30" tabindex="1" value="<?php echo attribute_escape( $post->post_title ); ?>" id="title" /></div> 
    130137</fieldset> 
    131138 
     
    164171        $uploading_iframe_src = apply_filters('uploading_iframe_src', $uploading_iframe_src); 
    165172        if ( false != $uploading_iframe_src ) 
    166                 echo '<iframe id="uploading" name="uploading" frameborder="0" src="' . $uploading_iframe_src . '">' . __('This feature requires iframe support.') . '</iframe>'; 
     173                echo '<iframe id="uploading" frameborder="0" src="' . $uploading_iframe_src . '">' . __('This feature requires iframe support.') . '</iframe>'; 
    167174} 
    168175?> 
  • trunk/wp-admin/edit-pages.php

    r972 r1005  
    1111<p><?php _e('Pages are like posts except they live outside of the normal blog chronology and can be hierarchical. You can use pages to organize and manage any amount of content.'); ?> <a href="page-new.php"><?php _e('Create a new page &raquo;'); ?></a></p> 
    1212 
    13 <form name="searchform" id="searchform" action="" method="get"> 
     13<form name="searchform" action="" method="get"> 
    1414        <fieldset> 
    1515        <legend><?php _e('Search Pages&hellip;') ?></legend> 
    16         <input type="text" name="s" id="s" value="<?php if (isset($_GET['s'])) echo attribute_escape($_GET['s']); ?>" size="17" /> 
     16        <input type="text" name="s" value="<?php if (isset($_GET['s'])) echo attribute_escape($_GET['s']); ?>" size="17" /> 
    1717        <input type="submit" name="submit" value="<?php _e('Search') ?>"  /> 
    1818        </fieldset> 
    1919</form> 
    20  
    21 <br style="clear:both;" /> 
    2220 
    2321<?php 
  • trunk/wp-admin/edit.php

    r972 r1005  
    7777  <fieldset>  
    7878  <legend><?php _e('Search Posts&hellip;') ?></legend>  
    79   <input type="text" name="s" id="s" value="<?php if (isset($s)) echo attribute_escape($s); ?>" size="17" />  
     79  <input type="text" name="s" value="<?php if (isset($s)) echo attribute_escape($s); ?>" size="17" />  
    8080  <input type="submit" name="submit" value="<?php _e('Search') ?>" class="button" />  
    8181  </fieldset> 
     
    197197                ?> 
    198198                <td style="text-align: center"> 
    199                         <?php comments_number("<a href='edit.php?p=$id&amp;c=1'>" . __('0') . '</a>', "<a href='edit.php?p=$id&amp;c=1'>" . __('1') . '</a>', "<a href='edit.php?p=$id&amp;c=1'>" . __('%') . '</a>') ?> 
     199                        <?php comments_number(__('0'), "<a href='edit.php?p=$id&amp;c=1'>" . __('1') . '</a>', "<a href='edit.php?p=$id&amp;c=1'>" . __('%') . '</a>') ?> 
    200200                        </td> 
    201201                <?php 
  • trunk/wp-admin/export.php

    r972 r1005  
    149149--> 
    150150 
    151 <!-- generator="wordpress/<?php bloginfo_rss('version') ?>" created="<?php echo date('Y-m-d H:m'); ?>"--> 
     151<!-- generator="wordpress/<?php bloginfo_rss('version') ?>" created="<?php echo date('Y-m-d H:i'); ?>"--> 
    152152<rss version="2.0" 
    153153        xmlns:content="http://purl.org/rss/1.0/modules/content/" 
  • trunk/wp-admin/import/livejournal.php

    r972 r1005  
    5050                        preg_match('|<eventtime>(.*?)</eventtime>|is', $post, $post_date); 
    5151                        $post_date = strtotime($post_date[1]); 
    52                         $post_date = date('Y-m-d H:i:s', $post_date); 
     52                        $post_date = gmdate('Y-m-d H:i:s', $post_date); 
    5353 
    5454                        preg_match('|<event>(.*?)</event>|is', $post, $post_content); 
  • trunk/wp-admin/import/textpattern.php

    r972 r1005  
    560560                echo '<p>'.__('Welcome to WordPress.  We hope (and expect!) that you will find this platform incredibly rewarding!  As a new WordPress user coming from Textpattern, there are some things that we would like to point out.  Hopefully, they will help your transition go as smoothly as possible.').'</p>'; 
    561561                echo '<h3>'.__('Users').'</h3>'; 
    562                 echo '<p>'.sprintf(__('You have already setup WordPress and have been assigned an administrative login and password.  Forget it.  You didn&#8217;t have that login in Textpattern, why should you have it here?  Instead we have taken care to import all of your users into our system.  Unfortunately there is one downside.  Because both WordPress and Textpattern uses a strong encryption hash with passwords, it is impossible to decrypt it and we are forced to assign temporary passwords to all your users.  <strong>Every user has the same username, but their passwords are reset to password123.</strong>  So <a href="%1$s">Login</a> and change it.'), get_bloginfo( 'wpurl' ) . '/wp-login.php').'</p>'; 
     562                echo '<p>'.sprintf(__('You have already setup WordPress and have been assigned an administrative login and password.  Forget it.  You didn\'t have that login in Textpattern, why should you have it here?  Instead we have taken care to import all of your users into our system.  Unfortunately there is one downside.  Because both WordPress and Textpattern uses a strong encryption hash with passwords, it is impossible to decrypt it and we are forced to assign temporary passwords to all your users.  <strong>Every user has the same username, but their passwords are reset to password123.</strong>  So <a href="%1$s">Login</a> and change it.'), '/wp-login.php').'</p>'; 
    563563                echo '<h3>'.__('Preserving Authors').'</h3>'; 
    564564                echo '<p>'.__('Secondly, we have attempted to preserve post authors.  If you are the only author or contributor to your blog, then you are safe.  In most cases, we are successful in this preservation endeavor.  However, if we cannot ascertain the name of the writer due to discrepancies between database tables, we assign it to you, the administrative user.').'</p>'; 
    565565                echo '<h3>'.__('Textile').'</h3>'; 
    566                 echo '<p>'.__('Also, since you&#8217;re coming from Textpattern, you probably have been using Textile to format your comments and posts.  If this is the case, we recommend downloading and installing <a href="http://www.huddledmasses.org/category/development/wordpress/textile/">Textile for WordPress</a>.  Trust me... You&#8217;ll want it.').'</p>'; 
     566                echo '<p>'.__('Also, since you\'re coming from Textpattern, you probably have been using Textile to format your comments and posts.  If this is the case, we recommend downloading and installing <a href="http://www.huddledmasses.org/category/development/wordpress/textile/">Textile for WordPress</a>.  Trust me... You\'ll want it.').'</p>'; 
    567567                echo '<h3>'.__('WordPress Resources').'</h3>'; 
    568568                echo '<p>'.__('Finally, there are numerous WordPress resources around the internet.  Some of them are:').'</p>'; 
     
    572572                echo '<li>'.__('<a href="http://codex.wordpress.org">The Codex (In other words, the WordPress Bible)</a>').'</li>'; 
    573573                echo '</ul>'; 
    574                 echo '<p>'.sprintf(__('That&#8217;s it! What are you waiting for? Go <a href="%1$s">login</a>!'), get_bloginfo( 'wpurl' ) . '/wp-login.php').'</p>'; 
     574                echo '<p>'.sprintf(__('That\'s it! What are you waiting for? Go <a href="%1$s">login</a>!'), '/wp-login.php').'</p>'; 
    575575        } 
    576576 
  • trunk/wp-admin/index.php

    r972 r1005  
    4444 
    4545<?php if ( $numcomments ) : ?> 
    46 <p><strong><a href="moderation.php"><?php echo sprintf(__('Comments in moderation (%s)'), number_format_i18n($numcomments) ); ?> &raquo;</a></strong></p> 
     46<p><strong><a href="moderation.php"><?php echo sprintf(__('Comments in moderation (%s)'), number_format($numcomments) ); ?> &raquo;</a></strong></p> 
    4747<?php endif; ?> 
    4848 
     
    104104$numcats  = (int) $wpdb->get_var("SELECT COUNT(*) FROM $wpdb->categories"); 
    105105 
    106 $post_str = sprintf(__ngettext('%1$s <a href="%2$s" title="Posts">post</a>', '%1$s <a href="%2$s" title="Posts">posts</a>', $numposts), number_format_i18n($numposts), 'edit.php'); 
    107 $comm_str = sprintf(__ngettext('%1$s <a href="%2$s" title="Comments">comment</a>', '%1$s <a href="%2$s" title="Comments">comments</a>', $numcomms), number_format_i18n($numcomms), 'edit-comments.php'); 
    108 $cat_str  = sprintf(__ngettext('%1$s <a href="%2$s" title="Categories">category</a>', '%1$s <a href="%2$s" title="Categories">categories</a>', $numcats), number_format_i18n($numcats), 'categories.php'); 
     106$post_str = sprintf(__ngettext('%1$s <a href="%2$s" title="Posts">post</a>', '%1$s <a href="%2$s" title="Posts">posts</a>', $numposts), number_format($numposts), 'edit.php'); 
     107$comm_str = sprintf(__ngettext('%1$s <a href="%2$s" title="Comments">comment</a>', '%1$s <a href="%2$s" title="Comments">comments</a>', $numcomms), number_format($numcomms), 'edit-comments.php'); 
     108$cat_str  = sprintf(__ngettext('%1$s <a href="%2$s" title="Categories">category</a>', '%1$s <a href="%2$s" title="Categories">categories</a>', $numcats), number_format($numcats), 'categories.php'); 
    109109?> 
    110110 
  • trunk/wp-admin/link-manager.php

    r972 r1005  
    200200 
    201201<?php } ?> 
    202 <?php 
    203 if( wp_cache_get( "checked_bookmarks_table", "options" ) == false ) { 
    204         $results = $wpdb->get_results( "SELECT link_id, category_id, count( * ) AS c FROM {$wpdb->link2cat} GROUP BY link_id, category_id" ); 
    205         if( $results != null ) { 
    206                 foreach( $results as $link ) { 
    207                         if( $link->c > 1 ) { 
    208                                 $wpdb->query( "DELETE FROM {$wpdb->link2cat} WHERE link_id='{$link->link_id}' AND category_id='{$link->category_id}'" ); 
    209                                 $wpdb->query( "INSERT INTO {$wpdb->link2cat} VALUES ( 0, '{$link->link_id}', '{$link->category_id}' )" ); 
    210                         } 
    211                 } 
    212         } 
    213         wp_cache_set( "checked_bookmarks_table", "1", "options" ); 
    214 } ?> 
    215202 
    216203</div> 
  • trunk/wp-admin/moderation.php

    r972 r1005  
    124124<p><?php comment_date(__('M j, g:i A')); ?> &#8212; [ <?php 
    125125echo '<a href="comment.php?action=editcomment&amp;c='.$comment->comment_ID.'">' . __('Edit') . '</a> | '; 
    126 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, '" . 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> "; ?> ] &#8212; 
     126echo " <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 '%s'.\n'Cancel' to stop, 'OK' to delete."), $comment->comment_author )) . "', theCommentList );\">" . __('Delete') . "</a> | "; ?> 
    127127<?php 
    128128$post = get_post($comment->comment_post_ID); 
     
    130130$post_title = ('' == $post_title) ? "# $comment->comment_post_ID" : $post_title; 
    131131?> 
    132 <a href="<?php echo get_permalink($comment->comment_post_ID); ?>"><?php echo $post_title; ?></a></p> 
    133 <p><?php _e('Bulk action:') ?> 
     132<a href="<?php echo get_permalink($comment->comment_post_ID); ?>" title="<?php echo $post_title; ?>"><?php _e('View Post') ?></a> ] &#8212; 
     133 <?php _e('Bulk action:') ?> 
    134134        <input type="radio" name="comment[<?php echo $comment->comment_ID; ?>]" id="comment-<?php echo $comment->comment_ID; ?>-approve" value="approve" /> <label for="comment-<?php echo $comment->comment_ID; ?>-approve"><?php _e('Approve') ?></label> &nbsp; 
    135135        <input type="radio" name="comment[<?php echo $comment->comment_ID; ?>]" id="comment-<?php echo $comment->comment_ID; ?>-spam" value="spam" /> <label for="comment-<?php echo $comment->comment_ID; ?>-spam"><?php _e('Spam') ?></label> &nbsp; 
     
    183183<noscript> 
    184184        <p> 
    185                 <input name="feelinglucky" type="checkbox" id="feelinglucky" value="true" /> <label for="feelinglucky"><?php _e('Delete every comment marked &#8220;defer.&#8221; <strong>Warning: This can&#8217;t be undone.</strong>'); ?></label> 
     185                <input name="feelinglucky" type="checkbox" id="feelinglucky" value="true" /> <label for="feelinglucky"><?php _e('Delete every comment marked "defer." <strong>Warning: This can&#8217;t be undone.</strong>'); ?></label> 
    186186        </p> 
    187187</noscript> 
  • trunk/wp-admin/options-reading.php

    r873 r1005  
    66 
    77include('admin-header.php'); 
    8  
    9 // Sanity checks 
    10 if ( 'page' == get_option('show_on_front') ) { 
    11         $front_page = get_option('page_on_front'); 
    12         if ( empty($front_page) ) { 
    13                 update_option('show_on_front', 'posts'); 
    14                 delete_option('page_for_posts'); 
    15                 delete_option('page_on_front'); 
    16         } 
    17 } 
    188?> 
    199 
  • trunk/wp-admin/plugins.php

    r981 r1005  
    139139                if ( $style != '' ) 
    140140                        $style = 'class="' . $style . '"'; 
    141                 $edit = ''; 
     141                if ( is_writable(ABSPATH . PLUGINDIR . '/' . $plugin_file) ) 
     142                        $edit = "<a href='plugin-editor.php?file=$plugin_file' title='".__('Open this file in the Plugin Editor')."' class='edit'>".__('Edit')."</a>"; 
     143                else 
     144                        $edit = ''; 
    142145 
    143146                echo " 
  • trunk/wp-admin/post-new.php

    r972 r1005  
    1111if ( ! current_user_can('edit_posts') ) { ?> 
    1212<div class="wrap"> 
    13 <p><?php printf(__('Since you&#8217;re a newcomer, you&#8217;ll have to wait for an admin to add the <code>edit_posts</code> capability to your user, in order to be authorized to post.<br /> 
     13<p><?php printf(__('Since you&#8217;re a newcomer, you&#8217;ll have to wait for an admin to raise your level to 1, in order to be authorized to post.<br /> 
    1414You can also <a href="mailto:%s?subject=Promotion?">e-mail the admin</a> to ask for a promotion.<br /> 
    1515When you&#8217;re promoted, just reload this page and you&#8217;ll be able to blog. :)'), get_option('admin_email')); ?> 
     
    5858<div id="wp-bookmarklet" class="wrap"> 
    5959<h3><?php _e('WordPress Bookmarklet'); ?></h3> 
    60 <p><?php _e('Right click on the following link and choose &#0147;Bookmark This Link...&#0148; or &#0147;Add to Favorites...&#0148; to create a posting shortcut.'); ?></p> 
     60<p><?php _e('Right click on the following link and choose "Add to favorites" to create a posting shortcut.'); ?></p> 
    6161<p> 
    6262 
  • trunk/wp-admin/upgrade-functions.php

    r992 r1005  
    176176                upgrade_130(); 
    177177        } 
     178         
     179        maybe_disable_automattic_widgets(); 
    178180 
    179181        if ( $wp_current_db_version < 3308 ) 
     
    185187        if ( $wp_current_db_version < 4351 ) 
    186188                upgrade_old_slugs(); 
    187          
    188         maybe_disable_automattic_widgets(); 
    189189 
    190190        $wp_rewrite->flush_rules(); 
  • trunk/wp-admin/user-edit.php

    r972 r1005  
    8383<?php wp_nonce_field('update-user_' . $user_id) ?> 
    8484<?php if ( $wp_http_referer ) : ?> 
    85         <input type="hidden" name="wp_http_referer" value="<?php echo wp_specialchars($wp_http_referer); ?>" /> 
     85        <input type="hidden" name="wp_http_referer" value="<?php echo clean_url($wp_http_referer); ?>" /> 
    8686<?php endif; ?> 
    8787<p> 
  • trunk/wp-admin/users.php

    r938 r1005  
    512512        <th colspan="7"><h3><?php echo $wp_roles->role_names[$role]; ?></h3></th> 
    513513<?php else : ?> 
    514         <th colspan="7"><h3><em><?php _e('No role for this blog'); ?></h3></th> 
     514        <th colspan="7"><h3><em><?php _e('No role for this blog'); ?></em></h3></th> 
    515515<?php endif; ?> 
    516516</tr> 
  • trunk/wp-admin/widgets.php

    r972 r1005  
    6969                //for ( var n in Draggables.drags ) { 
    7070                for ( n=0; n<=Draggables.drags.length; n++ ) { 
    71                         if ( Draggables.drags[n].element.id == 'lastmodule' ) { 
    72                                 Draggables.drags[n].destroy(); 
    73                                 break; 
     71                        if ( parseInt( n ) ) { 
     72                                if ( Draggables.drags[n].element.id == 'lastmodule' ) { 
     73                                        Draggables.drags[n].destroy(); 
     74                                        break; 
     75                                } 
    7476                        } 
    7577                } 
  • trunk/wp-admin/wp-admin.css

    r972 r1005  
    121121 
    122122a:hover { 
     123/*      border-bottom: 1px solid #3a75ae;*/ 
    123124        color: #069; 
    124125} 
     
    132133 
    133134body, td { 
    134         font: 13px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana, sans-serif
     135        font: 13px "Lucida Grande", "Lucida Sans Unicode", Tahoma, Verdana
    135136} 
    136137 
     
    170171 
    171172h2 { 
     173        border-bottom: .5em solid #e5f3ff; 
    172174        color: #333; 
    173         font: normal 32px serif; 
     175        font: normal 32px/5px serif; 
    174176        margin: 5px 10px; 
    175         background: url( images/heading-bg.gif ) repeat-x bottom; 
    176177} 
    177178 
     
    437438 
    438439.wrap h2 { 
    439         margin: 0 0 .5em; 
     440        margin: .4em 0 .5em; 
    440441        clear: both; 
    441442} 
     
    538539} 
    539540 
    540 #postdiv, #titlediv, #guiddiv, #tagdiv
     541#postdiv, #titlediv, #guiddiv
    541542        margin: 0 8px 0 0; 
    542543        padding: 0; 
     
    558559} 
    559560 
    560 #titlediv input, #guiddiv input, #tagdiv input
     561#titlediv input, #guiddiv input
    561562        margin: 0; 
    562563        width: 100%; 
     
    912913 
    913914#zeitgeist h2, fieldset legend a { 
    914         background: none; 
     915        border-bottom: none; 
    915916} 
    916917 
    917918* html #zeitgeist h2 { 
    918919        padding-top: 10px; 
     920} 
     921 
     922#zeitgeist h2 { 
     923        margin-top: .4em; 
    919924} 
    920925 
  • trunk/wp-config-sample.php

    r995 r1005  
    1919// chosen language must be installed to wp-content/languages. 
    2020// For example, install de.mo to wp-content/languages and set WPLANG to 'de' 
    21 // to enable language support. 
     21// to enable German language support. 
    2222define('WPLANG', ''); 
    2323// uncomment this to enable wp-content/sunrise.php support 
  • trunk/wp-content/themes/classic/style.css

    r972 r1005  
    4949body { 
    5050        background: #fff; 
    51         border: 2px solid #565; 
    52         border-bottom: 1px solid #565; 
    53         border-top: 3px solid #565; 
     51        border: solid 2px #565; 
     52        border-bottom: solid 1px #565; 
     53        border-top: solid 3px #565; 
    5454        color: #000; 
    5555        font-family: 'Lucida Grande', 'Lucida Sans Unicode', Verdana, sans-serif; 
     
    7272 
    7373h3 { 
    74         border-bottom: 1px dotted #eee; 
     74        border-bottom: dotted 1px #eee; 
    7575        font-family: "Times New Roman", Times, serif; 
    7676        margin-top: 0; 
     
    9797.credit { 
    9898        background: #90a090; 
    99         border-top: 3px double #aba; 
     99        border-top: double 3px #aba; 
    100100        color: #fff; 
    101101        font-size: 11px; 
     
    167167#header { 
    168168        background: #90a090; 
    169         border-bottom: 3px double #aba; 
    170         border-left: 1px solid #9a9; 
    171         border-right: 1px solid #565; 
    172         border-top: 1px solid #9a9; 
     169        border-bottom: double 3px #aba; 
     170        border-left: solid 1px #9a9; 
     171        border-right: solid 1px #565; 
     172        border-top: solid 1px #9a9; 
    173173        font: italic normal 230% 'Times New Roman', Times, serif; 
    174174        letter-spacing: 0.2em; 
     
    189189        background: #fff; 
    190190        border-left: 1px dotted #ccc; 
    191         border-top: 3px solid #e0e6e0; 
     191        border-top: solid 3px #e0e6e0; 
    192192        padding: 20px 0 10px 30px; 
    193193        position: absolute; 
  • trunk/wp-content/themes/default/archive.php

    r972 r1005  
    55                <?php if (have_posts()) : ?> 
    66 
    7         <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?> 
    8          <?php /* If this is a category archive */ if (is_category()) { ?> 
     7                <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?> 
     8<?php /* If this is a category archive */ if (is_category()) { ?> 
    99                <h2 class="pagetitle">Archive for the &#8216;<?php single_cat_title(); ?>&#8217; Category</h2> 
    1010 
    1111          <?php /* If this is a daily archive */ } elseif (is_day()) { ?> 
    1212                <h2 class="pagetitle">Archive for <?php the_time('F jS, Y'); ?></h2> 
    13           <?php /* If this is a monthly archive */ } elseif (is_month()) { ?> 
     13 
     14         <?php /* If this is a monthly archive */ } elseif (is_month()) { ?> 
    1415                <h2 class="pagetitle">Archive for <?php the_time('F, Y'); ?></h2> 
    15           <?php /* If this is a yearly archive */ } elseif (is_year()) { ?> 
     16 
     17                <?php /* If this is a yearly archive */ } elseif (is_year()) { ?> 
    1618                <h2 class="pagetitle">Archive for <?php the_time('Y'); ?></h2> 
     19 
    1720          <?php /* If this is an author archive */ } elseif (is_author()) { ?> 
    1821                <h2 class="pagetitle">Author Archive</h2> 
    19           <?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?> 
     22 
     23                <?php /* If this is a paged archive */ } elseif (isset($_GET['paged']) && !empty($_GET['paged'])) { ?> 
    2024                <h2 class="pagetitle">Blog Archives</h2> 
    21           <?php } ?> 
     25 
     26                <?php } ?> 
    2227 
    2328 
  • trunk/wp-content/themes/default/functions.php

    r972 r1005  
    385385                </div> 
    386386                <div id="jsForm"> 
    387                         <form style="display:inline;" method="post" name="hicolor" id="hicolor" action="<?php echo $_SERVER['REQUEST_URI']; ?>"> 
     387                        <form style="display:inline;" method="post" name="hicolor" id="hicolor" action="<?php echo attribute_escape($_SERVER['REQUEST_URI']); ?>"> 
    388388                                <?php wp_nonce_field('kubrick-header'); ?> 
    389389        <input type="button" onclick="tgt=document.getElementById('fontcolor');colorSelect(tgt,'pick1');return false;" name="pick1" id="pick1" value="<?php echo attribute_escape(__('Font Color')); ?>"></input> 
  • trunk/wp-content/themes/default/sidebar.php

    r972 r1005  
    33                        <?php   /* Widgetized sidebar, if you have the plugin installed. */ 
    44                                        if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar() ) : ?> 
    5 <?php if ( function_exists('dynamic_sidebar') && dynamic_sidebar() ) : ?> 
    6  
    7                 </ul> 
    8         </div> 
    9 <?php return; ?> 
    10  
    11 <?php endif; ?> 
    12                          
    135                        <li> 
    146                                <?php include (TEMPLATEPATH . '/searchform.php'); ?> 
  • trunk/wp-includes/author-template.php

    r972 r1005  
    176176        global $wpdb; 
    177177         
    178         $defaults = array(  
    179                 'optioncount' => false, 'exclude_admin' => true,  
    180                 'show_fullname' => false, 'hide_empty' => true,  
    181                 'feed' => '', 'feed_image' => '' 
    182         ); 
    183          
    184         $r = wp_parse_args( $args, $defaults ); 
    185         extract($r); 
     178        if ( is_array($args) ) 
     179                $r = &$args; 
     180        else 
     181                parse_str($args, $r); 
     182 
     183        $defaults = array('optioncount' => false, 'exclude_admin' => true, 'show_fullname' => false, 'hide_empty' => true, 
     184                'feed' => '', 'feed_image' => ''); 
     185        $r = array_merge($defaults, $r); 
     186        extract($r, EXTR_SKIP); 
    186187         
    187188        // TODO:  Move select to get_authors(). 
  • trunk/wp-includes/bookmark-template.php

    r972 r1005  
    1010function wp_get_links($args = '') { 
    1111        global $wpdb; 
    12          
    13         if ( strpos( $args, '=' ) === false ) { 
     12 
     13        if ( empty($args) ) 
     14                return; 
     15 
     16        if ( false === strpos($args, '=') ) { 
    1417                $cat_id = $args; 
    15                 $args = add_query_arg( 'category', $cat_id, $args ); 
    16         } 
    17          
    18         $defaults = array( 
    19                 'category' => -1, 'before' => '',  
    20                 'after' => '<br />', 'between' => ' ',  
    21                 'show_images' => true, 'orderby' => 'name',  
    22                 'show_description' => true, 'show_rating' => false,  
    23                 'limit' => -1, 'show_updated' => true,  
    24                 'echo' => true 
    25         ); 
    26          
    27         $r = wp_parse_args( $args, $defaults ); 
    28         extract( $r ); 
     18                $args = add_query_arg('category', $cat_id, $args); 
     19        } 
     20 
     21        parse_str($args); 
     22 
     23        if ( !isset($category) )         $category = -1; 
     24        if ( !isset($before) )           $before = ''; 
     25        if ( !isset($after) )            $after = '<br />'; 
     26        if ( !isset($between) )          $between = ' '; 
     27        if ( !isset($show_images) )      $show_images = true; 
     28        if ( !isset($orderby) )          $orderby = 'name'; 
     29        if ( !isset($show_description) ) $show_description = true; 
     30        if ( !isset($show_rating) )      $show_rating = false; 
     31        if ( !isset($limit) )            $limit = -1; 
     32        if ( !isset($show_updated) )     $show_updated = 1; 
     33        if ( !isset($echo) )             $echo = true; 
    2934 
    3035        return get_links($category, $before, $after, $between, $show_images, $orderby, $show_description, $show_rating, $limit, $show_updated, $echo); 
     
    241246 
    242247function _walk_bookmarks($bookmarks, $args = '' ) { 
    243         $defaults = array( 
    244                 'show_updated' => 0, 'show_description' => 0,  
    245                 'show_images' => 1, 'before' => '<li>',  
    246                 'after' => '</li>', 'between' => "\n" 
    247         ); 
    248          
    249         $r = wp_parse_args( $args, $defaults ); 
    250         extract( $r ); 
     248        if ( is_array($args) ) 
     249                $r = &$args; 
     250        else 
     251                parse_str($args, $r); 
     252 
     253        $defaults = array('show_updated' => 0, 'show_description' => 0, 'show_images' => 1, 'before' => '<li>', 
     254                'after' => '</li>', 'between' => "\n"); 
     255        $r = array_merge($defaults, $r); 
     256        extract($r, EXTR_SKIP); 
    251257 
    252258        foreach ( (array) $bookmarks as $bookmark ) { 
     
    315321 
    316322function wp_list_bookmarks($args = '') { 
    317         $defaults = array( 
    318                 'orderby' => 'name', 'order' => 'ASC',  
    319                 'limit' => -1, 'category' => '',  
    320                 'category_name' => '', 'hide_invisible' => 1,  
    321                 'show_updated' => 0, 'echo' => 1,  
    322                 'categorize' => 1, 'title_li' => __('Bookmarks'),  
    323                 'title_before' => '<h2>', 'title_after' => '</h2>',  
    324                 'category_orderby' => 'name', 'category_order' => 'ASC',  
    325                 'class' => 'linkcat', 'category_before' => '<li id="%id" class="%class">',  
    326                 'category_after' => '</li>' 
    327         ); 
    328          
    329         $r = wp_parse_args( $args, $defaults ); 
    330         extract( $r ); 
     323        if ( is_array($args) ) 
     324                $r = &$args; 
     325        else 
     326                parse_str($args, $r); 
     327 
     328        $defaults = array('orderby' => 'name', 'order' => 'ASC', 'limit' => -1, 'category' => '', 
     329                'category_name' => '', 'hide_invisible' => 1, 'show_updated' => 0, 'echo' => 1, 
     330                'categorize' => 1, 'title_li' => __('Bookmarks'), 'title_before' => '<h2>', 'title_after' => '</h2>', 
     331                'category_orderby' => 'name', 'category_order' => 'ASC', 'class' => 'linkcat', 
     332                'category_before' => '<li id="%id" class="%class">', 'category_after' => '</li>'); 
     333        $r = array_merge($defaults, $r); 
     334        extract($r, EXTR_SKIP); 
    331335 
    332336        $output = ''; 
  • trunk/wp-includes/bookmark.php

    r972 r1005  
    2626function get_bookmarks($args = '') { 
    2727        global $wpdb; 
    28          
    29         $defaults = array( 
    30                 'orderby' => 'name', 'order' => 'ASC',  
    31                 'limit' => -1, 'category' => '',  
    32                 'category_name' => '', 'hide_invisible' => 1,  
    33                 'show_updated' => 0, 'include' => '',  
    34                 'exclude' => '' 
    35         ); 
    36          
    37         $r = wp_parse_args( $args, $defaults ); 
    38         extract( $r ); 
     28 
     29        if ( is_array($args) ) 
     30                $r = &$args; 
     31        else 
     32                parse_str($args, $r); 
     33 
     34        $defaults = array('orderby' => 'name', 'order' => 'ASC', 'limit' => -1, 'category' => '', 
     35                'category_name' => '', 'hide_invisible' => 1, 'show_updated' => 0, 'include' => '', 'exclude' => ''); 
     36        $r = array_merge($defaults, $r); 
     37        extract($r, EXTR_SKIP); 
    3938 
    4039        $key = md5( serialize( $r ) ); 
  • trunk/wp-includes/category-template.php

    r972 r1005  
    8585function _get_the_category_usort($a, $b) { 
    8686        return strcmp($a->category_name, $b->category_name); 
     87} 
     88 
     89function _get_the_category_usort_by_ID($a, $b) { 
     90        if ( $a->cat_ID > $b->cat_ID ) 
     91                return 1; 
     92        elseif ( $a->cat_ID < $b->cat_ID ) 
     93                return -1; 
     94        else 
     95                return 0; 
    8796} 
    8897 
     
    173182 
    174183function wp_dropdown_categories($args = '') { 
    175         $defaults = array( 
    176                 'show_option_all' => '', 'show_option_none' => '',  
    177                'orderby' => 'ID', 'order' => 'ASC',  
    178                 'show_last_update' => 0, 'show_count' => 0,  
    179                 'hide_empty' => 1, 'child_of' => 0,  
    180                'exclude' => '', 'echo' => 1,  
    181                 'selected' => 0, 'hierarchical' => 0,  
    182                 'name' => 'cat', 'class' => 'postform' 
    183         ); 
    184          
     184        if ( is_array($args) ) 
     185                $r = &$args; 
     186        else 
     187                parse_str($args, $r); 
     188 
     189        $defaults = array('show_option_all' => '', 'show_option_none' => '', 'orderby' => 'ID', 
     190                'order' => 'ASC', 'show_last_update' => 0, 'show_count' => 0, 
     191                'hide_empty' => 1, 'child_of' => 0, 'exclude' => '', 'echo' => 1, 
     192               'selected' => 0, 'hierarchical' => 0, 'name' => 'cat', 
     193               'class' => 'postform'); 
    185194        $defaults['selected'] = ( is_category() ) ? get_query_var('cat') : 0; 
    186          
    187         $r = wp_parse_args( $args, $defaults ); 
     195        $r = array_merge($defaults, $r); 
    188196        $r['include_last_update_time'] = $r['show_last_update']; 
    189         extract( $r ); 
     197        extract($r, EXTR_SKIP); 
    190198 
    191199        $categories = get_categories($r); 
     
    223231 
    224232function wp_list_categories($args = '') { 
    225         $defaults = array( 
    226                 'show_option_all' => '', 'orderby' => 'name',  
    227                 'order' => 'ASC', 'show_last_update' => 0,  
    228                 'style' => 'list', 'show_count' => 0,  
    229                 'hide_empty' => 1, 'use_desc_for_title' => 1,  
    230                 'child_of' => 0, 'feed' => '',  
    231                 'feed_image' => '', 'exclude' => '',  
    232                 'hierarchical' => true, 'title_li' => __('Categories') 
    233         ); 
    234          
    235         $r = wp_parse_args( $args, $defaults ); 
    236          
    237         if ( !isset( $r['pad_counts'] ) && $r['show_count'] && $r['hierarchical'] ) { 
     233        if ( is_array($args) ) 
     234                $r = &$args; 
     235        else 
     236                parse_str($args, $r); 
     237 
     238        $defaults = array('show_option_all' => '', 'orderby' => 'name', 
     239                'order' => 'ASC', 'show_last_update' => 0, 'style' => 'list', 
     240                'show_count' => 0, 'hide_empty' => 1, 'use_desc_for_title' => 1, 
     241                'child_of' => 0, 'feed' => '', 'feed_image' => '', 'exclude' => '', 
     242                'hierarchical' => true, 'title_li' => __('Categories')); 
     243        $r = array_merge($defaults, $r); 
     244        if ( !isset($r['pad_counts']) && $r['show_count'] && $r['hierarchical'] ) 
    238245                $r['pad_counts'] = true; 
    239         } 
    240          
    241         if ( isset( $r['show_date'] ) ) { 
     246        if ( isset($r['show_date']) ) 
    242247                $r['include_last_update_time'] = $r['show_date']; 
    243         } 
    244          
    245         extract( $r ); 
    246          
     248        extract($r, EXTR_SKIP); 
     249 
    247250        $categories = get_categories($r); 
    248251 
  • trunk/wp-includes/category.php

    r972 r1005  
    66        if ( ! $cat_ids = wp_cache_get('all_category_ids', 'category') ) { 
    77                $cat_ids = $wpdb->get_col("SELECT cat_ID FROM $wpdb->categories"); 
    8                 wp_cache_set('all_category_ids', $cat_ids, 'category'); 
     8                wp_cache_add('all_category_ids', $cat_ids, 'category'); 
    99        } 
    1010 
     
    1414function &get_categories($args = '') { 
    1515        global $wpdb, $category_links; 
    16          
    17         $defaults = array( 
    18                 'type' => 'post', 'child_of' => 0,  
    19                 'orderby' => 'name', 'order' => 'ASC',  
    20                 'hide_empty' => true, 'include_last_update_time' => false,  
    21                 'hierarchical' => 1, 'exclude' => '',  
    22                 'include' => '', 'number' => '',  
    23                 'pad_counts' => false 
    24         ); 
    25          
    26         $r = wp_parse_args( $args, $defaults ); 
    27          
    28         if ( $r['orderby'] == 'count' ) { 
     16 
     17        if ( is_array($args) ) 
     18                $r = &$args; 
     19        else 
     20                parse_str($args, $r); 
     21 
     22        $defaults = array('type' => 'post', 'child_of' => 0, 'orderby' => 'name', 'order' => 'ASC', 
     23                'hide_empty' => true, 'include_last_update_time' => false, 'hierarchical' => 1, 'exclude' => '', 'include' => '', 
     24                'number' => '', 'pad_counts' => false); 
     25        $r = array_merge($defaults, $r); 
     26        if ( 'count' == $r['orderby'] ) 
    2927                $r['orderby'] = 'category_count'; 
    30         } else { 
    31                 $r['orderby'] = 'cat_' . $r['orderby']; 
    32         } 
    33          
    34         extract( $r ); 
     28        else 
     29                $r['orderby'] = "cat_" . $r['orderby'];  // restricts order by to cat_ID and cat_name fields 
     30        $r['number'] = (int) $r['number']; 
     31        extract($r, EXTR_SKIP); 
    3532 
    3633        $key = md5( serialize( $r ) ); 
     
    8380        } 
    8481 
    85          
    86  
    8782        if ( !empty($number) ) 
    8883                $number = 'LIMIT ' . $number; 
     
    138133 
    139134        $cache[ $key ] = $categories; 
    140         wp_cache_set( 'get_categories', $cache, 'category' ); 
     135        wp_cache_add( 'get_categories', $cache, 'category' ); 
    141136 
    142137        $categories = apply_filters('get_categories', $categories, $r); 
     
    159154                if ( ! $_category = wp_cache_get($category, 'category') ) { 
    160155                        $_category = $wpdb->get_row("SELECT * FROM $wpdb->categories WHERE cat_ID = '$category' LIMIT 1"); 
    161                         wp_cache_set($category, $_category, 'category'); 
     156                        wp_cache_add($category, $_category, 'category'); 
    162157                } 
    163158        } 
     
    212207} 
    213208 
    214 function get_category_by_slug( $slug  ) { 
    215         global $wpdb; 
    216         $slug = sanitize_title( $slug ); 
    217         if ( empty( $slug ) ) 
    218                 return false; 
    219         $category = $wpdb->get_var( "SELECT * FROM $wpdb->categories WHERE category_nicename = '$slug' " ); 
    220         return get_category( $category ); 
    221 } 
    222  
    223209// Get the ID of a category from its name 
    224210function get_cat_ID($cat_name='General') { 
     
    343329        return $children; 
    344330} 
    345  
    346331?> 
  • trunk/wp-includes/class-phpmailer.php

    r972 r1005  
    391391    function SendmailSend($header, $body) { 
    392392        if ($this->Sender != "") 
    393             $sendmail = sprintf("%s -oi -f %s -t", $this->Sendmail, $this->Sender); 
     393            $sendmail = sprintf("%s -oi -f %s -t", $this->Sendmail, escapeshellarg($this->Sender)); 
    394394        else 
    395395            $sendmail = sprintf("%s -oi -t", $this->Sendmail); 
  • trunk/wp-includes/class-snoopy.php

    r972 r1005  
    797797                if(!empty($this->host) && !isset($this->rawheaders['Host'])) { 
    798798                        $headers .= "Host: ".$this->host; 
    799                         if(!empty($this->port) && $this->port != 80
     799                        if(!empty($this->port)
    800800                                $headers .= ":".$this->port; 
    801801                        $headers .= "\r\n"; 
  • trunk/wp-includes/classes.php

    r972 r1005  
    507507                if ( $depth ) 
    508508                        $indent = str_repeat("\t", $depth); 
    509                 extract($args); 
     509                extract($args, EXTR_SKIP); 
    510510                $css_class = 'page_item'; 
    511511                $_current_page = get_page( $current_page ); 
     
    688688        // a WP_Error object can be passed in 'id' or 'data' 
    689689        function add( $args = '' ) { 
    690                 $defaults = array( 
    691                         'what' => 'object', 'action' => false,  
    692                         'id' => '0', 'old_id' => false,  
    693                         'data' => '', 'supplemental' => array() 
    694                 ); 
    695                  
    696                 $r = wp_parse_args( $args, $defaults ); 
    697                 extract( $r ); 
     690                if ( is_array($args) ) 
     691                        $r = &$args; 
     692                else 
     693                        parse_str($args, $r); 
     694 
     695                $defaults = array('what' => 'object', 'action' => false, 'id' => '0', 'old_id' => false, 
     696                                'data' => '', 'supplemental' => array()); 
     697 
     698                $r = array_merge($defaults, $r); 
     699                extract($r, EXTR_SKIP); 
    698700 
    699701                if ( is_wp_error($id) ) { 
  • trunk/wp-includes/comment-template.php

    r972 r1005  
    240240function trackback_rdf($timezone = 0) { 
    241241        global $id; 
    242         if (strpos($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator') !== false) { 
     242        if (stripos($_SERVER['HTTP_USER_AGENT'], 'W3C_Validator') === false) { 
    243243                echo '<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" 
    244244                                xmlns:dc="http://purl.org/dc/elements/1.1/" 
     
    286286        $req = get_option('require_name_email'); 
    287287        $commenter = wp_get_current_commenter(); 
    288         extract($commenter); 
     288        extract($commenter, EXTR_SKIP); 
    289289 
    290290        // TODO: Use API instead of SELECTs. 
  • trunk/wp-includes/comment.php

    r972 r1005  
    7474        global $comment_cache, $wpdb; 
    7575 
    76         if ( empty($comment) ) { 
    77                 if ( isset($GLOBALS['comment']) ) 
    78                         $_comment = & $GLOBALS['comment']; 
    79                 else 
    80                         $_comment = null; 
    81         } elseif ( is_object($comment) ) { 
     76        if ( empty($comment) ) 
     77                return null; 
     78 
     79        if ( is_object($comment) ) { 
    8280                if ( !isset($comment_cache[$comment->comment_ID]) ) 
    8381                        $comment_cache[$comment->comment_ID] = &$comment; 
     
    8583        } else { 
    8684                $comment = (int) $comment; 
    87                 if ( isset($GLOBALS['comment']) && ($GLOBALS['comment']->comment_ID == $comment) ) { 
    88                         $_comment = & $GLOBALS['comment']; 
    89                 } elseif ( !isset($comment_cache[$comment]) ) { 
     85                if ( !isset($comment_cache[$comment]) ) { 
    9086                        $_comment = $wpdb->get_row("SELECT * FROM $wpdb->comments WHERE comment_ID = '$comment' LIMIT 1"); 
    9187                        $comment_cache[$comment->comment_ID] = & $_comment; 
     
    183179function wp_allow_comment($commentdata) { 
    184180        global $wpdb; 
    185         extract($commentdata); 
     181        extract($commentdata, EXTR_SKIP); 
    186182 
    187183        // Simple duplicate check 
     
    330326function wp_insert_comment($commentdata) { 
    331327        global $wpdb; 
    332         extract($commentdata); 
     328        extract($commentdata, EXTR_SKIP); 
    333329 
    334330        if ( ! isset($comment_author_IP) ) 
     
    462458 
    463459        // Now extract the merged array. 
    464         extract($commentarr); 
     460        extract($commentarr, EXTR_SKIP); 
    465461 
    466462        $comment_content = apply_filters('comment_save_pre', $comment_content); 
     
    522518        $pingback_href_original_pos = 27; 
    523519 
    524         extract(parse_url($url)); 
     520        extract(parse_url($url), EXTR_SKIP); 
    525521 
    526522        if ( !isset($host) ) // Not an URL. This should never happen. 
     
    677673 
    678674        // original code by Mort (http://mort.mine.nu:8080) 
     675        $log = debug_fopen(ABSPATH . '/pingback.log', 'a'); 
    679676        $post_links = array(); 
     677        debug_fwrite($log, 'BEGIN ' . date('YmdHis', time()) . "\n"); 
    680678 
    681679        $pung = get_pung($post_ID); 
     
    692690        // http://www.phpfreaks.com/quickcode/Extract_All_URLs_on_a_Page/15.php 
    693691        preg_match_all("{\b http : [$any] +? (?= [$punc] * [^$any] | $)}x", $content, $post_links_temp); 
     692 
     693        // Debug 
     694        debug_fwrite($log, 'Post contents:'); 
     695        debug_fwrite($log, $content."\n"); 
    694696 
    695697        // Step 2. 
     
    716718 
    717719        foreach ( (array) $post_links as $pagelinkedto ) { 
     720                debug_fwrite($log, "Processing -- $pagelinkedto\n"); 
    718721                $pingback_server_url = discover_pingback_server_uri($pagelinkedto, 2048); 
    719722 
     
    721724                        @ set_time_limit( 60 ); 
    722725                         // Now, the RPC call 
     726                        debug_fwrite($log, "Page Linked To: $pagelinkedto \n"); 
     727                        debug_fwrite($log, 'Page Linked From: '); 
    723728                        $pagelinkedfrom = get_permalink($post_ID); 
     729                        debug_fwrite($log, $pagelinkedfrom."\n"); 
    724730 
    725731                        // using a timeout of 3 seconds should be enough to cover slow servers 
     
    733739                        if ( $client->query('pingback.ping', $pagelinkedfrom, $pagelinkedto ) ) 
    734740                                add_ping( $post_ID, $pagelinkedto ); 
    735                 } 
    736         } 
     741                        else 
     742                                debug_fwrite($log, "Error.\n Fault code: ".$client->getErrorCode()." : ".$client->getErrorMessage()."\n"); 
     743                } 
     744        } 
     745 
     746        debug_fwrite($log, "\nEND: ".time()."\n****************************\n"); 
     747        debug_fclose($log); 
    737748} 
    738749 
     
    771782        $fs = @fsockopen($trackback_url['host'], $trackback_url['port'], $errno, $errstr, 4); 
    772783        @fputs($fs, $http_request); 
     784/* 
     785        $debug_file = 'trackback.log'; 
     786        $fp = fopen($debug_file, 'a'); 
     787        fwrite($fp, "\n*****\nRequest:\n\n$http_request\n\nResponse:\n\n"); 
     788        while(!@feof($fs)) { 
     789                fwrite($fp, @fgets($fs, 4096)); 
     790        } 
     791        fwrite($fp, "\n\n"); 
     792        fclose($fp); 
     793*/ 
    773794        @fclose($fs); 
    774795 
  • trunk/wp-includes/compat.php

    r972 r1005  
    7474 * @author      Stephan Schmidt <schst@php.net> 
    7575 * @author      Aidan Lister <aidan@php.net> 
    76  * @version     $Revision: 4495
     76 * @version     $Revision: 5187
    7777 * @since       PHP 4.2.0 
    7878 * @require     PHP 4.0.0 (user_error) 
  • trunk/wp-includes/deprecated.php

    r972 r1005  
    428428 
    429429function wp_list_cats($args = '') { 
    430         $r = wp_parse_args( $args ); 
     430        if ( is_array($args) ) 
     431                $r = &$args; 
     432        else 
     433                parse_str($args, $r); 
    431434 
    432435        // Map to new names. 
  • trunk/wp-includes/feed-atom-comments.php

    r972 r1005  
    4141                        } 
    4242                ?></title> 
    43                 <link rel="alternate" href="<?php comment_link(); ?>" type="<?php bloginfo_rss('content_type'); ?>" /> 
     43                <link rel="alternate" href="<?php comment_link(); ?>" type="<?php bloginfo_rss('html_type'); ?>" /> 
    4444 
    4545                <author> 
  • trunk/wp-includes/feed.php

    r972 r1005  
    152152        $the_list = ''; 
    153153        foreach ( (array) $categories as $category ) { 
    154                 $category->cat_name = convert_chars($category->cat_name); 
     154                $cat_name = convert_chars($category->cat_name); 
    155155                if ( 'rdf' == $type ) 
    156                         $the_list .= "\n\t\t<dc:subject><![CDATA[$category->cat_name]]></dc:subject>\n"; 
     156                        $the_list .= "\n\t\t<dc:subject><![CDATA[$cat_name]]></dc:subject>\n"; 
    157157                if ( 'atom' == $type ) 
    158                         $the_list .= "<category scheme='$home' term='$category->cat_name' />"
     158                        $the_list .= sprintf( '<category scheme="%1$s" term="%2$s" />', attribute_escape( apply_filters( 'get_bloginfo_rss', get_bloginfo( 'url' ) ) ), attribute_escape( $category->cat_name ) )
    159159                else 
    160                         $the_list .= "\n\t\t<category><![CDATA[$category->cat_name]]></category>\n"; 
     160                        $the_list .= "\n\t\t<category><![CDATA[$cat_name]]></category>\n"; 
    161161        } 
    162162        return apply_filters('the_category_rss', $the_list, $type); 
  • trunk/wp-includes/formatting.php

    r972 r1005  
    11041104function js_escape($text) { 
    11051105        $safe_text = wp_specialchars($text, 'double'); 
    1106         $safe_text = str_replace('&#039;', "'", $safe_text); 
     1106        $safe_text = preg_replace('/&#(x)?0*(?(1)27|39);?/i', "'", stripslashes($safe_text)); 
    11071107        $safe_text = preg_replace("/\r?\n/", "\\n", addslashes($safe_text)); 
    11081108        return apply_filters('js_escape', $safe_text, $text); 
     
    11191119} 
    11201120 
     1121function wp_parse_str( $string, &$array ) { 
     1122        parse_str( $string, $array ); 
     1123        if ( get_magic_quotes_gpc() ) 
     1124                $array = stripslashes_deep( $array ); // parse_str() adds slashes if magicquotes is on.  See: http://php.net/parse_str 
     1125        $array = apply_filters( 'wp_parse_str', $array ); 
     1126} 
     1127 
    11211128?> 
  • trunk/wp-includes/functions.php

    r1003 r1005  
    8282        $j = @date($dateformatstring, $i); 
    8383        return $j; 
    84 } 
    85  
    86 function number_format_i18n($number, $decimals = null) { 
    87         global $wp_locale; 
    88         // let the user override the precision only 
    89         $decimals = is_null($decimals)? $wp_locale->number_format['decimals'] : intval($decimals); 
    90  
    91         return number_format($number, $decimals, $wp_locale->number_format['decimal_point'], $wp_locale->number_format['thousands_sep']); 
    9284} 
    9385 
     
    779771        $ret = ''; 
    780772        if ( is_array(func_get_arg(0)) ) { 
    781                 if ( @func_num_args() < 2 || '' == @func_get_arg(1) ) 
     773                if ( @func_num_args() < 2 || false === @func_get_arg(1) ) 
    782774                        $uri = $_SERVER['REQUEST_URI']; 
    783775                else 
    784776                        $uri = @func_get_arg(1); 
    785777        } else { 
    786                 if ( @func_num_args() < 3 || '' == @func_get_arg(2) ) 
     778                if ( @func_num_args() < 3 || false === @func_get_arg(2) ) 
    787779                        $uri = $_SERVER['REQUEST_URI']; 
    788780                else 
     
    819811        } 
    820812 
    821         parse_str($query, $qs); 
    822         if ( get_magic_quotes_gpc() ) 
    823                 $qs = stripslashes_deep($qs); // parse_str() adds slashes if magicquotes is on.  See: http://php.net/parse_str 
     813        wp_parse_str($query, $qs); 
    824814        $qs = urlencode_deep($qs); 
    825815        if ( is_array(func_get_arg(0)) ) { 
     
    842832        $ret = trim($ret, '?'); 
    843833        $ret = $protocol . $base . $ret . $frag; 
    844         $ret = trim($ret, '?'); 
     834        $ret = rtrim($ret, '?'); 
    845835        return $ret; 
    846836} 
     
    856846*/ 
    857847 
    858 function remove_query_arg($key, $query='') { 
     848function remove_query_arg($key, $query=FALSE) { 
    859849        if ( is_array($key) ) { // removing multiple keys 
    860850                foreach ( (array) $key as $k ) 
     
    919909} 
    920910 
    921 function get_status_header_desc( $code ) { 
    922         global $wp_header_to_desc; 
    923          
    924         $code = (int) $code; 
    925          
    926         if ( isset( $wp_header_to_desc[$code] ) ) { 
    927                 return $wp_header_to_desc[$code]; 
    928         } else { 
    929                 return ''; 
    930         } 
    931 } 
    932  
    933911function status_header( $header ) { 
    934         $text = get_status_header_desc( $header ); 
    935          
    936         if ( empty( $text ) ) 
    937                 return false; 
     912        if ( 200 == $header ) 
     913                $text = 'OK'; 
     914        elseif ( 301 == $header ) 
     915                $text = 'Moved Permanently'; 
     916        elseif ( 302 == $header ) 
     917                $text = 'Moved Temporarily'; 
     918        elseif ( 304 == $header ) 
     919                $text = 'Not Modified'; 
     920        elseif ( 404 == $header ) 
     921                $text = 'Not Found'; 
     922        elseif ( 410 == $header ) 
     923                $text = 'Gone'; 
    938924 
    939925        $protocol = $_SERVER["SERVER_PROTOCOL"]; 
     
    12171203                'pdf' => 'application/pdf', 
    12181204                'doc' => 'application/msword', 
    1219                 'odt' => 'application/vnd.oasis.opendocument.text', 
    12201205                'pot|pps|ppt' => 'application/vnd.ms-powerpoint', 
    12211206                'wri' => 'application/vnd.ms-write', 
     
    15051490 
    15061491function wp_parse_args( $args, $defaults = '' ) { 
    1507         if ( is_array( $args ) ) { 
     1492        if ( is_array( $args ) ) 
    15081493                $r =& $args; 
    1509         } else { 
    1510                 parse_str( $args, $r ); 
    1511                 if ( get_magic_quotes_gpc() ) { 
    1512                         $r = stripslashes_deep( $r ); 
    1513                 } 
    1514         } 
    1515          
    1516         if ( is_array( $defaults ) ) { 
     1494        else 
     1495                wp_parse_str( $args, $r ); 
     1496 
     1497        if ( is_array( $defaults ) ) 
    15171498                return array_merge( $defaults, $r ); 
    1518         } else { 
     1499        else 
    15191500                return $r; 
    1520         } 
    15211501} 
    15221502 
  • trunk/wp-includes/general-template.php

    r972 r1005  
    6464         
    6565        // Don't filter URL's. 
    66         if (strpos($show, 'url') === false ||  
    67                 strpos($show, 'directory') === false ||  
     66        if (strpos($show, 'url') === false && 
     67                strpos($show, 'directory') === false && 
    6868                strpos($show, 'home') === false) { 
    6969                $info = apply_filters('bloginfo', $info, $show); 
     
    110110                case 'comments_atom_url': 
    111111                        $output = get_feed_link('comments_atom'); 
     112                        break; 
    112113                case 'comments_rss2_url': 
    113114                        $output = get_feed_link('comments_rss2'); 
     
    218219        if ( is_single() || is_page() ) { 
    219220                $post = $wp_query->get_queried_object(); 
    220                 $title = apply_filters('single_post_title', $title); 
    221                 $title = strip_tags($post->post_title); 
     221                $title = strip_tags( apply_filters( 'single_post_title', $post->post_title ) ); 
    222222        } 
    223223 
     
    314314 
    315315function wp_get_archives($args = '') { 
    316         global $wpdb, $wp_locale
    317          
    318         $defaults = array( 
    319                 'type' => 'monthly', 'limit' => '',  
    320                'format' => 'html', 'before' => '',  
    321                 'after' => '', 'show_post_count' => false 
    322         ); 
    323          
    324         $r = wp_parse_args( $args, $defaults ); 
    325         extract( $r ); 
     316        global $wp_locale, $wpdb
     317 
     318        if ( is_array($args) ) 
     319                $r = &$args; 
     320        else 
     321                parse_str($args, $r); 
     322 
     323        $defaults = array('type' => 'monthly', 'limit' => '', 'format' => 'html', 'before' => '', 'after' => '', 'show_post_count' => false); 
     324        $r = array_merge($defaults, $r); 
     325        extract($r, EXTR_SKIP); 
    326326 
    327327        if ( '' == $type ) 
     
    901901        edCanvas = document.getElementById('<?php echo $id; ?>'); 
    902902        <?php if ( $prev_id && user_can_richedit() ) : ?> 
     903        // If tinyMCE is defined. 
     904        if ( typeof tinyMCE != 'undefined' ) { 
    903905        // This code is meant to allow tabbing from Title to Post (TinyMCE). 
    904         if ( tinyMCE.isMSIE ) 
    905                 document.getElementById('<?php echo $prev_id; ?>').onkeydown = function (e) 
    906                         { 
     906                if ( tinyMCE.isMSIE ) { 
     907                        document.getElementById('<?php echo $prev_id; ?>').onkeydown = function (e) { 
    907908                                e = e ? e : window.event; 
    908909                                if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) { 
     
    917918                                } 
    918919                        } 
    919         else 
    920                 document.getElementById('<?php echo $prev_id; ?>').onkeypress = function (e) 
    921                         { 
     920                } else { 
     921                        document.getElementById('<?php echo $prev_id; ?>').onkeypress = function (e) { 
    922922                                e = e ? e : window.event; 
    923923                                if (e.keyCode == 9 && !e.shiftKey && !e.controlKey && !e.altKey) { 
     
    932932                                } 
    933933                        } 
     934                } 
     935        } 
    934936        <?php endif; ?> 
    935937        //--> 
     
    957959} 
    958960 
    959 function paginate_links( $arg = '' ) { 
    960         if ( is_array($arg) ) 
    961                 $a = &$arg; 
    962         else 
    963                 parse_str($arg, $a); 
    964  
    965         // Defaults 
    966         $base = '%_%'; // http://example.com/all_posts.php%_% : %_% is replaced by format (below) 
    967         $format = '?page=%#%'; // ?page=%#% : %#% is replaced by the page number 
    968         $total = 1; 
    969         $current = 0; 
    970         $show_all = false; 
    971         $prev_next = true; 
    972         $prev_text = __('&laquo; Previous'); 
    973         $next_text = __('Next &raquo;'); 
    974         $end_size = 1; // How many numbers on either end including the end 
    975         $mid_size = 2; // How many numbers to either side of current not including current 
    976         $type = 'plain'; 
    977         $add_args = false; // array of query args to aadd 
    978  
    979         extract($a); 
     961function paginate_links( $args = '' ) { 
     962        $defaults = array(  
     963                'base' => '%_%', // http://example.com/all_posts.php%_% : %_% is replaced by format (below) 
     964                'format' => '?page=%#%', // ?page=%#% : %#% is replaced by the page number 
     965                'total' => 1, 
     966                'current' => 0, 
     967                'show_all' => false, 
     968                'prev_next' => true, 
     969                'prev_text' => __('&laquo; Previous'), 
     970                'next_text' => __('Next &raquo;'), 
     971                'end_size' => 1, // How many numbers on either end including the end 
     972                'mid_size' => 2, // How many numbers to either side of current not including current 
     973                'type' => 'plain', 
     974                'add_args' => false // array of query args to aadd 
     975        ); 
     976 
     977        $args = wp_parse_args( $args, $defaults ); 
     978        extract($args, EXTR_SKIP); 
    980979 
    981980        // Who knows what else people pass in $args 
  • trunk/wp-includes/js/prototype.js

    r972 r1005  
    1 /*  Prototype JavaScript framework, version 1.5.1 
     1/*  Prototype JavaScript framework, version 1.5.0 
    22 *  (c) 2005-2007 Sam Stephenson 
    33 * 
    44 *  Prototype is freely distributable under the terms of an MIT-style license. 
    5  *  For details, see the Prototype web site: http://www.prototypejs.org
     5 *  For details, see the Prototype web site: http://prototype.conio.net
    66 * 
    77/*--------------------------------------------------------------------------*/ 
    88 
    99var Prototype = { 
    10   Version: '1.5.1', 
    11  
    12   Browser: { 
    13     IE:     !!(window.attachEvent && !window.opera), 
    14     Opera:  !!window.opera, 
    15     WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1, 
    16     Gecko:  navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1 
    17   }, 
    18  
     10  Version: '1.5.0', 
    1911  BrowserFeatures: { 
    20     XPath: !!document.evaluate, 
    21     ElementExtensions: !!window.HTMLElement, 
    22     SpecificElementExtensions: 
    23       (document.createElement('div').__proto__ !== 
    24        document.createElement('form').__proto__) 
    25   }, 
    26  
    27   ScriptFragment: '<script[^>]*>([\u0001-\uFFFF]*?)</script>', 
    28   JSONFilter: /^\/\*-secure-\s*(.*)\s*\*\/\s*$/, 
    29  
    30   emptyFunction: function() { }, 
     12    XPath: !!document.evaluate 
     13  }, 
     14 
     15  ScriptFragment: '(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)', 
     16  emptyFunction: function() {}, 
    3117  K: function(x) { return x } 
    3218} 
     
    6147  }, 
    6248 
    63   toJSON: function(object) { 
    64     var type = typeof object; 
    65     switch(type) { 
    66       case 'undefined': 
    67       case 'function': 
    68       case 'unknown': return; 
    69       case 'boolean': return object.toString(); 
    70     } 
    71     if (object === null) return 'null'; 
    72     if (object.toJSON) return object.toJSON(); 
    73     if (object.ownerDocument === document) return; 
    74     var results = []; 
    75     for (var property in object) { 
    76       var value = Object.toJSON(object[property]); 
    77       if (value !== undefined) 
    78         results.push(property.toJSON() + ': ' + value); 
    79     } 
    80     return '{' + results.join(', ') + '}'; 
    81   }, 
    82  
    8349  keys: function(object) { 
    8450    var keys = []; 
     
    11076  var __method = this, args = $A(arguments), object = args.shift(); 
    11177  return function(event) { 
    112     return __method.apply(object, [event || window.event].concat(args)); 
     78    return __method.apply(object, [( event || window.event)].concat(args).concat($A(arguments))); 
    11379  } 
    11480} 
     
    11682Object.extend(Number.prototype, { 
    11783  toColorPart: function() { 
    118     return this.toPaddedString(2, 16); 
     84    var digits = this.toString(16); 
     85    if (this < 16) return '0' + digits; 
     86    return digits; 
    11987  }, 
    12088 
     
    12694    $R(0, this, true).each(iterator); 
    12795    return this; 
    128   }, 
    129  
    130   toPaddedString: function(length, radix) { 
    131     var string = this.toString(radix || 10); 
    132     return '0'.times(length - string.length) + string; 
    133   }, 
    134  
    135   toJSON: function() { 
    136     return isFinite(this) ? this.toString() : 'null'; 
    13796  } 
    13897}); 
    139  
    140 Date.prototype.toJSON = function() { 
    141   return '"' + this.getFullYear() + '-' + 
    142     (this.getMonth() + 1).toPaddedString(2) + '-' + 
    143     this.getDate().toPaddedString(2) + 'T' + 
    144     this.getHours().toPaddedString(2) + ':' + 
    145     this.getMinutes().toPaddedString(2) + ':' + 
    146     this.getSeconds().toPaddedString(2) + '"'; 
    147 }; 
    14898 
    14999var Try = { 
     
    196146  } 
    197147} 
    198 Object.extend(String, { 
    199   interpret: function(value) { 
    200     return value == null ? '' : String(value); 
    201   }, 
    202   specialChar: { 
    203     '\b': '\\b', 
    204     '\t': '\\t', 
    205     '\n': '\\n', 
    206     '\f': '\\f', 
    207     '\r': '\\r', 
    208     '\\': '\\\\' 
    209   } 
    210 }); 
     148String.interpret = function(value){ 
     149  return value == null ? '' : String(value); 
     150
    211151 
    212152Object.extend(String.prototype, { 
     
    274214 
    275215  escapeHTML: function() { 
    276     var self = arguments.callee; 
    277     self.text.data = this; 
    278     return self.div.innerHTML; 
     216    var div = document.createElement('div'); 
     217    var text = document.createTextNode(this); 
     218    div.appendChild(text); 
     219    return div.innerHTML; 
    279220  }, 
    280221 
     
    283224    div.innerHTML = this.stripTags(); 
    284225    return div.childNodes[0] ? (div.childNodes.length > 1 ? 
    285       $A(div.childNodes).inject('', function(memo, node) { return memo+node.nodeValue }) : 
     226      $A(div.childNodes).inject('',function(memo,node){ return memo+node.nodeValue }) : 
    286227      div.childNodes[0].nodeValue) : ''; 
    287228  }, 
     
    293234    return match[1].split(separator || '&').inject({}, function(hash, pair) { 
    294235      if ((pair = pair.split('='))[0]) { 
    295         var key = decodeURIComponent(pair.shift()); 
    296         var value = pair.length > 1 ? pair.join('=') : pair[0]
    297         if (value != undefined) value = decodeURIComponent(value); 
    298  
    299         if (key in hash) { 
    300           if (hash[key].constructor != Array) hash[key] = [hash[key]]; 
    301           hash[key].push(value); 
     236        var name = decodeURIComponent(pair[0]); 
     237        var value = pair[1] ? decodeURIComponent(pair[1]) : undefined
     238 
     239        if (hash[name] !== undefined) { 
     240          if (hash[name].constructor != Array) 
     241            hash[name] = [hash[name]]; 
     242          if (value) hash[name].push(value); 
    302243        } 
    303         else hash[key] = value; 
     244        else hash[name] = value; 
    304245      } 
    305246      return hash; 
     
    316257  }, 
    317258 
    318   times: function(count) { 
    319     var result = ''; 
    320     for (var i = 0; i < count; i++) result += this; 
    321     return result; 
    322   }, 
    323  
    324259  camelize: function() { 
    325260    var parts = this.split('-'), len = parts.length; 
     
    336271  }, 
    337272 
    338   capitalize: function()
     273  capitalize: function()
    339274    return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase(); 
    340275  }, 
     
    349284 
    350285  inspect: function(useDoubleQuotes) { 
    351     var escapedString = this.gsub(/[\x00-\x1f\\]/, function(match) { 
    352       var character = String.specialChar[match[0]]; 
    353       return character ? character : '\\u00' + match[0].charCodeAt().toPaddedString(2, 16); 
    354     }); 
    355     if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"'; 
    356     return "'" + escapedString.replace(/'/g, '\\\'') + "'"; 
    357   }, 
    358  
    359   toJSON: function() { 
    360     return this.inspect(true); 
    361   }, 
    362  
    363   unfilterJSON: function(filter) { 
    364     return this.sub(filter || Prototype.JSONFilter, '#{1}'); 
    365   }, 
    366  
    367   evalJSON: function(sanitize) { 
    368     var json = this.unfilterJSON(); 
    369     try { 
    370       if (!sanitize || (/^("(\\.|[^"\\\n\r])*?"|[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t])+?$/.test(json))) 
    371         return eval('(' + json + ')'); 
    372     } catch (e) { } 
    373     throw new SyntaxError('Badly formed JSON string: ' + this.inspect()); 
    374   }, 
    375  
    376   include: function(pattern) { 
    377     return this.indexOf(pattern) > -1; 
    378   }, 
    379  
    380   startsWith: function(pattern) { 
    381     return this.indexOf(pattern) === 0; 
    382   }, 
    383  
    384   endsWith: function(pattern) { 
    385     var d = this.length - pattern.length; 
    386     return d >= 0 && this.lastIndexOf(pattern) === d; 
    387   }, 
    388  
    389   empty: function() { 
    390     return this == ''; 
    391   }, 
    392  
    393   blank: function() { 
    394     return /^\s*$/.test(this); 
    395   } 
    396 }); 
    397  
    398 if (Prototype.Browser.WebKit || Prototype.Browser.IE) Object.extend(String.prototype, { 
    399   escapeHTML: function() { 
    400     return this.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;'); 
    401   }, 
    402   unescapeHTML: function() { 
    403     return this.replace(/&amp;/g,'&').replace(/&lt;/g,'<').replace(/&gt;/g,'>'); 
     286    var escapedString = this.replace(/\\/g, '\\\\'); 
     287    if (useDoubleQuotes) 
     288      return '"' + escapedString.replace(/"/g, '\\"') + '"'; 
     289    else 
     290      return "'" + escapedString.replace(/'/g, '\\\'') + "'"; 
    404291  } 
    405292}); 
     
    412299 
    413300String.prototype.parseQuery = String.prototype.toQueryParams; 
    414  
    415 Object.extend(String.prototype.escapeHTML, { 
    416   div:  document.createElement('div'), 
    417   text: document.createTextNode('') 
    418 }); 
    419  
    420 with (String.prototype.escapeHTML) div.appendChild(text); 
    421301 
    422302var Template = Class.create(); 
     
    437317} 
    438318 
    439 var $break = {}, $continue = new Error('"throw $continue" is deprecated, use "return" instead'); 
     319var $break    = new Object(); 
     320var $continue = new Object(); 
    440321 
    441322var Enumerable = { 
     
    444325    try { 
    445326      this._each(function(value) { 
    446         iterator(value, index++); 
     327        try { 
     328          iterator(value, index++); 
     329        } catch (e) { 
     330          if (e != $continue) throw e; 
     331        } 
    447332      }); 
    448333    } catch (e) { 
     
    646531} 
    647532 
    648 if (Prototype.Browser.WebKit) { 
    649   $A = Array.from = function(iterable) { 
    650     if (!iterable) return []; 
    651     if (!(typeof iterable == 'function' && iterable == '[object NodeList]') && 
    652       iterable.toArray) { 
    653       return iterable.toArray(); 
    654     } else { 
    655       var results = []; 
    656       for (var i = 0, length = iterable.length; i < length; i++) 
    657         results.push(iterable[i]); 
    658       return results; 
    659     } 
    660   } 
    661 } 
    662  
    663533Object.extend(Array.prototype, Enumerable); 
    664534 
     
    719589  }, 
    720590 
    721   uniq: function(sorted) { 
    722     return this.inject([], function(array, value, index) { 
    723       if (0 == index || (sorted ? array.last() != value : !array.include(value))) 
    724         array.push(value); 
    725       return array; 
     591  uniq: function() { 
     592    return this.inject([], function(array, value) { 
     593      return array.include(value) ? array : array.concat([value]); 
    726594    }); 
    727595  }, 
     
    737605  inspect: function() { 
    738606    return '[' + this.map(Object.inspect).join(', ') + ']'; 
    739   }, 
    740  
    741   toJSON: function() { 
    742     var results = []; 
    743     this.each(function(object) { 
    744       var value = Object.toJSON(object); 
    745       if (value !== undefined) results.push(value); 
    746     }); 
    747     return '[' + results.join(', ') + ']'; 
    748607  } 
    749608}); 
     
    751610Array.prototype.toArray = Array.prototype.clone; 
    752611 
    753 function $w(string)
     612function $w(string)
    754613  string = string.strip(); 
    755614  return string ? string.split(/\s+/) : []; 
    756615} 
    757616 
    758 if (Prototype.Browser.Opera){ 
    759   Array.prototype.concat = function()
     617if(window.opera){ 
     618  Array.prototype.concat = function()
    760619    var array = []; 
    761     for (var i = 0, length = this.length; i < length; i++) array.push(this[i]); 
    762     for (var i = 0, length = arguments.length; i < length; i++) { 
    763       if (arguments[i].constructor == Array) { 
    764         for (var j = 0, arrayLength = arguments[i].length; j < arrayLength; j++) 
     620    for(var i = 0, length = this.length; i < length; i++) array.push(this[i]); 
     621    for(var i = 0, length = arguments.length; i < length; i++) { 
     622      if(arguments[i].constructor == Array) { 
     623        for(var j = 0, arrayLength = arguments[i].length; j < arrayLength; j++) 
    765624          array.push(arguments[i][j]); 
    766625      } else { 
     
    771630  } 
    772631} 
    773 var Hash = function(object) { 
    774   if (object instanceof Hash) this.merge(object); 
    775   else Object.extend(this, object || {}); 
     632var Hash = function(obj) { 
     633  Object.extend(this, obj || {}); 
    776634}; 
    777635 
     
    779637  toQueryString: function(obj) { 
    780638    var parts = []; 
    781     parts.add = arguments.callee.addPair; 
    782  
    783     this.prototype._each.call(obj, function(pair) { 
     639 
     640          this.prototype._each.call(obj, function(pair) { 
    784641      if (!pair.key) return; 
    785       var value = pair.value; 
    786  
    787       if (value && typeof value == 'object') { 
    788         if (value.constructor == Array) value.each(function(value) { 
    789           parts.add(pair.key, value); 
    790         }); 
    791         return; 
     642 
     643      if (pair.value && pair.value.constructor == Array) { 
     644        var values = pair.value.compact(); 
     645        if (values.length < 2) pair.value = values.reduce(); 
     646        else { 
     647                key = encodeURIComponent(pair.key); 
     648          values.each(function(value) { 
     649            value = value != undefined ? encodeURIComponent(value) : ''; 
     650            parts.push(key + '=' + encodeURIComponent(value)); 
     651          }); 
     652          return; 
     653        } 
    792654      } 
    793       parts.add(pair.key, value); 
    794     }); 
     655      if (pair.value == undefined) pair[1] = ''; 
     656      parts.push(pair.map(encodeURIComponent).join('=')); 
     657          }); 
    795658 
    796659    return parts.join('&'); 
    797   }, 
    798  
    799   toJSON: function(object) { 
    800     var results = []; 
    801     this.prototype._each.call(object, function(pair) { 
    802       var value = Object.toJSON(pair.value); 
    803       if (value !== undefined) results.push(pair.key.toJSON() + ': ' + value); 
    804     }); 
    805     return '{' + results.join(', ') + '}'; 
    806660  } 
    807661}); 
    808  
    809 Hash.toQueryString.addPair = function(key, value, prefix) { 
    810   key = encodeURIComponent(key); 
    811   if (value === undefined) this.push(key); 
    812   else this.push(key + '=' + (value == null ? '' : encodeURIComponent(value))); 
    813 } 
    814662 
    815663Object.extend(Hash.prototype, Enumerable); 
     
    866714      return pair.map(Object.inspect).join(': '); 
    867715    }).join(', ') + '}>'; 
    868   }, 
    869  
    870   toJSON: function() { 
    871     return Hash.toJSON(this); 
    872716  } 
    873717}); 
    874718 
    875719function $H(object) { 
    876   if (object instanceof Hash) return object; 
     720  if (object && object.constructor == Hash) return object; 
    877721  return new Hash(object); 
    878 }; 
    879  
    880 // Safari iterates over shadowed properties 
    881 if (function() { 
    882   var i = 0, Test = function(value) { this.key = value }; 
    883   Test.prototype.key = 'foo'; 
    884   for (var property in new Test('bar')) i++; 
    885   return i > 1; 
    886 }()) Hash.prototype._each = function(iterator) { 
    887   var cache = []; 
    888   for (var key in this) { 
    889     var value = this[key]; 
    890     if ((value && value == Hash.prototype[key]) || cache.include(key)) continue; 
    891     cache.push(key); 
    892     var pair = [key, value]; 
    893     pair.key = key; 
    894     pair.value = value; 
    895     iterator(pair); 
    896   } 
    897722}; 
    898723ObjectRange = Class.create(); 
     
    1010835    this.url = url; 
    1011836    this.method = this.options.method; 
    1012     var params = Object.clone(this.options.parameters)
     837    var params = this.options.parameters
    1013838 
    1014839    if (!['get', 'post'].include(this.method)) { 
     
    1018843    } 
    1019844 
    1020     this.parameters = params; 
    1021  
    1022     if (params = Hash.toQueryString(params)) { 
    1023       // when GET, append parameters to URL 
    1024       if (this.method == 'get') 
    1025         this.url += (this.url.include('?') ? '&' : '?') + params; 
    1026       else if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) 
    1027         params += '&_='; 
    1028     } 
     845    params = Hash.toQueryString(params); 
     846    if (params && /Konqueror|Safari|KHTML/.test(navigator.userAgent)) params += '&_=' 
     847 
     848    // when GET, append parameters to URL 
     849    if (this.method == 'get' && params) 
     850      this.url += (this.url.indexOf('?') > -1 ? '&' : '?') + params; 
    1029851 
    1030852    try { 
    1031       if (this.options.onCreate) this.options.onCreate(this.transport); 
    1032853      Ajax.Responders.dispatch('onCreate', this, this.transport); 
    1033854 
     
    1041862      this.setRequestHeaders(); 
    1042863 
    1043       this.body = this.method == 'post' ? (this.options.postBody || params) : null; 
    1044       this.transport.send(this.body); 
     864      var body = this.method == 'post' ? (this.options.postBody || params) : null; 
     865 
     866      this.transport.send(body); 
    1045867 
    1046868      /* Force Firefox to handle ready state 4 for synchronous requests */ 
     
    1114936      } 
    1115937 
    1116       var contentType = this.getHeader('Content-type'); 
    1117       if (contentType && contentType.strip(). 
     938      if ((this.getHeader('Content-type') || 'text/javascript').strip(). 
    1118939        match(/^(text|application)\/(x-)?(java|ecma)script(;.*)?$/i)) 
    1119940          this.evalResponse(); 
     
    1142963    try { 
    1143964      var json = this.getHeader('X-JSON'); 
    1144       return json ? json.evalJSON() : null; 
     965      return json ? eval('(' + json + ')') : null; 
    1145966    } catch (e) { return null } 
    1146967  }, 
     
    1148969  evalResponse: function() { 
    1149970    try { 
    1150       return eval((this.transport.responseText || '').unfilterJSON()); 
     971      return eval(this.transport.responseText); 
    1151972    } catch (e) { 
    1152973      this.dispatchException(e); 
     
    12631084    return results; 
    12641085  }; 
    1265  
    1266   document.getElementsByClassName = function(className, parentElement) { 
     1086
     1087 
     1088document.getElementsByClassName = function(className, parentElement) { 
     1089  if (Prototype.BrowserFeatures.XPath) { 
    12671090    var q = ".//*[contains(concat(' ', @class, ' '), ' " + className + " ')]"; 
    12681091    return document._getElementsByXPath(q, parentElement); 
    1269   } 
    1270  
    1271 } else document.getElementsByClassName = function(className, parentElement) { 
    1272   var children = ($(parentElement) || document.body).getElementsByTagName('*'); 
    1273   var elements = [], child; 
    1274   for (var i = 0, length = children.length; i < length; i++) { 
    1275     child = children[i]; 
    1276     if (Element.hasClassName(child, className)) 
    1277       elements.push(Element.extend(child)); 
    1278   } 
    1279   return elements; 
     1092  } else { 
     1093    var children = ($(parentElement) || document.body).getElementsByTagName('*'); 
     1094    var elements = [], child; 
     1095    for (var i = 0, length = children.length; i < length; i++) { 
     1096      child = children[i]; 
     1097      if (Element.hasClassName(child, className)) 
     1098        elements.push(Element.extend(child)); 
     1099    } 
     1100    return elements; 
     1101  } 
    12801102}; 
    12811103 
    12821104/*--------------------------------------------------------------------------*/ 
    12831105 
    1284 if (!window.Element) var Element = {}; 
     1106if (!window.Element) 
     1107  var Element = new Object(); 
    12851108 
    12861109Element.extend = function(element) { 
    1287   var F = Prototype.BrowserFeatures; 
    1288   if (!element || !element.tagName || element.nodeType == 3 || 
    1289    element._extended || F.SpecificElementExtensions || element == window) 
    1290     return element; 
    1291  
    1292   var methods = {}, tagName = element.tagName, cache = Element.extend.cache, 
    1293    T = Element.Methods.ByTag; 
    1294  
    1295   // extend methods for all tags (Safari doesn't need this) 
    1296   if (!F.ElementExtensions) { 
    1297     Object.extend(methods, Element.Methods), 
     1110  if (!element || _nativeExtensions || element.nodeType == 3) return element; 
     1111 
     1112  if (!element._extended && element.tagName && element != window) { 
     1113    var methods = Object.clone(Element.Methods), cache = Element.extend.cache; 
     1114 
     1115    if (element.tagName == 'FORM') 
     1116      Object.extend(methods, Form.Methods); 
     1117    if (['INPUT', 'TEXTAREA', 'SELECT'].include(element.tagName)) 
     1118      Object.extend(methods, Form.Element.Methods); 
     1119 
    12981120    Object.extend(methods, Element.Methods.Simulated); 
    1299   } 
    1300  
    1301   // extend methods for specific tags 
    1302   if (T[tagName]) Object.extend(methods, T[tagName]); 
    1303  
    1304   for (var property in methods) { 
    1305     var value = methods[property]; 
    1306     if (typeof value == 'function' && !(property in element)) 
    1307       element[property] = cache.findOrStore(value); 
    1308   } 
    1309  
    1310   element._extended = Prototype.emptyFunction; 
     1121 
     1122    for (var property in methods) { 
     1123      var value = methods[property]; 
     1124      if (typeof value == 'function' && !(property in element)) 
     1125        element[property] = cache.findOrStore(value); 
     1126    } 
     1127  } 
     1128 
     1129  element._extended = true; 
    13111130  return element; 
    13121131}; 
     
    13941213 
    13951214  descendants: function(element) { 
    1396     return $A($(element).getElementsByTagName('*')).each(Element.extend); 
    1397   }, 
    1398  
    1399   firstDescendant: function(element) { 
    1400     element = $(element).firstChild; 
    1401     while (element && element.nodeType != 1) element = element.nextSibling; 
    1402     return $(element); 
     1215    return $A($(element).getElementsByTagName('*')); 
    14031216  }, 
    14041217 
     
    14301243 
    14311244  up: function(element, expression, index) { 
    1432     element = $(element); 
    1433     if (arguments.length == 1) return $(element.parentNode); 
    1434     var ancestors = element.ancestors(); 
    1435     return expression ? Selector.findElement(ancestors, expression, index) : 
    1436       ancestors[index || 0]; 
     1245    return Selector.findElement($(element).ancestors(), expression, index); 
    14371246  }, 
    14381247 
    14391248  down: function(element, expression, index) { 
    1440     element = $(element); 
    1441     if (arguments.length == 1) return element.firstDescendant(); 
    1442     var descendants = element.descendants(); 
    1443     return expression ? Selector.findElement(descendants, expression, index) : 
    1444       descendants[index || 0]; 
     1249    return Selector.findElement($(element).descendants(), expression, index); 
    14451250  }, 
    14461251 
    14471252  previous: function(element, expression, index) { 
    1448     element = $(element); 
    1449     if (arguments.length == 1) return $(Selector.handlers.previousElementSibling(element)); 
    1450     var previousSiblings = element.previousSiblings(); 
    1451     return expression ? Selector.findElement(previousSiblings, expression, index) : 
    1452       previousSiblings[index || 0]; 
     1253    return Selector.findElement($(element).previousSiblings(), expression, index); 
    14531254  }, 
    14541255 
    14551256  next: function(element, expression, index) { 
    1456     element = $(element); 
    1457     if (arguments.length == 1) return $(Selector.handlers.nextElementSibling(element)); 
    1458     var nextSiblings = element.nextSiblings(); 
    1459     return expression ? Selector.findElement(nextSiblings, expression, index) : 
    1460       nextSiblings[index || 0]; 
     1257    return Selector.findElement($(element).nextSiblings(), expression, index); 
    14611258  }, 
    14621259 
     
    14721269  readAttribute: function(element, name) { 
    14731270    element = $(element); 
    1474     if (Prototype.Browser.IE) { 
    1475       if (!element.attributes) return null; 
     1271    if (document.all && !window.opera) { 
    14761272      var t = Element._attributeTranslations; 
    14771273      if (t.values[name]) return t.values[name](element, name); 
    14781274      if (t.names[name])  name = t.names[name]; 
    14791275      var attribute = element.attributes[name]; 
    1480       return attribute ? attribute.nodeValue : null
     1276      if(attribute) return attribute.nodeValue
    14811277    } 
    14821278    return element.getAttribute(name); 
     
    15471343 
    15481344  empty: function(element) { 
    1549     return $(element).innerHTML.blank(); 
     1345    return $(element).innerHTML.match(/^\s*$/); 
    15501346  }, 
    15511347 
     
    15661362  getStyle: function(element, style) { 
    15671363    element = $(element); 
    1568     style = style == 'float' ? 'cssFloat' : style.camelize(); 
     1364    if (['float','cssFloat'].include(style)) 
     1365      style = (typeof element.style.styleFloat != 'undefined' ? 'styleFloat' : 'cssFloat'); 
     1366    style = style.camelize(); 
    15691367    var value = element.style[style]; 
    15701368    if (!value) { 
    1571       var css = document.defaultView.getComputedStyle(element, null); 
    1572       value = css ? css[style] : null; 
    1573     } 
    1574     if (style == 'opacity') return value ? parseFloat(value) : 1.0; 
     1369      if (document.defaultView && document.defaultView.getComputedStyle) { 
     1370        var css = document.defaultView.getComputedStyle(element, null); 
     1371        value = css ? css[style] : null; 
     1372      } else if (element.currentStyle) { 
     1373        value = element.currentStyle[style]; 
     1374      } 
     1375    } 
     1376 
     1377    if((value == 'auto') && ['width','height'].include(style) && (element.getStyle('display') != 'none')) 
     1378      value = element['offset'+style.capitalize()] + 'px'; 
     1379 
     1380    if (window.opera && ['left', 'top', 'right', 'bottom'].include(style)) 
     1381      if (Element.getStyle(element, 'position') == 'static') value = 'auto'; 
     1382    if(style == 'opacity') { 
     1383      if(value) return parseFloat(value); 
     1384      if(value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/)) 
     1385        if(value[1]) return parseFloat(value[1]) / 100; 
     1386      return 1.0; 
     1387    } 
    15751388    return value == 'auto' ? null : value; 
    15761389  }, 
    15771390 
    1578   getOpacity: function(element) { 
    1579     return $(element).getStyle('opacity'); 
    1580   }, 
    1581  
    1582   setStyle: function(element, styles, camelized) { 
     1391  setStyle: function(element, style) { 
    15831392    element = $(element); 
    1584     var elementStyle = element.style; 
    1585  
    1586     for (var property in styles) 
    1587       if (property == 'opacity') element.setOpacity(styles[property]) 
    1588       else 
    1589         elementStyle[(property == 'float' || property == 'cssFloat') ? 
    1590           (elementStyle.styleFloat === undefined ? 'cssFloat' : 'styleFloat') : 
    1591           (camelized ? property : property.camelize())] = styles[property]; 
    1592  
    1593     return element; 
    1594   }, 
    1595  
    1596   setOpacity: function(element, value) { 
    1597     element = $(element); 
    1598     element.style.opacity = (value == 1 || value === '') ? '' : 
    1599       (value < 0.00001) ? 0 : value; 
     1393    for (var name in style) { 
     1394      var value = style[name]; 
     1395      if(name == 'opacity') { 
     1396        if (value == 1) { 
     1397          value = (/Gecko/.test(navigator.userAgent) && 
     1398            !/Konqueror|Safari|KHTML/.test(navigator.userAgent)) ? 0.999999 : 1.0; 
     1399          if(/MSIE/.test(navigator.userAgent) && !window.opera) 
     1400            element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,''); 
     1401        } else if(value == '') { 
     1402          if(/MSIE/.test(navigator.userAgent) && !window.opera) 
     1403            element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,''); 
     1404        } else { 
     1405          if(value < 0.00001) value = 0; 
     1406          if(/MSIE/.test(navigator.userAgent) && !window.opera) 
     1407            element.style.filter = element.getStyle('filter').replace(/alpha\([^\)]*\)/gi,'') + 
     1408              'alpha(opacity='+value*100+')'; 
     1409        } 
     1410      } else if(['float','cssFloat'].include(name)) name = (typeof element.style.styleFloat != 'undefined') ? 'styleFloat' : 'cssFloat'; 
     1411      element.style[name.camelize()] = value; 
     1412    } 
    16001413    return element; 
    16011414  }, 
     
    16711484}; 
    16721485 
    1673 Object.extend(Element.Methods, { 
    1674   childOf: Element.Methods.descendantOf, 
    1675   childElements: Element.Methods.immediateDescendants 
     1486Object.extend(Element.Methods, {childOf: Element.Methods.descendantOf}); 
     1487 
     1488Element._attributeTranslations = {}; 
     1489 
     1490Element._attributeTranslations.names = { 
     1491  colspan:   "colSpan", 
     1492  rowspan:   "rowSpan", 
     1493  valign:    "vAlign", 
     1494  datetime:  "dateTime", 
     1495  accesskey: "accessKey", 
     1496  tabindex:  "tabIndex", 
     1497  enctype:   "encType", 
     1498  maxlength: "maxLength", 
     1499  readonly:  "readOnly", 
     1500  longdesc:  "longDesc" 
     1501}; 
     1502 
     1503Element._attributeTranslations.values = { 
     1504  _getAttr: function(element, attribute) { 
     1505    return element.getAttribute(attribute, 2); 
     1506  }, 
     1507 
     1508  _flag: function(element, attribute) { 
     1509    return $(element).hasAttribute(attribute) ? attribute : null; 
     1510  }, 
     1511 
     1512  style: function(element) { 
     1513    return element.style.cssText.toLowerCase(); 
     1514  }, 
     1515 
     1516  title: function(element) { 
     1517    var node = element.getAttributeNode('title'); 
     1518    return node.specified ? node.nodeValue : null; 
     1519  } 
     1520}; 
     1521 
     1522Object.extend(Element._attributeTranslations.values, { 
     1523  href: Element._attributeTranslations.values._getAttr, 
     1524  src:  Element._attributeTranslations.values._getAttr, 
     1525  disabled: Element._attributeTranslations.values._flag, 
     1526  checked:  Element._attributeTranslations.values._flag, 
     1527  readonly: Element._attributeTranslations.values._flag, 
     1528  multiple: Element._attributeTranslations.values._flag 
    16761529}); 
    16771530 
    1678 if (Prototype.Browser.Opera) { 
    1679   Element.Methods._getStyle = Element.Methods.getStyle; 
    1680   Element.Methods.getStyle = function(element, style) { 
    1681     switch(style) { 
    1682       case 'left': 
    1683       case 'top': 
    1684       case 'right': 
    1685       case 'bottom': 
    1686         if (Element._getStyle(element, 'position') == 'static') return null; 
    1687       default: return Element._getStyle(element, style); 
    1688     } 
    1689   }; 
    1690 
    1691 else if (Prototype.Browser.IE) { 
    1692   Element.Methods.getStyle = function(element, style) { 
    1693     element = $(element); 
    1694     style = (style == 'float' || style == 'cssFloat') ? 'styleFloat' : style.camelize(); 
    1695     var value = element.style[style]; 
    1696     if (!value && element.currentStyle) value = element.currentStyle[style]; 
    1697  
    1698     if (style == 'opacity') { 
    1699       if (value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/)) 
    1700         if (value[1]) return parseFloat(value[1]) / 100; 
    1701       return 1.0; 
    1702     } 
    1703  
    1704     if (value == 'auto') { 
    1705       if ((style == 'width' || style == 'height') && (element.getStyle('display') != 'none')) 
    1706         return element['offset'+style.capitalize()] + 'px'; 
    1707       return null; 
    1708     } 
    1709     return value; 
    1710   }; 
    1711  
    1712   Element.Methods.setOpacity = function(element, value) { 
    1713     element = $(element); 
    1714     var filter = element.getStyle('filter'), style = element.style; 
    1715     if (value == 1 || value === '') { 
    1716       style.filter = filter.replace(/alpha\([^\)]*\)/gi,''); 
    1717       return element; 
    1718     } else if (value < 0.00001) value = 0; 
    1719     style.filter = filter.replace(/alpha\([^\)]*\)/gi, '') + 
    1720       'alpha(opacity=' + (value * 100) + ')'; 
    1721     return element; 
    1722   }; 
    1723  
    1724   // IE is missing .innerHTML support for TABLE-related elements 
     1531Element.Methods.Simulated = { 
     1532  hasAttribute: function(element, attribute) { 
     1533    var t = Element._attributeTranslations; 
     1534    attribute = t.names[attribute] || attribute; 
     1535    return $(element).getAttributeNode(attribute).specified; 
     1536  } 
     1537}; 
     1538 
     1539// IE is missing .innerHTML support for TABLE-related elements 
     1540if (document.all && !window.opera){ 
    17251541  Element.Methods.update = function(element, html) { 
    17261542    element = $(element); 
     
    17431559          depth = 4; 
    17441560      } 
    1745       $A(element.childNodes).each(function(node) { element.removeChild(node) }); 
    1746       depth.times(function() { div = div.firstChild }); 
    1747       $A(div.childNodes).each(function(node) { element.appendChild(node) }); 
     1561      $A(element.childNodes).each(function(node){ 
     1562        element.removeChild(node) 
     1563      }); 
     1564      depth.times(function(){ div = div.firstChild }); 
     1565 
     1566      $A(div.childNodes).each( 
     1567        function(node){ element.appendChild(node) }); 
    17481568    } else { 
    17491569      element.innerHTML = html.stripScripts(); 
    17501570    } 
    1751     setTimeout(function() { html.evalScripts() }, 10); 
     1571    setTimeout(function() {html.evalScripts()}, 10); 
    17521572    return element; 
    17531573  } 
    1754 } 
    1755 else if (Prototype.Browser.Gecko) { 
    1756   Element.Methods.setOpacity = function(element, value) { 
    1757     element = $(element); 
    1758     element.style.opacity = (value == 1) ? 0.999999 : 
    1759       (value === '') ? '' : (value < 0.00001) ? 0 : value; 
    1760     return element; 
    1761   }; 
    1762 } 
    1763  
    1764 Element._attributeTranslations = { 
    1765   names: { 
    1766     colspan:   "colSpan", 
    1767     rowspan:   "rowSpan", 
    1768     valign:    "vAlign", 
    1769     datetime:  "dateTime", 
    1770     accesskey: "accessKey", 
    1771     tabindex:  "tabIndex", 
    1772     enctype:   "encType", 
    1773     maxlength: "maxLength", 
    1774     readonly:  "readOnly", 
    1775     longdesc:  "longDesc" 
    1776   }, 
    1777   values: { 
    1778     _getAttr: function(element, attribute) { 
    1779       return element.getAttribute(attribute, 2); 
    1780     }, 
    1781     _flag: function(element, attribute) { 
    1782       return $(element).hasAttribute(attribute) ? attribute : null; 
    1783     }, 
    1784     style: function(element) { 
    1785       return element.style.cssText.toLowerCase(); 
    1786     }, 
    1787     title: function(element) { 
    1788       var node = element.getAttributeNode('title'); 
    1789       return node.specified ? node.nodeValue : null; 
    1790     } 
    1791   } 
    17921574}; 
    17931575 
    1794 (function() { 
    1795   Object.extend(this, { 
    1796     href: this._getAttr, 
    1797     src:  this._getAttr, 
    1798     type: this._getAttr, 
    1799     disabled: this._flag, 
    1800     checked:  this._flag, 
    1801     readonly: this._flag, 
    1802     multiple: this._flag 
     1576Object.extend(Element, Element.Methods); 
     1577 
     1578var _nativeExtensions = false; 
     1579 
     1580if(/Konqueror|Safari|KHTML/.test(navigator.userAgent)) 
     1581  ['', 'Form', 'Input', 'TextArea', 'Select'].each(function(tag) { 
     1582    var className = 'HTML' + tag + 'Element'; 
     1583    if(window[className]) return; 
     1584    var klass = window[className] = {}; 
     1585    klass.prototype = document.createElement(tag ? tag.toLowerCase() : 'div').__proto__; 
    18031586  }); 
    1804 }).call(Element._attributeTranslations.values); 
    1805  
    1806 Element.Methods.Simulated = { 
    1807   hasAttribute: function(element, attribute) { 
    1808     var t = Element._attributeTranslations, node; 
    1809     attribute = t.names[attribute] || attribute; 
    1810     node = $(element).getAttributeNode(attribute); 
    1811     return node && node.specified; 
    1812   } 
    1813 }; 
    1814  
    1815 Element.Methods.ByTag = {}; 
    1816  
    1817 Object.extend(Element, Element.Methods); 
    1818  
    1819 if (!Prototype.BrowserFeatures.ElementExtensions && 
    1820  document.createElement('div').__proto__) { 
    1821   window.HTMLElement = {}; 
    1822   window.HTMLElement.prototype = document.createElement('div').__proto__; 
    1823   Prototype.BrowserFeatures.ElementExtensions = true; 
    1824 } 
    1825  
    1826 Element.hasAttribute = function(element, attribute) { 
    1827   if (element.hasAttribute) return element.hasAttribute(attribute); 
    1828   return Element.Methods.Simulated.hasAttribute(element, attribute); 
    1829 }; 
    18301587 
    18311588Element.addMethods = function(methods) { 
    1832   var F = Prototype.BrowserFeatures, T = Element.Methods.ByTag; 
    1833  
    1834   if (!methods) { 
    1835     Object.extend(Form, Form.Methods); 
    1836     Object.extend(Form.Element, Form.Element.Methods); 
    1837     Object.extend(Element.Methods.ByTag, { 
    1838       "FORM":     Object.clone(Form.Methods), 
    1839       "INPUT":    Object.clone(Form.Element.Methods), 
    1840       "SELECT":   Object.clone(Form.Element.Methods), 
    1841       "TEXTAREA": Object.clone(Form.Element.Methods) 
    1842     }); 
    1843   } 
    1844  
    1845   if (arguments.length == 2) { 
    1846     var tagName = methods; 
    1847     methods = arguments[1]; 
    1848   } 
    1849  
    1850   if (!tagName) Object.extend(Element.Methods, methods || {}); 
    1851   else { 
    1852     if (tagName.constructor == Array) tagName.each(extend); 
    1853     else extend(tagName); 
    1854   } 
    1855  
    1856   function extend(tagName) { 
    1857     tagName = tagName.toUpperCase(); 
    1858     if (!Element.Methods.ByTag[tagName]) 
    1859       Element.Methods.ByTag[tagName] = {}; 
    1860     Object.extend(Element.Methods.ByTag[tagName], methods); 
    1861   } 
     1589  Object.extend(Element.Methods, methods || {}); 
    18621590 
    18631591  function copy(methods, destination, onlyIfAbsent) { 
     
    18711599  } 
    18721600 
    1873   function findDOMClass(tagName) { 
    1874     var klass; 
    1875     var trans = { 
    1876       "OPTGROUP": "OptGroup", "TEXTAREA": "TextArea", "P": "Paragraph", 
    1877       "FIELDSET": "FieldSet", "UL": "UList", "OL": "OList", "DL": "DList", 
    1878       "DIR": "Directory", "H1": "Heading", "H2": "Heading", "H3": "Heading", 
    1879       "H4": "Heading", "H5": "Heading", "H6": "Heading", "Q": "Quote", 
    1880       "INS": "Mod", "DEL": "Mod", "A": "Anchor", "IMG": "Image", "CAPTION": 
    1881       "TableCaption", "COL": "TableCol", "COLGROUP": "TableCol", "THEAD": 
    1882       "TableSection", "TFOOT": "TableSection", "TBODY": "TableSection", "TR": 
    1883       "TableRow", "TH": "TableCell", "TD": "TableCell", "FRAMESET": 
    1884       "FrameSet", "IFRAME": "IFrame" 
    1885     }; 
    1886     if (trans[tagName]) klass = 'HTML' + trans[tagName] + 'Element'; 
    1887     if (window[klass]) return window[klass]; 
    1888     klass = 'HTML' + tagName + 'Element'; 
    1889     if (window[klass]) return window[klass]; 
    1890     klass = 'HTML' + tagName.capitalize() + 'Element'; 
    1891     if (window[klass]) return window[klass]; 
    1892  
    1893     window[klass] = {}; 
    1894     window[klass].prototype = document.createElement(tagName).__proto__; 
    1895     return window[klass]; 
    1896   } 
    1897  
    1898   if (F.ElementExtensions) { 
     1601  if (typeof HTMLElement != 'undefined') { 
    18991602    copy(Element.Methods, HTMLElement.prototype); 
    19001603    copy(Element.Methods.Simulated, HTMLElement.prototype, true); 
    1901   } 
    1902  
    1903   if (F.SpecificElementExtensions) { 
    1904     for (var tag in Element.Methods.ByTag) { 
    1905       var klass = findDOMClass(tag); 
    1906       if (typeof klass == "undefined") continue; 
    1907       copy(T[tag], klass.prototype); 
    1908     } 
    1909   } 
    1910  
    1911   Object.extend(Element, Element.Methods); 
    1912   delete Element.ByTag; 
    1913 }; 
    1914  
    1915 var Toggle = { display: Element.toggle }; 
     1604    copy(Form.Methods, HTMLFormElement.prototype); 
     1605    [HTMLInputElement, HTMLTextAreaElement, HTMLSelectElement].each(function(klass) { 
     1606      copy(Form.Element.Methods, klass.prototype); 
     1607    }); 
     1608    _nativeExtensions = true; 
     1609  } 
     1610
     1611 
     1612var Toggle = new Object(); 
     1613Toggle.display = Element.toggle; 
    19161614 
    19171615/*--------------------------------------------------------------------------*/ 
     
    20441742 
    20451743Object.extend(Element.ClassNames.prototype, Enumerable); 
    2046 /* Portions of the Selector class are derived from Jack Slocum’s DomQuery, 
    2047  * part of YUI-Ext version 0.40, distributed under the terms of an MIT-style 
    2048  * license.  Please see http://www.yui-ext.com/ for more information. */ 
    2049  
    20501744var Selector = Class.create(); 
    2051  
    20521745Selector.prototype = { 
    20531746  initialize: function(expression) { 
    2054     this.expression = expression.strip(); 
     1747    this.params = {classNames: []}; 
     1748    this.expression = expression.toString().strip(); 
     1749    this.parseExpression(); 
    20551750    this.compileMatcher(); 
    20561751  }, 
    20571752 
     1753  parseExpression: function() { 
     1754    function abort(message) { throw 'Parse error in selector: ' + message; } 
     1755 
     1756    if (this.expression == '')  abort('empty expression'); 
     1757 
     1758    var params = this.params, expr = this.expression, match, modifier, clause, rest; 
     1759    while (match = expr.match(/^(.*)\[([a-z0-9_:-]+?)(?:([~\|!]?=)(?:"([^"]*)"|([^\]\s]*)))?\]$/i)) { 
     1760      params.attributes = params.attributes || []; 
     1761      params.attributes.push({name: match[2], operator: match[3], value: match[4] || match[5] || ''}); 
     1762      expr = match[1]; 
     1763    } 
     1764 
     1765    if (expr == '*') return this.params.wildcard = true; 
     1766 
     1767    while (match = expr.match(/^([^a-z0-9_-])?([a-z0-9_-]+)(.*)/i)) { 
     1768      modifier = match[1], clause = match[2], rest = match[3]; 
     1769      switch (modifier) { 
     1770        case '#':       params.id = clause; break; 
     1771        case '.':       params.classNames.push(clause); break; 
     1772        case '': 
     1773        case undefined: params.tagName = clause.toUpperCase(); break; 
     1774        default:        abort(expr.inspect()); 
     1775      } 
     1776      expr = rest; 
     1777    } 
     1778 
     1779    if (expr.length > 0) abort(expr.inspect()); 
     1780  }, 
     1781 
     1782  buildMatchExpression: function() { 
     1783    var params = this.params, conditions = [], clause; 
     1784 
     1785    if (params.wildcard) 
     1786      conditions.push('true'); 
     1787    if (clause = params.id) 
     1788      conditions.push('element.readAttribute("id") == ' + clause.inspect()); 
     1789    if (clause = params.tagName) 
     1790      conditions.push('element.tagName.toUpperCase() == ' + clause.inspect()); 
     1791    if ((clause = params.classNames).length > 0) 
     1792      for (var i = 0, length = clause.length; i < length; i++) 
     1793        conditions.push('element.hasClassName(' + clause[i].inspect() + ')'); 
     1794    if (clause = params.attributes) { 
     1795      clause.each(function(attribute) { 
     1796        var value = 'element.readAttribute(' + attribute.name.inspect() + ')'; 
     1797        var splitValueBy = function(delimiter) { 
     1798          return value + ' && ' + value + '.split(' + delimiter.inspect() + ')'; 
     1799        } 
     1800 
     1801        switch (attribute.operator) { 
     1802          case '=':       conditions.push(value + ' == ' + attribute.value.inspect()); break; 
     1803          case '~=':      conditions.push(splitValueBy(' ') + '.include(' + attribute.value.inspect() + ')'); break; 
     1804          case '|=':      conditions.push( 
     1805                            splitValueBy('-') + '.first().toUpperCase() == ' + attribute.value.toUpperCase().inspect() 
     1806                          ); break; 
     1807          case '!=':      conditions.push(value + ' != ' + attribute.value.inspect()); break; 
     1808          case '': 
     1809          case undefined: conditions.push('element.hasAttribute(' + attribute.name.inspect() + ')'); break; 
     1810          default:        throw 'Unknown operator ' + attribute.operator + ' in selector'; 
     1811        } 
     1812      }); 
     1813    } 
     1814 
     1815    return conditions.join(' && '); 
     1816  }, 
     1817 
    20581818  compileMatcher: function() { 
    2059     // Selectors with namespaced attributes can't use the XPath version 
    2060     if (Prototype.BrowserFeatures.XPath && !(/\[[\w-]*?:/).test(this.expression)) 
    2061       return this.compileXPathMatcher(); 
    2062  
    2063     var e = this.expression, ps = Selector.patterns, h = Selector.handlers, 
    2064         c = Selector.criteria, le, p, m; 
    2065  
    2066     if (Selector._cache[e]) { 
    2067       this.matcher = Selector._cache[e]; return; 
    2068     } 
    2069     this.matcher = ["this.matcher = function(root) {", 
    2070                     "var r = root, h = Selector.handlers, c = false, n;"]; 
    2071  
    2072     while (e && le != e && (/\S/).test(e)) { 
    2073       le = e; 
    2074       for (var i in ps) { 
    2075         p = ps[i]; 
    2076         if (m = e.match(p)) { 
    2077           this.matcher.push(typeof c[i] == 'function' ? c[i](m) : 
    2078               new Template(c[i]).evaluate(m)); 
    2079           e = e.replace(m[0], ''); 
    2080           break; 
    2081         } 
    2082       } 
    2083     } 
    2084  
    2085     this.matcher.push("return h.unique(n);\n}"); 
    2086     eval(this.matcher.join('\n')); 
    2087     Selector._cache[this.expression] = this.matcher; 
    2088   }, 
    2089  
    2090   compileXPathMatcher: function() { 
    2091     var e = this.expression, ps = Selector.patterns, 
    2092         x = Selector.xpath, le,  m; 
    2093  
    2094     if (Selector._cache[e]) { 
    2095       this.xpath = Selector._cache[e]; return; 
    2096     } 
    2097  
    2098     this.matcher = ['.//*']; 
    2099     while (e && le != e && (/\S/).test(e)) { 
    2100       le = e; 
    2101       for (var i in ps) { 
    2102         if (m = e.match(ps[i])) { 
    2103           this.matcher.push(typeof x[i] == 'function' ? x[i](m) : 
    2104             new Template(x[i]).evaluate(m)); 
    2105           e = e.replace(m[0], ''); 
    2106           break; 
    2107         } 
    2108       } 
    2109     } 
    2110  
    2111     this.xpath = this.matcher.join(''); 
    2112     Selector._cache[this.expression] = this.xpath; 
    2113   }, 
    2114  
    2115   findElements: function(root) { 
    2116     root = root || document; 
    2117     if (this.xpath) return document._getElementsByXPath(this.xpath, root); 
    2118     return this.matcher(root); 
    2119   }, 
    2120  
    2121   match: function(element) { 
    2122     return this.findElements(document).include(element); 
     1819    this.match = new Function('element', 'if (!element.tagName) return false; \ 
     1820      element = $(element); \ 
     1821      return ' + this.buildMatchExpression()); 
     1822  }, 
     1823 
     1824  findElements: function(scope) { 
     1825    var element; 
     1826 
     1827    if (element = $(this.params.id)) 
     1828      if (this.match(element)) 
     1829        if (!scope || Element.childOf(element, scope)) 
     1830          return [element]; 
     1831 
     1832    scope = (scope || document).getElementsByTagName(this.params.tagName || '*'); 
     1833 
     1834    var results = []; 
     1835    for (var i = 0, length = scope.length; i < length; i++) 
     1836      if (this.match(element = scope[i])) 
     1837        results.push(Element.extend(element)); 
     1838 
     1839    return results; 
    21231840  }, 
    21241841 
    21251842  toString: function() { 
    21261843    return this.expression; 
    2127   }, 
    2128  
    2129   inspect: function() { 
    2130     return "#<Selector:" + this.expression.inspect() + ">"; 
    2131   } 
    2132 }; 
     1844  } 
     1845
    21331846 
    21341847Object.extend(Selector, { 
    2135   _cache: {}, 
    2136  
    2137   xpath: { 
    2138     descendant:   "//*", 
    2139     child:        "/*", 
    2140     adjacent:     "/following-sibling::*[1]", 
    2141     laterSibling: '/following-sibling::*', 
    2142     tagName:      function(m) { 
    2143       if (m[1] == '*') return ''; 
    2144       return "[local-name()='" + m[1].toLowerCase() + 
    2145              "' or local-name()='" + m[1].toUpperCase() + "']"; 
    2146     }, 
    2147     className:    "[contains(concat(' ', @class, ' '), ' #{1} ')]", 
    2148     id:           "[@id='#{1}']", 
    2149     attrPresence: "[@#{1}]", 
    2150     attr: function(m) { 
    2151       m[3] = m[5] || m[6]; 
    2152       return new Template(Selector.xpath.operators[m[2]]).evaluate(m); 
    2153     }, 
    2154     pseudo: function(m) { 
    2155       var h = Selector.xpath.pseudos[m[1]]; 
    2156       if (!h) return ''; 
    2157       if (typeof h === 'function') return h(m); 
    2158       return new Template(Selector.xpath.pseudos[m[1]]).evaluate(m); 
    2159     }, 
    2160     operators: { 
    2161       '=':  "[@#{1}='#{3}']", 
    2162       '!=': "[@#{1}!='#{3}']", 
    2163       '^=': "[starts-with(@#{1}, '#{3}')]", 
    2164       '$=': "[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']", 
    2165       '*=': "[contains(@#{1}, '#{3}')]", 
    2166       '~=': "[contains(concat(' ', @#{1}, ' '), ' #{3} ')]", 
    2167       '|=': "[contains(concat('-', @#{1}, '-'), '-#{3}-')]" 
    2168     }, 
    2169     pseudos: { 
    2170       'first-child': '[not(preceding-sibling::*)]', 
    2171       'last-child':  '[not(following-sibling::*)]', 
    2172       'only-child':  '[not(preceding-sibling::* or following-sibling::*)]', 
    2173       'empty':       "[count(*) = 0 and (count(text()) = 0 or translate(text(), ' \t\r\n', '') = '')]", 
    2174       'checked':     "[@checked]", 
    2175       'disabled':    "[@disabled]", 
    2176       'enabled':     "[not(@disabled)]", 
    2177       'not': function(m) { 
    2178         var e = m[6], p = Selector.patterns, 
    2179             x = Selector.xpath, le, m, v; 
    2180  
    2181         var exclusion = []; 
    2182         while (e && le != e && (/\S/).test(e)) { 
    2183           le = e; 
    2184           for (var i in p) { 
    2185             if (m = e.match(p[i])) { 
    2186               v = typeof x[i] == 'function' ? x[i](m) : new Template(x[i]).evaluate(m); 
    2187               exclusion.push("(" + v.substring(1, v.length - 1) + ")"); 
    2188               e = e.replace(m[0], ''); 
    2189               break; 
    2190             } 
    2191           } 
    2192         } 
    2193         return "[not(" + exclusion.join(" and ") + ")]"; 
    2194       }, 
    2195       'nth-child':      function(m) { 
    2196         return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ", m); 
    2197       }, 
    2198       'nth-last-child': function(m) { 
    2199         return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ", m); 
    2200       }, 
    2201       'nth-of-type':    function(m) { 
    2202         return Selector.xpath.pseudos.nth("position() ", m); 
    2203       }, 
    2204       'nth-last-of-type': function(m) { 
    2205         return Selector.xpath.pseudos.nth("(last() + 1 - position()) ", m); 
    2206       }, 
    2207       'first-of-type':  function(m) { 
    2208         m[6] = "1"; return Selector.xpath.pseudos['nth-of-type'](m); 
    2209       }, 
    2210       'last-of-type':   function(m) { 
    2211         m[6] = "1"; return Selector.xpath.pseudos['nth-last-of-type'](m); 
    2212       }, 
    2213       'only-of-type':   function(m) { 
    2214         var p = Selector.xpath.pseudos; return p['first-of-type'](m) + p['last-of-type'](m); 
    2215       }, 
    2216       nth: function(fragment, m) { 
    2217         var mm, formula = m[6], predicate; 
    2218         if (formula == 'even') formula = '2n+0'; 
    2219         if (formula == 'odd')  formula = '2n+1'; 
    2220         if (mm = formula.match(/^(\d+)$/)) // digit only 
    2221           return '[' + fragment + "= " + mm[1] + ']'; 
    2222         if (mm = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b 
    2223           if (mm[1] == "-") mm[1] = -1; 
    2224           var a = mm[1] ? Number(mm[1]) : 1; 
    2225           var b = mm[2] ? Number(mm[2]) : 0; 
    2226           predicate = "[((#{fragment} - #{b}) mod #{a} = 0) and " + 
    2227           "((#{fragment} - #{b}) div #{a} >= 0)]"; 
    2228           return new Template(predicate).evaluate({ 
    2229             fragment: fragment, a: a, b: b }); 
    2230         } 
    2231       } 
    2232     } 
    2233   }, 
    2234  
    2235   criteria: { 
    2236     tagName:      'n = h.tagName(n, r, "#{1}", c);   c = false;', 
    2237     className:    'n = h.className(n, r, "#{1}", c); c = false;', 
    2238     id:           'n = h.id(n, r, "#{1}", c);        c = false;', 
    2239     attrPresence: 'n = h.attrPresence(n, r, "#{1}"); c = false;', 
    2240     attr: function(m) { 
    2241       m[3] = (m[5] || m[6]); 
    2242       return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}"); c = false;').evaluate(m); 
    2243     }, 
    2244     pseudo:       function(m) { 
    2245       if (m[6]) m[6] = m[6].replace(/"/g, '\\"'); 
    2246       return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(m); 
    2247     }, 
    2248     descendant:   'c = "descendant";', 
    2249     child:        'c = "child";', 
    2250     adjacent:     'c = "adjacent";', 
    2251     laterSibling: 'c = "laterSibling";' 
    2252   }, 
    2253  
    2254   patterns: { 
    2255     // combinators must be listed first 
    2256     // (and descendant needs to be last combinator) 
    2257     laterSibling: /^\s*~\s*/, 
    2258     child:        /^\s*>\s*/, 
    2259     adjacent:     /^\s*\+\s*/, 
    2260     descendant:   /^\s/, 
    2261  
    2262     // selectors follow 
    2263     tagName:      /^\s*(\*|[\w\-]+)(\b|$)?/, 
    2264     id:           /^#([\w\-\*]+)(\b|$)/, 
    2265     className:    /^\.([\w\-\*]+)(\b|$)/, 
    2266     pseudo:       /^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|\s|(?=:))/, 
    2267     attrPresence: /^\[([\w]+)\]/, 
    2268     attr:         /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\]]*?)\4|([^'"][^\]]*?)))?\]/ 
    2269   }, 
    2270  
    2271   handlers: { 
    2272     // UTILITY FUNCTIONS 
    2273     // joins two collections 
    2274     concat: function(a, b) { 
    2275       for (var i = 0, node; node = b[i]; i++) 
    2276         a.push(node); 
    2277       return a; 
    2278     }, 
    2279  
    2280     // marks an array of nodes for counting 
    2281     mark: function(nodes) { 
    2282       for (var i = 0, node; node = nodes[i]; i++) 
    2283         node._counted = true; 
    2284       return nodes; 
    2285     }, 
    2286  
    2287     unmark: function(nodes) { 
    2288       for (var i = 0, node; node = nodes[i]; i++) 
    2289         node._counted = undefined; 
    2290       return nodes; 
    2291     }, 
    2292  
    2293     // mark each child node with its position (for nth calls) 
    2294     // "ofType" flag indicates whether we're indexing for nth-of-type 
    2295     // rather than nth-child 
    2296     index: function(parentNode, reverse, ofType) { 
    2297       parentNode._counted = true; 
    2298       if (reverse) { 
    2299         for (var nodes = parentNode.childNodes, i = nodes.length - 1, j = 1; i >= 0; i--) { 
    2300           node = nodes[i]; 
    2301           if (node.nodeType == 1 && (!ofType || node._counted)) node.nodeIndex = j++; 
    2302         } 
    2303       } else { 
    2304         for (var i = 0, j = 1, nodes = parentNode.childNodes; node = nodes[i]; i++) 
    2305           if (node.nodeType == 1 && (!ofType || node._counted)) node.nodeIndex = j++; 
    2306       } 
    2307     }, 
    2308  
    2309     // filters out duplicates and extends all nodes 
    2310     unique: function(nodes) { 
    2311       if (nodes.length == 0) return nodes; 
    2312       var results = [], n; 
    2313       for (var i = 0, l = nodes.length; i < l; i++) 
    2314         if (!(n = nodes[i])._counted) { 
    2315           n._counted = true; 
    2316           results.push(Element.extend(n)); 
    2317         } 
    2318       return Selector.handlers.unmark(results); 
    2319     }, 
    2320  
    2321     // COMBINATOR FUNCTIONS 
    2322     descendant: function(nodes) { 
    2323       var h = Selector.handlers; 
    2324       for (var i = 0, results = [], node; node = nodes[i]; i++) 
    2325         h.concat(results, node.getElementsByTagName('*')); 
    2326       return results; 
    2327     }, 
    2328  
    2329     child: function(nodes) { 
    2330       var h = Selector.handlers; 
    2331       for (var i = 0, results = [], node; node = nodes[i]; i++) { 
    2332         for (var j = 0, children = [], child; child = node.childNodes[j]; j++) 
    2333           if (child.nodeType == 1 && child.tagName != '!') results.push(child); 
    2334       } 
    2335       return results; 
    2336     }, 
    2337  
    2338     adjacent: function(nodes) { 
    2339       for (var i = 0, results = [], node; node = nodes[i]; i++) { 
    2340         var next = this.nextElementSibling(node); 
    2341         if (next) results.push(next); 
    2342       } 
    2343       return results; 
    2344     }, 
    2345  
    2346     laterSibling: function(nodes) { 
    2347       var h = Selector.handlers; 
    2348       for (var i = 0, results = [], node; node = nodes[i]; i++) 
    2349         h.concat(results, Element.nextSiblings(node)); 
    2350       return results; 
    2351     }, 
    2352  
    2353     nextElementSibling: function(node) { 
    2354       while (node = node.nextSibling) 
    2355               if (node.nodeType == 1) return node; 
    2356       return null; 
    2357     }, 
    2358  
    2359     previousElementSibling: function(node) { 
    2360       while (node = node.previousSibling) 
    2361         if (node.nodeType == 1) return node; 
    2362       return null; 
    2363     }, 
    2364  
    2365     // TOKEN FUNCTIONS 
    2366     tagName: function(nodes, root, tagName, combinator) { 
    2367       tagName = tagName.toUpperCase(); 
    2368       var results = [], h = Selector.handlers; 
    2369       if (nodes) { 
    2370         if (combinator) { 
    2371           // fastlane for ordinary descendant combinators 
    2372           if (combinator == "descendant") { 
    2373             for (var i = 0, node; node = nodes[i]; i++) 
    2374               h.concat(results, node.getElementsByTagName(tagName)); 
    2375             return results; 
    2376           } else nodes = this[combinator](nodes); 
    2377           if (tagName == "*") return nodes; 
    2378         } 
    2379         for (var i = 0, node; node = nodes[i]; i++) 
    2380           if (node.tagName.toUpperCase() == tagName) results.push(node); 
    2381         return results; 
    2382       } else return root.getElementsByTagName(tagName); 
    2383     }, 
    2384  
    2385     id: function(nodes, root, id, combinator) { 
    2386       var targetNode = $(id), h = Selector.handlers; 
    2387       if (!nodes && root == document) return targetNode ? [targetNode] : []; 
    2388       if (nodes) { 
    2389         if (combinator) { 
    2390           if (combinator == 'child') { 
    2391             for (var i = 0, node; node = nodes[i]; i++) 
    2392               if (targetNode.parentNode == node) return [targetNode]; 
    2393           } else if (combinator == 'descendant') { 
    2394             for (var i = 0, node; node = nodes[i]; i++) 
    2395               if (Element.descendantOf(targetNode, node)) return [targetNode]; 
    2396           } else if (combinator == 'adjacent') { 
    2397             for (var i = 0, node; node = nodes[i]; i++) 
    2398               if (Selector.handlers.previousElementSibling(targetNode) == node) 
    2399                 return [targetNode]; 
    2400           } else nodes = h[combinator](nodes); 
    2401         } 
    2402         for (var i = 0, node; node = nodes[i]; i++) 
    2403           if (node == targetNode) return [targetNode]; 
    2404         return []; 
    2405       } 
    2406       return (targetNode && Element.descendantOf(targetNode, root)) ? [targetNode] : []; 
    2407     }, 
    2408  
    2409     className: function(nodes, root, className, combinator) { 
    2410       if (nodes && combinator) nodes = this[combinator](nodes); 
    2411       return Selector.handlers.byClassName(nodes, root, className); 
    2412     }, 
    2413  
    2414     byClassName: function(nodes, root, className) { 
    2415       if (!nodes) nodes = Selector.handlers.descendant([root]); 
    2416       var needle = ' ' + className + ' '; 
    2417       for (var i = 0, results = [], node, nodeClassName; node = nodes[i]; i++) { 
    2418         nodeClassName = node.className; 
    2419         if (nodeClassName.length == 0) continue; 
    2420         if (nodeClassName == className || (' ' + nodeClassName + ' ').include(needle)) 
    2421           results.push(node); 
    2422       } 
    2423       return results; 
    2424     }, 
    2425  
    2426     attrPresence: function(nodes, root, attr) { 
    2427       var results = []; 
    2428       for (var i = 0, node; node = nodes[i]; i++) 
    2429         if (Element.hasAttribute(node, attr)) results.push(node); 
    2430       return results; 
    2431     }, 
    2432  
    2433     attr: function(nodes, root, attr, value, operator) { 
    2434       if (!nodes) nodes = root.getElementsByTagName("*"); 
    2435       var handler = Selector.operators[operator], results = []; 
    2436       for (var i = 0, node; node = nodes[i]; i++) { 
    2437         var nodeValue = Element.readAttribute(node, attr); 
    2438         if (nodeValue === null) continue; 
    2439         if (handler(nodeValue, value)) results.push(node); 
    2440       } 
    2441       return results; 
    2442     }, 
    2443  
    2444     pseudo: function(nodes, name, value, root, combinator) { 
    2445       if (nodes && combinator) nodes = this[combinator](nodes); 
    2446       if (!nodes) nodes = root.getElementsByTagName("*"); 
    2447       return Selector.pseudos[name](nodes, value, root); 
    2448     } 
    2449   }, 
    2450  
    2451   pseudos: { 
    2452     'first-child': function(nodes, value, root) { 
    2453       for (var i = 0, results = [], node; node = nodes[i]; i++) { 
    2454         if (Selector.handlers.previousElementSibling(node)) continue; 
    2455           results.push(node); 
    2456       } 
    2457       return results; 
    2458     }, 
    2459     'last-child': function(nodes, value, root) { 
    2460       for (var i = 0, results = [], node; node = nodes[i]; i++) { 
    2461         if (Selector.handlers.nextElementSibling(node)) continue; 
    2462           results.push(node); 
    2463       } 
    2464       return results; 
    2465     }, 
    2466     'only-child': function(nodes, value, root) { 
    2467       var h = Selector.handlers; 
    2468       for (var i = 0, results = [], node; node = nodes[i]; i++) 
    2469         if (!h.previousElementSibling(node) && !h.nextElementSibling(node)) 
    2470           results.push(node); 
    2471       return results; 
    2472     }, 
    2473     'nth-child':        function(nodes, formula, root) { 
    2474       return Selector.pseudos.nth(nodes, formula, root); 
    2475     }, 
    2476     'nth-last-child':   function(nodes, formula, root) { 
    2477       return Selector.pseudos.nth(nodes, formula, root, true); 
    2478     }, 
    2479     'nth-of-type':      function(nodes, formula, root) { 
    2480       return Selector.pseudos.nth(nodes, formula, root, false, true); 
    2481     }, 
    2482     'nth-last-of-type': function(nodes, formula, root) { 
    2483       return Selector.pseudos.nth(nodes, formula, root, true, true); 
    2484     }, 
    2485     'first-of-type':    function(nodes, formula, root) { 
    2486       return Selector.pseudos.nth(nodes, "1", root, false, true); 
    2487     }, 
    2488     'last-of-type':     function(nodes, formula, root) { 
    2489       return Selector.pseudos.nth(nodes, "1", root, true, true); 
    2490     }, 
    2491     'only-of-type':     function(nodes, formula, root) { 
    2492       var p = Selector.pseudos; 
    2493       return p['last-of-type'](p['first-of-type'](nodes, formula, root), formula, root); 
    2494     }, 
    2495  
    2496     // handles the an+b logic 
    2497     getIndices: function(a, b, total) { 
    2498       if (a == 0) return b > 0 ? [b] : []; 
    2499       return $R(1, total).inject([], function(memo, i) { 
    2500         if (0 == (i - b) % a && (i - b) / a >= 0) memo.push(i); 
    2501         return memo; 
     1848  matchElements: function(elements, expression) { 
     1849    var selector = new Selector(expression); 
     1850    return elements.select(selector.match.bind(selector)).map(Element.extend); 
     1851  }, 
     1852 
     1853  findElement: function(elements, expression, index) { 
     1854    if (typeof expression == 'number') index = expression, expression = false; 
     1855    return Selector.matchElements(elements, expression || '*')[index || 0]; 
     1856  }, 
     1857 
     1858  findChildElements: function(element, expressions) { 
     1859    return expressions.map(function(expression) { 
     1860      return expression.match(/[^\s"]+(?:"[^"]*"[^\s"]+)*/g).inject([null], function(results, expr) { 
     1861        var selector = new Selector(expr); 
     1862        return results.inject([], function(elements, result) { 
     1863          return elements.concat(selector.findElements(result || element)); 
     1864        }); 
    25021865      }); 
    2503     }, 
    2504  
    2505     // handles nth(-last)-child, nth(-last)-of-type, and (first|last)-of-type 
    2506     nth: function(nodes, formula, root, reverse, ofType) { 
    2507       if (nodes.length == 0) return []; 
    2508       if (formula == 'even') formula = '2n+0'; 
    2509       if (formula == 'odd')  formula = '2n+1'; 
    2510       var h = Selector.handlers, results = [], indexed = [], m; 
    2511       h.mark(nodes); 
    2512       for (var i = 0, node; node = nodes[i]; i++) { 
    2513         if (!node.parentNode._counted) { 
    2514           h.index(node.parentNode, reverse, ofType); 
    2515           indexed.push(node.parentNode); 
    2516         } 
    2517       } 
    2518       if (formula.match(/^\d+$/)) { // just a number 
    2519         formula = Number(formula); 
    2520         for (var i = 0, node; node = nodes[i]; i++) 
    2521           if (node.nodeIndex == formula) results.push(node); 
    2522       } else if (m = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b 
    2523         if (m[1] == "-") m[1] = -1; 
    2524         var a = m[1] ? Number(m[1]) : 1; 
    2525         var b = m[2] ? Number(m[2]) : 0; 
    2526         var indices = Selector.pseudos.getIndices(a, b, nodes.length); 
    2527         for (var i = 0, node, l = indices.length; node = nodes[i]; i++) { 
    2528           for (var j = 0; j < l; j++) 
    2529             if (node.nodeIndex == indices[j]) results.push(node); 
    2530         } 
    2531       } 
    2532       h.unmark(nodes); 
    2533       h.unmark(indexed); 
    2534       return results; 
    2535     }, 
    2536  
    2537     'empty': function(nodes, value, root) { 
    2538       for (var i = 0, results = [], node; node = nodes[i]; i++) { 
    2539         // IE treats comments as element nodes 
    2540         if (node.tagName == '!' || (node.firstChild && !node.innerHTML.match(/^\s*$/))) continue; 
    2541         results.push(node); 
    2542       } 
    2543       return results; 
    2544     }, 
    2545  
    2546     'not': function(nodes, selector, root) { 
    2547       var h = Selector.handlers, selectorType, m; 
    2548       var exclusions = new Selector(selector).findElements(root); 
    2549       h.mark(exclusions); 
    2550       for (var i = 0, results = [], node; node = nodes[i]; i++) 
    2551         if (!node._counted) results.push(node); 
    2552       h.unmark(exclusions); 
    2553       return results; 
    2554     }, 
    2555  
    2556     'enabled': function(nodes, value, root) { 
    2557       for (var i = 0, results = [], node; node = nodes[i]; i++) 
    2558         if (!node.disabled) results.push(node); 
    2559       return results; 
    2560     }, 
    2561  
    2562     'disabled': function(nodes, value, root) { 
    2563       for (var i = 0, results = [], node; node = nodes[i]; i++) 
    2564         if (node.disabled) results.push(node); 
    2565       return results; 
    2566     }, 
    2567  
    2568     'checked': function(nodes, value, root) { 
    2569       for (var i = 0, results = [], node; node = nodes[i]; i++) 
    2570         if (node.checked) results.push(node); 
    2571       return results; 
    2572     } 
    2573   }, 
    2574  
    2575   operators: { 
    2576     '=':  function(nv, v) { return nv == v; }, 
    2577     '!=': function(nv, v) { return nv != v; }, 
    2578     '^=': function(nv, v) { return nv.startsWith(v); }, 
    2579     '$=': function(nv, v) { return nv.endsWith(v); }, 
    2580     '*=': function(nv, v) { return nv.include(v); }, 
    2581     '~=': function(nv, v) { return (' ' + nv + ' ').include(' ' + v + ' '); }, 
    2582     '|=': function(nv, v) { return ('-' + nv.toUpperCase() + '-').include('-' + v.toUpperCase() + '-'); } 
    2583   }, 
    2584  
    2585   matchElements: function(elements, expression) { 
    2586     var matches = new Selector(expression).findElements(), h = Selector.handlers; 
    2587     h.mark(matches); 
    2588     for (var i = 0, results = [], element; element = elements[i]; i++) 
    2589       if (element._counted) results.push(element); 
    2590     h.unmark(matches); 
    2591     return results; 
    2592   }, 
    2593  
    2594   findElement: function(elements, expression, index) { 
    2595     if (typeof expression == 'number') { 
    2596       index = expression; expression = false; 
    2597     } 
    2598     return Selector.matchElements(elements, expression || '*')[index || 0]; 
    2599   }, 
    2600  
    2601   findChildElements: function(element, expressions) { 
    2602     var exprs = expressions.join(','), expressions = []; 
    2603     exprs.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m) { 
    2604       expressions.push(m[1].strip()); 
    2605     }); 
    2606     var results = [], h = Selector.handlers; 
    2607     for (var i = 0, l = expressions.length, selector; i < l; i++) { 
    2608       selector = new Selector(expressions[i].strip()); 
    2609       h.concat(results, selector.findElements(element)); 
    2610     } 
    2611     return (l > 1) ? h.unique(results) : results; 
     1866    }).flatten(); 
    26121867  } 
    26131868}); 
     
    26261881      if (!element.disabled && element.name) { 
    26271882        var key = element.name, value = $(element).getValue(); 
    2628         if (value != null) { 
    2629                if (key in result) { 
     1883        if (value != undefined) { 
     1884          if (result[key]) { 
    26301885            if (result[key].constructor != Array) result[key] = [result[key]]; 
    26311886            result[key].push(value); 
     
    26741929  disable: function(form) { 
    26751930    form = $(form); 
    2676     Form.getElements(form).invoke('disable'); 
     1931    form.getElements().each(function(element) { 
     1932      element.blur(); 
     1933      element.disabled = 'true'; 
     1934    }); 
    26771935    return form; 
    26781936  }, 
     
    26801938  enable: function(form) { 
    26811939    form = $(form); 
    2682     Form.getElements(form).invoke('enable'); 
     1940    form.getElements().each(function(element) { 
     1941      element.disabled = ''; 
     1942    }); 
    26831943    return form; 
    26841944  }, 
     
    26951955    form.findFirstElement().activate(); 
    26961956    return form; 
    2697   }, 
    2698  
    2699   request: function(form, options) { 
    2700     form = $(form), options = Object.clone(options || {}); 
    2701  
    2702     var params = options.parameters; 
    2703     options.parameters = form.serialize(true); 
    2704  
    2705     if (params) { 
    2706       if (typeof params == 'string') params = params.toQueryParams(); 
    2707       Object.extend(options.parameters, params); 
    2708     } 
    2709  
    2710     if (form.hasAttribute('method') && !options.method) 
    2711       options.method = form.method; 
    2712  
    2713     return new Ajax.Request(form.readAttribute('action'), options); 
    2714   } 
    2715 
     1957  } 
     1958
     1959 
     1960Object.extend(Form, Form.Methods); 
    27161961 
    27171962/*--------------------------------------------------------------------------*/ 
     
    27602005  activate: function(element) { 
    27612006    element = $(element); 
    2762     try { 
    2763       element.focus(); 
    2764       if (element.select && (element.tagName.toLowerCase() != 'input' || 
    2765         !['button', 'reset', 'submit'].include(element.type))) 
    2766         element.select(); 
    2767     } catch (e) {} 
     2007    element.focus(); 
     2008    if (element.select && ( element.tagName.toLowerCase() != 'input' || 
     2009      !['button', 'reset', 'submit'].include(element.type) ) ) 
     2010      element.select(); 
    27682011    return element; 
    27692012  }, 
     
    27712014  disable: function(element) { 
    27722015    element = $(element); 
    2773     element.blur(); 
    27742016    element.disabled = true; 
    27752017    return element; 
     
    27782020  enable: function(element) { 
    27792021    element = $(element); 
     2022    element.blur(); 
    27802023    element.disabled = false; 
    27812024    return element; 
     
    27832026} 
    27842027 
    2785 /*--------------------------------------------------------------------------*/ 
    2786  
     2028Object.extend(Form.Element, Form.Element.Methods); 
    27872029var Field = Form.Element; 
    2788 var $F = Form.Element.Methods.getValue; 
     2030var $F = Form.Element.getValue; 
    27892031 
    27902032/*--------------------------------------------------------------------------*/ 
     
    29532195 
    29542196  element: function(event) { 
    2955     return $(event.target || event.srcElement)
     2197    return event.target || event.srcElement
    29562198  }, 
    29572199 
     
    30182260 
    30192261    if (name == 'keypress' && 
    3020       (Prototype.Browser.WebKit || element.attachEvent)) 
     2262        (navigator.appVersion.match(/Konqueror|Safari|KHTML/) 
     2263        || element.attachEvent)) 
    30212264      name = 'keydown'; 
    30222265 
     
    30292272 
    30302273    if (name == 'keypress' && 
    3031         (Prototype.Browser.WebKit || element.attachEvent)) 
     2274        (navigator.appVersion.match(/Konqueror|Safari|KHTML/) 
     2275        || element.detachEvent)) 
    30322276      name = 'keydown'; 
    30332277 
     
    30432287 
    30442288/* prevent memory leaks in IE */ 
    3045 if (Prototype.Browser.IE
     2289if (navigator.appVersion.match(/\bMSIE\b/)
    30462290  Event.observe(window, 'unload', Event.unloadCache, false); 
    30472291var Position = { 
     
    31572401 
    31582402      // Safari fix 
    3159       if (element.offsetParent == document.body) 
     2403      if (element.offsetParent==document.body) 
    31602404        if (Element.getStyle(element,'position')=='absolute') break; 
    31612405 
     
    32532497// positioned.  For performance reasons, redefine Position.cumulativeOffset for 
    32542498// KHTML/WebKit only. 
    3255 if (Prototype.Browser.WebKit) { 
     2499if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) { 
    32562500  Position.cumulativeOffset = function(element) { 
    32572501    var valueT = 0, valueL = 0; 
  • trunk/wp-includes/js/scriptaculous/builder.js

    r972 r1005  
    1 // script.aculo.us builder.js v1.7.1_beta2, Sat Apr 28 15:20:12 CEST 2007 
     1// script.aculo.us builder.js v1.7.0, Fri Jan 19 19:16:36 CET 2007 
    22 
    3 // Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) 
     3// Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) 
    44// 
    55// script.aculo.us is freely distributable under the terms of an MIT-style license. 
     
    4949    if(arguments[1]) 
    5050      if(this._isStringOrNumber(arguments[1]) || 
    51         (arguments[1] instanceof Array) || 
    52         arguments[1].tagName) { 
     51        (arguments[1] instanceof Array)) { 
    5352          this._children(element, arguments[1]); 
    5453        } else { 
     
    6867            if(element.tagName.toUpperCase() != elementName) 
    6968              element = parentElement.getElementsByTagName(elementName)[0]; 
    70          
     69           
    7170        }  
    7271 
     
    9493  }, 
    9594  _children: function(element, children) { 
    96     if(children.tagName) { 
    97       element.appendChild(children); 
    98       return; 
    99     } 
    10095    if(typeof children=='object') { // array can hold nodes and text 
    10196      children.flatten().each( function(e) { 
     
    107102      }); 
    108103    } else 
    109       if(Builder._isStringOrNumber(children)) 
    110         element.appendChild(Builder._text(children)); 
     104      if(Builder._isStringOrNumber(children))  
     105        element.appendChild(Builder._text(children)); 
    111106  }, 
    112107  _isStringOrNumber: function(param) { 
  • trunk/wp-includes/js/scriptaculous/controls.js

    r972 r1005  
    1 // script.aculo.us controls.js v1.7.1_beta2, Sat Apr 28 15:20:12 CEST 2007 
    2  
    3 // Copyright (c) 2005-2007 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) 
    4 //           (c) 2005-2007 Ivan Krstic (http://blogs.law.harvard.edu/ivan) 
    5 //           (c) 2005-2007 Jon Tirsen (http://www.tirsen.com) 
     1// script.aculo.us controls.js v1.7.0, Fri Jan 19 19:16:36 CET 2007 
     2 
     3// Copyright (c) 2005, 2006 Thomas Fuchs (http://script.aculo.us, http://mir.aculo.us) 
     4//           (c) 2005, 2006 Ivan Krstic (http://blogs.law.harvard.edu/ivan) 
     5//           (c) 2005, 2006 Jon Tirsen (http://www.tirsen.com) 
    66// Contributors: 
    77//  Richard Livsey 
     
    4444Autocompleter.Base.prototype = { 
    4545  baseInitialize: function(element, update, options) { 
    46     element          = $(element) 
    47     this.element     = element;  
     46    this.element     = $(element);  
    4847    this.update      = $(update);   
    4948    this.hasFocus    = false;  
     
    8584    Element.hide(this.update); 
    8685 
    87     Event.observe(this.element, 'blur', this.onBlur.bindAsEventListener(this)); 
    88     Event.observe(this.element, 'keypress', this.onKeyPress.bindAsEventListener(this)); 
    89  
    90     // Turn autocomplete back on when the user leaves the page, so that the 
    91     // field's value will be remembered on Mozilla-based browsers. 
    92     Event.observe(window, 'beforeunload', function(){  
    93       element.setAttribute('autocomplete', 'on');  
    94     }); 
     86    Event.observe(this.element, "blur", this.onBlur.bindAsEventListener(this)); 
     87    Event.observe(this.element, "keypress", this.onKeyPress.bindAsEventListener(this)); 
    9588  }, 
    9689 
     
    9891    if(Element.getStyle(this.update, 'display')=='none') this.options.onShow(this.element, this.update); 
    9992    if(!this.iefix &&  
    100       (Prototype.Browser.IE) && 
     93      (navigator.appVersion.indexOf('MSIE')>0) && 
     94      (navigator.userAgent.indexOf('Opera')<0) && 
    10195      (Element.getStyle(this.update, 'position')=='absolute')) { 
    10296      new Insertion.After(this.update,  
     
    148142         this.markPrevious(); 
    149143         this.render(); 
    150          if(Prototype.Browser.WebKit) Event.stop(event); 
     144         if(navigator.appVersion.indexOf('AppleWebKit')>0) Event.stop(event); 
    151145         return; 
    152146       case Event.KEY_DOWN: 
    153147         this.markNext(); 
    154148         this.render(); 
    155          if(Prototype.Browser.WebKit) Event.stop(event); 
     149         if(navigator.appVersion.indexOf('AppleWebKit')>0) Event.stop(event); 
    156150         return; 
    157151      } 
    158152     else  
    159153       if(event.keyCode==Event.KEY_TAB || event.keyCode==Event.KEY_RETURN ||  
    160          (Prototype.Browser.WebKit > 0 && event.keyCode == 0)) return; 
     154         (navigator.appVersion.indexOf('AppleWebKit') > 0 && event.keyCode == 0)) return; 
    161155 
    162156    this.changed = true; 
     
    204198          Element.addClassName(this.getEntry(i),"selected") :  
    205199          Element.removeClassName(this.getEntry(i),"selected"); 
     200         
    206201      if(this.hasFocus) {  
    207202        this.show(); 
     
    305300    this.changed = false;    
    306301    if(this.getToken().length>=this.options.minChars) { 
     302      this.startIndicator(); 
    307303      this.getUpdatedChoices(); 
    308304    } else { 
     
    345341 
    346342  getUpdatedChoices: function() { 
    347     this.startIndicator(); 
    348      
    349     var entry = encodeURIComponent(this.options.paramName) + '=' +  
     343    entry = encodeURIComponent(this.options.paramName) + '=' +  
    350344      encodeURIComponent(this.getToken()); 
    351345 
     
    355349    if(this.options.defaultParams)  
    356350      this.options.parameters += '&' + this.options.defaultParams; 
    357      
     351 
    358352    new Ajax.Request(this.url, this.options); 
    359353  }, 
     
    484478      paramName: "value", 
    485479      okButton: true, 
    486       okLink: false, 
    487480      okText: "ok", 
    488       cancelButton: false, 
    489481      cancelLink: true, 
    490482      cancelText: "cancel", 
    491       textBeforeControls: '', 
    492       textBetweenControls: '', 
    493       textAfterControls: '', 
    494483      savingText: "Saving...", 
    495484      clickToEditText: "Click to edit",