SEO SIMPLE PACK - Version 2.0.0

Version Description

  • You can now set "og:image" for each page.
  • Added 'ssp_output_og_site_name' hook
  • English is supported.
  • Adjusted the design of the setting page a little
Download this release

Release Info

Developer looswebstudio
Plugin Icon 128x128 SEO SIMPLE PACK
Version 2.0.0
Comparing to
See all releases

Code changes from version 1.3.1 to 2.0.0

Files changed (71) hide show
  1. assets/css/ssp.css +0 -367
  2. assets/img/noimg.gif +0 -0
  3. assets/js/ssp_common.js +0 -16
  4. class/__branch.php +61 -0
  5. class/activate.php +35 -0
  6. class/data.php +230 -0
  7. class/hooks.php +198 -0
  8. class/menu.php +163 -0
  9. class/metabox.php +306 -0
  10. class/output.php +681 -0
  11. class/ssp_activate.php +0 -57
  12. class/ssp_branch.php +0 -14
  13. class/ssp_data.php +0 -147
  14. class/ssp_init.php +0 -96
  15. class/ssp_menu.php +0 -158
  16. class/ssp_metabox.php +0 -333
  17. class/ssp_methods.php +0 -355
  18. class/ssp_output.php +0 -1009
  19. class/trait/field.php +268 -0
  20. class/trait/output_helper.php +326 -0
  21. class/utility.php +94 -0
  22. composer.json +23 -0
  23. composer.lock +342 -0
  24. dist/css/common.css +1 -0
  25. dist/css/post.css +1 -0
  26. dist/css/ssp.css +1 -0
  27. dist/css/term.css +1 -0
  28. dist/js/common.js +1 -0
  29. dist/js/mediauploader.js +1 -0
  30. dist/js/ssp.js +1 -0
  31. inc/page_help.php +64 -55
  32. inc/page_ogp.php +44 -68
  33. inc/page_top.php +44 -68
  34. inc/parts/tab_analytics.php +0 -45
  35. inc/parts/tab_archive.php +0 -139
  36. inc/parts/tab_basic.php +0 -118
  37. inc/parts/tab_facebook.php +0 -51
  38. inc/parts/tab_ogp.php +0 -38
  39. inc/parts/tab_post_type.php +0 -187
  40. inc/parts/tab_taxonomy.php +0 -187
  41. inc/parts/tab_twitter.php +0 -63
  42. inc/parts/tab_webmaster.php +0 -39
  43. inc/tab/ogp_basic.php +21 -0
  44. inc/tab/ogp_facebook.php +22 -0
  45. inc/tab/ogp_twitter.php +25 -0
  46. inc/tab/top_analytics.php +22 -0
  47. inc/tab/top_archive.php +79 -0
  48. inc/tab/top_basic.php +86 -0
  49. inc/tab/top_post_type.php +104 -0
  50. inc/tab/top_taxonomy.php +110 -0
  51. inc/tab/top_webmaster.php +24 -0
  52. languages/loos-ssp-ja.mo +0 -0
  53. languages/loos-ssp-ja.po +542 -83
  54. readme.txt +74 -154
  55. seo-simple-pack.php +44 -35
  56. src/js/common.js +21 -0
  57. src/js/mediauploader.js +84 -0
  58. {assets → src}/js/ssp.js +0 -72
  59. src/scss/common.scss +2 -0
  60. src/scss/common/_media.scss +51 -0
  61. src/scss/common/_notice.scss +34 -0
  62. src/scss/inc/_field.scss +98 -0
  63. src/scss/inc/_help.scss +18 -0
  64. src/scss/inc/_help_btn.scss +22 -0
  65. src/scss/inc/_preview.scss +30 -0
  66. src/scss/inc/_ssp_page.scss +0 -0
  67. src/scss/inc/_ssp_tabs.scss +31 -0
  68. src/scss/inc/_switch.scss +60 -0
  69. src/scss/post.scss +12 -0
  70. src/scss/ssp.scss +131 -0
  71. src/scss/term.scss +32 -0
assets/css/ssp.css DELETED
@@ -1,367 +0,0 @@
1
- @charset "UTF-8";
2
-
3
- #ssp_wrap{
4
- box-sizing: border-box;
5
- padding: 8px;
6
- margin: 0 20px 20px 0;
7
- }
8
- #ssp_wrap * {
9
- box-sizing: border-box;
10
- }
11
-
12
- #ssp_wrap #ssp_updated{
13
- margin: 24px 0 24px;
14
- }
15
-
16
- /* 通知クローズボタン */
17
- .ssp_notice{
18
- position: relative;
19
- }
20
- .ssp_notice .notice-dismiss{
21
- cursor: pointer;
22
- }
23
-
24
- .ssp_notice .notice-dismiss:before{
25
- display: inline-block;
26
- vertical-align: middle;
27
- }
28
-
29
- .ssp_notice .notice-dismiss span{
30
- vertical-align: middle;
31
- }
32
- .ssp_notice{
33
- border-left-color: #b3c973;
34
- }
35
-
36
-
37
- .notice-dismiss:active,
38
- .notice-dismiss:focus,
39
- .notice-dismiss:hover {
40
- box-shadow: 0 0 4px #ccc;
41
- }
42
- .notice-dismiss:active:before,
43
- .notice-dismiss:focus:before,
44
- .notice-dismiss:hover:before {
45
- color: #c00;
46
- }
47
-
48
- /* devエリア */
49
- .dev_area{
50
- padding: 8px;
51
- margin: 16px;
52
- background: #fff;
53
- box-shadow: inset 0 0 4px #ccc;
54
- overflow: auto;
55
- max-height: 400px;
56
- position: relative;
57
- }
58
-
59
- .dev_area p{
60
- margin: -8px -8px 0;
61
- background: #e6e6de;
62
- font-size: 12px;
63
- padding: 0 8px;
64
- }
65
- .dev_area pre{
66
- font-size: 12px;
67
- margin: 0;
68
- }
69
- .dev_area font{
70
- color: rgb(201, 128, 110);
71
- }
72
- .dev_area pre small:nth-of-type(1) {
73
- background: #e6e6de;
74
- position: absolute;
75
- top: 0;
76
- right: 0;
77
- padding: 4px;
78
- }
79
- .dev_area pre small{
80
- font-size: 12px;
81
- }
82
- .dev_area pre i{
83
- font-size: 12px;
84
- color: #9973b9;
85
- font-style: normal;
86
- }
87
-
88
-
89
- /* フォームパーツ */
90
- #ssp_wrap input[type="text"]{
91
- width: 100%;
92
- padding: 8px;
93
- }
94
- #ssp_wrap textarea{
95
- width: 90%;
96
- height: 12em;
97
- }
98
- #ssp_wrap select{
99
- min-width: 15em;
100
- }
101
- #ssp_wrap input.sep_radio{
102
- display: none;
103
- }
104
- #ssp_wrap label.sep_radio{
105
- text-align: center;
106
- width: 40px;
107
- height: 40px;
108
- line-height: 34px;
109
- vertical-align: middle;
110
- padding: 0;
111
- margin: 4px;
112
- background: #fcfcfc;
113
- border: solid 1px #ccc;
114
- box-shadow: inset 0 0 2px #fff;
115
- }
116
- #ssp_wrap .sep_radio:checked + label.sep_radio{
117
-
118
- border: solid 2px rgb(235, 161, 112);
119
- }
120
- #ssp_wrap .sep .ssp_item{
121
- display: flex;
122
- flex-wrap: wrap;
123
- }
124
-
125
- #ssp_wrap .hide{
126
- display: none;
127
- }
128
-
129
- #ssp_wrap.ssp_metabox > label{
130
- display: block;
131
- padding: 0 0 4px;
132
- font-weight: bold;
133
- vertical-align: middle;
134
- }
135
-
136
- #ssp_wrap.ssp_metabox > label::before{
137
- content: "";
138
- display: inline-block;
139
- width: 8px;
140
- height: 16px;
141
- border: solid 1px #c9d6a1;
142
- box-shadow: inset -1px -1px 8px #fff;
143
- background: #c9d6a1;
144
- border-radius: 2px;
145
- vertical-align: middle;
146
- margin-right: 4px;
147
- cursor: initial;
148
- position: relative;
149
- top: -1px;
150
- }
151
- #ssp_wrap.ssp_metabox .ssp_meta_inner{
152
- margin: 8px 0 40px;
153
- padding-left: 24px;
154
- }
155
- #ssp_metabox h2{
156
- font-size: 16px;
157
- }
158
- #ssp_metabox h2:first-letter{
159
- font-size: 1.6em;
160
- color: #b3c973;
161
- letter-spacing: 1px;
162
- }
163
-
164
- /* ssp form-table */
165
- #ssp_wrap table.form-table th,
166
- #ssp_wrap table.form-table td{
167
- display: block;
168
- width: 100%;
169
- padding-bottom: 0;
170
- }
171
- #ssp_wrap table.form-table td{
172
- padding-left: 40px;
173
- }
174
- /* #ssp_wrap #post_type .tr_desc{
175
- display: none;
176
- } */
177
- /*
178
- ssp_item
179
- */
180
- #ssp_wrap h2.hndle{
181
- cursor: unset;
182
- }
183
- #ssp_wrap code {
184
- padding: 1px 4px 2px;
185
- }
186
-
187
- .ssp_help{
188
- margin-left: 16px;
189
- border-radius: 50%;
190
- padding: 0px;
191
- width: 24px;
192
- height: 24px;
193
- line-height: 24px;
194
- text-decoration: none;
195
- background: rgb(100, 100, 100);
196
- color: #fff;
197
- display: inline-block;
198
- vertical-align: middle;
199
- text-align: center;
200
- box-shadow: inset 0 0 4px rgba(204, 204, 204, 0.6);
201
- font-size: 12px;
202
- }
203
- #ssp_wrap td .inner{
204
- display: flex;
205
- flex-wrap: wrap;
206
- justify-content: space-between;
207
- }
208
-
209
- .ssp_item{
210
- width: 40%;
211
- }
212
- .textarea .ssp_item{
213
- width: 100%;
214
- }
215
- .ssp_desc{
216
- color: #666;
217
- font-size: 13px;
218
- font-style: italic;
219
- width: 56%;
220
- }
221
- .ssp_help_table{
222
- background: #fff;
223
- margin: 16px;
224
- }
225
- .ssp_help_table thead{
226
- background: #e3e4e3;
227
- }
228
- .ssp_help_table td,
229
- .ssp_help_table th{
230
- padding: 4px 8px;
231
- }
232
-
233
- #ssp_wrap #media_preview {
234
- margin-bottom: 24px;
235
- }
236
- #ssp_wrap #media_preview img{
237
- width: 400px;
238
- }
239
- #ssp_wrap #media_preview .no_image{
240
- width: 400px;
241
- padding: 40px 40px;
242
- border:dashed 1px #ccc;
243
- }
244
- #ssp_wrap #media_btn {
245
- margin-right: 24px;
246
- }
247
-
248
- /* disable row */
249
-
250
- tr[data-disable="1"] + tr,
251
- tr[data-disable="1"] + tr + tr,
252
- tr[data-disable="1"] + tr + tr + tr{
253
- display: none;
254
- }
255
-
256
-
257
-
258
- @media screen and (max-width: 767px) {
259
- .ssp_desc{
260
- width: 100%;
261
- }
262
- .ssp_item{
263
- width: 100%;
264
- }
265
- }
266
-
267
- .ssp_prev{
268
- padding: 4px;
269
- width: 100%;
270
- }
271
- .ssp_prev p {
272
- display: inline-block;
273
- background: #ececec;
274
- padding: 8px 12px;
275
- box-shadow: inset 0 0 4px #ccc;
276
- }
277
- .ssp_prev span{
278
- color: #fff;
279
- padding: 4px 8px;
280
- margin: 0 2px;
281
- font-size: 13px;
282
- border-radius: 4px;
283
- background: rgb(135, 171, 135);
284
- }
285
-
286
-
287
- /* タブコンテンツ */
288
- .nav-tab{
289
- cursor: pointer;
290
- }
291
- .nav-tab.act_{
292
- border-bottom: 1px solid #f1f1f1;
293
- background: #f1f1f1;
294
- color: #000;
295
- }
296
-
297
- .tab-contents{
298
- display: none;
299
- }
300
- .tab-contents.act_{
301
- display: block;
302
- }
303
-
304
-
305
-
306
- /* The switch - the box around the slider */
307
- .ssp_switch_box {
308
- position: relative;
309
- display: inline-block;
310
- width: 64px;
311
- height: 28px;
312
- margin: 0 8px;
313
- }
314
-
315
- /* Hide default HTML checkbox */
316
- .ssp_switch_box input {display:none;}
317
-
318
- /* The slider */
319
- .ssp_switch_box__slider {
320
- position: absolute;
321
- cursor: pointer;
322
- top: 0;
323
- left: 0;
324
- right: 0;
325
- bottom: 0;
326
- background-color: #ccc;
327
- -webkit-transition: .4s;
328
- transition: .4s;
329
- }
330
-
331
- .ssp_switch_box__slider:before {
332
- position: absolute;
333
- content: "";
334
- height: 20px;
335
- width: 20px;
336
- right: 4px;
337
- bottom: 4px;
338
- background-color: white;
339
- -webkit-transition: .4s;
340
- transition: .4s;
341
- }
342
-
343
- input:checked + .ssp_switch_box__slider {
344
- background-color: #2196F3;
345
- }
346
-
347
- input:checked + .ssp_switch_box__slider:before {
348
- right: 40px;
349
- }
350
-
351
- /* Rounded sliders */
352
- .ssp_switch_box__slider.-round {
353
- border-radius: 34px;
354
- }
355
-
356
- .ssp_switch_box__slider.-round:before {
357
- border-radius: 50%;
358
- }
359
-
360
- /* タームメタ */
361
- .form-table .ssp_term_meta_title td{
362
- padding-left: 0;
363
- }
364
- .ssp_term_meta_title h2{
365
- border-top: dashed 1px #ccc;
366
- padding: 16px 0 0;
367
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
assets/img/noimg.gif DELETED
Binary file
assets/js/ssp_common.js DELETED
@@ -1,16 +0,0 @@
1
- (function ($) {
2
- //noindex switch
3
- $switchBox = $('.ssp_switch_box');
4
- $switchBox.click(function (e){
5
- var labelFor = $(this).attr('for');
6
- var p = $(this).closest('tr');
7
- setTimeout( function() {
8
- var val = $('#' + labelFor).prop('checked');
9
- $('input[name="' + labelFor + '"]').val( Number(val) );
10
-
11
- if (p.attr('data-disable') !== undefined) {
12
- p.attr('data-disable', Number(val));
13
- }
14
- }, 10);
15
- });
16
- })(window.jQuery);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
class/__branch.php ADDED
@@ -0,0 +1,61 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class SSP_Branch {
3
+
4
+ /**
5
+ * 外部からのインスタンス化を防ぐ
6
+ */
7
+ private function __construct() {}
8
+
9
+ /**
10
+ * 条件分岐タグの結果を取得
11
+ * Conditional_Tags
12
+ */
13
+ public static $is_ = null;
14
+
15
+
16
+ /**
17
+ * init
18
+ */
19
+ public static function init() {
20
+ add_action( 'wp', [ 'SSP_Branch', 'set_branch' ], 1 );
21
+ }
22
+
23
+
24
+ /**
25
+ * 条件分岐タグの結果を変数に代入
26
+ */
27
+ public static function set_branch() {
28
+
29
+ self::$is_ = [
30
+ 'home' => is_home(),
31
+ 'front' => is_front_page(),
32
+ 'single' => is_single(),
33
+ 'page' => is_page(),
34
+ 'singular' => is_singular(),
35
+ 'category' => is_category(),
36
+ 'tag' => is_tag(),
37
+ 'tax' => is_tax(),
38
+ 'attachment' => is_attachment(),
39
+ 'archive' => is_archive(),
40
+ 'pt_archive' => is_post_type_archive(),
41
+ 'author' => is_author(),
42
+ 'date' => is_date(),
43
+ 'year' => is_year(),
44
+ 'month' => is_month(),
45
+ 'day' => is_day(),
46
+ 'search' => is_search(),
47
+ '404' => is_404(),
48
+ ];
49
+ if ( is_front_page() ) {
50
+ self::$is_['top'] = true;
51
+ } elseif ( is_home() ) {
52
+ if ( get_queried_object_id() === 0 ) {
53
+ self::$is_['top'] = true;
54
+ } else {
55
+ self::$is_['top'] = false;
56
+ }
57
+ } else {
58
+ self::$is_['top'] = false;
59
+ }
60
+ }
61
+ }
class/activate.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class SSP_Activate {
4
+
5
+ /**
6
+ * 外部からのインスタンス化を防ぐ
7
+ */
8
+ private function __construct() {}
9
+
10
+
11
+ /**
12
+ * プラグイン有効化時の処理
13
+ * Function for the plugin activated.
14
+ */
15
+ // public static function plugin_activate() {}
16
+
17
+
18
+ /**
19
+ * プラグイン停止時の処理
20
+ * Function for the plugin deactivated.
21
+ */
22
+ // public static function plugin_deactivate() {}
23
+
24
+
25
+ /**
26
+ * プラグインアンインストール時の処理
27
+ * Function for the plugin uninstalled.
28
+ */
29
+ public static function plugin_uninstall() {
30
+ foreach ( SSP_Data::DB_NAME as $db_name ) {
31
+ delete_option( $db_name );
32
+ }
33
+ }
34
+
35
+ }
class/data.php ADDED
@@ -0,0 +1,230 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class SSP_Data {
4
+
5
+ /**
6
+ * 外部からのインスタンス化を防ぐ
7
+ */
8
+ private function __construct() {}
9
+
10
+ /**
11
+ * 使用するDBの名前
12
+ */
13
+ const DB_NAME = [
14
+ 'installed' => 'ssp_installed',
15
+ 'notification' => 'ssp_notification',
16
+ 'settings' => 'ssp_settings',
17
+ 'ogp' => 'ssp_ogp',
18
+ ];
19
+
20
+ /**
21
+ * DB[ssp_settings]用変数
22
+ */
23
+ public static $settings = '';
24
+
25
+ /**
26
+ * DB[spp_ogp]用変数
27
+ */
28
+ public static $ogp = '';
29
+
30
+ /**
31
+ * サイト基本情報
32
+ */
33
+ public static $site_title = '';
34
+ public static $site_catch_phrase = '';
35
+
36
+ /**
37
+ * 共通テキスト
38
+ */
39
+ public static $texts = '';
40
+
41
+ /**
42
+ * 設定のデフォルト値
43
+ */
44
+ public static $default_settings = []; // 基本設定のデフォルト値
45
+ public static $default_ogp_settings = []; // OGP設定のデフォルト値
46
+ public static $default_pt_settings = []; // カスタム投稿のフォーマット形式
47
+ public static $default_tax_settings = []; // カスタムタクソノミーのフォーマット形式
48
+
49
+ /**
50
+ * カスタム投稿タイプ・カスタムタクソノミーを保持しておくための変数。
51
+ * 形式: [ 'name' => 'label' ]
52
+ */
53
+ public static $custom_post_types = [];
54
+ public static $custom_taxonomies = [];
55
+
56
+ /**
57
+ * nonce
58
+ */
59
+ const NONCE_ACTION = 'ssp_nonce_action';
60
+ const NONCE_NAME = 'ssp_nonce_name';
61
+
62
+ /**
63
+ * 区切り文字リスト
64
+ */
65
+ const SEPARATORS = [
66
+ 'dash' => '-',
67
+ 'line' => '|',
68
+ 'tilde' => '~',
69
+ ];
70
+
71
+
72
+ /**
73
+ * Set Data
74
+ */
75
+ public static function init() {
76
+
77
+ // 共通の翻訳用テキスト
78
+ self::$texts = [
79
+ 'quoted_title' => __( '"%s"', 'loos-ssp' ),
80
+ 'quoted_archive_title' => __( '"%s" archive page', 'loos-ssp' ),
81
+ 'is_snippet' => __( 'This content is treated as %s.', 'loos-ssp' ), // この内容は %s として扱われます。
82
+ 'title_of' => __( 'Title tag of %s', 'loos-ssp' ), // %sのタイトルタグ
83
+ 'description_of' => __( 'Description of %s', 'loos-ssp' ), // %sのディスクリプション
84
+ 'keyword_of' => __( 'Keywords of %s', 'loos-ssp' ),
85
+ 'title_tag' => __( 'Title tag format', 'loos-ssp' ), // タイトルタグの形式
86
+ 'description_tag' => __( 'Description format', 'loos-ssp' ), // ディスクリプションの形式
87
+ 'use' => __( 'Use %s', 'loos-ssp' ), // %sを使用する
88
+ 'nouse' => __( 'Do not use %s', 'loos-ssp' ), // を使用しない
89
+ 'noindex' => __( 'Do not index %s', 'loos-ssp' ), // sをインデックスさせない
90
+ 'noindex_help' => __( 'If you select "Yes", the default output will be <code>noindex</code>.', 'loos-ssp' ),
91
+ 'default_output' => __( 'The default setting of %2$s to be output to %1$s.', 'loos-ssp' ),
92
+ 'input' => __( 'Please enter %s.', 'loos-ssp' ),
93
+ 'reflect' => __( 'It will be reflected in %s.', 'loos-ssp' ),
94
+ 'archive_desc' => __( 'This is the archive page for %s.', 'loos-ssp' ),
95
+ ];
96
+
97
+ // 設定のデフォルト値をセット
98
+ self::set_default();
99
+
100
+ // インストール済みバージョン情報を取得
101
+ $installed_version = get_option( self::DB_NAME['installed'] );
102
+
103
+ if ( false === $installed_version ) {
104
+
105
+ // インストール時に実行する処理
106
+ self::setup_at_installed();
107
+
108
+ } elseif ( (int) SSP_VERSION > (int) $installed_version ) {
109
+
110
+ // 更新時に実行する処理
111
+ self::setup_at_updated();
112
+ }
113
+ // SSP_VERSION
114
+
115
+ // サイト基本情報取得
116
+ self::$site_title = esc_html( get_option( 'blogname' ) );
117
+ self::$site_catch_phrase = esc_html( get_option( 'blogdescription' ) );
118
+
119
+ // 一般設定データ
120
+ $saved_settings = get_option( self::DB_NAME['settings'] ) ?: [];
121
+ self::$settings = array_merge( self::$default_settings, $saved_settings );
122
+
123
+ // OGP設定
124
+ $saved_ogp_settings = get_option( self::DB_NAME['ogp'] ) ?: [];
125
+ self::$ogp = array_merge( self::$default_ogp_settings, $saved_ogp_settings );
126
+
127
+ }
128
+
129
+ /**
130
+ * デフォルト値をセット
131
+ */
132
+ public static function set_default() {
133
+ self::$default_settings = [
134
+ 'home_title' => '%_site_title_% %_sep_% %_tagline_%',
135
+ 'home_desc' => '',
136
+ 'home_keyword' => '',
137
+ 'separator' => 'line',
138
+ 'webmaster_bing' => '',
139
+ 'webmaster_google' => '',
140
+ 'webmaster_baidu' => '',
141
+ 'webmaster_yandex' => '',
142
+ 'google_analytics_type' => 'gtag',
143
+ 'google_analytics_id' => '',
144
+ 'post_noindex' => false,
145
+ 'post_title' => '%_page_title_% %_sep_% %_site_title_%',
146
+ 'post_desc' => '%_page_contents_%',
147
+ 'page_noindex' => false,
148
+ 'page_title' => '%_page_title_% %_sep_% %_site_title_%',
149
+ 'page_desc' => '%_page_contents_%',
150
+ 'attachment_disable' => true,
151
+ 'attachment_noindex' => true,
152
+ 'attachment_title' => '%_page_title_% %_sep_% %_site_title_%',
153
+ 'attachment_desc' => '%_page_contents_%',
154
+ 'cat_noindex' => true,
155
+ 'cat_title' => '%_cat_name_% %_sep_% %_site_title_%',
156
+ 'cat_desc' => '%_term_description_%',
157
+ 'tag_noindex' => true,
158
+ 'tag_title' => '%_tag_name_% %_sep_% %_site_title_%',
159
+ 'tag_desc' => '%_term_description_%',
160
+ 'post_format_disable' => false,
161
+ 'post_format_noindex' => true,
162
+ 'post_format_title' => '%_format_name_% %_sep_% %_site_title_%',
163
+ 'post_format_desc' => '',
164
+ 'author_disable' => false,
165
+ 'author_noindex' => true,
166
+ 'author_title' => '%_author_name_% %_sep_% %_site_title_%',
167
+ 'author_desc' => sprintf( self::$texts['archive_desc'], '%_author_name_%' ),
168
+ 'date_noindex' => true,
169
+ 'date_title' => '%_date_% %_sep_% %_site_title_%',
170
+ 'date_desc' => sprintf( self::$texts['archive_desc'], '%_date_%' ),
171
+ 'pt_archive_noindex' => true,
172
+ 'pt_archive_title' => '%_post_type_% %_sep_% %_site_title_%',
173
+ 'pt_archive_desc' => sprintf( self::$texts['archive_desc'], '%_post_type_%' ),
174
+ '404_title' => '404: ' . __( 'Page not found', 'loos-ssp' ) . ' %_sep_% %_site_title_%',
175
+ 'search_title' => __( 'Searched:', 'loos-ssp' ) . ' %_search_phrase_% %_sep_% %_site_title_%',
176
+ ];
177
+ // ページが見つかりませんでした。
178
+
179
+ self::$default_ogp_settings = [
180
+ 'og_image' => '',
181
+ 'fb_active' => true,
182
+ 'fb_url' => '',
183
+ 'fb_app_id' => '',
184
+ 'fb_admins' => '',
185
+ 'tw_active' => true,
186
+ 'tw_account' => '',
187
+ 'tw_card' => 'summary',
188
+ ];
189
+
190
+ /**
191
+ * カスタム投稿のフォーマット形式
192
+ */
193
+ self::$default_pt_settings = [
194
+ 'noindex' => false,
195
+ 'title' => '%_page_title_% %_sep_% %_site_title_%',
196
+ 'desc' => '%_page_contents_%',
197
+ ];
198
+
199
+ /**
200
+ * カスタムタクソノミーのフォーマット形式
201
+ */
202
+ self::$default_tax_settings = [
203
+ 'noindex' => true,
204
+ 'title' => '%_term_name_% %_sep_% %_site_title_%',
205
+ 'desc' => '%_term_description_%',
206
+ ];
207
+ }
208
+
209
+
210
+ /**
211
+ * インストール時に実行する処理
212
+ */
213
+ public static function setup_at_installed() {
214
+
215
+ update_option( self::DB_NAME['installed'], SSP_VERSION );
216
+ // update_option( SSP_Data::DB_NAME[ 'notification' ], 'hide' );
217
+
218
+ // デフォルト設定を保存
219
+ update_option( self::DB_NAME['settings'], self::$default_settings );
220
+ update_option( self::DB_NAME['ogp'], self::$default_ogp_settings );
221
+
222
+ }
223
+
224
+ /**
225
+ * 更新時に実行する処理
226
+ */
227
+ public static function setup_at_updated() {
228
+ update_option( self::DB_NAME['installed'], SSP_VERSION );
229
+ }
230
+ }
class/hooks.php ADDED
@@ -0,0 +1,198 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class SSP_Hooks {
3
+
4
+ /**
5
+ * 外部からのインスタンス化を防ぐ
6
+ */
7
+ private function __construct() {}
8
+
9
+ /**
10
+ * init
11
+ */
12
+ public static function init() {
13
+
14
+ add_action( 'init', [ 'SSP_Hooks', 'add_custom_settings' ], 99 ); // 確実に全部取得できるように後ろで発火
15
+ add_action( 'admin_enqueue_scripts', [ 'SSP_Hooks', 'include_files' ] );
16
+ add_action( 'admin_head', [ 'SSP_Hooks', 'hook_admin_head' ] );
17
+ add_action( 'template_redirect', [ 'SSP_Hooks', 'redirect' ], 1 );
18
+
19
+ // titleタグの除去
20
+ remove_action( 'wp_head', '_wp_render_title_tag', 1 );
21
+
22
+ // canonicalの削除
23
+ remove_action( 'wp_head', 'rel_canonical' );
24
+
25
+ // self::set_notification(); //OFF中
26
+ }
27
+
28
+
29
+ /**
30
+ * .dashicons-list-view が微妙にでかいので微調整
31
+ */
32
+ public static function hook_admin_head() {
33
+ echo '<style>.toplevel_page_ssp_main_setting .dashicons-list-view{transform: scale(.9) translateX(1px)}</style>';
34
+ }
35
+
36
+
37
+ /**
38
+ * CSS Scriptの読み込み
39
+ */
40
+ public static function include_files( $hook_suffix ) {
41
+
42
+ $is_index = 'index.php' === $hook_suffix;
43
+ $is_term = 'term.php' === $hook_suffix;
44
+ $is_editor_page = 'post.php' === $hook_suffix || 'post-new.php' === $hook_suffix;
45
+ $is_ssp_page = false !== strpos( $hook_suffix, 'ssp_' );
46
+
47
+ // SSP設定ページで読み込むファイル
48
+ if ( $is_ssp_page ) {
49
+
50
+ wp_enqueue_style( 'ssp-css', SSP_URL . 'dist/css/ssp.css', [], SSP_VERSION );
51
+ wp_enqueue_script( 'ssp-script', SSP_URL . 'dist/js/ssp.js', ['jquery' ], SSP_VERSION, true );
52
+
53
+ } elseif ( $is_editor_page ) {
54
+
55
+ wp_enqueue_style( 'ssp-post', SSP_URL . 'dist/css/post.css', [], SSP_VERSION );
56
+
57
+ } elseif ( $is_term ) {
58
+
59
+ wp_enqueue_style( 'ssp-term', SSP_URL . 'dist/css/term.css', [], SSP_VERSION );
60
+ }
61
+
62
+ // 設定ページでの共通ファイル
63
+ if ( $is_editor_page || $is_ssp_page || $is_term ) {
64
+ wp_enqueue_style( 'ssp-common', SSP_URL . 'dist/css/common.css', [], SSP_VERSION );
65
+
66
+ wp_enqueue_media();
67
+ wp_enqueue_script( 'ssp-media', SSP_URL . 'dist/js/mediauploader.js', ['jquery' ], SSP_VERSION, true );
68
+ wp_enqueue_script( 'ssp-common-script', SSP_URL . 'dist/js/common.js', ['jquery' ], SSP_VERSION, true );
69
+ }
70
+
71
+ // ダッシュボードでも読み込むファイル
72
+ if ( $is_index ) {
73
+ wp_enqueue_style( 'ssp-common', SSP_URL . 'dist/css/common.css', [], SSP_VERSION );
74
+ }
75
+
76
+ }
77
+
78
+
79
+
80
+ /**
81
+ * カスタム投稿タイプ・カスタムタクソノミー用を取得し、設定を追加
82
+ */
83
+ public static function add_custom_settings() {
84
+
85
+ if ( ! is_admin() ) return;
86
+
87
+ $added_new_data = false;
88
+ $args = [
89
+ 'public' => true,
90
+ '_builtin' => false,
91
+ ];
92
+
93
+ $custom_post_types = get_post_types( $args, 'objects', 'and' ) ?: [];
94
+ foreach ( $custom_post_types as $key => $obj ) {
95
+ SSP_Data::$custom_post_types[ $key ] = $obj->label;
96
+ }
97
+
98
+ $custom_taxonomies = get_taxonomies( $args, 'objects', 'and' ) ?: [];
99
+ foreach ( $custom_taxonomies as $key => $obj ) {
100
+ SSP_Data::$custom_taxonomies[ $key ] = $obj->label;
101
+ }
102
+
103
+ // カスタム投稿 の設定追加
104
+ foreach ( SSP_Data::$custom_post_types as $pt_name => $label ) {
105
+ if ( ! isset( SSP_Data::$settings[ $pt_name . '_noindex' ] ) ) {
106
+ SSP_Data::$settings[ $pt_name . '_noindex' ] = SSP_Data::$default_pt_settings['noindex'];
107
+ SSP_Data::$settings[ $pt_name . '_title' ] = SSP_Data::$default_pt_settings['title'];
108
+ SSP_Data::$settings[ $pt_name . '_desc' ] = SSP_Data::$default_pt_settings['desc'];
109
+
110
+ $added_new_data = true;
111
+ }
112
+ }
113
+
114
+ // カスタムタクソノミー の設定追加
115
+ foreach ( SSP_Data::$custom_taxonomies as $tax_name => $label ) {
116
+ if ( ! isset( SSP_Data::$settings[ $tax_name . '_noindex' ] ) ) {
117
+ SSP_Data::$settings[ $tax_name . '_noindex' ] = SSP_Data::$default_tax_settings['noindex'];
118
+ SSP_Data::$settings[ $tax_name . '_title' ] = SSP_Data::$default_tax_settings['title'];
119
+ SSP_Data::$settings[ $tax_name . '_desc' ] = SSP_Data::$default_tax_settings['desc'];
120
+
121
+ $added_new_data = true;
122
+ }
123
+ }
124
+
125
+ // 新規追加項目があった場合
126
+ if ( $added_new_data ) {
127
+ update_option( SSP_Data::DB_NAME['settings'], SSP_Data::$settings );
128
+ }
129
+
130
+ }
131
+
132
+
133
+ /**
134
+ * 使用しないページのリダイレクト処理
135
+ */
136
+ public static function redirect( $page ) {
137
+
138
+ $home = home_url();
139
+
140
+ if ( is_author() && SSP_Data::$settings['author_disable'] ) {
141
+ wp_safe_redirect( $home );
142
+ exit;
143
+ }
144
+
145
+ // check: /type/aside
146
+ if ( is_tax() && SSP_Data::$settings['post_format_disable'] ) {
147
+ if ( 'post_format' === get_queried_object()->taxonomy ) {
148
+ wp_safe_redirect( $home );
149
+ exit;
150
+ };
151
+ }
152
+ if ( is_attachment() && SSP_Data::$settings['attachment_disable'] ) {
153
+ wp_safe_redirect( get_post()->guid );
154
+ exit;
155
+ }
156
+ }
157
+
158
+
159
+ /**
160
+ * 更新に関する通知 :: 〜OFF中〜
161
+ */
162
+ private static function set_notification() {
163
+
164
+ /**
165
+ * プラグイン更新時、notification を show にセット
166
+ */
167
+ if ( get_option( SSP_Data::DB_NAME['notification'] ) !== 'hide' ) {
168
+ update_option( SSP_Data::DB_NAME['notification'], 'show' );
169
+ }
170
+
171
+ // phpcs:ignore WordPress.Security.NonceVerification.Missing
172
+ if ( isset( $_POST['ssp_notice_close'] ) ) {
173
+ // CLOSEボタン押された時
174
+ update_option( SSP_Data::DB_NAME['notification'], 'hide' );
175
+ }
176
+
177
+ // 以前から使用中の方へ向けてのメッセージ
178
+ $notification_db = get_option( SSP_Data::DB_NAME['notification'] );
179
+ if ( 'show' === $notification_db ) {
180
+ add_action( 'admin_notices', function() {
181
+ ?>
182
+ <div class="notice notice-error ssp-notice">
183
+ <p>
184
+ ~ 通知したいメッセージ ~
185
+ </p>
186
+ <form action="" method="post">
187
+ <button type="submit" name="ssp_notice_close" class="ssp-notice__closeBtn notice-dismiss">
188
+ <span>この通知を非表示にする</span>
189
+ </button>
190
+ </form>
191
+ </div>
192
+ <?php
193
+ } );
194
+ }
195
+
196
+ }
197
+
198
+ }
class/menu.php ADDED
@@ -0,0 +1,163 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class SSP_Menu {
3
+
4
+ use SSP\Field;
5
+
6
+ /**
7
+ * トップメニューに表示するタブコンテンツ
8
+ */
9
+ private static $top_menu_tabs;
10
+
11
+
12
+ /**
13
+ * OGPメニューに表示するタブコンテンツ
14
+ */
15
+ private static $ogp_menu_tabs;
16
+
17
+
18
+ /**
19
+ * 外部からのインスタンス化を防ぐ
20
+ */
21
+ private function __construct() {}
22
+
23
+
24
+ /**
25
+ * init
26
+ */
27
+ public static function init() {
28
+
29
+ self::$top_menu_tabs = [
30
+ 'basic' => __( 'Basic setting', 'loos-ssp' ), // 基本設定
31
+ 'post_type' => __( 'Post page', 'loos-ssp' ), // 投稿ページ
32
+ 'taxonomy' => __( 'Taxonomy archive', 'loos-ssp' ), // タクソノミーアーカイブ
33
+ 'archive' => __( 'Other archives', 'loos-ssp' ), // その他アーカイブ
34
+ 'analytics' => __( 'Google Analytics', 'loos-ssp' ), // Googleアナリティクス
35
+ 'webmaster' => __( 'Webmaster tools', 'loos-ssp' ), // ウェブマスターツール
36
+ ];
37
+
38
+ self::$ogp_menu_tabs = [
39
+ 'basic' => __( 'Basic setting', 'loos-ssp' ),
40
+ 'facebook' => 'Facebook',
41
+ 'twitter' => 'Twitter',
42
+ ];
43
+
44
+ add_action( 'admin_menu', ['SSP_Menu', 'add_menus' ] );
45
+ }
46
+
47
+
48
+ /**
49
+ * メニューの追加
50
+ */
51
+ public static function add_menus() {
52
+
53
+ // トップレベルメニュー
54
+ $top_menu_title = 'SEO SIMPLE PACK'; // ページのタイトルタグに表示されるテキスト
55
+ $top_menu_slug = 'ssp_main_setting'; // このメニューを参照するスラッグ名
56
+ $top_menu_cb = ['SSP_Menu', 'ssp_top_menu' ]; // 呼び出す関数名
57
+
58
+ add_menu_page(
59
+ $top_menu_title,
60
+ 'SEO PACK',
61
+ 'manage_options', // 必要な権限
62
+ $top_menu_slug,
63
+ $top_menu_cb,
64
+ 'dashicons-list-view',
65
+ 81 // 位置
66
+ );
67
+ add_submenu_page(
68
+ $top_menu_slug,
69
+ $top_menu_title,
70
+ __( 'General settings', 'loos-ssp' ), // サブ側の名前
71
+ 'administrator', // 権限
72
+ $top_menu_slug,
73
+ $top_menu_cb
74
+ );
75
+
76
+ // サブメニュー:OGP設定
77
+ add_submenu_page(
78
+ 'ssp_main_setting',
79
+ __( 'OGP settings', 'loos-ssp' ), // 'OGP設定',
80
+ __( 'OGP settings', 'loos-ssp' ), // 'OGP設定',
81
+ 'administrator',
82
+ 'ssp_ogp_setting',
83
+ ['SSP_Menu', 'ssp_ogp_menu' ]
84
+ );
85
+
86
+ // サブメニュー:HELP
87
+ add_submenu_page(
88
+ 'ssp_main_setting',
89
+ 'HELP',
90
+ 'HELP',
91
+ 'administrator',
92
+ 'ssp_help',
93
+ ['SSP_Menu', 'ssp_help_menu' ]
94
+ );
95
+ }
96
+
97
+
98
+ /**
99
+ * トップレベルメニュー 内容
100
+ */
101
+ public static function ssp_top_menu() {
102
+ require_once SSP_PATH . 'inc/page_top.php';
103
+ }
104
+
105
+ // サブメニュー [OGP] 内容
106
+ public static function ssp_ogp_menu() {
107
+ require_once SSP_PATH . 'inc/page_ogp.php';
108
+ }
109
+
110
+ // サブメニュー [HELP] 内容
111
+ public static function ssp_help_menu() {
112
+ // require_once SSP_PATH.'inc/page_ogp.php';
113
+ require_once SSP_PATH . 'inc/page_help.php';
114
+ }
115
+
116
+
117
+ /**
118
+ * 設定保存時のメッセージ
119
+ */
120
+ public static function output_saved_message() {
121
+ ?>
122
+ <div class="ssp-page__savedMessage updated notice is-dismissible">
123
+ <p>
124
+ <strong><?php esc_html_e( 'Your settings have been saved.', 'loos-ssp' ); ?></strong>
125
+ </p>
126
+ <button type="button" class="notice-dismiss">
127
+ <span class="screen-reader-text"><?php esc_html_e( 'Hide this notification.', 'loos-ssp' ); ?></span>
128
+ </button>
129
+ </div>
130
+ <?php
131
+ }
132
+
133
+
134
+ /**
135
+ * 設定タブの出力
136
+ */
137
+ public static function output_setting_tab( $tabs ) {
138
+ foreach ( $tabs as $key => $label ) {
139
+ $nav_class = ( reset( $tabs ) === $label ) ? 'nav-tab act_' : 'nav-tab';
140
+ echo '<a href="#' . esc_attr( $key ) . '" class="' . esc_attr( $nav_class ) . '">' . esc_html( $label ) . '</a>';
141
+ }
142
+ }
143
+
144
+
145
+ /**
146
+ * 設定タブコンテンツの出力
147
+ */
148
+ public static function output_setting_tab_content( $tabs, $page_type ) {
149
+ foreach ( $tabs as $key => $label ) {
150
+
151
+ $tab_class = ( reset( $tabs ) === $label ) ? 'tab-contents act_' : 'tab-contents';
152
+ echo '<div id="' . esc_attr( $key ) . '" class="' . esc_attr( $tab_class ) . '">';
153
+
154
+ // タブコンテンツ用ファイルの読み込み
155
+ if ( file_exists( SSP_PATH . 'inc/tab/' . $page_type . '_' . $key . '.php' ) ) {
156
+ require_once SSP_PATH . 'inc/tab/' . $page_type . '_' . $key . '.php';
157
+ }
158
+
159
+ echo '</div>';
160
+ }
161
+ }
162
+
163
+ }
class/metabox.php ADDED
@@ -0,0 +1,306 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class SSP_MetaBox {
3
+
4
+ use SSP\Field;
5
+
6
+ /**
7
+ * 外部からのインスタンス化を防ぐ
8
+ */
9
+ private function __construct() {}
10
+
11
+ /**
12
+ * Post meta
13
+ */
14
+ const POST_META_KEYS = [
15
+ 'robots' => 'ssp_meta_robots',
16
+ 'title' => 'ssp_meta_title',
17
+ 'description' => 'ssp_meta_description',
18
+ 'keyword' => 'ssp_meta_keyword',
19
+ 'image' => 'ssp_meta_image',
20
+ ];
21
+
22
+ /**
23
+ * Term meta
24
+ */
25
+ const TERM_META_KEYS = [
26
+ 'robots' => 'ssp_meta_robots',
27
+ 'title' => 'ssp_meta_title',
28
+ 'description' => 'ssp_meta_description',
29
+ 'image' => 'ssp_meta_image',
30
+ ];
31
+
32
+ /**
33
+ * @var array Setting choices
34
+ */
35
+ private static $robots_options = [];
36
+
37
+
38
+ /**
39
+ * init
40
+ */
41
+ public static function init() {
42
+
43
+ // Set choices
44
+ self::$robots_options = [
45
+ '' => __( 'Keep default settings', 'loos-ssp' ), // デフォルト設定のまま
46
+ 'index,follow' => __( 'Index', 'loos-ssp' ), // インデックスさせる
47
+ 'noindex' => __( 'Don\'t index', 'loos-ssp' ) . '(noindex)', // インデックスさせない
48
+ 'nofollow' => __( 'Don\'t follow links', 'loos-ssp' ) . '(nofollow)', // リンクを辿らせない
49
+ 'noarchive' => __( 'Don\'t cache', 'loos-ssp' ) . '(noarchive)', // キャッシュさせない
50
+ 'noindex,nofollow' => 'noindex,nofollow',
51
+ ];
52
+
53
+ // post meta追加
54
+ add_action( 'add_meta_boxes', [ 'SSP_MetaBox', 'add_ssp_metabox' ], 1 );
55
+ add_action( 'save_post', [ 'SSP_MetaBox', 'save_post_metas' ] );
56
+
57
+ // term meta追加 -> init:99 で $custom_taxonomies セットしているのでそれよりあとで実行
58
+ add_action( 'wp_loaded', function() {
59
+ $tax_names = array_merge( ['category', 'post_tag' ], array_keys( SSP_Data::$custom_taxonomies ) );
60
+ foreach ( $tax_names as $tax_name ) {
61
+ add_action( $tax_name . '_edit_form_fields', [ 'SSP_MetaBox', 'add_term_edit_fields' ], 20 );
62
+ // add_action( $tax_name . '_add_form_fields', [ 'SSP_MetaBox', 'add_term_fields' ] );
63
+ }
64
+
65
+ // 保存処理フック
66
+ add_action( 'edited_terms', [ 'SSP_MetaBox', 'save_term_metas' ] );
67
+ // add_action( 'created_term', [ 'SSP_MetaBox', 'save_term_metas' ] );
68
+ });
69
+
70
+ }
71
+
72
+
73
+ /**
74
+ * Add metabox.
75
+ */
76
+ public static function add_ssp_metabox() {
77
+ $args = [
78
+ 'public' => true,
79
+ '_builtin' => false,
80
+ ];
81
+ $post_types = get_post_types( $args, 'names', 'and' );
82
+ $screens = array_merge( ['post', 'page' ], $post_types );
83
+
84
+ add_meta_box(
85
+ 'ssp_metabox', // メタボックスのID名(html)
86
+ __( 'SEO SIMPLE PACK Settings', 'loos-ssp' ), // メタボックスのタイトル
87
+ ['SSP_MetaBox', 'ssp_metabox_callback' ], // htmlを出力する関数名
88
+ $screens, // 表示する投稿タイプ
89
+ 'normal', // 表示場所 : 'normal', 'advanced', 'side'
90
+ 'default', // 表示優先度 : 'high', 'core', 'default' または 'low'
91
+ null // $callback_args
92
+ );
93
+ }
94
+
95
+
96
+ /**
97
+ * Metabox cintents.
98
+ * memo: privateにするとエラーが起きる
99
+ */
100
+ public static function ssp_metabox_callback( $post ) {
101
+
102
+ $val_robots = get_post_meta( $post->ID, self::POST_META_KEYS['robots'], true );
103
+ $val_title = get_post_meta( $post->ID, self::POST_META_KEYS['title'], true );
104
+ $val_description = get_post_meta( $post->ID, self::POST_META_KEYS['description'], true );
105
+ $val_keyword = get_post_meta( $post->ID, self::POST_META_KEYS['keyword'], true );
106
+ $val_image = get_post_meta( $post->ID, self::POST_META_KEYS['image'], true );
107
+
108
+ // 更新に伴う調節
109
+ if ( 'noindex,follow' === $val_robots ) {
110
+ update_post_meta( $post->ID, self::POST_META_KEYS['robots'], 'noindex' );
111
+ $val_robots = 'noindex';
112
+ } elseif ( 'index,nofollow' === $val_robots ) {
113
+ update_post_meta( $post->ID, self::POST_META_KEYS['robots'], 'nofollow' );
114
+ $val_robots = 'nofollow';
115
+ }
116
+
117
+ $ssp_page_url = admin_url( 'admin.php?page=ssp_main_setting' );
118
+ $ssp_page_url_pt = admin_url( 'admin.php?page=ssp_main_setting#post_type' );
119
+ $help_page_url = admin_url( 'admin.php?page=ssp_help' );
120
+ ?>
121
+ <div class="ssp_metabox -post">
122
+ <?php
123
+ // robots
124
+ self::output_field( self::POST_META_KEYS['robots'], [
125
+ 'title' => __( '"robots" tag of this page', 'loos-ssp' ),
126
+ 'type' => 'select',
127
+ 'choices' => self::$robots_options,
128
+ 'desc' => sprintf(
129
+ __( 'If you want to know the default settings, see %s.', 'loos-ssp' ),
130
+ '<a href="' . esc_url( $ssp_page_url_pt ) . '" target="_blank">' . __( '"Post page" tab in "General Settings"', 'loos-ssp' ) . '</a>'
131
+ ),
132
+ ], $val_robots );
133
+
134
+ // title
135
+ self::output_field( self::POST_META_KEYS['title'], [
136
+ 'title' => __( 'Title tag of this page', 'loos-ssp' ),
137
+ 'desc' => sprintf(
138
+ __( '%s is available.', 'loos-ssp' ),
139
+ '<a href="' . esc_url( $help_page_url ) . '" target="_blank">' . __( 'Snippet tags', 'loos-ssp' ) . '</a>'
140
+ ),
141
+ ], $val_title );
142
+
143
+ // description
144
+ self::output_field( self::POST_META_KEYS['description'], [
145
+ 'title' => __( 'Description of this page', 'loos-ssp' ),
146
+ 'type' => 'textarea',
147
+ 'desc' => __( 'If blank, a description tag will be automatically generated from the content.', 'loos-ssp' ),
148
+ ], $val_description );
149
+
150
+ // og:image
151
+ self::output_field( self::POST_META_KEYS['image'], [
152
+ 'title' => __( '"og:image" of this page', 'loos-ssp' ),
153
+ 'type' => 'media',
154
+ ], $val_image );
155
+
156
+ // keywords
157
+ self::output_field( self::POST_META_KEYS['keyword'], [
158
+ 'title' => __( 'Keywords of this page', 'loos-ssp' ),
159
+ 'desc' => sprintf(
160
+ __( 'If blank, the "Keyword" setting of %s is used.', 'loos-ssp' ),
161
+ '<a href="' . esc_url( $ssp_page_url ) . '" target="_blank">' . __( '"Basic settings"', 'loos-ssp' ) . '</a>'
162
+ ),
163
+ ], $val_keyword );
164
+ ?>
165
+ <div>
166
+ <?php
167
+ // Set nonce field
168
+ wp_nonce_field( SSP_Data::NONCE_ACTION, SSP_Data::NONCE_NAME );
169
+ }
170
+
171
+
172
+ /**
173
+ * Save post meta
174
+ */
175
+ public static function save_post_metas( $post_id ) {
176
+
177
+ // 新規投稿ページでも発動するので、$_POSTが空なら return
178
+ if ( empty( $_POST ) ) return;
179
+
180
+ // 自動保存時
181
+ if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) return;
182
+
183
+ // nonceキー存在チェック
184
+ if ( ! isset( $_POST[ SSP_Data::NONCE_NAME ] ) ) return;
185
+
186
+ // nonceの検証
187
+ $nonce_name = $_POST[ SSP_Data::NONCE_NAME ]; // phpcs:ignore
188
+ if ( ! wp_verify_nonce( $nonce_name, SSP_Data::NONCE_ACTION ) ) return;
189
+
190
+ // Check the user's permissions. 現在のユーザーに編集権限があるかのチェック
191
+ $post_type = isset( $_POST['post_type'] ) ? $_POST['post_type'] : ''; // phpcs:ignorex
192
+ $check_can_key = 'page' === $post_type ? 'edit_page' : 'edit_post';
193
+ if ( ! current_user_can( $check_can_key, $post_id ) ) {
194
+ return;
195
+ }
196
+
197
+ foreach ( self::POST_META_KEYS as $key => $meta_key ) {
198
+
199
+ // 保存したい情報が渡ってきているか確認
200
+ if ( ! isset( $_POST[ $meta_key ] ) ) return;
201
+
202
+ // 入力された値をサニタイズ
203
+ $meta_val = sanitize_text_field( $_POST[ $meta_key ] ); // phpcs:ignorex
204
+
205
+ // 値を保存
206
+ update_post_meta( $post_id, $meta_key, $meta_val );
207
+
208
+ }
209
+
210
+ }
211
+
212
+
213
+ /**
214
+ * ターム「編集」画面にフィールド追加
215
+ */
216
+ public static function add_term_edit_fields( $term ) {
217
+ $val_robots = get_term_meta( $term->term_id, self::TERM_META_KEYS['robots'], true );
218
+ $val_title = get_term_meta( $term->term_id, self::TERM_META_KEYS['title'], true );
219
+ $val_description = get_term_meta( $term->term_id, self::TERM_META_KEYS['description'], true );
220
+ $val_image = get_term_meta( $term->term_id, self::TERM_META_KEYS['image'], true );
221
+
222
+ // @codingStandardsIgnoreStart
223
+ ?>
224
+ <tr class="ssp_term_meta_title">
225
+ <td colspan="2">
226
+ <h2><?=esc_html__( 'SEO SIMPLE PACK Settings', 'loos-ssp' )?></h2>
227
+ </td>
228
+ </tr>
229
+ <tr class="form-field">
230
+ <th>
231
+ <label for="<?=self::TERM_META_KEYS['robots']?>">
232
+ <?=esc_html__( '"robots" tag of this page', 'loos-ssp' )?>
233
+ </label>
234
+ </th>
235
+ <td>
236
+ <?php self::select_box( self::TERM_META_KEYS['robots'], $val_robots, self::$robots_options ) ?>
237
+ </td>
238
+ </tr>
239
+ <tr class="form-field">
240
+ <th>
241
+ <label for="<?=self::TERM_META_KEYS['title']?>">
242
+ <?=esc_html__( 'Title tag of this page', 'loos-ssp' )?>
243
+ </label>
244
+ </th>
245
+ <td>
246
+ <?php self::text_input( self::TERM_META_KEYS['title'], $val_title ) ?>
247
+ </td>
248
+ </tr>
249
+ <tr class="form-field">
250
+ <th>
251
+ <label for="<?=self::TERM_META_KEYS['description']?>">
252
+ <?=esc_html__( 'Description of this page', 'loos-ssp' )?>
253
+ </label>
254
+ </th>
255
+ <td>
256
+ <?php self::textarea( self::TERM_META_KEYS['description'], $val_description ) ?>
257
+ </td>
258
+ </tr>
259
+ <tr class="form-field">
260
+ <th>
261
+ <label for="<?=self::TERM_META_KEYS['image']?>">
262
+ <?=esc_html__( '"og:image" of this page', 'loos-ssp' )?>
263
+ </label>
264
+ </th>
265
+ <td>
266
+ <?php self::media_btns( self::TERM_META_KEYS['image'], $val_image ) ?>
267
+ </td>
268
+ </tr>
269
+
270
+ <?php
271
+ // @codingStandardsIgnoreEnd
272
+
273
+ // Set nonce field
274
+ wp_nonce_field( SSP_Data::NONCE_ACTION, SSP_Data::NONCE_NAME );
275
+ }
276
+
277
+
278
+ /**
279
+ * Save term meta
280
+ */
281
+ public static function save_term_metas( $term_id ) {
282
+
283
+ // $_POSTが空なら return
284
+ if ( empty( $_POST ) ) return;
285
+
286
+ // nonceキー存在チェック
287
+ if ( ! isset( $_POST[ SSP_Data::NONCE_NAME ] ) ) return;
288
+
289
+ // nonceの検証
290
+ $nonce_name = $_POST[ SSP_Data::NONCE_NAME ]; // phpcs:ignore
291
+ if ( ! wp_verify_nonce( $nonce_name, SSP_Data::NONCE_ACTION ) ) return;
292
+
293
+ foreach ( self::TERM_META_KEYS as $key => $meta_key ) {
294
+
295
+ // 保存したい情報が渡ってきているか確認
296
+ if ( ! isset( $_POST[ $meta_key ] ) ) return;
297
+
298
+ // 入力された値をサニタイズ
299
+ $meta_val = sanitize_text_field( $_POST[ $meta_key ] ); // phpcs:ignorex
300
+
301
+ // 値を保存
302
+ update_term_meta( $term_id, $meta_key, $meta_val );
303
+
304
+ }
305
+ }
306
+ }
class/output.php ADDED
@@ -0,0 +1,681 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class SSP_Output {
3
+
4
+ use \SSP\Output_Helper;
5
+
6
+ /**
7
+ * 外部からのインスタンス化を防ぐ
8
+ */
9
+ private function __construct() {}
10
+
11
+ /**
12
+ * @var object The current wp object.
13
+ */
14
+ private static $obj;
15
+
16
+ /**
17
+ * @var string The Title holder.
18
+ */
19
+ private static $title;
20
+
21
+ /**
22
+ * @var string The Description holder.
23
+ */
24
+ private static $description;
25
+
26
+ /**
27
+ * @var string The Description holder.
28
+ */
29
+ private static $robots;
30
+
31
+ /**
32
+ * @var string The Description holder.
33
+ */
34
+ private static $keyword;
35
+
36
+
37
+ /**
38
+ * @var string The canonical holder.
39
+ */
40
+ private static $canonical;
41
+
42
+ /**
43
+ * @var string The canonical holder.
44
+ */
45
+ private static $og_tags;
46
+
47
+ /**
48
+ * @var string The og:locale holder.
49
+ */
50
+ private static $og_locale;
51
+
52
+ /**
53
+ * @var string The og:type holder.
54
+ */
55
+ private static $og_type;
56
+
57
+ /**
58
+ * @var string The og:image holder.
59
+ */
60
+ private static $og_image;
61
+
62
+ /**
63
+ * @var string The og:facebook holder.
64
+ */
65
+ private static $og_facebook;
66
+
67
+ /**
68
+ * @var string The og:twitter holder.
69
+ */
70
+ private static $og_twitter;
71
+
72
+
73
+ /**
74
+ * init
75
+ */
76
+ public static function init() {
77
+ add_action( 'wp_head', [ 'SSP_Output', 'main' ], 5 );
78
+ }
79
+
80
+
81
+ /**
82
+ * Genarate and output meta tags for current page.
83
+ */
84
+ public static function main() {
85
+
86
+ // Genarate
87
+ self::generate_meta_tags();
88
+ self::generate_ogp_tags();
89
+
90
+ // Output
91
+ echo PHP_EOL . '<!-- SEO SIMPLE PACK ' . SSP_VERSION . ' -->' . PHP_EOL; // phpcs:ignore
92
+ self::output_meta_tags();
93
+ self::output_ogp_tags();
94
+ self::output_codes();
95
+ echo '<!-- / SEO SIMPLE PACK -->' . PHP_EOL . PHP_EOL;
96
+
97
+ }
98
+
99
+
100
+ /**
101
+ * Generate meta tags
102
+ */
103
+ private static function generate_meta_tags() {
104
+
105
+ self::$obj = get_queried_object();
106
+ self::$title = self::generate_title();
107
+ self::$robots = self::generate_robots();
108
+ self::$keyword = self::generate_keyword();
109
+ self::$description = self::generate_description();
110
+ self::$canonical = self::generate_canonical();
111
+
112
+ }
113
+
114
+ /**
115
+ * Output meta tags
116
+ */
117
+ private static function output_meta_tags() {
118
+
119
+ if ( ! empty( self::$title ) ) {
120
+ echo '<title>' . esc_html( self::$title ) . '</title>' . PHP_EOL;
121
+ }
122
+
123
+ if ( ! empty( self::$robots ) ) {
124
+ echo '<meta name="robots" content="' . esc_attr( self::$robots ) . '">' . PHP_EOL;
125
+ }
126
+
127
+ if ( ! empty( self::$description ) ) {
128
+ echo '<meta name="description" content="' . esc_attr( self::$description ) . '">' . PHP_EOL;
129
+ }
130
+
131
+ if ( ! empty( self::$keyword ) ) {
132
+ echo '<meta name="keywords" content="' . esc_attr( self::$keyword ) . '">' . PHP_EOL;
133
+ }
134
+
135
+ if ( ! empty( self::$canonical ) ) {
136
+ echo '<link rel="canonical" href="' . esc_attr( self::$canonical ) . '">' . PHP_EOL;
137
+ }
138
+
139
+ }
140
+
141
+
142
+ /**
143
+ * Generate ogp tags
144
+ */
145
+ private static function generate_ogp_tags() {
146
+
147
+ self::$og_locale = self::generate_og_locale();
148
+ self::$og_type = self::generate_og_type();
149
+ self::$og_image = self::generate_og_image();
150
+ self::$og_tags = self::generate_general_ogp();
151
+ self::$og_facebook = self::generate_og_facebook();
152
+ self::$og_twitter = self::generate_og_twitter();
153
+
154
+ }
155
+
156
+
157
+ /**
158
+ * Output ogp tags
159
+ */
160
+ private static function output_ogp_tags() {
161
+
162
+ if ( ! empty( self::$og_locale ) ) {
163
+ echo '<meta property="og:locale" content="' . esc_attr( self::$og_locale ) . '">' . PHP_EOL;
164
+ }
165
+
166
+ if ( ! empty( self::$og_image ) ) {
167
+ echo '<meta property="og:image" content="' . esc_url( self::$og_image ) . '">' . PHP_EOL;
168
+ }
169
+
170
+ if ( ! empty( self::$og_tags ) ) {
171
+ echo self::$og_tags; // phpcs:ignore
172
+ }
173
+
174
+ if ( ! empty( self::$og_type ) ) {
175
+ echo '<meta property="og:type" content="' . esc_attr( self::$og_type ) . '">' . PHP_EOL;
176
+ }
177
+
178
+ if ( ! empty( self::$og_facebook ) ) {
179
+ echo self::$og_facebook; // phpcs:ignore
180
+ }
181
+
182
+ if ( ! empty( self::$og_twitter ) ) {
183
+ echo self::$og_twitter; // phpcs:ignore
184
+ }
185
+
186
+ }
187
+
188
+
189
+ /**
190
+ * Generate the title tag for the current page.
191
+ *
192
+ * @return string : The title.
193
+ */
194
+ private static function generate_title() {
195
+
196
+ $settings = SSP_Data::$settings;
197
+
198
+ switch ( true ) {
199
+ case is_front_page():
200
+ $title = $settings['home_title'];
201
+ break;
202
+ case is_singular():
203
+ case is_home():
204
+ $meta_title = get_post_meta( self::$obj->ID, SSP_MetaBox::POST_META_KEYS['title'], true );
205
+ if ( $meta_title ) {
206
+ $title = $meta_title;
207
+ } else {
208
+ $pt = self::$obj->post_type;
209
+ $title = $settings[ $pt . '_title' ];
210
+ }
211
+ break;
212
+
213
+ case is_category():
214
+ $meta_title = get_term_meta( self::$obj->term_id, SSP_MetaBox::TERM_META_KEYS['title'], true );
215
+ $title = $meta_title ?: $settings['cat_title'];
216
+ break;
217
+
218
+ case is_tag():
219
+ $meta_title = get_term_meta( self::$obj->term_id, SSP_MetaBox::TERM_META_KEYS['title'], true );
220
+ $title = $meta_title ?: $settings['tag_title'];
221
+ break;
222
+
223
+ case is_tax():
224
+ $meta_title = get_term_meta( self::$obj->term_id, SSP_MetaBox::TERM_META_KEYS['title'], true );
225
+ $term = self::$obj->taxonomy;
226
+ $title = $meta_title ?: $settings[ $term . '_title' ];
227
+ break;
228
+
229
+ case is_post_type_archive():
230
+ $title = $settings['pt_archive_title'];
231
+ break;
232
+
233
+ case is_author():
234
+ $title = $settings['author_title'];
235
+ break;
236
+
237
+ case is_date():
238
+ $title = $settings['date_title'];
239
+ break;
240
+
241
+ case is_search():
242
+ $title = $settings['search_title'];
243
+ break;
244
+
245
+ case is_404():
246
+ $title = $settings['404_title'];
247
+ break;
248
+
249
+ default:
250
+ $title = SSP_Data::$site_title;
251
+ break;
252
+ }
253
+
254
+ $title = self::replace_snippets( $title );
255
+ return apply_filters( 'ssp_output_title', $title );
256
+ }
257
+
258
+ /**
259
+ * Generate the meta:robots for the current page.
260
+ *
261
+ * @return string : The meta:robots.
262
+ */
263
+ private static function generate_robots() {
264
+
265
+ $settings = SSP_Data::$settings;
266
+
267
+ switch ( true ) {
268
+
269
+ case is_front_page():
270
+ $robots = '';
271
+ break;
272
+
273
+ case is_singular():
274
+ case is_home():
275
+ $meta_robots = get_post_meta( self::$obj->ID, SSP_MetaBox::POST_META_KEYS['robots'], true );
276
+ if ( $meta_robots ) {
277
+ $robots = $meta_robots;
278
+ } else {
279
+ $pt = self::$obj->post_type;
280
+ $is_noindex = $settings[ $pt . '_noindex' ];
281
+ $robots = $is_noindex ? 'noindex' : '';
282
+ }
283
+ break;
284
+
285
+ case is_category():
286
+ $meta_robots = get_term_meta( self::$obj->term_id, SSP_MetaBox::TERM_META_KEYS['robots'], true );
287
+ if ( $meta_robots ) {
288
+ $robots = $meta_robots;
289
+ } else {
290
+ $is_noindex = $settings['cat_noindex'];
291
+ $robots = $is_noindex ? 'noindex' : '';
292
+ }
293
+
294
+ break;
295
+
296
+ case is_tag():
297
+ $meta_robots = get_term_meta( self::$obj->term_id, SSP_MetaBox::TERM_META_KEYS['robots'], true );
298
+ if ( $meta_robots ) {
299
+ $robots = $meta_robots;
300
+ } else {
301
+ $is_noindex = $settings['tag_noindex'];
302
+ $robots = $is_noindex ? 'noindex' : '';
303
+ }
304
+ break;
305
+
306
+ case is_tax():
307
+ $meta_robots = get_term_meta( self::$obj->term_id, SSP_MetaBox::TERM_META_KEYS['robots'], true );
308
+ if ( $meta_robots ) {
309
+ $robots = $meta_robots;
310
+ } else {
311
+ $term = self::$obj->taxonomy;
312
+ $is_noindex = $settings[ $term . '_noindex' ];
313
+ $robots = $is_noindex ? 'noindex' : '';
314
+ }
315
+ break;
316
+
317
+ case is_post_type_archive():
318
+ $is_noindex = $settings['pt_archive_noindex'];
319
+ $robots = $is_noindex ? 'noindex' : '';
320
+ break;
321
+
322
+ case is_author():
323
+ $is_noindex = $settings['author_noindex'];
324
+ $robots = $is_noindex ? 'noindex' : '';
325
+ break;
326
+
327
+ case is_date():
328
+ $is_noindex = $settings['date_noindex'];
329
+ $robots = $is_noindex ? 'noindex' : '';
330
+ break;
331
+
332
+ case is_search():
333
+ $robots = 'noindex';
334
+ break;
335
+
336
+ case is_404():
337
+ $robots = 'noindex';
338
+ break;
339
+
340
+ default:
341
+ $robots = '';
342
+ break;
343
+ }
344
+
345
+ return apply_filters( 'ssp_output_robots', $robots );
346
+ }
347
+
348
+ /**
349
+ * Generate the meta:keywords for the current page.
350
+ *
351
+ * @return string : The meta:keywords.
352
+ */
353
+ private static function generate_keyword() {
354
+
355
+ $keyword = '';
356
+
357
+ if ( is_front_page() ) {
358
+
359
+ $keyword = SSP_Data::$settings['home_keyword'];
360
+
361
+ } elseif ( is_singular() || ( ! is_front_page() && is_home() ) ) {
362
+
363
+ // メタボックスが入力されていれば上書きする
364
+ $metabox_keyword = get_post_meta( self::$obj->ID, SSP_MetaBox::POST_META_KEYS['keyword'], true );
365
+ if ( $metabox_keyword ) {
366
+ $keyword = $metabox_keyword;
367
+ }
368
+ }
369
+
370
+ return apply_filters( 'ssp_output_keyword', $keyword );
371
+
372
+ }
373
+
374
+
375
+ /**
376
+ * Generate the meta:description for the current page.
377
+ *
378
+ * @return string : The meta:description.
379
+ */
380
+ private static function generate_description() {
381
+
382
+ $settings = SSP_Data::$settings;
383
+
384
+ switch ( true ) {
385
+ case is_front_page():
386
+ $description = $settings['home_desc'] ?: '%_tagline_%';
387
+ break;
388
+
389
+ case is_singular():
390
+ case is_home():
391
+ $metabox_desc = get_post_meta( self::$obj->ID, SSP_MetaBox::POST_META_KEYS['description'], true );
392
+
393
+ if ( '' !== $metabox_desc ) {
394
+ // メタボックスが入力されていれば優先
395
+ $description = $metabox_desc;
396
+ } else {
397
+ $pt = self::$obj->post_type;
398
+ $description = $settings[ $pt . '_desc' ];
399
+ }
400
+ break;
401
+
402
+ case is_category():
403
+ $meta_description = get_term_meta( self::$obj->term_id, SSP_MetaBox::TERM_META_KEYS['description'], true );
404
+ $description = $meta_description ?: $settings['cat_desc'];
405
+ break;
406
+
407
+ case is_tag():
408
+ $meta_description = get_term_meta( self::$obj->term_id, SSP_MetaBox::TERM_META_KEYS['description'], true );
409
+ $description = $meta_description ?: $settings['tag_desc'];
410
+ break;
411
+
412
+ case is_tax():
413
+ $meta_description = get_term_meta( self::$obj->term_id, SSP_MetaBox::TERM_META_KEYS['description'], true );
414
+ $description = $meta_description ?: $settings[ self::$obj->taxonomy . '_desc' ];
415
+ break;
416
+
417
+ case is_post_type_archive():
418
+ $description = $settings['pt_archive_desc'];
419
+ break;
420
+
421
+ case is_author():
422
+ $description = $settings['author_desc'];
423
+ break;
424
+
425
+ case is_date():
426
+ $description = $settings['date_desc'];
427
+ break;
428
+
429
+ default:
430
+ $description = $settings['home_desc'];
431
+ break;
432
+ }
433
+
434
+ $description = self::replace_snippets( $description );
435
+ return apply_filters( 'ssp_output_description', $description );
436
+
437
+ }
438
+
439
+
440
+ /**
441
+ * Generate the general ogp tags for the current page.
442
+ *
443
+ * @return string : OGP tags.
444
+ */
445
+ private static function generate_general_ogp() {
446
+
447
+ $og_title = apply_filters( 'ssp_output_og_title', self::$title );
448
+ $og_desc = apply_filters( 'ssp_output_og_description', self::$description );
449
+ $og_url = apply_filters( 'ssp_output_og_url', self::$canonical );
450
+ $og_site_name = apply_filters( 'ssp_output_og_site_name', SSP_Data::$site_title );
451
+
452
+ $ogp = '';
453
+ $ogp .= '<meta property="og:title" content="' . esc_attr( $og_title ) . '">' . PHP_EOL;
454
+ $ogp .= '<meta property="og:description" content="' . esc_attr( $og_desc ) . '">' . PHP_EOL;
455
+ $ogp .= '<meta property="og:url" content="' . esc_attr( $og_url ) . '">' . PHP_EOL;
456
+ $ogp .= '<meta property="og:site_name" content="' . esc_attr( $og_site_name ) . '">' . PHP_EOL;
457
+
458
+ return $ogp;
459
+
460
+ }
461
+
462
+
463
+ /**
464
+ * Generate the canonical URL for the current page.
465
+ *
466
+ * @return string : The canonical URL.
467
+ */
468
+ private static function generate_canonical() {
469
+
470
+ switch ( true ) {
471
+
472
+ case is_front_page():
473
+ $canonical = home_url();
474
+ break;
475
+
476
+ case is_singular():
477
+ $canonical = get_permalink();
478
+ break;
479
+
480
+ case is_tax() || is_tag() || is_category():
481
+ $term = self::$obj;
482
+ $term_link = get_term_link( $term, $term->taxonomy );
483
+ $canonical = ( is_wp_error( $term_link ) ) ? '' : $term_link;
484
+ break;
485
+
486
+ case is_post_type_archive():
487
+ $post_type = get_query_var( 'post_type' );
488
+ $post_type = ( is_array( $post_type ) ) ? reset( $post_type ) : $post_type;
489
+ $canonical = get_post_type_archive_link( $post_type );
490
+ break;
491
+
492
+ case is_author():
493
+ $canonical = get_author_posts_url( get_query_var( 'author' ), get_query_var( 'author_name' ) );
494
+ break;
495
+
496
+ case is_date():
497
+ if ( is_day() ) {
498
+ $canonical = get_day_link( get_query_var( 'year' ), get_query_var( 'monthnum' ), get_query_var( 'day' ) );
499
+ } elseif ( is_month() ) {
500
+ $canonical = get_month_link( get_query_var( 'year' ), get_query_var( 'monthnum' ) );
501
+ } elseif ( is_year() ) {
502
+ $canonical = get_year_link( get_query_var( 'year' ) );
503
+ }
504
+ break;
505
+
506
+ case is_search():
507
+ $canonical = get_search_link();
508
+ break;
509
+
510
+ case is_404():
511
+ $canonical = home_url() . '/404';
512
+ break;
513
+
514
+ default:
515
+ // is_home() もここに来る。
516
+ $canonical = get_permalink( self::$obj->ID );
517
+
518
+ break;
519
+ }
520
+
521
+ return apply_filters( 'ssp_output_canonical', $canonical );
522
+ }
523
+
524
+
525
+ /**
526
+ * Generate the og:type for the current page.
527
+ *
528
+ * @return string : The og:type.
529
+ */
530
+ private static function generate_og_type() {
531
+ $og_type = is_singular() ? 'article' : 'website';
532
+ return apply_filters( 'ssp_output_og_type', $og_type );
533
+ }
534
+
535
+ /**
536
+ * Generate the og:image for the current page.
537
+ * 投稿ページ:アイキャッチ画像を優先し、なければデフォルトのOG:Image画像
538
+ * メディアページ:自身の画像URL
539
+ *
540
+ * @return string : The og:image url.
541
+ */
542
+ private static function generate_og_image() {
543
+
544
+ $og_image = ''; // 返す値
545
+ $basic_ogimg = SSP_Data::$ogp['og_image'];
546
+
547
+ switch ( true ) {
548
+ case is_attachment():
549
+ $og_image = self::$obj->guid ?: $basic_ogimg;
550
+ break;
551
+ case is_singular() || ( ! is_front_page() && is_home() ):
552
+ $the_id = self::$obj->ID; // 投稿ID
553
+ $meta_image = get_post_meta( $the_id, SSP_MetaBox::POST_META_KEYS['image'], true );
554
+
555
+ if ( $meta_image ) {
556
+ $og_image = $meta_image;
557
+ } elseif ( has_post_thumbnail( $the_id ) ) {
558
+ $thumb_id = get_post_thumbnail_id( $the_id );
559
+ $thumb_url = wp_get_attachment_image_src( $thumb_id, 'full' );
560
+ $og_image = $thumb_url[0] ?: $basic_ogimg;
561
+ } else {
562
+ $og_image = $basic_ogimg;
563
+ }
564
+ break;
565
+ case is_tax() || is_tag() || is_category():
566
+ $meta_image = get_term_meta( self::$obj->term_id, SSP_MetaBox::TERM_META_KEYS['image'], true );
567
+ $og_image = $meta_image ?: $basic_ogimg;
568
+ break;
569
+ default:
570
+ $og_image = $basic_ogimg;
571
+ break;
572
+ }
573
+
574
+ return apply_filters( 'ssp_output_og_image', $og_image );
575
+ }
576
+
577
+
578
+ /**
579
+ * Generate the og:locale for the current page.
580
+ *
581
+ * @return string : The og:locale.
582
+ */
583
+ private static function generate_og_locale() {
584
+
585
+ $locale = self::get_valid_og_locale();
586
+ return apply_filters( 'ssp_output_og_locale', $locale );
587
+
588
+ }
589
+
590
+ /**
591
+ * Generate the og tags for facebook. for the current page.
592
+ *
593
+ * @return string : The og tags for facebook.
594
+ */
595
+ private static function generate_og_facebook() {
596
+
597
+ if ( ! SSP_Data::$ogp['fb_active'] ) return '';
598
+
599
+ $appid = apply_filters( 'ssp_output_fb_appid', SSP_Data::$ogp['fb_app_id'] );
600
+ $admins = apply_filters( 'ssp_output_fb_admins', SSP_Data::$ogp['fb_admins'] );
601
+ $publisher = apply_filters( 'ssp_output_fb_publisher', SSP_Data::$ogp['fb_url'] );
602
+
603
+ $og_fb = '';
604
+ if ( ! empty( $appid ) ) {
605
+ $og_fb .= '<meta property="fb:app_id" content="' . esc_attr( $appid ) . '">' . PHP_EOL;
606
+ }
607
+ if ( ! empty( $admins ) ) {
608
+ $og_fb .= '<meta property="fb:admins" content="' . esc_attr( $admins ) . '">' . PHP_EOL;
609
+ }
610
+ if ( ! empty( $publisher ) && 'article' === self::$og_type ) {
611
+ $og_fb .= '<meta property="article:publisher" content="' . esc_attr( $publisher ) . '">' . PHP_EOL;
612
+ }
613
+
614
+ return $og_fb;
615
+
616
+ }
617
+
618
+
619
+ /**
620
+ * Generate the og tags for twitter. for the current page.
621
+ *
622
+ * @return string : The og tags for twitter.
623
+ */
624
+ private static function generate_og_twitter() {
625
+
626
+ if ( ! SSP_Data::$ogp['tw_active'] ) return '';
627
+
628
+ $tw_site = apply_filters( 'ssp_output_tw_site', SSP_Data::$ogp['tw_account'] );
629
+ $tw_card = apply_filters( 'ssp_output_tw_card', SSP_Data::$ogp['tw_card'] );
630
+
631
+ $og_tw = '';
632
+ if ( ! empty( $tw_card ) ) {
633
+ $og_tw .= '<meta name="twitter:card" content="' . esc_attr( $tw_card ) . '">' . PHP_EOL;
634
+ }
635
+ if ( ! empty( $tw_site ) ) {
636
+ $og_tw .= '<meta name="twitter:site" content="' . esc_attr( $tw_site ) . '">' . PHP_EOL;
637
+ }
638
+
639
+ return $og_tw;
640
+ }
641
+
642
+
643
+ /**
644
+ * Analytics and Webmaster code.
645
+ */
646
+ private static function output_codes() {
647
+
648
+ $settings = SSP_Data::$settings;
649
+
650
+ // meta tags for webmaster tools
651
+ if ( is_front_page() ) {
652
+ $webmaster_codes = [
653
+ 'webmaster_google' => 'google-site-verification',
654
+ 'webmaster_bing' => 'msvalidate.01',
655
+ 'webmaster_baidu' => 'baidu-site-verification',
656
+ 'webmaster_yandex' => 'yandex-verification',
657
+ ];
658
+ foreach ( $webmaster_codes as $key => $name ) {
659
+ if ( $settings[ $key ] ) {
660
+ echo '<meta name="' . esc_attr( $name ) . '" content="' . esc_attr( $settings[ $key ] ) . '">' . PHP_EOL;
661
+ }
662
+ }
663
+ }
664
+
665
+ // google analytics code
666
+ if ( $settings['google_analytics_id'] ) {
667
+
668
+ $gaid = $settings['google_analytics_id'];
669
+
670
+ if ( 'gtag' === $settings['google_analytics_type'] ) {
671
+
672
+ self::echo_gtag( $gaid );
673
+
674
+ } elseif ( 'analytics' === $settings['google_analytics_type'] ) {
675
+
676
+ self::echo_analytics( $gaid );
677
+
678
+ }
679
+ }
680
+ }
681
+ }
class/ssp_activate.php DELETED
@@ -1,57 +0,0 @@
1
- <?php
2
-
3
- class SSP_Activate {
4
-
5
- /**
6
- * 外部からのインスタンス化を防ぐ
7
- */
8
- private function __construct() {}
9
-
10
-
11
- /**
12
- * プラグイン有効化時の処理
13
- * Function for the plugin activated.
14
- */
15
- public static function plugin_activate() {
16
-
17
- if ( get_option( SSP_Data::DB_NAME[ 'installed' ] ) === false ) {
18
-
19
- //初回 or 再インストール時 : デフォルト設定取得
20
- $SSP_settings = SSP_Data::DEFAULT_SETTINGS;
21
- $SSP_ogp = SSP_Data::DEFAULT_OGP;
22
-
23
- update_option( SSP_Data::DB_NAME[ 'installed' ], 1 );
24
- // update_option( SSP_Data::DB_NAME[ 'notification' ], 'hide' );
25
-
26
- //DB更新
27
- update_option( SSP_Data::DB_NAME[ 'settings' ], $SSP_settings );
28
- update_option( SSP_Data::DB_NAME[ 'ogp' ], $SSP_ogp );
29
-
30
- } else {
31
-
32
- //データが残っている場合 : 既存設定取得
33
- // $SSP_settings = get_option( SSP_Data::DB_NAME[ 'settings' ] );
34
- // $SSP_ogp = get_option( SSP_Data::DB_NAME[ 'ogp' ] );
35
-
36
- }
37
- }
38
-
39
-
40
- /**
41
- * プラグイン停止時の処理
42
- * Function for the plugin deactivated.
43
- */
44
- public static function plugin_deactivate() {}
45
-
46
-
47
- /**
48
- * プラグインアンインストール時の処理
49
- * Function for the plugin uninstalled.
50
- */
51
- public static function plugin_uninstall() {
52
- foreach ( SSP_Data::DB_NAME as $db_name ) {
53
- delete_option( $db_name );
54
- }
55
- }
56
-
57
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
class/ssp_branch.php DELETED
@@ -1,14 +0,0 @@
1
- <?php
2
- class SSP_Branch {
3
-
4
- /**
5
- * 外部からのインスタンス化を防ぐ
6
- */
7
- private function __construct() {}
8
-
9
- /**
10
- * 条件分岐タグの結果を取得
11
- * Conditional_Tags
12
- */
13
- public static $is_ = null;
14
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
class/ssp_data.php DELETED
@@ -1,147 +0,0 @@
1
- <?php
2
-
3
- class SSP_Data {
4
-
5
- /**
6
- * 外部からのインスタンス化を防ぐ
7
- */
8
- private function __construct() {}
9
-
10
-
11
- /**
12
- * 使用するDBの名前
13
- */
14
- const DB_NAME = [
15
- 'installed' => 'ssp_installed',
16
- 'notification' => 'ssp_notification',
17
- 'settings' => 'ssp_settings',
18
- 'ogp' => 'ssp_ogp',
19
- ];
20
-
21
-
22
- /**
23
- * DB[ssp_settings]用変数
24
- */
25
- public static $settings = "";
26
-
27
-
28
- /**
29
- * DB[spp_ogp]用変数
30
- */
31
- public static $ogp = "";
32
-
33
-
34
- /**
35
- * サイト基本情報
36
- */
37
- public static $site_title = "";
38
- public static $site_catch_phrase = "";
39
-
40
-
41
- /**
42
- * NOUNCEキー アクション名
43
- */
44
- const NOUNCE_ACTION = '_ssp_post';
45
-
46
-
47
- /**
48
- * NOUNCEキー name
49
- */
50
- const NOUNCE_NAME = '_ssp_nounce';
51
-
52
-
53
- /**
54
- * 区切り文字リスト
55
- */
56
- const SEPARATOR_LIST = [
57
- 'dash' => '-',
58
- 'line' => '|',
59
- 'tilde' => '~'
60
- ];
61
-
62
-
63
- /**
64
- * 基本設定のデフォルト値
65
- */
66
- const DEFAULT_SETTINGS = [
67
- 'home_title' => '%_site_title_% %_sep_% %_phrase_%',
68
- 'home_desc' => '',
69
- 'home_keyword' => '',
70
- 'separator' => 'line',
71
- 'webmaster_bing' => '',
72
- 'webmaster_google' => '',
73
- 'webmaster_baidu' => '',
74
- 'webmaster_yandex' => '',
75
- 'google_analytics_type' => 'gtag',
76
- 'google_analytics_id' => '',
77
- 'post_noindex' => false,
78
- 'post_title' => '%_page_title_% %_sep_% %_site_title_%',
79
- 'post_desc' => '%_page_contents_%',
80
- 'page_noindex' => false,
81
- 'page_title' => '%_page_title_% %_sep_% %_site_title_%',
82
- 'page_desc' => '%_page_contents_%',
83
- 'attachment_disable' => true,
84
- 'attachment_noindex' => true,
85
- 'attachment_title' => '%_page_title_% %_sep_% %_site_title_%',
86
- 'attachment_desc' => '%_page_contents_%',
87
- 'cat_noindex' => true,
88
- 'cat_title' => '%_cat_name_% %_sep_% %_site_title_%',
89
- // 'cat_desc' => 'カテゴリー「%_cat_name_%」の一覧ページです。',
90
- 'cat_desc' => '%_term_description_%',
91
- 'tag_noindex' => true,
92
- 'tag_title' => '%_tag_name_% %_sep_% %_site_title_%',
93
- 'tag_desc' => 'タグ「%_tag_name_%」の一覧ページです。',
94
- 'post_format_disable' => true,
95
- 'post_format_noindex' => true,
96
- 'post_format_title' => '%_format_name_% %_sep_% %_site_title_%',
97
- 'post_format_desc' => '投稿フォーマット「%_format_name_%」の一覧ページです。',
98
- 'author_disable' => false,
99
- 'author_noindex' => true,
100
- 'author_title' => '%_author_name_% %_sep_% %_site_title_%',
101
- 'author_desc' => '%_author_name_% の執筆記事一覧ページです。',
102
- 'date_noindex' => true,
103
- 'date_title' => '%_date_% %_sep_% %_site_title_%', //get_localで日本語かそうでないか,
104
- 'date_desc' => '%_date_% の記事一覧ページです。', //get_localで日本語かそうでないか,
105
- 'pt_archive_noindex' => true,
106
- 'pt_archive_title' => '%_post_type_% %_sep_% %_site_title_%',
107
- 'pt_archive_desc' => '「%_post_type_%」の記事一覧ページです',
108
- '404_title' => 'ページが見つかりません。 %_sep_% %_site_title_%',
109
- 'search_title' => '検索: %_search_phrase_% %_sep_% %_site_title_%',
110
- ];
111
-
112
-
113
- /**
114
- * 初回インストール時に登録するOGP設定のデフォルト値
115
- */
116
- const DEFAULT_OGP = [
117
- 'og_image' => '',
118
- 'fb_active' => true,
119
- 'fb_url' => '',
120
- 'fb_app_id' => '',
121
- 'fb_admins' => '',
122
- 'tw_active' => true,
123
- 'tw_account' => '',
124
- 'tw_card' => 'summary',
125
- ];
126
-
127
-
128
- /**
129
- * カスタム投稿のフォーマット形式
130
- */
131
- const DEFAULT_PT_SETTING = [
132
- 'noindex' => false,
133
- 'title' => '%_page_title_% %_sep_% %_site_title_%',
134
- 'desc' => '%_page_contents_%',
135
- ];
136
-
137
-
138
- /**
139
- * カスタムタクソノミーのフォーマット形式
140
- */
141
- const DEFAULT_TAX_SETTING = [
142
- 'noindex' => true,
143
- 'title' => '%_term_name_% %_sep_% %_site_title_%',
144
- 'desc' => '%_tax_name_%「%_term_name_%」の一覧ページです。',
145
- ];
146
-
147
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
class/ssp_init.php DELETED
@@ -1,96 +0,0 @@
1
- <?php
2
-
3
- class SSP_Init {
4
-
5
- /**
6
- * The constructor
7
- */
8
- public function __construct() {
9
-
10
- SSP_Menu::init();
11
- $this->set_ssp_data();
12
- $this->set_hooks();
13
- SSP_MetaBox::init();
14
-
15
- //$this->set_notification(); //OFF中
16
-
17
- }
18
-
19
- /**
20
- * 基本データの初期化処理
21
- */
22
- private function set_ssp_data() {
23
-
24
- //サイト基本情報取得
25
- SSP_Data::$site_title = esc_html( get_option( 'blogname' ) );
26
- SSP_Data::$site_catch_phrase = esc_html( get_option( 'blogdescription' ) );
27
-
28
- // 一般設定データ
29
- $db_ssp_settings = get_option( SSP_Data::DB_NAME[ 'settings' ] ) ?: [];
30
- SSP_Data::$settings = array_merge( SSP_Data::DEFAULT_SETTINGS, $db_ssp_settings );
31
-
32
- // OGPせ設定
33
- $db_ssp_ogp = get_option( SSP_Data::DB_NAME[ 'ogp' ] ) ?: [];
34
- SSP_Data::$ogp = array_merge( SSP_Data::DEFAULT_OGP, $db_ssp_ogp );
35
-
36
- }
37
-
38
- /**
39
- * アクションフックの登録
40
- */
41
- private function set_hooks() {
42
-
43
- add_action( 'init', [ 'SSP_Methods', 'add_custom_settings' ] , 999);
44
- add_action( 'wp', [ 'SSP_Methods', 'set_branch' ], 1 );
45
- add_action( 'admin_enqueue_scripts', [ 'SSP_Methods', 'include_files' ] );
46
- add_action( 'admin_menu', ['SSP_Menu', 'add_menus'] );
47
- add_action( 'wp_head', [ 'SSP_Output', 'main' ], 5 );
48
- add_action( 'template_redirect', [ 'SSP_Methods', 'redirect' ], 1 );
49
-
50
- //titleタグの除去
51
- remove_action('wp_head', '_wp_render_title_tag', 1);
52
-
53
- // canonicalの削除
54
- remove_action('wp_head', 'rel_canonical');
55
-
56
- }
57
-
58
- /**
59
- * 更新に関する通知 :: 〜OFF中〜
60
- */
61
- private function set_notification() {
62
-
63
- /**
64
- * プラグイン更新時
65
- */
66
- if ( get_option( SSP_Data::DB_NAME[ 'notification' ] ) !== 'hide' ) {
67
- update_option( SSP_Data::DB_NAME[ 'notification' ], 'show' );
68
- }
69
-
70
- if ( isset($_POST['ssp_notice_close'] ) ) {
71
- //CLOSEボタン押されたら
72
- update_option( SSP_Data::DB_NAME[ 'notification' ], 'hide' );
73
- }
74
-
75
- // 以前から使用中の方へ向けてのメッセージ
76
- $notification_db = get_option( SSP_Data::DB_NAME[ 'notification' ] );
77
- if( $notification_db === 'show' ) {
78
- add_action( 'admin_notices', function() {
79
- ?>
80
- <div class="notice notice-error ssp_notice">
81
- <p>
82
- <b>[ SEO SIMPLE PACK 更新に伴うお知らせ ]</b><br>
83
- 個別ページごとの <code>meta robots</code> の設定方法が新しくなりました!<br>
84
- 以前のバージョンで個別設定をしていた場合は、お手数ですが再度設定をお願いいたします。
85
- </p>
86
- <form action="" method="post">
87
- <button type="submit" name="ssp_notice_close" class="notice-dismiss"><span>この通知を非表示にする</span></button>
88
- </form>
89
- </div>
90
- <?php
91
- } );
92
- }
93
-
94
- }
95
-
96
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
class/ssp_menu.php DELETED
@@ -1,158 +0,0 @@
1
- <?php
2
-
3
-
4
-
5
- class SSP_Menu {
6
-
7
-
8
- /**
9
- * サブメニュー「OGP設定」
10
- */
11
- private static $OGP_MENU;
12
-
13
- /**
14
- * トップメニューに表示するタブコンテンツ
15
- */
16
- private static $TOP_MENU_TABS;
17
-
18
-
19
- /**
20
- * OGPメニューに表示するタブコンテンツ
21
- */
22
- private static $OGP_MENU_TABS;
23
-
24
-
25
- /**
26
- * 外部からのインスタンス化を防ぐ
27
- */
28
- private function __construct() {}
29
-
30
-
31
- /**
32
- * init
33
- */
34
- public static function init() {
35
-
36
- self::$OGP_MENU = [
37
- 'parent_slug' => 'ssp_main_setting',
38
- 'page_title' => __('OGP settings', LOOS_SSP_DOMAIN ), //'OGP設定',
39
- 'menu_title' => __('OGP settings', LOOS_SSP_DOMAIN ), //'OGP設定',
40
- 'capability' => 'administrator',
41
- 'menu_slug' => 'ssp_ogp_setting',
42
- 'function' => ['SSP_Menu','ssp_ogp_menu']
43
- ];
44
-
45
- self::$TOP_MENU_TABS = [
46
- 'basic' => __('Basic setting', LOOS_SSP_DOMAIN ), // 基本設定
47
- 'post_type' => __('Post page', LOOS_SSP_DOMAIN ), // 投稿ページ
48
- 'taxonomy' => __('Taxonomy archive', LOOS_SSP_DOMAIN ), // タクソノミーアーカイブ
49
- 'archive' => __('Other archives', LOOS_SSP_DOMAIN ), // その他アーカイブ
50
- 'analytics' => __('Google Analytics', LOOS_SSP_DOMAIN ), // Googleアナリティクス
51
- 'webmaster' => __('Webmaster tools', LOOS_SSP_DOMAIN ), // ウェブマスターツール
52
- ];
53
-
54
- self::$OGP_MENU_TABS = [
55
- 'ogp' => __('Basic setting', LOOS_SSP_DOMAIN ), //基本設定
56
- 'facebook' => 'Facebook',
57
- 'twitter' => 'Twitter',
58
- ];
59
- }
60
-
61
-
62
- /**
63
- * トップレベルメニューの設定
64
- */
65
- const TOP_MENU = [
66
- 'page_title' => 'SEO PACK', //ページのタイトルタグに表示されるテキスト
67
- 'menu_title' => 'SEO PACK', //メニュータイトル
68
- 'capability' => 'manage_options', //必要な権限
69
- 'menu_slug' => 'ssp_main_setting', //このメニューを参照するスラッグ名
70
- 'function' => ['SSP_Menu','ssp_top_menu'], //呼び出す関数名
71
- //'icon_url' => SSP_URL.'assets/img/noimg.gif', //アイコンURL
72
- 'icon_url' => 'dashicons-list-view', //アイコンURL
73
- 'position' => 81 //管理画面での表示位置
74
- ];
75
-
76
-
77
-
78
-
79
- /**
80
- * サブメニュー「HELP」の設定
81
- */
82
- const HELP_MENU = [
83
- 'parent_slug' => 'ssp_main_setting',
84
- 'page_title' => 'HELP',
85
- 'menu_title' => 'HELP',
86
- 'capability' => 'administrator',
87
- 'menu_slug' => 'ssp_help',
88
- 'function' => ['SSP_Menu','ssp_help_menu']
89
- ];
90
-
91
-
92
- /**
93
- * メニューの追加
94
- */
95
- public static function add_menus() {
96
- //トップレベルメニュー
97
- add_menu_page(
98
- self::TOP_MENU['page_title'],
99
- self::TOP_MENU['menu_title'],
100
- self::TOP_MENU['capability'],
101
- self::TOP_MENU['menu_slug'],
102
- self::TOP_MENU['function'],
103
- self::TOP_MENU['icon_url'],
104
- self::TOP_MENU['position']
105
- );
106
-
107
- //トップレベルメニュークリック時の表示
108
- add_submenu_page(
109
- self::TOP_MENU['menu_slug'],
110
- self::TOP_MENU['menu_title'],
111
- __('General settings', LOOS_SSP_DOMAIN ), //サブ側の名前
112
- 'administrator', //権限
113
- self::TOP_MENU['menu_slug'],
114
- self::TOP_MENU['function'] //親と同じ関数を呼び出す
115
- );
116
-
117
- //サブメニュー SNS
118
- add_submenu_page(
119
- self::$OGP_MENU['parent_slug'],
120
- self::$OGP_MENU['page_title'],
121
- self::$OGP_MENU['menu_title'],
122
- self::$OGP_MENU['capability'],
123
- self::$OGP_MENU['menu_slug'],
124
- self::$OGP_MENU['function']
125
- );
126
-
127
- //サブメニュー HELP
128
- add_submenu_page(
129
- self::HELP_MENU['parent_slug'],
130
- self::HELP_MENU['page_title'],
131
- self::HELP_MENU['menu_title'],
132
- self::HELP_MENU['capability'],
133
- self::HELP_MENU['menu_slug'],
134
- self::HELP_MENU['function']
135
- );
136
- }
137
-
138
-
139
- /**
140
- * トップレベルメニュー 内容
141
- */
142
- public static function ssp_top_menu() {
143
- require_once SSP_PATH.'inc/page_top.php';
144
- }
145
-
146
- //サブメニュー [OGP] 内容
147
- public static function ssp_ogp_menu() {
148
- require_once SSP_PATH.'inc/page_ogp.php';
149
- }
150
-
151
- //サブメニュー [HELP] 内容
152
- public static function ssp_help_menu() {
153
- //require_once SSP_PATH.'inc/page_ogp.php';
154
- require_once SSP_PATH.'inc/page_help.php';
155
- }
156
-
157
- }
158
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
class/ssp_metabox.php DELETED
@@ -1,333 +0,0 @@
1
- <?php
2
- class SSP_MetaBox {
3
-
4
- /**
5
- * 外部からのインスタンス化を防ぐ
6
- */
7
- private function __construct() {}
8
-
9
-
10
- /**
11
- * metabox names
12
- */
13
- const P_METANAME = [
14
- 'robots' => 'ssp_meta_robots',
15
- 'title' => 'ssp_meta_title',
16
- 'description' => 'ssp_meta_description',
17
- 'keyword' => 'ssp_meta_keyword',
18
- ];
19
-
20
- /**
21
- * metabox names
22
- */
23
- const T_METANAME = [
24
- 'robots' => 'ssp_meta_robots',
25
- 'title' => 'ssp_meta_title',
26
- 'description' => 'ssp_meta_description',
27
- ];
28
-
29
- /**
30
- * init
31
- */
32
- public static function init() {
33
- //post meta
34
- add_action( 'add_meta_boxes', [ 'SSP_MetaBox', 'ssp_add_metabox' ], 1);
35
- add_action( 'save_post', [ 'SSP_MetaBox', 'save_ssp_metabox'] );
36
-
37
- //term meta
38
- // add_action('category_add_form_fields', [ 'SSP_MetaBox', 'ssp_add_term_fields' ]);
39
- // add_action('post_tag_add_form_fields', [ 'SSP_MetaBox', 'ssp_add_term_fields' ]);
40
- add_action('category_edit_form_fields', [ 'SSP_MetaBox', 'ssp_add_term_edit_fields' ], 20);
41
- add_action('post_tag_edit_form_fields', [ 'SSP_MetaBox', 'ssp_add_term_edit_fields' ], 20);
42
- add_action( 'created_term', [ 'SSP_MetaBox', 'ssp_save_term_filds' ] ); //新規追加用 保存処理フック
43
- add_action( 'edited_terms', [ 'SSP_MetaBox', 'ssp_save_term_filds' ] ); //編集ページ用 保存処理フック
44
- }
45
-
46
-
47
- /**
48
- * Add metabox.
49
- */
50
- public static function ssp_add_metabox() {
51
- $args = ['public' => true, '_builtin' => false];
52
- $post_types = get_post_types( $args, 'names', 'and' );
53
- $screens = array_merge( ['post','page'], $post_types );
54
-
55
- add_meta_box(
56
- 'ssp_metabox', //メタボックスのID名(html)
57
- 'SEO SIMPLE PACK 設定', //メタボックスのタイトル
58
- ['SSP_MetaBox', 'ssp_metabox_callback'], //htmlを出力する関数名
59
- $screens, //表示する投稿タイプ
60
- 'advanced', //表示場所 : 'normal', 'advanced', 'side'
61
- 'high', //表示優先度 : 'high', 'core', 'default' または 'low'
62
- null //$callback_args
63
- );
64
- }
65
-
66
- /**
67
- * Metabox cintents.
68
- *
69
- * privateにするとエラーが起きる
70
- */
71
- public static function ssp_metabox_callback( $post ) {
72
-
73
- $val_robots = get_post_meta( $post->ID, self::P_METANAME['robots'], true );
74
- $val_title = get_post_meta( $post->ID, self::P_METANAME['title'], true );
75
- $val_description = get_post_meta( $post->ID, self::P_METANAME['description'], true );
76
- $val_keyword = get_post_meta( $post->ID, self::P_METANAME['keyword'], true );
77
-
78
- //更新に伴う調節
79
- if ( $val_robots === "noindex,follow" ) {
80
- update_post_meta( $post->ID, self::P_METANAME['robots'], "noindex");
81
- $val_robots = "noindex";
82
- } elseif ( $val_robots === "index,nofollow" ) {
83
- update_post_meta( $post->ID, self::P_METANAME['robots'], "nofollow");
84
- $val_robots = "nofollow";
85
- }
86
-
87
- $robots_arr = [
88
- "インデックスさせる" => "index,follow",
89
- "インデックスさせない (noindex)" => "noindex",
90
- "リンクを辿らせない (nofollow)" => "nofollow",
91
- "キャッシュさせない (noarchive)" => "noarchive",
92
- "noindex,nofollow" => "noindex,nofollow",
93
- ];
94
- ?>
95
- <div id="ssp_wrap" class="ssp_metabox">
96
-
97
- <label for="<?=self::P_METANAME['robots']?>">このページの robotsタグ (インデックスさせるかどうか)</label>
98
- <div class="ssp_meta_inner">
99
- <select name="<?=self::P_METANAME['robots']?>" id="<?=self::P_METANAME['robots']?>">
100
- <option value="">-- デフォルト設定のまま --</option>
101
- <?php foreach ($robots_arr as $key => $value) {
102
- if ( $value === $val_robots ) {
103
- echo '<option value="', $value ,'" selected>', $key ,'</option>';
104
- } else {
105
- echo '<option value="', $value ,'">', $key ,'</option>';
106
- }
107
- } ?>
108
- </select>
109
- <p class="ssp_note">
110
- <i>
111
- 例:「サイトマップ」など、インデックスさせたくない特別なページには「インデックスさせない(noindex)」を設定してください。
112
- <br>
113
- 投稿ページの デフォルト設定 は <a href="<?=admin_url('admin.php?page=ssp_main_setting')?>" target="_blank">「SEO PACK」の「一般設定」</a>から<a href="<?=admin_url('admin.php?page=ssp_main_setting#post_type')?>" target="_blank">「投稿ページ」タブ</a> をご確認ください。
114
- </i>
115
- </p>
116
- </div>
117
-
118
-
119
- <label for="<?=self::P_METANAME['title']?>">このページのタイトルタグを上書きする</label>
120
- <div class="ssp_meta_inner">
121
- <input type="text" id="<?=self::P_METANAME['title']?>" name="<?=self::P_METANAME['title']?>" value="<?=esc_html( $val_title)?>">
122
- <p class="ssp_note">
123
- <i><a href="<?=admin_url('admin.php?page=ssp_help')?>" target="_blank">スニペットタグ</a> ( <code>%_site_title_%</code>など )が使用可能です。空白の場合、デフォルトの形式で出力されます。</i>
124
- </p>
125
- </div>
126
-
127
- <label for="<?=self::P_METANAME['description']?>">このページのディスクリプション</label>
128
- <div class="ssp_meta_inner">
129
- <textarea id="<?=self::P_METANAME['description']?>" name="<?=self::P_METANAME['description']?>"><?=esc_html( $val_description )?></textarea>
130
- <p class="ssp_note">
131
- <i>空白の場合、コンテンツから自動でディスクリプションタグが生成されます。</i>
132
- </p>
133
- </div>
134
-
135
- <label for="<?=self::P_METANAME['keyword']?>">このページのキーワード</label>
136
- <div class="ssp_meta_inner">
137
- <input type="text" id="<?=self::P_METANAME['keyword']?>" name="<?=self::P_METANAME['keyword']?>" value="<?=esc_html( $val_keyword )?>">
138
- <p class="ssp_note">
139
- <i>空白の場合、<a href="<?=admin_url('admin.php?page=ssp_main_setting')?>" target="_blank">「SEO PACK」の「基本設定」</a>の「キーワード」設定が使用されます。</i>
140
- </p>
141
- </div>
142
- </div>
143
- <?php
144
- // nonceフィールド追加
145
- wp_nonce_field( SSP_Data::NOUNCE_ACTION, SSP_Data::NOUNCE_NAME );
146
- }
147
-
148
-
149
- /**
150
- * Save post meta
151
- */
152
- public static function save_ssp_metabox( $post_id ) {
153
-
154
- /* Debug デバッグ には exit() 使う*/
155
- // var_dump( $_POST );
156
- // exit();
157
-
158
-
159
- //新規投稿ページでも発動するので、$_POSTが空なら return させる
160
- if ( empty($_POST) ) {
161
- return;
162
- }
163
-
164
- // SSPのnonceキーチェック
165
- if ( ! isset( $_POST[SSP_Data::NOUNCE_NAME] ) ) {
166
- return;
167
- }
168
-
169
- // Verify that the nonce is valid. nonceが正しいものか検証
170
- if ( ! wp_verify_nonce( $_POST[SSP_Data::NOUNCE_NAME], SSP_Data::NOUNCE_ACTION ) ) {
171
- return;
172
- }
173
-
174
-
175
- // If this is an autosave, our form has not been submitted, so we don't want to do anything.
176
- // :: 自動保存時にはメタボックスの内容を保存しないように、ここで処理を終える
177
- if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
178
- return;
179
- }
180
-
181
- // Check the user's permissions.
182
- // :: 現在のユーザーに投稿の編集権限があるかのチェック
183
- if ( isset( $_POST['post_type'] ) && 'page' == $_POST['post_type'] ) {
184
-
185
- if ( ! current_user_can( 'edit_page', $post_id ) ) {
186
- return;
187
- }
188
-
189
- } else {
190
-
191
- if ( ! current_user_can( 'edit_post', $post_id ) ) {
192
- return;
193
- }
194
- }
195
-
196
- /*
197
- OK, it's safe for us to save the data now.
198
- ここまでくれば大丈夫です。保存処理を開始します。
199
- */
200
-
201
- // Make sure that it is set.
202
- // 保存したい情報が渡ってきているか確認
203
- if ( !isset( $_POST[self::P_METANAME['robots']] ) ||
204
- !isset( $_POST[self::P_METANAME['title']] ) ||
205
- !isset( $_POST[self::P_METANAME['description']] ) ||
206
- !isset( $_POST[self::P_METANAME['keyword']] ) ) {
207
- return;
208
- }
209
-
210
- // Sanitize user input.
211
- // 入力された値をサニタイズ
212
- $meta_robots = sanitize_text_field( $_POST[self::P_METANAME['robots']] );
213
- $meta_title = sanitize_text_field( $_POST[self::P_METANAME['title']] );
214
- $meta_description = sanitize_text_field( $_POST[self::P_METANAME['description']] );
215
- $meta_keyword = sanitize_text_field( $_POST[self::P_METANAME['keyword']] );
216
-
217
- // Update the meta field in the database.
218
- // データベースのポストメタに値を保存
219
- update_post_meta( $post_id, self::P_METANAME['robots'], $meta_robots );
220
- update_post_meta( $post_id, self::P_METANAME['title'], $meta_title );
221
- update_post_meta( $post_id, self::P_METANAME['description'], $meta_description );
222
- update_post_meta( $post_id, self::P_METANAME['keyword'], $meta_keyword );
223
- }
224
-
225
-
226
- /**
227
- * ターム「新規追加」画面にフィールド追加
228
- */
229
- public static function ssp_add_term_fields() {
230
- $robots_arr = [
231
- "インデックスさせる" => "index,follow",
232
- "インデックスさせない (noindex)" => "noindex",
233
- "リンクを辿らせない (nofollow)" => "nofollow",
234
- "キャッシュさせない (noarchive)" => "noarchive",
235
- "noindex,nofollow" => "noindex,nofollow",
236
- ];
237
- ?>
238
- <div class="form-field">
239
- <label for="<?=self::T_METANAME['robots']?>">【SSP】このタームアーカイブページの robotsタグ設定</label>
240
- <select name="<?=self::T_METANAME['robots']?>" id="<?=self::T_METANAME['robots']?>">
241
- <option value="">-- デフォルト設定のまま --</option>
242
- <?php foreach ($robots_arr as $key => $value) {
243
- if ( $value === $val_robots ) {
244
- echo '<option value="', $value ,'" selected>', $key ,'</option>';
245
- } else {
246
- echo '<option value="', $value ,'">', $key ,'</option>';
247
- }
248
- } ?>
249
- </select>
250
- </div>
251
- <div class="form-field">
252
- <label for="<?=self::T_METANAME['title']?>">【SSP】このタームアーカイブページの titleタグ</label>
253
- <input type="text" name="<?=self::T_METANAME['title']?>" id="<?=self::T_METANAME['title']?>">
254
- </div>
255
- <div class="form-field">
256
- <label for="<?=self::T_METANAME['description']?>">【SSP】このタームアーカイブページの descriptionタグ</label>
257
- <textarea name="<?=self::T_METANAME['description']?>" id="<?=self::T_METANAME['description']?>" cols="40" rows="5"></textarea>
258
- </div>
259
- <?php
260
- }
261
-
262
- /**
263
- * ターム「編集」画面にフィールド追加
264
- */
265
- public static function ssp_add_term_edit_fields( $term ) {
266
- $robots_arr = [
267
- "インデックスさせる" => "index,follow",
268
- "インデックスさせない (noindex)" => "noindex",
269
- "リンクを辿らせない (nofollow)" => "nofollow",
270
- "キャッシュさせない (noarchive)" => "noarchive",
271
- "noindex,nofollow" => "noindex,nofollow",
272
- ];
273
- $val_robots = get_term_meta( $term->term_id, self::T_METANAME['robots'], true );
274
- $val_title = get_term_meta( $term->term_id, self::T_METANAME['title'], true );
275
- $val_description = get_term_meta( $term->term_id, self::T_METANAME['description'], true );
276
- ?>
277
- <tr class="ssp_term_meta_title">
278
- <td colspan="2">
279
- <h2>SEO SIMPLE PACKの設定</h2>
280
- </td>
281
- </tr>
282
- <tr class="form-field">
283
- <th>
284
- <label for="<?=self::T_METANAME['robots']?>">このタームアーカイブページの robotsタグ</label>
285
- </th>
286
- <td>
287
- <select name="<?=self::T_METANAME['robots']?>" id="<?=self::T_METANAME['robots']?>">
288
- <option value="">-- デフォルト設定のまま --</option>
289
- <?php foreach ($robots_arr as $key => $value) {
290
- if ( $value === $val_robots ) {
291
- echo '<option value="', $value ,'" selected>', $key ,'</option>';
292
- } else {
293
- echo '<option value="', $value ,'">', $key ,'</option>';
294
- }
295
- } ?>
296
- </select>
297
- </td>
298
- </tr>
299
- <tr class="form-field">
300
- <th>
301
- <label for="<?=self::T_METANAME['title']?>">このタームアーカイブページの titleタグ</label>
302
- </th>
303
- <td>
304
- <input type="text" name="<?=self::T_METANAME['title']?>" id="<?=self::T_METANAME['title']?>" value="<?=$val_title?>">
305
- </td>
306
- </tr>
307
- <tr class="form-field">
308
- <th>
309
- <label for="<?=self::T_METANAME['description']?>">このタームアーカイブページの descriptionタグ</label>
310
- </th>
311
- <td>
312
- <textarea name="<?=self::T_METANAME['description']?>" id="<?=self::T_METANAME['description']?>" cols="40" rows="5"><?=$val_description?></textarea>
313
- </td>
314
- </tr>
315
- <?php
316
- }
317
-
318
-
319
- /**
320
- * Save term meta
321
- */
322
- public static function ssp_save_term_filds( $term_id ) {
323
- foreach ( self::T_METANAME as $label => $keyname) {
324
- if ( isset( $_POST[$keyname] ) ) {
325
- update_term_meta( $term_id, $keyname, $_POST[$keyname]);
326
- }
327
- }
328
- }
329
- }
330
-
331
-
332
-
333
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
class/ssp_methods.php DELETED
@@ -1,355 +0,0 @@
1
- <?php
2
-
3
- class SSP_Methods {
4
-
5
- /**
6
- * 外部からのインスタンス化を防ぐ
7
- */
8
- private function __construct() {}
9
-
10
-
11
- /**
12
- * デバッグ用
13
- */
14
- public static function dump( $data, $str = "" ) {
15
-
16
- echo '<div class="dev_area">';
17
- echo '<p>'.$str.'</p>';
18
- var_dump($data);
19
- echo '</div>';
20
- }
21
-
22
-
23
- /**
24
- * カスタム投稿タイプ・タクソノミー用の設定を追加
25
- */
26
- public static function add_custom_settings () {
27
-
28
- if( !is_admin() ) {
29
- return;
30
- }
31
-
32
- $added_new_data = false;
33
- $args = [ 'public' => true, '_builtin' => false ];
34
- $post_types = get_post_types( $args, 'names', 'and' );
35
- $taxonomies = get_taxonomies( $args, 'names', 'and' );
36
-
37
- //カスタム投稿 settings 追加
38
- foreach ( $post_types as $pt ) {
39
- if ( !isset( SSP_Data::$settings[ $pt.'_noindex' ] ) ) {
40
- SSP_Data::$settings[ $pt.'_noindex' ] = SSP_Data::DEFAULT_PT_SETTING[ 'noindex' ];
41
- SSP_Data::$settings[ $pt.'_title' ] = SSP_Data::DEFAULT_PT_SETTING[ 'title' ];
42
- SSP_Data::$settings[ $pt.'_desc' ] = SSP_Data::DEFAULT_PT_SETTING[ 'desc' ];
43
- $added_new_data = true;
44
- }
45
- }
46
-
47
- //カスタムタクソノミー settings 追加
48
- foreach ( $taxonomies as $tax ) {
49
- if ( !isset( SSP_Data::$settings[ $tax.'_noindex' ] ) ) {
50
- SSP_Data::$settings[ $tax.'_noindex' ] = SSP_Data::DEFAULT_TAX_SETTING[ 'noindex' ];
51
- SSP_Data::$settings[ $tax.'_title' ] = SSP_Data::DEFAULT_TAX_SETTING[ 'title' ];
52
- SSP_Data::$settings[ $tax.'_desc' ] = SSP_Data::DEFAULT_TAX_SETTING[ 'desc' ];
53
- $added_new_data = true;
54
- }
55
- }
56
-
57
- //新規追加項目があった場合
58
- if ( $added_new_data ) {
59
- update_option( SSP_Data::DB_NAME['settings'], SSP_Data::$settings );
60
- }
61
-
62
- return;
63
- }
64
-
65
-
66
- /**
67
- * 条件分岐タグの結果を変数に代入
68
- */
69
- public static function set_branch() {
70
-
71
- SSP_Branch::$is_ = [
72
- 'home' => is_home(),
73
- 'front' => is_front_page(),
74
- 'single' => is_single(),
75
- 'page' => is_page(),
76
- 'singular' => is_singular(),
77
- 'category' => is_category(),
78
- 'tag' => is_tag(),
79
- 'tax' => is_tax(),
80
- 'attachment' => is_attachment(),
81
- 'archive' => is_archive(),
82
- 'pt_archive' => is_post_type_archive(),
83
- 'author' => is_author(),
84
- 'date' => is_date(),
85
- 'year' => is_year(),
86
- 'month' => is_month(),
87
- 'day' => is_day(),
88
- 'search' => is_search(),
89
- '404' => is_404(),
90
- ];
91
- if ( is_front_page() ) {
92
- SSP_Branch::$is_['top'] = true;
93
- } elseif ( is_home() ) {
94
- if ( get_queried_object_id() === 0) {
95
- SSP_Branch::$is_['top'] = true;
96
- } else {
97
- SSP_Branch::$is_['top'] = false;
98
- }
99
- } else {
100
- SSP_Branch::$is_['top'] = false;
101
- }
102
- }
103
-
104
-
105
- /**
106
- * CSS Scriptの読み込み
107
- */
108
- public static function include_files( $hook_suffix ) {
109
-
110
- $is_editor_page = 'post.php' === $hook_suffix || 'post-new.php' === $hook_suffix;
111
- $is_ssp_page = false !== strpos( $hook_suffix, 'ssp_' );
112
-
113
- if ( $is_ssp_page ) {
114
-
115
- wp_enqueue_media();
116
- wp_enqueue_script(
117
- 'ssp-script',
118
- plugins_url( 'assets/js/ssp.js', SSP_FILE ),
119
- array('jquery'),
120
- SSP_VERSION,
121
- true
122
- );
123
-
124
- }
125
-
126
- // 設定ページだけでなく編集画面でも読み込みたい
127
- if ( $is_editor_page || $is_ssp_page ) {
128
- wp_enqueue_script(
129
- 'ssp-common-script',
130
- plugins_url( 'assets/js/ssp_common.js', SSP_FILE ),
131
- array('jquery'),
132
- SSP_VERSION,
133
- true
134
- );
135
- wp_enqueue_style(
136
- 'ssp-css',
137
- plugins_url( "assets/css/ssp.css", SSP_FILE ),
138
- array(),
139
- SSP_VERSION
140
- );
141
- }
142
- }
143
-
144
-
145
- /**
146
- * 使用しないページのリダイレクト処理
147
- */
148
- public static function redirect( $page ) {
149
-
150
- $home = home_url();
151
-
152
- if ( SSP_Branch::$is_['author'] && SSP_Data::$settings['author_disable'] ) {
153
- wp_safe_redirect($home);
154
- exit;
155
- }
156
- if ( SSP_Branch::$is_['tax'] && SSP_Data::$settings['post_format_disable'] ) {
157
- if (get_queried_object()->taxonomy === 'post_format') {
158
- wp_safe_redirect($home);
159
- exit;
160
- };
161
- }
162
- if ( SSP_Branch::$is_['attachment'] && SSP_Data::$settings['attachment_disable'] ) {
163
- wp_safe_redirect(get_post()->guid);
164
- exit;
165
- }
166
- }
167
-
168
-
169
- /**
170
- * プレビュー機能用のスニペット変換
171
- */
172
- public static function replace_snippets_forpv ( $str ) {
173
-
174
- $str = str_replace ('%_site_title_%', '<span>'.esc_html( SSP_Data::$site_title ).'</span>', $str);
175
- $str = str_replace ('%_phrase_%', '<span>'.esc_html( SSP_Data::$site_catch_phrase ).'</span>', $str);
176
- $str = str_replace ('%_description_%', esc_html( SSP_Data::$settings[ 'home_desc' ] ), $str);
177
- $str = str_replace ('%_page_title_%', '<span>投稿タイトル</span>', $str);
178
- $str = str_replace ('%_cat_name_%', '<span>カテゴリー名</span>', $str);
179
- $str = str_replace ('%_tag_name_%', '<span>タグ名</span>', $str);
180
- $str = str_replace ('%_term_name_%', '<span>ターム名</span>', $str);
181
- $str = str_replace ('%_tax_name_%', '<span>タクソノミー名</span>', $str);
182
- $str = str_replace ('%_author_name_%', '<span>著者名(ニックネーム)</span>', $str);
183
- $str = str_replace ('%_search_phrase_%', '<span>検索ワード</span>', $str);
184
- $str = str_replace ('%_post_type_%', '<span>投稿タイプ名</span>', $str);
185
- $str = str_replace ('%_page_contents_%', '<span>投稿コンテンツ</span>', $str);
186
- $str = str_replace ('%_date_%', '<span>日付</span>', $str);
187
- $str = str_replace ('%_format_name_%', '<span>フォーマット名</span>', $str);
188
- $str = str_replace ('%_term_description_%', '<span>タームの説明</span>', $str);
189
-
190
-
191
- if (strpos($str, '%_sep_%') !== false) {
192
-
193
- $sep_key = SSP_Data::$settings[ 'separator' ];
194
- $sep_val = SSP_Data::SEPARATOR_LIST[$sep_key];
195
- $str = str_replace ('%_sep_%', '<span>'.$sep_val.'</span>', $str);
196
-
197
- }
198
-
199
- return $str;
200
- }
201
-
202
- /**
203
- * データを無害化して返す
204
- */
205
- public static function sanitize_post_data( $data ) {
206
-
207
- foreach ($data as $key => $val) {
208
-
209
- if ( $val === "" ) {
210
- continue;
211
- }
212
-
213
- // "1" , "0" => bool
214
- $bool_val = filter_var( $val, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE );
215
-
216
- if ( $bool_val === null ) {
217
-
218
- $val = sanitize_text_field( $val );
219
- $val = stripslashes( $val );
220
- $data[ $key ] = $val;
221
-
222
- } else {
223
-
224
- $data[ $key ] = $bool_val;
225
-
226
- }
227
- }
228
-
229
- return $data;
230
- }
231
-
232
- /**
233
- * 設定更新時のDB更新処理
234
- */
235
- public static function update_db( $P ) {
236
-
237
- if ( empty( $P ) ) {
238
- exit( 'POST data was not found' );
239
- }
240
-
241
- //Check my nounce key.
242
- check_admin_referer( SSP_Data::NOUNCE_ACTION, SSP_Data::NOUNCE_NAME );
243
-
244
- //Get DB name.
245
- $db_name = $P[ 'db_name' ];
246
-
247
- //SSP用のデータベースが登録されていなければ exit
248
- if ( !in_array( $db_name, SSP_Data::DB_NAME ) ) {
249
- exit( 'DataBase was not found' );
250
- }
251
-
252
- //Get DB 設定可能なデータのリストを取得
253
- //$db_data = get_option( $db_name );
254
- if ( $db_name === SSP_Data::DB_NAME['settings'] ) {
255
-
256
- // $db_data_key = array_keys( SSP_Data::DEFAULT_SETTINGS );
257
- $db_data_key = array_keys( SSP_Data::$settings );
258
-
259
- } elseif ( $db_name === SSP_Data::DB_NAME['ogp'] ) {
260
-
261
- // $db_data_key = array_keys( SSP_Data::DEFAULT_OGP );
262
- $db_data_key = array_keys( SSP_Data::$ogp );
263
-
264
- } else {
265
-
266
- exit( 'DataBase was not found' );
267
-
268
- }
269
-
270
- //Delete unexpected data form the POST data.
271
- //設定可能なデータだけを抽出 (送信ボタンのデータなどは削除)
272
- foreach ( $P as $key => $v ) {
273
-
274
- if ( !in_array( $key, $db_data_key) ) {
275
-
276
- unset( $P[ $key ] );
277
-
278
- }
279
- }
280
-
281
- //Update DB.
282
- update_option( $db_name, $P );
283
- }
284
-
285
-
286
- /**
287
- * 管理画面メニューのテーブル内容を出力する
288
- */
289
- public static function output_table_rows( $table_rows, $db_name = null) {
290
-
291
- if ( $db_name === "ogp") {
292
-
293
- $db = SSP_Data::$ogp;
294
-
295
- } else {
296
-
297
- $db = SSP_Data::$settings;
298
-
299
- }
300
-
301
- foreach ( $table_rows as $key => $row ) {
302
-
303
- $data_disable = "";
304
-
305
- if( $row['is_checkbox'] ) {
306
-
307
- if ( strpos( $key, '_disable' ) !== false ) {
308
- $data_disable = 'data-disable="'.(int) $db[$key].'"';
309
- }
310
-
311
- $form_item = '<span>はい</span><label class="ssp_switch_box" for="'.$key.'">';
312
-
313
- $form_item .= $db[ $key ]
314
- ? '<input type="checkbox" name="" id="'.$key.'" checked>'
315
- : '<input type="checkbox" name="" id="'.$key.'">';
316
- $form_item .= '<span class="ssp_switch_box__slider -round"></span></label><span>いいえ</span>';
317
- $form_item .= '<input type="hidden" name="'.$key.'" value="'.esc_attr( $db[$key] ).'">';
318
-
319
- } else {
320
-
321
- $form_item = $row['item'] ?:
322
- '<input type="text" name="'.$key.'" id="'.'.$key.'.'"value="'.esc_attr( $db[$key] ).'">';
323
-
324
- }
325
-
326
- if ( strpos( $key, "_desc" ) ) {
327
- $trclass = "tr_desc";
328
- } else {
329
- $trclass = "tr";
330
- }
331
-
332
- echo '<tr class="', $trclass ,'" valign="top" ', $data_disable, '><th scope="row">',
333
- '<label for="'.$key.'">', $row['title'], '</label>',
334
- $row['reqired'] ? '<span class="required">*</span>' : "" ,
335
- '</th>',
336
-
337
- '<td>',
338
- '<div class="inner ', $row['class'], '">',
339
-
340
- '<div class="ssp_item">', $form_item, '</div>',
341
- '<div class="ssp_desc">
342
- <p>', $row['desc'], '</p>',
343
- '</div>',
344
- $row['prev'] ?
345
- '<div class="ssp_prev">┗ '. __( 'Preview', LOOS_SSP_DOMAIN ) .' : <p>'.
346
- SSP_Methods::replace_snippets_forpv( esc_html( $db[ $key ] ) ).
347
- '</p><a href="' . admin_url() . 'admin.php?page=ssp_help" target="_blank" title="使用可能なスニペットタグについて" class="ssp_help">?</a></div>'
348
- : "",
349
- '</div>',
350
- '</td>',
351
- '</tr>';
352
- }
353
- }
354
- }
355
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
class/ssp_output.php DELETED
@@ -1,1009 +0,0 @@
1
- <?php
2
-
3
- class SSP_Output {
4
-
5
- /**
6
- * 外部からのインスタンス化を防ぐ
7
- */
8
- private function __construct() {}
9
-
10
- /**
11
- * @var object The current wp object.
12
- */
13
- private static $obj;
14
-
15
- /**
16
- * @var string The Title holder.
17
- */
18
- private static $title;
19
-
20
- /**
21
- * @var string The Description holder.
22
- */
23
- private static $description;
24
-
25
- /**
26
- * @var string The Description holder.
27
- */
28
- private static $robots;
29
-
30
- /**
31
- * @var string The Description holder.
32
- */
33
- private static $keyword;
34
-
35
-
36
- /**
37
- * @var string The canonical holder.
38
- */
39
- private static $canonical;
40
-
41
- /**
42
- * @var string The canonical holder.
43
- */
44
- private static $og_tags;
45
-
46
- /**
47
- * @var string The og:locale holder.
48
- */
49
- private static $og_locale;
50
-
51
- /**
52
- * @var string The og:type holder.
53
- */
54
- private static $og_type;
55
-
56
- /**
57
- * @var string The og:image holder.
58
- */
59
- private static $og_image;
60
-
61
- /**
62
- * @var string The og:facebook holder.
63
- */
64
- private static $og_facebook;
65
-
66
- /**
67
- * @var string The og:twitter holder.
68
- */
69
- private static $og_twitter;
70
-
71
-
72
- /**
73
- * The constructor.
74
- * Genarate and output meta tags for current page.
75
- */
76
- public static function main() {
77
-
78
- self::generate_metas();
79
- self::generate_og_metas();
80
-
81
- echo "\n<!-- SEO SIMPLE PACK ", SSP_VERSION, " -->\n";
82
- self::output_metas();
83
- self::output_og_metas();
84
- self::output_codes();
85
- echo "<!-- / SEO SIMPLE PACK -->\n";
86
-
87
- }
88
-
89
-
90
- /**
91
- * Generate meta tags
92
- *
93
- */
94
- private static function generate_metas() {
95
-
96
- self::$obj = get_queried_object();
97
- self::$title = self::generate_title( SSP_Branch::$is_ );
98
- self::$robots = self::generate_robots( SSP_Branch::$is_ );
99
- self::$keyword = self::generate_keyword( SSP_Branch::$is_ );
100
- self::$description = self::generate_description( SSP_Branch::$is_ );
101
- self::$canonical = self::generate_canonical(SSP_Branch::$is_ );
102
-
103
- }
104
-
105
- /**
106
- * Output meta tags
107
- */
108
- private static function output_metas() {
109
-
110
-
111
- if ( !empty( self::$title ) ) {
112
- echo '<title>', esc_html( self::$title ), '</title>', "\n";
113
- }
114
-
115
- if ( !empty( self::$robots ) ) {
116
- echo '<meta name="robots" content="', esc_attr( self::$robots ), '">', "\n";
117
- }
118
-
119
- if ( !empty( self::$description ) ) {
120
- echo '<meta name="description" content="', esc_attr( self::$description ), '">', "\n";
121
- }
122
-
123
- if ( !empty( self::$keyword ) ) {
124
- echo '<meta name="keywords" content="', esc_attr( self::$keyword ), '">', "\n";
125
- }
126
-
127
- if ( !empty( self::$canonical ) ) {
128
- echo '<link rel="canonical" href="', esc_attr( self::$canonical ), '">', "\n";
129
- }
130
-
131
- }
132
-
133
-
134
- /**
135
- * Generate ogp tags
136
- *
137
- */
138
- private static function generate_og_metas() {
139
-
140
- self::$og_locale = self::generate_og_locale();
141
- self::$og_type = self::generate_og_type();
142
- self::$og_image = self::generate_og_image();
143
- self::$og_tags = self::generate_general_ogp( );
144
- self::$og_facebook = self::generate_og_facebook();
145
- self::$og_twitter = self::generate_og_twitter();
146
-
147
- }
148
-
149
-
150
- /**
151
- * Output ogp tags
152
- */
153
- private static function output_og_metas() {
154
-
155
- if ( !empty( self::$og_locale ) ) {
156
- echo '<meta property="og:locale" content="'.esc_attr( self::$og_locale ).'">'."\n";
157
- }
158
-
159
- if ( !empty( self::$og_image ) ) {
160
- echo '<meta property="og:image" content="'.esc_url( self::$og_image ).'">'."\n";
161
- }
162
-
163
- if ( !empty( self::$og_tags ) ) {
164
- echo self::$og_tags;
165
- }
166
-
167
- if ( !empty( self::$og_type ) ) {
168
- echo '<meta property="og:type" content="'.esc_attr( self::$og_type ).'">'."\n";
169
- }
170
-
171
- if ( !empty( self::$og_facebook ) ) {
172
- echo self::$og_facebook."\n";
173
- }
174
-
175
- if ( !empty( self::$og_twitter ) ) {
176
- echo self::$og_twitter."\n";
177
- }
178
-
179
- }
180
-
181
-
182
- /**
183
- * Generate the title tag for the current page.
184
- *
185
- * @param array $is_ : Results of Conditional tags.
186
- * @return string : The title.
187
- */
188
- private static function generate_title( $is_ ) {
189
-
190
- switch ( true ) {
191
- case $is_[ 'top' ]:
192
-
193
- $title = SSP_Data::$settings[ 'home_title' ];
194
- break;
195
-
196
- case $is_[ 'singular' ] :
197
- case $is_[ 'home' ] :
198
- $meta_title = get_post_meta(self::$obj->ID, SSP_MetaBox::P_METANAME['title'], true);
199
- if ( $meta_title ) {
200
- $title = $meta_title;
201
- } else {
202
- $pt = self::$obj->post_type;
203
- $title = SSP_Data::$settings[ $pt.'_title' ];
204
- }
205
- break;
206
-
207
- case $is_[ 'category' ] :
208
-
209
- $meta_title = get_term_meta(self::$obj->term_id, SSP_MetaBox::T_METANAME['title'], true);
210
- $title = $meta_title ?: SSP_Data::$settings[ 'cat_title' ];
211
- break;
212
-
213
- case $is_[ 'tag' ] :
214
-
215
- $meta_title = get_term_meta(self::$obj->term_id, SSP_MetaBox::T_METANAME['title'], true);
216
- $title = $meta_title ?: SSP_Data::$settings[ 'tag_title' ];
217
- break;
218
-
219
- case $is_[ 'tax' ] :
220
-
221
- $meta_title = get_term_meta(self::$obj->term_id, SSP_MetaBox::T_METANAME['title'], true);
222
- $term = self::$obj->taxonomy;
223
- $title = $meta_title ?: SSP_Data::$settings[ $term.'_title' ];
224
- break;
225
-
226
- case $is_[ 'pt_archive' ] :
227
-
228
- $title = SSP_Data::$settings[ 'pt_archive_title' ];
229
- break;
230
-
231
- case $is_[ 'author' ] :
232
-
233
- $title = SSP_Data::$settings[ 'author_title' ];
234
- break;
235
-
236
- case $is_[ 'date' ] :
237
-
238
- $title = SSP_Data::$settings[ 'date_title' ];
239
- break;
240
-
241
- case $is_[ 'search' ] :
242
-
243
- $title = SSP_Data::$settings[ 'search_title' ];
244
- break;
245
-
246
- case $is_[ '404' ] :
247
-
248
- $title = SSP_Data::$settings[ '404_title' ];
249
- break;
250
-
251
- default :
252
- $title = SSP_Data::$site_title;
253
- break;
254
- }
255
-
256
- $title = self::replace_snippets( $title );
257
- $title = trim( strip_shortcodes( strip_tags( $title ) ) );
258
-
259
- return apply_filters( 'ssp_output_title', $title );
260
- }
261
-
262
- /**
263
- * Generate the meta:robots for the current page.
264
- *
265
- * @param array $is_ : Results of Conditional tags.
266
- * @return string : The meta:robots.
267
- */
268
- private static function generate_robots( $is_ ) {
269
-
270
- switch ( true ) {
271
-
272
- case $is_[ 'top' ]:
273
-
274
- $robots = "";
275
- break;
276
-
277
- case $is_[ 'singular' ] :
278
- case $is_[ 'home' ] :
279
-
280
- $meta_robots = get_post_meta(self::$obj->ID, SSP_MetaBox::P_METANAME['robots'], true);
281
- if ( $meta_robots ) {
282
- $robots = $meta_robots;
283
- } else {
284
- $pt = self::$obj->post_type;
285
- $is_noindex = SSP_Data::$settings[ $pt.'_noindex' ];
286
- $robots = $is_noindex ? 'noindex' : "";
287
- }
288
- break;
289
-
290
- case $is_[ 'category' ] :
291
-
292
- $meta_robots = get_term_meta(self::$obj->term_id, SSP_MetaBox::T_METANAME['robots'], true);
293
- if ( $meta_robots ) {
294
- $robots = $meta_robots;
295
- } else {
296
- $is_noindex = SSP_Data::$settings[ 'cat_noindex' ];
297
- $robots = $is_noindex ? 'noindex' : "";
298
- }
299
-
300
- break;
301
-
302
- case $is_[ 'tag' ] :
303
-
304
- $meta_robots = get_term_meta(self::$obj->term_id, SSP_MetaBox::T_METANAME['robots'], true);
305
- if ( $meta_robots ) {
306
- $robots = $meta_robots;
307
- } else {
308
- $is_noindex = SSP_Data::$settings[ 'tag_noindex' ];
309
- $robots = $is_noindex ? 'noindex' : "";
310
- }
311
- break;
312
-
313
- case $is_[ 'tax' ] :
314
-
315
- $meta_robots = get_term_meta(self::$obj->term_id, SSP_MetaBox::T_METANAME['robots'], true);
316
- if ( $meta_robots ) {
317
- $robots = $meta_robots;
318
- } else {
319
- $term = self::$obj->taxonomy;
320
- $is_noindex = SSP_Data::$settings[ $term.'_noindex' ];
321
- $robots = $is_noindex ? 'noindex' : "";
322
- }
323
- break;
324
-
325
- case $is_[ 'pt_archive' ] :
326
-
327
- $is_noindex = SSP_Data::$settings[ 'pt_archive_noindex' ];
328
- $robots = $is_noindex ? 'noindex' : "";
329
- break;
330
-
331
- case $is_[ 'author' ] :
332
-
333
- $is_noindex = SSP_Data::$settings[ 'author_noindex' ];
334
- $robots = $is_noindex ? 'noindex' : "";
335
- break;
336
-
337
- case $is_[ 'date' ] :
338
-
339
- $is_noindex = SSP_Data::$settings[ 'date_noindex' ];
340
- $robots = $is_noindex ? 'noindex' : "";
341
- break;
342
-
343
- case $is_[ 'search' ] :
344
-
345
- $robots = 'noindex';
346
- break;
347
-
348
- case $is_[ '404' ] :
349
-
350
- $robots = 'noindex';
351
- break;
352
-
353
- default :
354
- $robots = "";
355
- break;
356
- }
357
-
358
-
359
- return apply_filters( 'ssp_output_robots', $robots );
360
- }
361
-
362
- /**
363
- * Generate the meta:keyword for the current page.
364
- *
365
- * @param array $is_ : Results of Conditional tags.
366
- * @return string : The meta:keyword.
367
- */
368
- private static function generate_keyword( $is_ ) {
369
-
370
- $keyword = SSP_Data::$settings[ 'home_keyword' ];
371
-
372
- if ( $is_[ 'singular' ] || ( ! $is_[ 'top' ] && $is_[ 'home' ] ) ) {
373
-
374
- //メタボックスが入力されていれば上書きする
375
- $metabox_keyword = get_post_meta(self::$obj->ID, SSP_MetaBox::P_METANAME['keyword'], true);
376
- if ( $metabox_keyword ) {
377
- $keyword = $metabox_keyword;
378
- }
379
-
380
- }
381
-
382
- return apply_filters( 'ssp_output_keyword', $keyword );
383
-
384
- }
385
-
386
-
387
- /**
388
- * Generate the meta:description for the current page.
389
- *
390
-
391
- * @param array $is_ : Results of Conditional tags.
392
- * @return string : The meta:description.
393
- */
394
- private static function generate_description( $is_ ) {
395
-
396
- switch ( true ) {
397
- case $is_[ 'top' ]:
398
-
399
- $description = SSP_Data::$settings[ 'home_desc' ] ?: '%_phrase_%';
400
- break;
401
-
402
- case $is_[ 'singular' ] :
403
- case $is_[ 'home' ] :
404
-
405
- $metabox_desc = get_post_meta( self::$obj->ID, SSP_MetaBox::P_METANAME['description'], true );
406
-
407
- if ( $metabox_desc !== "" ) {
408
- //メタボックスが入力されていれば優先
409
- $description = $metabox_desc;
410
- } else {
411
- $pt = self::$obj->post_type;
412
- $description = SSP_Data::$settings[ $pt.'_desc' ];
413
- }
414
- break;
415
-
416
- case $is_[ 'category' ] :
417
-
418
- $meta_description = get_term_meta(self::$obj->term_id, SSP_MetaBox::T_METANAME['description'], true);
419
- $description = $meta_description ?: SSP_Data::$settings[ 'cat_desc' ];
420
- break;
421
-
422
- case $is_[ 'tag' ] :
423
- $meta_description = get_term_meta(self::$obj->term_id, SSP_MetaBox::T_METANAME['description'], true);
424
- $description = $meta_description ?: SSP_Data::$settings[ 'tag_desc' ];
425
- break;
426
-
427
- case $is_[ 'tax' ] :
428
- $term = self::$obj->taxonomy;
429
- $description = SSP_Data::$settings[ $term.'_desc' ];
430
- break;
431
-
432
- case $is_[ 'pt_archive' ] :
433
-
434
- $description = SSP_Data::$settings[ 'pt_archive_desc' ];
435
- break;
436
-
437
- case $is_[ 'author' ] :
438
-
439
- $description = SSP_Data::$settings[ 'author_desc' ];
440
- break;
441
-
442
- case $is_[ 'date' ] :
443
-
444
- $description = SSP_Data::$settings[ 'date_desc' ];
445
- break;
446
-
447
- default :
448
- $description = SSP_Data::$settings[ 'home_desc' ];
449
- break;
450
- }
451
-
452
- $description = self::replace_snippets( $description );
453
- return apply_filters( 'ssp_output_description', $description );
454
-
455
- }
456
-
457
-
458
- /**
459
- * Generate the general ogp tags for the current page.
460
- *
461
- * @return string : OGP tags.
462
- */
463
- private static function generate_general_ogp( ) {
464
-
465
- $og_title = apply_filters('ssp_output_og_title', self::$title );
466
- $og_desc = apply_filters('ssp_output_og_description', self::$description );
467
- $og_url = apply_filters('ssp_output_og_url', self::$canonical );
468
-
469
- $ogp = "";
470
- $ogp .= '<meta property="og:title" content="'.esc_attr( $og_title ).'">'."\n";
471
- $ogp .= '<meta property="og:description" content="'.esc_attr( $og_desc ).'">'."\n";
472
- $ogp .= '<meta property="og:url" content="'.esc_attr( $og_url ).'">'."\n";
473
- $ogp .= '<meta property="og:site_name" content="'.esc_attr( SSP_Data::$site_title ).'">'."\n";
474
-
475
- return $ogp;
476
-
477
- }
478
-
479
-
480
- /**
481
- * Generate the canonical URL for the current page.
482
- *
483
- * @param array $is_ : Results of Conditional tags.
484
- * @return string : The canonical URL.
485
- */
486
- private static function generate_canonical( $is_ ) {
487
-
488
- switch ( true ) {
489
-
490
- case $is_[ 'top' ] :
491
-
492
- $canonical = home_url();
493
- break;
494
-
495
- case $is_[ 'singular' ] :
496
-
497
- //is_home は default
498
- $canonical = get_permalink();
499
- break;
500
-
501
- case $is_[ 'tax' ] || $is_[ 'tag' ] || $is_[ 'category' ] :
502
-
503
- $term = self::$obj;
504
- $term_link = get_term_link( $term, $term->taxonomy );
505
- $canonical = ( is_wp_error( $term_link ) ) ? "" : $term_link;
506
- break;
507
-
508
- case $is_[ 'pt_archive' ] :
509
-
510
- $post_type = get_query_var( 'post_type' );
511
- $post_type = ( is_array( $post_type ) ) ? reset( $post_type ) : $post_type ;
512
- $canonical = get_post_type_archive_link( $post_type );
513
- break;
514
-
515
- case $is_[ 'author' ] :
516
-
517
- $canonical = get_author_posts_url( get_query_var( 'author' ), get_query_var( 'author_name' ) );
518
- break;
519
-
520
- case $is_[ 'date' ] :
521
-
522
- if ( $is_[ 'day' ] ) {
523
- $canonical = get_day_link( get_query_var( 'year' ), get_query_var( 'monthnum' ), get_query_var( 'day' ) );
524
- }
525
- elseif ( $is_[ 'month' ] ) {
526
- $canonical = get_month_link( get_query_var( 'year' ), get_query_var( 'monthnum' ) );
527
- }
528
- elseif ( $is_[ 'year' ] ) {
529
- $canonical = get_year_link( get_query_var( 'year' ) );
530
- }
531
- break;
532
-
533
- case $is_[ 'search' ] :
534
-
535
- $canonical = get_search_link();
536
- break;
537
-
538
- case $is_[ '404' ] :
539
-
540
- $canonical = home_url()."/404";
541
- break;
542
-
543
- default :
544
-
545
- $obj = self::$obj;
546
- $canonical = get_permalink( $obj->ID );
547
-
548
- break;
549
- }
550
-
551
- return apply_filters( 'ssp_output_canonical', $canonical );
552
- }
553
-
554
-
555
- /**
556
- * Generate the og:type for the current page.
557
- *
558
- * @return string : The og:type.
559
- */
560
- private static function generate_og_type() {
561
- $og_type = 'website';
562
- if ( SSP_Branch::$is_[ 'singular' ] ) {
563
- $og_type = 'article';
564
- }
565
- return apply_filters( 'ssp_output_og_type', $og_type );
566
- }
567
-
568
-
569
- /**
570
- * Generate the og:image for the current page.
571
- * 投稿ページ:アイキャッチ画像を優先し、なければデフォルトのOG:Image画像
572
- * メディアページ:自身の画像URL
573
- *
574
- * @return string : The og:image url.
575
- */
576
- private static function generate_og_image() {
577
- $is_ = SSP_Branch::$is_;
578
- $og_image = SSP_Data::$ogp[ 'og_image' ];
579
-
580
- if( $is_['attachment'] ) {
581
- $og_image = self::$obj->guid;
582
- } elseif ( $is_[ 'singular' ] || ( ! $is_[ 'top' ] && $is_[ 'home' ] ) ) {
583
-
584
- if ( has_post_thumbnail( self::$obj->ID ) ) {
585
- $thumb_id = get_post_thumbnail_id( self::$obj->ID );
586
- $thumb_url = wp_get_attachment_image_src( $thumb_id, 'full' );
587
- $og_image = $thumb_url[0];
588
- }
589
-
590
-
591
- }
592
- return apply_filters( 'ssp_output_og_image', $og_image );
593
- }
594
-
595
-
596
- /**
597
- * Generate the og:locale for the current page.
598
- *
599
- * @return string : The og:locale.
600
- */
601
- private static function generate_og_locale() {
602
-
603
- $locale = get_locale();
604
-
605
- // Catch some weird locales served out by WP that are not easily doubled up.
606
- $fix_locales = array(
607
- 'ca' => 'ca_ES',
608
- 'en' => 'en_US',
609
- 'el' => 'el_GR',
610
- 'et' => 'et_EE',
611
- 'ja' => 'ja_JP',
612
- 'sq' => 'sq_AL',
613
- 'uk' => 'uk_UA',
614
- 'vi' => 'vi_VN',
615
- 'zh' => 'zh_CN',
616
- );
617
-
618
- if ( isset( $fix_locales[ $locale ] ) ) {
619
- $locale = $fix_locales[ $locale ];
620
- }
621
-
622
- // Convert locales like "es" to "es_ES", in case that works for the given locale (sometimes it does).
623
- if ( strlen( $locale ) === 2 ) {
624
- $locale = strtolower( $locale ) . '_' . strtoupper( $locale );
625
- }
626
-
627
- // These are the locales FB supports.
628
- $fb_valid_fb_locales = array(
629
- 'af_ZA', // Afrikaans.
630
- 'ak_GH', // Akan.
631
- 'am_ET', // Amharic.
632
- 'ar_AR', // Arabic.
633
- 'as_IN', // Assamese.
634
- 'ay_BO', // Aymara.
635
- 'az_AZ', // Azerbaijani.
636
- 'be_BY', // Belarusian.
637
- 'bg_BG', // Bulgarian.
638
- 'bn_IN', // Bengali.
639
- 'br_FR', // Breton.
640
- 'bs_BA', // Bosnian.
641
- 'ca_ES', // Catalan.
642
- 'cb_IQ', // Sorani Kurdish.
643
- 'ck_US', // Cherokee.
644
- 'co_FR', // Corsican.
645
- 'cs_CZ', // Czech.
646
- 'cx_PH', // Cebuano.
647
- 'cy_GB', // Welsh.
648
- 'da_DK', // Danish.
649
- 'de_DE', // German.
650
- 'el_GR', // Greek.
651
- 'en_GB', // English (UK).
652
- 'en_IN', // English (India).
653
- 'en_PI', // English (Pirate).
654
- 'en_UD', // English (Upside Down).
655
- 'en_US', // English (US).
656
- 'eo_EO', // Esperanto.
657
- 'es_CL', // Spanish (Chile).
658
- 'es_CO', // Spanish (Colombia).
659
- 'es_ES', // Spanish (Spain).
660
- 'es_LA', // Spanish.
661
- 'es_MX', // Spanish (Mexico).
662
- 'es_VE', // Spanish (Venezuela).
663
- 'et_EE', // Estonian.
664
- 'eu_ES', // Basque.
665
- 'fa_IR', // Persian.
666
- 'fb_LT', // Leet Speak.
667
- 'ff_NG', // Fulah.
668
- 'fi_FI', // Finnish.
669
- 'fo_FO', // Faroese.
670
- 'fr_CA', // French (Canada).
671
- 'fr_FR', // French (France).
672
- 'fy_NL', // Frisian.
673
- 'ga_IE', // Irish.
674
- 'gl_ES', // Galician.
675
- 'gn_PY', // Guarani.
676
- 'gu_IN', // Gujarati.
677
- 'gx_GR', // Classical Greek.
678
- 'ha_NG', // Hausa.
679
- 'he_IL', // Hebrew.
680
- 'hi_IN', // Hindi.
681
- 'hr_HR', // Croatian.
682
- 'hu_HU', // Hungarian.
683
- 'hy_AM', // Armenian.
684
- 'id_ID', // Indonesian.
685
- 'ig_NG', // Igbo.
686
- 'is_IS', // Icelandic.
687
- 'it_IT', // Italian.
688
- 'ja_JP', // Japanese.
689
- 'ja_KS', // Japanese (Kansai).
690
- 'jv_ID', // Javanese.
691
- 'ka_GE', // Georgian.
692
- 'kk_KZ', // Kazakh.
693
- 'km_KH', // Khmer.
694
- 'kn_IN', // Kannada.
695
- 'ko_KR', // Korean.
696
- 'ku_TR', // Kurdish (Kurmanji).
697
- 'ky_KG', // Kyrgyz.
698
- 'la_VA', // Latin.
699
- 'lg_UG', // Ganda.
700
- 'li_NL', // Limburgish.
701
- 'ln_CD', // Lingala.
702
- 'lo_LA', // Lao.
703
- 'lt_LT', // Lithuanian.
704
- 'lv_LV', // Latvian.
705
- 'mg_MG', // Malagasy.
706
- 'mi_NZ', // Maori.
707
- 'mk_MK', // Macedonian.
708
- 'ml_IN', // Malayalam.
709
- 'mn_MN', // Mongolian.
710
- 'mr_IN', // Marathi.
711
- 'ms_MY', // Malay.
712
- 'mt_MT', // Maltese.
713
- 'my_MM', // Burmese.
714
- 'nb_NO', // Norwegian (bokmal).
715
- 'nd_ZW', // Ndebele.
716
- 'ne_NP', // Nepali.
717
- 'nl_BE', // Dutch (Belgie).
718
- 'nl_NL', // Dutch.
719
- 'nn_NO', // Norwegian (nynorsk).
720
- 'ny_MW', // Chewa.
721
- 'or_IN', // Oriya.
722
- 'pa_IN', // Punjabi.
723
- 'pl_PL', // Polish.
724
- 'ps_AF', // Pashto.
725
- 'pt_BR', // Portuguese (Brazil).
726
- 'pt_PT', // Portuguese (Portugal).
727
- 'qu_PE', // Quechua.
728
- 'rm_CH', // Romansh.
729
- 'ro_RO', // Romanian.
730
- 'ru_RU', // Russian.
731
- 'rw_RW', // Kinyarwanda.
732
- 'sa_IN', // Sanskrit.
733
- 'sc_IT', // Sardinian.
734
- 'se_NO', // Northern Sami.
735
- 'si_LK', // Sinhala.
736
- 'sk_SK', // Slovak.
737
- 'sl_SI', // Slovenian.
738
- 'sn_ZW', // Shona.
739
- 'so_SO', // Somali.
740
- 'sq_AL', // Albanian.
741
- 'sr_RS', // Serbian.
742
- 'sv_SE', // Swedish.
743
- 'sw_KE', // Swahili.
744
- 'sy_SY', // Syriac.
745
- 'sz_PL', // Silesian.
746
- 'ta_IN', // Tamil.
747
- 'te_IN', // Telugu.
748
- 'tg_TJ', // Tajik.
749
- 'th_TH', // Thai.
750
- 'tk_TM', // Turkmen.
751
- 'tl_PH', // Filipino.
752
- 'tl_ST', // Klingon.
753
- 'tr_TR', // Turkish.
754
- 'tt_RU', // Tatar.
755
- 'tz_MA', // Tamazight.
756
- 'uk_UA', // Ukrainian.
757
- 'ur_PK', // Urdu.
758
- 'uz_UZ', // Uzbek.
759
- 'vi_VN', // Vietnamese.
760
- 'wo_SN', // Wolof.
761
- 'xh_ZA', // Xhosa.
762
- 'yi_DE', // Yiddish.
763
- 'yo_NG', // Yoruba.
764
- 'zh_CN', // Simplified Chinese (China).
765
- 'zh_HK', // Traditional Chinese (Hong Kong).
766
- 'zh_TW', // Traditional Chinese (Taiwan).
767
- 'zu_ZA', // Zulu.
768
- 'zz_TR', // Zazaki.
769
- );
770
-
771
- // Check to see if the locale is a valid FB one, if not, use en_US as a fallback.
772
- if ( ! in_array( $locale, $fb_valid_fb_locales, true ) ) {
773
- $locale = strtolower( substr( $locale, 0, 2 ) ) . '_' . strtoupper( substr( $locale, 0, 2 ) );
774
- if ( ! in_array( $locale, $fb_valid_fb_locales, true ) ) {
775
- $locale = 'en_US';
776
- }
777
- }
778
-
779
- return apply_filters( 'ssp_output_og_locale', $locale );
780
-
781
- }
782
-
783
- /**
784
- * Generate the og tags for facebook. for the current page.
785
- *
786
- * @return string : The og tags for facebook.
787
- */
788
- private static function generate_og_facebook() {
789
-
790
- if ( ! SSP_Data::$ogp[ 'fb_active' ] ) {
791
- return "";
792
- }
793
-
794
- $og_fb = "";
795
-
796
- $appid = apply_filters( 'ssp_output_fb_appid', SSP_Data::$ogp[ 'fb_app_id' ] );
797
- $admins = apply_filters( 'ssp_output_fb_admins', SSP_Data::$ogp[ 'fb_admins' ] );
798
- $publisher = apply_filters( 'ssp_output_fb_publisher', SSP_Data::$ogp[ 'fb_url' ] );
799
-
800
- if( !empty( $appid )) {
801
- $og_fb .= '<meta property="fb:app_id" content="'.esc_attr( $appid ).'">'."\n";
802
- }
803
- if ( !empty( $admins )) {
804
- $og_fb .= '<meta property="fb:admins" content="'.esc_attr( $admins ).'">'."\n";
805
- }
806
- if ( !empty( $publisher ) && self::$og_type === "article") {
807
- $og_fb .= '<meta property="article:publisher" content="'.esc_attr( $publisher ).'">'."\n";
808
- }
809
-
810
- return $og_fb;
811
-
812
- }
813
-
814
-
815
- /**
816
- * Generate the og tags for twitter. for the current page.
817
- *
818
- * @return string : The og tags for twitter.
819
- */
820
- private static function generate_og_twitter() {
821
-
822
- if ( ! SSP_Data::$ogp[ 'tw_active' ] ) {
823
- return "";
824
- }
825
-
826
- $og_tw = "";
827
-
828
- $tw_site = apply_filters( 'ssp_output_tw_site', SSP_Data::$ogp[ 'tw_account' ] );
829
- $tw_card = apply_filters( 'ssp_output_tw_card', SSP_Data::$ogp[ 'tw_card' ] );
830
-
831
- if( !empty( $tw_card ) ) {
832
- $og_tw .= '<meta name="twitter:card" content="'.esc_attr( $tw_card ).'">'."\n";
833
- }
834
- if( !empty( $tw_site ) ) {
835
- $og_tw .= '<meta name="twitter:site" content="'.esc_attr( $tw_site ).'">'."\n";
836
- }
837
-
838
- return $og_tw;
839
- }
840
-
841
-
842
- /**
843
- * Analytics and Webmaster code.
844
- *
845
- * @return echo : code.
846
- */
847
- private static function output_codes() {
848
-
849
- //meta tags for webmaster tools
850
- if ( SSP_Branch::$is_['top'] ) {
851
- $webmaster_codes = [
852
- 'webmaster_google' => 'google-site-verification',
853
- 'webmaster_bing' => 'msvalidate.01',
854
- 'webmaster_baidu' => 'baidu-site-verification',
855
- 'webmaster_yandex' => 'yandex-verification',
856
- ];
857
- foreach ($webmaster_codes as $key => $name) {
858
-
859
- if ( SSP_Data::$settings[ $key ] ) {
860
- echo '<meta name="', esc_attr( $name ),'" content="', esc_attr( SSP_Data::$settings[ $key ] ), '">', "\n";
861
- }
862
-
863
- }
864
- }
865
-
866
-
867
- //google analytics code
868
- if ( SSP_Data::$settings[ 'google_analytics_id' ] ) {
869
- $gaid = SSP_Data::$settings[ 'google_analytics_id' ];
870
-
871
- if ( SSP_Data::$settings[ 'google_analytics_type' ] === 'gtag' ) {
872
-
873
- echo "<!-- Global site tag (gtag.js) - Google Analytics -->\n",
874
- "<script async src='https://www.googletagmanager.com/gtag/js?id=", esc_attr( $gaid ), "'></script>\n",
875
- "<script>\n",
876
- "window.dataLayer = window.dataLayer || [];\n",
877
- "function gtag(){dataLayer.push(arguments);}\n",
878
- "gtag('js', new Date());\n",
879
- "gtag('config', '", esc_attr( $gaid ), "');\n",
880
- "</script>\n";
881
-
882
- } elseif ( SSP_Data::$settings[ 'google_analytics_type' ] === 'analytics' ) {
883
-
884
- echo "<!-- Google Analytics -->\n",
885
- "<script>\n",
886
- "(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n",
887
- "(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n",
888
- "m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n",
889
- "})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');\n",
890
-
891
- "ga('create', '", esc_attr( $gaid ), "', 'auto');\n",
892
- "ga('send', 'pageview');\n",
893
- "</script>\n",
894
- "<!-- End Google Analytics -->\n";
895
-
896
- }
897
- }
898
- }
899
-
900
- /**
901
- *
902
- * Replace snippets method for self::
903
- *
904
- * - %_site_title_% : サイトのタイトル
905
- * - %_phrase_% : サイトのキャッチフレーズ
906
- * - %_site_description_% : サイトの説明文
907
- * - %_page_title_% : 投稿タイトル
908
- * - %_description_% : 投稿タイトル
909
- * - %_cat_name_% : カテゴリ名
910
- * - %_tag_name_% : タグ名
911
- * - %_term_name_% : ターム名
912
- * - %_tax_name_% : タクソノミー名
913
- * - %_search_phrase_% : 検索ワード
914
- * - %_post_type_% : 投稿タイプ
915
- * - %_format_name_% : 投稿フォーマット名
916
- * - %_date_% : Y年M月D日
917
- * - %_author_name_% : 著者名ニックネーム
918
- * - %_sep_% : 区切り文字
919
- *
920
- */
921
- private static function replace_snippets ( $str ) {
922
-
923
- $obj = self::$obj;
924
- $is_ = SSP_Branch::$is_;
925
- $str = str_replace ( '%_site_title_%', SSP_Data::$site_title, $str );
926
- $str = str_replace ( '%_phrase_%', SSP_Data::$site_catch_phrase, $str );
927
- $str = str_replace ( '%_description_%', SSP_Data::$settings[ 'home_desc' ], $str );
928
-
929
- if ( $is_['singular'] || ( ! $is_[ 'top' ] && $is_[ 'home' ] ) ) {
930
- //タイトル
931
- $title = get_the_title( $obj->ID );
932
- $str = str_replace ( '%_page_title_%', $title, $str );
933
-
934
- if ( strpos( $str, '%_page_contents_%' ) !== false ) {
935
-
936
- $content = $obj->post_content;
937
- $content = strip_shortcodes( strip_tags( $content ) );
938
- $content = str_replace(array("\r\n", "\r", "\n", "&nbsp;"), '', $content); //改行削除
939
- // $content = htmlspecialchars( $content, ENT_QUOTES, 'UTF-8' ); //出力時にesc_
940
- $content = mb_substr( $content, 0, 300 );
941
- $str = str_replace ( '%_page_contents_%', $content, $str );
942
-
943
- }
944
-
945
- } elseif ( $is_['category'] || $is_['tag'] || $is_['tax'] ) {
946
- //タームアーカイブ
947
- $str = str_replace ( array('%_cat_name_%','%_tag_name_%','%_term_name_%'), $obj->name, $str );
948
- $str = str_replace ('%_term_description_%', strip_shortcodes( $obj->description ), $str );
949
-
950
- if ( strpos( $str, '%_tax_name_%' ) !== false ) {
951
-
952
- $taxonomy_slug = ( isset( $obj->taxonomy ) ) ? $obj->taxonomy : "";
953
- $taxonomy_var = get_taxonomy($taxonomy_slug);
954
- $taxonomy_label = ( $taxonomy_var ) ? $taxonomy_var->label : "";
955
-
956
- $str = str_replace ( '%_tax_name_%', $taxonomy_label, $str );
957
- }
958
-
959
- } else {
960
- //その他のページ
961
- $obj_name = ( isset( $obj->name ) ) ? $obj->name : "";
962
- $obj_label = ( isset( $obj->label ) ) ? $obj->label : "";
963
-
964
- $str = str_replace ( '%_post_type_%', $obj_label, $str );
965
- $str = str_replace ( '%_format_name_%', $obj_name, $str );
966
-
967
- if ( strpos( $str, '%_date_%' ) !== false ) {
968
-
969
- $date = "";
970
- if ( $is_['day'] ) {
971
- $date = get_query_var( 'year' )."年".get_query_var( 'monthnum' )."月".get_query_var( 'day' )."日";
972
- }
973
- elseif ( $is_['month'] ) {
974
- $date = get_query_var( 'year' )."年".get_query_var( 'monthnum' )."月";
975
- }
976
- elseif ( $is_['year'] ) {
977
- $date = get_query_var( 'year' )."年";
978
- }
979
-
980
- $str = str_replace ('%_date_%', $date, $str);
981
-
982
- }
983
-
984
- if ( strpos( $str, '%_author_name_%' ) !== false ) {
985
-
986
-
987
- $str = str_replace ( '%_author_name_%', get_user_meta( $obj->ID, 'nickname', true ), $str );
988
-
989
- }
990
-
991
- if ( strpos( $str, '%_search_phrase_%' ) !== false ) {
992
-
993
- $str = str_replace ( '%_search_phrase_%', get_search_query(), $str );
994
-
995
- }
996
- }
997
-
998
- if ( strpos( $str, '%_sep_%' ) !== false ) {
999
-
1000
- $sep_key = SSP_Data::$settings[ 'separator' ];
1001
- $sep_val = SSP_Data::SEPARATOR_LIST[$sep_key];
1002
- $str = str_replace( '%_sep_%', $sep_val, $str );
1003
-
1004
- }
1005
-
1006
- return $str;
1007
- }
1008
-
1009
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
class/trait/field.php ADDED
@@ -0,0 +1,268 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * 設定フィールド出力用のtrait
4
+ */
5
+ namespace SSP;
6
+
7
+ // phpcs:disable WordPress.WP.EnqueuedResources.NonEnqueuedScript
8
+ // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
9
+ trait Field {
10
+
11
+ /**
12
+ * 外部からのインスタンス化を防ぐ
13
+ */
14
+ private function __construct() {}
15
+
16
+ /**
17
+ * 設定セクションの出力
18
+ */
19
+ public static function output_section( $title, $table_rows, $db_name = null ) {
20
+
21
+ if ( 'ogp' === $db_name ) {
22
+ $db = \SSP_Data::$ogp;
23
+ } else {
24
+ $db = \SSP_Data::$settings;
25
+ }
26
+
27
+ ?>
28
+ <div class="ssp-page__section">
29
+ <h2 class="ssp-page__section__title">
30
+ <?=esc_html( $title )?>
31
+ </h2>
32
+ <div class="ssp-page__section__body">
33
+ <?php
34
+ foreach ( $table_rows as $name => $args ) :
35
+ $now_value = isset( $db[ $name ] ) ? $db[ $name ] : '';
36
+ self::output_field( $name, $args, $now_value );
37
+ endforeach;
38
+ ?>
39
+ </div>
40
+ </div>
41
+ <?php
42
+ }
43
+
44
+
45
+ /**
46
+ * 各設定項目を出力する
47
+ */
48
+ public static function output_field( $name, $args = [], $now_value ) {
49
+
50
+ $args = array_merge( [
51
+ 'title' => '',
52
+ 'reqired' => false,
53
+ 'class' => '',
54
+ 'type' => 'text',
55
+ 'preview' => false,
56
+ 'desc' => '',
57
+ 'choices' => [],
58
+ 'item' => '',
59
+ ], $args );
60
+
61
+ $add_data = '';
62
+ if ( strpos( $name, '_disable' ) !== false ) {
63
+ $add_data = ' data-disable="' . esc_attr( (int) $now_value ) . '"';
64
+ } elseif ( strpos( $name, 'tw_active' ) !== false || strpos( $name, 'fb_active' ) !== false ) {
65
+ $add_data = ' data-active="' . esc_attr( (int) $now_value ) . '"';
66
+ }
67
+
68
+ // if ( $args['reqired'] ) {
69
+ // $table_title .= '<span class="required">*</span>';
70
+ // }
71
+
72
+ ?>
73
+ <div class="ssp-field"<?=$add_data?>>
74
+ <label for="<?=esc_attr( $name )?>" class="ssp-field__title">
75
+ <?=esc_html( $args['title'] ) ?>
76
+ </label>
77
+ <div class="<?=esc_attr( trim( 'ssp-field__body ' . $args['class'] ) )?>">
78
+ <div class="ssp_item ssp-field__item -<?=$args['type']?>">
79
+ <?php
80
+ if ( $args['item'] ) :
81
+ echo $args['item'];
82
+ else :
83
+ self::the_setting_field( $name, $now_value, $args['type'], $args['choices'] );
84
+ endif;
85
+ ?>
86
+ </div>
87
+ <div class="ssp_desc ssp-field__desc">
88
+ <p><?=$args['desc']?></p>
89
+ </div>
90
+ <?php if ( $args['preview'] ) : ?>
91
+ <div class="ssp-field__preview">
92
+ <span class="ssp-field__preview__label">
93
+ ┗ <?=esc_html__( 'Preview', 'loos-ssp' )?> :
94
+ </span>
95
+ <div class="ssp-field__preview__content">
96
+ <?=wp_kses_post( self::replace_snippets_forpv( $now_value ) )?>
97
+ </div>
98
+ <a href="<?=esc_url( admin_url( 'admin.php?page=ssp_help' ) )?>" target="_blank" title="<?=esc_html__( 'About available snippet tags', 'loos-ssp' )?>" class="ssp-helpButton">?</a>
99
+ </div>
100
+ <?php endif; ?>
101
+ </div>
102
+ </div>
103
+ <?php
104
+ }
105
+
106
+ /**
107
+ * 設定フィールドを取得
108
+ */
109
+ public static function the_setting_field( $name, $now_value, $type, $choices ) {
110
+
111
+ if ( 'text' === $type ) {
112
+
113
+ self::text_input( $name, $now_value );
114
+
115
+ } elseif ( 'switch' === $type ) {
116
+
117
+ self::switch_box( $name, $now_value );
118
+
119
+ } elseif ( 'select' === $type ) {
120
+
121
+ self::select_box( $name, $now_value, $choices );
122
+
123
+ } if ( 'radio_btn' === $type ) {
124
+
125
+ self::radio_btns( $name, $now_value, $choices );
126
+
127
+ } if ( 'media' === $type ) {
128
+
129
+ self::media_btns( $name, $now_value );
130
+
131
+ } elseif ( 'textarea' === $type ) {
132
+
133
+ self::textarea( $name, $now_value );
134
+
135
+ }
136
+ }
137
+
138
+
139
+ /**
140
+ * text_input
141
+ */
142
+ public static function text_input( $name, $now_value ) {
143
+ echo '<input type="text" name="' . esc_attr( $name ) . '" id="' . esc_attr( $name ) . '" value="' . esc_attr( $now_value ) . '">';
144
+ }
145
+
146
+
147
+ /**
148
+ * textarea
149
+ */
150
+ public static function textarea( $name, $now_value, $rows = '4' ) {
151
+ echo '<textarea name="' . esc_attr( $name ) . '" rows="' . esc_attr( $rows ) . '">' . esc_html( $now_value ) . '</textarea>';
152
+ }
153
+
154
+
155
+ /**
156
+ * switch_box
157
+ */
158
+ public static function switch_box( $name, $is_checked ) {
159
+
160
+ $checked = ( $is_checked ) ? 'checked' : '';
161
+ ?>
162
+ <span><?=esc_html__( 'Yes', 'loos-ssp' )?></span>
163
+ <label class="ssp_switch_box" for="<?=esc_attr( $name )?>">
164
+ <input type="checkbox" name="" id="<?=esc_attr( $name )?>" <?=$checked?>>
165
+ <span class="ssp_switch_box__slider -round"></span>
166
+ </label>
167
+ <span><?=esc_html__( 'No', 'loos-ssp' )?></span>
168
+ <input type="hidden" name="<?=esc_attr( $name )?>" value="<?=esc_attr( $is_checked )?>">
169
+ <?php
170
+ }
171
+
172
+
173
+ /**
174
+ * select_box
175
+ */
176
+ public static function select_box( $name, $now_value, $choices ) {
177
+
178
+ echo '<select name="' . esc_attr( $name ) . '" id="' . esc_attr( $name ) . '">';
179
+ foreach ( $choices as $key => $label ) {
180
+ $selected = ( $key === $now_value ) ? 'selected' : '';
181
+ echo '<option value="' . esc_attr( $key ) . '" ' . $selected . '>' . esc_html( $label ) . '</option>';
182
+ }
183
+ echo '</select>';
184
+ }
185
+
186
+
187
+ /**
188
+ * radio_btns
189
+ */
190
+ public static function radio_btns( $name, $now_value, $choices ) {
191
+
192
+ foreach ( $choices as $key => $label ) {
193
+
194
+ $checked = ( $key === $now_value ) ? 'checked' : '';
195
+ $radio_key = 'radio-' . $name . '-' . $key;
196
+
197
+ echo '<input type="radio" class="ssp-field__radioInput"' .
198
+ ' id="' . esc_attr( $radio_key ) . '"' .
199
+ ' name="' . esc_attr( $name ) . '"' .
200
+ ' value="' . esc_attr( $key ) . '"' . $checked . '>' .
201
+ '<label class="ssp-field__radioLabel" for="' . esc_attr( $radio_key ) . '">' . esc_html( $label ) . '</label>';
202
+ }
203
+ }
204
+
205
+
206
+ /**
207
+ * 画像アップロード
208
+ */
209
+ public static function media_btns( $name = '', $src = '' ) {
210
+ ?>
211
+ <div class="ssp-media">
212
+ <input type="hidden" id="src_<?=esc_attr( $name )?>" name="<?=esc_attr( $name )?>" value="<?=esc_attr( $src )?>" />
213
+ <?php if ( $src ) : ?>
214
+ <div id="preview_<?=esc_attr( $name )?>" class="ssp-media__preview">
215
+ <img src="<?=esc_url( $src )?>" alt="">
216
+ </div>
217
+ <?php else : ?>
218
+ <div id="preview_<?=esc_attr( $name )?>" class="ssp-media__preview"></div>
219
+ <?php endif; ?>
220
+ <div class="ssp-media__null">
221
+ <?=esc_html__( 'No image has been set yet.', 'loos-ssp' )?>
222
+ </div>
223
+ <div class="ssp-media__btns">
224
+ <button type="button" class="button button-primary" name="ssp-media-upload" data-id="<?=esc_attr( $name )?>">
225
+ <?=esc_html__( 'Select image', 'loos-ssp' )?>
226
+ </button>
227
+ <button type="button" class="button" name="ssp-media-clear" data-id="<?=esc_attr( $name )?>">
228
+ <?=esc_html__( 'Delete image', 'loos-ssp' )?>
229
+ </button>
230
+ </div>
231
+ </div>
232
+ <?php
233
+ }
234
+
235
+
236
+ /**
237
+ * プレビュー機能用のスニペット変換
238
+ */
239
+ public static function replace_snippets_forpv( $str ) {
240
+
241
+ $str = str_replace( '%_site_title_%', '<span>' . \SSP_Data::$site_title . '</span>', $str );
242
+ $str = str_replace( '%_phrase_%', '<span>' . \SSP_Data::$site_catch_phrase . '</span>', $str );
243
+ $str = str_replace( '%_tagline_%', '<span>' . \SSP_Data::$site_catch_phrase . '</span>', $str );
244
+ $str = str_replace( '%_description_%', \SSP_Data::$settings['home_desc'], $str );
245
+ $str = str_replace( '%_page_title_%', '<span>' . __( 'Post title', 'loos-ssp' ) . '</span>', $str );
246
+ $str = str_replace( '%_cat_name_%', '<span>' . __( 'Category name', 'loos-ssp' ) . '</span>', $str );
247
+ $str = str_replace( '%_tag_name_%', '<span>' . __( 'Tag name', 'loos-ssp' ) . '</span>', $str );
248
+ $str = str_replace( '%_term_name_%', '<span>' . __( 'Term name', 'loos-ssp' ) . '</span>', $str );
249
+ $str = str_replace( '%_tax_name_%', '<span>' . __( 'Taxonomy name', 'loos-ssp' ) . '</span>', $str );
250
+ $str = str_replace( '%_author_name_%', '<span>' . __( 'Author name', 'loos-ssp' ) . '</span>', $str );
251
+ $str = str_replace( '%_search_phrase_%', '<span>' . __( 'Search word', 'loos-ssp' ) . '</span>', $str );
252
+ $str = str_replace( '%_post_type_%', '<span>' . __( 'Post type name', 'loos-ssp' ) . '</span>', $str );
253
+ $str = str_replace( '%_page_contents_%', '<span>' . __( 'Page content', 'loos-ssp' ) . '</span>', $str );
254
+ $str = str_replace( '%_date_%', '<span>' . __( 'Date', 'loos-ssp' ) . '</span>', $str );
255
+ $str = str_replace( '%_format_name_%', '<span>' . __( 'Post format name', 'loos-ssp' ) . '</span>', $str );
256
+ $str = str_replace( '%_term_description_%', '<span>' . __( 'Term description', 'loos-ssp' ) . '</span>', $str );
257
+
258
+ if ( strpos( $str, '%_sep_%' ) !== false ) {
259
+
260
+ $sep_key = \SSP_Data::$settings['separator'];
261
+ $sep_val = \SSP_Data::SEPARATORS[ $sep_key ];
262
+ $str = str_replace( '%_sep_%', '<span>' . $sep_val . '</span>', $str );
263
+
264
+ }
265
+
266
+ return $str;
267
+ }
268
+ }
class/trait/output_helper.php ADDED
@@ -0,0 +1,326 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * SSP_Output用のtrait
4
+ */
5
+ namespace SSP;
6
+
7
+ // phpcs:disable WordPress.WP.EnqueuedResources.NonEnqueuedScript
8
+
9
+ trait Output_Helper {
10
+
11
+ /**
12
+ * gtagコード出力
13
+ */
14
+ public static function echo_gtag( $gaid ) {
15
+ ?>
16
+ <!-- Google Analytics (gtag.js) -->
17
+ <script async src="https://www.googletagmanager.com/gtag/js?id=<?=esc_attr( $gaid )?>"></script>
18
+ <script>
19
+ window.dataLayer = window.dataLayer || [];
20
+ function gtag(){dataLayer.push(arguments);}
21
+ gtag("js", new Date());
22
+ gtag("config", "<?=esc_attr( $gaid )?>");
23
+ </script>
24
+ <?php
25
+ }
26
+
27
+
28
+ /**
29
+ * 旧アナリティクスコード出力
30
+ */
31
+ public static function echo_analytics( $gaid ) {
32
+ ?>
33
+ <!-- Google Analytics -->
34
+ <script>
35
+ (function(i,s,o,g,r,a,m){i["GoogleAnalyticsObject"]=r;i[r]=i[r]||function(){
36
+ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
37
+ m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
38
+ })(window,document,"script","https://www.google-analytics.com/analytics.js","ga");
39
+ ga("create", "<?=esc_attr( $gaid )?>", "auto");
40
+ ga("send", "pageview");
41
+ </script>
42
+ <?php
43
+ }
44
+
45
+
46
+ /**
47
+ * og:locale用の有効な文字列を取得
48
+ */
49
+ public static function get_valid_og_locale() {
50
+ $locale = get_locale();
51
+
52
+ // 少し特殊なケースの locale 文字列たちを先に変換
53
+ $fix_locales = [
54
+ 'ca' => 'ca_ES', // Catalan.
55
+ 'en' => 'en_US', // English (US).
56
+ 'el' => 'el_GR', // Greek.
57
+ 'et' => 'et_EE', // Estonian.
58
+ 'ja' => 'ja_JP', // Japanese.
59
+ 'sq' => 'sq_AL', // Albanian.
60
+ 'uk' => 'uk_UA', // Ukrainian.
61
+ 'vi' => 'vi_VN', // Vietnamese.
62
+ 'zh' => 'zh_CN', // Simplified Chinese (China).
63
+ ];
64
+
65
+ if ( isset( $fix_locales[ $locale ] ) ) {
66
+ return $fix_locales[ $locale ];
67
+ }
68
+
69
+ // Convert locales like "es" to "es_ES".
70
+ if ( strlen( $locale ) === 2 ) {
71
+ $locale = strtolower( $locale ) . '_' . strtoupper( $locale );
72
+ }
73
+
74
+ // These are the locales FB supports.
75
+ $fb_valid_locales = [
76
+ 'af_ZA', // Afrikaans.
77
+ 'ak_GH', // Akan.
78
+ 'am_ET', // Amharic.
79
+ 'ar_AR', // Arabic.
80
+ 'as_IN', // Assamese.
81
+ 'ay_BO', // Aymara.
82
+ 'az_AZ', // Azerbaijani.
83
+ 'be_BY', // Belarusian.
84
+ 'bg_BG', // Bulgarian.
85
+ 'bn_IN', // Bengali.
86
+ 'br_FR', // Breton.
87
+ 'bs_BA', // Bosnian.
88
+ // 'ca_ES',
89
+ 'cb_IQ', // Sorani Kurdish.
90
+ 'ck_US', // Cherokee.
91
+ 'co_FR', // Corsican.
92
+ 'cs_CZ', // Czech.
93
+ 'cx_PH', // Cebuano.
94
+ 'cy_GB', // Welsh.
95
+ 'da_DK', // Danish.
96
+ 'de_DE', // German.
97
+ // 'el_GR',
98
+ 'en_GB', // English (UK).
99
+ 'en_IN', // English (India).
100
+ 'en_PI', // English (Pirate).
101
+ 'en_UD', // English (Upside Down).
102
+ // 'en_US',
103
+ 'eo_EO', // Esperanto.
104
+ 'es_CL', // Spanish (Chile).
105
+ 'es_CO', // Spanish (Colombia).
106
+ 'es_ES', // Spanish (Spain).
107
+ 'es_LA', // Spanish.
108
+ 'es_MX', // Spanish (Mexico).
109
+ 'es_VE', // Spanish (Venezuela).
110
+ // 'et_EE',
111
+ 'eu_ES', // Basque.
112
+ 'fa_IR', // Persian.
113
+ 'fb_LT', // Leet Speak.
114
+ 'ff_NG', // Fulah.
115
+ 'fi_FI', // Finnish.
116
+ 'fo_FO', // Faroese.
117
+ 'fr_CA', // French (Canada).
118
+ 'fr_FR', // French (France).
119
+ 'fy_NL', // Frisian.
120
+ 'ga_IE', // Irish.
121
+ 'gl_ES', // Galician.
122
+ 'gn_PY', // Guarani.
123
+ 'gu_IN', // Gujarati.
124
+ 'gx_GR', // Classical Greek.
125
+ 'ha_NG', // Hausa.
126
+ 'he_IL', // Hebrew.
127
+ 'hi_IN', // Hindi.
128
+ 'hr_HR', // Croatian.
129
+ 'hu_HU', // Hungarian.
130
+ 'hy_AM', // Armenian.
131
+ 'id_ID', // Indonesian.
132
+ 'ig_NG', // Igbo.
133
+ 'is_IS', // Icelandic.
134
+ 'it_IT', // Italian.
135
+ // 'ja_JP',
136
+ 'ja_KS', // Japanese (Kansai).
137
+ 'jv_ID', // Javanese.
138
+ 'ka_GE', // Georgian.
139
+ 'kk_KZ', // Kazakh.
140
+ 'km_KH', // Khmer.
141
+ 'kn_IN', // Kannada.
142
+ 'ko_KR', // Korean.
143
+ 'ku_TR', // Kurdish (Kurmanji).
144
+ 'ky_KG', // Kyrgyz.
145
+ 'la_VA', // Latin.
146
+ 'lg_UG', // Ganda.
147
+ 'li_NL', // Limburgish.
148
+ 'ln_CD', // Lingala.
149
+ 'lo_LA', // Lao.
150
+ 'lt_LT', // Lithuanian.
151
+ 'lv_LV', // Latvian.
152
+ 'mg_MG', // Malagasy.
153
+ 'mi_NZ', // Maori.
154
+ 'mk_MK', // Macedonian.
155
+ 'ml_IN', // Malayalam.
156
+ 'mn_MN', // Mongolian.
157
+ 'mr_IN', // Marathi.
158
+ 'ms_MY', // Malay.
159
+ 'mt_MT', // Maltese.
160
+ 'my_MM', // Burmese.
161
+ 'nb_NO', // Norwegian (bokmal).
162
+ 'nd_ZW', // Ndebele.
163
+ 'ne_NP', // Nepali.
164
+ 'nl_BE', // Dutch (Belgie).
165
+ 'nl_NL', // Dutch.
166
+ 'nn_NO', // Norwegian (nynorsk).
167
+ 'ny_MW', // Chewa.
168
+ 'or_IN', // Oriya.
169
+ 'pa_IN', // Punjabi.
170
+ 'pl_PL', // Polish.
171
+ 'ps_AF', // Pashto.
172
+ 'pt_BR', // Portuguese (Brazil).
173
+ 'pt_PT', // Portuguese (Portugal).
174
+ 'qu_PE', // Quechua.
175
+ 'rm_CH', // Romansh.
176
+ 'ro_RO', // Romanian.
177
+ 'ru_RU', // Russian.
178
+ 'rw_RW', // Kinyarwanda.
179
+ 'sa_IN', // Sanskrit.
180
+ 'sc_IT', // Sardinian.
181
+ 'se_NO', // Northern Sami.
182
+ 'si_LK', // Sinhala.
183
+ 'sk_SK', // Slovak.
184
+ 'sl_SI', // Slovenian.
185
+ 'sn_ZW', // Shona.
186
+ 'so_SO', // Somali.
187
+ // 'sq_AL',
188
+ 'sr_RS', // Serbian.
189
+ 'sv_SE', // Swedish.
190
+ 'sw_KE', // Swahili.
191
+ 'sy_SY', // Syriac.
192
+ 'sz_PL', // Silesian.
193
+ 'ta_IN', // Tamil.
194
+ 'te_IN', // Telugu.
195
+ 'tg_TJ', // Tajik.
196
+ 'th_TH', // Thai.
197
+ 'tk_TM', // Turkmen.
198
+ 'tl_PH', // Filipino.
199
+ 'tl_ST', // Klingon.
200
+ 'tr_TR', // Turkish.
201
+ 'tt_RU', // Tatar.
202
+ 'tz_MA', // Tamazight.
203
+ // 'uk_UA',
204
+ 'ur_PK', // Urdu.
205
+ 'uz_UZ', // Uzbek.
206
+ // 'vi_VN',
207
+ 'wo_SN', // Wolof.
208
+ 'xh_ZA', // Xhosa.
209
+ 'yi_DE', // Yiddish.
210
+ 'yo_NG', // Yoruba.
211
+ // 'zh_CN',
212
+ 'zh_HK', // Traditional Chinese (Hong Kong).
213
+ 'zh_TW', // Traditional Chinese (Taiwan).
214
+ 'zu_ZA', // Zulu.
215
+ 'zz_TR', // Zazaki.
216
+ ];
217
+
218
+ // FBでサポートされていない locale だった場合、en_US を返す
219
+ if ( ! in_array( $locale, $fb_valid_locales, true ) ) {
220
+ return 'en_US';
221
+ }
222
+
223
+ return $locale;
224
+ }
225
+
226
+
227
+ /**
228
+ * Replace snippets
229
+ */
230
+ private static function replace_snippets( $str ) {
231
+
232
+ $obj = \SSP_Output::$obj;
233
+
234
+ // 共通項目の置換
235
+ $str = str_replace( '%_site_title_%', \SSP_Data::$site_title, $str );
236
+ $str = str_replace( '%_phrase_%', \SSP_Data::$site_catch_phrase, $str );
237
+ $str = str_replace( '%_tagline_%', \SSP_Data::$site_catch_phrase, $str );
238
+ $str = str_replace( '%_description_%', \SSP_Data::$settings['home_desc'], $str );
239
+
240
+ if ( is_singular() || ( ! is_front_page() && is_home() ) ) {
241
+
242
+ // title
243
+ $title = get_the_title( $obj->ID );
244
+ $str = str_replace( '%_page_title_%', $title, $str );
245
+
246
+ // description
247
+ if ( false !== strpos( $str, '%_page_contents_%' ) ) {
248
+ $content = wp_strip_all_tags( do_shortcode( $obj->post_content ), true ); // 改行なども削除
249
+ $content = mb_substr( $content, 0, 300 );
250
+ $str = str_replace( '%_page_contents_%', $content, $str );
251
+ }
252
+ } elseif ( is_category() || is_tag() || is_tax() ) {
253
+
254
+ // title
255
+ $str = str_replace( ['%_cat_name_%', '%_tag_name_%', '%_term_name_%', '%_format_name_%' ], $obj->name, $str );
256
+
257
+ // description
258
+ $term_desc = wp_strip_all_tags( do_shortcode( $obj->description ), true ); // 改行なども削除
259
+ $str = str_replace( '%_term_description_%', $term_desc, $str );
260
+
261
+ // タクソノミー名
262
+ if ( false !== strpos( $str, '%_tax_name_%' ) ) {
263
+
264
+ $taxonomy_slug = ( isset( $obj->taxonomy ) ) ? $obj->taxonomy : '';
265
+ $taxonomy_var = get_taxonomy( $taxonomy_slug );
266
+ $taxonomy_label = ( $taxonomy_var ) ? $taxonomy_var->label : '';
267
+
268
+ $str = str_replace( '%_tax_name_%', $taxonomy_label, $str );
269
+ }
270
+ } else {
271
+ // その他のページ
272
+ // $obj_name = ( isset( $obj->name ) ) ? $obj->name : '';
273
+ $obj_label = ( isset( $obj->label ) ) ? $obj->label : '';
274
+
275
+ $str = str_replace( '%_post_type_%', $obj_label, $str );
276
+
277
+ if ( strpos( $str, '%_date_%' ) !== false ) {
278
+
279
+ $date_str = '';
280
+ $year = get_query_var( 'year' );
281
+ $month = '';
282
+ $monthnum = get_query_var( 'monthnum' );
283
+ $day = get_query_var( 'day' );
284
+
285
+ if ( $monthnum ) {
286
+ global $wp_locale;
287
+ $month = $wp_locale->get_month( $monthnum );
288
+ }
289
+
290
+ if ( is_day() ) {
291
+ $date_str = sprintf( _x( '%2$s %3$s, %1$s', 'date', 'loos-ssp' ), $year, $month, $day ); // phpcs:ignore
292
+ } elseif ( is_month() ) {
293
+ $date_str = sprintf( _x( '%2$s %1$s', 'date', 'loos-ssp' ), $year, $month ); // phpcs:ignore
294
+ } elseif ( is_year() ) {
295
+ $date_str = sprintf( _x( '%s', 'date', 'loos-ssp' ), $year ); // phpcs:ignore
296
+ }
297
+
298
+ $str = str_replace( '%_date_%', $date_str, $str );
299
+
300
+ }
301
+
302
+ if ( false !== strpos( $str, '%_author_name_%' ) ) {
303
+
304
+ $str = str_replace( '%_author_name_%', get_user_meta( $obj->ID, 'nickname', true ), $str );
305
+
306
+ }
307
+
308
+ if ( false !== strpos( $str, '%_search_phrase_%' ) ) {
309
+
310
+ $str = str_replace( '%_search_phrase_%', get_search_query(), $str );
311
+
312
+ }
313
+ }
314
+
315
+ if ( false !== strpos( $str, '%_sep_%' ) ) {
316
+
317
+ $sep_key = \SSP_Data::$settings['separator'];
318
+ $sep_val = \SSP_Data::SEPARATORS[ $sep_key ];
319
+ $str = str_replace( '%_sep_%', $sep_val, $str );
320
+
321
+ }
322
+
323
+ return $str;
324
+ }
325
+
326
+ }
class/utility.php ADDED
@@ -0,0 +1,94 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ // phpcs:disable WordPress.Security.EscapeOutput.OutputNotEscaped
3
+
4
+ class SSP_Utility {
5
+
6
+ /**
7
+ * 外部からのインスタンス化を防ぐ
8
+ */
9
+ private function __construct() {}
10
+
11
+
12
+ /**
13
+ * データを無害化して返す
14
+ */
15
+ public static function sanitize_post_data( $data ) {
16
+
17
+ foreach ( $data as $key => $val ) {
18
+
19
+ if ( '' === $val ) {
20
+ continue;
21
+ }
22
+
23
+ // "1" , "0" => bool
24
+ $bool_val = filter_var( $val, FILTER_VALIDATE_BOOLEAN, FILTER_NULL_ON_FAILURE );
25
+
26
+ if ( null === $bool_val ) {
27
+
28
+ $val = sanitize_text_field( $val );
29
+ $val = stripslashes( $val );
30
+ $data[ $key ] = $val;
31
+
32
+ } else {
33
+
34
+ $data[ $key ] = $bool_val;
35
+
36
+ }
37
+ }
38
+
39
+ return $data;
40
+ }
41
+
42
+
43
+ /**
44
+ * 設定更新時のDB更新処理
45
+ *
46
+ * @param array $P サニタイズ後の $_POST
47
+ */
48
+ public static function update_db( $P ) {
49
+
50
+ if ( empty( $P ) ) {
51
+ exit( 'POST data was not found' );
52
+ }
53
+
54
+ // nonceキー存在チェック
55
+ if ( ! isset( $P[ SSP_Data::NONCE_NAME ] ) ) return;
56
+
57
+ // nonceの検証
58
+ if ( ! wp_verify_nonce( $P[ SSP_Data::NONCE_NAME ], SSP_Data::NONCE_ACTION ) ) return;
59
+
60
+ // nonceチェック、こっちでも。
61
+ // check_admin_referer( SSP_Data::NONCE_ACTION, SSP_Data::NONCE_NAME );
62
+
63
+ // Get DB name.
64
+ $db_name = isset( $P['db_name'] ) ? $P['db_name'] : '';
65
+
66
+ // 設定可能なデータのリストを取得
67
+ if ( SSP_Data::DB_NAME['settings'] === $db_name ) {
68
+
69
+ $db_data_key = array_keys( SSP_Data::$settings );
70
+
71
+ } elseif ( SSP_Data::DB_NAME['ogp'] === $db_name ) {
72
+
73
+ $db_data_key = array_keys( SSP_Data::$ogp );
74
+
75
+ } else {
76
+
77
+ return;
78
+ }
79
+
80
+ // 保存したいデータだけを抽出 (送信ボタンのデータなど、不要なものを削除)
81
+ foreach ( $P as $key => $v ) {
82
+
83
+ if ( ! in_array( $key, $db_data_key, true ) ) {
84
+
85
+ unset( $P[ $key ] );
86
+
87
+ }
88
+ }
89
+
90
+ // Update
91
+ update_option( $db_name, $P );
92
+ }
93
+
94
+ }
composer.json ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "name": "loos/ssp",
3
+ "description": "",
4
+ "type": "wordpress-plugin",
5
+ "license": "GPL-2.0-or-later",
6
+ "authors": [
7
+ {
8
+ "name": "Ryo Yamasaki",
9
+ "homepage": "https://arkhe-theme.com/"
10
+ }
11
+ ],
12
+ "require-dev": {
13
+ "squizlabs/php_codesniffer": "^3.5",
14
+ "wp-coding-standards/wpcs": "^2.3",
15
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.6",
16
+ "phpcompatibility/phpcompatibility-wp": "*"
17
+ },
18
+ "scripts": {
19
+ "set-wpcs": [
20
+ "./vendor/bin/phpcs --config-set installed_paths `pwd -P`/vendor/phpcompatibility/php-compatibility,`pwd -P`/vendor/phpcompatibility/phpcompatibility-paragonie,`pwd -P`/vendor/phpcompatibility/phpcompatibility-wp,`pwd -P`/vendor/wp-coding-standards/wpcs"
21
+ ]
22
+ }
23
+ }
composer.lock ADDED
@@ -0,0 +1,342 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "_readme": [
3
+ "This file locks the dependencies of your project to a known state",
4
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
5
+ "This file is @generated automatically"
6
+ ],
7
+ "content-hash": "ada18c7d238584da6fe171ae14d46f80",
8
+ "packages": [],
9
+ "packages-dev": [
10
+ {
11
+ "name": "dealerdirect/phpcodesniffer-composer-installer",
12
+ "version": "v0.6.2",
13
+ "source": {
14
+ "type": "git",
15
+ "url": "https://github.com/Dealerdirect/phpcodesniffer-composer-installer.git",
16
+ "reference": "8001af8eb107fbfcedc31a8b51e20b07d85b457a"
17
+ },
18
+ "dist": {
19
+ "type": "zip",
20
+ "url": "https://api.github.com/repos/Dealerdirect/phpcodesniffer-composer-installer/zipball/8001af8eb107fbfcedc31a8b51e20b07d85b457a",
21
+ "reference": "8001af8eb107fbfcedc31a8b51e20b07d85b457a",
22
+ "shasum": ""
23
+ },
24
+ "require": {
25
+ "composer-plugin-api": "^1.0",
26
+ "php": "^5.3|^7",
27
+ "squizlabs/php_codesniffer": "^2|^3"
28
+ },
29
+ "require-dev": {
30
+ "composer/composer": "*",
31
+ "phpcompatibility/php-compatibility": "^9.0",
32
+ "sensiolabs/security-checker": "^4.1.0"
33
+ },
34
+ "type": "composer-plugin",
35
+ "extra": {
36
+ "class": "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\Plugin"
37
+ },
38
+ "autoload": {
39
+ "psr-4": {
40
+ "Dealerdirect\\Composer\\Plugin\\Installers\\PHPCodeSniffer\\": "src/"
41
+ }
42
+ },
43
+ "notification-url": "https://packagist.org/downloads/",
44
+ "license": [
45
+ "MIT"
46
+ ],
47
+ "authors": [
48
+ {
49
+ "name": "Franck Nijhof",
50
+ "email": "franck.nijhof@dealerdirect.com",
51
+ "homepage": "http://www.frenck.nl",
52
+ "role": "Developer / IT Manager"
53
+ }
54
+ ],
55
+ "description": "PHP_CodeSniffer Standards Composer Installer Plugin",
56
+ "homepage": "http://www.dealerdirect.com",
57
+ "keywords": [
58
+ "PHPCodeSniffer",
59
+ "PHP_CodeSniffer",
60
+ "code quality",
61
+ "codesniffer",
62
+ "composer",
63
+ "installer",
64
+ "phpcs",
65
+ "plugin",
66
+ "qa",
67
+ "quality",
68
+ "standard",
69
+ "standards",
70
+ "style guide",
71
+ "stylecheck",
72
+ "tests"
73
+ ],
74
+ "time": "2020-01-29T20:22:20+00:00"
75
+ },
76
+ {
77
+ "name": "phpcompatibility/php-compatibility",
78
+ "version": "9.3.5",
79
+ "source": {
80
+ "type": "git",
81
+ "url": "https://github.com/PHPCompatibility/PHPCompatibility.git",
82
+ "reference": "9fb324479acf6f39452e0655d2429cc0d3914243"
83
+ },
84
+ "dist": {
85
+ "type": "zip",
86
+ "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibility/zipball/9fb324479acf6f39452e0655d2429cc0d3914243",
87
+ "reference": "9fb324479acf6f39452e0655d2429cc0d3914243",
88
+ "shasum": ""
89
+ },
90
+ "require": {
91
+ "php": ">=5.3",
92
+ "squizlabs/php_codesniffer": "^2.3 || ^3.0.2"
93
+ },
94
+ "conflict": {
95
+ "squizlabs/php_codesniffer": "2.6.2"
96
+ },
97
+ "require-dev": {
98
+ "phpunit/phpunit": "~4.5 || ^5.0 || ^6.0 || ^7.0"
99
+ },
100
+ "suggest": {
101
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically.",
102
+ "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
103
+ },
104
+ "type": "phpcodesniffer-standard",
105
+ "notification-url": "https://packagist.org/downloads/",
106
+ "license": [
107
+ "LGPL-3.0-or-later"
108
+ ],
109
+ "authors": [
110
+ {
111
+ "name": "Wim Godden",
112
+ "homepage": "https://github.com/wimg",
113
+ "role": "lead"
114
+ },
115
+ {
116
+ "name": "Juliette Reinders Folmer",
117
+ "homepage": "https://github.com/jrfnl",
118
+ "role": "lead"
119
+ },
120
+ {
121
+ "name": "Contributors",
122
+ "homepage": "https://github.com/PHPCompatibility/PHPCompatibility/graphs/contributors"
123
+ }
124
+ ],
125
+ "description": "A set of sniffs for PHP_CodeSniffer that checks for PHP cross-version compatibility.",
126
+ "homepage": "http://techblog.wimgodden.be/tag/codesniffer/",
127
+ "keywords": [
128
+ "compatibility",
129
+ "phpcs",
130
+ "standards"
131
+ ],
132
+ "time": "2019-12-27T09:44:58+00:00"
133
+ },
134
+ {
135
+ "name": "phpcompatibility/phpcompatibility-paragonie",
136
+ "version": "1.3.0",
137
+ "source": {
138
+ "type": "git",
139
+ "url": "https://github.com/PHPCompatibility/PHPCompatibilityParagonie.git",
140
+ "reference": "b862bc32f7e860d0b164b199bd995e690b4b191c"
141
+ },
142
+ "dist": {
143
+ "type": "zip",
144
+ "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityParagonie/zipball/b862bc32f7e860d0b164b199bd995e690b4b191c",
145
+ "reference": "b862bc32f7e860d0b164b199bd995e690b4b191c",
146
+ "shasum": ""
147
+ },
148
+ "require": {
149
+ "phpcompatibility/php-compatibility": "^9.0"
150
+ },
151
+ "require-dev": {
152
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.5",
153
+ "paragonie/random_compat": "dev-master",
154
+ "paragonie/sodium_compat": "dev-master"
155
+ },
156
+ "suggest": {
157
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.",
158
+ "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
159
+ },
160
+ "type": "phpcodesniffer-standard",
161
+ "notification-url": "https://packagist.org/downloads/",
162
+ "license": [
163
+ "LGPL-3.0-or-later"
164
+ ],
165
+ "authors": [
166
+ {
167
+ "name": "Wim Godden",
168
+ "role": "lead"
169
+ },
170
+ {
171
+ "name": "Juliette Reinders Folmer",
172
+ "role": "lead"
173
+ }
174
+ ],
175
+ "description": "A set of rulesets for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by the Paragonie polyfill libraries.",
176
+ "homepage": "http://phpcompatibility.com/",
177
+ "keywords": [
178
+ "compatibility",
179
+ "paragonie",
180
+ "phpcs",
181
+ "polyfill",
182
+ "standards"
183
+ ],
184
+ "time": "2019-11-04T15:17:54+00:00"
185
+ },
186
+ {
187
+ "name": "phpcompatibility/phpcompatibility-wp",
188
+ "version": "2.1.0",
189
+ "source": {
190
+ "type": "git",
191
+ "url": "https://github.com/PHPCompatibility/PHPCompatibilityWP.git",
192
+ "reference": "41bef18ba688af638b7310666db28e1ea9158b2f"
193
+ },
194
+ "dist": {
195
+ "type": "zip",
196
+ "url": "https://api.github.com/repos/PHPCompatibility/PHPCompatibilityWP/zipball/41bef18ba688af638b7310666db28e1ea9158b2f",
197
+ "reference": "41bef18ba688af638b7310666db28e1ea9158b2f",
198
+ "shasum": ""
199
+ },
200
+ "require": {
201
+ "phpcompatibility/php-compatibility": "^9.0",
202
+ "phpcompatibility/phpcompatibility-paragonie": "^1.0"
203
+ },
204
+ "require-dev": {
205
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.5"
206
+ },
207
+ "suggest": {
208
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || This Composer plugin will sort out the PHP_CodeSniffer 'installed_paths' automatically.",
209
+ "roave/security-advisories": "dev-master || Helps prevent installing dependencies with known security issues."
210
+ },
211
+ "type": "phpcodesniffer-standard",
212
+ "notification-url": "https://packagist.org/downloads/",
213
+ "license": [
214
+ "LGPL-3.0-or-later"
215
+ ],
216
+ "authors": [
217
+ {
218
+ "name": "Wim Godden",
219
+ "role": "lead"
220
+ },
221
+ {
222
+ "name": "Juliette Reinders Folmer",
223
+ "role": "lead"
224
+ }
225
+ ],
226
+ "description": "A ruleset for PHP_CodeSniffer to check for PHP cross-version compatibility issues in projects, while accounting for polyfills provided by WordPress.",
227
+ "homepage": "http://phpcompatibility.com/",
228
+ "keywords": [
229
+ "compatibility",
230
+ "phpcs",
231
+ "standards",
232
+ "wordpress"
233
+ ],
234
+ "time": "2019-08-28T14:22:28+00:00"
235
+ },
236
+ {
237
+ "name": "squizlabs/php_codesniffer",
238
+ "version": "3.5.8",
239
+ "source": {
240
+ "type": "git",
241
+ "url": "https://github.com/squizlabs/PHP_CodeSniffer.git",
242
+ "reference": "9d583721a7157ee997f235f327de038e7ea6dac4"
243
+ },
244
+ "dist": {
245
+ "type": "zip",
246
+ "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/9d583721a7157ee997f235f327de038e7ea6dac4",
247
+ "reference": "9d583721a7157ee997f235f327de038e7ea6dac4",
248
+ "shasum": ""
249
+ },
250
+ "require": {
251
+ "ext-simplexml": "*",
252
+ "ext-tokenizer": "*",
253
+ "ext-xmlwriter": "*",
254
+ "php": ">=5.4.0"
255
+ },
256
+ "require-dev": {
257
+ "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
258
+ },
259
+ "bin": [
260
+ "bin/phpcs",
261
+ "bin/phpcbf"
262
+ ],
263
+ "type": "library",
264
+ "extra": {
265
+ "branch-alias": {
266
+ "dev-master": "3.x-dev"
267
+ }
268
+ },
269
+ "notification-url": "https://packagist.org/downloads/",
270
+ "license": [
271
+ "BSD-3-Clause"
272
+ ],
273
+ "authors": [
274
+ {
275
+ "name": "Greg Sherwood",
276
+ "role": "lead"
277
+ }
278
+ ],
279
+ "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.",
280
+ "homepage": "https://github.com/squizlabs/PHP_CodeSniffer",
281
+ "keywords": [
282
+ "phpcs",
283
+ "standards"
284
+ ],
285
+ "time": "2020-10-23T02:01:07+00:00"
286
+ },
287
+ {
288
+ "name": "wp-coding-standards/wpcs",
289
+ "version": "2.3.0",
290
+ "source": {
291
+ "type": "git",
292
+ "url": "https://github.com/WordPress/WordPress-Coding-Standards.git",
293
+ "reference": "7da1894633f168fe244afc6de00d141f27517b62"
294
+ },
295
+ "dist": {
296
+ "type": "zip",
297
+ "url": "https://api.github.com/repos/WordPress/WordPress-Coding-Standards/zipball/7da1894633f168fe244afc6de00d141f27517b62",
298
+ "reference": "7da1894633f168fe244afc6de00d141f27517b62",
299
+ "shasum": ""
300
+ },
301
+ "require": {
302
+ "php": ">=5.4",
303
+ "squizlabs/php_codesniffer": "^3.3.1"
304
+ },
305
+ "require-dev": {
306
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.5 || ^0.6",
307
+ "phpcompatibility/php-compatibility": "^9.0",
308
+ "phpcsstandards/phpcsdevtools": "^1.0",
309
+ "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0"
310
+ },
311
+ "suggest": {
312
+ "dealerdirect/phpcodesniffer-composer-installer": "^0.6 || This Composer plugin will sort out the PHPCS 'installed_paths' automatically."
313
+ },
314
+ "type": "phpcodesniffer-standard",
315
+ "notification-url": "https://packagist.org/downloads/",
316
+ "license": [
317
+ "MIT"
318
+ ],
319
+ "authors": [
320
+ {
321
+ "name": "Contributors",
322
+ "homepage": "https://github.com/WordPress/WordPress-Coding-Standards/graphs/contributors"
323
+ }
324
+ ],
325
+ "description": "PHP_CodeSniffer rules (sniffs) to enforce WordPress coding conventions",
326
+ "keywords": [
327
+ "phpcs",
328
+ "standards",
329
+ "wordpress"
330
+ ],
331
+ "time": "2020-05-13T23:57:56+00:00"
332
+ }
333
+ ],
334
+ "aliases": [],
335
+ "minimum-stability": "stable",
336
+ "stability-flags": [],
337
+ "prefer-stable": false,
338
+ "prefer-lowest": false,
339
+ "platform": [],
340
+ "platform-dev": [],
341
+ "plugin-api-version": "1.1.0"
342
+ }
dist/css/common.css ADDED
@@ -0,0 +1 @@
 
1
+ .ssp-media .ssp-media__preview{width:100%;max-width:480px;margin-bottom:24px;padding:16px;border:1px dashed #ccc}.ssp-media .ssp-media__preview img{display:block;width:100%;max-width:100%;height:auto}.ssp-media .ssp-media__null{display:none;width:100%;max-width:480px;margin-bottom:24px;padding:16px;border:1px dashed #ccc}.ssp-media .ssp-media__preview:empty{display:none}.ssp-media .ssp-media__preview:empty+.ssp-media__null{display:block}.ssp-media .ssp-media__btns{display:flex;align-items:center;margin-right:24px}.ssp-media .ssp-media__btns .button-primary{margin-right:8px}.ssp-notice{position:relative;border-left-color:#b3c973}.ssp-notice .ssp-notice__closeBtn{cursor:pointer}.ssp-notice .ssp-notice__closeBtn:before{display:inline-block;vertical-align:middle}.ssp-notice .ssp-notice__closeBtn span{vertical-align:middle}.ssp-notice__closeBtn:active,.ssp-notice__closeBtn:focus,.ssp-notice__closeBtn:hover{box-shadow:0 0 4px #ccc}.ssp-notice__closeBtn:active:before,.ssp-notice__closeBtn:focus:before,.ssp-notice__closeBtn:hover:before{color:#c00}
dist/css/post.css ADDED
@@ -0,0 +1 @@
 
1
+ .ssp-field+.ssp-field{margin-top:40px}.ssp-field[data-disable="1"]~.ssp-field{display:none}.ssp-field[data-active="0"]~.ssp-field{opacity:.5;pointer-events:none}.ssp-field input[type=text],.ssp-field textarea{width:100%;padding:4px 8px}.ssp-field .hide{display:none}.ssp-field code{margin:0;padding:2px 6px;font-size:inherit;font-style:normal;background:#eee}.ssp-field__body{padding:0 8px}.ssp-field__title{display:block;margin-bottom:16px;padding-left:8px;font-weight:700;font-size:14px;border-left:2px solid #87ab87}.ssp-field__desc{color:#666;font-size:13px;font-style:italic}.ssp-field__item.-radio_btn{display:flex;flex-wrap:wrap}.ssp-field__item.-radio_btn .ssp-field__radioInput{display:none}.ssp-field__item.-radio_btn .ssp-field__radioLabel{width:40px;height:40px;margin:4px;padding:0;line-height:34px;text-align:center;vertical-align:middle;background:#fcfcfc;border:1px solid #ccc;box-shadow:inset 0 0 2px #fff}.ssp-field__item.-radio_btn :checked+.ssp-field__radioLabel{border:2px solid #eba170}.ssp_metabox{padding:16px}@media screen and (max-width:767px){.ssp-field__body{padding:0}}
dist/css/ssp.css ADDED
@@ -0,0 +1 @@
 
1
+ .ssp-field+.ssp-field{margin-top:40px}.ssp-field[data-disable="1"]~.ssp-field{display:none}.ssp-field[data-active="0"]~.ssp-field{opacity:.5;pointer-events:none}.ssp-field input[type=text],.ssp-field textarea{width:100%;padding:4px 8px}.ssp-field .hide{display:none}.ssp-field code{margin:0;padding:2px 6px;font-size:inherit;font-style:normal;background:#eee}.ssp-field__body{padding:0 8px}.ssp-field__title{display:block;margin-bottom:16px;padding-left:8px;font-weight:700;font-size:14px;border-left:2px solid #87ab87}.ssp-field__desc{color:#666;font-size:13px;font-style:italic}.ssp-field__item.-radio_btn{display:flex;flex-wrap:wrap}.ssp-field__item.-radio_btn .ssp-field__radioInput{display:none}.ssp-field__item.-radio_btn .ssp-field__radioLabel{width:40px;height:40px;margin:4px;padding:0;line-height:34px;text-align:center;vertical-align:middle;background:#fcfcfc;border:1px solid #ccc;box-shadow:inset 0 0 2px #fff}.ssp-field__item.-radio_btn :checked+.ssp-field__radioLabel{border:2px solid #eba170}.ssp-helpButton{display:inline-block;width:24px;height:24px;margin-left:16px;padding:0;color:#fff!important;font-weight:700;font-size:12px;line-height:24px;text-align:center;text-decoration:none;vertical-align:middle;background:#556158;border-radius:50%;box-shadow:inset 0 0 4px hsla(0,0%,78.4%,.5);transition:transform .25s}.ssp-helpButton:hover{transform:scale(1.1)}.ssp-helpTable{width:100%;max-width:560px;margin:0 0 24px}.ssp-helpTable thead{background:#e3e4e3}.ssp-helpTable td,.ssp-helpTable th{padding:6px 8px;text-align:left}.ssp-field__preview{display:flex;flex-wrap:wrap;align-items:center;width:100%;padding:4px}.ssp-field__preview__label{margin-right:8px}.ssp-field__preview__content{display:inline-block;margin:0;padding:8px 12px;background:#ececec;border-radius:2px;box-shadow:inset 0 0 4px #ddd}.ssp-field__preview__content span{margin:0 2px;padding:4px 8px;color:#fff;font-size:13px;background:#87ab87;border-radius:4px}.ssp-page .nav-tab-wrapper{border-bottom:1px solid #ddd}.ssp-page .nav-tab{background:rgba(0,0,0,.05);border:none;border-radius:2px 2px 0 0;cursor:pointer}.ssp-page .nav-tab.act_,.ssp-page .nav-tab:hover{color:#000;background:#fdfdfd}.ssp-page .tab-contents{display:none;padding:16px}.ssp-page .tab-contents.act_{display:block}.ssp_switch_box{position:relative;display:inline-block;width:64px;height:28px;margin:0 8px}.ssp_switch_box input{display:none}.ssp_switch_box__slider{position:absolute;top:0;right:0;bottom:0;left:0;background-color:#ccc;cursor:pointer;transition:.4s}.ssp_switch_box__slider:before{position:absolute;right:4px;bottom:4px;width:20px;height:20px;background-color:#fff;transition:.4s;content:""}input:checked+.ssp_switch_box__slider{background-color:#2196f3}input:checked+.ssp_switch_box__slider:before{right:40px}.ssp_switch_box__slider.-round{border-radius:34px}.ssp_switch_box__slider.-round:before{border-radius:50%}.ssp-page{margin:0 20px 20px 0;padding:8px}.ssp-page,.ssp-page *{box-sizing:border-box}.ssp-page .ssp-page__savedMessage{margin:24px 0}h1.ssp-page__title{line-height:1.5}.ssp-page__section+.ssp-page__section{margin-top:48px}.ssp-page__section__title{position:relative;padding:8px 0 8px 16px;line-height:1.5;letter-spacing:.5px}.ssp-page__section__title:before{position:absolute;top:50%;left:0;z-index:-1;display:block;width:40px;height:40px;background-image:linear-gradient(-45deg,transparent 25%,#87ab87 0,#87ab87 50%,transparent 0,transparent 75%,#87ab87 0,#87ab87);background-size:6px 6px;border-radius:50%;transform:translateY(-50%);opacity:.4;content:""}.ssp-page__section__body{padding:24px;background:#fff;border-radius:3px;box-shadow:0 2px 4px rgba(0,0,0,.05),0 4px 4px -4px rgba(0,0,0,.1)}.ssp-page__note{padding-left:4px;font-style:italic}textarea[name=home_desc]{max-width:1000px;height:12em}[name=home_keyword]{max-width:1000px}.-webmaster input{max-width:800px}.-webmaster code b{margin:0 2px;padding:2px 4px;color:#fff;font-weight:400;font-size:.9em;background:#87ab87;border-radius:4px}@media screen and (min-width:768px){.ssp-page .ssp-field__body{display:flex;flex-wrap:wrap;justify-content:space-between}.ssp-page .ssp-field__item{width:40%}.ssp-page .ssp-field__desc{width:57%}.ssp-page .ssp-field__body.-wide .ssp-field__desc,.ssp-page .ssp-field__body.-wide .ssp-field__item{width:100%}}@media screen and (max-width:767px){.ssp-field__body{padding:0}}
dist/css/term.css ADDED
@@ -0,0 +1 @@
 
1
+ .form-table .ssp_term_meta_title td{padding-left:0}.ssp_term_meta_title h2{position:relative;padding:8px 0 8px 16px;line-height:1.5}.ssp_term_meta_title h2:before{position:absolute;top:50%;left:0;z-index:-1;display:block;width:40px;height:40px;background-image:linear-gradient(-45deg,transparent 25%,#87ab87 0,#87ab87 50%,transparent 0,transparent 75%,#87ab87 0,#87ab87);background-size:6px 6px;border-radius:50%;transform:translateY(-50%);opacity:.4;content:""}
dist/js/common.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(){var t={6077:function(t,n,r){var e=r(111);t.exports=function(t){if(!e(t)&&null!==t)throw TypeError("Can't set "+String(t)+" as a prototype");return t}},9670:function(t,n,r){var e=r(111);t.exports=function(t){if(!e(t))throw TypeError(String(t)+" is not an object");return t}},1318:function(t,n,r){var e=r(5656),o=r(7466),i=r(1400),u=function(t){return function(n,r,u){var c,f=e(n),a=o(f.length),s=i(u,a);if(t&&r!=r){for(;a>s;)if((c=f[s++])!=c)return!0}else for(;a>s;s++)if((t||s in f)&&f[s]===r)return t||s||0;return!t&&-1}};t.exports={includes:u(!0),indexOf:u(!1)}},4326:function(t){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},8880:function(t,n,r){var e=r(9781),o=r(3070),i=r(9114);t.exports=e?function(t,n,r){return o.f(t,n,i(1,r))}:function(t,n,r){return t[n]=r,t}},9114:function(t){t.exports=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}}},9781:function(t,n,r){var e=r(7293);t.exports=!e((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},317:function(t,n,r){var e=r(7854),o=r(111),i=e.document,u=o(i)&&o(i.createElement);t.exports=function(t){return u?i.createElement(t):{}}},748:function(t){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},7293:function(t){t.exports=function(t){try{return!!t()}catch(t){return!0}}},5005:function(t,n,r){var e=r(857),o=r(7854),i=function(t){return"function"==typeof t?t:void 0};t.exports=function(t,n){return arguments.length<2?i(e[t])||i(o[t]):e[t]&&e[t][n]||o[t]&&o[t][n]}},7854:function(t,n,r){var e=function(t){return t&&t.Math==Math&&t};t.exports=e("object"==typeof globalThis&&globalThis)||e("object"==typeof window&&window)||e("object"==typeof self&&self)||e("object"==typeof r.g&&r.g)||function(){return this}()||Function("return this")()},6656:function(t){var n={}.hasOwnProperty;t.exports=function(t,r){return n.call(t,r)}},3501:function(t){t.exports={}},490:function(t,n,r){var e=r(5005);t.exports=e("document","documentElement")},4664:function(t,n,r){var e=r(9781),o=r(7293),i=r(317);t.exports=!e&&!o((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},8361:function(t,n,r){var e=r(7293),o=r(4326),i="".split;t.exports=e((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==o(t)?i.call(t,""):Object(t)}:Object},9587:function(t,n,r){var e=r(111),o=r(7674);t.exports=function(t,n,r){var i,u;return o&&"function"==typeof(i=n.constructor)&&i!==r&&e(u=i.prototype)&&u!==r.prototype&&o(t,u),t}},2788:function(t,n,r){var e=r(5465),o=Function.toString;"function"!=typeof e.inspectSource&&(e.inspectSource=function(t){return o.call(t)}),t.exports=e.inspectSource},9909:function(t,n,r){var e,o,i,u=r(8536),c=r(7854),f=r(111),a=r(8880),s=r(6656),p=r(5465),l=r(6200),v=r(3501),y=c.WeakMap;if(u){var h=p.state||(p.state=new y),d=h.get,g=h.has,b=h.set;e=function(t,n){return n.facade=t,b.call(h,t,n),n},o=function(t){return d.call(h,t)||{}},i=function(t){return g.call(h,t)}}else{var x=l("state");v[x]=!0,e=function(t,n){return n.facade=t,a(t,x,n),n},o=function(t){return s(t,x)?t[x]:{}},i=function(t){return s(t,x)}}t.exports={set:e,get:o,has:i,enforce:function(t){return i(t)?o(t):e(t,{})},getterFor:function(t){return function(n){var r;if(!f(n)||(r=o(n)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return r}}}},4705:function(t,n,r){var e=r(7293),o=/#|\.prototype\./,i=function(t,n){var r=c[u(t)];return r==a||r!=f&&("function"==typeof n?e(n):!!n)},u=i.normalize=function(t){return String(t).replace(o,".").toLowerCase()},c=i.data={},f=i.NATIVE="N",a=i.POLYFILL="P";t.exports=i},111:function(t){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},1913:function(t){t.exports=!1},8536:function(t,n,r){var e=r(7854),o=r(2788),i=e.WeakMap;t.exports="function"==typeof i&&/native code/.test(o(i))},30:function(t,n,r){var e,o=r(9670),i=r(6048),u=r(748),c=r(3501),f=r(490),a=r(317),s=r(6200)("IE_PROTO"),p=function(){},l=function(t){return"<script>"+t+"<\/script>"},v=function(){try{e=document.domain&&new ActiveXObject("htmlfile")}catch(t){}var t,n;v=e?function(t){t.write(l("")),t.close();var n=t.parentWindow.Object;return t=null,n}(e):((n=a("iframe")).style.display="none",f.appendChild(n),n.src=String("javascript:"),(t=n.contentWindow.document).open(),t.write(l("document.F=Object")),t.close(),t.F);for(var r=u.length;r--;)delete v.prototype[u[r]];return v()};c[s]=!0,t.exports=Object.create||function(t,n){var r;return null!==t?(p.prototype=o(t),r=new p,p.prototype=null,r[s]=t):r=v(),void 0===n?r:i(r,n)}},6048:function(t,n,r){var e=r(9781),o=r(3070),i=r(9670),u=r(1956);t.exports=e?Object.defineProperties:function(t,n){i(t);for(var r,e=u(n),c=e.length,f=0;c>f;)o.f(t,r=e[f++],n[r]);return t}},3070:function(t,n,r){var e=r(9781),o=r(4664),i=r(9670),u=r(7593),c=Object.defineProperty;n.f=e?c:function(t,n,r){if(i(t),n=u(n,!0),i(r),o)try{return c(t,n,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported");return"value"in r&&(t[n]=r.value),t}},1236:function(t,n,r){var e=r(9781),o=r(5296),i=r(9114),u=r(5656),c=r(7593),f=r(6656),a=r(4664),s=Object.getOwnPropertyDescriptor;n.f=e?s:function(t,n){if(t=u(t),n=c(n,!0),a)try{return s(t,n)}catch(t){}if(f(t,n))return i(!o.f.call(t,n),t[n])}},8006:function(t,n,r){var e=r(6324),o=r(748).concat("length","prototype");n.f=Object.getOwnPropertyNames||function(t){return e(t,o)}},6324:function(t,n,r){var e=r(6656),o=r(5656),i=r(1318).indexOf,u=r(3501);t.exports=function(t,n){var r,c=o(t),f=0,a=[];for(r in c)!e(u,r)&&e(c,r)&&a.push(r);for(;n.length>f;)e(c,r=n[f++])&&(~i(a,r)||a.push(r));return a}},1956:function(t,n,r){var e=r(6324),o=r(748);t.exports=Object.keys||function(t){return e(t,o)}},5296:function(t,n){"use strict";var r={}.propertyIsEnumerable,e=Object.getOwnPropertyDescriptor,o=e&&!r.call({1:2},1);n.f=o?function(t){var n=e(this,t);return!!n&&n.enumerable}:r},7674:function(t,n,r){var e=r(9670),o=r(6077);t.exports=Object.setPrototypeOf||("__proto__"in{}?function(){var t,n=!1,r={};try{(t=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set).call(r,[]),n=r instanceof Array}catch(t){}return function(r,i){return e(r),o(i),n?t.call(r,i):r.__proto__=i,r}}():void 0)},857:function(t,n,r){var e=r(7854);t.exports=e},1320:function(t,n,r){var e=r(7854),o=r(8880),i=r(6656),u=r(3505),c=r(2788),f=r(9909),a=f.get,s=f.enforce,p=String(String).split("String");(t.exports=function(t,n,r,c){var f,a=!!c&&!!c.unsafe,l=!!c&&!!c.enumerable,v=!!c&&!!c.noTargetGet;"function"==typeof r&&("string"!=typeof n||i(r,"name")||o(r,"name",n),(f=s(r)).source||(f.source=p.join("string"==typeof n?n:""))),t!==e?(a?!v&&t[n]&&(l=!0):delete t[n],l?t[n]=r:o(t,n,r)):l?t[n]=r:u(n,r)})(Function.prototype,"toString",(function(){return"function"==typeof this&&a(this).source||c(this)}))},4488:function(t){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},3505:function(t,n,r){var e=r(7854),o=r(8880);t.exports=function(t,n){try{o(e,t,n)}catch(r){e[t]=n}return n}},6200:function(t,n,r){var e=r(2309),o=r(9711),i=e("keys");t.exports=function(t){return i[t]||(i[t]=o(t))}},5465:function(t,n,r){var e=r(7854),o=r(3505),i="__core-js_shared__",u=e[i]||o(i,{});t.exports=u},2309:function(t,n,r){var e=r(1913),o=r(5465);(t.exports=function(t,n){return o[t]||(o[t]=void 0!==n?n:{})})("versions",[]).push({version:"3.8.1",mode:e?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},3111:function(t,n,r){var e=r(4488),o="["+r(1361)+"]",i=RegExp("^"+o+o+"*"),u=RegExp(o+o+"*$"),c=function(t){return function(n){var r=String(e(n));return 1&t&&(r=r.replace(i,"")),2&t&&(r=r.replace(u,"")),r}};t.exports={start:c(1),end:c(2),trim:c(3)}},1400:function(t,n,r){var e=r(9958),o=Math.max,i=Math.min;t.exports=function(t,n){var r=e(t);return r<0?o(r+n,0):i(r,n)}},5656:function(t,n,r){var e=r(8361),o=r(4488);t.exports=function(t){return e(o(t))}},9958:function(t){var n=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:n)(t)}},7466:function(t,n,r){var e=r(9958),o=Math.min;t.exports=function(t){return t>0?o(e(t),9007199254740991):0}},7593:function(t,n,r){var e=r(111);t.exports=function(t,n){if(!e(t))return t;var r,o;if(n&&"function"==typeof(r=t.toString)&&!e(o=r.call(t)))return o;if("function"==typeof(r=t.valueOf)&&!e(o=r.call(t)))return o;if(!n&&"function"==typeof(r=t.toString)&&!e(o=r.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},9711:function(t){var n=0,r=Math.random();t.exports=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++n+r).toString(36)}},1361:function(t){t.exports="\t\n\v\f\r                 \u2028\u2029\ufeff"},9653:function(t,n,r){"use strict";var e=r(9781),o=r(7854),i=r(4705),u=r(1320),c=r(6656),f=r(4326),a=r(9587),s=r(7593),p=r(7293),l=r(30),v=r(8006).f,y=r(1236).f,h=r(3070).f,d=r(3111).trim,g="Number",b=o.Number,x=b.prototype,m=f(l(x))==g,O=function(t){var n,r,e,o,i,u,c,f,a=s(t,!1);if("string"==typeof a&&a.length>2)if(43===(n=(a=d(a)).charCodeAt(0))||45===n){if(88===(r=a.charCodeAt(2))||120===r)return NaN}else if(48===n){switch(a.charCodeAt(1)){case 66:case 98:e=2,o=49;break;case 79:case 111:e=8,o=55;break;default:return+a}for(u=(i=a.slice(2)).length,c=0;c<u;c++)if((f=i.charCodeAt(c))<48||f>o)return NaN;return parseInt(i,e)}return+a};if(i(g,!b(" 0o1")||!b("0b1")||b("+0x1"))){for(var w,j=function(t){var n=arguments.length<1?0:t,r=this;return r instanceof j&&(m?p((function(){x.valueOf.call(r)})):f(r)!=g)?a(new b(O(n)),r,j):O(n)},_=e?v(b):"MAX_VALUE,MIN_VALUE,NaN,NEGATIVE_INFINITY,POSITIVE_INFINITY,EPSILON,isFinite,isInteger,isNaN,isSafeInteger,MAX_SAFE_INTEGER,MIN_SAFE_INTEGER,parseFloat,parseInt,isInteger,fromString,range".split(","),E=0;_.length>E;E++)c(b,w=_[E])&&!c(j,w)&&h(j,w,y(b,w));j.prototype=x,x.constructor=j,u(o,g,j)}}},n={};function r(e){if(n[e])return n[e].exports;var o=n[e]={exports:{}};return t[e](o,o.exports,r),o.exports}r.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(n,{a:n}),n},r.d=function(t,n){for(var e in n)r.o(n,e)&&!r.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:n[e]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},function(){"use strict";var t;r(9653),(t=window.jQuery)(".ssp_switch_box").click((function(n){var r=t(this).attr("for"),e=t(this).closest(".ssp-field");setTimeout((function(){var n=t("#"+r).prop("checked");t('input[name="'+r+'"]').val(Number(n)),void 0!==e.attr("data-disable")?e.attr("data-disable",Number(n)):void 0!==p.attr("data-active")&&e.attr("data-active",Number(n))}),10)}))}()}();
dist/js/mediauploader.js ADDED
@@ -0,0 +1 @@
 
1
+ !function(){var t={9670:function(t,n,r){var e=r(111);t.exports=function(t){if(!e(t))throw TypeError(String(t)+" is not an object");return t}},1318:function(t,n,r){var e=r(5656),o=r(7466),i=r(1400),u=function(t){return function(n,r,u){var c,f=e(n),a=o(f.length),s=i(u,a);if(t&&r!=r){for(;a>s;)if((c=f[s++])!=c)return!0}else for(;a>s;s++)if((t||s in f)&&f[s]===r)return t||s||0;return!t&&-1}};t.exports={includes:u(!0),indexOf:u(!1)}},4326:function(t){var n={}.toString;t.exports=function(t){return n.call(t).slice(8,-1)}},9920:function(t,n,r){var e=r(6656),o=r(3887),i=r(1236),u=r(3070);t.exports=function(t,n){for(var r=o(n),c=u.f,f=i.f,a=0;a<r.length;a++){var s=r[a];e(t,s)||c(t,s,f(n,s))}}},8880:function(t,n,r){var e=r(9781),o=r(3070),i=r(9114);t.exports=e?function(t,n,r){return o.f(t,n,i(1,r))}:function(t,n,r){return t[n]=r,t}},9114:function(t){t.exports=function(t,n){return{enumerable:!(1&t),configurable:!(2&t),writable:!(4&t),value:n}}},9781:function(t,n,r){var e=r(7293);t.exports=!e((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},317:function(t,n,r){var e=r(7854),o=r(111),i=e.document,u=o(i)&&o(i.createElement);t.exports=function(t){return u?i.createElement(t):{}}},748:function(t){t.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},2109:function(t,n,r){var e=r(7854),o=r(1236).f,i=r(8880),u=r(1320),c=r(3505),f=r(9920),a=r(4705);t.exports=function(t,n){var r,s,p,l,v,y=t.target,g=t.global,h=t.stat;if(r=g?e:h?e[y]||c(y,{}):(e[y]||{}).prototype)for(s in n){if(l=n[s],p=t.noTargetGet?(v=o(r,s))&&v.value:r[s],!a(g?s:y+(h?".":"#")+s,t.forced)&&void 0!==p){if(typeof l==typeof p)continue;f(l,p)}(t.sham||p&&p.sham)&&i(l,"sham",!0),u(r,s,l,t)}}},7293:function(t){t.exports=function(t){try{return!!t()}catch(t){return!0}}},5005:function(t,n,r){var e=r(857),o=r(7854),i=function(t){return"function"==typeof t?t:void 0};t.exports=function(t,n){return arguments.length<2?i(e[t])||i(o[t]):e[t]&&e[t][n]||o[t]&&o[t][n]}},7854:function(t,n,r){var e=function(t){return t&&t.Math==Math&&t};t.exports=e("object"==typeof globalThis&&globalThis)||e("object"==typeof window&&window)||e("object"==typeof self&&self)||e("object"==typeof r.g&&r.g)||function(){return this}()||Function("return this")()},6656:function(t){var n={}.hasOwnProperty;t.exports=function(t,r){return n.call(t,r)}},3501:function(t){t.exports={}},4664:function(t,n,r){var e=r(9781),o=r(7293),i=r(317);t.exports=!e&&!o((function(){return 7!=Object.defineProperty(i("div"),"a",{get:function(){return 7}}).a}))},8361:function(t,n,r){var e=r(7293),o=r(4326),i="".split;t.exports=e((function(){return!Object("z").propertyIsEnumerable(0)}))?function(t){return"String"==o(t)?i.call(t,""):Object(t)}:Object},2788:function(t,n,r){var e=r(5465),o=Function.toString;"function"!=typeof e.inspectSource&&(e.inspectSource=function(t){return o.call(t)}),t.exports=e.inspectSource},9909:function(t,n,r){var e,o,i,u=r(8536),c=r(7854),f=r(111),a=r(8880),s=r(6656),p=r(5465),l=r(6200),v=r(3501),y=c.WeakMap;if(u){var g=p.state||(p.state=new y),h=g.get,d=g.has,x=g.set;e=function(t,n){return n.facade=t,x.call(g,t,n),n},o=function(t){return h.call(g,t)||{}},i=function(t){return d.call(g,t)}}else{var b=l("state");v[b]=!0,e=function(t,n){return n.facade=t,a(t,b,n),n},o=function(t){return s(t,b)?t[b]:{}},i=function(t){return s(t,b)}}t.exports={set:e,get:o,has:i,enforce:function(t){return i(t)?o(t):e(t,{})},getterFor:function(t){return function(n){var r;if(!f(n)||(r=o(n)).type!==t)throw TypeError("Incompatible receiver, "+t+" required");return r}}}},4705:function(t,n,r){var e=r(7293),o=/#|\.prototype\./,i=function(t,n){var r=c[u(t)];return r==a||r!=f&&("function"==typeof n?e(n):!!n)},u=i.normalize=function(t){return String(t).replace(o,".").toLowerCase()},c=i.data={},f=i.NATIVE="N",a=i.POLYFILL="P";t.exports=i},111:function(t){t.exports=function(t){return"object"==typeof t?null!==t:"function"==typeof t}},1913:function(t){t.exports=!1},8536:function(t,n,r){var e=r(7854),o=r(2788),i=e.WeakMap;t.exports="function"==typeof i&&/native code/.test(o(i))},3070:function(t,n,r){var e=r(9781),o=r(4664),i=r(9670),u=r(7593),c=Object.defineProperty;n.f=e?c:function(t,n,r){if(i(t),n=u(n,!0),i(r),o)try{return c(t,n,r)}catch(t){}if("get"in r||"set"in r)throw TypeError("Accessors not supported");return"value"in r&&(t[n]=r.value),t}},1236:function(t,n,r){var e=r(9781),o=r(5296),i=r(9114),u=r(5656),c=r(7593),f=r(6656),a=r(4664),s=Object.getOwnPropertyDescriptor;n.f=e?s:function(t,n){if(t=u(t),n=c(n,!0),a)try{return s(t,n)}catch(t){}if(f(t,n))return i(!o.f.call(t,n),t[n])}},8006:function(t,n,r){var e=r(6324),o=r(748).concat("length","prototype");n.f=Object.getOwnPropertyNames||function(t){return e(t,o)}},5181:function(t,n){n.f=Object.getOwnPropertySymbols},6324:function(t,n,r){var e=r(6656),o=r(5656),i=r(1318).indexOf,u=r(3501);t.exports=function(t,n){var r,c=o(t),f=0,a=[];for(r in c)!e(u,r)&&e(c,r)&&a.push(r);for(;n.length>f;)e(c,r=n[f++])&&(~i(a,r)||a.push(r));return a}},5296:function(t,n){"use strict";var r={}.propertyIsEnumerable,e=Object.getOwnPropertyDescriptor,o=e&&!r.call({1:2},1);n.f=o?function(t){var n=e(this,t);return!!n&&n.enumerable}:r},3887:function(t,n,r){var e=r(5005),o=r(8006),i=r(5181),u=r(9670);t.exports=e("Reflect","ownKeys")||function(t){var n=o.f(u(t)),r=i.f;return r?n.concat(r(t)):n}},857:function(t,n,r){var e=r(7854);t.exports=e},1320:function(t,n,r){var e=r(7854),o=r(8880),i=r(6656),u=r(3505),c=r(2788),f=r(9909),a=f.get,s=f.enforce,p=String(String).split("String");(t.exports=function(t,n,r,c){var f,a=!!c&&!!c.unsafe,l=!!c&&!!c.enumerable,v=!!c&&!!c.noTargetGet;"function"==typeof r&&("string"!=typeof n||i(r,"name")||o(r,"name",n),(f=s(r)).source||(f.source=p.join("string"==typeof n?n:""))),t!==e?(a?!v&&t[n]&&(l=!0):delete t[n],l?t[n]=r:o(t,n,r)):l?t[n]=r:u(n,r)})(Function.prototype,"toString",(function(){return"function"==typeof this&&a(this).source||c(this)}))},4488:function(t){t.exports=function(t){if(null==t)throw TypeError("Can't call method on "+t);return t}},3505:function(t,n,r){var e=r(7854),o=r(8880);t.exports=function(t,n){try{o(e,t,n)}catch(r){e[t]=n}return n}},6200:function(t,n,r){var e=r(2309),o=r(9711),i=e("keys");t.exports=function(t){return i[t]||(i[t]=o(t))}},5465:function(t,n,r){var e=r(7854),o=r(3505),i="__core-js_shared__",u=e[i]||o(i,{});t.exports=u},2309:function(t,n,r){var e=r(1913),o=r(5465);(t.exports=function(t,n){return o[t]||(o[t]=void 0!==n?n:{})})("versions",[]).push({version:"3.8.1",mode:e?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},1400:function(t,n,r){var e=r(9958),o=Math.max,i=Math.min;t.exports=function(t,n){var r=e(t);return r<0?o(r+n,0):i(r,n)}},5656:function(t,n,r){var e=r(8361),o=r(4488);t.exports=function(t){return e(o(t))}},9958:function(t){var n=Math.ceil,r=Math.floor;t.exports=function(t){return isNaN(t=+t)?0:(t>0?r:n)(t)}},7466:function(t,n,r){var e=r(9958),o=Math.min;t.exports=function(t){return t>0?o(e(t),9007199254740991):0}},7593:function(t,n,r){var e=r(111);t.exports=function(t,n){if(!e(t))return t;var r,o;if(n&&"function"==typeof(r=t.toString)&&!e(o=r.call(t)))return o;if("function"==typeof(r=t.valueOf)&&!e(o=r.call(t)))return o;if(!n&&"function"==typeof(r=t.toString)&&!e(o=r.call(t)))return o;throw TypeError("Can't convert object to primitive value")}},9711:function(t){var n=0,r=Math.random();t.exports=function(t){return"Symbol("+String(void 0===t?"":t)+")_"+(++n+r).toString(36)}},3753:function(t,n,r){"use strict";r(2109)({target:"URL",proto:!0,enumerable:!0},{toJSON:function(){return URL.prototype.toString.call(this)}})}},n={};function r(e){if(n[e])return n[e].exports;var o=n[e]={exports:{}};return t[e](o,o.exports,r),o.exports}r.n=function(t){var n=t&&t.__esModule?function(){return t.default}:function(){return t};return r.d(n,{a:n}),n},r.d=function(t,n){for(var e in n)r.o(n,e)&&!r.o(t,e)&&Object.defineProperty(t,e,{enumerable:!0,get:n[e]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=function(t,n){return Object.prototype.hasOwnProperty.call(t,n)},function(){"use strict";var t,n;r(3753),console.log("Loaded media-uploader.js."),t=window.jQuery,n=null,t(document).on("click","[name=ssp-media-upload]",(function(r){r.preventDefault();var e=t(this).attr("data-id");console.log(e),function(r){var e=t("#preview_"+r),o=t("#src_"+r);(n=wp.media({library:{type:"image"},multiple:!1})).on("select",(function(){var t=n.state().get("selection").first().toJSON();o.val(t.url),o.change(),e.html('<img src="'+t.url+'" alt="" />')})),n.open()}(e)})),t(document).on("click","[name=ssp-media-clear]",(function(){var n,r,e;n=t(this).attr("data-id"),r=t("#preview_"+n),(e=t("#src_"+n)).val(""),e.change(),r.empty()}))}()}();
dist/js/ssp.js ADDED
@@ -0,0 +1 @@
 
1
+ addEventListener("DOMContentLoaded",(function(){!function(){window.scrollTo(0,0);var t=document.querySelectorAll(".nav-tab"),e=document.querySelectorAll(".tab-contents");if(location.hash){var a=document.querySelector(location.hash),c=document.querySelector('[href="'+location.hash+'"]'),n=document.querySelector(".nav-tab.act_"),o=document.querySelector(".tab-contents.act_");a&&c&&n&&o&&(n.classList.remove("act_"),o.classList.remove("act_"),a.classList.add("act_"),c.classList.add("act_"))}for(var s=function(a){t[a].addEventListener("click",(function(c){c.preventDefault();var n=c.target.getAttribute("href");history.replaceState(null,null,n),t[a].classList.contains("act_")||(document.querySelector(".nav-tab.act_").classList.remove("act_"),t[a].classList.add("act_"),document.querySelector(".tab-contents.act_").classList.remove("act_"),e[a].classList.add("act_"))}))},r=0;r<t.length;r++)s(r)}()}));
inc/page_help.php CHANGED
@@ -1,58 +1,67 @@
1
- <div id="ssp_wrap" class="wrapp">
2
- <h1 id="ssp_title"><?=__('Help page', LOOS_SSP_DOMAIN )?></h1>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3
 
4
- <div id="poststuff">
5
- <div class="ssp_help_page">
6
- <?=__('About available "snippet tags"', LOOS_SSP_DOMAIN )?>
7
- <br>
8
- <?php
9
- $tags = [
10
- 'site_title' => __( 'Site title', LOOS_SSP_DOMAIN ),
11
- 'phrase' => __( 'Site catchphrase', LOOS_SSP_DOMAIN ),
12
- 'description' => __( 'Home description', LOOS_SSP_DOMAIN ),
13
- 'page_title' => __( 'Post title', LOOS_SSP_DOMAIN ),
14
- 'cat_name' => __( 'Category name', LOOS_SSP_DOMAIN ),
15
- 'tag_name' => __( 'Tag name', LOOS_SSP_DOMAIN ),
16
- 'term_name' => __( 'Term name', LOOS_SSP_DOMAIN ),
17
- 'term_description' => __( 'Term description', LOOS_SSP_DOMAIN ),
18
- 'tax_name' => __( 'Taxonomy name', LOOS_SSP_DOMAIN ),
19
- 'post_type' => __( 'Post type name', LOOS_SSP_DOMAIN ),
20
- 'page_contents' => __( 'Page content', LOOS_SSP_DOMAIN ),
21
- 'date' => __( 'The date that is searching in the date archive', LOOS_SSP_DOMAIN ),
22
- 'author_name' => __( 'Author name', LOOS_SSP_DOMAIN ),
23
- 'search_phrase' => __( 'Search word', LOOS_SSP_DOMAIN ),
24
- 'format_name' => __( 'Post format name', LOOS_SSP_DOMAIN ),
25
- 'sep' => __( 'Delimiter', LOOS_SSP_DOMAIN ),
26
- ];
27
- ?>
28
- <table class="ssp_help_table">
29
- <thead>
30
- <tr>
31
- <th>
32
- <?=__('Snippet tag', LOOS_SSP_DOMAIN )?>
33
- </th>
34
- <th>
35
- <?=__('Contents to be expanded', LOOS_SSP_DOMAIN )?>
36
- </th>
37
- </tr>
38
- </thead>
39
- <tbody>
40
- <?php
41
- foreach ($tags as $key => $val) {
42
- echo '<tr><th>%_' . $key . '_%</th><td>' . $val . '</td></tr>';
43
- }
44
- ?>
45
- </tbody>
46
- </table>
47
 
48
- <p>
49
- <?php
50
- echo sprintf(
51
- __( 'See %s for more information about "SEO SIMPLE PACK".', LOOS_SSP_DOMAIN ),
52
- '<a href="https://wemo.tech/1670" target="_blank">'. __( '"How to use the plugin"', LOOS_SSP_DOMAIN ).'</a>'
53
- );
54
- ?>
55
- </p>
56
- </div>
57
- </div>
 
58
  </div>
1
+ <?php
2
+ /**
3
+ * Help page
4
+ */
5
+ $tags = [
6
+ 'site_title' => __( 'Site title', 'loos-ssp' ),
7
+ 'tagline' => __( 'Site catchphrase', 'loos-ssp' ),
8
+ 'phrase' => __( 'Site catchphrase', 'loos-ssp' ) . ' ( ' . __( 'For backward compatibility', 'loos-ssp' ) . ' )',
9
+ 'description' => __( 'Home description', 'loos-ssp' ),
10
+ 'page_title' => __( 'Post title', 'loos-ssp' ),
11
+ 'cat_name' => __( 'Category name', 'loos-ssp' ),
12
+ 'tag_name' => __( 'Tag name', 'loos-ssp' ),
13
+ 'term_name' => __( 'Term name', 'loos-ssp' ),
14
+ 'term_description' => __( 'Term description', 'loos-ssp' ),
15
+ 'tax_name' => __( 'Taxonomy name', 'loos-ssp' ),
16
+ 'post_type' => __( 'Post type name', 'loos-ssp' ),
17
+ 'page_contents' => __( 'Page content', 'loos-ssp' ),
18
+ 'date' => __( 'The date that is searching in the date archive', 'loos-ssp' ),
19
+ 'author_name' => __( 'Author name', 'loos-ssp' ),
20
+ 'search_phrase' => __( 'Search word', 'loos-ssp' ),
21
+ 'format_name' => __( 'Post format name', 'loos-ssp' ),
22
+ 'sep' => __( 'Delimiter', 'loos-ssp' ),
23
+ ];
24
 
25
+ ?>
26
+ <div class="ssp-page">
27
+ <h1 class="ssp-page__title">
28
+ <?=esc_html__( 'Help page', 'loos-ssp' )?>
29
+ </h1>
30
+ <div class="ssp-page__body">
31
+ <div class="ssp-page__section">
32
+ <h2 class="ssp-page__section__title">
33
+ <?=esc_html__( 'About available "snippet tags"', 'loos-ssp' )?>
34
+ </h2>
35
+ <div class="ssp-page__section__body">
36
+ <table class="ssp-helpTable">
37
+ <thead>
38
+ <tr>
39
+ <th>
40
+ <?=esc_html__( 'Snippet tag', 'loos-ssp' )?>
41
+ </th>
42
+ <th>
43
+ <?=esc_html__( 'Contents to be expanded', 'loos-ssp' )?>
44
+ </th>
45
+ </tr>
46
+ </thead>
47
+ <tbody>
48
+ <?php
49
+ foreach ( $tags as $key => $val ) {
50
+ echo '<tr><th>%_' . $key . '_%</th><td>' . $val . '</td></tr>';
51
+ }
52
+ ?>
53
+ </tbody>
54
+ </table>
 
 
 
 
 
 
 
 
 
 
 
 
 
55
 
56
+ <p class="ssp-page__note">
57
+ <?php
58
+ echo sprintf(
59
+ esc_html__( 'See %s for more information about "SEO SIMPLE PACK".', 'loos-ssp' ),
60
+ '<a href="https://wemo.tech/1670" target="_blank">' . esc_html__( '"How to use the plugin"', 'loos-ssp' ) . '</a>'
61
+ );
62
+ ?>
63
+ </p>
64
+ </div>
65
+ </div>
66
+ </div>
67
  </div>
inc/page_ogp.php CHANGED
@@ -1,69 +1,45 @@
1
- <?php
2
- $is_updated = false;
3
-
4
- if ( $_SERVER['REQUEST_METHOD'] === 'POST' && !empty( $_POST ) && !isset( $_POST['ssp_notice_close'] ) ) {
5
-
6
- //$_POSTの無害化
7
- $P = SSP_Methods::sanitize_post_data( $_POST );
8
-
9
- //DBアップデート処理
10
- SSP_Methods::update_db( $P );
11
-
12
- $is_updated = true;
13
-
14
- //クラスインスタンス更新
15
- SSP_Data::$ogp = get_option( SSP_Data::DB_NAME[ 'ogp' ] );
16
-
17
- }
18
-
19
- $ssp_tab = SSP_Menu::$OGP_MENU_TABS;
20
- ?>
21
- <div id="ssp_wrap" class="wrapp">
22
-
23
- <h1 id="ssp_title"><?=__('OGP settings', LOOS_SSP_DOMAIN )?></h1>
24
- <?php
25
- if ( $is_updated ) {
26
- echo '<div id="ssp_updated" class="updated notice is-dismissible">'.
27
- '<p><strong>'. __('Your settings have been saved.', LOOS_SSP_DOMAIN ) .'</strong></p>'.
28
- '<button type="button" class="notice-dismiss">'.
29
- '<span class="screen-reader-text">'. __('Hide this notification.', LOOS_SSP_DOMAIN ) .'</span>'.
30
- '</button>'.
31
- '</div>';
32
- }
33
- ?>
34
- <div id="ssp-tabs" class="nav-tab-wrapper">
35
- <?php
36
- foreach ( $ssp_tab as $key => $val ) {
37
-
38
- $nav_class = ( $val === reset( $ssp_tab ) ) ? 'nav-tab act_' : 'nav-tab';
39
- echo '<a href="#' . $key . '" class="' . $nav_class . '">' . $val . '</a>';
40
-
41
- }
42
- ?>
43
- </div>
44
- <div id="poststuff">
45
- <form action="" method="post" id="ssp_form" accept-charset="UTF-8">
46
- <?php
47
- foreach ( $ssp_tab as $key => $val ) {
48
-
49
- $tab_class = ( $val === reset( $ssp_tab ) ) ? "tab-contents act_" : "tab-contents";
50
- echo '<div id="' . $key . '" class="' . $tab_class . '">';
51
-
52
- //タブコンテンツ用ファイルの読み込み
53
- if ( file_exists( SSP_PATH.'inc/parts/tab_'.$key.'.php' ) ) {
54
-
55
- require_once SSP_PATH.'inc/parts/tab_'.$key.'.php';
56
-
57
- }
58
-
59
- echo '</div>';
60
- }
61
- ?>
62
- <input type="hidden" name="db_name" value="<?php echo esc_attr( SSP_Data::DB_NAME['ogp'] ); ?>">
63
- <?php wp_nonce_field( SSP_Data::NOUNCE_ACTION, SSP_Data::NOUNCE_NAME ); ?>
64
- <button type="submit" class="button button-primary"><?=__( 'Save settings', LOOS_SSP_DOMAIN )?></button>
65
- </form>
66
- </div>
67
  </div>
68
-
69
-
1
+ <?php
2
+
3
+ /* phpcs:disable WordPress.Security.ValidatedSanitizedInput.InputNotValidated */
4
+ /* phpcs:disable WordPress.Security.NonceVerification.Missing */
5
+
6
+ $is_updated = false;
7
+
8
+ if ( 'POST' === $_SERVER['REQUEST_METHOD'] && isset( $_POST['is_setting_form'] ) ) {
9
+
10
+ // $_POSTの無害化
11
+ $P = SSP_Utility::sanitize_post_data( $_POST );
12
+
13
+ // DBアップデート処理
14
+ SSP_Utility::update_db( $P );
15
+
16
+ // クラスインスタンス更新(更新後の情報をセット)
17
+ SSP_Data::$ogp = get_option( SSP_Data::DB_NAME['ogp'] );
18
+
19
+ $is_updated = true;
20
+ }
21
+
22
+ ?>
23
+ <div class="ssp-page">
24
+ <h1 class="ssp-page__title">
25
+ <?=esc_html__( 'OGP settings', 'loos-ssp' )?>
26
+ </h1>
27
+ <?php if ( $is_updated ) self::output_saved_message(); ?>
28
+ <div class="ssp-page__tabs nav-tab-wrapper">
29
+ <?php self::output_setting_tab( SSP_Menu::$ogp_menu_tabs ); ?>
30
+ </div>
31
+ <div class="ssp-page__body">
32
+ <form action="" method="post" id="ssp_form" accept-charset="UTF-8">
33
+ <?php
34
+ // nonce
35
+ wp_nonce_field( SSP_Data::NONCE_ACTION, SSP_Data::NONCE_NAME );
36
+
37
+ // タブコンテンツ
38
+ self::output_setting_tab_content( SSP_Menu::$ogp_menu_tabs, 'ogp' );
39
+ ?>
40
+ <input type="hidden" name="is_setting_form" value="1">
41
+ <input type="hidden" name="db_name" value="<?php echo esc_attr( SSP_Data::DB_NAME['ogp'] ); ?>">
42
+ <button type="submit" class="button button-primary"><?=esc_html__( 'Save settings', 'loos-ssp' )?></button>
43
+ </form>
44
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  </div>
 
 
inc/page_top.php CHANGED
@@ -1,69 +1,45 @@
1
- <?php
2
- $is_updated = false;
3
-
4
- if ( $_SERVER['REQUEST_METHOD'] === 'POST' && !empty( $_POST ) && !isset( $_POST['ssp_notice_close'] ) ) {
5
-
6
- //$_POSTの無害化
7
- $P = SSP_Methods::sanitize_post_data( $_POST );
8
-
9
- //DBアップデート処理
10
- SSP_Methods::update_db( $P );
11
-
12
- $is_updated = true;
13
-
14
- //クラスインスタンス更新
15
- SSP_Data::$settings = get_option( SSP_Data::DB_NAME[ 'settings' ] );
16
-
17
- }
18
-
19
- $ssp_tab = SSP_Menu::$TOP_MENU_TABS;
20
- ?>
21
- <div id="ssp_wrap" class="wrapp">
22
-
23
- <h1 id="ssp_title">SEO SIMPLE PACK <?=__('General settings', LOOS_SSP_DOMAIN )?></h1>
24
- <?php
25
- if ( $is_updated ) {
26
- echo '<div id="ssp_updated" class="updated notice is-dismissible">'.
27
- '<p><strong>'. __('Your settings have been saved.', LOOS_SSP_DOMAIN ) .'</strong></p>'.
28
- '<button type="button" class="notice-dismiss">'.
29
- '<span class="screen-reader-text">'. __('Hide this notification.', LOOS_SSP_DOMAIN ) .'</span>'.
30
- '</button>'.
31
- '</div>';
32
- }
33
- ?>
34
- <div id="ssp-tabs" class="nav-tab-wrapper">
35
- <?php
36
- foreach ( $ssp_tab as $key => $val ) {
37
-
38
- $nav_class = ( $val === reset( $ssp_tab ) ) ? 'nav-tab act_' : 'nav-tab';
39
- echo '<a href="#' . $key . '" class="' . $nav_class . '">' . $val . '</a>';
40
-
41
- }
42
- ?>
43
- </div>
44
- <div id="poststuff">
45
- <form action="" method="post" id="ssp_form" accept-charset="UTF-8">
46
- <?php
47
- foreach ( $ssp_tab as $key => $val ) {
48
-
49
- $tab_class = ( $val === reset( $ssp_tab ) ) ? "tab-contents act_" : "tab-contents";
50
- echo '<div id="' . $key . '" class="' . $tab_class . '">';
51
-
52
- //タブコンテンツ用ファイルの読み込み
53
- if ( file_exists( SSP_PATH.'inc/parts/tab_'.$key.'.php' ) ) {
54
-
55
- require_once SSP_PATH.'inc/parts/tab_'.$key.'.php';
56
-
57
- }
58
-
59
- echo '</div>';
60
- }
61
- ?>
62
- <input type="hidden" name="db_name" value="<?php echo esc_attr( SSP_Data::DB_NAME['settings'] ); ?>">
63
- <?php wp_nonce_field( SSP_Data::NOUNCE_ACTION, SSP_Data::NOUNCE_NAME ); ?>
64
- <button type="submit" class="button button-primary"><?=__( 'Save settings', LOOS_SSP_DOMAIN )?></button>
65
- </form>
66
- </div>
67
  </div>
68
-
69
-
1
+ <?php
2
+
3
+ /* phpcs:disable WordPress.Security.ValidatedSanitizedInput.InputNotValidated */
4
+ /* phpcs:disable WordPress.Security.NonceVerification.Missing */
5
+
6
+ $is_updated = false;
7
+
8
+ if ( 'POST' === $_SERVER['REQUEST_METHOD'] && isset( $_POST['is_setting_form'] ) ) {
9
+
10
+ // $_POSTの無害化
11
+ $P = SSP_Utility::sanitize_post_data( $_POST );
12
+
13
+ // DBアップデート処理
14
+ SSP_Utility::update_db( $P );
15
+
16
+ // クラスインスタンス更新(更新後の情報をセット)
17
+ SSP_Data::$settings = get_option( SSP_Data::DB_NAME['settings'] );
18
+
19
+ $is_updated = true;
20
+ }
21
+
22
+ ?>
23
+ <div class="ssp-page">
24
+ <h1 class="ssp-page__title">
25
+ SEO SIMPLE PACK <?=esc_html__( 'General settings', 'loos-ssp' )?>
26
+ </h1>
27
+ <?php if ( $is_updated ) self::output_saved_message(); ?>
28
+ <div class="ssp-page__tabs nav-tab-wrapper">
29
+ <?php self::output_setting_tab( SSP_Menu::$top_menu_tabs ); ?>
30
+ </div>
31
+ <div class="ssp-page__body">
32
+ <form action="" method="post" id="ssp_form" accept-charset="UTF-8">
33
+ <?php
34
+ // nonce
35
+ wp_nonce_field( SSP_Data::NONCE_ACTION, SSP_Data::NONCE_NAME );
36
+
37
+ // タブコンテンツ
38
+ self::output_setting_tab_content( SSP_Menu::$top_menu_tabs, 'top' );
39
+ ?>
40
+ <input type="hidden" name="db_name" value="<?php echo esc_attr( SSP_Data::DB_NAME['settings'] ); ?>">
41
+ <input type="hidden" name="is_setting_form" value="1">
42
+ <button type="submit" class="button button-primary"><?=esc_html__( 'Save settings', 'loos-ssp' )?></button>
43
+ </form>
44
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
  </div>
 
 
inc/parts/tab_analytics.php DELETED
@@ -1,45 +0,0 @@
1
- <div class="postbox">
2
- <h2 class="hndle">
3
- <span>Googleアナリティクス設定</span>
4
- </h2>
5
- <div class="inside">
6
- <table class="form-table">
7
- <tbody>
8
- <tr valign="top">
9
- <th scope="row">
10
- <label for="google_analytics_type">コードタイプ</label>
11
- </th>
12
- <td>
13
- <select name="google_analytics_type" id="google_analytics_type">
14
- <?php
15
- if( SSP_Data::$settings[ 'google_analytics_type' ] === "gtag") {
16
- echo '<option value="gtag" selected>gtag.jsでコードを埋め込む</option>
17
- <option value="analytics">analytics.jsでコードを埋め込む</option>';
18
- } else {
19
- echo '<option value="gtag">gtag.jsでコードを埋め込む</option>
20
- <option value="analytics" selected>analytics.jsでコードを埋め込む</option>';
21
- }
22
- ?>
23
- </select>
24
- <p class="ssp_desc">
25
- Googleアナリティクスのトラッキングコードを、新しい<code>gtag.js</code>でのコードで埋め込むか、古い<code>analytics.js</code>によるコードで埋め込むかを選択できます。<br>
26
- 特に理由がなければ、gtag.jsを推奨します。
27
- </p>
28
- </td>
29
- </tr>
30
-
31
- <tr valign="top">
32
- <th scope="row">
33
- <label for="google_analytics_id">トラッキング ID</label>
34
- </th>
35
- <td>
36
- <input type="text" name="google_analytics_id" id="google_analytics_id" value="<?php echo esc_attr( SSP_Data::$settings[ 'google_analytics_id' ] ); ?>">
37
- <p class="ssp_desc">
38
- GoogleアナリティクスのトラッキングID( <code>UA-XXXXX-Y</code> )を入力して下さい。
39
- </p>
40
- </td>
41
- </tr>
42
- </tbody>
43
- </table>
44
- </div>
45
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/parts/tab_archive.php DELETED
@@ -1,139 +0,0 @@
1
- <div class="postbox">
2
- <h2 class="hndle">
3
- <span>「著者アーカイブ」の設定</span>
4
- </h2>
5
- <div class="inside">
6
- <table class="form-table">
7
- <tbody>
8
- <?php $table_rows = [
9
- 'author_disable' => [
10
- 'title' => '「著者アーカイブ」を使用しない',
11
- 'class' => '',
12
- 'item' => '',
13
- 'reqired' => false,
14
- 'is_checkbox' => true,
15
- 'prev' => false,
16
- 'desc' => '「はい」を選択すると「著者アーカイブ」へアクセスしてもトップページへリダイレクトされます。',
17
- ],
18
- 'author_noindex' => [
19
- 'title' => '「著者アーカイブ」をインデックスさせない',
20
- 'class' => '',
21
- 'item' => '',
22
- 'reqired' => false,
23
- 'is_checkbox' => true,
24
- 'prev' => false,
25
- 'desc' => '「はい」を選択すると <code>noindex</code> となります。',
26
- ],
27
- 'author_title' => [
28
- 'title' => 'タイトルタグの形式',
29
- 'class' => '',
30
- 'item' => '',
31
- 'reqired' => false,
32
- 'is_checkbox' => false,
33
- 'prev' => true,
34
- 'desc' => '「著者アーカイブ」ページに出力する <code>&lt;title&gt;</code> タグの設定です。',
35
- ],
36
- 'author_desc' => [
37
- 'title' => 'ディスクリプションの形式',
38
- 'class' => 'sep',
39
- 'item' => '',
40
- 'reqired' => false,
41
- 'is_checkbox' => false,
42
- 'prev' => true,
43
- 'desc' => '「著者アーカイブ」ページに出力する <code>meta:description</code> の設定です。',
44
- ],
45
- ];
46
- SSP_Methods::output_table_rows( $table_rows ); ?>
47
- </tbody>
48
- </table>
49
- </div>
50
- </div>
51
-
52
- <div class="postbox">
53
- <h2 class="hndle">
54
- <span>「日付アーカイブ」の設定</span>
55
- </h2>
56
- <div class="inside">
57
- <table class="form-table">
58
- <tbody>
59
- <?php $table_rows = [
60
- 'date_noindex' => [
61
- 'title' => '「日付アーカイブ」をインデックスさせない',
62
- 'class' => '',
63
- 'item' => '',
64
- 'reqired' => false,
65
- 'is_checkbox' => true,
66
- 'prev' => false,
67
- 'desc' => '「はい」を選択すると <code>noindex</code> となります。',
68
- ],
69
- 'date_title' => [
70
- 'title' => 'タイトルタグの形式',
71
- 'class' => '',
72
- 'item' => '',
73
- 'reqired' => false,
74
- 'is_checkbox' => false,
75
- 'prev' => true,
76
- 'desc' => '「日付アーカイブ」ページに出力する <code>&lt;title&gt;</code> タグの設定です。',
77
- ],
78
- 'date_desc' => [
79
- 'title' => 'ディスクリプションの形式',
80
- 'class' => 'sep',
81
- 'item' => '',
82
- 'reqired' => false,
83
- 'is_checkbox' => false,
84
- 'prev' => true,
85
- 'desc' => '「日付アーカイブ」ページに出力する <code>meta:description</code> の設定です。',
86
- ],
87
- ];
88
- SSP_Methods::output_table_rows( $table_rows ); ?>
89
- </tbody>
90
- </table>
91
- </div>
92
- </div>
93
-
94
-
95
- <div class="postbox">
96
- <h2 class="hndle">
97
- <span>「カスタム投稿アーカイブ」の設定</span>
98
- </h2>
99
- <div class="inside">
100
- <table class="form-table">
101
- <tbody>
102
- <?php $table_rows = [
103
- 'pt_archive_noindex' => [
104
- 'title' => '「カスタム投稿アーカイブ」をインデックスさせない',
105
- 'class' => '',
106
- 'item' => '',
107
- 'reqired' => false,
108
- 'is_checkbox' => true,
109
- 'prev' => false,
110
- 'desc' => '「はい」を選択すると <code>noindex</code> となります。',
111
- ],
112
- 'pt_archive_title' => [
113
- 'title' => 'タイトルタグの形式',
114
- 'class' => '',
115
- 'item' => '',
116
- 'reqired' => false,
117
- 'is_checkbox' => false,
118
- 'prev' => true,
119
- 'desc' => '「カスタム投稿アーカイブ」ページに出力する <code>&lt;title&gt;</code> タグの設定です。',
120
- ],
121
- 'pt_archive_desc' => [
122
- 'title' => 'ディスクリプションの形式',
123
- 'class' => 'sep',
124
- 'item' => '',
125
- 'reqired' => false,
126
- 'is_checkbox' => false,
127
- 'prev' => true,
128
- 'desc' => '「カスタム投稿アーカイブ」ページに出力する <code>meta:description</code> の設定です。',
129
- ],
130
- ];
131
- SSP_Methods::output_table_rows( $table_rows ); ?>
132
- </tbody>
133
- </table>
134
- <p class="ssp_note">
135
- 注意:カスタム投稿タイプの登録時、アーカイブを有効にする設定をしていない場合はそもそもアーカイブURLは発行されていないので注意して下さい。<br>
136
- 例えば、「<a href="https://ja.wordpress.org/plugins/custom-post-type-ui/" target="_blank">CPT UI</a>」でカスタム投稿タイプを追加している場合、「アーカイブあり」が <code>true</code> に設定されている必要があります。
137
- </p>
138
- </div>
139
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/parts/tab_basic.php DELETED
@@ -1,118 +0,0 @@
1
- <div class="postbox">
2
- <h2 class="hndle">
3
- <span><?=__('Basic setting', LOOS_SSP_DOMAIN )?></span>
4
- </h2>
5
- <div class="inside">
6
- <table class="form-table">
7
- <tbody>
8
- <?php $table_rows = [
9
- 'site_title' => [
10
- 'title' => __('Site title', LOOS_SSP_DOMAIN ) . ' ('. __( 'For confirmation', LOOS_SSP_DOMAIN ) .')',
11
- 'reqired' => false,
12
- 'class' => '',
13
- 'is_checkbox' => false,
14
- 'item' => '<input type="text" name="" value="'.esc_attr( SSP_Data::$site_title ).'" disabled>',
15
- 'prev' => false,
16
- 'desc' => '「<a href="'. admin_url() .'options-general.php" target="_blanc">一般設定</a>」 -> 「サイトのタイトル」の値です。<br><code>%_site_title_%</code> として扱われます。',
17
- ],
18
- 'site_catch_phrase' => [
19
- 'title' => __('Site catchphrase', LOOS_SSP_DOMAIN ) . ' ('. __( 'For confirmation', LOOS_SSP_DOMAIN ) .')',
20
- 'reqired' => false,
21
- 'class' => '',
22
- 'is_checkbox' => false,
23
- 'item' => '<input type="text" name="" value="'. esc_attr( SSP_Data::$site_catch_phrase ) .'" disabled>',
24
- 'prev' => false,
25
- 'desc' => '「<a href="'. admin_url() .'options-general.php" target="_blanc">一般設定</a>」 -> 「キャッチフレーズ」の値です。<br><code>%_phrase_%</code> として扱われます。',
26
- ],
27
- 'home_title' => [
28
- 'title' => __('Home title', LOOS_SSP_DOMAIN ),
29
- 'reqired' => false,
30
- 'class' => '',
31
- 'is_checkbox' => false,
32
- 'item' => '',
33
- 'prev' => true,
34
- 'desc' => sprintf(
35
- __( 'It is the setting of %s that is output to the home page.', LOOS_SSP_DOMAIN ),
36
- '<code>&lt;title&gt;</code> '. __( 'tag', LOOS_SSP_DOMAIN )
37
- ),//'ホームページに出力する <code>&lt;title&gt;</code> タグの設定です。',
38
- ],
39
- 'separator' => [
40
- 'title' => __( 'Delimiter', LOOS_SSP_DOMAIN ),
41
- 'reqired' => false,
42
- 'class' => 'sep',
43
- 'is_checkbox' => false,
44
- 'item' => '',
45
- 'prev' => false,
46
- 'desc' => 'ここで選択した 区切り文字 は <code>%_sep_%</code> として扱われます。',
47
- ],
48
- 'home_desc' => [
49
- 'title' => __( 'Home description', LOOS_SSP_DOMAIN ),
50
- 'reqired' => false,
51
- 'class' => 'textarea',
52
- 'is_checkbox' => false,
53
- 'item' => '<textarea name="home_desc">'.esc_html( SSP_Data::$settings['home_desc'] ).'</textarea>',
54
- 'prev' => false,
55
- 'desc' => 'ホーム の <code>meta:description</code> タグの設定です。<br>入力内容が空の場合、「キャッチフレーズ」の内容が優先されます。<br>また、ここで入力された内容は <code>%_description_%</code> として扱われます。',
56
- ],
57
- 'home_keyword' => [
58
- 'title' => __( 'Keyword', LOOS_SSP_DOMAIN ),
59
- 'reqired' => false,
60
- 'class' => '',
61
- 'is_checkbox' => false,
62
- 'item' => '',
63
- 'prev' => false,
64
- 'desc' => '「キーワードを使用する場合は入力してください。<br>* 複数の場合は , 区切りで入力してください。',
65
- ],
66
- ];
67
-
68
- //特殊なもの
69
- foreach ( SSP_Data::SEPARATOR_LIST as $key => $sep ) {
70
-
71
- $checked = ( $key === SSP_Data::$settings['separator'] ) ? 'checked' : '' ;
72
-
73
- $table_rows['separator']['item'] .= '<input '.
74
- 'type="radio" '.
75
- 'class="sep_radio" '.
76
- 'id="separator-'.$key.'" '.
77
- 'name="separator" '.
78
- 'value="'.$key.'" '.$checked.'>'
79
- .'<label class="sep_radio" for="separator-'.$key.'">'.$sep.'</label>';
80
- }
81
- SSP_Methods::output_table_rows( $table_rows ); ?>
82
- </tbody>
83
- </table>
84
- </div>
85
- </div>
86
-
87
- <div class="postbox">
88
- <h2 class="hndle">
89
- <span>特殊ページ設定</span>
90
- </h2>
91
- <div class="inside">
92
- <table class="form-table">
93
- <tbody>
94
- <?php $table_rows = [
95
- 'search_title' => [
96
- 'title' => '検索結果ページタイトル',
97
- 'reqired' => false,
98
- 'class' => '',
99
- 'is_checkbox' => false,
100
- 'item' => '',
101
- 'prev' => true,
102
- 'desc' => '検索結果ページ に出力する <code>&lt;title&gt;</code> タグの設定です。',
103
- ],
104
- '404_title' => [
105
- 'title' => '404ページタイトル',
106
- 'reqired' => false,
107
- 'class' => '',
108
- 'is_checkbox' => false,
109
- 'item' => '',
110
- 'prev' => true,
111
- 'desc' => '404ページ に出力する <code>&lt;title&gt;</code> タグの設定です。',
112
- ],
113
- ];
114
- SSP_Methods::output_table_rows( $table_rows ); ?>
115
- </tbody>
116
- </table>
117
- </div>
118
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/parts/tab_facebook.php DELETED
@@ -1,51 +0,0 @@
1
- <div class="postbox">
2
- <h2 class="hndle">
3
- <span>Facebook設定</span>
4
- </h2>
5
- <div class="inside">
6
- <table class="form-table">
7
- <tbody>
8
- <?php $table_rows = [
9
- 'fb_active' => [
10
- 'title' =>'Facebook用設定を使用する',
11
- 'reqired' => false,
12
- 'is_checkbox' => true,
13
- 'prev' => false,
14
- 'class' => '',
15
- 'item' => '',
16
- 'desc' => 'Facebook用のOGPタグを出力するかどうかの設定です。',
17
- ],
18
- 'fb_url' => [
19
- 'title' => 'Facebookページ URL',
20
- 'reqired' => false,
21
- 'is_checkbox' => false,
22
- 'prev' => false,
23
- 'class' => '',
24
- 'item' => '',
25
- 'desc' => 'FacebookページのURLを入力してください。 <code>article:publisher</code> に反映されます',
26
- ],
27
- 'fb_app_id' => [
28
- 'title' => 'fb:app_id',
29
- 'reqired' => false,
30
- 'is_checkbox' => false,
31
- 'prev' => false,
32
- 'class' => '',
33
- 'item' => '',
34
- 'desc' => 'FacebookアプリID を入力してください。',
35
- ],
36
- 'fb_admins' => [
37
- 'title' => 'fb:admins',
38
- 'reqired' => false,
39
- 'is_checkbox' => false,
40
- 'prev' => false,
41
- 'class' => '',
42
- 'item' => '',
43
- 'desc' => 'アプリ管理者の FacebookID を入力してください。',
44
- ],
45
- ];
46
-
47
- SSP_Methods::output_table_rows( $table_rows, "ogp" ); ?>
48
- </tbody>
49
- </table>
50
- </div>
51
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/parts/tab_ogp.php DELETED
@@ -1,38 +0,0 @@
1
-
2
- <div class="postbox">
3
- <h2 class="hndle">
4
- <span>OGPタグ 基本設定</span>
5
- </h2>
6
- <div class="inside">
7
- <table class="form-table">
8
- <tbody>
9
- <tr valign="top">
10
- <th scope="row">
11
- <label for="singular_label">og:image デフォルト画像</label>
12
- </th>
13
- <td>
14
- <input type="hidden" name="og_image" id="media_url" value="<?php echo esc_attr( SSP_Data::$ogp['og_image'] ); ?>" />
15
- <div id="media_preview">
16
- <?php
17
- if ( SSP_Data::$ogp['og_image'] ) {
18
- echo '<img src="', esc_url( SSP_Data::$ogp['og_image'] ), '" alt="preview">';
19
- } else {
20
- echo '<div class="no_image">まだOGP画像が設定されていません。</div>';
21
- }
22
- ?>
23
- </div>
24
- <button type="button" name="media_btn" id="media_btn" class="button button-primary">画像の選択</button>
25
- <button type="button" name="crear_btn" id="crear_btn" class="button">クリア</button>
26
- <p class="ssp_desc">
27
- <br>
28
- サイト全体のデフォルト設定です。<br>
29
- 投稿ページ(<small>投稿・固定ページ・カスタム投稿タイプ</small>)では、「アイキャッチ画像」が優先されます。
30
- <br><br>
31
- Facebookでは画像サイズに1200×630pxを推奨しています。
32
- </p>
33
- </td>
34
- </tr>
35
- </tbody>
36
- </table>
37
- </div>
38
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/parts/tab_post_type.php DELETED
@@ -1,187 +0,0 @@
1
- <div class="postbox">
2
- <h2 class="hndle">
3
- <span>「投稿」のデフォルト設定</span>
4
- </h2>
5
- <div class="inside">
6
- <table class="form-table">
7
- <tbody>
8
- <?php $table_rows = [
9
- 'post_noindex' => [
10
- 'title'=>'「投稿」の記事をインデックスさせない',
11
- 'reqired' => false,
12
- 'class' => '',
13
- 'is_checkbox' => true,
14
- 'item' => '',
15
- 'prev' => false,
16
- 'desc' => '「はい」を選択するとデフォルトの出力が <code>noindex</code> となります。',
17
- ],
18
- 'post_title' => [
19
- 'title'=>'タイトルタグの形式',
20
- 'reqired' => false,
21
- 'class' => '',
22
- 'is_checkbox' => false,
23
- 'item' => '',
24
- 'prev' => true,
25
- 'desc' => '「投稿」( <code>post</code> )の記事に出力する <code>&lt;title&gt;</code> タグのデフォルト設定です。',
26
- ],
27
- 'post_desc' => [
28
- 'title'=>'ディスクリプションの形式',
29
- 'reqired' => false,
30
- 'class' => 'sep',
31
- 'is_checkbox' => false,
32
- 'item' => '',
33
- 'prev' => true,
34
- 'desc' => '「投稿」( <code>post</code> )の記事に出力する <code>meta:description</code> のデフォルト設定です。',
35
- ],
36
- ];
37
- SSP_Methods::output_table_rows( $table_rows ); ?>
38
- </tbody>
39
- </table>
40
- </div>
41
- </div>
42
-
43
- <div class="postbox">
44
- <h2 class="hndle">
45
- <span>「固定ページ」のデフォルト設定</span>
46
- </h2>
47
- <div class="inside">
48
- <table class="form-table">
49
- <tbody>
50
- <?php $table_rows = [
51
- 'page_noindex' => [
52
- 'title'=>'「固定ページ」の記事をインデックスさせない',
53
- 'reqired' => false,
54
- 'class' => '',
55
- 'is_checkbox' => true,
56
- 'item' => '',
57
- 'prev' => false,
58
- 'desc' => '「はい」を選択するとデフォルトの出力が <code>noindex</code> となります。',
59
- ],
60
- 'page_title' => [
61
- 'title'=>'タイトルタグの形式',
62
- 'reqired' => false,
63
- 'class' => '',
64
- 'is_checkbox' => false,
65
- 'item' => '',
66
- 'prev' => true,
67
- 'desc' => '「固定ページ」( <code>page</code> )の記事に出力する <code>&lt;title&gt;</code> タグのデフォルト設定です。',
68
- ],
69
- 'page_desc' => [
70
- 'title'=>'ディスクリプションの形式',
71
- 'reqired' => false,
72
- 'class' => 'sep',
73
- 'is_checkbox' => false,
74
- 'item' => '',
75
- 'prev' => true,
76
- 'desc' => '「固定ページ」( <code>page</code> )の記事に出力する <code>meta:description</code> のデフォルト設定です。',
77
- ],
78
- ];
79
- SSP_Methods::output_table_rows( $table_rows ); ?>
80
- </tbody>
81
- </table>
82
- </div>
83
- </div>
84
-
85
-
86
- <?php
87
- //カスタム投稿タイプを取得
88
- $args = array(
89
- 'public' => true,
90
- '_builtin' => false
91
- );
92
- $post_types = get_post_types( $args, 'objects', 'and' );
93
-
94
- if ( count( $post_types ) > 0 ) {
95
-
96
-
97
-
98
- foreach ( $post_types as $obj ){
99
- echo '<div class="postbox"><h2 class="hndle"><span>カスタム投稿タイプ「'.$obj->label.'」のデフォルト設定</span></h2><div class="inside">';
100
- echo '<table class="form-table"><tbody>';
101
- $table_rows = [
102
- $obj->name.'_noindex' => [
103
- 'title'=>'「'.$obj->label.'」の記事をインデックスさせない',
104
- 'reqired' => false,
105
- 'class' => '',
106
- 'is_checkbox' => true,
107
- 'item' => '',
108
- 'prev' => false,
109
- 'desc' => '「はい」を選択するとデフォルトの出力が <code>noindex</code> となります。',
110
- ],
111
- $obj->name.'_title' => [
112
- 'title'=>'タイトルタグの形式',
113
- 'reqired' => false,
114
- 'class' => '',
115
- 'is_checkbox' => false,
116
- 'item' => '',
117
- 'prev' => true,
118
- 'desc' => '「'.$obj->label.'」( <code>'.$obj->name.'</code> )の記事に出力する <code>&lt;title&gt;</code> タグのデフォルト設定です。',
119
- ],
120
- $obj->name.'_desc' => [
121
- 'title'=>'ディスクリプションの形式',
122
- 'reqired' => false,
123
- 'class' => 'sep',
124
- 'is_checkbox' => false,
125
- 'item' => '',
126
- 'prev' => true,
127
- 'desc' => '「'.$obj->label.'」( <code>'.$obj->name.'</code> )の記事に出力する <code>meta:description</code> のデフォルト設定です。',
128
- ],
129
- ];
130
- SSP_Methods::output_table_rows($table_rows );
131
-
132
- echo '</tbody></table>';
133
- echo '</div></div>';
134
- }
135
- }
136
- ?>
137
-
138
- <div class="postbox">
139
- <h2 class="hndle">
140
- <span>「メディア」のデフォルト設定</span>
141
- </h2>
142
- <div class="inside">
143
- <table class="form-table">
144
- <tbody>
145
- <?php $table_rows = [
146
- 'attachment_disable' => [
147
- 'title'=>'「メディア」を使用しない',
148
- 'reqired' => false,
149
- 'class' => '',
150
- 'is_checkbox' => true,
151
- 'item' => '',
152
- 'prev' => false,
153
- 'desc' => '「はい」を選択すると「メディア」の個別ページへアクセスしても画像URLへとリダイレクトされます。',
154
- ],
155
- 'attachment_noindex' => [
156
- 'title'=>'「メディア」をインデックスさせない',
157
- 'reqired' => false,
158
- 'class' => '',
159
- 'is_checkbox' => true,
160
- 'item' => '',
161
- 'prev' => false,
162
- 'desc' => '「はい」を選択するとデフォルトの出力が <code>noindex</code> となります。',
163
- ],
164
- 'attachment_title' => [
165
- 'title'=>'タイトルタグの形式',
166
- 'reqired' => false,
167
- 'class' => '',
168
- 'is_checkbox' => false,
169
- 'item' => '',
170
- 'prev' => true,
171
- 'desc' => '「メディア」( <code>attachment</code> )の記事に出力する <code>&lt;title&gt;</code> タグのデフォルト設定です。',
172
- ],
173
- 'attachment_desc' => [
174
- 'title'=>'ディスクリプションの形式',
175
- 'reqired' => false,
176
- 'class' => 'sep',
177
- 'is_checkbox' => false,
178
- 'item' => '',
179
- 'prev' => true,
180
- 'desc' => '「メディア」( <code>attachment</code> )の記事に出力する <code>meta:description</code> のデフォルト設定です。',
181
- ],
182
- ];
183
- SSP_Methods::output_table_rows($table_rows ); ?>
184
- </tbody>
185
- </table>
186
- </div>
187
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/parts/tab_taxonomy.php DELETED
@@ -1,187 +0,0 @@
1
- <div class="postbox">
2
- <h2 class="hndle">
3
- <span>「カテゴリーアーカイブ」の設定</span>
4
- </h2>
5
- <div class="inside">
6
- <table class="form-table">
7
- <tbody>
8
- <?php $table_rows = [
9
-
10
- 'cat_noindex' => [
11
- 'title'=>'「カテゴリーアーカイブ」をインデックスさせない',
12
- 'reqired' => false,
13
- 'class' => '',
14
- 'is_checkbox' => true,
15
- 'item' => '',
16
- 'prev' => false,
17
- 'desc' => '「はい」を選択すると <code>noindex</code> となります。',
18
- ],
19
- 'cat_title' => [
20
- 'title'=>'タイトルタグの形式',
21
- 'reqired' => false,
22
- 'class' => '',
23
- 'is_checkbox' => false,
24
- 'item' => '',
25
- 'prev' => true,
26
- 'desc' => '「カテゴリーアーカイブ」に出力する <code>&lt;title&gt;</code> タグの設定です。',
27
- ],
28
- 'cat_desc' => [
29
- 'title'=>'ディスクリプションの形式',
30
- 'reqired' => false,
31
- 'class' => 'sep',
32
- 'is_checkbox' => false,
33
- 'item' => '',
34
- 'prev' => true,
35
- 'desc' => '「カテゴリーアーカイブ」に出力する <code>meta:description</code> の設定です。',
36
- ],
37
- ];
38
- SSP_Methods::output_table_rows( $table_rows ); ?>
39
- </tbody>
40
- </table>
41
- </div>
42
- </div>
43
-
44
- <div class="postbox">
45
- <h2 class="hndle">
46
- <span>「タグアーカイブ」の設定</span>
47
- </h2>
48
- <div class="inside">
49
- <table class="form-table">
50
- <tbody>
51
- <?php $table_rows = [
52
-
53
- 'tag_noindex' => [
54
- 'title'=>'「タグアーカイブ」をインデックスさせない',
55
- 'reqired' => false,
56
- 'class' => '',
57
- 'is_checkbox' => true,
58
- 'item' => '',
59
- 'prev' => false,
60
- 'desc' => '「はい」を選択すると <code>noindex</code> となります。',
61
- ],
62
- 'tag_title' => [
63
- 'title'=>'タイトルタグの形式',
64
- 'reqired' => false,
65
- 'class' => '',
66
- 'is_checkbox' => false,
67
- 'item' => '',
68
- 'prev' => true,
69
- 'desc' => '「タグアーカイブ」に出力する <code>&lt;title&gt;</code> タグの設定です。',
70
- ],
71
- 'tag_desc' => [
72
- 'title'=>'ディスクリプションの形式',
73
- 'reqired' => false,
74
- 'class' => 'sep',
75
- 'is_checkbox' => false,
76
- 'item' => '',
77
- 'prev' => true,
78
- 'desc' => '「タグアーカイブ」に出力する <code>meta:description</code> の設定です。',
79
- ],
80
- ];
81
- SSP_Methods::output_table_rows( $table_rows ); ?>
82
- </tbody>
83
- </table>
84
- </div>
85
- </div>
86
-
87
- <?php
88
- //カスタム投稿タイプを取得
89
- $args = array(
90
- 'public' => true,
91
- '_builtin' => false
92
- );
93
- $taxonomies = get_taxonomies( $args, 'objects', 'and' );
94
-
95
- if ( count( $taxonomies ) > 0 ) {
96
- foreach ( $taxonomies as $obj ){
97
- echo '<div class="postbox"><h2 class="hndle"><span>タクソノミー「'.$obj->label.'」の設定</span></h2><div class="inside">';
98
- echo '<table class="form-table"><tbody>';
99
-
100
- $table_rows = [
101
- $obj->name.'_noindex' => [
102
- 'title'=>'「'.$obj->label.'」のアーカイブページをインデックスさせない',
103
- 'reqired' => false,
104
- 'class' => '',
105
- 'is_checkbox' => true,
106
- 'item' => '',
107
- 'prev' => false,
108
- 'desc' => '「はい」を選択すると <code>noindex</code> となります。',
109
- ],
110
- $obj->name.'_title' => [
111
- 'title'=>'タイトルタグの形式',
112
- 'reqired' => false,
113
- 'class' => '',
114
- 'is_checkbox' => false,
115
- 'item' => '',
116
- 'prev' => true,
117
- 'desc' => '「'.$obj->label.'」( <code>'.$obj->name.'</code> )のアーカイブページに出力する <code>&lt;title&gt;</code> タグの設定です。',
118
- ],
119
- $obj->name.'_desc' => [
120
- 'title'=>'ディスクリプションの形式',
121
- 'reqired' => false,
122
- 'class' => 'sep',
123
- 'is_checkbox' => false,
124
- 'item' => '',
125
- 'prev' => true,
126
- 'desc' => '「'.$obj->label.'」( <code>'.$obj->name.'</code> )のアーカイブページに出力する <code>meta:description</code> の設定です。',
127
- ],
128
- ];
129
- SSP_Methods::output_table_rows( $table_rows );
130
-
131
- echo '</tbody></table>';
132
- echo '</div></div>';
133
- }
134
- }
135
- ?>
136
-
137
- <div class="postbox">
138
- <h2 class="hndle">
139
- <span>「投稿フォーマットアーカイブ」の設定</span>
140
- </h2>
141
- <div class="inside">
142
- <table class="form-table">
143
- <tbody>
144
- <?php $table_rows = [
145
- 'post_format_disable' => [
146
- 'title'=>'「投稿フォーマットアーカイブ」を使用しない',
147
- 'reqired' => false,
148
- 'class' => '',
149
- 'is_checkbox' => true,
150
- 'item' => '',
151
- 'prev' => false,
152
- 'desc' => '「はい」を選択すると「投稿フォーマットアーカイブ」へアクセスしてもトップページへリダイレクトされます。',
153
- ],
154
-
155
- 'post_format_noindex' => [
156
- 'title'=>'「投稿フォーマットアーカイブ」をインデックスさせない',
157
- 'reqired' => false,
158
- 'class' => '',
159
- 'is_checkbox' => true,
160
- 'item' => '',
161
- 'prev' => false,
162
- 'desc' => '「はい」を選択すると <code>noindex</code> となります。',
163
- ],
164
- 'post_format_title' => [
165
- 'title'=>'タイトルタグの形式',
166
- 'reqired' => false,
167
- 'class' => '',
168
- 'is_checkbox' => false,
169
- 'item' => '',
170
- 'prev' => true,
171
- 'desc' => '「投稿フォーマットアーカイブ」に出力する <code>&lt;title&gt;</code> タグの設定です。',
172
- ],
173
- 'post_format_desc' => [
174
- 'title'=>'ディスクリプションの形式',
175
- 'reqired' => false,
176
- 'class' => 'sep',
177
- 'is_checkbox' => false,
178
- 'item' => '',
179
- 'prev' => true,
180
- 'desc' => '「投稿フォーマットアーカイブ」に出力する <code>meta:description</code> の設定です。',
181
- ],
182
- ];
183
- SSP_Methods::output_table_rows( $table_rows ); ?>
184
- </tbody>
185
- </table>
186
- </div>
187
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/parts/tab_twitter.php DELETED
@@ -1,63 +0,0 @@
1
- <div class="postbox">
2
- <h2 class="hndle">
3
- <span>Twitter設定</span>
4
- </h2>
5
- <div class="inside">
6
- <table class="form-table">
7
- <tbody>
8
- <?php $table_rows = [
9
- 'tw_active' => [
10
- 'title' =>'Twitter用設定を使用する',
11
- 'reqired' => false,
12
- 'is_checkbox' => true,
13
- 'prev' => false,
14
- 'class' => '',
15
- 'item' => '',
16
- 'desc' => 'Twitter用のOGPタグを出力するかどうかの設定です。',
17
- ],
18
- 'tw_account' => [
19
- 'title' => 'Twitterアカウント名',
20
- 'reqired' => false,
21
- 'is_checkbox' => false,
22
- 'prev' => false,
23
- 'class' => '',
24
- 'item' => '',
25
- 'desc' => 'Twitterアカウント (@〇〇) を入力してください。',
26
- ],
27
- ];
28
-
29
-
30
- SSP_Methods::output_table_rows( $table_rows, "ogp" ); ?>
31
-
32
- <tr valign="top">
33
- <th scope="row">
34
- <label for="tw_card">カードタイプ</label>
35
- </th>
36
- <td>
37
- <div class="inner">
38
- <div class="ssp_item">
39
- <select id="tw_card" name="tw_card">
40
- <?php
41
- $cards = ['summary', 'summary_large_image'];
42
-
43
- foreach ($cards as $card) {
44
- if ( SSP_Data::$ogp['tw_card'] === $card ) {
45
- echo '<option value="', esc_attr( $card ), '" selected>', esc_html( $card ), '</option>';
46
- } else {
47
- echo '<option value="', esc_attr( $card ), '">', esc_html( $card ), '</option>';
48
- }
49
-
50
- }
51
- ?>
52
- </select>
53
- </div>
54
- <div class="ssp_desc">
55
- <p>Twitterで使用するカードタイプを選択してください。</p>
56
- </div>
57
- </div>
58
- </td>
59
- </tr>
60
- </tbody>
61
- </table>
62
- </div>
63
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/parts/tab_webmaster.php DELETED
@@ -1,39 +0,0 @@
1
- <div class="postbox">
2
- <h2 class="hndle">
3
- <span>ウェブマスターツール設定</span>
4
- </h2>
5
- <div class="inside">
6
- <table class="form-table">
7
- <tbody>
8
- <?php
9
- $webmas = [
10
- 'webmaster_google' => ['Google サーチコンソール', 'google-site-verification'],
11
- 'webmaster_bing' => ['Bing', 'msvalidate.01'],
12
- 'webmaster_baidu' => ['Baidu', 'baidu-site-verification'],
13
- 'webmaster_yandex' => ['Yandex', 'yandex-verification'],
14
- ];
15
- foreach ($webmas as $wm_key => $wm_v) {
16
- echo '<tr valign="top"><th scope="row">',
17
- '<label for="'.$wm_key.'">', $wm_v[0], '</label>',
18
- '</th>',
19
-
20
- '<td>',
21
- '<div class="inner">',
22
- '<div class="ssp_item">',
23
- '<input type="text" name="'.$wm_key.'" id="'.$wm_key.'" value="'.esc_attr( SSP_Data::$settings[ $wm_key ] ).'">',
24
- '</div>',
25
- '<div class="ssp_desc">
26
- <p>', $wm_v[0], 'のウェブマスターツール認証コード<br>',
27
- '埋め込まれるコード:',
28
- '<code>&lt;meta name="',$wm_v[1], '" content="入力コード"&gt;</code>',
29
- '</p>',
30
- '</div>',
31
- '</div>',
32
- '</td>',
33
- '</tr>';
34
- }
35
- ?>
36
- </tbody>
37
- </table>
38
- </div>
39
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
inc/tab/ogp_basic.php ADDED
@@ -0,0 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * 基本設定 タブ
4
+ */
5
+ // phpcs:disable WordPress.WP.I18n.MissingTranslatorsComment
6
+
7
+ $general_url = admin_url( 'options-general.php' );
8
+
9
+ $img_desc = __( 'This is the default setting for the entire site.', 'loos-ssp' ) . '<br>' .
10
+ __( 'On the Post page, "Featured Image" have priority.', 'loos-ssp' ) . '<br><br>' .
11
+ __( 'Facebook\'s recommended size is 1200 x 630px.', 'loos-ssp' );
12
+
13
+ // OGPタグ 基本設定
14
+ self::output_section( __( 'Basic settings for OGP tags', 'loos-ssp' ), [
15
+ 'og_image' => [
16
+ 'title' => __( 'Image of "og:image"', 'loos-ssp' ),
17
+ 'type' => 'media',
18
+ // 'item' => $img_item,
19
+ 'desc' => $img_desc,
20
+ ],
21
+ ], 'ogp' );
inc/tab/ogp_facebook.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Facebook タブ
4
+ */
5
+ self::output_section( __( 'Facebook settings', 'loos-ssp' ), [
6
+ 'fb_active' => [
7
+ 'title' => sprintf( SSP_Data::$texts['use'], __( 'meta tags for Facebook', 'loos-ssp' ) ),
8
+ 'type' => 'switch',
9
+ ],
10
+ 'fb_url' => [
11
+ 'title' => __( 'Facebook page URL', 'loos-ssp' ),
12
+ 'desc' => sprintf( SSP_Data::$texts['reflect'], '<code>article:publisher</code>' ),
13
+ ],
14
+ 'fb_app_id' => [
15
+ 'title' => 'fb:app_id',
16
+ 'desc' => sprintf( SSP_Data::$texts['input'], __( 'Facebook app ID', 'loos-ssp' ) ),
17
+ ],
18
+ 'fb_admins' => [
19
+ 'title' => 'fb:admins',
20
+ 'desc' => sprintf( SSP_Data::$texts['input'], __( 'App administrator\'s Facebook ID', 'loos-ssp' ) ),
21
+ ],
22
+ ], 'ogp' );
inc/tab/ogp_twitter.php ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Twitter タブ
4
+ */
5
+ self::output_section( __( 'Twitter settings', 'loos-ssp' ), [
6
+ 'tw_active' => [
7
+ 'title' => sprintf( SSP_Data::$texts['use'], __( 'meta tags for Twitter', 'loos-ssp' ) ),
8
+ 'type' => 'switch',
9
+ // 'desc' => __( 'Twitter用のOGPタグを出力するかどうかの設定です。', 'loos-ssp' ),
10
+ ],
11
+ 'tw_account' => [
12
+ 'title' => __( 'Twitter account name', 'loos-ssp' ),
13
+ 'desc' => sprintf( SSP_Data::$texts['input'], __( 'The "xxx" part of <code>@xxx</code>', 'loos-ssp' ) ),
14
+ ],
15
+ 'tw_card' => [
16
+ 'title' => __( 'Card type', 'loos-ssp' ),
17
+ 'type' => 'select',
18
+ 'choices' =>
19
+ [
20
+ 'summary' => 'summary',
21
+ 'summary_large_image' => 'summary_large_image',
22
+ ],
23
+ 'desc' => __( 'The card size will change when you share it on SNS.', 'loos-ssp' ),
24
+ ],
25
+ ], 'ogp' );
inc/tab/top_analytics.php ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Googleアナリティクス タブ
4
+ */
5
+ self::output_section( __( 'Google Analytics settings', 'loos-ssp' ), [
6
+ 'google_analytics_type' => [
7
+ 'title' => __( 'Tracking code type', 'loos-ssp' ),
8
+ 'type' => 'select',
9
+ 'choices' => [
10
+ 'gtag' => __( 'gtag.js', 'loos-ssp' ),
11
+ 'analytics' => __( 'analytics.js', 'loos-ssp' ),
12
+ ],
13
+ 'desc' => '※ ' . __( '<code>gtag.js</code> is recommended unless you have a specific reason.', 'loos-ssp' ),
14
+ ],
15
+ 'google_analytics_id' => [
16
+ 'title' => __( '"Tracking ID" or "Measurement ID"', 'loos-ssp' ),
17
+ 'desc' => sprintf(
18
+ SSP_Data::$texts['input'],
19
+ __( 'Tracking ID (<code>UA-XXXX...</code>) or Measurement ID (<code>G-XXX...</code>)', 'loos-ssp' )
20
+ ),
21
+ ],
22
+ ] );
inc/tab/top_archive.php ADDED
@@ -0,0 +1,79 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * その他アーカイブ タブ
4
+ */
5
+
6
+ // 著者アーカイブ
7
+ $the_title = __( 'Author', 'loos-ssp' );
8
+ $quoted_title = sprintf( SSP_Data::$texts['quoted_archive_title'], $the_title );
9
+ self::output_section( $quoted_title, [
10
+ 'author_disable' => [
11
+ 'title' => sprintf( SSP_Data::$texts['nouse'], $quoted_title ),
12
+ 'type' => 'switch',
13
+ 'desc' => sprintf( __( 'If you select "Yes", you will be redirected to the Home even if you access %s.', 'loos-ssp' ), $quoted_title ),
14
+ ],
15
+ 'author_noindex' => [
16
+ 'title' => sprintf( SSP_Data::$texts['noindex'], $quoted_title ),
17
+ 'type' => 'switch',
18
+ 'desc' => SSP_Data::$texts['noindex_help'],
19
+ ],
20
+ 'author_title' => [
21
+ 'title' => SSP_Data::$texts['title_tag'],
22
+ 'desc' => sprintf( SSP_Data::$texts['default_output'], $quoted_title, '<code>&lt;title&gt;</code>' ),
23
+ 'preview' => true,
24
+ ],
25
+ 'author_desc' => [
26
+ 'title' => SSP_Data::$texts['description_tag'],
27
+ 'desc' => sprintf( SSP_Data::$texts['default_output'], $quoted_title, '<code>meta:description</code>' ),
28
+ 'preview' => true,
29
+ ],
30
+ ] );
31
+
32
+
33
+ // 日付アーカイブ
34
+ $the_title = __( 'Date', 'loos-ssp' );
35
+ $quoted_title = sprintf( SSP_Data::$texts['quoted_archive_title'], $the_title );
36
+ self::output_section( $quoted_title, [
37
+ 'date_noindex' => [
38
+ 'title' => sprintf( SSP_Data::$texts['noindex'], $quoted_title ),
39
+ 'type' => 'switch',
40
+ 'desc' => SSP_Data::$texts['noindex_help'],
41
+ ],
42
+ 'date_title' => [
43
+ 'title' => SSP_Data::$texts['title_tag'],
44
+ 'desc' => sprintf( SSP_Data::$texts['default_output'], $quoted_title, '<code>&lt;title&gt;</code>' ),
45
+ 'preview' => true,
46
+ ],
47
+ 'date_desc' => [
48
+ 'title' => SSP_Data::$texts['description_tag'],
49
+ 'desc' => sprintf( SSP_Data::$texts['default_output'], $quoted_title, '<code>meta:description</code>' ),
50
+ 'preview' => true,
51
+ ],
52
+ ] );
53
+
54
+
55
+ // カスタム投稿 タイプアーカイブ
56
+ $the_title = __( 'Custom Post Type', 'loos-ssp' );
57
+ $quoted_title = sprintf( SSP_Data::$texts['quoted_archive_title'], $the_title );
58
+ self::output_section( $quoted_title, [
59
+ 'pt_archive_noindex' => [
60
+ 'title' => sprintf( SSP_Data::$texts['noindex'], $quoted_title ),
61
+ 'type' => 'switch',
62
+ 'desc' => SSP_Data::$texts['noindex_help'],
63
+ ],
64
+ 'pt_archive_title' => [
65
+ 'title' => SSP_Data::$texts['title_tag'],
66
+ 'desc' => sprintf( SSP_Data::$texts['default_output'], $quoted_title, '<code>&lt;title&gt;</code>' ),
67
+ 'preview' => true,
68
+ ],
69
+ 'pt_archive_desc' => [
70
+ 'title' => SSP_Data::$texts['description_tag'],
71
+ 'desc' => sprintf( SSP_Data::$texts['default_output'], $quoted_title, '<code>meta:description</code>' ),
72
+ 'preview' => true,
73
+ ],
74
+ ] );
75
+ // アーカイブが無効なカスタム投稿タイプでは関係ありません。
76
+ ?>
77
+ <p class="ssp-page__note">
78
+ ※ <?=esc_html__( 'It does not matter for custom post types with invalid archiving.', 'loos-ssp' )?>
79
+ </p>
inc/tab/top_basic.php ADDED
@@ -0,0 +1,86 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * 基本設定 タブ
4
+ */
5
+ // phpcs:disable WordPress.WP.I18n.MissingTranslatorsComment
6
+ // phpcs:disable WordPress.WP.I18n.MissingArgDomain
7
+
8
+ $general_url = admin_url( 'options-general.php' );
9
+ $general_page_link = '<a href="' . $general_url . '" target="_blanc">' .
10
+ sprintf( SSP_Data::$texts['quoted_title'], __( 'General Settings' ) ) .
11
+ '</a>';
12
+
13
+ // 「一般設定」 -> 「サイトのタイトル」
14
+ $general_to_title = $general_page_link . ' -> ' . sprintf( SSP_Data::$texts['quoted_title'], __( 'Site Title' ) );
15
+
16
+ // 「一般設定」 -> 「キャッチフレーズ」
17
+ $general_to_tagline = $general_page_link . ' -> ' . sprintf( SSP_Data::$texts['quoted_title'], __( 'Tagline' ) );
18
+
19
+ // Front Page
20
+ $page_title__home = __( 'Front Page', 'loos-ssp' );
21
+ $quoted_title__home = sprintf( SSP_Data::$texts['quoted_title'], $page_title__home );
22
+
23
+ // 基本設定
24
+ self::output_section( __( 'Basic setting', 'loos-ssp' ), [
25
+ 'site_title' => [
26
+ 'title' => __( 'Site title', 'loos-ssp' ) . ' (' . __( 'For confirmation', 'loos-ssp' ) . ')',
27
+ 'item' => '<input type="text" name="" value="' . esc_attr( SSP_Data::$site_title ) . '" disabled>',
28
+ 'desc' => sprintf( __( 'Contents of %s.', 'loos-ssp' ), $general_to_title ) .
29
+ '<br>' .
30
+ sprintf( SSP_Data::$texts['is_snippet'], '<code>%_site_title_%</code>' ),
31
+ ],
32
+ 'site_catch_phrase' => [
33
+ 'title' => __( 'Site catchphrase', 'loos-ssp' ) . ' (' . __( 'For confirmation', 'loos-ssp' ) . ')',
34
+ 'item' => '<input type="text" name="" value="' . esc_attr( SSP_Data::$site_catch_phrase ) . '" disabled>',
35
+ 'desc' => sprintf( __( 'Contents of %s.', 'loos-ssp' ), $general_to_tagline ) .
36
+ '<br>' .
37
+ sprintf( SSP_Data::$texts['is_snippet'], '<code>%_tagline_%</code>' ),
38
+ ],
39
+ 'separator' => [
40
+ 'title' => __( 'Delimiter', 'loos-ssp' ),
41
+ 'class' => '-separator',
42
+ 'type' => 'radio_btn',
43
+ 'choices' => SSP_Data::SEPARATORS,
44
+ 'desc' => sprintf( __( 'The character selected here is treated as %s.', 'loos-ssp' ), ' <code>%_sep_%</code>' ),
45
+ ],
46
+ 'home_title' => [
47
+ 'title' => sprintf( SSP_Data::$texts['title_of'], $quoted_title__home ),
48
+ 'preview' => true,
49
+ 'desc' => sprintf( SSP_Data::$texts['default_output'], $quoted_title__home, '<code>&lt;title&gt;</code>' ),
50
+ ],
51
+
52
+ 'home_desc' => [
53
+ 'title' => sprintf( SSP_Data::$texts['description_of'], $quoted_title__home ),
54
+ 'type' => 'textarea',
55
+ 'class' => '-wide',
56
+ 'desc' => sprintf( SSP_Data::$texts['default_output'], $quoted_title__home, '<code>meta:description</code>' ) .
57
+ sprintf( SSP_Data::$texts['is_snippet'], '<code>%_description_%</code>' ) .
58
+ '<br>※ ' .
59
+ __( 'If the input content is empty, the content of the "Site catchphrase" has priority.', 'loos-ssp' ),
60
+ ],
61
+ 'home_keyword' => [
62
+ 'title' => sprintf( SSP_Data::$texts['keyword_of'], $quoted_title__home ),
63
+ 'class' => '-wide',
64
+ 'desc' => '*' . __( 'If there are multiple, enter them separated by ",".', 'loos-ssp' ),
65
+ ],
66
+ ] );
67
+
68
+ // 特殊ページ設定
69
+ $page_title__s = __( 'Search result page', 'loos-ssp' );
70
+ $quoted_title__s = sprintf( SSP_Data::$texts['quoted_title'], $page_title__s );
71
+
72
+ $page_title__404 = __( '404 page', 'loos-ssp' );
73
+ $quoted_title__404 = sprintf( SSP_Data::$texts['quoted_title'], $page_title__404 );
74
+
75
+ self::output_section( __( 'Particular page settings', 'loos-ssp' ), [
76
+ 'search_title' => [
77
+ 'title' => sprintf( SSP_Data::$texts['title_of'], $quoted_title__s ),
78
+ 'desc' => sprintf( SSP_Data::$texts['default_output'], $quoted_title__s, '<code>&lt;title&gt;</code>' ),
79
+ 'preview' => true,
80
+ ],
81
+ '404_title' => [
82
+ 'title' => sprintf( SSP_Data::$texts['title_of'], $quoted_title__404 ),
83
+ 'desc' => sprintf( SSP_Data::$texts['default_output'], $quoted_title__404, '<code>&lt;title&gt;</code>' ),
84
+ 'preview' => true,
85
+ ],
86
+ ] );
inc/tab/top_post_type.php ADDED
@@ -0,0 +1,104 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * 投稿ページ タブ
4
+ */
5
+
6
+ // 投稿ページ
7
+ $pt_title = __( 'Posts', 'loos-ssp' );
8
+ $quoted_title = sprintf( SSP_Data::$texts['quoted_title'], $pt_title );
9
+ self::output_section( $pt_title, [
10
+ 'post_noindex' => [
11
+ 'title' => sprintf( SSP_Data::$texts['noindex'], $quoted_title ),
12
+ 'type' => 'switch',
13
+ 'desc' => SSP_Data::$texts['noindex_help'],
14
+ ],
15
+ 'post_title' => [
16
+ 'title' => SSP_Data::$texts['title_tag'],
17
+ 'preview' => true,
18
+ 'desc' => sprintf( SSP_Data::$texts['default_output'], $quoted_title, '<code>&lt;title&gt;</code>' ),
19
+ ],
20
+ 'post_desc' => [
21
+ 'title' => SSP_Data::$texts['description_tag'],
22
+ 'class' => 'sep',
23
+ 'preview' => true,
24
+ 'desc' => sprintf( SSP_Data::$texts['default_output'], $quoted_title, '<code>meta:description</code>' ),
25
+ ],
26
+ ] );
27
+
28
+ // 固定ページ
29
+ $pt_title = __( 'Pages', 'loos-ssp' );
30
+ $quoted_title = sprintf( SSP_Data::$texts['quoted_title'], $pt_title );
31
+ self::output_section( $pt_title, [
32
+ 'page_noindex' => [
33
+ 'title' => sprintf( SSP_Data::$texts['noindex'], $quoted_title ),
34
+ 'type' => 'switch',
35
+ 'desc' => SSP_Data::$texts['noindex_help'],
36
+ ],
37
+ 'page_title' => [
38
+ 'title' => SSP_Data::$texts['title_tag'],
39
+ 'preview' => true,
40
+ 'desc' => sprintf( SSP_Data::$texts['default_output'], $quoted_title, '<code>&lt;title&gt;</code>' ),
41
+ ],
42
+ 'page_desc' => [
43
+ 'title' => SSP_Data::$texts['description_tag'],
44
+ 'class' => 'sep',
45
+ 'preview' => true,
46
+ 'desc' => sprintf( SSP_Data::$texts['default_output'], $quoted_title, '<code>meta:description</code>' ),
47
+ ],
48
+ ] );
49
+
50
+
51
+ // カスタム投稿タイプ
52
+ foreach ( SSP_Data::$custom_post_types as $pt_name => $pt_label ) {
53
+
54
+ $pt_title = __( 'Custom Post Type', 'loos-ssp' ) . ' : ' . sprintf( __( '"%s"', 'loos-ssp' ), $pt_label );
55
+ $quoted_title = sprintf( SSP_Data::$texts['quoted_title'], $pt_label );
56
+
57
+ self::output_section( $pt_title, [
58
+ $pt_name . '_noindex' => [
59
+ 'title' => sprintf( SSP_Data::$texts['noindex'], $quoted_title ),
60
+ 'type' => 'switch',
61
+ 'desc' => SSP_Data::$texts['noindex_help'],
62
+ ],
63
+ $pt_name . '_title' => [
64
+ 'title' => SSP_Data::$texts['title_tag'],
65
+ 'preview' => true,
66
+ 'desc' => sprintf( SSP_Data::$texts['default_output'], $quoted_title, '<code>&lt;title&gt;</code>' ),
67
+ ],
68
+ $pt_name . '_desc' => [
69
+ 'title' => SSP_Data::$texts['description_tag'],
70
+ 'class' => 'sep',
71
+ 'preview' => true,
72
+ 'desc' => sprintf( SSP_Data::$texts['default_output'], $quoted_title, '<code>meta:description</code>' ),
73
+ ],
74
+ ] );
75
+ }
76
+
77
+
78
+ // メディアページ
79
+ $pt_title = __( 'Media page', 'loos-ssp' );
80
+ $quoted_title = sprintf( SSP_Data::$texts['quoted_title'], $pt_title );
81
+
82
+ self::output_section( $pt_title, [
83
+ 'attachment_disable' => [
84
+ 'title' => sprintf( SSP_Data::$texts['nouse'], $quoted_title ),
85
+ 'type' => 'switch',
86
+ 'desc' => sprintf( __( 'If you select "Yes", you will be redirected to the Media file even if you access %s.', 'loos-ssp' ), $quoted_title ),
87
+ ],
88
+ 'attachment_noindex' => [
89
+ 'title' => sprintf( SSP_Data::$texts['noindex'], $quoted_title ),
90
+ 'type' => 'switch',
91
+ 'desc' => SSP_Data::$texts['noindex_help'],
92
+ ],
93
+ 'attachment_title' => [
94
+ 'title' => SSP_Data::$texts['title_tag'],
95
+ 'preview' => true,
96
+ 'desc' => sprintf( SSP_Data::$texts['default_output'], $quoted_title, '<code>&lt;title&gt;</code>' ),
97
+ ],
98
+ 'attachment_desc' => [
99
+ 'title' => SSP_Data::$texts['description_tag'],
100
+ 'class' => 'sep',
101
+ 'preview' => true,
102
+ 'desc' => sprintf( SSP_Data::$texts['default_output'], $quoted_title, '<code>meta:description</code>' ),
103
+ ],
104
+ ] );
inc/tab/top_taxonomy.php ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * タクソノミーアーカイブ タブ
4
+ */
5
+
6
+ // カテゴリー
7
+ $tax_title = __( 'Category', 'loos-ssp' );
8
+ $quoted_title = sprintf( SSP_Data::$texts['quoted_archive_title'], $tax_title );
9
+ self::output_section( $tax_title, [
10
+ 'cat_noindex' => [
11
+ 'title' => sprintf( SSP_Data::$texts['noindex'], $quoted_title ),
12
+ 'type' => 'switch',
13
+ 'desc' => SSP_Data::$texts['noindex_help'],
14
+ ],
15
+ 'cat_title' => [
16
+ 'title' => SSP_Data::$texts['title_tag'],
17
+ 'preview' => true,
18
+ 'desc' => sprintf( SSP_Data::$texts['default_output'], $quoted_title, '<code>&lt;title&gt;</code>' ),
19
+ ],
20
+ 'cat_desc' => [
21
+ 'title' => SSP_Data::$texts['description_tag'],
22
+ 'class' => 'sep',
23
+ 'preview' => true,
24
+ 'desc' => sprintf( SSP_Data::$texts['default_output'], $quoted_title, '<code>meta:description</code>' ),
25
+ ],
26
+ ] );
27
+
28
+
29
+ // タグ
30
+ $tax_title = __( 'Tag', 'loos-ssp' );
31
+ $quoted_title = sprintf( SSP_Data::$texts['quoted_archive_title'], $tax_title );
32
+ self::output_section( $tax_title, [
33
+ 'tag_noindex' => [
34
+ 'title' => sprintf( SSP_Data::$texts['noindex'], $quoted_title ),
35
+ 'type' => 'switch',
36
+ 'desc' => SSP_Data::$texts['noindex_help'],
37
+ ],
38
+ 'tag_title' => [
39
+ 'title' => SSP_Data::$texts['title_tag'],
40
+ 'preview' => true,
41
+ 'desc' => sprintf( SSP_Data::$texts['default_output'], $quoted_title, '<code>&lt;title&gt;</code>' ),
42
+ ],
43
+ 'tag_desc' => [
44
+ 'title' => SSP_Data::$texts['description_tag'],
45
+ 'class' => 'sep',
46
+ 'preview' => true,
47
+ 'desc' => sprintf( SSP_Data::$texts['default_output'], $quoted_title, '<code>meta:description</code>' ),
48
+ ],
49
+ ] );
50
+
51
+ // カスタムタクソノミー
52
+ foreach ( SSP_Data::$custom_taxonomies as $tax_name => $tax_label ) {
53
+
54
+ $tax_title = __( 'Taxonomy', 'loos-ssp' ) . ' : ' . sprintf( __( '"%s"', 'loos-ssp' ), $tax_label );
55
+ $quoted_title = sprintf( SSP_Data::$texts['quoted_archive_title'], $tax_label );
56
+ self::output_section( $tax_title, [
57
+ $tax_name . '_noindex' => [
58
+ 'title' => sprintf( SSP_Data::$texts['noindex'], $quoted_title ),
59
+ 'type' => 'switch',
60
+ 'desc' => SSP_Data::$texts['noindex_help'],
61
+ ],
62
+ $tax_name . '_title' => [
63
+ 'title' => SSP_Data::$texts['title_tag'],
64
+ 'preview' => true,
65
+ 'desc' => sprintf(
66
+ SSP_Data::$texts['default_output'],
67
+ $quoted_title,
68
+ '<code>&lt;title&gt;</code>'
69
+ ),
70
+ ],
71
+ $tax_name . '_desc' => [
72
+ 'title' => SSP_Data::$texts['description_tag'],
73
+ 'class' => 'sep',
74
+ 'preview' => true,
75
+ 'desc' => sprintf(
76
+ SSP_Data::$texts['default_output'],
77
+ $quoted_title,
78
+ '<code>meta:description</code>'
79
+ ),
80
+ ],
81
+ ] );
82
+ }
83
+
84
+
85
+ // 投稿フォーマット
86
+ $tax_title = __( 'Post Format', 'loos-ssp' );
87
+ $quoted_title = sprintf( SSP_Data::$texts['quoted_archive_title'], $tax_title );
88
+ self::output_section( $tax_title, [
89
+ 'post_format_disable' => [
90
+ 'title' => sprintf( SSP_Data::$texts['nouse'], $quoted_title ),
91
+ 'type' => 'switch',
92
+ 'desc' => sprintf( __( 'If you select "Yes", you will be redirected to the Home even if you access %s.', 'loos-ssp' ), $quoted_title ),
93
+ ],
94
+ 'post_format_noindex' => [
95
+ 'title' => sprintf( SSP_Data::$texts['noindex'], $quoted_title ),
96
+ 'type' => 'switch',
97
+ 'desc' => SSP_Data::$texts['noindex_help'],
98
+ ],
99
+ 'post_format_title' => [
100
+ 'title' => SSP_Data::$texts['title_tag'],
101
+ 'preview' => true,
102
+ 'desc' => sprintf( SSP_Data::$texts['default_output'], $quoted_title, '<code>&lt;title&gt;</code>' ),
103
+ ],
104
+ 'post_format_desc' => [
105
+ 'title' => SSP_Data::$texts['description_tag'],
106
+ 'class' => 'sep',
107
+ 'preview' => true,
108
+ 'desc' => sprintf( SSP_Data::$texts['default_output'], $quoted_title, '<code>meta:description</code>' ),
109
+ ],
110
+ ] );
inc/tab/top_webmaster.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /**
3
+ * Googleアナリティクス タブ
4
+ */
5
+
6
+ $settings = [
7
+ 'webmaster_google' => [__( 'Google Search Console', 'loos-ssp' ), 'google-site-verification' ],
8
+ 'webmaster_bing' => ['Bing', 'msvalidate.01' ],
9
+ 'webmaster_baidu' => ['Baidu', 'baidu-site-verification' ],
10
+ 'webmaster_yandex' => ['Yandex', 'yandex-verification' ],
11
+ ];
12
+
13
+ $section_args = [];
14
+ foreach ( $settings as $key => $data ) {
15
+ $desc = __( 'Output code ', 'loos-ssp' ) .
16
+ ' : <code>&lt;meta name="' . $data[1] . '" content="<b>' . _x( 'Your code', 'input', 'loos-ssp' ) . '</b>"&gt;</code>';
17
+
18
+ $section_args[ $key ] = [
19
+ 'title' => sprintf( __( 'Authentication code for %s', 'loos-ssp' ), $data[0] ),
20
+ 'desc' => $desc,
21
+ 'class' => '-wide -webmaster',
22
+ ];
23
+ }
24
+ self::output_section( __( 'Webmaster Tools Certification Code', 'loos-ssp' ), $section_args );
languages/loos-ssp-ja.mo CHANGED
Binary file
languages/loos-ssp-ja.po CHANGED
@@ -1,15 +1,15 @@
1
  msgid ""
2
  msgstr ""
3
  "Project-Id-Version: SEO SIMPLE PACK\n"
4
- "POT-Creation-Date: 2020-08-06 21:47+0900\n"
5
- "PO-Revision-Date: 2020-08-07 23:28+0900\n"
6
  "Last-Translator: \n"
7
  "Language-Team: \n"
8
  "Language: ja\n"
9
  "MIME-Version: 1.0\n"
10
  "Content-Type: text/plain; charset=UTF-8\n"
11
  "Content-Transfer-Encoding: 8bit\n"
12
- "X-Generator: Poedit 2.4\n"
13
  "X-Poedit-Basepath: ..\n"
14
  "Plural-Forms: nplurals=1; plural=0;\n"
15
  "X-Poedit-Flags-xgettext: --add-comments=translators:\n"
@@ -20,164 +20,584 @@ msgstr ""
20
  "_nx_noop:3c,1,2;__ngettext_noop:1,2\n"
21
  "X-Poedit-SearchPath-0: .\n"
22
  "X-Poedit-SearchPathExcluded-0: *.min.js\n"
 
 
 
23
 
24
- #: class/ssp_menu.php:38 class/ssp_menu.php:39 inc/page_ogp.php:23
25
- msgid "OGP settings"
26
- msgstr "OGP設定"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
27
 
28
- #: class/ssp_menu.php:46 class/ssp_menu.php:55 inc/parts/tab_basic.php:3
29
  msgid "Basic setting"
30
  msgstr "基本設定"
31
 
32
- #: class/ssp_menu.php:47
33
  msgid "Post page"
34
  msgstr "投稿ページ"
35
 
36
- #: class/ssp_menu.php:48
37
  msgid "Taxonomy archive"
38
  msgstr "タクソノミーアーカイブ"
39
 
40
- #: class/ssp_menu.php:49
41
  msgid "Other archives"
42
  msgstr "その他アーカイブ"
43
 
44
- #: class/ssp_menu.php:50
45
  msgid "Google Analytics"
46
  msgstr "Googleアナリティクス"
47
 
48
- #: class/ssp_menu.php:51
49
  msgid "Webmaster tools"
50
  msgstr "ウェブマスターツール"
51
 
52
- #: class/ssp_menu.php:111 inc/page_top.php:23
53
  msgid "General settings"
54
  msgstr "一般設定"
55
 
56
- #: class/ssp_methods.php:345
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
57
  msgid "Preview"
58
  msgstr "プレビュー"
59
 
60
- #: inc/page_help.php:2
61
- msgid "Help page"
62
- msgstr "ヘルプページ"
63
 
64
- #: inc/page_help.php:6
65
- msgid "About available \"snippet tags\""
66
- msgstr "使用可能な\"スニペットタグ\"について"
67
 
68
- #: inc/page_help.php:10 inc/parts/tab_basic.php:10
69
- msgid "Site title"
70
- msgstr "サイトのタイトル"
71
 
72
- #: inc/page_help.php:11 inc/parts/tab_basic.php:19
73
- msgid "Site catchphrase"
74
- msgstr "サイトのキャッチフレーズ"
75
 
76
- #: inc/page_help.php:12 inc/parts/tab_basic.php:49
77
- msgid "Home description"
78
- msgstr "ホームのディスクリプション"
79
 
80
- #: inc/page_help.php:13
 
 
 
 
81
  msgid "Post title"
82
  msgstr "投稿のタイトル"
83
 
84
- #: inc/page_help.php:14
85
  msgid "Category name"
86
  msgstr "カテゴリー名"
87
 
88
- #: inc/page_help.php:15
89
  msgid "Tag name"
90
  msgstr "タグ名"
91
 
92
- #: inc/page_help.php:16
93
  msgid "Term name"
94
  msgstr "ターム名"
95
 
96
- #: inc/page_help.php:17
97
- msgid "Term description"
98
- msgstr "タームの説明"
99
-
100
- #: inc/page_help.php:18
101
  msgid "Taxonomy name"
102
  msgstr "タクソノミー名"
103
 
104
- #: inc/page_help.php:19
 
 
 
 
 
 
 
 
105
  msgid "Post type name"
106
  msgstr "投稿タイプ名"
107
 
108
- #: inc/page_help.php:20
109
  msgid "Page content"
110
  msgstr "ページコンテンツ"
111
 
112
- #: inc/page_help.php:21
113
- msgid "The date that is searching in the date archive"
114
- msgstr "日付アーカイブで検索中の日付"
115
-
116
- #: inc/page_help.php:22
117
- msgid "Author name"
118
- msgstr "著者名"
119
 
120
- #: inc/page_help.php:23
121
- msgid "Search word"
122
- msgstr "検索ワード"
123
-
124
- #: inc/page_help.php:24
125
  msgid "Post format name"
126
  msgstr "投稿フォーマット名"
127
 
128
- #: inc/page_help.php:25 inc/parts/tab_basic.php:40