PluginProbe ʕ •ᴥ•ʔ
Folders – Unlimited Folders to Organize Media Library Folder, Pages, Posts, File Manager / 3.0.9
Folders – Unlimited Folders to Organize Media Library Folder, Pages, Posts, File Manager v3.0.9
3.1.9 3.1.8 3.1.7 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 2.9.8 3.0 3.0.1 3.0.2 3.0.3 3.0.4 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.1 3.1.2 3.1.3 3.1.4 3.1.5 3.1.6 trunk 1.3.7 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.1.9 2.2 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.2.7 2.2.8 2.2.9 2.3 2.3.1 2.3.2 2.3.3 2.3.4 2.3.5 2.3.6 2.3.7 2.3.8 2.3.9 2.4 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.4.8 2.4.9 2.5 2.5.1 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.5.9 2.6 2.6.1 2.6.2 2.6.3 2.6.4 2.6.5 2.6.6 2.6.7 2.6.8 2.6.9 2.7 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.8 2.8.1 2.8.2 2.8.3 2.8.4 2.8.5 2.8.6 2.8.7 2.8.8 2.8.9 2.9 2.9.1 2.9.2
folders / templates / admin / settings-tabs / folders-import.php
folders / templates / admin / settings-tabs Last commit date
customize-folders.php 1 year ago folder-settings.php 1 year ago folder-user-settings.php 1 year ago folders-by-user.php 1 year ago folders-import.php 1 year ago notification-settings.php 1 year ago
folders-import.php
317 lines
1 <?php
2 $customize_folders = get_option("customize_folders");
3 if (isset($customize_folders['show_folder_in_settings']) && $customize_folders['show_folder_in_settings'] == "yes") {
4 $redirectURL = admin_url("options-general.php?page=wcp_folders_settings&setting_page=folders-import");
5 } else {
6 $redirectURL = admin_url("admin.php?page=wcp_folders_settings&setting_page=folders-import");
7 }
8 ?>
9 <script>
10 (function (factory) {
11 "use strict";
12 if(typeof define === 'function' && define.amd) {
13 define(['jquery'], factory);
14 }
15 else if(typeof module !== 'undefined' && module.exports) {
16 module.exports = factory(require('jquery'));
17 }
18 else {
19 factory(jQuery);
20 }
21 }(function ($, undefined) {
22 function showToast(message, classname) {
23 // Create the toast element
24 var $toast = $('<div class="toast '+classname+'">' + message + '</div>');
25
26 // Append the toast to the container
27 $('#toast-container').append($toast);
28 $('#toast-container').attr("class", "");
29 $('#toast-container').addClass(classname);
30
31 // Show the toast with a fade-in effect
32 $toast.fadeIn();
33
34 // Hide the toast after 3 seconds
35 setTimeout(function () {
36 $('#toast-container .toast:first-child').fadeOut(500, function(){
37 $(this).remove()
38 });
39 }, 3500);
40 }
41 var hasSubFolders = 0;
42 $(document).ready(function() {
43 $(document).on("click", "#import-folder-pop-up .popup-form-content, #import-folder-pop-up", function () {
44 console.log("wawas");
45 $("#import_file").val('');
46 });
47
48 $(document).on("click", ".export-folderswithin-button:not(.disabled)", function () {
49 $(this).addClass("disabled");
50 $(".import-export-loader").show();
51 $.ajax({
52 url: "<?php echo esc_url(admin_url("admin-ajax.php")) ?>",
53 data: {
54 'action': 'folders_export',
55 'nonce': "<?php echo esc_attr(wp_create_nonce("wcp_folders_export")) ?>"
56 },
57 type: 'post',
58 success: function (res) {
59 res = JSON.parse(res);
60 console.log(res);
61 var downloadLink = document.createElement("a");
62 var fileData = ['\ufeff' + JSON.stringify(res.data)];
63
64 var blobObject = new Blob(fileData, {
65 type: "text/json;charset=utf-8;"
66 });
67
68 var url = URL.createObjectURL(blobObject);
69 downloadLink.href = url;
70 var da = slugify(window.location.origin);
71 downloadLink.download = "folders-" + da + ".json";
72
73 document.body.appendChild(downloadLink);
74 downloadLink.click();
75 document.body.removeChild(downloadLink);
76 $(".export-folderswithin-button").removeClass("disabled");
77 $(".import-export-loader").hide();
78 showToast("<?php esc_html_e("Your folder structure has been successfully exported", "folders"); ?>" ,"success-msg");
79 }
80 });
81 });
82
83 function slugify(str) {
84 return str
85 .toLowerCase()
86 .replace(/[^a-z0-9]/g, '-')
87 .replace(/^-+|-+$/g, '');
88 }
89 $(document).on("change", "#import_file", function () {
90 fileName = $(this).val();
91 if(fileName == "") {
92 return;
93 }
94 fileExt = fileName.split('.').pop().toLowerCase();
95 if(fileExt != "json") {
96 showToast("<?php esc_html_e("Invalid file type, please upload json file", "folders"); ?>" ,"error-msg");
97 $("#import_file").val('');
98 } else {
99 var myFile = document.getElementById("import_file");
100 var fileReader = new FileReader();
101 fileReader.onload = function (e) {
102 $("#folder-import-table tbody").html("");
103 $("#got_file_content").html("");
104 var data = e.target.result;
105 $("#got_file_content").html(data);
106 data = JSON.parse(data);
107 try {
108 var totalFolders = hasSubFolders = 0;
109 if(data.length) {
110 for (i = 0; i < data.length; i++) {
111 var totalSubFoldes = 0;
112 for (j = 0; j < data[i].folders.length; j++) {
113 if(parseInt(data[i].folders[j].children.length) > 0) {
114 totalSubFoldes += parseInt(data[i].folders[j].children.length);
115 hasSubFolders = true;
116 }
117 }
118 var totalFolder = parseInt(data[i]['folders'].length) + totalSubFoldes;
119 $("#folder-import-table tbody").append(
120 `<tr>
121 <td>${data[i].post_title}</td>
122 <td>${data[i]['folders'].length}</td>
123 <td>${totalSubFoldes}</td>
124 <td>${totalFolder}</td>
125 </tr>`
126 );
127 totalFolders++;
128 }
129 if(totalFolders) {
130 $("#import-folder-pop-up").show();
131 } else {
132 $("#import_file").val('');
133 showToast("<?php esc_html_e("No data found.", "folders"); ?>" ,"error-msg");
134 }
135 }
136 }
137 catch (e) {
138 $("#import_file").val('');
139 showToast("<?php esc_html_e("Error during uploading file.", "folders"); ?>" ,"error-msg");
140 }
141 };
142 fileReader.readAsText(myFile.files[0]);
143 }
144 });
145 $(document).on("click", ".import-json-file", function (e) {
146 e.preventDefault();
147 if($(this).hasClass("check-for-sub") && hasSubFolders) {
148 $("#import-folder-pop-up").hide();
149 $("#confirm-for-sub-folder-data").show();
150 return;
151 }
152 $(".import-export-loader").show();
153 $.ajax({
154 url: "<?php echo esc_url(admin_url("admin-ajax.php")) ?>",
155 data: {
156 'action': 'folders_import',
157 'uploaded_data': $("#got_file_content").html(),
158 'nonce': "<?php echo esc_attr(wp_create_nonce("wcp_folders_import")) ?>"
159 },
160 type: 'post',
161 success: function (res) {
162 res = JSON.parse(res);
163 $(".import-file-input").hide();
164 $("#got_file_content").html('');
165 $("#import_file").val('');
166 $(".folders-toast-message .toast-message").text(res.message);
167 $(".import-export-loader").hide();
168 if (res.status == 1) {
169 showToast("<?php esc_html_e("Your folder structure has been imported successfully", "folders"); ?>" ,"success-msg");
170 } else {
171 showToast("<?php esc_html_e("Error during uploading file", "folders"); ?>" ,"error-msg");
172 }
173 }
174 });
175 });
176 });
177 }));
178
179 </script>
180 <div class="tab-content <?php echo esc_attr(($setting_page == "folders-import") ? "active" : "") ?>" id="folder-import">
181 <?php
182 $remove_folders_when_removed = !isset($customize_folders['remove_folders_when_removed']) ? "off" : $customize_folders['remove_folders_when_removed'];
183 ?>
184 <input type="hidden" name="customize_folders[remove_folders_when_removed]" value="off" />
185 <div class="folder-danger-zone">
186 <table class="import-export-table">
187 <?php if ($is_plugin_exists) { ?>
188 <tr class="has-other-plugins">
189 <td>
190 <span class="folder-info"><span class="dashicons dashicons-admin-generic"></span> <?php esc_html_e("Import", "folders"); ?></span>
191 <span class="folder-text"><span><?php esc_html_e("External folders found.", "folders"); ?></span> <?php esc_html_e("Click import to start importing external folders.", "folders"); ?></span>
192 </td>
193 <td class="last-td">
194 <a href="#" class="import-folders-button"><?php esc_html_e("Import", "folders"); ?></a>
195 </td>
196 </tr>
197 <?php } ?>
198 <tr class="no-more-plugins <?php echo (!$is_plugin_exists) ? "active" : "" ?>">
199 <td>
200 <span class="folder-info"><span class="dashicons dashicons-admin-generic"></span> <?php esc_html_e("Import from other Plugins", "folders"); ?></span>
201 <span class="folder-text"><?php esc_html_e("Couldn't detect any external folders that can be imported. Please contact us if you have external folders that were not detected", "folders"); ?></span>
202 </td>
203 <td class="last-td">
204 <a href="https://premio.io/contact/" target="_blank" class="contact-folders-button"><?php esc_html_e("Contact Us", "folders"); ?></a>
205 </td>
206 </tr>
207 <tr class="">
208 <td colspan="2">
209 <div class="import-export-data">
210 <div class="import-export-left">
211 <div class="folder-info"> <?php esc_html_e("Folders Import / Export", "folders"); ?></div>
212 <div class="folder-text">
213 <?php esc_html_e("Export or import folder structure within Folders plugin", "folders"); ?>
214 <span class="folder-tooltip" data-title="<?php esc_html_e("If you previously had Folders plugin, by clicking the import button, upload the folders structure file (JSON format) you exported by clicking the export button. This structure is the skeletal structure of how your folders are arranged in the plugin. Actual files/posts/pages/custom posts aren't imported/exported.", "folders") ?>">
215 <span class="dashicons dashicons-editor-help"></span>
216 </span>
217 </div>
218 </div>
219
220 <div class="last-td-export-import">
221 <a href="#" class="export-folderswithin-button button button-primary" style="margin-right: 8px"><?php esc_html_e("Export", "folders"); ?></a>
222 <label for="import_file" class="import-folderswithin-button button button-secondary" >
223 <input type="file" class="sr-only" name="importing_file" id="import_file" accept="application/json" />
224 <?php esc_html_e("Import", "folders"); ?>
225 </label>
226 </div>
227 </div>
228 </td>
229 </tr>
230 <tr id="got_file_content" style="display: none;">
231
232 </tr>
233 <tr>
234 <td colspan="2"><span class="danzer-title"><span class="dashicons dashicons-warning"></span> <?php esc_html_e("Danger Zone", "folders"); ?></span></td>
235 </tr>
236 <tr>
237 <td>
238 <span class="danger-info"><?php esc_html_e("Delete plugin data upon deletion", "folders"); ?></span>
239 <span class="danger-data"><?php esc_html_e("Delete all folders when the plugin is removed. This feature will remove all existing folders created by the plugin upon deletion.", "folders"); ?> <b><?php esc_html_e("(Not recommended)", "folders"); ?></span></b>
240 </td>
241 <td class="last-td" >
242 <div class="inline-checkbox">
243 <label class="folder-switch" for="remove_folders_when_removed">
244 <input type="checkbox" class="sr-only change-folder-status" name="customize_folders[remove_folders_when_removed]" id="remove_folders_when_removed" value="on" <?php checked($remove_folders_when_removed, "on") ?>>
245 <div class="folder-slider round"></div>
246 </label>
247 </div>
248 </td>
249 </tr>
250 <tr>
251 <td>
252 <span class="danger-info"><?php esc_html_e("Manual Data Removal", "folders"); ?></span>
253 <span class="danger-data"><?php esc_html_e("Delete all folders data manually This feature will remove all existing folders created by the plugin. Use this feature with caution.", "folders"); ?>
254 </td>
255 <td class="last-td">
256 <a href="#" class="remove-folders-data"><?php esc_html_e("Delete Now", "folders"); ?></a>
257 </td>
258 </tr>
259 </table>
260 </div>
261 </div>
262 <div class="folder-popup-form import-folder-pop-up" id="import-folder-pop-up">
263 <div class="popup-form-content">
264 <div class="folder-modal-content">
265 <div class="close-popup-button close-remove-folders">
266 <a class="" href="javascript:;"><span></span></a>
267 </div>
268 <div class="folder-title"><?php esc_html_e("Import Folder Structure", 'folders'); ?></div>
269 <div class="folder-note"><?php esc_html_e("The following folders will be imported to your plugin", "folders"); ?></div>
270 <div class="folder-body">
271 <div class="folder-table">
272 <table id="folder-import-table" class="folder-import-table">
273 <thead>
274 <tr>
275 <th><?php esc_html_e("Category", "folders"); ?></th>
276 <th><?php esc_html_e("No. of Folders", "folders"); ?></th>
277 <th><?php esc_html_e("No. of Subfolders", "folders"); ?></th>
278 <th><?php esc_html_e("Total", "folders"); ?></th>
279 </tr>
280 </thead>
281 <tbody>
282
283 </tbody>
284 </table>
285 </div>
286 </div>
287 <div class="folder-desc-note">
288 <?php esc_html_e('Clicking “Import” will create the imported folders to your Folders plugin and will enable the plugin for all the categories above', "folders"); ?>
289 </div>
290 <div class="folder-import-buttons">
291 <a href="javascript:;" class="form-cancel-btn"><?php esc_html_e("Cancel", 'folders'); ?></a>
292 <button type="button" class="form-cancel-btn import-json-file check-for-sub"><?php esc_html_e("Import", 'folders'); ?></button>
293 </div>
294 </div>
295 </div>
296 </div>
297 <div class="folder-popup-form" id="confirm-for-sub-folder-data">
298 <div class="popup-form-content">
299 <div class="folder-modal-content">
300 <div class="close-popup-button close-remove-folders">
301 <a class="" href="javascript:;"><span></span></a>
302 </div>
303 <div class="folder-title"><?php esc_html_e("Subfolders will be converted into main folders", 'folders'); ?></div>
304 <div class="folder-note"><?php printf(esc_html__("As subfolders are only available in the %1\$s of Folders, all of the subfolders will be converted into the main folders.", "folders"), "<a target='_blank' href='".esc_url($this->getFoldersUpgradeURL())."'>".esc_html__("Pro version", "folders")."</a>"); ?></div>
305 <div class="folder-import-buttons">
306 <a href="javascript:;" class="form-cancel-btn"><?php esc_html_e("Cancel", 'folders'); ?></a>
307 <button type="button" class="form-cancel-btn import-json-file"><?php esc_html_e("Continue", 'folders'); ?></button>
308 </div>
309 </div>
310 </div>
311 </div>
312 <div class="import-export-loader">
313 <div class="cv-spinner">
314 <span class="import-spinner"></span>
315 </div>
316 </div>
317 <div id="toast-container"></div>