PluginProbe
RabbitLoader / 2.17.6
RabbitLoader v2.17.6
4.0.2 4.0.1 4.0 3.2.0 3.1.1 3.1.0 3.0.5 3.0.3 3.0.4 2.17.1 2.17.2 2.17.3 2.17.4 2.17.5 2.17.6 2.17.7 2.18.0 2.18.1 2.18.2 2.18.3 2.18.4 2.18.5 2.18.6 2.18.7 2.18.8 All 129 releases
rabbit-loader / inc / tab_usage.php

tab_usage.php in RabbitLoader 2.17.6, at inc/tab_usage.php

87 lines 4.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if(class_exists('RabbitLoader_21_Tab_Usage')){
4 #it seems we have a conflict
5 return;
6 }
7
8 final class RabbitLoader_21_Tab_Usage extends RabbitLoader_21_Tab_Init{
9
10 public static function init(){
11 add_settings_section(
12 'rabbitloader_section_usage',
13 ' ',
14 '',
15 'rabbitloader-usage'
16 );
17 $start_date = date("Y-m-d", strtotime('-30 days'));
18 $end_date = date("Y-m-d");
19 $tbl = "RLUsageData.initV2(rabbitloader_local_vars.hostname, `".RabbitLoader_21_Core::getRLDomain()."`, `".RabbitLoader_21_Core::getWpOptVal('api_token')."`, `".$start_date."`, `".$end_date."`);";
20
21 wp_enqueue_script('rabbitloader-luxon', RABBITLOADER_PLUG_URL . 'admin/js/luxon.min.v2.1.1.js', [], RABBITLOADER_PLUG_VERSION);
22 wp_enqueue_script('rabbitloader-echarts', RABBITLOADER_PLUG_URL . 'admin/js/echarts.min.js', [], RABBITLOADER_PLUG_VERSION);
23 wp_enqueue_script('rabbitloader-usage-js', RabbitLoader_21_Core::getRLDomain().'account/common/js/ec_area_stacked.js', ['rabbitloader-echarts', 'rabbitloader-luxon'], RABBITLOADER_PLUG_VERSION);
24 wp_add_inline_script('rabbitloader-usage-js', $tbl);
25 }
26
27 public static function echoMainContent(){
28
29 do_settings_sections( 'rabbitloader-usage' );
30 $overview = self::getOverviewData($apiError, $apiMessage);
31
32 ?>
33 <div class="" style="max-width: 1160px; margin:40px auto;">
34 <div class="row mb-4">
35 <div class="col-sm-12 col-md-4">
36 <?php self::quota_used_box($overview, false);?>
37 </div>
38 <div class="col-sm-12 col-md-4">
39 <?php self::quota_remaining_box($overview);?>
40 </div>
41 <div class="col-sm-12 col-md-4">
42 <div class="bg-white rounded p-4 tpopup" title="<?php RabbitLoader_21_Util_WP::_e(sprintf('Your usage cycle will be reset on %s', date('jS M, Y', strtotime($overview['plan_end_date']))));?>">
43 <h4 class="">
44 <?php echo date('jS', strtotime($overview['plan_end_date']));?> <small style="font-size:14px;"><?php echo date('M', strtotime($overview['plan_end_date']));?></small>
45 </h4>
46 <span class="text-secondary mt-2"><?php RabbitLoader_21_Util_WP::_e('Next Reset');?></span>
47 </div>
48 </div>
49 </div>
50
51 <div class="row mb-4">
52 <div class="col">
53 <div class="bg-white rounded py-4">
54 <div class="row">
55 <div class="col-12 text-secondary">
56 <h5 class="px-4">CDN Usage</h5>
57 <span class="d-block px-4">Bandwidth usage pattern in last 30 days.</span>
58 </div>
59 </div>
60 <div class="p-4">
61 <div class="chart has-fixed-height" id="d3-area-stacked-nest-bandwidth" style="height:400px; width:100%;"></div>
62 </div>
63 </div>
64 </div>
65 </div>
66
67 <div class="row mb-4">
68 <div class="col">
69 <div class="bg-white rounded py-4">
70 <div class="row">
71 <div class="col-12 text-secondary">
72 <h5 class="px-4">Assets Request</h5>
73 <span class="d-block px-4">Assets request pattern in last 30 days. This includes the number of times asset files such as CSS, JavaScript, Images, Font files etc were requested from CDN server nodes.</span>
74 </div>
75 </div>
76 <div class="p-4">
77 <div class="chart has-fixed-height" id="d3-area-stacked-nest-requests" style="height:400px; width:100%;"></div>
78 </div>
79 </div>
80 </div>
81 </div>
82 </div>
83 <?php
84 }
85 }
86
87 ?>