本文整理汇总了PHP中RevSliderFunctionsWP类的典型用法代码示例。如果您正苦于以下问题:PHP RevSliderFunctionsWP类的具体用法?PHP RevSliderFunctionsWP怎么用?PHP RevSliderFunctionsWP使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RevSliderFunctionsWP类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: rev_slider_shortcode
function rev_slider_shortcode($args, $mid_content = null)
{
extract(shortcode_atts(array('alias' => ''), $args, 'rev_slider'));
$sliderAlias = $alias != '' ? $alias : RevSliderFunctions::getVal($args, 0);
$gal_ids = RevSliderFunctionsWP::check_for_shortcodes($mid_content);
//check for example on gallery shortcode and do stuff
ob_start();
if (!empty($gal_ids)) {
//add a gallery based slider
$slider = RevSliderOutput::putSlider($sliderAlias, '', $gal_ids);
} else {
$slider = RevSliderOutput::putSlider($sliderAlias);
}
$content = ob_get_contents();
ob_clean();
ob_end_clean();
// Do not output Slider if we are on mobile
$disable_on_mobile = $slider->getParam("disable_on_mobile", "off");
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'], 'iPad') || strstr($_SERVER['HTTP_USER_AGENT'], 'Windows Phone') || wp_is_mobile() ? true : false;
if ($mobile) {
return false;
}
}
$show_alternate = $slider->getParam("show_alternative_type", "off");
if ($show_alternate == 'mobile' || $show_alternate == 'mobile-ie8') {
if (wp_is_mobile()) {
$show_alternate_image = $slider->getParam("show_alternate_image", "");
return '<img class="tp-slider-alternative-image" src="' . $show_alternate_image . '" data-no-retina>';
}
}
//handle slider output types
if (!empty($slider)) {
$outputType = $slider->getParam("output_type", "");
switch ($outputType) {
case "compress":
$content = str_replace("\n", "", $content);
$content = str_replace("\r", "", $content);
return $content;
break;
case "echo":
echo $content;
//bypass the filters
break;
default:
return $content;
break;
}
} else {
return $content;
}
//normal output
}
示例2: _e
_e('Import', 'revslider');
?>
</li>
<li data-content="#import-export" class=""><?php
_e('Export', 'revslider');
?>
</li>
<li data-content="#import-replace" class=""><?php
_e('Replace URL', 'revslider');
?>
</li>
</ul>
<div id="import-import">
<?php
if (!RevSliderFunctionsWP::isAdminUser() && apply_filters('revslider_restrict_role', true)) {
_e('Import only available for Administrators', 'revslider');
} else {
?>
<form name="import_slider_form" id="rs_import_slider_form" action="<?php
echo RevSliderBase::$url_ajax;
?>
" enctype="multipart/form-data" method="post">
<input type="hidden" name="action" value="revslider_ajax_action">
<input type="hidden" name="client_action" value="import_slider">
<input type="hidden" name="sliderid" value="<?php
echo $sliderID;
?>
">
<input type="hidden" name="nonce" value="<?php
echo wp_create_nonce("revslider_actions");
示例3: getImageRealPathFromUrl
/**
* get image real path physical on disk from url
*/
public static function getImageRealPathFromUrl($urlImage)
{
$filepath = self::getImagePathFromURL($urlImage);
$realPath = RevSliderFunctionsWP::getPathUploads() . $filepath;
return $realPath;
}
示例4: putSliderBase
/**
*
* put html slider on the html page.
* @param $data - mixed, can be ID ot Alias.
*/
public function putSliderBase($sliderID, $gal_ids = array(), $markup_export = false, $settings = array(), $order = array())
{
$this->markup_export = $markup_export;
try {
$slver = apply_filters('revslider_remove_version', RevSliderGlobals::SLIDER_REVISION);
self::$sliderSerial++;
$this->slider = new RevSlider();
if ($sliderID !== '-99') {
$this->slider->initByMixed($sliderID);
} else {
//do default
$this->slider->initByMixed($sliderID);
}
//modify settings if there are any special settings given through the shortcode
if (!empty($settings)) {
$this->modify_settings($settings);
}
//modify settings for admin preview mode
if ($this->previewMode == true) {
$this->modifyPreviewModeSettings();
}
//set slider language
$isWpmlExists = RevSliderWpml::isWpmlExists();
$useWpml = $this->slider->getParam("use_wpml", "off");
if ($isWpmlExists && $useWpml == "on") {
if ($this->previewMode == false) {
$this->sliderLang = RevSliderFunctionsWP::getCurrentLangCode();
}
}
//edit html before slider
$htmlBeforeSlider = "";
if ($markup_export === true) {
$htmlBeforeSlider .= '<!-- FONT -->';
}
if ($this->slider->getParam("load_googlefont", "false") == "true") {
$googleFont = $this->slider->getParam("google_font");
if (is_array($googleFont)) {
foreach ($googleFont as $key => $font) {
}
} else {
$htmlBeforeSlider .= RevSliderOperations::getCleanFontImport($googleFont);
}
}
$gfonts = $this->slider->getParam("google_font", array());
if (!empty($gfonts) && is_array($gfonts)) {
foreach ($gfonts as $gf) {
$gf = str_replace(array('"', '+'), array('', ' '), $gf);
$htmlBeforeSlider .= RevSliderOperations::getCleanFontImport($gf);
}
}
//add all google fonts of layers
$gfsubsets = $this->slider->getParam("subsets", array());
$gf = $this->slider->getUsedFonts(false);
foreach ($gf as $gfk => $gfv) {
$tcf = $gfk . ':';
if (!empty($gfv['variants'])) {
$mgfirst = true;
foreach ($gfv['variants'] as $mgvk => $mgvv) {
if (!$mgfirst) {
$tcf .= ',';
}
$tcf .= $mgvk;
$mgfirst = false;
}
}
if (!empty($gfv['subsets'])) {
$mgfirst = true;
foreach ($gfv['subsets'] as $ssk => $ssv) {
if (array_search(esc_attr($gfk . '+' . $ssv), $gfsubsets) !== false) {
if ($mgfirst) {
$tcf .= '&subset=';
}
if (!$mgfirst) {
$tcf .= ',';
}
$tcf .= $ssv;
$mgfirst = false;
}
}
}
$htmlBeforeSlider .= RevSliderOperations::getCleanFontImport($tcf);
}
if ($markup_export === true) {
$htmlBeforeSlider .= '<!-- /FONT -->';
}
//pub js to body handle
if ($this->slider->getParam("js_to_body", "false") == "true") {
$operations = new RevSliderOperations();
$arrValues = $operations->getGeneralSettingsValues();
$enable_logs = RevSliderFunctions::getVal($arrValues, "enable_logs", 'off');
if ($markup_export === true) {
$htmlBeforeSlider .= '<!-- SCRIPTINCLUDE -->';
}
if ($enable_logs == 'on') {
$urlIncludeJS = RS_PLUGIN_URL . 'public/assets/js/jquery.themepunch.enablelog.js?rev=' . $slver;
//.........这里部分代码省略.........
示例5: get_image_attributes
public function get_image_attributes($slider_type)
{
$params = $this->params;
$bgType = RevSliderBase::getVar($params, "background_type", "transparent");
$bgColor = RevSliderBase::getVar($params, "slide_bg_color", "transparent");
$bgFit = RevSliderBase::getVar($params, "bg_fit", "cover");
$bgFitX = intval(RevSliderBase::getVar($params, "bg_fit_x", "100"));
$bgFitY = intval(RevSliderBase::getVar($params, "bg_fit_y", "100"));
$bgPosition = RevSliderBase::getVar($params, "bg_position", "center top");
$bgPositionX = intval(RevSliderBase::getVar($params, "bg_position_x", "0"));
$bgPositionY = intval(RevSliderBase::getVar($params, "bg_position_y", "0"));
$bgRepeat = RevSliderBase::getVar($params, "bg_repeat", "no-repeat");
$bgStyle = ' ';
if ($bgFit == 'percentage') {
$bgStyle .= "background-size: " . $bgFitX . '% ' . $bgFitY . '%;';
} else {
$bgStyle .= "background-size: " . $bgFit . ";";
}
if ($bgPosition == 'percentage') {
$bgStyle .= "background-position: " . $bgPositionX . '% ' . $bgPositionY . '%;';
} else {
$bgStyle .= "background-position: " . $bgPosition . ";";
}
$bgStyle .= "background-repeat: " . $bgRepeat . ";";
$thumb = '';
switch ($slider_type) {
case 'gallery':
$imageID = RevSliderBase::getVar($params, "image_id");
if (empty($imageID)) {
$thumb = RevSliderBase::getVar($params, "image");
$imgID = RevSliderBase::get_image_id_by_url($thumb);
if ($imgID !== false) {
$thumb = RevSliderFunctionsWP::getUrlAttachmentImage($imgID, RevSliderFunctionsWP::THUMB_MEDIUM);
}
} else {
$thumb = RevSliderFunctionsWP::getUrlAttachmentImage($imageID, RevSliderFunctionsWP::THUMB_MEDIUM);
}
break;
case 'posts':
$thumb = RS_PLUGIN_URL . 'public/assets/assets/sources/post.png';
$bgStyle = 'background-size: cover;';
break;
case 'facebook':
$thumb = RS_PLUGIN_URL . 'public/assets/assets/sources/fb.png';
$bgStyle = 'background-size: cover;';
break;
case 'twitter':
$thumb = RS_PLUGIN_URL . 'public/assets/assets/sources/tw.png';
$bgStyle = 'background-size: cover;';
break;
case 'instagram':
$thumb = RS_PLUGIN_URL . 'public/assets/assets/sources/ig.png';
$bgStyle = 'background-size: cover;';
break;
case 'flickr':
$thumb = RS_PLUGIN_URL . 'public/assets/assets/sources/fr.png';
$bgStyle = 'background-size: cover;';
break;
case 'youtube':
$thumb = RS_PLUGIN_URL . 'public/assets/assets/sources/yt.png';
$bgStyle = 'background-size: cover;';
break;
case 'vimeo':
$thumb = RS_PLUGIN_URL . 'public/assets/assets/sources/vm.png';
$bgStyle = 'background-size: cover;';
break;
}
if ($thumb == '') {
$thumb = RevSliderBase::getVar($params, "image");
}
$bg_fullstyle = '';
$bg_extraClass = '';
$data_urlImageForView = '';
//if($bgType=="image" || $bgType=="streamvimeo" || $bgType=="streamyoutube" || $bgType=="streaminstagram" || $bgType=="html5") {
$data_urlImageForView = $thumb;
$bg_fullstyle = $bgStyle;
//}
if ($bgType == "solid") {
$bg_fullstyle = 'background-color:' . $bgColor . ';';
}
if ($bgType == "trans" || $bgType == "transparent") {
$bg_extraClass = 'mini-transparent';
}
return array('url' => $data_urlImageForView, 'class' => $bg_extraClass, 'style' => $bg_fullstyle);
}
示例6: getCurrentLang
/**
*
* get current language
*/
public static function getCurrentLang()
{
self::validateWpmlExists();
$wpml = new SitePress();
if (is_admin()) {
$lang = $wpml->get_default_language();
} else {
$lang = RevSliderFunctionsWP::getCurrentLangCode();
}
return $lang;
}
示例7: check_file_in_zip
/**
* check if file is in zip
* @since: 5.0
*/
public static function check_file_in_zip($zip, $image, $filepath, $alias, &$alreadyImported, $add_path = false)
{
if (trim($image) !== '') {
if (strpos($image, 'http') !== false) {
} else {
$zimage = $zip->getStream('images/' . $image);
if (!$zimage) {
echo $image . __(' not found!<br>', REVSLIDER_TEXTDOMAIN);
} else {
if (!isset($alreadyImported['zip://' . $filepath . "#" . 'images/' . $image])) {
$importImage = RevSliderFunctionsWP::import_media('zip://' . $filepath . "#" . 'images/' . $image, $alias . '/');
if ($importImage !== false) {
$alreadyImported['zip://' . $filepath . "#" . 'images/' . $image] = $importImage['path'];
$image = $importImage['path'];
}
} else {
$image = $alreadyImported['zip://' . $filepath . "#" . 'images/' . $image];
}
}
if ($add_path) {
$upload_dir = wp_upload_dir();
$cont_url = $upload_dir['baseurl'];
$image = str_replace('uploads/uploads/', 'uploads/', $cont_url . '/' . $image);
}
}
}
return $image;
}
示例8: createTable
/**
* create tables
*/
public static function createTable($tableName)
{
global $wpdb;
$parseCssToDb = false;
$checkForTablesOneTime = get_option('revslider_checktables', '0');
if ($checkForTablesOneTime == '0') {
update_option('revslider_checktables', '1');
if (RevSliderFunctionsWP::isDBTableExists(self::$table_prefix . RevSliderGlobals::TABLE_CSS_NAME)) {
//$wpdb->tables( 'global' )
//check if database is empty
$result = $wpdb->get_row("SELECT COUNT( DISTINCT id ) AS NumberOfEntrys FROM " . self::$table_prefix . RevSliderGlobals::TABLE_CSS_NAME);
if ($result->NumberOfEntrys == 0) {
$parseCssToDb = true;
}
}
}
if ($parseCssToDb) {
$RevSliderOperations = new RevSliderOperations();
$RevSliderOperations->importCaptionsCssContentArray();
$RevSliderOperations->moveOldCaptionsCss();
}
//if table exists - don't create it.
$tableRealName = self::$table_prefix . $tableName;
if (RevSliderFunctionsWP::isDBTableExists($tableRealName)) {
return false;
}
switch ($tableName) {
case RevSliderGlobals::TABLE_SLIDERS_NAME:
$sql = "CREATE TABLE " . self::$table_prefix . $tableName . " (\r\r\n\t\t\t\t\t\t id int(9) NOT NULL AUTO_INCREMENT,\r\r\n\t\t\t\t\t\t title tinytext NOT NULL,\r\r\n\t\t\t\t\t\t alias tinytext,\r\r\n\t\t\t\t\t\t params MEDIUMTEXT NOT NULL,\r\r\n\t\t\t\t\t\t UNIQUE KEY id (id)\r\r\n\t\t\t\t\t\t);";
break;
case RevSliderGlobals::TABLE_SLIDES_NAME:
$sql = "CREATE TABLE " . self::$table_prefix . $tableName . " (\r\r\n\t\t\t\t\t\t\t id int(9) NOT NULL AUTO_INCREMENT,\r\r\n\t\t\t\t\t\t\t slider_id int(9) NOT NULL,\r\r\n\t\t\t\t\t\t\t slide_order int not NULL,\r\r\n\t\t\t\t\t\t\t params MEDIUMTEXT NOT NULL,\r\r\n\t\t\t\t\t\t\t layers MEDIUMTEXT NOT NULL,\r\r\n\t\t\t\t\t\t\t UNIQUE KEY id (id)\r\r\n\t\t\t\t\t\t\t);";
break;
case RevSliderGlobals::TABLE_STATIC_SLIDES_NAME:
$sql = "CREATE TABLE " . self::$table_prefix . $tableName . " (\r\r\n\t\t\t\t\t\t\t id int(9) NOT NULL AUTO_INCREMENT,\r\r\n\t\t\t\t\t\t\t slider_id int(9) NOT NULL,\r\r\n\t\t\t\t\t\t\t params MEDIUMTEXT NOT NULL,\r\r\n\t\t\t\t\t\t\t layers MEDIUMTEXT NOT NULL,\r\r\n\t\t\t\t\t\t\t UNIQUE KEY id (id)\r\r\n\t\t\t\t\t\t\t);";
break;
case RevSliderGlobals::TABLE_CSS_NAME:
$sql = "CREATE TABLE " . self::$table_prefix . $tableName . " (\r\r\n\t\t\t\t\t\t\t id int(9) NOT NULL AUTO_INCREMENT,\r\r\n\t\t\t\t\t\t\t handle TEXT NOT NULL,\r\r\n\t\t\t\t\t\t\t settings MEDIUMTEXT,\r\r\n\t\t\t\t\t\t\t hover MEDIUMTEXT,\r\r\n\t\t\t\t\t\t\t params MEDIUMTEXT NOT NULL,\r\r\n\t\t\t\t\t\t\t UNIQUE KEY id (id)\r\r\n\t\t\t\t\t\t\t);";
$parseCssToDb = true;
break;
case RevSliderGlobals::TABLE_LAYER_ANIMS_NAME:
$sql = "CREATE TABLE " . self::$table_prefix . $tableName . " (\r\r\n\t\t\t\t\t\t\t id int(9) NOT NULL AUTO_INCREMENT,\r\r\n\t\t\t\t\t\t\t handle TEXT NOT NULL,\r\r\n\t\t\t\t\t\t\t params TEXT NOT NULL,\r\r\n\t\t\t\t\t\t\t UNIQUE KEY id (id)\r\r\n\t\t\t\t\t\t\t);";
break;
case RevSliderGlobals::TABLE_NAVIGATION_NAME:
$sql = "CREATE TABLE " . self::$table_prefix . $tableName . " (\r\r\n\t\t\t\t\t\t\t id int(9) NOT NULL AUTO_INCREMENT,\r\r\n\t\t\t\t\t\t\t name VARCHAR(191) NOT NULL,\r\r\n\t\t\t\t\t\t\t handle VARCHAR(191) NOT NULL,\r\r\n\t\t\t\t\t\t\t css MEDIUMTEXT NOT NULL,\r\r\n\t\t\t\t\t\t\t markup MEDIUMTEXT NOT NULL,\r\r\n\t\t\t\t\t\t\t settings MEDIUMTEXT NULL,\r\r\n\t\t\t\t\t\t\t UNIQUE KEY id (id)\r\r\n\t\t\t\t\t\t\t);";
break;
default:
RevSliderFunctions::throwError("table: {$tableName} not found");
break;
}
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
dbDelta($sql);
if ($parseCssToDb) {
$RevSliderOperations = new RevSliderOperations();
$RevSliderOperations->importCaptionsCssContentArray();
$RevSliderOperations->moveOldCaptionsCss();
}
}
示例9: write_template_markup
/**
* output markup for template
* @since: 5.0
*/
public function write_template_markup($template, $slider_id = false)
{
$params = $template['params'];
$settings = $template['settings'];
$slide_id = $template['id'];
$title = str_replace("'", "", RevSliderBase::getVar($params, 'title', 'Slide'));
if ($slider_id !== false) {
$title = '';
}
//remove Title if Slider
$width = RevSliderBase::getVar($settings, "width", 1240);
$height = RevSliderBase::getVar($settings, "height", 868);
$bgType = RevSliderBase::getVar($params, "background_type", "transparent");
$bgColor = RevSliderBase::getVar($params, "slide_bg_color", "transparent");
$bgFit = RevSliderBase::getVar($params, "bg_fit", "cover");
$bgFitX = intval(RevSliderBase::getVar($params, "bg_fit_x", "100"));
$bgFitY = intval(RevSliderBase::getVar($params, "bg_fit_y", "100"));
$bgPosition = RevSliderBase::getVar($params, "bg_position", "center center");
$bgPositionX = intval(RevSliderBase::getVar($params, "bg_position_x", "0"));
$bgPositionY = intval(RevSliderBase::getVar($params, "bg_position_y", "0"));
$bgRepeat = RevSliderBase::getVar($params, "bg_repeat", "no-repeat");
$bgStyle = ' ';
if ($bgFit == 'percentage') {
if (intval($bgFitY) == 0 || intval($bgFitX) == 0) {
$bgStyle .= "background-size: cover;";
} else {
$bgStyle .= "background-size: " . $bgFitX . '% ' . $bgFitY . '%;';
}
} else {
$bgStyle .= "background-size: " . $bgFit . ";";
}
if ($bgPosition == 'percentage') {
$bgStyle .= "background-position: " . $bgPositionX . '% ' . $bgPositionY . '%;';
} else {
$bgStyle .= "background-position: " . $bgPosition . ";";
}
$bgStyle .= "background-repeat: " . $bgRepeat . ";";
if (isset($template['img'])) {
$thumb = $template['img'];
} else {
$imageID = RevSliderBase::getVar($params, "image_id");
if (empty($imageID)) {
$thumb = RevSliderBase::getVar($params, "image");
$imgID = RevSliderBase::get_image_id_by_url($thumb);
if ($imgID !== false) {
$thumb = RevSliderFunctionsWP::getUrlAttachmentImage($imgID, RevSliderFunctionsWP::THUMB_MEDIUM);
}
} else {
$thumb = RevSliderFunctionsWP::getUrlAttachmentImage($imageID, RevSliderFunctionsWP::THUMB_MEDIUM);
}
if ($thumb == '') {
$thumb = RevSliderBase::getVar($params, "image");
}
}
$bg_fullstyle = '';
$bg_extraClass = '';
$data_urlImageForView = '';
if ($bgType == 'image' || $bgType == 'vimeo' || $bgType == 'youtube' || $bgType == 'html5') {
$data_urlImageForView = 'data-src="' . $thumb . '"';
$bg_fullstyle = ' style="' . $bgStyle . '" ';
}
if ($bgType == "solid") {
$bg_fullstyle = ' style="background-color:' . $bgColor . ';" ';
}
if ($bgType == "trans" || $bgType == "transparent") {
$bg_extraClass = 'mini-transparent';
}
?>
<div <?php
echo $data_urlImageForView;
?>
class="<?php
echo $slider_id !== false ? 'template_slider_item' : 'template_item';
?>
<?php
echo $bg_extraClass;
?>
" <?php
echo $bg_fullstyle;
?>
data-gridwidth="<?php
echo $width;
?>
"
data-gridheight="<?php
echo $height;
?>
"
<?php
if ($slider_id !== false) {
?>
data-sliderid="<?php
echo $slider_id;
?>
"
<?php
//.........这里部分代码省略.........
示例10: stripslashes
} else {
$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
示例11: getPostsFromSpecificList
/**
*
* get posts from specific posts list
*/
private function getPostsFromSpecificList()
{
$strPosts = $this->getParam("posts_list", "");
$strPosts = apply_filters('revslider_set_posts_list', $strPosts);
$slider_id = $this->getID();
$arrPosts = RevSliderFunctionsWP::getPostsByIDs($strPosts, $slider_id);
return $arrPosts;
}
示例12: check_file_in_zip
/**
* check if file is in zip
* @since: 5.0
*/
public static function check_file_in_zip($d_path, $image, $alias, &$alreadyImported, $add_path = false)
{
global $wp_filesystem;
if (trim($image) !== '') {
if (strpos($image, 'http') !== false) {
} else {
$strip = false;
$zimage = $wp_filesystem->exists($d_path . 'images/' . $image);
if (!$zimage) {
$zimage = $wp_filesystem->exists(str_replace('//', '/', $d_path . 'images/' . $image));
$strip = true;
}
if (!$zimage) {
echo $image . __(' not found!<br>', 'revslider');
} else {
if (!isset($alreadyImported['images/' . $image])) {
if ($strip == true) {
//pclzip
$importImage = RevSliderFunctionsWP::import_media($d_path . str_replace('//', '/', 'images/' . $image), $alias . '/');
} else {
$importImage = RevSliderFunctionsWP::import_media($d_path . 'images/' . $image, $alias . '/');
}
if ($importImage !== false) {
$alreadyImported['images/' . $image] = $importImage['path'];
$image = $importImage['path'];
}
} else {
$image = $alreadyImported['images/' . $image];
}
}
if ($add_path) {
$upload_dir = wp_upload_dir();
$cont_url = $upload_dir['baseurl'];
$image = str_replace('uploads/uploads/', 'uploads/', $cont_url . '/' . $image);
}
}
}
return $image;
}
示例13: getPostsFromSpecificList
/**
*
* get posts from specific posts list
*/
private function getPostsFromSpecificList($gal_ids = array())
{
$is_gal = false;
$additional = array();
if (!empty($gal_ids) && $gal_ids[0]) {
$strPosts = $gal_ids;
$strPosts = apply_filters('revslider_set_posts_list_gal', $strPosts, $this->getID());
$is_gal = true;
} else {
if (isset($gal_ids[0])) {
unset($gal_ids[0]);
$strPosts = implode(",", $gal_ids);
$additional['order'] = "none";
$additional['orderby'] = "post__in";
} else {
$strPosts = $this->getParam("posts_list", "");
$additional['order'] = $this->getParam("posts_sort_direction", "DESC");
$additional['orderby'] = $this->getParam("post_sortby", "");
}
$strPosts = apply_filters('revslider_set_posts_list', $strPosts, $this->getID());
}
$slider_id = $this->getID();
$arrPosts = RevSliderFunctionsWP::getPostsByIDs($strPosts, $slider_id, $is_gal, $additional);
return $arrPosts;
}
示例14: 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'];
//.........这里部分代码省略.........
示例15: write_template_markup
/**
* output markup for template
* @since: 5.0
*/
public function write_template_markup($template, $slider_id = false)
{
$params = $template['params'];
$settings = $template['settings'];
$slide_id = $template['id'];
if ($slider_id !== false) {
$title = '';
}
//remove Title if Slider
$width = RevSliderBase::getVar($settings, "width", 1240);
$height = RevSliderBase::getVar($settings, "height", 868);
$bgType = RevSliderBase::getVar($params, "background_type", "transparent");
$bgColor = RevSliderBase::getVar($params, "slide_bg_color", "transparent");
$bgFit = RevSliderBase::getVar($params, "bg_fit", "cover");
$bgFitX = intval(RevSliderBase::getVar($params, "bg_fit_x", "100"));
$bgFitY = intval(RevSliderBase::getVar($params, "bg_fit_y", "100"));
$bgPosition = RevSliderBase::getVar($params, "bg_position", "center center");
$bgPositionX = intval(RevSliderBase::getVar($params, "bg_position_x", "0"));
$bgPositionY = intval(RevSliderBase::getVar($params, "bg_position_y", "0"));
$bgRepeat = RevSliderBase::getVar($params, "bg_repeat", "no-repeat");
$bgStyle = ' ';
if ($bgFit == 'percentage') {
if (intval($bgFitY) == 0 || intval($bgFitX) == 0) {
$bgStyle .= "background-size: cover;";
} else {
$bgStyle .= "background-size: " . $bgFitX . '% ' . $bgFitY . '%;';
}
} else {
$bgStyle .= "background-size: " . $bgFit . ";";
}
if ($bgPosition == 'percentage') {
$bgStyle .= "background-position: " . $bgPositionX . '% ' . $bgPositionY . '%;';
} else {
$bgStyle .= "background-position: " . $bgPosition . ";";
}
$bgStyle .= "background-repeat: " . $bgRepeat . ";";
if (isset($template['img'])) {
$thumb = $this->_check_file_path($template['img'], true);
} else {
$imageID = RevSliderBase::getVar($params, "image_id");
if (empty($imageID)) {
$thumb = RevSliderBase::getVar($params, "image");
$imgID = RevSliderBase::get_image_id_by_url($thumb);
if ($imgID !== false) {
$thumb = RevSliderFunctionsWP::getUrlAttachmentImage($imgID, RevSliderFunctionsWP::THUMB_MEDIUM);
}
} else {
$thumb = RevSliderFunctionsWP::getUrlAttachmentImage($imageID, RevSliderFunctionsWP::THUMB_MEDIUM);
}
if ($thumb == '') {
$thumb = RevSliderBase::getVar($params, "image");
}
}
$bg_fullstyle = '';
$bg_extraClass = '';
$data_urlImageForView = '';
if (isset($template['img'])) {
$data_urlImageForView = 'data-src="' . $thumb . '"';
} else {
if ($bgType == 'image' || $bgType == 'vimeo' || $bgType == 'youtube' || $bgType == 'html5') {
$data_urlImageForView = 'data-src="' . $thumb . '"';
$bg_fullstyle = ' style="' . $bgStyle . '" ';
}
if ($bgType == "solid") {
$bg_fullstyle = ' style="background-color:' . $bgColor . ';" ';
}
if ($bgType == "trans" || $bgType == "transparent") {
$bg_extraClass = 'mini-transparent';
}
}
?>
<div class="template_slide_single_element" style="display:inline-block">
<div <?php
echo $data_urlImageForView;
?>
class="<?php
echo $slider_id !== false ? 'template_slider_item' : 'template_item';
?>
<?php
echo $bg_extraClass;
?>
" <?php
echo $bg_fullstyle;
?>
data-gridwidth="<?php
echo $width;
?>
"
data-gridheight="<?php
echo $height;
?>
"
<?php
if ($slider_id !== false) {
?>
data-sliderid="<?php
//.........这里部分代码省略.........