PluginProbe
Adminimize / 1.11.3
Adminimize v1.11.3
1.11.14 1.11.13 1.11.1 1.11.10 1.11.11 1.11.12 1.11.2 1.11.3 1.11.4 1.11.5 1.11.6 1.11.7 1.11.8 1.11.9 1.3 1.4.7 1.6 1.7.12 1.7.13 1.7.14 1.7.15 1.7.16 1.7.17 1.7.18 1.7.19 All 53 releases
adminimize / inc-options / write_cp_options.php

write_cp_options.php in Adminimize 1.11.3, at inc-options/write_cp_options.php

335 lines 12.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package Adminimize
4 * @subpackage Custom Post type options
5 * @author Frank Bültge
6 */
7
8 if ( ! function_exists( 'add_action' ) ) {
9 echo "Hi there! I'm just a part of plugin, not much I can do when called directly.";
10 exit;
11 }
12 // reset
13 $post_type = '';
14 $args = array( 'public' => TRUE, '_builtin' => FALSE );
15 foreach ( get_post_types( $args ) as $post_type ) {
16 $post_type_object = get_post_type_object( $post_type );
17 ?>
18
19 <div id="poststuff" class="ui-sortable meta-box-sortables">
20 <div class="postbox">
21 <div class="handlediv" title="<?php esc_attr_e( 'Click to toggle', 'adminimize' ); ?>"><br /></div>
22 <h3 class="hndle" id="config_edit_<?php echo $post_type; ?>">
23 <?php esc_attr_e( 'Write options', 'adminimize' );
24 echo ' - ' . $post_type_object->label; ?>
25 </h3>
26
27 <div class="inside">
28 <br class="clear" />
29
30 <table summary="config_edit_post" class="widefat">
31 <colgroup>
32 <?php
33 $col = 0;
34 foreach ( (array) $user_roles_names as $role_name ) {
35 echo '<col class="col' . (int) $col . '">' . "\n";
36 $col ++;
37 }
38 ?>
39 </colgroup>
40 <thead>
41 <tr>
42 <th><?php esc_attr_e( 'Write options', 'adminimize' );
43 echo ' - ' . $post_type_object->label ?></th>
44 <?php
45 foreach ( (array) $user_roles_names as $role_name ) {
46 echo '<th>' . esc_attr_e( 'Deactivate for', 'adminimize' )
47 . '<br/>' . esc_attr( $role_name ) . '</th>';
48 } ?>
49 </tr>
50 <tr>
51 <td><?php esc_attr_e( 'Select all', 'adminimize' ); ?></td>
52 <?php
53 foreach ( (array) $user_roles as $role_slug ) {
54 echo '<td class="num"><input id="select_all" class="write_cp_options_'
55 . esc_attr( $post_type ) . '_' . esc_attr( $role_slug )
56 . '" type="checkbox" name="" value="" /></td>' . "\n";
57 } ?>
58 </tr>
59 </thead>
60
61 <tbody>
62 <?php
63 $metaboxes = array(
64 '#contextual-help-link-wrap',
65 '#screen-options-link-wrap',
66 '.page-title-action',
67 '#pageslugdiv',
68 '#tagsdiv,#tagsdivsb,#tagsdiv-post_tag',
69 '#formatdiv',
70 '#categorydiv,#categorydivsb',
71 '#category-add-toggle',
72 '#passworddiv',
73 '.side-info',
74 '#notice',
75 '#post-body h2',
76 '#media-buttons, #wp-content-media-buttons',
77 '#wp-word-count',
78 '#slugdiv,#edit-slug-box',
79 '#misc-publishing-actions',
80 '#commentstatusdiv',
81 '#editor-toolbar #edButtonHTML, #quicktags, #content-html',
82 );
83
84 if ( ! empty( $GLOBALS[ '_wp_post_type_features' ][ $post_type ] ) ) {
85 foreach ( $GLOBALS[ '_wp_post_type_features' ][ $post_type ] as $post_type_support => $key ) {
86
87 if ( post_type_supports( $post_type, $post_type_support ) && 'excerpt' === $post_type_support ) {
88 $post_type_support = 'postexcerpt';
89 }
90
91 if ( 'page-attributes' === $post_type_support ) {
92 $post_type_support = 'pageparentdiv';
93 }
94
95 if ( 'custom-fields' === $post_type_support ) {
96 $post_type_support = 'postcustom';
97 }
98
99 $metaboxes[] = '#' . $post_type_support
100 . ', #' . $post_type_support
101 . 'div, th.column-' . $post_type_support
102 . ', td.' . $post_type_support; // td for raw in edit screen
103 }
104 }
105
106 if ( function_exists( 'current_theme_supports' )
107 && current_theme_supports(
108 'post-thumbnails', $post_type
109 )
110 ) {
111 $metaboxes[] = '#postimagediv';
112 }
113 if ( function_exists( 'sticky_add_meta_box' ) ) {
114 $metaboxes[] = '#poststickystatusdiv';
115 }
116
117 // quick edit areas, id and class
118 $quickedit_areas = array(
119 'div.row-actions, div.row-actions .inline',
120 'fieldset.inline-edit-col-left',
121 'fieldset.inline-edit-col-left label',
122 'fieldset.inline-edit-col-left label.inline-edit-author',
123 'fieldset.inline-edit-col-left .inline-edit-group',
124 'fieldset.inline-edit-col-center',
125 'fieldset.inline-edit-col-center .inline-edit-categories-label',
126 'fieldset.inline-edit-col-center .category-checklist',
127 'fieldset.inline-edit-col-right',
128 'fieldset.inline-edit-col-right .inline-edit-tags',
129 'fieldset.inline-edit-col-right .inline-edit-group',
130 'tr.inline-edit-save p.inline-edit-save',
131 );
132 $metaboxes = array_merge( $metaboxes, $quickedit_areas );
133
134 $metaboxes_names = array(
135 esc_attr__( 'Help' ),
136 esc_attr__( 'Screen Options' ),
137 esc_attr__( 'Add New' ),
138 esc_attr__( 'Permalink', 'adminimize' ),
139 esc_attr__( 'Tags', 'adminimize' ),
140 esc_attr__( 'Format', 'adminimize' ),
141 esc_attr__( 'Categories', 'adminimize' ),
142 esc_attr__( 'Add New Category', 'adminimize' ),
143 esc_attr__( 'Password Protect This Post', 'adminimize' ),
144 esc_attr__( 'Related, Shortcuts', 'adminimize' ),
145 esc_attr__( 'Messages', 'adminimize' ),
146 esc_attr__( 'h2: Advanced Options', 'adminimize' ),
147 esc_attr__( 'Media Buttons (all)', 'adminimize' ),
148 esc_attr__( 'Word count', 'adminimize' ),
149 esc_attr__( 'Post Slug', 'adminimize' ),
150 esc_attr__( 'Publish Actions', 'adminimize' ),
151 esc_attr__( 'Discussion' ),
152 esc_attr__( 'HTML Editor Button' ),
153 );
154
155 if ( ! empty( $GLOBALS[ '_wp_post_type_features' ][ $post_type ] ) ) {
156 foreach ( $GLOBALS[ '_wp_post_type_features' ][ $post_type ] as $post_type_support => $key ) {
157 if ( post_type_supports( $post_type, $post_type_support ) ) {
158 $metaboxes_names[] = ucfirst( $post_type_support );
159 }
160 }
161 }
162
163 if ( function_exists( 'current_theme_supports' )
164 && current_theme_supports(
165 'post-thumbnails', 'post'
166 )
167 ) {
168 $metaboxes_names[] = esc_attr__( 'Post Thumbnail', 'adminimize' );
169 }
170
171 if ( function_exists( 'sticky_add_meta_box' ) ) {
172 $metaboxes_names[] = 'Post Sticky Status';
173 }
174
175 // quick edit names
176 $quickedit_names = array(
177 '<strong>' . esc_attr__( 'Quick Edit Link', 'adminimize' ) . '</strong>',
178 esc_attr__( 'QE', 'adminimize' ) . ' ' . esc_attr__( 'Inline Edit Left', 'adminimize' ),
179 '&emsp;' . esc_attr__( 'QE', 'adminimize' ) . ' &rArr;' . ' ' . esc_attr__( 'All Labels', 'adminimize' ),
180 '&emsp;' . esc_attr__( 'QE', 'adminimize' ) . ' &rArr;' . ' ' . esc_attr__( 'Author' ),
181 '&emsp;' . esc_attr__( 'QE', 'adminimize' ) . ' &rArr;' . ' ' . esc_attr__( 'Password and Private', 'adminimize' ),
182 esc_attr__( 'QE', 'adminimize' ) . ' ' . esc_attr__( 'Inline Edit Center', 'adminimize' ),
183 '&emsp;' . esc_attr__( 'QE', 'adminimize' ) . ' &rArr;' . ' ' . esc_attr__( 'Categories Title', 'adminimize' ),
184 '&emsp;' . esc_attr__( 'QE', 'adminimize' ) . ' &rArr;' . ' ' . esc_attr__( 'Categories List', 'adminimize' ),
185 esc_attr__( 'QE', 'adminimize' ) . ' ' . esc_attr__( 'Inline Edit Right', 'adminimize' ),
186 '&emsp;' . esc_attr__( 'QE', 'adminimize' ) . ' &rArr;' . ' ' . esc_attr__( 'Tags' ),
187 '&emsp;' . esc_attr__( 'QE', 'adminimize' ) . ' &rArr;' . ' ' . esc_attr__( 'Status, Sticky', 'adminimize' ),
188 esc_attr__( 'QE', 'adminimize' ) . ' ' . esc_attr__( 'Cancel/Save Button', 'adminimize' ),
189 );
190 $metaboxes_names = array_merge( $metaboxes_names, $quickedit_names );
191
192 // add own post options
193 $_mw_adminimize_own_values_[ $post_type ] = _mw_adminimize_get_option_value(
194 '_mw_adminimize_own_values_' . $post_type
195 );
196 $_mw_adminimize_own_values_[ $post_type ] = preg_split(
197 "/\r\n/", $_mw_adminimize_own_values_[ $post_type ]
198 );
199 foreach ( (array) $_mw_adminimize_own_values_[ $post_type ] as $key => $_mw_adminimize_own_value_[ $post_type ] ) {
200 $_mw_adminimize_own_value_[ $post_type ] = trim( $_mw_adminimize_own_value_[ $post_type ] );
201 $metaboxes[] = $_mw_adminimize_own_value_[ $post_type ];
202 }
203
204 $_mw_adminimize_own_options_[ $post_type ] = _mw_adminimize_get_option_value(
205 '_mw_adminimize_own_options_' . $post_type
206 );
207 $_mw_adminimize_own_options_[ $post_type ] = preg_split(
208 "/\r\n/", $_mw_adminimize_own_options_[ $post_type ]
209 );
210 foreach ( (array) $_mw_adminimize_own_options_[ $post_type ] as $key => $_mw_adminimize_own_option_[ $post_type ] ) {
211 $_mw_adminimize_own_option_[ $post_type ] = trim( $_mw_adminimize_own_option_[ $post_type ] );
212 $metaboxes_names[] = $_mw_adminimize_own_option_[ $post_type ];
213 }
214
215 $x = 0;
216 foreach ( $metaboxes as $index => $metabox ) {
217 if ( '' !== $metabox ) {
218 $checked_user_role_ = array();
219 foreach ( (array) $user_roles as $role ) {
220 $disabled_metaboxes_[ $post_type . '_' . $role ] = _mw_adminimize_get_option_value(
221 'mw_adminimize_disabled_metaboxes_' . $post_type . '_' . $role . '_items'
222 );
223 $checked_user_role_[ $post_type . '_' . $role ] = (
224 isset( $disabled_metaboxes_[ $post_type . '_' . $role ] )
225 && in_array(
226 $metabox, $disabled_metaboxes_[ $post_type . '_' . $role ], TRUE
227 )
228 ) ? ' checked="checked"' : '';
229 }
230 echo '<tr>' . "\n";
231 echo '<td>' . $metaboxes_names[ $index ] .
232 ' <span>(' . $metabox . ')</span> </td>' . "\n";
233 foreach ( $user_roles as $role_slug ) {
234 echo '<td class="num">';
235 echo '<input id="check_' .
236 $post_type . $role_slug . $x . '" class="write_cp_options_'
237 . $post_type .
238 '_' . $role_slug . '" type="checkbox"' .
239 $checked_user_role_[ $post_type . '_' . $role_slug ] .
240 ' name="mw_adminimize_disabled_metaboxes_' . $post_type .
241 '_' . $role_slug . '_items[]" value="' . $metabox . '" />';
242 echo '</td>' . "\n";
243 }
244 echo '</tr>' . "\n";
245 $x ++;
246 }
247 }
248 ?>
249 </tbody>
250 </table>
251
252 <?php
253 // Your own post options
254 ?>
255 <br style="margin-top: 10px;" />
256 <table summary="config_own_post" class="widefat">
257 <thead>
258 <tr>
259 <th>
260 <?php echo sprintf(
261 esc_attr__( 'Your own %s options', 'adminimize' ),
262 $post_type_object->label
263 );
264 echo '<br />';
265 esc_attr_e( 'Option name', 'adminimize' ); ?>
266 </th>
267 <th><?php echo '<br />';
268 esc_attr_e( 'Selector, ID or class', 'adminimize' ); ?></th>
269 </tr>
270 </thead>
271
272 <tbody>
273 <tr valign="top">
274 <td colspan="2">
275 <?php esc_attr_e(
276 'It is possible to add your own IDs or classes from elements and tags. You can find IDs and classes with the FireBug Add-on for Firefox. Assign a value and the associate name per line.',
277 'adminimize'
278 ); ?>
279 </td>
280 </tr>
281 <tr valign="top">
282 <td>
283 <textarea name="_mw_adminimize_own_options_<?php echo $post_type; ?>"
284 cols="60" rows="3"
285 id="_mw_adminimize_own_options_<?php echo $post_type; ?>"
286 style="width: 95%;"><?php echo _mw_adminimize_get_option_value(
287 '_mw_adminimize_own_options_' . $post_type
288 ); ?></textarea>
289 <br />
290 <label for="_mw_adminimize_own_options_<?php echo $post_type; ?>">
291 <?php esc_attr_e(
292 'Possible nomination for ID or class. Separate multiple nominations through a carriage return.',
293 'adminimize'
294 ); ?>
295 </label>
296 </td>
297 <td>
298 <textarea class="code" name="_mw_adminimize_own_values_<?php echo $post_type; ?>"
299 cols="60" rows="3"
300 id="_mw_adminimize_own_values_<?php echo $post_type; ?>"
301 style="width: 95%;"><?php echo _mw_adminimize_get_option_value(
302 '_mw_adminimize_own_values_' . $post_type
303 ); ?></textarea>
304 <br />
305 <label for="_mw_adminimize_own_values_<?php echo $post_type; ?>">
306 <?php esc_attr_e(
307 'Possible IDs or classes. Separate multiple values through a carriage return.',
308 'adminimize'
309 ); ?>
310 </label>
311 </td>
312 </tr>
313 </tbody>
314 </table>
315
316 <p id="submitbutton">
317 <input type="hidden" name="_mw_adminimize_action" value="_mw_adminimize_insert" />
318 <input class="button button-primary" type="submit"
319 name="_mw_adminimize_save"
320 value="<?php esc_attr_e( 'Update Options', 'adminimize' ); ?> &raquo;" />
321 <input type="hidden" name="page_options" value="'dofollow_timeout'" />
322 </p>
323
324 <p><a class="alignright button" href="javascript:void(0);"
325 onclick="window.scrollTo(0,0);" style="margin:3px 0 0 30px;">
326 <?php esc_attr_e( 'scroll to top', 'adminimize' ); ?></a>
327 <br class="clear" />
328 </p>
329
330 </div>
331 </div>
332 </div>
333
334 <?php } // end foreach ?>
335