@@ -6,10 +6,10 @@ discard block |
||
| 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'; |
@@ -25,25 +25,25 @@ discard block |
||
| 25 | 25 | |
| 26 | 26 | $s = isset( $_REQUEST['s'] ) ? stripslashes($_REQUEST['s']) : ''; |
| 27 | 27 | |
| 28 | - if ( $s != '' && FrmAppHelper::pro_is_installed() ) { |
|
| 29 | - $fid = isset( $_REQUEST['fid'] ) ? sanitize_title( $_REQUEST['fid'] ) : ''; |
|
| 30 | - $s_query = FrmProEntriesHelper::get_search_str( $s_query, $s, $form_id, $fid ); |
|
| 31 | - } |
|
| 28 | + if ( $s != '' && FrmAppHelper::pro_is_installed() ) { |
|
| 29 | + $fid = isset( $_REQUEST['fid'] ) ? sanitize_title( $_REQUEST['fid'] ) : ''; |
|
| 30 | + $s_query = FrmProEntriesHelper::get_search_str( $s_query, $s, $form_id, $fid ); |
|
| 31 | + } |
|
| 32 | 32 | |
| 33 | - $orderby = isset( $_REQUEST['orderby'] ) ? sanitize_title( $_REQUEST['orderby'] ) : $default_orderby; |
|
| 34 | - if ( strpos($orderby, 'meta') !== false ) { |
|
| 35 | - $order_field_type = FrmField::get_type( str_replace( 'meta_', '', $orderby ) ); |
|
| 33 | + $orderby = isset( $_REQUEST['orderby'] ) ? sanitize_title( $_REQUEST['orderby'] ) : $default_orderby; |
|
| 34 | + if ( strpos($orderby, 'meta') !== false ) { |
|
| 35 | + $order_field_type = FrmField::get_type( str_replace( 'meta_', '', $orderby ) ); |
|
| 36 | 36 | $orderby .= in_array( $order_field_type, array( 'number', 'scale' ) ) ? ' +0 ' : ''; |
| 37 | - } |
|
| 37 | + } |
|
| 38 | 38 | |
| 39 | 39 | $order = isset( $_REQUEST['order'] ) ? sanitize_title( $_REQUEST['order'] ) : $default_order; |
| 40 | 40 | $order = ' ORDER BY ' . $orderby . ' ' . $order; |
| 41 | 41 | |
| 42 | - $page = $this->get_pagenum(); |
|
| 42 | + $page = $this->get_pagenum(); |
|
| 43 | 43 | $start = (int) isset( $_REQUEST['start'] ) ? absint( $_REQUEST['start'] ) : ( ( $page - 1 ) * $per_page ); |
| 44 | 44 | |
| 45 | 45 | $this->items = FrmEntry::getAll( $s_query, $order, ' LIMIT ' . $start . ',' . $per_page, true, $join_form_in_query ); |
| 46 | - $total_items = FrmEntry::getRecordCount($s_query); |
|
| 46 | + $total_items = FrmEntry::getRecordCount($s_query); |
|
| 47 | 47 | |
| 48 | 48 | $this->set_pagination_args( array( |
| 49 | 49 | 'total_items' => $total_items, |
@@ -52,19 +52,19 @@ discard block |
||
| 52 | 52 | } |
| 53 | 53 | |
| 54 | 54 | public function no_items() { |
| 55 | - $s = isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : ''; |
|
| 56 | - if ( ! empty($s) ) { |
|
| 57 | - _e( 'No Entries Found', 'formidable' ); |
|
| 58 | - return; |
|
| 59 | - } |
|
| 55 | + $s = isset( $_REQUEST['s'] ) ? $_REQUEST['s'] : ''; |
|
| 56 | + if ( ! empty($s) ) { |
|
| 57 | + _e( 'No Entries Found', 'formidable' ); |
|
| 58 | + return; |
|
| 59 | + } |
|
| 60 | 60 | |
| 61 | 61 | $form_id = $this->params['form']; |
| 62 | 62 | $form = $this->params['form']; |
| 63 | 63 | |
| 64 | - if ( $form_id ) { |
|
| 65 | - $form = FrmForm::getOne($form_id); |
|
| 66 | - } |
|
| 67 | - $colspan = $this->get_column_count(); |
|
| 64 | + if ( $form_id ) { |
|
| 65 | + $form = FrmForm::getOne($form_id); |
|
| 66 | + } |
|
| 67 | + $colspan = $this->get_column_count(); |
|
| 68 | 68 | |
| 69 | 69 | include( FrmAppHelper::plugin_path() . '/classes/views/frm-entries/no_entries.php' ); |
| 70 | 70 | } |
@@ -84,12 +84,12 @@ discard block |
||
| 84 | 84 | } |
| 85 | 85 | |
| 86 | 86 | /** |
| 87 | - * Gets the name of the primary column in the Entries screen |
|
| 88 | - * |
|
| 89 | - * @since 2.0.14 |
|
| 90 | - * |
|
| 91 | - * @return string $primary_column |
|
| 92 | - */ |
|
| 87 | + * Gets the name of the primary column in the Entries screen |
|
| 88 | + * |
|
| 89 | + * @since 2.0.14 |
|
| 90 | + * |
|
| 91 | + * @return string $primary_column |
|
| 92 | + */ |
|
| 93 | 93 | protected function get_primary_column_name() { |
| 94 | 94 | $columns = get_column_headers( $this->screen ); |
| 95 | 95 | $hidden = get_hidden_columns( $this->screen ); |
@@ -113,7 +113,7 @@ discard block |
||
| 113 | 113 | |
| 114 | 114 | $this->get_actions( $actions, $item, $view_link ); |
| 115 | 115 | |
| 116 | - $action_links = $this->row_actions( $actions ); |
|
| 116 | + $action_links = $this->row_actions( $actions ); |
|
| 117 | 117 | |
| 118 | 118 | // Set up the checkbox ( because the user is editable, otherwise its empty ) |
| 119 | 119 | $checkbox = "<input type='checkbox' name='item-action[]' id='cb-item-action-{$item->id}' value='{$item->id}' />"; |
@@ -121,7 +121,7 @@ discard block |
||
| 121 | 121 | $r = "<tr id='item-action-{$item->id}'$style>"; |
| 122 | 122 | |
| 123 | 123 | list( $columns, $hidden, , $primary ) = $this->get_column_info(); |
| 124 | - $action_col = false; |
|
| 124 | + $action_col = false; |
|
| 125 | 125 | |
| 126 | 126 | foreach ( $columns as $column_name => $column_display_name ) { |
| 127 | 127 | $class = $column_name . ' column-' . $column_name; |
@@ -133,8 +133,8 @@ discard block |
||
| 133 | 133 | if ( in_array( $column_name, $hidden ) ) { |
| 134 | 134 | $class .= ' frm_hidden'; |
| 135 | 135 | } else if ( ! $action_col && ! in_array( $column_name, array( 'cb', 'id', 'form_id', 'post_id' ) ) ) { |
| 136 | - $action_col = $column_name; |
|
| 137 | - } |
|
| 136 | + $action_col = $column_name; |
|
| 137 | + } |
|
| 138 | 138 | |
| 139 | 139 | $attributes = 'class="' . esc_attr( $class ) . '"'; |
| 140 | 140 | unset($class); |
@@ -152,30 +152,30 @@ discard block |
||
| 152 | 152 | case 'ip': |
| 153 | 153 | case 'id': |
| 154 | 154 | case 'item_key': |
| 155 | - $val = $item->{$col_name}; |
|
| 156 | - break; |
|
| 155 | + $val = $item->{$col_name}; |
|
| 156 | + break; |
|
| 157 | 157 | case 'name': |
| 158 | 158 | case 'description': |
| 159 | - $val = FrmAppHelper::truncate(strip_tags($item->{$col_name}), 100); |
|
| 160 | - break; |
|
| 159 | + $val = FrmAppHelper::truncate(strip_tags($item->{$col_name}), 100); |
|
| 160 | + break; |
|
| 161 | 161 | case 'created_at': |
| 162 | 162 | case 'updated_at': |
| 163 | - $date = FrmAppHelper::get_formatted_time($item->{$col_name}); |
|
| 163 | + $date = FrmAppHelper::get_formatted_time($item->{$col_name}); |
|
| 164 | 164 | $val = '<abbr title="' . esc_attr( FrmAppHelper::get_formatted_time( $item->{$col_name}, '', 'g:i:s A' ) ) . '">' . $date . '</abbr>'; |
| 165 | 165 | break; |
| 166 | 166 | case 'is_draft': |
| 167 | - $val = empty($item->is_draft) ? __( 'No') : __( 'Yes'); |
|
| 168 | - break; |
|
| 167 | + $val = empty($item->is_draft) ? __( 'No') : __( 'Yes'); |
|
| 168 | + break; |
|
| 169 | 169 | case 'form_id': |
| 170 | - $val = FrmFormsHelper::edit_form_link($item->form_id); |
|
| 171 | - break; |
|
| 170 | + $val = FrmFormsHelper::edit_form_link($item->form_id); |
|
| 171 | + break; |
|
| 172 | 172 | case 'post_id': |
| 173 | - $val = FrmAppHelper::post_edit_link($item->post_id); |
|
| 174 | - break; |
|
| 173 | + $val = FrmAppHelper::post_edit_link($item->post_id); |
|
| 174 | + break; |
|
| 175 | 175 | case 'user_id': |
| 176 | - $user = get_userdata($item->user_id); |
|
| 177 | - $val = $user ? $user->user_login : ''; |
|
| 178 | - break; |
|
| 176 | + $user = get_userdata($item->user_id); |
|
| 177 | + $val = $user ? $user->user_login : ''; |
|
| 178 | + break; |
|
| 179 | 179 | case 'parent_item_id': |
| 180 | 180 | $val = $item->parent_item_id; |
| 181 | 181 | break; |
@@ -188,15 +188,15 @@ discard block |
||
| 188 | 188 | } |
| 189 | 189 | |
| 190 | 190 | if ( $col_name != 'cb' ) { |
| 191 | - $r .= "<td $attributes>"; |
|
| 191 | + $r .= "<td $attributes>"; |
|
| 192 | 192 | if ( $column_name == $action_col ) { |
| 193 | 193 | $edit_link = '?page=formidable-entries&frm_action=edit&id=' . $item->id; |
| 194 | 194 | $r .= '<a href="' . esc_url( isset( $actions['edit'] ) ? $edit_link : $view_link ) . '" class="row-title" >' . $val . '</a> '; |
| 195 | - $r .= $action_links; |
|
| 195 | + $r .= $action_links; |
|
| 196 | 196 | } else { |
| 197 | - $r .= $val; |
|
| 198 | - } |
|
| 199 | - $r .= '</td>'; |
|
| 197 | + $r .= $val; |
|
| 198 | + } |
|
| 199 | + $r .= '</td>'; |
|
| 200 | 200 | } |
| 201 | 201 | unset($val); |
| 202 | 202 | } |
@@ -205,19 +205,19 @@ discard block |
||
| 205 | 205 | return $r; |
| 206 | 206 | } |
| 207 | 207 | |
| 208 | - /** |
|
| 209 | - * @param string $view_link |
|
| 210 | - */ |
|
| 211 | - private function get_actions( &$actions, $item, $view_link ) { |
|
| 208 | + /** |
|
| 209 | + * @param string $view_link |
|
| 210 | + */ |
|
| 211 | + private function get_actions( &$actions, $item, $view_link ) { |
|
| 212 | 212 | $actions['view'] = '<a href="' . esc_url( $view_link ) . '">' . __( 'View', 'formidable' ) . '</a>'; |
| 213 | 213 | |
| 214 | - if ( current_user_can('frm_delete_entries') ) { |
|
| 214 | + if ( current_user_can('frm_delete_entries') ) { |
|
| 215 | 215 | $delete_link = '?page=formidable-entries&frm_action=destroy&id=' . $item->id . '&form=' . $this->params['form']; |
| 216 | 216 | $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>'; |
| 217 | - } |
|
| 217 | + } |
|
| 218 | 218 | |
| 219 | - $actions = apply_filters('frm_row_actions', $actions, $item); |
|
| 220 | - } |
|
| 219 | + $actions = apply_filters('frm_row_actions', $actions, $item); |
|
| 220 | + } |
|
| 221 | 221 | |
| 222 | 222 | private function get_column_value( $item, &$val ) { |
| 223 | 223 | $col_name = $this->column_name; |