@@ -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,15 +154,15 @@ discard block |
||
| 154 | 154 | $val = $this->column_value( compact('item') ); |
| 155 | 155 | } |
| 156 | 156 | |
| 157 | - $r .= "<td $attributes>"; |
|
| 157 | + $r .= "<td $attributes>"; |
|
| 158 | 158 | if ( $column_name == $action_col ) { |
| 159 | 159 | $edit_link = '?page=formidable-entries&frm_action=edit&id=' . $item->id; |
| 160 | 160 | $r .= '<a href="' . esc_url( isset( $actions['edit'] ) ? $edit_link : $view_link ) . '" class="row-title" >' . $val . '</a> '; |
| 161 | - $r .= $action_links; |
|
| 161 | + $r .= $action_links; |
|
| 162 | 162 | } else { |
| 163 | - $r .= $val; |
|
| 164 | - } |
|
| 165 | - $r .= '</td>'; |
|
| 163 | + $r .= $val; |
|
| 164 | + } |
|
| 165 | + $r .= '</td>'; |
|
| 166 | 166 | } |
| 167 | 167 | unset($val); |
| 168 | 168 | } |
@@ -217,19 +217,19 @@ discard block |
||
| 217 | 217 | return $val; |
| 218 | 218 | } |
| 219 | 219 | |
| 220 | - /** |
|
| 221 | - * @param string $view_link |
|
| 222 | - */ |
|
| 223 | - private function get_actions( &$actions, $item, $view_link ) { |
|
| 220 | + /** |
|
| 221 | + * @param string $view_link |
|
| 222 | + */ |
|
| 223 | + private function get_actions( &$actions, $item, $view_link ) { |
|
| 224 | 224 | $actions['view'] = '<a href="' . esc_url( $view_link ) . '">' . __( 'View', 'formidable' ) . '</a>'; |
| 225 | 225 | |
| 226 | - if ( current_user_can('frm_delete_entries') ) { |
|
| 226 | + if ( current_user_can('frm_delete_entries') ) { |
|
| 227 | 227 | $delete_link = '?page=formidable-entries&frm_action=destroy&id=' . $item->id . '&form=' . $this->params['form']; |
| 228 | 228 | $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>'; |
| 229 | - } |
|
| 229 | + } |
|
| 230 | 230 | |
| 231 | - $actions = apply_filters('frm_row_actions', $actions, $item); |
|
| 232 | - } |
|
| 231 | + $actions = apply_filters('frm_row_actions', $actions, $item); |
|
| 232 | + } |
|
| 233 | 233 | |
| 234 | 234 | private function get_column_value( $item, &$val ) { |
| 235 | 235 | $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; |
@@ -151,7 +151,7 @@ discard block |
||
| 151 | 151 | if ( in_array( $column_name, $hidden ) ) { |
| 152 | 152 | $val = ''; |
| 153 | 153 | } else { |
| 154 | - $val = $this->column_value( compact('item') ); |
|
| 154 | + $val = $this->column_value( compact( 'item' ) ); |
|
| 155 | 155 | } |
| 156 | 156 | |
| 157 | 157 | $r .= "<td $attributes>"; |
@@ -164,7 +164,7 @@ discard block |
||
| 164 | 164 | } |
| 165 | 165 | $r .= '</td>'; |
| 166 | 166 | } |
| 167 | - unset($val); |
|
| 167 | + unset( $val ); |
|
| 168 | 168 | } |
| 169 | 169 | $r .= '</tr>'; |
| 170 | 170 | |
@@ -192,7 +192,7 @@ discard block |
||
| 192 | 192 | $val = '<abbr title="' . esc_attr( FrmAppHelper::get_formatted_time( $item->{$col_name}, '', 'g:i:s A' ) ) . '">' . $date . '</abbr>'; |
| 193 | 193 | break; |
| 194 | 194 | case 'is_draft': |
| 195 | - $val = empty($item->is_draft) ? __( 'No' ) : __( 'Yes' ); |
|
| 195 | + $val = empty( $item->is_draft ) ? __( 'No' ) : __( 'Yes' ); |
|
| 196 | 196 | break; |
| 197 | 197 | case 'form_id': |
| 198 | 198 | $val = FrmFormsHelper::edit_form_link( $item->form_id ); |
@@ -223,12 +223,12 @@ discard block |
||
| 223 | 223 | private function get_actions( &$actions, $item, $view_link ) { |
| 224 | 224 | $actions['view'] = '<a href="' . esc_url( $view_link ) . '">' . __( 'View', 'formidable' ) . '</a>'; |
| 225 | 225 | |
| 226 | - if ( current_user_can('frm_delete_entries') ) { |
|
| 226 | + if ( current_user_can( 'frm_delete_entries' ) ) { |
|
| 227 | 227 | $delete_link = '?page=formidable-entries&frm_action=destroy&id=' . $item->id . '&form=' . $this->params['form']; |
| 228 | 228 | $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>'; |
| 229 | 229 | } |
| 230 | 230 | |
| 231 | - $actions = apply_filters('frm_row_actions', $actions, $item); |
|
| 231 | + $actions = apply_filters( 'frm_row_actions', $actions, $item ); |
|
| 232 | 232 | } |
| 233 | 233 | |
| 234 | 234 | private function get_column_value( $item, &$val ) { |