Make WordPress Core

Changeset 53450


Ignore:
Timestamp:
05/29/2022 03:33:12 PM (2 years ago)
Author:
SergeyBiryukov
Message:

Docs: Explicitly declare some globals for clarity.

This aims to improve developer experience by making it clear that these variables are defined elsewhere.

Props ravipatel, davidbaumwald, hellofromTonya, costdev, SergeyBiryukov.
Fixes #51439.

Location:
trunk/src/wp-admin
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/edit-comments.php

    r51975 r53450  
    2626
    2727    if ( 'delete_all' === $doaction && ! empty( $_REQUEST['pagegen_timestamp'] ) ) {
     28        /**
     29         * @global wpdb $wpdb WordPress database abstraction object.
     30         */
     31        global $wpdb;
     32
    2833        $comment_status = wp_unslash( $_REQUEST['comment_status'] );
    2934        $delete_time    = wp_unslash( $_REQUEST['pagegen_timestamp'] );
     
    135140wp_enqueue_script( 'admin-comments' );
    136141enqueue_comment_hotkeys_js();
     142
     143/**
     144 * @global int $post_id
     145 */
     146global $post_id;
    137147
    138148if ( $post_id ) {
  • trunk/src/wp-admin/edit-form-comment.php

    r51080 r53450  
    1111    die( '-1' );
    1212}
     13
     14/**
     15 * @global WP_Comment $comment Global comment object.
     16 */
     17global $comment;
    1318?>
    1419<form name="post" action="comment.php" method="post" id="post">
     
    140145<fieldset id='timestampdiv' class='hide-if-js'>
    141146<legend class="screen-reader-text"><?php _e( 'Date and time' ); ?></legend>
    142 <?php touch_time( ( 'editcomment' === $action ), 0 ); ?>
     147<?php
     148/**
     149 * @global string $action
     150 */
     151global $action;
     152
     153touch_time( ( 'editcomment' === $action ), 0 );
     154?>
    143155</fieldset>
    144156</div>
  • trunk/src/wp-admin/edit.php

    r51850 r53450  
    99/** WordPress Administration Bootstrap */
    1010require_once __DIR__ . '/admin.php';
     11
     12/**
     13 * @global string $typenow The post type of the current screen.
     14 */
     15global $typenow;
    1116
    1217if ( ! $typenow ) {
     
    8893        // Validate the post status exists.
    8994        if ( get_post_status_object( $post_status ) ) {
     95            /**
     96             * @global wpdb $wpdb WordPress database abstraction object.
     97             */
     98            global $wpdb;
     99
    90100            $post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type=%s AND post_status = %s", $post_type, $post_status ) );
    91101        }
  • trunk/src/wp-admin/install.php

    r53426 r53450  
    226226 * @global string $required_php_version   The required PHP version string.
    227227 * @global string $required_mysql_version The required MySQL version string.
    228  */
    229 global $wp_version, $required_php_version, $required_mysql_version;
     228 * @global wpdb   $wpdb                   WordPress database abstraction object.
     229 */
     230global $wp_version, $required_php_version, $required_mysql_version, $wpdb;
    230231
    231232$php_version   = PHP_VERSION;
  • trunk/src/wp-admin/upgrade.php

    r53426 r53450  
    4040 * @global string $required_php_version   The required PHP version string.
    4141 * @global string $required_mysql_version The required MySQL version string.
     42 * @global wpdb   $wpdb                   WordPress database abstraction object.
    4243 */
    43 global $wp_version, $required_php_version, $required_mysql_version;
     44global $wp_version, $required_php_version, $required_mysql_version, $wpdb;
    4445
    4546$step = (int) $step;
Note: See TracChangeset for help on using the changeset viewer.