permit_ssl() public static method

Checks to see if the URL is using SSL to connect with Jetpack
Since: 2.3.3
public static permit_ssl ( $force_recheck = false ) : boolean
return boolean
Example #1
0
 function ajax_recheck_ssl()
 {
     check_ajax_referer('recheck-ssl', 'ajax-nonce');
     $result = Jetpack::permit_ssl(true);
     wp_send_json(array('enabled' => $result, 'message' => get_transient('jetpack_https_test_message')));
 }
 public static function generate_stats_array($prefix = '')
 {
     $return = array();
     $return["{$prefix}version"] = JETPACK__VERSION;
     $return["{$prefix}wp-version"] = get_bloginfo('version');
     $return["{$prefix}php-version"] = PHP_VERSION;
     $return["{$prefix}branch"] = floatval(JETPACK__VERSION);
     $return["{$prefix}wp-branch"] = floatval(get_bloginfo('version'));
     $return["{$prefix}php-branch"] = floatval(PHP_VERSION);
     $return["{$prefix}ssl"] = Jetpack::permit_ssl();
     $return["{$prefix}language"] = get_bloginfo('language');
     $return["{$prefix}charset"] = get_bloginfo('charset');
     $return["{$prefix}is-multisite"] = is_multisite() ? 'multisite' : 'singlesite';
     $return["{$prefix}identitycrisis"] = Jetpack::check_identity_crisis(1) ? 'yes' : 'no';
     $return["{$prefix}plugins"] = implode(',', Jetpack::get_active_plugins());
     if (!empty($_SERVER['SERVER_ADDR']) || !empty($_SERVER['LOCAL_ADDR'])) {
         $ip = !empty($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : $_SERVER['LOCAL_ADDR'];
         $ip_arr = array_map('intval', explode('.', $ip));
         if (4 == sizeof($ip_arr)) {
             $return["{$prefix}ip-2-octets"] = implode('.', array_slice($ip_arr, 0, 2));
             $return["{$prefix}ip-3-octets"] = implode('.', array_slice($ip_arr, 0, 3));
         }
     }
     foreach (Jetpack::get_available_modules() as $slug) {
         $return["{$prefix}module-{$slug}"] = Jetpack::is_module_active($slug) ? 'on' : 'off';
     }
     return $return;
 }
 public static function generate_stats_array($prefix = '')
 {
     $return = array();
     $return["{$prefix}version"] = JETPACK__VERSION;
     $return["{$prefix}wp-version"] = get_bloginfo('version');
     $return["{$prefix}php-version"] = PHP_VERSION;
     $return["{$prefix}branch"] = floatval(JETPACK__VERSION);
     $return["{$prefix}wp-branch"] = floatval(get_bloginfo('version'));
     $return["{$prefix}php-branch"] = floatval(PHP_VERSION);
     $return["{$prefix}public"] = Jetpack_Options::get_option('public');
     $return["{$prefix}ssl"] = Jetpack::permit_ssl();
     $return["{$prefix}is-https"] = is_ssl() ? 'https' : 'http';
     $return["{$prefix}language"] = get_bloginfo('language');
     $return["{$prefix}charset"] = get_bloginfo('charset');
     $return["{$prefix}is-multisite"] = is_multisite() ? 'multisite' : 'singlesite';
     $return["{$prefix}identitycrisis"] = Jetpack::check_identity_crisis(1) ? 'yes' : 'no';
     $return["{$prefix}plugins"] = implode(',', Jetpack::get_active_plugins());
     $return["{$prefix}single-user-site"] = Jetpack::is_single_user_site();
     $return["{$prefix}manage-enabled"] = Jetpack::is_module_active('manage');
     // is-multi-network can have three values, `single-site`, `single-network`, and `multi-network`
     $return["{$prefix}is-multi-network"] = 'single-site';
     if (is_multisite()) {
         $return["{$prefix}is-multi-network"] = Jetpack::is_multi_network() ? 'multi-network' : 'single-network';
     }
     if (!empty($_SERVER['SERVER_ADDR']) || !empty($_SERVER['LOCAL_ADDR'])) {
         $ip = !empty($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : $_SERVER['LOCAL_ADDR'];
         $ip_arr = array_map('intval', explode('.', $ip));
         if (4 == count($ip_arr)) {
             $return["{$prefix}ip-2-octets"] = implode('.', array_slice($ip_arr, 0, 2));
         }
     }
     foreach (Jetpack::get_available_modules() as $slug) {
         $return["{$prefix}module-{$slug}"] = Jetpack::is_module_active($slug) ? 'on' : 'off';
     }
     return $return;
 }
 public static function recheck_ssl()
 {
     $result = Jetpack::permit_ssl(true);
     return array('enabled' => $result, 'message' => get_transient('jetpack_https_test_message'));
 }
 public static function generate_stats_array($prefix = '')
 {
     $return = array();
     $return["{$prefix}version"] = JETPACK__VERSION;
     $return["{$prefix}wp-version"] = get_bloginfo('version');
     $return["{$prefix}php-version"] = PHP_VERSION;
     $return["{$prefix}branch"] = floatval(JETPACK__VERSION);
     $return["{$prefix}wp-branch"] = floatval(get_bloginfo('version'));
     $return["{$prefix}php-branch"] = floatval(PHP_VERSION);
     $return["{$prefix}public"] = Jetpack_Options::get_option('public');
     $return["{$prefix}ssl"] = Jetpack::permit_ssl();
     $return["{$prefix}language"] = get_bloginfo('language');
     $return["{$prefix}charset"] = get_bloginfo('charset');
     $return["{$prefix}is-multisite"] = is_multisite() ? 'multisite' : 'singlesite';
     $return["{$prefix}identitycrisis"] = Jetpack::check_identity_crisis(1) ? 'yes' : 'no';
     $return["{$prefix}plugins"] = implode(',', Jetpack::get_active_plugins());
     switch (Jetpack_Options::get_option('json_api_full_management', null)) {
         case null:
             $return["{$prefix}full_manage"] = 'unset';
             break;
         case false:
             $return["{$prefix}full_manage"] = 'false';
             break;
         case true:
             $return["{$prefix}full_manage"] = 'true';
             break;
         default:
             $return["{$prefix}full_manage"] = Jetpack_Options::get_option('json_api_full_management', null);
     }
     if (!Jetpack_Options::get_option('public')) {
         // Also flag things as private since we don't provide the user with option to easy opt into if the site is private
         $return["{$prefix}full_manage"] = 'private-' . $return["{$prefix}full_manage"];
     }
     // is-multi-network can have three values, `single-site`, `single-network`, and `multi-network`
     $return["{$prefix}is-multi-network"] = 'single-site';
     if (is_multisite()) {
         $return["{$prefix}is-multi-network"] = Jetpack::is_multi_network() ? 'multi-network' : 'single-network';
     }
     if (!empty($_SERVER['SERVER_ADDR']) || !empty($_SERVER['LOCAL_ADDR'])) {
         $ip = !empty($_SERVER['SERVER_ADDR']) ? $_SERVER['SERVER_ADDR'] : $_SERVER['LOCAL_ADDR'];
         $ip_arr = array_map('intval', explode('.', $ip));
         if (4 == count($ip_arr)) {
             $return["{$prefix}ip-2-octets"] = implode('.', array_slice($ip_arr, 0, 2));
             $return["{$prefix}ip-3-octets"] = implode('.', array_slice($ip_arr, 0, 3));
         }
     }
     foreach (Jetpack::get_available_modules() as $slug) {
         $return["{$prefix}module-{$slug}"] = Jetpack::is_module_active($slug) ? 'on' : 'off';
     }
     return $return;
 }