Completed
Branch Gutenberg/use-new-wordpress-pa... (9fa7a4)
by
unknown
63:25 queued 48:18
created
core/db_models/EEM_Term.model.php 2 patches
Indentation   +201 added lines, -201 removed lines patch added patch discarded remove patch
@@ -10,205 +10,205 @@
 block discarded – undo
10 10
 class EEM_Term extends EEM_Base
11 11
 {
12 12
 
13
-    // private instance of the Attendee object
14
-    protected static $_instance = null;
15
-
16
-
17
-
18
-    /**
19
-     *__construct
20
-     *
21
-     * @param string $timezone
22
-     */
23
-    protected function __construct($timezone = null)
24
-    {
25
-        $this->singular_item = __('Term', 'event_espresso');
26
-        $this->plural_item = __('Terms', 'event_espresso');
27
-        $this->_tables = array(
28
-            'Term' => new EE_Primary_Table('terms', 'term_id'),
29
-        );
30
-        $this->_fields = array(
31
-            'Term' => array(
32
-                'term_id'    => new EE_Primary_Key_Int_Field('term_id', __('Term ID', 'event_espresso')),
33
-                'name'       => new EE_Plain_Text_Field('name', __('Term Name', 'event_espresso'), false, ''),
34
-                'slug'       => new EE_Slug_Field('slug', __('Term Slug', 'event_espresso'), false),
35
-                'term_group' => new EE_Integer_Field('term_group', __("Term Group", "event_espresso"), false, 0),
36
-            ),
37
-        );
38
-        $this->_model_relations = array(
39
-            'Term_Taxonomy' => new EE_Has_Many_Relation(),
40
-        );
41
-        $this->_wp_core_model = true;
42
-        $path_to_tax_model = 'Term_Taxonomy';
43
-        $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
44
-        $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Taxonomy_Protected(
45
-            $path_to_tax_model
46
-        );
47
-        $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = false;
48
-        $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = false;
49
-        $path_to_tax_model = $path_to_tax_model . '.';
50
-        // add cap restrictions for editing relating to the "ee_edit_*"
51
-        $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_category'] = new EE_Default_Where_Conditions(
52
-            array(
53
-                $path_to_tax_model . 'taxonomy*ee_edit_event_category' => array('!=', 'espresso_event_categories'),
54
-            )
55
-        );
56
-        $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_venue_category'] = new EE_Default_Where_Conditions(
57
-            array(
58
-                $path_to_tax_model . 'taxonomy*ee_edit_venue_category' => array('!=', 'espresso_venue_categories'),
59
-            )
60
-        );
61
-        $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_type'] = new EE_Default_Where_Conditions(
62
-            array(
63
-                $path_to_tax_model . 'taxonomy*ee_edit_event_type' => array('!=', 'espresso_event_type'),
64
-            )
65
-        );
66
-        // add cap restrictions for deleting relating to the "ee_deleting_*"
67
-        $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_category'] = new EE_Default_Where_Conditions(
68
-            array(
69
-                $path_to_tax_model . 'taxonomy*ee_delete_event_category' => array('!=', 'espresso_event_categories'),
70
-            )
71
-        );
72
-        $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_venue_category'] = new EE_Default_Where_Conditions(
73
-            array(
74
-                $path_to_tax_model . 'taxonomy*ee_delete_venue_category' => array('!=', 'espresso_venue_categories'),
75
-            )
76
-        );
77
-        $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_type'] = new EE_Default_Where_Conditions(
78
-            array(
79
-                $path_to_tax_model . 'taxonomy*ee_delete_event_type' => array('!=', 'espresso_event_type'),
80
-            )
81
-        );
82
-        parent::__construct($timezone);
83
-        add_filter('FHEE__Read__create_model_query_params', array('EEM_Term', 'rest_api_query_params'), 10, 3);
84
-    }
85
-
86
-
87
-
88
-    /**
89
-     * retrieves a list of all EE event categories
90
-     *
91
-     * @access public
92
-     * @param bool $show_uncategorized
93
-     * @return \EE_Base_Class[]
94
-     */
95
-    public function get_all_ee_categories($show_uncategorized = false)
96
-    {
97
-        $where_params = array(
98
-            'Term_Taxonomy.taxonomy' => 'espresso_event_categories',
99
-            'NOT'                    => array('name' => __('Uncategorized', 'event_espresso')),
100
-        );
101
-        if ($show_uncategorized) {
102
-            unset($where_params['NOT']);
103
-        }
104
-        return EEM_Term::instance()->get_all(
105
-            array(
106
-                $where_params,
107
-                'order_by' => array('name' => 'ASC'),
108
-            )
109
-        );
110
-    }
111
-
112
-
113
-
114
-    /**
115
-     * retrieves a list of all post_tags associated with an EE CPT
116
-     *
117
-     * @access public
118
-     * @param string $post_type
119
-     * @return array
120
-     */
121
-    public function get_all_CPT_post_tags($post_type = '')
122
-    {
123
-        switch ($post_type) {
124
-            case 'espresso_events':
125
-                return $this->get_all_event_post_tags();
126
-                break;
127
-            case 'espresso_venues':
128
-                return $this->get_all_venue_post_tags();
129
-                break;
130
-            default:
131
-                $event_tags = $this->get_all_event_post_tags();
132
-                $venue_tags = $this->get_all_venue_post_tags();
133
-                return array_merge($event_tags, $venue_tags);
134
-        }
135
-    }
136
-
137
-
138
-
139
-    /**
140
-     * get_all_event_post_tags
141
-     *
142
-     * @return EE_Base_Class[]
143
-     */
144
-    public function get_all_event_post_tags()
145
-    {
146
-        $post_tags = EEM_Term::instance()->get_all(
147
-            array(
148
-                array(
149
-                    'Term_Taxonomy.taxonomy'        => 'post_tag',
150
-                    'Term_Taxonomy.Event.post_type' => 'espresso_events',
151
-                ),
152
-                'order_by'   => array('name' => 'ASC'),
153
-                'force_join' => array('Term_Taxonomy.Event'),
154
-            )
155
-        );
156
-        foreach ($post_tags as $key => $post_tag) {
157
-            if (! isset($post_tags[ $key ]->post_type)) {
158
-                $post_tags[ $key ]->post_type = array();
159
-            }
160
-            $post_tags[ $key ]->post_type[] = 'espresso_events';
161
-        }
162
-        return $post_tags;
163
-    }
164
-
165
-
166
-
167
-    /**
168
-     * get_all_venue_post_tags
169
-     *
170
-     * @return EE_Base_Class[]
171
-     */
172
-    public function get_all_venue_post_tags()
173
-    {
174
-        $post_tags = EEM_Term::instance()->get_all(
175
-            array(
176
-                array(
177
-                    'Term_Taxonomy.taxonomy'        => 'post_tag',
178
-                    'Term_Taxonomy.Venue.post_type' => 'espresso_venues',
179
-                ),
180
-                'order_by'   => array('name' => 'ASC'),
181
-                'force_join' => array('Term_Taxonomy'),
182
-            )
183
-        );
184
-        foreach ($post_tags as $key => $post_tag) {
185
-            if (! isset($post_tags[ $key ]->post_type)) {
186
-                $post_tags[ $key ]->post_type = array();
187
-            }
188
-            $post_tags[ $key ]->post_type[] = 'espresso_venues';
189
-        }
190
-        return $post_tags;
191
-    }
192
-
193
-
194
-
195
-    /**
196
-     * Makes sure that during REST API queries, we only return terms
197
-     * for term taxonomies which should be shown in the rest api
198
-     *
199
-     * @param array    $model_query_params
200
-     * @param array    $querystring_query_params
201
-     * @param EEM_Base $model
202
-     * @return array
203
-     */
204
-    public static function rest_api_query_params($model_query_params, $querystring_query_params, $model)
205
-    {
206
-        if ($model === EEM_Term::instance()) {
207
-            $taxonomies = get_taxonomies(array('show_in_rest' => true));
208
-            if (! empty($taxonomies)) {
209
-                $model_query_params[0]['Term_Taxonomy.taxonomy'] = array('IN', $taxonomies);
210
-            }
211
-        }
212
-        return $model_query_params;
213
-    }
13
+	// private instance of the Attendee object
14
+	protected static $_instance = null;
15
+
16
+
17
+
18
+	/**
19
+	 *__construct
20
+	 *
21
+	 * @param string $timezone
22
+	 */
23
+	protected function __construct($timezone = null)
24
+	{
25
+		$this->singular_item = __('Term', 'event_espresso');
26
+		$this->plural_item = __('Terms', 'event_espresso');
27
+		$this->_tables = array(
28
+			'Term' => new EE_Primary_Table('terms', 'term_id'),
29
+		);
30
+		$this->_fields = array(
31
+			'Term' => array(
32
+				'term_id'    => new EE_Primary_Key_Int_Field('term_id', __('Term ID', 'event_espresso')),
33
+				'name'       => new EE_Plain_Text_Field('name', __('Term Name', 'event_espresso'), false, ''),
34
+				'slug'       => new EE_Slug_Field('slug', __('Term Slug', 'event_espresso'), false),
35
+				'term_group' => new EE_Integer_Field('term_group', __("Term Group", "event_espresso"), false, 0),
36
+			),
37
+		);
38
+		$this->_model_relations = array(
39
+			'Term_Taxonomy' => new EE_Has_Many_Relation(),
40
+		);
41
+		$this->_wp_core_model = true;
42
+		$path_to_tax_model = 'Term_Taxonomy';
43
+		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
44
+		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Taxonomy_Protected(
45
+			$path_to_tax_model
46
+		);
47
+		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = false;
48
+		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = false;
49
+		$path_to_tax_model = $path_to_tax_model . '.';
50
+		// add cap restrictions for editing relating to the "ee_edit_*"
51
+		$this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_category'] = new EE_Default_Where_Conditions(
52
+			array(
53
+				$path_to_tax_model . 'taxonomy*ee_edit_event_category' => array('!=', 'espresso_event_categories'),
54
+			)
55
+		);
56
+		$this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_venue_category'] = new EE_Default_Where_Conditions(
57
+			array(
58
+				$path_to_tax_model . 'taxonomy*ee_edit_venue_category' => array('!=', 'espresso_venue_categories'),
59
+			)
60
+		);
61
+		$this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_type'] = new EE_Default_Where_Conditions(
62
+			array(
63
+				$path_to_tax_model . 'taxonomy*ee_edit_event_type' => array('!=', 'espresso_event_type'),
64
+			)
65
+		);
66
+		// add cap restrictions for deleting relating to the "ee_deleting_*"
67
+		$this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_category'] = new EE_Default_Where_Conditions(
68
+			array(
69
+				$path_to_tax_model . 'taxonomy*ee_delete_event_category' => array('!=', 'espresso_event_categories'),
70
+			)
71
+		);
72
+		$this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_venue_category'] = new EE_Default_Where_Conditions(
73
+			array(
74
+				$path_to_tax_model . 'taxonomy*ee_delete_venue_category' => array('!=', 'espresso_venue_categories'),
75
+			)
76
+		);
77
+		$this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_type'] = new EE_Default_Where_Conditions(
78
+			array(
79
+				$path_to_tax_model . 'taxonomy*ee_delete_event_type' => array('!=', 'espresso_event_type'),
80
+			)
81
+		);
82
+		parent::__construct($timezone);
83
+		add_filter('FHEE__Read__create_model_query_params', array('EEM_Term', 'rest_api_query_params'), 10, 3);
84
+	}
85
+
86
+
87
+
88
+	/**
89
+	 * retrieves a list of all EE event categories
90
+	 *
91
+	 * @access public
92
+	 * @param bool $show_uncategorized
93
+	 * @return \EE_Base_Class[]
94
+	 */
95
+	public function get_all_ee_categories($show_uncategorized = false)
96
+	{
97
+		$where_params = array(
98
+			'Term_Taxonomy.taxonomy' => 'espresso_event_categories',
99
+			'NOT'                    => array('name' => __('Uncategorized', 'event_espresso')),
100
+		);
101
+		if ($show_uncategorized) {
102
+			unset($where_params['NOT']);
103
+		}
104
+		return EEM_Term::instance()->get_all(
105
+			array(
106
+				$where_params,
107
+				'order_by' => array('name' => 'ASC'),
108
+			)
109
+		);
110
+	}
111
+
112
+
113
+
114
+	/**
115
+	 * retrieves a list of all post_tags associated with an EE CPT
116
+	 *
117
+	 * @access public
118
+	 * @param string $post_type
119
+	 * @return array
120
+	 */
121
+	public function get_all_CPT_post_tags($post_type = '')
122
+	{
123
+		switch ($post_type) {
124
+			case 'espresso_events':
125
+				return $this->get_all_event_post_tags();
126
+				break;
127
+			case 'espresso_venues':
128
+				return $this->get_all_venue_post_tags();
129
+				break;
130
+			default:
131
+				$event_tags = $this->get_all_event_post_tags();
132
+				$venue_tags = $this->get_all_venue_post_tags();
133
+				return array_merge($event_tags, $venue_tags);
134
+		}
135
+	}
136
+
137
+
138
+
139
+	/**
140
+	 * get_all_event_post_tags
141
+	 *
142
+	 * @return EE_Base_Class[]
143
+	 */
144
+	public function get_all_event_post_tags()
145
+	{
146
+		$post_tags = EEM_Term::instance()->get_all(
147
+			array(
148
+				array(
149
+					'Term_Taxonomy.taxonomy'        => 'post_tag',
150
+					'Term_Taxonomy.Event.post_type' => 'espresso_events',
151
+				),
152
+				'order_by'   => array('name' => 'ASC'),
153
+				'force_join' => array('Term_Taxonomy.Event'),
154
+			)
155
+		);
156
+		foreach ($post_tags as $key => $post_tag) {
157
+			if (! isset($post_tags[ $key ]->post_type)) {
158
+				$post_tags[ $key ]->post_type = array();
159
+			}
160
+			$post_tags[ $key ]->post_type[] = 'espresso_events';
161
+		}
162
+		return $post_tags;
163
+	}
164
+
165
+
166
+
167
+	/**
168
+	 * get_all_venue_post_tags
169
+	 *
170
+	 * @return EE_Base_Class[]
171
+	 */
172
+	public function get_all_venue_post_tags()
173
+	{
174
+		$post_tags = EEM_Term::instance()->get_all(
175
+			array(
176
+				array(
177
+					'Term_Taxonomy.taxonomy'        => 'post_tag',
178
+					'Term_Taxonomy.Venue.post_type' => 'espresso_venues',
179
+				),
180
+				'order_by'   => array('name' => 'ASC'),
181
+				'force_join' => array('Term_Taxonomy'),
182
+			)
183
+		);
184
+		foreach ($post_tags as $key => $post_tag) {
185
+			if (! isset($post_tags[ $key ]->post_type)) {
186
+				$post_tags[ $key ]->post_type = array();
187
+			}
188
+			$post_tags[ $key ]->post_type[] = 'espresso_venues';
189
+		}
190
+		return $post_tags;
191
+	}
192
+
193
+
194
+
195
+	/**
196
+	 * Makes sure that during REST API queries, we only return terms
197
+	 * for term taxonomies which should be shown in the rest api
198
+	 *
199
+	 * @param array    $model_query_params
200
+	 * @param array    $querystring_query_params
201
+	 * @param EEM_Base $model
202
+	 * @return array
203
+	 */
204
+	public static function rest_api_query_params($model_query_params, $querystring_query_params, $model)
205
+	{
206
+		if ($model === EEM_Term::instance()) {
207
+			$taxonomies = get_taxonomies(array('show_in_rest' => true));
208
+			if (! empty($taxonomies)) {
209
+				$model_query_params[0]['Term_Taxonomy.taxonomy'] = array('IN', $taxonomies);
210
+			}
211
+		}
212
+		return $model_query_params;
213
+	}
214 214
 }
Please login to merge, or discard this patch.
Spacing   +24 added lines, -24 removed lines patch added patch discarded remove patch
@@ -40,43 +40,43 @@  discard block
 block discarded – undo
40 40
         );
41 41
         $this->_wp_core_model = true;
42 42
         $path_to_tax_model = 'Term_Taxonomy';
43
-        $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
44
-        $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Taxonomy_Protected(
43
+        $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
44
+        $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Taxonomy_Protected(
45 45
             $path_to_tax_model
46 46
         );
47
-        $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = false;
48
-        $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = false;
49
-        $path_to_tax_model = $path_to_tax_model . '.';
47
+        $this->_cap_restriction_generators[EEM_Base::caps_edit] = false;
48
+        $this->_cap_restriction_generators[EEM_Base::caps_delete] = false;
49
+        $path_to_tax_model = $path_to_tax_model.'.';
50 50
         // add cap restrictions for editing relating to the "ee_edit_*"
51
-        $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_category'] = new EE_Default_Where_Conditions(
51
+        $this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_event_category'] = new EE_Default_Where_Conditions(
52 52
             array(
53
-                $path_to_tax_model . 'taxonomy*ee_edit_event_category' => array('!=', 'espresso_event_categories'),
53
+                $path_to_tax_model.'taxonomy*ee_edit_event_category' => array('!=', 'espresso_event_categories'),
54 54
             )
55 55
         );
56
-        $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_venue_category'] = new EE_Default_Where_Conditions(
56
+        $this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_venue_category'] = new EE_Default_Where_Conditions(
57 57
             array(
58
-                $path_to_tax_model . 'taxonomy*ee_edit_venue_category' => array('!=', 'espresso_venue_categories'),
58
+                $path_to_tax_model.'taxonomy*ee_edit_venue_category' => array('!=', 'espresso_venue_categories'),
59 59
             )
60 60
         );
61
-        $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_type'] = new EE_Default_Where_Conditions(
61
+        $this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_event_type'] = new EE_Default_Where_Conditions(
62 62
             array(
63
-                $path_to_tax_model . 'taxonomy*ee_edit_event_type' => array('!=', 'espresso_event_type'),
63
+                $path_to_tax_model.'taxonomy*ee_edit_event_type' => array('!=', 'espresso_event_type'),
64 64
             )
65 65
         );
66 66
         // add cap restrictions for deleting relating to the "ee_deleting_*"
67
-        $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_category'] = new EE_Default_Where_Conditions(
67
+        $this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_event_category'] = new EE_Default_Where_Conditions(
68 68
             array(
69
-                $path_to_tax_model . 'taxonomy*ee_delete_event_category' => array('!=', 'espresso_event_categories'),
69
+                $path_to_tax_model.'taxonomy*ee_delete_event_category' => array('!=', 'espresso_event_categories'),
70 70
             )
71 71
         );
72
-        $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_venue_category'] = new EE_Default_Where_Conditions(
72
+        $this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_venue_category'] = new EE_Default_Where_Conditions(
73 73
             array(
74
-                $path_to_tax_model . 'taxonomy*ee_delete_venue_category' => array('!=', 'espresso_venue_categories'),
74
+                $path_to_tax_model.'taxonomy*ee_delete_venue_category' => array('!=', 'espresso_venue_categories'),
75 75
             )
76 76
         );
77
-        $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_type'] = new EE_Default_Where_Conditions(
77
+        $this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_event_type'] = new EE_Default_Where_Conditions(
78 78
             array(
79
-                $path_to_tax_model . 'taxonomy*ee_delete_event_type' => array('!=', 'espresso_event_type'),
79
+                $path_to_tax_model.'taxonomy*ee_delete_event_type' => array('!=', 'espresso_event_type'),
80 80
             )
81 81
         );
82 82
         parent::__construct($timezone);
@@ -154,10 +154,10 @@  discard block
 block discarded – undo
154 154
             )
155 155
         );
156 156
         foreach ($post_tags as $key => $post_tag) {
157
-            if (! isset($post_tags[ $key ]->post_type)) {
158
-                $post_tags[ $key ]->post_type = array();
157
+            if ( ! isset($post_tags[$key]->post_type)) {
158
+                $post_tags[$key]->post_type = array();
159 159
             }
160
-            $post_tags[ $key ]->post_type[] = 'espresso_events';
160
+            $post_tags[$key]->post_type[] = 'espresso_events';
161 161
         }
162 162
         return $post_tags;
163 163
     }
@@ -182,10 +182,10 @@  discard block
 block discarded – undo
182 182
             )
183 183
         );
184 184
         foreach ($post_tags as $key => $post_tag) {
185
-            if (! isset($post_tags[ $key ]->post_type)) {
186
-                $post_tags[ $key ]->post_type = array();
185
+            if ( ! isset($post_tags[$key]->post_type)) {
186
+                $post_tags[$key]->post_type = array();
187 187
             }
188
-            $post_tags[ $key ]->post_type[] = 'espresso_venues';
188
+            $post_tags[$key]->post_type[] = 'espresso_venues';
189 189
         }
190 190
         return $post_tags;
191 191
     }
@@ -205,7 +205,7 @@  discard block
 block discarded – undo
205 205
     {
206 206
         if ($model === EEM_Term::instance()) {
207 207
             $taxonomies = get_taxonomies(array('show_in_rest' => true));
208
-            if (! empty($taxonomies)) {
208
+            if ( ! empty($taxonomies)) {
209 209
                 $model_query_params[0]['Term_Taxonomy.taxonomy'] = array('IN', $taxonomies);
210 210
             }
211 211
         }
Please login to merge, or discard this patch.
core/db_models/fields/EE_Float_Field.php 1 patch
Indentation   +62 added lines, -62 removed lines patch added patch discarded remove patch
@@ -7,77 +7,77 @@
 block discarded – undo
7 7
 class EE_Float_Field extends EE_Model_Field_Base
8 8
 {
9 9
 
10
-    /**
11
-     * @param string $table_column
12
-     * @param string $nicename
13
-     * @param bool   $nullable
14
-     * @param null   $default_value
15
-     */
16
-    public function __construct($table_column, $nicename, $nullable, $default_value = null)
17
-    {
18
-        parent::__construct($table_column, $nicename, $nullable, $default_value);
19
-        $this->setSchemaType('number');
20
-    }
10
+	/**
11
+	 * @param string $table_column
12
+	 * @param string $nicename
13
+	 * @param bool   $nullable
14
+	 * @param null   $default_value
15
+	 */
16
+	public function __construct($table_column, $nicename, $nullable, $default_value = null)
17
+	{
18
+		parent::__construct($table_column, $nicename, $nullable, $default_value);
19
+		$this->setSchemaType('number');
20
+	}
21 21
 
22 22
 
23
-    /**
24
-     * If provided a string, strips out number-related formatting, like commas, periods, spaces, other junk, etc.
25
-     * However, treats commas and periods as thousand-separators ro decimal marks, as indicate by the config's currency.
26
-     * So if you want to pass in a string that NEEDS to interpret periods as decimal marks, call floatval() on it first.
27
-     * Returns a float
28
-     *
29
-     * @param type $value_inputted_for_field_on_model_object
30
-     * @return float
31
-     */
32
-    public function prepare_for_set($value_inputted_for_field_on_model_object)
33
-    {
23
+	/**
24
+	 * If provided a string, strips out number-related formatting, like commas, periods, spaces, other junk, etc.
25
+	 * However, treats commas and periods as thousand-separators ro decimal marks, as indicate by the config's currency.
26
+	 * So if you want to pass in a string that NEEDS to interpret periods as decimal marks, call floatval() on it first.
27
+	 * Returns a float
28
+	 *
29
+	 * @param type $value_inputted_for_field_on_model_object
30
+	 * @return float
31
+	 */
32
+	public function prepare_for_set($value_inputted_for_field_on_model_object)
33
+	{
34 34
 //      echo __LINE__."$value_inputted_for_field_on_model_object<br>";
35
-        // remove whitespaces and thousands separators
36
-        if (is_string($value_inputted_for_field_on_model_object)) {
37
-            $value_inputted_for_field_on_model_object = str_replace(
38
-                array(" ", EE_Config::instance()->currency->thsnds),
39
-                "",
40
-                $value_inputted_for_field_on_model_object
41
-            );
35
+		// remove whitespaces and thousands separators
36
+		if (is_string($value_inputted_for_field_on_model_object)) {
37
+			$value_inputted_for_field_on_model_object = str_replace(
38
+				array(" ", EE_Config::instance()->currency->thsnds),
39
+				"",
40
+				$value_inputted_for_field_on_model_object
41
+			);
42 42
 // echo __LINE__."$value_inputted_for_field_on_model_object<br>";
43 43
 // normalize it so periods are decimal marks (we don't care where you're from: we're talking PHP now)
44
-            $value_inputted_for_field_on_model_object = str_replace(
45
-                EE_Config::instance()->currency->dec_mrk,
46
-                ".",
47
-                $value_inputted_for_field_on_model_object
48
-            );
44
+			$value_inputted_for_field_on_model_object = str_replace(
45
+				EE_Config::instance()->currency->dec_mrk,
46
+				".",
47
+				$value_inputted_for_field_on_model_object
48
+			);
49 49
 // echo __LINE__."$value_inputted_for_field_on_model_object<br>";
50 50
 // double-check there's absolutely nothing left on this string besides numbers
51
-            $value_inputted_for_field_on_model_object = preg_replace(
52
-                "/[^0-9,.]/",
53
-                "",
54
-                $value_inputted_for_field_on_model_object
55
-            );
56
-        }
51
+			$value_inputted_for_field_on_model_object = preg_replace(
52
+				"/[^0-9,.]/",
53
+				"",
54
+				$value_inputted_for_field_on_model_object
55
+			);
56
+		}
57 57
 //      echo __LINE__."$value_inputted_for_field_on_model_object<br>";
58
-        return floatval($value_inputted_for_field_on_model_object);
59
-    }
58
+		return floatval($value_inputted_for_field_on_model_object);
59
+	}
60 60
 
61
-    /**
62
-     * Returns the number formatted according to local custom (set by the country of the blog).
63
-     *
64
-     * @param float $value_on_field_to_be_outputted
65
-     * @return string
66
-     */
67
-    public function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
68
-    {
69
-        $EE = EE_Registry::instance();
70
-        return number_format(
71
-            $value_on_field_to_be_outputted,
72
-            $EE->CFG->currency->dec_plc,
73
-            $EE->CFG->currency->dec_mrk,
74
-            $EE->CFG->currency->thsnds
75
-        );
76
-    }
61
+	/**
62
+	 * Returns the number formatted according to local custom (set by the country of the blog).
63
+	 *
64
+	 * @param float $value_on_field_to_be_outputted
65
+	 * @return string
66
+	 */
67
+	public function prepare_for_pretty_echoing($value_on_field_to_be_outputted, $schema = null)
68
+	{
69
+		$EE = EE_Registry::instance();
70
+		return number_format(
71
+			$value_on_field_to_be_outputted,
72
+			$EE->CFG->currency->dec_plc,
73
+			$EE->CFG->currency->dec_mrk,
74
+			$EE->CFG->currency->thsnds
75
+		);
76
+	}
77 77
 
78
-    public function prepare_for_set_from_db($value_found_in_db_for_model_object)
79
-    {
78
+	public function prepare_for_set_from_db($value_found_in_db_for_model_object)
79
+	{
80 80
 //      echo "prepare for set from db of ";d($value_found_in_db_for_model_object);
81
-        return floatval($value_found_in_db_for_model_object);
82
-    }
81
+		return floatval($value_found_in_db_for_model_object);
82
+	}
83 83
 }
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
-    public 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
+	public 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
 }
Please login to merge, or discard this patch.
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 "&infin;";
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 "&infin;";
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.