PluginProbe
Adminimize / 1.7.18
Adminimize v1.7.18
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.7.18, at inc-options/write_cp_options.php

253 lines 11.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
12 $args = array( 'public' => TRUE, '_builtin' => FALSE );
13 foreach ( get_post_types( $args ) as $post_type ) {
14 $post_type_object = get_post_type_object($post_type);
15 ?>
16
17 <div id="poststuff" class="ui-sortable meta-box-sortables">
18 <div class="postbox">
19 <div class="handlediv" title="<?php _e('Click to toggle'); ?>"><br/></div>
20 <h3 class="hndle" id="config_edit_<?php echo $post_type; ?>">
21 <?php _e('Write options', FB_ADMINIMIZE_TEXTDOMAIN ); echo ' - ' . $post_type_object->label; ?>
22 </h3>
23 <div class="inside">
24 <br class="clear" />
25
26 <table summary="config_edit_post" class="widefat">
27 <thead>
28 <tr>
29 <th><?php _e('Write options', FB_ADMINIMIZE_TEXTDOMAIN ); echo ' - ' . $post_type_object->label ?></th>
30 <?php
31 foreach ( $user_roles_names as $role_name ) { ?>
32 <th><?php _e('Deactivate for', FB_ADMINIMIZE_TEXTDOMAIN ); echo '<br/>' . $role_name; ?></th>
33 <?php } ?>
34 </tr>
35 </thead>
36
37 <tbody>
38 <?php
39 $metaboxes = array(
40 '#contextual-help-link-wrap',
41 '#screen-options-link-wrap',
42 '#pageslugdiv',
43 '#tagsdiv,#tagsdivsb,#tagsdiv-post_tag',
44 '#formatdiv',
45 '#categorydiv,#categorydivsb',
46 '#category-add-toggle',
47 '#passworddiv',
48 '.side-info',
49 '#notice',
50 '#post-body h2',
51 '#media-buttons',
52 '#wp-word-count',
53 '#slugdiv,#edit-slug-box',
54 '#misc-publishing-actions',
55 '#commentstatusdiv',
56 '#editor-toolbar #edButtonHTML, #quicktags'
57 );
58
59 foreach ( $GLOBALS['_wp_post_type_features'][$post_type] as $post_type_support => $key ) {
60 if ( post_type_supports( $post_type, $post_type_support ) )
61 if ( 'excerpt' === $post_type_support )
62 $post_type_support = 'postexcerpt';
63 if ( 'page-attributes' === $post_type_support )
64 $post_type_support = 'pageparentdiv';
65 if ( 'custom-fields' == $post_type_support )
66 $post_type_support = 'postcustom';
67 array_push( $metaboxes, '#' . $post_type_support . ', #' . $post_type_support . 'div' );
68 }
69 if ( function_exists('current_theme_supports') &&
70 current_theme_supports( 'post-thumbnails', $post_type )
71 )
72 array_push($metaboxes, '#postimagediv');
73 if (function_exists('sticky_add_meta_box'))
74 array_push($metaboxes, '#poststickystatusdiv');
75
76 // quick edit areas, id and class
77 $quickedit_areas = array(
78 'div.row-actions .inline',
79 'fieldset.inline-edit-col-left',
80 'fieldset.inline-edit-col-left label',
81 'fieldset.inline-edit-col-left label.inline-edit-author',
82 'fieldset.inline-edit-col-left .inline-edit-group',
83 'fieldset.inline-edit-col-center',
84 'fieldset.inline-edit-col-center .inline-edit-categories-label',
85 'fieldset.inline-edit-col-center .category-checklist',
86 'fieldset.inline-edit-col-right',
87 'fieldset.inline-edit-col-right .inline-edit-tags',
88 'fieldset.inline-edit-col-right .inline-edit-group',
89 'tr.inline-edit-save p.inline-edit-save'
90 );
91 $metaboxes = array_merge( $metaboxes, $quickedit_areas );
92
93 $metaboxes_names = array(
94 __('Help'),
95 __('Screen Options'),
96 __('Permalink', FB_ADMINIMIZE_TEXTDOMAIN ),
97 __('Tags', FB_ADMINIMIZE_TEXTDOMAIN ),
98 __('Format', FB_ADMINIMIZE_TEXTDOMAIN),
99 __('Categories', FB_ADMINIMIZE_TEXTDOMAIN ),
100 __('Add New Category', FB_ADMINIMIZE_TEXTDOMAIN ),
101 __('Password Protect This Post', FB_ADMINIMIZE_TEXTDOMAIN ),
102 __('Related, Shortcuts', FB_ADMINIMIZE_TEXTDOMAIN ),
103 __('Messages', FB_ADMINIMIZE_TEXTDOMAIN ),
104 __('h2: Advanced Options', FB_ADMINIMIZE_TEXTDOMAIN ),
105 __('Media Buttons (all)', FB_ADMINIMIZE_TEXTDOMAIN ),
106 __('Word count', FB_ADMINIMIZE_TEXTDOMAIN ),
107 __('Post Slug', FB_ADMINIMIZE_TEXTDOMAIN),
108 __('Publish Actions', FB_ADMINIMIZE_TEXTDOMAIN ),
109 __('Discussion'),
110 __('HTML Editor Button')
111 );
112
113 foreach ( $GLOBALS['_wp_post_type_features'][$post_type] as $post_type_support => $key ) {
114 if ( post_type_supports( $post_type, $post_type_support ) )
115 array_push( $metaboxes_names, ucfirst($post_type_support) );
116 }
117 if ( function_exists('current_theme_supports') &&
118 current_theme_supports( 'post-thumbnails', 'post' )
119 )
120 array_push($metaboxes_names, __('Post Thumbnail', FB_ADMINIMIZE_TEXTDOMAIN) );
121 if (function_exists('sticky_add_meta_box'))
122 array_push($metaboxes_names, 'Post Sticky Status');
123
124 // quick edit names
125 $quickedit_names = array(
126 '<strong>' .__('Quick Edit Link', FB_ADMINIMIZE_TEXTDOMAIN) . '</strong>',
127 __('QE', FB_ADMINIMIZE_TEXTDOMAIN) . ' ' . __('Inline Edit Left', FB_ADMINIMIZE_TEXTDOMAIN),
128 '&emsp;QE &rArr;' . ' ' . __('All Labels', FB_ADMINIMIZE_TEXTDOMAIN),
129 '&emsp;QE &rArr;' . ' ' . __('Author'),
130 '&emsp;QE &rArr;' . ' ' . __('Password and Private', FB_ADMINIMIZE_TEXTDOMAIN),
131 __('QE', FB_ADMINIMIZE_TEXTDOMAIN) . ' ' . __('Inline Edit Center', FB_ADMINIMIZE_TEXTDOMAIN),
132 '&emsp;QE &rArr;' . ' ' . __('Categories Title', FB_ADMINIMIZE_TEXTDOMAIN),
133 '&emsp;QE &rArr;' . ' ' . __('Categories List', FB_ADMINIMIZE_TEXTDOMAIN),
134 __('QE', FB_ADMINIMIZE_TEXTDOMAIN) . ' ' . __('Inline Edit Right', FB_ADMINIMIZE_TEXTDOMAIN),
135 '&emsp;QE &rArr;' . ' ' . __('Tags'),
136 '&emsp;QE &rArr;' . ' ' . __('Status, Sticky', FB_ADMINIMIZE_TEXTDOMAIN),
137 __('QE', FB_ADMINIMIZE_TEXTDOMAIN) . ' ' . __('Cancel/Save Button', FB_ADMINIMIZE_TEXTDOMAIN)
138 );
139 $metaboxes_names = array_merge($metaboxes_names, $quickedit_names);
140
141 // add own post options
142 $_mw_adminimize_own_values_[$post_type] = _mw_adminimize_get_option_value(
143 '_mw_adminimize_own_values_' . $post_type
144 );
145 $_mw_adminimize_own_values_[$post_type] = preg_split( "/\r\n/", $_mw_adminimize_own_values_[$post_type] );
146 foreach ( (array) $_mw_adminimize_own_values_[$post_type] as $key => $_mw_adminimize_own_value_[$post_type] ) {
147 $_mw_adminimize_own_value_[$post_type] = trim( $_mw_adminimize_own_value_[$post_type] );
148 array_push( $metaboxes, $_mw_adminimize_own_value_[$post_type] );
149 }
150
151 $_mw_adminimize_own_options_[$post_type] = _mw_adminimize_get_option_value(
152 '_mw_adminimize_own_options_' . $post_type
153 );
154 $_mw_adminimize_own_options_[$post_type] = preg_split( "/\r\n/", $_mw_adminimize_own_options_[$post_type] );
155 foreach ( (array) $_mw_adminimize_own_options_[$post_type] as $key => $_mw_adminimize_own_option_[$post_type] ) {
156 $_mw_adminimize_own_option_[$post_type] = trim( $_mw_adminimize_own_option_[$post_type] );
157 array_push( $metaboxes_names, $_mw_adminimize_own_option_[$post_type] );
158 }
159
160 $x = 0;
161 $class = '';
162 foreach ($metaboxes as $index => $metabox) {
163 if ( '' != $metabox ) {
164 $class = ( ' class="alternate"' == $class ) ? '' : ' class="alternate"';
165 $checked_user_role_ = array();
166 foreach ($user_roles as $role) {
167 $disabled_metaboxes_[$post_type . '_' . $role] = _mw_adminimize_get_option_value(
168 'mw_adminimize_disabled_metaboxes_' . $post_type . '_' . $role . '_items'
169 );
170 $checked_user_role_[$post_type . '_' . $role] = (
171 isset($disabled_metaboxes_[$post_type . '_' . $role]) &&
172 in_array($metabox, $disabled_metaboxes_[$post_type . '_' . $role])
173 ) ? ' checked="checked"' : '';
174 }
175 echo '<tr' . $class . '>' . "\n";
176 echo '<td>' . $metaboxes_names[$index] .
177 ' <span style="color:#ccc; font-weight: 400;">(' . $metabox . ')</span> </td>' . "\n";
178 foreach ($user_roles as $role) {
179 echo '<td class="num"><input id="check_' .
180 $post_type . $role . $x .'" type="checkbox"' .
181 $checked_user_role_[$post_type . '_' . $role] .
182 ' name="mw_adminimize_disabled_metaboxes_' . $post_type .
183 '_'. $role .'_items[]" value="' . $metabox . '" /></td>' . "\n";
184 }
185 echo '</tr>' . "\n";
186 $x ++;
187 }
188 }
189 ?>
190 </tbody>
191 </table>
192
193 <?php
194 //your own post options
195 ?>
196 <br style="margin-top: 10px;" />
197 <table summary="config_own_post" class="widefat">
198 <thead>
199 <tr>
200 <th>
201 <?php echo sprintf( __('Your own %s options', FB_ADMINIMIZE_TEXTDOMAIN ), $post_type_object->label );
202 echo '<br />'; _e('ID or class', FB_ADMINIMIZE_TEXTDOMAIN ); ?>
203 </th>
204 <th><?php echo '<br />'; _e('Option', FB_ADMINIMIZE_TEXTDOMAIN ); ?></th>
205 </tr>
206 </thead>
207
208 <tbody>
209 <tr valign="top">
210 <td colspan="2">
211 <?php _e('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.', FB_ADMINIMIZE_TEXTDOMAIN ); ?>
212 </td>
213 </tr>
214 <tr valign="top">
215 <td>
216 <textarea name="_mw_adminimize_own_options_<?php echo $post_type; ?>"
217 cols="60" rows="3"
218 id="_mw_adminimize_own_options_<?php echo $post_type; ?>"
219 style="width: 95%;" ><?php echo _mw_adminimize_get_option_value('_mw_adminimize_own_' . $post_type . '_options'); ?></textarea>
220 <br />
221 <?php _e('Possible nomination for ID or class. Separate multiple nominations through a carriage return.', FB_ADMINIMIZE_TEXTDOMAIN ); ?>
222 </td>
223 <td>
224 <textarea class="code" name="_mw_adminimize_own_values_<?php echo $post_type; ?>"
225 cols="60" rows="3"
226 id="_mw_adminimize_own_values_<?php echo $post_type; ?>"
227 style="width: 95%;" >
228 <?php echo _mw_adminimize_get_option_value('_mw_adminimize_own_' . $post_type . '_values'); ?></textarea>
229 <br />
230 <?php _e('Possible IDs or classes. Separate multiple values through a carriage return.', FB_ADMINIMIZE_TEXTDOMAIN ); ?>
231 </td>
232 </tr>
233 </tbody>
234 </table>
235
236 <p id="submitbutton">
237 <input type="hidden" name="_mw_adminimize_action" value="_mw_adminimize_insert" />
238 <input class="button button-primary" type="submit"
239 name="_mw_adminimize_save"
240 value="<?php _e('Update Options', FB_ADMINIMIZE_TEXTDOMAIN ); ?> &raquo;" />
241 <input type="hidden" name="page_options" value="'dofollow_timeout'" />
242 </p>
243 <p><a class="alignright button" href="javascript:void(0);"
244 onclick="window.scrollTo(0,0);" style="margin:3px 0 0 30px;">
245 <?php _e('scroll to top', FB_ADMINIMIZE_TEXTDOMAIN); ?></a>
246 <br class="clear" />
247 </p>
248
249 </div>
250 </div>
251 </div>
252
253 <?php } // end foreach ?>