@@ -24,10 +24,10 @@ discard block |
||
24 | 24 | * @param string $table_name |
25 | 25 | * @return string $tableName, having ensured it has the wpdb prefix on the front |
26 | 26 | */ |
27 | - public function ensureTableNameHasPrefix( $table_name ) |
|
27 | + public function ensureTableNameHasPrefix($table_name) |
|
28 | 28 | { |
29 | 29 | global $wpdb; |
30 | - return strpos( $table_name, $wpdb->base_prefix ) === 0 ? $table_name : $wpdb->prefix . $table_name; |
|
30 | + return strpos($table_name, $wpdb->base_prefix) === 0 ? $table_name : $wpdb->prefix.$table_name; |
|
31 | 31 | } |
32 | 32 | |
33 | 33 | |
@@ -39,13 +39,13 @@ discard block |
||
39 | 39 | * @param string $table_name |
40 | 40 | * @return bool |
41 | 41 | */ |
42 | - public function tableIsEmpty( $table_name ) |
|
42 | + public function tableIsEmpty($table_name) |
|
43 | 43 | { |
44 | 44 | global $wpdb; |
45 | - $table_name = $this->ensureTableNameHasPrefix( $table_name ); |
|
46 | - if ( $this->tableExists( $table_name ) ) { |
|
47 | - $count = $wpdb->get_var( "SELECT COUNT(*) FROM $table_name" ); |
|
48 | - return absint( $count ) === 0 ? true : false; |
|
45 | + $table_name = $this->ensureTableNameHasPrefix($table_name); |
|
46 | + if ($this->tableExists($table_name)) { |
|
47 | + $count = $wpdb->get_var("SELECT COUNT(*) FROM $table_name"); |
|
48 | + return absint($count) === 0 ? true : false; |
|
49 | 49 | } |
50 | 50 | return false; |
51 | 51 | } |
@@ -60,24 +60,24 @@ discard block |
||
60 | 60 | * @param $table_name |
61 | 61 | * @return bool |
62 | 62 | */ |
63 | - public function tableExists( $table_name ) |
|
63 | + public function tableExists($table_name) |
|
64 | 64 | { |
65 | 65 | global $wpdb, $EZSQL_ERROR; |
66 | - $table_name = $this->ensureTableNameHasPrefix( $table_name ); |
|
66 | + $table_name = $this->ensureTableNameHasPrefix($table_name); |
|
67 | 67 | //ignore if this causes an sql error |
68 | 68 | $old_error = $wpdb->last_error; |
69 | 69 | $old_suppress_errors = $wpdb->suppress_errors(); |
70 | - $old_show_errors_value = $wpdb->show_errors( FALSE ); |
|
70 | + $old_show_errors_value = $wpdb->show_errors(FALSE); |
|
71 | 71 | $ezsql_error_cache = $EZSQL_ERROR; |
72 | - $wpdb->get_results( "SELECT * from $table_name LIMIT 1"); |
|
73 | - $wpdb->show_errors( $old_show_errors_value ); |
|
74 | - $wpdb->suppress_errors( $old_suppress_errors ); |
|
72 | + $wpdb->get_results("SELECT * from $table_name LIMIT 1"); |
|
73 | + $wpdb->show_errors($old_show_errors_value); |
|
74 | + $wpdb->suppress_errors($old_suppress_errors); |
|
75 | 75 | $new_error = $wpdb->last_error; |
76 | 76 | $wpdb->last_error = $old_error; |
77 | 77 | $EZSQL_ERROR = $ezsql_error_cache; |
78 | 78 | //if there was a table doesn't exist error |
79 | - if( ! empty( $new_error ) ) { |
|
80 | - if( |
|
79 | + if ( ! empty($new_error)) { |
|
80 | + if ( |
|
81 | 81 | in_array( |
82 | 82 | \EEH_Activation::last_wpdb_error_code(), |
83 | 83 | array( |
@@ -87,14 +87,14 @@ discard block |
||
87 | 87 | ) |
88 | 88 | ) |
89 | 89 | || |
90 | - preg_match( '~^Table .* doesn\'t exist~', $new_error ) //in case not using mysql and error codes aren't reliable, just check for this error string |
|
90 | + preg_match('~^Table .* doesn\'t exist~', $new_error) //in case not using mysql and error codes aren't reliable, just check for this error string |
|
91 | 91 | ) { |
92 | 92 | return false; |
93 | 93 | } else { |
94 | 94 | //log this because that's weird. Just use the normal PHP error log |
95 | 95 | error_log( |
96 | 96 | sprintf( |
97 | - __( 'Event Espresso error detected when checking if table existed: %1$s (it wasn\'t just that the table didn\'t exist either)', 'event_espresso' ), |
|
97 | + __('Event Espresso error detected when checking if table existed: %1$s (it wasn\'t just that the table didn\'t exist either)', 'event_espresso'), |
|
98 | 98 | $new_error |
99 | 99 | ) |
100 | 100 | ); |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * @type string Index_comment |
125 | 125 | * } |
126 | 126 | */ |
127 | - public function showIndexes($table_name, $index_name){ |
|
127 | + public function showIndexes($table_name, $index_name) { |
|
128 | 128 | global $wpdb; |
129 | 129 | $table_name = $this->ensureTableNameHasPrefix($table_name); |
130 | 130 | $index_exists_query = "SHOW INDEX FROM {$table_name} WHERE Key_name = '{$index_name}'"; |
@@ -16,11 +16,11 @@ discard block |
||
16 | 16 | */ |
17 | 17 | class TableAnalysis extends \EE_Base { |
18 | 18 | |
19 | - /** |
|
20 | - * The maximum number of characters that can be indexed on a column using utf8mb4 collation, |
|
21 | - * see https://events.codebasehq.com/redirect?https://make.wordpress.org/core/2015/04/02/the-utf8mb4-upgrade/ |
|
22 | - */ |
|
23 | - const INDEX_COLUMN_SIZE = 191; |
|
19 | + /** |
|
20 | + * The maximum number of characters that can be indexed on a column using utf8mb4 collation, |
|
21 | + * see https://events.codebasehq.com/redirect?https://make.wordpress.org/core/2015/04/02/the-utf8mb4-upgrade/ |
|
22 | + */ |
|
23 | + const INDEX_COLUMN_SIZE = 191; |
|
24 | 24 | /** |
25 | 25 | * Returns the table name which will definitely have the wpdb prefix on the front, |
26 | 26 | * except if it currently has the wpdb->base_prefix on the front, in which case |
@@ -111,29 +111,29 @@ discard block |
||
111 | 111 | |
112 | 112 | |
113 | 113 | |
114 | - /** |
|
115 | - * @param $table_name |
|
116 | - * @param $index_name |
|
117 | - * @return array of columns used on that index, Each entry is an object with the following properties { |
|
118 | - * @type string Table |
|
119 | - * @type string Non_unique "0" or "1" |
|
120 | - * @type string Key_name |
|
121 | - * @type string Seq_in_index |
|
122 | - * @type string Column_name |
|
123 | - * @type string Collation |
|
124 | - * @type string Cardinality |
|
125 | - * @type string Sub_part on a column, usually this is just the number of characters from this column to use in indexing |
|
126 | - * @type string|null Packed |
|
127 | - * @type string Null |
|
128 | - * @type string Index_type |
|
129 | - * @type string Comment |
|
130 | - * @type string Index_comment |
|
131 | - * } |
|
132 | - */ |
|
114 | + /** |
|
115 | + * @param $table_name |
|
116 | + * @param $index_name |
|
117 | + * @return array of columns used on that index, Each entry is an object with the following properties { |
|
118 | + * @type string Table |
|
119 | + * @type string Non_unique "0" or "1" |
|
120 | + * @type string Key_name |
|
121 | + * @type string Seq_in_index |
|
122 | + * @type string Column_name |
|
123 | + * @type string Collation |
|
124 | + * @type string Cardinality |
|
125 | + * @type string Sub_part on a column, usually this is just the number of characters from this column to use in indexing |
|
126 | + * @type string|null Packed |
|
127 | + * @type string Null |
|
128 | + * @type string Index_type |
|
129 | + * @type string Comment |
|
130 | + * @type string Index_comment |
|
131 | + * } |
|
132 | + */ |
|
133 | 133 | public function showIndexes($table_name, $index_name){ |
134 | - global $wpdb; |
|
135 | - $table_name = $this->ensureTableNameHasPrefix($table_name); |
|
136 | - $index_exists_query = "SHOW INDEX FROM {$table_name} WHERE Key_name = '{$index_name}'"; |
|
137 | - return $wpdb->get_results($index_exists_query); |
|
138 | - } |
|
134 | + global $wpdb; |
|
135 | + $table_name = $this->ensureTableNameHasPrefix($table_name); |
|
136 | + $index_exists_query = "SHOW INDEX FROM {$table_name} WHERE Key_name = '{$index_name}'"; |
|
137 | + return $wpdb->get_results($index_exists_query); |
|
138 | + } |
|
139 | 139 | } |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\services\commands; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 |
@@ -3,8 +3,8 @@ |
||
3 | 3 | |
4 | 4 | use EventEspresso\core\services\commands\Command; |
5 | 5 | |
6 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
7 | - exit( 'No direct script access allowed' ); |
|
6 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
7 | + exit('No direct script access allowed'); |
|
8 | 8 | } |
9 | 9 | |
10 | 10 |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\services\commands\registration; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 |
@@ -12,8 +12,7 @@ |
||
12 | 12 | * DTO for passing data to a UpdateRegistrationAndTransactionAfterChangeCommandHandler |
13 | 13 | * |
14 | 14 | * @package Event Espresso |
15 | - |
|
16 | -*@author Brent Christensen |
|
15 | + *@author Brent Christensen |
|
17 | 16 | * |
18 | 17 | */ |
19 | 18 | class UpdateRegistrationAndTransactionAfterChangeCommand extends SingleRegistrationCommand |
@@ -2,8 +2,8 @@ |
||
2 | 2 | namespace EventEspresso\core\services\commands\registration; |
3 | 3 | |
4 | 4 | |
5 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
6 | - exit( 'No direct script access allowed' ); |
|
5 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
6 | + exit('No direct script access allowed'); |
|
7 | 7 | } |
8 | 8 | |
9 | 9 |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\services\progress_steps\display_strategies; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 |
@@ -4,8 +4,8 @@ discard block |
||
4 | 4 | use EventEspresso\core\services\collections\Collection; |
5 | 5 | |
6 | 6 | |
7 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
8 | - exit( 'No direct script access allowed' ); |
|
7 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
8 | + exit('No direct script access allowed'); |
|
9 | 9 | } |
10 | 10 | |
11 | 11 | |
@@ -28,7 +28,7 @@ discard block |
||
28 | 28 | * @throws \EventEspresso\core\exceptions\InvalidInterfaceException |
29 | 29 | */ |
30 | 30 | public function __construct() { |
31 | - parent::__construct( '\EventEspresso\core\services\progress_steps\ProgressStepInterface' ); |
|
31 | + parent::__construct('\EventEspresso\core\services\progress_steps\ProgressStepInterface'); |
|
32 | 32 | } |
33 | 33 | |
34 | 34 | } |
@@ -3,8 +3,8 @@ discard block |
||
3 | 3 | |
4 | 4 | use EventEspresso\core\exceptions\InvalidDataTypeException; |
5 | 5 | |
6 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
7 | - exit( 'No direct script access allowed' ); |
|
6 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
7 | + exit('No direct script access allowed'); |
|
8 | 8 | } |
9 | 9 | |
10 | 10 | |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * @author Brent Christensen |
20 | 20 | * @since 4.9.0 |
21 | 21 | */ |
22 | -class ProgressStep implements ProgressStepInterface{ |
|
22 | +class ProgressStep implements ProgressStepInterface { |
|
23 | 23 | |
24 | 24 | |
25 | 25 | /** |
@@ -65,11 +65,11 @@ discard block |
||
65 | 65 | * @param string $text |
66 | 66 | * @throws InvalidDataTypeException |
67 | 67 | */ |
68 | - public function __construct( $order, $id, $html_class, $text ) { |
|
69 | - $this->setOrder( $order ); |
|
70 | - $this->setId( $id ); |
|
71 | - $this->setHtmlClass( $html_class ); |
|
72 | - $this->setText( $text ); |
|
68 | + public function __construct($order, $id, $html_class, $text) { |
|
69 | + $this->setOrder($order); |
|
70 | + $this->setId($id); |
|
71 | + $this->setHtmlClass($html_class); |
|
72 | + $this->setText($text); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | |
@@ -86,8 +86,8 @@ discard block |
||
86 | 86 | /** |
87 | 87 | * @param boolean $current |
88 | 88 | */ |
89 | - public function setIsCurrent( $current = true ) { |
|
90 | - $this->current = filter_var( $current, FILTER_VALIDATE_BOOLEAN ); |
|
89 | + public function setIsCurrent($current = true) { |
|
90 | + $this->current = filter_var($current, FILTER_VALIDATE_BOOLEAN); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | |
@@ -104,8 +104,8 @@ discard block |
||
104 | 104 | /** |
105 | 105 | * @param boolean $completed |
106 | 106 | */ |
107 | - public function setIsCompleted( $completed = true ) { |
|
108 | - $this->completed = filter_var( $completed, FILTER_VALIDATE_BOOLEAN ); |
|
107 | + public function setIsCompleted($completed = true) { |
|
108 | + $this->completed = filter_var($completed, FILTER_VALIDATE_BOOLEAN); |
|
109 | 109 | } |
110 | 110 | |
111 | 111 | |
@@ -124,9 +124,9 @@ discard block |
||
124 | 124 | * @param string $id |
125 | 125 | * @throws InvalidDataTypeException |
126 | 126 | */ |
127 | - protected function setId( $id = '' ) { |
|
128 | - if ( ! is_string( $id ) ) { |
|
129 | - throw new InvalidDataTypeException( '$id', $id, 'string' ); |
|
127 | + protected function setId($id = '') { |
|
128 | + if ( ! is_string($id)) { |
|
129 | + throw new InvalidDataTypeException('$id', $id, 'string'); |
|
130 | 130 | } |
131 | 131 | $this->id = $id; |
132 | 132 | } |
@@ -148,9 +148,9 @@ discard block |
||
148 | 148 | * @param int $order |
149 | 149 | * @throws InvalidDataTypeException |
150 | 150 | */ |
151 | - protected function setOrder( $order = 0 ) { |
|
152 | - if ( ! is_int( $order ) ) { |
|
153 | - throw new InvalidDataTypeException( '$order', $order, 'integer' ); |
|
151 | + protected function setOrder($order = 0) { |
|
152 | + if ( ! is_int($order)) { |
|
153 | + throw new InvalidDataTypeException('$order', $order, 'integer'); |
|
154 | 154 | } |
155 | 155 | $this->order = $order; |
156 | 156 | } |
@@ -162,9 +162,9 @@ discard block |
||
162 | 162 | */ |
163 | 163 | public function htmlClass() { |
164 | 164 | $html_class = $this->html_class; |
165 | - if ( $this->isCurrent() ) { |
|
165 | + if ($this->isCurrent()) { |
|
166 | 166 | $html_class .= ' progress-step-active'; |
167 | - } else if ( $this->isCompleted() ) { |
|
167 | + } else if ($this->isCompleted()) { |
|
168 | 168 | $html_class .= ' progress-step-completed'; |
169 | 169 | } |
170 | 170 | return $html_class; |
@@ -177,12 +177,12 @@ discard block |
||
177 | 177 | * @param string $html_class |
178 | 178 | * @throws InvalidDataTypeException |
179 | 179 | */ |
180 | - protected function setHtmlClass( $html_class ) { |
|
181 | - if ( ! is_string( $html_class ) ) { |
|
182 | - throw new InvalidDataTypeException( '$html_class', $html_class, 'string' ); |
|
180 | + protected function setHtmlClass($html_class) { |
|
181 | + if ( ! is_string($html_class)) { |
|
182 | + throw new InvalidDataTypeException('$html_class', $html_class, 'string'); |
|
183 | 183 | } |
184 | - if ( strpos( $html_class, 'progress-step-' ) === false ) { |
|
185 | - $html_class = 'progress-step-' . $html_class; |
|
184 | + if (strpos($html_class, 'progress-step-') === false) { |
|
185 | + $html_class = 'progress-step-'.$html_class; |
|
186 | 186 | } |
187 | 187 | $this->html_class = $html_class; |
188 | 188 | } |
@@ -203,9 +203,9 @@ discard block |
||
203 | 203 | * @param string $text |
204 | 204 | * @throws InvalidDataTypeException |
205 | 205 | */ |
206 | - protected function setText( $text ) { |
|
207 | - if ( ! is_string( $text ) ) { |
|
208 | - throw new InvalidDataTypeException( '$text', $text, 'string' ); |
|
206 | + protected function setText($text) { |
|
207 | + if ( ! is_string($text)) { |
|
208 | + throw new InvalidDataTypeException('$text', $text, 'string'); |
|
209 | 209 | } |
210 | 210 | $this->text = $text; |
211 | 211 | } |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\services\progress_steps; |
3 | 3 | |
4 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
5 | - exit( 'No direct script access allowed' ); |
|
4 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
5 | + exit('No direct script access allowed'); |
|
6 | 6 | } |
7 | 7 | |
8 | 8 |