@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | /** |
@@ -13,7 +13,7 @@ discard block |
||
13 | 13 | * @author Mike Nelson |
14 | 14 | * |
15 | 15 | */ |
16 | -class EE_Restriction_Generator_Taxonomy_Protected extends EE_Restriction_Generator_Base{ |
|
16 | +class EE_Restriction_Generator_Taxonomy_Protected extends EE_Restriction_Generator_Base { |
|
17 | 17 | |
18 | 18 | /** |
19 | 19 | * Model chain/path to taxonomy model, including the term_taxonomy model itself |
@@ -24,28 +24,28 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @param string $path_to_taxonomy_model Model chain/path to taxonomy model, including the term_taxonomy model itself |
26 | 26 | */ |
27 | - public function __construct( $path_to_taxonomy_model ){ |
|
28 | - if( $path_to_taxonomy_model !== '' && substr( $path_to_taxonomy_model, -1, 1 ) != '.' ) { |
|
27 | + public function __construct($path_to_taxonomy_model) { |
|
28 | + if ($path_to_taxonomy_model !== '' && substr($path_to_taxonomy_model, -1, 1) != '.') { |
|
29 | 29 | $path_to_taxonomy_model .= '.'; |
30 | 30 | } |
31 | 31 | $this->_path_to_taxonomy_model = $path_to_taxonomy_model; |
32 | 32 | } |
33 | 33 | protected function _generate_restrictions() { |
34 | 34 | //if there are no standard caps for this model, then for allow full access |
35 | - if( ! $this->model()->cap_slug() ) { |
|
35 | + if ( ! $this->model()->cap_slug()) { |
|
36 | 36 | return array( |
37 | 37 | ); |
38 | 38 | } |
39 | 39 | |
40 | 40 | return array( |
41 | - 'ee_manage_event_categories' => new EE_Default_Where_Conditions( array( |
|
42 | - $this->_path_to_taxonomy_model . 'taxonomy*no_ee_manage_event_categories' => array( '!=', 'espresso_event_categories' ) |
|
41 | + 'ee_manage_event_categories' => new EE_Default_Where_Conditions(array( |
|
42 | + $this->_path_to_taxonomy_model.'taxonomy*no_ee_manage_event_categories' => array('!=', 'espresso_event_categories') |
|
43 | 43 | )), |
44 | - 'ee_manage_venue_categories' => new EE_Default_Where_Conditions( array( |
|
45 | - $this->_path_to_taxonomy_model . 'taxonomy*no_ee_manage_venue_categories' => array( '!=', 'espresso_venue_categories' ) |
|
44 | + 'ee_manage_venue_categories' => new EE_Default_Where_Conditions(array( |
|
45 | + $this->_path_to_taxonomy_model.'taxonomy*no_ee_manage_venue_categories' => array('!=', 'espresso_venue_categories') |
|
46 | 46 | )), |
47 | - 'ee_manage_event_types' => new EE_Default_Where_Conditions( array( |
|
48 | - $this->_path_to_taxonomy_model . 'taxonomy*ee_manage_event_types' => array( '!=', 'espresso_event_types' ) |
|
47 | + 'ee_manage_event_types' => new EE_Default_Where_Conditions(array( |
|
48 | + $this->_path_to_taxonomy_model.'taxonomy*ee_manage_event_types' => array('!=', 'espresso_event_types') |
|
49 | 49 | )), |
50 | 50 | ); |
51 | 51 | } |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | /** |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | * @author Mike Nelson |
16 | 16 | * |
17 | 17 | */ |
18 | -class EE_Restriction_Generator_WP_User extends EE_Restriction_Generator_Base{ |
|
18 | +class EE_Restriction_Generator_WP_User extends EE_Restriction_Generator_Base { |
|
19 | 19 | |
20 | 20 | /** |
21 | 21 | * @return \EE_Default_Where_Conditions |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | |
25 | 25 | return array( |
26 | 26 | //if they can't access users, they can still access themselves |
27 | - EE_Restriction_Generator_Base::get_cap_name( $this->model(), $this->action() ) => new EE_Default_Where_Conditions( array( |
|
27 | + EE_Restriction_Generator_Base::get_cap_name($this->model(), $this->action()) => new EE_Default_Where_Conditions(array( |
|
28 | 28 | EE_Default_Where_Conditions::user_field_name_placeholder => EE_Default_Where_Conditions::current_user_placeholder |
29 | 29 | )), |
30 | 30 |
@@ -1,6 +1,6 @@ discard block |
||
1 | 1 | <?php |
2 | -if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
3 | - exit( 'No direct script access allowed' ); |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
3 | + exit('No direct script access allowed'); |
|
4 | 4 | } |
5 | 5 | |
6 | 6 | /** |
@@ -14,12 +14,12 @@ discard block |
||
14 | 14 | * |
15 | 15 | */ |
16 | 16 | class EE_Return_None_Where_Conditions extends EE_Default_Where_Conditions { |
17 | - protected function _get_default_where_conditions(){ |
|
18 | - if( $this->_model->has_primary_key_field() ) { |
|
19 | - return array( $this->_model->primary_key_name() => array('<', 0 ) ); |
|
20 | - }else{ |
|
21 | - $fk_field = $this->_model->get_a_field_of_type( 'EE_Foreign_Key_Field_Base' ); |
|
22 | - return array( 'AND*impossible' => array( $fk_field->get_name() => array('IS_NULL'), $fk_field->get_name() => 'IS_NOT_NULL' ) ); |
|
17 | + protected function _get_default_where_conditions() { |
|
18 | + if ($this->_model->has_primary_key_field()) { |
|
19 | + return array($this->_model->primary_key_name() => array('<', 0)); |
|
20 | + } else { |
|
21 | + $fk_field = $this->_model->get_a_field_of_type('EE_Foreign_Key_Field_Base'); |
|
22 | + return array('AND*impossible' => array($fk_field->get_name() => array('IS_NULL'), $fk_field->get_name() => 'IS_NOT_NULL')); |
|
23 | 23 | } |
24 | 24 | } |
25 | 25 | } |
@@ -17,7 +17,7 @@ |
||
17 | 17 | protected function _get_default_where_conditions(){ |
18 | 18 | if( $this->_model->has_primary_key_field() ) { |
19 | 19 | return array( $this->_model->primary_key_name() => array('<', 0 ) ); |
20 | - }else{ |
|
20 | + } else{ |
|
21 | 21 | $fk_field = $this->_model->get_a_field_of_type( 'EE_Foreign_Key_Field_Base' ); |
22 | 22 | return array( 'AND*impossible' => array( $fk_field->get_name() => array('IS_NULL'), $fk_field->get_name() => 'IS_NOT_NULL' ) ); |
23 | 23 | } |
@@ -3,7 +3,7 @@ discard block |
||
3 | 3 | /* |
4 | 4 | * Strategy specifically for adding where conditions specific to CPT models. |
5 | 5 | */ |
6 | -class EE_Soft_Delete_Where_Conditions extends EE_Default_Where_Conditions{ |
|
6 | +class EE_Soft_Delete_Where_Conditions extends EE_Default_Where_Conditions { |
|
7 | 7 | /** |
8 | 8 | * Strategy for setting default soft delete where conditions. This strategy will find |
9 | 9 | * the field of type 'EE_Trashed_Flag_Field', and add a condition that it be FALSE on all queries involving |
@@ -12,12 +12,12 @@ discard block |
||
12 | 12 | * Eg, |
13 | 13 | * |
14 | 14 | */ |
15 | - function __construct(){} |
|
15 | + function __construct() {} |
|
16 | 16 | /** |
17 | 17 | * Gets the where default where conditions for a custom post type model |
18 | 18 | * @return array like EEM_Base::get_all's $query_params's index [0] (where conditions) |
19 | 19 | */ |
20 | - protected function _get_default_where_conditions(){ |
|
20 | + protected function _get_default_where_conditions() { |
|
21 | 21 | $trashed_field_name = $this->deleted_field_name(); |
22 | 22 | return array( |
23 | 23 | $trashed_field_name => false |
@@ -29,12 +29,12 @@ discard block |
||
29 | 29 | * @return string |
30 | 30 | * @throws EE_Error |
31 | 31 | */ |
32 | - private function deleted_field_name(){ |
|
32 | + private function deleted_field_name() { |
|
33 | 33 | $field = $this->_model->get_a_field_of_type('EE_Trashed_Flag_Field'); |
34 | - if($field){ |
|
34 | + if ($field) { |
|
35 | 35 | return $field->get_name(); |
36 | - }else{ |
|
37 | - throw new EE_Error(sprintf(__('We are trying to find the deleted flag field on %s, but none was found. Are you sure there is a field of type EE_Trashed_Flag_Field in %s constructor?','event_espresso'),get_class($this),get_class($this))); |
|
36 | + } else { |
|
37 | + throw new EE_Error(sprintf(__('We are trying to find the deleted flag field on %s, but none was found. Are you sure there is a field of type EE_Trashed_Flag_Field in %s constructor?', 'event_espresso'), get_class($this), get_class($this))); |
|
38 | 38 | } |
39 | 39 | } |
40 | 40 | } |
41 | 41 | \ No newline at end of file |
@@ -33,7 +33,7 @@ |
||
33 | 33 | $field = $this->_model->get_a_field_of_type('EE_Trashed_Flag_Field'); |
34 | 34 | if($field){ |
35 | 35 | return $field->get_name(); |
36 | - }else{ |
|
36 | + } else{ |
|
37 | 37 | throw new EE_Error(sprintf(__('We are trying to find the deleted flag field on %s, but none was found. Are you sure there is a field of type EE_Trashed_Flag_Field in %s constructor?','event_espresso'),get_class($this),get_class($this))); |
38 | 38 | } |
39 | 39 | } |
@@ -61,10 +61,10 @@ |
||
61 | 61 | $first_item = reset($arr); |
62 | 62 | if(is_array($first_item)){ |
63 | 63 | return true;//yep, there's at least 2 levels to this array |
64 | - }else{ |
|
64 | + } else{ |
|
65 | 65 | return false;//nope, only 1 level |
66 | 66 | } |
67 | - }else{ |
|
67 | + } else{ |
|
68 | 68 | return false;//its not an array at all! |
69 | 69 | } |
70 | 70 | } |
@@ -1,7 +1,7 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('NO direct script access allowed'); } |
3 | 3 | |
4 | -require_once( EE_HELPERS . 'EEH_Base.helper.php' ); |
|
4 | +require_once(EE_HELPERS.'EEH_Base.helper.php'); |
|
5 | 5 | |
6 | 6 | /** |
7 | 7 | * EE_Array |
@@ -26,8 +26,8 @@ discard block |
||
26 | 26 | * @param array $array2 an array of objects |
27 | 27 | * @return array an array of objects found in array 1 that aren't found in array 2. |
28 | 28 | */ |
29 | - public static function object_array_diff( $array1, $array2 ) { |
|
30 | - return array_udiff( $array1, $array2, array('self', '_compare_objects' )); |
|
29 | + public static function object_array_diff($array1, $array2) { |
|
30 | + return array_udiff($array1, $array2, array('self', '_compare_objects')); |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | /** |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | * @param array $arr |
36 | 36 | * @return boolean |
37 | 37 | */ |
38 | - public static function is_associative_array($arr){ |
|
38 | + public static function is_associative_array($arr) { |
|
39 | 39 | return array_keys($arr) !== range(0, count($arr) - 1); |
40 | 40 | } |
41 | 41 | |
@@ -45,7 +45,7 @@ discard block |
||
45 | 45 | * @param array $arr |
46 | 46 | * @return mixed what ever is in the array |
47 | 47 | */ |
48 | - public static function get_one_item_from_array($arr){ |
|
48 | + public static function get_one_item_from_array($arr) { |
|
49 | 49 | $item = end($arr); |
50 | 50 | reset($arr); |
51 | 51 | return $item; |
@@ -56,16 +56,16 @@ discard block |
||
56 | 56 | * @param mixed $arr |
57 | 57 | * @return boolean |
58 | 58 | */ |
59 | - public static function is_multi_dimensional_array($arr){ |
|
60 | - if(is_array($arr)){ |
|
59 | + public static function is_multi_dimensional_array($arr) { |
|
60 | + if (is_array($arr)) { |
|
61 | 61 | $first_item = reset($arr); |
62 | - if(is_array($first_item)){ |
|
63 | - return true;//yep, there's at least 2 levels to this array |
|
64 | - }else{ |
|
65 | - return false;//nope, only 1 level |
|
62 | + if (is_array($first_item)) { |
|
63 | + return true; //yep, there's at least 2 levels to this array |
|
64 | + } else { |
|
65 | + return false; //nope, only 1 level |
|
66 | 66 | } |
67 | - }else{ |
|
68 | - return false;//its not an array at all! |
|
67 | + } else { |
|
68 | + return false; //its not an array at all! |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 | |
@@ -76,8 +76,8 @@ discard block |
||
76 | 76 | * @param mixed $default |
77 | 77 | * @return mixed |
78 | 78 | */ |
79 | - public static function is_set( $arr, $index, $default ) { |
|
80 | - return isset( $arr[ $index ] ) ? $arr[ $index ] : $default; |
|
79 | + public static function is_set($arr, $index, $default) { |
|
80 | + return isset($arr[$index]) ? $arr[$index] : $default; |
|
81 | 81 | } |
82 | 82 | |
83 | 83 | } //end EEH_Template class |
84 | 84 | \ No newline at end of file |
@@ -23,10 +23,10 @@ |
||
23 | 23 | private static $_instance = NULL; |
24 | 24 | |
25 | 25 | /** |
26 | - * $_autoloaders |
|
27 | - * @var array $_autoloaders |
|
28 | - * @access private |
|
29 | - */ |
|
26 | + * $_autoloaders |
|
27 | + * @var array $_autoloaders |
|
28 | + * @access private |
|
29 | + */ |
|
30 | 30 | private static $_autoloaders; |
31 | 31 | |
32 | 32 |
@@ -1,6 +1,7 @@ |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if (!defined('EVENT_ESPRESSO_VERSION') ) { |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | +} |
|
4 | 5 | |
5 | 6 | /** |
6 | 7 | * EEH_Autoloader |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -38,7 +38,7 @@ discard block |
||
38 | 38 | */ |
39 | 39 | public static function instance() { |
40 | 40 | // check if class object is instantiated, and instantiated properly |
41 | - if ( ! self::$_instance instanceof EEH_Autoloader ) { |
|
41 | + if ( ! self::$_instance instanceof EEH_Autoloader) { |
|
42 | 42 | self::$_instance = new self(); |
43 | 43 | } |
44 | 44 | return self::$_instance; |
@@ -55,7 +55,7 @@ discard block |
||
55 | 55 | private function __construct() { |
56 | 56 | self::$_autoloaders = array(); |
57 | 57 | $this->_register_custom_autoloaders(); |
58 | - spl_autoload_register( array( $this, 'espresso_autoloader' )); |
|
58 | + spl_autoload_register(array($this, 'espresso_autoloader')); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | * @internal param string $class_name - simple class name ie: session |
70 | 70 | * @return void |
71 | 71 | */ |
72 | - public static function espresso_autoloader( $class_name ) { |
|
73 | - if ( isset( self::$_autoloaders[ $class_name ] ) ) { |
|
74 | - require_once( self::$_autoloaders[ $class_name ] ); |
|
72 | + public static function espresso_autoloader($class_name) { |
|
73 | + if (isset(self::$_autoloaders[$class_name])) { |
|
74 | + require_once(self::$_autoloaders[$class_name]); |
|
75 | 75 | } |
76 | 76 | } |
77 | 77 | |
@@ -86,23 +86,23 @@ discard block |
||
86 | 86 | * @throws \EE_Error |
87 | 87 | * @return void |
88 | 88 | */ |
89 | - public static function register_autoloader( $class_paths, $read_check = true ) { |
|
90 | - $class_paths = is_array( $class_paths ) ? $class_paths : array( $class_paths ); |
|
91 | - foreach ( $class_paths as $class => $path ) { |
|
89 | + public static function register_autoloader($class_paths, $read_check = true) { |
|
90 | + $class_paths = is_array($class_paths) ? $class_paths : array($class_paths); |
|
91 | + foreach ($class_paths as $class => $path) { |
|
92 | 92 | // don't give up! you gotta... |
93 | 93 | // get some class |
94 | - if ( empty( $class )) { |
|
95 | - throw new EE_Error ( sprintf( __( 'No Class name was specified while registering an autoloader for the following path: %s.','event_espresso' ), $path )); |
|
94 | + if (empty($class)) { |
|
95 | + throw new EE_Error(sprintf(__('No Class name was specified while registering an autoloader for the following path: %s.', 'event_espresso'), $path)); |
|
96 | 96 | } |
97 | 97 | // one day you will find the path young grasshopper |
98 | - if ( empty( $path )) { |
|
99 | - throw new EE_Error ( sprintf( __( 'No path was specified while registering an autoloader for the %s class.','event_espresso' ), $class )); |
|
98 | + if (empty($path)) { |
|
99 | + throw new EE_Error(sprintf(__('No path was specified while registering an autoloader for the %s class.', 'event_espresso'), $class)); |
|
100 | 100 | } |
101 | 101 | // is file readable ? |
102 | - if ( $read_check && ! is_readable( $path )) { |
|
103 | - throw new EE_Error ( sprintf( __( 'The file for the %s class could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s','event_espresso' ), $class, $path )); |
|
102 | + if ($read_check && ! is_readable($path)) { |
|
103 | + throw new EE_Error(sprintf(__('The file for the %s class could not be found or is not readable due to file permissions. Please ensure the following path is correct: %s', 'event_espresso'), $class, $path)); |
|
104 | 104 | } |
105 | - self::$_autoloaders[ $class ] = str_replace( array( '\/', '/' ), DS, $path ); |
|
105 | + self::$_autoloaders[$class] = str_replace(array('\/', '/'), DS, $path); |
|
106 | 106 | } |
107 | 107 | } |
108 | 108 | |
@@ -129,9 +129,9 @@ discard block |
||
129 | 129 | * @return void |
130 | 130 | */ |
131 | 131 | private function _register_custom_autoloaders() { |
132 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_CORE ); |
|
133 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_MODELS, TRUE ); |
|
134 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_CLASSES ); |
|
132 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CORE); |
|
133 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_MODELS, TRUE); |
|
134 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_CLASSES); |
|
135 | 135 | EEH_Autoloader::register_form_sections_autoloaders(); |
136 | 136 | } |
137 | 137 | |
@@ -145,7 +145,7 @@ discard block |
||
145 | 145 | * @return void |
146 | 146 | */ |
147 | 147 | public static function register_form_sections_autoloaders() { |
148 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_FORM_SECTIONS, TRUE ); |
|
148 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_FORM_SECTIONS, TRUE); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | * @return void |
159 | 159 | */ |
160 | 160 | public static function register_line_item_display_autoloaders() { |
161 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( EE_LIBRARIES . 'line_item_display' , TRUE ); |
|
161 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder(EE_LIBRARIES.'line_item_display', TRUE); |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | |
@@ -173,31 +173,31 @@ discard block |
||
173 | 173 | * @param bool $recursive |
174 | 174 | * @return array |
175 | 175 | */ |
176 | - public static function register_autoloaders_for_each_file_in_folder( $folder, $recursive = FALSE ){ |
|
176 | + public static function register_autoloaders_for_each_file_in_folder($folder, $recursive = FALSE) { |
|
177 | 177 | // make sure last char is a / |
178 | - $folder .= $folder[strlen($folder)-1] != DS ? DS : ''; |
|
178 | + $folder .= $folder[strlen($folder) - 1] != DS ? DS : ''; |
|
179 | 179 | $class_to_filepath_map = array(); |
180 | - $exclude = array( 'index' ); |
|
180 | + $exclude = array('index'); |
|
181 | 181 | //get all the files in that folder that end in php |
182 | - $filepaths = glob( $folder.'*'); |
|
182 | + $filepaths = glob($folder.'*'); |
|
183 | 183 | |
184 | - if ( empty( $filepaths ) ) { |
|
184 | + if (empty($filepaths)) { |
|
185 | 185 | return; |
186 | 186 | } |
187 | 187 | |
188 | - foreach( $filepaths as $filepath ) { |
|
189 | - if ( substr( $filepath, -4, 4 ) == '.php' ) { |
|
190 | - $class_name = EEH_File::get_classname_from_filepath_with_standard_filename( $filepath ); |
|
191 | - if ( ! in_array( $class_name, $exclude )) { |
|
192 | - $class_to_filepath_map [ $class_name ] = str_replace( array( '\/', '/' ), DS, $filepath ); |
|
188 | + foreach ($filepaths as $filepath) { |
|
189 | + if (substr($filepath, -4, 4) == '.php') { |
|
190 | + $class_name = EEH_File::get_classname_from_filepath_with_standard_filename($filepath); |
|
191 | + if ( ! in_array($class_name, $exclude)) { |
|
192 | + $class_to_filepath_map [$class_name] = str_replace(array('\/', '/'), DS, $filepath); |
|
193 | 193 | } |
194 | - } else if ( $recursive ) { |
|
195 | - EEH_Autoloader::register_autoloaders_for_each_file_in_folder( $filepath, $recursive ); |
|
194 | + } else if ($recursive) { |
|
195 | + EEH_Autoloader::register_autoloaders_for_each_file_in_folder($filepath, $recursive); |
|
196 | 196 | } |
197 | 197 | } |
198 | 198 | |
199 | 199 | //we remove the necessity to do a is_readable() check via the $read_check flag because glob by nature will not return non_readable files/directories. |
200 | - self::register_autoloader($class_to_filepath_map, FALSE ); |
|
200 | + self::register_autoloader($class_to_filepath_map, FALSE); |
|
201 | 201 | } |
202 | 202 | |
203 | 203 |
@@ -33,7 +33,7 @@ |
||
33 | 33 | * @ override magic methods |
34 | 34 | * @ return void |
35 | 35 | */ |
36 | - public function __set($a,$b) { return FALSE; } |
|
36 | + public function __set($a, $b) { return FALSE; } |
|
37 | 37 | public function __get($a) { return FALSE; } |
38 | 38 | public function __isset($a) { return FALSE; } |
39 | 39 | public function __unset($a) { return FALSE; } |
@@ -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 | * Event Espresso |
4 | 6 | * |
@@ -35,35 +35,35 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public static function get_called_class() { |
37 | 37 | $backtrace = debug_backtrace(); |
38 | - if ( isset( $backtrace[2] ) && is_array( $backtrace[2] ) && isset( $backtrace[2]['class'] ) && ! isset( $backtrace[2]['file'] )) { |
|
38 | + if (isset($backtrace[2]) && is_array($backtrace[2]) && isset($backtrace[2]['class']) && ! isset($backtrace[2]['file'])) { |
|
39 | 39 | return $backtrace[2]['class']; |
40 | - } else if ( isset( $backtrace[3] ) && is_array( $backtrace[3] ) && isset( $backtrace[3]['class'] ) && ! isset( $backtrace[3]['file'] )) { |
|
40 | + } else if (isset($backtrace[3]) && is_array($backtrace[3]) && isset($backtrace[3]['class']) && ! isset($backtrace[3]['file'])) { |
|
41 | 41 | return $backtrace[3]['class']; |
42 | - } else if ( isset( $backtrace[2] ) && is_array( $backtrace[2] ) && isset( $backtrace[2]['file'] ) && isset( $backtrace[2]['line'] )) { |
|
43 | - if ( self::$file_line == $backtrace[2]['file'] . $backtrace[2]['line'] ) { |
|
42 | + } else if (isset($backtrace[2]) && is_array($backtrace[2]) && isset($backtrace[2]['file']) && isset($backtrace[2]['line'])) { |
|
43 | + if (self::$file_line == $backtrace[2]['file'].$backtrace[2]['line']) { |
|
44 | 44 | self::$i++; |
45 | 45 | } else { |
46 | 46 | self::$i = 0; |
47 | - self::$file_line = $backtrace[2]['file'] . $backtrace[2]['line']; |
|
47 | + self::$file_line = $backtrace[2]['file'].$backtrace[2]['line']; |
|
48 | 48 | } |
49 | 49 | // was class method called via call_user_func ? |
50 | - if ( $backtrace[2]['function'] == 'call_user_func' && isset( $backtrace[2]['args'] ) && is_array( $backtrace[2]['args'] )){ |
|
51 | - if ( isset( $backtrace[2]['args'][0] ) && isset( $backtrace[2]['args'][0][0] )) { |
|
50 | + if ($backtrace[2]['function'] == 'call_user_func' && isset($backtrace[2]['args']) && is_array($backtrace[2]['args'])) { |
|
51 | + if (isset($backtrace[2]['args'][0]) && isset($backtrace[2]['args'][0][0])) { |
|
52 | 52 | $called_class = $backtrace[2]['args'][0][0]; |
53 | 53 | // is it an EE function ? |
54 | - if ( strpos( $called_class, 'EE' ) === 0 ) { |
|
55 | - $prefix_chars = strpos( $called_class, '_' ) + 1; |
|
56 | - $prefix = substr( $called_class, 0, $prefix_chars ); |
|
57 | - $classname = substr( $called_class, $prefix_chars, strlen( $called_class )); |
|
58 | - $classname = $prefix . str_replace( ' ', '_', ucwords( strtolower( str_replace( '_', ' ', $classname )))); |
|
54 | + if (strpos($called_class, 'EE') === 0) { |
|
55 | + $prefix_chars = strpos($called_class, '_') + 1; |
|
56 | + $prefix = substr($called_class, 0, $prefix_chars); |
|
57 | + $classname = substr($called_class, $prefix_chars, strlen($called_class)); |
|
58 | + $classname = $prefix.str_replace(' ', '_', ucwords(strtolower(str_replace('_', ' ', $classname)))); |
|
59 | 59 | return $classname; |
60 | 60 | } |
61 | 61 | } |
62 | 62 | } else { |
63 | - $lines = file( $backtrace[2]['file'] ); |
|
64 | - preg_match_all( '/([a-zA-Z0-9\_]+)::' . $backtrace[2]['function'] . '/', $lines[$backtrace[2]['line']-1], $matches ); |
|
65 | - if ( isset( $matches[1] ) && isset( $matches[1][ self::$i ] )) { |
|
66 | - return $matches[1][ self::$i ]; |
|
63 | + $lines = file($backtrace[2]['file']); |
|
64 | + preg_match_all('/([a-zA-Z0-9\_]+)::'.$backtrace[2]['function'].'/', $lines[$backtrace[2]['line'] - 1], $matches); |
|
65 | + if (isset($matches[1]) && isset($matches[1][self::$i])) { |
|
66 | + return $matches[1][self::$i]; |
|
67 | 67 | } |
68 | 68 | } |
69 | 69 | } |
@@ -80,22 +80,22 @@ discard block |
||
80 | 80 | * @param string $hook |
81 | 81 | * @return array |
82 | 82 | */ |
83 | - public static function get_class_names_for_all_callbacks_on_hook( $hook = NULL ) { |
|
83 | + public static function get_class_names_for_all_callbacks_on_hook($hook = NULL) { |
|
84 | 84 | global $wp_filter; |
85 | 85 | $class_names = array(); |
86 | 86 | // are any callbacks registered for this hook ? |
87 | - if ( isset( $wp_filter[ $hook ] )) { |
|
87 | + if (isset($wp_filter[$hook])) { |
|
88 | 88 | // loop thru all of the callbacks attached to the deprecated hookpoint |
89 | - foreach( $wp_filter[ $hook ] as $priority ) { |
|
90 | - foreach( $priority as $callback ) { |
|
89 | + foreach ($wp_filter[$hook] as $priority) { |
|
90 | + foreach ($priority as $callback) { |
|
91 | 91 | // is the callback a non-static class method ? |
92 | - if ( isset( $callback['function'] ) && is_array( $callback['function'] )) { |
|
93 | - if ( isset( $callback['function'][0] ) && is_object( $callback['function'][0] )) { |
|
94 | - $class_names[] = get_class( $callback['function'][0] ); |
|
92 | + if (isset($callback['function']) && is_array($callback['function'])) { |
|
93 | + if (isset($callback['function'][0]) && is_object($callback['function'][0])) { |
|
94 | + $class_names[] = get_class($callback['function'][0]); |
|
95 | 95 | } |
96 | 96 | // test for static method |
97 | - } else if ( strpos( $callback['function'], '::' ) !== FALSE ) { |
|
98 | - $class = explode( '::', $callback['function'] ); |
|
97 | + } else if (strpos($callback['function'], '::') !== FALSE) { |
|
98 | + $class = explode('::', $callback['function']); |
|
99 | 99 | $class_names[] = $class[0]; |
100 | 100 | } else { |
101 | 101 | // just a function |
@@ -116,24 +116,24 @@ discard block |
||
116 | 116 | * @param string $property |
117 | 117 | * @return boolean |
118 | 118 | */ |
119 | - public static function has_property( $class = NULL, $property = NULL ) { |
|
119 | + public static function has_property($class = NULL, $property = NULL) { |
|
120 | 120 | // if $class or $property don't exist, then get out, cuz that would be like... fatal dude |
121 | - if ( empty( $class ) || empty( $property )) { |
|
121 | + if (empty($class) || empty($property)) { |
|
122 | 122 | return FALSE; |
123 | 123 | } |
124 | 124 | // if your hosting company doesn't cut the mustard |
125 | - if ( version_compare( PHP_VERSION, '5.3.0' ) < 0 ) { |
|
125 | + if (version_compare(PHP_VERSION, '5.3.0') < 0) { |
|
126 | 126 | // just in case $class is an actual instantiated object |
127 | - if ( is_object( $class )) { |
|
128 | - return isset( $class->$property ) ? TRUE : FALSE; |
|
127 | + if (is_object($class)) { |
|
128 | + return isset($class->$property) ? TRUE : FALSE; |
|
129 | 129 | } else { |
130 | 130 | // use reflection for < PHP 5.3 to get details using just the class name |
131 | - $reflector = new ReflectionClass( $class ); |
|
132 | - return $reflector->hasProperty( $property ); |
|
131 | + $reflector = new ReflectionClass($class); |
|
132 | + return $reflector->hasProperty($property); |
|
133 | 133 | } |
134 | 134 | } else { |
135 | 135 | // or try regular property exists method which works as expected in PHP 5.3+ |
136 | - return property_exists( $class, $property ); |
|
136 | + return property_exists($class, $property); |
|
137 | 137 | } |
138 | 138 | } |
139 | 139 | |
@@ -143,7 +143,7 @@ discard block |
||
143 | 143 | |
144 | 144 | |
145 | 145 | // if PHP version < 5.3 |
146 | -if ( ! function_exists( 'get_called_class' )) { |
|
146 | +if ( ! function_exists('get_called_class')) { |
|
147 | 147 | /** |
148 | 148 | * @return bool|string |
149 | 149 | */ |
@@ -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 | * Event Espresso |
4 | 6 | * |
@@ -1,4 +1,6 @@ discard block |
||
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 | * Class EEH_Debug_Tools |
4 | 6 | * |
@@ -122,8 +124,7 @@ discard block |
||
122 | 124 | return; |
123 | 125 | } |
124 | 126 | echo '<h5>For Tag: '. $tag .'</h5>'; |
125 | - } |
|
126 | - else { |
|
127 | + } else { |
|
127 | 128 | $hook=$wp_filter; |
128 | 129 | ksort( $hook ); |
129 | 130 | } |
@@ -183,7 +184,7 @@ discard block |
||
183 | 184 | if( isset( $this->_start_times[ $timer_name ] ) ){ |
184 | 185 | $start_time = $this->_start_times[ $timer_name ]; |
185 | 186 | unset( $this->_start_times[ $timer_name ] ); |
186 | - }else{ |
|
187 | + } else{ |
|
187 | 188 | $start_time = array_pop( $this->_start_times ); |
188 | 189 | } |
189 | 190 | $total_time = microtime( TRUE ) - $start_time; |
@@ -8,7 +8,7 @@ discard block |
||
8 | 8 | * @since 4.0 |
9 | 9 | * |
10 | 10 | */ |
11 | -class EEH_Debug_Tools{ |
|
11 | +class EEH_Debug_Tools { |
|
12 | 12 | |
13 | 13 | /** |
14 | 14 | * instance of the EEH_Autoloader object |
@@ -35,7 +35,7 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public static function instance() { |
37 | 37 | // check if class object is instantiated, and instantiated properly |
38 | - if ( ! self::$_instance instanceof EEH_Debug_Tools ) { |
|
38 | + if ( ! self::$_instance instanceof EEH_Debug_Tools) { |
|
39 | 39 | self::$_instance = new self(); |
40 | 40 | } |
41 | 41 | return self::$_instance; |
@@ -51,19 +51,19 @@ discard block |
||
51 | 51 | */ |
52 | 52 | private function __construct() { |
53 | 53 | // load Kint PHP debugging library |
54 | - if ( ! class_exists( 'Kint' ) && file_exists( EE_PLUGIN_DIR_PATH . 'tests' . DS . 'kint' . DS . 'Kint.class.php' )){ |
|
54 | + if ( ! class_exists('Kint') && file_exists(EE_PLUGIN_DIR_PATH.'tests'.DS.'kint'.DS.'Kint.class.php')) { |
|
55 | 55 | // despite EE4 having a check for an existing copy of the Kint debugging class, |
56 | 56 | // if another plugin was loaded AFTER EE4 and they did NOT perform a similar check, |
57 | 57 | // then hilarity would ensue as PHP throws a "Cannot redeclare class Kint" error |
58 | 58 | // so we've moved it to our test folder so that it is not included with production releases |
59 | 59 | // plz use https://wordpress.org/plugins/kint-debugger/ if testing production versions of EE |
60 | - require_once( EE_PLUGIN_DIR_PATH . 'tests' . DS . 'kint' . DS . 'Kint.class.php' ); |
|
60 | + require_once(EE_PLUGIN_DIR_PATH.'tests'.DS.'kint'.DS.'Kint.class.php'); |
|
61 | 61 | } |
62 | - if ( ! defined('DOING_AJAX') || ! isset( $_REQUEST['noheader'] ) || $_REQUEST['noheader'] != 'true' || ! isset( $_REQUEST['TB_iframe'] )) { |
|
62 | + if ( ! defined('DOING_AJAX') || ! isset($_REQUEST['noheader']) || $_REQUEST['noheader'] != 'true' || ! isset($_REQUEST['TB_iframe'])) { |
|
63 | 63 | //add_action( 'shutdown', array($this,'espresso_session_footer_dump') ); |
64 | 64 | } |
65 | - add_action( 'activated_plugin', array( 'EEH_Debug_Tools', 'ee_plugin_activation_errors' )); |
|
66 | - add_action( 'shutdown', array( 'EEH_Debug_Tools', 'show_db_name' )); |
|
65 | + add_action('activated_plugin', array('EEH_Debug_Tools', 'ee_plugin_activation_errors')); |
|
66 | + add_action('shutdown', array('EEH_Debug_Tools', 'show_db_name')); |
|
67 | 67 | } |
68 | 68 | |
69 | 69 | |
@@ -74,8 +74,8 @@ discard block |
||
74 | 74 | * @return void |
75 | 75 | */ |
76 | 76 | public static function show_db_name() { |
77 | - if ( ! defined( 'DOING_AJAX' ) && ( defined( 'EE_ERROR_EMAILS' ) && EE_ERROR_EMAILS )) { |
|
78 | - echo '<p style="font-size:10px;font-weight:normal;color:#E76700;margin: 1em 2em; text-align: right;">DB_NAME: '. DB_NAME .'</p>'; |
|
77 | + if ( ! defined('DOING_AJAX') && (defined('EE_ERROR_EMAILS') && EE_ERROR_EMAILS)) { |
|
78 | + echo '<p style="font-size:10px;font-weight:normal;color:#E76700;margin: 1em 2em; text-align: right;">DB_NAME: '.DB_NAME.'</p>'; |
|
79 | 79 | } |
80 | 80 | } |
81 | 81 | |
@@ -87,9 +87,9 @@ discard block |
||
87 | 87 | * @return void |
88 | 88 | */ |
89 | 89 | public function espresso_session_footer_dump() { |
90 | - if ( class_exists('Kint') && function_exists( 'wp_get_current_user' ) && current_user_can('update_core') && ( defined('WP_DEBUG') && WP_DEBUG ) && ! defined('DOING_AJAX') && class_exists( 'EE_Registry' )) { |
|
91 | - Kint::dump( EE_Registry::instance()->SSN->id() ); |
|
92 | - Kint::dump( EE_Registry::instance()->SSN ); |
|
90 | + if (class_exists('Kint') && function_exists('wp_get_current_user') && current_user_can('update_core') && (defined('WP_DEBUG') && WP_DEBUG) && ! defined('DOING_AJAX') && class_exists('EE_Registry')) { |
|
91 | + Kint::dump(EE_Registry::instance()->SSN->id()); |
|
92 | + Kint::dump(EE_Registry::instance()->SSN); |
|
93 | 93 | // Kint::dump( EE_Registry::instance()->SSN->get_session_data('cart')->get_tickets() ); |
94 | 94 | $this->espresso_list_hooked_functions(); |
95 | 95 | $this->show_times(); |
@@ -106,27 +106,27 @@ discard block |
||
106 | 106 | * @param bool $tag |
107 | 107 | * @return void |
108 | 108 | */ |
109 | - public function espresso_list_hooked_functions( $tag=FALSE ){ |
|
109 | + public function espresso_list_hooked_functions($tag = FALSE) { |
|
110 | 110 | global $wp_filter; |
111 | 111 | echo '<br/><br/><br/><h3>Hooked Functions</h3>'; |
112 | - if ( $tag ) { |
|
113 | - $hook[$tag]=$wp_filter[$tag]; |
|
114 | - if ( ! is_array( $hook[$tag] )) { |
|
115 | - trigger_error( "Nothing found for '$tag' hook", E_USER_WARNING ); |
|
112 | + if ($tag) { |
|
113 | + $hook[$tag] = $wp_filter[$tag]; |
|
114 | + if ( ! is_array($hook[$tag])) { |
|
115 | + trigger_error("Nothing found for '$tag' hook", E_USER_WARNING); |
|
116 | 116 | return; |
117 | 117 | } |
118 | - echo '<h5>For Tag: '. $tag .'</h5>'; |
|
118 | + echo '<h5>For Tag: '.$tag.'</h5>'; |
|
119 | 119 | } |
120 | 120 | else { |
121 | - $hook=$wp_filter; |
|
122 | - ksort( $hook ); |
|
121 | + $hook = $wp_filter; |
|
122 | + ksort($hook); |
|
123 | 123 | } |
124 | - foreach( $hook as $tag => $priorities ) { |
|
124 | + foreach ($hook as $tag => $priorities) { |
|
125 | 125 | echo "<br />>>>>>\t<strong>$tag</strong><br />"; |
126 | - ksort( $priorities ); |
|
127 | - foreach( $priorities as $priority => $function ){ |
|
126 | + ksort($priorities); |
|
127 | + foreach ($priorities as $priority => $function) { |
|
128 | 128 | echo $priority; |
129 | - foreach( $function as $name => $properties ) { |
|
129 | + foreach ($function as $name => $properties) { |
|
130 | 130 | echo "\t$name<br />"; |
131 | 131 | } |
132 | 132 | } |
@@ -142,15 +142,15 @@ discard block |
||
142 | 142 | * @param string $hook_name |
143 | 143 | * @return array |
144 | 144 | */ |
145 | - public static function registered_filter_callbacks( $hook_name = '' ) { |
|
145 | + public static function registered_filter_callbacks($hook_name = '') { |
|
146 | 146 | $filters = array(); |
147 | 147 | global $wp_filter; |
148 | - if ( isset( $wp_filter[ $hook_name ] ) ) { |
|
149 | - $filters[ $hook_name ] = array(); |
|
150 | - foreach ( $wp_filter[ $hook_name ] as $priority => $callbacks ) { |
|
151 | - $filters[ $hook_name ][ $priority ] = array(); |
|
152 | - foreach ( $callbacks as $callback ) { |
|
153 | - $filters[ $hook_name ][ $priority ][] = $callback['function']; |
|
148 | + if (isset($wp_filter[$hook_name])) { |
|
149 | + $filters[$hook_name] = array(); |
|
150 | + foreach ($wp_filter[$hook_name] as $priority => $callbacks) { |
|
151 | + $filters[$hook_name][$priority] = array(); |
|
152 | + foreach ($callbacks as $callback) { |
|
153 | + $filters[$hook_name][$priority][] = $callback['function']; |
|
154 | 154 | } |
155 | 155 | } |
156 | 156 | } |
@@ -163,8 +163,8 @@ discard block |
||
163 | 163 | * start_timer |
164 | 164 | * @param null $timer_name |
165 | 165 | */ |
166 | - public function start_timer( $timer_name = NULL ){ |
|
167 | - $this->_start_times[$timer_name] = microtime( TRUE ); |
|
166 | + public function start_timer($timer_name = NULL) { |
|
167 | + $this->_start_times[$timer_name] = microtime(TRUE); |
|
168 | 168 | } |
169 | 169 | |
170 | 170 | |
@@ -173,15 +173,15 @@ discard block |
||
173 | 173 | * stop_timer |
174 | 174 | * @param string $timer_name |
175 | 175 | */ |
176 | - public function stop_timer($timer_name = 'default'){ |
|
177 | - if( isset( $this->_start_times[ $timer_name ] ) ){ |
|
178 | - $start_time = $this->_start_times[ $timer_name ]; |
|
179 | - unset( $this->_start_times[ $timer_name ] ); |
|
180 | - }else{ |
|
181 | - $start_time = array_pop( $this->_start_times ); |
|
176 | + public function stop_timer($timer_name = 'default') { |
|
177 | + if (isset($this->_start_times[$timer_name])) { |
|
178 | + $start_time = $this->_start_times[$timer_name]; |
|
179 | + unset($this->_start_times[$timer_name]); |
|
180 | + } else { |
|
181 | + $start_time = array_pop($this->_start_times); |
|
182 | 182 | } |
183 | - $total_time = microtime( TRUE ) - $start_time; |
|
184 | - switch ( $total_time ) { |
|
183 | + $total_time = microtime(TRUE) - $start_time; |
|
184 | + switch ($total_time) { |
|
185 | 185 | case $total_time < 0.00001 : |
186 | 186 | $color = '#8A549A'; |
187 | 187 | $bold = 'normal'; |
@@ -207,7 +207,7 @@ discard block |
||
207 | 207 | $bold = 'bold'; |
208 | 208 | break; |
209 | 209 | } |
210 | - $this->_times[] = '<hr /><div style="display: inline-block; min-width: 10px; margin:0em 1em; color:'.$color.'; font-weight:'.$bold.'; font-size:1.2em;">' . number_format( $total_time, 8 ) . '</div> ' . $timer_name; |
|
210 | + $this->_times[] = '<hr /><div style="display: inline-block; min-width: 10px; margin:0em 1em; color:'.$color.'; font-weight:'.$bold.'; font-size:1.2em;">'.number_format($total_time, 8).'</div> '.$timer_name; |
|
211 | 211 | } |
212 | 212 | |
213 | 213 | |
@@ -217,12 +217,12 @@ discard block |
||
217 | 217 | * @param bool $output_now |
218 | 218 | * @return string |
219 | 219 | */ |
220 | - public function show_times($output_now=true){ |
|
221 | - if($output_now){ |
|
222 | - echo implode("<br>",$this->_times); |
|
220 | + public function show_times($output_now = true) { |
|
221 | + if ($output_now) { |
|
222 | + echo implode("<br>", $this->_times); |
|
223 | 223 | return ''; |
224 | 224 | } |
225 | - return implode("<br>",$this->_times); |
|
225 | + return implode("<br>", $this->_times); |
|
226 | 226 | } |
227 | 227 | |
228 | 228 | |
@@ -233,27 +233,27 @@ discard block |
||
233 | 233 | * @return void |
234 | 234 | */ |
235 | 235 | public static function ee_plugin_activation_errors() { |
236 | - if ( defined('WP_DEBUG') && WP_DEBUG ) { |
|
236 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
237 | 237 | $activation_errors = ob_get_contents(); |
238 | - if ( class_exists( 'EE_Registry' )) { |
|
239 | - EE_Registry::instance()->load_helper( 'File' ); |
|
238 | + if (class_exists('EE_Registry')) { |
|
239 | + EE_Registry::instance()->load_helper('File'); |
|
240 | 240 | } else { |
241 | - include_once( EE_HELPERS . 'EEH_File.helper.php' ); |
|
241 | + include_once(EE_HELPERS.'EEH_File.helper.php'); |
|
242 | 242 | } |
243 | - if ( class_exists( 'EEH_File' )) { |
|
243 | + if (class_exists('EEH_File')) { |
|
244 | 244 | try { |
245 | - EEH_File::ensure_folder_exists_and_is_writable( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS ); |
|
246 | - EEH_File::ensure_file_exists_and_is_writable( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . 'espresso_plugin_activation_errors.html' ); |
|
247 | - EEH_File::write_to_file( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . 'espresso_plugin_activation_errors.html', $activation_errors ); |
|
248 | - } catch( EE_Error $e ){ |
|
249 | - EE_Error::add_error( sprintf( __( 'The Event Espresso activation errors file could not be setup because: %s', 'event_espresso' ), $e->getMessage() )); |
|
245 | + EEH_File::ensure_folder_exists_and_is_writable(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS); |
|
246 | + EEH_File::ensure_file_exists_and_is_writable(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.'espresso_plugin_activation_errors.html'); |
|
247 | + EEH_File::write_to_file(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.'espresso_plugin_activation_errors.html', $activation_errors); |
|
248 | + } catch (EE_Error $e) { |
|
249 | + EE_Error::add_error(sprintf(__('The Event Espresso activation errors file could not be setup because: %s', 'event_espresso'), $e->getMessage())); |
|
250 | 250 | } |
251 | 251 | } else { |
252 | 252 | // old school attempt |
253 | - file_put_contents( EVENT_ESPRESSO_UPLOAD_DIR . 'logs' . DS . 'espresso_plugin_activation_errors.html', $activation_errors ); |
|
253 | + file_put_contents(EVENT_ESPRESSO_UPLOAD_DIR.'logs'.DS.'espresso_plugin_activation_errors.html', $activation_errors); |
|
254 | 254 | } |
255 | - $activation_errors = get_option( 'ee_plugin_activation_errors', '' ) . $activation_errors; |
|
256 | - update_option( 'ee_plugin_activation_errors', $activation_errors ); |
|
255 | + $activation_errors = get_option('ee_plugin_activation_errors', '').$activation_errors; |
|
256 | + update_option('ee_plugin_activation_errors', $activation_errors); |
|
257 | 257 | } |
258 | 258 | } |
259 | 259 | |
@@ -268,10 +268,10 @@ discard block |
||
268 | 268 | * @param string $version The version of Event Espresso where the error was added |
269 | 269 | * @uses trigger_error() |
270 | 270 | */ |
271 | - public function doing_it_wrong( $function, $message, $version ) { |
|
272 | - do_action( 'AHEE__EEH_Debug_Tools__doing_it_wrong_run', $function, $message, $version); |
|
273 | - $version = is_null( $version ) ? '' : sprintf( __('(This message was added in version %s of Event Espresso.', 'event_espresso' ), $version ); |
|
274 | - trigger_error( sprintf( __('%1$s was called <strong>incorrectly</strong>. %2$s %3$s','event_espresso' ), $function, $message, $version ), E_USER_DEPRECATED ); |
|
271 | + public function doing_it_wrong($function, $message, $version) { |
|
272 | + do_action('AHEE__EEH_Debug_Tools__doing_it_wrong_run', $function, $message, $version); |
|
273 | + $version = is_null($version) ? '' : sprintf(__('(This message was added in version %s of Event Espresso.', 'event_espresso'), $version); |
|
274 | + trigger_error(sprintf(__('%1$s was called <strong>incorrectly</strong>. %2$s %3$s', 'event_espresso'), $function, $message, $version), E_USER_DEPRECATED); |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | |
@@ -292,22 +292,22 @@ discard block |
||
292 | 292 | * @param string $debug_index |
293 | 293 | * @param string $debug_key |
294 | 294 | */ |
295 | - public static function log( $class='', $func = '', $line = '', $info = array(), $display_request = false, $debug_index = '', $debug_key = 'EE_DEBUG_SPCO' ) { |
|
296 | - if ( WP_DEBUG && false ) { |
|
297 | - $debug_key = $debug_key . '_' . EE_Session::instance()->id(); |
|
298 | - $debug_data = get_option( $debug_key, array() ); |
|
295 | + public static function log($class = '', $func = '', $line = '', $info = array(), $display_request = false, $debug_index = '', $debug_key = 'EE_DEBUG_SPCO') { |
|
296 | + if (WP_DEBUG && false) { |
|
297 | + $debug_key = $debug_key.'_'.EE_Session::instance()->id(); |
|
298 | + $debug_data = get_option($debug_key, array()); |
|
299 | 299 | $default_data = array( |
300 | - $class => $func . '() : ' . $line, |
|
300 | + $class => $func.'() : '.$line, |
|
301 | 301 | 'REQ' => $display_request ? $_REQUEST : '', |
302 | 302 | ); |
303 | 303 | // don't serialize objects |
304 | - $info = self::strip_objects( $info ); |
|
305 | - $index = ! empty( $debug_index ) ? $debug_index : 0; |
|
306 | - if ( ! isset( $debug_data[$index] ) ) { |
|
304 | + $info = self::strip_objects($info); |
|
305 | + $index = ! empty($debug_index) ? $debug_index : 0; |
|
306 | + if ( ! isset($debug_data[$index])) { |
|
307 | 307 | $debug_data[$index] = array(); |
308 | 308 | } |
309 | - $debug_data[$index][microtime()] = array_merge( $default_data, $info ); |
|
310 | - update_option( $debug_key, $debug_data ); |
|
309 | + $debug_data[$index][microtime()] = array_merge($default_data, $info); |
|
310 | + update_option($debug_key, $debug_data); |
|
311 | 311 | } |
312 | 312 | } |
313 | 313 | |
@@ -319,26 +319,26 @@ discard block |
||
319 | 319 | * @param array $info |
320 | 320 | * @return array |
321 | 321 | */ |
322 | - public static function strip_objects( $info = array() ) { |
|
323 | - foreach ( $info as $key => $value ) { |
|
324 | - if ( is_array( $value ) ) { |
|
325 | - $info[ $key ] = self::strip_objects( $value ); |
|
326 | - } else if ( is_object( $value ) ) { |
|
327 | - $object_class = get_class( $value ); |
|
328 | - $info[ $object_class ] = array(); |
|
329 | - $info[ $object_class ][ 'ID' ] = method_exists( $value, 'ID' ) ? $value->ID() : spl_object_hash( $value ); |
|
330 | - if ( method_exists( $value, 'ID' ) ) { |
|
331 | - $info[ $object_class ][ 'ID' ] = $value->ID(); |
|
322 | + public static function strip_objects($info = array()) { |
|
323 | + foreach ($info as $key => $value) { |
|
324 | + if (is_array($value)) { |
|
325 | + $info[$key] = self::strip_objects($value); |
|
326 | + } else if (is_object($value)) { |
|
327 | + $object_class = get_class($value); |
|
328 | + $info[$object_class] = array(); |
|
329 | + $info[$object_class]['ID'] = method_exists($value, 'ID') ? $value->ID() : spl_object_hash($value); |
|
330 | + if (method_exists($value, 'ID')) { |
|
331 | + $info[$object_class]['ID'] = $value->ID(); |
|
332 | 332 | } |
333 | - if ( method_exists( $value, 'status' ) ) { |
|
334 | - $info[ $object_class ][ 'status' ] = $value->status(); |
|
335 | - } else if ( method_exists( $value, 'status_ID' ) ) { |
|
336 | - $info[ $object_class ][ 'status' ] = $value->status_ID(); |
|
333 | + if (method_exists($value, 'status')) { |
|
334 | + $info[$object_class]['status'] = $value->status(); |
|
335 | + } else if (method_exists($value, 'status_ID')) { |
|
336 | + $info[$object_class]['status'] = $value->status_ID(); |
|
337 | 337 | } |
338 | - unset( $info[ $key ] ); |
|
338 | + unset($info[$key]); |
|
339 | 339 | } |
340 | 340 | } |
341 | - return (array)$info; |
|
341 | + return (array) $info; |
|
342 | 342 | } |
343 | 343 | |
344 | 344 | |
@@ -355,31 +355,31 @@ discard block |
||
355 | 355 | * @param string $height |
356 | 356 | * @param bool $die |
357 | 357 | */ |
358 | - public static function printr( $var, $var_name = false, $file = __FILE__, $line = __LINE__, $height = 'auto', $die = false ) { |
|
358 | + public static function printr($var, $var_name = false, $file = __FILE__, $line = __LINE__, $height = 'auto', $die = false) { |
|
359 | 359 | //$print_r = false; |
360 | - if ( is_object( $var ) ) { |
|
360 | + if (is_object($var)) { |
|
361 | 361 | $var_name = ! $var_name ? 'object' : $var_name; |
362 | 362 | //$print_r = true; |
363 | - } else if ( is_array( $var ) ) { |
|
363 | + } else if (is_array($var)) { |
|
364 | 364 | $var_name = ! $var_name ? 'array' : $var_name; |
365 | 365 | //$print_r = true; |
366 | - } else if ( is_numeric( $var ) ) { |
|
366 | + } else if (is_numeric($var)) { |
|
367 | 367 | $var_name = ! $var_name ? 'numeric' : $var_name; |
368 | - } else if ( is_string( $var ) ) { |
|
368 | + } else if (is_string($var)) { |
|
369 | 369 | $var_name = ! $var_name ? 'string' : $var_name; |
370 | - } else if ( is_null( $var ) ) { |
|
370 | + } else if (is_null($var)) { |
|
371 | 371 | $var_name = ! $var_name ? 'null' : $var_name; |
372 | 372 | } |
373 | - $var_name = ucwords( str_replace( array( '$', '_' ), array( '', ' ' ), $var_name ) ); |
|
373 | + $var_name = ucwords(str_replace(array('$', '_'), array('', ' '), $var_name)); |
|
374 | 374 | ob_start(); |
375 | - echo '<pre style="display:block; width:100%; height:' . $height . '; border:2px solid light-blue;">'; |
|
376 | - echo '<h5 style="color:#2EA2CC;"><b>' . $var_name . '</b></h5><span style="color:#E76700">'; |
|
375 | + echo '<pre style="display:block; width:100%; height:'.$height.'; border:2px solid light-blue;">'; |
|
376 | + echo '<h5 style="color:#2EA2CC;"><b>'.$var_name.'</b></h5><span style="color:#E76700">'; |
|
377 | 377 | //$print_r ? print_r( $var ) : var_dump( $var ); |
378 | - var_dump( $var ); |
|
379 | - echo '</span><br /><span style="font-size:10px;font-weight:normal;">' . $file . '<br />line no: ' . $line . '</span></pre>'; |
|
378 | + var_dump($var); |
|
379 | + echo '</span><br /><span style="font-size:10px;font-weight:normal;">'.$file.'<br />line no: '.$line.'</span></pre>'; |
|
380 | 380 | $result = ob_get_clean(); |
381 | - if ( $die ) { |
|
382 | - die( $result ); |
|
381 | + if ($die) { |
|
382 | + die($result); |
|
383 | 383 | } else { |
384 | 384 | echo $result; |
385 | 385 | } |
@@ -396,8 +396,8 @@ discard block |
||
396 | 396 | * borrowed from Kint Debugger |
397 | 397 | * Plugin URI: http://upthemes.com/plugins/kint-debugger/ |
398 | 398 | */ |
399 | -if ( class_exists('Kint') && ! function_exists( 'dump_wp_query' ) ) { |
|
400 | - function dump_wp_query(){ |
|
399 | +if (class_exists('Kint') && ! function_exists('dump_wp_query')) { |
|
400 | + function dump_wp_query() { |
|
401 | 401 | global $wp_query; |
402 | 402 | d($wp_query); |
403 | 403 | } |
@@ -407,8 +407,8 @@ discard block |
||
407 | 407 | * borrowed from Kint Debugger |
408 | 408 | * Plugin URI: http://upthemes.com/plugins/kint-debugger/ |
409 | 409 | */ |
410 | -if ( class_exists('Kint') && ! function_exists( 'dump_wp' ) ) { |
|
411 | - function dump_wp(){ |
|
410 | +if (class_exists('Kint') && ! function_exists('dump_wp')) { |
|
411 | + function dump_wp() { |
|
412 | 412 | global $wp; |
413 | 413 | d($wp); |
414 | 414 | } |
@@ -418,8 +418,8 @@ discard block |
||
418 | 418 | * borrowed from Kint Debugger |
419 | 419 | * Plugin URI: http://upthemes.com/plugins/kint-debugger/ |
420 | 420 | */ |
421 | -if ( class_exists('Kint') && ! function_exists( 'dump_post' ) ) { |
|
422 | - function dump_post(){ |
|
421 | +if (class_exists('Kint') && ! function_exists('dump_post')) { |
|
422 | + function dump_post() { |
|
423 | 423 | global $post; |
424 | 424 | d($post); |
425 | 425 | } |