| 1 |
<?php /** |
| 2 |
* @version 1.0 |
| 3 |
* @package Booking Manager |
| 4 |
* @category Admin Panel - Dashboard functions |
| 5 |
* @author wpdevelop |
| 6 |
* |
| 7 |
* @web-site https://oplugins.com/ |
| 8 |
* @email info@oplugins.com |
| 9 |
* |
| 10 |
* @modified 2016-03-16 |
| 11 |
*/ |
| 12 |
|
| 13 |
if ( ! defined( 'ABSPATH' ) ) exit; // Exit, if accessed directly |
| 14 |
|
| 15 |
|
| 16 |
//////////////////////////////////////////////////////////////////////////////// |
| 17 |
// D a s h b o a r d W i d g e t |
| 18 |
//////////////////////////////////////////////////////////////////////////////// |
| 19 |
|
| 20 |
/** Setup Widget for Dashboard */ |
| 21 |
function wpbm_dashboard_widget_setup(){ |
| 22 |
|
| 23 |
// Check, if we have permission to show Widget /////////////////////////// |
| 24 |
$is_user_activated = apply_wpbm_filter('multiuser_is_current_user_active', true ); //FixIn: 6.0.1.17 |
| 25 |
if ( ! $is_user_activated ) |
| 26 |
return false; |
| 27 |
|
| 28 |
$user_role = get_wpbm_option( 'wpbm_user_role_master' ); |
| 29 |
if ( ! wpbm_is_current_user_have_this_role( $user_role ) ) |
| 30 |
return false; |
| 31 |
|
| 32 |
|
| 33 |
// Add Booking Manager Widget to Dashboard /////////////////////////////// |
| 34 |
$bk_dashboard_widget_id = 'wpbm_dashboard_widget'; |
| 35 |
wp_add_dashboard_widget( $bk_dashboard_widget_id, sprintf( __( 'Item Calendar', 'booking-manager') ), 'wpbm_dashboard_widget_show', null ); |
| 36 |
|
| 37 |
|
| 38 |
// Sort Dashboard. Add Booking Manager widget to top /////////////////////// |
| 39 |
global $wp_meta_boxes; |
| 40 |
$normal_dashboard = $wp_meta_boxes['dashboard']['normal']['core']; |
| 41 |
if ( isset( $normal_dashboard[$bk_dashboard_widget_id] ) ) { |
| 42 |
// Backup and delete our new dashbaord widget from the end of the array |
| 43 |
$example_widget_backup = array( $bk_dashboard_widget_id => $normal_dashboard[$bk_dashboard_widget_id] ); |
| 44 |
unset( $normal_dashboard[$bk_dashboard_widget_id] ); |
| 45 |
} else |
| 46 |
$example_widget_backup = array(); |
| 47 |
|
| 48 |
// Sometimes, some other plugins can modify this item, so its can be not a array |
| 49 |
if ( is_array( $normal_dashboard ) ) { |
| 50 |
// Merge the two arrays together so our widget is at the beginning |
| 51 |
if ( is_array( $normal_dashboard ) ) |
| 52 |
$sorted_dashboard = array_merge( $example_widget_backup, $normal_dashboard ); |
| 53 |
else |
| 54 |
$sorted_dashboard = $example_widget_backup; |
| 55 |
// Save the sorted array back into the original metaboxes |
| 56 |
$wp_meta_boxes['dashboard']['normal']['core'] = $sorted_dashboard; |
| 57 |
} |
| 58 |
} |
| 59 |
//add_action( 'wp_dashboard_setup', 'wpbm_dashboard_widget_setup' ); |
| 60 |
|
| 61 |
|
| 62 |
|
| 63 |
/** Show item Dashboard Widget content */ |
| 64 |
function wpbm_dashboard_widget_show() { |
| 65 |
|
| 66 |
wpbm_dashboard_widget_css(); |
| 67 |
|
| 68 |
?> |
| 69 |
<div id="wpbm_dashboard_widget_container" > |
| 70 |
<?php |
| 71 |
|
| 72 |
wpbm_dashboard_section_version(); |
| 73 |
|
| 74 |
wpbm_dashboard_section_support(); |
| 75 |
|
| 76 |
?> |
| 77 |
</div> |
| 78 |
<div style="clear:both;"></div> |
| 79 |
<?php |
| 80 |
} |
| 81 |
|
| 82 |
|
| 83 |
/** Get Info for Dashboard */ |
| 84 |
function wpbm_get_dashboard_info() { |
| 85 |
|
| 86 |
ob_start(); |
| 87 |
|
| 88 |
wpbm_dashboard_widget_show(); |
| 89 |
|
| 90 |
return ob_get_clean(); |
| 91 |
} |
| 92 |
|
| 93 |
|
| 94 |
/** CSS for Dashboard Widget */ |
| 95 |
function wpbm_dashboard_widget_css() { |
| 96 |
|
| 97 |
?><style type="text/css"> |
| 98 |
#wpbm_dashboard_widget_container { |
| 99 |
width:100%; |
| 100 |
} |
| 101 |
#wpbm_dashboard_widget_container .wpbm_dashboard_section { |
| 102 |
float:left; |
| 103 |
margin:0px; |
| 104 |
padding:0px; |
| 105 |
width:100%; |
| 106 |
} |
| 107 |
#wpbm_dashboard_widget_container .wpbm_dashboard_section h4 { |
| 108 |
font-size: 14px; |
| 109 |
font-weight: 600; |
| 110 |
margin: 5px 0 15px; |
| 111 |
} |
| 112 |
#bk_upgrade_section p { |
| 113 |
font-size: 13px; |
| 114 |
line-height: 1.5em; |
| 115 |
margin: 15px 0 0; |
| 116 |
padding: 0; |
| 117 |
} |
| 118 |
#dashboard-widgets-wrap #wpbm_dashboard_widget_container .wpbm_dashboard_section { |
| 119 |
width:49%; |
| 120 |
} |
| 121 |
#dashboard-widgets-wrap #wpbm_dashboard_widget_container .bk_right { |
| 122 |
float:right |
| 123 |
} |
| 124 |
#dashboard-widgets-wrap #wpbm_dashboard_widget_container .border_orrange, |
| 125 |
#wpbm_dashboard_widget_container .border_orrange { |
| 126 |
background: #fffaf1 none repeat scroll 0 0; |
| 127 |
border-left: 3px solid #eeab26; |
| 128 |
clear: both; |
| 129 |
margin: 5px 5px 20px; |
| 130 |
padding: 10px 0; |
| 131 |
width: 99%; |
| 132 |
} |
| 133 |
#wpbm_dashboard_widget_container .bk_header { |
| 134 |
color: #555555; |
| 135 |
font-size: 13px; |
| 136 |
font-weight: 600; |
| 137 |
line-height: 1em; |
| 138 |
} |
| 139 |
#wpbm_dashboard_widget_container .bk_table { |
| 140 |
background:transparent; |
| 141 |
border-bottom:none; |
| 142 |
border-top:1px solid #ECECEC; |
| 143 |
margin:6px 0 10px 6px; |
| 144 |
padding:2px 10px; |
| 145 |
width:95%; |
| 146 |
-border-radius:4px; |
| 147 |
-moz-border-radius:4px; |
| 148 |
-webkit-border-radius:4px; |
| 149 |
-moz-box-shadow:0 0 2px #C5C3C3; |
| 150 |
-webkit-box-shadow:0 0 2px #C5C3C3; |
| 151 |
-box-shadow:0 0 2px #C5C3C3; |
| 152 |
} |
| 153 |
#wpbm_dashboard_widget_container .bk_table td{ |
| 154 |
border-bottom:1px solid #DDDDDD; |
| 155 |
line-height:19px; |
| 156 |
padding:4px 0px 4px 10px; |
| 157 |
font-size:13px; |
| 158 |
} |
| 159 |
#wpbm_dashboard_widget_container .bk_table tr td.first{ |
| 160 |
text-align:center; |
| 161 |
padding:4px 0px; |
| 162 |
} |
| 163 |
#wpbm_dashboard_widget_container .bk_table tr td a { |
| 164 |
text-decoration: none; |
| 165 |
} |
| 166 |
#wpbm_dashboard_widget_container .bk_table tr td a span{ |
| 167 |
font-size:18px; |
| 168 |
font-family: Georgia,"Times New Roman","Bitstream Charter",Times,serif; |
| 169 |
} |
| 170 |
#wpbm_dashboard_widget_container .bk_table td.bk_spec_font a{ |
| 171 |
font-family: Georgia,"Times New Roman","Bitstream Charter",Times,serif; |
| 172 |
font-size:14px; |
| 173 |
} |
| 174 |
#wpbm_dashboard_widget_container .bk_table td.bk_spec_font { |
| 175 |
font-family: Georgia,"Times New Roman","Bitstream Charter",Times,serif; |
| 176 |
font-size:13px; |
| 177 |
} |
| 178 |
#wpbm_dashboard_widget_container .bk_table td.pending a{ |
| 179 |
color:#E66F00; |
| 180 |
} |
| 181 |
#wpbm_dashboard_widget_container .bk_table td.new-items a{ |
| 182 |
color:red; |
| 183 |
} |
| 184 |
#wpbm_dashboard_widget_container .bk_table td.actual-items a{ |
| 185 |
color:green; |
| 186 |
} |
| 187 |
#bk_errror_loading { |
| 188 |
text-align: center; |
| 189 |
font-style: italic; |
| 190 |
font-size:11px; |
| 191 |
} |
| 192 |
</style><?php |
| 193 |
} |
| 194 |
|
| 195 |
|
| 196 |
//////////////////////////////////////////////////////////////////////////////// |
| 197 |
// S e c t i o n s |
| 198 |
//////////////////////////////////////////////////////////////////////////////// |
| 199 |
|
| 200 |
/** Dashboard Support Section */ |
| 201 |
function wpbm_dashboard_section_support() { |
| 202 |
?> |
| 203 |
<div class="wpbm_dashboard_section bk_right"> |
| 204 |
<span class="bk_header"><?php _e('Support' , 'booking-manager');?>:</span> |
| 205 |
<table class="bk_table"> |
| 206 |
<tr> |
| 207 |
<td style="text-align:center;" class="bk_spec_font"><a target="_blank" href="https://oplugins.com/plugins/booking-manager/"><?php _e('Help Info' , 'booking-manager');?></a></td> |
| 208 |
</tr> |
| 209 |
<tr> |
| 210 |
<td style="text-align:center;" class="bk_spec_font"><a href="mailto:support@oplugins.com?subject=booking-manager"><?php _e('Contact Support' , 'booking-manager');?></a></td> |
| 211 |
</tr> |
| 212 |
<tr> |
| 213 |
<td style="text-align:center;" class="bk_spec_font"><?php // mailto:newfeature@oplugins.com?subject=booking-manager |
| 214 |
printf( __( '%sNew feature suggestion%s', 'booking-manager'), |
| 215 |
'<a href="mailto:newfeature@oplugins.com?Subject=booking-manager" target="_blank">', |
| 216 |
'</a>' ); ?></td> |
| 217 |
</tr> |
| 218 |
</table> |
| 219 |
</div> |
| 220 |
<?php |
| 221 |
} |
| 222 |
|
| 223 |
|
| 224 |
/** Dashboard Version Section */ |
| 225 |
function wpbm_dashboard_section_version() { |
| 226 |
|
| 227 |
$version = 'free'; |
| 228 |
|
| 229 |
?> |
| 230 |
<div class="wpbm_dashboard_section" > |
| 231 |
<span class="bk_header"><?php _e('Current version' , 'booking-manager');?>:</span> |
| 232 |
<table class="bk_table"> |
| 233 |
<tr class="first"> |
| 234 |
<td style="width:35%;text-align: right;;" class=""><?php _e('Version' , 'booking-manager');?>:</td> |
| 235 |
<td style="color: #e50;font-size: 13px;font-weight: 600;text-align: left;text-shadow: 0 -1px 0 #eee;;" |
| 236 |
class="bk_spec_font"><?php |
| 237 |
if ( substr( WPBM_VERSION, 0, 2 ) == '9.' ) { |
| 238 |
$show_version = substr( WPBM_VERSION , 2 ) ; |
| 239 |
if ( substr($show_version, ( -1 * ( strlen( WPBM_VERSION_NUM ) ) ) ) === WPBM_VERSION_NUM ) { |
| 240 |
$show_version = substr($show_version, 0, ( -1 * ( strlen( WPBM_VERSION_NUM ) ) - 1 ) ); |
| 241 |
$show_version = str_replace('.', ' ', $show_version) . " <sup><strong style='font-size:12px;'>" . WPBM_VERSION_NUM . "</strong></sup>" ; |
| 242 |
} |
| 243 |
echo $show_version ; |
| 244 |
} else |
| 245 |
echo WPBM_VERSION; |
| 246 |
?></td> |
| 247 |
</tr> |
| 248 |
<tr> |
| 249 |
<td style="width:35%;text-align: right;" class="first b"><?php _e('Release date' , 'booking-manager');?>:</td> |
| 250 |
<td style="text-align: left; font-weight: 600;" class="bk_spec_font"><?php echo date ("d.m.Y", filemtime(WPBM_FILE)); ?></td> |
| 251 |
</tr> |
| 252 |
</table> |
| 253 |
</div> |
| 254 |
<?php |
| 255 |
} |
| 256 |
|