2019-06-12 10:09:54 -04:00
|
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
if (!defined('WPINC')) {
|
|
|
|
|
die;
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-27 10:10:07 -04:00
|
|
|
|
add_action('wp_dashboard_setup', 'slm_add_dashboard_widgets');
|
2019-06-12 10:09:54 -04:00
|
|
|
|
|
2020-04-30 09:18:42 -04:00
|
|
|
|
if (null !== SLM_Helper_Class::slm_get_option('slm_adminbar') && SLM_Helper_Class::slm_get_option('slm_adminbar') == 1) {
|
|
|
|
|
add_action('admin_bar_menu', 'add_toolbar_items', 100);
|
|
|
|
|
}
|
2019-06-12 10:09:54 -04:00
|
|
|
|
/**
|
|
|
|
|
* Add a widget to the dashboard.
|
|
|
|
|
*
|
|
|
|
|
* This function is hooked into the 'wp_dashboard_setup' action below.
|
|
|
|
|
*/
|
|
|
|
|
function slm_add_dashboard_widgets()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
wp_add_dashboard_widget(
|
|
|
|
|
'slm_dashboard_widget', // Widget slug.
|
2024-10-28 21:54:52 -04:00
|
|
|
|
'SLM Plus', // Title.
|
2019-06-12 10:09:54 -04:00
|
|
|
|
'slm_dashboard_widget_function' // Display function.
|
|
|
|
|
);
|
|
|
|
|
}
|
2019-07-27 10:10:07 -04:00
|
|
|
|
|
2020-04-30 09:18:42 -04:00
|
|
|
|
function add_toolbar_items($admin_bar){
|
2019-07-27 10:10:07 -04:00
|
|
|
|
$admin_bar->add_menu(array(
|
|
|
|
|
'id' => 'slm-menu',
|
2024-11-19 10:01:55 -05:00
|
|
|
|
'title' => '<span class="ab-icon"></span>' . __('SLM Plus', 'slm-plus'), // Added text domain
|
2020-06-23 16:32:08 +02:00
|
|
|
|
'href' => admin_url('admin.php?page=slm_overview'),
|
2019-07-27 10:10:07 -04:00
|
|
|
|
'meta' => array(
|
2024-11-19 10:01:55 -05:00
|
|
|
|
'title' => __('slm-plus', 'slm-plus'), // Added text domain
|
2019-07-27 10:10:07 -04:00
|
|
|
|
),
|
|
|
|
|
));
|
|
|
|
|
$admin_bar->add_menu(array(
|
|
|
|
|
'id' => 'slm-manage-licenses-overview',
|
|
|
|
|
'parent' => 'slm-menu',
|
2024-11-19 10:01:55 -05:00
|
|
|
|
'title' => __('Overview', 'slm-plus'), // Added text domain
|
2019-07-27 10:10:07 -04:00
|
|
|
|
'href' => admin_url('admin.php?page=slm_overview'),
|
|
|
|
|
'meta' => array(
|
2024-11-19 10:01:55 -05:00
|
|
|
|
'title' => __('Overview', 'slm-plus'), // Added text domain
|
2019-07-27 10:10:07 -04:00
|
|
|
|
'class' => 'slm_overview_menu'
|
|
|
|
|
),
|
|
|
|
|
));
|
|
|
|
|
$admin_bar->add_menu(array(
|
|
|
|
|
'id' => 'slm-manage-licenses-addnew',
|
|
|
|
|
'parent' => 'slm-menu',
|
2024-11-19 10:01:55 -05:00
|
|
|
|
'title' => __('Add new license', 'slm-plus'), // Added text domain
|
2019-07-27 10:10:07 -04:00
|
|
|
|
'href' => admin_url('admin.php?page=slm_manage_license'),
|
|
|
|
|
'meta' => array(
|
2024-11-19 10:01:55 -05:00
|
|
|
|
'title' => __('Add new license', 'slm-plus'), // Added text domain
|
2019-07-27 10:10:07 -04:00
|
|
|
|
'class' => 'slm_addlicense_menu'
|
|
|
|
|
),
|
|
|
|
|
));
|
|
|
|
|
$admin_bar->add_menu(array(
|
|
|
|
|
'id' => 'slm-manage-licenses-settings',
|
|
|
|
|
'parent' => 'slm-menu',
|
2024-11-19 10:01:55 -05:00
|
|
|
|
'title' => __('Settings', 'slm-plus'), // Added text domain
|
2019-07-27 10:10:07 -04:00
|
|
|
|
'href' => admin_url( 'admin.php?page=slm_settings'),
|
|
|
|
|
'meta' => array(
|
2024-11-19 10:01:55 -05:00
|
|
|
|
'title' => __('Settings', 'slm-plus'), // Added text domain
|
2019-07-27 10:10:07 -04:00
|
|
|
|
'class' => 'slm_settings_menu'
|
|
|
|
|
),
|
|
|
|
|
));
|
|
|
|
|
}
|
|
|
|
|
|
2019-06-12 10:09:54 -04:00
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Create the function to output the contents of our Dashboard Widget.
|
|
|
|
|
*/
|
|
|
|
|
function slm_dashboard_widget_function()
|
|
|
|
|
{ ?>
|
|
|
|
|
|
2024-11-19 10:01:55 -05:00
|
|
|
|
<ul class="slm_status_list">
|
|
|
|
|
<li class="total-licenses">
|
|
|
|
|
<a href="<?php echo esc_url(admin_url('admin.php?page=slm_overview')); ?>">
|
|
|
|
|
<div class="icon"> <span class="dashicons dashicons-admin-network"></span> </div>
|
|
|
|
|
<strong><?php esc_html_e('Manage licenses', 'slm-plus'); ?></strong>
|
|
|
|
|
<?php esc_html_e('Total active licenses', 'slm-plus'); ?>
|
|
|
|
|
<span class="badge"><?php echo esc_html(SLM_Utility::get_total_licenses()); ?></span>
|
|
|
|
|
</a>
|
|
|
|
|
</li>
|
|
|
|
|
<li class="active-licenses">
|
|
|
|
|
<a href="<?php echo esc_url(admin_url('admin.php?page=slm_overview&s=active&view=active')); ?>">
|
|
|
|
|
<div class="icon"><span class="dashicons dashicons-yes-alt"></span></div>
|
|
|
|
|
<strong><?php echo esc_html(SLM_Utility::count_licenses('active')); ?></strong>
|
|
|
|
|
<?php esc_html_e('Active licenses', 'slm-plus'); ?>
|
|
|
|
|
</a>
|
|
|
|
|
</li>
|
|
|
|
|
<li class="pending-licenses">
|
|
|
|
|
<a href="<?php echo esc_url(admin_url('admin.php?page=slm_overview&s=pending&view=pending')); ?>">
|
|
|
|
|
<div class="icon"> <span class="dashicons dashicons-warning"></span> </div>
|
|
|
|
|
<strong><?php echo esc_html(SLM_Utility::count_licenses('pending')); ?></strong>
|
|
|
|
|
<?php esc_html_e('Pending licenses', 'slm-plus'); ?>
|
|
|
|
|
</a>
|
|
|
|
|
</li>
|
|
|
|
|
<li class="blocked-licenses">
|
|
|
|
|
<a href="<?php echo esc_url(admin_url('admin.php?page=slm_overview&s=blocked&view=blocked')); ?>">
|
|
|
|
|
<div class="icon"> <span class="dashicons dashicons-dismiss"></span> </div>
|
|
|
|
|
<strong><?php echo esc_html(SLM_Utility::count_licenses('blocked')); ?></strong>
|
|
|
|
|
<?php esc_html_e('Blocked licenses', 'slm-plus'); ?>
|
|
|
|
|
</a>
|
|
|
|
|
</li>
|
|
|
|
|
<li class="expired-licenses">
|
|
|
|
|
<a href="<?php echo esc_url(admin_url('admin.php?page=slm_overview&s=expired&view=expired')); ?>">
|
|
|
|
|
<div class="icon"> <span class="dashicons dashicons-calendar-alt"></span> </div>
|
|
|
|
|
<strong><?php echo esc_html(SLM_Utility::count_licenses('expired')); ?></strong>
|
|
|
|
|
<?php esc_html_e('Expired licenses', 'slm-plus'); ?>
|
|
|
|
|
</a>
|
|
|
|
|
</li>
|
|
|
|
|
</ul>
|
|
|
|
|
|
|
|
|
|
<div class="table recent_licenses">
|
|
|
|
|
<hr>
|
|
|
|
|
<table>
|
|
|
|
|
<thead>
|
|
|
|
|
<tr>
|
|
|
|
|
<th scope="col">
|
|
|
|
|
<?php esc_html_e('Recent Licenses', 'slm-plus'); ?>
|
|
|
|
|
<a href="<?php echo esc_url(admin_url('admin.php?page=slm_overview')); ?>"> – <?php esc_html_e('View All', 'slm-plus'); ?></a>
|
|
|
|
|
</th>
|
|
|
|
|
</tr>
|
|
|
|
|
</thead>
|
|
|
|
|
<tbody>
|
|
|
|
|
<?php SLM_Utility::slm_wp_dashboards_stats('5'); ?>
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
</div>
|
2019-06-12 10:09:54 -04:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<?php
|
|
|
|
|
}
|
2024-10-29 11:59:10 -04:00
|
|
|
|
|