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