Version Description
Download this release
Release Info
Developer | poporon |
Plugin | Pz-LinkCard |
Version | 2.0.1 |
Comparing to | |
See all releases |
Code changes from version 2.0.0.3 to 2.0.1
- js/mce-pz-lkc.js +1 -1
- languages/pz-linkcard-ja.mo +0 -0
- languages/pz-linkcard-ja.po +105 -77
- lib/pz-linkcard-cacheman-edit.php +40 -1
- lib/pz-linkcard-cacheman-list.php +25 -8
- lib/pz-linkcard-init.php +45 -2
- pz-linkcard.php +315 -210
- readme.txt +16 -0
js/mce-pz-lkc.js
CHANGED
@@ -9,7 +9,7 @@
|
|
9 |
ed.addCommand('insert_pz_linkcard', function() {
|
10 |
var insert_tag = window.prompt('Input URL', 'http://');
|
11 |
if (insert_tag !== null) {
|
12 |
-
ed.execCommand('mceInsertContent', 0, '[
|
13 |
}
|
14 |
});
|
15 |
},
|
9 |
ed.addCommand('insert_pz_linkcard', function() {
|
10 |
var insert_tag = window.prompt('Input URL', 'http://');
|
11 |
if (insert_tag !== null) {
|
12 |
+
ed.execCommand('mceInsertContent', 0, '[blogcard url="' + insert_tag + '"]');
|
13 |
}
|
14 |
});
|
15 |
},
|
languages/pz-linkcard-ja.mo
CHANGED
Binary file
|
languages/pz-linkcard-ja.po
CHANGED
@@ -4,8 +4,8 @@ msgid ""
|
|
4 |
msgstr ""
|
5 |
"Project-Id-Version: Pz-LinkCard\n"
|
6 |
"Report-Msgid-Bugs-To: http://wppolyglots.wordpress.com\n"
|
7 |
-
"POT-Creation-Date: 2017-
|
8 |
-
"PO-Revision-Date: 2017-
|
9 |
"Last-Translator: \n"
|
10 |
"Language-Team: poporon\n"
|
11 |
"Language: ja_JP\n"
|
@@ -19,237 +19,261 @@ msgstr ""
|
|
19 |
"Plural-Forms: nplurals=1; plural=0;\n"
|
20 |
"X-Poedit-SearchPath-0: ..\n"
|
21 |
|
22 |
-
#: ../pz-linkcard.php:
|
23 |
msgid "Incorrect URL specification."
|
24 |
msgstr "URLの指定が誤っています。"
|
25 |
|
26 |
-
#: ../pz-linkcard.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
msgid "Linkcard"
|
28 |
msgstr "リンクカード"
|
29 |
|
30 |
-
#: ../pz-linkcard.php:
|
31 |
msgid "Make Linkcard"
|
32 |
msgstr "リンクカードのショートコードを挿入する"
|
33 |
|
34 |
-
#: ../pz-linkcard.php:
|
35 |
msgid "LinkCard cache manager"
|
36 |
msgstr "リンクカード/DBキャッシュ管理"
|
37 |
|
38 |
-
#: ../pz-linkcard.php:
|
39 |
msgid "Pz LkC Cache"
|
40 |
msgstr "Pz カード管理"
|
41 |
|
42 |
-
#: ../pz-linkcard.php:
|
43 |
msgid "LinkCard Settings"
|
44 |
msgstr "リンクカード設定"
|
45 |
|
46 |
-
#: ../pz-linkcard.php:
|
47 |
msgid "Pz LinkCard"
|
48 |
msgstr "Pz カード設定"
|
49 |
|
50 |
-
#: ../pz-linkcard.php:
|
51 |
msgid "Settings"
|
52 |
msgstr "設定"
|
53 |
|
54 |
-
#: ../pz-linkcard.php:
|
55 |
msgid "Manage"
|
56 |
msgstr "管理"
|
57 |
|
58 |
#: ../lib/pz-linkcard-cacheman-edit.php:14
|
59 |
-
#: ../lib/pz-linkcard-cacheman-list.php:
|
60 |
msgid "ID"
|
61 |
msgstr ""
|
62 |
|
63 |
#: ../lib/pz-linkcard-cacheman-edit.php:18
|
64 |
-
#: ../lib/pz-linkcard-cacheman-list.php:
|
65 |
msgid "URL key"
|
66 |
msgstr "URLキー"
|
67 |
|
68 |
#: ../lib/pz-linkcard-cacheman-edit.php:22
|
69 |
-
#: ../lib/pz-linkcard-cacheman-list.php:
|
70 |
#: ../lib/pz-linkcard-settings.php:541
|
71 |
msgid "URL"
|
72 |
msgstr "URL"
|
73 |
|
74 |
-
#: ../lib/pz-linkcard-cacheman-edit.php:26 ../lib/pz-linkcard-edit.php:
|
75 |
-
msgid "Link type"
|
76 |
-
msgstr "外部/内部"
|
77 |
-
|
78 |
-
#: ../lib/pz-linkcard-cacheman-edit.php:30 ../lib/pz-linkcard-edit.php:29
|
79 |
msgid "Site name"
|
80 |
msgstr "サイト名称"
|
81 |
|
82 |
-
#: ../lib/pz-linkcard-cacheman-edit.php:
|
83 |
-
#: ../lib/pz-linkcard-cacheman-list.php:
|
84 |
msgid "Domain"
|
85 |
msgstr "ドメイン"
|
86 |
|
87 |
-
#: ../lib/pz-linkcard-cacheman-edit.php:
|
88 |
-
#: ../lib/pz-linkcard-cacheman-list.php:
|
89 |
#: ../lib/pz-linkcard-settings.php:512
|
90 |
msgid "Title"
|
91 |
msgstr "タイトル"
|
92 |
|
93 |
-
#: ../lib/pz-linkcard-cacheman-edit.php:
|
94 |
-
#: ../lib/pz-linkcard-cacheman-list.php:
|
95 |
#: ../lib/pz-linkcard-settings.php:569
|
96 |
msgid "Excerpt"
|
97 |
msgstr "抜粋文"
|
98 |
|
99 |
-
#: ../lib/pz-linkcard-cacheman-edit.php:
|
100 |
-
#: ../lib/pz-linkcard-cacheman-list.php:
|
101 |
msgid "Charset"
|
102 |
msgstr "文字セット"
|
103 |
|
104 |
-
#: ../lib/pz-linkcard-cacheman-edit.php:
|
105 |
msgid "->"
|
106 |
msgstr "→"
|
107 |
|
108 |
-
#: ../lib/pz-linkcard-cacheman-edit.php:
|
109 |
msgid "Thumbnail URL"
|
110 |
msgstr "サムネイルURL"
|
111 |
|
112 |
-
#: ../lib/pz-linkcard-cacheman-edit.php:
|
113 |
msgid "Favicon URL"
|
114 |
msgstr "ファビコンURL"
|
115 |
|
116 |
-
#: ../lib/pz-linkcard-cacheman-edit.php:
|
117 |
-
#: ../lib/pz-linkcard-cacheman-list.php:
|
118 |
msgid "Result code"
|
119 |
msgstr "結果コード"
|
120 |
|
121 |
-
#: ../lib/pz-linkcard-cacheman-edit.php:
|
122 |
-
#: ../lib/pz-linkcard-cacheman-list.php:
|
123 |
msgid "Post ID"
|
124 |
msgstr "記事ID"
|
125 |
|
126 |
-
#: ../lib/pz-linkcard-cacheman-edit.php:
|
127 |
msgid "SNS"
|
128 |
msgstr ""
|
129 |
|
130 |
-
#: ../lib/pz-linkcard-cacheman-edit.php:
|
131 |
-
#: ../lib/pz-linkcard-cacheman-list.php:
|
132 |
msgid "Tw"
|
133 |
msgstr ""
|
134 |
|
135 |
-
#: ../lib/pz-linkcard-cacheman-edit.php:
|
136 |
-
#: ../lib/pz-linkcard-cacheman-list.php:
|
137 |
msgid "fb"
|
138 |
msgstr ""
|
139 |
|
140 |
-
#: ../lib/pz-linkcard-cacheman-edit.php:
|
141 |
-
#: ../lib/pz-linkcard-cacheman-list.php:
|
142 |
msgid "B!"
|
143 |
msgstr ""
|
144 |
|
145 |
-
#: ../lib/pz-linkcard-cacheman-edit.php:
|
146 |
msgid "Uptime"
|
147 |
msgstr "更新日時"
|
148 |
|
149 |
-
#: ../lib/pz-linkcard-cacheman-edit.php:
|
150 |
msgid "Next update"
|
151 |
msgstr "次回更新日時"
|
152 |
|
153 |
-
#: ../lib/pz-linkcard-cacheman-edit.php:
|
154 |
-
#: ../lib/pz-linkcard-cacheman-list.php:
|
155 |
msgid "Regist"
|
156 |
msgstr "登録日時"
|
157 |
|
158 |
-
#: ../lib/pz-linkcard-cacheman-edit.php:
|
159 |
msgid "Update"
|
160 |
msgstr "更新"
|
161 |
|
162 |
-
#: ../lib/pz-linkcard-cacheman-edit.php:
|
163 |
msgid "Cancel"
|
164 |
msgstr "キャンセル"
|
165 |
|
166 |
-
#: ../lib/pz-linkcard-cacheman-list.php:
|
167 |
msgid "All"
|
168 |
msgstr "すべて"
|
169 |
|
170 |
-
#: ../lib/pz-linkcard-cacheman-list.php:
|
171 |
msgid "Internal"
|
172 |
msgstr "内部リンク"
|
173 |
|
174 |
-
#: ../lib/pz-linkcard-cacheman-list.php:
|
175 |
msgid "External"
|
176 |
msgstr "外部リンク"
|
177 |
|
178 |
-
#: ../lib/pz-linkcard-cacheman-list.php:
|
179 |
msgid "Modify"
|
180 |
msgstr "更新あり"
|
181 |
|
182 |
-
#: ../lib/pz-linkcard-cacheman-list.php:
|
183 |
msgid "Select batch"
|
184 |
msgstr "一括処理を選択"
|
185 |
|
186 |
-
#: ../lib/pz-linkcard-cacheman-list.php:
|
187 |
-
#: ../lib/pz-linkcard-cacheman-list.php:
|
188 |
msgid "Select"
|
189 |
msgstr "選択してください"
|
190 |
|
191 |
-
#: ../lib/pz-linkcard-cacheman-list.php:
|
192 |
msgid "Renew cache"
|
193 |
msgstr "記事内容を再取得する"
|
194 |
|
195 |
-
#: ../lib/pz-linkcard-cacheman-list.php:
|
196 |
msgid "Renew SNS count"
|
197 |
msgstr "ソーシャルカウントを再取得する"
|
198 |
|
199 |
-
#: ../lib/pz-linkcard-cacheman-list.php:
|
200 |
msgid "Check status"
|
201 |
msgstr "リンクが有効かチェックする"
|
202 |
|
203 |
-
#: ../lib/pz-linkcard-cacheman-list.php:
|
204 |
msgid "Delete from cache"
|
205 |
msgstr "キャッシュから削除する"
|
206 |
|
207 |
-
#: ../lib/pz-linkcard-cacheman-list.php:
|
208 |
msgid "Submit"
|
209 |
msgstr "適用"
|
210 |
|
211 |
-
#: ../lib/pz-linkcard-cacheman-list.php:
|
212 |
msgid "Select domain"
|
213 |
msgstr "ドメインを選択"
|
214 |
|
215 |
-
#: ../lib/pz-linkcard-cacheman-list.php:
|
216 |
msgid "All domain"
|
217 |
msgstr "すべてのドメイン"
|
218 |
|
219 |
-
#: ../lib/pz-linkcard-cacheman-list.php:
|
220 |
msgid "Refine search"
|
221 |
msgstr "絞り込み検索"
|
222 |
|
223 |
-
#: ../lib/pz-linkcard-cacheman-list.php:
|
224 |
msgid "items"
|
225 |
msgstr "項目"
|
226 |
|
227 |
-
#: ../lib/pz-linkcard-cacheman-list.php:
|
228 |
msgid "Select all"
|
229 |
msgstr "すべて選択"
|
230 |
|
231 |
-
#: ../lib/pz-linkcard-cacheman-list.php:
|
232 |
msgid "(last)"
|
233 |
msgstr ""
|
234 |
|
235 |
-
#: ../lib/pz-linkcard-cacheman-list.php:
|
236 |
msgid "edit"
|
237 |
msgstr "編集"
|
238 |
|
239 |
-
#: ../lib/pz-linkcard-cacheman-list.php:
|
240 |
-
#: ../lib/pz-linkcard-cacheman-list.php:
|
241 |
msgid "Are you sure?"
|
242 |
msgstr "実行します。"
|
243 |
|
244 |
-
#: ../lib/pz-linkcard-cacheman-list.php:
|
245 |
msgid "renew"
|
246 |
msgstr "再取得"
|
247 |
|
248 |
-
#: ../lib/pz-linkcard-cacheman-list.php:
|
249 |
msgid "delete"
|
250 |
msgstr "削除"
|
251 |
|
252 |
-
#: ../lib/pz-linkcard-cacheman-list.php:
|
253 |
msgid "Export"
|
254 |
msgstr "エクスポート"
|
255 |
|
@@ -265,27 +289,31 @@ msgstr "キャッシュの更新に失敗しました"
|
|
265 |
msgid "Social count renew"
|
266 |
msgstr "ソーシャルカウントの再取得"
|
267 |
|
268 |
-
#: ../lib/pz-linkcard-cacheman.php:100 ../lib/pz-linkcard-cacheman.php:
|
269 |
-
#: ../lib/pz-linkcard-cacheman.php:
|
270 |
msgid "completed"
|
271 |
msgstr "完了しました"
|
272 |
|
273 |
-
#: ../lib/pz-linkcard-cacheman.php:
|
274 |
msgid "Alive check"
|
275 |
msgstr "リンク先のチェック"
|
276 |
|
277 |
-
#: ../lib/pz-linkcard-cacheman.php:
|
278 |
msgid "Cache renew"
|
279 |
msgstr "記事内容の再取得"
|
280 |
|
281 |
-
#: ../lib/pz-linkcard-cacheman.php:
|
282 |
msgid "Cache deleted"
|
283 |
msgstr "キャッシュから削除しました"
|
284 |
|
285 |
-
#: ../lib/pz-linkcard-cacheman.php:
|
286 |
msgid "Download Export File"
|
287 |
msgstr "エクスポートファイルをダウンロード"
|
288 |
|
|
|
|
|
|
|
|
|
289 |
#: ../lib/pz-linkcard-js.php:8
|
290 |
msgid "Insert Pz-LinkCard"
|
291 |
msgstr "リンクカード作成"
|
4 |
msgstr ""
|
5 |
"Project-Id-Version: Pz-LinkCard\n"
|
6 |
"Report-Msgid-Bugs-To: http://wppolyglots.wordpress.com\n"
|
7 |
+
"POT-Creation-Date: 2017-08-01 19:42+0900\n"
|
8 |
+
"PO-Revision-Date: 2017-08-01 19:43+0900\n"
|
9 |
"Last-Translator: \n"
|
10 |
"Language-Team: poporon\n"
|
11 |
"Language: ja_JP\n"
|
19 |
"Plural-Forms: nplurals=1; plural=0;\n"
|
20 |
"X-Poedit-SearchPath-0: ..\n"
|
21 |
|
22 |
+
#: ../pz-linkcard.php:265
|
23 |
msgid "Incorrect URL specification."
|
24 |
msgstr "URLの指定が誤っています。"
|
25 |
|
26 |
+
#: ../pz-linkcard.php:1066
|
27 |
+
msgid "Category"
|
28 |
+
msgstr "カテゴリー"
|
29 |
+
|
30 |
+
#: ../pz-linkcard.php:1066 ../pz-linkcard.php:1078
|
31 |
+
msgid "‘"
|
32 |
+
msgstr "「"
|
33 |
+
|
34 |
+
#: ../pz-linkcard.php:1066 ../pz-linkcard.php:1078
|
35 |
+
msgid "’"
|
36 |
+
msgstr "」"
|
37 |
+
|
38 |
+
#: ../pz-linkcard.php:1067 ../pz-linkcard.php:1079
|
39 |
+
msgid "("
|
40 |
+
msgstr "("
|
41 |
+
|
42 |
+
#: ../pz-linkcard.php:1067 ../pz-linkcard.php:1079
|
43 |
+
msgid "Count"
|
44 |
+
msgstr "件数"
|
45 |
+
|
46 |
+
#: ../pz-linkcard.php:1067 ../pz-linkcard.php:1079
|
47 |
+
msgid ")"
|
48 |
+
msgstr ")"
|
49 |
+
|
50 |
+
#: ../pz-linkcard.php:1078
|
51 |
+
msgid "Tag"
|
52 |
+
msgstr "タグ"
|
53 |
+
|
54 |
+
#: ../pz-linkcard.php:1432
|
55 |
msgid "Linkcard"
|
56 |
msgstr "リンクカード"
|
57 |
|
58 |
+
#: ../pz-linkcard.php:1432
|
59 |
msgid "Make Linkcard"
|
60 |
msgstr "リンクカードのショートコードを挿入する"
|
61 |
|
62 |
+
#: ../pz-linkcard.php:1459 ../lib/pz-linkcard-cacheman.php:6
|
63 |
msgid "LinkCard cache manager"
|
64 |
msgstr "リンクカード/DBキャッシュ管理"
|
65 |
|
66 |
+
#: ../pz-linkcard.php:1459
|
67 |
msgid "Pz LkC Cache"
|
68 |
msgstr "Pz カード管理"
|
69 |
|
70 |
+
#: ../pz-linkcard.php:1460 ../lib/pz-linkcard-settings.php:4
|
71 |
msgid "LinkCard Settings"
|
72 |
msgstr "リンクカード設定"
|
73 |
|
74 |
+
#: ../pz-linkcard.php:1460
|
75 |
msgid "Pz LinkCard"
|
76 |
msgstr "Pz カード設定"
|
77 |
|
78 |
+
#: ../pz-linkcard.php:1547
|
79 |
msgid "Settings"
|
80 |
msgstr "設定"
|
81 |
|
82 |
+
#: ../pz-linkcard.php:1547
|
83 |
msgid "Manage"
|
84 |
msgstr "管理"
|
85 |
|
86 |
#: ../lib/pz-linkcard-cacheman-edit.php:14
|
87 |
+
#: ../lib/pz-linkcard-cacheman-list.php:198 ../lib/pz-linkcard-edit.php:13
|
88 |
msgid "ID"
|
89 |
msgstr ""
|
90 |
|
91 |
#: ../lib/pz-linkcard-cacheman-edit.php:18
|
92 |
+
#: ../lib/pz-linkcard-cacheman-list.php:199 ../lib/pz-linkcard-edit.php:17
|
93 |
msgid "URL key"
|
94 |
msgstr "URLキー"
|
95 |
|
96 |
#: ../lib/pz-linkcard-cacheman-edit.php:22
|
97 |
+
#: ../lib/pz-linkcard-cacheman-list.php:200 ../lib/pz-linkcard-edit.php:21
|
98 |
#: ../lib/pz-linkcard-settings.php:541
|
99 |
msgid "URL"
|
100 |
msgstr "URL"
|
101 |
|
102 |
+
#: ../lib/pz-linkcard-cacheman-edit.php:26 ../lib/pz-linkcard-edit.php:29
|
|
|
|
|
|
|
|
|
103 |
msgid "Site name"
|
104 |
msgstr "サイト名称"
|
105 |
|
106 |
+
#: ../lib/pz-linkcard-cacheman-edit.php:30
|
107 |
+
#: ../lib/pz-linkcard-cacheman-list.php:204 ../lib/pz-linkcard-edit.php:33
|
108 |
msgid "Domain"
|
109 |
msgstr "ドメイン"
|
110 |
|
111 |
+
#: ../lib/pz-linkcard-cacheman-edit.php:34
|
112 |
+
#: ../lib/pz-linkcard-cacheman-list.php:201 ../lib/pz-linkcard-edit.php:37
|
113 |
#: ../lib/pz-linkcard-settings.php:512
|
114 |
msgid "Title"
|
115 |
msgstr "タイトル"
|
116 |
|
117 |
+
#: ../lib/pz-linkcard-cacheman-edit.php:38
|
118 |
+
#: ../lib/pz-linkcard-cacheman-list.php:202 ../lib/pz-linkcard-edit.php:41
|
119 |
#: ../lib/pz-linkcard-settings.php:569
|
120 |
msgid "Excerpt"
|
121 |
msgstr "抜粋文"
|
122 |
|
123 |
+
#: ../lib/pz-linkcard-cacheman-edit.php:42
|
124 |
+
#: ../lib/pz-linkcard-cacheman-list.php:203 ../lib/pz-linkcard-edit.php:45
|
125 |
msgid "Charset"
|
126 |
msgstr "文字セット"
|
127 |
|
128 |
+
#: ../lib/pz-linkcard-cacheman-edit.php:43 ../lib/pz-linkcard-edit.php:46
|
129 |
msgid "->"
|
130 |
msgstr "→"
|
131 |
|
132 |
+
#: ../lib/pz-linkcard-cacheman-edit.php:46 ../lib/pz-linkcard-edit.php:49
|
133 |
msgid "Thumbnail URL"
|
134 |
msgstr "サムネイルURL"
|
135 |
|
136 |
+
#: ../lib/pz-linkcard-cacheman-edit.php:50 ../lib/pz-linkcard-edit.php:53
|
137 |
msgid "Favicon URL"
|
138 |
msgstr "ファビコンURL"
|
139 |
|
140 |
+
#: ../lib/pz-linkcard-cacheman-edit.php:54
|
141 |
+
#: ../lib/pz-linkcard-cacheman-list.php:208 ../lib/pz-linkcard-edit.php:57
|
142 |
msgid "Result code"
|
143 |
msgstr "結果コード"
|
144 |
|
145 |
+
#: ../lib/pz-linkcard-cacheman-edit.php:92
|
146 |
+
#: ../lib/pz-linkcard-cacheman-list.php:207 ../lib/pz-linkcard-edit.php:61
|
147 |
msgid "Post ID"
|
148 |
msgstr "記事ID"
|
149 |
|
150 |
+
#: ../lib/pz-linkcard-cacheman-edit.php:101 ../lib/pz-linkcard-edit.php:65
|
151 |
msgid "SNS"
|
152 |
msgstr ""
|
153 |
|
154 |
+
#: ../lib/pz-linkcard-cacheman-edit.php:103
|
155 |
+
#: ../lib/pz-linkcard-cacheman-list.php:205 ../lib/pz-linkcard-edit.php:67
|
156 |
msgid "Tw"
|
157 |
msgstr ""
|
158 |
|
159 |
+
#: ../lib/pz-linkcard-cacheman-edit.php:104
|
160 |
+
#: ../lib/pz-linkcard-cacheman-list.php:205 ../lib/pz-linkcard-edit.php:68
|
161 |
msgid "fb"
|
162 |
msgstr ""
|
163 |
|
164 |
+
#: ../lib/pz-linkcard-cacheman-edit.php:105
|
165 |
+
#: ../lib/pz-linkcard-cacheman-list.php:205 ../lib/pz-linkcard-edit.php:69
|
166 |
msgid "B!"
|
167 |
msgstr ""
|
168 |
|
169 |
+
#: ../lib/pz-linkcard-cacheman-edit.php:109 ../lib/pz-linkcard-edit.php:73
|
170 |
msgid "Uptime"
|
171 |
msgstr "更新日時"
|
172 |
|
173 |
+
#: ../lib/pz-linkcard-cacheman-edit.php:113 ../lib/pz-linkcard-edit.php:77
|
174 |
msgid "Next update"
|
175 |
msgstr "次回更新日時"
|
176 |
|
177 |
+
#: ../lib/pz-linkcard-cacheman-edit.php:117
|
178 |
+
#: ../lib/pz-linkcard-cacheman-list.php:206 ../lib/pz-linkcard-edit.php:81
|
179 |
msgid "Regist"
|
180 |
msgstr "登録日時"
|
181 |
|
182 |
+
#: ../lib/pz-linkcard-cacheman-edit.php:122 ../lib/pz-linkcard-edit.php:86
|
183 |
msgid "Update"
|
184 |
msgstr "更新"
|
185 |
|
186 |
+
#: ../lib/pz-linkcard-cacheman-edit.php:122 ../lib/pz-linkcard-edit.php:86
|
187 |
msgid "Cancel"
|
188 |
msgstr "キャンセル"
|
189 |
|
190 |
+
#: ../lib/pz-linkcard-cacheman-list.php:135
|
191 |
msgid "All"
|
192 |
msgstr "すべて"
|
193 |
|
194 |
+
#: ../lib/pz-linkcard-cacheman-list.php:136
|
195 |
msgid "Internal"
|
196 |
msgstr "内部リンク"
|
197 |
|
198 |
+
#: ../lib/pz-linkcard-cacheman-list.php:137
|
199 |
msgid "External"
|
200 |
msgstr "外部リンク"
|
201 |
|
202 |
+
#: ../lib/pz-linkcard-cacheman-list.php:138
|
203 |
msgid "Modify"
|
204 |
msgstr "更新あり"
|
205 |
|
206 |
+
#: ../lib/pz-linkcard-cacheman-list.php:148
|
207 |
msgid "Select batch"
|
208 |
msgstr "一括処理を選択"
|
209 |
|
210 |
+
#: ../lib/pz-linkcard-cacheman-list.php:150
|
211 |
+
#: ../lib/pz-linkcard-cacheman-list.php:219
|
212 |
msgid "Select"
|
213 |
msgstr "選択してください"
|
214 |
|
215 |
+
#: ../lib/pz-linkcard-cacheman-list.php:151
|
216 |
msgid "Renew cache"
|
217 |
msgstr "記事内容を再取得する"
|
218 |
|
219 |
+
#: ../lib/pz-linkcard-cacheman-list.php:152
|
220 |
msgid "Renew SNS count"
|
221 |
msgstr "ソーシャルカウントを再取得する"
|
222 |
|
223 |
+
#: ../lib/pz-linkcard-cacheman-list.php:153
|
224 |
msgid "Check status"
|
225 |
msgstr "リンクが有効かチェックする"
|
226 |
|
227 |
+
#: ../lib/pz-linkcard-cacheman-list.php:154
|
228 |
msgid "Delete from cache"
|
229 |
msgstr "キャッシュから削除する"
|
230 |
|
231 |
+
#: ../lib/pz-linkcard-cacheman-list.php:156
|
232 |
msgid "Submit"
|
233 |
msgstr "適用"
|
234 |
|
235 |
+
#: ../lib/pz-linkcard-cacheman-list.php:160
|
236 |
msgid "Select domain"
|
237 |
msgstr "ドメインを選択"
|
238 |
|
239 |
+
#: ../lib/pz-linkcard-cacheman-list.php:162
|
240 |
msgid "All domain"
|
241 |
msgstr "すべてのドメイン"
|
242 |
|
243 |
+
#: ../lib/pz-linkcard-cacheman-list.php:175
|
244 |
msgid "Refine search"
|
245 |
msgstr "絞り込み検索"
|
246 |
|
247 |
+
#: ../lib/pz-linkcard-cacheman-list.php:180
|
248 |
msgid "items"
|
249 |
msgstr "項目"
|
250 |
|
251 |
+
#: ../lib/pz-linkcard-cacheman-list.php:197
|
252 |
msgid "Select all"
|
253 |
msgstr "すべて選択"
|
254 |
|
255 |
+
#: ../lib/pz-linkcard-cacheman-list.php:208
|
256 |
msgid "(last)"
|
257 |
msgstr ""
|
258 |
|
259 |
+
#: ../lib/pz-linkcard-cacheman-list.php:273
|
260 |
msgid "edit"
|
261 |
msgstr "編集"
|
262 |
|
263 |
+
#: ../lib/pz-linkcard-cacheman-list.php:274
|
264 |
+
#: ../lib/pz-linkcard-cacheman-list.php:275
|
265 |
msgid "Are you sure?"
|
266 |
msgstr "実行します。"
|
267 |
|
268 |
+
#: ../lib/pz-linkcard-cacheman-list.php:274
|
269 |
msgid "renew"
|
270 |
msgstr "再取得"
|
271 |
|
272 |
+
#: ../lib/pz-linkcard-cacheman-list.php:275
|
273 |
msgid "delete"
|
274 |
msgstr "削除"
|
275 |
|
276 |
+
#: ../lib/pz-linkcard-cacheman-list.php:330
|
277 |
msgid "Export"
|
278 |
msgstr "エクスポート"
|
279 |
|
289 |
msgid "Social count renew"
|
290 |
msgstr "ソーシャルカウントの再取得"
|
291 |
|
292 |
+
#: ../lib/pz-linkcard-cacheman.php:100 ../lib/pz-linkcard-cacheman.php:127
|
293 |
+
#: ../lib/pz-linkcard-cacheman.php:142
|
294 |
msgid "completed"
|
295 |
msgstr "完了しました"
|
296 |
|
297 |
+
#: ../lib/pz-linkcard-cacheman.php:105
|
298 |
msgid "Alive check"
|
299 |
msgstr "リンク先のチェック"
|
300 |
|
301 |
+
#: ../lib/pz-linkcard-cacheman.php:132
|
302 |
msgid "Cache renew"
|
303 |
msgstr "記事内容の再取得"
|
304 |
|
305 |
+
#: ../lib/pz-linkcard-cacheman.php:150
|
306 |
msgid "Cache deleted"
|
307 |
msgstr "キャッシュから削除しました"
|
308 |
|
309 |
+
#: ../lib/pz-linkcard-cacheman.php:170
|
310 |
msgid "Download Export File"
|
311 |
msgstr "エクスポートファイルをダウンロード"
|
312 |
|
313 |
+
#: ../lib/pz-linkcard-edit.php:25
|
314 |
+
msgid "Link type"
|
315 |
+
msgstr "外部/内部"
|
316 |
+
|
317 |
#: ../lib/pz-linkcard-js.php:8
|
318 |
msgid "Insert Pz-LinkCard"
|
319 |
msgstr "リンクカード作成"
|
lib/pz-linkcard-cacheman-edit.php
CHANGED
@@ -54,9 +54,48 @@
|
|
54 |
<th><?php _e('Result code', $this->text_domain) ?></th>
|
55 |
<td><input name="data[result_code]" type="text" id="inputtext" value="<?php echo $data['result_code']; ?>" size="5" readonly="readonly" ondblclick="this.readOnly=false;" /></td>
|
56 |
</tr>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
<tr>
|
58 |
<th><?php _e('Post ID', $this->text_domain) ?></th>
|
59 |
-
<td><input name="data[
|
|
|
|
|
|
|
|
|
|
|
60 |
</tr>
|
61 |
<tr>
|
62 |
<th><?php _e('SNS', $this->text_domain) ?></th>
|
54 |
<th><?php _e('Result code', $this->text_domain) ?></th>
|
55 |
<td><input name="data[result_code]" type="text" id="inputtext" value="<?php echo $data['result_code']; ?>" size="5" readonly="readonly" ondblclick="this.readOnly=false;" /></td>
|
56 |
</tr>
|
57 |
+
<?php
|
58 |
+
// 記事IDの再取得(時間がかかるので未実行)
|
59 |
+
$use_post_id_t = array();
|
60 |
+
if ($data['use_post_id1'] > 0) {
|
61 |
+
$use_post_id_t[] = $data['use_post_id1'];
|
62 |
+
}
|
63 |
+
if ($data['use_post_id2'] > 0) {
|
64 |
+
$use_post_id_t[] = $data['use_post_id2'];
|
65 |
+
}
|
66 |
+
if ($data['use_post_id3'] > 0) {
|
67 |
+
$use_post_id_t[] = $data['use_post_id3'];
|
68 |
+
}
|
69 |
+
if ($data['use_post_id4'] > 0) {
|
70 |
+
$use_post_id_t[] = $data['use_post_id4'];
|
71 |
+
}
|
72 |
+
if ($data['use_post_id5'] > 0) {
|
73 |
+
$use_post_id_t[] = $data['use_post_id5'];
|
74 |
+
}
|
75 |
+
if ($data['use_post_id6'] > 0) {
|
76 |
+
$use_post_id_t[] = $data['use_post_id6'];
|
77 |
+
}
|
78 |
+
$use_post_id_m = $wpdb->get_results($wpdb->prepare("SELECT id FROM $wpdb->prefix"."posts WHERE post_type = 'post' AND post_content LIKE '%%\"%s\"%%' ORDER BY id ASC", '"'.$data['url'].'"' ));
|
79 |
+
foreach($use_post_id_m as $use_post_id) {
|
80 |
+
$use_post_id_t[] = $use_post_id->id;
|
81 |
+
}
|
82 |
+
$use_post_id_t = array_unique($use_post_id_t);
|
83 |
+
$use_post_id_t = array_values($use_post_id_t);
|
84 |
+
$data['use_post_id1'] = $use_post_id_t[0];
|
85 |
+
$data['use_post_id2'] = $use_post_id_t[1];
|
86 |
+
$data['use_post_id3'] = $use_post_id_t[2];
|
87 |
+
$data['use_post_id4'] = $use_post_id_t[3];
|
88 |
+
$data['use_post_id5'] = $use_post_id_t[4];
|
89 |
+
$data['use_post_id6'] = $use_post_id_t[5];
|
90 |
+
?>
|
91 |
<tr>
|
92 |
<th><?php _e('Post ID', $this->text_domain) ?></th>
|
93 |
+
<td><input name="data[use_post_id1]" type="text" id="inputtext" value="<?php echo $data['use_post_id1']; ?>" size="5" readonly="readonly" ondblclick="this.readOnly=false;" />
|
94 |
+
<input name="data[use_post_id2]" type="text" id="inputtext" value="<?php echo $data['use_post_id2']; ?>" size="5" readonly="readonly" ondblclick="this.readOnly=false;" />
|
95 |
+
<input name="data[use_post_id3]" type="text" id="inputtext" value="<?php echo $data['use_post_id3']; ?>" size="5" readonly="readonly" ondblclick="this.readOnly=false;" />
|
96 |
+
<input name="data[use_post_id4]" type="text" id="inputtext" value="<?php echo $data['use_post_id4']; ?>" size="5" readonly="readonly" ondblclick="this.readOnly=false;" />
|
97 |
+
<input name="data[use_post_id5]" type="text" id="inputtext" value="<?php echo $data['use_post_id5']; ?>" size="5" readonly="readonly" ondblclick="this.readOnly=false;" />
|
98 |
+
<input name="data[use_post_id6]" type="text" id="inputtext" value="<?php echo $data['use_post_id6']; ?>" size="5" readonly="readonly" ondblclick="this.readOnly=false;" /></td>
|
99 |
</tr>
|
100 |
<tr>
|
101 |
<th><?php _e('SNS', $this->text_domain) ?></th>
|
lib/pz-linkcard-cacheman-list.php
CHANGED
@@ -14,7 +14,12 @@ case 'title':
|
|
14 |
case 'excerpt':
|
15 |
case 'result_code':
|
16 |
case 'alive_result':
|
17 |
-
case '
|
|
|
|
|
|
|
|
|
|
|
18 |
case 'sns_twitter':
|
19 |
case 'sns_facebook':
|
20 |
case 'sns_hatena':
|
@@ -199,7 +204,7 @@ echo '</div>';
|
|
199 |
<th scope="col" class="domain" style="min-width: 6em;"> <?php echo_THC('domain', __('Domain', $this->text_domain) ); ?></th>
|
200 |
<th scope="col" class="sns" style="width: 2.5em;"> <?php echo_THC('sns_twitter', __('Tw', $this->text_domain)); echo '<br>'; echo_THC('sns_facebook', __('fb', $this->text_domain)); echo '<br>'; echo_THC('sns_hatena', __('B!', $this->text_domain)); ?></th>
|
201 |
<th scope="col" class="regist" style="width: 5em;"> <?php echo_THC('regist', __('Regist', $this->text_domain) ); ?></th>
|
202 |
-
<th scope="col" class="postid" style="width: 3em;"> <?php echo_THC('
|
203 |
<th scope="col" class="result" style="width: 2.5em;"> <?php echo_THC('result_code', __('Result code', $this->text_domain) ); ?><br><?php echo_THC('alive_result', __('(last)', $this->text_domain) ); ?></th>
|
204 |
</tr>
|
205 |
</thead>
|
@@ -243,11 +248,13 @@ foreach ($data_all as $data) {
|
|
243 |
$domain = $data->domain;
|
244 |
// 日本語ドメイン対応
|
245 |
if (isset($this->options['flg-idn']) ? true : false) {
|
246 |
-
if (
|
247 |
-
|
248 |
-
|
249 |
-
|
250 |
-
|
|
|
|
|
251 |
}
|
252 |
}
|
253 |
$title = htmlspecialchars($data->title);
|
@@ -293,7 +300,17 @@ foreach ($data_all as $data) {
|
|
293 |
echo '</td>';
|
294 |
|
295 |
echo ' <td>'.$data->regist.'</td>';
|
296 |
-
echo ' <td style="word-break: break-all;"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
297 |
echo ' <td>'.$data->result_code.($data->result_code <> $data->alive_result ? '<br><span style="color:#f00;">('.$data->alive_result.')</span>' : '').'</td>';
|
298 |
echo '</tr>';
|
299 |
}
|
14 |
case 'excerpt':
|
15 |
case 'result_code':
|
16 |
case 'alive_result':
|
17 |
+
case 'use_post_id1':
|
18 |
+
case 'use_post_id2':
|
19 |
+
case 'use_post_id3':
|
20 |
+
case 'use_post_id4':
|
21 |
+
case 'use_post_id5':
|
22 |
+
case 'use_post_id6':
|
23 |
case 'sns_twitter':
|
24 |
case 'sns_facebook':
|
25 |
case 'sns_hatena':
|
204 |
<th scope="col" class="domain" style="min-width: 6em;"> <?php echo_THC('domain', __('Domain', $this->text_domain) ); ?></th>
|
205 |
<th scope="col" class="sns" style="width: 2.5em;"> <?php echo_THC('sns_twitter', __('Tw', $this->text_domain)); echo '<br>'; echo_THC('sns_facebook', __('fb', $this->text_domain)); echo '<br>'; echo_THC('sns_hatena', __('B!', $this->text_domain)); ?></th>
|
206 |
<th scope="col" class="regist" style="width: 5em;"> <?php echo_THC('regist', __('Regist', $this->text_domain) ); ?></th>
|
207 |
+
<th scope="col" class="postid" style="width: 3em;"> <?php echo_THC('use_post_id1', __('Post ID', $this->text_domain) ); ?></th>
|
208 |
<th scope="col" class="result" style="width: 2.5em;"> <?php echo_THC('result_code', __('Result code', $this->text_domain) ); ?><br><?php echo_THC('alive_result', __('(last)', $this->text_domain) ); ?></th>
|
209 |
</tr>
|
210 |
</thead>
|
248 |
$domain = $data->domain;
|
249 |
// 日本語ドメイン対応
|
250 |
if (isset($this->options['flg-idn']) ? true : false) {
|
251 |
+
if (function_exists('idn_to_utf8')) {
|
252 |
+
if ( substr( $domain, 0, 4 ) == 'xn--') {
|
253 |
+
$domain = idn_to_utf8( $domain );
|
254 |
+
$url_m = parse_url( $url );
|
255 |
+
$url_m['host'] = idn_to_utf8( $url_m[host] );
|
256 |
+
$disp_url = $url_m['scheme'].'://'.$url_m['host'].$url_m['path'].$url_m['query'].$url_m['fragment'];
|
257 |
+
}
|
258 |
}
|
259 |
}
|
260 |
$title = htmlspecialchars($data->title);
|
300 |
echo '</td>';
|
301 |
|
302 |
echo ' <td>'.$data->regist.'</td>';
|
303 |
+
echo ' <td style="word-break: break-all;">';
|
304 |
+
if ($data->use_post_id1 > 0 ) {
|
305 |
+
echo '<a href="'.get_permalink($data->use_post_id1).'" target="_blank" title="'.get_the_title($data->use_post_id1).'">'.$data->use_post_id1;
|
306 |
+
}
|
307 |
+
if ($data->use_post_id2 > 0 ) {
|
308 |
+
echo '<br><a href="'.get_permalink($data->use_post_id2).'" target="_blank" title="'.get_the_title($data->use_post_id2).'">'.$data->use_post_id2;
|
309 |
+
}
|
310 |
+
if ($data->use_post_id3 > 0 ) {
|
311 |
+
echo '<br><a href="'.get_permalink($data->use_post_id3).'" target="_blank" title="'.get_the_title($data->use_post_id3).'">'.$data->use_post_id3;
|
312 |
+
}
|
313 |
+
echo '</td>';
|
314 |
echo ' <td>'.$data->result_code.($data->result_code <> $data->alive_result ? '<br><span style="color:#f00;">('.$data->alive_result.')</span>' : '').'</td>';
|
315 |
echo '</tr>';
|
316 |
}
|
lib/pz-linkcard-init.php
CHANGED
@@ -22,9 +22,10 @@
|
|
22 |
url VARCHAR(2048) DEFAULT '',
|
23 |
url_key VARBINARY(255) NOT NULL,
|
24 |
scheme VARCHAR(16) DEFAULT '',
|
|
|
|
|
25 |
address VARCHAR(2048) DEFAULT '',
|
26 |
site_name VARCHAR(100) DEFAULT '',
|
27 |
-
domain VARCHAR(253) DEFAULT '',
|
28 |
title VARCHAR(200) DEFAULT '',
|
29 |
excerpt VARCHAR(500) DEFAULT '',
|
30 |
thumbnail VARCHAR(2048) DEFAULT '',
|
@@ -36,7 +37,13 @@
|
|
36 |
sns_twitter INT DEFAULT -1,
|
37 |
sns_facebook INT DEFAULT -1,
|
38 |
sns_hatena INT DEFAULT -1,
|
39 |
-
post_id INT UNSIGNED,
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
regist_title VARCHAR(200) DEFAULT '',
|
41 |
regist_excerpt VARCHAR(500) DEFAULT '',
|
42 |
regist_charset VARCHAR(32) DEFAULT '',
|
@@ -83,6 +90,42 @@
|
|
83 |
}
|
84 |
}
|
85 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
// 過去バージョンからのコンバート(生存確認用のデータ作成)
|
87 |
$result = $wpdb->get_results("UPDATE $this->db_name SET result_code = 200 WHERE result_code IS NULL OR result_code = 0");
|
88 |
$result = $wpdb->get_results("UPDATE $this->db_name SET alive_result = result_code , alive_time = uptime WHERE alive_result IS NULL OR alive_result = 0 OR alive_time = 0");
|
22 |
url VARCHAR(2048) DEFAULT '',
|
23 |
url_key VARBINARY(255) NOT NULL,
|
24 |
scheme VARCHAR(16) DEFAULT '',
|
25 |
+
domain VARCHAR(253) DEFAULT '',
|
26 |
+
location VARCHAR(2048) DEFAULT '',
|
27 |
address VARCHAR(2048) DEFAULT '',
|
28 |
site_name VARCHAR(100) DEFAULT '',
|
|
|
29 |
title VARCHAR(200) DEFAULT '',
|
30 |
excerpt VARCHAR(500) DEFAULT '',
|
31 |
thumbnail VARCHAR(2048) DEFAULT '',
|
37 |
sns_twitter INT DEFAULT -1,
|
38 |
sns_facebook INT DEFAULT -1,
|
39 |
sns_hatena INT DEFAULT -1,
|
40 |
+
post_id INT UNSIGNED DEFAULT 0,
|
41 |
+
use_post_id1 INT UNSIGNED,
|
42 |
+
use_post_id2 INT UNSIGNED,
|
43 |
+
use_post_id3 INT UNSIGNED,
|
44 |
+
use_post_id4 INT UNSIGNED,
|
45 |
+
use_post_id5 INT UNSIGNED,
|
46 |
+
use_post_id6 INT UNSIGNED,
|
47 |
regist_title VARCHAR(200) DEFAULT '',
|
48 |
regist_excerpt VARCHAR(500) DEFAULT '',
|
49 |
regist_charset VARCHAR(32) DEFAULT '',
|
90 |
}
|
91 |
}
|
92 |
|
93 |
+
// 記事IDの再取得
|
94 |
+
$result = $wpdb->get_results("UPDATE $this->db_name SET use_post_id1 = post_id , post_id = 0 WHERE (use_post_id1 IS NULL OR result_code = 0) AND post_id > 0");
|
95 |
+
|
96 |
+
// // 記事IDの再取得(時間がかかるので未実行)
|
97 |
+
// $result = (array) $wpdb->get_results("SELECT id,url,use_post_id1,use_post_id2,use_post_id3,use_post_id4,use_post_id5,use_post_id6 FROM $this->db_name ORDER BY id");
|
98 |
+
// if (isset($result) && is_array($result) && count($result) > 0) {
|
99 |
+
// foreach($result as $data) {
|
100 |
+
// $use_post_id_t = array();
|
101 |
+
// if ($data->use_post_id1 > 0) {
|
102 |
+
// $use_post_id_t[] = $data->use_post_id1;
|
103 |
+
// }
|
104 |
+
// if ($data->use_post_id2 > 0) {
|
105 |
+
// $use_post_id_t[] = $data->use_post_id2;
|
106 |
+
// }
|
107 |
+
// if ($data->use_post_id3 > 0) {
|
108 |
+
// $use_post_id_t[] = $data->use_post_id3;
|
109 |
+
// }
|
110 |
+
// if ($data->use_post_id4 > 0) {
|
111 |
+
// $use_post_id_t[] = $data->use_post_id4;
|
112 |
+
// }
|
113 |
+
// if ($data->use_post_id5 > 0) {
|
114 |
+
// $use_post_id_t[] = $data->use_post_id5;
|
115 |
+
// }
|
116 |
+
// if ($data->use_post_id6 > 0) {
|
117 |
+
// $use_post_id_t[] = $data->use_post_id6;
|
118 |
+
// }
|
119 |
+
// $use_post_id_m = $wpdb->get_results($wpdb->prepare("SELECT id FROM $wpdb->prefix"."posts WHERE post_type = 'post' AND post_content LIKE '%%\"%s\"%%' ORDER BY id ASC", '"'.$data->url.'"' ));
|
120 |
+
// foreach($use_post_id_m as $use_post_id) {
|
121 |
+
// $use_post_id_t[] = $use_post_id->id;
|
122 |
+
// }
|
123 |
+
// $use_post_id_t = array_unique($use_post_id_t);
|
124 |
+
// $use_post_id_t = array_values($use_post_id_t);
|
125 |
+
// $wpdb->update($this->db_name, array('use_post_id1' => $use_post_id_m[0]->id, 'use_post_id2' => $use_post_id_m[1]->id, 'use_post_id3' => $use_post_id_m[2]->id, 'use_post_id4' => $use_post_id_m[3]->id, 'use_post_id5' => $use_post_id_m[4]->id, 'use_post_id6' => $use_post_id_m[5]->id ) , array('id' => $data->id ) );
|
126 |
+
// }
|
127 |
+
// }
|
128 |
+
|
129 |
// 過去バージョンからのコンバート(生存確認用のデータ作成)
|
130 |
$result = $wpdb->get_results("UPDATE $this->db_name SET result_code = 200 WHERE result_code IS NULL OR result_code = 0");
|
131 |
$result = $wpdb->get_results("UPDATE $this->db_name SET alive_result = result_code , alive_time = uptime WHERE alive_result IS NULL OR alive_result = 0 OR alive_time = 0");
|
pz-linkcard.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
Plugin Name: Pz-LinkCard
|
4 |
Plugin URI: http://poporon.poponet.jp/pz-linkcard
|
5 |
Description: リンクをカード形式で表示します。
|
6 |
-
Version: 2.0.
|
7 |
Author: poporon
|
8 |
Author URI: http://poporon.poponet.jp
|
9 |
License: GPLv2 or later
|
@@ -114,7 +114,7 @@ class Pz_LinkCard {
|
|
114 |
'flg-alive' => '1',
|
115 |
'flg-ssl' => '1',
|
116 |
'flg-amp' => '1',
|
117 |
-
'flg-idn' => '
|
118 |
'style-reset-img' => '1',
|
119 |
'style' => null,
|
120 |
'css-file' => null,
|
@@ -134,7 +134,7 @@ class Pz_LinkCard {
|
|
134 |
'thumbnail-url' => null,
|
135 |
'plugin-link' => null,
|
136 |
'plugin-name' => 'Pz-LinkCard',
|
137 |
-
'plugin-version' => '2.0.
|
138 |
'plugin-url' => 'http://poporon.poponet.jp/pz-linkcard',
|
139 |
'pz-hbc-options' => null,
|
140 |
'debug-time' => null
|
@@ -179,16 +179,16 @@ class Pz_LinkCard {
|
|
179 |
add_filter ('the_content', array($this, 'auto_replace') ); // 自動置き換え
|
180 |
add_shortcode ('pz-linkcard-auto-replace', array($this, 'shortcode') ); // 自動置き換え専用ショートコード
|
181 |
}
|
182 |
-
if ($this->options['code1']
|
183 |
add_shortcode($this->options['code1'], array($this, 'shortcode'));
|
184 |
}
|
185 |
-
if ($this->options['code2']
|
186 |
add_shortcode($this->options['code2'], array($this, 'shortcode'));
|
187 |
}
|
188 |
-
if ($this->options['code3']
|
189 |
add_shortcode($this->options['code3'], array($this, 'shortcode'));
|
190 |
}
|
191 |
-
if ($this->options['code4']
|
192 |
add_shortcode($this->options['code4'], array($this, 'shortcode'));
|
193 |
}
|
194 |
|
@@ -225,15 +225,13 @@ class Pz_LinkCard {
|
|
225 |
|
226 |
if (!wp_next_scheduled('pz_linkcard_check')) {
|
227 |
wp_schedule_event ( time() + 10 , 'hourly', 'pz_linkcard_check');
|
228 |
-
// wp_schedule_single_event( time() + 10 , 'pz_linkcard_check');
|
229 |
}
|
230 |
if (!wp_next_scheduled('pz_linkcard_alive')) {
|
231 |
wp_schedule_event ( time() + 1800 , 'daily', 'pz_linkcard_alive');
|
232 |
-
// wp_schedule_single_event( time() + 30 , 'pz_linkcard_alive');
|
233 |
}
|
234 |
}
|
235 |
|
236 |
-
//
|
237 |
public function auto_replace($contents) {
|
238 |
if (isset($this->options['auto-atag']) && $this->options['auto-atag']) {
|
239 |
$contents = preg_replace( '/(^|<br ?\/?>)(<p.*>)?<a .*href=[\'"](https?:\/\/[-_\.!~*()a-zA-Z0-9;\/?:\@&=+\$,%#]+)[\'"]((?!<IMG).)*<\/a>(<\/p>)?$/im', '[pz-linkcard-auto-replace url="$3"]', $contents);
|
@@ -247,7 +245,7 @@ class Pz_LinkCard {
|
|
247 |
// ショートコード処理
|
248 |
public function shortcode($atts, $content = null, $shortcode) {
|
249 |
// 実行時間
|
250 |
-
if (
|
251 |
$start_time = microtime(true);
|
252 |
}
|
253 |
|
@@ -295,7 +293,7 @@ class Pz_LinkCard {
|
|
295 |
$data = $this->pz_GetHTML ( $atts );
|
296 |
|
297 |
// 実行時間
|
298 |
-
if (
|
299 |
$end_time = microtime(true);
|
300 |
$elasped_time = number_format($end_time - $start_time, 8, '.', ',');
|
301 |
$data = PHP_EOL.'<!-- Pz-LkC -->'.PHP_EOL.$data.PHP_EOL.'<!-- /Pz-LkC ('.$elasped_time.'sec) -->'.PHP_EOL;
|
@@ -306,16 +304,8 @@ class Pz_LinkCard {
|
|
306 |
|
307 |
// キャッシュやリンク先からリンクカードのHTMLを生成
|
308 |
function pz_GetHTML($atts, $content = null) {
|
309 |
-
if (
|
310 |
-
echo
|
311 |
-
}
|
312 |
-
|
313 |
-
$url = $this->pz_TrimURL( $atts['url'] );
|
314 |
-
if (!isset($url) || $url == '' ) {
|
315 |
-
return null;
|
316 |
-
}
|
317 |
-
if (isset($this->options['debug-time']) && $this->options['debug-time']) {
|
318 |
-
echo '<!-- Pz-LkC [URL='.$url.'] /-->'.PHP_EOL;
|
319 |
}
|
320 |
|
321 |
// モバイルチェック
|
@@ -324,22 +314,28 @@ class Pz_LinkCard {
|
|
324 |
} else {
|
325 |
$is_mobile = false;
|
326 |
}
|
327 |
-
if (
|
328 |
-
echo
|
329 |
}
|
330 |
|
331 |
-
//
|
332 |
-
|
333 |
-
|
334 |
-
|
335 |
-
} else {
|
336 |
-
$domain_url = null;
|
337 |
-
$domain = null;
|
338 |
-
$error = true;
|
339 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
340 |
|
341 |
// 自サイトチェック
|
342 |
-
if (
|
343 |
if ($this->pz_TrimURL(get_permalink()) == $url) {
|
344 |
$link_type = 1; // 自ページ
|
345 |
} else {
|
@@ -348,15 +344,15 @@ class Pz_LinkCard {
|
|
348 |
} else {
|
349 |
$link_type = 0; // 外部サイト
|
350 |
}
|
351 |
-
if (
|
352 |
-
echo
|
353 |
}
|
354 |
|
355 |
// モバイルかPCかのクラス名を追加
|
356 |
$class_id = 'linkcard';
|
357 |
-
if ($is_mobile &&
|
358 |
$class_id .= ' '.$this->options['class-mobile'];
|
359 |
-
} elseif (
|
360 |
$class_id .= ' '.$this->options['class-pc'];
|
361 |
}
|
362 |
|
@@ -370,57 +366,58 @@ class Pz_LinkCard {
|
|
370 |
$data_id = $data['id'];
|
371 |
$url = $data['url'];
|
372 |
}
|
373 |
-
if (
|
374 |
-
echo
|
375 |
}
|
376 |
|
377 |
// 内部リンクの処理
|
378 |
if ( $link_type ) {
|
379 |
-
|
|
|
380 |
if (isset($this->options['in-target'])) {
|
381 |
if ($this->options['in-target'] == '1' || ($this->options['in-target'] == '2' && !$is_mobile)) {
|
382 |
-
$target =
|
383 |
}
|
384 |
}
|
385 |
-
$nofollow = '';
|
386 |
|
387 |
// キャッシュが無い、もしくは常に最新を取得する、もしくは強制取得
|
388 |
if ( is_null($data_id) || ( isset($atts['force']) && $atts['force'] == true ) ) {
|
389 |
-
if (
|
390 |
-
echo
|
391 |
}
|
392 |
-
$data
|
393 |
-
$data['link_type'] =
|
394 |
-
if (
|
395 |
-
echo
|
396 |
}
|
397 |
-
$result
|
398 |
} elseif ($this->options['in-get'] <> 2) {
|
399 |
-
if (
|
400 |
-
echo
|
401 |
}
|
402 |
-
$data
|
403 |
-
$data['link_type'] =
|
404 |
}
|
405 |
}
|
406 |
|
407 |
// 外部リンクの処理
|
408 |
if ( !$link_type ) {
|
409 |
// リンクターゲットの設定
|
410 |
-
$target =
|
411 |
if (isset($this->options['ex-target'])) {
|
412 |
if ($this->options['ex-target'] == '1' || ($this->options['ex-target'] == '2' && !$is_mobile)) {
|
413 |
$target = ' target="_blank"'; // 新しいページで開く
|
414 |
}
|
415 |
}
|
416 |
-
$nofollow = isset($this->options['nofollow']) ? ' rel="nofollow"' : '';
|
417 |
|
418 |
// キャッシュが無い、もしくは強制取得
|
419 |
if ( is_null($data_id) || ( isset($atts['force']) && $atts['force'] == true ) ) {
|
420 |
-
if (
|
421 |
-
echo
|
422 |
}
|
423 |
-
$result = $this->pz_GetCURL( $data );
|
424 |
if ( isset($result) && is_array($result) && isset($result['url']) ) {
|
425 |
$data = $result;
|
426 |
$data['link_type'] = 0;
|
@@ -429,6 +426,7 @@ class Pz_LinkCard {
|
|
429 |
}
|
430 |
}
|
431 |
|
|
|
432 |
$data_id = (isset($data['id']) ? $data['id'] : null);
|
433 |
$site_name = (isset($data['site_name']) ? $data['site_name'] : null);
|
434 |
$title = (isset($data['title']) ? $data['title'] : null);
|
@@ -478,24 +476,24 @@ class Pz_LinkCard {
|
|
478 |
} else {
|
479 |
$tag = '<div class="'.$class_id.'">'.$tag.'</div>';
|
480 |
}
|
481 |
-
return $tag;
|
482 |
}
|
483 |
|
484 |
// サムネイル取得
|
485 |
if ( !$this->options['thumbnail-position'] || ( $result_code <> 0 && $result_code <> 200 ) ) {
|
486 |
$thumbnail = null;
|
487 |
} else {
|
488 |
-
if ($sw_thumbnail == '1' || $sw_thumbnail == '13') {
|
489 |
if ( !$link_type ) {
|
490 |
-
$thumbnail_url = $this->pz_GetThumbnail($thumbnail_url);
|
491 |
}
|
492 |
if ( isset($thumbnail_url) && $thumbnail_url <> '' ) {
|
493 |
$thumbnail = '<img class="lkc-thumbnail-img" src="'.$thumbnail_url.'" alt="" />';
|
494 |
-
} elseif ($sw_thumbnail == '13') {
|
495 |
$sw_thumbnail = '3';
|
496 |
}
|
497 |
}
|
498 |
-
if ($sw_thumbnail == '3') {
|
499 |
// 画像取得(WebAPI)
|
500 |
if (isset($this->options['thumbnail-api'])) {
|
501 |
$thumbnail = preg_replace('/%DOMAIN_URL%/', $domain_url, $this->options['thumbnail-api'] );
|
@@ -510,14 +508,14 @@ class Pz_LinkCard {
|
|
510 |
if (!isset($this->options['info-position'])) {
|
511 |
$favicon = null;
|
512 |
} else{
|
513 |
-
if ($sw_favicon == '1' || $sw_favicon == '13') {
|
514 |
if ( !is_null($favicon_url ) ) {
|
515 |
$favicon = '<img class="lkc-favicon" src="'.$favicon_url.'" alt="" width=16 height=16 />';
|
516 |
-
} elseif ($sw_favicon == '13') {
|
517 |
$sw_favicon == '3';
|
518 |
}
|
519 |
}
|
520 |
-
if ($sw_favicon == '3') {
|
521 |
// サイトアイコン取得(WebAPI)
|
522 |
if (isset($this->options['favicon-api'])) {
|
523 |
$favicon = preg_replace('/%DOMAIN_URL%/', $domain_url, $this->options['favicon-api'] );
|
@@ -528,8 +526,6 @@ class Pz_LinkCard {
|
|
528 |
}
|
529 |
}
|
530 |
|
531 |
-
// データベースへの保存が終わったので、表示用の編集
|
532 |
-
|
533 |
// タイトル
|
534 |
if (!isset($title) || $title == '') {
|
535 |
$title = esc_html($url); // タイトル取得できていなかったらURLをセットする
|
@@ -560,8 +556,7 @@ class Pz_LinkCard {
|
|
560 |
$title = $str;
|
561 |
}
|
562 |
|
563 |
-
//
|
564 |
-
// 抜粋文非表示の場合、空欄にする
|
565 |
if (!isset($this->options['display-excerpt']) || is_null($this->options['display-excerpt'])) {
|
566 |
$excerpt = '';
|
567 |
} else {
|
@@ -590,8 +585,8 @@ class Pz_LinkCard {
|
|
590 |
// 日本語ドメイン対応
|
591 |
if (isset($this->options['flg-idn']) ? true : false) {
|
592 |
if (function_exists('idn_to_utf8')) {
|
593 |
-
if (
|
594 |
-
$site_name = idn_to_utf8( $
|
595 |
}
|
596 |
}
|
597 |
}
|
@@ -600,6 +595,7 @@ class Pz_LinkCard {
|
|
600 |
// リンク先URL
|
601 |
$not_allow_code = array('403','404','410');
|
602 |
if (array_search($alive_result, $not_allow_code)) {
|
|
|
603 |
$a_op_all = '<span style="cursor: not-allowed;" title="">';
|
604 |
$a_cl_all = '</span>';
|
605 |
$a_op = '';
|
@@ -607,6 +603,7 @@ class Pz_LinkCard {
|
|
607 |
$st_op = '<strike>';
|
608 |
$st_cl = '</strike>';
|
609 |
} elseif ((isset($this->options['link-all']) ? $this->options['link-all'] : null) == '1') {
|
|
|
610 |
$a_op_all = '<a class="no_icon" href="'.$url.'"'.$target.$nofollow.'>';
|
611 |
$a_cl_all = '</a>';
|
612 |
$a_op = '';
|
@@ -614,6 +611,7 @@ class Pz_LinkCard {
|
|
614 |
$st_op = '';
|
615 |
$st_cl = '';
|
616 |
} else {
|
|
|
617 |
$a_op_all = '';
|
618 |
$a_cl_all = '';
|
619 |
$a_op = '<a class="no_icon" href="'.$url.'"'.$target.$nofollow.'>';
|
@@ -652,7 +650,6 @@ class Pz_LinkCard {
|
|
652 |
}
|
653 |
}
|
654 |
$sns .= '</span>';
|
655 |
-
|
656 |
if ($this->options['sns-position'] == '1') {
|
657 |
$sns_title = $sns;
|
658 |
} else {
|
@@ -664,16 +661,15 @@ class Pz_LinkCard {
|
|
664 |
if ($thumbnail) {
|
665 |
$thumbnail = '<span class="lkc-thumbnail">'.$thumbnail.'</span>';
|
666 |
}
|
|
|
667 |
// サイト情報
|
668 |
$domain_info = '<div class="lkc-info">'.$a_op.'<span class="lkc-domain"'.$site_title.'>'.$favicon.' '.$site_name.$info.'</span>'.$a_cl.' '.$sns_info.$this->plugin_link.'</div>';
|
669 |
|
670 |
// 日本語ドメイン対応
|
671 |
if (isset($this->options['flg-idn']) ? true : false) {
|
672 |
-
$url_m = parse_url( $url );
|
673 |
if (function_exists('idn_to_utf8')) {
|
674 |
-
if (
|
675 |
-
$
|
676 |
-
$url = $url_m['scheme'].'://'.$url_m['host'].$url_m['path'].$url_m['query'].$url_m['fragment'];
|
677 |
}
|
678 |
}
|
679 |
}
|
@@ -682,8 +678,8 @@ class Pz_LinkCard {
|
|
682 |
$content = '<div class="lkc-content">'.$a_op.$thumbnail.'<span class="lkc-title">'.$title.'</span>'.$a_cl.$sns_title.'<div class="lkc-url"><cite>'.$st_op.$a_op.$url.$st_cl.$a_cl.'</cite></div><div class="lkc-excerpt">'.$excerpt.'</div></div>';
|
683 |
|
684 |
// Google AMPに暫定対応
|
685 |
-
|
686 |
-
|
687 |
$tag = '<table border="1" cellspacing="0" cellpadding="4"><tbody></tr><tr><td>'.$excerpt.'<br>'.$a_op_all.$a_op.$title.$a_cl.$a_cl_all.' - '.$site_name.'</td></tr></tbody></table>';
|
688 |
} else {
|
689 |
// HTMLタグ作成
|
@@ -709,7 +705,7 @@ class Pz_LinkCard {
|
|
709 |
return $tag;
|
710 |
}
|
711 |
|
712 |
-
// URL
|
713 |
function pz_TrimURL($url = null) {
|
714 |
if (!isset($url) || $url == '') {
|
715 |
$url = null;
|
@@ -718,8 +714,8 @@ class Pz_LinkCard {
|
|
718 |
|
719 |
if (isset($url) && $url <> '') {
|
720 |
$url = html_entity_decode($url);
|
721 |
-
$url = preg_replace('/^[\s \'\"‘’“”″]*(.*?)[\s \'\"‘’“”″]*$/u', '\1', $url);
|
722 |
-
$url = esc_url($url);
|
723 |
switch (isset($this->options['trail-slash']) ? $this->options['trail-slash'] : null) {
|
724 |
case '1': // URLがドメイン名だけの場合、最後のスラッシュを除外する
|
725 |
$array_url = parse_url($url);
|
@@ -735,6 +731,50 @@ class Pz_LinkCard {
|
|
735 |
return $url;
|
736 |
}
|
737 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
738 |
// ソーシャルカウント取得
|
739 |
public function pz_RenewSNSCount( $data ) {
|
740 |
if (!isset($this->options['sns-position']) || $this->options['sns-position'] == '') {
|
@@ -806,7 +846,7 @@ class Pz_LinkCard {
|
|
806 |
}
|
807 |
}
|
808 |
|
809 |
-
//
|
810 |
if ($update_cnt || ($this->now - strtotime($data['regist']) < WEEK_IN_SECONDS)) {
|
811 |
$sns_nexttime = $this->now + DAY_IN_SECONDS + rand(0, DAY_IN_SECONDS); // 1day + 0-24h
|
812 |
} else {
|
@@ -857,7 +897,7 @@ class Pz_LinkCard {
|
|
857 |
if (is_wp_error($data)) {
|
858 |
return null;
|
859 |
}
|
860 |
-
return (array) $data;
|
861 |
}
|
862 |
|
863 |
// キャッシュデータを保存
|
@@ -874,7 +914,15 @@ class Pz_LinkCard {
|
|
874 |
if (!isset($data['url_key']) || is_null($data['url_key']) || $data['url_key'] == '' ) {
|
875 |
$data['url_key'] = hash( 'sha256', esc_url( $url ), true);
|
876 |
}
|
877 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
878 |
|
879 |
// 更新してみる
|
880 |
if ( isset($data['id']) ) {
|
@@ -902,9 +950,30 @@ class Pz_LinkCard {
|
|
902 |
$this->db_name,
|
903 |
$data
|
904 |
);
|
905 |
-
// 挿入できなかったらエラー終了
|
906 |
if (!$result) {
|
907 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
908 |
}
|
909 |
}
|
910 |
return $this->pz_GetCache($data);
|
@@ -944,58 +1013,75 @@ class Pz_LinkCard {
|
|
944 |
|
945 |
// サイトアイコン
|
946 |
if (function_exists('has_site_icon') && has_site_icon()) {
|
947 |
-
$favicon
|
948 |
} else {
|
949 |
-
$favicon
|
950 |
}
|
951 |
|
952 |
-
$title =
|
953 |
-
$excerpt =
|
954 |
-
$thumbnail =
|
955 |
|
956 |
// 記事内容
|
957 |
-
$
|
958 |
-
|
959 |
-
|
|
|
960 |
}
|
961 |
if ( $post_id ) {
|
962 |
-
$result_code =
|
963 |
-
$post =
|
964 |
if ( $this->options['in-get'] ) {
|
965 |
-
$title =
|
966 |
-
$excerpt =
|
967 |
} else {
|
968 |
-
$title =
|
969 |
-
$excerpt =
|
970 |
if ($excerpt == '') {
|
971 |
-
$excerpt =
|
972 |
}
|
973 |
}
|
974 |
-
$thumbnail_id =
|
975 |
-
if (
|
976 |
-
echo
|
977 |
}
|
978 |
$attach = wp_get_attachment_image_src( $thumbnail_id, 'thumbnail', true );
|
979 |
if (isset($attach) && count($attach) > 3 && isset($attach[0])) {
|
980 |
$thumbnail = $attach[0];
|
981 |
}
|
982 |
} else {
|
983 |
-
// カテゴリページ等は内部取得できないので外部取得する
|
984 |
-
//if (isset($this->options['debug-time']) && $this->options['debug-time']) {
|
985 |
-
// echo '<!-- Pz-LkC [IN-CURL] /-->'.PHP_EOL;
|
986 |
-
//}
|
987 |
-
//$data = $this->pz_GetCURL( $data );
|
988 |
-
//$title = $data['title'];
|
989 |
-
//$excerpt = $data['excerpt'];
|
990 |
-
//$site_name = $data['site_name'];
|
991 |
-
//$thumbnail = $data['thumbnail'];
|
992 |
-
//$result_code = $data['result_code'];
|
993 |
-
// カテゴリページ等は内部取得できないのでサイト名をセットする
|
994 |
$title = get_bloginfo('name');
|
995 |
$excerpt = get_bloginfo('description');
|
996 |
$site_name = get_bloginfo('name');
|
997 |
$thumbnail = '';
|
998 |
$result_code = '200';
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
999 |
}
|
1000 |
|
1001 |
// タイトル整形
|
@@ -1021,25 +1107,30 @@ class Pz_LinkCard {
|
|
1021 |
}
|
1022 |
|
1023 |
// データセット
|
1024 |
-
if ($data['title']
|
1025 |
-
$before['mod_title']
|
1026 |
} else {
|
1027 |
-
$before['mod_title']
|
1028 |
}
|
1029 |
-
if ($data['excerpt']
|
1030 |
-
$before['mod_excerpt']
|
1031 |
} else {
|
1032 |
-
$before['mod_excerpt']
|
1033 |
-
}
|
1034 |
-
$data['
|
1035 |
-
|
1036 |
-
|
1037 |
-
$data['
|
1038 |
-
$data['
|
1039 |
-
$data['
|
1040 |
-
$data['
|
1041 |
-
$data['
|
1042 |
-
$data['
|
|
|
|
|
|
|
|
|
|
|
1043 |
|
1044 |
return $data;
|
1045 |
}
|
@@ -1062,29 +1153,12 @@ class Pz_LinkCard {
|
|
1062 |
$charset = null;
|
1063 |
$result_code = null;
|
1064 |
|
1065 |
-
|
1066 |
-
$
|
1067 |
-
$
|
1068 |
-
$
|
1069 |
-
$
|
1070 |
-
$
|
1071 |
-
$data['alive_time'] = (isset( $data['alive_time'] ) ? $data['alive_time'] : 0 );
|
1072 |
-
$data['alive_result'] = (isset( $data['alive_result'] ) ? $data['alive_result'] : 0 );
|
1073 |
-
$data['mod_title'] = 0;
|
1074 |
-
$data['mod_excerpt'] = 0;
|
1075 |
-
|
1076 |
-
if ( isset( $data['domain'] ) ) {
|
1077 |
-
$domain_url = $data['domain'];
|
1078 |
-
$domain = $data['domain'];
|
1079 |
-
} else {
|
1080 |
-
if (preg_match('{https?://(.+?)/}i', $url.'/',$m)) {
|
1081 |
-
$domain_url = $m[0];
|
1082 |
-
$domain = $m[1];
|
1083 |
-
} else {
|
1084 |
-
$domain_url = null;
|
1085 |
-
$domain = null;
|
1086 |
-
}
|
1087 |
-
}
|
1088 |
|
1089 |
if ( function_exists( 'curl_init' ) ) { // cURLを使用する
|
1090 |
$result_code = 0;
|
@@ -1095,10 +1169,9 @@ class Pz_LinkCard {
|
|
1095 |
curl_setopt( $ch, CURLOPT_REFERER, get_permalink() ); // リファラ
|
1096 |
}
|
1097 |
if (isset($this->options['flg-agent']) ? true : false) {
|
1098 |
-
curl_setopt( $ch, CURLOPT_USERAGENT, $this->options['user-agent'] ); //
|
1099 |
-
// curl_setopt( $ch, CURLOPT_USERAGENT, 'Pz-LinkCard-Crawler/'.$this->options['plugin-version'].' WordPress/'.get_bloginfo('version').' cURL/'.curl_version()['version'].' PHP/'.phpversion() );
|
1100 |
} else {
|
1101 |
-
curl_setopt( $ch, CURLOPT_USERAGENT, esc_html( $_SERVER['HTTP_USER_AGENT'] ) ); //
|
1102 |
}
|
1103 |
if (isset($this->options['flg-redir']) ? true : false) {
|
1104 |
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true ); // リダイレクトを処理する
|
@@ -1107,41 +1180,40 @@ class Pz_LinkCard {
|
|
1107 |
} else {
|
1108 |
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, false ); // リダイレクトを処理しない
|
1109 |
}
|
1110 |
-
curl_setopt( $ch, CURLOPT_COOKIESESSION,
|
1111 |
-
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER,
|
1112 |
$html = curl_exec($ch);
|
1113 |
-
$errno = intval( curl_errno( $ch ) );
|
1114 |
if ( $errno ) {
|
1115 |
-
$html =
|
1116 |
-
$result_code =
|
1117 |
-
$error =
|
1118 |
} else {
|
1119 |
-
$header =
|
1120 |
-
$result_code =
|
1121 |
-
$error =
|
1122 |
}
|
1123 |
curl_close($ch);
|
1124 |
-
} else {
|
1125 |
-
$result = wp_remote_get( $url );
|
1126 |
if ( is_wp_error( $result ) ) {
|
1127 |
-
$html =
|
1128 |
-
$result_code =
|
1129 |
-
$error =
|
1130 |
} else {
|
1131 |
-
$html =
|
1132 |
-
$result_code =
|
1133 |
-
$error =
|
1134 |
}
|
1135 |
}
|
1136 |
|
1137 |
// 文字コード判定
|
1138 |
$charset = null;
|
1139 |
if ($html <> '') {
|
1140 |
-
if (preg_match('/charset\s*=\s*([^>\/\s]*)
|
1141 |
$m[1] = trim(trim($m[1]), '\'\"');
|
1142 |
$charset = $m[1];
|
1143 |
} else {
|
1144 |
-
// $charset = mb_detect_encoding( $html );
|
1145 |
foreach(array('UTF-8','SJIS','EUC-JP','eucJP-win','ASCII','JIS','SJIS-win') as $c_charset) {
|
1146 |
// 文字コード変換してみて内容が変わらないものを文字セットと判断する
|
1147 |
if (mb_convert_encoding($html, $this->charset, $c_charset) == $html) {
|
@@ -1149,6 +1221,7 @@ class Pz_LinkCard {
|
|
1149 |
break;
|
1150 |
}
|
1151 |
}
|
|
|
1152 |
}
|
1153 |
if (is_null($charset)) {
|
1154 |
$charset = 'auto';
|
@@ -1157,7 +1230,7 @@ class Pz_LinkCard {
|
|
1157 |
$html = mb_convert_encoding($html, $this->charset, $charset);
|
1158 |
}
|
1159 |
|
1160 |
-
// HEAD
|
1161 |
$head = null;
|
1162 |
$tags = null;
|
1163 |
if (preg_match('/<\s*head\s*[^>]*>(.*)<\s*\/head\s*>/si', $html, $m)) {
|
@@ -1189,6 +1262,21 @@ class Pz_LinkCard {
|
|
1189 |
} elseif (isset( $tags['twitter:image'] ) && $tags['twitter:image'] ) {
|
1190 |
$thumbnail_url = $tags['twitter:image'] ;
|
1191 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1192 |
|
1193 |
// サイト名
|
1194 |
if (isset( $tags['og:site_name'] ) && $tags['og:site_name'] ) {
|
@@ -1222,28 +1310,34 @@ class Pz_LinkCard {
|
|
1222 |
if (isset($url_key) && !is_null($url_key)) {
|
1223 |
$data['url_key'] = $url_key;
|
1224 |
}
|
1225 |
-
$data['site_name'] =
|
1226 |
-
$data['title'] =
|
1227 |
-
$data['excerpt'] =
|
1228 |
-
$data['
|
1229 |
-
|
1230 |
-
|
1231 |
-
|
1232 |
-
|
1233 |
-
|
1234 |
-
|
1235 |
-
$data['
|
1236 |
-
$data['
|
1237 |
-
$data['
|
1238 |
-
$data['
|
1239 |
-
|
1240 |
-
|
1241 |
-
|
1242 |
-
|
1243 |
-
|
1244 |
-
$data['
|
1245 |
-
}
|
1246 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
1247 |
return $data;
|
1248 |
}
|
1249 |
|
@@ -1270,6 +1364,17 @@ class Pz_LinkCard {
|
|
1270 |
$tags += array_combine($match[1], $match[2]);
|
1271 |
}
|
1272 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1273 |
return $tags;
|
1274 |
}
|
1275 |
|
@@ -1397,20 +1502,20 @@ class Pz_LinkCard {
|
|
1397 |
if (isset($data) && isset($data->url)) {
|
1398 |
$before = $this->pz_GetCache( array( 'url' => $data->url ) );
|
1399 |
$after = $this->pz_GetCURL( $before );
|
1400 |
-
if ($before['title']
|
1401 |
-
$before['mod_title']
|
1402 |
} else {
|
1403 |
-
$before['mod_title']
|
1404 |
}
|
1405 |
-
if ($before['excerpt']
|
1406 |
-
$before['mod_excerpt']
|
1407 |
} else {
|
1408 |
-
$before['mod_excerpt']
|
1409 |
}
|
1410 |
-
$before['alive_result'] =
|
1411 |
-
$before['alive_time'] =
|
1412 |
-
$before['thumbnail'] =
|
1413 |
-
$before['favicon'] =
|
1414 |
$before = $this->pz_SetCache( $before );
|
1415 |
}
|
1416 |
}
|
3 |
Plugin Name: Pz-LinkCard
|
4 |
Plugin URI: http://poporon.poponet.jp/pz-linkcard
|
5 |
Description: リンクをカード形式で表示します。
|
6 |
+
Version: 2.0.1
|
7 |
Author: poporon
|
8 |
Author URI: http://poporon.poponet.jp
|
9 |
License: GPLv2 or later
|
114 |
'flg-alive' => '1',
|
115 |
'flg-ssl' => '1',
|
116 |
'flg-amp' => '1',
|
117 |
+
'flg-idn' => '',
|
118 |
'style-reset-img' => '1',
|
119 |
'style' => null,
|
120 |
'css-file' => null,
|
134 |
'thumbnail-url' => null,
|
135 |
'plugin-link' => null,
|
136 |
'plugin-name' => 'Pz-LinkCard',
|
137 |
+
'plugin-version' => '2.0.1',
|
138 |
'plugin-url' => 'http://poporon.poponet.jp/pz-linkcard',
|
139 |
'pz-hbc-options' => null,
|
140 |
'debug-time' => null
|
179 |
add_filter ('the_content', array($this, 'auto_replace') ); // 自動置き換え
|
180 |
add_shortcode ('pz-linkcard-auto-replace', array($this, 'shortcode') ); // 自動置き換え専用ショートコード
|
181 |
}
|
182 |
+
if ($this->options['code1']) {
|
183 |
add_shortcode($this->options['code1'], array($this, 'shortcode'));
|
184 |
}
|
185 |
+
if ($this->options['code2']) {
|
186 |
add_shortcode($this->options['code2'], array($this, 'shortcode'));
|
187 |
}
|
188 |
+
if ($this->options['code3']) {
|
189 |
add_shortcode($this->options['code3'], array($this, 'shortcode'));
|
190 |
}
|
191 |
+
if ($this->options['code4']) {
|
192 |
add_shortcode($this->options['code4'], array($this, 'shortcode'));
|
193 |
}
|
194 |
|
225 |
|
226 |
if (!wp_next_scheduled('pz_linkcard_check')) {
|
227 |
wp_schedule_event ( time() + 10 , 'hourly', 'pz_linkcard_check');
|
|
|
228 |
}
|
229 |
if (!wp_next_scheduled('pz_linkcard_alive')) {
|
230 |
wp_schedule_event ( time() + 1800 , 'daily', 'pz_linkcard_alive');
|
|
|
231 |
}
|
232 |
}
|
233 |
|
234 |
+
// テキストリンクの行とURLのみの行をリンクカードへ置き換える処理(コードが単純になるので、直接HTMLタグにするのでは無くショートコードに変換する。)
|
235 |
public function auto_replace($contents) {
|
236 |
if (isset($this->options['auto-atag']) && $this->options['auto-atag']) {
|
237 |
$contents = preg_replace( '/(^|<br ?\/?>)(<p.*>)?<a .*href=[\'"](https?:\/\/[-_\.!~*()a-zA-Z0-9;\/?:\@&=+\$,%#]+)[\'"]((?!<IMG).)*<\/a>(<\/p>)?$/im', '[pz-linkcard-auto-replace url="$3"]', $contents);
|
245 |
// ショートコード処理
|
246 |
public function shortcode($atts, $content = null, $shortcode) {
|
247 |
// 実行時間
|
248 |
+
if ($this->options['debug-time']) {
|
249 |
$start_time = microtime(true);
|
250 |
}
|
251 |
|
293 |
$data = $this->pz_GetHTML ( $atts );
|
294 |
|
295 |
// 実行時間
|
296 |
+
if ($this->options['debug-time']) {
|
297 |
$end_time = microtime(true);
|
298 |
$elasped_time = number_format($end_time - $start_time, 8, '.', ',');
|
299 |
$data = PHP_EOL.'<!-- Pz-LkC -->'.PHP_EOL.$data.PHP_EOL.'<!-- /Pz-LkC ('.$elasped_time.'sec) -->'.PHP_EOL;
|
304 |
|
305 |
// キャッシュやリンク先からリンクカードのHTMLを生成
|
306 |
function pz_GetHTML($atts, $content = null) {
|
307 |
+
if ($this->options['debug-time']) {
|
308 |
+
echo '<!-- Pz-LkC [DEBUG INFORMATION] /-->'.PHP_EOL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
309 |
}
|
310 |
|
311 |
// モバイルチェック
|
314 |
} else {
|
315 |
$is_mobile = false;
|
316 |
}
|
317 |
+
if ($this->options['debug-time']) {
|
318 |
+
echo '<!-- Pz-LkC [MOBILE='.$is_mobile.'] /-->'.PHP_EOL;
|
319 |
}
|
320 |
|
321 |
+
// URLエンティティ化など(無害化?)
|
322 |
+
$url = $this->pz_TrimURL( $atts['url'] );
|
323 |
+
if (!isset($url) || $url == '' ) {
|
324 |
+
return null;
|
|
|
|
|
|
|
|
|
325 |
}
|
326 |
+
if ($this->options['debug-time']) {
|
327 |
+
echo '<!-- Pz-LkC [URL='.$url.'] /-->'.PHP_EOL;
|
328 |
+
}
|
329 |
+
|
330 |
+
// URLパース(ドメイン名などを抽出)
|
331 |
+
$url_m = parse_url( $url );
|
332 |
+
$scheme = $url_m['scheme']; // スキーム
|
333 |
+
$domain = $url_m['host']; // ドメイン名
|
334 |
+
$domain_url = $scheme.'://'.$url_m['host']; // ドメインURL
|
335 |
+
$location = substr($url, mb_strlen($domain_url)); // ドメイン名以降
|
336 |
|
337 |
// 自サイトチェック
|
338 |
+
if (substr($url, 0, mb_strlen(home_url() ) ) == home_url() ) {
|
339 |
if ($this->pz_TrimURL(get_permalink()) == $url) {
|
340 |
$link_type = 1; // 自ページ
|
341 |
} else {
|
344 |
} else {
|
345 |
$link_type = 0; // 外部サイト
|
346 |
}
|
347 |
+
if ($this->options['debug-time']) {
|
348 |
+
echo '<!-- Pz-LkC [TYPE='.$link_type.'] /-->'.PHP_EOL;
|
349 |
}
|
350 |
|
351 |
// モバイルかPCかのクラス名を追加
|
352 |
$class_id = 'linkcard';
|
353 |
+
if ($is_mobile && $this->options['class-mobile']) {
|
354 |
$class_id .= ' '.$this->options['class-mobile'];
|
355 |
+
} elseif ($this->options['class-pc']) {
|
356 |
$class_id .= ' '.$this->options['class-pc'];
|
357 |
}
|
358 |
|
366 |
$data_id = $data['id'];
|
367 |
$url = $data['url'];
|
368 |
}
|
369 |
+
if ($this->options['debug-time']) {
|
370 |
+
echo '<!-- Pz-LkC [CACHE='.$data_id.'] /-->'.PHP_EOL;
|
371 |
}
|
372 |
|
373 |
// 内部リンクの処理
|
374 |
if ( $link_type ) {
|
375 |
+
// リンクターゲットの設定
|
376 |
+
$target = ''; // 同ページに開く
|
377 |
if (isset($this->options['in-target'])) {
|
378 |
if ($this->options['in-target'] == '1' || ($this->options['in-target'] == '2' && !$is_mobile)) {
|
379 |
+
$target = ' target="_blank"'; // 新しいページで開く
|
380 |
}
|
381 |
}
|
382 |
+
$nofollow = ''; // 内部サイトにnoflollowは付けない
|
383 |
|
384 |
// キャッシュが無い、もしくは常に最新を取得する、もしくは強制取得
|
385 |
if ( is_null($data_id) || ( isset($atts['force']) && $atts['force'] == true ) ) {
|
386 |
+
if ($this->options['debug-time']) {
|
387 |
+
echo '<!-- Pz-LkC [IN-POST] /-->'.PHP_EOL;
|
388 |
}
|
389 |
+
$data = $this->pz_GetPost( $data ); // 最新記事内容を取得
|
390 |
+
$data['link_type'] = 1;
|
391 |
+
if ($this->options['debug-time']) {
|
392 |
+
echo '<!-- Pz-LkC [IN-SET] /-->'.PHP_EOL;
|
393 |
}
|
394 |
+
$result = $this->pz_SetCache( $data ); // 保存
|
395 |
} elseif ($this->options['in-get'] <> 2) {
|
396 |
+
if ($this->options['debug-time']) {
|
397 |
+
echo '<!-- Pz-LkC [IN-POST] /-->'.PHP_EOL;
|
398 |
}
|
399 |
+
$data = $this->pz_GetPost( $data ); // 最新記事内容を取得
|
400 |
+
$data['link_type'] = 1;
|
401 |
}
|
402 |
}
|
403 |
|
404 |
// 外部リンクの処理
|
405 |
if ( !$link_type ) {
|
406 |
// リンクターゲットの設定
|
407 |
+
$target = ''; // 同ページに開く
|
408 |
if (isset($this->options['ex-target'])) {
|
409 |
if ($this->options['ex-target'] == '1' || ($this->options['ex-target'] == '2' && !$is_mobile)) {
|
410 |
$target = ' target="_blank"'; // 新しいページで開く
|
411 |
}
|
412 |
}
|
413 |
+
$nofollow = isset($this->options['nofollow']) ? ' rel="nofollow"' : ''; // nofollow指定。趣味の問題?
|
414 |
|
415 |
// キャッシュが無い、もしくは強制取得
|
416 |
if ( is_null($data_id) || ( isset($atts['force']) && $atts['force'] == true ) ) {
|
417 |
+
if ($this->options['debug-time']) {
|
418 |
+
echo '<!-- Pz-LkC [OUT-CURL] /-->'.PHP_EOL;
|
419 |
}
|
420 |
+
$result = $this->pz_GetCURL( $data ); // cURLで記事内容を取得
|
421 |
if ( isset($result) && is_array($result) && isset($result['url']) ) {
|
422 |
$data = $result;
|
423 |
$data['link_type'] = 0;
|
426 |
}
|
427 |
}
|
428 |
|
429 |
+
// 念のため初期化
|
430 |
$data_id = (isset($data['id']) ? $data['id'] : null);
|
431 |
$site_name = (isset($data['site_name']) ? $data['site_name'] : null);
|
432 |
$title = (isset($data['title']) ? $data['title'] : null);
|
476 |
} else {
|
477 |
$tag = '<div class="'.$class_id.'">'.$tag.'</div>';
|
478 |
}
|
479 |
+
return $tag; // タグを出力してさっさと終了
|
480 |
}
|
481 |
|
482 |
// サムネイル取得
|
483 |
if ( !$this->options['thumbnail-position'] || ( $result_code <> 0 && $result_code <> 200 ) ) {
|
484 |
$thumbnail = null;
|
485 |
} else {
|
486 |
+
if ($sw_thumbnail == '1' || $sw_thumbnail == '13') { // 直接取得
|
487 |
if ( !$link_type ) {
|
488 |
+
$thumbnail_url = $this->pz_GetThumbnail($thumbnail_url); // 外部サイトのサムネイルをキャッシュ
|
489 |
}
|
490 |
if ( isset($thumbnail_url) && $thumbnail_url <> '' ) {
|
491 |
$thumbnail = '<img class="lkc-thumbnail-img" src="'.$thumbnail_url.'" alt="" />';
|
492 |
+
} elseif ($sw_thumbnail == '13') { // 直接取得に失敗
|
493 |
$sw_thumbnail = '3';
|
494 |
}
|
495 |
}
|
496 |
+
if ($sw_thumbnail == '3') { // WebAPIを利用
|
497 |
// 画像取得(WebAPI)
|
498 |
if (isset($this->options['thumbnail-api'])) {
|
499 |
$thumbnail = preg_replace('/%DOMAIN_URL%/', $domain_url, $this->options['thumbnail-api'] );
|
508 |
if (!isset($this->options['info-position'])) {
|
509 |
$favicon = null;
|
510 |
} else{
|
511 |
+
if ($sw_favicon == '1' || $sw_favicon == '13') { // 直接取得
|
512 |
if ( !is_null($favicon_url ) ) {
|
513 |
$favicon = '<img class="lkc-favicon" src="'.$favicon_url.'" alt="" width=16 height=16 />';
|
514 |
+
} elseif ($sw_favicon == '13') { // 直接取得に失敗
|
515 |
$sw_favicon == '3';
|
516 |
}
|
517 |
}
|
518 |
+
if ($sw_favicon == '3') { // WebAPIを利用
|
519 |
// サイトアイコン取得(WebAPI)
|
520 |
if (isset($this->options['favicon-api'])) {
|
521 |
$favicon = preg_replace('/%DOMAIN_URL%/', $domain_url, $this->options['favicon-api'] );
|
526 |
}
|
527 |
}
|
528 |
|
|
|
|
|
529 |
// タイトル
|
530 |
if (!isset($title) || $title == '') {
|
531 |
$title = esc_html($url); // タイトル取得できていなかったらURLをセットする
|
556 |
$title = $str;
|
557 |
}
|
558 |
|
559 |
+
// 抜粋文整形(抜粋文非表示の場合、空欄にする)
|
|
|
560 |
if (!isset($this->options['display-excerpt']) || is_null($this->options['display-excerpt'])) {
|
561 |
$excerpt = '';
|
562 |
} else {
|
585 |
// 日本語ドメイン対応
|
586 |
if (isset($this->options['flg-idn']) ? true : false) {
|
587 |
if (function_exists('idn_to_utf8')) {
|
588 |
+
if (substr( $domain, 0, 4 ) == 'xn--') {
|
589 |
+
$site_name = idn_to_utf8( $domain );
|
590 |
}
|
591 |
}
|
592 |
}
|
595 |
// リンク先URL
|
596 |
$not_allow_code = array('403','404','410');
|
597 |
if (array_search($alive_result, $not_allow_code)) {
|
598 |
+
// Not found の時は見え消ししてリンクしない
|
599 |
$a_op_all = '<span style="cursor: not-allowed;" title="">';
|
600 |
$a_cl_all = '</span>';
|
601 |
$a_op = '';
|
603 |
$st_op = '<strike>';
|
604 |
$st_cl = '</strike>';
|
605 |
} elseif ((isset($this->options['link-all']) ? $this->options['link-all'] : null) == '1') {
|
606 |
+
// カード全体をリンク(どこをクリックしても良いのが分かり易い)
|
607 |
$a_op_all = '<a class="no_icon" href="'.$url.'"'.$target.$nofollow.'>';
|
608 |
$a_cl_all = '</a>';
|
609 |
$a_op = '';
|
611 |
$st_op = '';
|
612 |
$st_cl = '';
|
613 |
} else {
|
614 |
+
// タイトルとかURLとかを個別でリンク(タイトルや抜粋文などの文字を範囲指定をしてコピー等がし易い)
|
615 |
$a_op_all = '';
|
616 |
$a_cl_all = '';
|
617 |
$a_op = '<a class="no_icon" href="'.$url.'"'.$target.$nofollow.'>';
|
650 |
}
|
651 |
}
|
652 |
$sns .= '</span>';
|
|
|
653 |
if ($this->options['sns-position'] == '1') {
|
654 |
$sns_title = $sns;
|
655 |
} else {
|
661 |
if ($thumbnail) {
|
662 |
$thumbnail = '<span class="lkc-thumbnail">'.$thumbnail.'</span>';
|
663 |
}
|
664 |
+
|
665 |
// サイト情報
|
666 |
$domain_info = '<div class="lkc-info">'.$a_op.'<span class="lkc-domain"'.$site_title.'>'.$favicon.' '.$site_name.$info.'</span>'.$a_cl.' '.$sns_info.$this->plugin_link.'</div>';
|
667 |
|
668 |
// 日本語ドメイン対応
|
669 |
if (isset($this->options['flg-idn']) ? true : false) {
|
|
|
670 |
if (function_exists('idn_to_utf8')) {
|
671 |
+
if (substr( $domain, 0, 4 ) == 'xn--') {
|
672 |
+
$url = $scheme.'://'.idn_to_utf8( $domain ).$location;
|
|
|
673 |
}
|
674 |
}
|
675 |
}
|
678 |
$content = '<div class="lkc-content">'.$a_op.$thumbnail.'<span class="lkc-title">'.$title.'</span>'.$a_cl.$sns_title.'<div class="lkc-url"><cite>'.$st_op.$a_op.$url.$st_cl.$a_cl.'</cite></div><div class="lkc-excerpt">'.$excerpt.'</div></div>';
|
679 |
|
680 |
// Google AMPに暫定対応
|
681 |
+
if ( (isset($this->options['flg-amp']) ? true : false) && (preg_match('{/amp/?$}i', $_SERVER["REQUEST_URI"]) || (function_exists('is_amp_endpoint') && is_amp_endpoint()) ) ) {
|
682 |
+
// 簡易タグ作成
|
683 |
$tag = '<table border="1" cellspacing="0" cellpadding="4"><tbody></tr><tr><td>'.$excerpt.'<br>'.$a_op_all.$a_op.$title.$a_cl.$a_cl_all.' - '.$site_name.'</td></tr></tbody></table>';
|
684 |
} else {
|
685 |
// HTMLタグ作成
|
705 |
return $tag;
|
706 |
}
|
707 |
|
708 |
+
// URLのエンティティ化など(無害化?)
|
709 |
function pz_TrimURL($url = null) {
|
710 |
if (!isset($url) || $url == '') {
|
711 |
$url = null;
|
714 |
|
715 |
if (isset($url) && $url <> '') {
|
716 |
$url = html_entity_decode($url);
|
717 |
+
$url = preg_replace('/^[\s \'\"‘’“”″]*(.*?)[\s \'\"‘’“”″]*$/u', '\1', $url); // 色んな打ち間違え対応
|
718 |
+
$url = esc_url($url); // プロトコル除外など
|
719 |
switch (isset($this->options['trail-slash']) ? $this->options['trail-slash'] : null) {
|
720 |
case '1': // URLがドメイン名だけの場合、最後のスラッシュを除外する
|
721 |
$array_url = parse_url($url);
|
731 |
return $url;
|
732 |
}
|
733 |
|
734 |
+
/**
|
735 |
+
* 相対パスから絶対URLを返します
|
736 |
+
*
|
737 |
+
* @param string $base ベースURL(絶対URL)
|
738 |
+
* @param string $relational_path 相対パス
|
739 |
+
* @return string 相対パスの絶対URL
|
740 |
+
* @link http://blog.anoncom.net/2010/01/08/295.html
|
741 |
+
* @link http://logic.stepserver.jp/data/archives/501.html
|
742 |
+
*/
|
743 |
+
function createUri( $base = '', $relational_path = '' ) {
|
744 |
+
$parse = parse_url ( $base );
|
745 |
+
|
746 |
+
// パス末尾が / で終わるパターン
|
747 |
+
if (substr($parse['path'], -1, 1 ) == '/') {
|
748 |
+
$parse['path'] .= '.'; // ダミー挿入
|
749 |
+
}
|
750 |
+
if (preg_match('/^https?\:\/\//', $relational_path ) ) { // 絶対パスだった場合
|
751 |
+
return $rel_path;
|
752 |
+
} elseif (preg_match('/^\/\//', $relational_path ) ) { // 絶対パスだった場合
|
753 |
+
return $rel_path;
|
754 |
+
} elseif (preg_match('/^\/.*$/', $relational_path ) ) { // ドキュメントルート指定
|
755 |
+
return $parse['scheme'].'://'.$parse ['host'] . $relational_path;
|
756 |
+
} else {
|
757 |
+
// 相対パス処理
|
758 |
+
$basePath = explode ( '/', dirname ( $parse ['path'] ) );
|
759 |
+
$relPath = explode ( '/', $relational_path );
|
760 |
+
foreach ($relPath as $relDirName ) {
|
761 |
+
if ($relDirName == '.' ) {
|
762 |
+
array_shift($basePath );
|
763 |
+
array_unshift($basePath, '' );
|
764 |
+
} elseif ($relDirName == '..' ) {
|
765 |
+
array_pop($basePath );
|
766 |
+
if (count($basePath ) == 0 ) {
|
767 |
+
$basePath = array('' );
|
768 |
+
}
|
769 |
+
} else {
|
770 |
+
array_push($basePath, $relDirName );
|
771 |
+
}
|
772 |
+
}
|
773 |
+
$path = implode ('/', $basePath );
|
774 |
+
return $parse['scheme'].'://'.$parse['host'].$path;
|
775 |
+
}
|
776 |
+
}
|
777 |
+
|
778 |
// ソーシャルカウント取得
|
779 |
public function pz_RenewSNSCount( $data ) {
|
780 |
if (!isset($this->options['sns-position']) || $this->options['sns-position'] == '') {
|
846 |
}
|
847 |
}
|
848 |
|
849 |
+
// 登録してから一週間までは毎日、それ以降は週一回更新(取得が固まらないようにランダム時間付与)
|
850 |
if ($update_cnt || ($this->now - strtotime($data['regist']) < WEEK_IN_SECONDS)) {
|
851 |
$sns_nexttime = $this->now + DAY_IN_SECONDS + rand(0, DAY_IN_SECONDS); // 1day + 0-24h
|
852 |
} else {
|
897 |
if (is_wp_error($data)) {
|
898 |
return null;
|
899 |
}
|
900 |
+
return (array) $data; // Arrayに直して返す
|
901 |
}
|
902 |
|
903 |
// キャッシュデータを保存
|
914 |
if (!isset($data['url_key']) || is_null($data['url_key']) || $data['url_key'] == '' ) {
|
915 |
$data['url_key'] = hash( 'sha256', esc_url( $url ), true);
|
916 |
}
|
917 |
+
|
918 |
+
if (!$data['regist_result']) { // 最初登録時情報
|
919 |
+
$data['regist_title'] = $data['title'];
|
920 |
+
$data['regist_excerpt'] = $data['excerpt'];
|
921 |
+
$data['regist_charset'] = $data['charset'];
|
922 |
+
$data['regist_result'] = $data['result_code'];
|
923 |
+
$data['regist_time'] = $this->now;
|
924 |
+
}
|
925 |
+
$data['uptime'] = $this->now; // 最終更新日時
|
926 |
|
927 |
// 更新してみる
|
928 |
if ( isset($data['id']) ) {
|
950 |
$this->db_name,
|
951 |
$data
|
952 |
);
|
|
|
953 |
if (!$result) {
|
954 |
+
// 挿入できなかったら日本語項目を落としてなるべく登録する
|
955 |
+
unset($data['site_name']);
|
956 |
+
$result = $wpdb->insert(
|
957 |
+
$this->db_name,
|
958 |
+
$data
|
959 |
+
);
|
960 |
+
if (!$result) {
|
961 |
+
unset($data['excerpt']);
|
962 |
+
$result = $wpdb->insert(
|
963 |
+
$this->db_name,
|
964 |
+
$data
|
965 |
+
);
|
966 |
+
if (!$result) {
|
967 |
+
unset($data['title']);
|
968 |
+
$result = $wpdb->insert(
|
969 |
+
$this->db_name,
|
970 |
+
$data
|
971 |
+
);
|
972 |
+
if (!$result) {
|
973 |
+
return $data;
|
974 |
+
}
|
975 |
+
}
|
976 |
+
}
|
977 |
}
|
978 |
}
|
979 |
return $this->pz_GetCache($data);
|
1013 |
|
1014 |
// サイトアイコン
|
1015 |
if (function_exists('has_site_icon') && has_site_icon()) {
|
1016 |
+
$favicon = get_site_icon_url(16, '', 0);
|
1017 |
} else {
|
1018 |
+
$favicon = null;
|
1019 |
}
|
1020 |
|
1021 |
+
$title = null;
|
1022 |
+
$excerpt = null;
|
1023 |
+
$thumbnail = null;
|
1024 |
|
1025 |
// 記事内容
|
1026 |
+
$url = $data['url'];
|
1027 |
+
$post_id = url_to_postid($url ); // 記事IDを取得
|
1028 |
+
if ($this->options['debug-time']) {
|
1029 |
+
echo '<!-- Pz-LkC [PID='.$post_id.'] /-->'.PHP_EOL;
|
1030 |
}
|
1031 |
if ( $post_id ) {
|
1032 |
+
$result_code = 200; // 外部取得と同じコードをセット
|
1033 |
+
$post = get_post($post_id); // 記事情報
|
1034 |
if ( $this->options['in-get'] ) {
|
1035 |
+
$title = $post->post_title; // 記事タイトル
|
1036 |
+
$excerpt = $post->post_content; // 記事内容から抜粋
|
1037 |
} else {
|
1038 |
+
$title = $post->post_title; // 記事タイトル
|
1039 |
+
$excerpt = $post->post_excerpt; // 抜粋文優先
|
1040 |
if ($excerpt == '') {
|
1041 |
+
$excerpt = $post->post_content; // 抜粋文が無かったら記事
|
1042 |
}
|
1043 |
}
|
1044 |
+
$thumbnail_id = get_post_thumbnail_id( $post_id ); // サムネイル
|
1045 |
+
if ($this->options['debug-time']) {
|
1046 |
+
echo '<!-- Pz-LkC [TID='.$thumbnail_id.'] /-->'.PHP_EOL;
|
1047 |
}
|
1048 |
$attach = wp_get_attachment_image_src( $thumbnail_id, 'thumbnail', true );
|
1049 |
if (isset($attach) && count($attach) > 3 && isset($attach[0])) {
|
1050 |
$thumbnail = $attach[0];
|
1051 |
}
|
1052 |
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1053 |
$title = get_bloginfo('name');
|
1054 |
$excerpt = get_bloginfo('description');
|
1055 |
$site_name = get_bloginfo('name');
|
1056 |
$thumbnail = '';
|
1057 |
$result_code = '200';
|
1058 |
+
|
1059 |
+
// カテゴリ ページの処理
|
1060 |
+
$cat_url = home_url().'/category/';
|
1061 |
+
$cat_len = mb_strlen($cat_url );
|
1062 |
+
if (substr($url, 0, $cat_len ) == $cat_url ) {
|
1063 |
+
$cat_slug = substr($url, $cat_len );
|
1064 |
+
$cat_data = get_category_by_slug($cat_slug );
|
1065 |
+
$cat_count = ($cat_data->count - 0);
|
1066 |
+
$title = __('Category', $this->text_domain ).' '.__('‘', $this->text_domain ).$cat_data->name.__('’', $this->text_domain );
|
1067 |
+
$excerpt = __('(', $this->text_domain ).__('Count', $this->text_domain ).':'.($cat_data->count - 0).__(')', $this->text_domain ).' '.$cat_data->description;
|
1068 |
+
if (!isset($cat_data->slug)) {
|
1069 |
+
$result_code = '404';
|
1070 |
+
}
|
1071 |
+
} else {
|
1072 |
+
// タグ ページの処理
|
1073 |
+
$cat_url = home_url().'/tag/';
|
1074 |
+
$cat_len = mb_strlen($cat_url );
|
1075 |
+
if (substr($url, 0, $cat_len ) == $cat_url ) {
|
1076 |
+
$cat_slug = substr($url, $cat_len );
|
1077 |
+
$cat_data = get_tags( array( 'slug' => $cat_slug ) );
|
1078 |
+
$title = __('Tag', $this->text_domain ).' '.__('‘', $this->text_domain ).$cat_data[0]->name.__('’', $this->text_domain );
|
1079 |
+
$excerpt = __('(', $this->text_domain ).__('Count', $this->text_domain ).':'.($cat_data[0]->count - 0).__(')', $this->text_domain ).' '.$cat_data[0]->description;
|
1080 |
+
if (!isset($cat_data[0]->slug)) {
|
1081 |
+
$result_code = '404';
|
1082 |
+
}
|
1083 |
+
}
|
1084 |
+
}
|
1085 |
}
|
1086 |
|
1087 |
// タイトル整形
|
1107 |
}
|
1108 |
|
1109 |
// データセット
|
1110 |
+
if ($data['title'] == $title ) {
|
1111 |
+
$before['mod_title'] = 0;
|
1112 |
} else {
|
1113 |
+
$before['mod_title'] = 1;
|
1114 |
}
|
1115 |
+
if ($data['excerpt'] == $excerpt ) {
|
1116 |
+
$before['mod_excerpt'] = 0;
|
1117 |
} else {
|
1118 |
+
$before['mod_excerpt'] = 1;
|
1119 |
+
}
|
1120 |
+
if (empty($data['use_post_id1'])) {
|
1121 |
+
$data['use_post_id1'] = get_the_ID();
|
1122 |
+
}
|
1123 |
+
$data['scheme'] = $scheme;
|
1124 |
+
$data['domain'] = $domain;
|
1125 |
+
$data['location'] = $location;
|
1126 |
+
$data['site_name'] = $site_name;
|
1127 |
+
$data['title'] = $title;
|
1128 |
+
$data['excerpt'] = $excerpt;
|
1129 |
+
$data['thumbnail'] = $thumbnail;
|
1130 |
+
$data['favicon'] = $favicon;
|
1131 |
+
$data['result_code'] = $result_code;
|
1132 |
+
$data['alive_result'] = $result_code;
|
1133 |
+
$data['favicon'] = $favicon;
|
1134 |
|
1135 |
return $data;
|
1136 |
}
|
1153 |
$charset = null;
|
1154 |
$result_code = null;
|
1155 |
|
1156 |
+
// URLパース(ドメイン名などを抽出)
|
1157 |
+
$url_m = parse_url( $url );
|
1158 |
+
$scheme = $url_m['scheme']; // スキーム
|
1159 |
+
$domain = $url_m['host']; // ドメイン名
|
1160 |
+
$domain_url = $scheme.'://'.$url_m['host']; // ドメインURL
|
1161 |
+
$location = substr($url, mb_strlen($domain_url)); // ドメイン名以降
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1162 |
|
1163 |
if ( function_exists( 'curl_init' ) ) { // cURLを使用する
|
1164 |
$result_code = 0;
|
1169 |
curl_setopt( $ch, CURLOPT_REFERER, get_permalink() ); // リファラ
|
1170 |
}
|
1171 |
if (isset($this->options['flg-agent']) ? true : false) {
|
1172 |
+
curl_setopt( $ch, CURLOPT_USERAGENT, $this->options['user-agent'] ); // ユーザーエージェントにPz-LinkCard-Crawlerを使う
|
|
|
1173 |
} else {
|
1174 |
+
curl_setopt( $ch, CURLOPT_USERAGENT, esc_html( $_SERVER['HTTP_USER_AGENT'] ) ); // アクセス者のユーザーエージェントを使う
|
1175 |
}
|
1176 |
if (isset($this->options['flg-redir']) ? true : false) {
|
1177 |
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, true ); // リダイレクトを処理する
|
1180 |
} else {
|
1181 |
curl_setopt( $ch, CURLOPT_FOLLOWLOCATION, false ); // リダイレクトを処理しない
|
1182 |
}
|
1183 |
+
curl_setopt( $ch, CURLOPT_COOKIESESSION, true ); // セッションCOOKIEを使用する
|
1184 |
+
curl_setopt( $ch, CURLOPT_SSL_VERIFYPEER, (isset($this->options['flg-ssl']) ? false : true) ); // SSL検証
|
1185 |
$html = curl_exec($ch);
|
1186 |
+
$errno = intval( curl_errno( $ch ) ); // cURL実行
|
1187 |
if ( $errno ) {
|
1188 |
+
$html = ''; // cURLエラー
|
1189 |
+
$result_code = $errno;
|
1190 |
+
$error = true;
|
1191 |
} else {
|
1192 |
+
$header = curl_getinfo($ch);
|
1193 |
+
$result_code = $header['http_code']; // HTTPステータス
|
1194 |
+
$error = false;
|
1195 |
}
|
1196 |
curl_close($ch);
|
1197 |
+
} else { // cURLが使用できない場合
|
1198 |
+
$result = wp_remote_get( $url ); //wp_remote_get実行
|
1199 |
if ( is_wp_error( $result ) ) {
|
1200 |
+
$html = '';
|
1201 |
+
$result_code = -1; // wp_remote_getエラー
|
1202 |
+
$error = true;
|
1203 |
} else {
|
1204 |
+
$html = $result['body'];
|
1205 |
+
$result_code = $result['response']['code']; // HTTPステータス
|
1206 |
+
$error = false;
|
1207 |
}
|
1208 |
}
|
1209 |
|
1210 |
// 文字コード判定
|
1211 |
$charset = null;
|
1212 |
if ($html <> '') {
|
1213 |
+
if (preg_match('/charset\s*=\s*"*([^>\/\s]*)"*.*<\/head/si', $html, $m)) {
|
1214 |
$m[1] = trim(trim($m[1]), '\'\"');
|
1215 |
$charset = $m[1];
|
1216 |
} else {
|
|
|
1217 |
foreach(array('UTF-8','SJIS','EUC-JP','eucJP-win','ASCII','JIS','SJIS-win') as $c_charset) {
|
1218 |
// 文字コード変換してみて内容が変わらないものを文字セットと判断する
|
1219 |
if (mb_convert_encoding($html, $this->charset, $c_charset) == $html) {
|
1221 |
break;
|
1222 |
}
|
1223 |
}
|
1224 |
+
// $charset = mb_detect_encoding( $html ); // PHPに判定をまかせたい人向け
|
1225 |
}
|
1226 |
if (is_null($charset)) {
|
1227 |
$charset = 'auto';
|
1230 |
$html = mb_convert_encoding($html, $this->charset, $charset);
|
1231 |
}
|
1232 |
|
1233 |
+
// HEADタグ(METAタグ解析)
|
1234 |
$head = null;
|
1235 |
$tags = null;
|
1236 |
if (preg_match('/<\s*head\s*[^>]*>(.*)<\s*\/head\s*>/si', $html, $m)) {
|
1262 |
} elseif (isset( $tags['twitter:image'] ) && $tags['twitter:image'] ) {
|
1263 |
$thumbnail_url = $tags['twitter:image'] ;
|
1264 |
}
|
1265 |
+
if ($thumbnail_url && !preg_match('/^https*:\/\//', $thumbnail_url, $m) ) {
|
1266 |
+
$thumbnail_url = $this->createUri($url, $thumbnail_url);
|
1267 |
+
}
|
1268 |
+
|
1269 |
+
// OGPからサイトアイコンURL取得
|
1270 |
+
if (isset( $tags['icon'] ) && $tags['icon'] ) {
|
1271 |
+
$favicon_url = $tags['icon'] ;
|
1272 |
+
} elseif (isset( $tags['shortcut icon'] ) && $tags['shortcut icon'] ) {
|
1273 |
+
$favicon_url = $tags['shortcut icon'] ;
|
1274 |
+
} elseif (isset( $tags['apple-touch-icon'] ) && $tags['apple-touch-icon']) {
|
1275 |
+
$favicon_url = $tags['apple-touch-icon'] ;
|
1276 |
+
}
|
1277 |
+
if ($favicon_url && !preg_match('/^https*:\/\//', $favicon_url, $m) ) {
|
1278 |
+
$favicon_url = $this->createUri($url, $favicon_url);
|
1279 |
+
}
|
1280 |
|
1281 |
// サイト名
|
1282 |
if (isset( $tags['og:site_name'] ) && $tags['og:site_name'] ) {
|
1310 |
if (isset($url_key) && !is_null($url_key)) {
|
1311 |
$data['url_key'] = $url_key;
|
1312 |
}
|
1313 |
+
$data['site_name'] = $site_name;
|
1314 |
+
$data['title'] = $title;
|
1315 |
+
$data['excerpt'] = $excerpt;
|
1316 |
+
$data['mod_title'] = 0;
|
1317 |
+
$data['mod_excerpt'] = 0;
|
1318 |
+
$data['charset'] = $charset;
|
1319 |
+
// if (isset($atts['force']) && $atts['force'] == true) {
|
1320 |
+
// $data['regist'] = $this->now_mysql; // 登録日
|
1321 |
+
// }
|
1322 |
+
}
|
1323 |
+
$data['url'] = $url;
|
1324 |
+
$data['thumbnail'] = ( isset($thumbnail_url) ? $thumbnail_url : null );
|
1325 |
+
$data['result_code'] = $result_code;
|
1326 |
+
$data['alive_result'] = $result_code;
|
1327 |
+
$data['scheme'] = $scheme;
|
1328 |
+
$data['domain'] = $domain;
|
1329 |
+
$data['location'] = $location;
|
1330 |
+
$data['favicon'] = ( isset($favicon_url) ? $favicon_url : null );
|
1331 |
+
if (empty($data['use_post_id1'])) {
|
1332 |
+
$data['use_post_id1'] = get_the_ID();
|
1333 |
+
}
|
1334 |
+
$data['sns_twitter'] = (isset( $data['sns_twitter'] ) ? $data['sns_twitter'] : -1 );
|
1335 |
+
$data['sns_facebook'] = (isset( $data['sns_facebook'] ) ? $data['sns_facebook'] : -1 );
|
1336 |
+
$data['sns_hatena'] = (isset( $data['sns_hatena'] ) ? $data['sns_hatena'] : -1 );
|
1337 |
+
$data['sns_nexttime'] = (isset( $data['sns_nexttime'] ) ? $data['sns_nexttime'] : 0 );
|
1338 |
+
$data['uptime'] = $this->now;
|
1339 |
+
$data['alive_time'] = $this->now;
|
1340 |
+
$data['alive_result'] = $result_code;
|
1341 |
return $data;
|
1342 |
}
|
1343 |
|
1364 |
$tags += array_combine($match[1], $match[2]);
|
1365 |
}
|
1366 |
|
1367 |
+
// linkタグ パース
|
1368 |
+
$match = null;
|
1369 |
+
preg_match_all('/<\s*link\s(?=[^>]*?\brel\s*=\s*(?|"\s*([^"]*?)\s*"|\'\s*([^\']*?)\s*\'|([^"\'>]*?)(?=\s*\/?\s*>|\s\w+\s*=)))[^>]*?\bhref\s*=\s*(?|"\s*([^"]*?)\s*"|\'\s*([^\']*?)\s*\'|([^"\'>]*?)(?=\s*\/?\s*>|\s\w+\s*=))[^>]*>/is', $html, $match);
|
1370 |
+
if (isset($match) && is_array($match) && count($match) == 3 && count($match[1]) > 0) {
|
1371 |
+
foreach ($match[1] as &$m) {
|
1372 |
+
$m = strtolower($m);
|
1373 |
+
}
|
1374 |
+
unset($m);
|
1375 |
+
$tags += array_combine($match[1], $match[2]);
|
1376 |
+
}
|
1377 |
+
|
1378 |
return $tags;
|
1379 |
}
|
1380 |
|
1502 |
if (isset($data) && isset($data->url)) {
|
1503 |
$before = $this->pz_GetCache( array( 'url' => $data->url ) );
|
1504 |
$after = $this->pz_GetCURL( $before );
|
1505 |
+
if ($before['title'] == $after['title'] ) {
|
1506 |
+
$before['mod_title'] = 0;
|
1507 |
} else {
|
1508 |
+
$before['mod_title'] = 1;
|
1509 |
}
|
1510 |
+
if ($before['excerpt'] == $after['excerpt'] ) {
|
1511 |
+
$before['mod_excerpt'] = 0;
|
1512 |
} else {
|
1513 |
+
$before['mod_excerpt'] = 1;
|
1514 |
}
|
1515 |
+
$before['alive_result'] = $after['result_code'];
|
1516 |
+
$before['alive_time'] = $this->now;
|
1517 |
+
$before['thumbnail'] = $after['thumbnail'];
|
1518 |
+
$before['favicon'] = $after['favicon'];
|
1519 |
$before = $this->pz_SetCache( $before );
|
1520 |
}
|
1521 |
}
|
readme.txt
CHANGED
@@ -155,6 +155,22 @@ A5.
|
|
155 |
5. "Write shortcode and url"
|
156 |
|
157 |
== Changelog ==
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
158 |
Ver2.0.0
|
159 |
* URL指定に「href」も使用できるように変更しました。(Thanks @weblearninglog)
|
160 |
Modefied: "href" was added to the parameter that specifies the URL.
|
155 |
5. "Write shortcode and url"
|
156 |
|
157 |
== Changelog ==
|
158 |
+
Ver2.0.1
|
159 |
+
* 内部リンクのカテゴリーページ/タグページに対応しました。
|
160 |
+
Added: Supported display of category page.
|
161 |
+
|
162 |
+
Ver2.0.0.3
|
163 |
+
* Ver2.0.0.2で発生した内部リンクが取得できない不具合を修正しました。
|
164 |
+
Fixed: Fixed a bug.
|
165 |
+
|
166 |
+
Ver2.0.0.2
|
167 |
+
* 未実装のJavaScriptの呼び出しがあったので修正しました。
|
168 |
+
Fixed: Fixed a bug.
|
169 |
+
|
170 |
+
Ver2.0.0.1
|
171 |
+
* idn_to_utf8()が実装されていない環境でエラーが出ていたので対応しました。
|
172 |
+
Fixed: Fixed a bug.
|
173 |
+
|
174 |
Ver2.0.0
|
175 |
* URL指定に「href」も使用できるように変更しました。(Thanks @weblearninglog)
|
176 |
Modefied: "href" was added to the parameter that specifies the URL.
|