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