PluginProbe
Adminimize / 1.11.7
Adminimize v1.11.7
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
adminimize / inc-options / widget_options.php

widget_options.php in Adminimize 1.11.7, at inc-options/widget_options.php

205 lines 6.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * @package Adminimize
4 * @subpackage Widget Options, settings page
5 * @author Frank Bültge
6 * @since 1.8.1 01/10/2013
7 */
8 if ( ! function_exists( 'add_action' ) ) {
9 echo "Hi there! I'm just a part of plugin, not much I can do when called directly.";
10 exit;
11 }
12
13 if ( ! isset( $user_roles ) ) {
14 $user_roles = _mw_adminimize_get_all_user_roles();
15 }
16
17 if ( ! isset( $user_roles_names ) ) {
18 $user_roles_names = _mw_adminimize_get_all_user_roles_names();
19 }
20 ?>
21
22 <div id="poststuff" class="ui-sortable meta-box-sortables">
23 <div class="postbox">
24 <h3 class="hndle ui-sortable-handle" title="<?php esc_attr_e( 'Click to toggle', 'adminimize' ); ?>" id="widget_options"><?php esc_attr_e( 'Widgets', 'adminimize' ); ?></h3>
25
26 <div class="inside">
27 <br class="clear" />
28
29 <table summary="config_widget" class="widefat">
30 <colgroup>
31 <?php
32 $col = 0;
33 foreach ( $user_roles_names as $role_name ) {
34 echo '<col class="col' . $col . '">' . "\n";
35 $col ++;
36 }
37 ?>
38 </colgroup>
39 <thead>
40 <tr>
41 <th><?php esc_attr_e( 'Option', 'adminimize' ); ?></th>
42 <?php
43 foreach ( $user_roles_names as $role_name ) { ?>
44 <th><?php esc_attr_e( 'Deactivate for', 'adminimize' );
45 echo '<br/>' . $role_name; ?></th>
46 <?php } ?>
47 </tr>
48 <tr>
49 <td><?php esc_attr_e( 'Select all', 'adminimize' ); ?></td>
50 <?php
51 foreach ( $user_roles as $role_slug ) {
52 echo '<td class="num">';
53 echo '<input id="select_all" class="widget_options_' . $role_slug
54 . '" type="checkbox" name="" value="" />';
55 echo '</td>' . "\n";
56 } ?>
57 </tr>
58 </thead>
59
60 <tbody>
61 <?php
62 foreach ( $user_roles as $role ) {
63 $disabled_widget_option_[ $role ] = _mw_adminimize_get_option_value(
64 'mw_adminimize_disabled_widget_option_' . $role . '_items'
65 );
66 }
67
68 $widget_options = array(
69 '#contextual-help-link-wrap',
70 '#screen-options-link-wrap',
71 '#available-widgets',
72 '.inactive-sidebar.orphan-sidebar',
73 '.inactive-sidebar',
74 );
75
76 $widget_options_names = array(
77 esc_attr__( 'Help', 'adminimize' ),
78 esc_attr__( 'Screen Options' ),
79 esc_attr__( 'Available Widgets' ),
80 esc_attr__( 'Inactive Sidebar (not used)' ),
81 esc_attr__( 'Inactive Widgets' ),
82 );
83
84 $registered_sidebars = _mw_adminimize_get_registered_sidebars();
85 foreach ( $registered_sidebars as $key => $value ) {
86
87 $widget_options[] = $key;
88 $widget_options_names[] = $value[ 'name' ];
89 }
90
91 // get registered widgets
92 $registered_widgets = _mw_adminimize_get_all_widgets();
93 foreach ( (array) $registered_widgets as $key => $value ) {
94 $widget_options[] = $key;
95 $widget_options_names[] = $value->name;
96 }
97
98 $_mw_adminimize_own_widget_values = _mw_adminimize_get_option_value(
99 '_mw_adminimize_own_widget_values'
100 );
101 $_mw_adminimize_own_widget_values = preg_split( "/\r\n/", $_mw_adminimize_own_widget_values );
102 foreach ( (array) $_mw_adminimize_own_widget_values as $key => $_mw_adminimize_own_widget_value ) {
103 $_mw_adminimize_own_widget_value = trim( $_mw_adminimize_own_widget_value );
104 $widget_options[] = $_mw_adminimize_own_widget_value;
105 }
106
107 $_mw_adminimize_own_widget_options = _mw_adminimize_get_option_value(
108 '_mw_adminimize_own_widget_options'
109 );
110 $_mw_adminimize_own_widget_options = preg_split( "/\r\n/", $_mw_adminimize_own_widget_options );
111 foreach ( (array) $_mw_adminimize_own_widget_options as $key => $_mw_adminimize_own_widget_option ) {
112 $_mw_adminimize_own_widget_option = trim( $_mw_adminimize_own_widget_option );
113 $widget_options_names[] = $_mw_adminimize_own_widget_option;
114 }
115
116 $x = 0;
117 foreach ( $widget_options as $index => $widget_option ) {
118 if ( $widget_option != '' ) {
119 $checked_user_role_ = array();
120 foreach ( $user_roles as $role ) {
121 $checked_user_role_[ $role ] = ( isset( $disabled_widget_option_[ $role ] )
122 && in_array(
123 $widget_option, $disabled_widget_option_[ $role ]
124 ) ) ? ' checked="checked"' : '';
125 }
126 echo '<tr>' . "\n";
127 echo '<td>' . $widget_options_names[ $index ] . ' <span>(' . $widget_option . ')</span> </td>' . "\n";
128 foreach ( $user_roles as $role ) {
129 echo '<td class="num">';
130 echo '<input id="check_post' . $role . $x . '" class="widget_options_'
131 . preg_replace( '/[^a-z0-9_-]+/', '', $role ) . '" type="checkbox"'
132 . $checked_user_role_[ $role ] . ' name="mw_adminimize_disabled_widget_option_'
133 . $role . '_items[]" value="' . $widget_option . '" />';
134 echo '</td>' . "\n";
135 }
136 echo '</tr>' . "\n";
137 $x ++;
138 }
139 }
140 ?>
141 </tbody>
142 </table>
143
144 <?php
145 //your own global options
146 ?>
147 <br style="margin-top: 10px;" />
148 <table summary="config_edit_post" class="widefat">
149 <thead>
150 <tr>
151 <th><?php esc_attr_e( 'Your own Widget options', 'adminimize' );
152 echo '<br />';
153 esc_attr_e( 'Option name', 'adminimize' ); ?></th>
154 <th><?php echo '<br />';
155 esc_attr_e( 'Selector, ID or class', 'adminimize' ); ?></th>
156 </tr>
157 </thead>
158
159 <tbody>
160 <tr valign="top">
161 <td colspan="2"><?php esc_attr_e(
162 '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.',
163 'adminimize'
164 ); ?></td>
165 </tr>
166 <tr valign="top">
167 <td>
168 <textarea name="_mw_adminimize_own_widget_options" cols="60" rows="3" id="_mw_adminimize_own_widget_options" style="width: 95%;"><?php echo _mw_adminimize_get_option_value(
169 '_mw_adminimize_own_widget_options'
170 ); ?></textarea>
171 <br />
172 <?php esc_attr_e(
173 'Possible nomination for ID or class. Separate multiple nominations through a carriage return.',
174 'adminimize'
175 ); ?>
176 </td>
177 <td>
178 <textarea class="code" name="_mw_adminimize_own_widget_values" cols="60" rows="3" id="_mw_adminimize_own_widget_values" style="width: 95%;"><?php echo _mw_adminimize_get_option_value(
179 '_mw_adminimize_own_widget_values'
180 ); ?></textarea>
181 <br />
182 <?php esc_attr_e(
183 'Possible IDs or classes. Separate multiple values through a carriage return.', 'adminimize'
184 ); ?>
185 </td>
186 </tr>
187 </tbody>
188 </table>
189
190 <p id="submitbutton">
191 <input type="hidden" name="_mw_adminimize_action" value="_mw_adminimize_insert" />
192 <input class="button button-primary" type="submit" name="_mw_adminimize_save" value="<?php esc_attr_e(
193 'Update Options', 'adminimize'
194 ); ?> &raquo;" /><input type="hidden" name="page_options" value="'dofollow_timeout'" />
195 </p>
196
197 <p>
198 <a class="alignright button adminimize-scroltop" href="#" style="margin:3px 0 0 30px;"><?php esc_attr_e(
199 'scroll to top', 'adminimize'
200 ); ?></a><br class="clear" /></p>
201
202 </div>
203 </div>
204 </div>
205