From d7a5e61b0959fac8f676b420d3b1dd5ce6305334 Mon Sep 17 00:00:00 2001 From: Alex Lion Date: Wed, 2 Aug 2023 15:42:30 -0700 Subject: [PATCH 1/3] Improve I18N Issues (Based on 0.6) I know this plugin doesn't require any configuration, but this PR can complete its locale translation project on GlotPress. The community translators can translate the plugin's description at least. --- gp-require-login.php | 149 ++++++++++++++++++++++--------------------- 1 file changed, 77 insertions(+), 72 deletions(-) diff --git a/gp-require-login.php b/gp-require-login.php index 14bd2db..8c34f18 100644 --- a/gp-require-login.php +++ b/gp-require-login.php @@ -1,72 +1,77 @@ -get_current_page_url() ) ); - exit; - } - - return $methods; - } - - private function get_current_page_url() { - $page_url = 'http'; - - // Ask WordPress if we're running over SSL. - $ssl = is_ssl(); - - // Double check if we're running behind a broken load balancer. - if( false === $ssl ) { - if( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && 'https' === $_SERVER['HTTP_X_FORWARDED_PROTO'] ) { - $ssl = true; - } - } - - // Add the 's' to the url if required. - if( $ssl ) { - $page_url .= 's'; - } - - // Add the server name to the url. - $page_url .= '://' . $_SERVER['SERVER_NAME']; - - // Check to see if we're running over a non-default port number, if so add it to the url. - if( ( ! $ssl && '80' !== $_SERVER['SERVER_PORT'] ) || ( $ssl && '443' !== $_SERVER['SERVER_PORT'] ) ) { - $page_url .= ':' . $_SERVER['SERVER_PORT']; - } - - // And finally add the URI to the URL. - $page_url .= $_SERVER['REQUEST_URI']; - - return $page_url; - } - -} - -// Add an action to WordPress's init hook to setup the plugin. Don't just setup the plugin here as the GlotPress plugin may not have loaded yet. -add_action( 'gp_init', 'gp_require_login_init' ); - -// This function creates the plugin. -function gp_require_login_init() { - GLOBAL $gp_require_login; - - $gp_require_login = new GP_Require_Login; -} +get_current_page_url() ) ); + exit; + } + + return $methods; + } + + public function load_text_domain() { + load_plugin_textdomain( gp-require-login, false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); + } + + private function get_current_page_url() { + $page_url = 'http'; + + // Ask WordPress if we're running over SSL. + $ssl = is_ssl(); + + // Double check if we're running behind a broken load balancer. + if( false === $ssl ) { + if( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && 'https' === $_SERVER['HTTP_X_FORWARDED_PROTO'] ) { + $ssl = true; + } + } + + // Add the 's' to the url if required. + if( $ssl ) { + $page_url .= 's'; + } + + // Add the server name to the url. + $page_url .= '://' . $_SERVER['SERVER_NAME']; + + // Check to see if we're running over a non-default port number, if so add it to the url. + if( ( ! $ssl && '80' !== $_SERVER['SERVER_PORT'] ) || ( $ssl && '443' !== $_SERVER['SERVER_PORT'] ) ) { + $page_url .= ':' . $_SERVER['SERVER_PORT']; + } + + // And finally add the URI to the URL. + $page_url .= $_SERVER['REQUEST_URI']; + + return $page_url; + } + +} + +// Add an action to WordPress's init hook to setup the plugin. Don't just setup the plugin here as the GlotPress plugin may not have loaded yet. +add_action( 'gp_init', 'gp_require_login_init' ); + +// This function creates the plugin. +function gp_require_login_init() { + GLOBAL $gp_require_login; + + $gp_require_login = new GP_Require_Login; +} From a7cfa040c1f03b7598723b0358416803a2babfb2 Mon Sep 17 00:00:00 2001 From: Alex Lion Date: Wed, 2 Aug 2023 16:03:10 -0700 Subject: [PATCH 2/3] Revert "Improve I18N Issues (Based on 0.6)" This reverts commit d7a5e61b0959fac8f676b420d3b1dd5ce6305334. --- gp-require-login.php | 149 +++++++++++++++++++++---------------------- 1 file changed, 72 insertions(+), 77 deletions(-) diff --git a/gp-require-login.php b/gp-require-login.php index 8c34f18..14bd2db 100644 --- a/gp-require-login.php +++ b/gp-require-login.php @@ -1,77 +1,72 @@ -get_current_page_url() ) ); - exit; - } - - return $methods; - } - - public function load_text_domain() { - load_plugin_textdomain( gp-require-login, false, dirname( plugin_basename( __FILE__ ) ) . '/languages' ); - } - - private function get_current_page_url() { - $page_url = 'http'; - - // Ask WordPress if we're running over SSL. - $ssl = is_ssl(); - - // Double check if we're running behind a broken load balancer. - if( false === $ssl ) { - if( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && 'https' === $_SERVER['HTTP_X_FORWARDED_PROTO'] ) { - $ssl = true; - } - } - - // Add the 's' to the url if required. - if( $ssl ) { - $page_url .= 's'; - } - - // Add the server name to the url. - $page_url .= '://' . $_SERVER['SERVER_NAME']; - - // Check to see if we're running over a non-default port number, if so add it to the url. - if( ( ! $ssl && '80' !== $_SERVER['SERVER_PORT'] ) || ( $ssl && '443' !== $_SERVER['SERVER_PORT'] ) ) { - $page_url .= ':' . $_SERVER['SERVER_PORT']; - } - - // And finally add the URI to the URL. - $page_url .= $_SERVER['REQUEST_URI']; - - return $page_url; - } - -} - -// Add an action to WordPress's init hook to setup the plugin. Don't just setup the plugin here as the GlotPress plugin may not have loaded yet. -add_action( 'gp_init', 'gp_require_login_init' ); - -// This function creates the plugin. -function gp_require_login_init() { - GLOBAL $gp_require_login; - - $gp_require_login = new GP_Require_Login; -} +get_current_page_url() ) ); + exit; + } + + return $methods; + } + + private function get_current_page_url() { + $page_url = 'http'; + + // Ask WordPress if we're running over SSL. + $ssl = is_ssl(); + + // Double check if we're running behind a broken load balancer. + if( false === $ssl ) { + if( isset( $_SERVER['HTTP_X_FORWARDED_PROTO'] ) && 'https' === $_SERVER['HTTP_X_FORWARDED_PROTO'] ) { + $ssl = true; + } + } + + // Add the 's' to the url if required. + if( $ssl ) { + $page_url .= 's'; + } + + // Add the server name to the url. + $page_url .= '://' . $_SERVER['SERVER_NAME']; + + // Check to see if we're running over a non-default port number, if so add it to the url. + if( ( ! $ssl && '80' !== $_SERVER['SERVER_PORT'] ) || ( $ssl && '443' !== $_SERVER['SERVER_PORT'] ) ) { + $page_url .= ':' . $_SERVER['SERVER_PORT']; + } + + // And finally add the URI to the URL. + $page_url .= $_SERVER['REQUEST_URI']; + + return $page_url; + } + +} + +// Add an action to WordPress's init hook to setup the plugin. Don't just setup the plugin here as the GlotPress plugin may not have loaded yet. +add_action( 'gp_init', 'gp_require_login_init' ); + +// This function creates the plugin. +function gp_require_login_init() { + GLOBAL $gp_require_login; + + $gp_require_login = new GP_Require_Login; +} From bde008eee1a0f5b68d1967ea327e7db0f913759b Mon Sep 17 00:00:00 2001 From: Alex Lion Date: Wed, 2 Aug 2023 16:10:42 -0700 Subject: [PATCH 3/3] Improve I18N Issues (Based on 0.6) I know this plugin doesn't require any configuration, but this PR can complete its locale translation projects on GlotPress. The community translators can translate the plugin's description at least. --- gp-require-login.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/gp-require-login.php b/gp-require-login.php index 14bd2db..23f27f6 100644 --- a/gp-require-login.php +++ b/gp-require-login.php @@ -1,11 +1,12 @@