Completed
Branch FET/extra-logging-when-trashin... (b6e112)
by
unknown
36:04 queued 27:41
created
core/db_models/fields/EE_Text_Field_Base.php 1 patch
Indentation   +43 added lines, -43 removed lines patch added patch discarded remove patch
@@ -7,49 +7,49 @@
 block discarded – undo
7 7
 abstract class EE_Text_Field_Base extends EE_Model_Field_Base
8 8
 {
9 9
 
10
-    /**
11
-     * Gets the value in the format expected when being set.
12
-     * For display on the front-end, usually you would use prepare_for_pretty_echoing() instead.
13
-     * @param mixed $value_of_field_on_model_object
14
-     * @return mixed|string
15
-     */
16
-    public function prepare_for_get($value_of_field_on_model_object)
17
-    {
18
-        return $value_of_field_on_model_object;
19
-    }
10
+	/**
11
+	 * Gets the value in the format expected when being set.
12
+	 * For display on the front-end, usually you would use prepare_for_pretty_echoing() instead.
13
+	 * @param mixed $value_of_field_on_model_object
14
+	 * @return mixed|string
15
+	 */
16
+	public function prepare_for_get($value_of_field_on_model_object)
17
+	{
18
+		return $value_of_field_on_model_object;
19
+	}
20 20
 
21
-    /**
22
-     * Accepts schema of 'form_input' which formats the string for echoing in form input's value.
23
-     *
24
-     * @param string $value_on_field_to_be_outputted
25
-     * @param string $schema
26
-     * @return string
27
-     */
28
-    public function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
29
-    {
30
-        if ($schema === 'form_input') {
31
-            $value_on_field_to_be_outputted = (string) htmlentities(
32
-                $value_on_field_to_be_outputted,
33
-                ENT_QUOTES,
34
-                'UTF-8'
35
-            );
36
-        }
37
-        return parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted);
38
-    }
21
+	/**
22
+	 * Accepts schema of 'form_input' which formats the string for echoing in form input's value.
23
+	 *
24
+	 * @param string $value_on_field_to_be_outputted
25
+	 * @param string $schema
26
+	 * @return string
27
+	 */
28
+	public function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
29
+	{
30
+		if ($schema === 'form_input') {
31
+			$value_on_field_to_be_outputted = (string) htmlentities(
32
+				$value_on_field_to_be_outputted,
33
+				ENT_QUOTES,
34
+				'UTF-8'
35
+			);
36
+		}
37
+		return parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted);
38
+	}
39 39
 
40
-    /**
41
-     * Data received from the user should be exactly as they hope to save it in the DB, with the exception that
42
-     * quotes need to have slashes added to it. This method takes care of removing the slashes added by WP
43
-     * in magic-quotes fashion. We used to call html_entity_decode on the value here,
44
-     * because we called htmlentities when in EE_Text_Field_Base::prepare_for_pretty_echoing, but that's not necessary
45
-     * because web browsers always decode HTML entities in element attributes, like a form element's value attribute.
46
-     * So if we do it again here, we'll be removing HTML entities the user intended to have.)
47
-     *
48
-     * @param string $value_inputted_for_field_on_model_object
49
-     * @return string
50
-     */
51
-    public function prepare_for_set($value_inputted_for_field_on_model_object)
52
-    {
53
-        return stripslashes(parent::prepare_for_set($value_inputted_for_field_on_model_object));
54
-    }
40
+	/**
41
+	 * Data received from the user should be exactly as they hope to save it in the DB, with the exception that
42
+	 * quotes need to have slashes added to it. This method takes care of removing the slashes added by WP
43
+	 * in magic-quotes fashion. We used to call html_entity_decode on the value here,
44
+	 * because we called htmlentities when in EE_Text_Field_Base::prepare_for_pretty_echoing, but that's not necessary
45
+	 * because web browsers always decode HTML entities in element attributes, like a form element's value attribute.
46
+	 * So if we do it again here, we'll be removing HTML entities the user intended to have.)
47
+	 *
48
+	 * @param string $value_inputted_for_field_on_model_object
49
+	 * @return string
50
+	 */
51
+	public function prepare_for_set($value_inputted_for_field_on_model_object)
52
+	{
53
+		return stripslashes(parent::prepare_for_set($value_inputted_for_field_on_model_object));
54
+	}
55 55
 }
Please login to merge, or discard this patch.
core/db_models/fields/EE_WP_User_Field.php 1 patch
Indentation   +34 added lines, -34 removed lines patch added patch discarded remove patch
@@ -12,39 +12,39 @@
 block discarded – undo
12 12
  */
13 13
 class EE_WP_User_Field extends EE_Foreign_Key_Int_Field
14 14
 {
15
-    /**
16
-     * No need to provide a default or the model pointed to- the default is
17
-     * always get_current_user_id() and the model pointed to is always WP_User
18
-     *
19
-     * @param string  $table_column name fo column for field
20
-     * @param string  $nicename     should eb internationalized with __('blah','event_espresso')
21
-     * @param boolean $nullable
22
-     */
23
-    public function __construct($table_column, $nicename, $nullable)
24
-    {
25
-        parent::__construct($table_column, $nicename, $nullable, null, 'WP_User');
26
-    }
15
+	/**
16
+	 * No need to provide a default or the model pointed to- the default is
17
+	 * always get_current_user_id() and the model pointed to is always WP_User
18
+	 *
19
+	 * @param string  $table_column name fo column for field
20
+	 * @param string  $nicename     should eb internationalized with __('blah','event_espresso')
21
+	 * @param boolean $nullable
22
+	 */
23
+	public function __construct($table_column, $nicename, $nullable)
24
+	{
25
+		parent::__construct($table_column, $nicename, $nullable, null, 'WP_User');
26
+	}
27 27
 
28
-    /**
29
-     * Gets the default which is always the current user. This can't be set when initially
30
-     * constructing the model field because that's done before $current_user is set
31
-     *
32
-     * @return mixed
33
-     */
34
-    public function get_default_value()
35
-    {
36
-        if (did_action('init')) {
37
-            return get_current_user_id();
38
-        } else {
39
-            EE_Error::doing_it_wrong(
40
-                'EE_WP_User_Field::get_default_value',
41
-                __(
42
-                    'You cant get a default value for a wp_User_Field because the "init" action is called, because current_user global hasnt yet been setup. Consider doing your business logic on the "init" hook or later.',
43
-                    'event_espresso'
44
-                ),
45
-                '4.6.20'
46
-            );
47
-            return 1;
48
-        }
49
-    }
28
+	/**
29
+	 * Gets the default which is always the current user. This can't be set when initially
30
+	 * constructing the model field because that's done before $current_user is set
31
+	 *
32
+	 * @return mixed
33
+	 */
34
+	public function get_default_value()
35
+	{
36
+		if (did_action('init')) {
37
+			return get_current_user_id();
38
+		} else {
39
+			EE_Error::doing_it_wrong(
40
+				'EE_WP_User_Field::get_default_value',
41
+				__(
42
+					'You cant get a default value for a wp_User_Field because the "init" action is called, because current_user global hasnt yet been setup. Consider doing your business logic on the "init" hook or later.',
43
+					'event_espresso'
44
+				),
45
+				'4.6.20'
46
+			);
47
+			return 1;
48
+		}
49
+	}
50 50
 }
Please login to merge, or discard this patch.
core/db_models/fields/EE_Infinite_Integer_Field.php 1 patch
Indentation   +68 added lines, -68 removed lines patch added patch discarded remove patch
@@ -10,77 +10,77 @@
 block discarded – undo
10 10
 class EE_Infinite_Integer_Field extends EE_Model_Field_Base
11 11
 {
12 12
 
13
-    /**
14
-     * @param string $table_column
15
-     * @param string $nicename
16
-     * @param bool   $nullable
17
-     * @param null   $default_value
18
-     */
19
-    public function __construct($table_column, $nicename, $nullable, $default_value = null)
20
-    {
21
-        parent::__construct($table_column, $nicename, $nullable, $default_value);
22
-        $this->setSchemaType(array('integer', 'null'));
23
-    }
13
+	/**
14
+	 * @param string $table_column
15
+	 * @param string $nicename
16
+	 * @param bool   $nullable
17
+	 * @param null   $default_value
18
+	 */
19
+	public function __construct($table_column, $nicename, $nullable, $default_value = null)
20
+	{
21
+		parent::__construct($table_column, $nicename, $nullable, $default_value);
22
+		$this->setSchemaType(array('integer', 'null'));
23
+	}
24 24
 
25 25
 
26
-    public function prepare_for_use_in_db($value_of_field_on_model_object)
27
-    {
28
-        if ($value_of_field_on_model_object === EE_INF) {
29
-            return EE_INF_IN_DB;
30
-        } else {
31
-            return intval($value_of_field_on_model_object);
32
-        }
33
-    }
26
+	public function prepare_for_use_in_db($value_of_field_on_model_object)
27
+	{
28
+		if ($value_of_field_on_model_object === EE_INF) {
29
+			return EE_INF_IN_DB;
30
+		} else {
31
+			return intval($value_of_field_on_model_object);
32
+		}
33
+	}
34 34
 
35
-    public function prepare_for_set($value_inputted_for_field_on_model_object)
36
-    {
37
-        if ($value_inputted_for_field_on_model_object === EE_INF_IN_DB ||
38
-            $value_inputted_for_field_on_model_object === EE_INF ||
39
-            $value_inputted_for_field_on_model_object === "EE_INF" ||
40
-            $value_inputted_for_field_on_model_object === ""
41
-        ) {
42
-            return EE_INF;
43
-        } else {
44
-            return intval($value_inputted_for_field_on_model_object);
45
-        }
46
-    }
35
+	public function prepare_for_set($value_inputted_for_field_on_model_object)
36
+	{
37
+		if ($value_inputted_for_field_on_model_object === EE_INF_IN_DB ||
38
+			$value_inputted_for_field_on_model_object === EE_INF ||
39
+			$value_inputted_for_field_on_model_object === "EE_INF" ||
40
+			$value_inputted_for_field_on_model_object === ""
41
+		) {
42
+			return EE_INF;
43
+		} else {
44
+			return intval($value_inputted_for_field_on_model_object);
45
+		}
46
+	}
47 47
 
48
-    public function prepare_for_set_from_db($value_inputted_for_field_on_model_object)
49
-    {
50
-        $intval = intval($value_inputted_for_field_on_model_object);
51
-        if ($intval == EE_INF_IN_DB) {
52
-            return EE_INF;
53
-        } else {
54
-            return $intval;
55
-        }
56
-    }
48
+	public function prepare_for_set_from_db($value_inputted_for_field_on_model_object)
49
+	{
50
+		$intval = intval($value_inputted_for_field_on_model_object);
51
+		if ($intval == EE_INF_IN_DB) {
52
+			return EE_INF;
53
+		} else {
54
+			return $intval;
55
+		}
56
+	}
57 57
 
58
-    /**
59
-     * For outputting this field's value. If you want to output it into an input or something,
60
-     * use $schema=='input', as it will replace EE_INF with ''. If you want a readable version, use $schema=='text'
61
-     * as it will replace EE_INF with i18n Infinite
62
-     *
63
-     * @param type   $value_on_field_to_be_outputted
64
-     * @param string $schema input, symbol, text; or any string you want to show if the value equals EE_INF
65
-     * @return string
66
-     */
67
-    public function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
68
-    {
69
-        if ($value_on_field_to_be_outputted === EE_INF) {
70
-            switch ($schema) {
71
-                case 'input':
72
-                case 'form_input':
73
-                    return '';
74
-                case 'symbol':
75
-                    return "∞";
76
-                case 'text':
77
-                case null:
78
-                    return __("Unlimited", "event_espresso");
79
-                default:
80
-                    return $schema;
81
-            }
82
-        } else {
83
-            return $value_on_field_to_be_outputted;
84
-        }
85
-    }
58
+	/**
59
+	 * For outputting this field's value. If you want to output it into an input or something,
60
+	 * use $schema=='input', as it will replace EE_INF with ''. If you want a readable version, use $schema=='text'
61
+	 * as it will replace EE_INF with i18n Infinite
62
+	 *
63
+	 * @param type   $value_on_field_to_be_outputted
64
+	 * @param string $schema input, symbol, text; or any string you want to show if the value equals EE_INF
65
+	 * @return string
66
+	 */
67
+	public function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
68
+	{
69
+		if ($value_on_field_to_be_outputted === EE_INF) {
70
+			switch ($schema) {
71
+				case 'input':
72
+				case 'form_input':
73
+					return '';
74
+				case 'symbol':
75
+					return "∞";
76
+				case 'text':
77
+				case null:
78
+					return __("Unlimited", "event_espresso");
79
+				default:
80
+					return $schema;
81
+			}
82
+		} else {
83
+			return $value_on_field_to_be_outputted;
84
+		}
85
+	}
86 86
 }
Please login to merge, or discard this patch.
core/db_models/fields/EE_Slug_Field.php 1 patch
Indentation   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -2,15 +2,15 @@
 block discarded – undo
2 2
 
3 3
 class EE_Slug_Field extends EE_Text_Field_Base
4 4
 {
5
-    /**
6
-     * ensures string is usable in URLs
7
-     *
8
-     * @param string $value_inputted_for_field_on_model_object
9
-     * @return string
10
-     */
11
-    public function prepare_for_set($value_inputted_for_field_on_model_object)
12
-    {
13
-        // reminder: function prepares for use in URLs, not making human-readable.
14
-        return sanitize_title($value_inputted_for_field_on_model_object);
15
-    }
5
+	/**
6
+	 * ensures string is usable in URLs
7
+	 *
8
+	 * @param string $value_inputted_for_field_on_model_object
9
+	 * @return string
10
+	 */
11
+	public function prepare_for_set($value_inputted_for_field_on_model_object)
12
+	{
13
+		// reminder: function prepares for use in URLs, not making human-readable.
14
+		return sanitize_title($value_inputted_for_field_on_model_object);
15
+	}
16 16
 }
Please login to merge, or discard this patch.
core/db_models/fields/EE_Primary_Key_Int_Field.php 1 patch
Indentation   +20 added lines, -20 removed lines patch added patch discarded remove patch
@@ -3,27 +3,27 @@
 block discarded – undo
3 3
 class EE_Primary_Key_Int_Field extends EE_Primary_Key_Field_Base
4 4
 {
5 5
 
6
-    public function __construct($table_column, $nicename)
7
-    {
8
-        parent::__construct($table_column, $nicename, 0);
9
-        $this->setSchemaType('integer');
10
-    }
6
+	public function __construct($table_column, $nicename)
7
+	{
8
+		parent::__construct($table_column, $nicename, 0);
9
+		$this->setSchemaType('integer');
10
+	}
11 11
 
12
-    public function prepare_for_set($value_inputted_for_field_on_model_object)
13
-    {
14
-        if ($this->is_model_obj_of_type_pointed_to($value_inputted_for_field_on_model_object)) {
15
-            $value_inputted_for_field_on_model_object = $value_inputted_for_field_on_model_object->ID();
16
-        }
17
-        return absint($value_inputted_for_field_on_model_object);
18
-    }
12
+	public function prepare_for_set($value_inputted_for_field_on_model_object)
13
+	{
14
+		if ($this->is_model_obj_of_type_pointed_to($value_inputted_for_field_on_model_object)) {
15
+			$value_inputted_for_field_on_model_object = $value_inputted_for_field_on_model_object->ID();
16
+		}
17
+		return absint($value_inputted_for_field_on_model_object);
18
+	}
19 19
 
20
-    public function prepare_for_set_from_db($value_found_in_db_for_model_object)
21
-    {
22
-        return intval($value_found_in_db_for_model_object);
23
-    }
20
+	public function prepare_for_set_from_db($value_found_in_db_for_model_object)
21
+	{
22
+		return intval($value_found_in_db_for_model_object);
23
+	}
24 24
 
25
-    public function is_auto_increment()
26
-    {
27
-        return true;
28
-    }
25
+	public function is_auto_increment()
26
+	{
27
+		return true;
28
+	}
29 29
 }
Please login to merge, or discard this patch.
core/db_models/fields/EE_WP_Post_Type_Field.php.php 1 patch
Indentation   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -5,12 +5,12 @@
 block discarded – undo
5 5
  */
6 6
 class EE_WP_Post_Type_Field extends EE_DB_Only_Text_Field
7 7
 {
8
-    /**
9
-     * @param string $post_type the exact string to be used for the post type
10
-     *                          of all these post type model objects/rows
11
-     */
12
-    public function __construct($post_type)
13
-    {
14
-        parent::__construct('post_type', __("Post Type", 'event_espresso'), false, $post_type);
15
-    }
8
+	/**
9
+	 * @param string $post_type the exact string to be used for the post type
10
+	 *                          of all these post type model objects/rows
11
+	 */
12
+	public function __construct($post_type)
13
+	{
14
+		parent::__construct('post_type', __("Post Type", 'event_espresso'), false, $post_type);
15
+	}
16 16
 }
Please login to merge, or discard this patch.
core/db_models/fields/EE_Plain_Text_Field.php 1 patch
Indentation   +10 added lines, -10 removed lines patch added patch discarded remove patch
@@ -2,14 +2,14 @@
 block discarded – undo
2 2
 
3 3
 class EE_Plain_Text_Field extends EE_Text_Field_Base
4 4
 {
5
-    /**
6
-     * removes all tags when setting
7
-     *
8
-     * @param string $value_inputted_for_field_on_model_object
9
-     * @return string
10
-     */
11
-    public function prepare_for_set($value_inputted_for_field_on_model_object)
12
-    {
13
-        return wp_strip_all_tags(parent::prepare_for_set($value_inputted_for_field_on_model_object));
14
-    }
5
+	/**
6
+	 * removes all tags when setting
7
+	 *
8
+	 * @param string $value_inputted_for_field_on_model_object
9
+	 * @return string
10
+	 */
11
+	public function prepare_for_set($value_inputted_for_field_on_model_object)
12
+	{
13
+		return wp_strip_all_tags(parent::prepare_for_set($value_inputted_for_field_on_model_object));
14
+	}
15 15
 }
Please login to merge, or discard this patch.
core/db_models/fields/EE_Trashed_Flag_Field.php 1 patch
Indentation   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -2,6 +2,6 @@
 block discarded – undo
2 2
 
3 3
 class EE_Trashed_Flag_Field extends EE_Boolean_Field
4 4
 {
5
-    // note: some client code simply checks if a field IS an EE_Trashed_Flag_Field
6
-    // ...otherwise, these fields are mostly the same as boolean fields
5
+	// note: some client code simply checks if a field IS an EE_Trashed_Flag_Field
6
+	// ...otherwise, these fields are mostly the same as boolean fields
7 7
 }
Please login to merge, or discard this patch.
core/db_models/fields/EE_Integer_Field.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -6,26 +6,26 @@
 block discarded – undo
6 6
  */
7 7
 class EE_Integer_Field extends EE_Model_Field_Base
8 8
 {
9
-    /**
10
-     * @param string $table_column
11
-     * @param string $nicename
12
-     * @param bool   $nullable
13
-     * @param null   $default_value
14
-     */
15
-    public function __construct($table_column, $nicename, $nullable, $default_value = null)
16
-    {
17
-        parent::__construct($table_column, $nicename, $nullable, $default_value);
18
-        $this->setSchemaType('integer');
19
-    }
9
+	/**
10
+	 * @param string $table_column
11
+	 * @param string $nicename
12
+	 * @param bool   $nullable
13
+	 * @param null   $default_value
14
+	 */
15
+	public function __construct($table_column, $nicename, $nullable, $default_value = null)
16
+	{
17
+		parent::__construct($table_column, $nicename, $nullable, $default_value);
18
+		$this->setSchemaType('integer');
19
+	}
20 20
 
21 21
 
22
-    public function prepare_for_set($value_inputted_for_field_on_model_object)
23
-    {
24
-        return intval($value_inputted_for_field_on_model_object);
25
-    }
22
+	public function prepare_for_set($value_inputted_for_field_on_model_object)
23
+	{
24
+		return intval($value_inputted_for_field_on_model_object);
25
+	}
26 26
 
27
-    public function prepare_for_set_from_db($value_inputted_for_field_on_model_object)
28
-    {
29
-        return intval($value_inputted_for_field_on_model_object);
30
-    }
27
+	public function prepare_for_set_from_db($value_inputted_for_field_on_model_object)
28
+	{
29
+		return intval($value_inputted_for_field_on_model_object);
30
+	}
31 31
 }
Please login to merge, or discard this patch.