| @@ -1,253 +1,311 @@ | ||
| 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 | - ' QE ⇒' . ' ' . __('All Labels', FB_ADMINIMIZE_TEXTDOMAIN), | |
| 129 | - ' QE ⇒' . ' ' . __('Author'), | |
| 130 | - ' QE ⇒' . ' ' . __('Password and Private', FB_ADMINIMIZE_TEXTDOMAIN), | |
| 131 | - __('QE', FB_ADMINIMIZE_TEXTDOMAIN) . ' ' . __('Inline Edit Center', FB_ADMINIMIZE_TEXTDOMAIN), | |
| 132 | - ' QE ⇒' . ' ' . __('Categories Title', FB_ADMINIMIZE_TEXTDOMAIN), | |
| 133 | - ' QE ⇒' . ' ' . __('Categories List', FB_ADMINIMIZE_TEXTDOMAIN), | |
| 134 | - __('QE', FB_ADMINIMIZE_TEXTDOMAIN) . ' ' . __('Inline Edit Right', FB_ADMINIMIZE_TEXTDOMAIN), | |
| 135 | - ' QE ⇒' . ' ' . __('Tags'), | |
| 136 | - ' QE ⇒' . ' ' . __('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 ); ?> »" /> | |
| 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 | - | |
| 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' ); ?>"><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 | + <thead> | |
| 31 | + <tr> | |
| 32 | + <th><?php esc_attr_e( 'Write options', 'adminimize' ); | |
| 33 | + echo ' - ' . $post_type_object->label ?></th> | |
| 34 | + <?php | |
| 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 } ?> | |
| 39 | + </tr> | |
| 40 | + <tr> | |
| 41 | + <td><?php esc_attr_e( 'Select all', 'adminimize' ); ?></td> | |
| 42 | + <?php | |
| 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"; | |
| 50 | + } ?> | |
| 51 | + </tr> | |
| 52 | + </thead> | |
| 53 | + | |
| 54 | + <tbody> | |
| 55 | + <?php | |
| 56 | + $metaboxes = array( | |
| 57 | + '#contextual-help-link-wrap', | |
| 58 | + '#screen-options-link-wrap', | |
| 59 | + '#pageslugdiv', | |
| 60 | + '#tagsdiv,#tagsdivsb,#tagsdiv-post_tag', | |
| 61 | + '#formatdiv', | |
| 62 | + '#categorydiv,#categorydivsb', | |
| 63 | + '#category-add-toggle', | |
| 64 | + '#passworddiv', | |
| 65 | + '.side-info', | |
| 66 | + '#notice', | |
| 67 | + '#post-body h2', | |
| 68 | + '#media-buttons, #wp-content-media-buttons', | |
| 69 | + '#wp-word-count', | |
| 70 | + '#slugdiv,#edit-slug-box', | |
| 71 | + '#misc-publishing-actions', | |
| 72 | + '#commentstatusdiv', | |
| 73 | + '#editor-toolbar #edButtonHTML, #quicktags, #content-html', | |
| 74 | + ); | |
| 75 | + | |
| 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 ) { | |
| 79 | + $post_type_support = 'postexcerpt'; | |
| 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 | + } | |
| 88 | + | |
| 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 | |
| 93 | + } | |
| 94 | + if ( function_exists( 'current_theme_supports' ) | |
| 95 | + && current_theme_supports( | |
| 96 | + 'post-thumbnails', $post_type | |
| 97 | + ) | |
| 98 | + ) { | |
| 99 | + $metaboxes[] = '#postimagediv'; | |
| 100 | + } | |
| 101 | + if ( function_exists( 'sticky_add_meta_box' ) ) { | |
| 102 | + $metaboxes[] = '#poststickystatusdiv'; | |
| 103 | + } | |
| 104 | + | |
| 105 | + // quick edit areas, id and class | |
| 106 | + $quickedit_areas = array( | |
| 107 | + 'div.row-actions, div.row-actions .inline', | |
| 108 | + 'fieldset.inline-edit-col-left', | |
| 109 | + 'fieldset.inline-edit-col-left label', | |
| 110 | + 'fieldset.inline-edit-col-left label.inline-edit-author', | |
| 111 | + 'fieldset.inline-edit-col-left .inline-edit-group', | |
| 112 | + 'fieldset.inline-edit-col-center', | |
| 113 | + 'fieldset.inline-edit-col-center .inline-edit-categories-label', | |
| 114 | + 'fieldset.inline-edit-col-center .category-checklist', | |
| 115 | + 'fieldset.inline-edit-col-right', | |
| 116 | + 'fieldset.inline-edit-col-right .inline-edit-tags', | |
| 117 | + 'fieldset.inline-edit-col-right .inline-edit-group', | |
| 118 | + 'tr.inline-edit-save p.inline-edit-save', | |
| 119 | + ); | |
| 120 | + $metaboxes = array_merge( $metaboxes, $quickedit_areas ); | |
| 121 | + | |
| 122 | + $metaboxes_names = array( | |
| 123 | + esc_attr__( 'Help' ), | |
| 124 | + esc_attr__( 'Screen Options' ), | |
| 125 | + esc_attr__( 'Permalink', 'adminimize' ), | |
| 126 | + esc_attr__( 'Tags', 'adminimize' ), | |
| 127 | + esc_attr__( 'Format', 'adminimize' ), | |
| 128 | + esc_attr__( 'Categories', 'adminimize' ), | |
| 129 | + esc_attr__( 'Add New Category', 'adminimize' ), | |
| 130 | + esc_attr__( 'Password Protect This Post', 'adminimize' ), | |
| 131 | + esc_attr__( 'Related, Shortcuts', 'adminimize' ), | |
| 132 | + esc_attr__( 'Messages', 'adminimize' ), | |
| 133 | + esc_attr__( 'h2: Advanced Options', 'adminimize' ), | |
| 134 | + esc_attr__( 'Media Buttons (all)', 'adminimize' ), | |
| 135 | + esc_attr__( 'Word count', 'adminimize' ), | |
| 136 | + esc_attr__( 'Post Slug', 'adminimize' ), | |
| 137 | + esc_attr__( 'Publish Actions', 'adminimize' ), | |
| 138 | + esc_attr__( 'Discussion' ), | |
| 139 | + esc_attr__( 'HTML Editor Button' ), | |
| 140 | + ); | |
| 141 | + | |
| 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 ); | |
| 145 | + } | |
| 146 | + } | |
| 147 | + if ( function_exists( 'current_theme_supports' ) | |
| 148 | + && current_theme_supports( | |
| 149 | + 'post-thumbnails', 'post' | |
| 150 | + ) | |
| 151 | + ) { | |
| 152 | + $metaboxes_names[] = esc_attr__( 'Post Thumbnail', 'adminimize' ); | |
| 153 | + } | |
| 154 | + if ( function_exists( 'sticky_add_meta_box' ) ) { | |
| 155 | + $metaboxes_names[] = 'Post Sticky Status'; | |
| 156 | + } | |
| 157 | + | |
| 158 | + // quick edit names | |
| 159 | + $quickedit_names = array( | |
| 160 | + '<strong>' . esc_attr__( 'Quick Edit Link', 'adminimize' ) . '</strong>', | |
| 161 | + esc_attr__( 'QE', 'adminimize' ) . ' ' . esc_attr__( 'Inline Edit Left', 'adminimize' ), | |
| 162 | + ' QE ⇒' . ' ' . esc_attr__( 'All Labels', 'adminimize' ), | |
| 163 | + ' QE ⇒' . ' ' . esc_attr__( 'Author' ), | |
| 164 | + ' QE ⇒' . ' ' . esc_attr__( 'Password and Private', 'adminimize' ), | |
| 165 | + esc_attr__( 'QE', 'adminimize' ) . ' ' . esc_attr__( 'Inline Edit Center', 'adminimize' ), | |
| 166 | + ' QE ⇒' . ' ' . esc_attr__( 'Categories Title', 'adminimize' ), | |
| 167 | + ' QE ⇒' . ' ' . esc_attr__( 'Categories List', 'adminimize' ), | |
| 168 | + esc_attr__( 'QE', 'adminimize' ) . ' ' . esc_attr__( 'Inline Edit Right', 'adminimize' ), | |
| 169 | + ' QE ⇒' . ' ' . esc_attr__( 'Tags' ), | |
| 170 | + ' QE ⇒' . ' ' . esc_attr__( 'Status, Sticky', 'adminimize' ), | |
| 171 | + esc_attr__( 'QE', 'adminimize' ) . ' ' . esc_attr__( 'Cancel/Save Button', 'adminimize' ), | |
| 172 | + ); | |
| 173 | + $metaboxes_names = array_merge( $metaboxes_names, $quickedit_names ); | |
| 174 | + | |
| 175 | + // add own post options | |
| 176 | + $_mw_adminimize_own_values_[ $post_type ] = _mw_adminimize_get_option_value( | |
| 177 | + '_mw_adminimize_own_values_' . $post_type | |
| 178 | + ); | |
| 179 | + $_mw_adminimize_own_values_[ $post_type ] = preg_split( | |
| 180 | + "/\r\n/", $_mw_adminimize_own_values_[ $post_type ] | |
| 181 | + ); | |
| 182 | + foreach ( (array) $_mw_adminimize_own_values_[ $post_type ] as $key => $_mw_adminimize_own_value_[ $post_type ] ) { | |
| 183 | + $_mw_adminimize_own_value_[ $post_type ] = trim( $_mw_adminimize_own_value_[ $post_type ] ); | |
| 184 | + $metaboxes[] = $_mw_adminimize_own_value_[ $post_type ]; | |
| 185 | + } | |
| 186 | + | |
| 187 | + $_mw_adminimize_own_options_[ $post_type ] = _mw_adminimize_get_option_value( | |
| 188 | + '_mw_adminimize_own_options_' . $post_type | |
| 189 | + ); | |
| 190 | + $_mw_adminimize_own_options_[ $post_type ] = preg_split( | |
| 191 | + "/\r\n/", $_mw_adminimize_own_options_[ $post_type ] | |
| 192 | + ); | |
| 193 | + foreach ( (array) $_mw_adminimize_own_options_[ $post_type ] as $key => $_mw_adminimize_own_option_[ $post_type ] ) { | |
| 194 | + $_mw_adminimize_own_option_[ $post_type ] = trim( $_mw_adminimize_own_option_[ $post_type ] ); | |
| 195 | + $metaboxes_names[] = $_mw_adminimize_own_option_[ $post_type ]; | |
| 196 | + } | |
| 197 | + | |
| 198 | + $x = 0; | |
| 199 | + foreach ( $metaboxes as $index => $metabox ) { | |
| 200 | + if ( '' !== $metabox ) { | |
| 201 | + $checked_user_role_ = array(); | |
| 202 | + foreach ( $user_roles as $role ) { | |
| 203 | + $disabled_metaboxes_[ $post_type . '_' . $role ] = _mw_adminimize_get_option_value( | |
| 204 | + 'mw_adminimize_disabled_metaboxes_' . $post_type . '_' . $role . '_items' | |
| 205 | + ); | |
| 206 | + $checked_user_role_[ $post_type . '_' . $role ] = ( | |
| 207 | + isset( $disabled_metaboxes_[ $post_type . '_' . $role ] ) | |
| 208 | + && in_array( | |
| 209 | + $metabox, $disabled_metaboxes_[ $post_type . '_' . $role ] | |
| 210 | + ) | |
| 211 | + ) ? ' checked="checked"' : ''; | |
| 212 | + } | |
| 213 | + echo '<tr>' . "\n"; | |
| 214 | + echo '<td>' . $metaboxes_names[ $index ] . | |
| 215 | + ' <span>(' . $metabox . ')</span> </td>' . "\n"; | |
| 216 | + foreach ( $user_roles as $role ) { | |
| 217 | + echo '<td class="num">'; | |
| 218 | + echo '<input id="check_' . | |
| 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 ] . | |
| 222 | + ' name="mw_adminimize_disabled_metaboxes_' . $post_type . | |
| 223 | + '_' . $role . '_items[]" value="' . $metabox . '" />'; | |
| 224 | + echo '</td>' . "\n"; | |
| 225 | + } | |
| 226 | + echo '</tr>' . "\n"; | |
| 227 | + $x ++; | |
| 228 | + } | |
| 229 | + } | |
| 230 | + ?> | |
| 231 | + </tbody> | |
| 232 | + </table> | |
| 233 | + | |
| 234 | + <?php | |
| 235 | + //your own post options | |
| 236 | + ?> | |
| 237 | + <br style="margin-top: 10px;" /> | |
| 238 | + <table summary="config_own_post" class="widefat"> | |
| 239 | + <thead> | |
| 240 | + <tr> | |
| 241 | + <th> | |
| 242 | + <?php echo sprintf( | |
| 243 | + esc_attr__( 'Your own %s options', 'adminimize' ), $post_type_object->label | |
| 244 | + ); | |
| 245 | + echo '<br />'; | |
| 246 | + esc_attr_e( 'ID or class', 'adminimize' ); ?> | |
| 247 | + </th> | |
| 248 | + <th><?php echo '<br />'; | |
| 249 | + esc_attr_e( 'Option', 'adminimize' ); ?></th> | |
| 250 | + </tr> | |
| 251 | + </thead> | |
| 252 | + | |
| 253 | + <tbody> | |
| 254 | + <tr valign="top"> | |
| 255 | + <td colspan="2"> | |
| 256 | + <?php esc_attr_e( | |
| 257 | + '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.', | |
| 258 | + 'adminimize' | |
| 259 | + ); ?> | |
| 260 | + </td> | |
| 261 | + </tr> | |
| 262 | + <tr valign="top"> | |
| 263 | + <td> | |
| 264 | + <textarea name="_mw_adminimize_own_options_<?php echo $post_type; ?>" | |
| 265 | + cols="60" rows="3" | |
| 266 | + id="_mw_adminimize_own_options_<?php echo $post_type; ?>" | |
| 267 | + style="width: 95%;"><?php echo _mw_adminimize_get_option_value( | |
| 268 | + '_mw_adminimize_own_options_' . $post_type | |
| 269 | + ); ?></textarea> | |
| 270 | + <br /> | |
| 271 | + <?php esc_attr_e( | |
| 272 | + 'Possible nomination for ID or class. Separate multiple nominations through a carriage return.', | |
| 273 | + 'adminimize' | |
| 274 | + ); ?> | |
| 275 | + </td> | |
| 276 | + <td> | |
| 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> | |
| 283 | + <br /> | |
| 284 | + <?php esc_attr_e( | |
| 285 | + 'Possible IDs or classes. Separate multiple values through a carriage return.', | |
| 286 | + 'adminimize' | |
| 287 | + ); ?> | |
| 288 | + </td> | |
| 289 | + </tr> | |
| 290 | + </tbody> | |
| 291 | + </table> | |
| 292 | + | |
| 293 | + <p id="submitbutton"> | |
| 294 | + <input type="hidden" name="_mw_adminimize_action" value="_mw_adminimize_insert" /> | |
| 295 | + <input class="button button-primary" type="submit" | |
| 296 | + name="_mw_adminimize_save" | |
| 297 | + value="<?php esc_attr_e( 'Update Options', 'adminimize' ); ?> »" /> | |
| 298 | + <input type="hidden" name="page_options" value="'dofollow_timeout'" /> | |
| 299 | + </p> | |
| 300 | + | |
| 301 | + <p><a class="alignright button" href="javascript:void(0);" | |
| 302 | + onclick="window.scrollTo(0,0);" style="margin:3px 0 0 30px;"> | |
| 303 | + <?php esc_attr_e( 'scroll to top', 'adminimize' ); ?></a> | |
| 304 | + <br class="clear" /> | |
| 305 | + </p> | |
| 306 | + | |
| 307 | + </div> | |
| 308 | + </div> | |
| 309 | + </div> | |
| 310 | + | |
| 253 | 311 | <?php } // end foreach ?> |