Make WordPress Core

Ticket #14581: 14581.diff

File 14581.diff, 41.9 KB (added by wonderboymusic, 12 years ago)
  • src/wp-admin/comment.php

     
    9999        }
    100100
    101101        // No need to re-approve/re-trash/re-spam a comment.
    102         if ( $action == str_replace( '1', 'approve', $comment->comment_approved ) ) {
     102        if ( $action == str_replace( WP_STATUS_ON, 'approve', $comment->comment_approved ) ) {
    103103                wp_redirect( admin_url( 'edit-comments.php?same=' . $comment_id ) );
    104104                die();
    105105        }
     
    137137                break;
    138138}
    139139
    140 if ( $comment->comment_approved != '0' ) { // if not unapproved
     140if ( $comment->comment_approved != WP_STATUS_OFF ) { // if not unapproved
    141141        $message = '';
    142142        switch ( $comment->comment_approved ) {
    143143                case '1' :
     
    236236        switch ( $action ) {
    237237                case 'deletecomment' :
    238238                        wp_delete_comment( $comment_id );
    239                         $redir = add_query_arg( array('deleted' => '1'), $redir );
     239                        $redir = add_query_arg( array( 'deleted' => WP_STATUS_ON ), $redir );
    240240                        break;
    241241                case 'trashcomment' :
    242242                        wp_trash_comment($comment_id);
    243                         $redir = add_query_arg( array('trashed' => '1', 'ids' => $comment_id), $redir );
     243                        $redir = add_query_arg( array( 'trashed' => WP_STATUS_ON, 'ids' => $comment_id ), $redir );
    244244                        break;
    245245                case 'untrashcomment' :
    246246                        wp_untrash_comment($comment_id);
    247                         $redir = add_query_arg( array('untrashed' => '1'), $redir );
     247                        $redir = add_query_arg( array( 'untrashed' => WP_STATUS_ON ), $redir );
    248248                        break;
    249249                case 'spamcomment' :
    250250                        wp_spam_comment($comment_id);
    251                         $redir = add_query_arg( array('spammed' => '1', 'ids' => $comment_id), $redir );
     251                        $redir = add_query_arg( array( 'spammed' => WP_STATUS_ON, 'ids' => $comment_id ), $redir );
    252252                        break;
    253253                case 'unspamcomment' :
    254254                        wp_unspam_comment($comment_id);
    255                         $redir = add_query_arg( array('unspammed' => '1'), $redir );
     255                        $redir = add_query_arg( array( 'unspammed' => WP_STATUS_ON ), $redir );
    256256                        break;
    257257                case 'approvecomment' :
    258258                        wp_set_comment_status( $comment_id, 'approve' );
    259                         $redir = add_query_arg( array( 'approved' => 1 ), $redir );
     259                        $redir = add_query_arg( array( 'approved' => WP_STATUS_ON ), $redir );
    260260                        break;
    261261                case 'unapprovecomment' :
    262262                        wp_set_comment_status( $comment_id, 'hold' );
    263                         $redir = add_query_arg( array( 'unapproved' => 1 ), $redir );
     263                        $redir = add_query_arg( array( 'unapproved' => WP_STATUS_ON ), $redir );
    264264                        break;
    265265        }
    266266
  • src/wp-admin/edit-comments.php

     
    205205
    206206                if ( $same > 0 && $comment = get_comment( $same ) ) {
    207207                        switch ( $comment->comment_approved ) {
    208                                 case '1' :
     208                                case WP_STATUS_ON :
    209209                                        $messages[] = __('This comment is already approved.') . ' <a href="' . esc_url( admin_url( "comment.php?action=editcomment&c=$same" ) ) . '">' . __( 'Edit comment' ) . '</a>';
    210210                                        break;
    211211                                case 'trash' :
  • src/wp-admin/edit-form-comment.php

     
    8686<div id="misc-publishing-actions">
    8787
    8888<div class="misc-pub-section misc-pub-comment-status" id="comment-status-radio">
    89 <label class="approved"><input type="radio"<?php checked( $comment->comment_approved, '1' ); ?> name="comment_status" value="1" /><?php /* translators: comment type radio button */ _ex('Approved', 'adjective') ?></label><br />
    90 <label class="waiting"><input type="radio"<?php checked( $comment->comment_approved, '0' ); ?> name="comment_status" value="0" /><?php /* translators: comment type radio button */ _ex('Pending', 'adjective') ?></label><br />
     89<label class="approved"><input type="radio"<?php checked( $comment->comment_approved, WP_STATUS_ON ); ?> name="comment_status" value="<?php echo WP_STATUS_ON ?>" /><?php /* translators: comment type radio button */ _ex('Approved', 'adjective') ?></label><br />
     90<label class="waiting"><input type="radio"<?php checked( $comment->comment_approved, WP_STATUS_OFF ); ?> name="comment_status" value="<?php echo WP_STATUS_OFF ?>" /><?php /* translators: comment type radio button */ _ex('Pending', 'adjective') ?></label><br />
    9191<label class="spam"><input type="radio"<?php checked( $comment->comment_approved, 'spam' ); ?> name="comment_status" value="spam" /><?php /* translators: comment type radio button */ _ex('Spam', 'adjective'); ?></label>
    9292</div>
    9393
  • src/wp-admin/includes/class-wp-comments-list-table.php

     
    477477                                if ( ( 'reply' == $action || 'quickedit' == $action ) && ! defined('DOING_AJAX') )
    478478                                        $action .= ' hide-if-no-js';
    479479                                elseif ( ( $action == 'untrash' && $the_comment_status == 'trash' ) || ( $action == 'unspam' && $the_comment_status == 'spam' ) ) {
    480                                         if ( '1' == get_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', true ) )
     480                                        if ( WP_STATUS_ON == get_comment_meta( $comment->comment_ID, '_wp_trash_meta_status', true ) )
    481481                                                $action .= ' approve';
    482482                                        else
    483483                                                $action .= ' unapprove';
  • src/wp-admin/includes/class-wp-ms-sites-list-table.php

     
    262262                                                        $actions['edit']        = '<span class="edit"><a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ) . '">' . __( 'Edit' ) . '</a></span>';
    263263                                                        $actions['backend']     = "<span class='backend'><a href='" . esc_url( get_admin_url( $blog['blog_id'] ) ) . "' class='edit'>" . __( 'Dashboard' ) . '</a></span>';
    264264                                                        if ( get_current_site()->blog_id != $blog['blog_id'] ) {
    265                                                                 if ( get_blog_status( $blog['blog_id'], 'deleted' ) == '1' )
     265                                                                if ( get_blog_status( $blog['blog_id'], 'deleted' ) == WP_STATUS_ON )
    266266                                                                        $actions['activate']    = '<span class="activate"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=activateblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to activate the site %s' ), $blogname ) ) ), 'confirm' ) ) . '">' . __( 'Activate' ) . '</a></span>';
    267267                                                                else
    268268                                                                        $actions['deactivate']  = '<span class="activate"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=deactivateblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to deactivate the site %s' ), $blogname ) ) ), 'confirm') ) . '">' . __( 'Deactivate' ) . '</a></span>';
    269269
    270                                                                 if ( get_blog_status( $blog['blog_id'], 'archived' ) == '1' )
     270                                                                if ( get_blog_status( $blog['blog_id'], 'archived' ) == WP_STATUS_ON )
    271271                                                                        $actions['unarchive']   = '<span class="archive"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=unarchiveblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to unarchive the site %s.' ), $blogname ) ) ), 'confirm') ) . '">' . __( 'Unarchive' ) . '</a></span>';
    272272                                                                else
    273273                                                                        $actions['archive']     = '<span class="archive"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=archiveblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to archive the site %s.' ), $blogname ) ) ), 'confirm') ) . '">' . _x( 'Archive', 'verb; site' ) . '</a></span>';
    274274
    275                                                                 if ( get_blog_status( $blog['blog_id'], 'spam' ) == '1' )
     275                                                                if ( get_blog_status( $blog['blog_id'], 'spam' ) == WP_STATUS_ON )
    276276                                                                        $actions['unspam']      = '<span class="spam"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=unspamblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to unspam the site %s.' ), $blogname ) ) ), 'confirm') ) . '">' . _x( 'Not Spam', 'site' ) . '</a></span>';
    277277                                                                else
    278278                                                                        $actions['spam']        = '<span class="spam"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&amp;action2=spamblog&amp;id=' . $blog['blog_id'] . '&amp;msg=' . urlencode( sprintf( __( 'You are about to mark the site %s as spam.' ), $blogname ) ) ), 'confirm') ) . '">' . _x( 'Spam', 'site' ) . '</a></span>';
  • src/wp-admin/includes/comment.php

     
    128128        $post_id_array = array_map('intval', $post_id_array);
    129129        $post_id_in = "'" . implode("', '", $post_id_array) . "'";
    130130
    131         $pending = $wpdb->get_results( "SELECT comment_post_ID, COUNT(comment_ID) as num_comments FROM $wpdb->comments WHERE comment_post_ID IN ( $post_id_in ) AND comment_approved = '0' GROUP BY comment_post_ID", ARRAY_A );
     131        $sql = $wpdb->prepare(
     132                "SELECT comment_post_ID, COUNT(comment_ID) as num_comments FROM $wpdb->comments WHERE comment_post_ID IN ( $post_id_in ) AND comment_approved = %s GROUP BY comment_post_ID",
     133                WP_STATUS_OFF
     134        );
     135        $pending = $wpdb->get_results( $sql, ARRAY_A );
    132136
    133137        if ( $single ) {
    134138                if ( empty($pending) )
  • src/wp-admin/includes/dashboard.php

     
    272272        update_right_now_message();
    273273
    274274        // Check if search engines are asked not to index this site.
    275         if ( ! is_network_admin() && ! is_user_admin() && current_user_can( 'manage_options' ) && '1' != get_option( 'blog_public' ) ) {
     275        if ( ! is_network_admin() && ! is_user_admin() && current_user_can( 'manage_options' ) && WP_STATUS_ON != get_option( 'blog_public' ) ) {
    276276
    277277                /**
    278278                 * Filter the link title attribute for the 'Search Engines Discouraged'
  • src/wp-admin/includes/upgrade.php

     
    712712        $wpdb->show_errors();
    713713
    714714        // populate comment_count field of posts table
    715         $comments = $wpdb->get_results( "SELECT comment_post_ID, COUNT(*) as c FROM $wpdb->comments WHERE comment_approved = '1' GROUP BY comment_post_ID" );
     715        $sql = $wpdb->prepare(
     716                "SELECT comment_post_ID, COUNT(*) as c FROM $wpdb->comments WHERE comment_approved = %s GROUP BY comment_post_ID",
     717                WP_STATUS_ON
     718        );
     719        $comments = $wpdb->get_results( $sql );
    716720        if ( is_array( $comments ) )
    717721                foreach ($comments as $comment)
    718722                        $wpdb->update( $wpdb->posts, array('comment_count' => $comment->c), array('ID' => $comment->comment_post_ID) );
     
    10791083
    10801084        if ( $wp_current_db_version < 11958 ) {
    10811085                // Previously, setting depth to 1 would redundantly disable threading, but now 2 is the minimum depth to avoid confusion
    1082                 if ( get_option( 'thread_comments_depth' ) == '1' ) {
     1086                if ( get_option( 'thread_comments_depth' ) == WP_STATUS_ON ) {
    10831087                        update_option( 'thread_comments_depth', 2 );
    10841088                        update_option( 'thread_comments', 0 );
    10851089                }
     
    13441348
    13451349        // 3.0
    13461350        if ( $wp_current_db_version < 13576 )
    1347                 update_site_option( 'global_terms_enabled', '1' );
     1351                update_site_option( 'global_terms_enabled', WP_STATUS_ON );
    13481352
    13491353        // 3.3
    13501354        if ( $wp_current_db_version < 19390 )
     
    13741378
    13751379        // 3.5
    13761380        if ( $wp_current_db_version < 21823 )
    1377                 update_site_option( 'ms_files_rewriting', '1' );
     1381                update_site_option( 'ms_files_rewriting', WP_STATUS_ON );
    13781382
    13791383        // 3.5.2
    13801384        if ( $wp_current_db_version < 24448 ) {
     
    14041408 */
    14051409function maybe_create_table($table_name, $create_ddl) {
    14061410        global $wpdb;
    1407        
     1411
    14081412        $query = $wpdb->prepare( "SHOW TABLES LIKE %s", $wpdb->esc_like( $table_name ) );
    14091413
    14101414        if ( $wpdb->get_var( $query ) == $table_name ) {
  • src/wp-admin/includes/user.php

     
    394394                return;
    395395
    396396        //get_user_setting = JS saved UI setting. else no-js-fallback code.
    397         if ( 'hide' == get_user_setting('default_password_nag') || isset($_GET['default_password_nag']) && '0' == $_GET['default_password_nag'] ) {
     397        if ( 'hide' == get_user_setting('default_password_nag') || isset($_GET['default_password_nag']) && WP_STATUS_OFF == $_GET['default_password_nag'] ) {
    398398                delete_user_setting('default_password_nag');
    399399                update_user_option($user_ID, 'default_password_nag', false, true);
    400400        }
  • src/wp-admin/ms-delete-site.php

     
    3434echo '<div class="wrap">';
    3535echo '<h2>' . esc_html( $title ) . '</h2>';
    3636
    37 if ( isset( $_POST['action'] ) && $_POST['action'] == 'deleteblog' && isset( $_POST['confirmdelete'] ) && $_POST['confirmdelete'] == '1' ) {
     37if ( isset( $_POST['action'] ) && $_POST['action'] == 'deleteblog' && isset( $_POST['confirmdelete'] ) && $_POST['confirmdelete'] == WP_STATUS_ON ) {
    3838        check_admin_referer( 'delete-blog' );
    3939
    4040        $hash = wp_generate_password( 20, false );
  • src/wp-admin/network/sites.php

     
    124124                                                        case 'spam':
    125125                                                        case 'notspam':
    126126                                                                $updated_action = ( 'spam' === $doaction ) ? 'all_spam' : 'all_notspam';
    127                                                                 update_blog_status( $val, 'spam', ( 'spam' === $doaction ) ? '1' : '0' );
     127                                                                update_blog_status( $val, 'spam', ( 'spam' === $doaction ) ? WP_STATUS_ON : WP_STATUS_OFF );
    128128                                                        break;
    129129                                                }
    130130                                        } else {
     
    139139
    140140                case 'archiveblog':
    141141                case 'unarchiveblog':
    142                         update_blog_status( $id, 'archived', ( 'archiveblog' === $_GET['action'] ) ? '1' : '0' );
     142                        update_blog_status( $id, 'archived', ( 'archiveblog' === $_GET['action'] ) ? WP_STATUS_ON : WP_STATUS_OFF );
    143143                break;
    144144
    145145                case 'activateblog':
    146                         update_blog_status( $id, 'deleted', '0' );
     146                        update_blog_status( $id, 'deleted', WP_STATUS_OFF );
    147147
    148148                        /**
    149149                         * Fires after a network site is activated.
     
    164164                         * @param string $id The ID of the site being deactivated.
    165165                         */
    166166                        do_action( 'deactivate_blog', $id );
    167                         update_blog_status( $id, 'deleted', '1' );
     167                        update_blog_status( $id, 'deleted', WP_STATUS_ON );
    168168                break;
    169169
    170170                case 'unspamblog':
    171171                case 'spamblog':
    172                         update_blog_status( $id, 'spam', ( 'spamblog' === $_GET['action'] ) ? '1' : '0' );
     172                        update_blog_status( $id, 'spam', ( 'spamblog' === $_GET['action'] ) ? WP_STATUS_ON : WP_STATUS_OFF );
    173173                break;
    174174
    175175                case 'unmatureblog':
    176176                case 'matureblog':
    177                         update_blog_status( $id, 'mature', ( 'matureblog' === $_GET['action'] ) ? '1' : '0' );
     177                        update_blog_status( $id, 'mature', ( 'matureblog' === $_GET['action'] ) ? WP_STATUS_ON : WP_STATUS_OFF );
    178178                break;
    179179        }
    180180
  • src/wp-admin/network/themes.php

     
    4444                        check_admin_referer('disable-theme_' . $_GET['theme']);
    4545                        unset( $allowed_themes[ $_GET['theme'] ] );
    4646                        update_site_option( 'allowedthemes', $allowed_themes );
    47                         wp_safe_redirect( add_query_arg( 'disabled', '1', $referer ) );
     47                        wp_safe_redirect( add_query_arg( 'disabled', WP_STATUS_ON, $referer ) );
    4848                        exit;
    4949                case 'enable-selected':
    5050                        check_admin_referer('bulk-themes');
  • src/wp-admin/network/upgrade.php

     
    5252                        update_site_option( 'wpmu_upgrade_site', $wp_db_version );
    5353                }
    5454
    55                 $blogs = $wpdb->get_results( "SELECT * FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' AND spam = '0' AND deleted = '0' AND archived = '0' ORDER BY registered DESC LIMIT {$n}, 5", ARRAY_A );
     55                $sql = $wpdb->prepare(
     56                        "SELECT * FROM {$wpdb->blogs} WHERE site_id = '{$wpdb->siteid}' AND spam = %s AND deleted = %s AND archived = %s ORDER BY registered DESC LIMIT {$n}, 5",
     57                        WP_STATUS_OFF,
     58                        WP_STATUS_OFF,
     59                        WP_STATUS_OFF
     60                );
     61                $blogs = $wpdb->get_results( $sql, ARRAY_A );
    5662                if ( empty( $blogs ) ) {
    5763                        echo '<p>' . __( 'All done!' ) . '</p>';
    5864                        break;
  • src/wp-admin/network/users.php

     
    144144                                                                $blogs = get_blogs_of_user( $val, true );
    145145                                                                foreach ( (array) $blogs as $key => $details ) {
    146146                                                                        if ( $details->userblog_id != $current_site->blog_id ) // main blog not a spam !
    147                                                                                 update_blog_status( $details->userblog_id, 'spam', '1' );
     147                                                                                update_blog_status( $details->userblog_id, 'spam', WP_STATUS_ON );
    148148                                                                }
    149                                                                 update_user_status( $val, 'spam', '1' );
     149                                                                update_user_status( $val, 'spam', WP_STATUS_ON );
    150150                                                        break;
    151151
    152152                                                        case 'notspam':
     
    153153                                                                $userfunction = 'all_notspam';
    154154                                                                $blogs = get_blogs_of_user( $val, true );
    155155                                                                foreach ( (array) $blogs as $key => $details )
    156                                                                         update_blog_status( $details->userblog_id, 'spam', '0' );
     156                                                                        update_blog_status( $details->userblog_id, 'spam', WP_STATUS_OFF );
    157157
    158                                                                 update_user_status( $val, 'spam', '0' );
     158                                                                update_user_status( $val, 'spam', WP_STATUS_OFF );
    159159                                                        break;
    160160                                                }
    161161                                        }
  • src/wp-includes/class-wp-editor.php

     
    13791379         * @since 3.1.0
    13801380         */
    13811381        public static function wp_link_dialog() {
    1382                 $search_panel_visible = '1' == get_user_setting( 'wplink', '0' ) ? ' search-panel-visible' : '';
     1382                $search_panel_visible = WP_STATUS_ON == get_user_setting( 'wplink', WP_STATUS_OFF ) ? ' search-panel-visible' : '';
    13831383
    13841384                // display: none is required here, see #WP27605
    13851385                ?>
  • src/wp-includes/class-wp-xmlrpc-server.php

     
    970970                $comment_date = $this->_convert_date( $comment->comment_date );
    971971                $comment_date_gmt = $this->_convert_date_gmt( $comment->comment_date_gmt, $comment->comment_date );
    972972
    973                 if ( '0' == $comment->comment_approved )
     973                if ( WP_STATUS_OFF == $comment->comment_approved )
    974974                        $comment_status = 'hold';
    975975                else if ( 'spam' == $comment->comment_approved )
    976976                        $comment_status = 'spam';
    977                 else if ( '1' == $comment->comment_approved )
     977                else if ( WP_STATUS_ON == $comment->comment_approved )
    978978                        $comment_status = 'approve';
    979979                else
    980980                        $comment_status = $comment->comment_approved;
     
    51635163                        // Get the post author info.
    51645164                        $author = get_userdata($entry['post_author']);
    51655165
    5166                         $allow_comments = ('open' == $entry['comment_status']) ? 1 : 0;
    5167                         $allow_pings = ('open' == $entry['ping_status']) ? 1 : 0;
     5166                        $allow_comments = ( 'open' == $entry['comment_status'] ) ? WP_STATUS_ON : WP_STATUS_OFF;
     5167                        $allow_pings    = ( 'open' == $entry['ping_status'] )    ? WP_STATUS_ON : WP_STATUS_OFF;
    51685168
    51695169                        // Consider future posts as published
    51705170                        if ( $entry['post_status'] === 'future' )
  • src/wp-includes/comment-template.php

     
    11011101
    11021102        /** @todo Use API instead of SELECTs. */
    11031103        if ( $user_ID) {
    1104                 $comments = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND (comment_approved = '1' OR ( user_id = %d AND comment_approved = '0' ) )  ORDER BY comment_date_gmt", $post->ID, $user_ID));
     1104                $sql = $wpdb->prepare(
     1105                        "SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND (comment_approved = %s OR ( user_id = %d AND comment_approved = %s ) )  ORDER BY comment_date_gmt",
     1106                        $post->ID,
     1107                        WP_STATUS_ON,
     1108                        $user_ID,
     1109                        WP_STATUS_OFF
     1110                );
     1111                $comments = $wpdb->get_results( $sql );
    11051112        } else if ( empty($comment_author) ) {
    11061113                $comments = get_comments( array('post_id' => $post->ID, 'status' => 'approve', 'order' => 'ASC') );
    11071114        } else {
    1108                 $comments = $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND ( comment_approved = '1' OR ( comment_author = %s AND comment_author_email = %s AND comment_approved = '0' ) ) ORDER BY comment_date_gmt", $post->ID, wp_specialchars_decode($comment_author,ENT_QUOTES), $comment_author_email));
     1115                $sql = $wpdb->prepare(
     1116                        "SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND ( comment_approved = %s OR ( comment_author = %s AND comment_author_email = %s AND comment_approved = %s ) ) ORDER BY comment_date_gmt",
     1117                        $post->ID,
     1118                        WP_STATUS_ON,
     1119                        wp_specialchars_decode( $comment_author, ENT_QUOTES ),
     1120                        $comment_author_email,
     1121                        WP_STATUS_OFF
     1122                );
     1123                $comments = $wpdb->get_results( $sql );
    11091124        }
    11101125
    11111126        /**
     
    17921807                        <?php if ( 0 != $args['avatar_size'] ) echo get_avatar( $comment, $args['avatar_size'] ); ?>
    17931808                        <?php printf( __( '<cite class="fn">%s</cite> <span class="says">says:</span>' ), get_comment_author_link() ); ?>
    17941809                </div>
    1795                 <?php if ( '0' == $comment->comment_approved ) : ?>
     1810                <?php if ( WP_STATUS_OFF == $comment->comment_approved ) : ?>
    17961811                <em class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.' ) ?></em>
    17971812                <br />
    17981813                <?php endif; ?>
     
    18471862                                                <?php edit_comment_link( __( 'Edit' ), '<span class="edit-link">', '</span>' ); ?>
    18481863                                        </div><!-- .comment-metadata -->
    18491864
    1850                                         <?php if ( '0' == $comment->comment_approved ) : ?>
     1865                                        <?php if ( WP_STATUS_OFF == $comment->comment_approved ) : ?>
    18511866                                        <p class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.' ); ?></p>
    18521867                                        <?php endif; ?>
    18531868                                </footer><!-- .comment-meta -->
  • src/wp-includes/comment.php

     
    9292        if ( 1 == get_option('comment_whitelist')) {
    9393                if ( 'trackback' != $comment_type && 'pingback' != $comment_type && $author != '' && $email != '' ) {
    9494                        // expected_slashed ($author, $email)
    95                         $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");
     95                        $sql = $wpdb->prepare(
     96                                "SELECT comment_approved FROM $wpdb->comments WHERE comment_author = '$author' AND comment_author_email = '$email' and comment_approved = %s LIMIT 1",
     97                                WP_STATUS_ON
     98                        );
     99                        $ok_to_comment = $wpdb->get_var( $sql );
    96100                        if ( ( 1 == $ok_to_comment ) &&
    97101                                ( empty($mod_keys) || false === strpos( $email, $mod_keys) ) )
    98102                                        return true;
     
    116120 */
    117121function get_approved_comments($post_id) {
    118122        global $wpdb;
    119         return $wpdb->get_results($wpdb->prepare("SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved = '1' ORDER BY comment_date", $post_id));
     123        $sql = $wpdb->prepare(
     124                "SELECT * FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved = %s ORDER BY comment_date",
     125                $post_id,
     126                WP_STATUS_ON
     127        );
     128        return $wpdb->get_results( $sql );
    120129}
    121130
    122131/**
     
    302311
    303312                $status = $this->query_vars['status'];
    304313                if ( 'hold' == $status ) {
    305                         $approved = "comment_approved = '0'";
     314                        $approved = $wpdb->prepare( "comment_approved = %s", WP_STATUS_OFF );
    306315                } elseif ( 'approve' == $status ) {
    307                         $approved = "comment_approved = '1'";
     316                        $approved = $wpdb->prepare( "comment_approved = %s", WP_STATUS_ON );
    308317                } elseif ( ! empty( $status ) && 'all' != $status ) {
    309318                        $approved = $wpdb->prepare( "comment_approved = %s", $status );
    310319                } else {
    311                         $approved = "( comment_approved = '0' OR comment_approved = '1' )";
     320                        $approved = $wpdb->prepare( "( comment_approved = %s OR comment_approved = %s )", WP_STATUS_OFF, WP_STATUS_ON );
    312321                }
    313322                $order = ( 'ASC' == strtoupper( $this->query_vars['order'] ) ) ? 'ASC' : 'DESC';
    314323
     
    543552
    544553        switch ( strtolower($timezone)) {
    545554                case 'gmt':
    546                         $lastcommentmodified = $wpdb->get_var("SELECT comment_date_gmt FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1");
     555                        $sql = $wpdb->prepare(
     556                                "SELECT comment_date_gmt FROM $wpdb->comments WHERE comment_approved = %s ORDER BY comment_date_gmt DESC LIMIT 1",
     557                                WP_STATUS_ON
     558                        );
     559                        $lastcommentmodified = $wpdb->get_var( $sql );
    547560                        break;
    548561                case 'blog':
    549                         $lastcommentmodified = $wpdb->get_var("SELECT comment_date FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1");
     562                        $sql = $wpdb->prepare(
     563                                "SELECT comment_date FROM $wpdb->comments WHERE comment_approved = %s ORDER BY comment_date_gmt DESC LIMIT 1",
     564                                WP_STATUS_ON
     565                        );
     566                        $lastcommentmodified = $wpdb->get_var( $sql );
    550567                        break;
    551568                case 'server':
    552                         $lastcommentmodified = $wpdb->get_var($wpdb->prepare("SELECT DATE_ADD(comment_date_gmt, INTERVAL %s SECOND) FROM $wpdb->comments WHERE comment_approved = '1' ORDER BY comment_date_gmt DESC LIMIT 1", $add_seconds_server));
     569                        $sql = $wpdb->prepare(
     570                                "SELECT DATE_ADD(comment_date_gmt, INTERVAL %s SECOND) FROM $wpdb->comments WHERE comment_approved = %s ORDER BY comment_date_gmt DESC LIMIT 1",
     571                                $add_seconds_server,
     572                                WP_STATUS_ON
     573                        );
     574                        $lastcommentmodified = $wpdb->get_var( $sql );
    553575                        break;
    554576        }
    555577
     
    10671089        $comtypewhere = ( 'all' != $args['type'] && isset($allowedtypes[$args['type']]) ) ? " AND comment_type = '" . $allowedtypes[$args['type']] . "'" : '';
    10681090
    10691091        // Count comments older than this one
    1070         $oldercoms = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_parent = 0 AND comment_approved = '1' AND comment_date_gmt < '%s'" . $comtypewhere, $comment->comment_post_ID, $comment->comment_date_gmt ) );
     1092        $sql = $wpdb->prepare(
     1093                "SELECT COUNT(comment_ID) FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_parent = 0 AND comment_approved = %s AND comment_date_gmt < '%s'" . $comtypewhere,
     1094                $comment->comment_post_ID,
     1095                WP_STATUS_ON,
     1096                $comment->comment_date_gmt
     1097        );
     1098        $oldercoms = $wpdb->get_var( $sql );
    10711099
    10721100        // No older comments? Then it's page #1.
    10731101        if ( 0 == $oldercoms )
     
    13391367        do_action( 'untrash_comment', $comment_id );
    13401368
    13411369        $status = (string) get_comment_meta($comment_id, '_wp_trash_meta_status', true);
    1342         if ( empty($status) )
    1343                 $status = '0';
    1344 
     1370        if ( empty( $status ) ) {
     1371                $status = WP_STATUS_OFF;
     1372        }
    13451373        if ( wp_set_comment_status($comment_id, $status) ) {
    13461374                delete_comment_meta($comment_id, '_wp_trash_meta_time');
    13471375                delete_comment_meta($comment_id, '_wp_trash_meta_status');
     
    14181446        do_action( 'unspam_comment', $comment_id );
    14191447
    14201448        $status = (string) get_comment_meta($comment_id, '_wp_trash_meta_status', true);
    1421         if ( empty($status) )
    1422                 $status = '0';
    1423 
     1449        if ( empty( $status ) ) {
     1450                $status = WP_STATUS_OFF;
     1451        }
    14241452        if ( wp_set_comment_status($comment_id, $status) ) {
    14251453                delete_comment_meta($comment_id, '_wp_trash_meta_status');
    14261454                /**
     
    14541482
    14551483        if ( $approved == null )
    14561484                return false;
    1457         elseif ( $approved == '1' )
     1485        elseif ( $approved == WP_STATUS_ON )
    14581486                return 'approved';
    1459         elseif ( $approved == '0' )
     1487        elseif ( $approved == WP_STATUS_OFF )
    14601488                return 'unapproved';
    14611489        elseif ( $approved == 'spam' )
    14621490                return 'spam';
     
    17861814        do_action( 'comment_post', $comment_ID, $commentdata['comment_approved'] );
    17871815
    17881816        if ( 'spam' !== $commentdata['comment_approved'] ) { // If it's spam save it silently for later crunching
    1789                 if ( '0' == $commentdata['comment_approved'] ) {
     1817                if ( WP_STATUS_OFF == $commentdata['comment_approved'] ) {
    17901818                        wp_notify_moderator( $comment_ID );
    17911819                }
    17921820
     
    18191847
    18201848        switch ( $comment_status ) {
    18211849                case 'hold':
    1822                 case '0':
    1823                         $status = '0';
     1850                case WP_STATUS_OFF:
     1851                        $status = WP_STATUS_OFF;
    18241852                        break;
    18251853                case 'approve':
    1826                 case '1':
    1827                         $status = '1';
     1854                case WP_STATUS_ON:
     1855                        $status = WP_STATUS_ON;
    18281856                        if ( get_option('comments_notify') ) {
    18291857                                wp_notify_postauthor( $comment_id );
    18301858                        }
     
    20302058                return false;
    20312059
    20322060        $old = (int) $post->comment_count;
    2033         $new = (int) $wpdb->get_var( $wpdb->prepare("SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved = '1'", $post_id) );
     2061        $sql = $wpdb->prepare(
     2062                "SELECT COUNT(*) FROM $wpdb->comments WHERE comment_post_ID = %d AND comment_approved = %s",
     2063                $post_id,
     2064                WP_STATUS_ON
     2065        );
     2066        $new = (int) $wpdb->get_var( $sql );
    20342067        $wpdb->update( $wpdb->posts, array('comment_count' => $new), array('ID' => $post_id) );
    20352068
    20362069        clean_post_cache( $post );
     
    23242357 * @return mixed Empty string if blog is not public, returns $sites, if site is public.
    23252358 */
    23262359function privacy_ping_filter($sites) {
    2327         if ( '0' != get_option('blog_public') )
     2360        if ( WP_STATUS_OFF != get_option('blog_public') )
    23282361                return $sites;
    23292362        else
    23302363                return '';
  • src/wp-includes/default-constants.php

     
    1515function wp_initial_constants() {
    1616        global $blog_id;
    1717
     18        // avoid magic numbers
     19        define( 'WP_STATUS_ON', 1 );
     20        define( 'WP_STATUS_OFF', 0 );
     21
    1822        // set memory limits
    1923        if ( !defined('WP_MEMORY_LIMIT') ) {
    2024                if( is_multisite() ) {
  • src/wp-includes/default-widgets.php

     
    273273        }
    274274
    275275        public function widget( $args, $instance ) {
    276                 $c = ! empty( $instance['count'] ) ? '1' : '0';
    277                 $d = ! empty( $instance['dropdown'] ) ? '1' : '0';
     276                $c = ! empty( $instance['count'] )    ? WP_STATUS_ON : WP_STATUS_OFF;
     277                $d = ! empty( $instance['dropdown'] ) ? WP_STATUS_ON : WP_STATUS_OFF;
    278278
    279279                /** This filter is documented in wp-includes/default-widgets.php */
    280280                $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Archives' ) : $instance['title'], $instance, $this->id_base );
     
    547547                /** This filter is documented in wp-includes/default-widgets.php */
    548548                $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Categories' ) : $instance['title'], $instance, $this->id_base );
    549549
    550                 $c = ! empty( $instance['count'] ) ? '1' : '0';
    551                 $h = ! empty( $instance['hierarchical'] ) ? '1' : '0';
    552                 $d = ! empty( $instance['dropdown'] ) ? '1' : '0';
     550                $c = ! empty( $instance['count'] )        ? WP_STATUS_ON : WP_STATUS_OFF;
     551                $h = ! empty( $instance['hierarchical'] ) ? WP_STATUS_ON : WP_STATUS_OFF;
     552                $d = ! empty( $instance['dropdown'] )     ? WP_STATUS_ON : WP_STATUS_OFF;
    553553
    554554                echo $args['before_widget'];
    555555                if ( $title ) {
  • src/wp-includes/feed-rdf.php

     
    3333        <?php /** This filter is documented in wp-includes/feed-rss2.php */ ?>
    3434        <sy:updatePeriod><?php echo apply_filters( 'rss_update_period', 'hourly' ); ?></sy:updatePeriod>
    3535        <?php /** This filter is documented in wp-includes/feed-rss2.php */ ?>
    36         <sy:updateFrequency><?php echo apply_filters( 'rss_update_frequency', '1' ); ?></sy:updateFrequency>
     36        <sy:updateFrequency><?php echo apply_filters( 'rss_update_frequency', WP_STATUS_ON ); ?></sy:updateFrequency>
    3737        <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase>
    3838        <?php
    3939        /**
  • src/wp-includes/feed-rss2-comments.php

     
    4444        <?php /** This filter is documented in wp-includes/feed-rss2.php */ ?>
    4545        <sy:updatePeriod><?php echo apply_filters( 'rss_update_period', 'hourly' ); ?></sy:updatePeriod>
    4646        <?php /** This filter is documented in wp-includes/feed-rss2.php */ ?>
    47         <sy:updateFrequency><?php echo apply_filters( 'rss_update_frequency', '1' ); ?></sy:updateFrequency>
     47        <sy:updateFrequency><?php echo apply_filters( 'rss_update_frequency', WP_STATUS_ON ); ?></sy:updateFrequency>
    4848        <?php
    4949        /**
    5050         * Fires at the end of the RSS2 comment feed header.
  • src/wp-includes/formatting.php

     
    32323232                case 'default_ping_status':
    32333233                case 'default_comment_status':
    32343234                        // Options that if not there have 0 value but need to be something like "closed"
    3235                         if ( $value == '0' || $value == '')
     3235                        if ( $value == WP_STATUS_OFF || $value == '')
    32363236                                $value = 'closed';
    32373237                        break;
    32383238
  • src/wp-includes/functions.php

     
    11581158
    11591159        $output = "User-agent: *\n";
    11601160        $public = get_option( 'blog_public' );
    1161         if ( '0' == $public ) {
     1161        if ( WP_STATUS_OFF == $public ) {
    11621162                $output .= "Disallow: /\n";
    11631163        } else {
    11641164                $site_url = parse_url( site_url() );
  • src/wp-includes/general-template.php

     
    21982198 */
    21992199function noindex() {
    22002200        // If the blog is not public, tell robots to go away.
    2201         if ( '0' == get_option('blog_public') )
     2201        if ( WP_STATUS_OFF == get_option('blog_public') )
    22022202                wp_no_robots();
    22032203}
    22042204
  • src/wp-includes/ms-blogs.php

     
    847847        if ( ! empty( $deprecated ) )
    848848                _deprecated_argument( __FUNCTION__, 'MU' ); // never used
    849849
    850         return $wpdb->get_results( $wpdb->prepare("SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' AND last_updated != '0000-00-00 00:00:00' ORDER BY last_updated DESC limit %d, %d", $wpdb->siteid, $start, $quantity ) , ARRAY_A );
     850        $sql = $wpdb->prepare(
     851                "SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = %s AND archived = %s AND mature = %s AND spam = %s AND deleted = %s AND last_updated != '0000-00-00 00:00:00' ORDER BY last_updated DESC limit %d, %d",
     852                $wpdb->siteid,
     853                WP_STATUS_ON,
     854                WP_STATUS_OFF,
     855                WP_STATUS_OFF,
     856                WP_STATUS_OFF,
     857                WP_STATUS_OFF, 
     858                $start,
     859                $quantity
     860        );
     861        return $wpdb->get_results( $sql, ARRAY_A );
    851862}
    852863
    853864/**
  • src/wp-includes/ms-deprecated.php

     
    164164        _deprecated_function( __FUNCTION__, '3.0', 'wp_get_sites()' );
    165165
    166166        global $wpdb;
    167         $blogs = $wpdb->get_results( $wpdb->prepare("SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND mature = '0' AND spam = '0' AND deleted = '0' ORDER BY registered DESC", $wpdb->siteid), ARRAY_A );
     167        $sql = $wpdb->prepare(
     168                "SELECT blog_id, domain, path FROM $wpdb->blogs WHERE site_id = %d AND public = %s AND archived = %s AND mature = %s AND spam = %s AND deleted = %s ORDER BY registered DESC",
     169                $wpdb->siteid,
     170                WP_STATUS_ON,
     171                WP_STATUS_OFF,
     172                WP_STATUS_OFF,
     173                WP_STATUS_OFF,
     174                WP_STATUS_OFF
     175        );
     176        $blogs = $wpdb->get_results( $sql, ARRAY_A );
    168177
    169178        foreach ( (array) $blogs as $details ) {
    170179                $blog_list[ $details['blog_id'] ] = $details;
  • src/wp-includes/ms-files.php

     
    1818
    1919error_reporting( 0 );
    2020
    21 if ( $current_blog->archived == '1' || $current_blog->spam == '1' || $current_blog->deleted == '1' ) {
     21if ( $current_blog->archived == WP_STATUS_ON
     22        || $current_blog->spam == WP_STATUS_ON
     23        || $current_blog->deleted == WP_STATUS_ON ) {
    2224        status_header( 404 );
    2325        die( '404 &#8212; File not found.' );
    2426}
  • src/wp-includes/ms-functions.php

     
    22542254function wp_update_network_site_counts() {
    22552255        global $wpdb;
    22562256
    2257         $count = $wpdb->get_var( $wpdb->prepare("SELECT COUNT(blog_id) as c FROM $wpdb->blogs WHERE site_id = %d AND spam = '0' AND deleted = '0' and archived = '0'", $wpdb->siteid) );
     2257        $sql = $wpdb->prepare(
     2258                "SELECT COUNT(blog_id) as c FROM $wpdb->blogs WHERE site_id = %d AND spam = %s AND deleted = %s and archived = %s",
     2259                $wpdb->siteid,
     2260                WP_STATUS_OFF,
     2261                WP_STATUS_OFF,
     2262                WP_STATUS_OFF
     2263        );
     2264        $count = $wpdb->get_var( $sql );
    22582265        update_site_option( 'blog_count', $count );
    22592266}
    22602267
     
    22662273function wp_update_network_user_counts() {
    22672274        global $wpdb;
    22682275
    2269         $count = $wpdb->get_var( "SELECT COUNT(ID) as c FROM $wpdb->users WHERE spam = '0' AND deleted = '0'" );
     2276        $sql = $wpdb->prepare(
     2277                "SELECT COUNT(ID) as c FROM $wpdb->users WHERE spam = %s AND deleted = %s",
     2278                WP_STATUS_OFF,
     2279                WP_STATUS_OFF
     2280        );
     2281        $count = $wpdb->get_var( $sql );
    22702282        update_site_option( 'user_count', $count );
    22712283}
    22722284
  • src/wp-includes/ms-load.php

     
    8888        if ( is_super_admin() )
    8989                return true;
    9090
    91         if ( '1' == $blog->deleted ) {
     91        if ( WP_STATUS_ON == $blog->deleted ) {
    9292                if ( file_exists( WP_CONTENT_DIR . '/blog-deleted.php' ) )
    9393                        return WP_CONTENT_DIR . '/blog-deleted.php';
    9494                else
     
    102102                        wp_die( sprintf( __( 'This site has not been activated yet. If you are having problems activating your site, please contact <a href="mailto:%1$s">%1$s</a>.' ), str_replace( '@', ' AT ', get_site_option( 'admin_email', 'support@' . get_current_site()->domain ) ) ) );
    103103        }
    104104
    105         if ( $blog->archived == '1' || $blog->spam == '1' ) {
     105        if ( $blog->archived == WP_STATUS_ON || $blog->spam == WP_STATUS_ON ) {
    106106                if ( file_exists( WP_CONTENT_DIR . '/blog-suspended.php' ) )
    107107                        return WP_CONTENT_DIR . '/blog-suspended.php';
    108108                else
  • src/wp-includes/pluggable.php

     
    14781478        }
    14791479
    14801480        $comment_author_domain = @gethostbyaddr($comment->comment_author_IP);
    1481         $comments_waiting = $wpdb->get_var("SELECT count(comment_ID) FROM $wpdb->comments WHERE comment_approved = '0'");
     1481        $sql = $wpdb->prepare( "SELECT count(comment_ID) FROM $wpdb->comments WHERE comment_approved = %s", WP_STATUS_OFF );
     1482        $comments_waiting = $wpdb->get_var( $sql );
    14821483
    14831484        // The blogname option is escaped with esc_html on the way into the database in sanitize_option
    14841485        // we want to reverse this for the plain text arena of emails.
  • src/wp-includes/post.php

     
    27482748
    27492749        foreach ( $group_by_status as $status => $comments ) {
    27502750                // Sanity check. This shouldn't happen.
    2751                 if ( 'post-trashed' == $status )
    2752                         $status = '0';
     2751                if ( 'post-trashed' == $status ) {
     2752                        $status = WP_STATUS_OFF;
     2753                }
    27532754                $comments_in = implode( "', '", $comments );
    27542755                $wpdb->query( "UPDATE $wpdb->comments SET comment_approved = '$status' WHERE comment_ID IN ('" . $comments_in . "')" );
    27552756        }
     
    56465647                return;
    56475648
    56485649        if ( get_option('default_pingback_flag') )
    5649                 add_post_meta( $post_id, '_pingme', '1' );
    5650         add_post_meta( $post_id, '_encloseme', '1' );
     5650                add_post_meta( $post_id, '_pingme', WP_STATUS_ON );
     5651        add_post_meta( $post_id, '_encloseme', WP_STATUS_ON );
    56515652
    56525653        wp_schedule_single_event(time(), 'do_pings');
    56535654}
  • src/wp-signup.php

     
    127127            <?php _e( 'Allow search engines to index this site.' ); ?>
    128128            <br style="clear:both" />
    129129            <label class="checkbox" for="blog_public_on">
    130                 <input type="radio" id="blog_public_on" name="blog_public" value="1" <?php if ( !isset( $_POST['blog_public'] ) || $_POST['blog_public'] == '1' ) { ?>checked="checked"<?php } ?> />
     130                <input type="radio" id="blog_public_on" name="blog_public" value="1" <?php if ( !isset( $_POST['blog_public'] ) || $_POST['blog_public'] == WP_STATUS_ON ) { ?>checked="checked"<?php } ?> />
    131131                <strong><?php _e( 'Yes' ); ?></strong>
    132132            </label>
    133133            <label class="checkbox" for="blog_public_off">
    134                 <input type="radio" id="blog_public_off" name="blog_public" value="0" <?php if ( isset( $_POST['blog_public'] ) && $_POST['blog_public'] == '0' ) { ?>checked="checked"<?php } ?> />
     134                <input type="radio" id="blog_public_off" name="blog_public" value="0" <?php if ( isset( $_POST['blog_public'] ) && $_POST['blog_public'] == WP_STATUS_OFF ) { ?>checked="checked"<?php } ?> />
    135135                <strong><?php _e( 'No' ); ?></strong>
    136136            </label>
    137137        </p>