Making WordPress.org


Ignore:
Timestamp:
03/21/2019 10:22:37 PM (6 years ago)
Author:
coffee2code
Message:

Developer: Handle exception to deprecated item that refers to an externally-linked resource as its preferred alternative.

Specifically, debug_fwrite() had been deprecated in favor of PHP's error_log(). In every other case, the implicit assumption is that the preferred alternative is another WP resource.

Props rahmohn, coffee2code.
Fixes #4310.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/inc/template-tags.php

    r7754 r8487  
    10631063                    $refers .= '()';
    10641064                }
     1065
     1066                // Exceptions for externally-linked elements.
     1067                $exceptions = [
     1068                    'error_log()' => 'https://secure.php.net/manual/en/function.error-log.php',
     1069                ];
     1070                if ( ! empty( $exceptions[ $refers ] ) ) {
     1071                    $link_to = \DevHub_Formatting::generate_link( $exceptions[ $refers ], $refers );
     1072                }
     1073                // Else internally-link the element.
     1074                else {
     1075                    $link_to = \DevHub_Formatting::link_internal_element( $refers );
     1076                }
     1077
    10651078                /* translators: %s: Linked internal element name */
    1066                 $deprecation_info = ' ' . sprintf( __( 'Use %s instead.', 'wporg' ), \DevHub_Formatting::link_internal_element( $refers ) );
     1079                $deprecation_info = ' ' . sprintf( __( 'Use %s instead.', 'wporg' ), $link_to );
    10671080            }
    10681081        }
Note: See TracChangeset for help on using the changeset viewer.