| 1 |
<?php |
| 2 |
if ( ! defined( 'ABSPATH' ) ) { |
| 3 |
exit; // Exit if accessed directly. |
| 4 |
} |
| 5 |
/***************************************************************************************************************************************************** |
| 6 |
****************************************************************************************************************************************************** |
| 7 |
|
| 8 |
Slider Text Options |
| 9 |
|
| 10 |
*////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////* |
| 11 |
if (is_admin()){ |
| 12 |
if ( !function_exists ( "vs_image_options" )){ |
| 13 |
|
| 14 |
add_filter('vs_layer_element_options', 'vs_image_options'); |
| 15 |
function vs_image_options( $element ) { |
| 16 |
$option = array(); |
| 17 |
|
| 18 |
$item = array( |
| 19 |
'name' => __('Image','visual-slider'), |
| 20 |
'id' => 'image', |
| 21 |
'img' => VISUALSLIDER_DIR .'admin/assets/image/layer_image.png' |
| 22 |
|
| 23 |
); |
| 24 |
|
| 25 |
include VISUALSLIDER_PATH . 'layer/mini/position_size.php'; |
| 26 |
|
| 27 |
|
| 28 |
$option[]= array( |
| 29 |
"name" => __('Image','visual-slider'), |
| 30 |
"id" => "image", |
| 31 |
"default" => VISUALSLIDER_DIR.'admin/assets/image/image.png', |
| 32 |
"group" => __('Image','visual-slider'), |
| 33 |
"type" => "image", |
| 34 |
); |
| 35 |
|
| 36 |
|
| 37 |
|
| 38 |
$option[]= array( |
| 39 |
"name" => __('Alignment','visual-slider'), |
| 40 |
"id" => "image_align", |
| 41 |
"type" => "radio_image", |
| 42 |
"default" => 'center', |
| 43 |
"group" => __('Image','visual-slider'), |
| 44 |
"options" => array( |
| 45 |
'left' => VISUALSLIDER_DIR.'admin/assets/image/left.jpg', |
| 46 |
'center' => VISUALSLIDER_DIR.'admin/assets/image/center.jpg', |
| 47 |
'right' => VISUALSLIDER_DIR.'admin/assets/image/right.jpg', |
| 48 |
), |
| 49 |
|
| 50 |
); |
| 51 |
|
| 52 |
if(!empty(wp_unslash(filter_input( INPUT_POST, 'vs_tablet', FILTER_VALIDATE_BOOLEAN )))){ |
| 53 |
|
| 54 |
$option[]= array( |
| 55 |
"responsive" => "tablet", |
| 56 |
"name" => __('Responsive on Tablet','visual-slider'), |
| 57 |
"group" => __('Image','visual-slider'), |
| 58 |
"id" => "tablet_image_align_heading", |
| 59 |
"type" => "heading", |
| 60 |
); |
| 61 |
|
| 62 |
$option[]= array( |
| 63 |
"responsive" => "tablet", |
| 64 |
"name" => __('Alignment on Tablet','visual-slider'), |
| 65 |
"id" => "tablet_image_align", |
| 66 |
"type" => "radio_image", |
| 67 |
"default" => '', |
| 68 |
"group" => __('Image','visual-slider'), |
| 69 |
"options" => array( |
| 70 |
'' => VISUALSLIDER_DIR.'admin/assets/image/none.jpg', |
| 71 |
'left' => VISUALSLIDER_DIR.'admin/assets/image/left.jpg', |
| 72 |
'center' => VISUALSLIDER_DIR.'admin/assets/image/center.jpg', |
| 73 |
'right' => VISUALSLIDER_DIR.'admin/assets/image/right.jpg', |
| 74 |
), |
| 75 |
|
| 76 |
); |
| 77 |
|
| 78 |
|
| 79 |
|
| 80 |
} |
| 81 |
if(!empty(wp_unslash(filter_input( INPUT_POST, 'vs_mobile', FILTER_VALIDATE_BOOLEAN )))){ |
| 82 |
|
| 83 |
|
| 84 |
$option[]= array( |
| 85 |
"responsive" => "mobile", |
| 86 |
"name" => __('Responsive on Mobile','visual-slider'), |
| 87 |
"group" => __('Image','visual-slider'), |
| 88 |
|
| 89 |
"id" => "tablet_image_align_heading", |
| 90 |
"type" => "heading", |
| 91 |
); |
| 92 |
|
| 93 |
$option[]= array( |
| 94 |
"responsive" => "mobile", |
| 95 |
|
| 96 |
"name" => __('Alignment on Mobile','visual-slider'), |
| 97 |
"id" => "mobile_image_align", |
| 98 |
"type" => "radio_image", |
| 99 |
"default" => '', |
| 100 |
"group" => __('Image','visual-slider'), |
| 101 |
|
| 102 |
"options" => array( |
| 103 |
'' => VISUALSLIDER_DIR.'admin/assets/image/none.jpg', |
| 104 |
'left' => VISUALSLIDER_DIR.'admin/assets/image/left.jpg', |
| 105 |
'center' => VISUALSLIDER_DIR.'admin/assets/image/center.jpg', |
| 106 |
'right' => VISUALSLIDER_DIR.'admin/assets/image/right.jpg', |
| 107 |
), |
| 108 |
); |
| 109 |
|
| 110 |
|
| 111 |
} |
| 112 |
|
| 113 |
include VISUALSLIDER_PATH . 'layer/mini/effect.php'; |
| 114 |
|
| 115 |
|
| 116 |
$item['options']=$option; |
| 117 |
$element[]=$item; |
| 118 |
return $element; |
| 119 |
} |
| 120 |
} |
| 121 |
} |
| 122 |
/***************************************************************************************************************************************************** |
| 123 |
****************************************************************************************************************************************************** |
| 124 |
|
| 125 |
Slider Text Config |
| 126 |
|
| 127 |
*///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// |
| 128 |
if ( !function_exists ( "vs_image_perview" )){ |
| 129 |
add_filter('vs_layer_perview_image', 'vs_image_perview'); |
| 130 |
function vs_image_perview( $value ) { |
| 131 |
$option= $value['option']; |
| 132 |
$key= $value['key']; |
| 133 |
|
| 134 |
|
| 135 |
////////////////////////////////////////////////////////////OUTPUT//////////////////////////////////////////////////////////////////////////////////////// |
| 136 |
|
| 137 |
echo '<aside id="vs_perview_layer_'.esc_attr($key).'" class="vs_draggable vs-layer-item " data-key="'.esc_attr($key).'" >'; |
| 138 |
echo '<div class="vs-image vs-layer-content" ></div>'; |
| 139 |
|
| 140 |
echo '<div class="vs-layer-style"> </div>'; |
| 141 |
echo '</aside>'; |
| 142 |
|
| 143 |
} |
| 144 |
} |
| 145 |
if ( !function_exists ( "vs_image_config" )){ |
| 146 |
add_filter('vs_layer_image', 'vs_image_config'); |
| 147 |
function vs_image_config( $value ) { |
| 148 |
$option= $value['option']; |
| 149 |
$key= $value['key']; |
| 150 |
$global_key= $value['global_key']; |
| 151 |
$slide_key= $value['slide_key']; |
| 152 |
|
| 153 |
echo '<aside class="vs-layer-'.esc_attr($key).' vs-layer-item '.esc_attr(vs_layer_effect_class($option)).'" >'; |
| 154 |
|
| 155 |
|
| 156 |
echo '<div class="vs-image vs-layer-content" >'; |
| 157 |
|
| 158 |
if(!empty($option['image'])){ |
| 159 |
|
| 160 |
if(is_numeric($option['image'])){ |
| 161 |
$attachment_image = wp_get_attachment_image_src($option['image'],'full'); |
| 162 |
$value_url=!empty($attachment_image[0])?$attachment_image[0]:''; |
| 163 |
}else{ |
| 164 |
$value_url=$option['image']; |
| 165 |
} |
| 166 |
|
| 167 |
echo '<'.esc_attr('img').' src="'.esc_url($value_url).'">'; |
| 168 |
} |
| 169 |
|
| 170 |
echo '</div>'; |
| 171 |
$css=vs_layer_position( $option); |
| 172 |
$css.= vs_slider_var_align( 'img-ag',$option,'image_align' ); |
| 173 |
$css.=vs_layer_effect( $option); |
| 174 |
|
| 175 |
$item=''; |
| 176 |
if(!empty($global_key)){ |
| 177 |
$item.='.vs-global-'.$global_key.' '; |
| 178 |
} |
| 179 |
if(!empty($slide_key)){ |
| 180 |
$item.='.vs-slide-'.$slide_key.' '; |
| 181 |
} |
| 182 |
if(!empty($key)){ |
| 183 |
$item.='.vs-layer-'.$key.' '; |
| 184 |
} |
| 185 |
echo '<style>'.wp_kses(vs_slider_item_css( $css,$item),vs_kses()).'</style>'; |
| 186 |
|
| 187 |
echo '</aside>'; |
| 188 |
|
| 189 |
} |
| 190 |
} |