Completed
Branch BUG-5580-mike-implementation (468206)
by
unknown
08:00 queued 1434:13
created
core/db_models/fields/EE_Foreign_Key_String_Field.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,7 +1,7 @@  discard block
 block discarded – undo
1 1
 <?php
2
-require_once( EE_MODELS . 'fields/EE_Foreign_Key_Field_Base.php');
3
-class EE_Foreign_Key_String_Field extends EE_Foreign_Key_Field_Base{
4
-	function get_wpdb_data_type(){
2
+require_once(EE_MODELS.'fields/EE_Foreign_Key_Field_Base.php');
3
+class EE_Foreign_Key_String_Field extends EE_Foreign_Key_Field_Base {
4
+	function get_wpdb_data_type() {
5 5
 		return '%s';
6 6
 	}
7 7
 	/**
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
 	 * @return string
11 11
 	 */
12 12
 	function prepare_for_set($value_inputted_for_field_on_model_object) {
13
-		if($this->is_model_obj_of_type_pointed_to($value_inputted_for_field_on_model_object)){
13
+		if ($this->is_model_obj_of_type_pointed_to($value_inputted_for_field_on_model_object)) {
14 14
 			$value_inputted_for_field_on_model_object = $value_inputted_for_field_on_model_object->ID();
15 15
 		}
16 16
 		return strtoupper(wp_strip_all_tags($value_inputted_for_field_on_model_object));
Please login to merge, or discard this patch.
core/db_models/fields/EE_Full_HTML_Field.php 2 patches
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@  discard block
 block discarded – undo
1 1
 <?php
2
-require_once( EE_MODELS . 'fields/EE_Text_Field_Base.php' );
3
-class EE_Full_HTML_Field extends EE_Text_Field_Base{
2
+require_once(EE_MODELS.'fields/EE_Text_Field_Base.php');
3
+class EE_Full_HTML_Field extends EE_Text_Field_Base {
4 4
 
5 5
 
6 6
 	/**
@@ -10,11 +10,11 @@  discard block
 block discarded – undo
10 10
 	 * @return string
11 11
 	 */
12 12
 	function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null) {
13
-		if($schema =='form_input'){
13
+		if ($schema == 'form_input') {
14 14
 			return parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema);
15
-		}elseif($schema == 'no_wpautop'){
15
+		}elseif ($schema == 'no_wpautop') {
16 16
 			return do_shortcode(parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema));
17
-		}else{
17
+		} else {
18 18
 			return wpautop(do_shortcode(parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema)));
19 19
 		}
20 20
 	}
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,9 +12,9 @@
 block discarded – undo
12 12
 	function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null) {
13 13
 		if($schema =='form_input'){
14 14
 			return parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema);
15
-		}elseif($schema == 'no_wpautop'){
15
+		} elseif($schema == 'no_wpautop'){
16 16
 			return do_shortcode(parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema));
17
-		}else{
17
+		} else{
18 18
 			return wpautop(do_shortcode(parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema)));
19 19
 		}
20 20
 	}
Please login to merge, or discard this patch.
core/db_models/fields/EE_Integer_Field.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -3,8 +3,8 @@
 block discarded – undo
3 3
 /**
4 4
  * Text_Fields is a base class for any fields which are have integer value. (Exception: foreign and private key fields. Wish PHP had multiple-inheritance for this...)
5 5
  */
6
-class EE_Integer_Field extends EE_Model_Field_Base{
7
-	function get_wpdb_data_type(){
6
+class EE_Integer_Field extends EE_Model_Field_Base {
7
+	function get_wpdb_data_type() {
8 8
 		return '%d';
9 9
 	}
10 10
 	function prepare_for_set($value_inputted_for_field_on_model_object) {
Please login to merge, or discard this patch.
core/db_models/fields/EE_Maybe_Serialized_Simple_HTML_Field.php 3 patches
Spacing   +14 added lines, -14 removed lines patch added patch discarded remove patch
@@ -24,14 +24,14 @@  discard block
 block discarded – undo
24 24
  * But either way, the string or the array's values can ONLY contain simple HTML tags.
25 25
  * If you want to allow Full HTML in the value, use EE_Maybe_Serialized_Text_Field
26 26
  */
27
-class EE_Maybe_Serialized_Simple_HTML_Field extends EE_Maybe_Serialized_Text_Field{
27
+class EE_Maybe_Serialized_Simple_HTML_Field extends EE_Maybe_Serialized_Text_Field {
28 28
 	/**
29 29
 	 * removes all non-basic tags when setting
30 30
 	 * @param string $value_inputted_for_field_on_model_object
31 31
 	 * @return string
32 32
 	 */
33 33
 	function prepare_for_set($value_inputted_for_field_on_model_object) {
34
-		return parent::prepare_for_set( $this->_remove_tags(  $value_inputted_for_field_on_model_object ) );
34
+		return parent::prepare_for_set($this->_remove_tags($value_inputted_for_field_on_model_object));
35 35
 	}
36 36
 
37 37
 	/**
@@ -39,13 +39,13 @@  discard block
 block discarded – undo
39 39
 	 * @param array|string $value
40 40
 	 * @return array|string
41 41
 	 */
42
-	protected function _remove_tags( $value ) {
43
-		if( is_array( $value ) ) {
44
-			foreach( $value as $key => $v ) {
45
-				$value[ $key ] = $this->_remove_tags( $v );
42
+	protected function _remove_tags($value) {
43
+		if (is_array($value)) {
44
+			foreach ($value as $key => $v) {
45
+				$value[$key] = $this->_remove_tags($v);
46 46
 			}
47
-		}elseif( is_string( $value ) ) {
48
-			$value = wp_kses("$value", $this->_get_allowed_tags() );
47
+		}elseif (is_string($value)) {
48
+			$value = wp_kses("$value", $this->_get_allowed_tags());
49 49
 		}
50 50
 		return $value;
51 51
 	}
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	 * @return array|string
57 57
 	 */
58 58
 	function prepare_for_set_from_db($value_found_in_db_for_model_object) {
59
-		return parent::prepare_for_set_from_db( $this->_remove_tags(  $value_found_in_db_for_model_object ) );
59
+		return parent::prepare_for_set_from_db($this->_remove_tags($value_found_in_db_for_model_object));
60 60
 	}
61 61
 
62 62
 
@@ -65,12 +65,12 @@  discard block
 block discarded – undo
65 65
 	 * @global array $allowedtags
66 66
 	 * @return array
67 67
 	 */
68
-	function _get_allowed_tags(){
68
+	function _get_allowed_tags() {
69 69
 		global $allowedtags;
70 70
 		$tags_we_allow = $allowedtags;
71
-		$tags_we_allow['ol']=array();
72
-		$tags_we_allow['ul']=array();
73
-		$tags_we_allow['li']=array();
74
-		return apply_filters( 'FHEE__EE_Maybe_Serialized_Simple_HTML_Field___get_allowed_tags', $tags_we_allow, $this );
71
+		$tags_we_allow['ol'] = array();
72
+		$tags_we_allow['ul'] = array();
73
+		$tags_we_allow['li'] = array();
74
+		return apply_filters('FHEE__EE_Maybe_Serialized_Simple_HTML_Field___get_allowed_tags', $tags_we_allow, $this);
75 75
 	}
76 76
 }
Please login to merge, or discard this patch.
Braces   +4 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,4 +1,6 @@  discard block
 block discarded – undo
1
-<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) exit('No direct script access allowed');
1
+<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) {
2
+	exit('No direct script access allowed');
3
+}
2 4
 /**
3 5
  * Event Espresso
4 6
  *
@@ -44,7 +46,7 @@  discard block
 block discarded – undo
44 46
 			foreach( $value as $key => $v ) {
45 47
 				$value[ $key ] = $this->_remove_tags( $v );
46 48
 			}
47
-		}elseif( is_string( $value ) ) {
49
+		} elseif( is_string( $value ) ) {
48 50
 			$value = wp_kses("$value", $this->_get_allowed_tags() );
49 51
 		}
50 52
 		return $value;
Please login to merge, or discard this patch.
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -799,7 +799,6 @@
 block discarded – undo
799 799
 
800 800
 
801 801
 	/**
802
-
803 802
 	 *
804 803
 	 * 	 If the the first date starts at midnight on one day, and the next date ends at midnight on the
805 804
 	 * 	 very next day then this method will return true.
Please login to merge, or discard this patch.
core/db_models/fields/EE_Maybe_Serialized_Text_Field.php 2 patches
Spacing   +6 added lines, -6 removed lines patch added patch discarded remove patch
@@ -4,17 +4,17 @@  discard block
 block discarded – undo
4 4
 /**
5 5
  * For a db text column, which can either be an array in PHP code or a string.
6 6
  */
7
-require_once( EE_MODELS . 'fields/EE_Text_Field_Base.php' );
8
-class EE_Maybe_Serialized_Text_Field extends EE_Serialized_Text_Field{
7
+require_once(EE_MODELS.'fields/EE_Text_Field_Base.php');
8
+class EE_Maybe_Serialized_Text_Field extends EE_Serialized_Text_Field {
9 9
 	/**
10 10
 	 * Value could be an array or a string. If its an array, serialize it. Otherwise, leave it as a string
11 11
 	 * @param array|string $value_of_field_on_model_object
12 12
 	 * @return string (possibly serialized)
13 13
 	 */
14 14
 	function prepare_for_use_in_db($value_of_field_on_model_object) {
15
-		if(is_array($value_of_field_on_model_object)){
15
+		if (is_array($value_of_field_on_model_object)) {
16 16
 			return parent::prepare_for_use_in_db($value_of_field_on_model_object);
17
-		}else{
17
+		} else {
18 18
 			return $value_of_field_on_model_object;
19 19
 		}
20 20
 	}
@@ -26,9 +26,9 @@  discard block
 block discarded – undo
26 26
 	 */
27 27
 	function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null) {
28 28
 		$pretty_value = null;
29
-		if(is_array($value_on_field_to_be_outputted)){
29
+		if (is_array($value_on_field_to_be_outputted)) {
30 30
 			$pretty_value = parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema);
31
-		}else{
31
+		} else {
32 32
 			$pretty_value = $value_on_field_to_be_outputted;
33 33
 		}
34 34
 		return $pretty_value;
Please login to merge, or discard this patch.
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -42,7 +42,7 @@  discard block
 block discarded – undo
42 42
 				$validation_error_message = $default_validation_strategy->get_validation_error_message();
43 43
 			}
44 44
 			throw new EE_Validation_Error( $validation_error_message, 'float_only' );
45
-		}else{
45
+		} else{
46 46
 			return floatval($normalized_value);
47 47
 		}
48 48
 	}
@@ -55,7 +55,7 @@  discard block
 block discarded – undo
55 55
 	public function unnormalize($normalized_value) {
56 56
 		if( empty( $normalized_value ) ){
57 57
 			return '0.00';
58
-		}else{
58
+		} else{
59 59
 			return "$normalized_value";
60 60
 		}
61 61
 	}
Please login to merge, or discard this patch.
core/db_models/fields/EE_Money_Field.php 2 patches
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -2,8 +2,8 @@  discard block
 block discarded – undo
2 2
 /**
3 3
  * Text_Fields is a base class for any fields which are have float value. (Exception: foreign and private key fields. Wish PHP had multiple-inheritance for this...)
4 4
  */
5
-class EE_Money_Field extends EE_Float_Field{
6
-	function get_wpdb_data_type(){
5
+class EE_Money_Field extends EE_Float_Field {
6
+	function get_wpdb_data_type() {
7 7
 		return '%f';
8 8
 	}
9 9
 	/**
@@ -15,21 +15,21 @@  discard block
 block discarded – undo
15 15
 	 * @param type $schema
16 16
 	 * @return string
17 17
 	 */
18
-	function prepare_for_pretty_echoing($value_on_field_to_be_outputted,$schema = null){
18
+	function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null) {
19 19
 		$pretty_float = parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted);
20 20
 
21
-		if($schema == 'localized_float'){
21
+		if ($schema == 'localized_float') {
22 22
 			return $pretty_float;
23 23
 		}
24
-		EE_Registry::instance()->load_helper( 'Template' );
25
-		if($schema == 'no_currency_code'){
24
+		EE_Registry::instance()->load_helper('Template');
25
+		if ($schema == 'no_currency_code') {
26 26
 //			echo "schema no currency!";
27 27
 			$display_code = false;
28
-		}else{
28
+		} else {
29 29
 			$display_code = true;
30 30
 		}
31 31
 		//we don't use the $pretty_float because format_currency will take care of it.
32
-		return EEH_Template::format_currency( $value_on_field_to_be_outputted, false, $display_code );
32
+		return EEH_Template::format_currency($value_on_field_to_be_outputted, false, $display_code);
33 33
 	}
34 34
 
35 35
 	/**
@@ -48,7 +48,7 @@  discard block
 block discarded – undo
48 48
 		//now it's a float-style string or number
49 49
 		$float_val = parent::prepare_for_set($value_inputted_for_field_on_model_object);
50 50
 		//round to the correctly number of decimal places for this  currency
51
-		$rounded_value = round($float_val,  EE_Registry::instance()->CFG->currency->dec_plc);
51
+		$rounded_value = round($float_val, EE_Registry::instance()->CFG->currency->dec_plc);
52 52
 		return $rounded_value;
53 53
 	}
54 54
 
Please login to merge, or discard this patch.
Braces   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -90,7 +90,7 @@
 block discarded – undo
90 90
 		//so in case teh IPN is arriving later, let's try to process an IPN!
91 91
 		if($_SERVER['REQUEST_METHOD'] == 'POST'){
92 92
 			return $this->handle_ipn($_POST, $transaction );
93
-		}else{
93
+		} else{
94 94
 			return parent::finalize_payment_for( $transaction );
95 95
 		}
96 96
 	}
Please login to merge, or discard this patch.
core/db_models/fields/EE_Plain_Text_Field.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -1,6 +1,6 @@
 block discarded – undo
1 1
 <?php
2
-require_once( EE_MODELS . 'fields/EE_Text_Field_Base.php' );
3
-class EE_Plain_Text_Field extends EE_Text_Field_Base{
2
+require_once(EE_MODELS.'fields/EE_Text_Field_Base.php');
3
+class EE_Plain_Text_Field extends EE_Text_Field_Base {
4 4
 	/**
5 5
 	 * removes all tags when setting
6 6
 	 * @param string $value_inputted_for_field_on_model_object
Please login to merge, or discard this patch.
core/db_models/fields/EE_Primary_Key_Int_Field.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -1,14 +1,14 @@
 block discarded – undo
1 1
 <?php
2
-require_once( EE_MODELS . 'fields/EE_Primary_Key_Field_Base.php');
3
-class EE_Primary_Key_Int_Field extends EE_Primary_Key_Field_Base{
4
-	function get_wpdb_data_type(){
2
+require_once(EE_MODELS.'fields/EE_Primary_Key_Field_Base.php');
3
+class EE_Primary_Key_Int_Field extends EE_Primary_Key_Field_Base {
4
+	function get_wpdb_data_type() {
5 5
 		return '%d';
6 6
 	}
7 7
 	public function __construct($table_column, $nicename) {
8 8
 		parent::__construct($table_column, $nicename, 0);
9 9
 	}
10 10
 	function prepare_for_set($value_inputted_for_field_on_model_object) {
11
-		if($this->is_model_obj_of_type_pointed_to($value_inputted_for_field_on_model_object)){
11
+		if ($this->is_model_obj_of_type_pointed_to($value_inputted_for_field_on_model_object)) {
12 12
 			$value_inputted_for_field_on_model_object = $value_inputted_for_field_on_model_object->ID();
13 13
 		}
14 14
 		return absint($value_inputted_for_field_on_model_object);
Please login to merge, or discard this patch.
Doc Comments   +4 added lines patch added patch discarded remove patch
@@ -4,6 +4,10 @@
 block discarded – undo
4 4
 	function get_wpdb_data_type(){
5 5
 		return '%s';
6 6
 	}
7
+
8
+	/**
9
+	 * @param string $table_column
10
+	 */
7 11
 	public function __construct($table_column, $nicename) {
8 12
 		parent::__construct($table_column, $nicename, NULL);
9 13
 	}
Please login to merge, or discard this patch.
core/db_models/fields/EE_Serialized_Text_Field.php 2 patches
Braces   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -20,9 +20,9 @@
 block discarded – undo
20 20
 	function prepare_for_set($value_inputted_for_field_on_model_object) {
21 21
 		if(is_string($value_inputted_for_field_on_model_object)){
22 22
 			return parent::prepare_for_set($value_inputted_for_field_on_model_object);
23
-		}elseif(is_array($value_inputted_for_field_on_model_object)){
23
+		} elseif(is_array($value_inputted_for_field_on_model_object)){
24 24
 			return array_map(array($this,'prepare_for_set'), $value_inputted_for_field_on_model_object);
25
-		}else{//so they passed NULL or an INT or something wack
25
+		} else{//so they passed NULL or an INT or something wack
26 26
 			return $value_inputted_for_field_on_model_object;
27 27
 		}
28 28
 	}
Please login to merge, or discard this patch.
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -7,8 +7,8 @@  discard block
 block discarded – undo
7 7
  * However, when inserting into the DB, it should be serialized.
8 8
  * Upon retrieval from the DB, it should be unserialized back into an array.
9 9
  */
10
-require_once( EE_MODELS . 'fields/EE_Text_Field_Base.php' );
11
-class EE_Serialized_Text_Field extends EE_Text_Field_Base{
10
+require_once(EE_MODELS.'fields/EE_Text_Field_Base.php');
11
+class EE_Serialized_Text_Field extends EE_Text_Field_Base {
12 12
 	/**
13 13
 	 * Value SHOULD be an array, and we want to now convert it to a serialized string
14 14
 	 * @param array $value_of_field_on_model_object
@@ -18,13 +18,13 @@  discard block
 block discarded – undo
18 18
 		return maybe_serialize($value_of_field_on_model_object);
19 19
 	}
20 20
 	function prepare_for_set($value_inputted_for_field_on_model_object) {
21
-		EE_Registry::instance()->load_helper( 'Array' );
22
-		$value_inputted_for_field_on_model_object = EEH_Array::maybe_unserialize( $value_inputted_for_field_on_model_object );
23
-		if(is_string($value_inputted_for_field_on_model_object)){
21
+		EE_Registry::instance()->load_helper('Array');
22
+		$value_inputted_for_field_on_model_object = EEH_Array::maybe_unserialize($value_inputted_for_field_on_model_object);
23
+		if (is_string($value_inputted_for_field_on_model_object)) {
24 24
 			return parent::prepare_for_set($value_inputted_for_field_on_model_object);
25
-		}elseif(is_array($value_inputted_for_field_on_model_object)){
26
-			return array_map(array($this,'prepare_for_set'), $value_inputted_for_field_on_model_object);
27
-		}else{//so they passed NULL or an INT or something wack
25
+		}elseif (is_array($value_inputted_for_field_on_model_object)) {
26
+			return array_map(array($this, 'prepare_for_set'), $value_inputted_for_field_on_model_object);
27
+		} else {//so they passed NULL or an INT or something wack
28 28
 			return $value_inputted_for_field_on_model_object;
29 29
 		}
30 30
 	}
@@ -34,8 +34,8 @@  discard block
 block discarded – undo
34 34
 	 * @return array
35 35
 	 */
36 36
 	function prepare_for_set_from_db($value_found_in_db_for_model_object) {
37
-		EE_Registry::instance()->load_helper( 'Array' );
38
-		return EEH_Array::maybe_unserialize( $value_found_in_db_for_model_object );
37
+		EE_Registry::instance()->load_helper('Array');
38
+		return EEH_Array::maybe_unserialize($value_found_in_db_for_model_object);
39 39
 	}
40 40
 
41 41
 	/**
@@ -45,16 +45,16 @@  discard block
 block discarded – undo
45 45
 	 * @return string
46 46
 	 */
47 47
 	function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null) {
48
-		switch($schema){
48
+		switch ($schema) {
49 49
 			case 'print_r':
50
-				$pretty_value = print_r($value_on_field_to_be_outputted,true);
50
+				$pretty_value = print_r($value_on_field_to_be_outputted, true);
51 51
 				break;
52 52
 			case 'as_table':
53 53
 				EE_Registry::instance()->load_helper('Template');
54 54
 				$pretty_value = EEH_Template::layout_array_as_table($value_on_field_to_be_outputted);
55 55
 				break;
56 56
 			default:
57
-				$pretty_value = implode(", ",$value_on_field_to_be_outputted);
57
+				$pretty_value = implode(", ", $value_on_field_to_be_outputted);
58 58
 		}
59 59
 		return $pretty_value;
60 60
 	}
Please login to merge, or discard this patch.