Plugin Directory

Changeset 3485791


Ignore:
Timestamp:
03/18/2026 02:46:28 PM (2 weeks ago)
Author:
doublecracker
Message:

Release 1.0.11

Location:
gsheet-tables/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • gsheet-tables/trunk/assets/js/frontend.js

    r3478662 r3485791  
    11441144                cellValue = cellValue.replace(/\n+$/, '');
    11451145               
    1146                 var $td = $('<td>').text(cellValue);
     1146                var $td = $('<td>');
     1147                var linkData = self.parseHyperlinkCell(cellValue);
     1148                if (linkData) {
     1149                    var $link = $('<a>')
     1150                        .attr('href', linkData.url)
     1151                        .attr('target', '_blank')
     1152                        .attr('rel', 'noopener noreferrer')
     1153                        .text(linkData.text);
     1154                    $td.append($link);
     1155                } else {
     1156                    $td.text(cellValue);
     1157                }
    11471158                $tr.append($td);
    11481159            });
     
    16201631        // ページネーションを追加
    16211632        this.renderPagination();
     1633    };
     1634
     1635    /**
     1636     * セルのリンク情報を解析
     1637     * 対象: HYPERLINK関数、URL文字列
     1638     */
     1639    GSheetTable.prototype.parseHyperlinkCell = function(value) {
     1640        if (value === null || value === undefined) {
     1641            return null;
     1642        }
     1643
     1644        var str = String(value).trim();
     1645        if (str === '') {
     1646            return null;
     1647        }
     1648
     1649        // HYPERLINK関数: =HYPERLINK("url","text") または区切りが ; の場合
     1650        var formulaMatch = str.match(/^=HYPERLINK\(\s*"([^"]+)"\s*[,;]\s*"([^"]*)"\s*\)\s*$/i);
     1651        if (!formulaMatch) {
     1652            formulaMatch = str.match(/^=HYPERLINK\(\s*'([^']+)'\s*[,;]\s*'([^']*)'\s*\)\s*$/i);
     1653        }
     1654        if (formulaMatch) {
     1655            var formulaUrl = formulaMatch[1].trim();
     1656            var formulaText = formulaMatch[2] ? formulaMatch[2].trim() : '';
     1657            if (formulaUrl !== '') {
     1658                return {
     1659                    url: this.normalizeUrl(formulaUrl),
     1660                    text: formulaText !== '' ? formulaText : formulaUrl
     1661                };
     1662            }
     1663        }
     1664
     1665        // "表示名|URL" 形式をサポート(CSVでも表現可能)
     1666        // 例: 平塚中郡薬剤師会支援センター薬局|https://h-shiensenta.com/
     1667        var pipeMatch = str.match(/^(.+?)\s*\|\s*(https?:\/\/\S+|www\.\S+|mailto:\S+|tel:\S+)$/i);
     1668        if (pipeMatch) {
     1669            return {
     1670                url: this.normalizeUrl(pipeMatch[2].trim()),
     1671                text: pipeMatch[1].trim()
     1672            };
     1673        }
     1674
     1675        // "表示名 (URL)" 形式をサポート
     1676        // 例: 平塚中郡薬剤師会支援センター薬局 (https://h-shiensenta.com/)
     1677        var parenMatch = str.match(/^(.+?)\s*\((https?:\/\/[^)]+|www\.[^)]+|mailto:[^)]+|tel:[^)]+)\)\s*$/i);
     1678        if (parenMatch) {
     1679            return {
     1680                url: this.normalizeUrl(parenMatch[2].trim()),
     1681                text: parenMatch[1].trim()
     1682            };
     1683        }
     1684
     1685        // URL文字列のみの場合
     1686        if (/^(https?:\/\/|mailto:|tel:)/i.test(str) || /^www\./i.test(str)) {
     1687            var normalizedUrl = this.normalizeUrl(str);
     1688            return {
     1689                url: normalizedUrl,
     1690                text: str
     1691            };
     1692        }
     1693
     1694        return null;
     1695    };
     1696
     1697    /**
     1698     * URLを正規化(www. で始まる場合は http を付与)
     1699     */
     1700    GSheetTable.prototype.normalizeUrl = function(url) {
     1701        if (/^www\./i.test(url)) {
     1702            return 'http://' + url;
     1703        }
     1704        return url;
    16221705    };
    16231706   
  • gsheet-tables/trunk/gsheet-tables.php

    r3478662 r3485791  
    44 * Plugin URI: https://wordpress.org/plugins/gsheet-tables/
    55 * Description: Display Google Sheets data as interactive tables in WordPress with real-time filtering, sorting, and pagination capabilities.
    6  * Version: 1.0.10
     6 * Version: 1.0.11
    77 * Author: doublecracker
    88 * Author URI: https://github.com/doublecracker
     
    4949
    5050// プラグインのバージョン
    51 define('GSHEET_TABLES_VERSION', '1.0.10');
     51define('GSHEET_TABLES_VERSION', '1.0.11');
    5252define('GSHEET_TABLES_PLUGIN_DIR', plugin_dir_path(__FILE__));
    5353define('GSHEET_TABLES_PLUGIN_URL', plugin_dir_url(__FILE__));
  • gsheet-tables/trunk/includes/admin/views/settings-page.php

    r3478662 r3485791  
    7676            </tr>
    7777        </table>
     78
     79        <h2 class="title"><?php esc_html_e('リンク表示(CSV方式)', 'gsheet-tables'); ?></h2>
     80        <table class="form-table">
     81            <tr>
     82                <th scope="row">
     83                    <?php esc_html_e('入力形式', 'gsheet-tables'); ?>
     84                </th>
     85                <td>
     86                    <p class="description">
     87                        <?php esc_html_e('URLのみ: https://example.com/', 'gsheet-tables'); ?><br />
     88                        <?php esc_html_e('表示名つき: 表示名|https://example.com/', 'gsheet-tables'); ?><br />
     89                        <?php esc_html_e('括弧形式: 表示名 (https://example.com/)', 'gsheet-tables'); ?>
     90                    </p>
     91                    <p class="description">
     92                        <?php esc_html_e('HYPERLINK() 関数や文字リンクはCSVにURLが出ないためリンク化できません。', 'gsheet-tables'); ?>
     93                    </p>
     94                </td>
     95            </tr>
     96        </table>
    7897       
    7998        <h2 class="title"><?php esc_html_e('Google Sheets API設定', 'gsheet-tables'); ?></h2>
     
    85104                <td>
    86105                    <input type="text" id="google_api_key" name="google_api_key" class="regular-text" />
    87                     <p class="description"><?php esc_html_e('Google Sheets APIを使用する場合は、APIキーを入力してください。', 'gsheet-tables'); ?></p>
     106                    <p class="description"><?php esc_html_e('現在は公開CSV方式が標準のため、APIキーは不要です。', 'gsheet-tables'); ?></p>
     107                    <p class="description"><?php esc_html_e('APIを使う場合のみ、APIキーを入力してください。', 'gsheet-tables'); ?></p>
    88108                </td>
    89109            </tr>
  • gsheet-tables/trunk/includes/class-google-sheets.php

    r3478662 r3485791  
    293293        // 最初の行をヘッダーとして取得
    294294        $headers = str_getcsv(array_shift($lines));
     295        $headers = array_map('trim', $headers);
     296
     297        // 同名ヘッダーがある場合に重複を解消(後続は " (2)" などを付与)
     298        // これにより同名列の上書きを防ぎ、URL列の欠落を回避する
     299        $header_counts = array();
     300        foreach ($headers as $index => $header) {
     301            $base = $header !== '' ? $header : 'Column ' . ($index + 1);
     302            if (!isset($header_counts[$base])) {
     303                $header_counts[$base] = 1;
     304                $headers[$index] = $base;
     305            } else {
     306                $header_counts[$base]++;
     307                $headers[$index] = $base . ' (' . $header_counts[$base] . ')';
     308            }
     309        }
    295310       
    296311        // ヘッダーが空の場合は空配列を返す
  • gsheet-tables/trunk/readme.txt

    r3478662 r3485791  
    55Tested up to: 6.9
    66Requires PHP: 7.4
    7 Stable tag: 1.0.10
     7Stable tag: 1.0.11
    88License: GPLv2 or later
    99License URI: https://www.gnu.org/licenses/gpl-2.0.html
     
    1414
    1515GSheet Tables displays Google Sheets data on WordPress sites. Update your spreadsheet and the table updates automatically.
     16
     17You can also make text clickable by entering links in CSV-friendly formats like:
     18`Label|URL` or `Label (URL)`.
    1619
    1720= Key Features =
     
    4043  * UTF-8 BOM CSV for Excel compatibility
    4144  * Export visible columns only
     45
     46* **Link rendering (CSV-friendly)**
     47  * Plain URLs are clickable
     48  * `Label|URL` or `Label (URL)` formats for clickable text
     49  * `HYPERLINK()` and rich-text links are not available in CSV
    4250
    4351* **Custom styling**
     
    126134はい、管理画面のテーブル編集ページで「カスタムスタイル設定」から、罫線、文字サイズ、色などを設定できます。また、カスタムCSSも入力可能です。
    127135
     136= Why not use Google Drive/Sheets API? =
     137
     138To keep setup simple for site owners, this plugin uses public CSV export. 
     139That means no API keys, OAuth consent screens, or quota management are required.
     140
     141= Can I use HYPERLINK() or rich-text links from Sheets? =
     142
     143CSV export does not include the underlying URL for `HYPERLINK()` or rich-text links. 
     144Use a URL column or `Label|URL` / `Label (URL)` to display clickable links.
     145
    128146= レスポンシブデザインに対応していますか? =
    129147
     
    141159
    142160== Changelog ==
     161
     162= 1.0.11 =
     163* Add CSV-friendly link formats (`Label|URL` / `Label (URL)`) and clarify why the plugin uses public CSV instead of Google Drive/Sheets API.
     164* Document duplicate CSV header handling to prevent URL column overwrite.
    143165
    144166= 1.0.10 =
     
    202224== Upgrade Notice ==
    203225
     226= 1.0.11 =
     227Add CSV-friendly link formats, clarify CSV vs API rationale, and document duplicate header handling.
     228
    204229= 1.0.10 =
    205230Fix Plugin Check errors and warnings, add caching for get_table(), and improve performance. No breaking changes.
Note: See TracChangeset for help on using the changeset viewer.