Plugin Directory

Changeset 3078305


Ignore:
Timestamp:
04/28/2024 06:37:29 PM (23 months ago)
Author:
seebeen
Message:

Update to version 3.5.8 from GitHub

Location:
serbian-addons-for-woocommerce
Files:
130 added
8 edited
1 copied

Legend:

Unmodified
Added
Removed
  • serbian-addons-for-woocommerce/tags/3.5.8/lib/QR/QR_Code_Handler.php

    r3026688 r3078305  
    5151     * Choose the best QR Code implementation.
    5252     *
    53      * @param  array $args QR Code arguments.
    5453     * @return string|false
    5554     */
    56     protected function choose_implementation( array $args ): string|false {
    57         $implementations = array( QR_Generator_ImageMagick::class, QR_Generator_GD::class );
    58 
    59         /**
    60          * Filter the list of QR Code implementations.
    61          *
    62          * @param  array<int, class-string> $implementations List of QR Code implementations.
    63          * @return array<int, class-string>
    64          *
    65          * @since 3.3.0
    66          */
    67         $implementations = \apply_filters( 'woocommerce_serbian_qr_code_implementations', $implementations );
    68         $implementation  = false;
    69 
    70         foreach ( $implementations as $generator ) {
    71             if ( ! \call_user_func( array( $generator, 'test' ), $args ) ) {
    72                 continue;
    73             }
    74 
    75             if (
    76                 isset( $args['format'] ) &&
    77                 ! \call_user_func( array( $generator, 'supports_format' ), $args['format'] )
    78             ) {
    79                 continue;
    80             }
    81 
    82             return $generator;
    83         }
    84 
    85         return $implementation;
     55    protected function choose_implementation(): string|false {
     56        if ( \class_exists( \Imagick::class ) ) {
     57            return QR_Generator_ImageMagick::class;
     58        }
     59
     60        return QR_Generator_GD::class;
    8661    }
    8762
     
    10782                ),
    10883                'outputBase64'     => false,
    109                 'outputInterface'  => $this->choose_implementation( $args ),
     84                'outputInterface'  => $this->choose_implementation(),
    11085                'outputType'       => QROutputInterface::CUSTOM,
    11186                'quietzoneSize'    => 1,
     
    11388            ),
    11489        );
     90
     91        if ( QR_Generator_GD::class === $args['outputInterface'] ) {
     92            $args['moduleValues'] = \array_map( array( $this, 'hex2rgb' ), $args['moduleValues'] );
     93        }
    11594
    11695        /**
     
    130109
    131110    /**
     111     * Converts a hex color to RGB.
     112     *
     113     * @param  string $hex Hex color.
     114     * @return array       RGB color.
     115     */
     116    public function hex2rgb( string $hex ): array {
     117        $hex = \hexdec( \ltrim( $hex, '#' ) );
     118
     119        $r = ( $hex >> 16 ) & 0xFF;
     120        $g = ( $hex >> 8 ) & 0xFF;
     121        $b = $hex & 0xFF;
     122
     123        return array( $r, $g, $b );
     124    }
     125
     126    /**
    132127     * Initializes the handler.
    133128     *
  • serbian-addons-for-woocommerce/tags/3.5.8/readme.txt

    r3030701 r3078305  
    88WC requires at least: 8.0
    99WC tested up to: 8.3
    10 Stable tag: 3.5.7
     10Stable tag: 3.5.8
    1111License: GPLv2 or later
    1212License URI: http://www.gnu.org/licenses/gpl-2.0.html
  • serbian-addons-for-woocommerce/tags/3.5.8/serbian-addons-for-woocommerce.php

    r3030701 r3078305  
    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.5.7
     6 * Version:              3.5.8
    77 * Requires PHP:         8.0
    88 * Author:               Oblak Studio
  • serbian-addons-for-woocommerce/tags/3.5.8/vendor/composer/installed.php

    r3030669 r3078305  
    44        'pretty_version' => '1.0.0+no-version-set',
    55        'version' => '1.0.0.0',
    6         'reference' => NULL,
     6        'reference' => null,
    77        'type' => 'project',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => '1.0.0+no-version-set',
    1515            'version' => '1.0.0.0',
    16             'reference' => NULL,
     16            'reference' => null,
    1717            'type' => 'project',
    1818            'install_path' => __DIR__ . '/../../',
  • serbian-addons-for-woocommerce/trunk/lib/QR/QR_Code_Handler.php

    r3026688 r3078305  
    5151     * Choose the best QR Code implementation.
    5252     *
    53      * @param  array $args QR Code arguments.
    5453     * @return string|false
    5554     */
    56     protected function choose_implementation( array $args ): string|false {
    57         $implementations = array( QR_Generator_ImageMagick::class, QR_Generator_GD::class );
    58 
    59         /**
    60          * Filter the list of QR Code implementations.
    61          *
    62          * @param  array<int, class-string> $implementations List of QR Code implementations.
    63          * @return array<int, class-string>
    64          *
    65          * @since 3.3.0
    66          */
    67         $implementations = \apply_filters( 'woocommerce_serbian_qr_code_implementations', $implementations );
    68         $implementation  = false;
    69 
    70         foreach ( $implementations as $generator ) {
    71             if ( ! \call_user_func( array( $generator, 'test' ), $args ) ) {
    72                 continue;
    73             }
    74 
    75             if (
    76                 isset( $args['format'] ) &&
    77                 ! \call_user_func( array( $generator, 'supports_format' ), $args['format'] )
    78             ) {
    79                 continue;
    80             }
    81 
    82             return $generator;
    83         }
    84 
    85         return $implementation;
     55    protected function choose_implementation(): string|false {
     56        if ( \class_exists( \Imagick::class ) ) {
     57            return QR_Generator_ImageMagick::class;
     58        }
     59
     60        return QR_Generator_GD::class;
    8661    }
    8762
     
    10782                ),
    10883                'outputBase64'     => false,
    109                 'outputInterface'  => $this->choose_implementation( $args ),
     84                'outputInterface'  => $this->choose_implementation(),
    11085                'outputType'       => QROutputInterface::CUSTOM,
    11186                'quietzoneSize'    => 1,
     
    11388            ),
    11489        );
     90
     91        if ( QR_Generator_GD::class === $args['outputInterface'] ) {
     92            $args['moduleValues'] = \array_map( array( $this, 'hex2rgb' ), $args['moduleValues'] );
     93        }
    11594
    11695        /**
     
    130109
    131110    /**
     111     * Converts a hex color to RGB.
     112     *
     113     * @param  string $hex Hex color.
     114     * @return array       RGB color.
     115     */
     116    public function hex2rgb( string $hex ): array {
     117        $hex = \hexdec( \ltrim( $hex, '#' ) );
     118
     119        $r = ( $hex >> 16 ) & 0xFF;
     120        $g = ( $hex >> 8 ) & 0xFF;
     121        $b = $hex & 0xFF;
     122
     123        return array( $r, $g, $b );
     124    }
     125
     126    /**
    132127     * Initializes the handler.
    133128     *
  • serbian-addons-for-woocommerce/trunk/readme.txt

    r3030701 r3078305  
    88WC requires at least: 8.0
    99WC tested up to: 8.3
    10 Stable tag: 3.5.7
     10Stable tag: 3.5.8
    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

    r3030701 r3078305  
    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.5.7
     6 * Version:              3.5.8
    77 * Requires PHP:         8.0
    88 * Author:               Oblak Studio
  • serbian-addons-for-woocommerce/trunk/vendor/composer/installed.php

    r3030669 r3078305  
    44        'pretty_version' => '1.0.0+no-version-set',
    55        'version' => '1.0.0.0',
    6         'reference' => NULL,
     6        'reference' => null,
    77        'type' => 'project',
    88        'install_path' => __DIR__ . '/../../',
     
    1414            'pretty_version' => '1.0.0+no-version-set',
    1515            'version' => '1.0.0.0',
    16             'reference' => NULL,
     16            'reference' => null,
    1717            'type' => 'project',
    1818            'install_path' => __DIR__ . '/../../',
Note: See TracChangeset for help on using the changeset viewer.