PluginProbe ʕ •ᴥ•ʔ
SEO SIMPLE PACK / 2.2.3
SEO SIMPLE PACK v2.2.3
1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 1.3.0 1.3.1 2.0.0 2.1.0 2.1.1 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3.0 2.3.1 2.4.0 2.4.1 2.4.2 2.5.0 2.5.1 3.0.0 3.1.0 3.1.1 3.1.2 3.2.0 3.2.1 3.3.0 3.3.1 3.4.0 3.5.0 3.5.1 3.5.2 3.6.0 3.6.1 3.6.2 3.6.3 3.7.0 trunk 1.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2
seo-simple-pack / class / data.php
seo-simple-pack / class Last commit date
trait 5 years ago __branch.php 5 years ago activate.php 5 years ago data.php 5 years ago hooks.php 5 years ago menu.php 5 years ago metabox.php 5 years ago output.php 5 years ago utility.php 5 years ago
data.php
237 lines
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 */
34 public static $site_title = '';
35 public static $site_catch_phrase = '';
36
37 /**
38 * �
39 �通テキスト
40 */
41 public static $texts = '';
42
43 /**
44 * 設定のデフォルト値
45 */
46 public static $default_settings = []; // 基本設定のデフォルト値
47 public static $default_ogp_settings = []; // OGP設定のデフォルト値
48 public static $default_pt_settings = []; // カスタム投稿のフォーマット形式
49 public static $default_tax_settings = []; // カスタムタクソノミーのフォーマット形式
50
51 /**
52 * カスタム投稿タイプ・カスタムタクソノミーを保持しておくための変数。
53 * 形式: [ 'name' => 'label' ]
54 */
55 public static $custom_post_types = [];
56 public static $custom_taxonomies = [];
57
58 /**
59 * nonce
60 */
61 const NONCE_ACTION = 'ssp_nonce_action';
62 const NONCE_NAME = 'ssp_nonce_name';
63
64 /**
65 * 区切り文字リスト
66 */
67 const SEPARATORS = [
68 'dash' => '-',
69 'line' => '|',
70 'tilde' => '~',
71 ];
72
73
74 /**
75 * Set Data
76 */
77 public static function init() {
78
79 // �
80 �通の翻訳用テキスト
81 self::$texts = [
82 'quoted_title' => __( '"%s"', 'loos-ssp' ),
83 'quoted_archive_title' => __( '"%s" archive page', 'loos-ssp' ),
84 'is_snippet' => __( 'This content is treated as %s.', 'loos-ssp' ), // この�
85 容は %s として扱われます。
86 'title_of' => __( 'Title tag of %s', 'loos-ssp' ), // %sのタイトルタグ
87 'description_of' => __( 'Description of %s', 'loos-ssp' ), // %sのディスクリプション
88 'keyword_of' => __( 'Keywords of %s', 'loos-ssp' ),
89 'title_tag' => __( 'Title tag format', 'loos-ssp' ), // タイトルタグの形式
90 'description_tag' => __( 'Description format', 'loos-ssp' ), // ディスクリプションの形式
91 'use' => __( 'Use %s', 'loos-ssp' ), // %sを使用する
92 'nouse' => __( 'Do not use %s', 'loos-ssp' ), // を使用しない
93 'noindex' => __( 'Do not index %s', 'loos-ssp' ), // sをインデックスさせない
94 'noindex_help' => __( 'If you select "Yes", the default output will be <code>noindex</code>.', 'loos-ssp' ),
95 'default_output' => __( 'The default setting of %2$s to be output to %1$s.', 'loos-ssp' ),
96 'input' => __( 'Please enter %s.', 'loos-ssp' ),
97 'reflect' => __( 'It will be reflected in %s.', 'loos-ssp' ),
98 'archive_desc' => __( 'This is the archive page for %s.', 'loos-ssp' ),
99 ];
100
101 // 設定のデフォルト値をセット
102 self::set_default();
103
104 // インストール済みバージョン�
105 報を取得
106 $installed_version = get_option( self::DB_NAME['installed'] );
107
108 if ( false === $installed_version ) {
109
110 // インストール時に実行する処理
111 self::setup_at_installed();
112
113 } elseif ( (int) SSP_VERSION > (int) $installed_version ) {
114
115 // 更新時に実行する処理
116 self::setup_at_updated();
117 }
118 // SSP_VERSION
119
120 // サイト基本�
121 報取得
122 self::$site_title = esc_html( get_option( 'blogname' ) );
123 self::$site_catch_phrase = esc_html( get_option( 'blogdescription' ) );
124
125 // 一般設定データ
126 $saved_settings = get_option( self::DB_NAME['settings'] ) ?: [];
127 self::$settings = array_merge( self::$default_settings, $saved_settings );
128
129 // OGP設定
130 $saved_ogp_settings = get_option( self::DB_NAME['ogp'] ) ?: [];
131 self::$ogp = array_merge( self::$default_ogp_settings, $saved_ogp_settings );
132
133 }
134
135 /**
136 * デフォルト値をセット
137 */
138 public static function set_default() {
139 self::$default_settings = [
140 'home_title' => '%_site_title_% %_sep_% %_tagline_%',
141 'home_desc' => '',
142 'home_keyword' => '',
143 'reuse_keyword' => '1',
144 'separator' => 'line',
145 'webmaster_bing' => '',
146 'webmaster_google' => '',
147 'webmaster_baidu' => '',
148 'webmaster_yandex' => '',
149 'google_analytics_type' => 'gtag',
150 'google_analytics_id' => '',
151 'post_noindex' => false,
152 'post_title' => '%_page_title_% %_sep_% %_site_title_%',
153 'post_desc' => '%_page_contents_%',
154 'page_noindex' => false,
155 'page_title' => '%_page_title_% %_sep_% %_site_title_%',
156 'page_desc' => '%_page_contents_%',
157 'attachment_disable' => true,
158 'attachment_noindex' => true,
159 'attachment_title' => '%_page_title_% %_sep_% %_site_title_%',
160 'attachment_desc' => '%_page_contents_%',
161 'cat_noindex' => false,
162 'cat_title' => '%_cat_name_% %_sep_% %_site_title_%',
163 'cat_desc' => '%_term_description_%',
164 'tag_noindex' => false,
165 'tag_title' => '%_tag_name_% %_sep_% %_site_title_%',
166 'tag_desc' => '%_term_description_%',
167 'post_format_disable' => false,
168 'post_format_noindex' => true,
169 'post_format_title' => '%_format_name_% %_sep_% %_site_title_%',
170 'post_format_desc' => '',
171 'author_disable' => false,
172 'author_noindex' => true,
173 'author_title' => '%_author_name_% %_sep_% %_site_title_%',
174 'author_desc' => sprintf( self::$texts['archive_desc'], '%_author_name_%' ),
175 'date_noindex' => true,
176 'date_title' => '%_date_% %_sep_% %_site_title_%',
177 'date_desc' => sprintf( self::$texts['archive_desc'], '%_date_%' ),
178 'pt_archive_noindex' => true,
179 'pt_archive_title' => '%_post_type_% %_sep_% %_site_title_%',
180 'pt_archive_desc' => sprintf( self::$texts['archive_desc'], '%_post_type_%' ),
181 '404_title' => '404: ' . __( 'Page not found', 'loos-ssp' ) . ' %_sep_% %_site_title_%',
182 'search_title' => __( 'Searched:', 'loos-ssp' ) . ' %_search_phrase_% %_sep_% %_site_title_%',
183 ];
184
185 self::$default_ogp_settings = [
186 'og_image' => '',
187 'fb_active' => true,
188 'fb_url' => '',
189 'fb_app_id' => '',
190 'fb_admins' => '',
191 'tw_active' => true,
192 'tw_account' => '',
193 'tw_card' => 'summary',
194 ];
195
196 /**
197 * カスタム投稿のフォーマット形式
198 */
199 self::$default_pt_settings = [
200 'noindex' => false,
201 'title' => '%_page_title_% %_sep_% %_site_title_%',
202 'desc' => '%_page_contents_%',
203 ];
204
205 /**
206 * カスタムタクソノミーのフォーマット形式
207 */
208 self::$default_tax_settings = [
209 'noindex' => true,
210 'title' => '%_term_name_% %_sep_% %_site_title_%',
211 'desc' => '%_term_description_%',
212 ];
213 }
214
215
216 /**
217 * インストール時に実行する処理
218 */
219 public static function setup_at_installed() {
220
221 update_option( self::DB_NAME['installed'], SSP_VERSION );
222 // update_option( SSP_Data::DB_NAME[ 'notification' ], 'hide' );
223
224 // デフォルト設定を保存
225 update_option( self::DB_NAME['settings'], self::$default_settings );
226 update_option( self::DB_NAME['ogp'], self::$default_ogp_settings );
227
228 }
229
230 /**
231 * 更新時に実行する処理
232 */
233 public static function setup_at_updated() {
234 update_option( self::DB_NAME['installed'], SSP_VERSION );
235 }
236 }
237