PluginProbe
Adminimize / 1.11.1
Adminimize v1.11.1
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.1, at inc-options/write_cp_options.php

333 lines 12.2 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 if ( ! function_exists( 'add_action' ) ) {
8 echo "Hi there! I'm just a part of plugin, not much I can do when called directly.";
9 exit;
10 }
11 // reset
12 $post_type = '';
13 $args = array( 'public' => TRUE, '_builtin' => FALSE );
14 foreach ( get_post_types( $args ) as $post_type ) {
15 $post_type_object = get_post_type_object( $post_type );
16 ?>
17
18 <div id="poststuff" class="ui-sortable meta-box-sortables">
19 <div class="postbox">
20 <div class="handlediv" title="<?php esc_attr_e( 'Click to toggle', 'adminimize' ); ?>"><br /></div>
21 <h3 class="hndle" id="config_edit_<?php echo $post_type; ?>">
22 <?php esc_attr_e( 'Write options', 'adminimize' );
23 echo ' - ' . $post_type_object->label; ?>
24 </h3>
25
26 <div class="inside">
27 <br class="clear" />
28
29 <table summary="config_edit_post" class="widefat">
30 <colgroup>
31 <?php
32 $col = 0;
33 foreach ( $user_roles_names as $role_name ) {
34 echo '<col class="col' . $col . '">' . "\n";
35 $col ++;
36 }
37 ?>
38 </colgroup>
39 <thead>
40 <tr>
41 <th><?php esc_attr_e( 'Write options', 'adminimize' );
42 echo ' - ' . $post_type_object->label ?></th>
43 <?php
44 foreach ( $user_roles_names as $role_name ) { ?>
45 <th><?php esc_attr_e( 'Deactivate for', 'adminimize' );
46 echo '<br/>' . $role_name; ?></th>
47 <?php } ?>
48 </tr>
49 <tr>
50 <td><?php esc_attr_e( 'Select all', 'adminimize' ); ?></td>
51 <?php
52 foreach ( $user_roles as $role_slug ) {
53 echo '<td class="num">';
54 echo '<input id="select_all" class="write_cp_options_' . $post_type .
55 '_' . $role_slug
56 . '" type="checkbox" name="" value="" />';
57 echo '</td>' . "\n";
58 } ?>
59 </tr>
60 </thead>
61
62 <tbody>
63 <?php
64 $metaboxes = array(
65 '#contextual-help-link-wrap',
66 '#screen-options-link-wrap',
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__( 'Permalink', 'adminimize' ),
138 esc_attr__( 'Tags', 'adminimize' ),
139 esc_attr__( 'Format', 'adminimize' ),
140 esc_attr__( 'Categories', 'adminimize' ),
141 esc_attr__( 'Add New Category', 'adminimize' ),
142 esc_attr__( 'Password Protect This Post', 'adminimize' ),
143 esc_attr__( 'Related, Shortcuts', 'adminimize' ),
144 esc_attr__( 'Messages', 'adminimize' ),
145 esc_attr__( 'h2: Advanced Options', 'adminimize' ),
146 esc_attr__( 'Media Buttons (all)', 'adminimize' ),
147 esc_attr__( 'Word count', 'adminimize' ),
148 esc_attr__( 'Post Slug', 'adminimize' ),
149 esc_attr__( 'Publish Actions', 'adminimize' ),
150 esc_attr__( 'Discussion' ),
151 esc_attr__( 'HTML Editor Button' ),
152 );
153
154 if ( ! empty( $GLOBALS[ '_wp_post_type_features' ][ $post_type ] ) ) {
155 foreach ( $GLOBALS[ '_wp_post_type_features' ][ $post_type ] as $post_type_support => $key ) {
156 if ( post_type_supports( $post_type, $post_type_support ) ) {
157 $metaboxes_names[] = ucfirst( $post_type_support );
158 }
159 }
160 }
161
162 if ( function_exists( 'current_theme_supports' )
163 && current_theme_supports(
164 'post-thumbnails', 'post'
165 )
166 ) {
167 $metaboxes_names[] = esc_attr__( 'Post Thumbnail', 'adminimize' );
168 }
169
170 if ( function_exists( 'sticky_add_meta_box' ) ) {
171 $metaboxes_names[] = 'Post Sticky Status';
172 }
173
174 // quick edit names
175 $quickedit_names = array(
176 '<strong>' . esc_attr__( 'Quick Edit Link', 'adminimize' ) . '</strong>',
177 esc_attr__( 'QE', 'adminimize' ) . ' ' . esc_attr__( 'Inline Edit Left', 'adminimize' ),
178 '&emsp;' . esc_attr__( 'QE', 'adminimize' ) . ' &rArr;' . ' ' . esc_attr__( 'All Labels', 'adminimize' ),
179 '&emsp;' . esc_attr__( 'QE', 'adminimize' ) . ' &rArr;' . ' ' . esc_attr__( 'Author' ),
180 '&emsp;' . esc_attr__( 'QE', 'adminimize' ) . ' &rArr;' . ' ' . esc_attr__( 'Password and Private', 'adminimize' ),
181 esc_attr__( 'QE', 'adminimize' ) . ' ' . esc_attr__( 'Inline Edit Center', 'adminimize' ),
182 '&emsp;' . esc_attr__( 'QE', 'adminimize' ) . ' &rArr;' . ' ' . esc_attr__( 'Categories Title', 'adminimize' ),
183 '&emsp;' . esc_attr__( 'QE', 'adminimize' ) . ' &rArr;' . ' ' . esc_attr__( 'Categories List', 'adminimize' ),
184 esc_attr__( 'QE', 'adminimize' ) . ' ' . esc_attr__( 'Inline Edit Right', 'adminimize' ),
185 '&emsp;' . esc_attr__( 'QE', 'adminimize' ) . ' &rArr;' . ' ' . esc_attr__( 'Tags' ),
186 '&emsp;' . esc_attr__( 'QE', 'adminimize' ) . ' &rArr;' . ' ' . esc_attr__( 'Status, Sticky', 'adminimize' ),
187 esc_attr__( 'QE', 'adminimize' ) . ' ' . esc_attr__( 'Cancel/Save Button', 'adminimize' ),
188 );
189 $metaboxes_names = array_merge( $metaboxes_names, $quickedit_names );
190
191 // add own post options
192 $_mw_adminimize_own_values_[ $post_type ] = _mw_adminimize_get_option_value(
193 '_mw_adminimize_own_values_' . $post_type
194 );
195 $_mw_adminimize_own_values_[ $post_type ] = preg_split(
196 "/\r\n/", $_mw_adminimize_own_values_[ $post_type ]
197 );
198 foreach ( (array) $_mw_adminimize_own_values_[ $post_type ] as $key => $_mw_adminimize_own_value_[ $post_type ] ) {
199 $_mw_adminimize_own_value_[ $post_type ] = trim( $_mw_adminimize_own_value_[ $post_type ] );
200 $metaboxes[] = $_mw_adminimize_own_value_[ $post_type ];
201 }
202
203 $_mw_adminimize_own_options_[ $post_type ] = _mw_adminimize_get_option_value(
204 '_mw_adminimize_own_options_' . $post_type
205 );
206 $_mw_adminimize_own_options_[ $post_type ] = preg_split(
207 "/\r\n/", $_mw_adminimize_own_options_[ $post_type ]
208 );
209 foreach ( (array) $_mw_adminimize_own_options_[ $post_type ] as $key => $_mw_adminimize_own_option_[ $post_type ] ) {
210 $_mw_adminimize_own_option_[ $post_type ] = trim( $_mw_adminimize_own_option_[ $post_type ] );
211 $metaboxes_names[] = $_mw_adminimize_own_option_[ $post_type ];
212 }
213
214 $x = 0;
215 foreach ( $metaboxes as $index => $metabox ) {
216 if ( '' !== $metabox ) {
217 $checked_user_role_ = array();
218 foreach ( $user_roles as $role ) {
219 $disabled_metaboxes_[ $post_type . '_' . $role ] = _mw_adminimize_get_option_value(
220 'mw_adminimize_disabled_metaboxes_' . $post_type . '_' . $role . '_items'
221 );
222 $checked_user_role_[ $post_type . '_' . $role ] = (
223 isset( $disabled_metaboxes_[ $post_type . '_' . $role ] )
224 && in_array(
225 $metabox, $disabled_metaboxes_[ $post_type . '_' . $role ], FALSE
226 )
227 ) ? ' checked="checked"' : '';
228 }
229 echo '<tr>' . "\n";
230 echo '<td>' . $metaboxes_names[ $index ] .
231 ' <span>(' . $metabox . ')</span> </td>' . "\n";
232 foreach ( $user_roles as $role_slug ) {
233 echo '<td class="num">';
234 echo '<input id="check_' .
235 $post_type . $role_slug . $x . '" class="write_cp_options_'
236 . $post_type .
237 '_' . $role_slug . '" type="checkbox"' .
238 $checked_user_role_[ $post_type . '_' . $role_slug ] .
239 ' name="mw_adminimize_disabled_metaboxes_' . $post_type .
240 '_' . $role_slug . '_items[]" value="' . $metabox . '" />';
241 echo '</td>' . "\n";
242 }
243 echo '</tr>' . "\n";
244 $x ++;
245 }
246 }
247 ?>
248 </tbody>
249 </table>
250
251 <?php
252 //your own post options
253 ?>
254 <br style="margin-top: 10px;" />
255 <table summary="config_own_post" class="widefat">
256 <thead>
257 <tr>
258 <th>
259 <?php echo sprintf(
260 esc_attr__( 'Your own %s options', 'adminimize' ),
261 $post_type_object->label
262 );
263 echo '<br />';
264 esc_attr_e( 'Option name', 'adminimize' ); ?>
265 </th>
266 <th><?php echo '<br />';
267 esc_attr_e( 'Selector, ID or class', 'adminimize' ); ?></th>
268 </tr>
269 </thead>
270
271 <tbody>
272 <tr valign="top">
273 <td colspan="2">
274 <?php esc_attr_e(
275 '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.',
276 'adminimize'
277 ); ?>
278 </td>
279 </tr>
280 <tr valign="top">
281 <td>
282 <textarea name="_mw_adminimize_own_options_<?php echo $post_type; ?>"
283 cols="60" rows="3"
284 id="_mw_adminimize_own_options_<?php echo $post_type; ?>"
285 style="width: 95%;"><?php echo _mw_adminimize_get_option_value(
286 '_mw_adminimize_own_options_' . $post_type
287 ); ?></textarea>
288 <br />
289 <label for="_mw_adminimize_own_options_<?php echo $post_type; ?>">
290 <?php esc_attr_e(
291 'Possible nomination for ID or class. Separate multiple nominations through a carriage return.',
292 'adminimize'
293 ); ?>
294 </label>
295 </td>
296 <td>
297 <textarea class="code" name="_mw_adminimize_own_values_<?php echo $post_type; ?>"
298 cols="60" rows="3"
299 id="_mw_adminimize_own_values_<?php echo $post_type; ?>"
300 style="width: 95%;"><?php echo _mw_adminimize_get_option_value(
301 '_mw_adminimize_own_values_' . $post_type
302 ); ?></textarea>
303 <br />
304 <label for="_mw_adminimize_own_values_<?php echo $post_type; ?>">
305 <?php esc_attr_e(
306 'Possible IDs or classes. Separate multiple values through a carriage return.',
307 'adminimize'
308 ); ?>
309 </label>
310 </td>
311 </tr>
312 </tbody>
313 </table>
314
315 <p id="submitbutton">
316 <input type="hidden" name="_mw_adminimize_action" value="_mw_adminimize_insert" />
317 <input class="button button-primary" type="submit"
318 name="_mw_adminimize_save"
319 value="<?php esc_attr_e( 'Update Options', 'adminimize' ); ?> &raquo;" />
320 <input type="hidden" name="page_options" value="'dofollow_timeout'" />
321 </p>
322
323 <p><a class="alignright button" href="javascript:void(0);"
324 onclick="window.scrollTo(0,0);" style="margin:3px 0 0 30px;">
325 <?php esc_attr_e( 'scroll to top', 'adminimize' ); ?></a>
326 <br class="clear" />
327 </p>
328
329 </div>
330 </div>
331 </div>
332
333 <?php } // end foreach ?>