Completed
Branch new-admin-design (7f58b2)
by
unknown
02:54
created
core/EE_Base_Class_Repository.core.php 1 patch
Indentation   +94 added lines, -94 removed lines patch added patch discarded remove patch
@@ -16,108 +16,108 @@
 block discarded – undo
16 16
 abstract class EE_Base_Class_Repository extends EE_Object_Repository implements EEI_Deletable
17 17
 {
18 18
 
19
-    /**
20
-     * EE_Base_Class_Repository constructor.
21
-     */
22
-    public function __construct()
23
-    {
24
-        $this->persist_method = 'save';
25
-    }
19
+	/**
20
+	 * EE_Base_Class_Repository constructor.
21
+	 */
22
+	public function __construct()
23
+	{
24
+		$this->persist_method = 'save';
25
+	}
26 26
 
27 27
 
28
-    /**
29
-     * save
30
-     *
31
-     * calls EE_Base_Class::save() on the current object
32
-     * an array of arguments can also be supplied that will be passed along to EE_Base_Class::save(),
33
-     * where each element of the $arguments array corresponds to a parameter for the callback method
34
-     * PLZ NOTE: if the first argument of the callback requires an array, for example array( 'key' => 'value' )
35
-     * then $arguments needs to be a DOUBLE array ie: array( array( 'key' => 'value' ) )
36
-     *
37
-     * @access public
38
-     * @param array $arguments arrays of arguments that will be passed to the object's save method
39
-     * @return bool | int
40
-     */
41
-    public function save($arguments = array())
42
-    {
43
-        return $this->persist('save', $arguments);
44
-    }
28
+	/**
29
+	 * save
30
+	 *
31
+	 * calls EE_Base_Class::save() on the current object
32
+	 * an array of arguments can also be supplied that will be passed along to EE_Base_Class::save(),
33
+	 * where each element of the $arguments array corresponds to a parameter for the callback method
34
+	 * PLZ NOTE: if the first argument of the callback requires an array, for example array( 'key' => 'value' )
35
+	 * then $arguments needs to be a DOUBLE array ie: array( array( 'key' => 'value' ) )
36
+	 *
37
+	 * @access public
38
+	 * @param array $arguments arrays of arguments that will be passed to the object's save method
39
+	 * @return bool | int
40
+	 */
41
+	public function save($arguments = array())
42
+	{
43
+		return $this->persist('save', $arguments);
44
+	}
45 45
 
46 46
 
47
-    /**
48
-     * save_all
49
-     *
50
-     * calls EE_Base_Class::save() on ALL objects in the repository
51
-     *
52
-     * @access public
53
-     * @return bool | int
54
-     */
55
-    public function save_all()
56
-    {
57
-        return $this->persist_all('save');
58
-    }
47
+	/**
48
+	 * save_all
49
+	 *
50
+	 * calls EE_Base_Class::save() on ALL objects in the repository
51
+	 *
52
+	 * @access public
53
+	 * @return bool | int
54
+	 */
55
+	public function save_all()
56
+	{
57
+		return $this->persist_all('save');
58
+	}
59 59
 
60 60
 
61
-    /**
62
-     * Calls EE_Base_Class::delete() on the current object
63
-     * Keep in mind that this always detaches the object from the collection
64
-     * regardless of whether the delete was successful for the db.  This is because
65
-     * its possible that the object ONLY existed in the collection.
66
-     *
67
-     * @access public
68
-     * @return bool
69
-     */
70
-    public function delete()
71
-    {
72
-        $success = $this->_call_user_func_array_on_current('delete');
73
-        $this->remove($this->current());
74
-        return $success;
75
-    }
61
+	/**
62
+	 * Calls EE_Base_Class::delete() on the current object
63
+	 * Keep in mind that this always detaches the object from the collection
64
+	 * regardless of whether the delete was successful for the db.  This is because
65
+	 * its possible that the object ONLY existed in the collection.
66
+	 *
67
+	 * @access public
68
+	 * @return bool
69
+	 */
70
+	public function delete()
71
+	{
72
+		$success = $this->_call_user_func_array_on_current('delete');
73
+		$this->remove($this->current());
74
+		return $success;
75
+	}
76 76
 
77 77
 
78
-    /**
79
-     * delete_all
80
-     *
81
-     * calls EE_Base_Class::delete() on ALL objects in the repository
82
-     *
83
-     * @access public
84
-     * @return bool
85
-     */
86
-    public function delete_all()
87
-    {
88
-        $success = true;
89
-        $this->rewind();
90
-        while ($this->valid()) {
91
-            // any db error will result in false being returned
92
-            $success = $this->_call_user_func_array_on_current('delete') !== false ? $success : false;
93
-            // can't remove current object because valid() requires it
94
-            // so just capture current object temporarily
95
-            $object = $this->current();
96
-            // advance the pointer
97
-            $this->next();
98
-            // THEN remove the object from the repository
99
-            $this->remove($object);
100
-        }
101
-        return $success;
102
-    }
78
+	/**
79
+	 * delete_all
80
+	 *
81
+	 * calls EE_Base_Class::delete() on ALL objects in the repository
82
+	 *
83
+	 * @access public
84
+	 * @return bool
85
+	 */
86
+	public function delete_all()
87
+	{
88
+		$success = true;
89
+		$this->rewind();
90
+		while ($this->valid()) {
91
+			// any db error will result in false being returned
92
+			$success = $this->_call_user_func_array_on_current('delete') !== false ? $success : false;
93
+			// can't remove current object because valid() requires it
94
+			// so just capture current object temporarily
95
+			$object = $this->current();
96
+			// advance the pointer
97
+			$this->next();
98
+			// THEN remove the object from the repository
99
+			$this->remove($object);
100
+		}
101
+		return $success;
102
+	}
103 103
 
104 104
 
105
-    /**
106
-     * update_extra_meta
107
-     *
108
-     * calls EE_Base_Class::update_extra_meta() on the current object using the supplied values
109
-     *
110
-     * @access public
111
-     * @param string $meta_key
112
-     * @param string $meta_value
113
-     * @param string $previous_value
114
-     * @return bool | int
115
-     */
116
-    public function update_extra_meta($meta_key, $meta_value, $previous_value = null)
117
-    {
118
-        return $this->_call_user_func_array_on_current(
119
-            'update_extra_meta',
120
-            array($meta_key, $meta_value, $previous_value)
121
-        );
122
-    }
105
+	/**
106
+	 * update_extra_meta
107
+	 *
108
+	 * calls EE_Base_Class::update_extra_meta() on the current object using the supplied values
109
+	 *
110
+	 * @access public
111
+	 * @param string $meta_key
112
+	 * @param string $meta_value
113
+	 * @param string $previous_value
114
+	 * @return bool | int
115
+	 */
116
+	public function update_extra_meta($meta_key, $meta_value, $previous_value = null)
117
+	{
118
+		return $this->_call_user_func_array_on_current(
119
+			'update_extra_meta',
120
+			array($meta_key, $meta_value, $previous_value)
121
+		);
122
+	}
123 123
 }
Please login to merge, or discard this patch.
core/db_models/EEM_Term_Taxonomy.model.php 2 patches
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -62,49 +62,49 @@  discard block
 block discarded – undo
62 62
         );
63 63
         $cpt_models = array_keys(EE_Registry::instance()->cpt_models());
64 64
         foreach ($cpt_models as $model_name) {
65
-            $this->_model_relations[ $model_name ] = new EE_HABTM_Relation('Term_Relationship');
65
+            $this->_model_relations[$model_name] = new EE_HABTM_Relation('Term_Relationship');
66 66
         }
67 67
         $this->_wp_core_model = true;
68 68
         $this->_indexes = array(
69 69
             'term_id_taxonomy' => new EE_Unique_Index(array('term_id', 'taxonomy')),
70 70
         );
71 71
         $path_to_tax_model = '';
72
-        $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
73
-        $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Taxonomy_Protected(
72
+        $this->_cap_restriction_generators[EEM_Base::caps_read] = new EE_Restriction_Generator_Public();
73
+        $this->_cap_restriction_generators[EEM_Base::caps_read_admin] = new EE_Restriction_Generator_Taxonomy_Protected(
74 74
             $path_to_tax_model
75 75
         );
76
-        $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = false;
77
-        $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = false;
76
+        $this->_cap_restriction_generators[EEM_Base::caps_edit] = false;
77
+        $this->_cap_restriction_generators[EEM_Base::caps_delete] = false;
78 78
         // add cap restrictions for editing relating to the "ee_edit_*"
79
-        $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_category'] = new EE_Default_Where_Conditions(
79
+        $this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_event_category'] = new EE_Default_Where_Conditions(
80 80
             array(
81
-                $path_to_tax_model . 'taxonomy*ee_edit_event_category' => array('!=', 'espresso_event_categories'),
81
+                $path_to_tax_model.'taxonomy*ee_edit_event_category' => array('!=', 'espresso_event_categories'),
82 82
             )
83 83
         );
84
-        $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_venue_category'] = new EE_Default_Where_Conditions(
84
+        $this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_venue_category'] = new EE_Default_Where_Conditions(
85 85
             array(
86
-                $path_to_tax_model . 'taxonomy*ee_edit_venue_category' => array('!=', 'espresso_venue_categories'),
86
+                $path_to_tax_model.'taxonomy*ee_edit_venue_category' => array('!=', 'espresso_venue_categories'),
87 87
             )
88 88
         );
89
-        $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_type'] = new EE_Default_Where_Conditions(
89
+        $this->_cap_restrictions[EEM_Base::caps_edit]['ee_edit_event_type'] = new EE_Default_Where_Conditions(
90 90
             array(
91
-                $path_to_tax_model . 'taxonomy*ee_edit_event_type' => array('!=', 'espresso_event_type'),
91
+                $path_to_tax_model.'taxonomy*ee_edit_event_type' => array('!=', 'espresso_event_type'),
92 92
             )
93 93
         );
94 94
         // add cap restrictions for deleting relating to the "ee_deleting_*"
95
-        $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_category'] = new EE_Default_Where_Conditions(
95
+        $this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_event_category'] = new EE_Default_Where_Conditions(
96 96
             array(
97
-                $path_to_tax_model . 'taxonomy*ee_delete_event_category' => array('!=', 'espresso_event_categories'),
97
+                $path_to_tax_model.'taxonomy*ee_delete_event_category' => array('!=', 'espresso_event_categories'),
98 98
             )
99 99
         );
100
-        $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_venue_category'] = new EE_Default_Where_Conditions(
100
+        $this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_venue_category'] = new EE_Default_Where_Conditions(
101 101
             array(
102
-                $path_to_tax_model . 'taxonomy*ee_delete_venue_category' => array('!=', 'espresso_venue_categories'),
102
+                $path_to_tax_model.'taxonomy*ee_delete_venue_category' => array('!=', 'espresso_venue_categories'),
103 103
             )
104 104
         );
105
-        $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_type'] = new EE_Default_Where_Conditions(
105
+        $this->_cap_restrictions[EEM_Base::caps_delete]['ee_delete_event_type'] = new EE_Default_Where_Conditions(
106 106
             array(
107
-                $path_to_tax_model . 'taxonomy*ee_delete_event_type' => array('!=', 'espresso_event_type'),
107
+                $path_to_tax_model.'taxonomy*ee_delete_event_type' => array('!=', 'espresso_event_type'),
108 108
             )
109 109
         );
110 110
         parent::__construct($timezone);
@@ -126,7 +126,7 @@  discard block
 block discarded – undo
126 126
     {
127 127
         if ($model === EEM_Term_Taxonomy::instance()) {
128 128
             $taxonomies = get_taxonomies(array('show_in_rest' => true));
129
-            if (! empty($taxonomies)) {
129
+            if ( ! empty($taxonomies)) {
130 130
                 $model_query_params[0]['taxonomy'] = array('IN', $taxonomies);
131 131
             }
132 132
         }
Please login to merge, or discard this patch.
Indentation   +116 added lines, -116 removed lines patch added patch discarded remove patch
@@ -11,128 +11,128 @@
 block discarded – undo
11 11
 class EEM_Term_Taxonomy extends EEM_Base
12 12
 {
13 13
 
14
-    // private instance of the Attendee object
15
-    protected static $_instance = null;
14
+	// private instance of the Attendee object
15
+	protected static $_instance = null;
16 16
 
17 17
 
18 18
 
19
-    protected function __construct($timezone = null)
20
-    {
21
-        $this->singular_item = esc_html__('Term Taxonomy', 'event_espresso');
22
-        $this->plural_item = esc_html__('Term Taxonomy', 'event_espresso');
23
-        $this->_tables = array(
24
-            'Term_Taxonomy' => new EE_Primary_Table('term_taxonomy', 'term_taxonomy_id'),
25
-        );
26
-        $this->_fields = array(
27
-            'Term_Taxonomy' => array(
28
-                'term_taxonomy_id' => new EE_Primary_Key_Int_Field(
29
-                    'term_taxonomy_id',
30
-                    esc_html__('Term-Taxonomy ID', 'event_espresso')
31
-                ),
32
-                'term_id'          => new EE_Foreign_Key_Int_Field(
33
-                    'term_id',
34
-                    esc_html__("Term Id", "event_espresso"),
35
-                    false,
36
-                    0,
37
-                    'Term'
38
-                ),
39
-                'taxonomy'         => new EE_Plain_Text_Field(
40
-                    'taxonomy',
41
-                    esc_html__('Taxonomy Name', 'event_espresso'),
42
-                    false,
43
-                    'category'
44
-                ),
45
-                'description'      => new EE_Post_Content_Field(
46
-                    'description',
47
-                    esc_html__("Description of Term", "event_espresso"),
48
-                    false,
49
-                    ''
50
-                ),
51
-                'parent'           => new EE_Integer_Field('parent', esc_html__("Parent Term ID", "event_espresso"), false, 0),
52
-                'term_count'       => new EE_Integer_Field(
53
-                    'count',
54
-                    esc_html__("Count of Objects attached", 'event_espresso'),
55
-                    false,
56
-                    0
57
-                ),
58
-            ),
59
-        );
60
-        $this->_model_relations = array(
61
-            'Term_Relationship' => new EE_Has_Many_Relation(),
62
-            'Term'              => new EE_Belongs_To_Relation(),
63
-        );
64
-        $cpt_models = array_keys(EE_Registry::instance()->cpt_models());
65
-        foreach ($cpt_models as $model_name) {
66
-            $this->_model_relations[ $model_name ] = new EE_HABTM_Relation('Term_Relationship');
67
-        }
68
-        $this->_wp_core_model = true;
69
-        $this->_indexes = array(
70
-            'term_id_taxonomy' => new EE_Unique_Index(array('term_id', 'taxonomy')),
71
-        );
72
-        $path_to_tax_model = '';
73
-        $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
74
-        $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Taxonomy_Protected(
75
-            $path_to_tax_model
76
-        );
77
-        $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = false;
78
-        $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = false;
79
-        // add cap restrictions for editing relating to the "ee_edit_*"
80
-        $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_category'] = new EE_Default_Where_Conditions(
81
-            array(
82
-                $path_to_tax_model . 'taxonomy*ee_edit_event_category' => array('!=', 'espresso_event_categories'),
83
-            )
84
-        );
85
-        $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_venue_category'] = new EE_Default_Where_Conditions(
86
-            array(
87
-                $path_to_tax_model . 'taxonomy*ee_edit_venue_category' => array('!=', 'espresso_venue_categories'),
88
-            )
89
-        );
90
-        $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_type'] = new EE_Default_Where_Conditions(
91
-            array(
92
-                $path_to_tax_model . 'taxonomy*ee_edit_event_type' => array('!=', 'espresso_event_type'),
93
-            )
94
-        );
95
-        // add cap restrictions for deleting relating to the "ee_deleting_*"
96
-        $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_category'] = new EE_Default_Where_Conditions(
97
-            array(
98
-                $path_to_tax_model . 'taxonomy*ee_delete_event_category' => array('!=', 'espresso_event_categories'),
99
-            )
100
-        );
101
-        $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_venue_category'] = new EE_Default_Where_Conditions(
102
-            array(
103
-                $path_to_tax_model . 'taxonomy*ee_delete_venue_category' => array('!=', 'espresso_venue_categories'),
104
-            )
105
-        );
106
-        $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_type'] = new EE_Default_Where_Conditions(
107
-            array(
108
-                $path_to_tax_model . 'taxonomy*ee_delete_event_type' => array('!=', 'espresso_event_type'),
109
-            )
110
-        );
111
-        parent::__construct($timezone);
112
-        add_filter('FHEE__Read__create_model_query_params', array('EEM_Term_Taxonomy', 'rest_api_query_params'), 10, 3);
113
-    }
19
+	protected function __construct($timezone = null)
20
+	{
21
+		$this->singular_item = esc_html__('Term Taxonomy', 'event_espresso');
22
+		$this->plural_item = esc_html__('Term Taxonomy', 'event_espresso');
23
+		$this->_tables = array(
24
+			'Term_Taxonomy' => new EE_Primary_Table('term_taxonomy', 'term_taxonomy_id'),
25
+		);
26
+		$this->_fields = array(
27
+			'Term_Taxonomy' => array(
28
+				'term_taxonomy_id' => new EE_Primary_Key_Int_Field(
29
+					'term_taxonomy_id',
30
+					esc_html__('Term-Taxonomy ID', 'event_espresso')
31
+				),
32
+				'term_id'          => new EE_Foreign_Key_Int_Field(
33
+					'term_id',
34
+					esc_html__("Term Id", "event_espresso"),
35
+					false,
36
+					0,
37
+					'Term'
38
+				),
39
+				'taxonomy'         => new EE_Plain_Text_Field(
40
+					'taxonomy',
41
+					esc_html__('Taxonomy Name', 'event_espresso'),
42
+					false,
43
+					'category'
44
+				),
45
+				'description'      => new EE_Post_Content_Field(
46
+					'description',
47
+					esc_html__("Description of Term", "event_espresso"),
48
+					false,
49
+					''
50
+				),
51
+				'parent'           => new EE_Integer_Field('parent', esc_html__("Parent Term ID", "event_espresso"), false, 0),
52
+				'term_count'       => new EE_Integer_Field(
53
+					'count',
54
+					esc_html__("Count of Objects attached", 'event_espresso'),
55
+					false,
56
+					0
57
+				),
58
+			),
59
+		);
60
+		$this->_model_relations = array(
61
+			'Term_Relationship' => new EE_Has_Many_Relation(),
62
+			'Term'              => new EE_Belongs_To_Relation(),
63
+		);
64
+		$cpt_models = array_keys(EE_Registry::instance()->cpt_models());
65
+		foreach ($cpt_models as $model_name) {
66
+			$this->_model_relations[ $model_name ] = new EE_HABTM_Relation('Term_Relationship');
67
+		}
68
+		$this->_wp_core_model = true;
69
+		$this->_indexes = array(
70
+			'term_id_taxonomy' => new EE_Unique_Index(array('term_id', 'taxonomy')),
71
+		);
72
+		$path_to_tax_model = '';
73
+		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
74
+		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Taxonomy_Protected(
75
+			$path_to_tax_model
76
+		);
77
+		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = false;
78
+		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = false;
79
+		// add cap restrictions for editing relating to the "ee_edit_*"
80
+		$this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_category'] = new EE_Default_Where_Conditions(
81
+			array(
82
+				$path_to_tax_model . 'taxonomy*ee_edit_event_category' => array('!=', 'espresso_event_categories'),
83
+			)
84
+		);
85
+		$this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_venue_category'] = new EE_Default_Where_Conditions(
86
+			array(
87
+				$path_to_tax_model . 'taxonomy*ee_edit_venue_category' => array('!=', 'espresso_venue_categories'),
88
+			)
89
+		);
90
+		$this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_type'] = new EE_Default_Where_Conditions(
91
+			array(
92
+				$path_to_tax_model . 'taxonomy*ee_edit_event_type' => array('!=', 'espresso_event_type'),
93
+			)
94
+		);
95
+		// add cap restrictions for deleting relating to the "ee_deleting_*"
96
+		$this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_category'] = new EE_Default_Where_Conditions(
97
+			array(
98
+				$path_to_tax_model . 'taxonomy*ee_delete_event_category' => array('!=', 'espresso_event_categories'),
99
+			)
100
+		);
101
+		$this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_venue_category'] = new EE_Default_Where_Conditions(
102
+			array(
103
+				$path_to_tax_model . 'taxonomy*ee_delete_venue_category' => array('!=', 'espresso_venue_categories'),
104
+			)
105
+		);
106
+		$this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_type'] = new EE_Default_Where_Conditions(
107
+			array(
108
+				$path_to_tax_model . 'taxonomy*ee_delete_event_type' => array('!=', 'espresso_event_type'),
109
+			)
110
+		);
111
+		parent::__construct($timezone);
112
+		add_filter('FHEE__Read__create_model_query_params', array('EEM_Term_Taxonomy', 'rest_api_query_params'), 10, 3);
113
+	}
114 114
 
115 115
 
116 116
 
117
-    /**
118
-     * Makes sure that during REST API queries, we only return term-taxonomies
119
-     * for term taxonomies which should be shown in the rest api
120
-     *
121
-     * @param array    $model_query_params
122
-     * @param array    $querystring_query_params
123
-     * @param EEM_Base $model
124
-     * @return array
125
-     */
126
-    public static function rest_api_query_params($model_query_params, $querystring_query_params, $model)
127
-    {
128
-        if ($model === EEM_Term_Taxonomy::instance()) {
129
-            $taxonomies = get_taxonomies(array('show_in_rest' => true));
130
-            if (! empty($taxonomies)) {
131
-                $model_query_params[0]['taxonomy'] = array('IN', $taxonomies);
132
-            }
133
-        }
134
-        return $model_query_params;
135
-    }
117
+	/**
118
+	 * Makes sure that during REST API queries, we only return term-taxonomies
119
+	 * for term taxonomies which should be shown in the rest api
120
+	 *
121
+	 * @param array    $model_query_params
122
+	 * @param array    $querystring_query_params
123
+	 * @param EEM_Base $model
124
+	 * @return array
125
+	 */
126
+	public static function rest_api_query_params($model_query_params, $querystring_query_params, $model)
127
+	{
128
+		if ($model === EEM_Term_Taxonomy::instance()) {
129
+			$taxonomies = get_taxonomies(array('show_in_rest' => true));
130
+			if (! empty($taxonomies)) {
131
+				$model_query_params[0]['taxonomy'] = array('IN', $taxonomies);
132
+			}
133
+		}
134
+		return $model_query_params;
135
+	}
136 136
 }
137 137
 // End of file EEM_Term_Taxonomy.model.php
138 138
 // Location: /includes/models/EEM_Term_Taxonomy.model.php
Please login to merge, or discard this patch.
core/db_models/EEM_Extra_Meta.model.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,10 +38,10 @@
 block discarded – undo
38 38
             ));
39 39
         $this->_model_relations = array();
40 40
         foreach ($models_this_can_attach_to as $model) {
41
-            $this->_model_relations[ $model ] = new EE_Belongs_To_Any_Relation();
41
+            $this->_model_relations[$model] = new EE_Belongs_To_Any_Relation();
42 42
         }
43 43
         foreach ($this->cap_contexts_to_cap_action_map() as $cap_context => $action) {
44
-            $this->_cap_restriction_generators[ $cap_context ] = new EE_Restriction_Generator_Meta('EXM_key', 'EXM_value');
44
+            $this->_cap_restriction_generators[$cap_context] = new EE_Restriction_Generator_Meta('EXM_key', 'EXM_value');
45 45
         }
46 46
         parent::__construct($timezone);
47 47
     }
Please login to merge, or discard this patch.
Indentation   +27 added lines, -27 removed lines patch added patch discarded remove patch
@@ -17,33 +17,33 @@
 block discarded – undo
17 17
 class EEM_Extra_Meta extends EEM_Base
18 18
 {
19 19
 
20
-    // private instance of the Attendee object
21
-    protected static $_instance = null;
20
+	// private instance of the Attendee object
21
+	protected static $_instance = null;
22 22
 
23
-    protected function __construct($timezone = null)
24
-    {
25
-        $this->singular_item = esc_html__('Extra Meta', 'event_espresso');
26
-        $this->plural_item = esc_html__('Extra Metas', 'event_espresso');
27
-        $this->_tables = array(
28
-            'Extra_Meta' => new EE_Primary_Table('esp_extra_meta', 'EXM_ID')
29
-        );
30
-        $models_this_can_attach_to = array_keys(EE_Registry::instance()->non_abstract_db_models);
31
-        $this->_fields = array(
32
-            'Extra_Meta' => array(
33
-                'EXM_ID' => new EE_Primary_Key_Int_Field('EXM_ID', esc_html__("Extra Meta ID", "event_espresso")),
34
-                'OBJ_ID' => new EE_Foreign_Key_Int_Field('OBJ_ID', esc_html__("Primary Key of Attached Thing", "event_espresso"), false, 0, $models_this_can_attach_to),
35
-                'EXM_type' => new EE_Any_Foreign_Model_Name_Field('EXM_type', esc_html__("Model of Attached Thing", "event_espresso"), false, 'Transaction', $models_this_can_attach_to),
36
-                'EXM_key' => new EE_Plain_Text_Field('EXM_key', esc_html__("Meta Key", "event_espresso"), false, ''),
37
-                'EXM_value' => new EE_Maybe_Serialized_Text_Field('EXM_value', esc_html__("Meta Value", "event_espresso"), true)
23
+	protected function __construct($timezone = null)
24
+	{
25
+		$this->singular_item = esc_html__('Extra Meta', 'event_espresso');
26
+		$this->plural_item = esc_html__('Extra Metas', 'event_espresso');
27
+		$this->_tables = array(
28
+			'Extra_Meta' => new EE_Primary_Table('esp_extra_meta', 'EXM_ID')
29
+		);
30
+		$models_this_can_attach_to = array_keys(EE_Registry::instance()->non_abstract_db_models);
31
+		$this->_fields = array(
32
+			'Extra_Meta' => array(
33
+				'EXM_ID' => new EE_Primary_Key_Int_Field('EXM_ID', esc_html__("Extra Meta ID", "event_espresso")),
34
+				'OBJ_ID' => new EE_Foreign_Key_Int_Field('OBJ_ID', esc_html__("Primary Key of Attached Thing", "event_espresso"), false, 0, $models_this_can_attach_to),
35
+				'EXM_type' => new EE_Any_Foreign_Model_Name_Field('EXM_type', esc_html__("Model of Attached Thing", "event_espresso"), false, 'Transaction', $models_this_can_attach_to),
36
+				'EXM_key' => new EE_Plain_Text_Field('EXM_key', esc_html__("Meta Key", "event_espresso"), false, ''),
37
+				'EXM_value' => new EE_Maybe_Serialized_Text_Field('EXM_value', esc_html__("Meta Value", "event_espresso"), true)
38 38
 
39
-            ));
40
-        $this->_model_relations = array();
41
-        foreach ($models_this_can_attach_to as $model) {
42
-            $this->_model_relations[ $model ] = new EE_Belongs_To_Any_Relation();
43
-        }
44
-        foreach ($this->cap_contexts_to_cap_action_map() as $cap_context => $action) {
45
-            $this->_cap_restriction_generators[ $cap_context ] = new EE_Restriction_Generator_Meta('EXM_key', 'EXM_value');
46
-        }
47
-        parent::__construct($timezone);
48
-    }
39
+			));
40
+		$this->_model_relations = array();
41
+		foreach ($models_this_can_attach_to as $model) {
42
+			$this->_model_relations[ $model ] = new EE_Belongs_To_Any_Relation();
43
+		}
44
+		foreach ($this->cap_contexts_to_cap_action_map() as $cap_context => $action) {
45
+			$this->_cap_restriction_generators[ $cap_context ] = new EE_Restriction_Generator_Meta('EXM_key', 'EXM_value');
46
+		}
47
+		parent::__construct($timezone);
48
+	}
49 49
 }
Please login to merge, or discard this patch.
core/db_models/EEM_Attendee.model.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -284,8 +284,8 @@  discard block
 block discarded – undo
284 284
      */
285 285
     public function get_attendee_field_for_system_question($system_question_string)
286 286
     {
287
-        return isset($this->_system_question_to_attendee_field_name[ $system_question_string ])
288
-            ? $this->_system_question_to_attendee_field_name[ $system_question_string ]
287
+        return isset($this->_system_question_to_attendee_field_name[$system_question_string])
288
+            ? $this->_system_question_to_attendee_field_name[$system_question_string]
289 289
             : null;
290 290
     }
291 291
 
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
             return false;
354 354
         }
355 355
         $attendee = $this->get_all(array($where_cols_n_values));
356
-        if (! empty($attendee)) {
356
+        if ( ! empty($attendee)) {
357 357
             return array_shift($attendee);
358 358
         }
359 359
         return false;
Please login to merge, or discard this patch.
Indentation   +419 added lines, -419 removed lines patch added patch discarded remove patch
@@ -13,432 +13,432 @@
 block discarded – undo
13 13
 class EEM_Attendee extends EEM_CPT_Base
14 14
 {
15 15
 
16
-    // private instance of the Attendee object
17
-    protected static $_instance = null;
16
+	// private instance of the Attendee object
17
+	protected static $_instance = null;
18 18
 
19
-    /**
20
-     * QST_system for questions are strings not integers now,
21
-     * so these constants are deprecated.
22
-     * Please instead use the EEM_Attendee::system_question_* constants
23
-     *
24
-     * @deprecated
25
-     */
26
-    const fname_question_id = 1;
19
+	/**
20
+	 * QST_system for questions are strings not integers now,
21
+	 * so these constants are deprecated.
22
+	 * Please instead use the EEM_Attendee::system_question_* constants
23
+	 *
24
+	 * @deprecated
25
+	 */
26
+	const fname_question_id = 1;
27 27
 
28
-    /**
29
-     * @deprecated
30
-     */
31
-    const lname_question_id = 2;
28
+	/**
29
+	 * @deprecated
30
+	 */
31
+	const lname_question_id = 2;
32 32
 
33 33
 
34
-    /**
35
-     * @deprecated
36
-     */
37
-    const email_question_id = 3;
34
+	/**
35
+	 * @deprecated
36
+	 */
37
+	const email_question_id = 3;
38 38
 
39 39
 
40
-    /**
41
-     * @deprecated
42
-     */
43
-    const address_question_id = 4;
40
+	/**
41
+	 * @deprecated
42
+	 */
43
+	const address_question_id = 4;
44 44
 
45 45
 
46
-    /**
47
-     * @deprecated
48
-     */
49
-    const address2_question_id = 5;
46
+	/**
47
+	 * @deprecated
48
+	 */
49
+	const address2_question_id = 5;
50 50
 
51
-
52
-    /**
53
-     * @deprecated
54
-     */
55
-    const city_question_id = 6;
56
-
57
-
58
-    /**
59
-     * @deprecated
60
-     */
61
-    const state_question_id = 7;
62
-
63
-
64
-    /**
65
-     * @deprecated
66
-     */
67
-    const country_question_id = 8;
68
-
69
-
70
-    /**
71
-     * @deprecated
72
-     */
73
-    const zip_question_id = 9;
74
-
75
-
76
-    /**
77
-     * @deprecated
78
-     */
79
-    const phone_question_id = 10;
80
-
81
-    /**
82
-     * When looking for questions that correspond to attendee fields,
83
-     * look for the question with this QST_system value.
84
-     * These replace the old constants like EEM_Attendee::*_question_id
85
-     */
86
-    const system_question_fname = 'fname';
87
-
88
-    const system_question_lname = 'lname';
89
-
90
-    const system_question_email = 'email';
91
-
92
-    const system_question_email_confirm = 'email_confirm';
93
-
94
-    const system_question_address = 'address';
95
-
96
-    const system_question_address2 = 'address2';
97
-
98
-    const system_question_city = 'city';
99
-
100
-    const system_question_state = 'state';
101
-
102
-    const system_question_country = 'country';
103
-
104
-    const system_question_zip = 'zip';
105
-
106
-    const system_question_phone = 'phone';
107
-
108
-    /**
109
-     * Keys are all the EEM_Attendee::system_question_* constants, which are
110
-     * also all the values of QST_system in the questions table, and values
111
-     * are their corresponding Attendee field names
112
-     *
113
-     * @var array
114
-     */
115
-    protected $_system_question_to_attendee_field_name = array(
116
-        EEM_Attendee::system_question_fname    => 'ATT_fname',
117
-        EEM_Attendee::system_question_lname    => 'ATT_lname',
118
-        EEM_Attendee::system_question_email    => 'ATT_email',
119
-        EEM_Attendee::system_question_address  => 'ATT_address',
120
-        EEM_Attendee::system_question_address2 => 'ATT_address2',
121
-        EEM_Attendee::system_question_city     => 'ATT_city',
122
-        EEM_Attendee::system_question_state    => 'STA_ID',
123
-        EEM_Attendee::system_question_country  => 'CNT_ISO',
124
-        EEM_Attendee::system_question_zip      => 'ATT_zip',
125
-        EEM_Attendee::system_question_phone    => 'ATT_phone',
126
-    );
127
-
128
-
129
-
130
-    /**
131
-     * EEM_Attendee constructor.
132
-     *
133
-     * @param null              $timezone
134
-     * @param ModelFieldFactory $model_field_factory
135
-     * @throws EE_Error
136
-     * @throws InvalidArgumentException
137
-     */
138
-    protected function __construct($timezone = null, ModelFieldFactory $model_field_factory)
139
-    {
140
-        $this->singular_item = esc_html__('Attendee', 'event_espresso');
141
-        $this->plural_item = esc_html__('Attendees', 'event_espresso');
142
-        $this->_tables = array(
143
-            'Attendee_CPT'  => new EE_Primary_Table('posts', 'ID'),
144
-            'Attendee_Meta' => new EE_Secondary_Table(
145
-                'esp_attendee_meta',
146
-                'ATTM_ID',
147
-                'ATT_ID'
148
-            ),
149
-        );
150
-        $this->_fields = array(
151
-            'Attendee_CPT'  => array(
152
-                'ATT_ID'        => $model_field_factory->createPrimaryKeyIntField(
153
-                    'ID',
154
-                    esc_html__('Attendee ID', 'event_espresso')
155
-                ),
156
-                'ATT_full_name' => $model_field_factory->createPlainTextField(
157
-                    'post_title',
158
-                    esc_html__('Attendee Full Name', 'event_espresso'),
159
-                    false,
160
-                    esc_html__('Unknown', 'event_espresso')
161
-                ),
162
-                'ATT_bio'       => $model_field_factory->createPostContentField(
163
-                    'post_content',
164
-                    esc_html__('Attendee Biography', 'event_espresso'),
165
-                    false,
166
-                    esc_html__('No Biography Provided', 'event_espresso')
167
-                ),
168
-                'ATT_slug'      => $model_field_factory->createSlugField(
169
-                    'post_name',
170
-                    esc_html__('Attendee URL Slug', 'event_espresso')
171
-                ),
172
-                'ATT_created'   => $model_field_factory->createDatetimeField(
173
-                    'post_date',
174
-                    esc_html__('Time Attendee Created', 'event_espresso')
175
-                ),
176
-                'ATT_short_bio' => $model_field_factory->createSimpleHtmlField(
177
-                    'post_excerpt',
178
-                    esc_html__('Attendee Short Biography', 'event_espresso'),
179
-                    true,
180
-                    esc_html__('No Biography Provided', 'event_espresso')
181
-                ),
182
-                'ATT_modified'  => $model_field_factory->createDatetimeField(
183
-                    'post_modified',
184
-                    esc_html__('Time Attendee Last Modified', 'event_espresso')
185
-                ),
186
-                'ATT_author'    => $model_field_factory->createWpUserField(
187
-                    'post_author',
188
-                    esc_html__('Creator ID of the first Event attended', 'event_espresso'),
189
-                    false
190
-                ),
191
-                'ATT_parent'    => $model_field_factory->createDbOnlyIntField(
192
-                    'post_parent',
193
-                    esc_html__('Parent Attendee (unused)', 'event_espresso'),
194
-                    false,
195
-                    0
196
-                ),
197
-                'post_type'     => $model_field_factory->createWpPostTypeField('espresso_attendees'),
198
-                'status'        => $model_field_factory->createWpPostStatusField(
199
-                    'post_status',
200
-                    esc_html__('Attendee Status', 'event_espresso'),
201
-                    false,
202
-                    'publish'
203
-                ),
204
-                'password' => new EE_Password_Field(
205
-                    'post_password',
206
-                    esc_html__('Password', 'event_espresso'),
207
-                    false,
208
-                    '',
209
-                    array(
210
-                        'ATT_bio',
211
-                        'ATT_short_bio',
212
-                        'ATT_address',
213
-                        'ATT_address2',
214
-                        'ATT_city',
215
-                        'STA_ID',
216
-                        'CNT_ISO',
217
-                        'ATT_zip',
218
-                        'ATT_email',
219
-                        'ATT_phone'
220
-                    )
221
-                )
222
-            ),
223
-            'Attendee_Meta' => array(
224
-                'ATTM_ID'      => $model_field_factory->createDbOnlyIntField(
225
-                    'ATTM_ID',
226
-                    esc_html__('Attendee Meta Row ID', 'event_espresso'),
227
-                    false
228
-                ),
229
-                'ATT_ID_fk'    => $model_field_factory->createDbOnlyIntField(
230
-                    'ATT_ID',
231
-                    esc_html__('Foreign Key to Attendee in Post Table', 'event_espresso'),
232
-                    false
233
-                ),
234
-                'ATT_fname'    => $model_field_factory->createPlainTextField(
235
-                    'ATT_fname',
236
-                    esc_html__('First Name', 'event_espresso')
237
-                ),
238
-                'ATT_lname'    => $model_field_factory->createPlainTextField(
239
-                    'ATT_lname',
240
-                    esc_html__('Last Name', 'event_espresso')
241
-                ),
242
-                'ATT_address'  => $model_field_factory->createPlainTextField(
243
-                    'ATT_address',
244
-                    esc_html__('Address Part 1', 'event_espresso')
245
-                ),
246
-                'ATT_address2' => $model_field_factory->createPlainTextField(
247
-                    'ATT_address2',
248
-                    esc_html__('Address Part 2', 'event_espresso')
249
-                ),
250
-                'ATT_city'     => $model_field_factory->createPlainTextField(
251
-                    'ATT_city',
252
-                    esc_html__('City', 'event_espresso')
253
-                ),
254
-                'STA_ID'       => $model_field_factory->createForeignKeyIntField(
255
-                    'STA_ID',
256
-                    esc_html__('State', 'event_espresso'),
257
-                    true,
258
-                    0,
259
-                    'State'
260
-                ),
261
-                'CNT_ISO'      => $model_field_factory->createForeignKeyStringField(
262
-                    'CNT_ISO',
263
-                    esc_html__('Country', 'event_espresso'),
264
-                    true,
265
-                    '',
266
-                    'Country'
267
-                ),
268
-                'ATT_zip'      => $model_field_factory->createPlainTextField(
269
-                    'ATT_zip',
270
-                    esc_html__('ZIP/Postal Code', 'event_espresso')
271
-                ),
272
-                'ATT_email'    => $model_field_factory->createEmailField(
273
-                    'ATT_email',
274
-                    esc_html__('Email Address', 'event_espresso')
275
-                ),
276
-                'ATT_phone'    => $model_field_factory->createPlainTextField(
277
-                    'ATT_phone',
278
-                    esc_html__('Phone', 'event_espresso')
279
-                ),
280
-            ),
281
-        );
282
-        $this->_model_relations = array(
283
-            'Registration'      => new EE_Has_Many_Relation(),
284
-            'State'             => new EE_Belongs_To_Relation(),
285
-            'Country'           => new EE_Belongs_To_Relation(),
286
-            'Event'             => new EE_HABTM_Relation('Registration', false),
287
-            'WP_User'           => new EE_Belongs_To_Relation(),
288
-            'Message'           => new EE_Has_Many_Any_Relation(false),
289
-            // allow deletion of attendees even if they have messages in the queue for them.
290
-            'Term_Relationship' => new EE_Has_Many_Relation(),
291
-            'Term_Taxonomy'     => new EE_HABTM_Relation('Term_Relationship'),
292
-        );
293
-        $this->_caps_slug = 'contacts';
294
-        $this->model_chain_to_password = '';
295
-        parent::__construct($timezone);
296
-    }
297
-
298
-
299
-
300
-    /**
301
-     * Gets the name of the field on the attendee model corresponding to the system question string
302
-     * which should be one of the keys from EEM_Attendee::_system_question_to_attendee_field_name
303
-     *
304
-     * @param string $system_question_string
305
-     * @return string|null if not found
306
-     */
307
-    public function get_attendee_field_for_system_question($system_question_string)
308
-    {
309
-        return isset($this->_system_question_to_attendee_field_name[ $system_question_string ])
310
-            ? $this->_system_question_to_attendee_field_name[ $system_question_string ]
311
-            : null;
312
-    }
313
-
314
-
315
-
316
-    /**
317
-     * Gets mapping from esp_question.QST_system values to their corresponding attendee field names
318
-     *
319
-     * @return array
320
-     */
321
-    public function system_question_to_attendee_field_mapping()
322
-    {
323
-        return $this->_system_question_to_attendee_field_name;
324
-    }
325
-
326
-
327
-
328
-    /**
329
-     * Gets all the attendees for a transaction (by using the esp_registration as a join table)
330
-     *
331
-     * @param EE_Transaction /int $transaction_id_or_obj EE_Transaction or its ID
332
-     * @return EE_Attendee[]|EE_Base_Class[]
333
-     * @throws EE_Error
334
-     */
335
-    public function get_attendees_for_transaction($transaction_id_or_obj)
336
-    {
337
-        return $this->get_all(
338
-            array(
339
-                array(
340
-                    'Registration.Transaction.TXN_ID' => $transaction_id_or_obj instanceof EE_Transaction
341
-                        ? $transaction_id_or_obj->ID()
342
-                        : $transaction_id_or_obj,
343
-                ),
344
-            )
345
-        );
346
-    }
347
-
348
-
349
-
350
-    /**
351
-     * retrieve  a single attendee from db via their ID
352
-     *
353
-     * @param $ATT_ID
354
-     * @return mixed array on success, FALSE on fail
355
-     * @deprecated
356
-     */
357
-    public function get_attendee_by_ID($ATT_ID = false)
358
-    {
359
-        // retrieve a particular EE_Attendee
360
-        return $this->get_one_by_ID($ATT_ID);
361
-    }
362
-
363
-
364
-
365
-    /**
366
-     * retrieve  a single attendee from db via their ID
367
-     *
368
-     * @param array $where_cols_n_values
369
-     * @return mixed array on success, FALSE on fail
370
-     * @throws EE_Error
371
-     */
372
-    public function get_attendee($where_cols_n_values = array())
373
-    {
374
-        if (empty($where_cols_n_values)) {
375
-            return false;
376
-        }
377
-        $attendee = $this->get_all(array($where_cols_n_values));
378
-        if (! empty($attendee)) {
379
-            return array_shift($attendee);
380
-        }
381
-        return false;
382
-    }
383
-
384
-
385
-
386
-    /**
387
-     * Search for an existing Attendee record in the DB
388
-     *
389
-     * @param array $where_cols_n_values
390
-     * @return bool|mixed
391
-     * @throws EE_Error
392
-     */
393
-    public function find_existing_attendee($where_cols_n_values = null)
394
-    {
395
-        // search by combo of first and last names plus the email address
396
-        $attendee_data_keys = array(
397
-            'ATT_fname' => $this->_ATT_fname,
398
-            'ATT_lname' => $this->_ATT_lname,
399
-            'ATT_email' => $this->_ATT_email,
400
-        );
401
-        // no search params means attendee object already exists.
402
-        $where_cols_n_values = is_array($where_cols_n_values) && ! empty($where_cols_n_values)
403
-            ? $where_cols_n_values
404
-            : $attendee_data_keys;
405
-        $valid_data = true;
406
-        // check for required values
407
-        $valid_data = isset($where_cols_n_values['ATT_fname']) && ! empty($where_cols_n_values['ATT_fname'])
408
-            ? $valid_data
409
-            : false;
410
-        $valid_data = isset($where_cols_n_values['ATT_lname']) && ! empty($where_cols_n_values['ATT_lname'])
411
-            ? $valid_data
412
-            : false;
413
-        $valid_data = isset($where_cols_n_values['ATT_email']) && ! empty($where_cols_n_values['ATT_email'])
414
-            ? $valid_data
415
-            : false;
416
-        if ($valid_data) {
417
-            $attendee = $this->get_attendee($where_cols_n_values);
418
-            if ($attendee instanceof EE_Attendee) {
419
-                return $attendee;
420
-            }
421
-        }
422
-        return false;
423
-    }
424
-
425
-
426
-
427
-    /**
428
-     * Takes an incoming array of EE_Registration ids
429
-     * and sends back a list of corresponding non duplicate EE_Attendee objects.
430
-     *
431
-     * @since  4.3.0
432
-     * @param  array $ids array of EE_Registration ids
433
-     * @return EE_Attendee[]|EE_Base_Class[]
434
-     * @throws EE_Error
435
-     */
436
-    public function get_array_of_contacts_from_reg_ids($ids)
437
-    {
438
-        $ids = (array) $ids;
439
-        $_where = array(
440
-            'Registration.REG_ID' => array('in', $ids),
441
-        );
442
-        return $this->get_all(array($_where));
443
-    }
51
+
52
+	/**
53
+	 * @deprecated
54
+	 */
55
+	const city_question_id = 6;
56
+
57
+
58
+	/**
59
+	 * @deprecated
60
+	 */
61
+	const state_question_id = 7;
62
+
63
+
64
+	/**
65
+	 * @deprecated
66
+	 */
67
+	const country_question_id = 8;
68
+
69
+
70
+	/**
71
+	 * @deprecated
72
+	 */
73
+	const zip_question_id = 9;
74
+
75
+
76
+	/**
77
+	 * @deprecated
78
+	 */
79
+	const phone_question_id = 10;
80
+
81
+	/**
82
+	 * When looking for questions that correspond to attendee fields,
83
+	 * look for the question with this QST_system value.
84
+	 * These replace the old constants like EEM_Attendee::*_question_id
85
+	 */
86
+	const system_question_fname = 'fname';
87
+
88
+	const system_question_lname = 'lname';
89
+
90
+	const system_question_email = 'email';
91
+
92
+	const system_question_email_confirm = 'email_confirm';
93
+
94
+	const system_question_address = 'address';
95
+
96
+	const system_question_address2 = 'address2';
97
+
98
+	const system_question_city = 'city';
99
+
100
+	const system_question_state = 'state';
101
+
102
+	const system_question_country = 'country';
103
+
104
+	const system_question_zip = 'zip';
105
+
106
+	const system_question_phone = 'phone';
107
+
108
+	/**
109
+	 * Keys are all the EEM_Attendee::system_question_* constants, which are
110
+	 * also all the values of QST_system in the questions table, and values
111
+	 * are their corresponding Attendee field names
112
+	 *
113
+	 * @var array
114
+	 */
115
+	protected $_system_question_to_attendee_field_name = array(
116
+		EEM_Attendee::system_question_fname    => 'ATT_fname',
117
+		EEM_Attendee::system_question_lname    => 'ATT_lname',
118
+		EEM_Attendee::system_question_email    => 'ATT_email',
119
+		EEM_Attendee::system_question_address  => 'ATT_address',
120
+		EEM_Attendee::system_question_address2 => 'ATT_address2',
121
+		EEM_Attendee::system_question_city     => 'ATT_city',
122
+		EEM_Attendee::system_question_state    => 'STA_ID',
123
+		EEM_Attendee::system_question_country  => 'CNT_ISO',
124
+		EEM_Attendee::system_question_zip      => 'ATT_zip',
125
+		EEM_Attendee::system_question_phone    => 'ATT_phone',
126
+	);
127
+
128
+
129
+
130
+	/**
131
+	 * EEM_Attendee constructor.
132
+	 *
133
+	 * @param null              $timezone
134
+	 * @param ModelFieldFactory $model_field_factory
135
+	 * @throws EE_Error
136
+	 * @throws InvalidArgumentException
137
+	 */
138
+	protected function __construct($timezone = null, ModelFieldFactory $model_field_factory)
139
+	{
140
+		$this->singular_item = esc_html__('Attendee', 'event_espresso');
141
+		$this->plural_item = esc_html__('Attendees', 'event_espresso');
142
+		$this->_tables = array(
143
+			'Attendee_CPT'  => new EE_Primary_Table('posts', 'ID'),
144
+			'Attendee_Meta' => new EE_Secondary_Table(
145
+				'esp_attendee_meta',
146
+				'ATTM_ID',
147
+				'ATT_ID'
148
+			),
149
+		);
150
+		$this->_fields = array(
151
+			'Attendee_CPT'  => array(
152
+				'ATT_ID'        => $model_field_factory->createPrimaryKeyIntField(
153
+					'ID',
154
+					esc_html__('Attendee ID', 'event_espresso')
155
+				),
156
+				'ATT_full_name' => $model_field_factory->createPlainTextField(
157
+					'post_title',
158
+					esc_html__('Attendee Full Name', 'event_espresso'),
159
+					false,
160
+					esc_html__('Unknown', 'event_espresso')
161
+				),
162
+				'ATT_bio'       => $model_field_factory->createPostContentField(
163
+					'post_content',
164
+					esc_html__('Attendee Biography', 'event_espresso'),
165
+					false,
166
+					esc_html__('No Biography Provided', 'event_espresso')
167
+				),
168
+				'ATT_slug'      => $model_field_factory->createSlugField(
169
+					'post_name',
170
+					esc_html__('Attendee URL Slug', 'event_espresso')
171
+				),
172
+				'ATT_created'   => $model_field_factory->createDatetimeField(
173
+					'post_date',
174
+					esc_html__('Time Attendee Created', 'event_espresso')
175
+				),
176
+				'ATT_short_bio' => $model_field_factory->createSimpleHtmlField(
177
+					'post_excerpt',
178
+					esc_html__('Attendee Short Biography', 'event_espresso'),
179
+					true,
180
+					esc_html__('No Biography Provided', 'event_espresso')
181
+				),
182
+				'ATT_modified'  => $model_field_factory->createDatetimeField(
183
+					'post_modified',
184
+					esc_html__('Time Attendee Last Modified', 'event_espresso')
185
+				),
186
+				'ATT_author'    => $model_field_factory->createWpUserField(
187
+					'post_author',
188
+					esc_html__('Creator ID of the first Event attended', 'event_espresso'),
189
+					false
190
+				),
191
+				'ATT_parent'    => $model_field_factory->createDbOnlyIntField(
192
+					'post_parent',
193
+					esc_html__('Parent Attendee (unused)', 'event_espresso'),
194
+					false,
195
+					0
196
+				),
197
+				'post_type'     => $model_field_factory->createWpPostTypeField('espresso_attendees'),
198
+				'status'        => $model_field_factory->createWpPostStatusField(
199
+					'post_status',
200
+					esc_html__('Attendee Status', 'event_espresso'),
201
+					false,
202
+					'publish'
203
+				),
204
+				'password' => new EE_Password_Field(
205
+					'post_password',
206
+					esc_html__('Password', 'event_espresso'),
207
+					false,
208
+					'',
209
+					array(
210
+						'ATT_bio',
211
+						'ATT_short_bio',
212
+						'ATT_address',
213
+						'ATT_address2',
214
+						'ATT_city',
215
+						'STA_ID',
216
+						'CNT_ISO',
217
+						'ATT_zip',
218
+						'ATT_email',
219
+						'ATT_phone'
220
+					)
221
+				)
222
+			),
223
+			'Attendee_Meta' => array(
224
+				'ATTM_ID'      => $model_field_factory->createDbOnlyIntField(
225
+					'ATTM_ID',
226
+					esc_html__('Attendee Meta Row ID', 'event_espresso'),
227
+					false
228
+				),
229
+				'ATT_ID_fk'    => $model_field_factory->createDbOnlyIntField(
230
+					'ATT_ID',
231
+					esc_html__('Foreign Key to Attendee in Post Table', 'event_espresso'),
232
+					false
233
+				),
234
+				'ATT_fname'    => $model_field_factory->createPlainTextField(
235
+					'ATT_fname',
236
+					esc_html__('First Name', 'event_espresso')
237
+				),
238
+				'ATT_lname'    => $model_field_factory->createPlainTextField(
239
+					'ATT_lname',
240
+					esc_html__('Last Name', 'event_espresso')
241
+				),
242
+				'ATT_address'  => $model_field_factory->createPlainTextField(
243
+					'ATT_address',
244
+					esc_html__('Address Part 1', 'event_espresso')
245
+				),
246
+				'ATT_address2' => $model_field_factory->createPlainTextField(
247
+					'ATT_address2',
248
+					esc_html__('Address Part 2', 'event_espresso')
249
+				),
250
+				'ATT_city'     => $model_field_factory->createPlainTextField(
251
+					'ATT_city',
252
+					esc_html__('City', 'event_espresso')
253
+				),
254
+				'STA_ID'       => $model_field_factory->createForeignKeyIntField(
255
+					'STA_ID',
256
+					esc_html__('State', 'event_espresso'),
257
+					true,
258
+					0,
259
+					'State'
260
+				),
261
+				'CNT_ISO'      => $model_field_factory->createForeignKeyStringField(
262
+					'CNT_ISO',
263
+					esc_html__('Country', 'event_espresso'),
264
+					true,
265
+					'',
266
+					'Country'
267
+				),
268
+				'ATT_zip'      => $model_field_factory->createPlainTextField(
269
+					'ATT_zip',
270
+					esc_html__('ZIP/Postal Code', 'event_espresso')
271
+				),
272
+				'ATT_email'    => $model_field_factory->createEmailField(
273
+					'ATT_email',
274
+					esc_html__('Email Address', 'event_espresso')
275
+				),
276
+				'ATT_phone'    => $model_field_factory->createPlainTextField(
277
+					'ATT_phone',
278
+					esc_html__('Phone', 'event_espresso')
279
+				),
280
+			),
281
+		);
282
+		$this->_model_relations = array(
283
+			'Registration'      => new EE_Has_Many_Relation(),
284
+			'State'             => new EE_Belongs_To_Relation(),
285
+			'Country'           => new EE_Belongs_To_Relation(),
286
+			'Event'             => new EE_HABTM_Relation('Registration', false),
287
+			'WP_User'           => new EE_Belongs_To_Relation(),
288
+			'Message'           => new EE_Has_Many_Any_Relation(false),
289
+			// allow deletion of attendees even if they have messages in the queue for them.
290
+			'Term_Relationship' => new EE_Has_Many_Relation(),
291
+			'Term_Taxonomy'     => new EE_HABTM_Relation('Term_Relationship'),
292
+		);
293
+		$this->_caps_slug = 'contacts';
294
+		$this->model_chain_to_password = '';
295
+		parent::__construct($timezone);
296
+	}
297
+
298
+
299
+
300
+	/**
301
+	 * Gets the name of the field on the attendee model corresponding to the system question string
302
+	 * which should be one of the keys from EEM_Attendee::_system_question_to_attendee_field_name
303
+	 *
304
+	 * @param string $system_question_string
305
+	 * @return string|null if not found
306
+	 */
307
+	public function get_attendee_field_for_system_question($system_question_string)
308
+	{
309
+		return isset($this->_system_question_to_attendee_field_name[ $system_question_string ])
310
+			? $this->_system_question_to_attendee_field_name[ $system_question_string ]
311
+			: null;
312
+	}
313
+
314
+
315
+
316
+	/**
317
+	 * Gets mapping from esp_question.QST_system values to their corresponding attendee field names
318
+	 *
319
+	 * @return array
320
+	 */
321
+	public function system_question_to_attendee_field_mapping()
322
+	{
323
+		return $this->_system_question_to_attendee_field_name;
324
+	}
325
+
326
+
327
+
328
+	/**
329
+	 * Gets all the attendees for a transaction (by using the esp_registration as a join table)
330
+	 *
331
+	 * @param EE_Transaction /int $transaction_id_or_obj EE_Transaction or its ID
332
+	 * @return EE_Attendee[]|EE_Base_Class[]
333
+	 * @throws EE_Error
334
+	 */
335
+	public function get_attendees_for_transaction($transaction_id_or_obj)
336
+	{
337
+		return $this->get_all(
338
+			array(
339
+				array(
340
+					'Registration.Transaction.TXN_ID' => $transaction_id_or_obj instanceof EE_Transaction
341
+						? $transaction_id_or_obj->ID()
342
+						: $transaction_id_or_obj,
343
+				),
344
+			)
345
+		);
346
+	}
347
+
348
+
349
+
350
+	/**
351
+	 * retrieve  a single attendee from db via their ID
352
+	 *
353
+	 * @param $ATT_ID
354
+	 * @return mixed array on success, FALSE on fail
355
+	 * @deprecated
356
+	 */
357
+	public function get_attendee_by_ID($ATT_ID = false)
358
+	{
359
+		// retrieve a particular EE_Attendee
360
+		return $this->get_one_by_ID($ATT_ID);
361
+	}
362
+
363
+
364
+
365
+	/**
366
+	 * retrieve  a single attendee from db via their ID
367
+	 *
368
+	 * @param array $where_cols_n_values
369
+	 * @return mixed array on success, FALSE on fail
370
+	 * @throws EE_Error
371
+	 */
372
+	public function get_attendee($where_cols_n_values = array())
373
+	{
374
+		if (empty($where_cols_n_values)) {
375
+			return false;
376
+		}
377
+		$attendee = $this->get_all(array($where_cols_n_values));
378
+		if (! empty($attendee)) {
379
+			return array_shift($attendee);
380
+		}
381
+		return false;
382
+	}
383
+
384
+
385
+
386
+	/**
387
+	 * Search for an existing Attendee record in the DB
388
+	 *
389
+	 * @param array $where_cols_n_values
390
+	 * @return bool|mixed
391
+	 * @throws EE_Error
392
+	 */
393
+	public function find_existing_attendee($where_cols_n_values = null)
394
+	{
395
+		// search by combo of first and last names plus the email address
396
+		$attendee_data_keys = array(
397
+			'ATT_fname' => $this->_ATT_fname,
398
+			'ATT_lname' => $this->_ATT_lname,
399
+			'ATT_email' => $this->_ATT_email,
400
+		);
401
+		// no search params means attendee object already exists.
402
+		$where_cols_n_values = is_array($where_cols_n_values) && ! empty($where_cols_n_values)
403
+			? $where_cols_n_values
404
+			: $attendee_data_keys;
405
+		$valid_data = true;
406
+		// check for required values
407
+		$valid_data = isset($where_cols_n_values['ATT_fname']) && ! empty($where_cols_n_values['ATT_fname'])
408
+			? $valid_data
409
+			: false;
410
+		$valid_data = isset($where_cols_n_values['ATT_lname']) && ! empty($where_cols_n_values['ATT_lname'])
411
+			? $valid_data
412
+			: false;
413
+		$valid_data = isset($where_cols_n_values['ATT_email']) && ! empty($where_cols_n_values['ATT_email'])
414
+			? $valid_data
415
+			: false;
416
+		if ($valid_data) {
417
+			$attendee = $this->get_attendee($where_cols_n_values);
418
+			if ($attendee instanceof EE_Attendee) {
419
+				return $attendee;
420
+			}
421
+		}
422
+		return false;
423
+	}
424
+
425
+
426
+
427
+	/**
428
+	 * Takes an incoming array of EE_Registration ids
429
+	 * and sends back a list of corresponding non duplicate EE_Attendee objects.
430
+	 *
431
+	 * @since  4.3.0
432
+	 * @param  array $ids array of EE_Registration ids
433
+	 * @return EE_Attendee[]|EE_Base_Class[]
434
+	 * @throws EE_Error
435
+	 */
436
+	public function get_array_of_contacts_from_reg_ids($ids)
437
+	{
438
+		$ids = (array) $ids;
439
+		$_where = array(
440
+			'Registration.REG_ID' => array('in', $ids),
441
+		);
442
+		return $this->get_all(array($_where));
443
+	}
444 444
 }
Please login to merge, or discard this patch.
core/db_models/EEM_Post_Meta.model.php 2 patches
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -59,11 +59,11 @@
 block discarded – undo
59 59
         );
60 60
         $this->_model_relations = array();
61 61
         foreach ($models_this_can_attach_to as $model) {
62
-            $this->_model_relations[ $model ] = new EE_Belongs_To_Relation();
62
+            $this->_model_relations[$model] = new EE_Belongs_To_Relation();
63 63
         }
64 64
         $this->_wp_core_model = true;
65 65
         foreach ($this->cap_contexts_to_cap_action_map() as $cap_context => $action) {
66
-            $this->_cap_restriction_generators[ $cap_context ] = new EE_Restriction_Generator_Meta(
66
+            $this->_cap_restriction_generators[$cap_context] = new EE_Restriction_Generator_Meta(
67 67
                 'meta_key',
68 68
                 'meta_value'
69 69
             );
Please login to merge, or discard this patch.
Indentation   +49 added lines, -49 removed lines patch added patch discarded remove patch
@@ -19,56 +19,56 @@
 block discarded – undo
19 19
 class EEM_Post_Meta extends EEM_Base
20 20
 {
21 21
 
22
-    // private instance of the EE_Post_Meta object
23
-    protected static $_instance = null;
22
+	// private instance of the EE_Post_Meta object
23
+	protected static $_instance = null;
24 24
 
25 25
 
26 26
 
27
-    protected function __construct($timezone = null)
28
-    {
29
-        $this->singular_item = esc_html__('Post Meta', 'event_espresso');
30
-        $this->plural_item = esc_html__('Post Metas', 'event_espresso');
31
-        $this->_tables = array(
32
-            'Post_Meta' => new EE_Primary_Table('postmeta', 'meta_id'),
33
-        );
34
-        $models_this_can_attach_to = array_keys(EE_Registry::instance()->cpt_models());
35
-        $this->_fields = array(
36
-            'Post_Meta' => array(
37
-                'meta_id'    => new EE_Primary_Key_Int_Field(
38
-                    'meta_id',
39
-                    esc_html__("Meta ID", "event_espresso")
40
-                ),
41
-                'post_id'    => new EE_Foreign_Key_Int_Field(
42
-                    'post_id',
43
-                    esc_html__("Primary Key of Post", "event_espresso"),
44
-                    false,
45
-                    0,
46
-                    $models_this_can_attach_to
47
-                ),
48
-                'meta_key'   => new EE_Plain_Text_Field(
49
-                    'meta_key',
50
-                    esc_html__("Meta Key", "event_espresso"),
51
-                    false,
52
-                    ''
53
-                ),
54
-                'meta_value' => new EE_Maybe_Serialized_Text_Field(
55
-                    'meta_value',
56
-                    esc_html__("Meta Value", "event_espresso"),
57
-                    true
58
-                ),
59
-            ),
60
-        );
61
-        $this->_model_relations = array();
62
-        foreach ($models_this_can_attach_to as $model) {
63
-            $this->_model_relations[ $model ] = new EE_Belongs_To_Relation();
64
-        }
65
-        $this->_wp_core_model = true;
66
-        foreach ($this->cap_contexts_to_cap_action_map() as $cap_context => $action) {
67
-            $this->_cap_restriction_generators[ $cap_context ] = new EE_Restriction_Generator_Meta(
68
-                'meta_key',
69
-                'meta_value'
70
-            );
71
-        }
72
-        parent::__construct($timezone);
73
-    }
27
+	protected function __construct($timezone = null)
28
+	{
29
+		$this->singular_item = esc_html__('Post Meta', 'event_espresso');
30
+		$this->plural_item = esc_html__('Post Metas', 'event_espresso');
31
+		$this->_tables = array(
32
+			'Post_Meta' => new EE_Primary_Table('postmeta', 'meta_id'),
33
+		);
34
+		$models_this_can_attach_to = array_keys(EE_Registry::instance()->cpt_models());
35
+		$this->_fields = array(
36
+			'Post_Meta' => array(
37
+				'meta_id'    => new EE_Primary_Key_Int_Field(
38
+					'meta_id',
39
+					esc_html__("Meta ID", "event_espresso")
40
+				),
41
+				'post_id'    => new EE_Foreign_Key_Int_Field(
42
+					'post_id',
43
+					esc_html__("Primary Key of Post", "event_espresso"),
44
+					false,
45
+					0,
46
+					$models_this_can_attach_to
47
+				),
48
+				'meta_key'   => new EE_Plain_Text_Field(
49
+					'meta_key',
50
+					esc_html__("Meta Key", "event_espresso"),
51
+					false,
52
+					''
53
+				),
54
+				'meta_value' => new EE_Maybe_Serialized_Text_Field(
55
+					'meta_value',
56
+					esc_html__("Meta Value", "event_espresso"),
57
+					true
58
+				),
59
+			),
60
+		);
61
+		$this->_model_relations = array();
62
+		foreach ($models_this_can_attach_to as $model) {
63
+			$this->_model_relations[ $model ] = new EE_Belongs_To_Relation();
64
+		}
65
+		$this->_wp_core_model = true;
66
+		foreach ($this->cap_contexts_to_cap_action_map() as $cap_context => $action) {
67
+			$this->_cap_restriction_generators[ $cap_context ] = new EE_Restriction_Generator_Meta(
68
+				'meta_key',
69
+				'meta_value'
70
+			);
71
+		}
72
+		parent::__construct($timezone);
73
+	}
74 74
 }
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_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.