/**
  * Force SSL when Stripe in Live mode
  *
  * @since  1.0.2.5
  *
  * @param String $url The modified or raw URL
  * @param String $page_type Check if this is a membership page
  * @param Bool $ssl If SSL enabled or not
  * @param Int $site_id The ID of site
  *
  * @return String $url Modified or raw URL
  */
 public function ms_model_pages_get_ms_page_url_cb($url, $page_type, $ssl, $site_id)
 {
     /**
      * Constant M2_FORCE_NO_SSL
      *
      * It's needed, if :
      *      - the user has no SSL
      *      - the user has SSL but doesn't want to force
      *      - The user has multiple gateways like Paypal and Stripe and doesn't want to force
      *
      * If the user has SSL certificate, this rule won't work
      */
     if (!defined('M2_FORCE_NO_SSL') || M2_FORCE_NO_SSL != false) {
         if ($this->active && $this->is_live_mode()) {
             if ($page_type == MS_Model_Pages::MS_PAGE_MEMBERSHIPS) {
                 $url = MS_Helper_Utility::get_ssl_url($url);
             }
         }
     }
     return $url;
 }
 /**
  * Get MS Page URL.
  *
  * @since  1.0.0
  *
  * @param string|WP_Post $page_type The page type name or a WP_Post object.
  * @param boolean $ssl If wanted a SSL url. Set to null to use auto detection.
  * @return string The MS Page URL.
  */
 public static function get_page_url($page_type, $ssl = null)
 {
     static $Urls = array();
     $site_id = self::get_site_info('id');
     $page_id = self::get_page_id($page_type);
     if (!isset($Urls[$page_id])) {
         if (is_multisite()) {
             $url = get_blog_permalink($site_id, $page_id);
         } else {
             $url = get_permalink($page_id);
         }
         if (null === $ssl) {
             $ssl = is_ssl();
         }
         if ($ssl) {
             $url = MS_Helper_Utility::get_ssl_url($url);
         }
         $Urls[$page_id] = apply_filters('ms_model_pages_get_ms_page_url', $url, $page_type, $ssl, $site_id);
     }
     return $Urls[$page_id];
 }
 /**
  * Localize the URL to the current language.
  *
  * @since  1.0.1.0
  * @param  string $url The default URL.
  * @param  string $page_type Not used.
  * @param  bool $ssl Should the URL use ssl protocol?
  * @return string Localized URL.
  */
 public function translate_page_url($url, $page_type, $ssl)
 {
     if ($this->current_lang != $this->default_lang) {
         $post_id = url_to_postid($url);
         $tr_post_id = apply_filters('wpml_object_id', $post_id, 'page', true, $this->current_lang);
         if ($tr_post_id) {
             $url = get_permalink($tr_page_id);
             if (null === $ssl) {
                 $ssl = is_ssl();
             }
             if ($ssl) {
                 $url = MS_Helper_Utility::get_ssl_url($url);
             }
         }
     }
     return $url;
 }