@@ -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 |
@@ -31,9 +31,9 @@ discard block |
||
| 31 | 31 | * @param null $timezone |
| 32 | 32 | * @return EE_Datetime_Ticket|mixed |
| 33 | 33 | */ |
| 34 | - public static function new_instance( $props_n_values = array(), $timezone = NULL ) { |
|
| 35 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone ); |
|
| 36 | - return $has_object ? $has_object : new self( $props_n_values, FALSE, $timezone ); |
|
| 34 | + public static function new_instance($props_n_values = array(), $timezone = NULL) { |
|
| 35 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone); |
|
| 36 | + return $has_object ? $has_object : new self($props_n_values, FALSE, $timezone); |
|
| 37 | 37 | } |
| 38 | 38 | |
| 39 | 39 | |
@@ -43,7 +43,7 @@ discard block |
||
| 43 | 43 | * @param null $timezone |
| 44 | 44 | * @return EE_Datetime_Ticket |
| 45 | 45 | */ |
| 46 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = NULL ) { |
|
| 47 | - return new self( $props_n_values, TRUE, $timezone ); |
|
| 46 | + public static function new_instance_from_db($props_n_values = array(), $timezone = NULL) { |
|
| 47 | + return new self($props_n_values, TRUE, $timezone); |
|
| 48 | 48 | } |
| 49 | 49 | } //end EE_Datetime_Ticket class |
| 50 | 50 | \ No newline at end of file |
@@ -861,7 +861,7 @@ |
||
| 861 | 861 | |
| 862 | 862 | if ( $child_line_item->type() == EEM_Line_Item::type_line_item && $child_line_item->is_taxable()) { |
| 863 | 863 | $total += $child_line_item->total(); |
| 864 | - }elseif( $child_line_item->type() == EEM_Line_Item::type_sub_total ){ |
|
| 864 | + } elseif( $child_line_item->type() == EEM_Line_Item::type_sub_total ){ |
|
| 865 | 865 | $total += $child_line_item->taxable_total(); |
| 866 | 866 | } |
| 867 | 867 | } |
@@ -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 |
@@ -41,9 +41,9 @@ discard block |
||
| 41 | 41 | * @param string $timezone |
| 42 | 42 | * @return EE_Line_Item |
| 43 | 43 | */ |
| 44 | - public static function new_instance( $props_n_values = array(), $timezone = '' ) { |
|
| 45 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone ); |
|
| 46 | - return $has_object ? $has_object : new self( $props_n_values, FALSE, $timezone ); |
|
| 44 | + public static function new_instance($props_n_values = array(), $timezone = '') { |
|
| 45 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone); |
|
| 46 | + return $has_object ? $has_object : new self($props_n_values, FALSE, $timezone); |
|
| 47 | 47 | } |
| 48 | 48 | |
| 49 | 49 | |
@@ -53,8 +53,8 @@ discard block |
||
| 53 | 53 | * @param string $timezone |
| 54 | 54 | * @return EE_Line_Item |
| 55 | 55 | */ |
| 56 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = '' ) { |
|
| 57 | - return new self( $props_n_values, TRUE, $timezone ); |
|
| 56 | + public static function new_instance_from_db($props_n_values = array(), $timezone = '') { |
|
| 57 | + return new self($props_n_values, TRUE, $timezone); |
|
| 58 | 58 | } |
| 59 | 59 | |
| 60 | 60 | |
@@ -65,10 +65,10 @@ discard block |
||
| 65 | 65 | * @param bool $bydb |
| 66 | 66 | * @param string $timezone |
| 67 | 67 | */ |
| 68 | - protected function __construct( $fieldValues = array(), $bydb = FALSE, $timezone = '' ) { |
|
| 69 | - parent::__construct( $fieldValues, $bydb, $timezone ); |
|
| 70 | - if ( !$this->get( 'LIN_code' ) ) { |
|
| 71 | - $this->set_code( $this->generate_code() ); |
|
| 68 | + protected function __construct($fieldValues = array(), $bydb = FALSE, $timezone = '') { |
|
| 69 | + parent::__construct($fieldValues, $bydb, $timezone); |
|
| 70 | + if ( ! $this->get('LIN_code')) { |
|
| 71 | + $this->set_code($this->generate_code()); |
|
| 72 | 72 | } |
| 73 | 73 | } |
| 74 | 74 | |
@@ -79,7 +79,7 @@ discard block |
||
| 79 | 79 | * @return int |
| 80 | 80 | */ |
| 81 | 81 | function TXN_ID() { |
| 82 | - return $this->get( 'TXN_ID' ); |
|
| 82 | + return $this->get('TXN_ID'); |
|
| 83 | 83 | } |
| 84 | 84 | |
| 85 | 85 | |
@@ -89,8 +89,8 @@ discard block |
||
| 89 | 89 | * @param int $TXN_ID |
| 90 | 90 | * @return boolean |
| 91 | 91 | */ |
| 92 | - function set_TXN_ID( $TXN_ID ) { |
|
| 93 | - $this->set( 'TXN_ID', $TXN_ID ); |
|
| 92 | + function set_TXN_ID($TXN_ID) { |
|
| 93 | + $this->set('TXN_ID', $TXN_ID); |
|
| 94 | 94 | } |
| 95 | 95 | |
| 96 | 96 | |
@@ -100,9 +100,9 @@ discard block |
||
| 100 | 100 | * @return string |
| 101 | 101 | */ |
| 102 | 102 | function name() { |
| 103 | - $name = $this->get( 'LIN_name' ); |
|
| 104 | - if( ! $name ){ |
|
| 105 | - $name = ucwords( str_replace( '-', ' ', $this->type() ) ); |
|
| 103 | + $name = $this->get('LIN_name'); |
|
| 104 | + if ( ! $name) { |
|
| 105 | + $name = ucwords(str_replace('-', ' ', $this->type())); |
|
| 106 | 106 | } |
| 107 | 107 | return $name; |
| 108 | 108 | } |
@@ -114,8 +114,8 @@ discard block |
||
| 114 | 114 | * @param string $name |
| 115 | 115 | * @return boolean |
| 116 | 116 | */ |
| 117 | - function set_name( $name ) { |
|
| 118 | - $this->set( 'LIN_name', $name ); |
|
| 117 | + function set_name($name) { |
|
| 118 | + $this->set('LIN_name', $name); |
|
| 119 | 119 | } |
| 120 | 120 | |
| 121 | 121 | |
@@ -125,7 +125,7 @@ discard block |
||
| 125 | 125 | * @return string |
| 126 | 126 | */ |
| 127 | 127 | function desc() { |
| 128 | - return $this->get( 'LIN_desc' ); |
|
| 128 | + return $this->get('LIN_desc'); |
|
| 129 | 129 | } |
| 130 | 130 | |
| 131 | 131 | |
@@ -135,8 +135,8 @@ discard block |
||
| 135 | 135 | * @param string $desc |
| 136 | 136 | * @return boolean |
| 137 | 137 | */ |
| 138 | - function set_desc( $desc ) { |
|
| 139 | - $this->set( 'LIN_desc', $desc ); |
|
| 138 | + function set_desc($desc) { |
|
| 139 | + $this->set('LIN_desc', $desc); |
|
| 140 | 140 | } |
| 141 | 141 | |
| 142 | 142 | |
@@ -146,7 +146,7 @@ discard block |
||
| 146 | 146 | * @return int |
| 147 | 147 | */ |
| 148 | 148 | function quantity() { |
| 149 | - return $this->get( 'LIN_quantity' ); |
|
| 149 | + return $this->get('LIN_quantity'); |
|
| 150 | 150 | } |
| 151 | 151 | |
| 152 | 152 | |
@@ -156,8 +156,8 @@ discard block |
||
| 156 | 156 | * @param int $quantity |
| 157 | 157 | * @return boolean |
| 158 | 158 | */ |
| 159 | - function set_quantity( $quantity ) { |
|
| 160 | - $this->set( 'LIN_quantity', $quantity ); |
|
| 159 | + function set_quantity($quantity) { |
|
| 160 | + $this->set('LIN_quantity', $quantity); |
|
| 161 | 161 | } |
| 162 | 162 | |
| 163 | 163 | |
@@ -167,7 +167,7 @@ discard block |
||
| 167 | 167 | * @return string |
| 168 | 168 | */ |
| 169 | 169 | function OBJ_ID() { |
| 170 | - return $this->get( 'OBJ_ID' ); |
|
| 170 | + return $this->get('OBJ_ID'); |
|
| 171 | 171 | } |
| 172 | 172 | |
| 173 | 173 | |
@@ -177,8 +177,8 @@ discard block |
||
| 177 | 177 | * @param string $item_id |
| 178 | 178 | * @return boolean |
| 179 | 179 | */ |
| 180 | - function set_OBJ_ID( $item_id ) { |
|
| 181 | - $this->set( 'OBJ_ID', $item_id ); |
|
| 180 | + function set_OBJ_ID($item_id) { |
|
| 181 | + $this->set('OBJ_ID', $item_id); |
|
| 182 | 182 | } |
| 183 | 183 | |
| 184 | 184 | |
@@ -188,7 +188,7 @@ discard block |
||
| 188 | 188 | * @return string |
| 189 | 189 | */ |
| 190 | 190 | function OBJ_type() { |
| 191 | - return $this->get( 'OBJ_type' ); |
|
| 191 | + return $this->get('OBJ_type'); |
|
| 192 | 192 | } |
| 193 | 193 | |
| 194 | 194 | |
@@ -198,8 +198,8 @@ discard block |
||
| 198 | 198 | * @param string $OBJ_type |
| 199 | 199 | * @return boolean |
| 200 | 200 | */ |
| 201 | - function set_OBJ_type( $OBJ_type ) { |
|
| 202 | - $this->set( 'OBJ_type', $OBJ_type ); |
|
| 201 | + function set_OBJ_type($OBJ_type) { |
|
| 202 | + $this->set('OBJ_type', $OBJ_type); |
|
| 203 | 203 | } |
| 204 | 204 | |
| 205 | 205 | |
@@ -209,7 +209,7 @@ discard block |
||
| 209 | 209 | * @return float |
| 210 | 210 | */ |
| 211 | 211 | function unit_price() { |
| 212 | - return $this->get( 'LIN_unit_price' ); |
|
| 212 | + return $this->get('LIN_unit_price'); |
|
| 213 | 213 | } |
| 214 | 214 | |
| 215 | 215 | |
@@ -219,8 +219,8 @@ discard block |
||
| 219 | 219 | * @param float $unit_price |
| 220 | 220 | * @return boolean |
| 221 | 221 | */ |
| 222 | - function set_unit_price( $unit_price ) { |
|
| 223 | - $this->set( 'LIN_unit_price', $unit_price ); |
|
| 222 | + function set_unit_price($unit_price) { |
|
| 223 | + $this->set('LIN_unit_price', $unit_price); |
|
| 224 | 224 | } |
| 225 | 225 | |
| 226 | 226 | |
@@ -231,14 +231,14 @@ discard block |
||
| 231 | 231 | * @return boolean |
| 232 | 232 | */ |
| 233 | 233 | function is_percent() { |
| 234 | - $unit_price = $this->get( 'LIN_unit_price' ); |
|
| 235 | - $percent = $this->get( 'LIN_percent' ); |
|
| 236 | - if ( $unit_price < .001 && $percent ) { |
|
| 234 | + $unit_price = $this->get('LIN_unit_price'); |
|
| 235 | + $percent = $this->get('LIN_percent'); |
|
| 236 | + if ($unit_price < .001 && $percent) { |
|
| 237 | 237 | return TRUE; |
| 238 | - } elseif ( $unit_price >= .001 && !$percent ) { |
|
| 238 | + } elseif ($unit_price >= .001 && ! $percent) { |
|
| 239 | 239 | return FALSE; |
| 240 | - } elseif ( $unit_price >= .001 && $percent ) { |
|
| 241 | - 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 ) ); |
|
| 240 | + } elseif ($unit_price >= .001 && $percent) { |
|
| 241 | + 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)); |
|
| 242 | 242 | } else { |
| 243 | 243 | // if they're both 0, assume its not a percent item |
| 244 | 244 | return FALSE; |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | * @return float |
| 253 | 253 | */ |
| 254 | 254 | function percent() { |
| 255 | - return $this->get( 'LIN_percent' ); |
|
| 255 | + return $this->get('LIN_percent'); |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | |
@@ -262,8 +262,8 @@ discard block |
||
| 262 | 262 | * @param float $percent |
| 263 | 263 | * @return boolean |
| 264 | 264 | */ |
| 265 | - function set_percent( $percent ) { |
|
| 266 | - $this->set( 'LIN_percent', $percent ); |
|
| 265 | + function set_percent($percent) { |
|
| 266 | + $this->set('LIN_percent', $percent); |
|
| 267 | 267 | } |
| 268 | 268 | |
| 269 | 269 | |
@@ -273,7 +273,7 @@ discard block |
||
| 273 | 273 | * @return float |
| 274 | 274 | */ |
| 275 | 275 | function total() { |
| 276 | - return $this->get( 'LIN_total' ); |
|
| 276 | + return $this->get('LIN_total'); |
|
| 277 | 277 | } |
| 278 | 278 | |
| 279 | 279 | |
@@ -283,8 +283,8 @@ discard block |
||
| 283 | 283 | * @param float $total |
| 284 | 284 | * @return boolean |
| 285 | 285 | */ |
| 286 | - function set_total( $total ) { |
|
| 287 | - $this->set( 'LIN_total', $total ); |
|
| 286 | + function set_total($total) { |
|
| 287 | + $this->set('LIN_total', $total); |
|
| 288 | 288 | } |
| 289 | 289 | |
| 290 | 290 | |
@@ -294,7 +294,7 @@ discard block |
||
| 294 | 294 | * @return int |
| 295 | 295 | */ |
| 296 | 296 | function parent_ID() { |
| 297 | - return $this->get( 'LIN_parent' ); |
|
| 297 | + return $this->get('LIN_parent'); |
|
| 298 | 298 | } |
| 299 | 299 | |
| 300 | 300 | |
@@ -304,8 +304,8 @@ discard block |
||
| 304 | 304 | * @param int $parent |
| 305 | 305 | * @return boolean |
| 306 | 306 | */ |
| 307 | - function set_parent_ID( $parent ) { |
|
| 308 | - $this->set( 'LIN_parent', $parent ); |
|
| 307 | + function set_parent_ID($parent) { |
|
| 308 | + $this->set('LIN_parent', $parent); |
|
| 309 | 309 | } |
| 310 | 310 | |
| 311 | 311 | |
@@ -315,7 +315,7 @@ discard block |
||
| 315 | 315 | * @return string |
| 316 | 316 | */ |
| 317 | 317 | function type() { |
| 318 | - return $this->get( 'LIN_type' ); |
|
| 318 | + return $this->get('LIN_type'); |
|
| 319 | 319 | } |
| 320 | 320 | |
| 321 | 321 | |
@@ -325,8 +325,8 @@ discard block |
||
| 325 | 325 | * @param string $type |
| 326 | 326 | * @return boolean |
| 327 | 327 | */ |
| 328 | - function set_type( $type ) { |
|
| 329 | - $this->set( 'LIN_type', $type ); |
|
| 328 | + function set_type($type) { |
|
| 329 | + $this->set('LIN_type', $type); |
|
| 330 | 330 | } |
| 331 | 331 | |
| 332 | 332 | |
@@ -336,7 +336,7 @@ discard block |
||
| 336 | 336 | * @return EE_Line_Item |
| 337 | 337 | */ |
| 338 | 338 | public function parent() { |
| 339 | - return $this->get_model()->get_one_by_ID( $this->parent_ID() ); |
|
| 339 | + return $this->get_model()->get_one_by_ID($this->parent_ID()); |
|
| 340 | 340 | } |
| 341 | 341 | |
| 342 | 342 | |
@@ -346,10 +346,10 @@ discard block |
||
| 346 | 346 | * @return EE_Line_Item[] |
| 347 | 347 | */ |
| 348 | 348 | public function children() { |
| 349 | - if ( $this->ID() ) { |
|
| 350 | - return $this->get_model()->get_all( array( array( 'LIN_parent' => $this->ID() ) ) ); |
|
| 349 | + if ($this->ID()) { |
|
| 350 | + return $this->get_model()->get_all(array(array('LIN_parent' => $this->ID()))); |
|
| 351 | 351 | } else { |
| 352 | - if ( !is_array( $this->_Line_Item ) ) { |
|
| 352 | + if ( ! is_array($this->_Line_Item)) { |
|
| 353 | 353 | $this->_Line_Item = array(); |
| 354 | 354 | } |
| 355 | 355 | return $this->_Line_Item; |
@@ -363,7 +363,7 @@ discard block |
||
| 363 | 363 | * @return string |
| 364 | 364 | */ |
| 365 | 365 | function code() { |
| 366 | - return $this->get( 'LIN_code' ); |
|
| 366 | + return $this->get('LIN_code'); |
|
| 367 | 367 | } |
| 368 | 368 | |
| 369 | 369 | |
@@ -373,8 +373,8 @@ discard block |
||
| 373 | 373 | * @param string $code |
| 374 | 374 | * @return boolean |
| 375 | 375 | */ |
| 376 | - function set_code( $code ) { |
|
| 377 | - $this->set( 'LIN_code', $code ); |
|
| 376 | + function set_code($code) { |
|
| 377 | + $this->set('LIN_code', $code); |
|
| 378 | 378 | } |
| 379 | 379 | |
| 380 | 380 | |
@@ -384,7 +384,7 @@ discard block |
||
| 384 | 384 | * @return boolean |
| 385 | 385 | */ |
| 386 | 386 | function is_taxable() { |
| 387 | - return $this->get( 'LIN_is_taxable' ); |
|
| 387 | + return $this->get('LIN_is_taxable'); |
|
| 388 | 388 | } |
| 389 | 389 | |
| 390 | 390 | |
@@ -394,8 +394,8 @@ discard block |
||
| 394 | 394 | * @param boolean $is_taxable |
| 395 | 395 | * @return boolean |
| 396 | 396 | */ |
| 397 | - function set_is_taxable( $is_taxable ) { |
|
| 398 | - $this->set( 'LIN_is_taxable', $is_taxable ); |
|
| 397 | + function set_is_taxable($is_taxable) { |
|
| 398 | + $this->set('LIN_is_taxable', $is_taxable); |
|
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | |
@@ -407,11 +407,11 @@ discard block |
||
| 407 | 407 | */ |
| 408 | 408 | function get_object() { |
| 409 | 409 | $model_name_of_related_obj = $this->OBJ_type(); |
| 410 | - $is_model_name = EE_Registry::instance()->is_model_name( $model_name_of_related_obj ); |
|
| 411 | - if ( !$is_model_name ) { |
|
| 410 | + $is_model_name = EE_Registry::instance()->is_model_name($model_name_of_related_obj); |
|
| 411 | + if ( ! $is_model_name) { |
|
| 412 | 412 | return NULL; |
| 413 | 413 | } else { |
| 414 | - return $this->get_first_related( $model_name_of_related_obj ); |
|
| 414 | + return $this->get_first_related($model_name_of_related_obj); |
|
| 415 | 415 | } |
| 416 | 416 | } |
| 417 | 417 | |
@@ -423,11 +423,11 @@ discard block |
||
| 423 | 423 | * @param array $query_params |
| 424 | 424 | * @return EE_Ticket |
| 425 | 425 | */ |
| 426 | - function ticket( $query_params = array() ) { |
|
| 426 | + function ticket($query_params = array()) { |
|
| 427 | 427 | //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 |
| 428 | - $remove_defaults = array( 'default_where_conditions' => 'none' ); |
|
| 429 | - $query_params = array_merge( $remove_defaults, $query_params ); |
|
| 430 | - return $this->get_first_related( 'Ticket', $query_params ); |
|
| 428 | + $remove_defaults = array('default_where_conditions' => 'none'); |
|
| 429 | + $query_params = array_merge($remove_defaults, $query_params); |
|
| 430 | + return $this->get_first_related('Ticket', $query_params); |
|
| 431 | 431 | } |
| 432 | 432 | |
| 433 | 433 | |
@@ -438,13 +438,13 @@ discard block |
||
| 438 | 438 | * @return string |
| 439 | 439 | */ |
| 440 | 440 | function ticket_event_name() { |
| 441 | - $event_name = __( "Unknown", "event_espresso" ); |
|
| 441 | + $event_name = __("Unknown", "event_espresso"); |
|
| 442 | 442 | $ticket = $this->ticket(); |
| 443 | - if ( $ticket ) { |
|
| 443 | + if ($ticket) { |
|
| 444 | 444 | $datetime = $ticket->first_datetime(); |
| 445 | - if ( $datetime instanceof EE_Datetime ) { |
|
| 445 | + if ($datetime instanceof EE_Datetime) { |
|
| 446 | 446 | $event = $datetime->event(); |
| 447 | - if ( $event instanceof EE_Event ) { |
|
| 447 | + if ($event instanceof EE_Event) { |
|
| 448 | 448 | $event_name = $event->name(); |
| 449 | 449 | } |
| 450 | 450 | } |
@@ -460,13 +460,13 @@ discard block |
||
| 460 | 460 | * @param string $time_format |
| 461 | 461 | * @return string |
| 462 | 462 | */ |
| 463 | - function ticket_datetime_start( $date_format = '', $time_format = '' ) { |
|
| 464 | - $first_datetime_string = __( "Unknown", "event_espresso" ); |
|
| 463 | + function ticket_datetime_start($date_format = '', $time_format = '') { |
|
| 464 | + $first_datetime_string = __("Unknown", "event_espresso"); |
|
| 465 | 465 | $ticket = $this->ticket(); |
| 466 | - if ( $ticket instanceof EE_Ticket ) { |
|
| 466 | + if ($ticket instanceof EE_Ticket) { |
|
| 467 | 467 | $first_datetime = $ticket->first_datetime(); |
| 468 | - if ( $first_datetime ) { |
|
| 469 | - $first_datetime_string = $first_datetime->start_date_and_time( $date_format, $time_format ); |
|
| 468 | + if ($first_datetime) { |
|
| 469 | + $first_datetime_string = $first_datetime->start_date_and_time($date_format, $time_format); |
|
| 470 | 470 | } |
| 471 | 471 | } |
| 472 | 472 | return $first_datetime_string; |
@@ -480,20 +480,20 @@ discard block |
||
| 480 | 480 | * @param EE_Line_Item $line_item |
| 481 | 481 | * @return boolean success |
| 482 | 482 | */ |
| 483 | - function add_child_line_item( EE_Line_Item $line_item ) { |
|
| 484 | - if ( $this->ID() ) { |
|
| 483 | + function add_child_line_item(EE_Line_Item $line_item) { |
|
| 484 | + if ($this->ID()) { |
|
| 485 | 485 | //check for any duplicate line items (with the same code), if so, thsi replaces it |
| 486 | - $line_item_with_same_code = $this->get_child_line_item( $line_item->code() ); |
|
| 487 | - if( $line_item_with_same_code instanceof EE_Line_Item ) { |
|
| 488 | - $this->delete_child_line_item( $line_item_with_same_code->code() ); |
|
| 486 | + $line_item_with_same_code = $this->get_child_line_item($line_item->code()); |
|
| 487 | + if ($line_item_with_same_code instanceof EE_Line_Item) { |
|
| 488 | + $this->delete_child_line_item($line_item_with_same_code->code()); |
|
| 489 | 489 | } |
| 490 | - $line_item->set_parent_ID( $this->ID() ); |
|
| 491 | - if( $this->TXN_ID() ){ |
|
| 492 | - $line_item->set_TXN_ID( $this->TXN_ID() ); |
|
| 490 | + $line_item->set_parent_ID($this->ID()); |
|
| 491 | + if ($this->TXN_ID()) { |
|
| 492 | + $line_item->set_TXN_ID($this->TXN_ID()); |
|
| 493 | 493 | } |
| 494 | 494 | return $line_item->save(); |
| 495 | 495 | } else { |
| 496 | - $this->_Line_Item[ $line_item->code() ] = $line_item; |
|
| 496 | + $this->_Line_Item[$line_item->code()] = $line_item; |
|
| 497 | 497 | return TRUE; |
| 498 | 498 | } |
| 499 | 499 | } |
@@ -507,11 +507,11 @@ discard block |
||
| 507 | 507 | * @param string $code |
| 508 | 508 | * @return EE_Line_Item |
| 509 | 509 | */ |
| 510 | - function get_child_line_item( $code ) { |
|
| 511 | - if ( $this->ID() ) { |
|
| 512 | - return $this->get_model()->get_one( array( array( 'LIN_parent' => $this->ID(), 'LIN_code' => $code ) ) ); |
|
| 510 | + function get_child_line_item($code) { |
|
| 511 | + if ($this->ID()) { |
|
| 512 | + return $this->get_model()->get_one(array(array('LIN_parent' => $this->ID(), 'LIN_code' => $code))); |
|
| 513 | 513 | } else { |
| 514 | - return $this->_Line_Item[ $code ]; |
|
| 514 | + return $this->_Line_Item[$code]; |
|
| 515 | 515 | } |
| 516 | 516 | } |
| 517 | 517 | |
@@ -522,10 +522,10 @@ discard block |
||
| 522 | 522 | * @return int |
| 523 | 523 | */ |
| 524 | 524 | function delete_children_line_items() { |
| 525 | - if ( $this->ID() ) { |
|
| 526 | - return $this->get_model()->delete( array( array( 'LIN_parent' => $this->ID() ) ) ); |
|
| 525 | + if ($this->ID()) { |
|
| 526 | + return $this->get_model()->delete(array(array('LIN_parent' => $this->ID()))); |
|
| 527 | 527 | } else { |
| 528 | - $count = count( $this->_Line_Item ); |
|
| 528 | + $count = count($this->_Line_Item); |
|
| 529 | 529 | $this->_Line_Item = array(); |
| 530 | 530 | return $count; |
| 531 | 531 | } |
@@ -539,11 +539,11 @@ discard block |
||
| 539 | 539 | * @param string $code |
| 540 | 540 | * @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) |
| 541 | 541 | */ |
| 542 | - function delete_child_line_item( $code ) { |
|
| 543 | - if ( $this->ID() ) { |
|
| 544 | - return $this->get_model()->delete( array( array( 'LIN_code' => $code, 'LIN_parent' => $this->ID() ) ) ); |
|
| 542 | + function delete_child_line_item($code) { |
|
| 543 | + if ($this->ID()) { |
|
| 544 | + return $this->get_model()->delete(array(array('LIN_code' => $code, 'LIN_parent' => $this->ID()))); |
|
| 545 | 545 | } else { |
| 546 | - unset( $this->_Line_Item[ $code ] ); |
|
| 546 | + unset($this->_Line_Item[$code]); |
|
| 547 | 547 | return 1; |
| 548 | 548 | } |
| 549 | 549 | } |
@@ -556,7 +556,7 @@ discard block |
||
| 556 | 556 | */ |
| 557 | 557 | function generate_code() { |
| 558 | 558 | // each line item in the cart requires a unique identifier |
| 559 | - return md5( $this->get( 'OBJ_type' ) . $this->get( 'OBJ_ID' ) . time() ); |
|
| 559 | + return md5($this->get('OBJ_type').$this->get('OBJ_ID').time()); |
|
| 560 | 560 | } |
| 561 | 561 | |
| 562 | 562 | |
@@ -620,7 +620,7 @@ discard block |
||
| 620 | 620 | * @return string like '2, 004.00', formatted according to the localized currency |
| 621 | 621 | */ |
| 622 | 622 | function unit_price_no_code() { |
| 623 | - return $this->get_pretty( 'LIN_unit_price', 'no_currency_code' ); |
|
| 623 | + return $this->get_pretty('LIN_unit_price', 'no_currency_code'); |
|
| 624 | 624 | } |
| 625 | 625 | |
| 626 | 626 | |
@@ -630,7 +630,7 @@ discard block |
||
| 630 | 630 | * @return string like '2, 004.00', formatted according to the localized currency |
| 631 | 631 | */ |
| 632 | 632 | function total_no_code() { |
| 633 | - return $this->get_pretty( 'LIN_total', 'no_currency_code' ); |
|
| 633 | + return $this->get_pretty('LIN_total', 'no_currency_code'); |
|
| 634 | 634 | } |
| 635 | 635 | |
| 636 | 636 | |
@@ -646,9 +646,9 @@ discard block |
||
| 646 | 646 | $pre_tax_total = $this->recalculate_pre_tax_total(); |
| 647 | 647 | $tax_total = $this->recalculate_taxes_and_tax_total(); |
| 648 | 648 | $total = $pre_tax_total + $tax_total; |
| 649 | - $this->set_total( $total ); |
|
| 650 | - if( $this->type() == EEM_Line_Item::type_total && $this->transaction() instanceof EE_Transaction ){ |
|
| 651 | - $this->transaction()->set_total( $total ); |
|
| 649 | + $this->set_total($total); |
|
| 650 | + if ($this->type() == EEM_Line_Item::type_total && $this->transaction() instanceof EE_Transaction) { |
|
| 651 | + $this->transaction()->set_total($total); |
|
| 652 | 652 | } |
| 653 | 653 | return $total; |
| 654 | 654 | } |
@@ -666,20 +666,20 @@ discard block |
||
| 666 | 666 | function recalculate_pre_tax_total( ) { |
| 667 | 667 | $total = 0; |
| 668 | 668 | //completely ignore tax sub-totals when calculating the pre-tax-total |
| 669 | - if ( $this->is_tax_sub_total() ) { |
|
| 669 | + if ($this->is_tax_sub_total()) { |
|
| 670 | 670 | return 0; |
| 671 | - } elseif ( $this->is_sub_line_item() ) { |
|
| 672 | - throw new EE_Error( sprintf( __( "Calculating the pretax-total on subline items doesn't make sense right now. You were trying to calculate it on %s", "event_espresso" ), d( $this ) ) ); |
|
| 673 | - } elseif ( $this->is_line_item() ) { |
|
| 671 | + } elseif ($this->is_sub_line_item()) { |
|
| 672 | + throw new EE_Error(sprintf(__("Calculating the pretax-total on subline items doesn't make sense right now. You were trying to calculate it on %s", "event_espresso"), d($this))); |
|
| 673 | + } elseif ($this->is_line_item()) { |
|
| 674 | 674 | //we'll want to attach promotions here too. So maybe, if the line item has children, we'll need to take them into account too |
| 675 | 675 | $total = $this->unit_price() * $this->quantity(); |
| 676 | - $this->set_total( $total ); |
|
| 677 | - } elseif ( $this->is_sub_total() || $this->is_total() ) { |
|
| 676 | + $this->set_total($total); |
|
| 677 | + } elseif ($this->is_sub_total() || $this->is_total()) { |
|
| 678 | 678 | //get the total of all its children |
| 679 | - foreach ( $this->children() as $child_line_item ) { |
|
| 680 | - if ( $child_line_item instanceof EE_Line_Item ) { |
|
| 679 | + foreach ($this->children() as $child_line_item) { |
|
| 680 | + if ($child_line_item instanceof EE_Line_Item) { |
|
| 681 | 681 | //only recalculate sub-totals for NON-taxes |
| 682 | - if ( $child_line_item->is_percent() ) { |
|
| 682 | + if ($child_line_item->is_percent()) { |
|
| 683 | 683 | $total += $total * $child_line_item->percent() / 100; |
| 684 | 684 | } else { |
| 685 | 685 | $total += $child_line_item->recalculate_pre_tax_total(); |
@@ -688,8 +688,8 @@ discard block |
||
| 688 | 688 | } |
| 689 | 689 | //we only want to update sub-totals if we're including non-taxable items |
| 690 | 690 | //and grand totals shouldn't be updated when calculating pre-tax totals |
| 691 | - if( $this->is_sub_total() ){ |
|
| 692 | - $this->set_total( $total ); |
|
| 691 | + if ($this->is_sub_total()) { |
|
| 692 | + $this->set_total($total); |
|
| 693 | 693 | } |
| 694 | 694 | } |
| 695 | 695 | return $total; |
@@ -708,10 +708,10 @@ discard block |
||
| 708 | 708 | //calculate the pretax total |
| 709 | 709 | $taxable_total = $this->taxable_total(); |
| 710 | 710 | $tax_total = 0; |
| 711 | - foreach ( $taxes as $tax ) { |
|
| 711 | + foreach ($taxes as $tax) { |
|
| 712 | 712 | $total_on_this_tax = $taxable_total * $tax->percent() / 100; |
| 713 | 713 | //remember the total on this line item |
| 714 | - $tax->set_total( $total_on_this_tax ); |
|
| 714 | + $tax->set_total($total_on_this_tax); |
|
| 715 | 715 | $tax_total += $tax->total(); |
| 716 | 716 | } |
| 717 | 717 | $this->_recalculate_tax_sub_total(); |
@@ -725,18 +725,18 @@ discard block |
||
| 725 | 725 | * @return void |
| 726 | 726 | */ |
| 727 | 727 | private function _recalculate_tax_sub_total() { |
| 728 | - if ( $this->is_tax_sub_total() ) { |
|
| 728 | + if ($this->is_tax_sub_total()) { |
|
| 729 | 729 | $total = 0; |
| 730 | 730 | //simply loop through all its children (which should be taxes) and sum their total |
| 731 | - foreach ( $this->children() as $child_tax ) { |
|
| 732 | - if ( $child_tax instanceof EE_Line_Item ) { |
|
| 731 | + foreach ($this->children() as $child_tax) { |
|
| 732 | + if ($child_tax instanceof EE_Line_Item) { |
|
| 733 | 733 | $total += $child_tax->total(); |
| 734 | 734 | } |
| 735 | 735 | } |
| 736 | - $this->set_total( $total ); |
|
| 737 | - } elseif ( $this->is_total() ) { |
|
| 738 | - foreach ( $this->children() as $maybe_tax_subtotal ) { |
|
| 739 | - if ( $maybe_tax_subtotal instanceof EE_Line_Item ) { |
|
| 736 | + $this->set_total($total); |
|
| 737 | + } elseif ($this->is_total()) { |
|
| 738 | + foreach ($this->children() as $maybe_tax_subtotal) { |
|
| 739 | + if ($maybe_tax_subtotal instanceof EE_Line_Item) { |
|
| 740 | 740 | $maybe_tax_subtotal->_recalculate_tax_sub_total(); |
| 741 | 741 | } |
| 742 | 742 | } |
@@ -752,7 +752,7 @@ discard block |
||
| 752 | 752 | public function get_total_tax() { |
| 753 | 753 | $this->_recalculate_tax_sub_total(); |
| 754 | 754 | $total = 0; |
| 755 | - foreach ( $this->tax_descendants() as $tax_line_item ) { |
|
| 755 | + foreach ($this->tax_descendants() as $tax_line_item) { |
|
| 756 | 756 | $total += $tax_line_item->total(); |
| 757 | 757 | } |
| 758 | 758 | return $total; |
@@ -765,8 +765,8 @@ discard block |
||
| 765 | 765 | */ |
| 766 | 766 | public function get_items_total() { |
| 767 | 767 | $total = 0; |
| 768 | - foreach ( $this->_get_descendants_of_type( EEM_Line_Item::type_line_item ) as $item ) { |
|
| 769 | - if ( $item instanceof EE_Line_Item ) { |
|
| 768 | + foreach ($this->_get_descendants_of_type(EEM_Line_Item::type_line_item) as $item) { |
|
| 769 | + if ($item instanceof EE_Line_Item) { |
|
| 770 | 770 | $total += $item->total(); |
| 771 | 771 | } |
| 772 | 772 | } |
@@ -781,7 +781,7 @@ discard block |
||
| 781 | 781 | * @return EE_Line_Item[] |
| 782 | 782 | */ |
| 783 | 783 | function tax_descendants() { |
| 784 | - return $this->_get_descendants_of_type( EEM_Line_Item::type_tax ); |
|
| 784 | + return $this->_get_descendants_of_type(EEM_Line_Item::type_tax); |
|
| 785 | 785 | } |
| 786 | 786 | |
| 787 | 787 | |
@@ -791,7 +791,7 @@ discard block |
||
| 791 | 791 | * @return EE_Line_Item[] |
| 792 | 792 | */ |
| 793 | 793 | function get_items() { |
| 794 | - return $this->_get_descendants_of_type( EEM_Line_Item::type_line_item ); |
|
| 794 | + return $this->_get_descendants_of_type(EEM_Line_Item::type_line_item); |
|
| 795 | 795 | } |
| 796 | 796 | |
| 797 | 797 | |
@@ -801,15 +801,15 @@ discard block |
||
| 801 | 801 | * @param string $type one of the constants on EEM_Line_Item |
| 802 | 802 | * @return EE_Line_Item[] |
| 803 | 803 | */ |
| 804 | - protected function _get_descendants_of_type( $type ) { |
|
| 804 | + protected function _get_descendants_of_type($type) { |
|
| 805 | 805 | $line_items_of_type = array(); |
| 806 | - foreach ( $this->children() as $child_line_item ) { |
|
| 807 | - if ( $child_line_item instanceof EE_Line_Item ) { |
|
| 808 | - if ( $child_line_item->type() == $type ) { |
|
| 809 | - $line_items_of_type[ ] = $child_line_item; |
|
| 806 | + foreach ($this->children() as $child_line_item) { |
|
| 807 | + if ($child_line_item instanceof EE_Line_Item) { |
|
| 808 | + if ($child_line_item->type() == $type) { |
|
| 809 | + $line_items_of_type[] = $child_line_item; |
|
| 810 | 810 | } else { |
| 811 | 811 | //go-through-all-its children looking for taxes |
| 812 | - $line_items_of_type = array_merge( $line_items_of_type, $child_line_item->_get_descendants_of_type( $type ) ); |
|
| 812 | + $line_items_of_type = array_merge($line_items_of_type, $child_line_item->_get_descendants_of_type($type)); |
|
| 813 | 813 | } |
| 814 | 814 | } |
| 815 | 815 | } |
@@ -822,15 +822,15 @@ discard block |
||
| 822 | 822 | * @param string $type like one of the EEM_Line_Item::type_* |
| 823 | 823 | * @return EE_Line_Item |
| 824 | 824 | */ |
| 825 | - public function get_nearest_descendant_of_type( $type ) { |
|
| 826 | - foreach( $this->children() as $child ){ |
|
| 827 | - if( $child->type() == $type ){ |
|
| 825 | + public function get_nearest_descendant_of_type($type) { |
|
| 826 | + foreach ($this->children() as $child) { |
|
| 827 | + if ($child->type() == $type) { |
|
| 828 | 828 | return $child; |
| 829 | 829 | } |
| 830 | 830 | } |
| 831 | - foreach($this->children() as $child ){ |
|
| 832 | - $descendant_found = $child->get_nearest_descendant_of_type( $type ); |
|
| 833 | - if( $descendant_found ){ |
|
| 831 | + foreach ($this->children() as $child) { |
|
| 832 | + $descendant_found = $child->get_nearest_descendant_of_type($type); |
|
| 833 | + if ($descendant_found) { |
|
| 834 | 834 | return $descendant_found; |
| 835 | 835 | } |
| 836 | 836 | } |
@@ -846,12 +846,12 @@ discard block |
||
| 846 | 846 | */ |
| 847 | 847 | function taxable_total() { |
| 848 | 848 | $total = 0; |
| 849 | - if ( $this->children() ) { |
|
| 850 | - foreach ( $this->children() as $child_line_item ) { |
|
| 849 | + if ($this->children()) { |
|
| 850 | + foreach ($this->children() as $child_line_item) { |
|
| 851 | 851 | |
| 852 | - if ( $child_line_item->type() == EEM_Line_Item::type_line_item && $child_line_item->is_taxable()) { |
|
| 852 | + if ($child_line_item->type() == EEM_Line_Item::type_line_item && $child_line_item->is_taxable()) { |
|
| 853 | 853 | $total += $child_line_item->total(); |
| 854 | - }elseif( $child_line_item->type() == EEM_Line_Item::type_sub_total ){ |
|
| 854 | + }elseif ($child_line_item->type() == EEM_Line_Item::type_sub_total) { |
|
| 855 | 855 | $total += $child_line_item->taxable_total(); |
| 856 | 856 | } |
| 857 | 857 | } |
@@ -866,7 +866,7 @@ discard block |
||
| 866 | 866 | * @return EE_Transaction |
| 867 | 867 | */ |
| 868 | 868 | public function transaction() { |
| 869 | - return $this->get_first_related( 'Transaction' ); |
|
| 869 | + return $this->get_first_related('Transaction'); |
|
| 870 | 870 | } |
| 871 | 871 | |
| 872 | 872 | |
@@ -879,17 +879,17 @@ discard block |
||
| 879 | 879 | * @param int $txn_id if none is provided, assumes $this->TXN_ID() |
| 880 | 880 | * @return int count of items saved |
| 881 | 881 | */ |
| 882 | - public function save_this_and_descendants_to_txn( $txn_id = NULL ) { |
|
| 883 | - if ( ! $txn_id ) { |
|
| 882 | + public function save_this_and_descendants_to_txn($txn_id = NULL) { |
|
| 883 | + if ( ! $txn_id) { |
|
| 884 | 884 | $txn_id = $this->TXN_ID(); |
| 885 | 885 | } |
| 886 | - $this->set_TXN_ID( $txn_id ); |
|
| 886 | + $this->set_TXN_ID($txn_id); |
|
| 887 | 887 | $children = $this->children(); |
| 888 | 888 | $this->save(); |
| 889 | - foreach ( $children as $child_line_item ) { |
|
| 890 | - if ( $child_line_item instanceof EE_Line_Item ) { |
|
| 891 | - $child_line_item->set_parent_ID( $this->ID() ); |
|
| 892 | - $child_line_item->save_this_and_descendants_to_txn( $txn_id ); |
|
| 889 | + foreach ($children as $child_line_item) { |
|
| 890 | + if ($child_line_item instanceof EE_Line_Item) { |
|
| 891 | + $child_line_item->set_parent_ID($this->ID()); |
|
| 892 | + $child_line_item->save_this_and_descendants_to_txn($txn_id); |
|
| 893 | 893 | } |
| 894 | 894 | } |
| 895 | 895 | } |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
| 2 | -do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
|
| 1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
| 2 | +do_action('AHEE_log', __FILE__, __FUNCTION__, ''); |
|
| 3 | 3 | /** |
| 4 | 4 | * Event Espresso |
| 5 | 5 | * |
@@ -23,7 +23,7 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * ------------------------------------------------------------------------ |
| 25 | 25 | */ |
| 26 | -class EE_Payment_Method extends EE_Base_Class{ |
|
| 26 | +class EE_Payment_Method extends EE_Base_Class { |
|
| 27 | 27 | |
| 28 | 28 | /** |
| 29 | 29 | * Payment Method type object, which has all the info about this type of payment method, |
@@ -39,9 +39,9 @@ discard block |
||
| 39 | 39 | * @param array $props_n_values |
| 40 | 40 | * @return EE_Payment_Method |
| 41 | 41 | */ |
| 42 | - public static function new_instance( $props_n_values = array()) { |
|
| 43 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
| 44 | - return $has_object ? $has_object : new self( $props_n_values, FALSE ); |
|
| 42 | + public static function new_instance($props_n_values = array()) { |
|
| 43 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
| 44 | + return $has_object ? $has_object : new self($props_n_values, FALSE); |
|
| 45 | 45 | } |
| 46 | 46 | |
| 47 | 47 | |
@@ -51,8 +51,8 @@ discard block |
||
| 51 | 51 | * @param array $props_n_values |
| 52 | 52 | * @return EE_Payment_Method |
| 53 | 53 | */ |
| 54 | - public static function new_instance_from_db ( $props_n_values = array()) { |
|
| 55 | - return new self( $props_n_values, TRUE ); |
|
| 54 | + public static function new_instance_from_db($props_n_values = array()) { |
|
| 55 | + return new self($props_n_values, TRUE); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | |
@@ -81,7 +81,7 @@ discard block |
||
| 81 | 81 | * @return boolean |
| 82 | 82 | */ |
| 83 | 83 | function active() { |
| 84 | - return array_intersect(array_keys(EEM_Payment_Method::instance()->scopes()),$this->scope()); |
|
| 84 | + return array_intersect(array_keys(EEM_Payment_Method::instance()->scopes()), $this->scope()); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | |
@@ -90,10 +90,10 @@ discard block |
||
| 90 | 90 | * Sets this PM as active by making it usable within the CART scope. Offline gateways |
| 91 | 91 | * are also usable from the admin-scope as well. DOES NOT SAVE it |
| 92 | 92 | */ |
| 93 | - function set_active(){ |
|
| 93 | + function set_active() { |
|
| 94 | 94 | $default_scopes = array(EEM_Payment_Method::scope_cart); |
| 95 | - if($this->type_obj() && |
|
| 96 | - $this->type_obj()->payment_occurs() == EE_PMT_Base::offline){ |
|
| 95 | + if ($this->type_obj() && |
|
| 96 | + $this->type_obj()->payment_occurs() == EE_PMT_Base::offline) { |
|
| 97 | 97 | $default_scopes[] = EEM_Payment_Method::scope_admin; |
| 98 | 98 | } |
| 99 | 99 | $this->set_scope($default_scopes); |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | /** |
| 105 | 105 | * Makes this payment method apply to NO scopes at all. DOES NOT SAVE it. |
| 106 | 106 | */ |
| 107 | - function deactivate(){ |
|
| 107 | + function deactivate() { |
|
| 108 | 108 | $this->set_scope(array()); |
| 109 | 109 | } |
| 110 | 110 | |
@@ -295,8 +295,8 @@ discard block |
||
| 295 | 295 | * @param type $field_value |
| 296 | 296 | * @param type $use_default |
| 297 | 297 | */ |
| 298 | - function set( $field_name, $field_value, $use_default = FALSE ){ |
|
| 299 | - if( $field_name == 'PMD_type' ){ |
|
| 298 | + function set($field_name, $field_value, $use_default = FALSE) { |
|
| 299 | + if ($field_name == 'PMD_type') { |
|
| 300 | 300 | //the type has probably changed, so forget about its old type object |
| 301 | 301 | $this->_type_obj = NULL; |
| 302 | 302 | } |
@@ -370,18 +370,18 @@ discard block |
||
| 370 | 370 | * @return EE_PMT_Base |
| 371 | 371 | * @throws EE_Error |
| 372 | 372 | */ |
| 373 | - public function type_obj(){ |
|
| 374 | - if( ! $this->_type_obj ) { |
|
| 375 | - EE_Registry::instance()->load_lib( 'Payment_Method_Manager' ); |
|
| 376 | - if ( EE_Payment_Method_Manager::instance()->payment_method_type_exists( $this->type() )) { |
|
| 377 | - $class_name = EE_Payment_Method_Manager::instance()->payment_method_class_from_type( $this->type() ); |
|
| 378 | - if ( ! class_exists( $class_name )) { |
|
| 379 | - throw new EE_Error(sprintf(__("There is no payment method type of class '%s', did you deactivate an EE addon?", "event_espresso"),$class_name)); |
|
| 373 | + public function type_obj() { |
|
| 374 | + if ( ! $this->_type_obj) { |
|
| 375 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
| 376 | + if (EE_Payment_Method_Manager::instance()->payment_method_type_exists($this->type())) { |
|
| 377 | + $class_name = EE_Payment_Method_Manager::instance()->payment_method_class_from_type($this->type()); |
|
| 378 | + if ( ! class_exists($class_name)) { |
|
| 379 | + throw new EE_Error(sprintf(__("There is no payment method type of class '%s', did you deactivate an EE addon?", "event_espresso"), $class_name)); |
|
| 380 | 380 | } |
| 381 | - $r = new ReflectionClass( $class_name ); |
|
| 382 | - $this->_type_obj = $r->newInstanceArgs( array( $this )); |
|
| 381 | + $r = new ReflectionClass($class_name); |
|
| 382 | + $this->_type_obj = $r->newInstanceArgs(array($this)); |
|
| 383 | 383 | } else { |
| 384 | - throw new EE_Error( sprintf( __( 'A payment method of type "%1$s" does not exist. Only ones existing are: %2$s', 'event_espresso' ), $this->type(), implode(',', EE_Payment_Method_Manager::instance()->payment_method_type_names() ) ) ); |
|
| 384 | + throw new EE_Error(sprintf(__('A payment method of type "%1$s" does not exist. Only ones existing are: %2$s', 'event_espresso'), $this->type(), implode(',', EE_Payment_Method_Manager::instance()->payment_method_type_names()))); |
|
| 385 | 385 | } |
| 386 | 386 | } |
| 387 | 387 | return $this->_type_obj; |
@@ -394,18 +394,18 @@ discard block |
||
| 394 | 394 | * and the extra meta. Mostly used for passing off ot gateways. * |
| 395 | 395 | * @return array |
| 396 | 396 | */ |
| 397 | - public function settings_array(){ |
|
| 397 | + public function settings_array() { |
|
| 398 | 398 | $fields = $this->model_field_array(); |
| 399 | 399 | $extra_meta = $this->all_extra_meta_array(); |
| 400 | 400 | //remove the model's prefix from the fields |
| 401 | 401 | $combined_settings_array = array(); |
| 402 | - foreach($fields as $key => $value){ |
|
| 403 | - if(strpos($key, 'PMD_')===0){ |
|
| 402 | + foreach ($fields as $key => $value) { |
|
| 403 | + if (strpos($key, 'PMD_') === 0) { |
|
| 404 | 404 | $key_sans_model_prefix = str_replace('PMD_', '', $key); |
| 405 | 405 | $combined_settings_array [$key_sans_model_prefix] = $value; |
| 406 | 406 | } |
| 407 | 407 | } |
| 408 | - $combined_settings_array = array_merge( $extra_meta,$combined_settings_array ); |
|
| 408 | + $combined_settings_array = array_merge($extra_meta, $combined_settings_array); |
|
| 409 | 409 | return $combined_settings_array; |
| 410 | 410 | } |
| 411 | 411 | |
@@ -417,12 +417,12 @@ discard block |
||
| 417 | 417 | * @param string $css_class |
| 418 | 418 | * @return string of HTML for displaying the button |
| 419 | 419 | */ |
| 420 | - public function button_html( $url = '', $css_class = '' ){ |
|
| 420 | + public function button_html($url = '', $css_class = '') { |
|
| 421 | 421 | $payment_occurs = $this->type_obj()->payment_occurs(); |
| 422 | 422 | return ' |
| 423 | - <div id="' . $this->slug() . '-payment-option-dv" class="'. $payment_occurs .'-payment-gateway reg-page-payment-option-dv' . $css_class . '"> |
|
| 424 | - <a id="payment-gateway-button-' . $this->slug() . '" class="reg-page-payment-option-lnk" rel="' . $this->slug() . '" href="' . $url . '" > |
|
| 425 | - <img src="' . $this->button_url() . '" alt="' . sprintf( esc_attr__( 'Pay using %s', 'event_espresso' ), $this->get_pretty('PMD_name','form_input') ) . '" /> |
|
| 423 | + <div id="' . $this->slug().'-payment-option-dv" class="'.$payment_occurs.'-payment-gateway reg-page-payment-option-dv'.$css_class.'"> |
|
| 424 | + <a id="payment-gateway-button-' . $this->slug().'" class="reg-page-payment-option-lnk" rel="'.$this->slug().'" href="'.$url.'" > |
|
| 425 | + <img src="' . $this->button_url().'" alt="'.sprintf(esc_attr__('Pay using %s', 'event_espresso'), $this->get_pretty('PMD_name', 'form_input')).'" /> |
|
| 426 | 426 | </a> |
| 427 | 427 | </div> |
| 428 | 428 | '; |
@@ -435,7 +435,7 @@ discard block |
||
| 435 | 435 | * (as defined by the gateway and the currently active currencies) |
| 436 | 436 | * @return EE_Currency[] |
| 437 | 437 | */ |
| 438 | - public function get_all_usable_currencies(){ |
|
| 438 | + public function get_all_usable_currencies() { |
|
| 439 | 439 | return EEM_Currency::instance()->get_all_currencies_usable_by($this->type_obj()); |
| 440 | 440 | } |
| 441 | 441 | |
@@ -444,9 +444,9 @@ discard block |
||
| 444 | 444 | * @param string $currency_code currency ID (code) |
| 445 | 445 | * @return boolean |
| 446 | 446 | */ |
| 447 | - public function usable_for_currency( $currency_code ) { |
|
| 448 | - foreach( $this->get_all_usable_currencies() as $currency_obj ) { |
|
| 449 | - if( $currency_obj->ID() == $currency_code ){ |
|
| 447 | + public function usable_for_currency($currency_code) { |
|
| 448 | + foreach ($this->get_all_usable_currencies() as $currency_obj) { |
|
| 449 | + if ($currency_obj->ID() == $currency_code) { |
|
| 450 | 450 | return TRUE; |
| 451 | 451 | } |
| 452 | 452 | } |
@@ -459,7 +459,7 @@ discard block |
||
| 459 | 459 | * Returns TRUE if this payment method's gateway is an instance of EE_Onsite_Gateway |
| 460 | 460 | * @return bool |
| 461 | 461 | */ |
| 462 | - public function is_on_site(){ |
|
| 462 | + public function is_on_site() { |
|
| 463 | 463 | return $this->type_obj()->payment_occurs() == EE_PMT_Base::onsite; |
| 464 | 464 | } |
| 465 | 465 | |
@@ -469,7 +469,7 @@ discard block |
||
| 469 | 469 | * Returns TRUE if this payment method's gateway is an instance of EE_Offsite_Gateway |
| 470 | 470 | * @return bool |
| 471 | 471 | */ |
| 472 | - public function is_off_site(){ |
|
| 472 | + public function is_off_site() { |
|
| 473 | 473 | return $this->type_obj()->payment_occurs() == EE_PMT_Base::offsite; |
| 474 | 474 | } |
| 475 | 475 | |
@@ -479,7 +479,7 @@ discard block |
||
| 479 | 479 | * Returns TRUE if this payment method does not utilize a gateway |
| 480 | 480 | * @return bool |
| 481 | 481 | */ |
| 482 | - public function is_off_line(){ |
|
| 482 | + public function is_off_line() { |
|
| 483 | 483 | return $this->type_obj()->payment_occurs() == EE_PMT_Base::offline; |
| 484 | 484 | } |
| 485 | 485 | |
@@ -489,10 +489,10 @@ discard block |
||
| 489 | 489 | * to load the required classes, and don't need them at the time of unserialization |
| 490 | 490 | * @return array |
| 491 | 491 | */ |
| 492 | - public function __sleep(){ |
|
| 493 | - $properties = get_object_vars( $this ); |
|
| 494 | - unset( $properties[ '_type_obj' ] ); |
|
| 495 | - return array_keys( $properties ); |
|
| 492 | + public function __sleep() { |
|
| 493 | + $properties = get_object_vars($this); |
|
| 494 | + unset($properties['_type_obj']); |
|
| 495 | + return array_keys($properties); |
|
| 496 | 496 | } |
| 497 | 497 | |
| 498 | 498 | |
@@ -1,4 +1,6 @@ |
||
| 1 | -<?php if (!defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
| 1 | +<?php if (!defined('EVENT_ESPRESSO_VERSION')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | do_action( 'AHEE_log', __FILE__, __FUNCTION__, '' ); |
| 3 | 5 | /** |
| 4 | 6 | * Event Espresso |
@@ -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 |
@@ -32,9 +32,9 @@ discard block |
||
| 32 | 32 | * @param string $timezone |
| 33 | 33 | * @return EE_Price |
| 34 | 34 | */ |
| 35 | - public static function new_instance( $props_n_values = array(), $timezone = '' ) { |
|
| 36 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
| 37 | - return $has_object ? $has_object : new self( $props_n_values, FALSE, $timezone ); |
|
| 35 | + public static function new_instance($props_n_values = array(), $timezone = '') { |
|
| 36 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
| 37 | + return $has_object ? $has_object : new self($props_n_values, FALSE, $timezone); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | |
@@ -44,8 +44,8 @@ discard block |
||
| 44 | 44 | * @param string $timezone |
| 45 | 45 | * @return EE_Price |
| 46 | 46 | */ |
| 47 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = '' ) { |
|
| 48 | - return new self( $props_n_values, TRUE, $timezone ); |
|
| 47 | + public static function new_instance_from_db($props_n_values = array(), $timezone = '') { |
|
| 48 | + return new self($props_n_values, TRUE, $timezone); |
|
| 49 | 49 | } |
| 50 | 50 | |
| 51 | 51 | |
@@ -56,8 +56,8 @@ discard block |
||
| 56 | 56 | * @access public |
| 57 | 57 | * @param int $PRT_ID |
| 58 | 58 | */ |
| 59 | - public function set_type( $PRT_ID = 0 ) { |
|
| 60 | - $this->set( 'PRT_ID', $PRT_ID ); |
|
| 59 | + public function set_type($PRT_ID = 0) { |
|
| 60 | + $this->set('PRT_ID', $PRT_ID); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | |
@@ -68,8 +68,8 @@ discard block |
||
| 68 | 68 | * @access public |
| 69 | 69 | * @param float $PRC_amount |
| 70 | 70 | */ |
| 71 | - public function set_amount( $PRC_amount = 0.00 ) { |
|
| 72 | - $this->set( 'PRC_amount', $PRC_amount ); |
|
| 71 | + public function set_amount($PRC_amount = 0.00) { |
|
| 72 | + $this->set('PRC_amount', $PRC_amount); |
|
| 73 | 73 | } |
| 74 | 74 | |
| 75 | 75 | |
@@ -80,8 +80,8 @@ discard block |
||
| 80 | 80 | * @access public |
| 81 | 81 | * @param string $PRC_name |
| 82 | 82 | */ |
| 83 | - public function set_name( $PRC_name = '' ) { |
|
| 84 | - $this->set( 'PRC_name', $PRC_name ); |
|
| 83 | + public function set_name($PRC_name = '') { |
|
| 84 | + $this->set('PRC_name', $PRC_name); |
|
| 85 | 85 | } |
| 86 | 86 | |
| 87 | 87 | |
@@ -92,8 +92,8 @@ discard block |
||
| 92 | 92 | * @access public |
| 93 | 93 | * @param string $PRC_desc |
| 94 | 94 | */ |
| 95 | - public function set_description( $PRC_desc = '' ) { |
|
| 96 | - $this->Set( 'PRC_desc', $PRC_desc ); |
|
| 95 | + public function set_description($PRC_desc = '') { |
|
| 96 | + $this->Set('PRC_desc', $PRC_desc); |
|
| 97 | 97 | } |
| 98 | 98 | |
| 99 | 99 | |
@@ -104,8 +104,8 @@ discard block |
||
| 104 | 104 | * @access public |
| 105 | 105 | * @param bool $PRC_deleted |
| 106 | 106 | */ |
| 107 | - public function set_deleted( $PRC_deleted = NULL ) { |
|
| 108 | - $this->set( 'PRC_deleted', $PRC_deleted ); |
|
| 107 | + public function set_deleted($PRC_deleted = NULL) { |
|
| 108 | + $this->set('PRC_deleted', $PRC_deleted); |
|
| 109 | 109 | } |
| 110 | 110 | |
| 111 | 111 | |
@@ -116,7 +116,7 @@ discard block |
||
| 116 | 116 | * @return int |
| 117 | 117 | */ |
| 118 | 118 | public function type() { |
| 119 | - return $this->get( 'PRT_ID' ); |
|
| 119 | + return $this->get('PRT_ID'); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | * @return float |
| 128 | 128 | */ |
| 129 | 129 | public function amount() { |
| 130 | - return $this->get( 'PRC_amount' ); |
|
| 130 | + return $this->get('PRC_amount'); |
|
| 131 | 131 | } |
| 132 | 132 | |
| 133 | 133 | |
@@ -138,7 +138,7 @@ discard block |
||
| 138 | 138 | * @return string |
| 139 | 139 | */ |
| 140 | 140 | public function name() { |
| 141 | - return $this->get( 'PRC_name' ); |
|
| 141 | + return $this->get('PRC_name'); |
|
| 142 | 142 | } |
| 143 | 143 | |
| 144 | 144 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | * @return string |
| 150 | 150 | */ |
| 151 | 151 | public function desc() { |
| 152 | - return $this->get( 'PRC_desc' ); |
|
| 152 | + return $this->get('PRC_desc'); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | |
@@ -160,7 +160,7 @@ discard block |
||
| 160 | 160 | * @return int |
| 161 | 161 | */ |
| 162 | 162 | public function overrides() { |
| 163 | - return $this->get( 'PRC_overrides' ); |
|
| 163 | + return $this->get('PRC_overrides'); |
|
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | * @return int |
| 172 | 172 | */ |
| 173 | 173 | public function order() { |
| 174 | - return $this->get( 'PRC_order' ); |
|
| 174 | + return $this->get('PRC_order'); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | |
@@ -195,7 +195,7 @@ discard block |
||
| 195 | 195 | * @return bool |
| 196 | 196 | */ |
| 197 | 197 | public function deleted() { |
| 198 | - return $this->get( 'PRC_deleted' ); |
|
| 198 | + return $this->get('PRC_deleted'); |
|
| 199 | 199 | } |
| 200 | 200 | |
| 201 | 201 | |
@@ -204,7 +204,7 @@ discard block |
||
| 204 | 204 | * @return bool |
| 205 | 205 | */ |
| 206 | 206 | public function parent() { |
| 207 | - return $this->get( 'PRC_parent' ); |
|
| 207 | + return $this->get('PRC_parent'); |
|
| 208 | 208 | } |
| 209 | 209 | |
| 210 | 210 | |
@@ -226,7 +226,7 @@ discard block |
||
| 226 | 226 | * @return EE_Price_Type |
| 227 | 227 | */ |
| 228 | 228 | public function type_obj() { |
| 229 | - return $this->get_first_related( 'Price_Type' ); |
|
| 229 | + return $this->get_first_related('Price_Type'); |
|
| 230 | 230 | } |
| 231 | 231 | |
| 232 | 232 | |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | */ |
| 249 | 249 | public function is_percent() { |
| 250 | 250 | $price_type = $this->type_obj(); |
| 251 | - return $price_type->get( 'PRT_is_percent' ); |
|
| 251 | + return $price_type->get('PRT_is_percent'); |
|
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | * @return string |
| 261 | 261 | */ |
| 262 | 262 | public function pretty_price() { |
| 263 | - return ! $this->is_percent() ? $this->get_pretty('PRC_amount') : $this->get('PRC_amount') . '%'; |
|
| 263 | + return ! $this->is_percent() ? $this->get_pretty('PRC_amount') : $this->get('PRC_amount').'%'; |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | * @return mixed |
| 270 | 270 | */ |
| 271 | 271 | public function get_price_without_currency_symbol() { |
| 272 | - return str_replace( EE_Registry::instance()->CFG->currency->sign, '', $this->get_pretty( 'PRC_amount' ) ); |
|
| 272 | + return str_replace(EE_Registry::instance()->CFG->currency->sign, '', $this->get_pretty('PRC_amount')); |
|
| 273 | 273 | } |
| 274 | 274 | } |
| 275 | 275 | |
@@ -99,11 +99,11 @@ |
||
| 99 | 99 | |
| 100 | 100 | |
| 101 | 101 | /** |
| 102 | - * set deleted |
|
| 103 | - * |
|
| 104 | - * @access public |
|
| 105 | - * @param bool $PRC_deleted |
|
| 106 | - */ |
|
| 102 | + * set deleted |
|
| 103 | + * |
|
| 104 | + * @access public |
|
| 105 | + * @param bool $PRC_deleted |
|
| 106 | + */ |
|
| 107 | 107 | public function set_deleted( $PRC_deleted = NULL ) { |
| 108 | 108 | $this->set( 'PRC_deleted', $PRC_deleted ); |
| 109 | 109 | } |
@@ -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 |
@@ -32,9 +32,9 @@ discard block |
||
| 32 | 32 | * @param array $props_n_values |
| 33 | 33 | * @return EE_Question|mixed |
| 34 | 34 | */ |
| 35 | - public static function new_instance( $props_n_values = array() ) { |
|
| 36 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
| 37 | - return $has_object ? $has_object : new self( $props_n_values ); |
|
| 35 | + public static function new_instance($props_n_values = array()) { |
|
| 36 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
| 37 | + return $has_object ? $has_object : new self($props_n_values); |
|
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | |
@@ -43,8 +43,8 @@ discard block |
||
| 43 | 43 | * @param array $props_n_values |
| 44 | 44 | * @return EE_Question |
| 45 | 45 | */ |
| 46 | - public static function new_instance_from_db( $props_n_values = array() ) { |
|
| 47 | - return new self( $props_n_values, TRUE ); |
|
| 46 | + public static function new_instance_from_db($props_n_values = array()) { |
|
| 47 | + return new self($props_n_values, TRUE); |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | |
@@ -55,8 +55,8 @@ discard block |
||
| 55 | 55 | * @access public |
| 56 | 56 | * @param string $QST_display_text |
| 57 | 57 | */ |
| 58 | - public function set_display_text( $QST_display_text = '' ) { |
|
| 59 | - $this->set( 'QST_display_text', $QST_display_text ); |
|
| 58 | + public function set_display_text($QST_display_text = '') { |
|
| 59 | + $this->set('QST_display_text', $QST_display_text); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | |
@@ -67,8 +67,8 @@ discard block |
||
| 67 | 67 | * @access public |
| 68 | 68 | * @param string $QST_admin_label |
| 69 | 69 | */ |
| 70 | - public function set_admin_label( $QST_admin_label = '' ) { |
|
| 71 | - $this->set( 'QST_admin_label', $QST_admin_label ); |
|
| 70 | + public function set_admin_label($QST_admin_label = '') { |
|
| 71 | + $this->set('QST_admin_label', $QST_admin_label); |
|
| 72 | 72 | } |
| 73 | 73 | |
| 74 | 74 | |
@@ -79,8 +79,8 @@ discard block |
||
| 79 | 79 | * @access public |
| 80 | 80 | * @param mixed $QST_system |
| 81 | 81 | */ |
| 82 | - public function set_system_ID( $QST_system = '' ) { |
|
| 83 | - $this->set( 'QST_system', $QST_system ); |
|
| 82 | + public function set_system_ID($QST_system = '') { |
|
| 83 | + $this->set('QST_system', $QST_system); |
|
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | |
@@ -91,8 +91,8 @@ discard block |
||
| 91 | 91 | * @access public |
| 92 | 92 | * @param string $QST_type |
| 93 | 93 | */ |
| 94 | - public function set_question_type( $QST_type = '' ) { |
|
| 95 | - $this->set( 'QST_type', $QST_type ); |
|
| 94 | + public function set_question_type($QST_type = '') { |
|
| 95 | + $this->set('QST_type', $QST_type); |
|
| 96 | 96 | } |
| 97 | 97 | |
| 98 | 98 | |
@@ -103,8 +103,8 @@ discard block |
||
| 103 | 103 | * @access public |
| 104 | 104 | * @param bool $QST_required |
| 105 | 105 | */ |
| 106 | - public function set_required( $QST_required = FALSE ) { |
|
| 107 | - $this->set( 'QST_required', $QST_required ); |
|
| 106 | + public function set_required($QST_required = FALSE) { |
|
| 107 | + $this->set('QST_required', $QST_required); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | |
@@ -115,8 +115,8 @@ discard block |
||
| 115 | 115 | * @access public |
| 116 | 116 | * @param string $QST_required_text |
| 117 | 117 | */ |
| 118 | - public function set_required_text( $QST_required_text = '' ) { |
|
| 119 | - $this->set( 'QST_required_text', $QST_required_text ); |
|
| 118 | + public function set_required_text($QST_required_text = '') { |
|
| 119 | + $this->set('QST_required_text', $QST_required_text); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | |
@@ -127,8 +127,8 @@ discard block |
||
| 127 | 127 | * @access public |
| 128 | 128 | * @param int $QST_order |
| 129 | 129 | */ |
| 130 | - public function set_order( $QST_order = 0 ) { |
|
| 131 | - $this->set( 'QST_order', $QST_order ); |
|
| 130 | + public function set_order($QST_order = 0) { |
|
| 131 | + $this->set('QST_order', $QST_order); |
|
| 132 | 132 | } |
| 133 | 133 | |
| 134 | 134 | |
@@ -139,8 +139,8 @@ discard block |
||
| 139 | 139 | * @access public |
| 140 | 140 | * @param bool $QST_admin_only |
| 141 | 141 | */ |
| 142 | - public function set_admin_only( $QST_admin_only = FALSE ) { |
|
| 143 | - $this->set( 'QST_admin_only', $QST_admin_only ); |
|
| 142 | + public function set_admin_only($QST_admin_only = FALSE) { |
|
| 143 | + $this->set('QST_admin_only', $QST_admin_only); |
|
| 144 | 144 | } |
| 145 | 145 | |
| 146 | 146 | |
@@ -151,8 +151,8 @@ discard block |
||
| 151 | 151 | * @access public |
| 152 | 152 | * @param int $QST_wp_user |
| 153 | 153 | */ |
| 154 | - public function set_wp_user( $QST_wp_user = 1 ) { |
|
| 155 | - $this->set( 'QST_wp_user', $QST_wp_user ); |
|
| 154 | + public function set_wp_user($QST_wp_user = 1) { |
|
| 155 | + $this->set('QST_wp_user', $QST_wp_user); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | |
@@ -168,8 +168,8 @@ discard block |
||
| 168 | 168 | * @access public |
| 169 | 169 | * @param bool $QST_deleted |
| 170 | 170 | */ |
| 171 | - public function set_deleted( $QST_deleted = FALSE ) { |
|
| 172 | - $this->set( 'QST_deleted', $QST_deleted ); |
|
| 171 | + public function set_deleted($QST_deleted = FALSE) { |
|
| 172 | + $this->set('QST_deleted', $QST_deleted); |
|
| 173 | 173 | } |
| 174 | 174 | |
| 175 | 175 | |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | * @return string |
| 181 | 181 | */ |
| 182 | 182 | public function display_text() { |
| 183 | - return $this->get( 'QST_display_text' ); |
|
| 183 | + return $this->get('QST_display_text'); |
|
| 184 | 184 | } |
| 185 | 185 | |
| 186 | 186 | |
@@ -191,7 +191,7 @@ discard block |
||
| 191 | 191 | * @return string |
| 192 | 192 | */ |
| 193 | 193 | public function admin_label() { |
| 194 | - return $this->get( 'QST_admin_label' ); |
|
| 194 | + return $this->get('QST_admin_label'); |
|
| 195 | 195 | } |
| 196 | 196 | |
| 197 | 197 | |
@@ -202,7 +202,7 @@ discard block |
||
| 202 | 202 | * @return string |
| 203 | 203 | */ |
| 204 | 204 | public function system_ID() { |
| 205 | - return $this->get( 'QST_system' ); |
|
| 205 | + return $this->get('QST_system'); |
|
| 206 | 206 | } |
| 207 | 207 | |
| 208 | 208 | |
@@ -213,7 +213,7 @@ discard block |
||
| 213 | 213 | * @return boolean |
| 214 | 214 | */ |
| 215 | 215 | public function required() { |
| 216 | - return $this->get( 'QST_required' ); |
|
| 216 | + return $this->get('QST_required'); |
|
| 217 | 217 | } |
| 218 | 218 | |
| 219 | 219 | |
@@ -225,7 +225,7 @@ discard block |
||
| 225 | 225 | * @return string |
| 226 | 226 | */ |
| 227 | 227 | public function required_text() { |
| 228 | - return $this->get( 'QST_required_text' ); |
|
| 228 | + return $this->get('QST_required_text'); |
|
| 229 | 229 | } |
| 230 | 230 | |
| 231 | 231 | |
@@ -236,7 +236,7 @@ discard block |
||
| 236 | 236 | * @return string |
| 237 | 237 | */ |
| 238 | 238 | public function type() { |
| 239 | - return $this->get( 'QST_type' ); |
|
| 239 | + return $this->get('QST_type'); |
|
| 240 | 240 | } |
| 241 | 241 | |
| 242 | 242 | |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | * @return int |
| 249 | 249 | */ |
| 250 | 250 | public function order() { |
| 251 | - return $this->get( 'QST_order' ); |
|
| 251 | + return $this->get('QST_order'); |
|
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | |
@@ -260,7 +260,7 @@ discard block |
||
| 260 | 260 | * @return boolean |
| 261 | 261 | */ |
| 262 | 262 | public function admin_only() { |
| 263 | - return $this->get( 'QST_admin_only' ); |
|
| 263 | + return $this->get('QST_admin_only'); |
|
| 264 | 264 | } |
| 265 | 265 | |
| 266 | 266 | |
@@ -271,7 +271,7 @@ discard block |
||
| 271 | 271 | * @return int |
| 272 | 272 | */ |
| 273 | 273 | public function wp_user() { |
| 274 | - return $this->get( 'QST_wp_user' ); |
|
| 274 | + return $this->get('QST_wp_user'); |
|
| 275 | 275 | } |
| 276 | 276 | |
| 277 | 277 | |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | * @return boolean |
| 283 | 283 | */ |
| 284 | 284 | public function deleted() { |
| 285 | - return $this->get( 'QST_deleted' ); |
|
| 285 | + return $this->get('QST_deleted'); |
|
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | * @return EE_Answer[] |
| 293 | 293 | */ |
| 294 | 294 | public function answers() { |
| 295 | - return $this->get_many_related( 'Answer' ); |
|
| 295 | + return $this->get_many_related('Answer'); |
|
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | * @return boolean true = has answers, false = no answers. |
| 303 | 303 | */ |
| 304 | 304 | public function has_answers() { |
| 305 | - return $this->count_related( 'Answer' ) > 0 ? TRUE : FALSE; |
|
| 305 | + return $this->count_related('Answer') > 0 ? TRUE : FALSE; |
|
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | |
@@ -312,7 +312,7 @@ discard block |
||
| 312 | 312 | * @return EE_Question_Group[] |
| 313 | 313 | */ |
| 314 | 314 | public function question_groups() { |
| 315 | - return $this->get_many_related( 'Question_Group' ); |
|
| 315 | + return $this->get_many_related('Question_Group'); |
|
| 316 | 316 | } |
| 317 | 317 | |
| 318 | 318 | |
@@ -326,24 +326,24 @@ discard block |
||
| 326 | 326 | * whether it was trashed or not. |
| 327 | 327 | * @return EE_Question_Option[] |
| 328 | 328 | */ |
| 329 | - public function options( $notDeletedOptionsOnly = TRUE, $selected_value_to_always_include = NULL ) { |
|
| 330 | - if ( ! $this->ID() ) { |
|
| 329 | + public function options($notDeletedOptionsOnly = TRUE, $selected_value_to_always_include = NULL) { |
|
| 330 | + if ( ! $this->ID()) { |
|
| 331 | 331 | return array(); |
| 332 | 332 | } |
| 333 | 333 | $query_params = array(); |
| 334 | - if ( $selected_value_to_always_include ) { |
|
| 335 | - if ( is_array( $selected_value_to_always_include ) ) { |
|
| 336 | - $query_params[ 0 ][ 'OR*options-query' ][ 'QSO_value' ] = array( 'IN', $selected_value_to_always_include ); |
|
| 334 | + if ($selected_value_to_always_include) { |
|
| 335 | + if (is_array($selected_value_to_always_include)) { |
|
| 336 | + $query_params[0]['OR*options-query']['QSO_value'] = array('IN', $selected_value_to_always_include); |
|
| 337 | 337 | } else { |
| 338 | - $query_params[ 0 ][ 'OR*options-query' ][ 'QSO_value' ] = $selected_value_to_always_include; |
|
| 338 | + $query_params[0]['OR*options-query']['QSO_value'] = $selected_value_to_always_include; |
|
| 339 | 339 | } |
| 340 | 340 | } |
| 341 | - if ( $notDeletedOptionsOnly ) { |
|
| 342 | - $query_params[ 0 ][ 'OR*options-query' ][ 'QSO_deleted' ] = FALSE; |
|
| 341 | + if ($notDeletedOptionsOnly) { |
|
| 342 | + $query_params[0]['OR*options-query']['QSO_deleted'] = FALSE; |
|
| 343 | 343 | } |
| 344 | 344 | //order by QSO_order |
| 345 | - $query_params[ 'order_by' ] = array( 'QSO_order' => 'ASC' ); |
|
| 346 | - return $this->get_many_related( 'Question_Option', $query_params ); |
|
| 345 | + $query_params['order_by'] = array('QSO_order' => 'ASC'); |
|
| 346 | + return $this->get_many_related('Question_Option', $query_params); |
|
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | |
@@ -353,7 +353,7 @@ discard block |
||
| 353 | 353 | * @return \EE_Question_Option[] |
| 354 | 354 | */ |
| 355 | 355 | public function temp_options() { |
| 356 | - return $this->_model_relations[ 'Question_Option' ]; |
|
| 356 | + return $this->_model_relations['Question_Option']; |
|
| 357 | 357 | } |
| 358 | 358 | |
| 359 | 359 | |
@@ -364,8 +364,8 @@ discard block |
||
| 364 | 364 | * @param EE_Question_Option $option |
| 365 | 365 | * @return boolean success |
| 366 | 366 | */ |
| 367 | - public function add_option( EE_Question_Option $option ) { |
|
| 368 | - return $this->_add_relation_to( $option, 'Question_Option' ); |
|
| 367 | + public function add_option(EE_Question_Option $option) { |
|
| 368 | + return $this->_add_relation_to($option, 'Question_Option'); |
|
| 369 | 369 | } |
| 370 | 370 | |
| 371 | 371 | |
@@ -375,8 +375,8 @@ discard block |
||
| 375 | 375 | * @param EE_Question_Option $option |
| 376 | 376 | * @return boolean success |
| 377 | 377 | */ |
| 378 | - public function add_temp_option( EE_Question_Option $option ) { |
|
| 379 | - $this->_model_relations[ 'Question_Option' ][ ] = $option; |
|
| 378 | + public function add_temp_option(EE_Question_Option $option) { |
|
| 379 | + $this->_model_relations['Question_Option'][] = $option; |
|
| 380 | 380 | return TRUE; |
| 381 | 381 | } |
| 382 | 382 | |
@@ -387,8 +387,8 @@ discard block |
||
| 387 | 387 | * @param EE_Question_Option $option |
| 388 | 388 | * @return boolean success |
| 389 | 389 | */ |
| 390 | - public function remove_option( EE_Question_Option $option ) { |
|
| 391 | - return $this->_remove_relation_to( $option, 'Question_Option' ); |
|
| 390 | + public function remove_option(EE_Question_Option $option) { |
|
| 391 | + return $this->_remove_relation_to($option, 'Question_Option'); |
|
| 392 | 392 | } |
| 393 | 393 | |
| 394 | 394 | |
@@ -397,8 +397,8 @@ discard block |
||
| 397 | 397 | * @return bool |
| 398 | 398 | */ |
| 399 | 399 | public function is_system_question() { |
| 400 | - $system_ID = $this->get( 'QST_system' ); |
|
| 401 | - return ! empty( $system_ID ) ? TRUE : FALSE; |
|
| 400 | + $system_ID = $this->get('QST_system'); |
|
| 401 | + return ! empty($system_ID) ? TRUE : FALSE; |
|
| 402 | 402 | } |
| 403 | 403 | |
| 404 | 404 | |
@@ -411,8 +411,8 @@ discard block |
||
| 411 | 411 | */ |
| 412 | 412 | public function set_order_to_latest() { |
| 413 | 413 | $latest_order = $this->get_model()->get_latest_question_order(); |
| 414 | - $latest_order ++; |
|
| 415 | - $this->set( 'QST_order', $latest_order ); |
|
| 414 | + $latest_order++; |
|
| 415 | + $this->set('QST_order', $latest_order); |
|
| 416 | 416 | } |
| 417 | 417 | |
| 418 | 418 | |
@@ -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 |
@@ -40,9 +40,9 @@ discard block |
||
| 40 | 40 | * @param array $props_n_values |
| 41 | 41 | * @return EE_Question_Option |
| 42 | 42 | */ |
| 43 | - public static function new_instance( $props_n_values = array() ) { |
|
| 44 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
| 45 | - return $has_object ? $has_object : new self( $props_n_values ); |
|
| 43 | + public static function new_instance($props_n_values = array()) { |
|
| 44 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
| 45 | + return $has_object ? $has_object : new self($props_n_values); |
|
| 46 | 46 | } |
| 47 | 47 | |
| 48 | 48 | |
@@ -51,8 +51,8 @@ discard block |
||
| 51 | 51 | * @param array $props_n_values |
| 52 | 52 | * @return EE_Question_Option |
| 53 | 53 | */ |
| 54 | - public static function new_instance_from_db( $props_n_values = array() ) { |
|
| 55 | - return new self( $props_n_values, TRUE ); |
|
| 54 | + public static function new_instance_from_db($props_n_values = array()) { |
|
| 55 | + return new self($props_n_values, TRUE); |
|
| 56 | 56 | } |
| 57 | 57 | |
| 58 | 58 | |
@@ -62,8 +62,8 @@ discard block |
||
| 62 | 62 | * @param string $value |
| 63 | 63 | * @return bool success |
| 64 | 64 | */ |
| 65 | - public function set_value( $value ) { |
|
| 66 | - $this->set( 'QSO_value', $value ); |
|
| 65 | + public function set_value($value) { |
|
| 66 | + $this->set('QSO_value', $value); |
|
| 67 | 67 | } |
| 68 | 68 | |
| 69 | 69 | |
@@ -73,8 +73,8 @@ discard block |
||
| 73 | 73 | * @param string $text |
| 74 | 74 | * @return bool success |
| 75 | 75 | */ |
| 76 | - public function set_desc( $text ) { |
|
| 77 | - $this->set( 'QSO_desc', $text ); |
|
| 76 | + public function set_desc($text) { |
|
| 77 | + $this->set('QSO_desc', $text); |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | |
@@ -86,8 +86,8 @@ discard block |
||
| 86 | 86 | * @param integer $order |
| 87 | 87 | * @return bool $success |
| 88 | 88 | */ |
| 89 | - public function set_order( $order ) { |
|
| 90 | - $this->set( 'QSO_order', $order ); |
|
| 89 | + public function set_order($order) { |
|
| 90 | + $this->set('QSO_order', $order); |
|
| 91 | 91 | } |
| 92 | 92 | |
| 93 | 93 | |
@@ -97,8 +97,8 @@ discard block |
||
| 97 | 97 | * @param int $question_ID |
| 98 | 98 | * @return bool success |
| 99 | 99 | */ |
| 100 | - public function set_question_ID( $question_ID ) { |
|
| 101 | - $this->set( 'QST_ID', $question_ID ); |
|
| 100 | + public function set_question_ID($question_ID) { |
|
| 101 | + $this->set('QST_ID', $question_ID); |
|
| 102 | 102 | } |
| 103 | 103 | |
| 104 | 104 | |
@@ -108,7 +108,7 @@ discard block |
||
| 108 | 108 | * @param string $text |
| 109 | 109 | * @return bool success |
| 110 | 110 | */ |
| 111 | - public function set_opt_group( $text ) { |
|
| 111 | + public function set_opt_group($text) { |
|
| 112 | 112 | return $this->_QSO_opt_group = $text; |
| 113 | 113 | } |
| 114 | 114 | |
@@ -119,7 +119,7 @@ discard block |
||
| 119 | 119 | * @return string |
| 120 | 120 | */ |
| 121 | 121 | public function value() { |
| 122 | - return $this->get( 'QSO_value' ); |
|
| 122 | + return $this->get('QSO_value'); |
|
| 123 | 123 | } |
| 124 | 124 | |
| 125 | 125 | |
@@ -129,7 +129,7 @@ discard block |
||
| 129 | 129 | * @return string |
| 130 | 130 | */ |
| 131 | 131 | public function desc() { |
| 132 | - return $this->get( 'QSO_desc' ); |
|
| 132 | + return $this->get('QSO_desc'); |
|
| 133 | 133 | } |
| 134 | 134 | |
| 135 | 135 | |
@@ -139,7 +139,7 @@ discard block |
||
| 139 | 139 | * @return boolean |
| 140 | 140 | */ |
| 141 | 141 | public function deleted() { |
| 142 | - return $this->get( 'QSO_deleted' ); |
|
| 142 | + return $this->get('QSO_deleted'); |
|
| 143 | 143 | } |
| 144 | 144 | |
| 145 | 145 | |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | * @return integer |
| 152 | 152 | */ |
| 153 | 153 | public function order() { |
| 154 | - return $this->get( 'QSO_option' ); |
|
| 154 | + return $this->get('QSO_option'); |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | * @return int |
| 162 | 162 | */ |
| 163 | 163 | public function question_ID() { |
| 164 | - return $this->get( 'QST_ID' ); |
|
| 164 | + return $this->get('QST_ID'); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | * @return EE_Question |
| 172 | 172 | */ |
| 173 | 173 | public function question() { |
| 174 | - return $this->get_first_related( 'Question' ); |
|
| 174 | + return $this->get_first_related('Question'); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | |
@@ -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 |
@@ -33,9 +33,9 @@ discard block |
||
| 33 | 33 | * @param array $props_n_values |
| 34 | 34 | * @return EE_Venue |
| 35 | 35 | */ |
| 36 | - public static function new_instance( $props_n_values = array() ) { |
|
| 37 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
| 38 | - return $has_object ? $has_object : new self( $props_n_values ); |
|
| 36 | + public static function new_instance($props_n_values = array()) { |
|
| 37 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
| 38 | + return $has_object ? $has_object : new self($props_n_values); |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | |
@@ -45,8 +45,8 @@ discard block |
||
| 45 | 45 | * @param array $props_n_values |
| 46 | 46 | * @return EE_Venue |
| 47 | 47 | */ |
| 48 | - public static function new_instance_from_db( $props_n_values = array() ) { |
|
| 49 | - return new self( $props_n_values, TRUE ); |
|
| 48 | + public static function new_instance_from_db($props_n_values = array()) { |
|
| 49 | + return new self($props_n_values, TRUE); |
|
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | |
@@ -56,7 +56,7 @@ discard block |
||
| 56 | 56 | * @return string |
| 57 | 57 | */ |
| 58 | 58 | function name() { |
| 59 | - return $this->get( 'VNU_name' ); |
|
| 59 | + return $this->get('VNU_name'); |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | |
@@ -65,7 +65,7 @@ discard block |
||
| 65 | 65 | * @return string |
| 66 | 66 | */ |
| 67 | 67 | function phone() { |
| 68 | - return $this->get( 'VNU_phone' ); |
|
| 68 | + return $this->get('VNU_phone'); |
|
| 69 | 69 | } |
| 70 | 70 | |
| 71 | 71 | |
@@ -75,7 +75,7 @@ discard block |
||
| 75 | 75 | * @return string |
| 76 | 76 | */ |
| 77 | 77 | function venue_url() { |
| 78 | - return $this->get( 'VNU_url' ); |
|
| 78 | + return $this->get('VNU_url'); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | |
@@ -84,7 +84,7 @@ discard block |
||
| 84 | 84 | * @return string |
| 85 | 85 | */ |
| 86 | 86 | function description() { |
| 87 | - return $this->get( 'VNU_desc' ); |
|
| 87 | + return $this->get('VNU_desc'); |
|
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | |
@@ -94,7 +94,7 @@ discard block |
||
| 94 | 94 | * @return string |
| 95 | 95 | */ |
| 96 | 96 | function excerpt() { |
| 97 | - return $this->get( 'VNU_short_desc' ); |
|
| 97 | + return $this->get('VNU_short_desc'); |
|
| 98 | 98 | } |
| 99 | 99 | |
| 100 | 100 | |
@@ -104,7 +104,7 @@ discard block |
||
| 104 | 104 | * @return string |
| 105 | 105 | */ |
| 106 | 106 | function identifier() { |
| 107 | - return $this->get( 'VNU_identifier' ); |
|
| 107 | + return $this->get('VNU_identifier'); |
|
| 108 | 108 | } |
| 109 | 109 | |
| 110 | 110 | |
@@ -114,7 +114,7 @@ discard block |
||
| 114 | 114 | * @return string |
| 115 | 115 | */ |
| 116 | 116 | function address() { |
| 117 | - return $this->get( 'VNU_address' ); |
|
| 117 | + return $this->get('VNU_address'); |
|
| 118 | 118 | } |
| 119 | 119 | |
| 120 | 120 | |
@@ -124,7 +124,7 @@ discard block |
||
| 124 | 124 | * @return string |
| 125 | 125 | */ |
| 126 | 126 | function address2() { |
| 127 | - return $this->get( 'VNU_address2' ); |
|
| 127 | + return $this->get('VNU_address2'); |
|
| 128 | 128 | } |
| 129 | 129 | |
| 130 | 130 | |
@@ -135,7 +135,7 @@ discard block |
||
| 135 | 135 | * @return string |
| 136 | 136 | */ |
| 137 | 137 | function city() { |
| 138 | - return $this->get( 'VNU_city' ); |
|
| 138 | + return $this->get('VNU_city'); |
|
| 139 | 139 | } |
| 140 | 140 | |
| 141 | 141 | /** |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | * @return int |
| 144 | 144 | */ |
| 145 | 145 | function state_ID() { |
| 146 | - return $this->get( 'STA_ID' ); |
|
| 146 | + return $this->get('STA_ID'); |
|
| 147 | 147 | } |
| 148 | 148 | |
| 149 | 149 | |
@@ -152,7 +152,7 @@ discard block |
||
| 152 | 152 | * @return string |
| 153 | 153 | */ |
| 154 | 154 | public function state_abbrev() { |
| 155 | - return $this->state_obj() instanceof EE_State ? $this->state_obj()->abbrev() : __( 'Unknown', 'event_espresso' ); |
|
| 155 | + return $this->state_obj() instanceof EE_State ? $this->state_obj()->abbrev() : __('Unknown', 'event_espresso'); |
|
| 156 | 156 | } |
| 157 | 157 | |
| 158 | 158 | |
@@ -161,7 +161,7 @@ discard block |
||
| 161 | 161 | * @return string |
| 162 | 162 | */ |
| 163 | 163 | public function state_name() { |
| 164 | - return $this->state_obj() instanceof EE_State ? $this->state_obj()->name() : __( 'Unknown', 'event_espresso' ); |
|
| 164 | + return $this->state_obj() instanceof EE_State ? $this->state_obj()->name() : __('Unknown', 'event_espresso'); |
|
| 165 | 165 | } |
| 166 | 166 | |
| 167 | 167 | |
@@ -171,7 +171,7 @@ discard block |
||
| 171 | 171 | * @return EE_State |
| 172 | 172 | */ |
| 173 | 173 | function state_obj() { |
| 174 | - return $this->get_first_related( 'State' ); |
|
| 174 | + return $this->get_first_related('State'); |
|
| 175 | 175 | } |
| 176 | 176 | |
| 177 | 177 | |
@@ -183,7 +183,7 @@ discard block |
||
| 183 | 183 | * @return string |
| 184 | 184 | */ |
| 185 | 185 | public function state() { |
| 186 | - if ( apply_filters( 'FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj() ) ) { |
|
| 186 | + if (apply_filters('FHEE__EEI_Address__state__use_abbreviation', true, $this->state_obj())) { |
|
| 187 | 187 | return $this->state_abbrev(); |
| 188 | 188 | } else { |
| 189 | 189 | return $this->state_name(); |
@@ -197,7 +197,7 @@ discard block |
||
| 197 | 197 | * @return string |
| 198 | 198 | */ |
| 199 | 199 | function country_ID() { |
| 200 | - return $this->get( 'CNT_ISO' ); |
|
| 200 | + return $this->get('CNT_ISO'); |
|
| 201 | 201 | } |
| 202 | 202 | |
| 203 | 203 | |
@@ -206,7 +206,7 @@ discard block |
||
| 206 | 206 | * @return string |
| 207 | 207 | */ |
| 208 | 208 | public function country_name() { |
| 209 | - return $this->country_obj() instanceof EE_Country ? $this->country_obj()->name() : __( 'Unknown', 'event_espresso' ); |
|
| 209 | + return $this->country_obj() instanceof EE_Country ? $this->country_obj()->name() : __('Unknown', 'event_espresso'); |
|
| 210 | 210 | } |
| 211 | 211 | |
| 212 | 212 | |
@@ -216,7 +216,7 @@ discard block |
||
| 216 | 216 | * @return EE_Country |
| 217 | 217 | */ |
| 218 | 218 | function country_obj() { |
| 219 | - return $this->get_first_related( 'Country' ); |
|
| 219 | + return $this->get_first_related('Country'); |
|
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | |
@@ -228,7 +228,7 @@ discard block |
||
| 228 | 228 | * @return string |
| 229 | 229 | */ |
| 230 | 230 | public function country() { |
| 231 | - if ( apply_filters( 'FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj() ) ) { |
|
| 231 | + if (apply_filters('FHEE__EEI_Address__country__use_abbreviation', true, $this->country_obj())) { |
|
| 232 | 232 | return $this->country_ID(); |
| 233 | 233 | } else { |
| 234 | 234 | return $this->country_name(); |
@@ -242,7 +242,7 @@ discard block |
||
| 242 | 242 | * @return string |
| 243 | 243 | */ |
| 244 | 244 | function zip() { |
| 245 | - return $this->get( 'VNU_zip' ); |
|
| 245 | + return $this->get('VNU_zip'); |
|
| 246 | 246 | } |
| 247 | 247 | |
| 248 | 248 | |
@@ -252,7 +252,7 @@ discard block |
||
| 252 | 252 | * @return int |
| 253 | 253 | */ |
| 254 | 254 | function capacity() { |
| 255 | - return $this->get_pretty( 'VNU_capacity', 'symbol' ); |
|
| 255 | + return $this->get_pretty('VNU_capacity', 'symbol'); |
|
| 256 | 256 | } |
| 257 | 257 | |
| 258 | 258 | |
@@ -262,7 +262,7 @@ discard block |
||
| 262 | 262 | * @return string |
| 263 | 263 | */ |
| 264 | 264 | function created() { |
| 265 | - return $this->get( 'VNU_created' ); |
|
| 265 | + return $this->get('VNU_created'); |
|
| 266 | 266 | } |
| 267 | 267 | |
| 268 | 268 | |
@@ -272,7 +272,7 @@ discard block |
||
| 272 | 272 | * @return string |
| 273 | 273 | */ |
| 274 | 274 | function modified() { |
| 275 | - return $this->get( 'VNU_modified' ); |
|
| 275 | + return $this->get('VNU_modified'); |
|
| 276 | 276 | } |
| 277 | 277 | |
| 278 | 278 | |
@@ -282,7 +282,7 @@ discard block |
||
| 282 | 282 | * @return int |
| 283 | 283 | */ |
| 284 | 284 | function order() { |
| 285 | - return $this->get( 'VNU_order' ); |
|
| 285 | + return $this->get('VNU_order'); |
|
| 286 | 286 | } |
| 287 | 287 | |
| 288 | 288 | |
@@ -292,7 +292,7 @@ discard block |
||
| 292 | 292 | * @return int |
| 293 | 293 | */ |
| 294 | 294 | function wp_user() { |
| 295 | - return $this->get( 'VNU_wp_user' ); |
|
| 295 | + return $this->get('VNU_wp_user'); |
|
| 296 | 296 | } |
| 297 | 297 | |
| 298 | 298 | |
@@ -301,7 +301,7 @@ discard block |
||
| 301 | 301 | * @return string |
| 302 | 302 | */ |
| 303 | 303 | function virtual_phone() { |
| 304 | - return $this->get( 'VNU_virtual_phone' ); |
|
| 304 | + return $this->get('VNU_virtual_phone'); |
|
| 305 | 305 | } |
| 306 | 306 | |
| 307 | 307 | |
@@ -310,7 +310,7 @@ discard block |
||
| 310 | 310 | * @return string |
| 311 | 311 | */ |
| 312 | 312 | function virtual_url() { |
| 313 | - return $this->get( 'VNU_virtual_url' ); |
|
| 313 | + return $this->get('VNU_virtual_url'); |
|
| 314 | 314 | } |
| 315 | 315 | |
| 316 | 316 | |
@@ -319,7 +319,7 @@ discard block |
||
| 319 | 319 | * @return bool |
| 320 | 320 | */ |
| 321 | 321 | function enable_for_gmap() { |
| 322 | - return $this->get( 'VNU_enable_for_gmap' ); |
|
| 322 | + return $this->get('VNU_enable_for_gmap'); |
|
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | |
@@ -328,7 +328,7 @@ discard block |
||
| 328 | 328 | * @return string |
| 329 | 329 | */ |
| 330 | 330 | function google_map_link() { |
| 331 | - return $this->get( 'VNU_google_map_link' ); |
|
| 331 | + return $this->get('VNU_google_map_link'); |
|
| 332 | 332 | } |
| 333 | 333 | |
| 334 | 334 | |
@@ -340,16 +340,16 @@ discard block |
||
| 340 | 340 | * @param bool $upcoming |
| 341 | 341 | * @return EE_Event[] |
| 342 | 342 | */ |
| 343 | - function events( $query_params = array(), $upcoming = FALSE ) { |
|
| 344 | - if ( $upcoming ) { |
|
| 343 | + function events($query_params = array(), $upcoming = FALSE) { |
|
| 344 | + if ($upcoming) { |
|
| 345 | 345 | $query_params = array( |
| 346 | 346 | array( |
| 347 | 347 | 'status' => 'publish', |
| 348 | - 'Datetime.DTT_EVT_start' => array( '>', current_time( 'mysql' )) |
|
| 348 | + 'Datetime.DTT_EVT_start' => array('>', current_time('mysql')) |
|
| 349 | 349 | ) |
| 350 | 350 | ); |
| 351 | 351 | } |
| 352 | - return $this->get_many_related( 'Event', $query_params ); |
|
| 352 | + return $this->get_many_related('Event', $query_params); |
|
| 353 | 353 | } |
| 354 | 354 | |
| 355 | 355 | |
@@ -367,8 +367,8 @@ discard block |
||
| 367 | 367 | /** |
| 368 | 368 | * Sets address |
| 369 | 369 | */ |
| 370 | - function set_address( $address = '' ) { |
|
| 371 | - $this->set( 'VNU_address', $address ); |
|
| 370 | + function set_address($address = '') { |
|
| 371 | + $this->set('VNU_address', $address); |
|
| 372 | 372 | } |
| 373 | 373 | |
| 374 | 374 | |
@@ -376,8 +376,8 @@ discard block |
||
| 376 | 376 | /** |
| 377 | 377 | * @param string $address2 |
| 378 | 378 | */ |
| 379 | - function set_address2( $address2 = '' ) { |
|
| 380 | - $this->set( 'VNU_address2', $address2 ); |
|
| 379 | + function set_address2($address2 = '') { |
|
| 380 | + $this->set('VNU_address2', $address2); |
|
| 381 | 381 | } |
| 382 | 382 | |
| 383 | 383 | |
@@ -385,8 +385,8 @@ discard block |
||
| 385 | 385 | /** |
| 386 | 386 | * @param string $city |
| 387 | 387 | */ |
| 388 | - function set_city( $city = '' ) { |
|
| 389 | - $this->set( 'VNU_city', $city ); |
|
| 388 | + function set_city($city = '') { |
|
| 389 | + $this->set('VNU_city', $city); |
|
| 390 | 390 | } |
| 391 | 391 | |
| 392 | 392 | |
@@ -394,8 +394,8 @@ discard block |
||
| 394 | 394 | /** |
| 395 | 395 | * @param int $state |
| 396 | 396 | */ |
| 397 | - function set_state_ID( $state = 0 ) { |
|
| 398 | - $this->set( 'STA_ID', $state ); |
|
| 397 | + function set_state_ID($state = 0) { |
|
| 398 | + $this->set('STA_ID', $state); |
|
| 399 | 399 | } |
| 400 | 400 | |
| 401 | 401 | |
@@ -406,8 +406,8 @@ discard block |
||
| 406 | 406 | * @param EE_State /int $state_id_or_obj |
| 407 | 407 | * @return EE_State |
| 408 | 408 | */ |
| 409 | - function set_state_obj( $state_id_or_obj ) { |
|
| 410 | - return $this->_add_relation_to( $state_id_or_obj, 'State' ); |
|
| 409 | + function set_state_obj($state_id_or_obj) { |
|
| 410 | + return $this->_add_relation_to($state_id_or_obj, 'State'); |
|
| 411 | 411 | } |
| 412 | 412 | |
| 413 | 413 | |
@@ -415,8 +415,8 @@ discard block |
||
| 415 | 415 | /** |
| 416 | 416 | * @param int $country_ID |
| 417 | 417 | */ |
| 418 | - function set_country_ID( $country_ID = 0 ) { |
|
| 419 | - $this->set( 'CNT_ISO', $country_ID ); |
|
| 418 | + function set_country_ID($country_ID = 0) { |
|
| 419 | + $this->set('CNT_ISO', $country_ID); |
|
| 420 | 420 | } |
| 421 | 421 | |
| 422 | 422 | |
@@ -425,7 +425,7 @@ discard block |
||
| 425 | 425 | * @param EE_Country /string $country_id_or_obj |
| 426 | 426 | * @return EE_Country |
| 427 | 427 | */ |
| 428 | - function set_country_obj( $country_id_or_obj ) { |
|
| 428 | + function set_country_obj($country_id_or_obj) { |
|
| 429 | 429 | return $this->_add_relation_to($country_id_or_obj, 'Country'); |
| 430 | 430 | } |
| 431 | 431 | |
@@ -434,8 +434,8 @@ discard block |
||
| 434 | 434 | /** |
| 435 | 435 | * @param string $zip |
| 436 | 436 | */ |
| 437 | - function set_zip( $zip = '' ) { |
|
| 438 | - $this->set( 'VNU_zip', $zip ); |
|
| 437 | + function set_zip($zip = '') { |
|
| 438 | + $this->set('VNU_zip', $zip); |
|
| 439 | 439 | } |
| 440 | 440 | |
| 441 | 441 | |
@@ -443,8 +443,8 @@ discard block |
||
| 443 | 443 | /** |
| 444 | 444 | * @param int $capacity |
| 445 | 445 | */ |
| 446 | - function set_capacity( $capacity = 0 ) { |
|
| 447 | - $this->set( 'VNU_capacity', $capacity ); |
|
| 446 | + function set_capacity($capacity = 0) { |
|
| 447 | + $this->set('VNU_capacity', $capacity); |
|
| 448 | 448 | } |
| 449 | 449 | |
| 450 | 450 | |
@@ -452,8 +452,8 @@ discard block |
||
| 452 | 452 | /** |
| 453 | 453 | * @param string $created |
| 454 | 454 | */ |
| 455 | - function set_created( $created = '' ) { |
|
| 456 | - $this->set( 'VNU_created', $created ); |
|
| 455 | + function set_created($created = '') { |
|
| 456 | + $this->set('VNU_created', $created); |
|
| 457 | 457 | } |
| 458 | 458 | |
| 459 | 459 | |
@@ -461,8 +461,8 @@ discard block |
||
| 461 | 461 | /** |
| 462 | 462 | * @param string $desc |
| 463 | 463 | */ |
| 464 | - function set_description( $desc = '' ) { |
|
| 465 | - $this->set( 'VNU_desc', $desc ); |
|
| 464 | + function set_description($desc = '') { |
|
| 465 | + $this->set('VNU_desc', $desc); |
|
| 466 | 466 | } |
| 467 | 467 | |
| 468 | 468 | |
@@ -470,8 +470,8 @@ discard block |
||
| 470 | 470 | /** |
| 471 | 471 | * @param string $identifier |
| 472 | 472 | */ |
| 473 | - function set_identifier( $identifier = '' ) { |
|
| 474 | - $this->set( 'VNU_identifier', $identifier ); |
|
| 473 | + function set_identifier($identifier = '') { |
|
| 474 | + $this->set('VNU_identifier', $identifier); |
|
| 475 | 475 | } |
| 476 | 476 | |
| 477 | 477 | |
@@ -479,8 +479,8 @@ discard block |
||
| 479 | 479 | /** |
| 480 | 480 | * @param string $modified |
| 481 | 481 | */ |
| 482 | - function set_modified( $modified = '' ) { |
|
| 483 | - $this->set( 'VNU_modified', $modified ); |
|
| 482 | + function set_modified($modified = '') { |
|
| 483 | + $this->set('VNU_modified', $modified); |
|
| 484 | 484 | } |
| 485 | 485 | |
| 486 | 486 | |
@@ -488,8 +488,8 @@ discard block |
||
| 488 | 488 | /** |
| 489 | 489 | * @param string $name |
| 490 | 490 | */ |
| 491 | - function set_name( $name = '' ) { |
|
| 492 | - $this->set( 'VNU_name', $name ); |
|
| 491 | + function set_name($name = '') { |
|
| 492 | + $this->set('VNU_name', $name); |
|
| 493 | 493 | } |
| 494 | 494 | |
| 495 | 495 | |
@@ -497,8 +497,8 @@ discard block |
||
| 497 | 497 | /** |
| 498 | 498 | * @param int $order |
| 499 | 499 | */ |
| 500 | - function set_order( $order = 0 ) { |
|
| 501 | - $this->set( 'VNU_order', $order ); |
|
| 500 | + function set_order($order = 0) { |
|
| 501 | + $this->set('VNU_order', $order); |
|
| 502 | 502 | } |
| 503 | 503 | |
| 504 | 504 | |
@@ -506,8 +506,8 @@ discard block |
||
| 506 | 506 | /** |
| 507 | 507 | * @param string $phone |
| 508 | 508 | */ |
| 509 | - function set_phone( $phone = '' ) { |
|
| 510 | - $this->set( 'VNU_phone', $phone ); |
|
| 509 | + function set_phone($phone = '') { |
|
| 510 | + $this->set('VNU_phone', $phone); |
|
| 511 | 511 | } |
| 512 | 512 | |
| 513 | 513 | |
@@ -515,8 +515,8 @@ discard block |
||
| 515 | 515 | /** |
| 516 | 516 | * @param int $wp_user |
| 517 | 517 | */ |
| 518 | - function set_wp_user( $wp_user = 1 ) { |
|
| 519 | - $this->set( 'VNU_wp_user', $wp_user ); |
|
| 518 | + function set_wp_user($wp_user = 1) { |
|
| 519 | + $this->set('VNU_wp_user', $wp_user); |
|
| 520 | 520 | } |
| 521 | 521 | |
| 522 | 522 | |
@@ -524,8 +524,8 @@ discard block |
||
| 524 | 524 | /** |
| 525 | 525 | * @param string $url |
| 526 | 526 | */ |
| 527 | - function set_venue_url( $url = '' ) { |
|
| 528 | - $this->set( 'VNU_url', $url ); |
|
| 527 | + function set_venue_url($url = '') { |
|
| 528 | + $this->set('VNU_url', $url); |
|
| 529 | 529 | } |
| 530 | 530 | |
| 531 | 531 | |
@@ -533,8 +533,8 @@ discard block |
||
| 533 | 533 | /** |
| 534 | 534 | * @param string $phone |
| 535 | 535 | */ |
| 536 | - function set_virtual_phone( $phone = '' ) { |
|
| 537 | - $this->set( 'VNU_virtual_phone', $phone ); |
|
| 536 | + function set_virtual_phone($phone = '') { |
|
| 537 | + $this->set('VNU_virtual_phone', $phone); |
|
| 538 | 538 | } |
| 539 | 539 | |
| 540 | 540 | |
@@ -542,8 +542,8 @@ discard block |
||
| 542 | 542 | /** |
| 543 | 543 | * @param string $url |
| 544 | 544 | */ |
| 545 | - function set_virtual_url( $url = '' ) { |
|
| 546 | - $this->set( 'VNU_virtual_url', $url ); |
|
| 545 | + function set_virtual_url($url = '') { |
|
| 546 | + $this->set('VNU_virtual_url', $url); |
|
| 547 | 547 | } |
| 548 | 548 | |
| 549 | 549 | |
@@ -551,8 +551,8 @@ discard block |
||
| 551 | 551 | /** |
| 552 | 552 | * @param string $enable |
| 553 | 553 | */ |
| 554 | - function set_enable_for_gmap( $enable = '' ) { |
|
| 555 | - $this->set( 'VNU_enable_for_gmap', $enable ); |
|
| 554 | + function set_enable_for_gmap($enable = '') { |
|
| 555 | + $this->set('VNU_enable_for_gmap', $enable); |
|
| 556 | 556 | } |
| 557 | 557 | |
| 558 | 558 | |
@@ -560,8 +560,8 @@ discard block |
||
| 560 | 560 | /** |
| 561 | 561 | * @param string $google_map_link |
| 562 | 562 | */ |
| 563 | - function set_google_map_link( $google_map_link = '' ) { |
|
| 564 | - $this->set( 'VNU_google_map_link', $google_map_link ); |
|
| 563 | + function set_google_map_link($google_map_link = '') { |
|
| 564 | + $this->set('VNU_google_map_link', $google_map_link); |
|
| 565 | 565 | } |
| 566 | 566 | |
| 567 | 567 | |
@@ -23,8 +23,8 @@ discard block |
||
| 23 | 23 | * |
| 24 | 24 | * ------------------------------------------------------------------------ |
| 25 | 25 | */ |
| 26 | -require_once ( EE_MODELS . 'EEM_Base.model.php' ); |
|
| 27 | -require_once ( EE_CLASSES . 'EE_Checkin.class.php' ); |
|
| 26 | +require_once (EE_MODELS.'EEM_Base.model.php'); |
|
| 27 | +require_once (EE_CLASSES.'EE_Checkin.class.php'); |
|
| 28 | 28 | |
| 29 | 29 | class EEM_Checkin extends EEM_Base { |
| 30 | 30 | |
@@ -40,12 +40,12 @@ discard block |
||
| 40 | 40 | * @param string $timezone string representing the timezone we want to set for returned Date Time Strings (and any incoming timezone data that gets saved). Note this just sends the timezone info to the date time model field objects. Default is NULL (and will be assumed using the set timezone in the 'timezone_string' wp option) |
| 41 | 41 | * @return void |
| 42 | 42 | */ |
| 43 | - protected function __construct( $timezone = NULL ) { |
|
| 44 | - $this->singular_item = __('Check-In','event_espresso'); |
|
| 45 | - $this->plural_item = __('Check-Ins','event_espresso'); |
|
| 43 | + protected function __construct($timezone = NULL) { |
|
| 44 | + $this->singular_item = __('Check-In', 'event_espresso'); |
|
| 45 | + $this->plural_item = __('Check-Ins', 'event_espresso'); |
|
| 46 | 46 | |
| 47 | 47 | $this->_tables = array( |
| 48 | - 'Checkin'=>new EE_Primary_Table('esp_checkin','CHK_ID') |
|
| 48 | + 'Checkin'=>new EE_Primary_Table('esp_checkin', 'CHK_ID') |
|
| 49 | 49 | ); |
| 50 | 50 | $this->_fields = array( |
| 51 | 51 | 'Checkin'=> array( |
@@ -53,7 +53,7 @@ discard block |
||
| 53 | 53 | 'REG_ID'=>new EE_Foreign_Key_Int_Field('REG_ID', 'Registration Id', false, 0, 'Registration'), |
| 54 | 54 | 'DTT_ID'=>new EE_Foreign_Key_Int_Field('DTT_ID', 'Datetime Id', false, 0, 'Datetime'), |
| 55 | 55 | 'CHK_in'=>new EE_Boolean_Field('CHK_in', 'Whether a person has checked in or checked out', false, true), |
| 56 | - 'CHK_timestamp'=>new EE_Datetime_Field('CHK_timestamp', __('When the row was modified','event_espresso'), false, current_time('timestamp'), $timezone ) |
|
| 56 | + 'CHK_timestamp'=>new EE_Datetime_Field('CHK_timestamp', __('When the row was modified', 'event_espresso'), false, current_time('timestamp'), $timezone) |
|
| 57 | 57 | ) |
| 58 | 58 | ); |
| 59 | 59 | $this->_model_relations = array( |
@@ -61,7 +61,7 @@ discard block |
||
| 61 | 61 | 'Datetime'=>new EE_Belongs_To_Relation() |
| 62 | 62 | ); |
| 63 | 63 | $this->_model_chain_to_wp_user = 'Registration.Event'; |
| 64 | - parent::__construct( $timezone ); |
|
| 64 | + parent::__construct($timezone); |
|
| 65 | 65 | |
| 66 | 66 | } |
| 67 | 67 | |
@@ -1,4 +1,6 @@ |
||
| 1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
| 1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | /** |
| 3 | 5 | * Event Espresso |
| 4 | 6 | * |
@@ -1,4 +1,6 @@ discard block |
||
| 1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
| 1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
| 2 | + exit('No direct script access allowed'); |
|
| 3 | +} |
|
| 2 | 4 | require_once( EE_MODELS . 'EEM_CPT_Base.model.php'); |
| 3 | 5 | /** |
| 4 | 6 | * |
@@ -337,8 +339,9 @@ discard block |
||
| 337 | 339 | $questions[ $qg->ID() ] = $qg->model_field_array(); |
| 338 | 340 | $questions[ $qg->ID() ]['QSG_questions'] = array(); |
| 339 | 341 | foreach ( $qsts as $qst ) { |
| 340 | - if ( $qst->is_system_question() ) |
|
| 341 | - continue; |
|
| 342 | + if ( $qst->is_system_question() ) { |
|
| 343 | + continue; |
|
| 344 | + } |
|
| 342 | 345 | $answer = EEM_Answer::instance()->get_one( array( array( 'QST_ID' => $qst->ID(), 'REG_ID' => $registration->ID() ) ) ); |
| 343 | 346 | $answer = $answer instanceof EE_Answer ? $answer : EEM_Answer::instance()->create_default_object(); |
| 344 | 347 | $qst_name = $qstn_id = $qst->ID(); |
@@ -514,8 +517,9 @@ discard block |
||
| 514 | 517 | } |
| 515 | 518 | |
| 516 | 519 | //let's add specific query_params for active_events - keep in mind this will override any sent status in the query AND any date queries. |
| 517 | - if ( isset( $where_params['status'] ) ) |
|
| 518 | - unset( $where_params['status'] ); |
|
| 520 | + if ( isset( $where_params['status'] ) ) { |
|
| 521 | + unset( $where_params['status'] ); |
|
| 522 | + } |
|
| 519 | 523 | $where_params['OR'] = array( 'status' => array( '!=', 'publish' ), 'AND' => array('status' => 'publish', 'Datetime.DTT_EVT_end' => array( '<', date('Y-m-d g:i:s', time() ) ) ) ); |
| 520 | 524 | $query_params[0] = $where_params; |
| 521 | 525 | return $count ? $this->count($query_params, 'EVT_ID') : $this->get_all( $query_params ); |
@@ -538,8 +542,9 @@ discard block |
||
| 538 | 542 | } |
| 539 | 543 | |
| 540 | 544 | //let's add in specific query_params for inactive events. |
| 541 | - if ( isset( $where_params['status'] ) ) |
|
| 542 | - unset( $where_params['status'] ); |
|
| 545 | + if ( isset( $where_params['status'] ) ) { |
|
| 546 | + unset( $where_params['status'] ); |
|
| 547 | + } |
|
| 543 | 548 | |
| 544 | 549 | //we check for events that are not published OR are expired. |
| 545 | 550 | |
@@ -1,5 +1,5 @@ discard block |
||
| 1 | 1 | <?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
| 2 | -require_once( EE_MODELS . 'EEM_CPT_Base.model.php'); |
|
| 2 | +require_once(EE_MODELS.'EEM_CPT_Base.model.php'); |
|
| 3 | 3 | /** |
| 4 | 4 | * |
| 5 | 5 | * EEM_Event Model |
@@ -11,7 +11,7 @@ discard block |
||
| 11 | 11 | * @author Michael Nelson, Brent Christensen |
| 12 | 12 | * |
| 13 | 13 | */ |
| 14 | -class EEM_Event extends EEM_CPT_Base{ |
|
| 14 | +class EEM_Event extends EEM_CPT_Base { |
|
| 15 | 15 | |
| 16 | 16 | /** |
| 17 | 17 | * constant used by status(), indicating that no more tickets can be purchased for any of the datetimes for the event |
@@ -45,15 +45,15 @@ discard block |
||
| 45 | 45 | * @param string $timezone |
| 46 | 46 | * @return EEM_Event |
| 47 | 47 | */ |
| 48 | - public static function instance( $timezone = NULL ){ |
|
| 48 | + public static function instance($timezone = NULL) { |
|
| 49 | 49 | |
| 50 | 50 | // check if instance of EEM_Event already exists |
| 51 | - if ( ! self::$_instance instanceof EEM_Event ) { |
|
| 51 | + if ( ! self::$_instance instanceof EEM_Event) { |
|
| 52 | 52 | // instantiate Espresso_model |
| 53 | - self::$_instance = new self( $timezone ); |
|
| 53 | + self::$_instance = new self($timezone); |
|
| 54 | 54 | } |
| 55 | 55 | //we might have a timezone set, let set_timezone decide what to do with it |
| 56 | - self::$_instance->set_timezone( $timezone ); |
|
| 56 | + self::$_instance->set_timezone($timezone); |
|
| 57 | 57 | // EEM_Event object |
| 58 | 58 | return self::$_instance; |
| 59 | 59 | } |
@@ -64,12 +64,12 @@ discard block |
||
| 64 | 64 | * @param string $timezone |
| 65 | 65 | * @return EEM_Event |
| 66 | 66 | */ |
| 67 | - protected function __construct($timezone = null){ |
|
| 67 | + protected function __construct($timezone = null) { |
|
| 68 | 68 | |
| 69 | - EE_Registry::instance()->load_model( 'Registration' ); |
|
| 69 | + EE_Registry::instance()->load_model('Registration'); |
|
| 70 | 70 | |
| 71 | - $this->singular_item = __('Event','event_espresso'); |
|
| 72 | - $this->plural_item = __('Events','event_espresso'); |
|
| 71 | + $this->singular_item = __('Event', 'event_espresso'); |
|
| 72 | + $this->plural_item = __('Events', 'event_espresso'); |
|
| 73 | 73 | |
| 74 | 74 | // to remove Cancelled events from the frontend, copy the following filter to your functions.php file |
| 75 | 75 | // add_filter( 'AFEE__EEM_Event__construct___custom_stati__cancelled__Public', '__return_false' ); |
@@ -83,15 +83,15 @@ discard block |
||
| 83 | 83 | array( |
| 84 | 84 | EEM_Event::cancelled => array( |
| 85 | 85 | 'label' => __('Cancelled', 'event_espresso'), |
| 86 | - 'public' => apply_filters( 'AFEE__EEM_Event__construct___custom_stati__cancelled__Public', TRUE ) |
|
| 86 | + 'public' => apply_filters('AFEE__EEM_Event__construct___custom_stati__cancelled__Public', TRUE) |
|
| 87 | 87 | ), |
| 88 | 88 | EEM_Event::postponed => array( |
| 89 | 89 | 'label' => __('Postponed', 'event_espresso'), |
| 90 | - 'public' => apply_filters( 'AFEE__EEM_Event__construct___custom_stati__postponed__Public', TRUE ) |
|
| 90 | + 'public' => apply_filters('AFEE__EEM_Event__construct___custom_stati__postponed__Public', TRUE) |
|
| 91 | 91 | ), |
| 92 | 92 | EEM_Event::sold_out => array( |
| 93 | 93 | 'label' => __('Sold Out', 'event_espresso'), |
| 94 | - 'public' => apply_filters( 'AFEE__EEM_Event__construct___custom_stati__sold_out__Public', TRUE ) |
|
| 94 | + 'public' => apply_filters('AFEE__EEM_Event__construct___custom_stati__sold_out__Public', TRUE) |
|
| 95 | 95 | ) |
| 96 | 96 | ) |
| 97 | 97 | ); |
@@ -99,41 +99,41 @@ discard block |
||
| 99 | 99 | $default_registration_status = EE_Registry::instance()->CFG->registration instanceof EE_Registration_Config ? EE_Registry::instance()->CFG->registration->default_STS_ID : EEM_Registration::status_id_pending_payment; |
| 100 | 100 | |
| 101 | 101 | $this->_tables = array( |
| 102 | - 'Event_CPT'=>new EE_Primary_Table( 'posts','ID' ), |
|
| 103 | - 'Event_Meta'=> new EE_Secondary_Table( 'esp_event_meta', 'EVTM_ID', 'EVT_ID' ) |
|
| 102 | + 'Event_CPT'=>new EE_Primary_Table('posts', 'ID'), |
|
| 103 | + 'Event_Meta'=> new EE_Secondary_Table('esp_event_meta', 'EVTM_ID', 'EVT_ID') |
|
| 104 | 104 | ); |
| 105 | 105 | |
| 106 | 106 | $this->_fields = array( |
| 107 | 107 | 'Event_CPT'=>array( |
| 108 | - 'EVT_ID'=>new EE_Primary_Key_Int_Field( 'ID', __( 'Post ID for Event','event_espresso' )), |
|
| 109 | - 'EVT_name'=>new EE_Plain_Text_Field( 'post_title', __( 'Event Name','event_espresso' ), FALSE, '' ), |
|
| 110 | - 'EVT_desc'=>new EE_Post_Content_Field( 'post_content', __( 'Event Description', 'event_espresso' ), FALSE, '' ), |
|
| 111 | - 'EVT_slug'=>new EE_Slug_Field( 'post_name', __( 'Event Slug', 'event_espresso' ), FALSE, '' ), |
|
| 112 | - 'EVT_created'=>new EE_Datetime_Field( 'post_date', __( 'Date/Time Event Created', 'event_espresso' ), FALSE, current_time( 'timestamp' )), |
|
| 113 | - 'EVT_short_desc'=>new EE_Simple_HTML_Field( 'post_excerpt', __( 'Event Short Description', 'event_espresso' ), FALSE,'' ), |
|
| 114 | - 'EVT_modified'=>new EE_Datetime_Field( 'post_modified', __( 'Date/Time Event Modified', 'event_espresso' ), FALSE, current_time( 'timestamp' )), |
|
| 115 | - 'EVT_wp_user'=>new EE_WP_User_Field( 'post_author', __( 'Event Creator ID', 'event_espresso'), FALSE), |
|
| 116 | - 'parent'=>new EE_Integer_Field( 'post_parent', __( 'Event Parent ID', 'event_espresso' ), FALSE, 0 ), |
|
| 117 | - 'EVT_order'=>new EE_Integer_Field( 'menu_order', __( 'Event Menu Order', 'event_espresso' ), FALSE, 1 ), |
|
| 118 | - 'post_type'=>new EE_WP_Post_Type_Field('espresso_events'),// EE_Plain_Text_Field( 'post_type', __( 'Event Post Type', 'event_espresso' ), FALSE, 'espresso_events' ), |
|
| 119 | - 'status' => new EE_WP_Post_Status_Field( 'post_status', __( 'Event Status', 'event_espresso' ), FALSE, 'draft', $this->_custom_stati ) |
|
| 108 | + 'EVT_ID'=>new EE_Primary_Key_Int_Field('ID', __('Post ID for Event', 'event_espresso')), |
|
| 109 | + 'EVT_name'=>new EE_Plain_Text_Field('post_title', __('Event Name', 'event_espresso'), FALSE, ''), |
|
| 110 | + 'EVT_desc'=>new EE_Post_Content_Field('post_content', __('Event Description', 'event_espresso'), FALSE, ''), |
|
| 111 | + 'EVT_slug'=>new EE_Slug_Field('post_name', __('Event Slug', 'event_espresso'), FALSE, ''), |
|
| 112 | + 'EVT_created'=>new EE_Datetime_Field('post_date', __('Date/Time Event Created', 'event_espresso'), FALSE, current_time('timestamp')), |
|
| 113 | + 'EVT_short_desc'=>new EE_Simple_HTML_Field('post_excerpt', __('Event Short Description', 'event_espresso'), FALSE, ''), |
|
| 114 | + 'EVT_modified'=>new EE_Datetime_Field('post_modified', __('Date/Time Event Modified', 'event_espresso'), FALSE, current_time('timestamp')), |
|
| 115 | + 'EVT_wp_user'=>new EE_WP_User_Field('post_author', __('Event Creator ID', 'event_espresso'), FALSE), |
|
| 116 | + 'parent'=>new EE_Integer_Field('post_parent', __('Event Parent ID', 'event_espresso'), FALSE, 0), |
|
| 117 | + 'EVT_order'=>new EE_Integer_Field('menu_order', __('Event Menu Order', 'event_espresso'), FALSE, 1), |
|
| 118 | + 'post_type'=>new EE_WP_Post_Type_Field('espresso_events'), // EE_Plain_Text_Field( 'post_type', __( 'Event Post Type', 'event_espresso' ), FALSE, 'espresso_events' ), |
|
| 119 | + 'status' => new EE_WP_Post_Status_Field('post_status', __('Event Status', 'event_espresso'), FALSE, 'draft', $this->_custom_stati) |
|
| 120 | 120 | ), |
| 121 | 121 | 'Event_Meta'=>array( |
| 122 | - 'EVTM_ID'=> new EE_DB_Only_Float_Field( 'EVTM_ID', __( 'Event Meta Row ID','event_espresso' ), FALSE ), |
|
| 123 | - 'EVT_ID_fk'=>new EE_DB_Only_Int_Field( 'EVT_ID', __( 'Foreign key to Event ID from Event Meta table', 'event_espresso' ), FALSE ), |
|
| 124 | - 'EVT_display_desc'=>new EE_Boolean_Field( 'EVT_display_desc', __( 'Display Description Flag', 'event_espresso' ), FALSE, 1 ), |
|
| 125 | - 'EVT_display_ticket_selector'=>new EE_Boolean_Field( 'EVT_display_ticket_selector', __( 'Display Ticket Selector Flag', 'event_espresso' ), FALSE, 1 ), |
|
| 126 | - 'EVT_visible_on'=>new EE_Datetime_Field( 'EVT_visible_on', __( 'Event Visible Date', 'event_espresso' ), TRUE, current_time( 'timestamp' )), |
|
| 127 | - 'EVT_additional_limit'=>new EE_Integer_Field( 'EVT_additional_limit', __( 'Limit of Additional Registrations on Same Transaction', 'event_espresso' ), TRUE, 10 ), |
|
| 122 | + 'EVTM_ID'=> new EE_DB_Only_Float_Field('EVTM_ID', __('Event Meta Row ID', 'event_espresso'), FALSE), |
|
| 123 | + 'EVT_ID_fk'=>new EE_DB_Only_Int_Field('EVT_ID', __('Foreign key to Event ID from Event Meta table', 'event_espresso'), FALSE), |
|
| 124 | + 'EVT_display_desc'=>new EE_Boolean_Field('EVT_display_desc', __('Display Description Flag', 'event_espresso'), FALSE, 1), |
|
| 125 | + 'EVT_display_ticket_selector'=>new EE_Boolean_Field('EVT_display_ticket_selector', __('Display Ticket Selector Flag', 'event_espresso'), FALSE, 1), |
|
| 126 | + 'EVT_visible_on'=>new EE_Datetime_Field('EVT_visible_on', __('Event Visible Date', 'event_espresso'), TRUE, current_time('timestamp')), |
|
| 127 | + 'EVT_additional_limit'=>new EE_Integer_Field('EVT_additional_limit', __('Limit of Additional Registrations on Same Transaction', 'event_espresso'), TRUE, 10), |
|
| 128 | 128 | 'EVT_default_registration_status'=>new EE_Enum_Text_Field( |
| 129 | - 'EVT_default_registration_status', __( 'Default Registration Status on this Event', 'event_espresso' ), FALSE, $default_registration_status, EEM_Registration::reg_status_array() |
|
| 129 | + 'EVT_default_registration_status', __('Default Registration Status on this Event', 'event_espresso'), FALSE, $default_registration_status, EEM_Registration::reg_status_array() |
|
| 130 | 130 | ), |
| 131 | - 'EVT_member_only'=>new EE_Boolean_Field( 'EVT_member_only', __( 'Member-Only Event Flag', 'event_espresso' ), FALSE, FALSE ), |
|
| 132 | - 'EVT_phone'=> new EE_Plain_Text_Field('EVT_phone', __( 'Event Phone Number', 'event_espresso' ), FALSE ), |
|
| 133 | - 'EVT_allow_overflow'=>new EE_Boolean_Field( 'EVT_allow_overflow', __( 'Allow Overflow on Event', 'event_espresso' ), FALSE, FALSE ), |
|
| 134 | - 'EVT_timezone_string'=>new EE_Plain_Text_Field( 'EVT_timezone_string', __( 'Timezone (name) for Event times', 'event_espresso' ), FALSE ), |
|
| 135 | - 'EVT_external_URL'=>new EE_Plain_Text_Field( 'EVT_external_URL', __( 'URL of Event Page if hosted elsewhere', 'event_espresso' ), TRUE ), |
|
| 136 | - 'EVT_donations'=>new EE_Boolean_Field( 'EVT_donations', __( 'Accept Donations?', 'event_espresso' ), FALSE, FALSE ) |
|
| 131 | + 'EVT_member_only'=>new EE_Boolean_Field('EVT_member_only', __('Member-Only Event Flag', 'event_espresso'), FALSE, FALSE), |
|
| 132 | + 'EVT_phone'=> new EE_Plain_Text_Field('EVT_phone', __('Event Phone Number', 'event_espresso'), FALSE), |
|
| 133 | + 'EVT_allow_overflow'=>new EE_Boolean_Field('EVT_allow_overflow', __('Allow Overflow on Event', 'event_espresso'), FALSE, FALSE), |
|
| 134 | + 'EVT_timezone_string'=>new EE_Plain_Text_Field('EVT_timezone_string', __('Timezone (name) for Event times', 'event_espresso'), FALSE), |
|
| 135 | + 'EVT_external_URL'=>new EE_Plain_Text_Field('EVT_external_URL', __('URL of Event Page if hosted elsewhere', 'event_espresso'), TRUE), |
|
| 136 | + 'EVT_donations'=>new EE_Boolean_Field('EVT_donations', __('Accept Donations?', 'event_espresso'), FALSE, FALSE) |
|
| 137 | 137 | |
| 138 | 138 | )); |
| 139 | 139 | |
@@ -149,7 +149,7 @@ discard block |
||
| 149 | 149 | ); |
| 150 | 150 | |
| 151 | 151 | $this->_default_where_conditions_strategy = new EE_CPT_Where_Conditions('espresso_events', 'EVTM_ID'); |
| 152 | - parent::__construct( $timezone ); |
|
| 152 | + parent::__construct($timezone); |
|
| 153 | 153 | } |
| 154 | 154 | |
| 155 | 155 | |
@@ -164,9 +164,9 @@ discard block |
||
| 164 | 164 | * @return array |
| 165 | 165 | */ |
| 166 | 166 | public function get_all_question_groups() { |
| 167 | - return EE_Registry::instance()->load_model( 'Question_Group' )->get_all( array( |
|
| 168 | - array( 'QSG_deleted' => FALSE ), |
|
| 169 | - 'order_by' => array( 'QSG_order' => 'ASC' ) |
|
| 167 | + return EE_Registry::instance()->load_model('Question_Group')->get_all(array( |
|
| 168 | + array('QSG_deleted' => FALSE), |
|
| 169 | + 'order_by' => array('QSG_order' => 'ASC') |
|
| 170 | 170 | )); |
| 171 | 171 | } |
| 172 | 172 | |
@@ -182,13 +182,13 @@ discard block |
||
| 182 | 182 | * @param int $EVT_ID |
| 183 | 183 | * @return array |
| 184 | 184 | */ |
| 185 | - public function get_all_event_question_groups( $EVT_ID = 0 ) { |
|
| 186 | - if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) { |
|
| 187 | - EE_Error::add_error( __( 'An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 185 | + public function get_all_event_question_groups($EVT_ID = 0) { |
|
| 186 | + if ( ! isset($EVT_ID) || ! absint($EVT_ID)) { |
|
| 187 | + EE_Error::add_error(__('An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 188 | 188 | return FALSE; |
| 189 | 189 | } |
| 190 | - return EE_Registry::instance()->load_model( 'Event_Question_Group' )->get_all( array( |
|
| 191 | - array( 'EVT_ID' => $EVT_ID ) |
|
| 190 | + return EE_Registry::instance()->load_model('Event_Question_Group')->get_all(array( |
|
| 191 | + array('EVT_ID' => $EVT_ID) |
|
| 192 | 192 | )); |
| 193 | 193 | } |
| 194 | 194 | |
@@ -204,13 +204,13 @@ discard block |
||
| 204 | 204 | * @param boolean $for_primary_attendee |
| 205 | 205 | * @return array |
| 206 | 206 | */ |
| 207 | - public function get_event_question_groups( $EVT_ID = 0, $for_primary_attendee = TRUE ) { |
|
| 208 | - if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) { |
|
| 209 | - EE_Error::add_error( __( 'An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 207 | + public function get_event_question_groups($EVT_ID = 0, $for_primary_attendee = TRUE) { |
|
| 208 | + if ( ! isset($EVT_ID) || ! absint($EVT_ID)) { |
|
| 209 | + EE_Error::add_error(__('An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 210 | 210 | return FALSE; |
| 211 | 211 | } |
| 212 | - return EE_Registry::instance()->load_model( 'Event_Question_Group' )->get_all( array( |
|
| 213 | - array( 'EVT_ID' => $EVT_ID, 'EQG_primary' => $for_primary_attendee ) |
|
| 212 | + return EE_Registry::instance()->load_model('Event_Question_Group')->get_all(array( |
|
| 213 | + array('EVT_ID' => $EVT_ID, 'EQG_primary' => $for_primary_attendee) |
|
| 214 | 214 | )); |
| 215 | 215 | } |
| 216 | 216 | |
@@ -227,10 +227,10 @@ discard block |
||
| 227 | 227 | * @param EE_Registration $registration |
| 228 | 228 | * @return array |
| 229 | 229 | */ |
| 230 | - public function get_question_groups_for_event( $EVT_ID = 0, EE_Registration $registration ) { |
|
| 230 | + public function get_question_groups_for_event($EVT_ID = 0, EE_Registration $registration) { |
|
| 231 | 231 | |
| 232 | - if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) { |
|
| 233 | - EE_Error::add_error( __( 'An error occurred. No Question Groups could be retrieved because an Event ID was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 232 | + if ( ! isset($EVT_ID) || ! absint($EVT_ID)) { |
|
| 233 | + EE_Error::add_error(__('An error occurred. No Question Groups could be retrieved because an Event ID was not received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 234 | 234 | return FALSE; |
| 235 | 235 | } |
| 236 | 236 | |
@@ -240,7 +240,7 @@ discard block |
||
| 240 | 240 | 'QSG_deleted' => FALSE |
| 241 | 241 | ); |
| 242 | 242 | |
| 243 | - return EE_Registry::instance()->load_model( 'Question_Group' )->get_all( array( |
|
| 243 | + return EE_Registry::instance()->load_model('Question_Group')->get_all(array( |
|
| 244 | 244 | $where_params, |
| 245 | 245 | 'order_by' => array('QSG_order' => 'ASC') |
| 246 | 246 | )); |
@@ -260,16 +260,16 @@ discard block |
||
| 260 | 260 | * @param string $QSG_IDs csv list of $QSG IDs |
| 261 | 261 | * @return array |
| 262 | 262 | */ |
| 263 | - public function get_questions_in_groups( $QSG_IDs = '' ) { |
|
| 263 | + public function get_questions_in_groups($QSG_IDs = '') { |
|
| 264 | 264 | |
| 265 | - if ( empty( $QSG_IDs )) { |
|
| 266 | - EE_Error::add_error( __( 'An error occurred. No Question Group IDs were received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 265 | + if (empty($QSG_IDs)) { |
|
| 266 | + EE_Error::add_error(__('An error occurred. No Question Group IDs were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 267 | 267 | return FALSE; |
| 268 | 268 | } |
| 269 | 269 | |
| 270 | - return EE_Registry::instance()->load_model( 'Question' )->get_all( array( |
|
| 270 | + return EE_Registry::instance()->load_model('Question')->get_all(array( |
|
| 271 | 271 | array( |
| 272 | - 'Question_Group.QSG_ID' => array( 'IN', $QSG_IDs ), |
|
| 272 | + 'Question_Group.QSG_ID' => array('IN', $QSG_IDs), |
|
| 273 | 273 | 'QST_deleted' => FALSE, |
| 274 | 274 | 'QST_admin_only' => is_admin() |
| 275 | 275 | ), |
@@ -291,16 +291,16 @@ discard block |
||
| 291 | 291 | * @param string $QST_IDs csv list of $QST IDs |
| 292 | 292 | * @return array |
| 293 | 293 | */ |
| 294 | - public function get_options_for_question( $QST_IDs ) { |
|
| 294 | + public function get_options_for_question($QST_IDs) { |
|
| 295 | 295 | |
| 296 | - if ( empty( $QST_IDs )) { |
|
| 297 | - EE_Error::add_error( __( 'An error occurred. No Question IDs were received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
|
| 296 | + if (empty($QST_IDs)) { |
|
| 297 | + EE_Error::add_error(__('An error occurred. No Question IDs were received.', 'event_espresso'), __FILE__, __FUNCTION__, __LINE__); |
|
| 298 | 298 | return FALSE; |
| 299 | 299 | } |
| 300 | 300 | |
| 301 | - return EE_Registry::instance()->load_model( 'Question_Option' )->get_all( array( |
|
| 301 | + return EE_Registry::instance()->load_model('Question_Option')->get_all(array( |
|
| 302 | 302 | array( |
| 303 | - 'Question.QST_ID' => array( 'IN', $QST_IDs ), |
|
| 303 | + 'Question.QST_ID' => array('IN', $QST_IDs), |
|
| 304 | 304 | 'QSO_deleted' => FALSE |
| 305 | 305 | ), |
| 306 | 306 | 'order_by' => 'QSO_ID' |
@@ -319,45 +319,45 @@ discard block |
||
| 319 | 319 | * @throws EE_Error |
| 320 | 320 | * @return array |
| 321 | 321 | */ |
| 322 | - public function assemble_array_of_groups_questions_and_options( EE_Registration $registration, $EVT_ID = 0 ) { |
|
| 322 | + public function assemble_array_of_groups_questions_and_options(EE_Registration $registration, $EVT_ID = 0) { |
|
| 323 | 323 | |
| 324 | - if ( empty( $EVT_ID ) ) { |
|
| 325 | - throw new EE_Error( __( 'An error occurred. No EVT_ID is included. Needed to know which question groups to retrieve.', 'event_espresso' ) ); |
|
| 324 | + if (empty($EVT_ID)) { |
|
| 325 | + throw new EE_Error(__('An error occurred. No EVT_ID is included. Needed to know which question groups to retrieve.', 'event_espresso')); |
|
| 326 | 326 | } |
| 327 | 327 | |
| 328 | 328 | $questions = array(); |
| 329 | 329 | |
| 330 | 330 | // get all question groups for event |
| 331 | - $qgs = $this->get_question_groups_for_event( $EVT_ID, $registration ); |
|
| 332 | - if ( !empty( $qgs ) ) { |
|
| 333 | - foreach ( $qgs as $qg ) { |
|
| 331 | + $qgs = $this->get_question_groups_for_event($EVT_ID, $registration); |
|
| 332 | + if ( ! empty($qgs)) { |
|
| 333 | + foreach ($qgs as $qg) { |
|
| 334 | 334 | $qsts = $qg->questions(); |
| 335 | - $questions[ $qg->ID() ] = $qg->model_field_array(); |
|
| 336 | - $questions[ $qg->ID() ]['QSG_questions'] = array(); |
|
| 337 | - foreach ( $qsts as $qst ) { |
|
| 338 | - if ( $qst->is_system_question() ) |
|
| 335 | + $questions[$qg->ID()] = $qg->model_field_array(); |
|
| 336 | + $questions[$qg->ID()]['QSG_questions'] = array(); |
|
| 337 | + foreach ($qsts as $qst) { |
|
| 338 | + if ($qst->is_system_question()) |
|
| 339 | 339 | continue; |
| 340 | - $answer = EEM_Answer::instance()->get_one( array( array( 'QST_ID' => $qst->ID(), 'REG_ID' => $registration->ID() ) ) ); |
|
| 340 | + $answer = EEM_Answer::instance()->get_one(array(array('QST_ID' => $qst->ID(), 'REG_ID' => $registration->ID()))); |
|
| 341 | 341 | $answer = $answer instanceof EE_Answer ? $answer : EEM_Answer::instance()->create_default_object(); |
| 342 | 342 | $qst_name = $qstn_id = $qst->ID(); |
| 343 | 343 | $ans_id = $answer->ID(); |
| 344 | - $qst_name = !empty( $ans_id ) ? '[' . $qst_name . '][' . $ans_id . ']' : '[' . $qst_name . ']'; |
|
| 344 | + $qst_name = ! empty($ans_id) ? '['.$qst_name.']['.$ans_id.']' : '['.$qst_name.']'; |
|
| 345 | 345 | $input_name = ''; |
| 346 | - $input_id = sanitize_key( $qst->display_text() ); |
|
| 346 | + $input_id = sanitize_key($qst->display_text()); |
|
| 347 | 347 | $input_class = ''; |
| 348 | 348 | $questions[$qg->ID()]['QSG_questions'][$qst->ID()] = $qst->model_field_array(); |
| 349 | - $questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['QST_input_name'] = 'qstn' . $input_name . $qst_name; |
|
| 350 | - $questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['QST_input_id'] = $input_id . '-' . $qstn_id; |
|
| 351 | - $questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['QST_input_class'] = $input_class; |
|
| 352 | - $questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['QST_options'] = array(); |
|
| 353 | - $questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['qst_obj'] = $qst; |
|
| 354 | - $questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['ans_obj'] = $answer; |
|
| 355 | - |
|
| 356 | - if ( $qst->type() == 'RADIO_BTN' || $qst->type() == 'CHECKBOX' || $qst->type() == 'DROPDOWN' ) { |
|
| 357 | - $QSOs = $qst->options(TRUE,$answer->value()); |
|
| 358 | - if ( is_array( $QSOs ) ) { |
|
| 359 | - foreach ( $QSOs as $QSO_ID => $QSO ) { |
|
| 360 | - $questions[ $qg->ID() ]['QSG_questions'][ $qst->ID() ]['QST_options'][ $QSO_ID ] = $QSO->model_field_array(); |
|
| 349 | + $questions[$qg->ID()]['QSG_questions'][$qst->ID()]['QST_input_name'] = 'qstn'.$input_name.$qst_name; |
|
| 350 | + $questions[$qg->ID()]['QSG_questions'][$qst->ID()]['QST_input_id'] = $input_id.'-'.$qstn_id; |
|
| 351 | + $questions[$qg->ID()]['QSG_questions'][$qst->ID()]['QST_input_class'] = $input_class; |
|
| 352 | + $questions[$qg->ID()]['QSG_questions'][$qst->ID()]['QST_options'] = array(); |
|
| 353 | + $questions[$qg->ID()]['QSG_questions'][$qst->ID()]['qst_obj'] = $qst; |
|
| 354 | + $questions[$qg->ID()]['QSG_questions'][$qst->ID()]['ans_obj'] = $answer; |
|
| 355 | + |
|
| 356 | + if ($qst->type() == 'RADIO_BTN' || $qst->type() == 'CHECKBOX' || $qst->type() == 'DROPDOWN') { |
|
| 357 | + $QSOs = $qst->options(TRUE, $answer->value()); |
|
| 358 | + if (is_array($QSOs)) { |
|
| 359 | + foreach ($QSOs as $QSO_ID => $QSO) { |
|
| 360 | + $questions[$qg->ID()]['QSG_questions'][$qst->ID()]['QST_options'][$QSO_ID] = $QSO->model_field_array(); |
|
| 361 | 361 | } |
| 362 | 362 | } |
| 363 | 363 | } |
@@ -381,9 +381,9 @@ discard block |
||
| 381 | 381 | * @param $QST |
| 382 | 382 | * @return string string |
| 383 | 383 | */ |
| 384 | - private function _generate_question_input_name( $QST ) { |
|
| 384 | + private function _generate_question_input_name($QST) { |
|
| 385 | 385 | |
| 386 | - if ( $QST->QST_system ) { |
|
| 386 | + if ($QST->QST_system) { |
|
| 387 | 387 | $qst_name = $QST->QST_system; |
| 388 | 388 | /* switch( $QST->QST_system ) { |
| 389 | 389 | |
@@ -450,20 +450,20 @@ discard block |
||
| 450 | 450 | * @param bool $count whether to return the count or not (default FALSE) |
| 451 | 451 | * @return array EE_Event objects |
| 452 | 452 | */ |
| 453 | - public function get_active_events( $query_params, $count = FALSE ) { |
|
| 454 | - if ( array_key_exists( 0, $query_params ) ) { |
|
| 453 | + public function get_active_events($query_params, $count = FALSE) { |
|
| 454 | + if (array_key_exists(0, $query_params)) { |
|
| 455 | 455 | $where_params = $query_params[0]; |
| 456 | - unset( $query_params[0] ); |
|
| 456 | + unset($query_params[0]); |
|
| 457 | 457 | } else { |
| 458 | 458 | $where_params = array(); |
| 459 | 459 | } |
| 460 | 460 | |
| 461 | 461 | //let's add specific query_params for active_events - keep in mind this will override any sent status in the query AND any date queries. |
| 462 | 462 | $where_params['status'] = 'publish'; |
| 463 | - $where_params['Datetime.DTT_EVT_start'] = array('>', date('Y-m-d g:i:s', time() ) ); |
|
| 464 | - $where_params['Datetime.DTT_EVT_end'] = array('<', date('Y-m-d g:i:s', time() ) ); |
|
| 463 | + $where_params['Datetime.DTT_EVT_start'] = array('>', date('Y-m-d g:i:s', time())); |
|
| 464 | + $where_params['Datetime.DTT_EVT_end'] = array('<', date('Y-m-d g:i:s', time())); |
|
| 465 | 465 | $query_params[0] = $where_params; |
| 466 | - $events = $count ? $this->count($query_params, 'EVT_ID') : $this->get_all( $query_params ); |
|
| 466 | + $events = $count ? $this->count($query_params, 'EVT_ID') : $this->get_all($query_params); |
|
| 467 | 467 | return $events; |
| 468 | 468 | } |
| 469 | 469 | |
@@ -479,19 +479,19 @@ discard block |
||
| 479 | 479 | * @param bool $count whether to return the count or not (default FALSE) |
| 480 | 480 | * @return array EE_Event objects |
| 481 | 481 | */ |
| 482 | - public function get_upcoming_events( $query_params, $count = FALSE ) { |
|
| 483 | - if ( array_key_exists( 0, $query_params ) ) { |
|
| 482 | + public function get_upcoming_events($query_params, $count = FALSE) { |
|
| 483 | + if (array_key_exists(0, $query_params)) { |
|
| 484 | 484 | $where_params = $query_params[0]; |
| 485 | - unset( $query_params[0] ); |
|
| 485 | + unset($query_params[0]); |
|
| 486 | 486 | } else { |
| 487 | 487 | $where_params = array(); |
| 488 | 488 | } |
| 489 | 489 | |
| 490 | 490 | //let's add specific query_params for active_events - keep in mind this will override any sent status in the query AND any date queries. |
| 491 | 491 | $where_params['status'] = 'publish'; |
| 492 | - $where_params['Datetime.DTT_EVT_start'] = array('>', date('Y-m-d g:i:s', time() ) ); |
|
| 492 | + $where_params['Datetime.DTT_EVT_start'] = array('>', date('Y-m-d g:i:s', time())); |
|
| 493 | 493 | $query_params[0] = $where_params; |
| 494 | - return $count ? $this->count($query_params, 'EVT_ID') : $this->get_all( $query_params ); |
|
| 494 | + return $count ? $this->count($query_params, 'EVT_ID') : $this->get_all($query_params); |
|
| 495 | 495 | } |
| 496 | 496 | |
| 497 | 497 | |
@@ -503,20 +503,20 @@ discard block |
||
| 503 | 503 | * @param bool $count whether to return the count or not (default FALSE) |
| 504 | 504 | * @return array EE_Event objects |
| 505 | 505 | */ |
| 506 | - public function get_expired_events( $query_params, $count = FALSE ) { |
|
| 507 | - if ( array_key_exists( 0, $query_params ) ) { |
|
| 506 | + public function get_expired_events($query_params, $count = FALSE) { |
|
| 507 | + if (array_key_exists(0, $query_params)) { |
|
| 508 | 508 | $where_params = $query_params[0]; |
| 509 | - unset( $query_params[0] ); |
|
| 509 | + unset($query_params[0]); |
|
| 510 | 510 | } else { |
| 511 | 511 | $where_params = array(); |
| 512 | 512 | } |
| 513 | 513 | |
| 514 | 514 | //let's add specific query_params for active_events - keep in mind this will override any sent status in the query AND any date queries. |
| 515 | - if ( isset( $where_params['status'] ) ) |
|
| 516 | - unset( $where_params['status'] ); |
|
| 517 | - $where_params['OR'] = array( 'status' => array( '!=', 'publish' ), 'AND' => array('status' => 'publish', 'Datetime.DTT_EVT_end' => array( '<', date('Y-m-d g:i:s', time() ) ) ) ); |
|
| 515 | + if (isset($where_params['status'])) |
|
| 516 | + unset($where_params['status']); |
|
| 517 | + $where_params['OR'] = array('status' => array('!=', 'publish'), 'AND' => array('status' => 'publish', 'Datetime.DTT_EVT_end' => array('<', date('Y-m-d g:i:s', time())))); |
|
| 518 | 518 | $query_params[0] = $where_params; |
| 519 | - return $count ? $this->count($query_params, 'EVT_ID') : $this->get_all( $query_params ); |
|
| 519 | + return $count ? $this->count($query_params, 'EVT_ID') : $this->get_all($query_params); |
|
| 520 | 520 | } |
| 521 | 521 | |
| 522 | 522 | |
@@ -527,23 +527,23 @@ discard block |
||
| 527 | 527 | * @param boolean $count whether to return the count or not (default FALSE) |
| 528 | 528 | * @return EE_Event[] array of EE_Event objects |
| 529 | 529 | */ |
| 530 | - public function get_inactive_events( $query_params, $count = FALSE ) { |
|
| 531 | - if ( array_key_exists( 0, $query_params ) ) { |
|
| 530 | + public function get_inactive_events($query_params, $count = FALSE) { |
|
| 531 | + if (array_key_exists(0, $query_params)) { |
|
| 532 | 532 | $where_params = $query_params[0]; |
| 533 | - unset( $query_params[0] ); |
|
| 533 | + unset($query_params[0]); |
|
| 534 | 534 | } else { |
| 535 | 535 | $where_params = array(); |
| 536 | 536 | } |
| 537 | 537 | |
| 538 | 538 | //let's add in specific query_params for inactive events. |
| 539 | - if ( isset( $where_params['status'] ) ) |
|
| 540 | - unset( $where_params['status'] ); |
|
| 539 | + if (isset($where_params['status'])) |
|
| 540 | + unset($where_params['status']); |
|
| 541 | 541 | |
| 542 | 542 | //we check for events that are not published OR are expired. |
| 543 | 543 | |
| 544 | - $where_params['OR'] = array( 'status' => array( '!=', 'publish' ), 'Datetime.DTT_EVT_end' => array( '<', date('Y-m-d g:i:s', time() ) ) ); |
|
| 544 | + $where_params['OR'] = array('status' => array('!=', 'publish'), 'Datetime.DTT_EVT_end' => array('<', date('Y-m-d g:i:s', time()))); |
|
| 545 | 545 | $query_params[0] = $where_params; |
| 546 | - return $count ? $this->count( $query_params, 'EVT_ID' ) : $this->get_all( $query_params ); |
|
| 546 | + return $count ? $this->count($query_params, 'EVT_ID') : $this->get_all($query_params); |
|
| 547 | 547 | } |
| 548 | 548 | |
| 549 | 549 | |
@@ -551,13 +551,13 @@ discard block |
||
| 551 | 551 | * This is just injecting into the parent add_relationship_to so we do special handling on price relationships because we don't want to override any existing global default prices but instead insert NEW prices that get attached to the event. |
| 552 | 552 | * See parent for param descriptions |
| 553 | 553 | */ |
| 554 | - public function add_relationship_to($id_or_obj,$other_model_id_or_obj, $relationName, $where_query = array()){ |
|
| 554 | + public function add_relationship_to($id_or_obj, $other_model_id_or_obj, $relationName, $where_query = array()) { |
|
| 555 | 555 | |
| 556 | - if ( $relationName == 'Price' ) { |
|
| 556 | + if ($relationName == 'Price') { |
|
| 557 | 557 | //let's get the PRC object for the given ID to make sure that we aren't dealing with a default |
| 558 | 558 | $prc_chk = $this->get_related_model_obj($relationName)->ensure_is_obj($other_model_id_or_obj); |
| 559 | 559 | //if EVT_ID = 0, then this is a default |
| 560 | - if ( $prc_chk->get('EVT_ID') == 0 ) { |
|
| 560 | + if ($prc_chk->get('EVT_ID') == 0) { |
|
| 561 | 561 | //let's set the prc_id as 0 so we force an insert on the add_relation_to carried out by relation |
| 562 | 562 | $prc_chk->set('PRC_ID', 0); |
| 563 | 563 | } |
@@ -567,7 +567,7 @@ discard block |
||
| 567 | 567 | } |
| 568 | 568 | |
| 569 | 569 | //otherwise carry on as normal |
| 570 | - return parent::add_relationship_to($id_or_obj,$other_model_id_or_obj, $relationName, $where_query); |
|
| 570 | + return parent::add_relationship_to($id_or_obj, $other_model_id_or_obj, $relationName, $where_query); |
|
| 571 | 571 | } |
| 572 | 572 | |
| 573 | 573 | |
@@ -179,11 +179,11 @@ discard block |
||
| 179 | 179 | |
| 180 | 180 | |
| 181 | 181 | /** |
| 182 | - * get_question_groups |
|
| 183 | - * |
|
| 184 | - * @access public |
|
| 185 | - * @return array |
|
| 186 | - */ |
|
| 182 | + * get_question_groups |
|
| 183 | + * |
|
| 184 | + * @access public |
|
| 185 | + * @return array |
|
| 186 | + */ |
|
| 187 | 187 | public function get_all_question_groups() { |
| 188 | 188 | return EE_Registry::instance()->load_model( 'Question_Group' )->get_all( array( |
| 189 | 189 | array( 'QSG_deleted' => FALSE ), |
@@ -197,12 +197,12 @@ discard block |
||
| 197 | 197 | |
| 198 | 198 | |
| 199 | 199 | /** |
| 200 | - * get_question_groups |
|
| 201 | - * |
|
| 202 | - * @access public |
|
| 203 | - * @param int $EVT_ID |
|
| 204 | - * @return array |
|
| 205 | - */ |
|
| 200 | + * get_question_groups |
|
| 201 | + * |
|
| 202 | + * @access public |
|
| 203 | + * @param int $EVT_ID |
|
| 204 | + * @return array |
|
| 205 | + */ |
|
| 206 | 206 | public function get_all_event_question_groups( $EVT_ID = 0 ) { |
| 207 | 207 | if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) { |
| 208 | 208 | EE_Error::add_error( __( 'An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
@@ -218,13 +218,13 @@ discard block |
||
| 218 | 218 | |
| 219 | 219 | |
| 220 | 220 | /** |
| 221 | - * get_question_groups |
|
| 222 | - * |
|
| 223 | - * @access public |
|
| 224 | - * @param int $EVT_ID |
|
| 225 | - * @param boolean $for_primary_attendee |
|
| 226 | - * @return array |
|
| 227 | - */ |
|
| 221 | + * get_question_groups |
|
| 222 | + * |
|
| 223 | + * @access public |
|
| 224 | + * @param int $EVT_ID |
|
| 225 | + * @param boolean $for_primary_attendee |
|
| 226 | + * @return array |
|
| 227 | + */ |
|
| 228 | 228 | public function get_event_question_groups( $EVT_ID = 0, $for_primary_attendee = TRUE ) { |
| 229 | 229 | if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) { |
| 230 | 230 | EE_Error::add_error( __( 'An error occurred. No Event Question Groups could be retrieved because an Event ID was not received.', 'event_espresso' ), __FILE__, __FUNCTION__, __LINE__ ); |
@@ -241,13 +241,13 @@ discard block |
||
| 241 | 241 | |
| 242 | 242 | |
| 243 | 243 | /** |
| 244 | - * get_question_groups |
|
| 245 | - * |
|
| 246 | - * @access public |
|
| 247 | - * @param int $EVT_ID |
|
| 248 | - * @param EE_Registration $registration |
|
| 249 | - * @return array |
|
| 250 | - */ |
|
| 244 | + * get_question_groups |
|
| 245 | + * |
|
| 246 | + * @access public |
|
| 247 | + * @param int $EVT_ID |
|
| 248 | + * @param EE_Registration $registration |
|
| 249 | + * @return array |
|
| 250 | + */ |
|
| 251 | 251 | public function get_question_groups_for_event( $EVT_ID = 0, EE_Registration $registration ) { |
| 252 | 252 | |
| 253 | 253 | if ( ! isset( $EVT_ID) || ! absint( $EVT_ID )) { |
@@ -275,12 +275,12 @@ discard block |
||
| 275 | 275 | |
| 276 | 276 | |
| 277 | 277 | /** |
| 278 | - * get_question_target_db_column |
|
| 279 | - * |
|
| 280 | - * @access public |
|
| 281 | - * @param string $QSG_IDs csv list of $QSG IDs |
|
| 282 | - * @return array |
|
| 283 | - */ |
|
| 278 | + * get_question_target_db_column |
|
| 279 | + * |
|
| 280 | + * @access public |
|
| 281 | + * @param string $QSG_IDs csv list of $QSG IDs |
|
| 282 | + * @return array |
|
| 283 | + */ |
|
| 284 | 284 | public function get_questions_in_groups( $QSG_IDs = '' ) { |
| 285 | 285 | |
| 286 | 286 | if ( empty( $QSG_IDs )) { |
@@ -306,12 +306,12 @@ discard block |
||
| 306 | 306 | |
| 307 | 307 | |
| 308 | 308 | /** |
| 309 | - * get_options_for_question |
|
| 310 | - * |
|
| 311 | - * @access public |
|
| 312 | - * @param string $QST_IDs csv list of $QST IDs |
|
| 313 | - * @return array |
|
| 314 | - */ |
|
| 309 | + * get_options_for_question |
|
| 310 | + * |
|
| 311 | + * @access public |
|
| 312 | + * @param string $QST_IDs csv list of $QST IDs |
|
| 313 | + * @return array |
|
| 314 | + */ |
|
| 315 | 315 | public function get_options_for_question( $QST_IDs ) { |
| 316 | 316 | |
| 317 | 317 | if ( empty( $QST_IDs )) { |
@@ -396,12 +396,12 @@ discard block |
||
| 396 | 396 | |
| 397 | 397 | |
| 398 | 398 | /** |
| 399 | - * _get_question_target_db_column |
|
| 400 | - * |
|
| 401 | - * @access private |
|
| 402 | - * @param $QST |
|
| 403 | - * @return string string |
|
| 404 | - */ |
|
| 399 | + * _get_question_target_db_column |
|
| 400 | + * |
|
| 401 | + * @access private |
|
| 402 | + * @param $QST |
|
| 403 | + * @return string string |
|
| 404 | + */ |
|
| 405 | 405 | private function _generate_question_input_name( $QST ) { |
| 406 | 406 | |
| 407 | 407 | if ( $QST->QST_system ) { |