/** * Enable Private Site * @since 0.1.0 */ public function settings_field_ssl() { /* Check if feature is supported. */ if (is_ssl() && force_ssl_admin() && fx_ssl_is_https(get_option('home')) && fx_ssl_is_https(get_option('siteurl'))) { $disabled = ''; $option = get_option($this->option_name, false); } else { $disabled = ' disabled=disabled'; $option = false; // always false if requirement not met. } ?> <label for="fx_ssl_enable"> <input type="checkbox" value="1" id="fx_ssl_enable" name="<?php echo esc_attr($this->option_name); ?> " <?php checked($option); echo $disabled; ?> > <?php _ex('Redirect all pages to HTTPS', 'settings page', 'fx-ssl'); ?> </label> <?php }
/** * Check if SSL enabled * @since 0.1.0 */ function fx_ssl_active() { if (force_ssl_admin() && get_option('fx-ssl', false) && fx_ssl_is_https(get_option('home')) && fx_ssl_is_https(get_option('siteurl'))) { return true; } return false; }
/** * Runs only when the plugin is activated. * @since 0.1.0 */ function fx_ssl_activation() { /* Add notice. */ if (is_ssl() && force_ssl_admin() && fx_ssl_is_https(get_bloginfo('url')) && fx_ssl_is_https(get_bloginfo('wpurl'))) { set_transient('fx_ssl_notice', 'success', 5); if (get_option('fx-ssl', false)) { set_transient('fx_ssl_notice', 'active', 5); } } else { set_transient('fx_ssl_notice', 'fail', 5); } }