@@ -1,8 +1,8 @@ discard block |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\exceptions; |
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 | * Class InvalidIdentifierException |
@@ -23,8 +23,8 @@ discard block |
||
23 | 23 | * @param int $code |
24 | 24 | * @param \Exception $previous |
25 | 25 | */ |
26 | - public function __construct( $actual, $expected, $message = '', $code = 0, \Exception $previous = null ) { |
|
27 | - if ( empty( $message ) ) { |
|
26 | + public function __construct($actual, $expected, $message = '', $code = 0, \Exception $previous = null) { |
|
27 | + if (empty($message)) { |
|
28 | 28 | $message = sprintf( |
29 | 29 | __( |
30 | 30 | 'The supplied identifier "%1$s" is invalid. A value like "%2$s" was expected.', |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | $expected |
35 | 35 | ); |
36 | 36 | } |
37 | - parent::__construct( $message, $code, $previous ); |
|
37 | + parent::__construct($message, $code, $previous); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | } |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | * _migration_step() (ie, it its a count of rows in the old attendees table in _count_records_to_migrate(), it should also be OLD attendee rows migrated |
35 | 35 | * on each call to _migration_step(). |
36 | 36 | */ |
37 | -abstract class EE_Data_Migration_Script_Stage extends EE_Data_Migration_Class_Base{ |
|
37 | +abstract class EE_Data_Migration_Script_Stage extends EE_Data_Migration_Class_Base { |
|
38 | 38 | /** |
39 | 39 | * The migration script this is a stage of |
40 | 40 | * @var EE_Data_Migration_Script_Base |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | * called by EE_Data_Migration_Script_Base's __construct() method so children don't have to |
48 | 48 | * @param EE_Data_Migration_Script_Base $migration_script |
49 | 49 | */ |
50 | - public function _construct_finalize($migration_script){ |
|
50 | + public function _construct_finalize($migration_script) { |
|
51 | 51 | $this->_migration_script = $migration_script; |
52 | 52 | } |
53 | 53 | |
@@ -58,13 +58,13 @@ discard block |
||
58 | 58 | * @param int $num_items_to_migrate |
59 | 59 | * @return int |
60 | 60 | */ |
61 | - public function migration_step($num_items_to_migrate=50){ |
|
61 | + public function migration_step($num_items_to_migrate = 50) { |
|
62 | 62 | //before we run the migration step, we want ot take note of warnings that get outputted |
63 | 63 | ob_start(); |
64 | 64 | $items_migrated = $this->_migration_step($num_items_to_migrate); |
65 | 65 | $output = ob_get_contents(); |
66 | 66 | ob_end_clean(); |
67 | - if( $output ){ |
|
67 | + if ($output) { |
|
68 | 68 | $this->add_error($output); |
69 | 69 | } |
70 | 70 | $this->_records_migrated += $items_migrated; |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | * @param int $num_items_to_migrate |
83 | 83 | * @return int number of items ACTUALLY migrated |
84 | 84 | */ |
85 | - abstract protected function _migration_step($num_items_to_migrate=50); |
|
85 | + abstract protected function _migration_step($num_items_to_migrate = 50); |
|
86 | 86 | |
87 | 87 | /** |
88 | 88 | * Counts the records that have been migrated so far |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | * returns an array of strings describing errors |
97 | 97 | * @return array |
98 | 98 | */ |
99 | - public function get_errors(){ |
|
99 | + public function get_errors() { |
|
100 | 100 | return $this->_errors; |
101 | 101 | } |
102 | 102 | |
@@ -106,9 +106,9 @@ discard block |
||
106 | 106 | * to have been made from the properties_as_array() function. |
107 | 107 | * @param array $array_of_properties like what's produced from properties_as_array() method |
108 | 108 | */ |
109 | - public function instantiate_from_array_of_properties($array_of_properties){ |
|
109 | + public function instantiate_from_array_of_properties($array_of_properties) { |
|
110 | 110 | unset($array_of_properties['class']); |
111 | - foreach($array_of_properties as $property_name => $property_value){ |
|
111 | + foreach ($array_of_properties as $property_name => $property_value) { |
|
112 | 112 | $this->{$property_name} = $property_value; |
113 | 113 | } |
114 | 114 | } |
@@ -117,7 +117,7 @@ discard block |
||
117 | 117 | * Gets the script this is a stage of |
118 | 118 | * @return EE_Data_Migration_Script_Base |
119 | 119 | */ |
120 | - protected function get_migration_script(){ |
|
120 | + protected function get_migration_script() { |
|
121 | 121 | return $this->_migration_script; |
122 | 122 | } |
123 | 123 | } |
@@ -2,25 +2,25 @@ |
||
2 | 2 | //this displays any legends with an array of $items that are indexed by id for each item and each item itself is an array of 'icon' and 'desc'. |
3 | 3 | |
4 | 4 | //figure out the columns based on the count of items (we want a max of 6 items per column). |
5 | -$per_col = isset( $per_column ) ? $per_column : 5; |
|
5 | +$per_col = isset($per_column) ? $per_column : 5; |
|
6 | 6 | $count = 1; |
7 | 7 | ?> |
8 | 8 | <div class="ee-list-table-legend-container"> |
9 | 9 | <h3><?php _e('Legend', 'event_espresso'); ?></h3> |
10 | 10 | <dl class="alignleft ee-list-table-legend"> |
11 | - <?php foreach ( $items as $item => $details ) : ?> |
|
12 | - <?php if ( $per_col < $count ) : ?> |
|
11 | + <?php foreach ($items as $item => $details) : ?> |
|
12 | + <?php if ($per_col < $count) : ?> |
|
13 | 13 | </dl> |
14 | 14 | <dl class="alignleft ee-list-table-legend"> |
15 | 15 | <?php $count = 1; endif; ?> |
16 | 16 | <dt id="ee-legend-item-<?php echo $item; ?>"> |
17 | - <?php $class = ! empty( $details['class'] ) ? $details['class'] : 'ee-legend-img-container'; ?> |
|
18 | - <?php if ( strpos( $details[ 'class' ], '<span' ) !== false ) { |
|
17 | + <?php $class = ! empty($details['class']) ? $details['class'] : 'ee-legend-img-container'; ?> |
|
18 | + <?php if (strpos($details['class'], '<span') !== false) { |
|
19 | 19 | echo $class; |
20 | 20 | } else { ?> |
21 | 21 | <span class="<?php echo $class; ?>"> |
22 | - <?php if ( ! empty( $details[ 'icon' ] ) ) : ?> |
|
23 | - <img src="<?php echo $details[ 'icon' ]; ?>" class="ee-legend-icon" alt="<?php echo esc_attr( $details[ 'desc' ] ); ?>"/> |
|
22 | + <?php if ( ! empty($details['icon'])) : ?> |
|
23 | + <img src="<?php echo $details['icon']; ?>" class="ee-legend-icon" alt="<?php echo esc_attr($details['desc']); ?>"/> |
|
24 | 24 | <?php endif; ?> |
25 | 25 | </span> |
26 | 26 | <?php } ?> |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | /** @var string|WP_Screen $current_page */ |
5 | 5 | global $post_type, $post; |
6 | 6 | //action for registering metaboxes |
7 | -do_action( 'add_meta_boxes', $post_type, $post ); |
|
7 | +do_action('add_meta_boxes', $post_type, $post); |
|
8 | 8 | ?> |
9 | 9 | <?php if ( ! empty($admin_page_header)) : ?> |
10 | 10 | <div id="admin-page-header"> |
@@ -15,7 +15,7 @@ discard block |
||
15 | 15 | <!-- admin-page-header --> |
16 | 16 | <div id="post-body" class="metabox-holder columns-2"> |
17 | 17 | |
18 | - <?php if ( ! empty( $post_body_content )) : ?> |
|
18 | + <?php if ( ! empty($post_body_content)) : ?> |
|
19 | 19 | <div id="post-body-content"> |
20 | 20 | <?php echo $post_body_content; ?> |
21 | 21 | </div> |
@@ -23,13 +23,13 @@ discard block |
||
23 | 23 | <?php endif; ?> |
24 | 24 | |
25 | 25 | <div id="postbox-container-1" class="postbox-container"> |
26 | - <?php do_meta_boxes( $current_page, 'side', NULL ); ?> |
|
26 | + <?php do_meta_boxes($current_page, 'side', NULL); ?> |
|
27 | 27 | </div> |
28 | 28 | <!-- postbox-container-1 --> |
29 | 29 | |
30 | 30 | <div id="postbox-container-2" class="postbox-container"> |
31 | - <?php do_meta_boxes( $current_page, 'normal', NULL ); ?> |
|
32 | - <?php do_meta_boxes( $current_page, 'advanced', NULL ); ?> |
|
31 | + <?php do_meta_boxes($current_page, 'normal', NULL); ?> |
|
32 | + <?php do_meta_boxes($current_page, 'advanced', NULL); ?> |
|
33 | 33 | </div> |
34 | 34 | <!-- postbox-container-2 --> |
35 | 35 | <div class="clear"></div> |
@@ -1,8 +1,8 @@ |
||
1 | 1 | <?php |
2 | 2 | namespace EventEspresso\core\services\collections; |
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 |
@@ -8,8 +8,8 @@ discard block |
||
8 | 8 | use EventEspresso\core\services\locators\FqcnLocator; |
9 | 9 | use EventEspresso\core\services\locators\LocatorInterface; |
10 | 10 | |
11 | -if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
12 | - exit( 'No direct script access allowed' ); |
|
11 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
12 | + exit('No direct script access allowed'); |
|
13 | 13 | } |
14 | 14 | |
15 | 15 | |
@@ -170,13 +170,13 @@ discard block |
||
170 | 170 | $identifier_callback = '', |
171 | 171 | LocatorInterface $file_locator = null |
172 | 172 | ) { |
173 | - $this->setCollectionName( $collection_name ); |
|
174 | - $this->setCollectionInterface( $collection_interface ); |
|
175 | - $this->setCollectionFQCNs( $collection_FQCNs ); |
|
176 | - $this->setCollectionPaths( $collection_paths ); |
|
177 | - $this->setFileMasks( $file_mask ); |
|
178 | - $this->setIdentifierType( $identifier_type ); |
|
179 | - $this->setIdentifierCallback( $identifier_callback ); |
|
173 | + $this->setCollectionName($collection_name); |
|
174 | + $this->setCollectionInterface($collection_interface); |
|
175 | + $this->setCollectionFQCNs($collection_FQCNs); |
|
176 | + $this->setCollectionPaths($collection_paths); |
|
177 | + $this->setFileMasks($file_mask); |
|
178 | + $this->setIdentifierType($identifier_type); |
|
179 | + $this->setIdentifierCallback($identifier_callback); |
|
180 | 180 | $this->file_locator = $file_locator; |
181 | 181 | } |
182 | 182 | |
@@ -197,9 +197,9 @@ discard block |
||
197 | 197 | * @param string $collection_interface |
198 | 198 | * @throws \EventEspresso\core\exceptions\InvalidInterfaceException |
199 | 199 | */ |
200 | - protected function setCollectionInterface( $collection_interface ) { |
|
201 | - if ( ! ( interface_exists( $collection_interface ) || class_exists( $collection_interface ) ) ) { |
|
202 | - throw new InvalidInterfaceException( $collection_interface ); |
|
200 | + protected function setCollectionInterface($collection_interface) { |
|
201 | + if ( ! (interface_exists($collection_interface) || class_exists($collection_interface))) { |
|
202 | + throw new InvalidInterfaceException($collection_interface); |
|
203 | 203 | } |
204 | 204 | $this->collection_interface = $collection_interface; |
205 | 205 | } |
@@ -225,14 +225,14 @@ discard block |
||
225 | 225 | * @param string $collection_name |
226 | 226 | * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
227 | 227 | */ |
228 | - protected function setCollectionName( $collection_name ) { |
|
229 | - if ( ! is_string( $collection_name ) ) { |
|
230 | - throw new InvalidDataTypeException( '$collection_name', $collection_name, 'string' ); |
|
228 | + protected function setCollectionName($collection_name) { |
|
229 | + if ( ! is_string($collection_name)) { |
|
230 | + throw new InvalidDataTypeException('$collection_name', $collection_name, 'string'); |
|
231 | 231 | } |
232 | 232 | $this->collection_name = str_replace( |
233 | 233 | '-', |
234 | 234 | '_', |
235 | - sanitize_title_with_dashes( $collection_name, '', 'save' ) |
|
235 | + sanitize_title_with_dashes($collection_name, '', 'save') |
|
236 | 236 | ); |
237 | 237 | } |
238 | 238 | |
@@ -253,7 +253,7 @@ discard block |
||
253 | 253 | * @param string $identifier_type |
254 | 254 | * @throws \EventEspresso\core\exceptions\InvalidIdentifierException |
255 | 255 | */ |
256 | - protected function setIdentifierType( $identifier_type ) { |
|
256 | + protected function setIdentifierType($identifier_type) { |
|
257 | 257 | if ( |
258 | 258 | ! ( |
259 | 259 | $identifier_type === CollectionDetails::ID_CLASS_NAME |
@@ -286,9 +286,9 @@ discard block |
||
286 | 286 | * @param string $identifier_callback |
287 | 287 | * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
288 | 288 | */ |
289 | - protected function setIdentifierCallback( $identifier_callback = 'identifier' ) { |
|
290 | - if ( ! is_string( $identifier_callback ) ) { |
|
291 | - throw new InvalidDataTypeException( '$identifier_callback', $identifier_callback, 'string' ); |
|
289 | + protected function setIdentifierCallback($identifier_callback = 'identifier') { |
|
290 | + if ( ! is_string($identifier_callback)) { |
|
291 | + throw new InvalidDataTypeException('$identifier_callback', $identifier_callback, 'string'); |
|
292 | 292 | } |
293 | 293 | $this->identifier_callback = $identifier_callback; |
294 | 294 | } |
@@ -313,12 +313,12 @@ discard block |
||
313 | 313 | * @param string $file_mask |
314 | 314 | * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
315 | 315 | */ |
316 | - protected function setFileMasks( $file_mask ) { |
|
317 | - $this->file_mask = ! empty( $file_mask ) ? $file_mask : '*.php'; |
|
316 | + protected function setFileMasks($file_mask) { |
|
317 | + $this->file_mask = ! empty($file_mask) ? $file_mask : '*.php'; |
|
318 | 318 | // we know our default is a string, so if it's not a string now, |
319 | 319 | // then that means the incoming parameter was something else |
320 | - if ( ! is_string( $this->file_mask ) ) { |
|
321 | - throw new InvalidDataTypeException( '$file_mask', $this->file_mask, 'string' ); |
|
320 | + if ( ! is_string($this->file_mask)) { |
|
321 | + throw new InvalidDataTypeException('$file_mask', $this->file_mask, 'string'); |
|
322 | 322 | } |
323 | 323 | } |
324 | 324 | |
@@ -340,13 +340,13 @@ discard block |
||
340 | 340 | * @throws \EventEspresso\core\exceptions\InvalidClassException |
341 | 341 | * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
342 | 342 | */ |
343 | - public function setCollectionFQCNs( $collection_FQCNs ) { |
|
344 | - foreach ( (array) $collection_FQCNs as $collection_FQCN ) { |
|
345 | - if ( ! empty( $collection_FQCN ) ) { |
|
346 | - if ( class_exists( $collection_FQCN ) ) { |
|
343 | + public function setCollectionFQCNs($collection_FQCNs) { |
|
344 | + foreach ((array) $collection_FQCNs as $collection_FQCN) { |
|
345 | + if ( ! empty($collection_FQCN)) { |
|
346 | + if (class_exists($collection_FQCN)) { |
|
347 | 347 | $this->collection_FQCNs[] = $collection_FQCN; |
348 | 348 | } else { |
349 | - foreach ( $this->getFQCNsFromPartialNamespace( $collection_FQCN ) as $FQCN ) { |
|
349 | + foreach ($this->getFQCNsFromPartialNamespace($collection_FQCN) as $FQCN) { |
|
350 | 350 | $this->collection_FQCNs[] = $FQCN; |
351 | 351 | } |
352 | 352 | } |
@@ -363,11 +363,11 @@ discard block |
||
363 | 363 | * @throws \EventEspresso\core\exceptions\InvalidDataTypeException |
364 | 364 | * @throws \EventEspresso\core\exceptions\InvalidClassException |
365 | 365 | */ |
366 | - protected function getFQCNsFromPartialNamespace( $partial_FQCN ) { |
|
367 | - if ( ! $this->file_locator instanceof FqcnLocator ) { |
|
366 | + protected function getFQCNsFromPartialNamespace($partial_FQCN) { |
|
367 | + if ( ! $this->file_locator instanceof FqcnLocator) { |
|
368 | 368 | $this->file_locator = new FqcnLocator(); |
369 | 369 | } |
370 | - $this->file_locator->locate( $partial_FQCN ); |
|
370 | + $this->file_locator->locate($partial_FQCN); |
|
371 | 371 | return $this->file_locator->getFQCNs(); |
372 | 372 | } |
373 | 373 | |
@@ -388,11 +388,11 @@ discard block |
||
388 | 388 | * @param string|array $collection_paths |
389 | 389 | * @throws \EventEspresso\core\exceptions\InvalidFilePathException |
390 | 390 | */ |
391 | - public function setCollectionPaths( $collection_paths ) { |
|
392 | - foreach ( (array) $collection_paths as $collection_path ) { |
|
393 | - if ( ! empty( $collection_path ) ) { |
|
394 | - if ( ! is_readable( $collection_path ) ) { |
|
395 | - throw new InvalidFilePathException( $collection_path ); |
|
391 | + public function setCollectionPaths($collection_paths) { |
|
392 | + foreach ((array) $collection_paths as $collection_path) { |
|
393 | + if ( ! empty($collection_path)) { |
|
394 | + if ( ! is_readable($collection_path)) { |
|
395 | + throw new InvalidFilePathException($collection_path); |
|
396 | 396 | } |
397 | 397 | $this->collection_paths[] = $collection_path; |
398 | 398 | } |
@@ -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 |