@@ -43,30 +43,30 @@ discard block |
||
| 43 | 43 | ), |
| 44 | 44 | ); |
| 45 | 45 | switch ( $this->status ) { |
| 46 | - case 'template': |
|
| 47 | - $s_query['is_template'] = 1; |
|
| 48 | - $s_query['status !'] = 'trash'; |
|
| 49 | - break; |
|
| 50 | - case 'draft': |
|
| 51 | - $s_query['is_template'] = 0; |
|
| 52 | - $s_query['status'] = 'draft'; |
|
| 53 | - break; |
|
| 54 | - case 'trash': |
|
| 55 | - $s_query['status'] = 'trash'; |
|
| 56 | - break; |
|
| 57 | - default: |
|
| 58 | - $s_query['is_template'] = 0; |
|
| 59 | - $s_query['status !'] = 'trash'; |
|
| 60 | - break; |
|
| 46 | + case 'template': |
|
| 47 | + $s_query['is_template'] = 1; |
|
| 48 | + $s_query['status !'] = 'trash'; |
|
| 49 | + break; |
|
| 50 | + case 'draft': |
|
| 51 | + $s_query['is_template'] = 0; |
|
| 52 | + $s_query['status'] = 'draft'; |
|
| 53 | + break; |
|
| 54 | + case 'trash': |
|
| 55 | + $s_query['status'] = 'trash'; |
|
| 56 | + break; |
|
| 57 | + default: |
|
| 58 | + $s_query['is_template'] = 0; |
|
| 59 | + $s_query['status !'] = 'trash'; |
|
| 60 | + break; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | $s = self::get_param( array( |
| 64 | 64 | 'param' => 's', |
| 65 | 65 | 'sanitize' => 'sanitize_text_field', |
| 66 | 66 | ) ); |
| 67 | - if ( $s != '' ) { |
|
| 68 | - preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches); |
|
| 69 | - $search_terms = array_map('trim', $matches[0]); |
|
| 67 | + if ( $s != '' ) { |
|
| 68 | + preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches); |
|
| 69 | + $search_terms = array_map('trim', $matches[0]); |
|
| 70 | 70 | foreach ( (array) $search_terms as $term ) { |
| 71 | 71 | $s_query[] = array( |
| 72 | 72 | 'or' => true, |
@@ -76,10 +76,10 @@ discard block |
||
| 76 | 76 | ); |
| 77 | 77 | unset( $term ); |
| 78 | 78 | } |
| 79 | - } |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | 81 | $this->items = FrmForm::getAll( $s_query, $orderby . ' ' . $order, $start . ',' . $per_page ); |
| 82 | - $total_items = FrmDb::get_count( 'frm_forms', $s_query ); |
|
| 82 | + $total_items = FrmDb::get_count( 'frm_forms', $s_query ); |
|
| 83 | 83 | |
| 84 | 84 | $this->set_pagination_args( array( |
| 85 | 85 | 'total_items' => $total_items, |
@@ -88,7 +88,7 @@ discard block |
||
| 88 | 88 | } |
| 89 | 89 | |
| 90 | 90 | public function no_items() { |
| 91 | - if ( 'template' == $this->status ) { |
|
| 91 | + if ( 'template' == $this->status ) { |
|
| 92 | 92 | esc_html_e( 'No Templates Found.', 'formidable' ); |
| 93 | 93 | } else { |
| 94 | 94 | esc_html_e( 'No Forms Found.', 'formidable' ); |
@@ -99,55 +99,55 @@ discard block |
||
| 99 | 99 | } |
| 100 | 100 | |
| 101 | 101 | public function get_bulk_actions() { |
| 102 | - $actions = array(); |
|
| 102 | + $actions = array(); |
|
| 103 | 103 | |
| 104 | 104 | if ( in_array( $this->status, array( '', 'published' ) ) ) { |
| 105 | - $actions['bulk_create_template'] = __( 'Create Template', 'formidable' ); |
|
| 106 | - } |
|
| 107 | - |
|
| 108 | - if ( 'trash' == $this->status ) { |
|
| 109 | - if ( current_user_can('frm_edit_forms') ) { |
|
| 110 | - $actions['bulk_untrash'] = __( 'Restore', 'formidable' ); |
|
| 111 | - } |
|
| 112 | - |
|
| 113 | - if ( current_user_can('frm_delete_forms') ) { |
|
| 114 | - $actions['bulk_delete'] = __( 'Delete Permanently', 'formidable' ); |
|
| 115 | - } |
|
| 116 | - } else if ( EMPTY_TRASH_DAYS && current_user_can('frm_delete_forms') ) { |
|
| 117 | - $actions['bulk_trash'] = __( 'Move to Trash', 'formidable' ); |
|
| 118 | - } else if ( current_user_can('frm_delete_forms') ) { |
|
| 119 | - $actions['bulk_delete'] = __( 'Delete'); |
|
| 120 | - } |
|
| 121 | - |
|
| 122 | - return $actions; |
|
| 123 | - } |
|
| 105 | + $actions['bulk_create_template'] = __( 'Create Template', 'formidable' ); |
|
| 106 | + } |
|
| 107 | + |
|
| 108 | + if ( 'trash' == $this->status ) { |
|
| 109 | + if ( current_user_can('frm_edit_forms') ) { |
|
| 110 | + $actions['bulk_untrash'] = __( 'Restore', 'formidable' ); |
|
| 111 | + } |
|
| 112 | + |
|
| 113 | + if ( current_user_can('frm_delete_forms') ) { |
|
| 114 | + $actions['bulk_delete'] = __( 'Delete Permanently', 'formidable' ); |
|
| 115 | + } |
|
| 116 | + } else if ( EMPTY_TRASH_DAYS && current_user_can('frm_delete_forms') ) { |
|
| 117 | + $actions['bulk_trash'] = __( 'Move to Trash', 'formidable' ); |
|
| 118 | + } else if ( current_user_can('frm_delete_forms') ) { |
|
| 119 | + $actions['bulk_delete'] = __( 'Delete'); |
|
| 120 | + } |
|
| 121 | + |
|
| 122 | + return $actions; |
|
| 123 | + } |
|
| 124 | 124 | |
| 125 | 125 | public function extra_tablenav( $which ) { |
| 126 | - if ( 'top' != $which ) { |
|
| 127 | - return; |
|
| 128 | - } |
|
| 126 | + if ( 'top' != $which ) { |
|
| 127 | + return; |
|
| 128 | + } |
|
| 129 | 129 | |
| 130 | - if ( 'trash' == $this->status && current_user_can('frm_delete_forms') ) { |
|
| 130 | + if ( 'trash' == $this->status && current_user_can('frm_delete_forms') ) { |
|
| 131 | 131 | ?> |
| 132 | 132 | <div class="alignleft actions frm_visible_overflow"> |
| 133 | 133 | <?php submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false ); ?> |
| 134 | 134 | </div> |
| 135 | 135 | <?php |
| 136 | - return; |
|
| 137 | - } |
|
| 136 | + return; |
|
| 137 | + } |
|
| 138 | 138 | |
| 139 | - if ( 'template' != $this->status ) { |
|
| 140 | - return; |
|
| 141 | - } |
|
| 139 | + if ( 'template' != $this->status ) { |
|
| 140 | + return; |
|
| 141 | + } |
|
| 142 | 142 | |
| 143 | 143 | $where = apply_filters( 'frm_forms_dropdown', array(), '' ); |
| 144 | 144 | $forms = FrmForm::get_published_forms( $where ); |
| 145 | 145 | |
| 146 | - $base = admin_url('admin.php?page=formidable&form_type=template'); |
|
| 147 | - $args = array( |
|
| 148 | - 'frm_action' => 'duplicate', |
|
| 149 | - 'template' => true, |
|
| 150 | - ); |
|
| 146 | + $base = admin_url('admin.php?page=formidable&form_type=template'); |
|
| 147 | + $args = array( |
|
| 148 | + 'frm_action' => 'duplicate', |
|
| 149 | + 'template' => true, |
|
| 150 | + ); |
|
| 151 | 151 | |
| 152 | 152 | ?> |
| 153 | 153 | <div class="alignleft actions frm_visible_overflow"> |
@@ -159,16 +159,16 @@ discard block |
||
| 159 | 159 | ?> |
| 160 | 160 | <li class="frm_dropdown_li"><?php esc_html_e( 'You have not created any forms yet. You must create a form before you can make a template.', 'formidable' ) ?></li> |
| 161 | 161 | <?php |
| 162 | - } else { |
|
| 163 | - foreach ( $forms as $form ) { |
|
| 162 | + } else { |
|
| 163 | + foreach ( $forms as $form ) { |
|
| 164 | 164 | $args['id'] = $form->id; |
| 165 | 165 | ?> |
| 166 | 166 | <li><a href="<?php echo esc_url( add_query_arg( $args, $base ) ); ?>" tabindex="-1"><?php echo esc_html( empty( $form->name ) ? __( '(no title)' ) : FrmAppHelper::truncate( $form->name, 33 ) ); ?></a></li> |
| 167 | 167 | <?php |
| 168 | - unset($form); |
|
| 168 | + unset($form); |
|
| 169 | 169 | } |
| 170 | - } |
|
| 171 | - ?> |
|
| 170 | + } |
|
| 171 | + ?> |
|
| 172 | 172 | </ul> |
| 173 | 173 | </div> |
| 174 | 174 | </div> |
@@ -178,33 +178,33 @@ discard block |
||
| 178 | 178 | public function get_views() { |
| 179 | 179 | |
| 180 | 180 | $statuses = array( |
| 181 | - 'published' => __( 'My Forms', 'formidable' ), |
|
| 182 | - 'template' => __( 'Templates', 'formidable' ), |
|
| 183 | - 'draft' => __( 'Drafts', 'formidable' ), |
|
| 184 | - 'trash' => __( 'Trash', 'formidable' ), |
|
| 181 | + 'published' => __( 'My Forms', 'formidable' ), |
|
| 182 | + 'template' => __( 'Templates', 'formidable' ), |
|
| 183 | + 'draft' => __( 'Drafts', 'formidable' ), |
|
| 184 | + 'trash' => __( 'Trash', 'formidable' ), |
|
| 185 | 185 | ); |
| 186 | 186 | |
| 187 | - $links = array(); |
|
| 188 | - $counts = FrmForm::get_count(); |
|
| 187 | + $links = array(); |
|
| 188 | + $counts = FrmForm::get_count(); |
|
| 189 | 189 | $form_type = self::get_param( array( |
| 190 | 190 | 'param' => 'form_type', |
| 191 | 191 | 'default' => 'published', |
| 192 | 192 | ) ); |
| 193 | 193 | |
| 194 | - foreach ( $statuses as $status => $name ) { |
|
| 194 | + foreach ( $statuses as $status => $name ) { |
|
| 195 | 195 | |
| 196 | - if ( $status == $form_type ) { |
|
| 197 | - $class = ' class="current"'; |
|
| 198 | - } else { |
|
| 199 | - $class = ''; |
|
| 200 | - } |
|
| 196 | + if ( $status == $form_type ) { |
|
| 197 | + $class = ' class="current"'; |
|
| 198 | + } else { |
|
| 199 | + $class = ''; |
|
| 200 | + } |
|
| 201 | 201 | |
| 202 | - if ( $counts->{$status} || 'published' == $status ) { |
|
| 202 | + if ( $counts->{$status} || 'published' == $status ) { |
|
| 203 | 203 | $links[ $status ] = '<a href="' . esc_url( '?page=formidable&form_type=' . $status ) . '" ' . $class . '>' . sprintf( __( '%1$s <span class="count">(%2$s)</span>', 'formidable' ), $name, number_format_i18n( $counts->{$status} ) ) . '</a>'; |
| 204 | - } |
|
| 204 | + } |
|
| 205 | 205 | |
| 206 | - unset($status, $name); |
|
| 207 | - } |
|
| 206 | + unset($status, $name); |
|
| 207 | + } |
|
| 208 | 208 | |
| 209 | 209 | return $links; |
| 210 | 210 | } |
@@ -220,16 +220,16 @@ discard block |
||
| 220 | 220 | } |
| 221 | 221 | |
| 222 | 222 | public function single_row( $item, $style = '' ) { |
| 223 | - global $frm_vars, $mode; |
|
| 223 | + global $frm_vars, $mode; |
|
| 224 | 224 | |
| 225 | 225 | // Set up the hover actions for this user |
| 226 | 226 | $actions = array(); |
| 227 | 227 | $edit_link = '?page=formidable&frm_action=edit&id=' . $item->id; |
| 228 | 228 | $duplicate_link = '?page=formidable&frm_action=duplicate&id=' . $item->id; |
| 229 | 229 | |
| 230 | - $this->get_actions($actions, $item, $edit_link, $duplicate_link); |
|
| 230 | + $this->get_actions($actions, $item, $edit_link, $duplicate_link); |
|
| 231 | 231 | |
| 232 | - $action_links = $this->row_actions( $actions ); |
|
| 232 | + $action_links = $this->row_actions( $actions ); |
|
| 233 | 233 | |
| 234 | 234 | // Set up the checkbox ( because the user is editable, otherwise its empty ) |
| 235 | 235 | $checkbox = '<input type="checkbox" name="item-action[]" id="cb-item-action-' . absint( $item->id ) . '" value="' . esc_attr( $item->id ) . '" />'; |
@@ -238,9 +238,9 @@ discard block |
||
| 238 | 238 | |
| 239 | 239 | list( $columns, $hidden ) = $this->get_column_info(); |
| 240 | 240 | |
| 241 | - $format = 'Y/m/d'; |
|
| 242 | - if ( 'list' != $mode ) { |
|
| 243 | - $format .= ' \<\b\r \/\> g:i:s a'; |
|
| 241 | + $format = 'Y/m/d'; |
|
| 242 | + if ( 'list' != $mode ) { |
|
| 243 | + $format .= ' \<\b\r \/\> g:i:s a'; |
|
| 244 | 244 | } |
| 245 | 245 | |
| 246 | 246 | foreach ( $columns as $column_name => $column_display_name ) { |
@@ -248,7 +248,7 @@ discard block |
||
| 248 | 248 | |
| 249 | 249 | $style = ''; |
| 250 | 250 | if ( in_array( $column_name, $hidden ) ) { |
| 251 | - $class .= ' frm_hidden'; |
|
| 251 | + $class .= ' frm_hidden'; |
|
| 252 | 252 | } |
| 253 | 253 | |
| 254 | 254 | $class = 'class="' . esc_attr( $class ) . '"'; |
@@ -261,41 +261,41 @@ discard block |
||
| 261 | 261 | break; |
| 262 | 262 | case 'id': |
| 263 | 263 | case 'form_key': |
| 264 | - $val = $item->{$column_name}; |
|
| 265 | - break; |
|
| 264 | + $val = $item->{$column_name}; |
|
| 265 | + break; |
|
| 266 | 266 | case 'name': |
| 267 | - $val = $this->get_form_name( $item, $actions, $edit_link, $mode ); |
|
| 268 | - $val .= $action_links; |
|
| 267 | + $val = $this->get_form_name( $item, $actions, $edit_link, $mode ); |
|
| 268 | + $val .= $action_links; |
|
| 269 | 269 | |
| 270 | - break; |
|
| 270 | + break; |
|
| 271 | 271 | case 'created_at': |
| 272 | - $date = date($format, strtotime($item->created_at)); |
|
| 272 | + $date = date($format, strtotime($item->created_at)); |
|
| 273 | 273 | $val = '<abbr title="' . esc_attr( date( 'Y/m/d g:i:s A', strtotime( $item->created_at ) ) ) . '">' . $date . '</abbr>'; |
| 274 | 274 | break; |
| 275 | 275 | case 'shortcode': |
| 276 | 276 | $val = '<input type="text" readonly="readonly" class="frm_select_box" value="' . esc_attr( '[formidable id=' . $item->id . ']' ) . '" /><br/>'; |
| 277 | - if ( 'excerpt' == $mode ) { |
|
| 277 | + if ( 'excerpt' == $mode ) { |
|
| 278 | 278 | $val .= '<input type="text" readonly="readonly" class="frm_select_box" value="' . esc_attr( '[formidable key=' . $item->form_key . ']' ) . '" />'; |
| 279 | - } |
|
| 280 | - break; |
|
| 281 | - case 'entries': |
|
| 279 | + } |
|
| 280 | + break; |
|
| 281 | + case 'entries': |
|
| 282 | 282 | if ( isset( $item->options['no_save'] ) && $item->options['no_save'] ) { |
| 283 | 283 | $val = '<i class="frm_icon_font frm_forbid_icon frm_bstooltip" title="' . esc_attr('Saving entries is disabled for this form', 'formidable' ) . '"></i>'; |
| 284 | - } else { |
|
| 285 | - $text = FrmEntry::getRecordCount($item->id); |
|
| 284 | + } else { |
|
| 285 | + $text = FrmEntry::getRecordCount($item->id); |
|
| 286 | 286 | $val = current_user_can('frm_view_entries') ? '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-entries&form=' . $item->id ) ) . '">' . $text . '</a>' : $text; |
| 287 | - unset($text); |
|
| 288 | - } |
|
| 289 | - break; |
|
| 290 | - case 'type': |
|
| 291 | - $val = ( $item->is_template && $item->default_template ) ? __( 'Default', 'formidable' ) : __( 'Custom', 'formidable' ); |
|
| 292 | - break; |
|
| 287 | + unset($text); |
|
| 288 | + } |
|
| 289 | + break; |
|
| 290 | + case 'type': |
|
| 291 | + $val = ( $item->is_template && $item->default_template ) ? __( 'Default', 'formidable' ) : __( 'Custom', 'formidable' ); |
|
| 292 | + break; |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | if ( isset($val) ) { |
| 296 | - $r .= "<td $attributes>"; |
|
| 297 | - $r .= $val; |
|
| 298 | - $r .= '</td>'; |
|
| 296 | + $r .= "<td $attributes>"; |
|
| 297 | + $r .= $val; |
|
| 298 | + $r .= '</td>'; |
|
| 299 | 299 | } |
| 300 | 300 | unset($val); |
| 301 | 301 | } |
@@ -304,38 +304,38 @@ discard block |
||
| 304 | 304 | return $r; |
| 305 | 305 | } |
| 306 | 306 | |
| 307 | - /** |
|
| 308 | - * @param string $edit_link |
|
| 309 | - * @param string $duplicate_link |
|
| 310 | - */ |
|
| 311 | - private function get_actions( &$actions, $item, $edit_link, $duplicate_link ) { |
|
| 307 | + /** |
|
| 308 | + * @param string $edit_link |
|
| 309 | + * @param string $duplicate_link |
|
| 310 | + */ |
|
| 311 | + private function get_actions( &$actions, $item, $edit_link, $duplicate_link ) { |
|
| 312 | 312 | if ( 'trash' == $this->status ) { |
| 313 | 313 | if ( current_user_can('frm_edit_forms') ) { |
| 314 | 314 | $actions['restore'] = FrmFormsHelper::delete_trash_link( $item->id, $item->status, 'short' ); |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | - if ( current_user_can('frm_delete_forms') ) { |
|
| 317 | + if ( current_user_can('frm_delete_forms') ) { |
|
| 318 | 318 | $trash_url = wp_nonce_url( '?page=formidable&form_status=trash&frm_action=destroy&id=' . $item->id, 'destroy_form_' . $item->id ); |
| 319 | 319 | $actions['trash'] = '<a href="' . esc_url( $trash_url ) . '" class="submitdelete" onclick="return confirm(\'' . __( 'Are you sure you want to permanently delete that?', 'formidable' ) . '\')">' . __( 'Delete Permanently' ) . '</a>'; |
| 320 | - } |
|
| 321 | - return; |
|
| 320 | + } |
|
| 321 | + return; |
|
| 322 | 322 | } |
| 323 | 323 | |
| 324 | 324 | if ( current_user_can('frm_edit_forms') ) { |
| 325 | - if ( ! $item->is_template || ! $item->default_template ) { |
|
| 325 | + if ( ! $item->is_template || ! $item->default_template ) { |
|
| 326 | 326 | $actions['frm_edit'] = '<a href="' . esc_url( $edit_link ) . '">' . __( 'Edit' ) . '</a>'; |
| 327 | - } |
|
| 327 | + } |
|
| 328 | 328 | |
| 329 | - if ( $item->is_template ) { |
|
| 329 | + if ( $item->is_template ) { |
|
| 330 | 330 | $actions['frm_duplicate'] = '<a href="' . esc_url( wp_nonce_url( $duplicate_link ) ) . '">' . __( 'Create Form from Template', 'formidable' ) . '</a>'; |
| 331 | - } else { |
|
| 331 | + } else { |
|
| 332 | 332 | $actions['frm_settings'] = '<a href="' . esc_url( '?page=formidable&frm_action=settings&id=' . $item->id ) . '">' . __( 'Settings', 'formidable' ) . '</a>'; |
| 333 | 333 | |
| 334 | - if ( FrmAppHelper::pro_is_installed() ) { |
|
| 334 | + if ( FrmAppHelper::pro_is_installed() ) { |
|
| 335 | 335 | $actions['duplicate'] = '<a href="' . esc_url( wp_nonce_url( $duplicate_link ) ) . '">' . __( 'Duplicate', 'formidable' ) . '</a>'; |
| 336 | - } |
|
| 337 | - } |
|
| 338 | - } |
|
| 336 | + } |
|
| 337 | + } |
|
| 338 | + } |
|
| 339 | 339 | |
| 340 | 340 | $actions['trash'] = FrmFormsHelper::delete_trash_link( $item->id, $item->status, 'short' ); |
| 341 | 341 | if ( empty( $actions['trash'] ) ) { |
@@ -344,52 +344,52 @@ discard block |
||
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | $actions['view'] = '<a href="' . esc_url( FrmFormsHelper::get_direct_link( $item->form_key, $item ) ) . '" target="_blank">' . __( 'Preview') . '</a>'; |
| 347 | - } |
|
| 347 | + } |
|
| 348 | 348 | |
| 349 | - /** |
|
| 350 | - * @param string $edit_link |
|
| 351 | - */ |
|
| 349 | + /** |
|
| 350 | + * @param string $edit_link |
|
| 351 | + */ |
|
| 352 | 352 | private function get_form_name( $item, $actions, $edit_link, $mode = 'list' ) { |
| 353 | - $form_name = $item->name; |
|
| 354 | - if ( trim($form_name) == '' ) { |
|
| 355 | - $form_name = __( '(no title)'); |
|
| 356 | - } |
|
| 353 | + $form_name = $item->name; |
|
| 354 | + if ( trim($form_name) == '' ) { |
|
| 355 | + $form_name = __( '(no title)'); |
|
| 356 | + } |
|
| 357 | 357 | $form_name = FrmAppHelper::kses( $form_name ); |
| 358 | 358 | if ( 'excerpt' != $mode ) { |
| 359 | 359 | $form_name = FrmAppHelper::truncate( $form_name, 50 ); |
| 360 | 360 | } |
| 361 | 361 | |
| 362 | - $val = '<strong>'; |
|
| 363 | - if ( 'trash' == $this->status ) { |
|
| 364 | - $val .= $form_name; |
|
| 365 | - } else { |
|
| 362 | + $val = '<strong>'; |
|
| 363 | + if ( 'trash' == $this->status ) { |
|
| 364 | + $val .= $form_name; |
|
| 365 | + } else { |
|
| 366 | 366 | $val .= '<a href="' . esc_url( isset( $actions['frm_edit'] ) ? $edit_link : FrmFormsHelper::get_direct_link( $item->form_key, $item ) ) . '" class="row-title">' . FrmAppHelper::kses( $form_name ) . '</a> '; |
| 367 | - } |
|
| 367 | + } |
|
| 368 | 368 | |
| 369 | - $this->add_draft_label( $item, $val ); |
|
| 370 | - $val .= '</strong>'; |
|
| 369 | + $this->add_draft_label( $item, $val ); |
|
| 370 | + $val .= '</strong>'; |
|
| 371 | 371 | |
| 372 | - $this->add_form_description( $item, $val ); |
|
| 372 | + $this->add_form_description( $item, $val ); |
|
| 373 | 373 | |
| 374 | - return $val; |
|
| 375 | - } |
|
| 374 | + return $val; |
|
| 375 | + } |
|
| 376 | 376 | |
| 377 | - /** |
|
| 378 | - * @param string $val |
|
| 379 | - */ |
|
| 380 | - private function add_draft_label( $item, &$val ) { |
|
| 381 | - if ( 'draft' == $item->status && 'draft' != $this->status ) { |
|
| 377 | + /** |
|
| 378 | + * @param string $val |
|
| 379 | + */ |
|
| 380 | + private function add_draft_label( $item, &$val ) { |
|
| 381 | + if ( 'draft' == $item->status && 'draft' != $this->status ) { |
|
| 382 | 382 | $val .= ' - <span class="post-state">' . __( 'Draft', 'formidable' ) . '</span>'; |
| 383 | - } |
|
| 384 | - } |
|
| 385 | - |
|
| 386 | - /** |
|
| 387 | - * @param string $val |
|
| 388 | - */ |
|
| 389 | - private function add_form_description( $item, &$val ) { |
|
| 390 | - global $mode; |
|
| 391 | - if ( 'excerpt' == $mode ) { |
|
| 392 | - $val .= FrmAppHelper::truncate(strip_tags($item->description), 50); |
|
| 393 | - } |
|
| 394 | - } |
|
| 383 | + } |
|
| 384 | + } |
|
| 385 | + |
|
| 386 | + /** |
|
| 387 | + * @param string $val |
|
| 388 | + */ |
|
| 389 | + private function add_form_description( $item, &$val ) { |
|
| 390 | + global $mode; |
|
| 391 | + if ( 'excerpt' == $mode ) { |
|
| 392 | + $val .= FrmAppHelper::truncate(strip_tags($item->description), 50); |
|
| 393 | + } |
|
| 394 | + } |
|
| 395 | 395 | } |
@@ -18,7 +18,7 @@ discard block |
||
| 18 | 18 | $page = $this->get_pagenum(); |
| 19 | 19 | $per_page = $this->get_items_per_page( 'formidable_page_formidable_per_page' ); |
| 20 | 20 | |
| 21 | - $mode = self::get_param( array( |
|
| 21 | + $mode = self::get_param( array( |
|
| 22 | 22 | 'param' => 'mode', |
| 23 | 23 | 'default' => 'list', |
| 24 | 24 | ) ); |
@@ -26,11 +26,11 @@ discard block |
||
| 26 | 26 | 'param' => 'orderby', |
| 27 | 27 | 'default' => 'name', |
| 28 | 28 | ) ); |
| 29 | - $order = self::get_param( array( |
|
| 29 | + $order = self::get_param( array( |
|
| 30 | 30 | 'param' => 'order', |
| 31 | 31 | 'default' => 'ASC', |
| 32 | 32 | ) ); |
| 33 | - $start = self::get_param( array( |
|
| 33 | + $start = self::get_param( array( |
|
| 34 | 34 | 'param' => 'start', |
| 35 | 35 | 'default' => ( $page - 1 ) * $per_page, |
| 36 | 36 | ) ); |
@@ -65,8 +65,8 @@ discard block |
||
| 65 | 65 | 'sanitize' => 'sanitize_text_field', |
| 66 | 66 | ) ); |
| 67 | 67 | if ( $s != '' ) { |
| 68 | - preg_match_all('/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches); |
|
| 69 | - $search_terms = array_map('trim', $matches[0]); |
|
| 68 | + preg_match_all( '/".*?("|$)|((?<=[\\s",+])|^)[^\\s",+]+/', $s, $matches ); |
|
| 69 | + $search_terms = array_map( 'trim', $matches[0] ); |
|
| 70 | 70 | foreach ( (array) $search_terms as $term ) { |
| 71 | 71 | $s_query[] = array( |
| 72 | 72 | 'or' => true, |
@@ -106,17 +106,17 @@ discard block |
||
| 106 | 106 | } |
| 107 | 107 | |
| 108 | 108 | if ( 'trash' == $this->status ) { |
| 109 | - if ( current_user_can('frm_edit_forms') ) { |
|
| 109 | + if ( current_user_can( 'frm_edit_forms' ) ) { |
|
| 110 | 110 | $actions['bulk_untrash'] = __( 'Restore', 'formidable' ); |
| 111 | 111 | } |
| 112 | 112 | |
| 113 | - if ( current_user_can('frm_delete_forms') ) { |
|
| 113 | + if ( current_user_can( 'frm_delete_forms' ) ) { |
|
| 114 | 114 | $actions['bulk_delete'] = __( 'Delete Permanently', 'formidable' ); |
| 115 | 115 | } |
| 116 | - } else if ( EMPTY_TRASH_DAYS && current_user_can('frm_delete_forms') ) { |
|
| 116 | + } else if ( EMPTY_TRASH_DAYS && current_user_can( 'frm_delete_forms' ) ) { |
|
| 117 | 117 | $actions['bulk_trash'] = __( 'Move to Trash', 'formidable' ); |
| 118 | - } else if ( current_user_can('frm_delete_forms') ) { |
|
| 119 | - $actions['bulk_delete'] = __( 'Delete'); |
|
| 118 | + } else if ( current_user_can( 'frm_delete_forms' ) ) { |
|
| 119 | + $actions['bulk_delete'] = __( 'Delete' ); |
|
| 120 | 120 | } |
| 121 | 121 | |
| 122 | 122 | return $actions; |
@@ -127,7 +127,7 @@ discard block |
||
| 127 | 127 | return; |
| 128 | 128 | } |
| 129 | 129 | |
| 130 | - if ( 'trash' == $this->status && current_user_can('frm_delete_forms') ) { |
|
| 130 | + if ( 'trash' == $this->status && current_user_can( 'frm_delete_forms' ) ) { |
|
| 131 | 131 | ?> |
| 132 | 132 | <div class="alignleft actions frm_visible_overflow"> |
| 133 | 133 | <?php submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false ); ?> |
@@ -143,7 +143,7 @@ discard block |
||
| 143 | 143 | $where = apply_filters( 'frm_forms_dropdown', array(), '' ); |
| 144 | 144 | $forms = FrmForm::get_published_forms( $where ); |
| 145 | 145 | |
| 146 | - $base = admin_url('admin.php?page=formidable&form_type=template'); |
|
| 146 | + $base = admin_url( 'admin.php?page=formidable&form_type=template' ); |
|
| 147 | 147 | $args = array( |
| 148 | 148 | 'frm_action' => 'duplicate', |
| 149 | 149 | 'template' => true, |
@@ -165,7 +165,7 @@ discard block |
||
| 165 | 165 | ?> |
| 166 | 166 | <li><a href="<?php echo esc_url( add_query_arg( $args, $base ) ); ?>" tabindex="-1"><?php echo esc_html( empty( $form->name ) ? __( '(no title)' ) : FrmAppHelper::truncate( $form->name, 33 ) ); ?></a></li> |
| 167 | 167 | <?php |
| 168 | - unset($form); |
|
| 168 | + unset( $form ); |
|
| 169 | 169 | } |
| 170 | 170 | } |
| 171 | 171 | ?> |
@@ -200,10 +200,10 @@ discard block |
||
| 200 | 200 | } |
| 201 | 201 | |
| 202 | 202 | if ( $counts->{$status} || 'published' == $status ) { |
| 203 | - $links[ $status ] = '<a href="' . esc_url( '?page=formidable&form_type=' . $status ) . '" ' . $class . '>' . sprintf( __( '%1$s <span class="count">(%2$s)</span>', 'formidable' ), $name, number_format_i18n( $counts->{$status} ) ) . '</a>'; |
|
| 203 | + $links[$status] = '<a href="' . esc_url( '?page=formidable&form_type=' . $status ) . '" ' . $class . '>' . sprintf( __( '%1$s <span class="count">(%2$s)</span>', 'formidable' ), $name, number_format_i18n( $counts->{$status} ) ) . '</a>'; |
|
| 204 | 204 | } |
| 205 | 205 | |
| 206 | - unset($status, $name); |
|
| 206 | + unset( $status, $name ); |
|
| 207 | 207 | } |
| 208 | 208 | |
| 209 | 209 | return $links; |
@@ -227,7 +227,7 @@ discard block |
||
| 227 | 227 | $edit_link = '?page=formidable&frm_action=edit&id=' . $item->id; |
| 228 | 228 | $duplicate_link = '?page=formidable&frm_action=duplicate&id=' . $item->id; |
| 229 | 229 | |
| 230 | - $this->get_actions($actions, $item, $edit_link, $duplicate_link); |
|
| 230 | + $this->get_actions( $actions, $item, $edit_link, $duplicate_link ); |
|
| 231 | 231 | |
| 232 | 232 | $action_links = $this->row_actions( $actions ); |
| 233 | 233 | |
@@ -269,7 +269,7 @@ discard block |
||
| 269 | 269 | |
| 270 | 270 | break; |
| 271 | 271 | case 'created_at': |
| 272 | - $date = date($format, strtotime($item->created_at)); |
|
| 272 | + $date = date( $format, strtotime( $item->created_at ) ); |
|
| 273 | 273 | $val = '<abbr title="' . esc_attr( date( 'Y/m/d g:i:s A', strtotime( $item->created_at ) ) ) . '">' . $date . '</abbr>'; |
| 274 | 274 | break; |
| 275 | 275 | case 'shortcode': |
@@ -280,11 +280,11 @@ discard block |
||
| 280 | 280 | break; |
| 281 | 281 | case 'entries': |
| 282 | 282 | if ( isset( $item->options['no_save'] ) && $item->options['no_save'] ) { |
| 283 | - $val = '<i class="frm_icon_font frm_forbid_icon frm_bstooltip" title="' . esc_attr('Saving entries is disabled for this form', 'formidable' ) . '"></i>'; |
|
| 283 | + $val = '<i class="frm_icon_font frm_forbid_icon frm_bstooltip" title="' . esc_attr( 'Saving entries is disabled for this form', 'formidable' ) . '"></i>'; |
|
| 284 | 284 | } else { |
| 285 | - $text = FrmEntry::getRecordCount($item->id); |
|
| 286 | - $val = current_user_can('frm_view_entries') ? '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-entries&form=' . $item->id ) ) . '">' . $text . '</a>' : $text; |
|
| 287 | - unset($text); |
|
| 285 | + $text = FrmEntry::getRecordCount( $item->id ); |
|
| 286 | + $val = current_user_can( 'frm_view_entries' ) ? '<a href="' . esc_url( admin_url( 'admin.php?page=formidable-entries&form=' . $item->id ) ) . '">' . $text . '</a>' : $text; |
|
| 287 | + unset( $text ); |
|
| 288 | 288 | } |
| 289 | 289 | break; |
| 290 | 290 | case 'type': |
@@ -292,12 +292,12 @@ discard block |
||
| 292 | 292 | break; |
| 293 | 293 | } |
| 294 | 294 | |
| 295 | - if ( isset($val) ) { |
|
| 295 | + if ( isset( $val ) ) { |
|
| 296 | 296 | $r .= "<td $attributes>"; |
| 297 | 297 | $r .= $val; |
| 298 | 298 | $r .= '</td>'; |
| 299 | 299 | } |
| 300 | - unset($val); |
|
| 300 | + unset( $val ); |
|
| 301 | 301 | } |
| 302 | 302 | $r .= '</tr>'; |
| 303 | 303 | |
@@ -310,18 +310,18 @@ discard block |
||
| 310 | 310 | */ |
| 311 | 311 | private function get_actions( &$actions, $item, $edit_link, $duplicate_link ) { |
| 312 | 312 | if ( 'trash' == $this->status ) { |
| 313 | - if ( current_user_can('frm_edit_forms') ) { |
|
| 313 | + if ( current_user_can( 'frm_edit_forms' ) ) { |
|
| 314 | 314 | $actions['restore'] = FrmFormsHelper::delete_trash_link( $item->id, $item->status, 'short' ); |
| 315 | 315 | } |
| 316 | 316 | |
| 317 | - if ( current_user_can('frm_delete_forms') ) { |
|
| 317 | + if ( current_user_can( 'frm_delete_forms' ) ) { |
|
| 318 | 318 | $trash_url = wp_nonce_url( '?page=formidable&form_status=trash&frm_action=destroy&id=' . $item->id, 'destroy_form_' . $item->id ); |
| 319 | 319 | $actions['trash'] = '<a href="' . esc_url( $trash_url ) . '" class="submitdelete" onclick="return confirm(\'' . __( 'Are you sure you want to permanently delete that?', 'formidable' ) . '\')">' . __( 'Delete Permanently' ) . '</a>'; |
| 320 | 320 | } |
| 321 | 321 | return; |
| 322 | 322 | } |
| 323 | 323 | |
| 324 | - if ( current_user_can('frm_edit_forms') ) { |
|
| 324 | + if ( current_user_can( 'frm_edit_forms' ) ) { |
|
| 325 | 325 | if ( ! $item->is_template || ! $item->default_template ) { |
| 326 | 326 | $actions['frm_edit'] = '<a href="' . esc_url( $edit_link ) . '">' . __( 'Edit' ) . '</a>'; |
| 327 | 327 | } |
@@ -343,7 +343,7 @@ discard block |
||
| 343 | 343 | unset( $actions['trash'] ); |
| 344 | 344 | } |
| 345 | 345 | |
| 346 | - $actions['view'] = '<a href="' . esc_url( FrmFormsHelper::get_direct_link( $item->form_key, $item ) ) . '" target="_blank">' . __( 'Preview') . '</a>'; |
|
| 346 | + $actions['view'] = '<a href="' . esc_url( FrmFormsHelper::get_direct_link( $item->form_key, $item ) ) . '" target="_blank">' . __( 'Preview' ) . '</a>'; |
|
| 347 | 347 | } |
| 348 | 348 | |
| 349 | 349 | /** |
@@ -351,8 +351,8 @@ discard block |
||
| 351 | 351 | */ |
| 352 | 352 | private function get_form_name( $item, $actions, $edit_link, $mode = 'list' ) { |
| 353 | 353 | $form_name = $item->name; |
| 354 | - if ( trim($form_name) == '' ) { |
|
| 355 | - $form_name = __( '(no title)'); |
|
| 354 | + if ( trim( $form_name ) == '' ) { |
|
| 355 | + $form_name = __( '(no title)' ); |
|
| 356 | 356 | } |
| 357 | 357 | $form_name = FrmAppHelper::kses( $form_name ); |
| 358 | 358 | if ( 'excerpt' != $mode ) { |
@@ -389,7 +389,7 @@ discard block |
||
| 389 | 389 | private function add_form_description( $item, &$val ) { |
| 390 | 390 | global $mode; |
| 391 | 391 | if ( 'excerpt' == $mode ) { |
| 392 | - $val .= FrmAppHelper::truncate(strip_tags($item->description), 50); |
|
| 392 | + $val .= FrmAppHelper::truncate( strip_tags( $item->description ), 50 ); |
|
| 393 | 393 | } |
| 394 | 394 | } |
| 395 | 395 | } |