true, 'strategy' => 'defer' ) ); } } /** * Load the stylesheet only where PAYGRAB shows something. * * @return void */ public static function maybe_enqueue() { $post = get_post(); $need = false; if ( is_singular() && $post ) { foreach ( array( Paygrab_Product::SHORTCODE, 'paygrab_checkout', 'paygrab_mypage', 'paygrab_register', 'paygrab_login', 'paygrab_tokushoho' ) as $tag ) { if ( has_shortcode( $post->post_content, $tag ) ) { $need = true; break; } } } // A page set as one of PAYGRAB's pages is drawn in PAYGRAB's frame even without a shortcode (the seller's own // legal notice table, for one), so the frame needs the stylesheet too. if ( ! $need && '' !== self::layout_page() ) { $need = true; } if ( $need ) { self::enqueue(); } } /** * Load the stylesheet (also called by shortcodes used in unusual places). * * @return void */ public static function enqueue() { self::register(); wp_enqueue_style( 'paygrab' ); static $vars = false; if ( ! $vars ) { wp_add_inline_style( 'paygrab', Paygrab_Styles::css() ); $vars = true; } wp_enqueue_script( 'paygrab' ); } /** * "New here? Sign up" under the login form. * * @return void */ public static function login_register_link() { if ( ! paygrab_page_url( 'register' ) ) { return; } // phpcs:ignore WordPress.Security.NonceVerification.Recommended $redirect = isset( $_REQUEST['redirect_to'] ) ? wp_validate_redirect( esc_url_raw( wp_unslash( $_REQUEST['redirect_to'] ) ), '' ) : ''; printf( '

%1$s %3$s

', esc_html__( 'New here?', 'paygrab' ), esc_url( paygrab_register_url( $redirect ) ), esc_html__( 'Sign up for free', 'paygrab' ) ); } }