本文整理汇总了PHP中RevSliderWpml类的典型用法代码示例。如果您正苦于以下问题:PHP RevSliderWpml类的具体用法?PHP RevSliderWpml怎么用?PHP RevSliderWpml使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了RevSliderWpml类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _e
</li>
<li data-content="#general-firstslide" class="dontshowonhero"><?php
_e('1st Slide', REVSLIDER_TEXTDOMAIN);
?>
</li>
<li data-content="#general-misc"><?php
_e('Misc.', REVSLIDER_TEXTDOMAIN);
?>
</li>
</ul>
<!-- GENERAL MISC. -->
<div id="general-misc" style="display:none">
<?php
if (RevSliderWpml::isWpmlExists()) {
?>
<!-- MULTI LANGUANGE -->
<span id="label_use_wpml" class="label" origtitle="<?php
_e("Show multi language controls across the slider. Only available when wpml plugin exists.", REVSLIDER_TEXTDOMAIN);
?>
"><?php
_e("Use Multi Language (WPML)", REVSLIDER_TEXTDOMAIN);
?>
</span>
<input type="checkbox" class="tp-moderncheckbox withlabel" id="use_wpml" name="use_wpml" data-unchecked="off" <?php
checked(RevSliderFunctions::getVal($arrFieldsParams, 'use_wpml', 'off'), "on");
?>
>
<div class="clearfix"></div>
<?php
示例2: addLangFromData
/**
*
* add language (add slide that connected to current slide) from data
*/
private function addLangFromData($data)
{
$sliderID = RevSliderFunctions::getVal($data, "sliderid");
$slideID = RevSliderFunctions::getVal($data, "slideid");
$lang = RevSliderFunctions::getVal($data, "lang");
//duplicate slide
$slider = new RevSlider();
$slider->initByID($sliderID);
$newSlideID = $slider->duplicateSlide($slideID);
//update new slide
$this->initByID($newSlideID);
$arrUpdate = array();
$arrUpdate["lang"] = $lang;
$arrUpdate["parentid"] = $slideID;
$this->updateParamsInDB($arrUpdate);
$urlIcon = RevSliderWpml::getFlagUrl($lang);
$title = RevSliderWpml::getLangTitle($lang);
$newSlide = new RevSlide();
$newSlide->initByID($slideID);
$arrLangCodes = $newSlide->getArrChildLangCodes();
$isAll = RevSliderWpml::isAllLangsInArray($arrLangCodes);
$html = "<li>\r\n\t\t\t\t\t<img id=\"icon_lang_" . $newSlideID . "\" class=\"icon_slide_lang\" src=\"" . $urlIcon . "\" title=\"" . $title . "\" data-slideid=\"" . $newSlideID . "\" data-lang=\"" . $lang . "\">\r\n\t\t\t\t\t<div class=\"icon_lang_loader loader_round\" style=\"display:none\"></div>\t\t\t\t\t\t\t\t\r\n\t\t\t\t</li>";
$response = array();
$response["operation"] = "add";
$response["isAll"] = $isAll;
$response["html"] = $html;
return $response;
}
示例3: previewOutputMarkup
public function previewOutputMarkup($sliderID, $output = null)
{
if ($sliderID == "empty_output") {
$this->loadingMessageOutput();
exit;
}
if ($output == null) {
$output = new RevSliderOutput();
}
$slider = new RevSlider();
$slider->initByID($sliderID);
$isWpmlExists = RevSliderWpml::isWpmlExists();
$useWpml = $slider->getParam("use_wpml", "off");
$wpmlActive = false;
if ($isWpmlExists && $useWpml == "on") {
$wpmlActive = true;
$arrLanguages = RevSliderWpml::getArrLanguages(false);
//set current lang to output
$currentLang = RevSliderFunctions::getPostGetVariable("lang");
if (empty($currentLang)) {
$currentLang = RevSliderWpml::getCurrentLang();
}
if (empty($currentLang)) {
$currentLang = $arrLanguages[0];
}
$output->setLang($currentLang);
$selectLangChoose = RevSliderFunctions::getHTMLSelect($arrLanguages, $currentLang, "id='select_langs'", true);
}
$output->setPreviewMode();
//put the output html
$urlPlugin = "http://yourpluginpath/";
$urlPreviewPattern = RevSliderBase::$url_ajax_actions . "&client_action=preview_slider&only_markup=true&sliderid=" . $sliderID . "&lang=[lang]&nonce=[nonce]";
$nonce = wp_create_nonce("revslider_actions");
$setBase = is_ssl() ? "https://" : "http://";
$http = is_ssl() ? 'https' : 'http';
$operations = new RevSliderOperations();
$arrValues = $operations->getGeneralSettingsValues();
$set_diff_font = RevSliderFunctions::getVal($arrValues, "change_font_loading", '');
if ($set_diff_font !== '') {
$font_url = $set_diff_font;
} else {
$font_url = $http . '://fonts.googleapis.com/css?family=';
}
?>
<html>
<head>
<script type='text/javascript' src='<?php
echo $setBase;
?>
ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js'></script>
</head>
<body style="padding:0px;margin:0px;">
<?php
if ($wpmlActive == true) {
?>
<div style="margin-bottom:10px;text-align:center;">
<?php
_e("Choose language", REVSLIDER_TEXTDOMAIN);
?>
: <?php
echo $selectLangChoose;
?>
</div>
<script type="text/javascript">
var g_previewPattern = '<?php
echo $urlPreviewPattern;
?>
';
jQuery("#select_langs").change(function(){
var lang = this.value;
var nonce = "<?php
echo $nonce;
?>
";
var pattern = g_previewPattern;
var urlPreview = pattern.replace("[lang]",lang).replace("[nonce]",nonce);
location.href = urlPreview;
});
jQuery('body').on('click', '#rev_replace_images', function(){
var from = jQuery('input[name="orig_image_path"]').val();
var to = jQuery('input[name="replace_image_path"]').val();
jQuery('#rev_script_content').val(jQuery('#rev_script_content').val().replace(from, to));
jQuery('#rev_the_content').val(jQuery('#rev_the_content').val().replace(from, to));
jQuery('#rev_style_content').val(jQuery('#rev_style_content').val().replace(from, to));
jQuery('#rev_head_content').val(jQuery('#rev_head_content').val().replace(from, to));
});
</script>
<?php
}
?>
<?php
ob_start();
?>
<link rel='stylesheet' href='<?php
echo $urlPlugin;
?>
//.........这里部分代码省略.........
示例4:
$style_wrapper .= "background-size: " . $bgFitX . '% ' . $bgFitY . '%;';
} else {
$style_wrapper .= "background-size: " . $bgFit . ";";
}
if ($bgPosition == 'percentage') {
$style_wrapper .= "background-position: " . $bgPositionX . '% ' . $bgPositionY . '%;';
} else {
$style_wrapper .= "background-position: " . $bgPosition . ";";
}
$style_wrapper .= "background-repeat: " . $bgRepeat . ";";
break;
}
$slideTitle = $slide->getParam("title", "Slide");
$slideOrder = $slide->getOrder();
//treat multilanguage
$isWpmlExists = RevSliderWpml::isWpmlExists();
$useWpml = $slider->getParam("use_wpml", "off");
$wpmlActive = false;
if (!$slide->isStaticSlide()) {
if ($isWpmlExists && $useWpml == "on") {
$wpmlActive = true;
$parentSlide = $slide->getParentSlide();
$arrChildLangs = $parentSlide->getArrChildrenLangs();
}
}
?>
<script type="text/javascript">
/*
* Copyright 2015 Small Batch, Inc.
*
示例5: foreach
<div class="col-handle-inside">
<span class="ui-icon ui-icon-arrowthick-2-n-s"></span>
</div>
</span>
<div class="clear"></div>
<?php
if ($showLangs == true) {
?>
<ul class="list_slide_icons">
<?php
foreach ($arrChildLangs as $arrLang) {
$isParent = RevSliderFunctions::boolToStr($arrLang["isparent"]);
$childSlideID = $arrLang["slideid"];
$lang = $arrLang["lang"];
$urlFlag = RevSliderWpml::getFlagUrl($lang);
$langTitle = RevSliderWpml::getLangTitle($lang);
?>
<li>
<img id="icon_lang_<?php
echo $childSlideID;
?>
" class="icon_slide_lang" src="<?php
echo $urlFlag;
?>
" title="<?php
echo $langTitle;
?>
" data-slideid="<?php
echo $childSlideID;
?>
" data-lang="<?php
示例6: getPostsByCategory
/**
*
* get posts by some category
* could be multiple
*/
public static function getPostsByCategory($slider_id, $catID, $sortBy = self::SORTBY_ID, $direction = self::ORDER_DIRECTION_DESC, $numPosts = -1, $postTypes = "any", $taxonomies = "category", $arrAddition = array())
{
//get post types
if (strpos($postTypes, ",") !== false) {
$postTypes = explode(",", $postTypes);
if (array_search("any", $postTypes) !== false) {
$postTypes = "any";
}
}
if (empty($postTypes)) {
$postTypes = "any";
}
if (strpos($catID, ",") !== false) {
$catID = explode(",", $catID);
} else {
$catID = array($catID);
}
if (RevSliderWpml::isWpmlExists()) {
//translate categories to languages
$newcat = array();
foreach ($catID as $id) {
$newcat[] = icl_object_id($id, 'category', true);
}
$catID = $newcat;
}
$query = array('order' => $direction, 'ignore_sticky_posts' => 1, 'posts_per_page' => $numPosts, 'showposts' => $numPosts, 'post_type' => $postTypes);
//add sort by (could be by meta)
if (strpos($sortBy, "meta_num_") === 0) {
$metaKey = str_replace("meta_num_", "", $sortBy);
$query["orderby"] = "meta_value_num";
$query["meta_key"] = $metaKey;
} else {
if (strpos($sortBy, "meta_") === 0) {
$metaKey = str_replace("meta_", "", $sortBy);
$query["orderby"] = "meta_value";
$query["meta_key"] = $metaKey;
} else {
$query["orderby"] = $sortBy;
}
}
//get taxonomies array
$arrTax = array();
if (!empty($taxonomies)) {
$arrTax = explode(",", $taxonomies);
}
if (!empty($taxonomies)) {
$taxQuery = array();
//add taxomonies to the query
if (strpos($taxonomies, ",") !== false) {
//multiple taxomonies
$taxonomies = explode(",", $taxonomies);
foreach ($taxonomies as $taxomony) {
$taxArray = array('taxonomy' => $taxomony, 'field' => 'id', 'terms' => $catID);
$taxQuery[] = $taxArray;
}
} else {
//single taxomony
$taxArray = array('taxonomy' => $taxonomies, 'field' => 'id', 'terms' => $catID);
$taxQuery[] = $taxArray;
}
$taxQuery['relation'] = 'OR';
$query['tax_query'] = $taxQuery;
}
//if exists taxanomies
if (!empty($arrAddition)) {
$query = array_merge($query, $arrAddition);
}
$query = apply_filters('revslider_get_posts', $query, $slider_id);
$objQuery = new WP_Query($query);
$arrPosts = $objQuery->posts;
foreach ($arrPosts as $key => $post) {
if (method_exists($post, "to_array")) {
$arrPost = $post->to_array();
} else {
$arrPost = (array) $post;
}
$arrPostCats = self::getPostCategories($post, $arrTax);
$arrPost["categories"] = $arrPostCats;
$arrPosts[$key] = $arrPost;
}
return $arrPosts;
}
示例7: previewOutput
/**
*
* preview slider output
* if output object is null - create object
*/
public function previewOutput($sliderID, $output = null)
{
if ($sliderID == "empty_output") {
$this->loadingMessageOutput();
exit;
}
if ($output == null) {
$output = new RevSliderOutput();
}
$slider = new RevSlider();
$slider->initByID($sliderID);
$isWpmlExists = RevSliderWpml::isWpmlExists();
$useWpml = $slider->getParam("use_wpml", "off");
$wpmlActive = false;
if ($isWpmlExists && $useWpml == "on") {
$wpmlActive = true;
$arrLanguages = RevSliderWpml::getArrLanguages(false);
//set current lang to output
$currentLang = RevSliderFunctions::getPostGetVariable("lang");
if (empty($currentLang)) {
$currentLang = RevSliderWpml::getCurrentLang();
}
if (empty($currentLang)) {
$currentLang = $arrLanguages[0];
}
$output->setLang($currentLang);
$selectLangChoose = RevSliderFunctions::getHTMLSelect($arrLanguages, $currentLang, "id='select_langs'", true);
}
$output->setPreviewMode();
//put the output html
$urlPlugin = RS_PLUGIN_URL . 'public/assets/';
$urlPreviewPattern = RevSliderBase::$url_ajax_actions . "&client_action=preview_slider&sliderid=" . $sliderID . "&lang=[lang]&nonce=[nonce]";
$nonce = wp_create_nonce("revslider_actions");
$setBase = is_ssl() ? "https://" : "http://";
?>
<html>
<head>
<link rel='stylesheet' href='<?php
echo $urlPlugin;
?>
css/settings.css?rev=<?php
echo RevSliderGlobals::SLIDER_REVISION;
?>
' type='text/css' media='all' />
<link rel='stylesheet' href='<?php
echo $urlPlugin;
?>
fonts/font-awesome/css/font-awesome.css?rev=<?php
echo RevSliderGlobals::SLIDER_REVISION;
?>
' type='text/css' media='all' />
<link rel='stylesheet' href='<?php
echo $urlPlugin;
?>
fonts/pe-icon-7-stroke/css/pe-icon-7-stroke.css?rev=<?php
echo RevSliderGlobals::SLIDER_REVISION;
?>
' type='text/css' media='all' />
<?php
$db = new RevSliderDB();
$styles = $db->fetch(RevSliderGlobals::$table_css);
$styles = RevSliderCssParser::parseDbArrayToCss($styles, "\n");
$styles = RevSliderCssParser::compress_css($styles);
echo '<style type="text/css">' . $styles . '</style>';
//.$stylesinnerlayers
$http = is_ssl() ? 'https' : 'http';
$operations = new RevSliderOperations();
$arrValues = $operations->getGeneralSettingsValues();
$set_diff_font = RevSliderFunctions::getVal($arrValues, "change_font_loading", '');
if ($set_diff_font !== '') {
$font_url = $set_diff_font;
} else {
$font_url = $http . '://fonts.googleapis.com/css?family=';
}
$custom_css = RevSliderOperations::getStaticCss();
echo '<style type="text/css">' . RevSliderCssParser::compress_css($custom_css) . '</style>';
?>
<script type='text/javascript' src='<?php
echo $setBase;
?>
code.jquery.com/jquery-latest.min.js'></script>
<script type='text/javascript' src='<?php
echo $urlPlugin;
?>
js/jquery.themepunch.tools.min.js?rev=<?php
echo RevSliderGlobals::SLIDER_REVISION;
?>
'></script>
<script type='text/javascript' src='<?php
echo $urlPlugin;
?>
js/jquery.themepunch.revolution.min.js?rev=<?php
echo RevSliderGlobals::SLIDER_REVISION;
//.........这里部分代码省略.........
示例8: 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;
//.........这里部分代码省略.........
示例9: _e
_e("Unpublished", 'revslider');
?>
</option>
</select>
<span class="description"><?php
_e("The state of the slide. The unpublished slide will be excluded from the slider.", 'revslider');
?>
</span>
</p>
<!-- SLIDE LANGUAGE SELECTOR -->
<?php
if (isset($slider) && $slider->isInited()) {
$isWpmlExists = RevSliderWpml::isWpmlExists();
$useWpml = $slider->getParam("use_wpml", "off");
if ($isWpmlExists && $useWpml == "on") {
$arrLangs = RevSliderWpml::getArrLanguages();
$curset_lang = RevSliderFunctions::getVal($slideParams, "lang", "all");
?>
<p>
<label><?php
_e("Language", 'revslider');
?>
</label>
<select name="lang">
<?php
if (!empty($arrLangs) && is_array($arrLangs)) {
foreach ($arrLangs as $lang_handle => $lang_name) {
$sel = $lang_handle === $curset_lang ? ' selected="selected"' : '';
echo '<option value="' . $lang_handle . '"' . $sel . '>' . $lang_name . '</option>';
}
}
示例10: getSlidesForOutput
/**
*
* get slides for output
* one level only without children
*/
public function getSlidesForOutput($publishedOnly = false, $lang = 'all')
{
$isSlidesFromPosts = $this->isSlidesFromPosts();
$isSlidesFromStream = $this->isSlidesFromStream();
if (RevSliderWpml::isWpmlExists()) {
global $sitepress;
$sitepress->switch_lang($lang);
}
if ($isSlidesFromPosts) {
$arrParentSlides = $this->getSlidesFromPosts($publishedOnly);
} elseif ($isSlidesFromStream !== false) {
$arrParentSlides = $this->getSlidesFromStream($publishedOnly);
} else {
$arrParentSlides = $this->getSlides($publishedOnly);
}
if ($lang == 'all' || $isSlidesFromPosts || $isSlidesFromStream) {
return $arrParentSlides;
}
$arrSlides = array();
foreach ($arrParentSlides as $parentSlide) {
$parentLang = $parentSlide->getLang();
if ($parentLang == $lang) {
$arrSlides[] = $parentSlide;
}
$childAdded = false;
$arrChildren = $parentSlide->getArrChildren();
foreach ($arrChildren as $child) {
$childLang = $child->getLang();
if ($childLang == $lang) {
$arrSlides[] = $child;
$childAdded = true;
break;
}
}
if ($childAdded == false && $parentLang == "all") {
$arrSlides[] = $parentSlide;
}
}
return $arrSlides;
}
示例11: getSlidesForOutput
/**
*
* get slides for output
* one level only without children
*/
public function getSlidesForOutput($publishedOnly = false, $lang = 'all', $gal_ids = array())
{
$isSlidesFromPosts = $this->isSlidesFromPosts();
$isSlidesFromStream = $this->isSlidesFromStream();
if (RevSliderWpml::isWpmlExists() && $this->getParam('use_wpml', 'off') == 'on') {
global $sitepress;
$cur_lang = ICL_LANGUAGE_CODE;
$sitepress->switch_lang($lang);
/* NEW:
$wpml_current_language = apply_filters( 'wpml_current_language', null );
do_action( 'wpml_switch_language', $lang );
*/
}
if ($isSlidesFromPosts) {
$arrParentSlides = $this->getSlidesFromPosts($publishedOnly, $gal_ids);
} elseif ($isSlidesFromStream !== false) {
$arrParentSlides = $this->getSlidesFromStream($publishedOnly);
} else {
$arrParentSlides = $this->getSlides($publishedOnly);
}
if (RevSliderWpml::isWpmlExists() && $this->getParam('use_wpml', 'off') == 'on') {
//switch language back
global $sitepress;
$sitepress->switch_lang($cur_lang);
// NEW: do_action( 'wpml_switch_language', $wpml_current_language );
}
if ($lang == 'all' || $isSlidesFromPosts || $isSlidesFromStream) {
return $arrParentSlides;
}
$arrSlides = array();
foreach ($arrParentSlides as $parentSlide) {
$parentLang = $parentSlide->getLang();
if ($parentLang == $lang) {
$arrSlides[] = $parentSlide;
}
$childAdded = false;
$arrChildren = $parentSlide->getArrChildren();
foreach ($arrChildren as $child) {
$childLang = $child->getLang();
if ($childLang == $lang) {
$arrSlides[] = $child;
$childAdded = true;
break;
}
}
if ($childAdded == false && $parentLang == "all") {
$arrSlides[] = $parentSlide;
}
}
return $arrSlides;
}