Completed
Branch BUG-9042-ics-organizer-email (7b2e23)
by
unknown
29:24 queued 16:15
created
core/entities/models/JsonModelSchema.php 3 patches
Doc Comments   -2 removed lines patch added patch discarded remove patch
@@ -39,7 +39,6 @@  discard block
 block discarded – undo
39 39
 
40 40
     /**
41 41
      * Return the schema for a given model from a given model.
42
-     * @param \EEM_Base $model
43 42
      * @return array
44 43
      */
45 44
     public function getModelSchema()
@@ -103,7 +102,6 @@  discard block
 block discarded – undo
103 102
 
104 103
     /**
105 104
      * Outputs the schema header for a model.
106
-     * @param \EEM_Base $model
107 105
      * @return array
108 106
      */
109 107
     public function getInitialSchemaStructure()
Please login to merge, or discard this patch.
Indentation   +112 added lines, -112 removed lines patch added patch discarded remove patch
@@ -24,116 +24,116 @@
 block discarded – undo
24 24
 class JsonModelSchema
25 25
 {
26 26
 
27
-    /**
28
-     * @var \EEM_Base
29
-     */
30
-    protected $model;
31
-
32
-    /**
33
-     * JsonModelSchema constructor.
34
-     *
35
-     * @param \EEM_Base $model
36
-     */
37
-    public function __construct(EEM_Base $model){
38
-        $this->model = $model;
39
-    }
40
-
41
-    /**
42
-     * Return the schema for a given model from a given model.
43
-     * @param \EEM_Base $model
44
-     * @return array
45
-     */
46
-    public function getModelSchema()
47
-    {
48
-        return $this->getModelSchemaForRelations(
49
-            $this->model->relation_settings(),
50
-            $this->getModelSchemaForFields(
51
-                $this->model->field_settings(),
52
-                $this->getInitialSchemaStructure()
53
-            )
54
-        );
55
-    }
56
-
57
-
58
-    /**
59
-     * Get the schema for a given set of model fields.
60
-     * @param \EE_Model_Field_Base[]     $model_fields
61
-     * @return array
62
-     */
63
-    public function getModelSchemaForFields(array $model_fields, array $schema)
64
-    {
65
-        foreach ($model_fields as $field => $model_field) {
66
-            if (! $model_field instanceof EE_Model_Field_Base) {
67
-                continue;
68
-            }
69
-            $schema['properties'][$field] = $model_field->getSchema();
70
-
71
-            //if this is a primary key field add the primary key item
72
-            if ($model_field instanceof EE_Primary_Key_Field_Base) {
73
-                $schema['properties'][$field]['primary_key'] = true;
74
-            }
75
-
76
-            //if this is a foreign key field add the foreign key item
77
-            if ($model_field instanceof EE_Foreign_Key_Field_Base) {
78
-                $schema['properties'][$field]['foreign_key'] = array(
79
-                    'description' => esc_html__('This is a foreign key the points to the given models.', 'event_espresso'),
80
-                    'type' => 'array',
81
-                    'enum' => $model_field->get_model_class_names_pointed_to()
82
-                );
83
-            }
84
-        }
85
-        return $schema;
86
-    }
87
-
88
-
89
-    /**
90
-     * Get the schema for a given set of model relations
91
-     * @param EE_Model_Relation_Base[] $relations_on_model
92
-     * @return array
93
-     */
94
-    public function getModelSchemaForRelations(array $relations_on_model, array $schema)
95
-    {
96
-        foreach ($relations_on_model as $model_name => $relation) {
97
-            if (! $relation instanceof EE_Model_Relation_Base) {
98
-                continue;
99
-            }
100
-            $model_name_for_schema = $relation instanceof EE_Belongs_To_Relation
101
-                ? strtolower($model_name)
102
-                : EEH_Inflector::pluralize_and_lower($model_name);
103
-            $schema['properties'][$model_name_for_schema] = $relation->getSchema();
104
-            $schema['properties'][$model_name_for_schema]['relation_model'] = $model_name;
105
-        }
106
-        return $schema;
107
-    }
108
-
109
-
110
-    /**
111
-     * Outputs the schema header for a model.
112
-     * @param \EEM_Base $model
113
-     * @return array
114
-     */
115
-    public function getInitialSchemaStructure()
116
-    {
117
-        return array(
118
-            '$schema' => 'http://json-schema.org/draft-04/schema#',
119
-            'title' => $this->model->get_this_model_name(),
120
-            'type' => 'object',
121
-            'properties' => array()
122
-        );
123
-    }
124
-
125
-
126
-    /**
127
-     * Allows one to just use the object as a string to get the json.
128
-     * eg.
129
-     *
130
-     * $json_schema = new JsonModelSchema(EEM_Event::instance());
131
-     * echo $json_schema; //outputs the schema as a json formatted string.
132
-     *
133
-     * @return bool|false|mixed|string
134
-     */
135
-    public function __toString()
136
-    {
137
-        return wp_json_encode($this->getModelSchema());
138
-    }
27
+	/**
28
+	 * @var \EEM_Base
29
+	 */
30
+	protected $model;
31
+
32
+	/**
33
+	 * JsonModelSchema constructor.
34
+	 *
35
+	 * @param \EEM_Base $model
36
+	 */
37
+	public function __construct(EEM_Base $model){
38
+		$this->model = $model;
39
+	}
40
+
41
+	/**
42
+	 * Return the schema for a given model from a given model.
43
+	 * @param \EEM_Base $model
44
+	 * @return array
45
+	 */
46
+	public function getModelSchema()
47
+	{
48
+		return $this->getModelSchemaForRelations(
49
+			$this->model->relation_settings(),
50
+			$this->getModelSchemaForFields(
51
+				$this->model->field_settings(),
52
+				$this->getInitialSchemaStructure()
53
+			)
54
+		);
55
+	}
56
+
57
+
58
+	/**
59
+	 * Get the schema for a given set of model fields.
60
+	 * @param \EE_Model_Field_Base[]     $model_fields
61
+	 * @return array
62
+	 */
63
+	public function getModelSchemaForFields(array $model_fields, array $schema)
64
+	{
65
+		foreach ($model_fields as $field => $model_field) {
66
+			if (! $model_field instanceof EE_Model_Field_Base) {
67
+				continue;
68
+			}
69
+			$schema['properties'][$field] = $model_field->getSchema();
70
+
71
+			//if this is a primary key field add the primary key item
72
+			if ($model_field instanceof EE_Primary_Key_Field_Base) {
73
+				$schema['properties'][$field]['primary_key'] = true;
74
+			}
75
+
76
+			//if this is a foreign key field add the foreign key item
77
+			if ($model_field instanceof EE_Foreign_Key_Field_Base) {
78
+				$schema['properties'][$field]['foreign_key'] = array(
79
+					'description' => esc_html__('This is a foreign key the points to the given models.', 'event_espresso'),
80
+					'type' => 'array',
81
+					'enum' => $model_field->get_model_class_names_pointed_to()
82
+				);
83
+			}
84
+		}
85
+		return $schema;
86
+	}
87
+
88
+
89
+	/**
90
+	 * Get the schema for a given set of model relations
91
+	 * @param EE_Model_Relation_Base[] $relations_on_model
92
+	 * @return array
93
+	 */
94
+	public function getModelSchemaForRelations(array $relations_on_model, array $schema)
95
+	{
96
+		foreach ($relations_on_model as $model_name => $relation) {
97
+			if (! $relation instanceof EE_Model_Relation_Base) {
98
+				continue;
99
+			}
100
+			$model_name_for_schema = $relation instanceof EE_Belongs_To_Relation
101
+				? strtolower($model_name)
102
+				: EEH_Inflector::pluralize_and_lower($model_name);
103
+			$schema['properties'][$model_name_for_schema] = $relation->getSchema();
104
+			$schema['properties'][$model_name_for_schema]['relation_model'] = $model_name;
105
+		}
106
+		return $schema;
107
+	}
108
+
109
+
110
+	/**
111
+	 * Outputs the schema header for a model.
112
+	 * @param \EEM_Base $model
113
+	 * @return array
114
+	 */
115
+	public function getInitialSchemaStructure()
116
+	{
117
+		return array(
118
+			'$schema' => 'http://json-schema.org/draft-04/schema#',
119
+			'title' => $this->model->get_this_model_name(),
120
+			'type' => 'object',
121
+			'properties' => array()
122
+		);
123
+	}
124
+
125
+
126
+	/**
127
+	 * Allows one to just use the object as a string to get the json.
128
+	 * eg.
129
+	 *
130
+	 * $json_schema = new JsonModelSchema(EEM_Event::instance());
131
+	 * echo $json_schema; //outputs the schema as a json formatted string.
132
+	 *
133
+	 * @return bool|false|mixed|string
134
+	 */
135
+	public function __toString()
136
+	{
137
+		return wp_json_encode($this->getModelSchema());
138
+	}
139 139
 }
Please login to merge, or discard this patch.
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -34,7 +34,7 @@  discard block
 block discarded – undo
34 34
      *
35 35
      * @param \EEM_Base $model
36 36
      */
37
-    public function __construct(EEM_Base $model){
37
+    public function __construct(EEM_Base $model) {
38 38
         $this->model = $model;
39 39
     }
40 40
 
@@ -63,7 +63,7 @@  discard block
 block discarded – undo
63 63
     public function getModelSchemaForFields(array $model_fields, array $schema)
64 64
     {
65 65
         foreach ($model_fields as $field => $model_field) {
66
-            if (! $model_field instanceof EE_Model_Field_Base) {
66
+            if ( ! $model_field instanceof EE_Model_Field_Base) {
67 67
                 continue;
68 68
             }
69 69
             $schema['properties'][$field] = $model_field->getSchema();
@@ -94,7 +94,7 @@  discard block
 block discarded – undo
94 94
     public function getModelSchemaForRelations(array $relations_on_model, array $schema)
95 95
     {
96 96
         foreach ($relations_on_model as $model_name => $relation) {
97
-            if (! $relation instanceof EE_Model_Relation_Base) {
97
+            if ( ! $relation instanceof EE_Model_Relation_Base) {
98 98
                 continue;
99 99
             }
100 100
             $model_name_for_schema = $relation instanceof EE_Belongs_To_Relation
Please login to merge, or discard this patch.
core/entities/interfaces/HasSchemaInterface.php 1 patch
Indentation   +50 added lines, -50 removed lines patch added patch discarded remove patch
@@ -5,63 +5,63 @@
 block discarded – undo
5 5
 
6 6
 interface HasSchemaInterface
7 7
 {
8
-    /**
9
-     * Returns whatever is set as the nicename for the object.
10
-     *
11
-     * @return string
12
-     */
13
-    public function getSchemaDescription();
8
+	/**
9
+	 * Returns whatever is set as the nicename for the object.
10
+	 *
11
+	 * @return string
12
+	 */
13
+	public function getSchemaDescription();
14 14
 
15 15
 
16
-    /**
17
-     * Returns whatever is set as the $_schema_type property for the object.
18
-     * Note: this will automatically add 'null' to the schema if the object is_nullable()
19
-     *
20
-     * @return string|array
21
-     */
22
-    public function getSchemaType();
16
+	/**
17
+	 * Returns whatever is set as the $_schema_type property for the object.
18
+	 * Note: this will automatically add 'null' to the schema if the object is_nullable()
19
+	 *
20
+	 * @return string|array
21
+	 */
22
+	public function getSchemaType();
23 23
 
24 24
 
25
-    /**
26
-     * This is usually present when the $_schema_type property is 'object'.  Any child classes will need to override
27
-     * this method and return the properties for the schema.
28
-     * The reason this is not a property on the class is because there may be filters set on the values for the property
29
-     * that won't be exposed on construct.  For example enum type schemas may have the enum values filtered.
30
-     *
31
-     * @return array
32
-     */
33
-    public function getSchemaProperties();
25
+	/**
26
+	 * This is usually present when the $_schema_type property is 'object'.  Any child classes will need to override
27
+	 * this method and return the properties for the schema.
28
+	 * The reason this is not a property on the class is because there may be filters set on the values for the property
29
+	 * that won't be exposed on construct.  For example enum type schemas may have the enum values filtered.
30
+	 *
31
+	 * @return array
32
+	 */
33
+	public function getSchemaProperties();
34 34
 
35
-    /**
36
-     * If a child class has enum values, they should override this method and provide a simple array
37
-     * of the enum values.
38
-     * The reason this is not a property on the class is because there may be filterable enum values that
39
-     * are set on the instantiated object that could be filtered after construct.
40
-     *
41
-     * @return array
42
-     */
43
-    public function getSchemaEnum();
35
+	/**
36
+	 * If a child class has enum values, they should override this method and provide a simple array
37
+	 * of the enum values.
38
+	 * The reason this is not a property on the class is because there may be filterable enum values that
39
+	 * are set on the instantiated object that could be filtered after construct.
40
+	 *
41
+	 * @return array
42
+	 */
43
+	public function getSchemaEnum();
44 44
 
45
-    /**
46
-     * This returns the value of the $_schema_format property on the object.
47
-     *
48
-     * @return string
49
-     */
50
-    public function getSchemaFormat();
45
+	/**
46
+	 * This returns the value of the $_schema_format property on the object.
47
+	 *
48
+	 * @return string
49
+	 */
50
+	public function getSchemaFormat();
51 51
 
52
-    /**
53
-     * This returns the value of the $_schema_readonly property on the object.
54
-     *
55
-     * @return bool
56
-     */
57
-    public function getSchemaReadonly();
52
+	/**
53
+	 * This returns the value of the $_schema_readonly property on the object.
54
+	 *
55
+	 * @return bool
56
+	 */
57
+	public function getSchemaReadonly();
58 58
 
59 59
 
60
-    /**
61
-     * This returns elements used to represent this field in the json schema.
62
-     *
63
-     * @link http://json-schema.org/
64
-     * @return array
65
-     */
66
-    public function getSchema();
60
+	/**
61
+	 * This returns elements used to represent this field in the json schema.
62
+	 *
63
+	 * @link http://json-schema.org/
64
+	 * @return array
65
+	 */
66
+	public function getSchema();
67 67
 }
68 68
\ No newline at end of file
Please login to merge, or discard this patch.
core/db_models/fields/EE_Text_Field_Base.php 1 patch
Indentation   +30 added lines, -30 removed lines patch added patch discarded remove patch
@@ -7,36 +7,36 @@
 block discarded – undo
7 7
 abstract class EE_Text_Field_Base extends EE_Model_Field_Base
8 8
 {
9 9
 
10
-    function prepare_for_get($value_of_field_on_model_object)
11
-    {
12
-        return is_string($value_of_field_on_model_object) ? stripslashes($value_of_field_on_model_object) : $value_of_field_on_model_object;
13
-    }
10
+	function prepare_for_get($value_of_field_on_model_object)
11
+	{
12
+		return is_string($value_of_field_on_model_object) ? stripslashes($value_of_field_on_model_object) : $value_of_field_on_model_object;
13
+	}
14 14
 
15
-    /**
16
-     * Accepts schema of 'form_input' which formats the string for echoing in form input's value.
17
-     *
18
-     * @param string $value_on_field_to_be_outputted
19
-     * @param string $schema
20
-     * @return string
21
-     */
22
-    function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
23
-    {
24
-        if ($schema == 'form_input') {
25
-            $value_on_field_to_be_outputted = htmlentities($value_on_field_to_be_outputted, ENT_QUOTES, 'UTF-8');
26
-        }
27
-        return parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema);
28
-    }
15
+	/**
16
+	 * Accepts schema of 'form_input' which formats the string for echoing in form input's value.
17
+	 *
18
+	 * @param string $value_on_field_to_be_outputted
19
+	 * @param string $schema
20
+	 * @return string
21
+	 */
22
+	function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
23
+	{
24
+		if ($schema == 'form_input') {
25
+			$value_on_field_to_be_outputted = htmlentities($value_on_field_to_be_outputted, ENT_QUOTES, 'UTF-8');
26
+		}
27
+		return parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema);
28
+	}
29 29
 
30
-    /**
31
-     * In form inputs, we should have called htmlentities and addslashes on form inputs,
32
-     * so we need to undo that on setting of these fields
33
-     *
34
-     * @param string $value_inputted_for_field_on_model_object
35
-     * @return string
36
-     */
37
-    function prepare_for_set($value_inputted_for_field_on_model_object)
38
-    {
39
-        return stripslashes(html_entity_decode(parent::prepare_for_set($value_inputted_for_field_on_model_object),
40
-            ENT_QUOTES, 'UTF-8'));
41
-    }
30
+	/**
31
+	 * In form inputs, we should have called htmlentities and addslashes on form inputs,
32
+	 * so we need to undo that on setting of these fields
33
+	 *
34
+	 * @param string $value_inputted_for_field_on_model_object
35
+	 * @return string
36
+	 */
37
+	function prepare_for_set($value_inputted_for_field_on_model_object)
38
+	{
39
+		return stripslashes(html_entity_decode(parent::prepare_for_set($value_inputted_for_field_on_model_object),
40
+			ENT_QUOTES, 'UTF-8'));
41
+	}
42 42
 }
43 43
\ No newline at end of file
Please login to merge, or discard this patch.
core/db_models/fields/EE_Primary_Key_String_Field.php 2 patches
Indentation   +17 added lines, -17 removed lines patch added patch discarded remove patch
@@ -4,22 +4,22 @@
 block discarded – undo
4 4
 class EE_Primary_Key_String_Field extends EE_Primary_Key_Field_Base
5 5
 {
6 6
 
7
-    public function __construct($table_column, $nicename)
8
-    {
9
-        parent::__construct($table_column, $nicename, null);
10
-    }
7
+	public function __construct($table_column, $nicename)
8
+	{
9
+		parent::__construct($table_column, $nicename, null);
10
+	}
11 11
 
12
-    /**
13
-     * removes all tags when setting
14
-     *
15
-     * @param string $value_inputted_for_field_on_model_object
16
-     * @return string
17
-     */
18
-    function prepare_for_set($value_inputted_for_field_on_model_object)
19
-    {
20
-        if ($this->is_model_obj_of_type_pointed_to($value_inputted_for_field_on_model_object)) {
21
-            $value_inputted_for_field_on_model_object = $value_inputted_for_field_on_model_object->ID();
22
-        }
23
-        return wp_strip_all_tags($value_inputted_for_field_on_model_object);
24
-    }
12
+	/**
13
+	 * removes all tags when setting
14
+	 *
15
+	 * @param string $value_inputted_for_field_on_model_object
16
+	 * @return string
17
+	 */
18
+	function prepare_for_set($value_inputted_for_field_on_model_object)
19
+	{
20
+		if ($this->is_model_obj_of_type_pointed_to($value_inputted_for_field_on_model_object)) {
21
+			$value_inputted_for_field_on_model_object = $value_inputted_for_field_on_model_object->ID();
22
+		}
23
+		return wp_strip_all_tags($value_inputted_for_field_on_model_object);
24
+	}
25 25
 }
26 26
\ No newline at end of file
Please login to merge, or discard this patch.
Doc Comments   +3 added lines patch added patch discarded remove patch
@@ -4,6 +4,9 @@
 block discarded – undo
4 4
 class EE_Primary_Key_String_Field extends EE_Primary_Key_Field_Base
5 5
 {
6 6
 
7
+    /**
8
+     * @param string $table_column
9
+     */
7 10
     public function __construct($table_column, $nicename)
8 11
     {
9 12
         parent::__construct($table_column, $nicename, null);
Please login to merge, or discard this patch.
core/db_models/fields/EE_All_Caps_Text_Field.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -6,14 +6,14 @@
 block discarded – undo
6 6
  */
7 7
 class EE_All_Caps_Text_Field extends EE_Text_Field_Base
8 8
 {
9
-    /**
10
-     * makes it all upper case, and key-like
11
-     *
12
-     * @param string $value_inputted_for_field_on_model_object
13
-     * @return string
14
-     */
15
-    function prepare_for_set($value_inputted_for_field_on_model_object)
16
-    {
17
-        return strtoupper(sanitize_key($value_inputted_for_field_on_model_object));
18
-    }
9
+	/**
10
+	 * makes it all upper case, and key-like
11
+	 *
12
+	 * @param string $value_inputted_for_field_on_model_object
13
+	 * @return string
14
+	 */
15
+	function prepare_for_set($value_inputted_for_field_on_model_object)
16
+	{
17
+		return strtoupper(sanitize_key($value_inputted_for_field_on_model_object));
18
+	}
19 19
 }
20 20
\ No newline at end of file
Please login to merge, or discard this patch.
core/db_models/fields/EE_DB_Only_Field_Base.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
      * @param string $table_column
16 16
      * @param string $nicename
17 17
      * @param bool   $nullable
18
-     * @param null   $default_value
18
+     * @param string|null   $default_value
19 19
      */
20 20
     public function __construct($table_column, $nicename, $nullable, $default_value = null)
21 21
     {
Please login to merge, or discard this patch.
Indentation   +22 added lines, -22 removed lines patch added patch discarded remove patch
@@ -11,28 +11,28 @@
 block discarded – undo
11 11
 abstract class EE_DB_Only_Field_Base extends EE_Model_Field_Base
12 12
 {
13 13
 
14
-    /**
15
-     * @param string $table_column
16
-     * @param string $nicename
17
-     * @param bool   $nullable
18
-     * @param null   $default_value
19
-     */
20
-    public function __construct($table_column, $nicename, $nullable, $default_value = null)
21
-    {
22
-        parent::__construct($table_column, $nicename, $nullable, $default_value);
23
-        $this->setSchemaReadOnly(true);
24
-    }
14
+	/**
15
+	 * @param string $table_column
16
+	 * @param string $nicename
17
+	 * @param bool   $nullable
18
+	 * @param null   $default_value
19
+	 */
20
+	public function __construct($table_column, $nicename, $nullable, $default_value = null)
21
+	{
22
+		parent::__construct($table_column, $nicename, $nullable, $default_value);
23
+		$this->setSchemaReadOnly(true);
24
+	}
25 25
 
26 26
 
27
-    /**
28
-     * All these children classes are for the db-only (meaning, we should select them
29
-     * on get_all queries, update, delete, and will still want to set their default value
30
-     * on inserts, but the model object won't have reference to these fields)
31
-     *
32
-     * @return boolean
33
-     */
34
-    function is_db_only_field()
35
-    {
36
-        return true;
37
-    }
27
+	/**
28
+	 * All these children classes are for the db-only (meaning, we should select them
29
+	 * on get_all queries, update, delete, and will still want to set their default value
30
+	 * on inserts, but the model object won't have reference to these fields)
31
+	 *
32
+	 * @return boolean
33
+	 */
34
+	function is_db_only_field()
35
+	{
36
+		return true;
37
+	}
38 38
 }
39 39
\ No newline at end of file
Please login to merge, or discard this patch.
core/db_models/fields/EE_Email_Field.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -13,7 +13,7 @@
 block discarded – undo
13 13
      * @param string $table_column
14 14
      * @param string $nicename
15 15
      * @param bool   $nullable
16
-     * @param null   $default_value
16
+     * @param string   $default_value
17 17
      */
18 18
     public function __construct($table_column, $nicename, $nullable, $default_value = null)
19 19
     {
Please login to merge, or discard this patch.
Indentation   +42 added lines, -42 removed lines patch added patch discarded remove patch
@@ -9,48 +9,48 @@
 block discarded – undo
9 9
  */
10 10
 class EE_Email_Field extends EE_Text_Field_Base
11 11
 {
12
-    /**
13
-     * @param string $table_column
14
-     * @param string $nicename
15
-     * @param bool   $nullable
16
-     * @param null   $default_value
17
-     */
18
-    public function __construct($table_column, $nicename, $nullable, $default_value = null)
19
-    {
20
-        parent::__construct($table_column, $nicename, $nullable, $default_value);
21
-        $this->setSchemaFormat('email');
22
-    }
12
+	/**
13
+	 * @param string $table_column
14
+	 * @param string $nicename
15
+	 * @param bool   $nullable
16
+	 * @param null   $default_value
17
+	 */
18
+	public function __construct($table_column, $nicename, $nullable, $default_value = null)
19
+	{
20
+		parent::__construct($table_column, $nicename, $nullable, $default_value);
21
+		$this->setSchemaFormat('email');
22
+	}
23 23
 
24 24
 
25
-    /**
26
-     * In form inputs, we should have called htmlentities and addslashes() on form inputs,
27
-     * so we need to undo that on setting of these fields
28
-     *
29
-     * @param string $email_address
30
-     * @return string
31
-     */
32
-    function prepare_for_set($email_address)
33
-    {
34
-        $validation_level = isset(EE_Registry::instance()->CFG->registration->email_validation_level)
35
-            ? EE_Registry::instance()->CFG->registration->email_validation_level
36
-            : 'wp_default';
37
-        if ($validation_level === 'basic' && ! preg_match('/^.+\@\S+$/', $email_address)) {
38
-            // email not even in correct {string}@{string} format
39
-            return '';
40
-        } else if ($validation_level === 'wp_default' && ! is_email($email_address)) {
41
-            //not a valid email.
42
-            return '';
43
-        } else if (
44
-            ($validation_level === 'i18n' || $validation_level === 'i18n_dns')
45
-            // plz see http://stackoverflow.com/a/24817336 re: the following regex
46
-            && ! preg_match(
47
-                '/^(?!\.)((?!.*\.{2})[a-zA-Z0-9\x{0080}-\x{00FF}\x{0100}-\x{017F}\x{0180}-\x{024F}\x{0250}-\x{02AF}\x{0300}-\x{036F}\x{0370}-\x{03FF}\x{0400}-\x{04FF}\x{0500}-\x{052F}\x{0530}-\x{058F}\x{0590}-\x{05FF}\x{0600}-\x{06FF}\x{0700}-\x{074F}\x{0750}-\x{077F}\x{0780}-\x{07BF}\x{07C0}-\x{07FF}\x{0900}-\x{097F}\x{0980}-\x{09FF}\x{0A00}-\x{0A7F}\x{0A80}-\x{0AFF}\x{0B00}-\x{0B7F}\x{0B80}-\x{0BFF}\x{0C00}-\x{0C7F}\x{0C80}-\x{0CFF}\x{0D00}-\x{0D7F}\x{0D80}-\x{0DFF}\x{0E00}-\x{0E7F}\x{0E80}-\x{0EFF}\x{0F00}-\x{0FFF}\x{1000}-\x{109F}\x{10A0}-\x{10FF}\x{1100}-\x{11FF}\x{1200}-\x{137F}\x{1380}-\x{139F}\x{13A0}-\x{13FF}\x{1400}-\x{167F}\x{1680}-\x{169F}\x{16A0}-\x{16FF}\x{1700}-\x{171F}\x{1720}-\x{173F}\x{1740}-\x{175F}\x{1760}-\x{177F}\x{1780}-\x{17FF}\x{1800}-\x{18AF}\x{1900}-\x{194F}\x{1950}-\x{197F}\x{1980}-\x{19DF}\x{19E0}-\x{19FF}\x{1A00}-\x{1A1F}\x{1B00}-\x{1B7F}\x{1D00}-\x{1D7F}\x{1D80}-\x{1DBF}\x{1DC0}-\x{1DFF}\x{1E00}-\x{1EFF}\x{1F00}-\x{1FFF}\x{20D0}-\x{20FF}\x{2100}-\x{214F}\x{2C00}-\x{2C5F}\x{2C60}-\x{2C7F}\x{2C80}-\x{2CFF}\x{2D00}-\x{2D2F}\x{2D30}-\x{2D7F}\x{2D80}-\x{2DDF}\x{2F00}-\x{2FDF}\x{2FF0}-\x{2FFF}\x{3040}-\x{309F}\x{30A0}-\x{30FF}\x{3100}-\x{312F}\x{3130}-\x{318F}\x{3190}-\x{319F}\x{31C0}-\x{31EF}\x{31F0}-\x{31FF}\x{3200}-\x{32FF}\x{3300}-\x{33FF}\x{3400}-\x{4DBF}\x{4DC0}-\x{4DFF}\x{4E00}-\x{9FFF}\x{A000}-\x{A48F}\x{A490}-\x{A4CF}\x{A700}-\x{A71F}\x{A800}-\x{A82F}\x{A840}-\x{A87F}\x{AC00}-\x{D7AF}\x{F900}-\x{FAFF}\.!#$%&\'*+-\/=?^_`{|}~\-\d]+)@(?!\.)([a-zA-Z0-9\x{0080}-\x{00FF}\x{0100}-\x{017F}\x{0180}-\x{024F}\x{0250}-\x{02AF}\x{0300}-\x{036F}\x{0370}-\x{03FF}\x{0400}-\x{04FF}\x{0500}-\x{052F}\x{0530}-\x{058F}\x{0590}-\x{05FF}\x{0600}-\x{06FF}\x{0700}-\x{074F}\x{0750}-\x{077F}\x{0780}-\x{07BF}\x{07C0}-\x{07FF}\x{0900}-\x{097F}\x{0980}-\x{09FF}\x{0A00}-\x{0A7F}\x{0A80}-\x{0AFF}\x{0B00}-\x{0B7F}\x{0B80}-\x{0BFF}\x{0C00}-\x{0C7F}\x{0C80}-\x{0CFF}\x{0D00}-\x{0D7F}\x{0D80}-\x{0DFF}\x{0E00}-\x{0E7F}\x{0E80}-\x{0EFF}\x{0F00}-\x{0FFF}\x{1000}-\x{109F}\x{10A0}-\x{10FF}\x{1100}-\x{11FF}\x{1200}-\x{137F}\x{1380}-\x{139F}\x{13A0}-\x{13FF}\x{1400}-\x{167F}\x{1680}-\x{169F}\x{16A0}-\x{16FF}\x{1700}-\x{171F}\x{1720}-\x{173F}\x{1740}-\x{175F}\x{1760}-\x{177F}\x{1780}-\x{17FF}\x{1800}-\x{18AF}\x{1900}-\x{194F}\x{1950}-\x{197F}\x{1980}-\x{19DF}\x{19E0}-\x{19FF}\x{1A00}-\x{1A1F}\x{1B00}-\x{1B7F}\x{1D00}-\x{1D7F}\x{1D80}-\x{1DBF}\x{1DC0}-\x{1DFF}\x{1E00}-\x{1EFF}\x{1F00}-\x{1FFF}\x{20D0}-\x{20FF}\x{2100}-\x{214F}\x{2C00}-\x{2C5F}\x{2C60}-\x{2C7F}\x{2C80}-\x{2CFF}\x{2D00}-\x{2D2F}\x{2D30}-\x{2D7F}\x{2D80}-\x{2DDF}\x{2F00}-\x{2FDF}\x{2FF0}-\x{2FFF}\x{3040}-\x{309F}\x{30A0}-\x{30FF}\x{3100}-\x{312F}\x{3130}-\x{318F}\x{3190}-\x{319F}\x{31C0}-\x{31EF}\x{31F0}-\x{31FF}\x{3200}-\x{32FF}\x{3300}-\x{33FF}\x{3400}-\x{4DBF}\x{4DC0}-\x{4DFF}\x{4E00}-\x{9FFF}\x{A000}-\x{A48F}\x{A490}-\x{A4CF}\x{A700}-\x{A71F}\x{A800}-\x{A82F}\x{A840}-\x{A87F}\x{AC00}-\x{D7AF}\x{F900}-\x{FAFF}\-\.\d]+)((\.([a-zA-Z\x{0080}-\x{00FF}\x{0100}-\x{017F}\x{0180}-\x{024F}\x{0250}-\x{02AF}\x{0300}-\x{036F}\x{0370}-\x{03FF}\x{0400}-\x{04FF}\x{0500}-\x{052F}\x{0530}-\x{058F}\x{0590}-\x{05FF}\x{0600}-\x{06FF}\x{0700}-\x{074F}\x{0750}-\x{077F}\x{0780}-\x{07BF}\x{07C0}-\x{07FF}\x{0900}-\x{097F}\x{0980}-\x{09FF}\x{0A00}-\x{0A7F}\x{0A80}-\x{0AFF}\x{0B00}-\x{0B7F}\x{0B80}-\x{0BFF}\x{0C00}-\x{0C7F}\x{0C80}-\x{0CFF}\x{0D00}-\x{0D7F}\x{0D80}-\x{0DFF}\x{0E00}-\x{0E7F}\x{0E80}-\x{0EFF}\x{0F00}-\x{0FFF}\x{1000}-\x{109F}\x{10A0}-\x{10FF}\x{1100}-\x{11FF}\x{1200}-\x{137F}\x{1380}-\x{139F}\x{13A0}-\x{13FF}\x{1400}-\x{167F}\x{1680}-\x{169F}\x{16A0}-\x{16FF}\x{1700}-\x{171F}\x{1720}-\x{173F}\x{1740}-\x{175F}\x{1760}-\x{177F}\x{1780}-\x{17FF}\x{1800}-\x{18AF}\x{1900}-\x{194F}\x{1950}-\x{197F}\x{1980}-\x{19DF}\x{19E0}-\x{19FF}\x{1A00}-\x{1A1F}\x{1B00}-\x{1B7F}\x{1D00}-\x{1D7F}\x{1D80}-\x{1DBF}\x{1DC0}-\x{1DFF}\x{1E00}-\x{1EFF}\x{1F00}-\x{1FFF}\x{20D0}-\x{20FF}\x{2100}-\x{214F}\x{2C00}-\x{2C5F}\x{2C60}-\x{2C7F}\x{2C80}-\x{2CFF}\x{2D00}-\x{2D2F}\x{2D30}-\x{2D7F}\x{2D80}-\x{2DDF}\x{2F00}-\x{2FDF}\x{2FF0}-\x{2FFF}\x{3040}-\x{309F}\x{30A0}-\x{30FF}\x{3100}-\x{312F}\x{3130}-\x{318F}\x{3190}-\x{319F}\x{31C0}-\x{31EF}\x{31F0}-\x{31FF}\x{3200}-\x{32FF}\x{3300}-\x{33FF}\x{3400}-\x{4DBF}\x{4DC0}-\x{4DFF}\x{4E00}-\x{9FFF}\x{A000}-\x{A48F}\x{A490}-\x{A4CF}\x{A700}-\x{A71F}\x{A800}-\x{A82F}\x{A840}-\x{A87F}\x{AC00}-\x{D7AF}\x{F900}-\x{FAFF}]){2,63})+)$/u',
48
-                $email_address
49
-            )
50
-        ) {
51
-            //not a valid email.
52
-            return '';
53
-        }
54
-        return $email_address;
55
-    }
25
+	/**
26
+	 * In form inputs, we should have called htmlentities and addslashes() on form inputs,
27
+	 * so we need to undo that on setting of these fields
28
+	 *
29
+	 * @param string $email_address
30
+	 * @return string
31
+	 */
32
+	function prepare_for_set($email_address)
33
+	{
34
+		$validation_level = isset(EE_Registry::instance()->CFG->registration->email_validation_level)
35
+			? EE_Registry::instance()->CFG->registration->email_validation_level
36
+			: 'wp_default';
37
+		if ($validation_level === 'basic' && ! preg_match('/^.+\@\S+$/', $email_address)) {
38
+			// email not even in correct {string}@{string} format
39
+			return '';
40
+		} else if ($validation_level === 'wp_default' && ! is_email($email_address)) {
41
+			//not a valid email.
42
+			return '';
43
+		} else if (
44
+			($validation_level === 'i18n' || $validation_level === 'i18n_dns')
45
+			// plz see http://stackoverflow.com/a/24817336 re: the following regex
46
+			&& ! preg_match(
47
+				'/^(?!\.)((?!.*\.{2})[a-zA-Z0-9\x{0080}-\x{00FF}\x{0100}-\x{017F}\x{0180}-\x{024F}\x{0250}-\x{02AF}\x{0300}-\x{036F}\x{0370}-\x{03FF}\x{0400}-\x{04FF}\x{0500}-\x{052F}\x{0530}-\x{058F}\x{0590}-\x{05FF}\x{0600}-\x{06FF}\x{0700}-\x{074F}\x{0750}-\x{077F}\x{0780}-\x{07BF}\x{07C0}-\x{07FF}\x{0900}-\x{097F}\x{0980}-\x{09FF}\x{0A00}-\x{0A7F}\x{0A80}-\x{0AFF}\x{0B00}-\x{0B7F}\x{0B80}-\x{0BFF}\x{0C00}-\x{0C7F}\x{0C80}-\x{0CFF}\x{0D00}-\x{0D7F}\x{0D80}-\x{0DFF}\x{0E00}-\x{0E7F}\x{0E80}-\x{0EFF}\x{0F00}-\x{0FFF}\x{1000}-\x{109F}\x{10A0}-\x{10FF}\x{1100}-\x{11FF}\x{1200}-\x{137F}\x{1380}-\x{139F}\x{13A0}-\x{13FF}\x{1400}-\x{167F}\x{1680}-\x{169F}\x{16A0}-\x{16FF}\x{1700}-\x{171F}\x{1720}-\x{173F}\x{1740}-\x{175F}\x{1760}-\x{177F}\x{1780}-\x{17FF}\x{1800}-\x{18AF}\x{1900}-\x{194F}\x{1950}-\x{197F}\x{1980}-\x{19DF}\x{19E0}-\x{19FF}\x{1A00}-\x{1A1F}\x{1B00}-\x{1B7F}\x{1D00}-\x{1D7F}\x{1D80}-\x{1DBF}\x{1DC0}-\x{1DFF}\x{1E00}-\x{1EFF}\x{1F00}-\x{1FFF}\x{20D0}-\x{20FF}\x{2100}-\x{214F}\x{2C00}-\x{2C5F}\x{2C60}-\x{2C7F}\x{2C80}-\x{2CFF}\x{2D00}-\x{2D2F}\x{2D30}-\x{2D7F}\x{2D80}-\x{2DDF}\x{2F00}-\x{2FDF}\x{2FF0}-\x{2FFF}\x{3040}-\x{309F}\x{30A0}-\x{30FF}\x{3100}-\x{312F}\x{3130}-\x{318F}\x{3190}-\x{319F}\x{31C0}-\x{31EF}\x{31F0}-\x{31FF}\x{3200}-\x{32FF}\x{3300}-\x{33FF}\x{3400}-\x{4DBF}\x{4DC0}-\x{4DFF}\x{4E00}-\x{9FFF}\x{A000}-\x{A48F}\x{A490}-\x{A4CF}\x{A700}-\x{A71F}\x{A800}-\x{A82F}\x{A840}-\x{A87F}\x{AC00}-\x{D7AF}\x{F900}-\x{FAFF}\.!#$%&\'*+-\/=?^_`{|}~\-\d]+)@(?!\.)([a-zA-Z0-9\x{0080}-\x{00FF}\x{0100}-\x{017F}\x{0180}-\x{024F}\x{0250}-\x{02AF}\x{0300}-\x{036F}\x{0370}-\x{03FF}\x{0400}-\x{04FF}\x{0500}-\x{052F}\x{0530}-\x{058F}\x{0590}-\x{05FF}\x{0600}-\x{06FF}\x{0700}-\x{074F}\x{0750}-\x{077F}\x{0780}-\x{07BF}\x{07C0}-\x{07FF}\x{0900}-\x{097F}\x{0980}-\x{09FF}\x{0A00}-\x{0A7F}\x{0A80}-\x{0AFF}\x{0B00}-\x{0B7F}\x{0B80}-\x{0BFF}\x{0C00}-\x{0C7F}\x{0C80}-\x{0CFF}\x{0D00}-\x{0D7F}\x{0D80}-\x{0DFF}\x{0E00}-\x{0E7F}\x{0E80}-\x{0EFF}\x{0F00}-\x{0FFF}\x{1000}-\x{109F}\x{10A0}-\x{10FF}\x{1100}-\x{11FF}\x{1200}-\x{137F}\x{1380}-\x{139F}\x{13A0}-\x{13FF}\x{1400}-\x{167F}\x{1680}-\x{169F}\x{16A0}-\x{16FF}\x{1700}-\x{171F}\x{1720}-\x{173F}\x{1740}-\x{175F}\x{1760}-\x{177F}\x{1780}-\x{17FF}\x{1800}-\x{18AF}\x{1900}-\x{194F}\x{1950}-\x{197F}\x{1980}-\x{19DF}\x{19E0}-\x{19FF}\x{1A00}-\x{1A1F}\x{1B00}-\x{1B7F}\x{1D00}-\x{1D7F}\x{1D80}-\x{1DBF}\x{1DC0}-\x{1DFF}\x{1E00}-\x{1EFF}\x{1F00}-\x{1FFF}\x{20D0}-\x{20FF}\x{2100}-\x{214F}\x{2C00}-\x{2C5F}\x{2C60}-\x{2C7F}\x{2C80}-\x{2CFF}\x{2D00}-\x{2D2F}\x{2D30}-\x{2D7F}\x{2D80}-\x{2DDF}\x{2F00}-\x{2FDF}\x{2FF0}-\x{2FFF}\x{3040}-\x{309F}\x{30A0}-\x{30FF}\x{3100}-\x{312F}\x{3130}-\x{318F}\x{3190}-\x{319F}\x{31C0}-\x{31EF}\x{31F0}-\x{31FF}\x{3200}-\x{32FF}\x{3300}-\x{33FF}\x{3400}-\x{4DBF}\x{4DC0}-\x{4DFF}\x{4E00}-\x{9FFF}\x{A000}-\x{A48F}\x{A490}-\x{A4CF}\x{A700}-\x{A71F}\x{A800}-\x{A82F}\x{A840}-\x{A87F}\x{AC00}-\x{D7AF}\x{F900}-\x{FAFF}\-\.\d]+)((\.([a-zA-Z\x{0080}-\x{00FF}\x{0100}-\x{017F}\x{0180}-\x{024F}\x{0250}-\x{02AF}\x{0300}-\x{036F}\x{0370}-\x{03FF}\x{0400}-\x{04FF}\x{0500}-\x{052F}\x{0530}-\x{058F}\x{0590}-\x{05FF}\x{0600}-\x{06FF}\x{0700}-\x{074F}\x{0750}-\x{077F}\x{0780}-\x{07BF}\x{07C0}-\x{07FF}\x{0900}-\x{097F}\x{0980}-\x{09FF}\x{0A00}-\x{0A7F}\x{0A80}-\x{0AFF}\x{0B00}-\x{0B7F}\x{0B80}-\x{0BFF}\x{0C00}-\x{0C7F}\x{0C80}-\x{0CFF}\x{0D00}-\x{0D7F}\x{0D80}-\x{0DFF}\x{0E00}-\x{0E7F}\x{0E80}-\x{0EFF}\x{0F00}-\x{0FFF}\x{1000}-\x{109F}\x{10A0}-\x{10FF}\x{1100}-\x{11FF}\x{1200}-\x{137F}\x{1380}-\x{139F}\x{13A0}-\x{13FF}\x{1400}-\x{167F}\x{1680}-\x{169F}\x{16A0}-\x{16FF}\x{1700}-\x{171F}\x{1720}-\x{173F}\x{1740}-\x{175F}\x{1760}-\x{177F}\x{1780}-\x{17FF}\x{1800}-\x{18AF}\x{1900}-\x{194F}\x{1950}-\x{197F}\x{1980}-\x{19DF}\x{19E0}-\x{19FF}\x{1A00}-\x{1A1F}\x{1B00}-\x{1B7F}\x{1D00}-\x{1D7F}\x{1D80}-\x{1DBF}\x{1DC0}-\x{1DFF}\x{1E00}-\x{1EFF}\x{1F00}-\x{1FFF}\x{20D0}-\x{20FF}\x{2100}-\x{214F}\x{2C00}-\x{2C5F}\x{2C60}-\x{2C7F}\x{2C80}-\x{2CFF}\x{2D00}-\x{2D2F}\x{2D30}-\x{2D7F}\x{2D80}-\x{2DDF}\x{2F00}-\x{2FDF}\x{2FF0}-\x{2FFF}\x{3040}-\x{309F}\x{30A0}-\x{30FF}\x{3100}-\x{312F}\x{3130}-\x{318F}\x{3190}-\x{319F}\x{31C0}-\x{31EF}\x{31F0}-\x{31FF}\x{3200}-\x{32FF}\x{3300}-\x{33FF}\x{3400}-\x{4DBF}\x{4DC0}-\x{4DFF}\x{4E00}-\x{9FFF}\x{A000}-\x{A48F}\x{A490}-\x{A4CF}\x{A700}-\x{A71F}\x{A800}-\x{A82F}\x{A840}-\x{A87F}\x{AC00}-\x{D7AF}\x{F900}-\x{FAFF}]){2,63})+)$/u',
48
+				$email_address
49
+			)
50
+		) {
51
+			//not a valid email.
52
+			return '';
53
+		}
54
+		return $email_address;
55
+	}
56 56
 }
Please login to merge, or discard this patch.
core/db_models/fields/EE_Float_Field.php 2 patches
Doc Comments   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -12,7 +12,7 @@  discard block
 block discarded – undo
12 12
      * @param string $table_column
13 13
      * @param string $nicename
14 14
      * @param bool   $nullable
15
-     * @param null   $default_value
15
+     * @param integer|null   $default_value
16 16
      */
17 17
     public function __construct($table_column, $nicename, $nullable, $default_value = null)
18 18
     {
@@ -27,7 +27,7 @@  discard block
 block discarded – undo
27 27
      * So if you want to pass in a string that NEEDS to interpret periods as decimal marks, call floatval() on it first.
28 28
      * Returns a float
29 29
      *
30
-     * @param type $value_inputted_for_field_on_model_object
30
+     * @param string $value_inputted_for_field_on_model_object
31 31
      * @return float
32 32
      */
33 33
     function prepare_for_set($value_inputted_for_field_on_model_object)
Please login to merge, or discard this patch.
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -8,64 +8,64 @@
 block discarded – undo
8 8
 class EE_Float_Field extends EE_Model_Field_Base
9 9
 {
10 10
 
11
-    /**
12
-     * @param string $table_column
13
-     * @param string $nicename
14
-     * @param bool   $nullable
15
-     * @param null   $default_value
16
-     */
17
-    public function __construct($table_column, $nicename, $nullable, $default_value = null)
18
-    {
19
-        parent::__construct($table_column, $nicename, $nullable, $default_value);
20
-        $this->setSchemaType('number');
21
-    }
11
+	/**
12
+	 * @param string $table_column
13
+	 * @param string $nicename
14
+	 * @param bool   $nullable
15
+	 * @param null   $default_value
16
+	 */
17
+	public function __construct($table_column, $nicename, $nullable, $default_value = null)
18
+	{
19
+		parent::__construct($table_column, $nicename, $nullable, $default_value);
20
+		$this->setSchemaType('number');
21
+	}
22 22
 
23 23
 
24
-    /**
25
-     * If provided a string, strips out number-related formatting, like commas, periods, spaces, other junk, etc.
26
-     * However, treats commas and periods as thousand-separators ro decimal marks, as indicate by the config's currency.
27
-     * So if you want to pass in a string that NEEDS to interpret periods as decimal marks, call floatval() on it first.
28
-     * Returns a float
29
-     *
30
-     * @param type $value_inputted_for_field_on_model_object
31
-     * @return float
32
-     */
33
-    function prepare_for_set($value_inputted_for_field_on_model_object)
34
-    {
24
+	/**
25
+	 * If provided a string, strips out number-related formatting, like commas, periods, spaces, other junk, etc.
26
+	 * However, treats commas and periods as thousand-separators ro decimal marks, as indicate by the config's currency.
27
+	 * So if you want to pass in a string that NEEDS to interpret periods as decimal marks, call floatval() on it first.
28
+	 * Returns a float
29
+	 *
30
+	 * @param type $value_inputted_for_field_on_model_object
31
+	 * @return float
32
+	 */
33
+	function prepare_for_set($value_inputted_for_field_on_model_object)
34
+	{
35 35
 //		echo __LINE__."$value_inputted_for_field_on_model_object<br>";
36
-        //remove whitespaces and thousands separators
37
-        if (is_string($value_inputted_for_field_on_model_object)) {
38
-            $value_inputted_for_field_on_model_object = str_replace(array(" ", EE_Config::instance()->currency->thsnds),
39
-                "", $value_inputted_for_field_on_model_object);
36
+		//remove whitespaces and thousands separators
37
+		if (is_string($value_inputted_for_field_on_model_object)) {
38
+			$value_inputted_for_field_on_model_object = str_replace(array(" ", EE_Config::instance()->currency->thsnds),
39
+				"", $value_inputted_for_field_on_model_object);
40 40
 //echo __LINE__."$value_inputted_for_field_on_model_object<br>";
41 41
 //normalize it so periods are decimal marks (we don't care where you're from: we're talking PHP now)
42
-            $value_inputted_for_field_on_model_object = str_replace(EE_Config::instance()->currency->dec_mrk, ".",
43
-                $value_inputted_for_field_on_model_object);
42
+			$value_inputted_for_field_on_model_object = str_replace(EE_Config::instance()->currency->dec_mrk, ".",
43
+				$value_inputted_for_field_on_model_object);
44 44
 //echo __LINE__."$value_inputted_for_field_on_model_object<br>";
45 45
 //double-check there's absolutely nothing left on this string besides numbers
46
-            $value_inputted_for_field_on_model_object = preg_replace("/[^0-9,.]/", "",
47
-                $value_inputted_for_field_on_model_object);
48
-        }
46
+			$value_inputted_for_field_on_model_object = preg_replace("/[^0-9,.]/", "",
47
+				$value_inputted_for_field_on_model_object);
48
+		}
49 49
 //		echo __LINE__."$value_inputted_for_field_on_model_object<br>";
50
-        return floatval($value_inputted_for_field_on_model_object);
51
-    }
50
+		return floatval($value_inputted_for_field_on_model_object);
51
+	}
52 52
 
53
-    /**
54
-     * Returns the number formatted according to local custom (set by the country of the blog).
55
-     *
56
-     * @param float $value_on_field_to_be_outputted
57
-     * @return string
58
-     */
59
-    function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
60
-    {
61
-        $EE = EE_Registry::instance();
62
-        return number_format($value_on_field_to_be_outputted, $EE->CFG->currency->dec_plc, $EE->CFG->currency->dec_mrk,
63
-            $EE->CFG->currency->thsnds);
64
-    }
53
+	/**
54
+	 * Returns the number formatted according to local custom (set by the country of the blog).
55
+	 *
56
+	 * @param float $value_on_field_to_be_outputted
57
+	 * @return string
58
+	 */
59
+	function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
60
+	{
61
+		$EE = EE_Registry::instance();
62
+		return number_format($value_on_field_to_be_outputted, $EE->CFG->currency->dec_plc, $EE->CFG->currency->dec_mrk,
63
+			$EE->CFG->currency->thsnds);
64
+	}
65 65
 
66
-    function prepare_for_set_from_db($value_found_in_db_for_model_object)
67
-    {
66
+	function prepare_for_set_from_db($value_found_in_db_for_model_object)
67
+	{
68 68
 //		echo "prepare for set from db of ";d($value_found_in_db_for_model_object);
69
-        return floatval($value_found_in_db_for_model_object);
70
-    }
69
+		return floatval($value_found_in_db_for_model_object);
70
+	}
71 71
 }
72 72
\ No newline at end of file
Please login to merge, or discard this patch.
core/db_models/fields/EE_Foreign_Key_Int_Field.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -8,7 +8,7 @@
 block discarded – undo
8 8
      * @param string  $table_column  name fo column for field
9 9
      * @param string  $nicename      should eb internationalized with __('blah','event_espresso')
10 10
      * @param boolean $nullable
11
-     * @param mixed   $default_value if this is a integer field, it shoudl be an int. if it's a string field, it shoul
11
+     * @param integer|null   $default_value if this is a integer field, it shoudl be an int. if it's a string field, it shoul
12 12
      *                               dbe a string
13 13
      * @param string  $model_name    eg 'Event','Answer','Term', etc. Basically its the model class's name without the
14 14
      *                               "EEM_"
Please login to merge, or discard this patch.
Indentation   +29 added lines, -29 removed lines patch added patch discarded remove patch
@@ -4,37 +4,37 @@
 block discarded – undo
4 4
 class EE_Foreign_Key_Int_Field extends EE_Foreign_Key_Field_Base
5 5
 {
6 6
 
7
-    /**
8
-     * @param string  $table_column  name fo column for field
9
-     * @param string  $nicename      should eb internationalized with __('blah','event_espresso')
10
-     * @param boolean $nullable
11
-     * @param mixed   $default_value if this is a integer field, it shoudl be an int. if it's a string field, it shoul
12
-     *                               dbe a string
13
-     * @param string  $model_name    eg 'Event','Answer','Term', etc. Basically its the model class's name without the
14
-     *                               "EEM_"
15
-     */
16
-    public function __construct($table_column, $nicename, $nullable, $default_value, $model_name)
17
-    {
18
-        parent::__construct($table_column, $nicename, $nullable, $default_value, $model_name);
19
-        $this->setSchemaType('integer');
20
-    }
7
+	/**
8
+	 * @param string  $table_column  name fo column for field
9
+	 * @param string  $nicename      should eb internationalized with __('blah','event_espresso')
10
+	 * @param boolean $nullable
11
+	 * @param mixed   $default_value if this is a integer field, it shoudl be an int. if it's a string field, it shoul
12
+	 *                               dbe a string
13
+	 * @param string  $model_name    eg 'Event','Answer','Term', etc. Basically its the model class's name without the
14
+	 *                               "EEM_"
15
+	 */
16
+	public function __construct($table_column, $nicename, $nullable, $default_value, $model_name)
17
+	{
18
+		parent::__construct($table_column, $nicename, $nullable, $default_value, $model_name);
19
+		$this->setSchemaType('integer');
20
+	}
21 21
 
22 22
 
23
-    /**
24
-     * @param int|EE_Base_Class $value_inputted_for_field_on_model_object
25
-     * @return int
26
-     */
27
-    function prepare_for_set($value_inputted_for_field_on_model_object)
28
-    {
29
-        if ($this->is_model_obj_of_type_pointed_to($value_inputted_for_field_on_model_object)) {
30
-            $value_inputted_for_field_on_model_object = $value_inputted_for_field_on_model_object->ID();
31
-        }
32
-        return absint($value_inputted_for_field_on_model_object);
33
-    }
23
+	/**
24
+	 * @param int|EE_Base_Class $value_inputted_for_field_on_model_object
25
+	 * @return int
26
+	 */
27
+	function prepare_for_set($value_inputted_for_field_on_model_object)
28
+	{
29
+		if ($this->is_model_obj_of_type_pointed_to($value_inputted_for_field_on_model_object)) {
30
+			$value_inputted_for_field_on_model_object = $value_inputted_for_field_on_model_object->ID();
31
+		}
32
+		return absint($value_inputted_for_field_on_model_object);
33
+	}
34 34
 
35
-    function prepare_for_set_from_db($value_found_in_db_for_model_object)
36
-    {
37
-        return intval($value_found_in_db_for_model_object);
38
-    }
35
+	function prepare_for_set_from_db($value_found_in_db_for_model_object)
36
+	{
37
+		return intval($value_found_in_db_for_model_object);
38
+	}
39 39
 
40 40
 }
41 41
\ No newline at end of file
Please login to merge, or discard this patch.