Plugin Directory

Changeset 3106088

Timestamp:
06/22/2024 08:00:25 PM (6 weeks ago)
Author:
jamieblomerus
Message:

Uploaded 1.3 to trunk (so it can get translated before release)

Location:
mobile-bankid-integration/trunk
Files:
3 added
19 edited

Legend:

Unmodified
Added
Removed
  • mobile-bankid-integration/trunk/includes/admin/class-admin.php

    r3084002 r3106088  
    3333        self::add_tab( __( 'Integrations', 'mobile-bankid-integration' ), 'integrations', array( $this, 'page_integrations' ) );
    3434        self::add_tab( __( 'Contribute', 'mobile-bankid-integration' ), 'contribute', array( $this, 'page_contribute' ) );
     35
     36
     37
     38
     39
     40
     41
     42
    3543    }
    3644
     
    421429                color: rgb(201, 97, 152);
    422430            }
    423 
     431        </style>
    424432            <?php
    425433    }
     434
     435
     436
     437
     438
     439
     440
     441
     442
     443
     444
     445
     446
     447
     448
     449
     450
     451
     452
     453
     454
     455
     456
     457
     458
     459
     460
     461
     462
     463
     464
     465
     466
     467
     468
     469
     470
     471
     472
     473
     474
     475
     476
     477
     478
     479
    426480}
  • mobile-bankid-integration/trunk/includes/class-activation.php

    r3084002 r3106088  
    6565     */
    6666    private function checkrequirements() {
    67         // Check if running on Windows.
    68         if ( strtoupper( substr( PHP_OS, 0, 3 ) ) === 'WIN' ) {
    69             wp_die( esc_html__( 'Due to bugs and limitations in the plugins dependencies, this plugin does not work on Windows. Please try again on a Linux server.', 'mobile-bankid-integration' ) );
    70         }
    7167        // Check if PHP version is 7.4 or higher.
    7268        if ( version_compare( PHP_VERSION, '7.4.0' ) < 0 ) {
  • mobile-bankid-integration/trunk/includes/class-core.php

    r3084002 r3106088  
    4848        if ( get_option( 'mobile_bankid_integration_env' ) && get_option( 'mobile_bankid_integration_certificate' ) && get_option( 'mobile_bankid_integration_password' ) ) {
    4949            $this->create_bankid_service();
     50
     51
     52
     53
     54
     55
    5056            do_action( 'mobile_bankid_integration_init' );
    5157        }
     
    161167
    162168    /**
    163      * Get user ID from personal number.
    164      *
    165      * @param string $personal_number Personal number (12 digits, no hyphen).
     169     * Get user ID from personal number.
     170     *
     171     * @param string $personal_number Personal number (12 digits, no hyphen).
    166172     * @return int|false
    167173     */
    168174    public function getUserIdFromPersonalNumber( $personal_number ) {
    169         // Get user by personal number from User Meta.
     175        // Get user by personal number from User Meta.
    170176        $user_query = new \WP_User_Query(
    171177            array(
     
    182188
    183189    /**
    184      * Set personal number for user.
     190     * Set personal number for user.
    185191     *
    186192     * @param int    $user_id User ID.
    187      * @param string $personal_number Personal number (12 digits, no hyphen).
     193     * @param string $personal_number Personal number (12 digits, no hyphen).
    188194     * @return void
    189195     */
    190196    public function setPersonalNumberForUser( $user_id, $personal_number ) {
    191         // Check if user already has a personal number.
     197        // Check if user already has a personal number.
    192198        if ( $this->getUserIdFromPersonalNumber( $personal_number ) !== false ) {
    193199            return;
  • mobile-bankid-integration/trunk/includes/class-session.php

    r3084002 r3106088  
    2525
    2626    /**
    27      * The personal number.
    ��27     * The personal number.
    2828     *
    2929     * @var string
     
    4949     *
    5050     * @param int         $user_id The user ID.
    51      * @param string|null $personal_number The personal number.
     51     * @param string|null $personal_number The personal number.
    5252     * @param int|null    $time_created The time the session was created.
    5353     * @return void|\WP_Error
     
    6767        }
    6868        if ( ! $personal_number ) {
    69             $this->error = new \WP_Error( 'no_personal_number', __( 'No personal number found.', 'mobile-bankid-integration' ) );
     69            $this->error = new \WP_Error( 'no_personal_number', __( 'No personal number found.', 'mobile-bankid-integration' ) );
    7070        }
    7171        $this->user_id         = $user_id;
  • mobile-bankid-integration/trunk/includes/integrations/woocommerce.php

    r3070283 r3106088  
    9898     */
    9999    public function __construct() {
    100         if ( get_option( 'mobile_bankid_integration_woocommerce_login' ) === 'yes' && ( get_option( 'mobile_bankid_integration_certificate' ) && get_option( 'mobile_bankid_integration_password' ) && get_option( 'mobile_bankid_integration_endpoint' ) ) ) {
     100        if ( get_option( 'mobile_bankid_integration_woocommerce_login' ) === 'yes' && ( get_option( 'mobile_bankid_integration_certificate' ) && get_option( 'mobile_bankid_integration_password' ) && get_option( 'mobile_bankid_integration_en' ) ) ) {
    101101            add_action(
    102102                'woocommerce_login_form_end',
     
    119119     */
    120120    public function __construct() {
     121
     122
     123
     124
    121125        if ( get_option( 'mobile_bankid_integration_woocommerce_checkout_require_bankid' ) !== 'yes' ) {
    122126            return;
     
    173177    public function age_check(): bool {
    174178        $age = get_option( 'mobile_bankid_integration_woocommerce_age_check', 0 );
     179
     180
     181
     182
     183
     184
     185
     186
     187
    175188        if ( $age <= 0 ) {
    176189            return true;
  • mobile-bankid-integration/trunk/includes/settings/class-usersettings.php

    r3070283 r3106088  
    2323
    2424    /**
    25      * Show personal number field.
     25     * Show personal number field.
    2626     *
    2727     * @param object $user User object.
     
    3333        <table class="form-table">
    3434        <tr>
    35         <th><label for="personal_number"><?php esc_html_e( 'Personal number (12 digits, no hyphen)', 'mobile-bankid-integration' ); ?></label></th>
     35        <th><label for="personal_number"><?php esc_html_e( 'Personal number (12 digits, no hyphen)', 'mobile-bankid-integration' ); ?></label></th>
    3636        <td>
    3737        <input type="text" name="personal_number" id="personal_number"
     
    4040            echo 'disabled'; }
    4141        ?>
    42         value="<?php echo esc_attr( get_user_meta( $user->ID, 'mobile_bankid_integration_personal_number', true ) ); ?>" placeholder="<?php /* translators: Placeholder personal number. */ esc_attr_e( 'YYYYMMDDXXXX', 'mobile-bankid-integration' ); ?>" class="regular-text" />
     42        value="<?php echo esc_attr( get_user_meta( $user->ID, 'mobile_bankid_integration_personal_number', true ) ); ?>" placeholder="<?php /* translators: Placeholder personal number. */ esc_attr_e( 'YYYYMMDDXXXX', 'mobile-bankid-integration' ); ?>" class="regular-text" />
    4343        </td>
    4444        </tr>
     
    4848
    4949    /**
    50      * Save personal number field.
     50     * Save personal number field.
    5151     *
    5252     * @param int $user_id User ID.
     
    5858
    5959        if ( current_user_can( 'edit_users' ) ) {
    60             // Check if personal number is valid and save it if it is.
     60            // Check if personal number is valid and save it if it is.
    6161            if ( preg_match( '/^[0-9]{12}$/', $personal_number ) && Personnummer::valid( $personal_number ) ) {
    62                 // Check if user with this personal number already exists.
     62                // Check if user with this personal number already exists.
    6363                $check = get_users(
    6464                    array(
     
    7676                update_user_meta( $user_id, 'mobile_bankid_integration_personal_number', $personal_number );
    7777            } elseif ( strlen( $personal_number ) === 0 ) {
    78                 delete_user_meta( $user_id, 'personal_number' );
     78                delete_user_meta( $user_id, 'personal_number' );
    7979            } else {
    8080                add_action( 'user_profile_update_errors', array( $this, 'personal_number_update_error_invalid' ), 10, 3 );
     
    8585
    8686    /**
    87      * Add error message if personal number already exists.
     87     * Add error message if personal number already exists.
    8888     *
    8989     * @param object $errors WP_Error object.
     
    9393     */
    9494    public function personal_number_update_error_already_exists( $errors, $update, $user ) {
    95         $errors->add( 'personal_number', esc_html__( 'User with this personal number already exists.', 'mobile-bankid-integration' ) );
     95        $errors->add( 'personal_number', esc_html__( 'User with this personal number already exists.', 'mobile-bankid-integration' ) );
    9696    }
    9797
    9898    /**
    99      * Add error message if personal number is invalid.
     99     * Add error message if personal number is invalid.
    100100     *
    101101     * @param object $errors WP_Error object.
     
    105105     */
    106106    public function personal_number_update_error_invalid( $errors, $update, $user ) {
    107         $errors->add( 'personal_number', esc_html__( 'Personal number is not valid.', 'mobile-bankid-integration' ) );
     107        $errors->add( 'personal_number', esc_html__( 'Personal number is not valid.', 'mobile-bankid-integration' ) );
    108108    }
    109109}
  • mobile-bankid-integration/trunk/includes/settings/views/setup-finish.php

    r3070283 r3106088  
    44
    55<h1><?php esc_html_e( 'Setup is complete', 'mobile-bankid-integration' ); ?></h1>
    6 <p><?php esc_html_e( 'Mobile BankID Integration is now setup and ready to use. You can now login to your WordPress site using BankID as soon as you have added your personal number to your account.', 'mobile-bankid-integration' ); ?></p>
     6<p><?php esc_html_e( 'Mobile BankID Integration is now setup and ready to use. You can now login to your WordPress site using BankID as soon as you have added your personal number to your account.', 'mobile-bankid-integration' ); ?></p>
    77
    88<a href="<?php echo esc_url( admin_url( 'admin.php?page=mobile-bankid-integration' ) ); ?>" class="button button-primary"><?php esc_html_e( 'Go to settings', 'mobile-bankid-integration' ); ?></a>
  • mobile-bankid-integration/trunk/includes/wp-login/class-api.php

    r3084002 r3106088  
    128128     * Sign in user from BankID or create user if it does not exist and registration is enabled.
    129129     *
    130      * @param string $personal_number Personal number of user.
     130     * @param string $personal_number Personal number of user.
    131131     * @param string $fname First name as returned from BankID API.
    132132     * @param string $lname Last name as returned from BankID API.
     
    134134     */
    135135    private function sign_in_as_user_from_bankid( $personal_number, $fname, $lname ) {
    136         // Get user by personal number from DB.
     136        // Get user by personal number from DB.
    137137        $user_id = Core::$instance->getUserIdFromPersonalNumber( $personal_number );
    138138
     
    156156            );
    157157
    158             // Set user personal number.
     158            // Set user personal number.
    159159            Core::$instance->setPersonalNumberForUser( $user_id, $personal_number );
    160160        } else {
     
    166166        Core::$instance->createAuthCookie( $user_id );
    167167        do_action( 'wp_login', $personal_number, $user );
     168
     169
     170
     171
     172
     173
     174
     175
    168176        return $user;
    169177    }
     
    180188            $user_exists = username_exists( 'user_' . $rnd_str );
    181189        } while ( $user_exists > 0 );
    182         return 'user_' . $rnd_str;
     190
     191        $username = 'user_' . $rnd_str;
     192
     193        /**
     194         * Filter the username generated for new users.
     195         *
     196         * @param string $username Username.
     197         * @since 1.3
     198         */
     199        $username = apply_filters( 'mobile_bankid_integration_new_user_username', $username );
     200
     201        return $username;
    183202    }
    184203}
  • mobile-bankid-integration/trunk/includes/wp-login/class-login.php

    r3084002 r3106088  
    1515     */
    1616    public function __construct() {
    17         if ( get_option( 'mobile_bankid_integration_wplogin' ) === 'as_alternative' && ( get_option( 'mobile_bankid_integration_certificate' ) && get_option( 'mobile_bankid_integration_password' ) && get_option( 'mobile_bankid_integration_endpoint' ) ) ) {
     17        if ( get_option( 'mobile_bankid_integration_wplogin' ) === 'as_alternative' && ( get_option( 'mobile_bankid_integration_certificate' ) && get_option( 'mobile_bankid_integration_password' ) && get_option( 'mobile_bankid_integration_en' ) ) ) {
    1818            add_action( 'login_form', array( $this, 'login_button' ), 40 );
    1919            add_action(
  • mobile-bankid-integration/trunk/mobile-bankid-integration.php

    r3084002 r3106088  
    33Plugin Name: Mobile BankID Integration
    44Description: A plugin that allows you to integrate Mobile BankID with your WordPress site.
    5 Version: 1.2
     5Version: 1.
    66Author: Jamie Blomerus
    77Author URI: https://github.com/jamieblomerus
     
    1414
    1515// Define constants.
    16 define( 'MOBILE_BANKID_INTEGRATION_VERSION', '1.2' );
     16define( 'MOBILE_BANKID_INTEGRATION_VERSION', '1.' );
    1717define( 'MOBILE_BANKID_INTEGRATION_PLUGIN_FILE', __FILE__ );
    1818define( 'MOBILE_BANKID_INTEGRATION_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
     
    5959            require_once MOBILE_BANKID_INTEGRATION_PLUGIN_DIR . 'includes/admin/class-admin.php';
    6060            require_once MOBILE_BANKID_INTEGRATION_PLUGIN_DIR . 'includes/integrations/load.php';
     61
     62
    6163        }
    6264
  • mobile-bankid-integration/trunk/readme.txt

    r3089062 r3106088  
    44Requires at least: 5.2
    55Tested up to: 6.5
    6 Stable tag: 1.2
     6Stable tag: 1.
    77Requires PHP: 7.2
    88License: GPLv3 or later
     
    3333= Can I help translate it to my language? =
    3434
    35 Contribute to the translation of this plugin at Translating WordPress.
     35Contribute to the translation of this plugin at .
    3636
    3737= I do miss one feature =
     
    4040
    4141= How do I buy the BankID service? =
    42 To buy the BankID service and receive a FP certificate, you need to contact your bank. For more information, please visit this [guide](https://www.bankid.com/en/foretag/anslut-foeretag).
     42To buy the BankID service and receive a P certificate, you need to contact your bank. For more information, please visit this [guide](https://www.bankid.com/en/foretag/anslut-foeretag).
    4343
    44 = I want to test the plugin, but I don't have a Mobile BankID or FP certificate =
     44= I want to test the plugin, but I don't have a Mobile BankID or P certificate =
    4545
    4646If you are only testing the service out, you can during the setup choose to run the plugin against the testing environment and use a [test BankID](https://www.bankid.com/en/utvecklare/test/skaffa-testbankid/test-bankid-get).
    4747
    4848== Changelog ==
     49
     50
     51
     52
     53
     54
     55
     56
     57
    4958
    5059= 1.2 =
     
    7584== Upgrade Notice ==
    7685
     86
     87
     88
    7789= 1.2 =
    7890Major update. Requires total reinstallation of the plugin.
  • mobile-bankid-integration/trunk/vendor/autoload.php

    r3084002 r3106088  
    2323require_once __DIR__ . '/composer/autoload_real.php';
    2424
    25 return ComposerAutoloaderInit841ba1d7db30a331995bbf9dcd7573e3::getLoader();
     25return ComposerAutoloaderInit::getLoader();
  • mobile-bankid-integration/trunk/vendor/composer/autoload_psr4.php

    r3084002 r3106088  
    99    'chillerlan\\Settings\\' => array($vendorDir . '/chillerlan/php-settings-container/src'),
    1010    'chillerlan\\QRCode\\' => array($vendorDir . '/chillerlan/php-qrcode/src'),
    11     'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-factory/src', $vendorDir . '/psr/http-message/src'),
     11    'Psr\\Http\\Message\\' => array($vendorDir . '/psr/http-/src'),
    1212    'Psr\\Http\\Client\\' => array($vendorDir . '/psr/http-client/src'),
    1313    'Personnummer\\' => array($vendorDir . '/personnummer/personnummer/src'),
  • mobile-bankid-integration/trunk/vendor/composer/autoload_real.php

    r3084002 r3106088  
    33// autoload_real.php @generated by Composer
    44
    5 class ComposerAutoloaderInit841ba1d7db30a331995bbf9dcd7573e3
     5class ComposerAutoloaderInit
    66{
    77    private static $loader;
     
    2525        require __DIR__ . '/platform_check.php';
    2626
    27         spl_autoload_register(array('ComposerAutoloaderInit841ba1d7db30a331995bbf9dcd7573e3', 'loadClassLoader'), true, true);
     27        spl_autoload_register(array('ComposerAutoloaderInit', 'loadClassLoader'), true, true);
    2828        self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
    29         spl_autoload_unregister(array('ComposerAutoloaderInit841ba1d7db30a331995bbf9dcd7573e3', 'loadClassLoader'));
     29        spl_autoload_unregister(array('ComposerAutoloaderInit', 'loadClassLoader'));
    3030
    3131        require __DIR__ . '/autoload_static.php';
    32         call_user_func(\Composer\Autoload\ComposerStaticInit841ba1d7db30a331995bbf9dcd7573e3::getInitializer($loader));
     32        call_user_func(\Composer\Autoload\ComposerStaticInit::getInitializer($loader));
    3333
    3434        $loader->register(true);
    3535
    36         $filesToLoad = \Composer\Autoload\ComposerStaticInit841ba1d7db30a331995bbf9dcd7573e3::$files;
     36        $filesToLoad = \Composer\Autoload\ComposerStaticInit::$files;
    3737        $requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
    3838            if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
  • mobile-bankid-integration/trunk/vendor/composer/autoload_static.php

    r3084002 r3106088  
    55namespace Composer\Autoload;
    66
    7 class ComposerStaticInit841ba1d7db30a331995bbf9dcd7573e3
     7class ComposerStaticInit
    88{
    99    public static $files = array (
     
    4848        'Psr\\Http\\Message\\' =>
    4949        array (
    50             0 => __DIR__ . '/..' . '/psr/http-factory/src',
    51             1 => __DIR__ . '/..' . '/psr/http-message/src',
     50            0 => __DIR__ . '/..' . '/psr/http-/src',
     51            1 => __DIR__ . '/..' . '/psr/http-/src',
    5252        ),
    5353        'Psr\\Http\\Client\\' =>
     
    217217    {
    218218        return \Closure::bind(function () use ($loader) {
    219             $loader->prefixLengthsPsr4 = ComposerStaticInit841ba1d7db30a331995bbf9dcd7573e3::$prefixLengthsPsr4;
    220             $loader->prefixDirsPsr4 = ComposerStaticInit841ba1d7db30a331995bbf9dcd7573e3::$prefixDirsPsr4;
    221             $loader->classMap = ComposerStaticInit841ba1d7db30a331995bbf9dcd7573e3::$classMap;
     219            $loader->prefixLengthsPsr4 = ComposerStaticInit::$prefixLengthsPsr4;
     220            $loader->prefixDirsPsr4 = ComposerStaticInit::$prefixDirsPsr4;
     221            $loader->classMap = ComposerStaticInit::$classMap;
    222222
    223223        }, null, ClassLoader::class);
  • mobile-bankid-integration/trunk/vendor/composer/installed.json

    r3084002 r3106088  
    662662        {
    663663            "name": "psr/http-factory",
    664             "version": "1.0.2",
    665             "version_normalized": "1.0.2.0",
     664            "version": "1.",
     665            "version_normalized": "1..0",
    666666            "source": {
    667667                "type": "git",
    668668                "url": "https://github.com/php-fig/http-factory.git",
    669                 "reference": "e616d01114759c4c489f93b099585439f795fe35"
    670             },
    671             "dist": {
    672                 "type": "zip",
    673                 "url": "https://api.github.com/repos/php-fig/http-factory/zipball/e616d01114759c4c489f93b099585439f795fe35",
    674                 "reference": "e616d01114759c4c489f93b099585439f795fe35",
    675                 "shasum": ""
    676             },
    677             "require": {
    678                 "php": ">=7.0.0",
     669                "reference": ""
     670            },
     671            "dist": {
     672                "type": "zip",
     673                "url": "https://api.github.com/repos/php-fig/http-factory/zipball/",
     674                "reference": "",
     675                "shasum": ""
     676            },
     677            "require": {
     678                "php": ">=7.",
    679679                "psr/http-message": "^1.0 || ^2.0"
    680680            },
    681             "time": "2023-04-10T20:10:41+00:00",
     681            "time": "202+00:00",
    682682            "type": "library",
    683683            "extra": {
     
    702702                }
    703703            ],
    704             "description": "Common interfaces for PSR-7 HTTP message factories",
     704            "description": "Common interfaces for PSR-7 HTTP message factories",
    705705            "keywords": [
    706706                "factory",
     
    714714            ],
    715715            "support": {
    716                 "source": "https://github.com/php-fig/http-factory/tree/1.0.2"
     716                "source": "https://github.com/php-fig/http-factory"
    717717            },
    718718            "install-path": "../psr/http-factory"
  • mobile-bankid-integration/trunk/vendor/composer/installed.php

    r3084002 r3106088  
    44        'pretty_version' => 'dev-trunk',
    55        'version' => 'dev-trunk',
    6         'reference' => '7aedfae704fa281f38077e40019261b06e1964e7',
     6        'reference' => '',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => 'dev-trunk',
    1515            'version' => 'dev-trunk',
    16             'reference' => '7aedfae704fa281f38077e40019261b06e1964e7',
     16            'reference' => '',
    1717            'type' => 'library',
    1818            'install_path' => __DIR__ . '/../../',
     
    9999        ),
    100100        'psr/http-factory' => array(
    101             'pretty_version' => '1.0.2',
    102             'version' => '1.0.2.0',
    103             'reference' => 'e616d01114759c4c489f93b099585439f795fe35',
     101            'pretty_version' => '1.',
     102            'version' => '1..0',
     103            'reference' => '',
    104104            'type' => 'library',
    105105            'install_path' => __DIR__ . '/../psr/http-factory',
  • mobile-bankid-integration/trunk/vendor/psr/http-factory/composer.json

    r3070283 r3106088  
    11{
    22    "name": "psr/http-factory",
    3     "description": "Common interfaces for PSR-7 HTTP message factories",
     3    "description": "Common interfaces for PSR-7 HTTP message factories",
    44    "keywords": [
    55        "psr",
     
    1919        }
    2020    ],
     21
     22
     23
    2124    "require": {
    22         "php": ">=7.0.0",
     25        "php": ">=7.",
    2326        "psr/http-message": "^1.0 || ^2.0"
    2427    },
  • mobile-bankid-integration/trunk/vendor/psr/http-factory/src/UploadedFileFactoryInterface.php

    r3070283 r3106088  
    1616     * @param StreamInterface $stream Underlying stream representing the
    1717     *     uploaded file content.
    18      * @param int $size in bytes
     18     * @param int $size in bytes
    1919     * @param int $error PHP file upload error
    20      * @param string $clientFilename Filename as provided by the client, if any.
    21      * @param string $clientMediaType Media type as provided by the client, if any.
     20     * @param string $clientFilename Filename as provided by the client, if any.
     21     * @param string $clientMediaType Media type as provided by the client, if any.
    2222     *
    2323     * @return UploadedFileInterface
     
    2727    public function createUploadedFile(
    2828        StreamInterface $stream,
    29         int $size = null,
     29        int $size = null,
    3030        int $error = \UPLOAD_ERR_OK,
    31         string $clientFilename = null,
    32         string $clientMediaType = null
     31        string $clientFilename = null,
     32        string $clientMediaType = null
    3333    ): UploadedFileInterface;
    3434}
Note: See TracChangeset for help on using the changeset viewer.