Overview

Namespaces

  • None
  • Quform
    • Traduttore_Registry

Classes

  • Quform
  • Quform_Admin_InsertForm
  • Quform_Admin_Page
  • Quform_Admin_Page_Controller
  • Quform_Admin_Page_Dashboard
  • Quform_Admin_Page_Entries
  • Quform_Admin_Page_Entries_Edit
  • Quform_Admin_Page_Entries_List
  • Quform_Admin_Page_Entries_View
  • Quform_Admin_Page_Factory
  • Quform_Admin_Page_Forms_Add
  • Quform_Admin_Page_Forms_Edit
  • Quform_Admin_Page_Forms_List
  • Quform_Admin_Page_Help
  • Quform_Admin_Page_Preview
  • Quform_Admin_Page_Settings
  • Quform_Admin_Page_Tools
  • Quform_Admin_Page_Tools_ExportEntries
  • Quform_Admin_Page_Tools_ExportForm
  • Quform_Admin_Page_Tools_Home
  • Quform_Admin_Page_Tools_ImportForm
  • Quform_Admin_Page_Tools_Migrate
  • Quform_Admin_Page_Tools_Uninstall
  • Quform_Api
  • Quform_Block
  • Quform_Builder
  • Quform_Captcha
  • Quform_ClassLoader
  • Quform_Confirmation
  • Quform_Container
  • Quform_Dashboard_Widget
  • Quform_Dispatcher
  • Quform_Element
  • Quform_Element_Captcha
  • Quform_Element_Checkbox
  • Quform_Element_Column
  • Quform_Element_Container
  • Quform_Element_Container_Iterator
  • Quform_Element_Date
  • Quform_Element_Email
  • Quform_Element_Factory
  • Quform_Element_Field
  • Quform_Element_File
  • Quform_Element_Group
  • Quform_Element_Hidden
  • Quform_Element_Honeypot
  • Quform_Element_Html
  • Quform_Element_Multi
  • Quform_Element_Multiselect
  • Quform_Element_Name
  • Quform_Element_Page
  • Quform_Element_Password
  • Quform_Element_Radio
  • Quform_Element_Recaptcha
  • Quform_Element_Row
  • Quform_Element_Select
  • Quform_Element_Submit
  • Quform_Element_Text
  • Quform_Element_Textarea
  • Quform_Element_Time
  • Quform_Entry_Controller
  • Quform_Entry_Exporter
  • Quform_Entry_List_Settings
  • Quform_Entry_List_Table
  • Quform_Entry_Processor
  • Quform_Entry_UserSearcher
  • Quform_Filter_Abstract
  • Quform_Filter_Alpha
  • Quform_Filter_AlphaNumeric
  • Quform_Filter_Digits
  • Quform_Filter_Regex
  • Quform_Filter_Static
  • Quform_Filter_StripTags
  • Quform_Filter_Trim
  • Quform_Form
  • Quform_Form_Controller
  • Quform_Form_Exporter
  • Quform_Form_Factory
  • Quform_Form_Importer
  • Quform_Form_Iterator
  • Quform_Form_List_Settings
  • Quform_Form_List_Table
  • Quform_Form_Processor
  • Quform_License
  • Quform_Migrator
  • Quform_NonceRefresher
  • Quform_Notification
  • Quform_Notification_Resender
  • Quform_Options
  • Quform_Permissions
  • Quform_Repository
  • Quform_ScriptLoader
  • Quform_Session
  • Quform_Settings
  • Quform_Shortcode
  • Quform_Themes
  • Quform_TokenReplacer
  • Quform_Toolbar
  • Quform_Translations
  • Quform_Updater
  • Quform_Upgrader
  • Quform_Uploader
  • Quform_Validator_Abstract
  • Quform_Validator_Alpha
  • Quform_Validator_AlphaNumeric
  • Quform_Validator_Array
  • Quform_Validator_Captcha
  • Quform_Validator_Date
  • Quform_Validator_Digits
  • Quform_Validator_Duplicate
  • Quform_Validator_Email
  • Quform_Validator_FileUpload
  • Quform_Validator_GreaterThan
  • Quform_Validator_Honeypot
  • Quform_Validator_Identical
  • Quform_Validator_InArray
  • Quform_Validator_Length
  • Quform_Validator_LessThan
  • Quform_Validator_Recaptcha
  • Quform_Validator_Regex
  • Quform_Validator_Required
  • Quform_Validator_Static
  • Quform_Validator_Time
  • Quform_View
  • Quform_ViewFactory
  • Quform_Widget_Form
  • Quform_Widget_Popup

Interfaces

  • Quform_Attachable
  • Quform_Element_Editable
  • Quform_Filter_Interface
  • Quform_Validator_Interface

Constants

  • Quform\Traduttore_Registry\TRANSIENT_KEY_PLUGIN
  • Quform\Traduttore_Registry\TRANSIENT_KEY_THEME

Functions

  • Quform\Traduttore_Registry\add_project
  • Quform\Traduttore_Registry\clean_translations_cache
  • Quform\Traduttore_Registry\get_available_locales
  • Quform\Traduttore_Registry\get_installed_translations
  • Quform\Traduttore_Registry\get_translations
  • Quform\Traduttore_Registry\register_clean_translations_cache
  • Quform\Traduttore_Registry\sanitize_date
  • Overview
  • Namespace
  • Class
  1: <?php
  2: 
  3: /**
  4:  * @copyright Copyright (c) 2009-2022 ThemeCatcher (https://www.themecatcher.net)
  5:  */
  6: class Quform_Form_List_Table extends WP_List_Table
  7: {
  8:     /**
  9:      * @var Quform_Repository
 10:      */
 11:     protected $repository;
 12: 
 13:     /**
 14:      * @var Quform_Options
 15:      */
 16:     protected $options;
 17: 
 18:     /**
 19:      * @var string|null
 20:      */
 21:     protected $view;
 22: 
 23:     /**
 24:      * @param  Quform_Repository  $repository
 25:      * @param  Quform_Options     $options
 26:      */
 27:     public function __construct(Quform_Repository $repository, Quform_Options $options)
 28:     {
 29:         parent::__construct(array(
 30:             'singular' => 'qfb-form',
 31:             'plural' => 'qfb-forms'
 32:         ));
 33: 
 34:         $this->repository = $repository;
 35:         $this->options = $options;
 36:     }
 37: 
 38:     /**
 39:      * Prepares the list of items for displaying
 40:      */
 41:     public function prepare_items()
 42:     {
 43:         $this->view = Quform::get($_GET, 'view');
 44:         $perPage = $this->get_items_per_page('quform_forms_per_page');
 45: 
 46:         $args = array(
 47:             'active' => null,
 48:             'orderby' => $this->getOrderBy(strtolower((string) Quform::get($_GET, 'orderby'))),
 49:             'order' => $this->getOrder(strtolower((string) Quform::get($_GET, 'order'))),
 50:             'trashed' => false,
 51:             'limit' => $perPage,
 52:             'offset' => ($this->get_pagenum() - 1) * $perPage,
 53:             'search' => isset($_GET['s']) && Quform::isNonEmptyString($_GET['s']) ? wp_unslash($_GET['s']) : ''
 54:         );
 55: 
 56:         switch ($this->view) {
 57:             case 'active':
 58:                 $args['active'] = true;
 59:                 break;
 60:             case 'inactive':
 61:                 $args['active'] = false;
 62:                 break;
 63:             case 'trashed':
 64:                 $args['trashed'] = true;
 65:                 break;
 66:         }
 67: 
 68:         $this->items = $this->repository->getForms($args);
 69: 
 70:         $foundItems = $this->repository->getFoundRows();
 71: 
 72:         $this->set_pagination_args(array(
 73:             'total_items' => $foundItems,
 74:             'total_pages' => ceil($foundItems / $args['limit']),
 75:             'per_page' => $args['limit']
 76:         ));
 77:     }
 78: 
 79:     /**
 80:      * Display the list of views available on this table
 81:      */
 82:     public function views()
 83:     {
 84:         $views = $this->get_views();
 85: 
 86:         if (empty($views)) {
 87:             return;
 88:         }
 89: 
 90:         echo '<div class="qfb-sub-nav qfb-cf">';
 91:         echo '<ul class="qfb-sub-nav-ul">';
 92: 
 93:         foreach ($views as $class => $view) {
 94:             printf('<li class="qfb-view-%s">%s</li>', $class, $view);
 95:         }
 96: 
 97:         echo '</ul>';
 98:         echo '</div>';
 99:     }
100: 
101:     /**
102:      * Get an associative array ( id => link ) with the list of views available on this table
103:      *
104:      * @return array
105:      */
106:     protected function get_views()
107:     {
108:         $isSearch = isset($_GET['s']) && Quform::isNonEmptyString($_GET['s']);
109:         $views = array();
110: 
111:         $views['all'] = sprintf(
112:             '<a href="%s" class="%s">%s <span class="count">(%s)</span></a>',
113:             esc_url(admin_url('admin.php?page=quform.forms')),
114:             $this->view === null && !$isSearch ? 'qfb-current' : '',
115:             esc_html__('All', 'quform'),
116:             number_format_i18n($this->repository->count())
117:         );
118: 
119:         $views['active'] = sprintf(
120:             '<a href="%s" class="%s">%s <span class="count">(%s)</span></a>',
121:             esc_url(admin_url('admin.php?page=quform.forms&view=active')),
122:             $this->view === 'active' && !$isSearch ? 'qfb-current' : '',
123:             esc_html__('Active', 'quform'),
124:             number_format_i18n($this->repository->count(true))
125:         );
126: 
127:         $views['inactive'] = sprintf(
128:             '<a href="%s" class="%s">%s <span class="count">(%s)</span></a>',
129:             esc_url(admin_url('admin.php?page=quform.forms&view=inactive')),
130:             $this->view === 'inactive' && !$isSearch ? 'qfb-current' : '',
131:             esc_html__('Inactive', 'quform'),
132:             number_format_i18n($this->repository->count(false))
133:         );
134: 
135:         $views['trash'] = sprintf(
136:             '<a href="%s" class="%s">%s <span class="count">(%s)</span></a>',
137:             esc_url(admin_url('admin.php?page=quform.forms&view=trashed')),
138:             $this->view === 'trashed' && !$isSearch ? 'qfb-current' : '',
139:             esc_html__('Trash', 'quform'),
140:             number_format_i18n($this->repository->count(null, true))
141:         );
142: 
143:         if ($isSearch) {
144:             $views['search'] = sprintf(
145:                 '<a class="qfb-current">%s <span class="count">(%s)</span></a>',
146:                 esc_html(sprintf(__('Search results for &#8220;%s&#8221;', 'quform'), wp_unslash($_GET['s']))),
147:                 number_format_i18n($this->_pagination_args['total_items'])
148:             );
149:         }
150: 
151:         return $views;
152:     }
153: 
154:     /**
155:      * Get the list of columns
156:      *
157:      * @return array
158:      */
159:     public function get_columns()
160:     {
161:         return array(
162:             'cb' => '<input type="checkbox" />',
163:             'name' => esc_html__('Name', 'quform'),
164:             'shortcode' => '',
165:             'entries' => esc_html__('Entries', 'quform'),
166:             'active' => esc_html__('Active', 'quform'),
167:             'updated_at' => esc_html__('Last modified', 'quform')
168:         );
169:     }
170: 
171:     /**
172:      * Get the checkbox column content for the given item
173:      *
174:      * @param   array   $item
175:      * @return  string
176:      */
177:     protected function column_cb($item)
178:     {
179:         return sprintf('<input type="checkbox" name="ids[]" value="%s" />', $item['id']);
180:     }
181: 
182:     /**
183:      * Get the name column content for the given item
184:      *
185:      * @param   array   $item
186:      * @return  string
187:      */
188:     protected function column_name($item)
189:     {
190:         $output = '<strong>';
191: 
192:         if (current_user_can('quform_edit_forms') && $item['trashed'] != '1') {
193:             $output .= sprintf(
194:                 '<a href="%s" aria-label="%s">%s</a>',
195:                 esc_url(add_query_arg(array('id' => $item['id']), admin_url('admin.php?page=quform.forms&sp=edit'))),
196:                 /* translators: %s: the form name */
197:                 sprintf(esc_attr__('Edit form &#8220;%s&#8221;', 'quform'), Quform::escape($item['name'])),
198:                 Quform::escape($item['name'])
199:             );
200:         } else {
201:             $output .= Quform::escape($item['name']);
202:         }
203: 
204:         $output .= '</strong>';
205: 
206:         return $output;
207:     }
208: 
209:     /**
210:      * Get the shortcode column content for the given item
211:      *
212:      * @param   array   $item
213:      * @return  string
214:      */
215:     protected function column_shortcode($item)
216:     {
217:         $shortcode = sprintf('[quform id="%s" name="%s"]', $item['id'], $item['name']);
218: 
219:         $output = sprintf(
220:             '<input type="text" value="%s" size="%s" readonly>',
221:             Quform::escape($shortcode),
222:             esc_attr(Quform::strlen($shortcode))
223:         );
224: 
225:         return $output;
226:     }
227: 
228:     /**
229:      * Generates and display row actions links for the list table
230:      *
231:      * @param   array   $item         The item being acted upon
232:      * @param   string  $column_name  Current column name
233:      * @param   string  $primary      Primary column name
234:      * @return  string                The row actions HTML, or an empty string if the current column is not the primary column
235:      */
236:     protected function handle_row_actions($item, $column_name, $primary)
237:     {
238:         if ($column_name != $primary) {
239:             return '';
240:         }
241: 
242:         $actions = array();
243: 
244:         if ($item['trashed'] == '0') {
245:             if (current_user_can('quform_edit_forms')) {
246:                 $actions['edit'] = sprintf(
247:                     '<a href="%s" aria-label="%s">%s</a>',
248:                     esc_url(add_query_arg(array('id' => $item['id']), admin_url('admin.php?page=quform.forms&sp=edit'))),
249:                     sprintf(esc_attr__('Edit form &#8220;%s&#8221;', 'quform'), Quform::escape($item['name'])),
250:                     esc_html__('Edit', 'quform')
251:                 );
252:             }
253: 
254:             if (current_user_can('quform_view_entries')) {
255:                 $actions['entries'] = sprintf(
256:                     '<a href="%s" aria-label="%s">%s</a>',
257:                     esc_url(add_query_arg(array('id' => $item['id']), admin_url('admin.php?page=quform.entries'))),
258:                     /* translators: %s: the form name */
259:                     sprintf(esc_attr__('View submitted entries for &#8220;%s&#8221;', 'quform'), Quform::escape($item['name'])),
260:                     esc_html__('Entries', 'quform')
261:                 );
262:             }
263: 
264:             if (current_user_can('quform_edit_forms')) {
265:                 if ($item['active'] == '1') {
266:                     $deactivateUrl = admin_url('admin.php?page=quform.forms&action=deactivate');
267:                     $deactivateNonce = wp_create_nonce('quform_deactivate_form_' . $item['id']);
268: 
269:                     $actions['deactivate'] = sprintf(
270:                         '<a href="%s" aria-label="%s">%s</a>',
271:                         esc_url(add_query_arg(array('id' => $item['id'], '_wpnonce' => $deactivateNonce), $deactivateUrl)),
272:                         /* translators: %s: the form name */
273:                         sprintf(esc_attr__('Deactivate form &#8220;%s&#8221;', 'quform'), Quform::escape($item['name'])),
274:                         esc_html__('Deactivate', 'quform')
275:                     );
276:                 } else {
277:                     $activateUrl = admin_url('admin.php?page=quform.forms&action=activate');
278:                     $activateNonce = wp_create_nonce('quform_activate_form_' . $item['id']);
279: 
280:                     $actions['activate'] = sprintf(
281:                         '<a href="%s" aria-label="%s">%s</a>',
282:                         esc_url(add_query_arg(array('id' => $item['id'], '_wpnonce' => $activateNonce), $activateUrl)),
283:                         /* translators: %s: the form name */
284:                         sprintf(esc_attr__('Activate form &#8220;%s&#8221;', 'quform'), Quform::escape($item['name'])),
285:                         esc_html__('Activate', 'quform')
286:                     );
287:                 }
288:             }
289: 
290:             if (current_user_can('quform_add_forms')) {
291:                 $duplicateUrl = admin_url('admin.php?page=quform.forms&action=duplicate');
292:                 $duplicateNonce = wp_create_nonce('quform_duplicate_form_' . $item['id']);
293: 
294:                 $actions['duplicate'] = sprintf(
295:                     '<a href="%s" aria-label="%s">%s</a>',
296:                     esc_url(add_query_arg(array('id' => $item['id'], '_wpnonce' => $duplicateNonce), $duplicateUrl)),
297:                     /* translators: %s: the form name */
298:                     sprintf(esc_attr__('Duplicate form &#8220;%s&#8221;', 'quform'), Quform::escape($item['name'])),
299:                     esc_html__('Duplicate', 'quform')
300:                 );
301:             }
302: 
303:             if (current_user_can('quform_delete_forms')) {
304:                 $trashUrl = admin_url('admin.php?page=quform.forms&action=trash');
305:                 $trashNonce = wp_create_nonce('quform_trash_form_' . $item['id']);
306: 
307:                 $actions['trash'] = sprintf(
308:                     '<a href="%s" aria-label="%s">%s</a>',
309:                     esc_url(add_query_arg(array('id' => $item['id'], '_wpnonce' => $trashNonce), $trashUrl)),
310:                     /* translators: %s: the form name */
311:                     sprintf(esc_attr__('Move form &#8220;%s&#8221; to the Trash', 'quform'), Quform::escape($item['name'])),
312:                     esc_html__('Trash', 'quform')
313:                 );
314:             }
315:         } else {
316:             if (current_user_can('quform_delete_forms')) {
317:                 $untrashUrl = admin_url('admin.php?page=quform.forms&action=untrash');
318:                 $untrashNonce = wp_create_nonce('quform_untrash_form_' . $item['id']);
319: 
320:                 $actions['untrash'] = sprintf(
321:                     '<a href="%s" aria-label="%s">%s</a>',
322:                     esc_url(add_query_arg(array('id' => $item['id'], '_wpnonce' => $untrashNonce), $untrashUrl)),
323:                     /* translators: %s: the form name */
324:                     sprintf(esc_attr__('Restore form &#8220;%s&#8221; from the Trash', 'quform'), Quform::escape($item['name'])),
325:                     esc_html__('Restore', 'quform')
326:                 );
327: 
328:                 $deleteUrl = admin_url('admin.php?page=quform.forms&action=delete');
329:                 $deleteNonce = wp_create_nonce('quform_delete_form_' . $item['id']);
330: 
331:                 $actions['delete'] = sprintf(
332:                     '<a href="%s" aria-label="%s">%s</a>',
333:                     esc_url(add_query_arg(array('id' => $item['id'], '_wpnonce' => $deleteNonce), $deleteUrl)),
334:                     /* translators: %s: the form name */
335:                     sprintf(esc_attr__('Delete form &#8220;%s&#8221; permanently', 'quform'), Quform::escape($item['name'])),
336:                     esc_html__('Delete permanently', 'quform')
337:                 );
338:             }
339:         }
340: 
341:         return $this->row_actions($actions);
342:     }
343: 
344:     /**
345:      * Get the entries column content for the given item
346:      *
347:      * @param   array   $item
348:      * @return  string
349:      */
350:     protected function column_entries($item)
351:     {
352:         if ($item['unread'] > 0) {
353:             $count = sprintf(
354:                 '<strong>%s (%s)</strong>',
355:                 /* translators: %s: the number of unread entries */
356:                 esc_html(sprintf(_n('%s unread', '%s unread', $item['unread'], 'quform'), number_format_i18n($item['unread']))),
357:                 /* translators: %s: the number entries */
358:                 esc_html(sprintf(_n('%s entry', '%s entries', $item['entries'], 'quform'), number_format_i18n($item['entries'])))
359:             );
360:         } else {
361:             /* translators: %s: the number entries */
362:             $count = esc_html(sprintf(_n('%s entry', '%s entries', $item['entries'], 'quform'), number_format_i18n($item['entries'])));
363:         }
364: 
365:         if (current_user_can('quform_view_entries')) {
366:             $output = sprintf(
367:                 '<a href="%s">%s</a>',
368:                 esc_url(admin_url('admin.php?page=quform.entries&id=' . $item['id'])),
369:                 $count
370:             );
371:         } else {
372:             $output = $count;
373:         }
374: 
375:         return $output;
376:     }
377: 
378:     /**
379:      * Get the active column content for the given item
380:      *
381:      * @param   array   $item
382:      * @return  string
383:      */
384:     protected function column_active($item)
385:     {
386:         return $item['active'] == '1' ? esc_html__('Yes', 'quform') : esc_html__('No', 'quform');
387:     }
388: 
389:     /**
390:      * Get the updated_at column content for the given item
391:      *
392:      * @param   array   $item
393:      * @return  string
394:      */
395:     protected function column_updated_at($item)
396:     {
397:         return esc_html($this->options->formatDate($item['updated_at'], true));
398:     }
399: 
400:     /**
401:      * Get the list of sortable columns
402:      *
403:      * @return array
404:      */
405:     protected function get_sortable_columns()
406:     {
407:         $orderBy = $this->getOrderBy();
408:         $isAsc = $this->getOrder() == 'asc';
409: 
410:         return array(
411:             'name' => array('name', $orderBy == 'name' && $isAsc),
412:             'shortcode' => array('id', $orderBy == 'id' && $isAsc),
413:             'entries' => array('entries', ! ($orderBy == 'entries' && ! $isAsc)), // Default desc
414:             'active' => array('active', $orderBy == 'active' && $isAsc),
415:             'updated_at' => array('updated_at', ! ($orderBy == 'updated_at' && ! $isAsc)) // Default desc
416:         );
417:     }
418: 
419:     /**
420:      * Get an associative array ( option_name => option_title ) with the list
421:      * of bulk actions available on this table
422:      *
423:      * @return array
424:      */
425:     protected function get_bulk_actions()
426:     {
427:         $actions = array();
428: 
429:         if ($this->view == 'trashed') {
430:             if (current_user_can('quform_delete_forms')) {
431:                 $actions['untrash'] = __('Restore', 'quform');
432:                 $actions['delete'] = __('Delete permanently', 'quform');
433:             }
434:         } else {
435:             if (current_user_can('quform_edit_forms')) {
436:                 $actions['activate'] = __('Activate', 'quform');
437:                 $actions['deactivate'] = __('Deactivate', 'quform');
438:             }
439: 
440:             if (current_user_can('quform_add_forms')) {
441:                 $actions['duplicate'] = __('Duplicate', 'quform');
442:             }
443: 
444:             if (current_user_can('quform_delete_forms')) {
445:                 $actions['trash'] = __('Move to Trash', 'quform');
446:             }
447:         }
448: 
449:         return $actions;
450:     }
451: 
452:     /**
453:      * Message to be displayed when there are no forms
454:      */
455:     public function no_items() {
456:         if (isset($_GET['s']) && Quform::isNonEmptyString($_GET['s'])) {
457:             esc_html_e('Your search did not match any forms.', 'quform');
458:         } elseif ($this->view == 'trashed') {
459:             esc_html_e('No forms found in Trash.', 'quform');
460:         } elseif (current_user_can('quform_add_forms')) {
461:             printf(
462:                 /* translators: %1$s: open link tag, %2$s close link tag */
463:                 esc_html__('No forms found, %1$sclick here%2$s to create one.', 'quform'),
464:                 sprintf('<a href="%s">', esc_url(admin_url('admin.php?page=quform.forms&sp=add'))),
465:                 '</a>'
466:             );
467:         } else {
468:             esc_html_e('No forms found.', 'quform');
469:         }
470:     }
471: 
472:     /**
473:      * Displays the search box
474:      *
475:      * Duplicate of the parent function, but still shows the search box if there are no items
476:      *
477:      * @param string $text     The 'submit' button label.
478:      * @param string $input_id ID attribute value for the search input field.
479:      */
480:     public function search_box( $text, $input_id ) {
481:         $input_id = $input_id . '-search-input';
482: 
483:         if ( ! empty( $_REQUEST['orderby'] ) )
484:             echo '<input type="hidden" name="orderby" value="' . esc_attr( $_REQUEST['orderby'] ) . '" />';
485:         if ( ! empty( $_REQUEST['order'] ) )
486:             echo '<input type="hidden" name="order" value="' . esc_attr( $_REQUEST['order'] ) . '" />';
487:         if ( ! empty( $_REQUEST['post_mime_type'] ) )
488:             echo '<input type="hidden" name="post_mime_type" value="' . esc_attr( $_REQUEST['post_mime_type'] ) . '" />';
489:         if ( ! empty( $_REQUEST['detached'] ) )
490:             echo '<input type="hidden" name="detached" value="' . esc_attr( $_REQUEST['detached'] ) . '" />';
491:         ?>
492:         <p class="search-box">
493:             <label class="screen-reader-text" for="<?php echo esc_attr( $input_id ); ?>"><?php echo $text; ?>:</label>
494:             <input type="search" id="<?php echo esc_attr( $input_id ); ?>" name="s" value="<?php _admin_search_query(); ?>" />
495:             <?php submit_button( $text, '', '', false, array( 'id' => 'search-submit' ) ); ?>
496:         </p>
497:         <?php
498:     }
499: 
500:     /**
501:      * Get the order by value
502:      *
503:      * Gets the user meta setting if a value is saved
504:      *
505:      * @param   string  $requestedOrderBy  The requested order by from $_GET
506:      * @return  string
507:      */
508:     protected function getOrderBy($requestedOrderBy = '')
509:     {
510:         $currentUserId = get_current_user_id();
511:         $userOrderBy = get_user_meta($currentUserId, 'quform_forms_order_by', true);
512: 
513:         if (Quform::isNonEmptyString($requestedOrderBy)) {
514:             $orderBy = $requestedOrderBy;
515: 
516:             if ($requestedOrderBy != $userOrderBy) {
517:                 update_user_meta($currentUserId, 'quform_forms_order_by', $requestedOrderBy);
518:             }
519:         } elseif (Quform::isNonEmptyString($userOrderBy)) {
520:             $orderBy = $userOrderBy;
521:         } else {
522:             $orderBy = 'updated_at';
523:         }
524: 
525:         return $orderBy;
526:     }
527: 
528:     /**
529:      * Get the order value ('asc' or 'desc')
530:      *
531:      * Gets the user meta setting if a value is saved
532:      *
533:      * @param   string  $requestedOrder  The requested order from $_GET
534:      * @return  string
535:      */
536:     protected function getOrder($requestedOrder = '')
537:     {
538:         $currentUserId = get_current_user_id();
539:         $userOrder = get_user_meta($currentUserId, 'quform_forms_order', true);
540: 
541:         if (Quform::isNonEmptyString($requestedOrder)) {
542:             $order = $requestedOrder;
543: 
544:             if ($requestedOrder != $userOrder) {
545:                 update_user_meta($currentUserId, 'quform_forms_order', $requestedOrder);
546:             }
547:         } elseif (Quform::isNonEmptyString($userOrder)) {
548:             $order = $userOrder;
549:         } else {
550:             $order = 'desc';
551:         }
552: 
553:         return $order;
554:     }
555: 
556:     /**
557:      * Add an Empty Trash button to the Trash view
558:      *
559:      * @param string $which
560:      */
561:     protected function extra_tablenav($which)
562:     {
563:         if ($which == 'top' && $this->view == 'trashed' && count($this->items) && current_user_can('quform_delete_forms')) {
564:             submit_button(__('Empty Trash', 'quform'), 'apply', 'delete_all', false);
565:         }
566:     }
567: }
568: 
API documentation generated by ApiGen