@@ -51,7 +51,7 @@ |
||
51 | 51 | */ |
52 | 52 | public function wp_user_obj() |
53 | 53 | { |
54 | - if (! $this->_wp_user_obj) { |
|
54 | + if ( ! $this->_wp_user_obj) { |
|
55 | 55 | $this->_wp_user_obj = get_user_by('ID', $this->ID()); |
56 | 56 | } |
57 | 57 | return $this->_wp_user_obj; |
@@ -11,91 +11,91 @@ |
||
11 | 11 | class EE_WP_User extends EE_Base_Class implements EEI_Admin_Links |
12 | 12 | { |
13 | 13 | |
14 | - /** |
|
15 | - * @var WP_User |
|
16 | - */ |
|
17 | - protected $_wp_user_obj; |
|
14 | + /** |
|
15 | + * @var WP_User |
|
16 | + */ |
|
17 | + protected $_wp_user_obj; |
|
18 | 18 | |
19 | - /** |
|
20 | - * @param array $props_n_values |
|
21 | - * @return EE_WP_User|mixed |
|
22 | - */ |
|
23 | - public static function new_instance($props_n_values = array()) |
|
24 | - { |
|
25 | - $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
26 | - return $has_object ? $has_object : new self($props_n_values); |
|
27 | - } |
|
19 | + /** |
|
20 | + * @param array $props_n_values |
|
21 | + * @return EE_WP_User|mixed |
|
22 | + */ |
|
23 | + public static function new_instance($props_n_values = array()) |
|
24 | + { |
|
25 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
26 | + return $has_object ? $has_object : new self($props_n_values); |
|
27 | + } |
|
28 | 28 | |
29 | 29 | |
30 | - /** |
|
31 | - * @param array $props_n_values |
|
32 | - * @return EE_WP_User |
|
33 | - */ |
|
34 | - public static function new_instance_from_db($props_n_values = array()) |
|
35 | - { |
|
36 | - return new self($props_n_values, true); |
|
37 | - } |
|
30 | + /** |
|
31 | + * @param array $props_n_values |
|
32 | + * @return EE_WP_User |
|
33 | + */ |
|
34 | + public static function new_instance_from_db($props_n_values = array()) |
|
35 | + { |
|
36 | + return new self($props_n_values, true); |
|
37 | + } |
|
38 | 38 | |
39 | - /** |
|
40 | - * Return a normal WP_User object (caches the object for future calls) |
|
41 | - * |
|
42 | - * @return WP_User |
|
43 | - */ |
|
44 | - public function wp_user_obj() |
|
45 | - { |
|
46 | - if (! $this->_wp_user_obj) { |
|
47 | - $this->_wp_user_obj = get_user_by('ID', $this->ID()); |
|
48 | - } |
|
49 | - return $this->_wp_user_obj; |
|
50 | - } |
|
39 | + /** |
|
40 | + * Return a normal WP_User object (caches the object for future calls) |
|
41 | + * |
|
42 | + * @return WP_User |
|
43 | + */ |
|
44 | + public function wp_user_obj() |
|
45 | + { |
|
46 | + if (! $this->_wp_user_obj) { |
|
47 | + $this->_wp_user_obj = get_user_by('ID', $this->ID()); |
|
48 | + } |
|
49 | + return $this->_wp_user_obj; |
|
50 | + } |
|
51 | 51 | |
52 | - /** |
|
53 | - * Return the link to the admin details for the object. |
|
54 | - * |
|
55 | - * @return string |
|
56 | - */ |
|
57 | - public function get_admin_details_link() |
|
58 | - { |
|
59 | - return $this->get_admin_edit_link(); |
|
60 | - } |
|
52 | + /** |
|
53 | + * Return the link to the admin details for the object. |
|
54 | + * |
|
55 | + * @return string |
|
56 | + */ |
|
57 | + public function get_admin_details_link() |
|
58 | + { |
|
59 | + return $this->get_admin_edit_link(); |
|
60 | + } |
|
61 | 61 | |
62 | - /** |
|
63 | - * Returns the link to the editor for the object. Sometimes this is the same as the details. |
|
64 | - * |
|
65 | - * @return string |
|
66 | - */ |
|
67 | - public function get_admin_edit_link() |
|
68 | - { |
|
69 | - return esc_url( |
|
70 | - add_query_arg( |
|
71 | - 'wp_http_referer', |
|
72 | - urlencode( |
|
73 | - wp_unslash( |
|
74 | - $_SERVER['REQUEST_URI'] |
|
75 | - ) |
|
76 | - ), |
|
77 | - get_edit_user_link($this->ID()) |
|
78 | - ) |
|
79 | - ); |
|
80 | - } |
|
62 | + /** |
|
63 | + * Returns the link to the editor for the object. Sometimes this is the same as the details. |
|
64 | + * |
|
65 | + * @return string |
|
66 | + */ |
|
67 | + public function get_admin_edit_link() |
|
68 | + { |
|
69 | + return esc_url( |
|
70 | + add_query_arg( |
|
71 | + 'wp_http_referer', |
|
72 | + urlencode( |
|
73 | + wp_unslash( |
|
74 | + $_SERVER['REQUEST_URI'] |
|
75 | + ) |
|
76 | + ), |
|
77 | + get_edit_user_link($this->ID()) |
|
78 | + ) |
|
79 | + ); |
|
80 | + } |
|
81 | 81 | |
82 | - /** |
|
83 | - * Returns the link to a settings page for the object. |
|
84 | - * |
|
85 | - * @return string |
|
86 | - */ |
|
87 | - public function get_admin_settings_link() |
|
88 | - { |
|
89 | - return $this->get_admin_edit_link(); |
|
90 | - } |
|
82 | + /** |
|
83 | + * Returns the link to a settings page for the object. |
|
84 | + * |
|
85 | + * @return string |
|
86 | + */ |
|
87 | + public function get_admin_settings_link() |
|
88 | + { |
|
89 | + return $this->get_admin_edit_link(); |
|
90 | + } |
|
91 | 91 | |
92 | - /** |
|
93 | - * Returns the link to the "overview" for the object (typically the "list table" view). |
|
94 | - * |
|
95 | - * @return string |
|
96 | - */ |
|
97 | - public function get_admin_overview_link() |
|
98 | - { |
|
99 | - return admin_url('users.php'); |
|
100 | - } |
|
92 | + /** |
|
93 | + * Returns the link to the "overview" for the object (typically the "list table" view). |
|
94 | + * |
|
95 | + * @return string |
|
96 | + */ |
|
97 | + public function get_admin_overview_link() |
|
98 | + { |
|
99 | + return admin_url('users.php'); |
|
100 | + } |
|
101 | 101 | } |
@@ -7,16 +7,16 @@ discard block |
||
7 | 7 | define('EE_SUPPORT_EMAIL', '[email protected]'); |
8 | 8 | // used to be DIRECTORY_SEPARATOR, but that caused issues on windows |
9 | 9 | if (! defined('DS')) { |
10 | - define('DS', '/'); |
|
10 | + define('DS', '/'); |
|
11 | 11 | } |
12 | 12 | if (! defined('PS')) { |
13 | - define('PS', PATH_SEPARATOR); |
|
13 | + define('PS', PATH_SEPARATOR); |
|
14 | 14 | } |
15 | 15 | if (! defined('SP')) { |
16 | - define('SP', ' '); |
|
16 | + define('SP', ' '); |
|
17 | 17 | } |
18 | 18 | if (! defined('EENL')) { |
19 | - define('EENL', "\n"); |
|
19 | + define('EENL', "\n"); |
|
20 | 20 | } |
21 | 21 | // define the plugin directory and URL |
22 | 22 | define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE)); |
@@ -70,16 +70,16 @@ discard block |
||
70 | 70 | define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS); |
71 | 71 | // check for DOMPDF fonts in uploads |
72 | 72 | if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS)) { |
73 | - define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS); |
|
73 | + define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS); |
|
74 | 74 | } |
75 | 75 | // ajax constants |
76 | 76 | define( |
77 | - 'EE_FRONT_AJAX', |
|
78 | - isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) |
|
77 | + 'EE_FRONT_AJAX', |
|
78 | + isset($_REQUEST['ee_front_ajax']) || isset($_REQUEST['data']['ee_front_ajax']) |
|
79 | 79 | ); |
80 | 80 | define( |
81 | - 'EE_ADMIN_AJAX', |
|
82 | - isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) |
|
81 | + 'EE_ADMIN_AJAX', |
|
82 | + isset($_REQUEST['ee_admin_ajax']) || isset($_REQUEST['data']['ee_admin_ajax']) |
|
83 | 83 | ); |
84 | 84 | // just a handy constant occasionally needed for finding values representing infinity in the DB |
85 | 85 | // you're better to use this than its straight value (currently -1) in case you ever |
@@ -89,5 +89,5 @@ discard block |
||
89 | 89 | define('EE_DEBUG', false); |
90 | 90 | // for older WP versions |
91 | 91 | if (! defined('MONTH_IN_SECONDS')) { |
92 | - define('MONTH_IN_SECONDS', DAY_IN_SECONDS * 30); |
|
92 | + define('MONTH_IN_SECONDS', DAY_IN_SECONDS * 30); |
|
93 | 93 | } |
@@ -6,71 +6,71 @@ discard block |
||
6 | 6 | define('EE_MIN_PHP_VER_RECOMMENDED', '5.6.32'); |
7 | 7 | define('EE_SUPPORT_EMAIL', '[email protected]'); |
8 | 8 | // used to be DIRECTORY_SEPARATOR, but that caused issues on windows |
9 | -if (! defined('DS')) { |
|
9 | +if ( ! defined('DS')) { |
|
10 | 10 | define('DS', '/'); |
11 | 11 | } |
12 | -if (! defined('PS')) { |
|
12 | +if ( ! defined('PS')) { |
|
13 | 13 | define('PS', PATH_SEPARATOR); |
14 | 14 | } |
15 | -if (! defined('SP')) { |
|
15 | +if ( ! defined('SP')) { |
|
16 | 16 | define('SP', ' '); |
17 | 17 | } |
18 | -if (! defined('EENL')) { |
|
18 | +if ( ! defined('EENL')) { |
|
19 | 19 | define('EENL', "\n"); |
20 | 20 | } |
21 | 21 | // define the plugin directory and URL |
22 | 22 | define('EE_PLUGIN_BASENAME', plugin_basename(EVENT_ESPRESSO_MAIN_FILE)); |
23 | -define('EE_PLUGIN_DIR_PATH', dirname(EVENT_ESPRESSO_MAIN_FILE) . DS); |
|
23 | +define('EE_PLUGIN_DIR_PATH', dirname(EVENT_ESPRESSO_MAIN_FILE).DS); |
|
24 | 24 | define('EE_PLUGIN_DIR_URL', plugin_dir_url(EVENT_ESPRESSO_MAIN_FILE)); |
25 | 25 | // main root folder paths |
26 | -define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH . 'admin_pages' . DS); |
|
27 | -define('EE_CORE', EE_PLUGIN_DIR_PATH . 'core' . DS); |
|
28 | -define('EE_MODULES', EE_PLUGIN_DIR_PATH . 'modules' . DS); |
|
29 | -define('EE_PUBLIC', EE_PLUGIN_DIR_PATH . 'public' . DS); |
|
30 | -define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH . 'shortcodes' . DS); |
|
31 | -define('EE_WIDGETS', EE_PLUGIN_DIR_PATH . 'widgets' . DS); |
|
32 | -define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH . 'payment_methods' . DS); |
|
33 | -define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH . 'caffeinated' . DS); |
|
26 | +define('EE_ADMIN_PAGES', EE_PLUGIN_DIR_PATH.'admin_pages'.DS); |
|
27 | +define('EE_CORE', EE_PLUGIN_DIR_PATH.'core'.DS); |
|
28 | +define('EE_MODULES', EE_PLUGIN_DIR_PATH.'modules'.DS); |
|
29 | +define('EE_PUBLIC', EE_PLUGIN_DIR_PATH.'public'.DS); |
|
30 | +define('EE_SHORTCODES', EE_PLUGIN_DIR_PATH.'shortcodes'.DS); |
|
31 | +define('EE_WIDGETS', EE_PLUGIN_DIR_PATH.'widgets'.DS); |
|
32 | +define('EE_PAYMENT_METHODS', EE_PLUGIN_DIR_PATH.'payment_methods'.DS); |
|
33 | +define('EE_CAFF_PATH', EE_PLUGIN_DIR_PATH.'caffeinated'.DS); |
|
34 | 34 | // core system paths |
35 | -define('EE_ADMIN', EE_CORE . 'admin' . DS); |
|
36 | -define('EE_CPTS', EE_CORE . 'CPTs' . DS); |
|
37 | -define('EE_CLASSES', EE_CORE . 'db_classes' . DS); |
|
38 | -define('EE_INTERFACES', EE_CORE . 'interfaces' . DS); |
|
39 | -define('EE_BUSINESS', EE_CORE . 'business' . DS); |
|
40 | -define('EE_MODELS', EE_CORE . 'db_models' . DS); |
|
41 | -define('EE_HELPERS', EE_CORE . 'helpers' . DS); |
|
42 | -define('EE_LIBRARIES', EE_CORE . 'libraries' . DS); |
|
43 | -define('EE_TEMPLATES', EE_CORE . 'templates' . DS); |
|
44 | -define('EE_THIRD_PARTY', EE_CORE . 'third_party_libs' . DS); |
|
45 | -define('EE_GLOBAL_ASSETS', EE_TEMPLATES . 'global_assets' . DS); |
|
46 | -define('EE_FORM_SECTIONS', EE_LIBRARIES . 'form_sections' . DS); |
|
35 | +define('EE_ADMIN', EE_CORE.'admin'.DS); |
|
36 | +define('EE_CPTS', EE_CORE.'CPTs'.DS); |
|
37 | +define('EE_CLASSES', EE_CORE.'db_classes'.DS); |
|
38 | +define('EE_INTERFACES', EE_CORE.'interfaces'.DS); |
|
39 | +define('EE_BUSINESS', EE_CORE.'business'.DS); |
|
40 | +define('EE_MODELS', EE_CORE.'db_models'.DS); |
|
41 | +define('EE_HELPERS', EE_CORE.'helpers'.DS); |
|
42 | +define('EE_LIBRARIES', EE_CORE.'libraries'.DS); |
|
43 | +define('EE_TEMPLATES', EE_CORE.'templates'.DS); |
|
44 | +define('EE_THIRD_PARTY', EE_CORE.'third_party_libs'.DS); |
|
45 | +define('EE_GLOBAL_ASSETS', EE_TEMPLATES.'global_assets'.DS); |
|
46 | +define('EE_FORM_SECTIONS', EE_LIBRARIES.'form_sections'.DS); |
|
47 | 47 | // gateways |
48 | -define('EE_GATEWAYS', EE_MODULES . 'gateways' . DS); |
|
49 | -define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL . 'modules' . DS . 'gateways' . DS); |
|
48 | +define('EE_GATEWAYS', EE_MODULES.'gateways'.DS); |
|
49 | +define('EE_GATEWAYS_URL', EE_PLUGIN_DIR_URL.'modules'.DS.'gateways'.DS); |
|
50 | 50 | // asset URL paths |
51 | -define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'templates' . DS); |
|
52 | -define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL . 'global_assets' . DS); |
|
53 | -define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL . 'images' . DS); |
|
54 | -define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL . 'core' . DS . 'third_party_libs' . DS); |
|
55 | -define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL . 'core/helpers/assets/'); |
|
56 | -define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL . 'core/libraries/'); |
|
51 | +define('EE_TEMPLATES_URL', EE_PLUGIN_DIR_URL.'core'.DS.'templates'.DS); |
|
52 | +define('EE_GLOBAL_ASSETS_URL', EE_TEMPLATES_URL.'global_assets'.DS); |
|
53 | +define('EE_IMAGES_URL', EE_GLOBAL_ASSETS_URL.'images'.DS); |
|
54 | +define('EE_THIRD_PARTY_URL', EE_PLUGIN_DIR_URL.'core'.DS.'third_party_libs'.DS); |
|
55 | +define('EE_HELPERS_ASSETS', EE_PLUGIN_DIR_URL.'core/helpers/assets/'); |
|
56 | +define('EE_LIBRARIES_URL', EE_PLUGIN_DIR_URL.'core/libraries/'); |
|
57 | 57 | // define upload paths |
58 | 58 | $uploads = wp_upload_dir(); |
59 | 59 | // define the uploads directory and URL |
60 | -define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'] . DS . 'espresso' . DS); |
|
61 | -define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'] . DS . 'espresso' . DS); |
|
60 | +define('EVENT_ESPRESSO_UPLOAD_DIR', $uploads['basedir'].DS.'espresso'.DS); |
|
61 | +define('EVENT_ESPRESSO_UPLOAD_URL', $uploads['baseurl'].DS.'espresso'.DS); |
|
62 | 62 | // define the templates directory and URL |
63 | -define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'templates' . DS); |
|
64 | -define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'templates' . DS); |
|
63 | +define('EVENT_ESPRESSO_TEMPLATE_DIR', $uploads['basedir'].DS.'espresso'.DS.'templates'.DS); |
|
64 | +define('EVENT_ESPRESSO_TEMPLATE_URL', $uploads['baseurl'].DS.'espresso'.DS.'templates'.DS); |
|
65 | 65 | // define the gateway directory and URL |
66 | -define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'] . DS . 'espresso' . DS . 'gateways' . DS); |
|
67 | -define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'] . DS . 'espresso' . DS . 'gateways' . DS); |
|
66 | +define('EVENT_ESPRESSO_GATEWAY_DIR', $uploads['basedir'].DS.'espresso'.DS.'gateways'.DS); |
|
67 | +define('EVENT_ESPRESSO_GATEWAY_URL', $uploads['baseurl'].DS.'espresso'.DS.'gateways'.DS); |
|
68 | 68 | // languages folder/path |
69 | -define('EE_LANGUAGES_SAFE_LOC', '..' . DS . 'uploads' . DS . 'espresso' . DS . 'languages' . DS); |
|
70 | -define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'languages' . DS); |
|
69 | +define('EE_LANGUAGES_SAFE_LOC', '..'.DS.'uploads'.DS.'espresso'.DS.'languages'.DS); |
|
70 | +define('EE_LANGUAGES_SAFE_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'languages'.DS); |
|
71 | 71 | // check for DOMPDF fonts in uploads |
72 | -if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS)) { |
|
73 | - define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR . 'fonts' . DS); |
|
72 | +if (file_exists(EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS)) { |
|
73 | + define('DOMPDF_FONT_DIR', EVENT_ESPRESSO_UPLOAD_DIR.'fonts'.DS); |
|
74 | 74 | } |
75 | 75 | // ajax constants |
76 | 76 | define( |
@@ -88,6 +88,6 @@ discard block |
||
88 | 88 | define('EE_INF', INF > (float) PHP_INT_MAX ? INF : PHP_INT_MAX); |
89 | 89 | define('EE_DEBUG', false); |
90 | 90 | // for older WP versions |
91 | -if (! defined('MONTH_IN_SECONDS')) { |
|
91 | +if ( ! defined('MONTH_IN_SECONDS')) { |
|
92 | 92 | define('MONTH_IN_SECONDS', DAY_IN_SECONDS * 30); |
93 | 93 | } |
@@ -6,22 +6,22 @@ discard block |
||
6 | 6 | */ |
7 | 7 | function espresso_load_error_handling() |
8 | 8 | { |
9 | - static $error_handling_loaded = false; |
|
10 | - if ($error_handling_loaded) { |
|
11 | - return; |
|
12 | - } |
|
13 | - // load debugging tools |
|
14 | - if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) { |
|
15 | - require_once EE_HELPERS . 'EEH_Debug_Tools.helper.php'; |
|
16 | - \EEH_Debug_Tools::instance(); |
|
17 | - } |
|
18 | - // load error handling |
|
19 | - if (is_readable(EE_CORE . 'EE_Error.core.php')) { |
|
20 | - require_once EE_CORE . 'EE_Error.core.php'; |
|
21 | - } else { |
|
22 | - wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso')); |
|
23 | - } |
|
24 | - $error_handling_loaded = true; |
|
9 | + static $error_handling_loaded = false; |
|
10 | + if ($error_handling_loaded) { |
|
11 | + return; |
|
12 | + } |
|
13 | + // load debugging tools |
|
14 | + if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) { |
|
15 | + require_once EE_HELPERS . 'EEH_Debug_Tools.helper.php'; |
|
16 | + \EEH_Debug_Tools::instance(); |
|
17 | + } |
|
18 | + // load error handling |
|
19 | + if (is_readable(EE_CORE . 'EE_Error.core.php')) { |
|
20 | + require_once EE_CORE . 'EE_Error.core.php'; |
|
21 | + } else { |
|
22 | + wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso')); |
|
23 | + } |
|
24 | + $error_handling_loaded = true; |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | |
@@ -35,19 +35,19 @@ discard block |
||
35 | 35 | */ |
36 | 36 | function espresso_load_required($classname, $full_path_to_file) |
37 | 37 | { |
38 | - if (is_readable($full_path_to_file)) { |
|
39 | - require_once $full_path_to_file; |
|
40 | - } else { |
|
41 | - throw new \EE_Error( |
|
42 | - sprintf( |
|
43 | - esc_html__( |
|
44 | - 'The %s class file could not be located or is not readable due to file permissions.', |
|
45 | - 'event_espresso' |
|
46 | - ), |
|
47 | - $classname |
|
48 | - ) |
|
49 | - ); |
|
50 | - } |
|
38 | + if (is_readable($full_path_to_file)) { |
|
39 | + require_once $full_path_to_file; |
|
40 | + } else { |
|
41 | + throw new \EE_Error( |
|
42 | + sprintf( |
|
43 | + esc_html__( |
|
44 | + 'The %s class file could not be located or is not readable due to file permissions.', |
|
45 | + 'event_espresso' |
|
46 | + ), |
|
47 | + $classname |
|
48 | + ) |
|
49 | + ); |
|
50 | + } |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | |
@@ -66,39 +66,39 @@ discard block |
||
66 | 66 | */ |
67 | 67 | function bootstrap_espresso() |
68 | 68 | { |
69 | - require_once __DIR__ . '/espresso_definitions.php'; |
|
70 | - try { |
|
71 | - espresso_load_error_handling(); |
|
72 | - espresso_load_required( |
|
73 | - 'EEH_Base', |
|
74 | - EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' |
|
75 | - ); |
|
76 | - espresso_load_required( |
|
77 | - 'EEH_File', |
|
78 | - EE_CORE . 'interfaces' . DS . 'EEHI_File.interface.php' |
|
79 | - ); |
|
80 | - espresso_load_required( |
|
81 | - 'EEH_File', |
|
82 | - EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' |
|
83 | - ); |
|
84 | - espresso_load_required( |
|
85 | - 'EEH_Array', |
|
86 | - EE_CORE . 'helpers' . DS . 'EEH_Array.helper.php' |
|
87 | - ); |
|
88 | - // instantiate and configure PSR4 autoloader |
|
89 | - espresso_load_required( |
|
90 | - 'Psr4Autoloader', |
|
91 | - EE_CORE . 'Psr4Autoloader.php' |
|
92 | - ); |
|
93 | - espresso_load_required( |
|
94 | - 'EE_Psr4AutoloaderInit', |
|
95 | - EE_CORE . 'EE_Psr4AutoloaderInit.core.php' |
|
96 | - ); |
|
97 | - $AutoloaderInit = new EE_Psr4AutoloaderInit(); |
|
98 | - $AutoloaderInit->initializeAutoloader(); |
|
99 | - new EventEspresso\core\services\bootstrap\BootstrapCore(); |
|
100 | - } catch (Exception $e) { |
|
101 | - require_once EE_CORE . 'exceptions' . DS . 'ExceptionStackTraceDisplay.php'; |
|
102 | - new EventEspresso\core\exceptions\ExceptionStackTraceDisplay($e); |
|
103 | - } |
|
69 | + require_once __DIR__ . '/espresso_definitions.php'; |
|
70 | + try { |
|
71 | + espresso_load_error_handling(); |
|
72 | + espresso_load_required( |
|
73 | + 'EEH_Base', |
|
74 | + EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' |
|
75 | + ); |
|
76 | + espresso_load_required( |
|
77 | + 'EEH_File', |
|
78 | + EE_CORE . 'interfaces' . DS . 'EEHI_File.interface.php' |
|
79 | + ); |
|
80 | + espresso_load_required( |
|
81 | + 'EEH_File', |
|
82 | + EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' |
|
83 | + ); |
|
84 | + espresso_load_required( |
|
85 | + 'EEH_Array', |
|
86 | + EE_CORE . 'helpers' . DS . 'EEH_Array.helper.php' |
|
87 | + ); |
|
88 | + // instantiate and configure PSR4 autoloader |
|
89 | + espresso_load_required( |
|
90 | + 'Psr4Autoloader', |
|
91 | + EE_CORE . 'Psr4Autoloader.php' |
|
92 | + ); |
|
93 | + espresso_load_required( |
|
94 | + 'EE_Psr4AutoloaderInit', |
|
95 | + EE_CORE . 'EE_Psr4AutoloaderInit.core.php' |
|
96 | + ); |
|
97 | + $AutoloaderInit = new EE_Psr4AutoloaderInit(); |
|
98 | + $AutoloaderInit->initializeAutoloader(); |
|
99 | + new EventEspresso\core\services\bootstrap\BootstrapCore(); |
|
100 | + } catch (Exception $e) { |
|
101 | + require_once EE_CORE . 'exceptions' . DS . 'ExceptionStackTraceDisplay.php'; |
|
102 | + new EventEspresso\core\exceptions\ExceptionStackTraceDisplay($e); |
|
103 | + } |
|
104 | 104 | } |
@@ -11,13 +11,13 @@ discard block |
||
11 | 11 | return; |
12 | 12 | } |
13 | 13 | // load debugging tools |
14 | - if (WP_DEBUG === true && is_readable(EE_HELPERS . 'EEH_Debug_Tools.helper.php')) { |
|
15 | - require_once EE_HELPERS . 'EEH_Debug_Tools.helper.php'; |
|
14 | + if (WP_DEBUG === true && is_readable(EE_HELPERS.'EEH_Debug_Tools.helper.php')) { |
|
15 | + require_once EE_HELPERS.'EEH_Debug_Tools.helper.php'; |
|
16 | 16 | \EEH_Debug_Tools::instance(); |
17 | 17 | } |
18 | 18 | // load error handling |
19 | - if (is_readable(EE_CORE . 'EE_Error.core.php')) { |
|
20 | - require_once EE_CORE . 'EE_Error.core.php'; |
|
19 | + if (is_readable(EE_CORE.'EE_Error.core.php')) { |
|
20 | + require_once EE_CORE.'EE_Error.core.php'; |
|
21 | 21 | } else { |
22 | 22 | wp_die(esc_html__('The EE_Error core class could not be loaded.', 'event_espresso')); |
23 | 23 | } |
@@ -66,39 +66,39 @@ discard block |
||
66 | 66 | */ |
67 | 67 | function bootstrap_espresso() |
68 | 68 | { |
69 | - require_once __DIR__ . '/espresso_definitions.php'; |
|
69 | + require_once __DIR__.'/espresso_definitions.php'; |
|
70 | 70 | try { |
71 | 71 | espresso_load_error_handling(); |
72 | 72 | espresso_load_required( |
73 | 73 | 'EEH_Base', |
74 | - EE_CORE . 'helpers' . DS . 'EEH_Base.helper.php' |
|
74 | + EE_CORE.'helpers'.DS.'EEH_Base.helper.php' |
|
75 | 75 | ); |
76 | 76 | espresso_load_required( |
77 | 77 | 'EEH_File', |
78 | - EE_CORE . 'interfaces' . DS . 'EEHI_File.interface.php' |
|
78 | + EE_CORE.'interfaces'.DS.'EEHI_File.interface.php' |
|
79 | 79 | ); |
80 | 80 | espresso_load_required( |
81 | 81 | 'EEH_File', |
82 | - EE_CORE . 'helpers' . DS . 'EEH_File.helper.php' |
|
82 | + EE_CORE.'helpers'.DS.'EEH_File.helper.php' |
|
83 | 83 | ); |
84 | 84 | espresso_load_required( |
85 | 85 | 'EEH_Array', |
86 | - EE_CORE . 'helpers' . DS . 'EEH_Array.helper.php' |
|
86 | + EE_CORE.'helpers'.DS.'EEH_Array.helper.php' |
|
87 | 87 | ); |
88 | 88 | // instantiate and configure PSR4 autoloader |
89 | 89 | espresso_load_required( |
90 | 90 | 'Psr4Autoloader', |
91 | - EE_CORE . 'Psr4Autoloader.php' |
|
91 | + EE_CORE.'Psr4Autoloader.php' |
|
92 | 92 | ); |
93 | 93 | espresso_load_required( |
94 | 94 | 'EE_Psr4AutoloaderInit', |
95 | - EE_CORE . 'EE_Psr4AutoloaderInit.core.php' |
|
95 | + EE_CORE.'EE_Psr4AutoloaderInit.core.php' |
|
96 | 96 | ); |
97 | 97 | $AutoloaderInit = new EE_Psr4AutoloaderInit(); |
98 | 98 | $AutoloaderInit->initializeAutoloader(); |
99 | 99 | new EventEspresso\core\services\bootstrap\BootstrapCore(); |
100 | 100 | } catch (Exception $e) { |
101 | - require_once EE_CORE . 'exceptions' . DS . 'ExceptionStackTraceDisplay.php'; |
|
101 | + require_once EE_CORE.'exceptions'.DS.'ExceptionStackTraceDisplay.php'; |
|
102 | 102 | new EventEspresso\core\exceptions\ExceptionStackTraceDisplay($e); |
103 | 103 | } |
104 | 104 | } |
@@ -15,403 +15,403 @@ |
||
15 | 15 | class EE_SPCO_JSON_Response |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
19 | - * @var string |
|
20 | - */ |
|
21 | - protected $_errors = ''; |
|
22 | - |
|
23 | - /** |
|
24 | - * @var string |
|
25 | - */ |
|
26 | - protected $_unexpected_errors = ''; |
|
27 | - |
|
28 | - /** |
|
29 | - * @var string |
|
30 | - */ |
|
31 | - protected $_attention = ''; |
|
32 | - |
|
33 | - /** |
|
34 | - * @var string |
|
35 | - */ |
|
36 | - protected $_success = ''; |
|
37 | - |
|
38 | - /** |
|
39 | - * @var string |
|
40 | - */ |
|
41 | - protected $_plz_select_method_of_payment = ''; |
|
42 | - |
|
43 | - /** |
|
44 | - * @var string |
|
45 | - */ |
|
46 | - protected $_redirect_url = ''; |
|
47 | - |
|
48 | - /** |
|
49 | - * @var string |
|
50 | - */ |
|
51 | - protected $_registration_time_limit = ''; |
|
52 | - |
|
53 | - /** |
|
54 | - * @var string |
|
55 | - */ |
|
56 | - protected $_redirect_form = ''; |
|
57 | - |
|
58 | - /** |
|
59 | - * @var string |
|
60 | - */ |
|
61 | - protected $_reg_step_html = ''; |
|
62 | - |
|
63 | - /** |
|
64 | - * @var string |
|
65 | - */ |
|
66 | - protected $_method_of_payment = ''; |
|
67 | - |
|
68 | - /** |
|
69 | - * @var float |
|
70 | - */ |
|
71 | - protected $_payment_amount; |
|
72 | - |
|
73 | - /** |
|
74 | - * @var array |
|
75 | - */ |
|
76 | - protected $_return_data = array(); |
|
77 | - |
|
78 | - |
|
79 | - /** |
|
80 | - * @var array |
|
81 | - */ |
|
82 | - protected $_validation_rules = array(); |
|
83 | - |
|
84 | - |
|
85 | - /** |
|
86 | - * class constructor |
|
87 | - */ |
|
88 | - public function __construct() |
|
89 | - { |
|
90 | - } |
|
91 | - |
|
92 | - |
|
93 | - /** |
|
94 | - * __toString |
|
95 | - * |
|
96 | - * allows you to simply echo or print an EE_SPCO_JSON_Response object to produce a JSON encoded string |
|
97 | - * ie: $json_response = new EE_SPCO_JSON_Response(); |
|
98 | - * echo $json_response; |
|
99 | - * |
|
100 | - * @access public |
|
101 | - * @return string |
|
102 | - */ |
|
103 | - public function __toString() |
|
104 | - { |
|
105 | - $JSON_response = array(); |
|
106 | - // grab notices |
|
107 | - $notices = EE_Error::get_notices(false); |
|
108 | - $this->set_attention(isset($notices['attention']) ? $notices['attention'] : ''); |
|
109 | - $this->set_errors(isset($notices['errors']) ? $notices['errors'] : ''); |
|
110 | - $this->set_success(isset($notices['success']) ? $notices['success'] : ''); |
|
111 | - // add notices to JSON response, but only if they exist |
|
112 | - if ($this->attention()) { |
|
113 | - $JSON_response['attention'] = $this->attention(); |
|
114 | - } |
|
115 | - if ($this->errors()) { |
|
116 | - $JSON_response['errors'] = $this->errors(); |
|
117 | - } |
|
118 | - if ($this->unexpected_errors()) { |
|
119 | - $JSON_response['unexpected_errors'] = $this->unexpected_errors(); |
|
120 | - } |
|
121 | - if ($this->success()) { |
|
122 | - $JSON_response['success'] = $this->success(); |
|
123 | - } |
|
124 | - // but if NO notices are set... at least set the "success" as a key so that the JS knows everything worked |
|
125 | - if (! isset($JSON_response['attention']) && ! isset($JSON_response['errors']) && ! isset($JSON_response['success'])) { |
|
126 | - $JSON_response['success'] = null; |
|
127 | - } |
|
128 | - // set redirect_url, IF it exists |
|
129 | - if ($this->redirect_url()) { |
|
130 | - $JSON_response['redirect_url'] = $this->redirect_url(); |
|
131 | - } |
|
132 | - // set registration_time_limit, IF it exists |
|
133 | - if ($this->registration_time_limit()) { |
|
134 | - $JSON_response['registration_time_limit'] = $this->registration_time_limit(); |
|
135 | - } |
|
136 | - // set payment_amount, IF it exists |
|
137 | - if ($this->payment_amount() !== null) { |
|
138 | - $JSON_response['payment_amount'] = $this->payment_amount(); |
|
139 | - } |
|
140 | - // grab generic return data |
|
141 | - $return_data = $this->return_data(); |
|
142 | - // add billing form validation rules |
|
143 | - if ($this->validation_rules()) { |
|
144 | - $return_data['validation_rules'] = $this->validation_rules(); |
|
145 | - } |
|
146 | - // set reg_step_html, IF it exists |
|
147 | - if ($this->reg_step_html()) { |
|
148 | - $return_data['reg_step_html'] = $this->reg_step_html(); |
|
149 | - } |
|
150 | - // set method of payment, IF it exists |
|
151 | - if ($this->method_of_payment()) { |
|
152 | - $return_data['method_of_payment'] = $this->method_of_payment(); |
|
153 | - } |
|
154 | - // set "plz_select_method_of_payment" message, IF it exists |
|
155 | - if ($this->plz_select_method_of_payment()) { |
|
156 | - $return_data['plz_select_method_of_payment'] = $this->plz_select_method_of_payment(); |
|
157 | - } |
|
158 | - // set redirect_form, IF it exists |
|
159 | - if ($this->redirect_form()) { |
|
160 | - $return_data['redirect_form'] = $this->redirect_form(); |
|
161 | - } |
|
162 | - // and finally, add return_data array to main JSON response array, IF it contains anything |
|
163 | - // why did we add some of the above properties to the return data array? |
|
164 | - // because it is easier and cleaner in the Javascript to deal with this way |
|
165 | - if (! empty($return_data)) { |
|
166 | - $JSON_response['return_data'] = $return_data; |
|
167 | - } |
|
168 | - // filter final array |
|
169 | - $JSON_response = apply_filters('FHEE__EE_SPCO_JSON_Response___toString__JSON_response', $JSON_response); |
|
170 | - // return encoded array |
|
171 | - return (string) wp_json_encode($JSON_response); |
|
172 | - } |
|
173 | - |
|
174 | - |
|
175 | - /** |
|
176 | - * @param string $attention |
|
177 | - */ |
|
178 | - public function set_attention($attention) |
|
179 | - { |
|
180 | - $this->_attention = $attention; |
|
181 | - } |
|
182 | - |
|
183 | - |
|
184 | - /** |
|
185 | - * @return string |
|
186 | - */ |
|
187 | - public function attention() |
|
188 | - { |
|
189 | - return $this->_attention; |
|
190 | - } |
|
191 | - |
|
192 | - |
|
193 | - /** |
|
194 | - * @param string $errors |
|
195 | - */ |
|
196 | - public function set_errors($errors) |
|
197 | - { |
|
198 | - $this->_errors = $errors; |
|
199 | - } |
|
200 | - |
|
201 | - |
|
202 | - /** |
|
203 | - * @return string |
|
204 | - */ |
|
205 | - public function errors() |
|
206 | - { |
|
207 | - return $this->_errors; |
|
208 | - } |
|
209 | - |
|
210 | - |
|
211 | - /** |
|
212 | - * @return string |
|
213 | - */ |
|
214 | - public function unexpected_errors() |
|
215 | - { |
|
216 | - return $this->_unexpected_errors; |
|
217 | - } |
|
218 | - |
|
219 | - |
|
220 | - /** |
|
221 | - * @param string $unexpected_errors |
|
222 | - */ |
|
223 | - public function set_unexpected_errors($unexpected_errors) |
|
224 | - { |
|
225 | - $this->_unexpected_errors = $unexpected_errors; |
|
226 | - } |
|
227 | - |
|
228 | - |
|
229 | - /** |
|
230 | - * @param string $success |
|
231 | - */ |
|
232 | - public function set_success($success) |
|
233 | - { |
|
234 | - $this->_success = $success; |
|
235 | - } |
|
236 | - |
|
237 | - |
|
238 | - /** |
|
239 | - * @return string |
|
240 | - */ |
|
241 | - public function success() |
|
242 | - { |
|
243 | - return $this->_success; |
|
244 | - } |
|
245 | - |
|
246 | - |
|
247 | - /** |
|
248 | - * @param string $method_of_payment |
|
249 | - */ |
|
250 | - public function set_method_of_payment($method_of_payment) |
|
251 | - { |
|
252 | - $this->_method_of_payment = $method_of_payment; |
|
253 | - } |
|
254 | - |
|
255 | - |
|
256 | - /** |
|
257 | - * @return string |
|
258 | - */ |
|
259 | - public function method_of_payment() |
|
260 | - { |
|
261 | - return $this->_method_of_payment; |
|
262 | - } |
|
263 | - |
|
264 | - |
|
265 | - /** |
|
266 | - * @return float |
|
267 | - */ |
|
268 | - public function payment_amount() |
|
269 | - { |
|
270 | - return $this->_payment_amount; |
|
271 | - } |
|
272 | - |
|
273 | - |
|
274 | - /** |
|
275 | - * @param float $payment_amount |
|
276 | - * @throws EE_Error |
|
277 | - */ |
|
278 | - public function set_payment_amount($payment_amount) |
|
279 | - { |
|
280 | - $this->_payment_amount = (float) $payment_amount; |
|
281 | - } |
|
282 | - |
|
283 | - |
|
284 | - /** |
|
285 | - * @param string $next_step_html |
|
286 | - */ |
|
287 | - public function set_reg_step_html($next_step_html) |
|
288 | - { |
|
289 | - $this->_reg_step_html = $next_step_html; |
|
290 | - } |
|
291 | - |
|
292 | - |
|
293 | - /** |
|
294 | - * @return string |
|
295 | - */ |
|
296 | - public function reg_step_html() |
|
297 | - { |
|
298 | - return $this->_reg_step_html; |
|
299 | - } |
|
300 | - |
|
301 | - |
|
302 | - /** |
|
303 | - * @param string $redirect_form |
|
304 | - */ |
|
305 | - public function set_redirect_form($redirect_form) |
|
306 | - { |
|
307 | - $this->_redirect_form = $redirect_form; |
|
308 | - } |
|
309 | - |
|
310 | - |
|
311 | - /** |
|
312 | - * @return string |
|
313 | - */ |
|
314 | - public function redirect_form() |
|
315 | - { |
|
316 | - return ! empty($this->_redirect_form) ? $this->_redirect_form : false; |
|
317 | - } |
|
318 | - |
|
319 | - |
|
320 | - /** |
|
321 | - * @param string $plz_select_method_of_payment |
|
322 | - */ |
|
323 | - public function set_plz_select_method_of_payment($plz_select_method_of_payment) |
|
324 | - { |
|
325 | - $this->_plz_select_method_of_payment = $plz_select_method_of_payment; |
|
326 | - } |
|
327 | - |
|
328 | - |
|
329 | - /** |
|
330 | - * @return string |
|
331 | - */ |
|
332 | - public function plz_select_method_of_payment() |
|
333 | - { |
|
334 | - return $this->_plz_select_method_of_payment; |
|
335 | - } |
|
336 | - |
|
337 | - |
|
338 | - /** |
|
339 | - * @param string $redirect_url |
|
340 | - */ |
|
341 | - public function set_redirect_url($redirect_url) |
|
342 | - { |
|
343 | - $this->_redirect_url = $redirect_url; |
|
344 | - } |
|
345 | - |
|
346 | - |
|
347 | - /** |
|
348 | - * @return string |
|
349 | - */ |
|
350 | - public function redirect_url() |
|
351 | - { |
|
352 | - return $this->_redirect_url; |
|
353 | - } |
|
354 | - |
|
355 | - |
|
356 | - /** |
|
357 | - * @return string |
|
358 | - */ |
|
359 | - public function registration_time_limit() |
|
360 | - { |
|
361 | - return $this->_registration_time_limit; |
|
362 | - } |
|
363 | - |
|
364 | - |
|
365 | - /** |
|
366 | - * @param string $registration_time_limit |
|
367 | - */ |
|
368 | - public function set_registration_time_limit($registration_time_limit) |
|
369 | - { |
|
370 | - $this->_registration_time_limit = $registration_time_limit; |
|
371 | - } |
|
372 | - |
|
373 | - |
|
374 | - /** |
|
375 | - * @param array $return_data |
|
376 | - */ |
|
377 | - public function set_return_data($return_data) |
|
378 | - { |
|
379 | - $this->_return_data = array_merge($this->_return_data, $return_data); |
|
380 | - } |
|
381 | - |
|
382 | - |
|
383 | - /** |
|
384 | - * @return array |
|
385 | - */ |
|
386 | - public function return_data() |
|
387 | - { |
|
388 | - return $this->_return_data; |
|
389 | - } |
|
390 | - |
|
391 | - |
|
392 | - /** |
|
393 | - * @param array $validation_rules |
|
394 | - */ |
|
395 | - public function add_validation_rules(array $validation_rules = array()) |
|
396 | - { |
|
397 | - if (is_array($validation_rules) && ! empty($validation_rules)) { |
|
398 | - $this->_validation_rules = array_merge($this->_validation_rules, $validation_rules); |
|
399 | - } |
|
400 | - } |
|
401 | - |
|
402 | - |
|
403 | - /** |
|
404 | - * @return array | bool |
|
405 | - */ |
|
406 | - public function validation_rules() |
|
407 | - { |
|
408 | - return ! empty($this->_validation_rules) ? $this->_validation_rules : false; |
|
409 | - } |
|
410 | - |
|
411 | - |
|
412 | - public function echoAndExit() |
|
413 | - { |
|
414 | - echo $this; |
|
415 | - exit(); |
|
416 | - } |
|
18 | + /** |
|
19 | + * @var string |
|
20 | + */ |
|
21 | + protected $_errors = ''; |
|
22 | + |
|
23 | + /** |
|
24 | + * @var string |
|
25 | + */ |
|
26 | + protected $_unexpected_errors = ''; |
|
27 | + |
|
28 | + /** |
|
29 | + * @var string |
|
30 | + */ |
|
31 | + protected $_attention = ''; |
|
32 | + |
|
33 | + /** |
|
34 | + * @var string |
|
35 | + */ |
|
36 | + protected $_success = ''; |
|
37 | + |
|
38 | + /** |
|
39 | + * @var string |
|
40 | + */ |
|
41 | + protected $_plz_select_method_of_payment = ''; |
|
42 | + |
|
43 | + /** |
|
44 | + * @var string |
|
45 | + */ |
|
46 | + protected $_redirect_url = ''; |
|
47 | + |
|
48 | + /** |
|
49 | + * @var string |
|
50 | + */ |
|
51 | + protected $_registration_time_limit = ''; |
|
52 | + |
|
53 | + /** |
|
54 | + * @var string |
|
55 | + */ |
|
56 | + protected $_redirect_form = ''; |
|
57 | + |
|
58 | + /** |
|
59 | + * @var string |
|
60 | + */ |
|
61 | + protected $_reg_step_html = ''; |
|
62 | + |
|
63 | + /** |
|
64 | + * @var string |
|
65 | + */ |
|
66 | + protected $_method_of_payment = ''; |
|
67 | + |
|
68 | + /** |
|
69 | + * @var float |
|
70 | + */ |
|
71 | + protected $_payment_amount; |
|
72 | + |
|
73 | + /** |
|
74 | + * @var array |
|
75 | + */ |
|
76 | + protected $_return_data = array(); |
|
77 | + |
|
78 | + |
|
79 | + /** |
|
80 | + * @var array |
|
81 | + */ |
|
82 | + protected $_validation_rules = array(); |
|
83 | + |
|
84 | + |
|
85 | + /** |
|
86 | + * class constructor |
|
87 | + */ |
|
88 | + public function __construct() |
|
89 | + { |
|
90 | + } |
|
91 | + |
|
92 | + |
|
93 | + /** |
|
94 | + * __toString |
|
95 | + * |
|
96 | + * allows you to simply echo or print an EE_SPCO_JSON_Response object to produce a JSON encoded string |
|
97 | + * ie: $json_response = new EE_SPCO_JSON_Response(); |
|
98 | + * echo $json_response; |
|
99 | + * |
|
100 | + * @access public |
|
101 | + * @return string |
|
102 | + */ |
|
103 | + public function __toString() |
|
104 | + { |
|
105 | + $JSON_response = array(); |
|
106 | + // grab notices |
|
107 | + $notices = EE_Error::get_notices(false); |
|
108 | + $this->set_attention(isset($notices['attention']) ? $notices['attention'] : ''); |
|
109 | + $this->set_errors(isset($notices['errors']) ? $notices['errors'] : ''); |
|
110 | + $this->set_success(isset($notices['success']) ? $notices['success'] : ''); |
|
111 | + // add notices to JSON response, but only if they exist |
|
112 | + if ($this->attention()) { |
|
113 | + $JSON_response['attention'] = $this->attention(); |
|
114 | + } |
|
115 | + if ($this->errors()) { |
|
116 | + $JSON_response['errors'] = $this->errors(); |
|
117 | + } |
|
118 | + if ($this->unexpected_errors()) { |
|
119 | + $JSON_response['unexpected_errors'] = $this->unexpected_errors(); |
|
120 | + } |
|
121 | + if ($this->success()) { |
|
122 | + $JSON_response['success'] = $this->success(); |
|
123 | + } |
|
124 | + // but if NO notices are set... at least set the "success" as a key so that the JS knows everything worked |
|
125 | + if (! isset($JSON_response['attention']) && ! isset($JSON_response['errors']) && ! isset($JSON_response['success'])) { |
|
126 | + $JSON_response['success'] = null; |
|
127 | + } |
|
128 | + // set redirect_url, IF it exists |
|
129 | + if ($this->redirect_url()) { |
|
130 | + $JSON_response['redirect_url'] = $this->redirect_url(); |
|
131 | + } |
|
132 | + // set registration_time_limit, IF it exists |
|
133 | + if ($this->registration_time_limit()) { |
|
134 | + $JSON_response['registration_time_limit'] = $this->registration_time_limit(); |
|
135 | + } |
|
136 | + // set payment_amount, IF it exists |
|
137 | + if ($this->payment_amount() !== null) { |
|
138 | + $JSON_response['payment_amount'] = $this->payment_amount(); |
|
139 | + } |
|
140 | + // grab generic return data |
|
141 | + $return_data = $this->return_data(); |
|
142 | + // add billing form validation rules |
|
143 | + if ($this->validation_rules()) { |
|
144 | + $return_data['validation_rules'] = $this->validation_rules(); |
|
145 | + } |
|
146 | + // set reg_step_html, IF it exists |
|
147 | + if ($this->reg_step_html()) { |
|
148 | + $return_data['reg_step_html'] = $this->reg_step_html(); |
|
149 | + } |
|
150 | + // set method of payment, IF it exists |
|
151 | + if ($this->method_of_payment()) { |
|
152 | + $return_data['method_of_payment'] = $this->method_of_payment(); |
|
153 | + } |
|
154 | + // set "plz_select_method_of_payment" message, IF it exists |
|
155 | + if ($this->plz_select_method_of_payment()) { |
|
156 | + $return_data['plz_select_method_of_payment'] = $this->plz_select_method_of_payment(); |
|
157 | + } |
|
158 | + // set redirect_form, IF it exists |
|
159 | + if ($this->redirect_form()) { |
|
160 | + $return_data['redirect_form'] = $this->redirect_form(); |
|
161 | + } |
|
162 | + // and finally, add return_data array to main JSON response array, IF it contains anything |
|
163 | + // why did we add some of the above properties to the return data array? |
|
164 | + // because it is easier and cleaner in the Javascript to deal with this way |
|
165 | + if (! empty($return_data)) { |
|
166 | + $JSON_response['return_data'] = $return_data; |
|
167 | + } |
|
168 | + // filter final array |
|
169 | + $JSON_response = apply_filters('FHEE__EE_SPCO_JSON_Response___toString__JSON_response', $JSON_response); |
|
170 | + // return encoded array |
|
171 | + return (string) wp_json_encode($JSON_response); |
|
172 | + } |
|
173 | + |
|
174 | + |
|
175 | + /** |
|
176 | + * @param string $attention |
|
177 | + */ |
|
178 | + public function set_attention($attention) |
|
179 | + { |
|
180 | + $this->_attention = $attention; |
|
181 | + } |
|
182 | + |
|
183 | + |
|
184 | + /** |
|
185 | + * @return string |
|
186 | + */ |
|
187 | + public function attention() |
|
188 | + { |
|
189 | + return $this->_attention; |
|
190 | + } |
|
191 | + |
|
192 | + |
|
193 | + /** |
|
194 | + * @param string $errors |
|
195 | + */ |
|
196 | + public function set_errors($errors) |
|
197 | + { |
|
198 | + $this->_errors = $errors; |
|
199 | + } |
|
200 | + |
|
201 | + |
|
202 | + /** |
|
203 | + * @return string |
|
204 | + */ |
|
205 | + public function errors() |
|
206 | + { |
|
207 | + return $this->_errors; |
|
208 | + } |
|
209 | + |
|
210 | + |
|
211 | + /** |
|
212 | + * @return string |
|
213 | + */ |
|
214 | + public function unexpected_errors() |
|
215 | + { |
|
216 | + return $this->_unexpected_errors; |
|
217 | + } |
|
218 | + |
|
219 | + |
|
220 | + /** |
|
221 | + * @param string $unexpected_errors |
|
222 | + */ |
|
223 | + public function set_unexpected_errors($unexpected_errors) |
|
224 | + { |
|
225 | + $this->_unexpected_errors = $unexpected_errors; |
|
226 | + } |
|
227 | + |
|
228 | + |
|
229 | + /** |
|
230 | + * @param string $success |
|
231 | + */ |
|
232 | + public function set_success($success) |
|
233 | + { |
|
234 | + $this->_success = $success; |
|
235 | + } |
|
236 | + |
|
237 | + |
|
238 | + /** |
|
239 | + * @return string |
|
240 | + */ |
|
241 | + public function success() |
|
242 | + { |
|
243 | + return $this->_success; |
|
244 | + } |
|
245 | + |
|
246 | + |
|
247 | + /** |
|
248 | + * @param string $method_of_payment |
|
249 | + */ |
|
250 | + public function set_method_of_payment($method_of_payment) |
|
251 | + { |
|
252 | + $this->_method_of_payment = $method_of_payment; |
|
253 | + } |
|
254 | + |
|
255 | + |
|
256 | + /** |
|
257 | + * @return string |
|
258 | + */ |
|
259 | + public function method_of_payment() |
|
260 | + { |
|
261 | + return $this->_method_of_payment; |
|
262 | + } |
|
263 | + |
|
264 | + |
|
265 | + /** |
|
266 | + * @return float |
|
267 | + */ |
|
268 | + public function payment_amount() |
|
269 | + { |
|
270 | + return $this->_payment_amount; |
|
271 | + } |
|
272 | + |
|
273 | + |
|
274 | + /** |
|
275 | + * @param float $payment_amount |
|
276 | + * @throws EE_Error |
|
277 | + */ |
|
278 | + public function set_payment_amount($payment_amount) |
|
279 | + { |
|
280 | + $this->_payment_amount = (float) $payment_amount; |
|
281 | + } |
|
282 | + |
|
283 | + |
|
284 | + /** |
|
285 | + * @param string $next_step_html |
|
286 | + */ |
|
287 | + public function set_reg_step_html($next_step_html) |
|
288 | + { |
|
289 | + $this->_reg_step_html = $next_step_html; |
|
290 | + } |
|
291 | + |
|
292 | + |
|
293 | + /** |
|
294 | + * @return string |
|
295 | + */ |
|
296 | + public function reg_step_html() |
|
297 | + { |
|
298 | + return $this->_reg_step_html; |
|
299 | + } |
|
300 | + |
|
301 | + |
|
302 | + /** |
|
303 | + * @param string $redirect_form |
|
304 | + */ |
|
305 | + public function set_redirect_form($redirect_form) |
|
306 | + { |
|
307 | + $this->_redirect_form = $redirect_form; |
|
308 | + } |
|
309 | + |
|
310 | + |
|
311 | + /** |
|
312 | + * @return string |
|
313 | + */ |
|
314 | + public function redirect_form() |
|
315 | + { |
|
316 | + return ! empty($this->_redirect_form) ? $this->_redirect_form : false; |
|
317 | + } |
|
318 | + |
|
319 | + |
|
320 | + /** |
|
321 | + * @param string $plz_select_method_of_payment |
|
322 | + */ |
|
323 | + public function set_plz_select_method_of_payment($plz_select_method_of_payment) |
|
324 | + { |
|
325 | + $this->_plz_select_method_of_payment = $plz_select_method_of_payment; |
|
326 | + } |
|
327 | + |
|
328 | + |
|
329 | + /** |
|
330 | + * @return string |
|
331 | + */ |
|
332 | + public function plz_select_method_of_payment() |
|
333 | + { |
|
334 | + return $this->_plz_select_method_of_payment; |
|
335 | + } |
|
336 | + |
|
337 | + |
|
338 | + /** |
|
339 | + * @param string $redirect_url |
|
340 | + */ |
|
341 | + public function set_redirect_url($redirect_url) |
|
342 | + { |
|
343 | + $this->_redirect_url = $redirect_url; |
|
344 | + } |
|
345 | + |
|
346 | + |
|
347 | + /** |
|
348 | + * @return string |
|
349 | + */ |
|
350 | + public function redirect_url() |
|
351 | + { |
|
352 | + return $this->_redirect_url; |
|
353 | + } |
|
354 | + |
|
355 | + |
|
356 | + /** |
|
357 | + * @return string |
|
358 | + */ |
|
359 | + public function registration_time_limit() |
|
360 | + { |
|
361 | + return $this->_registration_time_limit; |
|
362 | + } |
|
363 | + |
|
364 | + |
|
365 | + /** |
|
366 | + * @param string $registration_time_limit |
|
367 | + */ |
|
368 | + public function set_registration_time_limit($registration_time_limit) |
|
369 | + { |
|
370 | + $this->_registration_time_limit = $registration_time_limit; |
|
371 | + } |
|
372 | + |
|
373 | + |
|
374 | + /** |
|
375 | + * @param array $return_data |
|
376 | + */ |
|
377 | + public function set_return_data($return_data) |
|
378 | + { |
|
379 | + $this->_return_data = array_merge($this->_return_data, $return_data); |
|
380 | + } |
|
381 | + |
|
382 | + |
|
383 | + /** |
|
384 | + * @return array |
|
385 | + */ |
|
386 | + public function return_data() |
|
387 | + { |
|
388 | + return $this->_return_data; |
|
389 | + } |
|
390 | + |
|
391 | + |
|
392 | + /** |
|
393 | + * @param array $validation_rules |
|
394 | + */ |
|
395 | + public function add_validation_rules(array $validation_rules = array()) |
|
396 | + { |
|
397 | + if (is_array($validation_rules) && ! empty($validation_rules)) { |
|
398 | + $this->_validation_rules = array_merge($this->_validation_rules, $validation_rules); |
|
399 | + } |
|
400 | + } |
|
401 | + |
|
402 | + |
|
403 | + /** |
|
404 | + * @return array | bool |
|
405 | + */ |
|
406 | + public function validation_rules() |
|
407 | + { |
|
408 | + return ! empty($this->_validation_rules) ? $this->_validation_rules : false; |
|
409 | + } |
|
410 | + |
|
411 | + |
|
412 | + public function echoAndExit() |
|
413 | + { |
|
414 | + echo $this; |
|
415 | + exit(); |
|
416 | + } |
|
417 | 417 | } |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | $JSON_response['success'] = $this->success(); |
123 | 123 | } |
124 | 124 | // but if NO notices are set... at least set the "success" as a key so that the JS knows everything worked |
125 | - if (! isset($JSON_response['attention']) && ! isset($JSON_response['errors']) && ! isset($JSON_response['success'])) { |
|
125 | + if ( ! isset($JSON_response['attention']) && ! isset($JSON_response['errors']) && ! isset($JSON_response['success'])) { |
|
126 | 126 | $JSON_response['success'] = null; |
127 | 127 | } |
128 | 128 | // set redirect_url, IF it exists |
@@ -162,7 +162,7 @@ discard block |
||
162 | 162 | // and finally, add return_data array to main JSON response array, IF it contains anything |
163 | 163 | // why did we add some of the above properties to the return data array? |
164 | 164 | // because it is easier and cleaner in the Javascript to deal with this way |
165 | - if (! empty($return_data)) { |
|
165 | + if ( ! empty($return_data)) { |
|
166 | 166 | $JSON_response['return_data'] = $return_data; |
167 | 167 | } |
168 | 168 | // filter final array |
@@ -15,64 +15,64 @@ discard block |
||
15 | 15 | class Registration_Form_Questions_Overview_Help_Tour extends EE_Help_Tour |
16 | 16 | { |
17 | 17 | |
18 | - protected function _set_tour_properties() |
|
19 | - { |
|
20 | - $this->_label = __('Questions Overview Tour', 'event_espresso'); |
|
21 | - $this->_slug = $this->_is_caf ? 'questions-overview-caf-joyride' : 'questions-overview-joyride'; |
|
22 | - } |
|
18 | + protected function _set_tour_properties() |
|
19 | + { |
|
20 | + $this->_label = __('Questions Overview Tour', 'event_espresso'); |
|
21 | + $this->_slug = $this->_is_caf ? 'questions-overview-caf-joyride' : 'questions-overview-joyride'; |
|
22 | + } |
|
23 | 23 | |
24 | - protected function _set_tour_stops() |
|
25 | - { |
|
26 | - $this->_stops = array( |
|
27 | - 10 => array( |
|
28 | - 'content' => $this->_start(), |
|
29 | - ), |
|
30 | - 30 => array( |
|
31 | - 'id' => 'display_text', |
|
32 | - 'content' => $this->_display_text_stop(), |
|
33 | - 'options' => array( |
|
34 | - 'tipLocation' => 'top', |
|
35 | - 'tipAdjustmentX' => -5, |
|
36 | - 'tipAdjustmentY' => -25, |
|
37 | - ), |
|
38 | - ), |
|
39 | - 40 => array( |
|
40 | - 'id' => 'admin_label', |
|
41 | - 'content' => $this->_admin_label_stop(), |
|
42 | - 'options' => array( |
|
43 | - 'tipLocation' => 'top', |
|
44 | - 'tipAdjustmentX' => 20, |
|
45 | - 'tipAdjustmentY' => -25, |
|
46 | - ), |
|
47 | - ), |
|
48 | - 50 => array( |
|
49 | - 'id' => 'type', |
|
50 | - 'content' => $this->_type_stop(), |
|
51 | - 'options' => array( |
|
52 | - 'tipLocation' => 'top', |
|
53 | - 'tipAdjustmentX' => -5, |
|
54 | - 'tipAdjustmentY' => -25, |
|
55 | - ), |
|
56 | - ), |
|
57 | - 60 => array( |
|
58 | - 'id' => 'values', |
|
59 | - 'content' => $this->_values_stop(), |
|
60 | - 'options' => array( |
|
61 | - 'tipLocation' => 'top', |
|
62 | - 'tipAdjustmentX' => -5, |
|
63 | - 'tipAdjustmentY' => -25, |
|
64 | - ), |
|
65 | - ), |
|
66 | - 70 => array( |
|
67 | - 'id' => 'required', |
|
68 | - 'content' => $this->_required_stop(), |
|
69 | - 'options' => array( |
|
70 | - 'tipLocation' => 'top', |
|
71 | - 'tipAdjustmentY' => -20, |
|
72 | - 'tipAdjustmentX' => -15, |
|
73 | - ), |
|
74 | - ), |
|
75 | - /*80 => array( |
|
24 | + protected function _set_tour_stops() |
|
25 | + { |
|
26 | + $this->_stops = array( |
|
27 | + 10 => array( |
|
28 | + 'content' => $this->_start(), |
|
29 | + ), |
|
30 | + 30 => array( |
|
31 | + 'id' => 'display_text', |
|
32 | + 'content' => $this->_display_text_stop(), |
|
33 | + 'options' => array( |
|
34 | + 'tipLocation' => 'top', |
|
35 | + 'tipAdjustmentX' => -5, |
|
36 | + 'tipAdjustmentY' => -25, |
|
37 | + ), |
|
38 | + ), |
|
39 | + 40 => array( |
|
40 | + 'id' => 'admin_label', |
|
41 | + 'content' => $this->_admin_label_stop(), |
|
42 | + 'options' => array( |
|
43 | + 'tipLocation' => 'top', |
|
44 | + 'tipAdjustmentX' => 20, |
|
45 | + 'tipAdjustmentY' => -25, |
|
46 | + ), |
|
47 | + ), |
|
48 | + 50 => array( |
|
49 | + 'id' => 'type', |
|
50 | + 'content' => $this->_type_stop(), |
|
51 | + 'options' => array( |
|
52 | + 'tipLocation' => 'top', |
|
53 | + 'tipAdjustmentX' => -5, |
|
54 | + 'tipAdjustmentY' => -25, |
|
55 | + ), |
|
56 | + ), |
|
57 | + 60 => array( |
|
58 | + 'id' => 'values', |
|
59 | + 'content' => $this->_values_stop(), |
|
60 | + 'options' => array( |
|
61 | + 'tipLocation' => 'top', |
|
62 | + 'tipAdjustmentX' => -5, |
|
63 | + 'tipAdjustmentY' => -25, |
|
64 | + ), |
|
65 | + ), |
|
66 | + 70 => array( |
|
67 | + 'id' => 'required', |
|
68 | + 'content' => $this->_required_stop(), |
|
69 | + 'options' => array( |
|
70 | + 'tipLocation' => 'top', |
|
71 | + 'tipAdjustmentY' => -20, |
|
72 | + 'tipAdjustmentX' => -15, |
|
73 | + ), |
|
74 | + ), |
|
75 | + /*80 => array( |
|
76 | 76 | 'class' => 'bulkactions', |
77 | 77 | 'content' => $this->_bulk_actions_stop(), |
78 | 78 | 'options' => array( |
@@ -81,84 +81,84 @@ discard block |
||
81 | 81 | 'tipAdjustmentX' => -15 |
82 | 82 | ) |
83 | 83 | ),*/ |
84 | - 90 => array( |
|
85 | - 'id' => 'event-espresso_page_espresso_registration_form-search-input', |
|
86 | - 'content' => $this->_search_stop(), |
|
87 | - 'options' => array( |
|
88 | - 'tipLocation' => 'left', |
|
89 | - 'tipAdjustmentY' => -50, |
|
90 | - 'tipAdjustmentX' => -15, |
|
91 | - ), |
|
92 | - ), |
|
93 | - 100 => array( |
|
94 | - 'id' => 'add-new-question', |
|
95 | - 'content' => $this->_add_new_question_stop(), |
|
96 | - 'options' => array( |
|
97 | - 'tipLocation' => 'right', |
|
98 | - 'tipAdjustmentY' => -50, |
|
99 | - 'tipAdjustmentX' => 15, |
|
100 | - ), |
|
101 | - ), |
|
102 | - ); |
|
103 | - } |
|
84 | + 90 => array( |
|
85 | + 'id' => 'event-espresso_page_espresso_registration_form-search-input', |
|
86 | + 'content' => $this->_search_stop(), |
|
87 | + 'options' => array( |
|
88 | + 'tipLocation' => 'left', |
|
89 | + 'tipAdjustmentY' => -50, |
|
90 | + 'tipAdjustmentX' => -15, |
|
91 | + ), |
|
92 | + ), |
|
93 | + 100 => array( |
|
94 | + 'id' => 'add-new-question', |
|
95 | + 'content' => $this->_add_new_question_stop(), |
|
96 | + 'options' => array( |
|
97 | + 'tipLocation' => 'right', |
|
98 | + 'tipAdjustmentY' => -50, |
|
99 | + 'tipAdjustmentX' => 15, |
|
100 | + ), |
|
101 | + ), |
|
102 | + ); |
|
103 | + } |
|
104 | 104 | |
105 | 105 | |
106 | - protected function _start() |
|
107 | - { |
|
108 | - $content = '<h3>' . __('Questions Overview', 'event_espresso') . '</h3>'; |
|
109 | - $content .= '<p>' . __( |
|
110 | - 'This tour of the Questions Overview page will go over different areas of the screen to help you understand what they are used for.', |
|
111 | - 'event_espresso' |
|
112 | - ) . '</p>'; |
|
106 | + protected function _start() |
|
107 | + { |
|
108 | + $content = '<h3>' . __('Questions Overview', 'event_espresso') . '</h3>'; |
|
109 | + $content .= '<p>' . __( |
|
110 | + 'This tour of the Questions Overview page will go over different areas of the screen to help you understand what they are used for.', |
|
111 | + 'event_espresso' |
|
112 | + ) . '</p>'; |
|
113 | 113 | |
114 | - return $content; |
|
115 | - } |
|
114 | + return $content; |
|
115 | + } |
|
116 | 116 | |
117 | - protected function _display_text_stop() |
|
118 | - { |
|
119 | - return '<p>' . __('View available questions.', 'event_espresso') . '</p>'; |
|
120 | - } |
|
117 | + protected function _display_text_stop() |
|
118 | + { |
|
119 | + return '<p>' . __('View available questions.', 'event_espresso') . '</p>'; |
|
120 | + } |
|
121 | 121 | |
122 | - protected function _admin_label_stop() |
|
123 | - { |
|
124 | - return '<p>' . __('View the admin label for your questions.', 'event_espresso') . '</p>'; |
|
125 | - } |
|
122 | + protected function _admin_label_stop() |
|
123 | + { |
|
124 | + return '<p>' . __('View the admin label for your questions.', 'event_espresso') . '</p>'; |
|
125 | + } |
|
126 | 126 | |
127 | - protected function _type_stop() |
|
128 | - { |
|
129 | - return '<p>' . __( |
|
130 | - 'View the type of question. Available options are Text, Textarea, Checkboxes, Radio Buttons, Dropdown, State/Province Dropdown, Country Dropdown, and Date Picker.', |
|
131 | - 'event_espresso' |
|
132 | - ) . '</p>'; |
|
133 | - } |
|
127 | + protected function _type_stop() |
|
128 | + { |
|
129 | + return '<p>' . __( |
|
130 | + 'View the type of question. Available options are Text, Textarea, Checkboxes, Radio Buttons, Dropdown, State/Province Dropdown, Country Dropdown, and Date Picker.', |
|
131 | + 'event_espresso' |
|
132 | + ) . '</p>'; |
|
133 | + } |
|
134 | 134 | |
135 | - protected function _values_stop() |
|
136 | - { |
|
137 | - return '<p>' . __( |
|
138 | - 'View stored values for checkboxes, radio buttons, and select boxes.', |
|
139 | - 'event_espresso' |
|
140 | - ) . '</p>'; |
|
141 | - } |
|
135 | + protected function _values_stop() |
|
136 | + { |
|
137 | + return '<p>' . __( |
|
138 | + 'View stored values for checkboxes, radio buttons, and select boxes.', |
|
139 | + 'event_espresso' |
|
140 | + ) . '</p>'; |
|
141 | + } |
|
142 | 142 | |
143 | - protected function _required_stop() |
|
144 | - { |
|
145 | - return '<p>' . __('View if a question is required.', 'event_espresso') . '</p>'; |
|
146 | - } |
|
143 | + protected function _required_stop() |
|
144 | + { |
|
145 | + return '<p>' . __('View if a question is required.', 'event_espresso') . '</p>'; |
|
146 | + } |
|
147 | 147 | |
148 | - /* protected function _bulk_actions_stop() { |
|
148 | + /* protected function _bulk_actions_stop() { |
|
149 | 149 | return '<p>' . __('Perform bulk actions to multiple questions.', 'event_espresso') . '</p>'; |
150 | 150 | } */ |
151 | 151 | |
152 | - protected function _search_stop() |
|
153 | - { |
|
154 | - return '<p>' . __( |
|
155 | - 'Search through questions. The following sources will be searched: Name of Question (display text).', |
|
156 | - 'event_espresso' |
|
157 | - ) . '</p>'; |
|
158 | - } |
|
152 | + protected function _search_stop() |
|
153 | + { |
|
154 | + return '<p>' . __( |
|
155 | + 'Search through questions. The following sources will be searched: Name of Question (display text).', |
|
156 | + 'event_espresso' |
|
157 | + ) . '</p>'; |
|
158 | + } |
|
159 | 159 | |
160 | - protected function _add_new_question_stop() |
|
161 | - { |
|
162 | - return '<p>' . __('Click here to add a new question.', 'event_espresso') . '</p>'; |
|
163 | - } |
|
160 | + protected function _add_new_question_stop() |
|
161 | + { |
|
162 | + return '<p>' . __('Click here to add a new question.', 'event_espresso') . '</p>'; |
|
163 | + } |
|
164 | 164 | } |
@@ -105,44 +105,44 @@ discard block |
||
105 | 105 | |
106 | 106 | protected function _start() |
107 | 107 | { |
108 | - $content = '<h3>' . __('Questions Overview', 'event_espresso') . '</h3>'; |
|
109 | - $content .= '<p>' . __( |
|
108 | + $content = '<h3>'.__('Questions Overview', 'event_espresso').'</h3>'; |
|
109 | + $content .= '<p>'.__( |
|
110 | 110 | 'This tour of the Questions Overview page will go over different areas of the screen to help you understand what they are used for.', |
111 | 111 | 'event_espresso' |
112 | - ) . '</p>'; |
|
112 | + ).'</p>'; |
|
113 | 113 | |
114 | 114 | return $content; |
115 | 115 | } |
116 | 116 | |
117 | 117 | protected function _display_text_stop() |
118 | 118 | { |
119 | - return '<p>' . __('View available questions.', 'event_espresso') . '</p>'; |
|
119 | + return '<p>'.__('View available questions.', 'event_espresso').'</p>'; |
|
120 | 120 | } |
121 | 121 | |
122 | 122 | protected function _admin_label_stop() |
123 | 123 | { |
124 | - return '<p>' . __('View the admin label for your questions.', 'event_espresso') . '</p>'; |
|
124 | + return '<p>'.__('View the admin label for your questions.', 'event_espresso').'</p>'; |
|
125 | 125 | } |
126 | 126 | |
127 | 127 | protected function _type_stop() |
128 | 128 | { |
129 | - return '<p>' . __( |
|
129 | + return '<p>'.__( |
|
130 | 130 | 'View the type of question. Available options are Text, Textarea, Checkboxes, Radio Buttons, Dropdown, State/Province Dropdown, Country Dropdown, and Date Picker.', |
131 | 131 | 'event_espresso' |
132 | - ) . '</p>'; |
|
132 | + ).'</p>'; |
|
133 | 133 | } |
134 | 134 | |
135 | 135 | protected function _values_stop() |
136 | 136 | { |
137 | - return '<p>' . __( |
|
137 | + return '<p>'.__( |
|
138 | 138 | 'View stored values for checkboxes, radio buttons, and select boxes.', |
139 | 139 | 'event_espresso' |
140 | - ) . '</p>'; |
|
140 | + ).'</p>'; |
|
141 | 141 | } |
142 | 142 | |
143 | 143 | protected function _required_stop() |
144 | 144 | { |
145 | - return '<p>' . __('View if a question is required.', 'event_espresso') . '</p>'; |
|
145 | + return '<p>'.__('View if a question is required.', 'event_espresso').'</p>'; |
|
146 | 146 | } |
147 | 147 | |
148 | 148 | /* protected function _bulk_actions_stop() { |
@@ -151,14 +151,14 @@ discard block |
||
151 | 151 | |
152 | 152 | protected function _search_stop() |
153 | 153 | { |
154 | - return '<p>' . __( |
|
154 | + return '<p>'.__( |
|
155 | 155 | 'Search through questions. The following sources will be searched: Name of Question (display text).', |
156 | 156 | 'event_espresso' |
157 | - ) . '</p>'; |
|
157 | + ).'</p>'; |
|
158 | 158 | } |
159 | 159 | |
160 | 160 | protected function _add_new_question_stop() |
161 | 161 | { |
162 | - return '<p>' . __('Click here to add a new question.', 'event_espresso') . '</p>'; |
|
162 | + return '<p>'.__('Click here to add a new question.', 'event_espresso').'</p>'; |
|
163 | 163 | } |
164 | 164 | } |
@@ -16,14 +16,14 @@ |
||
16 | 16 | { |
17 | 17 | |
18 | 18 | |
19 | - public function __construct(EE_Admin_Page $admin_page) |
|
20 | - { |
|
21 | - parent::__construct($admin_page); |
|
22 | - } |
|
19 | + public function __construct(EE_Admin_Page $admin_page) |
|
20 | + { |
|
21 | + parent::__construct($admin_page); |
|
22 | + } |
|
23 | 23 | |
24 | 24 | |
25 | - protected function _set_hooks_properties() |
|
26 | - { |
|
27 | - $this->_name = 'messages'; |
|
28 | - } |
|
25 | + protected function _set_hooks_properties() |
|
26 | + { |
|
27 | + $this->_name = 'messages'; |
|
28 | + } |
|
29 | 29 | } |
@@ -27,282 +27,282 @@ |
||
27 | 27 | class EE_Brewing_Regular extends EE_BASE implements InterminableInterface |
28 | 28 | { |
29 | 29 | |
30 | - /** |
|
31 | - * @var \EventEspresso\core\services\database\TableAnalysis $table_analysis |
|
32 | - */ |
|
33 | - protected $_table_analysis; |
|
30 | + /** |
|
31 | + * @var \EventEspresso\core\services\database\TableAnalysis $table_analysis |
|
32 | + */ |
|
33 | + protected $_table_analysis; |
|
34 | 34 | |
35 | 35 | |
36 | - /** |
|
37 | - * EE_Brewing_Regular constructor. |
|
38 | - * |
|
39 | - * @throws \DomainException |
|
40 | - * @throws \EE_Error |
|
41 | - * @throws InvalidDataTypeException |
|
42 | - * @throws InvalidInterfaceException |
|
43 | - * @throws \InvalidArgumentException |
|
44 | - */ |
|
45 | - public function __construct(TableAnalysis $table_analysis) |
|
46 | - { |
|
47 | - $this->_table_analysis = $table_analysis; |
|
48 | - if (defined('EE_CAFF_PATH')) { |
|
49 | - // activation |
|
50 | - add_action('AHEE__EEH_Activation__initialize_db_content', array($this, 'initialize_caf_db_content')); |
|
51 | - // load caff init |
|
52 | - add_action('AHEE__EE_System__set_hooks_for_core', array($this, 'caffeinated_init')); |
|
53 | - // remove the "powered by" credit link from receipts and invoices |
|
54 | - add_filter('FHEE_EE_Html_messenger__add_powered_by_credit_link_to_receipt_and_invoice', '__return_false'); |
|
55 | - // add caffeinated modules |
|
56 | - add_filter( |
|
57 | - 'FHEE__EE_Config__register_modules__modules_to_register', |
|
58 | - array($this, 'caffeinated_modules_to_register') |
|
59 | - ); |
|
60 | - // load caff scripts |
|
61 | - add_action('wp_enqueue_scripts', array($this, 'enqueue_caffeinated_scripts'), 10); |
|
62 | - add_filter('FHEE__EE_Registry__load_helper__helper_paths', array($this, 'caf_helper_paths'), 10); |
|
63 | - // add_filter('FHEE__EE_Registry__load_helper__helper_paths', array($this, 'caf_helper_paths'), 10); |
|
64 | - EE_Register_Payment_Method::register( |
|
65 | - 'caffeinated_payment_methods', |
|
66 | - array( |
|
67 | - 'payment_method_paths' => glob(EE_CAF_PAYMENT_METHODS . '*', GLOB_ONLYDIR), |
|
68 | - ) |
|
69 | - ); |
|
70 | - // caffeinated constructed |
|
71 | - do_action('AHEE__EE_Brewing_Regular__construct__complete'); |
|
72 | - // seeing how this is caf, which isn't put on WordPress.org, we can have affiliate links without a disclaimer |
|
73 | - add_filter('FHEE__ee_show_affiliate_links', '__return_false'); |
|
74 | - } |
|
75 | - } |
|
36 | + /** |
|
37 | + * EE_Brewing_Regular constructor. |
|
38 | + * |
|
39 | + * @throws \DomainException |
|
40 | + * @throws \EE_Error |
|
41 | + * @throws InvalidDataTypeException |
|
42 | + * @throws InvalidInterfaceException |
|
43 | + * @throws \InvalidArgumentException |
|
44 | + */ |
|
45 | + public function __construct(TableAnalysis $table_analysis) |
|
46 | + { |
|
47 | + $this->_table_analysis = $table_analysis; |
|
48 | + if (defined('EE_CAFF_PATH')) { |
|
49 | + // activation |
|
50 | + add_action('AHEE__EEH_Activation__initialize_db_content', array($this, 'initialize_caf_db_content')); |
|
51 | + // load caff init |
|
52 | + add_action('AHEE__EE_System__set_hooks_for_core', array($this, 'caffeinated_init')); |
|
53 | + // remove the "powered by" credit link from receipts and invoices |
|
54 | + add_filter('FHEE_EE_Html_messenger__add_powered_by_credit_link_to_receipt_and_invoice', '__return_false'); |
|
55 | + // add caffeinated modules |
|
56 | + add_filter( |
|
57 | + 'FHEE__EE_Config__register_modules__modules_to_register', |
|
58 | + array($this, 'caffeinated_modules_to_register') |
|
59 | + ); |
|
60 | + // load caff scripts |
|
61 | + add_action('wp_enqueue_scripts', array($this, 'enqueue_caffeinated_scripts'), 10); |
|
62 | + add_filter('FHEE__EE_Registry__load_helper__helper_paths', array($this, 'caf_helper_paths'), 10); |
|
63 | + // add_filter('FHEE__EE_Registry__load_helper__helper_paths', array($this, 'caf_helper_paths'), 10); |
|
64 | + EE_Register_Payment_Method::register( |
|
65 | + 'caffeinated_payment_methods', |
|
66 | + array( |
|
67 | + 'payment_method_paths' => glob(EE_CAF_PAYMENT_METHODS . '*', GLOB_ONLYDIR), |
|
68 | + ) |
|
69 | + ); |
|
70 | + // caffeinated constructed |
|
71 | + do_action('AHEE__EE_Brewing_Regular__construct__complete'); |
|
72 | + // seeing how this is caf, which isn't put on WordPress.org, we can have affiliate links without a disclaimer |
|
73 | + add_filter('FHEE__ee_show_affiliate_links', '__return_false'); |
|
74 | + } |
|
75 | + } |
|
76 | 76 | |
77 | 77 | |
78 | - /** |
|
79 | - * callback for the FHEE__EE_Registry__load_helper__helper_paths filter to add the caffeinated paths |
|
80 | - * |
|
81 | - * @param array $paths original helper paths array |
|
82 | - * @return array new array of paths |
|
83 | - */ |
|
84 | - public function caf_helper_paths($paths) |
|
85 | - { |
|
86 | - $paths[] = EE_CAF_CORE . 'helpers' . DS; |
|
87 | - return $paths; |
|
88 | - } |
|
78 | + /** |
|
79 | + * callback for the FHEE__EE_Registry__load_helper__helper_paths filter to add the caffeinated paths |
|
80 | + * |
|
81 | + * @param array $paths original helper paths array |
|
82 | + * @return array new array of paths |
|
83 | + */ |
|
84 | + public function caf_helper_paths($paths) |
|
85 | + { |
|
86 | + $paths[] = EE_CAF_CORE . 'helpers' . DS; |
|
87 | + return $paths; |
|
88 | + } |
|
89 | 89 | |
90 | 90 | |
91 | - /** |
|
92 | - * Upon brand-new activation, if this is a new activation of CAF, we want to add |
|
93 | - * some global prices that will show off EE4's capabilities. However, if they're upgrading |
|
94 | - * from 3.1, or simply EE4.x decaf, we assume they don't want us to suddenly introduce these extra prices. |
|
95 | - * This action should only be called when EE 4.x.0.P is initially activated. |
|
96 | - * Right now the only CAF content are these global prices. If there's more in the future, then |
|
97 | - * we should probably create a caf file to contain it all instead just a function like this. |
|
98 | - * Right now, we ASSUME the only price types in the system are default ones |
|
99 | - * |
|
100 | - * @global wpdb $wpdb |
|
101 | - */ |
|
102 | - public function initialize_caf_db_content() |
|
103 | - { |
|
104 | - global $wpdb; |
|
105 | - // use same method of getting creator id as the version introducing the change |
|
106 | - $default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id', get_current_user_id()); |
|
107 | - $price_type_table = $wpdb->prefix . "esp_price_type"; |
|
108 | - $price_table = $wpdb->prefix . "esp_price"; |
|
109 | - if ($this->_get_table_analysis()->tableExists($price_type_table)) { |
|
110 | - $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table . ' WHERE PBT_ID=4';// include trashed price types |
|
111 | - $tax_price_type_count = $wpdb->get_var($SQL); |
|
112 | - if ($tax_price_type_count <= 1) { |
|
113 | - $wpdb->insert( |
|
114 | - $price_type_table, |
|
115 | - array( |
|
116 | - 'PRT_name' => __("Regional Tax", "event_espresso"), |
|
117 | - 'PBT_ID' => 4, |
|
118 | - 'PRT_is_percent' => true, |
|
119 | - 'PRT_order' => 60, |
|
120 | - 'PRT_deleted' => false, |
|
121 | - 'PRT_wp_user' => $default_creator_id, |
|
122 | - ), |
|
123 | - array( |
|
124 | - '%s',// PRT_name |
|
125 | - '%d',// PBT_id |
|
126 | - '%d',// PRT_is_percent |
|
127 | - '%d',// PRT_order |
|
128 | - '%d',// PRT_deleted |
|
129 | - '%d', // PRT_wp_user |
|
130 | - ) |
|
131 | - ); |
|
132 | - // federal tax |
|
133 | - $result = $wpdb->insert( |
|
134 | - $price_type_table, |
|
135 | - array( |
|
136 | - 'PRT_name' => __("Federal Tax", "event_espresso"), |
|
137 | - 'PBT_ID' => 4, |
|
138 | - 'PRT_is_percent' => true, |
|
139 | - 'PRT_order' => 70, |
|
140 | - 'PRT_deleted' => false, |
|
141 | - 'PRT_wp_user' => $default_creator_id, |
|
142 | - ), |
|
143 | - array( |
|
144 | - '%s',// PRT_name |
|
145 | - '%d',// PBT_id |
|
146 | - '%d',// PRT_is_percent |
|
147 | - '%d',// PRT_order |
|
148 | - '%d',// PRT_deleted |
|
149 | - '%d' // PRT_wp_user |
|
150 | - ) |
|
151 | - ); |
|
152 | - if ($result) { |
|
153 | - $wpdb->insert( |
|
154 | - $price_table, |
|
155 | - array( |
|
156 | - 'PRT_ID' => $wpdb->insert_id, |
|
157 | - 'PRC_amount' => 15.00, |
|
158 | - 'PRC_name' => __("Sales Tax", "event_espresso"), |
|
159 | - 'PRC_desc' => '', |
|
160 | - 'PRC_is_default' => true, |
|
161 | - 'PRC_overrides' => null, |
|
162 | - 'PRC_deleted' => false, |
|
163 | - 'PRC_order' => 50, |
|
164 | - 'PRC_parent' => null, |
|
165 | - 'PRC_wp_user' => $default_creator_id, |
|
166 | - ), |
|
167 | - array( |
|
168 | - '%d',// PRT_id |
|
169 | - '%f',// PRC_amount |
|
170 | - '%s',// PRC_name |
|
171 | - '%s',// PRC_desc |
|
172 | - '%d',// PRC_is_default |
|
173 | - '%d',// PRC_overrides |
|
174 | - '%d',// PRC_deleted |
|
175 | - '%d',// PRC_order |
|
176 | - '%d',// PRC_parent |
|
177 | - '%d' // PRC_wp_user |
|
178 | - ) |
|
179 | - ); |
|
180 | - } |
|
181 | - } |
|
182 | - } |
|
183 | - } |
|
91 | + /** |
|
92 | + * Upon brand-new activation, if this is a new activation of CAF, we want to add |
|
93 | + * some global prices that will show off EE4's capabilities. However, if they're upgrading |
|
94 | + * from 3.1, or simply EE4.x decaf, we assume they don't want us to suddenly introduce these extra prices. |
|
95 | + * This action should only be called when EE 4.x.0.P is initially activated. |
|
96 | + * Right now the only CAF content are these global prices. If there's more in the future, then |
|
97 | + * we should probably create a caf file to contain it all instead just a function like this. |
|
98 | + * Right now, we ASSUME the only price types in the system are default ones |
|
99 | + * |
|
100 | + * @global wpdb $wpdb |
|
101 | + */ |
|
102 | + public function initialize_caf_db_content() |
|
103 | + { |
|
104 | + global $wpdb; |
|
105 | + // use same method of getting creator id as the version introducing the change |
|
106 | + $default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id', get_current_user_id()); |
|
107 | + $price_type_table = $wpdb->prefix . "esp_price_type"; |
|
108 | + $price_table = $wpdb->prefix . "esp_price"; |
|
109 | + if ($this->_get_table_analysis()->tableExists($price_type_table)) { |
|
110 | + $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table . ' WHERE PBT_ID=4';// include trashed price types |
|
111 | + $tax_price_type_count = $wpdb->get_var($SQL); |
|
112 | + if ($tax_price_type_count <= 1) { |
|
113 | + $wpdb->insert( |
|
114 | + $price_type_table, |
|
115 | + array( |
|
116 | + 'PRT_name' => __("Regional Tax", "event_espresso"), |
|
117 | + 'PBT_ID' => 4, |
|
118 | + 'PRT_is_percent' => true, |
|
119 | + 'PRT_order' => 60, |
|
120 | + 'PRT_deleted' => false, |
|
121 | + 'PRT_wp_user' => $default_creator_id, |
|
122 | + ), |
|
123 | + array( |
|
124 | + '%s',// PRT_name |
|
125 | + '%d',// PBT_id |
|
126 | + '%d',// PRT_is_percent |
|
127 | + '%d',// PRT_order |
|
128 | + '%d',// PRT_deleted |
|
129 | + '%d', // PRT_wp_user |
|
130 | + ) |
|
131 | + ); |
|
132 | + // federal tax |
|
133 | + $result = $wpdb->insert( |
|
134 | + $price_type_table, |
|
135 | + array( |
|
136 | + 'PRT_name' => __("Federal Tax", "event_espresso"), |
|
137 | + 'PBT_ID' => 4, |
|
138 | + 'PRT_is_percent' => true, |
|
139 | + 'PRT_order' => 70, |
|
140 | + 'PRT_deleted' => false, |
|
141 | + 'PRT_wp_user' => $default_creator_id, |
|
142 | + ), |
|
143 | + array( |
|
144 | + '%s',// PRT_name |
|
145 | + '%d',// PBT_id |
|
146 | + '%d',// PRT_is_percent |
|
147 | + '%d',// PRT_order |
|
148 | + '%d',// PRT_deleted |
|
149 | + '%d' // PRT_wp_user |
|
150 | + ) |
|
151 | + ); |
|
152 | + if ($result) { |
|
153 | + $wpdb->insert( |
|
154 | + $price_table, |
|
155 | + array( |
|
156 | + 'PRT_ID' => $wpdb->insert_id, |
|
157 | + 'PRC_amount' => 15.00, |
|
158 | + 'PRC_name' => __("Sales Tax", "event_espresso"), |
|
159 | + 'PRC_desc' => '', |
|
160 | + 'PRC_is_default' => true, |
|
161 | + 'PRC_overrides' => null, |
|
162 | + 'PRC_deleted' => false, |
|
163 | + 'PRC_order' => 50, |
|
164 | + 'PRC_parent' => null, |
|
165 | + 'PRC_wp_user' => $default_creator_id, |
|
166 | + ), |
|
167 | + array( |
|
168 | + '%d',// PRT_id |
|
169 | + '%f',// PRC_amount |
|
170 | + '%s',// PRC_name |
|
171 | + '%s',// PRC_desc |
|
172 | + '%d',// PRC_is_default |
|
173 | + '%d',// PRC_overrides |
|
174 | + '%d',// PRC_deleted |
|
175 | + '%d',// PRC_order |
|
176 | + '%d',// PRC_parent |
|
177 | + '%d' // PRC_wp_user |
|
178 | + ) |
|
179 | + ); |
|
180 | + } |
|
181 | + } |
|
182 | + } |
|
183 | + } |
|
184 | 184 | |
185 | 185 | |
186 | - /** |
|
187 | - * caffeinated_modules_to_register |
|
188 | - * |
|
189 | - * @access public |
|
190 | - * @param array $modules_to_register |
|
191 | - * @return array |
|
192 | - */ |
|
193 | - public function caffeinated_modules_to_register($modules_to_register = array()) |
|
194 | - { |
|
195 | - if (is_readable(EE_CAFF_PATH . 'modules')) { |
|
196 | - $caffeinated_modules_to_register = glob(EE_CAFF_PATH . 'modules' . DS . '*', GLOB_ONLYDIR); |
|
197 | - if (is_array($caffeinated_modules_to_register) && ! empty($caffeinated_modules_to_register)) { |
|
198 | - $modules_to_register = array_merge($modules_to_register, $caffeinated_modules_to_register); |
|
199 | - } |
|
200 | - } |
|
201 | - return $modules_to_register; |
|
202 | - } |
|
186 | + /** |
|
187 | + * caffeinated_modules_to_register |
|
188 | + * |
|
189 | + * @access public |
|
190 | + * @param array $modules_to_register |
|
191 | + * @return array |
|
192 | + */ |
|
193 | + public function caffeinated_modules_to_register($modules_to_register = array()) |
|
194 | + { |
|
195 | + if (is_readable(EE_CAFF_PATH . 'modules')) { |
|
196 | + $caffeinated_modules_to_register = glob(EE_CAFF_PATH . 'modules' . DS . '*', GLOB_ONLYDIR); |
|
197 | + if (is_array($caffeinated_modules_to_register) && ! empty($caffeinated_modules_to_register)) { |
|
198 | + $modules_to_register = array_merge($modules_to_register, $caffeinated_modules_to_register); |
|
199 | + } |
|
200 | + } |
|
201 | + return $modules_to_register; |
|
202 | + } |
|
203 | 203 | |
204 | 204 | |
205 | - /** |
|
206 | - * @throws EE_Error |
|
207 | - * @throws InvalidArgumentException |
|
208 | - * @throws ReflectionException |
|
209 | - * @throws InvalidDataTypeException |
|
210 | - * @throws InvalidInterfaceException |
|
211 | - */ |
|
212 | - public function caffeinated_init() |
|
213 | - { |
|
214 | - // Custom Post Type hooks |
|
215 | - add_filter( |
|
216 | - 'FHEE__EventEspresso_core_domain_entities_custom_post_types_TaxonomyDefinitions__getTaxonomies', |
|
217 | - array($this, 'filter_taxonomies') |
|
218 | - ); |
|
219 | - add_filter( |
|
220 | - 'FHEE__EventEspresso_core_domain_entities_custom_post_types_CustomPostTypeDefinitions__getCustomPostTypes', |
|
221 | - array($this, 'filter_cpts') |
|
222 | - ); |
|
223 | - add_filter( |
|
224 | - 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', |
|
225 | - array($this, 'nav_metabox_items') |
|
226 | - ); |
|
227 | - EE_Registry::instance()->load_file( |
|
228 | - EE_CAFF_PATH, |
|
229 | - 'EE_Caf_Messages', |
|
230 | - 'class', |
|
231 | - array(), |
|
232 | - false |
|
233 | - ); |
|
234 | - // caffeinated_init__complete hook |
|
235 | - do_action('AHEE__EE_Brewing_Regular__caffeinated_init__complete'); |
|
236 | - } |
|
205 | + /** |
|
206 | + * @throws EE_Error |
|
207 | + * @throws InvalidArgumentException |
|
208 | + * @throws ReflectionException |
|
209 | + * @throws InvalidDataTypeException |
|
210 | + * @throws InvalidInterfaceException |
|
211 | + */ |
|
212 | + public function caffeinated_init() |
|
213 | + { |
|
214 | + // Custom Post Type hooks |
|
215 | + add_filter( |
|
216 | + 'FHEE__EventEspresso_core_domain_entities_custom_post_types_TaxonomyDefinitions__getTaxonomies', |
|
217 | + array($this, 'filter_taxonomies') |
|
218 | + ); |
|
219 | + add_filter( |
|
220 | + 'FHEE__EventEspresso_core_domain_entities_custom_post_types_CustomPostTypeDefinitions__getCustomPostTypes', |
|
221 | + array($this, 'filter_cpts') |
|
222 | + ); |
|
223 | + add_filter( |
|
224 | + 'FHEE__EE_Admin__get_extra_nav_menu_pages_items', |
|
225 | + array($this, 'nav_metabox_items') |
|
226 | + ); |
|
227 | + EE_Registry::instance()->load_file( |
|
228 | + EE_CAFF_PATH, |
|
229 | + 'EE_Caf_Messages', |
|
230 | + 'class', |
|
231 | + array(), |
|
232 | + false |
|
233 | + ); |
|
234 | + // caffeinated_init__complete hook |
|
235 | + do_action('AHEE__EE_Brewing_Regular__caffeinated_init__complete'); |
|
236 | + } |
|
237 | 237 | |
238 | 238 | |
239 | - public function enqueue_caffeinated_scripts() |
|
240 | - { |
|
241 | - // sound of crickets... |
|
242 | - } |
|
239 | + public function enqueue_caffeinated_scripts() |
|
240 | + { |
|
241 | + // sound of crickets... |
|
242 | + } |
|
243 | 243 | |
244 | 244 | |
245 | - /** |
|
246 | - * callbacks below here |
|
247 | - * |
|
248 | - * @param array $taxonomy_array |
|
249 | - * @return array |
|
250 | - */ |
|
251 | - public function filter_taxonomies(array $taxonomy_array) |
|
252 | - { |
|
253 | - $taxonomy_array['espresso_venue_categories']['args']['show_in_nav_menus'] = true; |
|
254 | - return $taxonomy_array; |
|
255 | - } |
|
245 | + /** |
|
246 | + * callbacks below here |
|
247 | + * |
|
248 | + * @param array $taxonomy_array |
|
249 | + * @return array |
|
250 | + */ |
|
251 | + public function filter_taxonomies(array $taxonomy_array) |
|
252 | + { |
|
253 | + $taxonomy_array['espresso_venue_categories']['args']['show_in_nav_menus'] = true; |
|
254 | + return $taxonomy_array; |
|
255 | + } |
|
256 | 256 | |
257 | 257 | |
258 | - /** |
|
259 | - * @param array $cpt_array |
|
260 | - * @return mixed |
|
261 | - */ |
|
262 | - public function filter_cpts(array $cpt_array) |
|
263 | - { |
|
264 | - $cpt_array['espresso_venues']['args']['show_in_nav_menus'] = true; |
|
265 | - return $cpt_array; |
|
266 | - } |
|
258 | + /** |
|
259 | + * @param array $cpt_array |
|
260 | + * @return mixed |
|
261 | + */ |
|
262 | + public function filter_cpts(array $cpt_array) |
|
263 | + { |
|
264 | + $cpt_array['espresso_venues']['args']['show_in_nav_menus'] = true; |
|
265 | + return $cpt_array; |
|
266 | + } |
|
267 | 267 | |
268 | 268 | |
269 | - /** |
|
270 | - * @param array $menuitems |
|
271 | - * @return array |
|
272 | - */ |
|
273 | - public function nav_metabox_items(array $menuitems) |
|
274 | - { |
|
275 | - $menuitems[] = array( |
|
276 | - 'title' => __('Venue List', 'event_espresso'), |
|
277 | - 'url' => get_post_type_archive_link('espresso_venues'), |
|
278 | - 'description' => __('Archive page for all venues.', 'event_espresso'), |
|
279 | - ); |
|
280 | - return $menuitems; |
|
281 | - } |
|
269 | + /** |
|
270 | + * @param array $menuitems |
|
271 | + * @return array |
|
272 | + */ |
|
273 | + public function nav_metabox_items(array $menuitems) |
|
274 | + { |
|
275 | + $menuitems[] = array( |
|
276 | + 'title' => __('Venue List', 'event_espresso'), |
|
277 | + 'url' => get_post_type_archive_link('espresso_venues'), |
|
278 | + 'description' => __('Archive page for all venues.', 'event_espresso'), |
|
279 | + ); |
|
280 | + return $menuitems; |
|
281 | + } |
|
282 | 282 | |
283 | 283 | |
284 | - /** |
|
285 | - * Gets the injected table analyzer, or throws an exception |
|
286 | - * |
|
287 | - * @return TableAnalysis |
|
288 | - * @throws \EE_Error |
|
289 | - */ |
|
290 | - protected function _get_table_analysis() |
|
291 | - { |
|
292 | - if ($this->_table_analysis instanceof TableAnalysis) { |
|
293 | - return $this->_table_analysis; |
|
294 | - } else { |
|
295 | - throw new \EE_Error( |
|
296 | - sprintf( |
|
297 | - __('Table analysis class on class %1$s is not set properly.', 'event_espresso'), |
|
298 | - get_class($this) |
|
299 | - ) |
|
300 | - ); |
|
301 | - } |
|
302 | - } |
|
284 | + /** |
|
285 | + * Gets the injected table analyzer, or throws an exception |
|
286 | + * |
|
287 | + * @return TableAnalysis |
|
288 | + * @throws \EE_Error |
|
289 | + */ |
|
290 | + protected function _get_table_analysis() |
|
291 | + { |
|
292 | + if ($this->_table_analysis instanceof TableAnalysis) { |
|
293 | + return $this->_table_analysis; |
|
294 | + } else { |
|
295 | + throw new \EE_Error( |
|
296 | + sprintf( |
|
297 | + __('Table analysis class on class %1$s is not set properly.', 'event_espresso'), |
|
298 | + get_class($this) |
|
299 | + ) |
|
300 | + ); |
|
301 | + } |
|
302 | + } |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | |
306 | 306 | $brewing = new EE_Brewing_Regular( |
307 | - EE_Registry::instance()->create('TableAnalysis', array(), true) |
|
307 | + EE_Registry::instance()->create('TableAnalysis', array(), true) |
|
308 | 308 | ); |
@@ -11,10 +11,10 @@ discard block |
||
11 | 11 | * define and use the hook in a specific caffeinated/whatever class or file. |
12 | 12 | */ |
13 | 13 | // defined some new constants related to caffeinated folder |
14 | -define('EE_CAF_URL', EE_PLUGIN_DIR_URL . 'caffeinated/'); |
|
15 | -define('EE_CAF_CORE', EE_CAFF_PATH . 'core' . DS); |
|
16 | -define('EE_CAF_LIBRARIES', EE_CAF_CORE . 'libraries' . DS); |
|
17 | -define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH . 'payment_methods' . DS); |
|
14 | +define('EE_CAF_URL', EE_PLUGIN_DIR_URL.'caffeinated/'); |
|
15 | +define('EE_CAF_CORE', EE_CAFF_PATH.'core'.DS); |
|
16 | +define('EE_CAF_LIBRARIES', EE_CAF_CORE.'libraries'.DS); |
|
17 | +define('EE_CAF_PAYMENT_METHODS', EE_CAFF_PATH.'payment_methods'.DS); |
|
18 | 18 | |
19 | 19 | |
20 | 20 | /** |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | EE_Register_Payment_Method::register( |
65 | 65 | 'caffeinated_payment_methods', |
66 | 66 | array( |
67 | - 'payment_method_paths' => glob(EE_CAF_PAYMENT_METHODS . '*', GLOB_ONLYDIR), |
|
67 | + 'payment_method_paths' => glob(EE_CAF_PAYMENT_METHODS.'*', GLOB_ONLYDIR), |
|
68 | 68 | ) |
69 | 69 | ); |
70 | 70 | // caffeinated constructed |
@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | */ |
84 | 84 | public function caf_helper_paths($paths) |
85 | 85 | { |
86 | - $paths[] = EE_CAF_CORE . 'helpers' . DS; |
|
86 | + $paths[] = EE_CAF_CORE.'helpers'.DS; |
|
87 | 87 | return $paths; |
88 | 88 | } |
89 | 89 | |
@@ -104,10 +104,10 @@ discard block |
||
104 | 104 | global $wpdb; |
105 | 105 | // use same method of getting creator id as the version introducing the change |
106 | 106 | $default_creator_id = apply_filters('FHEE__EE_DMS_Core_4_5_0__get_default_creator_id', get_current_user_id()); |
107 | - $price_type_table = $wpdb->prefix . "esp_price_type"; |
|
108 | - $price_table = $wpdb->prefix . "esp_price"; |
|
107 | + $price_type_table = $wpdb->prefix."esp_price_type"; |
|
108 | + $price_table = $wpdb->prefix."esp_price"; |
|
109 | 109 | if ($this->_get_table_analysis()->tableExists($price_type_table)) { |
110 | - $SQL = 'SELECT COUNT(PRT_ID) FROM ' . $price_type_table . ' WHERE PBT_ID=4';// include trashed price types |
|
110 | + $SQL = 'SELECT COUNT(PRT_ID) FROM '.$price_type_table.' WHERE PBT_ID=4'; // include trashed price types |
|
111 | 111 | $tax_price_type_count = $wpdb->get_var($SQL); |
112 | 112 | if ($tax_price_type_count <= 1) { |
113 | 113 | $wpdb->insert( |
@@ -121,11 +121,11 @@ discard block |
||
121 | 121 | 'PRT_wp_user' => $default_creator_id, |
122 | 122 | ), |
123 | 123 | array( |
124 | - '%s',// PRT_name |
|
125 | - '%d',// PBT_id |
|
126 | - '%d',// PRT_is_percent |
|
127 | - '%d',// PRT_order |
|
128 | - '%d',// PRT_deleted |
|
124 | + '%s', // PRT_name |
|
125 | + '%d', // PBT_id |
|
126 | + '%d', // PRT_is_percent |
|
127 | + '%d', // PRT_order |
|
128 | + '%d', // PRT_deleted |
|
129 | 129 | '%d', // PRT_wp_user |
130 | 130 | ) |
131 | 131 | ); |
@@ -141,11 +141,11 @@ discard block |
||
141 | 141 | 'PRT_wp_user' => $default_creator_id, |
142 | 142 | ), |
143 | 143 | array( |
144 | - '%s',// PRT_name |
|
145 | - '%d',// PBT_id |
|
146 | - '%d',// PRT_is_percent |
|
147 | - '%d',// PRT_order |
|
148 | - '%d',// PRT_deleted |
|
144 | + '%s', // PRT_name |
|
145 | + '%d', // PBT_id |
|
146 | + '%d', // PRT_is_percent |
|
147 | + '%d', // PRT_order |
|
148 | + '%d', // PRT_deleted |
|
149 | 149 | '%d' // PRT_wp_user |
150 | 150 | ) |
151 | 151 | ); |
@@ -165,15 +165,15 @@ discard block |
||
165 | 165 | 'PRC_wp_user' => $default_creator_id, |
166 | 166 | ), |
167 | 167 | array( |
168 | - '%d',// PRT_id |
|
169 | - '%f',// PRC_amount |
|
170 | - '%s',// PRC_name |
|
171 | - '%s',// PRC_desc |
|
172 | - '%d',// PRC_is_default |
|
173 | - '%d',// PRC_overrides |
|
174 | - '%d',// PRC_deleted |
|
175 | - '%d',// PRC_order |
|
176 | - '%d',// PRC_parent |
|
168 | + '%d', // PRT_id |
|
169 | + '%f', // PRC_amount |
|
170 | + '%s', // PRC_name |
|
171 | + '%s', // PRC_desc |
|
172 | + '%d', // PRC_is_default |
|
173 | + '%d', // PRC_overrides |
|
174 | + '%d', // PRC_deleted |
|
175 | + '%d', // PRC_order |
|
176 | + '%d', // PRC_parent |
|
177 | 177 | '%d' // PRC_wp_user |
178 | 178 | ) |
179 | 179 | ); |
@@ -192,8 +192,8 @@ discard block |
||
192 | 192 | */ |
193 | 193 | public function caffeinated_modules_to_register($modules_to_register = array()) |
194 | 194 | { |
195 | - if (is_readable(EE_CAFF_PATH . 'modules')) { |
|
196 | - $caffeinated_modules_to_register = glob(EE_CAFF_PATH . 'modules' . DS . '*', GLOB_ONLYDIR); |
|
195 | + if (is_readable(EE_CAFF_PATH.'modules')) { |
|
196 | + $caffeinated_modules_to_register = glob(EE_CAFF_PATH.'modules'.DS.'*', GLOB_ONLYDIR); |
|
197 | 197 | if (is_array($caffeinated_modules_to_register) && ! empty($caffeinated_modules_to_register)) { |
198 | 198 | $modules_to_register = array_merge($modules_to_register, $caffeinated_modules_to_register); |
199 | 199 | } |
@@ -16,208 +16,208 @@ |
||
16 | 16 | class espresso_events_Registration_Form_Hooks_Extend extends espresso_events_Registration_Form_Hooks |
17 | 17 | { |
18 | 18 | |
19 | - /** |
|
20 | - * extending the properties set in espresso_events_Registration_From_Hooks |
|
21 | - * |
|
22 | - * @access protected |
|
23 | - * @return void |
|
24 | - */ |
|
25 | - protected function _extend_properties() |
|
26 | - { |
|
27 | - $this->_metaboxes = array_merge( |
|
28 | - $this->_metaboxes, |
|
29 | - array( |
|
30 | - 1 => array( |
|
31 | - 'page_route' => array('create_new', 'edit'), |
|
32 | - 'func' => 'additional_questions', |
|
33 | - 'label' => esc_html__('Questions for Additional Registrants', 'event_espresso'), |
|
34 | - 'priority' => 'default', |
|
35 | - 'context' => 'side', |
|
36 | - ), |
|
37 | - ) |
|
38 | - ); |
|
39 | - $this->_scripts_styles = array( |
|
40 | - 'registers' => array( |
|
41 | - 'extended-event-editor' => array( |
|
42 | - 'url' => EE_CORE_CAF_ADMIN_EXTEND_URL |
|
43 | - . 'registration_form/assets/event-editor-question-groups.js', |
|
44 | - 'depends' => array('jquery'), |
|
45 | - ), |
|
46 | - ), |
|
47 | - 'enqueues' => array( |
|
48 | - 'extended-event-editor' => array('edit', 'create_new'), |
|
49 | - ), |
|
50 | - ); |
|
51 | - } |
|
52 | - |
|
53 | - |
|
54 | - /** |
|
55 | - * @param Callable[] $callbacks |
|
56 | - * @return array |
|
57 | - */ |
|
58 | - public function modify_callbacks($callbacks) |
|
59 | - { |
|
60 | - $callbacks = parent::modify_callbacks($callbacks); |
|
61 | - $callbacks[] = array($this, 'additional_question_group_update'); |
|
62 | - return $callbacks; |
|
63 | - } |
|
64 | - |
|
65 | - |
|
66 | - /** |
|
67 | - * Call back hooked into revision restores. |
|
68 | - * |
|
69 | - * @param $post_id |
|
70 | - * @param $revision_id |
|
71 | - * @return EE_Base_Class|void |
|
72 | - * @throws EE_Error |
|
73 | - * @throws InvalidArgumentException |
|
74 | - * @throws InvalidDataTypeException |
|
75 | - * @throws InvalidInterfaceException |
|
76 | - * @throws ReflectionException |
|
77 | - */ |
|
78 | - public function restore_revision($post_id, $revision_id) |
|
79 | - { |
|
80 | - $post_evt = parent::restore_revision($post_id, $revision_id); |
|
81 | - |
|
82 | - // restore revision for additional questions |
|
83 | - $post_evt->restore_revision( |
|
84 | - $revision_id, |
|
85 | - array('Question_Group'), |
|
86 | - array( |
|
87 | - 'Question_Group' => array('Event_Question_Group.EQG_primary' => 0), |
|
88 | - ) |
|
89 | - ); |
|
90 | - } |
|
91 | - |
|
92 | - |
|
93 | - /** |
|
94 | - * @param $post_id |
|
95 | - * @param $post |
|
96 | - * @throws EE_Error |
|
97 | - * @throws InvalidArgumentException |
|
98 | - * @throws InvalidDataTypeException |
|
99 | - * @throws InvalidInterfaceException |
|
100 | - */ |
|
101 | - public function additional_questions($post_id, $post) |
|
102 | - { |
|
103 | - $this->_event = $this->_adminpage_obj->get_event_object(); |
|
104 | - $event_id = $this->_event->ID(); |
|
105 | - ?> |
|
19 | + /** |
|
20 | + * extending the properties set in espresso_events_Registration_From_Hooks |
|
21 | + * |
|
22 | + * @access protected |
|
23 | + * @return void |
|
24 | + */ |
|
25 | + protected function _extend_properties() |
|
26 | + { |
|
27 | + $this->_metaboxes = array_merge( |
|
28 | + $this->_metaboxes, |
|
29 | + array( |
|
30 | + 1 => array( |
|
31 | + 'page_route' => array('create_new', 'edit'), |
|
32 | + 'func' => 'additional_questions', |
|
33 | + 'label' => esc_html__('Questions for Additional Registrants', 'event_espresso'), |
|
34 | + 'priority' => 'default', |
|
35 | + 'context' => 'side', |
|
36 | + ), |
|
37 | + ) |
|
38 | + ); |
|
39 | + $this->_scripts_styles = array( |
|
40 | + 'registers' => array( |
|
41 | + 'extended-event-editor' => array( |
|
42 | + 'url' => EE_CORE_CAF_ADMIN_EXTEND_URL |
|
43 | + . 'registration_form/assets/event-editor-question-groups.js', |
|
44 | + 'depends' => array('jquery'), |
|
45 | + ), |
|
46 | + ), |
|
47 | + 'enqueues' => array( |
|
48 | + 'extended-event-editor' => array('edit', 'create_new'), |
|
49 | + ), |
|
50 | + ); |
|
51 | + } |
|
52 | + |
|
53 | + |
|
54 | + /** |
|
55 | + * @param Callable[] $callbacks |
|
56 | + * @return array |
|
57 | + */ |
|
58 | + public function modify_callbacks($callbacks) |
|
59 | + { |
|
60 | + $callbacks = parent::modify_callbacks($callbacks); |
|
61 | + $callbacks[] = array($this, 'additional_question_group_update'); |
|
62 | + return $callbacks; |
|
63 | + } |
|
64 | + |
|
65 | + |
|
66 | + /** |
|
67 | + * Call back hooked into revision restores. |
|
68 | + * |
|
69 | + * @param $post_id |
|
70 | + * @param $revision_id |
|
71 | + * @return EE_Base_Class|void |
|
72 | + * @throws EE_Error |
|
73 | + * @throws InvalidArgumentException |
|
74 | + * @throws InvalidDataTypeException |
|
75 | + * @throws InvalidInterfaceException |
|
76 | + * @throws ReflectionException |
|
77 | + */ |
|
78 | + public function restore_revision($post_id, $revision_id) |
|
79 | + { |
|
80 | + $post_evt = parent::restore_revision($post_id, $revision_id); |
|
81 | + |
|
82 | + // restore revision for additional questions |
|
83 | + $post_evt->restore_revision( |
|
84 | + $revision_id, |
|
85 | + array('Question_Group'), |
|
86 | + array( |
|
87 | + 'Question_Group' => array('Event_Question_Group.EQG_primary' => 0), |
|
88 | + ) |
|
89 | + ); |
|
90 | + } |
|
91 | + |
|
92 | + |
|
93 | + /** |
|
94 | + * @param $post_id |
|
95 | + * @param $post |
|
96 | + * @throws EE_Error |
|
97 | + * @throws InvalidArgumentException |
|
98 | + * @throws InvalidDataTypeException |
|
99 | + * @throws InvalidInterfaceException |
|
100 | + */ |
|
101 | + public function additional_questions($post_id, $post) |
|
102 | + { |
|
103 | + $this->_event = $this->_adminpage_obj->get_event_object(); |
|
104 | + $event_id = $this->_event->ID(); |
|
105 | + ?> |
|
106 | 106 | <div class="inside"> |
107 | 107 | <p><strong> |
108 | 108 | <?php _e('Question Groups', 'event_espresso'); ?> |
109 | 109 | </strong><br/> |
110 | 110 | <?php |
111 | - printf( |
|
112 | - esc_html__( |
|
113 | - 'Add a pre-populated %1$sgroup of questions%2$s to your event.', |
|
114 | - 'event_espresso' |
|
115 | - ), |
|
116 | - '<a href="admin.php?page=espresso_registration_form" target="_blank">', |
|
117 | - '</a>' |
|
118 | - ); |
|
119 | - ?> |
|
111 | + printf( |
|
112 | + esc_html__( |
|
113 | + 'Add a pre-populated %1$sgroup of questions%2$s to your event.', |
|
114 | + 'event_espresso' |
|
115 | + ), |
|
116 | + '<a href="admin.php?page=espresso_registration_form" target="_blank">', |
|
117 | + '</a>' |
|
118 | + ); |
|
119 | + ?> |
|
120 | 120 | </p> |
121 | 121 | <?php |
122 | 122 | |
123 | - $qsg_where['QSG_deleted'] = false; |
|
124 | - $query_params = apply_filters( |
|
125 | - 'FHEE__espresso_events_Registration_Form_Hooks_Extend__additional_questions__question_group_query_parameters', |
|
126 | - array($qsg_where, 'order_by' => array('QSG_order' => 'ASC')) |
|
127 | - ); |
|
128 | - $QSGs = EEM_Question_Group::instance()->get_all($query_params); |
|
129 | - $EQGs = ! empty($event_id) |
|
130 | - ? $this->_event->get_many_related( |
|
131 | - 'Question_Group', |
|
132 | - array(array('Event_Question_Group.EQG_primary' => 0)) |
|
133 | - ) |
|
134 | - : array(); |
|
135 | - $EQGids = array_keys($EQGs); |
|
136 | - |
|
137 | - if (! empty($QSGs)) { |
|
138 | - $html = count($QSGs) > 10 ? '<div style="height:250px;overflow:auto;">' : ''; |
|
139 | - foreach ($QSGs as $QSG) { |
|
140 | - $checked = in_array($QSG->ID(), $EQGids, true) ? ' checked="checked" ' : ''; |
|
141 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce( |
|
142 | - array( |
|
143 | - 'action' => 'edit_question_group', |
|
144 | - 'QSG_ID' => $QSG->ID(), |
|
145 | - ), |
|
146 | - EE_FORMS_ADMIN_URL |
|
147 | - ); |
|
148 | - |
|
149 | - $html .= ' |
|
123 | + $qsg_where['QSG_deleted'] = false; |
|
124 | + $query_params = apply_filters( |
|
125 | + 'FHEE__espresso_events_Registration_Form_Hooks_Extend__additional_questions__question_group_query_parameters', |
|
126 | + array($qsg_where, 'order_by' => array('QSG_order' => 'ASC')) |
|
127 | + ); |
|
128 | + $QSGs = EEM_Question_Group::instance()->get_all($query_params); |
|
129 | + $EQGs = ! empty($event_id) |
|
130 | + ? $this->_event->get_many_related( |
|
131 | + 'Question_Group', |
|
132 | + array(array('Event_Question_Group.EQG_primary' => 0)) |
|
133 | + ) |
|
134 | + : array(); |
|
135 | + $EQGids = array_keys($EQGs); |
|
136 | + |
|
137 | + if (! empty($QSGs)) { |
|
138 | + $html = count($QSGs) > 10 ? '<div style="height:250px;overflow:auto;">' : ''; |
|
139 | + foreach ($QSGs as $QSG) { |
|
140 | + $checked = in_array($QSG->ID(), $EQGids, true) ? ' checked="checked" ' : ''; |
|
141 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce( |
|
142 | + array( |
|
143 | + 'action' => 'edit_question_group', |
|
144 | + 'QSG_ID' => $QSG->ID(), |
|
145 | + ), |
|
146 | + EE_FORMS_ADMIN_URL |
|
147 | + ); |
|
148 | + |
|
149 | + $html .= ' |
|
150 | 150 | <p id="event-question-group-' . $QSG->ID() . '"> |
151 | 151 | <input value="' . $QSG->ID() . '"' |
152 | - . ' type="checkbox" name="add_attendee_question_groups[' . $QSG->ID() . ']"' . $checked . ' /> |
|
152 | + . ' type="checkbox" name="add_attendee_question_groups[' . $QSG->ID() . ']"' . $checked . ' /> |
|
153 | 153 | <a href="' . $edit_link . '" title="' |
154 | - . sprintf( |
|
155 | - esc_attr__('Edit %s Group', 'event_espresso'), |
|
156 | - $QSG->get('QSG_name') |
|
157 | - ) |
|
158 | - . '" target="_blank">' . $QSG->get('QSG_name') . '</a> |
|
154 | + . sprintf( |
|
155 | + esc_attr__('Edit %s Group', 'event_espresso'), |
|
156 | + $QSG->get('QSG_name') |
|
157 | + ) |
|
158 | + . '" target="_blank">' . $QSG->get('QSG_name') . '</a> |
|
159 | 159 | </p>'; |
160 | - if ($QSG->ID() === 2) { |
|
161 | - $html .= ' |
|
160 | + if ($QSG->ID() === 2) { |
|
161 | + $html .= ' |
|
162 | 162 | <p id="question-group-requirements-notice-pg" class="important-notice small-text" style="display: none;">' |
163 | - . esc_html__( |
|
164 | - 'The Personal Information question group is required whenever the Address Information question group is activated.', |
|
165 | - 'event_espresso' |
|
166 | - ) |
|
167 | - . '</p>'; |
|
168 | - } |
|
169 | - } |
|
170 | - $html .= count($QSGs) > 10 ? '</div>' : ''; |
|
171 | - |
|
172 | - echo $html; |
|
173 | - } else { |
|
174 | - esc_html_e( |
|
175 | - 'There seems to be a problem with your questions. Please contact [email protected]', |
|
176 | - 'event_espresso' |
|
177 | - ); |
|
178 | - } |
|
179 | - do_action('AHEE__espresso_events_Registration_Form_Hooks__additional_questions__after_content'); |
|
180 | - ?> |
|
163 | + . esc_html__( |
|
164 | + 'The Personal Information question group is required whenever the Address Information question group is activated.', |
|
165 | + 'event_espresso' |
|
166 | + ) |
|
167 | + . '</p>'; |
|
168 | + } |
|
169 | + } |
|
170 | + $html .= count($QSGs) > 10 ? '</div>' : ''; |
|
171 | + |
|
172 | + echo $html; |
|
173 | + } else { |
|
174 | + esc_html_e( |
|
175 | + 'There seems to be a problem with your questions. Please contact [email protected]', |
|
176 | + 'event_espresso' |
|
177 | + ); |
|
178 | + } |
|
179 | + do_action('AHEE__espresso_events_Registration_Form_Hooks__additional_questions__after_content'); |
|
180 | + ?> |
|
181 | 181 | </div> |
182 | 182 | <?php |
183 | - } |
|
184 | - |
|
185 | - |
|
186 | - public function additional_question_group_update($evtobj, $data) |
|
187 | - { |
|
188 | - $question_groups = ! empty($data['add_attendee_question_groups']) |
|
189 | - ? (array) $data['add_attendee_question_groups'] |
|
190 | - : array(); |
|
191 | - $added_qgs = array_keys($question_groups); |
|
192 | - $success = array(); |
|
193 | - |
|
194 | - // let's get all current question groups associated with this event. |
|
195 | - $current_qgs = $evtobj->get_many_related( |
|
196 | - 'Question_Group', |
|
197 | - array(array('Event_Question_Group.EQG_primary' => 0)) |
|
198 | - ); |
|
199 | - $current_qgs = array_keys($current_qgs); // we just want the ids |
|
200 | - |
|
201 | - // now let's get the groups selected in the editor and update (IF we have data) |
|
202 | - if (! empty($question_groups)) { |
|
203 | - foreach ($question_groups as $id => $val) { |
|
204 | - // add to event |
|
205 | - if ($val) { |
|
206 | - $qg = $evtobj->_add_relation_to($id, 'Question_Group', array('EQG_primary' => 0)); |
|
207 | - } |
|
208 | - $success[] = ! empty($qg) ? 1 : 0; |
|
209 | - } |
|
210 | - } |
|
211 | - |
|
212 | - // wait a minute... are there question groups missing in the saved groups that ARE with the current event? |
|
213 | - $removed_qgs = array_diff($current_qgs, $added_qgs); |
|
214 | - |
|
215 | - foreach ($removed_qgs as $qgid) { |
|
216 | - $qg = $evtobj->_remove_relation_to($qgid, 'Question_Group', array('EQG_primary' => 0)); |
|
217 | - $success[] = ! empty($qg) ? 1 : 0; |
|
218 | - } |
|
219 | - |
|
220 | - |
|
221 | - return in_array(0, $success, true) ? false : true; |
|
222 | - } |
|
183 | + } |
|
184 | + |
|
185 | + |
|
186 | + public function additional_question_group_update($evtobj, $data) |
|
187 | + { |
|
188 | + $question_groups = ! empty($data['add_attendee_question_groups']) |
|
189 | + ? (array) $data['add_attendee_question_groups'] |
|
190 | + : array(); |
|
191 | + $added_qgs = array_keys($question_groups); |
|
192 | + $success = array(); |
|
193 | + |
|
194 | + // let's get all current question groups associated with this event. |
|
195 | + $current_qgs = $evtobj->get_many_related( |
|
196 | + 'Question_Group', |
|
197 | + array(array('Event_Question_Group.EQG_primary' => 0)) |
|
198 | + ); |
|
199 | + $current_qgs = array_keys($current_qgs); // we just want the ids |
|
200 | + |
|
201 | + // now let's get the groups selected in the editor and update (IF we have data) |
|
202 | + if (! empty($question_groups)) { |
|
203 | + foreach ($question_groups as $id => $val) { |
|
204 | + // add to event |
|
205 | + if ($val) { |
|
206 | + $qg = $evtobj->_add_relation_to($id, 'Question_Group', array('EQG_primary' => 0)); |
|
207 | + } |
|
208 | + $success[] = ! empty($qg) ? 1 : 0; |
|
209 | + } |
|
210 | + } |
|
211 | + |
|
212 | + // wait a minute... are there question groups missing in the saved groups that ARE with the current event? |
|
213 | + $removed_qgs = array_diff($current_qgs, $added_qgs); |
|
214 | + |
|
215 | + foreach ($removed_qgs as $qgid) { |
|
216 | + $qg = $evtobj->_remove_relation_to($qgid, 'Question_Group', array('EQG_primary' => 0)); |
|
217 | + $success[] = ! empty($qg) ? 1 : 0; |
|
218 | + } |
|
219 | + |
|
220 | + |
|
221 | + return in_array(0, $success, true) ? false : true; |
|
222 | + } |
|
223 | 223 | } |
@@ -134,7 +134,7 @@ discard block |
||
134 | 134 | : array(); |
135 | 135 | $EQGids = array_keys($EQGs); |
136 | 136 | |
137 | - if (! empty($QSGs)) { |
|
137 | + if ( ! empty($QSGs)) { |
|
138 | 138 | $html = count($QSGs) > 10 ? '<div style="height:250px;overflow:auto;">' : ''; |
139 | 139 | foreach ($QSGs as $QSG) { |
140 | 140 | $checked = in_array($QSG->ID(), $EQGids, true) ? ' checked="checked" ' : ''; |
@@ -147,15 +147,15 @@ discard block |
||
147 | 147 | ); |
148 | 148 | |
149 | 149 | $html .= ' |
150 | - <p id="event-question-group-' . $QSG->ID() . '"> |
|
151 | - <input value="' . $QSG->ID() . '"' |
|
152 | - . ' type="checkbox" name="add_attendee_question_groups[' . $QSG->ID() . ']"' . $checked . ' /> |
|
153 | - <a href="' . $edit_link . '" title="' |
|
150 | + <p id="event-question-group-' . $QSG->ID().'"> |
|
151 | + <input value="' . $QSG->ID().'"' |
|
152 | + . ' type="checkbox" name="add_attendee_question_groups['.$QSG->ID().']"'.$checked.' /> |
|
153 | + <a href="' . $edit_link.'" title="' |
|
154 | 154 | . sprintf( |
155 | 155 | esc_attr__('Edit %s Group', 'event_espresso'), |
156 | 156 | $QSG->get('QSG_name') |
157 | 157 | ) |
158 | - . '" target="_blank">' . $QSG->get('QSG_name') . '</a> |
|
158 | + . '" target="_blank">'.$QSG->get('QSG_name').'</a> |
|
159 | 159 | </p>'; |
160 | 160 | if ($QSG->ID() === 2) { |
161 | 161 | $html .= ' |
@@ -199,7 +199,7 @@ discard block |
||
199 | 199 | $current_qgs = array_keys($current_qgs); // we just want the ids |
200 | 200 | |
201 | 201 | // now let's get the groups selected in the editor and update (IF we have data) |
202 | - if (! empty($question_groups)) { |
|
202 | + if ( ! empty($question_groups)) { |
|
203 | 203 | foreach ($question_groups as $id => $val) { |
204 | 204 | // add to event |
205 | 205 | if ($val) { |
@@ -16,113 +16,113 @@ |
||
16 | 16 | class Extend_Registration_Form_Questions_Admin_List_Table extends Registration_Form_Questions_Admin_List_Table |
17 | 17 | { |
18 | 18 | |
19 | - public function __construct($admin_page) |
|
20 | - { |
|
21 | - parent::__construct($admin_page); |
|
22 | - } |
|
19 | + public function __construct($admin_page) |
|
20 | + { |
|
21 | + parent::__construct($admin_page); |
|
22 | + } |
|
23 | 23 | |
24 | - public function column_display_text(EE_Question $item) |
|
25 | - { |
|
26 | - $system_question = $item->is_system_question(); |
|
27 | - $actions = array(); |
|
24 | + public function column_display_text(EE_Question $item) |
|
25 | + { |
|
26 | + $system_question = $item->is_system_question(); |
|
27 | + $actions = array(); |
|
28 | 28 | |
29 | - if (! defined('REG_ADMIN_URL')) { |
|
30 | - define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
|
31 | - } |
|
29 | + if (! defined('REG_ADMIN_URL')) { |
|
30 | + define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
|
31 | + } |
|
32 | 32 | |
33 | - $edit_query_args = array( |
|
34 | - 'action' => 'edit_question', |
|
35 | - 'QST_ID' => $item->ID(), |
|
36 | - ); |
|
33 | + $edit_query_args = array( |
|
34 | + 'action' => 'edit_question', |
|
35 | + 'QST_ID' => $item->ID(), |
|
36 | + ); |
|
37 | 37 | |
38 | - $trash_query_args = array( |
|
39 | - 'action' => 'trash_question', |
|
40 | - 'QST_ID' => $item->ID(), |
|
41 | - ); |
|
38 | + $trash_query_args = array( |
|
39 | + 'action' => 'trash_question', |
|
40 | + 'QST_ID' => $item->ID(), |
|
41 | + ); |
|
42 | 42 | |
43 | - $restore_query_args = array( |
|
44 | - 'action' => 'restore_question', |
|
45 | - 'QST_ID' => $item->ID(), |
|
46 | - ); |
|
43 | + $restore_query_args = array( |
|
44 | + 'action' => 'restore_question', |
|
45 | + 'QST_ID' => $item->ID(), |
|
46 | + ); |
|
47 | 47 | |
48 | - $delete_query_args = array( |
|
49 | - 'action' => 'delete_questions', |
|
50 | - 'QST_ID' => $item->ID(), |
|
51 | - ); |
|
48 | + $delete_query_args = array( |
|
49 | + 'action' => 'delete_questions', |
|
50 | + 'QST_ID' => $item->ID(), |
|
51 | + ); |
|
52 | 52 | |
53 | - $duplicate_query_args = array( |
|
54 | - 'action' => 'duplicate_question', |
|
55 | - 'QST_ID' => $item->ID(), |
|
56 | - ); |
|
53 | + $duplicate_query_args = array( |
|
54 | + 'action' => 'duplicate_question', |
|
55 | + 'QST_ID' => $item->ID(), |
|
56 | + ); |
|
57 | 57 | |
58 | - $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_FORMS_ADMIN_URL); |
|
59 | - $trash_link = EE_Admin_Page::add_query_args_and_nonce($trash_query_args, EE_FORMS_ADMIN_URL); |
|
60 | - $restore_link = EE_Admin_Page::add_query_args_and_nonce($restore_query_args, EE_FORMS_ADMIN_URL); |
|
61 | - $delete_link = EE_Admin_Page::add_query_args_and_nonce($delete_query_args, EE_FORMS_ADMIN_URL); |
|
62 | - $duplicate_link = EE_Admin_Page::add_query_args_and_nonce($duplicate_query_args, EE_FORMS_ADMIN_URL); |
|
58 | + $edit_link = EE_Admin_Page::add_query_args_and_nonce($edit_query_args, EE_FORMS_ADMIN_URL); |
|
59 | + $trash_link = EE_Admin_Page::add_query_args_and_nonce($trash_query_args, EE_FORMS_ADMIN_URL); |
|
60 | + $restore_link = EE_Admin_Page::add_query_args_and_nonce($restore_query_args, EE_FORMS_ADMIN_URL); |
|
61 | + $delete_link = EE_Admin_Page::add_query_args_and_nonce($delete_query_args, EE_FORMS_ADMIN_URL); |
|
62 | + $duplicate_link = EE_Admin_Page::add_query_args_and_nonce($duplicate_query_args, EE_FORMS_ADMIN_URL); |
|
63 | 63 | |
64 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
65 | - 'ee_edit_question', |
|
66 | - 'espresso_registration_form_edit_question', |
|
67 | - $item->ID() |
|
68 | - )) { |
|
69 | - $actions = array( |
|
70 | - 'edit' => '<a href="' . $edit_link . '" title="' |
|
71 | - . __('Edit Question', 'event_espresso') . '">' |
|
72 | - . __('Edit', 'event_espresso') . '</a>', |
|
73 | - ); |
|
74 | - } |
|
64 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
65 | + 'ee_edit_question', |
|
66 | + 'espresso_registration_form_edit_question', |
|
67 | + $item->ID() |
|
68 | + )) { |
|
69 | + $actions = array( |
|
70 | + 'edit' => '<a href="' . $edit_link . '" title="' |
|
71 | + . __('Edit Question', 'event_espresso') . '">' |
|
72 | + . __('Edit', 'event_espresso') . '</a>', |
|
73 | + ); |
|
74 | + } |
|
75 | 75 | |
76 | - if (! $system_question |
|
77 | - && $this->_view != 'trash' |
|
78 | - && EE_Registry::instance()->CAP->current_user_can( |
|
79 | - 'ee_delete_question', |
|
80 | - 'espresso_registration_form_trash_question', |
|
81 | - $item->ID() |
|
82 | - )) { |
|
83 | - $actions['delete'] = '<a href="' . $trash_link . '" title="' |
|
84 | - . __('Trash Question', 'event_espresso') . '">' |
|
85 | - . __('Trash', 'event_espresso') . '</a>'; |
|
86 | - } |
|
76 | + if (! $system_question |
|
77 | + && $this->_view != 'trash' |
|
78 | + && EE_Registry::instance()->CAP->current_user_can( |
|
79 | + 'ee_delete_question', |
|
80 | + 'espresso_registration_form_trash_question', |
|
81 | + $item->ID() |
|
82 | + )) { |
|
83 | + $actions['delete'] = '<a href="' . $trash_link . '" title="' |
|
84 | + . __('Trash Question', 'event_espresso') . '">' |
|
85 | + . __('Trash', 'event_espresso') . '</a>'; |
|
86 | + } |
|
87 | 87 | |
88 | - if ($this->_view == 'trash') { |
|
89 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
90 | - 'ee_delete_question', |
|
91 | - 'espresso_registration_form_restore_question', |
|
92 | - $item->ID() |
|
93 | - )) { |
|
94 | - $actions['restore'] = '<a href="' . $restore_link . '" title="' |
|
95 | - . __('Restore Question', 'event_espresso') . '">' |
|
96 | - . __('Restore', 'event_espresso') . '</a>'; |
|
97 | - } |
|
98 | - if ($item->count_related('Answer') === 0 |
|
99 | - && EE_Registry::instance()->CAP->current_user_can( |
|
100 | - 'ee_delete_question', |
|
101 | - 'espresso_registration_form_delete_questions', |
|
102 | - $item->ID() |
|
103 | - )) { |
|
104 | - $actions['delete'] = '<a href="' . $delete_link . '" title="' |
|
105 | - . __('Delete Question Permanently', 'event_espresso') . '">' |
|
106 | - . __('Delete Permanently', 'event_espresso') . '</a>'; |
|
107 | - } |
|
108 | - } |
|
109 | - if (EE_Registry::instance()->CAP->current_user_can( |
|
110 | - 'ee_edit_questions', |
|
111 | - 'espresso_registration_form_edit_question' |
|
112 | - )) { |
|
113 | - $actions['duplicate'] = '<a href="' . $duplicate_link . '" title="' |
|
114 | - . __('Duplicate Question', 'event_espresso') . '">' |
|
115 | - . __('Duplicate', 'event_espresso') . '</a>'; |
|
116 | - } |
|
88 | + if ($this->_view == 'trash') { |
|
89 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
90 | + 'ee_delete_question', |
|
91 | + 'espresso_registration_form_restore_question', |
|
92 | + $item->ID() |
|
93 | + )) { |
|
94 | + $actions['restore'] = '<a href="' . $restore_link . '" title="' |
|
95 | + . __('Restore Question', 'event_espresso') . '">' |
|
96 | + . __('Restore', 'event_espresso') . '</a>'; |
|
97 | + } |
|
98 | + if ($item->count_related('Answer') === 0 |
|
99 | + && EE_Registry::instance()->CAP->current_user_can( |
|
100 | + 'ee_delete_question', |
|
101 | + 'espresso_registration_form_delete_questions', |
|
102 | + $item->ID() |
|
103 | + )) { |
|
104 | + $actions['delete'] = '<a href="' . $delete_link . '" title="' |
|
105 | + . __('Delete Question Permanently', 'event_espresso') . '">' |
|
106 | + . __('Delete Permanently', 'event_espresso') . '</a>'; |
|
107 | + } |
|
108 | + } |
|
109 | + if (EE_Registry::instance()->CAP->current_user_can( |
|
110 | + 'ee_edit_questions', |
|
111 | + 'espresso_registration_form_edit_question' |
|
112 | + )) { |
|
113 | + $actions['duplicate'] = '<a href="' . $duplicate_link . '" title="' |
|
114 | + . __('Duplicate Question', 'event_espresso') . '">' |
|
115 | + . __('Duplicate', 'event_espresso') . '</a>'; |
|
116 | + } |
|
117 | 117 | |
118 | - $content = EE_Registry::instance()->CAP->current_user_can( |
|
119 | - 'ee_edit_question', |
|
120 | - 'espresso_registration_form_edit_question', |
|
121 | - $item->ID() |
|
122 | - ) |
|
123 | - ? '<strong><a class="row-title" href="' . $edit_link . '">' . $item->display_text() . '</a></strong>' |
|
124 | - : $item->display_text(); |
|
125 | - $content .= $this->row_actions($actions); |
|
126 | - return $content; |
|
127 | - } |
|
118 | + $content = EE_Registry::instance()->CAP->current_user_can( |
|
119 | + 'ee_edit_question', |
|
120 | + 'espresso_registration_form_edit_question', |
|
121 | + $item->ID() |
|
122 | + ) |
|
123 | + ? '<strong><a class="row-title" href="' . $edit_link . '">' . $item->display_text() . '</a></strong>' |
|
124 | + : $item->display_text(); |
|
125 | + $content .= $this->row_actions($actions); |
|
126 | + return $content; |
|
127 | + } |
|
128 | 128 | } |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | $system_question = $item->is_system_question(); |
27 | 27 | $actions = array(); |
28 | 28 | |
29 | - if (! defined('REG_ADMIN_URL')) { |
|
29 | + if ( ! defined('REG_ADMIN_URL')) { |
|
30 | 30 | define('REG_ADMIN_URL', EVENTS_ADMIN_URL); |
31 | 31 | } |
32 | 32 | |
@@ -67,22 +67,22 @@ discard block |
||
67 | 67 | $item->ID() |
68 | 68 | )) { |
69 | 69 | $actions = array( |
70 | - 'edit' => '<a href="' . $edit_link . '" title="' |
|
71 | - . __('Edit Question', 'event_espresso') . '">' |
|
72 | - . __('Edit', 'event_espresso') . '</a>', |
|
70 | + 'edit' => '<a href="'.$edit_link.'" title="' |
|
71 | + . __('Edit Question', 'event_espresso').'">' |
|
72 | + . __('Edit', 'event_espresso').'</a>', |
|
73 | 73 | ); |
74 | 74 | } |
75 | 75 | |
76 | - if (! $system_question |
|
76 | + if ( ! $system_question |
|
77 | 77 | && $this->_view != 'trash' |
78 | 78 | && EE_Registry::instance()->CAP->current_user_can( |
79 | 79 | 'ee_delete_question', |
80 | 80 | 'espresso_registration_form_trash_question', |
81 | 81 | $item->ID() |
82 | 82 | )) { |
83 | - $actions['delete'] = '<a href="' . $trash_link . '" title="' |
|
84 | - . __('Trash Question', 'event_espresso') . '">' |
|
85 | - . __('Trash', 'event_espresso') . '</a>'; |
|
83 | + $actions['delete'] = '<a href="'.$trash_link.'" title="' |
|
84 | + . __('Trash Question', 'event_espresso').'">' |
|
85 | + . __('Trash', 'event_espresso').'</a>'; |
|
86 | 86 | } |
87 | 87 | |
88 | 88 | if ($this->_view == 'trash') { |
@@ -91,9 +91,9 @@ discard block |
||
91 | 91 | 'espresso_registration_form_restore_question', |
92 | 92 | $item->ID() |
93 | 93 | )) { |
94 | - $actions['restore'] = '<a href="' . $restore_link . '" title="' |
|
95 | - . __('Restore Question', 'event_espresso') . '">' |
|
96 | - . __('Restore', 'event_espresso') . '</a>'; |
|
94 | + $actions['restore'] = '<a href="'.$restore_link.'" title="' |
|
95 | + . __('Restore Question', 'event_espresso').'">' |
|
96 | + . __('Restore', 'event_espresso').'</a>'; |
|
97 | 97 | } |
98 | 98 | if ($item->count_related('Answer') === 0 |
99 | 99 | && EE_Registry::instance()->CAP->current_user_can( |
@@ -101,18 +101,18 @@ discard block |
||
101 | 101 | 'espresso_registration_form_delete_questions', |
102 | 102 | $item->ID() |
103 | 103 | )) { |
104 | - $actions['delete'] = '<a href="' . $delete_link . '" title="' |
|
105 | - . __('Delete Question Permanently', 'event_espresso') . '">' |
|
106 | - . __('Delete Permanently', 'event_espresso') . '</a>'; |
|
104 | + $actions['delete'] = '<a href="'.$delete_link.'" title="' |
|
105 | + . __('Delete Question Permanently', 'event_espresso').'">' |
|
106 | + . __('Delete Permanently', 'event_espresso').'</a>'; |
|
107 | 107 | } |
108 | 108 | } |
109 | 109 | if (EE_Registry::instance()->CAP->current_user_can( |
110 | 110 | 'ee_edit_questions', |
111 | 111 | 'espresso_registration_form_edit_question' |
112 | 112 | )) { |
113 | - $actions['duplicate'] = '<a href="' . $duplicate_link . '" title="' |
|
114 | - . __('Duplicate Question', 'event_espresso') . '">' |
|
115 | - . __('Duplicate', 'event_espresso') . '</a>'; |
|
113 | + $actions['duplicate'] = '<a href="'.$duplicate_link.'" title="' |
|
114 | + . __('Duplicate Question', 'event_espresso').'">' |
|
115 | + . __('Duplicate', 'event_espresso').'</a>'; |
|
116 | 116 | } |
117 | 117 | |
118 | 118 | $content = EE_Registry::instance()->CAP->current_user_can( |
@@ -120,7 +120,7 @@ discard block |
||
120 | 120 | 'espresso_registration_form_edit_question', |
121 | 121 | $item->ID() |
122 | 122 | ) |
123 | - ? '<strong><a class="row-title" href="' . $edit_link . '">' . $item->display_text() . '</a></strong>' |
|
123 | + ? '<strong><a class="row-title" href="'.$edit_link.'">'.$item->display_text().'</a></strong>' |
|
124 | 124 | : $item->display_text(); |
125 | 125 | $content .= $this->row_actions($actions); |
126 | 126 | return $content; |