Thanks!
I noticed the last line actually executes the main function in the class. So I enclosed that with the “maybe_set_server_https_on” functions if statements.
It looks like this:
if ( ! isset( $_SERVER[ 'HTTPS' ] ) || $_SERVER[ 'HTTPS' ] !== 'on' ) {;
if ( isset( $_SERVER[ 'HTTP_X_FORWARDED_PROTO' ] ) && strpos( $_SERVER[ 'HTTP_X_FORWARDED_PROTO' ], 'https' ) !== false ) {
JSM_Force_SSL::get_instance();
}
}
I suppose I could optimize it a bit more by not continueing with the plugin if the statement is true. Is there a (wordpress) function for that? Otherwise I could include it in the if ( ! class_exists( 'JSM_Force_SSL' ) )
statement. Unfortunately I am not very experienced with PHP.