PluginProbe
Adminimize / 1.9.1
Adminimize v1.9.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
← All changes | inc-options/write_cp_options.php +60 -82 1.11.11 → 1.9.1 View file →
@@ -3,9 +3,8 @@
3 3 * @package Adminimize
4 4 * @subpackage Custom Post type options
5 5 * @author Frank Bültge
6 6 */
7 -
8 7 if ( ! function_exists( 'add_action' ) ) {
9 8 echo "Hi there! I'm just a part of plugin, not much I can do when called directly.";
10 9 exit;
11 10 }
@@ -17,9 +16,10 @@
17 16 ?>
18 17
19 18 <div id="poststuff" class="ui-sortable meta-box-sortables">
20 19 <div class="postbox">
21 - <h3 class="hndle ui-sortable-handle" title="<?php esc_attr_e( 'Click to toggle', 'adminimize' ); ?>" id="config_edit_<?php echo $post_type; ?>">
20 + <div class="handlediv" title="<?php esc_attr_e( 'Click to toggle' ); ?>"><br /></div>
21 + <h3 class="hndle" id="config_edit_<?php echo $post_type; ?>">
22 22 <?php esc_attr_e( 'Write options', 'adminimize' );
23 23 echo ' - ' . $post_type_object->label; ?>
24 24 </h3>
25 25
@@ -26,34 +26,28 @@
26 26 <div class="inside">
27 27 <br class="clear" />
28 28
29 29 <table summary="config_edit_post" class="widefat">
30 - <colgroup>
31 - <?php
32 - $col = 0;
33 - foreach ( (array) $user_roles_names as $role_name ) {
34 - echo '<col class="col' . (int) $col . '">' . "\n";
35 - $col ++;
36 - }
37 - ?>
38 - </colgroup>
39 30 <thead>
40 31 <tr>
41 32 <th><?php esc_attr_e( 'Write options', 'adminimize' );
42 33 echo ' - ' . $post_type_object->label ?></th>
43 34 <?php
44 - foreach ( (array) $user_roles_names as $role_name ) {
45 - echo '<th>' . esc_attr__( 'Deactivate for', 'adminimize' )
46 - . '<br/>' . esc_attr( $role_name ) . '</th>';
47 - } ?>
35 + foreach ( $user_roles_names as $role_name ) { ?>
36 + <th><?php esc_attr_e( 'Deactivate for', 'adminimize' );
37 + echo '<br/>' . $role_name; ?></th>
38 + <?php } ?>
48 39 </tr>
49 40 <tr>
50 41 <td><?php esc_attr_e( 'Select all', 'adminimize' ); ?></td>
51 42 <?php
52 - foreach ( (array) $user_roles as $role_slug ) {
53 - echo '<td class="num"><input id="select_all" class="write_cp_options_'
54 - . esc_attr( $post_type ) . '_' . esc_attr( $role_slug )
55 - . '" type="checkbox" name="" value="" /></td>' . "\n";
43 + foreach ( $user_roles_names as $role_name ) {
44 + $role_name = strtolower( $role_name );
45 + $role_name = preg_replace( '/[^a-z0-9]+/', '', $role_name );
46 + echo '<td class="num">';
47 + echo '<input id="select_all" class="write_cp_options_' . $role_name
48 + . '" type="checkbox" name="" value="" />';
49 + echo '</td>' . "\n";
56 50 } ?>
57 51 </tr>
58 52 </thead>
59 53
@@ -61,9 +55,8 @@
61 55 <?php
62 56 $metaboxes = array(
63 57 '#contextual-help-link-wrap',
64 58 '#screen-options-link-wrap',
65 - '.page-title-action',
66 59 '#pageslugdiv',
67 60 '#tagsdiv,#tagsdivsb,#tagsdiv-post_tag',
68 61 '#formatdiv',
69 62 '#categorydiv,#categorydivsb',
@@ -79,30 +72,26 @@
79 72 '#commentstatusdiv',
80 73 '#editor-toolbar #edButtonHTML, #quicktags, #content-html',
81 74 );
82 75
83 - if ( ! empty( $GLOBALS[ '_wp_post_type_features' ][ $post_type ] ) ) {
84 - foreach ( $GLOBALS[ '_wp_post_type_features' ][ $post_type ] as $post_type_support => $key ) {
85 -
86 - if ( post_type_supports( $post_type, $post_type_support ) && 'excerpt' === $post_type_support ) {
76 + foreach ( $GLOBALS[ '_wp_post_type_features' ][ $post_type ] as $post_type_support => $key ) {
77 + if ( post_type_supports( $post_type, $post_type_support ) ) {
78 + if ( 'excerpt' === $post_type_support ) {
87 79 $post_type_support = 'postexcerpt';
88 80 }
81 + }
82 + if ( 'page-attributes' === $post_type_support ) {
83 + $post_type_support = 'pageparentdiv';
84 + }
85 + if ( 'custom-fields' == $post_type_support ) {
86 + $post_type_support = 'postcustom';
87 + }
89 88
90 - if ( 'page-attributes' === $post_type_support ) {
91 - $post_type_support = 'pageparentdiv';
92 - }
93 -
94 - if ( 'custom-fields' === $post_type_support ) {
95 - $post_type_support = 'postcustom';
96 - }
97 -
98 - $metaboxes[] = '#' . $post_type_support
99 - . ', #' . $post_type_support
100 - . 'div, th.column-' . $post_type_support
101 - . ', td.' . $post_type_support; // td for raw in edit screen
102 - }
89 + $metaboxes[] = '#' . $post_type_support
90 + . ', #' . $post_type_support
91 + . 'div, th.column-' . $post_type_support
92 + . ', td.' . $post_type_support; // td for raw in edit screen
103 93 }
104 -
105 94 if ( function_exists( 'current_theme_supports' )
106 95 && current_theme_supports(
107 96 'post-thumbnails', $post_type
108 97 )
@@ -130,11 +119,10 @@
130 119 );
131 120 $metaboxes = array_merge( $metaboxes, $quickedit_areas );
132 121
133 122 $metaboxes_names = array(
134 - esc_attr__( 'Help', 'adminimize' ),
135 - esc_attr__( 'Screen Options', 'adminimize' ),
136 - esc_attr__( 'Add New', 'adminimize' ),
123 + esc_attr__( 'Help' ),
124 + esc_attr__( 'Screen Options' ),
137 125 esc_attr__( 'Permalink', 'adminimize' ),
138 126 esc_attr__( 'Tags', 'adminimize' ),
139 127 esc_attr__( 'Format', 'adminimize' ),
140 128 esc_attr__( 'Categories', 'adminimize' ),
@@ -146,20 +134,17 @@
146 134 esc_attr__( 'Media Buttons (all)', 'adminimize' ),
147 135 esc_attr__( 'Word count', 'adminimize' ),
148 136 esc_attr__( 'Post Slug', 'adminimize' ),
149 137 esc_attr__( 'Publish Actions', 'adminimize' ),
150 - esc_attr__( 'Discussion', 'adminimize' ),
151 - esc_attr__( 'HTML Editor Button', 'adminimize' ),
138 + esc_attr__( 'Discussion' ),
139 + esc_attr__( 'HTML Editor Button' ),
152 140 );
153 141
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 - }
142 + foreach ( $GLOBALS[ '_wp_post_type_features' ][ $post_type ] as $post_type_support => $key ) {
143 + if ( post_type_supports( $post_type, $post_type_support ) ) {
144 + $metaboxes_names[] = ucfirst( $post_type_support );
159 145 }
160 146 }
161 -
162 147 if ( function_exists( 'current_theme_supports' )
163 148 && current_theme_supports(
164 149 'post-thumbnails', 'post'
165 150 )
@@ -165,9 +150,8 @@
165 150 )
166 151 ) {
167 152 $metaboxes_names[] = esc_attr__( 'Post Thumbnail', 'adminimize' );
168 153 }
169 -
170 154 if ( function_exists( 'sticky_add_meta_box' ) ) {
171 155 $metaboxes_names[] = 'Post Sticky Status';
172 156 }
173 157
@@ -174,17 +158,17 @@
174 158 // quick edit names
175 159 $quickedit_names = array(
176 160 '<strong>' . esc_attr__( 'Quick Edit Link', 'adminimize' ) . '</strong>',
177 161 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' ),
162 + '&emsp;QE &rArr;' . ' ' . esc_attr__( 'All Labels', 'adminimize' ),
163 + '&emsp;QE &rArr;' . ' ' . esc_attr__( 'Author' ),
164 + '&emsp;QE &rArr;' . ' ' . esc_attr__( 'Password and Private', 'adminimize' ),
181 165 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' ),
166 + '&emsp;QE &rArr;' . ' ' . esc_attr__( 'Categories Title', 'adminimize' ),
167 + '&emsp;QE &rArr;' . ' ' . esc_attr__( 'Categories List', 'adminimize' ),
184 168 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' ),
169 + '&emsp;QE &rArr;' . ' ' . esc_attr__( 'Tags' ),
170 + '&emsp;QE &rArr;' . ' ' . esc_attr__( 'Status, Sticky', 'adminimize' ),
187 171 esc_attr__( 'QE', 'adminimize' ) . ' ' . esc_attr__( 'Cancel/Save Button', 'adminimize' ),
188 172 );
189 173 $metaboxes_names = array_merge( $metaboxes_names, $quickedit_names );
190 174
@@ -214,9 +198,9 @@
214 198 $x = 0;
215 199 foreach ( $metaboxes as $index => $metabox ) {
216 200 if ( '' !== $metabox ) {
217 201 $checked_user_role_ = array();
218 - foreach ( (array) $user_roles as $role ) {
202 + foreach ( $user_roles as $role ) {
219 203 $disabled_metaboxes_[ $post_type . '_' . $role ] = _mw_adminimize_get_option_value(
220 204 'mw_adminimize_disabled_metaboxes_' . $post_type . '_' . $role . '_items'
221 205 );
222 206 $checked_user_role_[ $post_type . '_' . $role ] = (
@@ -221,9 +205,9 @@
221 205 );
222 206 $checked_user_role_[ $post_type . '_' . $role ] = (
223 207 isset( $disabled_metaboxes_[ $post_type . '_' . $role ] )
224 208 && in_array(
225 - $metabox, $disabled_metaboxes_[ $post_type . '_' . $role ], TRUE
209 + $metabox, $disabled_metaboxes_[ $post_type . '_' . $role ]
226 210 )
227 211 ) ? ' checked="checked"' : '';
228 212 }
229 213 echo '<tr>' . "\n";
@@ -228,17 +212,16 @@
228 212 }
229 213 echo '<tr>' . "\n";
230 214 echo '<td>' . $metaboxes_names[ $index ] .
231 215 ' <span>(' . $metabox . ')</span> </td>' . "\n";
232 - foreach ( $user_roles as $role_slug ) {
216 + foreach ( $user_roles as $role ) {
233 217 echo '<td class="num">';
234 218 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 ] .
219 + $post_type . $role . $x . '" class="write_cp_options_'
220 + . preg_replace( '/[^a-z0-9]+/', '', $role ) . '" type="checkbox"' .
221 + $checked_user_role_[ $post_type . '_' . $role ] .
239 222 ' name="mw_adminimize_disabled_metaboxes_' . $post_type .
240 - '_' . $role_slug . '_items[]" value="' . $metabox . '" />';
223 + '_' . $role . '_items[]" value="' . $metabox . '" />';
241 224 echo '</td>' . "\n";
242 225 }
243 226 echo '</tr>' . "\n";
244 227 $x ++;
@@ -248,9 +231,9 @@
248 231 </tbody>
249 232 </table>
250 233
251 234 <?php
252 - // Your own post options
235 + //your own post options
253 236 ?>
254 237 <br style="margin-top: 10px;" />
255 238 <table summary="config_own_post" class="widefat">
256 239 <thead>
@@ -256,16 +239,15 @@
256 239 <thead>
257 240 <tr>
258 241 <th>
259 242 <?php echo sprintf(
260 - esc_attr__( 'Your own %s options', 'adminimize' ),
261 - $post_type_object->label
243 + esc_attr__( 'Your own %s options', 'adminimize' ), $post_type_object->label
262 244 );
263 245 echo '<br />';
264 - esc_attr_e( 'Option name', 'adminimize' ); ?>
246 + esc_attr_e( 'ID or class', 'adminimize' ); ?>
265 247 </th>
266 248 <th><?php echo '<br />';
267 - esc_attr_e( 'Selector, ID or class', 'adminimize' ); ?></th>
249 + esc_attr_e( 'Option', 'adminimize' ); ?></th>
268 250 </tr>
269 251 </thead>
270 252
271 253 <tbody>
@@ -285,29 +267,25 @@
285 267 style="width: 95%;"><?php echo _mw_adminimize_get_option_value(
286 268 '_mw_adminimize_own_options_' . $post_type
287 269 ); ?></textarea>
288 270 <br />
289 - <label for="_mw_adminimize_own_options_<?php echo $post_type; ?>">
290 271 <?php esc_attr_e(
291 272 'Possible nomination for ID or class. Separate multiple nominations through a carriage return.',
292 273 'adminimize'
293 274 ); ?>
294 - </label>
295 275 </td>
296 276 <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>
277 + <textarea class="code" name="_mw_adminimize_own_values_<?php echo $post_type; ?>"
278 + cols="60" rows="3"
279 + id="_mw_adminimize_own_values_<?php echo $post_type; ?>"
280 + style="width: 95%;"><?php echo _mw_adminimize_get_option_value(
281 + '_mw_adminimize_own_values_' . $post_type
282 + ); ?></textarea>
303 283 <br />
304 - <label for="_mw_adminimize_own_values_<?php echo $post_type; ?>">
305 284 <?php esc_attr_e(
306 285 'Possible IDs or classes. Separate multiple values through a carriage return.',
307 286 'adminimize'
308 287 ); ?>
309 - </label>
310 288 </td>
311 289 </tr>
312 290 </tbody>
313 291 </table>
@@ -319,9 +297,9 @@
319 297 value="<?php esc_attr_e( 'Update Options', 'adminimize' ); ?> &raquo;" />
320 298 <input type="hidden" name="page_options" value="'dofollow_timeout'" />
321 299 </p>
322 300
323 - <a class="alignright button adminimize-scroltop" href="#"
301 + <p><a class="alignright button" href="javascript:void(0);"
324 302 onclick="window.scrollTo(0,0);" style="margin:3px 0 0 30px;">
325 303 <?php esc_attr_e( 'scroll to top', 'adminimize' ); ?></a>
326 304 <br class="clear" />
327 305 </p>
@@ -329,5 +307,5 @@
329 307 </div>
330 308 </div>
331 309 </div>
332 310
333 -<?php } // end foreach ?>
311 +<?php } // end foreach ?>