1: <?php
2:
3: 4: 5:
6: abstract class Quform_Admin_Page_Tools extends Quform_Admin_Page
7: {
8: 9: 10: 11: 12:
13: public function getSubNavHtml()
14: {
15: $links = array(
16: array(
17: 'cap' => 'quform_view_tools',
18: 'href' => admin_url('admin.php?page=quform.tools'),
19: 'class' => 'home',
20: 'text' => __('Home', 'quform')
21: ),
22: array(
23: 'cap' => 'quform_export_entries',
24: 'href' => admin_url('admin.php?page=quform.tools&sp=export.entries'),
25: 'class' => 'export-entries',
26: 'text' => __('Export Entries', 'quform')
27: ),
28: array(
29: 'cap' => 'quform_export_forms',
30: 'href' => admin_url('admin.php?page=quform.tools&sp=export.form'),
31: 'class' => 'export-form',
32: 'text' => __('Export Form', 'quform')
33: ),
34: array(
35: 'cap' => 'quform_import_forms',
36: 'href' => admin_url('admin.php?page=quform.tools&sp=import.form'),
37: 'class' => 'import-form',
38: 'text' => __('Import Form', 'quform')
39: ),
40: array(
41: 'cap' => 'quform_full_access',
42: 'href' => admin_url('admin.php?page=quform.tools&sp=migrate'),
43: 'class' => 'migrate',
44: 'text' => __('Migrate', 'quform')
45: ),
46: array(
47: 'cap' => 'activate_plugins',
48: 'href' => admin_url('admin.php?page=quform.tools&sp=uninstall'),
49: 'class' => 'uninstall',
50: 'text' => __('Uninstall', 'quform')
51: )
52: );
53:
54: $visible = array();
55: foreach ($links as $link) {
56: if (current_user_can($link['cap'])) {
57: $visible[] = $link;
58: }
59: }
60:
61: if ( ! count($visible)) {
62: return '';
63: }
64:
65: ob_start();
66: ?>
67: <div class="qfb-sub-nav qfb-cf">
68: <ul class="qfb-sub-nav-ul">
69: <?php
70: foreach ($visible as $item) {
71: echo '<li class="qfb-sub-nav-tools-' . $item['class'] . '"><a href="' . esc_url($item['href']) . '"><span>' . esc_html($item['text']) . '</span></a></li>';
72: }
73: ?>
74: </ul>
75: </div>
76: <?php
77:
78: return ob_get_clean();
79: }
80: }
81: