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