Ticket #14581: 14581.diff
| File 14581.diff, 41.9 KB (added by , 12 years ago) |
|---|
-
src/wp-admin/comment.php
99 99 } 100 100 101 101 // 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 ) ) { 103 103 wp_redirect( admin_url( 'edit-comments.php?same=' . $comment_id ) ); 104 104 die(); 105 105 } … … 137 137 break; 138 138 } 139 139 140 if ( $comment->comment_approved != '0') { // if not unapproved140 if ( $comment->comment_approved != WP_STATUS_OFF ) { // if not unapproved 141 141 $message = ''; 142 142 switch ( $comment->comment_approved ) { 143 143 case '1' : … … 236 236 switch ( $action ) { 237 237 case 'deletecomment' : 238 238 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 ); 240 240 break; 241 241 case 'trashcomment' : 242 242 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 ); 244 244 break; 245 245 case 'untrashcomment' : 246 246 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 ); 248 248 break; 249 249 case 'spamcomment' : 250 250 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 ); 252 252 break; 253 253 case 'unspamcomment' : 254 254 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 ); 256 256 break; 257 257 case 'approvecomment' : 258 258 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 ); 260 260 break; 261 261 case 'unapprovecomment' : 262 262 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 ); 264 264 break; 265 265 } 266 266 -
src/wp-admin/edit-comments.php
205 205 206 206 if ( $same > 0 && $comment = get_comment( $same ) ) { 207 207 switch ( $comment->comment_approved ) { 208 case '1':208 case WP_STATUS_ON : 209 209 $messages[] = __('This comment is already approved.') . ' <a href="' . esc_url( admin_url( "comment.php?action=editcomment&c=$same" ) ) . '">' . __( 'Edit comment' ) . '</a>'; 210 210 break; 211 211 case 'trash' : -
src/wp-admin/edit-form-comment.php
86 86 <div id="misc-publishing-actions"> 87 87 88 88 <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 /> 91 91 <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> 92 92 </div> 93 93 -
src/wp-admin/includes/class-wp-comments-list-table.php
477 477 if ( ( 'reply' == $action || 'quickedit' == $action ) && ! defined('DOING_AJAX') ) 478 478 $action .= ' hide-if-no-js'; 479 479 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 ) ) 481 481 $action .= ' approve'; 482 482 else 483 483 $action .= ' unapprove'; -
src/wp-admin/includes/class-wp-ms-sites-list-table.php
262 262 $actions['edit'] = '<span class="edit"><a href="' . esc_url( network_admin_url( 'site-info.php?id=' . $blog['blog_id'] ) ) . '">' . __( 'Edit' ) . '</a></span>'; 263 263 $actions['backend'] = "<span class='backend'><a href='" . esc_url( get_admin_url( $blog['blog_id'] ) ) . "' class='edit'>" . __( 'Dashboard' ) . '</a></span>'; 264 264 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 ) 266 266 $actions['activate'] = '<span class="activate"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=activateblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to activate the site %s' ), $blogname ) ) ), 'confirm' ) ) . '">' . __( 'Activate' ) . '</a></span>'; 267 267 else 268 268 $actions['deactivate'] = '<span class="activate"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=deactivateblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to deactivate the site %s' ), $blogname ) ) ), 'confirm') ) . '">' . __( 'Deactivate' ) . '</a></span>'; 269 269 270 if ( get_blog_status( $blog['blog_id'], 'archived' ) == '1')270 if ( get_blog_status( $blog['blog_id'], 'archived' ) == WP_STATUS_ON ) 271 271 $actions['unarchive'] = '<span class="archive"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=unarchiveblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to unarchive the site %s.' ), $blogname ) ) ), 'confirm') ) . '">' . __( 'Unarchive' ) . '</a></span>'; 272 272 else 273 273 $actions['archive'] = '<span class="archive"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=archiveblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to archive the site %s.' ), $blogname ) ) ), 'confirm') ) . '">' . _x( 'Archive', 'verb; site' ) . '</a></span>'; 274 274 275 if ( get_blog_status( $blog['blog_id'], 'spam' ) == '1')275 if ( get_blog_status( $blog['blog_id'], 'spam' ) == WP_STATUS_ON ) 276 276 $actions['unspam'] = '<span class="spam"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=unspamblog&id=' . $blog['blog_id'] . '&msg=' . urlencode( sprintf( __( 'You are about to unspam the site %s.' ), $blogname ) ) ), 'confirm') ) . '">' . _x( 'Not Spam', 'site' ) . '</a></span>'; 277 277 else 278 278 $actions['spam'] = '<span class="spam"><a href="' . esc_url( wp_nonce_url( network_admin_url( 'sites.php?action=confirm&action2=spamblog&id=' . $blog['blog_id'] . '&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
128 128 $post_id_array = array_map('intval', $post_id_array); 129 129 $post_id_in = "'" . implode("', '", $post_id_array) . "'"; 130 130 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 ); 132 136 133 137 if ( $single ) { 134 138 if ( empty($pending) ) -
src/wp-admin/includes/dashboard.php
272 272 update_right_now_message(); 273 273 274 274 // 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' ) ) { 276 276 277 277 /** 278 278 * Filter the link title attribute for the 'Search Engines Discouraged' -
src/wp-admin/includes/upgrade.php
712 712 $wpdb->show_errors(); 713 713 714 714 // 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 ); 716 720 if ( is_array( $comments ) ) 717 721 foreach ($comments as $comment) 718 722 $wpdb->update( $wpdb->posts, array('comment_count' => $comment->c), array('ID' => $comment->comment_post_ID) ); … … 1079 1083 1080 1084 if ( $wp_current_db_version < 11958 ) { 1081 1085 // 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 ) { 1083 1087 update_option( 'thread_comments_depth', 2 ); 1084 1088 update_option( 'thread_comments', 0 ); 1085 1089 } … … 1344 1348 1345 1349 // 3.0 1346 1350 if ( $wp_current_db_version < 13576 ) 1347 update_site_option( 'global_terms_enabled', '1');1351 update_site_option( 'global_terms_enabled', WP_STATUS_ON ); 1348 1352 1349 1353 // 3.3 1350 1354 if ( $wp_current_db_version < 19390 ) … … 1374 1378 1375 1379 // 3.5 1376 1380 if ( $wp_current_db_version < 21823 ) 1377 update_site_option( 'ms_files_rewriting', '1');1381 update_site_option( 'ms_files_rewriting', WP_STATUS_ON ); 1378 1382 1379 1383 // 3.5.2 1380 1384 if ( $wp_current_db_version < 24448 ) { … … 1404 1408 */ 1405 1409 function maybe_create_table($table_name, $create_ddl) { 1406 1410 global $wpdb; 1407 1411 1408 1412 $query = $wpdb->prepare( "SHOW TABLES LIKE %s", $wpdb->esc_like( $table_name ) ); 1409 1413 1410 1414 if ( $wpdb->get_var( $query ) == $table_name ) { -
src/wp-admin/includes/user.php
394 394 return; 395 395 396 396 //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'] ) { 398 398 delete_user_setting('default_password_nag'); 399 399 update_user_option($user_ID, 'default_password_nag', false, true); 400 400 } -
src/wp-admin/ms-delete-site.php
34 34 echo '<div class="wrap">'; 35 35 echo '<h2>' . esc_html( $title ) . '</h2>'; 36 36 37 if ( isset( $_POST['action'] ) && $_POST['action'] == 'deleteblog' && isset( $_POST['confirmdelete'] ) && $_POST['confirmdelete'] == '1') {37 if ( isset( $_POST['action'] ) && $_POST['action'] == 'deleteblog' && isset( $_POST['confirmdelete'] ) && $_POST['confirmdelete'] == WP_STATUS_ON ) { 38 38 check_admin_referer( 'delete-blog' ); 39 39 40 40 $hash = wp_generate_password( 20, false ); -
src/wp-admin/network/sites.php
124 124 case 'spam': 125 125 case 'notspam': 126 126 $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 ); 128 128 break; 129 129 } 130 130 } else { … … 139 139 140 140 case 'archiveblog': 141 141 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 ); 143 143 break; 144 144 145 145 case 'activateblog': 146 update_blog_status( $id, 'deleted', '0');146 update_blog_status( $id, 'deleted', WP_STATUS_OFF ); 147 147 148 148 /** 149 149 * Fires after a network site is activated. … … 164 164 * @param string $id The ID of the site being deactivated. 165 165 */ 166 166 do_action( 'deactivate_blog', $id ); 167 update_blog_status( $id, 'deleted', '1');167 update_blog_status( $id, 'deleted', WP_STATUS_ON ); 168 168 break; 169 169 170 170 case 'unspamblog': 171 171 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 ); 173 173 break; 174 174 175 175 case 'unmatureblog': 176 176 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 ); 178 178 break; 179 179 } 180 180 -
src/wp-admin/network/themes.php
44 44 check_admin_referer('disable-theme_' . $_GET['theme']); 45 45 unset( $allowed_themes[ $_GET['theme'] ] ); 46 46 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 ) ); 48 48 exit; 49 49 case 'enable-selected': 50 50 check_admin_referer('bulk-themes'); -
src/wp-admin/network/upgrade.php
52 52 update_site_option( 'wpmu_upgrade_site', $wp_db_version ); 53 53 } 54 54 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 ); 56 62 if ( empty( $blogs ) ) { 57 63 echo '<p>' . __( 'All done!' ) . '</p>'; 58 64 break; -
src/wp-admin/network/users.php
144 144 $blogs = get_blogs_of_user( $val, true ); 145 145 foreach ( (array) $blogs as $key => $details ) { 146 146 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 ); 148 148 } 149 update_user_status( $val, 'spam', '1');149 update_user_status( $val, 'spam', WP_STATUS_ON ); 150 150 break; 151 151 152 152 case 'notspam': … … 153 153 $userfunction = 'all_notspam'; 154 154 $blogs = get_blogs_of_user( $val, true ); 155 155 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 ); 157 157 158 update_user_status( $val, 'spam', '0');158 update_user_status( $val, 'spam', WP_STATUS_OFF ); 159 159 break; 160 160 } 161 161 } -
src/wp-includes/class-wp-editor.php
1379 1379 * @since 3.1.0 1380 1380 */ 1381 1381 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' : ''; 1383 1383 1384 1384 // display: none is required here, see #WP27605 1385 1385 ?> -
src/wp-includes/class-wp-xmlrpc-server.php
970 970 $comment_date = $this->_convert_date( $comment->comment_date ); 971 971 $comment_date_gmt = $this->_convert_date_gmt( $comment->comment_date_gmt, $comment->comment_date ); 972 972 973 if ( '0'== $comment->comment_approved )973 if ( WP_STATUS_OFF == $comment->comment_approved ) 974 974 $comment_status = 'hold'; 975 975 else if ( 'spam' == $comment->comment_approved ) 976 976 $comment_status = 'spam'; 977 else if ( '1'== $comment->comment_approved )977 else if ( WP_STATUS_ON == $comment->comment_approved ) 978 978 $comment_status = 'approve'; 979 979 else 980 980 $comment_status = $comment->comment_approved; … … 5163 5163 // Get the post author info. 5164 5164 $author = get_userdata($entry['post_author']); 5165 5165 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; 5168 5168 5169 5169 // Consider future posts as published 5170 5170 if ( $entry['post_status'] === 'future' ) -
src/wp-includes/comment-template.php
1101 1101 1102 1102 /** @todo Use API instead of SELECTs. */ 1103 1103 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 ); 1105 1112 } else if ( empty($comment_author) ) { 1106 1113 $comments = get_comments( array('post_id' => $post->ID, 'status' => 'approve', 'order' => 'ASC') ); 1107 1114 } 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 ); 1109 1124 } 1110 1125 1111 1126 /** … … 1792 1807 <?php if ( 0 != $args['avatar_size'] ) echo get_avatar( $comment, $args['avatar_size'] ); ?> 1793 1808 <?php printf( __( '<cite class="fn">%s</cite> <span class="says">says:</span>' ), get_comment_author_link() ); ?> 1794 1809 </div> 1795 <?php if ( '0'== $comment->comment_approved ) : ?>1810 <?php if ( WP_STATUS_OFF == $comment->comment_approved ) : ?> 1796 1811 <em class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.' ) ?></em> 1797 1812 <br /> 1798 1813 <?php endif; ?> … … 1847 1862 <?php edit_comment_link( __( 'Edit' ), '<span class="edit-link">', '</span>' ); ?> 1848 1863 </div><!-- .comment-metadata --> 1849 1864 1850 <?php if ( '0'== $comment->comment_approved ) : ?>1865 <?php if ( WP_STATUS_OFF == $comment->comment_approved ) : ?> 1851 1866 <p class="comment-awaiting-moderation"><?php _e( 'Your comment is awaiting moderation.' ); ?></p> 1852 1867 <?php endif; ?> 1853 1868 </footer><!-- .comment-meta --> -
src/wp-includes/comment.php
92 92 if ( 1 == get_option('comment_whitelist')) { 93 93 if ( 'trackback' != $comment_type && 'pingback' != $comment_type && $author != '' && $email != '' ) { 94 94 // 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 ); 96 100 if ( ( 1 == $ok_to_comment ) && 97 101 ( empty($mod_keys) || false === strpos( $email, $mod_keys) ) ) 98 102 return true; … … 116 120 */ 117 121 function get_approved_comments($post_id) { 118 122 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 ); 120 129 } 121 130 122 131 /** … … 302 311 303 312 $status = $this->query_vars['status']; 304 313 if ( 'hold' == $status ) { 305 $approved = "comment_approved = '0'";314 $approved = $wpdb->prepare( "comment_approved = %s", WP_STATUS_OFF ); 306 315 } elseif ( 'approve' == $status ) { 307 $approved = "comment_approved = '1'";316 $approved = $wpdb->prepare( "comment_approved = %s", WP_STATUS_ON ); 308 317 } elseif ( ! empty( $status ) && 'all' != $status ) { 309 318 $approved = $wpdb->prepare( "comment_approved = %s", $status ); 310 319 } 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 ); 312 321 } 313 322 $order = ( 'ASC' == strtoupper( $this->query_vars['order'] ) ) ? 'ASC' : 'DESC'; 314 323 … … 543 552 544 553 switch ( strtolower($timezone)) { 545 554 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 ); 547 560 break; 548 561 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 ); 550 567 break; 551 568 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 ); 553 575 break; 554 576 } 555 577 … … 1067 1089 $comtypewhere = ( 'all' != $args['type'] && isset($allowedtypes[$args['type']]) ) ? " AND comment_type = '" . $allowedtypes[$args['type']] . "'" : ''; 1068 1090 1069 1091 // 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 ); 1071 1099 1072 1100 // No older comments? Then it's page #1. 1073 1101 if ( 0 == $oldercoms ) … … 1339 1367 do_action( 'untrash_comment', $comment_id ); 1340 1368 1341 1369 $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 } 1345 1373 if ( wp_set_comment_status($comment_id, $status) ) { 1346 1374 delete_comment_meta($comment_id, '_wp_trash_meta_time'); 1347 1375 delete_comment_meta($comment_id, '_wp_trash_meta_status'); … … 1418 1446 do_action( 'unspam_comment', $comment_id ); 1419 1447 1420 1448 $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 } 1424 1452 if ( wp_set_comment_status($comment_id, $status) ) { 1425 1453 delete_comment_meta($comment_id, '_wp_trash_meta_status'); 1426 1454 /** … … 1454 1482 1455 1483 if ( $approved == null ) 1456 1484 return false; 1457 elseif ( $approved == '1')1485 elseif ( $approved == WP_STATUS_ON ) 1458 1486 return 'approved'; 1459 elseif ( $approved == '0')1487 elseif ( $approved == WP_STATUS_OFF ) 1460 1488 return 'unapproved'; 1461 1489 elseif ( $approved == 'spam' ) 1462 1490 return 'spam'; … … 1786 1814 do_action( 'comment_post', $comment_ID, $commentdata['comment_approved'] ); 1787 1815 1788 1816 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'] ) { 1790 1818 wp_notify_moderator( $comment_ID ); 1791 1819 } 1792 1820 … … 1819 1847 1820 1848 switch ( $comment_status ) { 1821 1849 case 'hold': 1822 case '0':1823 $status = '0';1850 case WP_STATUS_OFF: 1851 $status = WP_STATUS_OFF; 1824 1852 break; 1825 1853 case 'approve': 1826 case '1':1827 $status = '1';1854 case WP_STATUS_ON: 1855 $status = WP_STATUS_ON; 1828 1856 if ( get_option('comments_notify') ) { 1829 1857 wp_notify_postauthor( $comment_id ); 1830 1858 } … … 2030 2058 return false; 2031 2059 2032 2060 $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 ); 2034 2067 $wpdb->update( $wpdb->posts, array('comment_count' => $new), array('ID' => $post_id) ); 2035 2068 2036 2069 clean_post_cache( $post ); … … 2324 2357 * @return mixed Empty string if blog is not public, returns $sites, if site is public. 2325 2358 */ 2326 2359 function privacy_ping_filter($sites) { 2327 if ( '0'!= get_option('blog_public') )2360 if ( WP_STATUS_OFF != get_option('blog_public') ) 2328 2361 return $sites; 2329 2362 else 2330 2363 return ''; -
src/wp-includes/default-constants.php
15 15 function wp_initial_constants() { 16 16 global $blog_id; 17 17 18 // avoid magic numbers 19 define( 'WP_STATUS_ON', 1 ); 20 define( 'WP_STATUS_OFF', 0 ); 21 18 22 // set memory limits 19 23 if ( !defined('WP_MEMORY_LIMIT') ) { 20 24 if( is_multisite() ) { -
src/wp-includes/default-widgets.php
273 273 } 274 274 275 275 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; 278 278 279 279 /** This filter is documented in wp-includes/default-widgets.php */ 280 280 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Archives' ) : $instance['title'], $instance, $this->id_base ); … … 547 547 /** This filter is documented in wp-includes/default-widgets.php */ 548 548 $title = apply_filters( 'widget_title', empty( $instance['title'] ) ? __( 'Categories' ) : $instance['title'], $instance, $this->id_base ); 549 549 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; 553 553 554 554 echo $args['before_widget']; 555 555 if ( $title ) { -
src/wp-includes/feed-rdf.php
33 33 <?php /** This filter is documented in wp-includes/feed-rss2.php */ ?> 34 34 <sy:updatePeriod><?php echo apply_filters( 'rss_update_period', 'hourly' ); ?></sy:updatePeriod> 35 35 <?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> 37 37 <sy:updateBase>2000-01-01T12:00+00:00</sy:updateBase> 38 38 <?php 39 39 /** -
src/wp-includes/feed-rss2-comments.php
44 44 <?php /** This filter is documented in wp-includes/feed-rss2.php */ ?> 45 45 <sy:updatePeriod><?php echo apply_filters( 'rss_update_period', 'hourly' ); ?></sy:updatePeriod> 46 46 <?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> 48 48 <?php 49 49 /** 50 50 * Fires at the end of the RSS2 comment feed header. -
src/wp-includes/formatting.php
3232 3232 case 'default_ping_status': 3233 3233 case 'default_comment_status': 3234 3234 // 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 == '') 3236 3236 $value = 'closed'; 3237 3237 break; 3238 3238 -
src/wp-includes/functions.php
1158 1158 1159 1159 $output = "User-agent: *\n"; 1160 1160 $public = get_option( 'blog_public' ); 1161 if ( '0'== $public ) {1161 if ( WP_STATUS_OFF == $public ) { 1162 1162 $output .= "Disallow: /\n"; 1163 1163 } else { 1164 1164 $site_url = parse_url( site_url() ); -
src/wp-includes/general-template.php
2198 2198 */ 2199 2199 function noindex() { 2200 2200 // 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') ) 2202 2202 wp_no_robots(); 2203 2203 } 2204 2204 -
src/wp-includes/ms-blogs.php
847 847 if ( ! empty( $deprecated ) ) 848 848 _deprecated_argument( __FUNCTION__, 'MU' ); // never used 849 849 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 ); 851 862 } 852 863 853 864 /** -
src/wp-includes/ms-deprecated.php
164 164 _deprecated_function( __FUNCTION__, '3.0', 'wp_get_sites()' ); 165 165 166 166 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 ); 168 177 169 178 foreach ( (array) $blogs as $details ) { 170 179 $blog_list[ $details['blog_id'] ] = $details; -
src/wp-includes/ms-files.php
18 18 19 19 error_reporting( 0 ); 20 20 21 if ( $current_blog->archived == '1' || $current_blog->spam == '1' || $current_blog->deleted == '1' ) { 21 if ( $current_blog->archived == WP_STATUS_ON 22 || $current_blog->spam == WP_STATUS_ON 23 || $current_blog->deleted == WP_STATUS_ON ) { 22 24 status_header( 404 ); 23 25 die( '404 — File not found.' ); 24 26 } -
src/wp-includes/ms-functions.php
2254 2254 function wp_update_network_site_counts() { 2255 2255 global $wpdb; 2256 2256 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 ); 2258 2265 update_site_option( 'blog_count', $count ); 2259 2266 } 2260 2267 … … 2266 2273 function wp_update_network_user_counts() { 2267 2274 global $wpdb; 2268 2275 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 ); 2270 2282 update_site_option( 'user_count', $count ); 2271 2283 } 2272 2284 -
src/wp-includes/ms-load.php
88 88 if ( is_super_admin() ) 89 89 return true; 90 90 91 if ( '1'== $blog->deleted ) {91 if ( WP_STATUS_ON == $blog->deleted ) { 92 92 if ( file_exists( WP_CONTENT_DIR . '/blog-deleted.php' ) ) 93 93 return WP_CONTENT_DIR . '/blog-deleted.php'; 94 94 else … … 102 102 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 ) ) ) ); 103 103 } 104 104 105 if ( $blog->archived == '1' || $blog->spam == '1') {105 if ( $blog->archived == WP_STATUS_ON || $blog->spam == WP_STATUS_ON ) { 106 106 if ( file_exists( WP_CONTENT_DIR . '/blog-suspended.php' ) ) 107 107 return WP_CONTENT_DIR . '/blog-suspended.php'; 108 108 else -
src/wp-includes/pluggable.php
1478 1478 } 1479 1479 1480 1480 $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 ); 1482 1483 1483 1484 // The blogname option is escaped with esc_html on the way into the database in sanitize_option 1484 1485 // we want to reverse this for the plain text arena of emails. -
src/wp-includes/post.php
2748 2748 2749 2749 foreach ( $group_by_status as $status => $comments ) { 2750 2750 // 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 } 2753 2754 $comments_in = implode( "', '", $comments ); 2754 2755 $wpdb->query( "UPDATE $wpdb->comments SET comment_approved = '$status' WHERE comment_ID IN ('" . $comments_in . "')" ); 2755 2756 } … … 5646 5647 return; 5647 5648 5648 5649 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 ); 5651 5652 5652 5653 wp_schedule_single_event(time(), 'do_pings'); 5653 5654 } -
src/wp-signup.php
127 127 <?php _e( 'Allow search engines to index this site.' ); ?> 128 128 <br style="clear:both" /> 129 129 <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 } ?> /> 131 131 <strong><?php _e( 'Yes' ); ?></strong> 132 132 </label> 133 133 <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 } ?> /> 135 135 <strong><?php _e( 'No' ); ?></strong> 136 136 </label> 137 137 </p>