Plugin Directory

Changeset 2954946


Ignore:
Timestamp:
08/17/2023 12:49:31 PM (19 months ago)
Author:
joelmelon
Message:

V1.0.12 add allowdynamicproperties, remove error_logs and change all callback responses to wp_json_encode

Location:
lnurl-auth
Files:
1 added
8 edited

Legend:

Unmodified
Added
Removed
  • lnurl-auth/trunk/classes/Assets.php

    r2835912 r2954946  
    1111 * @since 1.0.0
    1212 */
     13
     14// https://www.php.net/manual/en/class.allowdynamicproperties.php
     15#[\AllowDynamicProperties]
     16
    1317class Assets {
    1418
     
    9397        };
    9498
    95         // function to cycle up until background found 
     99        // function to cycle up until background found
    96100        Element.prototype.lnurlGetRealBackgroundColor = function() {
    97101            const element = this;
    98102            const transparent = "rgba(0, 0, 0, 0)";
    99103            if (!element) return transparent;
    100    
     104
    101105            var bg = getComputedStyle(element).backgroundColor;
    102106            if (bg === "transparent" || bg === "rgba(0, 0, 0, 0)" && null !== element.parentElement) {
     
    107111        };
    108112
    109         // function to cycle up until color found 
     113        // function to cycle up until color found
    110114        Element.prototype.lnurlGetRealColor = function() {
    111115            const element = this;
    112116            const transparent = "rgba(0, 0, 0, 0)";
    113117            if (!element) return transparent;
    114    
     118
    115119            var color = getComputedStyle(element).color;
    116120            if (color === "transparent" || color === "rgba(0, 0, 0, 0)" && null !== element.parentElement) {
     
    139143                return;
    140144            }
    141            
     145
    142146            const data = new FormData();
    143147            data.append( "action", "js_initialize_lnurl_auth" );
     
    148152            element.classList.add(`⚡️`);
    149153            // console.log("Request from:", element);
    150            
     154
    151155            fetch("' . admin_url( 'admin-ajax.php' ) . '", {
    152156                method: "POST",
     
    221225                        if (seconds.innerText != mseconds_remaining) seconds.innerText = (String(mseconds_remaining).length <= 1 ? "0" + mseconds_remaining : mseconds_remaining);
    222226                        if (
    223                             clock_img && clock_img.alt != clock_icon || 
     227                            clock_img && clock_img.alt != clock_icon ||
    224228                            !clock_img && clock.innerText == clock_icon
    225229                        ) {
     
    240244            for (let lnurlAuthInstance of lnurlAuthInstances) {
    241245                intersectionObserver.observe(lnurlAuthInstance);
    242                 lnurlAuthInstance.lnurlAuthRequest();   
     246                lnurlAuthInstance.lnurlAuthRequest();
    243247                lnurlAuthInstance.querySelector("." + lnurlAuthElementClass + "-reinit").addEventListener("click", function() {
    244248                    lnurlAuthInstance.lnurlAuthReset();
     
    256260    public function lnurl_auth_css() {
    257261        return '
    258         .lnurl-auth, 
    259         .lnurl-auth-qrcode, 
     262        .lnurl-auth,
     263        .lnurl-auth-qrcode,
    260264        .lnurl-auth-permalink { position: relative; width: 100%; }
    261265
    262266        .lnurl-auth { display: flex; flex-wrap: wrap; color: inherit; background-color: inherit; }
    263        
     267
    264268        @keyframes lnurl_auth_loading_shimmer {
    265269            0% { background-position: -100vw 0 }
     
    267271        }
    268272        .lnurl-auth-qrcode:empty,
    269         .lnurl-auth-permalink:empty { 
     273        .lnurl-auth-permalink:empty {
    270274            animation-duration: 2s;
    271275            animation-fill-mode: forwards;
     
    279283        }
    280284        .lnurl-auth-qrcode:empty + .lnurl-auth-qrcode-logo { opacity: .2; }
    281        
     285
    282286        .lnurl-auth-label { flex: 0 0 100%; margin-bottom: 16px !important; color: inherit; text-align: center; }
    283287        .lnurl-auth-qrcode-wrapper { position: relative; width: 100%; padding-top: 100%; flex: 0 0 100%; margin-bottom: 16px; overflow: hidden; }
     
    294298        .lnurl-auth-timer-clock { position: relative; margin-top: .15em; margin-right: .25em; }
    295299        .lnurl-auth-timer-minutes, .lnurl-auth-timer-seconds, .lnurl-auth-timer-separator { color: inherit; font-size: .9em; opacity: .4; }
    296        
     300
    297301        .lnurl-auth-message-wrapper { display: none; justify-content: center; align-items: center; position: absolute; left: 0; top: 0; width: 100%; height: 100%; border: 1px solid; text-align: center; }
    298302        .lnurl-auth-message-scroll-wrapper { padding: 2em; max-height: calc(100% - 4em); overflow: scroll; }
     
    323327        #loginform .lnurl-auth-permalink a { color: #F7931A }
    324328        #loginform .lnurl-auth-permalink a:hover, #loginform .lnurl-auth-permalink a:active, #loginform .lnurl-auth-permalink a:visited, { color: #EF8F1A }
    325        
     329
    326330        body:not(.⚡️) #loginform .lnurl-auth { display: none; }
    327331        body:not(.⚡️) #loginform .lnurl-auth-loginform-wordpress-button { display: none; }
    328        
     332
    329333        body.⚡️ #loginform .lnurl-auth-loginform-lightning-button { display: none; }
    330334        body.⚡️ #loginform .lnurl-auth-loginform-wordpress-button { display: inline-block; }
  • lnurl-auth/trunk/classes/Helpers.php

    r2835403 r2954946  
    99 * @since 1.0.0
    1010 */
     11
     12// https://www.php.net/manual/en/class.allowdynamicproperties.php
     13#[\AllowDynamicProperties]
     14
    1115class Helpers {
    1216
  • lnurl-auth/trunk/classes/Login.php

    r2835604 r2954946  
    2222 * @since 1.0.0
    2323 */
     24
     25// https://www.php.net/manual/en/class.allowdynamicproperties.php
     26#[\AllowDynamicProperties]
     27
    2428class Login {
    2529
     
    132136                $message = '"' . sanitize_text_field( $th->getMessage() ) . '": ' . esc_html( _x( 'Verifying signature failed. Please reload the page and try again.', 'lnurl_auth_callback error', 'lnurl-auth' ) );
    133137                lnurl_auth()->Plugin->Transients->set( $k1, false, false, $message );
    134                 error_log( json_encode( array( $k1, $signed_k1, $node_linking_key, $message ) ) );
    135                 echo json_encode(
     138                // error_log( json_encode( array( $k1, $signed_k1, $node_linking_key, $message ) ) );
     139                echo wp_json_encode(
    136140                    array(
    137141                        'status' => 'ERROR',
     
    149153                    $message = esc_html( _x( 'No session for this k1. Please reload the page and try again.', 'lnurl_auth_callback error', 'lnurl-auth' ) );
    150154                    lnurl_auth()->Plugin->Transients->set( $k1, false, false, $message );
    151                     error_log( json_encode( array( $k1, $signed_k1, $node_linking_key, $message ) ) );
     155                    // error_log( json_encode( array( $k1, $signed_k1, $node_linking_key, $message ) ) );
    152156                    echo wp_json_encode(
    153157                        array(
     
    165169                    $message = esc_html( _x( 'Sorry, your node is banned from this site.', 'lnurl_auth_callback error', 'lnurl-auth' ) );
    166170                    lnurl_auth()->Plugin->Transients->set( $k1, false, false, $message );
    167                     error_log( json_encode( array( $k1, $signed_k1, $node_linking_key, $message ) ) );
     171                    // error_log( json_encode( array( $k1, $signed_k1, $node_linking_key, $message ) ) );
    168172                    echo wp_json_encode(
    169173                        array(
     
    181185                    $message = esc_html( _x( 'Sorry, your node has no access to this site.', 'lnurl_auth_callback error', 'lnurl-auth' ) );
    182186                    lnurl_auth()->Plugin->Transients->set( $k1, false, false, $message );
    183                     error_log( json_encode( array( $k1, $signed_k1, $node_linking_key, $message ) ) );
     187                    // error_log( json_encode( array( $k1, $signed_k1, $node_linking_key, $message ) ) );
    184188                    echo wp_json_encode(
    185189                        array(
     
    209213                        $message = esc_html( _x( 'Registrations are disabled. We are not able to create an account for you.', 'lnurl_auth_callback error', 'lnurl-auth' ) );
    210214                        lnurl_auth()->Plugin->Transients->set( $k1, false, false, $message );
    211                         error_log( json_encode( array( $k1, $signed_k1, $node_linking_key, $message ) ) );
     215                        // error_log( json_encode( array( $k1, $signed_k1, $node_linking_key, $message ) ) );
    212216                        echo wp_json_encode(
    213217                            array(
     
    243247                        $message = esc_html( _x( 'We failed to create a user for you. Please try again later.', 'lnurl_auth_callback error', 'lnurl-auth' ) );
    244248                        lnurl_auth()->Plugin->Transients->set( $k1, false, false, $message );
    245                         error_log( json_encode( array( $k1, $signed_k1, $node_linking_key, $message ) ) );
     249                        // error_log( json_encode( array( $k1, $signed_k1, $node_linking_key, $message ) ) );
    246250                        echo wp_json_encode(
    247251                            array(
     
    272276                        $message = esc_html( _x( 'We failed searching for your user account. Please try again later.', 'lnurl_auth_callback error', 'lnurl-auth' ) );
    273277                        lnurl_auth()->Plugin->Transients->set( $k1, false, false, $message );
    274                         error_log( json_encode( array( $k1, $signed_k1, $node_linking_key, $message ) ) );
     278                        // error_log( json_encode( array( $k1, $signed_k1, $node_linking_key, $message ) ) );
    275279                        echo wp_json_encode(
    276280                            array(
     
    286290                lnurl_auth()->Plugin->Transients->set( $k1, true, $user_id );
    287291
    288                 echo json_encode( array( 'status' => 'OK' ) );
     292                echo wp_json_encode( array( 'status' => 'OK' ) );
    289293                die;
    290294            }
     
    293297            $message = esc_html( _x( 'Something went wrong. Please reload the page and try again.', 'lnurl_auth_callback error', 'lnurl-auth' ) );
    294298            lnurl_auth()->Plugin->Transients->set( $k1, false, false, $message );
    295             error_log( json_encode( array( $k1, $signed_k1, $node_linking_key, $message ) ) );
    296             echo json_encode(
     299            // error_log( json_encode( array( $k1, $signed_k1, $node_linking_key, $message ) ) );
     300            echo wp_json_encode(
    297301                array(
    298302                    'status' => 'ERROR',
  • lnurl-auth/trunk/classes/Plugin.php

    r2835403 r2954946  
    1717 * @since 1.0.0
    1818 */
     19
     20// https://www.php.net/manual/en/class.allowdynamicproperties.php
     21#[\AllowDynamicProperties]
     22
    1923class Plugin {
    2024
     
    7781     */
    7882    public function run() {
     83        error_log( json_encode( array( 'k1', 'signed', 'node_linking', 'message' ) ) );
     84
    7985        // load classes
    8086        $this->load_classes(
  • lnurl-auth/trunk/classes/Settings.php

    r2835403 r2954946  
    1919 * @since 1.0.0
    2020 */
     21
     22// https://www.php.net/manual/en/class.allowdynamicproperties.php
     23#[\AllowDynamicProperties]
     24
    2125class Settings {
    2226
  • lnurl-auth/trunk/classes/Transients.php

    r2835403 r2954946  
    99 * @since 1.0.0
    1010 */
     11
     12// https://www.php.net/manual/en/class.allowdynamicproperties.php
     13#[\AllowDynamicProperties]
     14
    1115class Transients {
    1216
  • lnurl-auth/trunk/lnurl-auth.php

    r2835912 r2954946  
    44* Plugin URI: https://wordpress.org/plugins/lnurl-auth/
    55* Description: This plugin provides LNURL Auth for WordPress. Login to WordPress with Bitcoin Lightning ⚡️
    6 * Version: 1.0.11
     6* Version: 1.0.12
    77* Author: joelmelon
    88* Author URI: https://lnurl-auth-for-wordpress.joelstuedle.ch
  • lnurl-auth/trunk/readme.txt

    r2835912 r2954946  
    66Requires at least: 6.0
    77Requires PHP: 8.0.15
    8 Tested up to: 6.1.1
    9 Stable tag: 1.0.11
    10 License: GPLv3 or later
    11 License URI: https://www.gnu.org/licenses/gpl-3.0.html
     8Tested up to: 6.3
     9Stable tag: 1.0.12
     10License: DBAD 1.1 or later
     11License URI: https://dbad-license.org/
    1212
    1313This plugin provides LNURL Auth for WordPress. Login to WordPress with Bitcoin Lightning ⚡️
     
    3030== Demo ==
    3131
    32 A demo WordPress installation with LNURL Auth is available [here](https://lnurl-auth-for-wordpress.joelstuedle.ch/). 
     32A demo WordPress installation with LNURL Auth is available [here](https://lnurl-auth-for-wordpress.joelstuedle.ch/).
    3333
    3434== Installation ==
     
    4444The LNURL auth QR code or URL contains a unique and time-sensitive text string. This text string is sent to the visitor's wallet. The visitor's wallet signs this text string with the private key and sends back the response with the signed text string. This signature can then be validated to confirm the visitor's identity.
    4545
    46 Read the specs here: https://github.com/lnurl/luds/blob/luds/04.md 
     46Read the specs here: https://github.com/lnurl/luds/blob/luds/04.md
    4747
    4848== Vendors ==
     
    5757
    5858== Changelog ==
     59
     60= 1.0.12 =
     61* Add `allowdynamicproperties`, remove `error_logs` and change all callback responses to `wp_json_encode`.
    5962
    6063= 1.0.11 =
Note: See TracChangeset for help on using the changeset viewer.