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


PHP RevSlider::getAllSliderAliases方法代碼示例

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


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

示例1: tt_revo_importer

function tt_revo_importer()
{
    if (class_exists('UniteFunctionsRev')) {
        global $wpdb;
        $revo_directory = get_stylesheet_directory() . '/framework/addons/wordpress-importer/files/revsliders/';
        $revo_files = array();
        $db = new UniteDBRev();
        $revo_obj = new RevSlider();
        $aliases = $revo_obj->getAllSliderAliases();
        foreach (glob($revo_directory . '*.txt') as $filename) {
            $filename = basename($filename);
            $revo_files[] = get_stylesheet_directory_uri() . '/framework/addons/wordpress-importer/files/revsliders/' . $filename;
        }
        foreach ($revo_files as $rev_file) {
            $get_revo_file = wp_remote_get($rev_file);
            $ncd = $get_revo_file['body'];
            if (base64_decode($ncd, true)) {
                $slider_data = @unserialize(base64_decode($ncd));
            } else {
                ob_start();
                $ncd = preg_replace('!s:(\\d+):"(.*?)";!e', "'s:'.strlen('\$2').':\"\$2\";'", trim($ncd));
                //clear errors in string
                ob_end_clean();
                $slider_data = @unserialize($ncd);
            }
            if (empty($slider_data)) {
                continue;
            }
            $slider_params = $slider_data["params"];
            if (in_array($slider_params['alias'], $aliases)) {
                continue;
            }
            $serialized_content = serialize($slider_data);
            /* Detecting Animations and Styles */
            $animations = isset($slider_data["custom_animations"]) ? $slider_data["custom_animations"] : array();
            if (!empty($animations)) {
                foreach ($animations as $key => $animation) {
                    //$animation['id'], $animation['handle'], $animation['params']
                    $exist = $db->fetch(GlobalsRevSlider::$table_layer_anims, "handle = '" . $animation['handle'] . "'");
                    if (!empty($exist)) {
                        //update the animation, get the ID
                        $arrUpdate = array();
                        $arrUpdate['params'] = stripslashes(json_encode(str_replace("'", '"', $animation['params'])));
                        $db->update(GlobalsRevSlider::$table_layer_anims, $arrUpdate, array('handle' => $animation['handle']));
                        $id = $exist['0']['id'];
                    } else {
                        //insert the animation, get the ID
                        $arrInsert = array();
                        $arrInsert["handle"] = $animation['handle'];
                        $arrInsert["params"] = stripslashes(json_encode(str_replace("'", '"', $animation['params'])));
                        $id = $db->insert(GlobalsRevSlider::$table_layer_anims, $arrInsert);
                    }
                    $serialized_content = str_replace(array('customin-' . $animation['id'], 'customout-' . $animation['id']), array('customin-' . $id, 'customout-' . $id), $serialized_content);
                }
            }
            // Static Captions
            $static = isset($slider_data["static_captions"]) ? $slider_data["static_captions"] : "";
            if (!empty($static)) {
                RevOperations::updateStaticCss($static);
            }
            //overwrite/create dynamic-captions.css
            //parse css to classes
            if (isset($slider_data["dynamic_captions"]) && !empty($slider_data["dynamic_captions"])) {
                $dynamicCss = UniteCssParserRev::parseCssToArray($slider_data["dynamic_captions"]);
                if (is_array($dynamicCss) && $dynamicCss !== false && count($dynamicCss) > 0) {
                    foreach ($dynamicCss as $class => $styles) {
                        //check if static style or dynamic style
                        $class = trim($class);
                        if (strpos($class, ':hover') === false && strpos($class, ':') !== false || strpos($class, " ") !== false || strpos($class, ".tp-caption") === false || (strpos($class, ".") === false || strpos($class, "#") !== false) || strpos($class, ">") !== false) {
                            //.tp-caption>.imageclass or .tp-caption.imageclass>img or .tp-caption.imageclass .img
                            continue;
                        }
                        //is a dynamic style
                        if (strpos($class, ':hover') !== false) {
                            $class = trim(str_replace(':hover', '', $class));
                            $arrInsert = array();
                            $arrInsert["hover"] = json_encode($styles);
                            $arrInsert["settings"] = json_encode(array('hover' => 'true'));
                        } else {
                            $arrInsert = array();
                            $arrInsert["params"] = json_encode($styles);
                        }
                        //check if class exists
                        $result = $db->fetch(GlobalsRevSlider::$table_css, "handle = '" . $class . "'");
                        if (!empty($result)) {
                            //update
                            $db->update(GlobalsRevSlider::$table_css, $arrInsert, array('handle' => $class));
                        } else {
                            //insert
                            $arrInsert["handle"] = $class;
                            $db->insert(GlobalsRevSlider::$table_css, $arrInsert);
                        }
                    }
                }
            }
            $slider_data = unserialize($serialized_content);
            $slider_params = $slider_data["params"];
            /*
            if(isset($slider_params["background_image"])) {
                $slider_params["background_image"] = UniteFunctionsWPRev::getImageUrlFromPath($slider_params["background_image"]);
//.........這裏部分代碼省略.........
開發者ID:petersondrs,項目名稱:tellura,代碼行數:101,代碼來源:revo-importer.php

示例2: array

<?php

global $byt_theme_globals;
$frontpage_show_slider = $byt_theme_globals->frontpage_show_slider();
get_sidebar('home-above-slider');
if (class_exists('RevSlider') && function_exists('putRevSlider')) {
    $homepage_slider = $byt_theme_globals->get_homepage_slider();
    $homepage_slider_alias = '';
    if ($homepage_slider >= 0) {
        $sliders_array = array();
        try {
            $slider = new RevSlider();
            $sliders_array = $slider->getAllSliderAliases();
            $homepage_slider_alias = $sliders_array[$homepage_slider];
        } catch (Exception $e) {
        }
    }
    if (!empty($homepage_slider_alias) && $frontpage_show_slider) {
        putRevSlider($homepage_slider_alias);
    }
}
開發者ID:JDjimenezdelgado,項目名稱:old-mmexperience,代碼行數:21,代碼來源:home-page-header.php


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