@@ -550,7 +550,7 @@ |
||
| 550 | 550 | } |
| 551 | 551 | } |
| 552 | 552 | } |
| 553 | - return FALSE; |
|
| 553 | + return FALSE; |
|
| 554 | 554 | } |
| 555 | 555 | |
| 556 | 556 | |
@@ -59,19 +59,19 @@ discard block |
||
| 59 | 59 | * @param null $pretty_date_format |
| 60 | 60 | * @param null $pretty_time_format |
| 61 | 61 | */ |
| 62 | - public function __construct( $table_column, $nice_name, $nullable, $default_value, $timezone = NULL, $date_format = NULL, $time_format = NULL, $pretty_date_format = NULL, $pretty_time_format = NULL ){ |
|
| 62 | + public function __construct($table_column, $nice_name, $nullable, $default_value, $timezone = NULL, $date_format = NULL, $time_format = NULL, $pretty_date_format = NULL, $pretty_time_format = NULL) { |
|
| 63 | 63 | |
| 64 | 64 | parent::__construct($table_column, $nice_name, $nullable, $default_value); |
| 65 | 65 | $this->_date_format = empty($date_format) ? get_option('date_format') : $date_format; |
| 66 | - $this->_date_format = EE_Base_Class::fix_date_format_for_use_with_strtotime( $this->_date_format ); |
|
| 66 | + $this->_date_format = EE_Base_Class::fix_date_format_for_use_with_strtotime($this->_date_format); |
|
| 67 | 67 | $this->_time_format = empty($time_format) ? get_option('time_format') : $time_format; |
| 68 | 68 | |
| 69 | - $this->set_timezone( $timezone ); |
|
| 69 | + $this->set_timezone($timezone); |
|
| 70 | 70 | |
| 71 | 71 | |
| 72 | 72 | $this->_pretty_date_format = empty($pretty_date_format) ? get_option('date_format') : $pretty_date_format; |
| 73 | - $this->_pretty_date_format = EE_Base_Class::fix_date_format_for_use_with_strtotime( $this->_pretty_date_format ); |
|
| 74 | - $this->_pretty_time_format = empty( $pretty_time_format ) ? get_option('time_format') : $pretty_time_format; |
|
| 73 | + $this->_pretty_date_format = EE_Base_Class::fix_date_format_for_use_with_strtotime($this->_pretty_date_format); |
|
| 74 | + $this->_pretty_time_format = empty($pretty_time_format) ? get_option('time_format') : $pretty_time_format; |
|
| 75 | 75 | } |
| 76 | 76 | |
| 77 | 77 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | * @return DateTimeZone|null |
| 90 | 90 | */ |
| 91 | 91 | public static function get_UTC_DateTimeZone() { |
| 92 | - return EE_Datetime_Field::$_UTC_DateTimeZone instanceof DateTimeZone ? EE_Datetime_Field::$_UTC_DateTimeZone : new DateTimeZone( 'UTC' ); |
|
| 92 | + return EE_Datetime_Field::$_UTC_DateTimeZone instanceof DateTimeZone ? EE_Datetime_Field::$_UTC_DateTimeZone : new DateTimeZone('UTC'); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | |
@@ -100,7 +100,7 @@ discard block |
||
| 100 | 100 | * @return int unix timestamp (utc) |
| 101 | 101 | */ |
| 102 | 102 | public function prepare_for_set($value_inputted_for_field_on_model_object) { |
| 103 | - return $this->_convert_to_utc_unix_timestamp( $value_inputted_for_field_on_model_object); |
|
| 103 | + return $this->_convert_to_utc_unix_timestamp($value_inputted_for_field_on_model_object); |
|
| 104 | 104 | } |
| 105 | 105 | |
| 106 | 106 | |
@@ -116,9 +116,9 @@ discard block |
||
| 116 | 116 | * @param bool $pretty If we're returning the pretty formats or standard format string. |
| 117 | 117 | * @return string The final assembled format string. |
| 118 | 118 | */ |
| 119 | - private function _get_date_time_output( $pretty = FALSE ) { |
|
| 119 | + private function _get_date_time_output($pretty = FALSE) { |
|
| 120 | 120 | |
| 121 | - switch ( $this->_date_time_output ) { |
|
| 121 | + switch ($this->_date_time_output) { |
|
| 122 | 122 | case 'time' : |
| 123 | 123 | return $pretty ? $this->_pretty_time_format : $this->_time_format; |
| 124 | 124 | break; |
@@ -128,7 +128,7 @@ discard block |
||
| 128 | 128 | break; |
| 129 | 129 | |
| 130 | 130 | default : |
| 131 | - return $pretty ? $this->_pretty_date_format . ' ' . $this->_pretty_time_format : $this->_date_format . ' ' . $this->_time_format; |
|
| 131 | + return $pretty ? $this->_pretty_date_format.' '.$this->_pretty_time_format : $this->_date_format.' '.$this->_time_format; |
|
| 132 | 132 | } |
| 133 | 133 | } |
| 134 | 134 | |
@@ -142,7 +142,7 @@ discard block |
||
| 142 | 142 | * @param string $what acceptable values are 'time' or 'date'. Any other value will be set but will always result in both 'date' and 'time' being returned. |
| 143 | 143 | * @return void |
| 144 | 144 | */ |
| 145 | - public function set_date_time_output( $what = NULL ) { |
|
| 145 | + public function set_date_time_output($what = NULL) { |
|
| 146 | 146 | $this->_date_time_output = $what; |
| 147 | 147 | } |
| 148 | 148 | |
@@ -158,23 +158,23 @@ discard block |
||
| 158 | 158 | * @param string $timezone A valid timezone string as described by @link http://www.php.net/manual/en/timezones.php |
| 159 | 159 | * @return void |
| 160 | 160 | */ |
| 161 | - public function set_timezone( $timezone ) { |
|
| 162 | - if( $timezone === NULL && $this->_timezone != NULL){ |
|
| 161 | + public function set_timezone($timezone) { |
|
| 162 | + if ($timezone === NULL && $this->_timezone != NULL) { |
|
| 163 | 163 | //leave the timezone AS-IS if we already have one and |
| 164 | 164 | //the function arg didn't provide one |
| 165 | 165 | return; |
| 166 | 166 | } |
| 167 | - $this->_timezone = empty( $timezone ) ? get_option('timezone_string') : $timezone; |
|
| 167 | + $this->_timezone = empty($timezone) ? get_option('timezone_string') : $timezone; |
|
| 168 | 168 | |
| 169 | 169 | //if timezone is STILL empty then let's get the GMT offset and then set the timezone_string using our converter |
| 170 | - if ( empty( $this->_timezone ) ) { |
|
| 170 | + if (empty($this->_timezone)) { |
|
| 171 | 171 | //let's get a the WordPress UTC offset |
| 172 | 172 | $offset = get_option('gmt_offset'); |
| 173 | 173 | $this->_blog_offset = $offset; |
| 174 | - $this->_timezone = self::timezone_convert_to_string_from_offset( $offset ); |
|
| 174 | + $this->_timezone = self::timezone_convert_to_string_from_offset($offset); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | - self::validate_timezone( $this->_timezone ); //just running validation on the timezone. |
|
| 177 | + self::validate_timezone($this->_timezone); //just running validation on the timezone. |
|
| 178 | 178 | } |
| 179 | 179 | |
| 180 | 180 | |
@@ -198,7 +198,7 @@ discard block |
||
| 198 | 198 | * @param string $format a new date format (corresponding to formats accepted by PHP date() function) |
| 199 | 199 | * @return void |
| 200 | 200 | */ |
| 201 | - public function set_date_format( $format ) { |
|
| 201 | + public function set_date_format($format) { |
|
| 202 | 202 | $this->_date_format = $format; |
| 203 | 203 | } |
| 204 | 204 | |
@@ -212,7 +212,7 @@ discard block |
||
| 212 | 212 | * @param string $format a new time format (corresponding to formats accepted by PHP date() function) |
| 213 | 213 | * @return void |
| 214 | 214 | */ |
| 215 | - public function set_time_format( $format ) { |
|
| 215 | + public function set_time_format($format) { |
|
| 216 | 216 | $this->_time_format = $format; |
| 217 | 217 | } |
| 218 | 218 | |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | * @param string $format a new pretty date format (corresponding to formats accepted by PHP date() function) |
| 228 | 228 | * @return void |
| 229 | 229 | */ |
| 230 | - public function set_pretty_date_format( $format ) { |
|
| 230 | + public function set_pretty_date_format($format) { |
|
| 231 | 231 | $this->_pretty_date_format = $format; |
| 232 | 232 | } |
| 233 | 233 | |
@@ -244,7 +244,7 @@ discard block |
||
| 244 | 244 | * @param string $format a new pretty time format (corresponding to formats accepted by PHP date() function) |
| 245 | 245 | * @return void |
| 246 | 246 | */ |
| 247 | - public function set_pretty_time_format( $format ) { |
|
| 247 | + public function set_pretty_time_format($format) { |
|
| 248 | 248 | $this->_pretty_time_format = $format; |
| 249 | 249 | } |
| 250 | 250 | |
@@ -257,12 +257,12 @@ discard block |
||
| 257 | 257 | * @throws EE_Error |
| 258 | 258 | * @return int updated timestamp |
| 259 | 259 | */ |
| 260 | - public function prepare_for_set_with_new_time($time_to_set_string, $current_datetime_value ){ |
|
| 261 | - $this->_set_date_obj( date( $this->_date_format . ' ' . $this->_time_format, $current_datetime_value), 'UTC' ); |
|
| 262 | - if ( ! $this->_date instanceof DateTime && ! $this->_nullable ) { |
|
| 263 | - throw new EE_Error( __('Something went wrong with setting the date/time. Likely, either there is an invalid datetime string or an invalid timezone string being used.', 'event_espresso' ) ); |
|
| 260 | + public function prepare_for_set_with_new_time($time_to_set_string, $current_datetime_value) { |
|
| 261 | + $this->_set_date_obj(date($this->_date_format.' '.$this->_time_format, $current_datetime_value), 'UTC'); |
|
| 262 | + if ( ! $this->_date instanceof DateTime && ! $this->_nullable) { |
|
| 263 | + throw new EE_Error(__('Something went wrong with setting the date/time. Likely, either there is an invalid datetime string or an invalid timezone string being used.', 'event_espresso')); |
|
| 264 | 264 | } |
| 265 | - return $this->_prepare_for_set_new( $time_to_set_string, TRUE ); |
|
| 265 | + return $this->_prepare_for_set_new($time_to_set_string, TRUE); |
|
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | |
@@ -274,12 +274,12 @@ discard block |
||
| 274 | 274 | * @throws EE_Error |
| 275 | 275 | * @return int updated timestamp |
| 276 | 276 | */ |
| 277 | - public function prepare_for_set_with_new_date($date_to_set_string, $current_datetime_value ){ |
|
| 278 | - $this->_set_date_obj( date( $this->_date_format . ' ' . $this->_time_format, $current_datetime_value ), 'UTC' ); |
|
| 279 | - if ( ! $this->_date instanceof DateTime && ! $this->_nullable ) { |
|
| 280 | - throw new EE_Error( __('Something went wrong with setting the date/time. Likely, either there is an invalid datetime string or an invalid timezone string being used.', 'event_espresso' ) ); |
|
| 277 | + public function prepare_for_set_with_new_date($date_to_set_string, $current_datetime_value) { |
|
| 278 | + $this->_set_date_obj(date($this->_date_format.' '.$this->_time_format, $current_datetime_value), 'UTC'); |
|
| 279 | + if ( ! $this->_date instanceof DateTime && ! $this->_nullable) { |
|
| 280 | + throw new EE_Error(__('Something went wrong with setting the date/time. Likely, either there is an invalid datetime string or an invalid timezone string being used.', 'event_espresso')); |
|
| 281 | 281 | } |
| 282 | - return $this->_prepare_for_set_new( $date_to_set_string ); |
|
| 282 | + return $this->_prepare_for_set_new($date_to_set_string); |
|
| 283 | 283 | } |
| 284 | 284 | |
| 285 | 285 | |
@@ -292,11 +292,11 @@ discard block |
||
| 292 | 292 | * @param int $datetime_value This will always be a unix timestamp in UTC because that's what the internal data type of the date time property is. |
| 293 | 293 | * @return string formatted date time for given timezone |
| 294 | 294 | */ |
| 295 | - public function prepare_for_get( $datetime_value ) { |
|
| 295 | + public function prepare_for_get($datetime_value) { |
|
| 296 | 296 | |
| 297 | 297 | $format_string = $this->_get_date_time_output(); |
| 298 | 298 | //send this to our formatter to return localized time for the timezone |
| 299 | - return $this->_convert_to_timezone_from_utc_unix_timestamp( $datetime_value, $format_string ); |
|
| 299 | + return $this->_convert_to_timezone_from_utc_unix_timestamp($datetime_value, $format_string); |
|
| 300 | 300 | } |
| 301 | 301 | |
| 302 | 302 | |
@@ -310,19 +310,19 @@ discard block |
||
| 310 | 310 | * @internal param mixed $value_on_field_to_be_outputted |
| 311 | 311 | * @return mixed |
| 312 | 312 | */ |
| 313 | - public function prepare_for_pretty_echoing( $datetime_value, $schema = null ) { |
|
| 314 | - if( $this->_display_timezone() ) { |
|
| 315 | - if( $schema == 'no_html' ){ |
|
| 316 | - $timezone_string = '(' . self::get_timezone_abbrev( $this->_timezone ) . ')'; |
|
| 317 | - }else{ |
|
| 318 | - $timezone_string = '<span class="ee_dtt_timezone_string">(' . self::get_timezone_abbrev($this->_timezone) . ')</span>'; |
|
| 313 | + public function prepare_for_pretty_echoing($datetime_value, $schema = null) { |
|
| 314 | + if ($this->_display_timezone()) { |
|
| 315 | + if ($schema == 'no_html') { |
|
| 316 | + $timezone_string = '('.self::get_timezone_abbrev($this->_timezone).')'; |
|
| 317 | + } else { |
|
| 318 | + $timezone_string = '<span class="ee_dtt_timezone_string">('.self::get_timezone_abbrev($this->_timezone).')</span>'; |
|
| 319 | 319 | } |
| 320 | 320 | } else { |
| 321 | 321 | $timezone_string = ''; |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | - $format_string = $this->_get_date_time_output( TRUE ); |
|
| 325 | - return $this->_convert_to_timezone_from_utc_unix_timestamp( $datetime_value, $format_string ) . $timezone_string; |
|
| 324 | + $format_string = $this->_get_date_time_output(TRUE); |
|
| 325 | + return $this->_convert_to_timezone_from_utc_unix_timestamp($datetime_value, $format_string).$timezone_string; |
|
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | |
@@ -333,8 +333,8 @@ discard block |
||
| 333 | 333 | * @param int $datetime_value unix timestamp in UTC |
| 334 | 334 | * @return string mysql timestamp in UTC |
| 335 | 335 | */ |
| 336 | - public function prepare_for_use_in_db( $datetime_value ) { |
|
| 337 | - return $this->_nullable && empty( $datetime_value) ? NULL : date( "Y-m-d H:i:s", $datetime_value ); |
|
| 336 | + public function prepare_for_use_in_db($datetime_value) { |
|
| 337 | + return $this->_nullable && empty($datetime_value) ? NULL : date("Y-m-d H:i:s", $datetime_value); |
|
| 338 | 338 | } |
| 339 | 339 | |
| 340 | 340 | |
@@ -346,8 +346,8 @@ discard block |
||
| 346 | 346 | * @param string $datetime_value mysql timestamp in UTC |
| 347 | 347 | * @return int UnixTime in UTC |
| 348 | 348 | */ |
| 349 | - public function prepare_for_set_from_db( $datetime_value ) { |
|
| 350 | - return $this->_nullable && empty( $datetime_value ) ? NULL : strtotime( $datetime_value ); |
|
| 349 | + public function prepare_for_set_from_db($datetime_value) { |
|
| 350 | + return $this->_nullable && empty($datetime_value) ? NULL : strtotime($datetime_value); |
|
| 351 | 351 | } |
| 352 | 352 | |
| 353 | 353 | |
@@ -359,17 +359,17 @@ discard block |
||
| 359 | 359 | * @throws EE_Error |
| 360 | 360 | * @return string final converted date-time-zone. |
| 361 | 361 | */ |
| 362 | - private function _convert_to_timezone_from_utc_unix_timestamp( $datetime_value, $format ) { |
|
| 363 | - if ( $this->_nullable && empty( $datetime_value )) { |
|
| 362 | + private function _convert_to_timezone_from_utc_unix_timestamp($datetime_value, $format) { |
|
| 363 | + if ($this->_nullable && empty($datetime_value)) { |
|
| 364 | 364 | return NULL; |
| 365 | 365 | } |
| 366 | - $datetime = date( 'Y-m-d H:i:s', (int)$datetime_value ); |
|
| 367 | - $this->_set_date_obj( $datetime, 'UTC' ); |
|
| 368 | - if ( ! $this->_date instanceof DateTime ) { |
|
| 369 | - throw new EE_Error( sprintf( __('Something went wrong with setting the date/time. Likely, either there is an invalid datetime string or an invalid timezone string being used on %s', 'event_espresso' ) , $this->get_model_name() ) ); |
|
| 366 | + $datetime = date('Y-m-d H:i:s', (int) $datetime_value); |
|
| 367 | + $this->_set_date_obj($datetime, 'UTC'); |
|
| 368 | + if ( ! $this->_date instanceof DateTime) { |
|
| 369 | + throw new EE_Error(sprintf(__('Something went wrong with setting the date/time. Likely, either there is an invalid datetime string or an invalid timezone string being used on %s', 'event_espresso'), $this->get_model_name())); |
|
| 370 | 370 | } |
| 371 | - $this->_date->setTimezone( new DateTimeZone( $this->_timezone ) ); |
|
| 372 | - return $this->_date->format( $format ); |
|
| 371 | + $this->_date->setTimezone(new DateTimeZone($this->_timezone)); |
|
| 372 | + return $this->_date->format($format); |
|
| 373 | 373 | |
| 374 | 374 | } |
| 375 | 375 | |
@@ -388,22 +388,22 @@ discard block |
||
| 388 | 388 | * @param boolean $is_time If this is a time adjustment set this boolean flag to true, otherwise it is a date adjustment |
| 389 | 389 | * @return int UTC UnixTimestamp |
| 390 | 390 | */ |
| 391 | - private function _prepare_for_set_new( $datetime_adjustment, $is_time = FALSE ) { |
|
| 392 | - if ( $this->_nullable && empty( $datetime_adjustment ) ) { |
|
| 391 | + private function _prepare_for_set_new($datetime_adjustment, $is_time = FALSE) { |
|
| 392 | + if ($this->_nullable && empty($datetime_adjustment)) { |
|
| 393 | 393 | return NULL; |
| 394 | 394 | } |
| 395 | 395 | //first let's parse the incoming string |
| 396 | - $parsed = date_parse( $datetime_adjustment ); |
|
| 396 | + $parsed = date_parse($datetime_adjustment); |
|
| 397 | 397 | //set the timezone to the incoming timezone for the current date_object |
| 398 | - $this->_date->setTimezone( new DateTimeZone( $this->_timezone ) ); |
|
| 398 | + $this->_date->setTimezone(new DateTimeZone($this->_timezone)); |
|
| 399 | 399 | //let's adjust the time or date depending on our $is_time boolean |
| 400 | - if ( $is_time ) { |
|
| 401 | - $this->_date->setTime( $parsed['hour'], $parsed['minute'] ); |
|
| 400 | + if ($is_time) { |
|
| 401 | + $this->_date->setTime($parsed['hour'], $parsed['minute']); |
|
| 402 | 402 | } else { |
| 403 | - $this->_date->setDate( $parsed['year'], $parsed['month'], $parsed['day'] ); |
|
| 403 | + $this->_date->setDate($parsed['year'], $parsed['month'], $parsed['day']); |
|
| 404 | 404 | } |
| 405 | 405 | //return to UTC time |
| 406 | - $this->_date->setTimezone( EE_Datetime_Field::get_UTC_DateTimeZone() ); |
|
| 406 | + $this->_date->setTimezone(EE_Datetime_Field::get_UTC_DateTimeZone()); |
|
| 407 | 407 | //return unix timestamp |
| 408 | 408 | return $this->_date->format('U'); |
| 409 | 409 | } |
@@ -418,10 +418,10 @@ discard block |
||
| 418 | 418 | * @param string|int $datetime This can be either an integer timestamp (in which case this method will convert from int to string first to make sure we get the right timezone setup ) |
| 419 | 419 | * @return string unix timestamp for utc |
| 420 | 420 | */ |
| 421 | - private function _convert_to_utc_unix_timestamp( $datetime ) { |
|
| 422 | - if ( $this->_nullable && empty( $datetime ) ) |
|
| 421 | + private function _convert_to_utc_unix_timestamp($datetime) { |
|
| 422 | + if ($this->_nullable && empty($datetime)) |
|
| 423 | 423 | return NULL; |
| 424 | - $timestamp = is_numeric( $datetime ) ? $this->_convert_from_numeric_value_to_utc_unix_timestamp( $datetime ) : $this->_convert_from_string_value_to_utc_unix_timestamp( $datetime ); |
|
| 424 | + $timestamp = is_numeric($datetime) ? $this->_convert_from_numeric_value_to_utc_unix_timestamp($datetime) : $this->_convert_from_string_value_to_utc_unix_timestamp($datetime); |
|
| 425 | 425 | return $timestamp; |
| 426 | 426 | } |
| 427 | 427 | |
@@ -432,15 +432,15 @@ discard block |
||
| 432 | 432 | * @return bool|int|string |
| 433 | 433 | * @throws EE_Error |
| 434 | 434 | */ |
| 435 | - private function _convert_from_numeric_value_to_utc_unix_timestamp( $datetime ) { |
|
| 436 | - $datetime = date( 'Y-m-d H:i:s', (int) $datetime); |
|
| 435 | + private function _convert_from_numeric_value_to_utc_unix_timestamp($datetime) { |
|
| 436 | + $datetime = date('Y-m-d H:i:s', (int) $datetime); |
|
| 437 | 437 | |
| 438 | - date_default_timezone_set( $this->_timezone ); |
|
| 438 | + date_default_timezone_set($this->_timezone); |
|
| 439 | 439 | $timestamp = strtotime($datetime); |
| 440 | 440 | |
| 441 | 441 | //if we don't have a datetime at this point then something has gone wrong |
| 442 | - if ( $timestamp === NULL || $timestamp === FALSE) { |
|
| 443 | - throw new EE_Error( sprintf( __('Something went wrong with setting the date/time. Likely, either there is an invalid timezone string or invalid timestamp being used. Datetime passed in: %s producted timestamp: %s', 'event_espresso' ), $datetime, $timestamp ) ); |
|
| 442 | + if ($timestamp === NULL || $timestamp === FALSE) { |
|
| 443 | + throw new EE_Error(sprintf(__('Something went wrong with setting the date/time. Likely, either there is an invalid timezone string or invalid timestamp being used. Datetime passed in: %s producted timestamp: %s', 'event_espresso'), $datetime, $timestamp)); |
|
| 444 | 444 | } |
| 445 | 445 | |
| 446 | 446 | //return to default for PHP |
@@ -457,15 +457,15 @@ discard block |
||
| 457 | 457 | * @return string |
| 458 | 458 | * @throws EE_Error |
| 459 | 459 | */ |
| 460 | - private function _convert_from_string_value_to_utc_unix_timestamp( $datetime ) { |
|
| 460 | + private function _convert_from_string_value_to_utc_unix_timestamp($datetime) { |
|
| 461 | 461 | //create a new datetime object using the given string and timezone |
| 462 | - $this->_set_date_obj( $datetime, $this->_timezone ); |
|
| 462 | + $this->_set_date_obj($datetime, $this->_timezone); |
|
| 463 | 463 | |
| 464 | - if ( ! $this->_date instanceof DateTime && ! $this->_nullable ) { |
|
| 465 | - throw new EE_Error( __('Something went wrong with setting the date/time. Likely, either there is an invalid datetime string or an invalid timezone string being used.', 'event_espresso' ) ); |
|
| 464 | + if ( ! $this->_date instanceof DateTime && ! $this->_nullable) { |
|
| 465 | + throw new EE_Error(__('Something went wrong with setting the date/time. Likely, either there is an invalid datetime string or an invalid timezone string being used.', 'event_espresso')); |
|
| 466 | 466 | } |
| 467 | 467 | |
| 468 | - $this->_date->setTimezone( EE_Datetime_Field::get_UTC_DateTimeZone() ); |
|
| 468 | + $this->_date->setTimezone(EE_Datetime_Field::get_UTC_DateTimeZone()); |
|
| 469 | 469 | return $this->_date->format('U'); |
| 470 | 470 | |
| 471 | 471 | } |
@@ -481,13 +481,13 @@ discard block |
||
| 481 | 481 | * @throws EE_Error |
| 482 | 482 | * @return boolean Return True if Valid, False if Invalid |
| 483 | 483 | */ |
| 484 | - public static function validate_timezone( $timezone_string ) { |
|
| 484 | + public static function validate_timezone($timezone_string) { |
|
| 485 | 485 | // easiest way to test a timezone string is just see if it throws an error when you try to create a DateTimeZone object with it |
| 486 | 486 | try { |
| 487 | - new DateTimeZone( $timezone_string ); |
|
| 488 | - } catch ( Exception $e ) { |
|
| 489 | - throw new EE_Error( sprintf( |
|
| 490 | - __( 'The timezone given (%s), is invalid, please check with %sthis list%s for what valid timezones can be used', 'event_espresso' ), |
|
| 487 | + new DateTimeZone($timezone_string); |
|
| 488 | + } catch (Exception $e) { |
|
| 489 | + throw new EE_Error(sprintf( |
|
| 490 | + __('The timezone given (%s), is invalid, please check with %sthis list%s for what valid timezones can be used', 'event_espresso'), |
|
| 491 | 491 | $timezone_string, |
| 492 | 492 | '<a href="http://www.php.net/manual/en/timezones.php">', |
| 493 | 493 | '</a>' |
@@ -506,13 +506,13 @@ discard block |
||
| 506 | 506 | * @param string $offset GMT offset |
| 507 | 507 | * @return string timezone_string (valid for DateTimeZone) |
| 508 | 508 | */ |
| 509 | - public static function timezone_convert_to_string_from_offset( $offset ) { |
|
| 509 | + public static function timezone_convert_to_string_from_offset($offset) { |
|
| 510 | 510 | $offset *= 3600; // convert hour offset to seconds |
| 511 | 511 | //make sure $offset is int (cause if incoming was int then converted to float); |
| 512 | 512 | $offset = (int) $offset; |
| 513 | 513 | |
| 514 | 514 | //account for WP offsets that aren't valid UTC |
| 515 | - switch ( $offset ) { |
|
| 515 | + switch ($offset) { |
|
| 516 | 516 | case -1800 : |
| 517 | 517 | $offset = -3600; |
| 518 | 518 | break; |
@@ -543,9 +543,9 @@ discard block |
||
| 543 | 543 | } |
| 544 | 544 | |
| 545 | 545 | $abbreviations = timezone_abbreviations_list(); |
| 546 | - foreach ( $abbreviations as $abbreviation ) { |
|
| 547 | - foreach ( $abbreviation as $city ) { |
|
| 548 | - if ( $city['offset'] === $offset && $city['dst'] === FALSE ) { |
|
| 546 | + foreach ($abbreviations as $abbreviation) { |
|
| 547 | + foreach ($abbreviation as $city) { |
|
| 548 | + if ($city['offset'] === $offset && $city['dst'] === FALSE) { |
|
| 549 | 549 | return $city['timezone_id']; |
| 550 | 550 | } |
| 551 | 551 | } |
@@ -561,18 +561,18 @@ discard block |
||
| 561 | 561 | * @param string $tz valid timezone string |
| 562 | 562 | * @return int if conversion can happen then we return the offset, if not then we return FALSE (or EE_Error) |
| 563 | 563 | */ |
| 564 | - public static function timezone_convert_to_offset_from_string( $tz ) { |
|
| 564 | + public static function timezone_convert_to_offset_from_string($tz) { |
|
| 565 | 565 | $abbreviations = timezone_abbreviations_list(); |
| 566 | 566 | $offset = NULL; |
| 567 | - foreach ( $abbreviations as $abbreviation ) { |
|
| 568 | - foreach ( $abbreviation as $city ) { |
|
| 569 | - if ( $city['timezone_id'] == $tz ) { |
|
| 567 | + foreach ($abbreviations as $abbreviation) { |
|
| 568 | + foreach ($abbreviation as $city) { |
|
| 569 | + if ($city['timezone_id'] == $tz) { |
|
| 570 | 570 | $offset = $city['offset']; |
| 571 | 571 | } |
| 572 | 572 | } |
| 573 | 573 | } |
| 574 | 574 | //$offset will be in seconds so let's convert to hours and make sure its an int |
| 575 | - return ! empty( $offset) ? (int)( $offset / 3600 ) : 0; |
|
| 575 | + return ! empty($offset) ? (int) ($offset / 3600) : 0; |
|
| 576 | 576 | } |
| 577 | 577 | |
| 578 | 578 | |
@@ -588,15 +588,15 @@ discard block |
||
| 588 | 588 | |
| 589 | 589 | //first let's do a comparison of timezone strings. If they match then we can get out without any further calculations |
| 590 | 590 | $blog_string = get_option('timezone_string'); |
| 591 | - if ( $blog_string == $this->_timezone ) |
|
| 591 | + if ($blog_string == $this->_timezone) |
|
| 592 | 592 | return FALSE; |
| 593 | 593 | |
| 594 | 594 | //now we need to calc the offset for the timezone string so we can compare with the blog offset. |
| 595 | - $this_offset = self::timezone_convert_to_offset_from_string( $this->_timezone ); |
|
| 596 | - $blog_offset = !empty( $this->_blog_offset ) ? $this->_blog_offset : self::timezone_convert_to_offset_from_string( $blog_string ); |
|
| 595 | + $this_offset = self::timezone_convert_to_offset_from_string($this->_timezone); |
|
| 596 | + $blog_offset = ! empty($this->_blog_offset) ? $this->_blog_offset : self::timezone_convert_to_offset_from_string($blog_string); |
|
| 597 | 597 | |
| 598 | 598 | //now compare |
| 599 | - if ( $blog_offset === $this_offset ) |
|
| 599 | + if ($blog_offset === $this_offset) |
|
| 600 | 600 | return FALSE; |
| 601 | 601 | |
| 602 | 602 | return TRUE; |
@@ -612,32 +612,32 @@ discard block |
||
| 612 | 612 | * @throws Exception |
| 613 | 613 | * @return void |
| 614 | 614 | */ |
| 615 | - private function _set_date_obj( $date_string, $timezone ) { |
|
| 616 | - if ( $this->_nullable && empty( $date_string ) ) { |
|
| 615 | + private function _set_date_obj($date_string, $timezone) { |
|
| 616 | + if ($this->_nullable && empty($date_string)) { |
|
| 617 | 617 | $this->_date = NULL; |
| 618 | 618 | return; |
| 619 | 619 | } |
| 620 | 620 | try { |
| 621 | 621 | //start off assuming it's a wonky excel format |
| 622 | - if ( version_compare( PHP_VERSION, '5.3.0' ) >= 0 ) { |
|
| 622 | + if (version_compare(PHP_VERSION, '5.3.0') >= 0) { |
|
| 623 | 623 | // maybe it's the Microsoft excel format '16/08/2013 8:58' ? |
| 624 | - $this->_date = DateTime::createFromFormat( 'd/m/Y H:i', $date_string, new DateTimeZone( $timezone )); |
|
| 624 | + $this->_date = DateTime::createFromFormat('d/m/Y H:i', $date_string, new DateTimeZone($timezone)); |
|
| 625 | 625 | } else { |
| 626 | 626 | //change 'd/m/Y H:i' to 'd-m-Y H:i' because of how strtotime() interprets date formats. see: http://www.php.net/manual/en/datetime.formats.date.php |
| 627 | - $this->_date = new DateTime( date( 'd-m-Y H:i', strtotime( $date_string )), new DateTimeZone( $timezone )); |
|
| 627 | + $this->_date = new DateTime(date('d-m-Y H:i', strtotime($date_string)), new DateTimeZone($timezone)); |
|
| 628 | 628 | } |
| 629 | - } catch( Exception $e ) {} |
|
| 629 | + } catch (Exception $e) {} |
|
| 630 | 630 | |
| 631 | - if( ! $this->_date ){ |
|
| 631 | + if ( ! $this->_date) { |
|
| 632 | 632 | try { |
| 633 | - $this->_date = new DateTime( $date_string, new DateTimeZone( $timezone )); |
|
| 634 | - } catch( Exception $e ) { |
|
| 633 | + $this->_date = new DateTime($date_string, new DateTimeZone($timezone)); |
|
| 634 | + } catch (Exception $e) { |
|
| 635 | 635 | // because DateTime chokes on some formats, check if strtotime fails, and throw error regarding bad format |
| 636 | - if ( strtotime( $date_string ) == 0 ) { |
|
| 637 | - throw new Exception( sprintf( __('The following date time \'%s\' can not be parsed by PHP due to its formatting.%sYou may need to choose a more standard date time format. Please check your WordPress Settings.', 'event_espresso' ), $date_string, '<br />' )); |
|
| 636 | + if (strtotime($date_string) == 0) { |
|
| 637 | + throw new Exception(sprintf(__('The following date time \'%s\' can not be parsed by PHP due to its formatting.%sYou may need to choose a more standard date time format. Please check your WordPress Settings.', 'event_espresso'), $date_string, '<br />')); |
|
| 638 | 638 | } else { |
| 639 | 639 | //ok give up, but don't throw an error |
| 640 | - $this->_date = new DateTime( NULL, new DateTimeZone( $timezone )); |
|
| 640 | + $this->_date = new DateTime(NULL, new DateTimeZone($timezone)); |
|
| 641 | 641 | } |
| 642 | 642 | } |
| 643 | 643 | } |
@@ -651,9 +651,9 @@ discard block |
||
| 651 | 651 | * @param string $timezone Valid timezone String |
| 652 | 652 | * @return string abbreviation |
| 653 | 653 | */ |
| 654 | - public static function get_timezone_abbrev( $timezone ) { |
|
| 654 | + public static function get_timezone_abbrev($timezone) { |
|
| 655 | 655 | $dateTime = new DateTime(); |
| 656 | - $dateTime->setTimeZone( new DateTimeZone($timezone) ); |
|
| 656 | + $dateTime->setTimeZone(new DateTimeZone($timezone)); |
|
| 657 | 657 | return $dateTime->format('T'); |
| 658 | 658 | } |
| 659 | 659 | |
@@ -314,7 +314,7 @@ discard block |
||
| 314 | 314 | if( $this->_display_timezone() ) { |
| 315 | 315 | if( $schema == 'no_html' ){ |
| 316 | 316 | $timezone_string = '(' . self::get_timezone_abbrev( $this->_timezone ) . ')'; |
| 317 | - }else{ |
|
| 317 | + } else{ |
|
| 318 | 318 | $timezone_string = '<span class="ee_dtt_timezone_string">(' . self::get_timezone_abbrev($this->_timezone) . ')</span>'; |
| 319 | 319 | } |
| 320 | 320 | } else { |
@@ -419,8 +419,9 @@ discard block |
||
| 419 | 419 | * @return string unix timestamp for utc |
| 420 | 420 | */ |
| 421 | 421 | private function _convert_to_utc_unix_timestamp( $datetime ) { |
| 422 | - if ( $this->_nullable && empty( $datetime ) ) |
|
| 423 | - return NULL; |
|
| 422 | + if ( $this->_nullable && empty( $datetime ) ) { |
|
| 423 | + return NULL; |
|
| 424 | + } |
|
| 424 | 425 | $timestamp = is_numeric( $datetime ) ? $this->_convert_from_numeric_value_to_utc_unix_timestamp( $datetime ) : $this->_convert_from_string_value_to_utc_unix_timestamp( $datetime ); |
| 425 | 426 | return $timestamp; |
| 426 | 427 | } |
@@ -588,16 +589,18 @@ discard block |
||
| 588 | 589 | |
| 589 | 590 | //first let's do a comparison of timezone strings. If they match then we can get out without any further calculations |
| 590 | 591 | $blog_string = get_option('timezone_string'); |
| 591 | - if ( $blog_string == $this->_timezone ) |
|
| 592 | - return FALSE; |
|
| 592 | + if ( $blog_string == $this->_timezone ) { |
|
| 593 | + return FALSE; |
|
| 594 | + } |
|
| 593 | 595 | |
| 594 | 596 | //now we need to calc the offset for the timezone string so we can compare with the blog offset. |
| 595 | 597 | $this_offset = self::timezone_convert_to_offset_from_string( $this->_timezone ); |
| 596 | 598 | $blog_offset = !empty( $this->_blog_offset ) ? $this->_blog_offset : self::timezone_convert_to_offset_from_string( $blog_string ); |
| 597 | 599 | |
| 598 | 600 | //now compare |
| 599 | - if ( $blog_offset === $this_offset ) |
|
| 600 | - return FALSE; |
|
| 601 | + if ( $blog_offset === $this_offset ) { |
|
| 602 | + return FALSE; |
|
| 603 | + } |
|
| 601 | 604 | |
| 602 | 605 | return TRUE; |
| 603 | 606 | |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
| 2 | -require_once( EE_MODELS . 'fields/EE_Integer_Field.php' ); |
|
| 2 | +require_once(EE_MODELS.'fields/EE_Integer_Field.php'); |
|
| 3 | 3 | /** |
| 4 | 4 | * Class EE_Enum_Integer_Field |
| 5 | 5 | * |
@@ -8,7 +8,7 @@ discard block |
||
| 8 | 8 | * @author Mike Nelson |
| 9 | 9 | * |
| 10 | 10 | */ |
| 11 | -class EE_Enum_Integer_Field extends EE_Integer_Field{ |
|
| 11 | +class EE_Enum_Integer_Field extends EE_Integer_Field { |
|
| 12 | 12 | |
| 13 | 13 | var $_allowed_enum_values; |
| 14 | 14 | |
@@ -20,7 +20,7 @@ discard block |
||
| 20 | 20 | * @param int $default_value |
| 21 | 21 | * @param array $allowed_enum_values keys are values to be used in the DB, values are how they should be displayed |
| 22 | 22 | */ |
| 23 | - function __construct($table_column, $nicename, $nullable, $default_value, $allowed_enum_values){ |
|
| 23 | + function __construct($table_column, $nicename, $nullable, $default_value, $allowed_enum_values) { |
|
| 24 | 24 | $this->_allowed_enum_values = $allowed_enum_values; |
| 25 | 25 | parent::__construct($table_column, $nicename, $nullable, $default_value); |
| 26 | 26 | } |
@@ -32,21 +32,21 @@ discard block |
||
| 32 | 32 | * @throws EE_Error |
| 33 | 33 | */ |
| 34 | 34 | function prepare_for_set($value_inputted_for_field_on_model_object) { |
| 35 | - if( $value_inputted_for_field_on_model_object !== NULL && ! array_key_exists( $value_inputted_for_field_on_model_object, $this->_allowed_enum_values )){ |
|
| 36 | - if( defined( 'WP_DEBUG' ) && WP_DEBUG ){ |
|
| 35 | + if ($value_inputted_for_field_on_model_object !== NULL && ! array_key_exists($value_inputted_for_field_on_model_object, $this->_allowed_enum_values)) { |
|
| 36 | + if (defined('WP_DEBUG') && WP_DEBUG) { |
|
| 37 | 37 | $msg = sprintf( |
| 38 | - __('System is assigning incompatible value "%1$s" to field "%2$s"','event_espresso'), |
|
| 38 | + __('System is assigning incompatible value "%1$s" to field "%2$s"', 'event_espresso'), |
|
| 39 | 39 | $value_inputted_for_field_on_model_object, |
| 40 | 40 | $this->_name |
| 41 | 41 | ); |
| 42 | 42 | $msg2 = sprintf( |
| 43 | - __('Allowed values for "%1$s" are "%2$s". You provided "%3$s"','event_espresso'), |
|
| 43 | + __('Allowed values for "%1$s" are "%2$s". You provided "%3$s"', 'event_espresso'), |
|
| 44 | 44 | $this->_name, |
| 45 | - implode( ', ', array_keys( $this->_allowed_enum_values )), |
|
| 45 | + implode(', ', array_keys($this->_allowed_enum_values)), |
|
| 46 | 46 | $value_inputted_for_field_on_model_object |
| 47 | 47 | ); |
| 48 | 48 | throw new EE_Error("$msg||$msg2"); |
| 49 | - }else{ |
|
| 49 | + } else { |
|
| 50 | 50 | return $this->get_default_value(); |
| 51 | 51 | } |
| 52 | 52 | } |
@@ -62,7 +62,7 @@ discard block |
||
| 62 | 62 | * @param null $schema |
| 63 | 63 | * @return string |
| 64 | 64 | */ |
| 65 | - function prepare_for_pretty_echoing( $value_on_field_to_be_outputted, $schema = NULL ) { |
|
| 65 | + function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = NULL) { |
|
| 66 | 66 | return $this->_allowed_enum_values[$value_on_field_to_be_outputted]; |
| 67 | 67 | } |
| 68 | 68 | } |
@@ -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 | require_once( EE_MODELS . 'fields/EE_Integer_Field.php' ); |
| 3 | 5 | /** |
| 4 | 6 | * Class EE_Enum_Integer_Field |
@@ -46,7 +48,7 @@ discard block |
||
| 46 | 48 | $value_inputted_for_field_on_model_object |
| 47 | 49 | ); |
| 48 | 50 | throw new EE_Error("$msg||$msg2"); |
| 49 | - }else{ |
|
| 51 | + } else{ |
|
| 50 | 52 | return $this->get_default_value(); |
| 51 | 53 | } |
| 52 | 54 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php |
| 2 | -require_once( EE_MODELS . 'fields/EE_Text_Field_Base.php' ); |
|
| 2 | +require_once(EE_MODELS.'fields/EE_Text_Field_Base.php'); |
|
| 3 | 3 | /** |
| 4 | 4 | * |
| 5 | 5 | * Class EE_Enum_Text_Field |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * @param mixed $default_value |
| 24 | 24 | * @param array $allowed_enum_values keys are values to be used in the DB, values are how they should be displayed |
| 25 | 25 | */ |
| 26 | - function __construct($table_column, $nice_name, $nullable, $default_value, $allowed_enum_values){ |
|
| 26 | + function __construct($table_column, $nice_name, $nullable, $default_value, $allowed_enum_values) { |
|
| 27 | 27 | $this->_allowed_enum_values = $allowed_enum_values; |
| 28 | 28 | parent::__construct($table_column, $nice_name, $nullable, $default_value); |
| 29 | 29 | } |
@@ -38,12 +38,12 @@ discard block |
||
| 38 | 38 | * @throws EE_Error |
| 39 | 39 | */ |
| 40 | 40 | function prepare_for_set($value_inputted_for_field_on_model_object) { |
| 41 | - if($value_inputted_for_field_on_model_object!==null && !array_key_exists($value_inputted_for_field_on_model_object,$this->_allowed_enum_values)){ |
|
| 42 | - if(WP_DEBUG){ |
|
| 43 | - $msg = sprintf(__("System is assigning incompatible value '%s' to field '%s'",'event_espresso'),$value_inputted_for_field_on_model_object,$this->_name); |
|
| 44 | - $msg2 = sprintf(__("Allowed values for '%s' are %s. You provided %s",'event_espresso'),$this->_name,implode(", ",array_keys($this->_allowed_enum_values)),$value_inputted_for_field_on_model_object); |
|
| 41 | + if ($value_inputted_for_field_on_model_object !== null && ! array_key_exists($value_inputted_for_field_on_model_object, $this->_allowed_enum_values)) { |
|
| 42 | + if (WP_DEBUG) { |
|
| 43 | + $msg = sprintf(__("System is assigning incompatible value '%s' to field '%s'", 'event_espresso'), $value_inputted_for_field_on_model_object, $this->_name); |
|
| 44 | + $msg2 = sprintf(__("Allowed values for '%s' are %s. You provided %s", 'event_espresso'), $this->_name, implode(", ", array_keys($this->_allowed_enum_values)), $value_inputted_for_field_on_model_object); |
|
| 45 | 45 | throw new EE_Error("$msg||$msg2"); |
| 46 | - }else{ |
|
| 46 | + } else { |
|
| 47 | 47 | return $this->get_default_value(); |
| 48 | 48 | } |
| 49 | 49 | } |
@@ -43,7 +43,7 @@ |
||
| 43 | 43 | $msg = sprintf(__("System is assigning incompatible value '%s' to field '%s'",'event_espresso'),$value_inputted_for_field_on_model_object,$this->_name); |
| 44 | 44 | $msg2 = sprintf(__("Allowed values for '%s' are %s. You provided %s",'event_espresso'),$this->_name,implode(", ",array_keys($this->_allowed_enum_values)),$value_inputted_for_field_on_model_object); |
| 45 | 45 | throw new EE_Error("$msg||$msg2"); |
| 46 | - }else{ |
|
| 46 | + } else{ |
|
| 47 | 47 | return $this->get_default_value(); |
| 48 | 48 | } |
| 49 | 49 | } |
@@ -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 | * Event Espresso |
| 4 | 6 | * |
@@ -217,7 +219,7 @@ discard block |
||
| 217 | 219 | $post_id = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_content LIKE '%$shortcode_and_opening_bracket%' LIMIT 1"); |
| 218 | 220 | if($post_id){ |
| 219 | 221 | return get_post($post_id); |
| 220 | - }else{ |
|
| 222 | + } else{ |
|
| 221 | 223 | return NULL; |
| 222 | 224 | } |
| 223 | 225 | |
@@ -382,7 +384,7 @@ discard block |
||
| 382 | 384 | if($drop_table_if_pre_existed && EEH_Activation::table_exists( $wp_table_name ) ){ |
| 383 | 385 | if( defined( 'EE_DROP_BAD_TABLES' ) && EE_DROP_BAD_TABLES ){ |
| 384 | 386 | $wpdb->query("DROP TABLE IF EXISTS $wp_table_name "); |
| 385 | - }else{ |
|
| 387 | + } else{ |
|
| 386 | 388 | //so we should be more cautious rather than just dropping tables so easily |
| 387 | 389 | EE_Error::add_persistent_admin_notice( |
| 388 | 390 | 'bad_table_' . $wp_table_name . '_detected', |
@@ -533,13 +535,13 @@ discard block |
||
| 533 | 535 | foreach( $current_data_migration_script->get_errors() as $error ){ |
| 534 | 536 | EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__ ); |
| 535 | 537 | } |
| 536 | - }else{ |
|
| 538 | + } else{ |
|
| 537 | 539 | EE_Error::add_error( __( 'There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso' ) ); |
| 538 | 540 | } |
| 539 | 541 | return FALSE; |
| 540 | 542 | } |
| 541 | 543 | EE_Data_Migration_Manager::instance()->update_current_database_state_to(); |
| 542 | - }else{ |
|
| 544 | + } else{ |
|
| 543 | 545 | EE_Error::add_error( __( 'Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
| 544 | 546 | return FALSE; |
| 545 | 547 | } |
@@ -828,7 +830,7 @@ discard block |
||
| 828 | 830 | if( ! EEM_Payment_Method::instance()->count_active( EEM_Payment_Method::scope_cart ) ){ |
| 829 | 831 | EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
| 830 | 832 | EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' ); |
| 831 | - }else{ |
|
| 833 | + } else{ |
|
| 832 | 834 | EEM_Payment_Method::instance()->verify_button_urls(); |
| 833 | 835 | } |
| 834 | 836 | } |
@@ -977,7 +979,9 @@ discard block |
||
| 977 | 979 | //do an initial loop to determine if we need to continue |
| 978 | 980 | $def_ms = array(); |
| 979 | 981 | foreach ( $default_messengers as $msgr ) { |
| 980 | - if ( isset($active_messengers[$msgr] ) || isset( $has_activated[$msgr] ) ) continue; |
|
| 982 | + if ( isset($active_messengers[$msgr] ) || isset( $has_activated[$msgr] ) ) { |
|
| 983 | + continue; |
|
| 984 | + } |
|
| 981 | 985 | $def_ms[] = $msgr; |
| 982 | 986 | } |
| 983 | 987 | |
@@ -1303,7 +1307,7 @@ discard block |
||
| 1303 | 1307 | if( ! delete_option( $option_name ) ){ |
| 1304 | 1308 | $undeleted_options[] = $option_name; |
| 1305 | 1309 | } |
| 1306 | - }else{ |
|
| 1310 | + } else{ |
|
| 1307 | 1311 | $option_names_to_delete_from_wildcard = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'" ); |
| 1308 | 1312 | foreach($option_names_to_delete_from_wildcard as $option_name_from_wildcard ){ |
| 1309 | 1313 | if( ! delete_option( $option_name_from_wildcard ) ){ |
@@ -1369,7 +1373,7 @@ discard block |
||
| 1369 | 1373 | $EZSQL_ERROR = $ezsql_error_cache; |
| 1370 | 1374 | if( empty( $new_error ) ){ |
| 1371 | 1375 | return TRUE; |
| 1372 | - }else{ |
|
| 1376 | + } else{ |
|
| 1373 | 1377 | return FALSE; |
| 1374 | 1378 | } |
| 1375 | 1379 | } |
@@ -47,7 +47,7 @@ discard block |
||
| 47 | 47 | * be called on plugin activation and reactivation |
| 48 | 48 | * @return boolean success, whether the database and folders are setup properly |
| 49 | 49 | */ |
| 50 | - public static function initialize_db_and_folders(){ |
|
| 50 | + public static function initialize_db_and_folders() { |
|
| 51 | 51 | $good_filesystem = EEH_Activation::create_upload_directories(); |
| 52 | 52 | $good_db = EEH_Activation::create_database_tables(); |
| 53 | 53 | return $good_filesystem && $good_db; |
@@ -59,7 +59,7 @@ discard block |
||
| 59 | 59 | * upon activation of a new plugin, reactivation, and at the end |
| 60 | 60 | * of running migration scripts |
| 61 | 61 | */ |
| 62 | - public static function initialize_db_content(){ |
|
| 62 | + public static function initialize_db_content() { |
|
| 63 | 63 | EEH_Activation::initialize_system_questions(); |
| 64 | 64 | EEH_Activation::insert_default_status_codes(); |
| 65 | 65 | EEH_Activation::generate_default_message_templates(); |
@@ -69,7 +69,7 @@ discard block |
||
| 69 | 69 | EEH_Activation::validate_messages_system(); |
| 70 | 70 | EEH_Activation::insert_default_payment_methods(); |
| 71 | 71 | //also, check for CAF default db content |
| 72 | - do_action( 'AHEE__EEH_Activation__initialize_db_content' ); |
|
| 72 | + do_action('AHEE__EEH_Activation__initialize_db_content'); |
|
| 73 | 73 | //also: EEM_Gateways::load_all_gateways() outputs a lot of success messages |
| 74 | 74 | //which users really won't care about on initial activation |
| 75 | 75 | EE_Error::overwrite_success(); |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | */ |
| 88 | 88 | public static function CPT_initialization() { |
| 89 | 89 | // register Custom Post Types |
| 90 | - EE_Registry::instance()->load_core( 'Register_CPTs' ); |
|
| 90 | + EE_Registry::instance()->load_core('Register_CPTs'); |
|
| 91 | 91 | flush_rewrite_rules(); |
| 92 | 92 | } |
| 93 | 93 | |
@@ -103,8 +103,8 @@ discard block |
||
| 103 | 103 | */ |
| 104 | 104 | public static function deactivate_event_espresso() { |
| 105 | 105 | // check permissions |
| 106 | - if ( current_user_can( 'activate_plugins' )) { |
|
| 107 | - deactivate_plugins( EE_PLUGIN_BASENAME, TRUE ); |
|
| 106 | + if (current_user_can('activate_plugins')) { |
|
| 107 | + deactivate_plugins(EE_PLUGIN_BASENAME, TRUE); |
|
| 108 | 108 | } |
| 109 | 109 | } |
| 110 | 110 | |
@@ -126,79 +126,79 @@ discard block |
||
| 126 | 126 | $critical_pages = array( |
| 127 | 127 | array( |
| 128 | 128 | 'id' =>'reg_page_id', |
| 129 | - 'name' => __( 'Registration Checkout', 'event_espresso' ), |
|
| 129 | + 'name' => __('Registration Checkout', 'event_espresso'), |
|
| 130 | 130 | 'post' => NULL, |
| 131 | 131 | 'code' => 'ESPRESSO_CHECKOUT' |
| 132 | 132 | ), |
| 133 | 133 | array( |
| 134 | 134 | 'id' => 'txn_page_id', |
| 135 | - 'name' => __( 'Transactions', 'event_espresso' ), |
|
| 135 | + 'name' => __('Transactions', 'event_espresso'), |
|
| 136 | 136 | 'post' => NULL, |
| 137 | 137 | 'code' => 'ESPRESSO_TXN_PAGE' |
| 138 | 138 | ), |
| 139 | 139 | array( |
| 140 | 140 | 'id' => 'thank_you_page_id', |
| 141 | - 'name' => __( 'Thank You', 'event_espresso' ), |
|
| 141 | + 'name' => __('Thank You', 'event_espresso'), |
|
| 142 | 142 | 'post' => NULL, |
| 143 | 143 | 'code' => 'ESPRESSO_THANK_YOU' |
| 144 | 144 | ), |
| 145 | 145 | array( |
| 146 | 146 | 'id' => 'cancel_page_id', |
| 147 | - 'name' => __( 'Registration Cancelled', 'event_espresso' ), |
|
| 147 | + 'name' => __('Registration Cancelled', 'event_espresso'), |
|
| 148 | 148 | 'post' => NULL, |
| 149 | 149 | 'code' => 'ESPRESSO_CANCELLED' |
| 150 | 150 | ), |
| 151 | 151 | ); |
| 152 | 152 | |
| 153 | - foreach ( $critical_pages as $critical_page ) { |
|
| 153 | + foreach ($critical_pages as $critical_page) { |
|
| 154 | 154 | // is critical page ID set in config ? |
| 155 | - if ( EE_Registry::instance()->CFG->core->$critical_page['id'] !== FALSE ) { |
|
| 155 | + if (EE_Registry::instance()->CFG->core->$critical_page['id'] !== FALSE) { |
|
| 156 | 156 | // attempt to find post by ID |
| 157 | - $critical_page['post'] = get_post( EE_Registry::instance()->CFG->core->$critical_page['id'] ); |
|
| 157 | + $critical_page['post'] = get_post(EE_Registry::instance()->CFG->core->$critical_page['id']); |
|
| 158 | 158 | } |
| 159 | 159 | // no dice? |
| 160 | - if ( $critical_page['post'] == NULL ) { |
|
| 160 | + if ($critical_page['post'] == NULL) { |
|
| 161 | 161 | // attempt to find post by title |
| 162 | - $critical_page['post'] = self::get_page_by_ee_shortcode( $critical_page['code'] ); |
|
| 162 | + $critical_page['post'] = self::get_page_by_ee_shortcode($critical_page['code']); |
|
| 163 | 163 | // still nothing? |
| 164 | - if ( $critical_page['post'] == NULL ) { |
|
| 165 | - $critical_page = EEH_Activation::create_critical_page( $critical_page ); |
|
| 164 | + if ($critical_page['post'] == NULL) { |
|
| 165 | + $critical_page = EEH_Activation::create_critical_page($critical_page); |
|
| 166 | 166 | // REALLY? Still nothing ??!?!? |
| 167 | - if ( $critical_page['post'] == NULL ) { |
|
| 168 | - $msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' ); |
|
| 169 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 167 | + if ($critical_page['post'] == NULL) { |
|
| 168 | + $msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso'); |
|
| 169 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 170 | 170 | break; |
| 171 | 171 | } |
| 172 | 172 | } |
| 173 | 173 | } |
| 174 | 174 | // track post_shortcodes |
| 175 | - if ( $critical_page['post'] ) { |
|
| 176 | - EEH_Activation::_track_critical_page_post_shortcodes( $critical_page ); |
|
| 175 | + if ($critical_page['post']) { |
|
| 176 | + EEH_Activation::_track_critical_page_post_shortcodes($critical_page); |
|
| 177 | 177 | } |
| 178 | 178 | // check that Post ID matches critical page ID in config |
| 179 | - if ( isset( $critical_page['post']->ID ) && $critical_page['post']->ID != EE_Registry::instance()->CFG->core->$critical_page['id'] ) { |
|
| 179 | + if (isset($critical_page['post']->ID) && $critical_page['post']->ID != EE_Registry::instance()->CFG->core->$critical_page['id']) { |
|
| 180 | 180 | //update Config with post ID |
| 181 | 181 | EE_Registry::instance()->CFG->core->$critical_page['id'] = $critical_page['post']->ID; |
| 182 | - if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE ) ) { |
|
| 183 | - $msg = __( 'The Event Espresso critical page configuration settings could not be updated.', 'event_espresso' ); |
|
| 184 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 182 | + if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) { |
|
| 183 | + $msg = __('The Event Espresso critical page configuration settings could not be updated.', 'event_espresso'); |
|
| 184 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 185 | 185 | } |
| 186 | 186 | } |
| 187 | 187 | |
| 188 | - $critical_page_problem = ! isset( $critical_page['post']->post_status ) || $critical_page['post']->post_status != 'publish' || strpos( $critical_page['post']->post_content, $critical_page['code'] ) === FALSE ? TRUE : $critical_page_problem; |
|
| 188 | + $critical_page_problem = ! isset($critical_page['post']->post_status) || $critical_page['post']->post_status != 'publish' || strpos($critical_page['post']->post_content, $critical_page['code']) === FALSE ? TRUE : $critical_page_problem; |
|
| 189 | 189 | |
| 190 | 190 | } |
| 191 | 191 | |
| 192 | - if ( $critical_page_problem ) { |
|
| 192 | + if ($critical_page_problem) { |
|
| 193 | 193 | $msg = sprintf( |
| 194 | - __('A potential issue has been detected with one or more of your Event Espresso pages. Go to %s to view your Event Espresso pages.', 'event_espresso' ), |
|
| 195 | - '<a href="' . admin_url('admin.php?page=espresso_general_settings&action=critical_pages') . '">' . __('Event Espresso Critical Pages Settings', 'event_espresso') . '</a>' |
|
| 194 | + __('A potential issue has been detected with one or more of your Event Espresso pages. Go to %s to view your Event Espresso pages.', 'event_espresso'), |
|
| 195 | + '<a href="'.admin_url('admin.php?page=espresso_general_settings&action=critical_pages').'">'.__('Event Espresso Critical Pages Settings', 'event_espresso').'</a>' |
|
| 196 | 196 | ); |
| 197 | - EE_Error::add_persistent_admin_notice( 'critical_page_problem', $msg ); |
|
| 197 | + EE_Error::add_persistent_admin_notice('critical_page_problem', $msg); |
|
| 198 | 198 | } |
| 199 | 199 | |
| 200 | - if ( EE_Error::has_notices() ) { |
|
| 201 | - EE_Error::get_notices( FALSE, TRUE, TRUE ); |
|
| 200 | + if (EE_Error::has_notices()) { |
|
| 201 | + EE_Error::get_notices(FALSE, TRUE, TRUE); |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | } |
@@ -211,13 +211,13 @@ discard block |
||
| 211 | 211 | * parameter to the shortcode |
| 212 | 212 | * @return WP_Post or NULl |
| 213 | 213 | */ |
| 214 | - public static function get_page_by_ee_shortcode($ee_shortcode){ |
|
| 214 | + public static function get_page_by_ee_shortcode($ee_shortcode) { |
|
| 215 | 215 | global $wpdb; |
| 216 | 216 | $shortcode_and_opening_bracket = '['.$ee_shortcode; |
| 217 | 217 | $post_id = $wpdb->get_var("SELECT ID FROM {$wpdb->posts} WHERE post_content LIKE '%$shortcode_and_opening_bracket%' LIMIT 1"); |
| 218 | - if($post_id){ |
|
| 218 | + if ($post_id) { |
|
| 219 | 219 | return get_post($post_id); |
| 220 | - }else{ |
|
| 220 | + } else { |
|
| 221 | 221 | return NULL; |
| 222 | 222 | } |
| 223 | 223 | |
@@ -234,32 +234,32 @@ discard block |
||
| 234 | 234 | * @param array $critical_page |
| 235 | 235 | * @return array |
| 236 | 236 | */ |
| 237 | - public static function create_critical_page( $critical_page ) { |
|
| 237 | + public static function create_critical_page($critical_page) { |
|
| 238 | 238 | |
| 239 | 239 | $post_args = array( |
| 240 | 240 | 'post_title' => $critical_page['name'], |
| 241 | 241 | 'post_status' => 'publish', |
| 242 | 242 | 'post_type' => 'page', |
| 243 | 243 | 'comment_status' => 'closed', |
| 244 | - 'post_content' => '[' . $critical_page['code'] . ']' |
|
| 244 | + 'post_content' => '['.$critical_page['code'].']' |
|
| 245 | 245 | ); |
| 246 | 246 | |
| 247 | - $post_id = wp_insert_post( $post_args ); |
|
| 248 | - if ( ! $post_id ) { |
|
| 247 | + $post_id = wp_insert_post($post_args); |
|
| 248 | + if ( ! $post_id) { |
|
| 249 | 249 | $msg = sprintf( |
| 250 | - __( 'The Event Espresso critical page entitled "%s" could not be created.', 'event_espresso' ), |
|
| 250 | + __('The Event Espresso critical page entitled "%s" could not be created.', 'event_espresso'), |
|
| 251 | 251 | $critical_page['name'] |
| 252 | 252 | ); |
| 253 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 253 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 254 | 254 | return $critical_page; |
| 255 | 255 | } |
| 256 | 256 | // get newly created post's details |
| 257 | - if ( ! $critical_page['post'] = get_post( $post_id )) { |
|
| 257 | + if ( ! $critical_page['post'] = get_post($post_id)) { |
|
| 258 | 258 | $msg = sprintf( |
| 259 | - __( 'The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso' ), |
|
| 259 | + __('The Event Espresso critical page entitled "%s" could not be retrieved.', 'event_espresso'), |
|
| 260 | 260 | $critical_page['name'] |
| 261 | 261 | ); |
| 262 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 262 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 263 | 263 | } |
| 264 | 264 | |
| 265 | 265 | return $critical_page; |
@@ -278,34 +278,34 @@ discard block |
||
| 278 | 278 | * @param array $critical_page |
| 279 | 279 | * @return void |
| 280 | 280 | */ |
| 281 | - private static function _track_critical_page_post_shortcodes( $critical_page = array() ) { |
|
| 281 | + private static function _track_critical_page_post_shortcodes($critical_page = array()) { |
|
| 282 | 282 | // check the goods |
| 283 | - if ( ! $critical_page['post'] instanceof WP_Post ) { |
|
| 283 | + if ( ! $critical_page['post'] instanceof WP_Post) { |
|
| 284 | 284 | $msg = sprintf( |
| 285 | - __( 'The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso' ), |
|
| 285 | + __('The Event Espresso critical page shortcode for the page %s can not be tracked because it is not a WP_Post object.', 'event_espresso'), |
|
| 286 | 286 | $critical_page['name'] |
| 287 | 287 | ); |
| 288 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 288 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 289 | 289 | return; |
| 290 | 290 | } |
| 291 | 291 | // map shortcode to post |
| 292 | - EE_Registry::instance()->CFG->core->post_shortcodes[ $critical_page['post']->post_name ][ $critical_page['code'] ] = $critical_page['post']->ID; |
|
| 292 | + EE_Registry::instance()->CFG->core->post_shortcodes[$critical_page['post']->post_name][$critical_page['code']] = $critical_page['post']->ID; |
|
| 293 | 293 | // and make sure it's NOT added to the WP "Posts Page" |
| 294 | 294 | // name of the WP Posts Page |
| 295 | 295 | $posts_page = EE_Registry::instance()->CFG->get_page_for_posts(); |
| 296 | - if ( isset( EE_Registry::instance()->CFG->core->post_shortcodes[ $posts_page ] )) { |
|
| 297 | - unset( EE_Registry::instance()->CFG->core->post_shortcodes[ $posts_page ][ $critical_page['code'] ] ); |
|
| 296 | + if (isset(EE_Registry::instance()->CFG->core->post_shortcodes[$posts_page])) { |
|
| 297 | + unset(EE_Registry::instance()->CFG->core->post_shortcodes[$posts_page][$critical_page['code']]); |
|
| 298 | 298 | } |
| 299 | - if ( $posts_page != 'posts' && isset( EE_Registry::instance()->CFG->core->post_shortcodes['posts'] )) { |
|
| 300 | - unset( EE_Registry::instance()->CFG->core->post_shortcodes['posts'][ $critical_page['code'] ] ); |
|
| 299 | + if ($posts_page != 'posts' && isset(EE_Registry::instance()->CFG->core->post_shortcodes['posts'])) { |
|
| 300 | + unset(EE_Registry::instance()->CFG->core->post_shortcodes['posts'][$critical_page['code']]); |
|
| 301 | 301 | } |
| 302 | 302 | // update post_shortcode CFG |
| 303 | - if ( ! EE_Config::instance()->update_espresso_config( FALSE, FALSE )) { |
|
| 303 | + if ( ! EE_Config::instance()->update_espresso_config(FALSE, FALSE)) { |
|
| 304 | 304 | $msg = sprintf( |
| 305 | - __( 'The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso' ), |
|
| 305 | + __('The Event Espresso critical page shortcode for the %s page could not be configured properly.', 'event_espresso'), |
|
| 306 | 306 | $critical_page['name'] |
| 307 | 307 | ); |
| 308 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 308 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 309 | 309 | } |
| 310 | 310 | } |
| 311 | 311 | |
@@ -323,24 +323,24 @@ discard block |
||
| 323 | 323 | public static function get_default_creator_id() { |
| 324 | 324 | global $wpdb; |
| 325 | 325 | |
| 326 | - if ( ! empty( self::$_default_creator_id ) ) { |
|
| 326 | + if ( ! empty(self::$_default_creator_id)) { |
|
| 327 | 327 | return self::$_default_creator_id; |
| 328 | 328 | }/**/ |
| 329 | 329 | |
| 330 | - $role_to_check = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator' ); |
|
| 330 | + $role_to_check = apply_filters('FHEE__EEH_Activation__get_default_creator_id__role_to_check', 'administrator'); |
|
| 331 | 331 | |
| 332 | 332 | //let's allow pre_filtering for early exits by altenative methods for getting id. We check for truthy result and if so then exit early. |
| 333 | - $pre_filtered_id = apply_filters( 'FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check ); |
|
| 334 | - if ( $pre_filtered_id !== false ) { |
|
| 333 | + $pre_filtered_id = apply_filters('FHEE__EEH_Activation__get_default_creator_id__pre_filtered_id', false, $role_to_check); |
|
| 334 | + if ($pre_filtered_id !== false) { |
|
| 335 | 335 | return (int) $pre_filtered_id; |
| 336 | 336 | } |
| 337 | 337 | |
| 338 | - $capabilities_key = $wpdb->prefix . 'capabilities'; |
|
| 339 | - $query = $wpdb->prepare( "SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$capabilities_key' AND meta_value LIKE %s ORDER BY user_id ASC LIMIT 0,1", '%' . $role_to_check . '%' ); |
|
| 340 | - $user_id = $wpdb->get_var( $query ); |
|
| 341 | - $user_id = apply_filters( 'FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id ); |
|
| 342 | - if ( $user_id && intval( $user_id ) ) { |
|
| 343 | - self::$_default_creator_id = intval( $user_id ); |
|
| 338 | + $capabilities_key = $wpdb->prefix.'capabilities'; |
|
| 339 | + $query = $wpdb->prepare("SELECT user_id FROM $wpdb->usermeta WHERE meta_key = '$capabilities_key' AND meta_value LIKE %s ORDER BY user_id ASC LIMIT 0,1", '%'.$role_to_check.'%'); |
|
| 340 | + $user_id = $wpdb->get_var($query); |
|
| 341 | + $user_id = apply_filters('FHEE__EEH_Activation_Helper__get_default_creator_id__user_id', $user_id); |
|
| 342 | + if ($user_id && intval($user_id)) { |
|
| 343 | + self::$_default_creator_id = intval($user_id); |
|
| 344 | 344 | return self::$_default_creator_id; |
| 345 | 345 | } else { |
| 346 | 346 | return NULL; |
@@ -367,26 +367,26 @@ discard block |
||
| 367 | 367 | * @return void |
| 368 | 368 | * @throws EE_Error if there are database errors |
| 369 | 369 | */ |
| 370 | - public static function create_table( $table_name, $sql, $engine = 'ENGINE=MyISAM ',$drop_table_if_pre_existed = false ) { |
|
| 370 | + public static function create_table($table_name, $sql, $engine = 'ENGINE=MyISAM ', $drop_table_if_pre_existed = false) { |
|
| 371 | 371 | // echo "create table $table_name ". ($drop_table_if_pre_existed? 'but first nuke preexisting one' : 'or update it if it exists') . "<br>";//die; |
| 372 | - if( apply_filters( 'FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql ) ){ |
|
| 372 | + if (apply_filters('FHEE__EEH_Activation__create_table__short_circuit', FALSE, $table_name, $sql)) { |
|
| 373 | 373 | return; |
| 374 | 374 | } |
| 375 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
| 376 | - if ( ! function_exists( 'dbDelta' )) { |
|
| 377 | - require_once( ABSPATH . 'wp-admin/includes/upgrade.php' ); |
|
| 375 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
| 376 | + if ( ! function_exists('dbDelta')) { |
|
| 377 | + require_once(ABSPATH.'wp-admin/includes/upgrade.php'); |
|
| 378 | 378 | } |
| 379 | 379 | global $wpdb; |
| 380 | - $wp_table_name = $wpdb->prefix . $table_name; |
|
| 380 | + $wp_table_name = $wpdb->prefix.$table_name; |
|
| 381 | 381 | // if(in_array(EE_System::instance()->detect_req_type(),array(EE_System::req_type_new_activation, EE_System::req_t) ) |
| 382 | - if($drop_table_if_pre_existed && EEH_Activation::table_exists( $wp_table_name ) ){ |
|
| 383 | - if( defined( 'EE_DROP_BAD_TABLES' ) && EE_DROP_BAD_TABLES ){ |
|
| 382 | + if ($drop_table_if_pre_existed && EEH_Activation::table_exists($wp_table_name)) { |
|
| 383 | + if (defined('EE_DROP_BAD_TABLES') && EE_DROP_BAD_TABLES) { |
|
| 384 | 384 | $wpdb->query("DROP TABLE IF EXISTS $wp_table_name "); |
| 385 | - }else{ |
|
| 385 | + } else { |
|
| 386 | 386 | //so we should be more cautious rather than just dropping tables so easily |
| 387 | 387 | EE_Error::add_persistent_admin_notice( |
| 388 | - 'bad_table_' . $wp_table_name . '_detected', |
|
| 389 | - sprintf( __( 'Database table %1$s existed when it shouldn\'t, and probably contained erroneous data. You probably restored to a backup that didn\'t remove old tables didn\'t you? We recommend adding %2$s to your %3$s file then restore to that backup again. This will clear out the invalid data from %1$s. Afterwards you should undo that change from your %3$s file. %4$sIf you cannot edit %3$s, you should remove the data from %1$s manually then restore to the backup again.', 'event_espresso' ), |
|
| 388 | + 'bad_table_'.$wp_table_name.'_detected', |
|
| 389 | + sprintf(__('Database table %1$s existed when it shouldn\'t, and probably contained erroneous data. You probably restored to a backup that didn\'t remove old tables didn\'t you? We recommend adding %2$s to your %3$s file then restore to that backup again. This will clear out the invalid data from %1$s. Afterwards you should undo that change from your %3$s file. %4$sIf you cannot edit %3$s, you should remove the data from %1$s manually then restore to the backup again.', 'event_espresso'), |
|
| 390 | 390 | $wp_table_name, |
| 391 | 391 | "<pre>define( 'EE_DROP_BAD_TABLES', TRUE );</pre>", |
| 392 | 392 | '<b>wp-config.php</b>', |
@@ -397,16 +397,16 @@ discard block |
||
| 397 | 397 | $SQL = "CREATE TABLE $wp_table_name ( $sql ) $engine DEFAULT CHARSET=utf8 COLLATE=utf8_general_ci;"; |
| 398 | 398 | //get $wpdb to echo errors, but buffer them. This way at least WE know an error |
| 399 | 399 | //happened. And then we can choose to tell the end user |
| 400 | - $old_show_errors_policy = $wpdb->show_errors( TRUE ); |
|
| 401 | - $old_error_supression_policy = $wpdb->suppress_errors( FALSE ); |
|
| 400 | + $old_show_errors_policy = $wpdb->show_errors(TRUE); |
|
| 401 | + $old_error_supression_policy = $wpdb->suppress_errors(FALSE); |
|
| 402 | 402 | ob_start(); |
| 403 | - dbDelta( $SQL ); |
|
| 403 | + dbDelta($SQL); |
|
| 404 | 404 | $output = ob_get_contents(); |
| 405 | 405 | ob_end_clean(); |
| 406 | - $wpdb->show_errors( $old_show_errors_policy ); |
|
| 407 | - $wpdb->suppress_errors( $old_error_supression_policy ); |
|
| 408 | - if( ! empty( $output ) ){ |
|
| 409 | - throw new EE_Error( $output ); |
|
| 406 | + $wpdb->show_errors($old_show_errors_policy); |
|
| 407 | + $wpdb->suppress_errors($old_error_supression_policy); |
|
| 408 | + if ( ! empty($output)) { |
|
| 409 | + throw new EE_Error($output); |
|
| 410 | 410 | } |
| 411 | 411 | } |
| 412 | 412 | |
@@ -423,15 +423,15 @@ discard block |
||
| 423 | 423 | * @param string $column_info if your SQL were 'ALTER TABLE table_name ADD price VARCHAR(10)', this would be 'VARCHAR(10)' |
| 424 | 424 | * @return bool|int |
| 425 | 425 | */ |
| 426 | - public static function add_column_if_it_doesnt_exist($table_name,$column_name,$column_info='INT UNSIGNED NOT NULL'){ |
|
| 427 | - if( apply_filters( 'FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', FALSE ) ){ |
|
| 426 | + public static function add_column_if_it_doesnt_exist($table_name, $column_name, $column_info = 'INT UNSIGNED NOT NULL') { |
|
| 427 | + if (apply_filters('FHEE__EEH_Activation__add_column_if_it_doesnt_exist__short_circuit', FALSE)) { |
|
| 428 | 428 | return FALSE; |
| 429 | 429 | } |
| 430 | 430 | global $wpdb; |
| 431 | - $full_table_name=$wpdb->prefix.$table_name; |
|
| 431 | + $full_table_name = $wpdb->prefix.$table_name; |
|
| 432 | 432 | $fields = self::get_fields_on_table($table_name); |
| 433 | - if (!in_array($column_name, $fields)){ |
|
| 434 | - $alter_query="ALTER TABLE $full_table_name ADD $column_name $column_info"; |
|
| 433 | + if ( ! in_array($column_name, $fields)) { |
|
| 434 | + $alter_query = "ALTER TABLE $full_table_name ADD $column_name $column_info"; |
|
| 435 | 435 | //echo "alter query:$alter_query"; |
| 436 | 436 | return $wpdb->query($alter_query); |
| 437 | 437 | } |
@@ -450,15 +450,15 @@ discard block |
||
| 450 | 450 | * @param string $table_name, without prefixed $wpdb->prefix |
| 451 | 451 | * @return array of database column names |
| 452 | 452 | */ |
| 453 | - public static function get_fields_on_table( $table_name = NULL ) { |
|
| 453 | + public static function get_fields_on_table($table_name = NULL) { |
|
| 454 | 454 | global $wpdb; |
| 455 | - $table_name=$wpdb->prefix.$table_name; |
|
| 456 | - if ( ! empty( $table_name )) { |
|
| 455 | + $table_name = $wpdb->prefix.$table_name; |
|
| 456 | + if ( ! empty($table_name)) { |
|
| 457 | 457 | $columns = $wpdb->get_results("SHOW COLUMNS FROM $table_name "); |
| 458 | 458 | if ($columns !== FALSE) { |
| 459 | 459 | $field_array = array(); |
| 460 | - foreach($columns as $column ){ |
|
| 461 | - $field_array[] = $column->Field;; |
|
| 460 | + foreach ($columns as $column) { |
|
| 461 | + $field_array[] = $column->Field; ; |
|
| 462 | 462 | } |
| 463 | 463 | return $field_array; |
| 464 | 464 | } |
@@ -476,10 +476,10 @@ discard block |
||
| 476 | 476 | * @param string $table_name |
| 477 | 477 | * @return bool | int |
| 478 | 478 | */ |
| 479 | - public static function delete_unused_db_table( $table_name ) { |
|
| 479 | + public static function delete_unused_db_table($table_name) { |
|
| 480 | 480 | global $wpdb; |
| 481 | - $table_name = strpos( $table_name, $wpdb->prefix ) === FALSE ? $wpdb->prefix . $table_name : $table_name; |
|
| 482 | - return $wpdb->query( 'DROP TABLE IF EXISTS '. $table_name ); |
|
| 481 | + $table_name = strpos($table_name, $wpdb->prefix) === FALSE ? $wpdb->prefix.$table_name : $table_name; |
|
| 482 | + return $wpdb->query('DROP TABLE IF EXISTS '.$table_name); |
|
| 483 | 483 | } |
| 484 | 484 | |
| 485 | 485 | |
@@ -493,18 +493,18 @@ discard block |
||
| 493 | 493 | * @param string $index_name |
| 494 | 494 | * @return bool | int |
| 495 | 495 | */ |
| 496 | - public static function drop_index( $table_name, $index_name ) { |
|
| 497 | - if( apply_filters( 'FHEE__EEH_Activation__drop_index__short_circuit', FALSE ) ){ |
|
| 496 | + public static function drop_index($table_name, $index_name) { |
|
| 497 | + if (apply_filters('FHEE__EEH_Activation__drop_index__short_circuit', FALSE)) { |
|
| 498 | 498 | return FALSE; |
| 499 | 499 | } |
| 500 | 500 | global $wpdb; |
| 501 | - $table_name_with_prefix = $wpdb->prefix . $table_name ; |
|
| 501 | + $table_name_with_prefix = $wpdb->prefix.$table_name; |
|
| 502 | 502 | $index_exists_query = "SHOW INDEX FROM $table_name_with_prefix WHERE Key_name = '$index_name'"; |
| 503 | 503 | if ( |
| 504 | - $wpdb->get_var( "SHOW TABLES LIKE '$table_name_with_prefix'" ) == $wpdb->prefix . $table_name |
|
| 505 | - && $wpdb->get_var( $index_exists_query ) == $table_name_with_prefix //using get_var with the $index_exists_query returns the table's name |
|
| 504 | + $wpdb->get_var("SHOW TABLES LIKE '$table_name_with_prefix'") == $wpdb->prefix.$table_name |
|
| 505 | + && $wpdb->get_var($index_exists_query) == $table_name_with_prefix //using get_var with the $index_exists_query returns the table's name |
|
| 506 | 506 | ) { |
| 507 | - return $wpdb->query( "ALTER TABLE $table_name_with_prefix DROP INDEX $index_name" ); |
|
| 507 | + return $wpdb->query("ALTER TABLE $table_name_with_prefix DROP INDEX $index_name"); |
|
| 508 | 508 | } |
| 509 | 509 | return TRUE; |
| 510 | 510 | } |
@@ -520,27 +520,27 @@ discard block |
||
| 520 | 520 | * @return boolean success (whether database is setup properly or not) |
| 521 | 521 | */ |
| 522 | 522 | public static function create_database_tables() { |
| 523 | - EE_Registry::instance()->load_core( 'Data_Migration_Manager' ); |
|
| 523 | + EE_Registry::instance()->load_core('Data_Migration_Manager'); |
|
| 524 | 524 | //find the migration script that sets the database to be compatible with the code |
| 525 | 525 | $dms_name = EE_Data_Migration_Manager::instance()->get_most_up_to_date_dms(); |
| 526 | - if( $dms_name ){ |
|
| 527 | - $current_data_migration_script = EE_Registry::instance()->load_dms( $dms_name ); |
|
| 528 | - $current_data_migration_script->set_migrating( FALSE ); |
|
| 526 | + if ($dms_name) { |
|
| 527 | + $current_data_migration_script = EE_Registry::instance()->load_dms($dms_name); |
|
| 528 | + $current_data_migration_script->set_migrating(FALSE); |
|
| 529 | 529 | $current_data_migration_script->schema_changes_before_migration(); |
| 530 | 530 | $current_data_migration_script->schema_changes_after_migration(); |
| 531 | - if( $current_data_migration_script->get_errors() ){ |
|
| 532 | - if( WP_DEBUG ){ |
|
| 533 | - foreach( $current_data_migration_script->get_errors() as $error ){ |
|
| 534 | - EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 531 | + if ($current_data_migration_script->get_errors()) { |
|
| 532 | + if (WP_DEBUG) { |
|
| 533 | + foreach ($current_data_migration_script->get_errors() as $error) { |
|
| 534 | + EE_Error::add_error($error, __FILE__, __FUNCTION__, __LINE__); |
|
| 535 | 535 | } |
| 536 | - }else{ |
|
| 537 | - EE_Error::add_error( __( 'There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso' ) ); |
|
| 536 | + } else { |
|
| 537 | + EE_Error::add_error(__('There were errors creating the Event Espresso database tables and Event Espresso has been deactivated. To view the errors, please enable WP_DEBUG in your wp-config.php file.', 'event_espresso')); |
|
| 538 | 538 | } |
| 539 | 539 | return FALSE; |
| 540 | 540 | } |
| 541 | 541 | EE_Data_Migration_Manager::instance()->update_current_database_state_to(); |
| 542 | - }else{ |
|
| 543 | - EE_Error::add_error( __( 'Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__); |
|
| 542 | + } else { |
|
| 543 | + EE_Error::add_error(__('Could not determine most up-to-date data migration script from which to pull database schema structure. So database is probably not setup properly', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 544 | 544 | return FALSE; |
| 545 | 545 | } |
| 546 | 546 | } |
@@ -559,26 +559,26 @@ discard block |
||
| 559 | 559 | public static function initialize_system_questions() { |
| 560 | 560 | // QUESTION GROUPS |
| 561 | 561 | global $wpdb; |
| 562 | - $SQL = 'SELECT QSG_system FROM ' . $wpdb->prefix . 'esp_question_group WHERE QSG_system != 0'; |
|
| 562 | + $SQL = 'SELECT QSG_system FROM '.$wpdb->prefix.'esp_question_group WHERE QSG_system != 0'; |
|
| 563 | 563 | // what we have |
| 564 | - $question_groups = $wpdb->get_col( $SQL ); |
|
| 564 | + $question_groups = $wpdb->get_col($SQL); |
|
| 565 | 565 | // check the response |
| 566 | - $question_groups = is_array( $question_groups ) ? $question_groups : array(); |
|
| 566 | + $question_groups = is_array($question_groups) ? $question_groups : array(); |
|
| 567 | 567 | // what we should have |
| 568 | - $QSG_systems = array( 1, 2 ); |
|
| 568 | + $QSG_systems = array(1, 2); |
|
| 569 | 569 | // loop thru what we should have and compare to what we have |
| 570 | - foreach ( $QSG_systems as $QSG_system ) { |
|
| 570 | + foreach ($QSG_systems as $QSG_system) { |
|
| 571 | 571 | // reset values array |
| 572 | 572 | $QSG_values = array(); |
| 573 | 573 | // if we don't have what we should have (but use $QST_system as as string because that's what we got from the db) |
| 574 | - if ( ! in_array( "$QSG_system", $question_groups )) { |
|
| 574 | + if ( ! in_array("$QSG_system", $question_groups)) { |
|
| 575 | 575 | // add it |
| 576 | - switch ( $QSG_system ) { |
|
| 576 | + switch ($QSG_system) { |
|
| 577 | 577 | |
| 578 | 578 | case 1: |
| 579 | 579 | $QSG_values = array( |
| 580 | - 'QSG_name' => __( 'Personal Information', 'event_espresso' ), |
|
| 581 | - 'QSG_identifier' => 'personal-information-' . time(), |
|
| 580 | + 'QSG_name' => __('Personal Information', 'event_espresso'), |
|
| 581 | + 'QSG_identifier' => 'personal-information-'.time(), |
|
| 582 | 582 | 'QSG_desc' => '', |
| 583 | 583 | 'QSG_order' => 1, |
| 584 | 584 | 'QSG_show_group_name' => 1, |
@@ -590,8 +590,8 @@ discard block |
||
| 590 | 590 | |
| 591 | 591 | case 2: |
| 592 | 592 | $QSG_values = array( |
| 593 | - 'QSG_name' => __( 'Address Information','event_espresso' ), |
|
| 594 | - 'QSG_identifier' => 'address-information-' . time(), |
|
| 593 | + 'QSG_name' => __('Address Information', 'event_espresso'), |
|
| 594 | + 'QSG_identifier' => 'address-information-'.time(), |
|
| 595 | 595 | 'QSG_desc' => '', |
| 596 | 596 | 'QSG_order' => 2, |
| 597 | 597 | 'QSG_show_group_name' => 1, |
@@ -603,14 +603,14 @@ discard block |
||
| 603 | 603 | |
| 604 | 604 | } |
| 605 | 605 | // make sure we have some values before inserting them |
| 606 | - if ( ! empty( $QSG_values )) { |
|
| 606 | + if ( ! empty($QSG_values)) { |
|
| 607 | 607 | // insert system question |
| 608 | 608 | $wpdb->insert( |
| 609 | - $wpdb->prefix . 'esp_question_group', |
|
| 609 | + $wpdb->prefix.'esp_question_group', |
|
| 610 | 610 | $QSG_values, |
| 611 | - array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d' ) |
|
| 611 | + array('%s', '%s', '%s', '%d', '%d', '%d', '%d', '%d') |
|
| 612 | 612 | ); |
| 613 | - $QSG_IDs[ $QSG_system ] = $wpdb->insert_id; |
|
| 613 | + $QSG_IDs[$QSG_system] = $wpdb->insert_id; |
|
| 614 | 614 | } |
| 615 | 615 | } |
| 616 | 616 | } |
@@ -619,9 +619,9 @@ discard block |
||
| 619 | 619 | |
| 620 | 620 | // QUESTIONS |
| 621 | 621 | global $wpdb; |
| 622 | - $SQL = 'SELECT QST_system FROM ' . $wpdb->prefix . "esp_question WHERE QST_system != ''"; |
|
| 622 | + $SQL = 'SELECT QST_system FROM '.$wpdb->prefix."esp_question WHERE QST_system != ''"; |
|
| 623 | 623 | // what we have |
| 624 | - $questions = $wpdb->get_col( $SQL ); |
|
| 624 | + $questions = $wpdb->get_col($SQL); |
|
| 625 | 625 | // what we should have |
| 626 | 626 | $QST_systems = array( |
| 627 | 627 | 'fname', |
@@ -638,22 +638,22 @@ discard block |
||
| 638 | 638 | $order_for_group_1 = 1; |
| 639 | 639 | $order_for_group_2 = 1; |
| 640 | 640 | // loop thru what we should have and compare to what we have |
| 641 | - foreach ( $QST_systems as $QST_system ) { |
|
| 641 | + foreach ($QST_systems as $QST_system) { |
|
| 642 | 642 | // reset values array |
| 643 | 643 | $QST_values = array(); |
| 644 | 644 | // if we don't have what we should have |
| 645 | - if ( ! in_array( $QST_system, $questions )) { |
|
| 645 | + if ( ! in_array($QST_system, $questions)) { |
|
| 646 | 646 | // add it |
| 647 | - switch ( $QST_system ) { |
|
| 647 | + switch ($QST_system) { |
|
| 648 | 648 | |
| 649 | 649 | case 'fname': |
| 650 | 650 | $QST_values = array( |
| 651 | - 'QST_display_text' => __( 'First Name', 'event_espresso' ), |
|
| 652 | - 'QST_admin_label' => __( 'First Name - System Question', 'event_espresso' ), |
|
| 651 | + 'QST_display_text' => __('First Name', 'event_espresso'), |
|
| 652 | + 'QST_admin_label' => __('First Name - System Question', 'event_espresso'), |
|
| 653 | 653 | 'QST_system' => 'fname', |
| 654 | 654 | 'QST_type' => 'TEXT', |
| 655 | 655 | 'QST_required' => 1, |
| 656 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
| 656 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
| 657 | 657 | 'QST_order' => 1, |
| 658 | 658 | 'QST_admin_only' => 0, |
| 659 | 659 | 'QST_wp_user' => self::get_default_creator_id(), |
@@ -663,12 +663,12 @@ discard block |
||
| 663 | 663 | |
| 664 | 664 | case 'lname': |
| 665 | 665 | $QST_values = array( |
| 666 | - 'QST_display_text' => __( 'Last Name', 'event_espresso' ), |
|
| 667 | - 'QST_admin_label' => __( 'Last Name - System Question', 'event_espresso' ), |
|
| 666 | + 'QST_display_text' => __('Last Name', 'event_espresso'), |
|
| 667 | + 'QST_admin_label' => __('Last Name - System Question', 'event_espresso'), |
|
| 668 | 668 | 'QST_system' => 'lname', |
| 669 | 669 | 'QST_type' => 'TEXT', |
| 670 | 670 | 'QST_required' => 1, |
| 671 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
| 671 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
| 672 | 672 | 'QST_order' => 2, |
| 673 | 673 | 'QST_admin_only' => 0, |
| 674 | 674 | 'QST_wp_user' => self::get_default_creator_id(), |
@@ -678,12 +678,12 @@ discard block |
||
| 678 | 678 | |
| 679 | 679 | case 'email': |
| 680 | 680 | $QST_values = array( |
| 681 | - 'QST_display_text' => __( 'Email Address', 'event_espresso' ), |
|
| 682 | - 'QST_admin_label' => __( 'Email Address - System Question', 'event_espresso' ), |
|
| 681 | + 'QST_display_text' => __('Email Address', 'event_espresso'), |
|
| 682 | + 'QST_admin_label' => __('Email Address - System Question', 'event_espresso'), |
|
| 683 | 683 | 'QST_system' => 'email', |
| 684 | 684 | 'QST_type' => 'TEXT', |
| 685 | 685 | 'QST_required' => 1, |
| 686 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
| 686 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
| 687 | 687 | 'QST_order' => 3, |
| 688 | 688 | 'QST_admin_only' => 0, |
| 689 | 689 | 'QST_wp_user' => self::get_default_creator_id(), |
@@ -693,12 +693,12 @@ discard block |
||
| 693 | 693 | |
| 694 | 694 | case 'address': |
| 695 | 695 | $QST_values = array( |
| 696 | - 'QST_display_text' => __( 'Address', 'event_espresso' ), |
|
| 697 | - 'QST_admin_label' => __( 'Address - System Question', 'event_espresso' ), |
|
| 696 | + 'QST_display_text' => __('Address', 'event_espresso'), |
|
| 697 | + 'QST_admin_label' => __('Address - System Question', 'event_espresso'), |
|
| 698 | 698 | 'QST_system' => 'address', |
| 699 | 699 | 'QST_type' => 'TEXT', |
| 700 | 700 | 'QST_required' => 0, |
| 701 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
| 701 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
| 702 | 702 | 'QST_order' => 4, |
| 703 | 703 | 'QST_admin_only' => 0, |
| 704 | 704 | 'QST_wp_user' => self::get_default_creator_id(), |
@@ -708,12 +708,12 @@ discard block |
||
| 708 | 708 | |
| 709 | 709 | case 'address2': |
| 710 | 710 | $QST_values = array( |
| 711 | - 'QST_display_text' => __( 'Address2', 'event_espresso' ), |
|
| 712 | - 'QST_admin_label' => __( 'Address2 - System Question', 'event_espresso' ), |
|
| 711 | + 'QST_display_text' => __('Address2', 'event_espresso'), |
|
| 712 | + 'QST_admin_label' => __('Address2 - System Question', 'event_espresso'), |
|
| 713 | 713 | 'QST_system' => 'address2', |
| 714 | 714 | 'QST_type' => 'TEXT', |
| 715 | 715 | 'QST_required' => 0, |
| 716 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
| 716 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
| 717 | 717 | 'QST_order' => 5, |
| 718 | 718 | 'QST_admin_only' => 0, |
| 719 | 719 | 'QST_wp_user' => self::get_default_creator_id(), |
@@ -723,12 +723,12 @@ discard block |
||
| 723 | 723 | |
| 724 | 724 | case 'city': |
| 725 | 725 | $QST_values = array( |
| 726 | - 'QST_display_text' => __( 'City', 'event_espresso' ), |
|
| 727 | - 'QST_admin_label' => __( 'City - System Question', 'event_espresso' ), |
|
| 726 | + 'QST_display_text' => __('City', 'event_espresso'), |
|
| 727 | + 'QST_admin_label' => __('City - System Question', 'event_espresso'), |
|
| 728 | 728 | 'QST_system' => 'city', |
| 729 | 729 | 'QST_type' => 'TEXT', |
| 730 | 730 | 'QST_required' => 0, |
| 731 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
| 731 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
| 732 | 732 | 'QST_order' => 6, |
| 733 | 733 | 'QST_admin_only' => 0, |
| 734 | 734 | 'QST_wp_user' => self::get_default_creator_id(), |
@@ -738,12 +738,12 @@ discard block |
||
| 738 | 738 | |
| 739 | 739 | case 'state': |
| 740 | 740 | $QST_values = array( |
| 741 | - 'QST_display_text' => __( 'State/Province', 'event_espresso' ), |
|
| 742 | - 'QST_admin_label' => __( 'State/Province - System Question', 'event_espresso' ), |
|
| 741 | + 'QST_display_text' => __('State/Province', 'event_espresso'), |
|
| 742 | + 'QST_admin_label' => __('State/Province - System Question', 'event_espresso'), |
|
| 743 | 743 | 'QST_system' => 'state', |
| 744 | 744 | 'QST_type' => 'STATE', |
| 745 | 745 | 'QST_required' => 0, |
| 746 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
| 746 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
| 747 | 747 | 'QST_order' => 7, |
| 748 | 748 | 'QST_admin_only' => 0, |
| 749 | 749 | 'QST_wp_user' => self::get_default_creator_id(), |
@@ -753,12 +753,12 @@ discard block |
||
| 753 | 753 | |
| 754 | 754 | case 'country' : |
| 755 | 755 | $QST_values = array( |
| 756 | - 'QST_display_text' => __( 'Country', 'event_espresso' ), |
|
| 757 | - 'QST_admin_label' => __( 'Country - System Question', 'event_espresso' ), |
|
| 756 | + 'QST_display_text' => __('Country', 'event_espresso'), |
|
| 757 | + 'QST_admin_label' => __('Country - System Question', 'event_espresso'), |
|
| 758 | 758 | 'QST_system' => 'country', |
| 759 | 759 | 'QST_type' => 'COUNTRY', |
| 760 | 760 | 'QST_required' => 0, |
| 761 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
| 761 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
| 762 | 762 | 'QST_order' => 8, |
| 763 | 763 | 'QST_admin_only' => 0, |
| 764 | 764 | 'QST_wp_user' => self::get_default_creator_id(), |
@@ -768,12 +768,12 @@ discard block |
||
| 768 | 768 | |
| 769 | 769 | case 'zip': |
| 770 | 770 | $QST_values = array( |
| 771 | - 'QST_display_text' => __( 'Zip/Postal Code', 'event_espresso' ), |
|
| 772 | - 'QST_admin_label' => __( 'Zip/Postal Code - System Question', 'event_espresso' ), |
|
| 771 | + 'QST_display_text' => __('Zip/Postal Code', 'event_espresso'), |
|
| 772 | + 'QST_admin_label' => __('Zip/Postal Code - System Question', 'event_espresso'), |
|
| 773 | 773 | 'QST_system' => 'zip', |
| 774 | 774 | 'QST_type' => 'TEXT', |
| 775 | 775 | 'QST_required' => 0, |
| 776 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
| 776 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
| 777 | 777 | 'QST_order' => 9, |
| 778 | 778 | 'QST_admin_only' => 0, |
| 779 | 779 | 'QST_wp_user' => self::get_default_creator_id(), |
@@ -783,12 +783,12 @@ discard block |
||
| 783 | 783 | |
| 784 | 784 | case 'phone': |
| 785 | 785 | $QST_values = array( |
| 786 | - 'QST_display_text' => __( 'Phone Number', 'event_espresso' ), |
|
| 787 | - 'QST_admin_label' => __( 'Phone Number - System Question', 'event_espresso' ), |
|
| 786 | + 'QST_display_text' => __('Phone Number', 'event_espresso'), |
|
| 787 | + 'QST_admin_label' => __('Phone Number - System Question', 'event_espresso'), |
|
| 788 | 788 | 'QST_system' => 'phone', |
| 789 | 789 | 'QST_type' => 'TEXT', |
| 790 | 790 | 'QST_required' => 0, |
| 791 | - 'QST_required_text' => __( 'This field is required', 'event_espresso' ), |
|
| 791 | + 'QST_required_text' => __('This field is required', 'event_espresso'), |
|
| 792 | 792 | 'QST_order' => 10, |
| 793 | 793 | 'QST_admin_only' => 0, |
| 794 | 794 | 'QST_wp_user' => self::get_default_creator_id(), |
@@ -797,22 +797,22 @@ discard block |
||
| 797 | 797 | break; |
| 798 | 798 | |
| 799 | 799 | } |
| 800 | - if ( ! empty( $QST_values )) { |
|
| 800 | + if ( ! empty($QST_values)) { |
|
| 801 | 801 | // insert system question |
| 802 | 802 | $wpdb->insert( |
| 803 | - $wpdb->prefix . 'esp_question', |
|
| 803 | + $wpdb->prefix.'esp_question', |
|
| 804 | 804 | $QST_values, |
| 805 | - array( '%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d' ) |
|
| 805 | + array('%s', '%s', '%s', '%s', '%d', '%s', '%d', '%d', '%d', '%d') |
|
| 806 | 806 | ); |
| 807 | 807 | $QST_ID = $wpdb->insert_id; |
| 808 | 808 | |
| 809 | 809 | // QUESTION GROUP QUESTIONS |
| 810 | - $QSG_ID = in_array( $QST_system, array('fname','lname','email')) ? 1 : 2; |
|
| 810 | + $QSG_ID = in_array($QST_system, array('fname', 'lname', 'email')) ? 1 : 2; |
|
| 811 | 811 | // add system questions to groups |
| 812 | 812 | $wpdb->insert( |
| 813 | - $wpdb->prefix . 'esp_question_group_question', |
|
| 814 | - array( 'QSG_ID' => $QSG_ID , 'QST_ID' => $QST_ID, 'QGQ_order'=>($QSG_ID==1)? $order_for_group_1++ : $order_for_group_2++ ), |
|
| 815 | - array( '%d', '%d','%d' ) |
|
| 813 | + $wpdb->prefix.'esp_question_group_question', |
|
| 814 | + array('QSG_ID' => $QSG_ID, 'QST_ID' => $QST_ID, 'QGQ_order'=>($QSG_ID == 1) ? $order_for_group_1++ : $order_for_group_2++), |
|
| 815 | + array('%d', '%d', '%d') |
|
| 816 | 816 | ); |
| 817 | 817 | } |
| 818 | 818 | } |
@@ -824,11 +824,11 @@ discard block |
||
| 824 | 824 | * Makes sure the default payment method (Invoice) is active. |
| 825 | 825 | * This used to be done automatically as part of constructing the old gateways config |
| 826 | 826 | */ |
| 827 | - public static function insert_default_payment_methods(){ |
|
| 828 | - if( ! EEM_Payment_Method::instance()->count_active( EEM_Payment_Method::scope_cart ) ){ |
|
| 829 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
| 830 | - EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type( 'Invoice' ); |
|
| 831 | - }else{ |
|
| 827 | + public static function insert_default_payment_methods() { |
|
| 828 | + if ( ! EEM_Payment_Method::instance()->count_active(EEM_Payment_Method::scope_cart)) { |
|
| 829 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
| 830 | + EE_Payment_Method_Manager::instance()->activate_a_payment_method_of_type('Invoice'); |
|
| 831 | + } else { |
|
| 832 | 832 | EEM_Payment_Method::instance()->verify_button_urls(); |
| 833 | 833 | } |
| 834 | 834 | } |
@@ -844,12 +844,12 @@ discard block |
||
| 844 | 844 | |
| 845 | 845 | global $wpdb; |
| 846 | 846 | |
| 847 | - if ( EEH_Activation::table_exists( EEM_Status::instance()->table() ) ) { |
|
| 847 | + if (EEH_Activation::table_exists(EEM_Status::instance()->table())) { |
|
| 848 | 848 | |
| 849 | - $SQL = "DELETE FROM " . EEM_Status::instance()->table() . " WHERE STS_ID IN ( 'ACT', 'NAC', 'NOP', 'OPN', 'CLS', 'PND', 'ONG', 'SEC', 'DRF', 'DEL', 'DEN', 'EXP', 'RPP', 'RCN', 'RDC', 'RAP', 'RNA', 'TAB', 'TIN', 'TFL', 'TCM', 'TOP', 'PAP', 'PCN', 'PFL', 'PDC', 'EDR', 'ESN', 'PPN', 'RIC' );"; |
|
| 849 | + $SQL = "DELETE FROM ".EEM_Status::instance()->table()." WHERE STS_ID IN ( 'ACT', 'NAC', 'NOP', 'OPN', 'CLS', 'PND', 'ONG', 'SEC', 'DRF', 'DEL', 'DEN', 'EXP', 'RPP', 'RCN', 'RDC', 'RAP', 'RNA', 'TAB', 'TIN', 'TFL', 'TCM', 'TOP', 'PAP', 'PCN', 'PFL', 'PDC', 'EDR', 'ESN', 'PPN', 'RIC' );"; |
|
| 850 | 850 | $wpdb->query($SQL); |
| 851 | 851 | |
| 852 | - $SQL = "INSERT INTO " . EEM_Status::instance()->table() . " |
|
| 852 | + $SQL = "INSERT INTO ".EEM_Status::instance()->table()." |
|
| 853 | 853 | (STS_ID, STS_code, STS_type, STS_can_edit, STS_desc, STS_open) VALUES |
| 854 | 854 | ('ACT', 'ACTIVE', 'event', 0, NULL, 1), |
| 855 | 855 | ('NAC', 'NOT_ACTIVE', 'event', 0, NULL, 0), |
@@ -908,26 +908,26 @@ discard block |
||
| 908 | 908 | * @return boolean success of verifying upload directories exist |
| 909 | 909 | */ |
| 910 | 910 | public static function create_upload_directories() { |
| 911 | - EE_Registry::instance()->load_helper( 'File' ); |
|
| 911 | + EE_Registry::instance()->load_helper('File'); |
|
| 912 | 912 | // Create the required folders |
| 913 | 913 | $folders = array( |
| 914 | 914 | EVENT_ESPRESSO_UPLOAD_DIR, |
| 915 | 915 | EVENT_ESPRESSO_TEMPLATE_DIR, |
| 916 | 916 | EVENT_ESPRESSO_GATEWAY_DIR, |
| 917 | - EVENT_ESPRESSO_UPLOAD_DIR . '/logs/', |
|
| 918 | - EVENT_ESPRESSO_UPLOAD_DIR . '/css/', |
|
| 919 | - EVENT_ESPRESSO_UPLOAD_DIR . '/tickets/' |
|
| 917 | + EVENT_ESPRESSO_UPLOAD_DIR.'/logs/', |
|
| 918 | + EVENT_ESPRESSO_UPLOAD_DIR.'/css/', |
|
| 919 | + EVENT_ESPRESSO_UPLOAD_DIR.'/tickets/' |
|
| 920 | 920 | ); |
| 921 | - foreach ( $folders as $folder ) { |
|
| 921 | + foreach ($folders as $folder) { |
|
| 922 | 922 | try { |
| 923 | - EEH_File::ensure_folder_exists_and_is_writable( $folder ); |
|
| 924 | - @ chmod( $folder, 0755 ); |
|
| 925 | - } catch( EE_Error $e ){ |
|
| 923 | + EEH_File::ensure_folder_exists_and_is_writable($folder); |
|
| 924 | + @ chmod($folder, 0755); |
|
| 925 | + } catch (EE_Error $e) { |
|
| 926 | 926 | EE_Error::add_error( |
| 927 | 927 | sprintf( |
| 928 | - __( 'Could not create the folder at "%1$s" because: %2$s', 'event_espresso' ), |
|
| 928 | + __('Could not create the folder at "%1$s" because: %2$s', 'event_espresso'), |
|
| 929 | 929 | $folder, |
| 930 | - '<br />' . $e->getMessage() |
|
| 930 | + '<br />'.$e->getMessage() |
|
| 931 | 931 | ), |
| 932 | 932 | __FILE__, __FUNCTION__, __LINE__ |
| 933 | 933 | ); |
@@ -953,16 +953,16 @@ discard block |
||
| 953 | 953 | $settings = $installed_messengers = $default_messengers = array(); |
| 954 | 954 | |
| 955 | 955 | //include our helper |
| 956 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
| 956 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
| 957 | 957 | |
| 958 | 958 | //get all installed messenger objects |
| 959 | 959 | $installed = EEH_MSG_Template::get_installed_message_objects(); |
| 960 | 960 | |
| 961 | 961 | //let's setup the $installed messengers in an array AND the messengers that are set to be activated on install. |
| 962 | - foreach ( $installed['messengers'] as $msgr ) { |
|
| 963 | - if ( $msgr instanceof EE_messenger ) { |
|
| 962 | + foreach ($installed['messengers'] as $msgr) { |
|
| 963 | + if ($msgr instanceof EE_messenger) { |
|
| 964 | 964 | $installed_messengers[$msgr->name] = $msgr; |
| 965 | - if ( $msgr->activate_on_install ) { |
|
| 965 | + if ($msgr->activate_on_install) { |
|
| 966 | 966 | $default_messengers[] = $msgr->name; |
| 967 | 967 | } |
| 968 | 968 | } |
@@ -972,36 +972,36 @@ discard block |
||
| 972 | 972 | $active_messengers = EEH_MSG_Template::get_active_messengers_in_db(); |
| 973 | 973 | |
| 974 | 974 | //things that have already been activated before |
| 975 | - $has_activated = get_option( 'ee_has_activated_messenger' ); |
|
| 975 | + $has_activated = get_option('ee_has_activated_messenger'); |
|
| 976 | 976 | |
| 977 | 977 | //do an initial loop to determine if we need to continue |
| 978 | 978 | $def_ms = array(); |
| 979 | - foreach ( $default_messengers as $msgr ) { |
|
| 980 | - if ( isset($active_messengers[$msgr] ) || isset( $has_activated[$msgr] ) ) continue; |
|
| 979 | + foreach ($default_messengers as $msgr) { |
|
| 980 | + if (isset($active_messengers[$msgr]) || isset($has_activated[$msgr])) continue; |
|
| 981 | 981 | $def_ms[] = $msgr; |
| 982 | 982 | } |
| 983 | 983 | |
| 984 | 984 | //setup the $installed_mts in an array |
| 985 | - foreach ( $installed['message_types'] as $imt ) { |
|
| 986 | - if ( $imt instanceof EE_message_type ) { |
|
| 985 | + foreach ($installed['message_types'] as $imt) { |
|
| 986 | + if ($imt instanceof EE_message_type) { |
|
| 987 | 987 | $installed_mts[$imt->name] = $imt; |
| 988 | 988 | } |
| 989 | 989 | } |
| 990 | 990 | |
| 991 | 991 | //loop through default array for default messengers (if present) |
| 992 | - if ( ! empty( $def_ms ) ) { |
|
| 993 | - foreach ( $def_ms as $messenger ) { |
|
| 992 | + if ( ! empty($def_ms)) { |
|
| 993 | + foreach ($def_ms as $messenger) { |
|
| 994 | 994 | //all is good so let's setup the default stuff. We need to use the given messenger object (if exists) to get the default message type for the messenger. |
| 995 | - if ( ! isset( $installed_messengers[$messenger] )) { |
|
| 995 | + if ( ! isset($installed_messengers[$messenger])) { |
|
| 996 | 996 | continue; |
| 997 | 997 | } |
| 998 | 998 | /** @var EE_messenger[] $installed_messengers */ |
| 999 | 999 | $default_mts = $installed_messengers[$messenger]->get_default_message_types(); |
| 1000 | 1000 | $active_messengers[$messenger]['obj'] = $installed_messengers[$messenger]; |
| 1001 | - foreach ( $default_mts as $index => $mt ) { |
|
| 1001 | + foreach ($default_mts as $index => $mt) { |
|
| 1002 | 1002 | //is there an installed_mt matching the default string? If not then nothing to do here. |
| 1003 | - if ( ! isset( $installed_mts[$mt] ) ) { |
|
| 1004 | - unset( $default_mts[$index] ); |
|
| 1003 | + if ( ! isset($installed_mts[$mt])) { |
|
| 1004 | + unset($default_mts[$index]); |
|
| 1005 | 1005 | continue; |
| 1006 | 1006 | } |
| 1007 | 1007 | |
@@ -1010,41 +1010,41 @@ discard block |
||
| 1010 | 1010 | /** @var EE_message_type[] $installed_mts */ |
| 1011 | 1011 | $settings_fields = $installed_mts[$mt]->get_admin_settings_fields(); |
| 1012 | 1012 | $settings = array(); |
| 1013 | - if ( is_array( $settings_fields ) ) { |
|
| 1014 | - foreach ( $settings_fields as $field => $values ) { |
|
| 1015 | - if ( isset( $values['default'] ) ) { |
|
| 1013 | + if (is_array($settings_fields)) { |
|
| 1014 | + foreach ($settings_fields as $field => $values) { |
|
| 1015 | + if (isset($values['default'])) { |
|
| 1016 | 1016 | $settings[$field] = $values['default']; |
| 1017 | 1017 | } |
| 1018 | 1018 | } |
| 1019 | 1019 | } |
| 1020 | 1020 | |
| 1021 | - $active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt]['settings'] = $settings; |
|
| 1021 | + $active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]['settings'] = $settings; |
|
| 1022 | 1022 | $has_activated[$messenger][] = $mt; |
| 1023 | 1023 | } |
| 1024 | 1024 | |
| 1025 | 1025 | //setup any initial settings for the messenger |
| 1026 | 1026 | $msgr_settings = $installed_messengers[$messenger]->get_admin_settings_fields(); |
| 1027 | 1027 | |
| 1028 | - if ( !empty( $msgr_settings ) ) { |
|
| 1029 | - foreach ( $msgr_settings as $field => $value ) { |
|
| 1028 | + if ( ! empty($msgr_settings)) { |
|
| 1029 | + foreach ($msgr_settings as $field => $value) { |
|
| 1030 | 1030 | $active_messengers[$messenger]['settings'][$field] = $value; |
| 1031 | 1031 | } |
| 1032 | 1032 | } |
| 1033 | 1033 | |
| 1034 | 1034 | //now let's save the settings for this messenger! Must do now because the validator checks the db for active messengers to validate. |
| 1035 | - EEH_MSG_Template::update_active_messengers_in_db( $active_messengers ); |
|
| 1035 | + EEH_MSG_Template::update_active_messengers_in_db($active_messengers); |
|
| 1036 | 1036 | |
| 1037 | 1037 | //let's generate all the templates but only if the messenger has default_mts (otherwise its just activated). |
| 1038 | - if ( !empty( $default_mts ) ) { |
|
| 1039 | - $success = EEH_MSG_Template::generate_new_templates( $messenger, $default_mts, '', TRUE ); |
|
| 1038 | + if ( ! empty($default_mts)) { |
|
| 1039 | + $success = EEH_MSG_Template::generate_new_templates($messenger, $default_mts, '', TRUE); |
|
| 1040 | 1040 | } |
| 1041 | 1041 | } |
| 1042 | 1042 | } //end check for empty( $def_ms ) |
| 1043 | 1043 | |
| 1044 | 1044 | //still need to see if there are any message types to activate for active messengers |
| 1045 | - foreach ( $active_messengers as $messenger => $settings ) { |
|
| 1045 | + foreach ($active_messengers as $messenger => $settings) { |
|
| 1046 | 1046 | $msg_obj = $settings['obj']; |
| 1047 | - if ( ! $msg_obj instanceof EE_messenger ) { |
|
| 1047 | + if ( ! $msg_obj instanceof EE_messenger) { |
|
| 1048 | 1048 | continue; |
| 1049 | 1049 | } |
| 1050 | 1050 | |
@@ -1052,45 +1052,45 @@ discard block |
||
| 1052 | 1052 | $new_default_mts = array(); |
| 1053 | 1053 | |
| 1054 | 1054 | //loop through each default mt reported by the messenger and make sure its set in its active db entry. |
| 1055 | - foreach( $all_default_mts as $index => $mt ) { |
|
| 1055 | + foreach ($all_default_mts as $index => $mt) { |
|
| 1056 | 1056 | //already active? already has generated templates? || has already been activated before (we dont' want to reactivate things users intentionally deactivated). |
| 1057 | - if ( ( isset( $has_activated[$messenger] ) && in_array($mt, $has_activated[$messenger]) ) || isset( $active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt] ) || EEH_MSG_Template::already_generated( $messenger, $mt, 0, FALSE ) ) { |
|
| 1057 | + if ((isset($has_activated[$messenger]) && in_array($mt, $has_activated[$messenger])) || isset($active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]) || EEH_MSG_Template::already_generated($messenger, $mt, 0, FALSE)) { |
|
| 1058 | 1058 | continue; |
| 1059 | 1059 | } |
| 1060 | 1060 | |
| 1061 | 1061 | //is there an installed_mt matching the default string? If not then nothing to do here. |
| 1062 | - if ( ! isset( $installed_mts[$mt] ) ) { |
|
| 1063 | - unset( $all_default_mts[$mt] ); |
|
| 1062 | + if ( ! isset($installed_mts[$mt])) { |
|
| 1063 | + unset($all_default_mts[$mt]); |
|
| 1064 | 1064 | continue; |
| 1065 | 1065 | } |
| 1066 | 1066 | |
| 1067 | 1067 | $settings_fields = $installed_mts[$mt]->get_admin_settings_fields(); |
| 1068 | 1068 | $settings = array(); |
| 1069 | - if ( is_array( $settings_fields ) ) { |
|
| 1070 | - foreach ( $settings_fields as $field => $values ) { |
|
| 1071 | - if ( isset( $values['default'] ) ) { |
|
| 1069 | + if (is_array($settings_fields)) { |
|
| 1070 | + foreach ($settings_fields as $field => $values) { |
|
| 1071 | + if (isset($values['default'])) { |
|
| 1072 | 1072 | $settings[$field] = $values['default']; |
| 1073 | 1073 | } |
| 1074 | 1074 | } |
| 1075 | 1075 | } |
| 1076 | 1076 | |
| 1077 | - $active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt]['settings'] = $settings; |
|
| 1077 | + $active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt]['settings'] = $settings; |
|
| 1078 | 1078 | $new_default_mts[] = $mt; |
| 1079 | 1079 | $has_activated[$messenger][] = $mt; |
| 1080 | 1080 | } |
| 1081 | 1081 | |
| 1082 | 1082 | |
| 1083 | - if ( ! empty( $new_default_mts ) ) { |
|
| 1084 | - $success = EEH_MSG_Template::generate_new_templates( $messenger, $new_default_mts, '', TRUE ); |
|
| 1083 | + if ( ! empty($new_default_mts)) { |
|
| 1084 | + $success = EEH_MSG_Template::generate_new_templates($messenger, $new_default_mts, '', TRUE); |
|
| 1085 | 1085 | } |
| 1086 | 1086 | |
| 1087 | 1087 | } |
| 1088 | 1088 | |
| 1089 | 1089 | //now let's save the settings for this messenger! |
| 1090 | - EEH_MSG_Template::update_active_messengers_in_db( $active_messengers ); |
|
| 1090 | + EEH_MSG_Template::update_active_messengers_in_db($active_messengers); |
|
| 1091 | 1091 | |
| 1092 | 1092 | //update $has_activated record |
| 1093 | - update_option( 'ee_has_activated_messenger', $has_activated ); |
|
| 1093 | + update_option('ee_has_activated_messenger', $has_activated); |
|
| 1094 | 1094 | |
| 1095 | 1095 | //that's it! |
| 1096 | 1096 | return $success; |
@@ -1110,47 +1110,47 @@ discard block |
||
| 1110 | 1110 | */ |
| 1111 | 1111 | public static function validate_messages_system() { |
| 1112 | 1112 | //include our helper |
| 1113 | - EE_Registry::instance()->load_helper( 'MSG_Template' ); |
|
| 1113 | + EE_Registry::instance()->load_helper('MSG_Template'); |
|
| 1114 | 1114 | |
| 1115 | 1115 | //get active and installed messengers/message types. |
| 1116 | 1116 | $active_messengers = EEH_MSG_Template::get_active_messengers_in_db(); |
| 1117 | 1117 | $installed = EEH_MSG_Template::get_installed_message_objects(); |
| 1118 | 1118 | $installed_messengers = $installed_mts = array(); |
| 1119 | 1119 | //set up the arrays so they can be handled easier. |
| 1120 | - foreach( $installed['messengers'] as $im ) { |
|
| 1121 | - if ( $im instanceof EE_messenger ) { |
|
| 1120 | + foreach ($installed['messengers'] as $im) { |
|
| 1121 | + if ($im instanceof EE_messenger) { |
|
| 1122 | 1122 | $installed_messengers[$im->name] = $im; |
| 1123 | 1123 | } |
| 1124 | 1124 | } |
| 1125 | - foreach( $installed['message_types'] as $imt ) { |
|
| 1126 | - if ( $imt instanceof EE_message_type ) { |
|
| 1125 | + foreach ($installed['message_types'] as $imt) { |
|
| 1126 | + if ($imt instanceof EE_message_type) { |
|
| 1127 | 1127 | $installed_mts[$imt->name] = $imt; |
| 1128 | 1128 | } |
| 1129 | 1129 | } |
| 1130 | 1130 | |
| 1131 | 1131 | //now let's loop through the active array and validate |
| 1132 | - foreach( $active_messengers as $messenger => $active_details ) { |
|
| 1132 | + foreach ($active_messengers as $messenger => $active_details) { |
|
| 1133 | 1133 | //first let's see if this messenger is installed. |
| 1134 | - if ( ! isset( $installed_messengers[$messenger] ) ) { |
|
| 1134 | + if ( ! isset($installed_messengers[$messenger])) { |
|
| 1135 | 1135 | //not set so let's just remove from actives and make sure templates are inactive. |
| 1136 | - unset( $active_messengers[$messenger] ); |
|
| 1137 | - EEH_MSG_Template::update_to_inactive( $messenger ); |
|
| 1136 | + unset($active_messengers[$messenger]); |
|
| 1137 | + EEH_MSG_Template::update_to_inactive($messenger); |
|
| 1138 | 1138 | continue; |
| 1139 | 1139 | } |
| 1140 | 1140 | |
| 1141 | 1141 | //messenger is active, so let's just make sure that any active message types not installed are deactivated. |
| 1142 | - $mts = ! empty( $active_details['settings'][$messenger . '-message_types'] ) ? $active_details['settings'][$messenger . '-message_types'] : array(); |
|
| 1143 | - foreach ( $mts as $mt_name => $mt ) { |
|
| 1144 | - if ( ! isset( $installed_mts[$mt_name] ) ) { |
|
| 1145 | - unset( $active_messengers[$messenger]['settings'][$messenger . '-message_types'][$mt_name] ); |
|
| 1146 | - EEH_MSG_Template::update_to_inactive( $messenger, $mt_name ); |
|
| 1142 | + $mts = ! empty($active_details['settings'][$messenger.'-message_types']) ? $active_details['settings'][$messenger.'-message_types'] : array(); |
|
| 1143 | + foreach ($mts as $mt_name => $mt) { |
|
| 1144 | + if ( ! isset($installed_mts[$mt_name])) { |
|
| 1145 | + unset($active_messengers[$messenger]['settings'][$messenger.'-message_types'][$mt_name]); |
|
| 1146 | + EEH_MSG_Template::update_to_inactive($messenger, $mt_name); |
|
| 1147 | 1147 | } |
| 1148 | 1148 | } |
| 1149 | 1149 | } |
| 1150 | 1150 | |
| 1151 | 1151 | //all done! let's update the active_messengers. |
| 1152 | - EEH_MSG_Template::update_active_messengers_in_db( $active_messengers ); |
|
| 1153 | - do_action( 'AHEE__EEH_Activation__validate_messages_system' ); |
|
| 1152 | + EEH_MSG_Template::update_active_messengers_in_db($active_messengers); |
|
| 1153 | + do_action('AHEE__EEH_Activation__validate_messages_system'); |
|
| 1154 | 1154 | return; |
| 1155 | 1155 | } |
| 1156 | 1156 | |
@@ -1164,12 +1164,12 @@ discard block |
||
| 1164 | 1164 | * @static |
| 1165 | 1165 | * @return void |
| 1166 | 1166 | */ |
| 1167 | - public static function create_no_ticket_prices_array(){ |
|
| 1167 | + public static function create_no_ticket_prices_array() { |
|
| 1168 | 1168 | // this creates an array for tracking events that have no active ticket prices created |
| 1169 | 1169 | // this allows us to warn admins of the situation so that it can be corrected |
| 1170 | - $espresso_no_ticket_prices = get_option( 'ee_no_ticket_prices', FALSE ); |
|
| 1171 | - if ( ! $espresso_no_ticket_prices ) { |
|
| 1172 | - add_option( 'ee_no_ticket_prices', array(), '', FALSE ); |
|
| 1170 | + $espresso_no_ticket_prices = get_option('ee_no_ticket_prices', FALSE); |
|
| 1171 | + if ( ! $espresso_no_ticket_prices) { |
|
| 1172 | + add_option('ee_no_ticket_prices', array(), '', FALSE); |
|
| 1173 | 1173 | } |
| 1174 | 1174 | } |
| 1175 | 1175 | |
@@ -1191,24 +1191,24 @@ discard block |
||
| 1191 | 1191 | * Finds all our EE4 custom post types, and deletes them and their associated data (like post meta or term relations)/ |
| 1192 | 1192 | * @global wpdb $wpdb |
| 1193 | 1193 | */ |
| 1194 | - public static function delete_all_espresso_cpt_data(){ |
|
| 1194 | + public static function delete_all_espresso_cpt_data() { |
|
| 1195 | 1195 | global $wpdb; |
| 1196 | 1196 | //get all the CPT post_types |
| 1197 | 1197 | $ee_post_types = array(); |
| 1198 | - foreach(EE_Registry::instance()->non_abstract_db_models as $model_name){ |
|
| 1199 | - if ( method_exists( $model_name, 'instance' )) { |
|
| 1200 | - $model_obj = call_user_func( array( $model_name, 'instance' )); |
|
| 1201 | - if ( $model_obj instanceof EEM_CPT_Base ) { |
|
| 1202 | - $ee_post_types[] = $wpdb->prepare("%s",$model_obj->post_type()); |
|
| 1198 | + foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) { |
|
| 1199 | + if (method_exists($model_name, 'instance')) { |
|
| 1200 | + $model_obj = call_user_func(array($model_name, 'instance')); |
|
| 1201 | + if ($model_obj instanceof EEM_CPT_Base) { |
|
| 1202 | + $ee_post_types[] = $wpdb->prepare("%s", $model_obj->post_type()); |
|
| 1203 | 1203 | } |
| 1204 | 1204 | } |
| 1205 | 1205 | } |
| 1206 | 1206 | //get all our CPTs |
| 1207 | - $query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",",$ee_post_types).")"; |
|
| 1207 | + $query = "SELECT ID FROM {$wpdb->posts} WHERE post_type IN (".implode(",", $ee_post_types).")"; |
|
| 1208 | 1208 | $cpt_ids = $wpdb->get_col($query); |
| 1209 | 1209 | //delete each post meta and term relations too |
| 1210 | - foreach($cpt_ids as $post_id){ |
|
| 1211 | - wp_delete_post($post_id,true); |
|
| 1210 | + foreach ($cpt_ids as $post_id) { |
|
| 1211 | + wp_delete_post($post_id, true); |
|
| 1212 | 1212 | } |
| 1213 | 1213 | } |
| 1214 | 1214 | |
@@ -1222,18 +1222,18 @@ discard block |
||
| 1222 | 1222 | * @param bool $remove_all |
| 1223 | 1223 | * @return void |
| 1224 | 1224 | */ |
| 1225 | - public static function delete_all_espresso_tables_and_data( $remove_all = TRUE ) { // FALSE |
|
| 1225 | + public static function delete_all_espresso_tables_and_data($remove_all = TRUE) { // FALSE |
|
| 1226 | 1226 | global $wpdb; |
| 1227 | 1227 | $undeleted_tables = array(); |
| 1228 | 1228 | |
| 1229 | 1229 | // load registry |
| 1230 | - foreach( EE_Registry::instance()->non_abstract_db_models as $model_name ){ |
|
| 1231 | - if ( method_exists( $model_name, 'instance' )) { |
|
| 1232 | - $model_obj = call_user_func( array( $model_name, 'instance' )); |
|
| 1233 | - if ( $model_obj instanceof EEM_Base ) { |
|
| 1234 | - foreach ( $model_obj->get_tables() as $table ) { |
|
| 1235 | - if ( strpos( $table->get_table_name(), 'esp_' )) { |
|
| 1236 | - switch ( EEH_Activation::delete_unused_db_table( $table->get_table_name() )) { |
|
| 1230 | + foreach (EE_Registry::instance()->non_abstract_db_models as $model_name) { |
|
| 1231 | + if (method_exists($model_name, 'instance')) { |
|
| 1232 | + $model_obj = call_user_func(array($model_name, 'instance')); |
|
| 1233 | + if ($model_obj instanceof EEM_Base) { |
|
| 1234 | + foreach ($model_obj->get_tables() as $table) { |
|
| 1235 | + if (strpos($table->get_table_name(), 'esp_')) { |
|
| 1236 | + switch (EEH_Activation::delete_unused_db_table($table->get_table_name())) { |
|
| 1237 | 1237 | case FALSE : |
| 1238 | 1238 | $undeleted_tables[] = $table->get_table_name(); |
| 1239 | 1239 | break; |
@@ -1258,8 +1258,8 @@ discard block |
||
| 1258 | 1258 | 'wp_esp_promotion_rule', |
| 1259 | 1259 | 'wp_esp_rule' |
| 1260 | 1260 | ); |
| 1261 | - foreach( $tables_without_models as $table ){ |
|
| 1262 | - EEH_Activation::delete_unused_db_table( $table ); |
|
| 1261 | + foreach ($tables_without_models as $table) { |
|
| 1262 | + EEH_Activation::delete_unused_db_table($table); |
|
| 1263 | 1263 | } |
| 1264 | 1264 | |
| 1265 | 1265 | |
@@ -1295,51 +1295,51 @@ discard block |
||
| 1295 | 1295 | ); |
| 1296 | 1296 | |
| 1297 | 1297 | $undeleted_options = array(); |
| 1298 | - foreach ( $wp_options_to_delete as $option_name => $no_wildcard ) { |
|
| 1298 | + foreach ($wp_options_to_delete as $option_name => $no_wildcard) { |
|
| 1299 | 1299 | |
| 1300 | - if( $no_wildcard ){ |
|
| 1301 | - if( ! delete_option( $option_name ) ){ |
|
| 1300 | + if ($no_wildcard) { |
|
| 1301 | + if ( ! delete_option($option_name)) { |
|
| 1302 | 1302 | $undeleted_options[] = $option_name; |
| 1303 | 1303 | } |
| 1304 | - }else{ |
|
| 1305 | - $option_names_to_delete_from_wildcard = $wpdb->get_col( "SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'" ); |
|
| 1306 | - foreach($option_names_to_delete_from_wildcard as $option_name_from_wildcard ){ |
|
| 1307 | - if( ! delete_option( $option_name_from_wildcard ) ){ |
|
| 1304 | + } else { |
|
| 1305 | + $option_names_to_delete_from_wildcard = $wpdb->get_col("SELECT option_name FROM $wpdb->options WHERE option_name LIKE '%$option_name%'"); |
|
| 1306 | + foreach ($option_names_to_delete_from_wildcard as $option_name_from_wildcard) { |
|
| 1307 | + if ( ! delete_option($option_name_from_wildcard)) { |
|
| 1308 | 1308 | $undeleted_options[] = $option_name_from_wildcard; |
| 1309 | 1309 | } |
| 1310 | 1310 | } |
| 1311 | 1311 | } |
| 1312 | 1312 | } |
| 1313 | 1313 | |
| 1314 | - if ( $remove_all && $espresso_db_update = get_option( 'espresso_db_update' )) { |
|
| 1314 | + if ($remove_all && $espresso_db_update = get_option('espresso_db_update')) { |
|
| 1315 | 1315 | $db_update_sans_ee4 = array(); |
| 1316 | - foreach($espresso_db_update as $version => $times_activated){ |
|
| 1317 | - if( $version[0] =='3'){//if its NON EE4 |
|
| 1316 | + foreach ($espresso_db_update as $version => $times_activated) { |
|
| 1317 | + if ($version[0] == '3') {//if its NON EE4 |
|
| 1318 | 1318 | $db_update_sans_ee4[$version] = $times_activated; |
| 1319 | 1319 | } |
| 1320 | 1320 | } |
| 1321 | - update_option( 'espresso_db_update', $db_update_sans_ee4 ); |
|
| 1321 | + update_option('espresso_db_update', $db_update_sans_ee4); |
|
| 1322 | 1322 | } |
| 1323 | 1323 | |
| 1324 | 1324 | $errors = ''; |
| 1325 | - if ( ! empty( $undeleted_tables )) { |
|
| 1325 | + if ( ! empty($undeleted_tables)) { |
|
| 1326 | 1326 | $errors .= sprintf( |
| 1327 | - __( 'The following tables could not be deleted: %s%s', 'event_espresso' ), |
|
| 1327 | + __('The following tables could not be deleted: %s%s', 'event_espresso'), |
|
| 1328 | 1328 | '<br/>', |
| 1329 | - implode( ',<br/>', $undeleted_tables ) |
|
| 1329 | + implode(',<br/>', $undeleted_tables) |
|
| 1330 | 1330 | ); |
| 1331 | 1331 | } |
| 1332 | - if ( ! empty( $undeleted_options )) { |
|
| 1333 | - $errors .= ! empty( $undeleted_tables ) ? '<br/>' : ''; |
|
| 1332 | + if ( ! empty($undeleted_options)) { |
|
| 1333 | + $errors .= ! empty($undeleted_tables) ? '<br/>' : ''; |
|
| 1334 | 1334 | $errors .= sprintf( |
| 1335 | - __( 'The following wp-options could not be deleted: %s%s', 'event_espresso' ), |
|
| 1335 | + __('The following wp-options could not be deleted: %s%s', 'event_espresso'), |
|
| 1336 | 1336 | '<br/>', |
| 1337 | - implode( ',<br/>', $undeleted_options ) |
|
| 1337 | + implode(',<br/>', $undeleted_options) |
|
| 1338 | 1338 | ); |
| 1339 | 1339 | |
| 1340 | 1340 | } |
| 1341 | - if ( $errors != '' ) { |
|
| 1342 | - EE_Error::add_attention( $errors, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 1341 | + if ($errors != '') { |
|
| 1342 | + EE_Error::add_attention($errors, __FILE__, __FUNCTION__, __LINE__); |
|
| 1343 | 1343 | } |
| 1344 | 1344 | } |
| 1345 | 1345 | |
@@ -1349,25 +1349,25 @@ discard block |
||
| 1349 | 1349 | * @param string $table_name with or without $wpdb->prefix |
| 1350 | 1350 | * @return boolean |
| 1351 | 1351 | */ |
| 1352 | - public static function table_exists( $table_name ){ |
|
| 1352 | + public static function table_exists($table_name) { |
|
| 1353 | 1353 | global $wpdb, $EZSQL_ERROR; |
| 1354 | - if(strpos($table_name, $wpdb->prefix) !== 0){ |
|
| 1354 | + if (strpos($table_name, $wpdb->prefix) !== 0) { |
|
| 1355 | 1355 | $table_name = $wpdb->prefix.$table_name; |
| 1356 | 1356 | } |
| 1357 | 1357 | //ignore if this causes an sql error |
| 1358 | 1358 | $old_error = $wpdb->last_error; |
| 1359 | 1359 | $old_suppress_errors = $wpdb->suppress_errors(); |
| 1360 | - $old_show_errors_value = $wpdb->show_errors( FALSE ); |
|
| 1360 | + $old_show_errors_value = $wpdb->show_errors(FALSE); |
|
| 1361 | 1361 | $ezsql_error_cache = $EZSQL_ERROR; |
| 1362 | - $wpdb->get_results( "SELECT * from $table_name LIMIT 1"); |
|
| 1363 | - $wpdb->show_errors( $old_show_errors_value ); |
|
| 1364 | - $wpdb->suppress_errors( $old_suppress_errors ); |
|
| 1362 | + $wpdb->get_results("SELECT * from $table_name LIMIT 1"); |
|
| 1363 | + $wpdb->show_errors($old_show_errors_value); |
|
| 1364 | + $wpdb->suppress_errors($old_suppress_errors); |
|
| 1365 | 1365 | $new_error = $wpdb->last_error; |
| 1366 | 1366 | $wpdb->last_error = $old_error; |
| 1367 | 1367 | $EZSQL_ERROR = $ezsql_error_cache; |
| 1368 | - if( empty( $new_error ) ){ |
|
| 1368 | + if (empty($new_error)) { |
|
| 1369 | 1369 | return TRUE; |
| 1370 | - }else{ |
|
| 1370 | + } else { |
|
| 1371 | 1371 | return FALSE; |
| 1372 | 1372 | } |
| 1373 | 1373 | } |
@@ -1375,7 +1375,7 @@ discard block |
||
| 1375 | 1375 | /** |
| 1376 | 1376 | * Resets the cache on EEH_Activation |
| 1377 | 1377 | */ |
| 1378 | - public static function reset(){ |
|
| 1378 | + public static function reset() { |
|
| 1379 | 1379 | self::$_default_creator_id = NULL; |
| 1380 | 1380 | } |
| 1381 | 1381 | } |
@@ -60,19 +60,19 @@ |
||
| 60 | 60 | private static function _timezone_convert_to_string_from_offset( $offset ) { |
| 61 | 61 | //shamelessly taken from bottom comment at http://ca1.php.net/manual/en/function.timezone-name-from-abbr.php because timezone_name_from_abbr() did NOT work as expected - its not reliable |
| 62 | 62 | $offset *= 3600; // convert hour offset to seconds |
| 63 | - $abbrarray = timezone_abbreviations_list(); |
|
| 64 | - foreach ($abbrarray as $abbr) |
|
| 65 | - { |
|
| 66 | - foreach ($abbr as $city) |
|
| 67 | - { |
|
| 68 | - if ($city['offset'] === $offset && $city['dst'] === FALSE) |
|
| 69 | - { |
|
| 70 | - return $city['timezone_id']; |
|
| 71 | - } |
|
| 72 | - } |
|
| 73 | - } |
|
| 74 | - |
|
| 75 | - return FALSE; |
|
| 63 | + $abbrarray = timezone_abbreviations_list(); |
|
| 64 | + foreach ($abbrarray as $abbr) |
|
| 65 | + { |
|
| 66 | + foreach ($abbr as $city) |
|
| 67 | + { |
|
| 68 | + if ($city['offset'] === $offset && $city['dst'] === FALSE) |
|
| 69 | + { |
|
| 70 | + return $city['timezone_id']; |
|
| 71 | + } |
|
| 72 | + } |
|
| 73 | + } |
|
| 74 | + |
|
| 75 | + return FALSE; |
|
| 76 | 76 | } |
| 77 | 77 | |
| 78 | 78 | |
@@ -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 | /** |
@@ -40,10 +40,10 @@ discard block |
||
| 40 | 40 | public static function get_timezone() { |
| 41 | 41 | $timezone = get_option('timezone_string'); |
| 42 | 42 | //if timezone is STILL empty then let's get the GMT offset and then set the timezone_string using our converter |
| 43 | - if ( empty( $timezone ) ) { |
|
| 43 | + if (empty($timezone)) { |
|
| 44 | 44 | //let's get a the WordPress UTC offset |
| 45 | 45 | $offset = get_option('gmt_offset'); |
| 46 | - $timezone = self::_timezone_convert_to_string_from_offset( $offset ); |
|
| 46 | + $timezone = self::_timezone_convert_to_string_from_offset($offset); |
|
| 47 | 47 | } |
| 48 | 48 | return $timezone; |
| 49 | 49 | } |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | * @param string $offset GMT offset |
| 58 | 58 | * @return string timezone_string (valid for DateTimeZone) |
| 59 | 59 | */ |
| 60 | - private static function _timezone_convert_to_string_from_offset( $offset ) { |
|
| 60 | + private static function _timezone_convert_to_string_from_offset($offset) { |
|
| 61 | 61 | //shamelessly taken from bottom comment at http://ca1.php.net/manual/en/function.timezone-name-from-abbr.php because timezone_name_from_abbr() did NOT work as expected - its not reliable |
| 62 | 62 | $offset *= 3600; // convert hour offset to seconds |
| 63 | 63 | $abbrarray = timezone_abbreviations_list(); |
@@ -77,14 +77,14 @@ discard block |
||
| 77 | 77 | |
| 78 | 78 | |
| 79 | 79 | |
| 80 | - public function prepare_dtt_from_db( $dttvalue, $format = 'U' ) { |
|
| 80 | + public function prepare_dtt_from_db($dttvalue, $format = 'U') { |
|
| 81 | 81 | |
| 82 | 82 | $timezone = self::get_timezone(); |
| 83 | 83 | |
| 84 | - $date_obj = new DateTime( $dttvalue, new DateTimeZone('UTC') ); |
|
| 85 | - if ( !$date_obj ) |
|
| 86 | - throw new EE_Error( __('Something went wrong with setting the date/time. Likely, either there is an invalid datetime string or an invalid timezone string being used.', 'event_espresso' ) ); |
|
| 87 | - $date_obj->setTimezone( new DateTimeZone($timezone) ); |
|
| 84 | + $date_obj = new DateTime($dttvalue, new DateTimeZone('UTC')); |
|
| 85 | + if ( ! $date_obj) |
|
| 86 | + throw new EE_Error(__('Something went wrong with setting the date/time. Likely, either there is an invalid datetime string or an invalid timezone string being used.', 'event_espresso')); |
|
| 87 | + $date_obj->setTimezone(new DateTimeZone($timezone)); |
|
| 88 | 88 | |
| 89 | 89 | return $date_obj->format($format); |
| 90 | 90 | } |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | |
| 95 | 95 | |
| 96 | 96 | public static function ddtimezone($tz_event = '') { |
| 97 | - do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
| 97 | + do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
| 98 | 98 | |
| 99 | 99 | $timezone_format = _x('Y-m-d G:i:s', 'timezone date format'); |
| 100 | 100 | |
@@ -112,9 +112,9 @@ discard block |
||
| 112 | 112 | if (0 == $current_offset) |
| 113 | 113 | $tzstring = 'UTC'; |
| 114 | 114 | elseif ($current_offset < 0) |
| 115 | - $tzstring = 'UTC' . $current_offset; |
|
| 115 | + $tzstring = 'UTC'.$current_offset; |
|
| 116 | 116 | else |
| 117 | - $tzstring = 'UTC+' . $current_offset; |
|
| 117 | + $tzstring = 'UTC+'.$current_offset; |
|
| 118 | 118 | } |
| 119 | 119 | ?> |
| 120 | 120 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | </p> |
| 127 | 127 | |
| 128 | 128 | <p><span><?php printf(__('<abbr title="Coordinated Universal Time">UTC</abbr> time is <code>%s</code>'), date_i18n($timezone_format, false, 'gmt')); ?></span> |
| 129 | - <?php if (get_option('timezone_string') || !empty($current_offset)) : ?> |
|
| 129 | + <?php if (get_option('timezone_string') || ! empty($current_offset)) : ?> |
|
| 130 | 130 | <br /><span><?php printf(__('Local time is <code>%1$s</code>'), date_i18n($timezone_format)); ?></span> |
| 131 | 131 | <?php endif; ?> |
| 132 | 132 | |
@@ -159,10 +159,9 @@ discard block |
||
| 159 | 159 | if ($found) { |
| 160 | 160 | echo ' '; |
| 161 | 161 | $message = $tr['isdst'] ? |
| 162 | - __('Daylight saving time begins on: <code>%s</code>.') : |
|
| 163 | - __('Standard time begins on: <code>%s</code>.'); |
|
| 162 | + __('Daylight saving time begins on: <code>%s</code>.') : __('Standard time begins on: <code>%s</code>.'); |
|
| 164 | 163 | // Add the difference between the current offset and the new offset to ts to get the correct transition time from date_i18n(). |
| 165 | - printf($message, date_i18n(get_option('date_format') . ' ' . get_option('time_format'), $tr['ts'] + ($tz_offset - $tr['offset']))); |
|
| 164 | + printf($message, date_i18n(get_option('date_format').' '.get_option('time_format'), $tr['ts'] + ($tz_offset - $tr['offset']))); |
|
| 166 | 165 | } else { |
| 167 | 166 | _e('This timezone does not observe daylight saving time.'); |
| 168 | 167 | } |
@@ -177,16 +176,16 @@ discard block |
||
| 177 | 176 | |
| 178 | 177 | |
| 179 | 178 | |
| 180 | - public static function date_time_for_timezone( $timestamp, $format, $timezone ) { |
|
| 181 | - $timezone = empty( $timezone ) ? self::get_timezone() : $timezone; |
|
| 179 | + public static function date_time_for_timezone($timestamp, $format, $timezone) { |
|
| 180 | + $timezone = empty($timezone) ? self::get_timezone() : $timezone; |
|
| 182 | 181 | |
| 183 | 182 | //set timezone |
| 184 | - date_default_timezone_set( $timezone ); |
|
| 183 | + date_default_timezone_set($timezone); |
|
| 185 | 184 | |
| 186 | - $date = date( $format, $timestamp ); |
|
| 185 | + $date = date($format, $timestamp); |
|
| 187 | 186 | |
| 188 | 187 | //setback |
| 189 | - date_default_timezone_set( 'UTC' ); |
|
| 188 | + date_default_timezone_set('UTC'); |
|
| 190 | 189 | return $date; |
| 191 | 190 | } |
| 192 | 191 | |
@@ -199,7 +198,7 @@ discard block |
||
| 199 | 198 | * @param integer $value what you want to increment the time by |
| 200 | 199 | * @return EE_Base_Class return the EE_Base_Class object so right away you can do something with it (chaining) |
| 201 | 200 | */ |
| 202 | - public static function date_time_add( EE_Base_Class $obj, $dttfield, $what = 'years', $value = 1 ) { |
|
| 201 | + public static function date_time_add(EE_Base_Class $obj, $dttfield, $what = 'years', $value = 1) { |
|
| 203 | 202 | //get the raw UTC date. |
| 204 | 203 | $dtt = $obj->get_raw($dttfield); |
| 205 | 204 | $new_date = self::calc_date($dtt, $what, $value); |
@@ -209,7 +208,7 @@ discard block |
||
| 209 | 208 | } |
| 210 | 209 | |
| 211 | 210 | //same as date_time_add except subtracting value instead of adding. |
| 212 | - public static function date_time_subtract( EE_Base_Class $obj, $dttfield, $what = 'years', $value = 1 ) { |
|
| 211 | + public static function date_time_subtract(EE_Base_Class $obj, $dttfield, $what = 'years', $value = 1) { |
|
| 213 | 212 | //get the raw UTC date |
| 214 | 213 | $dtt = $obj->get_raw($dttfield); |
| 215 | 214 | $new_date = self::calc_date($dtt, $what, $value, '-'); |
@@ -228,21 +227,21 @@ discard block |
||
| 228 | 227 | * @param string $operand What operand you wish to use for the calculation |
| 229 | 228 | * @return string new UTC timestamp |
| 230 | 229 | */ |
| 231 | - public static function calc_date( $utcdtt, $what = 'years', $value = 1, $operand = '+' ) { |
|
| 230 | + public static function calc_date($utcdtt, $what = 'years', $value = 1, $operand = '+') { |
|
| 232 | 231 | $newdtt = ''; |
| 233 | 232 | |
| 234 | - switch ( $what ) { |
|
| 233 | + switch ($what) { |
|
| 235 | 234 | case 'years' : |
| 236 | - $value = (60*60*24*364.5) * $value; |
|
| 235 | + $value = (60 * 60 * 24 * 364.5) * $value; |
|
| 237 | 236 | break; |
| 238 | 237 | case 'months' : |
| 239 | - $value = (60*60*24*30.375) * $value; |
|
| 238 | + $value = (60 * 60 * 24 * 30.375) * $value; |
|
| 240 | 239 | break; |
| 241 | 240 | case 'days' : |
| 242 | - $value = (60*60*24) * $value; |
|
| 241 | + $value = (60 * 60 * 24) * $value; |
|
| 243 | 242 | break; |
| 244 | 243 | case 'hours' : |
| 245 | - $value = (60*60) * $value; |
|
| 244 | + $value = (60 * 60) * $value; |
|
| 246 | 245 | break; |
| 247 | 246 | case 'minutes' : |
| 248 | 247 | $value = 60 * $value; |
@@ -252,7 +251,7 @@ discard block |
||
| 252 | 251 | break; |
| 253 | 252 | } |
| 254 | 253 | |
| 255 | - switch ( $operand ) { |
|
| 254 | + switch ($operand) { |
|
| 256 | 255 | case '+': |
| 257 | 256 | $newdtt = $utcdtt + $value; |
| 258 | 257 | break; |
@@ -1,6 +1,7 @@ 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 | 6 | /** |
| 6 | 7 | * Event Espresso |
@@ -82,8 +83,9 @@ discard block |
||
| 82 | 83 | $timezone = self::get_timezone(); |
| 83 | 84 | |
| 84 | 85 | $date_obj = new DateTime( $dttvalue, new DateTimeZone('UTC') ); |
| 85 | - if ( !$date_obj ) |
|
| 86 | - throw new EE_Error( __('Something went wrong with setting the date/time. Likely, either there is an invalid datetime string or an invalid timezone string being used.', 'event_espresso' ) ); |
|
| 86 | + if ( !$date_obj ) { |
|
| 87 | + throw new EE_Error( __('Something went wrong with setting the date/time. Likely, either there is an invalid datetime string or an invalid timezone string being used.', 'event_espresso' ) ); |
|
| 88 | + } |
|
| 87 | 89 | $date_obj->setTimezone( new DateTimeZone($timezone) ); |
| 88 | 90 | |
| 89 | 91 | return $date_obj->format($format); |
@@ -104,17 +106,19 @@ discard block |
||
| 104 | 106 | $check_zone_info = true; |
| 105 | 107 | |
| 106 | 108 | // Remove old Etc mappings. Fallback to gmt_offset. |
| 107 | - if (false !== strpos($tzstring, 'Etc/GMT')) |
|
| 108 | - $tzstring = ''; |
|
| 109 | + if (false !== strpos($tzstring, 'Etc/GMT')) { |
|
| 110 | + $tzstring = ''; |
|
| 111 | + } |
|
| 109 | 112 | |
| 110 | 113 | if (empty($tzstring)) { // Create a UTC+- zone if no timezone string exists |
| 111 | 114 | $check_zone_info = false; |
| 112 | - if (0 == $current_offset) |
|
| 113 | - $tzstring = 'UTC'; |
|
| 114 | - elseif ($current_offset < 0) |
|
| 115 | - $tzstring = 'UTC' . $current_offset; |
|
| 116 | - else |
|
| 117 | - $tzstring = 'UTC+' . $current_offset; |
|
| 115 | + if (0 == $current_offset) { |
|
| 116 | + $tzstring = 'UTC'; |
|
| 117 | + } elseif ($current_offset < 0) { |
|
| 118 | + $tzstring = 'UTC' . $current_offset; |
|
| 119 | + } else { |
|
| 120 | + $tzstring = 'UTC+' . $current_offset; |
|
| 121 | + } |
|
| 118 | 122 | } |
| 119 | 123 | ?> |
| 120 | 124 | |
@@ -137,10 +141,11 @@ discard block |
||
| 137 | 141 | // Set TZ so localtime works. |
| 138 | 142 | date_default_timezone_set($tzstring); |
| 139 | 143 | $now = localtime(time(), true); |
| 140 | - if ($now['tm_isdst']) |
|
| 141 | - _e('This timezone is currently in daylight saving time.'); |
|
| 142 | - else |
|
| 143 | - _e('This timezone is currently in standard time.'); |
|
| 144 | + if ($now['tm_isdst']) { |
|
| 145 | + _e('This timezone is currently in daylight saving time.'); |
|
| 146 | + } else { |
|
| 147 | + _e('This timezone is currently in standard time.'); |
|
| 148 | + } |
|
| 144 | 149 | ?> |
| 145 | 150 | <br /> |
| 146 | 151 | <?php |
@@ -40,27 +40,27 @@ discard block |
||
| 40 | 40 | * @param int $EVT_ID |
| 41 | 41 | * @return object |
| 42 | 42 | */ |
| 43 | - public static function get_event( $EVT_ID = 0 ) { |
|
| 44 | - $EVT_ID = $EVT_ID instanceof WP_Post ? $EVT_ID->ID : absint( $EVT_ID ); |
|
| 43 | + public static function get_event($EVT_ID = 0) { |
|
| 44 | + $EVT_ID = $EVT_ID instanceof WP_Post ? $EVT_ID->ID : absint($EVT_ID); |
|
| 45 | 45 | // do we already have the Event you are looking for? |
| 46 | - if ( EEH_Event_View::$_event instanceof EE_Event && $EVT_ID && EEH_Event_View::$_event->ID() === $EVT_ID ) { |
|
| 46 | + if (EEH_Event_View::$_event instanceof EE_Event && $EVT_ID && EEH_Event_View::$_event->ID() === $EVT_ID) { |
|
| 47 | 47 | return EEH_Event_View::$_event; |
| 48 | 48 | } |
| 49 | 49 | EEH_Event_View::$_event = NULL; |
| 50 | 50 | // international newspaper? |
| 51 | 51 | global $post; |
| 52 | 52 | // if this is being called from an EE_Event post, then we can just grab the attached EE_Event object |
| 53 | - if ( isset( $post->post_type ) && $post->post_type == 'espresso_events' || $EVT_ID ) { |
|
| 53 | + if (isset($post->post_type) && $post->post_type == 'espresso_events' || $EVT_ID) { |
|
| 54 | 54 | // d( $post ); |
| 55 | 55 | // grab the event we're looking for |
| 56 | - if ( isset( $post->EE_Event ) && ( $EVT_ID == 0 || ( $EVT_ID == $post->ID ))) { |
|
| 56 | + if (isset($post->EE_Event) && ($EVT_ID == 0 || ($EVT_ID == $post->ID))) { |
|
| 57 | 57 | EEH_Event_View::$_event = $post->EE_Event; |
| 58 | 58 | // d( EEH_Event_View::$_event ); |
| 59 | 59 | } |
| 60 | 60 | // now if we STILL do NOT have an EE_Event model object, BUT we have an Event ID... |
| 61 | - if ( ! EEH_Event_View::$_event instanceof EE_Event && $EVT_ID ) { |
|
| 61 | + if ( ! EEH_Event_View::$_event instanceof EE_Event && $EVT_ID) { |
|
| 62 | 62 | // sigh... pull it from the db |
| 63 | - EEH_Event_View::$_event = EEM_Event::instance()->get_one_by_ID( $EVT_ID ); |
|
| 63 | + EEH_Event_View::$_event = EEM_Event::instance()->get_one_by_ID($EVT_ID); |
|
| 64 | 64 | // d( EEH_Event_View::$_event ); |
| 65 | 65 | } |
| 66 | 66 | } |
@@ -76,8 +76,8 @@ discard block |
||
| 76 | 76 | * @param int $EVT_ID |
| 77 | 77 | * @return boolean |
| 78 | 78 | */ |
| 79 | - public static function display_ticket_selector( $EVT_ID = 0 ) { |
|
| 80 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 79 | + public static function display_ticket_selector($EVT_ID = 0) { |
|
| 80 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 81 | 81 | return $event instanceof EE_Event ? $event->display_ticket_selector() : FALSE; |
| 82 | 82 | } |
| 83 | 83 | |
@@ -90,9 +90,9 @@ discard block |
||
| 90 | 90 | * @param int $EVT_ID |
| 91 | 91 | * @return string |
| 92 | 92 | */ |
| 93 | - public static function event_status( $EVT_ID = 0 ) { |
|
| 94 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 95 | - return $event instanceof EE_Event ? $event->pretty_active_status( FALSE ) : ''; |
|
| 93 | + public static function event_status($EVT_ID = 0) { |
|
| 94 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 95 | + return $event instanceof EE_Event ? $event->pretty_active_status(FALSE) : ''; |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | |
@@ -104,8 +104,8 @@ discard block |
||
| 104 | 104 | * @param int $EVT_ID |
| 105 | 105 | * @return string |
| 106 | 106 | */ |
| 107 | - public static function event_active_status( $EVT_ID = 0 ) { |
|
| 108 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 107 | + public static function event_active_status($EVT_ID = 0) { |
|
| 108 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 109 | 109 | return $event instanceof EE_Event ? $event->pretty_active_status() : 'inactive'; |
| 110 | 110 | } |
| 111 | 111 | |
@@ -118,13 +118,13 @@ discard block |
||
| 118 | 118 | * @param int $EVT_ID |
| 119 | 119 | * @return string |
| 120 | 120 | */ |
| 121 | - public static function event_has_content_or_excerpt( $EVT_ID = 0 ) { |
|
| 122 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 121 | + public static function event_has_content_or_excerpt($EVT_ID = 0) { |
|
| 122 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 123 | 123 | $has_content_or_excerpt = FALSE; |
| 124 | - if ( $event instanceof EE_Event ) { |
|
| 125 | - $has_content_or_excerpt = $event->description() != '' || $event->short_description( NULL, NULL, TRUE ) != '' ? TRUE : FALSE; |
|
| 124 | + if ($event instanceof EE_Event) { |
|
| 125 | + $has_content_or_excerpt = $event->description() != '' || $event->short_description(NULL, NULL, TRUE) != '' ? TRUE : FALSE; |
|
| 126 | 126 | } |
| 127 | - if ( is_archive() && ! ( espresso_display_full_description_in_event_list() || espresso_display_excerpt_in_event_list() )) { |
|
| 127 | + if (is_archive() && ! (espresso_display_full_description_in_event_list() || espresso_display_excerpt_in_event_list())) { |
|
| 128 | 128 | $has_content_or_excerpt = FALSE; |
| 129 | 129 | } |
| 130 | 130 | return $has_content_or_excerpt; |
@@ -140,39 +140,39 @@ discard block |
||
| 140 | 140 | * @param null $more |
| 141 | 141 | * @return string |
| 142 | 142 | */ |
| 143 | - public static function event_content_or_excerpt( $num_words = NULL, $more = NULL ) { |
|
| 143 | + public static function event_content_or_excerpt($num_words = NULL, $more = NULL) { |
|
| 144 | 144 | |
| 145 | 145 | global $post; |
| 146 | 146 | $content = ''; |
| 147 | 147 | |
| 148 | 148 | ob_start(); |
| 149 | - if (( is_single() ) || ( is_archive() && espresso_display_full_description_in_event_list() )) { |
|
| 149 | + if ((is_single()) || (is_archive() && espresso_display_full_description_in_event_list())) { |
|
| 150 | 150 | //echo '<h2 style="color:#E76700;">the_content<br/><span style="font-size:9px;font-weight:normal;color:#666">' . __FILE__ . '</span> <b style="font-size:10px;color:#333"> ' . __LINE__ . ' </b></h2>'; |
| 151 | 151 | the_content(); |
| 152 | - } else if (( is_archive() && has_excerpt( $post->ID ) && espresso_display_excerpt_in_event_list() ) || apply_filters( 'FHEE__EES_Espresso_Events__process_shortcode__true', FALSE )) { |
|
| 152 | + } else if ((is_archive() && has_excerpt($post->ID) && espresso_display_excerpt_in_event_list()) || apply_filters('FHEE__EES_Espresso_Events__process_shortcode__true', FALSE)) { |
|
| 153 | 153 | //echo '<h2 style="color:#E76700;">the_excerpt<br/><span style="font-size:9px;font-weight:normal;color:#666">' . __FILE__ . '</span> <b style="font-size:10px;color:#333"> ' . __LINE__ . ' </b></h2>'; |
| 154 | 154 | the_excerpt(); |
| 155 | - } else if (( is_archive() && ! has_excerpt( $post->ID ) && espresso_display_excerpt_in_event_list() )) { |
|
| 155 | + } else if ((is_archive() && ! has_excerpt($post->ID) && espresso_display_excerpt_in_event_list())) { |
|
| 156 | 156 | //echo '<h2 style="color:#E76700;">get_the_content<br/><span style="font-size:9px;font-weight:normal;color:#666">' . __FILE__ . '</span><b style="font-size:10px;color:#333"> ' . __LINE__ . ' </b></h2>'; |
| 157 | - if ( ! empty( $num_words )) { |
|
| 158 | - if ( empty( $more )) { |
|
| 159 | - $more = ' <a href="' . get_permalink() . '" class="more-link">' . __( '(more…)' ) . '</a>'; |
|
| 160 | - $more = apply_filters( 'the_content_more_link', $more ); |
|
| 157 | + if ( ! empty($num_words)) { |
|
| 158 | + if (empty($more)) { |
|
| 159 | + $more = ' <a href="'.get_permalink().'" class="more-link">'.__('(more…)').'</a>'; |
|
| 160 | + $more = apply_filters('the_content_more_link', $more); |
|
| 161 | 161 | } |
| 162 | - $content = str_replace( 'NOMORELINK', '', get_the_content( 'NOMORELINK' )); |
|
| 162 | + $content = str_replace('NOMORELINK', '', get_the_content('NOMORELINK')); |
|
| 163 | 163 | |
| 164 | - $content = wp_trim_words( $content, $num_words, ' ' ) . $more; |
|
| 164 | + $content = wp_trim_words($content, $num_words, ' ').$more; |
|
| 165 | 165 | } else { |
| 166 | - $content = get_the_content(); |
|
| 166 | + $content = get_the_content(); |
|
| 167 | 167 | } |
| 168 | 168 | global $allowedtags; |
| 169 | - $content = wp_kses( $content, $allowedtags ); |
|
| 170 | - $content = strip_shortcodes( $content ); |
|
| 171 | - echo apply_filters( 'the_content', $content ); |
|
| 169 | + $content = wp_kses($content, $allowedtags); |
|
| 170 | + $content = strip_shortcodes($content); |
|
| 171 | + echo apply_filters('the_content', $content); |
|
| 172 | 172 | |
| 173 | 173 | } else { |
| 174 | 174 | //echo '<h2 style="color:#E76700;">nothing<br/><span style="font-size:9px;font-weight:normal;color:#666">' . __FILE__ . '</span> <b style="font-size:10px;color:#333"> ' . __LINE__ . ' </b></h2>'; |
| 175 | - echo apply_filters( 'the_content', $content ); |
|
| 175 | + echo apply_filters('the_content', $content); |
|
| 176 | 176 | } |
| 177 | 177 | return ob_get_clean(); |
| 178 | 178 | } |
@@ -186,13 +186,13 @@ discard block |
||
| 186 | 186 | * @param int $EVT_ID |
| 187 | 187 | * @return string |
| 188 | 188 | */ |
| 189 | - public static function event_tickets_available( $EVT_ID = 0 ) { |
|
| 190 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 189 | + public static function event_tickets_available($EVT_ID = 0) { |
|
| 190 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 191 | 191 | $tickets_available_for_purchase = array(); |
| 192 | - if( $event instanceof EE_Event ) { |
|
| 193 | - $datetimes = EEH_Event_View::get_all_date_obj( $EVT_ID, FALSE ); |
|
| 194 | - foreach( $datetimes as $datetime ) { |
|
| 195 | - $tickets_available_for_purchase = array_merge( $tickets_available_for_purchase, $datetime->ticket_types_available_for_purchase() ); |
|
| 192 | + if ($event instanceof EE_Event) { |
|
| 193 | + $datetimes = EEH_Event_View::get_all_date_obj($EVT_ID, FALSE); |
|
| 194 | + foreach ($datetimes as $datetime) { |
|
| 195 | + $tickets_available_for_purchase = array_merge($tickets_available_for_purchase, $datetime->ticket_types_available_for_purchase()); |
|
| 196 | 196 | } |
| 197 | 197 | } |
| 198 | 198 | return $tickets_available_for_purchase; |
@@ -208,22 +208,22 @@ discard block |
||
| 208 | 208 | * @param bool $hide_uncategorized |
| 209 | 209 | * @return string |
| 210 | 210 | */ |
| 211 | - public static function event_categories( $EVT_ID = 0, $hide_uncategorized = TRUE ) { |
|
| 211 | + public static function event_categories($EVT_ID = 0, $hide_uncategorized = TRUE) { |
|
| 212 | 212 | $category_links = array(); |
| 213 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 214 | - if ( $event instanceof EE_Event ) { |
|
| 215 | - $event_categories = get_the_terms( $event->ID(), 'espresso_event_categories' ); |
|
| 216 | - if ( $event_categories ) { |
|
| 213 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 214 | + if ($event instanceof EE_Event) { |
|
| 215 | + $event_categories = get_the_terms($event->ID(), 'espresso_event_categories'); |
|
| 216 | + if ($event_categories) { |
|
| 217 | 217 | // loop thru terms and create links |
| 218 | - foreach ( $event_categories as $term ) { |
|
| 219 | - $url = get_term_link( $term, 'espresso_venue_categories' ); |
|
| 220 | - if ( ! is_wp_error( $url ) && (( $hide_uncategorized && strtolower( $term->name ) != __( 'uncategorized', 'event_espresso' )) || ! $hide_uncategorized )) { |
|
| 221 | - $category_links[] = '<a href="' . esc_url( $url ) . '" rel="tag">' . $term->name . '</a>'; |
|
| 218 | + foreach ($event_categories as $term) { |
|
| 219 | + $url = get_term_link($term, 'espresso_venue_categories'); |
|
| 220 | + if ( ! is_wp_error($url) && (($hide_uncategorized && strtolower($term->name) != __('uncategorized', 'event_espresso')) || ! $hide_uncategorized)) { |
|
| 221 | + $category_links[] = '<a href="'.esc_url($url).'" rel="tag">'.$term->name.'</a>'; |
|
| 222 | 222 | } |
| 223 | 223 | } |
| 224 | 224 | } |
| 225 | 225 | } |
| 226 | - return implode( ', ', $category_links ); |
|
| 226 | + return implode(', ', $category_links); |
|
| 227 | 227 | } |
| 228 | 228 | |
| 229 | 229 | |
@@ -237,9 +237,9 @@ discard block |
||
| 237 | 237 | * @param int $EVT_ID |
| 238 | 238 | * @return string |
| 239 | 239 | */ |
| 240 | - public static function the_event_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) { |
|
| 241 | - $datetime = EEH_Event_View::get_primary_date_obj( $EVT_ID ); |
|
| 242 | - return $datetime instanceof EE_Datetime ? $datetime->start_date_and_time( $dt_frmt, $tm_frmt ) : ''; |
|
| 240 | + public static function the_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) { |
|
| 241 | + $datetime = EEH_Event_View::get_primary_date_obj($EVT_ID); |
|
| 242 | + return $datetime instanceof EE_Datetime ? $datetime->start_date_and_time($dt_frmt, $tm_frmt) : ''; |
|
| 243 | 243 | } |
| 244 | 244 | |
| 245 | 245 | |
@@ -253,9 +253,9 @@ discard block |
||
| 253 | 253 | * @param int $EVT_ID |
| 254 | 254 | * @return string |
| 255 | 255 | */ |
| 256 | - public static function the_event_end_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) { |
|
| 257 | - $datetime = EEH_Event_View::get_last_date_obj( $EVT_ID ); |
|
| 258 | - return $datetime instanceof EE_Datetime ? $datetime->end_date_and_time( $dt_frmt, $tm_frmt ) : ''; |
|
| 256 | + public static function the_event_end_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) { |
|
| 257 | + $datetime = EEH_Event_View::get_last_date_obj($EVT_ID); |
|
| 258 | + return $datetime instanceof EE_Datetime ? $datetime->end_date_and_time($dt_frmt, $tm_frmt) : ''; |
|
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | |
@@ -269,9 +269,9 @@ discard block |
||
| 269 | 269 | * @param int $EVT_ID |
| 270 | 270 | * @return string |
| 271 | 271 | */ |
| 272 | - public static function the_earliest_event_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) { |
|
| 273 | - $datetime = EEH_Event_View::get_earliest_date_obj( $EVT_ID ); |
|
| 274 | - return $datetime instanceof EE_Datetime ? $datetime->start_date_and_time( $dt_frmt, $tm_frmt ) : ''; |
|
| 272 | + public static function the_earliest_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) { |
|
| 273 | + $datetime = EEH_Event_View::get_earliest_date_obj($EVT_ID); |
|
| 274 | + return $datetime instanceof EE_Datetime ? $datetime->start_date_and_time($dt_frmt, $tm_frmt) : ''; |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | |
@@ -285,9 +285,9 @@ discard block |
||
| 285 | 285 | * @param int $EVT_ID |
| 286 | 286 | * @return string |
| 287 | 287 | */ |
| 288 | - public static function the_latest_event_date( $dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0 ) { |
|
| 289 | - $datetime = EEH_Event_View::get_last_date_obj( $EVT_ID ); |
|
| 290 | - return $datetime instanceof EE_Datetime ? $datetime->end_date_and_time( $dt_frmt, $tm_frmt ) : ''; |
|
| 288 | + public static function the_latest_event_date($dt_frmt = 'D M jS', $tm_frmt = 'g:i a', $EVT_ID = 0) { |
|
| 289 | + $datetime = EEH_Event_View::get_last_date_obj($EVT_ID); |
|
| 290 | + return $datetime instanceof EE_Datetime ? $datetime->end_date_and_time($dt_frmt, $tm_frmt) : ''; |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | |
@@ -299,13 +299,13 @@ discard block |
||
| 299 | 299 | * @param int $EVT_ID |
| 300 | 300 | * @return string |
| 301 | 301 | */ |
| 302 | - public static function event_date_as_calendar_page( $EVT_ID = 0 ) { |
|
| 303 | - $datetime = EEH_Event_View::get_primary_date_obj( $EVT_ID ); |
|
| 304 | - if ( $datetime instanceof EE_Datetime ) { |
|
| 302 | + public static function event_date_as_calendar_page($EVT_ID = 0) { |
|
| 303 | + $datetime = EEH_Event_View::get_primary_date_obj($EVT_ID); |
|
| 304 | + if ($datetime instanceof EE_Datetime) { |
|
| 305 | 305 | ?> |
| 306 | 306 | <div class="event-date-calendar-page-dv"> |
| 307 | - <div class="event-date-calendar-page-month-dv"><?php echo date_i18n( 'M', strtotime( $datetime->start_date()));?></div> |
|
| 308 | - <div class="event-date-calendar-page-day-dv"><?php echo $datetime->start_date( 'd' );?></div> |
|
| 307 | + <div class="event-date-calendar-page-month-dv"><?php echo date_i18n('M', strtotime($datetime->start_date())); ?></div> |
|
| 308 | + <div class="event-date-calendar-page-day-dv"><?php echo $datetime->start_date('d'); ?></div> |
|
| 309 | 309 | </div> |
| 310 | 310 | <?php |
| 311 | 311 | } |
@@ -320,17 +320,17 @@ discard block |
||
| 320 | 320 | * @param int $EVT_ID |
| 321 | 321 | * @return string |
| 322 | 322 | */ |
| 323 | - public static function get_primary_date_obj( $EVT_ID = 0 ) { |
|
| 324 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 325 | - if ( $event instanceof EE_Event ) { |
|
| 323 | + public static function get_primary_date_obj($EVT_ID = 0) { |
|
| 324 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 325 | + if ($event instanceof EE_Event) { |
|
| 326 | 326 | $datetimes = $event->get_many_related( |
| 327 | 327 | 'Datetime', |
| 328 | 328 | array( |
| 329 | 329 | 'limit' => 1, |
| 330 | - 'order_by' => array( 'DTT_order' => 'ASC' ) |
|
| 330 | + 'order_by' => array('DTT_order' => 'ASC') |
|
| 331 | 331 | ) |
| 332 | 332 | ); |
| 333 | - return reset( $datetimes ); |
|
| 333 | + return reset($datetimes); |
|
| 334 | 334 | } else { |
| 335 | 335 | return FALSE; |
| 336 | 336 | } |
@@ -345,17 +345,17 @@ discard block |
||
| 345 | 345 | * @param int $EVT_ID |
| 346 | 346 | * @return string |
| 347 | 347 | */ |
| 348 | - public static function get_last_date_obj( $EVT_ID = 0 ) { |
|
| 349 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 350 | - if ( $event instanceof EE_Event ) { |
|
| 348 | + public static function get_last_date_obj($EVT_ID = 0) { |
|
| 349 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 350 | + if ($event instanceof EE_Event) { |
|
| 351 | 351 | $datetimes = $event->get_many_related( |
| 352 | 352 | 'Datetime', |
| 353 | 353 | array( |
| 354 | 354 | 'limit' => 1, |
| 355 | - 'order_by' => array( 'DTT_order' => 'DESC' ) |
|
| 355 | + 'order_by' => array('DTT_order' => 'DESC') |
|
| 356 | 356 | ) |
| 357 | 357 | ); |
| 358 | - return end( $datetimes ); |
|
| 358 | + return end($datetimes); |
|
| 359 | 359 | } else { |
| 360 | 360 | return FALSE; |
| 361 | 361 | } |
@@ -370,17 +370,17 @@ discard block |
||
| 370 | 370 | * @param int $EVT_ID |
| 371 | 371 | * @return string |
| 372 | 372 | */ |
| 373 | - public static function get_earliest_date_obj( $EVT_ID = 0 ) { |
|
| 374 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 375 | - if ( $event instanceof EE_Event ) { |
|
| 373 | + public static function get_earliest_date_obj($EVT_ID = 0) { |
|
| 374 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 375 | + if ($event instanceof EE_Event) { |
|
| 376 | 376 | $datetimes = $event->get_many_related( |
| 377 | 377 | 'Datetime', |
| 378 | 378 | array( |
| 379 | 379 | 'limit' => 1, |
| 380 | - 'order_by' => array( 'DTT_EVT_start' => 'ASC' ) |
|
| 380 | + 'order_by' => array('DTT_EVT_start' => 'ASC') |
|
| 381 | 381 | ) |
| 382 | 382 | ); |
| 383 | - return reset( $datetimes ); |
|
| 383 | + return reset($datetimes); |
|
| 384 | 384 | } else { |
| 385 | 385 | return FALSE; |
| 386 | 386 | } |
@@ -395,17 +395,17 @@ discard block |
||
| 395 | 395 | * @param int $EVT_ID |
| 396 | 396 | * @return string |
| 397 | 397 | */ |
| 398 | - public static function get_latest_date_obj( $EVT_ID = 0 ) { |
|
| 399 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 400 | - if ( $event instanceof EE_Event ) { |
|
| 398 | + public static function get_latest_date_obj($EVT_ID = 0) { |
|
| 399 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 400 | + if ($event instanceof EE_Event) { |
|
| 401 | 401 | $datetimes = $event->get_many_related( |
| 402 | 402 | 'Datetime', |
| 403 | 403 | array( |
| 404 | 404 | 'limit' => 1, |
| 405 | - 'order_by' => array( 'DTT_EVT_start' => 'DESC' ) |
|
| 405 | + 'order_by' => array('DTT_EVT_start' => 'DESC') |
|
| 406 | 406 | ) |
| 407 | 407 | ); |
| 408 | - return end( $datetimes ); |
|
| 408 | + return end($datetimes); |
|
| 409 | 409 | } else { |
| 410 | 410 | return FALSE; |
| 411 | 411 | } |
@@ -423,18 +423,18 @@ discard block |
||
| 423 | 423 | * @param null $limit |
| 424 | 424 | * @return EE_Datetime[] |
| 425 | 425 | */ |
| 426 | - public static function get_all_date_obj( $EVT_ID = 0, $include_expired = NULL, $include_deleted = false, $limit = NULL ) { |
|
| 427 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 428 | - if($include_expired === NULL){ |
|
| 429 | - if($event->is_expired()){ |
|
| 426 | + public static function get_all_date_obj($EVT_ID = 0, $include_expired = NULL, $include_deleted = false, $limit = NULL) { |
|
| 427 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 428 | + if ($include_expired === NULL) { |
|
| 429 | + if ($event->is_expired()) { |
|
| 430 | 430 | $include_expired = TRUE; |
| 431 | - }else{ |
|
| 431 | + } else { |
|
| 432 | 432 | $include_expired = FALSE; |
| 433 | 433 | } |
| 434 | - }else{ |
|
| 434 | + } else { |
|
| 435 | 435 | $include_expired = TRUE; |
| 436 | 436 | } |
| 437 | - if ( $event instanceof EE_Event ) { |
|
| 437 | + if ($event instanceof EE_Event) { |
|
| 438 | 438 | return $event->datetimes_ordered($include_expired, $include_deleted, $limit); |
| 439 | 439 | } else { |
| 440 | 440 | return array(); |
@@ -450,11 +450,11 @@ discard block |
||
| 450 | 450 | * @param int $EVT_ID |
| 451 | 451 | * @return string |
| 452 | 452 | */ |
| 453 | - public static function event_link_url( $EVT_ID = 0 ) { |
|
| 454 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 455 | - if ( $event instanceof EE_Event ) { |
|
| 456 | - $url = $event->external_url() !== NULL && $event->external_url() !== '' ? $event->external_url() : get_permalink( $event->ID() ); |
|
| 457 | - return preg_match( "~^(?:f|ht)tps?://~i", $url ) ? $url : 'http://' . $url; |
|
| 453 | + public static function event_link_url($EVT_ID = 0) { |
|
| 454 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 455 | + if ($event instanceof EE_Event) { |
|
| 456 | + $url = $event->external_url() !== NULL && $event->external_url() !== '' ? $event->external_url() : get_permalink($event->ID()); |
|
| 457 | + return preg_match("~^(?:f|ht)tps?://~i", $url) ? $url : 'http://'.$url; |
|
| 458 | 458 | } |
| 459 | 459 | return NULL; |
| 460 | 460 | } |
@@ -468,11 +468,11 @@ discard block |
||
| 468 | 468 | * @param int $EVT_ID |
| 469 | 469 | * @return string |
| 470 | 470 | */ |
| 471 | - public static function event_phone( $EVT_ID = 0 ) { |
|
| 472 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 473 | - if ( $event instanceof EE_Event ) { |
|
| 474 | - EE_Registry::instance()->load_helper( 'Formatter' ); |
|
| 475 | - return EEH_Schema::telephone( $event->phone() ); |
|
| 471 | + public static function event_phone($EVT_ID = 0) { |
|
| 472 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 473 | + if ($event instanceof EE_Event) { |
|
| 474 | + EE_Registry::instance()->load_helper('Formatter'); |
|
| 475 | + return EEH_Schema::telephone($event->phone()); |
|
| 476 | 476 | } |
| 477 | 477 | return NULL; |
| 478 | 478 | } |
@@ -489,23 +489,23 @@ discard block |
||
| 489 | 489 | * @param string $after |
| 490 | 490 | * @return string |
| 491 | 491 | */ |
| 492 | - public static function edit_event_link( $EVT_ID = 0, $link = '', $before = '', $after = '' ) { |
|
| 493 | - $event = EEH_Event_View::get_event( $EVT_ID ); |
|
| 494 | - if ( $event instanceof EE_Event ) { |
|
| 492 | + public static function edit_event_link($EVT_ID = 0, $link = '', $before = '', $after = '') { |
|
| 493 | + $event = EEH_Event_View::get_event($EVT_ID); |
|
| 494 | + if ($event instanceof EE_Event) { |
|
| 495 | 495 | // can the user edit this post ? |
| 496 | - if ( current_user_can( 'edit_post', $event->ID() )) { |
|
| 496 | + if (current_user_can('edit_post', $event->ID())) { |
|
| 497 | 497 | // set link text |
| 498 | - $link = ! empty( $link ) ? $link : __('edit this event'); |
|
| 498 | + $link = ! empty($link) ? $link : __('edit this event'); |
|
| 499 | 499 | // generate nonce |
| 500 | - $nonce = wp_create_nonce( 'edit_nonce' ); |
|
| 500 | + $nonce = wp_create_nonce('edit_nonce'); |
|
| 501 | 501 | // generate url to event editor for this event |
| 502 | - $url = add_query_arg( array( 'page' => 'espresso_events', 'action' => 'edit', 'post' => $event->ID(), 'edit_nonce' => $nonce ), admin_url() ); |
|
| 502 | + $url = add_query_arg(array('page' => 'espresso_events', 'action' => 'edit', 'post' => $event->ID(), 'edit_nonce' => $nonce), admin_url()); |
|
| 503 | 503 | // get edit CPT text |
| 504 | - $post_type_obj = get_post_type_object( 'espresso_events' ); |
|
| 504 | + $post_type_obj = get_post_type_object('espresso_events'); |
|
| 505 | 505 | // build final link html |
| 506 | - $link = '<a class="post-edit-link" href="' . $url . '" title="' . esc_attr( $post_type_obj->labels->edit_item ) . '">' . $link . '</a>'; |
|
| 506 | + $link = '<a class="post-edit-link" href="'.$url.'" title="'.esc_attr($post_type_obj->labels->edit_item).'">'.$link.'</a>'; |
|
| 507 | 507 | // put it all together |
| 508 | - return $before . apply_filters( 'edit_post_link', $link, $event->ID() ) . $after; |
|
| 508 | + return $before.apply_filters('edit_post_link', $link, $event->ID()).$after; |
|
| 509 | 509 | } |
| 510 | 510 | } |
| 511 | 511 | return ''; |
@@ -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 | * Event Espresso |
| 4 | 6 | * |
@@ -428,10 +430,10 @@ discard block |
||
| 428 | 430 | if($include_expired === NULL){ |
| 429 | 431 | if($event->is_expired()){ |
| 430 | 432 | $include_expired = TRUE; |
| 431 | - }else{ |
|
| 433 | + } else{ |
|
| 432 | 434 | $include_expired = FALSE; |
| 433 | 435 | } |
| 434 | - }else{ |
|
| 436 | + } else{ |
|
| 435 | 437 | $include_expired = TRUE; |
| 436 | 438 | } |
| 437 | 439 | if ( $event instanceof EE_Event ) { |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | return array(); |
| 100 | 100 | } |
| 101 | 101 | if (( $key = array_search( 'global_assets', $espresso_themes )) !== FALSE ) { |
| 102 | - unset( $espresso_themes[ $key ] ); |
|
| 102 | + unset( $espresso_themes[ $key ] ); |
|
| 103 | 103 | } |
| 104 | 104 | EEH_Template::$_espresso_themes = array(); |
| 105 | 105 | foreach ( $espresso_themes as $espresso_theme ) { |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | foreach ( (array)$full_template_paths as $full_template_path ) { |
| 227 | 227 | if ( is_readable( $full_template_path )) { |
| 228 | 228 | $template_path = str_replace( array( '\\', '/' ), DIRECTORY_SEPARATOR, $full_template_path ); |
| 229 | - break; |
|
| 229 | + break; |
|
| 230 | 230 | } |
| 231 | 231 | } |
| 232 | 232 | } |
@@ -15,7 +15,7 @@ discard block |
||
| 15 | 15 | |
| 16 | 16 | |
| 17 | 17 | |
| 18 | -if ( ! function_exists( 'espresso_get_template_part' )) { |
|
| 18 | +if ( ! function_exists('espresso_get_template_part')) { |
|
| 19 | 19 | /** |
| 20 | 20 | * espresso_get_template_part |
| 21 | 21 | * basically a copy of the WordPress get_template_part() function but uses EEH_Template::locate_template() instead, and doesn't add base versions of files |
@@ -25,14 +25,14 @@ discard block |
||
| 25 | 25 | * @param string $name The name of the specialised template. |
| 26 | 26 | * @return string the html output for the formatted money value |
| 27 | 27 | */ |
| 28 | - function espresso_get_template_part( $slug = NULL, $name = NULL ) { |
|
| 29 | - EEH_Template::get_template_part( $slug, $name ); |
|
| 28 | + function espresso_get_template_part($slug = NULL, $name = NULL) { |
|
| 29 | + EEH_Template::get_template_part($slug, $name); |
|
| 30 | 30 | } |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | |
| 34 | 34 | |
| 35 | -if ( ! function_exists( 'espresso_get_object_css_class' )) { |
|
| 35 | +if ( ! function_exists('espresso_get_object_css_class')) { |
|
| 36 | 36 | /** |
| 37 | 37 | * espresso_get_object_css_class - attempts to generate a css class based on the type of EE object passed |
| 38 | 38 | * |
@@ -42,8 +42,8 @@ discard block |
||
| 42 | 42 | * @param string $suffix added to the end of the generated class |
| 43 | 43 | * @return string |
| 44 | 44 | */ |
| 45 | - function espresso_get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) { |
|
| 46 | - return EEH_Template::get_object_css_class( $object, $prefix, $suffix ); |
|
| 45 | + function espresso_get_object_css_class($object = NULL, $prefix = '', $suffix = '') { |
|
| 46 | + return EEH_Template::get_object_css_class($object, $prefix, $suffix); |
|
| 47 | 47 | } |
| 48 | 48 | } |
| 49 | 49 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * @return boolean |
| 71 | 71 | */ |
| 72 | 72 | public static function is_espresso_theme() { |
| 73 | - return wp_get_theme()->get( 'TextDomain' ) == 'event_espresso' ? TRUE : FALSE; |
|
| 73 | + return wp_get_theme()->get('TextDomain') == 'event_espresso' ? TRUE : FALSE; |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | /** |
@@ -79,9 +79,9 @@ discard block |
||
| 79 | 79 | * @return void |
| 80 | 80 | */ |
| 81 | 81 | public static function load_espresso_theme_functions() { |
| 82 | - if ( ! defined( 'EE_THEME_FUNCTIONS_LOADED' )) { |
|
| 83 | - if ( is_readable( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' )) { |
|
| 84 | - require_once( EE_PUBLIC . EE_Config::get_current_theme() . DS . 'functions.php' ); |
|
| 82 | + if ( ! defined('EE_THEME_FUNCTIONS_LOADED')) { |
|
| 83 | + if (is_readable(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php')) { |
|
| 84 | + require_once(EE_PUBLIC.EE_Config::get_current_theme().DS.'functions.php'); |
|
| 85 | 85 | } |
| 86 | 86 | } |
| 87 | 87 | } |
@@ -93,17 +93,17 @@ discard block |
||
| 93 | 93 | * @return array |
| 94 | 94 | */ |
| 95 | 95 | public static function get_espresso_themes() { |
| 96 | - if ( empty( EEH_Template::$_espresso_themes )) { |
|
| 97 | - $espresso_themes = glob( EE_PUBLIC . '*', GLOB_ONLYDIR ); |
|
| 98 | - if ( empty( $espresso_themes ) ) { |
|
| 96 | + if (empty(EEH_Template::$_espresso_themes)) { |
|
| 97 | + $espresso_themes = glob(EE_PUBLIC.'*', GLOB_ONLYDIR); |
|
| 98 | + if (empty($espresso_themes)) { |
|
| 99 | 99 | return array(); |
| 100 | 100 | } |
| 101 | - if (( $key = array_search( 'global_assets', $espresso_themes )) !== FALSE ) { |
|
| 102 | - unset( $espresso_themes[ $key ] ); |
|
| 101 | + if (($key = array_search('global_assets', $espresso_themes)) !== FALSE) { |
|
| 102 | + unset($espresso_themes[$key]); |
|
| 103 | 103 | } |
| 104 | 104 | EEH_Template::$_espresso_themes = array(); |
| 105 | - foreach ( $espresso_themes as $espresso_theme ) { |
|
| 106 | - EEH_Template::$_espresso_themes[ basename( $espresso_theme ) ] = $espresso_theme; |
|
| 105 | + foreach ($espresso_themes as $espresso_theme) { |
|
| 106 | + EEH_Template::$_espresso_themes[basename($espresso_theme)] = $espresso_theme; |
|
| 107 | 107 | } |
| 108 | 108 | } |
| 109 | 109 | return EEH_Template::$_espresso_themes; |
@@ -122,16 +122,16 @@ discard block |
||
| 122 | 122 | * @param bool $return_string |
| 123 | 123 | * @return string the html output for the formatted money value |
| 124 | 124 | */ |
| 125 | - public static function get_template_part( $slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE ) { |
|
| 126 | - do_action( "get_template_part_{$slug}-{$name}", $slug, $name ); |
|
| 125 | + public static function get_template_part($slug = NULL, $name = NULL, $template_args = array(), $return_string = FALSE) { |
|
| 126 | + do_action("get_template_part_{$slug}-{$name}", $slug, $name); |
|
| 127 | 127 | $templates = array(); |
| 128 | 128 | $name = (string) $name; |
| 129 | - if ( $name != '' ) { |
|
| 129 | + if ($name != '') { |
|
| 130 | 130 | $templates[] = "{$slug}-{$name}.php"; |
| 131 | 131 | } |
| 132 | 132 | // allow template parts to be turned off via something like: add_filter( 'FHEE__content_espresso_events_tickets_template__display_datetimes', '__return_false' ); |
| 133 | - if ( apply_filters( "FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE )) { |
|
| 134 | - EEH_Template::locate_template( $templates, $template_args, TRUE, $return_string ); |
|
| 133 | + if (apply_filters("FHEE__EEH_Template__get_template_part__display__{$slug}_{$name}", TRUE)) { |
|
| 134 | + EEH_Template::locate_template($templates, $template_args, TRUE, $return_string); |
|
| 135 | 135 | } |
| 136 | 136 | } |
| 137 | 137 | |
@@ -156,26 +156,26 @@ discard block |
||
| 156 | 156 | * Used in places where you don't actually load the template, you just want to know if there's a custom version of it. |
| 157 | 157 | * @return mixed |
| 158 | 158 | */ |
| 159 | - public static function locate_template( $templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE ) { |
|
| 159 | + public static function locate_template($templates = array(), $template_args = array(), $load = TRUE, $return_string = TRUE, $check_if_custom = FALSE) { |
|
| 160 | 160 | // first use WP locate_template to check for template in the current theme folder |
| 161 | - $template_path = locate_template( $templates ); |
|
| 161 | + $template_path = locate_template($templates); |
|
| 162 | 162 | |
| 163 | - if ( $check_if_custom && !empty( $template_path ) ) |
|
| 163 | + if ($check_if_custom && ! empty($template_path)) |
|
| 164 | 164 | return TRUE; |
| 165 | 165 | |
| 166 | 166 | // not in the theme |
| 167 | - if ( empty( $template_path )) { |
|
| 167 | + if (empty($template_path)) { |
|
| 168 | 168 | // not even a template to look for ? |
| 169 | - if ( empty( $templates )) { |
|
| 169 | + if (empty($templates)) { |
|
| 170 | 170 | // get post_type |
| 171 | - $post_type = EE_Registry::instance()->REQ->get( 'post_type' ); |
|
| 171 | + $post_type = EE_Registry::instance()->REQ->get('post_type'); |
|
| 172 | 172 | // get array of EE Custom Post Types |
| 173 | 173 | $EE_CPTs = EE_Register_CPTs::get_CPTs(); |
| 174 | 174 | // build template name based on request |
| 175 | - if ( isset( $EE_CPTs[ $post_type ] )) { |
|
| 176 | - $archive_or_single = is_archive() ? 'archive' : ''; |
|
| 177 | - $archive_or_single = is_single() ? 'single' : $archive_or_single; |
|
| 178 | - $templates = $archive_or_single . '-' . $post_type . '.php'; |
|
| 175 | + if (isset($EE_CPTs[$post_type])) { |
|
| 176 | + $archive_or_single = is_archive() ? 'archive' : ''; |
|
| 177 | + $archive_or_single = is_single() ? 'single' : $archive_or_single; |
|
| 178 | + $templates = $archive_or_single.'-'.$post_type.'.php'; |
|
| 179 | 179 | } |
| 180 | 180 | } |
| 181 | 181 | // currently active EE template theme |
@@ -184,61 +184,61 @@ discard block |
||
| 184 | 184 | // array of paths to folders that may contain templates |
| 185 | 185 | $template_folder_paths = array( |
| 186 | 186 | // first check the /wp-content/uploads/espresso/templates/(current EE theme)/ folder for an EE theme template file |
| 187 | - EVENT_ESPRESSO_TEMPLATE_DIR . $current_theme, |
|
| 187 | + EVENT_ESPRESSO_TEMPLATE_DIR.$current_theme, |
|
| 188 | 188 | // then in the root of the /wp-content/uploads/espresso/templates/ folder |
| 189 | 189 | EVENT_ESPRESSO_TEMPLATE_DIR |
| 190 | 190 | ); |
| 191 | 191 | |
| 192 | 192 | //add core plugin folders for checking only if we're not $check_if_custom |
| 193 | - if ( ! $check_if_custom ) { |
|
| 193 | + if ( ! $check_if_custom) { |
|
| 194 | 194 | $core_paths = array( |
| 195 | 195 | // in the /wp-content/plugins/(EE4 folder)/public/(current EE theme)/ folder within the plugin |
| 196 | - EE_PUBLIC . $current_theme, |
|
| 196 | + EE_PUBLIC.$current_theme, |
|
| 197 | 197 | // in the /wp-content/plugins/(EE4 folder)/core/templates/(current EE theme)/ folder within the plugin |
| 198 | - EE_TEMPLATES . $current_theme, |
|
| 198 | + EE_TEMPLATES.$current_theme, |
|
| 199 | 199 | // or maybe relative from the plugin root: /wp-content/plugins/(EE4 folder)/ |
| 200 | 200 | EE_PLUGIN_DIR_PATH |
| 201 | 201 | ); |
| 202 | - $template_folder_paths = array_merge( $template_folder_paths, $core_paths ); |
|
| 202 | + $template_folder_paths = array_merge($template_folder_paths, $core_paths); |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | // now filter that array |
| 206 | - $template_folder_paths = apply_filters( 'FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths ); |
|
| 206 | + $template_folder_paths = apply_filters('FHEE__EEH_Template__locate_template__template_folder_paths', $template_folder_paths); |
|
| 207 | 207 | |
| 208 | 208 | // array to hold all possible template paths |
| 209 | 209 | $full_template_paths = array(); |
| 210 | 210 | |
| 211 | 211 | // loop through $templates |
| 212 | - foreach ( (array)$templates as $template ) { |
|
| 212 | + foreach ((array) $templates as $template) { |
|
| 213 | 213 | // while looping through all template folder paths |
| 214 | - foreach ( (array)$template_folder_paths as $template_folder_path ) { |
|
| 214 | + foreach ((array) $template_folder_paths as $template_folder_path) { |
|
| 215 | 215 | // build up our template locations array by combining our template folder paths with our templates |
| 216 | - $full_template_paths[] = rtrim( $template_folder_path, DS ) . DS . $template; |
|
| 216 | + $full_template_paths[] = rtrim($template_folder_path, DS).DS.$template; |
|
| 217 | 217 | } |
| 218 | 218 | // if $template is an absolute path, then we'll tack it onto the start of our array so that it gets searched first |
| 219 | - array_unshift( $full_template_paths, $template ); |
|
| 219 | + array_unshift($full_template_paths, $template); |
|
| 220 | 220 | } |
| 221 | 221 | // filter final array of full template paths |
| 222 | - $full_template_paths = apply_filters( 'FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths ); |
|
| 222 | + $full_template_paths = apply_filters('FHEE__EEH_Template__locate_template__full_template_paths', $full_template_paths); |
|
| 223 | 223 | |
| 224 | 224 | |
| 225 | 225 | // now loop through our final array of template location paths and check each location |
| 226 | - foreach ( (array)$full_template_paths as $full_template_path ) { |
|
| 227 | - if ( is_readable( $full_template_path )) { |
|
| 228 | - $template_path = str_replace( array( '\\', '/' ), DIRECTORY_SEPARATOR, $full_template_path ); |
|
| 226 | + foreach ((array) $full_template_paths as $full_template_path) { |
|
| 227 | + if (is_readable($full_template_path)) { |
|
| 228 | + $template_path = str_replace(array('\\', '/'), DIRECTORY_SEPARATOR, $full_template_path); |
|
| 229 | 229 | break; |
| 230 | 230 | } |
| 231 | 231 | } |
| 232 | 232 | } |
| 233 | 233 | // if we got it and you want to see it... |
| 234 | - if ( $template_path && $load && ! $check_if_custom ) { |
|
| 235 | - if ( $return_string ) { |
|
| 236 | - return EEH_Template::display_template( $template_path, $template_args, TRUE ); |
|
| 234 | + if ($template_path && $load && ! $check_if_custom) { |
|
| 235 | + if ($return_string) { |
|
| 236 | + return EEH_Template::display_template($template_path, $template_args, TRUE); |
|
| 237 | 237 | } else { |
| 238 | - EEH_Template::display_template( $template_path, $template_args, FALSE ); |
|
| 238 | + EEH_Template::display_template($template_path, $template_args, FALSE); |
|
| 239 | 239 | } |
| 240 | 240 | } |
| 241 | - return $check_if_custom && ! empty( $template_path ) ? TRUE : $template_path; |
|
| 241 | + return $check_if_custom && ! empty($template_path) ? TRUE : $template_path; |
|
| 242 | 242 | } |
| 243 | 243 | |
| 244 | 244 | |
@@ -250,9 +250,9 @@ discard block |
||
| 250 | 250 | * @param boolean $return_string whether to send output immediately to screen, or capture and return as a string |
| 251 | 251 | * @return mixed string |
| 252 | 252 | */ |
| 253 | - public static function display_template( $template_path = FALSE, $template_args = array(), $return_string = FALSE ) { |
|
| 253 | + public static function display_template($template_path = FALSE, $template_args = array(), $return_string = FALSE) { |
|
| 254 | 254 | //require the template validator for verifying variables are set according to how the template requires |
| 255 | - EE_Registry::instance()->load_helper( 'Template_Validator' ); |
|
| 255 | + EE_Registry::instance()->load_helper('Template_Validator'); |
|
| 256 | 256 | |
| 257 | 257 | /** |
| 258 | 258 | * These two filters are intended for last minute changes to templates being loaded and/or template arg |
@@ -263,26 +263,26 @@ discard block |
||
| 263 | 263 | * |
| 264 | 264 | * @since 4.6.0 |
| 265 | 265 | */ |
| 266 | - $template_path = apply_filters( 'FHEE__EEH_Template__display_template__template_path', $template_path ); |
|
| 267 | - $template_args = apply_filters( 'FHEE__EEH_Template__display_template__template_args', $template_args ); |
|
| 266 | + $template_path = apply_filters('FHEE__EEH_Template__display_template__template_path', $template_path); |
|
| 267 | + $template_args = apply_filters('FHEE__EEH_Template__display_template__template_args', $template_args); |
|
| 268 | 268 | |
| 269 | 269 | // you gimme nuttin - YOU GET NUTTIN !! |
| 270 | - if ( ! $template_path || ! is_readable( $template_path )) { |
|
| 270 | + if ( ! $template_path || ! is_readable($template_path)) { |
|
| 271 | 271 | return ''; |
| 272 | 272 | } |
| 273 | 273 | // if $template_args are not in an array, then make it so |
| 274 | - if ( ! is_array( $template_args ) && ! is_object( $template_args )) { |
|
| 275 | - $template_args = array( $template_args ); |
|
| 274 | + if ( ! is_array($template_args) && ! is_object($template_args)) { |
|
| 275 | + $template_args = array($template_args); |
|
| 276 | 276 | } |
| 277 | - extract( (array) $template_args); |
|
| 277 | + extract((array) $template_args); |
|
| 278 | 278 | |
| 279 | - if ( $return_string ) { |
|
| 279 | + if ($return_string) { |
|
| 280 | 280 | // because we want to return a string, we are going to capture the output |
| 281 | 281 | ob_start(); |
| 282 | - include( $template_path ); |
|
| 282 | + include($template_path); |
|
| 283 | 283 | return ob_get_clean(); |
| 284 | 284 | } else { |
| 285 | - include( $template_path ); |
|
| 285 | + include($template_path); |
|
| 286 | 286 | } |
| 287 | 287 | return ''; |
| 288 | 288 | } |
@@ -300,27 +300,27 @@ discard block |
||
| 300 | 300 | * @param string $suffix added to the end of the generated class |
| 301 | 301 | * @return string |
| 302 | 302 | */ |
| 303 | - public static function get_object_css_class( $object = NULL, $prefix = '', $suffix = '' ) { |
|
| 303 | + public static function get_object_css_class($object = NULL, $prefix = '', $suffix = '') { |
|
| 304 | 304 | // in the beginning... |
| 305 | - $prefix = ! empty( $prefix ) ? rtrim( $prefix, '-' ) . '-' : ''; |
|
| 305 | + $prefix = ! empty($prefix) ? rtrim($prefix, '-').'-' : ''; |
|
| 306 | 306 | // da muddle |
| 307 | 307 | $class = ''; |
| 308 | 308 | // the end |
| 309 | - $suffix = ! empty( $suffix ) ? '-' . ltrim( $suffix, '-' ) : ''; |
|
| 309 | + $suffix = ! empty($suffix) ? '-'.ltrim($suffix, '-') : ''; |
|
| 310 | 310 | // is the passed object an EE object ? |
| 311 | - if ( $object instanceof EE_Base_Class ) { |
|
| 311 | + if ($object instanceof EE_Base_Class) { |
|
| 312 | 312 | // grab the exact type of object |
| 313 | - $obj_class = get_class( $object ); |
|
| 313 | + $obj_class = get_class($object); |
|
| 314 | 314 | // depending on the type of object... |
| 315 | - switch ( $obj_class ) { |
|
| 315 | + switch ($obj_class) { |
|
| 316 | 316 | // no specifics just yet... |
| 317 | 317 | default : |
| 318 | - $class = strtolower( str_replace( '_', '-', $obj_class )); |
|
| 319 | - $class .= method_exists( $obj_class, 'name' ) ? '-' . sanitize_title( $object->name() ) : ''; |
|
| 318 | + $class = strtolower(str_replace('_', '-', $obj_class)); |
|
| 319 | + $class .= method_exists($obj_class, 'name') ? '-'.sanitize_title($object->name()) : ''; |
|
| 320 | 320 | |
| 321 | 321 | } |
| 322 | 322 | } |
| 323 | - return $prefix . $class . $suffix; |
|
| 323 | + return $prefix.$class.$suffix; |
|
| 324 | 324 | } |
| 325 | 325 | |
| 326 | 326 | |
@@ -336,50 +336,50 @@ discard block |
||
| 336 | 336 | * @param string $cur_code_span_class |
| 337 | 337 | * @return string the html output for the formatted money value |
| 338 | 338 | */ |
| 339 | - public static function format_currency( $amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code' ) { |
|
| 339 | + public static function format_currency($amount = NULL, $return_raw = FALSE, $display_code = TRUE, $CNT_ISO = '', $cur_code_span_class = 'currency-code') { |
|
| 340 | 340 | // ensure amount was received |
| 341 | - if ( is_null( $amount ) ) { |
|
| 342 | - $msg = __( 'In order to format currency, an amount needs to be passed.', 'event_espresso' ); |
|
| 343 | - EE_Error::add_error( $msg, __FILE__, __FUNCTION__, __LINE__ ); |
|
| 341 | + if (is_null($amount)) { |
|
| 342 | + $msg = __('In order to format currency, an amount needs to be passed.', 'event_espresso'); |
|
| 343 | + EE_Error::add_error($msg, __FILE__, __FUNCTION__, __LINE__); |
|
| 344 | 344 | return ''; |
| 345 | 345 | } |
| 346 | 346 | //ensure amount is float |
| 347 | 347 | $amount = (float) $amount; |
| 348 | 348 | // filter raw amount (allows 0.00 to be changed to "free" for example) |
| 349 | - $amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount', $amount, $return_raw ); |
|
| 349 | + $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount', $amount, $return_raw); |
|
| 350 | 350 | // still a number or was amount converted to a string like "free" ? |
| 351 | - if ( is_float( $amount_formatted )) { |
|
| 351 | + if (is_float($amount_formatted)) { |
|
| 352 | 352 | // was a country ISO code passed ? if so generate currency config object for that country |
| 353 | - $mny = $CNT_ISO !== '' ? new EE_Currency_Config( $CNT_ISO ) : NULL; |
|
| 353 | + $mny = $CNT_ISO !== '' ? new EE_Currency_Config($CNT_ISO) : NULL; |
|
| 354 | 354 | // verify results |
| 355 | - if ( ! $mny instanceof EE_Currency_Config ) { |
|
| 355 | + if ( ! $mny instanceof EE_Currency_Config) { |
|
| 356 | 356 | // set default config country currency settings |
| 357 | 357 | $mny = EE_Registry::instance()->CFG->currency instanceof EE_Currency_Config ? EE_Registry::instance()->CFG->currency : new EE_Currency_Config(); |
| 358 | 358 | } |
| 359 | 359 | // format float |
| 360 | - $amount_formatted = number_format( $amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds ); |
|
| 360 | + $amount_formatted = number_format($amount, $mny->dec_plc, $mny->dec_mrk, $mny->thsnds); |
|
| 361 | 361 | // add formatting ? |
| 362 | - if ( ! $return_raw ) { |
|
| 362 | + if ( ! $return_raw) { |
|
| 363 | 363 | // add currency sign |
| 364 | - if( $mny->sign_b4 ){ |
|
| 365 | - if( $amount >= 0 ){ |
|
| 366 | - $amount_formatted = $mny->sign . $amount_formatted; |
|
| 367 | - }else{ |
|
| 368 | - $amount_formatted = '-' . $mny->sign . str_replace( '-', '', $amount_formatted ); |
|
| 364 | + if ($mny->sign_b4) { |
|
| 365 | + if ($amount >= 0) { |
|
| 366 | + $amount_formatted = $mny->sign.$amount_formatted; |
|
| 367 | + } else { |
|
| 368 | + $amount_formatted = '-'.$mny->sign.str_replace('-', '', $amount_formatted); |
|
| 369 | 369 | } |
| 370 | 370 | |
| 371 | - }else{ |
|
| 372 | - $amount_formatted = $amount_formatted . $mny->sign; |
|
| 371 | + } else { |
|
| 372 | + $amount_formatted = $amount_formatted.$mny->sign; |
|
| 373 | 373 | } |
| 374 | 374 | |
| 375 | 375 | // add currency code ? |
| 376 | - $amount_formatted = $display_code ? $amount_formatted . ' <span class="' . $cur_code_span_class . '">(' . $mny->code . ')</span>' : $amount_formatted; |
|
| 376 | + $amount_formatted = $display_code ? $amount_formatted.' <span class="'.$cur_code_span_class.'">('.$mny->code.')</span>' : $amount_formatted; |
|
| 377 | 377 | } |
| 378 | 378 | // filter results |
| 379 | - $amount_formatted = apply_filters( 'FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw ); |
|
| 379 | + $amount_formatted = apply_filters('FHEE__EEH_Template__format_currency__amount_formatted', $amount_formatted, $mny, $return_raw); |
|
| 380 | 380 | } |
| 381 | 381 | // clean up vars |
| 382 | - unset( $mny ); |
|
| 382 | + unset($mny); |
|
| 383 | 383 | // return formatted currency amount |
| 384 | 384 | return $amount_formatted; |
| 385 | 385 | } |
@@ -394,11 +394,11 @@ discard block |
||
| 394 | 394 | * @param string $schema 'UPPER', 'lower', or 'Sentence' |
| 395 | 395 | * @return string The localized label for the status id. |
| 396 | 396 | */ |
| 397 | - public static function pretty_status( $status_id, $plural = FALSE, $schema = 'upper' ) { |
|
| 397 | + public static function pretty_status($status_id, $plural = FALSE, $schema = 'upper') { |
|
| 398 | 398 | /** @type EEM_Status $EEM_Status */ |
| 399 | - $EEM_Status = EE_Registry::instance()->load_model( 'Status' ); |
|
| 400 | - $status = $EEM_Status->localized_status( array( $status_id => __( 'unknown', 'event_espresso' )), $plural, $schema ); |
|
| 401 | - return $status[ $status_id ]; |
|
| 399 | + $EEM_Status = EE_Registry::instance()->load_model('Status'); |
|
| 400 | + $status = $EEM_Status->localized_status(array($status_id => __('unknown', 'event_espresso')), $plural, $schema); |
|
| 401 | + return $status[$status_id]; |
|
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | |
@@ -411,9 +411,9 @@ discard block |
||
| 411 | 411 | * @param string $icon |
| 412 | 412 | * @return string the html output for the button |
| 413 | 413 | */ |
| 414 | - public static function get_button_or_link( $url, $label, $class = 'button-primary', $icon = '' ) { |
|
| 415 | - $label = ! empty( $icon ) ? '<span class="' . $icon . '"></span>' . $label : $label; |
|
| 416 | - $button = '<a id="' . sanitize_title_with_dashes($label) . '" href="' . $url . '" class="' . $class . '">' . $label . '</a>'; |
|
| 414 | + public static function get_button_or_link($url, $label, $class = 'button-primary', $icon = '') { |
|
| 415 | + $label = ! empty($icon) ? '<span class="'.$icon.'"></span>'.$label : $label; |
|
| 416 | + $button = '<a id="'.sanitize_title_with_dashes($label).'" href="'.$url.'" class="'.$class.'">'.$label.'</a>'; |
|
| 417 | 417 | return $button; |
| 418 | 418 | } |
| 419 | 419 | |
@@ -430,21 +430,21 @@ discard block |
||
| 430 | 430 | * @param bool|string $help_text (optional) send help text you want to use for the link if default not to be used |
| 431 | 431 | * @return string generated link |
| 432 | 432 | */ |
| 433 | - public static function get_help_tab_link( $help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE ) { |
|
| 433 | + public static function get_help_tab_link($help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE) { |
|
| 434 | 434 | |
| 435 | - if ( ! $page ) |
|
| 436 | - $page = isset( $_REQUEST['page'] ) && ! empty( $_REQUEST['page'] ) ? sanitize_key( $_REQUEST['page'] ) : $page; |
|
| 435 | + if ( ! $page) |
|
| 436 | + $page = isset($_REQUEST['page']) && ! empty($_REQUEST['page']) ? sanitize_key($_REQUEST['page']) : $page; |
|
| 437 | 437 | |
| 438 | - if ( ! $action ) |
|
| 439 | - $action = isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ? sanitize_key( $_REQUEST['action'] ) : $action; |
|
| 438 | + if ( ! $action) |
|
| 439 | + $action = isset($_REQUEST['action']) && ! empty($_REQUEST['action']) ? sanitize_key($_REQUEST['action']) : $action; |
|
| 440 | 440 | |
| 441 | 441 | $action = empty($action) ? 'default' : $action; |
| 442 | 442 | |
| 443 | 443 | |
| 444 | - $help_tab_lnk = $page . '-' . $action . '-' . $help_tab_id; |
|
| 445 | - $icon = !$icon_style ? ' dashicons-editor-help' : $icon_style; |
|
| 446 | - $help_text = !$help_text ? '' : $help_text; |
|
| 447 | - return '<a id="' . $help_tab_lnk . '" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22' . $icon . '" title="' . esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso') . '" > ' . $help_text . ' </a>'; |
|
| 444 | + $help_tab_lnk = $page.'-'.$action.'-'.$help_tab_id; |
|
| 445 | + $icon = ! $icon_style ? ' dashicons-editor-help' : $icon_style; |
|
| 446 | + $help_text = ! $help_text ? '' : $help_text; |
|
| 447 | + return '<a id="'.$help_tab_lnk.'" class="ee-clickable dashicons espresso-help-tab-lnk ee-icon-size-22'.$icon.'" title="'.esc_attr__('Click to open the \'Help\' tab for more information about this feature.', 'event_espresso').'" > '.$help_text.' </a>'; |
|
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | |
@@ -456,31 +456,31 @@ discard block |
||
| 456 | 456 | * @param EE_Help_Tour |
| 457 | 457 | * @return string html |
| 458 | 458 | */ |
| 459 | - public static function help_tour_stops_generator( EE_Help_Tour $tour ) { |
|
| 459 | + public static function help_tour_stops_generator(EE_Help_Tour $tour) { |
|
| 460 | 460 | $id = $tour->get_slug(); |
| 461 | 461 | $stops = $tour->get_stops(); |
| 462 | 462 | |
| 463 | - $content = '<ol style="display:none" id="' . $id . '">'; |
|
| 463 | + $content = '<ol style="display:none" id="'.$id.'">'; |
|
| 464 | 464 | |
| 465 | - foreach ( $stops as $stop ) { |
|
| 466 | - $data_id = !empty( $stop['id'] ) ? ' data-id="' . $stop['id'] . '"' : ''; |
|
| 467 | - $data_class = empty( $data_id ) && !empty( $stop['class'] ) ? ' data-class="' . $stop['class'] . '"' : ''; |
|
| 465 | + foreach ($stops as $stop) { |
|
| 466 | + $data_id = ! empty($stop['id']) ? ' data-id="'.$stop['id'].'"' : ''; |
|
| 467 | + $data_class = empty($data_id) && ! empty($stop['class']) ? ' data-class="'.$stop['class'].'"' : ''; |
|
| 468 | 468 | |
| 469 | 469 | //if container is set to modal then let's make sure we set the options accordingly |
| 470 | - if ( empty( $data_id ) && empty( $data_class ) ) { |
|
| 470 | + if (empty($data_id) && empty($data_class)) { |
|
| 471 | 471 | $stop['options']['modal'] = true; |
| 472 | 472 | $stop['options']['expose'] = true; |
| 473 | 473 | } |
| 474 | 474 | |
| 475 | - $custom_class = !empty( $stop['custom_class'] ) ? ' class="' . $stop['custom_class'] . '"' : ''; |
|
| 476 | - $button_text = !empty( $stop['button_text'] ) ? ' data-button="' . $stop['button_text'] . '"' : ''; |
|
| 475 | + $custom_class = ! empty($stop['custom_class']) ? ' class="'.$stop['custom_class'].'"' : ''; |
|
| 476 | + $button_text = ! empty($stop['button_text']) ? ' data-button="'.$stop['button_text'].'"' : ''; |
|
| 477 | 477 | $inner_content = isset($stop['content']) ? $stop['content'] : ''; |
| 478 | 478 | |
| 479 | 479 | //options |
| 480 | - if ( isset( $stop['options'] ) && is_array( $stop['options'] ) ) { |
|
| 480 | + if (isset($stop['options']) && is_array($stop['options'])) { |
|
| 481 | 481 | $options = ' data-options="'; |
| 482 | - foreach ( $stop['options'] as $option => $value ) { |
|
| 483 | - $options .= $option . ':' . $value . ';'; |
|
| 482 | + foreach ($stop['options'] as $option => $value) { |
|
| 483 | + $options .= $option.':'.$value.';'; |
|
| 484 | 484 | } |
| 485 | 485 | $options .= '"'; |
| 486 | 486 | } else { |
@@ -488,7 +488,7 @@ discard block |
||
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | //let's put all together |
| 491 | - $content .= '<li' . $data_id . $data_class . $custom_class . $button_text . $options . '>' . $inner_content . '</li>'; |
|
| 491 | + $content .= '<li'.$data_id.$data_class.$custom_class.$button_text.$options.'>'.$inner_content.'</li>'; |
|
| 492 | 492 | } |
| 493 | 493 | |
| 494 | 494 | $content .= '</ol>'; |
@@ -509,31 +509,31 @@ discard block |
||
| 509 | 509 | * @throws EE_Error |
| 510 | 510 | * @return string html structure for status. |
| 511 | 511 | */ |
| 512 | - public static function status_legend( $status_array, $active_status = '' ) { |
|
| 513 | - if ( !is_array( $status_array ) ) |
|
| 514 | - throw new EE_Error( __('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso') ); |
|
| 512 | + public static function status_legend($status_array, $active_status = '') { |
|
| 513 | + if ( ! is_array($status_array)) |
|
| 514 | + throw new EE_Error(__('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso')); |
|
| 515 | 515 | |
| 516 | 516 | $setup_array = array(); |
| 517 | - foreach ( $status_array as $item => $status ) { |
|
| 517 | + foreach ($status_array as $item => $status) { |
|
| 518 | 518 | $setup_array[$item] = array( |
| 519 | - 'class' => 'ee-status-legend ee-status-legend-' . $status, |
|
| 520 | - 'desc' => EEH_Template::pretty_status( $status, FALSE, 'sentence' ), |
|
| 519 | + 'class' => 'ee-status-legend ee-status-legend-'.$status, |
|
| 520 | + 'desc' => EEH_Template::pretty_status($status, FALSE, 'sentence'), |
|
| 521 | 521 | 'status' => $status |
| 522 | 522 | ); |
| 523 | 523 | } |
| 524 | 524 | |
| 525 | - $content = '<div class="ee-list-table-legend-container">' . "\n"; |
|
| 526 | - $content .= '<h4>' . __('Status Legend', 'event_espresso') . '</h4>' . "\n"; |
|
| 527 | - $content .= '<dl class="ee-list-table-legend">' . "\n\t"; |
|
| 528 | - foreach ( $setup_array as $item => $details ) { |
|
| 525 | + $content = '<div class="ee-list-table-legend-container">'."\n"; |
|
| 526 | + $content .= '<h4>'.__('Status Legend', 'event_espresso').'</h4>'."\n"; |
|
| 527 | + $content .= '<dl class="ee-list-table-legend">'."\n\t"; |
|
| 528 | + foreach ($setup_array as $item => $details) { |
|
| 529 | 529 | $active_class = $active_status == $details['status'] ? ' class="ee-is-active-status"' : ''; |
| 530 | - $content .= '<dt id="ee-legend-item-tooltip-' . $item . '"' . $active_class . '>' . "\n\t\t"; |
|
| 531 | - $content .= '<span class="' . $details['class'] . '"></span>' . "\n\t\t"; |
|
| 532 | - $content .= '<span class="ee-legend-description">' . $details['desc'] . '</span>' . "\n\t"; |
|
| 533 | - $content .= '</dt>' . "\n"; |
|
| 530 | + $content .= '<dt id="ee-legend-item-tooltip-'.$item.'"'.$active_class.'>'."\n\t\t"; |
|
| 531 | + $content .= '<span class="'.$details['class'].'"></span>'."\n\t\t"; |
|
| 532 | + $content .= '<span class="ee-legend-description">'.$details['desc'].'</span>'."\n\t"; |
|
| 533 | + $content .= '</dt>'."\n"; |
|
| 534 | 534 | } |
| 535 | - $content .= '</dl>' . "\n"; |
|
| 536 | - $content .= '</div>' . "\n"; |
|
| 535 | + $content .= '</dl>'."\n"; |
|
| 536 | + $content .= '</div>'."\n"; |
|
| 537 | 537 | return $content; |
| 538 | 538 | } |
| 539 | 539 | |
@@ -546,8 +546,8 @@ discard block |
||
| 546 | 546 | * @return string |
| 547 | 547 | */ |
| 548 | 548 | public static function layout_array_as_table($data) { |
| 549 | - if (is_object($data) || $data instanceof __PHP_Incomplete_Class ) { |
|
| 550 | - $data = (array)$data; |
|
| 549 | + if (is_object($data) || $data instanceof __PHP_Incomplete_Class) { |
|
| 550 | + $data = (array) $data; |
|
| 551 | 551 | } |
| 552 | 552 | EE_Registry::instance()->load_helper('Array'); |
| 553 | 553 | ob_start(); |
@@ -561,10 +561,10 @@ discard block |
||
| 561 | 561 | ?> |
| 562 | 562 | <tr> |
| 563 | 563 | <td> |
| 564 | - <?php echo $data_key;?> |
|
| 564 | + <?php echo $data_key; ?> |
|
| 565 | 565 | </td> |
| 566 | 566 | <td> |
| 567 | - <?php echo self::layout_array_as_table($data_values);?> |
|
| 567 | + <?php echo self::layout_array_as_table($data_values); ?> |
|
| 568 | 568 | </td> |
| 569 | 569 | </tr> |
| 570 | 570 | <?php |
@@ -578,7 +578,7 @@ discard block |
||
| 578 | 578 | <ul> |
| 579 | 579 | <?php |
| 580 | 580 | foreach ($data as $datum) { |
| 581 | - echo "<li>"; echo self::layout_array_as_table($datum);echo "</li>"; |
|
| 581 | + echo "<li>"; echo self::layout_array_as_table($datum); echo "</li>"; |
|
| 582 | 582 | }?> |
| 583 | 583 | </ul> |
| 584 | 584 | <?php |
@@ -604,8 +604,8 @@ discard block |
||
| 604 | 604 | * @param $url |
| 605 | 605 | * @param bool $show_num_field |
| 606 | 606 | */ |
| 607 | - public static function paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE ) { |
|
| 608 | - echo self::get_paging_html( $total_items, $current, $per_page, $url, $show_num_field ); |
|
| 607 | + public static function paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE) { |
|
| 608 | + echo self::get_paging_html($total_items, $current, $per_page, $url, $show_num_field); |
|
| 609 | 609 | } |
| 610 | 610 | |
| 611 | 611 | |
@@ -623,69 +623,69 @@ discard block |
||
| 623 | 623 | * @param boolean $show_num_field Whether to show the input for changing page number. |
| 624 | 624 | * @return string |
| 625 | 625 | */ |
| 626 | - public static function get_paging_html( $total_items, $current, $per_page, $url, $show_num_field = TRUE ) { |
|
| 626 | + public static function get_paging_html($total_items, $current, $per_page, $url, $show_num_field = TRUE) { |
|
| 627 | 627 | $page_links = array(); |
| 628 | 628 | $disable_first = $disable_last = ''; |
| 629 | 629 | $total_items = (int) $total_items; |
| 630 | 630 | $per_page = (int) $per_page; |
| 631 | 631 | $current = (int) $current; |
| 632 | 632 | |
| 633 | - $total_pages = round( ceil( $total_items ) / $per_page ); |
|
| 633 | + $total_pages = round(ceil($total_items) / $per_page); |
|
| 634 | 634 | |
| 635 | - if ( $total_pages <= 1) |
|
| 635 | + if ($total_pages <= 1) |
|
| 636 | 636 | return ''; |
| 637 | 637 | |
| 638 | - $output = '<span class="displaying-num">' . sprintf( _n( '1 item', '%s items', $total_items ), number_format_i18n( $total_items ) ) . '</span>'; |
|
| 638 | + $output = '<span class="displaying-num">'.sprintf(_n('1 item', '%s items', $total_items), number_format_i18n($total_items)).'</span>'; |
|
| 639 | 639 | |
| 640 | - if ( $current == 1 ) |
|
| 640 | + if ($current == 1) |
|
| 641 | 641 | $disable_first = ' disabled'; |
| 642 | - if ( $current == $total_pages ) |
|
| 642 | + if ($current == $total_pages) |
|
| 643 | 643 | $disable_last = ' disabled'; |
| 644 | 644 | |
| 645 | - $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>", |
|
| 646 | - 'first-page' . $disable_first, |
|
| 647 | - esc_attr__( 'Go to the first page' ), |
|
| 648 | - esc_url( remove_query_arg( 'paged', $url ) ), |
|
| 645 | + $page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>", |
|
| 646 | + 'first-page'.$disable_first, |
|
| 647 | + esc_attr__('Go to the first page'), |
|
| 648 | + esc_url(remove_query_arg('paged', $url)), |
|
| 649 | 649 | '«' |
| 650 | 650 | ); |
| 651 | 651 | |
| 652 | - $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>", |
|
| 653 | - 'prev-page' . $disable_first, |
|
| 654 | - esc_attr__( 'Go to the previous page' ), |
|
| 655 | - esc_url( add_query_arg( 'paged', max( 1, $current-1 ), $url ) ), |
|
| 652 | + $page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>", |
|
| 653 | + 'prev-page'.$disable_first, |
|
| 654 | + esc_attr__('Go to the previous page'), |
|
| 655 | + esc_url(add_query_arg('paged', max(1, $current - 1), $url)), |
|
| 656 | 656 | '‹' |
| 657 | 657 | ); |
| 658 | 658 | |
| 659 | - if ( ! $show_num_field ) |
|
| 659 | + if ( ! $show_num_field) |
|
| 660 | 660 | $html_current_page = $current; |
| 661 | 661 | else |
| 662 | - $html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name='paged' value='%s' size='%d' />", |
|
| 663 | - esc_attr__( 'Current page' ), |
|
| 662 | + $html_current_page = sprintf("<input class='current-page' title='%s' type='text' name='paged' value='%s' size='%d' />", |
|
| 663 | + esc_attr__('Current page'), |
|
| 664 | 664 | $current, |
| 665 | - strlen( $total_pages ) |
|
| 665 | + strlen($total_pages) |
|
| 666 | 666 | ); |
| 667 | 667 | |
| 668 | - $html_total_pages = sprintf( "<span class='total-pages'>%s</span>", number_format_i18n( $total_pages ) ); |
|
| 669 | - $page_links[] = '<span class="paging-input">' . sprintf( _x( '%1$s of %2$s', 'paging' ), $html_current_page, $html_total_pages ) . '</span>'; |
|
| 668 | + $html_total_pages = sprintf("<span class='total-pages'>%s</span>", number_format_i18n($total_pages)); |
|
| 669 | + $page_links[] = '<span class="paging-input">'.sprintf(_x('%1$s of %2$s', 'paging'), $html_current_page, $html_total_pages).'</span>'; |
|
| 670 | 670 | |
| 671 | - $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>", |
|
| 672 | - 'next-page' . $disable_last, |
|
| 673 | - esc_attr__( 'Go to the next page' ), |
|
| 674 | - esc_url( add_query_arg( 'paged', min( $total_pages, $current+1 ), $url ) ), |
|
| 671 | + $page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>", |
|
| 672 | + 'next-page'.$disable_last, |
|
| 673 | + esc_attr__('Go to the next page'), |
|
| 674 | + esc_url(add_query_arg('paged', min($total_pages, $current + 1), $url)), |
|
| 675 | 675 | '›' |
| 676 | 676 | ); |
| 677 | 677 | |
| 678 | - $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>", |
|
| 679 | - 'last-page' . $disable_last, |
|
| 680 | - esc_attr__( 'Go to the last page' ), |
|
| 681 | - esc_url( add_query_arg( 'paged', $total_pages, $url ) ), |
|
| 678 | + $page_links[] = sprintf("<a class='%s' title='%s' href='%s'>%s</a>", |
|
| 679 | + 'last-page'.$disable_last, |
|
| 680 | + esc_attr__('Go to the last page'), |
|
| 681 | + esc_url(add_query_arg('paged', $total_pages, $url)), |
|
| 682 | 682 | '»' |
| 683 | 683 | ); |
| 684 | 684 | |
| 685 | 685 | $pagination_links_class = 'pagination-links'; |
| 686 | - $output .= "\n<span class='$pagination_links_class'>" . join( "\n", $page_links ) . '</span>'; |
|
| 686 | + $output .= "\n<span class='$pagination_links_class'>".join("\n", $page_links).'</span>'; |
|
| 687 | 687 | |
| 688 | - if ( $total_pages ) |
|
| 688 | + if ($total_pages) |
|
| 689 | 689 | $page_class = $total_pages < 2 ? ' one-page' : ''; |
| 690 | 690 | else |
| 691 | 691 | $page_class = ' no-pages'; |
@@ -160,8 +160,9 @@ discard block |
||
| 160 | 160 | // first use WP locate_template to check for template in the current theme folder |
| 161 | 161 | $template_path = locate_template( $templates ); |
| 162 | 162 | |
| 163 | - if ( $check_if_custom && !empty( $template_path ) ) |
|
| 164 | - return TRUE; |
|
| 163 | + if ( $check_if_custom && !empty( $template_path ) ) { |
|
| 164 | + return TRUE; |
|
| 165 | + } |
|
| 165 | 166 | |
| 166 | 167 | // not in the theme |
| 167 | 168 | if ( empty( $template_path )) { |
@@ -364,11 +365,11 @@ discard block |
||
| 364 | 365 | if( $mny->sign_b4 ){ |
| 365 | 366 | if( $amount >= 0 ){ |
| 366 | 367 | $amount_formatted = $mny->sign . $amount_formatted; |
| 367 | - }else{ |
|
| 368 | + } else{ |
|
| 368 | 369 | $amount_formatted = '-' . $mny->sign . str_replace( '-', '', $amount_formatted ); |
| 369 | 370 | } |
| 370 | 371 | |
| 371 | - }else{ |
|
| 372 | + } else{ |
|
| 372 | 373 | $amount_formatted = $amount_formatted . $mny->sign; |
| 373 | 374 | } |
| 374 | 375 | |
@@ -432,11 +433,13 @@ discard block |
||
| 432 | 433 | */ |
| 433 | 434 | public static function get_help_tab_link( $help_tab_id, $page = FALSE, $action = FALSE, $icon_style = FALSE, $help_text = FALSE ) { |
| 434 | 435 | |
| 435 | - if ( ! $page ) |
|
| 436 | - $page = isset( $_REQUEST['page'] ) && ! empty( $_REQUEST['page'] ) ? sanitize_key( $_REQUEST['page'] ) : $page; |
|
| 436 | + if ( ! $page ) { |
|
| 437 | + $page = isset( $_REQUEST['page'] ) && ! empty( $_REQUEST['page'] ) ? sanitize_key( $_REQUEST['page'] ) : $page; |
|
| 438 | + } |
|
| 437 | 439 | |
| 438 | - if ( ! $action ) |
|
| 439 | - $action = isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ? sanitize_key( $_REQUEST['action'] ) : $action; |
|
| 440 | + if ( ! $action ) { |
|
| 441 | + $action = isset( $_REQUEST['action'] ) && ! empty( $_REQUEST['action'] ) ? sanitize_key( $_REQUEST['action'] ) : $action; |
|
| 442 | + } |
|
| 440 | 443 | |
| 441 | 444 | $action = empty($action) ? 'default' : $action; |
| 442 | 445 | |
@@ -510,8 +513,9 @@ discard block |
||
| 510 | 513 | * @return string html structure for status. |
| 511 | 514 | */ |
| 512 | 515 | public static function status_legend( $status_array, $active_status = '' ) { |
| 513 | - if ( !is_array( $status_array ) ) |
|
| 514 | - throw new EE_Error( __('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso') ); |
|
| 516 | + if ( !is_array( $status_array ) ) { |
|
| 517 | + throw new EE_Error( __('The EEH_Template::status_legend helper required the incoming status_array argument to be an array!', 'event_espresso') ); |
|
| 518 | + } |
|
| 515 | 519 | |
| 516 | 520 | $setup_array = array(); |
| 517 | 521 | foreach ( $status_array as $item => $status ) { |
@@ -572,8 +576,7 @@ discard block |
||
| 572 | 576 | </tbody> |
| 573 | 577 | </table> |
| 574 | 578 | <?php |
| 575 | - } |
|
| 576 | - else { |
|
| 579 | + } else { |
|
| 577 | 580 | ?> |
| 578 | 581 | <ul> |
| 579 | 582 | <?php |
@@ -583,8 +586,7 @@ discard block |
||
| 583 | 586 | </ul> |
| 584 | 587 | <?php |
| 585 | 588 | } |
| 586 | - } |
|
| 587 | - else { |
|
| 589 | + } else { |
|
| 588 | 590 | //simple value |
| 589 | 591 | echo $data; |
| 590 | 592 | } |
@@ -632,15 +634,18 @@ discard block |
||
| 632 | 634 | |
| 633 | 635 | $total_pages = round( ceil( $total_items ) / $per_page ); |
| 634 | 636 | |
| 635 | - if ( $total_pages <= 1) |
|
| 636 | - return ''; |
|
| 637 | + if ( $total_pages <= 1) { |
|
| 638 | + return ''; |
|
| 639 | + } |
|
| 637 | 640 | |
| 638 | 641 | $output = '<span class="displaying-num">' . sprintf( _n( '1 item', '%s items', $total_items ), number_format_i18n( $total_items ) ) . '</span>'; |
| 639 | 642 | |
| 640 | - if ( $current == 1 ) |
|
| 641 | - $disable_first = ' disabled'; |
|
| 642 | - if ( $current == $total_pages ) |
|
| 643 | - $disable_last = ' disabled'; |
|
| 643 | + if ( $current == 1 ) { |
|
| 644 | + $disable_first = ' disabled'; |
|
| 645 | + } |
|
| 646 | + if ( $current == $total_pages ) { |
|
| 647 | + $disable_last = ' disabled'; |
|
| 648 | + } |
|
| 644 | 649 | |
| 645 | 650 | $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>", |
| 646 | 651 | 'first-page' . $disable_first, |
@@ -656,14 +661,15 @@ discard block |
||
| 656 | 661 | '‹' |
| 657 | 662 | ); |
| 658 | 663 | |
| 659 | - if ( ! $show_num_field ) |
|
| 660 | - $html_current_page = $current; |
|
| 661 | - else |
|
| 662 | - $html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name='paged' value='%s' size='%d' />", |
|
| 664 | + if ( ! $show_num_field ) { |
|
| 665 | + $html_current_page = $current; |
|
| 666 | + } else { |
|
| 667 | + $html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name='paged' value='%s' size='%d' />", |
|
| 663 | 668 | esc_attr__( 'Current page' ), |
| 664 | 669 | $current, |
| 665 | 670 | strlen( $total_pages ) |
| 666 | 671 | ); |
| 672 | + } |
|
| 667 | 673 | |
| 668 | 674 | $html_total_pages = sprintf( "<span class='total-pages'>%s</span>", number_format_i18n( $total_pages ) ); |
| 669 | 675 | $page_links[] = '<span class="paging-input">' . sprintf( _x( '%1$s of %2$s', 'paging' ), $html_current_page, $html_total_pages ) . '</span>'; |
@@ -685,10 +691,11 @@ discard block |
||
| 685 | 691 | $pagination_links_class = 'pagination-links'; |
| 686 | 692 | $output .= "\n<span class='$pagination_links_class'>" . join( "\n", $page_links ) . '</span>'; |
| 687 | 693 | |
| 688 | - if ( $total_pages ) |
|
| 689 | - $page_class = $total_pages < 2 ? ' one-page' : ''; |
|
| 690 | - else |
|
| 691 | - $page_class = ' no-pages'; |
|
| 694 | + if ( $total_pages ) { |
|
| 695 | + $page_class = $total_pages < 2 ? ' one-page' : ''; |
|
| 696 | + } else { |
|
| 697 | + $page_class = ' no-pages'; |
|
| 698 | + } |
|
| 692 | 699 | |
| 693 | 700 | return "<div class='tablenav-pages{$page_class}'>$output</div>"; |
| 694 | 701 | } |
@@ -6,19 +6,19 @@ discard block |
||
| 6 | 6 | * @subpackage |
| 7 | 7 | * @author Mike Nelson |
| 8 | 8 | */ |
| 9 | -class EE_Datepicker_Input extends EE_Form_Input_Base{ |
|
| 9 | +class EE_Datepicker_Input extends EE_Form_Input_Base { |
|
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * @param array $input_settings |
| 13 | 13 | */ |
| 14 | - function __construct( $input_settings = array() ){ |
|
| 15 | - $this->_set_display_strategy( new EE_Text_Input_Display_Strategy( 'datepicker' ) ); |
|
| 16 | - $this->_set_normalization_strategy( new EE_Text_Normalization() ); |
|
| 17 | - parent::__construct( $input_settings ); |
|
| 18 | - $this->set_html_class( $this->html_class() . ' datepicker' ); |
|
| 14 | + function __construct($input_settings = array()) { |
|
| 15 | + $this->_set_display_strategy(new EE_Text_Input_Display_Strategy('datepicker')); |
|
| 16 | + $this->_set_normalization_strategy(new EE_Text_Normalization()); |
|
| 17 | + parent::__construct($input_settings); |
|
| 18 | + $this->set_html_class($this->html_class().' datepicker'); |
|
| 19 | 19 | // add some style and make it dance |
| 20 | - add_action( 'wp_enqueue_scripts', array( 'EE_Datepicker_Input', 'enqueue_styles_and_scripts' )); |
|
| 21 | - add_action( 'admin_enqueue_scripts', array( 'EE_Datepicker_Input', 'enqueue_styles_and_scripts' )); |
|
| 20 | + add_action('wp_enqueue_scripts', array('EE_Datepicker_Input', 'enqueue_styles_and_scripts')); |
|
| 21 | + add_action('admin_enqueue_scripts', array('EE_Datepicker_Input', 'enqueue_styles_and_scripts')); |
|
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | |
@@ -31,8 +31,8 @@ discard block |
||
| 31 | 31 | */ |
| 32 | 32 | public static function enqueue_styles_and_scripts() { |
| 33 | 33 | // load css |
| 34 | - wp_register_style( 'espresso-ui-theme', EE_GLOBAL_ASSETS_URL . 'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(), EVENT_ESPRESSO_VERSION, TRUE ); |
|
| 35 | - wp_enqueue_style( 'espresso-ui-theme'); |
|
| 34 | + wp_register_style('espresso-ui-theme', EE_GLOBAL_ASSETS_URL.'css/espresso-ui-theme/jquery-ui-1.10.3.custom.min.css', array(), EVENT_ESPRESSO_VERSION, TRUE); |
|
| 35 | + wp_enqueue_style('espresso-ui-theme'); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | |
@@ -6,14 +6,14 @@ |
||
| 6 | 6 | * @subpackage |
| 7 | 7 | * @author Mike Nelson |
| 8 | 8 | */ |
| 9 | -class EE_Float_Input extends EE_Form_Input_Base{ |
|
| 9 | +class EE_Float_Input extends EE_Form_Input_Base { |
|
| 10 | 10 | |
| 11 | 11 | /** |
| 12 | 12 | * @param array $input_settings |
| 13 | 13 | */ |
| 14 | - function __construct($input_settings = array()){ |
|
| 14 | + function __construct($input_settings = array()) { |
|
| 15 | 15 | $this->_set_display_strategy(new EE_Text_Input_Display_Strategy()); |
| 16 | - $this->_set_normalization_strategy(new EE_Float_Normalization( isset( $input_settings[ 'validation_error_message' ] ) ? $input_settings[ 'validation_error_message' ] : NULL ) ); |
|
| 16 | + $this->_set_normalization_strategy(new EE_Float_Normalization(isset($input_settings['validation_error_message']) ? $input_settings['validation_error_message'] : NULL)); |
|
| 17 | 17 | parent::__construct($input_settings); |
| 18 | 18 | } |
| 19 | 19 | } |
| 20 | 20 | \ No newline at end of file |