Version Description
Select a default folder for your media library, pages, posts, and custom posts. We've also added a knowledge base with all FAQs.
Download this release
Release Info
Developer | galdub |
Plugin | Folders – Unlimited Folders to Organize Media Library Folder, Pages, Posts, File Manager |
Version | 2.3 |
Comparing to | |
See all releases |
Code changes from version 2.2.9 to 2.3
- assets/css/design.css +17 -3
- assets/images/premio-help.png +0 -0
- assets/js/custom.js +6 -0
- folders.php +2 -2
- includes/folders.class.php +56 -0
- readme.txt +5 -1
- templates/admin/admin-content.php +14 -2
- templates/admin/general-settings.php +80 -4
assets/css/design.css
CHANGED
@@ -354,6 +354,9 @@ a#expand-collapse-list.all-open span:before {
|
|
354 |
display: inline-block;
|
355 |
vertical-align: top;
|
356 |
}
|
|
|
|
|
|
|
357 |
.header-posts a, .un-categorised-items a {
|
358 |
color: #444444;
|
359 |
padding: 7px;
|
@@ -363,8 +366,19 @@ a#expand-collapse-list.all-open span:before {
|
|
363 |
font-size: 14px;
|
364 |
line-height: 18px;
|
365 |
}
|
366 |
-
.header-posts a:hover, .un-categorised-items:hover {
|
367 |
background: #dfdfdf;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
368 |
}
|
369 |
span.total-count {
|
370 |
float: right;
|
@@ -517,11 +531,11 @@ li.active-menu {
|
|
517 |
th#wcp_move {
|
518 |
width: 20px;
|
519 |
}
|
520 |
-
td.
|
521 |
vertical-align: middle;
|
522 |
opacity: 0;
|
523 |
}
|
524 |
-
.wp-list-table tr:hover .
|
525 |
opacity: 1;
|
526 |
}
|
527 |
.wcp-drop-hover {
|
354 |
display: inline-block;
|
355 |
vertical-align: top;
|
356 |
}
|
357 |
+
.un-categorised-items {
|
358 |
+
border-radius: 3px;
|
359 |
+
}
|
360 |
.header-posts a, .un-categorised-items a {
|
361 |
color: #444444;
|
362 |
padding: 7px;
|
366 |
font-size: 14px;
|
367 |
line-height: 18px;
|
368 |
}
|
369 |
+
.header-posts a:hover, .un-categorised-items:hover, .un-categorised-items.active-item {
|
370 |
background: #dfdfdf;
|
371 |
+
border-radius: 3px;
|
372 |
+
}
|
373 |
+
.header-posts a.active-item, .un-categorised-items.active-item {
|
374 |
+
background: #008ec2 !important;
|
375 |
+
color: #fff !important;
|
376 |
+
}
|
377 |
+
.un-categorised-items.active-item a {
|
378 |
+
color: #fff !important;
|
379 |
+
}
|
380 |
+
.un-categorised-items.active-item a span, .header-posts a.active-item span.total-count {
|
381 |
+
color: #444444 !important;
|
382 |
}
|
383 |
span.total-count {
|
384 |
float: right;
|
531 |
th#wcp_move {
|
532 |
width: 20px;
|
533 |
}
|
534 |
+
.wp-list-table tr td .wcp-move-file {
|
535 |
vertical-align: middle;
|
536 |
opacity: 0;
|
537 |
}
|
538 |
+
.wp-list-table tr:hover td .wcp-move-file, .wp-list-table td.wcp_move.column-wcp_move.wcp-draggable {
|
539 |
opacity: 1;
|
540 |
}
|
541 |
.wcp-drop-hover {
|
assets/images/premio-help.png
ADDED
Binary file
|
assets/js/custom.js
CHANGED
@@ -298,6 +298,8 @@ jQuery(document).ready(function(){
|
|
298 |
|
299 |
jQuery(document).on("click", "h3.title", function(e) {
|
300 |
e.stopPropagation();
|
|
|
|
|
301 |
activeRecordID = jQuery(this).closest("li.route").data("folder-id");
|
302 |
if(!jQuery("#media-attachment-taxonomy-filter").length) {
|
303 |
folderCurrentURL = wcp_settings.page_url + jQuery(this).closest("li.route").data("slug");
|
@@ -462,6 +464,8 @@ jQuery(document).ready(function(){
|
|
462 |
jQuery(".header-posts").click(function(){
|
463 |
activeRecordID = "";
|
464 |
jQuery(".wcp-container .route").removeClass("active-item");
|
|
|
|
|
465 |
if(!jQuery("#media-attachment-taxonomy-filter").length) {
|
466 |
folderCurrentURL = wcp_settings.page_url;
|
467 |
jQuery(".folder-loader-ajax").addClass("active");
|
@@ -482,6 +486,8 @@ jQuery(document).ready(function(){
|
|
482 |
jQuery(".un-categorised-items").click(function(){
|
483 |
activeRecordID = "-1";
|
484 |
jQuery(".wcp-container .route").removeClass("active-item");
|
|
|
|
|
485 |
if(!jQuery("#media-attachment-taxonomy-filter").length) {
|
486 |
folderCurrentURL = wcp_settings.page_url+"-1";
|
487 |
jQuery(".folder-loader-ajax").addClass("active");
|
298 |
|
299 |
jQuery(document).on("click", "h3.title", function(e) {
|
300 |
e.stopPropagation();
|
301 |
+
jQuery(".un-categorised-items").removeClass("active-item");
|
302 |
+
jQuery(".header-posts a").removeClass("active-item");
|
303 |
activeRecordID = jQuery(this).closest("li.route").data("folder-id");
|
304 |
if(!jQuery("#media-attachment-taxonomy-filter").length) {
|
305 |
folderCurrentURL = wcp_settings.page_url + jQuery(this).closest("li.route").data("slug");
|
464 |
jQuery(".header-posts").click(function(){
|
465 |
activeRecordID = "";
|
466 |
jQuery(".wcp-container .route").removeClass("active-item");
|
467 |
+
jQuery(".un-categorised-items").removeClass("active-item");
|
468 |
+
jQuery(".header-posts a").addClass("active-item");
|
469 |
if(!jQuery("#media-attachment-taxonomy-filter").length) {
|
470 |
folderCurrentURL = wcp_settings.page_url;
|
471 |
jQuery(".folder-loader-ajax").addClass("active");
|
486 |
jQuery(".un-categorised-items").click(function(){
|
487 |
activeRecordID = "-1";
|
488 |
jQuery(".wcp-container .route").removeClass("active-item");
|
489 |
+
jQuery(".header-posts a").removeClass("active-item");
|
490 |
+
jQuery(".un-categorised-items").addClass("active-item");
|
491 |
if(!jQuery("#media-attachment-taxonomy-filter").length) {
|
492 |
folderCurrentURL = wcp_settings.page_url+"-1";
|
493 |
jQuery(".folder-loader-ajax").addClass("active");
|
folders.php
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
/**
|
3 |
* Plugin Name: Folders
|
4 |
* Description: Arrange media, pages, custom post types and posts into folders
|
5 |
-
* Version: 2.
|
6 |
* Author: Premio
|
7 |
* Author URI: https://premio.io/downloads/folders/
|
8 |
*/
|
@@ -15,7 +15,7 @@ define('WCP_FOLDER', 'folders');
|
|
15 |
define('WCP_FOLDER_VAR', 'folders_settings');
|
16 |
define("WCP_DS", DIRECTORY_SEPARATOR);
|
17 |
define('WCP_FOLDER_URL',plugin_dir_url(__FILE__));
|
18 |
-
define('WCP_FOLDER_VERSION',"2.
|
19 |
|
20 |
include_once plugin_dir_path(__FILE__)."includes/folders.class.php";
|
21 |
register_activation_hook( __FILE__, array( 'WCP_Folders', 'activate' ) );
|
2 |
/**
|
3 |
* Plugin Name: Folders
|
4 |
* Description: Arrange media, pages, custom post types and posts into folders
|
5 |
+
* Version: 2.3
|
6 |
* Author: Premio
|
7 |
* Author URI: https://premio.io/downloads/folders/
|
8 |
*/
|
15 |
define('WCP_FOLDER_VAR', 'folders_settings');
|
16 |
define("WCP_DS", DIRECTORY_SEPARATOR);
|
17 |
define('WCP_FOLDER_URL',plugin_dir_url(__FILE__));
|
18 |
+
define('WCP_FOLDER_VERSION',"2.3");
|
19 |
|
20 |
include_once plugin_dir_path(__FILE__)."includes/folders.class.php";
|
21 |
register_activation_hook( __FILE__, array( 'WCP_Folders', 'activate' ) );
|
includes/folders.class.php
CHANGED
@@ -77,6 +77,9 @@ class WCP_Folders
|
|
77 |
add_filter('pre-upload-ui', array($this, 'show_dropdown_on_media_screen'));
|
78 |
add_action('add_attachment', array($this, 'add_attachment_category'));
|
79 |
|
|
|
|
|
|
|
80 |
$options = get_option("folders_settings");
|
81 |
|
82 |
$options = is_array($options)?$options:array();
|
@@ -106,6 +109,42 @@ class WCP_Folders
|
|
106 |
add_action("wp_ajax_folder_update_status", array($this, 'folder_update_status'));
|
107 |
}
|
108 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
109 |
public function folder_update_status() {
|
110 |
if(!empty($_REQUEST['nonce']) && wp_verify_nonce($_REQUEST['nonce'], 'folder_update_status')) {
|
111 |
$status = filter_input(INPUT_POST, 'status', FILTER_SANITIZE_STRING);
|
@@ -2023,6 +2062,7 @@ class WCP_Folders
|
|
2023 |
public function plugin_action_links($links)
|
2024 |
{
|
2025 |
array_unshift($links, '<a href="' . admin_url("admin.php?page=wcp_folders_settings") . '" >' . esc_html__('Settings', WCP_FOLDER) . '</a>');
|
|
|
2026 |
$links['pro'] = '<a class="wcp-folder-upgrade-button" href="'.admin_url("admin.php?page=wcp_folders_upgrade").'" >'.__( 'Upgrade', WCP_FOLDER ).'</a>';
|
2027 |
return $links;
|
2028 |
}
|
@@ -2081,6 +2121,7 @@ class WCP_Folders
|
|
2081 |
function folders_register_settings()
|
2082 |
{
|
2083 |
register_setting('folders_settings', 'folders_settings1', 'folders_settings_validate');
|
|
|
2084 |
|
2085 |
self::check_and_set_post_type();
|
2086 |
|
@@ -2204,6 +2245,21 @@ class WCP_Folders
|
|
2204 |
if($is_shown === false) {
|
2205 |
include_once dirname(dirname(__FILE__)) . "/templates/admin/update.php";
|
2206 |
} else {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2207 |
include_once dirname(dirname(__FILE__)) . "/templates/admin/general-settings.php";
|
2208 |
}
|
2209 |
|
77 |
add_filter('pre-upload-ui', array($this, 'show_dropdown_on_media_screen'));
|
78 |
add_action('add_attachment', array($this, 'add_attachment_category'));
|
79 |
|
80 |
+
/* check for default folders */
|
81 |
+
add_filter('pre_get_posts', array($this, 'check_for_default_folders'));
|
82 |
+
|
83 |
$options = get_option("folders_settings");
|
84 |
|
85 |
$options = is_array($options)?$options:array();
|
109 |
add_action("wp_ajax_folder_update_status", array($this, 'folder_update_status'));
|
110 |
}
|
111 |
|
112 |
+
public function check_for_default_folders() {
|
113 |
+
global $typenow;
|
114 |
+
$isAjax = (defined('DOING_AJAX') && DOING_AJAX)?1:0;
|
115 |
+
$options = get_option('folders_settings');
|
116 |
+
$options = (empty($options) || !is_array($options))?array():$options;
|
117 |
+
if(!$isAjax && in_array($typenow, $options)) {
|
118 |
+
$default_folders = get_option('default_folders');
|
119 |
+
$default_folders = (empty($default_folders) || !is_array($default_folders))?array():$default_folders;
|
120 |
+
if ($typenow == "attachment") {
|
121 |
+
$admin_url = admin_url("upload.php?post_type=attachment&media_folder=");
|
122 |
+
if(!isset($_REQUEST['media_folder'])) {
|
123 |
+
if(isset($default_folders[$typenow]) && !empty($default_folders[$typenow])) {
|
124 |
+
$admin_url .= $default_folders[$typenow];
|
125 |
+
wp_redirect($admin_url);
|
126 |
+
exit;
|
127 |
+
}
|
128 |
+
}
|
129 |
+
} else {
|
130 |
+
$admin_url = admin_url("edit.php?post_type=" . $typenow);
|
131 |
+
if (isset($_GET['s']) && !empty($_GET['s'])) {
|
132 |
+
$admin_url .= "&s=" . $_GET['s'];
|
133 |
+
}
|
134 |
+
$post_type = self::get_custom_post_type($typenow);
|
135 |
+
$admin_url .= "&{$post_type}=";
|
136 |
+
if(!isset($_REQUEST[$post_type])) {
|
137 |
+
if(isset($default_folders[$typenow]) && !empty($default_folders[$typenow])) {
|
138 |
+
$admin_url .= $default_folders[$typenow];
|
139 |
+
wp_redirect($admin_url);
|
140 |
+
exit;
|
141 |
+
}
|
142 |
+
}
|
143 |
+
}
|
144 |
+
}
|
145 |
+
// echo "2121"; die;
|
146 |
+
}
|
147 |
+
|
148 |
public function folder_update_status() {
|
149 |
if(!empty($_REQUEST['nonce']) && wp_verify_nonce($_REQUEST['nonce'], 'folder_update_status')) {
|
150 |
$status = filter_input(INPUT_POST, 'status', FILTER_SANITIZE_STRING);
|
2062 |
public function plugin_action_links($links)
|
2063 |
{
|
2064 |
array_unshift($links, '<a href="' . admin_url("admin.php?page=wcp_folders_settings") . '" >' . esc_html__('Settings', WCP_FOLDER) . '</a>');
|
2065 |
+
$links['need_help'] = '<a target="_blank" href="https://premio.io/help/folders/?utm_source=pluginspage" >'.__( 'Need help?', WCP_FOLDER ).'</a>';
|
2066 |
$links['pro'] = '<a class="wcp-folder-upgrade-button" href="'.admin_url("admin.php?page=wcp_folders_upgrade").'" >'.__( 'Upgrade', WCP_FOLDER ).'</a>';
|
2067 |
return $links;
|
2068 |
}
|
2121 |
function folders_register_settings()
|
2122 |
{
|
2123 |
register_setting('folders_settings', 'folders_settings1', 'folders_settings_validate');
|
2124 |
+
register_setting('default_folders', 'default_folders');
|
2125 |
|
2126 |
self::check_and_set_post_type();
|
2127 |
|
2245 |
if($is_shown === false) {
|
2246 |
include_once dirname(dirname(__FILE__)) . "/templates/admin/update.php";
|
2247 |
} else {
|
2248 |
+
$options = get_option('folders_settings');
|
2249 |
+
$options = (empty($options) || !is_array($options)) ?array():$options;
|
2250 |
+
$post_types = get_post_types( array( 'public' => true ), 'objects' );
|
2251 |
+
$terms_data = array();
|
2252 |
+
foreach ($post_types as $post_type) {
|
2253 |
+
if(in_array($post_type->name, $options)) {
|
2254 |
+
$term = $post_type->name;
|
2255 |
+
$term = self::get_custom_post_type($term);
|
2256 |
+
$categories = self::get_terms_hierarchical($term);
|
2257 |
+
$terms_data[$post_type->name] = $categories;
|
2258 |
+
} else {
|
2259 |
+
$terms_data[$post_type->name] = array();
|
2260 |
+
}
|
2261 |
+
}
|
2262 |
+
|
2263 |
include_once dirname(dirname(__FILE__)) . "/templates/admin/general-settings.php";
|
2264 |
}
|
2265 |
|
readme.txt
CHANGED
@@ -3,7 +3,7 @@ Contributors: galdub, tomeraharon, premio
|
|
3 |
Tags: folder, folders, organize, pages folders, media library, posts folders, media folders, subfolders, file manager, directories
|
4 |
Requires at least: 3.0.0
|
5 |
Tested up to: 5.2
|
6 |
-
Stable tag: 2.
|
7 |
Plugin URI: https://premio.io/downloads/folders/
|
8 |
|
9 |
Folders is a WordPress plugin that will help you quickly organize and manage all of your Pages, Posts and Media library files in folders.
|
@@ -59,6 +59,7 @@ Digital Agencies: You're creating all sorts of content for your clients daily -
|
|
59 |
* Drag and drop pages, posts, and media library
|
60 |
* Select specific folders when you add media to your pages, posts or any other post type.
|
61 |
* Drag and drop folders, change order, and hierarchy
|
|
|
62 |
* Bulk select images and media files and drag them to any folder. No worries, you can also drag and drop media library files one-by-one if you want :)
|
63 |
* Rename folders
|
64 |
* Monitor all the unassigned media library files, posts, pages, and custom posts so you can organize them easily to your folders
|
@@ -133,6 +134,9 @@ A live demo for the Folders plugin is available at <a href="https://demo.premio.
|
|
133 |
|
134 |
== Changelog ==
|
135 |
|
|
|
|
|
|
|
136 |
= 2.2.9 =
|
137 |
Better media library to folders bulk drag and drop in list mode
|
138 |
|
3 |
Tags: folder, folders, organize, pages folders, media library, posts folders, media folders, subfolders, file manager, directories
|
4 |
Requires at least: 3.0.0
|
5 |
Tested up to: 5.2
|
6 |
+
Stable tag: 2.3
|
7 |
Plugin URI: https://premio.io/downloads/folders/
|
8 |
|
9 |
Folders is a WordPress plugin that will help you quickly organize and manage all of your Pages, Posts and Media library files in folders.
|
59 |
* Drag and drop pages, posts, and media library
|
60 |
* Select specific folders when you add media to your pages, posts or any other post type.
|
61 |
* Drag and drop folders, change order, and hierarchy
|
62 |
+
* Select a default folder for your media library, posts, pages, and custom posts - you can select the folder that will load by default when you open your media library, pages, posts, and custom posts. For example, you can show all the unassigned files whenever you open the media library.
|
63 |
* Bulk select images and media files and drag them to any folder. No worries, you can also drag and drop media library files one-by-one if you want :)
|
64 |
* Rename folders
|
65 |
* Monitor all the unassigned media library files, posts, pages, and custom posts so you can organize them easily to your folders
|
134 |
|
135 |
== Changelog ==
|
136 |
|
137 |
+
= 2.3 =
|
138 |
+
Select a default folder for your media library, pages, posts, and custom posts. We've also added a knowledge base with all FAQs.
|
139 |
+
|
140 |
= 2.2.9 =
|
141 |
Better media library to folders bulk drag and drop in list mode
|
142 |
|
templates/admin/admin-content.php
CHANGED
@@ -49,6 +49,18 @@ if($typenow == "page") {
|
|
49 |
}
|
50 |
$display_status = "wcp_dynamic_display_status_" . $typenow;
|
51 |
$display_status = get_option($display_status);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
52 |
?>
|
53 |
<div id="wcp-content" class="<?php echo esc_attr(isset($display_status) && $display_status == "hide"?"hide-folders-area":"") ?>" >
|
54 |
<div id="wcp-content-resize">
|
@@ -60,9 +72,9 @@ $display_status = get_option($display_status);
|
|
60 |
<div class='wcp-container'>
|
61 |
<?php echo $form_html ?>
|
62 |
<div class="header-posts">
|
63 |
-
<a href="javascript:;" class="all-posts"><span class="wcp-icon folder-icon-insert_drive_file"></span> <?php esc_html_e("All ".$title, WCP_FOLDER) ?> <span class="total-count"><?php echo esc_attr($total_posts) ?></span></a>
|
64 |
</div>
|
65 |
-
<div class="un-categorised-items">
|
66 |
<a href="javascript:;" class="un-categorized-posts"><?php esc_html_e("Unassigned ".$title, WCP_FOLDER) ?> <span class="total-count total-empty"><?php echo esc_attr($total_empty) ?></span> </a>
|
67 |
</div>
|
68 |
<div id="custom-menu" class="wcp-custom-menu <?php echo ($status==1)?"active":"" ?>">
|
49 |
}
|
50 |
$display_status = "wcp_dynamic_display_status_" . $typenow;
|
51 |
$display_status = get_option($display_status);
|
52 |
+
$post_type = WCP_Folders::get_custom_post_type($typenow);
|
53 |
+
$active_class = "";
|
54 |
+
$active_all_class = "";
|
55 |
+
if(!empty($post_type)) {
|
56 |
+
if(isset($_REQUEST[$post_type]) && $_REQUEST[$post_type] == -1) {
|
57 |
+
$active_class = "active-item";
|
58 |
+
}
|
59 |
+
|
60 |
+
if(!isset($_REQUEST[$post_type]) || $_REQUEST[$post_type] == "") {
|
61 |
+
$active_all_class = "active-item";
|
62 |
+
}
|
63 |
+
}
|
64 |
?>
|
65 |
<div id="wcp-content" class="<?php echo esc_attr(isset($display_status) && $display_status == "hide"?"hide-folders-area":"") ?>" >
|
66 |
<div id="wcp-content-resize">
|
72 |
<div class='wcp-container'>
|
73 |
<?php echo $form_html ?>
|
74 |
<div class="header-posts">
|
75 |
+
<a href="javascript:;" class="all-posts <?php echo esc_attr($active_all_class) ?>"><span class="wcp-icon folder-icon-insert_drive_file"></span> <?php esc_html_e("All ".$title, WCP_FOLDER) ?> <span class="total-count"><?php echo esc_attr($total_posts) ?></span></a>
|
76 |
</div>
|
77 |
+
<div class="un-categorised-items <?php echo esc_attr($active_class) ?>">
|
78 |
<a href="javascript:;" class="un-categorized-posts"><?php esc_html_e("Unassigned ".$title, WCP_FOLDER) ?> <span class="total-count total-empty"><?php echo esc_attr($total_empty) ?></span> </a>
|
79 |
</div>
|
80 |
<div id="custom-menu" class="wcp-custom-menu <?php echo ($status==1)?"active":"" ?>">
|
templates/admin/general-settings.php
CHANGED
@@ -16,7 +16,30 @@ defined('ABSPATH') or wp_die('Nope, not accessing this');
|
|
16 |
}
|
17 |
#setting-form {
|
18 |
float: left;
|
19 |
-
width:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
}
|
21 |
<?php if ( function_exists( 'is_rtl' ) && is_rtl() ) { ?>
|
22 |
#setting-form {
|
@@ -24,12 +47,26 @@ defined('ABSPATH') or wp_die('Nope, not accessing this');
|
|
24 |
}
|
25 |
<?php } ?>
|
26 |
</style>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
27 |
<div class="wrap">
|
28 |
<h1><?php esc_attr_e( 'Folders Settings', WCP_FOLDER ); ?></h1>
|
29 |
<form action="options.php" method="post" id="setting-form">
|
30 |
<?php
|
31 |
-
settings_fields(
|
|
|
32 |
$options = get_option('folders_settings');
|
|
|
|
|
33 |
do_settings_sections( __FILE__ );
|
34 |
?>
|
35 |
<table class="form-table">
|
@@ -39,6 +76,8 @@ defined('ABSPATH') or wp_die('Nope, not accessing this');
|
|
39 |
foreach ( $post_types as $post_type ) : ?>
|
40 |
<?php
|
41 |
if ( ! $post_type->show_ui) continue;
|
|
|
|
|
42 |
if(in_array($post_type->name, $post_array)){
|
43 |
?>
|
44 |
<tr>
|
@@ -46,7 +85,23 @@ defined('ABSPATH') or wp_die('Nope, not accessing this');
|
|
46 |
<label for="folders_<?php echo esc_attr($post_type->name); ?>" ><?php esc_html_e( 'Use folders with: ', WCP_FOLDER )." ".esc_html_e($post_type->label); ?></label>
|
47 |
</th>
|
48 |
<td>
|
49 |
-
<input type="checkbox" id="folders_<?php echo esc_attr($post_type->name); ?>" name="folders_settings[]" value="<?php echo esc_attr($post_type->name); ?>"<?php if ( in_array( $post_type->name, $options ) ) echo ' checked="checked"'; ?>/>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
</td>
|
51 |
</tr>
|
52 |
<?php
|
@@ -56,7 +111,23 @@ defined('ABSPATH') or wp_die('Nope, not accessing this');
|
|
56 |
<label for="folders_<?php echo esc_attr($post_type->name); ?>" ><?php esc_html_e( 'Use folders with: ', WCP_FOLDER )." ".esc_html_e($post_type->label); ?></label>
|
57 |
</th>
|
58 |
<td>
|
59 |
-
<input type="checkbox" id="folders_<?php echo esc_attr($post_type->name); ?>" name="folders_settings[]" value="<?php echo esc_attr($post_type->name); ?>"<?php if ( in_array( $post_type->name, $options ) ) echo ' checked="checked"'; ?>/>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
60 |
</td>
|
61 |
</tr>
|
62 |
<?php } endforeach; ?>
|
@@ -89,4 +160,9 @@ defined('ABSPATH') or wp_die('Nope, not accessing this');
|
|
89 |
<input type="hidden" name="folders_settings1[premio_folder_option]" value="yes" />
|
90 |
<?php submit_button(); ?>
|
91 |
</form>
|
|
|
|
|
|
|
|
|
|
|
92 |
</div>
|
16 |
}
|
17 |
#setting-form {
|
18 |
float: left;
|
19 |
+
width: 580px;
|
20 |
+
}
|
21 |
+
.form-table th.default-folder {
|
22 |
+
width: 100px;
|
23 |
+
}
|
24 |
+
.premio-help {
|
25 |
+
width: calc(100% - 600px);
|
26 |
+
float: left;
|
27 |
+
text-align: center;
|
28 |
+
}
|
29 |
+
.premio-help a {
|
30 |
+
display: inline-block;
|
31 |
+
width: 200px;
|
32 |
+
margin-top: 15px;
|
33 |
+
}
|
34 |
+
.premio-help a img {
|
35 |
+
width: 100%;
|
36 |
+
height: auto;
|
37 |
+
}
|
38 |
+
.hide-option {
|
39 |
+
display: none;
|
40 |
+
}
|
41 |
+
select.hide-show-option {
|
42 |
+
width: 170px;
|
43 |
}
|
44 |
<?php if ( function_exists( 'is_rtl' ) && is_rtl() ) { ?>
|
45 |
#setting-form {
|
47 |
}
|
48 |
<?php } ?>
|
49 |
</style>
|
50 |
+
<script>
|
51 |
+
jQuery(document).ready(function(){
|
52 |
+
jQuery(document).on("click",".folder-select",function(){
|
53 |
+
if(jQuery(this).is(":checked")) {
|
54 |
+
jQuery(this).closest("tr").find(".hide-show-option").removeClass("hide-option");
|
55 |
+
} else {
|
56 |
+
jQuery(this).closest("tr").find(".hide-show-option").addClass("hide-option");
|
57 |
+
}
|
58 |
+
});
|
59 |
+
});
|
60 |
+
</script>
|
61 |
<div class="wrap">
|
62 |
<h1><?php esc_attr_e( 'Folders Settings', WCP_FOLDER ); ?></h1>
|
63 |
<form action="options.php" method="post" id="setting-form">
|
64 |
<?php
|
65 |
+
settings_fields('folders_settings');
|
66 |
+
settings_fields('default_folders');
|
67 |
$options = get_option('folders_settings');
|
68 |
+
$default_folders = get_option('default_folders');
|
69 |
+
$default_folders = (empty($default_folders) || !is_array($default_folders))?array():$default_folders;
|
70 |
do_settings_sections( __FILE__ );
|
71 |
?>
|
72 |
<table class="form-table">
|
76 |
foreach ( $post_types as $post_type ) : ?>
|
77 |
<?php
|
78 |
if ( ! $post_type->show_ui) continue;
|
79 |
+
$is_checked = !in_array( $post_type->name, $options )?"hide-option":"";
|
80 |
+
$selected_id = (isset($default_folders[$post_type->name]))?$default_folders[$post_type->name]:"all";
|
81 |
if(in_array($post_type->name, $post_array)){
|
82 |
?>
|
83 |
<tr>
|
85 |
<label for="folders_<?php echo esc_attr($post_type->name); ?>" ><?php esc_html_e( 'Use folders with: ', WCP_FOLDER )." ".esc_html_e($post_type->label); ?></label>
|
86 |
</th>
|
87 |
<td>
|
88 |
+
<input type="checkbox" class="folder-select" id="folders_<?php echo esc_attr($post_type->name); ?>" name="folders_settings[]" value="<?php echo esc_attr($post_type->name); ?>"<?php if ( in_array( $post_type->name, $options ) ) echo ' checked="checked"'; ?>/>
|
89 |
+
</td>
|
90 |
+
<th class="default-folder">
|
91 |
+
<label class="hide-show-option <?php echo esc_attr($is_checked) ?>" for="folders_for_<?php echo esc_attr($post_type->name); ?>" ><?php esc_html_e( 'Default folder: ', WCP_FOLDER ) ?></label>
|
92 |
+
</th>
|
93 |
+
<td>
|
94 |
+
<select class="hide-show-option <?php echo esc_attr($is_checked) ?>" id="folders_for_<?php echo esc_attr($post_type->name); ?>" name="default_folders[<?php echo esc_attr($post_type->name); ?>]" ?>">
|
95 |
+
<option value="">All <?php echo esc_attr($post_type->label) ?> Folders</option>
|
96 |
+
<option value="-1" <?php echo ($selected_id == -1)?"selected":"" ?>>Unassigned <?php echo esc_attr($post_type->label) ?></option>
|
97 |
+
<?php
|
98 |
+
if(isset($terms_data[$post_type->name]) && !empty($terms_data[$post_type->name])) {
|
99 |
+
foreach ($terms_data[$post_type->name] as $term) {
|
100 |
+
$selected = ($selected_id == $term->slug)?"selected":"";
|
101 |
+
echo "<option ".esc_attr($selected)." value='".esc_attr($term->slug)."'>".esc_attr($term->name)."</option>";
|
102 |
+
}
|
103 |
+
} ?>
|
104 |
+
</select>
|
105 |
</td>
|
106 |
</tr>
|
107 |
<?php
|
111 |
<label for="folders_<?php echo esc_attr($post_type->name); ?>" ><?php esc_html_e( 'Use folders with: ', WCP_FOLDER )." ".esc_html_e($post_type->label); ?></label>
|
112 |
</th>
|
113 |
<td>
|
114 |
+
<input type="checkbox" class="folder-select" id="folders_<?php echo esc_attr($post_type->name); ?>" name="folders_settings[]" value="<?php echo esc_attr($post_type->name); ?>"<?php if ( in_array( $post_type->name, $options ) ) echo ' checked="checked"'; ?>/>
|
115 |
+
</td>
|
116 |
+
<th class="default-folder">
|
117 |
+
<label class="hide-show-option <?php echo esc_attr($is_checked) ?>" for="folders_for_<?php echo esc_attr($post_type->name); ?>" ><?php esc_html_e( 'Default folder: ', WCP_FOLDER ) ?></label>
|
118 |
+
</th>
|
119 |
+
<td>
|
120 |
+
<select class="hide-show-option <?php echo esc_attr($is_checked) ?>" id="folders_for_<?php echo esc_attr($post_type->name); ?>" name="default_folders[<?php echo esc_attr($post_type->name); ?>]" ?>">
|
121 |
+
<option value="">All <?php echo esc_attr($post_type->label) ?> Folders</option>
|
122 |
+
<option value="-1" <?php echo ($selected_id == -1)?"selected":"" ?>>Unassigned <?php echo esc_attr($post_type->label) ?></option>
|
123 |
+
<?php
|
124 |
+
if(isset($terms_data[$post_type->name]) && !empty($terms_data[$post_type->name])) {
|
125 |
+
foreach ($terms_data[$post_type->name] as $term) {
|
126 |
+
$selected = ($selected_id == $term->slug)?"selected":"";
|
127 |
+
echo "<option ".esc_attr($selected)." value='".esc_attr($term->slug)."'>".esc_attr($term->name)."</option>";
|
128 |
+
}
|
129 |
+
} ?>
|
130 |
+
</select>
|
131 |
</td>
|
132 |
</tr>
|
133 |
<?php } endforeach; ?>
|
160 |
<input type="hidden" name="folders_settings1[premio_folder_option]" value="yes" />
|
161 |
<?php submit_button(); ?>
|
162 |
</form>
|
163 |
+
<div class="premio-help">
|
164 |
+
<a href="https://premio.io/help/folders/?utm_source=pluginspage" target="_blank">
|
165 |
+
<img src="<?php echo esc_url(WCP_FOLDER_URL."assets/images/premio-help.png") ?>" alt="Premio Help" class="Premio Help" />
|
166 |
+
</a>
|
167 |
+
</div>
|
168 |
</div>
|