Пример #1
0
 /**
  * Loads and configures NetDNA widget to be used in WP Dashboards.
  * @param $widget_id
  * @param array $form_inputs
  */
 function widget_maxcdn($widget_id, $form_inputs = array())
 {
     w3_require_once(W3TC_INC_FUNCTIONS_DIR . '/ui.php');
     $authorized = $this->authorized;
     $have_zone = $this->have_zone;
     $error = '';
     $no_zone = $this->_config->get_integer('cdn.maxcdn.zone_id') == 0;
     $is_sealed = $this->_sealed;
     if ($this->authorized && $this->have_zone) {
         $zone_id = $this->_config->get_integer('cdn.maxcdn.zone_id');
         try {
             $zone_info = $this->api->get_pull_zone($zone_id);
         } catch (Exception $ex) {
             $zone_info = false;
             $error = $ex->getMessage();
         }
         if ($zone_info) {
             $content_zone = $zone_info['name'];
             try {
                 $summary = $this->api->get_stats_per_zone($zone_id);
                 $filetypes = $this->api->get_list_of_file_types_per_zone($zone_id);
                 $popular_files = $this->api->get_list_of_popularfiles_per_zone($zone_id);
                 $popular_files = NetDNAPresentation::format_popular($popular_files);
                 $popular_files = array_slice($popular_files, 0, 5);
                 $account = $this->api->get_account();
                 $account_status = NetDNAPresentation::get_account_status($account['status']);
                 include W3TC_INC_WIDGET_DIR . '/maxcdn.php';
             } catch (Exception $ex) {
                 $error = $ex->getMessage();
                 include W3TC_INC_WIDGET_DIR . '/maxcdn_signup.php';
             }
         } else {
             include W3TC_INC_WIDGET_DIR . '/maxcdn_signup.php';
         }
     } else {
         include W3TC_INC_WIDGET_DIR . '/maxcdn_signup.php';
     }
 }
Пример #2
0
 /**
  * Loads and configures NetDNA widget to be used in WP Dashboards.
  * @param $widget_id
  * @param array $form_inputs
  */
 function widget_netdna($widget_id, $form_inputs = array())
 {
     $authorized = $this->authorized;
     $have_zone = $this->have_zone;
     $is_sealed = $this->_sealed;
     if ($authorized && $have_zone) {
         $zone_id = $this->_config->get_integer('cdn.netdna.zone_id');
         $zone_info = $this->api->get_pull_zone($zone_id);
         if ($zone_info) {
             $content_zone = $zone_info['name'];
             $summary = $this->api->get_stats_per_zone($zone_id);
             $filetypes = $this->api->get_list_of_file_types_per_zone($zone_id);
             $popular_files = $this->api->get_list_of_popularfiles_per_zone($zone_id);
             $popular_files = NetDNAPresentation::format_popular($popular_files);
             $popular_files = array_slice($popular_files, 0, 5);
             $account = $this->api->get_account();
             $account_status = NetDNAPresentation::get_account_status($account['status']);
             include W3TC_INC_WIDGET_DIR . '/netdna.php';
         } else {
             include W3TC_INC_WIDGET_DIR . '/netdna_signup.php';
         }
     } else {
         include W3TC_INC_WIDGET_DIR . '/netdna_signup.php';
     }
 }
Пример #3
0
_e('File', 'w3-total-cache');
?>
</span>
                <span style="display:inline-block;float:right"><?php 
_e('Hits', 'w3-total-cache');
?>
</span>
            </p>
            <ul class="file_hits">
                <?php 
if ($popular_files) {
    $compare = $popular_files[0]['hit'];
    foreach ($popular_files as $file) {
        ?>
                <li><span style="display:inline-block; background-color: <?php 
        echo NetDNAPresentation::get_file_group_color($file['group']);
        ?>
;width: <?php 
        echo $file['hit'] / $compare * 100 * 0.9;
        ?>
%; min-width:60%" title="<?php 
        echo $file['title'];
        ?>
"><?php 
        echo '/', $file['group'], '/', $file['file'];
        ?>
</span> <span style="color:#000"><?php 
        echo $file['hit'];
        ?>
</span></li>
                <?php 
 /**
  * Loads and configures NetDNA widget to be used in WP Dashboards.
  *
  * @param unknown $widget_id
  * @param array   $form_inputs
  */
 function widget_netdna($widget_id, $form_inputs = array())
 {
     $authorized = $this->authorized;
     $have_zone = $this->have_zone;
     $is_sealed = $this->_sealed;
     $error = '';
     $pull_zones = array();
     $zone_info = false;
     if ($authorized && $have_zone) {
         $zone_id = $this->_config->get_integer('cdn.netdna.zone_id');
         try {
             $zone_info = $this->api->get_pull_zone($zone_id);
         } catch (\Exception $ex) {
             $error = $ex->getMessage();
             $zone_info = false;
         }
         if ($zone_info) {
             $content_zone = $zone_info['name'];
             try {
                 $summary = $this->api->get_stats_per_zone($zone_id);
                 $filetypes = $this->api->get_list_of_file_types_per_zone($zone_id);
                 $popular_files = $this->api->get_list_of_popularfiles_per_zone($zone_id);
                 $popular_files = \NetDNAPresentation::format_popular($popular_files);
                 $popular_files = array_slice($popular_files, 0, 5);
                 $account = $this->api->get_account();
                 $account_status = \NetDNAPresentation::get_account_status($account['status']);
                 include W3TC_INC_WIDGET_DIR . '/netdna.php';
             } catch (\Exception $ex) {
                 try {
                     $pull_zones = $this->api->get_zones_by_url(home_url());
                 } catch (\Exception $ex) {
                 }
                 $error = $ex->getMessage();
                 include W3TC_INC_WIDGET_DIR . '/netdna_signup.php';
             }
         } else {
             try {
                 $pull_zones = $this->api->get_zones_by_url(home_url());
             } catch (\Exception $ex) {
             }
             include W3TC_INC_WIDGET_DIR . '/netdna_signup.php';
         }
     } else {
         include W3TC_INC_WIDGET_DIR . '/netdna_signup.php';
     }
 }