本文整理汇总了PHP中RevSlider::isSlidesFromPosts方法的典型用法代码示例。如果您正苦于以下问题:PHP RevSlider::isSlidesFromPosts方法的具体用法?PHP RevSlider::isSlidesFromPosts怎么用?PHP RevSlider::isSlidesFromPosts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RevSlider
的用法示例。
在下文中一共展示了RevSlider::isSlidesFromPosts方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: toggleSlideStatFromData
/**
* toggle slide state from data
**/
public function toggleSlideStatFromData($data)
{
$sliderID = RevSliderFunctions::getVal($data, "slider_id");
$slider = new RevSlider();
$slider->initByID($sliderID);
$slideID = RevSliderFunctions::getVal($data, "slide_id");
if ($slider->isSlidesFromPosts()) {
$postData = RevSliderFunctionsWP::getPost($slideID);
$oldState = $postData["post_status"];
$newState = $oldState == RevSliderFunctionsWP::STATE_PUBLISHED ? RevSliderFunctionsWP::STATE_DRAFT : RevSliderFunctionsWP::STATE_PUBLISHED;
//update the state in wp
RevSliderFunctionsWP::updatePostState($slideID, $newState);
//return state:
$newState = $newState == RevSliderFunctionsWP::STATE_PUBLISHED ? "published" : "unpublished";
} else {
$this->initByID($slideID);
$state = $this->getParam("state", "published");
$newState = $state == "published" ? "unpublished" : "published";
$arrUpdate = array();
$arrUpdate["state"] = $newState;
$this->updateParamsInDB($arrUpdate);
}
return $newState;
}
示例2: getArrSlidersWithSlidesShort
/**
*
* get array of sliders with slides, short, assoc.
*/
public function getArrSlidersWithSlidesShort($filterType = self::SLIDER_TYPE_ALL)
{
$arrSliders = self::getArrSlidersShort(null, $filterType);
$output = array();
foreach ($arrSliders as $sliderID => $sliderName) {
$slider = new RevSlider();
$slider->initByID($sliderID);
$isFromPosts = $slider->isSlidesFromPosts();
$isTemplate = $slider->getParam("template", "false");
//filter by gallery only
if ($filterType == self::SLIDER_TYPE_POSTS && $isFromPosts == false) {
continue;
}
if ($filterType == self::SLIDER_TYPE_GALLERY && $isFromPosts == true) {
continue;
}
//filter by template type
if ($filterType == self::SLIDER_TYPE_TEMPLATE && $isTemplate == "false") {
continue;
}
$sliderTitle = $slider->getTitle();
$arrSlides = $slider->getArrSlidesFromGalleryShort();
foreach ($arrSlides as $slideID => $slideName) {
$output[$slideID] = $sliderName . ", " . $slideName;
}
}
return $output;
}
示例3: updateSlideImageFromData
/**
*
* update slide image from data
*/
public function updateSlideImageFromData($data)
{
$sliderID = RevSliderFunctions::getVal($data, "slider_id");
$slider = new RevSlider();
$slider->initByID($sliderID);
$slideID = RevSliderFunctions::getVal($data, "slide_id");
$urlImage = RevSliderFunctions::getVal($data, "url_image");
RevSliderFunctions::validateNotEmpty($urlImage);
$imageID = RevSliderFunctions::getVal($data, "image_id");
if ($slider->isSlidesFromPosts()) {
if (!empty($imageID)) {
RevSliderFunctionsWP::updatePostThumbnail($slideID, $imageID);
}
} elseif ($slider->isSlidesFromStream() !== false) {
//do nothing
} else {
$this->initByID($slideID);
$arrUpdate = array();
$arrUpdate["image"] = $urlImage;
$arrUpdate["image_id"] = $imageID;
$this->updateParamsInDB($arrUpdate);
}
return $urlImage;
}
示例4: count
$selectSliders = UniteFunctionsRev::getHTMLSelect($arrSliders, "", "id='selectSliders'", true);
$numSliders = count($arrSliders);
//set iframe parameters
//$width = $sliderParams["width"];
//$height = $sliderParams["height"];
$width = isset($sliderParams["width"]) ? $sliderParams["width"] : '';
$height = isset($sliderParams["height"]) ? $sliderParams["height"] : '';
$iframeWidth = $width + 60;
$iframeHeight = $height + 50;
$iframeStyle = "width:" . $iframeWidth . "px;height:" . $iframeHeight . "px;";
$arrSlides = $slider->getSlides(false);
$numSlides = count($arrSlides);
$linksSliderSettings = self::getViewUrl(RevSliderAdmin::VIEW_SLIDER, "id={$sliderID}");
$patternViewSlide = self::getViewUrl("slide", "id=[slideid]");
//treat in case of slides from gallery
if ($slider->isSlidesFromPosts() == false) {
$templateName = "slides_gallery";
//handle wpml
$isWpmlExists = UniteWpmlRev::isWpmlExists();
$useWpml = $slider->getParam("use_wpml", "off");
$wpmlActive = false;
if ($isWpmlExists && $useWpml == "on") {
$wpmlActive = true;
//get langs floating menu
$urlIconDelete = self::$url_plugin . "images/icon-trash.png";
$urlIconEdit = self::$url_plugin . "images/icon-edit.png";
$urlIconPreview = self::$url_plugin . "images/preview.png";
$textDelete = ControllerModulerevslideropencart::$lang_var['Delete_Slider'];
$textEdit = ControllerModulerevslideropencart::$lang_var['Edit_Slide'];
$textPreview = ControllerModulerevslideropencart::$lang_var['Preview_Slide'];
$htmlBefore = "";
示例5: __construct
/**
* Constructor
*/
public function __construct()
{
parent::__construct();
$operations = new RevOperations();
$sliderID = $this->getRequest()->getParam('id');
$storeID = $this->getRequest()->getParam('store_id', 0);
if (empty($sliderID)) {
UniteFunctionsRev::throwError("Slider ID not found");
}
$slider = new RevSlider();
$slider->initByID($sliderID);
$sliderParams = $slider->getParams();
$arrSliders = $slider->getArrSlidersShort($sliderID);
$selectSliders = UniteFunctionsRev::getHTMLSelect($arrSliders, "", "id='selectSliders'", true);
$numSliders = count($arrSliders);
//set iframe parameters
$width = $sliderParams["width"];
$height = $sliderParams["height"];
$iframeWidth = $width + 60;
$iframeHeight = $height + 50;
$iframeStyle = "width:" . $iframeWidth . "px;height:" . $iframeHeight . "px;";
$arrSlides = $slider->getSlides(false, $storeID);
$numSlides = count($arrSlides);
$linksSliderSettings = $this->helper("adminhtml")->getUrl('adminhtml/nwdrevslider/slider/id/' . $sliderID);
$patternViewSlide = $this->helper("adminhtml")->getUrl('adminhtml/nwdrevslider/slider/id/[slideid]');
$useStaticLayers = $slider->getParam("enable_static_layers", "off");
//treat in case of slides from gallery
if ($slider->isSlidesFromPosts() == false) {
$templateName = "slides_gallery";
// store view
$selectStoreView = Mage::app()->getLayout()->createBlock('core/html_select')->setName('select_storeview')->setId('select_storeview')->setTitle('Store View')->setValue($storeID)->setOptions(Mage::getSingleton('adminhtml/system_store')->getStoreValuesForForm(false, true))->getHtml();
$this->assign('storeID', $storeID);
$this->assign('selectStoreView', $selectStoreView);
$this->setTemplate('nwdthemes/revslider/templates/slides_gallery.phtml');
} else {
//slides from posts
$templateName = "slides_posts";
$sourceType = $slider->getParam("source_type", "posts");
$showSortBy = $sourceType == "posts" ? true : false;
$showDelete = $sourceType == "specific_posts" ? true : false;
//get button links
$urlNewPost = $this->helper('adminhtml')->getUrl('adminhtml/catalog_product/new');
$linkNewPost = UniteFunctionsRev::getHtmlLink($urlNewPost, $this->__("<i class='revicon-pencil-1'></i>New Product"), "button_new_post", "button-primary revblue", true);
//get ordering
$arrSortBy = $this->helper('nwdrevslider')->getArrSortBy();
$sortBy = $slider->getParam("post_sortby", RevSlider::DEFAULT_POST_SORTBY);
$selectSortBy = UniteFunctionsRev::getHTMLSelect($arrSortBy, $sortBy, "id='select_sortby'", true);
$this->assign('showSortBy', $showSortBy);
$this->assign('showDelete', $showDelete);
$this->assign('selectSortBy', $selectSortBy);
$this->assign('linkNewPost', $linkNewPost);
$this->setTemplate('nwdthemes/revslider/templates/slides_posts.phtml');
}
$this->assign('sliderID', $sliderID);
$this->assign('iframeStyle', $iframeStyle);
$this->assign('patternViewSlide', $patternViewSlide);
$this->assign('selectSliders', $selectSliders);
$this->assign('linksSliderSettings', $linksSliderSettings);
$this->assign('useStaticLayers', $useStaticLayers);
$this->assign('arrSlides', $arrSlides);
$this->assign('slider', $slider);
$this->assign('numSlides', $numSlides);
$this->assign('numSliders', $numSliders);
}