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