* Based on @see wp_update_plugins().
         *
         * @access private
         * @since  8.5.28
         *
         * @return int
         */
        private static function get_status_check_timeout()
        {
            global $pagenow;
            switch ($pagenow) {
                case 'admin.php':
                    $timeout = MINUTE_IN_SECONDS;
                    break;
                case 'plugins.php':
                    $timeout = HOUR_IN_SECONDS;
                    break;
                default:
                    if (defined('DOING_CRON') && DOING_CRON) {
                        $timeout = 0;
                    } else {
                        $timeout = 12 * HOUR_IN_SECONDS;
                    }
            }
            return $timeout;
        }
    }
    // Init the plugin updater API!
    cnLicense_Status::init();
}
// End class_exists check.
 /**
  * Returns the plugins license status message and message type.
  *
  * @access private
  * @since  8.5.24
  * @static
  *
  * @param cnLicense $license
  *
  * @return array
  */
 private static function statusMessage($license)
 {
     $status = array();
     /*
      * First check to ensure a license key has been saved for the item, if not, bail.
      */
     if (0 == strlen($license->key)) {
         $status['type'] = 'warning';
         $status['code'] = 'no_key';
         $message = esc_html__('License has not been activated.', 'connections');
         $message .= sprintf(' <a href="%1$s" title="%2$s">%2$s</a>', esc_url(self_admin_url('admin.php?page=connections_settings&tab=licenses')), esc_html__('Please activate now in order to receive support and to enable in admin updates.', 'connections'));
         $status['message'] = $message;
         return $status;
     }
     // Retrieve the items license data.
     $data = cnLicense_Status::get($license->slug);
     if (is_wp_error($data)) {
         $status['type'] = 'error';
         $status['code'] = $data->get_error_code();
         $status['message'] = $data->get_error_message();
         return $status;
     }
     // If there was an error message in the EDD SL API response, set the description to the error message.
     if (isset($data->success) && FALSE === $data->success) {
         // $status = isset( $data[ $slug ] ) && isset( $data[ $slug ]->license ) ? $data[ $slug ]->license : 'unknown';
         $error = isset($data->error) ? $data->error : 'unknown';
         switch ($error) {
             case 'expired':
                 $status['type'] = 'error';
                 $status['code'] = 'expired';
                 $message = esc_html__('Support license key has expired. Your are no longer receiving support and in admin updates.', 'connections');
                 if (isset($data->renewal_url)) {
                     $message .= sprintf(' <a href="%1$s" title="%2$s">%2$s</a>', esc_url($data->renewal_url), esc_html__('Click here to renew the support license.', 'connections'));
                 }
                 $status['message'] = $message;
                 return $status;
             case 'invalid_item_id':
             case 'item_name_mismatch':
                 $status['type'] = 'error';
                 $status['code'] = 'item_name_mismatch';
                 $status['message'] = esc_html__('License entered is not for this item.', 'connections');
                 break;
             case 'missing':
                 $status['type'] = 'error';
                 $status['code'] = 'missing';
                 $status['message'] = esc_html__('Invalid license.', 'connections');
                 break;
             case 'revoked':
                 $status['type'] = 'error';
                 $status['code'] = 'revoked';
                 $status['message'] = esc_html__('License has been revoked.', 'connections');
                 break;
             case 'no_activations_left':
                 $status['type'] = 'warning';
                 $status['code'] = 'no_activations_left';
                 $status['message'] = esc_html__('License activation limit has been reached.', 'connections');
                 break;
             case 'key_mismatch':
                 $status['type'] = 'error';
                 $status['code'] = 'key_mismatch';
                 $status['message'] = esc_html__('License key mismatch.', 'connections');
                 break;
             case 'license_not_activable':
                 $status['type'] = 'error';
                 $status['code'] = 'license_not_activable';
                 $status['message'] = esc_html__('Bundle license keys can not be activated. Use item license key instead.', 'connections');
                 break;
             default:
                 $status['type'] = 'error';
                 $status['code'] = 'unknown_error';
                 $status['message'] = esc_html__('An unknown error has occurred.', 'connections');
                 break;
         }
     } elseif (isset($data->success) && TRUE === $data->success) {
         // Get the status if the item's license key.
         //$status = self::status( $license->name, $license->key );
         // If there was no error message, display the current license status.
         switch ($data->license) {
             case 'invalid':
                 $status['type'] = 'error';
                 $status['code'] = 'invalid';
                 $status['message'] = esc_html__('License key invalid.', 'connections');
                 break;
             case 'expired':
                 $status['type'] = 'error';
                 $status['code'] = 'expired';
                 $message = esc_html__('Support license key has expired. Your are no longer receiving support and in admin updates.', 'connections');
                 if (isset($data->renewal_url)) {
                     $message .= sprintf(' <a href="%1$s" title="%2$s">%2$s</a>', esc_url($data->renewal_url), esc_html__('Click here to renew support license.', 'connections'));
                 }
                 $status['message'] = $message;
                 break;
             case 'inactive':
                 $status['type'] = 'warning';
                 $status['code'] = 'inactive';
                 $status['message'] = esc_html__('License is not active.', 'connections');
                 break;
             case 'disabled':
                 $status['type'] = 'error';
                 $status['code'] = 'disabled';
                 $status['message'] = esc_html__('License has been disabled.', 'connections');
                 break;
             case 'site_inactive':
                 $status['type'] = 'warning';
                 $status['code'] = 'site_inactive';
                 $status['message'] = esc_html__('License is not active on this site.', 'connections');
                 break;
             case 'invalid_item_id':
             case 'item_name_mismatch':
                 $status['type'] = 'error';
                 $status['code'] = 'item_name_mismatch';
                 $status['message'] = esc_html__('License entered is not for this item.', 'connections');
                 break;
             case 'valid':
                 $status['type'] = 'success';
                 $status['code'] = 'valid';
                 $expiryDate = strtotime($data->expires);
                 if ($expiryDate !== FALSE) {
                     $message = sprintf(esc_html__('License is valid and you are receiving updates. Your support license key will expire on %s.', 'connections'), date('F jS Y', $expiryDate));
                 } elseif ('lifetime' == $data->expires) {
                     $message = esc_html__('Lifetime license is valid and you are receiving updates.', 'connections');
                 } else {
                     $message = esc_html__('License is valid', 'connections');
                 }
                 $status['message'] = $message;
                 break;
             case 'deactivated':
                 $status['type'] = 'warning';
                 $status['code'] = 'deactivated';
                 $status['message'] = esc_html__('License is deactivated.', 'connections');
                 break;
             case 'failed':
                 $status['type'] = 'error';
                 $status['code'] = 'failed';
                 $status['message'] = esc_html__('License validation failed.', 'connections');
                 break;
             default:
                 $status['type'] = 'error';
                 $status['code'] = 'unknown_error';
                 $status['message'] = esc_html__('An unknown error has occurred.', 'connections');
         }
     } else {
         $status['type'] = 'error';
         $status['code'] = 'unknown_error';
         $status['message'] = esc_html__('An unknown error has occurred.', 'connections');
     }
     return $status;
 }