Guest User

Untitled

a guest
Feb 27th, 2020
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 26.67 KB | None | 0 0
  1. <?php
  2. /**
  3. * Easy Slider
  4. *
  5. * Shortcode that allows to display a simple slideshow
  6. */
  7. if ( ! defined( 'ABSPATH' ) ) { exit; } // Exit if accessed directly
  8.  
  9.  
  10. if ( ! class_exists( 'avia_sc_slider' ) )
  11. {
  12. class avia_sc_slider extends aviaShortcodeTemplate
  13. {
  14. /**
  15. * Create the config array for the shortcode button
  16. */
  17. function shortcode_insert_button()
  18. {
  19. $this->config['version'] = '1.0';
  20. $this->config['self_closing'] = 'no';
  21.  
  22. $this->config['name'] = __( 'Easy Slider', 'avia_framework' );
  23. $this->config['tab'] = __( 'Media Elements', 'avia_framework' );
  24. $this->config['icon'] = AviaBuilder::$path['imagesURL'] . 'sc-slideshow.png';
  25. $this->config['order'] = 85;
  26. $this->config['target'] = 'avia-target-insert';
  27. $this->config['shortcode'] = 'av_slideshow';
  28. $this->config['shortcode_nested'] = array( 'av_slide' );
  29. $this->config['tooltip'] = __( 'Display a simple slideshow element', 'avia_framework' );
  30. $this->config['disabling_allowed'] = true;
  31. $this->config['id_name'] = 'id';
  32. $this->config['id_show'] = 'yes';
  33. $this->config['alb_desc_id'] = 'alb_description';
  34. }
  35.  
  36. function extra_assets()
  37. {
  38. //load css
  39. wp_enqueue_style( 'avia-module-slideshow', AviaBuilder::$path['pluginUrlRoot'] . 'avia-shortcodes/slideshow/slideshow.css', array( 'avia-layout' ), false );
  40.  
  41. //load js
  42. wp_enqueue_script( 'avia-module-slideshow', AviaBuilder::$path['pluginUrlRoot'] . 'avia-shortcodes/slideshow/slideshow.js', array( 'avia-shortcodes' ), false, true );
  43. wp_enqueue_script( 'avia-module-slideshow-video', AviaBuilder::$path['pluginUrlRoot'] . 'avia-shortcodes/slideshow/slideshow-video.js', array( 'avia-shortcodes' ), false, true );
  44.  
  45.  
  46. }
  47.  
  48. /**
  49. * Popup Elements
  50. *
  51. * If this function is defined in a child class the element automatically gets an edit button, that, when pressed
  52. * opens a modal window that allows to edit the element properties
  53. *
  54. * @return void
  55. */
  56. function popup_elements()
  57. {
  58. $this->elements = array(
  59.  
  60. array(
  61. 'type' => 'tab_container',
  62. 'nodescription' => true
  63. ),
  64.  
  65. array(
  66. 'type' => 'tab',
  67. 'name' => __( 'Content', 'avia_framework' ),
  68. 'nodescription' => true
  69. ),
  70.  
  71. array(
  72. 'type' => 'template',
  73. 'template_id' => $this->popup_key( 'content_slideshow' )
  74. ),
  75.  
  76. array(
  77. 'type' => 'tab_close',
  78. 'nodescription' => true
  79. ),
  80.  
  81. array(
  82. 'type' => 'tab',
  83. 'name' => __( 'Styling', 'avia_framework' ),
  84. 'nodescription' => true
  85. ),
  86.  
  87. array(
  88. 'type' => 'template',
  89. 'template_id' => $this->popup_key( 'styling_general' )
  90. ),
  91.  
  92. array(
  93. 'type' => 'tab_close',
  94. 'nodescription' => true
  95. ),
  96.  
  97. array(
  98. 'type' => 'tab',
  99. 'name' => __( 'Advanced', 'avia_framework' ),
  100. 'nodescription' => true
  101. ),
  102.  
  103. array(
  104. 'type' => 'toggle_container',
  105. 'nodescription' => true
  106. ),
  107.  
  108. array(
  109. 'type' => 'template',
  110. 'template_id' => $this->popup_key( 'advanced_privacy' )
  111. ),
  112.  
  113. array(
  114. 'type' => 'template',
  115. 'template_id' => $this->popup_key( 'advanced_animation' )
  116. ),
  117.  
  118. array(
  119. 'type' => 'template',
  120. 'template_id' => 'screen_options_toggle'
  121. ),
  122.  
  123. array(
  124. 'type' => 'template',
  125. 'template_id' => 'developer_options_toggle',
  126. 'args' => array( 'sc' => $this )
  127. ),
  128.  
  129. array(
  130. 'type' => 'toggle_container_close',
  131. 'nodescription' => true
  132. ),
  133.  
  134. array(
  135. 'type' => 'tab_close',
  136. 'nodescription' => true
  137. ),
  138.  
  139. array(
  140. 'type' => 'tab_container_close',
  141. 'nodescription' => true
  142. )
  143.  
  144. );
  145.  
  146. }
  147.  
  148. /**
  149. * Create and register templates for easier maintainance
  150. *
  151. * @since 4.6.4
  152. */
  153. protected function register_dynamic_templates()
  154. {
  155.  
  156. $this->register_modal_group_templates();
  157.  
  158. /**
  159. * Content Tab
  160. * ===========
  161. */
  162.  
  163. $c = array(
  164. array(
  165. 'type' => 'modal_group',
  166. 'id' => 'content',
  167. 'container_class' => 'avia-element-fullwidth avia-multi-img',
  168. 'modal_title' => __( 'Edit Form Element', 'avia_framework' ),
  169. 'add_label' => __( 'Add single image or video', 'avia_framework' ),
  170. 'std' => array(),
  171. 'creator' => array(
  172. 'name' => __( 'Add Images', 'avia_framework' ),
  173. 'desc' => __( 'Here you can add new Images to the slideshow.', 'avia_framework' ),
  174. 'id' => 'id',
  175. 'type' => 'multi_image',
  176. 'title' => __( 'Add multiple Images', 'avia_framework' ),
  177. 'button' => __( 'Insert Images', 'avia_framework' ),
  178. 'std' => ''
  179. ),
  180. 'subelements' => $this->create_modal()
  181. )
  182. );
  183.  
  184. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'content_slideshow' ), $c );
  185.  
  186. /**
  187. * Styling Tab
  188. * ===========
  189. */
  190.  
  191. $c = array(
  192. array(
  193. 'name' => __( 'Slideshow Image Size', 'avia_framework' ),
  194. 'desc' => __( 'Choose the size of the image that loads into the slideshow.', 'avia_framework' ),
  195. 'id' => 'size',
  196. 'type' => 'select',
  197. 'std' => 'featured',
  198. 'subtype' => AviaHelper::get_registered_image_sizes( array( 'thumbnail', 'logo', 'widget', 'slider_thumb' ) )
  199. ),
  200.  
  201. array(
  202. 'name' => __( 'Slideshow control styling?', 'avia_framework' ),
  203. 'desc' => __( 'Here you can select if and how to display the slideshow controls', 'avia_framework' ),
  204. 'id' => 'control_layout',
  205. 'type' => 'select',
  206. 'std' => '',
  207. 'subtype' => array(
  208. __( 'Default', 'avia_framework' ) => 'av-control-default',
  209. __( 'Minimal White', 'avia_framework' ) => 'av-control-minimal',
  210. __( 'Minimal Black', 'avia_framework' ) => 'av-control-minimal av-control-minimal-dark',
  211. __( 'Hidden', 'avia_framework' ) => 'av-control-hidden'
  212. )
  213. ),
  214.  
  215.  
  216. array(
  217. 'name' => __( 'Use first slides caption as permanent caption', 'avia_framework' ),
  218. 'desc' => __( 'If checked the caption will be placed on top of the slider. Please be aware that all slideshow link settings and other captions will be ignored then', 'avia_framework' ) ,
  219. 'id' => 'perma_caption',
  220. 'std' => '',
  221. 'type' => 'checkbox'
  222. )
  223.  
  224. );
  225.  
  226. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'styling_general' ), $c );
  227.  
  228.  
  229. /**
  230. * Advanced Tab
  231. * ============
  232. */
  233.  
  234. $c = array(
  235. array(
  236. 'name' => __( 'Lazy Load videos', 'avia_framework' ),
  237. 'desc' => __( 'Option to only load the preview image of a video slide. The actual videos will only be fetched once the user clicks on the image (Waiting for user interaction speeds up the inital pageload)', 'avia_framework' ),
  238. 'id' => 'conditional_play',
  239. 'type' => 'select',
  240. 'std' => '',
  241. 'subtype' => array(
  242. __( 'Always load videos', 'avia_framework' ) => '',
  243. __( 'Wait for user interaction or for a slide with active autoplay to load the video', 'avia_framework' ) => 'confirm_all'
  244. ),
  245. )
  246. );
  247.  
  248. $template = array(
  249. array(
  250. 'type' => 'template',
  251. 'template_id' => 'toggle',
  252. 'title' => __( 'Privacy', 'avia_framework' ),
  253. 'content' => $c
  254. ),
  255. );
  256.  
  257. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'advanced_privacy' ), $template );
  258.  
  259.  
  260. $c = array(
  261. array(
  262. 'name' => __( 'Slideshow Transition', 'avia_framework' ),
  263. 'desc' => __( 'Choose the transition for your Slideshow.', 'avia_framework' ),
  264. 'id' => 'animation',
  265. 'type' => 'select',
  266. 'std' => 'slide',
  267. 'subtype' => array(
  268. __( 'Slide sidewards', 'avia_framework' ) => 'slide',
  269. __( 'Slide up/down', 'avia_framework' ) => 'slide_up',
  270. __( 'Fade', 'avia_framework' ) => 'fade'
  271. ),
  272. ),
  273.  
  274. array(
  275. 'name' => __( 'Autorotation active?', 'avia_framework' ),
  276. 'desc' => __( 'Check if the slideshow should rotate by default', 'avia_framework' ),
  277. 'id' => 'autoplay',
  278. 'type' => 'select',
  279. 'std' => 'false',
  280. 'subtype' => array(
  281. __( 'Yes', 'avia_framework' ) => 'true',
  282. __( 'No', 'avia_framework' ) => 'false'
  283. )
  284. ),
  285.  
  286. array(
  287. 'name' => __( 'Stop Autorotation with the last slide', 'avia_framework' ),
  288. 'desc' => __( 'Check if you want to disable autorotation when this last slide is displayed', 'avia_framework' ) ,
  289. 'id' => 'autoplay_stopper',
  290. 'required' => array( 'autoplay', 'equals', 'true' ),
  291. 'std' => '',
  292. 'type' => 'checkbox'
  293. ),
  294.  
  295. array(
  296. 'name' => __( 'Slideshow autorotation duration', 'avia_framework' ),
  297. 'desc' => __( 'Images will be shown the selected amount of seconds.', 'avia_framework' ),
  298. 'id' => 'interval',
  299. 'type' => 'select',
  300. 'std' => '5',
  301. 'required' => array( 'autoplay', 'equals', 'true' ),
  302. 'subtype' => array( '2'=>'2', '3'=>'3', '4'=>'4', '5'=>'5', '6'=>'6', '7'=>'7', '8'=>'8', '9'=>'9', '10'=>'10', '15'=>'15', '20'=>'20', '30'=>'30', '40'=>'40', '60'=>'60', '100'=>'100')
  303. )
  304. );
  305.  
  306. $template = array(
  307. array(
  308. 'type' => 'template',
  309. 'template_id' => 'toggle',
  310. 'title' => __( 'Slider Animation', 'avia_framework' ),
  311. 'content' => $c
  312. ),
  313. );
  314.  
  315. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'advanced_animation' ), $template );
  316.  
  317. }
  318.  
  319.  
  320. /**
  321. * Creates the modal popup for a single entry
  322. *
  323. * @since 4.6.4
  324. * @return array
  325. */
  326. protected function create_modal()
  327. {
  328. $elements = array(
  329.  
  330. array(
  331. 'type' => 'tab_container',
  332. 'nodescription' => true
  333. ),
  334.  
  335. array(
  336. 'type' => 'tab',
  337. 'name' => __( 'Content', 'avia_framework' ),
  338. 'nodescription' => true
  339. ),
  340.  
  341. array(
  342. 'type' => 'template',
  343. 'template_id' => 'toggle_container',
  344. 'templates_include' => array(
  345. $this->popup_key( 'modal_content_slidecontent' ),
  346. $this->popup_key( 'modal_content_fallback' ),
  347. $this->popup_key( 'modal_content_caption' )
  348. ),
  349. 'nodescription' => true
  350. ),
  351.  
  352. array(
  353. 'type' => 'tab_close',
  354. 'nodescription' => true
  355. ),
  356.  
  357. array(
  358. 'type' => 'tab',
  359. 'name' => __( 'Styling', 'avia_framework' ),
  360. 'nodescription' => true
  361. ),
  362.  
  363. array(
  364. 'type' => 'template',
  365. 'template_id' => 'toggle_container',
  366. 'templates_include' => array(
  367. $this->popup_key( 'modal_styling_format' ),
  368. $this->popup_key( 'modal_styling_player' ),
  369. $this->popup_key( 'modal_styling_fonts' )
  370. ),
  371. 'nodescription' => true
  372. ),
  373.  
  374. array(
  375. 'type' => 'tab_close',
  376. 'nodescription' => true
  377. ),
  378.  
  379. array(
  380. 'type' => 'tab',
  381. 'name' => __( 'Advanced', 'avia_framework' ),
  382. 'nodescription' => true
  383. ),
  384.  
  385. array(
  386. 'type' => 'template',
  387. 'template_id' => 'toggle_container',
  388. 'templates_include' => array(
  389. $this->popup_key( 'modal_advanced_heading' ),
  390. $this->popup_key( 'modal_advanced_link' )
  391. ),
  392. 'nodescription' => true
  393. ),
  394.  
  395. array(
  396. 'type' => 'tab_close',
  397. 'nodescription' => true
  398. ),
  399.  
  400. array(
  401. 'type' => 'tab_container_close',
  402. 'nodescription' => true
  403. )
  404.  
  405.  
  406. );
  407.  
  408. return $elements;
  409. }
  410.  
  411. /**
  412. * Register all templates for the modal group popup
  413. *
  414. * @since 4.6.4
  415. */
  416. protected function register_modal_group_templates()
  417. {
  418. /**
  419. * Content Tab
  420. * ===========
  421. */
  422.  
  423. $c = array(
  424. array(
  425. 'name' => __( 'Which type of slide is this?','avia_framework' ),
  426. 'id' => 'slide_type',
  427. 'type' => 'select',
  428. 'std' => '',
  429. 'subtype' => array(
  430. __( 'Image Slide', 'avia_framework' ) => 'image',
  431. __( 'Video Slide', 'avia_framework' ) => 'video',
  432. )
  433. ),
  434.  
  435. array(
  436. 'name' => __( 'Choose another Image', 'avia_framework' ),
  437. 'desc' => __( 'Either upload a new, or choose an existing image from your media library', 'avia_framework' ),
  438. 'id' => 'id',
  439. 'fetch' => 'id',
  440. 'type' => 'image',
  441. 'required' => array( 'slide_type', 'is_empty_or', 'image' ),
  442. 'title' => __( 'Change Image', 'avia_framework' ),
  443. 'button' => __( 'Change Image', 'avia_framework' ),
  444. 'std' => ''
  445. ),
  446.  
  447. array(
  448. 'type' => 'template',
  449. 'template_id' => 'video',
  450. 'required' => array( 'slide_type', 'equals', 'video' ),
  451. 'id' => 'video',
  452. 'args' => array(
  453. 'sc' => $this
  454. )
  455. ),
  456.  
  457. );
  458.  
  459. $template = array(
  460. array(
  461. 'type' => 'template',
  462. 'template_id' => 'toggle',
  463. 'title' => __( 'Select Slide Content', 'avia_framework' ),
  464. 'content' => $c
  465. ),
  466. );
  467.  
  468. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'modal_content_slidecontent' ), $template );
  469.  
  470.  
  471. $c = array(
  472. array(
  473. 'type' => 'template',
  474. 'template_id' => 'slideshow_fallback_image'
  475. )
  476.  
  477. );
  478.  
  479. $template = array(
  480. array(
  481. 'type' => 'template',
  482. 'template_id' => 'toggle',
  483. 'title' => __( 'Fallback images', 'avia_framework' ),
  484. 'content' => $c
  485. ),
  486. );
  487.  
  488. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'modal_content_fallback' ), $template );
  489.  
  490. $c = array(
  491. array(
  492. 'name' => __( 'Caption Title', 'avia_framework' ),
  493. 'desc' => __( 'Enter a caption title for the slide here', 'avia_framework' ) ,
  494. 'id' => 'title',
  495. 'std' => '',
  496. 'type' => 'input'
  497. ),
  498.  
  499. array(
  500. 'name' => __( 'Caption Text', 'avia_framework' ),
  501. 'desc' => __( 'Enter some additional caption text', 'avia_framework' ) ,
  502. 'id' => 'content',
  503. 'type' => 'textarea',
  504. 'std' => '',
  505. )
  506.  
  507. );
  508.  
  509. $template = array(
  510. array(
  511. 'type' => 'template',
  512. 'template_id' => 'toggle',
  513. 'title' => __( 'Slide Caption', 'avia_framework' ),
  514. 'content' => $c
  515. ),
  516. );
  517.  
  518. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'modal_content_caption' ), $template );
  519.  
  520.  
  521. /**
  522. * Styling Tab
  523. * ===========
  524. */
  525.  
  526. $c = array(
  527. array(
  528. 'name' => __( 'Video Aspect Ratio', 'avia_framework' ),
  529. 'desc' => __( 'In order to calculate the correct height and width for the video slide you need to enter a aspect ratio (width:height). usually: 16:9 or 4:3.', 'avia_framework' ) . '<br/>' . __( 'If left empty 16:9 will be used', 'avia_framework' ) ,
  530. 'id' => 'video_ratio',
  531. 'std' => '16:9',
  532. 'type' => 'input',
  533. 'required' => array( 'slide_type', 'equals', 'video' ),
  534. ),
  535.  
  536. /*
  537. array(
  538. 'name' => __( 'Video Size', 'avia_framework' ),
  539. 'desc' => __( 'By default the video will try to match the default slideshow size that was selected in the slider settings at &quot;Slideshow Image and Video Size&quot;', 'avia_framework' ),
  540. 'id' => 'video_format',
  541. 'type' => 'select',
  542. 'std' => '',
  543. 'required' => array( 'slide_type', 'equals', 'video' ),
  544. 'subtype' => array(
  545. __( 'Try to match the default slideshow size (Video will not be cropped, but black borders will be visible at each side)', 'avia_framework' ) => '',
  546. __( 'Try to match the default slideshow size but stretch the video to fill the whole slider (video will be cropped at top and bottom)', 'avia_framework' ) => 'stretch',
  547. __( 'Show the full Video without cropping', 'avia_framework' ) =>'full',
  548. )
  549. ),
  550. */
  551.  
  552.  
  553. );
  554.  
  555. $template = array(
  556. array(
  557. 'type' => 'template',
  558. 'template_id' => 'toggle',
  559. 'title' => __( 'Video Format', 'avia_framework' ),
  560. 'content' => $c
  561. ),
  562. );
  563.  
  564. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'modal_styling_format' ), $template );
  565.  
  566. $c = array(
  567. array(
  568. 'type' => 'template',
  569. 'template_id' => 'slideshow_player',
  570. 'required' => array( 'slide_type', 'equals', 'video' ),
  571. 'content' => $c
  572. ),
  573.  
  574. );
  575.  
  576. $template = array(
  577. array(
  578. 'type' => 'template',
  579. 'template_id' => 'toggle',
  580. 'title' => __( 'Player Settings', 'avia_framework' ),
  581. 'content' => $c
  582. ),
  583. );
  584.  
  585. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'modal_styling_player' ), $template );
  586.  
  587.  
  588. $c = array(
  589. array(
  590. 'name' => __( 'Caption Title Font Size', 'avia_framework' ),
  591. 'desc' => __( 'Select a custom font size for the titles.', 'avia_framework' ),
  592. 'type' => 'template',
  593. 'template_id' => 'font_sizes_icon_switcher',
  594. 'subtype' => array(
  595. // 'default' => AviaHtmlHelper::number_array( 10, 120, 1, array( __( 'Use Default', 'avia_framework' ) => '' ), 'px' ),
  596. 'medium' => AviaHtmlHelper::number_array( 10, 120, 1, array( __( 'Use Default', 'avia_framework' ) => '', __( 'Hidden', 'avia_framework' ) => 'hidden' ), 'px' ),
  597. 'small' => AviaHtmlHelper::number_array( 10, 120, 1, array( __( 'Use Default', 'avia_framework' ) => '', __( 'Hidden', 'avia_framework' ) => 'hidden' ), 'px' ),
  598. 'mini' => AviaHtmlHelper::number_array( 10, 120, 1, array( __( 'Use Default', 'avia_framework' ) => '', __( 'Hidden', 'avia_framework' ) => 'hidden' ), 'px' )
  599. ),
  600. 'id_sizes' => array(
  601. // 'default' => 'custom_title_size',
  602. 'medium' => 'av-medium-font-size-title',
  603. 'small' => 'av-small-font-size-title',
  604. 'mini' => 'av-mini-font-size-title'
  605. )
  606. ),
  607.  
  608. array(
  609. 'name' => __( 'Caption Content Font Size', 'avia_framework' ),
  610. 'desc' => __( 'Select a custom font size for the titles.', 'avia_framework' ),
  611. 'type' => 'template',
  612. 'template_id' => 'font_sizes_icon_switcher',
  613. 'subtype' => array(
  614. // 'default' => AviaHtmlHelper::number_array( 10, 120, 1, array( __( 'Use Default', 'avia_framework' ) => '' ), 'px' ),
  615. 'medium' => AviaHtmlHelper::number_array( 10, 120, 1, array( __( 'Use Default', 'avia_framework' ) => '', __( 'Hidden', 'avia_framework' ) => 'hidden' ), 'px' ),
  616. 'small' => AviaHtmlHelper::number_array( 10, 120, 1, array( __( 'Use Default', 'avia_framework' ) => '', __( 'Hidden', 'avia_framework' ) => 'hidden' ), 'px' ),
  617. 'mini' => AviaHtmlHelper::number_array( 10, 120, 1, array( __( 'Use Default', 'avia_framework' ) => '', __( 'Hidden', 'avia_framework' ) => 'hidden' ), 'px' )
  618. ),
  619. 'id_sizes' => array(
  620. // 'default' => 'custom_size',
  621. 'medium' => 'av-medium-font-size',
  622. 'small' => 'av-small-font-size',
  623. 'mini' => 'av-mini-font-size'
  624. )
  625. ),
  626.  
  627. );
  628.  
  629. $template = array(
  630. array(
  631. 'type' => 'template',
  632. 'template_id' => 'toggle',
  633. 'title' => __( 'Font Sizes', 'avia_framework' ),
  634. 'content' => $c
  635. ),
  636. );
  637.  
  638. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'modal_styling_fonts' ), $template );
  639.  
  640.  
  641. /**
  642. * Advanced Tab
  643. * ===========
  644. */
  645.  
  646. $c = array(
  647. array(
  648. 'name' => __( 'Apply a link to the slide?', 'avia_framework' ),
  649. 'desc' => __( 'You can choose to apply the link to the whole image', 'avia_framework' ),
  650. 'id' => 'link_apply',
  651. 'type' => 'select',
  652. 'std' => 'image',
  653. 'required' => array( 'slide_type', 'is_empty_or', 'image' ),
  654. 'subtype' => array(
  655. __( 'No Link for this slide', 'avia_framework' ) => '',
  656. __( 'Apply Link to Image', 'avia_framework' ) => 'image'
  657. )
  658. ),
  659.  
  660. array(
  661. 'name' => __( 'Image Link?', 'avia_framework' ),
  662. 'desc' => __( 'Where should the Image link to?', 'avia_framework' ),
  663. 'id' => 'link',
  664. 'required' => array( 'link_apply', 'equals', 'image' ),
  665. 'type' => 'linkpicker',
  666. 'fetchTMPL' => true,
  667. 'subtype' => array(
  668. __( 'Open Image in Lightbox', 'avia_framework' ) => 'lightbox',
  669. __( 'Set Manually', 'avia_framework' ) => 'manually',
  670. __( 'Single Entry', 'avia_framework' ) => 'single',
  671. __( 'Taxonomy Overview Page', 'avia_framework' ) => 'taxonomy',
  672. ),
  673. 'std' => ''
  674. ),
  675.  
  676. array(
  677. 'name' => __( 'Open Link in new Window?', 'avia_framework' ),
  678. 'desc' => __( 'Select here if you want to open the linked page in a new window', 'avia_framework' ),
  679. 'id' => 'link_target',
  680. 'type' => 'select',
  681. 'std' => '',
  682. 'required' => array( 'link', 'not_empty_and', 'lightbox' ),
  683. 'subtype' => AviaHtmlHelper::linking_options()
  684. )
  685.  
  686. );
  687.  
  688. $template = array(
  689. array(
  690. 'type' => 'template',
  691. 'template_id' => 'toggle',
  692. 'title' => __( 'Link Settings', 'avia_framework' ),
  693. 'content' => $c
  694. ),
  695. );
  696.  
  697. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'modal_advanced_link' ), $template );
  698.  
  699.  
  700. $c = array(
  701. array(
  702. 'type' => 'template',
  703. 'template_id' => 'heading_tag',
  704. 'theme_default' => 'h2',
  705. 'context' => __CLASS__
  706. ),
  707.  
  708.  
  709. );
  710.  
  711. $template = array(
  712. array(
  713. 'type' => 'template',
  714. 'template_id' => 'toggle',
  715. 'title' => __( 'Heading Tag', 'avia_framework' ),
  716. 'content' => $c
  717. ),
  718. );
  719.  
  720. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'modal_advanced_heading' ), $template );
  721.  
  722. }
  723.  
  724. /**
  725. * Editor Element - this function defines the visual appearance of an element on the AviaBuilder Canvas
  726. * Most common usage is to define some markup in the $params['innerHtml'] which is then inserted into the drag and drop container
  727. * Less often used: $params['data'] to add data attributes, $params['class'] to modify the className
  728. *
  729. *
  730. * @param array $params this array holds the default values for $content and $args.
  731. * @return $params the return array usually holds an innerHtml key that holds item specific markup.
  732. */
  733. function editor_element( $params )
  734. {
  735. $params = parent::editor_element( $params );
  736. return $params;
  737. }
  738.  
  739. /**
  740. * Editor Sub Element - this function defines the visual appearance of an element that is displayed within a modal window and on click opens its own modal window
  741. * Works in the same way as Editor Element
  742. * @param array $params this array holds the default values for $content and $args.
  743. * @return $params the return array usually holds an innerHtml key that holds item specific markup.
  744. */
  745. function editor_sub_element( $params )
  746. {
  747. $img_template = $this->update_template( 'img_fakeArg', '{{img_fakeArg}}' );
  748. $template = $this->update_template( 'title', '{{title}}' );
  749. $content = $this->update_template( 'content', '{{content}}' );
  750. $video = $this->update_template( 'video', '{{video}}' );
  751. $thumbnail = isset( $params['args']['id'] ) ? wp_get_attachment_image( $params['args']['id'] ) : '';
  752.  
  753.  
  754. $params['innerHtml'] = '';
  755. $params['innerHtml'] .= "<div class='avia_title_container'>";
  756. $params['innerHtml'] .= '<div ' . $this->class_by_arguments( 'slide_type' ,$params['args'] ) . '>';
  757. $params['innerHtml'] .= "<span class='avia_slideshow_image' {$img_template} >{$thumbnail}</span>";
  758. $params['innerHtml'] .= "<div class='avia_slideshow_content'>";
  759. $params['innerHtml'] .= "<h4 class='avia_title_container_inner' {$template} >{$params['args']['title']}</h4>";
  760. $params['innerHtml'] .= "<p class='avia_content_container' {$content}>" . stripslashes($params['content']) . '</p>';
  761. $params['innerHtml'] .= "<small class='avia_video_url' {$video}>" . stripslashes( $params['args']['video'] ) . '</small>';
  762. $params['innerHtml'] .= '</div>';
  763. $params['innerHtml'] .= '</div>';
  764. $params['innerHtml'] .= '</div>';
  765.  
  766. return $params;
  767. }
  768.  
  769.  
  770. /**
  771. * Frontend Shortcode Handler
  772. *
  773. * @param array $atts array of attributes
  774. * @param string $content text within enclosing form of shortcode element
  775. * @param string $shortcodename the shortcode found, when == callback name
  776. * @return string $output returns the modified html string
  777. */
  778. function shortcode_handler( $atts, $content = '', $shortcodename = '', $meta = '' )
  779. {
  780. extract( AviaHelper::av_mobile_sizes( $atts) ); //return $av_font_classes, $av_title_font_classes and $av_display_classes
  781.  
  782. $atts = shortcode_atts( array(
  783. 'size' => 'featured',
  784. 'animation' => 'slide',
  785. 'conditional_play' => '',
  786. 'ids' => '',
  787. 'autoplay' => 'false',
  788. 'interval' => 5,
  789. 'control_layout' => '',
  790. 'perma_caption' => '',
  791. 'handle' => $shortcodename,
  792. 'content' => ShortcodeHelper::shortcode2array( $content, 1 ),
  793. 'class' => $meta['el_class'] . ' ' . $av_display_classes,
  794. 'custom_markup' => $meta['custom_markup'],
  795. 'autoplay_stopper' =>''
  796.  
  797. ), $atts, $this->config['shortcode'] );
  798.  
  799.  
  800. /**
  801. * For videos reset any image related link settings - might brek frontend output
  802. */
  803. foreach ( $atts['content'] as &$slide )
  804. {
  805. if( isset( $slide['attr']['slide_type'] ) && 'video' == $slide['attr']['slide_type'] )
  806. {
  807. $slide['attr']['link_apply'] = '';
  808. }
  809. }
  810.  
  811. unset( $slide );
  812.  
  813. $atts['el_id'] = $meta['custom_el_id'];
  814.  
  815. $slider = new avia_slideshow( $atts );
  816. return $slider->html();
  817. }
  818.  
  819. }
  820. }
Advertisement
Add Comment
Please, Sign In to add comment