@@ -9,19 +9,19 @@ |
||
9 | 9 | interface EEI_Contact |
10 | 10 | { |
11 | 11 | |
12 | - public function fname(); |
|
12 | + public function fname(); |
|
13 | 13 | |
14 | 14 | |
15 | 15 | |
16 | - public function lname(); |
|
16 | + public function lname(); |
|
17 | 17 | |
18 | 18 | |
19 | 19 | |
20 | - public function email(); |
|
20 | + public function email(); |
|
21 | 21 | |
22 | 22 | |
23 | 23 | |
24 | - public function phone(); |
|
24 | + public function phone(); |
|
25 | 25 | } |
26 | 26 | |
27 | 27 | // End of file EEI_Contact.php |
@@ -8,99 +8,99 @@ |
||
8 | 8 | interface EEI_Base |
9 | 9 | { |
10 | 10 | |
11 | - /** |
|
12 | - * gets the unique ID of the model object. If it hasn't been saved yet |
|
13 | - * to the database, this should be 0 or NULL |
|
14 | - */ |
|
15 | - public function ID(); |
|
16 | - |
|
17 | - |
|
18 | - |
|
19 | - /** |
|
20 | - * Returns an array where keys are field names and values are their values |
|
21 | - * |
|
22 | - * @return array |
|
23 | - */ |
|
24 | - public function model_field_array(); |
|
25 | - |
|
26 | - |
|
27 | - |
|
28 | - /** |
|
29 | - * Saves the thing to the database and returns success (or an ID) |
|
30 | - * |
|
31 | - * @return boolean success on insert; or int on update (ID of newly inserted thing) |
|
32 | - */ |
|
33 | - public function save(); |
|
34 | - |
|
35 | - |
|
36 | - |
|
37 | - /** |
|
38 | - * Similar to insert_post_meta, adds a record in the Extra_Meta model's table with the given key and value. |
|
39 | - * A $previous_value can be specified in case there are many meta rows with the same key |
|
40 | - * |
|
41 | - * @param string $meta_key |
|
42 | - * @param string $meta_value |
|
43 | - * @param string $previous_value |
|
44 | - * @return int records updated (or BOOLEAN if we actually ended up inserting the extra meta row) |
|
45 | - * NOTE: if the values haven't changed, returns 0 |
|
46 | - */ |
|
47 | - public function update_extra_meta($meta_key, $meta_value, $previous_value = null); |
|
48 | - |
|
49 | - |
|
50 | - |
|
51 | - /** |
|
52 | - * Adds a new extra meta record. If $unique is set to TRUE, we'll first double-check |
|
53 | - * no other extra meta for this model object have the same key. Returns TRUE if the |
|
54 | - * extra meta row was entered, false if not |
|
55 | - * |
|
56 | - * @param string $meta_key |
|
57 | - * @param string $meta_value |
|
58 | - * @param boolean $unique |
|
59 | - * @return boolean |
|
60 | - */ |
|
61 | - public function add_extra_meta($meta_key, $meta_value, $unique = false); |
|
62 | - |
|
63 | - |
|
64 | - |
|
65 | - /** |
|
66 | - * Deletes all the extra meta rows for this record as specified by key. If $meta_value |
|
67 | - * is specified, only deletes extra meta records with that value. |
|
68 | - * |
|
69 | - * @param string $meta_key |
|
70 | - * @param string $meta_value |
|
71 | - * @return int number of extra meta rows deleted |
|
72 | - */ |
|
73 | - public function delete_extra_meta($meta_key, $meta_value = null); |
|
74 | - |
|
75 | - |
|
76 | - |
|
77 | - /** |
|
78 | - * Gets the extra meta with the given meta key. If you specify "single" we just return 1, otherwise |
|
79 | - * an array of everything found. Requires that this model actually have a relation of type EE_Has_Many_Any_Relation. |
|
80 | - * You can specify $default is case you haven't found the extra meta |
|
81 | - * |
|
82 | - * @param string $meta_key |
|
83 | - * @param boolean $single |
|
84 | - * @param mixed $default if we don't find anything, what should we return? |
|
85 | - * @return mixed single value if $single; array if ! $single |
|
86 | - */ |
|
87 | - public function get_extra_meta($meta_key, $single = false, $default = NULL); |
|
88 | - |
|
89 | - |
|
90 | - |
|
91 | - /** |
|
92 | - * Gets a pretty view of the field's value. $extra_cache_ref can specify different formats for this. |
|
93 | - * The $extra_cache_ref will be passed to the model field's prepare_for_pretty_echoing, so consult the field's class |
|
94 | - * to see what options are available. |
|
95 | - * |
|
96 | - * @param string $field_name |
|
97 | - * @param string $extra_cache_ref This allows the user to specify an extra cache ref for the given property |
|
98 | - * (in cases where the same property may be used for different outputs |
|
99 | - * - i.e. datetime, money etc.) |
|
100 | - * @return mixed |
|
101 | - * @throws \EE_Error |
|
102 | - */ |
|
103 | - public function get_pretty($field_name, $extra_cache_ref); |
|
11 | + /** |
|
12 | + * gets the unique ID of the model object. If it hasn't been saved yet |
|
13 | + * to the database, this should be 0 or NULL |
|
14 | + */ |
|
15 | + public function ID(); |
|
16 | + |
|
17 | + |
|
18 | + |
|
19 | + /** |
|
20 | + * Returns an array where keys are field names and values are their values |
|
21 | + * |
|
22 | + * @return array |
|
23 | + */ |
|
24 | + public function model_field_array(); |
|
25 | + |
|
26 | + |
|
27 | + |
|
28 | + /** |
|
29 | + * Saves the thing to the database and returns success (or an ID) |
|
30 | + * |
|
31 | + * @return boolean success on insert; or int on update (ID of newly inserted thing) |
|
32 | + */ |
|
33 | + public function save(); |
|
34 | + |
|
35 | + |
|
36 | + |
|
37 | + /** |
|
38 | + * Similar to insert_post_meta, adds a record in the Extra_Meta model's table with the given key and value. |
|
39 | + * A $previous_value can be specified in case there are many meta rows with the same key |
|
40 | + * |
|
41 | + * @param string $meta_key |
|
42 | + * @param string $meta_value |
|
43 | + * @param string $previous_value |
|
44 | + * @return int records updated (or BOOLEAN if we actually ended up inserting the extra meta row) |
|
45 | + * NOTE: if the values haven't changed, returns 0 |
|
46 | + */ |
|
47 | + public function update_extra_meta($meta_key, $meta_value, $previous_value = null); |
|
48 | + |
|
49 | + |
|
50 | + |
|
51 | + /** |
|
52 | + * Adds a new extra meta record. If $unique is set to TRUE, we'll first double-check |
|
53 | + * no other extra meta for this model object have the same key. Returns TRUE if the |
|
54 | + * extra meta row was entered, false if not |
|
55 | + * |
|
56 | + * @param string $meta_key |
|
57 | + * @param string $meta_value |
|
58 | + * @param boolean $unique |
|
59 | + * @return boolean |
|
60 | + */ |
|
61 | + public function add_extra_meta($meta_key, $meta_value, $unique = false); |
|
62 | + |
|
63 | + |
|
64 | + |
|
65 | + /** |
|
66 | + * Deletes all the extra meta rows for this record as specified by key. If $meta_value |
|
67 | + * is specified, only deletes extra meta records with that value. |
|
68 | + * |
|
69 | + * @param string $meta_key |
|
70 | + * @param string $meta_value |
|
71 | + * @return int number of extra meta rows deleted |
|
72 | + */ |
|
73 | + public function delete_extra_meta($meta_key, $meta_value = null); |
|
74 | + |
|
75 | + |
|
76 | + |
|
77 | + /** |
|
78 | + * Gets the extra meta with the given meta key. If you specify "single" we just return 1, otherwise |
|
79 | + * an array of everything found. Requires that this model actually have a relation of type EE_Has_Many_Any_Relation. |
|
80 | + * You can specify $default is case you haven't found the extra meta |
|
81 | + * |
|
82 | + * @param string $meta_key |
|
83 | + * @param boolean $single |
|
84 | + * @param mixed $default if we don't find anything, what should we return? |
|
85 | + * @return mixed single value if $single; array if ! $single |
|
86 | + */ |
|
87 | + public function get_extra_meta($meta_key, $single = false, $default = NULL); |
|
88 | + |
|
89 | + |
|
90 | + |
|
91 | + /** |
|
92 | + * Gets a pretty view of the field's value. $extra_cache_ref can specify different formats for this. |
|
93 | + * The $extra_cache_ref will be passed to the model field's prepare_for_pretty_echoing, so consult the field's class |
|
94 | + * to see what options are available. |
|
95 | + * |
|
96 | + * @param string $field_name |
|
97 | + * @param string $extra_cache_ref This allows the user to specify an extra cache ref for the given property |
|
98 | + * (in cases where the same property may be used for different outputs |
|
99 | + * - i.e. datetime, money etc.) |
|
100 | + * @return mixed |
|
101 | + * @throws \EE_Error |
|
102 | + */ |
|
103 | + public function get_pretty($field_name, $extra_cache_ref); |
|
104 | 104 | |
105 | 105 | |
106 | 106 |
@@ -9,13 +9,13 @@ |
||
9 | 9 | interface EEI_Request_Stack_Core_App |
10 | 10 | { |
11 | 11 | |
12 | - /** |
|
13 | - * gives the core app a chance to handle the response after the request stack has fully processed |
|
14 | - * |
|
15 | - * @param EE_Request $request |
|
16 | - * @param EE_Response $response |
|
17 | - */ |
|
18 | - public function handle_response(EE_Request $request, EE_Response $response); |
|
12 | + /** |
|
13 | + * gives the core app a chance to handle the response after the request stack has fully processed |
|
14 | + * |
|
15 | + * @param EE_Request $request |
|
16 | + * @param EE_Response $response |
|
17 | + */ |
|
18 | + public function handle_response(EE_Request $request, EE_Response $response); |
|
19 | 19 | |
20 | 20 | } |
21 | 21 | // End of file EEI_Request_Stack_Core_App.interface.php |
@@ -9,27 +9,27 @@ |
||
9 | 9 | interface EEHI_File |
10 | 10 | { |
11 | 11 | |
12 | - /** |
|
13 | - * ensure_file_exists_and_is_writable |
|
14 | - * ensures that a file exists and is writable, will attempt to create file if it does not exist |
|
15 | - * |
|
16 | - * @param string $full_file_path |
|
17 | - * @throws EE_Error |
|
18 | - * @return bool |
|
19 | - */ |
|
20 | - public static function ensure_file_exists_and_is_writable($full_file_path = ''); |
|
12 | + /** |
|
13 | + * ensure_file_exists_and_is_writable |
|
14 | + * ensures that a file exists and is writable, will attempt to create file if it does not exist |
|
15 | + * |
|
16 | + * @param string $full_file_path |
|
17 | + * @throws EE_Error |
|
18 | + * @return bool |
|
19 | + */ |
|
20 | + public static function ensure_file_exists_and_is_writable($full_file_path = ''); |
|
21 | 21 | |
22 | 22 | |
23 | 23 | |
24 | - /** |
|
25 | - * ensure_folder_exists_and_is_writable |
|
26 | - * ensures that a folder exists and is writable, will attempt to create folder if it does not exist |
|
27 | - * |
|
28 | - * @param string $folder |
|
29 | - * @throws EE_Error |
|
30 | - * @return bool |
|
31 | - */ |
|
32 | - public static function ensure_folder_exists_and_is_writable($folder = ''); |
|
24 | + /** |
|
25 | + * ensure_folder_exists_and_is_writable |
|
26 | + * ensures that a folder exists and is writable, will attempt to create folder if it does not exist |
|
27 | + * |
|
28 | + * @param string $folder |
|
29 | + * @throws EE_Error |
|
30 | + * @return bool |
|
31 | + */ |
|
32 | + public static function ensure_folder_exists_and_is_writable($folder = ''); |
|
33 | 33 | } |
34 | 34 | // End of file EEHI_File.interface.php |
35 | 35 | // Location: core/interfaces/EEHI_File.interface.php |
36 | 36 | \ No newline at end of file |
@@ -9,18 +9,18 @@ |
||
9 | 9 | interface EEHI_Money |
10 | 10 | { |
11 | 11 | |
12 | - /** |
|
13 | - * For comparing floats. Default operator is '=', but see the $operator below for all options. |
|
14 | - * This should be used to compare floats instead of normal '==' because floats |
|
15 | - * are inherently imprecise, and so you can sometimes have two floats that appear to be identical |
|
16 | - * but actually differ by 0.00000001. |
|
17 | - * |
|
18 | - * @param float $float1 |
|
19 | - * @param float $float2 |
|
20 | - * @param string $operator The operator. Valid options are =, <=, <, >=, >, <>, eq, lt, lte, gt, gte, ne |
|
21 | - * @return boolean whether the equation is true or false |
|
22 | - */ |
|
23 | - public function compare_floats($float1, $float2, $operator = '='); |
|
12 | + /** |
|
13 | + * For comparing floats. Default operator is '=', but see the $operator below for all options. |
|
14 | + * This should be used to compare floats instead of normal '==' because floats |
|
15 | + * are inherently imprecise, and so you can sometimes have two floats that appear to be identical |
|
16 | + * but actually differ by 0.00000001. |
|
17 | + * |
|
18 | + * @param float $float1 |
|
19 | + * @param float $float2 |
|
20 | + * @param string $operator The operator. Valid options are =, <=, <, >=, >, <>, eq, lt, lte, gt, gte, ne |
|
21 | + * @return boolean whether the equation is true or false |
|
22 | + */ |
|
23 | + public function compare_floats($float1, $float2, $operator = '='); |
|
24 | 24 | } |
25 | 25 | // End of file EEHI_Money.interface.php |
26 | 26 | // Location: core/interfaces/EEHI_Money.interface.php |
27 | 27 | \ No newline at end of file |
@@ -38,30 +38,30 @@ discard block |
||
38 | 38 | * @throws EE_Error if filesystem credentials are required |
39 | 39 | * @return WP_Filesystem_Base |
40 | 40 | */ |
41 | - private static function _get_wp_filesystem( $filepath = null) { |
|
42 | - if( apply_filters( |
|
41 | + private static function _get_wp_filesystem($filepath = null) { |
|
42 | + if (apply_filters( |
|
43 | 43 | 'FHEE__EEH_File___get_wp_filesystem__allow_using_filesystem_direct', |
44 | - $filepath && EEH_File::is_in_uploads_folder( $filepath ), |
|
45 | - $filepath ) ) { |
|
46 | - if( ! EEH_File::$_wp_filesystem_direct instanceof WP_Filesystem_Direct ) { |
|
47 | - require_once(ABSPATH . 'wp-admin/includes/class-wp-filesystem-base.php'); |
|
44 | + $filepath && EEH_File::is_in_uploads_folder($filepath), |
|
45 | + $filepath )) { |
|
46 | + if ( ! EEH_File::$_wp_filesystem_direct instanceof WP_Filesystem_Direct) { |
|
47 | + require_once(ABSPATH.'wp-admin/includes/class-wp-filesystem-base.php'); |
|
48 | 48 | $method = 'direct'; |
49 | - $wp_filesystem_direct_file = apply_filters( 'filesystem_method_file', ABSPATH . 'wp-admin/includes/class-wp-filesystem-' . $method . '.php', $method ); |
|
49 | + $wp_filesystem_direct_file = apply_filters('filesystem_method_file', ABSPATH.'wp-admin/includes/class-wp-filesystem-'.$method.'.php', $method); |
|
50 | 50 | //check constants defined, just like in wp-admin/includes/file.php's WP_Filesystem() |
51 | - if ( ! defined('FS_CHMOD_DIR') ) { |
|
52 | - define('FS_CHMOD_DIR', ( fileperms( ABSPATH ) & 0777 | 0755 ) ); |
|
51 | + if ( ! defined('FS_CHMOD_DIR')) { |
|
52 | + define('FS_CHMOD_DIR', (fileperms(ABSPATH) & 0777 | 0755)); |
|
53 | 53 | } |
54 | - if ( ! defined('FS_CHMOD_FILE') ) { |
|
55 | - define('FS_CHMOD_FILE', ( fileperms( ABSPATH . 'index.php' ) & 0777 | 0644 ) ); |
|
54 | + if ( ! defined('FS_CHMOD_FILE')) { |
|
55 | + define('FS_CHMOD_FILE', (fileperms(ABSPATH.'index.php') & 0777 | 0644)); |
|
56 | 56 | } |
57 | - require_once( $wp_filesystem_direct_file ); |
|
58 | - EEH_File::$_wp_filesystem_direct = new WP_Filesystem_Direct( array() ); |
|
57 | + require_once($wp_filesystem_direct_file); |
|
58 | + EEH_File::$_wp_filesystem_direct = new WP_Filesystem_Direct(array()); |
|
59 | 59 | } |
60 | 60 | return EEH_File::$_wp_filesystem_direct; |
61 | 61 | } |
62 | 62 | global $wp_filesystem; |
63 | 63 | // no filesystem setup ??? |
64 | - if ( ! $wp_filesystem instanceof WP_Filesystem_Base ) { |
|
64 | + if ( ! $wp_filesystem instanceof WP_Filesystem_Base) { |
|
65 | 65 | // if some eager beaver's just trying to get in there too early... |
66 | 66 | // let them do it, because we are one of those eager beavers! :P |
67 | 67 | /** |
@@ -74,34 +74,34 @@ discard block |
||
74 | 74 | * and there may be troubles if the WP files are owned by a different user |
75 | 75 | * than the server user. But both of these issues should exist in 4.4 and earlier too |
76 | 76 | */ |
77 | - if ( FALSE && ! did_action( 'wp_loaded' )) { |
|
77 | + if (FALSE && ! did_action('wp_loaded')) { |
|
78 | 78 | $msg = __('An attempt to access and/or write to a file on the server could not be completed due to a lack of sufficient credentials.', 'event_espresso'); |
79 | - if ( WP_DEBUG ) { |
|
80 | - $msg .= '<br />' . __('The WP Filesystem can not be accessed until after the "wp_loaded" hook has run, so it\'s best not to attempt access until the "admin_init" hookpoint.', 'event_espresso'); |
|
79 | + if (WP_DEBUG) { |
|
80 | + $msg .= '<br />'.__('The WP Filesystem can not be accessed until after the "wp_loaded" hook has run, so it\'s best not to attempt access until the "admin_init" hookpoint.', 'event_espresso'); |
|
81 | 81 | } |
82 | - throw new EE_Error( $msg ); |
|
82 | + throw new EE_Error($msg); |
|
83 | 83 | } else { |
84 | 84 | // should be loaded if we are past the wp_loaded hook... |
85 | - if ( ! function_exists( 'WP_Filesystem' )) { |
|
86 | - require_once( ABSPATH . 'wp-admin/includes/file.php' ); |
|
87 | - require_once( ABSPATH . 'wp-admin/includes/template.php' ); |
|
85 | + if ( ! function_exists('WP_Filesystem')) { |
|
86 | + require_once(ABSPATH.'wp-admin/includes/file.php'); |
|
87 | + require_once(ABSPATH.'wp-admin/includes/template.php'); |
|
88 | 88 | } |
89 | 89 | // turn on output buffering so that we can capture the credentials form |
90 | 90 | ob_start(); |
91 | - $credentials = request_filesystem_credentials( '' ); |
|
91 | + $credentials = request_filesystem_credentials(''); |
|
92 | 92 | // store credentials form for the time being |
93 | 93 | EEH_File::$_credentials_form = ob_get_clean(); |
94 | 94 | // basically check for direct or previously configured access |
95 | - if ( ! WP_Filesystem( $credentials ) ) { |
|
95 | + if ( ! WP_Filesystem($credentials)) { |
|
96 | 96 | // if credentials do NOT exist |
97 | - if ( $credentials === FALSE ) { |
|
98 | - add_action( 'admin_notices', array( 'EEH_File', 'display_request_filesystem_credentials_form' ), 999 ); |
|
99 | - throw new EE_Error( __('An attempt to access and/or write to a file on the server could not be completed due to a lack of sufficient credentials.', 'event_espresso')); |
|
100 | - } elseif( is_wp_error( $wp_filesystem->errors ) && $wp_filesystem->errors->get_error_code() ) { |
|
101 | - add_action( 'admin_notices', array( 'EEH_File', 'display_request_filesystem_credentials_form' ), 999 ); |
|
97 | + if ($credentials === FALSE) { |
|
98 | + add_action('admin_notices', array('EEH_File', 'display_request_filesystem_credentials_form'), 999); |
|
99 | + throw new EE_Error(__('An attempt to access and/or write to a file on the server could not be completed due to a lack of sufficient credentials.', 'event_espresso')); |
|
100 | + } elseif (is_wp_error($wp_filesystem->errors) && $wp_filesystem->errors->get_error_code()) { |
|
101 | + add_action('admin_notices', array('EEH_File', 'display_request_filesystem_credentials_form'), 999); |
|
102 | 102 | throw new EE_Error( |
103 | 103 | sprintf( |
104 | - __( 'WP Filesystem Error: $1%s', 'event_espresso' ), |
|
104 | + __('WP Filesystem Error: $1%s', 'event_espresso'), |
|
105 | 105 | $wp_filesystem->errors->get_error_message() ) ); |
106 | 106 | } |
107 | 107 | } |
@@ -114,8 +114,8 @@ discard block |
||
114 | 114 | * display_request_filesystem_credentials_form |
115 | 115 | */ |
116 | 116 | public static function display_request_filesystem_credentials_form() { |
117 | - if ( ! empty( EEH_File::$_credentials_form )) { |
|
118 | - echo '<div class="updated espresso-notices-attention"><p>' . EEH_File::$_credentials_form . '</p></div>'; |
|
117 | + if ( ! empty(EEH_File::$_credentials_form)) { |
|
118 | + echo '<div class="updated espresso-notices-attention"><p>'.EEH_File::$_credentials_form.'</p></div>'; |
|
119 | 119 | } |
120 | 120 | } |
121 | 121 | |
@@ -133,29 +133,29 @@ discard block |
||
133 | 133 | * @throws EE_Error if filesystem credentials are required |
134 | 134 | * @return bool |
135 | 135 | */ |
136 | - public static function verify_filepath_and_permissions( $full_file_path = '', $file_name = '', $file_ext = '', $type_of_file = '' ) { |
|
136 | + public static function verify_filepath_and_permissions($full_file_path = '', $file_name = '', $file_ext = '', $type_of_file = '') { |
|
137 | 137 | // load WP_Filesystem and set file permissions |
138 | - $wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path ); |
|
139 | - $full_file_path = EEH_File::standardise_directory_separators( $full_file_path ); |
|
140 | - if ( ! $wp_filesystem->is_readable( EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) )) { |
|
141 | - $file_name = ! empty( $type_of_file ) ? $file_name . ' ' . $type_of_file : $file_name; |
|
142 | - $file_name .= ! empty( $file_ext ) ? ' file' : ' folder'; |
|
138 | + $wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path); |
|
139 | + $full_file_path = EEH_File::standardise_directory_separators($full_file_path); |
|
140 | + if ( ! $wp_filesystem->is_readable(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path))) { |
|
141 | + $file_name = ! empty($type_of_file) ? $file_name.' '.$type_of_file : $file_name; |
|
142 | + $file_name .= ! empty($file_ext) ? ' file' : ' folder'; |
|
143 | 143 | $msg = sprintf( |
144 | - __( 'The requested %1$s could not be found or is not readable, possibly due to an incorrect filepath, or incorrect file permissions.%2$s', 'event_espresso' ), |
|
144 | + __('The requested %1$s could not be found or is not readable, possibly due to an incorrect filepath, or incorrect file permissions.%2$s', 'event_espresso'), |
|
145 | 145 | $file_name, |
146 | 146 | '<br />' |
147 | 147 | ); |
148 | - if ( EEH_File::exists( $full_file_path )) { |
|
149 | - $msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_file_path, $type_of_file ); |
|
148 | + if (EEH_File::exists($full_file_path)) { |
|
149 | + $msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path, $type_of_file); |
|
150 | 150 | } else { |
151 | 151 | // no file permissions means the file was not found |
152 | 152 | $msg .= sprintf( |
153 | - __( 'Please ensure the following path is correct: "%s".', 'event_espresso' ), |
|
153 | + __('Please ensure the following path is correct: "%s".', 'event_espresso'), |
|
154 | 154 | $full_file_path |
155 | 155 | ); |
156 | 156 | } |
157 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
158 | - throw new EE_Error( $msg . '||' . $msg ); |
|
157 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
158 | + throw new EE_Error($msg.'||'.$msg); |
|
159 | 159 | } |
160 | 160 | return FALSE; |
161 | 161 | } |
@@ -173,24 +173,24 @@ discard block |
||
173 | 173 | * @throws EE_Error if filesystem credentials are required |
174 | 174 | * @return string |
175 | 175 | */ |
176 | - private static function _permissions_error_for_unreadable_filepath( $full_file_path = '', $type_of_file = '' ){ |
|
176 | + private static function _permissions_error_for_unreadable_filepath($full_file_path = '', $type_of_file = '') { |
|
177 | 177 | // load WP_Filesystem and set file permissions |
178 | - $wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path ); |
|
178 | + $wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path); |
|
179 | 179 | // check file permissions |
180 | - $perms = $wp_filesystem->getchmod( EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) ); |
|
181 | - if ( $perms ) { |
|
180 | + $perms = $wp_filesystem->getchmod(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path)); |
|
181 | + if ($perms) { |
|
182 | 182 | // file permissions exist, but way be set incorrectly |
183 | - $type_of_file = ! empty( $type_of_file ) ? $type_of_file . ' ' : ''; |
|
184 | - $type_of_file .= ! empty( $type_of_file ) ? 'file' : 'folder'; |
|
183 | + $type_of_file = ! empty($type_of_file) ? $type_of_file.' ' : ''; |
|
184 | + $type_of_file .= ! empty($type_of_file) ? 'file' : 'folder'; |
|
185 | 185 | return sprintf( |
186 | - __( 'File permissions for the requested %1$s are currently set at "%2$s". The recommended permissions are 644 for files and 755 for folders.', 'event_espresso' ), |
|
186 | + __('File permissions for the requested %1$s are currently set at "%2$s". The recommended permissions are 644 for files and 755 for folders.', 'event_espresso'), |
|
187 | 187 | $type_of_file, |
188 | 188 | $perms |
189 | 189 | ); |
190 | 190 | } else { |
191 | 191 | // file exists but file permissions could not be read ?!?! |
192 | 192 | return sprintf( |
193 | - __( 'Please ensure that the server and/or PHP configuration allows the current process to access the following file: "%s".', 'event_espresso' ), |
|
193 | + __('Please ensure that the server and/or PHP configuration allows the current process to access the following file: "%s".', 'event_espresso'), |
|
194 | 194 | $full_file_path |
195 | 195 | ); |
196 | 196 | } |
@@ -208,35 +208,35 @@ discard block |
||
208 | 208 | * can't write to it |
209 | 209 | * @return bool false if folder isn't writable; true if it exists and is writeable, |
210 | 210 | */ |
211 | - public static function ensure_folder_exists_and_is_writable( $folder = '' ){ |
|
212 | - if ( empty( $folder )) { |
|
211 | + public static function ensure_folder_exists_and_is_writable($folder = '') { |
|
212 | + if (empty($folder)) { |
|
213 | 213 | return false; |
214 | 214 | } |
215 | 215 | // remove ending DS |
216 | - $folder = EEH_File::standardise_directory_separators( rtrim( $folder, '/\\' )); |
|
217 | - $parent_folder = EEH_File::get_parent_folder( $folder ); |
|
216 | + $folder = EEH_File::standardise_directory_separators(rtrim($folder, '/\\')); |
|
217 | + $parent_folder = EEH_File::get_parent_folder($folder); |
|
218 | 218 | // add DS to folder |
219 | - $folder = EEH_File::end_with_directory_separator( $folder ); |
|
220 | - $wp_filesystem = EEH_File::_get_wp_filesystem( $folder ); |
|
221 | - if ( ! $wp_filesystem->is_dir( EEH_File::convert_local_filepath_to_remote_filepath( $folder ) ) ) { |
|
219 | + $folder = EEH_File::end_with_directory_separator($folder); |
|
220 | + $wp_filesystem = EEH_File::_get_wp_filesystem($folder); |
|
221 | + if ( ! $wp_filesystem->is_dir(EEH_File::convert_local_filepath_to_remote_filepath($folder))) { |
|
222 | 222 | //ok so it doesn't exist. Does its parent? Can we write to it? |
223 | - if( ! EEH_File::ensure_folder_exists_and_is_writable( $parent_folder ) ) { |
|
223 | + if ( ! EEH_File::ensure_folder_exists_and_is_writable($parent_folder)) { |
|
224 | 224 | return false; |
225 | 225 | } |
226 | - if ( ! EEH_File::verify_is_writable( $parent_folder, 'folder' )) { |
|
226 | + if ( ! EEH_File::verify_is_writable($parent_folder, 'folder')) { |
|
227 | 227 | return false; |
228 | 228 | } else { |
229 | - if ( ! $wp_filesystem->mkdir( EEH_File::convert_local_filepath_to_remote_filepath( $folder ) ) ) { |
|
230 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
231 | - $msg = sprintf( __( '"%s" could not be created.', 'event_espresso' ), $folder ); |
|
232 | - $msg .= EEH_File::_permissions_error_for_unreadable_filepath( $folder ); |
|
233 | - throw new EE_Error( $msg ); |
|
229 | + if ( ! $wp_filesystem->mkdir(EEH_File::convert_local_filepath_to_remote_filepath($folder))) { |
|
230 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
231 | + $msg = sprintf(__('"%s" could not be created.', 'event_espresso'), $folder); |
|
232 | + $msg .= EEH_File::_permissions_error_for_unreadable_filepath($folder); |
|
233 | + throw new EE_Error($msg); |
|
234 | 234 | } |
235 | 235 | return false; |
236 | 236 | } |
237 | - EEH_File::add_index_file( $folder ); |
|
237 | + EEH_File::add_index_file($folder); |
|
238 | 238 | } |
239 | - } elseif ( ! EEH_File::verify_is_writable( $folder, 'folder' )) { |
|
239 | + } elseif ( ! EEH_File::verify_is_writable($folder, 'folder')) { |
|
240 | 240 | return false; |
241 | 241 | } |
242 | 242 | return true; |
@@ -251,15 +251,15 @@ discard block |
||
251 | 251 | * @throws EE_Error if filesystem credentials are required |
252 | 252 | * @return bool |
253 | 253 | */ |
254 | - public static function verify_is_writable( $full_path = '', $file_or_folder = 'folder' ){ |
|
254 | + public static function verify_is_writable($full_path = '', $file_or_folder = 'folder') { |
|
255 | 255 | // load WP_Filesystem and set file permissions |
256 | - $wp_filesystem = EEH_File::_get_wp_filesystem( $full_path ); |
|
257 | - $full_path = EEH_File::standardise_directory_separators( $full_path ); |
|
258 | - if ( ! $wp_filesystem->is_writable( EEH_File::convert_local_filepath_to_remote_filepath( $full_path ) ) ) { |
|
259 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
260 | - $msg = sprintf( __( 'The "%1$s" %2$s is not writable.', 'event_espresso' ), $full_path, $file_or_folder ); |
|
261 | - $msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_path ); |
|
262 | - throw new EE_Error( $msg ); |
|
256 | + $wp_filesystem = EEH_File::_get_wp_filesystem($full_path); |
|
257 | + $full_path = EEH_File::standardise_directory_separators($full_path); |
|
258 | + if ( ! $wp_filesystem->is_writable(EEH_File::convert_local_filepath_to_remote_filepath($full_path))) { |
|
259 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
260 | + $msg = sprintf(__('The "%1$s" %2$s is not writable.', 'event_espresso'), $full_path, $file_or_folder); |
|
261 | + $msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_path); |
|
262 | + throw new EE_Error($msg); |
|
263 | 263 | } |
264 | 264 | return FALSE; |
265 | 265 | } |
@@ -276,25 +276,25 @@ discard block |
||
276 | 276 | * @throws EE_Error if filesystem credentials are required |
277 | 277 | * @return bool |
278 | 278 | */ |
279 | - public static function ensure_file_exists_and_is_writable( $full_file_path = '' ) { |
|
279 | + public static function ensure_file_exists_and_is_writable($full_file_path = '') { |
|
280 | 280 | // load WP_Filesystem and set file permissions |
281 | - $wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path ); |
|
282 | - $full_file_path = EEH_File::standardise_directory_separators( $full_file_path ); |
|
283 | - $parent_folder = EEH_File::get_parent_folder( $full_file_path ); |
|
284 | - if ( ! EEH_File::exists( $full_file_path )) { |
|
285 | - if( ! EEH_File::ensure_folder_exists_and_is_writable( $parent_folder ) ) { |
|
281 | + $wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path); |
|
282 | + $full_file_path = EEH_File::standardise_directory_separators($full_file_path); |
|
283 | + $parent_folder = EEH_File::get_parent_folder($full_file_path); |
|
284 | + if ( ! EEH_File::exists($full_file_path)) { |
|
285 | + if ( ! EEH_File::ensure_folder_exists_and_is_writable($parent_folder)) { |
|
286 | 286 | return false; |
287 | 287 | } |
288 | - if ( ! $wp_filesystem->touch( EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) ) ) { |
|
289 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
290 | - $msg = sprintf( __( 'The "%s" file could not be created.', 'event_espresso' ), $full_file_path ); |
|
291 | - $msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_file_path ); |
|
292 | - throw new EE_Error( $msg ); |
|
288 | + if ( ! $wp_filesystem->touch(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path))) { |
|
289 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
290 | + $msg = sprintf(__('The "%s" file could not be created.', 'event_espresso'), $full_file_path); |
|
291 | + $msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path); |
|
292 | + throw new EE_Error($msg); |
|
293 | 293 | } |
294 | 294 | return false; |
295 | 295 | } |
296 | 296 | } |
297 | - if ( ! EEH_File::verify_is_writable( $full_file_path, 'file' )) { |
|
297 | + if ( ! EEH_File::verify_is_writable($full_file_path, 'file')) { |
|
298 | 298 | return false; |
299 | 299 | } |
300 | 300 | return true; |
@@ -306,7 +306,7 @@ discard block |
||
306 | 306 | * @param string $file_or_folder_path |
307 | 307 | * @return string parent folder, ENDING with a directory separator |
308 | 308 | */ |
309 | - public static function get_parent_folder( $file_or_folder_path ) { |
|
309 | + public static function get_parent_folder($file_or_folder_path) { |
|
310 | 310 | //find the last DS, ignoring a DS on the very end |
311 | 311 | //eg if given "/var/something/somewhere/", we want to get "somewhere"'s |
312 | 312 | //parent folder, "/var/something/" |
@@ -328,12 +328,12 @@ discard block |
||
328 | 328 | * @throws EE_Error if filesystem credentials are required |
329 | 329 | * @return string |
330 | 330 | */ |
331 | - public static function get_file_contents( $full_file_path = '' ){ |
|
332 | - $full_file_path = EEH_File::standardise_directory_separators( $full_file_path ); |
|
333 | - if ( EEH_File::verify_filepath_and_permissions( $full_file_path, EEH_File::get_filename_from_filepath( $full_file_path ) , EEH_File::get_file_extension( $full_file_path ))) { |
|
331 | + public static function get_file_contents($full_file_path = '') { |
|
332 | + $full_file_path = EEH_File::standardise_directory_separators($full_file_path); |
|
333 | + if (EEH_File::verify_filepath_and_permissions($full_file_path, EEH_File::get_filename_from_filepath($full_file_path), EEH_File::get_file_extension($full_file_path))) { |
|
334 | 334 | // load WP_Filesystem and set file permissions |
335 | - $wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path ); |
|
336 | - return $wp_filesystem->get_contents(EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) ); |
|
335 | + $wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path); |
|
336 | + return $wp_filesystem->get_contents(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path)); |
|
337 | 337 | } |
338 | 338 | return ''; |
339 | 339 | } |
@@ -348,26 +348,26 @@ discard block |
||
348 | 348 | * @throws EE_Error if filesystem credentials are required |
349 | 349 | * @return bool |
350 | 350 | */ |
351 | - public static function write_to_file( $full_file_path = '', $file_contents = '', $file_type = '' ){ |
|
352 | - $full_file_path = EEH_File::standardise_directory_separators( $full_file_path ); |
|
353 | - $file_type = ! empty( $file_type ) ? rtrim( $file_type, ' ' ) . ' ' : ''; |
|
354 | - $folder = EEH_File::remove_filename_from_filepath( $full_file_path ); |
|
355 | - if ( ! EEH_File::verify_is_writable( $folder, 'folder' )) { |
|
356 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
357 | - $msg = sprintf( __( 'The %1$sfile located at "%2$s" is not writable.', 'event_espresso' ), $file_type, $full_file_path ); |
|
358 | - $msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_file_path ); |
|
359 | - throw new EE_Error( $msg ); |
|
351 | + public static function write_to_file($full_file_path = '', $file_contents = '', $file_type = '') { |
|
352 | + $full_file_path = EEH_File::standardise_directory_separators($full_file_path); |
|
353 | + $file_type = ! empty($file_type) ? rtrim($file_type, ' ').' ' : ''; |
|
354 | + $folder = EEH_File::remove_filename_from_filepath($full_file_path); |
|
355 | + if ( ! EEH_File::verify_is_writable($folder, 'folder')) { |
|
356 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
357 | + $msg = sprintf(__('The %1$sfile located at "%2$s" is not writable.', 'event_espresso'), $file_type, $full_file_path); |
|
358 | + $msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path); |
|
359 | + throw new EE_Error($msg); |
|
360 | 360 | } |
361 | 361 | return FALSE; |
362 | 362 | } |
363 | 363 | // load WP_Filesystem and set file permissions |
364 | - $wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path ); |
|
364 | + $wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path); |
|
365 | 365 | // write the file |
366 | - if ( ! $wp_filesystem->put_contents(EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ), $file_contents )) { |
|
367 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
368 | - $msg = sprintf( __( 'The %1$sfile located at "%2$s" could not be written to.', 'event_espresso' ), $file_type, $full_file_path ); |
|
369 | - $msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_file_path, 'f' ); |
|
370 | - throw new EE_Error( $msg ); |
|
366 | + if ( ! $wp_filesystem->put_contents(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path), $file_contents)) { |
|
367 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
368 | + $msg = sprintf(__('The %1$sfile located at "%2$s" could not be written to.', 'event_espresso'), $file_type, $full_file_path); |
|
369 | + $msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_file_path, 'f'); |
|
370 | + throw new EE_Error($msg); |
|
371 | 371 | } |
372 | 372 | return FALSE; |
373 | 373 | } |
@@ -383,9 +383,9 @@ discard block |
||
383 | 383 | * @throws EE_Error if filesystem credentials are required |
384 | 384 | * @return boolean |
385 | 385 | */ |
386 | - public static function delete( $filepath, $recursive = false, $type = false ) { |
|
386 | + public static function delete($filepath, $recursive = false, $type = false) { |
|
387 | 387 | $wp_filesystem = EEH_File::_get_wp_filesystem(); |
388 | - return $wp_filesystem->delete( $filepath, $recursive, $type ) ? TRUE : FALSE; |
|
388 | + return $wp_filesystem->delete($filepath, $recursive, $type) ? TRUE : FALSE; |
|
389 | 389 | } |
390 | 390 | |
391 | 391 | |
@@ -397,9 +397,9 @@ discard block |
||
397 | 397 | * @throws EE_Error if filesystem credentials are required |
398 | 398 | * @return bool |
399 | 399 | */ |
400 | - public static function exists( $full_file_path = '' ) { |
|
401 | - $wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path ); |
|
402 | - return $wp_filesystem->exists( EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) ) ? TRUE : FALSE; |
|
400 | + public static function exists($full_file_path = '') { |
|
401 | + $wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path); |
|
402 | + return $wp_filesystem->exists(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path)) ? TRUE : FALSE; |
|
403 | 403 | } |
404 | 404 | |
405 | 405 | |
@@ -412,9 +412,9 @@ discard block |
||
412 | 412 | * @throws EE_Error if filesystem credentials are required |
413 | 413 | * @return bool |
414 | 414 | */ |
415 | - public static function is_readable( $full_file_path = '' ) { |
|
416 | - $wp_filesystem = EEH_File::_get_wp_filesystem( $full_file_path ); |
|
417 | - if( $wp_filesystem->is_readable( EEH_File::convert_local_filepath_to_remote_filepath( $full_file_path ) ) ) { |
|
415 | + public static function is_readable($full_file_path = '') { |
|
416 | + $wp_filesystem = EEH_File::_get_wp_filesystem($full_file_path); |
|
417 | + if ($wp_filesystem->is_readable(EEH_File::convert_local_filepath_to_remote_filepath($full_file_path))) { |
|
418 | 418 | return true; |
419 | 419 | } else { |
420 | 420 | return false; |
@@ -430,8 +430,8 @@ discard block |
||
430 | 430 | * @param string $full_file_path |
431 | 431 | * @return string |
432 | 432 | */ |
433 | - public static function remove_filename_from_filepath( $full_file_path = '' ) { |
|
434 | - return pathinfo( $full_file_path, PATHINFO_DIRNAME ); |
|
433 | + public static function remove_filename_from_filepath($full_file_path = '') { |
|
434 | + return pathinfo($full_file_path, PATHINFO_DIRNAME); |
|
435 | 435 | } |
436 | 436 | |
437 | 437 | |
@@ -441,8 +441,8 @@ discard block |
||
441 | 441 | * @param string $full_file_path |
442 | 442 | * @return string |
443 | 443 | */ |
444 | - public static function get_filename_from_filepath( $full_file_path = '' ) { |
|
445 | - return pathinfo( $full_file_path, PATHINFO_BASENAME ); |
|
444 | + public static function get_filename_from_filepath($full_file_path = '') { |
|
445 | + return pathinfo($full_file_path, PATHINFO_BASENAME); |
|
446 | 446 | } |
447 | 447 | |
448 | 448 | |
@@ -452,8 +452,8 @@ discard block |
||
452 | 452 | * @param string $full_file_path |
453 | 453 | * @return string |
454 | 454 | */ |
455 | - public static function get_file_extension( $full_file_path = '' ) { |
|
456 | - return pathinfo( $full_file_path, PATHINFO_EXTENSION ); |
|
455 | + public static function get_file_extension($full_file_path = '') { |
|
456 | + return pathinfo($full_file_path, PATHINFO_EXTENSION); |
|
457 | 457 | } |
458 | 458 | |
459 | 459 | |
@@ -464,10 +464,10 @@ discard block |
||
464 | 464 | * @throws EE_Error if filesystem credentials are required |
465 | 465 | * @return bool |
466 | 466 | */ |
467 | - public static function add_htaccess_deny_from_all( $folder = '' ) { |
|
468 | - $folder = EEH_File::standardise_and_end_with_directory_separator( $folder ); |
|
469 | - if ( ! EEH_File::exists( $folder . '.htaccess' ) ) { |
|
470 | - if ( ! EEH_File::write_to_file( $folder . '.htaccess', 'deny from all', '.htaccess' )) { |
|
467 | + public static function add_htaccess_deny_from_all($folder = '') { |
|
468 | + $folder = EEH_File::standardise_and_end_with_directory_separator($folder); |
|
469 | + if ( ! EEH_File::exists($folder.'.htaccess')) { |
|
470 | + if ( ! EEH_File::write_to_file($folder.'.htaccess', 'deny from all', '.htaccess')) { |
|
471 | 471 | return FALSE; |
472 | 472 | } |
473 | 473 | } |
@@ -481,10 +481,10 @@ discard block |
||
481 | 481 | * @throws EE_Error if filesystem credentials are required |
482 | 482 | * @return boolean |
483 | 483 | */ |
484 | - public static function add_index_file( $folder ) { |
|
485 | - $folder = EEH_File::standardise_and_end_with_directory_separator( $folder ); |
|
486 | - if ( ! EEH_File::exists( $folder . 'index.php' ) ) { |
|
487 | - if ( ! EEH_File::write_to_file( $folder . 'index.php', 'You are not permitted to read from this folder', '.php' )) { |
|
484 | + public static function add_index_file($folder) { |
|
485 | + $folder = EEH_File::standardise_and_end_with_directory_separator($folder); |
|
486 | + if ( ! EEH_File::exists($folder.'index.php')) { |
|
487 | + if ( ! EEH_File::write_to_file($folder.'index.php', 'You are not permitted to read from this folder', '.php')) { |
|
488 | 488 | return false; |
489 | 489 | } |
490 | 490 | } |
@@ -499,11 +499,11 @@ discard block |
||
499 | 499 | * @param string $file_path |
500 | 500 | * @return string |
501 | 501 | */ |
502 | - public static function get_classname_from_filepath_with_standard_filename( $file_path ){ |
|
502 | + public static function get_classname_from_filepath_with_standard_filename($file_path) { |
|
503 | 503 | //extract file from path |
504 | - $filename = basename( $file_path ); |
|
504 | + $filename = basename($file_path); |
|
505 | 505 | //now remove the first period and everything after |
506 | - $pos_of_first_period = strpos( $filename,'.' ); |
|
506 | + $pos_of_first_period = strpos($filename, '.'); |
|
507 | 507 | return substr($filename, 0, $pos_of_first_period); |
508 | 508 | } |
509 | 509 | |
@@ -515,8 +515,8 @@ discard block |
||
515 | 515 | * @param string $file_path |
516 | 516 | * @return string |
517 | 517 | */ |
518 | - public static function standardise_directory_separators( $file_path ){ |
|
519 | - return str_replace( array( '\\', '/' ), DS, $file_path ); |
|
518 | + public static function standardise_directory_separators($file_path) { |
|
519 | + return str_replace(array('\\', '/'), DS, $file_path); |
|
520 | 520 | } |
521 | 521 | |
522 | 522 | |
@@ -527,8 +527,8 @@ discard block |
||
527 | 527 | * @param string $file_path |
528 | 528 | * @return string |
529 | 529 | */ |
530 | - public static function end_with_directory_separator( $file_path ){ |
|
531 | - return rtrim( $file_path, '/\\' ) . DS; |
|
530 | + public static function end_with_directory_separator($file_path) { |
|
531 | + return rtrim($file_path, '/\\').DS; |
|
532 | 532 | } |
533 | 533 | |
534 | 534 | |
@@ -538,8 +538,8 @@ discard block |
||
538 | 538 | * @param $file_path |
539 | 539 | * @return string |
540 | 540 | */ |
541 | - public static function standardise_and_end_with_directory_separator( $file_path ){ |
|
542 | - return self::end_with_directory_separator( self::standardise_directory_separators( $file_path )); |
|
541 | + public static function standardise_and_end_with_directory_separator($file_path) { |
|
542 | + return self::end_with_directory_separator(self::standardise_directory_separators($file_path)); |
|
543 | 543 | } |
544 | 544 | |
545 | 545 | |
@@ -556,21 +556,21 @@ discard block |
||
556 | 556 | * if $index_numerically == FALSE (Default) keys are what the class names SHOULD be; |
557 | 557 | * and values are their filepaths |
558 | 558 | */ |
559 | - public static function get_contents_of_folders( $folder_paths = array(), $index_numerically = FALSE ){ |
|
559 | + public static function get_contents_of_folders($folder_paths = array(), $index_numerically = FALSE) { |
|
560 | 560 | $class_to_folder_path = array(); |
561 | - foreach( $folder_paths as $folder_path ){ |
|
562 | - $folder_path = self::standardise_and_end_with_directory_separator( $folder_path ); |
|
561 | + foreach ($folder_paths as $folder_path) { |
|
562 | + $folder_path = self::standardise_and_end_with_directory_separator($folder_path); |
|
563 | 563 | // load WP_Filesystem and set file permissions |
564 | - $files_in_folder = glob( $folder_path . '*' ); |
|
564 | + $files_in_folder = glob($folder_path.'*'); |
|
565 | 565 | $class_to_folder_path = array(); |
566 | - if ( $files_in_folder ) { |
|
567 | - foreach( $files_in_folder as $file_path ){ |
|
566 | + if ($files_in_folder) { |
|
567 | + foreach ($files_in_folder as $file_path) { |
|
568 | 568 | //only add files, not folders |
569 | - if ( ! is_dir( $file_path )) { |
|
570 | - if ( $index_numerically ) { |
|
569 | + if ( ! is_dir($file_path)) { |
|
570 | + if ($index_numerically) { |
|
571 | 571 | $class_to_folder_path[] = $file_path; |
572 | 572 | } else { |
573 | - $classname = self::get_classname_from_filepath_with_standard_filename( $file_path ); |
|
573 | + $classname = self::get_classname_from_filepath_with_standard_filename($file_path); |
|
574 | 574 | $class_to_folder_path[$classname] = $file_path; |
575 | 575 | } |
576 | 576 | } |
@@ -590,39 +590,39 @@ discard block |
||
590 | 590 | * @throws EE_Error if filesystem credentials are required |
591 | 591 | * @return boolean success |
592 | 592 | */ |
593 | - public static function copy( $source_file, $destination_file, $overwrite = FALSE ){ |
|
594 | - $full_source_path = EEH_File::standardise_directory_separators( $source_file ); |
|
595 | - if( ! EEH_File::exists( $full_source_path ) ){ |
|
596 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
597 | - $msg = sprintf( __( 'The file located at "%2$s" is not readable or doesn\'t exist.', 'event_espresso' ), $full_source_path ); |
|
598 | - $msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_source_path ); |
|
599 | - throw new EE_Error( $msg ); |
|
593 | + public static function copy($source_file, $destination_file, $overwrite = FALSE) { |
|
594 | + $full_source_path = EEH_File::standardise_directory_separators($source_file); |
|
595 | + if ( ! EEH_File::exists($full_source_path)) { |
|
596 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
597 | + $msg = sprintf(__('The file located at "%2$s" is not readable or doesn\'t exist.', 'event_espresso'), $full_source_path); |
|
598 | + $msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_source_path); |
|
599 | + throw new EE_Error($msg); |
|
600 | 600 | } |
601 | 601 | return FALSE; |
602 | 602 | } |
603 | 603 | |
604 | - $full_dest_path = EEH_File::standardise_directory_separators( $destination_file ); |
|
605 | - $folder = EEH_File::remove_filename_from_filepath( $full_dest_path ); |
|
606 | - if ( ! EEH_File::verify_is_writable( $folder, 'folder' )) { |
|
607 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
608 | - $msg = sprintf( __( 'The file located at "%2$s" is not writable.', 'event_espresso' ), $full_dest_path ); |
|
609 | - $msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_dest_path ); |
|
610 | - throw new EE_Error( $msg ); |
|
604 | + $full_dest_path = EEH_File::standardise_directory_separators($destination_file); |
|
605 | + $folder = EEH_File::remove_filename_from_filepath($full_dest_path); |
|
606 | + if ( ! EEH_File::verify_is_writable($folder, 'folder')) { |
|
607 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
608 | + $msg = sprintf(__('The file located at "%2$s" is not writable.', 'event_espresso'), $full_dest_path); |
|
609 | + $msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_dest_path); |
|
610 | + throw new EE_Error($msg); |
|
611 | 611 | } |
612 | 612 | return FALSE; |
613 | 613 | } |
614 | 614 | |
615 | 615 | // load WP_Filesystem and set file permissions |
616 | - $wp_filesystem = EEH_File::_get_wp_filesystem( $destination_file ); |
|
616 | + $wp_filesystem = EEH_File::_get_wp_filesystem($destination_file); |
|
617 | 617 | // write the file |
618 | 618 | if ( ! $wp_filesystem->copy( |
619 | - EEH_File::convert_local_filepath_to_remote_filepath( $full_source_path ), |
|
620 | - EEH_File::convert_local_filepath_to_remote_filepath( $full_dest_path ), |
|
619 | + EEH_File::convert_local_filepath_to_remote_filepath($full_source_path), |
|
620 | + EEH_File::convert_local_filepath_to_remote_filepath($full_dest_path), |
|
621 | 621 | $overwrite )) { |
622 | - if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
|
623 | - $msg = sprintf( __( 'Attempted writing to file %1$s, but could not, probably because of permissions issues', 'event_espresso' ), $full_source_path ); |
|
624 | - $msg .= EEH_File::_permissions_error_for_unreadable_filepath( $full_source_path, 'f' ); |
|
625 | - throw new EE_Error( $msg ); |
|
622 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
623 | + $msg = sprintf(__('Attempted writing to file %1$s, but could not, probably because of permissions issues', 'event_espresso'), $full_source_path); |
|
624 | + $msg .= EEH_File::_permissions_error_for_unreadable_filepath($full_source_path, 'f'); |
|
625 | + throw new EE_Error($msg); |
|
626 | 626 | } |
627 | 627 | return FALSE; |
628 | 628 | } |
@@ -634,9 +634,9 @@ discard block |
||
634 | 634 | * @param string $filepath |
635 | 635 | * @return boolean |
636 | 636 | */ |
637 | - public static function is_in_uploads_folder( $filepath ) { |
|
637 | + public static function is_in_uploads_folder($filepath) { |
|
638 | 638 | $uploads = wp_upload_dir(); |
639 | - return strpos( $filepath, $uploads[ 'basedir' ] ) === 0 ? true : false; |
|
639 | + return strpos($filepath, $uploads['basedir']) === 0 ? true : false; |
|
640 | 640 | } |
641 | 641 | |
642 | 642 | /** |
@@ -651,9 +651,9 @@ discard block |
||
651 | 651 | * @return string the remote filepath (eg the filepath the filesystem method, eg |
652 | 652 | * ftp or ssh, will use to access the folder |
653 | 653 | */ |
654 | - public static function convert_local_filepath_to_remote_filepath( $local_filepath ) { |
|
655 | - $wp_filesystem = EEH_File::_get_wp_filesystem( $local_filepath ); |
|
656 | - return str_replace( WP_CONTENT_DIR . DS, $wp_filesystem->wp_content_dir(), $local_filepath ); |
|
654 | + public static function convert_local_filepath_to_remote_filepath($local_filepath) { |
|
655 | + $wp_filesystem = EEH_File::_get_wp_filesystem($local_filepath); |
|
656 | + return str_replace(WP_CONTENT_DIR.DS, $wp_filesystem->wp_content_dir(), $local_filepath); |
|
657 | 657 | } |
658 | 658 | } |
659 | 659 | // End of file EEH_File.helper.php |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | |
3 | 5 | /** |
4 | 6 | * |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @author Michael Nelson, Brent Christensen |
9 | 9 | * |
10 | 10 | */ |
11 | -class EEM_Payment extends EEM_Base implements EEMI_Payment{ |
|
11 | +class EEM_Payment extends EEM_Base implements EEMI_Payment { |
|
12 | 12 | |
13 | 13 | // private instance of the Payment object |
14 | 14 | protected static $_instance = NULL; |
@@ -56,28 +56,28 @@ discard block |
||
56 | 56 | * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved). Note this just sends the timezone info to the date time model field objects. Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option) |
57 | 57 | * @return EEM_Payment |
58 | 58 | */ |
59 | - protected function __construct( $timezone ) { |
|
59 | + protected function __construct($timezone) { |
|
60 | 60 | |
61 | - $this->singular_item = __('Payment','event_espresso'); |
|
62 | - $this->plural_item = __('Payments','event_espresso'); |
|
61 | + $this->singular_item = __('Payment', 'event_espresso'); |
|
62 | + $this->plural_item = __('Payments', 'event_espresso'); |
|
63 | 63 | |
64 | 64 | $this->_tables = array( |
65 | - 'Payment'=>new EE_Primary_Table('esp_payment','PAY_ID') |
|
65 | + 'Payment'=>new EE_Primary_Table('esp_payment', 'PAY_ID') |
|
66 | 66 | ); |
67 | 67 | $this->_fields = array( |
68 | 68 | 'Payment'=>array( |
69 | - 'PAY_ID'=>new EE_Primary_Key_Int_Field('PAY_ID', __('Payment ID','event_espresso')), |
|
70 | - 'TXN_ID'=>new EE_Foreign_Key_Int_Field('TXN_ID', __('Transaction ID','event_espresso'), false, 0, 'Transaction'), |
|
71 | - 'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID','event_espresso'), false, EEM_Payment::status_id_failed, 'Status'), |
|
72 | - 'PAY_timestamp'=> new EE_Datetime_Field('PAY_timestamp', __('Timestamp of when payment was attempted','event_espresso'), false, EE_Datetime_Field::now, $timezone ), |
|
73 | - 'PAY_source'=>new EE_All_Caps_Text_Field('PAY_source', __('User-friendly description of payment','event_espresso'), false, 'CART'), |
|
74 | - 'PAY_amount'=>new EE_Money_Field('PAY_amount', __('Amount Payment should be for','event_espresso'), false, 0), |
|
69 | + 'PAY_ID'=>new EE_Primary_Key_Int_Field('PAY_ID', __('Payment ID', 'event_espresso')), |
|
70 | + 'TXN_ID'=>new EE_Foreign_Key_Int_Field('TXN_ID', __('Transaction ID', 'event_espresso'), false, 0, 'Transaction'), |
|
71 | + 'STS_ID'=>new EE_Foreign_Key_String_Field('STS_ID', __('Status ID', 'event_espresso'), false, EEM_Payment::status_id_failed, 'Status'), |
|
72 | + 'PAY_timestamp'=> new EE_Datetime_Field('PAY_timestamp', __('Timestamp of when payment was attempted', 'event_espresso'), false, EE_Datetime_Field::now, $timezone), |
|
73 | + 'PAY_source'=>new EE_All_Caps_Text_Field('PAY_source', __('User-friendly description of payment', 'event_espresso'), false, 'CART'), |
|
74 | + 'PAY_amount'=>new EE_Money_Field('PAY_amount', __('Amount Payment should be for', 'event_espresso'), false, 0), |
|
75 | 75 | 'PMD_ID'=>new EE_Foreign_Key_Int_Field('PMD_ID', __("Payment Method ID", 'event_espresso'), false, NULL, 'Payment_Method'), |
76 | - 'PAY_gateway_response'=>new EE_Plain_Text_Field('PAY_gateway_response', __('Response from Gateway about the payment','event_espresso'), false, ''), |
|
77 | - 'PAY_txn_id_chq_nmbr'=>new EE_Plain_Text_Field('PAY_txn_id_chq_nmbr', __('Gateway Transaction ID or Cheque Number','event_espresso'), true, ''), |
|
78 | - 'PAY_po_number'=>new EE_Plain_Text_Field('PAY_po_number', __('Purchase or Sales Number','event_espresso'), true, ''), |
|
79 | - 'PAY_extra_accntng'=>new EE_Simple_HTML_Field('PAY_extra_accntng', __('Extra Account Info','event_espresso'), true, ''), |
|
80 | - 'PAY_details'=>new EE_Serialized_Text_Field('PAY_details', __('Full Gateway response about payment','event_espresso'), true, ''), |
|
76 | + 'PAY_gateway_response'=>new EE_Plain_Text_Field('PAY_gateway_response', __('Response from Gateway about the payment', 'event_espresso'), false, ''), |
|
77 | + 'PAY_txn_id_chq_nmbr'=>new EE_Plain_Text_Field('PAY_txn_id_chq_nmbr', __('Gateway Transaction ID or Cheque Number', 'event_espresso'), true, ''), |
|
78 | + 'PAY_po_number'=>new EE_Plain_Text_Field('PAY_po_number', __('Purchase or Sales Number', 'event_espresso'), true, ''), |
|
79 | + 'PAY_extra_accntng'=>new EE_Simple_HTML_Field('PAY_extra_accntng', __('Extra Account Info', 'event_espresso'), true, ''), |
|
80 | + 'PAY_details'=>new EE_Serialized_Text_Field('PAY_details', __('Full Gateway response about payment', 'event_espresso'), true, ''), |
|
81 | 81 | 'PAY_redirect_url'=>new EE_Plain_Text_Field('PAY_redirect_url', __("Redirect URL", 'event_espresso'), true), |
82 | 82 | 'PAY_redirect_args'=>new EE_Serialized_Text_Field('PAY_redirect_args', __("Key-Value POST vars to send along with redirect", 'event_espresso'), true) |
83 | 83 | ) |
@@ -87,11 +87,11 @@ discard block |
||
87 | 87 | 'Status'=> new EE_Belongs_To_Relation(), |
88 | 88 | 'Payment_Method'=>new EE_Belongs_To_Relation(), |
89 | 89 | 'Registration_Payment' => new EE_Has_Many_Relation(), |
90 | - 'Registration' => new EE_HABTM_Relation( 'Registration_Payment' ), |
|
90 | + 'Registration' => new EE_HABTM_Relation('Registration_Payment'), |
|
91 | 91 | ); |
92 | 92 | $this->_model_chain_to_wp_user = 'Payment_Method'; |
93 | 93 | $this->_caps_slug = 'transactions'; |
94 | - parent::__construct( $timezone ); |
|
94 | + parent::__construct($timezone); |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @param string $PAY_txn_id_chq_nmbr |
104 | 104 | * @return EE_Payment |
105 | 105 | */ |
106 | - public function get_payment_by_txn_id_chq_nmbr( $PAY_txn_id_chq_nmbr ){ |
|
106 | + public function get_payment_by_txn_id_chq_nmbr($PAY_txn_id_chq_nmbr) { |
|
107 | 107 | return $this->get_one(array(array('PAY_txn_id_chq_nmbr'=>$PAY_txn_id_chq_nmbr))); |
108 | 108 | } |
109 | 109 | |
@@ -119,15 +119,15 @@ discard block |
||
119 | 119 | * @param string $status_of_payment one of EEM_Payment::status_id_*, like 'PAP','PCN',etc. If none is provided, gets payments with any status |
120 | 120 | * @return EE_Payment[] |
121 | 121 | */ |
122 | - public function get_payments_for_transaction( $TXN_ID = FALSE, $status_of_payment = null ) { |
|
122 | + public function get_payments_for_transaction($TXN_ID = FALSE, $status_of_payment = null) { |
|
123 | 123 | // all payments for a TXN ordered chronologically |
124 | - $query_params = array( array( 'TXN_ID' => $TXN_ID ), 'order_by' => array( 'PAY_timestamp' => 'ASC' )); |
|
124 | + $query_params = array(array('TXN_ID' => $TXN_ID), 'order_by' => array('PAY_timestamp' => 'ASC')); |
|
125 | 125 | // if provided with a status, search specifically for that status. Otherwise get them all |
126 | - if ( $status_of_payment ){ |
|
126 | + if ($status_of_payment) { |
|
127 | 127 | $query_params[0]['STS_ID'] = $status_of_payment; |
128 | 128 | } |
129 | 129 | // retrieve payments |
130 | - return $this->get_all ( $query_params ); |
|
130 | + return $this->get_all($query_params); |
|
131 | 131 | } |
132 | 132 | |
133 | 133 | |
@@ -137,8 +137,8 @@ discard block |
||
137 | 137 | * @param int $TXN_ID |
138 | 138 | * @return EE_Payment[] |
139 | 139 | */ |
140 | - public function get_approved_payments_for_transaction( $TXN_ID = 0 ) { |
|
141 | - return $this->get_payments_for_transaction( $TXN_ID, EEM_Payment::status_id_approved ); |
|
140 | + public function get_approved_payments_for_transaction($TXN_ID = 0) { |
|
141 | + return $this->get_payments_for_transaction($TXN_ID, EEM_Payment::status_id_approved); |
|
142 | 142 | |
143 | 143 | } |
144 | 144 | |
@@ -159,36 +159,36 @@ discard block |
||
159 | 159 | * |
160 | 160 | * @return EE_Payment[] |
161 | 161 | */ |
162 | - public function get_payments_made_between_dates( $start_date = '', $end_date = '', $format = '', $timezone = '' ) { |
|
163 | - $timezone = empty( $timezone ) ? EEH_DTT_Helper::get_timezone() : $timezone; |
|
162 | + public function get_payments_made_between_dates($start_date = '', $end_date = '', $format = '', $timezone = '') { |
|
163 | + $timezone = empty($timezone) ? EEH_DTT_Helper::get_timezone() : $timezone; |
|
164 | 164 | //if $start_date or $end date, verify $format is included. |
165 | - if ( ( ! empty( $start_date ) || ! empty( $end_date ) ) && empty( $format ) ) { |
|
166 | - throw new EE_Error( __('You included a start date and/or a end date for this method but did not include a format string. The format string is needed for setting up the query', 'event_espresso' ) ); |
|
165 | + if (( ! empty($start_date) || ! empty($end_date)) && empty($format)) { |
|
166 | + throw new EE_Error(__('You included a start date and/or a end date for this method but did not include a format string. The format string is needed for setting up the query', 'event_espresso')); |
|
167 | 167 | } |
168 | - $now = new DateTime( 'now' ); |
|
168 | + $now = new DateTime('now'); |
|
169 | 169 | // setup timezone objects once |
170 | - $modelDateTimeZone = new DateTimeZone( $this->_timezone ); |
|
171 | - $passedDateTimeZone = new DateTimeZone( $timezone ); |
|
170 | + $modelDateTimeZone = new DateTimeZone($this->_timezone); |
|
171 | + $passedDateTimeZone = new DateTimeZone($timezone); |
|
172 | 172 | // setup start date |
173 | - $start_date = ! empty( $start_date ) ? date_create_from_format( $format, $start_date, $passedDateTimeZone ) : $now; |
|
174 | - $start_date->setTimeZone( $modelDateTimeZone ); |
|
175 | - $start_date = $start_date->format( 'Y-m-d' ) . ' 00:00:00'; |
|
176 | - $start_date = strtotime( $start_date ); |
|
173 | + $start_date = ! empty($start_date) ? date_create_from_format($format, $start_date, $passedDateTimeZone) : $now; |
|
174 | + $start_date->setTimeZone($modelDateTimeZone); |
|
175 | + $start_date = $start_date->format('Y-m-d').' 00:00:00'; |
|
176 | + $start_date = strtotime($start_date); |
|
177 | 177 | // setup end date |
178 | - $end_date = ! empty( $end_date ) ? date_create_from_format( $format, $end_date, $passedDateTimeZone ) : $now; |
|
179 | - $end_date->setTimeZone( $modelDateTimeZone ); |
|
180 | - $end_date = $end_date->format('Y-m-d') . ' 23:59:59'; |
|
181 | - $end_date = strtotime( $end_date ); |
|
178 | + $end_date = ! empty($end_date) ? date_create_from_format($format, $end_date, $passedDateTimeZone) : $now; |
|
179 | + $end_date->setTimeZone($modelDateTimeZone); |
|
180 | + $end_date = $end_date->format('Y-m-d').' 23:59:59'; |
|
181 | + $end_date = strtotime($end_date); |
|
182 | 182 | |
183 | 183 | // make sure our start date is the lowest value and vice versa |
184 | - $start = min( $start_date, $end_date ); |
|
185 | - $end = max( $start_date, $end_date ); |
|
184 | + $start = min($start_date, $end_date); |
|
185 | + $end = max($start_date, $end_date); |
|
186 | 186 | |
187 | 187 | //yes we generated the date and time string in utc but we WANT this start date and time used in the set timezone on the model. |
188 | - $start_date = $this->convert_datetime_for_query( 'PAY_timestamp', date( 'Y-m-d', $start ) . ' 00:00:00', 'Y-m-d H:i:s', $this->get_timezone() ); |
|
189 | - $end_date = $this->convert_datetime_for_query( 'PAY_timestamp', date( 'Y-m-d', $end) . ' 23:59:59' , 'Y-m-d H:i:s', $this->get_timezone() ); |
|
188 | + $start_date = $this->convert_datetime_for_query('PAY_timestamp', date('Y-m-d', $start).' 00:00:00', 'Y-m-d H:i:s', $this->get_timezone()); |
|
189 | + $end_date = $this->convert_datetime_for_query('PAY_timestamp', date('Y-m-d', $end).' 23:59:59', 'Y-m-d H:i:s', $this->get_timezone()); |
|
190 | 190 | |
191 | - return $this->get_all(array(array('PAY_timestamp'=>array('>=',$start_date),'PAY_timestamp*'=>array('<=',$end_date)))); |
|
191 | + return $this->get_all(array(array('PAY_timestamp'=>array('>=', $start_date), 'PAY_timestamp*'=>array('<=', $end_date)))); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | /** |
@@ -198,35 +198,35 @@ discard block |
||
198 | 198 | * returns a string for the approved status |
199 | 199 | * @return string |
200 | 200 | */ |
201 | - function approved_status(){ |
|
201 | + function approved_status() { |
|
202 | 202 | return self::status_id_approved; |
203 | 203 | } |
204 | 204 | /** |
205 | 205 | * returns a string for the pending status |
206 | 206 | * @return string |
207 | 207 | */ |
208 | - function pending_status(){ |
|
208 | + function pending_status() { |
|
209 | 209 | return self::status_id_pending; |
210 | 210 | } |
211 | 211 | /** |
212 | 212 | * returns a string for the cancelled status |
213 | 213 | * @return string |
214 | 214 | */ |
215 | - function cancelled_status(){ |
|
215 | + function cancelled_status() { |
|
216 | 216 | return self::status_id_cancelled; |
217 | 217 | } |
218 | 218 | /** |
219 | 219 | * returns a string for the failed status |
220 | 220 | * @return string |
221 | 221 | */ |
222 | - function failed_status(){ |
|
222 | + function failed_status() { |
|
223 | 223 | return self::status_id_failed; |
224 | 224 | } |
225 | 225 | /** |
226 | 226 | * returns a string for the declined status |
227 | 227 | * @return string |
228 | 228 | */ |
229 | - function declined_status(){ |
|
229 | + function declined_status() { |
|
230 | 230 | return self::status_id_declined; |
231 | 231 | } |
232 | 232 |
@@ -1,4 +1,6 @@ |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * |
4 | 6 | * Payment Model |
@@ -34,17 +34,16 @@ discard block |
||
34 | 34 | |
35 | 35 | |
36 | 36 | |
37 | - /** |
|
38 | - * Add an EE_Middleware class to the beginning of the middleware_stack |
|
39 | - * First parameter is the middleware classname, |
|
40 | - * any number of arguments can also be passed, and detected via func_get_args() |
|
41 | - |
|
42 | - * @ param $class_name |
|
43 | - * @ param $args |
|
44 | - * |
|
45 | - * @return EE_Request_Stack_Builder |
|
46 | - * @throws \InvalidArgumentException |
|
47 | - */ |
|
37 | + /** |
|
38 | + * Add an EE_Middleware class to the beginning of the middleware_stack |
|
39 | + * First parameter is the middleware classname, |
|
40 | + * any number of arguments can also be passed, and detected via func_get_args() |
|
41 | + * @ param $class_name |
|
42 | + * @ param $args |
|
43 | + * |
|
44 | + * @return EE_Request_Stack_Builder |
|
45 | + * @throws \InvalidArgumentException |
|
46 | + */ |
|
48 | 47 | public function unshift( /*$class_name, $args*/ ) { |
49 | 48 | if ( func_num_args() === 0 ) { |
50 | 49 | throw new InvalidArgumentException( 'Missing argument(s) when calling unshift' ); |
@@ -56,35 +55,34 @@ discard block |
||
56 | 55 | |
57 | 56 | |
58 | 57 | |
59 | - /** |
|
60 | - * Add an EE_Middleware class to the end of the middleware_stack |
|
61 | - * First parameter is the middleware classname, |
|
62 | - * any number of arguments can also be passed, and detected via func_get_args() |
|
63 | - |
|
64 | - * @ param $class_name |
|
65 | - * @ param $args |
|
66 | - * |
|
67 | - * @return EE_Request_Stack_Builder |
|
68 | - * @throws \InvalidArgumentException |
|
69 | - */ |
|
58 | + /** |
|
59 | + * Add an EE_Middleware class to the end of the middleware_stack |
|
60 | + * First parameter is the middleware classname, |
|
61 | + * any number of arguments can also be passed, and detected via func_get_args() |
|
62 | + * @ param $class_name |
|
63 | + * @ param $args |
|
64 | + * |
|
65 | + * @return EE_Request_Stack_Builder |
|
66 | + * @throws \InvalidArgumentException |
|
67 | + */ |
|
70 | 68 | public function push( /*$class_name, $args...*/ ) { |
71 | 69 | if ( func_num_args() === 0 ) { |
72 | 70 | throw new InvalidArgumentException( 'Missing argument(s) when calling push' ); |
73 | 71 | } |
74 | - $middleware = func_get_args(); |
|
75 | - $this->_middleware_stack[] = $middleware; |
|
72 | + $middleware = func_get_args(); |
|
73 | + $this->_middleware_stack[] = $middleware; |
|
76 | 74 | return $this; |
77 | 75 | } |
78 | 76 | |
79 | 77 | |
80 | 78 | |
81 | - /** |
|
82 | - * builds decorated middleware stack |
|
83 | - * by continuously injecting previous middleware app into the next |
|
84 | - * |
|
85 | - * @param EEI_Request_Decorator $application |
|
86 | - * @return EE_Request_Stack |
|
87 | - */ |
|
79 | + /** |
|
80 | + * builds decorated middleware stack |
|
81 | + * by continuously injecting previous middleware app into the next |
|
82 | + * |
|
83 | + * @param EEI_Request_Decorator $application |
|
84 | + * @return EE_Request_Stack |
|
85 | + */ |
|
88 | 86 | public function resolve( EEI_Request_Decorator $application ) { |
89 | 87 | $middlewares = array( $application ); |
90 | 88 | foreach ( $this->_middleware_stack as $middleware_args ) { |
@@ -93,9 +91,9 @@ discard block |
||
93 | 91 | $application = $class_name( $application ); |
94 | 92 | } else { |
95 | 93 | array_unshift( $middleware_args, $application ); |
96 | - $reflection = new ReflectionClass($class_name); |
|
97 | - $application = $reflection->newInstanceArgs($middleware_args); |
|
98 | - } |
|
94 | + $reflection = new ReflectionClass($class_name); |
|
95 | + $application = $reflection->newInstanceArgs($middleware_args); |
|
96 | + } |
|
99 | 97 | array_unshift( $middlewares, $application ); |
100 | 98 | } |
101 | 99 | return new EE_Request_Stack( $application, $middlewares ); |
@@ -46,11 +46,11 @@ discard block |
||
46 | 46 | * @throws \InvalidArgumentException |
47 | 47 | */ |
48 | 48 | public function unshift( /*$class_name, $args*/ ) { |
49 | - if ( func_num_args() === 0 ) { |
|
50 | - throw new InvalidArgumentException( 'Missing argument(s) when calling unshift' ); |
|
49 | + if (func_num_args() === 0) { |
|
50 | + throw new InvalidArgumentException('Missing argument(s) when calling unshift'); |
|
51 | 51 | } |
52 | 52 | $middleware = func_get_args(); |
53 | - array_unshift( $this->_middleware_stack, $middleware ); |
|
53 | + array_unshift($this->_middleware_stack, $middleware); |
|
54 | 54 | return $this; |
55 | 55 | } |
56 | 56 | |
@@ -68,8 +68,8 @@ discard block |
||
68 | 68 | * @throws \InvalidArgumentException |
69 | 69 | */ |
70 | 70 | public function push( /*$class_name, $args...*/ ) { |
71 | - if ( func_num_args() === 0 ) { |
|
72 | - throw new InvalidArgumentException( 'Missing argument(s) when calling push' ); |
|
71 | + if (func_num_args() === 0) { |
|
72 | + throw new InvalidArgumentException('Missing argument(s) when calling push'); |
|
73 | 73 | } |
74 | 74 | $middleware = func_get_args(); |
75 | 75 | $this->_middleware_stack[] = $middleware; |
@@ -85,20 +85,20 @@ discard block |
||
85 | 85 | * @param EEI_Request_Decorator $application |
86 | 86 | * @return EE_Request_Stack |
87 | 87 | */ |
88 | - public function resolve( EEI_Request_Decorator $application ) { |
|
89 | - $middlewares = array( $application ); |
|
90 | - foreach ( $this->_middleware_stack as $middleware_args ) { |
|
91 | - $class_name = array_shift( $middleware_args ); |
|
92 | - if ( is_callable( $class_name ) ) { |
|
93 | - $application = $class_name( $application ); |
|
88 | + public function resolve(EEI_Request_Decorator $application) { |
|
89 | + $middlewares = array($application); |
|
90 | + foreach ($this->_middleware_stack as $middleware_args) { |
|
91 | + $class_name = array_shift($middleware_args); |
|
92 | + if (is_callable($class_name)) { |
|
93 | + $application = $class_name($application); |
|
94 | 94 | } else { |
95 | - array_unshift( $middleware_args, $application ); |
|
95 | + array_unshift($middleware_args, $application); |
|
96 | 96 | $reflection = new ReflectionClass($class_name); |
97 | 97 | $application = $reflection->newInstanceArgs($middleware_args); |
98 | 98 | } |
99 | - array_unshift( $middlewares, $application ); |
|
99 | + array_unshift($middlewares, $application); |
|
100 | 100 | } |
101 | - return new EE_Request_Stack( $application, $middlewares ); |
|
101 | + return new EE_Request_Stack($application, $middlewares); |
|
102 | 102 | } |
103 | 103 | |
104 | 104 |
@@ -29,191 +29,191 @@ |
||
29 | 29 | class EE_Bootstrap |
30 | 30 | { |
31 | 31 | |
32 | - /** |
|
33 | - * @var EE_Request $request |
|
34 | - */ |
|
35 | - protected $request; |
|
36 | - |
|
37 | - /** |
|
38 | - * @var EE_Response $response |
|
39 | - */ |
|
40 | - protected $response; |
|
41 | - |
|
42 | - /** |
|
43 | - * @var EE_Request_Stack_Builder $request_stack_builder |
|
44 | - */ |
|
45 | - protected $request_stack_builder; |
|
46 | - |
|
47 | - /** |
|
48 | - * @var EE_Request_Stack $_request_stack |
|
49 | - */ |
|
50 | - protected $request_stack; |
|
51 | - |
|
52 | - |
|
53 | - |
|
54 | - public function __construct(EE_Request $request, EE_Response $response) |
|
55 | - { |
|
56 | - $this->request = $request; |
|
57 | - $this->response = $response; |
|
58 | - // construct request stack and run middleware apps as soon as all WP plugins are loaded |
|
59 | - add_action('plugins_loaded', array($this, 'run_request_stack'), 0); |
|
60 | - // set framework for the rest of EE to hook into when loading |
|
61 | - add_action('plugins_loaded', array('EE_Bootstrap', 'load_espresso_addons'), 1); |
|
62 | - add_action('plugins_loaded', array('EE_Bootstrap', 'detect_activations_or_upgrades'), 3); |
|
63 | - add_action('plugins_loaded', array('EE_Bootstrap', 'load_core_configuration'), 5); |
|
64 | - add_action('plugins_loaded', array('EE_Bootstrap', 'register_shortcodes_modules_and_widgets'), 7); |
|
65 | - add_action('plugins_loaded', array('EE_Bootstrap', 'brew_espresso'), 9); |
|
66 | - } |
|
67 | - |
|
68 | - |
|
69 | - |
|
70 | - /** |
|
71 | - * run_request_stack |
|
72 | - * construct request stack and run middleware apps |
|
73 | - * |
|
74 | - * @throws EE_Error |
|
75 | - * @throws InvalidArgumentException |
|
76 | - */ |
|
77 | - public function run_request_stack() |
|
78 | - { |
|
79 | - $this->load_autoloader(); |
|
80 | - $this->set_autoloaders_for_required_files(); |
|
81 | - $this->request_stack_builder = $this->build_request_stack(); |
|
82 | - $this->request_stack = $this->request_stack_builder->resolve( |
|
83 | - new EE_Load_Espresso_Core() |
|
84 | - ); |
|
85 | - $this->request_stack->handle_request($this->request, $this->response); |
|
86 | - $this->request_stack->handle_response(); |
|
87 | - } |
|
88 | - |
|
89 | - |
|
90 | - |
|
91 | - /** |
|
92 | - * load_autoloader |
|
93 | - */ |
|
94 | - protected function load_autoloader() |
|
95 | - { |
|
96 | - // load interfaces |
|
97 | - espresso_load_required( |
|
98 | - 'EEH_Autoloader', |
|
99 | - EE_CORE . 'helpers' . DS . 'EEH_Autoloader.helper.php' |
|
100 | - ); |
|
101 | - EEH_Autoloader::instance(); |
|
102 | - } |
|
103 | - |
|
104 | - |
|
105 | - |
|
106 | - /** |
|
107 | - * load_required_files |
|
108 | - * |
|
109 | - * @throws EE_Error |
|
110 | - */ |
|
111 | - protected function set_autoloaders_for_required_files() |
|
112 | - { |
|
113 | - // load interfaces |
|
114 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'interfaces', true); |
|
115 | - // load helpers |
|
116 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_HELPERS); |
|
117 | - // load request stack |
|
118 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'request_stack' . DS); |
|
119 | - // load middleware |
|
120 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'middleware' . DS); |
|
121 | - } |
|
122 | - |
|
123 | - |
|
124 | - |
|
125 | - /** |
|
126 | - * build_request_stack |
|
127 | - * |
|
128 | - * @return EE_Request_Stack_Builder |
|
129 | - * @throws InvalidArgumentException |
|
130 | - */ |
|
131 | - public function build_request_stack() |
|
132 | - { |
|
133 | - $request_stack_builder = new EE_Request_Stack_Builder(); |
|
134 | - $stack_apps = apply_filters( |
|
135 | - 'FHEE__EE_Bootstrap__build_request_stack__stack_apps', |
|
136 | - array( |
|
137 | - 'EE_Detect_Login', |
|
138 | - 'EE_Recommended_Versions', |
|
139 | - 'EE_Alpha_Banner_Warning', |
|
140 | - ) |
|
141 | - ); |
|
142 | - // load middleware onto stack : FILO (First In Last Out) |
|
143 | - foreach ((array)$stack_apps as $stack_app) { |
|
144 | - //$request_stack_builder->push( $stack_app ); |
|
145 | - $request_stack_builder->unshift($stack_app); |
|
146 | - } |
|
147 | - return apply_filters( |
|
148 | - 'FHEE__EE_Bootstrap__build_request_stack__request_stack_builder', |
|
149 | - $request_stack_builder |
|
150 | - ); |
|
151 | - } |
|
152 | - |
|
153 | - |
|
154 | - |
|
155 | - /** |
|
156 | - * load_espresso_addons |
|
157 | - * runs during the WP 'plugins_loaded' action at priority 1 |
|
158 | - * and is the initial loading phase for EE addons |
|
159 | - * no other logic should be performed at this point |
|
160 | - */ |
|
161 | - public static function load_espresso_addons() |
|
162 | - { |
|
163 | - do_action('AHEE__EE_Bootstrap__load_espresso_addons'); |
|
164 | - } |
|
165 | - |
|
166 | - |
|
167 | - |
|
168 | - /** |
|
169 | - * detect_activations_or_upgrades |
|
170 | - * runs during the WP 'plugins_loaded' action at priority 3 |
|
171 | - * Now that all of the addons have been loaded, |
|
172 | - * we can determine if anything needs activating or upgrading |
|
173 | - */ |
|
174 | - public static function detect_activations_or_upgrades() |
|
175 | - { |
|
176 | - do_action('AHEE__EE_Bootstrap__detect_activations_or_upgrades'); |
|
177 | - } |
|
178 | - |
|
179 | - |
|
180 | - |
|
181 | - /** |
|
182 | - * load_core_configuration |
|
183 | - * runs during the WP 'plugins_loaded' action at priority 5 |
|
184 | - * Now that the database is assumed to be at the correct version |
|
185 | - * we can load and set all of the system configurations |
|
186 | - */ |
|
187 | - public static function load_core_configuration() |
|
188 | - { |
|
189 | - do_action('AHEE__EE_Bootstrap__load_core_configuration'); |
|
190 | - } |
|
191 | - |
|
192 | - |
|
193 | - |
|
194 | - /** |
|
195 | - * register_shortcodes_modules_and_widgets |
|
196 | - * runs during the WP 'plugins_loaded' action at priority 7 |
|
197 | - * and handles registering all o four shortcodes, modules and widgets |
|
198 | - * so that they are ready to be used throughout the system |
|
199 | - */ |
|
200 | - public static function register_shortcodes_modules_and_widgets() |
|
201 | - { |
|
202 | - do_action('AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets'); |
|
203 | - } |
|
204 | - |
|
205 | - |
|
206 | - |
|
207 | - /** |
|
208 | - * brew_espresso |
|
209 | - * runs during the WP 'plugins_loaded' action at priority 9 |
|
210 | - * bootstrapping is considered complete at this point, |
|
211 | - * so let the fun begin... |
|
212 | - */ |
|
213 | - public static function brew_espresso() |
|
214 | - { |
|
215 | - do_action('AHEE__EE_Bootstrap__brew_espresso'); |
|
216 | - } |
|
32 | + /** |
|
33 | + * @var EE_Request $request |
|
34 | + */ |
|
35 | + protected $request; |
|
36 | + |
|
37 | + /** |
|
38 | + * @var EE_Response $response |
|
39 | + */ |
|
40 | + protected $response; |
|
41 | + |
|
42 | + /** |
|
43 | + * @var EE_Request_Stack_Builder $request_stack_builder |
|
44 | + */ |
|
45 | + protected $request_stack_builder; |
|
46 | + |
|
47 | + /** |
|
48 | + * @var EE_Request_Stack $_request_stack |
|
49 | + */ |
|
50 | + protected $request_stack; |
|
51 | + |
|
52 | + |
|
53 | + |
|
54 | + public function __construct(EE_Request $request, EE_Response $response) |
|
55 | + { |
|
56 | + $this->request = $request; |
|
57 | + $this->response = $response; |
|
58 | + // construct request stack and run middleware apps as soon as all WP plugins are loaded |
|
59 | + add_action('plugins_loaded', array($this, 'run_request_stack'), 0); |
|
60 | + // set framework for the rest of EE to hook into when loading |
|
61 | + add_action('plugins_loaded', array('EE_Bootstrap', 'load_espresso_addons'), 1); |
|
62 | + add_action('plugins_loaded', array('EE_Bootstrap', 'detect_activations_or_upgrades'), 3); |
|
63 | + add_action('plugins_loaded', array('EE_Bootstrap', 'load_core_configuration'), 5); |
|
64 | + add_action('plugins_loaded', array('EE_Bootstrap', 'register_shortcodes_modules_and_widgets'), 7); |
|
65 | + add_action('plugins_loaded', array('EE_Bootstrap', 'brew_espresso'), 9); |
|
66 | + } |
|
67 | + |
|
68 | + |
|
69 | + |
|
70 | + /** |
|
71 | + * run_request_stack |
|
72 | + * construct request stack and run middleware apps |
|
73 | + * |
|
74 | + * @throws EE_Error |
|
75 | + * @throws InvalidArgumentException |
|
76 | + */ |
|
77 | + public function run_request_stack() |
|
78 | + { |
|
79 | + $this->load_autoloader(); |
|
80 | + $this->set_autoloaders_for_required_files(); |
|
81 | + $this->request_stack_builder = $this->build_request_stack(); |
|
82 | + $this->request_stack = $this->request_stack_builder->resolve( |
|
83 | + new EE_Load_Espresso_Core() |
|
84 | + ); |
|
85 | + $this->request_stack->handle_request($this->request, $this->response); |
|
86 | + $this->request_stack->handle_response(); |
|
87 | + } |
|
88 | + |
|
89 | + |
|
90 | + |
|
91 | + /** |
|
92 | + * load_autoloader |
|
93 | + */ |
|
94 | + protected function load_autoloader() |
|
95 | + { |
|
96 | + // load interfaces |
|
97 | + espresso_load_required( |
|
98 | + 'EEH_Autoloader', |
|
99 | + EE_CORE . 'helpers' . DS . 'EEH_Autoloader.helper.php' |
|
100 | + ); |
|
101 | + EEH_Autoloader::instance(); |
|
102 | + } |
|
103 | + |
|
104 | + |
|
105 | + |
|
106 | + /** |
|
107 | + * load_required_files |
|
108 | + * |
|
109 | + * @throws EE_Error |
|
110 | + */ |
|
111 | + protected function set_autoloaders_for_required_files() |
|
112 | + { |
|
113 | + // load interfaces |
|
114 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'interfaces', true); |
|
115 | + // load helpers |
|
116 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_HELPERS); |
|
117 | + // load request stack |
|
118 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'request_stack' . DS); |
|
119 | + // load middleware |
|
120 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'middleware' . DS); |
|
121 | + } |
|
122 | + |
|
123 | + |
|
124 | + |
|
125 | + /** |
|
126 | + * build_request_stack |
|
127 | + * |
|
128 | + * @return EE_Request_Stack_Builder |
|
129 | + * @throws InvalidArgumentException |
|
130 | + */ |
|
131 | + public function build_request_stack() |
|
132 | + { |
|
133 | + $request_stack_builder = new EE_Request_Stack_Builder(); |
|
134 | + $stack_apps = apply_filters( |
|
135 | + 'FHEE__EE_Bootstrap__build_request_stack__stack_apps', |
|
136 | + array( |
|
137 | + 'EE_Detect_Login', |
|
138 | + 'EE_Recommended_Versions', |
|
139 | + 'EE_Alpha_Banner_Warning', |
|
140 | + ) |
|
141 | + ); |
|
142 | + // load middleware onto stack : FILO (First In Last Out) |
|
143 | + foreach ((array)$stack_apps as $stack_app) { |
|
144 | + //$request_stack_builder->push( $stack_app ); |
|
145 | + $request_stack_builder->unshift($stack_app); |
|
146 | + } |
|
147 | + return apply_filters( |
|
148 | + 'FHEE__EE_Bootstrap__build_request_stack__request_stack_builder', |
|
149 | + $request_stack_builder |
|
150 | + ); |
|
151 | + } |
|
152 | + |
|
153 | + |
|
154 | + |
|
155 | + /** |
|
156 | + * load_espresso_addons |
|
157 | + * runs during the WP 'plugins_loaded' action at priority 1 |
|
158 | + * and is the initial loading phase for EE addons |
|
159 | + * no other logic should be performed at this point |
|
160 | + */ |
|
161 | + public static function load_espresso_addons() |
|
162 | + { |
|
163 | + do_action('AHEE__EE_Bootstrap__load_espresso_addons'); |
|
164 | + } |
|
165 | + |
|
166 | + |
|
167 | + |
|
168 | + /** |
|
169 | + * detect_activations_or_upgrades |
|
170 | + * runs during the WP 'plugins_loaded' action at priority 3 |
|
171 | + * Now that all of the addons have been loaded, |
|
172 | + * we can determine if anything needs activating or upgrading |
|
173 | + */ |
|
174 | + public static function detect_activations_or_upgrades() |
|
175 | + { |
|
176 | + do_action('AHEE__EE_Bootstrap__detect_activations_or_upgrades'); |
|
177 | + } |
|
178 | + |
|
179 | + |
|
180 | + |
|
181 | + /** |
|
182 | + * load_core_configuration |
|
183 | + * runs during the WP 'plugins_loaded' action at priority 5 |
|
184 | + * Now that the database is assumed to be at the correct version |
|
185 | + * we can load and set all of the system configurations |
|
186 | + */ |
|
187 | + public static function load_core_configuration() |
|
188 | + { |
|
189 | + do_action('AHEE__EE_Bootstrap__load_core_configuration'); |
|
190 | + } |
|
191 | + |
|
192 | + |
|
193 | + |
|
194 | + /** |
|
195 | + * register_shortcodes_modules_and_widgets |
|
196 | + * runs during the WP 'plugins_loaded' action at priority 7 |
|
197 | + * and handles registering all o four shortcodes, modules and widgets |
|
198 | + * so that they are ready to be used throughout the system |
|
199 | + */ |
|
200 | + public static function register_shortcodes_modules_and_widgets() |
|
201 | + { |
|
202 | + do_action('AHEE__EE_Bootstrap__register_shortcodes_modules_and_widgets'); |
|
203 | + } |
|
204 | + |
|
205 | + |
|
206 | + |
|
207 | + /** |
|
208 | + * brew_espresso |
|
209 | + * runs during the WP 'plugins_loaded' action at priority 9 |
|
210 | + * bootstrapping is considered complete at this point, |
|
211 | + * so let the fun begin... |
|
212 | + */ |
|
213 | + public static function brew_espresso() |
|
214 | + { |
|
215 | + do_action('AHEE__EE_Bootstrap__brew_espresso'); |
|
216 | + } |
|
217 | 217 | |
218 | 218 | |
219 | 219 |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | // load interfaces |
97 | 97 | espresso_load_required( |
98 | 98 | 'EEH_Autoloader', |
99 | - EE_CORE . 'helpers' . DS . 'EEH_Autoloader.helper.php' |
|
99 | + EE_CORE.'helpers'.DS.'EEH_Autoloader.helper.php' |
|
100 | 100 | ); |
101 | 101 | EEH_Autoloader::instance(); |
102 | 102 | } |
@@ -111,13 +111,13 @@ discard block |
||
111 | 111 | protected function set_autoloaders_for_required_files() |
112 | 112 | { |
113 | 113 | // load interfaces |
114 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'interfaces', true); |
|
114 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE.'interfaces', true); |
|
115 | 115 | // load helpers |
116 | 116 | EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_HELPERS); |
117 | 117 | // load request stack |
118 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'request_stack' . DS); |
|
118 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE.'request_stack'.DS); |
|
119 | 119 | // load middleware |
120 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE . 'middleware' . DS); |
|
120 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE.'middleware'.DS); |
|
121 | 121 | } |
122 | 122 | |
123 | 123 | |
@@ -140,7 +140,7 @@ discard block |
||
140 | 140 | ) |
141 | 141 | ); |
142 | 142 | // load middleware onto stack : FILO (First In Last Out) |
143 | - foreach ((array)$stack_apps as $stack_app) { |
|
143 | + foreach ((array) $stack_apps as $stack_app) { |
|
144 | 144 | //$request_stack_builder->push( $stack_app ); |
145 | 145 | $request_stack_builder->unshift($stack_app); |
146 | 146 | } |