PageRenderTime 193ms CodeModel.GetById 21ms RepoModel.GetById 1ms app.codeStats 0ms

/inc/defaults.php

https://gitlab.com/kishikeisuke/estatesale
PHP | 421 lines | 391 code | 13 blank | 17 comment | 26 complexity | 6bc68d4fb116cb499bb8643ebee116f2 MD5 | raw file
  1. <?php
  2. /**
  3. * WpTHK WordPress Theme - free/libre wordpress platform
  4. *
  5. * This program is free software; you can redistribute it and/or modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * (at your option) any later version.
  9. *
  10. * @copyright Copyright (C) 2015 Thought is free.
  11. * @license http://www.gnu.org/licenses/gpl-2.0.html GPL v2 or later
  12. * @author LunaNuko
  13. * @link http://thk.kanzae.net/
  14. * @translators rakeem( http://rakeem.jp/ )
  15. */
  16. if( class_exists( 'defConfig' ) === false ):
  17. class defConfig {
  18. public function __construct() {
  19. }
  20. public function default_variables() {
  21. $share_msg = __( 'Please share this if you liked it!', 'wpthk' );
  22. $read_more = __( 'Read more', 'wpthk' );
  23. $home_text = __( 'Home', 'wpthk' );
  24. if( get_locale() === 'ja' ) {
  25. $share_msg = 'よろしければシェアお願いします';
  26. $read_more = '記事を読む';
  27. $home_text = 'ホーム';
  28. }
  29. $defaults = array(
  30. 'bootstrap_header' => 'out',
  31. 'bootstrap_footer' => 'out',
  32. 'foot_widget' => 3,
  33. 'pagination_visible' => true,
  34. 'related_visible' => true,
  35. 'comment_visible' => true,
  36. 'trackback_visible' => true,
  37. 'comment_page_visible' => true,
  38. 'trackback_page_visible'=> true,
  39. 'thumbnail_width' => 150,
  40. 'thumbnail_height' => 150,
  41. 'thumbnail_is_size' => 'generate',
  42. 'title_sep' => 'pipe',
  43. 'title_top_list' => 'site_catch',
  44. 'title_front_page' => 'site_catch',
  45. 'title_other' => 'title_site',
  46. 'canonical_enable' => true,
  47. 'next_prev_enable' => true,
  48. 'rss_feed_enable' => true,
  49. 'atom_feed_enable' => true,
  50. 'meta_keywords' => 'none',
  51. 'twitter_card_type' => 'summary',
  52. 'child_css' => true,
  53. 'bootstrap_js_load_type' => 'none',
  54. 'jquery_load' => true,
  55. 'jquery_migrate' => 'not',
  56. 'awesome_css_type' => 'minimum',
  57. 'awesome_load' => 'sync',
  58. 'html_compress' => 'none',
  59. 'child_css_compress' => 'none',
  60. 'child_js_compress' => 'none',
  61. 'list_view' => 'excerpt',
  62. 'breadcrumb_view' => 'outer',
  63. 'content_side_discrete' => 'discrete',
  64. 'content_discrete' => 'discrete',
  65. 'thumbnail_visible' => true,
  66. 'noimage_visible' => true,
  67. 'excerpt_length' => 120,
  68. 'excerpt_priority' => true,
  69. 'read_more_text' => $read_more,
  70. 'short_title_length' => 16,
  71. 'read_more_short_title' => true,
  72. 'header_catchphrase_visible' => true,
  73. 'home_text' => $home_text,
  74. 'page_top_text' => 'PAGE TOP',
  75. 'page_top_icon' => 'fa_caret_square_o_up',
  76. 'post_date_visible' => true,
  77. 'mod_date_visible' => true,
  78. 'category_meta_u_visible' => true,
  79. 'tag_meta_u_visible' => true,
  80. 'list_post_date_visible' => true,
  81. 'list_category_meta_visible' => true,
  82. 'list_mod_date_u_visible' => true,
  83. 'global_navi_visible' => true,
  84. 'global_navi_position' => 'under',
  85. 'global_navi_mobile_type' => 'luxury',
  86. 'head_band_visible' => true,
  87. 'head_band_follow_icon' => 'icon_name',
  88. 'head_band_rss' => true,
  89. 'head_band_feedly' => true,
  90. 'gallery_type' => 'none',
  91. 'add_class_external' => true,
  92. 'twitter_share_tops_button' => true,
  93. 'facebook_share_tops_button' => true,
  94. 'google_share_tops_button' => true,
  95. 'linkedin_share_tops_button' => true,
  96. 'hatena_share_tops_button' => true,
  97. 'pocket_share_tops_button' => true,
  98. 'twitter_share_bottoms_button' => true,
  99. 'facebook_share_bottoms_button' => true,
  100. 'google_share_bottoms_button' => true,
  101. 'linkedin_share_bottoms_button' => true,
  102. 'hatena_share_bottoms_button' => true,
  103. 'pocket_share_bottoms_button' => true,
  104. 'search_extract' => 'word',
  105. 'search_extract_length' => 140,
  106. 'search_match_method' => 'default',
  107. 'search_highlight' => true,
  108. 'highlight_bold' => true,
  109. 'highlight_oblique' => true,
  110. 'highlight_bg' => true,
  111. 'highlight_bg_color' => '#ffd700',
  112. 'highlight_radius' => 6,
  113. 'sns_count_cache_expire' => 600,
  114. 'sns_count_weekly_cleanup' => 'dust',
  115. 'sns_tops_enable' => true,
  116. 'sns_tops_type' => 'color',
  117. 'sns_bottoms_enable' => true,
  118. 'sns_bottoms_type' => 'color',
  119. 'sns_bottoms_msg' => $share_msg,
  120. 'sns_toppage_view' => true,
  121. 'sns_page_view' => true,
  122. 'adsense_visible' => true,
  123. 'preview_adsense_visible' => true,
  124. 'user_scalable' => 'yes',
  125. 'author_visible' => true,
  126. 'author_page_type' => 'auth'
  127. );
  128. return $defaults;
  129. }
  130. public function default_custom_variables() {
  131. $this->default_variables();
  132. $defaults = $this->default_variables() + array(
  133. 'wpthk_mode_select' => 'wpthk',
  134. 'nextpage_index' => false,
  135. 'css_to_style' => false,
  136. 'jquery_defer' => false,
  137. 'column3' => '2column',
  138. 'column_home' => 'default',
  139. 'column_post' => 'default',
  140. 'column_page' => 'default',
  141. 'column_archive' => 'default',
  142. 'side_1_width' => 366,
  143. 'side_2_width' => 280,
  144. 'side_position' => 'right',
  145. 'column3_position' => 'center',
  146. 'column3_reverse' => false,
  147. 'sticky_no_excerpt' => false,
  148. 'container_max_width' => 1170,
  149. 'title_position' => 'left',
  150. 'contents_border' => true,
  151. 'pagination_area_border'=> true,
  152. 'cont_border_radius' => 0,
  153. 'sidebar_border' => true,
  154. 'side_border_radius' => 0,
  155. 'header_border' => false,
  156. 'header_border_wide' => false,
  157. 'footer_border' => false,
  158. 'footer_border_top' => true,
  159. 'head_margin_top' => 0,
  160. 'head_padding_top' => 20,
  161. 'head_padding_right' => 10,
  162. 'head_padding_bottom' => 20,
  163. 'head_padding_left' => 10,
  164. 'side_discrete' => 'indiscrete',
  165. 'cont_padding_top' => 35,
  166. 'cont_padding_right' => 25,
  167. 'cont_padding_bottom' => 0,
  168. 'cont_padding_left' => 25,
  169. 'break_excerpt' => false,
  170. 'header_catchphrase_change' => THK_DESCRIPTION,
  171. 'page_top_color' => null,
  172. 'page_top_bg_color' => null,
  173. 'category_meta_visible' => false,
  174. 'tag_meta_visible' => false,
  175. 'tax_meta_visible' => false,
  176. 'post_date_u_visible' => false,
  177. 'mod_date_u_visible' => false,
  178. 'tax_meta_u_visible' => false,
  179. 'list_mod_date_visible' => false,
  180. 'list_tag_meta_visible' => false,
  181. 'list_tax_meta_visible' => false,
  182. 'list_post_date_u_visible' => false,
  183. 'list_category_meta_u_visible' => false,
  184. 'list_tag_meta_u_visible' => false,
  185. 'list_tax_meta_u_visible' => false,
  186. 'thumbnail_layout' => 'right',
  187. 'thumbnail_view_height' => 'fixed',
  188. 'top_description' => THK_DESCRIPTION,
  189. 'facebook_ogp_enable' => false,
  190. 'facebook_admin' => null,
  191. 'facebook_app_id' => null,
  192. 'twitter_card_enable' => false,
  193. 'twitter_id' => null,
  194. 'child_script' => false,
  195. 'html5shiv_load_type' => false,
  196. 'respondjs_load_type' => false,
  197. 'thk_emoji_disable' => false,
  198. 'thk_embed_disable' => false,
  199. 'css_search' => true,
  200. 'css_archive' => true,
  201. 'css_calendar' => true,
  202. 'css_new_post' => true,
  203. 'css_rcomments' => true,
  204. 'css_follow_button' => true,
  205. 'css_rss_feedly' => true,
  206. 'css_qr_code' => true,
  207. 'child_js_file_1' => null,
  208. 'child_js_file_2' => null,
  209. 'child_js_file_3' => null,
  210. 'overall_image' => 'white',
  211. 'body_color' => null,
  212. 'body_link_color' => null,
  213. 'body_hover_color' => null,
  214. 'breadcrumb_color' => null,
  215. 'head_color' => null,
  216. 'head_link_color' => null,
  217. 'head_hover_color' => null,
  218. 'foot_color' => null,
  219. 'foot_link_color' => null,
  220. 'foot_hover_color' => null,
  221. 'body_bg_color' => null,
  222. 'body_transparent' => 100,
  223. 'cont_bg_color' => null,
  224. 'cont_border_color' => null,
  225. 'cont_transparent' => 100,
  226. 'side_bg_color' => null,
  227. 'side_border_color' => null,
  228. 'side_transparent' => 100,
  229. 'head_bg_color' => null,
  230. 'head_border_color' => null,
  231. 'head_transparent' => 100,
  232. 'foot_bg_color' => null,
  233. 'foot_border_color' => null,
  234. 'foot_transparent' => 100,
  235. 'title_img' => null,
  236. 'body_bg_img' => null,
  237. 'body_img_vertical' => 'top',
  238. 'body_img_horizontal' => 'left',
  239. 'body_img_fixed' => false,
  240. 'body_img_transparent' => 0,
  241. 'body_img_repeat' => 'repeat',
  242. 'body_img_size' => 'auto',
  243. 'side_bg_img' => null,
  244. 'head_bg_img' => null,
  245. 'head_img_width_max' => false,
  246. 'head_img_vertical' => 'top',
  247. 'head_img_horizontal' => 'left',
  248. //'head_img_fixed' => false,
  249. 'head_img_repeat' => 'repeat',
  250. 'head_img_size' => 'auto',
  251. 'logo_img' => null,
  252. 'logo_img_up' => false,
  253. 'global_navi_open_close' => 'individual',
  254. 'global_navi_sticky' => 'none',
  255. 'global_navi_translucent' => false,
  256. 'global_navi_add_sep' => false,
  257. 'global_navi_auto_resize' => 'auto',
  258. 'gnavi_color' => null,
  259. 'gnavi_bar_bg_color' => null,
  260. 'gnavi_bg_color' => null,
  261. 'gnavi_bg_hover_color' => null,
  262. 'gnavi_bg_current_color' => null,
  263. 'gnavi_border_top_color' => null,
  264. 'gnavi_border_bottom_color' => null,
  265. 'gnavi_separator_color' => null,
  266. 'gnavi_border_top_width' => 1,
  267. 'gnavi_border_bottom_width' => 4,
  268. 'gnavi_top_buttom_padding' => 8,
  269. 'head_band_wide' => false,
  270. 'head_band_fixed' => false,
  271. 'head_band_height' => 28,
  272. 'head_band_color' => null,
  273. 'head_band_hover_color' => null,
  274. 'head_band_bg_color' => null,
  275. 'head_band_border_bottom_color' => null,
  276. 'head_band_border_bottom_width' => 1,
  277. 'head_band_follow_color' => false,
  278. 'head_band_twitter' => false,
  279. 'head_band_search' => false,
  280. 'head_search_color' => null,
  281. 'head_search_bg_color' => null,
  282. 'head_search_transparent' => 30,
  283. 'follow_twitter_id' => null,
  284. 'head_band_facebook' => false,
  285. 'follow_facebook_id' => null,
  286. 'head_band_hatena' => false,
  287. 'follow_hatena_id' => null,
  288. 'head_band_google' => false,
  289. 'follow_google_id' => null,
  290. 'head_band_youtube' => false,
  291. 'follow_youtube_id' => null,
  292. 'head_band_line' => false,
  293. 'follow_line_id' => null,
  294. 'parent_css_uncompress' => false,
  295. 'anime_sitename' => 'none',
  296. 'anime_thumbnail' => 'none',
  297. 'anime_sns_buttons' => 'none',
  298. 'anime_global_navi' => 'none',
  299. 'lazyload_enable' => false,
  300. 'lazyload_crawler' => false,
  301. 'lazyload_placeholder' => null,
  302. 'lazyload_spinner' => true,
  303. 'lazyload_threshold' => 0,
  304. 'lazyload_effect' => 'fadeIn',
  305. 'lazyload_effectspeed' => 1000,
  306. 'lazyload_event' => 'scroll',
  307. 'external_icon_type' => 'normal',
  308. 'external_icon_color' => null,
  309. 'add_external_icon' => false,
  310. 'add_target_blank' => false,
  311. 'add_rel_nofollow' => false,
  312. 'line_share_tops_button'=> false,
  313. 'rss_share_tops_button' => false,
  314. 'feedly_share_tops_button' => false,
  315. 'line_share_bottoms_button' => false,
  316. 'rss_share_bottoms_button' => false,
  317. 'feedly_share_bottoms_button' => false,
  318. 'sns_count_cache_enable' => false,
  319. 'sns_count_cache_force' => false,
  320. 'sns_tops_position' => 'left',
  321. 'sns_tops_count' => false,
  322. 'sns_tops_multiple' => false,
  323. 'sns_bottoms_position' => 'left',
  324. 'sns_bottoms_count' => false,
  325. 'sns_bottoms_multiple' => false,
  326. 'sns_fb_appid' => null,
  327. 'page_adsense_visible' => false,
  328. 'comment_search' => false,
  329. 'buffering_enable' => false,
  330. 'add_role_attribute' => false,
  331. 'remove_hentry_class' => false,
  332. 'enable_mb_slug' => false,
  333. 'categories_a_inner' => false,
  334. 'archives_a_inner' => false,
  335. 'sns_count_cache_cleanup' => false,
  336. 'thk_author_url' => THK_HOME_URL,
  337. 'all_clear' => false
  338. );
  339. return $defaults;
  340. }
  341. public function over_all_default_contents_background_color() {
  342. return array(
  343. 'white' => '#ffffff',
  344. 'pearl' => '#ffffff',
  345. 'coffee' => '#ffffff',
  346. 'dark' => '#ffffff',
  347. 'black' => '#000000',
  348. 'pure' => 'inherit'
  349. );
  350. }
  351. public function const_custom( $defaults = array() ) {
  352. $mods = wp_parse_args( get_theme_mods(), $defaults );
  353. foreach( $mods as $key => $val ) {
  354. if( ctype_digit( $val ) && $val == (int)$val ) {
  355. $mods[$key] = (int)apply_filters( 'theme_mod_' . $key, $val );
  356. }
  357. else {
  358. $mods[$key] = apply_filters( 'theme_mod_' . $key, $val );
  359. }
  360. }
  361. return( $mods );
  362. }
  363. public function optimize_wpthk_variable() {
  364. global $wpthk;
  365. foreach( $wpthk as $key => $val ) {
  366. if( empty( $val ) && $val !== 0 ) unset( $wpthk[$key] );
  367. if( ctype_digit( $val ) && $val == (int)$val ) {
  368. $wpthk[$key] = (int)$val;
  369. if( $key === 'facebook_admin' || $key === 'facebook_app_id' ||$key === 'twitter_id' ) {
  370. $wpthk[$key] = (string)$val;
  371. }
  372. }
  373. }
  374. // カラム操作で別々のカラムになってるかどうかの判別 Global 変数追加
  375. $wpthk['column_default'] = true;
  376. $wpthk['column_style'] = isset( $wpthk['column3'] ) ? $wpthk['column3'] : '2column';
  377. $column_home = isset( $wpthk['column_home'] ) ? $wpthk['column_home'] : 'default';
  378. $column_post = isset( $wpthk['column_post'] ) ? $wpthk['column_post'] : 'default';
  379. $column_page = isset( $wpthk['column_page'] ) ? $wpthk['column_page'] : 'default';
  380. $column_archive = isset( $wpthk['column_archive'] ) ? $wpthk['column_archive'] : 'default';
  381. $columns = array(
  382. $column_home,
  383. $column_post,
  384. $column_page,
  385. $column_archive
  386. );
  387. foreach( $columns as $col ) {
  388. if( $wpthk['column_style'] !== $col && $col !== 'default' ) {
  389. $wpthk['column_default'] = false;
  390. break;
  391. }
  392. }
  393. // アクセスされたテンプレートのカラム数を格納する Global 変数追加
  394. if( is_front_page() === true && isset( $wpthk['column_home'] ) && $wpthk['column_home'] !== 'default' ) {
  395. $wpthk['column_style'] = $wpthk['column_home'];
  396. }
  397. elseif( is_single() === true && isset( $wpthk['column_post'] ) && $wpthk['column_post'] !== 'default' ) {
  398. $wpthk['column_style'] = $wpthk['column_post'];
  399. }
  400. elseif( ( is_page() === true || is_404() === true ) && isset( $wpthk['column_page'] ) && $wpthk['column_page'] !== 'default' ) {
  401. $wpthk['column_style'] = $wpthk['column_page'];
  402. }
  403. elseif( ( is_archive() === true || is_search() === true ) && isset( $wpthk['column_archive'] ) && $wpthk['column_archive'] !== 'default' ) {
  404. $wpthk['column_style'] = $wpthk['column_archive'];
  405. }
  406. }
  407. }
  408. endif;