PluginProbe ʕ •ᴥ•ʔ
WP All Import – Drag & Drop Import for CSV, XML, Excel & Google Sheets / 2.13
WP All Import – Drag & Drop Import for CSV, XML, Excel & Google Sheets v2.13
3.9.5 3.9.6 4.0.0 4.0.1 4.1.0 trunk 2.12 2.13 2.14 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.2.0 3.2.1 3.2.2 3.2.3 3.2.4 3.2.5 3.2.6 3.2.7 3.2.8 3.2.9 3.3.0 3.3.1 3.3.2 3.3.3 3.3.4 3.3.5 3.3.6 3.3.7 3.3.8 3.3.9 3.4.0 3.4.1 3.4.2 3.4.3 3.4.4 3.4.5 3.4.6 3.4.7 3.4.8 3.4.9 3.5.0 3.5.1 3.5.2 3.5.3 3.5.4 3.5.5 3.5.6 3.5.7 3.5.8 3.5.9 3.6.0 3.6.1 3.6.2 3.6.3 3.6.4 3.6.5 3.6.6 3.6.7 3.6.8 3.6.9 3.7.0 3.7.1 3.7.2 3.7.3 3.7.3-beta-1.0 3.7.4 3.7.4-beta-1.0 3.7.5 3.7.6 3.7.7 3.7.8 3.7.9 3.8.0 3.9.0 3.9.1 3.9.2 3.9.3 3.9.4
wp-all-import / controllers / admin / manage.php
wp-all-import / controllers / admin Last commit date
help.php 13 years ago home.php 13 years ago import.php 13 years ago manage.php 13 years ago settings.php 13 years ago
manage.php
108 lines
1 <?php
2 /**
3 * Manage Imports
4 *
5 * @author Pavel Kulbakin <p.kulbakin@gmail.com>
6 */
7 class PMXI_Admin_Manage extends PMXI_Controller_Admin {
8
9 public function init() {
10 parent::init();
11
12 if ('update' == PMXI_Plugin::getInstance()->getAdminCurrentScreen()->action) {
13 $this->isInline = true;
14 if ( ! session_id()) session_start(); // prevent session initialization throw a notification in inline mode of delegated plugin
15 }
16 }
17
18 /**
19 * Previous Imports list
20 */
21 public function index() {
22
23 $get = $this->input->get(array(
24 's' => '',
25 'order_by' => 'name',
26 'order' => 'ASC',
27 'pagenum' => 1,
28 'perPage' => 10,
29 ));
30 $get['pagenum'] = absint($get['pagenum']);
31 extract($get);
32 $this->data += $get;
33
34 $list = new PMXI_Import_List();
35 $post = new PMXI_Post_Record();
36 $by = NULL;
37 if ('' != $s) {
38 $like = '%' . preg_replace('%\s+%', '%', preg_replace('/[%?]/', '\\\\$0', $s)) . '%';
39 $by[] = array(array('name LIKE' => $like, 'type LIKE' => $like, 'path LIKE' => $like), 'OR');
40 }
41
42 $this->data['list'] = $list->join($post->getTable(), $list->getTable() . '.id = ' . $post->getTable() . '.import_id', 'LEFT')
43 ->setColumns(
44 $list->getTable() . '.*',
45 'COUNT(' . $post->getTable() . '.post_id' . ') AS post_count'
46 )
47 ->getBy($by, "$order_by $order", $pagenum, $perPage, $list->getTable() . '.id');
48
49 $this->data['page_links'] = paginate_links(array(
50 'base' => add_query_arg('pagenum', '%#%', $this->baseUrl),
51 'format' => '',
52 'prev_text' => __('&laquo;', 'pmxi_plugin'),
53 'next_text' => __('&raquo;', 'pmxi_plugin'),
54 'total' => ceil($list->total() / $perPage),
55 'current' => $pagenum,
56 ));
57
58 $this->render();
59 }
60
61 /**
62 * Delete an import
63 */
64 public function delete() {
65 $id = $this->input->get('id');
66 $this->data['item'] = $item = new PMXI_Import_Record();
67 if ( ! $id or $item->getById($id)->isEmpty()) {
68 wp_redirect($this->baseUrl); die();
69 }
70
71 if ($this->input->post('is_confirmed')) {
72 check_admin_referer('delete-import', '_wpnonce_delete-import');
73
74 $item->delete( ! $this->input->post('is_delete_posts'));
75 wp_redirect(add_query_arg('pmxi_nt', urlencode(__('Import deleted', 'pmxi_plugin')), $this->baseUrl)); die();
76 }
77
78 $this->render();
79 }
80
81 /**
82 * Bulk actions
83 */
84 public function bulk() {
85 check_admin_referer('bulk-imports', '_wpnonce_bulk-imports');
86 if ($this->input->post('doaction2')) {
87 $this->data['action'] = $action = $this->input->post('bulk-action2');
88 } else {
89 $this->data['action'] = $action = $this->input->post('bulk-action');
90 }
91 $this->data['ids'] = $ids = $this->input->post('items');
92 $this->data['items'] = $items = new PMXI_Import_List();
93 if (empty($action) or ! in_array($action, array('delete')) or empty($ids) or $items->getBy('id', $ids)->isEmpty()) {
94 wp_redirect($this->baseUrl); die();
95 }
96
97 if ($this->input->post('is_confirmed')) {
98 $is_delete_posts = $this->input->post('is_delete_posts');
99 foreach($items->convertRecords() as $item) {
100 $item->delete( ! $is_delete_posts);
101 }
102
103 wp_redirect(add_query_arg('pmxi_nt', urlencode(sprintf(__('<strong>%d</strong> %s deleted', 'pmxi_plugin'), $items->count(), _n('import', 'imports', $items->count(), 'pmxi_plugin'))), $this->baseUrl)); die();
104 }
105
106 $this->render();
107 }
108 }