PluginProbe
Adminimize / 1.11.8
Adminimize v1.11.8
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_post_options.php

write_post_options.php in Adminimize 1.11.8, at inc-options/write_post_options.php

289 lines 11.0 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 Post 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
12 if ( ! isset( $user_roles ) ) {
13 $user_roles = _mw_adminimize_get_all_user_roles();
14 }
15
16 if ( ! isset( $user_roles_names ) ) {
17 $user_roles_names = _mw_adminimize_get_all_user_roles_names();
18 }
19 ?>
20
21 <div id="poststuff" class="ui-sortable meta-box-sortables">
22 <div class="postbox">
23 <h3 class="hndle ui-sortable-handle" title="<?php esc_attr_e( 'Click to toggle', 'adminimize' ); ?>" id="config_edit_post" title="<?php esc_attr_e( 'Click to toggle', 'adminimize' ); ?>"><?php
24 esc_attr_e( 'Write options - Post', 'adminimize' ); ?></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 ( (array) $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 - Post', 'adminimize' ); ?></th>
42 <?php
43 foreach ( (array) $user_roles_names as $role_name ) { ?>
44 <th><?php esc_attr_e( 'Deactivate for', 'adminimize' ); echo '<br/>' . $role_name; ?></th>
45 <?php } ?>
46 </tr>
47 <tr>
48 <td><?php esc_attr_e( 'Select all', 'adminimize' ); ?></td>
49 <?php
50 foreach ( (array) $user_roles as $role_slug ) {
51 echo '<td class="num"><input id="select_all" class="write_post_options_'
52 . esc_attr( $role_slug ) . '" type="checkbox" name="" value="" /></td>' . "\n";
53 } ?>
54 </tr>
55 </thead>
56
57 <tbody>
58 <?php
59 $metaboxes = array(
60 '#contextual-help-link-wrap',
61 '#screen-options-link-wrap',
62 '.page-title-action',
63 '#title, #titlediv, th.column-title, td.title',
64 '#pageslugdiv',
65 '#tags, #tagsdiv,#tagsdivsb,#tagsdiv-post_tag, th.column-tags, td.tags',
66 '#categories, #categorydiv, #categorydivsb, th.column-categories, td.categories',
67 '#category-add-toggle',
68 '#date, #datediv, th.column-date, td.date, div.curtime',
69 '#passworddiv',
70 '.side-info',
71 '#notice',
72 '#post-body h2',
73 '#media-buttons, #wp-content-media-buttons',
74 '#wp-word-count',
75 '#slugdiv,#edit-slug-box',
76 '#misc-publishing-actions',
77 '#commentstatusdiv',
78 '#editor-toolbar #edButtonHTML, #quicktags, #content-html, .wp-switch-editor.switch-html',
79 );
80
81 $post_type = 'post';
82 foreach ( $GLOBALS[ '_wp_post_type_features' ][ $post_type ] as $post_type_support => $key ) {
83 if ( post_type_supports( $post_type, $post_type_support )
84 && 'excerpt' === $post_type_support
85 ) {
86 $post_type_support = $post_type . 'excerpt';
87 }
88 if ( 'page-attributes' === $post_type_support ) {
89 $post_type_support = 'pageparentdiv';
90 }
91 if ( 'custom-fields' === $post_type_support ) {
92 $post_type_support = $post_type . 'custom';
93 }
94 if ( 'post-formats' === $post_type_support ) {
95 $post_type_support = 'format';
96 }
97 if ( 'editor' === $post_type_support ) {
98 $post_type_support = 'postdivrich';
99 }
100
101 $metaboxes[] = '#' . $post_type_support
102 . ', #' . $post_type_support
103 . 'div, th.column-' . $post_type_support
104 . ', td.' . $post_type_support; //th and td for raw in edit screen
105 }
106
107 if ( function_exists( 'current_theme_supports' )
108 && current_theme_supports(
109 'post-thumbnails', 'post'
110 )
111 ) {
112 $metaboxes[] = '#postimagediv';
113 }
114
115 // quick edit areas, id and class
116 $quickedit_areas = array(
117 'div.row-actions, div.row-actions .inline',
118 'fieldset.inline-edit-col-left',
119 'fieldset.inline-edit-col-left label',
120 'fieldset.inline-edit-col-left label.inline-edit-author',
121 'fieldset.inline-edit-col-left .inline-edit-group',
122 'fieldset.inline-edit-col-center',
123 'fieldset.inline-edit-col-center .inline-edit-categories-label',
124 'fieldset.inline-edit-col-center .category-checklist',
125 'fieldset.inline-edit-col-right',
126 'fieldset.inline-edit-col-right .inline-edit-tags',
127 'fieldset.inline-edit-col-right .inline-edit-group',
128 'tr.inline-edit-post p.inline-edit-save'
129 );
130 $metaboxes = array_merge( $metaboxes, $quickedit_areas );
131
132 $metaboxes_names = array(
133 esc_attr__( 'Help', 'adminimize' ),
134 esc_attr__( 'Screen Options', 'adminimize' ),
135 esc_attr__( 'Add New', 'adminimize' ),
136 esc_attr__( 'Title', 'adminimize' ),
137 esc_attr__( 'Permalink', 'adminimize' ),
138 esc_attr__( 'Tags', 'adminimize' ),
139 esc_attr__( 'Categories', 'adminimize' ),
140 esc_attr__( 'Add New Category', 'adminimize' ),
141 esc_attr__( 'Date', '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', 'adminimize' ),
151 esc_attr__( 'HTML Editor Button', 'adminimize' )
152 );
153
154 foreach ( $GLOBALS[ '_wp_post_type_features' ][ $post_type ] as $post_type_support => $key ) {
155 if ( post_type_supports( $post_type, $post_type_support ) ) {
156 $metaboxes_names[] = ucfirst( $post_type_support );
157 }
158 }
159
160 if ( function_exists( 'current_theme_supports' )
161 && current_theme_supports(
162 'post-thumbnails', 'post'
163 )
164 ) {
165 $metaboxes_names[] = esc_attr__( 'Post Thumbnail', 'adminimize' );
166 }
167
168 // quick edit names
169 $quickedit_names = array(
170 '<strong>' . esc_attr__( 'Quick Edit Link', 'adminimize' ) . '</strong>',
171 esc_attr__( 'QE', 'adminimize' ) . ' ' . esc_attr__( 'Inline Edit Left', 'adminimize' ),
172 '&emsp;' . esc_attr__( 'QE', 'adminimize' ) . ' &rArr;' . ' ' . esc_attr__( 'All Labels', 'adminimize' ),
173 '&emsp;' . esc_attr__( 'QE', 'adminimize' ) . ' &rArr;' . ' ' . esc_attr__( 'Author' ),
174 '&emsp;' . esc_attr__( 'QE', 'adminimize' ) . ' &rArr;' . ' ' . esc_attr__( 'Password and Private', 'adminimize' ),
175 esc_attr__( 'QE', 'adminimize' ) . ' ' . esc_attr__( 'Inline Edit Center', 'adminimize' ),
176 '&emsp;' . esc_attr__( 'QE', 'adminimize' ) . ' &rArr;' . ' ' . esc_attr__( 'Categories Title', 'adminimize' ),
177 '&emsp;' . esc_attr__( 'QE', 'adminimize' ) . ' &rArr;' . ' ' . esc_attr__( 'Categories List', 'adminimize' ),
178 esc_attr__( 'QE', 'adminimize' ) . ' ' . esc_attr__( 'Inline Edit Right', 'adminimize' ),
179 '&emsp;' . esc_attr__( 'QE', 'adminimize' ) . ' &rArr;' . ' ' . esc_attr__( 'Tags' ),
180 '&emsp;' . esc_attr__( 'QE', 'adminimize' ) . ' &rArr;' . ' ' . esc_attr__( 'Status, Sticky', 'adminimize' ),
181 esc_attr__( 'QE', 'adminimize' ) . ' ' . esc_attr__( 'Cancel/Save Button', 'adminimize' )
182 );
183 $metaboxes_names = array_merge( $metaboxes_names, $quickedit_names );
184
185 // add own post options
186 $_mw_adminimize_own_post_values = _mw_adminimize_get_option_value( '_mw_adminimize_own_post_values' );
187 $_mw_adminimize_own_post_values = preg_split( "/\r\n/", $_mw_adminimize_own_post_values );
188 foreach ( (array) $_mw_adminimize_own_post_values as $key => $_mw_adminimize_own_post_value ) {
189 $_mw_adminimize_own_post_value = trim( $_mw_adminimize_own_post_value );
190 $metaboxes[] = $_mw_adminimize_own_post_value;
191 }
192
193 $_mw_adminimize_own_post_options = _mw_adminimize_get_option_value( '_mw_adminimize_own_post_options' );
194 $_mw_adminimize_own_post_options = preg_split( "/\r\n/", $_mw_adminimize_own_post_options );
195 foreach ( (array) $_mw_adminimize_own_post_options as $key => $_mw_adminimize_own_post_option ) {
196 $_mw_adminimize_own_post_option = trim( $_mw_adminimize_own_post_option );
197 $metaboxes_names[] = $_mw_adminimize_own_post_option;
198 }
199
200 $x = 0;
201 foreach ( $metaboxes as $index => $metabox ) {
202 if ( '' !== $metabox ) {
203 $checked_user_role_ = array();
204 foreach ( $user_roles as $role ) {
205 $checked_user_role_[ $role ] = ( isset( $disabled_metaboxes_post_[ $role ] )
206 && in_array(
207 $metabox, $disabled_metaboxes_post_[ $role ], FALSE
208 ) ) ? ' checked="checked"' : '';
209 }
210 echo '<tr>' . "\n";
211 echo '<td>' . $metaboxes_names[ $index ] . ' <span>(' . $metabox . ')</span> </td>' . "\n";
212 foreach ( $user_roles as $role ) {
213 echo '<td class="num">';
214 echo '<input id="check_post' . $role . $x . '" class="write_post_options_'
215 . preg_replace( '/[^a-z0-9_-]+/', '', $role ) . '" type="checkbox"'
216 . $checked_user_role_[ $role ] . ' name="mw_adminimize_disabled_metaboxes_post_'
217 . $role . '_items[]" value="' . $metabox . '" />';
218 echo '</td>' . "\n";
219 }
220 echo '</tr>' . "\n";
221 $x ++;
222 }
223 }
224 ?>
225 </tbody>
226 </table>
227
228 <?php
229 //your own post options
230 ?>
231 <br style="margin-top: 10px;" />
232 <table summary="config_own_post" class="widefat">
233 <thead>
234 <tr>
235 <th><?php esc_attr_e( 'Your own options', 'adminimize' );
236 echo '<br />';
237 esc_attr_e( 'Option name', 'adminimize' ); ?></th>
238 <th><?php echo '<br />';
239 esc_attr_e( 'Selector, ID or class', 'adminimize' ); ?></th>
240 </tr>
241 </thead>
242
243 <tbody>
244 <tr valign="top">
245 <td colspan="2"><?php esc_attr_e(
246 '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.',
247 'adminimize'
248 ); ?></td>
249 </tr>
250 <tr valign="top">
251 <td>
252 <textarea name="_mw_adminimize_own_post_options" cols="60" rows="3" id="_mw_adminimize_own_post_options" style="width: 95%;"><?php echo _mw_adminimize_get_option_value(
253 '_mw_adminimize_own_post_options'
254 ); ?></textarea>
255 <br />
256 <?php esc_attr_e(
257 'Possible nomination for ID or class. Separate multiple nominations through a carriage return.',
258 'adminimize'
259 ); ?>
260 </td>
261 <td>
262 <textarea class="code" name="_mw_adminimize_own_post_values" cols="60" rows="3" id="_mw_adminimize_own_post_values" style="width: 95%;"><?php echo _mw_adminimize_get_option_value(
263 '_mw_adminimize_own_post_values'
264 ); ?></textarea>
265 <br />
266 <?php esc_attr_e(
267 'Possible IDs or classes. Separate multiple values through a carriage return.', 'adminimize'
268 ); ?>
269 </td>
270 </tr>
271 </tbody>
272 </table>
273
274 <p id="submitbutton">
275 <input type="hidden" name="_mw_adminimize_action" value="_mw_adminimize_insert" />
276 <input class="button button-primary" type="submit" name="_mw_adminimize_save" value="<?php esc_attr_e(
277 'Update Options', 'adminimize'
278 ); ?> &raquo;" /><input type="hidden" name="page_options" value="'dofollow_timeout'" />
279 </p>
280
281 <p>
282 <a class="alignright button adminimize-scroltop" href="#" style="margin:3px 0 0 30px;"><?php esc_attr_e(
283 'scroll to top', 'adminimize'
284 ); ?></a><br class="clear" /></p>
285
286 </div>
287 </div>
288 </div>
289