Making WordPress.org


Ignore:
Timestamp:
08/12/2021 06:54:30 AM (5 years ago)
Author:
dd32
Message:

Theme Directory: Guard against undefined constants closer to where they're used.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/theme-directory/rest-api/class-themes-auto-review.php

    r10843 r11175  
    124124         */
    125125        public function update_item( $request ) {
     126                if ( ! defined( 'THEME_TRACBOT_PASSWORD' ) || ! THEME_TRACBOT_PASSWORD ) {
     127                        return new \WP_Error(
     128                                'rest_error_updating_ticket',
     129                                __( 'Unable to locate ticket.', 'wporg-themes' ),
     130                                array( 'status' => \WP_Http::INTERNAL_SERVER_ERROR )
     131                        );
     132                }
     133
    126134                if ( ! class_exists( 'Trac' ) ) {
    127135                        require_once ABSPATH . WPINC . '/class-IXR.php';
     
    137145                $ticket = $trac_instance->ticket_get( $ticket_id );
    138146
    139                 if( ! $ticket ){
     147                if ( ! $ticket ) {
    140148                        return new \WP_Error(
    141149                                'rest_invalid_ticket',
     
    147155                $body = $request->get_body();
    148156
    149                 if( empty( $body ) ) {
     157                if ( empty( $body ) ) {
    150158                        return new \WP_Error(
    151159                                'rest_error_updating_ticket',
     
    159167                $updated_ticket = $trac_instance->ticket_update( $ticket_id, $content, [], false );
    160168
    161                 if( ! $updated_ticket ) {
     169                if ( ! $updated_ticket ) {
    162170                        return new \WP_Error(
    163171                                'rest_error_updating_ticket',
Note: See TracChangeset for help on using the changeset viewer.