PluginProbe
Adminimize / 1.9.1
Adminimize v1.9.1
1.11.14 1.11.13 1.11.1 1.11.10 1.11.11 1.11.12 1.11.2 1.11.3 1.11.4 1.11.5 1.11.6 1.11.7 1.11.8 1.11.9 1.3 1.4.7 1.6 1.7.12 1.7.13 1.7.14 1.7.15 1.7.16 1.7.17 1.7.18 1.7.19 All 53 releases
← All changes | inc-options/global_options.php +48 -110 1.11.6 → 1.9.1 View file →
@@ -1,13 +1,10 @@
1 1 <?php
2 2 /**
3 - * Global options area on the settings page.
4 - *
5 3 * @package Adminimize
6 4 * @subpackage Global Options
7 5 * @author Frank Bültge
8 6 */
9 -
10 7 if ( ! function_exists( 'add_action' ) ) {
11 8 echo "Hi there! I'm just a part of plugin, not much I can do when called directly.";
12 9 exit;
13 10 }
@@ -14,61 +11,40 @@
14 11 ?>
15 12
16 13 <div id="poststuff" class="ui-sortable meta-box-sortables">
17 14 <div class="postbox">
18 - <div class="handlediv" title="<?php esc_attr_e( 'Click to toggle', 'adminimize' ); ?>"><br/></div>
15 + <div class="handlediv" title="<?php esc_attr_e( 'Click to toggle' ); ?>"><br /></div>
19 16 <h3 class="hndle" id="global_options"><?php esc_attr_e( 'Global options', 'adminimize' ); ?></h3>
20 17
21 18 <div class="inside">
22 - <br class="clear"/>
19 + <br class="clear" />
23 20
24 21 <table summary="config_edit_post" class="widefat">
25 - <colgroup>
26 - <?php
27 - $col = 0;
28 - if ( ! isset( $user_roles_names ) ) {
29 - $user_roles_names = _mw_adminimize_get_all_user_roles_names();
30 - }
31 - foreach ( $user_roles_names as $role_name ) {
32 - // phpcs:disable
33 - echo '<col class="col' . $col . '">' . "\n";
34 - $col ++;
35 - }
36 - ?>
37 - </colgroup>
38 22 <thead>
39 23 <tr>
40 24 <th><?php esc_attr_e( 'Option', 'adminimize' ); ?></th>
41 25 <?php
42 - foreach ( $user_roles_names as $role_name ) {
43 - ?>
44 - <th>
45 - <?php
46 - esc_attr_e( 'Deactivate for', 'adminimize' );
47 - echo '<br/>' . esc_html( $role_name );
48 - ?>
49 - </th>
26 + foreach ( $user_roles_names as $role_name ) { ?>
27 + <th><?php esc_attr_e( 'Deactivate for', 'adminimize' );
28 + echo '<br/>' . $role_name; ?></th>
50 29 <?php } ?>
51 30 </tr>
52 31 <tr>
53 32 <td><?php esc_attr_e( 'Select all', 'adminimize' ); ?></td>
54 33 <?php
55 - if ( ! isset( $user_roles ) ) {
56 - $user_roles = _mw_adminimize_get_all_user_roles();
57 - }
58 - foreach ( $user_roles as $role_slug ) {
34 + foreach ( $user_roles_names as $role_name ) {
35 + $role_name = strtolower( $role_name );
36 + $role_name = preg_replace( '/[^a-z0-9]+/', '', $role_name );
59 37 echo '<td class="num">';
60 - echo '<input id="select_all" class="global_options_' . esc_attr( $role_slug )
61 - . '" type="checkbox" name="" value="" />';
38 + echo '<input id="select_all" class="global_options_' . $role_name
39 + . '" type="checkbox" name="" value="" />';
62 40 echo '</td>' . "\n";
63 - }
64 - ?>
41 + } ?>
65 42 </tr>
66 43 </thead>
67 44
68 45 <tbody>
69 46 <?php
70 - $disabled_global_option_ = array();
71 47 foreach ( $user_roles as $role ) {
72 48 $disabled_global_option_[ $role ] = _mw_adminimize_get_option_value(
73 49 'mw_adminimize_disabled_global_option_' . $role . '_items'
74 50 );
@@ -97,9 +73,9 @@
97 73 $_mw_adminimize_own_values = _mw_adminimize_get_option_value( '_mw_adminimize_own_values' );
98 74 $_mw_adminimize_own_values = preg_split( "/\r\n/", $_mw_adminimize_own_values );
99 75 foreach ( (array) $_mw_adminimize_own_values as $key => $_mw_adminimize_own_value ) {
100 76 $_mw_adminimize_own_value = trim( $_mw_adminimize_own_value );
101 - $global_options[] = $_mw_adminimize_own_value;
77 + $global_options[] = $_mw_adminimize_own_value;
102 78 }
103 79
104 80 $_mw_adminimize_own_options = _mw_adminimize_get_option_value( '_mw_adminimize_own_options' );
105 81 $_mw_adminimize_own_options = preg_split( "/\r\n/", $_mw_adminimize_own_options );
@@ -104,9 +80,9 @@
104 80 $_mw_adminimize_own_options = _mw_adminimize_get_option_value( '_mw_adminimize_own_options' );
105 81 $_mw_adminimize_own_options = preg_split( "/\r\n/", $_mw_adminimize_own_options );
106 82 foreach ( (array) $_mw_adminimize_own_options as $key => $_mw_adminimize_own_option ) {
107 83 $_mw_adminimize_own_option = trim( $_mw_adminimize_own_option );
108 - $global_options_names[] = $_mw_adminimize_own_option;
84 + $global_options_names[] = $_mw_adminimize_own_option;
109 85 }
110 86
111 87 $x = 0;
112 88 foreach ( $global_options as $index => $global_option ) {
@@ -114,21 +90,21 @@
114 90 if ( empty( $global_option ) ) {
115 91 continue;
116 92 }
117 93
118 - $global_option = esc_attr( $global_option );
119 -
120 94 $checked_user_role_ = array();
121 - foreach ( (array) $user_roles as $role ) {
122 - $checked_user_role_[ $role ] = _mw_adminimize_is_checked( $global_option, $disabled_global_option_[ $role ] );
95 + foreach ( $user_roles as $role ) {
96 + $checked_user_role_[ $role ] = ( isset( $disabled_global_option_[ $role ] )
97 + && in_array( $global_option, $disabled_global_option_[ $role ] ) ) ? ' checked="checked"'
98 + : '';
123 99 }
124 100 echo '<tr>' . "\n";
125 101 echo '<td>' . $global_options_names[ $index ] . ' <span>(' . $global_option . ')</span> </td>' . "\n";
126 - foreach ( (array) $user_roles as $role ) {
102 + foreach ( $user_roles as $role ) {
127 103 echo '<td class="num"><input id="check_post' . $role . $x . '" class="global_options_'
128 - . preg_replace( '/[^a-z0-9_-]+/', '', $role ) . '" type="checkbox" '
129 - . $checked_user_role_[ $role ] . ' name="mw_adminimize_disabled_global_option_'
130 - . $role . '_items[]" value="' . $global_option . '" /></td>' . "\n";
104 + . preg_replace( '/[^a-z0-9]+/', '', $role ) . '" type="checkbox"'
105 + . $checked_user_role_[ $role ] . ' name="mw_adminimize_disabled_global_option_'
106 + . $role . '_items[]" value="' . $global_option . '" /></td>' . "\n";
131 107 }
132 108 echo '</tr>' . "\n";
133 109 $x ++;
134 110
@@ -137,80 +113,50 @@
137 113 </tbody>
138 114 </table>
139 115
140 116 <?php
141 - // your own global options.
117 + //your own global options
142 118 ?>
143 - <br style="margin-top: 10px;"/>
119 + <br style="margin-top: 10px;" />
144 120 <table summary="config_edit_post" class="widefat">
145 121 <thead>
146 122 <tr>
147 - <th>
148 - <?php
149 - esc_attr_e( 'Your own options', 'adminimize' );
123 + <th><?php esc_attr_e( 'Your own options', 'adminimize' );
150 124 echo '<br />';
151 - esc_attr_e( 'Option name', 'adminimize' );
152 - ?>
153 - </th>
154 - <th>
155 - <?php
156 - echo '<br />';
157 - esc_attr_e( 'Selector, ID or class', 'adminimize' );
158 - ?>
159 - </th>
125 + esc_attr_e( 'ID or class', 'adminimize' ); ?></th>
126 + <th><?php echo '<br />';
127 + esc_attr_e( 'Option', 'adminimize' ); ?></th>
160 128 </tr>
161 129 </thead>
162 130
163 131 <tbody>
164 132 <tr valign="top">
165 - <td colspan="2">
166 - <?php
167 - esc_attr_e(
133 + <td colspan="2"><?php esc_attr_e(
168 134 '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.',
169 135 'adminimize'
170 - );
171 - ?>
172 - </td>
136 + ); ?></td>
173 137 </tr>
174 138 <tr valign="top">
175 139 <td>
176 - <label for="_mw_adminimize_own_options"></label>
177 140 <textarea name="_mw_adminimize_own_options" cols="60" rows="3"
178 - id="_mw_adminimize_own_options" style="width: 95%;">
179 - <?php
180 - // The function sanitize the output.
181 - // phpcs:disable
182 - echo _mw_adminimize_get_option_value(
183 - '_mw_adminimize_own_options'
184 - );
185 - ?>
186 - </textarea>
187 - <br/>
188 - <?php
189 - esc_attr_e(
141 + id="_mw_adminimize_own_options" style="width: 95%;"><?php echo _mw_adminimize_get_option_value(
142 + '_mw_adminimize_own_options'
143 + ); ?></textarea>
144 + <br />
145 + <?php esc_attr_e(
190 146 'Possible nomination for ID or class. Separate multiple nominations through a carriage return.',
191 147 'adminimize'
192 - );
193 - ?>
148 + ); ?>
194 149 </td>
195 150 <td>
196 - <label for="_mw_adminimize_own_values"></label>
197 151 <textarea class="code" name="_mw_adminimize_own_values" cols="60" rows="3"
198 - id="_mw_adminimize_own_values" style="width: 95%;">
199 - <?php
200 - // The function sanitize the output.
201 - // phpcs:disable
202 - echo _mw_adminimize_get_option_value(
203 - '_mw_adminimize_own_values'
204 - );
205 - ?>
206 - </textarea>
207 - <br/>
208 - <?php
209 - esc_attr_e(
152 + id="_mw_adminimize_own_values" style="width: 95%;"><?php echo _mw_adminimize_get_option_value(
153 + '_mw_adminimize_own_values'
154 + ); ?></textarea>
155 + <br />
156 + <?php esc_attr_e(
210 157 'Possible IDs or classes. Separate multiple values through a carriage return.', 'adminimize'
211 - );
212 - ?>
158 + ); ?>
213 159 </td>
214 160 </tr>
215 161 </tbody>
216 162 </table>
@@ -215,28 +161,20 @@
215 161 </tbody>
216 162 </table>
217 163
218 164 <p id="submitbutton">
219 - <input type="hidden" name="_mw_adminimize_action" value="_mw_adminimize_insert"/>
220 - <input class="button button-primary" type="submit" name="_mw_adminimize_save" value="
221 - <?php
222 - esc_attr_e(
165 + <input type="hidden" name="_mw_adminimize_action" value="_mw_adminimize_insert" />
166 + <input class="button button-primary" type="submit" name="_mw_adminimize_save" value="<?php esc_attr_e(
223 167 'Update Options', 'adminimize'
224 - );
225 - ?>
226 - &raquo;"/><input type="hidden" name="page_options" value="'dofollow_timeout'"/>
168 + ); ?> &raquo;" /><input type="hidden" name="page_options" value="'dofollow_timeout'" />
227 169 </p>
228 170
229 171 <p>
230 - <a class="alignright button adminimize-scroltop" href="#"
231 - style="margin:3px 0 0 30px;">
232 - <?php
233 - esc_attr_e(
172 + <a class="alignright button" href="javascript:void(0);" onclick="window.scrollTo(0,0);"
173 + style="margin:3px 0 0 30px;"><?php esc_attr_e(
234 174 'scroll to top', 'adminimize'
235 - );
236 - ?>
237 - </a>
238 - <br class="clear"/>
175 + ); ?></a>
176 + <br class="clear" />
239 177 </p>
240 178
241 179 </div>
242 180 </div>