Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions src/Utils/Helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,6 @@ public static function render_template( $template_path, $variables = [], $should
return '';
}

if ( ! empty( $variables ) ) {
// This will needed for provide variables to the template.
// Will skips those variables, those already defined.
extract( $variables, EXTR_SKIP ); // phpcs:ignore
}

if ( true === $should_echo ) {

// Load template and output the data.
Expand Down
11 changes: 6 additions & 5 deletions templates/google-login-button.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,22 @@
*
* @package RtCamp\GithubLogin
* @since 1.0.0
* @var array<string, string> $variables
*/

use RtCamp\GoogleLogin\Utils\Helper;

if ( isset( $custom_btn_text ) && $custom_btn_text ) {
$button_text = esc_html( $custom_btn_text );
if (!empty($variables['custom_btn_text'])) {
$button_text = esc_html($variables['custom_btn_text']);
} else {
$button_text = ( ! empty( $button_text ) ) ? $button_text : __( 'Login with Google', 'login-with-google' );
$button_text = $variables['button_text'] ?? __( 'Login with Google', 'login-with-google' );
}

if ( empty( $login_url ) ) {
if (empty($variables['login_url'])) {
return;
}

$button_url = $login_url;
$button_url = $variables['login_url'];

if ( is_user_logged_in() ) {
$button_text = __( 'Log out', 'login-with-google' );
Expand Down