Make WordPress Core

Changeset 4626


Ignore:
Timestamp:
12/07/2006 03:57:23 AM (20 years ago)
Author:
markjaquith
Message:

Bunch of whitespace and coding standardization.

Location:
trunk/wp-includes
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/wp-includes/comment.php

    r4495 r4626  
    44        global $wpdb;
    55
    6         if (1 == get_option('comment_moderation')) return false; // If moderation is set to manual
     6        if ( 1 == get_option('comment_moderation') )
     7                return false; // If moderation is set to manual
    78
    89        if ( preg_match_all("|(href\t*?=\t*?['\"]?)?(https?:)?//|i", $comment, $out) >= get_option('comment_max_links') )
    910                return false; // Check # of external links
    1011
    11         $mod_keys = trim( get_option('moderation_keys') );
     12        $mod_keys = trim(get_option('moderation_keys'));
    1213        if ( !empty($mod_keys) ) {
    1314                $words = explode("\n", $mod_keys );
    … …  
    1718
    1819                        // Skip empty lines
    19                         if (empty($word)) { continue; }
     20                        if ( empty($word) )
     21                                continue;
    2022
    2123                        // Do some escaping magic so that '#' chars in the
    … …  
    4446                        else
    4547                                return false;
    46                 } elseif( $author != '' && $email != '' ) {
     48                } elseif ( $author != '' && $email != '' ) {
    4749                        $ok_to_comment = $wpdb->get_var("SELECT comment_approved FROM $wpdb->comments WHERE comment_author = '$author' AND comment_author_email = '$email' and comment_approved = '1' LIMIT 1");
    4850                        if ( ( 1 == $ok_to_comment ) &&
    … …  
    5557                }
    5658        }
    57 
    5859        return true;
    5960}
     61
    6062
    6163function get_approved_comments($post_id) {
    … …  
    6567        return $wpdb->get_results("SELECT * FROM $wpdb->comments WHERE comment_post_ID = '$post_id' AND comment_approved = '1' ORDER BY comment_date");
    6668}
     69
    6770
    6871// Retrieves comment data given a comment ID or comment object.
    … …  
    98101}
    99102
     103
    100104// Deprecate in favor of get_comment()?
    101105function get_commentdata( $comment_ID, $no_cache = 0, $include_unapproved = false ) { // less flexible, but saves DB queries
    102106        global $postc, $id, $commentdata, $wpdb;
    103         if ($no_cache) {
     107        if ( $no_cache ) {
    104108                $query = "SELECT * FROM $wpdb->comments WHERE comment_ID = '$comment_ID'";
    105                 if (false == $include_unapproved) {
    106                                 $query .= " AND comment_approved = '1'";
    107                 }
    108                                 $myrow = $wpdb->get_row($query, ARRAY_A);
     109                if ( false == $include_unapproved )
     110                        $query .= " AND comment_approved = '1'";
     111                $myrow = $wpdb->get_row($query, ARRAY_A);
    109112        } else {
    110                 $myrow['comment_ID'] = $postc->comment_ID;
    111                 $myrow['comment_post_ID'] = $postc->comment_post_ID;
    112                 $myrow['comment_author'] = $postc->comment_author;
     113                $myrow['comment_ID']           = $postc->comment_ID;
     114                $myrow['comment_post_ID']      = $postc->comment_post_ID;
     115                $myrow['comment_author']       = $postc->comment_author;
    113116                $myrow['comment_author_email'] = $postc->comment_author_email;
    114                 $myrow['comment_author_url'] = $postc->comment_author_url;
    115                 $myrow['comment_author_IP'] = $postc->comment_author_IP;
    116                 $myrow['comment_date'] = $postc->comment_date;
    117                 $myrow['comment_content'] = $postc->comment_content;
    118                 $myrow['comment_karma'] = $postc->comment_karma;
    119                 $myrow['comment_approved'] = $postc->comment_approved;
    120                 $myrow['comment_type'] = $postc->comment_type;
     117                $myrow['comment_author_url']   = $postc->comment_author_url;
     118                $myrow['comment_author_IP']    = $postc->comment_author_IP;
     119                $myrow['comment_date']         = $postc->comment_date;
     120                $myrow['comment_content']      = $postc->comment_content;
     121                $myrow['comment_karma']        = $postc->comment_karma;
     122                $myrow['comment_approved']     = $postc->comment_approved;
     123                $myrow['comment_type']         = $postc->comment_type;
    121124        }
    122125        return $myrow;
    123126}
     127
    124128
    125129function get_lastcommentmodified($timezone = 'server') {
    … …  
    129133        $now = current_time('mysql', 1);
    130134        if ( !isset($cache_lastcommentmodified[$timezone]) ) {
    131                 switch(strtolower($timezone)) {
     135                switch ( strtolower($timezone)) {
    132136                        case 'gmt':
    133137                                $lastcommentmodified = $wpdb->get_var("SELECT comment_date_gmt FROM $wpdb->comments WHERE comment_date_gmt <= '$now' ORDER BY comment_date_gmt DESC LIMIT 1");
    … …  
    147151}
    148152
     153
    149154function sanitize_comment_cookies() {
    150155        if ( isset($_COOKIE['comment_author_'.COOKIEHASH]) ) {
    … …  
    169174        }
    170175}
     176
    171177
    172178function wp_allow_comment($commentdata) {
    … …  
    199205        }
    200206
    201         // The author and the admins get respect.
    202207        if ( $userdata && ( $user_id == $post_author || $user->has_cap('level_9') ) ) {
     208                // The author and the admins get respect.
    203209                $approved = 1;
    204         }
    205 
    206         // Everyone else's comments will be checked.
    207         else {
     210         } else {
     211                // Everyone else's comments will be checked.
    208212                if ( check_comment($comment_author, $comment_author_email, $comment_author_url, $comment_content, $comment_author_IP, $comment_agent, $comment_type) )
    209213                        $approved = 1;
    … …  
    218222}
    219223
     224
    220225function wp_blacklist_check($author, $email, $url, $comment, $user_ip, $user_agent) {
    221226        global $wpdb;
    … …  
    224229
    225230        if ( preg_match_all('/&#(\d+);/', $comment . $author . $url, $chars) ) {
    226                 foreach ($chars[1] as $char) {
     231                foreach ( (array) $chars[1] as $char ) {
    227232                        // If it's an encoded char in the normal ASCII set, reject
    228233                        if ( 38 == $char )
    229234                                continue; // Unless it's &
    230                         if ($char < 128)
     235                        if ( $char < 128 )
    231236                                return true;
    232237                }
    … …  
    234239
    235240        $mod_keys = trim( get_option('blacklist_keys') );
    236         if ('' == $mod_keys )
     241        if ( '' == $mod_keys )
    237242                return false; // If moderation keys are empty
    238243        $words = explode("\n", $mod_keys );
    239244
    240         foreach ($words as $word) {
     245        foreach ( (array) $words as $word ) {
    241246                $word = trim($word);
    242247
    … …  
    249254
    250255                $pattern = "#$word#i";
    251                 if ( preg_match($pattern, $author    ) ) return true;
    252                 if ( preg_match($pattern, $email     ) ) return true;
    253                 if ( preg_match($pattern, $url       ) ) return true;
    254                 if ( preg_match($pattern, $comment   ) ) return true;
    255                 if ( preg_match($pattern, $user_ip   ) ) return true;
    256                 if ( preg_match($pattern, $user_agent) ) return true;
    257         }
    258 
     256                if (
     257                           preg_match($pattern, $author)
     258                        || preg_match($pattern, $email)
     259                        || preg_match($pattern, $url)
     260                        || preg_match($pattern, $comment)
     261                        || preg_match($pattern, $user_ip)
     262                        || preg_match($pattern, $user_agent)
     263                 )
     264                        return true;
     265        }
    259266        return false;
    260267}
     268
    261269
    262270function wp_delete_comment($comment_id) {
    … …  
    277285}
    278286
     287
    279288function wp_get_comment_status($comment_id) {
    280289        global $wpdb;
    281290
    282291        $result = $wpdb->get_var("SELECT comment_approved FROM $wpdb->comments WHERE comment_ID='$comment_id' LIMIT 1");
    283         if ($result == NULL) {
     292
     293        if ( $result == NULL )
    284294                return 'deleted';
    285         } else if ($result == '1') {
     295        elseif ( $result == '1' )
    286296                return 'approved';
    287         } else if ($result == '0') {
     297        elseif ( $result == '0' )
    288298                return 'unapproved';
    289         } else if ($result == 'spam') {
     299        elseif ( $result == 'spam' )
    290300                return 'spam';
    291         } else {
     301        else
    292302                return false;
    293         }
    294 }
     303}
     304
    295305
    296306function wp_get_current_commenter() {
    … …  
    311321        return compact('comment_author', 'comment_author_email', 'comment_author_url');
    312322}
     323
    313324
    314325function wp_insert_comment($commentdata) {
    … …  
    343354}
    344355
     356
    345357function wp_filter_comment($commentdata) {
    346358        $commentdata['user_id']              = apply_filters('pre_user_id', $commentdata['user_ID']);
    … …  
    355367}
    356368
     369
    357370function wp_throttle_comment_flood($block, $time_lastcomment, $time_newcomment) {
    358371        if ( $block ) // a plugin has already blocked... we'll let that decision stand
    … …  
    363376}
    364377
     378
    365379function wp_new_comment( $commentdata ) {
    366380        $commentdata = apply_filters('preprocess_comment', $commentdata);
    … …  
    374388        $commentdata['comment_date']     = current_time('mysql');
    375389        $commentdata['comment_date_gmt'] = current_time('mysql', 1);
    376 
    377390
    378391        $commentdata = wp_filter_comment($commentdata);
    … …  
    397410}
    398411
     412
    399413function wp_set_comment_status($comment_id, $comment_status) {
    400                 global $wpdb;
    401 
    402                 switch($comment_status) {
     414        global $wpdb;
     415
     416        switch ( $comment_status ) {
    403417                case 'hold':
    404418                        $query = "UPDATE $wpdb->comments SET comment_approved='0' WHERE comment_ID='$comment_id' LIMIT 1";
    405                 break;
     419                        break;
    406420                case 'approve':
    407421                        $query = "UPDATE $wpdb->comments SET comment_approved='1' WHERE comment_ID='$comment_id' LIMIT 1";
    408                 break;
     422                        break;
    409423                case 'spam':
    410424                        $query = "UPDATE $wpdb->comments SET comment_approved='spam' WHERE comment_ID='$comment_id' LIMIT 1";
    411                 break;
     425                        break;
    412426                case 'delete':
    413427                        return wp_delete_comment($comment_id);
    414                 break;
     428                        break;
    415429                default:
    416430                        return false;
    417                 }
    418 
    419                 if ($wpdb->query($query)) {
     431        }
     432
     433        if ( $wpdb->query($query) ) {
    420434                do_action('wp_set_comment_status', $comment_id, $comment_status);
    421435
    422436                $comment = get_comment($comment_id);
    423437                $comment_post_ID = $comment->comment_post_ID;
    424                 $c = $wpdb->get_row( "SELECT count(*) as c FROM {$wpdb->comments} WHERE comment_post_ID = '$comment_post_ID' AND comment_approved = '1'" );
    425                 if( is_object( $c ) )
    426                         $wpdb->query( "UPDATE $wpdb->posts SET comment_count = '$c->c' WHERE ID = '$comment_post_ID'" );
     438                $c = $wpdb->get_row("SELECT count(*) as c FROM {$wpdb->comments} WHERE comment_post_ID = '$comment_post_ID' AND comment_approved = '1'");
     439                if ( is_object($c) )
     440                        $wpdb->query("UPDATE $wpdb->posts SET comment_count = '$c->c' WHERE ID = '$comment_post_ID'");
    427441                return true;
    428                 } else {
     442        } else {
    429443                return false;
    430                 }
    431 }
     444        }
     445}
     446
    432447
    433448function wp_update_comment($commentarr) {
    … …  
    438453
    439454        // Escape data pulled from DB.
    440         foreach ($comment as $key => $value)
     455        foreach ( (array) $comment as $key => $value )
    441456                $comment[$key] = $wpdb->escape($value);
    442457
    … …  
    453468        $result = $wpdb->query(
    454469                "UPDATE $wpdb->comments SET
    455                         comment_content = '$comment_content',
    456                         comment_author = '$comment_author',
     470                        comment_content      = '$comment_content',
     471                        comment_author       = '$comment_author',
    457472                        comment_author_email = '$comment_author_email',
    458                         comment_approved = '$comment_approved',
    459                         comment_author_url = '$comment_author_url',
    460                         comment_date = '$comment_date'
     473                        comment_approved     = '$comment_approved',
     474                        comment_author_url   = '$comment_author_url',
     475                        comment_date         = '$comment_date'
    461476                WHERE comment_ID = $comment_ID" );
    462477
    463478        $rval = $wpdb->rows_affected;
    464 
    465479        wp_update_comment_count($comment_post_ID);
    466 
    467480        do_action('edit_comment', $comment_ID);
    468 
    469481        return $rval;
    470482}
     483
    471484
    472485function wp_update_comment_count($post_id) {
    … …  
    481494}
    482495
     496
    483497//
    484498// Ping and trackback functions.
    … …  
    498512        extract(parse_url($url));
    499513
    500         if (!isset($host)) {
    501                 // Not an URL. This should never happen.
     514        if ( !isset($host) ) // Not an URL. This should never happen.
    502515                return false;
    503         }
    504 
    505         $path  = (!isset($path)) ? '/'        : $path;
    506         $path .= (isset($query)) ? '?'.$query : '';
    507         $port  = (isset($port))  ? $port      : 80;
     516
     517        $path  = ( !isset($path) ) ? '/'          : $path;
     518        $path .= ( isset($query) ) ? '?' . $query : '';
     519        $port  = ( isset($port)  ) ? $port        : 80;
    508520
    509521        // Try to connect to the server at $host
    510522        $fp = @fsockopen($host, $port, $errno, $errstr, 2);
    511         if (!$fp) {
    512                 // Couldn't open a connection to $host;
     523        if ( !$fp ) // Couldn't open a connection to $host
    513524                return false;
    514         }
    515525
    516526        // Send the GET request
    517527        $request = "GET $path HTTP/1.1\r\nHost: $host\r\nUser-Agent: WordPress/$wp_version \r\n\r\n";
    518 //      ob_end_flush();
     528        // ob_end_flush();
    519529        fputs($fp, $request);
    520530
    521531        // Let's check for an X-Pingback header first
    522         while (!feof($fp)) {
     532        while ( !feof($fp) ) {
    523533                $line = fgets($fp, 512);
    524                 if (trim($line) == '') {
     534                if ( trim($line) == '' )
    525535                        break;
    526                 }
    527536                $headers .= trim($line)."\n";
    528537                $x_pingback_header_offset = strpos(strtolower($headers), $x_pingback_str);
    529                 if ($x_pingback_header_offset) {
     538                if ( $x_pingback_header_offset ) {
    530539                        // We got it!
    531540                        preg_match('#x-pingback: (.+)#is', $headers, $matches);
    … …  
    533542                        return $pingback_server_url;
    534543                }
    535                 if(strpos(strtolower($headers), 'content-type: ')) {
     544                if ( strpos(strtolower($headers), 'content-type: ') ) {
    536545                        preg_match('#content-type: (.+)#is', $headers, $matches);
    537546                        $content_type = trim($matches[1]);
    … …  
    539548        }
    540549
    541         if (preg_match('#(image|audio|video|model)/#is', $content_type)) {
    542                 // Not an (x)html, sgml, or xml page, no use going further
     550        if ( preg_match('#(image|audio|video|model)/#is', $content_type) ) // Not an (x)html, sgml, or xml page, no use going further
    543551                return false;
    544         }
    545 
    546         while (!feof($fp)) {
     552
     553        while ( !feof($fp) ) {
    547554                $line = fgets($fp, 1024);
    548555                $contents .= trim($line);
    549556                $pingback_link_offset_dquote = strpos($contents, $pingback_str_dquote);
    550557                $pingback_link_offset_squote = strpos($contents, $pingback_str_squote);
    551                 if ($pingback_link_offset_dquote || $pingback_link_offset_squote) {
     558                if ( $pingback_link_offset_dquote || $pingback_link_offset_squote ) {
    552559                        $quote = ($pingback_link_offset_dquote) ? '"' : '\'';
    553560                        $pingback_link_offset = ($quote=='"') ? $pingback_link_offset_dquote : $pingback_link_offset_squote;
    … …  
    558565                        $pingback_server_url = substr($contents, $pingback_href_start, $pingback_server_url_len);
    559566                        // We may find rel="pingback" but an incomplete pingback URL
    560                         if ($pingback_server_url_len > 0) {
    561                                 // We got it!
     567                        if ( $pingback_server_url_len > 0 ) // We got it!
    562568                                return $pingback_server_url;
    563                         }
    564569                }
    565570                $byte_count += strlen($line);
    566                 if ($byte_count > $timeout_bytes) {
     571                if ( $byte_count > $timeout_bytes ) {
    567572                        // It's no use going further, there probably isn't any pingback
    568573                        // server to find in this file. (Prevents loading large files.)
    … …  
    574579        return false;
    575580}
     581
    576582
    577583function do_all_pings() {
    … …  
    593599        $trackbacks = $wpdb->get_results("SELECT ID FROM $wpdb->posts WHERE CHAR_LENGTH(TRIM(to_ping)) > 7 AND post_status = 'publish'");
    594600        if ( is_array($trackbacks) ) {
    595                 foreach ( $trackbacks as $trackback ) {
     601                foreach ( $trackbacks as $trackback )
    596602                        do_trackbacks($trackback->ID);
    597                 }
    598603        }
    599604
    … …  
    613618        }
    614619
    615         if (empty($post->post_excerpt))
     620        if ( empty($post->post_excerpt) )
    616621                $excerpt = apply_filters('the_content', $post->post_content);
    617622        else
    … …  
    627632        $post_title = strip_tags($post_title);
    628633
    629         if ($to_ping) : foreach ($to_ping as $tb_ping) :
    630                 $tb_ping = trim($tb_ping);
    631                 if ( !in_array($tb_ping, $pinged) ) {
    632                         trackback($tb_ping, $post_title, $excerpt, $post_id);
    633                         $pinged[] = $tb_ping;
    634                 } else {
    635                         $wpdb->query("UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, '$tb_ping', '')) WHERE ID = '$post_id'");
    636                 }
    637         endforeach; endif;
    638 }
     634        if ( $to_ping ) {
     635                foreach ( (array) $to_ping as $tb_ping ) {
     636                        $tb_ping = trim($tb_ping);
     637                        if ( !in_array($tb_ping, $pinged) ) {
     638                                trackback($tb_ping, $post_title, $excerpt, $post_id);
     639                                $pinged[] = $tb_ping;
     640                        } else {
     641                                $wpdb->query("UPDATE $wpdb->posts SET to_ping = TRIM(REPLACE(to_ping, '$tb_ping', '')) WHERE ID = '$post_id'");
     642                        }
     643                }
     644        }
     645}
     646
    639647
    640648function generic_ping($post_id = 0) {
    … …  
    644652        if ( '' != $services ) {
    645653                $services = explode("\n", $services);
    646                 foreach ($services as $service) {
     654                foreach ( (array) $services as $service )
    647655                        weblog_ping($service);
    648                 }
    649656        }
    650657
    651658        return $post_id;
    652659}
     660
    653661
    654662function pingback($content, $post_ID) {
    655663        global $wp_version, $wpdb;
    656         include_once (ABSPATH . WPINC . '/class-IXR.php');
     664        include_once(ABSPATH . WPINC . '/class-IXR.php');
    657665
    658666        // original code by Mort (http://mort.mine.nu:8080)
    659667        $log = debug_fopen(ABSPATH . '/pingback.log', 'a');
    660668        $post_links = array();
    661         debug_fwrite($log, 'BEGIN '.date('YmdHis', time())."\n");
     669        debug_fwrite($log, 'BEGIN ' . date('YmdHis', time()) . "\n");
    662670
    663671        $pung = get_pung($post_ID);
    … …  
    688696        // We don't wanna ping first and second types, even if they have a valid <link/>
    689697
    690         foreach($post_links_temp[0] as $link_test) :
     698        foreach ( $post_links_temp[0] as $link_test ) :
    691699                if ( !in_array($link_test, $pung) && (url_to_postid($link_test) != $post_ID) // If we haven't pung it already and it isn't a link to itself
    692700                                && !is_local_attachment($link_test) ) : // Also, let's never ping local attachments.
    693701                        $test = parse_url($link_test);
    694                         if (isset($test['query']))
     702                        if ( isset($test['query']) )
    695703                                $post_links[] = $link_test;
    696                         elseif(($test['path'] != '/') && ($test['path'] != ''))
     704                        elseif ( ($test['path'] != '/') && ($test['path'] != '') )
    697705                                $post_links[] = $link_test;
    698706                endif;
    699707        endforeach;
    700708
    701         do_action_ref_array('pre_ping',  array(&$post_links, &$pung));
    702 
    703         foreach ($post_links as $pagelinkedto){
     709        do_action_ref_array('pre_ping', array(&$post_links, &$pung));
     710
     711        foreach ( (array) $post_links as $pagelinkedto ) {
    704712                debug_fwrite($log, "Processing -- $pagelinkedto\n");
    705713                $pingback_server_url = discover_pingback_server_uri($pagelinkedto, 2048);
    706714
    707                 if ($pingback_server_url) {
     715                if ( $pingback_server_url ) {
    708716                        @ set_time_limit( 60 );
    709717                         // Now, the RPC call
    … …  
    732740}
    733741
    734 function privacy_ping_filter( $sites ) {
     742
     743function privacy_ping_filter($sites) {
    735744        if ( '0' != get_option('blog_public') )
    736745                return $sites;
    … …  
    781790}
    782791
     792
    783793function weblog_ping($server = '', $path = '') {
    784794        global $wp_version;
    785         include_once (ABSPATH . WPINC . '/class-IXR.php');
     795        include_once(ABSPATH . WPINC . '/class-IXR.php');
    786796
    787797        // using a timeout of 3 seconds should be enough to cover slow servers
  • trunk/wp-includes/feed.php

    r4454 r4626  
    66}
    77
     8
    89function bloginfo_rss($show = '') {
    910        echo get_bloginfo_rss($show);
    1011}
     12
    1113
    1214function get_the_title_rss() {
    … …  
    1719}
    1820
     21
    1922function the_title_rss() {
    2023        echo get_the_title_rss();
    2124}
     25
    2226
    2327function the_content_rss($more_link_text='(more...)', $stripteaser=0, $more_file='', $cut = 0, $encode_html = 0) {
    … …  
    4347                        $use_dotdotdot = 0;
    4448                }
    45                 for ( $i=0; $i<$k; $i++ ) {
     49                for ( $i=0; $i<$k; $i++ )
    4650                        $excerpt .= $blah[$i].' ';
    47                 }
    4851                $excerpt .= ($use_dotdotdot) ? '...' : '';
    4952                $content = $excerpt;
    … …  
    5356}
    5457
     58
    5559function the_excerpt_rss() {
    5660        $output = get_the_excerpt(true);
    … …  
    5862}
    5963
     64
    6065function permalink_single_rss($file = '') {
    6166        echo get_permalink();
    6267}
     68
    6369
    6470function comment_link() {
    … …  
    6672}
    6773
     74
    6875function get_comment_author_rss() {
    6976        return apply_filters('comment_author_rss', get_comment_author() );
    7077}
     78
     79
    7180function comment_author_rss() {
    7281        echo get_comment_author_rss();
    7382}
     83
    7484
    7585function comment_text_rss() {
    … …  
    7989}
    8090
     91
    8192function comments_rss_link($link_text = 'Comments RSS', $commentsrssfilename = '') {
    8293        $url = comments_rss($commentsrssfilename);
    8394        echo "<a href='$url'>$link_text</a>";
    8495}
     96
    8597
    8698function comments_rss($commentsrssfilename = '') {
    … …  
    94106        return apply_filters('post_comments_feed_link', $url);
    95107}
     108
    96109
    97110function get_author_rss_link($echo = false, $author_id, $author_nicename) {
    … …  
    113126}
    114127
     128
    115129function get_category_rss_link($echo = false, $cat_ID, $category_nicename) {
    116130        $permalink_structure = get_option('permalink_structure');
    … …  
    130144}
    131145
     146
    132147function get_the_category_rss($type = 'rss') {
    133148        $categories = get_the_category();
    … …  
    143158}
    144159
     160
    145161function the_category_rss($type = 'rss') {
    146162        echo get_the_category_rss($type);
    147163}
     164
    148165
    149166function rss_enclosure() {
  • trunk/wp-includes/plugin.php

    r4424 r4626  
    1010        // check that we don't already have the same filter at the same priority
    1111        if ( isset($wp_filter[$tag]["$priority"]) ) {
    12                 foreach($wp_filter[$tag]["$priority"] as $filter) {
     12                foreach ( $wp_filter[$tag]["$priority"] as $filter ) {
    1313                        // uncomment if we want to match function AND accepted_args
    1414                        // if ( $filter == array($function, $accepted_args) ) {
    … …  
    136136        foreach ( (array) $wp_filter[$tag] as $priority => $functions ) {
    137137                if ( !is_null($functions) ) {
    138                         foreach( (array) $functions as $function ) {
     138                        foreach ( (array) $functions as $function ) {
    139139                                $function_name = $function['function'];
    140140                                $accepted_args = $function['accepted_args'];
  • trunk/wp-includes/registration.php

    r4495 r4626  
    1111}
    1212
     13
    1314function email_exists( $email ) {
    1415        global $wpdb;
    … …  
    1617        return $wpdb->get_var("SELECT ID FROM $wpdb->users WHERE user_email = '$email'");
    1718}
     19
    1820
    1921function validate_username( $username ) {
    … …  
    2628        return apply_filters('validate_username', $valid, $username);
    2729}
     30
    2831
    2932function wp_insert_user($userdata) {
    … …  
    124127}
    125128
     129
    126130function wp_update_user($userdata) {
    127131        global $wpdb;
    … …  
    147151        // Update the cookies if the password changed.
    148152        $current_user = wp_get_current_user();
    149         if( $current_user->id == $ID ) {
     153        if ( $current_user->id == $ID ) {
    150154                if ( isset($plaintext_pass) ) {
    151155                        wp_clearcookie();
    … …  
    157161}
    158162
    159 function wp_create_user( $username, $password, $email = '') {
     163
     164function wp_create_user($username, $password, $email = '') {
    160165        global $wpdb;
    161166
    162         $user_login = $wpdb->escape( $username );
    163         $user_email = $wpdb->escape( $email );
     167        $user_login = $wpdb->escape($username);
     168        $user_email = $wpdb->escape($email);
    164169        $user_pass = $password;
    165170
    … …  
    169174
    170175
    171 function create_user( $username, $password, $email ) {
    172         return wp_create_user( $username, $password, $email );
     176function create_user($username, $password, $email) {
     177        return wp_create_user($username, $password, $email);
    173178}
    174179
    175 
    176180?>
  • trunk/wp-includes/vars.php

    r4380 r4626  
    22
    33// On which page are we ?
    4 if (preg_match('#([^/]+\.php)$#', $PHP_SELF, $self_matches)) {
     4if ( preg_match('#([^/]+\.php)$#', $PHP_SELF, $self_matches) ) {
    55        $pagenow = $self_matches[1];
    6 } else if (strstr($PHP_SELF, '?')) {
     6} elseif ( strpos($PHP_SELF, '?') !== false ) {
    77        $pagenow = explode('/', $PHP_SELF);
    88        $pagenow = trim($pagenow[(sizeof($pagenow)-1)]);
    … …  
    1414
    1515// Simple browser detection
     16// We should probably be doing true/false instead of 1/0 here ~ Mark
    1617$is_lynx = 0; $is_gecko = 0; $is_winIE = 0; $is_macIE = 0; $is_opera = 0; $is_NS4 = 0;
    1718
    18 if (preg_match('/Lynx/', $_SERVER['HTTP_USER_AGENT'])) {
     19if ( preg_match('/Lynx/', $_SERVER['HTTP_USER_AGENT']) )
    1920        $is_lynx = 1;
    20 } elseif (preg_match('/Gecko/', $_SERVER['HTTP_USER_AGENT'])) {
     21elseif ( preg_match('/Gecko/', $_SERVER['HTTP_USER_AGENT']) )
    2122        $is_gecko = 1;
    22 } elseif ((preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT'])) && (preg_match('/Win/', $_SERVER['HTTP_USER_AGENT']))) {
     23elseif ( preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT']) && preg_match('/Win/', $_SERVER['HTTP_USER_AGENT']) )
    2324        $is_winIE = 1;
    24 } elseif ((preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT'])) && (preg_match('/Mac/', $_SERVER['HTTP_USER_AGENT']))) {
     25elseif ( preg_match('/MSIE/', $_SERVER['HTTP_USER_AGENT']) && preg_match('/Mac/', $_SERVER['HTTP_USER_AGENT']) )
    2526        $is_macIE = 1;
    26 } elseif (preg_match('/Opera/', $_SERVER['HTTP_USER_AGENT'])) {
     27elseif ( preg_match('/Opera/', $_SERVER['HTTP_USER_AGENT']) )
    2728        $is_opera = 1;
    28 } elseif ((preg_match('/Nav/', $_SERVER['HTTP_USER_AGENT']) ) || (preg_match('/Mozilla\/4\./', $_SERVER['HTTP_USER_AGENT']))) {
     29elseif ( preg_match('/Nav/', $_SERVER['HTTP_USER_AGENT']) || preg_match('/Mozilla\/4\./', $_SERVER['HTTP_USER_AGENT']) )
    2930        $is_NS4 = 1;
    30 }
    31 $is_IE    = (($is_macIE) || ($is_winIE));
     31
     32$is_IE = ( $is_macIE || $is_winIE );
    3233
    3334// Server detection
    … …  
    3839if (!isset($wpsmiliestrans)) {
    3940        $wpsmiliestrans = array(
    40         ':mrgreen:'     => 'icon_mrgreen.gif',
    41         ':neutral:'     => 'icon_neutral.gif',
    42         ':twisted:'     => 'icon_twisted.gif',
    43         ':arrow:'       => 'icon_arrow.gif',
    44         ':shock:'       => 'icon_eek.gif',
    45         ':smile:'       => 'icon_smile.gif',
    46         ':???:' => 'icon_confused.gif',
    47         ':cool:'        => 'icon_cool.gif',
    48         ':evil:'        => 'icon_evil.gif',
    49         ':grin:'        => 'icon_biggrin.gif',
    50         ':idea:'        => 'icon_idea.gif',
    51         ':oops:'        => 'icon_redface.gif',
    52         ':razz:'        => 'icon_razz.gif',
    53         ':roll:'        => 'icon_rolleyes.gif',
    54         ':wink:'        => 'icon_wink.gif',
    55         ':cry:'         => 'icon_cry.gif',
    56         ':eek:'         => 'icon_surprised.gif',
    57         ':lol:'         => 'icon_lol.gif',
    58         ':mad:'         => 'icon_mad.gif',
    59         ':sad:'         => 'icon_sad.gif',
    60         '8-)'           => 'icon_cool.gif',
    61         '8-O'           => 'icon_eek.gif',
    62         ':-('           => 'icon_sad.gif',
    63         ':-)'           => 'icon_smile.gif',
    64         ':-?'           => 'icon_confused.gif',
    65         ':-D'           => 'icon_biggrin.gif',
    66         ':-P'           => 'icon_razz.gif',
    67         ':-o'           => 'icon_surprised.gif',
    68         ':-x'           => 'icon_mad.gif',
    69         ':-|'           => 'icon_neutral.gif',
    70         ';-)'           => 'icon_wink.gif',
    71         '8)'            => 'icon_cool.gif',
    72         '8O'            => 'icon_eek.gif',
    73         ':('            => 'icon_sad.gif',
    74         ':)'            => 'icon_smile.gif',
    75         ':?'            => 'icon_confused.gif',
    76         ':D'            => 'icon_biggrin.gif',
    77         ':P'            => 'icon_razz.gif',
    78         ':o'            => 'icon_surprised.gif',
    79         ':x'            => 'icon_mad.gif',
    80         ':|'            => 'icon_neutral.gif',
    81         ';)'            => 'icon_wink.gif',
    82         ':!:'           => 'icon_exclaim.gif',
    83         ':?:'           => 'icon_question.gif',
     41        ':mrgreen:' => 'icon_mrgreen.gif',
     42        ':neutral:' => 'icon_neutral.gif',
     43        ':twisted:' => 'icon_twisted.gif',
     44          ':arrow:' => 'icon_arrow.gif',
     45          ':shock:' => 'icon_eek.gif',
     46          ':smile:' => 'icon_smile.gif',
     47            ':???:' => 'icon_confused.gif',
     48           ':cool:' => 'icon_cool.gif',
     49           ':evil:' => 'icon_evil.gif',
     50           ':grin:' => 'icon_biggrin.gif',
     51           ':idea:' => 'icon_idea.gif',
     52           ':oops:' => 'icon_redface.gif',
     53           ':razz:' => 'icon_razz.gif',
     54           ':roll:' => 'icon_rolleyes.gif',
     55           ':wink:' => 'icon_wink.gif',
     56            ':cry:' => 'icon_cry.gif',
     57            ':eek:' => 'icon_surprised.gif',
     58            ':lol:' => 'icon_lol.gif',
     59            ':mad:' => 'icon_mad.gif',
     60            ':sad:' => 'icon_sad.gif',
     61              '8-)' => 'icon_cool.gif',
     62              '8-O' => 'icon_eek.gif',
     63              ':-(' => 'icon_sad.gif',
     64              ':-)' => 'icon_smile.gif',
     65              ':-?' => 'icon_confused.gif',
     66              ':-D' => 'icon_biggrin.gif',
     67              ':-P' => 'icon_razz.gif',
     68              ':-o' => 'icon_surprised.gif',
     69              ':-x' => 'icon_mad.gif',
     70              ':-|' => 'icon_neutral.gif',
     71              ';-)' => 'icon_wink.gif',
     72               '8)' => 'icon_cool.gif',
     73               '8O' => 'icon_eek.gif',
     74               ':(' => 'icon_sad.gif',
     75               ':)' => 'icon_smile.gif',
     76               ':?' => 'icon_confused.gif',
     77               ':D' => 'icon_biggrin.gif',
     78               ':P' => 'icon_razz.gif',
     79               ':o' => 'icon_surprised.gif',
     80               ':x' => 'icon_mad.gif',
     81               ':|' => 'icon_neutral.gif',
     82               ';)' => 'icon_wink.gif',
     83              ':!:' => 'icon_exclaim.gif',
     84              ':?:' => 'icon_question.gif',
    8485        );
    8586}
    8687
    87 
    8888// generates smilies' search & replace arrays
    89 foreach($wpsmiliestrans as $smiley => $img) {
     89foreach ( (array) $wpsmiliestrans as $smiley => $img ) {
    9090        $wp_smiliessearch[] = '/(\s|^)'.preg_quote($smiley, '/').'(\s|$)/';
    91         $smiley_masked = htmlspecialchars( trim($smiley) , ENT_QUOTES);
     91        $smiley_masked = htmlspecialchars(trim($smiley), ENT_QUOTES);
    9292        $wp_smiliesreplace[] = " <img src='" . get_option('siteurl') . "/wp-includes/images/smilies/$img' alt='$smiley_masked' class='wp-smiley' /> ";
    9393}
Note: See TracChangeset for help on using the changeset viewer.