-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwasnap.php
107 lines (86 loc) · 4.1 KB
/
wasnap.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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
<?php
/**
* Plugin Name: Washington State SNAP Education
* Plugin URI: https://wasnap-ed.org
* Description: A custom plugin for Washington State SNAP Education
* Author: Tony DeStefano
* Version: 0.0.1
* Text Domain: wasnap
*
* Copyright 2016 Spokane WordPress Development
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License, version 2, as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
*/
require_once ( 'classes/WaSnap/Controller.php' );
require_once ( 'classes/WaSnap/Util.php' );
require_once ( 'classes/WaSnap/Provider.php' );
require_once ( 'classes/WaSnap/ProviderTable.php' );
require_once ( 'classes/WaSnap/Page.php' );
require_once ( 'classes/WaSnap/ForumPost.php' );
require_once ( 'classes/WaSnap/Question.php' );
require_once ( 'classes/WaSnap/Answer.php' );
require_once ( 'classes/WaSnap/ProviderResource.php' );
require_once ( 'classes/WaSnap/Email.php' );
$wasnap_controller = new \WaSnap\Controller;
/* activate */
register_activation_hook( __FILE__, array( $wasnap_controller, 'activate' ) );
/* enqueue js and css */
add_action( 'init', array( $wasnap_controller, 'init' ) );
/* capture form post */
add_action( 'init', array( $wasnap_controller, 'form_capture' ) );
/* register shortcode */
add_shortcode( 'wasnap', array( $wasnap_controller, 'short_code' ) );
/* add role */
add_action( 'init', array( $wasnap_controller, 'add_role' ) );
/* add post types */
add_action( 'init', array( $wasnap_controller, 'add_post_types' ) );
/* remove HTML editor for CPTs */
add_filter( 'user_can_richedit', array( $wasnap_controller, 'disable_richedit' ) );
add_action( 'wp_ajax_wasnap_dshs_message_save', function() use ( $wasnap_controller )
{
$wasnap_controller->dshs_message_save();
} );
add_action( 'wp_ajax_wasnap_dshs_message_delete', function() use ( $wasnap_controller )
{
$wasnap_controller->dshs_message_delete();
} );
add_filter ( 'wp_mail_content_type', array( $wasnap_controller, 'wp_mail_content_type' ) );
add_filter ( 'retrieve_password_message', array( $wasnap_controller, 'retrieve_password_message' ) );
/* admin stuff */
if ( is_admin() )
{
/* capture form post */
add_action( 'init', array( $wasnap_controller, 'download' ) );
/* Add main menu and sub-menus */
add_action( 'admin_menu', array( $wasnap_controller, 'admin_menus') );
/* register settings */
add_action( 'admin_init', array( $wasnap_controller, 'register_settings' ) );
/* admin scripts */
add_action( 'admin_init', array( $wasnap_controller, 'admin_scripts' ) );
/* add the settings page link */
add_filter( 'plugin_action_links_' . plugin_basename( __FILE__ ), array( $wasnap_controller, 'settings_link' ) );
/* redirect after ad user */
add_filter( 'wp_redirect', array( $wasnap_controller, 'redirect_after_add_user' ) );
/* extra user fields */
add_action( 'user_new_form', array( $wasnap_controller, 'extra_profile_fields' ) );
add_action( 'show_user_profile', array( $wasnap_controller, 'extra_profile_fields' ) );
add_action( 'edit_user_profile', array( $wasnap_controller, 'extra_profile_fields' ) );
add_action( 'personal_options_update', array( $wasnap_controller, 'save_extra_profile_fields' ) );
add_action( 'edit_user_profile_update', array( $wasnap_controller, 'save_extra_profile_fields' ) );
add_action( 'user_register', array( $wasnap_controller, 'save_extra_profile_fields' ) );
/* extra hopscotch column */
add_action( 'manage_wasnap_hopscotch_posts_custom_column', array( $wasnap_controller, 'set_hopscotch_custom_columns' ) );
add_filter( 'manage_wasnap_hopscotch_posts_columns', array( $wasnap_controller, 'set_hopscotch_columns' ) );
}