@@ -389,11 +389,11 @@ discard block |
||
| 389 | 389 | */ |
| 390 | 390 | public function type_obj() |
| 391 | 391 | { |
| 392 | - if (! $this->_type_obj) { |
|
| 392 | + if ( ! $this->_type_obj) { |
|
| 393 | 393 | EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
| 394 | 394 | if (EE_Payment_Method_Manager::instance()->payment_method_type_exists($this->type())) { |
| 395 | 395 | $class_name = EE_Payment_Method_Manager::instance()->payment_method_class_from_type($this->type()); |
| 396 | - if (! class_exists($class_name)) { |
|
| 396 | + if ( ! class_exists($class_name)) { |
|
| 397 | 397 | throw new EE_Error( |
| 398 | 398 | sprintf( |
| 399 | 399 | __( |
@@ -402,7 +402,7 @@ discard block |
||
| 402 | 402 | ), |
| 403 | 403 | $class_name, |
| 404 | 404 | '<br />', |
| 405 | - '<a href="' . admin_url('plugins.php') . '">', |
|
| 405 | + '<a href="'.admin_url('plugins.php').'">', |
|
| 406 | 406 | '</a>' |
| 407 | 407 | ) |
| 408 | 408 | ); |
@@ -441,7 +441,7 @@ discard block |
||
| 441 | 441 | foreach ($fields as $key => $value) { |
| 442 | 442 | if (strpos($key, 'PMD_') === 0) { |
| 443 | 443 | $key_sans_model_prefix = str_replace('PMD_', '', $key); |
| 444 | - $combined_settings_array [ $key_sans_model_prefix ] = $value; |
|
| 444 | + $combined_settings_array [$key_sans_model_prefix] = $value; |
|
| 445 | 445 | } |
| 446 | 446 | } |
| 447 | 447 | $combined_settings_array = array_merge($extra_meta, $combined_settings_array); |
@@ -464,14 +464,14 @@ discard block |
||
| 464 | 464 | <div id="' |
| 465 | 465 | . $this->slug() |
| 466 | 466 | . '-payment-option-dv" class="' |
| 467 | - . $payment_occurs . '-payment-gateway reg-page-payment-option-dv' . $css_class . '"> |
|
| 467 | + . $payment_occurs.'-payment-gateway reg-page-payment-option-dv'.$css_class.'"> |
|
| 468 | 468 | <a id="payment-gateway-button-' . $this->slug() |
| 469 | 469 | . '" class="reg-page-payment-option-lnk" rel="' |
| 470 | - . $this->slug() . '" href="' . $url . '" > |
|
| 471 | - <img src="' . $this->button_url() . '" alt="' . sprintf( |
|
| 470 | + . $this->slug().'" href="'.$url.'" > |
|
| 471 | + <img src="' . $this->button_url().'" alt="'.sprintf( |
|
| 472 | 472 | esc_attr__('Pay using %s', 'event_espresso'), |
| 473 | 473 | $this->get_pretty('PMD_name', 'form_input') |
| 474 | - ) . '" /> |
|
| 474 | + ).'" /> |
|
| 475 | 475 | </a> |
| 476 | 476 | </div> |
| 477 | 477 | '; |
@@ -11,580 +11,580 @@ |
||
| 11 | 11 | class EE_Payment_Method extends EE_Base_Class |
| 12 | 12 | { |
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * Payment Method type object, which has all the info about this type of payment method, |
|
| 16 | - * including functions for processing payments, to get settings forms, etc. |
|
| 17 | - * |
|
| 18 | - * @var EE_PMT_Base |
|
| 19 | - */ |
|
| 20 | - protected $_type_obj; |
|
| 21 | - |
|
| 22 | - |
|
| 23 | - /** |
|
| 24 | - * @param array $props_n_values |
|
| 25 | - * @return EE_Payment_Method |
|
| 26 | - * @throws \EE_Error |
|
| 27 | - */ |
|
| 28 | - public static function new_instance($props_n_values = array()) |
|
| 29 | - { |
|
| 30 | - $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
| 31 | - return $has_object ? $has_object : new self($props_n_values, false); |
|
| 32 | - } |
|
| 33 | - |
|
| 34 | - |
|
| 35 | - /** |
|
| 36 | - * @param array $props_n_values |
|
| 37 | - * @return EE_Payment_Method |
|
| 38 | - * @throws \EE_Error |
|
| 39 | - */ |
|
| 40 | - public static function new_instance_from_db($props_n_values = array()) |
|
| 41 | - { |
|
| 42 | - return new self($props_n_values, true); |
|
| 43 | - } |
|
| 44 | - |
|
| 45 | - |
|
| 46 | - |
|
| 47 | - /** |
|
| 48 | - * Checks if there is a payment method class of the given 'PMD_type', and if so returns the classname. |
|
| 49 | - * Otherwise returns a normal EE_Payment_Method |
|
| 50 | - * |
|
| 51 | - * @param array $props_n_values where 'PMD_type' is a gateway name like 'Paypal_Standard','Invoice',etc (basically |
|
| 52 | - * the classname minus 'EEPM_') |
|
| 53 | - * @return string |
|
| 54 | - */ |
|
| 55 | - // private static function _payment_method_type($props_n_values) |
|
| 56 | - // { |
|
| 57 | - // EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
| 58 | - // $type_string = isset($props_n_values['PMD_type']) ? $props_n_values['PMD_type'] : null; |
|
| 59 | - // if (EE_Payment_Method_Manager::instance()->payment_method_type_exists($type_string)) { |
|
| 60 | - // return 'EEPM_' . $type_string; |
|
| 61 | - // } else { |
|
| 62 | - // return __CLASS__; |
|
| 63 | - // } |
|
| 64 | - // } |
|
| 65 | - |
|
| 66 | - |
|
| 67 | - /** |
|
| 68 | - * Gets whether this payment method can be used anywhere at all (ie frontend cart, admin, etc) |
|
| 69 | - * |
|
| 70 | - * @return boolean |
|
| 71 | - */ |
|
| 72 | - public function active() |
|
| 73 | - { |
|
| 74 | - return array_intersect(array_keys(EEM_Payment_Method::instance()->scopes()), $this->scope()); |
|
| 75 | - } |
|
| 76 | - |
|
| 77 | - |
|
| 78 | - /** |
|
| 79 | - * Sets this PM as active by making it usable within the CART scope. Offline gateways |
|
| 80 | - * are also usable from the admin-scope as well. DOES NOT SAVE it |
|
| 81 | - * |
|
| 82 | - * @throws \EE_Error |
|
| 83 | - */ |
|
| 84 | - public function set_active() |
|
| 85 | - { |
|
| 86 | - $default_scopes = array(EEM_Payment_Method::scope_cart); |
|
| 87 | - if ( |
|
| 88 | - $this->type_obj() && |
|
| 89 | - $this->type_obj()->payment_occurs() === EE_PMT_Base::offline |
|
| 90 | - ) { |
|
| 91 | - $default_scopes[] = EEM_Payment_Method::scope_admin; |
|
| 92 | - } |
|
| 93 | - $this->set_scope($default_scopes); |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - |
|
| 97 | - /** |
|
| 98 | - * Makes this payment method apply to NO scopes at all. DOES NOT SAVE it. |
|
| 99 | - */ |
|
| 100 | - public function deactivate() |
|
| 101 | - { |
|
| 102 | - $this->set_scope(array()); |
|
| 103 | - } |
|
| 104 | - |
|
| 105 | - |
|
| 106 | - /** |
|
| 107 | - * Gets button_url |
|
| 108 | - * |
|
| 109 | - * @return string |
|
| 110 | - */ |
|
| 111 | - public function button_url() |
|
| 112 | - { |
|
| 113 | - return $this->get('PMD_button_url'); |
|
| 114 | - } |
|
| 115 | - |
|
| 116 | - |
|
| 117 | - /** |
|
| 118 | - * Sets button_url |
|
| 119 | - * |
|
| 120 | - * @param string $button_url |
|
| 121 | - */ |
|
| 122 | - public function set_button_url($button_url) |
|
| 123 | - { |
|
| 124 | - $this->set('PMD_button_url', $button_url); |
|
| 125 | - } |
|
| 126 | - |
|
| 127 | - |
|
| 128 | - /** |
|
| 129 | - * Gets debug_mode |
|
| 130 | - * |
|
| 131 | - * @return boolean |
|
| 132 | - */ |
|
| 133 | - public function debug_mode() |
|
| 134 | - { |
|
| 135 | - return $this->get('PMD_debug_mode'); |
|
| 136 | - } |
|
| 137 | - |
|
| 138 | - |
|
| 139 | - /** |
|
| 140 | - * Sets debug_mode |
|
| 141 | - * |
|
| 142 | - * @param boolean $debug_mode |
|
| 143 | - */ |
|
| 144 | - public function set_debug_mode($debug_mode) |
|
| 145 | - { |
|
| 146 | - $this->set('PMD_debug_mode', $debug_mode); |
|
| 147 | - } |
|
| 148 | - |
|
| 149 | - |
|
| 150 | - /** |
|
| 151 | - * Gets description |
|
| 152 | - * |
|
| 153 | - * @return string |
|
| 154 | - */ |
|
| 155 | - public function description() |
|
| 156 | - { |
|
| 157 | - return $this->get('PMD_desc'); |
|
| 158 | - } |
|
| 159 | - |
|
| 160 | - |
|
| 161 | - /** |
|
| 162 | - * Sets description |
|
| 163 | - * |
|
| 164 | - * @param string $description |
|
| 165 | - */ |
|
| 166 | - public function set_description($description) |
|
| 167 | - { |
|
| 168 | - $this->set('PMD_desc', $description); |
|
| 169 | - } |
|
| 170 | - |
|
| 171 | - |
|
| 172 | - /** |
|
| 173 | - * Gets name |
|
| 174 | - * |
|
| 175 | - * @return string |
|
| 176 | - */ |
|
| 177 | - public function name() |
|
| 178 | - { |
|
| 179 | - return $this->get('PMD_name'); |
|
| 180 | - } |
|
| 181 | - |
|
| 182 | - |
|
| 183 | - /** |
|
| 184 | - * Sets name |
|
| 185 | - * |
|
| 186 | - * @param string $name |
|
| 187 | - */ |
|
| 188 | - public function set_name($name) |
|
| 189 | - { |
|
| 190 | - $this->set('PMD_name', $name); |
|
| 191 | - } |
|
| 192 | - |
|
| 193 | - |
|
| 194 | - /** |
|
| 195 | - * Gets open_by_default |
|
| 196 | - * |
|
| 197 | - * @return boolean |
|
| 198 | - */ |
|
| 199 | - public function open_by_default() |
|
| 200 | - { |
|
| 201 | - return $this->get('PMD_open_by_default'); |
|
| 202 | - } |
|
| 203 | - |
|
| 204 | - |
|
| 205 | - /** |
|
| 206 | - * Sets open_by_default |
|
| 207 | - * |
|
| 208 | - * @param boolean $open_by_default |
|
| 209 | - */ |
|
| 210 | - public function set_open_by_default($open_by_default) |
|
| 211 | - { |
|
| 212 | - $this->set('PMD_open_by_default', $open_by_default); |
|
| 213 | - } |
|
| 214 | - |
|
| 215 | - |
|
| 216 | - /** |
|
| 217 | - * Gets order |
|
| 218 | - * |
|
| 219 | - * @return int |
|
| 220 | - */ |
|
| 221 | - public function order() |
|
| 222 | - { |
|
| 223 | - return $this->get('PMD_order'); |
|
| 224 | - } |
|
| 225 | - |
|
| 226 | - |
|
| 227 | - /** |
|
| 228 | - * Sets order |
|
| 229 | - * |
|
| 230 | - * @param int $order |
|
| 231 | - */ |
|
| 232 | - public function set_order($order) |
|
| 233 | - { |
|
| 234 | - $this->set('PMD_order', $order); |
|
| 235 | - } |
|
| 236 | - |
|
| 237 | - |
|
| 238 | - /** |
|
| 239 | - * Gets slug |
|
| 240 | - * |
|
| 241 | - * @return string |
|
| 242 | - */ |
|
| 243 | - public function slug() |
|
| 244 | - { |
|
| 245 | - return $this->get('PMD_slug'); |
|
| 246 | - } |
|
| 247 | - |
|
| 248 | - |
|
| 249 | - /** |
|
| 250 | - * Sets slug |
|
| 251 | - * |
|
| 252 | - * @param string $slug |
|
| 253 | - */ |
|
| 254 | - public function set_slug($slug) |
|
| 255 | - { |
|
| 256 | - $this->set('PMD_slug', $slug); |
|
| 257 | - } |
|
| 258 | - |
|
| 259 | - |
|
| 260 | - /** |
|
| 261 | - * Gets type |
|
| 262 | - * |
|
| 263 | - * @return string |
|
| 264 | - */ |
|
| 265 | - public function type() |
|
| 266 | - { |
|
| 267 | - return $this->get('PMD_type'); |
|
| 268 | - } |
|
| 269 | - |
|
| 270 | - |
|
| 271 | - /** |
|
| 272 | - * Sets type |
|
| 273 | - * |
|
| 274 | - * @param string $type |
|
| 275 | - */ |
|
| 276 | - public function set_type($type) |
|
| 277 | - { |
|
| 278 | - $this->set('PMD_type', $type); |
|
| 279 | - } |
|
| 280 | - |
|
| 281 | - |
|
| 282 | - /** |
|
| 283 | - * Gets wp_user |
|
| 284 | - * |
|
| 285 | - * @return int |
|
| 286 | - */ |
|
| 287 | - public function wp_user() |
|
| 288 | - { |
|
| 289 | - return $this->get('PMD_wp_user'); |
|
| 290 | - } |
|
| 291 | - |
|
| 292 | - |
|
| 293 | - /** |
|
| 294 | - * Sets wp_user |
|
| 295 | - * |
|
| 296 | - * @param int $wp_user_id |
|
| 297 | - */ |
|
| 298 | - public function set_wp_user($wp_user_id) |
|
| 299 | - { |
|
| 300 | - $this->set('PMD_wp_user', $wp_user_id); |
|
| 301 | - } |
|
| 302 | - |
|
| 303 | - /** |
|
| 304 | - * Overrides parent so when PMD_type is changed we refresh the _type_obj |
|
| 305 | - * |
|
| 306 | - * @param string $field_name |
|
| 307 | - * @param mixed $field_value |
|
| 308 | - * @param boolean $use_default |
|
| 309 | - */ |
|
| 310 | - public function set($field_name, $field_value, $use_default = false) |
|
| 311 | - { |
|
| 312 | - if ($field_name === 'PMD_type') { |
|
| 313 | - // the type has probably changed, so forget about its old type object |
|
| 314 | - $this->_type_obj = null; |
|
| 315 | - } |
|
| 316 | - parent::set($field_name, $field_value, $use_default); |
|
| 317 | - } |
|
| 318 | - |
|
| 319 | - |
|
| 320 | - /** |
|
| 321 | - * Gets admin_name |
|
| 322 | - * |
|
| 323 | - * @return string |
|
| 324 | - */ |
|
| 325 | - public function admin_name() |
|
| 326 | - { |
|
| 327 | - return $this->get('PMD_admin_name'); |
|
| 328 | - } |
|
| 329 | - |
|
| 330 | - |
|
| 331 | - /** |
|
| 332 | - * Sets admin_name |
|
| 333 | - * |
|
| 334 | - * @param string $admin_name |
|
| 335 | - */ |
|
| 336 | - public function set_admin_name($admin_name) |
|
| 337 | - { |
|
| 338 | - $this->set('PMD_admin_name', $admin_name); |
|
| 339 | - } |
|
| 340 | - |
|
| 341 | - |
|
| 342 | - /** |
|
| 343 | - * Gets admin_desc |
|
| 344 | - * |
|
| 345 | - * @return string |
|
| 346 | - */ |
|
| 347 | - public function admin_desc() |
|
| 348 | - { |
|
| 349 | - return $this->get('PMD_admin_desc'); |
|
| 350 | - } |
|
| 351 | - |
|
| 352 | - |
|
| 353 | - /** |
|
| 354 | - * Sets admin_desc |
|
| 355 | - * |
|
| 356 | - * @param string $admin_desc |
|
| 357 | - */ |
|
| 358 | - public function set_admin_desc($admin_desc) |
|
| 359 | - { |
|
| 360 | - $this->set('PMD_admin_desc', $admin_desc); |
|
| 361 | - } |
|
| 362 | - |
|
| 363 | - |
|
| 364 | - /** |
|
| 365 | - * Gets scope |
|
| 366 | - * |
|
| 367 | - * @return array |
|
| 368 | - */ |
|
| 369 | - public function scope() |
|
| 370 | - { |
|
| 371 | - return $this->get('PMD_scope'); |
|
| 372 | - } |
|
| 373 | - |
|
| 374 | - |
|
| 375 | - /** |
|
| 376 | - * Sets scope |
|
| 377 | - * |
|
| 378 | - * @param array $scope |
|
| 379 | - */ |
|
| 380 | - public function set_scope($scope) |
|
| 381 | - { |
|
| 382 | - $this->set('PMD_scope', $scope); |
|
| 383 | - } |
|
| 384 | - |
|
| 385 | - |
|
| 386 | - /** |
|
| 387 | - * Gets the payment method type for this payment method instance |
|
| 388 | - * |
|
| 389 | - * @return EE_PMT_Base |
|
| 390 | - * @throws EE_Error |
|
| 391 | - */ |
|
| 392 | - public function type_obj() |
|
| 393 | - { |
|
| 394 | - if (! $this->_type_obj) { |
|
| 395 | - EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
| 396 | - if (EE_Payment_Method_Manager::instance()->payment_method_type_exists($this->type())) { |
|
| 397 | - $class_name = EE_Payment_Method_Manager::instance()->payment_method_class_from_type($this->type()); |
|
| 398 | - if (! class_exists($class_name)) { |
|
| 399 | - throw new EE_Error( |
|
| 400 | - sprintf( |
|
| 401 | - __( |
|
| 402 | - 'An attempt to use the "%1$s" payment method failed, so it was deactivated.%2$sWas the "%1$s" Plugin recently deactivated? It can be reactivated on the %3$sPlugins Admin Page%4$s', |
|
| 403 | - 'event_espresso' |
|
| 404 | - ), |
|
| 405 | - $class_name, |
|
| 406 | - '<br />', |
|
| 407 | - '<a href="' . admin_url('plugins.php') . '">', |
|
| 408 | - '</a>' |
|
| 409 | - ) |
|
| 410 | - ); |
|
| 411 | - } |
|
| 412 | - $r = new ReflectionClass($class_name); |
|
| 413 | - $this->_type_obj = $r->newInstanceArgs(array($this)); |
|
| 414 | - } else { |
|
| 415 | - throw new EE_Error( |
|
| 416 | - sprintf( |
|
| 417 | - __( |
|
| 418 | - 'A payment method of type "%1$s" does not exist. Only ones existing are: %2$s', |
|
| 419 | - 'event_espresso' |
|
| 420 | - ), |
|
| 421 | - $this->type(), |
|
| 422 | - implode(',', EE_Payment_Method_Manager::instance()->payment_method_type_names()) |
|
| 423 | - ) |
|
| 424 | - ); |
|
| 425 | - } |
|
| 426 | - } |
|
| 427 | - return $this->_type_obj; |
|
| 428 | - } |
|
| 429 | - |
|
| 430 | - |
|
| 431 | - /** |
|
| 432 | - * Returns a simple array of key-value pairs combining the payment method's fields (without the 'PMD_' prefix) |
|
| 433 | - * and the extra meta. Mostly used for passing off ot gateways. * |
|
| 434 | - * |
|
| 435 | - * @return array |
|
| 436 | - */ |
|
| 437 | - public function settings_array() |
|
| 438 | - { |
|
| 439 | - $fields = $this->model_field_array(); |
|
| 440 | - $extra_meta = $this->all_extra_meta_array(); |
|
| 441 | - // remove the model's prefix from the fields |
|
| 442 | - $combined_settings_array = array(); |
|
| 443 | - foreach ($fields as $key => $value) { |
|
| 444 | - if (strpos($key, 'PMD_') === 0) { |
|
| 445 | - $key_sans_model_prefix = str_replace('PMD_', '', $key); |
|
| 446 | - $combined_settings_array [ $key_sans_model_prefix ] = $value; |
|
| 447 | - } |
|
| 448 | - } |
|
| 449 | - $combined_settings_array = array_merge($extra_meta, $combined_settings_array); |
|
| 450 | - return $combined_settings_array; |
|
| 451 | - } |
|
| 452 | - |
|
| 453 | - |
|
| 454 | - /** |
|
| 455 | - * Gets the HTML for displaying the payment method on a page. |
|
| 456 | - * |
|
| 457 | - * @param string $url |
|
| 458 | - * @param string $css_class |
|
| 459 | - * @return string of HTML for displaying the button |
|
| 460 | - * @throws \EE_Error |
|
| 461 | - */ |
|
| 462 | - public function button_html($url = '', $css_class = '') |
|
| 463 | - { |
|
| 464 | - $payment_occurs = $this->type_obj()->payment_occurs(); |
|
| 465 | - return ' |
|
| 14 | + /** |
|
| 15 | + * Payment Method type object, which has all the info about this type of payment method, |
|
| 16 | + * including functions for processing payments, to get settings forms, etc. |
|
| 17 | + * |
|
| 18 | + * @var EE_PMT_Base |
|
| 19 | + */ |
|
| 20 | + protected $_type_obj; |
|
| 21 | + |
|
| 22 | + |
|
| 23 | + /** |
|
| 24 | + * @param array $props_n_values |
|
| 25 | + * @return EE_Payment_Method |
|
| 26 | + * @throws \EE_Error |
|
| 27 | + */ |
|
| 28 | + public static function new_instance($props_n_values = array()) |
|
| 29 | + { |
|
| 30 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
| 31 | + return $has_object ? $has_object : new self($props_n_values, false); |
|
| 32 | + } |
|
| 33 | + |
|
| 34 | + |
|
| 35 | + /** |
|
| 36 | + * @param array $props_n_values |
|
| 37 | + * @return EE_Payment_Method |
|
| 38 | + * @throws \EE_Error |
|
| 39 | + */ |
|
| 40 | + public static function new_instance_from_db($props_n_values = array()) |
|
| 41 | + { |
|
| 42 | + return new self($props_n_values, true); |
|
| 43 | + } |
|
| 44 | + |
|
| 45 | + |
|
| 46 | + |
|
| 47 | + /** |
|
| 48 | + * Checks if there is a payment method class of the given 'PMD_type', and if so returns the classname. |
|
| 49 | + * Otherwise returns a normal EE_Payment_Method |
|
| 50 | + * |
|
| 51 | + * @param array $props_n_values where 'PMD_type' is a gateway name like 'Paypal_Standard','Invoice',etc (basically |
|
| 52 | + * the classname minus 'EEPM_') |
|
| 53 | + * @return string |
|
| 54 | + */ |
|
| 55 | + // private static function _payment_method_type($props_n_values) |
|
| 56 | + // { |
|
| 57 | + // EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
| 58 | + // $type_string = isset($props_n_values['PMD_type']) ? $props_n_values['PMD_type'] : null; |
|
| 59 | + // if (EE_Payment_Method_Manager::instance()->payment_method_type_exists($type_string)) { |
|
| 60 | + // return 'EEPM_' . $type_string; |
|
| 61 | + // } else { |
|
| 62 | + // return __CLASS__; |
|
| 63 | + // } |
|
| 64 | + // } |
|
| 65 | + |
|
| 66 | + |
|
| 67 | + /** |
|
| 68 | + * Gets whether this payment method can be used anywhere at all (ie frontend cart, admin, etc) |
|
| 69 | + * |
|
| 70 | + * @return boolean |
|
| 71 | + */ |
|
| 72 | + public function active() |
|
| 73 | + { |
|
| 74 | + return array_intersect(array_keys(EEM_Payment_Method::instance()->scopes()), $this->scope()); |
|
| 75 | + } |
|
| 76 | + |
|
| 77 | + |
|
| 78 | + /** |
|
| 79 | + * Sets this PM as active by making it usable within the CART scope. Offline gateways |
|
| 80 | + * are also usable from the admin-scope as well. DOES NOT SAVE it |
|
| 81 | + * |
|
| 82 | + * @throws \EE_Error |
|
| 83 | + */ |
|
| 84 | + public function set_active() |
|
| 85 | + { |
|
| 86 | + $default_scopes = array(EEM_Payment_Method::scope_cart); |
|
| 87 | + if ( |
|
| 88 | + $this->type_obj() && |
|
| 89 | + $this->type_obj()->payment_occurs() === EE_PMT_Base::offline |
|
| 90 | + ) { |
|
| 91 | + $default_scopes[] = EEM_Payment_Method::scope_admin; |
|
| 92 | + } |
|
| 93 | + $this->set_scope($default_scopes); |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + |
|
| 97 | + /** |
|
| 98 | + * Makes this payment method apply to NO scopes at all. DOES NOT SAVE it. |
|
| 99 | + */ |
|
| 100 | + public function deactivate() |
|
| 101 | + { |
|
| 102 | + $this->set_scope(array()); |
|
| 103 | + } |
|
| 104 | + |
|
| 105 | + |
|
| 106 | + /** |
|
| 107 | + * Gets button_url |
|
| 108 | + * |
|
| 109 | + * @return string |
|
| 110 | + */ |
|
| 111 | + public function button_url() |
|
| 112 | + { |
|
| 113 | + return $this->get('PMD_button_url'); |
|
| 114 | + } |
|
| 115 | + |
|
| 116 | + |
|
| 117 | + /** |
|
| 118 | + * Sets button_url |
|
| 119 | + * |
|
| 120 | + * @param string $button_url |
|
| 121 | + */ |
|
| 122 | + public function set_button_url($button_url) |
|
| 123 | + { |
|
| 124 | + $this->set('PMD_button_url', $button_url); |
|
| 125 | + } |
|
| 126 | + |
|
| 127 | + |
|
| 128 | + /** |
|
| 129 | + * Gets debug_mode |
|
| 130 | + * |
|
| 131 | + * @return boolean |
|
| 132 | + */ |
|
| 133 | + public function debug_mode() |
|
| 134 | + { |
|
| 135 | + return $this->get('PMD_debug_mode'); |
|
| 136 | + } |
|
| 137 | + |
|
| 138 | + |
|
| 139 | + /** |
|
| 140 | + * Sets debug_mode |
|
| 141 | + * |
|
| 142 | + * @param boolean $debug_mode |
|
| 143 | + */ |
|
| 144 | + public function set_debug_mode($debug_mode) |
|
| 145 | + { |
|
| 146 | + $this->set('PMD_debug_mode', $debug_mode); |
|
| 147 | + } |
|
| 148 | + |
|
| 149 | + |
|
| 150 | + /** |
|
| 151 | + * Gets description |
|
| 152 | + * |
|
| 153 | + * @return string |
|
| 154 | + */ |
|
| 155 | + public function description() |
|
| 156 | + { |
|
| 157 | + return $this->get('PMD_desc'); |
|
| 158 | + } |
|
| 159 | + |
|
| 160 | + |
|
| 161 | + /** |
|
| 162 | + * Sets description |
|
| 163 | + * |
|
| 164 | + * @param string $description |
|
| 165 | + */ |
|
| 166 | + public function set_description($description) |
|
| 167 | + { |
|
| 168 | + $this->set('PMD_desc', $description); |
|
| 169 | + } |
|
| 170 | + |
|
| 171 | + |
|
| 172 | + /** |
|
| 173 | + * Gets name |
|
| 174 | + * |
|
| 175 | + * @return string |
|
| 176 | + */ |
|
| 177 | + public function name() |
|
| 178 | + { |
|
| 179 | + return $this->get('PMD_name'); |
|
| 180 | + } |
|
| 181 | + |
|
| 182 | + |
|
| 183 | + /** |
|
| 184 | + * Sets name |
|
| 185 | + * |
|
| 186 | + * @param string $name |
|
| 187 | + */ |
|
| 188 | + public function set_name($name) |
|
| 189 | + { |
|
| 190 | + $this->set('PMD_name', $name); |
|
| 191 | + } |
|
| 192 | + |
|
| 193 | + |
|
| 194 | + /** |
|
| 195 | + * Gets open_by_default |
|
| 196 | + * |
|
| 197 | + * @return boolean |
|
| 198 | + */ |
|
| 199 | + public function open_by_default() |
|
| 200 | + { |
|
| 201 | + return $this->get('PMD_open_by_default'); |
|
| 202 | + } |
|
| 203 | + |
|
| 204 | + |
|
| 205 | + /** |
|
| 206 | + * Sets open_by_default |
|
| 207 | + * |
|
| 208 | + * @param boolean $open_by_default |
|
| 209 | + */ |
|
| 210 | + public function set_open_by_default($open_by_default) |
|
| 211 | + { |
|
| 212 | + $this->set('PMD_open_by_default', $open_by_default); |
|
| 213 | + } |
|
| 214 | + |
|
| 215 | + |
|
| 216 | + /** |
|
| 217 | + * Gets order |
|
| 218 | + * |
|
| 219 | + * @return int |
|
| 220 | + */ |
|
| 221 | + public function order() |
|
| 222 | + { |
|
| 223 | + return $this->get('PMD_order'); |
|
| 224 | + } |
|
| 225 | + |
|
| 226 | + |
|
| 227 | + /** |
|
| 228 | + * Sets order |
|
| 229 | + * |
|
| 230 | + * @param int $order |
|
| 231 | + */ |
|
| 232 | + public function set_order($order) |
|
| 233 | + { |
|
| 234 | + $this->set('PMD_order', $order); |
|
| 235 | + } |
|
| 236 | + |
|
| 237 | + |
|
| 238 | + /** |
|
| 239 | + * Gets slug |
|
| 240 | + * |
|
| 241 | + * @return string |
|
| 242 | + */ |
|
| 243 | + public function slug() |
|
| 244 | + { |
|
| 245 | + return $this->get('PMD_slug'); |
|
| 246 | + } |
|
| 247 | + |
|
| 248 | + |
|
| 249 | + /** |
|
| 250 | + * Sets slug |
|
| 251 | + * |
|
| 252 | + * @param string $slug |
|
| 253 | + */ |
|
| 254 | + public function set_slug($slug) |
|
| 255 | + { |
|
| 256 | + $this->set('PMD_slug', $slug); |
|
| 257 | + } |
|
| 258 | + |
|
| 259 | + |
|
| 260 | + /** |
|
| 261 | + * Gets type |
|
| 262 | + * |
|
| 263 | + * @return string |
|
| 264 | + */ |
|
| 265 | + public function type() |
|
| 266 | + { |
|
| 267 | + return $this->get('PMD_type'); |
|
| 268 | + } |
|
| 269 | + |
|
| 270 | + |
|
| 271 | + /** |
|
| 272 | + * Sets type |
|
| 273 | + * |
|
| 274 | + * @param string $type |
|
| 275 | + */ |
|
| 276 | + public function set_type($type) |
|
| 277 | + { |
|
| 278 | + $this->set('PMD_type', $type); |
|
| 279 | + } |
|
| 280 | + |
|
| 281 | + |
|
| 282 | + /** |
|
| 283 | + * Gets wp_user |
|
| 284 | + * |
|
| 285 | + * @return int |
|
| 286 | + */ |
|
| 287 | + public function wp_user() |
|
| 288 | + { |
|
| 289 | + return $this->get('PMD_wp_user'); |
|
| 290 | + } |
|
| 291 | + |
|
| 292 | + |
|
| 293 | + /** |
|
| 294 | + * Sets wp_user |
|
| 295 | + * |
|
| 296 | + * @param int $wp_user_id |
|
| 297 | + */ |
|
| 298 | + public function set_wp_user($wp_user_id) |
|
| 299 | + { |
|
| 300 | + $this->set('PMD_wp_user', $wp_user_id); |
|
| 301 | + } |
|
| 302 | + |
|
| 303 | + /** |
|
| 304 | + * Overrides parent so when PMD_type is changed we refresh the _type_obj |
|
| 305 | + * |
|
| 306 | + * @param string $field_name |
|
| 307 | + * @param mixed $field_value |
|
| 308 | + * @param boolean $use_default |
|
| 309 | + */ |
|
| 310 | + public function set($field_name, $field_value, $use_default = false) |
|
| 311 | + { |
|
| 312 | + if ($field_name === 'PMD_type') { |
|
| 313 | + // the type has probably changed, so forget about its old type object |
|
| 314 | + $this->_type_obj = null; |
|
| 315 | + } |
|
| 316 | + parent::set($field_name, $field_value, $use_default); |
|
| 317 | + } |
|
| 318 | + |
|
| 319 | + |
|
| 320 | + /** |
|
| 321 | + * Gets admin_name |
|
| 322 | + * |
|
| 323 | + * @return string |
|
| 324 | + */ |
|
| 325 | + public function admin_name() |
|
| 326 | + { |
|
| 327 | + return $this->get('PMD_admin_name'); |
|
| 328 | + } |
|
| 329 | + |
|
| 330 | + |
|
| 331 | + /** |
|
| 332 | + * Sets admin_name |
|
| 333 | + * |
|
| 334 | + * @param string $admin_name |
|
| 335 | + */ |
|
| 336 | + public function set_admin_name($admin_name) |
|
| 337 | + { |
|
| 338 | + $this->set('PMD_admin_name', $admin_name); |
|
| 339 | + } |
|
| 340 | + |
|
| 341 | + |
|
| 342 | + /** |
|
| 343 | + * Gets admin_desc |
|
| 344 | + * |
|
| 345 | + * @return string |
|
| 346 | + */ |
|
| 347 | + public function admin_desc() |
|
| 348 | + { |
|
| 349 | + return $this->get('PMD_admin_desc'); |
|
| 350 | + } |
|
| 351 | + |
|
| 352 | + |
|
| 353 | + /** |
|
| 354 | + * Sets admin_desc |
|
| 355 | + * |
|
| 356 | + * @param string $admin_desc |
|
| 357 | + */ |
|
| 358 | + public function set_admin_desc($admin_desc) |
|
| 359 | + { |
|
| 360 | + $this->set('PMD_admin_desc', $admin_desc); |
|
| 361 | + } |
|
| 362 | + |
|
| 363 | + |
|
| 364 | + /** |
|
| 365 | + * Gets scope |
|
| 366 | + * |
|
| 367 | + * @return array |
|
| 368 | + */ |
|
| 369 | + public function scope() |
|
| 370 | + { |
|
| 371 | + return $this->get('PMD_scope'); |
|
| 372 | + } |
|
| 373 | + |
|
| 374 | + |
|
| 375 | + /** |
|
| 376 | + * Sets scope |
|
| 377 | + * |
|
| 378 | + * @param array $scope |
|
| 379 | + */ |
|
| 380 | + public function set_scope($scope) |
|
| 381 | + { |
|
| 382 | + $this->set('PMD_scope', $scope); |
|
| 383 | + } |
|
| 384 | + |
|
| 385 | + |
|
| 386 | + /** |
|
| 387 | + * Gets the payment method type for this payment method instance |
|
| 388 | + * |
|
| 389 | + * @return EE_PMT_Base |
|
| 390 | + * @throws EE_Error |
|
| 391 | + */ |
|
| 392 | + public function type_obj() |
|
| 393 | + { |
|
| 394 | + if (! $this->_type_obj) { |
|
| 395 | + EE_Registry::instance()->load_lib('Payment_Method_Manager'); |
|
| 396 | + if (EE_Payment_Method_Manager::instance()->payment_method_type_exists($this->type())) { |
|
| 397 | + $class_name = EE_Payment_Method_Manager::instance()->payment_method_class_from_type($this->type()); |
|
| 398 | + if (! class_exists($class_name)) { |
|
| 399 | + throw new EE_Error( |
|
| 400 | + sprintf( |
|
| 401 | + __( |
|
| 402 | + 'An attempt to use the "%1$s" payment method failed, so it was deactivated.%2$sWas the "%1$s" Plugin recently deactivated? It can be reactivated on the %3$sPlugins Admin Page%4$s', |
|
| 403 | + 'event_espresso' |
|
| 404 | + ), |
|
| 405 | + $class_name, |
|
| 406 | + '<br />', |
|
| 407 | + '<a href="' . admin_url('plugins.php') . '">', |
|
| 408 | + '</a>' |
|
| 409 | + ) |
|
| 410 | + ); |
|
| 411 | + } |
|
| 412 | + $r = new ReflectionClass($class_name); |
|
| 413 | + $this->_type_obj = $r->newInstanceArgs(array($this)); |
|
| 414 | + } else { |
|
| 415 | + throw new EE_Error( |
|
| 416 | + sprintf( |
|
| 417 | + __( |
|
| 418 | + 'A payment method of type "%1$s" does not exist. Only ones existing are: %2$s', |
|
| 419 | + 'event_espresso' |
|
| 420 | + ), |
|
| 421 | + $this->type(), |
|
| 422 | + implode(',', EE_Payment_Method_Manager::instance()->payment_method_type_names()) |
|
| 423 | + ) |
|
| 424 | + ); |
|
| 425 | + } |
|
| 426 | + } |
|
| 427 | + return $this->_type_obj; |
|
| 428 | + } |
|
| 429 | + |
|
| 430 | + |
|
| 431 | + /** |
|
| 432 | + * Returns a simple array of key-value pairs combining the payment method's fields (without the 'PMD_' prefix) |
|
| 433 | + * and the extra meta. Mostly used for passing off ot gateways. * |
|
| 434 | + * |
|
| 435 | + * @return array |
|
| 436 | + */ |
|
| 437 | + public function settings_array() |
|
| 438 | + { |
|
| 439 | + $fields = $this->model_field_array(); |
|
| 440 | + $extra_meta = $this->all_extra_meta_array(); |
|
| 441 | + // remove the model's prefix from the fields |
|
| 442 | + $combined_settings_array = array(); |
|
| 443 | + foreach ($fields as $key => $value) { |
|
| 444 | + if (strpos($key, 'PMD_') === 0) { |
|
| 445 | + $key_sans_model_prefix = str_replace('PMD_', '', $key); |
|
| 446 | + $combined_settings_array [ $key_sans_model_prefix ] = $value; |
|
| 447 | + } |
|
| 448 | + } |
|
| 449 | + $combined_settings_array = array_merge($extra_meta, $combined_settings_array); |
|
| 450 | + return $combined_settings_array; |
|
| 451 | + } |
|
| 452 | + |
|
| 453 | + |
|
| 454 | + /** |
|
| 455 | + * Gets the HTML for displaying the payment method on a page. |
|
| 456 | + * |
|
| 457 | + * @param string $url |
|
| 458 | + * @param string $css_class |
|
| 459 | + * @return string of HTML for displaying the button |
|
| 460 | + * @throws \EE_Error |
|
| 461 | + */ |
|
| 462 | + public function button_html($url = '', $css_class = '') |
|
| 463 | + { |
|
| 464 | + $payment_occurs = $this->type_obj()->payment_occurs(); |
|
| 465 | + return ' |
|
| 466 | 466 | <div id="' |
| 467 | - . $this->slug() |
|
| 468 | - . '-payment-option-dv" class="' |
|
| 469 | - . $payment_occurs . '-payment-gateway reg-page-payment-option-dv' . $css_class . '"> |
|
| 467 | + . $this->slug() |
|
| 468 | + . '-payment-option-dv" class="' |
|
| 469 | + . $payment_occurs . '-payment-gateway reg-page-payment-option-dv' . $css_class . '"> |
|
| 470 | 470 | <a id="payment-gateway-button-' . $this->slug() |
| 471 | - . '" class="reg-page-payment-option-lnk" rel="' |
|
| 472 | - . $this->slug() . '" href="' . $url . '" > |
|
| 471 | + . '" class="reg-page-payment-option-lnk" rel="' |
|
| 472 | + . $this->slug() . '" href="' . $url . '" > |
|
| 473 | 473 | <img src="' . $this->button_url() . '" alt="' . sprintf( |
| 474 | - esc_attr__('Pay using %s', 'event_espresso'), |
|
| 475 | - $this->get_pretty('PMD_name', 'form_input') |
|
| 476 | - ) . '" /> |
|
| 474 | + esc_attr__('Pay using %s', 'event_espresso'), |
|
| 475 | + $this->get_pretty('PMD_name', 'form_input') |
|
| 476 | + ) . '" /> |
|
| 477 | 477 | </a> |
| 478 | 478 | </div> |
| 479 | 479 | '; |
| 480 | - } |
|
| 481 | - |
|
| 482 | - |
|
| 483 | - /** |
|
| 484 | - * Gets all the currencies which are an option for this payment method |
|
| 485 | - * (as defined by the gateway and the currently active currencies) |
|
| 486 | - * |
|
| 487 | - * @return EE_Currency[] |
|
| 488 | - * @throws \EE_Error |
|
| 489 | - */ |
|
| 490 | - public function get_all_usable_currencies() |
|
| 491 | - { |
|
| 492 | - return EEM_Currency::instance()->get_all_currencies_usable_by($this->type_obj()); |
|
| 493 | - } |
|
| 494 | - |
|
| 495 | - |
|
| 496 | - /** |
|
| 497 | - * Reports whether or not this payment method can be used for this payment method |
|
| 498 | - * |
|
| 499 | - * @param string $currency_code currency ID (code) |
|
| 500 | - * @return boolean |
|
| 501 | - * @throws \EE_Error |
|
| 502 | - */ |
|
| 503 | - public function usable_for_currency($currency_code) |
|
| 504 | - { |
|
| 505 | - foreach ($this->get_all_usable_currencies() as $currency_obj) { |
|
| 506 | - if ($currency_obj->ID() === $currency_code) { |
|
| 507 | - return true; |
|
| 508 | - } |
|
| 509 | - } |
|
| 510 | - return false; |
|
| 511 | - } |
|
| 512 | - |
|
| 513 | - |
|
| 514 | - /** |
|
| 515 | - * Returns TRUE if this payment method's gateway is an instance of EE_Onsite_Gateway |
|
| 516 | - * |
|
| 517 | - * @return bool |
|
| 518 | - * @throws \EE_Error |
|
| 519 | - */ |
|
| 520 | - public function is_on_site() |
|
| 521 | - { |
|
| 522 | - return $this->type_obj()->payment_occurs() === EE_PMT_Base::onsite; |
|
| 523 | - } |
|
| 524 | - |
|
| 525 | - |
|
| 526 | - /** |
|
| 527 | - * Returns TRUE if this payment method's gateway is an instance of EE_Offsite_Gateway |
|
| 528 | - * |
|
| 529 | - * @return bool |
|
| 530 | - * @throws \EE_Error |
|
| 531 | - */ |
|
| 532 | - public function is_off_site() |
|
| 533 | - { |
|
| 534 | - return $this->type_obj()->payment_occurs() === EE_PMT_Base::offsite; |
|
| 535 | - } |
|
| 536 | - |
|
| 537 | - |
|
| 538 | - /** |
|
| 539 | - * Returns TRUE if this payment method does not utilize a gateway |
|
| 540 | - * |
|
| 541 | - * @return bool |
|
| 542 | - * @throws \EE_Error |
|
| 543 | - */ |
|
| 544 | - public function is_off_line() |
|
| 545 | - { |
|
| 546 | - return $this->type_obj()->payment_occurs() === EE_PMT_Base::offline; |
|
| 547 | - } |
|
| 548 | - |
|
| 549 | - /** |
|
| 550 | - * Overrides default __sleep so the object type is NOT cached. |
|
| 551 | - * This way we can rely on the normal EE_Payment_Method::type_obj() logic |
|
| 552 | - * to load the required classes, and don't need them at the time of unserialization |
|
| 553 | - * |
|
| 554 | - * @return array |
|
| 555 | - */ |
|
| 556 | - public function __sleep() |
|
| 557 | - { |
|
| 558 | - $properties = get_object_vars($this); |
|
| 559 | - unset($properties['_type_obj']); |
|
| 560 | - return array_keys($properties); |
|
| 561 | - } |
|
| 562 | - |
|
| 563 | - |
|
| 564 | - /** |
|
| 565 | - * Overrides parent to add some logging for when payment methods get deactivated |
|
| 566 | - * |
|
| 567 | - * @param array $set_cols_n_values |
|
| 568 | - * @return int @see EE_Base_Class::save() |
|
| 569 | - * @throws \EE_Error |
|
| 570 | - */ |
|
| 571 | - public function save($set_cols_n_values = array()) |
|
| 572 | - { |
|
| 573 | - $results = parent::save($set_cols_n_values); |
|
| 574 | - if ($this->get_original('PMD_scope') !== $this->get('PMD_scope')) { |
|
| 575 | - EE_Log::instance()->log( |
|
| 576 | - __FILE__, |
|
| 577 | - __FUNCTION__, |
|
| 578 | - sprintf( |
|
| 579 | - __('Set new scope on payment method %1$s to %2$s from %3$s on URL %4$s', 'event_espresso'), |
|
| 580 | - $this->name(), |
|
| 581 | - serialize($this->get_original('PMD_scope')), |
|
| 582 | - serialize($this->get('PMD_scope')), |
|
| 583 | - EE_Registry::instance()->REQ->get_current_page_permalink() |
|
| 584 | - ), |
|
| 585 | - 'payment_method_change' |
|
| 586 | - ); |
|
| 587 | - } |
|
| 588 | - return $results; |
|
| 589 | - } |
|
| 480 | + } |
|
| 481 | + |
|
| 482 | + |
|
| 483 | + /** |
|
| 484 | + * Gets all the currencies which are an option for this payment method |
|
| 485 | + * (as defined by the gateway and the currently active currencies) |
|
| 486 | + * |
|
| 487 | + * @return EE_Currency[] |
|
| 488 | + * @throws \EE_Error |
|
| 489 | + */ |
|
| 490 | + public function get_all_usable_currencies() |
|
| 491 | + { |
|
| 492 | + return EEM_Currency::instance()->get_all_currencies_usable_by($this->type_obj()); |
|
| 493 | + } |
|
| 494 | + |
|
| 495 | + |
|
| 496 | + /** |
|
| 497 | + * Reports whether or not this payment method can be used for this payment method |
|
| 498 | + * |
|
| 499 | + * @param string $currency_code currency ID (code) |
|
| 500 | + * @return boolean |
|
| 501 | + * @throws \EE_Error |
|
| 502 | + */ |
|
| 503 | + public function usable_for_currency($currency_code) |
|
| 504 | + { |
|
| 505 | + foreach ($this->get_all_usable_currencies() as $currency_obj) { |
|
| 506 | + if ($currency_obj->ID() === $currency_code) { |
|
| 507 | + return true; |
|
| 508 | + } |
|
| 509 | + } |
|
| 510 | + return false; |
|
| 511 | + } |
|
| 512 | + |
|
| 513 | + |
|
| 514 | + /** |
|
| 515 | + * Returns TRUE if this payment method's gateway is an instance of EE_Onsite_Gateway |
|
| 516 | + * |
|
| 517 | + * @return bool |
|
| 518 | + * @throws \EE_Error |
|
| 519 | + */ |
|
| 520 | + public function is_on_site() |
|
| 521 | + { |
|
| 522 | + return $this->type_obj()->payment_occurs() === EE_PMT_Base::onsite; |
|
| 523 | + } |
|
| 524 | + |
|
| 525 | + |
|
| 526 | + /** |
|
| 527 | + * Returns TRUE if this payment method's gateway is an instance of EE_Offsite_Gateway |
|
| 528 | + * |
|
| 529 | + * @return bool |
|
| 530 | + * @throws \EE_Error |
|
| 531 | + */ |
|
| 532 | + public function is_off_site() |
|
| 533 | + { |
|
| 534 | + return $this->type_obj()->payment_occurs() === EE_PMT_Base::offsite; |
|
| 535 | + } |
|
| 536 | + |
|
| 537 | + |
|
| 538 | + /** |
|
| 539 | + * Returns TRUE if this payment method does not utilize a gateway |
|
| 540 | + * |
|
| 541 | + * @return bool |
|
| 542 | + * @throws \EE_Error |
|
| 543 | + */ |
|
| 544 | + public function is_off_line() |
|
| 545 | + { |
|
| 546 | + return $this->type_obj()->payment_occurs() === EE_PMT_Base::offline; |
|
| 547 | + } |
|
| 548 | + |
|
| 549 | + /** |
|
| 550 | + * Overrides default __sleep so the object type is NOT cached. |
|
| 551 | + * This way we can rely on the normal EE_Payment_Method::type_obj() logic |
|
| 552 | + * to load the required classes, and don't need them at the time of unserialization |
|
| 553 | + * |
|
| 554 | + * @return array |
|
| 555 | + */ |
|
| 556 | + public function __sleep() |
|
| 557 | + { |
|
| 558 | + $properties = get_object_vars($this); |
|
| 559 | + unset($properties['_type_obj']); |
|
| 560 | + return array_keys($properties); |
|
| 561 | + } |
|
| 562 | + |
|
| 563 | + |
|
| 564 | + /** |
|
| 565 | + * Overrides parent to add some logging for when payment methods get deactivated |
|
| 566 | + * |
|
| 567 | + * @param array $set_cols_n_values |
|
| 568 | + * @return int @see EE_Base_Class::save() |
|
| 569 | + * @throws \EE_Error |
|
| 570 | + */ |
|
| 571 | + public function save($set_cols_n_values = array()) |
|
| 572 | + { |
|
| 573 | + $results = parent::save($set_cols_n_values); |
|
| 574 | + if ($this->get_original('PMD_scope') !== $this->get('PMD_scope')) { |
|
| 575 | + EE_Log::instance()->log( |
|
| 576 | + __FILE__, |
|
| 577 | + __FUNCTION__, |
|
| 578 | + sprintf( |
|
| 579 | + __('Set new scope on payment method %1$s to %2$s from %3$s on URL %4$s', 'event_espresso'), |
|
| 580 | + $this->name(), |
|
| 581 | + serialize($this->get_original('PMD_scope')), |
|
| 582 | + serialize($this->get('PMD_scope')), |
|
| 583 | + EE_Registry::instance()->REQ->get_current_page_permalink() |
|
| 584 | + ), |
|
| 585 | + 'payment_method_change' |
|
| 586 | + ); |
|
| 587 | + } |
|
| 588 | + return $results; |
|
| 589 | + } |
|
| 590 | 590 | } |
@@ -6,23 +6,23 @@ |
||
| 6 | 6 | class EE_Event_Venue extends EE_Base_Class |
| 7 | 7 | { |
| 8 | 8 | |
| 9 | - /** |
|
| 10 | - * @param array $props_n_values |
|
| 11 | - * @return EE_Event_Venue|mixed |
|
| 12 | - */ |
|
| 13 | - public static function new_instance($props_n_values = array()) |
|
| 14 | - { |
|
| 15 | - $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
| 16 | - return $has_object ? $has_object : new self($props_n_values); |
|
| 17 | - } |
|
| 9 | + /** |
|
| 10 | + * @param array $props_n_values |
|
| 11 | + * @return EE_Event_Venue|mixed |
|
| 12 | + */ |
|
| 13 | + public static function new_instance($props_n_values = array()) |
|
| 14 | + { |
|
| 15 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
| 16 | + return $has_object ? $has_object : new self($props_n_values); |
|
| 17 | + } |
|
| 18 | 18 | |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * @param array $props_n_values |
|
| 22 | - * @return EE_Event_Venue |
|
| 23 | - */ |
|
| 24 | - public static function new_instance_from_db($props_n_values = array()) |
|
| 25 | - { |
|
| 26 | - return new self($props_n_values, true); |
|
| 27 | - } |
|
| 20 | + /** |
|
| 21 | + * @param array $props_n_values |
|
| 22 | + * @return EE_Event_Venue |
|
| 23 | + */ |
|
| 24 | + public static function new_instance_from_db($props_n_values = array()) |
|
| 25 | + { |
|
| 26 | + return new self($props_n_values, true); |
|
| 27 | + } |
|
| 28 | 28 | } |
@@ -12,53 +12,53 @@ |
||
| 12 | 12 | { |
| 13 | 13 | |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * Overrides parent _delete() so that we do soft deletes. |
|
| 17 | - * |
|
| 18 | - * @return bool|int |
|
| 19 | - */ |
|
| 20 | - protected function _delete() |
|
| 21 | - { |
|
| 22 | - return $this->delete_or_restore(); |
|
| 23 | - } |
|
| 15 | + /** |
|
| 16 | + * Overrides parent _delete() so that we do soft deletes. |
|
| 17 | + * |
|
| 18 | + * @return bool|int |
|
| 19 | + */ |
|
| 20 | + protected function _delete() |
|
| 21 | + { |
|
| 22 | + return $this->delete_or_restore(); |
|
| 23 | + } |
|
| 24 | 24 | |
| 25 | 25 | |
| 26 | - /** |
|
| 27 | - * Deletes or restores this object. |
|
| 28 | - * |
|
| 29 | - * @param bool $delete true=>delete, false=>restore |
|
| 30 | - * @return bool|int |
|
| 31 | - */ |
|
| 32 | - public function delete_or_restore($delete = true) |
|
| 33 | - { |
|
| 34 | - /** |
|
| 35 | - * Called just before trashing (soft delete) or restoring a trashed item. |
|
| 36 | - * |
|
| 37 | - * @param EE_Base_Class $model_object about to be trashed or restored |
|
| 38 | - * @param bool $delete true the item is being trashed, false the item is being restored. |
|
| 39 | - */ |
|
| 40 | - do_action('AHEE__EE_Soft_Delete_Base_Class__delete_or_restore__before', $this, $delete); |
|
| 41 | - $model = $this->get_model(); |
|
| 42 | - $result = $model->delete_or_restore_by_ID($delete, $this->ID()); |
|
| 43 | - /** |
|
| 44 | - * Called just after trashing (soft delete) or restoring a trashed item. |
|
| 45 | - * |
|
| 46 | - * @param EE_Base_Class $model_object that was just trashed or restored. |
|
| 47 | - * @param bool $delete true the item is being trashed, false the item is being restored. |
|
| 48 | - * @param bool|int $result |
|
| 49 | - */ |
|
| 50 | - do_action('AHEE__EE_Soft_Delete_Base_Class__delete_or_restore__after', $this, $delete, $result); |
|
| 51 | - return $result; |
|
| 52 | - } |
|
| 26 | + /** |
|
| 27 | + * Deletes or restores this object. |
|
| 28 | + * |
|
| 29 | + * @param bool $delete true=>delete, false=>restore |
|
| 30 | + * @return bool|int |
|
| 31 | + */ |
|
| 32 | + public function delete_or_restore($delete = true) |
|
| 33 | + { |
|
| 34 | + /** |
|
| 35 | + * Called just before trashing (soft delete) or restoring a trashed item. |
|
| 36 | + * |
|
| 37 | + * @param EE_Base_Class $model_object about to be trashed or restored |
|
| 38 | + * @param bool $delete true the item is being trashed, false the item is being restored. |
|
| 39 | + */ |
|
| 40 | + do_action('AHEE__EE_Soft_Delete_Base_Class__delete_or_restore__before', $this, $delete); |
|
| 41 | + $model = $this->get_model(); |
|
| 42 | + $result = $model->delete_or_restore_by_ID($delete, $this->ID()); |
|
| 43 | + /** |
|
| 44 | + * Called just after trashing (soft delete) or restoring a trashed item. |
|
| 45 | + * |
|
| 46 | + * @param EE_Base_Class $model_object that was just trashed or restored. |
|
| 47 | + * @param bool $delete true the item is being trashed, false the item is being restored. |
|
| 48 | + * @param bool|int $result |
|
| 49 | + */ |
|
| 50 | + do_action('AHEE__EE_Soft_Delete_Base_Class__delete_or_restore__after', $this, $delete, $result); |
|
| 51 | + return $result; |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | 54 | |
| 55 | - /** |
|
| 56 | - * Performs a restoration (un-deletes) this object |
|
| 57 | - * |
|
| 58 | - * @return bool|int |
|
| 59 | - */ |
|
| 60 | - public function restore() |
|
| 61 | - { |
|
| 62 | - return $this->delete_or_restore(false); |
|
| 63 | - } |
|
| 55 | + /** |
|
| 56 | + * Performs a restoration (un-deletes) this object |
|
| 57 | + * |
|
| 58 | + * @return bool|int |
|
| 59 | + */ |
|
| 60 | + public function restore() |
|
| 61 | + { |
|
| 62 | + return $this->delete_or_restore(false); |
|
| 63 | + } |
|
| 64 | 64 | } |
@@ -6,23 +6,23 @@ |
||
| 6 | 6 | class EE_Event_Question_Group extends EE_Base_Class |
| 7 | 7 | { |
| 8 | 8 | |
| 9 | - /** |
|
| 10 | - * @param array $props_n_values |
|
| 11 | - * @return EE_Event_Question_Group|mixed |
|
| 12 | - */ |
|
| 13 | - public static function new_instance($props_n_values = array()) |
|
| 14 | - { |
|
| 15 | - $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
| 16 | - return $has_object ? $has_object : new self($props_n_values); |
|
| 17 | - } |
|
| 9 | + /** |
|
| 10 | + * @param array $props_n_values |
|
| 11 | + * @return EE_Event_Question_Group|mixed |
|
| 12 | + */ |
|
| 13 | + public static function new_instance($props_n_values = array()) |
|
| 14 | + { |
|
| 15 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
| 16 | + return $has_object ? $has_object : new self($props_n_values); |
|
| 17 | + } |
|
| 18 | 18 | |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * @param array $props_n_values |
|
| 22 | - * @return EE_Event_Question_Group |
|
| 23 | - */ |
|
| 24 | - public static function new_instance_from_db($props_n_values = array()) |
|
| 25 | - { |
|
| 26 | - return new self($props_n_values, true); |
|
| 27 | - } |
|
| 20 | + /** |
|
| 21 | + * @param array $props_n_values |
|
| 22 | + * @return EE_Event_Question_Group |
|
| 23 | + */ |
|
| 24 | + public static function new_instance_from_db($props_n_values = array()) |
|
| 25 | + { |
|
| 26 | + return new self($props_n_values, true); |
|
| 27 | + } |
|
| 28 | 28 | } |
@@ -12,142 +12,142 @@ |
||
| 12 | 12 | class EE_Status extends EE_Base_Class |
| 13 | 13 | { |
| 14 | 14 | |
| 15 | - /** |
|
| 16 | - * @param array $props_n_values |
|
| 17 | - * @return EE_Status |
|
| 18 | - */ |
|
| 19 | - public static function new_instance($props_n_values = array()) |
|
| 20 | - { |
|
| 21 | - $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
| 22 | - return $has_object ? $has_object : new self($props_n_values); |
|
| 23 | - } |
|
| 24 | - |
|
| 25 | - |
|
| 26 | - /** |
|
| 27 | - * @param array $props_n_values |
|
| 28 | - * @return EE_Status |
|
| 29 | - */ |
|
| 30 | - public static function new_instance_from_db($props_n_values = array()) |
|
| 31 | - { |
|
| 32 | - return new self($props_n_values, true); |
|
| 33 | - } |
|
| 34 | - |
|
| 35 | - |
|
| 36 | - /** |
|
| 37 | - * Gets code |
|
| 38 | - * |
|
| 39 | - * @param bool $plural |
|
| 40 | - * @param string $schema |
|
| 41 | - * @return string |
|
| 42 | - */ |
|
| 43 | - public function code($plural = false, $schema = 'upper') |
|
| 44 | - { |
|
| 45 | - $id = $this->get('STS_ID'); |
|
| 46 | - $code = EEM_Status::instance()->localized_status(array($id => $this->get('STS_code')), $plural, $schema); |
|
| 47 | - return $code[ $id ]; |
|
| 48 | - } |
|
| 49 | - |
|
| 50 | - |
|
| 51 | - /** |
|
| 52 | - * Sets code |
|
| 53 | - * |
|
| 54 | - * @param string $code |
|
| 55 | - * @return boolean |
|
| 56 | - */ |
|
| 57 | - public function set_code($code) |
|
| 58 | - { |
|
| 59 | - $this->set('STS_code', $code); |
|
| 60 | - } |
|
| 61 | - |
|
| 62 | - |
|
| 63 | - /** |
|
| 64 | - * Gets desc |
|
| 65 | - * |
|
| 66 | - * @return string |
|
| 67 | - */ |
|
| 68 | - public function desc() |
|
| 69 | - { |
|
| 70 | - return $this->get('STS_desc'); |
|
| 71 | - } |
|
| 72 | - |
|
| 73 | - |
|
| 74 | - /** |
|
| 75 | - * Sets desc |
|
| 76 | - * |
|
| 77 | - * @param string $desc |
|
| 78 | - * @return boolean |
|
| 79 | - */ |
|
| 80 | - public function set_desc($desc) |
|
| 81 | - { |
|
| 82 | - $this->set('STS_desc', $desc); |
|
| 83 | - } |
|
| 84 | - |
|
| 85 | - |
|
| 86 | - /** |
|
| 87 | - * Gets type |
|
| 88 | - * |
|
| 89 | - * @return string |
|
| 90 | - */ |
|
| 91 | - public function type() |
|
| 92 | - { |
|
| 93 | - return $this->get('STS_type'); |
|
| 94 | - } |
|
| 95 | - |
|
| 96 | - |
|
| 97 | - /** |
|
| 98 | - * Sets type |
|
| 99 | - * |
|
| 100 | - * @param string $type |
|
| 101 | - * @return boolean |
|
| 102 | - */ |
|
| 103 | - public function set_type($type) |
|
| 104 | - { |
|
| 105 | - $this->set('STS_type', $type); |
|
| 106 | - } |
|
| 107 | - |
|
| 108 | - |
|
| 109 | - /** |
|
| 110 | - * Gets can_edit |
|
| 111 | - * |
|
| 112 | - * @return boolean |
|
| 113 | - */ |
|
| 114 | - public function can_edit() |
|
| 115 | - { |
|
| 116 | - return $this->get('STS_can_edit'); |
|
| 117 | - } |
|
| 118 | - |
|
| 119 | - |
|
| 120 | - /** |
|
| 121 | - * Sets can_edit |
|
| 122 | - * |
|
| 123 | - * @param boolean $can_edit |
|
| 124 | - * @return boolean |
|
| 125 | - */ |
|
| 126 | - public function set_can_edit($can_edit) |
|
| 127 | - { |
|
| 128 | - $this->set('STS_can_edit', $can_edit); |
|
| 129 | - } |
|
| 130 | - |
|
| 131 | - |
|
| 132 | - /** |
|
| 133 | - * Gets open |
|
| 134 | - * |
|
| 135 | - * @return boolean |
|
| 136 | - */ |
|
| 137 | - public function open() |
|
| 138 | - { |
|
| 139 | - return $this->get('STS_open'); |
|
| 140 | - } |
|
| 141 | - |
|
| 142 | - |
|
| 143 | - /** |
|
| 144 | - * Sets open |
|
| 145 | - * |
|
| 146 | - * @param boolean $open |
|
| 147 | - * @return boolean |
|
| 148 | - */ |
|
| 149 | - public function set_open($open) |
|
| 150 | - { |
|
| 151 | - $this->set('STS_open', $open); |
|
| 152 | - } |
|
| 15 | + /** |
|
| 16 | + * @param array $props_n_values |
|
| 17 | + * @return EE_Status |
|
| 18 | + */ |
|
| 19 | + public static function new_instance($props_n_values = array()) |
|
| 20 | + { |
|
| 21 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
| 22 | + return $has_object ? $has_object : new self($props_n_values); |
|
| 23 | + } |
|
| 24 | + |
|
| 25 | + |
|
| 26 | + /** |
|
| 27 | + * @param array $props_n_values |
|
| 28 | + * @return EE_Status |
|
| 29 | + */ |
|
| 30 | + public static function new_instance_from_db($props_n_values = array()) |
|
| 31 | + { |
|
| 32 | + return new self($props_n_values, true); |
|
| 33 | + } |
|
| 34 | + |
|
| 35 | + |
|
| 36 | + /** |
|
| 37 | + * Gets code |
|
| 38 | + * |
|
| 39 | + * @param bool $plural |
|
| 40 | + * @param string $schema |
|
| 41 | + * @return string |
|
| 42 | + */ |
|
| 43 | + public function code($plural = false, $schema = 'upper') |
|
| 44 | + { |
|
| 45 | + $id = $this->get('STS_ID'); |
|
| 46 | + $code = EEM_Status::instance()->localized_status(array($id => $this->get('STS_code')), $plural, $schema); |
|
| 47 | + return $code[ $id ]; |
|
| 48 | + } |
|
| 49 | + |
|
| 50 | + |
|
| 51 | + /** |
|
| 52 | + * Sets code |
|
| 53 | + * |
|
| 54 | + * @param string $code |
|
| 55 | + * @return boolean |
|
| 56 | + */ |
|
| 57 | + public function set_code($code) |
|
| 58 | + { |
|
| 59 | + $this->set('STS_code', $code); |
|
| 60 | + } |
|
| 61 | + |
|
| 62 | + |
|
| 63 | + /** |
|
| 64 | + * Gets desc |
|
| 65 | + * |
|
| 66 | + * @return string |
|
| 67 | + */ |
|
| 68 | + public function desc() |
|
| 69 | + { |
|
| 70 | + return $this->get('STS_desc'); |
|
| 71 | + } |
|
| 72 | + |
|
| 73 | + |
|
| 74 | + /** |
|
| 75 | + * Sets desc |
|
| 76 | + * |
|
| 77 | + * @param string $desc |
|
| 78 | + * @return boolean |
|
| 79 | + */ |
|
| 80 | + public function set_desc($desc) |
|
| 81 | + { |
|
| 82 | + $this->set('STS_desc', $desc); |
|
| 83 | + } |
|
| 84 | + |
|
| 85 | + |
|
| 86 | + /** |
|
| 87 | + * Gets type |
|
| 88 | + * |
|
| 89 | + * @return string |
|
| 90 | + */ |
|
| 91 | + public function type() |
|
| 92 | + { |
|
| 93 | + return $this->get('STS_type'); |
|
| 94 | + } |
|
| 95 | + |
|
| 96 | + |
|
| 97 | + /** |
|
| 98 | + * Sets type |
|
| 99 | + * |
|
| 100 | + * @param string $type |
|
| 101 | + * @return boolean |
|
| 102 | + */ |
|
| 103 | + public function set_type($type) |
|
| 104 | + { |
|
| 105 | + $this->set('STS_type', $type); |
|
| 106 | + } |
|
| 107 | + |
|
| 108 | + |
|
| 109 | + /** |
|
| 110 | + * Gets can_edit |
|
| 111 | + * |
|
| 112 | + * @return boolean |
|
| 113 | + */ |
|
| 114 | + public function can_edit() |
|
| 115 | + { |
|
| 116 | + return $this->get('STS_can_edit'); |
|
| 117 | + } |
|
| 118 | + |
|
| 119 | + |
|
| 120 | + /** |
|
| 121 | + * Sets can_edit |
|
| 122 | + * |
|
| 123 | + * @param boolean $can_edit |
|
| 124 | + * @return boolean |
|
| 125 | + */ |
|
| 126 | + public function set_can_edit($can_edit) |
|
| 127 | + { |
|
| 128 | + $this->set('STS_can_edit', $can_edit); |
|
| 129 | + } |
|
| 130 | + |
|
| 131 | + |
|
| 132 | + /** |
|
| 133 | + * Gets open |
|
| 134 | + * |
|
| 135 | + * @return boolean |
|
| 136 | + */ |
|
| 137 | + public function open() |
|
| 138 | + { |
|
| 139 | + return $this->get('STS_open'); |
|
| 140 | + } |
|
| 141 | + |
|
| 142 | + |
|
| 143 | + /** |
|
| 144 | + * Sets open |
|
| 145 | + * |
|
| 146 | + * @param boolean $open |
|
| 147 | + * @return boolean |
|
| 148 | + */ |
|
| 149 | + public function set_open($open) |
|
| 150 | + { |
|
| 151 | + $this->set('STS_open', $open); |
|
| 152 | + } |
|
| 153 | 153 | } |
@@ -44,7 +44,7 @@ |
||
| 44 | 44 | { |
| 45 | 45 | $id = $this->get('STS_ID'); |
| 46 | 46 | $code = EEM_Status::instance()->localized_status(array($id => $this->get('STS_code')), $plural, $schema); |
| 47 | - return $code[ $id ]; |
|
| 47 | + return $code[$id]; |
|
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | |
@@ -12,87 +12,87 @@ |
||
| 12 | 12 | class EE_Term extends EE_Base_Class |
| 13 | 13 | { |
| 14 | 14 | |
| 15 | - public $post_type; |
|
| 15 | + public $post_type; |
|
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * Sets some dynamic defaults |
|
| 19 | - * |
|
| 20 | - * @param array $fieldValues |
|
| 21 | - * @param bool $bydb |
|
| 22 | - * @param string $timezone |
|
| 23 | - */ |
|
| 24 | - protected function __construct($fieldValues = array(), $bydb = false, $timezone = '') |
|
| 25 | - { |
|
| 26 | - if (! isset($fieldValues['slug'])) { |
|
| 27 | - $fieldValues['slug'] = $fieldValues['name']; |
|
| 28 | - } |
|
| 29 | - parent::__construct($fieldValues, $bydb, $timezone); |
|
| 30 | - } |
|
| 17 | + /** |
|
| 18 | + * Sets some dynamic defaults |
|
| 19 | + * |
|
| 20 | + * @param array $fieldValues |
|
| 21 | + * @param bool $bydb |
|
| 22 | + * @param string $timezone |
|
| 23 | + */ |
|
| 24 | + protected function __construct($fieldValues = array(), $bydb = false, $timezone = '') |
|
| 25 | + { |
|
| 26 | + if (! isset($fieldValues['slug'])) { |
|
| 27 | + $fieldValues['slug'] = $fieldValues['name']; |
|
| 28 | + } |
|
| 29 | + parent::__construct($fieldValues, $bydb, $timezone); |
|
| 30 | + } |
|
| 31 | 31 | |
| 32 | 32 | |
| 33 | - /** |
|
| 34 | - * @param array $props_n_values |
|
| 35 | - * @return EE_Term|mixed |
|
| 36 | - */ |
|
| 37 | - public static function new_instance($props_n_values = array()) |
|
| 38 | - { |
|
| 39 | - $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
| 40 | - return $has_object ? $has_object : new self($props_n_values); |
|
| 41 | - } |
|
| 33 | + /** |
|
| 34 | + * @param array $props_n_values |
|
| 35 | + * @return EE_Term|mixed |
|
| 36 | + */ |
|
| 37 | + public static function new_instance($props_n_values = array()) |
|
| 38 | + { |
|
| 39 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
| 40 | + return $has_object ? $has_object : new self($props_n_values); |
|
| 41 | + } |
|
| 42 | 42 | |
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * @param array $props_n_values |
|
| 46 | - * @return EE_Term |
|
| 47 | - */ |
|
| 48 | - public static function new_instance_from_db($props_n_values = array()) |
|
| 49 | - { |
|
| 50 | - return new self($props_n_values, true); |
|
| 51 | - } |
|
| 44 | + /** |
|
| 45 | + * @param array $props_n_values |
|
| 46 | + * @return EE_Term |
|
| 47 | + */ |
|
| 48 | + public static function new_instance_from_db($props_n_values = array()) |
|
| 49 | + { |
|
| 50 | + return new self($props_n_values, true); |
|
| 51 | + } |
|
| 52 | 52 | |
| 53 | 53 | |
| 54 | - /** |
|
| 55 | - * Gets name |
|
| 56 | - * |
|
| 57 | - * @return string |
|
| 58 | - */ |
|
| 59 | - public function name() |
|
| 60 | - { |
|
| 61 | - return $this->get('name'); |
|
| 62 | - } |
|
| 54 | + /** |
|
| 55 | + * Gets name |
|
| 56 | + * |
|
| 57 | + * @return string |
|
| 58 | + */ |
|
| 59 | + public function name() |
|
| 60 | + { |
|
| 61 | + return $this->get('name'); |
|
| 62 | + } |
|
| 63 | 63 | |
| 64 | 64 | |
| 65 | - /** |
|
| 66 | - * Sets name |
|
| 67 | - * |
|
| 68 | - * @param string $name |
|
| 69 | - * @return boolean |
|
| 70 | - */ |
|
| 71 | - public function set_name($name) |
|
| 72 | - { |
|
| 73 | - $this->set('name', $name); |
|
| 74 | - } |
|
| 65 | + /** |
|
| 66 | + * Sets name |
|
| 67 | + * |
|
| 68 | + * @param string $name |
|
| 69 | + * @return boolean |
|
| 70 | + */ |
|
| 71 | + public function set_name($name) |
|
| 72 | + { |
|
| 73 | + $this->set('name', $name); |
|
| 74 | + } |
|
| 75 | 75 | |
| 76 | 76 | |
| 77 | - /** |
|
| 78 | - * Gets slug |
|
| 79 | - * |
|
| 80 | - * @return string |
|
| 81 | - */ |
|
| 82 | - public function slug() |
|
| 83 | - { |
|
| 84 | - return $this->get('slug'); |
|
| 85 | - } |
|
| 77 | + /** |
|
| 78 | + * Gets slug |
|
| 79 | + * |
|
| 80 | + * @return string |
|
| 81 | + */ |
|
| 82 | + public function slug() |
|
| 83 | + { |
|
| 84 | + return $this->get('slug'); |
|
| 85 | + } |
|
| 86 | 86 | |
| 87 | 87 | |
| 88 | - /** |
|
| 89 | - * Sets slug |
|
| 90 | - * |
|
| 91 | - * @param string $slug |
|
| 92 | - * @return boolean |
|
| 93 | - */ |
|
| 94 | - public function set_slug($slug) |
|
| 95 | - { |
|
| 96 | - $this->set('slug', $slug); |
|
| 97 | - } |
|
| 88 | + /** |
|
| 89 | + * Sets slug |
|
| 90 | + * |
|
| 91 | + * @param string $slug |
|
| 92 | + * @return boolean |
|
| 93 | + */ |
|
| 94 | + public function set_slug($slug) |
|
| 95 | + { |
|
| 96 | + $this->set('slug', $slug); |
|
| 97 | + } |
|
| 98 | 98 | } |
@@ -23,7 +23,7 @@ |
||
| 23 | 23 | */ |
| 24 | 24 | protected function __construct($fieldValues = array(), $bydb = false, $timezone = '') |
| 25 | 25 | { |
| 26 | - if (! isset($fieldValues['slug'])) { |
|
| 26 | + if ( ! isset($fieldValues['slug'])) { |
|
| 27 | 27 | $fieldValues['slug'] = $fieldValues['name']; |
| 28 | 28 | } |
| 29 | 29 | parent::__construct($fieldValues, $bydb, $timezone); |
@@ -14,98 +14,98 @@ |
||
| 14 | 14 | class EE_Registration_Payment extends EE_Base_Class |
| 15 | 15 | { |
| 16 | 16 | |
| 17 | - /** |
|
| 18 | - * |
|
| 19 | - * @param array $props_n_values |
|
| 20 | - * @param string $timezone |
|
| 21 | - * @return EE_Registration_Payment |
|
| 22 | - */ |
|
| 23 | - public static function new_instance($props_n_values = array(), $timezone = '', $date_formats = array()) |
|
| 24 | - { |
|
| 25 | - $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
| 26 | - return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
| 27 | - } |
|
| 28 | - |
|
| 29 | - |
|
| 30 | - /** |
|
| 31 | - * @param array $props_n_values |
|
| 32 | - * @param string $timezone |
|
| 33 | - * @return EE_Registration_Payment |
|
| 34 | - */ |
|
| 35 | - public static function new_instance_from_db($props_n_values = array(), $timezone = '') |
|
| 36 | - { |
|
| 37 | - return new self($props_n_values, true, $timezone); |
|
| 38 | - } |
|
| 39 | - |
|
| 40 | - |
|
| 41 | - /** |
|
| 42 | - * registration_ID |
|
| 43 | - * |
|
| 44 | - * @access public |
|
| 45 | - * @return int |
|
| 46 | - */ |
|
| 47 | - public function registration_ID() |
|
| 48 | - { |
|
| 49 | - return $this->get('REG_ID'); |
|
| 50 | - } |
|
| 51 | - |
|
| 52 | - |
|
| 53 | - /** |
|
| 54 | - * payment_ID |
|
| 55 | - * |
|
| 56 | - * @access public |
|
| 57 | - * @return int |
|
| 58 | - */ |
|
| 59 | - public function payment_ID() |
|
| 60 | - { |
|
| 61 | - return $this->get('PAY_ID'); |
|
| 62 | - } |
|
| 63 | - |
|
| 64 | - |
|
| 65 | - /** |
|
| 66 | - * amount |
|
| 67 | - * |
|
| 68 | - * @access public |
|
| 69 | - * @return float |
|
| 70 | - */ |
|
| 71 | - public function amount() |
|
| 72 | - { |
|
| 73 | - return $this->get('RPY_amount'); |
|
| 74 | - } |
|
| 75 | - |
|
| 76 | - |
|
| 77 | - /** |
|
| 78 | - * amount |
|
| 79 | - * |
|
| 80 | - * @access public |
|
| 81 | - * @param float $amount |
|
| 82 | - */ |
|
| 83 | - public function set_amount($amount = 0.000) |
|
| 84 | - { |
|
| 85 | - $this->set('RPY_amount', $amount); |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - |
|
| 89 | - /** |
|
| 90 | - * registration |
|
| 91 | - * |
|
| 92 | - * @access public |
|
| 93 | - * @return \EE_Registration |
|
| 94 | - */ |
|
| 95 | - public function registration() |
|
| 96 | - { |
|
| 97 | - return $this->get_first_related('Registration'); |
|
| 98 | - } |
|
| 99 | - |
|
| 100 | - |
|
| 101 | - /** |
|
| 102 | - * payment |
|
| 103 | - * |
|
| 104 | - * @access public |
|
| 105 | - * @return \EE_Payment |
|
| 106 | - */ |
|
| 107 | - public function payment() |
|
| 108 | - { |
|
| 109 | - return $this->get_first_related('Payment'); |
|
| 110 | - } |
|
| 17 | + /** |
|
| 18 | + * |
|
| 19 | + * @param array $props_n_values |
|
| 20 | + * @param string $timezone |
|
| 21 | + * @return EE_Registration_Payment |
|
| 22 | + */ |
|
| 23 | + public static function new_instance($props_n_values = array(), $timezone = '', $date_formats = array()) |
|
| 24 | + { |
|
| 25 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__, $timezone, $date_formats); |
|
| 26 | + return $has_object ? $has_object : new self($props_n_values, false, $timezone, $date_formats); |
|
| 27 | + } |
|
| 28 | + |
|
| 29 | + |
|
| 30 | + /** |
|
| 31 | + * @param array $props_n_values |
|
| 32 | + * @param string $timezone |
|
| 33 | + * @return EE_Registration_Payment |
|
| 34 | + */ |
|
| 35 | + public static function new_instance_from_db($props_n_values = array(), $timezone = '') |
|
| 36 | + { |
|
| 37 | + return new self($props_n_values, true, $timezone); |
|
| 38 | + } |
|
| 39 | + |
|
| 40 | + |
|
| 41 | + /** |
|
| 42 | + * registration_ID |
|
| 43 | + * |
|
| 44 | + * @access public |
|
| 45 | + * @return int |
|
| 46 | + */ |
|
| 47 | + public function registration_ID() |
|
| 48 | + { |
|
| 49 | + return $this->get('REG_ID'); |
|
| 50 | + } |
|
| 51 | + |
|
| 52 | + |
|
| 53 | + /** |
|
| 54 | + * payment_ID |
|
| 55 | + * |
|
| 56 | + * @access public |
|
| 57 | + * @return int |
|
| 58 | + */ |
|
| 59 | + public function payment_ID() |
|
| 60 | + { |
|
| 61 | + return $this->get('PAY_ID'); |
|
| 62 | + } |
|
| 63 | + |
|
| 64 | + |
|
| 65 | + /** |
|
| 66 | + * amount |
|
| 67 | + * |
|
| 68 | + * @access public |
|
| 69 | + * @return float |
|
| 70 | + */ |
|
| 71 | + public function amount() |
|
| 72 | + { |
|
| 73 | + return $this->get('RPY_amount'); |
|
| 74 | + } |
|
| 75 | + |
|
| 76 | + |
|
| 77 | + /** |
|
| 78 | + * amount |
|
| 79 | + * |
|
| 80 | + * @access public |
|
| 81 | + * @param float $amount |
|
| 82 | + */ |
|
| 83 | + public function set_amount($amount = 0.000) |
|
| 84 | + { |
|
| 85 | + $this->set('RPY_amount', $amount); |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + |
|
| 89 | + /** |
|
| 90 | + * registration |
|
| 91 | + * |
|
| 92 | + * @access public |
|
| 93 | + * @return \EE_Registration |
|
| 94 | + */ |
|
| 95 | + public function registration() |
|
| 96 | + { |
|
| 97 | + return $this->get_first_related('Registration'); |
|
| 98 | + } |
|
| 99 | + |
|
| 100 | + |
|
| 101 | + /** |
|
| 102 | + * payment |
|
| 103 | + * |
|
| 104 | + * @access public |
|
| 105 | + * @return \EE_Payment |
|
| 106 | + */ |
|
| 107 | + public function payment() |
|
| 108 | + { |
|
| 109 | + return $this->get_first_related('Payment'); |
|
| 110 | + } |
|
| 111 | 111 | } |
@@ -6,23 +6,23 @@ |
||
| 6 | 6 | class EE_Question_Group_Question extends EE_Base_Class |
| 7 | 7 | { |
| 8 | 8 | |
| 9 | - /** |
|
| 10 | - * @param array $props_n_values |
|
| 11 | - * @return EE_Question_Group_Question|mixed |
|
| 12 | - */ |
|
| 13 | - public static function new_instance($props_n_values = array()) |
|
| 14 | - { |
|
| 15 | - $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
| 16 | - return $has_object ? $has_object : new self($props_n_values); |
|
| 17 | - } |
|
| 9 | + /** |
|
| 10 | + * @param array $props_n_values |
|
| 11 | + * @return EE_Question_Group_Question|mixed |
|
| 12 | + */ |
|
| 13 | + public static function new_instance($props_n_values = array()) |
|
| 14 | + { |
|
| 15 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
| 16 | + return $has_object ? $has_object : new self($props_n_values); |
|
| 17 | + } |
|
| 18 | 18 | |
| 19 | 19 | |
| 20 | - /** |
|
| 21 | - * @param array $props_n_values |
|
| 22 | - * @return EE_Question_Group_Question |
|
| 23 | - */ |
|
| 24 | - public static function new_instance_from_db($props_n_values = array()) |
|
| 25 | - { |
|
| 26 | - return new self($props_n_values, true); |
|
| 27 | - } |
|
| 20 | + /** |
|
| 21 | + * @param array $props_n_values |
|
| 22 | + * @return EE_Question_Group_Question |
|
| 23 | + */ |
|
| 24 | + public static function new_instance_from_db($props_n_values = array()) |
|
| 25 | + { |
|
| 26 | + return new self($props_n_values, true); |
|
| 27 | + } |
|
| 28 | 28 | } |
@@ -11,104 +11,104 @@ |
||
| 11 | 11 | class EE_State extends EE_Base_Class |
| 12 | 12 | { |
| 13 | 13 | |
| 14 | - /** |
|
| 15 | - * @param array $props_n_values |
|
| 16 | - * @return EE_State|mixed |
|
| 17 | - */ |
|
| 18 | - public static function new_instance($props_n_values = array()) |
|
| 19 | - { |
|
| 20 | - $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
| 21 | - return $has_object ? $has_object : new self($props_n_values); |
|
| 22 | - } |
|
| 23 | - |
|
| 24 | - |
|
| 25 | - /** |
|
| 26 | - * @param array $props_n_values |
|
| 27 | - * @return EE_State |
|
| 28 | - */ |
|
| 29 | - public static function new_instance_from_db($props_n_values = array()) |
|
| 30 | - { |
|
| 31 | - return new self($props_n_values, true); |
|
| 32 | - } |
|
| 33 | - |
|
| 34 | - |
|
| 35 | - /** |
|
| 36 | - * @return string |
|
| 37 | - */ |
|
| 38 | - public function country_iso() |
|
| 39 | - { |
|
| 40 | - return $this->get('CNT_ISO'); |
|
| 41 | - } |
|
| 42 | - |
|
| 43 | - |
|
| 44 | - /** |
|
| 45 | - * @return string |
|
| 46 | - */ |
|
| 47 | - public function abbrev() |
|
| 48 | - { |
|
| 49 | - return $this->get('STA_abbrev'); |
|
| 50 | - } |
|
| 51 | - |
|
| 52 | - |
|
| 53 | - /** |
|
| 54 | - * @return bool |
|
| 55 | - */ |
|
| 56 | - public function active() |
|
| 57 | - { |
|
| 58 | - return $this->get('STA_active'); |
|
| 59 | - } |
|
| 60 | - |
|
| 61 | - |
|
| 62 | - /** |
|
| 63 | - * @return string |
|
| 64 | - */ |
|
| 65 | - public function name() |
|
| 66 | - { |
|
| 67 | - return $this->get('STA_name'); |
|
| 68 | - } |
|
| 69 | - |
|
| 70 | - |
|
| 71 | - /** |
|
| 72 | - * @return EE_Country |
|
| 73 | - */ |
|
| 74 | - public function country() |
|
| 75 | - { |
|
| 76 | - return $this->get_first_related('Country'); |
|
| 77 | - } |
|
| 78 | - |
|
| 79 | - |
|
| 80 | - /** |
|
| 81 | - * @param $iso |
|
| 82 | - */ |
|
| 83 | - public function set_country_iso($iso) |
|
| 84 | - { |
|
| 85 | - $this->set('CNT_ISO', $iso); |
|
| 86 | - } |
|
| 87 | - |
|
| 88 | - |
|
| 89 | - /** |
|
| 90 | - * @param $abbrev |
|
| 91 | - */ |
|
| 92 | - public function set_abbrev($abbrev) |
|
| 93 | - { |
|
| 94 | - $this->set('STA_abbrev', $abbrev); |
|
| 95 | - } |
|
| 96 | - |
|
| 97 | - |
|
| 98 | - /** |
|
| 99 | - * @param $active |
|
| 100 | - */ |
|
| 101 | - public function set_active($active) |
|
| 102 | - { |
|
| 103 | - $this->set('STA_active', $active); |
|
| 104 | - } |
|
| 105 | - |
|
| 106 | - |
|
| 107 | - /** |
|
| 108 | - * @param $name |
|
| 109 | - */ |
|
| 110 | - public function set_name($name) |
|
| 111 | - { |
|
| 112 | - $this->set('STA_name', $name); |
|
| 113 | - } |
|
| 14 | + /** |
|
| 15 | + * @param array $props_n_values |
|
| 16 | + * @return EE_State|mixed |
|
| 17 | + */ |
|
| 18 | + public static function new_instance($props_n_values = array()) |
|
| 19 | + { |
|
| 20 | + $has_object = parent::_check_for_object($props_n_values, __CLASS__); |
|
| 21 | + return $has_object ? $has_object : new self($props_n_values); |
|
| 22 | + } |
|
| 23 | + |
|
| 24 | + |
|
| 25 | + /** |
|
| 26 | + * @param array $props_n_values |
|
| 27 | + * @return EE_State |
|
| 28 | + */ |
|
| 29 | + public static function new_instance_from_db($props_n_values = array()) |
|
| 30 | + { |
|
| 31 | + return new self($props_n_values, true); |
|
| 32 | + } |
|
| 33 | + |
|
| 34 | + |
|
| 35 | + /** |
|
| 36 | + * @return string |
|
| 37 | + */ |
|
| 38 | + public function country_iso() |
|
| 39 | + { |
|
| 40 | + return $this->get('CNT_ISO'); |
|
| 41 | + } |
|
| 42 | + |
|
| 43 | + |
|
| 44 | + /** |
|
| 45 | + * @return string |
|
| 46 | + */ |
|
| 47 | + public function abbrev() |
|
| 48 | + { |
|
| 49 | + return $this->get('STA_abbrev'); |
|
| 50 | + } |
|
| 51 | + |
|
| 52 | + |
|
| 53 | + /** |
|
| 54 | + * @return bool |
|
| 55 | + */ |
|
| 56 | + public function active() |
|
| 57 | + { |
|
| 58 | + return $this->get('STA_active'); |
|
| 59 | + } |
|
| 60 | + |
|
| 61 | + |
|
| 62 | + /** |
|
| 63 | + * @return string |
|
| 64 | + */ |
|
| 65 | + public function name() |
|
| 66 | + { |
|
| 67 | + return $this->get('STA_name'); |
|
| 68 | + } |
|
| 69 | + |
|
| 70 | + |
|
| 71 | + /** |
|
| 72 | + * @return EE_Country |
|
| 73 | + */ |
|
| 74 | + public function country() |
|
| 75 | + { |
|
| 76 | + return $this->get_first_related('Country'); |
|
| 77 | + } |
|
| 78 | + |
|
| 79 | + |
|
| 80 | + /** |
|
| 81 | + * @param $iso |
|
| 82 | + */ |
|
| 83 | + public function set_country_iso($iso) |
|
| 84 | + { |
|
| 85 | + $this->set('CNT_ISO', $iso); |
|
| 86 | + } |
|
| 87 | + |
|
| 88 | + |
|
| 89 | + /** |
|
| 90 | + * @param $abbrev |
|
| 91 | + */ |
|
| 92 | + public function set_abbrev($abbrev) |
|
| 93 | + { |
|
| 94 | + $this->set('STA_abbrev', $abbrev); |
|
| 95 | + } |
|
| 96 | + |
|
| 97 | + |
|
| 98 | + /** |
|
| 99 | + * @param $active |
|
| 100 | + */ |
|
| 101 | + public function set_active($active) |
|
| 102 | + { |
|
| 103 | + $this->set('STA_active', $active); |
|
| 104 | + } |
|
| 105 | + |
|
| 106 | + |
|
| 107 | + /** |
|
| 108 | + * @param $name |
|
| 109 | + */ |
|
| 110 | + public function set_name($name) |
|
| 111 | + { |
|
| 112 | + $this->set('STA_name', $name); |
|
| 113 | + } |
|
| 114 | 114 | } |