Make WordPress Core

Changes between Version 30 and Version 31 of Ticket #57262, comment 3


Ignore:
Timestamp:
12/14/2022 11:15:55 PM (2 years ago)
Author:
autotutorial
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #57262, comment 3

    v30 v31  
    4141
    4242I'm with preference to adding explicit bool cast for the six uses of force_ssl_admin in core, feel free to comment ( without BC)
     43Otherwise, to improve performance, I'd set the default to true and is_null. Although with certificate expiration exceptions (hence short term) the majority is https for modern times. In both cases the manual must clarify if the value is different from the first call a second call is needed to retrieve the expected value.
     44{{{#!php
     45<?php
     46function force_ssl_admin( $force = null ) {
     47        static $forced = true;
     48
     49        if ( is_null( $force ) ) {
     50                return $forced;
     51        }
     52
     53        $forced = (bool) $force;
     54        return $forced;
     55}
     56?>
     57}}}
     58