Changeset 45583
- Timestamp:
- 07/01/2019 12:50:14 PM (6 years ago)
- Location:
- trunk/src/wp-admin
- Files:
-
- 74 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/async-upload.php
r44331 r45583 40 40 41 41 // just fetch the detail form for that attachment 42 if ( isset( $_REQUEST['attachment_id'] ) && ( $id = intval( $_REQUEST['attachment_id'] ) ) && $_REQUEST['fetch'] ) { 42 if ( isset( $_REQUEST['attachment_id'] ) && intval( $_REQUEST['attachment_id'] ) && $_REQUEST['fetch'] ) { 43 $id = intval( $_REQUEST['attachment_id'] ); 43 44 $post = get_post( $id ); 44 45 if ( 'attachment' != $post->post_type ) { … … 51 52 switch ( $_REQUEST['fetch'] ) { 52 53 case 3: 53 if ( $thumb_url = wp_get_attachment_image_src( $id, 'thumbnail', true ) ) { 54 $thumb_url = wp_get_attachment_image_src( $id, 'thumbnail', true ); 55 if ( $thumb_url ) { 54 56 echo '<img class="pinkynail" src="' . esc_url( $thumb_url[0] ) . '" alt="" />'; 55 57 } -
trunk/src/wp-admin/comment.php
r45140 r45583 63 63 $comment_id = absint( $_GET['c'] ); 64 64 65 if ( ! $comment = get_comment( $comment_id ) ) { 65 $comment = get_comment( $comment_id ); 66 if ( ! $comment ) { 66 67 comment_footer_die( __( 'Invalid comment ID.' ) . sprintf( ' <a href="%s">' . __( 'Go back' ) . '</a>.', 'javascript:history.go(-1)' ) ); 67 68 } … … 89 90 $comment_id = absint( $_GET['c'] ); 90 91 91 if ( ! $comment = get_comment( $comment_id ) ) { 92 $comment = get_comment( $comment_id ); 93 if ( ! $comment ) { 92 94 wp_redirect( admin_url( 'edit-comments.php?error=1' ) ); 93 95 die(); … … 261 263 $noredir = isset( $_REQUEST['noredir'] ); 262 264 263 if ( ! $comment = get_comment( $comment_id ) ) { 265 $comment = get_comment( $comment_id ); 266 if ( ! $comment ) { 264 267 comment_footer_die( __( 'Invalid comment ID.' ) . sprintf( ' <a href="%s">' . __( 'Go back' ) . '</a>.', 'edit-comments.php' ) ); 265 268 } -
trunk/src/wp-admin/custom-background.php
r45411 r45583 257 257 } else { 258 258 $background_styles = ''; 259 if ( $bgcolor = get_background_color() ) { 259 $bgcolor = get_background_color(); 260 if ( $bgcolor ) { 260 261 $background_styles .= 'background-color: #' . $bgcolor . ';'; 261 262 } -
trunk/src/wp-admin/edit-comments.php
r45140 r45583 40 40 } 41 41 42 $approved = $unapproved = $spammed = $unspammed = $trashed = $untrashed = $deleted = 0; 42 $approved = 0; 43 $unapproved = 0; 44 $spammed = 0; 45 $unspammed = 0; 46 $trashed = 0; 47 $untrashed = 0; 48 $deleted = 0; 43 49 44 50 $redirect_to = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'spammed', 'unspammed', 'approved', 'unapproved', 'ids' ), wp_get_referer() ); … … 308 314 } 309 315 310 if ( $same > 0 && $comment = get_comment( $same ) ) { 311 switch ( $comment->comment_approved ) { 312 case '1': 313 $messages[] = __( 'This comment is already approved.' ) . ' <a href="' . esc_url( admin_url( "comment.php?action=editcomment&c=$same" ) ) . '">' . __( 'Edit comment' ) . '</a>'; 314 break; 315 case 'trash': 316 $messages[] = __( 'This comment is already in the Trash.' ) . ' <a href="' . esc_url( admin_url( 'edit-comments.php?comment_status=trash' ) ) . '"> ' . __( 'View Trash' ) . '</a>'; 317 break; 318 case 'spam': 319 $messages[] = __( 'This comment is already marked as spam.' ) . ' <a href="' . esc_url( admin_url( "comment.php?action=editcomment&c=$same" ) ) . '">' . __( 'Edit comment' ) . '</a>'; 320 break; 316 if ( $same > 0 ) { 317 $comment = get_comment( $same ); 318 if ( $comment ) { 319 switch ( $comment->comment_approved ) { 320 case '1': 321 $messages[] = __( 'This comment is already approved.' ) . ' <a href="' . esc_url( admin_url( "comment.php?action=editcomment&c=$same" ) ) . '">' . __( 'Edit comment' ) . '</a>'; 322 break; 323 case 'trash': 324 $messages[] = __( 'This comment is already in the Trash.' ) . ' <a href="' . esc_url( admin_url( 'edit-comments.php?comment_status=trash' ) ) . '"> ' . __( 'View Trash' ) . '</a>'; 325 break; 326 case 'spam': 327 $messages[] = __( 'This comment is already marked as spam.' ) . ' <a href="' . esc_url( admin_url( "comment.php?action=editcomment&c=$same" ) ) . '">' . __( 'Edit comment' ) . '</a>'; 328 break; 329 } 321 330 } 322 331 } -
trunk/src/wp-admin/edit-form-advanced.php
r45437 r45583 41 41 42 42 wp_enqueue_script( 'post' ); 43 $_wp_editor_expand = $_content_editor_dfw = false; 43 44 $_wp_editor_expand = false; 45 $_content_editor_dfw = false; 44 46 45 47 /** … … 107 109 $messages = array(); 108 110 109 $preview_post_link_html = $scheduled_post_link_html = $view_post_link_html = ''; 110 $preview_page_link_html = $scheduled_page_link_html = $view_page_link_html = ''; 111 $preview_post_link_html = ''; 112 $scheduled_post_link_html = ''; 113 $view_post_link_html = ''; 114 115 $preview_page_link_html = ''; 116 $scheduled_page_link_html = ''; 117 $view_page_link_html = ''; 111 118 112 119 $preview_url = get_preview_post_link( $post ); … … 577 584 if ( 'auto-draft' != $post->post_status ) { 578 585 echo '<span id="last-edit">'; 579 if ( $last_user = get_userdata( get_post_meta( $post_ID, '_edit_last', true ) ) ) { 586 $last_user = get_userdata( get_post_meta( $post_ID, '_edit_last', true ) ); 587 if ( $last_user ) { 580 588 /* translators: 1: Name of most recent post author, 2: Post edited date, 3: Post edited time */ 581 589 printf( __( 'Last edited by %1$s on %2$s at %3$s' ), esc_html( $last_user->display_name ), mysql2date( __( 'F j, Y' ), $post->post_modified ), mysql2date( __( 'g:i a' ), $post->post_modified ) ); -
trunk/src/wp-admin/edit.php
r45140 r45583 104 104 switch ( $doaction ) { 105 105 case 'trash': 106 $trashed = $locked = 0; 106 $trashed = 0; 107 $locked = 0; 107 108 108 109 foreach ( (array) $post_ids as $post_id ) { -
trunk/src/wp-admin/import.php
r45440 r45583 102 102 <?php 103 103 foreach ( $importers as $importer_id => $data ) { 104 $plugin_slug = $action = ''; 104 $plugin_slug = ''; 105 $action = ''; 105 106 $is_plugin_installed = false; 106 107 -
trunk/src/wp-admin/includes/ajax-actions.php
r45507 r45583 670 670 $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0; 671 671 672 if ( ! $comment = get_comment( $id ) ) { 672 $comment = get_comment( $id ); 673 if ( ! $comment ) { 673 674 wp_die( time() ); 674 675 } … … 779 780 780 781 check_ajax_referer( "delete-meta_$id" ); 781 if ( ! $meta = get_metadata_by_mid( 'post', $id ) ) { 782 $meta = get_metadata_by_mid( 'post', $id ); 783 if ( ! $meta ) { 782 784 wp_die( 1 ); 783 785 } … … 907 909 $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0; 908 910 909 if ( ! $comment = get_comment( $id ) ) { 911 $comment = get_comment( $id ); 912 if ( ! $comment ) { 910 913 $x = new WP_Ajax_Response( 911 914 array( … … 1011 1014 $tag = wp_insert_term( $_POST['tag-name'], $taxonomy, $_POST ); 1012 1015 1013 if ( ! $tag || is_wp_error( $tag ) || ( ! $tag = get_term( $tag['term_id'], $taxonomy ) ) ) { 1016 if ( $tag && ! is_wp_error( $tag ) ) { 1017 $tag = get_term( $tag['term_id'], $taxonomy ); 1018 } 1019 1020 if ( ! $tag || is_wp_error( $tag ) ) { 1014 1021 $message = __( 'An error has occurred. Please reload the page and try again.' ); 1015 1022 if ( is_wp_error( $tag ) && $tag->get_error_message() ) { … … 1491 1498 } 1492 1499 1493 if ( ! $mid = add_meta( $pid ) ) { 1500 $mid = add_meta( $pid ); 1501 if ( ! $mid ) { 1494 1502 wp_die( __( 'Please provide a custom field value.' ) ); 1495 1503 } … … 1497 1505 wp_die( 0 ); 1498 1506 } 1499 } elseif ( ! $mid = add_meta( $pid ) ) { 1500 wp_die( __( 'Please provide a custom field value.' ) ); 1507 } else { 1508 $mid = add_meta( $pid ); 1509 if ( ! $mid ) { 1510 wp_die( __( 'Please provide a custom field value.' ) ); 1511 } 1501 1512 } 1502 1513 … … 1520 1531 wp_die( __( 'Please provide a custom field name.' ) ); 1521 1532 } 1522 if ( ! $meta = get_metadata_by_mid( 'post', $mid ) ) { 1533 $meta = get_metadata_by_mid( 'post', $mid ); 1534 if ( ! $meta ) { 1523 1535 wp_die( 0 ); // if meta doesn't exist 1524 1536 } … … 1529 1541 } 1530 1542 if ( $meta->meta_value != $value || $meta->meta_key != $key ) { 1531 if ( ! $u = update_metadata_by_mid( 'post', $mid, $value, $key ) ) { 1543 $u = update_metadata_by_mid( 'post', $mid, $value, $key ); 1544 if ( ! $u ) { 1532 1545 wp_die( 0 ); // We know meta exists; we also know it's unchanged (or DB error, in which case there are bigger problems). 1533 1546 } … … 1571 1584 wp_die( -1 ); 1572 1585 } 1573 if ( ! $user_id = edit_user() ) { 1586 $user_id = edit_user(); 1587 if ( ! $user_id ) { 1574 1588 wp_die( 0 ); 1575 1589 } elseif ( is_wp_error( $user_id ) ) { … … 1625 1639 } 1626 1640 1627 if ( ! $user = wp_get_current_user() ) { 1641 $user = wp_get_current_user(); 1642 if ( ! $user ) { 1628 1643 wp_die( -1 ); 1629 1644 } … … 1654 1669 } 1655 1670 1656 if ( ! $user = wp_get_current_user() ) { 1671 $user = wp_get_current_user(); 1672 if ( ! $user ) { 1657 1673 wp_die( -1 ); 1658 1674 } … … 1808 1824 } 1809 1825 1810 if ( ! $user = wp_get_current_user() ) { 1826 $user = wp_get_current_user(); 1827 if ( ! $user ) { 1811 1828 wp_die( -1 ); 1812 1829 } … … 1876 1893 check_ajax_referer( 'inlineeditnonce', '_inline_edit' ); 1877 1894 1878 if ( ! isset( $_POST['post_ID'] ) || ! ( $post_ID = (int) $_POST['post_ID'] )) {1895 if ( ! isset( $_POST['post_ID'] ) || ! (int) $_POST['post_ID'] ) { 1879 1896 wp_die(); 1880 1897 } 1898 1899 $post_ID = (int) $_POST['post_ID']; 1881 1900 1882 1901 if ( 'page' == $_POST['post_type'] ) { … … 1890 1909 } 1891 1910 1892 if ( $last = wp_check_post_lock( $post_ID ) ) { 1911 $last = wp_check_post_lock( $post_ID ); 1912 if ( $last ) { 1893 1913 $last_user = get_userdata( $last ); 1894 1914 $last_user_name = $last_user ? $last_user->display_name : __( 'Someone' ); … … 1992 2012 } 1993 2013 1994 if ( ! isset( $_POST['tax_ID'] ) || ! ( $id = (int) $_POST['tax_ID'] )) {2014 if ( ! isset( $_POST['tax_ID'] ) || ! (int) $_POST['tax_ID'] ) { 1995 2015 wp_die( -1 ); 1996 2016 } 2017 2018 $id = (int) $_POST['tax_ID']; 1997 2019 1998 2020 if ( ! current_user_can( 'edit_term', $id ) ) { … … 2237 2259 } 2238 2260 2239 if ( $form = $wp_registered_widget_controls[ $widget_id ] ) { 2261 $form = $wp_registered_widget_controls[ $widget_id ]; 2262 if ( $form ) { 2240 2263 call_user_func_array( $form['callback'], $form['params'] ); 2241 2264 } … … 2389 2412 } 2390 2413 2391 if ( ! $attachment = wp_prepare_attachment_for_js( $attachment_id ) ) { 2414 $attachment = wp_prepare_attachment_for_js( $attachment_id ); 2415 if ( ! $attachment ) { 2392 2416 wp_die(); 2393 2417 } … … 2599 2623 } 2600 2624 2601 if ( $last_id = get_post_meta( $post_id, '_edit_last', true ) ) { 2625 $last_id = get_post_meta( $post_id, '_edit_last', true ); 2626 if ( $last_id ) { 2602 2627 $last_user = get_userdata( $last_id ); 2603 2628 /* translators: 1: display_name of last user, 2: date of last edit, 3: time of last edit. */ … … 2621 2646 } 2622 2647 $post_id = (int) $_POST['post_ID']; 2623 if ( ! $post = get_post( $post_id ) ) { 2648 $post = get_post( $post_id ); 2649 if ( ! $post ) { 2624 2650 wp_die( 0 ); 2625 2651 } … … 2685 2711 } 2686 2712 2687 if ( ! $id = absint( $_REQUEST['id'] ) ) { 2713 $id = absint( $_REQUEST['id'] ); 2714 if ( ! $id ) { 2688 2715 wp_send_json_error(); 2689 2716 } 2690 2717 2691 if ( ! $post = get_post( $id ) ) { 2718 $post = get_post( $id ); 2719 if ( ! $post ) { 2692 2720 wp_send_json_error(); 2693 2721 } … … 2701 2729 } 2702 2730 2703 if ( ! $attachment = wp_prepare_attachment_for_js( $id ) ) { 2731 $attachment = wp_prepare_attachment_for_js( $id ); 2732 if ( ! $attachment ) { 2704 2733 wp_send_json_error(); 2705 2734 } … … 2787 2816 } 2788 2817 2789 if ( ! $id = absint( $_REQUEST['id'] ) ) { 2818 $id = absint( $_REQUEST['id'] ); 2819 if ( ! $id ) { 2790 2820 wp_send_json_error(); 2791 2821 } … … 2870 2900 } 2871 2901 2872 if ( ! $id = absint( $_REQUEST['id'] ) ) { 2902 $id = absint( $_REQUEST['id'] ); 2903 if ( ! $id ) { 2873 2904 wp_send_json_error(); 2874 2905 } … … 2907 2938 } 2908 2939 2909 if ( ! $attachment = wp_prepare_attachment_for_js( $id ) ) { 2940 $attachment = wp_prepare_attachment_for_js( $id ); 2941 if ( ! $attachment ) { 2910 2942 wp_send_json_error(); 2911 2943 } … … 2924 2956 } 2925 2957 2926 if ( ! $post_id = absint( $_REQUEST['post_id'] ) ) { 2958 $post_id = absint( $_REQUEST['post_id'] ); 2959 if ( ! $post_id ) { 2927 2960 wp_send_json_error(); 2928 2961 } … … 2944 2977 continue; 2945 2978 } 2946 if ( ! $attachment = get_post( $attachment_id ) ) { 2979 $attachment = get_post( $attachment_id ); 2980 if ( ! $attachment ) { 2947 2981 continue; 2948 2982 } … … 2978 3012 $id = intval( $attachment['id'] ); 2979 3013 2980 if ( ! $post = get_post( $id ) ) { 3014 $post = get_post( $id ); 3015 if ( ! $post ) { 2981 3016 wp_send_json_error(); 2982 3017 } … … 2988 3023 if ( current_user_can( 'edit_post', $id ) ) { 2989 3024 // If this attachment is unattached, attach it. Primarily a back compat thing. 2990 if ( 0 == $post->post_parent && $insert_into_post_id = intval( $_POST['post_id'] ) ) { 3025 $insert_into_post_id = intval( $_POST['post_id'] ); 3026 if ( 0 == $post->post_parent && $insert_into_post_id ) { 2991 3027 wp_update_post( 2992 3028 array( … … 3053 3089 check_ajax_referer( 'media-send-to-editor', 'nonce' ); 3054 3090 3055 if ( ! $src = wp_unslash( $_POST['src'] ) ) { 3091 $src = wp_unslash( $_POST['src'] ); 3092 if ( ! $src ) { 3056 3093 wp_send_json_error(); 3057 3094 } … … 3061 3098 } 3062 3099 3063 if ( ! $src = esc_url_raw( $src ) ) { 3100 $src = esc_url_raw( $src ); 3101 if ( ! $src ) { 3064 3102 wp_send_json_error(); 3065 3103 } 3066 3104 3067 if ( ! $link_text = trim( wp_unslash( $_POST['link_text'] ) ) ) { 3105 $link_text = trim( wp_unslash( $_POST['link_text'] ) ); 3106 if ( ! $link_text ) { 3068 3107 $link_text = wp_basename( $src ); 3069 3108 } … … 3088 3127 // Figure out what filter to run: 3089 3128 $type = 'file'; 3090 if ( ( $ext = preg_replace( '/^.+?\.([^.]+)$/', '$1', $src ) ) && ( $ext_type = wp_ext2type( $ext ) ) 3091 && ( 'audio' == $ext_type || 'video' == $ext_type ) ) { 3129 $ext = preg_replace( '/^.+?\.([^.]+)$/', '$1', $src ); 3130 if ( $ext ) { 3131 $ext_type = wp_ext2type( $ext ); 3132 if ( 'audio' == $ext_type || 'video' == $ext_type ) { 3092 3133 $type = $ext_type; 3134 } 3093 3135 } 3094 3136 … … 3111 3153 } 3112 3154 3113 $response = $data = array(); 3155 $response = array(); 3156 $data = array(); 3114 3157 $nonce_state = wp_verify_nonce( $_POST['_nonce'], 'heartbeat-nonce' ); 3115 3158 … … 3193 3236 require ABSPATH . 'wp-admin/includes/revision.php'; 3194 3237 3195 if ( ! $post = get_post( (int) $_REQUEST['post_id'] ) ) { 3238 $post = get_post( (int) $_REQUEST['post_id'] ); 3239 if ( ! $post ) { 3196 3240 wp_send_json_error(); 3197 3241 } … … 3202 3246 3203 3247 // Really just pre-loading the cache here. 3204 if ( ! $revisions = wp_get_post_revisions( $post->ID, array( 'check_enabled' => false ) ) ) { 3248 $revisions = wp_get_post_revisions( $post->ID, array( 'check_enabled' => false ) ); 3249 if ( ! $revisions ) { 3205 3250 wp_send_json_error(); 3206 3251 } -
trunk/src/wp-admin/includes/class-core-upgrader.php
r45262 r45583 285 285 if ( false === WP_AUTO_UPDATE_CORE ) { 286 286 // Defaults to turned off, unless a filter allows it 287 $upgrade_dev = $upgrade_minor = $upgrade_major = false; 287 $upgrade_dev = false; 288 $upgrade_minor = false; 289 $upgrade_major = false; 288 290 } elseif ( true === WP_AUTO_UPDATE_CORE ) { 289 291 // ALL updates for core 290 $upgrade_dev = $upgrade_minor = $upgrade_major = true; 292 $upgrade_dev = true; 293 $upgrade_minor = true; 294 $upgrade_major = true; 291 295 } elseif ( 'minor' === WP_AUTO_UPDATE_CORE ) { 292 296 // Only minor updates for core 293 $upgrade_dev = $upgrade_major =false;297 $upgrade_dev = false; 294 298 $upgrade_minor = true; 299 $upgrade_major = false; 295 300 } 296 301 } -
trunk/src/wp-admin/includes/class-file-upload-upgrader.php
r42343 r45583 100 100 } else { 101 101 // Else, It's set to something, Back compat for plugins using the old (pre-3.3) File_Uploader handler. 102 if ( ! ( ( $uploads = wp_upload_dir() ) && false === $uploads['error'] ) ) { 102 $uploads = wp_upload_dir(); 103 if ( ! ( $uploads && false === $uploads['error'] ) ) { 103 104 wp_die( $uploads['error'] ); 104 105 } -
trunk/src/wp-admin/includes/class-language-pack-upgrader.php
r44676 r45583 333 333 334 334 // Check to see if a .po and .mo exist in the folder. 335 $po = $mo = false; 335 $po = false; 336 $mo = false; 336 337 foreach ( (array) $files as $file => $filedata ) { 337 338 if ( '.po' == substr( $file, -3 ) ) { -
trunk/src/wp-admin/includes/class-theme-upgrader-skin.php
r43598 r45583 42 42 43 43 $update_actions = array(); 44 if ( ! empty( $this->upgrader->result['destination_name'] ) && $theme_info = $this->upgrader->theme_info() ) { 44 $theme_info = $this->upgrader->theme_info(); 45 if ( $theme_info ) { 45 46 $name = $theme_info->display( 'Name' ); 46 47 $stylesheet = $this->upgrader->result['destination_name']; -
trunk/src/wp-admin/includes/class-wp-automatic-updater.php
r45412 r45583 100 100 foreach ( $vcs_dirs as $vcs_dir ) { 101 101 foreach ( $check_dirs as $check_dir ) { 102 if ( $checkout = @is_dir( rtrim( $check_dir, '\\/' ) . "/$vcs_dir" ) ) { 102 $checkout = @is_dir( rtrim( $check_dir, '\\/' ) . "/$vcs_dir" ); 103 if ( $checkout ) { 103 104 break 2; 104 105 } -
trunk/src/wp-admin/includes/class-wp-comments-list-table.php
r44759 r45583 820 820 $pending_comments = $this->pending_count[ $post->ID ]; 821 821 } else { 822 $_pending_count_temp = get_pending_comments_num( array( $post->ID ) ); 823 $pending_comments = $this->pending_count[ $post->ID ] = $_pending_count_temp[ $post->ID ]; 822 $_pending_count_temp = get_pending_comments_num( array( $post->ID ) ); 823 $pending_comments = $_pending_count_temp[ $post->ID ]; 824 $this->pending_count[ $post->ID ] = $pending_comments; 824 825 } 825 826 … … 832 833 833 834 echo '<div class="response-links">'; 834 if ( 'attachment' === $post->post_type && ( $thumb = wp_get_attachment_image( $post->ID, array( 80, 60 ), true ) ) ) { 835 echo $thumb; 835 if ( 'attachment' === $post->post_type ) { 836 $thumb = wp_get_attachment_image( $post->ID, array( 80, 60 ), true ); 837 if ( $thumb ) { 838 echo $thumb; 839 } 836 840 } 837 841 echo $post_link; -
trunk/src/wp-admin/includes/class-wp-filesystem-base.php
r45226 r45583 225 225 return $folder; 226 226 } 227 if ( $return = $this->search_for_folder( $folder ) ) { 227 $return = $this->search_for_folder( $folder ); 228 if ( $return ) { 228 229 $this->cache[ $folder ] = $return; 229 230 } … … 285 286 // Only search for the remaining path tokens in the directory, not the full path again. 286 287 $newfolder = implode( '/', array_slice( $folder_parts, $index + 1 ) ); 287 if ( $ret = $this->search_for_folder( $newfolder, $newdir, $loop ) ) { 288 $ret = $this->search_for_folder( $newfolder, $newdir, $loop ); 289 if ( $ret ) { 288 290 return $ret; 289 291 } … … 399 401 400 402 for ( $i = 0, $c = count( $attarray ); $i < $c; $i++ ) { 401 if ( $key = array_search( $attarray[ $i ], $legal ) ) { 403 $key = array_search( $attarray[ $i ], $legal ); 404 if ( $key ) { 402 405 $realmode .= $legal[ $key ]; 403 406 } -
trunk/src/wp-admin/includes/class-wp-filesystem-ftpext.php
r45424 r45583 591 591 $b['am/pm'] = $lucifer[6]; 592 592 $b['name'] = $lucifer[8]; 593 } elseif ( ! $is_windows && $lucifer = preg_split( '/[ ]/', $line, 9, PREG_SPLIT_NO_EMPTY ) ) { 594 //echo $line."\n"; 595 $lcount = count( $lucifer ); 596 if ( $lcount < 8 ) { 597 return ''; 598 } 599 $b = array(); 600 $b['isdir'] = $lucifer[0]{0} === 'd'; 601 $b['islink'] = $lucifer[0]{0} === 'l'; 602 if ( $b['isdir'] ) { 603 $b['type'] = 'd'; 604 } elseif ( $b['islink'] ) { 605 $b['type'] = 'l'; 606 } else { 607 $b['type'] = 'f'; 608 } 609 $b['perms'] = $lucifer[0]; 610 $b['permsn'] = $this->getnumchmodfromh( $b['perms'] ); 611 $b['number'] = $lucifer[1]; 612 $b['owner'] = $lucifer[2]; 613 $b['group'] = $lucifer[3]; 614 $b['size'] = $lucifer[4]; 615 if ( $lcount == 8 ) { 616 sscanf( $lucifer[5], '%d-%d-%d', $b['year'], $b['month'], $b['day'] ); 617 sscanf( $lucifer[6], '%d:%d', $b['hour'], $b['minute'] ); 618 $b['time'] = @mktime( $b['hour'], $b['minute'], 0, $b['month'], $b['day'], $b['year'] ); 619 $b['name'] = $lucifer[7]; 620 } else { 621 $b['month'] = $lucifer[5]; 622 $b['day'] = $lucifer[6]; 623 if ( preg_match( '/([0-9]{2}):([0-9]{2})/', $lucifer[7], $l2 ) ) { 624 $b['year'] = gmdate( 'Y' ); 625 $b['hour'] = $l2[1]; 626 $b['minute'] = $l2[2]; 593 } elseif ( ! $is_windows ) { 594 $lucifer = preg_split( '/[ ]/', $line, 9, PREG_SPLIT_NO_EMPTY ); 595 if ( $lucifer ) { 596 //echo $line."\n"; 597 $lcount = count( $lucifer ); 598 if ( $lcount < 8 ) { 599 return ''; 600 } 601 $b = array(); 602 $b['isdir'] = $lucifer[0]{0} === 'd'; 603 $b['islink'] = $lucifer[0]{0} === 'l'; 604 if ( $b['isdir'] ) { 605 $b['type'] = 'd'; 606 } elseif ( $b['islink'] ) { 607 $b['type'] = 'l'; 627 608 } else { 628 $b['year'] = $lucifer[7]; 629 $b['hour'] = 0; 630 $b['minute'] = 0; 609 $b['type'] = 'f'; 631 610 } 632 $b['time'] = strtotime( sprintf( '%d %s %d %02d:%02d', $b['day'], $b['month'], $b['year'], $b['hour'], $b['minute'] ) ); 633 $b['name'] = $lucifer[8]; 611 $b['perms'] = $lucifer[0]; 612 $b['permsn'] = $this->getnumchmodfromh( $b['perms'] ); 613 $b['number'] = $lucifer[1]; 614 $b['owner'] = $lucifer[2]; 615 $b['group'] = $lucifer[3]; 616 $b['size'] = $lucifer[4]; 617 if ( $lcount == 8 ) { 618 sscanf( $lucifer[5], '%d-%d-%d', $b['year'], $b['month'], $b['day'] ); 619 sscanf( $lucifer[6], '%d:%d', $b['hour'], $b['minute'] ); 620 $b['time'] = @mktime( $b['hour'], $b['minute'], 0, $b['month'], $b['day'], $b['year'] ); 621 $b['name'] = $lucifer[7]; 622 } else { 623 $b['month'] = $lucifer[5]; 624 $b['day'] = $lucifer[6]; 625 if ( preg_match( '/([0-9]{2}):([0-9]{2})/', $lucifer[7], $l2 ) ) { 626 $b['year'] = gmdate( 'Y' ); 627 $b['hour'] = $l2[1]; 628 $b['minute'] = $l2[2]; 629 } else { 630 $b['year'] = $lucifer[7]; 631 $b['hour'] = 0; 632 $b['minute'] = 0; 633 } 634 $b['time'] = strtotime( sprintf( '%d %s %d %02d:%02d', $b['day'], $b['month'], $b['year'], $b['hour'], $b['minute'] ) ); 635 $b['name'] = $lucifer[8]; 636 } 634 637 } 635 638 } -
trunk/src/wp-admin/includes/class-wp-filesystem-ftpsockets.php
r45226 r45583 137 137 $temp = wp_tempnam( $file ); 138 138 139 if ( ! $temphandle = fopen( $temp, 'w+' ) ) { 139 $temphandle = fopen( $temp, 'w+' ); 140 if ( ! $temphandle ) { 140 141 unlink( $temp ); 141 142 return false; … … 191 192 */ 192 193 public function put_contents( $file, $contents, $mode = false ) { 193 $temp = wp_tempnam( $file ); 194 if ( ! $temphandle = @fopen( $temp, 'w+' ) ) { 194 $temp = wp_tempnam( $file ); 195 $temphandle = @fopen( $temp, 'w+' ); 196 if ( ! $temphandle ) { 195 197 unlink( $temp ); 196 198 return false; -
trunk/src/wp-admin/includes/class-wp-filesystem-ssh2.php
r45424 r45583 222 222 } 223 223 224 if ( ! ( $stream = ssh2_exec( $this->link, $command ) ) ) { 224 $stream = ssh2_exec( $this->link, $command ); 225 if ( ! $stream ) { 225 226 $this->errors->add( 226 227 'command', -
trunk/src/wp-admin/includes/class-wp-importer.php
r42771 r45583 131 131 $blog_id = (int) $blog_id; 132 132 } else { 133 $blog = 'http://' . preg_replace( '#^https?://#', '', $blog_id ); 134 if ( ( ! $parsed = parse_url( $blog ) ) || empty( $parsed['host'] ) ) { 133 $blog = 'http://' . preg_replace( '#^https?://#', '', $blog_id ); 134 $parsed = parse_url( $blog ); 135 if ( ! $parsed || empty( $parsed['host'] ) ) { 135 136 fwrite( STDERR, "Error: can not determine blog_id from $blog_id\n" ); 136 137 exit(); -
trunk/src/wp-admin/includes/class-wp-list-table.php
r44574 r45583 805 805 $total_pages_after = '</span></span>'; 806 806 807 $disable_first = $disable_last = $disable_prev = $disable_next = false; 807 $disable_first = false; 808 $disable_last = false; 809 $disable_prev = false; 810 $disable_next = false; 808 811 809 812 if ( $current == 1 ) { -
trunk/src/wp-admin/includes/class-wp-media-list-table.php
r45147 r45583 378 378 $title = _draft_or_post_title(); 379 379 $thumb = wp_get_attachment_image( $post->ID, array( 60, 60 ), true, array( 'alt' => '' ) ); 380 $link_start = $link_end = ''; 380 $link_start = ''; 381 $link_end = ''; 381 382 382 383 if ( current_user_can( 'edit_post', $post->ID ) && ! $this->is_trash ) { … … 453 454 $m_time = $post->post_date; 454 455 $time = get_post_time( 'G', true, $post, false ); 455 if ( ( abs( $t_diff = time() - $time ) ) < DAY_IN_SECONDS ) { 456 $t_diff = time() - $time; 457 if ( ( abs( $t_diff ) ) < DAY_IN_SECONDS ) { 456 458 if ( $t_diff < 0 ) { 457 459 $h_time = sprintf( __( '%s from now' ), human_time_diff( $time ) ); -
trunk/src/wp-admin/includes/class-wp-ms-sites-list-table.php
r43571 r45583 94 94 if ( ! $s && wp_is_large_network() ) { 95 95 if ( ! isset( $_REQUEST['orderby'] ) ) { 96 $_GET['orderby'] = $_REQUEST['orderby'] = ''; 96 $_GET['orderby'] = ''; 97 $_REQUEST['orderby'] = ''; 97 98 } 98 99 if ( ! isset( $_REQUEST['order'] ) ) { 99 $_GET['order'] = $_REQUEST['order'] = 'DESC'; 100 $_GET['order'] = 'DESC'; 101 $_REQUEST['order'] = 'DESC'; 100 102 } 101 103 } -
trunk/src/wp-admin/includes/class-wp-ms-themes-list-table.php
r43571 r45583 116 116 } 117 117 118 $maybe_update = current_user_can( 'update_themes' ) && ! $this->is_site_themes && $current = get_site_transient( 'update_themes' ); 118 $current = get_site_transient( 'update_themes' ); 119 $maybe_update = current_user_can( 'update_themes' ) && ! $this->is_site_themes && $current; 119 120 120 121 foreach ( (array) $themes['all'] as $key => $theme ) { -
trunk/src/wp-admin/includes/class-wp-ms-users-list-table.php
r45252 r45583 66 66 if ( ! $usersearch && wp_is_large_network( 'users' ) ) { 67 67 if ( ! isset( $_REQUEST['orderby'] ) ) { 68 $_GET['orderby'] = $_REQUEST['orderby'] = 'id'; 68 $_GET['orderby'] = 'id'; 69 $_REQUEST['orderby'] = 'id'; 69 70 } 70 71 if ( ! isset( $_REQUEST['order'] ) ) { 71 $_GET['order'] = $_REQUEST['order'] = 'DESC'; 72 $_GET['order'] = 'DESC'; 73 $_REQUEST['order'] = 'DESC'; 72 74 } 73 75 $args['count_total'] = false; … … 472 474 473 475 if ( current_user_can( 'delete_user', $user->ID ) && ! in_array( $user->user_login, $super_admins ) ) { 474 $actions['delete'] = '<a href="' . $delete =esc_url( network_admin_url( add_query_arg( '_wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), wp_nonce_url( 'users.php', 'deleteuser' ) . '&action=deleteuser&id=' . $user->ID ) ) ) . '" class="delete">' . __( 'Delete' ) . '</a>';476 $actions['delete'] = '<a href="' . esc_url( network_admin_url( add_query_arg( '_wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), wp_nonce_url( 'users.php', 'deleteuser' ) . '&action=deleteuser&id=' . $user->ID ) ) ) . '" class="delete">' . __( 'Delete' ) . '</a>'; 475 477 } 476 478 -
trunk/src/wp-admin/includes/class-wp-posts-list-table.php
r45136 r45583 110 110 } 111 111 112 if ( 'post' === $post_type && $sticky_posts = get_option( 'sticky_posts' ) ) { 112 $sticky_posts = get_option( 'sticky_posts' ); 113 if ( 'post' === $post_type && $sticky_posts ) { 113 114 $sticky_posts = implode( ', ', array_map( 'absint', (array) $sticky_posts ) ); 114 115 $this->sticky_posts_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( 1 ) FROM $wpdb->posts WHERE post_type = %s AND post_status NOT IN ('trash', 'auto-draft') AND ID IN ($sticky_posts)", $post_type ) ); … … 244 245 $url = add_query_arg( $args, 'edit.php' ); 245 246 246 $class_html = $aria_current = ''; 247 $class_html = ''; 248 $aria_current = ''; 247 249 if ( ! empty( $class ) ) { 248 250 $class_html = sprintf( … … 996 998 $locked_text = esc_html( sprintf( __( '%s is currently editing' ), $lock_holder->display_name ) ); 997 999 } else { 998 $locked_avatar = $locked_text = ''; 1000 $locked_avatar = ''; 1001 $locked_text = ''; 999 1002 } 1000 1003 … … 1055 1058 1056 1059 if ( '0000-00-00 00:00:00' === $post->post_date ) { 1057 $t_time = $h_time = __( 'Unpublished' ); 1060 $t_time = __( 'Unpublished' ); 1061 $h_time = $t_time; 1058 1062 $time_diff = 0; 1059 1063 } else { … … 1575 1579 } 1576 1580 1577 if ( $authors = wp_dropdown_users( $users_opt ) ) : 1581 $authors = wp_dropdown_users( $users_opt ); 1582 if ( $authors ) : 1578 1583 $authors_dropdown = '<label class="inline-edit-author">'; 1579 1584 $authors_dropdown .= '<span class="title">' . __( 'Author' ) . '</span>'; -
trunk/src/wp-admin/includes/class-wp-privacy-policy-content.php
r45448 r45583 242 242 } elseif ( $new_data['plugin_name'] === $old_data['plugin_name'] ) { 243 243 // The info for the policy was updated. 244 $checked[] = array(244 $checked[] = array( 245 245 'plugin_name' => $new_data['plugin_name'], 246 246 'policy_text' => $new_data['policy_text'], 247 247 'updated' => $time, 248 248 ); 249 $found = $update_cache = true; 249 $found = true; 250 $update_cache = true; 250 251 } 251 252 … … 379 380 380 381 foreach ( $content_array as $section ) { 381 $class = $meta = $removed = ''; 382 $class = ''; 383 $meta = ''; 384 $removed = ''; 382 385 383 386 if ( ! empty( $section['removed'] ) ) { -
trunk/src/wp-admin/includes/class-wp-screen.php
r45503 r45583 203 203 } 204 204 205 $post_type = $taxonomy = null; 205 $post_type = null; 206 $taxonomy = null; 206 207 $in_admin = false; 207 208 $action = ''; … … 1016 1017 ); 1017 1018 1018 $wrapper_start = $wrapper_end = $form_start = $form_end = ''; 1019 $wrapper_start = ''; 1020 $wrapper_end = ''; 1021 $form_start = ''; 1022 $form_end = ''; 1019 1023 1020 1024 // Output optional wrapper. -
trunk/src/wp-admin/includes/class-wp-terms-list-table.php
r44804 r45583 227 227 $number = $args['number']; 228 228 229 $args['offset'] = $offset = ( $page - 1 ) * $number; 229 $offset = ( $page - 1 ) * $number; 230 $args['offset'] = $offset; 230 231 231 232 // Convert it to table rows. … … 234 235 if ( is_taxonomy_hierarchical( $taxonomy ) && ! isset( $args['orderby'] ) ) { 235 236 // We'll need the full set of terms then. 236 $args['number'] = $args['offset'] = 0; 237 $args['number'] = 0; 238 $args['offset'] = $args['number']; 237 239 } 238 240 $terms = get_terms( $taxonomy, $args ); … … 286 288 // If the page starts in a subtree, print the parents. 287 289 if ( $count == $start && $term->parent > 0 && empty( $_REQUEST['s'] ) ) { 288 $my_parents = $parent_ids = array(); 290 $my_parents = array(); 291 $parent_ids = array(); 289 292 $p = $term->parent; 290 293 while ( $p ) { -
trunk/src/wp-admin/includes/class-wp-themes-list-table.php
r45080 r45583 209 209 unset( $actions['delete'] ); 210 210 211 $screenshot = $theme->get_screenshot(); 211 212 ?> 212 213 213 214 <span class="screenshot hide-if-customize"> 214 <?php if ( $screenshot = $theme->get_screenshot()) : ?>215 <?php if ( $screenshot ) : ?> 215 216 <img src="<?php echo esc_url( $screenshot ); ?>" alt="" /> 216 217 <?php endif; ?> 217 218 </span> 218 219 <a href="<?php echo wp_customize_url( $stylesheet ); ?>" class="screenshot load-customize hide-if-no-customize"> 219 <?php if ( $screenshot = $theme->get_screenshot()) : ?>220 <?php if ( $screenshot ) : ?> 220 221 <img src="<?php echo esc_url( $screenshot ); ?>" alt="" /> 221 222 <?php endif; ?> -
trunk/src/wp-admin/includes/class-wp-upgrader.php
r45262 r45583 186 186 global $wp_filesystem; 187 187 188 if ( false === ( $credentials = $this->skin->request_filesystem_credentials( false, $directories[0], $allow_relaxed_file_ownership ) ) ) { 188 $credentials = $this->skin->request_filesystem_credentials( false, $directories[0], $allow_relaxed_file_ownership ); 189 if ( false === $credentials ) { 189 190 return false; 190 191 } -
trunk/src/wp-admin/includes/comment.php
r42343 r45583 105 105 */ 106 106 function get_comment_to_edit( $id ) { 107 if ( ! $comment = get_comment( $id ) ) { 107 $comment = get_comment( $id ); 108 if ( ! $comment ) { 108 109 return false; 109 110 } -
trunk/src/wp-admin/includes/dashboard.php
r45536 r45583 596 596 echo '<div class="draft-title"><a href="' . esc_url( $url ) . '" aria-label="' . esc_attr( sprintf( __( 'Edit “%s”' ), $title ) ) . '">' . esc_html( $title ) . '</a>'; 597 597 echo '<time datetime="' . get_the_time( 'c', $draft ) . '">' . get_the_time( __( 'F j, Y' ), $draft ) . '</time></div>'; 598 if ( $the_content = wp_trim_words( $draft->post_content, $draft_length ) ) { 598 $the_content = wp_trim_words( $draft->post_content, $draft_length ); 599 if ( $the_content ) { 599 600 echo '<p>' . $the_content . '</p>'; 600 601 } … … 1013 1014 $locale = get_user_locale(); 1014 1015 $cache_key = 'dash_v2_' . md5( $widget_id . '_' . $locale ); 1015 if ( false !== ( $output = get_transient( $cache_key ) ) ) { 1016 $output = get_transient( $cache_key ); 1017 if ( false !== $output ) { 1016 1018 echo $output; 1017 1019 return true; … … 1074 1076 */ 1075 1077 function wp_dashboard_rss_control( $widget_id, $form_inputs = array() ) { 1076 if ( ! $widget_options = get_option( 'dashboard_widget_options' ) ) { 1078 $widget_options = get_option( 'dashboard_widget_options' ); 1079 if ( ! $widget_options ) { 1077 1080 $widget_options = array(); 1078 1081 } … … 1567 1570 $key = md5( $_SERVER['HTTP_USER_AGENT'] ); 1568 1571 1569 if ( false === ( $response = get_site_transient( 'browser_' . $key ) ) ) { 1572 $response = get_site_transient( 'browser_' . $key ); 1573 if ( false === $response ) { 1570 1574 // include an unmodified $wp_version 1571 1575 include( ABSPATH . WPINC . '/version.php' ); -
trunk/src/wp-admin/includes/edit-tag-messages.php
r42343 r45583 50 50 51 51 $message = false; 52 if ( isset( $_REQUEST['message'] ) && ( $msg = (int) $_REQUEST['message'] ) ) { 52 if ( isset( $_REQUEST['message'] ) && (int) $_REQUEST['message'] ) { 53 $msg = (int) $_REQUEST['message']; 53 54 if ( isset( $messages[ $taxonomy ][ $msg ] ) ) { 54 55 $message = $messages[ $taxonomy ][ $msg ]; -
trunk/src/wp-admin/includes/export.php
r45424 r45583 118 118 $join = ''; 119 119 if ( $args['category'] && 'post' == $args['content'] ) { 120 if ( $term = term_exists( $args['category'], 'category' ) ) { 120 $term = term_exists( $args['category'], 'category' ); 121 if ( $term ) { 121 122 $join = "INNER JOIN {$wpdb->term_relationships} ON ({$wpdb->posts}.ID = {$wpdb->term_relationships}.object_id)"; 122 123 $where .= $wpdb->prepare( " AND {$wpdb->term_relationships}.term_taxonomy_id = %d", $term['term_taxonomy_id'] ); … … 145 146 * or all content. 146 147 */ 147 $cats = $tags = $terms = array(); 148 $cats = array(); 149 $tags = array(); 150 $terms = array(); 148 151 if ( isset( $term ) && $term ) { 149 152 $cat = get_term( $term['term_id'], 'category' ); -
trunk/src/wp-admin/includes/file.php
r45580 r45583 822 822 * overriding this one. 823 823 */ 824 if ( ! ( ( $uploads = wp_upload_dir( $time ) ) && false === $uploads['error'] ) ) { 824 $uploads = wp_upload_dir( $time ); 825 if ( ! ( $uploads && false === $uploads['error'] ) ) { 825 826 return call_user_func_array( $upload_error_handler, array( &$file, $uploads['error'] ) ); 826 827 } … … 1252 1253 mbstring_binary_safe_encoding(); 1253 1254 1254 $skipped_key = $skipped_signature = 0; 1255 $skipped_key = 0; 1256 $skipped_signature = 0; 1255 1257 1256 1258 foreach ( (array) $signatures as $signature ) { … … 1433 1435 1434 1436 for ( $i = 0; $i < $z->numFiles; $i++ ) { 1435 if ( ! $info = $z->statIndex( $i ) ) { 1437 $info = $z->statIndex( $i ); 1438 if ( ! $info ) { 1436 1439 return new WP_Error( 'stat_failed_ziparchive', __( 'Could not retrieve file from archive.' ) ); 1437 1440 } … … 1448 1451 $uncompressed_size += $info['size']; 1449 1452 1453 $dirname = dirname( $info['name'] ); 1454 1450 1455 if ( '/' === substr( $info['name'], -1 ) ) { 1451 1456 // Directory. 1452 1457 $needed_dirs[] = $to . untrailingslashit( $info['name'] ); 1453 } elseif ( '.' !== $dirname = dirname( $info['name'] )) {1458 } elseif ( '.' !== $dirname ) { 1454 1459 // Path to a file. 1455 1460 $needed_dirs[] = $to . untrailingslashit( $dirname ); … … 1497 1502 1498 1503 for ( $i = 0; $i < $z->numFiles; $i++ ) { 1499 if ( ! $info = $z->statIndex( $i ) ) { 1504 $info = $z->statIndex( $i ); 1505 if ( ! $info ) { 1500 1506 return new WP_Error( 'stat_failed_ziparchive', __( 'Could not retrieve file from archive.' ) ); 1501 1507 } … … 1830 1836 1831 1837 // Attempt to determine the file owner of the WordPress files, and that of newly created files 1832 $wp_file_owner = $temp_file_owner = false; 1838 $wp_file_owner = false; 1839 $temp_file_owner = false; 1833 1840 if ( function_exists( 'fileowner' ) ) { 1834 1841 $wp_file_owner = @fileowner( __FILE__ ); -
trunk/src/wp-admin/includes/image-edit.php
r45499 r45583 655 655 */ 656 656 function wp_restore_image( $post_id ) { 657 $meta = wp_get_attachment_metadata( $post_id ); 658 $file = get_attached_file( $post_id ); 659 $backup_sizes = $old_backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true ); 660 $restored = false; 661 $msg = new stdClass; 657 $meta = wp_get_attachment_metadata( $post_id ); 658 $file = get_attached_file( $post_id ); 659 $backup_sizes = get_post_meta( $post_id, '_wp_attachment_backup_sizes', true ); 660 $old_backup_sizes = $backup_sizes; 661 $restored = false; 662 $msg = new stdClass; 662 663 663 664 if ( ! is_array( $backup_sizes ) ) { … … 748 749 749 750 $return = new stdClass; 750 $success = $delete = $scaled = $nocrop = false; 751 $success = false; 752 $delete = false; 753 $scaled = false; 754 $nocrop = false; 751 755 $post = get_post( $post_id ); 752 756 … … 875 879 } elseif ( 'thumbnail' == $target ) { 876 880 $sizes = array( 'thumbnail' ); 877 $success = $delete = $nocrop = true; 881 $success = true; 882 $delete = true; 883 $nocrop = true; 878 884 } 879 885 … … 945 951 } else { 946 952 $file_url = wp_get_attachment_url( $post_id ); 947 if ( ! empty( $meta['sizes']['thumbnail'] ) && $thumb = $meta['sizes']['thumbnail'] ) { 953 if ( ! empty( $meta['sizes']['thumbnail'] ) ) { 954 $thumb = $meta['sizes']['thumbnail']; 948 955 $return->thumbnail = path_join( dirname( $file_url ), $thumb['file'] ); 949 956 } else { -
trunk/src/wp-admin/includes/media.php
r45499 r45583 288 288 289 289 $time = current_time( 'mysql' ); 290 if ( $post = get_post( $post_id ) ) { 290 $post = get_post( $post_id ); 291 if ( $post ) { 291 292 // The post date doesn't usually matter for pages, so don't backdate this upload. 292 293 if ( 'page' !== $post->post_type && substr( $post->post_date, 0, 4 ) > 0 ) { … … 370 371 371 372 // Use image exif/iptc data for title and caption defaults if possible. 372 } elseif ( 0 === strpos( $type, 'image/' ) && $image_meta = wp_read_image_metadata( $file ) ) { 373 if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) ) { 374 $title = $image_meta['title']; 375 } 376 377 if ( trim( $image_meta['caption'] ) ) { 378 $excerpt = $image_meta['caption']; 373 } elseif ( 0 === strpos( $type, 'image/' ) ) { 374 $image_meta = wp_read_image_metadata( $file ); 375 if ( $image_meta ) { 376 if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) ) { 377 $title = $image_meta['title']; 378 } 379 380 if ( trim( $image_meta['caption'] ) ) { 381 $excerpt = $image_meta['caption']; 382 } 379 383 } 380 384 } … … 421 425 422 426 $time = current_time( 'mysql' ); 423 if ( $post = get_post( $post_id ) ) { 427 $post = get_post( $post_id ); 428 if ( $post ) { 424 429 if ( substr( $post->post_date, 0, 4 ) > 0 ) { 425 430 $time = $post->post_date; … … 439 444 440 445 // Use image exif/iptc data for title and caption defaults if possible. 441 if ( $image_meta = wp_read_image_metadata( $file ) ) { 446 $image_meta = wp_read_image_metadata( $file ); 447 if ( $image_meta ) { 442 448 if ( trim( $image_meta['title'] ) && ! is_numeric( sanitize_title( $image_meta['title'] ) ) ) { 443 449 $title = $image_meta['title']; … … 693 699 if ( ! empty( $_POST['attachments'] ) ) { 694 700 foreach ( $_POST['attachments'] as $attachment_id => $attachment ) { 695 $post = $_post = get_post( $attachment_id, ARRAY_A ); 701 $post = get_post( $attachment_id, ARRAY_A ); 702 $_post = $post; 696 703 697 704 if ( ! current_user_can( 'edit_post', $attachment_id ) ) { … … 836 843 837 844 $type = 'file'; 838 if ( ( $ext = preg_replace( '/^.+?\.([^.]+)$/', '$1', $src ) ) && ( $ext_type = wp_ext2type( $ext ) ) 839 && ( 'audio' == $ext_type || 'video' == $ext_type ) ) { 845 $ext = preg_replace( '/^.+?\.([^.]+)$/', '$1', $src ); 846 if ( $ext ) { 847 $ext_type = wp_ext2type( $ext ); 848 if ( 'audio' == $ext_type || 'video' == $ext_type ) { 840 849 $type = $ext_type; 850 } 841 851 } 842 852 … … 1441 1451 continue; 1442 1452 } 1443 if ( $item = get_media_item( $id, array( 'errors' => isset( $errors[ $id ] ) ? $errors[ $id ] : null ) ) ) { 1453 $item = get_media_item( $id, array( 'errors' => isset( $errors[ $id ] ) ? $errors[ $id ] : null ) ); 1454 if ( $item ) { 1444 1455 $output .= "\n<div id='media-item-$id' class='media-item child-of-$attachment->post_parent preloaded'><div class='progress hidden'><div class='bar'></div></div><div id='media-upload-error-$id' class='hidden'></div><div class='filename hidden'></div>$item\n</div>"; 1445 1456 } … … 1463 1474 global $redir_tab; 1464 1475 1465 if ( ( $attachment_id = intval( $attachment_id ) ) && $thumb_url = wp_get_attachment_image_src( $attachment_id, 'thumbnail', true ) ) { 1466 $thumb_url = $thumb_url[0]; 1467 } else { 1468 $thumb_url = false; 1476 $thumb_url = false; 1477 $attachment_id = intval( $attachment_id ); 1478 1479 if ( $attachment_id ) { 1480 $thumb_url = wp_get_attachment_image_src( $attachment_id, 'thumbnail', true ); 1481 if ( $thumb_url ) { 1482 $thumb_url = $thumb_url[0]; 1483 } 1469 1484 } 1470 1485 … … 2754 2769 $table_class = ''; 2755 2770 } else { 2756 $view = $table_class = 'not-image'; 2771 $view = 'not-image'; 2772 $table_class = $view; 2757 2773 } 2758 2774 … … 2837 2853 $browser_uploader = admin_url( 'media-new.php?browser-uploader' ); 2838 2854 2839 if ( $post = get_post() ) { 2855 $post = get_post(); 2856 if ( $post ) { 2840 2857 $browser_uploader .= '&post_id=' . intval( $post->ID ); 2841 2858 } elseif ( ! empty( $GLOBALS['post_ID'] ) ) { … … 2877 2894 function media_upload_max_image_resize() { 2878 2895 $checked = get_user_setting( 'upload_resize' ) ? ' checked="true"' : ''; 2879 $a = $end = ''; 2896 $a = ''; 2897 $end = ''; 2880 2898 2881 2899 if ( current_user_can( 'manage_options' ) ) { … … 2920 2938 } 2921 2939 2922 $thumb_url = false; 2923 if ( $attachment_id = intval( $post->ID ) ) { 2940 $thumb_url = false; 2941 $attachment_id = intval( $post->ID ); 2942 if ( $attachment_id ) { 2924 2943 $thumb_url = wp_get_attachment_image_src( $attachment_id, array( 900, 450 ), true ); 2925 2944 } … … 2938 2957 } 2939 2958 2940 $open_style = $not_open_style = ''; 2959 $open_style = ''; 2960 $not_open_style = ''; 2941 2961 if ( $open ) { 2942 2962 $open_style = ' style="display:none"'; … … 3512 3532 if ( isset( $result ) ) { 3513 3533 $location = 'upload.php'; 3514 if ( $referer = wp_get_referer() ) { 3534 $referer = wp_get_referer(); 3535 if ( $referer ) { 3515 3536 if ( false !== strpos( $referer, 'upload.php' ) ) { 3516 3537 $location = remove_query_arg( array( 'attached', 'detach' ), $referer ); -
trunk/src/wp-admin/includes/menu.php
r42343 r45583 44 44 // Create list of page plugin hook names. 45 45 foreach ( $menu as $menu_page ) { 46 if ( false !== $pos = strpos( $menu_page[2], '?' ) ) { 46 $pos = strpos( $menu_page[2], '?' ); 47 if ( false !== $pos ) { 47 48 // Handle post_type=post|page|foo pages. 48 49 $hook_name = substr( $menu_page[2], 0, $pos ); … … 201 202 */ 202 203 function add_menu_classes( $menu ) { 203 $first = $lastorder = false; 204 $i = 0; 205 $mc = count( $menu ); 204 $first = false; 205 $lastorder = false; 206 $i = 0; 207 $mc = count( $menu ); 206 208 foreach ( $menu as $order => $top ) { 207 209 $i++; -
trunk/src/wp-admin/includes/misc.php
r45580 r45583 137 137 138 138 // Split out the existing file into the preceding lines, and those that appear after the marker 139 $pre_lines = $post_lines = $existing_lines = array(); 140 $found_marker = $found_end_marker = false; 139 $pre_lines = array(); 140 $post_lines = array(); 141 $existing_lines = array(); 142 $found_marker = false; 143 $found_end_marker = false; 141 144 foreach ( $lines as $line ) { 142 145 if ( ! $found_marker && false !== strpos( $line, $start_marker ) ) { … … 597 600 check_admin_referer( 'screen-options-nonce', 'screenoptionnonce' ); 598 601 599 if ( ! $user = wp_get_current_user() ) { 602 $user = wp_get_current_user(); 603 if ( ! $user ) { 600 604 return; 601 605 } … … 965 969 if ( array_key_exists( 'wp-check-locked-posts', $data ) && is_array( $data['wp-check-locked-posts'] ) ) { 966 970 foreach ( $data['wp-check-locked-posts'] as $key ) { 967 if ( ! $post_id = absint( substr( $key, 5 ) ) ) { 971 $post_id = absint( substr( $key, 5 ) ); 972 if ( ! $post_id ) { 968 973 continue; 969 974 } 970 975 971 if ( ( $user_id = wp_check_post_lock( $post_id ) ) && ( $user = get_userdata( $user_id ) ) && current_user_can( 'edit_post', $post_id ) ) { 972 $send = array( 'text' => sprintf( __( '%s is currently editing' ), $user->display_name ) ); 973 974 if ( ( $avatar = get_avatar( $user->ID, 18 ) ) && preg_match( "|src='([^']+)'|", $avatar, $matches ) ) { 975 $send['avatar_src'] = $matches[1]; 976 $user_id = wp_check_post_lock( $post_id ); 977 if ( $user_id ) { 978 $user = get_userdata( $user_id ); 979 if ( $user && current_user_can( 'edit_post', $post_id ) ) { 980 $send = array( 'text' => sprintf( __( '%s is currently editing' ), $user->display_name ) ); 981 982 $avatar = get_avatar( $user->ID, 18 ); 983 if ( $avatar && preg_match( "|src='([^']+)'|", $avatar, $matches ) ) { 984 $send['avatar_src'] = $matches[1]; 985 } 986 987 $checked[ $key ] = $send; 976 988 } 977 978 $checked[ $key ] = $send;979 989 } 980 990 } … … 1003 1013 $send = array(); 1004 1014 1005 if ( ! $post_id = absint( $received['post_id'] ) ) { 1015 $post_id = absint( $received['post_id'] ); 1016 if ( ! $post_id ) { 1006 1017 return $response; 1007 1018 } … … 1011 1022 } 1012 1023 1013 if ( ( $user_id = wp_check_post_lock( $post_id ) ) && ( $user = get_userdata( $user_id ) ) ) { 1024 $user_id = wp_check_post_lock( $post_id ); 1025 $user = get_userdata( $user_id ); 1026 if ( $user ) { 1014 1027 $error = array( 1015 1028 'text' => sprintf( __( '%s has taken over and is currently editing.' ), $user->display_name ), 1016 1029 ); 1017 1030 1018 if ( $avatar = get_avatar( $user->ID, 64 ) ) { 1031 $avatar = get_avatar( $user->ID, 64 ); 1032 if ( $avatar ) { 1019 1033 if ( preg_match( "|src='([^']+)'|", $avatar, $matches ) ) { 1020 1034 $error['avatar_src'] = $matches[1]; … … 1024 1038 $send['lock_error'] = $error; 1025 1039 } else { 1026 if ( $new_lock = wp_set_post_lock( $post_id ) ) { 1040 $new_lock = wp_set_post_lock( $post_id ); 1041 if ( $new_lock ) { 1027 1042 $send['new_lock'] = implode( ':', $new_lock ); 1028 1043 } … … 1050 1065 $response['wp-refresh-post-nonces'] = array( 'check' => 1 ); 1051 1066 1052 if ( ! $post_id = absint( $received['post_id'] ) ) { 1067 $post_id = absint( $received['post_id'] ); 1068 if ( ! $post_id ) { 1053 1069 return $response; 1054 1070 } -
trunk/src/wp-admin/includes/ms.php
r45579 r45583 368 368 $id = (int) $id; 369 369 370 if ( ! $user = get_userdata( $id ) ) { 370 $user = get_userdata( $id ); 371 if ( ! $user ) { 371 372 return false; 372 373 } … … 909 910 <table class="form-table" role="presentation"> 910 911 <?php 911 foreach ( ( $allusers = (array) $_POST['allusers'] ) as $user_id ) { 912 $allusers = (array) $_POST['allusers']; 913 foreach ( $allusers as $user_id ) { 912 914 if ( $user_id != '' && $user_id != '0' ) { 913 915 $delete_user = get_userdata( $user_id ); -
trunk/src/wp-admin/includes/nav-menu.php
r44686 r45583 412 412 ); 413 413 414 $most_recent_url = $view_all_url = $search_url = ''; 414 $most_recent_url = ''; 415 $view_all_url = ''; 416 $search_url = ''; 415 417 if ( $nav_menu_selected_id ) { 416 418 $most_recent_url = esc_url( add_query_arg( $post_type_name . '-tab', 'most-recent', remove_query_arg( $removed_args ) ) ); … … 741 743 ); 742 744 743 $most_used_url = $view_all_url = $search_url = ''; 745 $most_used_url = ''; 746 $view_all_url = ''; 747 $search_url = ''; 744 748 if ( $nav_menu_selected_id ) { 745 749 $most_used_url = esc_url( add_query_arg( $taxonomy_name . '-tab', 'most-used', remove_query_arg( $removed_args ) ) ); … … 1028 1032 } 1029 1033 1030 $some_pending_menu_items = $some_invalid_menu_items = false; 1034 $some_pending_menu_items = false; 1035 $some_invalid_menu_items = false; 1031 1036 foreach ( (array) $menu_items as $menu_item ) { 1032 1037 if ( isset( $menu_item->post_status ) && 'draft' == $menu_item->post_status ) { … … 1182 1187 } 1183 1188 } else { 1184 if ( false !== ( $key = array_search( $nav_menu_selected_id, $nav_menu_option['auto_add'] ) ) ) { 1189 $key = array_search( $nav_menu_selected_id, $nav_menu_option['auto_add'] ); 1190 if ( false !== $key ) { 1185 1191 unset( $nav_menu_option['auto_add'][ $key ] ); 1186 1192 } -
trunk/src/wp-admin/includes/network.php
r45416 r45583 83 83 */ 84 84 function get_clean_basedomain() { 85 if ( $existing_domain = network_domain_check() ) { 85 $existing_domain = network_domain_check(); 86 if ( $existing_domain ) { 86 87 return $existing_domain; 87 88 } 88 89 $domain = preg_replace( '|https?://|', '', get_option( 'siteurl' ) ); 89 if ( $slash = strpos( $domain, '/' ) ) { 90 $slash = strpos( $domain, '/' ); 91 if ( $slash ) { 90 92 $domain = substr( $domain, 0, $slash ); 91 93 } … … 186 188 } else { 187 189 $subdomain_install = false; 188 if ( $got_mod_rewrite = got_mod_rewrite() ) { // dangerous assumptions 190 $got_mod_rewrite = got_mod_rewrite(); 191 if ( $got_mod_rewrite ) { // dangerous assumptions 189 192 echo '<div class="updated inline"><p><strong>' . __( 'Note:' ) . '</strong> '; 190 193 /* translators: %s: mod_rewrite */ -
trunk/src/wp-admin/includes/plugin-install.php
r45563 r45583 161 161 162 162 $http_url = $url; 163 if ( $ssl = wp_http_supports( array( 'ssl' ) ) ) { 163 $ssl = wp_http_supports( array( 'ssl' ) ); 164 if ( $ssl ) { 164 165 $url = set_url_scheme( $url, 'https' ); 165 166 } … … 239 240 */ 240 241 function install_popular_tags( $args = array() ) { 241 $key = md5( serialize( $args ) ); 242 if ( false !== ( $tags = get_site_transient( 'poptags_' . $key ) ) ) { 242 $key = md5( serialize( $args ) ); 243 $tags = get_site_transient( 'poptags_' . $key ); 244 if ( false !== $tags ) { 243 245 return $tags; 244 246 } -
trunk/src/wp-admin/includes/plugin.php
r45546 r45583 153 153 // Translate fields 154 154 if ( $translate ) { 155 if ( $textdomain = $plugin_data['TextDomain'] ) { 155 $textdomain = $plugin_data['TextDomain']; 156 if ( $textdomain ) { 156 157 if ( ! is_textdomain_loaded( $textdomain ) ) { 157 158 if ( $plugin_data['DomainPath'] ) { … … 365 366 return $wp_plugins; 366 367 } 367 if ( $plugins_dir = @ opendir( WPMU_PLUGIN_DIR ) ) { 368 $plugins_dir = @opendir( WPMU_PLUGIN_DIR ); 369 if ( $plugins_dir ) { 368 370 while ( ( $file = readdir( $plugins_dir ) ) !== false ) { 369 371 if ( substr( $file, -4 ) == '.php' ) { … … 432 434 433 435 // These exist in the wp-content directory 434 if ( $plugins_dir = @ opendir( WP_CONTENT_DIR ) ) { 436 $plugins_dir = @opendir( WP_CONTENT_DIR ); 437 if ( $plugins_dir ) { 435 438 while ( ( $file = readdir( $plugins_dir ) ) !== false ) { 436 439 if ( isset( $_dropins[ $file ] ) ) { … … 734 737 $network_current = get_site_option( 'active_sitewide_plugins', array() ); 735 738 } 736 $current = get_option( 'active_plugins', array() ); 737 $do_blog = $do_network = false; 739 $current = get_option( 'active_plugins', array() ); 740 $do_blog = false; 741 $do_network = false; 738 742 739 743 foreach ( (array) $plugins as $plugin ) { … … 993 997 994 998 // Remove deleted plugins from the plugin updates list. 995 if ( $current = get_site_transient( 'update_plugins' ) ) { 999 $current = get_site_transient( 'update_plugins' ); 1000 if ( $current ) { 996 1001 // Don't remove the plugins that weren't deleted. 997 1002 $deleted = array_diff( $plugins, $errors ); … … 1820 1825 $hook = get_plugin_page_hook( $plugin_page, $pagenow ); 1821 1826 1822 $parent = $parent1 = get_admin_page_parent(); 1827 $parent = get_admin_page_parent(); 1828 $parent1 = $parent; 1823 1829 1824 1830 if ( empty( $parent ) ) { -
trunk/src/wp-admin/includes/post.php
r45424 r45583 340 340 if ( isset( $post_data['meta'] ) && $post_data['meta'] ) { 341 341 foreach ( $post_data['meta'] as $key => $value ) { 342 if ( ! $meta = get_post_meta_by_id( $key ) ) { 342 $meta = get_post_meta_by_id( $key ); 343 if ( ! $meta ) { 343 344 continue; 344 345 } … … 358 359 if ( isset( $post_data['deletemeta'] ) && $post_data['deletemeta'] ) { 359 360 foreach ( $post_data['deletemeta'] as $key => $value ) { 360 if ( ! $meta = get_post_meta_by_id( $key ) ) { 361 $meta = get_post_meta_by_id( $key ); 362 if ( ! $meta ) { 361 363 continue; 362 364 } … … 532 534 } 533 535 534 if ( isset( $post_data['post_parent'] ) && ( $parent = (int) $post_data['post_parent'] ) ) { 536 if ( isset( $post_data['post_parent'] ) && (int) $post_data['post_parent'] ) { 537 $parent = (int) $post_data['post_parent']; 535 538 $pages = $wpdb->get_results( "SELECT ID, post_parent FROM $wpdb->posts WHERE post_type = 'page'" ); 536 539 $children = array(); … … 548 551 } 549 552 550 $updated = $skipped = $locked = array(); 553 $updated = array(); 554 $skipped = array(); 555 $locked = array(); 551 556 $shared_post_data = $post_data; 552 557 … … 1282 1287 if ( isset( $_GET['edit'] ) && $_GET['edit'] == $box_id ) { 1283 1288 $classes = array( '' ); 1284 } elseif ( $closed = get_user_option( 'closedpostboxes_' . $screen_id ) ) { 1289 } elseif ( get_user_option( 'closedpostboxes_' . $screen_id ) ) { 1290 $closed = get_user_option( 'closedpostboxes_' . $screen_id ); 1285 1291 if ( ! is_array( $closed ) ) { 1286 1292 $classes = array( '' ); … … 1557 1563 */ 1558 1564 function wp_check_post_lock( $post_id ) { 1559 if ( ! $post = get_post( $post_id ) ) { 1565 $post = get_post( $post_id ); 1566 if ( ! $post ) { 1560 1567 return false; 1561 1568 } 1562 1569 1563 if ( ! $lock = get_post_meta( $post->ID, '_edit_lock', true ) ) { 1570 $lock = get_post_meta( $post->ID, '_edit_lock', true ); 1571 if ( ! $lock ) { 1564 1572 return false; 1565 1573 } … … 1593 1601 */ 1594 1602 function wp_set_post_lock( $post_id ) { 1595 if ( ! $post = get_post( $post_id ) ) { 1603 $post = get_post( $post_id ); 1604 if ( ! $post ) { 1596 1605 return false; 1597 1606 } 1598 1607 1599 if ( 0 == ( $user_id = get_current_user_id() ) ) { 1608 $user_id = get_current_user_id(); 1609 if ( 0 == $user_id ) { 1600 1610 return false; 1601 1611 } … … 1616 1626 */ 1617 1627 function _admin_notice_post_locked() { 1618 if ( ! $post = get_post() ) { 1628 $post = get_post(); 1629 if ( ! $post ) { 1619 1630 return; 1620 1631 } 1621 1632 1622 $user = null; 1623 if ( $user_id = wp_check_post_lock( $post->ID ) ) { 1633 $user = null; 1634 $user_id = wp_check_post_lock( $post->ID ); 1635 if ( $user_id ) { 1624 1636 $user = get_userdata( $user_id ); 1625 1637 } … … 1647 1659 } 1648 1660 1649 if ( $locked && ( $sendback = wp_get_referer() ) &&1650 1661 $sendback = wp_get_referer(); 1662 if ( $locked && $sendback && false === strpos( $sendback, 'post.php' ) && false === strpos( $sendback, 'post-new.php' ) ) { 1651 1663 1652 1664 $sendback_text = __( 'Go back' ); … … 1794 1806 1795 1807 // Store one autosave per author. If there is already an autosave, overwrite it. 1796 if ( $old_autosave = wp_get_post_autosave( $post_id, $post_author ) ) { 1808 $old_autosave = wp_get_post_autosave( $post_id, $post_author ); 1809 if ( $old_autosave ) { 1797 1810 $new_autosave = _wp_post_revision_data( $post_data, true ); 1798 1811 $new_autosave['ID'] = $old_autosave->ID; … … 1845 1858 $_POST['ID'] = $post_ID; 1846 1859 1847 if ( ! $post = get_post( $post_ID ) ) { 1860 $post = get_post( $post_ID ); 1861 if ( ! $post ) { 1848 1862 wp_die( __( 'Sorry, you are not allowed to edit this post.' ) ); 1849 1863 } … … 1906 1920 } 1907 1921 1908 $post_id = (int) $post_data['post_id']; 1909 $post_data['ID'] = $post_data['post_ID'] = $post_id; 1922 $post_id = (int) $post_data['post_id']; 1923 $post_data['ID'] = $post_id; 1924 $post_data['post_ID'] = $post_id; 1910 1925 1911 1926 if ( false === wp_verify_nonce( $post_data['_wpnonce'], 'update-post_' . $post_id ) ) { -
trunk/src/wp-admin/includes/revision.php
r43571 r45583 21 21 */ 22 22 function wp_get_revision_ui_diff( $post, $compare_from, $compare_to ) { 23 if ( ! $post = get_post( $post ) ) { 23 $post = get_post( $post ); 24 if ( ! $post ) { 24 25 return false; 25 26 } 26 27 27 28 if ( $compare_from ) { 28 if ( ! $compare_from = get_post( $compare_from ) ) { 29 $compare_from = get_post( $compare_from ); 30 if ( ! $compare_from ) { 29 31 return false; 30 32 } … … 34 36 } 35 37 36 if ( ! $compare_to = get_post( $compare_to ) ) { 38 $compare_to = get_post( $compare_to ); 39 if ( ! $compare_to ) { 37 40 return false; 38 41 } -
trunk/src/wp-admin/includes/taxonomy.php
r42877 r45583 54 54 */ 55 55 function wp_create_category( $cat_name, $parent = 0 ) { 56 if ( $id = category_exists( $cat_name, $parent ) ) { 56 $id = category_exists( $cat_name, $parent ); 57 if ( $id ) { 57 58 return $id; 58 59 } … … 78 79 $cat_ids = array(); 79 80 foreach ( $categories as $category ) { 80 if ( $id = category_exists( $category ) ) { 81 $id = category_exists( $category ); 82 if ( $id ) { 81 83 $cat_ids[] = $id; 82 } elseif ( $id = wp_create_category( $category ) ) { 83 $cat_ids[] = $id; 84 } else { 85 $id = wp_create_category( $category ); 86 if ( $id ) { 87 $cat_ids[] = $id; 88 } 84 89 } 85 90 } … … 301 306 */ 302 307 function wp_create_term( $tag_name, $taxonomy = 'post_tag' ) { 303 if ( $id = term_exists( $tag_name, $taxonomy ) ) { 308 $id = term_exists( $tag_name, $taxonomy ); 309 if ( $id ) { 304 310 return $id; 305 311 } -
trunk/src/wp-admin/includes/template.php
r45403 r45583 1213 1213 1214 1214 // Grab the ones the user has manually sorted. Pull them out of their previous context/priority and into the one the user chose 1215 if ( ! $already_sorted && $sorted = get_user_option( "meta-box-order_$page" ) ) { 1215 $sorted = get_user_option( "meta-box-order_$page" ); 1216 if ( ! $already_sorted && $sorted ) { 1216 1217 foreach ( $sorted as $box_context => $ids ) { 1217 1218 foreach ( explode( ',', $ids ) as $id ) { -
trunk/src/wp-admin/includes/theme-install.php
r44643 r45583 63 63 _deprecated_function( __FUNCTION__, '3.1.0', 'get_theme_feature_list()' ); 64 64 65 if ( ! $cache = get_transient( 'wporg_theme_feature_list' ) ) { 65 $cache = get_transient( 'wporg_theme_feature_list' ); 66 if ( ! $cache ) { 66 67 set_transient( 'wporg_theme_feature_list', array(), 3 * HOUR_IN_SECONDS ); 67 68 } -
trunk/src/wp-admin/includes/theme.php
r45412 r45583 304 304 } 305 305 306 if ( ! $feature_list = get_site_transient( 'wporg_theme_feature_list' ) ) { 306 $feature_list = get_site_transient( 'wporg_theme_feature_list' ); 307 if ( ! $feature_list ) { 307 308 set_site_transient( 'wporg_theme_feature_list', array(), 3 * HOUR_IN_SECONDS ); 308 309 } … … 491 492 492 493 $http_url = $url; 493 if ( $ssl = wp_http_supports( array( 'ssl' ) ) ) { 494 $ssl = wp_http_supports( array( 'ssl' ) ); 495 if ( $ssl ) { 494 496 $url = set_url_scheme( $url, 'https' ); 495 497 } -
trunk/src/wp-admin/includes/translation-install.php
r45412 r45583 36 36 37 37 if ( false === $res ) { 38 $url = $http_url = 'http://api.wordpress.org/translations/' . $type . '/1.0/'; 39 if ( $ssl = wp_http_supports( array( 'ssl' ) ) ) { 38 $url = 'http://api.wordpress.org/translations/' . $type . '/1.0/'; 39 $http_url = $url; 40 $ssl = wp_http_supports( array( 'ssl' ) ); 41 if ( $ssl ) { 40 42 $url = set_url_scheme( $url, 'https' ); 41 43 } … … 118 120 */ 119 121 function wp_get_available_translations() { 120 if ( ! wp_installing() && false !== ( $translations = get_site_transient( 'available_translations' ) ) ) { 121 return $translations; 122 if ( ! wp_installing() ) { 123 $translations = get_site_transient( 'available_translations' ); 124 if ( false !== $translations ) { 125 return $translations; 126 } 122 127 } 123 128 -
trunk/src/wp-admin/includes/update.php
r45529 r45583 117 117 */ 118 118 function get_core_checksums( $version, $locale ) { 119 $url = $http_url = 'http://api.wordpress.org/core/checksums/1.0/?' . http_build_query( compact( 'version', 'locale' ), null, '&' ); 120 121 if ( $ssl = wp_http_supports( array( 'ssl' ) ) ) { 119 $http_url = 'http://api.wordpress.org/core/checksums/1.0/?' . http_build_query( compact( 'version', 'locale' ), null, '&' ); 120 $url = $http_url; 121 122 $ssl = wp_http_supports( array( 'ssl' ) ); 123 if ( $ssl ) { 122 124 $url = set_url_scheme( $url, 'https' ); 123 125 } -
trunk/src/wp-admin/includes/upgrade.php
r45580 r45583 1261 1261 1262 1262 // Associate terms with the same slug in a term group and make slugs unique. 1263 if ( $exists = $wpdb->get_results( $wpdb->prepare( "SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $slug ) ) ) { 1263 $exists = $wpdb->get_results( $wpdb->prepare( "SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $slug ) ); 1264 if ( $exists ) { 1264 1265 $term_group = $exists[0]->term_group; 1265 1266 $id = $exists[0]->term_id; … … 1366 1367 1367 1368 // Associate terms with the same slug in a term group and make slugs unique. 1368 if ( $exists = $wpdb->get_results( $wpdb->prepare( "SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $slug ) ) ) { 1369 $exists = $wpdb->get_results( $wpdb->prepare( "SELECT term_id, term_group FROM $wpdb->terms WHERE slug = %s", $slug ) ); 1370 if ( $exists ) { 1369 1371 $term_group = $exists[0]->term_group; 1370 1372 $term_id = $exists[0]->term_id; … … 1824 1826 } 1825 1827 1826 if ( $wp_current_db_version < 22422 && $term = get_term_by( 'slug', 'post-format-standard', 'post_format' ) ) { 1827 wp_delete_term( $term->term_id, 'post_format' ); 1828 if ( $wp_current_db_version < 22422 ) { 1829 $term = get_term_by( 'slug', 'post-format-standard', 'post_format' ); 1830 if ( $term ) { 1831 wp_delete_term( $term->term_id, 'post_format' ); 1832 } 1828 1833 } 1829 1834 } … … 2431 2436 global $wpdb; 2432 2437 $all_options = new stdClass; 2433 if ( $options = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" ) ) { 2438 $options = $wpdb->get_results( "SELECT option_name, option_value FROM $wpdb->options" ); 2439 if ( $options ) { 2434 2440 foreach ( $options as $option ) { 2435 2441 if ( 'siteurl' == $option->option_name || 'home' == $option->option_name || 'category_base' == $option->option_name ) { … … 2608 2614 2609 2615 // Clear the field and index arrays. 2610 $cfields = $indices = $indices_without_subparts = array(); 2616 $cfields = array(); 2617 $indices = array(); 2618 $indices_without_subparts = array(); 2611 2619 2612 2620 // Get all of the field names in the query from between the parentheses. … … 2683 2691 2684 2692 // Parse the columns. Multiple columns are separated by a comma. 2685 $index_columns = $index_columns_without_subparts = array_map( 'trim', explode( ',', $index_matches['index_columns'] ) ); 2693 $index_columns = array_map( 'trim', explode( ',', $index_matches['index_columns'] ) ); 2694 $index_columns_without_subparts = $index_columns; 2686 2695 2687 2696 // Normalize columns. … … 2853 2862 2854 2863 // Check if the index definition exists, ignoring subparts. 2855 if ( ! ( ( $aindex = array_search( $index_string, $indices_without_subparts ) ) === false ) ) { 2864 $aindex = array_search( $index_string, $indices_without_subparts ); 2865 if ( false !== $aindex ) { 2856 2866 // If the index already exists (even with different subparts), we don't need to create it. 2857 2867 unset( $indices_without_subparts[ $aindex ] ); -
trunk/src/wp-admin/includes/user.php
r45448 r45583 45 45 } 46 46 47 $pass1 = $pass2 = ''; 47 $pass1 = ''; 48 $pass2 = ''; 48 49 if ( isset( $_POST['pass1'] ) ) { 49 50 $pass1 = $_POST['pass1']; … … 202 203 } elseif ( ! is_email( $user->user_email ) ) { 203 204 $errors->add( 'invalid_email', __( '<strong>ERROR</strong>: The email address isn’t correct.' ), array( 'form-field' => 'email' ) ); 204 } elseif ( ( $owner_id = email_exists( $user->user_email ) ) && ( ! $update || ( $owner_id != $user->ID ) ) ) { 205 $errors->add( 'email_exists', __( '<strong>ERROR</strong>: This email is already registered, please choose another one.' ), array( 'form-field' => 'email' ) ); 205 } else { 206 $owner_id = email_exists( $user->user_email ); 207 if ( $owner_id && ( ! $update || ( $owner_id != $user->ID ) ) ) { 208 $errors->add( 'email_exists', __( '<strong>ERROR</strong>: This email is already registered, please choose another one.' ), array( 'form-field' => 'email' ) ); 209 } 206 210 } 207 211 -
trunk/src/wp-admin/includes/widgets.php
r43571 r45583 300 300 301 301 <div class="widget-description"> 302 <?php echo ( $widget_description = wp_widget_description( $widget_id ) ) ? "$widget_description\n" : "$widget_title\n"; ?> 302 <?php 303 $widget_description = wp_widget_description( $widget_id ); 304 echo ( $widget_description ) ? "$widget_description\n" : "$widget_title\n"; 305 ?> 303 306 </div> 304 307 <?php -
trunk/src/wp-admin/install.php
r45403 r45583 308 308 switch ( $step ) { 309 309 case 0: // Step 0 310 if ( wp_can_install_language_pack() && empty( $language ) && ( $languages = wp_get_available_translations() ) ) { 311 $scripts_to_print[] = 'language-chooser'; 312 display_header( 'language-chooser' ); 313 echo '<form id="setup" method="post" action="?step=1">'; 314 wp_install_language_form( $languages ); 315 echo '</form>'; 316 break; 310 if ( wp_can_install_language_pack() && empty( $language ) ) { 311 $languages = wp_get_available_translations(); 312 if ( $languages ) { 313 $scripts_to_print[] = 'language-chooser'; 314 display_header( 'language-chooser' ); 315 echo '<form id="setup" method="post" action="?step=1">'; 316 wp_install_language_form( $languages ); 317 echo '</form>'; 318 break; 319 } 317 320 } 318 321 -
trunk/src/wp-admin/link-manager.php
r45382 r45583 45 45 $wp_list_table->prepare_items(); 46 46 47 $title = __( 'Links' ); 48 $this_file = $parent_file = 'link-manager.php'; 47 $title = __( 'Links' ); 48 $this_file = 'link-manager.php'; 49 $parent_file = $this_file; 49 50 50 51 get_current_screen()->add_help_tab( -
trunk/src/wp-admin/link.php
r42343 r45583 113 113 $link_id = (int) $_GET['link_id']; 114 114 115 if ( ! $link = get_link_to_edit( $link_id ) ) { 115 $link = get_link_to_edit( $link_id ); 116 if ( ! $link ) { 116 117 wp_die( __( 'Link not found.' ) ); 117 118 } -
trunk/src/wp-admin/media.php
r45437 r45583 28 28 if ( empty( $errors ) ) { 29 29 $location = 'media.php'; 30 if ( $referer = wp_get_original_referer() ) { 30 $referer = wp_get_original_referer(); 31 if ( $referer ) { 31 32 if ( false !== strpos( $referer, 'upload.php' ) || ( url_to_postid( $referer ) == $attachment_id ) ) { 32 33 $location = $referer; -
trunk/src/wp-admin/menu-header.php
r44331 r45583 109 109 $class = $class ? ' class="' . join( ' ', $class ) . '"' : ''; 110 110 $id = ! empty( $item[5] ) ? ' id="' . preg_replace( '|[^a-zA-Z0-9_:.]|', '-', $item[5] ) . '"' : ''; 111 $img = $img_style = ''; 111 $img = ''; 112 $img_style = ''; 112 113 $img_class = ' dashicons-before'; 113 114 … … 153 154 $menu_hook = get_plugin_page_hook( $submenu_items[0][2], $item[2] ); 154 155 $menu_file = $submenu_items[0][2]; 155 if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) { 156 $pos = strpos( $menu_file, '?' ); 157 if ( false !== $pos ) { 156 158 $menu_file = substr( $menu_file, 0, $pos ); 157 159 } … … 165 167 $menu_hook = get_plugin_page_hook( $item[2], 'admin.php' ); 166 168 $menu_file = $item[2]; 167 if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) { 169 $pos = strpos( $menu_file, '?' ); 170 if ( false !== $pos ) { 168 171 $menu_file = substr( $menu_file, 0, $pos ); 169 172 } … … 197 200 $menu_file = $item[2]; 198 201 199 if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) { 202 $pos = strpos( $menu_file, '?' ); 203 if ( false !== $pos ) { 200 204 $menu_file = substr( $menu_file, 0, $pos ); 201 205 } … … 227 231 $menu_hook = get_plugin_page_hook( $sub_item[2], $item[2] ); 228 232 $sub_file = $sub_item[2]; 229 if ( false !== ( $pos = strpos( $sub_file, '?' ) ) ) { 233 $pos = strpos( $sub_file, '?' ); 234 if ( false !== $pos ) { 230 235 $sub_file = substr( $sub_file, 0, $pos ); 231 236 } -
trunk/src/wp-admin/options-general.php
r45556 r45583 74 74 <?php 75 75 if ( ! is_multisite() ) { 76 $wp_site_url_class = $wp_home_class = ''; 76 $wp_site_url_class = ''; 77 $wp_home_class = ''; 77 78 if ( defined( 'WP_SITEURL' ) ) { 78 79 $wp_site_url_class = ' disabled'; -
trunk/src/wp-admin/options-permalink.php
r45424 r45583 58 58 $permalink_structure = get_option( 'permalink_structure' ); 59 59 60 $prefix = $blog_prefix = ''; 60 $prefix = ''; 61 $blog_prefix = ''; 61 62 if ( ! got_url_rewrite() ) { 62 63 $prefix = '/index.php'; -
trunk/src/wp-admin/options.php
r45439 r45583 81 81 } 82 82 83 $whitelist_options = array(83 $whitelist_options = array( 84 84 'general' => array( 85 85 'blogname', … … 147 147 ), 148 148 ); 149 $whitelist_options['misc'] = $whitelist_options['options'] = $whitelist_options['privacy'] = array(); 149 $whitelist_options['misc'] = array(); 150 $whitelist_options['options'] = array(); 151 $whitelist_options['privacy'] = array(); 150 152 151 153 $mail_options = array( 'mailserver_url', 'mailserver_port', 'mailserver_login', 'mailserver_pass' ); -
trunk/src/wp-admin/plugins.php
r45432 r45583 292 292 293 293 if ( '.' == $plugin_slug ) { 294 if ( $data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ) ) { 294 $data = get_plugin_data( WP_PLUGIN_DIR . '/' . $plugin ); 295 if ( $data ) { 295 296 $plugin_info[ $plugin ] = $data; 296 297 $plugin_info[ $plugin ]['is_uninstallable'] = is_uninstallable_plugin( $plugin ); … … 301 302 } else { 302 303 // Get plugins list from that folder. 303 if ( $folder_plugins = get_plugins( '/' . $plugin_slug ) ) { 304 $folder_plugins = get_plugins( '/' . $plugin_slug ); 305 if ( $folder_plugins ) { 304 306 foreach ( $folder_plugins as $plugin_file => $data ) { 305 307 $plugin_info[ $plugin_file ] = _get_plugin_data_markup_translate( $plugin_file, $data ); -
trunk/src/wp-admin/post.php
r44726 r45583 20 20 wp_die( __( 'A post ID mismatch has been detected.' ), __( 'Sorry, you are not allowed to edit this item.' ), 400 ); 21 21 } elseif ( isset( $_GET['post'] ) ) { 22 $post_id = $post_ID =(int) $_GET['post'];22 $post_id = (int) $_GET['post']; 23 23 } elseif ( isset( $_POST['post_ID'] ) ) { 24 $post_id = $post_ID =(int) $_POST['post_ID'];24 $post_id = (int) $_POST['post_ID']; 25 25 } else { 26 $post_id = $post_ID = 0; 27 } 26 $post_id = 0; 27 } 28 $post_ID = $post_id; 28 29 29 30 /** … … 242 243 } 243 244 244 if ( $user_id = wp_check_post_lock( $post_id ) ) { 245 $user_id = wp_check_post_lock( $post_id ); 246 if ( $user_id ) { 245 247 $user = get_userdata( $user_id ); 246 248 wp_die( sprintf( __( 'You cannot move this item to the Trash. %s is currently editing.' ), $user->display_name ) ); -
trunk/src/wp-admin/revision.php
r45140 r45583 34 34 switch ( $action ) { 35 35 case 'restore': 36 if ( ! $revision = wp_get_post_revision( $revision_id ) ) { 36 $revision = wp_get_post_revision( $revision_id ); 37 if ( ! $revision ) { 37 38 break; 38 39 } … … 42 43 } 43 44 44 if ( ! $post = get_post( $revision->post_parent ) ) { 45 $post = get_post( $revision->post_parent ); 46 if ( ! $post ) { 45 47 break; 46 48 } … … 71 73 case 'edit': 72 74 default: 73 if ( ! $revision = wp_get_post_revision( $revision_id ) ) { 75 $revision = wp_get_post_revision( $revision_id ); 76 if ( ! $revision ) { 74 77 break; 75 78 } 76 if ( ! $post = get_post( $revision->post_parent ) ) { 79 80 $post = get_post( $revision->post_parent ); 81 if ( ! $post ) { 77 82 break; 78 83 } … … 111 116 // This is so that the correct "Edit" menu item is selected. 112 117 if ( ! empty( $post->post_type ) && 'post' != $post->post_type ) { 113 $parent_file = $submenu_file ='edit.php?post_type=' . $post->post_type;118 $parent_file = 'edit.php?post_type=' . $post->post_type; 114 119 } else { 115 $parent_file = $submenu_file ='edit.php';120 $parent_file = 'edit.php'; 116 121 } 122 $submenu_file = $parent_file; 117 123 118 124 wp_enqueue_script( 'revisions' ); -
trunk/src/wp-admin/setup-config.php
r45433 r45583 127 127 switch ( $step ) { 128 128 case -1: 129 if ( wp_can_install_language_pack() && empty( $language ) && ( $languages = wp_get_available_translations() ) ) { 130 setup_config_display_header( 'language-chooser' ); 131 echo '<h1 class="screen-reader-text">Select a default language</h1>'; 132 echo '<form id="setup" method="post" action="?step=0">'; 133 wp_install_language_form( $languages ); 134 echo '</form>'; 135 break; 129 if ( wp_can_install_language_pack() && empty( $language ) ) { 130 $languages = wp_get_available_translations(); 131 if ( $languages ) { 132 setup_config_display_header( 'language-chooser' ); 133 echo '<h1 class="screen-reader-text">Select a default language</h1>'; 134 echo '<form id="setup" method="post" action="?step=0">'; 135 wp_install_language_form( $languages ); 136 echo '</form>'; 137 break; 138 } 136 139 } 137 140 -
trunk/src/wp-admin/theme-editor.php
r45431 r45583 74 74 } 75 75 76 $allowed_files = $style_files = array(); 76 $allowed_files = array(); 77 $style_files = array(); 77 78 $has_templates = false; 78 79 -
trunk/src/wp-admin/themes.php
r45140 r45583 269 269 } 270 270 271 if ( false !== ( $pos = strpos( $menu_file, '?' ) ) ) { 271 $pos = strpos( $menu_file, '?' ); 272 if ( false !== $pos ) { 272 273 $menu_file = substr( $menu_file, 0, $pos ); 273 274 } … … 369 370 <?php 370 371 // List broken themes, if any. 371 if ( ! is_multisite() && current_user_can( 'edit_themes' ) && $broken_themes = wp_get_themes( array( 'errors' => true ) ) ) { 372 $broken_themes = wp_get_themes( array( 'errors' => true ) ); 373 if ( ! is_multisite() && current_user_can( 'edit_themes' ) && $broken_themes ) { 372 374 ?> 373 375 -
trunk/src/wp-admin/update-core.php
r45532 r45583 36 36 static $first_pass = true; 37 37 38 $wp_version = get_bloginfo( 'version' ); 38 $wp_version = get_bloginfo( 'version' ); 39 $version_string = sprintf( '%s–<strong>%s</strong>', $update->current, $update->locale ); 39 40 40 41 if ( 'en_US' == $update->locale && 'en_US' == get_locale() ) { 41 42 $version_string = $update->current; 42 } elseif ( 'en_US' == $update->locale && $update->packages->partial && $wp_version == $update->partial_version && ( $updates = get_core_updates() ) && 1 == count( $updates ) ) { 43 // If the only available update is a partial builds, it doesn't need a language-specific version string. 44 $version_string = $update->current; 45 } else { 46 $version_string = sprintf( '%s–<strong>%s</strong>', $update->current, $update->locale ); 43 } elseif ( 'en_US' == $update->locale && $update->packages->partial && $wp_version == $update->partial_version ) { 44 $updates = get_core_updates(); 45 if ( $updates && 1 == count( $updates ) ) { 46 // If the only available update is a partial builds, it doesn't need a language-specific version string. 47 $version_string = $update->current; 48 } 47 49 } 48 50 … … 538 540 <?php 539 541 540 if ( false === ( $credentials = request_filesystem_credentials( $url, '', false, ABSPATH, array( 'version', 'locale' ), $allow_relaxed_file_ownership ) ) ) { 542 $credentials = request_filesystem_credentials( $url, '', false, ABSPATH, array( 'version', 'locale' ), $allow_relaxed_file_ownership ); 543 if ( false === $credentials ) { 541 544 echo '</div>'; 542 545 return; -
trunk/src/wp-admin/upload.php
r45140 r45583 131 131 132 132 $location = 'upload.php'; 133 if ( $referer = wp_get_referer() ) { 133 $referer = wp_get_referer(); 134 if ( $referer ) { 134 135 if ( false !== strpos( $referer, 'upload.php' ) ) { 135 136 $location = remove_query_arg( array( 'trashed', 'untrashed', 'deleted', 'message', 'ids', 'posted' ), $referer ); … … 287 288 } 288 289 289 if ( ! empty( $_GET['attached'] ) && $attached = absint( $_GET['attached'] ) ) { 290 if ( ! empty( $_GET['attached'] ) && absint( $_GET['attached'] ) ) { 291 $attached = absint( $_GET['attached'] ); 290 292 if ( 1 == $attached ) { 291 293 $message = __( 'Media file attached.' ); … … 298 300 } 299 301 300 if ( ! empty( $_GET['detach'] ) && $detached = absint( $_GET['detach'] ) ) { 302 if ( ! empty( $_GET['detach'] ) && absint( $_GET['detach'] ) ) { 303 $detached = absint( $_GET['detach'] ); 301 304 if ( 1 == $detached ) { 302 305 $message = __( 'Media file detached.' ); … … 309 312 } 310 313 311 if ( ! empty( $_GET['deleted'] ) && $deleted = absint( $_GET['deleted'] ) ) { 314 if ( ! empty( $_GET['deleted'] ) && absint( $_GET['deleted'] ) ) { 315 $deleted = absint( $_GET['deleted'] ); 312 316 if ( 1 == $deleted ) { 313 317 $message = __( 'Media file permanently deleted.' ); … … 320 324 } 321 325 322 if ( ! empty( $_GET['trashed'] ) && $trashed = absint( $_GET['trashed'] ) ) { 326 if ( ! empty( $_GET['trashed'] ) && absint( $_GET['trashed'] ) ) { 327 $trashed = absint( $_GET['trashed'] ); 323 328 if ( 1 == $trashed ) { 324 329 $message = __( 'Media file moved to the trash.' ); … … 332 337 } 333 338 334 if ( ! empty( $_GET['untrashed'] ) && $untrashed = absint( $_GET['untrashed'] ) ) { 339 if ( ! empty( $_GET['untrashed'] ) && absint( $_GET['untrashed'] ) ) { 340 $untrashed = absint( $_GET['untrashed'] ); 335 341 if ( 1 == $untrashed ) { 336 342 $message = __( 'Media file restored from the trash.' ); -
trunk/src/wp-admin/user-edit.php
r45416 r45583 603 603 * @param WP_User $profileuser User object for the current user to edit. 604 604 */ 605 if ( $show_password_fields = apply_filters( 'show_password_fields', true, $profileuser ) ) : 605 $show_password_fields = apply_filters( 'show_password_fields', true, $profileuser ); 606 if ( $show_password_fields ) : 606 607 ?> 607 608 </table> -
trunk/src/wp-admin/users.php
r45542 r45583 486 486 $message = __( 'New user created.' ); 487 487 488 if ( isset( $_GET['id'] ) && ( $user_id = $_GET['id'] ) && current_user_can( 'edit_user', $user_id ) ) { 488 $user_id = isset( $_GET['id'] ) ? $_GET['id'] : false; 489 if ( $user_id && current_user_can( 'edit_user', $user_id ) ) { 489 490 $message .= sprintf( 490 491 ' <a href="%s">%s</a>', -
trunk/src/wp-admin/widgets.php
r45140 r45583 255 255 $multi_number = (int) $_GET['num']; 256 256 $control['params'][0]['number'] = -1; 257 $widget_id = $control['id'] = $control['id_base'] . '-' . $multi_number; 257 $control['id'] = $control['id_base'] . '-' . $multi_number; 258 $widget_id = $control['id']; 258 259 $wp_registered_widget_controls[ $control['id'] ] = $control; 259 260 break; … … 499 500 <?php 500 501 501 $i = $split = 0; 502 $i = 0; 503 $split = 0; 502 504 $single_sidebar_class = ''; 503 505 $sidebars_count = count( $theme_sidebars );
Note: See TracChangeset
for help on using the changeset viewer.