Plugin Directory

Changeset 2569530


Ignore:
Timestamp:
07/21/2021 08:03:06 PM (5 years ago)
Author:
Designed4Pixels
Message:

update vultr module

Location:
wp-cloud-server/trunk/modules/vultr/includes
Files:
10 edited

Legend:

Unmodified
Added
Removed
  • wp-cloud-server/trunk/modules/vultr/includes/admin/admin-post/admin-post-delete-vultr-template.php

    r2478501 r2569530  
    2121    // Delete Template if Confirmed Received
    2222    if ( 'true' == $wpcs_confirm_vultr_template_delete ) {
    23         $confirm = wpcs_delete_server_template( 'Vultr', $wpcs_confirm_vultr_template_id );
     23        $confirm = wpcs_delete_template( 'Vultr', $wpcs_confirm_vultr_template_id );
    2424    }
    2525       
  • wp-cloud-server/trunk/modules/vultr/includes/admin/admin-post/admin-post-edit-vultr-template.php

    r2478501 r2569530  
    1717    if ( isset( $_POST['wpcs_vultr_template_type'] ) ) {
    1818        $server_type = $_POST['wpcs_vultr_template_type'];
     19    }
     20
     21    // Save the ServerPilot Template Name
     22    if ( isset( $_POST['wpcs_vultr_template_app'] ) ) {
     23        $server_app = $_POST['wpcs_vultr_template_app'];
    1924    }
    2025   
     
    7176        $server_type                    = $server_type_explode[0];
    7277        $server_type_name               = isset( $server_type_explode[1] ) ? $server_type_explode[1] : '';
     78
     79        $server_app_explode             = explode( '|', $server_app );
     80        $server_app                     = $server_app_explode[0];
     81        $server_app_name                = isset( $server_app_explode[1] ) ? $server_app_explode[1] : '';
    7382       
    7483        $server_region                  = ( 'userselected' == $server_region_name ) ? 'userselected' : $server_region ;
     
    8998            "image"             =>  $server_type,
    9099            "image_name"        =>  $server_type_name,
     100            "app"               =>  $server_app,
     101            "app_name"          =>  $server_app_name,
    91102            "ssh_key_name"      =>  $server_ssh_key,
    92103            "user_data"         =>  $server_startup_script,
     
    123134            update_option( 'wpcs_template_data_backup', $template_data );
    124135       
    125     $feedback = get_option( 'wpcs_setting_errors', array());
     136            $feedback = get_option( 'wpcs_setting_errors', array());
    126137   
    127138    $feedback[] = array(
  • wp-cloud-server/trunk/modules/vultr/includes/admin/assets/js/dashboard-tab.js

    r2449616 r2569530  
    1313
    1414    $( function() {
    15         $("ul#vultr_tabs li").click(function(event) {
     15        $(".vultr").click(function(event) {
    1616            // Read the "data-tab" value from clicked link
    1717            var type = $(this).data('tab');
     18            var tabid = $(this).parent().data('tab-id');
    1819            var data = {
    1920                'action': 'vultr_dashboard_tabs',
    2021                'vultr_dashboard_tabs_nonce': wpcs_vultr_dashboard_tabs_ajax_script.ajax_vultr_dashboard_tabs_nonce,
    21                 'vultr_dashboard_tabs_type': type
     22                'vultr_dashboard_tabs_type': type,
     23                'vultr_dashboard_tabs_id': tabid
    2224            };
    2325            // Make an AJAX call
  • wp-cloud-server/trunk/modules/vultr/includes/admin/class-wp-cloud-server-vultr-admin.php

    r2449616 r2569530  
    108108        // Pick up the notice "admin_type" - passed via the "data-tab" attribute
    109109        if ( isset( $_POST['vultr_dashboard_tabs_type'] ) ) {
    110             $position = $_POST['vultr_dashboard_tabs_type'];
    111             update_option( 'wpcs_vultr_tabs_current_tab', $position );
    112         } else {
    113             update_option( 'wpcs_vultr_tabs_current_tab', 'No Data' );
     110            $position   = $_POST['vultr_dashboard_tabs_type'];
     111            $tab_id     = $_POST['vultr_dashboard_tabs_id'];
     112            update_option( "wpcs_{$tab_id}_current_tab", $position );
    114113        }
    115114           
  • wp-cloud-server/trunk/modules/vultr/includes/admin/class-wp-cloud-server-vultr-settings.php

    r2478550 r2569530  
    244244        register_setting( 'wpcs_vultr_create_template', 'wpcs_vultr_template_name', $args );
    245245        register_setting( 'wpcs_vultr_create_template', 'wpcs_vultr_template_type' );
     246        register_setting( 'wpcs_vultr_create_template', 'wpcs_vultr_template_app' );
    246247        register_setting( 'wpcs_vultr_create_template', 'wpcs_vultr_template_region' );
    247248        register_setting( 'wpcs_vultr_create_template', 'wpcs_vultr_template_size' );
     
    282283        );
    283284
     285        if ( check_vultr_pro_plugin() ) {
     286
     287            add_settings_field(
     288                'wpcs_vultr_template_app',
     289                esc_attr__( 'Server App:', 'wp-cloud-server-vultr' ),
     290                array( $this, 'wpcs_field_callback_vultr_template_app' ),
     291                'wpcs_vultr_create_template',
     292                'wpcs_vultr_create_template'
     293            );
     294
     295        }
     296
    284297        add_settings_field(
    285298            'wpcs_vultr_template_region',
     
    324337        ?>
    325338        <select class="w-400" name="wpcs_vultr_template_type" id="wpcs_vultr_template_type">
    326             <optgroup label="Select Image">
    327                 <?php
    328                 if ( !empty( $images ) ) {
     339            <?php
     340                if ( $images && is_array( $images ) ) {
     341                    ?>
     342                    <optgroup label="Select Image">
     343                    <?php
    329344                    foreach ( $images as $key => $image ) {
    330                         if ( 'Marketplace App' !== $image['name'] ) {
     345                        $options = ( check_vultr_pro_plugin() ) ? array( 'Marketplace App' ) : array( 'Marketplace App', 'Application' );
     346                        if ( !in_array( $image['name'], $options ) ) {
    331347                            ?>
    332348                            <option value="<?php echo "{$key}|{$image['name']}"; ?>"><?php echo $image['name']; ?></option>
     
    340356        <?php
    341357
     358    }
     359
     360    /**
     361     *  Vultr Field Callback for Template App Setting.
     362     *
     363     *  @since 3.0.6
     364     */
     365    public function wpcs_field_callback_vultr_template_app() {
     366
     367        $apps           = wpcs_vultr_app_list();
     368        $module_data    = get_option( 'wpcs_module_list' );
     369   
     370        ?>
     371        <select class="w-400" name="wpcs_vultr_template_app" id="wpcs_vultr_template_app">
     372            <?php
     373            if ( $apps && is_array( $apps ) ) {
     374                ?>
     375                <optgroup label="Select Application">
     376                    <option value="no-application">-- No Application --</option>
     377                    <?php
     378                    foreach ( $apps as $key => $app ) {
     379                        ?>
     380                        <option value="<?php echo "{$key}|{$app['deploy_name']}"; ?>"><?php echo $app['deploy_name']; ?></option>
     381                        <?php
     382                    }
     383                }
     384                ?>
     385            </optgroup>
     386        </select>
     387        <p class="text_desc" >[ Select 'Application' for Server Image above ]</p>
     388        <?php
    342389    }
    343390
     
    462509        register_setting( 'wpcs_vultr_create_server', 'wpcs_vultr_server_name', $args );
    463510        register_setting( 'wpcs_vultr_create_server', 'wpcs_vultr_server_type' );
     511        register_setting( 'wpcs_vultr_create_server', 'wpcs_vultr_server_app' );
    464512        register_setting( 'wpcs_vultr_create_server', 'wpcs_vultr_server_region' );
    465513        register_setting( 'wpcs_vultr_create_server', 'wpcs_vultr_server_size' );
     
    491539        );
    492540
     541        if ( check_vultr_pro_plugin() ) {
     542
     543            add_settings_field(
     544                'wpcs_vultr_server_app',
     545                esc_attr__( 'Server App:', 'wp-cloud-server-vultr' ),
     546                array( $this, 'wpcs_field_callback_vultr_server_app' ),
     547                'wpcs_vultr_create_server',
     548                'wpcs_vultr_create_server'
     549            );
     550
     551        }
     552
    493553        add_settings_field(
    494554            'wpcs_vultr_server_region',
     
    534594        ?>
    535595        <select class="w-400" name="wpcs_vultr_server_type" id="wpcs_vultr_server_type">
    536             <optgroup label="Select Image">
    537596                <?php
    538597                if ( !empty( $images ) ) {
     598                    ?>
     599                    <optgroup label="Select Image">
     600                    <?php
    539601                    foreach ( $images as $key => $image ) {
    540                         if ( 'Marketplace App' !== $image['name'] ) {
     602                        $options = ( check_vultr_pro_plugin() ) ? array( 'Marketplace App' ) : array( 'Marketplace App', 'Application' );
     603                        if ( !in_array( $image['name'], $options ) ) {
    541604                            ?>
    542605                            <option value="<?php echo $key; ?>"><?php echo $image['name']; ?></option>
     
    552615
    553616    /**
     617     *  Vultr Field Callback for Server Type Setting.
     618     *
     619     *  @since 1.0.0
     620     */
     621    public function wpcs_field_callback_vultr_server_app() {
     622
     623        $apps           = wpcs_vultr_app_list();
     624        $module_data    = get_option( 'wpcs_module_list' );
     625   
     626        ?>
     627        <select class="w-400" name="wpcs_vultr_server_app" id="wpcs_vultr_server_app">
     628            <?php
     629            if ( !empty( $apps ) ) {
     630                ?>
     631                <optgroup label="Select Application">
     632                    <option value="no-application">-- No Application --</option>
     633                    <?php
     634                    foreach ( $apps as $key => $app ) {
     635                        ?>
     636                        <option value="<?php echo $key; ?>"><?php echo $app['deploy_name']; ?></option>
     637                        <?php
     638                    }
     639                }
     640                ?>
     641            </optgroup>
     642        </select>
     643        <p class="text_desc" >[ Select 'Application' for Server Image above ]</p>
     644        <?php
     645    }
     646
     647    /**
    554648     *  Vultr Field Callback for Server Name Setting.
    555649     *
     
    577671            <optgroup label="Select Region">
    578672            <?php
    579             if ( !empty( $regions ) ) {
     673            if ( $regions && is_array( $regions ) ) {
    580674                foreach ( $regions as $region ) {
    581675                ?>
     
    604698            <optgroup label="Select Plan">
    605699            <?php
    606             if ( !empty( $plans ) ) {
     700            if ( $plans && is_array( $plans ) ) {
    607701                foreach ( $plans as $plan ) {
    608702                ?>
  • wp-cloud-server/trunk/modules/vultr/includes/admin/settings/template-settings.php

    r2478504 r2569530  
    4848        ?>
    4949        <select class="w-400" name="wpcs_vultr_template_type" id="wpcs_vultr_template_type">
    50             <optgroup label="Select Image">
    51                 <?php
     50            <?php
    5251                if ( !empty( $images ) ) {
     52                    ?>
     53                    <optgroup label="Select Image">
     54                    <?php
    5355                    foreach ( $images as $key => $image ) {
    54                         if ( 'Marketplace App' !== $image['name'] ) {
     56                        $options = ( check_vultr_pro_plugin() ) ? array( 'Marketplace App' ) : array( 'Marketplace App', 'Application' );
     57                        if ( !in_array( $image['name'], $options ) ) {
    5558                            ?>
    5659                            <option value="<?php echo "{$key}|{$image['name']}"; ?>" <?php selected( $value, $image['name'] ); ?>><?php echo $image['name']; ?></option>
     
    6265            </optgroup>
    6366        </select>
     67    <?php
     68}
     69
     70/**
     71*  Display Vultr Template App
     72*
     73*  @since 3.0.6
     74*/
     75function wpcs_vultr_template_app( $value='' ) {
     76
     77    $apps           = wpcs_vultr_app_list();
     78    $module_data    = get_option( 'wpcs_module_list' );
     79
     80    ?>
     81    <select class="w-400" name="wpcs_vultr_template_app" id="wpcs_vultr_template_app">
     82        <?php
     83        if ( !empty( $apps ) ) {
     84            ?>
     85            <optgroup label="Select Application">
     86                <option value="no-application">-- No Application --</option>
     87                <?php
     88                foreach ( $apps as $key => $app ) {
     89                    ?>
     90                    <option value="<?php echo "{$key}|{$app['deploy_name']}"; ?>" <?php selected( $value, $app['deploy_name'] ); ?>><?php echo $app['deploy_name']; ?></option>
     91                    <?php
     92                }
     93            }
     94            ?>
     95        </optgroup>
     96    </select>
    6497    <?php
    6598}
  • wp-cloud-server/trunk/modules/vultr/includes/api/class-wp-cloud-server-vultr-api.php

    r2449616 r2569530  
    106106     */
    107107    public function call_api( $model, $api_data = null, $cache = false, $cache_lifetime = 900, $request = 'GET', $enable_response = false, $function = null ) {
     108
     109        $module_list = get_option( 'wpcs_module_list' );
     110
     111        if ( ( !isset( $module_list[ 'Vultr' ]['status'] ) ) || ( 'active' !== $module_list[ 'Vultr' ]['status'] ) ) {
     112            return false;
     113        }
    108114
    109115        if ( 'POST' === $request || 'DELETE' === $request || 'GET' === $request ) {
  • wp-cloud-server/trunk/modules/vultr/includes/api/wp-cloud-server-vultr-api-abstraction.php

    r2478550 r2569530  
    5757
    5858/**
     59 * Retrieves a list of Applications
     60 *
     61 * @since  3.0.6
     62 *
     63 * @return images List of available applications
     64 */
     65function wpcs_vultr_app_list() {
     66
     67    $plans  = get_option( 'wpcs_vultr_api_data' );
     68   
     69    if ( !isset( $plans['apps'] ) ) {
     70        // Create instance of the Vultr API
     71        $api    = new WP_Cloud_Server_Vultr_API();
     72        $plans['apps'] = $api->call_api( 'app/list', null, false, 900, 'GET', false, 'vultr_app_list' );
     73    }
     74
     75    if ( $plans && is_array( $plans ) ) {
     76   
     77        foreach ( $plans['apps'] as $plan ) {
     78            //if ( !in_array( $plan['name'], ['Custom','Snapshot', 'Backup','Application'], true ) ) {
     79            //if ( !in_array( $plan['name'], ['Custom','Snapshot', 'Backup'], true ) ) {
     80                $plan_list[$plan['APPID']] =  array( 'name' => $plan['name'], 'deploy_name' => $plan['deploy_name'] );
     81            //}
     82        }
     83    }
     84
     85    $plan_list = ( isset( $plan_list ) ) ? $plan_list : false;
     86   
     87    return $plan_list;
     88}
     89
     90/**
    5991 * Retrieves a list of OS Images
    6092 *
     
    85117   
    86118        foreach ( $plans['images'] as $plan ) {
    87             if ( !in_array( $plan['name'], ['Custom','Snapshot', 'Backup','Application'], true ) ) {
     119            //if ( !in_array( $plan['name'], ['Custom','Snapshot', 'Backup','Application'], true ) ) {
     120            if ( !in_array( $plan['name'], ['Custom','Snapshot', 'Backup'], true ) ) {
    88121                $plan_list[$plan['OSID']] =  array( 'name' => $plan['name'] );
    89122            }
     
    103136    );
    104137
    105     $plan_list = ( isset( $plan_list ) ) ? $plan_list : array();
     138    $plan_list = ( isset( $plan_list ) ) ? $plan_list : false;
    106139
    107140    update_option( 'vultr_os_list', $plan_list );
     
    394427function wpcs_vultr_call_api_list_servers( $enable_response = false ) {
    395428
    396     $api = new WP_Cloud_Server_Vultr_API();
    397 
    398     $api_response = $api->call_api( 'server/list', null, false, 0, 'GET', $enable_response, 'get_servers' );
    399 
    400     return $api_response;
     429    $data = get_option( 'wpcs_vultr_api_data' );
     430
     431    if ( isset( $data['servers'] ) && empty( $data['servers'] ) ) {
     432        $servers = WPCS_Vultr()->api->call_api( "server/list", null, false, 0, 'GET', $enable_response, 'vultr_server_list' );
     433        $data['servers'] = $servers;
     434        update_option( 'wpcs_vultr_api_data', $data );
     435    }
     436   
     437    return ( is_array( $data['servers'] ) ) ? $data['servers'] : false;
    401438
    402439}
     
    531568 */
    532569function wpcs_vultr_cloud_server_action( $action, $server_id, $enable_response = false ) {
    533    
    534     // Create instance of the UpCloud API
    535     $api = new WP_Cloud_Server_Vultr_API();
     570
     571    if ( 'DeleteInstance' == $action ) {
     572
     573        $request    = 'POST';
     574        $api_data   = array( "instanceName" => $server_id, "forceDeleteAddOns" => true );
     575
     576    } else {
     577
     578        $request    = 'POST';
     579        $api_data   = array( "instanceName" => $server_id );
     580
     581    }
     582
     583    // Delete the Instance API Data to Force update
     584    $data = get_option( 'wpcs_vultr_api_data' );
     585    if ( isset( $data['servers'] ) ) {
     586        unset( $data['servers'] );
     587        update_option( 'wpcs_vultr_api_data', $data );
     588    }
    536589
    537590    $request    = 'POST';
    538591    $api_data   = array( "SUBID"    => $server_id );
    539592   
    540     $api_response = $api->call_api( 'server/' . $action, $api_data, false, 0, $request, $enable_response, 'server_action' );
     593    $api_response = WPCS_Vultr()->api->call_api( 'server/' . $action, $api_data, false, 0, $request, $enable_response, 'server_action' );
    541594   
    542595    return $api_response;
    543596}
     597
     598/**
     599 * Call to API to get Domain Info
     600 *
     601 * @since  1.0
     602 *
     603 * @return api_response     API response
     604 */
     605function wpcs_vultr_call_api_list_domains( $enable_response = false ) {
     606
     607    $data = get_option( 'wpcs_vultr_api_data' );
     608
     609    if ( !isset( $data['domains'] ) ) {
     610        $databases = WPCS_Vultr()->api->call_api( "domains", null, false, 0, 'GET', false, 'vultr_domain_list' );
     611        $data['domains'] = $databases;
     612        update_option( 'wpcs_vultr_api_data', $data );
     613    }
     614   
     615    return ( is_array( $data['domains'] ) ) ? $data['domains'] : false;
     616
     617}
     618
     619/**
     620 * Call to API to get Firewall Info
     621 *
     622 * @since  1.0
     623 *
     624 * @return api_response     API response
     625 */
     626function wpcs_vultr_call_api_list_firewall( $enable_response = false ) {
     627
     628    $data = get_option( 'wpcs_vultr_api_data' );
     629
     630    if ( !isset( $data['firewalls'] ) ) {
     631        $databases = WPCS_Vultr()->api->call_api( "firewall/rule_list", null, false, 0, 'GET', $enable_response, 'vultr_firewall_list' );
     632        $data['firewalls'] = $databases;
     633        update_option( 'wpcs_vultr_api_data', $data );
     634    }
     635   
     636    return ( is_array( $data['firewalls'] ) ) ? $data['firewalls'] : false;
     637
     638}
     639
     640/**
     641 * Call to API to get Network Info
     642 *
     643 * @since  1.0
     644 *
     645 * @return api_response     API response
     646 */
     647function wpcs_vultr_call_api_list_network( $enable_response = false ) {
     648
     649    $data = get_option( 'wpcs_vultr_api_data' );
     650
     651    if ( !isset( $data['firewalls'] ) ) {
     652        $databases = WPCS_Vultr()->api->call_api( "network/list", null, false, 0, 'GET', $enable_response, 'vultr_firewall_list' );
     653        $data['firewalls'] = $databases;
     654        update_option( 'wpcs_vultr_api_data', $data );
     655    }
     656   
     657    return ( is_array( $data['firewalls'] ) ) ? $data['firewalls'] : false;
     658
     659}
     660
     661/**
     662 * Call to API to get Reserved IP Info
     663 *
     664 * @since  3.0.6
     665 *
     666 * @return api_response     API response
     667 */
     668function wpcs_vultr_call_api_list_reserved_ip( $enable_response = false ) {
     669
     670    $data = get_option( 'wpcs_vultr_api_data' );
     671
     672    if ( !isset( $data['reservedip'] ) ) {
     673        $databases = WPCS_Vultr()->api->call_api( "reservedip/list", null, false, 0, 'GET', $enable_response, 'vultr_reservedip_list' );
     674        $data['reservedip'] = $databases;
     675        update_option( 'wpcs_vultr_api_data', $data );
     676    }
     677   
     678    return ( is_array( $data['reservedip'] ) ) ? $data['reservedip'] : false;
     679
     680}
     681
     682/**
     683 * Call to API to get Backup Info
     684 *
     685 * @since  1.0
     686 *
     687 * @return api_response     API response
     688 */
     689function wpcs_vultr_call_api_list_backups( $server_id = null, $enable_response = false ) {
     690
     691    $api_data = ( !empty( $server ) ) ? array( 'SUBID' => $server_id ) : null;
     692
     693    $databases = WPCS_Vultr()->api->call_api( "backup/list", $api_data, false, 0, 'GET', $enable_response, 'vultr_reservedip_list' );
     694    $data['backups'] = $databases;
     695   
     696    return ( is_array( $data['backups'] ) ) ? $data['backups'] : false;
     697}
     698
     699/**
     700 * Call to API to get Snapshot Info
     701 *
     702 * @since  1.0
     703 *
     704 * @return api_response     API response
     705 */
     706function wpcs_vultr_call_api_list_snapshots( $enable_response = false ) {
     707
     708    $data = get_option( 'wpcs_vultr_api_data' );
     709
     710    if ( !isset( $data['snapshots'] ) ) {
     711        $databases = WPCS_Vultr()->api->call_api( "snapshot/list", null, false, 0, 'GET', $enable_response, 'vultr_reservedip_list' );
     712        $data['snapshots'] = $databases;
     713        update_option( 'wpcs_vultr_api_data', $data );
     714    }
     715   
     716    return ( is_array( $data['snapshots'] ) ) ? $data['snapshots'] : false;
     717
     718}
     719
     720/**
     721 * Call to API to get Snapshot Info
     722 *
     723 * @since  1.0
     724 *
     725 * @return api_response     API response
     726 */
     727function wpcs_vultr_call_api_list_block_storage( $enable_response = false ) {
     728
     729    $data = get_option( 'wpcs_vultr_api_data' );
     730
     731    if ( !isset( $data['blocks'] ) ) {
     732        $databases = WPCS_Vultr()->api->call_api( "block/list", null, false, 0, 'GET', $enable_response, 'vultr_reservedip_list' );
     733        $data['blocks'] = $databases;
     734        update_option( 'wpcs_vultr_api_data', $data );
     735    }
     736   
     737    return ( is_array( $data['blocks'] ) ) ? $data['blocks'] : false;
     738
     739}
     740
     741/**
     742 * Call to API to get Snapshot Info
     743 *
     744 * @since  1.0
     745 *
     746 * @return api_response     API response
     747 */
     748function wpcs_vultr_call_api_list_firewall_groups( $enable_response = false ) {
     749
     750    $data = get_option( 'wpcs_vultr_api_data' );
     751
     752    if ( !isset( $data['firewalls'] ) ) {
     753        $databases = WPCS_Vultr()->api->call_api( "firewall/group_list", null, false, 0, 'GET', $enable_response, 'vultr_reservedip_list' );
     754        $data['firewalls'] = $databases;
     755        update_option( 'wpcs_vultr_api_data', $data );
     756    }
     757   
     758    return ( is_array( $data['firewalls'] ) ) ? $data['firewalls'] : false;
     759
     760}
  • wp-cloud-server/trunk/modules/vultr/includes/class-wp-cloud-server-vultr-edd.php

    r2485671 r2569530  
    289289                    $server_plan_id         = $server['size'];
    290290                    $server_os_id           = $server['image'];
     291                    $server_app_id          = $server['app'];
    291292                    $server_region          = ( 'userselected' == $server['region'] ) ? $server_location : $server['region'];
    292293                    $user_meta              = $server['user_data'];
     
    297298                    $size_name              = $server['size_name'];
    298299                    $image_name             = $server['image_name'];
     300                    $app_name               = $server['app_name'];
    299301                }
    300302            }
     
    348350                "OSID"          =>  $server_os_id,
    349351            );
     352
     353            if ( '186' == $server_os_id ) {
     354                $app_data['APPID']      = $server_app_id;
     355            }
    350356
    351357           
     
    426432                'size_name'         => $size_name,
    427433                'image_name'        => $image_name,
     434                'app_name'          => $app_name,
    428435            );
    429436           
  • wp-cloud-server/trunk/modules/vultr/includes/config/config.php

    r2492179 r2569530  
    3636require_once WPCS_VULTR_PLUGIN_DIR . 'includes/config/templates/vultr-backup-details.php';
    3737require_once WPCS_VULTR_PLUGIN_DIR . 'includes/config/templates/vultr-snapshot-details.php';
     38
     39require_once WPCS_VULTR_PLUGIN_DIR . 'includes/config/templates/vultr-block-storage-details.php';
     40require_once WPCS_VULTR_PLUGIN_DIR . 'includes/config/templates/vultr-private-network-details.php';
     41require_once WPCS_VULTR_PLUGIN_DIR . 'includes/config/templates/vultr-reserved-ip-details.php';
     42require_once WPCS_VULTR_PLUGIN_DIR . 'includes/config/templates/vultr-firewall-details.php';
     43require_once WPCS_VULTR_PLUGIN_DIR . 'includes/config/templates/vultr-domain-details.php';
     44
     45require_once WPCS_VULTR_PLUGIN_DIR . 'includes/config/templates/vultr-list-ssh-keys.php';
     46require_once WPCS_VULTR_PLUGIN_DIR . 'includes/config/templates/vultr-create-ssh-key.php';
     47require_once WPCS_VULTR_PLUGIN_DIR . 'includes/config/templates/vultr-create-user-github-startup-scripts.php';
     48require_once WPCS_VULTR_PLUGIN_DIR . 'includes/config/templates/vultr-list-user-startup-scripts.php';
     49require_once WPCS_VULTR_PLUGIN_DIR . 'includes/config/templates/vultr-create-user-startup-scripts.php';
     50require_once WPCS_VULTR_PLUGIN_DIR . 'includes/config/templates/vultr-list-host-names.php';
     51require_once WPCS_VULTR_PLUGIN_DIR . 'includes/config/templates/vultr-create-host-name.php';
    3852
    3953/*
     
    129143            'subtitle'      => '',
    130144            'desc'          => '',
    131             'tab_block_id'  => 'vultr_tabs',
     145            'tab_block_id'  => 'vultr_server_tabs',
    132146                    'tabs'          => array(
    133147                        'tab1'      =>  'Servers',
    134                         'tab2'      =>  'Templates',
    135                         'tab3'      =>  '+ Add Server',
    136                         'tab4'      =>  '+ Add Template',
    137                         'tab5'      =>  'Clients',
     148                        'tab2'      =>  '+ Add Server',
    138149                    ),
    139150                    'tabs_content'  => array(
    140151                        'tab1'      =>  'vultr-server-details',
    141                         'tab2'      =>  'vultr-template-details',
    142                         'tab3'      =>  'vultr-create-server',
    143                         'tab4'      =>  'vultr-create-template',
    144                         'tab5'      =>  'vultr-client-details',
     152                        'tab2'      =>  'vultr-create-server',
    145153                    ),
    146154                    'tabs_active'   => array(
    147155                        'tab1'      =>  'true',
    148                         'tab2'      =>  wpcs_cart_active(),
    149                         'tab3'      =>  'true',
    150                         'tab4'      =>  wpcs_cart_active(),
    151                         'tab5'      =>  wpcs_cart_active(),
     156                        'tab2'      =>  'true',
    152157                    ),
    153158                    'tabs_width'    => array(
    154159                        'tab1'      =>  '',
    155                         'tab2'      =>  '',
    156                         'tab3'      =>  'xsmall',
    157                         'tab4'      =>  'xsmall',
    158                         'tab5'      =>  '',
     160                        'tab2'      =>  'xsmall',
     161                    ),
     162                    'modal_menu_items'  => array(
     163                        'menu1'     =>  'Summary',
     164                        'menu2'     =>  'Backups',
     165                        'menu3'     =>  'Snapshots',
     166                    ),
     167            'modal_menu_active' => array(
     168                        'menu1'     =>  'true',
     169                        'menu2'     =>  'true',
     170                        'menu3'     =>  'true',
     171                    ),
     172            'modal_menu_action' => array(
     173                        'menu1'     =>  'summary',
     174                        'menu2'     =>  'backup',
     175                        'menu3'     =>  'snapshot',
    159176                    ),
    160177);
     
    167184            'id'            => 'vultr-backup-details',
    168185            'module'        => 'Vultr',
    169             'active'        => 'false',
     186            'active'        => 'true',
    170187            'position'      => '9',
    171188            'template'      => 'vultr-backup-details',
     
    201218$config[ 'wp-cloud-servers-vultr' ]['Vultr'][1] = $sub_menu;
    202219
     220$sub_menu = array(
     221    'id'            => 'vultr-block-storage-details',
     222    'module'        => 'Vultr',
     223    'active'        => 'true',
     224    'position'      => '9',
     225    'template'      => 'vultr-block-storage-details',
     226    'template_path' => 'includes/config/templates',
     227    'menu_header'   => '',
     228    'menu_divider'  => '',
     229    'menu_item'     => 'Block Storage',
     230    'section_width' => '',
     231    'type'          => 'text',
     232    'api_required'  => array( 'vultr'),
     233    'title'         => '',
     234    'subtitle'      => '',
     235    'desc'          => '',
     236    'tab_block_id'  => 'vultr_volumes_tabs',
     237            'tabs'          => array(
     238                'tab1'      =>  'Block Storage',
     239                'tab2'      =>  '+ Add Block Storage',
     240            ),
     241            'tabs_content'  => array(
     242                'tab1'      =>  'vultr-block-storage-details',
     243                'tab2'      =>  'vultr-create-block-storage',
     244            ),
     245            'tabs_active'   => array(
     246                'tab1'      =>  'true',
     247                'tab2'      =>  'false',
     248            ),
     249            'tabs_width'    => array(
     250                'tab1'      =>  '',
     251                'tab2'      =>  '',
     252            ),
     253);
     254
     255$config[ 'wp-cloud-servers-vultr' ]['Vultr'][2] = $sub_menu;
     256
     257$sub_menu = array(
     258    'id'            => 'vultr-domain-details',
     259    'module'        => 'Vultr',
     260    'active'        => 'true',
     261    'position'      => '9',
     262    'template'      => 'vultr-domain-details',
     263    'template_path' => 'includes/config/templates',
     264    'menu_header'   => '',
     265    'menu_divider'  => '',
     266    'menu_item'     => 'DNS',
     267    'section_width' => '',
     268    'type'          => 'text',
     269    'api_required'  => array( 'vultr'),
     270    'title'         => 'Vultr Servers',
     271    'subtitle'      => '',
     272    'desc'          => '',
     273    'tab_block_id'  => 'vultr_domain_tabs',
     274            'tabs'          => array(
     275                'tab1'      =>  'Domains',
     276                'tab2'      =>  '+ Add Domain',
     277            ),
     278            'tabs_content'  => array(
     279                'tab1'      =>  'vultr-domain-details',
     280                'tab2'      =>  'vultr-create-domain',
     281            ),
     282            'tabs_active'   => array(
     283                'tab1'      =>  'true',
     284                'tab2'      =>  'false',
     285            ),
     286            'tabs_width'    => array(
     287                'tab1'      =>  '',
     288                'tab2'      =>  '',
     289            ),
     290);
     291
     292$config[ 'wp-cloud-servers-vultr' ]['Vultr'][3] = $sub_menu;
     293
     294$sub_menu = array(
     295    'id'            => 'vultr-firewall-details',
     296    'module'        => 'Vultr',
     297    'active'        => 'true',
     298    'position'      => '9',
     299    'template'      => 'vultr-firewall-details',
     300    'template_path' => 'includes/config/templates',
     301    'menu_header'   => '',
     302    'menu_divider'  => '',
     303    'menu_item'     => 'Firewall',
     304    'section_width' => '',
     305    'type'          => 'text',
     306    'api_required'  => array( 'vultr'),
     307    'title'         => '',
     308    'subtitle'      => '',
     309    'desc'          => '',
     310    'tab_block_id'  => 'vultr_firewall_tabs',
     311            'tabs'          => array(
     312                'tab1'      =>  'Firewall',
     313                'tab2'      =>  '+ Add Firewall',
     314            ),
     315            'tabs_content'  => array(
     316                'tab1'      =>  'vultr-firewall-details',
     317                'tab2'      =>  'vultr-create-firewall',
     318            ),
     319            'tabs_active'   => array(
     320                'tab1'      =>  'true',
     321                'tab2'      =>  'false',
     322            ),
     323            'tabs_width'    => array(
     324                'tab1'      =>  '',
     325                'tab2'      =>  '',
     326            ),
     327);
     328
     329$config[ 'wp-cloud-servers-vultr' ]['Vultr'][4] = $sub_menu;
     330
     331$sub_menu = array(
     332    'id'            => 'vultr-network-details',
     333    'module'        => 'Vultr',
     334    'active'        => 'true',
     335    'position'      => '9',
     336    'template'      => 'vultr-network-details',
     337    'template_path' => 'includes/config/templates',
     338    'menu_header'   => '',
     339    'menu_divider'  => '',
     340    'menu_item'     => 'Network',
     341    'section_width' => '',
     342    'type'          => 'text',
     343    'api_required'  => array( 'vultr'),
     344    'title'         => '',
     345    'subtitle'      => '',
     346    'desc'          => '',
     347    'tab_block_id'  => 'vultr_network_tabs',
     348            'tabs'          => array(
     349                'tab1'      =>  'Reserved IPs',
     350                'tab2'      =>  '+ Add Reserved IPs',
     351                'tab3'      =>  'Private Networks',
     352                'tab4'      =>  '+ Add Private Network',
     353            ),
     354            'tabs_content'  => array(
     355                'tab1'      =>  'vultr-reserved-ip-details',
     356                'tab2'      =>  'vultr-private-network-details',
     357                'tab3'      =>  'vultr-private-network-details',
     358                'tab4'      =>  'vultr-private-network-details',
     359            ),
     360            'tabs_active'   => array(
     361                'tab1'      =>  'true',
     362                'tab2'      =>  'false',
     363                'tab3'      =>  'true',
     364                'tab4'      =>  'false',
     365            ),
     366            'tabs_width'    => array(
     367                'tab1'      =>  '',
     368                'tab2'      =>  '',
     369                'tab3'      =>  '',
     370                'tab4'      =>  '',
     371            ),
     372);
     373
     374$config[ 'wp-cloud-servers-vultr' ]['Vultr'][5] = $sub_menu;
     375
     376$sub_menu = array(
     377    'id'            => 'vultr-template-details',
     378    'module'        => 'Vultr',
     379    'active'        => wpcs_cart_active(),
     380    'position'      => '9',
     381    'template'      => 'vultr-template-details',
     382    'template_path' => 'includes/config/templates',
     383    'menu_header'   => 'Hosting',
     384    'menu_divider'  => 'yes',
     385    'menu_item'     => 'Templates',
     386    'section_width' => '',
     387    'type'          => 'text',
     388    'api_required'  => array( 'vultr'),
     389    'title'         => '',
     390    'subtitle'      => '',
     391    'desc'          => '',
     392    'tab_block_id'  => 'vultr_templates_tabs',
     393            'tabs'          => array(
     394                'tab1'      =>  'Templates',
     395                'tab2'      =>  '+ Add Template',
     396            ),
     397            'tabs_content'  => array(
     398                'tab1'      =>  'vultr-template-details',
     399                'tab2'      =>  'vultr-create-template',
     400            ),
     401            'tabs_active'   => array(
     402                'tab1'      =>  'true',
     403                'tab2'      =>  'true',
     404            ),
     405            'tabs_width'    => array(
     406                'tab1'      =>  '',
     407                'tab2'      =>  'xsmall',
     408            ),
     409);
     410
     411$config[ 'wp-cloud-servers-vultr' ]['Vultr'][6] = $sub_menu;
     412
     413$sub_menu = array(
     414    'id'            => 'vultr-client-details',
     415    'module'        => 'Vultr',
     416    'active'        => wpcs_cart_active(),
     417    'position'      => '9',
     418    'template'      => 'vultr-client-details',
     419    'template_path' => 'includes/config/templates',
     420    'menu_header'   => '',
     421    'menu_divider'  => '',
     422    'menu_item'     => 'Clients',
     423    'section_width' => '',
     424    'type'          => 'text',
     425    'api_required'  => array( 'vultr'),
     426    'title'         => '',
     427    'subtitle'      => '',
     428    'desc'          => '',
     429    'tab_block_id'  => 'vultr_client_tabs',
     430            'tabs'          => array(
     431                'tab1'      =>  'Clients',
     432            ),
     433            'tabs_content'  => array(
     434                'tab1'      =>  'vultr-client-details',
     435            ),
     436            'tabs_active'   => array(
     437                'tab1'      =>  'true',
     438            ),
     439            'tabs_width'    => array(
     440                'tab1'      =>  '',
     441            ),
     442);
     443
     444$config[ 'wp-cloud-servers-vultr' ]['Vultr'][7] = $sub_menu;
     445
     446$sub_menu = array(
     447    'id'            => 'create-ssh-key',
     448    'module'        => '',
     449    'active'        => 'true',
     450    'position'      => '7',
     451    'template'      => 'create-ssh-key',
     452    'template_path' => 'includes/admin/dashboard/config/templates',
     453    'menu_header'   => 'Settings',
     454    'menu_divider'  => 'yes',
     455    'menu_item'     => 'SSH Keys',
     456    'type'          => 'text',
     457    'section_width' => '',
     458    'title'         => '',
     459    'subtitle'      => '',
     460    'desc'          => '',
     461    'table'         => array(
     462        'heading1'  =>  'Name',
     463        'heading2'  =>  'Fingerprint',
     464        'heading3'  =>  'Public Key',
     465        'heading4'  =>  'Manage',
     466    ),
     467    'tab_block_id'  => 'settings_vultr_ssh_tabs',
     468    'tabs'          => array(
     469        'tab1'      =>  'SSH Keys',
     470        'tab2'      =>  '+ Add SSH Key',
     471    ),
     472    'tabs_content'  => array(
     473        'tab1'      =>  'vultr-list-ssh-keys',
     474        'tab2'      =>  'vultr-create-ssh-key',
     475    ),
     476    'tabs_active'   => array(
     477        'tab1'      =>  'true',
     478        'tab2'      =>  'true',
     479    ),
     480    'tabs_width'    => array(
     481        'tab1'      =>  '',
     482        'tab2'      =>  'xsmall',
     483    ),
     484);
     485
     486$config[ 'wp-cloud-servers-vultr' ]['Vultr'][8] = $sub_menu;
     487
     488$sub_menu = array(
     489    'id'            => 'create-user-startup-scripts',
     490    'module'        => '',
     491    'active'        => 'true',
     492    'position'      => '7',
     493    'template'      => 'create-user-startup-scripts',
     494    'template_path' => 'includes/admin/dashboard/config/templates',
     495    'menu_header'   => '',
     496    'menu_divider'  => '',
     497    'menu_item'     => 'Startup Scripts',
     498    'type'          => 'text',
     499    'section_width' => '',
     500    'title'         => esc_html__( 'Startup Scripts', 'wp-cloud-server' ),
     501    'subtitle'      => '',
     502    'desc'          => '',
     503    'table'         => array(
     504        'heading1'  =>  'Name',
     505        'heading2'  =>  'Description',
     506        'heading3'  =>  'GitHub Repos',
     507        'heading4'  =>  'GitHub File',
     508        'heading5'  =>  'Manage',
     509    ),
     510    'tab_block_id'  => 'settings_vultr_scripts_tabs',
     511    'tabs'          => array(
     512        'tab1'      =>  'Startup Scripts',
     513        'tab2'      =>  '+ Add Startup Script',
     514        'tab3'      =>  '+ Add GitHub Script',
     515    ),
     516    'tabs_content'  => array(
     517        'tab1'      =>  'vultr-list-user-startup-scripts',
     518        'tab2'      =>  'vultr-create-user-startup-scripts',
     519        'tab3'      =>  'vultr-create-user-github-startup-scripts',
     520    ),
     521    'tabs_active'   => array(
     522        'tab1'      =>  'true',
     523        'tab2'      =>  'true',
     524        'tab3'      =>  'true',
     525    ),
     526    'tabs_width'    => array(
     527        'tab1'      =>  '',
     528        'tab2'      =>  'xsmall',
     529        'tab3'      =>  'xsmall',
     530    ),
     531);
     532
     533$config[ 'wp-cloud-servers-vultr' ]['Vultr'][9] = $sub_menu;
     534
     535$sub_menu = array(
     536    'id'            => 'create-host-name',
     537    'module'        => '',
     538    'active'        => wpcs_cart_active(),
     539    'position'      => '7',
     540    'template'      => 'create-host-name',
     541    'template_path' => 'includes/admin/dashboard/config/templates',
     542    'menu_header'   => '',
     543    'menu_divider'  => '',
     544    'menu_item'     => 'Hostnames',
     545    'type'          => 'text',
     546    'section_width' => '',
     547    'title'         => '',
     548    'subtitle'      => '',
     549    'desc'          => '',
     550    'table'         => array(
     551        'heading1'  =>  'Label',
     552        'heading2'  =>  'Hostname',
     553        'heading3'  =>  'Suffix',
     554        'heading4'  =>  'Protocol',
     555        'heading5'  =>  'Domain',
     556        'heading6'  =>  'Port',
     557        'heading7'  =>  'Manage',
     558    ),
     559    'tab_block_id'  => 'settings_vultr_hostnames_tabs',
     560    'tabs'          => array(
     561        'tab1'      =>  'Hostnames',
     562        'tab2'      =>  '+ Add Hostname',
     563    ),
     564    'tabs_content'  => array(
     565        'tab1'      =>  'vultr-list-host-names',
     566        'tab2'      =>  'vultr-create-host-name',
     567    ),
     568    'tabs_active'   => array(
     569        'tab1'      =>  'true',
     570        'tab2'      =>  'true',
     571    ),
     572    'tabs_width'    => array(
     573        'tab1'      =>  '',
     574        'tab2'      =>  'xsmall',
     575    ),
     576);
     577
     578$config[ 'wp-cloud-servers-vultr' ]['Vultr'][10] = $sub_menu;
     579
    203580/*
    204581 * <--- END MENU CONFIGURATION
     
    213590}
    214591add_action( 'wpcs_update_module_config', 'wpcs_setup_vultr_config', 10, 3 );
     592
     593function wpcs_vultr_summary_upgrade( $server ) {
     594    ?>
     595    <div class="uk-overflow-auto">
     596        <h3 class="uk-margin-remove-top uk-heading-divider"><?php _e( 'Server Management', 'wp-cloud-server' ); ?></h3>
     597            <table class="server-info uk-table uk-table-striped">
     598                                    <tbody>
     599                                         <tr>
     600                                    <td><?php esc_html_e( 'Server Name', 'wp-cloud-server' ); ?></td>
     601                                    <td><?php echo "{$server['label']}"; ?></td>
     602                                </tr>
     603                                <tr>
     604                                    <td><?php esc_html_e( 'Status', 'wp-cloud-server' ); ?></td>
     605                                    <td><?php echo ucfirst($server['power_status']); ?></td>
     606                                </tr>
     607                                <tr>
     608                                    <td><?php esc_html_e( 'Region', 'wp-cloud-server' ); ?></td>
     609                                    <td><?php echo $server['location']; ?></td>
     610                                </tr>
     611                                <tr>
     612                                    <td><?php esc_html_e( 'Image', 'wp-cloud-server' ); ?></td>
     613                                    <td><?php echo $server['os']; ?></td>
     614                                </tr>
     615                                <tr>
     616                                    <td><?php esc_html_e( 'VCPUs', 'wp-cloud-server' ); ?></td>
     617                                    <td><?php echo $server['vcpu_count']; ?></td>
     618                                </tr>
     619                                <tr>
     620                                    <td><?php esc_html_e( 'Memory', 'wp-cloud-server' ); ?></td>
     621                                    <td><?php echo $server['ram'] ?></td>
     622                                </tr>
     623                                <tr>
     624                                    <td><?php esc_html_e( 'SSD', 'wp-cloud-server' ); ?></td>
     625                                    <td><?php echo $server['disk']; ?></td>
     626                                </tr>
     627                                <tr>
     628                                    <td><?php esc_html_e( 'IP Address', 'wp-cloud-server' ); ?></td>
     629                                    <td><?php echo isset($server['main_ip']) ? $server['main_ip'] : 'Not Available'; ?></td>
     630                                </tr>
     631                                <tr>
     632                                    <td><?php esc_html_e( 'Server ID', 'wp-cloud-server' ); ?></td>
     633                                    <td><?php echo "{$server['SUBID']}"; ?></td>
     634                                </tr>
     635                                <tr>
     636                                    <td><?php esc_html_e( 'Date Created', 'wp-cloud-server' ); ?></td>
     637                                    <td><?php $d = new DateTime( $server['date_created'] ); echo $d->format('d-m-Y'); ?></td>
     638                                </tr>
     639                                    </tbody>
     640                                </table>
     641        </div>
     642    <?php
     643}
     644add_action( 'wpcs_vultr_summary_content', 'wpcs_vultr_summary_upgrade' );
     645
     646function wpcs_vultr_backup_upgrade( $server ) {
     647
     648    $backups        = wpcs_vultr_call_api_list_backups( $server['SUBID'] );
     649    $module_data    = get_option( 'wpcs_module_list' );
     650
     651    ?>
     652    <div class="uk-overflow-auto">
     653        <h3 class="uk-margin-remove-top uk-heading-divider"><?php _e( 'Vultr Backups', 'wp-cloud-server' ); ?></h3>
     654            <div class="uk-overflow-auto">
     655                <table class="uk-table uk-table-striped">
     656                    <thead>
     657                        <tr>
     658                            <th><?php esc_html_e( 'ID', 'wp-cloud-server-vultr' ); ?></th>
     659                            <th><?php esc_html_e( 'Date', 'wp-cloud-server-vultr' ); ?></th>
     660                            <th><?php esc_html_e( 'Description', 'wp-cloud-server-vultr' ); ?></th>
     661                            <th><?php esc_html_e( 'Size', 'wp-cloud-server-vultr' ); ?></th>
     662                            <th><?php esc_html_e( 'Status', 'wp-cloud-server-vultr' ); ?></th>
     663                        </tr>
     664                    </thead>
     665                    <tbody>
     666                        <?php
     667                        if ( !empty( $backups ) ) {
     668                            foreach ( $backups as $key => $backup ) {
     669                                ?>
     670                                <tr>
     671                                    <td><?php echo $backup['BACKUPID']; ?></td>
     672                                    <td><?php
     673                                        $d = new DateTime( $backup['date_created'] );
     674                                        echo $d->format('d-m-Y');
     675                                        ?>
     676                                    </td>
     677                                    <td><?php echo $backup['description']; ?></td>
     678                                    <td><?php echo $backup['size']; ?></td>
     679                                    <td><?php echo $backup['status']; ?></td>
     680                                </tr>
     681                                <?php
     682                            }
     683                        } else {
     684                            ?>
     685                            <tr>
     686                                <td colspan="7"><?php esc_html_e( 'No Backup Information Available', 'wp-cloud-server' ) ?></td>
     687                            </tr>
     688                            <?php
     689                        }
     690                        ?>
     691                    </tbody>
     692                </table>
     693            </div>
     694    </div>
     695    <?php
     696}
     697add_action( 'wpcs_vultr_backup_content', 'wpcs_vultr_backup_upgrade' );
     698
     699function wpcs_vultr_snapshot_upgrade( $server ) {
     700
     701    $backups        = wpcs_vultr_call_api_list_snapshots();
     702    $module_data    = get_option( 'wpcs_module_list' );
     703
     704    ?>
     705    <div class="uk-overflow-auto">
     706        <h3 class="uk-margin-remove-top uk-heading-divider"><?php _e( 'Vultr Snapshots', 'wp-cloud-server' ); ?></h3>
     707            <div class="uk-overflow-auto">
     708                <table class="uk-table uk-table-striped">
     709                    <thead>
     710                        <tr>
     711                            <th><?php esc_html_e( 'ID', 'wp-cloud-server-vultr' ); ?></th>
     712                            <th><?php esc_html_e( 'Date', 'wp-cloud-server-vultr' ); ?></th>
     713                            <th><?php esc_html_e( 'Description', 'wp-cloud-server-vultr' ); ?></th>
     714                            <th><?php esc_html_e( 'Size', 'wp-cloud-server-vultr' ); ?></th>
     715                            <th><?php esc_html_e( 'Status', 'wp-cloud-server-vultr' ); ?></th>
     716                        </tr>
     717                    </thead>
     718                    <tbody>
     719                        <?php
     720                        if ( !empty( $backups ) ) {
     721                            foreach ( $backups as $key => $backup ) {
     722                                ?>
     723                                <tr>
     724                                    <td><?php echo $backup['SNAPSHOTID']; ?></td>
     725                                    <td><?php
     726                                        $d = new DateTime( $backup['date_created'] );
     727                                        echo $d->format('d-m-Y');
     728                                        ?>
     729                                    </td>
     730                                    <td><?php echo $backup['description']; ?></td>
     731                                    <td><?php echo $backup['size']; ?></td>
     732                                    <td><?php echo $backup['status']; ?></td>
     733                                </tr>
     734                                <?php
     735                            }
     736                        } else {
     737                            ?>
     738                            <tr>
     739                                <td colspan="7"><?php esc_html_e( 'No Snapshot Information Available', 'wp-cloud-server' ) ?></td>
     740                            </tr>
     741                            <?php
     742                        }
     743                        ?>
     744                    </tbody>
     745                </table>
     746            </div>
     747    </div>
     748<?php
     749}
     750add_action( 'wpcs_vultr_snapshot_content', 'wpcs_vultr_snapshot_upgrade' );
Note: See TracChangeset for help on using the changeset viewer.