Plugin Directory

Changeset 2718528


Ignore:
Timestamp:
05/05/2022 09:54:35 AM (4 years ago)
Author:
byteplant
Message:

new admin option: allow invalid addresses

Location:
woo-address-validator
Files:
2 deleted
9 edited
8 copied
2 moved

Legend:

Unmodified
Added
Removed
  • woo-address-validator/tags/2.8/languages/woo-address-validator-de_DE.po

    r2426438 r2718528  
    22msgstr ""
    33"Project-Id-Version: Woocommerce Address Validator\n"
    4 "POT-Creation-Date: 2020-11-26 10:32+0100\n"
    5 "PO-Revision-Date: 2020-11-26 10:33+0100\n"
     4"POT-Creation-Date: 2022-05-04 18:50+0200\n"
     5"PO-Revision-Date: 2022-05-04 18:52+0200\n"
    66"Last-Translator: \n"
    77"Language-Team: \n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "X-Generator: Poedit 2.4.2\n"
     12"X-Generator: Poedit 3.0.1\n"
    1313"X-Poedit-KeywordsList: _;gettext;gettext_noop;esc_html_e;__;_e\n"
    1414"X-Poedit-Basepath: ..\n"
    1515"X-Poedit-SearchPath-0: .\n"
    1616
    17 #: src/Admin.php:140
     17#: src/Admin.php:146
    1818msgid "Address Validator"
    1919msgstr "Address Validator"
    2020
    21 #: src/Admin.php:157
     21#: src/Admin.php:163
    2222msgid "An error occured."
    2323msgstr "Ein Fehler ist aufgetreten."
    2424
    25 #: src/Admin.php:158 src/WC/WCAV_WC_Admin.php:97
     25#: src/Admin.php:164 src/WC/WCAV_WC_Admin.php:97
    2626msgid "API Result"
    2727msgstr "API Ergebnis"
    2828
    29 #: src/Admin.php:178
     29#: src/Admin.php:184
    3030msgid "Woocommerce Address Validator"
    3131msgstr "Woocommerce Address Validator"
    3232
    33 #: src/Admin.php:181
     33#: src/Admin.php:187
    3434msgid ""
    3535"It looks like your API key is invalid or depleted. Please check your key and "
     
    3939"API Key prüfen und aktualisieren."
    4040
    41 #: src/Admin.php:182
     41#: src/Admin.php:188
    4242#, php-format
    4343msgid ""
     
    4747"einloggen."
    4848
    49 #: src/Admin.php:191
     49#: src/Admin.php:197
    5050msgid "API Key"
    5151msgstr "API Key"
    5252
    53 #: src/Admin.php:199
     53#: src/Admin.php:205
     54msgid "Allow INVALID Addresses"
     55msgstr "Ungültige Adressen zulassen"
     56
     57#: src/Admin.php:213
    5458msgid "Update"
    5559msgstr "Aktualisieren"
    5660
    57 #: src/Admin.php:205
     61#: src/Admin.php:219
     62msgid ""
     63"Allow INVALID Addresses will prompt the user to check an address that could "
     64"not be validated, and allow them to continue (this feature was contributed "
     65"by \"Simply Charlotte Mason\" --- https://simplycharlottemason.com)."
     66msgstr ""
     67"Ungültige Adressen zulassen fordert den Benutzer auf, eine Adresse zu "
     68"überprüfen, die nicht validiert werden konnte, und erlaubt dann die "
     69"Fortsetzung des Checkouts (diese Funktion wurde von \"Simply Charlotte Mason"
     70"\" --- https://simplycharlottemason.com beigetragen)."
     71
     72#: src/Admin.php:224
    5873msgid ""
    5974"With Address-Validator you can easily verify any national or international "
     
    6681"Kunden zu erhalten."
    6782
    68 #: src/Admin.php:212
     83#: src/Admin.php:231
    6984#, php-format
    7085msgid ""
     
    7590"625 kostenlosen Credits."
    7691
    77 #: src/Admin.php:234
     92#: src/Admin.php:253
    7893msgid "Your Address-Validator API key is invalid or depleted."
    7994msgstr "Der API Key ist ungültig oder die Credits sind verbraucht."
    8095
    81 #: src/Admin.php:241
     96#: src/Admin.php:260
    8297#, php-format
    8398msgid ""
     
    85100msgstr "API Key <a href=\"%s\">auf der Einstellungsseite</a> prüfen/ändern."
    86101
    87 #: src/WC/WC.php:216
     102#: src/WC/WC.php:222
    88103msgid "We have corrected your address. Please check the address again."
    89104msgstr ""
    90105"Wir haben die Adresse korrigiert. Bitte prüfen, ob die Angaben jetzt stimmen."
    91106
    92 #: src/WC/WC.php:218
     107#: src/WC/WC.php:224
     108msgid "Your address could not be verified. Please check the address again."
     109msgstr ""
     110"Die Adresse konnte nicht verifiziert werden. Bitte überprüfen Sie die "
     111"Adresse erneut."
     112
     113#: src/WC/WC.php:226
    93114msgid "Please enter a valid address."
    94115msgstr "Bitte eine gültige Adresse angeben."
  • woo-address-validator/tags/2.8/readme.txt

    r2630781 r2718528  
    33Tags: woocommerce, validation, address, address validation, billing, shipping, delivery, billing address, shipping address, checkout
    44Requires at least: 3.0.1
    5 Tested up to: 5.8.2
    6 Stable tag: 2.7
     5Tested up to: 5.9.3
     6Stable tag: 2.8
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • woo-address-validator/tags/2.8/src/Admin.php

    r2426438 r2718528  
    8080        $this->validator   = $validator;
    8181
    82         $this->defaults = array(
    83             'api-key' => '',
    84         );
     82        $this->defaults = array(
     83            'api-key' => '',
     84            'allow-invalidaddr' => 0
     85        );
    8586
    8687        add_action( 'admin_menu', array( $this, 'admin_menu' ) );
     
    9192            && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST[ $this->action_name ] ) ), $this->action )
    9293        ) {
    93             $data = (array) wp_unslash( $_POST['wcav'] );
     94            $data = (array) wp_unslash( $_POST['wcav'] );
     95            // checkbox is missing in form data if unchecked, set to 0
     96            if ( ! isset( $data['allow-invalidaddr'] ) ) {
     97                $data[ 'allow-invalidaddr' ] = 0;
     98            }
    9499            if ( $this->update( $data ) ) {
    95100                $url = admin_url( 'options-general.php' );
     
    194199                                <input type="text" name="wcav[api-key]" value="<?php echo esc_attr( $options['api-key'] ); ?>">
    195200                            </td>
    196                         </tr>
     201                        </tr>                       
     202                        <tr>
     203                            <th scope="row">
     204                                <label for="allow-invalidaddr"><?php esc_html_e( 'Allow INVALID Addresses', 'woo-address-validator' ); ?></label>
     205                            </th>
     206                            <td>
     207                                <input type="checkbox" name="wcav[allow-invalidaddr]" value="1" <?php checked(1, $options['allow-invalidaddr'], true); ?> >
     208                            </td>
     209                        </tr>                       
    197210                    </tbody>
    198211                </table>
     
    201214            <hr>
    202215            <p>
     216                <?php
     217                esc_html_e(
     218                    'Allow INVALID Addresses will prompt the user to check an address that could not be validated, and allow them to continue (this feature was contributed by "Simply Charlotte Mason" --- https://simplycharlottemason.com).', 'woo-address-validator'
     219                );
     220                ?><br><br>
    203221                <?php
    204222                esc_html_e(
  • woo-address-validator/tags/2.8/src/Plugin.php

    r1625016 r2718528  
    4444     * @var WCAV_Validator | NULL
    4545     */
    46     private $validator = NULL;
     46    private $validator = NULL;
     47       
     48   /**
     49    * Allow INVALID addresses option.
     50    *
     51    * @var bool
     52    */
     53   private $allow_invalidaddr = 0;
    4754
    4855    /**
     
    5764        if ( ! empty( $options['api-key'] )  ) {
    5865            $this->api_key = $options['api-key'];
     66        }
     67        if ( ! empty( $options['allow-invalidaddr'] )  ) {
     68            $this->allow_invalidaddr = $options['allow-invalidaddr'];
    5969        }
    6070
     
    7585        require_once( dirname( __FILE__ ) . '/WC/WC.php' );
    7686        $wc = new WCAV_WC();
    77         $wc->setup( $this->plugin_path, $this->plugin_url, $this->validator );
     87        $wc->setup( $this->plugin_path, $this->plugin_url, $this->validator, $this->allow_invalidaddr );
    7888    }
    7989}
  • woo-address-validator/tags/2.8/src/WC/WC.php

    r1629762 r2718528  
    5252    private $billing_status;
    5353
     54    /**
     55     * @var bool
     56     */
     57    private $allow_invalidaddr;
     58
    5459    /**
    5560     * Setup the admin.
     
    5964     * @param WCAV_Validator $validator The Validator.
    6065     */
    61     public function setup( $plugin_path, $plugin_url, WCAV_Validator $validator ) {
    62 
    63         $this->plugin_path = $plugin_path;
    64         $this->plugin_url  = $plugin_url;
    65         $this->validator   = $validator;
     66    public function setup( $plugin_path, $plugin_url, WCAV_Validator $validator, $allow_invalidaddr ) {
     67
     68        $this->plugin_path       = $plugin_path;
     69        $this->plugin_url        = $plugin_url;
     70        $this->validator         = $validator;
     71        $this->allow_invalidaddr = $allow_invalidaddr;
    6672
    6773        add_action( 'woocommerce_after_checkout_validation', array( $this, 'validate' ) );
     
    168174            if ( ! $this->is_valid_billing && $is_first_round ) {
    169175                $this->wc_notice();
    170                 if ( 'SUSPECT' === $this->validator->get_status() ) {
     176                if ( $this->allow_invalidaddr && 'INVALID' === $this->validator->get_status() || 'SUSPECT' === $this->validator->get_status() ) {
    171177                    $set_cookie = TRUE;
    172178                    $address = $this->validator->get_sanitized_address();
     
    190196            if ( ! $this->is_valid_shipping && $is_first_round ) {
    191197
    192                 if ( 'SUSPECT' === $this->validator->get_status() ) {
     198               if ( $this->allow_invalidaddr && 'INVALID' === $this->validator->get_status() || 'SUSPECT' === $this->validator->get_status() ) {
    193199                    $set_cookie = TRUE;
    194200                    $address = $this->validator->get_sanitized_address();
     
    213219    public function wc_notice() {
    214220
    215         if ( 'SUSPECT' === strtoupper( $this->validator->get_status() ) ) {
    216             $string = __( 'We have corrected your address. Please check the address again.', 'woo-address-validator' );
    217         } else {
    218             $string = __( 'Please enter a valid address.', 'woo-address-validator' );
    219         }
     221        if ( 'SUSPECT' === strtoupper( $this->validator->get_status() ) ) {
     222            $string = __( 'We have corrected your address. Please check the address again.', 'woo-address-validator' );
     223        } elseif ( $this->allow_invalidaddr && 'INVALID' == strtoupper( $this->validator->get_status() ) ) {
     224            $string = __( 'Your address could not be verified. Please check the address again.', 'woo-address-validator' );
     225        } else {
     226            $string = __( 'Please enter a valid address.', 'woo-address-validator' );
     227        }
    220228        wc_add_notice( $string, 'error' );
    221229    }
  • woo-address-validator/tags/2.8/src/WC/WCAV_WC_Admin.php

    r1629762 r2718528  
    1919
    2020    /**
    21      * Display the status of the billing adress of an order.
     21     * Display the status of the billing address of an order.
    2222     *
    2323     * @param $order
     
    3838
    3939    /**
    40      * Display the status of the status adress of an order.
     40     * Display the status of the shipping address of an order.
    4141     *
    4242     * @param $order
  • woo-address-validator/tags/2.8/woocommerce-address-validator.php

    r2630781 r2718528  
    44 * Plugin URI: https://www.address-validator.net/
    55 * Description: Validate billing and shipping addresses in WooCommerce.
    6  * Version: 2.7
     6 * Version: 2.8
    77 * Author: Byteplant
    88 * Author URI: https://www.address-validator.net/
  • woo-address-validator/trunk/languages/woo-address-validator-de_DE.po

    r2718527 r2718528  
    22msgstr ""
    33"Project-Id-Version: Woocommerce Address Validator\n"
    4 "POT-Creation-Date: 2020-11-26 10:32+0100\n"
    5 "PO-Revision-Date: 2020-11-26 10:33+0100\n"
     4"POT-Creation-Date: 2022-05-04 18:50+0200\n"
     5"PO-Revision-Date: 2022-05-04 18:52+0200\n"
    66"Last-Translator: \n"
    77"Language-Team: \n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "X-Generator: Poedit 2.4.2\n"
     12"X-Generator: Poedit 3.0.1\n"
    1313"X-Poedit-KeywordsList: _;gettext;gettext_noop;esc_html_e;__;_e\n"
    1414"X-Poedit-Basepath: ..\n"
    1515"X-Poedit-SearchPath-0: .\n"
    1616
    17 #: src/Admin.php:140
     17#: src/Admin.php:146
    1818msgid "Address Validator"
    1919msgstr "Address Validator"
    2020
    21 #: src/Admin.php:157
     21#: src/Admin.php:163
    2222msgid "An error occured."
    2323msgstr "Ein Fehler ist aufgetreten."
    2424
    25 #: src/Admin.php:158 src/WC/WCAV_WC_Admin.php:97
     25#: src/Admin.php:164 src/WC/WCAV_WC_Admin.php:97
    2626msgid "API Result"
    2727msgstr "API Ergebnis"
    2828
    29 #: src/Admin.php:178
     29#: src/Admin.php:184
    3030msgid "Woocommerce Address Validator"
    3131msgstr "Woocommerce Address Validator"
    3232
    33 #: src/Admin.php:181
     33#: src/Admin.php:187
    3434msgid ""
    3535"It looks like your API key is invalid or depleted. Please check your key and "
     
    3939"API Key prüfen und aktualisieren."
    4040
    41 #: src/Admin.php:182
     41#: src/Admin.php:188
    4242#, php-format
    4343msgid ""
     
    4747"einloggen."
    4848
    49 #: src/Admin.php:191
     49#: src/Admin.php:197
    5050msgid "API Key"
    5151msgstr "API Key"
    5252
    53 #: src/Admin.php:199
     53#: src/Admin.php:205
     54msgid "Allow INVALID Addresses"
     55msgstr "Ungültige Adressen zulassen"
     56
     57#: src/Admin.php:213
    5458msgid "Update"
    5559msgstr "Aktualisieren"
    5660
    57 #: src/Admin.php:205
     61#: src/Admin.php:219
     62msgid ""
     63"Allow INVALID Addresses will prompt the user to check an address that could "
     64"not be validated, and allow them to continue (this feature was contributed "
     65"by \"Simply Charlotte Mason\" --- https://simplycharlottemason.com)."
     66msgstr ""
     67"Ungültige Adressen zulassen fordert den Benutzer auf, eine Adresse zu "
     68"überprüfen, die nicht validiert werden konnte, und erlaubt dann die "
     69"Fortsetzung des Checkouts (diese Funktion wurde von \"Simply Charlotte Mason"
     70"\" --- https://simplycharlottemason.com beigetragen)."
     71
     72#: src/Admin.php:224
    5873msgid ""
    5974"With Address-Validator you can easily verify any national or international "
     
    6681"Kunden zu erhalten."
    6782
    68 #: src/Admin.php:212
     83#: src/Admin.php:231
    6984#, php-format
    7085msgid ""
     
    7590"625 kostenlosen Credits."
    7691
    77 #: src/Admin.php:234
     92#: src/Admin.php:253
    7893msgid "Your Address-Validator API key is invalid or depleted."
    7994msgstr "Der API Key ist ungültig oder die Credits sind verbraucht."
    8095
    81 #: src/Admin.php:241
     96#: src/Admin.php:260
    8297#, php-format
    8398msgid ""
     
    85100msgstr "API Key <a href=\"%s\">auf der Einstellungsseite</a> prüfen/ändern."
    86101
    87 #: src/WC/WC.php:216
     102#: src/WC/WC.php:222
    88103msgid "We have corrected your address. Please check the address again."
    89104msgstr ""
    90105"Wir haben die Adresse korrigiert. Bitte prüfen, ob die Angaben jetzt stimmen."
    91106
    92 #: src/WC/WC.php:218
     107#: src/WC/WC.php:224
     108msgid "Your address could not be verified. Please check the address again."
     109msgstr ""
     110"Die Adresse konnte nicht verifiziert werden. Bitte überprüfen Sie die "
     111"Adresse erneut."
     112
     113#: src/WC/WC.php:226
    93114msgid "Please enter a valid address."
    94115msgstr "Bitte eine gültige Adresse angeben."
  • woo-address-validator/trunk/readme.txt

    r2630781 r2718528  
    33Tags: woocommerce, validation, address, address validation, billing, shipping, delivery, billing address, shipping address, checkout
    44Requires at least: 3.0.1
    5 Tested up to: 5.8.2
    6 Stable tag: 2.7
     5Tested up to: 5.9.3
     6Stable tag: 2.8
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • woo-address-validator/trunk/src/Admin.php

    r2426438 r2718528  
    8080        $this->validator   = $validator;
    8181
    82         $this->defaults = array(
    83             'api-key' => '',
    84         );
     82        $this->defaults = array(
     83            'api-key' => '',
     84            'allow-invalidaddr' => 0
     85        );
    8586
    8687        add_action( 'admin_menu', array( $this, 'admin_menu' ) );
     
    9192            && wp_verify_nonce( sanitize_text_field( wp_unslash( $_POST[ $this->action_name ] ) ), $this->action )
    9293        ) {
    93             $data = (array) wp_unslash( $_POST['wcav'] );
     94            $data = (array) wp_unslash( $_POST['wcav'] );
     95            // checkbox is missing in form data if unchecked, set to 0
     96            if ( ! isset( $data['allow-invalidaddr'] ) ) {
     97                $data[ 'allow-invalidaddr' ] = 0;
     98            }
    9499            if ( $this->update( $data ) ) {
    95100                $url = admin_url( 'options-general.php' );
     
    194199                                <input type="text" name="wcav[api-key]" value="<?php echo esc_attr( $options['api-key'] ); ?>">
    195200                            </td>
    196                         </tr>
     201                        </tr>                       
     202                        <tr>
     203                            <th scope="row">
     204                                <label for="allow-invalidaddr"><?php esc_html_e( 'Allow INVALID Addresses', 'woo-address-validator' ); ?></label>
     205                            </th>
     206                            <td>
     207                                <input type="checkbox" name="wcav[allow-invalidaddr]" value="1" <?php checked(1, $options['allow-invalidaddr'], true); ?> >
     208                            </td>
     209                        </tr>                       
    197210                    </tbody>
    198211                </table>
     
    201214            <hr>
    202215            <p>
     216                <?php
     217                esc_html_e(
     218                    'Allow INVALID Addresses will prompt the user to check an address that could not be validated, and allow them to continue (this feature was contributed by "Simply Charlotte Mason" --- https://simplycharlottemason.com).', 'woo-address-validator'
     219                );
     220                ?><br><br>
    203221                <?php
    204222                esc_html_e(
  • woo-address-validator/trunk/src/Plugin.php

    r1625016 r2718528  
    4444     * @var WCAV_Validator | NULL
    4545     */
    46     private $validator = NULL;
     46    private $validator = NULL;
     47       
     48   /**
     49    * Allow INVALID addresses option.
     50    *
     51    * @var bool
     52    */
     53   private $allow_invalidaddr = 0;
    4754
    4855    /**
     
    5764        if ( ! empty( $options['api-key'] )  ) {
    5865            $this->api_key = $options['api-key'];
     66        }
     67        if ( ! empty( $options['allow-invalidaddr'] )  ) {
     68            $this->allow_invalidaddr = $options['allow-invalidaddr'];
    5969        }
    6070
     
    7585        require_once( dirname( __FILE__ ) . '/WC/WC.php' );
    7686        $wc = new WCAV_WC();
    77         $wc->setup( $this->plugin_path, $this->plugin_url, $this->validator );
     87        $wc->setup( $this->plugin_path, $this->plugin_url, $this->validator, $this->allow_invalidaddr );
    7888    }
    7989}
  • woo-address-validator/trunk/src/WC/WC.php

    r1629762 r2718528  
    5252    private $billing_status;
    5353
     54    /**
     55     * @var bool
     56     */
     57    private $allow_invalidaddr;
     58
    5459    /**
    5560     * Setup the admin.
     
    5964     * @param WCAV_Validator $validator The Validator.
    6065     */
    61     public function setup( $plugin_path, $plugin_url, WCAV_Validator $validator ) {
    62 
    63         $this->plugin_path = $plugin_path;
    64         $this->plugin_url  = $plugin_url;
    65         $this->validator   = $validator;
     66    public function setup( $plugin_path, $plugin_url, WCAV_Validator $validator, $allow_invalidaddr ) {
     67
     68        $this->plugin_path       = $plugin_path;
     69        $this->plugin_url        = $plugin_url;
     70        $this->validator         = $validator;
     71        $this->allow_invalidaddr = $allow_invalidaddr;
    6672
    6773        add_action( 'woocommerce_after_checkout_validation', array( $this, 'validate' ) );
     
    168174            if ( ! $this->is_valid_billing && $is_first_round ) {
    169175                $this->wc_notice();
    170                 if ( 'SUSPECT' === $this->validator->get_status() ) {
     176                if ( $this->allow_invalidaddr && 'INVALID' === $this->validator->get_status() || 'SUSPECT' === $this->validator->get_status() ) {
    171177                    $set_cookie = TRUE;
    172178                    $address = $this->validator->get_sanitized_address();
     
    190196            if ( ! $this->is_valid_shipping && $is_first_round ) {
    191197
    192                 if ( 'SUSPECT' === $this->validator->get_status() ) {
     198               if ( $this->allow_invalidaddr && 'INVALID' === $this->validator->get_status() || 'SUSPECT' === $this->validator->get_status() ) {
    193199                    $set_cookie = TRUE;
    194200                    $address = $this->validator->get_sanitized_address();
     
    213219    public function wc_notice() {
    214220
    215         if ( 'SUSPECT' === strtoupper( $this->validator->get_status() ) ) {
    216             $string = __( 'We have corrected your address. Please check the address again.', 'woo-address-validator' );
    217         } else {
    218             $string = __( 'Please enter a valid address.', 'woo-address-validator' );
    219         }
     221        if ( 'SUSPECT' === strtoupper( $this->validator->get_status() ) ) {
     222            $string = __( 'We have corrected your address. Please check the address again.', 'woo-address-validator' );
     223        } elseif ( $this->allow_invalidaddr && 'INVALID' == strtoupper( $this->validator->get_status() ) ) {
     224            $string = __( 'Your address could not be verified. Please check the address again.', 'woo-address-validator' );
     225        } else {
     226            $string = __( 'Please enter a valid address.', 'woo-address-validator' );
     227        }
    220228        wc_add_notice( $string, 'error' );
    221229    }
  • woo-address-validator/trunk/src/WC/WCAV_WC_Admin.php

    r1629762 r2718528  
    1919
    2020    /**
    21      * Display the status of the billing adress of an order.
     21     * Display the status of the billing address of an order.
    2222     *
    2323     * @param $order
     
    3838
    3939    /**
    40      * Display the status of the status adress of an order.
     40     * Display the status of the shipping address of an order.
    4141     *
    4242     * @param $order
  • woo-address-validator/trunk/woocommerce-address-validator.php

    r2630781 r2718528  
    44 * Plugin URI: https://www.address-validator.net/
    55 * Description: Validate billing and shipping addresses in WooCommerce.
    6  * Version: 2.7
     6 * Version: 2.8
    77 * Author: Byteplant
    88 * Author URI: https://www.address-validator.net/
Note: See TracChangeset for help on using the changeset viewer.