当前位置: 首页>>代码示例>>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;未经允许,请勿转载。