PluginProbe ʕ •ᴥ•ʔ
Folders – Unlimited Folders to Organize Media Library Folder, Pages, Posts, File Manager / 1.3.7
Folders – Unlimited Folders to Organize Media Library Folder, Pages, Posts, File Manager v1.3.7
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 / includes / types.php
folders / includes Last commit date
GMMediaTags.class.php 10 years ago GMMediaTags.js 10 years ago GMMediaTagsAdmin.class.php 10 years ago options.php 9 years ago types.php 8 years ago
types.php
205 lines
1 <?php
2 /************************
3 *** CUSTOM POST TYPES ***
4 *************************/
5
6 function add_custom_posttype_folder_taxonomy() {
7 // get post types
8 global $globOptions, $folder_types, $typenow;
9
10 if ($globOptions) {
11
12 foreach($folder_types as $type) {
13 $tax_slug = $type.'_folder';
14 $args = array(
15 'hierarchical' => true,
16 'labels' => array(
17 'name' => _x( 'Folders', 'taxonomy general name' ),
18 'singular_name' => _x( 'Folder', 'taxonomy singular name' ),
19 'search_items' => __( 'Search Folders' ),
20 'all_items' => __( 'All Folders' ),
21 'parent_item' => __( 'Parent Folder' ),
22 'parent_item_colon' => __( 'Parent Folder:' ),
23 'edit_item' => __( 'Edit Folder' ),
24 'update_item' => __( 'Update Folder' ),
25 'add_new_item' => __( 'Add New Folder' ),
26 'new_item_name' => __( 'New Folder Name' ),
27 'menu_name' => __( 'Folders' ),
28 ),
29 'rewrite' => array(
30 'slug' => '',
31 'with_front' => false,
32 'hierarchical' => false
33 ),
34 'update_count_callback' => '_update_generic_term_count'
35 );
36 if ($type == 'attachment') {
37 $tax_slug = 'media_folder';
38 $args = array(
39 'hierarchical' => true,
40 'labels' => array(
41 'name' => _x( 'Folders', 'taxonomy general name' ),
42 'singular_name' => _x( 'Folder', 'taxonomy singular name' ),
43 'search_items' => __( 'Search Folders' ),
44 'all_items' => __( 'All Folders' ),
45 'parent_item' => __( 'Parent Folder' ),
46 'parent_item_colon' => __( 'Parent Folder:' ),
47 'edit_item' => __( 'Edit Folder' ),
48 'update_item' => __( 'Update Folder' ),
49 'add_new_item' => __( 'Add New Folder' ),
50 'new_item_name' => __( 'New Folder Name' ),
51 'menu_name' => __( 'Folders' ),
52 ),
53 'sort' => true,
54 'show_admin_column' => true,
55 'update_count_callback' => '_update_generic_term_count'
56 );
57 } elseif ($type == 'page') {
58 $tax_slug = 'folder';
59 $args = array(
60 'hierarchical' => true,
61 'labels' => array(
62 'name' => _x( 'Folders', 'taxonomy general name' ),
63 'singular_name' => _x( 'Folder', 'taxonomy singular name' ),
64 'search_items' => __( 'Search Folders' ),
65 'all_items' => __( 'All Folders' ),
66 'parent_item' => __( 'Parent Folder' ),
67 'parent_item_colon' => __( 'Parent Folder:' ),
68 'edit_item' => __( 'Edit Folder' ),
69 'update_item' => __( 'Update Folder' ),
70 'add_new_item' => __( 'Add New Folder' ),
71 'new_item_name' => __( 'New Folder Name' ),
72 'menu_name' => __( 'Folders' ),
73 ),
74 'sort' => true,
75 'show_admin_column' => true,
76 'update_count_callback' => '_update_generic_term_count'
77 );
78 }
79 register_taxonomy($tax_slug, $type, $args);
80 }
81 }
82 }
83 add_action( 'init', 'add_custom_posttype_folder_taxonomy', 0 );
84
85 function folders_add_posttype_taxonomy_filters() {
86 global $globOptions, $folder_types, $typenow;
87 if ($folder_types) {
88 foreach($folder_types as $type) {
89 if($type == 'page') {
90 $tax_slug = 'folder';
91 } else {
92 $tax_slug = $type.'_folder';
93 }
94 if( $typenow == $type ) {
95 $tax_obj = get_taxonomy($tax_slug);
96 $tax_name = $tax_obj->labels->name;
97 $terms = get_terms($tax_slug);
98 if(count($terms)) {
99 echo "<select name='$tax_slug' id='$tax_slug' class='postform'>";
100 echo "<option value=''>Show All $tax_name</option>";
101 foreach ($terms as $term) {
102 echo '<option value='. $term->slug, $_GET[$tax_slug] == $term->slug ? ' selected="selected"' : '','>' . $term->name .' (' . $term->count .')</option>';
103 }
104 echo "</select>";
105 }
106 }
107 }
108 }
109 }
110 add_action( 'restrict_manage_posts', 'folders_add_posttype_taxonomy_filters' );
111
112 // Add Folders into Admin Menu
113 function folders_posttype_in_admin_menu() {
114 global $globOptions, $folder_types, $menu;
115 if (empty($folder_types)) {
116 return;
117 }
118
119 foreach($folder_types as $type) {
120 $itemKey = searchForId($type, $menu);
121 switch (true) {
122 case ($type == 'attachment'):
123 $itemKey = 10;
124 $edit = 'upload.php';
125 break;
126 case ($type === 'post'):
127 $edit = 'edit.php';
128 $itemKey = 5;
129 break;
130 default:
131 $edit = 'edit.php';
132 break;
133 }
134
135
136 $folder = $type == 'attachment' ? 'media' : $type;
137 $upper = $type == 'attachment' ? 'Media' : ucwords(str_replace(array('-','_'), ' ', $type));
138 if ($type == 'page') {
139 $tax_slug = 'folder';
140 } else {
141 $tax_slug = $folder . '_folder';
142 }
143
144
145 if ($type == 'attachment') {
146 add_menu_page( 'Media Folders', 'Media Folders', 'publish_pages', "edit-tags.php?taxonomy=media_folder&post_type=attachment", false, 'dashicons-portfolio', "{$itemKey}.5" );
147 } else {
148 add_menu_page( $upper.' Folders', "{$upper} Folders", 'publish_pages', "{$edit}?post_type={$type}&{$tax_slug}", false, 'dashicons-portfolio', "{$itemKey}.5" );
149 }
150 add_submenu_page( "{$edit}?post_type={$type}&{$tax_slug}", 'Add/Edit Folders', 'Add/Edit Folders', 'publish_pages', "edit-tags.php?taxonomy={$tax_slug}&post_type={$type}", false );
151 $tax_obj = get_taxonomy($tax_slug);
152 $tax_name = $tax_obj->labels->name;
153 $terms = get_terms($tax_slug);
154
155 if($terms) {
156 foreach ($terms as $term) {
157 if ($type == 'attachment') {
158 add_submenu_page( "edit-tags.php?taxonomy=media_folder&post_type=attachment", $term->name, $term->name, 'publish_pages', "{$edit}?taxonomy=media_folder&term={$term->slug}", false );
159 } else {
160 add_submenu_page( "{$edit}?post_type={$type}&{$tax_slug}", $term->name, $term->name, 'publish_pages', "{$edit}?post_type={$type}&{$tax_slug}={$term->slug}", false );
161 }
162 }
163 }
164 remove_submenu_page( "{$edit}", "edit-tags.php?taxonomy=post_folder" );
165 remove_submenu_page( "{$edit}?post_type={$type}", "edit-tags.php?taxonomy={$tax_slug}&amp;post_type={$type}" );
166 remove_submenu_page( "{$edit}", "edit-tags.php?taxonomy={$tax_slug}&amp;post_type={$type}" );
167 }
168 }
169 add_action('admin_menu', 'folders_posttype_in_admin_menu');
170
171 function add_folder_posttype_column( $columns ) {
172 $myCustomColumns = array(
173 'folder' => __( 'Folder', 'Folder' )
174 );
175 $columns = array_merge( $columns, $myCustomColumns );
176 return $columns;
177 }
178 add_filter( 'manage_posts_columns', 'add_folder_posttype_column' );
179
180 function add_folder_posttype_column_content( $column_name, $post_id ) {
181 if ( $column_name == 'folder' ) {
182 $getType = get_post_type($post_id);
183 if ($getType == 'page') {
184 $ter = wp_get_post_terms($post_id, 'folder' );
185 } else {
186 $ter = wp_get_post_terms($post_id, $getType.'_folder' );
187 }
188 $count = count($ter);
189
190 if ($ter && is_wp_error($ter) === false) {
191 foreach ($ter as $key => $term) {
192 if ($term->name) {
193 if ($count === $key + 1) {
194 echo $term->name;
195 }
196 else {
197 echo $term->name.', ';
198 }
199 }
200 }
201 }
202 }
203 }
204 add_action( 'manage_posts_custom_column', 'add_folder_posttype_column_content', 10, 2 );
205