@@ -2,15 +2,15 @@ discard block |
||
2 | 2 | /** |
3 | 3 | * Required by EEM_Question_Group_Question in case someone queries for all its model objects |
4 | 4 | */ |
5 | -class EE_Question_Group_Question extends EE_Base_Class{ |
|
5 | +class EE_Question_Group_Question extends EE_Base_Class { |
|
6 | 6 | |
7 | 7 | /** |
8 | 8 | * @param array $props_n_values |
9 | 9 | * @return EE_Question_Group_Question|mixed |
10 | 10 | */ |
11 | - public static function new_instance( $props_n_values = array() ) { |
|
12 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
13 | - return $has_object ? $has_object : new self( $props_n_values ); |
|
11 | + public static function new_instance($props_n_values = array()) { |
|
12 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
13 | + return $has_object ? $has_object : new self($props_n_values); |
|
14 | 14 | } |
15 | 15 | |
16 | 16 | |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * @param array $props_n_values |
20 | 20 | * @return EE_Question_Group_Question |
21 | 21 | */ |
22 | - public static function new_instance_from_db ( $props_n_values = array() ) { |
|
23 | - return new self( $props_n_values, TRUE ); |
|
22 | + public static function new_instance_from_db($props_n_values = array()) { |
|
23 | + return new self($props_n_values, TRUE); |
|
24 | 24 | } |
25 | 25 | } |
26 | 26 | \ No newline at end of file |
@@ -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,7 +33,7 @@ discard block |
||
33 | 33 | * @return boolean success |
34 | 34 | */ |
35 | 35 | public function delete() { |
36 | - return $this->delete_or_restore( TRUE ); |
|
36 | + return $this->delete_or_restore(TRUE); |
|
37 | 37 | } |
38 | 38 | |
39 | 39 | |
@@ -43,7 +43,7 @@ discard block |
||
43 | 43 | * @return boolean success |
44 | 44 | */ |
45 | 45 | public function delete_permanently() { |
46 | - return $this->get_model()->delete_permanently_by_ID( $this->ID() ); |
|
46 | + return $this->get_model()->delete_permanently_by_ID($this->ID()); |
|
47 | 47 | } |
48 | 48 | |
49 | 49 | |
@@ -53,9 +53,9 @@ discard block |
||
53 | 53 | * @param bool $delete true=>delete, false=>restore |
54 | 54 | * @return bool |
55 | 55 | */ |
56 | - public function delete_or_restore( $delete = TRUE ) { |
|
56 | + public function delete_or_restore($delete = TRUE) { |
|
57 | 57 | $model = $this->get_model(); |
58 | - return $model->delete_or_restore_by_ID( $delete, $this->ID() ); |
|
58 | + return $model->delete_or_restore_by_ID($delete, $this->ID()); |
|
59 | 59 | } |
60 | 60 | |
61 | 61 | |
@@ -65,6 +65,6 @@ discard block |
||
65 | 65 | * @return boolean |
66 | 66 | */ |
67 | 67 | public function restore() { |
68 | - return $this->delete_or_restore( FALSE ); |
|
68 | + return $this->delete_or_restore(FALSE); |
|
69 | 69 | } |
70 | 70 | } |
71 | 71 | \ No newline at end of file |
@@ -2,18 +2,18 @@ |
||
2 | 2 | exit( 'No direct script access allowed' ); |
3 | 3 | } |
4 | 4 | /** |
5 | - * Event Espresso |
|
6 | - * |
|
7 | - * Event Registration and Management Plugin for WordPress |
|
8 | - * |
|
9 | - * @ package Event Espresso |
|
10 | - * @ author Event Espresso |
|
11 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
12 | - * @ license {@link http://eventespresso.com/support/terms-conditions/} * see Plugin Licensing * |
|
13 | - * @ link {@link http://www.eventespresso.com} |
|
14 | - * @ since 4.0 |
|
15 | - * |
|
16 | - */ |
|
5 | + * Event Espresso |
|
6 | + * |
|
7 | + * Event Registration and Management Plugin for WordPress |
|
8 | + * |
|
9 | + * @ package Event Espresso |
|
10 | + * @ author Event Espresso |
|
11 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
12 | + * @ license {@link http://eventespresso.com/support/terms-conditions/} * see Plugin Licensing * |
|
13 | + * @ link {@link http://www.eventespresso.com} |
|
14 | + * @ since 4.0 |
|
15 | + * |
|
16 | + */ |
|
17 | 17 | |
18 | 18 | |
19 | 19 |
@@ -2,12 +2,12 @@ |
||
2 | 2 | exit( 'No direct script access allowed' ); |
3 | 3 | } |
4 | 4 | /** |
5 | - * Taxes class |
|
6 | - * |
|
7 | - * @package Event Espresso |
|
8 | - * @subpackage includes/classes/EE_Taxes.class.php |
|
9 | - * @author Brent Christensen |
|
10 | - */ |
|
5 | + * Taxes class |
|
6 | + * |
|
7 | + * @package Event Espresso |
|
8 | + * @subpackage includes/classes/EE_Taxes.class.php |
|
9 | + * @author Brent Christensen |
|
10 | + */ |
|
11 | 11 | class EE_Taxes extends EE_BASE { |
12 | 12 | |
13 | 13 | /** |
@@ -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 | * Taxes class |
@@ -32,20 +32,20 @@ discard block |
||
32 | 32 | * @param EE_Ticket $ticket incoming EE_Ticket |
33 | 33 | * @return float total taxes to apply to ticket. |
34 | 34 | */ |
35 | - public static function get_total_taxes_for_admin( EE_Ticket $ticket ) { |
|
35 | + public static function get_total_taxes_for_admin(EE_Ticket $ticket) { |
|
36 | 36 | $tax = 0; |
37 | 37 | $total_tax = 0; |
38 | 38 | //This first checks to see if the given ticket is taxable. |
39 | - if ( ! $ticket->get( 'TKT_taxable' ) ) |
|
39 | + if ( ! $ticket->get('TKT_taxable')) |
|
40 | 40 | return $tax; |
41 | 41 | //get subtotal (notice we're only retrieving a subtotal if there isn't one given) |
42 | - $subtotal = self::get_subtotal_for_admin( $ticket ); |
|
42 | + $subtotal = self::get_subtotal_for_admin($ticket); |
|
43 | 43 | //get taxes |
44 | 44 | $taxes = self::get_taxes_for_admin(); |
45 | 45 | //apply taxes to subtotal |
46 | - foreach ( $taxes as $tax ) { |
|
46 | + foreach ($taxes as $tax) { |
|
47 | 47 | //assuming taxes are not cumulative |
48 | - $total_tax += $subtotal * $tax->get( 'PRC_amount' ) / 100; |
|
48 | + $total_tax += $subtotal * $tax->get('PRC_amount') / 100; |
|
49 | 49 | } |
50 | 50 | return $total_tax; |
51 | 51 | } |
@@ -57,8 +57,8 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public static function get_total_taxes_percentage() { |
59 | 59 | $total_tax_percent = 0; |
60 | - foreach( self::get_taxes_for_admin() as $tax_price ) { |
|
61 | - $total_tax_percent += $tax_price->get( 'PRC_amount' ); |
|
60 | + foreach (self::get_taxes_for_admin() as $tax_price) { |
|
61 | + $total_tax_percent += $tax_price->get('PRC_amount'); |
|
62 | 62 | } |
63 | 63 | return $total_tax_percent; |
64 | 64 | } |
@@ -69,9 +69,9 @@ discard block |
||
69 | 69 | * @param EE_Ticket $ticket |
70 | 70 | * @return float |
71 | 71 | */ |
72 | - public static function get_subtotal_for_admin( EE_Ticket $ticket ) { |
|
72 | + public static function get_subtotal_for_admin(EE_Ticket $ticket) { |
|
73 | 73 | $TKT_ID = $ticket->ID(); |
74 | - return isset( self::$_subtotal[ $TKT_ID ] ) ? self::$_subtotal[ $TKT_ID ] : self::_get_subtotal_for_admin( $ticket ); |
|
74 | + return isset(self::$_subtotal[$TKT_ID]) ? self::$_subtotal[$TKT_ID] : self::_get_subtotal_for_admin($ticket); |
|
75 | 75 | } |
76 | 76 | |
77 | 77 | |
@@ -81,26 +81,26 @@ discard block |
||
81 | 81 | * @param EE_Ticket $ticket |
82 | 82 | * @return float subtotal calculated from all EE_Price[] on Ticket. |
83 | 83 | */ |
84 | - private static function _get_subtotal_for_admin( EE_Ticket $ticket ) { |
|
84 | + private static function _get_subtotal_for_admin(EE_Ticket $ticket) { |
|
85 | 85 | $subtotal = 0; |
86 | 86 | //get all prices |
87 | - $prices = $ticket->get_many_related( 'Price', array( 'default_where_conditions' => 'none', 'order_by' => array( 'PRC_order' => 'ASC' ) ) ); |
|
87 | + $prices = $ticket->get_many_related('Price', array('default_where_conditions' => 'none', 'order_by' => array('PRC_order' => 'ASC'))); |
|
88 | 88 | //let's loop through them (base price is always the first item) |
89 | - foreach ( $prices as $price ) { |
|
90 | - if ( $price instanceof EE_Price ) { |
|
91 | - switch ( $price->type_obj()->base_type() ) { |
|
89 | + foreach ($prices as $price) { |
|
90 | + if ($price instanceof EE_Price) { |
|
91 | + switch ($price->type_obj()->base_type()) { |
|
92 | 92 | case 1: // base price |
93 | 93 | case 3: // surcharges |
94 | - $subtotal += $price->is_percent() ? $subtotal * $price->get( 'PRC_amount' ) / 100 : $price->get( 'PRC_amount' ); |
|
94 | + $subtotal += $price->is_percent() ? $subtotal * $price->get('PRC_amount') / 100 : $price->get('PRC_amount'); |
|
95 | 95 | break; |
96 | 96 | case 2: // discounts |
97 | - $subtotal -= $price->is_percent() ? $subtotal * $price->get( 'PRC_amount' ) / 100 : $price->get( 'PRC_amount' ); |
|
97 | + $subtotal -= $price->is_percent() ? $subtotal * $price->get('PRC_amount') / 100 : $price->get('PRC_amount'); |
|
98 | 98 | break; |
99 | 99 | } |
100 | 100 | } |
101 | 101 | } |
102 | 102 | $TKT_ID = $ticket->ID(); |
103 | - self::$_subtotal = array( $TKT_ID => $subtotal ); |
|
103 | + self::$_subtotal = array($TKT_ID => $subtotal); |
|
104 | 104 | return $subtotal; |
105 | 105 | } |
106 | 106 | |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | * @return EE_Price[] EE_Price objects that have PRT_ID == 4 |
112 | 112 | */ |
113 | 113 | public static function get_taxes_for_admin() { |
114 | - self::$_default_taxes = ! empty( self::$_default_taxes ) ? self::$_default_taxes : EE_Registry::instance()->load_model( 'Price' )->get_all( array( array( 'Price_Type.PBT_ID' => 4 ) ) ); |
|
114 | + self::$_default_taxes = ! empty(self::$_default_taxes) ? self::$_default_taxes : EE_Registry::instance()->load_model('Price')->get_all(array(array('Price_Type.PBT_ID' => 4))); |
|
115 | 115 | return self::$_default_taxes; |
116 | 116 | } |
117 | 117 |
@@ -36,8 +36,9 @@ |
||
36 | 36 | $tax = 0; |
37 | 37 | $total_tax = 0; |
38 | 38 | //This first checks to see if the given ticket is taxable. |
39 | - if ( ! $ticket->get( 'TKT_taxable' ) ) |
|
40 | - return $tax; |
|
39 | + if ( ! $ticket->get( 'TKT_taxable' ) ) { |
|
40 | + return $tax; |
|
41 | + } |
|
41 | 42 | //get subtotal (notice we're only retrieving a subtotal if there isn't one given) |
42 | 43 | $subtotal = self::get_subtotal_for_admin( $ticket ); |
43 | 44 | //get taxes |
@@ -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 |
@@ -30,9 +30,9 @@ discard block |
||
30 | 30 | * @param array $props_n_values |
31 | 31 | * @return EE_Term_Relationship |
32 | 32 | */ |
33 | - public static function new_instance( $props_n_values = array() ) { |
|
34 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
35 | - return $has_object ? $has_object : new self( $props_n_values ); |
|
33 | + public static function new_instance($props_n_values = array()) { |
|
34 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
35 | + return $has_object ? $has_object : new self($props_n_values); |
|
36 | 36 | } |
37 | 37 | |
38 | 38 | |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | * @param array $props_n_values |
42 | 42 | * @return EE_Term_Relationship |
43 | 43 | */ |
44 | - public static function new_instance_from_db( $props_n_values = array() ) { |
|
45 | - return new self( $props_n_values, TRUE ); |
|
44 | + public static function new_instance_from_db($props_n_values = array()) { |
|
45 | + return new self($props_n_values, TRUE); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 |
@@ -2,18 +2,18 @@ |
||
2 | 2 | exit( 'No direct script access allowed' ); |
3 | 3 | } |
4 | 4 | /** |
5 | - * Event Espresso |
|
6 | - * |
|
7 | - * Event Registration and Management Plugin for WordPress |
|
8 | - * |
|
9 | - * @ package Event Espresso |
|
10 | - * @ author Event Espresso |
|
11 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
12 | - * @ license {@link http://eventespresso.com/support/terms-conditions/} * see Plugin Licensing * |
|
13 | - * @ link {@link http://www.eventespresso.com} |
|
14 | - * @ since 4.0 |
|
15 | - * |
|
16 | - */ |
|
5 | + * Event Espresso |
|
6 | + * |
|
7 | + * Event Registration and Management Plugin for WordPress |
|
8 | + * |
|
9 | + * @ package Event Espresso |
|
10 | + * @ author Event Espresso |
|
11 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
12 | + * @ license {@link http://eventespresso.com/support/terms-conditions/} * see Plugin Licensing * |
|
13 | + * @ link {@link http://www.eventespresso.com} |
|
14 | + * @ since 4.0 |
|
15 | + * |
|
16 | + */ |
|
17 | 17 | |
18 | 18 | |
19 | 19 |
@@ -1,5 +1,5 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { |
|
2 | - exit( 'No direct script access allowed' ); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | 3 | } |
4 | 4 | /** |
5 | 5 | * Event Espresso |
@@ -35,9 +35,9 @@ discard block |
||
35 | 35 | * @param string $timezone |
36 | 36 | * @return EE_Ticket_Template|mixed |
37 | 37 | */ |
38 | - public static function new_instance( $props_n_values = array(), $timezone = '' ) { |
|
39 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__, $timezone ); |
|
40 | - return $has_object ? $has_object : new self( $props_n_values, FALSE, $timezone ); |
|
38 | + public static function new_instance($props_n_values = array(), $timezone = '') { |
|
39 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone); |
|
40 | + return $has_object ? $has_object : new self($props_n_values, FALSE, $timezone); |
|
41 | 41 | } |
42 | 42 | |
43 | 43 | |
@@ -47,8 +47,8 @@ discard block |
||
47 | 47 | * @param string $timezone |
48 | 48 | * @return EE_Ticket_Template |
49 | 49 | */ |
50 | - public static function new_instance_from_db( $props_n_values = array(), $timezone = '' ) { |
|
51 | - return new self( $props_n_values, TRUE, $timezone ); |
|
50 | + public static function new_instance_from_db($props_n_values = array(), $timezone = '') { |
|
51 | + return new self($props_n_values, TRUE, $timezone); |
|
52 | 52 | } |
53 | 53 | |
54 | 54 |
@@ -2,18 +2,18 @@ |
||
2 | 2 | exit( 'No direct script access allowed' ); |
3 | 3 | } |
4 | 4 | /** |
5 | - * Event Espresso |
|
6 | - * |
|
7 | - * Event Registration and Management Plugin for WordPress |
|
8 | - * |
|
9 | - * @ package Event Espresso |
|
10 | - * @ author Event Espresso |
|
11 | - * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
12 | - * @ license {@link http://eventespresso.com/support/terms-conditions/} * see Plugin Licensing * |
|
13 | - * @ link {@link http://www.eventespresso.com} |
|
14 | - * @ since 4.0 |
|
15 | - * |
|
16 | - */ |
|
5 | + * Event Espresso |
|
6 | + * |
|
7 | + * Event Registration and Management Plugin for WordPress |
|
8 | + * |
|
9 | + * @ package Event Espresso |
|
10 | + * @ author Event Espresso |
|
11 | + * @ copyright (c) 2008-2011 Event Espresso All Rights Reserved. |
|
12 | + * @ license {@link http://eventespresso.com/support/terms-conditions/} * see Plugin Licensing * |
|
13 | + * @ link {@link http://www.eventespresso.com} |
|
14 | + * @ since 4.0 |
|
15 | + * |
|
16 | + */ |
|
17 | 17 | |
18 | 18 | |
19 | 19 |
@@ -2,14 +2,14 @@ |
||
2 | 2 | exit( 'No direct script access allowed' ); |
3 | 3 | } |
4 | 4 | /** |
5 | - * EE_WP_User class |
|
6 | - * |
|
7 | - * @package Event Espresso |
|
8 | - * @subpackage includes/classes/EE_WP_User.class.php |
|
9 | - * @author Mike Nelson |
|
10 | - * |
|
11 | - * ------------------------------------------------------------------------ |
|
12 | - */ |
|
5 | + * EE_WP_User class |
|
6 | + * |
|
7 | + * @package Event Espresso |
|
8 | + * @subpackage includes/classes/EE_WP_User.class.php |
|
9 | + * @author Mike Nelson |
|
10 | + * |
|
11 | + * ------------------------------------------------------------------------ |
|
12 | + */ |
|
13 | 13 | class EE_WP_User extends EE_Base_Class { |
14 | 14 | |
15 | 15 | /** |
@@ -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 | * EE_WP_User class |
@@ -22,9 +22,9 @@ discard block |
||
22 | 22 | * @param array $props_n_values |
23 | 23 | * @return EE_WP_User|mixed |
24 | 24 | */ |
25 | - public static function new_instance( $props_n_values = array() ) { |
|
26 | - $has_object = parent::_check_for_object( $props_n_values, __CLASS__ ); |
|
27 | - return $has_object ? $has_object : new self( $props_n_values ); |
|
25 | + public static function new_instance($props_n_values = array()) { |
|
26 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
27 | + return $has_object ? $has_object : new self($props_n_values); |
|
28 | 28 | } |
29 | 29 | |
30 | 30 | |
@@ -33,8 +33,8 @@ discard block |
||
33 | 33 | * @param array $props_n_values |
34 | 34 | * @return EE_WP_User |
35 | 35 | */ |
36 | - public static function new_instance_from_db( $props_n_values = array() ) { |
|
37 | - return new self( $props_n_values, TRUE ); |
|
36 | + public static function new_instance_from_db($props_n_values = array()) { |
|
37 | + return new self($props_n_values, TRUE); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | /** |
@@ -42,8 +42,8 @@ discard block |
||
42 | 42 | * @return WP_User |
43 | 43 | */ |
44 | 44 | public function wp_user_obj() { |
45 | - if( ! $this->_wp_user_obj ) { |
|
46 | - $this->_wp_user_obj = get_user_by('ID', $this->ID() ); |
|
45 | + if ( ! $this->_wp_user_obj) { |
|
46 | + $this->_wp_user_obj = get_user_by('ID', $this->ID()); |
|
47 | 47 | } |
48 | 48 | return $this->_wp_user_obj; |
49 | 49 | } |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | $_SERVER['REQUEST_URI'] |
70 | 70 | ) |
71 | 71 | ), |
72 | - get_edit_user_link( $this->ID() ) |
|
72 | + get_edit_user_link($this->ID()) |
|
73 | 73 | ) |
74 | 74 | ); |
75 | 75 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | * @return string |
88 | 88 | */ |
89 | 89 | public function get_admin_overview_link() { |
90 | - return admin_url( 'users.php' ); |
|
90 | + return admin_url('users.php'); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 |
@@ -50,18 +50,18 @@ discard block |
||
50 | 50 | /** |
51 | 51 | * constructor |
52 | 52 | */ |
53 | - protected function __construct( $timezone = NULL ){ |
|
54 | - $this->singular_item = __('Answer','event_espresso'); |
|
55 | - $this->plural_item = __('Answers','event_espresso'); |
|
53 | + protected function __construct($timezone = NULL) { |
|
54 | + $this->singular_item = __('Answer', 'event_espresso'); |
|
55 | + $this->plural_item = __('Answers', 'event_espresso'); |
|
56 | 56 | $this->_tables = array( |
57 | 57 | 'Answer'=> new EE_Primary_Table('esp_answer', 'ANS_ID') |
58 | 58 | ); |
59 | 59 | $this->_fields = array( |
60 | 60 | 'Answer'=>array( |
61 | - 'ANS_ID'=> new EE_Primary_Key_Int_Field('ANS_ID', __('Answer ID','event_espresso')), |
|
62 | - 'REG_ID'=>new EE_Foreign_Key_Int_Field('REG_ID', __('Registration ID','event_espresso'), false, 0, 'Registration'), |
|
63 | - 'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID','event_espresso'), false, 0, 'Question'), |
|
64 | - 'ANS_value'=>new EE_Maybe_Serialized_Simple_HTML_Field('ANS_value', __('Answer Value','event_espresso'), false, '') |
|
61 | + 'ANS_ID'=> new EE_Primary_Key_Int_Field('ANS_ID', __('Answer ID', 'event_espresso')), |
|
62 | + 'REG_ID'=>new EE_Foreign_Key_Int_Field('REG_ID', __('Registration ID', 'event_espresso'), false, 0, 'Registration'), |
|
63 | + 'QST_ID'=>new EE_Foreign_Key_Int_Field('QST_ID', __('Question ID', 'event_espresso'), false, 0, 'Question'), |
|
64 | + 'ANS_value'=>new EE_Maybe_Serialized_Simple_HTML_Field('ANS_value', __('Answer Value', 'event_espresso'), false, '') |
|
65 | 65 | )); |
66 | 66 | $this->_model_relations = array( |
67 | 67 | 'Registration'=>new EE_Belongs_To_Relation(), |
@@ -69,7 +69,7 @@ discard block |
||
69 | 69 | ); |
70 | 70 | $this->_model_chain_to_wp_user = 'Registration.Event'; |
71 | 71 | $this->_caps_slug = 'registrations'; |
72 | - parent::__construct( $timezone ); |
|
72 | + parent::__construct($timezone); |
|
73 | 73 | } |
74 | 74 | |
75 | 75 | |
@@ -82,19 +82,19 @@ discard block |
||
82 | 82 | * @param boolean $pretty_answer whether to call 'pretty_value' or just 'value' |
83 | 83 | * @return string |
84 | 84 | */ |
85 | - public function get_answer_value_to_question( EE_Registration $registration, $question_id = NULL,$pretty_answer = FALSE ){ |
|
86 | - $value = $this->get_attendee_property_answer_value( $registration, $question_id, $pretty_answer ); |
|
87 | - if ( $value === NULL ){ |
|
88 | - $answer_obj = $this->get_registration_question_answer_object( $registration, $question_id, $pretty_answer ); |
|
89 | - if( $answer_obj instanceof EE_Answer ){ |
|
90 | - if($pretty_answer){ |
|
85 | + public function get_answer_value_to_question(EE_Registration $registration, $question_id = NULL, $pretty_answer = FALSE) { |
|
86 | + $value = $this->get_attendee_property_answer_value($registration, $question_id, $pretty_answer); |
|
87 | + if ($value === NULL) { |
|
88 | + $answer_obj = $this->get_registration_question_answer_object($registration, $question_id, $pretty_answer); |
|
89 | + if ($answer_obj instanceof EE_Answer) { |
|
90 | + if ($pretty_answer) { |
|
91 | 91 | $value = $answer_obj->pretty_value(); |
92 | - }else{ |
|
92 | + } else { |
|
93 | 93 | $value = $answer_obj->value(); |
94 | 94 | } |
95 | 95 | } |
96 | 96 | } |
97 | - return apply_filters( 'FHEE__EEM_Answer__get_answer_value_to_question__answer_value', $value, $registration, $question_id ); |
|
97 | + return apply_filters('FHEE__EEM_Answer__get_answer_value_to_question__answer_value', $value, $registration, $question_id); |
|
98 | 98 | } |
99 | 99 | |
100 | 100 | |
@@ -105,9 +105,9 @@ discard block |
||
105 | 105 | * @param int $question_id |
106 | 106 | * @return EE_Answer |
107 | 107 | */ |
108 | - public function get_registration_question_answer_object( EE_Registration $registration, $question_id = NULL){ |
|
109 | - $answer_obj = $this->get_one( array( array( 'QST_ID'=>$question_id, 'REG_ID'=>$registration->ID() ))); |
|
110 | - return apply_filters( 'FHEE__EEM_Answer__get_registration_question_answer_object__answer_obj', $answer_obj, $registration, $question_id ); |
|
108 | + public function get_registration_question_answer_object(EE_Registration $registration, $question_id = NULL) { |
|
109 | + $answer_obj = $this->get_one(array(array('QST_ID'=>$question_id, 'REG_ID'=>$registration->ID()))); |
|
110 | + return apply_filters('FHEE__EEM_Answer__get_registration_question_answer_object__answer_obj', $answer_obj, $registration, $question_id); |
|
111 | 111 | } |
112 | 112 | |
113 | 113 | |
@@ -119,27 +119,27 @@ discard block |
||
119 | 119 | * @param boolean $pretty_answer |
120 | 120 | * @return string |
121 | 121 | */ |
122 | - public function get_attendee_property_answer_value( EE_Registration $registration, $question_id = NULL, $pretty_answer = FALSE ){ |
|
122 | + public function get_attendee_property_answer_value(EE_Registration $registration, $question_id = NULL, $pretty_answer = FALSE) { |
|
123 | 123 | $field_name = NULL; |
124 | 124 | $value = NULL; |
125 | 125 | //only bother checking if the registration has an attendee |
126 | - if( $registration->attendee() instanceof EE_Attendee && isset($this->_question_id_to_att_field_map[$question_id])){ |
|
126 | + if ($registration->attendee() instanceof EE_Attendee && isset($this->_question_id_to_att_field_map[$question_id])) { |
|
127 | 127 | $field_name = $this->_question_id_to_att_field_map[$question_id]; |
128 | - if($pretty_answer){ |
|
129 | - if($field_name == 'STA_ID'){ |
|
128 | + if ($pretty_answer) { |
|
129 | + if ($field_name == 'STA_ID') { |
|
130 | 130 | $state = $registration->attendee()->state_obj(); |
131 | - $value = $state instanceof EE_State ? $state->name() : sprintf(__('Unknown State (%s)', 'event_espresso'),$registration->attendee()->state_ID()); |
|
132 | - }else if($field_name == 'CNT_ISO'){ |
|
131 | + $value = $state instanceof EE_State ? $state->name() : sprintf(__('Unknown State (%s)', 'event_espresso'), $registration->attendee()->state_ID()); |
|
132 | + } else if ($field_name == 'CNT_ISO') { |
|
133 | 133 | $country = $registration->attendee()->country_obj(); |
134 | - $value = $country instanceof EE_Country ? $country->name() : sprintf(__('Unknown Country (%s)', "event_espresso"),$registration->attendee()->country_ID()); |
|
135 | - }else{ |
|
134 | + $value = $country instanceof EE_Country ? $country->name() : sprintf(__('Unknown Country (%s)', "event_espresso"), $registration->attendee()->country_ID()); |
|
135 | + } else { |
|
136 | 136 | $value = $registration->attendee()->get_pretty($field_name); |
137 | 137 | } |
138 | - }else{ |
|
138 | + } else { |
|
139 | 139 | $value = $registration->attendee()->get($field_name); |
140 | 140 | } |
141 | 141 | } |
142 | - return apply_filters( 'FHEE__EEM_Answer__get_attendee_question_answer_value__answer_value', $value, $registration, $question_id ); |
|
142 | + return apply_filters('FHEE__EEM_Answer__get_attendee_question_answer_value__answer_value', $value, $registration, $question_id); |
|
143 | 143 | } |
144 | 144 | |
145 | 145 |
@@ -1,4 +1,6 @@ discard block |
||
1 | -<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed'); |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { |
|
2 | + exit('No direct script access allowed'); |
|
3 | +} |
|
2 | 4 | /** |
3 | 5 | * Event Espresso |
4 | 6 | * |
@@ -89,7 +91,7 @@ discard block |
||
89 | 91 | if( $answer_obj instanceof EE_Answer ){ |
90 | 92 | if($pretty_answer){ |
91 | 93 | $value = $answer_obj->pretty_value(); |
92 | - }else{ |
|
94 | + } else{ |
|
93 | 95 | $value = $answer_obj->value(); |
94 | 96 | } |
95 | 97 | } |
@@ -129,13 +131,13 @@ discard block |
||
129 | 131 | if($field_name == 'STA_ID'){ |
130 | 132 | $state = $registration->attendee()->state_obj(); |
131 | 133 | $value = $state instanceof EE_State ? $state->name() : sprintf(__('Unknown State (%s)', 'event_espresso'),$registration->attendee()->state_ID()); |
132 | - }else if($field_name == 'CNT_ISO'){ |
|
134 | + } else if($field_name == 'CNT_ISO'){ |
|
133 | 135 | $country = $registration->attendee()->country_obj(); |
134 | 136 | $value = $country instanceof EE_Country ? $country->name() : sprintf(__('Unknown Country (%s)', "event_espresso"),$registration->attendee()->country_ID()); |
135 | - }else{ |
|
137 | + } else{ |
|
136 | 138 | $value = $registration->attendee()->get_pretty($field_name); |
137 | 139 | } |
138 | - }else{ |
|
140 | + } else{ |
|
139 | 141 | $value = $registration->attendee()->get($field_name); |
140 | 142 | } |
141 | 143 | } |
@@ -105,13 +105,13 @@ discard block |
||
105 | 105 | |
106 | 106 | |
107 | 107 | /** |
108 | - * retrieve a single attendee from db via their ID |
|
109 | - * |
|
110 | - * @access public |
|
111 | - * @param $ATT_ID |
|
112 | - * @return mixed array on success, FALSE on fail |
|
108 | + * retrieve a single attendee from db via their ID |
|
109 | + * |
|
110 | + * @access public |
|
111 | + * @param $ATT_ID |
|
112 | + * @return mixed array on success, FALSE on fail |
|
113 | 113 | * @deprecated |
114 | - */ |
|
114 | + */ |
|
115 | 115 | public function get_attendee_by_ID( $ATT_ID = FALSE ) { |
116 | 116 | // retrieve a particular EE_Attendee |
117 | 117 | return $this->get_one_by_ID( $ATT_ID ); |
@@ -121,12 +121,12 @@ discard block |
||
121 | 121 | |
122 | 122 | |
123 | 123 | /** |
124 | - * retrieve a single attendee from db via their ID |
|
125 | - * |
|
126 | - * @access public |
|
127 | - * @param array $where_cols_n_values |
|
128 | - * @return mixed array on success, FALSE on fail |
|
129 | - */ |
|
124 | + * retrieve a single attendee from db via their ID |
|
125 | + * |
|
126 | + * @access public |
|
127 | + * @param array $where_cols_n_values |
|
128 | + * @return mixed array on success, FALSE on fail |
|
129 | + */ |
|
130 | 130 | public function get_attendee( $where_cols_n_values = array() ) { |
131 | 131 | |
132 | 132 | if ( empty( $where_cols_n_values )) { |
@@ -174,20 +174,20 @@ discard block |
||
174 | 174 | |
175 | 175 | |
176 | 176 | /** |
177 | - * Takes an incoming array of EE_Registration ids and sends back a list of corresponding non duplicate |
|
178 | - * EE_Attendee objects. |
|
179 | - * |
|
180 | - * @since 4.3.0 |
|
181 | - * @param array $ids array of EE_Registration ids |
|
182 | - * @return EE_Attendee[] |
|
183 | - */ |
|
184 | - public function get_array_of_contacts_from_reg_ids( $ids ) { |
|
185 | - $ids = (array) $ids; |
|
186 | - $_where = array( |
|
187 | - 'Registration.REG_ID' => array( 'in', $ids ) |
|
188 | - ); |
|
189 | - return $this->get_all( array( $_where ) ); |
|
190 | - } |
|
177 | + * Takes an incoming array of EE_Registration ids and sends back a list of corresponding non duplicate |
|
178 | + * EE_Attendee objects. |
|
179 | + * |
|
180 | + * @since 4.3.0 |
|
181 | + * @param array $ids array of EE_Registration ids |
|
182 | + * @return EE_Attendee[] |
|
183 | + */ |
|
184 | + public function get_array_of_contacts_from_reg_ids( $ids ) { |
|
185 | + $ids = (array) $ids; |
|
186 | + $_where = array( |
|
187 | + 'Registration.REG_ID' => array( 'in', $ids ) |
|
188 | + ); |
|
189 | + return $this->get_all( array( $_where ) ); |
|
190 | + } |
|
191 | 191 | |
192 | 192 | |
193 | 193 | } |
@@ -256,7 +256,7 @@ |
||
256 | 256 | * @param int $TXN_ID |
257 | 257 | * @param int $ATT_ID |
258 | 258 | * @param int $att_nmbr in case the ATT_ID is the same for multiple registrations (same details used) then the attendee number is required |
259 | - * @return mixed array on success, FALSE on fail |
|
259 | + * @return EE_Soft_Delete_Base_Class|null array on success, FALSE on fail |
|
260 | 260 | */ |
261 | 261 | public function get_registration_for_transaction_attendee( $TXN_ID = 0, $ATT_ID = 0, $att_nmbr = 0 ) { |
262 | 262 | return $this->get_one(array( |
@@ -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,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_Base.model.php' ); |
|
2 | +require_once (EE_MODELS.'EEM_Base.model.php'); |
|
3 | 3 | |
4 | 4 | /** |
5 | 5 | * |
@@ -19,16 +19,16 @@ discard block |
||
19 | 19 | * QST_ID and QST_systems that relate to attendee attributes. |
20 | 20 | * NOTE: this will be deprecated if we remove system questions |
21 | 21 | */ |
22 | - const fname_question_id=1; |
|
23 | - const lname_question_id=2; |
|
24 | - const email_question_id=3; |
|
25 | - const address_question_id=4; |
|
26 | - const address2_question_id=5; |
|
27 | - const city_question_id=6; |
|
28 | - const state_question_id=7; |
|
29 | - const country_question_id=8; |
|
30 | - const zip_question_id=9; |
|
31 | - const phone_question_id=10; |
|
22 | + const fname_question_id = 1; |
|
23 | + const lname_question_id = 2; |
|
24 | + const email_question_id = 3; |
|
25 | + const address_question_id = 4; |
|
26 | + const address2_question_id = 5; |
|
27 | + const city_question_id = 6; |
|
28 | + const state_question_id = 7; |
|
29 | + const country_question_id = 8; |
|
30 | + const zip_question_id = 9; |
|
31 | + const phone_question_id = 10; |
|
32 | 32 | |
33 | 33 | |
34 | 34 | |
@@ -39,9 +39,9 @@ discard block |
||
39 | 39 | * @access protected |
40 | 40 | * @param null $timezone |
41 | 41 | */ |
42 | - protected function __construct( $timezone = NULL ) { |
|
43 | - $this->singular_item = __('Attendee','event_espresso'); |
|
44 | - $this->plural_item = __('Attendees','event_espresso'); |
|
42 | + protected function __construct($timezone = NULL) { |
|
43 | + $this->singular_item = __('Attendee', 'event_espresso'); |
|
44 | + $this->plural_item = __('Attendees', 'event_espresso'); |
|
45 | 45 | $this->_tables = array( |
46 | 46 | 'Attendee_CPT'=> new EE_Primary_Table('posts', 'ID'), |
47 | 47 | 'Attendee_Meta'=>new EE_Secondary_Table('esp_attendee_meta', 'ATTM_ID', 'ATT_ID') |
@@ -55,37 +55,37 @@ discard block |
||
55 | 55 | 'ATT_created'=>new EE_Datetime_Field('post_date', __("Time Attendee Created", "event_espresso"), false, time()), |
56 | 56 | 'ATT_short_bio'=>new EE_Simple_HTML_Field('post_excerpt', __("Attendee Short Biography", "event_espresso"), true, __("No Biography Provided", "event_espresso")), |
57 | 57 | 'ATT_modified'=>new EE_Datetime_Field('post_modified', __("Time Attendee Last Modified", "event_espresso"), FALSE, time()), |
58 | - 'ATT_author'=>new EE_WP_User_Field('post_author', __("Creator ID of the first Event attended", "event_espresso"), false ), |
|
58 | + 'ATT_author'=>new EE_WP_User_Field('post_author', __("Creator ID of the first Event attended", "event_espresso"), false), |
|
59 | 59 | 'ATT_parent'=>new EE_DB_Only_Int_Field('post_parent', __("Parent Attendee (unused)", "event_espresso"), false, 0), |
60 | - 'post_type'=>new EE_WP_Post_Type_Field('espresso_attendees'),// EE_DB_Only_Text_Field('post_type', __("Post Type of Attendee", "event_espresso"), false,'espresso_attendees'), |
|
60 | + 'post_type'=>new EE_WP_Post_Type_Field('espresso_attendees'), // EE_DB_Only_Text_Field('post_type', __("Post Type of Attendee", "event_espresso"), false,'espresso_attendees'), |
|
61 | 61 | 'status' => new EE_WP_Post_Status_Field('post_status', __('Attendee Status', 'event_espresso'), false, 'publish') |
62 | 62 | ), |
63 | 63 | 'Attendee_Meta'=>array( |
64 | - 'ATTM_ID'=> new EE_DB_Only_Int_Field('ATTM_ID', __('Attendee Meta Row ID','event_espresso'), false), |
|
64 | + 'ATTM_ID'=> new EE_DB_Only_Int_Field('ATTM_ID', __('Attendee Meta Row ID', 'event_espresso'), false), |
|
65 | 65 | 'ATT_ID_fk'=>new EE_DB_Only_Int_Field('ATT_ID', __("Foreign Key to Attendee in Post Table", "event_espresso"), false), |
66 | - 'ATT_fname'=>new EE_Plain_Text_Field('ATT_fname', __('First Name','event_espresso'), true, ''), |
|
67 | - 'ATT_lname'=>new EE_Plain_Text_Field('ATT_lname', __('Last Name','event_espresso'), true, ''), |
|
68 | - 'ATT_address'=>new EE_Plain_Text_Field('ATT_address', __('Address Part 1','event_espresso'), true, ''), |
|
69 | - 'ATT_address2'=>new EE_Plain_Text_Field('ATT_address2', __('Address Part 2','event_espresso'), true, ''), |
|
70 | - 'ATT_city'=>new EE_Plain_Text_Field('ATT_city', __('City','event_espresso'), true, ''), |
|
71 | - 'STA_ID'=>new EE_Foreign_Key_Int_Field('STA_ID', __('State','event_espresso'), true,0,'State'), |
|
72 | - 'CNT_ISO'=>new EE_Foreign_Key_String_Field('CNT_ISO', __('Country','event_espresso'), true,'','Country'), |
|
73 | - 'ATT_zip'=>new EE_Plain_Text_Field('ATT_zip', __('ZIP/Postal Code','event_espresso'), true, ''), |
|
74 | - 'ATT_email'=>new EE_Email_Field('ATT_email', __('Email Address','event_espresso'), true, ''), |
|
75 | - 'ATT_phone'=>new EE_Plain_Text_Field('ATT_phone', __('Phone','event_espresso'), true, '') |
|
66 | + 'ATT_fname'=>new EE_Plain_Text_Field('ATT_fname', __('First Name', 'event_espresso'), true, ''), |
|
67 | + 'ATT_lname'=>new EE_Plain_Text_Field('ATT_lname', __('Last Name', 'event_espresso'), true, ''), |
|
68 | + 'ATT_address'=>new EE_Plain_Text_Field('ATT_address', __('Address Part 1', 'event_espresso'), true, ''), |
|
69 | + 'ATT_address2'=>new EE_Plain_Text_Field('ATT_address2', __('Address Part 2', 'event_espresso'), true, ''), |
|
70 | + 'ATT_city'=>new EE_Plain_Text_Field('ATT_city', __('City', 'event_espresso'), true, ''), |
|
71 | + 'STA_ID'=>new EE_Foreign_Key_Int_Field('STA_ID', __('State', 'event_espresso'), true, 0, 'State'), |
|
72 | + 'CNT_ISO'=>new EE_Foreign_Key_String_Field('CNT_ISO', __('Country', 'event_espresso'), true, '', 'Country'), |
|
73 | + 'ATT_zip'=>new EE_Plain_Text_Field('ATT_zip', __('ZIP/Postal Code', 'event_espresso'), true, ''), |
|
74 | + 'ATT_email'=>new EE_Email_Field('ATT_email', __('Email Address', 'event_espresso'), true, ''), |
|
75 | + 'ATT_phone'=>new EE_Plain_Text_Field('ATT_phone', __('Phone', 'event_espresso'), true, '') |
|
76 | 76 | )); |
77 | 77 | $this->_model_relations = array( |
78 | 78 | 'Registration'=>new EE_Has_Many_Relation(), |
79 | 79 | 'State'=>new EE_Belongs_To_Relation(), |
80 | 80 | 'Country'=>new EE_Belongs_To_Relation(), |
81 | - 'Event'=>new EE_HABTM_Relation('Registration', FALSE ), |
|
81 | + 'Event'=>new EE_HABTM_Relation('Registration', FALSE), |
|
82 | 82 | 'WP_User' => new EE_Belongs_To_Relation(), |
83 | - 'Message' => new EE_Has_Many_Any_Relation( false ) //allow deletion of attendees even if they have messages in the queue for them. |
|
83 | + 'Message' => new EE_Has_Many_Any_Relation(false) //allow deletion of attendees even if they have messages in the queue for them. |
|
84 | 84 | ); |
85 | 85 | require_once('strategies/EE_CPT_Where_Conditions.strategy.php'); |
86 | 86 | $this->_default_where_conditions_strategy = new EE_CPT_Where_Conditions('espresso_attendees', 'ATTM_ID'); |
87 | 87 | $this->_caps_slug = 'contacts'; |
88 | - parent::__construct( $timezone ); |
|
88 | + parent::__construct($timezone); |
|
89 | 89 | |
90 | 90 | } |
91 | 91 | |
@@ -97,8 +97,8 @@ discard block |
||
97 | 97 | * @param EE_Transaction/int $transaction_id_or_obj EE_Transaction or its ID |
98 | 98 | * @return EE_Attendee[] |
99 | 99 | */ |
100 | - public function get_attendees_for_transaction( $transaction_id_or_obj ){ |
|
101 | - return $this->get_all( array( array( |
|
100 | + public function get_attendees_for_transaction($transaction_id_or_obj) { |
|
101 | + return $this->get_all(array(array( |
|
102 | 102 | 'Registration.Transaction.TXN_ID' => $transaction_id_or_obj instanceof EE_Transaction ? $transaction_id_or_obj->ID() : $transaction_id_or_obj |
103 | 103 | ))); |
104 | 104 | } |
@@ -113,9 +113,9 @@ discard block |
||
113 | 113 | * @return mixed array on success, FALSE on fail |
114 | 114 | * @deprecated |
115 | 115 | */ |
116 | - public function get_attendee_by_ID( $ATT_ID = FALSE ) { |
|
116 | + public function get_attendee_by_ID($ATT_ID = FALSE) { |
|
117 | 117 | // retrieve a particular EE_Attendee |
118 | - return $this->get_one_by_ID( $ATT_ID ); |
|
118 | + return $this->get_one_by_ID($ATT_ID); |
|
119 | 119 | } |
120 | 120 | |
121 | 121 | |
@@ -128,14 +128,14 @@ discard block |
||
128 | 128 | * @param array $where_cols_n_values |
129 | 129 | * @return mixed array on success, FALSE on fail |
130 | 130 | */ |
131 | - public function get_attendee( $where_cols_n_values = array() ) { |
|
131 | + public function get_attendee($where_cols_n_values = array()) { |
|
132 | 132 | |
133 | - if ( empty( $where_cols_n_values )) { |
|
133 | + if (empty($where_cols_n_values)) { |
|
134 | 134 | return FALSE; |
135 | 135 | } |
136 | - $attendee = $this->get_all( array($where_cols_n_values )); |
|
137 | - if ( ! empty( $attendee )) { |
|
138 | - return array_shift( $attendee ); |
|
136 | + $attendee = $this->get_all(array($where_cols_n_values)); |
|
137 | + if ( ! empty($attendee)) { |
|
138 | + return array_shift($attendee); |
|
139 | 139 | } else { |
140 | 140 | return FALSE; |
141 | 141 | } |
@@ -151,20 +151,20 @@ discard block |
||
151 | 151 | * @param array $where_cols_n_values |
152 | 152 | * @return bool|mixed |
153 | 153 | */ |
154 | - public function find_existing_attendee( $where_cols_n_values = NULL ) { |
|
154 | + public function find_existing_attendee($where_cols_n_values = NULL) { |
|
155 | 155 | // search by combo of first and last names plus the email address |
156 | - $attendee_data_keys = array( 'ATT_fname' => $this->_ATT_fname, 'ATT_lname' => $this->_ATT_lname, 'ATT_email' => $this->_ATT_email ); |
|
156 | + $attendee_data_keys = array('ATT_fname' => $this->_ATT_fname, 'ATT_lname' => $this->_ATT_lname, 'ATT_email' => $this->_ATT_email); |
|
157 | 157 | // no search params means attendee object already exists. |
158 | - $where_cols_n_values = is_array( $where_cols_n_values ) && ! empty( $where_cols_n_values ) ? $where_cols_n_values : $attendee_data_keys; |
|
158 | + $where_cols_n_values = is_array($where_cols_n_values) && ! empty($where_cols_n_values) ? $where_cols_n_values : $attendee_data_keys; |
|
159 | 159 | $valid_data = TRUE; |
160 | 160 | // check for required values |
161 | - $valid_data = isset( $where_cols_n_values['ATT_fname'] ) && ! empty( $where_cols_n_values['ATT_fname'] ) ? $valid_data : FALSE; |
|
162 | - $valid_data = isset( $where_cols_n_values['ATT_lname'] ) && ! empty( $where_cols_n_values['ATT_lname'] ) ? $valid_data : FALSE; |
|
163 | - $valid_data = isset( $where_cols_n_values['ATT_email'] ) && ! empty( $where_cols_n_values['ATT_email'] ) ? $valid_data : FALSE; |
|
161 | + $valid_data = isset($where_cols_n_values['ATT_fname']) && ! empty($where_cols_n_values['ATT_fname']) ? $valid_data : FALSE; |
|
162 | + $valid_data = isset($where_cols_n_values['ATT_lname']) && ! empty($where_cols_n_values['ATT_lname']) ? $valid_data : FALSE; |
|
163 | + $valid_data = isset($where_cols_n_values['ATT_email']) && ! empty($where_cols_n_values['ATT_email']) ? $valid_data : FALSE; |
|
164 | 164 | |
165 | - if ( $valid_data ) { |
|
166 | - $attendee = $this->get_attendee( $where_cols_n_values ); |
|
167 | - if ( $attendee instanceof EE_Attendee ) { |
|
165 | + if ($valid_data) { |
|
166 | + $attendee = $this->get_attendee($where_cols_n_values); |
|
167 | + if ($attendee instanceof EE_Attendee) { |
|
168 | 168 | return $attendee; |
169 | 169 | } |
170 | 170 | } |
@@ -182,12 +182,12 @@ discard block |
||
182 | 182 | * @param array $ids array of EE_Registration ids |
183 | 183 | * @return EE_Attendee[] |
184 | 184 | */ |
185 | - public function get_array_of_contacts_from_reg_ids( $ids ) { |
|
185 | + public function get_array_of_contacts_from_reg_ids($ids) { |
|
186 | 186 | $ids = (array) $ids; |
187 | 187 | $_where = array( |
188 | - 'Registration.REG_ID' => array( 'in', $ids ) |
|
188 | + 'Registration.REG_ID' => array('in', $ids) |
|
189 | 189 | ); |
190 | - return $this->get_all( array( $_where ) ); |
|
190 | + return $this->get_all(array($_where)); |
|
191 | 191 | } |
192 | 192 | |
193 | 193 |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -define('EE_Event_Category_Taxonomy','espresso_event_category'); |
|
2 | +define('EE_Event_Category_Taxonomy', 'espresso_event_category'); |
|
3 | 3 | /** |
4 | 4 | * |
5 | 5 | * EEM_CPT_Base |
@@ -16,7 +16,7 @@ discard block |
||
16 | 16 | * @author Mike Nelson |
17 | 17 | * |
18 | 18 | */ |
19 | -abstract class EEM_CPT_Base extends EEM_Soft_Delete_Base{ |
|
19 | +abstract class EEM_CPT_Base extends EEM_Soft_Delete_Base { |
|
20 | 20 | |
21 | 21 | /** |
22 | 22 | * @var string post_status_trashed - the wp post status for trashed cpts |
@@ -44,42 +44,42 @@ discard block |
||
44 | 44 | * @param string $timezone |
45 | 45 | * @throws \EE_Error |
46 | 46 | */ |
47 | - protected function __construct( $timezone = NULL ){ |
|
47 | + protected function __construct($timezone = NULL) { |
|
48 | 48 | |
49 | 49 | //adds a relationship to Term_Taxonomy for all these models. For this to work |
50 | 50 | //Term_Relationship must have a relation to each model subclassing EE_CPT_Base explicitly |
51 | 51 | //eg, in EEM_Term_Relationship, inside the _model_relations array, there must be an entry |
52 | 52 | //with key equalling the subclassing model's model name (eg 'Event' or 'Venue'), and the value |
53 | 53 | //must also be new EE_HABTM_Relation('Term_Relationship'); |
54 | - $this->_model_relations['Term_Taxonomy'] =new EE_HABTM_Relation('Term_Relationship'); |
|
54 | + $this->_model_relations['Term_Taxonomy'] = new EE_HABTM_Relation('Term_Relationship'); |
|
55 | 55 | $primary_table_name = NULL; |
56 | 56 | //add the common _status field to all CPT primary tables. |
57 | - foreach ( $this->_tables as $alias => $table_obj ) { |
|
58 | - if ( $table_obj instanceof EE_Primary_Table ) { |
|
57 | + foreach ($this->_tables as $alias => $table_obj) { |
|
58 | + if ($table_obj instanceof EE_Primary_Table) { |
|
59 | 59 | $primary_table_name = $alias; |
60 | 60 | } |
61 | 61 | } |
62 | 62 | //set default wp post statuses if child has not already set. |
63 | - if ( ! isset( $this->_fields[$primary_table_name]['status'] )) { |
|
63 | + if ( ! isset($this->_fields[$primary_table_name]['status'])) { |
|
64 | 64 | $this->_fields[$primary_table_name]['status'] = new EE_WP_Post_Status_Field('post_status', __("Event Status", "event_espresso"), false, 'draft'); |
65 | 65 | } |
66 | - if( ! isset( $this->_fields[$primary_table_name]['to_ping'])){ |
|
67 | - $this->_fields[$primary_table_name]['to_ping'] = new EE_DB_Only_Text_Field('to_ping', __( 'To Ping', 'event_espresso' ), FALSE, ''); |
|
66 | + if ( ! isset($this->_fields[$primary_table_name]['to_ping'])) { |
|
67 | + $this->_fields[$primary_table_name]['to_ping'] = new EE_DB_Only_Text_Field('to_ping', __('To Ping', 'event_espresso'), FALSE, ''); |
|
68 | 68 | } |
69 | - if( ! isset( $this->_fields[$primary_table_name]['pinged'])){ |
|
70 | - $this->_fields[$primary_table_name]['pinged'] = new EE_DB_Only_Text_Field('pinged', __( 'Pinged', 'event_espresso' ), FALSE, ''); |
|
69 | + if ( ! isset($this->_fields[$primary_table_name]['pinged'])) { |
|
70 | + $this->_fields[$primary_table_name]['pinged'] = new EE_DB_Only_Text_Field('pinged', __('Pinged', 'event_espresso'), FALSE, ''); |
|
71 | 71 | } |
72 | 72 | |
73 | - if( ! isset( $this->_fields[$primary_table_name]['comment_status'])){ |
|
74 | - $this->_fields[$primary_table_name]['comment_status'] = new EE_Plain_Text_Field('comment_status', __('Comment Status', 'event_espresso' ), FALSE, 'open'); |
|
73 | + if ( ! isset($this->_fields[$primary_table_name]['comment_status'])) { |
|
74 | + $this->_fields[$primary_table_name]['comment_status'] = new EE_Plain_Text_Field('comment_status', __('Comment Status', 'event_espresso'), FALSE, 'open'); |
|
75 | 75 | } |
76 | 76 | |
77 | - if( ! isset( $this->_fields[$primary_table_name]['ping_status'])){ |
|
77 | + if ( ! isset($this->_fields[$primary_table_name]['ping_status'])) { |
|
78 | 78 | $this->_fields[$primary_table_name]['ping_status'] = new EE_Plain_Text_Field('ping_status', __('Ping Status', 'event_espresso'), FALSE, 'open'); |
79 | 79 | } |
80 | 80 | |
81 | - if( ! isset( $this->_fields[$primary_table_name]['post_content_filtered'])){ |
|
82 | - $this->_fields[$primary_table_name]['post_content_filtered'] = new EE_DB_Only_Text_Field('post_content_filtered', __( 'Post Content Filtered', 'event_espresso' ), FALSE, ''); |
|
81 | + if ( ! isset($this->_fields[$primary_table_name]['post_content_filtered'])) { |
|
82 | + $this->_fields[$primary_table_name]['post_content_filtered'] = new EE_DB_Only_Text_Field('post_content_filtered', __('Post Content Filtered', 'event_espresso'), FALSE, ''); |
|
83 | 83 | } |
84 | 84 | parent::__construct($timezone); |
85 | 85 | |
@@ -92,7 +92,7 @@ discard block |
||
92 | 92 | */ |
93 | 93 | public function public_event_stati() { |
94 | 94 | // @see wp-includes/post.php |
95 | - return get_post_stati( array( 'public' => TRUE )); |
|
95 | + return get_post_stati(array('public' => TRUE)); |
|
96 | 96 | } |
97 | 97 | |
98 | 98 | |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | * @return string |
104 | 104 | * @throws EE_Error |
105 | 105 | */ |
106 | - public function deleted_field_name(){ |
|
106 | + public function deleted_field_name() { |
|
107 | 107 | throw new EE_Error(sprintf(__("EEM_CPT_Base should nto call deleted_field_name! It should instead use post_status_field_name", "event_espresso"))); |
108 | 108 | } |
109 | 109 | |
@@ -114,12 +114,12 @@ discard block |
||
114 | 114 | * @return string |
115 | 115 | * @throws EE_Error |
116 | 116 | */ |
117 | - public function post_status_field_name(){ |
|
117 | + public function post_status_field_name() { |
|
118 | 118 | $field = $this->get_a_field_of_type('EE_WP_Post_Status_Field'); |
119 | - if($field){ |
|
119 | + if ($field) { |
|
120 | 120 | return $field->get_name(); |
121 | - }else{ |
|
122 | - throw new EE_Error(sprintf(__('We are trying to find the post status flag field on %s, but none was found. Are you sure there is a field of type EE_Trashed_Flag_Field in %s constructor?','event_espresso'),get_class($this),get_class($this))); |
|
121 | + } else { |
|
122 | + throw new EE_Error(sprintf(__('We are trying to find the post status flag field on %s, but none was found. Are you sure there is a field of type EE_Trashed_Flag_Field in %s constructor?', 'event_espresso'), get_class($this), get_class($this))); |
|
123 | 123 | } |
124 | 124 | } |
125 | 125 | |
@@ -130,9 +130,9 @@ discard block |
||
130 | 130 | * @param array $query_params like EEM_Base::get_all's $query_params |
131 | 131 | * @return array like EEM_Base::get_all's $query_params |
132 | 132 | */ |
133 | - protected function _alter_query_params_so_only_trashed_items_included($query_params){ |
|
134 | - $post_status_field_name=$this->post_status_field_name(); |
|
135 | - $query_params[0][$post_status_field_name]=self::post_status_trashed; |
|
133 | + protected function _alter_query_params_so_only_trashed_items_included($query_params) { |
|
134 | + $post_status_field_name = $this->post_status_field_name(); |
|
135 | + $query_params[0][$post_status_field_name] = self::post_status_trashed; |
|
136 | 136 | return $query_params; |
137 | 137 | } |
138 | 138 | |
@@ -143,9 +143,9 @@ discard block |
||
143 | 143 | * @param array $query_params |
144 | 144 | * @return array |
145 | 145 | */ |
146 | - protected function _alter_query_params_so_deleted_and_undeleted_items_included($query_params){ |
|
147 | - $post_status_field_name=$this->post_status_field_name(); |
|
148 | - $query_params[0][$post_status_field_name]=array('IN',array_keys($this->get_status_array())); |
|
146 | + protected function _alter_query_params_so_deleted_and_undeleted_items_included($query_params) { |
|
147 | + $post_status_field_name = $this->post_status_field_name(); |
|
148 | + $query_params[0][$post_status_field_name] = array('IN', array_keys($this->get_status_array())); |
|
149 | 149 | return $query_params; |
150 | 150 | } |
151 | 151 | |
@@ -157,11 +157,11 @@ discard block |
||
157 | 157 | * @param array $query_params like EEM_Base::get_all |
158 | 158 | * @return boolean success |
159 | 159 | */ |
160 | - function delete_or_restore($delete=true,$query_params = array()){ |
|
161 | - $post_status_field_name=$this->post_status_field_name(); |
|
160 | + function delete_or_restore($delete = true, $query_params = array()) { |
|
161 | + $post_status_field_name = $this->post_status_field_name(); |
|
162 | 162 | $query_params = $this->_alter_query_params_so_deleted_and_undeleted_items_included($query_params); |
163 | 163 | $new_status = $delete ? self::post_status_trashed : 'draft'; |
164 | - if ( $this->update (array($post_status_field_name=>$new_status), $query_params )) { |
|
164 | + if ($this->update(array($post_status_field_name=>$new_status), $query_params)) { |
|
165 | 165 | return TRUE; |
166 | 166 | } else { |
167 | 167 | return FALSE; |
@@ -178,7 +178,7 @@ discard block |
||
178 | 178 | */ |
179 | 179 | public function meta_table() { |
180 | 180 | $meta_table = $this->_get_other_tables(); |
181 | - $meta_table = reset( $meta_table ); |
|
181 | + $meta_table = reset($meta_table); |
|
182 | 182 | return $meta_table instanceof EE_Secondary_Table ? $meta_table->get_table_name() : NULL; |
183 | 183 | } |
184 | 184 | |
@@ -190,16 +190,16 @@ discard block |
||
190 | 190 | * @param bool $all triggers whether we include DB_Only fields or JUST non DB_Only fields. Defaults to false (no db only fields) |
191 | 191 | * @return array |
192 | 192 | */ |
193 | - public function get_meta_table_fields( $all = FALSE ) { |
|
193 | + public function get_meta_table_fields($all = FALSE) { |
|
194 | 194 | $all_fields = $fields_to_return = array(); |
195 | - foreach ( $this->_tables as $alias => $table_obj ) { |
|
196 | - if ( $table_obj instanceof EE_Secondary_Table ) |
|
197 | - $all_fields = array_merge( $this->_get_fields_for_table($alias), $all_fields ); |
|
195 | + foreach ($this->_tables as $alias => $table_obj) { |
|
196 | + if ($table_obj instanceof EE_Secondary_Table) |
|
197 | + $all_fields = array_merge($this->_get_fields_for_table($alias), $all_fields); |
|
198 | 198 | } |
199 | 199 | |
200 | - if ( !$all ) { |
|
201 | - foreach ( $all_fields as $name => $obj ) { |
|
202 | - if ( $obj instanceof EE_DB_Only_Field_Base ) |
|
200 | + if ( ! $all) { |
|
201 | + foreach ($all_fields as $name => $obj) { |
|
202 | + if ($obj instanceof EE_DB_Only_Field_Base) |
|
203 | 203 | continue; |
204 | 204 | $fields_to_return[] = $name; |
205 | 205 | } |
@@ -222,13 +222,13 @@ discard block |
||
222 | 222 | * @param int $parent_term_taxonomy_id |
223 | 223 | * @return EE_Term_Taxonomy |
224 | 224 | */ |
225 | - function add_event_category(EE_CPT_Base $cpt_model_object, $category_name, $category_description ='',$parent_term_taxonomy_id = null){ |
|
225 | + function add_event_category(EE_CPT_Base $cpt_model_object, $category_name, $category_description = '', $parent_term_taxonomy_id = null) { |
|
226 | 226 | //create term |
227 | - require_once( EE_MODELS . 'EEM_Term.model.php'); |
|
227 | + require_once(EE_MODELS.'EEM_Term.model.php'); |
|
228 | 228 | //first, check for a term by the same name or slug |
229 | 229 | $category_slug = sanitize_title($category_name); |
230 | - $term = EEM_Term::instance()->get_one(array(array('OR'=>array('name'=>$category_name,'slug'=>$category_slug)))); |
|
231 | - if( ! $term ){ |
|
230 | + $term = EEM_Term::instance()->get_one(array(array('OR'=>array('name'=>$category_name, 'slug'=>$category_slug)))); |
|
231 | + if ( ! $term) { |
|
232 | 232 | $term = EE_Term::new_instance(array( |
233 | 233 | 'name'=>$category_name, |
234 | 234 | 'slug'=>$category_slug |
@@ -236,10 +236,10 @@ discard block |
||
236 | 236 | $term->save(); |
237 | 237 | } |
238 | 238 | //make sure there's a term-taxonomy entry too |
239 | - require_once( EE_MODELS . 'EEM_Term_Taxonomy.model.php'); |
|
240 | - $term_taxonomy = EEM_Term_Taxonomy::instance()->get_one(array(array('term_id'=>$term->ID(),'taxonomy'=>EE_Event_Category_Taxonomy))); |
|
239 | + require_once(EE_MODELS.'EEM_Term_Taxonomy.model.php'); |
|
240 | + $term_taxonomy = EEM_Term_Taxonomy::instance()->get_one(array(array('term_id'=>$term->ID(), 'taxonomy'=>EE_Event_Category_Taxonomy))); |
|
241 | 241 | /** @var $term_taxonomy EE_Term_Taxonomy */ |
242 | - if( ! $term_taxonomy ){ |
|
242 | + if ( ! $term_taxonomy) { |
|
243 | 243 | $term_taxonomy = EE_Term_Taxonomy::new_instance(array( |
244 | 244 | 'term_id'=>$term->ID(), |
245 | 245 | 'taxonomy'=>EE_Event_Category_Taxonomy, |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | 'parent'=>$parent_term_taxonomy_id |
249 | 249 | )); |
250 | 250 | $term_taxonomy->save(); |
251 | - }else{ |
|
251 | + } else { |
|
252 | 252 | $term_taxonomy->set_count($term_taxonomy->count() + 1); |
253 | 253 | $term_taxonomy->save(); |
254 | 254 | } |
@@ -263,11 +263,11 @@ discard block |
||
263 | 263 | * @param string $category_name name of the event category (term) |
264 | 264 | * @return bool |
265 | 265 | */ |
266 | - function remove_event_category(EE_CPT_Base $cpt_model_object_event, $category_name){ |
|
266 | + function remove_event_category(EE_CPT_Base $cpt_model_object_event, $category_name) { |
|
267 | 267 | //find the term_taxonomy by that name |
268 | - $term_taxonomy = $this->get_first_related($cpt_model_object_event, 'Term_Taxonomy', array(array('Term.name'=>$category_name,'taxonomy'=>EE_Event_Category_Taxonomy))); |
|
268 | + $term_taxonomy = $this->get_first_related($cpt_model_object_event, 'Term_Taxonomy', array(array('Term.name'=>$category_name, 'taxonomy'=>EE_Event_Category_Taxonomy))); |
|
269 | 269 | /** @var $term_taxonomy EE_Term_Taxonomy */ |
270 | - if( $term_taxonomy ){ |
|
270 | + if ($term_taxonomy) { |
|
271 | 271 | $term_taxonomy->set_count($term_taxonomy->count() - 1); |
272 | 272 | $term_taxonomy->save(); |
273 | 273 | } |
@@ -287,8 +287,8 @@ discard block |
||
287 | 287 | * @param string|array $attr Optional. Query string or array of attributes. |
288 | 288 | * @return string HTML image element |
289 | 289 | */ |
290 | - public function get_feature_image( $id, $size = 'thumbnail', $attr = '' ) { |
|
291 | - return get_the_post_thumbnail( $id, $size, $attr ); |
|
290 | + public function get_feature_image($id, $size = 'thumbnail', $attr = '') { |
|
291 | + return get_the_post_thumbnail($id, $size, $attr); |
|
292 | 292 | } |
293 | 293 | |
294 | 294 | |
@@ -301,10 +301,10 @@ discard block |
||
301 | 301 | * @global array $wp_post_statuses set in wp core for storing all the post stati |
302 | 302 | * @return array |
303 | 303 | */ |
304 | - public function get_post_statuses(){ |
|
304 | + public function get_post_statuses() { |
|
305 | 305 | global $wp_post_statuses; |
306 | 306 | $statuses = array(); |
307 | - foreach($wp_post_statuses as $post_status => $args_object){ |
|
307 | + foreach ($wp_post_statuses as $post_status => $args_object) { |
|
308 | 308 | $statuses[$post_status] = $args_object->label; |
309 | 309 | } |
310 | 310 | return $statuses; |
@@ -319,9 +319,9 @@ discard block |
||
319 | 319 | public function get_status_array() { |
320 | 320 | $statuses = $this->get_post_statuses(); |
321 | 321 | //first the global filter |
322 | - $statuses = apply_filters( 'FHEE_EEM_CPT_Base__get_status_array', $statuses ); |
|
322 | + $statuses = apply_filters('FHEE_EEM_CPT_Base__get_status_array', $statuses); |
|
323 | 323 | //now the class specific filter |
324 | - $statuses = apply_filters( 'FHEE_EEM_' . get_class($this) . '__get_status_array', $statuses ); |
|
324 | + $statuses = apply_filters('FHEE_EEM_'.get_class($this).'__get_status_array', $statuses); |
|
325 | 325 | return $statuses; |
326 | 326 | } |
327 | 327 | |
@@ -333,7 +333,7 @@ discard block |
||
333 | 333 | */ |
334 | 334 | public function get_custom_post_statuses() { |
335 | 335 | $new_stati = array(); |
336 | - foreach ( $this->_custom_stati as $status => $props ) { |
|
336 | + foreach ($this->_custom_stati as $status => $props) { |
|
337 | 337 | $new_stati[$status] = $props['label']; |
338 | 338 | } |
339 | 339 | return $new_stati; |
@@ -349,24 +349,24 @@ discard block |
||
349 | 349 | * @param WP_Post|array $post |
350 | 350 | * @return EE_CPT_Base |
351 | 351 | */ |
352 | - public function instantiate_class_from_post_object_orig($post){ |
|
353 | - $post = (array)$post; |
|
352 | + public function instantiate_class_from_post_object_orig($post) { |
|
353 | + $post = (array) $post; |
|
354 | 354 | $has_all_necessary_fields_for_table = true; |
355 | 355 | //check if the post has fields on the meta table already |
356 | - foreach($this->_get_other_tables() as $table_obj){ |
|
356 | + foreach ($this->_get_other_tables() as $table_obj) { |
|
357 | 357 | $fields_for_that_table = $this->_get_fields_for_table($table_obj->get_table_alias()); |
358 | - foreach($fields_for_that_table as $field_obj){ |
|
359 | - if( ! isset($post[$field_obj->get_table_column()]) |
|
360 | - && ! isset($post[$field_obj->get_qualified_column()])){ |
|
358 | + foreach ($fields_for_that_table as $field_obj) { |
|
359 | + if ( ! isset($post[$field_obj->get_table_column()]) |
|
360 | + && ! isset($post[$field_obj->get_qualified_column()])) { |
|
361 | 361 | $has_all_necessary_fields_for_table = false; |
362 | 362 | } |
363 | 363 | } |
364 | 364 | } |
365 | 365 | //if we don't have all the fields we need, then just fetch the proper model from the DB |
366 | - if( ! $has_all_necessary_fields_for_table){ |
|
366 | + if ( ! $has_all_necessary_fields_for_table) { |
|
367 | 367 | |
368 | 368 | return $this->get_one_by_ID($post['ID']); |
369 | - }else{ |
|
369 | + } else { |
|
370 | 370 | return $this->instantiate_class_from_array_or_object($post); |
371 | 371 | } |
372 | 372 | } |
@@ -377,30 +377,30 @@ discard block |
||
377 | 377 | * @param null $post |
378 | 378 | * @return EE_Base_Class|EE_Soft_Delete_Base_Class |
379 | 379 | */ |
380 | - public function instantiate_class_from_post_object( $post = NULL ){ |
|
381 | - if ( empty( $post )) { |
|
380 | + public function instantiate_class_from_post_object($post = NULL) { |
|
381 | + if (empty($post)) { |
|
382 | 382 | global $post; |
383 | 383 | } |
384 | - $post = (array)$post; |
|
384 | + $post = (array) $post; |
|
385 | 385 | $tables_needing_to_be_queried = array(); |
386 | 386 | //check if the post has fields on the meta table already |
387 | - foreach($this->get_tables() as $table_obj){ |
|
387 | + foreach ($this->get_tables() as $table_obj) { |
|
388 | 388 | $fields_for_that_table = $this->_get_fields_for_table($table_obj->get_table_alias()); |
389 | - foreach($fields_for_that_table as $field_obj){ |
|
390 | - if( ! isset($post[$field_obj->get_table_column()]) |
|
391 | - && ! isset($post[$field_obj->get_qualified_column()])){ |
|
389 | + foreach ($fields_for_that_table as $field_obj) { |
|
390 | + if ( ! isset($post[$field_obj->get_table_column()]) |
|
391 | + && ! isset($post[$field_obj->get_qualified_column()])) { |
|
392 | 392 | $tables_needing_to_be_queried[$table_obj->get_table_alias()] = $table_obj; |
393 | 393 | } |
394 | 394 | } |
395 | 395 | } |
396 | 396 | //if we don't have all the fields we need, then just fetch the proper model from the DB |
397 | - if( $tables_needing_to_be_queried){ |
|
398 | - if(count($tables_needing_to_be_queried) == 1 && reset($tables_needing_to_be_queried) instanceof EE_Secondary_Table){ |
|
397 | + if ($tables_needing_to_be_queried) { |
|
398 | + if (count($tables_needing_to_be_queried) == 1 && reset($tables_needing_to_be_queried) instanceof EE_Secondary_Table) { |
|
399 | 399 | //so we're only missing data from a secondary table. Well that's not too hard to query for |
400 | 400 | $table_to_query = reset($tables_needing_to_be_queried); |
401 | - $missing_data = $this->_do_wpdb_query( 'get_row', array( 'SELECT * FROM ' . $table_to_query->get_table_name() . ' WHERE ' . $table_to_query->get_fk_on_table() . ' = ' . $post['ID'], ARRAY_A )); |
|
402 | - if ( ! empty( $missing_data )) { |
|
403 | - $post = array_merge( $post, $missing_data ); |
|
401 | + $missing_data = $this->_do_wpdb_query('get_row', array('SELECT * FROM '.$table_to_query->get_table_name().' WHERE '.$table_to_query->get_fk_on_table().' = '.$post['ID'], ARRAY_A)); |
|
402 | + if ( ! empty($missing_data)) { |
|
403 | + $post = array_merge($post, $missing_data); |
|
404 | 404 | } |
405 | 405 | } else { |
406 | 406 | return $this->get_one_by_ID($post['ID']); |
@@ -417,15 +417,15 @@ discard block |
||
417 | 417 | * @throws EE_Error |
418 | 418 | * @return string |
419 | 419 | */ |
420 | - public function post_type(){ |
|
420 | + public function post_type() { |
|
421 | 421 | $post_type_field = NULL; |
422 | - foreach($this->field_settings(true) as $field_obj){ |
|
423 | - if($field_obj instanceof EE_WP_Post_Type_Field){ |
|
424 | - $post_type_field = $field_obj;break; |
|
422 | + foreach ($this->field_settings(true) as $field_obj) { |
|
423 | + if ($field_obj instanceof EE_WP_Post_Type_Field) { |
|
424 | + $post_type_field = $field_obj; break; |
|
425 | 425 | } |
426 | 426 | } |
427 | - if($post_type_field == NULL){ |
|
428 | - throw new EE_Error(sprintf(__("CPT Model %s should have a field of type EE_WP_Post_Type, but doesnt", "event_espresso"),get_class($this))); |
|
427 | + if ($post_type_field == NULL) { |
|
428 | + throw new EE_Error(sprintf(__("CPT Model %s should have a field of type EE_WP_Post_Type, but doesnt", "event_espresso"), get_class($this))); |
|
429 | 429 | } |
430 | 430 | return $post_type_field->get_default_value(); |
431 | 431 | } |
@@ -118,7 +118,7 @@ discard block |
||
118 | 118 | $field = $this->get_a_field_of_type('EE_WP_Post_Status_Field'); |
119 | 119 | if($field){ |
120 | 120 | return $field->get_name(); |
121 | - }else{ |
|
121 | + } else{ |
|
122 | 122 | throw new EE_Error(sprintf(__('We are trying to find the post status flag field on %s, but none was found. Are you sure there is a field of type EE_Trashed_Flag_Field in %s constructor?','event_espresso'),get_class($this),get_class($this))); |
123 | 123 | } |
124 | 124 | } |
@@ -193,14 +193,16 @@ discard block |
||
193 | 193 | public function get_meta_table_fields( $all = FALSE ) { |
194 | 194 | $all_fields = $fields_to_return = array(); |
195 | 195 | foreach ( $this->_tables as $alias => $table_obj ) { |
196 | - if ( $table_obj instanceof EE_Secondary_Table ) |
|
197 | - $all_fields = array_merge( $this->_get_fields_for_table($alias), $all_fields ); |
|
196 | + if ( $table_obj instanceof EE_Secondary_Table ) { |
|
197 | + $all_fields = array_merge( $this->_get_fields_for_table($alias), $all_fields ); |
|
198 | + } |
|
198 | 199 | } |
199 | 200 | |
200 | 201 | if ( !$all ) { |
201 | 202 | foreach ( $all_fields as $name => $obj ) { |
202 | - if ( $obj instanceof EE_DB_Only_Field_Base ) |
|
203 | - continue; |
|
203 | + if ( $obj instanceof EE_DB_Only_Field_Base ) { |
|
204 | + continue; |
|
205 | + } |
|
204 | 206 | $fields_to_return[] = $name; |
205 | 207 | } |
206 | 208 | } else { |
@@ -248,7 +250,7 @@ discard block |
||
248 | 250 | 'parent'=>$parent_term_taxonomy_id |
249 | 251 | )); |
250 | 252 | $term_taxonomy->save(); |
251 | - }else{ |
|
253 | + } else{ |
|
252 | 254 | $term_taxonomy->set_count($term_taxonomy->count() + 1); |
253 | 255 | $term_taxonomy->save(); |
254 | 256 | } |
@@ -366,7 +368,7 @@ discard block |
||
366 | 368 | if( ! $has_all_necessary_fields_for_table){ |
367 | 369 | |
368 | 370 | return $this->get_one_by_ID($post['ID']); |
369 | - }else{ |
|
371 | + } else{ |
|
370 | 372 | return $this->instantiate_class_from_array_or_object($post); |
371 | 373 | } |
372 | 374 | } |