Plugin Directory

Changeset 2775563


Ignore:
Timestamp:
08/25/2022 01:39:43 PM (4 years ago)
Author:
ethereumicoio
Message:

The [ethpress_link_button] shortcode is added; Buttons labels text settings is added; WooCommerce Account Details show Link Wallet button setting is added; The Redirect URL setting is added to set an URL of a page to redirect after a successful login

Location:
ethpress/trunk
Files:
1 added
13 edited

Legend:

Unmodified
Added
Removed
  • ethpress/trunk/app/Admin/Options.php

    r2763568 r2775563  
    224224            self::input_api_url( $options );
    225225            self::input_use_managed_service( $options );
     226            self::input_redirect_url( $options );
    226227            self::section_login();
    227228            self::woocommerce_login_form_setting( $options );
    228229            self::woocommerce_register_form_setting( $options );
    229230            self::woocommerce_after_checkout_registration_form_setting( $options );
     231            self::woocommerce_account_details_link_button_setting( $options );
     232            self::section_strings();
     233            self::login_button_label_setting( $options );
     234            self::link_button_label_setting( $options );
     235            self::register_button_label_setting( $options );
    230236        }
    231237       
     
    318324   
    319325    /**
     326     * Outputs login section title.
     327     *
     328     * @since 1.2.0
     329     */
     330    public static function section_strings()
     331    {
     332        ?>
     333        <tr valign="top">
     334            <th scope="row">
     335                <h2>
     336                    <?php
     337        _e( "Labels Settings", 'ethpress' );
     338        ?>
     339                </h2>
     340            </th>
     341            <td>
     342            </td>
     343        </tr>
     344    <?php
     345    }
     346   
     347    /**
     348     * Outputs input for login_button_label option.
     349     *
     350     * @since 1.5.12
     351     */
     352    public static function login_button_label_setting( $options = null )
     353    {
     354        $login_button_label = ( isset( $options['login_button_label'] ) ? esc_attr( $options['login_button_label'] ) : esc_html__( 'Log In With a Crypto Wallet', 'ethpress' ) );
     355        ?>
     356        <tr valign="top">
     357            <th scope="row"><?php
     358        _e( "Login button label", 'ethpress' );
     359        ?></th>
     360            <td>
     361                <fieldset>
     362                    <label>
     363                        <input <?php
     364        if ( \losnappas\Ethpress\ethpress_fs()->is_not_paying() ) {
     365            if ( !\losnappas\Ethpress\ethpress_fs()->is_trial() ) {
     366                ?> disabled <?php
     367            }
     368        }
     369        ?> class="regular-text" id="ethpress_login_button_label" name="ethpress[login_button_label]" type="text" value="<?php
     370        echo  esc_attr( $login_button_label ) ;
     371        ?>">
     372                        <p class="description">
     373                            <?php
     374        _e( 'The Login button text can be set there.' );
     375        ?></p>
     376                        <?php
     377        if ( \losnappas\Ethpress\ethpress_fs()->is_not_paying() ) {
     378           
     379            if ( \losnappas\Ethpress\ethpress_fs()->is_trial() ) {
     380                ?>
     381                                <h2 class="description"><?php
     382                echo  '<a href="' . \losnappas\Ethpress\ethpress_fs()->get_upgrade_url() . '">' . __( 'Upgrade to keep using this feature!', 'ethpress' ) . '</a>' ;
     383                ?></h2>
     384                            <?php
     385            } else {
     386                ?>
     387                                <h2 class="description"><?php
     388                echo  '<a href="' . \losnappas\Ethpress\ethpress_fs()->get_upgrade_url() . '">' . __( 'Upgrade to use this feature!', 'ethpress' ) . '</a>' ;
     389                ?></h2>
     390                        <?php
     391            }
     392       
     393        }
     394        ?>
     395                    </label>
     396                </fieldset>
     397            </td>
     398        </tr>
     399    <?php
     400    }
     401   
     402    /**
     403     * Outputs input for link_button_label option.
     404     *
     405     * @since 1.5.12
     406     */
     407    public static function link_button_label_setting( $options = null )
     408    {
     409        $link_button_label = ( isset( $options['link_button_label'] ) ? esc_attr( $options['link_button_label'] ) : esc_html__( 'Link Your Crypto Wallets', 'ethpress' ) );
     410        ?>
     411        <tr valign="top">
     412            <th scope="row"><?php
     413        _e( "Link button label", 'ethpress' );
     414        ?></th>
     415            <td>
     416                <fieldset>
     417                    <label>
     418                        <input <?php
     419        if ( \losnappas\Ethpress\ethpress_fs()->is_not_paying() ) {
     420            if ( !\losnappas\Ethpress\ethpress_fs()->is_trial() ) {
     421                ?> disabled <?php
     422            }
     423        }
     424        ?> class="regular-text" id="ethpress_link_button_label" name="ethpress[link_button_label]" type="text" value="<?php
     425        echo  esc_attr( $link_button_label ) ;
     426        ?>">
     427                        <p class="description">
     428                            <?php
     429        _e( 'The Link button text can be set there.' );
     430        ?></p>
     431                        <?php
     432        if ( \losnappas\Ethpress\ethpress_fs()->is_not_paying() ) {
     433           
     434            if ( \losnappas\Ethpress\ethpress_fs()->is_trial() ) {
     435                ?>
     436                                <h2 class="description"><?php
     437                echo  '<a href="' . \losnappas\Ethpress\ethpress_fs()->get_upgrade_url() . '">' . __( 'Upgrade to keep using this feature!', 'ethpress' ) . '</a>' ;
     438                ?></h2>
     439                            <?php
     440            } else {
     441                ?>
     442                                <h2 class="description"><?php
     443                echo  '<a href="' . \losnappas\Ethpress\ethpress_fs()->get_upgrade_url() . '">' . __( 'Upgrade to use this feature!', 'ethpress' ) . '</a>' ;
     444                ?></h2>
     445                        <?php
     446            }
     447       
     448        }
     449        ?>
     450                    </label>
     451                </fieldset>
     452            </td>
     453        </tr>
     454    <?php
     455    }
     456   
     457    /**
     458     * Outputs input for register_button_label option.
     459     *
     460     * @since 1.5.12
     461     */
     462    public static function register_button_label_setting( $options = null )
     463    {
     464        $register_button_label = ( isset( $options['register_button_label'] ) ? esc_attr( $options['register_button_label'] ) : esc_html__( 'Register With a Crypto Wallet', 'ethpress' ) );
     465        ?>
     466        <tr valign="top">
     467            <th scope="row"><?php
     468        _e( "Link button label", 'ethpress' );
     469        ?></th>
     470            <td>
     471                <fieldset>
     472                    <label>
     473                        <input <?php
     474        if ( \losnappas\Ethpress\ethpress_fs()->is_not_paying() ) {
     475            if ( !\losnappas\Ethpress\ethpress_fs()->is_trial() ) {
     476                ?> disabled <?php
     477            }
     478        }
     479        ?> class="regular-text" id="ethpress_register_button_label" name="ethpress[register_button_label]" type="text" value="<?php
     480        echo  esc_attr( $register_button_label ) ;
     481        ?>">
     482                        <p class="description">
     483                            <?php
     484        _e( 'The Link button text can be set there.' );
     485        ?></p>
     486                        <?php
     487        if ( \losnappas\Ethpress\ethpress_fs()->is_not_paying() ) {
     488           
     489            if ( \losnappas\Ethpress\ethpress_fs()->is_trial() ) {
     490                ?>
     491                                <h2 class="description"><?php
     492                echo  '<a href="' . \losnappas\Ethpress\ethpress_fs()->get_upgrade_url() . '">' . __( 'Upgrade to keep using this feature!', 'ethpress' ) . '</a>' ;
     493                ?></h2>
     494                            <?php
     495            } else {
     496                ?>
     497                                <h2 class="description"><?php
     498                echo  '<a href="' . \losnappas\Ethpress\ethpress_fs()->get_upgrade_url() . '">' . __( 'Upgrade to use this feature!', 'ethpress' ) . '</a>' ;
     499                ?></h2>
     500                        <?php
     501            }
     502       
     503        }
     504        ?>
     505                    </label>
     506                </fieldset>
     507            </td>
     508        </tr>
     509    <?php
     510    }
     511   
     512    /**
    320513     * Outputs input for api url option.
    321514     *
     
    333526        <tr valign="top">
    334527            <th scope="row"><?php
    335         _e( "WooCommerce Login Form", 'ethpress' );
     528        _e( "Verification Service API URL", 'ethpress' );
    336529        ?></th>
    337530            <td>
     
    394587   
    395588    /**
     589     * Outputs input for redirect url option.
     590     *
     591     * @since 1.5.12
     592     */
     593    public static function input_redirect_url( $options = null )
     594    {
     595        $ecrecovers_with_php = self::_check_ecrecovers_with_php();
     596        if ( is_null( $options ) ) {
     597            $options = get_site_option( 'ethpress' );
     598        }
     599        // Logger::log("Options::input_redirect_url: options = " . print_r($options, true));
     600        $redirect_url = ( isset( $options['redirect_url'] ) ? esc_url( $options['redirect_url'] ) : '' );
     601        ?>
     602        <tr valign="top">
     603            <th scope="row"><?php
     604        _e( "Redirect URL", 'ethpress' );
     605        ?></th>
     606            <td>
     607                <fieldset>
     608                    <label>
     609                        <input <?php
     610        if ( \losnappas\Ethpress\ethpress_fs()->is_not_paying() ) {
     611            if ( !\losnappas\Ethpress\ethpress_fs()->is_trial() ) {
     612                ?> disabled <?php
     613            }
     614        }
     615        ?> class="regular-text" id="ethpress_redirect_url" name="ethpress[redirect_url]" type="text" value="<?php
     616        echo  esc_attr( $redirect_url ) ;
     617        ?>">
     618                        <p class="description">
     619                            <?php
     620        _e( 'The page to redirect after a successful login', 'ethpress' );
     621        ?></p>
     622                        <?php
     623        if ( \losnappas\Ethpress\ethpress_fs()->is_not_paying() ) {
     624           
     625            if ( \losnappas\Ethpress\ethpress_fs()->is_trial() ) {
     626                ?>
     627                                <h2 class="description"><?php
     628                echo  '<a href="' . \losnappas\Ethpress\ethpress_fs()->get_upgrade_url() . '">' . __( 'Upgrade to keep using this feature!', 'ethpress' ) . '</a>' ;
     629                ?></h2>
     630                            <?php
     631            } else {
     632                ?>
     633                                <h2 class="description"><?php
     634                echo  '<a href="' . \losnappas\Ethpress\ethpress_fs()->get_upgrade_url() . '">' . __( 'Upgrade to use this feature!', 'ethpress' ) . '</a>' ;
     635                ?></h2>
     636                        <?php
     637            }
     638       
     639        }
     640        ?>
     641                    </label>
     642                </fieldset>
     643            </td>
     644        </tr>
     645    <?php
     646    }
     647   
     648    /**
    396649     * Outputs input for use_managed_service option.
    397650     *
     
    449702                    ?>
    450703                                <h2 class="description"><?php
    451                     echo  '<a href="' . \losnappas\Ethpress\ethpress_fs()->get_upgrade_url() . '">' . __( 'Upgrade to keep using the Managed Verification Service API feature!', 'ethpress' ) . '</a>' ;
     704                    echo  '<a href="' . \losnappas\Ethpress\ethpress_fs()->get_upgrade_url() . '">' . __( 'Upgrade to keep using this feature!', 'ethpress' ) . '</a>' ;
    452705                    ?></h2>
    453706                            <?php
     
    455708                    ?>
    456709                                <h2 class="description"><?php
    457                     echo  '<a href="' . \losnappas\Ethpress\ethpress_fs()->get_upgrade_url() . '">' . __( 'Upgrade to use the Managed Verification Service API feature!', 'ethpress' ) . '</a>' ;
     710                    echo  '<a href="' . \losnappas\Ethpress\ethpress_fs()->get_upgrade_url() . '">' . __( 'Upgrade to use this feature!', 'ethpress' ) . '</a>' ;
    458711                    ?></h2>
    459712                        <?php
     
    520773                ?>
    521774                            <h2 class="description"><?php
    522                 echo  '<a href="' . \losnappas\Ethpress\ethpress_fs()->get_upgrade_url() . '">' . __( 'Upgrade to keep using the WooCommerce Login Form feature!', 'ethpress' ) . '</a>' ;
     775                echo  '<a href="' . \losnappas\Ethpress\ethpress_fs()->get_upgrade_url() . '">' . __( 'Upgrade to keep using this feature!', 'ethpress' ) . '</a>' ;
    523776                ?></h2>
    524777                        <?php
     
    526779                ?>
    527780                            <h2 class="description"><?php
    528                 echo  '<a href="' . \losnappas\Ethpress\ethpress_fs()->get_upgrade_url() . '">' . __( 'Upgrade to use the WooCommerce Login Form feature!', 'ethpress' ) . '</a>' ;
     781                echo  '<a href="' . \losnappas\Ethpress\ethpress_fs()->get_upgrade_url() . '">' . __( 'Upgrade to use this feature!', 'ethpress' ) . '</a>' ;
    529782                ?></h2>
    530783                        <?php
     
    596849                ?>
    597850                            <h2 class="description"><?php
    598                 echo  '<a href="' . \losnappas\Ethpress\ethpress_fs()->get_upgrade_url() . '">' . __( 'Upgrade to keep using the WooCommerce Register Form feature!', 'ethpress' ) . '</a>' ;
     851                echo  '<a href="' . \losnappas\Ethpress\ethpress_fs()->get_upgrade_url() . '">' . __( 'Upgrade to keep using this feature!', 'ethpress' ) . '</a>' ;
    599852                ?></h2>
    600853                        <?php
     
    602855                ?>
    603856                            <h2 class="description"><?php
    604                 echo  '<a href="' . \losnappas\Ethpress\ethpress_fs()->get_upgrade_url() . '">' . __( 'Upgrade to use the WooCommerce Register Form feature!', 'ethpress' ) . '</a>' ;
     857                echo  '<a href="' . \losnappas\Ethpress\ethpress_fs()->get_upgrade_url() . '">' . __( 'Upgrade to use this feature!', 'ethpress' ) . '</a>' ;
    605858                ?></h2>
    606859                        <?php
     
    681934                ?>
    682935                            <h2 class="description"><?php
    683                 echo  '<a href="' . \losnappas\Ethpress\ethpress_fs()->get_upgrade_url() . '">' . __( 'Upgrade to keep using the WooCommerce Register on a Checkout page feature!', 'ethpress' ) . '</a>' ;
     936                echo  '<a href="' . \losnappas\Ethpress\ethpress_fs()->get_upgrade_url() . '">' . __( 'Upgrade to keep using this feature!', 'ethpress' ) . '</a>' ;
    684937                ?></h2>
    685938                        <?php
     
    687940                ?>
    688941                            <h2 class="description"><?php
    689                 echo  '<a href="' . \losnappas\Ethpress\ethpress_fs()->get_upgrade_url() . '">' . __( 'Upgrade to use the WooCommerce Register on a Checkout page feature!', 'ethpress' ) . '</a>' ;
     942                echo  '<a href="' . \losnappas\Ethpress\ethpress_fs()->get_upgrade_url() . '">' . __( 'Upgrade to use this feature!', 'ethpress' ) . '</a>' ;
    690943                ?></h2>
    691944                        <?php
     
    707960                        <h2 class="description"><?php
    708961            echo  '<a href="' . get_admin_url() . 'options-general.php' . '">' . __( 'Check the Administration > Settings > General > Membership: Anyone can register box to use this feature.', 'ethpress' ) . '</a> ' ;
     962            ?></h2>
     963                    <?php
     964        }
     965       
     966        ?>
     967                </fieldset>
     968            </td>
     969        </tr>
     970    <?php
     971    }
     972   
     973    /**
     974     * Outputs input for woocommerce_account_details_link_button_show option.
     975     *
     976     * @since 1.3.0
     977     */
     978    public static function woocommerce_account_details_link_button_setting( $options = null )
     979    {
     980        if ( is_null( $options ) ) {
     981            $options = get_site_option( 'ethpress' );
     982        }
     983        // Logger::log("Options::woocommerce_after_checkout_registration_form_setting: options = " . print_r($options, true));
     984        $woocommerce_account_details_link_button_show = false;
     985        /**
     986         * Check if WooCommerce is active
     987         * https://wordpress.stackexchange.com/a/193908/137915
     988         **/
     989        $woocommerce_active = in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) );
     990        ?>
     991        <tr valign="top">
     992            <th scope="row"><?php
     993        _e( "WooCommerce Account Details Link Wallet Form", 'ethpress' );
     994        ?></th>
     995            <td>
     996                <fieldset>
     997                    <input <?php
     998        if ( !get_option( 'users_can_register' ) || !$woocommerce_active || \losnappas\Ethpress\ethpress_fs()->is_not_paying() ) {
     999            if ( !get_option( 'users_can_register' ) || !$woocommerce_active || !\losnappas\Ethpress\ethpress_fs()->is_trial() ) {
     1000                ?> disabled <?php
     1001            }
     1002        }
     1003        ?> class="regular-text" id="ethpress_woocommerce_account_details_link_button_show" name="ethpress[woocommerce_account_details_link_button_show]" type="checkbox" value="yes" <?php
     1004        echo  ( $woocommerce_account_details_link_button_show ? 'checked' : '' ) ;
     1005        ?> />
     1006                    <label for="ethpress_woocommerce_account_details_link_button_show">
     1007                        <?php
     1008        _e( 'Show the Link Wallet button on the WooCommerce Account Details page?', 'ethpress' );
     1009        ?>
     1010                    </label>
     1011                    <p class="description">
     1012                        <?php
     1013        _e( 'Check to the Link Wallet button on the WooCommerce Account Details page.', 'ethpress' );
     1014        ?></p>
     1015                    <?php
     1016        if ( \losnappas\Ethpress\ethpress_fs()->is_not_paying() ) {
     1017           
     1018            if ( \losnappas\Ethpress\ethpress_fs()->is_trial() ) {
     1019                ?>
     1020                            <h2 class="description"><?php
     1021                echo  '<a href="' . \losnappas\Ethpress\ethpress_fs()->get_upgrade_url() . '">' . __( 'Upgrade to keep using this feature!', 'ethpress' ) . '</a>' ;
     1022                ?></h2>
     1023                        <?php
     1024            } else {
     1025                ?>
     1026                            <h2 class="description"><?php
     1027                echo  '<a href="' . \losnappas\Ethpress\ethpress_fs()->get_upgrade_url() . '">' . __( 'Upgrade to use this feature!', 'ethpress' ) . '</a>' ;
     1028                ?></h2>
     1029                        <?php
     1030            }
     1031       
     1032        }
     1033       
     1034        if ( !$woocommerce_active ) {
     1035            ?>
     1036                        <h2 class="description"><?php
     1037            echo  '<a href="https://woocommerce.com/?aff=12943&cid=17113767">' . __( 'Install WooCommerce to use this feature!', 'ethpress' ) . '</a> ' . __( 'WooCommerce is a customizable, open-source eCommerce platform built on WordPress.', 'ethpress' ) ;
    7091038            ?></h2>
    7101039                    <?php
     
    7371066        $woocommerce_register_form_show = false;
    7381067        $woocommerce_after_checkout_registration_form_show = false;
     1068        $woocommerce_account_details_link_button_show = false;
     1069        $login_button_label = '';
     1070        $link_button_label = '';
     1071        $register_button_label = '';
     1072        $redirect_url = '';
    7391073        if ( empty($input['recursive']) && is_multisite() ) {
    7401074            // Mark next call as recursed.
     
    7421076        }
    7431077        $options['api_url'] = $newurl;
     1078        $options['redirect_url'] = $redirect_url;
    7441079        $options['use_managed_service'] = intval( $use_managed_service );
    7451080        $options['woocommerce_login_form_show'] = intval( $woocommerce_login_form_show );
    7461081        $options['woocommerce_register_form_show'] = intval( $woocommerce_register_form_show );
    7471082        $options['woocommerce_after_checkout_registration_form_show'] = intval( $woocommerce_after_checkout_registration_form_show );
     1083        $options['woocommerce_account_details_link_button_show'] = intval( $woocommerce_account_details_link_button_show );
     1084        $options['login_button_label'] = $login_button_label;
     1085        $options['link_button_label'] = $link_button_label;
     1086        $options['register_button_label'] = $register_button_label;
    7481087        if ( isset( $input['have_db_users'] ) ) {
    7491088            $options['have_db_users'] = $input['have_db_users'];
  • ethpress/trunk/app/Dependencies/BN/BN.php

    r2275868 r2775563  
    9393    }
    9494
     95    #[\ReturnTypeWillChange]
    9596    public function jsonSerialize() {
    9697        return $this->toString(16);
  • ethpress/trunk/app/Front.php

    r2664122 r2775563  
    11<?php
     2
    23/**
    34 * Handles front-end.
     
    67 * @package ethpress
    78 */
    8 
    99namespace losnappas\Ethpress;
    1010
    1111defined( 'ABSPATH' ) || die;
    12 
    13 use \losnappas\Ethpress\Plugin;
    14 
     12use  losnappas\Ethpress\Plugin ;
    1513/**
    1614 * Handles functions for frontend.
     
    1816 * @since 0.1.0
    1917 */
    20 class Front {
     18class Front
     19{
     20    /**
     21     * Displays login button. Hooked to login_form.
     22     *
     23     * @since 0.1.0
     24     */
     25    public static function login_form()
     26    {
     27        $text = esc_html__( 'Enable JavaScript to log in with a crypto wallet.', 'ethpress' );
     28        $noscript = '<noscript>' . $text . '</noscript>';
     29        // phpcs:disable -- Complains about not being escaped. They are.
     30        echo  $noscript ;
     31        ?>
     32        <div class="ethpress">
     33            <?php
     34        echo  self::get_login_button() ;
     35        ?>
     36        </div>
     37    <?php
     38        // phpcs:enable
     39    }
     40   
     41    /**
     42     * Gets the login form.
     43     *
     44     * @since 0.1.1
     45     */
     46    public static function get_login_form()
     47    {
     48        \ob_start();
     49        self::login_form();
     50        return \ob_get_clean();
     51    }
     52   
     53    /**
     54     * Creates necessary html for the login button.
     55     *
     56     * @since 0.1.0
     57     *
     58     * @return string Login button html.
     59     */
     60    public static function get_login_button()
     61    {
     62        \ob_start();
     63        self::login_button();
     64        return \ob_get_clean();
     65    }
     66   
     67    /**
     68     * Creates necessary html for the login button.
     69     *
     70     * @since 0.1.0
     71     *
     72     * @return string Login button html.
     73     */
     74    public static function login_button()
     75    {
     76        $label = esc_html__( 'Log In With a Crypto Wallet', 'ethpress' );
     77        ?>
     78        <button class="ethpress-metamask-login-button ethpress-button ethpress-button-secondary ethpress-button-large" type="button" name="metamask">
     79            <?php
     80        echo  $label ;
     81        ?>
     82        </button>
     83        <?php
     84    }
     85   
     86    /**
     87     * Creates necessary html for the link button.
     88     *
     89     * @since 1.5.12
     90     *
     91     * @return string Link button html.
     92     */
     93    public static function get_link_button()
     94    {
     95        \ob_start();
     96        self::link_button();
     97        return \ob_get_clean();
     98    }
     99   
     100    /**
     101     * Creates necessary html for the link button.
     102     *
     103     * @since 1.5.12
     104     *
     105     * @return void
     106     */
     107    public static function link_button()
     108    {
     109        Plugin::login_enqueue_scripts();
     110        $is_user_logged_in = is_user_logged_in();
     111       
     112        if ( !$is_user_logged_in ) {
     113            Front::login_form();
     114        } else {
     115            $label = esc_html__( 'Link Your Crypto Wallets', 'ethpress' );
     116            ?>
     117            <button class='ethpress-metamask-login-button ethpress-button ethpress-button-secondary ethpress-button-large ethpress-account-linker-button' type='button' name='metamask'>
     118                <?php
     119            echo  $label ;
     120            ?>
     121            </button>
     122        <?php
     123        }
     124   
     125    }
     126   
     127    /**
     128     * Displays register button. Hooked to register_form.
     129     *
     130     * @since 0.1.0
     131     */
     132    public static function register_form()
     133    {
     134        $text = esc_html__( 'Enable JavaScript to log in with a crypto wallet.', 'ethpress' );
     135        $noscript = '<noscript>' . $text . '</noscript>';
     136        // phpcs:disable -- Complains about not being escaped. They are.
     137        echo  $noscript ;
     138        ?>
     139        <div class="ethpress">
     140            <?php
     141        echo  self::get_register_button() ;
     142        ?>
     143        </div>
     144    <?php
     145        // phpcs:enable
     146    }
     147   
     148    /**
     149     * Gets the register form.
     150     *
     151     * @since 0.1.1
     152     */
     153    public static function get_register_form()
     154    {
     155        \ob_start();
     156        self::register_form();
     157        return \ob_get_clean();
     158    }
     159   
     160    /**
     161     * Creates necessary html for the register button.
     162     *
     163     * @since 0.1.0
     164     *
     165     * @return string Register button html.
     166     */
     167    public static function get_register_button()
     168    {
     169        \ob_start();
     170        self::register_button();
     171        return \ob_get_clean();
     172    }
     173   
     174    /**
     175     * Creates necessary html for the login button.
     176     *
     177     * @since 0.1.0
     178     *
     179     * @return string Login button html.
     180     */
     181    public static function register_button()
     182    {
     183        $label = esc_html__( 'Register With a Crypto Wallet', 'ethpress' );
     184        ?>
     185        <button class="ethpress-metamask-login-button ethpress-button ethpress-button-secondary ethpress-button-large" type="button" name="metamask">
     186            <?php
     187        echo  $label ;
     188        ?>
     189        </button>
     190<?php
     191    }
    21192
    22     /**
    23      * Displays login button. Hooked to login_form.
    24      *
    25      * @since 0.1.0
    26      */
    27     public static function login_form() {
    28         $text     = esc_html__( 'Enable JavaScript to log in with a crypto wallet.', 'ethpress' );
    29         $noscript = '<noscript>' . $text . '</noscript>';
    30 
    31         // phpcs:disable -- Complains about not being escaped. They are.
    32         echo $noscript;
    33         ?>
    34             <div class="ethpress">
    35                 <?php echo self::get_login_button(); ?>
    36             </div>
    37         <?php
    38         // phpcs:enable
    39     }
    40 
    41     /**
    42      * Gets the login form.
    43      *
    44      * @since 0.1.1
    45      */
    46     public static function get_login_form() {
    47         \ob_start();
    48         self::login_form();
    49         return \ob_get_clean();
    50     }
    51 
    52     /**
    53      * Creates necessary html for the login button.
    54      *
    55      * @since 0.1.0
    56      *
    57      * @return string Login button html.
    58      */
    59     public static function get_login_button() {
    60         $label  = esc_html__( 'Log In With a Crypto Wallet', 'ethpress' );
    61         $button = "
    62 <button class='ethpress-metamask-login-button ethpress-button ethpress-button-secondary ethpress-button-large' type='button' name='metamask'>
    63     $label
    64 </button>";
    65         return $button;
    66     }
    67 
    68     /**
    69      * Displays register button. Hooked to register_form.
    70      *
    71      * @since 0.1.0
    72      */
    73     public static function register_form() {
    74         $text     = esc_html__( 'Enable JavaScript to log in with a crypto wallet.', 'ethpress' );
    75         $noscript = '<noscript>' . $text . '</noscript>';
    76 
    77         // phpcs:disable -- Complains about not being escaped. They are.
    78         echo $noscript;
    79         ?>
    80             <div class="ethpress">
    81                 <?php echo self::get_register_button(); ?>
    82             </div>
    83         <?php
    84         // phpcs:enable
    85     }
    86 
    87     /**
    88      * Gets the register form.
    89      *
    90      * @since 0.1.1
    91      */
    92     public static function get_register_form() {
    93         \ob_start();
    94         self::register_form();
    95         return \ob_get_clean();
    96     }
    97 
    98     /**
    99      * Creates necessary html for the register button.
    100      *
    101      * @since 0.1.0
    102      *
    103      * @return string Register button html.
    104      */
    105     public static function get_register_button() {
    106         $label  = esc_html__( 'Register With a Crypto Wallet', 'ethpress' );
    107         $button = "
    108 <button class='ethpress-metamask-login-button ethpress-button ethpress-button-secondary ethpress-button-large' type='button' name='metamask'>
    109     $label
    110 </button>";
    111         return $button;
    112     }
    113193}
  • ethpress/trunk/app/Login.php

    r2754355 r2775563  
    11<?php
     2
    23/**
    34 * Controls login flow.
     
    67 * @since 0.1.0
    78 */
    8 
    99namespace losnappas\Ethpress;
    1010
    1111defined( 'ABSPATH' ) || die;
    12 
    13 use losnappas\Ethpress\Address;
    14 use losnappas\Ethpress\Signature;
    15 use losnappas\Ethpress\Nonce;
     12use  losnappas\Ethpress\Address ;
     13use  losnappas\Ethpress\Signature ;
     14use  losnappas\Ethpress\Nonce ;
    1615/**
    1716 * In php, wp_enqueue_script( 'ethpress-login' ); and then you can call ethpress.metamask.connect in javascript.
     
    1918 * @since 0.1.0
    2019 */
    21 class Login {
    22 
    23     /**
    24      * Ajax: verifies signed message by re-creating the message again and extracting the address.
    25      *
    26      * @since 0.1.0
    27      */
    28     public static function verify_login() {
    29         check_ajax_referer( 'ethpress_log_in' );
    30 
    31         $message = '';
    32         $success = true;
    33 
    34         if ( ! isset( $_POST['coinbase'], $_POST['signature'] ) ) {
    35             wp_send_json_error( [ 'message' => esc_html__( 'Invalid input', 'ethpress' ) ] );
    36         }
    37 
    38         // Sanitize.
    39         // These two show up as linter errors, but that is a bug in the linter itself.
    40         $coinbase              = Address::sanitize( wp_unslash( $_POST['coinbase'] ) );
    41         $signature             = Address::sanitize( wp_unslash( $_POST['signature'] ) );
    42         $requested_redirect_to = '';
    43         if ( ! empty( $_POST['redirect_to'] ) ) {
    44             $redirect_to           = wp_sanitize_redirect( wp_unslash( $_POST['redirect_to'] ) );
    45             $requested_redirect_to = $redirect_to;
    46         } else {
    47             $redirect_to = admin_url();
    48         }
    49 
    50         // Verify.
    51         $message  = self::get_login_message( $coinbase );
    52         $verified = Signature::verify( $message, $signature, $coinbase );
    53 
    54         if ( $verified ) {
    55             // Log in.
    56             try {
    57                 $address = new Address( $coinbase );
    58                 if ( get_option( 'users_can_register' ) ) {
    59                     $user = $address->register_and_log_in();
    60                 } else {
    61                     $user = $address->log_in();
    62                 }
    63                 $message = esc_html__( 'Logged in', 'ethpress' );
    64                 // phpcs:ignore -- This is using wp original hook.
    65                 $redirect_to = apply_filters( 'login_redirect', $redirect_to, $requested_redirect_to, $user );
    66             } catch ( \WP_Error $e ) {
    67                 $user = $e;
    68             }
    69         } else {
    70             $user = new \WP_Error( 'ethpress', __( 'Signature err, try again.', 'ethpress' ) );
    71         }
    72 
    73         if ( isset( $_POST['provider'] ) ) {
    74             $provider = \sanitize_key( \wp_unslash( (string) $_POST['provider'] ) );
    75         } else {
    76             $provider = false;
    77         }
    78 
    79         /**
    80          * Fires after every login attempt.
    81          *
    82          * @since 0.1.0
    83          *
    84          * @param WP_User|WP_Error $user WP_User on success, WP_Error on failure.
    85          * @param (string|false) $provider One of 'metamask', 'walletconnect', false.
    86          */
    87         do_action( 'ethpress_login', $user, $provider );
    88 
    89         if ( is_wp_error( $user ) ) {
    90             $message = $user->get_error_message();
    91             $success = false;
    92         } elseif ( ( empty( $redirect_to ) || 'wp-admin/' === $redirect_to || admin_url() === $redirect_to ) ) {
    93             // Redirect.
    94             // Copied from wp-login.php.
    95             // If the user doesn't belong to a blog, send them to user admin. If the user can't edit posts, send them to their profile.
    96             if ( is_multisite() && ! get_active_blog_for_user( $user->ID ) && ! is_super_admin( $user->ID ) ) {
    97                 $redirect_to = user_admin_url();
    98             } elseif ( is_multisite() && ! $user->has_cap( 'read' ) ) {
    99                 $redirect_to = get_dashboard_url( $user->ID );
    100             } elseif ( ! $user->has_cap( 'edit_posts' ) ) {
    101                 $redirect_to = $user->has_cap( 'read' ) ? admin_url( 'profile.php' ) : home_url();
    102             }
    103         }
    104 
    105         wp_send_json(
    106             [
    107                 'data'    => [
    108                     'redirect' => $redirect_to,
    109                     'message'  => $message,
    110                 ],
    111                 'success' => $success,
    112             ]
    113         );
    114     }
    115 
    116     /**
    117      * Gets login message to be signed for address.
    118      *
    119      * @since 0.1.0
    120      *
    121      * @param string $coinbase Address.
    122      * @return string Message.
    123      */
    124     public static function get_login_message( $coinbase ) {
    125         $message = sprintf(
    126             /* translators: blog name. */
    127             __(
    128                 'Log in to %1$s',
    129                 'ethpress'
    130             ),
    131             get_bloginfo( 'name', 'display' )
    132         ) . "\n\n" . get_home_url();
    133         $nonce = Nonce::get( $coinbase );
    134 
    135         /**
    136          * Filters the message to show in the login dialog.
    137          *
    138          * The message needs to be the same when it is signed and when it is verified.
    139          * Nonce will be added on a new line.
    140          *
    141          * @since 0.1.0
    142          * @since 0.7.0 Has wallet address as 2nd argument: $coinbase. Client ip is now hashed with nonce.
    143          *
    144          * @param string $message Message.
    145          * @param string $coinbase User's address.
    146          */
    147         $message  = apply_filters( 'ethpress_login_message', $message, $coinbase );
    148         $message .= "\n\n" . $nonce;
    149         return $message;
    150     }
    151 
    152     /**
    153      * Ajax: sends login message. Used to use GET, but now using POST, thus using _REQUEST.
    154      *
    155      * @since 0.1.0
    156      */
    157     public static function get_message() {
    158         $referer_ok = check_ajax_referer( 'ethpress_get_message', false, false );
    159         if ( ! $referer_ok ) {
    160             // User had probably logged in without cookies enabled.
    161             wp_send_json_error( esc_html__( 'Bad nonce, please refresh.', 'ethpress' ) );
    162         } elseif ( ! empty( $_REQUEST['coinbase'] ) ) {
    163             // This shows up as lint error, but that is a bug in the linter itself.
    164             $coinbase = Address::sanitize( wp_unslash( $_REQUEST['coinbase'] ) );
    165             $message  = self::get_login_message( $coinbase );
    166             wp_send_json_success( $message );
    167         } else {
    168             wp_send_json_error( esc_html__( 'No address specified.', 'ethpress' ) );
    169         }
    170     }
    171 
    172     /**
    173      * Deletes table row when user is deleted.
    174      *
    175      * @since 0.1.0
    176      *
    177      * @param int $user_id Id of the user being deleted.
    178      */
    179     public static function destroy( $user_id ) {
    180         $address = Address::find_by_user( $user_id );
    181         if ( ! is_wp_error( $address ) ) {
    182             $address->delete();
    183         }
    184         /**
    185          * Fires after address table row was attempted deleted.
    186          *
    187          * @since 0.1.0
    188          *
    189          * @param int $user_id User id of address that was attempted deleted.
    190          * @param Address|WP_Error $address Address if deletiong success, WP_Error otherwise.
    191          */
    192         do_action( 'ethpress_destroyed', $user_id, $address );
    193     }
    194 
    195     /**
    196      * Attaches user to blog.
    197      *
    198      * @since 0.2.4
    199      *
    200      * @param WP_User $user User to add.
    201      * @return true|void|\WP_Error True if success. Nothing if not multisite. WP_Error if error.
    202      */
    203     public static function attach_user_to_blog( $user ) {
    204         if ( ! empty( $user ) && ! is_wp_error( $user ) && is_multisite() ) {
    205             $blog_id          = get_current_blog_id();
    206             $existing_user_id = $user->ID;
    207             if ( ! is_user_member_of_blog( $existing_user_id, $blog_id ) ) {
    208 
     20class Login
     21{
     22    /**
     23     * Ajax: verifies signed message by re-creating the message again and extracting the address.
     24     *
     25     * @since 0.1.0
     26     */
     27    public static function verify_login()
     28    {
     29        check_ajax_referer( 'ethpress_log_in' );
     30        $message = '';
     31        $success = true;
     32        if ( !isset( $_POST['coinbase'], $_POST['signature'] ) ) {
     33            wp_send_json_error( [
     34                'message' => esc_html__( 'Invalid input', 'ethpress' ),
     35            ] );
     36        }
     37        // Sanitize.
     38        // These two show up as linter errors, but that is a bug in the linter itself.
     39        $coinbase = Address::sanitize( wp_unslash( $_POST['coinbase'] ) );
     40        $signature = Address::sanitize( wp_unslash( $_POST['signature'] ) );
     41        $requested_redirect_to = '';
     42       
     43        if ( !empty($_POST['redirect_to']) ) {
     44            $redirect_to = wp_sanitize_redirect( wp_unslash( $_POST['redirect_to'] ) );
     45            $requested_redirect_to = $redirect_to;
     46        } else {
     47            $redirect_to = admin_url();
     48        }
     49       
     50        // Verify.
     51        $message = self::get_login_message( $coinbase );
     52        $verified = Signature::verify( $message, $signature, $coinbase );
     53       
     54        if ( $verified ) {
     55            // Log in.
     56            try {
     57                $address = new Address( $coinbase );
     58               
     59                if ( get_option( 'users_can_register' ) ) {
     60                    $user = $address->register_and_log_in();
     61                } else {
     62                    $user = $address->log_in();
     63                }
     64               
     65                $message = esc_html__( 'Logged in', 'ethpress' );
     66                // phpcs:ignore -- This is using wp original hook.
     67                $redirect_to = apply_filters(
     68                    'login_redirect',
     69                    $redirect_to,
     70                    $requested_redirect_to,
     71                    $user
     72                );
     73            } catch ( \WP_Error $e ) {
     74                $user = $e;
     75            }
     76        } else {
     77            $user = new \WP_Error( 'ethpress', __( 'Signature err, try again.', 'ethpress' ) );
     78        }
     79       
     80       
     81        if ( isset( $_POST['provider'] ) ) {
     82            $provider = \sanitize_key( \wp_unslash( (string) $_POST['provider'] ) );
     83        } else {
     84            $provider = false;
     85        }
     86       
     87        /**
     88         * Fires after every login attempt.
     89         *
     90         * @since 0.1.0
     91         *
     92         * @param \WP_User|\WP_Error $user WP_User on success, WP_Error on failure.
     93         * @param (string|false) $provider One of 'metamask', 'walletconnect', false.
     94         */
     95        do_action( 'ethpress_login', $user, $provider );
     96       
     97        if ( is_wp_error( $user ) ) {
     98            $message = $user->get_error_message();
     99            $success = false;
     100        } elseif ( empty($redirect_to) || 'wp-admin/' === $redirect_to || admin_url() === $redirect_to ) {
     101            /**
     102             * @var \WP_User
     103             */
     104            $user = $user;
     105            // Redirect.
     106            // Copied from wp-login.php.
     107            // If the user doesn't belong to a blog, send them to user admin. If the user can't edit posts, send them to their profile.
     108           
     109            if ( is_multisite() && !get_active_blog_for_user( $user->ID ) && !is_super_admin( $user->ID ) ) {
     110                $redirect_to = user_admin_url();
     111            } elseif ( is_multisite() && !$user->has_cap( 'read' ) ) {
     112                $redirect_to = get_dashboard_url( $user->ID );
     113            } elseif ( !$user->has_cap( 'edit_posts' ) ) {
     114                $redirect_to = ( $user->has_cap( 'read' ) ? admin_url( 'profile.php' ) : home_url() );
     115            }
     116       
     117        }
     118       
     119        wp_send_json( [
     120            'data'    => [
     121            'redirect' => $redirect_to,
     122            'message'  => $message,
     123        ],
     124            'success' => $success,
     125        ] );
     126    }
     127   
     128    /**
     129     * Gets login message to be signed for address.
     130     *
     131     * @since 0.1.0
     132     *
     133     * @param string $coinbase Address.
     134     * @return string Message.
     135     */
     136    public static function get_login_message( $coinbase )
     137    {
     138        $message = sprintf(
     139            /* translators: blog name. */
     140            __( 'Log in to %1$s', 'ethpress' ),
     141            get_bloginfo( 'name', 'display' )
     142        ) . "\n\n" . get_home_url();
     143        $nonce = Nonce::get( $coinbase );
     144        /**
     145         * Filters the message to show in the login dialog.
     146         *
     147         * The message needs to be the same when it is signed and when it is verified.
     148         * Nonce will be added on a new line.
     149         *
     150         * @since 0.1.0
     151         * @since 0.7.0 Has wallet address as 2nd argument: $coinbase. Client ip is now hashed with nonce.
     152         *
     153         * @param string $message Message.
     154         * @param string $coinbase User's address.
     155         */
     156        $message = apply_filters( 'ethpress_login_message', $message, $coinbase );
     157        $message .= "\n\n" . $nonce;
     158        return $message;
     159    }
     160   
     161    /**
     162     * Ajax: sends login message. Used to use GET, but now using POST, thus using _REQUEST.
     163     *
     164     * @since 0.1.0
     165     */
     166    public static function get_message()
     167    {
     168        $referer_ok = check_ajax_referer( 'ethpress_get_message', false, false );
     169       
     170        if ( !$referer_ok ) {
     171            // User had probably logged in without cookies enabled.
     172            wp_send_json_error( esc_html__( 'Bad nonce, please refresh.', 'ethpress' ) );
     173        } elseif ( !empty($_REQUEST['coinbase']) ) {
     174            // This shows up as lint error, but that is a bug in the linter itself.
     175            $coinbase = Address::sanitize( wp_unslash( $_REQUEST['coinbase'] ) );
     176            $message = self::get_login_message( $coinbase );
     177            wp_send_json_success( $message );
     178        } else {
     179            wp_send_json_error( esc_html__( 'No address specified.', 'ethpress' ) );
     180        }
     181   
     182    }
     183   
     184    /**
     185     * Deletes table row when user is deleted.
     186     *
     187     * @since 0.1.0
     188     *
     189     * @param int $user_id Id of the user being deleted.
     190     */
     191    public static function destroy( $user_id )
     192    {
     193        $address = Address::find_by_user( $user_id );
     194        if ( !is_wp_error( $address ) ) {
     195            $address->delete();
     196        }
     197        /**
     198         * Fires after address table row was attempted deleted.
     199         *
     200         * @since 0.1.0
     201         *
     202         * @param int $user_id User id of address that was attempted deleted.
     203         * @param Address|WP_Error $address Address if deletiong success, WP_Error otherwise.
     204         */
     205        do_action( 'ethpress_destroyed', $user_id, $address );
     206    }
     207   
     208    /**
     209     * Attaches user to blog.
     210     *
     211     * @since 0.2.4
     212     *
     213     * @param WP_User $user User to add.
     214     * @return true|void|\WP_Error True if success. Nothing if not multisite. WP_Error if error.
     215     */
     216    public static function attach_user_to_blog( $user )
     217    {
     218       
     219        if ( !empty($user) && !is_wp_error( $user ) && is_multisite() ) {
     220            $blog_id = get_current_blog_id();
     221            $existing_user_id = $user->ID;
     222           
     223            if ( !is_user_member_of_blog( $existing_user_id, $blog_id ) ) {
    209224                // @see https://stackoverflow.com/a/12178249/4256005
    210                 $role = get_option('default_role');
    211                 if (empty($role)) {
     225                $role = get_option( 'default_role' );
     226                if ( empty($role) ) {
    212227                    // https://wordpress.org/support/article/multisite-network-administration/
    213                     // "By design, all users who are added to your network will have subscriber access to all sites on your network".
     228                    // "By design, all users who are added to your network will have subscriber access to all sites on your network".
    214229                    $role = 'subscriber';
    215230                }
    216                 $result = add_user_to_blog( $blog_id, $existing_user_id, $role );
    217 
    218                 return $result;
    219             }
    220         }
    221     }
     231                $result = add_user_to_blog( $blog_id, $existing_user_id, $role );
     232                return $result;
     233            }
     234       
     235        }
     236   
     237    }
    222238
    223239}
  • ethpress/trunk/app/Plugin.php

    r2763568 r2775563  
    1212use  losnappas\Ethpress\Upgrade ;
    1313use  losnappas\Ethpress\Shortcodes\LoginButton ;
     14use  losnappas\Ethpress\Shortcodes\LinkButton ;
    1415use  losnappas\Ethpress\Shortcodes\LoggedAccount ;
    1516use  losnappas\Ethpress\Logger ;
     
    4950            'woocommerce_register_form_show'                    => '0',
    5051            'woocommerce_after_checkout_registration_form_show' => '0',
     52            'woocommerce_account_details_link_button_show'      => '0',
    5153        ];
    5254        $options = \get_site_option( 'ethpress', $defopts );
     
    6870        add_action( 'ethpress_login', [ ETHPRESS_NS . '\\Login', 'attach_user_to_blog' ] );
    6971        add_shortcode( LoginButton::$shortcode_name, [ ETHPRESS_NS . '\\Shortcodes\\LoginButton', 'add_shortcode' ] );
     72        add_shortcode( LinkButton::$shortcode_name, [ ETHPRESS_NS . '\\Shortcodes\\LinkButton', 'add_shortcode' ] );
    7073        add_action( 'widgets_init', [ ETHPRESS_NS . '\\Widgets\\Button', 'widgets_init' ] );
    7174        add_action( 'show_user_profile', [ ETHPRESS_NS . '\\Widgets\\Button', 'show_user_profile' ] );
     
    245248        $woocommerce_register_form_show = false;
    246249        $woocommerce_after_checkout_registration_form_show = false;
     250        $woocommerce_account_details_link_button_show = false;
     251        $login_button_label = '';
     252        $link_button_label = '';
     253        $register_button_label = '';
     254        $redirect_url = '';
    247255        $opts = [
    248256            'db_version'                                        => $db_version,
     
    251259            'woocommerce_register_form_show'                    => $woocommerce_register_form_show,
    252260            'woocommerce_after_checkout_registration_form_show' => $woocommerce_after_checkout_registration_form_show,
     261            'woocommerce_account_details_link_button_show'      => $woocommerce_account_details_link_button_show,
     262            'login_button_label'                                => $login_button_label,
     263            'link_button_label'                                 => $link_button_label,
     264            'register_button_label'                             => $register_button_label,
     265            'redirect_url'                                      => $redirect_url,
    253266        ];
    254267        /**
  • ethpress/trunk/app/Widgets/Button.php

    r2350902 r2775563  
    11<?php
     2
    23/**
    34 * Ethpress widget: a button
     
    89namespace losnappas\Ethpress\Widgets;
    910
    10 defined( 'ABSPATH' ) || die;
     11defined('ABSPATH') || die;
    1112
    1213use losnappas\Ethpress\Plugin;
     
    1920 * @since 0.7.0
    2021 */
    21 class Button extends \WP_Widget {
     22class Button extends \WP_Widget
     23{
    2224
    2325    /**
     
    2628     * @since 0.7.0
    2729     */
    28     public function __construct() {
     30    public function __construct()
     31    {
    2932        $widget_ops = array(
    3033            'classname'   => 'ethpress-widget',
    31             'description' => esc_html__( 'EthPress Widget', 'ethpress' ),
     34            'description' => esc_html__('EthPress Widget', 'ethpress'),
    3235        );
    33         parent::__construct( 'ethpress', esc_html__( 'EthPress', 'ethpress' ), $widget_ops );
     36        parent::__construct('ethpress', esc_html__('EthPress', 'ethpress'), $widget_ops);
    3437    }
    3538
     
    4245     * @param array $instance Saved values from database.
    4346     */
    44     public function widget( $args, $instance ) {
     47    public function widget($args, $instance)
     48    {
    4549        $is_user_logged_in = is_user_logged_in();
    4650
    4751        // This means it's going into admin dashboard.
    48         if ( ! is_array( $args ) ) {
     52        if (!is_array($args)) {
    4953            $args = [
    5054                'before_widget' => '<div class="ethpress" id="ethpress-dashboard-widget">',
     
    5761        // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- These are supposed to be unescaped.
    5862        echo $args['before_widget'];
    59         if ( ! empty( $instance['title'] ) ) {
     63        if (!empty($instance['title'])) {
    6064            // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- These are supposed to be unescaped.
    61             echo $args['before_title'] . apply_filters( 'widget_title', $instance['title'] ) . $args['after_title'];
     65            echo $args['before_title'] . apply_filters('widget_title', $instance['title']) . $args['after_title'];
    6266        }
    6367
    64         Plugin::login_enqueue_scripts();
    65         if ( ! $is_user_logged_in ) {
    66             Front::login_form();
    67         } else {
    68             ?>
    69             <button class='ethpress-metamask-login-button ethpress-button ethpress-button-secondary ethpress-button-large ethpress-account-linker-button' type='button' name='metamask'>
    70                 <?php esc_html_e( 'Link Your Crypto Wallets', 'ethpress' ); ?>
    71             </button>
    72             <?php
    73         }
     68        Front::link_button();
     69
    7470        // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- These are supposed to be unescaped.
    7571        echo $args['after_widget'];
     
    8177     * @param array $instance The widget options.
    8278     */
    83     public function form( $instance ) {
    84         $title = ! empty( $instance['title'] ) ? $instance['title'] : '';
    85         ?>
     79    public function form($instance)
     80    {
     81        $title = !empty($instance['title']) ? $instance['title'] : '';
     82?>
    8683        <p>
    87         <label for="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>"><?php esc_html_e( 'Title:', 'ethpress' ); ?></label>
    88         <input class="widefat" id="<?php echo esc_attr( $this->get_field_id( 'title' ) ); ?>" name ="<?php echo esc_attr( $this->get_field_name( 'title' ) ); ?>" type="text" value="<?php echo esc_attr( $title ); ?>">
     84            <label for="<?php echo esc_attr($this->get_field_id('title')); ?>"><?php esc_html_e('Title:', 'ethpress'); ?></label>
     85            <input class="widefat" id="<?php echo esc_attr($this->get_field_id('title')); ?>" name="<?php echo esc_attr($this->get_field_name('title')); ?>" type="text" value="<?php echo esc_attr($title); ?>">
    8986        </p>
    90         <?php
     87    <?php
    9188    }
    9289
     
    10198     * @return array
    10299     */
    103     public function update( $new_instance, $old_instance ) {
     100    public function update($new_instance, $old_instance)
     101    {
    104102        $instance          = array();
    105         $instance['title'] = ( ! empty( $new_instance['title'] ) ) ? sanitize_text_field( $new_instance['title'] ) : '';
     103        $instance['title'] = (!empty($new_instance['title'])) ? sanitize_text_field($new_instance['title']) : '';
    106104        return $instance;
    107105    }
     
    112110     * @since 0.7.0
    113111     */
    114     public static function widgets_init() {
    115         register_widget( ETHPRESS_NS . '\Widgets\Button' );
     112    public static function widgets_init()
     113    {
     114        register_widget(ETHPRESS_NS . '\Widgets\Button');
    116115
    117116        global $pagenow;
    118117        $login_page    = wp_login_url();
    119         $is_login_page = false !== stripos( $login_page, $pagenow );
    120         if ( isset( $_SERVER['SCRIPT_NAME'] ) ) {
     118        $is_login_page = false !== stripos($login_page, $pagenow);
     119        if (isset($_SERVER['SCRIPT_NAME'])) {
    121120            // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- we are simply comparing.
    122             $is_login_page = $is_login_page || false !== stripos( $login_page, wp_unslash( $_SERVER['SCRIPT_NAME'] ) );
     121            $is_login_page = $is_login_page || false !== stripos($login_page, wp_unslash($_SERVER['SCRIPT_NAME']));
    123122        }
    124         $ajax = defined( 'DOING_AJAX' ) && DOING_AJAX;
    125         if ( function_exists( 'wp_doing_ajax' ) ) {
     123        $ajax = defined('DOING_AJAX') && DOING_AJAX;
     124        if (function_exists('wp_doing_ajax')) {
    126125            $ajax = wp_doing_ajax();
    127126        }
    128         if ( isset( $_SERVER['HTTP_REFERER'] ) && $ajax ) {
     127        if (isset($_SERVER['HTTP_REFERER']) && $ajax) {
    129128            // phpcs:ignore WordPress.Security.ValidatedSanitizedInput.InputNotSanitized -- we are simply comparing.
    130             $is_login_page = $is_login_page || false !== stripos( wp_unslash( $_SERVER['HTTP_REFERER'] ), $login_page );
     129            $is_login_page = $is_login_page || false !== stripos(wp_unslash($_SERVER['HTTP_REFERER']), $login_page);
    131130        }
    132         if ( ! $is_login_page && is_user_logged_in() ) {
    133             add_action( 'wp_ajax_ethpress_link_account', [ ETHPRESS_NS . '\Linker', 'link_account' ] );
    134             add_filter( 'ethpress_login_message', [ ETHPRESS_NS . '\Linker', 'login_message' ] );
     131        if (!$is_login_page && is_user_logged_in()) {
     132            add_action('wp_ajax_ethpress_link_account', [ETHPRESS_NS . '\Linker', 'link_account']);
     133            add_filter('ethpress_login_message', [ETHPRESS_NS . '\Linker', 'login_message']);
    135134            add_filter(
    136135                'ethpress_login_inline_script',
    137                 [ ETHPRESS_NS . '\Linker', 'ethpress_login_inline_script' ]
     136                [ETHPRESS_NS . '\Linker', 'ethpress_login_inline_script']
    138137            );
    139138        }
     
    145144     * @since 0.7.0
    146145     */
    147     public static function show_user_profile() {
    148         ?>
    149         <h3><?php esc_html_e( 'Crypto Wallet', 'ethpress' ); ?></h3>
    150         <p><?php esc_html_e( 'After linking a crypto wallet to your account, you can use it to log in.', 'ethpress' ); ?></p>
    151         <?php
     146    public static function show_user_profile()
     147    {
     148    ?>
     149        <h3><?php esc_html_e('Crypto Wallet', 'ethpress'); ?></h3>
     150        <p><?php esc_html_e('After linking a crypto wallet to your account, you can use it to log in.', 'ethpress'); ?></p>
     151<?php
    152152        self::widgets_init();
    153153        $widget = new Button();
    154         $widget->widget( null, null );
     154        $widget->widget(null, null);
    155155        Plugin::register_scripts();
    156156        Plugin::login_enqueue_scripts_and_styles();
    157157    }
    158158}
    159 
  • ethpress/trunk/ethpress.php

    r2765503 r2775563  
    66 * Description: Ethereum Web3 login. Enable crypto wallet logins to WordPress.
    77 * Author: Lynn (lynn.mvp at tutanota dot com), ethereumicoio
    8  * Version: 1.5.11
     8 * Version: 1.5.12
    99 * Author URI: https://ethereumico.io
    1010 * Text Domain: ethpress
  • ethpress/trunk/languages/ethpress.pot

    r2765503 r2775563  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: EthPress 1.5.11\n"
     5"Project-Id-Version: EthPress 1.5.12\n"
    66"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/ethpress\n"
    7 "POT-Creation-Date: 2022-08-03 05:10:43+00:00\n"
     7"POT-Creation-Date: 2022-08-25 13:30:23+00:00\n"
    88"MIME-Version: 1.0\n"
    99"Content-Type: text/plain; charset=utf-8\n"
     
    8989msgstr ""
    9090
    91 #: app/Admin/Options.php:147 app/Admin/Options.php:237
     91#: app/Admin/Options.php:147 app/Admin/Options.php:244
    9292msgid ""
    9393"If you like <strong>EthPress</strong> please leave us a %1$s rating. A huge "
     
    107107msgstr ""
    108108
    109 #: app/Admin/Options.php:228
     109#: app/Admin/Options.php:235
    110110msgid "Save Changes"
    111111msgstr ""
    112112
    113 #: app/Admin/Options.php:229
     113#: app/Admin/Options.php:236
    114114msgid "Are you sure you want to delete all EthPress options?"
    115115msgstr ""
    116116
    117 #: app/Admin/Options.php:229
     117#: app/Admin/Options.php:236
    118118msgid "Reset"
    119119msgstr ""
    120120
    121 #: app/Admin/Options.php:264
     121#: app/Admin/Options.php:271
    122122msgid "Main Settings"
    123123msgstr ""
    124124
    125 #: app/Admin/Options.php:284
     125#: app/Admin/Options.php:291
    126126msgid "Login Display Settings"
    127127msgstr ""
    128128
    129 #: app/Admin/Options.php:309 app/Admin/Options.php:469
    130 msgid "WooCommerce Login Form"
    131 msgstr ""
    132 
    133 #: app/Admin/Options.php:315 app/Admin/Options.php:396
     129#: app/Admin/Options.php:311
     130msgid "Labels Settings"
     131msgstr ""
     132
     133#: app/Admin/Options.php:327 app/Front.php:79 app/Plugin.php:313
     134msgid "Log In With a Crypto Wallet"
     135msgstr ""
     136
     137#: app/Admin/Options.php:331
     138msgid "Login button label"
     139msgstr ""
     140
     141#: app/Admin/Options.php:343
     142msgid "The Login button text can be set there."
     143msgstr ""
     144
     145#: app/Admin/Options.php:348 app/Admin/Options.php:392
     146#: app/Admin/Options.php:436 app/Admin/Options.php:562
     147#: app/Admin/Options.php:632 app/Admin/Options.php:702
     148#: app/Admin/Options.php:774 app/Admin/Options.php:851
     149#: app/Admin/Options.php:928
     150msgid "Upgrade to keep using this feature!"
     151msgstr ""
     152
     153#: app/Admin/Options.php:352 app/Admin/Options.php:396
     154#: app/Admin/Options.php:440 app/Admin/Options.php:566
     155#: app/Admin/Options.php:636 app/Admin/Options.php:706
     156#: app/Admin/Options.php:778 app/Admin/Options.php:855
     157#: app/Admin/Options.php:932
     158msgid "Upgrade to use this feature!"
     159msgstr ""
     160
     161#: app/Admin/Options.php:371 app/Front.php:125 app/Plugin.php:314
     162msgid "Link Your Crypto Wallets"
     163msgstr ""
     164
     165#: app/Admin/Options.php:375 app/Admin/Options.php:419
     166msgid "Link button label"
     167msgstr ""
     168
     169#: app/Admin/Options.php:387 app/Admin/Options.php:431
     170msgid "The Link button text can be set there."
     171msgstr ""
     172
     173#: app/Admin/Options.php:415 app/Front.php:199 app/Plugin.php:315
     174msgid "Register With a Crypto Wallet"
     175msgstr ""
     176
     177#: app/Admin/Options.php:468
     178msgid "Verification Service API URL"
     179msgstr ""
     180
     181#: app/Admin/Options.php:474 app/Admin/Options.php:607
    134182msgid ""
    135183"Your PHP installation has the necessary PHP extension to do verifications "
     
    137185msgstr ""
    138186
    139 #: app/Admin/Options.php:326
     187#: app/Admin/Options.php:485
    140188msgid ""
    141189"Use an API or install %1$sPHP-GMP%2$s or %3$sPHP-BCMath%2$s to verify "
     
    143191msgstr ""
    144192
    145 #: app/Admin/Options.php:346
     193#: app/Admin/Options.php:505
    146194#. translators: a link.
    147195msgid "To deploy your own verification service, see %1$s."
    148196msgstr ""
    149197
    150 #: app/Admin/Options.php:390
     198#: app/Admin/Options.php:542
     199msgid "Redirect URL"
     200msgstr ""
     201
     202#: app/Admin/Options.php:554
     203msgid "The page to redirect after a successful login"
     204msgstr ""
     205
     206#: app/Admin/Options.php:601
    151207msgid "Managed Verification Service"
    152208msgstr ""
    153209
    154 #: app/Admin/Options.php:410
     210#: app/Admin/Options.php:621
    155211msgid "Use Managed Verification Service"
    156212msgstr ""
    157213
    158 #: app/Admin/Options.php:413
     214#: app/Admin/Options.php:624
    159215msgid "Check to use the Managed Verification Service."
    160216msgstr ""
    161217
    162 #: app/Admin/Options.php:421
    163 msgid "Upgrade to keep using the Managed Verification Service API feature!"
    164 msgstr ""
    165 
    166 #: app/Admin/Options.php:425
    167 msgid "Upgrade to use the Managed Verification Service API feature!"
    168 msgstr ""
    169 
    170 #: app/Admin/Options.php:480
     218#: app/Admin/Options.php:680
     219msgid "WooCommerce Login Form"
     220msgstr ""
     221
     222#: app/Admin/Options.php:691
    171223msgid "Show on WooCommerce Login Form?"
    172224msgstr ""
    173225
    174 #: app/Admin/Options.php:483
     226#: app/Admin/Options.php:694
    175227msgid "Check to show EthPress login button on the WooCommerce Login Form."
    176228msgstr ""
    177229
    178 #: app/Admin/Options.php:491
    179 msgid "Upgrade to keep using the WooCommerce Login Form feature!"
    180 msgstr ""
    181 
    182 #: app/Admin/Options.php:495
    183 msgid "Upgrade to use the WooCommerce Login Form feature!"
    184 msgstr ""
    185 
    186 #: app/Admin/Options.php:501 app/Admin/Options.php:573
    187 #: app/Admin/Options.php:650
     230#: app/Admin/Options.php:712 app/Admin/Options.php:784
     231#: app/Admin/Options.php:861 app/Admin/Options.php:938
    188232msgid "Install WooCommerce to use this feature!"
    189233msgstr ""
    190234
    191 #: app/Admin/Options.php:501 app/Admin/Options.php:573
    192 #: app/Admin/Options.php:650
     235#: app/Admin/Options.php:712 app/Admin/Options.php:784
     236#: app/Admin/Options.php:861 app/Admin/Options.php:938
    193237msgid ""
    194238"WooCommerce is a customizable, open-source eCommerce platform built on "
     
    196240msgstr ""
    197241
    198 #: app/Admin/Options.php:541
     242#: app/Admin/Options.php:752
    199243msgid "WooCommerce Register Form"
    200244msgstr ""
    201245
    202 #: app/Admin/Options.php:552
     246#: app/Admin/Options.php:763
    203247msgid "Show on WooCommerce Register Form?"
    204248msgstr ""
    205249
    206 #: app/Admin/Options.php:555
     250#: app/Admin/Options.php:766
    207251msgid "Check to show EthPress register button on the WooCommerce Register Form."
    208252msgstr ""
    209253
    210 #: app/Admin/Options.php:563
    211 msgid "Upgrade to keep using the WooCommerce Register Form feature!"
    212 msgstr ""
    213 
    214 #: app/Admin/Options.php:567
    215 msgid "Upgrade to use the WooCommerce Register Form feature!"
    216 msgstr ""
    217 
    218 #: app/Admin/Options.php:578 app/Admin/Options.php:655
     254#: app/Admin/Options.php:789 app/Admin/Options.php:866
    219255msgid ""
    220256"Check the Administration > Settings > General > Membership: Anyone can "
     
    222258msgstr ""
    223259
    224 #: app/Admin/Options.php:618
     260#: app/Admin/Options.php:829
    225261msgid "WooCommerce Checkout Page Register Form"
    226262msgstr ""
    227263
    228 #: app/Admin/Options.php:629
     264#: app/Admin/Options.php:840
    229265msgid "Show on the WooCommerce Checkout page?"
    230266msgstr ""
    231267
    232 #: app/Admin/Options.php:632
     268#: app/Admin/Options.php:843
    233269msgid "Check to show EthPress register button on the WooCommerce Checkout page."
    234270msgstr ""
    235271
    236 #: app/Admin/Options.php:640
    237 msgid "Upgrade to keep using the WooCommerce Register on a Checkout page feature!"
    238 msgstr ""
    239 
    240 #: app/Admin/Options.php:644
    241 msgid "Upgrade to use the WooCommerce Register on a Checkout page feature!"
    242 msgstr ""
    243 
    244 #: app/Admin/Options.php:719
     272#: app/Admin/Options.php:906
     273msgid "WooCommerce Account Details Link Wallet Form"
     274msgstr ""
     275
     276#: app/Admin/Options.php:917
     277msgid "Show the Link Wallet button on the WooCommerce Account Details page?"
     278msgstr ""
     279
     280#: app/Admin/Options.php:920
     281msgid "Check to the Link Wallet button on the WooCommerce Account Details page."
     282msgstr ""
     283
     284#: app/Admin/Options.php:1017
    245285msgid "Settings"
    246286msgstr ""
    247287
    248 #: app/Front.php:28 app/Front.php:74
     288#: app/Front.php:31 app/Front.php:151
    249289msgid "Enable JavaScript to log in with a crypto wallet."
    250 msgstr ""
    251 
    252 #: app/Front.php:60
    253 msgid "Log In With a Crypto Wallet"
    254 msgstr ""
    255 
    256 #: app/Front.php:106
    257 msgid "Register With a Crypto Wallet"
    258290msgstr ""
    259291
     
    304336msgstr ""
    305337
    306 #: app/Login.php:35
     338#: app/Login.php:39
    307339msgid "Invalid input"
    308340msgstr ""
    309341
    310 #: app/Login.php:63 app/Plugin.php:191
     342#: app/Login.php:77 app/Plugin.php:199
    311343msgid "Logged in"
    312344msgstr ""
    313345
    314 #: app/Login.php:70
     346#: app/Login.php:84
    315347msgid "Signature err, try again."
    316348msgstr ""
    317349
    318 #: app/Login.php:127
     350#: app/Login.php:146
    319351#. translators: blog name.
    320352msgid "Log in to %1$s"
    321353msgstr ""
    322354
    323 #: app/Login.php:161
     355#: app/Login.php:181
    324356msgid "Bad nonce, please refresh."
    325357msgstr ""
    326358
    327 #: app/Login.php:168
     359#: app/Login.php:188
    328360msgid "No address specified."
    329361msgstr ""
    330362
    331 #: app/Plugin.php:185
     363#: app/Plugin.php:193
    332364msgid "Choose your login method"
    333365msgstr ""
    334366
    335 #: app/Plugin.php:186
     367#: app/Plugin.php:194
    336368msgid "Error: cannot detect crypto wallet"
    337369msgstr ""
    338370
    339 #: app/Plugin.php:187
     371#: app/Plugin.php:195
    340372msgid "Waiting for your permission"
    341373msgstr ""
    342374
    343 #: app/Plugin.php:188
     375#: app/Plugin.php:196
    344376msgid "Fetching login phrase..."
    345377msgstr ""
    346378
    347 #: app/Plugin.php:189
     379#: app/Plugin.php:197
    348380msgid "Waiting for your signature"
    349381msgstr ""
    350382
    351 #: app/Plugin.php:190
     383#: app/Plugin.php:198
    352384msgid "Verifying signature..."
    353385msgstr ""
    354386
    355 #: app/Plugin.php:192
     387#: app/Plugin.php:200
    356388msgid "Login aborted"
    357389msgstr ""
    358390
    359 #: app/Plugin.php:193
     391#: app/Plugin.php:201
    360392msgid "Log In"
    361393msgstr ""
    362394
    363 #: app/Plugin.php:194
     395#: app/Plugin.php:202
    364396msgid "Scan a QR code with your wallet, https://walletconnect.org"
    365397msgstr ""
    366398
    367 #: app/Plugin.php:195
     399#: app/Plugin.php:203
    368400msgid "Browser add-on and mobile app, https://metamask.io"
    369401msgstr ""
    370402
    371 #: app/Plugin.php:248
     403#: app/Plugin.php:256
    372404msgid "Log out first"
    373405msgstr ""
    374406
    375 #: app/Widgets/Button.php:31
     407#: app/Widgets/Button.php:34
    376408msgid "EthPress Widget"
    377409msgstr ""
    378410
    379 #: app/Widgets/Button.php:70
    380 msgid "Link Your Crypto Wallets"
    381 msgstr ""
    382 
    383 #: app/Widgets/Button.php:87
     411#: app/Widgets/Button.php:84
    384412msgid "Title:"
    385413msgstr ""
  • ethpress/trunk/readme.txt

    r2768291 r2775563  
    11=== EthPress - Web3 Login ===
    2 Contributors: lynn999, ethereumicoio
     2Contributors: lynn999, ethereumicoio, freemius
    33Donate link: https://etherscan.io/address/0x106417f7265e15c1aae52f76809f171578e982a9
    44Tags: login, metamask, ethereum, web3, trust wallet, bitcoin, cryptocurrency, crypto wallet, walletconnect
    55Requires at least: 4.6
    66Tested up to: 6.0.1
    7 Stable tag: 1.5.11
     7Stable tag: 1.5.12
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    2828* A web3 login button is added to your login screen automatically
    2929* Use the EthPress widget for maximum ease
    30 * Alternatively, a shortcode  [ethpress_login_button] can be used
     30* A shortcode [ethpress_login_button] can be used to display the Login button anywhere
     31* A shortcode [ethpress_link_button] can be used to display the Link accounts button anywhere
    3132* Local signature verification. To verify signatures locally with JavaScript, see this [guide](https://gitlab.com/losnappas/verify-eth-signature) please.
    32 * Managed Verification Service. [PRO](https://ethereumico.io/product/web3-login-wordpress-ethpress-plugin/) version required. [Free 7 days Trial](https://checkout.freemius.com/mode/dialog/plugin/9248/plan/15558/?trial=paid) available!
    33 * EthPress login button on a [WooCommerce](https://woocommerce.com/?aff=12943&cid=17113767) Login, Register and Checkout Forms. [PRO](https://ethereumico.io/product/web3-login-wordpress-ethpress-plugin/) version required. [Free 7 days Trial](https://checkout.freemius.com/mode/dialog/plugin/9248/plan/15558/?trial=paid) available!
    34 * The [ethpress_account] short code can be used to display the current user’s address logged with. [PRO](https://ethereumico.io/product/web3-login-wordpress-ethpress-plugin/) version required. [Free 7 days Trial](https://checkout.freemius.com/mode/dialog/plugin/9248/plan/15558/?trial=paid) available!
    35 * [NFT](https://ethereumico.io/product/nft-wordpress-plugin/) Token based access control for [WooCommerce](https://woocommerce.com/?aff=12943&cid=17113767) products, simple pages and posts can be done with the [EthPress NFT Access Add-On](https://ethereumico.io/product/nft-authentication-nft-access-control-wordpress-plugin/). [Free 7 days Trial](https://checkout.freemius.com/mode/dialog/plugin/10731/plan/18172/?trial=paid) available!
     33
     34== Features PRO ==
     35
     36> The [EthPress PRO](https://ethereumico.io/product/web3-login-wordpress-ethpress-plugin/) version is required to use these features. [Free 7 days Trial](https://checkout.freemius.com/mode/dialog/plugin/9248/plan/15558/?trial=paid) is available!
     37
     38* Managed Verification Service.
     39* EthPress login button on a [WooCommerce](https://woocommerce.com/?aff=12943&cid=17113767) Login, Register and Checkout Forms.
     40* The [ethpress_account] short code can be used to display the current user’s address logged with.
     41* Buttons labels text can be changed in plugin settings
     42* WooCommerce Account Details show Link Wallet button setting
     43* The `Redirect URL` setting can be used to set an URL of a page to redirect after a successful login
     44
     45> The [NFT](https://ethereumico.io/product/nft-wordpress-plugin/) Token based access control for the [WooCommerce](https://woocommerce.com/?aff=12943&cid=17113767) products, simple pages and posts can be done with the [EthPress NFT Access Add-On](https://ethereumico.io/product/nft-authentication-nft-access-control-wordpress-plugin/). [Free 7 days Trial](https://checkout.freemius.com/mode/dialog/plugin/10731/plan/18172/?trial=paid) is available!
    3646
    3747[More Q&A](https://gitlab.com/losnappas/ethpress/-/blob/master/README-EXTRA.md).
     
    140150
    141151The `login_redirect` hook is a [standard WordPress hook](https://developer.wordpress.org/reference/hooks/login_redirect/) you can use to customize the page user should be redirected after login.
     152
     153> The [EthPress PRO](https://ethereumico.io/product/web3-login-wordpress-ethpress-plugin/) version has a feature to configure it on the plugin settings page. [Free 7 days Trial](https://checkout.freemius.com/mode/dialog/plugin/9248/plan/15558/?trial=paid) is available!
    142154
    143155`
     
    172184== Changelog ==
    173185
     186
     187= 1.5.12 =
     188
     189* The `[ethpress_link_button]` shortcode is added
     190* Buttons labels text settings is added
     191* WooCommerce Account Details show Link Wallet button setting is added
     192* The `Redirect URL` setting is added to set an URL of a page to redirect after a successful login
     193
    174194= 1.5.11 =
    175195
  • ethpress/trunk/vendor/autoload.php

    r2765503 r2775563  
    55require_once __DIR__ . '/composer/autoload_real.php';
    66
    7 return ComposerAutoloaderInitf4ed892c423fcef463e8c6daa512a46c::getLoader();
     7return ComposerAutoloaderInitf3c6553acb34adbc7dfda2e6cecd78e4::getLoader();
  • ethpress/trunk/vendor/composer/autoload_classmap.php

    r2754355 r2775563  
    4040    'losnappas\\Ethpress\\Nonce' => $baseDir . '/app/Nonce.php',
    4141    'losnappas\\Ethpress\\Plugin' => $baseDir . '/app/Plugin.php',
     42    'losnappas\\Ethpress\\Shortcodes\\LinkButton' => $baseDir . '/app/Shortcodes/LinkButton.php',
    4243    'losnappas\\Ethpress\\Shortcodes\\LoggedAccount' => $baseDir . '/app/Shortcodes/LoggedAccount.php',
    4344    'losnappas\\Ethpress\\Shortcodes\\LoginButton' => $baseDir . '/app/Shortcodes/LoginButton.php',
  • ethpress/trunk/vendor/composer/autoload_real.php

    r2765503 r2775563  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInitf4ed892c423fcef463e8c6daa512a46c
     5class ComposerAutoloaderInitf3c6553acb34adbc7dfda2e6cecd78e4
    66{
    77    private static $loader;
     
    2323        }
    2424
    25         spl_autoload_register(array('ComposerAutoloaderInitf4ed892c423fcef463e8c6daa512a46c', 'loadClassLoader'), true, true);
     25        spl_autoload_register(array('ComposerAutoloaderInitf3c6553acb34adbc7dfda2e6cecd78e4', 'loadClassLoader'), true, true);
    2626        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(\dirname(__FILE__)));
    27         spl_autoload_unregister(array('ComposerAutoloaderInitf4ed892c423fcef463e8c6daa512a46c', 'loadClassLoader'));
     27        spl_autoload_unregister(array('ComposerAutoloaderInitf3c6553acb34adbc7dfda2e6cecd78e4', 'loadClassLoader'));
    2828
    2929        $useStaticLoader = PHP_VERSION_ID >= 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded());
     
    3131            require __DIR__ . '/autoload_static.php';
    3232
    33             call_user_func(\Composer\Autoload\ComposerStaticInitf4ed892c423fcef463e8c6daa512a46c::getInitializer($loader));
     33            call_user_func(\Composer\Autoload\ComposerStaticInitf3c6553acb34adbc7dfda2e6cecd78e4::getInitializer($loader));
    3434        } else {
    3535            $map = require __DIR__ . '/autoload_namespaces.php';
  • ethpress/trunk/vendor/composer/autoload_static.php

    r2765503 r2775563  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInitf4ed892c423fcef463e8c6daa512a46c
     7class ComposerStaticInitf3c6553acb34adbc7dfda2e6cecd78e4
    88{
    99    public static $prefixLengthsPsr4 = array (
     
    5555        'losnappas\\Ethpress\\Nonce' => __DIR__ . '/../..' . '/app/Nonce.php',
    5656        'losnappas\\Ethpress\\Plugin' => __DIR__ . '/../..' . '/app/Plugin.php',
     57        'losnappas\\Ethpress\\Shortcodes\\LinkButton' => __DIR__ . '/../..' . '/app/Shortcodes/LinkButton.php',
    5758        'losnappas\\Ethpress\\Shortcodes\\LoggedAccount' => __DIR__ . '/../..' . '/app/Shortcodes/LoggedAccount.php',
    5859        'losnappas\\Ethpress\\Shortcodes\\LoginButton' => __DIR__ . '/../..' . '/app/Shortcodes/LoginButton.php',
     
    6566    {
    6667        return \Closure::bind(function () use ($loader) {
    67             $loader->prefixLengthsPsr4 = ComposerStaticInitf4ed892c423fcef463e8c6daa512a46c::$prefixLengthsPsr4;
    68             $loader->prefixDirsPsr4 = ComposerStaticInitf4ed892c423fcef463e8c6daa512a46c::$prefixDirsPsr4;
    69             $loader->classMap = ComposerStaticInitf4ed892c423fcef463e8c6daa512a46c::$classMap;
     68            $loader->prefixLengthsPsr4 = ComposerStaticInitf3c6553acb34adbc7dfda2e6cecd78e4::$prefixLengthsPsr4;
     69            $loader->prefixDirsPsr4 = ComposerStaticInitf3c6553acb34adbc7dfda2e6cecd78e4::$prefixDirsPsr4;
     70            $loader->classMap = ComposerStaticInitf3c6553acb34adbc7dfda2e6cecd78e4::$classMap;
    7071
    7172        }, null, ClassLoader::class);
Note: See TracChangeset for help on using the changeset viewer.