@@ -2,15 +2,15 @@ |
||
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 | } |
@@ -3,27 +3,27 @@ |
||
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 | } |
@@ -5,12 +5,12 @@ |
||
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 | } |
@@ -2,14 +2,14 @@ |
||
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 | } |
@@ -2,6 +2,6 @@ |
||
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 | } |
@@ -6,26 +6,26 @@ |
||
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 | } |
@@ -2,24 +2,24 @@ |
||
2 | 2 | |
3 | 3 | abstract class EE_Primary_Key_Field_Base extends EE_Field_With_Model_Name |
4 | 4 | { |
5 | - /** |
|
6 | - * Overrides parent so it doesn't need to provide so many non-applicable fields |
|
7 | - * |
|
8 | - * @param string $table_column |
|
9 | - * @param string $nicename |
|
10 | - */ |
|
11 | - public function __construct($table_column, $nicename, $default) |
|
12 | - { |
|
13 | - parent::__construct($table_column, $nicename, false, $default, null); |
|
14 | - } |
|
5 | + /** |
|
6 | + * Overrides parent so it doesn't need to provide so many non-applicable fields |
|
7 | + * |
|
8 | + * @param string $table_column |
|
9 | + * @param string $nicename |
|
10 | + */ |
|
11 | + public function __construct($table_column, $nicename, $default) |
|
12 | + { |
|
13 | + parent::__construct($table_column, $nicename, false, $default, null); |
|
14 | + } |
|
15 | 15 | |
16 | - /** |
|
17 | - * @param $table_alias |
|
18 | - * @param $name |
|
19 | - */ |
|
20 | - public function _construct_finalize($table_alias, $name, $model_name) |
|
21 | - { |
|
22 | - $this->_model_name_pointed_to = $model_name; |
|
23 | - parent::_construct_finalize($table_alias, $name, $model_name); |
|
24 | - } |
|
16 | + /** |
|
17 | + * @param $table_alias |
|
18 | + * @param $name |
|
19 | + */ |
|
20 | + public function _construct_finalize($table_alias, $name, $model_name) |
|
21 | + { |
|
22 | + $this->_model_name_pointed_to = $model_name; |
|
23 | + parent::_construct_finalize($table_alias, $name, $model_name); |
|
24 | + } |
|
25 | 25 | } |
@@ -14,57 +14,57 @@ |
||
14 | 14 | class EE_Full_HTML_Field extends EE_Text_Field_Base |
15 | 15 | { |
16 | 16 | |
17 | - /** |
|
18 | - * @param string $table_column |
|
19 | - * @param string $nicename |
|
20 | - * @param bool $nullable |
|
21 | - * @param null $default_value |
|
22 | - */ |
|
23 | - public function __construct($table_column, $nicename, $nullable, $default_value = null) |
|
24 | - { |
|
25 | - parent::__construct($table_column, $nicename, $nullable, $default_value); |
|
26 | - $this->setSchemaType('object'); |
|
27 | - } |
|
17 | + /** |
|
18 | + * @param string $table_column |
|
19 | + * @param string $nicename |
|
20 | + * @param bool $nullable |
|
21 | + * @param null $default_value |
|
22 | + */ |
|
23 | + public function __construct($table_column, $nicename, $nullable, $default_value = null) |
|
24 | + { |
|
25 | + parent::__construct($table_column, $nicename, $nullable, $default_value); |
|
26 | + $this->setSchemaType('object'); |
|
27 | + } |
|
28 | 28 | |
29 | 29 | |
30 | - /** |
|
31 | - * Does shortcodes and auto-paragraphs the content (unless schema is 'no_wpautop') |
|
32 | - * |
|
33 | - * @param type $value_on_field_to_be_outputted |
|
34 | - * @param type $schema |
|
35 | - * @return string |
|
36 | - */ |
|
37 | - public function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null) |
|
38 | - { |
|
39 | - if ($schema == 'form_input') { |
|
40 | - return parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema); |
|
41 | - } elseif ($schema == 'no_wpautop') { |
|
42 | - return do_shortcode(parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema)); |
|
43 | - } else { |
|
44 | - return wpautop(do_shortcode(parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema))); |
|
45 | - } |
|
46 | - } |
|
30 | + /** |
|
31 | + * Does shortcodes and auto-paragraphs the content (unless schema is 'no_wpautop') |
|
32 | + * |
|
33 | + * @param type $value_on_field_to_be_outputted |
|
34 | + * @param type $schema |
|
35 | + * @return string |
|
36 | + */ |
|
37 | + public function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null) |
|
38 | + { |
|
39 | + if ($schema == 'form_input') { |
|
40 | + return parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema); |
|
41 | + } elseif ($schema == 'no_wpautop') { |
|
42 | + return do_shortcode(parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema)); |
|
43 | + } else { |
|
44 | + return wpautop(do_shortcode(parent::prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema))); |
|
45 | + } |
|
46 | + } |
|
47 | 47 | |
48 | 48 | |
49 | 49 | |
50 | - public function getSchemaProperties() |
|
51 | - { |
|
52 | - return array( |
|
53 | - 'raw' => array( |
|
54 | - 'description' => sprintf( |
|
55 | - __('%s - the value in the database.', 'event_espresso'), |
|
56 | - $this->get_nicename() |
|
57 | - ), |
|
58 | - 'type' => 'string' |
|
59 | - ), |
|
60 | - 'rendered' => array( |
|
61 | - 'description' => sprintf( |
|
62 | - __('%s - transformed for display.', 'event_espresso'), |
|
63 | - $this->get_nicename() |
|
64 | - ), |
|
65 | - 'type' => 'string', |
|
66 | - 'readonly' => true |
|
67 | - ) |
|
68 | - ); |
|
69 | - } |
|
50 | + public function getSchemaProperties() |
|
51 | + { |
|
52 | + return array( |
|
53 | + 'raw' => array( |
|
54 | + 'description' => sprintf( |
|
55 | + __('%s - the value in the database.', 'event_espresso'), |
|
56 | + $this->get_nicename() |
|
57 | + ), |
|
58 | + 'type' => 'string' |
|
59 | + ), |
|
60 | + 'rendered' => array( |
|
61 | + 'description' => sprintf( |
|
62 | + __('%s - transformed for display.', 'event_espresso'), |
|
63 | + $this->get_nicename() |
|
64 | + ), |
|
65 | + 'type' => 'string', |
|
66 | + 'readonly' => true |
|
67 | + ) |
|
68 | + ); |
|
69 | + } |
|
70 | 70 | } |
@@ -2,15 +2,15 @@ |
||
2 | 2 | |
3 | 3 | class EE_DB_Only_Int_Field extends EE_DB_Only_Field_Base |
4 | 4 | { |
5 | - /** |
|
6 | - * @param string $table_column |
|
7 | - * @param string $nicename |
|
8 | - * @param bool $nullable |
|
9 | - * @param null $default_value |
|
10 | - */ |
|
11 | - public function __construct($table_column, $nicename, $nullable, $default_value = null) |
|
12 | - { |
|
13 | - parent::__construct($table_column, $nicename, $nullable, $default_value); |
|
14 | - $this->setSchemaType('integer'); |
|
15 | - } |
|
5 | + /** |
|
6 | + * @param string $table_column |
|
7 | + * @param string $nicename |
|
8 | + * @param bool $nullable |
|
9 | + * @param null $default_value |
|
10 | + */ |
|
11 | + public function __construct($table_column, $nicename, $nullable, $default_value = null) |
|
12 | + { |
|
13 | + parent::__construct($table_column, $nicename, $nullable, $default_value); |
|
14 | + $this->setSchemaType('integer'); |
|
15 | + } |
|
16 | 16 | } |