本文整理汇总了PHP中RevSlider::importSliderFromPost方法的典型用法代码示例。如果您正苦于以下问题:PHP RevSlider::importSliderFromPost方法的具体用法?PHP RevSlider::importSliderFromPost怎么用?PHP RevSlider::importSliderFromPost使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类RevSlider
的用法示例。
在下文中一共展示了RevSlider::importSliderFromPost方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: explode
function import_revslider($other_data)
{
$is_import = false;
if ($handle = opendir(THEME_DIR . "assets" . DIRECTORY_SEPARATOR . "data-demo" . DIRECTORY_SEPARATOR . "revslider")) {
$arr_other_data = explode('||', $other_data);
while (false !== ($entry = readdir($handle))) {
if (in_array($entry, $arr_other_data)) {
continue;
}
if ($entry != "." && $entry != "..") {
$rev_import_file = THEME_DIR . "assets" . DIRECTORY_SEPARATOR . "data-demo" . DIRECTORY_SEPARATOR . "revslider" . DIRECTORY_SEPARATOR . $entry;
if (class_exists('RevSlider')) {
$slider = new RevSlider();
$response = $slider->importSliderFromPost(true, true, $rev_import_file);
/*if (is_array($response) && isset($response['success']) && !$response['success']) {
return $other_data;
}*/
if (!empty($other_data)) {
$other_data .= '||';
}
$other_data .= $entry;
$is_import = true;
break;
} else {
return 'done';
}
}
}
closedir($handle);
} else {
return 'done';
}
if ($is_import) {
return $other_data;
}
return 'done';
}
示例2: revSliderCharityDataImport
public function revSliderCharityDataImport() {
if (class_exists('RevSlider')) {
$slider = new RevSlider();
$response = $slider->importSliderFromPost(true, true, CHY_THEME_DIR . '/vendor/data/home_slder2.zip');
$response = $slider->importSliderFromPost(true, true, CHY_THEME_DIR . '/vendor/data/home_slder3.zip');
$response = $slider->importSliderFromPost(true, true, CHY_THEME_DIR . '/vendor/data/home_slder1.zip');
$response = $slider->importSliderFromPost(true, true, CHY_THEME_DIR . '/vendor/data/ShopLandingSlider.zip');
}
}
示例3: reset
function wbc_extended_example($demo_active_import, $demo_directory_path)
{
reset($demo_active_import);
$current_key = key($demo_active_import);
/************************************************************************
* Import slider(s) for the current demo being imported
*************************************************************************/
if (class_exists('RevSlider')) {
//If it's demo3 or demo5
$wbc_sliders_array = array('demo1' => 'newslider2014.zip');
if (isset($demo_active_import[$current_key]['directory']) && !empty($demo_active_import[$current_key]['directory']) && array_key_exists($demo_active_import[$current_key]['directory'], $wbc_sliders_array)) {
$wbc_slider_import = $wbc_sliders_array[$demo_active_import[$current_key]['directory']];
if (file_exists($demo_directory_path . $wbc_slider_import)) {
$slider = new RevSlider();
$slider->importSliderFromPost(true, true, $demo_directory_path . $wbc_slider_import);
}
}
}
/************************************************************************
* Setting Menus
*************************************************************************/
// If it's demo1 - demo6
$wbc_menu_array = array('demo1');
if (isset($demo_active_import[$current_key]['directory']) && !empty($demo_active_import[$current_key]['directory']) && in_array($demo_active_import[$current_key]['directory'], $wbc_menu_array)) {
$top_menu = get_term_by('name', 'Top Menu', 'nav_menu');
$main_menu = get_term_by('name', 'Header Menu', 'nav_menu');
$footer_menu = get_term_by('name', 'Footer Menu', 'nav_menu');
if (isset($top_menu->term_id)) {
set_theme_mod('nav_menu_locations', array('top-menu' => $top_menu->term_id, 'primary-menu' => $main_menu->term_id, 'footer-menu' => $footer_menu->term_id));
}
}
/************************************************************************
* Set HomePage
*************************************************************************/
// array of demos/homepages to check/select from
$wbc_home_pages = array('demo1' => 'Home');
$wbc_blog_pages = array('demo1' => 'Blog');
if (isset($demo_active_import[$current_key]['directory']) && !empty($demo_active_import[$current_key]['directory']) && array_key_exists($demo_active_import[$current_key]['directory'], $wbc_home_pages)) {
$page = get_page_by_title($wbc_home_pages[$demo_active_import[$current_key]['directory']]);
if (isset($page->ID)) {
update_option('page_on_front', $page->ID);
update_option('show_on_front', 'page');
//Update Widgets Switch to On
$all_widgets_on = 'a:34:{s:6:"button";b:1;s:10:"google-map";b:1;s:5:"image";b:1;s:6:"slider";b:1;s:13:"post-carousel";b:1;s:6:"editor";b:1;s:12:"alert-widget";b:1;s:14:"counter-widget";b:1;s:21:"featured-block-widget";b:1;s:19:"gallery-grid-widget";b:1;s:4:"icon";b:1;s:15:"carousel-widget";b:1;s:17:"posts-list-widget";b:1;s:18:"progressbar-widget";b:1;s:19:"sermons-list-widget";b:1;s:21:"sermons-albums-widget";b:1;s:17:"staff-grid-widget";b:1;s:13:"spacer-widget";b:1;s:11:"tabs-widget";b:1;s:8:"taxonomy";b:1;s:13:"toggle-widget";b:1;s:11:"testimonial";b:1;s:30:"upcoming-events-listing-widget";b:1;s:5:"video";b:1;s:14:"simple-masonry";b:1;s:20:"social-media-buttons";b:1;s:11:"price-table";b:1;s:13:"layout-slider";b:1;s:10:"image-grid";b:1;s:4:"hero";b:1;s:8:"headline";b:1;s:8:"features";b:1;s:7:"contact";b:1;s:3:"cta";b:1;}';
$all_widgets_on = unserialize($all_widgets_on);
update_option('siteorigin_widgets_active', $all_widgets_on);
}
}
if (isset($demo_active_import[$current_key]['directory']) && !empty($demo_active_import[$current_key]['directory']) && array_key_exists($demo_active_import[$current_key]['directory'], $wbc_blog_pages)) {
$bpage = get_page_by_title($wbc_blog_pages[$demo_active_import[$current_key]['directory']]);
if (isset($bpage->ID)) {
update_option('page_for_posts', $bpage->ID);
}
}
}
示例4: import_revsliders
public function import_revsliders($file)
{
if (!file_exists($file)) {
return 'Revolution Slider file not found';
return;
}
if (class_exists('RevSlider')) {
ob_start();
$rev = new RevSlider();
$response = $rev->importSliderFromPost(false, false, $file);
ob_end_clean();
return 'Revolution Slider imported';
}
}
示例5: glob
function import_revslider($folder = '')
{
if (!class_exists('RevSliderAdmin')) {
require_once RS_PLUGIN_PATH . '/admin/revslider-admin.class.php';
}
$rev_files = glob(get_template_directory() . '/library/import/files/' . $folder . '/revslider/*.zip');
if (!empty($rev_files)) {
foreach ($rev_files as $rev_file) {
$_FILES['import_file']['error'] = UPLOAD_ERR_OK;
$_FILES['import_file']['tmp_name'] = $rev_file;
$slider = new RevSlider();
$slider->importSliderFromPost(true, 'none');
}
}
}
示例6: import_sliders
private function import_sliders()
{
$dir = opendir($this->dir);
ob_start();
while ($file = readdir($dir)) {
if ($file != '.' && $file != '..' && preg_match('/\\.zip$/', $file)) {
$filepath = $this->dir . '/' . $file;
if (!isset($_FILES["import_file"])) {
$_FILES["import_file"] = array();
}
$_FILES["import_file"]["tmp_name"] = $filepath;
$slider = new RevSlider();
$response = $slider->importSliderFromPost();
}
}
ob_end_clean();
}
示例7: reset
function wbc_extended_example($demo_active_import, $demo_directory_path)
{
reset($demo_active_import);
$current_key = key($demo_active_import);
/************************************************************************
* Import slider(s) for the current demo being imported
* *********************************************************************** */
if (class_exists('RevSlider')) {
//If it's demo3 or demo5
$wbc_sliders_array = array('demo1' => 'portfolio.zip', 'demo5' => 'anotherslider.zip');
if (isset($demo_active_import[$current_key]['directory']) && !empty($demo_active_import[$current_key]['directory']) && array_key_exists($demo_active_import[$current_key]['directory'], $wbc_sliders_array)) {
$wbc_slider_import = $wbc_sliders_array[$demo_active_import[$current_key]['directory']];
if (file_exists($demo_directory_path . $wbc_slider_import)) {
$slider = new RevSlider();
$slider->importSliderFromPost(true, true, $demo_directory_path . $wbc_slider_import);
}
}
}
/************************************************************************
* Setting Menus
* *********************************************************************** */
// If it's demo1 - demo6
$wbc_menu_array = array('Business-onepage', 'Portfolio', 'Creative', 'Creative-onepage');
if (isset($demo_active_import[$current_key]['directory']) && !empty($demo_active_import[$current_key]['directory']) && in_array($demo_active_import[$current_key]['directory'], $wbc_menu_array)) {
$top_menu = get_term_by('name', 'Temp Menu', 'nav_menu');
if (isset($top_menu->term_id)) {
set_theme_mod('nav_menu_locations', array('theme-primary' => $top_menu->term_id, 'theme-footer' => $top_menu->term_id));
}
}
/* * **********************************************************************
* Set HomePage
* *********************************************************************** */
// array of demos/homepages to check/select from
$wbc_home_pages = array('Business-onepage' => 'Home', 'Portfolio' => 'Home', 'Creative' => 'Home', 'Creative-onepage' => 'Home');
if (isset($demo_active_import[$current_key]['directory']) && !empty($demo_active_import[$current_key]['directory']) && array_key_exists($demo_active_import[$current_key]['directory'], $wbc_home_pages)) {
$page = get_page_by_title($wbc_home_pages[$demo_active_import[$current_key]['directory']]);
if (isset($page->ID)) {
update_option('page_on_front', $page->ID);
update_option('show_on_front', 'page');
}
}
}
示例8: importRevSlider
function importRevSlider($demo_name)
{
// Get the xml file from directory
$import_path = THEME_LIB . "/admin/dummydata/" . $demo_name . "/";
$import_rev_slider = $import_path . "revslider.zip";
# Import Layer Slider
if (is_file($import_rev_slider) && class_exists('RevSlider')) {
$slider = new RevSlider();
ob_start();
$response = $slider->importSliderFromPost(true, true, $import_rev_slider);
$content = ob_get_clean();
}
}
示例9: flush
function import_sliders()
{
// Revolution Sliders
if (file_exists(WP_PLUGIN_DIR . '/revslider/revslider.php')) {
require_once WP_PLUGIN_DIR . '/revslider/revslider.php';
$dir = get_template_directory() . '/admin/tools/importer/data/revslider';
if (is_dir($dir)) {
$hdir = @opendir($dir);
if ($hdir) {
echo '<br><b>' . __('Import Revolution sliders ...', 'themerex') . '</b><br>';
flush();
$slider = new RevSlider();
while (($file = readdir($hdir)) !== false) {
$pi = pathinfo($dir . '/' . $file);
if (substr($file, 0, 1) == '.' || is_dir($dir . '/' . $file) || $pi['extension'] != 'zip') {
continue;
}
if ($this->debug) {
printf(__('Slider "%s":', 'themerex'), $file);
}
if (!is_array($_FILES)) {
$_FILES = array();
}
$_FILES["import_file"] = array("tmp_name" => $dir . '/' . $file);
$response = $slider->importSliderFromPost();
if ($response["success"] == false) {
if ($this->debug) {
echo ' ' . __('imported', 'themerex') . '<br>';
}
} else {
if ($this->debug) {
echo ' ' . __('import error', 'themerex') . '<br>';
}
}
flush();
}
@closedir($hdir);
}
}
} else {
if ($this->debug) {
printf(__('Can not locate Revo plugin: %s', 'themerex'), WP_PLUGIN_DIR . '/revslider/revslider.php<br>');
flush();
}
}
}
示例10: importSliderHandle
/**
*
* import slideer handle (not ajax response)
*/
private static function importSliderHandle($viewBack = null, $updateAnim = true, $updateStatic = true)
{
dmp(__("importing slider setings and data...", REVSLIDER_TEXTDOMAIN));
$slider = new RevSlider();
$response = $slider->importSliderFromPost($updateAnim, $updateStatic);
$sliderID = $response["sliderID"];
if (empty($viewBack)) {
$viewBack = self::getViewUrl(self::VIEW_SLIDER, "id=" . $sliderID);
if (empty($sliderID)) {
$viewBack = self::getViewUrl(self::VIEW_SLIDERS);
}
}
//handle error
if ($response["success"] == false) {
$message = $response["error"];
dmp("<b>Error: " . $message . "</b>");
echo UniteFunctionsRev::getHtmlLink($viewBack, __("Go Back", REVSLIDER_TEXTDOMAIN));
} else {
//handle success, js redirect.
dmp(__("Slider Import Success, redirecting...", REVSLIDER_TEXTDOMAIN));
sdsconfig::getgeneratecssfile();
echo "<script>location.href='{$viewBack}'</script>";
}
exit;
}
示例11: tbImportRevSlider
function tbImportRevSlider($theme)
{
if (class_exists('UniteBaseAdminClassRev')) {
require_once ABSPATH . 'wp-content/plugins/revslider/revslider_admin.php';
if ($handle = opendir(get_template_directory() . '/inc/dummy/' . $theme . '/revslider')) {
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != "..") {
$_FILES['import_file']['tmp_name'] = get_template_directory() . '/inc/dummy/' . $theme . '/revslider/' . $entry;
$slider = new RevSlider();
ob_start();
$response = $slider->importSliderFromPost(true, true);
ob_end_clean();
}
}
closedir($handle);
}
return true;
}
return false;
}
示例12: fusion_importer
//.........这里部分代码省略.........
update_post_meta($opmenu->ID, 'pyre_displayed_menu', $menu->term_id);
}
if ($menu->name == 'Main Menu') {
$locations['main_navigation'] = $menu->term_id;
}
} elseif ($demo_type == 'forum') {
if ($menu->name == 'Main Menu') {
$locations['main_navigation'] = $menu->term_id;
}
}
}
}
set_theme_mod('nav_menu_locations', $locations);
// set menus to locations
// Import Theme Options
$theme_options_json = file_get_contents($theme_options_file);
$theme_options = json_decode($theme_options_json, true);
$theme_options['logo_retina'] = '';
$theme_options_db_name = Avada::get_original_option_name();
update_option($theme_options_db_name, $theme_options);
// Add sidebar widget areas
if ($sidebar_exists == true) {
update_option('sbg_sidebars', $sidebars);
foreach ($sidebars as $sidebar) {
$sidebar_class = avada_name_to_class($sidebar);
register_sidebar(array('name' => $sidebar, 'id' => 'avada-custom-sidebar-' . strtolower($sidebar_class), 'before_widget' => '<div id="%1$s" class="widget %2$s">', 'after_widget' => '</div>', 'before_title' => '<div class="heading"><h4 class="widget-title">', 'after_title' => '</h4></div>'));
}
}
// Add data to widgets
if (isset($widgets_file) && $widgets_file) {
$widgets_json = $widgets_file;
// widgets data file
$widgets_json = file_get_contents($widgets_json);
$widget_data = $widgets_json;
$import_widgets = fusion_import_widget_data($widget_data);
}
// Import Layerslider
if (function_exists('layerslider_import_sample_slider') && $layerslider_exists == true) {
// if layerslider is activated
// Get importUtil
include WP_PLUGIN_DIR . '/LayerSlider/classes/class.ls.importutil.php';
$layer_files = fusion_get_import_files($layer_directory, 'zip');
foreach ($layer_files as $layer_file) {
// finally import layer slider
$import = new LS_ImportUtil($layer_file);
}
// Get all sliders
// Table name
$table_name = $wpdb->prefix . "layerslider";
// Get sliders
$sliders = $wpdb->get_results("SELECT * FROM {$table_name}\n\t\t\t\t\t\t\t\t\t\t\t\t\tWHERE flag_hidden = '0' AND flag_deleted = '0'\n\t\t\t\t\t\t\t\t\t\t\t\t\tORDER BY date_c ASC");
if (!empty($sliders)) {
foreach ($sliders as $key => $item) {
$slides[$item->id] = $item->name;
}
}
if ($slides) {
foreach ($slides as $key => $val) {
$slides_array[$val] = $key;
}
}
// Assign LayerSlider
if ($demo_type == 'classic') {
$lspage = get_page_by_title('Layer Slider');
if (isset($lspage) && $lspage->ID && $slides_array['Avada Full Width']) {
update_post_meta($lspage->ID, 'pyre_slider', $slides_array['Avada Full Width']);
}
}
}
// Import Revslider
if (class_exists('UniteFunctionsRev') && $revslider_exists == true) {
// if revslider is activated
$rev_files = fusion_get_import_files($rev_directory, 'zip');
$slider = new RevSlider();
foreach ($rev_files as $rev_file) {
// finally import rev slider data files
$filepath = $rev_file;
ob_start();
$slider->importSliderFromPost(true, false, $filepath);
ob_clean();
ob_end_clean();
}
}
// Set reading options
$homepage = get_page_by_title($homepage_title);
if (isset($homepage) && $homepage->ID) {
update_option('show_on_front', 'page');
update_option('page_on_front', $homepage->ID);
// Front Page
}
// Fusion Sliders Import
if ($fs_exists == true) {
@avada_import_fsliders($fs_url);
}
update_option('avada_imported_demo', 'true');
echo 'imported';
exit;
}
}
}
示例13: flush
function import_sliders()
{
// Revolution Sliders
if (axiom_exists_revslider() && file_exists(WP_PLUGIN_DIR . '/revslider/revslider.php')) {
require_once WP_PLUGIN_DIR . '/revslider/revslider.php';
$dir = axiom_get_folder_dir($this->options['folder_with_revsliders']);
if (is_dir($dir)) {
$hdir = @opendir($dir);
if ($hdir) {
echo '<script>' . 'document.getElementById("import_progress_status").innerHTML = "' . __('Import Revolution sliders ...', 'axiom') . '";' . '</script>';
echo '<br><b>' . __('Import Revolution sliders ...', 'axiom') . '</b><br>';
flush();
$slider = new RevSlider();
$counter = 0;
while (($file = readdir($hdir)) !== false) {
$counter++;
if ($counter <= $this->last_slider) {
continue;
}
$pi = pathinfo($dir . '/' . $file);
if (substr($file, 0, 1) == '.' || is_dir($dir . '/' . $file) || $pi['extension'] != 'zip') {
continue;
}
if ($this->options['debug']) {
printf(__('Slider "%s":', 'axiom'), $file);
}
if (!is_array($_FILES)) {
$_FILES = array();
}
$_FILES["import_file"] = array("tmp_name" => $dir . '/' . $file);
$response = $slider->importSliderFromPost();
if ($response["success"] == false) {
if ($this->options['debug']) {
echo ' ' . __('import error:', 'axiom') . '<br>' . dumpVar($response);
}
} else {
if ($this->options['debug']) {
echo ' ' . __('imported', 'axiom') . '<br>';
}
}
flush();
break;
}
@closedir($hdir);
// Write last slider into log
axiom_fpc($this->import_log, $file ? '0|100|' . intval($counter) : '');
$this->last_slider = $file ? $counter : 0;
}
}
} else {
if ($this->options['debug']) {
printf(__('Can not locate Revo plugin: %s', 'axiom'), WP_PLUGIN_DIR . '/revslider/revslider.php<br>');
flush();
}
}
}
示例14: jeg_import_revolution
function jeg_import_revolution()
{
/** first delete the slider */
$slider = new RevSlider();
global $_FILES;
$sliderpaths = array();
if (!$slider->isAliasExists('santaicon')) {
$sliderpaths[] = get_template_directory() . '/admin/import/data/santaicon.zip';
}
if (!$slider->isAliasExists('slider1')) {
$sliderpaths[] = get_template_directory() . '/admin/import/data/slider1.zip';
}
if (!$slider->isAliasExists('resto')) {
$sliderpaths[] = get_template_directory() . '/admin/import/data/resto.zip';
}
ob_start();
if ($sliderpaths) {
foreach ($sliderpaths as $sliderpath) {
$_FILES["import_file"]["tmp_name"] = $sliderpath;
$slider->importSliderFromPost(false, false);
}
}
ob_end_clean();
}
示例15: while
function tb_import_revslider($theme)
{
if (class_exists('UniteBaseAdminClassRev')) {
require_once ABSPATH . 'wp-content/plugins/revslider/admin/revslider-admin.class.php';
if ($handle = opendir(ABS_PATH_ADMIN . '/sample/' . $theme . '/revslider')) {
while (false !== ($entry = readdir($handle))) {
if ($entry != "." && $entry != "..") {
$_FILES['import_file']['tmp_name'] = ABS_PATH_ADMIN . '/sample/' . $theme . '/revslider/' . $entry;
$slider = new RevSlider();
ob_start();
$response = $slider->importSliderFromPost(true, true);
ob_end_clean();
}
}
closedir($handle);
}
return true;
}
return false;
}