PluginProbe ʕ •ᴥ•ʔ
Advanced Custom Fields: Extended / 0.9.2.7
Advanced Custom Fields: Extended v0.9.2.7
0.9.2.7 0.9.2.6 0.9.2.5 0.8.6 0.8.6.1 0.8.6.3 0.8.6.5 0.8.6.6 0.8.6.7 0.8.6.8 0.8.6.9 0.8.7 0.8.7.1 0.8.7.2 0.8.7.3 0.8.7.4 0.8.7.5 0.8.7.6 0.8.8 0.8.8.1 0.8.8.10 0.8.8.11 0.8.8.2 0.8.8.3 0.8.8.4 0.8.8.5 0.8.8.6 0.8.8.7 0.8.8.8 0.8.8.9 0.8.9 0.8.9.1 0.8.9.2 0.8.9.3 0.8.9.4 0.8.9.5 0.9 0.9.0.1 0.9.0.2 0.9.0.3 0.9.0.4 0.9.0.5 0.9.0.6 0.9.0.7 0.9.0.8 0.9.0.9 0.9.1 0.9.1.1 0.9.2 0.9.2.1 0.9.2.2 0.9.2.3 0.9.2.4 trunk 0.5 0.5.1 0.5.2 0.5.2.1 0.5.2.3 0.5.5 0.5.5.1 0.5.8 0.5.8.1 0.6 0.6.0.1 0.6.0.2 0.6.1 0.6.3 0.6.5 0.6.7 0.6.7.2 0.7 0.7.0.3 0.7.5 0.7.5.5 0.7.8 0.7.9 0.7.9.3 0.7.9.4 0.7.9.9.8 0.7.9.9.9 0.8 0.8.1 0.8.2 0.8.3 0.8.3.1 0.8.4 0.8.4.1 0.8.4.5 0.8.4.6 0.8.5 0.8.5.5
acf-extended / includes / screens / screen-attachment.php
acf-extended / includes / screens Last commit date
screen-attachment.php 7 months ago screen-options-page.php 7 months ago screen-post.php 7 months ago screen-settings.php 7 months ago screen-taxonomy.php 3 months ago screen-user.php 7 months ago
screen-attachment.php
232 lines
1 <?php
2
3 if(!defined('ABSPATH')){
4 exit;
5 }
6
7 if(!class_exists('acfe_screen_attachment')):
8
9 class acfe_screen_attachment{
10
11 // vars
12 var $post_id;
13
14 /**
15 * construct
16 */
17 function __construct(){
18
19 /**
20 * hooks:
21 *
22 * acfe/load_attachments
23 * acfe/add_attachments_meta_boxes $post_type
24 */
25
26 // edit
27 add_action('load-post.php', array($this, 'attachment_load'));
28
29 // list
30 add_action('load-upload.php', array($this, 'attachments_load'));
31
32 }
33
34
35 /**
36 * attachment_load
37 *
38 * load-post.php
39 */
40 function attachment_load(){
41
42 // global
43 global $typenow;
44
45 // exclude attachment
46 if($typenow !== 'attachment'){
47 return;
48 }
49
50 // vars
51 $post_id = (int) acfe_get_post_id();
52
53 // actions
54 do_action("acfe/load_attachment", $post_id);
55
56 // hooks
57 add_action('add_meta_boxes', array($this, 'add_attachment_meta_boxes'), 10, 2);
58
59 }
60
61
62 /**
63 * add_attachment_meta_boxes
64 *
65 * add_meta_boxes
66 *
67 * @param $post_type
68 * @param $post
69 */
70 function add_attachment_meta_boxes($post_type, $post){
71
72 do_action("acfe/add_attachment_meta_boxes", $post);
73
74 }
75
76
77 /**
78 * attachments_load
79 *
80 * load-upload.php
81 */
82 function attachments_load(){
83
84 // actions
85 do_action("acfe/load_attachments");
86
87 // hooks
88 add_action('admin_footer', array($this, 'attachments_footer'));
89
90 }
91
92
93 /**
94 * attachments_footer
95 *
96 * admin_footer
97 */
98 function attachments_footer(){
99
100 do_action('acfe/add_attachments_meta_boxes', 'attachment');
101
102 $this->attachments_do_meta_boxes();
103
104 }
105
106
107 /**
108 * attachments_do_meta_boxes
109 */
110 function attachments_do_meta_boxes(){
111
112 // check filter
113 if(!acf_is_filter_enabled('acfe/attachment_list')){
114 return;
115 }
116
117 // mode (list/grid)
118 // source: wp-admin/upload.php:16
119 $mode = get_user_option('media_library_mode', get_current_user_id()) ? get_user_option('media_library_mode', get_current_user_id()) : 'grid';
120 $modes = array('grid', 'list');
121
122 if(isset($_GET['mode']) && in_array($_GET['mode'], $modes, true)){
123 $mode = $_GET['mode'];
124 }
125
126 // enqueue
127 acf_enqueue_scripts();
128
129 ?>
130 <template id="tmpl-acf-after-title">
131
132 <div id="poststuff" class="acfe-list-postboxes">
133 <form method="post">
134 <?php do_meta_boxes('edit', 'acf_after_title', 'attachment'); ?>
135 </form>
136 </div>
137
138 </template>
139
140 <template id="tmpl-acf-normal">
141
142 <div id="poststuff" class="acfe-list-postboxes">
143 <form method="post">
144 <?php do_meta_boxes('edit', 'normal', 'attachment'); ?>
145 </form>
146 </div>
147
148 </template>
149
150 <template id="tmpl-acf-side">
151
152 <div class="acf-column-2">
153
154 <div id="poststuff" class="acfe-list-postboxes -side">
155 <form method="post">
156 <?php do_meta_boxes('edit', 'side', 'attachment'); ?>
157 </form>
158 </div>
159
160 </div>
161
162 </template>
163 <script type="text/javascript">
164 (function($){
165
166 <?php if($mode === 'list'): ?>
167
168 // main form
169 var $main = $('#posts-filter');
170
171 $main.wrap('<div class="acf-columns-2" />');
172 $main.prepend($('.subsubsub'));
173 $main.wrap('<div class="acf-column-1" />');
174
175 // field groups
176 var $column_1 = $('.acf-column-1');
177
178 $column_1.prepend($('#tmpl-acf-after-title').html());
179 $column_1.append($('#tmpl-acf-normal').html());
180 $column_1.after($('#tmpl-acf-side').html());
181
182 <?php if(!acf_is_filter_enabled('acfe/attachment_list/side')): ?>
183 $('.acf-columns-2').removeClass('acf-columns-2');
184 <?php endif; ?>
185
186 <?php elseif($mode === 'grid'): ?>
187
188 // wait for media grid to load
189 acf.addAction('load', function(){
190
191 // media frame
192 var $main = $('.media-frame');
193
194 $main.wrap('<div class="acf-columns-2" />');
195 $main.wrap('<div class="acf-column-1" />');
196
197 // field groups
198 var $column_1 = $('.acf-column-1');
199
200 $column_1.prepend($('#tmpl-acf-after-title').html());
201 $column_1.append($('#tmpl-acf-normal').html());
202 $column_1.after($('#tmpl-acf-side').html());
203
204 <?php if(!acf_is_filter_enabled('acfe/attachment_list/side')): ?>
205 $('.acf-columns-2').removeClass('acf-columns-2');
206 <?php endif; ?>
207
208 // fix dev mode bulk actions
209 var $acfWrap = $('#acfe-acf-custom-fields');
210 var $wpWrap = $('#acfe-wp-custom-fields');
211
212 // move Bulk Button
213 $acfWrap.find('.tablenav.bottom').insertAfter($acfWrap);
214 $wpWrap.find('.tablenav.bottom').insertAfter($wpWrap);
215
216 // re-initialize postboxes
217 (acf.get('postboxes') || []).map(acf.newPostbox);
218
219 });
220
221 <?php endif; ?>
222
223 })(jQuery);
224 </script>
225 <?php
226 }
227
228 }
229
230 acf_new_instance('acfe_screen_attachment');
231
232 endif;