@@ -15,25 +15,25 @@ |
||
15 | 15 | class InstantiationException extends BadMethodCallException |
16 | 16 | { |
17 | 17 | |
18 | - /** |
|
19 | - * InstantiationException constructor. |
|
20 | - * |
|
21 | - * @param string $identifier the name of the requested entity or service |
|
22 | - * @param string $message |
|
23 | - * @param int $code |
|
24 | - * @param \Exception $previous |
|
25 | - */ |
|
26 | - public function __construct($identifier, $message = '', $code = 0, \Exception $previous = null) |
|
27 | - { |
|
28 | - if (empty($message)) { |
|
29 | - $message = sprintf( |
|
30 | - esc_html__( |
|
31 | - 'The "%1$s" class could not be constructed.', |
|
32 | - 'event_espresso' |
|
33 | - ), |
|
34 | - $identifier |
|
35 | - ); |
|
36 | - } |
|
37 | - parent::__construct($message, $code, $previous); |
|
38 | - } |
|
18 | + /** |
|
19 | + * InstantiationException constructor. |
|
20 | + * |
|
21 | + * @param string $identifier the name of the requested entity or service |
|
22 | + * @param string $message |
|
23 | + * @param int $code |
|
24 | + * @param \Exception $previous |
|
25 | + */ |
|
26 | + public function __construct($identifier, $message = '', $code = 0, \Exception $previous = null) |
|
27 | + { |
|
28 | + if (empty($message)) { |
|
29 | + $message = sprintf( |
|
30 | + esc_html__( |
|
31 | + 'The "%1$s" class could not be constructed.', |
|
32 | + 'event_espresso' |
|
33 | + ), |
|
34 | + $identifier |
|
35 | + ); |
|
36 | + } |
|
37 | + parent::__construct($message, $code, $previous); |
|
38 | + } |
|
39 | 39 | } |
@@ -14,26 +14,26 @@ |
||
14 | 14 | { |
15 | 15 | |
16 | 16 | |
17 | - /** |
|
18 | - * ServiceExistsException constructor |
|
19 | - * |
|
20 | - * @param string $service_name the name of the requested service |
|
21 | - * @param string $message |
|
22 | - * @param int $code |
|
23 | - * @param \Exception $previous |
|
24 | - */ |
|
25 | - public function __construct( |
|
26 | - $service_name, |
|
27 | - $message = '', |
|
28 | - $code = 0, |
|
29 | - \Exception $previous = null |
|
30 | - ) { |
|
31 | - if (empty($message)) { |
|
32 | - $message = sprintf( |
|
33 | - esc_html__('The "%1$s" service already exists in the CoffeeShop and can not be added again.', 'event_espresso'), |
|
34 | - $service_name |
|
35 | - ); |
|
36 | - } |
|
37 | - parent::__construct($message, $code, $previous); |
|
38 | - } |
|
17 | + /** |
|
18 | + * ServiceExistsException constructor |
|
19 | + * |
|
20 | + * @param string $service_name the name of the requested service |
|
21 | + * @param string $message |
|
22 | + * @param int $code |
|
23 | + * @param \Exception $previous |
|
24 | + */ |
|
25 | + public function __construct( |
|
26 | + $service_name, |
|
27 | + $message = '', |
|
28 | + $code = 0, |
|
29 | + \Exception $previous = null |
|
30 | + ) { |
|
31 | + if (empty($message)) { |
|
32 | + $message = sprintf( |
|
33 | + esc_html__('The "%1$s" service already exists in the CoffeeShop and can not be added again.', 'event_espresso'), |
|
34 | + $service_name |
|
35 | + ); |
|
36 | + } |
|
37 | + parent::__construct($message, $code, $previous); |
|
38 | + } |
|
39 | 39 | } |
@@ -12,26 +12,26 @@ |
||
12 | 12 | class ServiceNotFoundException extends \RuntimeException |
13 | 13 | { |
14 | 14 | |
15 | - /** |
|
16 | - * ServiceNotFoundException constructor |
|
17 | - * |
|
18 | - * @param string $service_name the name of the requested service |
|
19 | - * @param string $message |
|
20 | - * @param int $code |
|
21 | - * @param \Exception $previous |
|
22 | - */ |
|
23 | - public function __construct( |
|
24 | - $service_name, |
|
25 | - $message = '', |
|
26 | - $code = 0, |
|
27 | - \Exception $previous = null |
|
28 | - ) { |
|
29 | - if (empty($message)) { |
|
30 | - $message = sprintf( |
|
31 | - esc_html__('The requested service "%1$s" could not found be found in the CoffeeShop.', 'event_espresso'), |
|
32 | - $service_name |
|
33 | - ); |
|
34 | - } |
|
35 | - parent::__construct($message, $code, $previous); |
|
36 | - } |
|
15 | + /** |
|
16 | + * ServiceNotFoundException constructor |
|
17 | + * |
|
18 | + * @param string $service_name the name of the requested service |
|
19 | + * @param string $message |
|
20 | + * @param int $code |
|
21 | + * @param \Exception $previous |
|
22 | + */ |
|
23 | + public function __construct( |
|
24 | + $service_name, |
|
25 | + $message = '', |
|
26 | + $code = 0, |
|
27 | + \Exception $previous = null |
|
28 | + ) { |
|
29 | + if (empty($message)) { |
|
30 | + $message = sprintf( |
|
31 | + esc_html__('The requested service "%1$s" could not found be found in the CoffeeShop.', 'event_espresso'), |
|
32 | + $service_name |
|
33 | + ); |
|
34 | + } |
|
35 | + parent::__construct($message, $code, $previous); |
|
36 | + } |
|
37 | 37 | } |
@@ -13,27 +13,27 @@ |
||
13 | 13 | class InvalidServiceException extends \UnexpectedValueException |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * InvalidServiceException constructor. |
|
18 | - * |
|
19 | - * @param string $service_name the name of the requested service |
|
20 | - * @param string $actual classname of what we got |
|
21 | - * @param string $message |
|
22 | - * @param int $code |
|
23 | - * @param \Exception $previous |
|
24 | - */ |
|
25 | - public function __construct($service_name, $actual, $message = '', $code = 0, \Exception $previous = null) |
|
26 | - { |
|
27 | - if (empty($message)) { |
|
28 | - $message = sprintf( |
|
29 | - esc_html__( |
|
30 | - 'The "%1$s" service could not be retrieved from the CoffeeShop, but "%2$s" was received.', |
|
31 | - 'event_espresso' |
|
32 | - ), |
|
33 | - $service_name, |
|
34 | - print_r($actual, true) |
|
35 | - ); |
|
36 | - } |
|
37 | - parent::__construct($message, $code, $previous); |
|
38 | - } |
|
16 | + /** |
|
17 | + * InvalidServiceException constructor. |
|
18 | + * |
|
19 | + * @param string $service_name the name of the requested service |
|
20 | + * @param string $actual classname of what we got |
|
21 | + * @param string $message |
|
22 | + * @param int $code |
|
23 | + * @param \Exception $previous |
|
24 | + */ |
|
25 | + public function __construct($service_name, $actual, $message = '', $code = 0, \Exception $previous = null) |
|
26 | + { |
|
27 | + if (empty($message)) { |
|
28 | + $message = sprintf( |
|
29 | + esc_html__( |
|
30 | + 'The "%1$s" service could not be retrieved from the CoffeeShop, but "%2$s" was received.', |
|
31 | + 'event_espresso' |
|
32 | + ), |
|
33 | + $service_name, |
|
34 | + print_r($actual, true) |
|
35 | + ); |
|
36 | + } |
|
37 | + parent::__construct($message, $code, $previous); |
|
38 | + } |
|
39 | 39 | } |
@@ -14,115 +14,115 @@ |
||
14 | 14 | class GatewayDataFormatter implements GatewayDataFormatterInterface |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * Gets the text to use for a gateway's line item name when this is a partial payment |
|
19 | - * |
|
20 | - * @param \EEI_Payment $payment |
|
21 | - * @return string |
|
22 | - */ |
|
23 | - public function formatPartialPaymentLineItemName(\EEI_Payment $payment) |
|
24 | - { |
|
25 | - return apply_filters( |
|
26 | - 'EEG_Paypal_Pro__do_direct_payment__partial_amount_line_item_name', |
|
27 | - $payment->get_first_event_name(), |
|
28 | - $this, |
|
29 | - $payment |
|
30 | - ); |
|
31 | - } |
|
17 | + /** |
|
18 | + * Gets the text to use for a gateway's line item name when this is a partial payment |
|
19 | + * |
|
20 | + * @param \EEI_Payment $payment |
|
21 | + * @return string |
|
22 | + */ |
|
23 | + public function formatPartialPaymentLineItemName(\EEI_Payment $payment) |
|
24 | + { |
|
25 | + return apply_filters( |
|
26 | + 'EEG_Paypal_Pro__do_direct_payment__partial_amount_line_item_name', |
|
27 | + $payment->get_first_event_name(), |
|
28 | + $this, |
|
29 | + $payment |
|
30 | + ); |
|
31 | + } |
|
32 | 32 | |
33 | 33 | |
34 | - /** |
|
35 | - * Gets the text to use for a gateway's line item description when this is a partial payment |
|
36 | - * |
|
37 | - * @param \EEI_Payment $payment |
|
38 | - * @return string |
|
39 | - */ |
|
40 | - public function formatPartialPaymentLineItemDesc(\EEI_Payment $payment) |
|
41 | - { |
|
42 | - return apply_filters( |
|
43 | - 'FHEE__EE_Gateway___partial_payment_desc', |
|
44 | - sprintf( |
|
45 | - esc_html__('Payment of %1$s for %2$s', "event_espresso"), |
|
46 | - $payment->get_pretty('PAY_amount', 'no_currency_code'), |
|
47 | - $payment->get_first_event_name() |
|
48 | - ), |
|
49 | - $this, |
|
50 | - $payment |
|
51 | - ); |
|
52 | - } |
|
34 | + /** |
|
35 | + * Gets the text to use for a gateway's line item description when this is a partial payment |
|
36 | + * |
|
37 | + * @param \EEI_Payment $payment |
|
38 | + * @return string |
|
39 | + */ |
|
40 | + public function formatPartialPaymentLineItemDesc(\EEI_Payment $payment) |
|
41 | + { |
|
42 | + return apply_filters( |
|
43 | + 'FHEE__EE_Gateway___partial_payment_desc', |
|
44 | + sprintf( |
|
45 | + esc_html__('Payment of %1$s for %2$s', "event_espresso"), |
|
46 | + $payment->get_pretty('PAY_amount', 'no_currency_code'), |
|
47 | + $payment->get_first_event_name() |
|
48 | + ), |
|
49 | + $this, |
|
50 | + $payment |
|
51 | + ); |
|
52 | + } |
|
53 | 53 | |
54 | 54 | |
55 | - /** |
|
56 | - * Gets the name to use for a line item when sending line items to the gateway |
|
57 | - * |
|
58 | - * @param \EEI_Line_Item $line_item |
|
59 | - * @param \EEI_Payment $payment |
|
60 | - * @return string |
|
61 | - */ |
|
62 | - public function formatLineItemName(\EEI_Line_Item $line_item, \EEI_Payment $payment) |
|
63 | - { |
|
64 | - return apply_filters( |
|
65 | - 'FHEE__EE_gateway___line_item_name', |
|
66 | - sprintf( |
|
67 | - _x('%1$s for %2$s', 'Ticket for Event', 'event_espresso'), |
|
68 | - $line_item->name(), |
|
69 | - $line_item->ticket_event_name() |
|
70 | - ), |
|
71 | - $this, |
|
72 | - $line_item, |
|
73 | - $payment |
|
74 | - ); |
|
75 | - } |
|
55 | + /** |
|
56 | + * Gets the name to use for a line item when sending line items to the gateway |
|
57 | + * |
|
58 | + * @param \EEI_Line_Item $line_item |
|
59 | + * @param \EEI_Payment $payment |
|
60 | + * @return string |
|
61 | + */ |
|
62 | + public function formatLineItemName(\EEI_Line_Item $line_item, \EEI_Payment $payment) |
|
63 | + { |
|
64 | + return apply_filters( |
|
65 | + 'FHEE__EE_gateway___line_item_name', |
|
66 | + sprintf( |
|
67 | + _x('%1$s for %2$s', 'Ticket for Event', 'event_espresso'), |
|
68 | + $line_item->name(), |
|
69 | + $line_item->ticket_event_name() |
|
70 | + ), |
|
71 | + $this, |
|
72 | + $line_item, |
|
73 | + $payment |
|
74 | + ); |
|
75 | + } |
|
76 | 76 | |
77 | 77 | |
78 | - /** |
|
79 | - * Gets the description to use for a line item when sending line items to the gateway |
|
80 | - * |
|
81 | - * @param \EEI_Line_Item $line_item |
|
82 | - * @param \EEI_Payment $payment |
|
83 | - * @return string |
|
84 | - */ |
|
85 | - public function formatLineItemDesc(\EEI_Line_Item $line_item, \EEI_Payment $payment) |
|
86 | - { |
|
87 | - return apply_filters( |
|
88 | - 'FHEE__EE_Gateway___line_item_desc', |
|
89 | - $line_item->desc(), |
|
90 | - $this, |
|
91 | - $line_item, |
|
92 | - $payment |
|
93 | - ); |
|
94 | - } |
|
78 | + /** |
|
79 | + * Gets the description to use for a line item when sending line items to the gateway |
|
80 | + * |
|
81 | + * @param \EEI_Line_Item $line_item |
|
82 | + * @param \EEI_Payment $payment |
|
83 | + * @return string |
|
84 | + */ |
|
85 | + public function formatLineItemDesc(\EEI_Line_Item $line_item, \EEI_Payment $payment) |
|
86 | + { |
|
87 | + return apply_filters( |
|
88 | + 'FHEE__EE_Gateway___line_item_desc', |
|
89 | + $line_item->desc(), |
|
90 | + $this, |
|
91 | + $line_item, |
|
92 | + $payment |
|
93 | + ); |
|
94 | + } |
|
95 | 95 | |
96 | 96 | |
97 | - /** |
|
98 | - * Gets the order description that should generally be sent to gateways |
|
99 | - * |
|
100 | - * @param \EEI_Payment $payment |
|
101 | - * @return string |
|
102 | - */ |
|
103 | - public function formatOrderDescription(\EEI_Payment $payment) |
|
104 | - { |
|
105 | - return apply_filters( |
|
106 | - 'FHEE__EE_Gateway___order_description', |
|
107 | - sprintf( |
|
108 | - esc_html__('Event Registrations from %1$s for %2$s', "event_espresso"), |
|
109 | - wp_specialchars_decode(get_bloginfo(), ENT_QUOTES), |
|
110 | - $payment->get_first_event_name() |
|
111 | - ), |
|
112 | - $this, |
|
113 | - $payment |
|
114 | - ); |
|
115 | - } |
|
97 | + /** |
|
98 | + * Gets the order description that should generally be sent to gateways |
|
99 | + * |
|
100 | + * @param \EEI_Payment $payment |
|
101 | + * @return string |
|
102 | + */ |
|
103 | + public function formatOrderDescription(\EEI_Payment $payment) |
|
104 | + { |
|
105 | + return apply_filters( |
|
106 | + 'FHEE__EE_Gateway___order_description', |
|
107 | + sprintf( |
|
108 | + esc_html__('Event Registrations from %1$s for %2$s', "event_espresso"), |
|
109 | + wp_specialchars_decode(get_bloginfo(), ENT_QUOTES), |
|
110 | + $payment->get_first_event_name() |
|
111 | + ), |
|
112 | + $this, |
|
113 | + $payment |
|
114 | + ); |
|
115 | + } |
|
116 | 116 | |
117 | 117 | |
118 | - /** |
|
119 | - * Formats the amount so it can generally be sent to gateways |
|
120 | - * |
|
121 | - * @param float $amount |
|
122 | - * @return string |
|
123 | - */ |
|
124 | - public function formatCurrency($amount) |
|
125 | - { |
|
126 | - return number_format($amount, 2, '.', ''); |
|
127 | - } |
|
118 | + /** |
|
119 | + * Formats the amount so it can generally be sent to gateways |
|
120 | + * |
|
121 | + * @param float $amount |
|
122 | + * @return string |
|
123 | + */ |
|
124 | + public function formatCurrency($amount) |
|
125 | + { |
|
126 | + return number_format($amount, 2, '.', ''); |
|
127 | + } |
|
128 | 128 | } |
@@ -51,547 +51,547 @@ |
||
51 | 51 | class ModelFieldFactory |
52 | 52 | { |
53 | 53 | |
54 | - /** |
|
55 | - * @var LoaderInterface $loader |
|
56 | - */ |
|
57 | - private $loader; |
|
58 | - |
|
59 | - |
|
60 | - /** |
|
61 | - * ModelFieldFactory constructor. |
|
62 | - * |
|
63 | - * @param LoaderInterface $loader |
|
64 | - */ |
|
65 | - public function __construct(LoaderInterface $loader) |
|
66 | - { |
|
67 | - $this->loader = $loader; |
|
68 | - } |
|
69 | - |
|
70 | - |
|
71 | - /** |
|
72 | - * @param string $table_column |
|
73 | - * @param string $nice_name |
|
74 | - * @param bool $nullable |
|
75 | - * @param null $default_value |
|
76 | - * @return EE_All_Caps_Text_Field |
|
77 | - */ |
|
78 | - public function createAllCapsTextField($table_column, $nice_name, $nullable, $default_value = null) |
|
79 | - { |
|
80 | - return $this->loader->getNew( |
|
81 | - 'EE_All_Caps_Text_Field', |
|
82 | - array($table_column, $nice_name, $nullable, $default_value) |
|
83 | - ); |
|
84 | - } |
|
85 | - |
|
86 | - |
|
87 | - /** |
|
88 | - * @param string $table_column |
|
89 | - * @param string $nice_name |
|
90 | - * @param bool $nullable |
|
91 | - * @param null $default_value |
|
92 | - * @param string $model_name |
|
93 | - * @return EE_Any_Foreign_Model_Name_Field |
|
94 | - */ |
|
95 | - public function createAnyForeignModelNameField( |
|
96 | - $table_column, |
|
97 | - $nice_name, |
|
98 | - $nullable, |
|
99 | - $default_value = null, |
|
100 | - $model_name |
|
101 | - ) { |
|
102 | - return $this->loader->getNew( |
|
103 | - 'EE_Any_Foreign_Model_Name_Field', |
|
104 | - array($table_column, $nice_name, $nullable, $default_value, $model_name) |
|
105 | - ); |
|
106 | - } |
|
107 | - |
|
108 | - |
|
109 | - /** |
|
110 | - * @param string $table_column |
|
111 | - * @param string $nice_name |
|
112 | - * @param bool $nullable |
|
113 | - * @param null $default_value |
|
114 | - * @return EE_Boolean_Field |
|
115 | - */ |
|
116 | - public function createBooleanField($table_column, $nice_name, $nullable, $default_value = null) |
|
117 | - { |
|
118 | - return $this->loader->getNew( |
|
119 | - 'EE_Boolean_Field', |
|
120 | - array($table_column, $nice_name, $nullable, $default_value) |
|
121 | - ); |
|
122 | - } |
|
123 | - |
|
124 | - |
|
125 | - /** |
|
126 | - * @param string $table_column |
|
127 | - * @param string $nice_name |
|
128 | - * @param string $timezone_string |
|
129 | - * @param bool $nullable |
|
130 | - * @param string $default_value |
|
131 | - * @throws EE_Error |
|
132 | - * @throws InvalidArgumentException |
|
133 | - * @return EE_Datetime_Field |
|
134 | - */ |
|
135 | - public function createDatetimeField( |
|
136 | - $table_column, |
|
137 | - $nice_name, |
|
138 | - $nullable = false, |
|
139 | - $default_value = EE_Datetime_Field::now |
|
140 | - ) { |
|
141 | - return $this->loader->getNew( |
|
142 | - 'EE_Datetime_Field', |
|
143 | - array( |
|
144 | - $table_column, |
|
145 | - $nice_name, |
|
146 | - $nullable, |
|
147 | - $default_value, |
|
148 | - ) |
|
149 | - ); |
|
150 | - } |
|
151 | - |
|
152 | - |
|
153 | - /** |
|
154 | - * @param string $table_column |
|
155 | - * @param string $nice_name |
|
156 | - * @param bool $nullable |
|
157 | - * @param null $default_value |
|
158 | - * @return EE_DB_Only_Float_Field |
|
159 | - */ |
|
160 | - public function createDbOnlyFloatField($table_column, $nice_name, $nullable, $default_value = null) |
|
161 | - { |
|
162 | - return $this->loader->getNew( |
|
163 | - 'EE_DB_Only_Float_Field', |
|
164 | - array($table_column, $nice_name, $nullable, $default_value) |
|
165 | - ); |
|
166 | - } |
|
167 | - |
|
168 | - |
|
169 | - /** |
|
170 | - * @param string $table_column |
|
171 | - * @param string $nice_name |
|
172 | - * @param bool $nullable |
|
173 | - * @param null $default_value |
|
174 | - * @return EE_DB_Only_Int_Field |
|
175 | - */ |
|
176 | - public function createDbOnlyIntField($table_column, $nice_name, $nullable, $default_value = null) |
|
177 | - { |
|
178 | - return $this->loader->getNew( |
|
179 | - 'EE_DB_Only_Int_Field', |
|
180 | - array($table_column, $nice_name, $nullable, $default_value) |
|
181 | - ); |
|
182 | - } |
|
183 | - |
|
184 | - |
|
185 | - /** |
|
186 | - * @param string $table_column |
|
187 | - * @param string $nice_name |
|
188 | - * @param bool $nullable |
|
189 | - * @param null $default_value |
|
190 | - * @return EE_DB_Only_Text_Field |
|
191 | - */ |
|
192 | - public function createDbOnlyTextField($table_column, $nice_name, $nullable, $default_value = null) |
|
193 | - { |
|
194 | - return $this->loader->getNew( |
|
195 | - 'EE_DB_Only_Text_Field', |
|
196 | - array($table_column, $nice_name, $nullable, $default_value) |
|
197 | - ); |
|
198 | - } |
|
199 | - |
|
200 | - |
|
201 | - /** |
|
202 | - * @param string $table_column |
|
203 | - * @param string $nice_name |
|
204 | - * @param bool $nullable |
|
205 | - * @param string $default_value |
|
206 | - * @return EE_Email_Field |
|
207 | - */ |
|
208 | - public function createEmailField($table_column, $nice_name, $nullable = true, $default_value = '') |
|
209 | - { |
|
210 | - return $this->loader->getNew( |
|
211 | - 'EE_Email_Field', |
|
212 | - array($table_column, $nice_name, $nullable, $default_value) |
|
213 | - ); |
|
214 | - } |
|
215 | - |
|
216 | - |
|
217 | - /** |
|
218 | - * @param string $table_column |
|
219 | - * @param string $nice_name |
|
220 | - * @param bool $nullable |
|
221 | - * @param null $default_value |
|
222 | - * @param array $allowed_enum_values keys are values to be used in the DB, |
|
223 | - * values are how they should be displayed |
|
224 | - * @return EE_Enum_Integer_Field |
|
225 | - */ |
|
226 | - public function createEnumIntegerField( |
|
227 | - $table_column, |
|
228 | - $nice_name, |
|
229 | - $nullable, |
|
230 | - $default_value = null, |
|
231 | - array $allowed_enum_values |
|
232 | - ) { |
|
233 | - return $this->loader->getNew( |
|
234 | - 'EE_Enum_Integer_Field', |
|
235 | - array($table_column, $nice_name, $nullable, $default_value, $allowed_enum_values) |
|
236 | - ); |
|
237 | - } |
|
238 | - |
|
239 | - |
|
240 | - /** |
|
241 | - * @param string $table_column |
|
242 | - * @param string $nice_name |
|
243 | - * @param bool $nullable |
|
244 | - * @param null $default_value |
|
245 | - * @param array $allowed_enum_values keys are values to be used in the DB, |
|
246 | - * values are how they should be displayed |
|
247 | - * @return EE_Enum_Text_Field |
|
248 | - */ |
|
249 | - public function createEnumTextField( |
|
250 | - $table_column, |
|
251 | - $nice_name, |
|
252 | - $nullable, |
|
253 | - $default_value, |
|
254 | - array $allowed_enum_values |
|
255 | - ) { |
|
256 | - return $this->loader->getNew( |
|
257 | - 'EE_Enum_Text_Field', |
|
258 | - array($table_column, $nice_name, $nullable, $default_value, $allowed_enum_values) |
|
259 | - ); |
|
260 | - } |
|
261 | - |
|
262 | - |
|
263 | - /** |
|
264 | - * @param string $table_column |
|
265 | - * @param string $nice_name |
|
266 | - * @param bool $nullable |
|
267 | - * @param null $default_value |
|
268 | - * @return EE_Float_Field |
|
269 | - */ |
|
270 | - public function createFloatField($table_column, $nice_name, $nullable, $default_value = null) |
|
271 | - { |
|
272 | - return $this->loader->getNew( |
|
273 | - 'EE_Float_Field', |
|
274 | - array($table_column, $nice_name, $nullable, $default_value) |
|
275 | - ); |
|
276 | - } |
|
277 | - |
|
278 | - |
|
279 | - /** |
|
280 | - * @param string $table_column |
|
281 | - * @param string $nice_name |
|
282 | - * @param bool $nullable |
|
283 | - * @param null $default_value |
|
284 | - * @param string $model_name |
|
285 | - * @return EE_Foreign_Key_Int_Field |
|
286 | - */ |
|
287 | - public function createForeignKeyIntField($table_column, $nice_name, $nullable, $default_value, $model_name) |
|
288 | - { |
|
289 | - return $this->loader->getNew( |
|
290 | - 'EE_Foreign_Key_Int_Field', |
|
291 | - array($table_column, $nice_name, $nullable, $default_value, $model_name) |
|
292 | - ); |
|
293 | - } |
|
294 | - |
|
295 | - |
|
296 | - /** |
|
297 | - * @param string $table_column |
|
298 | - * @param string $nice_name |
|
299 | - * @param bool $nullable |
|
300 | - * @param null $default_value |
|
301 | - * @param string $model_name |
|
302 | - * @return EE_Foreign_Key_String_Field |
|
303 | - */ |
|
304 | - public function createForeignKeyStringField( |
|
305 | - $table_column, |
|
306 | - $nice_name, |
|
307 | - $nullable, |
|
308 | - $default_value, |
|
309 | - $model_name |
|
310 | - ) { |
|
311 | - return $this->loader->getNew( |
|
312 | - 'EE_Foreign_Key_String_Field', |
|
313 | - array($table_column, $nice_name, $nullable, $default_value, $model_name) |
|
314 | - ); |
|
315 | - } |
|
316 | - |
|
317 | - |
|
318 | - /** |
|
319 | - * @param string $table_column |
|
320 | - * @param string $nice_name |
|
321 | - * @param bool $nullable |
|
322 | - * @param null $default_value |
|
323 | - * @return EE_Full_HTML_Field |
|
324 | - */ |
|
325 | - public function createFullHtmlField($table_column, $nice_name, $nullable, $default_value = null) |
|
326 | - { |
|
327 | - return $this->loader->getNew( |
|
328 | - 'EE_Full_HTML_Field', |
|
329 | - array($table_column, $nice_name, $nullable, $default_value) |
|
330 | - ); |
|
331 | - } |
|
332 | - |
|
333 | - |
|
334 | - /** |
|
335 | - * @param string $table_column |
|
336 | - * @param string $nice_name |
|
337 | - * @param bool $nullable |
|
338 | - * @param null $default_value |
|
339 | - * @return EE_Infinite_Integer_Field |
|
340 | - */ |
|
341 | - public function createInfiniteIntegerField($table_column, $nice_name, $nullable, $default_value = null) |
|
342 | - { |
|
343 | - return $this->loader->getNew( |
|
344 | - 'EE_Infinite_Integer_Field', |
|
345 | - array($table_column, $nice_name, $nullable, $default_value) |
|
346 | - ); |
|
347 | - } |
|
348 | - |
|
349 | - |
|
350 | - /** |
|
351 | - * @param string $table_column |
|
352 | - * @param string $nice_name |
|
353 | - * @param bool $nullable |
|
354 | - * @param integer $default_value |
|
355 | - * @return EE_Integer_Field |
|
356 | - */ |
|
357 | - public function createIntegerField($table_column, $nice_name, $nullable = false, $default_value = 0) |
|
358 | - { |
|
359 | - return $this->loader->getNew( |
|
360 | - 'EE_Integer_Field', |
|
361 | - array($table_column, $nice_name, $nullable, $default_value) |
|
362 | - ); |
|
363 | - } |
|
364 | - |
|
365 | - |
|
366 | - /** |
|
367 | - * @param string $table_column |
|
368 | - * @param string $nice_name |
|
369 | - * @param bool $nullable |
|
370 | - * @param null $default_value |
|
371 | - * @return EE_Maybe_Serialized_Simple_HTML_Field |
|
372 | - */ |
|
373 | - public function createMaybeSerializedSimpleHtmlField($table_column, $nice_name, $nullable, $default_value = null) |
|
374 | - { |
|
375 | - return $this->loader->getNew( |
|
376 | - 'EE_Maybe_Serialized_Simple_HTML_Field', |
|
377 | - array($table_column, $nice_name, $nullable, $default_value) |
|
378 | - ); |
|
379 | - } |
|
380 | - |
|
381 | - |
|
382 | - /** |
|
383 | - * @param string $table_column |
|
384 | - * @param string $nice_name |
|
385 | - * @param bool $nullable |
|
386 | - * @param null $default_value |
|
387 | - * @return EE_Maybe_Serialized_Text_Field |
|
388 | - */ |
|
389 | - public function createMaybeSerializedTextField($table_column, $nice_name, $nullable, $default_value = null) |
|
390 | - { |
|
391 | - return $this->loader->getNew( |
|
392 | - 'EE_Maybe_Serialized_Text_Field', |
|
393 | - array($table_column, $nice_name, $nullable, $default_value) |
|
394 | - ); |
|
395 | - } |
|
396 | - |
|
397 | - |
|
398 | - /** |
|
399 | - * @param string $table_column |
|
400 | - * @param string $nice_name |
|
401 | - * @param bool $nullable |
|
402 | - * @param null $default_value |
|
403 | - * @return EE_Money_Field |
|
404 | - */ |
|
405 | - public function createMoneyField($table_column, $nice_name, $nullable, $default_value = null) |
|
406 | - { |
|
407 | - return $this->loader->getNew( |
|
408 | - 'EE_Money_Field', |
|
409 | - array($table_column, $nice_name, $nullable, $default_value) |
|
410 | - ); |
|
411 | - } |
|
412 | - |
|
413 | - |
|
414 | - /** |
|
415 | - * @param string $table_column |
|
416 | - * @param string $nice_name |
|
417 | - * @param bool $nullable |
|
418 | - * @param string $default_value |
|
419 | - * @return EE_Plain_Text_Field |
|
420 | - */ |
|
421 | - public function createPlainTextField($table_column, $nice_name, $nullable = true, $default_value = '') |
|
422 | - { |
|
423 | - return $this->loader->getNew( |
|
424 | - 'EE_Plain_Text_Field', |
|
425 | - array($table_column, $nice_name, $nullable, $default_value) |
|
426 | - ); |
|
427 | - } |
|
428 | - |
|
429 | - |
|
430 | - /** |
|
431 | - * @param string $table_column |
|
432 | - * @param string $nice_name |
|
433 | - * @param bool $nullable |
|
434 | - * @param null $default_value |
|
435 | - * @return EE_Post_Content_Field |
|
436 | - */ |
|
437 | - public function createPostContentField($table_column, $nice_name, $nullable, $default_value = null) |
|
438 | - { |
|
439 | - return $this->loader->getNew( |
|
440 | - 'EE_Post_Content_Field', |
|
441 | - array($table_column, $nice_name, $nullable, $default_value) |
|
442 | - ); |
|
443 | - } |
|
444 | - |
|
445 | - |
|
446 | - /** |
|
447 | - * @param string $table_column |
|
448 | - * @param string $nice_name |
|
449 | - * @return EE_Primary_Key_Int_Field |
|
450 | - */ |
|
451 | - public function createPrimaryKeyIntField($table_column, $nice_name) |
|
452 | - { |
|
453 | - return $this->loader->getNew('EE_Primary_Key_Int_Field', array($table_column, $nice_name)); |
|
454 | - } |
|
455 | - |
|
456 | - |
|
457 | - /** |
|
458 | - * @param string $table_column |
|
459 | - * @param string $nice_name |
|
460 | - * @return EE_Primary_Key_String_Field |
|
461 | - */ |
|
462 | - public function createPrimaryKeyStringField($table_column, $nice_name) |
|
463 | - { |
|
464 | - return $this->loader->getNew('EE_Primary_Key_String_Field', array($table_column, $nice_name)); |
|
465 | - } |
|
466 | - |
|
467 | - |
|
468 | - /** |
|
469 | - * @param string $table_column |
|
470 | - * @param string $nice_name |
|
471 | - * @param bool $nullable |
|
472 | - * @param null $default_value |
|
473 | - * @return EE_Serialized_Text_Field |
|
474 | - */ |
|
475 | - public function createSerializedTextField($table_column, $nice_name, $nullable, $default_value = null) |
|
476 | - { |
|
477 | - return $this->loader->getNew( |
|
478 | - 'EE_Serialized_Text_Field', |
|
479 | - array($table_column, $nice_name, $nullable, $default_value) |
|
480 | - ); |
|
481 | - } |
|
482 | - |
|
483 | - |
|
484 | - /** |
|
485 | - * @param string $table_column |
|
486 | - * @param string $nice_name |
|
487 | - * @param bool $nullable |
|
488 | - * @param null $default_value |
|
489 | - * @return EE_Simple_HTML_Field |
|
490 | - */ |
|
491 | - public function createSimpleHtmlField($table_column, $nice_name, $nullable, $default_value = null) |
|
492 | - { |
|
493 | - return $this->loader->getNew( |
|
494 | - 'EE_Simple_HTML_Field', |
|
495 | - array($table_column, $nice_name, $nullable, $default_value) |
|
496 | - ); |
|
497 | - } |
|
498 | - |
|
499 | - |
|
500 | - /** |
|
501 | - * @param string $table_column |
|
502 | - * @param string $nice_name |
|
503 | - * @param bool $nullable |
|
504 | - * @param null $default_value |
|
505 | - * @return EE_Slug_Field |
|
506 | - */ |
|
507 | - public function createSlugField($table_column, $nice_name, $nullable = false, $default_value = null) |
|
508 | - { |
|
509 | - return $this->loader->getNew( |
|
510 | - 'EE_Slug_Field', |
|
511 | - array($table_column, $nice_name, $nullable, $default_value) |
|
512 | - ); |
|
513 | - } |
|
514 | - |
|
515 | - |
|
516 | - /** |
|
517 | - * @param string $table_column |
|
518 | - * @param string $nice_name |
|
519 | - * @param bool $nullable |
|
520 | - * @param null $default_value |
|
521 | - * @return EE_Trashed_Flag_Field |
|
522 | - */ |
|
523 | - public function createTrashedFlagField($table_column, $nice_name, $nullable, $default_value = null) |
|
524 | - { |
|
525 | - return $this->loader->getNew( |
|
526 | - 'EE_Trashed_Flag_Field', |
|
527 | - array($table_column, $nice_name, $nullable, $default_value) |
|
528 | - ); |
|
529 | - } |
|
530 | - |
|
531 | - |
|
532 | - /** |
|
533 | - * @param string $table_column |
|
534 | - * @param string $nice_name |
|
535 | - * @param bool $nullable |
|
536 | - * @param mixed $default_value |
|
537 | - * @param array $values If additional stati are to be used other than the default WP |
|
538 | - * statuses, then they can be registered via this property. The |
|
539 | - * format of the array should be as follows: array( |
|
540 | - * 'status_reference' => array( |
|
541 | - * 'label' => esc_html__('Status Reference Label', 'event_espresso'), |
|
542 | - * 'public' => true, // whether this status should |
|
543 | - * be shown on the frontend of the site |
|
544 | - * 'exclude_from_search' => false, // whether this status should |
|
545 | - * be excluded from wp searches |
|
546 | - * 'show_in_admin_all_list' => true, // whether this status is |
|
547 | - * included in queries for the admin "all" view in list table |
|
548 | - * views. |
|
549 | - * 'show_in_admin_status_list' => true, // show in the list of |
|
550 | - * statuses with post counts at the top of the admin list tables |
|
551 | - * (i.e. Status Reference(2) ) |
|
552 | - * 'label_count' => _n_noop( |
|
553 | - * 'Status Reference <span class="count">(%s)</span>', |
|
554 | - * 'Status References <span class="count">(%s)</span>' |
|
555 | - * ), // the text to display on |
|
556 | - * the admin screen |
|
557 | - * ( or you won't see your status count ). |
|
558 | - * ) |
|
559 | - * ) |
|
560 | - * @link http://codex.wordpress.org/Function_Reference/register_post_status for more info |
|
561 | - * @return EE_WP_Post_Status_Field |
|
562 | - */ |
|
563 | - public function createWpPostStatusField( |
|
564 | - $table_column, |
|
565 | - $nice_name, |
|
566 | - $nullable, |
|
567 | - $default_value = null, |
|
568 | - array $values = array() |
|
569 | - ) { |
|
570 | - return $this->loader->getNew( |
|
571 | - 'EE_WP_Post_Status_Field', |
|
572 | - array($table_column, $nice_name, $nullable, $default_value, $values) |
|
573 | - ); |
|
574 | - } |
|
575 | - |
|
576 | - |
|
577 | - /** |
|
578 | - * @param string $post_type |
|
579 | - * @return EE_WP_Post_Type_Field |
|
580 | - */ |
|
581 | - public function createWpPostTypeField($post_type) |
|
582 | - { |
|
583 | - return $this->loader->getNew('EE_WP_Post_Type_Field', array($post_type)); |
|
584 | - } |
|
585 | - |
|
586 | - |
|
587 | - /** |
|
588 | - * @param string $table_column |
|
589 | - * @param string $nice_name |
|
590 | - * @param bool $nullable |
|
591 | - * @return EE_WP_User_Field |
|
592 | - */ |
|
593 | - public function createWpUserField($table_column, $nice_name, $nullable) |
|
594 | - { |
|
595 | - return $this->loader->getNew('EE_WP_User_Field', array($table_column, $nice_name, $nullable)); |
|
596 | - } |
|
54 | + /** |
|
55 | + * @var LoaderInterface $loader |
|
56 | + */ |
|
57 | + private $loader; |
|
58 | + |
|
59 | + |
|
60 | + /** |
|
61 | + * ModelFieldFactory constructor. |
|
62 | + * |
|
63 | + * @param LoaderInterface $loader |
|
64 | + */ |
|
65 | + public function __construct(LoaderInterface $loader) |
|
66 | + { |
|
67 | + $this->loader = $loader; |
|
68 | + } |
|
69 | + |
|
70 | + |
|
71 | + /** |
|
72 | + * @param string $table_column |
|
73 | + * @param string $nice_name |
|
74 | + * @param bool $nullable |
|
75 | + * @param null $default_value |
|
76 | + * @return EE_All_Caps_Text_Field |
|
77 | + */ |
|
78 | + public function createAllCapsTextField($table_column, $nice_name, $nullable, $default_value = null) |
|
79 | + { |
|
80 | + return $this->loader->getNew( |
|
81 | + 'EE_All_Caps_Text_Field', |
|
82 | + array($table_column, $nice_name, $nullable, $default_value) |
|
83 | + ); |
|
84 | + } |
|
85 | + |
|
86 | + |
|
87 | + /** |
|
88 | + * @param string $table_column |
|
89 | + * @param string $nice_name |
|
90 | + * @param bool $nullable |
|
91 | + * @param null $default_value |
|
92 | + * @param string $model_name |
|
93 | + * @return EE_Any_Foreign_Model_Name_Field |
|
94 | + */ |
|
95 | + public function createAnyForeignModelNameField( |
|
96 | + $table_column, |
|
97 | + $nice_name, |
|
98 | + $nullable, |
|
99 | + $default_value = null, |
|
100 | + $model_name |
|
101 | + ) { |
|
102 | + return $this->loader->getNew( |
|
103 | + 'EE_Any_Foreign_Model_Name_Field', |
|
104 | + array($table_column, $nice_name, $nullable, $default_value, $model_name) |
|
105 | + ); |
|
106 | + } |
|
107 | + |
|
108 | + |
|
109 | + /** |
|
110 | + * @param string $table_column |
|
111 | + * @param string $nice_name |
|
112 | + * @param bool $nullable |
|
113 | + * @param null $default_value |
|
114 | + * @return EE_Boolean_Field |
|
115 | + */ |
|
116 | + public function createBooleanField($table_column, $nice_name, $nullable, $default_value = null) |
|
117 | + { |
|
118 | + return $this->loader->getNew( |
|
119 | + 'EE_Boolean_Field', |
|
120 | + array($table_column, $nice_name, $nullable, $default_value) |
|
121 | + ); |
|
122 | + } |
|
123 | + |
|
124 | + |
|
125 | + /** |
|
126 | + * @param string $table_column |
|
127 | + * @param string $nice_name |
|
128 | + * @param string $timezone_string |
|
129 | + * @param bool $nullable |
|
130 | + * @param string $default_value |
|
131 | + * @throws EE_Error |
|
132 | + * @throws InvalidArgumentException |
|
133 | + * @return EE_Datetime_Field |
|
134 | + */ |
|
135 | + public function createDatetimeField( |
|
136 | + $table_column, |
|
137 | + $nice_name, |
|
138 | + $nullable = false, |
|
139 | + $default_value = EE_Datetime_Field::now |
|
140 | + ) { |
|
141 | + return $this->loader->getNew( |
|
142 | + 'EE_Datetime_Field', |
|
143 | + array( |
|
144 | + $table_column, |
|
145 | + $nice_name, |
|
146 | + $nullable, |
|
147 | + $default_value, |
|
148 | + ) |
|
149 | + ); |
|
150 | + } |
|
151 | + |
|
152 | + |
|
153 | + /** |
|
154 | + * @param string $table_column |
|
155 | + * @param string $nice_name |
|
156 | + * @param bool $nullable |
|
157 | + * @param null $default_value |
|
158 | + * @return EE_DB_Only_Float_Field |
|
159 | + */ |
|
160 | + public function createDbOnlyFloatField($table_column, $nice_name, $nullable, $default_value = null) |
|
161 | + { |
|
162 | + return $this->loader->getNew( |
|
163 | + 'EE_DB_Only_Float_Field', |
|
164 | + array($table_column, $nice_name, $nullable, $default_value) |
|
165 | + ); |
|
166 | + } |
|
167 | + |
|
168 | + |
|
169 | + /** |
|
170 | + * @param string $table_column |
|
171 | + * @param string $nice_name |
|
172 | + * @param bool $nullable |
|
173 | + * @param null $default_value |
|
174 | + * @return EE_DB_Only_Int_Field |
|
175 | + */ |
|
176 | + public function createDbOnlyIntField($table_column, $nice_name, $nullable, $default_value = null) |
|
177 | + { |
|
178 | + return $this->loader->getNew( |
|
179 | + 'EE_DB_Only_Int_Field', |
|
180 | + array($table_column, $nice_name, $nullable, $default_value) |
|
181 | + ); |
|
182 | + } |
|
183 | + |
|
184 | + |
|
185 | + /** |
|
186 | + * @param string $table_column |
|
187 | + * @param string $nice_name |
|
188 | + * @param bool $nullable |
|
189 | + * @param null $default_value |
|
190 | + * @return EE_DB_Only_Text_Field |
|
191 | + */ |
|
192 | + public function createDbOnlyTextField($table_column, $nice_name, $nullable, $default_value = null) |
|
193 | + { |
|
194 | + return $this->loader->getNew( |
|
195 | + 'EE_DB_Only_Text_Field', |
|
196 | + array($table_column, $nice_name, $nullable, $default_value) |
|
197 | + ); |
|
198 | + } |
|
199 | + |
|
200 | + |
|
201 | + /** |
|
202 | + * @param string $table_column |
|
203 | + * @param string $nice_name |
|
204 | + * @param bool $nullable |
|
205 | + * @param string $default_value |
|
206 | + * @return EE_Email_Field |
|
207 | + */ |
|
208 | + public function createEmailField($table_column, $nice_name, $nullable = true, $default_value = '') |
|
209 | + { |
|
210 | + return $this->loader->getNew( |
|
211 | + 'EE_Email_Field', |
|
212 | + array($table_column, $nice_name, $nullable, $default_value) |
|
213 | + ); |
|
214 | + } |
|
215 | + |
|
216 | + |
|
217 | + /** |
|
218 | + * @param string $table_column |
|
219 | + * @param string $nice_name |
|
220 | + * @param bool $nullable |
|
221 | + * @param null $default_value |
|
222 | + * @param array $allowed_enum_values keys are values to be used in the DB, |
|
223 | + * values are how they should be displayed |
|
224 | + * @return EE_Enum_Integer_Field |
|
225 | + */ |
|
226 | + public function createEnumIntegerField( |
|
227 | + $table_column, |
|
228 | + $nice_name, |
|
229 | + $nullable, |
|
230 | + $default_value = null, |
|
231 | + array $allowed_enum_values |
|
232 | + ) { |
|
233 | + return $this->loader->getNew( |
|
234 | + 'EE_Enum_Integer_Field', |
|
235 | + array($table_column, $nice_name, $nullable, $default_value, $allowed_enum_values) |
|
236 | + ); |
|
237 | + } |
|
238 | + |
|
239 | + |
|
240 | + /** |
|
241 | + * @param string $table_column |
|
242 | + * @param string $nice_name |
|
243 | + * @param bool $nullable |
|
244 | + * @param null $default_value |
|
245 | + * @param array $allowed_enum_values keys are values to be used in the DB, |
|
246 | + * values are how they should be displayed |
|
247 | + * @return EE_Enum_Text_Field |
|
248 | + */ |
|
249 | + public function createEnumTextField( |
|
250 | + $table_column, |
|
251 | + $nice_name, |
|
252 | + $nullable, |
|
253 | + $default_value, |
|
254 | + array $allowed_enum_values |
|
255 | + ) { |
|
256 | + return $this->loader->getNew( |
|
257 | + 'EE_Enum_Text_Field', |
|
258 | + array($table_column, $nice_name, $nullable, $default_value, $allowed_enum_values) |
|
259 | + ); |
|
260 | + } |
|
261 | + |
|
262 | + |
|
263 | + /** |
|
264 | + * @param string $table_column |
|
265 | + * @param string $nice_name |
|
266 | + * @param bool $nullable |
|
267 | + * @param null $default_value |
|
268 | + * @return EE_Float_Field |
|
269 | + */ |
|
270 | + public function createFloatField($table_column, $nice_name, $nullable, $default_value = null) |
|
271 | + { |
|
272 | + return $this->loader->getNew( |
|
273 | + 'EE_Float_Field', |
|
274 | + array($table_column, $nice_name, $nullable, $default_value) |
|
275 | + ); |
|
276 | + } |
|
277 | + |
|
278 | + |
|
279 | + /** |
|
280 | + * @param string $table_column |
|
281 | + * @param string $nice_name |
|
282 | + * @param bool $nullable |
|
283 | + * @param null $default_value |
|
284 | + * @param string $model_name |
|
285 | + * @return EE_Foreign_Key_Int_Field |
|
286 | + */ |
|
287 | + public function createForeignKeyIntField($table_column, $nice_name, $nullable, $default_value, $model_name) |
|
288 | + { |
|
289 | + return $this->loader->getNew( |
|
290 | + 'EE_Foreign_Key_Int_Field', |
|
291 | + array($table_column, $nice_name, $nullable, $default_value, $model_name) |
|
292 | + ); |
|
293 | + } |
|
294 | + |
|
295 | + |
|
296 | + /** |
|
297 | + * @param string $table_column |
|
298 | + * @param string $nice_name |
|
299 | + * @param bool $nullable |
|
300 | + * @param null $default_value |
|
301 | + * @param string $model_name |
|
302 | + * @return EE_Foreign_Key_String_Field |
|
303 | + */ |
|
304 | + public function createForeignKeyStringField( |
|
305 | + $table_column, |
|
306 | + $nice_name, |
|
307 | + $nullable, |
|
308 | + $default_value, |
|
309 | + $model_name |
|
310 | + ) { |
|
311 | + return $this->loader->getNew( |
|
312 | + 'EE_Foreign_Key_String_Field', |
|
313 | + array($table_column, $nice_name, $nullable, $default_value, $model_name) |
|
314 | + ); |
|
315 | + } |
|
316 | + |
|
317 | + |
|
318 | + /** |
|
319 | + * @param string $table_column |
|
320 | + * @param string $nice_name |
|
321 | + * @param bool $nullable |
|
322 | + * @param null $default_value |
|
323 | + * @return EE_Full_HTML_Field |
|
324 | + */ |
|
325 | + public function createFullHtmlField($table_column, $nice_name, $nullable, $default_value = null) |
|
326 | + { |
|
327 | + return $this->loader->getNew( |
|
328 | + 'EE_Full_HTML_Field', |
|
329 | + array($table_column, $nice_name, $nullable, $default_value) |
|
330 | + ); |
|
331 | + } |
|
332 | + |
|
333 | + |
|
334 | + /** |
|
335 | + * @param string $table_column |
|
336 | + * @param string $nice_name |
|
337 | + * @param bool $nullable |
|
338 | + * @param null $default_value |
|
339 | + * @return EE_Infinite_Integer_Field |
|
340 | + */ |
|
341 | + public function createInfiniteIntegerField($table_column, $nice_name, $nullable, $default_value = null) |
|
342 | + { |
|
343 | + return $this->loader->getNew( |
|
344 | + 'EE_Infinite_Integer_Field', |
|
345 | + array($table_column, $nice_name, $nullable, $default_value) |
|
346 | + ); |
|
347 | + } |
|
348 | + |
|
349 | + |
|
350 | + /** |
|
351 | + * @param string $table_column |
|
352 | + * @param string $nice_name |
|
353 | + * @param bool $nullable |
|
354 | + * @param integer $default_value |
|
355 | + * @return EE_Integer_Field |
|
356 | + */ |
|
357 | + public function createIntegerField($table_column, $nice_name, $nullable = false, $default_value = 0) |
|
358 | + { |
|
359 | + return $this->loader->getNew( |
|
360 | + 'EE_Integer_Field', |
|
361 | + array($table_column, $nice_name, $nullable, $default_value) |
|
362 | + ); |
|
363 | + } |
|
364 | + |
|
365 | + |
|
366 | + /** |
|
367 | + * @param string $table_column |
|
368 | + * @param string $nice_name |
|
369 | + * @param bool $nullable |
|
370 | + * @param null $default_value |
|
371 | + * @return EE_Maybe_Serialized_Simple_HTML_Field |
|
372 | + */ |
|
373 | + public function createMaybeSerializedSimpleHtmlField($table_column, $nice_name, $nullable, $default_value = null) |
|
374 | + { |
|
375 | + return $this->loader->getNew( |
|
376 | + 'EE_Maybe_Serialized_Simple_HTML_Field', |
|
377 | + array($table_column, $nice_name, $nullable, $default_value) |
|
378 | + ); |
|
379 | + } |
|
380 | + |
|
381 | + |
|
382 | + /** |
|
383 | + * @param string $table_column |
|
384 | + * @param string $nice_name |
|
385 | + * @param bool $nullable |
|
386 | + * @param null $default_value |
|
387 | + * @return EE_Maybe_Serialized_Text_Field |
|
388 | + */ |
|
389 | + public function createMaybeSerializedTextField($table_column, $nice_name, $nullable, $default_value = null) |
|
390 | + { |
|
391 | + return $this->loader->getNew( |
|
392 | + 'EE_Maybe_Serialized_Text_Field', |
|
393 | + array($table_column, $nice_name, $nullable, $default_value) |
|
394 | + ); |
|
395 | + } |
|
396 | + |
|
397 | + |
|
398 | + /** |
|
399 | + * @param string $table_column |
|
400 | + * @param string $nice_name |
|
401 | + * @param bool $nullable |
|
402 | + * @param null $default_value |
|
403 | + * @return EE_Money_Field |
|
404 | + */ |
|
405 | + public function createMoneyField($table_column, $nice_name, $nullable, $default_value = null) |
|
406 | + { |
|
407 | + return $this->loader->getNew( |
|
408 | + 'EE_Money_Field', |
|
409 | + array($table_column, $nice_name, $nullable, $default_value) |
|
410 | + ); |
|
411 | + } |
|
412 | + |
|
413 | + |
|
414 | + /** |
|
415 | + * @param string $table_column |
|
416 | + * @param string $nice_name |
|
417 | + * @param bool $nullable |
|
418 | + * @param string $default_value |
|
419 | + * @return EE_Plain_Text_Field |
|
420 | + */ |
|
421 | + public function createPlainTextField($table_column, $nice_name, $nullable = true, $default_value = '') |
|
422 | + { |
|
423 | + return $this->loader->getNew( |
|
424 | + 'EE_Plain_Text_Field', |
|
425 | + array($table_column, $nice_name, $nullable, $default_value) |
|
426 | + ); |
|
427 | + } |
|
428 | + |
|
429 | + |
|
430 | + /** |
|
431 | + * @param string $table_column |
|
432 | + * @param string $nice_name |
|
433 | + * @param bool $nullable |
|
434 | + * @param null $default_value |
|
435 | + * @return EE_Post_Content_Field |
|
436 | + */ |
|
437 | + public function createPostContentField($table_column, $nice_name, $nullable, $default_value = null) |
|
438 | + { |
|
439 | + return $this->loader->getNew( |
|
440 | + 'EE_Post_Content_Field', |
|
441 | + array($table_column, $nice_name, $nullable, $default_value) |
|
442 | + ); |
|
443 | + } |
|
444 | + |
|
445 | + |
|
446 | + /** |
|
447 | + * @param string $table_column |
|
448 | + * @param string $nice_name |
|
449 | + * @return EE_Primary_Key_Int_Field |
|
450 | + */ |
|
451 | + public function createPrimaryKeyIntField($table_column, $nice_name) |
|
452 | + { |
|
453 | + return $this->loader->getNew('EE_Primary_Key_Int_Field', array($table_column, $nice_name)); |
|
454 | + } |
|
455 | + |
|
456 | + |
|
457 | + /** |
|
458 | + * @param string $table_column |
|
459 | + * @param string $nice_name |
|
460 | + * @return EE_Primary_Key_String_Field |
|
461 | + */ |
|
462 | + public function createPrimaryKeyStringField($table_column, $nice_name) |
|
463 | + { |
|
464 | + return $this->loader->getNew('EE_Primary_Key_String_Field', array($table_column, $nice_name)); |
|
465 | + } |
|
466 | + |
|
467 | + |
|
468 | + /** |
|
469 | + * @param string $table_column |
|
470 | + * @param string $nice_name |
|
471 | + * @param bool $nullable |
|
472 | + * @param null $default_value |
|
473 | + * @return EE_Serialized_Text_Field |
|
474 | + */ |
|
475 | + public function createSerializedTextField($table_column, $nice_name, $nullable, $default_value = null) |
|
476 | + { |
|
477 | + return $this->loader->getNew( |
|
478 | + 'EE_Serialized_Text_Field', |
|
479 | + array($table_column, $nice_name, $nullable, $default_value) |
|
480 | + ); |
|
481 | + } |
|
482 | + |
|
483 | + |
|
484 | + /** |
|
485 | + * @param string $table_column |
|
486 | + * @param string $nice_name |
|
487 | + * @param bool $nullable |
|
488 | + * @param null $default_value |
|
489 | + * @return EE_Simple_HTML_Field |
|
490 | + */ |
|
491 | + public function createSimpleHtmlField($table_column, $nice_name, $nullable, $default_value = null) |
|
492 | + { |
|
493 | + return $this->loader->getNew( |
|
494 | + 'EE_Simple_HTML_Field', |
|
495 | + array($table_column, $nice_name, $nullable, $default_value) |
|
496 | + ); |
|
497 | + } |
|
498 | + |
|
499 | + |
|
500 | + /** |
|
501 | + * @param string $table_column |
|
502 | + * @param string $nice_name |
|
503 | + * @param bool $nullable |
|
504 | + * @param null $default_value |
|
505 | + * @return EE_Slug_Field |
|
506 | + */ |
|
507 | + public function createSlugField($table_column, $nice_name, $nullable = false, $default_value = null) |
|
508 | + { |
|
509 | + return $this->loader->getNew( |
|
510 | + 'EE_Slug_Field', |
|
511 | + array($table_column, $nice_name, $nullable, $default_value) |
|
512 | + ); |
|
513 | + } |
|
514 | + |
|
515 | + |
|
516 | + /** |
|
517 | + * @param string $table_column |
|
518 | + * @param string $nice_name |
|
519 | + * @param bool $nullable |
|
520 | + * @param null $default_value |
|
521 | + * @return EE_Trashed_Flag_Field |
|
522 | + */ |
|
523 | + public function createTrashedFlagField($table_column, $nice_name, $nullable, $default_value = null) |
|
524 | + { |
|
525 | + return $this->loader->getNew( |
|
526 | + 'EE_Trashed_Flag_Field', |
|
527 | + array($table_column, $nice_name, $nullable, $default_value) |
|
528 | + ); |
|
529 | + } |
|
530 | + |
|
531 | + |
|
532 | + /** |
|
533 | + * @param string $table_column |
|
534 | + * @param string $nice_name |
|
535 | + * @param bool $nullable |
|
536 | + * @param mixed $default_value |
|
537 | + * @param array $values If additional stati are to be used other than the default WP |
|
538 | + * statuses, then they can be registered via this property. The |
|
539 | + * format of the array should be as follows: array( |
|
540 | + * 'status_reference' => array( |
|
541 | + * 'label' => esc_html__('Status Reference Label', 'event_espresso'), |
|
542 | + * 'public' => true, // whether this status should |
|
543 | + * be shown on the frontend of the site |
|
544 | + * 'exclude_from_search' => false, // whether this status should |
|
545 | + * be excluded from wp searches |
|
546 | + * 'show_in_admin_all_list' => true, // whether this status is |
|
547 | + * included in queries for the admin "all" view in list table |
|
548 | + * views. |
|
549 | + * 'show_in_admin_status_list' => true, // show in the list of |
|
550 | + * statuses with post counts at the top of the admin list tables |
|
551 | + * (i.e. Status Reference(2) ) |
|
552 | + * 'label_count' => _n_noop( |
|
553 | + * 'Status Reference <span class="count">(%s)</span>', |
|
554 | + * 'Status References <span class="count">(%s)</span>' |
|
555 | + * ), // the text to display on |
|
556 | + * the admin screen |
|
557 | + * ( or you won't see your status count ). |
|
558 | + * ) |
|
559 | + * ) |
|
560 | + * @link http://codex.wordpress.org/Function_Reference/register_post_status for more info |
|
561 | + * @return EE_WP_Post_Status_Field |
|
562 | + */ |
|
563 | + public function createWpPostStatusField( |
|
564 | + $table_column, |
|
565 | + $nice_name, |
|
566 | + $nullable, |
|
567 | + $default_value = null, |
|
568 | + array $values = array() |
|
569 | + ) { |
|
570 | + return $this->loader->getNew( |
|
571 | + 'EE_WP_Post_Status_Field', |
|
572 | + array($table_column, $nice_name, $nullable, $default_value, $values) |
|
573 | + ); |
|
574 | + } |
|
575 | + |
|
576 | + |
|
577 | + /** |
|
578 | + * @param string $post_type |
|
579 | + * @return EE_WP_Post_Type_Field |
|
580 | + */ |
|
581 | + public function createWpPostTypeField($post_type) |
|
582 | + { |
|
583 | + return $this->loader->getNew('EE_WP_Post_Type_Field', array($post_type)); |
|
584 | + } |
|
585 | + |
|
586 | + |
|
587 | + /** |
|
588 | + * @param string $table_column |
|
589 | + * @param string $nice_name |
|
590 | + * @param bool $nullable |
|
591 | + * @return EE_WP_User_Field |
|
592 | + */ |
|
593 | + public function createWpUserField($table_column, $nice_name, $nullable) |
|
594 | + { |
|
595 | + return $this->loader->getNew('EE_WP_User_Field', array($table_column, $nice_name, $nullable)); |
|
596 | + } |
|
597 | 597 | } |
@@ -16,35 +16,35 @@ |
||
16 | 16 | { |
17 | 17 | |
18 | 18 | |
19 | - /** |
|
20 | - * @access public |
|
21 | - * @param mixed $command_bus_middleware_object |
|
22 | - * @param string $message |
|
23 | - * @param int $code |
|
24 | - * @param \Exception $previous |
|
25 | - */ |
|
26 | - public function __construct($command_bus_middleware_object, $message = '', $code = 0, \Exception $previous = null) |
|
27 | - { |
|
28 | - $command_bus_middleware = is_object($command_bus_middleware_object) |
|
29 | - ? get_class($command_bus_middleware_object) |
|
30 | - : gettype($command_bus_middleware_object); |
|
19 | + /** |
|
20 | + * @access public |
|
21 | + * @param mixed $command_bus_middleware_object |
|
22 | + * @param string $message |
|
23 | + * @param int $code |
|
24 | + * @param \Exception $previous |
|
25 | + */ |
|
26 | + public function __construct($command_bus_middleware_object, $message = '', $code = 0, \Exception $previous = null) |
|
27 | + { |
|
28 | + $command_bus_middleware = is_object($command_bus_middleware_object) |
|
29 | + ? get_class($command_bus_middleware_object) |
|
30 | + : gettype($command_bus_middleware_object); |
|
31 | 31 | |
32 | - if (empty($message)) { |
|
33 | - $message = sprintf( |
|
34 | - esc_html__( |
|
35 | - 'The supplied Command Bus Middleware "%1$s" does not have a valid name. It should be in the following format: "{CommandName}Handler" ', |
|
36 | - 'event_espresso' |
|
37 | - ), |
|
38 | - $command_bus_middleware |
|
39 | - ); |
|
40 | - } |
|
41 | - parent::__construct( |
|
42 | - '$command_bus_middleware', |
|
43 | - $command_bus_middleware, |
|
44 | - 'CommandBusMiddlewareInterface', |
|
45 | - $message, |
|
46 | - $code, |
|
47 | - $previous |
|
48 | - ); |
|
49 | - } |
|
32 | + if (empty($message)) { |
|
33 | + $message = sprintf( |
|
34 | + esc_html__( |
|
35 | + 'The supplied Command Bus Middleware "%1$s" does not have a valid name. It should be in the following format: "{CommandName}Handler" ', |
|
36 | + 'event_espresso' |
|
37 | + ), |
|
38 | + $command_bus_middleware |
|
39 | + ); |
|
40 | + } |
|
41 | + parent::__construct( |
|
42 | + '$command_bus_middleware', |
|
43 | + $command_bus_middleware, |
|
44 | + 'CommandBusMiddlewareInterface', |
|
45 | + $message, |
|
46 | + $code, |
|
47 | + $previous |
|
48 | + ); |
|
49 | + } |
|
50 | 50 | } |
@@ -13,21 +13,21 @@ |
||
13 | 13 | class CommandHandlerNotFoundException extends \OutOfBoundsException |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * @access public |
|
18 | - * @param string $command_handler_name |
|
19 | - * @param string $message |
|
20 | - * @param int $code |
|
21 | - * @param \Exception $previous |
|
22 | - */ |
|
23 | - public function __construct($command_handler_name, $message = '', $code = 0, \Exception $previous = null) |
|
24 | - { |
|
25 | - if (empty($message)) { |
|
26 | - $message = sprintf( |
|
27 | - esc_html__('The requested Command Handler "%1$s" could not be located or does not exist.', 'event_espresso'), |
|
28 | - $command_handler_name |
|
29 | - ); |
|
30 | - } |
|
31 | - parent::__construct($message, $code, $previous); |
|
32 | - } |
|
16 | + /** |
|
17 | + * @access public |
|
18 | + * @param string $command_handler_name |
|
19 | + * @param string $message |
|
20 | + * @param int $code |
|
21 | + * @param \Exception $previous |
|
22 | + */ |
|
23 | + public function __construct($command_handler_name, $message = '', $code = 0, \Exception $previous = null) |
|
24 | + { |
|
25 | + if (empty($message)) { |
|
26 | + $message = sprintf( |
|
27 | + esc_html__('The requested Command Handler "%1$s" could not be located or does not exist.', 'event_espresso'), |
|
28 | + $command_handler_name |
|
29 | + ); |
|
30 | + } |
|
31 | + parent::__construct($message, $code, $previous); |
|
32 | + } |
|
33 | 33 | } |
@@ -13,24 +13,24 @@ |
||
13 | 13 | class InvalidCommandHandlerException extends \DomainException |
14 | 14 | { |
15 | 15 | |
16 | - /** |
|
17 | - * @access public |
|
18 | - * @param string $command_name |
|
19 | - * @param string $message |
|
20 | - * @param int $code |
|
21 | - * @param \Exception $previous |
|
22 | - */ |
|
23 | - public function __construct($command_name, $message = '', $code = 0, \Exception $previous = null) |
|
24 | - { |
|
25 | - if (empty($message)) { |
|
26 | - $message = sprintf( |
|
27 | - esc_html__( |
|
28 | - 'The supplied Command Handler "%1$s" does not have a valid name. It should be in the following format: "{CommandName}Handler" ', |
|
29 | - 'event_espresso' |
|
30 | - ), |
|
31 | - $command_name |
|
32 | - ); |
|
33 | - } |
|
34 | - parent::__construct($message, $code, $previous); |
|
35 | - } |
|
16 | + /** |
|
17 | + * @access public |
|
18 | + * @param string $command_name |
|
19 | + * @param string $message |
|
20 | + * @param int $code |
|
21 | + * @param \Exception $previous |
|
22 | + */ |
|
23 | + public function __construct($command_name, $message = '', $code = 0, \Exception $previous = null) |
|
24 | + { |
|
25 | + if (empty($message)) { |
|
26 | + $message = sprintf( |
|
27 | + esc_html__( |
|
28 | + 'The supplied Command Handler "%1$s" does not have a valid name. It should be in the following format: "{CommandName}Handler" ', |
|
29 | + 'event_espresso' |
|
30 | + ), |
|
31 | + $command_name |
|
32 | + ); |
|
33 | + } |
|
34 | + parent::__construct($message, $code, $previous); |
|
35 | + } |
|
36 | 36 | } |