rtProgress::progress_ui PHP Method

progress_ui() public method

Show progress_ui.
public progress_ui ( float $progress, boolean $echo = true ) : string
$progress float
$echo boolean
return string $progress_ui
    public function progress_ui($progress, $echo = true)
    {
        $progress_ui = '
			<div id="rtprogressbar">
				<div style="width:' . esc_attr($progress) . '%"></div>
			</div>
			';
        if ($echo) {
            echo $progress_ui;
            // @codingStandardsIgnoreLine
        } else {
            return $progress_ui;
        }
    }

Usage Example

 public function usage_widget()
 {
     $usage_details = get_site_option('rtmedia-encoding-usage');
     $content = '';
     if ($usage_details && isset($usage_details[$this->api_key]->status) && $usage_details[$this->api_key]->status) {
         if (isset($usage_details[$this->api_key]->plan->name)) {
             $content .= '<p><strong>' . __('Current Plan', 'buddypress-media') . ':</strong> ' . $usage_details[$this->api_key]->plan->name . ($usage_details[$this->api_key]->sub_status ? '' : ' (' . __('Unsubscribed', 'buddypress-media') . ')') . '</p>';
         }
         if (isset($usage_details[$this->api_key]->used)) {
             $content .= '<p><span class="encoding-used"></span><strong>' . __('Used', 'buddypress-media') . ':</strong> ' . (($used_size = size_format($usage_details[$this->api_key]->used, 2)) ? $used_size : '0MB') . '</p>';
         }
         if (isset($usage_details[$this->api_key]->remaining)) {
             $content .= '<p><span class="encoding-remaining"></span><strong>' . __('Remaining', 'buddypress-media') . ':</strong> ' . (($remaining_size = size_format($usage_details[$this->api_key]->remaining, 2)) ? $remaining_size : '0MB') . '</p>';
         }
         if (isset($usage_details[$this->api_key]->total)) {
             $content .= '<p><strong>' . __('Total', 'buddypress-media') . ':</strong> ' . size_format($usage_details[$this->api_key]->total, 2) . '</p>';
         }
         $usage = new rtProgress();
         $content .= $usage->progress_ui($usage->progress($usage_details[$this->api_key]->used, $usage_details[$this->api_key]->total), false);
         if ($usage_details[$this->api_key]->remaining <= 0) {
             $content .= '<div class="error below-h2"><p>' . __('Your usage limit has been reached. Upgrade your plan.', 'buddypress-media') . '</p></div>';
         }
     } else {
         $content .= '<div class="error below-h2"><p>' . __('Your API key is not valid or is expired.', 'buddypress-media') . '</p></div>';
     }
     new RTMediaAdminWidget('rtmedia-encoding-usage', __('Encoding Usage', 'buddypress-media'), $content);
 }
All Usage Examples Of rtProgress::progress_ui