芝麻web文件管理V1.00
编辑当前文件:/home4/randall/public_html/sl/wp-content/plugins/revslider/includes/extension.class.php
* @link https://www.sliderrevolution.com/ * @copyright 2019 ThemePunch */ if(!defined('ABSPATH')) exit(); class RevSliderExtension { public function __construct() { $this->init_essential_grid_extensions(); } /*************************** * Setup part for Revslider inclusion into Essential Grid ***************************/ /** * Do all initializations for RevSlider integration */ public function init_essential_grid_extensions(){ if(!class_exists('Essential_Grid')) return false; //only add if Essential Grid is installed add_filter('essgrid_set_ajax_source_order', array($this, 'add_slider_to_eg_ajax')); add_filter('essgrid_handle_ajax_content', array($this, 'set_slider_values_to_eg_ajax'), 10, 4); add_action('essgrid_add_meta_options', array($this, 'add_eg_additional_meta_field')); add_action('essgrid_save_meta_options', array($this, 'save_eg_additional_meta_field'), 10, 2); //only do on frontend add_action('admin_head', array($this, 'add_eg_additional_inline_javascript')); add_action('wp_footer', array($this, 'add_eg_additional_inline_javascript')); } /** * Add Slider to the List of choosable media */ public function add_slider_to_eg_ajax($media){ $media['revslider'] = array('name' => __('Slider Revolution', 'revslider'), 'type' => 'ccw'); return $media; } /** * Add Slider to the List of choosable media */ public function set_slider_values_to_eg_ajax($handle, $media_sources, $post, $grid_id){ if($handle !== 'revslider') return false; $slider_source = ''; $values = get_post_custom($post['ID']); if(isset($values['eg_sources_revslider'])){ if(isset($values['eg_sources_revslider'][0])) $slider_source = (isset($values['eg_sources_revslider'][0])) ? $values['eg_sources_revslider'][0] : ''; else $slider_source = (isset($values['eg_sources_revslider'])) ? $values['eg_sources_revslider'] : ''; } if($slider_source === ''){ return false; }else{ return ' data-ajaxtype="'.$handle.'" data-ajaxsource="'.$slider_source.'"'; } } /** * Adds custom meta field into the essential grid meta box for post/pages */ public function add_eg_additional_meta_field($values){ $sld = new RevSliderSlider(); $sliders = $sld->get_sliders(); $shortcodes = array(); if(!empty($sliders)){ $first = true; foreach($sliders as $slider){ $name = $slider->get_param('shortcode','false'); if($name != 'false'){ $shortcodes[$slider->get_id()] = $name; $first = false; } } } $selected_slider = (isset($values['eg_sources_revslider'])) ? $values['eg_sources_revslider'] : ''; if($selected_slider == ''){ $selected_slider = array(); $selected_slider[0] = ''; } ?>
>
$name){ ?>
>