Completed
Push — master ( c6223f...a80801 )
by Stephanie
04:48
created
classes/helpers/FrmEntriesListHelper.php 1 patch
Indentation   +58 added lines, -58 removed lines patch added patch discarded remove patch
@@ -6,10 +6,10 @@  discard block
 block discarded – undo
6 6
 	protected $field;
7 7
 
8 8
 	public function prepare_items() {
9
-        global $per_page;
9
+		global $per_page;
10 10
 
11 11
 		$per_page = $this->get_items_per_page( 'formidable_page_formidable_entries_per_page' );
12
-        $form_id = $this->params['form'];
12
+		$form_id = $this->params['form'];
13 13
 
14 14
 		$default_orderby = 'id';
15 15
 		$default_order = 'DESC';
@@ -21,25 +21,25 @@  discard block
 block discarded – undo
21 21
 
22 22
 		$s = isset( $_REQUEST['s'] ) ? stripslashes($_REQUEST['s']) : '';
23 23
 
24
-	    if ( $s != '' && FrmAppHelper::pro_is_installed() ) {
25
-	        $fid = isset( $_REQUEST['fid'] ) ? sanitize_title( $_REQUEST['fid'] ) : '';
26
-	        $s_query = FrmProEntriesHelper::get_search_str( $s_query, $s, $form_id, $fid );
27
-	    }
24
+		if ( $s != '' && FrmAppHelper::pro_is_installed() ) {
25
+			$fid = isset( $_REQUEST['fid'] ) ? sanitize_title( $_REQUEST['fid'] ) : '';
26
+			$s_query = FrmProEntriesHelper::get_search_str( $s_query, $s, $form_id, $fid );
27
+		}
28 28
 
29
-        $orderby = isset( $_REQUEST['orderby'] ) ? sanitize_title( $_REQUEST['orderby'] ) : $default_orderby;
30
-        if ( strpos($orderby, 'meta') !== false ) {
31
-            $order_field_type = FrmField::get_type( str_replace( 'meta_', '', $orderby ) );
29
+		$orderby = isset( $_REQUEST['orderby'] ) ? sanitize_title( $_REQUEST['orderby'] ) : $default_orderby;
30
+		if ( strpos($orderby, 'meta') !== false ) {
31
+			$order_field_type = FrmField::get_type( str_replace( 'meta_', '', $orderby ) );
32 32
 			$orderby .= in_array( $order_field_type, array( 'number', 'scale' ) ) ? ' +0 ' : '';
33
-        }
33
+		}
34 34
 
35 35
 		$order = isset( $_REQUEST['order'] ) ? sanitize_title( $_REQUEST['order'] ) : $default_order;
36 36
 		$order = ' ORDER BY ' . $orderby . ' ' . $order;
37 37
 
38
-        $page = $this->get_pagenum();
38
+		$page = $this->get_pagenum();
39 39
 		$start = (int) isset( $_REQUEST['start'] ) ? absint( $_REQUEST['start'] ) : ( ( $page - 1 ) * $per_page );
40 40
 
41 41
 		$this->items = FrmEntry::getAll( $s_query, $order, ' LIMIT ' . $start . ',' . $per_page, true, false );
42
-        $total_items = FrmEntry::getRecordCount($s_query);
42
+		$total_items = FrmEntry::getRecordCount($s_query);
43 43
 
44 44
 		$this->set_pagination_args( array(
45 45
 			'total_items' => $total_items,
@@ -48,19 +48,19 @@  discard block
 block discarded – undo
48 48
 	}
49 49
 
50 50
 	public function no_items() {
51
-        $s = isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : '';
52
-	    if ( ! empty($s) ) {
53
-            _e( 'No Entries Found', 'formidable' );
54
-            return;
55
-        }
51
+		$s = isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : '';
52
+		if ( ! empty($s) ) {
53
+			_e( 'No Entries Found', 'formidable' );
54
+			return;
55
+		}
56 56
 
57 57
 		$form_id = $this->params['form'];
58 58
 		$form = $this->params['form'];
59 59
 
60
-        if ( $form_id ) {
61
-            $form = FrmForm::getOne($form_id);
62
-        }
63
-        $colspan = $this->get_column_count();
60
+		if ( $form_id ) {
61
+			$form = FrmForm::getOne($form_id);
62
+		}
63
+		$colspan = $this->get_column_count();
64 64
 
65 65
 		include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/no_entries.php' );
66 66
 	}
@@ -80,12 +80,12 @@  discard block
 block discarded – undo
80 80
 	}
81 81
 
82 82
 	/**
83
-	* Gets the name of the primary column in the Entries screen
84
-	*
85
-	* @since 2.0.14
86
-	*
87
-	* @return string $primary_column
88
-	*/
83
+	 * Gets the name of the primary column in the Entries screen
84
+	 *
85
+	 * @since 2.0.14
86
+	 *
87
+	 * @return string $primary_column
88
+	 */
89 89
 	protected function get_primary_column_name() {
90 90
 		$columns = get_column_headers( $this->screen );
91 91
 		$hidden = get_hidden_columns( $this->screen );
@@ -109,7 +109,7 @@  discard block
 block discarded – undo
109 109
 
110 110
 		$this->get_actions( $actions, $item, $view_link );
111 111
 
112
-        $action_links = $this->row_actions( $actions );
112
+		$action_links = $this->row_actions( $actions );
113 113
 
114 114
 		// Set up the checkbox ( because the user is editable, otherwise its empty )
115 115
 		$checkbox = "<input type='checkbox' name='item-action[]' id='cb-item-action-{$item->id}' value='{$item->id}' />";
@@ -117,7 +117,7 @@  discard block
 block discarded – undo
117 117
 		$r = "<tr id='item-action-{$item->id}'$style>";
118 118
 
119 119
 		list( $columns, $hidden, , $primary ) = $this->get_column_info();
120
-        $action_col = false;
120
+		$action_col = false;
121 121
 
122 122
 		foreach ( $columns as $column_name => $column_display_name ) {
123 123
 			$class = $column_name . ' column-' . $column_name;
@@ -129,8 +129,8 @@  discard block
 block discarded – undo
129 129
 			if ( in_array( $column_name, $hidden ) ) {
130 130
 				$class .= ' frm_hidden';
131 131
 			} else if ( ! $action_col && ! in_array( $column_name, array( 'cb', 'id', 'form_id', 'post_id' ) ) ) {
132
-			    $action_col = $column_name;
133
-            }
132
+				$action_col = $column_name;
133
+			}
134 134
 
135 135
 			$attributes = 'class="' . esc_attr( $class ) . '"';
136 136
 			unset($class);
@@ -147,30 +147,30 @@  discard block
 block discarded – undo
147 147
 				case 'ip':
148 148
 				case 'id':
149 149
 				case 'item_key':
150
-				    $val = $item->{$col_name};
151
-				    break;
150
+					$val = $item->{$col_name};
151
+					break;
152 152
 				case 'name':
153 153
 				case 'description':
154
-				    $val = FrmAppHelper::truncate(strip_tags($item->{$col_name}), 100);
155
-				    break;
154
+					$val = FrmAppHelper::truncate(strip_tags($item->{$col_name}), 100);
155
+					break;
156 156
 				case 'created_at':
157 157
 				case 'updated_at':
158
-				    $date = FrmAppHelper::get_formatted_time($item->{$col_name});
158
+					$date = FrmAppHelper::get_formatted_time($item->{$col_name});
159 159
 					$val = '<abbr title="' . esc_attr( FrmAppHelper::get_formatted_time( $item->{$col_name}, '', 'g:i:s A' ) ) . '">' . $date . '</abbr>';
160 160
 					break;
161 161
 				case 'is_draft':
162
-				    $val = empty($item->is_draft) ? __( 'No') : __( 'Yes');
163
-			        break;
162
+					$val = empty($item->is_draft) ? __( 'No') : __( 'Yes');
163
+					break;
164 164
 				case 'form_id':
165
-				    $val = FrmFormsHelper::edit_form_link($item->form_id);
166
-    				break;
165
+					$val = FrmFormsHelper::edit_form_link($item->form_id);
166
+					break;
167 167
 				case 'post_id':
168
-				    $val = FrmAppHelper::post_edit_link($item->post_id);
169
-				    break;
168
+					$val = FrmAppHelper::post_edit_link($item->post_id);
169
+					break;
170 170
 				case 'user_id':
171
-				    $user = get_userdata($item->user_id);
172
-				    $val = $user ? $user->user_login : '';
173
-				    break;
171
+					$user = get_userdata($item->user_id);
172
+					$val = $user ? $user->user_login : '';
173
+					break;
174 174
 				default:
175 175
 					$val = apply_filters( 'frm_entries_' . $col_name . '_column', false, compact( 'item' ) );
176 176
 					if ( $val === false ) {
@@ -180,15 +180,15 @@  discard block
 block discarded – undo
180 180
 			}
181 181
 
182 182
 			if ( isset( $val ) ) {
183
-			    $r .= "<td $attributes>";
183
+				$r .= "<td $attributes>";
184 184
 				if ( $column_name == $action_col ) {
185 185
 					$edit_link = '?page=formidable-entries&frm_action=edit&id=' . $item->id;
186 186
 					$r .= '<a href="' . esc_url( isset( $actions['edit'] ) ? $edit_link : $view_link ) . '" class="row-title" >' . $val . '</a> ';
187
-			        $r .= $action_links;
187
+					$r .= $action_links;
188 188
 				} else {
189
-			        $r .= $val;
190
-			    }
191
-			    $r .= '</td>';
189
+					$r .= $val;
190
+				}
191
+				$r .= '</td>';
192 192
 			}
193 193
 			unset($val);
194 194
 		}
@@ -197,19 +197,19 @@  discard block
 block discarded – undo
197 197
 		return $r;
198 198
 	}
199 199
 
200
-    /**
201
-     * @param string $view_link
202
-     */
203
-    private function get_actions( &$actions, $item, $view_link ) {
200
+	/**
201
+	 * @param string $view_link
202
+	 */
203
+	private function get_actions( &$actions, $item, $view_link ) {
204 204
 		$actions['view'] = '<a href="' . esc_url( $view_link ) . '">' . __( 'View', 'formidable' ) . '</a>';
205 205
 
206
-        if ( current_user_can('frm_delete_entries') ) {
206
+		if ( current_user_can('frm_delete_entries') ) {
207 207
 			$delete_link = '?page=formidable-entries&frm_action=destroy&id=' . $item->id . '&form=' . $this->params['form'];
208 208
 			$actions['delete'] = '<a href="' . esc_url( wp_nonce_url( $delete_link ) ) . '" class="submitdelete" onclick="return confirm(\'' . esc_attr( __( 'Are you sure you want to delete that?', 'formidable' ) ) . '\')">' . __( 'Delete' ) . '</a>';
209
-	    }
209
+		}
210 210
 
211
-        $actions = apply_filters('frm_row_actions', $actions, $item);
212
-    }
211
+		$actions = apply_filters('frm_row_actions', $actions, $item);
212
+	}
213 213
 
214 214
 	private function get_column_value( $item, &$val ) {
215 215
 		$col_name = $this->column_name;
Please login to merge, or discard this patch.