Changeset 3485791
- Timestamp:
- 03/18/2026 02:46:28 PM (2 weeks ago)
- Location:
- gsheet-tables/trunk
- Files:
-
- 5 edited
-
assets/js/frontend.js (modified) (2 diffs)
-
gsheet-tables.php (modified) (2 diffs)
-
includes/admin/views/settings-page.php (modified) (2 diffs)
-
includes/class-google-sheets.php (modified) (1 diff)
-
readme.txt (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
gsheet-tables/trunk/assets/js/frontend.js
r3478662 r3485791 1144 1144 cellValue = cellValue.replace(/\n+$/, ''); 1145 1145 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 } 1147 1158 $tr.append($td); 1148 1159 }); … … 1620 1631 // ページネーションを追加 1621 1632 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; 1622 1705 }; 1623 1706 -
gsheet-tables/trunk/gsheet-tables.php
r3478662 r3485791 4 4 * Plugin URI: https://wordpress.org/plugins/gsheet-tables/ 5 5 * Description: Display Google Sheets data as interactive tables in WordPress with real-time filtering, sorting, and pagination capabilities. 6 * Version: 1.0.1 06 * Version: 1.0.11 7 7 * Author: doublecracker 8 8 * Author URI: https://github.com/doublecracker … … 49 49 50 50 // プラグインのバージョン 51 define('GSHEET_TABLES_VERSION', '1.0.1 0');51 define('GSHEET_TABLES_VERSION', '1.0.11'); 52 52 define('GSHEET_TABLES_PLUGIN_DIR', plugin_dir_path(__FILE__)); 53 53 define('GSHEET_TABLES_PLUGIN_URL', plugin_dir_url(__FILE__)); -
gsheet-tables/trunk/includes/admin/views/settings-page.php
r3478662 r3485791 76 76 </tr> 77 77 </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> 78 97 79 98 <h2 class="title"><?php esc_html_e('Google Sheets API設定', 'gsheet-tables'); ?></h2> … … 85 104 <td> 86 105 <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> 88 108 </td> 89 109 </tr> -
gsheet-tables/trunk/includes/class-google-sheets.php
r3478662 r3485791 293 293 // 最初の行をヘッダーとして取得 294 294 $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 } 295 310 296 311 // ヘッダーが空の場合は空配列を返す -
gsheet-tables/trunk/readme.txt
r3478662 r3485791 5 5 Tested up to: 6.9 6 6 Requires PHP: 7.4 7 Stable tag: 1.0.1 07 Stable tag: 1.0.11 8 8 License: GPLv2 or later 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html … … 14 14 15 15 GSheet Tables displays Google Sheets data on WordPress sites. Update your spreadsheet and the table updates automatically. 16 17 You can also make text clickable by entering links in CSV-friendly formats like: 18 `Label|URL` or `Label (URL)`. 16 19 17 20 = Key Features = … … 40 43 * UTF-8 BOM CSV for Excel compatibility 41 44 * 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 42 50 43 51 * **Custom styling** … … 126 134 はい、管理画面のテーブル編集ページで「カスタムスタイル設定」から、罫線、文字サイズ、色などを設定できます。また、カスタムCSSも入力可能です。 127 135 136 = Why not use Google Drive/Sheets API? = 137 138 To keep setup simple for site owners, this plugin uses public CSV export. 139 That 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 143 CSV export does not include the underlying URL for `HYPERLINK()` or rich-text links. 144 Use a URL column or `Label|URL` / `Label (URL)` to display clickable links. 145 128 146 = レスポンシブデザインに対応していますか? = 129 147 … … 141 159 142 160 == 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. 143 165 144 166 = 1.0.10 = … … 202 224 == Upgrade Notice == 203 225 226 = 1.0.11 = 227 Add CSV-friendly link formats, clarify CSV vs API rationale, and document duplicate header handling. 228 204 229 = 1.0.10 = 205 230 Fix 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.