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
adminimize / inc-options / dashboard_options.php

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

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