クラス
LoginPage
HTML/CSS for the login page after an Add to Wishlist
redirect
ソース ソース
ファイル: src/Views/LoginPage.php
class LoginPage { /** * Registers hooks * * @author Evan D Shaw <evandanielshaw@gmail.com> * @return void */ public static function init() { add_action('usces_action_login_page_inform', [get_class(), 'appendAddToWishlistFormFields']); add_action('usces_action_login_page_header', [get_class(), 'mustLoginInformHeader']); } /** * Shows message at top of login page * * @author Evan D Shaw <evandanielshaw@gmail.com> * @return void */ public static function mustLoginInformHeader() { global $usces; if (!empty($usces->options['member_page_data']['header']['login'])) { $html = $usces->options['member_page_data']['header']['login']; echo do_shortcode(stripslashes(nl2br($html))); } if (!empty($_GET[Redirect::REDIRECT_KEY_ADD_TO_WISHLIST]) || !empty($_GET[Redirect::REDIRECT_KEY_ADD_TO_WISHLIST_BY_SERIAL])) { wp_enqueue_style( 'wcexwl-login-page', WCEXWL_PLUGIN_URL . '/src/Styles/login.css', [], WCEXWL_VERSION ); $display = Master::getFilterableValues(); ?> <p class="login-required-error"> <?php echo $display['loginRequiredMessage']; ?> </p> <?php } } /** * Adds wishlist fields to login form, if applicable * * @author Evan D Shaw <evandanielshaw@gmail.com> * @return void */ public static function appendAddToWishlistFormFields() { if (!empty($_REQUEST[Redirect::REDIRECT_KEY_ADD_TO_WISHLIST])) { $payload = ''; if (isset($_GET[Redirect::REDIRECT_KEY_ADD_TO_WISHLIST])) { $payload = urlencode($_GET[Redirect::REDIRECT_KEY_ADD_TO_WISHLIST]); } else { $payload = $_REQUEST[Redirect::REDIRECT_KEY_ADD_TO_WISHLIST]; } ?> <input type="hidden" name="<?php echo Redirect::REDIRECT_KEY_ADD_TO_WISHLIST; ?>" value="<?php echo $payload; ?>" /> <?php return; } if (!empty($_REQUEST[Redirect::REDIRECT_KEY_ADD_TO_WISHLIST_BY_SERIAL])) { $encodeflag = false; if (isset($_GET[Redirect::REDIRECT_KEY_ADD_TO_WISHLIST_BY_SERIAL])) { $encodeflag = true; } foreach ((array)$_REQUEST[Redirect::REDIRECT_KEY_ADD_TO_WISHLIST_BY_SERIAL] as $serial) { $payload = $encodeflag === true ? urlencode(wp_unslash($serial)) : wp_unslash($serial); ?> <input type="hidden" name="<?php echo Redirect::REDIRECT_KEY_ADD_TO_WISHLIST_BY_SERIAL; ?>[]" value="<?php echo $payload ?>" /> <?php } } } }
- appendAddToWishlistFormFields — Adds wishlist fields to login form, if applicable
- init — Registers hooks
- mustLoginInformHeader — Shows message at top of login page