-
Notifications
You must be signed in to change notification settings - Fork 0
/
kintone-mw-wp-form.php
83 lines (74 loc) · 2.42 KB
/
kintone-mw-wp-form.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
<?php
/*
Plugin Name: MW WP Form kintone連携
Author: Akito Tsukahara Lifebook
Version: 1.0.0
*/
define('KMWF_VERSION', '1.0.0');
define('KMWF_PLUGIN_BASENAME', plugin_basename(__FILE__));
define('KMWF_PLUGIN_NAME', trim(dirname(KMWF_PLUGIN_BASENAME), '/'));
class Kintone_MW_WP_Form{
/**
* Kintone_MW_WP_Form constructor.
*/
public function __construct(){
add_action( 'plugins_loaded', array( $this, '_initialize' ), 11 );
add_action( 'after_setup_theme', array( $this, '_load_admin_initialize_files' ), 9 );
add_action( 'mwform_after_exec_shortcode', array( $this, '_load_initialize_files' ), 9 );
}
/**
* Load adminclasses
*
* @return void
*/
public function _load_admin_initialize_files() {
include_once( plugin_dir_path( __FILE__ ) . 'classes/class.admin.php' );
}
/**
* Load classes
*
* MW WP Formのショートコードが呼ばれた時にだけ処理を行う(無駄な呼び出しを控える為)
* @return void
*/
public function _load_initialize_files() {
include_once( plugin_dir_path( __FILE__ ) . 'classes/class.api.php' );
include_once( plugin_dir_path( __FILE__ ) . 'classes/class.filter.php' );
}
/**
* ページセットアップ
*
* @return void
*/
public function _initialize() {
//国際化用ファイルの読み込み
//load_plugin_textdomain( 'kintone-mw-wp-form' );
add_action( 'init', array( $this, '_self_made_post_type' ) );
}
/**
* カスタム投稿タイプ登録
*
* @return void
*/
function _self_made_post_type() {
register_post_type( 'kintone-mw-wp-form',
array(
'label' => 'kintone MW WP Form',
'public' => true,
'exclude_from_search' => true,
'show_ui' => true,
'show_in_menu' => true,
'menu_position' => 30,
'hierarchical' => true,
'has_archive' => true,
'with_front' => true,
'supports' => array(
'title',
'custom-fields',
'post-formats',
'revisions',
),
)
);
}
}
new Kintone_MW_WP_Form();