Plugin Directory

Changeset 3846961


Ignore:
Timestamp:
12/06/2026 12:33:25 AM (11 hours ago)
Author:
RedWoodCIty
Message:

Version 1.8.0: add the Wi-Fi data type, UTM parameters for redirects, the QR Code block, a bulk ZIP download action and WP-CLI commands; update endroid/qr-code to 4.6.1 and remove unused libraries, tests and development files (QR code images are generated exactly as before)

Location:
qr-code-management/trunk
Files:
76 added
35 deleted
31 edited

Legend:

Unmodified
Added
Removed
  • qr-code-management/trunk/assets/css/admin.css

    r3610648 r3846961  
    8282#rwcqrcm_qrdata_contact:checked ~ #rwcqrcm_qrdata_contact_content,
    8383#rwcqrcm_qrdata_event:checked ~ #rwcqrcm_qrdata_event_content,
    84 #rwcqrcm_qrdata_free:checked ~ #rwcqrcm_qrdata_free_content {
     84#rwcqrcm_qrdata_free:checked ~ #rwcqrcm_qrdata_free_content,
     85#rwcqrcm_qrdata_wifi:checked ~ #rwcqrcm_qrdata_wifi_content {
    8586  display: block;
    8687}
    … …  
    137138}
    138139
    139 /*# sourceMappingURL=admin.css.map */
  • qr-code-management/trunk/assets/js/qr-scanner-redirect.js

    r3787869 r3846961  
    33 *
    44 * カメラで QR コードを読み取り、URL であれば確認のうえリダイレクトする。
    5  * 読み取りには jsQR(assets/js/jsQR.js。enqueue の依存として先に読み込まれる)を使う。
     5 * 読み取りには jsQR(assets/js/jsQR.min.js。enqueue の依存として先に読み込まれる)を使う。
    66 * 設定・文言はサーバー側(RWC_Qrcode::qrcm_scanner_shortcode)が
    77 * window.qrcmscannerredirect.settings で渡す。
  • qr-code-management/trunk/includes/Admin.php

    r3802279 r3846961  
    185185                }
    186186
     187                // 短縮 URL の転送先に付ける UTM(1.8.0〜)。有効は on のみ、値は 1 行・100 文字まで
     188                if ( is_array( $value ) && isset( $value['redirect']['utm'] ) ) {
     189                        $utm = is_array( $value['redirect']['utm'] ) ? $value['redirect']['utm'] : array();
     190
     191                        $value['redirect']['utm'] = array(
     192                                'source'   => isset( $utm['source'] ) ? RWC_Qrcode::sanitize_utm_value( $utm['source'] ) : '',
     193                                'medium'   => isset( $utm['medium'] ) ? RWC_Qrcode::sanitize_utm_value( $utm['medium'] ) : '',
     194                                'campaign' => isset( $utm['campaign'] ) ? RWC_Qrcode::sanitize_utm_value( $utm['campaign'] ) : '',
     195                        );
     196                        if ( isset( $utm['enabled'] ) && 'on' === $utm['enabled'] ) {
     197                                $value['redirect']['utm']['enabled'] = 'on';
     198                        }
     199                }
     200
    187201                return $value;
    188202        }
    … …  
    277291
    278292        /**
    279          * 管理画面のスタイルを読み込む
    280          */
    281         public function my_admin_style() {
    282                 wp_enqueue_style( 'wp-color-picker' );
     293         * この画面で読み込む管理画面のアセットの範囲を返す
     294         *
     295         * 以前はすべての管理画面で CSS・JS 5 本・メディアライブラリ・カラーピッカーを読み込んでいた。
     296         * QR コードを編集する画面(対象の投稿タイプの編集・プロフィール・設定画面)だけで全部を、
     297         * QR コードの列を出す一覧とレポート画面では CSS だけを読み込む。
     298         *
     299         * @param string $hook_suffix 画面のフック名(admin_enqueue_scripts の引数)。
     300         * @return string full(CSS と JS)/ css(CSS のみ)/ 空(読み込まない)。
     301         */
     302        public static function asset_scope( $hook_suffix ) {
     303                $settings   = self::get_settings();
     304                $post_types = isset( $settings['role']['post_type'] ) ? array_keys( (array) $settings['role']['post_type'] ) : array();
     305                // QR コード管理の投稿タイプ(独自の QR コード)は常に対象
     306                $post_types[] = 'rwcqrcm';
     307                $profile      = isset( $settings['role']['user']['profile'] );
     308
     309                $screen    = function_exists( 'get_current_screen' ) ? get_current_screen() : null;
     310                $post_type = $screen && isset( $screen->post_type ) ? (string) $screen->post_type : '';
     311                $screen_id = $screen && isset( $screen->id ) ? (string) $screen->id : '';
     312
     313                if ( in_array( $hook_suffix, array( 'post.php', 'post-new.php' ), true ) && in_array( $post_type, $post_types, true ) ) {
     314                        return 'full';
     315                }
     316                if ( $profile && in_array( $hook_suffix, array( 'profile.php', 'user-edit.php' ), true ) ) {
     317                        return 'full';
     318                }
     319                if ( 'rwcqrcm_page_rwcqrcm-setting' === $screen_id ) {
     320                        return 'full';
     321                }
     322                if ( 'edit.php' === $hook_suffix && in_array( $post_type, $post_types, true ) ) {
     323                        return 'css';
     324                }
     325                if ( $profile && 'users.php' === $hook_suffix ) {
     326                        return 'css';
     327                }
     328                if ( 'rwcqrcm_page_' . Report::PAGE_SLUG === $screen_id ) {
     329                        return 'css';
     330                }
     331
     332                return '';
     333        }
     334
     335        /**
     336         * 管理画面のスタイルを読み込む(QR コードを扱う画面だけ)
     337         *
     338         * @param string $hook_suffix 画面のフック名。
     339         */
     340        public function my_admin_style( $hook_suffix = '' ) {
     341                $scope = self::asset_scope( (string) $hook_suffix );
     342                if ( '' === $scope ) {
     343                        return;
     344                }
     345
     346                if ( 'full' === $scope ) {
     347                        wp_enqueue_style( 'wp-color-picker' );
     348                }
    283349                wp_enqueue_style(
    284350                        'rwcqrcm-admin_style',
    … …  
    292358        /**
    293359         * 管理画面のスクリプト(メディアアップローダー・カラーピッカー・QR エディター)を読み込む
    294          */
    295         public function my_admin_scripts() {
     360         *
     361         * QR コードを編集する画面(対象の投稿タイプの編集・プロフィール・設定画面)だけで読み込む。
     362         * 版は毎回の filemtime() ではなくプラグインの版にする。
     363         *
     364         * @param string $hook_suffix 画面のフック名。
     365         */
     366        public function my_admin_scripts( $hook_suffix = '' ) {
     367                if ( 'full' !== self::asset_scope( (string) $hook_suffix ) ) {
     368                        return;
     369                }
     370
    296371                wp_enqueue_media();
    297372                wp_enqueue_script( 'wp-color-picker' );
    … …  
    312387                                plugins_url( $file, Plugin::PLUGIN_BASEFILE ),
    313388                                $deps,
    314                                 filemtime( dirname( Plugin::PLUGIN_BASEFILE ) . $file ),
     389                                RWCQRCM_VERSION,
    315390                                true
    316391                        );
  • qr-code-management/trunk/includes/Plugin.php

    r3743259 r3846961  
    7474                $this->report    = new Report();
    7575
     76                // 投稿一覧の一括操作(ZIP)は管理画面でだけ使う
     77                if ( is_admin() ) {
     78                        new Bulk_Download( $this->qrcode );
     79                }
     80                new Block( $this->qrcode );
     81
     82                if ( defined( 'WP_CLI' ) && WP_CLI ) {
     83                        \WP_CLI::add_command( 'qrcm', CLI::class );
     84                }
     85
    7686                add_action( 'widgets_init', array( $this, 'register_widgets' ) );
    7787        }
  • qr-code-management/trunk/includes/Qrcode.php

    r3845962 r3846961  
    44
    55use RWC\QRCM\Plugin;
    6 use Endroid\QrCode\ErrorCorrectionLevel;
    7 use Endroid\QrCode\LabelAlignment;
    8 use Endroid\QrCode\QrCode;
    96
    107/**
    … …  
    4340        /** 改行を保持したまま保存するフィールド名(テキストエリア) */
    4441        const MULTILINE_KEYS = array( 'freeinput' );
     42
     43        /** Wi-Fi の暗号方式(WIFI: 形式の T: の値) */
     44        const WIFI_ENCRYPTIONS = array( 'WPA', 'WEP', 'nopass' );
     45
     46        /** Wi-Fi の SSID・パスワードの最大文字数(SSID は 32 バイト、WPA のパスフレーズは 63 文字まで) */
     47        const WIFI_MAX_LENGTH = 64;
     48
     49        /** UTM の値の最大文字数 */
     50        const UTM_MAX_LENGTH = 100;
    4551
    4652        /** QR コードデータのフィールド名(メタキー rwcqrcm_qrdata_* の接尾辞) */
    … …  
    7177                // free
    7278                'free_freeinput',
     79                // wifi(1.8.0〜)
     80                'wifi_ssid',
     81                'wifi_encryption',
     82                'wifi_password',
     83                'wifi_hidden',
    7384        );
    7485
    … …  
    250261                        if ( ! $permalink ) {
    251262                                // URL が未設定なら投稿者アーカイブへ戻す
    252                                 wp_safe_redirect( get_author_posts_url( $target['id'] ) );
     263                                wp_safe_redirect( $this->redirect_destination( get_author_posts_url( $target['id'] ), $target ) );
    253264                                exit;
    254265                        }
    255266                        // phpcs:ignore WordPress.Security.SafeRedirect.wp_redirect_wp_redirect -- QR コードの転送先は外部サイトを指定できる仕様のため wp_safe_redirect は使えない。URL は編集権限を持つユーザーが入力したもの。
    256                         wp_redirect( $permalink, 302 );
     267                        wp_redirect( $this->redirect_destination( $permalink, $target ), 302 );
    257268                        exit;
    258269                }
    … …  
    263274                                // URL が未設定(連絡先・フリー入力など URL 以外のデータ)なら空の転送で
    264275                                // 白紙のページになるため、サイトのトップへ戻す
    265                                 wp_safe_redirect( home_url( '/' ) );
     276                                wp_safe_redirect( $this->redirect_destination( home_url( '/' ), $target ) );
    266277                                exit;
    267278                        }
    268279                        // phpcs:ignore WordPress.Security.SafeRedirect.wp_redirect_wp_redirect -- QR コードの転送先は外部サイトを指定できる仕様のため wp_safe_redirect は使えない。URL は編集権限を持つユーザーが入力したもの。
    269                         wp_redirect( $permalink, 302 );
     280                        wp_redirect( $this->redirect_destination( $permalink, $target ), 302 );
    270281                        exit;
    271282                }
    272283
    273284                $permalink = get_permalink( $target['id'] );
    274                 wp_safe_redirect( $permalink ? $permalink : home_url( '/' ) );
     285                wp_safe_redirect( $this->redirect_destination( $permalink ? $permalink : home_url( '/' ), $target ) );
    275286                exit;
     287        }
     288
     289        /**
     290         * 転送先の URL を仕上げる(UTM パラメーターの付与とフィルター)
     291         *
     292         * 設定で UTM の付与を有効にしていれば utm_source / utm_medium / utm_campaign を付ける。
     293         * 転送先の URL に同じ名前のパラメーターが既にあれば、そちらを優先して上書きしない。
     294         * DB の読み書きはしない(設定は読み込み済みのオプション)。
     295         *
     296         * @param string $url    転送先の URL。
     297         * @param array  $target 転送元の対象(type: post / user、id)。
     298         * @return string 転送先の URL。
     299         */
     300        private function redirect_destination( $url, $target ) {
     301                $url = self::add_utm_parameters( (string) $url, self::utm_settings( $this->option ) );
     302
     303                /**
     304                 * 短縮 URL(?qrc=)の転送先を変える
     305                 *
     306                 * @since 1.8.0
     307                 *
     308                 * @param string $url    転送先の URL(UTM パラメーターを付けた後)。
     309                 * @param array  $target 転送元の対象(type: post / user、id)。
     310                 */
     311                $filtered = apply_filters( 'rwcqrcm_redirect_url', $url, $target );
     312
     313                return is_string( $filtered ) && '' !== $filtered ? $filtered : $url;
     314        }
     315
     316        /**
     317         * 設定から UTM の付与の設定を取り出す
     318         *
     319         * @param mixed $option プラグイン設定(rwc_qrcm オプション)。
     320         * @return array|null 有効なら source / medium / campaign、無効なら null。
     321         */
     322        public static function utm_settings( $option ) {
     323                if ( ! is_array( $option ) || ! isset( $option['redirect']['utm']['enabled'] ) || 'on' !== $option['redirect']['utm']['enabled'] ) {
     324                        return null;
     325                }
     326
     327                $utm = $option['redirect']['utm'];
     328
     329                return array(
     330                        'source'   => isset( $utm['source'] ) ? self::sanitize_utm_value( $utm['source'] ) : 'qr',
     331                        'medium'   => isset( $utm['medium'] ) ? self::sanitize_utm_value( $utm['medium'] ) : 'qrcode',
     332                        'campaign' => isset( $utm['campaign'] ) ? self::sanitize_utm_value( $utm['campaign'] ) : '',
     333                );
     334        }
     335
     336        /**
     337         * UTM の値を保存・使用できる形にする(1 行のテキスト、上限 100 文字)
     338         *
     339         * @param mixed $value 入力値。
     340         * @return string 値。
     341         */
     342        public static function sanitize_utm_value( $value ) {
     343                if ( ! is_scalar( $value ) ) {
     344                        return '';
     345                }
     346                $value = sanitize_text_field( (string) $value );
     347
     348                return function_exists( 'mb_substr' ) ? mb_substr( $value, 0, self::UTM_MAX_LENGTH, 'UTF-8' ) : substr( $value, 0, self::UTM_MAX_LENGTH );
     349        }
     350
     351        /**
     352         * URL に UTM パラメーターを付ける
     353         *
     354         * @param string     $url URL。
     355         * @param array|null $utm source / medium / campaign(null なら何もしない)。
     356         * @return string URL。
     357         */
     358        public static function add_utm_parameters( $url, $utm ) {
     359                if ( ! $utm || '' === $url ) {
     360                        return $url;
     361                }
     362
     363                $existing = array();
     364                $query    = wp_parse_url( $url, PHP_URL_QUERY );
     365                if ( is_string( $query ) && '' !== $query ) {
     366                        parse_str( $query, $existing );
     367                }
     368
     369                $args = array();
     370                foreach ( array( 'source', 'medium', 'campaign' ) as $name ) {
     371                        if ( isset( $utm[ $name ] ) && '' !== $utm[ $name ] && ! isset( $existing[ 'utm_' . $name ] ) ) {
     372                                $args[ 'utm_' . $name ] = rawurlencode( $utm[ $name ] );
     373                        }
     374                }
     375
     376                return $args ? add_query_arg( $args, $url ) : $url;
    276377        }
    277378
    … …  
    386487         * @param int    $post_id 投稿 ID またはユーザー ID。
    387488         * @param string $type    post または user。
     489         * @return string fresh(最新のため生成しなかった)/ created(生成した)/ failed(生成に失敗・前回も失敗)。
    388490         */
    389491        public function ensure_qrcode( $post_id, $type ) {
    … …  
    393495                $stored = $this->get_qrcode_meta( $post_id, self::HASH_META_KEY, $type );
    394496                if ( $stored === $signature && $this->qrcode_files_exist( $post_id, $type ) ) {
    395                         return;
     497                        return 'fresh';
    396498                }
    397499                // 前回と同じ内容で生成に失敗している(データが大きすぎる等)なら再試行しない
    398500                if ( 'error:' . $signature === $stored ) {
    399                         return;
    400                 }
    401 
    402                 $this->create_qrcode( $post_id, $type );
     501                        return 'failed';
     502                }
     503
     504                return $this->create_qrcode( $post_id, $type ) ? 'created' : 'failed';
     505        }
     506
     507        /**
     508         * 生成済みの QR コード画像が最新か(生成はしない)
     509         *
     510         * まとめてダウンロードは、この判定が true の投稿の画像だけを使う(新しく作らない)。
     511         *
     512         * @param int    $post_id 投稿 ID またはユーザー ID。
     513         * @param string $type    post または user。
     514         * @return bool 署名が今の内容と一致し、有効な形式のファイルが揃っていれば true。
     515         */
     516        public function is_qrcode_fresh( $post_id, $type ) {
     517                $signature = $this->qrcode_signature( $post_id, $type, $this->get_qrcode_data( $post_id, $type ) );
     518
     519                return $this->get_qrcode_meta( $post_id, self::HASH_META_KEY, $type ) === $signature && $this->qrcode_files_exist( $post_id, $type );
     520        }
     521
     522        /**
     523         * 生成済みの QR コード画像のパスを返す(生成はしない)
     524         *
     525         * @param int    $post_id 投稿 ID またはユーザー ID。
     526         * @param string $type    post または user。
     527         * @param string $format  svg / png / eps / jpg。
     528         * @return string ファイルのパス。リダイレクトコードが未発行なら空文字。
     529         */
     530        public function qrcode_file_path( $post_id, $type, $format ) {
     531                $code = (string) $this->get_qrcode_meta( $post_id, 'rwc_qrcm_redirect_code', $type );
     532                if ( '' === $code || ! in_array( $format, array( 'svg', 'png', 'eps', 'jpg' ), true ) ) {
     533                        return '';
     534                }
     535
     536                return $this->qrcode_dir( $type ) . (int) $post_id . '/' . $code . '.' . $format;
     537        }
     538
     539        /**
     540         * 有効な出力形式(設定画面の「出力形式」)を返す
     541         *
     542         * @return string[] svg / png / eps / jpg のうち有効なもの。
     543         */
     544        public function enabled_formats() {
     545                $formats = isset( $this->option['output']['format'] ) ? array_keys( (array) $this->option['output']['format'] ) : array();
     546
     547                return array_values( array_intersect( array( 'png', 'svg', 'eps', 'jpg' ), $formats ) );
     548        }
     549
     550        /**
     551         * 現在のユーザーが QR コードの機能を使える権限グループか(設定画面の「利用できる権限」)
     552         *
     553         * @return bool 使えるなら true。
     554         */
     555        public function current_user_has_allowed_role() {
     556                $allowed_roles = isset( $this->option['role']['roles'] ) ? array_keys( (array) $this->option['role']['roles'] ) : array();
     557
     558                return (bool) array_intersect( wp_get_current_user()->roles, $allowed_roles );
     559        }
     560
     561        /**
     562         * QR コードを発行する投稿タイプか(設定画面の「カスタム投稿タイプ」)
     563         *
     564         * @param string $post_type 投稿タイプ。
     565         * @return bool 対象なら true。
     566         */
     567        public function is_enabled_post_type( $post_type ) {
     568                return isset( $this->option['role']['post_type'][ (string) $post_type ] );
     569        }
     570
     571        /**
     572         * ユーザーのプロフィールで QR コードを使う設定か
     573         *
     574         * @return bool 使うなら true。
     575         */
     576        public function is_profile_enabled() {
     577                return isset( $this->option['role']['user']['profile'] );
    403578        }
    404579
    … …  
    597772                 * @var $rwcqrcm_qrdata_event_dtend
    598773                 * @var $rwcqrcm_qrdata_free_freeinput
     774                 * @var $rwcqrcm_qrdata_wifi_ssid
     775                 * @var $rwcqrcm_qrdata_wifi_encryption
     776                 * @var $rwcqrcm_qrdata_wifi_password
     777                 * @var $rwcqrcm_qrdata_wifi_hidden
    599778                 */
    600779                $rwc_qrcm_redirect_code = $this->get_redirect_code( $post_id, $type );
    … …  
    669848
    670849                        return $rwcqrcm_qrdata_free_freeinput;
     850                } elseif ( 'wifi' === $rwcqrcm_qrdata_type_type ) {
     851                        // wifi(1.8.0〜)
     852                        return self::build_wifi(
     853                                $rwcqrcm_qrdata_wifi_ssid,
     854                                $rwcqrcm_qrdata_wifi_encryption,
     855                                $rwcqrcm_qrdata_wifi_password,
     856                                'on' === $rwcqrcm_qrdata_wifi_hidden
     857                        );
    671858                }
    672859
    … …  
    768955
    769956                return "BEGIN:VCARD\r\nVERSION:3.0\r\n" . implode( "\r\n", $lines ) . "\r\nEND:VCARD";
     957        }
     958
     959        /**
     960         * Wi-Fi の接続情報(WIFI: 形式)を組み立てる
     961         *
     962         * 形式は ZXing の「Wi-Fi Network config」: WIFI:T:<暗号方式>;S:<SSID>;P:<パスワード>;H:true;;
     963         * SSID・パスワードの中の \ ; , : " は \ でエスケープする。暗号方式が nopass(パスワードなし)なら P: を出さない。
     964         * SSID が空なら空文字を返す(URL が未入力のときと同じ扱い)。
     965         *
     966         * @param mixed $ssid       SSID。
     967         * @param mixed $encryption 暗号方式(WPA / WEP / nopass。不明な値は WPA)。
     968         * @param mixed $password   パスワード。
     969         * @param bool  $hidden     SSID を隠しているネットワークなら true。
     970         * @return string WIFI: 形式の文字列。
     971         */
     972        public static function build_wifi( $ssid, $encryption, $password, $hidden = false ) {
     973                $ssid = (string) $ssid;
     974                if ( '' === $ssid ) {
     975                        return '';
     976                }
     977
     978                $encryption = in_array( $encryption, self::WIFI_ENCRYPTIONS, true ) ? $encryption : 'WPA';
     979
     980                $escape = function ( $value ) {
     981                        return preg_replace( '/([\\\\;,:"])/', '\\\\$1', (string) $value );
     982                };
     983
     984                $text = 'WIFI:T:' . $encryption . ';S:' . $escape( $ssid ) . ';';
     985                if ( 'nopass' !== $encryption && '' !== (string) $password ) {
     986                        $text .= 'P:' . $escape( $password ) . ';';
     987                }
     988                if ( $hidden ) {
     989                        $text .= 'H:true;';
     990                }
     991
     992                return $text . ';';
     993        }
     994
     995        /**
     996         * Wi-Fi の SSID・パスワードを保存できる形にする
     997         *
     998         * sanitize_text_field() はタグ・%xx・連続する空白を取り除き、パスワードが変わってしまうため使わない。
     999         * 不正な UTF-8 と制御文字だけを取り除き、長さを上限で切る(前後の空白も値として残す)。
     1000         *
     1001         * @param mixed $value 入力値。
     1002         * @return string 保存する値。
     1003         */
     1004        public static function sanitize_wifi_text( $value ) {
     1005                $value = wp_check_invalid_utf8( (string) $value );
     1006                $value = (string) preg_replace( '/[\x00-\x1F\x7F]/', '', $value );
     1007
     1008                return function_exists( 'mb_substr' ) ? mb_substr( $value, 0, self::WIFI_MAX_LENGTH, 'UTF-8' ) : substr( $value, 0, self::WIFI_MAX_LENGTH );
     1009        }
     1010
     1011        /**
     1012         * 送信された Wi-Fi のパスワードの扱いを決める
     1013         *
     1014         * 保存済みのパスワードは画面に出さない(入力欄は空で表示する)。そのため、空のまま保存されたら
     1015         * 保存済みの値を残し、「パスワードを消す」にチェックがあるとき・「パスワードなし」にしたときだけ消す。
     1016         *
     1017         * @param array $qrdata 送信された qrdata(サニタイズ済み)。
     1018         * @return array パスワードを残すときは wifi.password を取り除き、消すときは空にした qrdata。
     1019         */
     1020        private static function apply_wifi_password_rules( $qrdata ) {
     1021                if ( ! isset( $qrdata['wifi'] ) || ! is_array( $qrdata['wifi'] ) ) {
     1022                        return $qrdata;
     1023                }
     1024
     1025                $clear = isset( $qrdata['wifi']['password_clear'] ) && 'on' === $qrdata['wifi']['password_clear'];
     1026                unset( $qrdata['wifi']['password_clear'] );
     1027                // 「パスワードなし」では使わないパスワードを保存したままにしない
     1028                if ( isset( $qrdata['wifi']['encryption'] ) && 'nopass' === $qrdata['wifi']['encryption'] ) {
     1029                        $clear = true;
     1030                }
     1031
     1032                if ( $clear ) {
     1033                        $qrdata['wifi']['password'] = '';
     1034                } elseif ( ! isset( $qrdata['wifi']['password'] ) || '' === (string) $qrdata['wifi']['password'] ) {
     1035                        unset( $qrdata['wifi']['password'] );
     1036                }
     1037
     1038                return $qrdata;
    7701039        }
    7711040
    … …  
    8141083                $file_base              = $this->qrcode_dir( $type ) . $post_id . '/' . $rwc_qrcm_redirect_code;
    8151084
    816                 $qr_code = new QrCode( $data );
     1085                $text = (string) $data;
    8171086
    8181087                $data = $this->get_create_settings( $type, $post_id );
    8191088                extract( $data );
    8201089
    821                 // サイズ・余白・ロゴの寸法は get_create_settings() で整数の範囲に収めてある
    822                 if ( $rwcqrcm_qrsettings_size_width ) {
    823                         $qr_code->setSize( (int) $rwcqrcm_qrsettings_size_width );
    824                 }
    825 
    826                 // 余白は 0 も指定できる(未入力のときだけ endroid の既定値 10 を使う)
    827                 if ( '' !== (string) $rwcqrcm_qrsettings_margin && is_numeric( $rwcqrcm_qrsettings_margin ) ) {
    828                         $qr_code->setMargin( max( 0, (int) $rwcqrcm_qrsettings_margin ) );
    829                 }
    830 
    831                 if ( $rwcqrcm_qrsettings_correction_level && in_array(
    832                         $rwcqrcm_qrsettings_correction_level,
    833                         array(
    834                                 'LOW',
    835                                 'MEDIUM',
    836                                 'QUARTILE',
    837                                 'HIGH',
    838                         ),
    839                         true
    840                 ) ) {
    841                         $qr_code->setErrorCorrectionLevel( ErrorCorrectionLevel::{$rwcqrcm_qrsettings_correction_level}() );
    842                 }
    843 
    844                 // サイズがモジュール(点)の数より小さいと 1 点が 0px になり、GD が ValueError(致命的エラー)を出す。
    845                 // 1 点 1px になるサイズまで広げる(データが大きすぎる場合は getData() が例外を投げ、create_qrcode() が捕捉する)。
    846                 $rwcqrcm_qr_matrix = $qr_code->getData();
    847                 if ( $rwcqrcm_qr_matrix['block_size'] < 1 ) {
    848                         $qr_code->setSize( (int) $rwcqrcm_qr_matrix['block_count'] );
    849                 }
    850 
     1090                // サイズ・余白・ロゴの寸法は get_create_settings() で整数の範囲に収めてある。
     1091                // 生成は Qr_Writer(endroid/qr-code 4.x)が 1.7.2 まで(3.9.7)と同じ画像になるように行う。
     1092                $options = array(
     1093                        'size'      => $rwcqrcm_qrsettings_size_width ? (int) $rwcqrcm_qrsettings_size_width : 0,
     1094                        // 余白は 0 も指定できる(未入力のときだけ既定値 10 を使う)
     1095                        'margin'    => '' !== (string) $rwcqrcm_qrsettings_margin && is_numeric( $rwcqrcm_qrsettings_margin ) ? max( 0, (int) $rwcqrcm_qrsettings_margin ) : null,
     1096                        'font_path' => plugin_dir_path( RWCQRCM_PLUGIN_MAIN_FILE ) . 'vendor/endroid/qr-code/assets/open_sans.ttf',
     1097                );
     1098
     1099                if ( in_array( $rwcqrcm_qrsettings_correction_level, array( 'LOW', 'MEDIUM', 'QUARTILE', 'HIGH' ), true ) ) {
     1100                        $options['correction_level'] = $rwcqrcm_qrsettings_correction_level;
     1101                }
     1102
     1103                // フォントは open_sans.ttf を明示する。endroid 既定の noto_sans.otf(約 16MB)は
     1104                // 配布サイズ削減のため同梱していない(plugin-deps/prune-vendor.php で削除している)。
    8511105                if ( $rwcqrcm_qrsettings_label ) {
    852                         // フォントは open_sans.ttf を明示する。endroid の既定(noto_sans.otf、約 16MB)は
    853                         // 配布サイズ削減のため同梱していない(plugin-deps の post-install で削除している)。
    854                         $qr_code->setLabel(
    855                                 $rwcqrcm_qrsettings_label,
    856                                 16,
    857                                 plugin_dir_path( RWCQRCM_PLUGIN_MAIN_FILE ) . 'vendor/endroid/qr-code/assets/fonts/open_sans.ttf',
    858                                 LabelAlignment::CENTER()
    859                         );
    860                 }
    861 
    862                 // 色コードとして解釈できない値(手入力の誤りなど)は無視し、endroid の既定色(黒 / 白)を使う。
    863                 // 以前は不正な値がそのまま 16 進変換され、意図しない色(多くは黒)になっていた。
    864                 $rwcqrcm_foreground_rgb = self::parse_hex_color( $rwcqrcm_qrsettings_color );
    865                 if ( null !== $rwcqrcm_foreground_rgb ) {
    866                         $qr_code->setForegroundColor( $rwcqrcm_foreground_rgb + array( 'a' => 1 ) );
    867                 }
    868 
    869                 $rwcqrcm_background_rgb = self::parse_hex_color( $rwcqrcm_qrsettings_background_color );
    870                 if ( null !== $rwcqrcm_background_rgb ) {
    871                         $qr_code->setBackgroundColor( $rwcqrcm_background_rgb + array( 'a' => 1 ) );
    872                 }
    873 
    874                 $rwcqrcm_qrsettings_logo_path = '';
     1106                        $options['label'] = (string) $rwcqrcm_qrsettings_label;
     1107                }
     1108
     1109                // 色コードとして解釈できない値(手入力の誤りなど)は無視し、既定色(黒 / 白)を使う。
     1110                $options['foreground'] = self::parse_hex_color( $rwcqrcm_qrsettings_color );
     1111                $options['background'] = self::parse_hex_color( $rwcqrcm_qrsettings_background_color );
     1112
    8751113                if ( $rwcqrcm_qrsettings_logo ) {
    8761114                        $rwcqrcm_qrsettings_logo_path = get_attached_file( $rwcqrcm_qrsettings_logo );
    877                 }
    878 
    879                 if ( $rwcqrcm_qrsettings_logo_path && file_exists( $rwcqrcm_qrsettings_logo_path ) ) {
    880                         try {
    881                                 $qr_code->setLogoPath( $rwcqrcm_qrsettings_logo_path );
    882                         } catch ( \Exception $e ) {
    883                                 // ロゴ画像が読み込めない場合はロゴなしで生成を続ける
    884                                 unset( $e );
    885                         }
    886                 }
    887 
    888                 if ( ! $rwcqrcm_qrsettings_logo_width ) {
    889                         $rwcqrcm_qrsettings_logo_width = '10%';
    890                 }
    891 
    892                 if ( ! $rwcqrcm_qrsettings_logo_height ) {
    893                         $rwcqrcm_qrsettings_logo_height = '10%';
    894                 }
    895 
    896                 if ( $rwcqrcm_qrsettings_logo_path ) {
    897                         $data = $qr_code->getData();
    898 
    899                         if ( false !== strpos( $rwcqrcm_qrsettings_logo_width, '%' ) ) { // if size set as percent
    900                                 $rwcqrcm_qrsettings_logo_width = $this->clear_digits( $rwcqrcm_qrsettings_logo_width ) * $data['inner_width'] / 100;
    901                         }
    902 
    903                         if ( false !== strpos( $rwcqrcm_qrsettings_logo_height, '%' ) ) { // if size set as percent
    904                                 $rwcqrcm_qrsettings_logo_height = $this->clear_digits( $rwcqrcm_qrsettings_logo_height ) * $data['inner_height'] / 100;
    905                         }
    906 
    907                         $qr_code->setLogoSize( intval( $rwcqrcm_qrsettings_logo_width ), intval( $rwcqrcm_qrsettings_logo_height ) );
     1115                        if ( $rwcqrcm_qrsettings_logo_path && file_exists( $rwcqrcm_qrsettings_logo_path ) ) {
     1116                                $options['logo_path']   = $rwcqrcm_qrsettings_logo_path;
     1117                                $options['logo_width']  = $rwcqrcm_qrsettings_logo_width;
     1118                                $options['logo_height'] = $rwcqrcm_qrsettings_logo_height;
     1119                        }
    9081120                }
    9091121
    9101122                // 一覧・メタボックスの表示用に svg は常に書き出す
    911                 $this->write_qrcode_file( $qr_code, $file_base, 'svg' );
    912 
     1123                $formats = array( 'svg' );
    9131124                foreach ( array( 'png', 'eps' ) as $format ) {
    9141125                        if ( isset( $this->option['output']['format'][ $format ] ) ) {
    915                                 $this->write_qrcode_file( $qr_code, $file_base, $format );
    916                         }
    917                 }
    918 
     1126                                $formats[] = $format;
     1127                        }
     1128                }
    9191129                // jpeg のライターはないため、png を書き出してから GD で変換する
    920                 if ( isset( $this->option['output']['format']['jpg'] ) ) {
    921                         $this->write_qrcode_file( $qr_code, $file_base, 'png' );
    922 
     1130                $jpeg = isset( $this->option['output']['format']['jpg'] );
     1131                if ( $jpeg && ! in_array( 'png', $formats, true ) ) {
     1132                        $formats[] = 'png';
     1133                }
     1134
     1135                Qr_Writer::write( $text, $options, $file_base, $formats );
     1136
     1137                if ( $jpeg ) {
    9231138                        // エラー抑制(@)ではなく戻り値を確認する。読み込みに失敗した場合、
    9241139                        // 以前は imagejpeg( false, ... ) で致命的エラーになっていた。
    … …  
    9261141                        if ( false !== $image ) {
    9271142                                imagejpeg( $image, $file_base . '.jpg' );
    928                                 // メモリの解放
    929                                 imagedestroy( $image );
    930                         }
    931                 }
    932         }
    933 
    934         /**
    935          * QR コードを指定形式でファイルへ書き出す
    936          *
    937          * @param QrCode $qr_code   設定済みの QrCode インスタンス。
    938          * @param string $file_base 拡張子を除いた出力パス。
    939          * @param string $format    svg / png / eps。
    940          */
    941         private function write_qrcode_file( QrCode $qr_code, $file_base, $format ) {
    942                 $qr_code->setWriterByName( $format );
    943                 $qr_code->writeFile( $file_base . '.' . $format );
     1143                                // メモリの解放(PHP 8.0 以降は不要で、8.5 では imagedestroy() が非推奨)
     1144                                if ( PHP_VERSION_ID < 80000 ) {
     1145                                        imagedestroy( $image );
     1146                                }
     1147                        }
     1148                }
    9441149        }
    9451150
    … …  
    15291734                        : array();
    15301735
     1736                // Wi-Fi の SSID・パスワードは sanitize_text_field() を通すと値が変わる(タグ・%xx・連続する空白)ため、
     1737                // 元の入力から sanitize_wifi_text() で作り直す。暗号方式は決まった値だけを受け付ける。
     1738                if ( isset( $raw['qrdata']['wifi'] ) && is_array( $raw['qrdata']['wifi'] ) ) {
     1739                        foreach ( array( 'ssid', 'password' ) as $wifi_key ) {
     1740                                if ( isset( $raw['qrdata']['wifi'][ $wifi_key ] ) && is_scalar( $raw['qrdata']['wifi'][ $wifi_key ] ) ) {
     1741                                        $qrdata['wifi'][ $wifi_key ] = self::sanitize_wifi_text( $raw['qrdata']['wifi'][ $wifi_key ] );
     1742                                }
     1743                        }
     1744                        if ( isset( $qrdata['wifi']['encryption'] ) && ! in_array( $qrdata['wifi']['encryption'], self::WIFI_ENCRYPTIONS, true ) ) {
     1745                                $qrdata['wifi']['encryption'] = 'WPA';
     1746                        }
     1747                        // 「SSID を隠している」はチェックを外すと空(フォームは hidden の off を先に送る)
     1748                        if ( isset( $qrdata['wifi']['hidden'] ) && 'on' !== $qrdata['wifi']['hidden'] ) {
     1749                                $qrdata['wifi']['hidden'] = '';
     1750                        }
     1751                        $qrdata = self::apply_wifi_password_rules( $qrdata );
     1752                }
     1753
    15311754                // URL に許可されていないスキーム(javascript: / data: など)が入力されていたら保存しない。
    15321755                // input type="url" はこれらも正しい URL として受け付けるため、サーバー側で弾く。
    … …  
    19762199                wp_enqueue_script(
    19772200                        'qrcm-jsqr',
    1978                         plugins_url( '/assets/js/jsQR.js', Plugin::PLUGIN_BASEFILE ),
     2201                        plugins_url( '/assets/js/jsQR.min.js', Plugin::PLUGIN_BASEFILE ),
    19792202                        array(),
    19802203                        RWCQRCM_VERSION,
  • qr-code-management/trunk/includes/Report.php

    r3802279 r3846961  
    283283         * 対象ごとのスキャン数を集計する
    284284         *
    285          * @param int $days 集計期間(日数)。0 なら全期間。
     285         * @param int $days   集計期間(日数)。0 なら全期間。
     286         * @param int $limit  件数(既定は画面・CSV と同じ 100 件)。
     287         * @param int $offset 先頭から飛ばす件数(WP-CLI のページ分け)。
    286288         * @return array 行の配列(post_id / target_type / scans / visitors / last_scan)。
    287289         */
    288         public static function get_summary( $days ) {
     290        public static function get_summary( $days, $limit = self::LIMIT, $offset = 0 ) {
    289291                global $wpdb;
    290292
    … …  
    293295                return (array) $wpdb->get_results(
    294296                        $wpdb->prepare(
    295                                 "SELECT post_id, target_type, COUNT(*) AS scans, COUNT(DISTINCT user_id) AS visitors, MAX(create_date) AS last_scan FROM {$wpdb->prefix}rwc_qrcm_log WHERE create_date >= %s GROUP BY post_id, target_type ORDER BY scans DESC, last_scan DESC LIMIT %d",
     297                                "SELECT post_id, target_type, COUNT(*) AS scans, COUNT(DISTINCT user_id) AS visitors, MAX(create_date) AS last_scan FROM {$wpdb->prefix}rwc_qrcm_log WHERE create_date >= %s GROUP BY post_id, target_type ORDER BY scans DESC, last_scan DESC, post_id ASC, target_type ASC LIMIT %d OFFSET %d",
    296298                                $since,
    297                                 self::LIMIT
     299                                max( 1, (int) $limit ),
     300                                max( 0, (int) $offset )
    298301                        )
    299302                );
  • qr-code-management/trunk/includes/autoloader.php

    r3743259 r3846961  
    1010
    1111$rwcqrcm_class_map = array(
    12         'RWC\QRCM\Plugin'     => $rwcqrcm_base_dir . '/Plugin.php',
    13         'RWC\QRCM\DB_Tables'  => $rwcqrcm_base_dir . '/DB_Tables.php',
    14         'RWC\QRCM\Admin'      => $rwcqrcm_base_dir . '/Admin.php',
    15         'RWC\QRCM\RWC_Qrcode' => $rwcqrcm_base_dir . '/Qrcode.php',
    16         'RWC\QRCM\Report'     => $rwcqrcm_base_dir . '/Report.php',
    17         'RWC\QRCM\Widget'     => $rwcqrcm_base_dir . '/Widget.php',
     12        'RWC\QRCM\Plugin'        => $rwcqrcm_base_dir . '/Plugin.php',
     13        'RWC\QRCM\DB_Tables'     => $rwcqrcm_base_dir . '/DB_Tables.php',
     14        'RWC\QRCM\Admin'         => $rwcqrcm_base_dir . '/Admin.php',
     15        'RWC\QRCM\RWC_Qrcode'    => $rwcqrcm_base_dir . '/Qrcode.php',
     16        'RWC\QRCM\Report'        => $rwcqrcm_base_dir . '/Report.php',
     17        'RWC\QRCM\Widget'        => $rwcqrcm_base_dir . '/Widget.php',
     18        'RWC\QRCM\Qr_Writer'     => $rwcqrcm_base_dir . '/Qr_Writer.php',
     19        'RWC\QRCM\CLI'           => $rwcqrcm_base_dir . '/CLI.php',
     20        'RWC\QRCM\Bulk_Download' => $rwcqrcm_base_dir . '/Bulk_Download.php',
     21        'RWC\QRCM\Block'         => $rwcqrcm_base_dir . '/Block.php',
    1822);
    1923
    … …  
    3034);
    3135
     36// QR コード生成ライブラリが使う拡張(mbstring / ctype)がない環境向けの代わりの関数
     37if ( ! function_exists( 'mb_list_encodings' ) ) {
     38        require_once $rwcqrcm_base_dir . '/compat/mbstring.php';
     39}
     40if ( ! function_exists( 'ctype_digit' ) ) {
     41        require_once $rwcqrcm_base_dir . '/compat/ctype.php';
     42}
     43
    3244require_once plugin_dir_path( RWCQRCM_PLUGIN_MAIN_FILE ) . '/vendor/autoload.php';
    3345
  • qr-code-management/trunk/languages/qr-code-management-ja.po

    r3845962 r3846961  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: QR Code Management 1.7.2\n"
    6 "POT-Creation-Date: 2026-12-05 08:06+0000\n"
     5"Project-Id-Version: QR Code Management 1.8.0\n"
     6"POT-Creation-Date: 2026-12-05 17:00+0000\n"
    77"MIME-Version: 1.0\n"
    88"Content-Type: text/plain; charset=UTF-8\n"
    99"Content-Transfer-Encoding: 8bit\n"
    1010"X-Domain: qr-code-management\n"
    11 "PO-Revision-Date: 2026-12-05 08:06+0000\n"
     11"PO-Revision-Date: 2026-12-05 17:00+0000\n"
    1212"Language: ja\n"
    1313"Plural-Forms: nplurals=1; plural=0;\n"
    1414
    15 #: includes/Report.php:322
     15#: includes/Report.php:325
    1616msgid "(Deleted post #%d)"
    1717msgstr "(削除された投稿 #%d)"
    1818
    19 #: includes/Report.php:313
     19#: includes/Report.php:316
    2020msgid "(Deleted user #%d)"
    2121msgstr "(削除されたユーザー #%d)"
    2222
    23 #: includes/Report.php:325
     23#: includes/Report.php:328
    2424msgid "(no title)"
    2525msgstr "(タイトルなし)"
    2626
    27 #: templates/meta-box-qrcode-data.php:154
     27#: templates/meta-box-qrcode-data.php:159
    2828msgid "8 digits for date of birth: year (4 digits), month (2 digits) and day (2 digits), in order."
    2929msgstr "生年月日を 8 桁で指定します(年 4 桁・月 2 桁・日 2 桁の順)。"
    3030
    31 #: templates/meta-box-qrcode-data.php:169
     31#: templates/meta-box-qrcode-data.php:174
    3232msgid "A URL pointing to a website that represents the person in some way."
    3333msgstr "何らかの形で人物を表すWebサイトを指すURL"
    3434
    35 #: templates/meta-box-qrcode-data.php:119
     35#: templates/meta-box-qrcode-data.php:300
     36msgid "A password is saved. It is not shown here. Leave this field empty to keep it."
     37msgstr "パスワードは保存済みです(ここには表示しません)。空のままにすると、保存済みのパスワードを使います。"
     38
     39#: templates/meta-box-qrcode-data.php:124
    3640msgid "A structured representation of the name of the person. When a field is divided by a comma (,), the first half is treated as the last name and the second half is treated as the first name."
    3741msgstr "氏名を構造化して指定します。カンマ(,)で区切ると、前半が姓、後半が名として扱われます。"
    3842
    39 #: templates/admin-qrcm-setting.php:168
     43#: templates/admin-qrcm-setting.php:202
    4044msgid "Access log retention"
    4145msgstr "アクセスログの保存期間"
    4246
    43 #: templates/admin-qrcm-setting.php:178
     47#: templates/admin-qrcm-setting.php:212
    4448msgid "Access logs (used by the access report) older than this number of days are deleted automatically once a day. Enter 0 to keep them forever (up to %d days)."
    4549msgstr "アクセスレポートに使うアクセスログのうち、この日数より古いものを 1 日 1 回自動で削除します。0 を入力すると無期限に保存します(最大 %d 日)。"
    … …  
    5761msgstr "アクセスレポート"
    5862
     63#: templates/admin-qrcm-setting.php:184
     64msgid "Add UTM parameters to the redirect destination"
     65msgstr "リダイレクト先に UTM パラメーターを付ける"
     66
    5967#: templates/meta-box-qrcode-settings.php:69
    6068msgid "Add an image"
    6169msgstr "画像追加"
    6270
    63 #: templates/meta-box-qrcode-data.php:147
     71#: templates/meta-box-qrcode-data.php:152
    6472msgid "Address"
    6573msgstr "住所"
    … …  
    6977msgstr "全期間"
    7078
    71 #: includes/Qrcode.php:304
     79#: includes/Qrcode.php:405
    7280msgid "Author"
    7381msgstr "作成者"
    7482
    75 #: templates/admin-qrcm-setting.php:110
     83#: templates/admin-qrcm-setting.php:111
    7684msgid "Available permissions"
    7785msgstr "使用可能な権限"
    … …  
    8593msgstr "背景画像"
    8694
    87 #: templates/meta-box-qrcode-data.php:152
     95#: templates/meta-box-qrcode-data.php:157
    8896msgid "Birthday"
    8997msgstr "誕生日"
    … …  
    101109msgstr "色"
    102110
    103 #: templates/admin-qrcm-setting.php:21 templates/meta-box-qrcode-data.php:43
     111#: templates/admin-qrcm-setting.php:21 templates/meta-box-qrcode-data.php:47
    104112msgid "Contact"
    105113msgstr "連絡先"
    … …  
    109117msgstr "補正レベル"
    110118
    111 #: templates/admin-qrcm-setting.php:84
     119#: templates/admin-qrcm-setting.php:85
    112120msgid "Custom post type settings"
    113121msgstr "カスタム投稿タイプ設定"
    114122
    115 #: templates/admin-qrcm-setting.php:65
     123#: templates/admin-qrcm-setting.php:66
    116124msgid "Data format used"
    117125msgstr "使用するデータ形式"
    … …  
    121129msgstr "削除"
    122130
    123 #: templates/meta-box-qrcode-data.php:129
     131#: templates/meta-box-qrcode-data.php:308
     132msgid "Delete the saved password"
     133msgstr "保存済みのパスワードを消す"
     134
     135#: templates/meta-box-qrcode-data.php:134
    124136msgid "Designates a text string to be set as the kana name in the phonebook.When a field is divided by a comma (,), the first half is treated as the last name and the second half is treated as the first name."
    125137msgstr "電話帳のふりがなとして設定する文字列を指定します。カンマ(,)で区切ると、前半が姓、後半が名として扱われます。"
    126138
    127 #: templates/admin-qrcm-setting.php:36
     139#: templates/admin-qrcm-setting.php:37
    128140msgid "Display settings"
    129141msgstr "表示設定"
    … …  
    133145msgstr "QR コード設定で有効にした投稿タイプのページ(ユーザープロフィールの QR コードが有効なら投稿者アーカイブも)にだけ表示されます。"
    134146
    135 #: templates/admin-qrcm-setting.php:46
     147#: templates/admin-qrcm-setting.php:47
    136148msgid "Download"
    137149msgstr "ダウンロード"
    … …  
    141153msgstr "CSV ダウンロード"
    142154
     155#: includes/Bulk_Download.php:104
     156msgid "Download QR codes (ZIP)"
     157msgstr "QRコードをダウンロード(ZIP)"
     158
    143159#: templates/meta-box-qrcode-settings.php:61
    144160msgid "Edit"
    145161msgstr "変更"
    146162
    147 #: templates/meta-box-qrcode-data.php:142
     163#: templates/meta-box-qrcode-data.php:147
    148164msgid "Email"
    149165msgstr "メールアドレス"
    150166
    151 #: templates/meta-box-qrcode-data.php:212
     167#: templates/meta-box-qrcode-data.php:217
    152168msgid "End"
    153169msgstr "終了"
    154170
    155 #: templates/admin-qrcm-setting.php:22 templates/meta-box-qrcode-data.php:44
     171#: templates/admin-qrcm-setting.php:22 templates/meta-box-qrcode-data.php:48
    156172msgid "Events"
    157173msgstr "イベント"
    158174
    159 #: templates/meta-box-qrcode-data.php:124
     175#: templates/meta-box-qrcode-data.php:129
    160176msgid "Familiar name for the object represented by this MeCard/vCard."
    161177msgstr "この MeCard / vCard によって表示されるニックネーム。"
    … …  
    173189msgstr "文字サイズ"
    174190
    175 #: templates/admin-qrcm-setting.php:130
     191#: templates/admin-qrcm-setting.php:131
    176192msgid "Format"
    177193msgstr "形式"
    178194
    179 #: includes/Qrcode.php:1997
     195#: includes/Qrcode.php:2220
    180196msgid "Forwarding"
    181197msgstr "転送"
    182198
    183 #: templates/admin-qrcm-setting.php:23 templates/meta-box-qrcode-data.php:45 templates/meta-box-qrcode-data.php:244
     199#: templates/admin-qrcm-setting.php:23 templates/meta-box-qrcode-data.php:49 templates/meta-box-qrcode-data.php:249
    184200msgid "Free"
    185201msgstr "自由入力"
    … …  
    189205msgstr "高さ"
    190206
    191 #: templates/admin-qrcm-setting.php:45
     207#: templates/meta-box-qrcode-data.php:313
     208msgid "Hidden network"
     209msgstr "ステルスネットワーク"
     210
     211#: templates/admin-qrcm-setting.php:46
    192212msgid "Image"
    193213msgstr "画像"
    … …  
    201221msgstr "内側"
    202222
    203 #: templates/admin-qrcm-setting.php:165
     223#: templates/admin-qrcm-setting.php:166
    204224msgid "Invalid"
    205225msgstr "無効"
    … …  
    225245msgstr "最終スキャン"
    226246
     247#: includes/Block.php:71
     248msgid "Leave both empty to show the QR code of the post being displayed. If both are set, the post ID is used."
     249msgstr "両方とも空にすると、表示中の投稿の QR コードを表示します。両方を入れたときは投稿 ID を使います。"
     250
    227251#: templates/meta-box-qrcode-settings.php:122
    228252msgid "Level H – up to 30%&nbsp;damage"
    … …  
    241265msgstr "Level Q – 最大25%の劣化"
    242266
    243 #: templates/admin-qrcm-setting.php:39
     267#: templates/admin-qrcm-setting.php:40
    244268msgid "List display"
    245269msgstr "一覧の表示"
    … …  
    261285msgstr "最大 %s px。これより大きい値は最大値に切り詰めます。"
    262286
    263 #: templates/meta-box-qrcode-data.php:104
     287#: templates/meta-box-qrcode-data.php:109
    264288msgid "MeCard"
    265289msgstr "MeCard"
    266290
    267 #: templates/meta-box-qrcode-data.php:117
     291#: templates/meta-box-qrcode-data.php:122
    268292msgid "Name"
    269293msgstr "名前"
    270294
    271 #: templates/meta-box-qrcode-data.php:122
     295#: templates/meta-box-qrcode-data.php:264
     296msgid "Network name (SSID)"
     297msgstr "ネットワーク名(SSID)"
     298
     299#: templates/meta-box-qrcode-data.php:127
    272300msgid "Nickname"
    273301msgstr "ニックネーム"
     302
     303#: includes/Block.php:72
     304msgid "No QR code to show. Save the post, check that this post type is enabled in the QR code settings, and that \"Image\" is enabled under \"List display\"."
     305msgstr "表示する QR コードがありません。投稿を保存し、QR コードの設定でこの投稿タイプが有効になっていること、「一覧の表示」の「画像」が有効になっていることを確かめてください。"
    274306
    275307#: templates/meta-box-qrcode-settings.php:67
    … …  
    277309msgstr "画像が選択されていません"
    278310
     311#: templates/meta-box-qrcode-data.php:302
     312msgid "No password is saved."
     313msgstr "パスワードは保存されていません。"
     314
    279315#: templates/admin-qrcm-report.php:79
    280316msgid "No scans have been recorded in this period."
    281317msgstr "この期間に記録されたスキャンはありません。"
    282318
    283 #: templates/meta-box-qrcode-data.php:31 templates/meta-box-qrcode-settings.php:85 templates/meta-box-qrcode-settings.php:231
     319#: templates/meta-box-qrcode-data.php:279
     320msgid "None (no password)"
     321msgstr "なし(パスワードなし)"
     322
     323#: includes/Bulk_Download.php:257
     324msgid "None of the selected posts have generated QR code images. Open the post list or the edit screen to generate them, then download again."
     325msgstr "選んだ投稿には、作成済みの QR コード画像がありません。投稿一覧か編集画面を開いて画像を作成してから、もう一度ダウンロードしてください。"
     326
     327#: templates/meta-box-qrcode-data.php:35 templates/meta-box-qrcode-settings.php:85 templates/meta-box-qrcode-settings.php:231
    284328msgid "Not set"
    285329msgstr "設定しない"
    286330
    287 #: templates/meta-box-qrcode-data.php:172
     331#: templates/meta-box-qrcode-data.php:177
    288332msgid "Note"
    289333msgstr "ノート"
    … …  
    297341msgstr "QRコードの下のオプションのテキストラベルです。"
    298342
    299 #: templates/meta-box-qrcode-data.php:162
     343#: templates/meta-box-qrcode-data.php:167
    300344msgid "Organization"
    301345msgstr "組織"
    302346
    303 #: templates/meta-box-qrcode-data.php:164
     347#: templates/meta-box-qrcode-data.php:169
    304348msgid "Organization name."
    305349msgstr "組織名。"
    306350
    307 #: templates/admin-qrcm-setting.php:127
     351#: templates/admin-qrcm-setting.php:128
    308352msgid "Output setting"
    309353msgstr "出力設定"
    … …  
    313357msgstr "外側"
    314358
    315 #: includes/Qrcode.php:2001
     359#: templates/meta-box-qrcode-data.php:291
     360msgid "Password"
     361msgstr "パスワード"
     362
     363#: includes/Qrcode.php:2224
    316364msgid "Permission failed"
    317365msgstr "許可に失敗しました"
    318366
    319 #: templates/meta-box-qrcode-data.php:132
     367#: templates/meta-box-qrcode-data.php:137
    320368msgid "Phone"
    321369msgstr "電話"
    322370
    323 #: templates/meta-box-qrcode-data.php:159
     371#: templates/meta-box-qrcode-data.php:164
    324372msgid "Position held in organization."
    325373msgstr "組織での役職。"
    … …  
    329377msgstr "投稿"
    330378
    331 #: templates/admin-qrcm-setting.php:156
     379#: includes/Block.php:69
     380msgid "Post ID"
     381msgstr "投稿 ID"
     382
     383#: templates/admin-qrcm-setting.php:157
    332384msgid "Presence"
    333385msgstr "有効/無効"
    334386
    335 #: includes/Qrcode.php:302 includes/Qrcode.php:1272 includes/Qrcode.php:1731 includes/Widget.php:104
     387#: includes/Block.php:66 includes/Qrcode.php:403 includes/Qrcode.php:1477 includes/Qrcode.php:1954 includes/Widget.php:104
    336388msgid "QR Code"
    337389msgstr "QRコード"
    … …  
    341393msgstr "QR コード (QR Code Management)"
    342394
    343 #: includes/Qrcode.php:1432 includes/Qrcode.php:1671
     395#: includes/Qrcode.php:1637 includes/Qrcode.php:1894
    344396msgid "QR Code Data"
    345397msgstr "QRコードデータ"
    346398
    347 #: includes/Qrcode.php:1996
     399#: includes/Qrcode.php:2219
    348400msgid "QR Code Management"
    349401msgstr "QR Code Management"
    350402
    351 #: includes/Qrcode.php:1442 includes/Qrcode.php:1676 templates/admin-qrcm-setting.php:188
     403#: includes/Qrcode.php:1647 includes/Qrcode.php:1899 templates/admin-qrcm-setting.php:222
    352404msgid "QR Code Settings"
    353405msgstr "QRコード設定"
    354406
    355 #: includes/Qrcode.php:1452 includes/Qrcode.php:1681
     407#: includes/Qrcode.php:1657 includes/Qrcode.php:1904
    356408msgid "QR Code Shortcode"
    357409msgstr "QRコードショートコード"
    358410
    359 #: templates/admin-qrcm-setting.php:62
     411#: templates/admin-qrcm-setting.php:63
    360412msgid "QR Code data settings"
    361413msgstr "QRコードデータ設定"
    … …  
    373425msgstr "QRコード設定"
    374426
     427#: includes/Block.php:68
     428msgid "QR code target"
     429msgstr "QR コードの対象"
     430
    375431#: templates/meta-box-qrcode-settings.php:327
    376432msgid "Qrcode size"
    … …  
    381437msgstr "記録されているスキャン: %1$s 件(%2$s 以降)。"
    382438
    383 #: templates/admin-qrcm-setting.php:153
     439#: templates/admin-qrcm-setting.php:154
    384440msgid "Redirect settings"
    385441msgstr "リダイレクト設定"
    386442
    387 #: templates/admin-qrcm-setting.php:81
     443#: templates/admin-qrcm-setting.php:82
    388444msgid "Role settings"
    389445msgstr "権限設定"
    … …  
    393449msgstr "サンプルQRコード"
    394450
    395 #: templates/admin-qrcm-setting.php:213 templates/meta-box-qrcode-settings.php:337
     451#: templates/admin-qrcm-setting.php:247 templates/meta-box-qrcode-settings.php:337
    396452msgid "Save"
    397453msgstr "保存"
    398454
    399 #: templates/admin-qrcm-setting.php:195
     455#: templates/admin-qrcm-setting.php:229
    400456msgid "Scanner shortcode"
    401457msgstr "スキャナーショートコード"
    … …  
    409465msgstr "スキャンはリダイレクト設定が有効なときだけ記録されます。アクセスを集計するには設定画面で有効にしてください。"
    410466
    411 #: includes/Qrcode.php:1223
     467#: includes/Qrcode.php:1428
    412468msgid "Scans: %s"
    413469msgstr "スキャン数: %s"
    414470
    415 #: includes/Admin.php:324
     471#: templates/meta-box-qrcode-data.php:272
     472msgid "Security"
     473msgstr "セキュリティ"
     474
     475#: includes/Admin.php:399
    416476msgid "Select"
    417477msgstr "選択"
    418478
    419 #: templates/meta-box-qrcode-data.php:109
     479#: templates/meta-box-qrcode-data.php:114
    420480msgid "Select contact information QR code format"
    421481msgstr "連絡先情報のQRコードフォーマットを選択"
    422482
    423 #: includes/Qrcode.php:1999
     483#: includes/Qrcode.php:2222
    424484msgid "Select device"
    425485msgstr "デバイスを選択"
    426486
    427 #: includes/Admin.php:323
     487#: includes/Admin.php:398
    428488msgid "Select or Upload Media"
    429489msgstr "メディアを選択またはアップロード"
    430490
    431 #: templates/meta-box-qrcode-data.php:34 templates/meta-box-qrcode-settings.php:88 templates/meta-box-qrcode-settings.php:235
     491#: includes/Bulk_Download.php:256
     492msgid "Select up to %d posts to download QR codes at a time."
     493msgstr "QR コードを一度にダウンロードできるのは %d 件までです。"
     494
     495#: templates/meta-box-qrcode-data.php:38 templates/meta-box-qrcode-settings.php:88 templates/meta-box-qrcode-settings.php:235
    432496msgid "Set"
    433497msgstr "設定する"
    434498
    435 #: templates/meta-box-qrcode-data.php:27 templates/meta-box-qrcode-settings.php:81
     499#: templates/meta-box-qrcode-data.php:31 templates/meta-box-qrcode-settings.php:81
    436500msgid "Set individually"
    437501msgstr "個別に設定する"
    … …  
    449513msgstr "設定"
    450514
    451 #: templates/admin-qrcm-setting.php:199 templates/meta-box-qrcode-shortcode.php:14
     515#: templates/admin-qrcm-setting.php:233 templates/meta-box-qrcode-shortcode.php:14
    452516msgid "Shortcode"
    453517msgstr "ショートコード"
    … …  
    457521msgstr "表示中のページの QR コードを表示します。"
    458522
     523#: includes/Block.php:67
     524msgid "Shows the QR code of this post, or of the post or user you specify. Same as the [qrcm] shortcode."
     525msgstr "この投稿、または指定した投稿・ユーザーの QR コードを表示します。[qrcm] ショートコードと同じです。"
     526
    459527#: templates/admin-qrcm-report.php:103
    460528msgid "Shows up to %d QR codes, sorted by number of scans."
    … …  
    469537msgstr "このページにアクセスする権限がありません。"
    470538
    471 #: includes/Qrcode.php:1363
     539#: includes/Qrcode.php:1568
    472540msgid "Sorry, you are not allowed to download this QR code."
    473541msgstr "この QR コードをダウンロードする権限がありません。"
    474542
    475 #: templates/meta-box-qrcode-data.php:127
     543#: templates/meta-box-qrcode-data.php:132
    476544msgid "Sound"
    477545msgstr "音"
    478546
    479 #: templates/meta-box-qrcode-data.php:174
     547#: templates/meta-box-qrcode-data.php:179
    480548msgid "Specifies supplemental information to be set as memo in the phonebook."
    481549msgstr "電話帳にメモとして設定する補足情報を指定します。"
    … …  
    485553msgstr "QRコードの周囲の境界線サイズをピクセルで指定してください"
    486554
    487 #: templates/meta-box-qrcode-data.php:211
     555#: templates/meta-box-qrcode-data.php:216
    488556msgid "Start"
    489557msgstr "開始"
    490558
    491 #: templates/meta-box-qrcode-data.php:230
     559#: templates/meta-box-qrcode-data.php:235
    492560msgid "Summary"
    493561msgstr "概要"
    … …  
    505573msgstr "テキストの位置"
    506574
    507 #: includes/Qrcode.php:1256
     575#: templates/meta-box-qrcode-data.php:321
     576msgid "The QR code contains the password as it is. Anyone who can see or download the QR code image can connect to the network."
     577msgstr "QR コードにはパスワードがそのまま入ります。QR コードの画像を見られる人・ダウンロードできる人は、誰でもこのネットワークに接続できます。"
     578
     579#: includes/Qrcode.php:1461
    508580msgid "The QR code data is too long to generate an image. Shorten the QR code data."
    509581msgstr "QR コードのデータが長すぎるため画像を生成できません。QR コードのデータを短くしてください。"
    510582
    511 #: templates/meta-box-qrcode-data.php:144
     583#: includes/Bulk_Download.php:258
     584msgid "The ZIP file could not be created."
     585msgstr "ZIP ファイルを作成できませんでした。"
     586
     587#: templates/meta-box-qrcode-data.php:149
    512588msgid "The address for electronic mail communication."
    513589msgstr "電子メール通信用のアドレス。"
    514590
    515 #: templates/meta-box-qrcode-data.php:134
     591#: templates/meta-box-qrcode-data.php:139
    516592msgid "The canonical number string for a telephone number for telephony communication."
    517593msgstr "電話番号を正規の形式で指定します。"
    518594
    519 #: templates/meta-box-qrcode-data.php:139
     595#: templates/meta-box-qrcode-data.php:144
    520596msgid "The canonical string for a videophone number communication."
    521597msgstr "テレビ電話番号通信の正規の文字列"
    522598
    523 #: templates/meta-box-qrcode-data.php:149
     599#: templates/meta-box-qrcode-data.php:317
     600msgid "The network does not broadcast its SSID"
     601msgstr "SSID を公開していない(ステルス)ネットワーク"
     602
     603#: templates/meta-box-qrcode-data.php:154
    524604msgid "The physical delivery address. The fields divided by commas (,) denote PO box, room number, house number, city, prefecture, zip code and country, in order."
    525605msgstr "住所を指定します。カンマ(,)で区切った各項目は、私書箱・部屋番号・番地・市区町村・都道府県・郵便番号・国の順に扱われます。"
    … …  
    529609msgstr "QR コードが使用環境でどの程度損傷しうるかに応じて、「バックアップ」データの量が変わります。"
    530610
    531 #: templates/meta-box-qrcode-data.php:85 templates/meta-box-qrcode-data.php:195
     611#: templates/meta-box-qrcode-data.php:90 templates/meta-box-qrcode-data.php:200
    532612msgid "This URL cannot be used in a QR code because its scheme (such as javascript: or data:) is not allowed. It will not be saved. Enter a URL that starts with https:// or http://."
    533613msgstr "この URL は、スキーム(javascript: や data: など)が許可されていないため QR コードに使えません。保存されません。https:// または http:// で始まる URL を入力してください。"
    … …  
    537617msgstr "この色の組み合わせでは QR コードが読み取りにくい可能性があります。明るい背景に、十分なコントラストのある濃い色を使ってください。"
    538618
    539 #: templates/meta-box-qrcode-data.php:157
     619#: templates/meta-box-qrcode-data.php:162
    540620msgid "Title"
    541621msgstr "タイトル"
    … …  
    553633msgstr "上部テキストの種類"
    554634
    555 #: includes/Report.php:202 templates/admin-qrcm-report.php:70 templates/meta-box-qrcode-data.php:97
     635#: includes/Report.php:202 templates/admin-qrcm-report.php:70 templates/meta-box-qrcode-data.php:102
    556636msgid "Type"
    557637msgstr "タイプ"
    558638
    559 #: templates/admin-qrcm-setting.php:20 templates/meta-box-qrcode-data.php:42 templates/meta-box-qrcode-data.php:73 templates/meta-box-qrcode-data.php:167
     639#: templates/admin-qrcm-setting.php:20 templates/meta-box-qrcode-data.php:46 templates/meta-box-qrcode-data.php:78 templates/meta-box-qrcode-data.php:172
    560640msgid "URL"
    561641msgstr "URL"
     642
     643#: templates/admin-qrcm-setting.php:179
     644msgid "UTM parameters"
     645msgstr "UTM パラメーター"
    562646
    563647#: includes/Report.php:205 templates/admin-qrcm-report.php:72
    … …  
    565649msgstr "ユニーク訪問者"
    566650
    567 #: templates/admin-qrcm-setting.php:107
     651#: templates/admin-qrcm-setting.php:108
    568652msgid "Use with user profile"
    569653msgstr "ユーザープロフィールで使用する"
    … …  
    573657msgstr "ユーザー"
    574658
    575 #: templates/admin-qrcm-setting.php:99
     659#: includes/Block.php:70
     660msgid "User ID"
     661msgstr "ユーザー ID"
     662
     663#: templates/admin-qrcm-setting.php:100
    576664msgid "User settings"
    577665msgstr "ユーザー設定"
    578666
    579 #: templates/admin-qrcm-setting.php:161
     667#: templates/admin-qrcm-setting.php:162
    580668msgid "Valid"
    581669msgstr "有効"
    582670
    583 #: templates/meta-box-qrcode-data.php:137
     671#: templates/meta-box-qrcode-data.php:142
    584672msgid "Videophone"
    585673msgstr "テレビ電話"
    586674
    587 #: includes/Qrcode.php:2000
     675#: templates/meta-box-qrcode-data.php:278
     676msgid "WEP"
     677msgstr "WEP"
     678
     679#: templates/meta-box-qrcode-data.php:277
     680msgid "WPA / WPA2 / WPA3"
     681msgstr "WPA / WPA2 / WPA3"
     682
     683#: includes/Qrcode.php:2223
    588684msgid "Wait for your permission"
    589685msgstr "許可を待っています"
     686
     687#: templates/admin-qrcm-setting.php:199
     688msgid "When a QR code with the shortened URL is scanned, these parameters are added to the redirect destination so that access analysis (such as Google Analytics) can tell visits from QR codes. Parameters already in the destination URL are not overwritten. Empty fields are not added."
     689msgstr "短縮 URL の QR コードが読み取られたとき、リダイレクト先にこのパラメーターを付けます。アクセス解析(Google アナリティクスなど)で QR コードからの訪問を見分けられます。転送先の URL にすでにあるパラメーターは上書きしません。空の項目は付けません。"
     690
     691#: templates/admin-qrcm-setting.php:24 templates/meta-box-qrcode-data.php:50
     692msgid "Wi-Fi"
     693msgstr "Wi-Fi"
    590694
    591695#: templates/meta-box-qrcode-settings.php:205
    … …  
    593697msgstr "幅"
    594698
    595 #: includes/Qrcode.php:1998
     699#: includes/Qrcode.php:2221
    596700msgid "Would you like to redirect to the url \"%URL\""
    597701msgstr "\"%URL\"にリダイレクトしますか"
    598702
    599 #: includes/Qrcode.php:2002
     703#: includes/Qrcode.php:2225
    600704msgid "Your browser has no permission for the camera. Please activate the permission."
    601705msgstr "ブラウザーにカメラの使用許可がありません。許可を有効にしてください。"
    602706
    603 #: templates/admin-qrcm-setting.php:174
     707#: templates/admin-qrcm-setting.php:208
    604708msgid "days"
    605709msgstr "日"
    … …  
    613717msgstr "背景画像のプレビューを編集"
    614718
    615 #: includes/Qrcode.php:1315 templates/admin-qrcm-setting.php:137
     719#: includes/Qrcode.php:1520 templates/admin-qrcm-setting.php:138
    616720msgid "eps"
    617721msgstr "EPS"
    618722
    619 #: includes/Qrcode.php:1316 templates/admin-qrcm-setting.php:135
     723#: includes/Qrcode.php:1521 templates/admin-qrcm-setting.php:136
    620724msgid "jpeg"
    621725msgstr "JPEG"
    622726
    623 #: includes/Qrcode.php:1313 templates/admin-qrcm-setting.php:136
     727#: includes/Qrcode.php:1518 templates/admin-qrcm-setting.php:137
    624728msgid "png"
    625729msgstr "PNG"
    … …  
    629733msgstr "背景画像を保存"
    630734
    631 #: includes/Qrcode.php:1314 templates/admin-qrcm-setting.php:138
     735#: includes/Qrcode.php:1519 templates/admin-qrcm-setting.php:139
    632736msgid "svg"
    633737msgstr "SVG"
    634738
    635 #: templates/meta-box-qrcode-data.php:106
     739#: templates/meta-box-qrcode-data.php:111
    636740msgid "vCard"
    637741msgstr "vCard"
  • qr-code-management/trunk/languages/qr-code-management.pot

    r3845962 r3846961  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: QR Code Management 1.7.2\n"
    6 "POT-Creation-Date: 2026-12-05 08:06+0000\n"
     5"Project-Id-Version: QR Code Management 1.8.0\n"
     6"POT-Creation-Date: 2026-12-05 17:00+0000\n"
    77"MIME-Version: 1.0\n"
    88"Content-Type: text/plain; charset=UTF-8\n"
    … …  
    1111"Language-Team: \n"
    1212
    13 #: includes/Report.php:322
     13#: includes/Report.php:325
    1414msgid "(Deleted post #%d)"
    1515msgstr ""
    1616
    17 #: includes/Report.php:313
     17#: includes/Report.php:316
    1818msgid "(Deleted user #%d)"
    1919msgstr ""
    2020
    21 #: includes/Report.php:325
     21#: includes/Report.php:328
    2222msgid "(no title)"
    2323msgstr ""
    2424
    25 #: templates/meta-box-qrcode-data.php:154
     25#: templates/meta-box-qrcode-data.php:159
    2626msgid "8 digits for date of birth: year (4 digits), month (2 digits) and day (2 digits), in order."
    2727msgstr ""
    2828
    29 #: templates/meta-box-qrcode-data.php:169
     29#: templates/meta-box-qrcode-data.php:174
    3030msgid "A URL pointing to a website that represents the person in some way."
    3131msgstr ""
    3232
    33 #: templates/meta-box-qrcode-data.php:119
     33#: templates/meta-box-qrcode-data.php:300
     34msgid "A password is saved. It is not shown here. Leave this field empty to keep it."
     35msgstr ""
     36
     37#: templates/meta-box-qrcode-data.php:124
    3438msgid "A structured representation of the name of the person. When a field is divided by a comma (,), the first half is treated as the last name and the second half is treated as the first name."
    3539msgstr ""
    3640
    37 #: templates/admin-qrcm-setting.php:168
     41#: templates/admin-qrcm-setting.php:202
    3842msgid "Access log retention"
    3943msgstr ""
    4044
    41 #: templates/admin-qrcm-setting.php:178
     45#: templates/admin-qrcm-setting.php:212
    4246msgid "Access logs (used by the access report) older than this number of days are deleted automatically once a day. Enter 0 to keep them forever (up to %d days)."
    4347msgstr ""
    … …  
    5559msgstr ""
    5660
     61#: templates/admin-qrcm-setting.php:184
     62msgid "Add UTM parameters to the redirect destination"
     63msgstr ""
     64
    5765#: templates/meta-box-qrcode-settings.php:69
    5866msgid "Add an image"
    5967msgstr ""
    6068
    61 #: templates/meta-box-qrcode-data.php:147
     69#: templates/meta-box-qrcode-data.php:152
    6270msgid "Address"
    6371msgstr ""
    … …  
    6775msgstr ""
    6876
    69 #: includes/Qrcode.php:304
     77#: includes/Qrcode.php:405
    7078msgid "Author"
    7179msgstr ""
    7280
    73 #: templates/admin-qrcm-setting.php:110
     81#: templates/admin-qrcm-setting.php:111
    7482msgid "Available permissions"
    7583msgstr ""
    … …  
    8391msgstr ""
    8492
    85 #: templates/meta-box-qrcode-data.php:152
     93#: templates/meta-box-qrcode-data.php:157
    8694msgid "Birthday"
    8795msgstr ""
    … …  
    99107msgstr ""
    100108
    101 #: templates/admin-qrcm-setting.php:21 templates/meta-box-qrcode-data.php:43
     109#: templates/admin-qrcm-setting.php:21 templates/meta-box-qrcode-data.php:47
    102110msgid "Contact"
    103111msgstr ""
    … …  
    107115msgstr ""
    108116
    109 #: templates/admin-qrcm-setting.php:84
     117#: templates/admin-qrcm-setting.php:85
    110118msgid "Custom post type settings"
    111119msgstr ""
    112120
    113 #: templates/admin-qrcm-setting.php:65
     121#: templates/admin-qrcm-setting.php:66
    114122msgid "Data format used"
    115123msgstr ""
    … …  
    119127msgstr ""
    120128
    121 #: templates/meta-box-qrcode-data.php:129
     129#: templates/meta-box-qrcode-data.php:308
     130msgid "Delete the saved password"
     131msgstr ""
     132
     133#: templates/meta-box-qrcode-data.php:134
    122134msgid "Designates a text string to be set as the kana name in the phonebook.When a field is divided by a comma (,), the first half is treated as the last name and the second half is treated as the first name."
    123135msgstr ""
    124136
    125 #: templates/admin-qrcm-setting.php:36
     137#: templates/admin-qrcm-setting.php:37
    126138msgid "Display settings"
    127139msgstr ""
    … …  
    131143msgstr ""
    132144
    133 #: templates/admin-qrcm-setting.php:46
     145#: templates/admin-qrcm-setting.php:47
    134146msgid "Download"
    135147msgstr ""
    … …  
    139151msgstr ""
    140152
     153#: includes/Bulk_Download.php:104
     154msgid "Download QR codes (ZIP)"
     155msgstr ""
     156
    141157#: templates/meta-box-qrcode-settings.php:61
    142158msgid "Edit"
    143159msgstr ""
    144160
    145 #: templates/meta-box-qrcode-data.php:142
     161#: templates/meta-box-qrcode-data.php:147
    146162msgid "Email"
    147163msgstr ""
    148164
    149 #: templates/meta-box-qrcode-data.php:212
     165#: templates/meta-box-qrcode-data.php:217
    150166msgid "End"
    151167msgstr ""
    152168
    153 #: templates/admin-qrcm-setting.php:22 templates/meta-box-qrcode-data.php:44
     169#: templates/admin-qrcm-setting.php:22 templates/meta-box-qrcode-data.php:48
    154170msgid "Events"
    155171msgstr ""
    156172
    157 #: templates/meta-box-qrcode-data.php:124
     173#: templates/meta-box-qrcode-data.php:129
    158174msgid "Familiar name for the object represented by this MeCard/vCard."
    159175msgstr ""
    … …  
    171187msgstr ""
    172188
    173 #: templates/admin-qrcm-setting.php:130
     189#: templates/admin-qrcm-setting.php:131
    174190msgid "Format"
    175191msgstr ""
    176192
    177 #: includes/Qrcode.php:1997
     193#: includes/Qrcode.php:2220
    178194msgid "Forwarding"
    179195msgstr ""
    180196
    181 #: templates/admin-qrcm-setting.php:23 templates/meta-box-qrcode-data.php:45 templates/meta-box-qrcode-data.php:244
     197#: templates/admin-qrcm-setting.php:23 templates/meta-box-qrcode-data.php:49 templates/meta-box-qrcode-data.php:249
    182198msgid "Free"
    183199msgstr ""
    … …  
    187203msgstr ""
    188204
    189 #: templates/admin-qrcm-setting.php:45
     205#: templates/meta-box-qrcode-data.php:313
     206msgid "Hidden network"
     207msgstr ""
     208
     209#: templates/admin-qrcm-setting.php:46
    190210msgid "Image"
    191211msgstr ""
    … …  
    199219msgstr ""
    200220
    201 #: templates/admin-qrcm-setting.php:165
     221#: templates/admin-qrcm-setting.php:166
    202222msgid "Invalid"
    203223msgstr ""
    … …  
    223243msgstr ""
    224244
     245#: includes/Block.php:71
     246msgid "Leave both empty to show the QR code of the post being displayed. If both are set, the post ID is used."
     247msgstr ""
     248
    225249#: templates/meta-box-qrcode-settings.php:122
    226250msgid "Level H – up to 30%&nbsp;damage"
    … …  
    239263msgstr ""
    240264
    241 #: templates/admin-qrcm-setting.php:39
     265#: templates/admin-qrcm-setting.php:40
    242266msgid "List display"
    243267msgstr ""
    … …  
    259283msgstr ""
    260284
    261 #: templates/meta-box-qrcode-data.php:104
     285#: templates/meta-box-qrcode-data.php:109
    262286msgid "MeCard"
    263287msgstr ""
    264288
    265 #: templates/meta-box-qrcode-data.php:117
     289#: templates/meta-box-qrcode-data.php:122
    266290msgid "Name"
    267291msgstr ""
    268292
    269 #: templates/meta-box-qrcode-data.php:122
     293#: templates/meta-box-qrcode-data.php:264
     294msgid "Network name (SSID)"
     295msgstr ""
     296
     297#: templates/meta-box-qrcode-data.php:127
    270298msgid "Nickname"
     299msgstr ""
     300
     301#: includes/Block.php:72
     302msgid "No QR code to show. Save the post, check that this post type is enabled in the QR code settings, and that \"Image\" is enabled under \"List display\"."
    271303msgstr ""
    272304
    … …  
    275307msgstr ""
    276308
     309#: templates/meta-box-qrcode-data.php:302
     310msgid "No password is saved."
     311msgstr ""
     312
    277313#: templates/admin-qrcm-report.php:79
    278314msgid "No scans have been recorded in this period."
    279315msgstr ""
    280316
    281 #: templates/meta-box-qrcode-data.php:31 templates/meta-box-qrcode-settings.php:85 templates/meta-box-qrcode-settings.php:231
     317#: templates/meta-box-qrcode-data.php:279
     318msgid "None (no password)"
     319msgstr ""
     320
     321#: includes/Bulk_Download.php:257
     322msgid "None of the selected posts have generated QR code images. Open the post list or the edit screen to generate them, then download again."
     323msgstr ""
     324
     325#: templates/meta-box-qrcode-data.php:35 templates/meta-box-qrcode-settings.php:85 templates/meta-box-qrcode-settings.php:231
    282326msgid "Not set"
    283327msgstr ""
    284328
    285 #: templates/meta-box-qrcode-data.php:172
     329#: templates/meta-box-qrcode-data.php:177
    286330msgid "Note"
    287331msgstr ""
    … …  
    295339msgstr ""
    296340
    297 #: templates/meta-box-qrcode-data.php:162
     341#: templates/meta-box-qrcode-data.php:167
    298342msgid "Organization"
    299343msgstr ""
    300344
    301 #: templates/meta-box-qrcode-data.php:164
     345#: templates/meta-box-qrcode-data.php:169
    302346msgid "Organization name."
    303347msgstr ""
    304348
    305 #: templates/admin-qrcm-setting.php:127
     349#: templates/admin-qrcm-setting.php:128
    306350msgid "Output setting"
    307351msgstr ""
    … …  
    311355msgstr ""
    312356
    313 #: includes/Qrcode.php:2001
     357#: templates/meta-box-qrcode-data.php:291
     358msgid "Password"
     359msgstr ""
     360
     361#: includes/Qrcode.php:2224
    314362msgid "Permission failed"
    315363msgstr ""
    316364
    317 #: templates/meta-box-qrcode-data.php:132
     365#: templates/meta-box-qrcode-data.php:137
    318366msgid "Phone"
    319367msgstr ""
    320368
    321 #: templates/meta-box-qrcode-data.php:159
     369#: templates/meta-box-qrcode-data.php:164
    322370msgid "Position held in organization."
    323371msgstr ""
    … …  
    327375msgstr ""
    328376
    329 #: templates/admin-qrcm-setting.php:156
     377#: includes/Block.php:69
     378msgid "Post ID"
     379msgstr ""
     380
     381#: templates/admin-qrcm-setting.php:157
    330382msgid "Presence"
    331383msgstr ""
    332384
    333 #: includes/Qrcode.php:302 includes/Qrcode.php:1272 includes/Qrcode.php:1731 includes/Widget.php:104
     385#: includes/Block.php:66 includes/Qrcode.php:403 includes/Qrcode.php:1477 includes/Qrcode.php:1954 includes/Widget.php:104
    334386msgid "QR Code"
    335387msgstr ""
    … …  
    339391msgstr ""
    340392
    341 #: includes/Qrcode.php:1432 includes/Qrcode.php:1671
     393#: includes/Qrcode.php:1637 includes/Qrcode.php:1894
    342394msgid "QR Code Data"
    343395msgstr ""
    344396
    345 #: includes/Qrcode.php:1996
     397#: includes/Qrcode.php:2219
    346398msgid "QR Code Management"
    347399msgstr ""
    348400
    349 #: includes/Qrcode.php:1442 includes/Qrcode.php:1676 templates/admin-qrcm-setting.php:188
     401#: includes/Qrcode.php:1647 includes/Qrcode.php:1899 templates/admin-qrcm-setting.php:222
    350402msgid "QR Code Settings"
    351403msgstr ""
    352404
    353 #: includes/Qrcode.php:1452 includes/Qrcode.php:1681
     405#: includes/Qrcode.php:1657 includes/Qrcode.php:1904
    354406msgid "QR Code Shortcode"
    355407msgstr ""
    356408
    357 #: templates/admin-qrcm-setting.php:62
     409#: templates/admin-qrcm-setting.php:63
    358410msgid "QR Code data settings"
    359411msgstr ""
    … …  
    371423msgstr ""
    372424
     425#: includes/Block.php:68
     426msgid "QR code target"
     427msgstr ""
     428
    373429#: templates/meta-box-qrcode-settings.php:327
    374430msgid "Qrcode size"
    … …  
    379435msgstr ""
    380436
    381 #: templates/admin-qrcm-setting.php:153
     437#: templates/admin-qrcm-setting.php:154
    382438msgid "Redirect settings"
    383439msgstr ""
    384440
    385 #: templates/admin-qrcm-setting.php:81
     441#: templates/admin-qrcm-setting.php:82
    386442msgid "Role settings"
    387443msgstr ""
    … …  
    391447msgstr ""
    392448
    393 #: templates/admin-qrcm-setting.php:213 templates/meta-box-qrcode-settings.php:337
     449#: templates/admin-qrcm-setting.php:247 templates/meta-box-qrcode-settings.php:337
    394450msgid "Save"
    395451msgstr ""
    396452
    397 #: templates/admin-qrcm-setting.php:195
     453#: templates/admin-qrcm-setting.php:229
    398454msgid "Scanner shortcode"
    399455msgstr ""
    … …  
    407463msgstr ""
    408464
    409 #: includes/Qrcode.php:1223
     465#: includes/Qrcode.php:1428
    410466msgid "Scans: %s"
    411467msgstr ""
    412468
    413 #: includes/Admin.php:324
     469#: templates/meta-box-qrcode-data.php:272
     470msgid "Security"
     471msgstr ""
     472
     473#: includes/Admin.php:399
    414474msgid "Select"
    415475msgstr ""
    416476
    417 #: templates/meta-box-qrcode-data.php:109
     477#: templates/meta-box-qrcode-data.php:114
    418478msgid "Select contact information QR code format"
    419479msgstr ""
    420480
    421 #: includes/Qrcode.php:1999
     481#: includes/Qrcode.php:2222
    422482msgid "Select device"
    423483msgstr ""
    424484
    425 #: includes/Admin.php:323
     485#: includes/Admin.php:398
    426486msgid "Select or Upload Media"
    427487msgstr ""
    428488
    429 #: templates/meta-box-qrcode-data.php:34 templates/meta-box-qrcode-settings.php:88 templates/meta-box-qrcode-settings.php:235
     489#: includes/Bulk_Download.php:256
     490msgid "Select up to %d posts to download QR codes at a time."
     491msgstr ""
     492
     493#: templates/meta-box-qrcode-data.php:38 templates/meta-box-qrcode-settings.php:88 templates/meta-box-qrcode-settings.php:235
    430494msgid "Set"
    431495msgstr ""
    432496
    433 #: templates/meta-box-qrcode-data.php:27 templates/meta-box-qrcode-settings.php:81
     497#: templates/meta-box-qrcode-data.php:31 templates/meta-box-qrcode-settings.php:81
    434498msgid "Set individually"
    435499msgstr ""
    … …  
    447511msgstr ""
    448512
    449 #: templates/admin-qrcm-setting.php:199 templates/meta-box-qrcode-shortcode.php:14
     513#: templates/admin-qrcm-setting.php:233 templates/meta-box-qrcode-shortcode.php:14
    450514msgid "Shortcode"
    451515msgstr ""
    … …  
    455519msgstr ""
    456520
     521#: includes/Block.php:67
     522msgid "Shows the QR code of this post, or of the post or user you specify. Same as the [qrcm] shortcode."
     523msgstr ""
     524
    457525#: templates/admin-qrcm-report.php:103
    458526msgid "Shows up to %d QR codes, sorted by number of scans."
    … …  
    467535msgstr ""
    468536
    469 #: includes/Qrcode.php:1363
     537#: includes/Qrcode.php:1568
    470538msgid "Sorry, you are not allowed to download this QR code."
    471539msgstr ""
    472540
    473 #: templates/meta-box-qrcode-data.php:127
     541#: templates/meta-box-qrcode-data.php:132
    474542msgid "Sound"
    475543msgstr ""
    476544
    477 #: templates/meta-box-qrcode-data.php:174
     545#: templates/meta-box-qrcode-data.php:179
    478546msgid "Specifies supplemental information to be set as memo in the phonebook."
    479547msgstr ""
    … …  
    483551msgstr ""
    484552
    485 #: templates/meta-box-qrcode-data.php:211
     553#: templates/meta-box-qrcode-data.php:216
    486554msgid "Start"
    487555msgstr ""
    488556
    489 #: templates/meta-box-qrcode-data.php:230
     557#: templates/meta-box-qrcode-data.php:235
    490558msgid "Summary"
    491559msgstr ""
    … …  
    503571msgstr ""
    504572
    505 #: includes/Qrcode.php:1256
     573#: templates/meta-box-qrcode-data.php:321
     574msgid "The QR code contains the password as it is. Anyone who can see or download the QR code image can connect to the network."
     575msgstr ""
     576
     577#: includes/Qrcode.php:1461
    506578msgid "The QR code data is too long to generate an image. Shorten the QR code data."
    507579msgstr ""
    508580
     581#: includes/Bulk_Download.php:258
     582msgid "The ZIP file could not be created."
     583msgstr ""
     584
     585#: templates/meta-box-qrcode-data.php:149
     586msgid "The address for electronic mail communication."
     587msgstr ""
     588
     589#: templates/meta-box-qrcode-data.php:139
     590msgid "The canonical number string for a telephone number for telephony communication."
     591msgstr ""
     592
    509593#: templates/meta-box-qrcode-data.php:144
    510 msgid "The address for electronic mail communication."
    511 msgstr ""
    512 
    513 #: templates/meta-box-qrcode-data.php:134
    514 msgid "The canonical number string for a telephone number for telephony communication."
    515 msgstr ""
    516 
    517 #: templates/meta-box-qrcode-data.php:139
    518594msgid "The canonical string for a videophone number communication."
    519595msgstr ""
    520596
    521 #: templates/meta-box-qrcode-data.php:149
     597#: templates/meta-box-qrcode-data.php:317
     598msgid "The network does not broadcast its SSID"
     599msgstr ""
     600
     601#: templates/meta-box-qrcode-data.php:154
    522602msgid "The physical delivery address. The fields divided by commas (,) denote PO box, room number, house number, city, prefecture, zip code and country, in order."
    523603msgstr ""
    … …  
    527607msgstr ""
    528608
    529 #: templates/meta-box-qrcode-data.php:85 templates/meta-box-qrcode-data.php:195
     609#: templates/meta-box-qrcode-data.php:90 templates/meta-box-qrcode-data.php:200
    530610msgid "This URL cannot be used in a QR code because its scheme (such as javascript: or data:) is not allowed. It will not be saved. Enter a URL that starts with https:// or http://."
    531611msgstr ""
    … …  
    535615msgstr ""
    536616
    537 #: templates/meta-box-qrcode-data.php:157
     617#: templates/meta-box-qrcode-data.php:162
    538618msgid "Title"
    539619msgstr ""
    … …  
    551631msgstr ""
    552632
    553 #: includes/Report.php:202 templates/admin-qrcm-report.php:70 templates/meta-box-qrcode-data.php:97
     633#: includes/Report.php:202 templates/admin-qrcm-report.php:70 templates/meta-box-qrcode-data.php:102
    554634msgid "Type"
    555635msgstr ""
    556636
    557 #: templates/admin-qrcm-setting.php:20 templates/meta-box-qrcode-data.php:42 templates/meta-box-qrcode-data.php:73 templates/meta-box-qrcode-data.php:167
     637#: templates/admin-qrcm-setting.php:20 templates/meta-box-qrcode-data.php:46 templates/meta-box-qrcode-data.php:78 templates/meta-box-qrcode-data.php:172
    558638msgid "URL"
     639msgstr ""
     640
     641#: templates/admin-qrcm-setting.php:179
     642msgid "UTM parameters"
    559643msgstr ""
    560644
    … …  
    563647msgstr ""
    564648
    565 #: templates/admin-qrcm-setting.php:107
     649#: templates/admin-qrcm-setting.php:108
    566650msgid "Use with user profile"
    567651msgstr ""
    … …  
    571655msgstr ""
    572656
    573 #: templates/admin-qrcm-setting.php:99
     657#: includes/Block.php:70
     658msgid "User ID"
     659msgstr ""
     660
     661#: templates/admin-qrcm-setting.php:100
    574662msgid "User settings"
    575663msgstr ""
    576664
    577 #: templates/admin-qrcm-setting.php:161
     665#: templates/admin-qrcm-setting.php:162
    578666msgid "Valid"
    579667msgstr ""
    580668
    581 #: templates/meta-box-qrcode-data.php:137
     669#: templates/meta-box-qrcode-data.php:142
    582670msgid "Videophone"
    583671msgstr ""
    584672
    585 #: includes/Qrcode.php:2000
     673#: templates/meta-box-qrcode-data.php:278
     674msgid "WEP"
     675msgstr ""
     676
     677#: templates/meta-box-qrcode-data.php:277
     678msgid "WPA / WPA2 / WPA3"
     679msgstr ""
     680
     681#: includes/Qrcode.php:2223
    586682msgid "Wait for your permission"
     683msgstr ""
     684
     685#: templates/admin-qrcm-setting.php:199
     686msgid "When a QR code with the shortened URL is scanned, these parameters are added to the redirect destination so that access analysis (such as Google Analytics) can tell visits from QR codes. Parameters already in the destination URL are not overwritten. Empty fields are not added."
     687msgstr ""
     688
     689#: templates/admin-qrcm-setting.php:24 templates/meta-box-qrcode-data.php:50
     690msgid "Wi-Fi"
    587691msgstr ""
    588692
    … …  
    591695msgstr ""
    592696
    593 #: includes/Qrcode.php:1998
     697#: includes/Qrcode.php:2221
    594698msgid "Would you like to redirect to the url \"%URL\""
    595699msgstr ""
    596700
    597 #: includes/Qrcode.php:2002
     701#: includes/Qrcode.php:2225
    598702msgid "Your browser has no permission for the camera. Please activate the permission."
    599703msgstr ""
    600704
    601 #: templates/admin-qrcm-setting.php:174
     705#: templates/admin-qrcm-setting.php:208
    602706msgid "days"
    603707msgstr ""
    … …  
    611715msgstr ""
    612716
    613 #: includes/Qrcode.php:1315 templates/admin-qrcm-setting.php:137
     717#: includes/Qrcode.php:1520 templates/admin-qrcm-setting.php:138
    614718msgid "eps"
    615719msgstr ""
    616720
    617 #: includes/Qrcode.php:1316 templates/admin-qrcm-setting.php:135
     721#: includes/Qrcode.php:1521 templates/admin-qrcm-setting.php:136
    618722msgid "jpeg"
    619723msgstr ""
    620724
    621 #: includes/Qrcode.php:1313 templates/admin-qrcm-setting.php:136
     725#: includes/Qrcode.php:1518 templates/admin-qrcm-setting.php:137
    622726msgid "png"
    623727msgstr ""
    … …  
    627731msgstr ""
    628732
    629 #: includes/Qrcode.php:1314 templates/admin-qrcm-setting.php:138
     733#: includes/Qrcode.php:1519 templates/admin-qrcm-setting.php:139
    630734msgid "svg"
    631735msgstr ""
    632736
    633 #: templates/meta-box-qrcode-data.php:106
     737#: templates/meta-box-qrcode-data.php:111
    634738msgid "vCard"
    635739msgstr ""
  • qr-code-management/trunk/qr-code-management.php

    r3845962 r3846961  
    33 * Plugin Name: QR Code Management
    44 * Description: A plug-in that issues a QR code for public pages of posts, fixed pages, and custom post types. The QR code format is PNG, SVG, EPS, JPEG.
    5  * Version: 1.7.2
     5 * Version: 1.8.0
    66 * Author: Redwoodcity Inc.
    77 * Author URI: https://www.redwoodcity.jp/
    … …  
    1717}
    1818
    19 define( 'RWCQRCM_VERSION', '1.7.2' );
     19define( 'RWCQRCM_VERSION', '1.8.0' );
    2020define( 'RWCQRCM_PLUGIN_MAIN_FILE', __FILE__ );
    2121
  • qr-code-management/trunk/readme.txt

    r3845962 r3846961  
    55Requires at least: 4.7
    66Tested up to: 7.1
    7 Stable tag: 1.7.2
     7Stable tag: 1.8.0
    88Requires PHP: 7.4
    99License: GPLv2 or later
    … …  
    2020* **QR code display** — Shows a QR code with a download button on the edit screen and in the post / page list of the post types you choose.
    2121* **Output formats** — Download QR codes as PNG, SVG, EPS, or JPEG.
    22 * **Redirect (shortened URL)** — Embeds a shortened URL (`https://your-site/?qrc=CODE`) instead of the page URL. Each scan is recorded in an access log and redirected to the current permalink, so printed QR codes keep working even when the page URL changes.
     22* **Redirect (shortened URL)** — Embeds a shortened URL (`https://your-site/?qrc=CODE`) instead of the page URL. Each scan is recorded in an access log and redirected to the current permalink, so printed QR codes keep working even when the page URL changes. Optionally, UTM parameters (`utm_source` / `utm_medium` / `utm_campaign`) are added to the redirect destination for your analytics tool.
    2323* **Access report** — See the number of scans, unique visitors, and the last scan date for each QR code over the last 7 / 30 / 90 days or all time, and download the report as CSV. The scan count is also shown in the post list. Optionally, access logs older than a set number of days are deleted automatically.
    24 * **QR code data** — Embeds the permalink by default. Per post, it can be changed to a URL, contact information (MeCard / vCard), event information, or free text.
     24* **QR code data** — Embeds the permalink by default. Per post, it can be changed to a URL, contact information (MeCard / vCard), event information, Wi-Fi network settings, or free text.
    2525* **Appearance settings** — Margin, error correction level, label, size, colors, logo image, and background image can be set globally or per post.
    2626* **Original QR codes** — Create QR codes that are not tied to a post, with any data.
    … …  
    2929* **Shortcodes** — `[qrcm]` embeds a QR code in content (attributes: `post_id` / `user_id`; without attributes it shows the QR code of the current post or author). `[qrcm_scanner]` places a camera-based QR code reader that redirects to the scanned URL.
    3030* **Sidebar widget** — The "QR Code (QR Code Management)" widget shows the QR code of the page being viewed.
     31* **Block** — The "QR Code" block shows the same QR code as the `[qrcm]` shortcode in the block editor (WordPress 5.3 or later).
     32* **Bulk download** — Select posts in the list screen and choose "Download QR codes (ZIP)" to download their generated QR code images at once (up to 100 posts at a time).
     33* **WP-CLI** — `wp qrcm regenerate` regenerates QR code images and `wp qrcm report` outputs the access report (table / CSV / JSON).
    3134
    3235= Usage =
    … …  
    8689
    8790== Changelog ==
     91
     92= 1.8.0 =
     93*Release Date - 6 December 2026*
     94* Reduced the plugin size by more than half (about 2.4 MB to 1.0 MB): updated the bundled QR code library (endroid/qr-code 3.9.7 to 4.6.1, which no longer needs the Symfony components), removed the unused QR code reader library, the library tests and documents, and minified the scanner script. QR code images are generated exactly as before
     95* Added the Wi-Fi data type (network name, security, password, hidden network). The saved password is not shown on the edit screen
     96* Added an option to add UTM parameters to the redirect destination ("Setting" -> "Redirect settings", off by default), and the `rwcqrcm_redirect_url` filter
     97* Added the "QR Code" block (WordPress 5.3 or later)
     98* Added the "Download QR codes (ZIP)" bulk action to the post list (only images that are already generated and up to date; up to 100 posts at a time)
     99* Added WP-CLI commands: `wp qrcm regenerate` and `wp qrcm report`
     100* The admin CSS and JavaScript are now loaded only on the screens that use them
    88101
    89102= 1.7.2 =
  • qr-code-management/trunk/templates/admin-qrcm-setting.php

    r3802279 r3846961  
    2222                        'event'   => __( 'Events', 'qr-code-management' ),
    2323                        'free'    => __( 'Free', 'qr-code-management' ),
     24                        'wifi'    => __( 'Wi-Fi', 'qr-code-management' ),
    2425                );
    2526
    … …  
    164165                                                                                <?php checked( isset( $rwc_qrcm['redirect']['presence'] ) && 'invalid' === $rwc_qrcm['redirect']['presence'] ); ?>>
    165166                                                                <label for="rwc_qrcm_redirect_presence_invalid"><?php esc_html_e( 'Invalid', 'qr-code-management' ); ?></label>
     167                                                        </div>
     168
     169                                                        <?php
     170                                                        // 転送先に付ける UTM(1.8.0〜)。未保存なら既定値を表示する(付与は無効)
     171                                                        $rwcqrcm_utm         = isset( $rwc_qrcm['redirect']['utm'] ) && is_array( $rwc_qrcm['redirect']['utm'] ) ? $rwc_qrcm['redirect']['utm'] : array();
     172                                                        $rwcqrcm_utm_fields  = array(
     173                                                                'source'   => array( 'utm_source', 'qr' ),
     174                                                                'medium'   => array( 'utm_medium', 'qrcode' ),
     175                                                                'campaign' => array( 'utm_campaign', '' ),
     176                                                        );
     177                                                        $rwcqrcm_utm_enabled = isset( $rwcqrcm_utm['enabled'] ) && 'on' === $rwcqrcm_utm['enabled'];
     178                                                        ?>
     179                                                        <h3 class="rwc_inner_box__header"><?php esc_html_e( 'UTM parameters', 'qr-code-management' ); ?></h3>
     180                                                        <div class="rwc_inner_box__body">
     181                                                                <input type="checkbox" name="rwc_qrcm[redirect][utm][enabled]"
     182                                                                                id="rwc_qrcm_redirect_utm_enabled" value="on"
     183                                                                                <?php checked( $rwcqrcm_utm_enabled ); ?>>
     184                                                                <label for="rwc_qrcm_redirect_utm_enabled"><?php esc_html_e( 'Add UTM parameters to the redirect destination', 'qr-code-management' ); ?></label>
     185                                                                <table class="form-table" role="presentation">
     186                                                                        <?php foreach ( $rwcqrcm_utm_fields as $rwcqrcm_utm_key => $rwcqrcm_utm_def ) : ?>
     187                                                                                <tr>
     188                                                                                        <th><label for="rwc_qrcm_redirect_utm_<?php echo esc_attr( $rwcqrcm_utm_key ); ?>"><?php echo esc_html( $rwcqrcm_utm_def[0] ); ?></label></th>
     189                                                                                        <td>
     190                                                                                                <input type="text" class="regular-text"
     191                                                                                                                name="rwc_qrcm[redirect][utm][<?php echo esc_attr( $rwcqrcm_utm_key ); ?>]"
     192                                                                                                                id="rwc_qrcm_redirect_utm_<?php echo esc_attr( $rwcqrcm_utm_key ); ?>"
     193                                                                                                                maxlength="<?php echo esc_attr( (string) RWC_Qrcode::UTM_MAX_LENGTH ); ?>"
     194                                                                                                                value="<?php echo esc_attr( isset( $rwcqrcm_utm[ $rwcqrcm_utm_key ] ) ? (string) $rwcqrcm_utm[ $rwcqrcm_utm_key ] : $rwcqrcm_utm_def[1] ); ?>">
     195                                                                                        </td>
     196                                                                                </tr>
     197                                                                        <?php endforeach; ?>
     198                                                                </table>
     199                                                                <p class="description"><?php esc_html_e( 'When a QR code with the shortened URL is scanned, these parameters are added to the redirect destination so that access analysis (such as Google Analytics) can tell visits from QR codes. Parameters already in the destination URL are not overwritten. Empty fields are not added.', 'qr-code-management' ); ?></p>
    166200                                                        </div>
    167201
  • qr-code-management/trunk/templates/meta-box-qrcode-data.php

    r3845962 r3846961  
    1515 * @var $rwcqrcm_qrdata_event_summary
    1616 * @var $rwcqrcm_qrdata_free_freeinput
     17 * @var $rwcqrcm_qrdata_wifi_ssid
     18 * @var $rwcqrcm_qrdata_wifi_encryption
     19 * @var $rwcqrcm_qrdata_wifi_password
     20 * @var $rwcqrcm_qrdata_wifi_hidden
    1721 */
    1822
    … …  
    4448                'event'   => __( 'Events', 'qr-code-management' ),
    4549                'free'    => __( 'Free', 'qr-code-management' ),
     50                'wifi'    => __( 'Wi-Fi', 'qr-code-management' ),
    4651        );
    4752
    … …  
    254259                </table>
    255260        </div>
     261        <div class="tab_content" id="rwcqrcm_qrdata_wifi_content">
     262                <table class="form-table" role="presentation">
     263                        <tr>
     264                                <th><label for="rwcqrcm_qrdata_wifi_ssid"><?php esc_html_e( 'Network name (SSID)', 'qr-code-management' ); ?></label></th>
     265                                <td>
     266                                        <input type="text" name="rwcqrcm[qrdata][wifi][ssid]" id="rwcqrcm_qrdata_wifi_ssid" class="regular-text"
     267                                                        maxlength="<?php echo esc_attr( (string) RWC_Qrcode::WIFI_MAX_LENGTH ); ?>" autocomplete="off"
     268                                                        value="<?php echo esc_attr( (string) $rwcqrcm_qrdata_wifi_ssid ); ?>">
     269                                </td>
     270                        </tr>
     271                        <tr>
     272                                <th><label for="rwcqrcm_qrdata_wifi_encryption"><?php esc_html_e( 'Security', 'qr-code-management' ); ?></label></th>
     273                                <td>
     274                                        <?php
     275                                        // 暗号方式(ラベルは定義時に翻訳しておく)。未保存なら WPA
     276                                        $rwcqrcm_wifi_encryptions        = array(
     277                                                'WPA'    => __( 'WPA / WPA2 / WPA3', 'qr-code-management' ),
     278                                                'WEP'    => __( 'WEP', 'qr-code-management' ),
     279                                                'nopass' => __( 'None (no password)', 'qr-code-management' ),
     280                                        );
     281                                        $rwcqrcm_wifi_encryption_current = in_array( $rwcqrcm_qrdata_wifi_encryption, RWC_Qrcode::WIFI_ENCRYPTIONS, true ) ? $rwcqrcm_qrdata_wifi_encryption : 'WPA';
     282                                        ?>
     283                                        <select name="rwcqrcm[qrdata][wifi][encryption]" id="rwcqrcm_qrdata_wifi_encryption">
     284                                                <?php foreach ( $rwcqrcm_wifi_encryptions as $rwcqrcm_wifi_encryption => $rwcqrcm_wifi_encryption_label ) : ?>
     285                                                        <option value="<?php echo esc_attr( $rwcqrcm_wifi_encryption ); ?>" <?php selected( $rwcqrcm_wifi_encryption_current, $rwcqrcm_wifi_encryption ); ?>><?php echo esc_html( $rwcqrcm_wifi_encryption_label ); ?></option>
     286                                                <?php endforeach; ?>
     287                                        </select>
     288                                </td>
     289                        </tr>
     290                        <tr>
     291                                <th><label for="rwcqrcm_qrdata_wifi_password"><?php esc_html_e( 'Password', 'qr-code-management' ); ?></label></th>
     292                                <td>
     293                                        <?php // 保存済みのパスワードは画面に出さない。空のまま保存すると、保存済みの値を残す。 ?>
     294                                        <input type="password" name="rwcqrcm[qrdata][wifi][password]" id="rwcqrcm_qrdata_wifi_password" class="regular-text"
     295                                                        maxlength="<?php echo esc_attr( (string) RWC_Qrcode::WIFI_MAX_LENGTH ); ?>" autocomplete="new-password" value=""
     296                                                        aria-describedby="rwcqrcm_qrdata_wifi_password_description">
     297                                        <p class="description" id="rwcqrcm_qrdata_wifi_password_description">
     298                                                <?php
     299                                                if ( '' !== (string) $rwcqrcm_qrdata_wifi_password ) {
     300                                                        esc_html_e( 'A password is saved. It is not shown here. Leave this field empty to keep it.', 'qr-code-management' );
     301                                                } else {
     302                                                        esc_html_e( 'No password is saved.', 'qr-code-management' );
     303                                                }
     304                                                ?>
     305                                        </p>
     306                                        <?php if ( '' !== (string) $rwcqrcm_qrdata_wifi_password ) : ?>
     307                                                <input type="checkbox" name="rwcqrcm[qrdata][wifi][password_clear]" id="rwcqrcm_qrdata_wifi_password_clear" value="on">
     308                                                <label for="rwcqrcm_qrdata_wifi_password_clear"><?php esc_html_e( 'Delete the saved password', 'qr-code-management' ); ?></label>
     309                                        <?php endif; ?>
     310                                </td>
     311                        </tr>
     312                        <tr>
     313                                <th><?php esc_html_e( 'Hidden network', 'qr-code-management' ); ?></th>
     314                                <td>
     315                                        <input type="hidden" name="rwcqrcm[qrdata][wifi][hidden]" value="off">
     316                                        <input type="checkbox" name="rwcqrcm[qrdata][wifi][hidden]" id="rwcqrcm_qrdata_wifi_hidden" value="on" <?php checked( 'on' === $rwcqrcm_qrdata_wifi_hidden ); ?>>
     317                                        <label for="rwcqrcm_qrdata_wifi_hidden"><?php esc_html_e( 'The network does not broadcast its SSID', 'qr-code-management' ); ?></label>
     318                                </td>
     319                        </tr>
     320                </table>
     321                <p class="description"><?php esc_html_e( 'The QR code contains the password as it is. Anyone who can see or download the QR code image can connect to the network.', 'qr-code-management' ); ?></p>
     322        </div>
    256323</div>
  • qr-code-management/trunk/vendor/composer/autoload_classmap.php

    r3609180 r3846961  
    77
    88return array(
    9     'Attribute' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
    109    'Composer\\InstalledVersions' => $vendorDir . '/composer/InstalledVersions.php',
    11     'JsonException' => $vendorDir . '/symfony/polyfill-php73/Resources/stubs/JsonException.php',
    12     'Normalizer' => $vendorDir . '/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php',
    13     'PhpToken' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php',
    14     'Stringable' => $vendorDir . '/myclabs/php-enum/stubs/Stringable.php',
    15     'UnhandledMatchError' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php',
    16     'ValueError' => $vendorDir . '/symfony/polyfill-php80/Resources/stubs/ValueError.php',
    1710);
  • qr-code-management/trunk/vendor/composer/autoload_psr4.php

    r3609180 r3846961  
    77
    88return array(
    9     'Zxing\\' => array($vendorDir . '/khanamiryan/qrcode-detector-decoder/lib'),
    10     'Symfony\\Polyfill\\Php80\\' => array($vendorDir . '/symfony/polyfill-php80'),
    11     'Symfony\\Polyfill\\Php73\\' => array($vendorDir . '/symfony/polyfill-php73'),
    12     'Symfony\\Polyfill\\Mbstring\\' => array($vendorDir . '/symfony/polyfill-mbstring'),
    13     'Symfony\\Polyfill\\Intl\\Normalizer\\' => array($vendorDir . '/symfony/polyfill-intl-normalizer'),
    14     'Symfony\\Polyfill\\Intl\\Grapheme\\' => array($vendorDir . '/symfony/polyfill-intl-grapheme'),
    15     'Symfony\\Polyfill\\Ctype\\' => array($vendorDir . '/symfony/polyfill-ctype'),
    16     'Symfony\\Component\\String\\' => array($vendorDir . '/symfony/string'),
    17     'Symfony\\Component\\PropertyInfo\\' => array($vendorDir . '/symfony/property-info'),
    18     'Symfony\\Component\\PropertyAccess\\' => array($vendorDir . '/symfony/property-access'),
    19     'Symfony\\Component\\OptionsResolver\\' => array($vendorDir . '/symfony/options-resolver'),
    20     'MyCLabs\\Enum\\' => array($vendorDir . '/myclabs/php-enum/src'),
    219    'Endroid\\QrCode\\' => array($vendorDir . '/endroid/qr-code/src'),
    2210    'DASPRiD\\Enum\\' => array($vendorDir . '/dasprid/enum/src'),
  • qr-code-management/trunk/vendor/composer/autoload_real.php

    r3609180 r3846961  
    3434        $loader->register(true);
    3535
    36         $filesToLoad = \Composer\Autoload\ComposerStaticInitbbbd9ef4ee6dc9adeb1afd05246f95d0::$files;
    37         $requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
    38             if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
    39                 $GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
    40 
    41                 require $file;
    42             }
    43         }, null, null);
    44         foreach ($filesToLoad as $fileIdentifier => $file) {
    45             $requireFile($fileIdentifier, $file);
    46         }
    47 
    4836        return $loader;
    4937    }
  • qr-code-management/trunk/vendor/composer/autoload_static.php

    r3609180 r3846961  
    77class ComposerStaticInitbbbd9ef4ee6dc9adeb1afd05246f95d0
    88{
    9     public static $files = array (
    10         'a4a119a56e50fbb293281d9a48007e0e' => __DIR__ . '/..' . '/symfony/polyfill-php80/bootstrap.php',
    11         '6e3fae29631ef280660b3cdad06f25a8' => __DIR__ . '/..' . '/symfony/deprecation-contracts/function.php',
    12         '320cde22f66dd4f5d3fd621d3e88b98f' => __DIR__ . '/..' . '/symfony/polyfill-ctype/bootstrap.php',
    13         '8825ede83f2f289127722d4e842cf7e8' => __DIR__ . '/..' . '/symfony/polyfill-intl-grapheme/bootstrap.php',
    14         'e69f7f6ee287b969198c3c9d6777bd38' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/bootstrap.php',
    15         '0e6d7bf4a5811bfa5cf40c5ccd6fae6a' => __DIR__ . '/..' . '/symfony/polyfill-mbstring/bootstrap.php',
    16         'b6b991a57620e2fb6b2f66f03fe9ddc2' => __DIR__ . '/..' . '/symfony/string/Resources/functions.php',
    17         '0d59ee240a4cd96ddbb4ff164fccea4d' => __DIR__ . '/..' . '/symfony/polyfill-php73/bootstrap.php',
    18         'a9ed0d27b5a698798a89181429f162c5' => __DIR__ . '/..' . '/khanamiryan/qrcode-detector-decoder/lib/Common/customFunctions.php',
    19     );
    20 
    219    public static $prefixLengthsPsr4 = array (
    22         'Z' =>
    23         array (
    24             'Zxing\\' => 6,
    25         ),
    26         'S' =>
    27         array (
    28             'Symfony\\Polyfill\\Php80\\' => 23,
    29             'Symfony\\Polyfill\\Php73\\' => 23,
    30             'Symfony\\Polyfill\\Mbstring\\' => 26,
    31             'Symfony\\Polyfill\\Intl\\Normalizer\\' => 33,
    32             'Symfony\\Polyfill\\Intl\\Grapheme\\' => 31,
    33             'Symfony\\Polyfill\\Ctype\\' => 23,
    34             'Symfony\\Component\\String\\' => 25,
    35             'Symfony\\Component\\PropertyInfo\\' => 31,
    36             'Symfony\\Component\\PropertyAccess\\' => 33,
    37             'Symfony\\Component\\OptionsResolver\\' => 34,
    38         ),
    39         'M' =>
    40         array (
    41             'MyCLabs\\Enum\\' => 13,
    42         ),
    4310        'E' =>
    4411        array (
    … …  
    5623
    5724    public static $prefixDirsPsr4 = array (
    58         'Zxing\\' =>
    59         array (
    60             0 => __DIR__ . '/..' . '/khanamiryan/qrcode-detector-decoder/lib',
    61         ),
    62         'Symfony\\Polyfill\\Php80\\' =>
    63         array (
    64             0 => __DIR__ . '/..' . '/symfony/polyfill-php80',
    65         ),
    66         'Symfony\\Polyfill\\Php73\\' =>
    67         array (
    68             0 => __DIR__ . '/..' . '/symfony/polyfill-php73',
    69         ),
    70         'Symfony\\Polyfill\\Mbstring\\' =>
    71         array (
    72             0 => __DIR__ . '/..' . '/symfony/polyfill-mbstring',
    73         ),
    74         'Symfony\\Polyfill\\Intl\\Normalizer\\' =>
    75         array (
    76             0 => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer',
    77         ),
    78         'Symfony\\Polyfill\\Intl\\Grapheme\\' =>
    79         array (
    80             0 => __DIR__ . '/..' . '/symfony/polyfill-intl-grapheme',
    81         ),
    82         'Symfony\\Polyfill\\Ctype\\' =>
    83         array (
    84             0 => __DIR__ . '/..' . '/symfony/polyfill-ctype',
    85         ),
    86         'Symfony\\Component\\String\\' =>
    87         array (
    88             0 => __DIR__ . '/..' . '/symfony/string',
    89         ),
    90         'Symfony\\Component\\PropertyInfo\\' =>
    91         array (
    92             0 => __DIR__ . '/..' . '/symfony/property-info',
    93         ),
    94         'Symfony\\Component\\PropertyAccess\\' =>
    95         array (
    96             0 => __DIR__ . '/..' . '/symfony/property-access',
    97         ),
    98         'Symfony\\Component\\OptionsResolver\\' =>
    99         array (
    100             0 => __DIR__ . '/..' . '/symfony/options-resolver',
    101         ),
    102         'MyCLabs\\Enum\\' =>
    103         array (
    104             0 => __DIR__ . '/..' . '/myclabs/php-enum/src',
    105         ),
    10625        'Endroid\\QrCode\\' =>
    10726        array (
    … …  
    11938
    12039    public static $classMap = array (
    121         'Attribute' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/Attribute.php',
    12240        'Composer\\InstalledVersions' => __DIR__ . '/..' . '/composer/InstalledVersions.php',
    123         'JsonException' => __DIR__ . '/..' . '/symfony/polyfill-php73/Resources/stubs/JsonException.php',
    124         'Normalizer' => __DIR__ . '/..' . '/symfony/polyfill-intl-normalizer/Resources/stubs/Normalizer.php',
    125         'PhpToken' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/PhpToken.php',
    126         'Stringable' => __DIR__ . '/..' . '/myclabs/php-enum/stubs/Stringable.php',
    127         'UnhandledMatchError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/UnhandledMatchError.php',
    128         'ValueError' => __DIR__ . '/..' . '/symfony/polyfill-php80/Resources/stubs/ValueError.php',
    12941    );
    13042
  • qr-code-management/trunk/vendor/composer/installed.json

    r3743259 r3846961  
    113113        {
    114114            "name": "endroid/qr-code",
    115             "version": "3.9.7",
    116             "version_normalized": "3.9.7.0",
     115            "version": "4.6.1",
     116            "version_normalized": "4.6.1.0",
    117117            "source": {
    118118                "type": "git",
    119119                "url": "https://github.com/endroid/qr-code.git",
    120                 "reference": "94563d7b3105288e6ac53a67ae720e3669fac1f6"
     120                "reference": "a75c913b0e4d6ad275e49a2c1de1cacffc6c2184"
    121121            },
    122122            "dist": {
    123123                "type": "zip",
    124                 "url": "https://api.github.com/repos/endroid/qr-code/zipball/94563d7b3105288e6ac53a67ae720e3669fac1f6",
    125                 "reference": "94563d7b3105288e6ac53a67ae720e3669fac1f6",
     124                "url": "https://api.github.com/repos/endroid/qr-code/zipball/a75c913b0e4d6ad275e49a2c1de1cacffc6c2184",
     125                "reference": "a75c913b0e4d6ad275e49a2c1de1cacffc6c2184",
    126126                "shasum": ""
    127127            },
    128128            "require": {
    129                 "bacon/bacon-qr-code": "^2.0",
    130                 "khanamiryan/qrcode-detector-decoder": "^1.0.5",
    131                 "myclabs/php-enum": "^1.5",
    132                 "php": "^7.3||^8.0",
    133                 "symfony/options-resolver": "^3.4||^4.4||^5.0",
    134                 "symfony/property-access": "^3.4||^4.4||^5.0"
     129                "bacon/bacon-qr-code": "^2.0.5",
     130                "php": "^7.4||^8.0"
    135131            },
    136132            "require-dev": {
    137                 "endroid/quality": "^1.5.2",
    138                 "setasign/fpdf": "^1.8"
     133                "endroid/quality": "dev-master",
     134                "ext-gd": "*",
     135                "khanamiryan/qrcode-detector-decoder": "^1.0.4",
     136                "setasign/fpdf": "^1.8.2"
    139137            },
    140138            "suggest": {
    141                 "ext-gd": "Required for generating PNG images",
    142                 "roave/security-advisories": "Avoids installation of package versions with vulnerabilities",
    143                 "setasign/fpdf": "Required to use the FPDF writer.",
    144                 "symfony/security-checker": "Checks your composer.lock for vulnerabilities"
     139                "ext-gd": "Enables you to write PNG images",
     140                "khanamiryan/qrcode-detector-decoder": "Enables you to use the image validator",
     141                "roave/security-advisories": "Makes sure package versions with known security issues are not installed",
     142                "setasign/fpdf": "Enables you to use the PDF writer"
    145143            },
    146             "time": "2021-04-20T19:10:54+00:00",
     144            "time": "2022-10-26T08:48:17+00:00",
    147145            "type": "library",
    148146            "extra": {
    149147                "branch-alias": {
    150                     "dev-master": "3.x-dev"
     148                    "dev-master": "4.x-dev"
    151149                }
    152150            },
    … …  
    170168            "homepage": "https://github.com/endroid/qr-code",
    171169            "keywords": [
    172                 "bundle",
    173170                "code",
    174171                "endroid",
    … …  
    179176            "support": {
    180177                "issues": "https://github.com/endroid/qr-code/issues",
    181                 "source": "https://github.com/endroid/qr-code/tree/3.9.7"
     178                "source": "https://github.com/endroid/qr-code/tree/4.6.1"
    182179            },
    183180            "funding": [
    … …  
    188185            ],
    189186            "install-path": "../endroid/qr-code"
    190         },
    191         {
    192             "name": "khanamiryan/qrcode-detector-decoder",
    193             "version": "1.0.6",
    194             "version_normalized": "1.0.6.0",
    195             "source": {
    196                 "type": "git",
    197                 "url": "https://github.com/khanamiryan/php-qrcode-detector-decoder.git",
    198                 "reference": "45326fb83a2a375065dbb3a134b5b8a5872da569"
    199             },
    200             "dist": {
    201                 "type": "zip",
    202                 "url": "https://api.github.com/repos/khanamiryan/php-qrcode-detector-decoder/zipball/45326fb83a2a375065dbb3a134b5b8a5872da569",
    203                 "reference": "45326fb83a2a375065dbb3a134b5b8a5872da569",
    204                 "shasum": ""
    205             },
    206             "require": {
    207                 "php": ">=5.6"
    208             },
    209             "require-dev": {
    210                 "phpunit/phpunit": "^5.7 | ^7.5 | ^8.0 | ^9.0",
    211                 "rector/rector": "^0.13.6",
    212                 "symplify/easy-coding-standard": "^11.0"
    213             },
    214             "time": "2022-06-29T09:25:13+00:00",
    215             "type": "library",
    216             "installation-source": "dist",
    217             "autoload": {
    218                 "files": [
    219                     "lib/Common/customFunctions.php"
    220                 ],
    221                 "psr-4": {
    222                     "Zxing\\": "lib/"
    223                 }
    224             },
    225             "notification-url": "https://packagist.org/downloads/",
    226             "license": [
    227                 "MIT",
    228                 "Apache-2.0"
    229             ],
    230             "authors": [
    231                 {
    232                     "name": "Ashot Khanamiryan",
    233                     "email": "a.khanamiryan@gmail.com",
    234                     "homepage": "https://github.com/khanamiryan",
    235                     "role": "Developer"
    236                 }
    237             ],
    238             "description": "QR code decoder / reader",
    239             "homepage": "https://github.com/khanamiryan/php-qrcode-detector-decoder/",
    240             "keywords": [
    241                 "barcode",
    242                 "qr",
    243                 "zxing"
    244             ],
    245             "support": {
    246                 "issues": "https://github.com/khanamiryan/php-qrcode-detector-decoder/issues",
    247                 "source": "https://github.com/khanamiryan/php-qrcode-detector-decoder/tree/1.0.6"
    248             },
    249             "install-path": "../khanamiryan/qrcode-detector-decoder"
    250         },
    251         {
    252             "name": "myclabs/php-enum",
    253             "version": "1.8.5",
    254             "version_normalized": "1.8.5.0",
    255             "source": {
    256                 "type": "git",
    257                 "url": "https://github.com/myclabs/php-enum.git",
    258                 "reference": "e7be26966b7398204a234f8673fdad5ac6277802"
    259             },
    260             "dist": {
    261                 "type": "zip",
    262                 "url": "https://api.github.com/repos/myclabs/php-enum/zipball/e7be26966b7398204a234f8673fdad5ac6277802",
    263                 "reference": "e7be26966b7398204a234f8673fdad5ac6277802",
    264                 "shasum": ""
    265             },
    266             "require": {
    267                 "ext-json": "*",
    268                 "php": "^7.3 || ^8.0"
    269             },
    270             "require-dev": {
    271                 "phpunit/phpunit": "^9.5",
    272                 "squizlabs/php_codesniffer": "1.*",
    273                 "vimeo/psalm": "^4.6.2 || ^5.2"
    274             },
    275             "time": "2025-01-14T11:49:03+00:00",
    276             "type": "library",
    277             "installation-source": "dist",
    278             "autoload": {
    279                 "psr-4": {
    280                     "MyCLabs\\Enum\\": "src/"
    281                 },
    282                 "classmap": [
    283                     "stubs/Stringable.php"
    284                 ]
    285             },
    286             "notification-url": "https://packagist.org/downloads/",
    287             "license": [
    288                 "MIT"
    289             ],
    290             "authors": [
    291                 {
    292                     "name": "PHP Enum contributors",
    293                     "homepage": "https://github.com/myclabs/php-enum/graphs/contributors"
    294                 }
    295             ],
    296             "description": "PHP Enum implementation",
    297             "homepage": "https://github.com/myclabs/php-enum",
    298             "keywords": [
    299                 "enum"
    300             ],
    301             "support": {
    302                 "issues": "https://github.com/myclabs/php-enum/issues",
    303                 "source": "https://github.com/myclabs/php-enum/tree/1.8.5"
    304             },
    305             "funding": [
    306                 {
    307                     "url": "https://github.com/mnapoli",
    308                     "type": "github"
    309                 },
    310                 {
    311                     "url": "https://tidelift.com/funding/github/packagist/myclabs/php-enum",
    312                     "type": "tidelift"
    313                 }
    314             ],
    315             "install-path": "../myclabs/php-enum"
    316         },
    317         {
    318             "name": "symfony/deprecation-contracts",
    319             "version": "v2.5.4",
    320             "version_normalized": "2.5.4.0",
    321             "source": {
    322                 "type": "git",
    323                 "url": "https://github.com/symfony/deprecation-contracts.git",
    324                 "reference": "605389f2a7e5625f273b53960dc46aeaf9c62918"
    325             },
    326             "dist": {
    327                 "type": "zip",
    328                 "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/605389f2a7e5625f273b53960dc46aeaf9c62918",
    329                 "reference": "605389f2a7e5625f273b53960dc46aeaf9c62918",
    330                 "shasum": ""
    331             },
    332             "require": {
    333                 "php": ">=7.1"
    334             },
    335             "time": "2024-09-25T14:11:13+00:00",
    336             "type": "library",
    337             "extra": {
    338                 "thanks": {
    339                     "url": "https://github.com/symfony/contracts",
    340                     "name": "symfony/contracts"
    341                 },
    342                 "branch-alias": {
    343                     "dev-main": "2.5-dev"
    344                 }
    345             },
    346             "installation-source": "dist",
    347             "autoload": {
    348                 "files": [
    349                     "function.php"
    350                 ]
    351             },
    352             "notification-url": "https://packagist.org/downloads/",
    353             "license": [
    354                 "MIT"
    355             ],
    356             "authors": [
    357                 {
    358                     "name": "Nicolas Grekas",
    359                     "email": "p@tchwork.com"
    360                 },
    361                 {
    362                     "name": "Symfony Community",
    363                     "homepage": "https://symfony.com/contributors"
    364                 }
    365             ],
    366             "description": "A generic function and convention to trigger deprecation notices",
    367             "homepage": "https://symfony.com",
    368             "support": {
    369                 "source": "https://github.com/symfony/deprecation-contracts/tree/v2.5.4"
    370             },
    371             "funding": [
    372                 {
    373                     "url": "https://symfony.com/sponsor",
    374                     "type": "custom"
    375                 },
    376                 {
    377                     "url": "https://github.com/fabpot",
    378                     "type": "github"
    379                 },
    380                 {
    381                     "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
    382                     "type": "tidelift"
    383                 }
    384             ],
    385             "install-path": "../symfony/deprecation-contracts"
    386         },
    387         {
    388             "name": "symfony/options-resolver",
    389             "version": "v5.4.45",
    390             "version_normalized": "5.4.45.0",
    391             "source": {
    392                 "type": "git",
    393                 "url": "https://github.com/symfony/options-resolver.git",
    394                 "reference": "74e5b6f0db3e8589e6cfd5efb317a1fc2bb52fb6"
    395             },
    396             "dist": {
    397                 "type": "zip",
    398                 "url": "https://api.github.com/repos/symfony/options-resolver/zipball/74e5b6f0db3e8589e6cfd5efb317a1fc2bb52fb6",
    399                 "reference": "74e5b6f0db3e8589e6cfd5efb317a1fc2bb52fb6",
    400                 "shasum": ""
    401             },
    402             "require": {
    403                 "php": ">=7.2.5",
    404                 "symfony/deprecation-contracts": "^2.1|^3",
    405                 "symfony/polyfill-php73": "~1.0",
    406                 "symfony/polyfill-php80": "^1.16"
    407             },
    408             "time": "2024-09-25T14:11:13+00:00",
    409             "type": "library",
    410             "installation-source": "dist",
    411             "autoload": {
    412                 "psr-4": {
    413                     "Symfony\\Component\\OptionsResolver\\": ""
    414                 },
    415                 "exclude-from-classmap": [
    416                     "/Tests/"
    417                 ]
    418             },
    419             "notification-url": "https://packagist.org/downloads/",
    420             "license": [
    421                 "MIT"
    422             ],
    423             "authors": [
    424                 {
    425                     "name": "Fabien Potencier",
    426                     "email": "fabien@symfony.com"
    427                 },
    428                 {
    429                     "name": "Symfony Community",
    430                     "homepage": "https://symfony.com/contributors"
    431                 }
    432             ],
    433             "description": "Provides an improved replacement for the array_replace PHP function",
    434             "homepage": "https://symfony.com",
    435             "keywords": [
    436                 "config",
    437                 "configuration",
    438                 "options"
    439             ],
    440             "support": {
    441                 "source": "https://github.com/symfony/options-resolver/tree/v5.4.45"
    442             },
    443             "funding": [
    444                 {
    445                     "url": "https://symfony.com/sponsor",
    446                     "type": "custom"
    447                 },
    448                 {
    449                     "url": "https://github.com/fabpot",
    450                     "type": "github"
    451                 },
    452                 {
    453                     "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
    454                     "type": "tidelift"
    455                 }
    456             ],
    457             "install-path": "../symfony/options-resolver"
    458         },
    459         {
    460             "name": "symfony/polyfill-ctype",
    461             "version": "v1.37.0",
    462             "version_normalized": "1.37.0.0",
    463             "source": {
    464                 "type": "git",
    465                 "url": "https://github.com/symfony/polyfill-ctype.git",
    466                 "reference": "141046a8f9477948ff284fa65be2095baafb94f2"
    467             },
    468             "dist": {
    469                 "type": "zip",
    470                 "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/141046a8f9477948ff284fa65be2095baafb94f2",
    471                 "reference": "141046a8f9477948ff284fa65be2095baafb94f2",
    472                 "shasum": ""
    473             },
    474             "require": {
    475                 "php": ">=7.2"
    476             },
    477             "provide": {
    478                 "ext-ctype": "*"
    479             },
    480             "suggest": {
    481                 "ext-ctype": "For best performance"
    482             },
    483             "time": "2026-04-10T16:19:22+00:00",
    484             "type": "library",
    485             "extra": {
    486                 "thanks": {
    487                     "url": "https://github.com/symfony/polyfill",
    488                     "name": "symfony/polyfill"
    489                 }
    490             },
    491             "installation-source": "dist",
    492             "autoload": {
    493                 "files": [
    494                     "bootstrap.php"
    495                 ],
    496                 "psr-4": {
    497                     "Symfony\\Polyfill\\Ctype\\": ""
    498                 }
    499             },
    500             "notification-url": "https://packagist.org/downloads/",
    501             "license": [
    502                 "MIT"
    503             ],
    504             "authors": [
    505                 {
    506                     "name": "Gert de Pagter",
    507                     "email": "BackEndTea@gmail.com"
    508                 },
    509                 {
    510                     "name": "Symfony Community",
    511                     "homepage": "https://symfony.com/contributors"
    512                 }
    513             ],
    514             "description": "Symfony polyfill for ctype functions",
    515             "homepage": "https://symfony.com",
    516             "keywords": [
    517                 "compatibility",
    518                 "ctype",
    519                 "polyfill",
    520                 "portable"
    521             ],
    522             "support": {
    523                 "source": "https://github.com/symfony/polyfill-ctype/tree/v1.37.0"
    524             },
    525             "funding": [
    526                 {
    527                     "url": "https://symfony.com/sponsor",
    528                     "type": "custom"
    529                 },
    530                 {
    531                     "url": "https://github.com/fabpot",
    532                     "type": "github"
    533                 },
    534                 {
    535                     "url": "https://github.com/nicolas-grekas",
    536                     "type": "github"
    537                 },
    538                 {
    539                     "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
    540                     "type": "tidelift"
    541                 }
    542             ],
    543             "install-path": "../symfony/polyfill-ctype"
    544         },
    545         {
    546             "name": "symfony/polyfill-intl-grapheme",
    547             "version": "v1.38.1",
    548             "version_normalized": "1.38.1.0",
    549             "source": {
    550                 "type": "git",
    551                 "url": "https://github.com/symfony/polyfill-intl-grapheme.git",
    552                 "reference": "e9247d281d694a5120554d9afaf54e070e88a603"
    553             },
    554             "dist": {
    555                 "type": "zip",
    556                 "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/e9247d281d694a5120554d9afaf54e070e88a603",
    557                 "reference": "e9247d281d694a5120554d9afaf54e070e88a603",
    558                 "shasum": ""
    559             },
    560             "require": {
    561                 "php": ">=7.2"
    562             },
    563             "suggest": {
    564                 "ext-intl": "For best performance"
    565             },
    566             "time": "2026-05-26T05:58:03+00:00",
    567             "type": "library",
    568             "extra": {
    569                 "thanks": {
    570                     "url": "https://github.com/symfony/polyfill",
    571                     "name": "symfony/polyfill"
    572                 }
    573             },
    574             "installation-source": "dist",
    575             "autoload": {
    576                 "files": [
    577                     "bootstrap.php"
    578                 ],
    579                 "psr-4": {
    580                     "Symfony\\Polyfill\\Intl\\Grapheme\\": ""
    581                 }
    582             },
    583             "notification-url": "https://packagist.org/downloads/",
    584             "license": [
    585                 "MIT"
    586             ],
    587             "authors": [
    588                 {
    589                     "name": "Nicolas Grekas",
    590                     "email": "p@tchwork.com"
    591                 },
    592                 {
    593                     "name": "Symfony Community",
    594                     "homepage": "https://symfony.com/contributors"
    595                 }
    596             ],
    597             "description": "Symfony polyfill for intl's grapheme_* functions",
    598             "homepage": "https://symfony.com",
    599             "keywords": [
    600                 "compatibility",
    601                 "grapheme",
    602                 "intl",
    603                 "polyfill",
    604                 "portable",
    605                 "shim"
    606             ],
    607             "support": {
    608                 "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.38.1"
    609             },
    610             "funding": [
    611                 {
    612                     "url": "https://symfony.com/sponsor",
    613                     "type": "custom"
    614                 },
    615                 {
    616                     "url": "https://github.com/fabpot",
    617                     "type": "github"
    618                 },
    619                 {
    620                     "url": "https://github.com/nicolas-grekas",
    621                     "type": "github"
    622                 },
    623                 {
    624                     "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
    625                     "type": "tidelift"
    626                 }
    627             ],
    628             "install-path": "../symfony/polyfill-intl-grapheme"
    629         },
    630         {
    631             "name": "symfony/polyfill-intl-normalizer",
    632             "version": "v1.38.0",
    633             "version_normalized": "1.38.0.0",
    634             "source": {
    635                 "type": "git",
    636                 "url": "https://github.com/symfony/polyfill-intl-normalizer.git",
    637                 "reference": "2d446c214bdbe5b71bde5011b060a05fece3ae6b"
    638             },
    639             "dist": {
    640                 "type": "zip",
    641                 "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/2d446c214bdbe5b71bde5011b060a05fece3ae6b",
    642                 "reference": "2d446c214bdbe5b71bde5011b060a05fece3ae6b",
    643                 "shasum": ""
    644             },
    645             "require": {
    646                 "php": ">=7.2"
    647             },
    648             "suggest": {
    649                 "ext-intl": "For best performance"
    650             },
    651             "time": "2026-05-25T13:48:31+00:00",
    652             "type": "library",
    653             "extra": {
    654                 "thanks": {
    655                     "url": "https://github.com/symfony/polyfill",
    656                     "name": "symfony/polyfill"
    657                 }
    658             },
    659             "installation-source": "dist",
    660             "autoload": {
    661                 "files": [
    662                     "bootstrap.php"
    663                 ],
    664                 "psr-4": {
    665                     "Symfony\\Polyfill\\Intl\\Normalizer\\": ""
    666                 },
    667                 "classmap": [
    668                     "Resources/stubs"
    669                 ]
    670             },
    671             "notification-url": "https://packagist.org/downloads/",
    672             "license": [
    673                 "MIT"
    674             ],
    675             "authors": [
    676                 {
    677                     "name": "Nicolas Grekas",
    678                     "email": "p@tchwork.com"
    679                 },
    680                 {
    681                     "name": "Symfony Community",
    682                     "homepage": "https://symfony.com/contributors"
    683                 }
    684             ],
    685             "description": "Symfony polyfill for intl's Normalizer class and related functions",
    686             "homepage": "https://symfony.com",
    687             "keywords": [
    688                 "compatibility",
    689                 "intl",
    690                 "normalizer",
    691                 "polyfill",
    692                 "portable",
    693                 "shim"
    694             ],
    695             "support": {
    696                 "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.38.0"
    697             },
    698             "funding": [
    699                 {
    700                     "url": "https://symfony.com/sponsor",
    701                     "type": "custom"
    702                 },
    703                 {
    704                     "url": "https://github.com/fabpot",
    705                     "type": "github"
    706                 },
    707                 {
    708                     "url": "https://github.com/nicolas-grekas",
    709                     "type": "github"
    710                 },
    711                 {
    712                     "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
    713                     "type": "tidelift"
    714                 }
    715             ],
    716             "install-path": "../symfony/polyfill-intl-normalizer"
    717         },
    718         {
    719             "name": "symfony/polyfill-mbstring",
    720             "version": "v1.38.2",
    721             "version_normalized": "1.38.2.0",
    722             "source": {
    723                 "type": "git",
    724                 "url": "https://github.com/symfony/polyfill-mbstring.git",
    725                 "reference": "d3d318bad5e7a1bfbd026009c8bfb8d8f99ae6b6"
    726             },
    727             "dist": {
    728                 "type": "zip",
    729                 "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/d3d318bad5e7a1bfbd026009c8bfb8d8f99ae6b6",
    730                 "reference": "d3d318bad5e7a1bfbd026009c8bfb8d8f99ae6b6",
    731                 "shasum": ""
    732             },
    733             "require": {
    734                 "ext-iconv": "*",
    735                 "php": ">=7.2"
    736             },
    737             "provide": {
    738                 "ext-mbstring": "*"
    739             },
    740             "suggest": {
    741                 "ext-mbstring": "For best performance"
    742             },
    743             "time": "2026-05-27T06:59:30+00:00",
    744             "type": "library",
    745             "extra": {
    746                 "thanks": {
    747                     "url": "https://github.com/symfony/polyfill",
    748                     "name": "symfony/polyfill"
    749                 }
    750             },
    751             "installation-source": "dist",
    752             "autoload": {
    753                 "files": [
    754                     "bootstrap.php"
    755                 ],
    756                 "psr-4": {
    757                     "Symfony\\Polyfill\\Mbstring\\": ""
    758                 }
    759             },
    760             "notification-url": "https://packagist.org/downloads/",
    761             "license": [
    762                 "MIT"
    763             ],
    764             "authors": [
    765                 {
    766                     "name": "Nicolas Grekas",
    767                     "email": "p@tchwork.com"
    768                 },
    769                 {
    770                     "name": "Symfony Community",
    771                     "homepage": "https://symfony.com/contributors"
    772                 }
    773             ],
    774             "description": "Symfony polyfill for the Mbstring extension",
    775             "homepage": "https://symfony.com",
    776             "keywords": [
    777                 "compatibility",
    778                 "mbstring",
    779                 "polyfill",
    780                 "portable",
    781                 "shim"
    782             ],
    783             "support": {
    784                 "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.38.2"
    785             },
    786             "funding": [
    787                 {
    788                     "url": "https://symfony.com/sponsor",
    789                     "type": "custom"
    790                 },
    791                 {
    792                     "url": "https://github.com/fabpot",
    793                     "type": "github"
    794                 },
    795                 {
    796                     "url": "https://github.com/nicolas-grekas",
    797                     "type": "github"
    798                 },
    799                 {
    800                     "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
    801                     "type": "tidelift"
    802                 }
    803             ],
    804             "install-path": "../symfony/polyfill-mbstring"
    805         },
    806         {
    807             "name": "symfony/polyfill-php73",
    808             "version": "v1.37.0",
    809             "version_normalized": "1.37.0.0",
    810             "source": {
    811                 "type": "git",
    812                 "url": "https://github.com/symfony/polyfill-php73.git",
    813                 "reference": "0f68c03565dcaaf25a890667542e8bd75fe7e5bb"
    814             },
    815             "dist": {
    816                 "type": "zip",
    817                 "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/0f68c03565dcaaf25a890667542e8bd75fe7e5bb",
    818                 "reference": "0f68c03565dcaaf25a890667542e8bd75fe7e5bb",
    819                 "shasum": ""
    820             },
    821             "require": {
    822                 "php": ">=7.2"
    823             },
    824             "time": "2024-09-09T11:45:10+00:00",
    825             "type": "library",
    826             "extra": {
    827                 "thanks": {
    828                     "url": "https://github.com/symfony/polyfill",
    829                     "name": "symfony/polyfill"
    830                 }
    831             },
    832             "installation-source": "dist",
    833             "autoload": {
    834                 "files": [
    835                     "bootstrap.php"
    836                 ],
    837                 "psr-4": {
    838                     "Symfony\\Polyfill\\Php73\\": ""
    839                 },
    840                 "classmap": [
    841                     "Resources/stubs"
    842                 ]
    843             },
    844             "notification-url": "https://packagist.org/downloads/",
    845             "license": [
    846                 "MIT"
    847             ],
    848             "authors": [
    849                 {
    850                     "name": "Nicolas Grekas",
    851                     "email": "p@tchwork.com"
    852                 },
    853                 {
    854                     "name": "Symfony Community",
    855                     "homepage": "https://symfony.com/contributors"
    856                 }
    857             ],
    858             "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions",
    859             "homepage": "https://symfony.com",
    860             "keywords": [
    861                 "compatibility",
    862                 "polyfill",
    863                 "portable",
    864                 "shim"
    865             ],
    866             "support": {
    867                 "source": "https://github.com/symfony/polyfill-php73/tree/v1.37.0"
    868             },
    869             "funding": [
    870                 {
    871                     "url": "https://symfony.com/sponsor",
    872                     "type": "custom"
    873                 },
    874                 {
    875                     "url": "https://github.com/fabpot",
    876                     "type": "github"
    877                 },
    878                 {
    879                     "url": "https://github.com/nicolas-grekas",
    880                     "type": "github"
    881                 },
    882                 {
    883                     "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
    884                     "type": "tidelift"
    885                 }
    886             ],
    887             "install-path": "../symfony/polyfill-php73"
    888         },
    889         {
    890             "name": "symfony/polyfill-php80",
    891             "version": "v1.37.0",
    892             "version_normalized": "1.37.0.0",
    893             "source": {
    894                 "type": "git",
    895                 "url": "https://github.com/symfony/polyfill-php80.git",
    896                 "reference": "dfb55726c3a76ea3b6459fcfda1ec2d80a682411"
    897             },
    898             "dist": {
    899                 "type": "zip",
    900                 "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/dfb55726c3a76ea3b6459fcfda1ec2d80a682411",
    901                 "reference": "dfb55726c3a76ea3b6459fcfda1ec2d80a682411",
    902                 "shasum": ""
    903             },
    904             "require": {
    905                 "php": ">=7.2"
    906             },
    907             "time": "2026-04-10T16:19:22+00:00",
    908             "type": "library",
    909             "extra": {
    910                 "thanks": {
    911                     "url": "https://github.com/symfony/polyfill",
    912                     "name": "symfony/polyfill"
    913                 }
    914             },
    915             "installation-source": "dist",
    916             "autoload": {
    917                 "files": [
    918                     "bootstrap.php"
    919                 ],
    920                 "psr-4": {
    921                     "Symfony\\Polyfill\\Php80\\": ""
    922                 },
    923                 "classmap": [
    924                     "Resources/stubs"
    925                 ]
    926             },
    927             "notification-url": "https://packagist.org/downloads/",
    928             "license": [
    929                 "MIT"
    930             ],
    931             "authors": [
    932                 {
    933                     "name": "Ion Bazan",
    934                     "email": "ion.bazan@gmail.com"
    935                 },
    936                 {
    937                     "name": "Nicolas Grekas",
    938                     "email": "p@tchwork.com"
    939                 },
    940                 {
    941                     "name": "Symfony Community",
    942                     "homepage": "https://symfony.com/contributors"
    943                 }
    944             ],
    945             "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions",
    946             "homepage": "https://symfony.com",
    947             "keywords": [
    948                 "compatibility",
    949                 "polyfill",
    950                 "portable",
    951                 "shim"
    952             ],
    953             "support": {
    954                 "source": "https://github.com/symfony/polyfill-php80/tree/v1.37.0"
    955             },
    956             "funding": [
    957                 {
    958                     "url": "https://symfony.com/sponsor",
    959                     "type": "custom"
    960                 },
    961                 {
    962                     "url": "https://github.com/fabpot",
    963                     "type": "github"
    964                 },
    965                 {
    966                     "url": "https://github.com/nicolas-grekas",
    967                     "type": "github"
    968                 },
    969                 {
    970                     "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
    971                     "type": "tidelift"
    972                 }
    973             ],
    974             "install-path": "../symfony/polyfill-php80"
    975         },
    976         {
    977             "name": "symfony/property-access",
    978             "version": "v5.4.45",
    979             "version_normalized": "5.4.45.0",
    980             "source": {
    981                 "type": "git",
    982                 "url": "https://github.com/symfony/property-access.git",
    983                 "reference": "111e7ed617509f1a9139686055d234aad6e388e0"
    984             },
    985             "dist": {
    986                 "type": "zip",
    987                 "url": "https://api.github.com/repos/symfony/property-access/zipball/111e7ed617509f1a9139686055d234aad6e388e0",
    988                 "reference": "111e7ed617509f1a9139686055d234aad6e388e0",
    989                 "shasum": ""
    990             },
    991             "require": {
    992                 "php": ">=7.2.5",
    993                 "symfony/deprecation-contracts": "^2.1|^3",
    994                 "symfony/polyfill-php80": "^1.16",
    995                 "symfony/property-info": "^5.2|^6.0"
    996             },
    997             "require-dev": {
    998                 "symfony/cache": "^4.4|^5.0|^6.0"
    999             },
    1000             "suggest": {
    1001                 "psr/cache-implementation": "To cache access methods."
    1002             },
    1003             "time": "2024-09-25T14:11:13+00:00",
    1004             "type": "library",
    1005             "installation-source": "dist",
    1006             "autoload": {
    1007                 "psr-4": {
    1008                     "Symfony\\Component\\PropertyAccess\\": ""
    1009                 },
    1010                 "exclude-from-classmap": [
    1011                     "/Tests/"
    1012                 ]
    1013             },
    1014             "notification-url": "https://packagist.org/downloads/",
    1015             "license": [
    1016                 "MIT"
    1017             ],
    1018             "authors": [
    1019                 {
    1020                     "name": "Fabien Potencier",
    1021                     "email": "fabien@symfony.com"
    1022                 },
    1023                 {
    1024                     "name": "Symfony Community",
    1025                     "homepage": "https://symfony.com/contributors"
    1026                 }
    1027             ],
    1028             "description": "Provides functions to read and write from/to an object or array using a simple string notation",
    1029             "homepage": "https://symfony.com",
    1030             "keywords": [
    1031                 "access",
    1032                 "array",
    1033                 "extraction",
    1034                 "index",
    1035                 "injection",
    1036                 "object",
    1037                 "property",
    1038                 "property-path",
    1039                 "reflection"
    1040             ],
    1041             "support": {
    1042                 "source": "https://github.com/symfony/property-access/tree/v5.4.45"
    1043             },
    1044             "funding": [
    1045                 {
    1046                     "url": "https://symfony.com/sponsor",
    1047                     "type": "custom"
    1048                 },
    1049                 {
    1050                     "url": "https://github.com/fabpot",
    1051                     "type": "github"
    1052                 },
    1053                 {
    1054                     "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
    1055                     "type": "tidelift"
    1056                 }
    1057             ],
    1058             "install-path": "../symfony/property-access"
    1059         },
    1060         {
    1061             "name": "symfony/property-info",
    1062             "version": "v5.4.48",
    1063             "version_normalized": "5.4.48.0",
    1064             "source": {
    1065                 "type": "git",
    1066                 "url": "https://github.com/symfony/property-info.git",
    1067                 "reference": "a0396295ad585f95fccd690bc6a281e5bd303902"
    1068             },
    1069             "dist": {
    1070                 "type": "zip",
    1071                 "url": "https://api.github.com/repos/symfony/property-info/zipball/a0396295ad585f95fccd690bc6a281e5bd303902",
    1072                 "reference": "a0396295ad585f95fccd690bc6a281e5bd303902",
    1073                 "shasum": ""
    1074             },
    1075             "require": {
    1076                 "php": ">=7.2.5",
    1077                 "symfony/deprecation-contracts": "^2.1|^3",
    1078                 "symfony/polyfill-php80": "^1.16",
    1079                 "symfony/string": "^5.1|^6.0"
    1080             },
    1081             "conflict": {
    1082                 "phpdocumentor/reflection-docblock": "<3.2.2",
    1083                 "phpdocumentor/type-resolver": "<1.4.0",
    1084                 "symfony/dependency-injection": "<4.4"
    1085             },
    1086             "require-dev": {
    1087                 "doctrine/annotations": "^1.10.4|^2",
    1088                 "phpdocumentor/reflection-docblock": "^3.0|^4.0|^5.0",
    1089                 "phpstan/phpdoc-parser": "^1.0|^2.0",
    1090                 "symfony/cache": "^4.4|^5.0|^6.0",
    1091                 "symfony/dependency-injection": "^4.4|^5.0|^6.0",
    1092                 "symfony/serializer": "^4.4|^5.0|^6.0"
    1093             },
    1094             "suggest": {
    1095                 "phpdocumentor/reflection-docblock": "To use the PHPDoc",
    1096                 "psr/cache-implementation": "To cache results",
    1097                 "symfony/doctrine-bridge": "To use Doctrine metadata",
    1098                 "symfony/serializer": "To use Serializer metadata"
    1099             },
    1100             "time": "2024-11-25T16:14:41+00:00",
    1101             "type": "library",
    1102             "installation-source": "dist",
    1103             "autoload": {
    1104                 "psr-4": {
    1105                     "Symfony\\Component\\PropertyInfo\\": ""
    1106                 },
    1107                 "exclude-from-classmap": [
    1108                     "/Tests/"
    1109                 ]
    1110             },
    1111             "notification-url": "https://packagist.org/downloads/",
    1112             "license": [
    1113                 "MIT"
    1114             ],
    1115             "authors": [
    1116                 {
    1117                     "name": "Kévin Dunglas",
    1118                     "email": "dunglas@gmail.com"
    1119                 },
    1120                 {
    1121                     "name": "Symfony Community",
    1122                     "homepage": "https://symfony.com/contributors"
    1123                 }
    1124             ],
    1125             "description": "Extracts information about PHP class' properties using metadata of popular sources",
    1126             "homepage": "https://symfony.com",
    1127             "keywords": [
    1128                 "doctrine",
    1129                 "phpdoc",
    1130                 "property",
    1131                 "symfony",
    1132                 "type",
    1133                 "validator"
    1134             ],
    1135             "support": {
    1136                 "source": "https://github.com/symfony/property-info/tree/v5.4.48"
    1137             },
    1138             "funding": [
    1139                 {
    1140                     "url": "https://symfony.com/sponsor",
    1141                     "type": "custom"
    1142                 },
    1143                 {
    1144                     "url": "https://github.com/fabpot",
    1145                     "type": "github"
    1146                 },
    1147                 {
    1148                     "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
    1149                     "type": "tidelift"
    1150                 }
    1151             ],
    1152             "install-path": "../symfony/property-info"
    1153         },
    1154         {
    1155             "name": "symfony/string",
    1156             "version": "v5.4.47",
    1157             "version_normalized": "5.4.47.0",
    1158             "source": {
    1159                 "type": "git",
    1160                 "url": "https://github.com/symfony/string.git",
    1161                 "reference": "136ca7d72f72b599f2631aca474a4f8e26719799"
    1162             },
    1163             "dist": {
    1164                 "type": "zip",
    1165                 "url": "https://api.github.com/repos/symfony/string/zipball/136ca7d72f72b599f2631aca474a4f8e26719799",
    1166                 "reference": "136ca7d72f72b599f2631aca474a4f8e26719799",
    1167                 "shasum": ""
    1168             },
    1169             "require": {
    1170                 "php": ">=7.2.5",
    1171                 "symfony/polyfill-ctype": "~1.8",
    1172                 "symfony/polyfill-intl-grapheme": "~1.0",
    1173                 "symfony/polyfill-intl-normalizer": "~1.0",
    1174                 "symfony/polyfill-mbstring": "~1.0",
    1175                 "symfony/polyfill-php80": "~1.15"
    1176             },
    1177             "conflict": {
    1178                 "symfony/translation-contracts": ">=3.0"
    1179             },
    1180             "require-dev": {
    1181                 "symfony/error-handler": "^4.4|^5.0|^6.0",
    1182                 "symfony/http-client": "^4.4|^5.0|^6.0",
    1183                 "symfony/translation-contracts": "^1.1|^2",
    1184                 "symfony/var-exporter": "^4.4|^5.0|^6.0"
    1185             },
    1186             "time": "2024-11-10T20:33:58+00:00",
    1187             "type": "library",
    1188             "installation-source": "dist",
    1189             "autoload": {
    1190                 "files": [
    1191                     "Resources/functions.php"
    1192                 ],
    1193                 "psr-4": {
    1194                     "Symfony\\Component\\String\\": ""
    1195                 },
    1196                 "exclude-from-classmap": [
    1197                     "/Tests/"
    1198                 ]
    1199             },
    1200             "notification-url": "https://packagist.org/downloads/",
    1201             "license": [
    1202                 "MIT"
    1203             ],
    1204             "authors": [
    1205                 {
    1206                     "name": "Nicolas Grekas",
    1207                     "email": "p@tchwork.com"
    1208                 },
    1209                 {
    1210                     "name": "Symfony Community",
    1211                     "homepage": "https://symfony.com/contributors"
    1212                 }
    1213             ],
    1214             "description": "Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way",
    1215             "homepage": "https://symfony.com",
    1216             "keywords": [
    1217                 "grapheme",
    1218                 "i18n",
    1219                 "string",
    1220                 "unicode",
    1221                 "utf-8",
    1222                 "utf8"
    1223             ],
    1224             "support": {
    1225                 "source": "https://github.com/symfony/string/tree/v5.4.47"
    1226             },
    1227             "funding": [
    1228                 {
    1229                     "url": "https://symfony.com/sponsor",
    1230                     "type": "custom"
    1231                 },
    1232                 {
    1233                     "url": "https://github.com/fabpot",
    1234                     "type": "github"
    1235                 },
    1236                 {
    1237                     "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
    1238                     "type": "tidelift"
    1239                 }
    1240             ],
    1241             "install-path": "../symfony/string"
    1242187        }
    1243188    ],
    1244     "dev": false,
     189    "dev": true,
    1245190    "dev-package-names": []
    1246191}
  • qr-code-management/trunk/vendor/composer/installed.php

    r3743259 r3846961  
    44        'pretty_version' => 'dev-master',
    55        'version' => 'dev-master',
    6         'reference' => 'e32024923a2ebfad3c156b0951c8c4d78b4eb885',
     6        'reference' => '76580b88ec31e6b5f9ce8ba81d36ed985c7ce60f',
    77        'type' => 'library',
    88        'install_path' => __DIR__ . '/../../../../../../plugin-deps',
    99        'aliases' => array(),
    10         'dev' => false,
     10        'dev' => true,
    1111    ),
    1212    'versions' => array(
    … …  
    3030        ),
    3131        'endroid/qr-code' => array(
    32             'pretty_version' => '3.9.7',
    33             'version' => '3.9.7.0',
    34             'reference' => '94563d7b3105288e6ac53a67ae720e3669fac1f6',
     32            'pretty_version' => '4.6.1',
     33            'version' => '4.6.1.0',
     34            'reference' => 'a75c913b0e4d6ad275e49a2c1de1cacffc6c2184',
    3535            'type' => 'library',
    3636            'install_path' => __DIR__ . '/../endroid/qr-code',
    37             'aliases' => array(),
    38             'dev_requirement' => false,
    39         ),
    40         'khanamiryan/qrcode-detector-decoder' => array(
    41             'pretty_version' => '1.0.6',
    42             'version' => '1.0.6.0',
    43             'reference' => '45326fb83a2a375065dbb3a134b5b8a5872da569',
    44             'type' => 'library',
    45             'install_path' => __DIR__ . '/../khanamiryan/qrcode-detector-decoder',
    46             'aliases' => array(),
    47             'dev_requirement' => false,
    48         ),
    49         'myclabs/php-enum' => array(
    50             'pretty_version' => '1.8.5',
    51             'version' => '1.8.5.0',
    52             'reference' => 'e7be26966b7398204a234f8673fdad5ac6277802',
    53             'type' => 'library',
    54             'install_path' => __DIR__ . '/../myclabs/php-enum',
    5537            'aliases' => array(),
    5638            'dev_requirement' => false,
    … …  
    5941            'pretty_version' => 'dev-master',
    6042            'version' => 'dev-master',
    61             'reference' => 'e32024923a2ebfad3c156b0951c8c4d78b4eb885',
     43            'reference' => '76580b88ec31e6b5f9ce8ba81d36ed985c7ce60f',
    6244            'type' => 'library',
    6345            'install_path' => __DIR__ . '/../../../../../../plugin-deps',
    … …  
    6547            'dev_requirement' => false,
    6648        ),
    67         'symfony/deprecation-contracts' => array(
    68             'pretty_version' => 'v2.5.4',
    69             'version' => '2.5.4.0',
    70             'reference' => '605389f2a7e5625f273b53960dc46aeaf9c62918',
    71             'type' => 'library',
    72             'install_path' => __DIR__ . '/../symfony/deprecation-contracts',
    73             'aliases' => array(),
    74             'dev_requirement' => false,
    75         ),
    76         'symfony/options-resolver' => array(
    77             'pretty_version' => 'v5.4.45',
    78             'version' => '5.4.45.0',
    79             'reference' => '74e5b6f0db3e8589e6cfd5efb317a1fc2bb52fb6',
    80             'type' => 'library',
    81             'install_path' => __DIR__ . '/../symfony/options-resolver',
    82             'aliases' => array(),
    83             'dev_requirement' => false,
    84         ),
    85         'symfony/polyfill-ctype' => array(
    86             'pretty_version' => 'v1.37.0',
    87             'version' => '1.37.0.0',
    88             'reference' => '141046a8f9477948ff284fa65be2095baafb94f2',
    89             'type' => 'library',
    90             'install_path' => __DIR__ . '/../symfony/polyfill-ctype',
    91             'aliases' => array(),
    92             'dev_requirement' => false,
    93         ),
    94         'symfony/polyfill-intl-grapheme' => array(
    95             'pretty_version' => 'v1.38.1',
    96             'version' => '1.38.1.0',
    97             'reference' => 'e9247d281d694a5120554d9afaf54e070e88a603',
    98             'type' => 'library',
    99             'install_path' => __DIR__ . '/../symfony/polyfill-intl-grapheme',
    100             'aliases' => array(),
    101             'dev_requirement' => false,
    102         ),
    103         'symfony/polyfill-intl-normalizer' => array(
    104             'pretty_version' => 'v1.38.0',
    105             'version' => '1.38.0.0',
    106             'reference' => '2d446c214bdbe5b71bde5011b060a05fece3ae6b',
    107             'type' => 'library',
    108             'install_path' => __DIR__ . '/../symfony/polyfill-intl-normalizer',
    109             'aliases' => array(),
    110             'dev_requirement' => false,
    111         ),
    112         'symfony/polyfill-mbstring' => array(
    113             'pretty_version' => 'v1.38.2',
    114             'version' => '1.38.2.0',
    115             'reference' => 'd3d318bad5e7a1bfbd026009c8bfb8d8f99ae6b6',
    116             'type' => 'library',
    117             'install_path' => __DIR__ . '/../symfony/polyfill-mbstring',
    118             'aliases' => array(),
    119             'dev_requirement' => false,
    120         ),
    121         'symfony/polyfill-php73' => array(
    122             'pretty_version' => 'v1.37.0',
    123             'version' => '1.37.0.0',
    124             'reference' => '0f68c03565dcaaf25a890667542e8bd75fe7e5bb',
    125             'type' => 'library',
    126             'install_path' => __DIR__ . '/../symfony/polyfill-php73',
    127             'aliases' => array(),
    128             'dev_requirement' => false,
    129         ),
    130         'symfony/polyfill-php80' => array(
    131             'pretty_version' => 'v1.37.0',
    132             'version' => '1.37.0.0',
    133             'reference' => 'dfb55726c3a76ea3b6459fcfda1ec2d80a682411',
    134             'type' => 'library',
    135             'install_path' => __DIR__ . '/../symfony/polyfill-php80',
    136             'aliases' => array(),
    137             'dev_requirement' => false,
    138         ),
    139         'symfony/property-access' => array(
    140             'pretty_version' => 'v5.4.45',
    141             'version' => '5.4.45.0',
    142             'reference' => '111e7ed617509f1a9139686055d234aad6e388e0',
    143             'type' => 'library',
    144             'install_path' => __DIR__ . '/../symfony/property-access',
    145             'aliases' => array(),
    146             'dev_requirement' => false,
    147         ),
    148         'symfony/property-info' => array(
    149             'pretty_version' => 'v5.4.48',
    150             'version' => '5.4.48.0',
    151             'reference' => 'a0396295ad585f95fccd690bc6a281e5bd303902',
    152             'type' => 'library',
    153             'install_path' => __DIR__ . '/../symfony/property-info',
    154             'aliases' => array(),
    155             'dev_requirement' => false,
    156         ),
    157         'symfony/string' => array(
    158             'pretty_version' => 'v5.4.47',
    159             'version' => '5.4.47.0',
    160             'reference' => '136ca7d72f72b599f2631aca474a4f8e26719799',
    161             'type' => 'library',
    162             'install_path' => __DIR__ . '/../symfony/string',
    163             'aliases' => array(),
    164             'dev_requirement' => false,
    165         ),
    16649    ),
    16750);
  • qr-code-management/trunk/vendor/endroid/qr-code/LICENSE

    r2269636 r3846961  
    1 Copyright 2020 (c) Jeroen van den Enden
     1Copyright 2022 (c) Jeroen van den Enden
    22
    33Permission is hereby granted, free of charge, to any person obtaining a copy
  • qr-code-management/trunk/vendor/endroid/qr-code/composer.json

    r3609180 r3846961  
    22    "name": "endroid/qr-code",
    33    "description": "Endroid QR Code",
    4     "keywords": ["endroid", "qrcode", "qr", "code", "bundle", "php"],
     4    "keywords": ["endroid", "qrcode", "qr", "code", "php"],
    55    "homepage": "https://github.com/endroid/qr-code",
    66    "type": "library",
    … …  
    1313    ],
    1414    "require": {
    15         "php": "^7.3||^8.0",
    16         "bacon/bacon-qr-code": "^2.0",
    17         "khanamiryan/qrcode-detector-decoder": "^1.0.5",
    18         "myclabs/php-enum": "^1.5",
    19         "symfony/options-resolver": "^3.4||^4.4||^5.0",
    20         "symfony/property-access": "^3.4||^4.4||^5.0"
     15        "php": "^7.4||^8.0",
     16        "bacon/bacon-qr-code": "^2.0.5"
    2117    },
    2218    "require-dev": {
    23         "endroid/quality": "^1.5.2",
    24         "setasign/fpdf": "^1.8"
     19        "ext-gd": "*",
     20        "endroid/quality": "dev-master",
     21        "khanamiryan/qrcode-detector-decoder": "^1.0.4",
     22        "setasign/fpdf": "^1.8.2"
    2523    },
    2624    "suggest": {
    27         "ext-gd": "Required for generating PNG images",
    28         "roave/security-advisories": "Avoids installation of package versions with vulnerabilities",
    29         "setasign/fpdf": "Required to use the FPDF writer.",
    30         "symfony/security-checker": "Checks your composer.lock for vulnerabilities"
     25        "ext-gd": "Enables you to write PNG images",
     26        "khanamiryan/qrcode-detector-decoder": "Enables you to use the image validator",
     27        "roave/security-advisories": "Makes sure package versions with known security issues are not installed",
     28        "setasign/fpdf": "Enables you to use the PDF writer"
    3129    },
    3230    "autoload": {
    … …  
    4139    },
    4240    "config": {
    43         "sort-packages": true
     41        "sort-packages": true,
     42        "preferred-install": {
     43            "endroid/*": "source"
     44        }
    4445    },
    4546    "extra": {
    4647        "branch-alias": {
    47             "dev-master": "3.x-dev"
     48            "dev-master": "4.x-dev"
    4849        }
    4950    }
  • qr-code-management/trunk/vendor/endroid/qr-code/src/Exception/ValidationException.php

    r3609180 r3846961  
    33declare(strict_types=1);
    44
    5 /*
    6  * (c) Jeroen van den Enden <info@endroid.nl>
    7  *
    8  * This source file is subject to the MIT license that is bundled
    9  * with this source code in the file LICENSE.
    10  */
    11 
    125namespace Endroid\QrCode\Exception;
    136
    14 class ValidationException extends QrCodeException
     7final class ValidationException extends \Exception
    158{
     9    public static function createForUnsupportedWriter(string $writerClass): self
     10    {
     11        return new self(sprintf('Unable to validate the result: "%s" does not support validation', $writerClass));
     12    }
     13
     14    public static function createForMissingPackage(string $packageName): self
     15    {
     16        return new self(sprintf('Please install "%s" or disable image validation', $packageName));
     17    }
     18
     19    public static function createForIncompatiblePhpVersion(): self
     20    {
     21        return new self('The validator is not compatible with PHP 8 yet, see https://github.com/khanamiryan/php-qrcode-detector-decoder/pull/103');
     22    }
     23
     24    public static function createForInvalidData(string $expectedData, string $actualData): self
     25    {
     26        return new self('The validation reader read "'.$actualData.'" instead of "'.$expectedData.'". Adjust your parameters to increase readability or disable validation.');
     27    }
    1628}
  • qr-code-management/trunk/vendor/endroid/qr-code/src/QrCode.php

    r3609180 r3846961  
    33declare(strict_types=1);
    44
    5 /*
    6  * (c) Jeroen van den Enden <info@endroid.nl>
    7  *
    8  * This source file is subject to the MIT license that is bundled
    9  * with this source code in the file LICENSE.
    10  */
    11 
    125namespace Endroid\QrCode;
    136
    14 use BaconQrCode\Encoder\Encoder;
    15 use Endroid\QrCode\Exception\InvalidFontException;
    16 use Endroid\QrCode\Exception\UnsupportedExtensionException;
    17 use Endroid\QrCode\Exception\ValidationException;
    18 use Endroid\QrCode\Writer\WriterInterface;
     7use Endroid\QrCode\Color\Color;
     8use Endroid\QrCode\Color\ColorInterface;
     9use Endroid\QrCode\Encoding\Encoding;
     10use Endroid\QrCode\Encoding\EncodingInterface;
     11use Endroid\QrCode\ErrorCorrectionLevel\ErrorCorrectionLevelInterface;
     12use Endroid\QrCode\ErrorCorrectionLevel\ErrorCorrectionLevelLow;
     13use Endroid\QrCode\RoundBlockSizeMode\RoundBlockSizeModeInterface;
     14use Endroid\QrCode\RoundBlockSizeMode\RoundBlockSizeModeMargin;
    1915
    20 class QrCode implements QrCodeInterface
     16final class QrCode implements QrCodeInterface
    2117{
    22     const LABEL_FONT_PATH_DEFAULT = __DIR__.'/../assets/fonts/noto_sans.otf';
     18    private string $data;
     19    private EncodingInterface $encoding;
     20    private ErrorCorrectionLevelInterface $errorCorrectionLevel;
     21    private int $size;
     22    private int $margin;
     23    private RoundBlockSizeModeInterface $roundBlockSizeMode;
     24    private ColorInterface $foregroundColor;
     25    private ColorInterface $backgroundColor;
    2326
    24     const ROUND_BLOCK_SIZE_MODE_MARGIN = 'margin';
    25     const ROUND_BLOCK_SIZE_MODE_SHRINK = 'shrink';
    26     const ROUND_BLOCK_SIZE_MODE_ENLARGE = 'enlarge';
    27 
    28     private $text;
    29 
    30     /** @var int */
    31     private $size = 300;
    32 
    33     /** @var int */
    34     private $margin = 10;
    35 
    36     /** @var array<int> */
    37     private $foregroundColor = [
    38         'r' => 0,
    39         'g' => 0,
    40         'b' => 0,
    41         'a' => 0,
    42     ];
    43 
    44     /** @var array<int> */
    45     private $backgroundColor = [
    46         'r' => 255,
    47         'g' => 255,
    48         'b' => 255,
    49         'a' => 0,
    50     ];
    51 
    52     /** @var string */
    53     private $encoding = 'UTF-8';
    54 
    55     /** @var bool */
    56     private $roundBlockSize = true;
    57 
    58     /** @var string */
    59     private $roundBlockSizeMode = self::ROUND_BLOCK_SIZE_MODE_MARGIN;
    60 
    61     private $errorCorrectionLevel;
    62 
    63     /** @var string */
    64     private $logoPath;
    65 
    66     /** @var int|null */
    67     private $logoWidth;
    68 
    69     /** @var int|null */
    70     private $logoHeight;
    71 
    72     /** @var string */
    73     private $label;
    74 
    75     /** @var int */
    76     private $labelFontSize = 16;
    77 
    78     /** @var string */
    79     private $labelFontPath = self::LABEL_FONT_PATH_DEFAULT;
    80 
    81     private $labelAlignment;
    82 
    83     /** @var array<string, int> */
    84     private $labelMargin = [
    85         't' => 0,
    86         'r' => 10,
    87         'b' => 10,
    88         'l' => 10,
    89     ];
    90 
    91     /** @var WriterRegistryInterface */
    92     private $writerRegistry;
    93 
    94     /** @var WriterInterface|null */
    95     private $writer;
    96 
    97     /** @var array<mixed> */
    98     private $writerOptions = [];
    99 
    100     /** @var bool */
    101     private $validateResult = false;
    102 
    103     public function __construct(string $text = '')
    104     {
    105         $this->text = $text;
    106 
    107         $this->errorCorrectionLevel = ErrorCorrectionLevel::LOW();
    108         $this->labelAlignment = LabelAlignment::CENTER();
    109 
    110         $this->createWriterRegistry();
     27    public function __construct(
     28        string $data,
     29        EncodingInterface $encoding = null,
     30        ErrorCorrectionLevelInterface $errorCorrectionLevel = null,
     31        int $size = 300,
     32        int $margin = 10,
     33        RoundBlockSizeModeInterface $roundBlockSizeMode = null,
     34        ColorInterface $foregroundColor = null,
     35        ColorInterface $backgroundColor = null
     36    ) {
     37        $this->data = $data;
     38        $this->encoding = $encoding ?? new Encoding('UTF-8');
     39        $this->errorCorrectionLevel = $errorCorrectionLevel ?? new ErrorCorrectionLevelLow();
     40        $this->size = $size;
     41        $this->margin = $margin;
     42        $this->roundBlockSizeMode = $roundBlockSizeMode ?? new RoundBlockSizeModeMargin();
     43        $this->foregroundColor = $foregroundColor ?? new Color(0, 0, 0);
     44        $this->backgroundColor = $backgroundColor ?? new Color(255, 255, 255);
    11145    }
    11246
    113     public function setText(string $text): void
     47    public static function create(string $data): self
    11448    {
    115         $this->text = $text;
     49        return new self($data);
    11650    }
    11751
    118     public function getText(): string
     52    public function getData(): string
    11953    {
    120         return $this->text;
     54        return $this->data;
    12155    }
    12256
    123     public function setSize(int $size): void
     57    public function setData(string $data): self
    12458    {
    125         $this->size = $size;
     59        $this->data = $data;
     60
     61        return $this;
     62    }
     63
     64    public function getEncoding(): EncodingInterface
     65    {
     66        return $this->encoding;
     67    }
     68
     69    public function setEncoding(Encoding $encoding): self
     70    {
     71        $this->encoding = $encoding;
     72
     73        return $this;
     74    }
     75
     76    public function getErrorCorrectionLevel(): ErrorCorrectionLevelInterface
     77    {
     78        return $this->errorCorrectionLevel;
     79    }
     80
     81    public function setErrorCorrectionLevel(ErrorCorrectionLevelInterface $errorCorrectionLevel): self
     82    {
     83        $this->errorCorrectionLevel = $errorCorrectionLevel;
     84
     85        return $this;
    12686    }
    12787
    … …  
    13191    }
    13292
    133     public function setMargin(int $margin): void
     93    public function setSize(int $size): self
    13494    {
    135         $this->margin = $margin;
     95        $this->size = $size;
     96
     97        return $this;
    13698    }
    13799
    … …  
    141103    }
    142104
    143     /** @param array<int> $foregroundColor */
    144     public function setForegroundColor(array $foregroundColor): void
     105    public function setMargin(int $margin): self
    145106    {
    146         if (!isset($foregroundColor['a'])) {
    147             $foregroundColor['a'] = 0;
    148         }
     107        $this->margin = $margin;
    149108
    150         foreach ($foregroundColor as &$color) {
    151             $color = intval($color);
    152         }
    153 
    154         $this->foregroundColor = $foregroundColor;
     109        return $this;
    155110    }
    156111
    157     public function getForegroundColor(): array
     112    public function getRoundBlockSizeMode(): RoundBlockSizeModeInterface
     113    {
     114        return $this->roundBlockSizeMode;
     115    }
     116
     117    public function setRoundBlockSizeMode(RoundBlockSizeModeInterface $roundBlockSizeMode): self
     118    {
     119        $this->roundBlockSizeMode = $roundBlockSizeMode;
     120
     121        return $this;
     122    }
     123
     124    public function getForegroundColor(): ColorInterface
    158125    {
    159126        return $this->foregroundColor;
    160127    }
    161128
    162     /** @param array<int> $backgroundColor */
    163     public function setBackgroundColor(array $backgroundColor): void
     129    public function setForegroundColor(ColorInterface $foregroundColor): self
    164130    {
    165         if (!isset($backgroundColor['a'])) {
    166             $backgroundColor['a'] = 0;
    167         }
     131        $this->foregroundColor = $foregroundColor;
    168132
    169         foreach ($backgroundColor as &$color) {
    170             $color = intval($color);
    171         }
    172 
    173         $this->backgroundColor = $backgroundColor;
     133        return $this;
    174134    }
    175135
    176     public function getBackgroundColor(): array
     136    public function getBackgroundColor(): ColorInterface
    177137    {
    178138        return $this->backgroundColor;
    179139    }
    180140
    181     public function setEncoding(string $encoding): void
     141    public function setBackgroundColor(ColorInterface $backgroundColor): self
    182142    {
    183         $this->encoding = $encoding;
    184     }
     143        $this->backgroundColor = $backgroundColor;
    185144
    186     public function getEncoding(): string
    187     {
    188         return $this->encoding;
    189     }
    190 
    191     public function setRoundBlockSize(bool $roundBlockSize, string $roundBlockSizeMode = self::ROUND_BLOCK_SIZE_MODE_MARGIN): void
    192     {
    193         $this->roundBlockSize = $roundBlockSize;
    194         $this->setRoundBlockSizeMode($roundBlockSizeMode);
    195     }
    196 
    197     public function getRoundBlockSize(): bool
    198     {
    199         return $this->roundBlockSize;
    200     }
    201 
    202     public function setRoundBlockSizeMode(string $roundBlockSizeMode): void
    203     {
    204         if (!in_array($roundBlockSizeMode, [
    205             self::ROUND_BLOCK_SIZE_MODE_ENLARGE,
    206             self::ROUND_BLOCK_SIZE_MODE_MARGIN,
    207             self::ROUND_BLOCK_SIZE_MODE_SHRINK,
    208         ])) {
    209             throw new ValidationException('Invalid round block size mode: '.$roundBlockSizeMode);
    210         }
    211 
    212         $this->roundBlockSizeMode = $roundBlockSizeMode;
    213     }
    214 
    215     public function setErrorCorrectionLevel(ErrorCorrectionLevel $errorCorrectionLevel): void
    216     {
    217         $this->errorCorrectionLevel = $errorCorrectionLevel;
    218     }
    219 
    220     public function getErrorCorrectionLevel(): ErrorCorrectionLevel
    221     {
    222         return $this->errorCorrectionLevel;
    223     }
    224 
    225     public function setLogoPath(string $logoPath): void
    226     {
    227         $this->logoPath = $logoPath;
    228     }
    229 
    230     public function getLogoPath(): ?string
    231     {
    232         return $this->logoPath;
    233     }
    234 
    235     public function setLogoSize(int $logoWidth, int $logoHeight = null): void
    236     {
    237         $this->logoWidth = $logoWidth;
    238         $this->logoHeight = $logoHeight;
    239     }
    240 
    241     public function setLogoWidth(int $logoWidth): void
    242     {
    243         $this->logoWidth = $logoWidth;
    244     }
    245 
    246     public function getLogoWidth(): ?int
    247     {
    248         return $this->logoWidth;
    249     }
    250 
    251     public function setLogoHeight(int $logoHeight): void
    252     {
    253         $this->logoHeight = $logoHeight;
    254     }
    255 
    256     public function getLogoHeight(): ?int
    257     {
    258         return $this->logoHeight;
    259     }
    260 
    261     /** @param array<string, int> $labelMargin */
    262     public function setLabel(string $label, int $labelFontSize = null, string $labelFontPath = null, string $labelAlignment = null, array $labelMargin = null): void
    263     {
    264         $this->label = $label;
    265 
    266         if (null !== $labelFontSize) {
    267             $this->setLabelFontSize($labelFontSize);
    268         }
    269 
    270         if (null !== $labelFontPath) {
    271             $this->setLabelFontPath($labelFontPath);
    272         }
    273 
    274         if (null !== $labelAlignment) {
    275             $this->setLabelAlignment($labelAlignment);
    276         }
    277 
    278         if (null !== $labelMargin) {
    279             $this->setLabelMargin($labelMargin);
    280         }
    281     }
    282 
    283     public function getLabel(): ?string
    284     {
    285         return $this->label;
    286     }
    287 
    288     public function setLabelFontSize(int $labelFontSize): void
    289     {
    290         $this->labelFontSize = $labelFontSize;
    291     }
    292 
    293     public function getLabelFontSize(): int
    294     {
    295         return $this->labelFontSize;
    296     }
    297 
    298     public function setLabelFontPath(string $labelFontPath): void
    299     {
    300         $resolvedLabelFontPath = (string) realpath($labelFontPath);
    301 
    302         if (!is_file($resolvedLabelFontPath)) {
    303             throw new InvalidFontException('Invalid label font path: '.$labelFontPath);
    304         }
    305 
    306         $this->labelFontPath = $resolvedLabelFontPath;
    307     }
    308 
    309     public function getLabelFontPath(): string
    310     {
    311         return $this->labelFontPath;
    312     }
    313 
    314     public function setLabelAlignment(string $labelAlignment): void
    315     {
    316         $this->labelAlignment = new LabelAlignment($labelAlignment);
    317     }
    318 
    319     public function getLabelAlignment(): string
    320     {
    321         return $this->labelAlignment->getValue();
    322     }
    323 
    324     /** @param array<string, int> $labelMargin */
    325     public function setLabelMargin(array $labelMargin): void
    326     {
    327         $this->labelMargin = array_merge($this->labelMargin, $labelMargin);
    328     }
    329 
    330     public function getLabelMargin(): array
    331     {
    332         return $this->labelMargin;
    333     }
    334 
    335     public function setWriterRegistry(WriterRegistryInterface $writerRegistry): void
    336     {
    337         $this->writerRegistry = $writerRegistry;
    338     }
    339 
    340     public function setWriter(WriterInterface $writer): void
    341     {
    342         $this->writer = $writer;
    343     }
    344 
    345     public function getWriter(string $name = null): WriterInterface
    346     {
    347         if (!is_null($name)) {
    348             return $this->writerRegistry->getWriter($name);
    349         }
    350 
    351         if ($this->writer instanceof WriterInterface) {
    352             return $this->writer;
    353         }
    354 
    355         return $this->writerRegistry->getDefaultWriter();
    356     }
    357 
    358     /** @param array<string, mixed> $writerOptions */
    359     public function setWriterOptions(array $writerOptions): void
    360     {
    361         $this->writerOptions = $writerOptions;
    362     }
    363 
    364     public function getWriterOptions(): array
    365     {
    366         return $this->writerOptions;
    367     }
    368 
    369     private function createWriterRegistry(): void
    370     {
    371         $this->writerRegistry = new WriterRegistry();
    372         $this->writerRegistry->loadDefaultWriters();
    373     }
    374 
    375     public function setWriterByName(string $name): void
    376     {
    377         $this->writer = $this->getWriter($name);
    378     }
    379 
    380     public function setWriterByPath(string $path): void
    381     {
    382         $extension = pathinfo($path, PATHINFO_EXTENSION);
    383 
    384         $this->setWriterByExtension($extension);
    385     }
    386 
    387     public function setWriterByExtension(string $extension): void
    388     {
    389         foreach ($this->writerRegistry->getWriters() as $writer) {
    390             if ($writer->supportsExtension($extension)) {
    391                 $this->writer = $writer;
    392 
    393                 return;
    394             }
    395         }
    396 
    397         throw new UnsupportedExtensionException('Missing writer for extension "'.$extension.'"');
    398     }
    399 
    400     public function writeString(): string
    401     {
    402         return $this->getWriter()->writeString($this);
    403     }
    404 
    405     public function writeDataUri(): string
    406     {
    407         return $this->getWriter()->writeDataUri($this);
    408     }
    409 
    410     public function writeFile(string $path): void
    411     {
    412         $this->getWriter()->writeFile($this, $path);
    413     }
    414 
    415     public function getContentType(): string
    416     {
    417         return $this->getWriter()->getContentType();
    418     }
    419 
    420     public function setValidateResult(bool $validateResult): void
    421     {
    422         $this->validateResult = $validateResult;
    423     }
    424 
    425     public function getValidateResult(): bool
    426     {
    427         return $this->validateResult;
    428     }
    429 
    430     public function getData(): array
    431     {
    432         $baconErrorCorrectionLevel = $this->errorCorrectionLevel->toBaconErrorCorrectionLevel();
    433 
    434         $baconQrCode = Encoder::encode($this->text, $baconErrorCorrectionLevel, $this->encoding);
    435 
    436         $baconMatrix = $baconQrCode->getMatrix();
    437 
    438         $matrix = [];
    439         $columnCount = $baconMatrix->getWidth();
    440         $rowCount = $baconMatrix->getHeight();
    441         for ($rowIndex = 0; $rowIndex < $rowCount; ++$rowIndex) {
    442             $matrix[$rowIndex] = [];
    443             for ($columnIndex = 0; $columnIndex < $columnCount; ++$columnIndex) {
    444                 $matrix[$rowIndex][$columnIndex] = $baconMatrix->get($columnIndex, $rowIndex);
    445             }
    446         }
    447 
    448         $data = ['matrix' => $matrix];
    449         $data['block_count'] = count($matrix[0]);
    450         $data['block_size'] = $this->size / $data['block_count'];
    451         if ($this->roundBlockSize) {
    452             switch ($this->roundBlockSizeMode) {
    453                 case self::ROUND_BLOCK_SIZE_MODE_ENLARGE:
    454                     $data['block_size'] = intval(ceil($data['block_size']));
    455                     $this->size = $data['block_size'] * $data['block_count'];
    456                     break;
    457                 case self::ROUND_BLOCK_SIZE_MODE_SHRINK:
    458                     $data['block_size'] = intval(floor($data['block_size']));
    459                     $this->size = $data['block_size'] * $data['block_count'];
    460                     break;
    461                 case self::ROUND_BLOCK_SIZE_MODE_MARGIN:
    462                 default:
    463                     $data['block_size'] = intval(floor($data['block_size']));
    464             }
    465         }
    466         $data['inner_width'] = $data['block_size'] * $data['block_count'];
    467         $data['inner_height'] = $data['block_size'] * $data['block_count'];
    468         $data['outer_width'] = $this->size + 2 * $this->margin;
    469         $data['outer_height'] = $this->size + 2 * $this->margin;
    470         $data['margin_left'] = ($data['outer_width'] - $data['inner_width']) / 2;
    471         if ($this->roundBlockSize) {
    472             $data['margin_left'] = intval(floor($data['margin_left']));
    473         }
    474         $data['margin_right'] = $data['outer_width'] - $data['inner_width'] - $data['margin_left'];
    475 
    476         return $data;
     145        return $this;
    477146    }
    478147}
  • qr-code-management/trunk/vendor/endroid/qr-code/src/QrCodeInterface.php

    r3609180 r3846961  
    33declare(strict_types=1);
    44
    5 /*
    6  * (c) Jeroen van den Enden <info@endroid.nl>
    7  *
    8  * This source file is subject to the MIT license that is bundled
    9  * with this source code in the file LICENSE.
    10  */
     5namespace Endroid\QrCode;
    116
    12 namespace Endroid\QrCode;
     7use Endroid\QrCode\Color\ColorInterface;
     8use Endroid\QrCode\Encoding\EncodingInterface;
     9use Endroid\QrCode\ErrorCorrectionLevel\ErrorCorrectionLevelInterface;
     10use Endroid\QrCode\RoundBlockSizeMode\RoundBlockSizeModeInterface;
    1311
    1412interface QrCodeInterface
    1513{
    16     public function getText(): string;
     14    public function getData(): string;
     15
     16    public function getEncoding(): EncodingInterface;
     17
     18    public function getErrorCorrectionLevel(): ErrorCorrectionLevelInterface;
    1719
    1820    public function getSize(): int;
    … …  
    2022    public function getMargin(): int;
    2123
    22     /** @return array<int> */
    23     public function getForegroundColor(): array;
     24    public function getRoundBlockSizeMode(): RoundBlockSizeModeInterface;
    2425
    25     /** @return array<int> */
    26     public function getBackgroundColor(): array;
     26    public function getForegroundColor(): ColorInterface;
    2727
    28     public function getEncoding(): string;
    29 
    30     public function getRoundBlockSize(): bool;
    31 
    32     public function getErrorCorrectionLevel(): ErrorCorrectionLevel;
    33 
    34     public function getLogoPath(): ?string;
    35 
    36     public function getLogoWidth(): ?int;
    37 
    38     public function getLogoHeight(): ?int;
    39 
    40     public function getLabel(): ?string;
    41 
    42     public function getLabelFontPath(): string;
    43 
    44     public function getLabelFontSize(): int;
    45 
    46     public function getLabelAlignment(): string;
    47 
    48     /** @return array<int> */
    49     public function getLabelMargin(): array;
    50 
    51     public function getValidateResult(): bool;
    52 
    53     /** @return array<mixed> */
    54     public function getWriterOptions(): array;
    55 
    56     public function getContentType(): string;
    57 
    58     public function setWriterRegistry(WriterRegistryInterface $writerRegistry): void;
    59 
    60     public function writeString(): string;
    61 
    62     public function writeDataUri(): string;
    63 
    64     public function writeFile(string $path): void;
    65 
    66     /** @return array<mixed> */
    67     public function getData(): array;
     28    public function getBackgroundColor(): ColorInterface;
    6829}
  • qr-code-management/trunk/vendor/endroid/qr-code/src/Writer/BinaryWriter.php

    r3609180 r3846961  
    33declare(strict_types=1);
    44
    5 /*
    6  * (c) Jeroen van den Enden <info@endroid.nl>
    7  *
    8  * This source file is subject to the MIT license that is bundled
    9  * with this source code in the file LICENSE.
    10  */
    11 
    125namespace Endroid\QrCode\Writer;
    136
     7use Endroid\QrCode\Bacon\MatrixFactory;
     8use Endroid\QrCode\Label\LabelInterface;
     9use Endroid\QrCode\Logo\LogoInterface;
    1410use Endroid\QrCode\QrCodeInterface;
     11use Endroid\QrCode\Writer\Result\BinaryResult;
     12use Endroid\QrCode\Writer\Result\ResultInterface;
    1513
    16 class BinaryWriter extends AbstractWriter
     14final class BinaryWriter implements WriterInterface
    1715{
    18     public function writeString(QrCodeInterface $qrCode): string
     16    public function write(QrCodeInterface $qrCode, LogoInterface $logo = null, LabelInterface $label = null, array $options = []): ResultInterface
    1917    {
    20         $rows = [];
    21         $data = $qrCode->getData();
    22         foreach ($data['matrix'] as $row) {
    23             $values = '';
    24             foreach ($row as $value) {
    25                 $values .= $value;
    26             }
    27             $rows[] = $values;
    28         }
     18        $matrixFactory = new MatrixFactory();
     19        $matrix = $matrixFactory->create($qrCode);
    2920
    30         return implode("\n", $rows);
    31     }
    32 
    33     public static function getContentType(): string
    34     {
    35         return 'text/plain';
    36     }
    37 
    38     public static function getSupportedExtensions(): array
    39     {
    40         return ['bin', 'txt'];
    41     }
    42 
    43     public function getName(): string
    44     {
    45         return 'binary';
     21        return new BinaryResult($matrix);
    4622    }
    4723}
  • qr-code-management/trunk/vendor/endroid/qr-code/src/Writer/DebugWriter.php

    r3609180 r3846961  
    33declare(strict_types=1);
    44
    5 /*
    6  * (c) Jeroen van den Enden <info@endroid.nl>
    7  *
    8  * This source file is subject to the MIT license that is bundled
    9  * with this source code in the file LICENSE.
    10  */
    11 
    125namespace Endroid\QrCode\Writer;
    136
     7use Endroid\QrCode\Bacon\MatrixFactory;
     8use Endroid\QrCode\Label\LabelInterface;
     9use Endroid\QrCode\Logo\LogoInterface;
    1410use Endroid\QrCode\QrCodeInterface;
    15 use Exception;
    16 use ReflectionClass;
     11use Endroid\QrCode\Writer\Result\DebugResult;
     12use Endroid\QrCode\Writer\Result\ResultInterface;
    1713
    18 class DebugWriter extends AbstractWriter
     14final class DebugWriter implements WriterInterface, ValidatingWriterInterface
    1915{
    20     public function writeString(QrCodeInterface $qrCode): string
     16    public function write(QrCodeInterface $qrCode, LogoInterface $logo = null, LabelInterface $label = null, array $options = []): ResultInterface
    2117    {
    22         $data = [];
    23         $skip = ['getData'];
     18        $matrixFactory = new MatrixFactory();
     19        $matrix = $matrixFactory->create($qrCode);
    2420
    25         $reflectionClass = new ReflectionClass($qrCode);
    26         foreach ($reflectionClass->getMethods() as $method) {
    27             $methodName = $method->getShortName();
    28             if (0 === strpos($methodName, 'get') && 0 == $method->getNumberOfParameters() && !in_array($methodName, $skip)) {
    29                 $value = $qrCode->{$methodName}();
    30                 if (is_array($value) && !is_object(current($value))) {
    31                     $value = '['.implode(', ', $value).']';
    32                 } elseif (is_bool($value)) {
    33                     $value = $value ? 'true' : 'false';
    34                 } elseif (is_string($value)) {
    35                     $value = '"'.$value.'"';
    36                 } elseif (is_null($value)) {
    37                     $value = 'null';
    38                 }
    39                 try {
    40                     $data[] = $methodName.': '.$value;
    41                 } catch (Exception $exception) {
    42                 }
    43             }
     21        return new DebugResult($matrix, $qrCode, $logo, $label, $options);
     22    }
     23
     24    public function validateResult(ResultInterface $result, string $expectedData): void
     25    {
     26        if (!$result instanceof DebugResult) {
     27            throw new \Exception('Unable to write logo: instance of DebugResult expected');
    4428        }
    4529
    46         $string = implode(" \n", $data);
    47 
    48         return $string;
    49     }
    50 
    51     public static function getContentType(): string
    52     {
    53         return 'text/plain';
    54     }
    55 
    56     public function getName(): string
    57     {
    58         return 'debug';
     30        $result->setValidateResult(true);
    5931    }
    6032}
  • qr-code-management/trunk/vendor/endroid/qr-code/src/Writer/EpsWriter.php

    r3609180 r3846961  
    33declare(strict_types=1);
    44
    5 /*
    6  * (c) Jeroen van den Enden <info@endroid.nl>
    7  *
    8  * This source file is subject to the MIT license that is bundled
    9  * with this source code in the file LICENSE.
    10  */
    11 
    125namespace Endroid\QrCode\Writer;
    136
     7use Endroid\QrCode\Bacon\MatrixFactory;
     8use Endroid\QrCode\Label\LabelInterface;
     9use Endroid\QrCode\Logo\LogoInterface;
    1410use Endroid\QrCode\QrCodeInterface;
     11use Endroid\QrCode\Writer\Result\EpsResult;
     12use Endroid\QrCode\Writer\Result\ResultInterface;
    1513
    16 class EpsWriter extends AbstractWriter
     14final class EpsWriter implements WriterInterface
    1715{
    18     public function writeString(QrCodeInterface $qrCode): string
     16    public const DECIMAL_PRECISION = 10;
     17
     18    public function write(QrCodeInterface $qrCode, LogoInterface $logo = null, LabelInterface $label = null, array $options = []): ResultInterface
    1919    {
    20         $data = $qrCode->getData();
     20        $matrixFactory = new MatrixFactory();
     21        $matrix = $matrixFactory->create($qrCode);
    2122
    22         $epsData = [];
    23         $epsData[] = '%!PS-Adobe-3.0 EPSF-3.0';
    24         $epsData[] = '%%BoundingBox: 0 0 '.$data['outer_width'].' '.$data['outer_height'];
    25         $epsData[] = '/F { rectfill } def';
    26         $epsData[] = number_format($qrCode->getBackgroundColor()['r'] / 100, 2, '.', ',').' '.number_format($qrCode->getBackgroundColor()['g'] / 100, 2, '.', ',').' '.number_format($qrCode->getBackgroundColor()['b'] / 100, 2, '.', ',').' setrgbcolor';
    27         $epsData[] = '0 0 '.$data['outer_width'].' '.$data['outer_height'].' F';
    28         $epsData[] = number_format($qrCode->getForegroundColor()['r'] / 100, 2, '.', ',').' '.number_format($qrCode->getForegroundColor()['g'] / 100, 2, '.', ',').' '.number_format($qrCode->getForegroundColor()['b'] / 100, 2, '.', ',').' setrgbcolor';
     23        $lines = [
     24            '%!PS-Adobe-3.0 EPSF-3.0',
     25            '%%BoundingBox: 0 0 '.$matrix->getOuterSize().' '.$matrix->getOuterSize(),
     26            '/F { rectfill } def',
     27            number_format($qrCode->getBackgroundColor()->getRed() / 100, 2, '.', ',').' '.number_format($qrCode->getBackgroundColor()->getGreen() / 100, 2, '.', ',').' '.number_format($qrCode->getBackgroundColor()->getBlue() / 100, 2, '.', ',').' setrgbcolor',
     28            '0 0 '.$matrix->getOuterSize().' '.$matrix->getOuterSize().' F',
     29            number_format($qrCode->getForegroundColor()->getRed() / 100, 2, '.', ',').' '.number_format($qrCode->getForegroundColor()->getGreen() / 100, 2, '.', ',').' '.number_format($qrCode->getForegroundColor()->getBlue() / 100, 2, '.', ',').' setrgbcolor',
     30        ];
    2931
    30         // Please note an EPS has a reversed Y axis compared to PNG and SVG
    31         $data['matrix'] = array_reverse($data['matrix']);
    32         foreach ($data['matrix'] as $row => $values) {
    33             foreach ($values as $column => $value) {
    34                 if (1 === $value) {
    35                     $x = $data['margin_left'] + $data['block_size'] * $column;
    36                     $y = $data['margin_left'] + $data['block_size'] * $row;
    37                     $epsData[] = $x.' '.$y.' '.$data['block_size'].' '.$data['block_size'].' F';
     32        for ($rowIndex = 0; $rowIndex < $matrix->getBlockCount(); ++$rowIndex) {
     33            for ($columnIndex = 0; $columnIndex < $matrix->getBlockCount(); ++$columnIndex) {
     34                if (1 === $matrix->getBlockValue($matrix->getBlockCount() - 1 - $rowIndex, $columnIndex)) {
     35                    $x = $matrix->getMarginLeft() + $matrix->getBlockSize() * $columnIndex;
     36                    $y = $matrix->getMarginLeft() + $matrix->getBlockSize() * $rowIndex;
     37                    $lines[] = number_format($x, self::DECIMAL_PRECISION, '.', '').' '.number_format($y, self::DECIMAL_PRECISION, '.', '').' '.number_format($matrix->getBlockSize(), self::DECIMAL_PRECISION, '.', '').' '.number_format($matrix->getBlockSize(), self::DECIMAL_PRECISION, '.', '').' F';
    3838                }
    3939            }
    4040        }
    4141
    42         return implode("\n", $epsData);
    43     }
    44 
    45     public static function getContentType(): string
    46     {
    47         return 'image/eps';
    48     }
    49 
    50     public static function getSupportedExtensions(): array
    51     {
    52         return ['eps'];
    53     }
    54 
    55     public function getName(): string
    56     {
    57         return 'eps';
     42        return new EpsResult($matrix, $lines);
    5843    }
    5944}
  • qr-code-management/trunk/vendor/endroid/qr-code/src/Writer/PngWriter.php

    r3609180 r3846961  
    33declare(strict_types=1);
    44
    5 /*
    6  * (c) Jeroen van den Enden <info@endroid.nl>
    7  *
    8  * This source file is subject to the MIT license that is bundled
    9  * with this source code in the file LICENSE.
    10  */
    11 
    125namespace Endroid\QrCode\Writer;
    136
    14 use Endroid\QrCode\Exception\GenerateImageException;
    15 use Endroid\QrCode\Exception\MissingFunctionException;
    16 use Endroid\QrCode\Exception\MissingLogoHeightException;
     7use Endroid\QrCode\Bacon\MatrixFactory;
    178use Endroid\QrCode\Exception\ValidationException;
    18 use Endroid\QrCode\LabelAlignment;
     9use Endroid\QrCode\ImageData\LabelImageData;
     10use Endroid\QrCode\ImageData\LogoImageData;
     11use Endroid\QrCode\Label\Alignment\LabelAlignmentLeft;
     12use Endroid\QrCode\Label\Alignment\LabelAlignmentRight;
     13use Endroid\QrCode\Label\LabelInterface;
     14use Endroid\QrCode\Logo\LogoInterface;
    1915use Endroid\QrCode\QrCodeInterface;
     16use Endroid\QrCode\RoundBlockSizeMode\RoundBlockSizeModeNone;
     17use Endroid\QrCode\Writer\Result\PngResult;
     18use Endroid\QrCode\Writer\Result\ResultInterface;
    2019use Zxing\QrReader;
    2120
    22 class PngWriter extends AbstractWriter
     21final class PngWriter implements WriterInterface, ValidatingWriterInterface
    2322{
    24     public function writeString(QrCodeInterface $qrCode): string
     23    public function write(QrCodeInterface $qrCode, LogoInterface $logo = null, LabelInterface $label = null, array $options = []): ResultInterface
    2524    {
    2625        if (!extension_loaded('gd')) {
    27             throw new GenerateImageException('Unable to generate image: check your GD installation');
    28         }
    29 
    30         $image = $this->createImage($qrCode->getData(), $qrCode);
    31 
    32         $logoPath = $qrCode->getLogoPath();
    33         if (null !== $logoPath) {
    34             $image = $this->addLogo($image, $logoPath, $qrCode->getLogoWidth(), $qrCode->getLogoHeight());
    35         }
    36 
    37         $label = $qrCode->getLabel();
    38         if (null !== $label) {
    39             $image = $this->addLabel($image, $label, $qrCode->getLabelFontPath(), $qrCode->getLabelFontSize(), $qrCode->getLabelAlignment(), $qrCode->getLabelMargin(), $qrCode->getForegroundColor(), $qrCode->getBackgroundColor());
    40         }
    41 
    42         $string = $this->imageToString($image);
    43 
    44         if (PHP_VERSION_ID < 80000) {
    45             imagedestroy($image);
    46         }
    47 
    48         if ($qrCode->getValidateResult()) {
    49             $reader = new QrReader($string, QrReader::SOURCE_TYPE_BLOB);
    50             if ($reader->text() !== $qrCode->getText()) {
    51                 throw new ValidationException('Built-in validation reader read "'.$reader->text().'" instead of "'.$qrCode->getText().'".
    52                      Adjust your parameters to increase readability or disable built-in validation.');
     26            throw new \Exception('Unable to generate image: please check if the GD extension is enabled and configured correctly');
     27        }
     28
     29        $matrixFactory = new MatrixFactory();
     30        $matrix = $matrixFactory->create($qrCode);
     31
     32        $baseBlockSize = $qrCode->getRoundBlockSizeMode() instanceof RoundBlockSizeModeNone ? 10 : intval($matrix->getBlockSize());
     33        $baseImage = imagecreatetruecolor($matrix->getBlockCount() * $baseBlockSize, $matrix->getBlockCount() * $baseBlockSize);
     34
     35        if (!$baseImage) {
     36            throw new \Exception('Unable to generate image: please check if the GD extension is enabled and configured correctly');
     37        }
     38
     39        /** @var int $foregroundColor */
     40        $foregroundColor = imagecolorallocatealpha(
     41            $baseImage,
     42            $qrCode->getForegroundColor()->getRed(),
     43            $qrCode->getForegroundColor()->getGreen(),
     44            $qrCode->getForegroundColor()->getBlue(),
     45            $qrCode->getForegroundColor()->getAlpha()
     46        );
     47
     48        /** @var int $transparentColor */
     49        $transparentColor = imagecolorallocatealpha($baseImage, 255, 255, 255, 127);
     50
     51        imagefill($baseImage, 0, 0, $transparentColor);
     52
     53        for ($rowIndex = 0; $rowIndex < $matrix->getBlockCount(); ++$rowIndex) {
     54            for ($columnIndex = 0; $columnIndex < $matrix->getBlockCount(); ++$columnIndex) {
     55                if (1 === $matrix->getBlockValue($rowIndex, $columnIndex)) {
     56                    imagefilledrectangle(
     57                        $baseImage,
     58                        $columnIndex * $baseBlockSize,
     59                        $rowIndex * $baseBlockSize,
     60                        ($columnIndex + 1) * $baseBlockSize - 1,
     61                        ($rowIndex + 1) * $baseBlockSize - 1,
     62                        $foregroundColor
     63                    );
     64                }
    5365            }
    5466        }
    5567
    56         return $string;
    57     }
    58 
    59     /**
    60      * @param array<mixed> $data
    61      *
    62      * @return mixed
    63      */
    64     private function createImage(array $data, QrCodeInterface $qrCode)
    65     {
    66         $baseSize = $qrCode->getRoundBlockSize() ? $data['block_size'] : 25;
    67 
    68         $baseImage = $this->createBaseImage($baseSize, $data, $qrCode);
    69         $interpolatedImage = $this->createInterpolatedImage($baseImage, $data, $qrCode);
     68        $targetWidth = $matrix->getOuterSize();
     69        $targetHeight = $matrix->getOuterSize();
     70
     71        if ($label instanceof LabelInterface) {
     72            $labelImageData = LabelImageData::createForLabel($label);
     73            $targetHeight += $labelImageData->getHeight() + $label->getMargin()->getTop() + $label->getMargin()->getBottom();
     74        }
     75
     76        $targetImage = imagecreatetruecolor($targetWidth, $targetHeight);
     77
     78        if (!$targetImage) {
     79            throw new \Exception('Unable to generate image: please check if the GD extension is enabled and configured correctly');
     80        }
     81
     82        /** @var int $backgroundColor */
     83        $backgroundColor = imagecolorallocatealpha(
     84            $targetImage,
     85            $qrCode->getBackgroundColor()->getRed(),
     86            $qrCode->getBackgroundColor()->getGreen(),
     87            $qrCode->getBackgroundColor()->getBlue(),
     88            $qrCode->getBackgroundColor()->getAlpha()
     89        );
     90
     91        imagefill($targetImage, 0, 0, $backgroundColor);
     92
     93        imagecopyresampled(
     94            $targetImage,
     95            $baseImage,
     96            $matrix->getMarginLeft(),
     97            $matrix->getMarginLeft(),
     98            0,
     99            0,
     100            $matrix->getInnerSize(),
     101            $matrix->getInnerSize(),
     102            imagesx($baseImage),
     103            imagesy($baseImage)
     104        );
    70105
    71106        if (PHP_VERSION_ID < 80000) {
    … …  
    73108        }
    74109
    75         return $interpolatedImage;
    76     }
    77 
    78     /**
    79      * @param array<mixed> $data
    80      *
    81      * @return mixed
    82      */
    83     private function createBaseImage(int $baseSize, array $data, QrCodeInterface $qrCode)
    84     {
    85         $image = imagecreatetruecolor($data['block_count'] * $baseSize, $data['block_count'] * $baseSize);
    86 
    87         if (!$image) {
    88             throw new GenerateImageException('Unable to generate image: check your GD installation');
    89         }
    90 
    91         $foregroundColor = imagecolorallocatealpha($image, $qrCode->getForegroundColor()['r'], $qrCode->getForegroundColor()['g'], $qrCode->getForegroundColor()['b'], $qrCode->getForegroundColor()['a']);
    92         if (!is_int($foregroundColor)) {
    93             throw new GenerateImageException('Foreground color could not be allocated');
    94         }
    95 
    96         $backgroundColor = imagecolorallocatealpha($image, $qrCode->getBackgroundColor()['r'], $qrCode->getBackgroundColor()['g'], $qrCode->getBackgroundColor()['b'], $qrCode->getBackgroundColor()['a']);
    97         if (!is_int($backgroundColor)) {
    98             throw new GenerateImageException('Background color could not be allocated');
    99         }
    100 
    101         imagefill($image, 0, 0, $backgroundColor);
    102 
    103         foreach ($data['matrix'] as $row => $values) {
    104             foreach ($values as $column => $value) {
    105                 if (1 === $value) {
    106                     imagefilledrectangle($image, $column * $baseSize, $row * $baseSize, intval(($column + 1) * $baseSize), intval(($row + 1) * $baseSize), $foregroundColor);
     110        if ($qrCode->getBackgroundColor()->getAlpha() > 0) {
     111            imagesavealpha($targetImage, true);
     112        }
     113
     114        $result = new PngResult($matrix, $targetImage);
     115
     116        if ($logo instanceof LogoInterface) {
     117            $result = $this->addLogo($logo, $result);
     118        }
     119
     120        if ($label instanceof LabelInterface) {
     121            $result = $this->addLabel($label, $result);
     122        }
     123
     124        return $result;
     125    }
     126
     127    private function addLogo(LogoInterface $logo, PngResult $result): PngResult
     128    {
     129        $logoImageData = LogoImageData::createForLogo($logo);
     130
     131        if ('image/svg+xml' === $logoImageData->getMimeType()) {
     132            throw new \Exception('PNG Writer does not support SVG logo');
     133        }
     134
     135        $targetImage = $result->getImage();
     136        $matrix = $result->getMatrix();
     137
     138        if ($logoImageData->getPunchoutBackground()) {
     139            /** @var int $transparent */
     140            $transparent = imagecolorallocatealpha($targetImage, 255, 255, 255, 127);
     141            imagealphablending($targetImage, false);
     142            $xOffsetStart = intval($matrix->getOuterSize() / 2 - $logoImageData->getWidth() / 2);
     143            $yOffsetStart = intval($matrix->getOuterSize() / 2 - $logoImageData->getHeight() / 2);
     144            for ($xOffset = $xOffsetStart; $xOffset < $xOffsetStart + $logoImageData->getWidth(); ++$xOffset) {
     145                for ($yOffset = $yOffsetStart; $yOffset < $yOffsetStart + $logoImageData->getHeight(); ++$yOffset) {
     146                    imagesetpixel($targetImage, $xOffset, $yOffset, $transparent);
    107147                }
    108148            }
    109149        }
    110150
    111         return $image;
    112     }
    113 
    114     /**
    115      * @param mixed        $baseImage
    116      * @param array<mixed> $data
    117      *
    118      * @return mixed
    119      */
    120     private function createInterpolatedImage($baseImage, array $data, QrCodeInterface $qrCode)
    121     {
    122         $image = imagecreatetruecolor($data['outer_width'], $data['outer_height']);
    123 
    124         if (!$image) {
    125             throw new GenerateImageException('Unable to generate image: check your GD installation');
    126         }
    127 
    128         $backgroundColor = imagecolorallocatealpha($image, $qrCode->getBackgroundColor()['r'], $qrCode->getBackgroundColor()['g'], $qrCode->getBackgroundColor()['b'], $qrCode->getBackgroundColor()['a']);
    129         if (!is_int($backgroundColor)) {
    130             throw new GenerateImageException('Background color could not be allocated');
    131         }
    132 
    133         imagefill($image, 0, 0, $backgroundColor);
    134         imagecopyresampled($image, $baseImage, (int) $data['margin_left'], (int) $data['margin_left'], 0, 0, (int) $data['inner_width'], (int) $data['inner_height'], imagesx($baseImage), imagesy($baseImage));
    135 
    136         if ($qrCode->getBackgroundColor()['a'] > 0) {
    137             imagesavealpha($image, true);
    138         }
    139 
    140         return $image;
    141     }
    142 
    143     /**
    144      * @param mixed $sourceImage
    145      *
    146      * @return mixed
    147      */
    148     private function addLogo($sourceImage, string $logoPath, int $logoWidth = null, int $logoHeight = null)
    149     {
    150         $mimeType = $this->getMimeType($logoPath);
    151         $logoImage = imagecreatefromstring(strval(file_get_contents($logoPath)));
    152 
    153         if ('image/svg+xml' === $mimeType && (null === $logoHeight || null === $logoWidth)) {
    154             throw new MissingLogoHeightException('SVG Logos require an explicit height set via setLogoSize($width, $height)');
    155         }
    156 
    157         if (!$logoImage) {
    158             throw new GenerateImageException('Unable to generate image: check your GD installation or logo path');
    159         }
    160 
    161         $logoSourceWidth = imagesx($logoImage);
    162         $logoSourceHeight = imagesy($logoImage);
    163 
    164         if (null === $logoWidth) {
    165             $logoWidth = $logoSourceWidth;
    166         }
    167 
    168         if (null === $logoHeight) {
    169             $aspectRatio = $logoWidth / $logoSourceWidth;
    170             $logoHeight = intval($logoSourceHeight * $aspectRatio);
    171         }
    172 
    173         $logoX = imagesx($sourceImage) / 2 - $logoWidth / 2;
    174         $logoY = imagesy($sourceImage) / 2 - $logoHeight / 2;
    175 
    176         imagecopyresampled($sourceImage, $logoImage, intval($logoX), intval($logoY), 0, 0, $logoWidth, $logoHeight, $logoSourceWidth, $logoSourceHeight);
     151        imagecopyresampled(
     152            $targetImage,
     153            $logoImageData->getImage(),
     154            intval($matrix->getOuterSize() / 2 - $logoImageData->getWidth() / 2),
     155            intval($matrix->getOuterSize() / 2 - $logoImageData->getHeight() / 2),
     156            0,
     157            0,
     158            $logoImageData->getWidth(),
     159            $logoImageData->getHeight(),
     160            imagesx($logoImageData->getImage()),
     161            imagesy($logoImageData->getImage())
     162        );
    177163
    178164        if (PHP_VERSION_ID < 80000) {
    179             imagedestroy($logoImage);
    180         }
    181 
    182         return $sourceImage;
    183     }
    184 
    185     /**
    186      * @param mixed      $sourceImage
    187      * @param array<int> $labelMargin
    188      * @param array<int> $foregroundColor
    189      * @param array<int> $backgroundColor
    190      *
    191      * @return mixed
    192      */
    193     private function addLabel($sourceImage, string $label, string $labelFontPath, int $labelFontSize, string $labelAlignment, array $labelMargin, array $foregroundColor, array $backgroundColor)
    194     {
    195         if (!function_exists('imagettfbbox')) {
    196             throw new MissingFunctionException('Missing function "imagettfbbox", please make sure you installed the FreeType library');
    197         }
    198 
    199         $labelBox = imagettfbbox($labelFontSize, 0, $labelFontPath, $label);
    200         if (!$labelBox) {
    201             throw new GenerateImageException('Unable to add label: check your GD installation');
    202         }
    203 
    204         $labelBoxWidth = intval($labelBox[2] - $labelBox[0]);
    205         $labelBoxHeight = intval($labelBox[0] - $labelBox[7]);
    206 
    207         $sourceWidth = imagesx($sourceImage);
    208         $sourceHeight = imagesy($sourceImage);
    209         $targetWidth = $sourceWidth;
    210         $targetHeight = $sourceHeight + $labelBoxHeight + $labelMargin['t'] + $labelMargin['b'];
    211 
    212         // Create empty target image
    213         $targetImage = imagecreatetruecolor($targetWidth, $targetHeight);
    214 
    215         if (!$targetImage) {
    216             throw new GenerateImageException('Unable to generate image: check your GD installation');
    217         }
    218 
    219         $foregroundColor = imagecolorallocate($targetImage, $foregroundColor['r'], $foregroundColor['g'], $foregroundColor['b']);
    220         if (!is_int($foregroundColor)) {
    221             throw new GenerateImageException('Foreground color could not be allocated');
    222         }
    223 
    224         $backgroundColor = imagecolorallocate($targetImage, $backgroundColor['r'], $backgroundColor['g'], $backgroundColor['b']);
    225         if (!is_int($backgroundColor)) {
    226             throw new GenerateImageException('Background color could not be allocated');
    227         }
    228 
    229         imagefill($targetImage, 0, 0, $backgroundColor);
    230 
    231         // Copy source image to target image
    232         imagecopyresampled($targetImage, $sourceImage, 0, 0, 0, 0, $sourceWidth, $sourceHeight, $sourceWidth, $sourceHeight);
    233 
    234         if (PHP_VERSION_ID < 80000) {
    235             imagedestroy($sourceImage);
    236         }
    237 
    238         switch ($labelAlignment) {
    239             case LabelAlignment::LEFT:
    240                 $labelX = $labelMargin['l'];
    241                 break;
    242             case LabelAlignment::RIGHT:
    243                 $labelX = $targetWidth - $labelBoxWidth - $labelMargin['r'];
    244                 break;
    245             default:
    246                 $labelX = intval($targetWidth / 2 - $labelBoxWidth / 2);
    247                 break;
    248         }
    249 
    250         $labelY = $targetHeight - $labelMargin['b'];
    251         imagettftext($targetImage, $labelFontSize, 0, $labelX, $labelY, $foregroundColor, $labelFontPath, $label);
    252 
    253         return $targetImage;
    254     }
    255 
    256     /**
    257      * @param mixed $image
    258      */
    259     private function imageToString($image): string
    260     {
    261         ob_start();
    262         imagepng($image);
    263 
    264         return (string) ob_get_clean();
    265     }
    266 
    267     public static function getContentType(): string
    268     {
    269         return 'image/png';
    270     }
    271 
    272     public static function getSupportedExtensions(): array
    273     {
    274         return ['png'];
    275     }
    276 
    277     public function getName(): string
    278     {
    279         return 'png';
     165            imagedestroy($logoImageData->getImage());
     166        }
     167
     168        return new PngResult($matrix, $targetImage);
     169    }
     170
     171    private function addLabel(LabelInterface $label, PngResult $result): PngResult
     172    {
     173        $targetImage = $result->getImage();
     174
     175        $labelImageData = LabelImageData::createForLabel($label);
     176
     177        /** @var int $textColor */
     178        $textColor = imagecolorallocatealpha(
     179            $targetImage,
     180            $label->getTextColor()->getRed(),
     181            $label->getTextColor()->getGreen(),
     182            $label->getTextColor()->getBlue(),
     183            $label->getTextColor()->getAlpha()
     184        );
     185
     186        $x = intval(imagesx($targetImage) / 2 - $labelImageData->getWidth() / 2);
     187        $y = imagesy($targetImage) - $label->getMargin()->getBottom();
     188
     189        if ($label->getAlignment() instanceof LabelAlignmentLeft) {
     190            $x = $label->getMargin()->getLeft();
     191        } elseif ($label->getAlignment() instanceof LabelAlignmentRight) {
     192            $x = imagesx($targetImage) - $labelImageData->getWidth() - $label->getMargin()->getRight();
     193        }
     194
     195        imagettftext($targetImage, $label->getFont()->getSize(), 0, $x, $y, $textColor, $label->getFont()->getPath(), $label->getText());
     196
     197        return new PngResult($result->getMatrix(), $targetImage);
     198    }
     199
     200    public function validateResult(ResultInterface $result, string $expectedData): void
     201    {
     202        $string = $result->getString();
     203
     204        if (!class_exists(QrReader::class)) {
     205            throw ValidationException::createForMissingPackage('khanamiryan/qrcode-detector-decoder');
     206        }
     207
     208        if (PHP_VERSION_ID >= 80000) {
     209            throw ValidationException::createForIncompatiblePhpVersion();
     210        }
     211
     212        $reader = new QrReader($string, QrReader::SOURCE_TYPE_BLOB);
     213        if ($reader->text() !== $expectedData) {
     214            throw ValidationException::createForInvalidData($expectedData, strval($reader->text()));
     215        }
    280216    }
    281217}
  • qr-code-management/trunk/vendor/endroid/qr-code/src/Writer/SvgWriter.php

    r3609180 r3846961  
    33declare(strict_types=1);
    44
    5 /*
    6  * (c) Jeroen van den Enden <info@endroid.nl>
    7  *
    8  * This source file is subject to the MIT license that is bundled
    9  * with this source code in the file LICENSE.
    10  */
    11 
    125namespace Endroid\QrCode\Writer;
    136
    14 use Endroid\QrCode\Exception\GenerateImageException;
    15 use Endroid\QrCode\Exception\MissingLogoHeightException;
    16 use Endroid\QrCode\Exception\ValidationException;
     7use Endroid\QrCode\Bacon\MatrixFactory;
     8use Endroid\QrCode\ImageData\LogoImageData;
     9use Endroid\QrCode\Label\LabelInterface;
     10use Endroid\QrCode\Logo\LogoInterface;
    1711use Endroid\QrCode\QrCodeInterface;
    18 use SimpleXMLElement;
     12use Endroid\QrCode\Writer\Result\ResultInterface;
     13use Endroid\QrCode\Writer\Result\SvgResult;
    1914
    20 class SvgWriter extends AbstractWriter
     15final class SvgWriter implements WriterInterface
    2116{
    22     public function writeString(QrCodeInterface $qrCode): string
     17    public const DECIMAL_PRECISION = 10;
     18    public const WRITER_OPTION_BLOCK_ID = 'block_id';
     19    public const WRITER_OPTION_EXCLUDE_XML_DECLARATION = 'exclude_xml_declaration';
     20    public const WRITER_OPTION_EXCLUDE_SVG_WIDTH_AND_HEIGHT = 'exclude_svg_width_and_height';
     21    public const WRITER_OPTION_FORCE_XLINK_HREF = 'force_xlink_href';
     22
     23    public function write(QrCodeInterface $qrCode, LogoInterface $logo = null, LabelInterface $label = null, array $options = []): ResultInterface
    2324    {
    24         $options = $qrCode->getWriterOptions();
    25 
    26         if ($qrCode->getValidateResult()) {
    27             throw new ValidationException('Built-in validation reader can not check SVG images: please disable via setValidateResult(false)');
     25        if (!isset($options[self::WRITER_OPTION_BLOCK_ID])) {
     26            $options[self::WRITER_OPTION_BLOCK_ID] = 'block';
    2827        }
    2928
    30         $data = $qrCode->getData();
     29        if (!isset($options[self::WRITER_OPTION_EXCLUDE_XML_DECLARATION])) {
     30            $options[self::WRITER_OPTION_EXCLUDE_XML_DECLARATION] = false;
     31        }
    3132
    32         $svg = new SimpleXMLElement('<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"/>');
    33         $svg->addAttribute('version', '1.1');
    34         $svg->addAttribute('width', $data['outer_width'].'px');
    35         $svg->addAttribute('height', $data['outer_height'].'px');
    36         $svg->addAttribute('viewBox', '0 0 '.$data['outer_width'].' '.$data['outer_height']);
    37         $svg->addChild('defs');
     33        if (!isset($options[self::WRITER_OPTION_EXCLUDE_SVG_WIDTH_AND_HEIGHT])) {
     34            $options[self::WRITER_OPTION_EXCLUDE_SVG_WIDTH_AND_HEIGHT] = false;
     35        }
    3836
    39         // Block definition
    40         $block_id = isset($options['rect_id']) && $options['rect_id'] ? $options['rect_id'] : 'block';
    41         $blockDefinition = $svg->defs->addChild('rect');
    42         $blockDefinition->addAttribute('id', $block_id);
    43         $blockDefinition->addAttribute('width', strval($data['block_size']));
    44         $blockDefinition->addAttribute('height', strval($data['block_size']));
    45         $blockDefinition->addAttribute('fill', '#'.sprintf('%02x%02x%02x', $qrCode->getForegroundColor()['r'], $qrCode->getForegroundColor()['g'], $qrCode->getForegroundColor()['b']));
    46         $blockDefinition->addAttribute('fill-opacity', strval($this->getOpacity($qrCode->getForegroundColor()['a'])));
     37        $matrixFactory = new MatrixFactory();
     38        $matrix = $matrixFactory->create($qrCode);
    4739
    48         // Background
    49         $background = $svg->addChild('rect');
     40        $xml = new \SimpleXMLElement('<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"/>');
     41        $xml->addAttribute('version', '1.1');
     42        if (!$options[self::WRITER_OPTION_EXCLUDE_SVG_WIDTH_AND_HEIGHT]) {
     43            $xml->addAttribute('width', $matrix->getOuterSize().'px');
     44            $xml->addAttribute('height', $matrix->getOuterSize().'px');
     45        }
     46        $xml->addAttribute('viewBox', '0 0 '.$matrix->getOuterSize().' '.$matrix->getOuterSize());
     47        $xml->addChild('defs');
     48
     49        $blockDefinition = $xml->defs->addChild('rect');
     50        $blockDefinition->addAttribute('id', strval($options[self::WRITER_OPTION_BLOCK_ID]));
     51        $blockDefinition->addAttribute('width', number_format($matrix->getBlockSize(), self::DECIMAL_PRECISION, '.', ''));
     52        $blockDefinition->addAttribute('height', number_format($matrix->getBlockSize(), self::DECIMAL_PRECISION, '.', ''));
     53        $blockDefinition->addAttribute('fill', '#'.sprintf('%02x%02x%02x', $qrCode->getForegroundColor()->getRed(), $qrCode->getForegroundColor()->getGreen(), $qrCode->getForegroundColor()->getBlue()));
     54        $blockDefinition->addAttribute('fill-opacity', strval($qrCode->getForegroundColor()->getOpacity()));
     55
     56        $background = $xml->addChild('rect');
    5057        $background->addAttribute('x', '0');
    5158        $background->addAttribute('y', '0');
    52         $background->addAttribute('width', strval($data['outer_width']));
    53         $background->addAttribute('height', strval($data['outer_height']));
    54         $background->addAttribute('fill', '#'.sprintf('%02x%02x%02x', $qrCode->getBackgroundColor()['r'], $qrCode->getBackgroundColor()['g'], $qrCode->getBackgroundColor()['b']));
    55         $background->addAttribute('fill-opacity', strval($this->getOpacity($qrCode->getBackgroundColor()['a'])));
     59        $background->addAttribute('width', strval($matrix->getOuterSize()));
     60        $background->addAttribute('height', strval($matrix->getOuterSize()));
     61        $background->addAttribute('fill', '#'.sprintf('%02x%02x%02x', $qrCode->getBackgroundColor()->getRed(), $qrCode->getBackgroundColor()->getGreen(), $qrCode->getBackgroundColor()->getBlue()));
     62        $background->addAttribute('fill-opacity', strval($qrCode->getBackgroundColor()->getOpacity()));
    5663
    57         foreach ($data['matrix'] as $row => $values) {
    58             foreach ($values as $column => $value) {
    59                 if (1 === $value) {
    60                     $block = $svg->addChild('use');
    61                     $block->addAttribute('x', strval($data['margin_left'] + $data['block_size'] * $column));
    62                     $block->addAttribute('y', strval($data['margin_left'] + $data['block_size'] * $row));
    63                     $block->addAttribute('xlink:href', '#'.$block_id, 'http://www.w3.org/1999/xlink');
     64        for ($rowIndex = 0; $rowIndex < $matrix->getBlockCount(); ++$rowIndex) {
     65            for ($columnIndex = 0; $columnIndex < $matrix->getBlockCount(); ++$columnIndex) {
     66                if (1 === $matrix->getBlockValue($rowIndex, $columnIndex)) {
     67                    $block = $xml->addChild('use');
     68                    $block->addAttribute('x', number_format($matrix->getMarginLeft() + $matrix->getBlockSize() * $columnIndex, self::DECIMAL_PRECISION, '.', ''));
     69                    $block->addAttribute('y', number_format($matrix->getMarginLeft() + $matrix->getBlockSize() * $rowIndex, self::DECIMAL_PRECISION, '.', ''));
     70                    $block->addAttribute('xlink:href', '#'.$options[self::WRITER_OPTION_BLOCK_ID], 'http://www.w3.org/1999/xlink');
    6471                }
    6572            }
    6673        }
    6774
    68         $logoPath = $qrCode->getLogoPath();
    69         if (is_string($logoPath)) {
    70             $forceXlinkHref = false;
    71             if (isset($options['force_xlink_href']) && $options['force_xlink_href']) {
    72                 $forceXlinkHref = true;
    73             }
     75        $result = new SvgResult($matrix, $xml, boolval($options[self::WRITER_OPTION_EXCLUDE_XML_DECLARATION]));
    7476
    75             $this->addLogo($svg, $data['outer_width'], $data['outer_height'], $logoPath, $qrCode->getLogoWidth(), $qrCode->getLogoHeight(), $forceXlinkHref);
     77        if ($logo instanceof LogoInterface) {
     78            $this->addLogo($logo, $result, $options);
    7679        }
    7780
    78         $xml = $svg->asXML();
     81        return $result;
     82    }
    7983
    80         if (!is_string($xml)) {
    81             throw new GenerateImageException('Unable to save SVG XML');
     84    /** @param array<mixed> $options */
     85    private function addLogo(LogoInterface $logo, SvgResult $result, array $options): void
     86    {
     87        $logoImageData = LogoImageData::createForLogo($logo);
     88
     89        if (!isset($options[self::WRITER_OPTION_FORCE_XLINK_HREF])) {
     90            $options[self::WRITER_OPTION_FORCE_XLINK_HREF] = false;
    8291        }
    8392
    84         if (isset($options['exclude_xml_declaration']) && $options['exclude_xml_declaration']) {
    85             $xml = str_replace("<?xml version=\"1.0\"?>\n", '', $xml);
    86         }
     93        $xml = $result->getXml();
    8794
    88         return $xml;
    89     }
     95        /** @var \SimpleXMLElement $xmlAttributes */
     96        $xmlAttributes = $xml->attributes();
    9097
    91     private function addLogo(SimpleXMLElement $svg, int $imageWidth, int $imageHeight, string $logoPath, int $logoWidth = null, int $logoHeight = null, bool $forceXlinkHref = false): void
    92     {
    93         $mimeType = $this->getMimeType($logoPath);
    94         $imageData = file_get_contents($logoPath);
     98        $x = intval($xmlAttributes->width) / 2 - $logoImageData->getWidth() / 2;
     99        $y = intval($xmlAttributes->height) / 2 - $logoImageData->getHeight() / 2;
    95100
    96         if (!is_string($imageData)) {
    97             throw new GenerateImageException('Unable to read image data: check your logo path');
    98         }
    99 
    100         if ('image/svg+xml' === $mimeType && (null === $logoHeight || null === $logoWidth)) {
    101             throw new MissingLogoHeightException('SVG Logos require an explicit height set via setLogoSize($width, $height)');
    102         }
    103 
    104         if (null === $logoHeight || null === $logoWidth) {
    105             $logoImage = imagecreatefromstring(strval($imageData));
    106 
    107             if (!$logoImage) {
    108                 throw new GenerateImageException('Unable to generate image: check your GD installation or logo path');
    109             }
    110 
    111             /** @var mixed $logoImage */
    112             $logoSourceWidth = imagesx($logoImage);
    113             $logoSourceHeight = imagesy($logoImage);
    114 
    115             if (PHP_VERSION_ID < 80000) {
    116                 imagedestroy($logoImage);
    117             }
    118 
    119             if (null === $logoWidth) {
    120                 $logoWidth = $logoSourceWidth;
    121             }
    122 
    123             if (null === $logoHeight) {
    124                 $aspectRatio = $logoWidth / $logoSourceWidth;
    125                 $logoHeight = intval($logoSourceHeight * $aspectRatio);
    126             }
    127         }
    128 
    129         $logoX = $imageWidth / 2 - $logoWidth / 2;
    130         $logoY = $imageHeight / 2 - $logoHeight / 2;
    131 
    132         $imageDefinition = $svg->addChild('image');
    133         $imageDefinition->addAttribute('x', strval($logoX));
    134         $imageDefinition->addAttribute('y', strval($logoY));
    135         $imageDefinition->addAttribute('width', strval($logoWidth));
    136         $imageDefinition->addAttribute('height', strval($logoHeight));
     101        $imageDefinition = $xml->addChild('image');
     102        $imageDefinition->addAttribute('x', strval($x));
     103        $imageDefinition->addAttribute('y', strval($y));
     104        $imageDefinition->addAttribute('width', strval($logoImageData->getWidth()));
     105        $imageDefinition->addAttribute('height', strval($logoImageData->getHeight()));
    137106        $imageDefinition->addAttribute('preserveAspectRatio', 'none');
    138107
    139         // xlink:href is actually deprecated, but still required when placing the qr code in a pdf.
    140         // SimpleXML strips out the xlink part by using addAttribute(), so it must be set directly.
    141         if ($forceXlinkHref) {
    142             $imageDefinition['xlink:href'] = 'data:'.$mimeType.';base64,'.base64_encode($imageData);
     108        if ($options[self::WRITER_OPTION_FORCE_XLINK_HREF]) {
     109            $imageDefinition->addAttribute('xlink:href', $logoImageData->createDataUri(), 'http://www.w3.org/1999/xlink');
    143110        } else {
    144             $imageDefinition->addAttribute('href', 'data:'.$mimeType.';base64,'.base64_encode($imageData));
     111            $imageDefinition->addAttribute('href', $logoImageData->createDataUri());
    145112        }
    146113    }
    147 
    148     private function getOpacity(int $alpha): float
    149     {
    150         $opacity = 1 - $alpha / 127;
    151 
    152         return $opacity;
    153     }
    154 
    155     public static function getContentType(): string
    156     {
    157         return 'image/svg+xml';
    158     }
    159 
    160     public static function getSupportedExtensions(): array
    161     {
    162         return ['svg'];
    163     }
    164 
    165     public function getName(): string
    166     {
    167         return 'svg';
    168     }
    169114}
  • qr-code-management/trunk/vendor/endroid/qr-code/src/Writer/WriterInterface.php

    r3609180 r3846961  
    33declare(strict_types=1);
    44
    5 /*
    6  * (c) Jeroen van den Enden <info@endroid.nl>
    7  *
    8  * This source file is subject to the MIT license that is bundled
    9  * with this source code in the file LICENSE.
    10  */
    11 
    125namespace Endroid\QrCode\Writer;
    136
     7use Endroid\QrCode\Label\LabelInterface;
     8use Endroid\QrCode\Logo\LogoInterface;
    149use Endroid\QrCode\QrCodeInterface;
     10use Endroid\QrCode\Writer\Result\ResultInterface;
    1511
    1612interface WriterInterface
    1713{
    18     public function writeString(QrCodeInterface $qrCode): string;
    19 
    20     public function writeDataUri(QrCodeInterface $qrCode): string;
    21 
    22     public function writeFile(QrCodeInterface $qrCode, string $path): void;
    23 
    24     public static function getContentType(): string;
    25 
    26     public static function supportsExtension(string $extension): bool;
    27 
    28     /** @return array<string> */
    29     public static function getSupportedExtensions(): array;
    30 
    31     public function getName(): string;
     14    /** @param array<mixed> $options */
     15    public function write(QrCodeInterface $qrCode, LogoInterface $logo = null, LabelInterface $label = null, array $options = []): ResultInterface;
    3216}
Note: See TracChangeset for help on using the changeset viewer.