當前位置: 首頁>>代碼示例>>PHP>>正文


PHP RevSliderOperations::get_performance方法代碼示例

本文整理匯總了PHP中RevSliderOperations::get_performance方法的典型用法代碼示例。如果您正苦於以下問題:PHP RevSliderOperations::get_performance方法的具體用法?PHP RevSliderOperations::get_performance怎麽用?PHP RevSliderOperations::get_performance使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在RevSliderOperations的用法示例。


在下文中一共展示了RevSliderOperations::get_performance方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: get_slider_speed


//.........這裏部分代碼省略.........
            foreach ($my_fonts as $c_font) {
                $fcount = RevSliderBase::get_font_weight_count($c_font);
                $_li = '<li class="tp-monitor-listli">';
                if ($fcount < 4) {
                    $_li .= '<span class="tp-monitor-good"></span>';
                } else {
                    if ($fcount < 7) {
                        $_li .= '<span class="tp-monitor-well"></span>';
                    } else {
                        $_li .= '<span class="tp-monitor-warning"></span>';
                    }
                }
                $_li .= '<span class="tp-monitor-file">';
                $_li .= strip_tags($c_font);
                $_li .= '</span>';
                $_li .= '</li>';
                if ($fcount > 4) {
                    $issues .= $_li;
                }
                echo $_li;
                $all_font_count += $fcount;
            }
        }
        echo '</ul>';
        ?>
		</div><!-- END OF OVERALL Div-->
		
		<script>
			jQuery(document).on("ready",function() {
				
				jQuery('body').on('click','.tp-monitor-showdetails',function() {
					var bt = jQuery(this);
					if (bt.hasClass("selected")) {
						bt.find('.tp-show-inner-btn').html(bt.data('close'));
						bt.removeClass("selected");
						jQuery(bt.data('target')).slideUp(200);
					} else {
						bt.find('.tp-show-inner-btn').html(bt.data('open'));
						bt.addClass("selected");
						jQuery(bt.data('target')).slideDown(200);
					}
					
				})
			})
		</script>
		<?php 
        $content = ob_get_contents();
        ob_end_clean();
        if ($img_counter == 0) {
            $img_counter = 1;
        }
        if ($slide_counter == 0) {
            $slide_counter = 1;
        }
        $overall = RevSliderOperations::get_performance($total_size / $slide_counter, 0, 400000);
        // 400KB / Slide is ok
        $image = RevSliderOperations::get_performance($img_size / $img_counter, 0, 100000);
        // 100KB Image OK
        $css = RevSliderOperations::get_performance($css_size, 0, 150000);
        // 150KB CSS OK
        $js = RevSliderOperations::get_performance($js_size, 0, 250000);
        // 250KB Image OK
        $font = RevSliderOperations::get_performance($all_font_count, 0, 15);
        // 250KB Image OK
        $firstslide_size += $js_size;
        $firstslide_size += $css_size;
        $smartslide_size += $js_size;
        $smartslide_size += $css_size;
        $content = str_replace("%overall_performance%", $overall["proc"], $content);
        $content = str_replace("%overall_color%", $overall["col"], $content);
        $content = str_replace("%overall_size%", size_format($total_size, 2), $content);
        $content = str_replace("%image_performance%", $image["proc"], $content);
        $content = str_replace("%image_color%", $image["col"], $content);
        $content = str_replace("%css_performance%", $css["proc"], $content);
        $content = str_replace("%css_color%", $css["col"], $content);
        $content = str_replace("%css_size%", size_format($css_size, 2), $content);
        $content = str_replace("%js_performance%", $js["proc"], $content);
        $content = str_replace("%js_color%", $js["col"], $content);
        $content = str_replace("%js_size%", size_format($js_size, 2), $content);
        $content = str_replace("%font_performance%", $font["proc"], $content);
        $content = str_replace("%font_color%", $font["col"], $content);
        $content = str_replace("%font_size%", $all_font_count, $content);
        $content = str_replace("%issues%", $issues, $content);
        $content = str_replace("%firstslide_size%", size_format($firstslide_size, 2), $content);
        $content = str_replace("%smartslide_size%", size_format($smartslide_size, 2), $content);
        $content = str_replace("%allslide_size%", size_format($total_size, 2), $content);
        $total_size = $total_size / 1000;
        $content = str_replace("%umtsspeed-all%", gmdate('i:s', $total_size / 48), $content);
        $content = str_replace("%dslspeed-all%", gmdate('i:s', $total_size / 307), $content);
        $content = str_replace("%t1speed-all%", gmdate('i:s', $total_size / 1180), $content);
        $firstslide_size = $firstslide_size / 1000;
        $content = str_replace("%umtsspeed-single%", gmdate('i:s', $firstslide_size / 48), $content);
        $content = str_replace("%dslspeed-single%", gmdate('i:s', $firstslide_size / 307), $content);
        $content = str_replace("%t1speed-single%", gmdate('i:s', $firstslide_size / 1180), $content);
        $smartslide_size = $smartslide_size / 1000;
        $content = str_replace("%umtsspeed-smart%", gmdate('i:s', $smartslide_size / 48), $content);
        $content = str_replace("%dslspeed-smart%", gmdate('i:s', $smartslide_size / 307), $content);
        $content = str_replace("%t1speed-smart%", gmdate('i:s', $smartslide_size / 1180), $content);
        echo $content;
    }
開發者ID:hathbanger,項目名稱:squab,代碼行數:101,代碼來源:operations.class.php


注:本文中的RevSliderOperations::get_performance方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。