AbstraktEnfold

Untitled

Mar 19th, 2025
61
0
50 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 56.36 KB | None | 0 0
  1. <?php
  2. /**
  3. * AMG Tabs and tabs
  4. *
  5. * Creates tabs or accordions
  6. */
  7. if( ! defined( 'ABSPATH' ) ) { exit; } // Exit if accessed directly
  8.  
  9.  
  10. if( ! class_exists( 'amg_sc_cards', false ) )
  11. {
  12. class amg_sc_cards extends aviaShortcodeTemplate
  13. {
  14. use \aviaBuilder\traits\scNamedColors;
  15. use \aviaBuilder\traits\scButtonStyles;
  16. /**
  17. *
  18. * @var int
  19. */
  20. static protected $toggle_id = 1;
  21.  
  22. /**
  23. *
  24. * @var int
  25. */
  26. static protected $counter = 1;
  27.  
  28. /**
  29. *
  30. * @var int
  31. */
  32. static protected $initial = 0;
  33.  
  34. /**
  35. *
  36. * @var array
  37. */
  38. static protected $tags = array();
  39.  
  40. /**
  41. * Google search only accepts 1 Tag “FAQPage”
  42. *
  43. * @since 5.0
  44. * @var int
  45. */
  46. static protected $total = 0;
  47.  
  48. /**
  49. *
  50. * @since 4.8.8
  51. * @var boolean
  52. */
  53. protected $in_sc_exec;
  54.  
  55. /**
  56. *
  57. * @since 4.9
  58. * @var string
  59. */
  60. protected $heading_tag;
  61.  
  62. /**
  63. *
  64. * @since 4.9
  65. * @var string
  66. */
  67. protected $heading_class;
  68.  
  69. /**
  70. *
  71. * @since 4.5.5
  72. * @param AviaBuilder $builder
  73. */
  74. public function __construct( $builder )
  75. {
  76. $this->in_sc_exec = false;
  77. $this->heading_tag = '';
  78. $this->heading_class = '';
  79.  
  80. parent::__construct( $builder );
  81.  
  82. $this->_construct_scNamedColors();
  83. $this->_construct_scButtonStyles();
  84. }
  85.  
  86. /**
  87. * @since 4.5.5
  88. */
  89. public function __destruct()
  90. {
  91. $this->_destruct_scNamedColors();
  92. $this->_destruct_scButtonStyles();
  93. parent::__destruct();
  94. }
  95.  
  96. /**
  97. * Create the config array for the shortcode button
  98. */
  99. protected function shortcode_insert_button()
  100. {
  101. $this->config['version'] = '1.0';
  102. $this->config['self_closing'] = 'no';
  103. $this->config['base_element'] = 'yes';
  104.  
  105. $this->config['name'] = __( 'Cards', 'avia_framework' );
  106. $this->config['tab'] = __( 'AMG Elements', 'avia_framework' );
  107. $this->config['icon'] = AviaBuilder::$path['imagesURL'] . 'sc-contentslider.png';
  108. $this->config['order'] = 270;
  109. $this->config['target'] = 'avia-target-insert';
  110. $this->config['shortcode'] = 'amg_card_container';
  111. $this->config['shortcode_nested'] = array( 'amg_card' );
  112. $this->config['tooltip'] = __( 'Creates a new Cards Layout Group', 'avia_framework' );
  113. $this->config['tinyMCE'] = array( 'tiny_always' => true );
  114. $this->config['preview'] = true;
  115. $this->config['disabling_allowed'] = true;
  116. $this->config['id_name'] = 'id';
  117. $this->config['id_show'] = 'yes';
  118. $this->config['alb_desc_id'] = 'alb_description';
  119. $this->config['name_item'] = __( 'AMG Card Item', 'avia_framework' );
  120. $this->config['tooltip_item'] = __( 'An AMG Card Item', 'avia_framework' );
  121. }
  122.  
  123. protected function admin_assets()
  124. {
  125. $ver = AbstraktEnfoldExtensions::get_plugin_version();
  126. $developMode = AbstraktEnfoldExtensions::developMode();
  127. $lastmodtime = $developMode ? rand(1, 999999999) : $ver;
  128. //load css
  129. wp_enqueue_style( 'amg-cards', plugin_dir_url(__FILE__) . "cards.min.css", array( 'avia-layout' ), $lastmodtime );
  130. wp_enqueue_script( 'amg-cards', plugin_dir_url(__FILE__) . "cards.min.js", array( 'avia-shortcodes' ), $lastmodtime, true );
  131.  
  132. }
  133.  
  134. protected function extra_assets()
  135. {
  136.  
  137. $ver = AbstraktEnfoldExtensions::get_plugin_version();
  138. $developMode = AbstraktEnfoldExtensions::developMode();
  139. $lastmodtime = $developMode ? rand(1, 999999999) : $ver;
  140. //load css
  141. wp_enqueue_style( 'amg-cards', plugin_dir_url(__FILE__) . "cards.css", array( 'avia-layout' ), $lastmodtime );
  142. wp_enqueue_script( 'amg-cards', plugin_dir_url(__FILE__) . "cards.js", array( 'avia-shortcodes' ), $lastmodtime, true );
  143. }
  144.  
  145. /**
  146. * Popup Elements
  147. *
  148. * If this function is defined in a child class the element automatically gets an edit button, that, when pressed
  149. * opens a modal window that allows to edit the element properties
  150. *
  151. * @return void
  152. */
  153. protected function popup_elements()
  154. {
  155. $this->elements = array(
  156.  
  157. array(
  158. 'type' => 'tab_container',
  159. 'nodescription' => true
  160. ),
  161.  
  162. array(
  163. 'type' => 'tab',
  164. 'name' => __( 'Content', 'avia_framework' ),
  165. 'nodescription' => true
  166. ),
  167.  
  168. array(
  169. 'type' => 'template',
  170. 'template_id' => 'toggle_container',
  171. 'templates_include' => array(
  172. $this->popup_key( 'content_amg_card' )
  173. ),
  174. 'nodescription' => true
  175. ),
  176.  
  177. array(
  178. 'type' => 'tab_close',
  179. 'nodescription' => true
  180. ),
  181.  
  182. array(
  183. 'type' => 'tab',
  184. 'name' => __( 'Automation', 'avia_framework' ),
  185. 'nodescription' => true
  186. ),
  187.  
  188. array(
  189. 'type' => 'template',
  190. 'template_id' => 'toggle_container',
  191. 'templates_include' => array(
  192. $this->popup_key( 'behavior_intro' ),
  193. $this->popup_key( 'style_behavior' )
  194. ),
  195. 'nodescription' => true
  196. ),
  197.  
  198. array(
  199. 'type' => 'tab_close',
  200. 'nodescription' => true
  201. ),
  202.  
  203. array(
  204. 'type' => 'tab',
  205. 'name' => __( 'Styling', 'avia_framework' ),
  206. 'nodescription' => true
  207. ),
  208.  
  209. array(
  210. 'type' => 'template',
  211. 'template_id' => 'toggle_container',
  212. 'templates_include' => array(
  213. $this->popup_key( 'styling_card_dimensions' ),
  214. $this->popup_key( 'styling_colors' ),
  215. $this->popup_key( 'styling_font_sizes' )
  216. ),
  217. 'nodescription' => true
  218. ),
  219.  
  220. array(
  221. 'type' => 'tab_close',
  222. 'nodescription' => true
  223. ),
  224.  
  225. array(
  226. 'type' => 'tab',
  227. 'name' => __( 'Advanced', 'avia_framework' ),
  228. 'nodescription' => true
  229. ),
  230.  
  231. array(
  232. 'type' => 'toggle_container',
  233. 'nodescription' => true
  234. ),
  235.  
  236. array(
  237. 'type' => 'template',
  238. 'template_id' => $this->popup_key( 'advanced_heading' ),
  239. 'nodescription' => true
  240. ),
  241.  
  242. array(
  243. 'type' => 'template',
  244. 'template_id' => 'screen_options_toggle',
  245. 'lockable' => true
  246. ),
  247.  
  248. array(
  249. 'type' => 'template',
  250. 'template_id' => 'developer_options_toggle',
  251. 'args' => array( 'sc' => $this )
  252. ),
  253.  
  254. array(
  255. 'type' => 'toggle_container_close',
  256. 'nodescription' => true
  257. ),
  258.  
  259. array(
  260. 'type' => 'tab_close',
  261. 'nodescription' => true
  262. ),
  263.  
  264. array(
  265. 'type' => 'template',
  266. 'template_id' => 'element_template_selection_tab',
  267. 'args' => array( 'sc' => $this )
  268. ),
  269.  
  270. array(
  271. 'type' => 'tab_container_close',
  272. 'nodescription' => true
  273. )
  274.  
  275.  
  276. );
  277.  
  278. }
  279.  
  280. /**
  281. * Create and register templates for easier maintainance
  282. *
  283. * @since 4.6.4
  284. */
  285. protected function register_dynamic_templates()
  286. {
  287.  
  288. $this->register_modal_group_templates();
  289.  
  290. /**
  291. * Content Tab
  292. * ===========
  293. */
  294.  
  295. $c = array(
  296. array(
  297. 'name' => __( 'Add/Edit Card', 'avia_framework' ),
  298. 'desc' => __( 'Here you can add, remove and edit the tabs you want to display.', 'avia_framework' ),
  299. 'type' => 'modal_group',
  300. 'id' => 'content',
  301. 'modal_title' => __( 'Edit Card Element', 'avia_framework' ),
  302. 'editable_item' => true,
  303. 'lockable' => true,
  304. 'tmpl_set_default' => false,
  305. 'std' => array(
  306. array( 'title' => __( 'Card 1', 'avia_framework' ), 'tags' => '' ),
  307. array( 'title' => __( 'Card 2', 'avia_framework' ), 'tags' => '' ),
  308. ),
  309. 'subelements' => $this->create_modal()
  310. ),
  311.  
  312. array(
  313. 'name' => __( 'Title Position', 'avia_framework' ),
  314. 'desc' => __( 'Select one of the 4 choices', 'avia_framework' ),
  315. 'id' => 'title_position',
  316. 'type' => 'select',
  317. 'std' => 'bottom',
  318. 'lockable' => true,
  319. 'subtype' => array(
  320. __( 'Top', 'avia_framework' ) => 'top',
  321. __( 'Bottom', 'avia_framework' ) => 'bottom',
  322. __( 'Full', 'avia_framework' ) => 'full',
  323. __( 'None', 'avia_framework' ) => 'none',
  324. )
  325. )
  326. );
  327.  
  328. $template = array(
  329. array(
  330. 'type' => 'template',
  331. 'template_id' => 'toggle',
  332. 'title' => __( 'Cards', 'avia_framework' ),
  333. 'content' => $c
  334. ),
  335. );
  336.  
  337. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'content_amg_card' ), $template );
  338.  
  339.  
  340. $c = array(
  341.  
  342. array(
  343. 'name' => __( 'Hover Animation', 'avia_framework' ),
  344. 'desc' => __( 'Select the style of hover animation', 'avia_framework' ),
  345. 'id' => 'animation',
  346. 'type' => 'select',
  347. 'std' => 'up',
  348. 'lockable' => true,
  349. 'subtype' => array(
  350. __( 'Up', 'avia_framework' ) => 'up',
  351. __( 'Down', 'avia_framework' ) => 'down',
  352. __( 'Fade', 'avia_framework' ) => 'fade',
  353. __( 'Flip', 'avia_framework' ) => 'flip',
  354. )
  355. ),
  356. array(
  357. 'name' => __( 'Column Order', 'avia_framework' ),
  358. 'desc' => __( 'Select the column order', 'avia_framework' ),
  359. 'id' => 'column',
  360. 'type' => 'select',
  361. 'std' => 'row',
  362. 'lockable' => true,
  363. 'subtype' => array(
  364. __( 'Forward', 'avia_framework' ) => 'row',
  365. __( 'Reverse', 'avia_framework' ) => 'row-reverse',
  366. )
  367. )
  368. );
  369.  
  370. $template = array(
  371. array(
  372. 'type' => 'template',
  373. 'template_id' => 'toggle',
  374. 'title' => __( 'Hover', 'avia_framework' ),
  375. 'content' => $c
  376. ),
  377. );
  378.  
  379. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'style_behavior' ), $template );
  380.  
  381.  
  382. $c = array(
  383. array(
  384. 'name' => __( 'Intro', 'avia_framework' ),
  385. 'desc' => __( 'Choose to use active style class', 'avia_framework' ),
  386. 'id' => 'intro',
  387. 'type' => 'select',
  388. 'std' => '',
  389. 'lockable' => true,
  390. 'subtype' => AbstraktEnfoldExtensions::get_intro_animations()
  391. ),
  392. array(
  393. 'name' => __( 'Duration', 'avia_framework' ),
  394. 'desc' => __( 'Select duration of time this animation will run', 'avia_framework' ),
  395. 'id' => 'duration',
  396. 'type' => 'select',
  397. 'std' => 's100',
  398. 'lockable' => true,
  399. 'required' => array( 'intro', 'not', '' ),
  400. 'subtype' => AbstraktEnfoldExtensions::get_duration_times()
  401. ),
  402.  
  403. );
  404. $template = array(
  405. array(
  406. 'type' => 'template',
  407. 'template_id' => 'toggle',
  408. 'title' => __( 'Intro', 'avia_framework' ),
  409. 'content' => $c
  410. ),
  411. );
  412.  
  413. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'behavior_intro' ), $template );
  414.  
  415. /**
  416. * Styling Tab
  417. * ===========
  418. */
  419. $c = array(
  420. array(
  421. 'name' => __( 'Container Layout', 'avia_framework' ),
  422. 'desc' => __( 'Either use the widget default colors or apply some custom ones', 'avia_framework' ),
  423. 'id' => 'card_layout',
  424. 'type' => 'select',
  425. 'std' => '',
  426. 'lockable' => true,
  427. 'subtype' => array(
  428. __( 'Default', 'avia_framework' ) => '',
  429. __( 'Define Custom layout', 'avia_framework' ) => 'custom'
  430. ),
  431. ),
  432. array(
  433. 'name' => __( 'Container Max Width', 'avia_framework' ),
  434. 'desc' => __( 'Enter your minimum height for each glow in pixels', 'avia_framework' ),
  435. 'id' => 'max_width',
  436. 'type' => 'input',
  437. 'std' => '1400px',
  438. 'lockable' => true,
  439. 'required' => array( 'card_layout', 'equals', 'custom' )
  440. ),
  441. array(
  442. 'name' => __( 'Container Min Height', 'avia_framework' ),
  443. 'desc' => __( 'Enter your minimum height for each card in pixels', 'avia_framework' ),
  444. 'id' => 'min_height',
  445. 'type' => 'input',
  446. 'std' => '580px',
  447. 'lockable' => true,
  448. 'required' => array( 'card_layout', 'equals', 'custom' )
  449. ),
  450. array(
  451. 'name' => __( 'Column Count', 'avia_framework' ),
  452. 'desc' => __( 'This number will be the maximum number of cards per row.', 'avia_framework' ),
  453. 'id' => 'flex',
  454. 'type' => 'select',
  455. 'std' => '0 1 33.33%',
  456. 'lockable' => true,
  457. 'subtype' => array(
  458. __( '1', 'avia_framework' ) => '0 1 100%',
  459. __( '2', 'avia_framework' ) => '0 1 50%',
  460. __( '3', 'avia_framework' ) => '0 1 33.33%',
  461. __( '4', 'avia_framework' ) => '0 1 25%',
  462. __( '5', 'avia_framework' ) => '0 1 20%'
  463. ),
  464. 'required' => array( 'card_layout', 'equals', 'custom' )
  465. ),
  466. array(
  467. 'name' => __( 'Box Shadow', 'avia_framework' ),
  468. 'desc' => __( 'Either use the card default box shadow or apply a custom one', 'avia_framework' ),
  469. 'id' => 'box',
  470. 'type' => 'select',
  471. 'std' => '',
  472. 'lockable' => true,
  473. 'subtype' => array(
  474. __( 'Default', 'avia_framework' ) => '',
  475. __( 'Define Box Shadow', 'avia_framework' ) => 'custom'
  476. )
  477. ),
  478. array(
  479. 'name' => __( 'Box Shadow', 'avia_framework' ),
  480. 'desc' => __( 'Enter your custom box-shadow using standard CSS Syntax', 'avia_framework' ),
  481. 'id' => 'box-shadow',
  482. 'type' => 'input',
  483. 'std' => '0 0 3px #ccc',
  484. 'rgba' => true,
  485. 'lockable' => true,
  486. 'required' => array( 'box', 'equals', 'custom' ),
  487. ),
  488. array(
  489. 'name' => __( 'Border Radius', 'avia_framework' ),
  490. 'desc' => __( 'Set the border radius of the column', 'avia_framework' ),
  491. 'id' => 'border_radius',
  492. 'type' => 'multi_input',
  493. 'sync' => true,
  494. 'std' => '',
  495. 'lockable' => true,
  496. 'multi' => array(
  497. 'top' => __( 'Top-Left-Radius', 'avia_framework' ),
  498. 'right' => __( 'Top-Right-Radius', 'avia_framework' ),
  499. 'bottom' => __( 'Bottom-Right-Radius', 'avia_framework' ),
  500. 'left' => __( 'Bottom-Left-Radius', 'avia_framework' )
  501. )
  502. ),
  503. array(
  504. 'name' => __( 'Folded Corner', 'avia_framework' ),
  505. 'desc' => __( 'Set the border radius of the column', 'avia_framework' ),
  506. 'id' => 'corner',
  507. 'type' => 'select',
  508. 'std' => '',
  509. 'lockable' => true,
  510. 'subtype' => array(
  511. __( 'Yes', 'avia_framework' ) => 'yes',
  512. __( 'No', 'avia_framework' ) => 'no'
  513. )
  514. ),
  515.  
  516. );
  517. $template = array(
  518. array(
  519. 'type' => 'template',
  520. 'template_id' => 'toggle',
  521. 'title' => __( 'Container', 'avia_framework' ),
  522. 'content' => $c
  523. ),
  524. );
  525.  
  526. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'styling_card_dimensions' ), $template );
  527.  
  528.  
  529. $c = array(
  530. array(
  531. 'name' => __( 'Colors', 'avia_framework' ),
  532. 'desc' => __( 'Either use the themes default colors or apply some custom ones', 'avia_framework' ),
  533. 'id' => 'colors',
  534. 'type' => 'select',
  535. 'std' => '',
  536. 'lockable' => true,
  537. 'subtype' => array(
  538. __( 'Default', 'avia_framework' ) => '',
  539. __( 'Define Custom Colors', 'avia_framework' ) => 'custom'
  540. )
  541. ),
  542.  
  543. array(
  544. 'name' => __( 'Title Font Color', 'avia_framework' ),
  545. 'desc' => __( 'Select a custom color for the toggle icon. Leave empty to use default', 'avia_framework' ),
  546. 'id' => 'title_font_color',
  547. 'type' => 'colorpicker',
  548. 'std' => '',
  549. 'rgba' => true,
  550. 'lockable' => true,
  551. 'required' => array( 'colors', 'equals', 'custom' ),
  552. 'container_class' => 'av_third av_third_first',
  553. ),
  554. array(
  555. 'name' => __( 'Title Background Color', 'avia_framework' ),
  556. 'desc' => __( 'Select a custom color for the toggle icon. Leave empty to use default', 'avia_framework' ),
  557. 'id' => 'title_bg_color',
  558. 'type' => 'colorpicker',
  559. 'std' => '',
  560. 'rgba' => true,
  561. 'lockable' => true,
  562. 'required' => array( 'colors', 'equals', 'custom' ),
  563. 'container_class' => 'av_third av_third_last',
  564. ),
  565.  
  566. array(
  567. 'name' => __( 'Content Font Color', 'avia_framework' ),
  568. 'desc' => __( 'Select a custom font color. Leave empty to use the default', 'avia_framework' ),
  569. 'id' => 'font_color',
  570. 'type' => 'colorpicker',
  571. 'std' => '',
  572. 'rgba' => true,
  573. 'lockable' => true,
  574. 'required' => array( 'colors', 'equals', 'custom' ),
  575. 'container_class' => 'av_third av_third_first'
  576. ),
  577.  
  578. array(
  579. 'name' => __( 'Background Color', 'avia_framework' ),
  580. 'desc' => __( 'Select a custom background color. Leave empty to use the default', 'avia_framework' ),
  581. 'id' => 'background_color',
  582. 'type' => 'colorpicker',
  583. 'std' => '',
  584. 'rgba' => true,
  585. 'lockable' => true,
  586. 'required' => array( 'colors', 'equals', 'custom' ),
  587. 'container_class' => 'av_third',
  588. )
  589. );
  590.  
  591. $template = array(
  592. array(
  593. 'type' => 'template',
  594. 'template_id' => 'toggle',
  595. 'title' => __( 'Colors', 'avia_framework' ),
  596. 'content' => $c
  597. ),
  598. );
  599.  
  600. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'styling_colors' ), $template );
  601.  
  602. $c = array(
  603. array(
  604. 'name' => __( 'Title Font Sizes', 'avia_framework' ),
  605. 'desc' => __( 'Select a custom font size for the toggle title. Using non default values might need CSS styling.', 'avia_framework' ),
  606. 'type' => 'template',
  607. 'template_id' => 'font_sizes_icon_switcher',
  608. 'lockable' => true,
  609. 'textfield' => true,
  610. 'subtype' => array(
  611. 'default' => AviaHtmlHelper::number_array( 10, 50, 1, array( __( 'Use Default', 'avia_framework' ) => '' ), 'px' ),
  612. 'desktop' => AviaHtmlHelper::number_array( 10, 50, 1, array( __( 'Use Default', 'avia_framework' ) => '' ), 'px' ),
  613. 'medium' => AviaHtmlHelper::number_array( 10, 40, 1, array( __( 'Use Default', 'avia_framework' ) => '', __( 'Hidden', 'avia_framework' ) => 'hidden' ), 'px' ),
  614. 'small' => AviaHtmlHelper::number_array( 10, 40, 1, array( __( 'Use Default', 'avia_framework' ) => '', __( 'Hidden', 'avia_framework' ) => 'hidden' ), 'px' ),
  615. 'mini' => AviaHtmlHelper::number_array( 10, 40, 1, array( __( 'Use Default', 'avia_framework' ) => '', __( 'Hidden', 'avia_framework' ) => 'hidden' ), 'px' )
  616. ),
  617. 'id_sizes' => array(
  618. 'default' => 'size-title',
  619. 'desktop' => 'av-desktop-font-size-toggle',
  620. 'medium' => 'av-medium-font-size-toggle',
  621. 'small' => 'av-small-font-size-toggle',
  622. 'mini' => 'av-mini-font-size-toggle'
  623. )
  624. ),
  625.  
  626. array(
  627. 'name' => __( 'Content Font Sizes', 'avia_framework' ),
  628. 'desc' => __( 'Select a custom font size for the content.', 'avia_framework' ),
  629. 'type' => 'template',
  630. 'template_id' => 'font_sizes_icon_switcher',
  631. 'lockable' => true,
  632. 'textfield' => true,
  633. 'subtype' => array(
  634. 'default' => AviaHtmlHelper::number_array( 10, 50, 1, array( __( 'Use Default', 'avia_framework' ) => '' ), 'px' ),
  635. 'desktop' => AviaHtmlHelper::number_array( 10, 50, 1, array( __( 'Use Default', 'avia_framework' ) => '' ), 'px' ),
  636. 'medium' => AviaHtmlHelper::number_array( 10, 40, 1, array( __( 'Use Default', 'avia_framework' ) => '', __( 'Hidden', 'avia_framework' ) => 'hidden' ), 'px' ),
  637. 'small' => AviaHtmlHelper::number_array( 10, 40, 1, array( __( 'Use Default', 'avia_framework' ) => '', __( 'Hidden', 'avia_framework' ) => 'hidden' ), 'px' ),
  638. 'mini' => AviaHtmlHelper::number_array( 10, 40, 1, array( __( 'Use Default', 'avia_framework' ) => '', __( 'Hidden', 'avia_framework' ) => 'hidden' ), 'px' )
  639. ),
  640. 'id_sizes' => array(
  641. 'default' => 'size-content',
  642. 'desktop' => 'av-desktop-font-size-content',
  643. 'medium' => 'av-medium-font-size-content',
  644. 'small' => 'av-small-font-size-content',
  645. 'mini' => 'av-mini-font-size-content'
  646. )
  647. )
  648.  
  649. );
  650.  
  651. $template = array(
  652. array(
  653. 'type' => 'template',
  654. 'template_id' => 'toggle',
  655. 'title' => __( 'Font Sizes', 'avia_framework' ),
  656. 'content' => $c
  657. ),
  658. );
  659.  
  660. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'styling_font_sizes' ), $template );
  661.  
  662.  
  663. /**
  664. * Advanced Tab
  665. * ============
  666. */
  667.  
  668. $c = array(
  669. array(
  670. 'type' => 'template',
  671. 'template_id' => 'heading_tag',
  672. 'theme_default' => 'p',
  673. 'name' => __( 'Tab Title Tag (Theme Default is &lt;%s&gt;)', 'avia_framework' ),
  674. 'desc' => __( 'Select a html tag for the toggle titles of this element.', 'avia_framework' ),
  675. 'context' => __CLASS__,
  676. 'lockable' => true
  677. ),
  678.  
  679. );
  680.  
  681. $template = array(
  682. array(
  683. 'type' => 'template',
  684. 'template_id' => 'toggle',
  685. 'title' => __( 'Tab Titles', 'avia_framework' ),
  686. 'content' => $c
  687. ),
  688. );
  689.  
  690. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'advanced_heading' ), $template );
  691.  
  692. }
  693.  
  694. /**
  695. * Creates the modal popup for a single entry
  696. *
  697. * @since 4.6.4
  698. * @return array
  699. */
  700. protected function create_modal()
  701. {
  702. $elements = array(
  703.  
  704. array(
  705. 'type' => 'tab_container',
  706. 'nodescription' => true
  707. ),
  708.  
  709. array(
  710. 'type' => 'tab',
  711. 'name' => __( 'Content', 'avia_framework' ),
  712. 'nodescription' => true
  713. ),
  714.  
  715. array(
  716. 'type' => 'template',
  717. 'template_id' => 'toggle_container',
  718. 'templates_include' => array(
  719. $this->popup_key( 'modal_card_title' ),
  720. $this->popup_key( 'modal_card_image' ),
  721. $this->popup_key( 'modal_card_content' )
  722. ),
  723. ),
  724.  
  725. array(
  726. 'type' => 'tab_close',
  727. 'nodescription' => true
  728. ),
  729. ///////////////////////////// BUTTON START //////////////////////////////
  730.  
  731. array(
  732. 'type' => 'tab',
  733. 'name' => __( 'Button', 'avia_framework' ),
  734. 'nodescription' => true
  735. ),
  736. array(
  737. 'type' => 'template',
  738. 'template_id' => 'toggle_container',
  739. 'templates_include' => array(
  740. $this->popup_key( 'modal_button' ),
  741. $this->popup_key( 'modal_button_link' ),
  742. $this->popup_key( 'styling_button_appearance' ),
  743. $this->popup_key( 'styling_button_fonts' ),
  744. $this->popup_key( 'styling_button_margin_padding' ),
  745. $this->popup_key( 'styling_button_colors' ),
  746. 'border_toggle',
  747. 'box_shadow_toggle',
  748. $this->popup_key( 'advanced_button_animation' )
  749. ),
  750. 'nodescription' => true
  751. ),
  752. array(
  753. 'type' => 'tab_close',
  754. 'nodescription' => true
  755. ),
  756. ///////////////////////////// BUTTON END ////////////////////////////////
  757.  
  758. array(
  759. 'type' => 'tab',
  760. 'name' => __( 'Advanced', 'avia_framework' ),
  761. 'nodescription' => true
  762. ),
  763.  
  764. array(
  765. 'type' => 'template',
  766. 'template_id' => 'toggle_container',
  767. 'templates_include' => array(
  768. $this->popup_key( 'modal_advanced_developer' )
  769. ),
  770. 'nodescription' => true
  771. ),
  772.  
  773. array(
  774. 'type' => 'tab_close',
  775. 'nodescription' => true
  776. ),
  777.  
  778. array(
  779. 'type' => 'template',
  780. 'template_id' => 'element_template_selection_tab',
  781. 'args' => array(
  782. 'sc' => $this,
  783. 'modal_group' => true
  784. )
  785. ),
  786.  
  787. array(
  788. 'type' => 'tab_container_close',
  789. 'nodescription' => true
  790. )
  791.  
  792.  
  793. );
  794.  
  795. return $elements;
  796. }
  797.  
  798. /**
  799. * Register all templates for the modal group popup
  800. *
  801. * @since 4.6.4
  802. */
  803. protected function register_modal_group_templates()
  804. {
  805. /**
  806. * Content Tab
  807. * ===========
  808. */
  809.  
  810. $c = array(
  811. array(
  812. 'name' => __( 'Card Title', 'avia_framework' ),
  813. 'desc' => __( 'Enter the card title here (Better keep it short)', 'avia_framework' ),
  814. 'id' => 'title',
  815. 'type' => 'input',
  816. 'std' => 'Tab Title',
  817. 'lockable' => true,
  818. )
  819. );
  820.  
  821. $template = array(
  822. array(
  823. 'type' => 'template',
  824. 'template_id' => 'toggle',
  825. 'title' => __( 'Title', 'avia_framework' ),
  826. 'content' => $c
  827. ),
  828. );
  829.  
  830. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'modal_card_title' ), $template );
  831.  
  832. $c = array(
  833. array(
  834. 'name' => __( 'Card Image', 'avia_framework' ),
  835. 'desc' => __( 'Either upload a new, or choose an existing image from your media library', 'avia_framework' ),
  836. 'id' => 'src',
  837. 'type' => 'image',
  838. 'title' => __( 'Insert Image', 'avia_framework' ),
  839. 'button' => __( 'Insert', 'avia_framework' ),
  840. 'std' => AviaBuilder::$path['imagesURL'] . 'placeholder.jpg',
  841. 'lockable' => true,
  842. 'locked' => array( 'src', 'attachment', 'attachment_size' )
  843. ),
  844. array(
  845. 'name' => __( 'Image Position', 'avia_framework' ),
  846. 'desc' => __( 'Either upload a new, or choose an existing image from your media library', 'avia_framework' ),
  847. 'id' => 'image_position',
  848. 'type' => 'select',
  849. 'std' => 'bottom',
  850. 'lockable' => true,
  851. 'locked' => array( 'src', 'attachment', 'attachment_size' ),
  852. 'subtype' => array(
  853. __( 'Top', 'avia_framework' ) => 'top',
  854. __( 'Bottom', 'avia_framework' ) => 'bottom',
  855. __( 'Above', 'avia_framework' ) => 'above',
  856. __( 'Below', 'avia_framework' ) => 'below',
  857. )
  858. )
  859. );
  860. $template = array(
  861. array(
  862. 'type' => 'template',
  863. 'template_id' => 'toggle',
  864. 'title' => __( 'Image', 'avia_framework' ),
  865. 'content' => $c
  866. ),
  867. );
  868.  
  869. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'modal_card_image' ), $template );
  870.  
  871. $c = array(
  872. array(
  873. 'name' => __( 'Card Content', 'avia_framework' ),
  874. 'desc' => __( 'Enter some content here', 'avia_framework' ),
  875. 'id' => 'content',
  876. 'type' => 'tiny_mce',
  877. 'std' => __( 'Tab Content goes here', 'avia_framework' ),
  878. 'lockable' => true,
  879. ),
  880. );
  881. $template = array(
  882. array(
  883. 'type' => 'template',
  884. 'template_id' => 'toggle',
  885. 'title' => __( 'Content', 'avia_framework' ),
  886. 'content' => $c
  887. ),
  888. );
  889.  
  890. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'modal_card_content' ), $template );
  891.  
  892. ///////////////////////////// BUTTON START ////////////////////////////// BUTTON START ////////////////////////////////
  893.  
  894. $template = AbstraktEnfoldExtensions::amg_enfold_section('Button');
  895. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'modal_button' ), $template );
  896. $template = AbstraktEnfoldExtensions::amg_enfold_section('Link Settings');
  897. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'modal_button_link' ), $template );
  898. $template = AbstraktEnfoldExtensions::amg_enfold_section('Appearance');
  899. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'styling_button_appearance' ), $template );
  900. $template = AbstraktEnfoldExtensions::amg_enfold_section('Font Sizes');
  901. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'styling_button_fonts' ), $template );
  902. $c = AbstraktEnfoldExtensions::amg_enfold_section('Button Margin And Padding');
  903. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'styling_button_margin_padding' ), $c );
  904. $template = AbstraktEnfoldExtensions::amg_enfold_section('Colors');
  905. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'styling_button_colors' ), $template );
  906. $template = AbstraktEnfoldExtensions::amg_enfold_section('Animation');
  907. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'advanced_button_animation' ), $template );
  908.  
  909. ///////////////////////////// BUTTON END ////////////////////////////// BUTTON END ////////////////////////////////
  910.  
  911.  
  912.  
  913. $setting_id = Avia_Builder()->get_developer_settings( 'custom_id' );
  914. $class = in_array( $setting_id, array( 'deactivate', 'hide' ) ) ? 'avia-hidden' : '';
  915.  
  916. $c = array(
  917. array(
  918. 'name' => __( 'For Developers: Custom Tab ID','avia_framework' ),
  919. 'desc' => __( 'Insert a custom ID for the element here. Make sure to only use allowed characters (latin characters, underscores, dashes and numbers, no special characters can be used)','avia_framework' ),
  920. 'id' => 'custom_id',
  921. 'type' => 'input',
  922. 'std' => '',
  923. 'container_class' => $class,
  924. )
  925. );
  926.  
  927. $template = array(
  928. array(
  929. 'type' => 'template',
  930. 'template_id' => 'toggle',
  931. 'title' => __( 'Developer Settings', 'avia_framework' ),
  932. 'content' => $c
  933. ),
  934. );
  935.  
  936. AviaPopupTemplates()->register_dynamic_template( $this->popup_key( 'modal_advanced_developer' ), $template );
  937.  
  938. }
  939.  
  940.  
  941. /**
  942. * 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
  943. * Works in the same way as Editor Element
  944. *
  945. * @param array $params holds the default values for $content and $args.
  946. * @return array usually holds an innerHtml key that holds item specific markup.
  947. */
  948. public function editor_sub_element( $params )
  949. {
  950. $default = array();
  951. $locked = array();
  952. $attr = $params['args'];
  953. Avia_Element_Templates()->set_locked_attributes( $attr, $this, $this->config['shortcode_nested'][0], $default, $locked );
  954.  
  955. $template = $this->update_option_lockable( 'title', $locked );
  956.  
  957. $params['innerHtml'] = '';
  958. $params['innerHtml'] .= "<div class='avia_title_container' {$template} data-update_element_template='yes'>{$attr['title']}</div>";
  959.  
  960. return $params;
  961. }
  962.  
  963. /**
  964. * Create custom stylings
  965. *
  966. * @since 4.8.4
  967. * @param array $args
  968. * @return array
  969. */
  970. protected function get_element_styles( array $args )
  971. {
  972. $result = parent::get_element_styles( $args );
  973.  
  974. extract( $result );
  975.  
  976. $default = array(
  977. 'faq_markup' => '',
  978. 'styling' => '',
  979. 'colors' => '',
  980. 'border_color' => '',
  981. 'title_font_color' => '',
  982. 'title_background_color' => '',
  983. 'font_color' => '',
  984. 'background_color' => '',
  985. 'background_title_color' => '',
  986. );
  987.  
  988. $default = $this->sync_sc_defaults_array( $default, 'no_modal_item', 'no_content' );
  989.  
  990.  
  991. $locked = array();
  992. Avia_Element_Templates()->set_locked_attributes( $atts, $this, $shortcodename, $default, $locked, $content );
  993. Avia_Element_Templates()->add_template_class( $meta, $atts, $default );
  994. $meta = aviaShortcodeTemplate::set_frontend_developer_heading_tag( $atts, $meta );
  995.  
  996. $this->in_sc_exec = true;
  997.  
  998. $atts = shortcode_atts( $default, $atts, $this->config['shortcode'] );
  999.  
  1000. // set heading tag for all titles - save global
  1001. $default_heading = ! empty( $meta['heading_tag'] ) ? $meta['heading_tag'] : 'h3';
  1002.  
  1003. $args = array(
  1004. 'heading' => $default_heading,
  1005. 'extra_class' => $meta['heading_class']
  1006. );
  1007.  
  1008. $extra_args = array( $this, $atts, $content, 'title' );
  1009.  
  1010. /**
  1011. * @since 4.9
  1012. * @return array
  1013. */
  1014. $args = apply_filters( 'avf_customize_heading_settings', $args, __CLASS__, $extra_args );
  1015.  
  1016. $this->heading_tag = ! empty( $args['heading'] ) ? $args['heading'] : $default_heading;
  1017. $this->heading_class = ! empty( $args['extra_class'] ) ? $args['extra_class'] : $meta['heading_class'];
  1018.  
  1019. $element_styling->create_callback_styles( $atts );
  1020.  
  1021. $classes = array(
  1022. 'cardContainer',
  1023. $element_id,
  1024. $atts['styling']
  1025. );
  1026.  
  1027. $element_styling->add_classes( 'item_container', $classes );
  1028. $element_styling->add_classes_from_array( 'item_container', $meta, 'el_class' );
  1029. $element_styling->add_responsive_classes( 'item_container', 'hide_element', $atts );
  1030. $element_styling->add_responsive_font_sizes( 'title', 'size-title', $atts, $this );
  1031. $element_styling->add_responsive_font_sizes( 'title', 'size-title', $atts, $this );
  1032. $element_styling->add_responsive_font_sizes( 'toggle-content', 'size-content', $atts, $this );
  1033.  
  1034.  
  1035. if ($atts['card_layout'] == 'custom') {
  1036. $element_styling->add_styles( 'item_container', array(
  1037. 'max-width' => $atts['max_width'],
  1038. ) );
  1039. $element_styling->add_styles( 'column', array(
  1040. 'flex' => str_replace(',', ' ', $atts['flex']),
  1041. ) );
  1042. $element_styling->add_styles( 'border', array(
  1043. 'border-radius' => str_replace(',', ' ', $atts['border_radius']),
  1044. ) );
  1045. }
  1046.  
  1047.  
  1048. if( 'custom' == $atts['colors'] )
  1049. {
  1050. $element_styling->add_styles( 'content', array(
  1051. 'color' => $atts['font_color'],
  1052. ) );
  1053. $element_styling->add_styles( 'title', array(
  1054. 'color' => $atts['title_font_color'],
  1055. ));
  1056. $element_styling->add_styles( 'tBackground', array(
  1057. 'background-color' => $atts['title_bg_color'],
  1058. ));
  1059. $element_styling->add_styles( 'flip', array(
  1060. 'box-shadow' => $atts['box-shadow'],
  1061. ));
  1062. }
  1063.  
  1064. if ($atts['corner'] != 'yes') {
  1065. $element_styling->add_styles( 'corner', array(
  1066. 'border-style' => 'none',
  1067. ));
  1068. }
  1069.  
  1070. // #top needed when placed inside section
  1071. $selectors = array(
  1072. 'column' => "#top #wrap_all .cardContainer.{$element_id} .amg-flex-box .amg-flex-column",
  1073. 'item_container' => "#top #wrap_all .cardContainer.{$element_id}",
  1074. 'title' => "#top #wrap_all .cardContainer.{$element_id} .amg-card-container {$this->heading_tag}.amg-card-title",
  1075. 'content' => "#top #wrap_all .cardContainer.{$element_id} .amg-card-container .amg-card-content",
  1076. 'contentTitle' => "#top #wrap_all .cardContainer.{$element_id} .amg-card-container {$this->heading_tag}.amg-card-content-title",
  1077. 'tBackground' => "#top #wrap_all .cardContainer.{$element_id} .amg-card-container .card-title-container",
  1078. 'flip' => "#top #wrap_all .cardContainer.{$element_id} .amg-card-container .amg-flip-box",
  1079. 'border' => "#top #wrap_all .cardContainer.{$element_id} .amg-card-container .amg-flip-box,
  1080. #top #wrap_all .cardContainer.{$element_id} .amg-card-container,
  1081. #top #wrap_all .cardContainer.{$element_id} .amg-card-container .amg-card-content,
  1082. #top #wrap_all .cardContainer.{$element_id} .amg-card-container .amg-card-image,
  1083. #top #wrap_all .cardContainer.{$element_id} .amg-card-container .card-title-container",
  1084. 'corner' => "#top #wrap_all .cardContainer.{$element_id} .amg-card-container .card-title-container:before "
  1085. );
  1086.  
  1087. $element_styling->add_selectors( $selectors );
  1088.  
  1089. $result['default'] = $default;
  1090. $result['atts'] = $atts;
  1091. $result['content'] = $content;
  1092. $result['meta'] = $meta;
  1093. $result['element_styling'] = $element_styling;
  1094.  
  1095. $this->parent_atts = $atts;
  1096. amg_sc_cards::$initial = $atts['initial'];
  1097. amg_sc_cards::$tags = array();
  1098.  
  1099. $this->el_styling = $element_styling;
  1100.  
  1101. return $result;
  1102. }
  1103.  
  1104. /**
  1105. * Create custom stylings for items
  1106. *
  1107. * @since 4.8.4
  1108. * @param array $args
  1109. * @return array
  1110. */
  1111. protected function get_element_styles_item( array $args )
  1112. {
  1113. $result = parent::get_element_styles_item( $args );
  1114.  
  1115. /**
  1116. * Fixes a problem when 3-rd party plugins call nested shortcodes without executing main shortcode (like YOAST in wpseo-filter-shortcodes)
  1117. */
  1118. if( ! $this->in_sc_exec )
  1119. {
  1120. return $result;
  1121. }
  1122. extract( $result );
  1123. $default = array(
  1124. 'title' => '',
  1125. 'tags' => '',
  1126. 'custom_id' => '',
  1127. 'custom_markup' => ''
  1128. );
  1129. $default = $this->sync_sc_defaults_array( $default, 'modal_item', 'no_content' );
  1130. $locked = array();
  1131. Avia_Element_Templates()->set_locked_attributes( $atts, $this, $shortcodename, $default, $locked, $content );
  1132.  
  1133. $classes = array(
  1134. 'card',
  1135. $element_id
  1136. );
  1137.  
  1138. $element_styling->add_classes( 'item_container', $classes );
  1139. $element_styling->add_classes( 'item_container', $this->class_by_arguments( 'icon_select, size, position', $atts, true, 'array' ) );
  1140. $element_styling->add_responsive_classes( 'item_container', 'hide_element', $atts );
  1141. $element_styling->add_responsive_font_sizes( 'container', 'size-content', $atts, $this );
  1142.  
  1143. $this->set_button_styes( $element_styling, $atts );
  1144.  
  1145. ///////////////////////////// BUTTON START ////////////////////////////// BUTTON START ////////////////////////////////
  1146. if( $atts['icon_select'] == 'yes' )
  1147. {
  1148. $atts['icon_select'] = 'yes-left-icon';
  1149. }
  1150. $classes = array(
  1151. 'avia-button',
  1152. $element_id
  1153. );
  1154.  
  1155. $element_styling->add_classes( 'container', $classes );
  1156. $element_styling->add_classes( 'container', $this->class_by_arguments( 'button_icon_select, size, position', $atts, true, 'array' ) );
  1157. $element_styling->add_responsive_classes( 'container', 'hide_element', $atts );
  1158. $element_styling->add_responsive_font_sizes( 'container', 'size-text', $atts, $this );
  1159. $element_styling->add_responsive_font_sizes( 'button_icon', 'size-button-icon', $atts, $this );
  1160.  
  1161. $element_styling->add_classes( 'wrap', $element_id . '-wrap' );
  1162.  
  1163. $this->set_button_styes( $element_styling, $atts );
  1164.  
  1165. if( ! empty( $atts['css_position'] ) )
  1166. {
  1167. $element_styling->add_responsive_styles( 'wrap', 'css_position', $atts, $this );
  1168. }
  1169.  
  1170. $element_styling->add_responsive_styles( 'container', 'margin', $atts, $this );
  1171. $element_styling->add_responsive_styles( 'container', 'padding', $atts, $this );
  1172.  
  1173. if( ! in_array( $atts['animation'], array( 'no-animation', '' ) ) )
  1174. {
  1175. if( false !== strpos( $atts['animation'], 'curtain-reveal-' ) )
  1176. {
  1177. $classes_curtain = array(
  1178. 'avia-curtain-reveal-overlay',
  1179. 'av-animated-when-visible-95',
  1180. 'animate-all-devices',
  1181. $atts['animation']
  1182. );
  1183.  
  1184. // animate in preview window
  1185. if( is_admin() )
  1186. {
  1187. $classes_curtain[] = 'avia-animate-admin-preview';
  1188. }
  1189.  
  1190. $element_styling->add_classes( 'curtain', $classes_curtain );
  1191. $element_styling->add_callback_styles( 'curtain', array( 'animation' ) );
  1192. }
  1193. else
  1194. {
  1195. $wrap_classes = array(
  1196. 'avia_animated_button',
  1197. 'av-animated-when-visible-95',
  1198. // 'animate-all-devices',
  1199. $atts['animation']
  1200. );
  1201.  
  1202. if( is_admin() )
  1203. {
  1204. $wrap_classes[] = 'avia-animate-admin-preview';
  1205.  
  1206. $element_styling->add_callback_styles( 'wrap', array( 'animation' ) );
  1207. }
  1208. else
  1209. {
  1210. $element_styling->add_callback_styles( 'wrap-animation', array( 'animation' ) );
  1211. }
  1212.  
  1213. $element_styling->add_classes( 'wrap', $wrap_classes );
  1214. }
  1215. }
  1216. ///////////////////////////// BUTTON END //////////////////////////////// BUTTON END //////////////////////////////////
  1217.  
  1218. $selectors = array(
  1219. 'item_container' => ".cardContainer .amg-card-container.{$element_id}",
  1220. 'content' => ".cardContainer .amg-card-container.{$element_id} .amg-card-content"
  1221. );
  1222.  
  1223. ///////////////////////////// BUTTON START ////////////////////////////// BUTTON START ////////////////////////////////
  1224. $selectors = AbstraktEnfoldExtensions::amg_button_append_selectors($selectors, $element_id);
  1225. ///////////////////////////// BUTTON END //////////////////////////////// BUTTON END //////////////////////////////////
  1226.  
  1227. $element_styling->add_selectors( $selectors );
  1228.  
  1229. $result['default'] = $default;
  1230. $result['atts'] = $atts;
  1231. $result['content'] = $content;
  1232. $result['element_styling'] = $element_styling;
  1233.  
  1234. return $result;
  1235. }
  1236.  
  1237. /**
  1238. * Frontend Shortcode Handler
  1239. *
  1240. * @param array $atts array of attributes
  1241. * @param string $content text within enclosing form of shortcode element
  1242. * @param string $shortcodename the shortcode found, when == callback name
  1243. * @return string $output returns the modified html string
  1244. */
  1245. public function shortcode_handler( $atts, $content = '', $shortcodename = '', $meta = '' )
  1246. {
  1247. $result = $this->get_element_styles( compact( array( 'atts', 'content', 'shortcodename', 'meta' ) ) );
  1248.  
  1249. extract( $result );
  1250. extract( $atts );
  1251.  
  1252. $this->subitem_inline_styles = '';
  1253.  
  1254.  
  1255. amg_sc_cards::$counter = 1;
  1256.  
  1257. $content = ShortcodeHelper::avia_remove_autop( $content, true );
  1258.  
  1259. $style_tag = $element_styling->get_style_tag( $element_id );
  1260. $item_tag = $element_styling->style_tag_html( $this->subitem_inline_styles, 'sub-' . $element_id );
  1261. $container_class = $element_styling->get_class_string( 'item_container' );
  1262. $class = $atts['animation'];
  1263. $class .= " {$atts['title_position']}";
  1264.  
  1265. $output = '';
  1266. $output .= $style_tag;
  1267. $output .= $item_tag;
  1268. $output .= "<div id='app' data-animated='{$atts['intro']}' data-duration='{$atts['duration']}' data-height='{$atts['min_height']}' data-mobile-height='{$atts['mobile_min_height']}' {$meta['custom_el_id']} class='{$container_class} {$class}' {$markup_faq}>";
  1269. $output .= "<div class='amg-flex-box'>";
  1270. $output .= $content;
  1271. $output .= '</div>';
  1272. $output .= '</div>';
  1273.  
  1274. $this->in_sc_exec = false;
  1275.  
  1276. return $output;
  1277. }
  1278.  
  1279.  
  1280. /**
  1281. * Shortcode handler
  1282. *
  1283. * @param array $atts
  1284. * @param string $content
  1285. * @param string $shortcodename
  1286. * @return string
  1287. */
  1288. public function amg_card( $atts, $content = '', $shortcodename = '' )
  1289. {
  1290. /**
  1291. * Fixes a problem when 3-rd party plugins call nested shortcodes without executing main shortcode (like YOAST in wpseo-filter-shortcodes)
  1292. */
  1293. if( ! $this->in_sc_exec )
  1294. {
  1295. return '';
  1296. }
  1297.  
  1298. $result = $this->get_element_styles_item( compact( array( 'atts', 'content', 'shortcodename' ) ) );
  1299.  
  1300. extract( $result );
  1301. $toggle_atts = $atts;
  1302.  
  1303.  
  1304. $this->subitem_inline_styles .= $element_styling->get_style_tag( $element_id, 'rules_only' );
  1305.  
  1306. ///////////////////////////// BUTTON START //////////////////////////////// BUTTON START //////////////////////////////////
  1307.  
  1308. $output = '';
  1309. $output .= $style_tag;
  1310. $button = '';
  1311.  
  1312. if( '' != $atts['color_options'] )
  1313. {
  1314. if( 'custom' != $atts['btn_color_bg_hover'] && 'btn_custom_grad' != $atts['btn_color_bg'] )
  1315. {
  1316. // must be added otherwise we get a bottom border !!!
  1317. // $style_hover = "style='background-color:{$atts['btn_color_bg_hover']};'";
  1318.  
  1319. if( $this->is_special_button_color( $atts['btn_color_bg_hover'] ) )
  1320. {
  1321. $background_hover = "<span class='avia_button_background avia-button avia-color-{$atts['btn_color_bg_hover']}' {$style_hover}></span>";
  1322. }
  1323. }
  1324. }
  1325.  
  1326. $style_tag = $element_styling->get_style_tag( $element_id );
  1327. $wrap_class = $element_styling->get_class_string( 'wrap' );
  1328. $button_container_class = $element_styling->get_class_string( 'container' );
  1329. if ($atts['button'] == 'yes') {
  1330. $button = AbstraktEnfoldExtensions::amg_create_button($atts, $meta, $button_container_class, $style_tag, $wrap_class, $background_hover);
  1331. }
  1332.  
  1333. ///////////////////////////// BUTTON END //////////////////////////////// BUTTON END //////////////////////////////////
  1334.  
  1335. $output .= "<div class='amg-flex-column card'>";
  1336. $output .= '<div class="amg-card-container">';
  1337. $output .= '<div class="amg-flip-box">';
  1338. $output .= '<div class="amg-card-content">';
  1339. $output .= ShortcodeHelper::avia_apply_autop( ShortcodeHelper::avia_remove_autop( $content ) );
  1340. $output .= $button;
  1341. $output .= '</div>';
  1342. $output .= '<div id="' . $toggle_atts['custom_id'] . '" class="amg-card-image" id="card-image-' . $toggle_atts['custom_id'] . '"><img alt="' . $toggle_atts['title'] . '" src="' . $toggle_atts['src'] . '"></div>';
  1343. $output .= "<div class='card-title-container'><{$this->heading_tag} class='amg-card-title'>" . $toggle_atts['title'] . "</{$this->heading_tag}></div>";;
  1344. $output .= '</div>';
  1345. $output .= '</div>';
  1346. $output .= '</div>';
  1347.  
  1348. amg_sc_cards::$counter ++;
  1349.  
  1350. return $output;
  1351. }
  1352. }
  1353. }
  1354.  
Advertisement
Add Comment
Please, Sign In to add comment