本文整理汇总了PHP中RevSliderFunctions类的典型用法代码示例。如果您正苦于以下问题:PHP RevSliderFunctions类的具体用法?PHP RevSliderFunctions怎么用?PHP RevSliderFunctions使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RevSliderFunctions类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getMetaQuery
/**
*
* get meta query for filtering woocommerce posts.
*/
public static function getMetaQuery($args)
{
$regPriceFrom = RevSliderFunctions::getVal($args, self::ARG_REGULAR_PRICE_FROM);
$regPriceTo = RevSliderFunctions::getVal($args, self::ARG_REGULAR_PRICE_TO);
$salePriceFrom = RevSliderFunctions::getVal($args, self::ARG_SALE_PRICE_FROM);
$salePriceTo = RevSliderFunctions::getVal($args, self::ARG_SALE_PRICE_TO);
$inStockOnly = RevSliderFunctions::getVal($args, self::ARG_IN_STOCK_ONLY);
$featuredOnly = RevSliderFunctions::getVal($args, self::ARG_FEATURED_ONLY);
$arrQueries = array();
//get regular price array
if (!empty($regPriceFrom) || !empty($regPriceTo)) {
$arrQueries[] = self::getPriceQuery($regPriceFrom, $regPriceTo, self::META_REGULAR_PRICE);
}
//get sale price array
if (!empty($salePriceFrom) || !empty($salePriceTo)) {
$arrQueries[] = self::getPriceQuery($salePriceFrom, $salePriceTo, self::META_SALE_PRICE);
}
if ($inStockOnly == "on") {
$query = array('key' => self::META_STOCK_STATUS, 'value' => "instock");
$arrQueries[] = $query;
}
if ($featuredOnly == "on") {
$query = array('key' => self::META_FEATURED, 'value' => "yes");
$arrQueries[] = $query;
}
$query = array();
if (!empty($arrQueries)) {
$query = array("meta_query" => $arrQueries);
}
return $query;
}
示例2: delete
/**
*
* delete rows
*/
public function delete($table, $where)
{
global $wpdb;
RevSliderFunctions::validateNotEmpty($table, "table name");
RevSliderFunctions::validateNotEmpty($where, "where");
$query = "delete from {$table} where {$where}";
$wpdb->query($query);
$this->checkForErrors("Delete query error");
}
示例3: add_tiny_mce_shortcode_dialog
//.........这里部分代码省略.........
?>
" data-slideralias="<?php
echo esc_attr($values['slideralias']);
?>
">
<span class="mini-transparent mini-as-bg"></span>
<div class="rs-slider-modify-container <?php
echo $values['bg_extraClass'];
?>
" <?php
echo $values['bg_fullstyle'];
?>
></div>
<i class="slide-link-forward eg-icon-forward"></i>
<span class="rs-slider-modify-title">#<?php
echo $values['sliderid'] . ' ' . $values['slidertitle'];
?>
</span>
</li>
<?php
break;
}
}
}
?>
<span style="clear:both;width:100%;display:block"></span>
</ul>
<span style="clear:both;width:100%;display:block"></span>
<script type="text/javascript">
var rev_sliders_info = jQuery.parseJSON(<?php
echo RevSliderFunctions::jsonEncodeForClientSide($sliders_info);
?>
);
</script>
</div>
<div class="revslider-stepnavigator">
<span class="revslider-currentstep"><strong><?php
_e('STEP 1', 'revslider');
?>
</strong><?php
_e('Select / Create Slider', 'revslider');
?>
</span>
<span class="revslider-step-actions-wrapper">
<a href="javascript:void(0);" class="button-primary nonclickable" id="rs-modify-predefined-slider"><span class="dashicons dashicons-admin-generic"></span><?php
_e('Quick Modify Slider', 'revslider');
?>
</a>
<a href="javascript:void(0);" class="button-primary nonclickable" id="rs-add-predefined-slider"><span class="dashicons dashicons-migrate"></span><?php
_e('Add Selected Slider', 'revslider');
?>
</a>
</span>
<span style="clear:both;width:100%;display:block"></span>
</div>
</div>
<!-- STEP 1.5 -->
<div id="revslider-tiny-dialog-step-1-5" style="display: none;">
<p class="revslider-quicktitle"></p>
<div id="revslider-tiny-settings-wrap" class="revslider-quick-inner-wrapper" style="padding-right:0px;padding-bottom:0px;">
<ul class="rs-mod-slides-wrapper">
示例4: validateWpmlExists
/**
*
* valdiate that wpml exists
*/
private static function validateWpmlExists()
{
if (!self::isWpmlExists()) {
RevSliderFunctions::throwError("The wpml plugin is not activated");
}
}
示例5: add_style_settings_to_layer
/**
* add missing new style fields to the layers as all layers would be broken without this
* @since 5.0
*/
public static function add_style_settings_to_layer($sliders = false)
{
$sr = new RevSlider();
$sl = new RevSliderSlide();
$operations = new RevSliderOperations();
if ($sliders === false) {
//do it on all Sliders
$sliders = $sr->getArrSliders(false);
} else {
$sliders = array($sliders);
}
$styles = $operations->getCaptionsContentArray();
if (!empty($sliders) && is_array($sliders)) {
foreach ($sliders as $slider) {
$slides = $slider->getSlides();
$staticID = $sl->getStaticSlideID($slider->getID());
if ($staticID !== false) {
$msl = new RevSliderSlide();
if (strpos($staticID, 'static_') === false) {
$staticID = 'static_' . $slider->getID();
}
$msl->initByID($staticID);
if ($msl->getID() !== '') {
$slides = array_merge($slides, array($msl));
}
}
if (!empty($slides) && is_array($slides)) {
foreach ($slides as $slide) {
$layers = $slide->getLayers();
if (!empty($layers) && is_array($layers)) {
foreach ($layers as $lk => $layer) {
$static_styles = (array) RevSliderFunctions::getVal($layer, 'static_styles', array());
$def_val = (array) RevSliderFunctions::getVal($layer, 'deformation', array());
$defh_val = (array) RevSliderFunctions::getVal($layer, 'deformation-hover', array());
if (empty($def_val)) {
//add parallax always!
$def_val['parallax'] = RevSliderFunctions::getVal($layer, 'parallax_level', '-');
$layers[$lk]['deformation'] = $def_val;
//check for selected style in styles, then add all deformations to the layer
$cur_style = RevSliderFunctions::getVal($layer, 'style', '');
if (trim($cur_style) == '') {
continue;
}
$wws = false;
foreach ($styles as $style) {
if ($style['handle'] == '.tp-caption.' . $cur_style) {
$wws = $style;
break;
}
}
if ($wws == false) {
continue;
}
$css_idle = '';
$css_hover = '';
$wws['params'] = (array) $wws['params'];
$wws['hover'] = (array) $wws['hover'];
$wws['advanced'] = (array) $wws['advanced'];
if (isset($wws['params']['font-family'])) {
$def_val['font-family'] = $wws['params']['font-family'];
}
if (isset($wws['params']['padding'])) {
$raw_pad = $wws['params']['padding'];
if (!is_array($raw_pad)) {
$raw_pad = explode(' ', $raw_pad);
}
switch (count($raw_pad)) {
case 1:
$raw_pad = array($raw_pad[0], $raw_pad[0], $raw_pad[0], $raw_pad[0]);
break;
case 2:
$raw_pad = array($raw_pad[0], $raw_pad[1], $raw_pad[0], $raw_pad[1]);
break;
case 3:
$raw_pad = array($raw_pad[0], $raw_pad[1], $raw_pad[2], $raw_pad[1]);
break;
}
$def_val['padding'] = $raw_pad;
}
if (isset($wws['params']['font-style'])) {
$def_val['font-style'] = $wws['params']['font-style'];
}
if (isset($wws['params']['text-decoration'])) {
$def_val['text-decoration'] = $wws['params']['text-decoration'];
}
if (isset($wws['params']['background-color'])) {
if (RevSliderFunctions::isrgb($wws['params']['background-color'])) {
$def_val['background-color'] = RevSliderFunctions::rgba2hex($wws['params']['background-color']);
} else {
$def_val['background-color'] = $wws['params']['background-color'];
}
}
if (isset($wws['params']['background-transparency'])) {
$def_val['background-transparency'] = $wws['params']['background-transparency'];
if ($def_val['background-transparency'] > 1) {
$def_val['background-transparency'] /= 100;
//.........这里部分代码省略.........
示例6: putRevSlider
/**
*
* put rev slider on the page.
* the data can be slider ID or slider alias.
*/
function putRevSlider($data, $putIn = "")
{
$operations = new RevSliderOperations();
$arrValues = $operations->getGeneralSettingsValues();
$includesGlobally = RevSliderFunctions::getVal($arrValues, "includes_globally", "on");
$strPutIn = RevSliderFunctions::getVal($arrValues, "pages_for_includes");
$isPutIn = RevSliderOutput::isPutIn($strPutIn, true);
if ($isPutIn == false && $includesGlobally == "off") {
$output = new RevSliderOutput();
$option1Name = __("Include RevSlider libraries globally (all pages/posts)", 'revslider');
$option2Name = __("Pages to include RevSlider libraries", 'revslider');
$output->putErrorMessage(__("If you want to use the PHP function \"putRevSlider\" in your code please make sure to check \" ", 'revslider') . $option1Name . __(" \" in the backend's \"General Settings\" (top right panel). <br> <br> Or add the current page to the \"", 'revslider') . $option2Name . __("\" option box.", 'revslider'));
return false;
}
ob_start();
$slider = RevSliderOutput::putSlider($data, $putIn);
$content = ob_get_contents();
ob_clean();
ob_end_clean();
if (is_object($slider)) {
$disable_on_mobile = @$slider->getParam("disable_on_mobile", "off");
// Do not output Slider if we are on mobile
if ($disable_on_mobile == 'on') {
$mobile = strstr($_SERVER['HTTP_USER_AGENT'], 'Android') || strstr($_SERVER['HTTP_USER_AGENT'], 'webOS') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPhone') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPod') || strstr($_SERVER['HTTP_USER_AGENT'], 'Windows Phone') || strstr($_SERVER['HTTP_USER_AGENT'], 'iPad') || wp_is_mobile() ? true : false;
if ($mobile) {
return false;
}
}
}
echo $content;
}
示例7: onAjaxAction
/**
*
* onAjax action handler
*/
public static function onAjaxAction()
{
$slider = new RevSlider();
$slide = new RevSlide();
$operations = new RevSliderOperations();
$action = self::getPostGetVar("client_action");
$data = self::getPostGetVar("data");
$nonce = self::getPostGetVar("nonce");
if (empty($nonce)) {
$nonce = self::getPostGetVar("rs-nonce");
}
try {
//verify the nonce
$isVerified = wp_verify_nonce($nonce, "revslider_actions");
if ($isVerified == false) {
RevSliderFunctions::throwError("Wrong request");
}
switch ($action) {
case 'add_new_preset':
if (!isset($data['settings']) || !isset($data['values'])) {
self::ajaxResponseError(__('Missing values to add preset', 'revslider'), false);
}
$result = $operations->add_preset_setting($data);
if ($result === true) {
$presets = $operations->get_preset_settings();
self::ajaxResponseSuccess(__('Preset created', 'revslider'), array('data' => $presets));
} else {
self::ajaxResponseError($result, false);
}
exit;
break;
case 'update_preset':
if (!isset($data['name']) || !isset($data['values'])) {
self::ajaxResponseError(__('Missing values to update preset', 'revslider'), false);
}
$result = $operations->update_preset_setting($data);
if ($result === true) {
$presets = $operations->get_preset_settings();
self::ajaxResponseSuccess(__('Preset created', 'revslider'), array('data' => $presets));
} else {
self::ajaxResponseError($result, false);
}
exit;
break;
case 'remove_preset':
if (!isset($data['name'])) {
self::ajaxResponseError(__('Missing values to remove preset', 'revslider'), false);
}
$result = $operations->remove_preset_setting($data);
if ($result === true) {
$presets = $operations->get_preset_settings();
self::ajaxResponseSuccess(__('Preset deleted', 'revslider'), array('data' => $presets));
} else {
self::ajaxResponseError($result, false);
}
exit;
break;
case "export_slider":
$sliderID = self::getGetVar("sliderid");
$dummy = self::getGetVar("dummy");
$slider->initByID($sliderID);
$slider->exportSlider($dummy);
break;
case "import_slider":
$updateAnim = self::getPostGetVar("update_animations");
$updateNav = self::getPostGetVar("update_navigations");
$updateStatic = self::getPostGetVar("update_static_captions");
self::importSliderHandle(null, $updateAnim, $updateStatic, $updateNav);
break;
case "import_slider_slidersview":
$viewBack = self::getViewUrl(self::VIEW_SLIDERS);
$updateAnim = self::getPostGetVar("update_animations");
$updateNav = self::getPostGetVar("update_navigations");
$updateStatic = self::getPostGetVar("update_static_captions");
self::importSliderHandle($viewBack, $updateAnim, $updateStatic, $updateNav);
break;
case "import_slider_online_template_slidersview":
$viewBack = self::getViewUrl(self::VIEW_SLIDERS);
self::importSliderOnlineTemplateHandle($viewBack, 'true', 'none');
break;
case "import_slide_online_template_slidersview":
$redirect_id = esc_attr(self::getPostGetVar("redirect_id"));
$viewBack = self::getViewUrl(self::VIEW_SLIDE, "id={$redirect_id}");
$slidenum = intval(self::getPostGetVar("slidenum"));
$sliderid = intval(self::getPostGetVar("slider_id"));
self::importSliderOnlineTemplateHandle($viewBack, 'true', 'none', array('slider_id' => $sliderid, 'slide_id' => $slidenum));
break;
case "import_slider_template_slidersview":
$viewBack = self::getViewUrl(self::VIEW_SLIDERS);
$updateAnim = self::getPostGetVar("update_animations");
$updateStatic = self::getPostGetVar("update_static_captions");
self::importSliderTemplateHandle($viewBack, $updateAnim, $updateStatic);
break;
case "import_slide_template_slidersview":
$redirect_id = esc_attr(self::getPostGetVar("redirect_id"));
$viewBack = self::getViewUrl(self::VIEW_SLIDE, "id={$redirect_id}");
//.........这里部分代码省略.........
示例8: googlef_template_container
);
var googlef_template_container = wp.template( "rs-preset-googlefont" );
jQuery('#add_new_google_font').click(function(){
var content = googlef_template_container({'value':''});
jQuery('#rs-google-fonts').append(content);
});
jQuery('body').on('click', '.rs-google-remove-field', function(){
jQuery(this).parent().remove();
});
<?php
$google_font = RevSliderFunctions::getVal($arrFieldsParams, 'google_font', array());
if (!empty($google_font) && is_array($google_font)) {
foreach ($google_font as $gfont) {
?>
jQuery('#rs-google-fonts').append(googlef_template_container({'value':'<?php
echo esc_attr($gfont);
?>
'}));
<?php
}
}
?>
/*
var data = {};
data['value'] = key;
示例9: foreach
foreach ($arrSlideLinkLayers as $link_handle => $link_name) {
$sel = $link_handle == $slide_link ? ' selected="selected"' : '';
echo '<option value="' . $link_handle . '"' . $sel . '>' . $link_name . '</option>';
}
}
?>
</select>
<span class="description"><?php
_e('Call Slide Action', 'revslider');
?>
</span>
</p>
<!-- Link POSITION -->
<p>
<?php
$link_pos = RevSliderFunctions::getVal($slideParams, 'link_pos', 'front');
?>
<label><?php
_e("Link Sensibility:", 'revslider');
?>
</label>
<span style="display:inline-block; width:200px; margin-right:20px;">
<input type="radio" id="link_pos_1" value="front" name="link_pos"<?php
checked($link_pos, 'front');
?>
><span style="line-height:30px; vertical-align: middle; margin:0px 20px 0px 10px;"><?php
_e('Front', 'revslider');
?>
</span>
<input type="radio" id="link_pos_2" value="back" name="link_pos"<?php
checked($link_pos, 'back');
示例10: outputImage
/**
* show Image to client
* @since: 5.0
* @moved from image_view.class.php
*/
private static function outputImage($filepath)
{
$info = RevSliderFunctions::getPathInfo($filepath);
$ext = $info["extension"];
$ext = strtolower($ext);
if ($ext == "jpg") {
$ext = "jpeg";
}
$numExpires = 31536000;
//one year
$strExpires = @date('D, d M Y H:i:s', time() + $numExpires);
$contents = file_get_contents($filepath);
$filesize = strlen($contents);
header("Expires: {$strExpires} GMT");
header("Cache-Control: public");
header("Content-Type: image/{$ext}");
header("Content-Length: {$filesize}");
echo $contents;
exit;
}
示例11: stripslashes
$order = $index + 1;
}
$urlImageForView = $slide->getUrlImageThumb();
$slideTitle = $slide->getParam("title", "Slide");
$title = $slideTitle;
$filename = $slide->getImageFilename();
$imageAlt = stripslashes($slideTitle);
if (empty($imageAlt)) {
$imageAlt = "slide";
}
if ($bgType == "image" && !empty($filename)) {
$title .= " (" . $filename . ")";
}
$postID = $slide->getID();
$urlEditSlide = RevSliderFunctionsWP::getUrlEditPost($postID);
$linkEdit = RevSliderFunctions::getHtmlLink($urlEditSlide, $title, "", "", true);
$state = $slide->getParam("state", "published");
?>
<li id="slidelist_item_<?php
echo $postID;
?>
" class="ui-state-default">
<span class="slide-col col-order">
<span class="order-text"><?php
echo $order;
?>
</span>
<div class="state_loader" style="display:none;"></div>
<?php
if ($state == "published") {
示例12: getWPQuery
/**
*
* get meta query
*/
public static function getWPQuery($filterType, $sortBy)
{
$response = array();
$dayMs = 60 * 60 * 24;
$time = current_time('timestamp');
$todayStart = strtotime(date('Y-m-d', $time));
$todayEnd = $todayStart + $dayMs - 1;
$tomorrowStart = $todayEnd + 1;
$tomorrowEnd = $tomorrowStart + $dayMs - 1;
$start_month = strtotime(date('Y-m-1', $time));
$end_month = strtotime(date('Y-m-t', $time)) + 86399;
$next_month_middle = strtotime('+1 month', $time);
//get the end of this month + 1 day
$start_next_month = strtotime(date('Y-m-1', $next_month_middle));
$end_next_month = strtotime(date('Y-m-t', $next_month_middle)) + 86399;
$query = array();
switch ($filterType) {
case self::DEFAULT_FILTER:
//none
break;
case "today":
$query[] = array('key' => '_start_ts', 'value' => $todayEnd, 'compare' => '<=');
$query[] = array('key' => '_end_ts', 'value' => $todayStart, 'compare' => '>=');
break;
case "future":
$query[] = array('key' => '_start_ts', 'value' => $time, 'compare' => '>');
break;
case "tomorrow":
$query[] = array('key' => '_start_ts', 'value' => $tomorrowEnd, 'compare' => '<=');
$query[] = array('key' => '_end_ts', 'value' => $todayStart, 'compare' => '>=');
break;
case "past":
$query[] = array('key' => '_end_ts', 'value' => $todayStart, 'compare' => '<');
break;
case "month":
$query[] = array('key' => '_start_ts', 'value' => $end_month, 'compare' => '<=');
$query[] = array('key' => '_end_ts', 'value' => $start_month, 'compare' => '>=');
break;
case "nextmonth":
$query[] = array('key' => '_start_ts', 'value' => $end_next_month, 'compare' => '<=');
$query[] = array('key' => '_end_ts', 'value' => $start_next_month, 'compare' => '>=');
break;
default:
RevSliderFunctions::throwError("Wrong event filter");
break;
}
if (!empty($query)) {
$response["meta_query"] = $query;
}
//convert sortby
switch ($sortBy) {
case "event_start_date":
$response["orderby"] = "meta_value_num";
$response["meta_key"] = "_start_ts";
break;
case "event_end_date":
$response["orderby"] = "meta_value_num";
$response["meta_key"] = "_end_ts";
break;
}
return $response;
}
示例13: parseDbArrayToCss
public static function parseDbArrayToCss($cssArray, $nl = "\n\r")
{
$css = '';
$deformations = self::get_deformation_css_tags();
$transparency = array('color' => 'color-transparency', 'background-color' => 'background-transparency', 'border-color' => 'border-transparency');
foreach ($cssArray as $id => $attr) {
$stripped = '';
if (strpos($attr['handle'], '.tp-caption') !== false) {
$stripped = trim(str_replace('.tp-caption', '', $attr['handle']));
}
$attr['advanced'] = json_decode($attr['advanced'], true);
$styles = json_decode(str_replace("'", '"', $attr['params']), true);
$styles_adv = $attr['advanced']['idle'];
$css .= $attr['handle'];
if (!empty($stripped)) {
$css .= ', ' . $stripped;
}
$css .= " {" . $nl;
if (is_array($styles) || is_array($styles_adv)) {
if (is_array($styles)) {
foreach ($styles as $name => $style) {
if (in_array($name, $deformations)) {
continue;
}
if (!is_array($name) && isset($transparency[$name])) {
//the style can have transparency!
if (isset($styles[$transparency[$name]]) && $style !== 'transparent') {
$style = RevSliderFunctions::hex2rgba($style, $styles[$transparency[$name]] * 100);
}
}
if (is_array($style)) {
$style = implode(' ', $style);
}
$css .= $name . ':' . $style . ";" . $nl;
}
}
if (is_array($styles_adv)) {
foreach ($styles_adv as $name => $style) {
if (in_array($name, $deformations)) {
continue;
}
if (is_array($style)) {
$style = implode(' ', $style);
}
$css .= $name . ':' . $style . ";" . $nl;
}
}
}
$css .= "}" . $nl . $nl;
//add hover
$setting = json_decode($attr['settings'], true);
if (@$setting['hover'] == 'true') {
$hover = json_decode(str_replace("'", '"', $attr['hover']), true);
$hover_adv = $attr['advanced']['hover'];
if (is_array($hover) || is_array($hover_adv)) {
$css .= $attr['handle'] . ":hover";
if (!empty($stripped)) {
$css .= ', ' . $stripped . ':hover';
}
$css .= " {" . $nl;
if (is_array($hover)) {
foreach ($hover as $name => $style) {
if (in_array($name, $deformations)) {
continue;
}
if (!is_array($name) && isset($transparency[$name])) {
//the style can have transparency!
if (isset($hover[$transparency[$name]]) && $style !== 'transparent') {
$style = RevSliderFunctions::hex2rgba($style, $hover[$transparency[$name]] * 100);
}
}
if (is_array($style)) {
$style = implode(' ', $style);
}
$css .= $name . ':' . $style . ";" . $nl;
}
}
if (is_array($hover_adv)) {
foreach ($hover_adv as $name => $style) {
if (in_array($name, $deformations)) {
continue;
}
if (is_array($style)) {
$style = implode(' ', $style);
}
$css .= $name . ':' . $style . ";" . $nl;
}
}
$css .= "}" . $nl . $nl;
}
}
}
return $css;
}
示例14: resetSlideSettings
public function resetSlideSettings($data)
{
$sliderID = RevSliderFunctions::getVal($data, "sliderid");
$this->initByID($sliderID);
$arrSildes = $this->getSlides();
foreach ($arrSildes as $slide) {
$slide->reset_slide_values($data);
}
}
示例15: get_slider_speed
/**
* view the estimated speed of the Slider
* @since: 5.0
*/
public static function get_slider_speed($sliderID)
{
//$data = wp_get_attachment_metadata($cur_img_id);
ob_start();
$total_size = 0;
$do_ssl = is_ssl() ? 'http:' : 'https:';
$slider = new RevSliderSlider();
$slider->initByID($sliderID);
$slides = $slider->getSlidesForExport();
$static_slides = $slider->getStaticSlideForExport();
if (!empty($static_slides) && is_array($static_slides)) {
foreach ($static_slides as $s_slide) {
$slides[] = $s_slide;
}
}
$used_images = array();
$used_videos = array();
$used_captions = array();
$using_kenburns = false;
$using_parallax = false;
$using_carousel = false;
$using_navigation = false;
$using_videos = false;
$using_actions = false;
$using_layeranim = false;
$img_size = 0;
$video_size = 0;
$slide_counter = 0;
$firstslide_size = 0;
$smartslide_size = 0;
if ($slider->getParam("use_parallax", "off") == 'on') {
$using_parallax = true;
}
if ($slider->getParam("slider-type", "standard") == 'carousel') {
$using_carousel = true;
}
$enable_arrows = $slider->getParam('enable_arrows', 'off');
$enable_bullets = $slider->getParam('enable_bullets', 'off');
$enable_tabs = $slider->getParam('enable_tabs', 'off');
$enable_thumbnails = $slider->getParam('enable_thumbnails', 'off');
if ($enable_arrows == 'on' || $enable_bullets == 'on' || $enable_tabs == 'on' || $enable_thumbnails == 'on') {
$using_navigation = true;
}
if (!empty($slides) && count($slides) > 0) {
foreach ($slides as $key => $slide) {
if (isset($slide['params']['state']) && $slide['params']['state'] != 'published') {
continue;
}
if (!isset($slide['id'])) {
continue;
}
$slide_counter++;
$slide_id = $slide['id'];
if (isset($slide['params']['kenburn_effect']) && $slide['params']['kenburn_effect'] == 'on') {
$using_kenburns = true;
}
if (!isset($slide['params']['image_source_type'])) {
$slide['params']['image_source_type'] = 'full';
}
if (isset($slide['params']['image']) && $slide['params']['image'] != '') {
//add infos of image to an array
$infos = array();
$urlImage = false;
switch ($slide['params']['background_type']) {
case 'streamyoutube':
case 'streaminstagram':
case 'streamvimeo':
case 'youtube':
case 'vimeo':
$using_videos = true;
break;
}
if (isset($slide['params']['image_id'])) {
$cur_img_id = $slide['params']['image_id'];
//get image sizes by ID
$urlImage = wp_get_attachment_image_src($slide['params']['image_id'], $slide['params']['image_source_type']);
}
if ($urlImage === false) {
$cur_img_id = RevSliderFunctionsWP::get_image_id_by_url($slide['params']['image']);
if ($cur_img_id !== false) {
$urlImage = wp_get_attachment_image_src($cur_img_id, $slide['params']['image_source_type']);
}
}
if ($urlImage !== false) {
$infos['id'] = $cur_img_id;
$file = get_attached_file($cur_img_id);
$infos['info'] = pathinfo($file);
if (file_exists($file)) {
$infos['size'] = filesize($file);
$infos['size-format'] = size_format($infos['size'], 2);
$img_size += $infos['size'];
if ($slide_counter == 1) {
$firstslide_size += $infos['size'];
}
if ($slide_counter == 1 || $slide_counter == 2 || $slide_counter == count($slides)) {
$smartslide_size += $infos['size'];
//.........这里部分代码省略.........