Plugin Directory

Changeset 3052698


Ignore:
Timestamp:
03/17/2024 02:33:03 PM (2 years ago)
Author:
stephend
Message:

Add strict checks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • smart-app-banner/trunk/wsl-smart-app-banner.php

    r3052694 r3052698  
    6666    }
    6767
    68     if ( ( is_null( $app_id_list ) || '' == $app_id ) &&
    69         ( is_front_page() || get_option( 'wsl_global_banner' ) == 'Yes' ) ) {
     68    if ( ( is_null( $app_id_list ) || '' === $app_id ) &&
     69        ( is_front_page() || get_option( 'wsl_global_banner' ) === 'Yes' ) ) {
    7070        $app_id         = get_option( 'wsl_homepage_appid' );
    7171        $app_id_ipad    = get_option( 'wsl_homepage_appid_ipad' );
     
    7575
    7676    // if it's not there, exit.
    77     if ( is_null( $app_id ) || '' == $app_id ) {
     77    if ( is_null( $app_id ) || '' === $app_id ) {
    7878        return;
    7979    }
     
    8181    $options = '';
    8282
    83     if ( ! is_null( $affiliate_data ) && '' != $affiliate_data ) {
     83    if ( ! is_null( $affiliate_data ) && '' !== $affiliate_data ) {
    8484        $options = "$options, affiliate-data=$affiliate_data";
    8585    }
    86     if ( ! is_null( $app_argument ) && '' != $app_argument ) {
     86    if ( ! is_null( $app_argument ) && '' !== $app_argument ) {
    8787        $options = "$options, app-argument=$app_argument";
    8888    }
    8989
    9090    // if it is, output the header.
    91     if ( is_null( $app_id_ipad ) || '' == $app_id_ipad ) {
     91    if ( is_null( $app_id_ipad ) || '' === $app_id_ipad ) {
    9292        echo "<meta name=\"apple-itunes-app\" content=\"app-id=$app_id$options\"/>";
    9393    } else {
     
    9595<script language="javascript">
    9696<!--
    97 if (navigator.userAgent.match(/iPad/i) != null) {
     97if (navigator.userAgent.match(/iPad/i) !== null) {
    9898document.write("<meta name=\"apple-itunes-app\" content=\"app-id=<?php echo "$app_id_ipad$options"; ?>\"/>\n");
    9999}
     
    141141    $protocol             = wp_parse_url( $url, PHP_URL_SCHEME );
    142142    $disallowed_protocols = array( 'javascript' );
    143     if ( in_array( $protocol, $disallowed_protocols ) ) {
     143    if ( in_array( $protocol, $disallowed_protocols, true ) ) {
    144144        return false;
    145145    }
     
    159159function wsl_validate_input( $app_id, $app_id_ipad, $affiliate_data, $app_argument ) {
    160160    $error_message = null;
    161     if ( preg_match( '/[^0-9]/', $app_id ) == 1 ) {
     161    if ( preg_match( '/[^0-9]/', $app_id ) === 1 ) {
    162162        $error_message = __( 'Invalid App ID' );
    163     } elseif ( preg_match( '/[^0-9]/', $app_id_ipad ) == 1 ) {
     163    } elseif ( preg_match( '/[^0-9]/', $app_id_ipad ) === 1 ) {
    164164        $error_message = __( 'Invalid iPad App ID' );
    165     } elseif ( isset( $app_argument ) && '' != $app_argument && ! wsl_custom_url_validator( $app_argument ) ) {
     165    } elseif ( isset( $app_argument ) && '' !== $app_argument && ! wsl_custom_url_validator( $app_argument ) ) {
    166166        $error_message = __( 'Invalid URL for app argument' );
    167167    }
     
    205205    // See if the user has posted us some information.
    206206    // If they did, this hidden field will be set to 'Y'.
    207     if ( isset( $_POST[ $hidden_field_name ] ) && 'Y' == $_POST[ $hidden_field_name ] ) {
     207    if ( isset( $_POST[ $hidden_field_name ] ) && 'Y' === $_POST[ $hidden_field_name ] ) {
    208208
    209209        if ( ! isset( $_POST['wsl-update'] ) || ! wp_verify_nonce( $_POST['wsl-update'], 'wsl-update' ) ) {
     
    225225            <div class="error"><p><strong><?php _e( $error_message, 'smart-app-banner' ); ?></strong></p></div>
    226226                <?php
    227             } elseif ( isset( $app_id ) && '' != $app_id ) {
     227            } elseif ( isset( $app_id ) && '' !== $app_id ) {
    228228                $app_list[ $app_id ] = array(
    229229                    'app_name'       => $app_name,
     
    260260                update_option( $affiliate_field_name, $affiliate_val );
    261261                update_option( $argument_field_name, $argument_val );
    262                 if ( 'Yes' == $_POST[ $global_banner_field_name ] ) {
     262                if ( 'Yes' === $_POST[ $global_banner_field_name ] ) {
    263263                                update_option( $global_banner_field_name, 'Yes' );
    264264                } else {
     
    330330    <td><input type="checkbox" name="<?php echo $global_banner_field_name; ?>" value="Yes"
    331331                                                <?php
    332                                                 if ( 'Yes' == $global_banner_val ) {
     332                                                if ( 'Yes' === $global_banner_val ) {
    333333                                                    echo 'checked'; }
    334334                                                ?>
Note: See TracChangeset for help on using the changeset viewer.