PluginProbe
Adminimize / 1.11.2
Adminimize v1.11.2
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 / dashboard_options.php

dashboard_options.php in Adminimize 1.11.2, at inc-options/dashboard_options.php

215 lines 7.3 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 Dashboard 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 ?>
13
14 <div id="poststuff" class="ui-sortable meta-box-sortables">
15 <div class="postbox">
16 <div class="handlediv" title="<?php esc_attr_e( 'Click to toggle', 'adminimize' ); ?>"><br /></div>
17 <h3 class="hndle" id="dashboard_options"><?php esc_attr_e( 'Dashboard options', 'adminimize' ); ?></h3>
18
19 <div class="inside">
20 <br class="clear" />
21 <?php
22 $disabled_dashboard_option_ = array();
23 // get widgets
24 $widgets = _mw_adminimize_get_option_value( 'mw_adminimize_dashboard_widgets' );
25 if ( NULL === $widgets ) {
26 echo '<p>';
27 esc_attr_e(
28 'To complete the installation for Dashboard Widgets you must visit your dashboard once and then come back to Settings > Adminimize to configure who has access to each widget.',
29 'adminimize'
30 );
31 echo '</p>';
32 } else {
33 ?>
34
35 <table summary="config_edit_dashboard" class="widefat">
36 <colgroup>
37 <?php
38 $col = 0;
39 foreach ( $user_roles_names as $role_name ) {
40 echo '<col class="col' . $col . '">' . "\n";
41 $col ++;
42 }
43 ?>
44 </colgroup>
45 <thead>
46 <tr>
47 <th><?php esc_attr_e( 'Option', 'adminimize' ); ?></th>
48 <?php
49 foreach ( $user_roles_names as $role_name ) { ?>
50 <th><?php esc_attr_e( 'Deactivate for', 'adminimize' );
51 echo '<br/>' . $role_name; ?></th>
52 <?php } ?>
53 </tr>
54 <tr>
55 <td><?php esc_attr_e( 'Select all', 'adminimize' ); ?></td>
56 <?php
57 foreach ( $user_roles as $role_slug ) {
58 echo '<td class="num">';
59 echo '<input id="select_all" class="dashboard_options_' . $role_slug
60 . '" type="checkbox" name="" value="" />';
61 echo '</td>' . "\n";
62 } ?>
63 </tr>
64 </thead>
65
66 <tbody>
67 <?php
68 foreach ( $user_roles as $role ) {
69 $disabled_dashboard_option_[ $role ] = _mw_adminimize_get_option_value(
70 'mw_adminimize_disabled_dashboard_option_' . $role . '_items'
71 );
72 }
73
74 $dashboard_options = array();
75 $dashboard_options_names = array();
76 foreach ( $widgets as $widget ) {
77 // Object to array
78 if ( is_object( $widget ) ) {
79 $widget = get_object_vars( $widget );
80 }
81 $dashboard_options[] = $widget[ 'id' ];
82 $dashboard_options_names[] = $widget[ 'title' ];
83 }
84
85 $_mw_adminimize_own_dashboard_values = _mw_adminimize_get_option_value(
86 '_mw_adminimize_own_dashboard_values'
87 );
88 $_mw_adminimize_own_dashboard_values = preg_split( "/\r\n/", $_mw_adminimize_own_dashboard_values );
89 foreach ( (array) $_mw_adminimize_own_dashboard_values as $key => $_mw_adminimize_own_dashboard_value ) {
90 $_mw_adminimize_own_dashboard_value = trim( $_mw_adminimize_own_dashboard_value );
91 $dashboard_options[] = $_mw_adminimize_own_dashboard_value;
92 }
93
94 $_mw_adminimize_own_dashboard_options = _mw_adminimize_get_option_value(
95 '_mw_adminimize_own_dashboard_options'
96 );
97 $_mw_adminimize_own_dashboard_options = preg_split(
98 "/\r\n/", $_mw_adminimize_own_dashboard_options
99 );
100 foreach ( (array) $_mw_adminimize_own_dashboard_options as $key => $_mw_adminimize_own_dashboard_option ) {
101 $_mw_adminimize_own_dashboard_option = trim( $_mw_adminimize_own_dashboard_option );
102 $dashboard_options_names[] = $_mw_adminimize_own_dashboard_option;
103 }
104
105 $x = 0;
106 foreach ( $dashboard_options as $index => $dashboard_option ) {
107
108 if ( '' !== $dashboard_option ) {
109 $checked_user_role_ = array();
110 foreach ( $user_roles as $role ) {
111
112 $checked_user_role_[ $role ] = ( in_array(
113 $dashboard_option, (array) $disabled_dashboard_option_[ $role ], FALSE
114 ) ) ? ' checked="checked"' : '';
115
116 }
117 echo '<tr>' . "\n";
118
119 // No title on the Dashboard item.
120 if ( ! $dashboard_options_names[ $index ] ) {
121 $dashboard_options_names[ $index ] = '<b><i>' . esc_attr__(
122 'No Title!', 'adminimize'
123 ) . '</i></b>';
124 }
125 echo '<td>' . $dashboard_options_names[ $index ] . ' <span>(' . $dashboard_option . ')</span> </td>' . "\n";
126 foreach ( $user_roles as $role ) {
127 echo '<td class="num">';
128 echo '<input id="check_post' . $role . $x . '" class="dashboard_options_'
129 . preg_replace( '/[^a-z0-9_-]+/', '', $role ) . '" type="checkbox"'
130 . $checked_user_role_[ $role ] . ' name="mw_adminimize_disabled_dashboard_option_'
131 . $role . '_items[]" value="' . $dashboard_option . '" />';
132 echo '</td>';
133 }
134 echo '</tr>' . "\n";
135 $x ++;
136 }
137
138 }
139 ?>
140 </tbody>
141 </table>
142
143 <?php
144 //Your own dashboard options.
145 ?>
146 <br style="margin-top: 10px;" />
147 <table summary="config_edit_post" class="widefat">
148 <thead>
149 <tr>
150 <th><?php esc_attr_e( 'Your own options', 'adminimize' );
151 echo '<br />';
152 esc_attr_e( 'Option name', 'adminimize' ); ?></th>
153 <th><?php echo '<br />';
154 esc_attr_e( 'Selector, ID or class', 'adminimize' ); ?></th>
155 </tr>
156 </thead>
157
158 <tbody>
159 <tr valign="top">
160 <td colspan="2"><?php esc_attr_e(
161 '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.',
162 'adminimize'
163 ); ?></td>
164 </tr>
165 <tr valign="top">
166 <td>
167 <textarea name="_mw_adminimize_own_dashboard_options" cols="60" rows="3"
168 id="_mw_adminimize_own_dashboard_options" style="width: 95%;"><?php
169 echo _mw_adminimize_get_option_value(
170 '_mw_adminimize_own_dashboard_options'
171 ); ?></textarea>
172 <br />
173 <label for="_mw_adminimize_own_dashboard_options">
174 <?php esc_attr_e(
175 'Possible nomination for ID or class. Separate multiple nominations through a carriage return.',
176 'adminimize'
177 ); ?>
178 </label>
179 </td>
180 <td>
181 <textarea class="code" name="_mw_adminimize_own_dashboard_values" cols="60" rows="3"
182 id="_mw_adminimize_own_dashboard_values" style="width: 95%;"><?php
183 echo _mw_adminimize_get_option_value(
184 '_mw_adminimize_own_dashboard_values'
185 ); ?></textarea>
186 <br />
187 <label for="_mw_adminimize_own_dashboard_values">
188 <?php esc_attr_e(
189 'Possible IDs or classes. Separate multiple values through a carriage return.',
190 'adminimize'
191 ); ?>
192 </label>
193 </td>
194 </tr>
195 </tbody>
196 </table>
197
198 <p id="submitbutton">
199 <input type="hidden" name="_mw_adminimize_action" value="_mw_adminimize_insert" />
200 <input class="button button-primary" type="submit" name="_mw_adminimize_save" value="<?php esc_attr_e(
201 'Update Options', 'adminimize'
202 ); ?> &raquo;" /><input type="hidden" name="page_options" value="'dofollow_timeout'" />
203 </p>
204
205 <?php } // end if else $widgets ?>
206
207 <p>
208 <a class="alignright button" href="javascript:void(0);" onclick="window.scrollTo(0,0);" style="margin:3px 0 0 30px;"><?php esc_attr_e(
209 'scroll to top', 'adminimize'
210 ); ?></a><br class="clear" /></p>
211
212 </div>
213 </div>
214 </div>
215