@@ -1,5 +1,5 @@ discard block |
||
| 1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
| 2 | - exit( 'No direct script access allowed' ); |
|
| 1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | 3 | } |
| 4 | 4 | /** |
| 5 | 5 | * Event Espresso |
@@ -50,9 +50,9 @@ discard block |
||
| 50 | 50 | * date_format and the second value is the time format |
| 51 | 51 | * @return EE_Line_Item |
| 52 | 52 | */ |
| 53 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
| 54 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
| 55 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
| 53 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
| 54 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
| 55 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | |
@@ -63,8 +63,8 @@ discard block |
||
| 63 | 63 | * the website will be used. |
| 64 | 64 | * @return EE_Line_Item |
| 65 | 65 | */ |
| 66 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
| 67 | - return new self( $props_n_values, TRUE, $timezone ); |
|
| 66 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
| 67 | + return new self($props_n_values, TRUE, $timezone); |
|
| 68 | 68 | } |
| 69 | 69 | |
| 70 | 70 | |
@@ -75,10 +75,10 @@ discard block |
||
| 75 | 75 | * @param bool $bydb |
| 76 | 76 | * @param string $timezone |
| 77 | 77 | */ |
| 78 | - protected function __construct( $fieldValues = array(), $bydb = FALSE, $timezone = '' ) { |
|
| 79 | - parent::__construct( $fieldValues, $bydb, $timezone ); |
|
| 80 | - if ( ! $this->get( 'LIN_code' ) ) { |
|
| 81 | - $this->set_code( $this->generate_code() ); |
|
| 78 | + protected function __construct($fieldValues = array(), $bydb = FALSE, $timezone = '') { |
|
| 79 | + parent::__construct($fieldValues, $bydb, $timezone); |
|
| 80 | + if ( ! $this->get('LIN_code')) { |
|
| 81 | + $this->set_code($this->generate_code()); |
|
| 82 | 82 | } |
| 83 | 83 | } |
| 84 | 84 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | * @return int |
| 90 | 90 | */ |
| 91 | 91 | function ID() { |
| 92 | - return $this->get( 'LIN_ID' ); |
|
| 92 | + return $this->get('LIN_ID'); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * @return int |
| 100 | 100 | */ |
| 101 | 101 | function TXN_ID() { |
| 102 | - return $this->get( 'TXN_ID' ); |
|
| 102 | + return $this->get('TXN_ID'); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | |
@@ -109,8 +109,8 @@ discard block |
||
| 109 | 109 | * @param int $TXN_ID |
| 110 | 110 | * @return boolean |
| 111 | 111 | */ |
| 112 | - function set_TXN_ID( $TXN_ID ) { |
|
| 113 | - $this->set( 'TXN_ID', $TXN_ID ); |
|
| 112 | + function set_TXN_ID($TXN_ID) { |
|
| 113 | + $this->set('TXN_ID', $TXN_ID); |
|
| 114 | 114 | } |
| 115 | 115 | |
| 116 | 116 | |
@@ -120,9 +120,9 @@ discard block |
||
| 120 | 120 | * @return string |
| 121 | 121 | */ |
| 122 | 122 | function name() { |
| 123 | - $name = $this->get( 'LIN_name' ); |
|
| 124 | - if( ! $name ){ |
|
| 125 | - $name = ucwords( str_replace( '-', ' ', $this->type() ) ); |
|
| 123 | + $name = $this->get('LIN_name'); |
|
| 124 | + if ( ! $name) { |
|
| 125 | + $name = ucwords(str_replace('-', ' ', $this->type())); |
|
| 126 | 126 | } |
| 127 | 127 | return $name; |
| 128 | 128 | } |
@@ -134,8 +134,8 @@ discard block |
||
| 134 | 134 | * @param string $name |
| 135 | 135 | * @return boolean |
| 136 | 136 | */ |
| 137 | - function set_name( $name ) { |
|
| 138 | - $this->set( 'LIN_name', $name ); |
|
| 137 | + function set_name($name) { |
|
| 138 | + $this->set('LIN_name', $name); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | * @return string |
| 146 | 146 | */ |
| 147 | 147 | function desc() { |
| 148 | - return $this->get( 'LIN_desc' ); |
|
| 148 | + return $this->get('LIN_desc'); |
|
| 149 | 149 | } |
| 150 | 150 | |
| 151 | 151 | |
@@ -155,8 +155,8 @@ discard block |
||
| 155 | 155 | * @param string $desc |
| 156 | 156 | * @return boolean |
| 157 | 157 | */ |
| 158 | - function set_desc( $desc ) { |
|
| 159 | - $this->set( 'LIN_desc', $desc ); |
|
| 158 | + function set_desc($desc) { |
|
| 159 | + $this->set('LIN_desc', $desc); |
|
| 160 | 160 | } |
| 161 | 161 | |
| 162 | 162 | |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | * @return int |
| 167 | 167 | */ |
| 168 | 168 | function quantity() { |
| 169 | - return $this->get( 'LIN_quantity' ); |
|
| 169 | + return $this->get('LIN_quantity'); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | |
@@ -176,8 +176,8 @@ discard block |
||
| 176 | 176 | * @param int $quantity |
| 177 | 177 | * @return boolean |
| 178 | 178 | */ |
| 179 | - function set_quantity( $quantity ) { |
|
| 180 | - $this->set( 'LIN_quantity', $quantity ); |
|
| 179 | + function set_quantity($quantity) { |
|
| 180 | + $this->set('LIN_quantity', $quantity); |
|
| 181 | 181 | } |
| 182 | 182 | |
| 183 | 183 | |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | * @return string |
| 188 | 188 | */ |
| 189 | 189 | function OBJ_ID() { |
| 190 | - return $this->get( 'OBJ_ID' ); |
|
| 190 | + return $this->get('OBJ_ID'); |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | |
@@ -197,8 +197,8 @@ discard block |
||
| 197 | 197 | * @param string $item_id |
| 198 | 198 | * @return boolean |
| 199 | 199 | */ |
| 200 | - function set_OBJ_ID( $item_id ) { |
|
| 201 | - $this->set( 'OBJ_ID', $item_id ); |
|
| 200 | + function set_OBJ_ID($item_id) { |
|
| 201 | + $this->set('OBJ_ID', $item_id); |
|
| 202 | 202 | } |
| 203 | 203 | |
| 204 | 204 | |
@@ -208,7 +208,7 @@ discard block |
||
| 208 | 208 | * @return string |
| 209 | 209 | */ |
| 210 | 210 | function OBJ_type() { |
| 211 | - return $this->get( 'OBJ_type' ); |
|
| 211 | + return $this->get('OBJ_type'); |
|
| 212 | 212 | } |
| 213 | 213 | |
| 214 | 214 | |
@@ -218,8 +218,8 @@ discard block |
||
| 218 | 218 | * @param string $OBJ_type |
| 219 | 219 | * @return boolean |
| 220 | 220 | */ |
| 221 | - function set_OBJ_type( $OBJ_type ) { |
|
| 222 | - $this->set( 'OBJ_type', $OBJ_type ); |
|
| 221 | + function set_OBJ_type($OBJ_type) { |
|
| 222 | + $this->set('OBJ_type', $OBJ_type); |
|
| 223 | 223 | } |
| 224 | 224 | |
| 225 | 225 | |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | * @return float |
| 230 | 230 | */ |
| 231 | 231 | function unit_price() { |
| 232 | - return $this->get( 'LIN_unit_price' ); |
|
| 232 | + return $this->get('LIN_unit_price'); |
|
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | |
@@ -239,8 +239,8 @@ discard block |
||
| 239 | 239 | * @param float $unit_price |
| 240 | 240 | * @return boolean |
| 241 | 241 | */ |
| 242 | - function set_unit_price( $unit_price ) { |
|
| 243 | - $this->set( 'LIN_unit_price', $unit_price ); |
|
| 242 | + function set_unit_price($unit_price) { |
|
| 243 | + $this->set('LIN_unit_price', $unit_price); |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | |
@@ -251,19 +251,19 @@ discard block |
||
| 251 | 251 | * @return boolean |
| 252 | 252 | */ |
| 253 | 253 | function is_percent() { |
| 254 | - if( $this->is_tax_sub_total() ) { |
|
| 254 | + if ($this->is_tax_sub_total()) { |
|
| 255 | 255 | //tax subtotals HAVE a percent on them, that percentage only applies |
| 256 | 256 | //to taxable items, so its' an exception. Treat it like a flat line item |
| 257 | 257 | return false; |
| 258 | 258 | } |
| 259 | - $unit_price = abs( $this->get( 'LIN_unit_price' ) ); |
|
| 260 | - $percent = abs( $this->get( 'LIN_percent' ) ); |
|
| 261 | - if ( $unit_price < .001 && $percent ) { |
|
| 259 | + $unit_price = abs($this->get('LIN_unit_price')); |
|
| 260 | + $percent = abs($this->get('LIN_percent')); |
|
| 261 | + if ($unit_price < .001 && $percent) { |
|
| 262 | 262 | return TRUE; |
| 263 | - } elseif ( $unit_price >= .001 && !$percent ) { |
|
| 263 | + } elseif ($unit_price >= .001 && ! $percent) { |
|
| 264 | 264 | return FALSE; |
| 265 | - } elseif ( $unit_price >= .001 && $percent ) { |
|
| 266 | - throw new EE_Error( sprintf( __( "A Line Item can not have a unit price of (%s) AND a percent (%s)!", "event_espresso" ), $unit_price, $percent ) ); |
|
| 265 | + } elseif ($unit_price >= .001 && $percent) { |
|
| 266 | + throw new EE_Error(sprintf(__("A Line Item can not have a unit price of (%s) AND a percent (%s)!", "event_espresso"), $unit_price, $percent)); |
|
| 267 | 267 | } else { |
| 268 | 268 | // if they're both 0, assume its not a percent item |
| 269 | 269 | return FALSE; |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | * @return float |
| 278 | 278 | */ |
| 279 | 279 | function percent() { |
| 280 | - return $this->get( 'LIN_percent' ); |
|
| 280 | + return $this->get('LIN_percent'); |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | |
@@ -287,8 +287,8 @@ discard block |
||
| 287 | 287 | * @param float $percent |
| 288 | 288 | * @return boolean |
| 289 | 289 | */ |
| 290 | - function set_percent( $percent ) { |
|
| 291 | - $this->set( 'LIN_percent', $percent ); |
|
| 290 | + function set_percent($percent) { |
|
| 291 | + $this->set('LIN_percent', $percent); |
|
| 292 | 292 | } |
| 293 | 293 | |
| 294 | 294 | |
@@ -298,7 +298,7 @@ discard block |
||
| 298 | 298 | * @return float |
| 299 | 299 | */ |
| 300 | 300 | function total() { |
| 301 | - return $this->get( 'LIN_total' ); |
|
| 301 | + return $this->get('LIN_total'); |
|
| 302 | 302 | } |
| 303 | 303 | |
| 304 | 304 | |
@@ -308,8 +308,8 @@ discard block |
||
| 308 | 308 | * @param float $total |
| 309 | 309 | * @return boolean |
| 310 | 310 | */ |
| 311 | - function set_total( $total ) { |
|
| 312 | - $this->set( 'LIN_total', $total ); |
|
| 311 | + function set_total($total) { |
|
| 312 | + $this->set('LIN_total', $total); |
|
| 313 | 313 | } |
| 314 | 314 | |
| 315 | 315 | |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | * @return int |
| 320 | 320 | */ |
| 321 | 321 | function order() { |
| 322 | - return $this->get( 'LIN_order' ); |
|
| 322 | + return $this->get('LIN_order'); |
|
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | |
@@ -328,8 +328,8 @@ discard block |
||
| 328 | 328 | * Sets order |
| 329 | 329 | * @param int $order |
| 330 | 330 | */ |
| 331 | - function set_order( $order ) { |
|
| 332 | - $this->set( 'LIN_order', $order ); |
|
| 331 | + function set_order($order) { |
|
| 332 | + $this->set('LIN_order', $order); |
|
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | |
@@ -339,7 +339,7 @@ discard block |
||
| 339 | 339 | * @return int |
| 340 | 340 | */ |
| 341 | 341 | function parent_ID() { |
| 342 | - return $this->get( 'LIN_parent' ); |
|
| 342 | + return $this->get('LIN_parent'); |
|
| 343 | 343 | } |
| 344 | 344 | |
| 345 | 345 | |
@@ -349,8 +349,8 @@ discard block |
||
| 349 | 349 | * @param int $parent |
| 350 | 350 | * @return boolean |
| 351 | 351 | */ |
| 352 | - function set_parent_ID( $parent ) { |
|
| 353 | - $this->set( 'LIN_parent', $parent ); |
|
| 352 | + function set_parent_ID($parent) { |
|
| 353 | + $this->set('LIN_parent', $parent); |
|
| 354 | 354 | } |
| 355 | 355 | |
| 356 | 356 | |
@@ -360,7 +360,7 @@ discard block |
||
| 360 | 360 | * @return string |
| 361 | 361 | */ |
| 362 | 362 | function type() { |
| 363 | - return $this->get( 'LIN_type' ); |
|
| 363 | + return $this->get('LIN_type'); |
|
| 364 | 364 | } |
| 365 | 365 | |
| 366 | 366 | |
@@ -370,8 +370,8 @@ discard block |
||
| 370 | 370 | * @param string $type |
| 371 | 371 | * @return boolean |
| 372 | 372 | */ |
| 373 | - function set_type( $type ) { |
|
| 374 | - $this->set( 'LIN_type', $type ); |
|
| 373 | + function set_type($type) { |
|
| 374 | + $this->set('LIN_type', $type); |
|
| 375 | 375 | } |
| 376 | 376 | |
| 377 | 377 | |
@@ -384,8 +384,8 @@ discard block |
||
| 384 | 384 | * @return EE_Line_Item |
| 385 | 385 | */ |
| 386 | 386 | public function parent() { |
| 387 | - if( $this->ID() ) { |
|
| 388 | - return $this->get_model()->get_one_by_ID( $this->parent_ID() ); |
|
| 387 | + if ($this->ID()) { |
|
| 388 | + return $this->get_model()->get_one_by_ID($this->parent_ID()); |
|
| 389 | 389 | } else { |
| 390 | 390 | return $this->_parent; |
| 391 | 391 | } |
@@ -398,13 +398,13 @@ discard block |
||
| 398 | 398 | * @return EE_Line_Item[] |
| 399 | 399 | */ |
| 400 | 400 | public function children() { |
| 401 | - if ( $this->ID() ) { |
|
| 401 | + if ($this->ID()) { |
|
| 402 | 402 | return $this->get_model()->get_all( |
| 403 | 403 | array( |
| 404 | - array( 'LIN_parent' => $this->ID() ), |
|
| 405 | - 'order_by' => array( 'LIN_order' => 'ASC' ) ) ); |
|
| 404 | + array('LIN_parent' => $this->ID()), |
|
| 405 | + 'order_by' => array('LIN_order' => 'ASC') ) ); |
|
| 406 | 406 | } else { |
| 407 | - if ( ! is_array( $this->_children ) ) { |
|
| 407 | + if ( ! is_array($this->_children)) { |
|
| 408 | 408 | $this->_children = array(); |
| 409 | 409 | } |
| 410 | 410 | return $this->_children; |
@@ -418,7 +418,7 @@ discard block |
||
| 418 | 418 | * @return string |
| 419 | 419 | */ |
| 420 | 420 | function code() { |
| 421 | - return $this->get( 'LIN_code' ); |
|
| 421 | + return $this->get('LIN_code'); |
|
| 422 | 422 | } |
| 423 | 423 | |
| 424 | 424 | |
@@ -428,8 +428,8 @@ discard block |
||
| 428 | 428 | * @param string $code |
| 429 | 429 | * @return boolean |
| 430 | 430 | */ |
| 431 | - function set_code( $code ) { |
|
| 432 | - $this->set( 'LIN_code', $code ); |
|
| 431 | + function set_code($code) { |
|
| 432 | + $this->set('LIN_code', $code); |
|
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | |
@@ -439,7 +439,7 @@ discard block |
||
| 439 | 439 | * @return boolean |
| 440 | 440 | */ |
| 441 | 441 | function is_taxable() { |
| 442 | - return $this->get( 'LIN_is_taxable' ); |
|
| 442 | + return $this->get('LIN_is_taxable'); |
|
| 443 | 443 | } |
| 444 | 444 | |
| 445 | 445 | |
@@ -449,8 +449,8 @@ discard block |
||
| 449 | 449 | * @param boolean $is_taxable |
| 450 | 450 | * @return boolean |
| 451 | 451 | */ |
| 452 | - function set_is_taxable( $is_taxable ) { |
|
| 453 | - $this->set( 'LIN_is_taxable', $is_taxable ); |
|
| 452 | + function set_is_taxable($is_taxable) { |
|
| 453 | + $this->set('LIN_is_taxable', $is_taxable); |
|
| 454 | 454 | } |
| 455 | 455 | |
| 456 | 456 | |
@@ -465,7 +465,7 @@ discard block |
||
| 465 | 465 | */ |
| 466 | 466 | function get_object() { |
| 467 | 467 | $model_name_of_related_obj = $this->OBJ_type(); |
| 468 | - return $this->get_model()->has_relation( $model_name_of_related_obj ) ? $this->get_first_related( $model_name_of_related_obj ) : NULL; |
|
| 468 | + return $this->get_model()->has_relation($model_name_of_related_obj) ? $this->get_first_related($model_name_of_related_obj) : NULL; |
|
| 469 | 469 | } |
| 470 | 470 | |
| 471 | 471 | |
@@ -476,11 +476,11 @@ discard block |
||
| 476 | 476 | * @param array $query_params |
| 477 | 477 | * @return EE_Ticket |
| 478 | 478 | */ |
| 479 | - function ticket( $query_params = array() ) { |
|
| 479 | + function ticket($query_params = array()) { |
|
| 480 | 480 | //we're going to assume that when this method is called we always want to receive the attached ticket EVEN if that ticket is archived. This can be overridden via the incoming $query_params argument |
| 481 | - $remove_defaults = array( 'default_where_conditions' => 'none' ); |
|
| 482 | - $query_params = array_merge( $remove_defaults, $query_params ); |
|
| 483 | - return $this->get_first_related( 'Ticket', $query_params ); |
|
| 481 | + $remove_defaults = array('default_where_conditions' => 'none'); |
|
| 482 | + $query_params = array_merge($remove_defaults, $query_params); |
|
| 483 | + return $this->get_first_related('Ticket', $query_params); |
|
| 484 | 484 | } |
| 485 | 485 | |
| 486 | 486 | |
@@ -490,11 +490,11 @@ discard block |
||
| 490 | 490 | * @return EE_Datetime | NULL |
| 491 | 491 | */ |
| 492 | 492 | function get_ticket_datetime() { |
| 493 | - if ( $this->OBJ_type() === 'Ticket' ) { |
|
| 493 | + if ($this->OBJ_type() === 'Ticket') { |
|
| 494 | 494 | $ticket = $this->ticket(); |
| 495 | - if ( $ticket instanceof EE_Ticket ) { |
|
| 495 | + if ($ticket instanceof EE_Ticket) { |
|
| 496 | 496 | $datetime = $ticket->first_datetime(); |
| 497 | - if ( $datetime instanceof EE_Datetime ) { |
|
| 497 | + if ($datetime instanceof EE_Datetime) { |
|
| 498 | 498 | return $datetime; |
| 499 | 499 | } |
| 500 | 500 | } |
@@ -510,9 +510,9 @@ discard block |
||
| 510 | 510 | * @return string |
| 511 | 511 | */ |
| 512 | 512 | function ticket_event_name() { |
| 513 | - $event_name = __( "Unknown", "event_espresso" ); |
|
| 513 | + $event_name = __("Unknown", "event_espresso"); |
|
| 514 | 514 | $event = $this->ticket_event(); |
| 515 | - if ( $event instanceof EE_Event ) { |
|
| 515 | + if ($event instanceof EE_Event) { |
|
| 516 | 516 | $event_name = $event->name(); |
| 517 | 517 | } |
| 518 | 518 | return $event_name; |
@@ -526,9 +526,9 @@ discard block |
||
| 526 | 526 | function ticket_event() { |
| 527 | 527 | $event = null; |
| 528 | 528 | $ticket = $this->ticket(); |
| 529 | - if ( $ticket instanceof EE_Ticket ) { |
|
| 529 | + if ($ticket instanceof EE_Ticket) { |
|
| 530 | 530 | $datetime = $ticket->first_datetime(); |
| 531 | - if ( $datetime instanceof EE_Datetime ) { |
|
| 531 | + if ($datetime instanceof EE_Datetime) { |
|
| 532 | 532 | $event = $datetime->event(); |
| 533 | 533 | } |
| 534 | 534 | } |
@@ -543,11 +543,11 @@ discard block |
||
| 543 | 543 | * @param string $time_format |
| 544 | 544 | * @return string |
| 545 | 545 | */ |
| 546 | - function ticket_datetime_start( $date_format = '', $time_format = '' ) { |
|
| 547 | - $first_datetime_string = __( "Unknown", "event_espresso" ); |
|
| 546 | + function ticket_datetime_start($date_format = '', $time_format = '') { |
|
| 547 | + $first_datetime_string = __("Unknown", "event_espresso"); |
|
| 548 | 548 | $datetime = $this->get_ticket_datetime(); |
| 549 | - if ( $datetime ) { |
|
| 550 | - $first_datetime_string = $datetime->start_date_and_time( $date_format, $time_format ); |
|
| 549 | + if ($datetime) { |
|
| 550 | + $first_datetime_string = $datetime->start_date_and_time($date_format, $time_format); |
|
| 551 | 551 | } |
| 552 | 552 | return $first_datetime_string; |
| 553 | 553 | } |
@@ -562,26 +562,26 @@ discard block |
||
| 562 | 562 | * @return bool success |
| 563 | 563 | * @throws \EE_Error |
| 564 | 564 | */ |
| 565 | - function add_child_line_item( EEI_Line_Item $line_item, $set_order = true ) { |
|
| 565 | + function add_child_line_item(EEI_Line_Item $line_item, $set_order = true) { |
|
| 566 | 566 | // should we calculate the LIN_order for this line item ? |
| 567 | - if ( $set_order || $line_item->order() === null ) { |
|
| 568 | - $line_item->set_order( count( $this->children() ) ); |
|
| 567 | + if ($set_order || $line_item->order() === null) { |
|
| 568 | + $line_item->set_order(count($this->children())); |
|
| 569 | 569 | } |
| 570 | - if ( $this->ID() ) { |
|
| 570 | + if ($this->ID()) { |
|
| 571 | 571 | //check for any duplicate line items (with the same code), if so, this replaces it |
| 572 | - $line_item_with_same_code = $this->get_child_line_item( $line_item->code() ); |
|
| 573 | - if( $line_item_with_same_code instanceof EE_Line_Item && $line_item_with_same_code !== $line_item ) { |
|
| 574 | - $this->delete_child_line_item( $line_item_with_same_code->code() ); |
|
| 572 | + $line_item_with_same_code = $this->get_child_line_item($line_item->code()); |
|
| 573 | + if ($line_item_with_same_code instanceof EE_Line_Item && $line_item_with_same_code !== $line_item) { |
|
| 574 | + $this->delete_child_line_item($line_item_with_same_code->code()); |
|
| 575 | 575 | } |
| 576 | - $line_item->set_parent_ID( $this->ID() ); |
|
| 577 | - if( $this->TXN_ID() ){ |
|
| 578 | - $line_item->set_TXN_ID( $this->TXN_ID() ); |
|
| 576 | + $line_item->set_parent_ID($this->ID()); |
|
| 577 | + if ($this->TXN_ID()) { |
|
| 578 | + $line_item->set_TXN_ID($this->TXN_ID()); |
|
| 579 | 579 | } |
| 580 | 580 | return $line_item->save(); |
| 581 | 581 | } else { |
| 582 | - $this->_children[ $line_item->code() ] = $line_item; |
|
| 583 | - if( $line_item->parent() != $this ) { |
|
| 584 | - $line_item->set_parent( $this ); |
|
| 582 | + $this->_children[$line_item->code()] = $line_item; |
|
| 583 | + if ($line_item->parent() != $this) { |
|
| 584 | + $line_item->set_parent($this); |
|
| 585 | 585 | } |
| 586 | 586 | return TRUE; |
| 587 | 587 | } |
@@ -595,16 +595,16 @@ discard block |
||
| 595 | 595 | * @param EE_Line_Item $line_item |
| 596 | 596 | * |
| 597 | 597 | */ |
| 598 | - public function set_parent( $line_item ) { |
|
| 599 | - if ( $this->ID() ) { |
|
| 600 | - if( ! $line_item->ID() ) { |
|
| 598 | + public function set_parent($line_item) { |
|
| 599 | + if ($this->ID()) { |
|
| 600 | + if ( ! $line_item->ID()) { |
|
| 601 | 601 | $line_item->save(); |
| 602 | 602 | } |
| 603 | - $this->set_parent_ID( $line_item->ID() ); |
|
| 603 | + $this->set_parent_ID($line_item->ID()); |
|
| 604 | 604 | $this->save(); |
| 605 | 605 | } else { |
| 606 | 606 | $this->_parent = $line_item; |
| 607 | - $this->set_parent_ID( $line_item->ID() ); |
|
| 607 | + $this->set_parent_ID($line_item->ID()); |
|
| 608 | 608 | } |
| 609 | 609 | } |
| 610 | 610 | |
@@ -617,11 +617,11 @@ discard block |
||
| 617 | 617 | * @param string $code |
| 618 | 618 | * @return EE_Line_Item |
| 619 | 619 | */ |
| 620 | - function get_child_line_item( $code ) { |
|
| 621 | - if ( $this->ID() ) { |
|
| 622 | - return $this->get_model()->get_one( array( array( 'LIN_parent' => $this->ID(), 'LIN_code' => $code ) ) ); |
|
| 620 | + function get_child_line_item($code) { |
|
| 621 | + if ($this->ID()) { |
|
| 622 | + return $this->get_model()->get_one(array(array('LIN_parent' => $this->ID(), 'LIN_code' => $code))); |
|
| 623 | 623 | } else { |
| 624 | - return isset( $this->_children[ $code ] ) ? $this->_children[ $code ] : null; |
|
| 624 | + return isset($this->_children[$code]) ? $this->_children[$code] : null; |
|
| 625 | 625 | } |
| 626 | 626 | } |
| 627 | 627 | |
@@ -632,10 +632,10 @@ discard block |
||
| 632 | 632 | * @return int |
| 633 | 633 | */ |
| 634 | 634 | function delete_children_line_items() { |
| 635 | - if ( $this->ID() ) { |
|
| 636 | - return $this->get_model()->delete( array( array( 'LIN_parent' => $this->ID() ) ) ); |
|
| 635 | + if ($this->ID()) { |
|
| 636 | + return $this->get_model()->delete(array(array('LIN_parent' => $this->ID()))); |
|
| 637 | 637 | } else { |
| 638 | - $count = count( $this->_children ); |
|
| 638 | + $count = count($this->_children); |
|
| 639 | 639 | $this->_children = array(); |
| 640 | 640 | return $count; |
| 641 | 641 | } |
@@ -652,25 +652,25 @@ discard block |
||
| 652 | 652 | * @param bool $stop_search_once_found |
| 653 | 653 | * @return int count of items deleted (or simply removed from the line item's cache, if not has not been saved to the DB yet) |
| 654 | 654 | */ |
| 655 | - function delete_child_line_item( $code, $stop_search_once_found = true ) { |
|
| 656 | - if ( $this->ID() ) { |
|
| 655 | + function delete_child_line_item($code, $stop_search_once_found = true) { |
|
| 656 | + if ($this->ID()) { |
|
| 657 | 657 | $items_deleted = 0; |
| 658 | - if( $this->code() == $code ) { |
|
| 659 | - $items_deleted += EEH_Line_Item::delete_all_child_items( $this ); |
|
| 660 | - $items_deleted += intval( $this->delete() ); |
|
| 661 | - if( $stop_search_once_found ){ |
|
| 658 | + if ($this->code() == $code) { |
|
| 659 | + $items_deleted += EEH_Line_Item::delete_all_child_items($this); |
|
| 660 | + $items_deleted += intval($this->delete()); |
|
| 661 | + if ($stop_search_once_found) { |
|
| 662 | 662 | return $items_deleted; |
| 663 | 663 | } |
| 664 | 664 | } |
| 665 | - foreach( $this->children() as $child_line_item ) { |
|
| 666 | - $items_deleted += $child_line_item->delete_child_line_item( $code, $stop_search_once_found ); |
|
| 665 | + foreach ($this->children() as $child_line_item) { |
|
| 666 | + $items_deleted += $child_line_item->delete_child_line_item($code, $stop_search_once_found); |
|
| 667 | 667 | } |
| 668 | 668 | return $items_deleted; |
| 669 | 669 | } else { |
| 670 | - if( isset( $this->_children[ $code ] ) ) { |
|
| 671 | - unset( $this->_children[ $code ] ); |
|
| 670 | + if (isset($this->_children[$code])) { |
|
| 671 | + unset($this->_children[$code]); |
|
| 672 | 672 | return 1; |
| 673 | - }else{ |
|
| 673 | + } else { |
|
| 674 | 674 | return 0; |
| 675 | 675 | } |
| 676 | 676 | } |
@@ -683,9 +683,9 @@ discard block |
||
| 683 | 683 | * @return boolean |
| 684 | 684 | */ |
| 685 | 685 | public function delete_if_childless_subtotal() { |
| 686 | - if( $this->ID() && |
|
| 686 | + if ($this->ID() && |
|
| 687 | 687 | $this->type() == EEM_Line_Item::type_sub_total && |
| 688 | - ! $this->children() ) { |
|
| 688 | + ! $this->children()) { |
|
| 689 | 689 | return $this->delete(); |
| 690 | 690 | } else { |
| 691 | 691 | return false; |
@@ -700,7 +700,7 @@ discard block |
||
| 700 | 700 | */ |
| 701 | 701 | function generate_code() { |
| 702 | 702 | // each line item in the cart requires a unique identifier |
| 703 | - return md5( $this->get( 'OBJ_type' ) . $this->get( 'OBJ_ID' ) . microtime() ); |
|
| 703 | + return md5($this->get('OBJ_type').$this->get('OBJ_ID').microtime()); |
|
| 704 | 704 | } |
| 705 | 705 | |
| 706 | 706 | |
@@ -764,7 +764,7 @@ discard block |
||
| 764 | 764 | * @return string like '2, 004.00', formatted according to the localized currency |
| 765 | 765 | */ |
| 766 | 766 | function unit_price_no_code() { |
| 767 | - return $this->get_pretty( 'LIN_unit_price', 'no_currency_code' ); |
|
| 767 | + return $this->get_pretty('LIN_unit_price', 'no_currency_code'); |
|
| 768 | 768 | } |
| 769 | 769 | |
| 770 | 770 | |
@@ -774,7 +774,7 @@ discard block |
||
| 774 | 774 | * @return string like '2, 004.00', formatted according to the localized currency |
| 775 | 775 | */ |
| 776 | 776 | function total_no_code() { |
| 777 | - return $this->get_pretty( 'LIN_total', 'no_currency_code' ); |
|
| 777 | + return $this->get_pretty('LIN_total', 'no_currency_code'); |
|
| 778 | 778 | } |
| 779 | 779 | |
| 780 | 780 | |
@@ -793,17 +793,17 @@ discard block |
||
| 793 | 793 | |
| 794 | 794 | $total = $pre_tax_total + $tax_total; |
| 795 | 795 | // no negative totals plz |
| 796 | - $total = max( $total, 0 ); |
|
| 797 | - $this->set_total( $total ); |
|
| 796 | + $total = max($total, 0); |
|
| 797 | + $this->set_total($total); |
|
| 798 | 798 | //only update the related transaction's total |
| 799 | 799 | //if we intend to save this line item and its a grand total |
| 800 | - if( |
|
| 800 | + if ( |
|
| 801 | 801 | $this->allow_persist() && |
| 802 | 802 | $this->type() == EEM_Line_Item::type_total && |
| 803 | 803 | $this->transaction() instanceof EE_Transaction |
| 804 | - ){ |
|
| 805 | - $this->transaction()->set_total( $total ); |
|
| 806 | - if ( $this->transaction()->ID() ) { |
|
| 804 | + ) { |
|
| 805 | + $this->transaction()->set_total($total); |
|
| 806 | + if ($this->transaction()->ID()) { |
|
| 807 | 807 | $this->transaction()->save(); |
| 808 | 808 | } |
| 809 | 809 | } |
@@ -824,42 +824,42 @@ discard block |
||
| 824 | 824 | $total = 0; |
| 825 | 825 | $my_children = $this->children(); |
| 826 | 826 | //completely ignore tax and tax sub-totals when calculating the pre-tax-total |
| 827 | - if ( $this->is_tax_sub_total() || $this->is_tax() ) { |
|
| 827 | + if ($this->is_tax_sub_total() || $this->is_tax()) { |
|
| 828 | 828 | return 0; |
| 829 | 829 | } elseif ( |
| 830 | - ( $this->is_sub_line_item() || $this->is_line_item() ) |
|
| 831 | - && empty( $my_children ) |
|
| 830 | + ($this->is_sub_line_item() || $this->is_line_item()) |
|
| 831 | + && empty($my_children) |
|
| 832 | 832 | ) { |
| 833 | 833 | $total = $this->unit_price() * $this->quantity(); |
| 834 | - } elseif( $this->is_sub_total() || $this->is_total() ) { |
|
| 835 | - $total = $this->_recalculate_pretax_total_for_subtotal( $total, $my_children ); |
|
| 836 | - } elseif ( $this->is_line_item() && ! empty( $my_children ) ) { |
|
| 837 | - $total = $this->_recalculate_pretax_total_for_line_item( $total, $my_children ); |
|
| 834 | + } elseif ($this->is_sub_total() || $this->is_total()) { |
|
| 835 | + $total = $this->_recalculate_pretax_total_for_subtotal($total, $my_children); |
|
| 836 | + } elseif ($this->is_line_item() && ! empty($my_children)) { |
|
| 837 | + $total = $this->_recalculate_pretax_total_for_line_item($total, $my_children); |
|
| 838 | 838 | } |
| 839 | 839 | //ensure all non-line items and non-sub-line-items have a quantity of 1 |
| 840 | - if( ! $this->is_line_item() && ! $this->is_sub_line_item() ) { |
|
| 841 | - $this->set_quantity( 1 ); |
|
| 842 | - if( ! $this->is_percent() ) { |
|
| 843 | - $this->set_unit_price( $this->total() ); |
|
| 840 | + if ( ! $this->is_line_item() && ! $this->is_sub_line_item()) { |
|
| 841 | + $this->set_quantity(1); |
|
| 842 | + if ( ! $this->is_percent()) { |
|
| 843 | + $this->set_unit_price($this->total()); |
|
| 844 | 844 | } |
| 845 | 845 | } |
| 846 | 846 | |
| 847 | 847 | //we don't want to bother saving grand totals, because that needs to factor in taxes anyways |
| 848 | 848 | //so it ought to be |
| 849 | - if( ! $this->is_total() ) { |
|
| 850 | - $this->set_total( $total ); |
|
| 849 | + if ( ! $this->is_total()) { |
|
| 850 | + $this->set_total($total); |
|
| 851 | 851 | //if not a percent line item, make sure we keep the unit price in sync |
| 852 | - if( |
|
| 852 | + if ( |
|
| 853 | 853 | $this->is_line_item() && |
| 854 | - ! empty( $my_children ) && |
|
| 854 | + ! empty($my_children) && |
|
| 855 | 855 | ! $this->is_percent() |
| 856 | 856 | ) { |
| 857 | - if( $this->quantity() === 0 ){ |
|
| 857 | + if ($this->quantity() === 0) { |
|
| 858 | 858 | $new_unit_price = 0; |
| 859 | 859 | } else { |
| 860 | 860 | $new_unit_price = $this->total() / $this->quantity(); |
| 861 | 861 | } |
| 862 | - $this->set_unit_price( $new_unit_price ); |
|
| 862 | + $this->set_unit_price($new_unit_price); |
|
| 863 | 863 | } |
| 864 | 864 | $this->maybe_save(); |
| 865 | 865 | } |
@@ -875,34 +875,34 @@ discard block |
||
| 875 | 875 | * @param EE_Line_Item[] $my_children |
| 876 | 876 | * @return float |
| 877 | 877 | */ |
| 878 | - protected function _recalculate_pretax_total_for_subtotal( $calculated_total_so_far, $my_children = null ) { |
|
| 879 | - if( $my_children === null ) { |
|
| 878 | + protected function _recalculate_pretax_total_for_subtotal($calculated_total_so_far, $my_children = null) { |
|
| 879 | + if ($my_children === null) { |
|
| 880 | 880 | $my_children = $this->children(); |
| 881 | 881 | } |
| 882 | 882 | //get the total of all its children |
| 883 | - foreach ( $my_children as $child_line_item ) { |
|
| 884 | - if ( $child_line_item instanceof EE_Line_Item ) { |
|
| 885 | - if ( $child_line_item->is_percent() ) { |
|
| 883 | + foreach ($my_children as $child_line_item) { |
|
| 884 | + if ($child_line_item instanceof EE_Line_Item) { |
|
| 885 | + if ($child_line_item->is_percent()) { |
|
| 886 | 886 | $percent_total = $calculated_total_so_far * $child_line_item->percent() / 100; |
| 887 | - $child_line_item->set_total( $percent_total ); |
|
| 887 | + $child_line_item->set_total($percent_total); |
|
| 888 | 888 | //so far all percent line items should have a quantity of 1 |
| 889 | 889 | //(ie, no double percent discounts. Although that might be requested someday) |
| 890 | - $child_line_item->set_quantity( 1 ); |
|
| 890 | + $child_line_item->set_quantity(1); |
|
| 891 | 891 | $child_line_item->maybe_save(); |
| 892 | 892 | $calculated_total_so_far += $percent_total; |
| 893 | 893 | } else { |
| 894 | 894 | //verify flat sub-line-item quantities match their parent |
| 895 | - if( $child_line_item->is_sub_line_item() ) { |
|
| 896 | - $child_line_item->set_quantity( $this->quantity() ); |
|
| 895 | + if ($child_line_item->is_sub_line_item()) { |
|
| 896 | + $child_line_item->set_quantity($this->quantity()); |
|
| 897 | 897 | } |
| 898 | 898 | $calculated_total_so_far += $child_line_item->recalculate_pre_tax_total(); |
| 899 | 899 | } |
| 900 | 900 | } |
| 901 | 901 | } |
| 902 | 902 | |
| 903 | - if( $this->is_sub_total() ){ |
|
| 903 | + if ($this->is_sub_total()) { |
|
| 904 | 904 | // no negative totals plz |
| 905 | - $calculated_total_so_far = max( $calculated_total_so_far, 0 ); |
|
| 905 | + $calculated_total_so_far = max($calculated_total_so_far, 0); |
|
| 906 | 906 | } |
| 907 | 907 | return $calculated_total_so_far; |
| 908 | 908 | } |
@@ -916,8 +916,8 @@ discard block |
||
| 916 | 916 | * @param EE_Line_Item[] $my_children |
| 917 | 917 | * @return float |
| 918 | 918 | */ |
| 919 | - protected function _recalculate_pretax_total_for_line_item( $calculated_total_so_far, $my_children = null ) { |
|
| 920 | - if( $my_children === null ) { |
|
| 919 | + protected function _recalculate_pretax_total_for_line_item($calculated_total_so_far, $my_children = null) { |
|
| 920 | + if ($my_children === null) { |
|
| 921 | 921 | $my_children = $this->children(); |
| 922 | 922 | } |
| 923 | 923 | //we need to keep track of the running total for a single item, |
@@ -925,9 +925,9 @@ discard block |
||
| 925 | 925 | $unit_price_for_total = 0; |
| 926 | 926 | $quantity_for_total = 1; |
| 927 | 927 | //get the total of all its children |
| 928 | - foreach ( $my_children as $child_line_item ) { |
|
| 929 | - if ( $child_line_item instanceof EE_Line_Item ) { |
|
| 930 | - if ( $child_line_item->is_percent() ) { |
|
| 928 | + foreach ($my_children as $child_line_item) { |
|
| 929 | + if ($child_line_item instanceof EE_Line_Item) { |
|
| 930 | + if ($child_line_item->is_percent()) { |
|
| 931 | 931 | //it should be the unit-price-so-far multiplied by teh percent multiplied by the quantity |
| 932 | 932 | //not total multiplied by percent, because that ignores rounding along-the-way |
| 933 | 933 | $percent_unit_price = round( |
@@ -935,17 +935,17 @@ discard block |
||
| 935 | 935 | EE_Registry::instance()->CFG->currency->dec_plc |
| 936 | 936 | ); |
| 937 | 937 | $percent_total = $percent_unit_price * $quantity_for_total; |
| 938 | - $child_line_item->set_total( $percent_total ); |
|
| 938 | + $child_line_item->set_total($percent_total); |
|
| 939 | 939 | //so far all percent line items should have a quantity of 1 |
| 940 | 940 | //(ie, no double percent discounts. Although that might be requested someday) |
| 941 | - $child_line_item->set_quantity( 1 ); |
|
| 941 | + $child_line_item->set_quantity(1); |
|
| 942 | 942 | $child_line_item->maybe_save(); |
| 943 | 943 | $calculated_total_so_far += $percent_total; |
| 944 | 944 | $unit_price_for_total += $percent_unit_price; |
| 945 | 945 | } else { |
| 946 | 946 | //verify flat sub-line-item quantities match their parent |
| 947 | - if( $child_line_item->is_sub_line_item() ) { |
|
| 948 | - $child_line_item->set_quantity( $this->quantity() ); |
|
| 947 | + if ($child_line_item->is_sub_line_item()) { |
|
| 948 | + $child_line_item->set_quantity($this->quantity()); |
|
| 949 | 949 | } |
| 950 | 950 | $quantity_for_total = $child_line_item->quantity(); |
| 951 | 951 | $calculated_total_so_far += $child_line_item->recalculate_pre_tax_total(); |
@@ -969,10 +969,10 @@ discard block |
||
| 969 | 969 | //calculate the pretax total |
| 970 | 970 | $taxable_total = $this->taxable_total(); |
| 971 | 971 | $tax_total = 0; |
| 972 | - foreach ( $taxes as $tax ) { |
|
| 972 | + foreach ($taxes as $tax) { |
|
| 973 | 973 | $total_on_this_tax = $taxable_total * $tax->percent() / 100; |
| 974 | 974 | //remember the total on this line item |
| 975 | - $tax->set_total( $total_on_this_tax ); |
|
| 975 | + $tax->set_total($total_on_this_tax); |
|
| 976 | 976 | $tax_total += $tax->total(); |
| 977 | 977 | } |
| 978 | 978 | $this->_recalculate_tax_sub_total(); |
@@ -986,21 +986,21 @@ discard block |
||
| 986 | 986 | * @return void |
| 987 | 987 | */ |
| 988 | 988 | private function _recalculate_tax_sub_total() { |
| 989 | - if ( $this->is_tax_sub_total() ) { |
|
| 989 | + if ($this->is_tax_sub_total()) { |
|
| 990 | 990 | $total = 0; |
| 991 | 991 | $total_percent = 0; |
| 992 | 992 | //simply loop through all its children (which should be taxes) and sum their total |
| 993 | - foreach ( $this->children() as $child_tax ) { |
|
| 994 | - if ( $child_tax instanceof EE_Line_Item ) { |
|
| 993 | + foreach ($this->children() as $child_tax) { |
|
| 994 | + if ($child_tax instanceof EE_Line_Item) { |
|
| 995 | 995 | $total += $child_tax->total(); |
| 996 | 996 | $total_percent += $child_tax->percent(); |
| 997 | 997 | } |
| 998 | 998 | } |
| 999 | - $this->set_total( $total ); |
|
| 1000 | - $this->set_percent( $total_percent ); |
|
| 1001 | - } elseif ( $this->is_total() ) { |
|
| 1002 | - foreach ( $this->children() as $maybe_tax_subtotal ) { |
|
| 1003 | - if ( $maybe_tax_subtotal instanceof EE_Line_Item ) { |
|
| 999 | + $this->set_total($total); |
|
| 1000 | + $this->set_percent($total_percent); |
|
| 1001 | + } elseif ($this->is_total()) { |
|
| 1002 | + foreach ($this->children() as $maybe_tax_subtotal) { |
|
| 1003 | + if ($maybe_tax_subtotal instanceof EE_Line_Item) { |
|
| 1004 | 1004 | $maybe_tax_subtotal->_recalculate_tax_sub_total(); |
| 1005 | 1005 | } |
| 1006 | 1006 | } |
@@ -1016,8 +1016,8 @@ discard block |
||
| 1016 | 1016 | public function get_total_tax() { |
| 1017 | 1017 | $this->_recalculate_tax_sub_total(); |
| 1018 | 1018 | $total = 0; |
| 1019 | - foreach ( $this->tax_descendants() as $tax_line_item ) { |
|
| 1020 | - if ( $tax_line_item instanceof EE_Line_Item ) { |
|
| 1019 | + foreach ($this->tax_descendants() as $tax_line_item) { |
|
| 1020 | + if ($tax_line_item instanceof EE_Line_Item) { |
|
| 1021 | 1021 | $total += $tax_line_item->total(); |
| 1022 | 1022 | } |
| 1023 | 1023 | } |
@@ -1031,8 +1031,8 @@ discard block |
||
| 1031 | 1031 | */ |
| 1032 | 1032 | public function get_items_total() { |
| 1033 | 1033 | $total = 0; |
| 1034 | - foreach ( $this->get_items() as $item ) { |
|
| 1035 | - if ( $item instanceof EE_Line_Item ) { |
|
| 1034 | + foreach ($this->get_items() as $item) { |
|
| 1035 | + if ($item instanceof EE_Line_Item) { |
|
| 1036 | 1036 | $total += $item->total(); |
| 1037 | 1037 | } |
| 1038 | 1038 | } |
@@ -1047,8 +1047,8 @@ discard block |
||
| 1047 | 1047 | * @return EE_Line_Item[] |
| 1048 | 1048 | */ |
| 1049 | 1049 | function tax_descendants() { |
| 1050 | - EE_Registry::instance()->load_helper( 'Line_Item' ); |
|
| 1051 | - return EEH_Line_Item::get_tax_descendants( $this ); |
|
| 1050 | + EE_Registry::instance()->load_helper('Line_Item'); |
|
| 1051 | + return EEH_Line_Item::get_tax_descendants($this); |
|
| 1052 | 1052 | } |
| 1053 | 1053 | |
| 1054 | 1054 | |
@@ -1058,8 +1058,8 @@ discard block |
||
| 1058 | 1058 | * @return EE_Line_Item[] |
| 1059 | 1059 | */ |
| 1060 | 1060 | function get_items() { |
| 1061 | - EE_Registry::instance()->load_helper( 'Line_Item' ); |
|
| 1062 | - return EEH_Line_Item::get_line_item_descendants( $this ); |
|
| 1061 | + EE_Registry::instance()->load_helper('Line_Item'); |
|
| 1062 | + return EEH_Line_Item::get_line_item_descendants($this); |
|
| 1063 | 1063 | } |
| 1064 | 1064 | |
| 1065 | 1065 | |
@@ -1073,22 +1073,22 @@ discard block |
||
| 1073 | 1073 | */ |
| 1074 | 1074 | function taxable_total() { |
| 1075 | 1075 | $total = 0; |
| 1076 | - if ( $this->children() ) { |
|
| 1077 | - foreach ( $this->children() as $child_line_item ) { |
|
| 1078 | - if ( $child_line_item->type() == EEM_Line_Item::type_line_item && $child_line_item->is_taxable()) { |
|
| 1076 | + if ($this->children()) { |
|
| 1077 | + foreach ($this->children() as $child_line_item) { |
|
| 1078 | + if ($child_line_item->type() == EEM_Line_Item::type_line_item && $child_line_item->is_taxable()) { |
|
| 1079 | 1079 | //if it's a percent item, only take into account the percent |
| 1080 | 1080 | //that's taxable too (the taxable total so far) |
| 1081 | - if( $child_line_item->is_percent() ) { |
|
| 1082 | - $total = $total + ( $total * $child_line_item->percent() / 100 ); |
|
| 1083 | - }else{ |
|
| 1081 | + if ($child_line_item->is_percent()) { |
|
| 1082 | + $total = $total + ($total * $child_line_item->percent() / 100); |
|
| 1083 | + } else { |
|
| 1084 | 1084 | $total += $child_line_item->total(); |
| 1085 | 1085 | } |
| 1086 | - }elseif( $child_line_item->type() == EEM_Line_Item::type_sub_total ){ |
|
| 1086 | + }elseif ($child_line_item->type() == EEM_Line_Item::type_sub_total) { |
|
| 1087 | 1087 | $total += $child_line_item->taxable_total(); |
| 1088 | 1088 | } |
| 1089 | 1089 | } |
| 1090 | 1090 | } |
| 1091 | - return max( $total, 0 ); |
|
| 1091 | + return max($total, 0); |
|
| 1092 | 1092 | } |
| 1093 | 1093 | |
| 1094 | 1094 | |
@@ -1098,7 +1098,7 @@ discard block |
||
| 1098 | 1098 | * @return EE_Transaction |
| 1099 | 1099 | */ |
| 1100 | 1100 | public function transaction() { |
| 1101 | - return $this->get_first_related( 'Transaction' ); |
|
| 1101 | + return $this->get_first_related('Transaction'); |
|
| 1102 | 1102 | } |
| 1103 | 1103 | |
| 1104 | 1104 | |
@@ -1111,17 +1111,17 @@ discard block |
||
| 1111 | 1111 | * @param int $txn_id if none is provided, assumes $this->TXN_ID() |
| 1112 | 1112 | * @return int count of items saved |
| 1113 | 1113 | */ |
| 1114 | - public function save_this_and_descendants_to_txn( $txn_id = NULL ) { |
|
| 1115 | - if ( ! $txn_id ) { |
|
| 1114 | + public function save_this_and_descendants_to_txn($txn_id = NULL) { |
|
| 1115 | + if ( ! $txn_id) { |
|
| 1116 | 1116 | $txn_id = $this->TXN_ID(); |
| 1117 | 1117 | } |
| 1118 | - $this->set_TXN_ID( $txn_id ); |
|
| 1118 | + $this->set_TXN_ID($txn_id); |
|
| 1119 | 1119 | $children = $this->children(); |
| 1120 | 1120 | $this->save(); |
| 1121 | - foreach ( $children as $child_line_item ) { |
|
| 1122 | - if ( $child_line_item instanceof EE_Line_Item ) { |
|
| 1123 | - $child_line_item->set_parent_ID( $this->ID() ); |
|
| 1124 | - $child_line_item->save_this_and_descendants_to_txn( $txn_id ); |
|
| 1121 | + foreach ($children as $child_line_item) { |
|
| 1122 | + if ($child_line_item instanceof EE_Line_Item) { |
|
| 1123 | + $child_line_item->set_parent_ID($this->ID()); |
|
| 1124 | + $child_line_item->save_this_and_descendants_to_txn($txn_id); |
|
| 1125 | 1125 | } |
| 1126 | 1126 | } |
| 1127 | 1127 | } |
@@ -1133,10 +1133,10 @@ discard block |
||
| 1133 | 1133 | * @param string $type one of the constants on EEM_Line_Item |
| 1134 | 1134 | * @return EE_Line_Item[] |
| 1135 | 1135 | */ |
| 1136 | - protected function _get_descendants_of_type( $type ) { |
|
| 1137 | - EE_Error::doing_it_wrong( 'EE_Line_Item::_get_descendants_of_type()', __('Method replaced with EEH_Line_Item::get_descendants_of_type()', 'event_espresso'), '4.6.0' ); |
|
| 1138 | - EE_Registry::instance()->load_helper( 'Line_Item' ); |
|
| 1139 | - return EEH_Line_Item::get_descendants_of_type( $this, $type ); |
|
| 1136 | + protected function _get_descendants_of_type($type) { |
|
| 1137 | + EE_Error::doing_it_wrong('EE_Line_Item::_get_descendants_of_type()', __('Method replaced with EEH_Line_Item::get_descendants_of_type()', 'event_espresso'), '4.6.0'); |
|
| 1138 | + EE_Registry::instance()->load_helper('Line_Item'); |
|
| 1139 | + return EEH_Line_Item::get_descendants_of_type($this, $type); |
|
| 1140 | 1140 | } |
| 1141 | 1141 | |
| 1142 | 1142 | |
@@ -1146,10 +1146,10 @@ discard block |
||
| 1146 | 1146 | * @param string $type like one of the EEM_Line_Item::type_* |
| 1147 | 1147 | * @return EE_Line_Item |
| 1148 | 1148 | */ |
| 1149 | - public function get_nearest_descendant_of_type( $type ) { |
|
| 1150 | - EE_Error::doing_it_wrong( 'EE_Line_Item::get_nearest_descendant_of_type()', __('Method replaced with EEH_Line_Item::get_nearest_descendant_of_type()', 'event_espresso'), '4.6.0' ); |
|
| 1151 | - EE_Registry::instance()->load_helper( 'Line_Item' ); |
|
| 1152 | - return EEH_Line_Item::get_nearest_descendant_of_type( $this, $type ); |
|
| 1149 | + public function get_nearest_descendant_of_type($type) { |
|
| 1150 | + EE_Error::doing_it_wrong('EE_Line_Item::get_nearest_descendant_of_type()', __('Method replaced with EEH_Line_Item::get_nearest_descendant_of_type()', 'event_espresso'), '4.6.0'); |
|
| 1151 | + EE_Registry::instance()->load_helper('Line_Item'); |
|
| 1152 | + return EEH_Line_Item::get_nearest_descendant_of_type($this, $type); |
|
| 1153 | 1153 | } |
| 1154 | 1154 | |
| 1155 | 1155 | |
@@ -1160,7 +1160,7 @@ discard block |
||
| 1160 | 1160 | * @return int count of items saved |
| 1161 | 1161 | */ |
| 1162 | 1162 | public function maybe_save() { |
| 1163 | - if ( $this->ID() ) { |
|
| 1163 | + if ($this->ID()) { |
|
| 1164 | 1164 | return $this->save(); |
| 1165 | 1165 | } |
| 1166 | 1166 | return false; |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
| 2 | - exit( 'No direct script access allowed' ); |
|
| 1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | 3 | } |
| 4 | 4 | /** |
| 5 | 5 | * Event Espresso |
@@ -35,9 +35,9 @@ discard block |
||
| 35 | 35 | * date_format and the second value is the time format |
| 36 | 36 | * @return EE_Attendee |
| 37 | 37 | */ |
| 38 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
| 39 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
| 40 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
| 38 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
| 39 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
| 40 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | |
@@ -48,8 +48,8 @@ discard block |
||
| 48 | 48 | * the website will be used. |
| 49 | 49 | * @return EE_Attendee |
| 50 | 50 | */ |
| 51 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
| 52 | - return new self( $props_n_values, TRUE, $timezone ); |
|
| 51 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
| 52 | + return new self($props_n_values, TRUE, $timezone); |
|
| 53 | 53 | } |
| 54 | 54 | |
| 55 | 55 | |
@@ -60,8 +60,8 @@ discard block |
||
| 60 | 60 | * @access public |
| 61 | 61 | * @param int $PRT_ID |
| 62 | 62 | */ |
| 63 | - public function set_type( $PRT_ID = 0 ) { |
|
| 64 | - $this->set( 'PRT_ID', $PRT_ID ); |
|
| 63 | + public function set_type($PRT_ID = 0) { |
|
| 64 | + $this->set('PRT_ID', $PRT_ID); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | |
@@ -72,8 +72,8 @@ discard block |
||
| 72 | 72 | * @access public |
| 73 | 73 | * @param float $PRC_amount |
| 74 | 74 | */ |
| 75 | - public function set_amount( $PRC_amount = 0.00 ) { |
|
| 76 | - $this->set( 'PRC_amount', $PRC_amount ); |
|
| 75 | + public function set_amount($PRC_amount = 0.00) { |
|
| 76 | + $this->set('PRC_amount', $PRC_amount); |
|
| 77 | 77 | } |
| 78 | 78 | |
| 79 | 79 | |
@@ -84,8 +84,8 @@ discard block |
||
| 84 | 84 | * @access public |
| 85 | 85 | * @param string $PRC_name |
| 86 | 86 | */ |
| 87 | - public function set_name( $PRC_name = '' ) { |
|
| 88 | - $this->set( 'PRC_name', $PRC_name ); |
|
| 87 | + public function set_name($PRC_name = '') { |
|
| 88 | + $this->set('PRC_name', $PRC_name); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | |
@@ -96,8 +96,8 @@ discard block |
||
| 96 | 96 | * @access public |
| 97 | 97 | * @param string $PRC_desc |
| 98 | 98 | */ |
| 99 | - public function set_description( $PRC_desc = '' ) { |
|
| 100 | - $this->Set( 'PRC_desc', $PRC_desc ); |
|
| 99 | + public function set_description($PRC_desc = '') { |
|
| 100 | + $this->Set('PRC_desc', $PRC_desc); |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | |
@@ -108,8 +108,8 @@ discard block |
||
| 108 | 108 | * @access public |
| 109 | 109 | * @param bool $PRC_is_default |
| 110 | 110 | */ |
| 111 | - public function set_is_default( $PRC_is_default = FALSE ) { |
|
| 112 | - $this->set( 'PRC_is_default', $PRC_is_default ); |
|
| 111 | + public function set_is_default($PRC_is_default = FALSE) { |
|
| 112 | + $this->set('PRC_is_default', $PRC_is_default); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | |
@@ -120,8 +120,8 @@ discard block |
||
| 120 | 120 | * @access public |
| 121 | 121 | * @param bool $PRC_deleted |
| 122 | 122 | */ |
| 123 | - public function set_deleted( $PRC_deleted = NULL ) { |
|
| 124 | - $this->set( 'PRC_deleted', $PRC_deleted ); |
|
| 123 | + public function set_deleted($PRC_deleted = NULL) { |
|
| 124 | + $this->set('PRC_deleted', $PRC_deleted); |
|
| 125 | 125 | } |
| 126 | 126 | |
| 127 | 127 | |
@@ -132,7 +132,7 @@ discard block |
||
| 132 | 132 | * @return int |
| 133 | 133 | */ |
| 134 | 134 | public function type() { |
| 135 | - return $this->get( 'PRT_ID' ); |
|
| 135 | + return $this->get('PRT_ID'); |
|
| 136 | 136 | } |
| 137 | 137 | |
| 138 | 138 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | * @return float |
| 144 | 144 | */ |
| 145 | 145 | public function amount() { |
| 146 | - return $this->get( 'PRC_amount' ); |
|
| 146 | + return $this->get('PRC_amount'); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | |
@@ -154,7 +154,7 @@ discard block |
||
| 154 | 154 | * @return string |
| 155 | 155 | */ |
| 156 | 156 | public function name() { |
| 157 | - return $this->get( 'PRC_name' ); |
|
| 157 | + return $this->get('PRC_name'); |
|
| 158 | 158 | } |
| 159 | 159 | |
| 160 | 160 | |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | * @return string |
| 166 | 166 | */ |
| 167 | 167 | public function desc() { |
| 168 | - return $this->get( 'PRC_desc' ); |
|
| 168 | + return $this->get('PRC_desc'); |
|
| 169 | 169 | } |
| 170 | 170 | |
| 171 | 171 | |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | * @return int |
| 177 | 177 | */ |
| 178 | 178 | public function overrides() { |
| 179 | - return $this->get( 'PRC_overrides' ); |
|
| 179 | + return $this->get('PRC_overrides'); |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | |
@@ -187,7 +187,7 @@ discard block |
||
| 187 | 187 | * @return int |
| 188 | 188 | */ |
| 189 | 189 | public function order() { |
| 190 | - return $this->get( 'PRC_order' ); |
|
| 190 | + return $this->get('PRC_order'); |
|
| 191 | 191 | } |
| 192 | 192 | |
| 193 | 193 | |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | * @return bool |
| 212 | 212 | */ |
| 213 | 213 | public function is_default() { |
| 214 | - return $this->get( 'PRC_is_default' ); |
|
| 214 | + return $this->get('PRC_is_default'); |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | |
@@ -222,7 +222,7 @@ discard block |
||
| 222 | 222 | * @return bool |
| 223 | 223 | */ |
| 224 | 224 | public function deleted() { |
| 225 | - return $this->get( 'PRC_deleted' ); |
|
| 225 | + return $this->get('PRC_deleted'); |
|
| 226 | 226 | } |
| 227 | 227 | |
| 228 | 228 | |
@@ -231,7 +231,7 @@ discard block |
||
| 231 | 231 | * @return bool |
| 232 | 232 | */ |
| 233 | 233 | public function parent() { |
| 234 | - return $this->get( 'PRC_parent' ); |
|
| 234 | + return $this->get('PRC_parent'); |
|
| 235 | 235 | } |
| 236 | 236 | |
| 237 | 237 | |
@@ -253,7 +253,7 @@ discard block |
||
| 253 | 253 | * @return EE_Price_Type |
| 254 | 254 | */ |
| 255 | 255 | public function type_obj() { |
| 256 | - return $this->get_first_related( 'Price_Type' ); |
|
| 256 | + return $this->get_first_related('Price_Type'); |
|
| 257 | 257 | } |
| 258 | 258 | |
| 259 | 259 | |
@@ -275,7 +275,7 @@ discard block |
||
| 275 | 275 | */ |
| 276 | 276 | public function is_percent() { |
| 277 | 277 | $price_type = $this->type_obj(); |
| 278 | - return $price_type->get( 'PRT_is_percent' ); |
|
| 278 | + return $price_type->get('PRT_is_percent'); |
|
| 279 | 279 | } |
| 280 | 280 | |
| 281 | 281 | |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | * @return string |
| 288 | 288 | */ |
| 289 | 289 | public function pretty_price() { |
| 290 | - return ! $this->is_percent() ? $this->get_pretty('PRC_amount') : $this->get('PRC_amount') . '%'; |
|
| 290 | + return ! $this->is_percent() ? $this->get_pretty('PRC_amount') : $this->get('PRC_amount').'%'; |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | |
@@ -296,7 +296,7 @@ discard block |
||
| 296 | 296 | * @return mixed |
| 297 | 297 | */ |
| 298 | 298 | public function get_price_without_currency_symbol() { |
| 299 | - return str_replace( EE_Registry::instance()->CFG->currency->sign, '', $this->get_pretty( 'PRC_amount' ) ); |
|
| 299 | + return str_replace(EE_Registry::instance()->CFG->currency->sign, '', $this->get_pretty('PRC_amount')); |
|
| 300 | 300 | } |
| 301 | 301 | } |
| 302 | 302 | |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
| 2 | - exit( 'No direct script access allowed' ); |
|
| 1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | 3 | } |
| 4 | 4 | /** |
| 5 | 5 | * Event Espresso |
@@ -45,9 +45,9 @@ discard block |
||
| 45 | 45 | * date_format and the second value is the time format |
| 46 | 46 | * @return EE_Attendee |
| 47 | 47 | */ |
| 48 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
| 49 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
| 50 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
| 48 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
| 49 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
| 50 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | |
@@ -58,8 +58,8 @@ discard block |
||
| 58 | 58 | * the website will be used. |
| 59 | 59 | * @return EE_Attendee |
| 60 | 60 | */ |
| 61 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
| 62 | - return new self( $props_n_values, TRUE, $timezone ); |
|
| 61 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
| 62 | + return new self($props_n_values, TRUE, $timezone); |
|
| 63 | 63 | } |
| 64 | 64 | |
| 65 | 65 | |
@@ -69,8 +69,8 @@ discard block |
||
| 69 | 69 | * @param string $value |
| 70 | 70 | * @return bool success |
| 71 | 71 | */ |
| 72 | - public function set_value( $value ) { |
|
| 73 | - $this->set( 'QSO_value', $value ); |
|
| 72 | + public function set_value($value) { |
|
| 73 | + $this->set('QSO_value', $value); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | |
@@ -80,8 +80,8 @@ discard block |
||
| 80 | 80 | * @param string $text |
| 81 | 81 | * @return bool success |
| 82 | 82 | */ |
| 83 | - public function set_desc( $text ) { |
|
| 84 | - $this->set( 'QSO_desc', $text ); |
|
| 83 | + public function set_desc($text) { |
|
| 84 | + $this->set('QSO_desc', $text); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | |
@@ -93,8 +93,8 @@ discard block |
||
| 93 | 93 | * @param integer $order |
| 94 | 94 | * @return bool $success |
| 95 | 95 | */ |
| 96 | - public function set_order( $order ) { |
|
| 97 | - $this->set( 'QSO_order', $order ); |
|
| 96 | + public function set_order($order) { |
|
| 97 | + $this->set('QSO_order', $order); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | |
@@ -104,8 +104,8 @@ discard block |
||
| 104 | 104 | * @param int $question_ID |
| 105 | 105 | * @return bool success |
| 106 | 106 | */ |
| 107 | - public function set_question_ID( $question_ID ) { |
|
| 108 | - $this->set( 'QST_ID', $question_ID ); |
|
| 107 | + public function set_question_ID($question_ID) { |
|
| 108 | + $this->set('QST_ID', $question_ID); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | |
@@ -115,7 +115,7 @@ discard block |
||
| 115 | 115 | * @param string $text |
| 116 | 116 | * @return bool success |
| 117 | 117 | */ |
| 118 | - public function set_opt_group( $text ) { |
|
| 118 | + public function set_opt_group($text) { |
|
| 119 | 119 | return $this->_QSO_opt_group = $text; |
| 120 | 120 | } |
| 121 | 121 | |
@@ -126,7 +126,7 @@ discard block |
||
| 126 | 126 | * @return string |
| 127 | 127 | */ |
| 128 | 128 | public function value() { |
| 129 | - return $this->get( 'QSO_value' ); |
|
| 129 | + return $this->get('QSO_value'); |
|
| 130 | 130 | } |
| 131 | 131 | |
| 132 | 132 | |
@@ -136,7 +136,7 @@ discard block |
||
| 136 | 136 | * @return string |
| 137 | 137 | */ |
| 138 | 138 | public function desc() { |
| 139 | - return $this->get( 'QSO_desc' ); |
|
| 139 | + return $this->get('QSO_desc'); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | * @return boolean |
| 147 | 147 | */ |
| 148 | 148 | public function deleted() { |
| 149 | - return $this->get( 'QSO_deleted' ); |
|
| 149 | + return $this->get('QSO_deleted'); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | |
@@ -158,7 +158,7 @@ discard block |
||
| 158 | 158 | * @return integer |
| 159 | 159 | */ |
| 160 | 160 | public function order() { |
| 161 | - return $this->get( 'QSO_option' ); |
|
| 161 | + return $this->get('QSO_option'); |
|
| 162 | 162 | } |
| 163 | 163 | |
| 164 | 164 | |
@@ -168,7 +168,7 @@ discard block |
||
| 168 | 168 | * @return int |
| 169 | 169 | */ |
| 170 | 170 | public function question_ID() { |
| 171 | - return $this->get( 'QST_ID' ); |
|
| 171 | + return $this->get('QST_ID'); |
|
| 172 | 172 | } |
| 173 | 173 | |
| 174 | 174 | |
@@ -178,7 +178,7 @@ discard block |
||
| 178 | 178 | * @return EE_Question |
| 179 | 179 | */ |
| 180 | 180 | public function question() { |
| 181 | - return $this->get_first_related( 'Question' ); |
|
| 181 | + return $this->get_first_related('Question'); |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | |
@@ -197,11 +197,11 @@ discard block |
||
| 197 | 197 | * @param array $options { |
| 198 | 198 | * @type int $QST_ID the QST_ID attribute of this question option, otherwise it will be for the same question as the original |
| 199 | 199 | */ |
| 200 | - public function duplicate( $options = array() ) { |
|
| 200 | + public function duplicate($options = array()) { |
|
| 201 | 201 | $new_question_option = clone $this; |
| 202 | - $new_question_option->set( 'QSO_ID', null ); |
|
| 203 | - if( array_key_exists( 'QST_ID', $options ) ) {//use array_key_exists instead of isset because NULL might be a valid value |
|
| 204 | - $new_question_option->set_question_ID( $options[ 'QST_ID' ] ); |
|
| 202 | + $new_question_option->set('QSO_ID', null); |
|
| 203 | + if (array_key_exists('QST_ID', $options)) {//use array_key_exists instead of isset because NULL might be a valid value |
|
| 204 | + $new_question_option->set_question_ID($options['QST_ID']); |
|
| 205 | 205 | } |
| 206 | 206 | $new_question_option->save(); |
| 207 | 207 | } |
@@ -219,8 +219,8 @@ discard block |
||
| 219 | 219 | * @param string $QSO_system |
| 220 | 220 | * @return bool |
| 221 | 221 | */ |
| 222 | - public function set_system( $QSO_system ) { |
|
| 223 | - return $this->set( 'QSO_system', $QSO_system ); |
|
| 222 | + public function set_system($QSO_system) { |
|
| 223 | + return $this->set('QSO_system', $QSO_system); |
|
| 224 | 224 | } |
| 225 | 225 | } |
| 226 | 226 | |
@@ -19,9 +19,9 @@ discard block |
||
| 19 | 19 | * @param string $timezone |
| 20 | 20 | * @return EE_Registration_Payment |
| 21 | 21 | */ |
| 22 | - public static function new_instance( $props_n_values = array(), $timezone = '', $date_formats = array() ) { |
|
| 23 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
| 24 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
| 22 | + public static function new_instance($props_n_values = array(), $timezone = '', $date_formats = array()) { |
|
| 23 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
| 24 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
| 25 | 25 | } |
| 26 | 26 | |
| 27 | 27 | |
@@ -31,8 +31,8 @@ discard block |
||
| 31 | 31 | * @param string $timezone |
| 32 | 32 | * @return EE_Registration_Payment |
| 33 | 33 | */ |
| 34 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = '' ) { |
|
| 35 | - return new self( $props_n_values, true, $timezone ); |
|
| 34 | + public static function new_instance_from_db($props_n_values = array(), $timezone = '') { |
|
| 35 | + return new self($props_n_values, true, $timezone); |
|
| 36 | 36 | } |
| 37 | 37 | |
| 38 | 38 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * @return int |
| 44 | 44 | */ |
| 45 | 45 | public function registration_ID() { |
| 46 | - return $this->get( 'REG_ID' ); |
|
| 46 | + return $this->get('REG_ID'); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | |
@@ -54,7 +54,7 @@ discard block |
||
| 54 | 54 | * @return int |
| 55 | 55 | */ |
| 56 | 56 | public function payment_ID() { |
| 57 | - return $this->get( 'PAY_ID' ); |
|
| 57 | + return $this->get('PAY_ID'); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * @return float |
| 66 | 66 | */ |
| 67 | 67 | public function amount() { |
| 68 | - return $this->get( 'RPY_amount' ); |
|
| 68 | + return $this->get('RPY_amount'); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | |
@@ -75,8 +75,8 @@ discard block |
||
| 75 | 75 | * @access public |
| 76 | 76 | * @param float $amount |
| 77 | 77 | */ |
| 78 | - public function set_amount( $amount = 0.000 ) { |
|
| 79 | - $this->set( 'RPY_amount', $amount ); |
|
| 78 | + public function set_amount($amount = 0.000) { |
|
| 79 | + $this->set('RPY_amount', $amount); |
|
| 80 | 80 | } |
| 81 | 81 | |
| 82 | 82 | |
@@ -87,7 +87,7 @@ discard block |
||
| 87 | 87 | * @return \EE_Registration |
| 88 | 88 | */ |
| 89 | 89 | public function registration() { |
| 90 | - return $this->get_first_related( 'Registration' ); |
|
| 90 | + return $this->get_first_related('Registration'); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | |
@@ -98,7 +98,7 @@ discard block |
||
| 98 | 98 | * @return \EE_Payment |
| 99 | 99 | */ |
| 100 | 100 | public function payment() { |
| 101 | - return $this->get_first_related( 'Payment' ); |
|
| 101 | + return $this->get_first_related('Payment'); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | -<?php if ( !defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
| 2 | - exit( 'No direct script access allowed' ); |
|
| 1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | 3 | } |
| 4 | 4 | /** |
| 5 | 5 | * Event Espresso |
@@ -66,9 +66,9 @@ discard block |
||
| 66 | 66 | * date_format and the second value is the time format |
| 67 | 67 | * @return EE_Ticket |
| 68 | 68 | */ |
| 69 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
| 70 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
| 71 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
| 69 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
| 70 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
| 71 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | |
@@ -79,8 +79,8 @@ discard block |
||
| 79 | 79 | * the website will be used. |
| 80 | 80 | * @return EE_Ticket |
| 81 | 81 | */ |
| 82 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
| 83 | - return new self( $props_n_values, TRUE, $timezone ); |
|
| 82 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
| 83 | + return new self($props_n_values, TRUE, $timezone); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | * @return bool |
| 90 | 90 | */ |
| 91 | 91 | public function parent() { |
| 92 | - return $this->get( 'TKT_parent' ); |
|
| 92 | + return $this->get('TKT_parent'); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | |
@@ -99,13 +99,13 @@ discard block |
||
| 99 | 99 | * @param int $DTT_ID the primary key for a particular datetime |
| 100 | 100 | * @return boolean |
| 101 | 101 | */ |
| 102 | - public function available( $DTT_ID = 0 ) { |
|
| 102 | + public function available($DTT_ID = 0) { |
|
| 103 | 103 | // are we checking availability for a particular datetime ? |
| 104 | - if ( $DTT_ID ) { |
|
| 104 | + if ($DTT_ID) { |
|
| 105 | 105 | // get that datetime object |
| 106 | - $datetime = $this->get_first_related( 'Datetime', array( array( 'DTT_ID' => $DTT_ID ) ) ); |
|
| 106 | + $datetime = $this->get_first_related('Datetime', array(array('DTT_ID' => $DTT_ID))); |
|
| 107 | 107 | // if ticket sales for this datetime have exceeded the reg limit... |
| 108 | - if ( $datetime instanceof EE_Datetime && $datetime->sold_out() ) { |
|
| 108 | + if ($datetime instanceof EE_Datetime && $datetime->sold_out()) { |
|
| 109 | 109 | return FALSE; |
| 110 | 110 | } |
| 111 | 111 | } |
@@ -120,21 +120,21 @@ discard block |
||
| 120 | 120 | * @param bool $display true = we'll return a localized string, otherwise we just return the value of the relevant status const |
| 121 | 121 | * @return mixed(int|string) status int if the display string isn't requested |
| 122 | 122 | */ |
| 123 | - public function ticket_status( $display = FALSE ) { |
|
| 124 | - if ( ! $this->is_remaining() ) { |
|
| 125 | - return $display ? EEH_Template::pretty_status( EE_Ticket::sold_out, FALSE, 'sentence' ) : EE_Ticket::sold_out; |
|
| 123 | + public function ticket_status($display = FALSE) { |
|
| 124 | + if ( ! $this->is_remaining()) { |
|
| 125 | + return $display ? EEH_Template::pretty_status(EE_Ticket::sold_out, FALSE, 'sentence') : EE_Ticket::sold_out; |
|
| 126 | 126 | } |
| 127 | - if ( $this->get( 'TKT_deleted' ) ) { |
|
| 128 | - return $display ? EEH_Template::pretty_status( EE_Ticket::archived, FALSE, 'sentence' ) : EE_Ticket::archived; |
|
| 127 | + if ($this->get('TKT_deleted')) { |
|
| 128 | + return $display ? EEH_Template::pretty_status(EE_Ticket::archived, FALSE, 'sentence') : EE_Ticket::archived; |
|
| 129 | 129 | } |
| 130 | - if ( $this->is_expired() ) { |
|
| 131 | - return $display ? EEH_Template::pretty_status( EE_Ticket::expired, FALSE, 'sentence' ) : EE_Ticket::expired; |
|
| 130 | + if ($this->is_expired()) { |
|
| 131 | + return $display ? EEH_Template::pretty_status(EE_Ticket::expired, FALSE, 'sentence') : EE_Ticket::expired; |
|
| 132 | 132 | } |
| 133 | - if ( $this->is_pending() ) { |
|
| 134 | - return $display ? EEH_Template::pretty_status( EE_Ticket::pending, FALSE, 'sentence' ) : EE_Ticket::pending; |
|
| 133 | + if ($this->is_pending()) { |
|
| 134 | + return $display ? EEH_Template::pretty_status(EE_Ticket::pending, FALSE, 'sentence') : EE_Ticket::pending; |
|
| 135 | 135 | } |
| 136 | - if ( $this->is_on_sale() ) { |
|
| 137 | - return $display ? EEH_Template::pretty_status( EE_Ticket::onsale, FALSE, 'sentence' ) : EE_Ticket::onsale; |
|
| 136 | + if ($this->is_on_sale()) { |
|
| 137 | + return $display ? EEH_Template::pretty_status(EE_Ticket::onsale, FALSE, 'sentence') : EE_Ticket::onsale; |
|
| 138 | 138 | } |
| 139 | 139 | return ''; |
| 140 | 140 | } |
@@ -148,12 +148,12 @@ discard block |
||
| 148 | 148 | * @param int $DTT_ID if an int above 0 is included here then we get a specific dtt. |
| 149 | 149 | * @return boolean true = tickets remaining, false not. |
| 150 | 150 | */ |
| 151 | - public function is_remaining( $DTT_ID = 0 ) { |
|
| 152 | - $num_remaining = $this->remaining( $DTT_ID ); |
|
| 153 | - if ( $num_remaining === 0 ) { |
|
| 151 | + public function is_remaining($DTT_ID = 0) { |
|
| 152 | + $num_remaining = $this->remaining($DTT_ID); |
|
| 153 | + if ($num_remaining === 0) { |
|
| 154 | 154 | return FALSE; |
| 155 | 155 | } |
| 156 | - if ( $num_remaining > 0 && $num_remaining < $this->min() ) { |
|
| 156 | + if ($num_remaining > 0 && $num_remaining < $this->min()) { |
|
| 157 | 157 | return FALSE; |
| 158 | 158 | } |
| 159 | 159 | return TRUE; |
@@ -167,25 +167,25 @@ discard block |
||
| 167 | 167 | * all related datetimes |
| 168 | 168 | * @return int |
| 169 | 169 | */ |
| 170 | - public function remaining( $DTT_ID = 0 ) { |
|
| 170 | + public function remaining($DTT_ID = 0) { |
|
| 171 | 171 | // are we checking availability for a particular datetime ? |
| 172 | - if ( $DTT_ID ) { |
|
| 172 | + if ($DTT_ID) { |
|
| 173 | 173 | // get array with the one requested datetime |
| 174 | - $datetimes = $this->get_many_related( 'Datetime', array( array( 'DTT_ID' => $DTT_ID ) ) ); |
|
| 174 | + $datetimes = $this->get_many_related('Datetime', array(array('DTT_ID' => $DTT_ID))); |
|
| 175 | 175 | } else { |
| 176 | 176 | // we need to check availability of ALL datetimes |
| 177 | - $datetimes = $this->get_many_related( 'Datetime', array( 'order_by' => array( 'DTT_EVT_start' => 'ASC' ) ) ); |
|
| 177 | + $datetimes = $this->get_many_related('Datetime', array('order_by' => array('DTT_EVT_start' => 'ASC'))); |
|
| 178 | 178 | } |
| 179 | 179 | // d( $datetimes ); |
| 180 | 180 | // if datetime reg limit is not unlimited |
| 181 | - if ( ! empty( $datetimes ) ) { |
|
| 181 | + if ( ! empty($datetimes)) { |
|
| 182 | 182 | // although TKT_qty and $datetime->spaces_remaining() could both be EE_INF |
| 183 | 183 | // we only need to check for EE_INF explicitly if we want to optimize. |
| 184 | 184 | // because EE_INF - x = EE_INF; and min(x,EE_INF) = x; |
| 185 | 185 | $tickets_remaining = $this->qty() - $this->sold(); |
| 186 | - foreach ( $datetimes as $datetime ) { |
|
| 187 | - if ( $datetime instanceof EE_Datetime ) { |
|
| 188 | - $tickets_remaining = min( $tickets_remaining, $datetime->spaces_remaining() ); |
|
| 186 | + foreach ($datetimes as $datetime) { |
|
| 187 | + if ($datetime instanceof EE_Datetime) { |
|
| 188 | + $tickets_remaining = min($tickets_remaining, $datetime->spaces_remaining()); |
|
| 189 | 189 | } |
| 190 | 190 | } |
| 191 | 191 | return $tickets_remaining; |
@@ -200,7 +200,7 @@ discard block |
||
| 200 | 200 | * @return int |
| 201 | 201 | */ |
| 202 | 202 | function min() { |
| 203 | - return $this->get( 'TKT_min' ); |
|
| 203 | + return $this->get('TKT_min'); |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | 206 | |
@@ -210,7 +210,7 @@ discard block |
||
| 210 | 210 | * @return boolean |
| 211 | 211 | */ |
| 212 | 212 | public function is_expired() { |
| 213 | - return ( $this->get_raw( 'TKT_end_date' ) < time() ); |
|
| 213 | + return ($this->get_raw('TKT_end_date') < time()); |
|
| 214 | 214 | } |
| 215 | 215 | |
| 216 | 216 | |
@@ -220,7 +220,7 @@ discard block |
||
| 220 | 220 | * @return boolean |
| 221 | 221 | */ |
| 222 | 222 | public function is_pending() { |
| 223 | - return ( $this->get_raw( 'TKT_start_date' ) > time() ); |
|
| 223 | + return ($this->get_raw('TKT_start_date') > time()); |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | |
@@ -230,7 +230,7 @@ discard block |
||
| 230 | 230 | * @return boolean |
| 231 | 231 | */ |
| 232 | 232 | public function is_on_sale() { |
| 233 | - return ( $this->get_raw( 'TKT_start_date' ) < time() && $this->get_raw( 'TKT_end_date' ) > time() ); |
|
| 233 | + return ($this->get_raw('TKT_start_date') < time() && $this->get_raw('TKT_end_date') > time()); |
|
| 234 | 234 | } |
| 235 | 235 | |
| 236 | 236 | |
@@ -241,11 +241,11 @@ discard block |
||
| 241 | 241 | * @param string $conjunction - conjunction junction what's your function ? this string joins the start date with the end date ie: Jan 01 "to" Dec 31 |
| 242 | 242 | * @return array |
| 243 | 243 | */ |
| 244 | - public function date_range( $dt_frmt = '', $conjunction = ' - ' ) { |
|
| 245 | - $first_date = $this->first_datetime() instanceof EE_Datetime ? $this->first_datetime()->start_date( $dt_frmt ) : ''; |
|
| 246 | - $last_date = $this->last_datetime() instanceof EE_Datetime ? $this->last_datetime()->end_date( $dt_frmt ) : ''; |
|
| 244 | + public function date_range($dt_frmt = '', $conjunction = ' - ') { |
|
| 245 | + $first_date = $this->first_datetime() instanceof EE_Datetime ? $this->first_datetime()->start_date($dt_frmt) : ''; |
|
| 246 | + $last_date = $this->last_datetime() instanceof EE_Datetime ? $this->last_datetime()->end_date($dt_frmt) : ''; |
|
| 247 | 247 | |
| 248 | - return $first_date && $last_date ? $first_date . $conjunction . $last_date : ''; |
|
| 248 | + return $first_date && $last_date ? $first_date.$conjunction.$last_date : ''; |
|
| 249 | 249 | } |
| 250 | 250 | |
| 251 | 251 | |
@@ -255,8 +255,8 @@ discard block |
||
| 255 | 255 | * @return EE_Datetime |
| 256 | 256 | */ |
| 257 | 257 | public function first_datetime() { |
| 258 | - $datetimes = $this->datetimes( array( 'limit' => 1 ) ); |
|
| 259 | - return reset( $datetimes ); |
|
| 258 | + $datetimes = $this->datetimes(array('limit' => 1)); |
|
| 259 | + return reset($datetimes); |
|
| 260 | 260 | } |
| 261 | 261 | |
| 262 | 262 | |
@@ -267,11 +267,11 @@ discard block |
||
| 267 | 267 | * @param array $query_params see EEM_Base::get_all() |
| 268 | 268 | * @return EE_Datetime[] |
| 269 | 269 | */ |
| 270 | - public function datetimes( $query_params = array() ) { |
|
| 271 | - if ( ! isset( $query_params[ 'order_by' ] ) ) { |
|
| 272 | - $query_params[ 'order_by' ][ 'DTT_order' ] = 'ASC'; |
|
| 270 | + public function datetimes($query_params = array()) { |
|
| 271 | + if ( ! isset($query_params['order_by'])) { |
|
| 272 | + $query_params['order_by']['DTT_order'] = 'ASC'; |
|
| 273 | 273 | } |
| 274 | - return $this->get_many_related( 'Datetime', $query_params ); |
|
| 274 | + return $this->get_many_related('Datetime', $query_params); |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | |
@@ -281,8 +281,8 @@ discard block |
||
| 281 | 281 | * @return EE_Datetime |
| 282 | 282 | */ |
| 283 | 283 | public function last_datetime() { |
| 284 | - $datetimes = $this->datetimes( array( 'limit' => 1, 'order_by' => array( 'DTT_EVT_start' => 'DESC' ) ) ); |
|
| 285 | - return end( $datetimes ); |
|
| 284 | + $datetimes = $this->datetimes(array('limit' => 1, 'order_by' => array('DTT_EVT_start' => 'DESC'))); |
|
| 285 | + return end($datetimes); |
|
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | |
@@ -296,22 +296,22 @@ discard block |
||
| 296 | 296 | * @param int $dtt_id [optional] include the dtt_id with $what = 'datetime'. |
| 297 | 297 | * @return mixed (array|int) how many tickets have sold |
| 298 | 298 | */ |
| 299 | - public function tickets_sold( $what = 'ticket', $dtt_id = NULL ) { |
|
| 299 | + public function tickets_sold($what = 'ticket', $dtt_id = NULL) { |
|
| 300 | 300 | $total = 0; |
| 301 | 301 | $tickets_sold = $this->_all_tickets_sold(); |
| 302 | - switch ( $what ) { |
|
| 302 | + switch ($what) { |
|
| 303 | 303 | case 'ticket' : |
| 304 | - return $tickets_sold[ 'ticket' ]; |
|
| 304 | + return $tickets_sold['ticket']; |
|
| 305 | 305 | break; |
| 306 | 306 | case 'datetime' : |
| 307 | - if ( empty( $tickets_sold[ 'datetime' ] ) ) { |
|
| 307 | + if (empty($tickets_sold['datetime'])) { |
|
| 308 | 308 | return $total; |
| 309 | 309 | } |
| 310 | - if ( ! empty( $dtt_id ) && ! isset( $tickets_sold[ 'datetime' ][ $dtt_id ] ) ) { |
|
| 311 | - EE_Error::add_error( __( "You've requested the amount of tickets sold for a given ticket and datetime, however there are no records for the datetime id you included. Are you SURE that is a datetime related to this ticket?", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 310 | + if ( ! empty($dtt_id) && ! isset($tickets_sold['datetime'][$dtt_id])) { |
|
| 311 | + EE_Error::add_error(__("You've requested the amount of tickets sold for a given ticket and datetime, however there are no records for the datetime id you included. Are you SURE that is a datetime related to this ticket?", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
|
| 312 | 312 | return $total; |
| 313 | 313 | } |
| 314 | - return empty( $dtt_id ) ? $tickets_sold[ 'datetime' ] : $tickets_sold[ 'datetime' ][ $dtt_id ]; |
|
| 314 | + return empty($dtt_id) ? $tickets_sold['datetime'] : $tickets_sold['datetime'][$dtt_id]; |
|
| 315 | 315 | break; |
| 316 | 316 | default: |
| 317 | 317 | return $total; |
@@ -325,15 +325,15 @@ discard block |
||
| 325 | 325 | * @return EE_Ticket[] |
| 326 | 326 | */ |
| 327 | 327 | protected function _all_tickets_sold() { |
| 328 | - $datetimes = $this->get_many_related( 'Datetime' ); |
|
| 328 | + $datetimes = $this->get_many_related('Datetime'); |
|
| 329 | 329 | $tickets_sold = array(); |
| 330 | - if ( ! empty( $datetimes ) ) { |
|
| 331 | - foreach ( $datetimes as $datetime ) { |
|
| 332 | - $tickets_sold[ 'datetime' ][ $datetime->ID() ] = $datetime->get( 'DTT_sold' ); |
|
| 330 | + if ( ! empty($datetimes)) { |
|
| 331 | + foreach ($datetimes as $datetime) { |
|
| 332 | + $tickets_sold['datetime'][$datetime->ID()] = $datetime->get('DTT_sold'); |
|
| 333 | 333 | } |
| 334 | 334 | } |
| 335 | 335 | //Tickets sold |
| 336 | - $tickets_sold[ 'ticket' ] = $this->sold(); |
|
| 336 | + $tickets_sold['ticket'] = $this->sold(); |
|
| 337 | 337 | return $tickets_sold; |
| 338 | 338 | } |
| 339 | 339 | |
@@ -346,9 +346,9 @@ discard block |
||
| 346 | 346 | * @param bool $return_array whether to return as an array indexed by price id or just the object. |
| 347 | 347 | * @return EE_Price |
| 348 | 348 | */ |
| 349 | - public function base_price( $return_array = FALSE ) { |
|
| 350 | - $_where = array( 'Price_Type.PBT_ID' => EEM_Price_Type::base_type_base_price ); |
|
| 351 | - return $return_array ? $this->get_many_related( 'Price', array( $_where ) ) : $this->get_first_related( 'Price', array( $_where ) ); |
|
| 349 | + public function base_price($return_array = FALSE) { |
|
| 350 | + $_where = array('Price_Type.PBT_ID' => EEM_Price_Type::base_type_base_price); |
|
| 351 | + return $return_array ? $this->get_many_related('Price', array($_where)) : $this->get_first_related('Price', array($_where)); |
|
| 352 | 352 | } |
| 353 | 353 | |
| 354 | 354 | |
@@ -360,8 +360,8 @@ discard block |
||
| 360 | 360 | * @return EE_Price[] |
| 361 | 361 | */ |
| 362 | 362 | public function price_modifiers() { |
| 363 | - $query_params = array( 0 => array( 'Price_Type.PBT_ID' => array( 'NOT IN', array( EEM_Price_Type::base_type_base_price, EEM_Price_Type::base_type_tax ) ) ) ); |
|
| 364 | - return $this->prices( $query_params ); |
|
| 363 | + $query_params = array(0 => array('Price_Type.PBT_ID' => array('NOT IN', array(EEM_Price_Type::base_type_base_price, EEM_Price_Type::base_type_tax)))); |
|
| 364 | + return $this->prices($query_params); |
|
| 365 | 365 | } |
| 366 | 366 | |
| 367 | 367 | |
@@ -371,8 +371,8 @@ discard block |
||
| 371 | 371 | * @param array $query_params like EEM_Base::get_all |
| 372 | 372 | * @return EE_Price[] |
| 373 | 373 | */ |
| 374 | - public function prices( $query_params = array() ) { |
|
| 375 | - return $this->get_many_related( 'Price', $query_params ); |
|
| 374 | + public function prices($query_params = array()) { |
|
| 375 | + return $this->get_many_related('Price', $query_params); |
|
| 376 | 376 | } |
| 377 | 377 | |
| 378 | 378 | |
@@ -382,8 +382,8 @@ discard block |
||
| 382 | 382 | * @param array $query_params see EEM_Base::get_all() |
| 383 | 383 | * @return EE_Datetime_Ticket |
| 384 | 384 | */ |
| 385 | - public function datetime_tickets( $query_params = array() ) { |
|
| 386 | - return $this->get_many_related( 'Datetime_Ticket', $query_params ); |
|
| 385 | + public function datetime_tickets($query_params = array()) { |
|
| 386 | + return $this->get_many_related('Datetime_Ticket', $query_params); |
|
| 387 | 387 | } |
| 388 | 388 | |
| 389 | 389 | |
@@ -394,8 +394,8 @@ discard block |
||
| 394 | 394 | * @param boolean $show_deleted |
| 395 | 395 | * @return EE_Datetime[] |
| 396 | 396 | */ |
| 397 | - public function datetimes_ordered( $show_expired = TRUE, $show_deleted = FALSE ) { |
|
| 398 | - return EEM_Datetime::instance( $this->_timezone )->get_datetimes_for_ticket_ordered_by_DTT_order( $this->ID(), $show_expired, $show_deleted ); |
|
| 397 | + public function datetimes_ordered($show_expired = TRUE, $show_deleted = FALSE) { |
|
| 398 | + return EEM_Datetime::instance($this->_timezone)->get_datetimes_for_ticket_ordered_by_DTT_order($this->ID(), $show_expired, $show_deleted); |
|
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | |
@@ -405,7 +405,7 @@ discard block |
||
| 405 | 405 | * @return string |
| 406 | 406 | */ |
| 407 | 407 | function ID() { |
| 408 | - return $this->get( 'TKT_ID' ); |
|
| 408 | + return $this->get('TKT_ID'); |
|
| 409 | 409 | } |
| 410 | 410 | |
| 411 | 411 | |
@@ -429,7 +429,7 @@ discard block |
||
| 429 | 429 | * @return EE_Ticket_Template |
| 430 | 430 | */ |
| 431 | 431 | public function template() { |
| 432 | - return $this->get_first_related( 'Ticket_Template' ); |
|
| 432 | + return $this->get_first_related('Ticket_Template'); |
|
| 433 | 433 | } |
| 434 | 434 | |
| 435 | 435 | |
@@ -448,7 +448,7 @@ discard block |
||
| 448 | 448 | * @return bool |
| 449 | 449 | */ |
| 450 | 450 | public function ticket_price() { |
| 451 | - return $this->get( 'TKT_price' ); |
|
| 451 | + return $this->get('TKT_price'); |
|
| 452 | 452 | } |
| 453 | 453 | |
| 454 | 454 | |
@@ -457,7 +457,7 @@ discard block |
||
| 457 | 457 | * @return mixed |
| 458 | 458 | */ |
| 459 | 459 | public function pretty_price() { |
| 460 | - return $this->get_pretty( 'TKT_price' ); |
|
| 460 | + return $this->get_pretty('TKT_price'); |
|
| 461 | 461 | } |
| 462 | 462 | |
| 463 | 463 | |
@@ -476,17 +476,17 @@ discard block |
||
| 476 | 476 | * @param bool $no_cache |
| 477 | 477 | * @return float |
| 478 | 478 | */ |
| 479 | - public function get_ticket_total_with_taxes( $no_cache = FALSE ) { |
|
| 480 | - if ( ! isset( $this->_ticket_total_with_taxes ) || $no_cache ) { |
|
| 479 | + public function get_ticket_total_with_taxes($no_cache = FALSE) { |
|
| 480 | + if ( ! isset($this->_ticket_total_with_taxes) || $no_cache) { |
|
| 481 | 481 | $this->_ticket_total_with_taxes = $this->get_ticket_subtotal() + $this->get_ticket_taxes_total_for_admin(); |
| 482 | 482 | } |
| 483 | - return (float)$this->_ticket_total_with_taxes; |
|
| 483 | + return (float) $this->_ticket_total_with_taxes; |
|
| 484 | 484 | } |
| 485 | 485 | |
| 486 | 486 | |
| 487 | 487 | |
| 488 | 488 | public function ensure_TKT_Price_correct() { |
| 489 | - $this->set( 'TKT_price', EE_Taxes::get_subtotal_for_admin( $this ) ); |
|
| 489 | + $this->set('TKT_price', EE_Taxes::get_subtotal_for_admin($this)); |
|
| 490 | 490 | $this->save(); |
| 491 | 491 | } |
| 492 | 492 | |
@@ -496,7 +496,7 @@ discard block |
||
| 496 | 496 | * @return float |
| 497 | 497 | */ |
| 498 | 498 | public function get_ticket_subtotal() { |
| 499 | - return EE_Taxes::get_subtotal_for_admin( $this ); |
|
| 499 | + return EE_Taxes::get_subtotal_for_admin($this); |
|
| 500 | 500 | } |
| 501 | 501 | |
| 502 | 502 | |
@@ -506,7 +506,7 @@ discard block |
||
| 506 | 506 | * @return float |
| 507 | 507 | */ |
| 508 | 508 | public function get_ticket_taxes_total_for_admin() { |
| 509 | - return EE_Taxes::get_total_taxes_for_admin( $this ); |
|
| 509 | + return EE_Taxes::get_total_taxes_for_admin($this); |
|
| 510 | 510 | } |
| 511 | 511 | |
| 512 | 512 | |
@@ -516,8 +516,8 @@ discard block |
||
| 516 | 516 | * @param string $name |
| 517 | 517 | * @return boolean |
| 518 | 518 | */ |
| 519 | - function set_name( $name ) { |
|
| 520 | - $this->set( 'TKT_name', $name ); |
|
| 519 | + function set_name($name) { |
|
| 520 | + $this->set('TKT_name', $name); |
|
| 521 | 521 | } |
| 522 | 522 | |
| 523 | 523 | |
@@ -527,7 +527,7 @@ discard block |
||
| 527 | 527 | * @return string |
| 528 | 528 | */ |
| 529 | 529 | function description() { |
| 530 | - return $this->get( 'TKT_description' ); |
|
| 530 | + return $this->get('TKT_description'); |
|
| 531 | 531 | } |
| 532 | 532 | |
| 533 | 533 | |
@@ -537,8 +537,8 @@ discard block |
||
| 537 | 537 | * @param string $description |
| 538 | 538 | * @return boolean |
| 539 | 539 | */ |
| 540 | - function set_description( $description ) { |
|
| 541 | - $this->set( 'TKT_description', $description ); |
|
| 540 | + function set_description($description) { |
|
| 541 | + $this->set('TKT_description', $description); |
|
| 542 | 542 | } |
| 543 | 543 | |
| 544 | 544 | |
@@ -549,8 +549,8 @@ discard block |
||
| 549 | 549 | * @param string $tm_frmt |
| 550 | 550 | * @return string |
| 551 | 551 | */ |
| 552 | - function start_date( $dt_frmt = '', $tm_frmt = '' ) { |
|
| 553 | - return $this->_get_datetime( 'TKT_start_date', $dt_frmt, $tm_frmt ); |
|
| 552 | + function start_date($dt_frmt = '', $tm_frmt = '') { |
|
| 553 | + return $this->_get_datetime('TKT_start_date', $dt_frmt, $tm_frmt); |
|
| 554 | 554 | } |
| 555 | 555 | |
| 556 | 556 | |
@@ -560,8 +560,8 @@ discard block |
||
| 560 | 560 | * @param string $start_date |
| 561 | 561 | * @return void |
| 562 | 562 | */ |
| 563 | - function set_start_date( $start_date ) { |
|
| 564 | - $this->_set_date_time( 'B', $start_date, 'TKT_start_date' ); |
|
| 563 | + function set_start_date($start_date) { |
|
| 564 | + $this->_set_date_time('B', $start_date, 'TKT_start_date'); |
|
| 565 | 565 | } |
| 566 | 566 | |
| 567 | 567 | |
@@ -572,8 +572,8 @@ discard block |
||
| 572 | 572 | * @param string $tm_frmt |
| 573 | 573 | * @return string |
| 574 | 574 | */ |
| 575 | - function end_date( $dt_frmt = '', $tm_frmt = '' ) { |
|
| 576 | - return $this->_get_datetime( 'TKT_end_date', $dt_frmt, $tm_frmt ); |
|
| 575 | + function end_date($dt_frmt = '', $tm_frmt = '') { |
|
| 576 | + return $this->_get_datetime('TKT_end_date', $dt_frmt, $tm_frmt); |
|
| 577 | 577 | } |
| 578 | 578 | |
| 579 | 579 | |
@@ -583,8 +583,8 @@ discard block |
||
| 583 | 583 | * @param string $end_date |
| 584 | 584 | * @return void |
| 585 | 585 | */ |
| 586 | - function set_end_date( $end_date ) { |
|
| 587 | - $this->_set_date_time( 'B', $end_date, 'TKT_end_date' ); |
|
| 586 | + function set_end_date($end_date) { |
|
| 587 | + $this->_set_date_time('B', $end_date, 'TKT_end_date'); |
|
| 588 | 588 | } |
| 589 | 589 | |
| 590 | 590 | |
@@ -596,8 +596,8 @@ discard block |
||
| 596 | 596 | * |
| 597 | 597 | * @param string $time a string representation of the sell until time (ex 9am or 7:30pm) |
| 598 | 598 | */ |
| 599 | - function set_end_time( $time ) { |
|
| 600 | - $this->_set_time_for( $time, 'TKT_end_date' ); |
|
| 599 | + function set_end_time($time) { |
|
| 600 | + $this->_set_time_for($time, 'TKT_end_date'); |
|
| 601 | 601 | } |
| 602 | 602 | |
| 603 | 603 | |
@@ -607,8 +607,8 @@ discard block |
||
| 607 | 607 | * @param int $min |
| 608 | 608 | * @return boolean |
| 609 | 609 | */ |
| 610 | - function set_min( $min ) { |
|
| 611 | - $this->set( 'TKT_min', $min ); |
|
| 610 | + function set_min($min) { |
|
| 611 | + $this->set('TKT_min', $min); |
|
| 612 | 612 | } |
| 613 | 613 | |
| 614 | 614 | |
@@ -618,7 +618,7 @@ discard block |
||
| 618 | 618 | * @return int |
| 619 | 619 | */ |
| 620 | 620 | function max() { |
| 621 | - return $this->get( 'TKT_max' ); |
|
| 621 | + return $this->get('TKT_max'); |
|
| 622 | 622 | } |
| 623 | 623 | |
| 624 | 624 | |
@@ -628,8 +628,8 @@ discard block |
||
| 628 | 628 | * @param int $max |
| 629 | 629 | * @return boolean |
| 630 | 630 | */ |
| 631 | - function set_max( $max ) { |
|
| 632 | - $this->set( 'TKT_max', $max ); |
|
| 631 | + function set_max($max) { |
|
| 632 | + $this->set('TKT_max', $max); |
|
| 633 | 633 | } |
| 634 | 634 | |
| 635 | 635 | |
@@ -639,8 +639,8 @@ discard block |
||
| 639 | 639 | * @param float $price |
| 640 | 640 | * @return boolean |
| 641 | 641 | */ |
| 642 | - function set_price( $price ) { |
|
| 643 | - $this->set( 'TKT_price', $price ); |
|
| 642 | + function set_price($price) { |
|
| 643 | + $this->set('TKT_price', $price); |
|
| 644 | 644 | } |
| 645 | 645 | |
| 646 | 646 | |
@@ -650,7 +650,7 @@ discard block |
||
| 650 | 650 | * @return int |
| 651 | 651 | */ |
| 652 | 652 | function sold() { |
| 653 | - return $this->get_raw( 'TKT_sold' ); |
|
| 653 | + return $this->get_raw('TKT_sold'); |
|
| 654 | 654 | } |
| 655 | 655 | |
| 656 | 656 | |
@@ -660,10 +660,10 @@ discard block |
||
| 660 | 660 | * @param int $qty |
| 661 | 661 | * @return boolean |
| 662 | 662 | */ |
| 663 | - function increase_sold( $qty = 1 ) { |
|
| 663 | + function increase_sold($qty = 1) { |
|
| 664 | 664 | $sold = $this->sold() + $qty; |
| 665 | - $this->_increase_sold_for_datetimes( $qty ); |
|
| 666 | - return $this->set_sold( $sold ); |
|
| 665 | + $this->_increase_sold_for_datetimes($qty); |
|
| 666 | + return $this->set_sold($sold); |
|
| 667 | 667 | } |
| 668 | 668 | |
| 669 | 669 | |
@@ -673,12 +673,12 @@ discard block |
||
| 673 | 673 | * @param int $qty |
| 674 | 674 | * @return boolean |
| 675 | 675 | */ |
| 676 | - protected function _increase_sold_for_datetimes( $qty = 1 ) { |
|
| 676 | + protected function _increase_sold_for_datetimes($qty = 1) { |
|
| 677 | 677 | $datetimes = $this->datetimes(); |
| 678 | - if ( is_array( $datetimes ) ) { |
|
| 679 | - foreach ( $datetimes as $datetime ) { |
|
| 680 | - if ( $datetime instanceof EE_Datetime ) { |
|
| 681 | - $datetime->increase_sold( $qty ); |
|
| 678 | + if (is_array($datetimes)) { |
|
| 679 | + foreach ($datetimes as $datetime) { |
|
| 680 | + if ($datetime instanceof EE_Datetime) { |
|
| 681 | + $datetime->increase_sold($qty); |
|
| 682 | 682 | $datetime->save(); |
| 683 | 683 | } |
| 684 | 684 | } |
@@ -692,10 +692,10 @@ discard block |
||
| 692 | 692 | * @param int $sold |
| 693 | 693 | * @return boolean |
| 694 | 694 | */ |
| 695 | - function set_sold( $sold ) { |
|
| 695 | + function set_sold($sold) { |
|
| 696 | 696 | // sold can not go below zero |
| 697 | - $sold = max( 0, $sold ); |
|
| 698 | - $this->set( 'TKT_sold', $sold ); |
|
| 697 | + $sold = max(0, $sold); |
|
| 698 | + $this->set('TKT_sold', $sold); |
|
| 699 | 699 | } |
| 700 | 700 | |
| 701 | 701 | |
@@ -705,10 +705,10 @@ discard block |
||
| 705 | 705 | * @param int $qty |
| 706 | 706 | * @return boolean |
| 707 | 707 | */ |
| 708 | - function decrease_sold( $qty = 1 ) { |
|
| 708 | + function decrease_sold($qty = 1) { |
|
| 709 | 709 | $sold = $this->sold() - $qty; |
| 710 | - $this->_decrease_sold_for_datetimes( $qty ); |
|
| 711 | - return $this->set_sold( $sold ); |
|
| 710 | + $this->_decrease_sold_for_datetimes($qty); |
|
| 711 | + return $this->set_sold($sold); |
|
| 712 | 712 | } |
| 713 | 713 | |
| 714 | 714 | |
@@ -719,12 +719,12 @@ discard block |
||
| 719 | 719 | * @param int $qty |
| 720 | 720 | * @return boolean |
| 721 | 721 | */ |
| 722 | - protected function _decrease_sold_for_datetimes( $qty = 1 ) { |
|
| 722 | + protected function _decrease_sold_for_datetimes($qty = 1) { |
|
| 723 | 723 | $datetimes = $this->datetimes(); |
| 724 | - if ( is_array( $datetimes ) ) { |
|
| 725 | - foreach ( $datetimes as $datetime ) { |
|
| 726 | - if ( $datetime instanceof EE_Datetime ) { |
|
| 727 | - $datetime->decrease_sold( $qty ); |
|
| 724 | + if (is_array($datetimes)) { |
|
| 725 | + foreach ($datetimes as $datetime) { |
|
| 726 | + if ($datetime instanceof EE_Datetime) { |
|
| 727 | + $datetime->decrease_sold($qty); |
|
| 728 | 728 | $datetime->save(); |
| 729 | 729 | } |
| 730 | 730 | } |
@@ -745,14 +745,14 @@ discard block |
||
| 745 | 745 | * |
| 746 | 746 | * @return int |
| 747 | 747 | */ |
| 748 | - function qty( $context = '' ) { |
|
| 749 | - switch ( $context ) { |
|
| 748 | + function qty($context = '') { |
|
| 749 | + switch ($context) { |
|
| 750 | 750 | case 'reg_limit' : |
| 751 | 751 | return $this->real_quantity_on_ticket(); |
| 752 | 752 | case 'saleable' : |
| 753 | - return $this->real_quantity_on_ticket( 'saleable' ); |
|
| 753 | + return $this->real_quantity_on_ticket('saleable'); |
|
| 754 | 754 | default: |
| 755 | - return $this->get_raw( 'TKT_qty' ); |
|
| 755 | + return $this->get_raw('TKT_qty'); |
|
| 756 | 756 | } |
| 757 | 757 | } |
| 758 | 758 | |
@@ -769,38 +769,38 @@ discard block |
||
| 769 | 769 | * |
| 770 | 770 | * @return int |
| 771 | 771 | */ |
| 772 | - function real_quantity_on_ticket( $context = 'reg_limit' ) { |
|
| 772 | + function real_quantity_on_ticket($context = 'reg_limit') { |
|
| 773 | 773 | // start with the original db value for ticket quantity |
| 774 | - $raw = $this->get_raw( 'TKT_qty' ); |
|
| 774 | + $raw = $this->get_raw('TKT_qty'); |
|
| 775 | 775 | // return immediately if it's zero |
| 776 | - if ( $raw === 0 ) { |
|
| 776 | + if ($raw === 0) { |
|
| 777 | 777 | return $raw; |
| 778 | 778 | } |
| 779 | 779 | // ensure qty doesn't exceed raw value for THIS ticket |
| 780 | - $qty = min( EE_INF, $raw ); |
|
| 780 | + $qty = min(EE_INF, $raw); |
|
| 781 | 781 | // NOW that we know the maximum number of tickets available for the ticket |
| 782 | 782 | // we need to calculate the maximum number of tickets available for the datetime |
| 783 | 783 | // without really factoring this ticket into the calculations |
| 784 | 784 | $datetimes = $this->datetimes(); |
| 785 | - foreach ( $datetimes as $datetime ) { |
|
| 786 | - if ( $datetime instanceof EE_Datetime ) { |
|
| 785 | + foreach ($datetimes as $datetime) { |
|
| 786 | + if ($datetime instanceof EE_Datetime) { |
|
| 787 | 787 | // initialize with no restrictions for each datetime |
| 788 | 788 | // but adjust datetime qty based on datetime reg limit |
| 789 | - $datetime_qty = min( EE_INF, $datetime->reg_limit() ); |
|
| 789 | + $datetime_qty = min(EE_INF, $datetime->reg_limit()); |
|
| 790 | 790 | // if we want the actual saleable amount, then we need to consider OTHER ticket sales |
| 791 | 791 | // for this datetime, that do NOT include sales for this ticket (so we add THIS ticket's sales back in) |
| 792 | - if ( $context == 'saleable' ) { |
|
| 793 | - $datetime_qty = max( $datetime_qty - $datetime->sold() + $this->sold(), 0 ); |
|
| 792 | + if ($context == 'saleable') { |
|
| 793 | + $datetime_qty = max($datetime_qty - $datetime->sold() + $this->sold(), 0); |
|
| 794 | 794 | $datetime_qty = ! $datetime->sold_out() ? $datetime_qty : 0; |
| 795 | 795 | } |
| 796 | - $qty = min( $datetime_qty, $qty ); |
|
| 796 | + $qty = min($datetime_qty, $qty); |
|
| 797 | 797 | } |
| 798 | 798 | |
| 799 | 799 | } |
| 800 | 800 | // we need to factor in the details for this specific ticket |
| 801 | - if ( $qty > 0 && $context == 'saleable' ) { |
|
| 801 | + if ($qty > 0 && $context == 'saleable') { |
|
| 802 | 802 | // and subtract the sales for THIS ticket |
| 803 | - $qty = max( $qty - $this->sold(), 0 ); |
|
| 803 | + $qty = max($qty - $this->sold(), 0); |
|
| 804 | 804 | //echo ' $qty: ' . $qty . "<br />"; |
| 805 | 805 | } |
| 806 | 806 | //echo '$qty: ' . $qty . "<br />"; |
@@ -816,14 +816,14 @@ discard block |
||
| 816 | 816 | * @return bool |
| 817 | 817 | * @throws \EE_Error |
| 818 | 818 | */ |
| 819 | - function set_qty( $qty ) { |
|
| 819 | + function set_qty($qty) { |
|
| 820 | 820 | $datetimes = $this->datetimes(); |
| 821 | - foreach ( $datetimes as $datetime ) { |
|
| 822 | - if ( $datetime instanceof EE_Datetime ) { |
|
| 823 | - $qty = min( $qty, $datetime->reg_limit() ); |
|
| 821 | + foreach ($datetimes as $datetime) { |
|
| 822 | + if ($datetime instanceof EE_Datetime) { |
|
| 823 | + $qty = min($qty, $datetime->reg_limit()); |
|
| 824 | 824 | } |
| 825 | 825 | } |
| 826 | - $this->set( 'TKT_qty', $qty ); |
|
| 826 | + $this->set('TKT_qty', $qty); |
|
| 827 | 827 | } |
| 828 | 828 | |
| 829 | 829 | |
@@ -833,7 +833,7 @@ discard block |
||
| 833 | 833 | * @return int |
| 834 | 834 | */ |
| 835 | 835 | function uses() { |
| 836 | - return $this->get( 'TKT_uses' ); |
|
| 836 | + return $this->get('TKT_uses'); |
|
| 837 | 837 | } |
| 838 | 838 | |
| 839 | 839 | |
@@ -843,8 +843,8 @@ discard block |
||
| 843 | 843 | * @param int $uses |
| 844 | 844 | * @return boolean |
| 845 | 845 | */ |
| 846 | - function set_uses( $uses ) { |
|
| 847 | - $this->set( 'TKT_uses', $uses ); |
|
| 846 | + function set_uses($uses) { |
|
| 847 | + $this->set('TKT_uses', $uses); |
|
| 848 | 848 | } |
| 849 | 849 | |
| 850 | 850 | |
@@ -854,7 +854,7 @@ discard block |
||
| 854 | 854 | * @return boolean |
| 855 | 855 | */ |
| 856 | 856 | public function required() { |
| 857 | - return $this->get( 'TKT_required' ); |
|
| 857 | + return $this->get('TKT_required'); |
|
| 858 | 858 | } |
| 859 | 859 | |
| 860 | 860 | |
@@ -864,8 +864,8 @@ discard block |
||
| 864 | 864 | * @param boolean $required |
| 865 | 865 | * @return boolean |
| 866 | 866 | */ |
| 867 | - public function set_required( $required ) { |
|
| 868 | - $this->set( 'TKT_required', $required ); |
|
| 867 | + public function set_required($required) { |
|
| 868 | + $this->set('TKT_required', $required); |
|
| 869 | 869 | } |
| 870 | 870 | |
| 871 | 871 | |
@@ -875,7 +875,7 @@ discard block |
||
| 875 | 875 | * @return boolean |
| 876 | 876 | */ |
| 877 | 877 | function taxable() { |
| 878 | - return $this->get( 'TKT_taxable' ); |
|
| 878 | + return $this->get('TKT_taxable'); |
|
| 879 | 879 | } |
| 880 | 880 | |
| 881 | 881 | |
@@ -885,8 +885,8 @@ discard block |
||
| 885 | 885 | * @param boolean $taxable |
| 886 | 886 | * @return boolean |
| 887 | 887 | */ |
| 888 | - function set_taxable( $taxable ) { |
|
| 889 | - $this->set( 'TKT_taxable', $taxable ); |
|
| 888 | + function set_taxable($taxable) { |
|
| 889 | + $this->set('TKT_taxable', $taxable); |
|
| 890 | 890 | } |
| 891 | 891 | |
| 892 | 892 | |
@@ -896,7 +896,7 @@ discard block |
||
| 896 | 896 | * @return boolean |
| 897 | 897 | */ |
| 898 | 898 | function is_default() { |
| 899 | - return $this->get( 'TKT_is_default' ); |
|
| 899 | + return $this->get('TKT_is_default'); |
|
| 900 | 900 | } |
| 901 | 901 | |
| 902 | 902 | |
@@ -906,8 +906,8 @@ discard block |
||
| 906 | 906 | * @param boolean $is_default |
| 907 | 907 | * @return boolean |
| 908 | 908 | */ |
| 909 | - function set_is_default( $is_default ) { |
|
| 910 | - $this->set( 'TKT_is_default', $is_default ); |
|
| 909 | + function set_is_default($is_default) { |
|
| 910 | + $this->set('TKT_is_default', $is_default); |
|
| 911 | 911 | } |
| 912 | 912 | |
| 913 | 913 | |
@@ -917,7 +917,7 @@ discard block |
||
| 917 | 917 | * @return int |
| 918 | 918 | */ |
| 919 | 919 | function order() { |
| 920 | - return $this->get( 'TKT_order' ); |
|
| 920 | + return $this->get('TKT_order'); |
|
| 921 | 921 | } |
| 922 | 922 | |
| 923 | 923 | |
@@ -927,8 +927,8 @@ discard block |
||
| 927 | 927 | * @param int $order |
| 928 | 928 | * @return boolean |
| 929 | 929 | */ |
| 930 | - function set_order( $order ) { |
|
| 931 | - $this->set( 'TKT_order', $order ); |
|
| 930 | + function set_order($order) { |
|
| 931 | + $this->set('TKT_order', $order); |
|
| 932 | 932 | } |
| 933 | 933 | |
| 934 | 934 | |
@@ -938,7 +938,7 @@ discard block |
||
| 938 | 938 | * @return int |
| 939 | 939 | */ |
| 940 | 940 | function row() { |
| 941 | - return $this->get( 'TKT_row' ); |
|
| 941 | + return $this->get('TKT_row'); |
|
| 942 | 942 | } |
| 943 | 943 | |
| 944 | 944 | |
@@ -948,8 +948,8 @@ discard block |
||
| 948 | 948 | * @param int $row |
| 949 | 949 | * @return boolean |
| 950 | 950 | */ |
| 951 | - function set_row( $row ) { |
|
| 952 | - $this->set( 'TKT_row', $row ); |
|
| 951 | + function set_row($row) { |
|
| 952 | + $this->set('TKT_row', $row); |
|
| 953 | 953 | } |
| 954 | 954 | |
| 955 | 955 | |
@@ -959,7 +959,7 @@ discard block |
||
| 959 | 959 | * @return boolean |
| 960 | 960 | */ |
| 961 | 961 | function deleted() { |
| 962 | - return $this->get( 'TKT_deleted' ); |
|
| 962 | + return $this->get('TKT_deleted'); |
|
| 963 | 963 | } |
| 964 | 964 | |
| 965 | 965 | |
@@ -969,8 +969,8 @@ discard block |
||
| 969 | 969 | * @param boolean $deleted |
| 970 | 970 | * @return boolean |
| 971 | 971 | */ |
| 972 | - function set_deleted( $deleted ) { |
|
| 973 | - $this->set( 'TKT_deleted', $deleted ); |
|
| 972 | + function set_deleted($deleted) { |
|
| 973 | + $this->set('TKT_deleted', $deleted); |
|
| 974 | 974 | } |
| 975 | 975 | |
| 976 | 976 | |
@@ -980,7 +980,7 @@ discard block |
||
| 980 | 980 | * @return int |
| 981 | 981 | */ |
| 982 | 982 | function parent_ID() { |
| 983 | - return $this->get( 'TKT_parent' ); |
|
| 983 | + return $this->get('TKT_parent'); |
|
| 984 | 984 | } |
| 985 | 985 | |
| 986 | 986 | |
@@ -990,8 +990,8 @@ discard block |
||
| 990 | 990 | * @param int $parent |
| 991 | 991 | * @return boolean |
| 992 | 992 | */ |
| 993 | - function set_parent_ID( $parent ) { |
|
| 994 | - $this->set( 'TKT_parent', $parent ); |
|
| 993 | + function set_parent_ID($parent) { |
|
| 994 | + $this->set('TKT_parent', $parent); |
|
| 995 | 995 | } |
| 996 | 996 | |
| 997 | 997 | |
@@ -1002,10 +1002,10 @@ discard block |
||
| 1002 | 1002 | */ |
| 1003 | 1003 | function name_and_info() { |
| 1004 | 1004 | $times = array(); |
| 1005 | - foreach ( $this->datetimes() as $datetime ) { |
|
| 1005 | + foreach ($this->datetimes() as $datetime) { |
|
| 1006 | 1006 | $times[] = $datetime->start_date_and_time(); |
| 1007 | 1007 | } |
| 1008 | - return $this->name() . " @ " . implode( ", ", $times ) . " for " . $this->price(); |
|
| 1008 | + return $this->name()." @ ".implode(", ", $times)." for ".$this->price(); |
|
| 1009 | 1009 | } |
| 1010 | 1010 | |
| 1011 | 1011 | |
@@ -1015,7 +1015,7 @@ discard block |
||
| 1015 | 1015 | * @return string |
| 1016 | 1016 | */ |
| 1017 | 1017 | function name() { |
| 1018 | - return $this->get( 'TKT_name' ); |
|
| 1018 | + return $this->get('TKT_name'); |
|
| 1019 | 1019 | } |
| 1020 | 1020 | |
| 1021 | 1021 | |
@@ -1025,7 +1025,7 @@ discard block |
||
| 1025 | 1025 | * @return float |
| 1026 | 1026 | */ |
| 1027 | 1027 | function price() { |
| 1028 | - return $this->get( 'TKT_price' ); |
|
| 1028 | + return $this->get('TKT_price'); |
|
| 1029 | 1029 | } |
| 1030 | 1030 | |
| 1031 | 1031 | |
@@ -1035,8 +1035,8 @@ discard block |
||
| 1035 | 1035 | * @param array $query_params like EEM_Base::get_all's |
| 1036 | 1036 | * @return EE_Registration[] |
| 1037 | 1037 | */ |
| 1038 | - public function registrations( $query_params = array() ) { |
|
| 1039 | - return $this->get_many_related( 'Registration', $query_params ); |
|
| 1038 | + public function registrations($query_params = array()) { |
|
| 1039 | + return $this->get_many_related('Registration', $query_params); |
|
| 1040 | 1040 | } |
| 1041 | 1041 | |
| 1042 | 1042 | |
@@ -1047,8 +1047,8 @@ discard block |
||
| 1047 | 1047 | * @return int |
| 1048 | 1048 | */ |
| 1049 | 1049 | public function update_tickets_sold() { |
| 1050 | - $count_regs_for_this_ticket = $this->count_registrations( array( array( 'STS_ID' => EEM_Registration::status_id_approved, 'REG_deleted' => 0 ) ) ); |
|
| 1051 | - $this->set_sold( $count_regs_for_this_ticket ); |
|
| 1050 | + $count_regs_for_this_ticket = $this->count_registrations(array(array('STS_ID' => EEM_Registration::status_id_approved, 'REG_deleted' => 0))); |
|
| 1051 | + $this->set_sold($count_regs_for_this_ticket); |
|
| 1052 | 1052 | $this->save(); |
| 1053 | 1053 | return $count_regs_for_this_ticket; |
| 1054 | 1054 | } |
@@ -1060,7 +1060,7 @@ discard block |
||
| 1060 | 1060 | * @param array $query_params like EEM_Base::get_all's |
| 1061 | 1061 | * @return int |
| 1062 | 1062 | */ |
| 1063 | - public function count_registrations( $query_params = array() ) { |
|
| 1063 | + public function count_registrations($query_params = array()) { |
|
| 1064 | 1064 | return $this->count_related('Registration', $query_params); |
| 1065 | 1065 | } |
| 1066 | 1066 | |
@@ -1085,7 +1085,7 @@ discard block |
||
| 1085 | 1085 | public function get_related_event() { |
| 1086 | 1086 | //get one datetime to use for getting the event |
| 1087 | 1087 | $datetime = $this->first_datetime(); |
| 1088 | - if ( $datetime instanceof EE_Datetime ) { |
|
| 1088 | + if ($datetime instanceof EE_Datetime) { |
|
| 1089 | 1089 | return $datetime->event(); |
| 1090 | 1090 | } |
| 1091 | 1091 | return null; |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
| 2 | - exit( 'No direct script access allowed' ); |
|
| 1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | 3 | } |
| 4 | 4 | /** |
| 5 | 5 | * Event Espresso |
@@ -35,9 +35,9 @@ discard block |
||
| 35 | 35 | * @param string $timezone |
| 36 | 36 | * @return EE_Ticket_Price|mixed |
| 37 | 37 | */ |
| 38 | - public static function new_instance( $props_n_values = array(), $timezone = '', $date_formats = array() ) { |
|
| 39 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
| 40 | - return $has_object ? $has_object : new self( $props_n_values, FALSE, $timezone, $date_formats ); |
|
| 38 | + public static function new_instance($props_n_values = array(), $timezone = '', $date_formats = array()) { |
|
| 39 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
| 40 | + return $has_object ? $has_object : new self($props_n_values, FALSE, $timezone, $date_formats); |
|
| 41 | 41 | } |
| 42 | 42 | |
| 43 | 43 | |
@@ -47,8 +47,8 @@ discard block |
||
| 47 | 47 | * @param string $timezone |
| 48 | 48 | * @return EE_Ticket_Price |
| 49 | 49 | */ |
| 50 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = '' ) { |
|
| 51 | - return new self( $props_n_values, TRUE, $timezone ); |
|
| 50 | + public static function new_instance_from_db($props_n_values = array(), $timezone = '') { |
|
| 51 | + return new self($props_n_values, TRUE, $timezone); |
|
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
| 2 | - exit( 'No direct script access allowed' ); |
|
| 1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | 3 | } |
| 4 | 4 | /** |
| 5 | 5 | * Event Espresso |
@@ -26,7 +26,7 @@ discard block |
||
| 26 | 26 | * @subpackage includes/classes/EE_Transaction.class.php |
| 27 | 27 | * @author Brent Christensen |
| 28 | 28 | */ |
| 29 | -class EE_Transaction extends EE_Base_Class implements EEI_Transaction{ |
|
| 29 | +class EE_Transaction extends EE_Base_Class implements EEI_Transaction { |
|
| 30 | 30 | |
| 31 | 31 | |
| 32 | 32 | /** |
@@ -38,9 +38,9 @@ discard block |
||
| 38 | 38 | * date_format and the second value is the time format |
| 39 | 39 | * @return EE_Transaction |
| 40 | 40 | */ |
| 41 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
| 42 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
| 43 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
| 41 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
| 42 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
| 43 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
| 44 | 44 | } |
| 45 | 45 | |
| 46 | 46 | |
@@ -51,8 +51,8 @@ discard block |
||
| 51 | 51 | * the website will be used. |
| 52 | 52 | * @return EE_Attendee |
| 53 | 53 | */ |
| 54 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
| 55 | - return new self( $props_n_values, TRUE, $timezone ); |
|
| 54 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
| 55 | + return new self($props_n_values, TRUE, $timezone); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | |
@@ -67,9 +67,9 @@ discard block |
||
| 67 | 67 | * @return void |
| 68 | 68 | */ |
| 69 | 69 | public function lock() { |
| 70 | - $locked_transactions = get_option( 'ee_locked_transactions', array() ); |
|
| 71 | - $locked_transactions[ $this->ID() ] = true; |
|
| 72 | - update_option( 'ee_locked_transactions', $locked_transactions ); |
|
| 70 | + $locked_transactions = get_option('ee_locked_transactions', array()); |
|
| 71 | + $locked_transactions[$this->ID()] = true; |
|
| 72 | + update_option('ee_locked_transactions', $locked_transactions); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | |
@@ -83,9 +83,9 @@ discard block |
||
| 83 | 83 | * @return void |
| 84 | 84 | */ |
| 85 | 85 | public function unlock() { |
| 86 | - $locked_transactions = get_option( 'ee_locked_transactions', array() ); |
|
| 87 | - unset( $locked_transactions[ $this->ID() ] ); |
|
| 88 | - update_option( 'ee_locked_transactions', $locked_transactions ); |
|
| 86 | + $locked_transactions = get_option('ee_locked_transactions', array()); |
|
| 87 | + unset($locked_transactions[$this->ID()]); |
|
| 88 | + update_option('ee_locked_transactions', $locked_transactions); |
|
| 89 | 89 | } |
| 90 | 90 | |
| 91 | 91 | /** |
@@ -102,8 +102,8 @@ discard block |
||
| 102 | 102 | * @return boolean |
| 103 | 103 | */ |
| 104 | 104 | public function is_locked() { |
| 105 | - $locked_transactions = get_option( 'ee_locked_transactions', array() ); |
|
| 106 | - return isset( $locked_transactions[ $this->ID() ] ) ? true : false; |
|
| 105 | + $locked_transactions = get_option('ee_locked_transactions', array()); |
|
| 106 | + return isset($locked_transactions[$this->ID()]) ? true : false; |
|
| 107 | 107 | } |
| 108 | 108 | |
| 109 | 109 | |
@@ -114,8 +114,8 @@ discard block |
||
| 114 | 114 | * @access public |
| 115 | 115 | * @param float $total total value of transaction |
| 116 | 116 | */ |
| 117 | - public function set_total( $total = 0.00 ) { |
|
| 118 | - $this->set( 'TXN_total', $total ); |
|
| 117 | + public function set_total($total = 0.00) { |
|
| 118 | + $this->set('TXN_total', $total); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | |
@@ -126,8 +126,8 @@ discard block |
||
| 126 | 126 | * @access public |
| 127 | 127 | * @param float $total_paid total amount paid to date (sum of all payments) |
| 128 | 128 | */ |
| 129 | - public function set_paid( $total_paid = 0.00 ) { |
|
| 130 | - $this->set( 'TXN_paid', $total_paid ); |
|
| 129 | + public function set_paid($total_paid = 0.00) { |
|
| 130 | + $this->set('TXN_paid', $total_paid); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | |
@@ -138,8 +138,8 @@ discard block |
||
| 138 | 138 | * @access public |
| 139 | 139 | * @param string $status whether the transaction is open, declined, accepted, or any number of custom values that can be set |
| 140 | 140 | */ |
| 141 | - public function set_status( $status = '' ) { |
|
| 142 | - $this->set( 'STS_ID', $status ); |
|
| 141 | + public function set_status($status = '') { |
|
| 142 | + $this->set('STS_ID', $status); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | |
@@ -150,8 +150,8 @@ discard block |
||
| 150 | 150 | * @access public |
| 151 | 151 | * @param string $hash_salt required for some payment gateways |
| 152 | 152 | */ |
| 153 | - public function set_hash_salt( $hash_salt = '' ) { |
|
| 154 | - $this->set( 'TXN_hash_salt', $hash_salt ); |
|
| 153 | + public function set_hash_salt($hash_salt = '') { |
|
| 154 | + $this->set('TXN_hash_salt', $hash_salt); |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | |
@@ -160,8 +160,8 @@ discard block |
||
| 160 | 160 | * Sets TXN_reg_steps array |
| 161 | 161 | * @param array $txn_reg_steps |
| 162 | 162 | */ |
| 163 | - function set_reg_steps( $txn_reg_steps ) { |
|
| 164 | - $this->set( 'TXN_reg_steps', $txn_reg_steps ); |
|
| 163 | + function set_reg_steps($txn_reg_steps) { |
|
| 164 | + $this->set('TXN_reg_steps', $txn_reg_steps); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | |
@@ -171,8 +171,8 @@ discard block |
||
| 171 | 171 | * @return array |
| 172 | 172 | */ |
| 173 | 173 | function reg_steps() { |
| 174 | - $TXN_reg_steps = $this->get( 'TXN_reg_steps' ); |
|
| 175 | - return is_array( $TXN_reg_steps ) ? $TXN_reg_steps : array(); |
|
| 174 | + $TXN_reg_steps = $this->get('TXN_reg_steps'); |
|
| 175 | + return is_array($TXN_reg_steps) ? $TXN_reg_steps : array(); |
|
| 176 | 176 | } |
| 177 | 177 | |
| 178 | 178 | |
@@ -182,7 +182,7 @@ discard block |
||
| 182 | 182 | * @return string of transaction's total cost, with currency symbol and decimal |
| 183 | 183 | */ |
| 184 | 184 | public function pretty_total() { |
| 185 | - return $this->get_pretty( 'TXN_total' ); |
|
| 185 | + return $this->get_pretty('TXN_total'); |
|
| 186 | 186 | } |
| 187 | 187 | |
| 188 | 188 | |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | * @return string |
| 193 | 193 | */ |
| 194 | 194 | public function pretty_paid() { |
| 195 | - return $this->get_pretty( 'TXN_paid' ); |
|
| 195 | + return $this->get_pretty('TXN_paid'); |
|
| 196 | 196 | } |
| 197 | 197 | |
| 198 | 198 | |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | * @return float amount remaining |
| 205 | 205 | */ |
| 206 | 206 | public function remaining() { |
| 207 | - return (float)( $this->total() - $this->paid() ); |
|
| 207 | + return (float) ($this->total() - $this->paid()); |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | |
@@ -215,7 +215,7 @@ discard block |
||
| 215 | 215 | * @return float |
| 216 | 216 | */ |
| 217 | 217 | public function total() { |
| 218 | - return $this->get( 'TXN_total' ); |
|
| 218 | + return $this->get('TXN_total'); |
|
| 219 | 219 | } |
| 220 | 220 | |
| 221 | 221 | |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | * @return float |
| 227 | 227 | */ |
| 228 | 228 | public function paid() { |
| 229 | - return $this->get( 'TXN_paid' ); |
|
| 229 | + return $this->get('TXN_paid'); |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | |
@@ -236,8 +236,8 @@ discard block |
||
| 236 | 236 | * @access public |
| 237 | 237 | */ |
| 238 | 238 | public function get_cart_session() { |
| 239 | - $session_data = $this->get( 'TXN_session_data' ); |
|
| 240 | - return isset( $session_data[ 'cart' ] ) && $session_data[ 'cart' ] instanceof EE_Cart ? $session_data[ 'cart' ] : NULL; |
|
| 239 | + $session_data = $this->get('TXN_session_data'); |
|
| 240 | + return isset($session_data['cart']) && $session_data['cart'] instanceof EE_Cart ? $session_data['cart'] : NULL; |
|
| 241 | 241 | } |
| 242 | 242 | |
| 243 | 243 | |
@@ -247,9 +247,9 @@ discard block |
||
| 247 | 247 | * @access public |
| 248 | 248 | */ |
| 249 | 249 | public function session_data() { |
| 250 | - $session_data = $this->get( 'TXN_session_data' ); |
|
| 251 | - if ( empty( $session_data ) ) { |
|
| 252 | - $session_data = array( 'id' => NULL, 'user_id' => NULL, 'ip_address' => NULL, 'user_agent' => NULL, 'init_access' => NULL, 'last_access' => NULL, 'pages_visited' => array() ); |
|
| 250 | + $session_data = $this->get('TXN_session_data'); |
|
| 251 | + if (empty($session_data)) { |
|
| 252 | + $session_data = array('id' => NULL, 'user_id' => NULL, 'ip_address' => NULL, 'user_agent' => NULL, 'init_access' => NULL, 'last_access' => NULL, 'pages_visited' => array()); |
|
| 253 | 253 | } |
| 254 | 254 | return $session_data; |
| 255 | 255 | } |
@@ -262,11 +262,11 @@ discard block |
||
| 262 | 262 | * @access public |
| 263 | 263 | * @param EE_Session|array $session_data |
| 264 | 264 | */ |
| 265 | - public function set_txn_session_data( $session_data ) { |
|
| 266 | - if ( $session_data instanceof EE_Session ) { |
|
| 267 | - $this->set( 'TXN_session_data', $session_data->get_session_data( NULL, TRUE )); |
|
| 265 | + public function set_txn_session_data($session_data) { |
|
| 266 | + if ($session_data instanceof EE_Session) { |
|
| 267 | + $this->set('TXN_session_data', $session_data->get_session_data(NULL, TRUE)); |
|
| 268 | 268 | } else { |
| 269 | - $this->set( 'TXN_session_data', $session_data ); |
|
| 269 | + $this->set('TXN_session_data', $session_data); |
|
| 270 | 270 | } |
| 271 | 271 | } |
| 272 | 272 | |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | * @access public |
| 278 | 278 | */ |
| 279 | 279 | public function hash_salt_() { |
| 280 | - return $this->get( 'TXN_hash_salt' ); |
|
| 280 | + return $this->get('TXN_hash_salt'); |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | |
@@ -297,13 +297,13 @@ discard block |
||
| 297 | 297 | * @param boolean $gmt - whether to return a unix timestamp with UTC offset applied (default) or no UTC offset applied |
| 298 | 298 | * @return string | int |
| 299 | 299 | */ |
| 300 | - public function datetime( $format = FALSE, $gmt = FALSE ) { |
|
| 301 | - if ( $format ) { |
|
| 302 | - return $this->get_pretty( 'TXN_timestamp' ); |
|
| 303 | - } else if ( $gmt ) { |
|
| 304 | - return $this->get_raw( 'TXN_timestamp' ); |
|
| 300 | + public function datetime($format = FALSE, $gmt = FALSE) { |
|
| 301 | + if ($format) { |
|
| 302 | + return $this->get_pretty('TXN_timestamp'); |
|
| 303 | + } else if ($gmt) { |
|
| 304 | + return $this->get_raw('TXN_timestamp'); |
|
| 305 | 305 | } else { |
| 306 | - return $this->get( 'TXN_timestamp' ); |
|
| 306 | + return $this->get('TXN_timestamp'); |
|
| 307 | 307 | } |
| 308 | 308 | } |
| 309 | 309 | |
@@ -315,10 +315,10 @@ discard block |
||
| 315 | 315 | * @param boolean $get_cached TRUE to retrieve cached registrations or FALSE to pull from the db |
| 316 | 316 | * @return EE_Registration[] |
| 317 | 317 | */ |
| 318 | - public function registrations( $query_params = array(), $get_cached = FALSE ) { |
|
| 319 | - $query_params = ( empty( $query_params ) || ! is_array( $query_params ) ) ? array( 'order_by' => array( 'Event.EVT_name' => 'ASC', 'Attendee.ATT_lname' => 'ASC', 'Attendee.ATT_fname' => 'ASC' ) ) : $query_params; |
|
| 318 | + public function registrations($query_params = array(), $get_cached = FALSE) { |
|
| 319 | + $query_params = (empty($query_params) || ! is_array($query_params)) ? array('order_by' => array('Event.EVT_name' => 'ASC', 'Attendee.ATT_lname' => 'ASC', 'Attendee.ATT_fname' => 'ASC')) : $query_params; |
|
| 320 | 320 | $query_params = $get_cached ? array() : $query_params; |
| 321 | - return $this->get_many_related( 'Registration', $query_params ); |
|
| 321 | + return $this->get_many_related('Registration', $query_params); |
|
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | |
@@ -329,7 +329,7 @@ discard block |
||
| 329 | 329 | * @return mixed EE_Attendee[] by default, int if $output is set to 'COUNT' |
| 330 | 330 | */ |
| 331 | 331 | public function attendees() { |
| 332 | - return $this->get_many_related( 'Attendee', array( array( 'Registration.Transaction.TXN_ID' => $this->ID() ) ) ); |
|
| 332 | + return $this->get_many_related('Attendee', array(array('Registration.Transaction.TXN_ID' => $this->ID()))); |
|
| 333 | 333 | } |
| 334 | 334 | |
| 335 | 335 | |
@@ -339,8 +339,8 @@ discard block |
||
| 339 | 339 | * @param array $query_params like EEM_Base::get_all |
| 340 | 340 | * @return EE_Payment[] |
| 341 | 341 | */ |
| 342 | - public function payments( $query_params = array() ) { |
|
| 343 | - return $this->get_many_related( 'Payment', $query_params ); |
|
| 342 | + public function payments($query_params = array()) { |
|
| 343 | + return $this->get_many_related('Payment', $query_params); |
|
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | |
@@ -350,8 +350,8 @@ discard block |
||
| 350 | 350 | * @return EE_Payment[] |
| 351 | 351 | */ |
| 352 | 352 | public function approved_payments() { |
| 353 | - EE_Registry::instance()->load_model( 'Payment' ); |
|
| 354 | - return $this->get_many_related( 'Payment', array( array( 'STS_ID' => EEM_Payment::status_id_approved ), 'order_by' => array( 'PAY_timestamp' => 'DESC' ) ) ); |
|
| 353 | + EE_Registry::instance()->load_model('Payment'); |
|
| 354 | + return $this->get_many_related('Payment', array(array('STS_ID' => EEM_Payment::status_id_approved), 'order_by' => array('PAY_timestamp' => 'DESC'))); |
|
| 355 | 355 | } |
| 356 | 356 | |
| 357 | 357 | |
@@ -361,8 +361,8 @@ discard block |
||
| 361 | 361 | * @param bool $show_icons |
| 362 | 362 | * @return string |
| 363 | 363 | */ |
| 364 | - public function e_pretty_status( $show_icons = FALSE ) { |
|
| 365 | - echo $this->pretty_status( $show_icons ); |
|
| 364 | + public function e_pretty_status($show_icons = FALSE) { |
|
| 365 | + echo $this->pretty_status($show_icons); |
|
| 366 | 366 | } |
| 367 | 367 | |
| 368 | 368 | |
@@ -372,10 +372,10 @@ discard block |
||
| 372 | 372 | * @param bool $show_icons |
| 373 | 373 | * @return string |
| 374 | 374 | */ |
| 375 | - public function pretty_status( $show_icons = FALSE ) { |
|
| 376 | - $status = EEM_Status::instance()->localized_status( array( $this->status_ID() => __( 'unknown', 'event_espresso' ) ), FALSE, 'sentence' ); |
|
| 375 | + public function pretty_status($show_icons = FALSE) { |
|
| 376 | + $status = EEM_Status::instance()->localized_status(array($this->status_ID() => __('unknown', 'event_espresso')), FALSE, 'sentence'); |
|
| 377 | 377 | $icon = ''; |
| 378 | - switch ( $this->status_ID() ) { |
|
| 378 | + switch ($this->status_ID()) { |
|
| 379 | 379 | case EEM_Transaction::complete_status_code: |
| 380 | 380 | $icon = $show_icons ? '<span class="dashicons dashicons-yes ee-icon-size-24 green-text"></span>' : ''; |
| 381 | 381 | break; |
@@ -392,7 +392,7 @@ discard block |
||
| 392 | 392 | $icon = $show_icons ? '<span class="dashicons dashicons-plus ee-icon-size-16 orange-text"></span>' : ''; |
| 393 | 393 | break; |
| 394 | 394 | } |
| 395 | - return $icon . $status[ $this->status_ID() ]; |
|
| 395 | + return $icon.$status[$this->status_ID()]; |
|
| 396 | 396 | } |
| 397 | 397 | |
| 398 | 398 | |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | * @access public |
| 403 | 403 | */ |
| 404 | 404 | public function status_ID() { |
| 405 | - return $this->get( 'STS_ID' ); |
|
| 405 | + return $this->get('STS_ID'); |
|
| 406 | 406 | } |
| 407 | 407 | |
| 408 | 408 | |
@@ -412,7 +412,7 @@ discard block |
||
| 412 | 412 | * @return boolean |
| 413 | 413 | */ |
| 414 | 414 | public function is_free() { |
| 415 | - return (float)$this->get( 'TXN_total' ) == 0 ? TRUE : FALSE; |
|
| 415 | + return (float) $this->get('TXN_total') == 0 ? TRUE : FALSE; |
|
| 416 | 416 | } |
| 417 | 417 | |
| 418 | 418 | |
@@ -480,12 +480,12 @@ discard block |
||
| 480 | 480 | * @access public |
| 481 | 481 | * @return string |
| 482 | 482 | */ |
| 483 | - public function invoice_url( $type = 'html' ) { |
|
| 483 | + public function invoice_url($type = 'html') { |
|
| 484 | 484 | $REG = $this->primary_registration(); |
| 485 | - if ( ! $REG instanceof EE_Registration ) { |
|
| 485 | + if ( ! $REG instanceof EE_Registration) { |
|
| 486 | 486 | return ''; |
| 487 | 487 | } |
| 488 | - return $REG->invoice_url( $type ); |
|
| 488 | + return $REG->invoice_url($type); |
|
| 489 | 489 | } |
| 490 | 490 | |
| 491 | 491 | |
@@ -495,7 +495,7 @@ discard block |
||
| 495 | 495 | * @return EE_Registration |
| 496 | 496 | */ |
| 497 | 497 | public function primary_registration() { |
| 498 | - return $this->get_first_related( 'Registration', array( array( 'REG_count' => EEM_Registration::PRIMARY_REGISTRANT_COUNT ) ) ); |
|
| 498 | + return $this->get_first_related('Registration', array(array('REG_count' => EEM_Registration::PRIMARY_REGISTRANT_COUNT))); |
|
| 499 | 499 | } |
| 500 | 500 | |
| 501 | 501 | |
@@ -505,12 +505,12 @@ discard block |
||
| 505 | 505 | * @param string $type 'pdf' or 'html' (default is 'html') |
| 506 | 506 | * @return string |
| 507 | 507 | */ |
| 508 | - public function receipt_url( $type = 'html' ) { |
|
| 508 | + public function receipt_url($type = 'html') { |
|
| 509 | 509 | $REG = $this->primary_registration(); |
| 510 | - if ( ! $REG instanceof EE_Registration ) { |
|
| 510 | + if ( ! $REG instanceof EE_Registration) { |
|
| 511 | 511 | return ''; |
| 512 | 512 | } |
| 513 | - return $REG->receipt_url( $type ); |
|
| 513 | + return $REG->receipt_url($type); |
|
| 514 | 514 | } |
| 515 | 515 | |
| 516 | 516 | |
@@ -535,15 +535,15 @@ discard block |
||
| 535 | 535 | * @deprecated |
| 536 | 536 | * @return boolean |
| 537 | 537 | */ |
| 538 | - public function update_based_on_payments(){ |
|
| 538 | + public function update_based_on_payments() { |
|
| 539 | 539 | EE_Error::doing_it_wrong( |
| 540 | - __CLASS__ . '::' . __FUNCTION__, |
|
| 541 | - sprintf( __( 'This method is deprecated. Please use "%s" instead', 'event_espresso' ), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()' ), |
|
| 540 | + __CLASS__.'::'.__FUNCTION__, |
|
| 541 | + sprintf(__('This method is deprecated. Please use "%s" instead', 'event_espresso'), 'EE_Transaction_Processor::update_transaction_and_registrations_after_checkout_or_payment()'), |
|
| 542 | 542 | '4.6.0' |
| 543 | 543 | ); |
| 544 | 544 | /** @type EE_Transaction_Processor $transaction_processor */ |
| 545 | - $transaction_processor = EE_Registry::instance()->load_class( 'Transaction_Processor' ); |
|
| 546 | - return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment( $this ); |
|
| 545 | + $transaction_processor = EE_Registry::instance()->load_class('Transaction_Processor'); |
|
| 546 | + return $transaction_processor->update_transaction_and_registrations_after_checkout_or_payment($this); |
|
| 547 | 547 | } |
| 548 | 548 | |
| 549 | 549 | |
@@ -552,7 +552,7 @@ discard block |
||
| 552 | 552 | * @return string |
| 553 | 553 | */ |
| 554 | 554 | public function gateway_response_on_transaction() { |
| 555 | - $payment = $this->get_first_related( 'Payment' ); |
|
| 555 | + $payment = $this->get_first_related('Payment'); |
|
| 556 | 556 | return $payment instanceof EE_Payment ? $payment->gateway_response() : ''; |
| 557 | 557 | } |
| 558 | 558 | |
@@ -563,7 +563,7 @@ discard block |
||
| 563 | 563 | * @return EE_Status |
| 564 | 564 | */ |
| 565 | 565 | public function status_obj() { |
| 566 | - return $this->get_first_related( 'Status' ); |
|
| 566 | + return $this->get_first_related('Status'); |
|
| 567 | 567 | } |
| 568 | 568 | |
| 569 | 569 | |
@@ -573,8 +573,8 @@ discard block |
||
| 573 | 573 | * @param array $query_params like EEM_Base::get_all |
| 574 | 574 | * @return EE_Extra_Meta |
| 575 | 575 | */ |
| 576 | - public function extra_meta( $query_params = array() ) { |
|
| 577 | - return $this->get_many_related( 'Extra_Meta', $query_params ); |
|
| 576 | + public function extra_meta($query_params = array()) { |
|
| 577 | + return $this->get_many_related('Extra_Meta', $query_params); |
|
| 578 | 578 | } |
| 579 | 579 | |
| 580 | 580 | |
@@ -584,8 +584,8 @@ discard block |
||
| 584 | 584 | * @param EE_Registration $registration |
| 585 | 585 | * @return EE_Base_Class the relation was added to |
| 586 | 586 | */ |
| 587 | - public function add_registration( EE_Registration $registration ) { |
|
| 588 | - return $this->_add_relation_to( $registration, 'Registration' ); |
|
| 587 | + public function add_registration(EE_Registration $registration) { |
|
| 588 | + return $this->_add_relation_to($registration, 'Registration'); |
|
| 589 | 589 | } |
| 590 | 590 | |
| 591 | 591 | |
@@ -596,8 +596,8 @@ discard block |
||
| 596 | 596 | * @param int $registration_or_id |
| 597 | 597 | * @return EE_Base_Class that was removed from being related |
| 598 | 598 | */ |
| 599 | - public function remove_registration_with_id( $registration_or_id ) { |
|
| 600 | - return $this->_remove_relation_to( $registration_or_id, 'Registration' ); |
|
| 599 | + public function remove_registration_with_id($registration_or_id) { |
|
| 600 | + return $this->_remove_relation_to($registration_or_id, 'Registration'); |
|
| 601 | 601 | } |
| 602 | 602 | |
| 603 | 603 | |
@@ -607,7 +607,7 @@ discard block |
||
| 607 | 607 | * @return EE_Line_Item[] |
| 608 | 608 | */ |
| 609 | 609 | public function items_purchased() { |
| 610 | - return $this->line_items( array( array( 'LIN_type' => EEM_Line_Item::type_line_item ) ) ); |
|
| 610 | + return $this->line_items(array(array('LIN_type' => EEM_Line_Item::type_line_item))); |
|
| 611 | 611 | } |
| 612 | 612 | |
| 613 | 613 | |
@@ -617,8 +617,8 @@ discard block |
||
| 617 | 617 | * @param EE_Line_Item $line_item |
| 618 | 618 | * @return EE_Base_Class the relation was added to |
| 619 | 619 | */ |
| 620 | - public function add_line_item( EE_Line_Item $line_item ) { |
|
| 621 | - return $this->_add_relation_to( $line_item, 'Line_Item' ); |
|
| 620 | + public function add_line_item(EE_Line_Item $line_item) { |
|
| 621 | + return $this->_add_relation_to($line_item, 'Line_Item'); |
|
| 622 | 622 | } |
| 623 | 623 | |
| 624 | 624 | |
@@ -628,8 +628,8 @@ discard block |
||
| 628 | 628 | * @param array $query_params |
| 629 | 629 | * @return EE_Line_Item[] |
| 630 | 630 | */ |
| 631 | - public function line_items( $query_params = array() ) { |
|
| 632 | - return $this->get_many_related( 'Line_Item', $query_params ); |
|
| 631 | + public function line_items($query_params = array()) { |
|
| 632 | + return $this->get_many_related('Line_Item', $query_params); |
|
| 633 | 633 | } |
| 634 | 634 | |
| 635 | 635 | |
@@ -639,7 +639,7 @@ discard block |
||
| 639 | 639 | * @return EE_Line_Item[] |
| 640 | 640 | */ |
| 641 | 641 | public function tax_items() { |
| 642 | - return $this->line_items( array( array( 'LIN_type' => EEM_Line_Item::type_tax ) ) ); |
|
| 642 | + return $this->line_items(array(array('LIN_type' => EEM_Line_Item::type_tax))); |
|
| 643 | 643 | } |
| 644 | 644 | |
| 645 | 645 | |
@@ -650,10 +650,10 @@ discard block |
||
| 650 | 650 | * @return EE_Line_Item |
| 651 | 651 | */ |
| 652 | 652 | public function total_line_item() { |
| 653 | - $item = $this->get_first_related( 'Line_Item', array( array( 'LIN_type' => EEM_Line_Item::type_total ) ) ); |
|
| 654 | - if( ! $item ){ |
|
| 655 | - EE_Registry::instance()->load_helper( 'Line_Item' ); |
|
| 656 | - $item = EEH_Line_Item::create_total_line_item( $this ); |
|
| 653 | + $item = $this->get_first_related('Line_Item', array(array('LIN_type' => EEM_Line_Item::type_total))); |
|
| 654 | + if ( ! $item) { |
|
| 655 | + EE_Registry::instance()->load_helper('Line_Item'); |
|
| 656 | + $item = EEH_Line_Item::create_total_line_item($this); |
|
| 657 | 657 | } |
| 658 | 658 | return $item; |
| 659 | 659 | } |
@@ -667,7 +667,7 @@ discard block |
||
| 667 | 667 | */ |
| 668 | 668 | public function tax_total() { |
| 669 | 669 | $tax_line_item = $this->tax_total_line_item(); |
| 670 | - if ( $tax_line_item ) { |
|
| 670 | + if ($tax_line_item) { |
|
| 671 | 671 | return $tax_line_item->total(); |
| 672 | 672 | } else { |
| 673 | 673 | return 0; |
@@ -681,7 +681,7 @@ discard block |
||
| 681 | 681 | * @return EE_Line_Item |
| 682 | 682 | */ |
| 683 | 683 | public function tax_total_line_item() { |
| 684 | - return EEH_Line_Item::get_taxes_subtotal( $this->total_line_item() ); |
|
| 684 | + return EEH_Line_Item::get_taxes_subtotal($this->total_line_item()); |
|
| 685 | 685 | } |
| 686 | 686 | |
| 687 | 687 | |
@@ -690,20 +690,20 @@ discard block |
||
| 690 | 690 | * Gets the array of billing info for the gateway and for this transaction's primary registration's attendee. |
| 691 | 691 | * @return EE_Form_Section_Proper |
| 692 | 692 | */ |
| 693 | - public function billing_info(){ |
|
| 693 | + public function billing_info() { |
|
| 694 | 694 | $payment_method = $this->payment_method(); |
| 695 | - if ( !$payment_method){ |
|
| 695 | + if ( ! $payment_method) { |
|
| 696 | 696 | EE_Error::add_error(__("Could not find billing info for transaction because no gateway has been used for it yet", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
| 697 | 697 | return false; |
| 698 | 698 | } |
| 699 | 699 | $primary_reg = $this->primary_registration(); |
| 700 | - if ( ! $primary_reg ) { |
|
| 701 | - EE_Error::add_error( __( "Cannot get billing info for gateway %s on transaction because no primary registration exists", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 700 | + if ( ! $primary_reg) { |
|
| 701 | + EE_Error::add_error(__("Cannot get billing info for gateway %s on transaction because no primary registration exists", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
|
| 702 | 702 | return FALSE; |
| 703 | 703 | } |
| 704 | 704 | $attendee = $primary_reg->attendee(); |
| 705 | - if ( ! $attendee ) { |
|
| 706 | - EE_Error::add_error( __( "Cannot get billing info for gateway %s on transaction because the primary registration has no attendee exists", "event_espresso" ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 705 | + if ( ! $attendee) { |
|
| 706 | + EE_Error::add_error(__("Cannot get billing info for gateway %s on transaction because the primary registration has no attendee exists", "event_espresso"), __FILE__, __FUNCTION__, __LINE__); |
|
| 707 | 707 | return FALSE; |
| 708 | 708 | } |
| 709 | 709 | return $attendee->billing_info_for_payment_method($payment_method); |
@@ -738,15 +738,15 @@ discard block |
||
| 738 | 738 | * offline ones, dont' create payments) |
| 739 | 739 | * @return EE_Payment_Method |
| 740 | 740 | */ |
| 741 | - function payment_method(){ |
|
| 741 | + function payment_method() { |
|
| 742 | 742 | $pm = $this->get_first_related('Payment_Method'); |
| 743 | - if( $pm instanceof EE_Payment_Method ){ |
|
| 743 | + if ($pm instanceof EE_Payment_Method) { |
|
| 744 | 744 | return $pm; |
| 745 | - }else{ |
|
| 745 | + } else { |
|
| 746 | 746 | $last_payment = $this->last_payment(); |
| 747 | - if( $last_payment instanceof EE_Payment && $last_payment->payment_method() ){ |
|
| 747 | + if ($last_payment instanceof EE_Payment && $last_payment->payment_method()) { |
|
| 748 | 748 | return $last_payment->payment_method(); |
| 749 | - }else{ |
|
| 749 | + } else { |
|
| 750 | 750 | return NULL; |
| 751 | 751 | } |
| 752 | 752 | } |
@@ -757,15 +757,15 @@ discard block |
||
| 757 | 757 | * @return EE_Payment |
| 758 | 758 | */ |
| 759 | 759 | public function last_payment() { |
| 760 | - return $this->get_first_related( 'Payment', array( 'order_by' => array( 'PAY_ID' => 'desc' ) ) ); |
|
| 760 | + return $this->get_first_related('Payment', array('order_by' => array('PAY_ID' => 'desc'))); |
|
| 761 | 761 | } |
| 762 | 762 | |
| 763 | 763 | /** |
| 764 | 764 | * Gets all the line items which are unrelated to tickets on this transaction |
| 765 | 765 | * @return EE_Line_Item[] |
| 766 | 766 | */ |
| 767 | - public function non_ticket_line_items(){ |
|
| 768 | - return EEM_Line_Item::instance()->get_all_non_ticket_line_items_for_transaction( $this->ID() ); |
|
| 767 | + public function non_ticket_line_items() { |
|
| 768 | + return EEM_Line_Item::instance()->get_all_non_ticket_line_items_for_transaction($this->ID()); |
|
| 769 | 769 | } |
| 770 | 770 | |
| 771 | 771 | |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
| 2 | - exit( 'No direct script access allowed' ); |
|
| 1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | 3 | } |
| 4 | 4 | /** |
| 5 | 5 | * Event Espresso |
@@ -37,9 +37,9 @@ discard block |
||
| 37 | 37 | * date_format and the second value is the time format |
| 38 | 38 | * @return EE_Attendee |
| 39 | 39 | */ |
| 40 | - public static function new_instance( $props_n_values = array(), $timezone = null, $date_formats = array() ) { |
|
| 41 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone, $date_formats ); |
|
| 42 | - return $has_object ? $has_object : new self( $props_n_values, false, $timezone, $date_formats ); |
|
| 40 | + public static function new_instance($props_n_values = array(), $timezone = null, $date_formats = array()) { |
|
| 41 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
| 42 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
| 43 | 43 | } |
| 44 | 44 | |
| 45 | 45 | |
@@ -50,8 +50,8 @@ discard block |
||
| 50 | 50 | * the website will be used. |
| 51 | 51 | * @return EE_Attendee |
| 52 | 52 | */ |
| 53 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = null ) { |
|
| 54 | - return new self( $props_n_values, TRUE, $timezone ); |
|
| 53 | + public static function new_instance_from_db($props_n_values = array(), $timezone = null) { |
|
| 54 | + return new self($props_n_values, TRUE, $timezone); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | * @return string |
| 62 | 62 | */ |
| 63 | 63 | function name() { |
| 64 | - return $this->get( 'VNU_name' ); |
|
| 64 | + return $this->get('VNU_name'); |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | |
@@ -70,7 +70,7 @@ discard block |
||
| 70 | 70 | * @return string |
| 71 | 71 | */ |
| 72 | 72 | function phone() { |
| 73 | - return $this->get( 'VNU_phone' ); |
|
| 73 | + return $this->get('VNU_phone'); |
|
| 74 | 74 | } |
| 75 | 75 | |
| 76 | 76 | |
@@ -80,7 +80,7 @@ discard block |
||
| 80 | 80 | * @return string |
| 81 | 81 | */ |
| 82 | 82 | function venue_url() { |
| 83 | - return $this->get( 'VNU_url' ); |
|
| 83 | + return $this->get('VNU_url'); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | |
@@ -89,7 +89,7 @@ discard block |
||
| 89 | 89 | * @return string |
| 90 | 90 | */ |
| 91 | 91 | function description() { |
| 92 | - return $this->get( 'VNU_desc' ); |
|
| 92 | + return $this->get('VNU_desc'); |
|
| 93 | 93 | } |
| 94 | 94 | |
| 95 | 95 | |
@@ -99,7 +99,7 @@ discard block |
||
| 99 | 99 | * @return string |
| 100 | 100 | */ |
| 101 | 101 | function excerpt() { |
| 102 | - return $this->get( 'VNU_short_desc' ); |
|
| 102 | + return $this->get('VNU_short_desc'); |
|
| 103 | 103 | } |
| 104 | 104 | |
| 105 | 105 | |
@@ -109,7 +109,7 @@ discard block |
||
| 109 | 109 | * @return string |
| 110 | 110 | */ |
| 111 | 111 | function identifier() { |
| 112 | - return $this->get( 'VNU_identifier' ); |
|
| 112 | + return $this->get('VNU_identifier'); |
|
| 113 | 113 | } |
| 114 | 114 | |
| 115 | 115 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | * @return string |
| 120 | 120 | */ |
| 121 | 121 | function address() { |
| 122 | - return $this->get( 'VNU_address' ); |
|
| 122 | + return $this->get('VNU_address'); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | * @return string |
| 130 | 130 | */ |
| 131 | 131 | function address2() { |
| 132 | - return $this->get( 'VNU_address2' ); |
|
| 132 | + return $this->get('VNU_address2'); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | |
@@ -140,7 +140,7 @@ discard block |
||
| 140 | 140 | * @return string |
| 141 | 141 | */ |
| 142 | 142 | function city() { |
| 143 | - return $this->get( 'VNU_city' ); |
|
| 143 | + return $this->get('VNU_city'); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | /** |
@@ -148,7 +148,7 @@ discard block |
||
| 148 | 148 | * @return int |
| 149 | 149 | */ |
| 150 | 150 | function state_ID() { |
| 151 | - return $this->get( 'STA_ID' ); |
|
| 151 | + return $this->get('STA_ID'); |
|
| 152 | 152 | } |
| 153 | 153 | |
| 154 | 154 | |
@@ -157,7 +157,7 @@ discard block |
||
| 157 | 157 | * @return string |
| 158 | 158 | */ |
| 159 | 159 | public function state_abbrev() { |
| 160 | - return $this->state_obj() instanceof EE_State ? $this->state_obj()->abbrev() : __( 'Unknown', 'event_espresso' ); |
|
| 160 | + return $this->state_obj() instanceof EE_State ? $this->state_obj()->abbrev() : __('Unknown', 'event_espresso'); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | |
@@ -166,7 +166,7 @@ discard block |
||
| 166 | 166 | * @return string |
| 167 | 167 | */ |
| 168 | 168 | public function state_name() { |
| 169 | - return $this->state_obj() instanceof EE_State ? $this->state_obj()->name() : __( 'Unknown', 'event_espresso' ); |
|
| 169 | + return $this->state_obj() instanceof EE_State ? $this->state_obj()->name() : __('Unknown', 'event_espresso'); |
|
| 170 | 170 | } |
| 171 | 171 | |
| 172 | 172 | |
@@ -176,7 +176,7 @@ discard block |
||
| 176 | 176 | * @return EE_State |
| 177 | 177 | */ |
| 178 | 178 | function state_obj() { |
| 179 | - return $this->get_first_related( 'State' ); |
|
| 179 | + return $this->get_first_related('State'); |
|
| 180 | 180 | } |
| 181 | 181 | |
| 182 | 182 | |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | * @return string |
| 189 | 189 | */ |
| 190 | 190 | public function state() { |
| 191 | - if ( apply_filters( 'FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj() ) ) { |
|
| 191 | + if (apply_filters('FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj())) { |
|
| 192 | 192 | return $this->state_abbrev(); |
| 193 | 193 | } else { |
| 194 | 194 | return $this->state_name(); |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | * @return string |
| 203 | 203 | */ |
| 204 | 204 | function country_ID() { |
| 205 | - return $this->get( 'CNT_ISO' ); |
|
| 205 | + return $this->get('CNT_ISO'); |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | |
@@ -211,7 +211,7 @@ discard block |
||
| 211 | 211 | * @return string |
| 212 | 212 | */ |
| 213 | 213 | public function country_name() { |
| 214 | - return $this->country_obj() instanceof EE_Country ? $this->country_obj()->name() : __( 'Unknown', 'event_espresso' ); |
|
| 214 | + return $this->country_obj() instanceof EE_Country ? $this->country_obj()->name() : __('Unknown', 'event_espresso'); |
|
| 215 | 215 | } |
| 216 | 216 | |
| 217 | 217 | |
@@ -221,7 +221,7 @@ discard block |
||
| 221 | 221 | * @return EE_Country |
| 222 | 222 | */ |
| 223 | 223 | function country_obj() { |
| 224 | - return $this->get_first_related( 'Country' ); |
|
| 224 | + return $this->get_first_related('Country'); |
|
| 225 | 225 | } |
| 226 | 226 | |
| 227 | 227 | |
@@ -233,7 +233,7 @@ discard block |
||
| 233 | 233 | * @return string |
| 234 | 234 | */ |
| 235 | 235 | public function country() { |
| 236 | - if ( apply_filters( 'FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj() ) ) { |
|
| 236 | + if (apply_filters('FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj())) { |
|
| 237 | 237 | return $this->country_ID(); |
| 238 | 238 | } else { |
| 239 | 239 | return $this->country_name(); |
@@ -247,7 +247,7 @@ discard block |
||
| 247 | 247 | * @return string |
| 248 | 248 | */ |
| 249 | 249 | function zip() { |
| 250 | - return $this->get( 'VNU_zip' ); |
|
| 250 | + return $this->get('VNU_zip'); |
|
| 251 | 251 | } |
| 252 | 252 | |
| 253 | 253 | |
@@ -257,7 +257,7 @@ discard block |
||
| 257 | 257 | * @return int |
| 258 | 258 | */ |
| 259 | 259 | function capacity() { |
| 260 | - return $this->get_pretty( 'VNU_capacity', 'symbol' ); |
|
| 260 | + return $this->get_pretty('VNU_capacity', 'symbol'); |
|
| 261 | 261 | } |
| 262 | 262 | |
| 263 | 263 | |
@@ -267,7 +267,7 @@ discard block |
||
| 267 | 267 | * @return string |
| 268 | 268 | */ |
| 269 | 269 | function created() { |
| 270 | - return $this->get( 'VNU_created' ); |
|
| 270 | + return $this->get('VNU_created'); |
|
| 271 | 271 | } |
| 272 | 272 | |
| 273 | 273 | |
@@ -277,7 +277,7 @@ discard block |
||
| 277 | 277 | * @return string |
| 278 | 278 | */ |
| 279 | 279 | function modified() { |
| 280 | - return $this->get( 'VNU_modified' ); |
|
| 280 | + return $this->get('VNU_modified'); |
|
| 281 | 281 | } |
| 282 | 282 | |
| 283 | 283 | |
@@ -287,7 +287,7 @@ discard block |
||
| 287 | 287 | * @return int |
| 288 | 288 | */ |
| 289 | 289 | function order() { |
| 290 | - return $this->get( 'VNU_order' ); |
|
| 290 | + return $this->get('VNU_order'); |
|
| 291 | 291 | } |
| 292 | 292 | |
| 293 | 293 | |
@@ -297,7 +297,7 @@ discard block |
||
| 297 | 297 | * @return int |
| 298 | 298 | */ |
| 299 | 299 | function wp_user() { |
| 300 | - return $this->get( 'VNU_wp_user' ); |
|
| 300 | + return $this->get('VNU_wp_user'); |
|
| 301 | 301 | } |
| 302 | 302 | |
| 303 | 303 | |
@@ -306,7 +306,7 @@ discard block |
||
| 306 | 306 | * @return string |
| 307 | 307 | */ |
| 308 | 308 | function virtual_phone() { |
| 309 | - return $this->get( 'VNU_virtual_phone' ); |
|
| 309 | + return $this->get('VNU_virtual_phone'); |
|
| 310 | 310 | } |
| 311 | 311 | |
| 312 | 312 | |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | * @return string |
| 316 | 316 | */ |
| 317 | 317 | function virtual_url() { |
| 318 | - return $this->get( 'VNU_virtual_url' ); |
|
| 318 | + return $this->get('VNU_virtual_url'); |
|
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | * @return bool |
| 325 | 325 | */ |
| 326 | 326 | function enable_for_gmap() { |
| 327 | - return $this->get( 'VNU_enable_for_gmap' ); |
|
| 327 | + return $this->get('VNU_enable_for_gmap'); |
|
| 328 | 328 | } |
| 329 | 329 | |
| 330 | 330 | |
@@ -333,7 +333,7 @@ discard block |
||
| 333 | 333 | * @return string |
| 334 | 334 | */ |
| 335 | 335 | function google_map_link() { |
| 336 | - return $this->get( 'VNU_google_map_link' ); |
|
| 336 | + return $this->get('VNU_google_map_link'); |
|
| 337 | 337 | } |
| 338 | 338 | |
| 339 | 339 | |
@@ -345,16 +345,16 @@ discard block |
||
| 345 | 345 | * @param bool $upcoming |
| 346 | 346 | * @return EE_Event[] |
| 347 | 347 | */ |
| 348 | - function events( $query_params = array(), $upcoming = FALSE ) { |
|
| 349 | - if ( $upcoming ) { |
|
| 348 | + function events($query_params = array(), $upcoming = FALSE) { |
|
| 349 | + if ($upcoming) { |
|
| 350 | 350 | $query_params = array( |
| 351 | 351 | array( |
| 352 | 352 | 'status' => 'publish', |
| 353 | - 'Datetime.DTT_EVT_start' => array( '>', EEM_Datetime::instance()->current_time_for_query( 'DTT_EVT_start' ) ) |
|
| 353 | + 'Datetime.DTT_EVT_start' => array('>', EEM_Datetime::instance()->current_time_for_query('DTT_EVT_start')) |
|
| 354 | 354 | ) |
| 355 | 355 | ); |
| 356 | 356 | } |
| 357 | - return $this->get_many_related( 'Event', $query_params ); |
|
| 357 | + return $this->get_many_related('Event', $query_params); |
|
| 358 | 358 | } |
| 359 | 359 | |
| 360 | 360 | |
@@ -372,8 +372,8 @@ discard block |
||
| 372 | 372 | /** |
| 373 | 373 | * Sets address |
| 374 | 374 | */ |
| 375 | - function set_address( $address = '' ) { |
|
| 376 | - $this->set( 'VNU_address', $address ); |
|
| 375 | + function set_address($address = '') { |
|
| 376 | + $this->set('VNU_address', $address); |
|
| 377 | 377 | } |
| 378 | 378 | |
| 379 | 379 | |
@@ -381,8 +381,8 @@ discard block |
||
| 381 | 381 | /** |
| 382 | 382 | * @param string $address2 |
| 383 | 383 | */ |
| 384 | - function set_address2( $address2 = '' ) { |
|
| 385 | - $this->set( 'VNU_address2', $address2 ); |
|
| 384 | + function set_address2($address2 = '') { |
|
| 385 | + $this->set('VNU_address2', $address2); |
|
| 386 | 386 | } |
| 387 | 387 | |
| 388 | 388 | |
@@ -390,8 +390,8 @@ discard block |
||
| 390 | 390 | /** |
| 391 | 391 | * @param string $city |
| 392 | 392 | */ |
| 393 | - function set_city( $city = '' ) { |
|
| 394 | - $this->set( 'VNU_city', $city ); |
|
| 393 | + function set_city($city = '') { |
|
| 394 | + $this->set('VNU_city', $city); |
|
| 395 | 395 | } |
| 396 | 396 | |
| 397 | 397 | |
@@ -399,8 +399,8 @@ discard block |
||
| 399 | 399 | /** |
| 400 | 400 | * @param int $state |
| 401 | 401 | */ |
| 402 | - function set_state_ID( $state = 0 ) { |
|
| 403 | - $this->set( 'STA_ID', $state ); |
|
| 402 | + function set_state_ID($state = 0) { |
|
| 403 | + $this->set('STA_ID', $state); |
|
| 404 | 404 | } |
| 405 | 405 | |
| 406 | 406 | |
@@ -411,8 +411,8 @@ discard block |
||
| 411 | 411 | * @param EE_State /int $state_id_or_obj |
| 412 | 412 | * @return EE_State |
| 413 | 413 | */ |
| 414 | - function set_state_obj( $state_id_or_obj ) { |
|
| 415 | - return $this->_add_relation_to( $state_id_or_obj, 'State' ); |
|
| 414 | + function set_state_obj($state_id_or_obj) { |
|
| 415 | + return $this->_add_relation_to($state_id_or_obj, 'State'); |
|
| 416 | 416 | } |
| 417 | 417 | |
| 418 | 418 | |
@@ -420,8 +420,8 @@ discard block |
||
| 420 | 420 | /** |
| 421 | 421 | * @param int $country_ID |
| 422 | 422 | */ |
| 423 | - function set_country_ID( $country_ID = 0 ) { |
|
| 424 | - $this->set( 'CNT_ISO', $country_ID ); |
|
| 423 | + function set_country_ID($country_ID = 0) { |
|
| 424 | + $this->set('CNT_ISO', $country_ID); |
|
| 425 | 425 | } |
| 426 | 426 | |
| 427 | 427 | |
@@ -430,7 +430,7 @@ discard block |
||
| 430 | 430 | * @param EE_Country /string $country_id_or_obj |
| 431 | 431 | * @return EE_Country |
| 432 | 432 | */ |
| 433 | - function set_country_obj( $country_id_or_obj ) { |
|
| 433 | + function set_country_obj($country_id_or_obj) { |
|
| 434 | 434 | return $this->_add_relation_to($country_id_or_obj, 'Country'); |
| 435 | 435 | } |
| 436 | 436 | |
@@ -439,8 +439,8 @@ discard block |
||
| 439 | 439 | /** |
| 440 | 440 | * @param string $zip |
| 441 | 441 | */ |
| 442 | - function set_zip( $zip = '' ) { |
|
| 443 | - $this->set( 'VNU_zip', $zip ); |
|
| 442 | + function set_zip($zip = '') { |
|
| 443 | + $this->set('VNU_zip', $zip); |
|
| 444 | 444 | } |
| 445 | 445 | |
| 446 | 446 | |
@@ -448,8 +448,8 @@ discard block |
||
| 448 | 448 | /** |
| 449 | 449 | * @param int $capacity |
| 450 | 450 | */ |
| 451 | - function set_capacity( $capacity = 0 ) { |
|
| 452 | - $this->set( 'VNU_capacity', $capacity ); |
|
| 451 | + function set_capacity($capacity = 0) { |
|
| 452 | + $this->set('VNU_capacity', $capacity); |
|
| 453 | 453 | } |
| 454 | 454 | |
| 455 | 455 | |
@@ -457,8 +457,8 @@ discard block |
||
| 457 | 457 | /** |
| 458 | 458 | * @param string $created |
| 459 | 459 | */ |
| 460 | - function set_created( $created = '' ) { |
|
| 461 | - $this->set( 'VNU_created', $created ); |
|
| 460 | + function set_created($created = '') { |
|
| 461 | + $this->set('VNU_created', $created); |
|
| 462 | 462 | } |
| 463 | 463 | |
| 464 | 464 | |
@@ -466,8 +466,8 @@ discard block |
||
| 466 | 466 | /** |
| 467 | 467 | * @param string $desc |
| 468 | 468 | */ |
| 469 | - function set_description( $desc = '' ) { |
|
| 470 | - $this->set( 'VNU_desc', $desc ); |
|
| 469 | + function set_description($desc = '') { |
|
| 470 | + $this->set('VNU_desc', $desc); |
|
| 471 | 471 | } |
| 472 | 472 | |
| 473 | 473 | |
@@ -475,8 +475,8 @@ discard block |
||
| 475 | 475 | /** |
| 476 | 476 | * @param string $identifier |
| 477 | 477 | */ |
| 478 | - function set_identifier( $identifier = '' ) { |
|
| 479 | - $this->set( 'VNU_identifier', $identifier ); |
|
| 478 | + function set_identifier($identifier = '') { |
|
| 479 | + $this->set('VNU_identifier', $identifier); |
|
| 480 | 480 | } |
| 481 | 481 | |
| 482 | 482 | |
@@ -484,8 +484,8 @@ discard block |
||
| 484 | 484 | /** |
| 485 | 485 | * @param string $modified |
| 486 | 486 | */ |
| 487 | - function set_modified( $modified = '' ) { |
|
| 488 | - $this->set( 'VNU_modified', $modified ); |
|
| 487 | + function set_modified($modified = '') { |
|
| 488 | + $this->set('VNU_modified', $modified); |
|
| 489 | 489 | } |
| 490 | 490 | |
| 491 | 491 | |
@@ -493,8 +493,8 @@ discard block |
||
| 493 | 493 | /** |
| 494 | 494 | * @param string $name |
| 495 | 495 | */ |
| 496 | - function set_name( $name = '' ) { |
|
| 497 | - $this->set( 'VNU_name', $name ); |
|
| 496 | + function set_name($name = '') { |
|
| 497 | + $this->set('VNU_name', $name); |
|
| 498 | 498 | } |
| 499 | 499 | |
| 500 | 500 | |
@@ -502,8 +502,8 @@ discard block |
||
| 502 | 502 | /** |
| 503 | 503 | * @param int $order |
| 504 | 504 | */ |
| 505 | - function set_order( $order = 0 ) { |
|
| 506 | - $this->set( 'VNU_order', $order ); |
|
| 505 | + function set_order($order = 0) { |
|
| 506 | + $this->set('VNU_order', $order); |
|
| 507 | 507 | } |
| 508 | 508 | |
| 509 | 509 | |
@@ -511,8 +511,8 @@ discard block |
||
| 511 | 511 | /** |
| 512 | 512 | * @param string $phone |
| 513 | 513 | */ |
| 514 | - function set_phone( $phone = '' ) { |
|
| 515 | - $this->set( 'VNU_phone', $phone ); |
|
| 514 | + function set_phone($phone = '') { |
|
| 515 | + $this->set('VNU_phone', $phone); |
|
| 516 | 516 | } |
| 517 | 517 | |
| 518 | 518 | |
@@ -520,8 +520,8 @@ discard block |
||
| 520 | 520 | /** |
| 521 | 521 | * @param int $wp_user |
| 522 | 522 | */ |
| 523 | - function set_wp_user( $wp_user = 1 ) { |
|
| 524 | - $this->set( 'VNU_wp_user', $wp_user ); |
|
| 523 | + function set_wp_user($wp_user = 1) { |
|
| 524 | + $this->set('VNU_wp_user', $wp_user); |
|
| 525 | 525 | } |
| 526 | 526 | |
| 527 | 527 | |
@@ -529,8 +529,8 @@ discard block |
||
| 529 | 529 | /** |
| 530 | 530 | * @param string $url |
| 531 | 531 | */ |
| 532 | - function set_venue_url( $url = '' ) { |
|
| 533 | - $this->set( 'VNU_url', $url ); |
|
| 532 | + function set_venue_url($url = '') { |
|
| 533 | + $this->set('VNU_url', $url); |
|
| 534 | 534 | } |
| 535 | 535 | |
| 536 | 536 | |
@@ -538,8 +538,8 @@ discard block |
||
| 538 | 538 | /** |
| 539 | 539 | * @param string $phone |
| 540 | 540 | */ |
| 541 | - function set_virtual_phone( $phone = '' ) { |
|
| 542 | - $this->set( 'VNU_virtual_phone', $phone ); |
|
| 541 | + function set_virtual_phone($phone = '') { |
|
| 542 | + $this->set('VNU_virtual_phone', $phone); |
|
| 543 | 543 | } |
| 544 | 544 | |
| 545 | 545 | |
@@ -547,8 +547,8 @@ discard block |
||
| 547 | 547 | /** |
| 548 | 548 | * @param string $url |
| 549 | 549 | */ |
| 550 | - function set_virtual_url( $url = '' ) { |
|
| 551 | - $this->set( 'VNU_virtual_url', $url ); |
|
| 550 | + function set_virtual_url($url = '') { |
|
| 551 | + $this->set('VNU_virtual_url', $url); |
|
| 552 | 552 | } |
| 553 | 553 | |
| 554 | 554 | |
@@ -556,8 +556,8 @@ discard block |
||
| 556 | 556 | /** |
| 557 | 557 | * @param string $enable |
| 558 | 558 | */ |
| 559 | - function set_enable_for_gmap( $enable = '' ) { |
|
| 560 | - $this->set( 'VNU_enable_for_gmap', $enable ); |
|
| 559 | + function set_enable_for_gmap($enable = '') { |
|
| 560 | + $this->set('VNU_enable_for_gmap', $enable); |
|
| 561 | 561 | } |
| 562 | 562 | |
| 563 | 563 | |
@@ -565,8 +565,8 @@ discard block |
||
| 565 | 565 | /** |
| 566 | 566 | * @param string $google_map_link |
| 567 | 567 | */ |
| 568 | - function set_google_map_link( $google_map_link = '' ) { |
|
| 569 | - $this->set( 'VNU_google_map_link', $google_map_link ); |
|
| 568 | + function set_google_map_link($google_map_link = '') { |
|
| 569 | + $this->set('VNU_google_map_link', $google_map_link); |
|
| 570 | 570 | } |
| 571 | 571 | |
| 572 | 572 | |
@@ -35,35 +35,35 @@ discard block |
||
| 35 | 35 | */ |
| 36 | 36 | public static function get_called_class() { |
| 37 | 37 | $backtrace = debug_backtrace(); |
| 38 | - if ( isset( $backtrace[2] ) && is_array( $backtrace[2] ) && isset( $backtrace[2]['class'] ) && ! isset( $backtrace[2]['file'] )) { |
|
| 38 | + if (isset($backtrace[2]) && is_array($backtrace[2]) && isset($backtrace[2]['class']) && ! isset($backtrace[2]['file'])) { |
|
| 39 | 39 | return $backtrace[2]['class']; |
| 40 | - } else if ( isset( $backtrace[3] ) && is_array( $backtrace[3] ) && isset( $backtrace[3]['class'] ) && ! isset( $backtrace[3]['file'] )) { |
|
| 40 | + } else if (isset($backtrace[3]) && is_array($backtrace[3]) && isset($backtrace[3]['class']) && ! isset($backtrace[3]['file'])) { |
|
| 41 | 41 | return $backtrace[3]['class']; |
| 42 | - } else if ( isset( $backtrace[2] ) && is_array( $backtrace[2] ) && isset( $backtrace[2]['file'] ) && isset( $backtrace[2]['line'] )) { |
|
| 43 | - if ( self::$file_line == $backtrace[2]['file'] . $backtrace[2]['line'] ) { |
|
| 42 | + } else if (isset($backtrace[2]) && is_array($backtrace[2]) && isset($backtrace[2]['file']) && isset($backtrace[2]['line'])) { |
|
| 43 | + if (self::$file_line == $backtrace[2]['file'].$backtrace[2]['line']) { |
|
| 44 | 44 | self::$i++; |
| 45 | 45 | } else { |
| 46 | 46 | self::$i = 0; |
| 47 | - self::$file_line = $backtrace[2]['file'] . $backtrace[2]['line']; |
|
| 47 | + self::$file_line = $backtrace[2]['file'].$backtrace[2]['line']; |
|
| 48 | 48 | } |
| 49 | 49 | // was class method called via call_user_func ? |
| 50 | - if ( $backtrace[2]['function'] == 'call_user_func' && isset( $backtrace[2]['args'] ) && is_array( $backtrace[2]['args'] )){ |
|
| 51 | - if ( isset( $backtrace[2]['args'][0] ) && isset( $backtrace[2]['args'][0][0] )) { |
|
| 50 | + if ($backtrace[2]['function'] == 'call_user_func' && isset($backtrace[2]['args']) && is_array($backtrace[2]['args'])) { |
|
| 51 | + if (isset($backtrace[2]['args'][0]) && isset($backtrace[2]['args'][0][0])) { |
|
| 52 | 52 | $called_class = $backtrace[2]['args'][0][0]; |
| 53 | 53 | // is it an EE function ? |
| 54 | - if ( strpos( $called_class, 'EE' ) === 0 ) { |
|
| 55 | - $prefix_chars = strpos( $called_class, '_' ) + 1; |
|
| 56 | - $prefix = substr( $called_class, 0, $prefix_chars ); |
|
| 57 | - $classname = substr( $called_class, $prefix_chars, strlen( $called_class )); |
|
| 58 | - $classname = $prefix . str_replace( ' ', '_', ucwords( strtolower( str_replace( '_', ' ', $classname )))); |
|
| 54 | + if (strpos($called_class, 'EE') === 0) { |
|
| 55 | + $prefix_chars = strpos($called_class, '_') + 1; |
|
| 56 | + $prefix = substr($called_class, 0, $prefix_chars); |
|
| 57 | + $classname = substr($called_class, $prefix_chars, strlen($called_class)); |
|
| 58 | + $classname = $prefix.str_replace(' ', '_', ucwords(strtolower(str_replace('_', ' ', $classname)))); |
|
| 59 | 59 | return $classname; |
| 60 | 60 | } |
| 61 | 61 | } |
| 62 | 62 | } else { |
| 63 | - $lines = file( $backtrace[2]['file'] ); |
|
| 64 | - preg_match_all( '/([a-zA-Z0-9\_]+)::' . $backtrace[2]['function'] . '/', $lines[$backtrace[2]['line']-1], $matches ); |
|
| 65 | - if ( isset( $matches[1] ) && isset( $matches[1][ self::$i ] )) { |
|
| 66 | - return $matches[1][ self::$i ]; |
|
| 63 | + $lines = file($backtrace[2]['file']); |
|
| 64 | + preg_match_all('/([a-zA-Z0-9\_]+)::'.$backtrace[2]['function'].'/', $lines[$backtrace[2]['line'] - 1], $matches); |
|
| 65 | + if (isset($matches[1]) && isset($matches[1][self::$i])) { |
|
| 66 | + return $matches[1][self::$i]; |
|
| 67 | 67 | } |
| 68 | 68 | } |
| 69 | 69 | } |
@@ -80,22 +80,22 @@ discard block |
||
| 80 | 80 | * @param string $hook |
| 81 | 81 | * @return array |
| 82 | 82 | */ |
| 83 | - public static function get_class_names_for_all_callbacks_on_hook( $hook = NULL ) { |
|
| 83 | + public static function get_class_names_for_all_callbacks_on_hook($hook = NULL) { |
|
| 84 | 84 | global $wp_filter; |
| 85 | 85 | $class_names = array(); |
| 86 | 86 | // are any callbacks registered for this hook ? |
| 87 | - if ( isset( $wp_filter[ $hook ] )) { |
|
| 87 | + if (isset($wp_filter[$hook])) { |
|
| 88 | 88 | // loop thru all of the callbacks attached to the deprecated hookpoint |
| 89 | - foreach( $wp_filter[ $hook ] as $priority ) { |
|
| 90 | - foreach( $priority as $callback ) { |
|
| 89 | + foreach ($wp_filter[$hook] as $priority) { |
|
| 90 | + foreach ($priority as $callback) { |
|
| 91 | 91 | // is the callback a non-static class method ? |
| 92 | - if ( isset( $callback['function'] ) && is_array( $callback['function'] )) { |
|
| 93 | - if ( isset( $callback['function'][0] ) && is_object( $callback['function'][0] )) { |
|
| 94 | - $class_names[] = get_class( $callback['function'][0] ); |
|
| 92 | + if (isset($callback['function']) && is_array($callback['function'])) { |
|
| 93 | + if (isset($callback['function'][0]) && is_object($callback['function'][0])) { |
|
| 94 | + $class_names[] = get_class($callback['function'][0]); |
|
| 95 | 95 | } |
| 96 | 96 | // test for static method |
| 97 | - } else if ( strpos( $callback['function'], '::' ) !== FALSE ) { |
|
| 98 | - $class = explode( '::', $callback['function'] ); |
|
| 97 | + } else if (strpos($callback['function'], '::') !== FALSE) { |
|
| 98 | + $class = explode('::', $callback['function']); |
|
| 99 | 99 | $class_names[] = $class[0]; |
| 100 | 100 | } else { |
| 101 | 101 | // just a function |
@@ -116,24 +116,24 @@ discard block |
||
| 116 | 116 | * @param string $property |
| 117 | 117 | * @return boolean |
| 118 | 118 | */ |
| 119 | - public static function has_property( $class = NULL, $property = NULL ) { |
|
| 119 | + public static function has_property($class = NULL, $property = NULL) { |
|
| 120 | 120 | // if $class or $property don't exist, then get out, cuz that would be like... fatal dude |
| 121 | - if ( empty( $class ) || empty( $property )) { |
|
| 121 | + if (empty($class) || empty($property)) { |
|
| 122 | 122 | return FALSE; |
| 123 | 123 | } |
| 124 | 124 | // if your hosting company doesn't cut the mustard |
| 125 | - if ( version_compare( PHP_VERSION, '5.3.0' ) < 0 ) { |
|
| 125 | + if (version_compare(PHP_VERSION, '5.3.0') < 0) { |
|
| 126 | 126 | // just in case $class is an actual instantiated object |
| 127 | - if ( is_object( $class )) { |
|
| 128 | - return isset( $class->{$property} ) ? TRUE : FALSE; |
|
| 127 | + if (is_object($class)) { |
|
| 128 | + return isset($class->{$property} ) ? TRUE : FALSE; |
|
| 129 | 129 | } else { |
| 130 | 130 | // use reflection for < PHP 5.3 to get details using just the class name |
| 131 | - $reflector = new ReflectionClass( $class ); |
|
| 132 | - return $reflector->hasProperty( $property ); |
|
| 131 | + $reflector = new ReflectionClass($class); |
|
| 132 | + return $reflector->hasProperty($property); |
|
| 133 | 133 | } |
| 134 | 134 | } else { |
| 135 | 135 | // or try regular property exists method which works as expected in PHP 5.3+ |
| 136 | - return property_exists( $class, $property ); |
|
| 136 | + return property_exists($class, $property); |
|
| 137 | 137 | } |
| 138 | 138 | } |
| 139 | 139 | |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | |
| 144 | 144 | |
| 145 | 145 | // if PHP version < 5.3 |
| 146 | -if ( ! function_exists( 'get_called_class' )) { |
|
| 146 | +if ( ! function_exists('get_called_class')) { |
|
| 147 | 147 | /** |
| 148 | 148 | * @return bool|string |
| 149 | 149 | */ |