Completed
Branch BUG-fix-i18n-strings-pricing-a... (d805e1)
by
unknown
08:37 queued 34s
created
caffeinated/admin/new/pricing/Price_Types_List_Table.class.php 2 patches
Indentation   +218 added lines, -218 removed lines patch added patch discarded remove patch
@@ -16,222 +16,222 @@
 block discarded – undo
16 16
 class Price_Types_List_Table extends EE_Admin_List_Table
17 17
 {
18 18
 
19
-    public function __construct($admin_page)
20
-    {
21
-        parent::__construct($admin_page);
22
-        require_once(EE_MODELS . 'EEM_Price_Type.model.php');
23
-        $this->_PRT = EEM_Price_Type::instance();
24
-    }
25
-
26
-
27
-    protected function _setup_data()
28
-    {
29
-        $trashed = $this->_admin_page->get_view() == 'trashed' ? true : false;
30
-        $this->_data = $this->_admin_page->get_price_types_overview_data($this->_per_page, false, $trashed);
31
-        $this->_all_data_count = $this->_admin_page->get_price_types_overview_data($this->_per_page, true, false);
32
-        $this->_trashed_count = $this->_admin_page->get_price_types_overview_data($this->_per_page, true, true);
33
-    }
34
-
35
-
36
-    protected function _set_properties()
37
-    {
38
-        $this->_wp_list_args = array(
39
-            'singular' => esc_html__('price type', 'event_espresso'),
40
-            'plural'   => esc_html__('price types', 'event_espresso'),
41
-            'ajax'     => true,
42
-            'screen'   => $this->_admin_page->get_current_screen()->id,
43
-        );
44
-
45
-        $this->_columns = array(
46
-            'cb'        => '<input type="checkbox" />', // Render a checkbox instead of text
47
-            'name'      => esc_html__('Name', 'event_espresso'),
48
-            'base_type' => '<div class="jst-cntr">' . esc_html__('Base Type', 'event_espresso') . '</div>',
49
-            'percent'   => '<div class="jst-cntr">'
50
-                           . sprintf(
51
-                               /* translators: 1: HTML new line, 2: open span tag, 3: close span tag */
52
-                               esc_html__('Applied %1$s as %2$s%%%3$s or %2$s$%3$s', 'event_espresso'),
53
-                               '<br/>',
54
-                               '<span class="big-text">',
55
-                               '</span>'
56
-                           )
57
-                           . '</div>',
58
-            'order'     => '<div class="jst-cntr">'
59
-                           . sprintf(
60
-                               /* translators: HTML new line */
61
-                               esc_html__('Order of %s Application', 'event_espresso'),
62
-                               '<br/>'
63
-                           )
64
-                           . '</div>',
65
-        );
66
-
67
-        $this->_sortable_columns = array(
68
-            // TRUE means its already sorted
69
-            'name' => array('name' => false),
70
-        );
71
-
72
-        $this->_hidden_columns = array();
73
-    }
74
-
75
-
76
-    protected function _get_table_filters()
77
-    {
78
-    }
79
-
80
-
81
-    protected function _add_view_counts()
82
-    {
83
-        $this->_views['all']['count'] = $this->_all_data_count;
84
-        if (EE_Registry::instance()->CAP->current_user_can(
85
-            'ee_delete_default_price_types',
86
-            'pricing_trash_price_type'
87
-        )) {
88
-            $this->_views['trashed']['count'] = $this->_trashed_count;
89
-        }
90
-    }
91
-
92
-
93
-    public function column_cb($item)
94
-    {
95
-        if ($item->base_type() !== 1) {
96
-            return sprintf(
97
-                '<input type="checkbox" name="checkbox[%1$s]" />',
98
-                $item->ID()
99
-            );
100
-        }
101
-        return '';
102
-    }
103
-
104
-
105
-    public function column_name($item)
106
-    {
107
-
108
-        // Build row actions
109
-        $actions = array();
110
-        // edit price link
111
-        if (EE_Registry::instance()->CAP->current_user_can(
112
-            'ee_edit_default_price_type',
113
-            'pricing_edit_price_type',
114
-            $item->ID()
115
-        )) {
116
-            $edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
117
-                'action' => 'edit_price_type',
118
-                'id'     => $item->ID(),
119
-            ), PRICING_ADMIN_URL);
120
-            $actions['edit'] = '<a href="' . $edit_lnk_url . '" aria-label="'
121
-                               . sprintf(
122
-                                   /* translators: The name of the price type */
123
-                                   esc_attr__('Edit Price Type (%s)', 'event_espresso'),
124
-                                   $item->name()
125
-                               )
126
-                               . '">'
127
-                               . esc_html__('Edit', 'event_espresso') . '</a>';
128
-        }
129
-
130
-        $name_link = EE_Registry::instance()->CAP->current_user_can(
131
-            'ee_edit_default_price_type',
132
-            'pricing_edit_price_type',
133
-            $item->ID()
134
-        )
135
-            ? '<a href="' . $edit_lnk_url . '" aria-label="'
136
-              . sprintf(
137
-                  /* translators: The name of the price type */
138
-                  esc_attr__('Edit Price Type (%s)', 'event_espresso'),
139
-                  $item->name()
140
-              )
141
-              . '">'
142
-              . stripslashes($item->name()) . '</a>'
143
-            : $item->name();
144
-
145
-        if ($item->base_type() !== 1) {
146
-            if ($this->_view == 'all') {
147
-                // trash price link
148
-                if (EE_Registry::instance()->CAP->current_user_can(
149
-                    'ee_delete_default_price_type',
150
-                    'pricing_trash_price_type',
151
-                    $item->ID()
152
-                )) {
153
-                    $trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
154
-                        'action'   => 'trash_price_type',
155
-                        'id'       => $item->ID(),
156
-                        'noheader' => true,
157
-                    ), PRICING_ADMIN_URL);
158
-                    $actions['trash'] = '<a href="' . $trash_lnk_url . '" aria-label="'
159
-                                        . sprintf(
160
-                                            /* translators: The name of the price type */
161
-                                            esc_attr__('Move Price Type %s to Trash', 'event_espresso'),
162
-                                            $item->name()
163
-                                        )
164
-                                        . '">'
165
-                                        . esc_html__('Move to Trash', 'event_espresso') . '</a>';
166
-                }
167
-            } else {
168
-                // restore price link
169
-                if (EE_Registry::instance()->CAP->current_user_can(
170
-                    'ee_delete_default_price_type',
171
-                    'pricing_restore_price_type',
172
-                    $item->ID()
173
-                )) {
174
-                    $restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
175
-                        'action'   => 'restore_price_type',
176
-                        'id'       => $item->ID(),
177
-                        'noheader' => true,
178
-                    ), PRICING_ADMIN_URL);
179
-                    $actions['restore'] = '<a href="' . $restore_lnk_url . '" aria-label="'
180
-                                          . sprintf(
181
-                                              /* translators: The name of the price type */
182
-                                              esc_attr__('Restore Price Type (%s)', 'event_espresso'),
183
-                                              $item->name()
184
-                                          )
185
-                                          . '">'
186
-                                          . esc_html__('Restore', 'event_espresso') . '</a>';
187
-                }
188
-                // delete price link
189
-                if (EE_Registry::instance()->CAP->current_user_can(
190
-                    'ee_delete_default_price_type',
191
-                    'pricing_delete_price_type',
192
-                    $item->ID()
193
-                )) {
194
-                    $delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
195
-                        'action'   => 'delete_price_type',
196
-                        'id'       => $item->ID(),
197
-                        'noheader' => true,
198
-                    ), PRICING_ADMIN_URL);
199
-                    $actions['delete'] = '<a href="' . $delete_lnk_url . '" aria-label="'
200
-                                         . sprintf(
201
-                                             /* translators: The name of the price type */
202
-                                             esc_attr__('Delete Price Type %s Permanently', 'event_espresso'),
203
-                                             $item->name()
204
-                                         )
205
-                                         . '">'
206
-                                         . esc_html__('Delete Permanently', 'event_espresso') . '</a>';
207
-                }
208
-            }
209
-        }
210
-
211
-        // Return the name contents
212
-        return sprintf(
213
-            '%1$s <span style="color:silver">(id:%2$s)</span>%3$s',
214
-            $name_link,
215
-            $item->ID(),
216
-            $this->row_actions($actions)
217
-        );
218
-    }
219
-
220
-
221
-    public function column_base_type($item)
222
-    {
223
-        return '<div class="jst-cntr">' . $item->base_type_name() . '</div>';
224
-    }
225
-
226
-
227
-    public function column_percent($item)
228
-    {
229
-        return '<div class="jst-cntr">' . ($item->is_percent() ? '%' : EE_Registry::instance()->CFG->currency->sign) . '</div>';
230
-    }
231
-
232
-
233
-    public function column_order($item)
234
-    {
235
-        return '<div class="jst-cntr">' . $item->order() . '</div>';
236
-    }
19
+	public function __construct($admin_page)
20
+	{
21
+		parent::__construct($admin_page);
22
+		require_once(EE_MODELS . 'EEM_Price_Type.model.php');
23
+		$this->_PRT = EEM_Price_Type::instance();
24
+	}
25
+
26
+
27
+	protected function _setup_data()
28
+	{
29
+		$trashed = $this->_admin_page->get_view() == 'trashed' ? true : false;
30
+		$this->_data = $this->_admin_page->get_price_types_overview_data($this->_per_page, false, $trashed);
31
+		$this->_all_data_count = $this->_admin_page->get_price_types_overview_data($this->_per_page, true, false);
32
+		$this->_trashed_count = $this->_admin_page->get_price_types_overview_data($this->_per_page, true, true);
33
+	}
34
+
35
+
36
+	protected function _set_properties()
37
+	{
38
+		$this->_wp_list_args = array(
39
+			'singular' => esc_html__('price type', 'event_espresso'),
40
+			'plural'   => esc_html__('price types', 'event_espresso'),
41
+			'ajax'     => true,
42
+			'screen'   => $this->_admin_page->get_current_screen()->id,
43
+		);
44
+
45
+		$this->_columns = array(
46
+			'cb'        => '<input type="checkbox" />', // Render a checkbox instead of text
47
+			'name'      => esc_html__('Name', 'event_espresso'),
48
+			'base_type' => '<div class="jst-cntr">' . esc_html__('Base Type', 'event_espresso') . '</div>',
49
+			'percent'   => '<div class="jst-cntr">'
50
+						   . sprintf(
51
+							   /* translators: 1: HTML new line, 2: open span tag, 3: close span tag */
52
+							   esc_html__('Applied %1$s as %2$s%%%3$s or %2$s$%3$s', 'event_espresso'),
53
+							   '<br/>',
54
+							   '<span class="big-text">',
55
+							   '</span>'
56
+						   )
57
+						   . '</div>',
58
+			'order'     => '<div class="jst-cntr">'
59
+						   . sprintf(
60
+							   /* translators: HTML new line */
61
+							   esc_html__('Order of %s Application', 'event_espresso'),
62
+							   '<br/>'
63
+						   )
64
+						   . '</div>',
65
+		);
66
+
67
+		$this->_sortable_columns = array(
68
+			// TRUE means its already sorted
69
+			'name' => array('name' => false),
70
+		);
71
+
72
+		$this->_hidden_columns = array();
73
+	}
74
+
75
+
76
+	protected function _get_table_filters()
77
+	{
78
+	}
79
+
80
+
81
+	protected function _add_view_counts()
82
+	{
83
+		$this->_views['all']['count'] = $this->_all_data_count;
84
+		if (EE_Registry::instance()->CAP->current_user_can(
85
+			'ee_delete_default_price_types',
86
+			'pricing_trash_price_type'
87
+		)) {
88
+			$this->_views['trashed']['count'] = $this->_trashed_count;
89
+		}
90
+	}
91
+
92
+
93
+	public function column_cb($item)
94
+	{
95
+		if ($item->base_type() !== 1) {
96
+			return sprintf(
97
+				'<input type="checkbox" name="checkbox[%1$s]" />',
98
+				$item->ID()
99
+			);
100
+		}
101
+		return '';
102
+	}
103
+
104
+
105
+	public function column_name($item)
106
+	{
107
+
108
+		// Build row actions
109
+		$actions = array();
110
+		// edit price link
111
+		if (EE_Registry::instance()->CAP->current_user_can(
112
+			'ee_edit_default_price_type',
113
+			'pricing_edit_price_type',
114
+			$item->ID()
115
+		)) {
116
+			$edit_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
117
+				'action' => 'edit_price_type',
118
+				'id'     => $item->ID(),
119
+			), PRICING_ADMIN_URL);
120
+			$actions['edit'] = '<a href="' . $edit_lnk_url . '" aria-label="'
121
+							   . sprintf(
122
+								   /* translators: The name of the price type */
123
+								   esc_attr__('Edit Price Type (%s)', 'event_espresso'),
124
+								   $item->name()
125
+							   )
126
+							   . '">'
127
+							   . esc_html__('Edit', 'event_espresso') . '</a>';
128
+		}
129
+
130
+		$name_link = EE_Registry::instance()->CAP->current_user_can(
131
+			'ee_edit_default_price_type',
132
+			'pricing_edit_price_type',
133
+			$item->ID()
134
+		)
135
+			? '<a href="' . $edit_lnk_url . '" aria-label="'
136
+			  . sprintf(
137
+				  /* translators: The name of the price type */
138
+				  esc_attr__('Edit Price Type (%s)', 'event_espresso'),
139
+				  $item->name()
140
+			  )
141
+			  . '">'
142
+			  . stripslashes($item->name()) . '</a>'
143
+			: $item->name();
144
+
145
+		if ($item->base_type() !== 1) {
146
+			if ($this->_view == 'all') {
147
+				// trash price link
148
+				if (EE_Registry::instance()->CAP->current_user_can(
149
+					'ee_delete_default_price_type',
150
+					'pricing_trash_price_type',
151
+					$item->ID()
152
+				)) {
153
+					$trash_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
154
+						'action'   => 'trash_price_type',
155
+						'id'       => $item->ID(),
156
+						'noheader' => true,
157
+					), PRICING_ADMIN_URL);
158
+					$actions['trash'] = '<a href="' . $trash_lnk_url . '" aria-label="'
159
+										. sprintf(
160
+											/* translators: The name of the price type */
161
+											esc_attr__('Move Price Type %s to Trash', 'event_espresso'),
162
+											$item->name()
163
+										)
164
+										. '">'
165
+										. esc_html__('Move to Trash', 'event_espresso') . '</a>';
166
+				}
167
+			} else {
168
+				// restore price link
169
+				if (EE_Registry::instance()->CAP->current_user_can(
170
+					'ee_delete_default_price_type',
171
+					'pricing_restore_price_type',
172
+					$item->ID()
173
+				)) {
174
+					$restore_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
175
+						'action'   => 'restore_price_type',
176
+						'id'       => $item->ID(),
177
+						'noheader' => true,
178
+					), PRICING_ADMIN_URL);
179
+					$actions['restore'] = '<a href="' . $restore_lnk_url . '" aria-label="'
180
+										  . sprintf(
181
+											  /* translators: The name of the price type */
182
+											  esc_attr__('Restore Price Type (%s)', 'event_espresso'),
183
+											  $item->name()
184
+										  )
185
+										  . '">'
186
+										  . esc_html__('Restore', 'event_espresso') . '</a>';
187
+				}
188
+				// delete price link
189
+				if (EE_Registry::instance()->CAP->current_user_can(
190
+					'ee_delete_default_price_type',
191
+					'pricing_delete_price_type',
192
+					$item->ID()
193
+				)) {
194
+					$delete_lnk_url = EE_Admin_Page::add_query_args_and_nonce(array(
195
+						'action'   => 'delete_price_type',
196
+						'id'       => $item->ID(),
197
+						'noheader' => true,
198
+					), PRICING_ADMIN_URL);
199
+					$actions['delete'] = '<a href="' . $delete_lnk_url . '" aria-label="'
200
+										 . sprintf(
201
+											 /* translators: The name of the price type */
202
+											 esc_attr__('Delete Price Type %s Permanently', 'event_espresso'),
203
+											 $item->name()
204
+										 )
205
+										 . '">'
206
+										 . esc_html__('Delete Permanently', 'event_espresso') . '</a>';
207
+				}
208
+			}
209
+		}
210
+
211
+		// Return the name contents
212
+		return sprintf(
213
+			'%1$s <span style="color:silver">(id:%2$s)</span>%3$s',
214
+			$name_link,
215
+			$item->ID(),
216
+			$this->row_actions($actions)
217
+		);
218
+	}
219
+
220
+
221
+	public function column_base_type($item)
222
+	{
223
+		return '<div class="jst-cntr">' . $item->base_type_name() . '</div>';
224
+	}
225
+
226
+
227
+	public function column_percent($item)
228
+	{
229
+		return '<div class="jst-cntr">' . ($item->is_percent() ? '%' : EE_Registry::instance()->CFG->currency->sign) . '</div>';
230
+	}
231
+
232
+
233
+	public function column_order($item)
234
+	{
235
+		return '<div class="jst-cntr">' . $item->order() . '</div>';
236
+	}
237 237
 }
Please login to merge, or discard this patch.
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -19,7 +19,7 @@  discard block
 block discarded – undo
19 19
     public function __construct($admin_page)
20 20
     {
21 21
         parent::__construct($admin_page);
22
-        require_once(EE_MODELS . 'EEM_Price_Type.model.php');
22
+        require_once(EE_MODELS.'EEM_Price_Type.model.php');
23 23
         $this->_PRT = EEM_Price_Type::instance();
24 24
     }
25 25
 
@@ -45,7 +45,7 @@  discard block
 block discarded – undo
45 45
         $this->_columns = array(
46 46
             'cb'        => '<input type="checkbox" />', // Render a checkbox instead of text
47 47
             'name'      => esc_html__('Name', 'event_espresso'),
48
-            'base_type' => '<div class="jst-cntr">' . esc_html__('Base Type', 'event_espresso') . '</div>',
48
+            'base_type' => '<div class="jst-cntr">'.esc_html__('Base Type', 'event_espresso').'</div>',
49 49
             'percent'   => '<div class="jst-cntr">'
50 50
                            . sprintf(
51 51
                                /* translators: 1: HTML new line, 2: open span tag, 3: close span tag */
@@ -117,14 +117,14 @@  discard block
 block discarded – undo
117 117
                 'action' => 'edit_price_type',
118 118
                 'id'     => $item->ID(),
119 119
             ), PRICING_ADMIN_URL);
120
-            $actions['edit'] = '<a href="' . $edit_lnk_url . '" aria-label="'
120
+            $actions['edit'] = '<a href="'.$edit_lnk_url.'" aria-label="'
121 121
                                . sprintf(
122 122
                                    /* translators: The name of the price type */
123 123
                                    esc_attr__('Edit Price Type (%s)', 'event_espresso'),
124 124
                                    $item->name()
125 125
                                )
126 126
                                . '">'
127
-                               . esc_html__('Edit', 'event_espresso') . '</a>';
127
+                               . esc_html__('Edit', 'event_espresso').'</a>';
128 128
         }
129 129
 
130 130
         $name_link = EE_Registry::instance()->CAP->current_user_can(
@@ -132,14 +132,14 @@  discard block
 block discarded – undo
132 132
             'pricing_edit_price_type',
133 133
             $item->ID()
134 134
         )
135
-            ? '<a href="' . $edit_lnk_url . '" aria-label="'
135
+            ? '<a href="'.$edit_lnk_url.'" aria-label="'
136 136
               . sprintf(
137 137
                   /* translators: The name of the price type */
138 138
                   esc_attr__('Edit Price Type (%s)', 'event_espresso'),
139 139
                   $item->name()
140 140
               )
141 141
               . '">'
142
-              . stripslashes($item->name()) . '</a>'
142
+              . stripslashes($item->name()).'</a>'
143 143
             : $item->name();
144 144
 
145 145
         if ($item->base_type() !== 1) {
@@ -155,14 +155,14 @@  discard block
 block discarded – undo
155 155
                         'id'       => $item->ID(),
156 156
                         'noheader' => true,
157 157
                     ), PRICING_ADMIN_URL);
158
-                    $actions['trash'] = '<a href="' . $trash_lnk_url . '" aria-label="'
158
+                    $actions['trash'] = '<a href="'.$trash_lnk_url.'" aria-label="'
159 159
                                         . sprintf(
160 160
                                             /* translators: The name of the price type */
161 161
                                             esc_attr__('Move Price Type %s to Trash', 'event_espresso'),
162 162
                                             $item->name()
163 163
                                         )
164 164
                                         . '">'
165
-                                        . esc_html__('Move to Trash', 'event_espresso') . '</a>';
165
+                                        . esc_html__('Move to Trash', 'event_espresso').'</a>';
166 166
                 }
167 167
             } else {
168 168
                 // restore price link
@@ -176,14 +176,14 @@  discard block
 block discarded – undo
176 176
                         'id'       => $item->ID(),
177 177
                         'noheader' => true,
178 178
                     ), PRICING_ADMIN_URL);
179
-                    $actions['restore'] = '<a href="' . $restore_lnk_url . '" aria-label="'
179
+                    $actions['restore'] = '<a href="'.$restore_lnk_url.'" aria-label="'
180 180
                                           . sprintf(
181 181
                                               /* translators: The name of the price type */
182 182
                                               esc_attr__('Restore Price Type (%s)', 'event_espresso'),
183 183
                                               $item->name()
184 184
                                           )
185 185
                                           . '">'
186
-                                          . esc_html__('Restore', 'event_espresso') . '</a>';
186
+                                          . esc_html__('Restore', 'event_espresso').'</a>';
187 187
                 }
188 188
                 // delete price link
189 189
                 if (EE_Registry::instance()->CAP->current_user_can(
@@ -196,14 +196,14 @@  discard block
 block discarded – undo
196 196
                         'id'       => $item->ID(),
197 197
                         'noheader' => true,
198 198
                     ), PRICING_ADMIN_URL);
199
-                    $actions['delete'] = '<a href="' . $delete_lnk_url . '" aria-label="'
199
+                    $actions['delete'] = '<a href="'.$delete_lnk_url.'" aria-label="'
200 200
                                          . sprintf(
201 201
                                              /* translators: The name of the price type */
202 202
                                              esc_attr__('Delete Price Type %s Permanently', 'event_espresso'),
203 203
                                              $item->name()
204 204
                                          )
205 205
                                          . '">'
206
-                                         . esc_html__('Delete Permanently', 'event_espresso') . '</a>';
206
+                                         . esc_html__('Delete Permanently', 'event_espresso').'</a>';
207 207
                 }
208 208
             }
209 209
         }
@@ -220,18 +220,18 @@  discard block
 block discarded – undo
220 220
 
221 221
     public function column_base_type($item)
222 222
     {
223
-        return '<div class="jst-cntr">' . $item->base_type_name() . '</div>';
223
+        return '<div class="jst-cntr">'.$item->base_type_name().'</div>';
224 224
     }
225 225
 
226 226
 
227 227
     public function column_percent($item)
228 228
     {
229
-        return '<div class="jst-cntr">' . ($item->is_percent() ? '%' : EE_Registry::instance()->CFG->currency->sign) . '</div>';
229
+        return '<div class="jst-cntr">'.($item->is_percent() ? '%' : EE_Registry::instance()->CFG->currency->sign).'</div>';
230 230
     }
231 231
 
232 232
 
233 233
     public function column_order($item)
234 234
     {
235
-        return '<div class="jst-cntr">' . $item->order() . '</div>';
235
+        return '<div class="jst-cntr">'.$item->order().'</div>';
236 236
     }
237 237
 }
Please login to merge, or discard this patch.