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