Changeset 3156636
- Timestamp:
- 09/24/2024 06:52:11 AM (18 months ago)
- Location:
- serbian-addons-for-woocommerce
- Files:
-
- 12 edited
- 1 copied
-
tags/3.7.4 (copied) (copied from serbian-addons-for-woocommerce/trunk)
-
tags/3.7.4/lib/Checkout/Field_Customizer.php (modified) (1 diff)
-
tags/3.7.4/lib/Order/Field_Display.php (modified) (1 diff)
-
tags/3.7.4/lib/Serbian_WooCommerce.php (modified) (5 diffs)
-
tags/3.7.4/lib/Utils/wcsrb-settings.php (modified) (1 diff)
-
tags/3.7.4/readme.txt (modified) (1 diff)
-
tags/3.7.4/serbian-addons-for-woocommerce.php (modified) (2 diffs)
-
trunk/lib/Checkout/Field_Customizer.php (modified) (1 diff)
-
trunk/lib/Order/Field_Display.php (modified) (1 diff)
-
trunk/lib/Serbian_WooCommerce.php (modified) (5 diffs)
-
trunk/lib/Utils/wcsrb-settings.php (modified) (1 diff)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/serbian-addons-for-woocommerce.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
serbian-addons-for-woocommerce/tags/3.7.4/lib/Checkout/Field_Customizer.php
r3155827 r3156636 42 42 #[Filter( tag: 'woocommerce_billing_fields', priority: 'woocommerce_serbian_checkout_fields_priority' )] 43 43 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' ); 45 45 46 46 $fields = $this->maybe_remove_fields( $fields ); -
serbian-addons-for-woocommerce/tags/3.7.4/lib/Order/Field_Display.php
r3155827 r3156636 32 32 $formats['RS'] = "{name}\n{company}\n{mb}\n{pib}\n{address_1}\n{address_2}\n{postcode} {city}, {state} {country}"; 33 33 34 if ( \WCSRB()->get_settings( ' general', 'remove_unneeded_fields' ) ) {34 if ( \WCSRB()->get_settings( 'core', 'remove_unneeded_fields' ) ) { 35 35 $formats['RS'] = \str_replace( array( '{state}', '{address_2}' ), '', $formats['RS'] ); 36 36 } -
serbian-addons-for-woocommerce/tags/3.7.4/lib/Serbian_WooCommerce.php
r3156268 r3156636 8 8 namespace Oblak\WooCommerce\Serbian_Addons; 9 9 10 use Oblak\WooCommerce\Core\Settings_Helper;11 10 use Oblak\WP\Decorators\Action; 12 11 use Oblak\WP\Decorators\Filter; 13 12 use Oblak\WP\Traits\Hook_Processor_Trait; 13 use XWC\Traits\Settings_API_Methods; 14 14 use XWP\Helper\Traits\Singleton; 15 15 … … 19 19 class Serbian_WooCommerce { 20 20 use Hook_Processor_Trait; 21 use Settings_Helper { 22 Settings_Helper::load_settings as load_settings_helper; 23 } 21 use Settings_API_Methods; 24 22 use Singleton; 25 23 use \XWP_Asset_Retriever; … … 62 60 63 61 /** 64 * Get the settings array from the database65 *66 * We use the helper settings loader to load the settings, and then we add the company info67 * 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 /**92 62 * Initializes the installer 93 63 */ … … 102 72 #[Action( tag: 'woocommerce_loaded', priority: 99 )] 103 73 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', '' ), 108 88 ); 109 89 } … … 146 126 #[Filter( tag: 'woocommerce_currency_symbol', priority: 99 )] 147 127 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' ) ) { 149 129 return $symbol; 150 130 } -
serbian-addons-for-woocommerce/tags/3.7.4/lib/Utils/wcsrb-settings.php
r3155827 r3156636 63 63 ); 64 64 65 switch ( WCSRB()->get_settings( ' general', 'enabled_customer_types' ) ) {65 switch ( WCSRB()->get_settings( 'core', 'enabled_customer_types' ) ) { 66 66 case 'both': 67 67 unset( $options[ __( 'Company', 'serbian-addons-for-woocommerce' ) ] ); -
serbian-addons-for-woocommerce/tags/3.7.4/readme.txt
r3156614 r3156636 8 8 WC requires at least: 8.5 9 9 WC tested up to: 9.2 10 Stable tag: 3.7. 310 Stable tag: 3.7.4 11 11 License: GPLv2 or later 12 12 License 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 4 4 * Plugin URI: https://oblak.studio/open-source/srpski-woocommerce 5 5 * Description: Various addons and tweaks that make WooCommerce compatible with Serbian bureaucracy. 6 * Version: 3.7. 36 * Version: 3.7.4 7 7 * Requires PHP: 8.0 8 8 * Author: Oblak Studio … … 25 25 defined( 'WCRS_PLUGIN_BASE' ) || define( 'WCRS_PLUGIN_BASE', plugin_basename( WCRS_PLUGIN_FILE ) ); 26 26 defined( 'WCRS_PLUGIN_PATH' ) || define( 'WCRS_PLUGIN_PATH', plugin_dir_path( WCRS_PLUGIN_FILE ) ); 27 defined( 'WCRS_VERSION' ) || define( 'WCRS_VERSION', '3.7. 3' );27 defined( 'WCRS_VERSION' ) || define( 'WCRS_VERSION', '3.7.4' ); 28 28 // phpcs:enable WordPress.WhiteSpace.OperatorSpacing.SpacingBefore 29 29 -
serbian-addons-for-woocommerce/trunk/lib/Checkout/Field_Customizer.php
r3155827 r3156636 42 42 #[Filter( tag: 'woocommerce_billing_fields', priority: 'woocommerce_serbian_checkout_fields_priority' )] 43 43 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' ); 45 45 46 46 $fields = $this->maybe_remove_fields( $fields ); -
serbian-addons-for-woocommerce/trunk/lib/Order/Field_Display.php
r3155827 r3156636 32 32 $formats['RS'] = "{name}\n{company}\n{mb}\n{pib}\n{address_1}\n{address_2}\n{postcode} {city}, {state} {country}"; 33 33 34 if ( \WCSRB()->get_settings( ' general', 'remove_unneeded_fields' ) ) {34 if ( \WCSRB()->get_settings( 'core', 'remove_unneeded_fields' ) ) { 35 35 $formats['RS'] = \str_replace( array( '{state}', '{address_2}' ), '', $formats['RS'] ); 36 36 } -
serbian-addons-for-woocommerce/trunk/lib/Serbian_WooCommerce.php
r3156268 r3156636 8 8 namespace Oblak\WooCommerce\Serbian_Addons; 9 9 10 use Oblak\WooCommerce\Core\Settings_Helper;11 10 use Oblak\WP\Decorators\Action; 12 11 use Oblak\WP\Decorators\Filter; 13 12 use Oblak\WP\Traits\Hook_Processor_Trait; 13 use XWC\Traits\Settings_API_Methods; 14 14 use XWP\Helper\Traits\Singleton; 15 15 … … 19 19 class Serbian_WooCommerce { 20 20 use Hook_Processor_Trait; 21 use Settings_Helper { 22 Settings_Helper::load_settings as load_settings_helper; 23 } 21 use Settings_API_Methods; 24 22 use Singleton; 25 23 use \XWP_Asset_Retriever; … … 62 60 63 61 /** 64 * Get the settings array from the database65 *66 * We use the helper settings loader to load the settings, and then we add the company info67 * 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 /**92 62 * Initializes the installer 93 63 */ … … 102 72 #[Action( tag: 'woocommerce_loaded', priority: 99 )] 103 73 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', '' ), 108 88 ); 109 89 } … … 146 126 #[Filter( tag: 'woocommerce_currency_symbol', priority: 99 )] 147 127 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' ) ) { 149 129 return $symbol; 150 130 } -
serbian-addons-for-woocommerce/trunk/lib/Utils/wcsrb-settings.php
r3155827 r3156636 63 63 ); 64 64 65 switch ( WCSRB()->get_settings( ' general', 'enabled_customer_types' ) ) {65 switch ( WCSRB()->get_settings( 'core', 'enabled_customer_types' ) ) { 66 66 case 'both': 67 67 unset( $options[ __( 'Company', 'serbian-addons-for-woocommerce' ) ] ); -
serbian-addons-for-woocommerce/trunk/readme.txt
r3156614 r3156636 8 8 WC requires at least: 8.5 9 9 WC tested up to: 9.2 10 Stable tag: 3.7. 310 Stable tag: 3.7.4 11 11 License: GPLv2 or later 12 12 License URI: http://www.gnu.org/licenses/gpl-2.0.html -
serbian-addons-for-woocommerce/trunk/serbian-addons-for-woocommerce.php
r3156614 r3156636 4 4 * Plugin URI: https://oblak.studio/open-source/srpski-woocommerce 5 5 * Description: Various addons and tweaks that make WooCommerce compatible with Serbian bureaucracy. 6 * Version: 3.7. 36 * Version: 3.7.4 7 7 * Requires PHP: 8.0 8 8 * Author: Oblak Studio … … 25 25 defined( 'WCRS_PLUGIN_BASE' ) || define( 'WCRS_PLUGIN_BASE', plugin_basename( WCRS_PLUGIN_FILE ) ); 26 26 defined( 'WCRS_PLUGIN_PATH' ) || define( 'WCRS_PLUGIN_PATH', plugin_dir_path( WCRS_PLUGIN_FILE ) ); 27 defined( 'WCRS_VERSION' ) || define( 'WCRS_VERSION', '3.7. 3' );27 defined( 'WCRS_VERSION' ) || define( 'WCRS_VERSION', '3.7.4' ); 28 28 // phpcs:enable WordPress.WhiteSpace.OperatorSpacing.SpacingBefore 29 29
Note: See TracChangeset
for help on using the changeset viewer.