Plugin Directory

Changeset 3156636


Ignore:
Timestamp:
09/24/2024 06:52:11 AM (18 months ago)
Author:
seebeen
Message:

Update to version 3.7.4 from GitHub

Location:
serbian-addons-for-woocommerce
Files:
12 edited
1 copied

Legend:

Unmodified
Added
Removed
  • serbian-addons-for-woocommerce/tags/3.7.4/lib/Checkout/Field_Customizer.php

    r3155827 r3156636  
    4242    #[Filter( tag: 'woocommerce_billing_fields', priority: 'woocommerce_serbian_checkout_fields_priority' )]
    4343    public function modify_billing_fields( $fields ) {
    44         $enabled_type = \WCSRB()->get_settings( 'general', 'enabled_customer_types' );
     44        $enabled_type = \WCSRB()->get_settings( 'core', 'enabled_customer_types' );
    4545
    4646        $fields = $this->maybe_remove_fields( $fields );
  • serbian-addons-for-woocommerce/tags/3.7.4/lib/Order/Field_Display.php

    r3155827 r3156636  
    3232        $formats['RS'] = "{name}\n{company}\n{mb}\n{pib}\n{address_1}\n{address_2}\n{postcode} {city}, {state} {country}";
    3333
    34         if ( \WCSRB()->get_settings( 'general', 'remove_unneeded_fields' ) ) {
     34        if ( \WCSRB()->get_settings( 'core', 'remove_unneeded_fields' ) ) {
    3535            $formats['RS'] = \str_replace( array( '{state}', '{address_2}' ), '', $formats['RS'] );
    3636        }
  • serbian-addons-for-woocommerce/tags/3.7.4/lib/Serbian_WooCommerce.php

    r3156268 r3156636  
    88namespace Oblak\WooCommerce\Serbian_Addons;
    99
    10 use Oblak\WooCommerce\Core\Settings_Helper;
    1110use Oblak\WP\Decorators\Action;
    1211use Oblak\WP\Decorators\Filter;
    1312use Oblak\WP\Traits\Hook_Processor_Trait;
     13use XWC\Traits\Settings_API_Methods;
    1414use XWP\Helper\Traits\Singleton;
    1515
     
    1919class Serbian_WooCommerce {
    2020    use Hook_Processor_Trait;
    21     use Settings_Helper {
    22         Settings_Helper::load_settings as load_settings_helper;
    23     }
     21    use Settings_API_Methods;
    2422    use Singleton;
    2523    use \XWP_Asset_Retriever;
     
    6260
    6361    /**
    64      * Get the settings array from the database
    65      *
    66      * We use the helper settings loader to load the settings, and then we add the company info
    67      * because it is a mix of our settings and WooCommerce settings.
    68      *
    69      * @param  string $prefix        The settings prefix.
    70      * @param  array  $raw_settings  The settings fields.
    71      * @param  mixed  $default_value The default value for the settings.
    72      * @return array                 The settings array.
    73      */
    74     protected function load_settings( string $prefix, array $raw_settings, $default_value ): array {
    75         $settings = $this->load_settings_helper( $prefix, $raw_settings, $default_value );
    76 
    77         $settings['company'] = array(
    78             'accounts'  => \wcsrb_get_bank_accounts(),
    79             'address'   => \get_option( 'woocommerce_store_address', '' ),
    80             'address_2' => \get_option( 'woocommerce_store_address_2', '' ),
    81             'city'      => \get_option( 'woocommerce_store_city', '' ),
    82             'country'   => \wc_get_base_location()['country'],
    83             'logo'      => \get_option( 'site_icon', 0 ),
    84             'name'      => \get_option( 'woocommerce_store_name', '' ),
    85             'postcode'  => \get_option( 'woocommerce_store_postcode', '' ),
    86         );
    87 
    88         return $settings;
    89     }
    90 
    91     /**
    9262     * Initializes the installer
    9363     */
     
    10272    #[Action( tag: 'woocommerce_loaded', priority: 99 )]
    10373    public function load_plugin_settings() {
    104         $this->settings = $this->load_settings(
    105             'wcsrb',
    106             require WCRS_PLUGIN_PATH . 'config/settings.php',
    107             false,
     74        $this->load_options( 'wcsrb_settings' );
     75
     76        $this->settings['enabled_customer_types'] ??= 'both';
     77        $this->settings['remove_unneeded_fields'] ??= false;
     78        $this->settings['fix_currency_symbol']    ??= true;
     79        $this->settings['company']                  = array(
     80            'accounts'  => \wcsrb_get_bank_accounts(),
     81            'address'   => \get_option( 'woocommerce_store_address', '' ),
     82            'address_2' => \get_option( 'woocommerce_store_address_2', '' ),
     83            'city'      => \get_option( 'woocommerce_store_city', '' ),
     84            'country'   => \wc_get_base_location()['country'],
     85            'logo'      => \get_option( 'site_icon', 0 ),
     86            'name'      => \get_option( 'woocommerce_store_name', '' ),
     87            'postcode'  => \get_option( 'woocommerce_store_postcode', '' ),
    10888        );
    10989    }
     
    146126    #[Filter( tag: 'woocommerce_currency_symbol', priority: 99 )]
    147127    public function change_currency_symbol( string $symbol, string $currency ): string {
    148         if ( ! $this->get_settings( 'general', 'fix_currency_symbol' ) ) {
     128        if ( ! $this->get_settings( 'core', 'fix_currency_symbol' ) ) {
    149129            return $symbol;
    150130        }
  • serbian-addons-for-woocommerce/tags/3.7.4/lib/Utils/wcsrb-settings.php

    r3155827 r3156636  
    6363    );
    6464
    65     switch ( WCSRB()->get_settings( 'general', 'enabled_customer_types' ) ) {
     65    switch ( WCSRB()->get_settings( 'core', 'enabled_customer_types' ) ) {
    6666        case 'both':
    6767            unset( $options[ __( 'Company', 'serbian-addons-for-woocommerce' ) ] );
  • serbian-addons-for-woocommerce/tags/3.7.4/readme.txt

    r3156614 r3156636  
    88WC requires at least: 8.5
    99WC tested up to: 9.2
    10 Stable tag: 3.7.3
     10Stable tag: 3.7.4
    1111License: GPLv2 or later
    1212License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • serbian-addons-for-woocommerce/tags/3.7.4/serbian-addons-for-woocommerce.php

    r3156614 r3156636  
    44 * Plugin URI:           https://oblak.studio/open-source/srpski-woocommerce
    55 * Description:          Various addons and tweaks that make WooCommerce compatible with Serbian bureaucracy.
    6  * Version:              3.7.3
     6 * Version:              3.7.4
    77 * Requires PHP:         8.0
    88 * Author:               Oblak Studio
     
    2525defined( 'WCRS_PLUGIN_BASE' ) || define( 'WCRS_PLUGIN_BASE', plugin_basename( WCRS_PLUGIN_FILE ) );
    2626defined( 'WCRS_PLUGIN_PATH' ) || define( 'WCRS_PLUGIN_PATH', plugin_dir_path( WCRS_PLUGIN_FILE ) );
    27 defined( 'WCRS_VERSION' )     || define( 'WCRS_VERSION', '3.7.3' );
     27defined( 'WCRS_VERSION' )     || define( 'WCRS_VERSION', '3.7.4' );
    2828// phpcs:enable WordPress.WhiteSpace.OperatorSpacing.SpacingBefore
    2929
  • serbian-addons-for-woocommerce/trunk/lib/Checkout/Field_Customizer.php

    r3155827 r3156636  
    4242    #[Filter( tag: 'woocommerce_billing_fields', priority: 'woocommerce_serbian_checkout_fields_priority' )]
    4343    public function modify_billing_fields( $fields ) {
    44         $enabled_type = \WCSRB()->get_settings( 'general', 'enabled_customer_types' );
     44        $enabled_type = \WCSRB()->get_settings( 'core', 'enabled_customer_types' );
    4545
    4646        $fields = $this->maybe_remove_fields( $fields );
  • serbian-addons-for-woocommerce/trunk/lib/Order/Field_Display.php

    r3155827 r3156636  
    3232        $formats['RS'] = "{name}\n{company}\n{mb}\n{pib}\n{address_1}\n{address_2}\n{postcode} {city}, {state} {country}";
    3333
    34         if ( \WCSRB()->get_settings( 'general', 'remove_unneeded_fields' ) ) {
     34        if ( \WCSRB()->get_settings( 'core', 'remove_unneeded_fields' ) ) {
    3535            $formats['RS'] = \str_replace( array( '{state}', '{address_2}' ), '', $formats['RS'] );
    3636        }
  • serbian-addons-for-woocommerce/trunk/lib/Serbian_WooCommerce.php

    r3156268 r3156636  
    88namespace Oblak\WooCommerce\Serbian_Addons;
    99
    10 use Oblak\WooCommerce\Core\Settings_Helper;
    1110use Oblak\WP\Decorators\Action;
    1211use Oblak\WP\Decorators\Filter;
    1312use Oblak\WP\Traits\Hook_Processor_Trait;
     13use XWC\Traits\Settings_API_Methods;
    1414use XWP\Helper\Traits\Singleton;
    1515
     
    1919class Serbian_WooCommerce {
    2020    use Hook_Processor_Trait;
    21     use Settings_Helper {
    22         Settings_Helper::load_settings as load_settings_helper;
    23     }
     21    use Settings_API_Methods;
    2422    use Singleton;
    2523    use \XWP_Asset_Retriever;
     
    6260
    6361    /**
    64      * Get the settings array from the database
    65      *
    66      * We use the helper settings loader to load the settings, and then we add the company info
    67      * because it is a mix of our settings and WooCommerce settings.
    68      *
    69      * @param  string $prefix        The settings prefix.
    70      * @param  array  $raw_settings  The settings fields.
    71      * @param  mixed  $default_value The default value for the settings.
    72      * @return array                 The settings array.
    73      */
    74     protected function load_settings( string $prefix, array $raw_settings, $default_value ): array {
    75         $settings = $this->load_settings_helper( $prefix, $raw_settings, $default_value );
    76 
    77         $settings['company'] = array(
    78             'accounts'  => \wcsrb_get_bank_accounts(),
    79             'address'   => \get_option( 'woocommerce_store_address', '' ),
    80             'address_2' => \get_option( 'woocommerce_store_address_2', '' ),
    81             'city'      => \get_option( 'woocommerce_store_city', '' ),
    82             'country'   => \wc_get_base_location()['country'],
    83             'logo'      => \get_option( 'site_icon', 0 ),
    84             'name'      => \get_option( 'woocommerce_store_name', '' ),
    85             'postcode'  => \get_option( 'woocommerce_store_postcode', '' ),
    86         );
    87 
    88         return $settings;
    89     }
    90 
    91     /**
    9262     * Initializes the installer
    9363     */
     
    10272    #[Action( tag: 'woocommerce_loaded', priority: 99 )]
    10373    public function load_plugin_settings() {
    104         $this->settings = $this->load_settings(
    105             'wcsrb',
    106             require WCRS_PLUGIN_PATH . 'config/settings.php',
    107             false,
     74        $this->load_options( 'wcsrb_settings' );
     75
     76        $this->settings['enabled_customer_types'] ??= 'both';
     77        $this->settings['remove_unneeded_fields'] ??= false;
     78        $this->settings['fix_currency_symbol']    ??= true;
     79        $this->settings['company']                  = array(
     80            'accounts'  => \wcsrb_get_bank_accounts(),
     81            'address'   => \get_option( 'woocommerce_store_address', '' ),
     82            'address_2' => \get_option( 'woocommerce_store_address_2', '' ),
     83            'city'      => \get_option( 'woocommerce_store_city', '' ),
     84            'country'   => \wc_get_base_location()['country'],
     85            'logo'      => \get_option( 'site_icon', 0 ),
     86            'name'      => \get_option( 'woocommerce_store_name', '' ),
     87            'postcode'  => \get_option( 'woocommerce_store_postcode', '' ),
    10888        );
    10989    }
     
    146126    #[Filter( tag: 'woocommerce_currency_symbol', priority: 99 )]
    147127    public function change_currency_symbol( string $symbol, string $currency ): string {
    148         if ( ! $this->get_settings( 'general', 'fix_currency_symbol' ) ) {
     128        if ( ! $this->get_settings( 'core', 'fix_currency_symbol' ) ) {
    149129            return $symbol;
    150130        }
  • serbian-addons-for-woocommerce/trunk/lib/Utils/wcsrb-settings.php

    r3155827 r3156636  
    6363    );
    6464
    65     switch ( WCSRB()->get_settings( 'general', 'enabled_customer_types' ) ) {
     65    switch ( WCSRB()->get_settings( 'core', 'enabled_customer_types' ) ) {
    6666        case 'both':
    6767            unset( $options[ __( 'Company', 'serbian-addons-for-woocommerce' ) ] );
  • serbian-addons-for-woocommerce/trunk/readme.txt

    r3156614 r3156636  
    88WC requires at least: 8.5
    99WC tested up to: 9.2
    10 Stable tag: 3.7.3
     10Stable tag: 3.7.4
    1111License: GPLv2 or later
    1212License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • serbian-addons-for-woocommerce/trunk/serbian-addons-for-woocommerce.php

    r3156614 r3156636  
    44 * Plugin URI:           https://oblak.studio/open-source/srpski-woocommerce
    55 * Description:          Various addons and tweaks that make WooCommerce compatible with Serbian bureaucracy.
    6  * Version:              3.7.3
     6 * Version:              3.7.4
    77 * Requires PHP:         8.0
    88 * Author:               Oblak Studio
     
    2525defined( 'WCRS_PLUGIN_BASE' ) || define( 'WCRS_PLUGIN_BASE', plugin_basename( WCRS_PLUGIN_FILE ) );
    2626defined( 'WCRS_PLUGIN_PATH' ) || define( 'WCRS_PLUGIN_PATH', plugin_dir_path( WCRS_PLUGIN_FILE ) );
    27 defined( 'WCRS_VERSION' )     || define( 'WCRS_VERSION', '3.7.3' );
     27defined( 'WCRS_VERSION' )     || define( 'WCRS_VERSION', '3.7.4' );
    2828// phpcs:enable WordPress.WhiteSpace.OperatorSpacing.SpacingBefore
    2929
Note: See TracChangeset for help on using the changeset viewer.