Completed
Branch RELEASE (416965)
by
unknown
11:06 queued 12s
created
sensitive_data_removal/EE_Sensitive_Data_Removal_Base.strategy.php 1 patch
Indentation   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -11,16 +11,16 @@
 block discarded – undo
11 11
  */
12 12
 abstract class EE_Sensitive_Data_Removal_Base extends EE_Form_Input_Strategy_Base
13 13
 {
14
-    /**
15
-     * Removes all the sensitive data from this normalized value.
16
-     * For example, should could 'mask' a credit card from
17
-     * '1234 1234 1234 1234' TO '**** **** **** 1234'.
18
-     * Or turn a ccv number from
19
-     * '123' to '***',
20
-     * or turn a password from
21
-     * 'CantHac7Th15' to '*************',
22
-     * or just leave htevalue as-is
23
-     * @return mixed
24
-     */
25
-    abstract public function remove_sensitive_data($normalized_value);
14
+	/**
15
+	 * Removes all the sensitive data from this normalized value.
16
+	 * For example, should could 'mask' a credit card from
17
+	 * '1234 1234 1234 1234' TO '**** **** **** 1234'.
18
+	 * Or turn a ccv number from
19
+	 * '123' to '***',
20
+	 * or turn a password from
21
+	 * 'CantHac7Th15' to '*************',
22
+	 * or just leave htevalue as-is
23
+	 * @return mixed
24
+	 */
25
+	abstract public function remove_sensitive_data($normalized_value);
26 26
 }
Please login to merge, or discard this patch.
sensitive_data_removal/EE_All_Sensitive_Data_Removal.strategy.php 1 patch
Indentation   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -11,23 +11,23 @@
 block discarded – undo
11 11
  */
12 12
 class EE_All_Sensitive_Data_Removal extends EE_Sensitive_Data_Removal_Base
13 13
 {
14
-    public function remove_sensitive_data($normalized_value)
15
-    {
16
-        switch (gettype($normalized_value)) {
17
-            case "boolean":
18
-                return false;
19
-            case "integer":
20
-            case "double":
21
-                return 0;
22
-            case "string":
23
-                return '';
24
-            case "array":
25
-                return array();
26
-            case "object":
27
-            case "resource":
28
-            case "NULL":
29
-            default:
30
-                return null;
31
-        }
32
-    }
14
+	public function remove_sensitive_data($normalized_value)
15
+	{
16
+		switch (gettype($normalized_value)) {
17
+			case "boolean":
18
+				return false;
19
+			case "integer":
20
+			case "double":
21
+				return 0;
22
+			case "string":
23
+				return '';
24
+			case "array":
25
+				return array();
26
+			case "object":
27
+			case "resource":
28
+			case "NULL":
29
+			default:
30
+				return null;
31
+		}
32
+	}
33 33
 }
Please login to merge, or discard this patch.
strategies/sensitive_data_removal/EE_No_Sensitive_Data_Removal.strategy.php 1 patch
Indentation   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -11,8 +11,8 @@
 block discarded – undo
11 11
  */
12 12
 class EE_No_Sensitive_Data_Removal extends EE_Sensitive_Data_Removal_Base
13 13
 {
14
-    public function remove_sensitive_data($normalized_value)
15
-    {
16
-        return $normalized_value;
17
-    }
14
+	public function remove_sensitive_data($normalized_value)
15
+	{
16
+		return $normalized_value;
17
+	}
18 18
 }
Please login to merge, or discard this patch.
libraries/form_sections/base/EE_Form_Section_HTML_From_Template.form.php 1 patch
Indentation   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -11,11 +11,11 @@
 block discarded – undo
11 11
  */
12 12
 class EE_Form_Section_HTML_From_Template extends EE_Form_Section_HTML
13 13
 {
14
-    public function __construct($template_file, $args = array(), $options_array = array())
15
-    {
16
-        $html = EEH_Template::locate_template($template_file, $args);
14
+	public function __construct($template_file, $args = array(), $options_array = array())
15
+	{
16
+		$html = EEH_Template::locate_template($template_file, $args);
17 17
 
18 18
 //      echo " filepath:$template_file html $html";
19
-        parent::__construct($html, $options_array);
20
-    }
19
+		parent::__construct($html, $options_array);
20
+	}
21 21
 }
Please login to merge, or discard this patch.
core/libraries/form_sections/payment_methods/EE_Billing_Info_Form.form.php 2 patches
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -81,7 +81,7 @@
 block discarded – undo
81 81
      */
82 82
     public function html_class()
83 83
     {
84
-        return ! empty($this->_html_class) ? $this->_html_class . ' ee-billing-form' : 'ee-billing-form';
84
+        return ! empty($this->_html_class) ? $this->_html_class.' ee-billing-form' : 'ee-billing-form';
85 85
     }
86 86
 }
87 87
 // End of file EE_Billing_Info_Form.form.php
Please login to merge, or discard this patch.
Indentation   +56 added lines, -56 removed lines patch added patch discarded remove patch
@@ -14,75 +14,75 @@
 block discarded – undo
14 14
  */
15 15
 class EE_Billing_Info_Form extends EE_Form_Section_Proper
16 16
 {
17
-    /**
18
-     * The payment method this billing form is for
19
-     * @var EE_Payment_Method
20
-     */
21
-    protected $_pm_instance;
17
+	/**
18
+	 * The payment method this billing form is for
19
+	 * @var EE_Payment_Method
20
+	 */
21
+	protected $_pm_instance;
22 22
 
23 23
 
24
-    /**
25
-     *
26
-     * @param EE_Payment_Method $payment_method
27
-     * @param array             $options_array @see EE_Form_Section_Proper::__construct()
28
-     * @throws EE_Error
29
-     */
30
-    public function __construct(EE_Payment_Method $payment_method, $options_array = array())
31
-    {
32
-        $this->_pm_instance = $payment_method;
33
-        $this->_layout_strategy = new EE_Div_Per_Section_Layout();
34
-        parent::__construct($options_array);
35
-    }
24
+	/**
25
+	 *
26
+	 * @param EE_Payment_Method $payment_method
27
+	 * @param array             $options_array @see EE_Form_Section_Proper::__construct()
28
+	 * @throws EE_Error
29
+	 */
30
+	public function __construct(EE_Payment_Method $payment_method, $options_array = array())
31
+	{
32
+		$this->_pm_instance = $payment_method;
33
+		$this->_layout_strategy = new EE_Div_Per_Section_Layout();
34
+		parent::__construct($options_array);
35
+	}
36 36
 
37 37
 
38 38
 
39
-    /**
40
-     * Sets the payment method for this billing form
41
-     * @param EE_Payment_Method $payment_method
42
-     * @return void
43
-     */
44
-    public function set_payment_method($payment_method)
45
-    {
46
-        $this->_pm_instance = $payment_method;
47
-    }
39
+	/**
40
+	 * Sets the payment method for this billing form
41
+	 * @param EE_Payment_Method $payment_method
42
+	 * @return void
43
+	 */
44
+	public function set_payment_method($payment_method)
45
+	{
46
+		$this->_pm_instance = $payment_method;
47
+	}
48 48
 
49 49
 
50 50
 
51
-    /**
52
-     * Returns the instance of the payment method this billing form is for
53
-     * @return EE_Payment_Method
54
-     */
55
-    public function payment_method()
56
-    {
57
-        return $this->_pm_instance;
58
-    }
51
+	/**
52
+	 * Returns the instance of the payment method this billing form is for
53
+	 * @return EE_Payment_Method
54
+	 */
55
+	public function payment_method()
56
+	{
57
+		return $this->_pm_instance;
58
+	}
59 59
 
60 60
 
61 61
 
62
-    /**
63
-     * payment_fields_autofilled_notice_html
64
-     *
65
-     * @return EE_Form_Section_HTML
66
-     */
67
-    public function payment_fields_autofilled_notice_html()
68
-    {
69
-        return  new EE_Form_Section_HTML(
70
-            EEH_HTML::p(
71
-                apply_filters('FHEE__EE_Billing_Info_Form__payment_fields_autofilled_notice_html_text', esc_html__('Payment fields have been autofilled because you are in debug mode', 'event_espresso')),
72
-                '',
73
-                'important-notice'
74
-            )
75
-        );
76
-    }
62
+	/**
63
+	 * payment_fields_autofilled_notice_html
64
+	 *
65
+	 * @return EE_Form_Section_HTML
66
+	 */
67
+	public function payment_fields_autofilled_notice_html()
68
+	{
69
+		return  new EE_Form_Section_HTML(
70
+			EEH_HTML::p(
71
+				apply_filters('FHEE__EE_Billing_Info_Form__payment_fields_autofilled_notice_html_text', esc_html__('Payment fields have been autofilled because you are in debug mode', 'event_espresso')),
72
+				'',
73
+				'important-notice'
74
+			)
75
+		);
76
+	}
77 77
 
78 78
 
79 79
 
80
-    /**
81
-     * @return string
82
-     */
83
-    public function html_class()
84
-    {
85
-        return ! empty($this->_html_class) ? $this->_html_class . ' ee-billing-form' : 'ee-billing-form';
86
-    }
80
+	/**
81
+	 * @return string
82
+	 */
83
+	public function html_class()
84
+	{
85
+		return ! empty($this->_html_class) ? $this->_html_class . ' ee-billing-form' : 'ee-billing-form';
86
+	}
87 87
 }
88 88
 // End of file EE_Billing_Info_Form.form.php
Please login to merge, or discard this patch.
core/libraries/form_sections/helpers/EE_Validation_Error.error.php 1 patch
Indentation   +41 added lines, -41 removed lines patch added patch discarded remove patch
@@ -2,47 +2,47 @@
 block discarded – undo
2 2
 
3 3
 class EE_Validation_Error extends Exception
4 4
 {
5
-    /**
6
-     * Form Section from which this error originated.
7
-     * @var EE_Form_Section
8
-     */
9
-    protected $_form_section;
10
-    /**
11
-     * a short string for uniquely identifying the error, which isn't internationalized and
12
-     * machines can use to identify the error
13
-     * @var string
14
-     */
15
-    protected $_string_code;
5
+	/**
6
+	 * Form Section from which this error originated.
7
+	 * @var EE_Form_Section
8
+	 */
9
+	protected $_form_section;
10
+	/**
11
+	 * a short string for uniquely identifying the error, which isn't internationalized and
12
+	 * machines can use to identify the error
13
+	 * @var string
14
+	 */
15
+	protected $_string_code;
16 16
 
17
-    /**
18
-     * When creating a validation error, we need to know which field the error relates to.
19
-     * @param string $message message you want to display about this error
20
-     * @param string $string_code a code for uniquely identifying the exception
21
-     * @param EE_Form_Section_Validatable $form_section
22
-     * @param Exception $previous if there was an exception that caused this exception
23
-     */
24
-    public function __construct($message = null, $string_code = null, $form_section = null, $previous = null)
25
-    {
26
-        $this->_form_section = $form_section;
27
-        $this->_string_code = $string_code;
28
-        parent::__construct($message, 500, $previous);
29
-    }
17
+	/**
18
+	 * When creating a validation error, we need to know which field the error relates to.
19
+	 * @param string $message message you want to display about this error
20
+	 * @param string $string_code a code for uniquely identifying the exception
21
+	 * @param EE_Form_Section_Validatable $form_section
22
+	 * @param Exception $previous if there was an exception that caused this exception
23
+	 */
24
+	public function __construct($message = null, $string_code = null, $form_section = null, $previous = null)
25
+	{
26
+		$this->_form_section = $form_section;
27
+		$this->_string_code = $string_code;
28
+		parent::__construct($message, 500, $previous);
29
+	}
30 30
 
31
-    /**
32
-     * returns teh form section which caused the error.
33
-     * @return EE_Form_Section_Validatable
34
-     */
35
-    public function get_form_section()
36
-    {
37
-        return $this->_form_section;
38
-    }
39
-    /**
40
-     * Sets teh form seciton of the error, in case it wasnt set previously
41
-     * @param EE_Form_Section_Validatable $form_section
42
-     * @return void
43
-     */
44
-    public function set_form_section($form_section)
45
-    {
46
-        $this->_form_section = $form_section;
47
-    }
31
+	/**
32
+	 * returns teh form section which caused the error.
33
+	 * @return EE_Form_Section_Validatable
34
+	 */
35
+	public function get_form_section()
36
+	{
37
+		return $this->_form_section;
38
+	}
39
+	/**
40
+	 * Sets teh form seciton of the error, in case it wasnt set previously
41
+	 * @param EE_Form_Section_Validatable $form_section
42
+	 * @return void
43
+	 */
44
+	public function set_form_section($form_section)
45
+	{
46
+		$this->_form_section = $form_section;
47
+	}
48 48
 }
Please login to merge, or discard this patch.
line_item_display/EE_Invoice_Line_Item_Display_Strategy.strategy.php 2 patches
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -108,7 +108,7 @@  discard block
 block discarded – undo
108 108
         // price td
109 109
         $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c');
110 110
         // total td
111
-        $total = $line_item->is_taxable() ? $line_item->total_no_code() . '*' : $line_item->total_no_code();
111
+        $total = $line_item->is_taxable() ? $line_item->total_no_code().'*' : $line_item->total_no_code();
112 112
         $html .= EEH_HTML::td($total, '', 'item_r');
113 113
         // end of row
114 114
         $html .= EEH_HTML::trx();
@@ -132,10 +132,10 @@  discard block
 block discarded – undo
132 132
         $html .= EEH_HTML::td($line_item->name(), '', 'item_l sub-item');
133 133
         // desc td
134 134
         $html .= $options['show_desc'] ? EEH_HTML::td($line_item->desc(), '', 'item_l') : '';
135
-        $html .= EEH_HTML::td() . EEH_HTML::tdx();
135
+        $html .= EEH_HTML::td().EEH_HTML::tdx();
136 136
         // discount/surcharge td
137 137
         if ($line_item->is_percent()) {
138
-            $html .= EEH_HTML::td($line_item->percent() . '%', '', 'item_c');
138
+            $html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c');
139 139
         } else {
140 140
             $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c');
141 141
         }
@@ -164,7 +164,7 @@  discard block
 block discarded – undo
164 164
         // desc td
165 165
         $html .= $options['show_desc'] ? EEH_HTML::td($line_item->desc(), '', 'item_l') : '';
166 166
         // percent td
167
-        $html .= EEH_HTML::td($line_item->percent() . '%', '', 'item_c', '', ' colspan="2"');
167
+        $html .= EEH_HTML::td($line_item->percent().'%', '', 'item_c', '', ' colspan="2"');
168 168
         // total td
169 169
         $html .= EEH_HTML::td($line_item->total_no_code(), '', 'item_r');
170 170
         // end of row
Please login to merge, or discard this patch.
Indentation   +212 added lines, -212 removed lines patch added patch discarded remove patch
@@ -1,222 +1,222 @@
 block discarded – undo
1 1
 <?php
2 2
 
3 3
  /**
4
- *
5
- * Class EE_Invoice_Line_Item_Display_Strategy
6
- *
7
- * Description
8
- *
9
- * @package         Event Espresso
10
- * @subpackage    core
11
- * @author              Brent Christensen
12
- *
13
- *
14
- */
4
+  *
5
+  * Class EE_Invoice_Line_Item_Display_Strategy
6
+  *
7
+  * Description
8
+  *
9
+  * @package         Event Espresso
10
+  * @subpackage    core
11
+  * @author              Brent Christensen
12
+  *
13
+  *
14
+  */
15 15
 class EE_Invoice_Line_Item_Display_Strategy implements EEI_Line_Item_Display
16 16
 {
17
-    /**
18
-     * @param EE_Line_Item $line_item
19
-     * @param array        $options
20
-     * @return mixed
21
-     */
22
-    public function display_line_item($line_item, $options = array())
23
-    {
24
-
25
-        $html = '';
26
-        // set some default options and merge with incoming
27
-        $default_options = array(
28
-            'show_desc' => true,
29
-            'odd' => false
30
-        );
31
-        $options = array_merge($default_options, (array) $options);
32
-
33
-        switch ($line_item->type()) {
34
-            case EEM_Line_Item::type_total:
35
-                // loop thru children
36
-                foreach ($line_item->children() as $child_line_item) {
37
-                    // recursively feed children back into this method
38
-                    $html .= $this->display_line_item($child_line_item, $options);
39
-                }
40
-                $html .= $this->_separator_row($options);
41
-                $html .= $this->_total_row($line_item, esc_html__('Total', 'event_espresso'), $options);
42
-                break;
43
-
44
-
45
-            case EEM_Line_Item::type_sub_total:
46
-                // loop thru children
47
-                foreach ($line_item->children() as $child_line_item) {
48
-                    // recursively feed children back into this method
49
-                    $html .= $this->display_line_item($child_line_item, $options);
50
-                }
51
-                $html .= $this->_total_row($line_item, esc_html__('Sub-Total', 'event_espresso'), $options);
52
-                break;
53
-
54
-
55
-            case EEM_Line_Item::type_tax_sub_total:
56
-                // loop thru children
57
-                foreach ($line_item->children() as $child_line_item) {
58
-                    // recursively feed children back into this method
59
-                    $html .= $this->display_line_item($child_line_item, $options);
60
-                }
61
-                $html .= $this->_total_row($line_item, esc_html__('Tax Total', 'event_espresso'), $options);
62
-                break;
63
-
64
-
65
-            case EEM_Line_Item::type_line_item:
66
-                // item row
67
-                $html .= $this->_item_row($line_item, $options);
68
-                // got any kids?
69
-                foreach ($line_item->children() as $child_line_item) {
70
-                    $this->display_line_item($child_line_item, $options);
71
-                }
72
-                break;
73
-
74
-
75
-            case EEM_Line_Item::type_sub_line_item:
76
-                $html .= $this->_sub_item_row($line_item, $options);
77
-                break;
78
-
79
-
80
-            case EEM_Line_Item::type_tax:
81
-                $html .= $this->_tax_row($line_item, $options);
82
-                break;
83
-        }
84
-
85
-        return $html;
86
-    }
87
-
88
-
89
-
90
-    /**
91
-     *  _total_row
92
-     *
93
-     * @param EE_Line_Item $line_item
94
-     * @param array        $options
95
-     * @return mixed
96
-     */
97
-    private function _item_row(EE_Line_Item $line_item, $options = array())
98
-    {
99
-        // start of row
100
-        $row_class = $options['odd'] ? 'item odd' : 'item';
101
-        $html = EEH_HTML::tr('', $row_class);
102
-        // name td
103
-        $html .= EEH_HTML::td($line_item->name(), '', 'item_l');
104
-        // desc td
105
-        $html .= $options['show_desc'] ? EEH_HTML::td($line_item->desc(), '', 'item_l') : '';
106
-        // quantity td
107
-        $html .= EEH_HTML::td($line_item->quantity(), '', 'item_l');
108
-        // price td
109
-        $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c');
110
-        // total td
111
-        $total = $line_item->is_taxable() ? $line_item->total_no_code() . '*' : $line_item->total_no_code();
112
-        $html .= EEH_HTML::td($total, '', 'item_r');
113
-        // end of row
114
-        $html .= EEH_HTML::trx();
115
-        return $html;
116
-    }
117
-
118
-
119
-
120
-    /**
121
-     *  _sub_item_row
122
-     *
123
-     * @param EE_Line_Item $line_item
124
-     * @param array        $options
125
-     * @return mixed
126
-     */
127
-    private function _sub_item_row(EE_Line_Item $line_item, $options = array())
128
-    {
129
-        // start of row
130
-        $html = EEH_HTML::tr('', 'item sub-item-row');
131
-        // name td
132
-        $html .= EEH_HTML::td($line_item->name(), '', 'item_l sub-item');
133
-        // desc td
134
-        $html .= $options['show_desc'] ? EEH_HTML::td($line_item->desc(), '', 'item_l') : '';
135
-        $html .= EEH_HTML::td() . EEH_HTML::tdx();
136
-        // discount/surcharge td
137
-        if ($line_item->is_percent()) {
138
-            $html .= EEH_HTML::td($line_item->percent() . '%', '', 'item_c');
139
-        } else {
140
-            $html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c');
141
-        }
142
-        // total td
143
-        $html .= EEH_HTML::td($line_item->total_no_code(), '', 'item_r');
144
-        // end of row
145
-        $html .= EEH_HTML::trx();
146
-        return $html;
147
-    }
148
-
149
-
150
-
151
-    /**
152
-     *  _tax_row
153
-     *
154
-     * @param EE_Line_Item $line_item
155
-     * @param array        $options
156
-     * @return mixed
157
-     */
158
-    private function _tax_row(EE_Line_Item $line_item, $options = array())
159
-    {
160
-        // start of row
161
-        $html = EEH_HTML::tr('', 'item sub-item tax-total');
162
-        // name td
163
-        $html .= EEH_HTML::td($line_item->name(), '', 'item_l sub-item');
164
-        // desc td
165
-        $html .= $options['show_desc'] ? EEH_HTML::td($line_item->desc(), '', 'item_l') : '';
166
-        // percent td
167
-        $html .= EEH_HTML::td($line_item->percent() . '%', '', 'item_c', '', ' colspan="2"');
168
-        // total td
169
-        $html .= EEH_HTML::td($line_item->total_no_code(), '', 'item_r');
170
-        // end of row
171
-        $html .= EEH_HTML::trx();
172
-        return $html;
173
-    }
174
-
175
-
176
-
177
-    /**
178
-     *  _total_row
179
-     *
180
-     * @param EE_Line_Item $line_item
181
-     * @param string       $text
182
-     * @param array        $options
183
-     * @return mixed
184
-     */
185
-    private function _total_row(EE_Line_Item $line_item, $text = '', $options = array())
186
-    {
187
-        // colspan
188
-        $colspan = $options['show_desc'] ? ' colspan="2"' : '';
189
-        // start of row
190
-        $html = EEH_HTML::tr('', '', 'total_tr odd');
191
-        // empty td
192
-        $html .= EEH_HTML::td(EEH_HTML::nbsp(), '', '', '', $colspan);
193
-        // total td
194
-        $html .= EEH_HTML::td($text, '', 'total_currency total', '', $colspan);
195
-        // total td
196
-        $html .= EEH_HTML::td($line_item->total_no_code(), '', 'total');
197
-        // end of row
198
-        $html .= EEH_HTML::trx();
199
-        return $html;
200
-    }
201
-
202
-
203
-
204
-    /**
205
-     *  _separator_row
206
-     *
207
-     * @param array        $options
208
-     * @return mixed
209
-     */
210
-    private function _separator_row($options = array())
211
-    {
212
-        // colspan
213
-        $colspan = $options['show_desc'] ? ' colspan="5"' : ' colspan="4"';
214
-        // start of row
215
-        $html = EEH_HTML::tr(EEH_HTML::td('<hr>', '', '', '', $colspan));
17
+	/**
18
+	 * @param EE_Line_Item $line_item
19
+	 * @param array        $options
20
+	 * @return mixed
21
+	 */
22
+	public function display_line_item($line_item, $options = array())
23
+	{
24
+
25
+		$html = '';
26
+		// set some default options and merge with incoming
27
+		$default_options = array(
28
+			'show_desc' => true,
29
+			'odd' => false
30
+		);
31
+		$options = array_merge($default_options, (array) $options);
32
+
33
+		switch ($line_item->type()) {
34
+			case EEM_Line_Item::type_total:
35
+				// loop thru children
36
+				foreach ($line_item->children() as $child_line_item) {
37
+					// recursively feed children back into this method
38
+					$html .= $this->display_line_item($child_line_item, $options);
39
+				}
40
+				$html .= $this->_separator_row($options);
41
+				$html .= $this->_total_row($line_item, esc_html__('Total', 'event_espresso'), $options);
42
+				break;
43
+
44
+
45
+			case EEM_Line_Item::type_sub_total:
46
+				// loop thru children
47
+				foreach ($line_item->children() as $child_line_item) {
48
+					// recursively feed children back into this method
49
+					$html .= $this->display_line_item($child_line_item, $options);
50
+				}
51
+				$html .= $this->_total_row($line_item, esc_html__('Sub-Total', 'event_espresso'), $options);
52
+				break;
53
+
54
+
55
+			case EEM_Line_Item::type_tax_sub_total:
56
+				// loop thru children
57
+				foreach ($line_item->children() as $child_line_item) {
58
+					// recursively feed children back into this method
59
+					$html .= $this->display_line_item($child_line_item, $options);
60
+				}
61
+				$html .= $this->_total_row($line_item, esc_html__('Tax Total', 'event_espresso'), $options);
62
+				break;
63
+
64
+
65
+			case EEM_Line_Item::type_line_item:
66
+				// item row
67
+				$html .= $this->_item_row($line_item, $options);
68
+				// got any kids?
69
+				foreach ($line_item->children() as $child_line_item) {
70
+					$this->display_line_item($child_line_item, $options);
71
+				}
72
+				break;
73
+
74
+
75
+			case EEM_Line_Item::type_sub_line_item:
76
+				$html .= $this->_sub_item_row($line_item, $options);
77
+				break;
78
+
79
+
80
+			case EEM_Line_Item::type_tax:
81
+				$html .= $this->_tax_row($line_item, $options);
82
+				break;
83
+		}
84
+
85
+		return $html;
86
+	}
87
+
88
+
89
+
90
+	/**
91
+	 *  _total_row
92
+	 *
93
+	 * @param EE_Line_Item $line_item
94
+	 * @param array        $options
95
+	 * @return mixed
96
+	 */
97
+	private function _item_row(EE_Line_Item $line_item, $options = array())
98
+	{
99
+		// start of row
100
+		$row_class = $options['odd'] ? 'item odd' : 'item';
101
+		$html = EEH_HTML::tr('', $row_class);
102
+		// name td
103
+		$html .= EEH_HTML::td($line_item->name(), '', 'item_l');
104
+		// desc td
105
+		$html .= $options['show_desc'] ? EEH_HTML::td($line_item->desc(), '', 'item_l') : '';
106
+		// quantity td
107
+		$html .= EEH_HTML::td($line_item->quantity(), '', 'item_l');
108
+		// price td
109
+		$html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c');
110
+		// total td
111
+		$total = $line_item->is_taxable() ? $line_item->total_no_code() . '*' : $line_item->total_no_code();
112
+		$html .= EEH_HTML::td($total, '', 'item_r');
113
+		// end of row
114
+		$html .= EEH_HTML::trx();
115
+		return $html;
116
+	}
117
+
118
+
119
+
120
+	/**
121
+	 *  _sub_item_row
122
+	 *
123
+	 * @param EE_Line_Item $line_item
124
+	 * @param array        $options
125
+	 * @return mixed
126
+	 */
127
+	private function _sub_item_row(EE_Line_Item $line_item, $options = array())
128
+	{
129
+		// start of row
130
+		$html = EEH_HTML::tr('', 'item sub-item-row');
131
+		// name td
132
+		$html .= EEH_HTML::td($line_item->name(), '', 'item_l sub-item');
133
+		// desc td
134
+		$html .= $options['show_desc'] ? EEH_HTML::td($line_item->desc(), '', 'item_l') : '';
135
+		$html .= EEH_HTML::td() . EEH_HTML::tdx();
136
+		// discount/surcharge td
137
+		if ($line_item->is_percent()) {
138
+			$html .= EEH_HTML::td($line_item->percent() . '%', '', 'item_c');
139
+		} else {
140
+			$html .= EEH_HTML::td($line_item->unit_price_no_code(), '', 'item_c');
141
+		}
142
+		// total td
143
+		$html .= EEH_HTML::td($line_item->total_no_code(), '', 'item_r');
144
+		// end of row
145
+		$html .= EEH_HTML::trx();
146
+		return $html;
147
+	}
148
+
149
+
150
+
151
+	/**
152
+	 *  _tax_row
153
+	 *
154
+	 * @param EE_Line_Item $line_item
155
+	 * @param array        $options
156
+	 * @return mixed
157
+	 */
158
+	private function _tax_row(EE_Line_Item $line_item, $options = array())
159
+	{
160
+		// start of row
161
+		$html = EEH_HTML::tr('', 'item sub-item tax-total');
162
+		// name td
163
+		$html .= EEH_HTML::td($line_item->name(), '', 'item_l sub-item');
164
+		// desc td
165
+		$html .= $options['show_desc'] ? EEH_HTML::td($line_item->desc(), '', 'item_l') : '';
166
+		// percent td
167
+		$html .= EEH_HTML::td($line_item->percent() . '%', '', 'item_c', '', ' colspan="2"');
168
+		// total td
169
+		$html .= EEH_HTML::td($line_item->total_no_code(), '', 'item_r');
170
+		// end of row
171
+		$html .= EEH_HTML::trx();
172
+		return $html;
173
+	}
174
+
175
+
176
+
177
+	/**
178
+	 *  _total_row
179
+	 *
180
+	 * @param EE_Line_Item $line_item
181
+	 * @param string       $text
182
+	 * @param array        $options
183
+	 * @return mixed
184
+	 */
185
+	private function _total_row(EE_Line_Item $line_item, $text = '', $options = array())
186
+	{
187
+		// colspan
188
+		$colspan = $options['show_desc'] ? ' colspan="2"' : '';
189
+		// start of row
190
+		$html = EEH_HTML::tr('', '', 'total_tr odd');
191
+		// empty td
192
+		$html .= EEH_HTML::td(EEH_HTML::nbsp(), '', '', '', $colspan);
193
+		// total td
194
+		$html .= EEH_HTML::td($text, '', 'total_currency total', '', $colspan);
195
+		// total td
196
+		$html .= EEH_HTML::td($line_item->total_no_code(), '', 'total');
197
+		// end of row
198
+		$html .= EEH_HTML::trx();
199
+		return $html;
200
+	}
201
+
202
+
203
+
204
+	/**
205
+	 *  _separator_row
206
+	 *
207
+	 * @param array        $options
208
+	 * @return mixed
209
+	 */
210
+	private function _separator_row($options = array())
211
+	{
212
+		// colspan
213
+		$colspan = $options['show_desc'] ? ' colspan="5"' : ' colspan="4"';
214
+		// start of row
215
+		$html = EEH_HTML::tr(EEH_HTML::td('<hr>', '', '', '', $colspan));
216 216
 //      // separator td
217 217
 //      $html .= EEH_HTML::td( '<hr>', '',  '',  '',  $colspan );
218 218
 //      // end of row
219 219
 //      $html .= EEH_HTML::trx();
220
-        return $html;
221
-    }
220
+		return $html;
221
+	}
222 222
 }
Please login to merge, or discard this patch.
core/request_stack/EE_Response.core.php 2 patches
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
      */
72 72
     public function set_notice($key, $value)
73 73
     {
74
-        $this->_notice[ $key ] = $value;
74
+        $this->_notice[$key] = $value;
75 75
     }
76 76
 
77 77
 
@@ -82,7 +82,7 @@  discard block
 block discarded – undo
82 82
      */
83 83
     public function get_notice($key)
84 84
     {
85
-        return isset($this->_notice[ $key ]) ? $this->_notice[ $key ] : null;
85
+        return isset($this->_notice[$key]) ? $this->_notice[$key] : null;
86 86
     }
87 87
 
88 88
 
@@ -103,7 +103,7 @@  discard block
 block discarded – undo
103 103
      */
104 104
     public function add_output($string, $append = true)
105 105
     {
106
-        $this->_output = $append ? $this->_output . $string : $string . $this->_output;
106
+        $this->_output = $append ? $this->_output.$string : $string.$this->_output;
107 107
     }
108 108
 
109 109
 
Please login to merge, or discard this patch.
Indentation   +142 added lines, -142 removed lines patch added patch discarded remove patch
@@ -12,146 +12,146 @@
 block discarded – undo
12 12
  */
13 13
 class EE_Response
14 14
 {
15
-    /**
16
-     * @access    protected
17
-     * @type        array $_notice
18
-     */
19
-    protected $_notice = array();
20
-
21
-    /**
22
-     *    rendered output to be returned to WP
23
-     *
24
-     * @access    protected
25
-     * @type        string
26
-     */
27
-    protected $_output = '';
28
-
29
-    /**
30
-     * @access    protected
31
-     * @type        bool
32
-     */
33
-    protected $request_terminated = false;
34
-
35
-    /**
36
-     * @access    protected
37
-     * @type        bool
38
-     */
39
-    protected $deactivate_plugin = false;
40
-
41
-
42
-    /**
43
-     * @deprecated  4.9.53
44
-     * @return EE_Response
45
-     */
46
-    public function __construct()
47
-    {
48
-        $this->terminate_request(false);
49
-        EE_Error::doing_it_wrong(
50
-            __METHOD__,
51
-            sprintf(
52
-                esc_html__(
53
-                    'This class is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace',
54
-                    'event_espresso'
55
-                ),
56
-                'EventEspresso\core\services\request\Response',
57
-                '\core\services\request',
58
-                'EventEspresso\core\services\request'
59
-            ),
60
-            '4.9.53'
61
-        );
62
-    }
63
-
64
-
65
-    /**
66
-     * @deprecated  4.9.53
67
-     * @param $key
68
-     * @param $value
69
-     * @return    void
70
-     */
71
-    public function set_notice($key, $value)
72
-    {
73
-        $this->_notice[ $key ] = $value;
74
-    }
75
-
76
-
77
-    /**
78
-     * @deprecated  4.9.53
79
-     * @param $key
80
-     * @return    mixed
81
-     */
82
-    public function get_notice($key)
83
-    {
84
-        return isset($this->_notice[ $key ]) ? $this->_notice[ $key ] : null;
85
-    }
86
-
87
-
88
-    /**
89
-     * @deprecated  4.9.53
90
-     * @return    array
91
-     */
92
-    public function get_notices()
93
-    {
94
-        return $this->_notice;
95
-    }
96
-
97
-
98
-    /**
99
-     * @deprecated  4.9.53
100
-     * @param      $string
101
-     * @param bool $append
102
-     */
103
-    public function add_output($string, $append = true)
104
-    {
105
-        $this->_output = $append ? $this->_output . $string : $string . $this->_output;
106
-    }
107
-
108
-
109
-    /**
110
-     * @deprecated  4.9.53
111
-     * @return    string
112
-     */
113
-    public function get_output()
114
-    {
115
-        return $this->_output;
116
-    }
117
-
118
-
119
-    /**
120
-     * @deprecated  4.9.53
121
-     * @return boolean
122
-     */
123
-    public function request_terminated()
124
-    {
125
-        return $this->request_terminated;
126
-    }
127
-
128
-
129
-    /**
130
-     * @deprecated  4.9.53
131
-     * @param boolean $request_terminated
132
-     */
133
-    public function terminate_request($request_terminated = true)
134
-    {
135
-        $this->request_terminated = filter_var($request_terminated, FILTER_VALIDATE_BOOLEAN);
136
-    }
137
-
138
-
139
-    /**
140
-     * @deprecated  4.9.53
141
-     * @return boolean
142
-     */
143
-    public function plugin_deactivated()
144
-    {
145
-        return $this->deactivate_plugin;
146
-    }
147
-
148
-
149
-    /**
150
-     * @deprecated  4.9.53
151
-     * sets $deactivate_plugin to true
152
-     */
153
-    public function deactivate_plugin()
154
-    {
155
-        $this->deactivate_plugin = true;
156
-    }
15
+	/**
16
+	 * @access    protected
17
+	 * @type        array $_notice
18
+	 */
19
+	protected $_notice = array();
20
+
21
+	/**
22
+	 *    rendered output to be returned to WP
23
+	 *
24
+	 * @access    protected
25
+	 * @type        string
26
+	 */
27
+	protected $_output = '';
28
+
29
+	/**
30
+	 * @access    protected
31
+	 * @type        bool
32
+	 */
33
+	protected $request_terminated = false;
34
+
35
+	/**
36
+	 * @access    protected
37
+	 * @type        bool
38
+	 */
39
+	protected $deactivate_plugin = false;
40
+
41
+
42
+	/**
43
+	 * @deprecated  4.9.53
44
+	 * @return EE_Response
45
+	 */
46
+	public function __construct()
47
+	{
48
+		$this->terminate_request(false);
49
+		EE_Error::doing_it_wrong(
50
+			__METHOD__,
51
+			sprintf(
52
+				esc_html__(
53
+					'This class is deprecated. Please use %1$s instead. All Event Espresso request stack classes have been moved to %2$s and are now under the %3$s namespace',
54
+					'event_espresso'
55
+				),
56
+				'EventEspresso\core\services\request\Response',
57
+				'\core\services\request',
58
+				'EventEspresso\core\services\request'
59
+			),
60
+			'4.9.53'
61
+		);
62
+	}
63
+
64
+
65
+	/**
66
+	 * @deprecated  4.9.53
67
+	 * @param $key
68
+	 * @param $value
69
+	 * @return    void
70
+	 */
71
+	public function set_notice($key, $value)
72
+	{
73
+		$this->_notice[ $key ] = $value;
74
+	}
75
+
76
+
77
+	/**
78
+	 * @deprecated  4.9.53
79
+	 * @param $key
80
+	 * @return    mixed
81
+	 */
82
+	public function get_notice($key)
83
+	{
84
+		return isset($this->_notice[ $key ]) ? $this->_notice[ $key ] : null;
85
+	}
86
+
87
+
88
+	/**
89
+	 * @deprecated  4.9.53
90
+	 * @return    array
91
+	 */
92
+	public function get_notices()
93
+	{
94
+		return $this->_notice;
95
+	}
96
+
97
+
98
+	/**
99
+	 * @deprecated  4.9.53
100
+	 * @param      $string
101
+	 * @param bool $append
102
+	 */
103
+	public function add_output($string, $append = true)
104
+	{
105
+		$this->_output = $append ? $this->_output . $string : $string . $this->_output;
106
+	}
107
+
108
+
109
+	/**
110
+	 * @deprecated  4.9.53
111
+	 * @return    string
112
+	 */
113
+	public function get_output()
114
+	{
115
+		return $this->_output;
116
+	}
117
+
118
+
119
+	/**
120
+	 * @deprecated  4.9.53
121
+	 * @return boolean
122
+	 */
123
+	public function request_terminated()
124
+	{
125
+		return $this->request_terminated;
126
+	}
127
+
128
+
129
+	/**
130
+	 * @deprecated  4.9.53
131
+	 * @param boolean $request_terminated
132
+	 */
133
+	public function terminate_request($request_terminated = true)
134
+	{
135
+		$this->request_terminated = filter_var($request_terminated, FILTER_VALIDATE_BOOLEAN);
136
+	}
137
+
138
+
139
+	/**
140
+	 * @deprecated  4.9.53
141
+	 * @return boolean
142
+	 */
143
+	public function plugin_deactivated()
144
+	{
145
+		return $this->deactivate_plugin;
146
+	}
147
+
148
+
149
+	/**
150
+	 * @deprecated  4.9.53
151
+	 * sets $deactivate_plugin to true
152
+	 */
153
+	public function deactivate_plugin()
154
+	{
155
+		$this->deactivate_plugin = true;
156
+	}
157 157
 }
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   +123 added lines, -123 removed lines patch added patch discarded remove patch
@@ -10,133 +10,133 @@
 block discarded – undo
10 10
  */
11 11
 class EEM_Term_Taxonomy extends EEM_Base
12 12
 {
13
-    /**
14
-     * @var EEM_Term_Taxonomy
15
-     */
16
-    protected static $_instance = null;
13
+	/**
14
+	 * @var EEM_Term_Taxonomy
15
+	 */
16
+	protected static $_instance = null;
17 17
 
18 18
 
19
-    /**
20
-     * @param $timezone
21
-     * @throws EE_Error
22
-     */
23
-    protected function __construct($timezone = null)
24
-    {
25
-        $this->singular_item = esc_html__('Term Taxonomy', 'event_espresso');
26
-        $this->plural_item = esc_html__('Term Taxonomy', 'event_espresso');
27
-        $this->_tables = array(
28
-            'Term_Taxonomy' => new EE_Primary_Table('term_taxonomy', 'term_taxonomy_id'),
29
-        );
30
-        $this->_fields = array(
31
-            'Term_Taxonomy' => array(
32
-                'term_taxonomy_id' => new EE_Primary_Key_Int_Field(
33
-                    'term_taxonomy_id',
34
-                    esc_html__('Term-Taxonomy ID', 'event_espresso')
35
-                ),
36
-                'term_id'          => new EE_Foreign_Key_Int_Field(
37
-                    'term_id',
38
-                    esc_html__("Term Id", "event_espresso"),
39
-                    false,
40
-                    0,
41
-                    'Term'
42
-                ),
43
-                'taxonomy'         => new EE_Plain_Text_Field(
44
-                    'taxonomy',
45
-                    esc_html__('Taxonomy Name', 'event_espresso'),
46
-                    false,
47
-                    'category'
48
-                ),
49
-                'description'      => new EE_Post_Content_Field(
50
-                    'description',
51
-                    esc_html__("Description of Term", "event_espresso"),
52
-                    false,
53
-                    ''
54
-                ),
55
-                'parent'           => new EE_Integer_Field('parent', esc_html__("Parent Term ID", "event_espresso"), false, 0),
56
-                'term_count'       => new EE_Integer_Field(
57
-                    'count',
58
-                    esc_html__("Count of Objects attached", 'event_espresso'),
59
-                    false,
60
-                    0
61
-                ),
62
-            ),
63
-        );
64
-        $this->_model_relations = array(
65
-            'Term_Relationship' => new EE_Has_Many_Relation(),
66
-            'Term'              => new EE_Belongs_To_Relation(),
67
-        );
68
-        $cpt_models = array_keys(EE_Registry::instance()->cpt_models());
69
-        foreach ($cpt_models as $model_name) {
70
-            $this->_model_relations[ $model_name ] = new EE_HABTM_Relation('Term_Relationship');
71
-        }
72
-        $this->_wp_core_model = true;
73
-        $this->_indexes = array(
74
-            'term_id_taxonomy' => new EE_Unique_Index(array('term_id', 'taxonomy')),
75
-        );
76
-        $path_to_tax_model = '';
77
-        $this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
78
-        $this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Taxonomy_Protected(
79
-            $path_to_tax_model
80
-        );
81
-        $this->_cap_restriction_generators[ EEM_Base::caps_edit ] = false;
82
-        $this->_cap_restriction_generators[ EEM_Base::caps_delete ] = false;
83
-        // add cap restrictions for editing relating to the "ee_edit_*"
84
-        $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_category'] = new EE_Default_Where_Conditions(
85
-            array(
86
-                $path_to_tax_model . 'taxonomy*ee_edit_event_category' => array('!=', 'espresso_event_categories'),
87
-            )
88
-        );
89
-        $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_venue_category'] = new EE_Default_Where_Conditions(
90
-            array(
91
-                $path_to_tax_model . 'taxonomy*ee_edit_venue_category' => array('!=', 'espresso_venue_categories'),
92
-            )
93
-        );
94
-        $this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_type'] = new EE_Default_Where_Conditions(
95
-            array(
96
-                $path_to_tax_model . 'taxonomy*ee_edit_event_type' => array('!=', 'espresso_event_type'),
97
-            )
98
-        );
99
-        // add cap restrictions for deleting relating to the "ee_deleting_*"
100
-        $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_category'] = new EE_Default_Where_Conditions(
101
-            array(
102
-                $path_to_tax_model . 'taxonomy*ee_delete_event_category' => array('!=', 'espresso_event_categories'),
103
-            )
104
-        );
105
-        $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_venue_category'] = new EE_Default_Where_Conditions(
106
-            array(
107
-                $path_to_tax_model . 'taxonomy*ee_delete_venue_category' => array('!=', 'espresso_venue_categories'),
108
-            )
109
-        );
110
-        $this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_type'] = new EE_Default_Where_Conditions(
111
-            array(
112
-                $path_to_tax_model . 'taxonomy*ee_delete_event_type' => array('!=', 'espresso_event_type'),
113
-            )
114
-        );
115
-        parent::__construct($timezone);
116
-        add_filter('FHEE__Read__create_model_query_params', array('EEM_Term_Taxonomy', 'rest_api_query_params'), 10, 3);
117
-    }
19
+	/**
20
+	 * @param $timezone
21
+	 * @throws EE_Error
22
+	 */
23
+	protected function __construct($timezone = null)
24
+	{
25
+		$this->singular_item = esc_html__('Term Taxonomy', 'event_espresso');
26
+		$this->plural_item = esc_html__('Term Taxonomy', 'event_espresso');
27
+		$this->_tables = array(
28
+			'Term_Taxonomy' => new EE_Primary_Table('term_taxonomy', 'term_taxonomy_id'),
29
+		);
30
+		$this->_fields = array(
31
+			'Term_Taxonomy' => array(
32
+				'term_taxonomy_id' => new EE_Primary_Key_Int_Field(
33
+					'term_taxonomy_id',
34
+					esc_html__('Term-Taxonomy ID', 'event_espresso')
35
+				),
36
+				'term_id'          => new EE_Foreign_Key_Int_Field(
37
+					'term_id',
38
+					esc_html__("Term Id", "event_espresso"),
39
+					false,
40
+					0,
41
+					'Term'
42
+				),
43
+				'taxonomy'         => new EE_Plain_Text_Field(
44
+					'taxonomy',
45
+					esc_html__('Taxonomy Name', 'event_espresso'),
46
+					false,
47
+					'category'
48
+				),
49
+				'description'      => new EE_Post_Content_Field(
50
+					'description',
51
+					esc_html__("Description of Term", "event_espresso"),
52
+					false,
53
+					''
54
+				),
55
+				'parent'           => new EE_Integer_Field('parent', esc_html__("Parent Term ID", "event_espresso"), false, 0),
56
+				'term_count'       => new EE_Integer_Field(
57
+					'count',
58
+					esc_html__("Count of Objects attached", 'event_espresso'),
59
+					false,
60
+					0
61
+				),
62
+			),
63
+		);
64
+		$this->_model_relations = array(
65
+			'Term_Relationship' => new EE_Has_Many_Relation(),
66
+			'Term'              => new EE_Belongs_To_Relation(),
67
+		);
68
+		$cpt_models = array_keys(EE_Registry::instance()->cpt_models());
69
+		foreach ($cpt_models as $model_name) {
70
+			$this->_model_relations[ $model_name ] = new EE_HABTM_Relation('Term_Relationship');
71
+		}
72
+		$this->_wp_core_model = true;
73
+		$this->_indexes = array(
74
+			'term_id_taxonomy' => new EE_Unique_Index(array('term_id', 'taxonomy')),
75
+		);
76
+		$path_to_tax_model = '';
77
+		$this->_cap_restriction_generators[ EEM_Base::caps_read ] = new EE_Restriction_Generator_Public();
78
+		$this->_cap_restriction_generators[ EEM_Base::caps_read_admin ] = new EE_Restriction_Generator_Taxonomy_Protected(
79
+			$path_to_tax_model
80
+		);
81
+		$this->_cap_restriction_generators[ EEM_Base::caps_edit ] = false;
82
+		$this->_cap_restriction_generators[ EEM_Base::caps_delete ] = false;
83
+		// add cap restrictions for editing relating to the "ee_edit_*"
84
+		$this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_category'] = new EE_Default_Where_Conditions(
85
+			array(
86
+				$path_to_tax_model . 'taxonomy*ee_edit_event_category' => array('!=', 'espresso_event_categories'),
87
+			)
88
+		);
89
+		$this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_venue_category'] = new EE_Default_Where_Conditions(
90
+			array(
91
+				$path_to_tax_model . 'taxonomy*ee_edit_venue_category' => array('!=', 'espresso_venue_categories'),
92
+			)
93
+		);
94
+		$this->_cap_restrictions[ EEM_Base::caps_edit ]['ee_edit_event_type'] = new EE_Default_Where_Conditions(
95
+			array(
96
+				$path_to_tax_model . 'taxonomy*ee_edit_event_type' => array('!=', 'espresso_event_type'),
97
+			)
98
+		);
99
+		// add cap restrictions for deleting relating to the "ee_deleting_*"
100
+		$this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_category'] = new EE_Default_Where_Conditions(
101
+			array(
102
+				$path_to_tax_model . 'taxonomy*ee_delete_event_category' => array('!=', 'espresso_event_categories'),
103
+			)
104
+		);
105
+		$this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_venue_category'] = new EE_Default_Where_Conditions(
106
+			array(
107
+				$path_to_tax_model . 'taxonomy*ee_delete_venue_category' => array('!=', 'espresso_venue_categories'),
108
+			)
109
+		);
110
+		$this->_cap_restrictions[ EEM_Base::caps_delete ]['ee_delete_event_type'] = new EE_Default_Where_Conditions(
111
+			array(
112
+				$path_to_tax_model . 'taxonomy*ee_delete_event_type' => array('!=', 'espresso_event_type'),
113
+			)
114
+		);
115
+		parent::__construct($timezone);
116
+		add_filter('FHEE__Read__create_model_query_params', array('EEM_Term_Taxonomy', 'rest_api_query_params'), 10, 3);
117
+	}
118 118
 
119 119
 
120
-    /**
121
-     * Makes sure that during REST API queries, we only return term-taxonomies
122
-     * for term taxonomies which should be shown in the rest api
123
-     *
124
-     * @param array    $model_query_params
125
-     * @param array    $querystring_query_params
126
-     * @param EEM_Base $model
127
-     * @return array
128
-     * @throws EE_Error
129
-     */
130
-    public static function rest_api_query_params($model_query_params, $querystring_query_params, $model)
131
-    {
132
-        if ($model === EEM_Term_Taxonomy::instance()) {
133
-            $taxonomies = get_taxonomies(array('show_in_rest' => true));
134
-            if (! empty($taxonomies)) {
135
-                $model_query_params[0]['taxonomy'] = array('IN', $taxonomies);
136
-            }
137
-        }
138
-        return $model_query_params;
139
-    }
120
+	/**
121
+	 * Makes sure that during REST API queries, we only return term-taxonomies
122
+	 * for term taxonomies which should be shown in the rest api
123
+	 *
124
+	 * @param array    $model_query_params
125
+	 * @param array    $querystring_query_params
126
+	 * @param EEM_Base $model
127
+	 * @return array
128
+	 * @throws EE_Error
129
+	 */
130
+	public static function rest_api_query_params($model_query_params, $querystring_query_params, $model)
131
+	{
132
+		if ($model === EEM_Term_Taxonomy::instance()) {
133
+			$taxonomies = get_taxonomies(array('show_in_rest' => true));
134
+			if (! empty($taxonomies)) {
135
+				$model_query_params[0]['taxonomy'] = array('IN', $taxonomies);
136
+			}
137
+		}
138
+		return $model_query_params;
139
+	}
140 140
 }
141 141
 // End of file EEM_Term_Taxonomy.model.php
142 142
 // Location: /includes/models/EEM_Term_Taxonomy.model.php
Please login to merge, or discard this patch.