AbstraktEnfold

Functions.php

Mar 19th, 2025
76
0
50 days
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 70.57 KB | None | 0 0
  1. <?php
  2.  
  3. /*..
  4. Plugin Name: Abstrakt Enfold Extensions
  5. Plugin URI: https://abstraktmg.com
  6. Description: Plugin for Abstrakt Marketing Group Designers Only
  7. Author: Nathaniel Riggins
  8. Author URI: https://abstraktmg.com
  9. Version: 2.0.5
  10. License: Private
  11. */
  12.  
  13. if ( !defined('ABSPATH') ) { die('-1'); }
  14.  
  15. if (!class_exists('AbstraktEnfoldExtensions')) {
  16. class AbstraktEnfoldExtensions {
  17.  
  18. public string $plugin;
  19. private array $elements = array(
  20. 'accordion',
  21. 'aces',
  22. 'badges',
  23. 'billboard',
  24. 'bulletin',
  25. 'button',
  26. 'cards',
  27. 'carousel',
  28. 'crawl',
  29. 'cube',
  30. 'deck',
  31. 'fashion',
  32. 'glow',
  33. 'hero',
  34. 'marquee',
  35. 'material',
  36. 'panorama',
  37. 'paper',
  38. 'pricing',
  39. 'rotators',
  40. 'tabs',
  41. 'testimonials',
  42. 'triple',
  43. 'versa',
  44. 'wall',
  45. 'waves',
  46. );
  47. private array $deletes = array(
  48. 'animate',
  49. 'blocks',
  50. 'intros',
  51. 'navi',
  52. 'neon',
  53. 'podcasts',
  54. 'posters',
  55. 'sticky',
  56. 'text',
  57. 'traveler',
  58. );
  59. // Class construct
  60. function __construct() {
  61. $this->plugin = plugin_basename(__FILE__);
  62. add_action('wp_enqueue_scripts', array($this, 'load_scripts'));
  63. add_action('admin_enqueue_scripts', array($this, 'load_admin_scripts'));
  64. add_action('init', array($this, 'includeClasses'));
  65. add_action('avia_builder_mode', array($this, 'builder_set_debug'));
  66. add_action('admin_menu', array($this, 'amg_enfold_admin_menu'));
  67. add_action('admin_init', array($this, 'amg_enfold_admin_settings_init'));
  68. add_action('wp_footer', array($this, 'amg_enfold_popup'));
  69. add_action( 'init', array($this, 'add_all_image_sizes'));
  70. }
  71. function add_all_image_sizes() :void
  72. {
  73. ///// AUTO SIZES ///
  74. add_image_size( 'amg-auto-300', 300);
  75. add_image_size( 'amg-auto-500', 500);
  76. add_image_size( 'amg-auto-750', 750);
  77. add_image_size( 'amg-auto-1000', 1000);
  78. add_image_size( 'amg-auto-1250', 1250);
  79. add_image_size( 'amg-auto-1500', 1500);
  80. add_image_size( 'amg-auto-2000', 2000);
  81. add_image_size( 'amg-portrait-300', 300, 400, true );
  82. add_image_size( 'amg-portrait-450', 450, 600, true );
  83. add_image_size( 'amg-portrait-600', 600, 800, true );
  84. add_image_size( 'amg-portrait-750', 750, 1000, true );
  85. add_image_size( 'amg-landscape-320', 320, 180, true );
  86. add_image_size( 'amg-landscape-480', 480, 270, true );
  87. add_image_size( 'amg-landscape-720', 720, 405, true );
  88. add_image_size( 'amg-landscape-960', 960, 540, true );
  89. add_image_size( 'amg-landscape-1440', 1440, 810, true );
  90. add_image_size( 'amg-landscape-1920', 1920, 1080, true );
  91. }
  92. function builder_set_debug()
  93. {
  94. return "debug";
  95. }
  96. public static function get_image_sizes() : array
  97. {
  98. return array(
  99. __( 'None', 'avia_framework' ) => '',
  100. __( 'Auto 300w', 'avia_framework' ) => 'amg-auto-300',
  101. __( 'Auto 500w', 'avia_framework' ) => 'amg-auto-500',
  102. __( 'Auto 750w', 'avia_framework' ) => 'amg-auto-750',
  103. __( 'Auto 1000w', 'avia_framework' ) => 'amg-auto-1000',
  104. __( 'Auto 1250w', 'avia_framework' ) => 'amg-auto-1250',
  105. __( 'Auto 1500w', 'avia_framework' ) => 'amg-auto-1500',
  106. __( 'Auto 2000w', 'avia_framework' ) => 'amg-auto-2000',
  107.  
  108. __( 'Portrait 300w', 'avia_framework' ) => 'amg-portrait-300',
  109. __( 'Portrait 450w', 'avia_framework' ) => 'amg-portrait-450',
  110. __( 'Portrait 600w', 'avia_framework' ) => 'amg-portrait-600',
  111. __( 'Portrait 750w', 'avia_framework' ) => 'amg-portrait-750',
  112.  
  113. __( 'Landscape 320w', 'avia_framework' ) => 'amg-landscape-320',
  114. __( 'Landscape 480w', 'avia_framework' ) => 'amg-landscape-480',
  115. __( 'Landscape 720w', 'avia_framework' ) => 'amg-landscape-720',
  116. __( 'Landscape 960w', 'avia_framework' ) => 'amg-landscape-960',
  117. __( 'Landscape 1440w', 'avia_framework' ) => 'amg-landscape-1440',
  118. __( 'Landscape 1920w', 'avia_framework' ) => 'amg-landscape-1920',
  119. );
  120. }
  121.  
  122. public static function get_plugin_version():string
  123. {
  124. $data = get_plugin_data(__FILE__);
  125. return $data['Version'];
  126. }
  127.  
  128. public static function developMode():bool {
  129.  
  130. return get_option('amg_enfold_developer_mode') == 'yes';
  131. }
  132. public function includeClasses():void {
  133.  
  134. $count = count($this->elements);
  135. for ($i = 0; $i < $count; $i++) {
  136. if (get_option("amg_enfold_extensions_{$this->elements[$i]}_active") == 'yes') {
  137. include plugin_dir_path( __FILE__ ) . "/enfold/{$this->elements[$i]}/{$this->elements[$i]}.php";
  138. }
  139. }
  140. }
  141. public function load_admin_scripts():void
  142. {
  143. $ver = AbstraktEnfoldExtensions::get_plugin_version();
  144. $developMode = AbstraktEnfoldExtensions::developMode();
  145. $lastmodtime = $developMode ? rand(1, 999999999) : $ver;
  146. wp_enqueue_style('amg-admin-enfold', plugin_dir_url(__FILE__) . 'css/style.min.css', false, $lastmodtime);
  147. wp_enqueue_script('amg-admin-enfold-fontawesome', 'https://kit.fontawesome.com/ececabbde4.js', false, $lastmodtime);
  148. }
  149.  
  150. public function load_scripts():void {
  151. $ver = AbstraktEnfoldExtensions::get_plugin_version();
  152. $developMode = AbstraktEnfoldExtensions::developMode();
  153. $lastmodtime = $developMode ? rand(1, 999999999) : $ver;
  154. wp_enqueue_style('amg-enfold-icons', plugin_dir_url(__FILE__) . 'css/uicons.min.css', array('avia-layout'), $lastmodtime);
  155. wp_enqueue_style( 'amg-css-animate', plugin_dir_url(__FILE__) . "css/animateCSS.min.css", array( 'avia-layout' ) );
  156. wp_enqueue_style('amg-enfold', plugin_dir_url(__FILE__) . 'css/style.min.css', array('avia-layout'), $lastmodtime);
  157. wp_enqueue_style('amg-swiper', plugin_dir_url(__FILE__) . 'css/swiper.css', array('avia-layout'), $lastmodtime);
  158. wp_enqueue_script( 'amg-gsap', plugin_dir_url(__FILE__) . "js/gsap.min.js", array( 'amg-swiper' ), $lastmodtime, true );
  159. wp_enqueue_script( 'amg-enfold', plugin_dir_url(__FILE__) . "js/script.min.js", array(), $lastmodtime );
  160. wp_enqueue_script( 'amg-swiper', plugin_dir_url(__FILE__) . "js/swiper.js", array(), $lastmodtime );
  161. }
  162. public static function get_duration_times():array {
  163. return array(
  164. __( 'None', 'avia_framework' ) => '',
  165. __( '0.1s', 'avia_framework' ) => 's100',
  166. __( '0.2s', 'avia_framework' ) => 's200',
  167. __( '0.3s', 'avia_framework' ) => 's300',
  168. __( '0.4s', 'avia_framework' ) => 's400',
  169. __( '0.5s', 'avia_framework' ) => 's500',
  170. __( '0.6s', 'avia_framework' ) => 's600',
  171. __( '0.7s', 'avia_framework' ) => 's700',
  172. __( '0.8s', 'avia_framework' ) => 's800',
  173. __( '0.9s', 'avia_framework' ) => 's900',
  174. __( '1s', 'avia_framework' ) => 's1000',
  175. __( '1.1s', 'avia_framework' ) => 's1100',
  176. __( '1.2s', 'avia_framework' ) => 's1200',
  177. __( '1.3s', 'avia_framework' ) => 's1300',
  178. __( '1.4s', 'avia_framework' ) => 's1400',
  179. __( '1.5s', 'avia_framework' ) => 's1500',
  180. __( '1.6s', 'avia_framework' ) => 's1600',
  181. __( '1.7s', 'avia_framework' ) => 's1700',
  182. __( '1.8s', 'avia_framework' ) => 's1800',
  183. __( '1.9s', 'avia_framework' ) => 's1900',
  184. __( '2s', 'avia_framework' ) => 's2000',
  185. __( '2.1s', 'avia_framework' ) => 's2100',
  186. __( '2.2s', 'avia_framework' ) => 's2200',
  187. __( '2.3s', 'avia_framework' ) => 's2300',
  188. __( '2.4s', 'avia_framework' ) => 's2400',
  189. __( '2.5s', 'avia_framework' ) => 's2500',
  190. __( '2.6s', 'avia_framework' ) => 's2600',
  191. __( '2.7s', 'avia_framework' ) => 's2700',
  192. __( '2.8s', 'avia_framework' ) => 's2800',
  193. __( '2.9s', 'avia_framework' ) => 's2900',
  194. __( '3s', 'avia_framework' ) => 's3000',
  195. );
  196. }
  197. public static function get_delay_times():array {
  198. return array(
  199. __( 'None', 'avia_framework' ) => '',
  200. __( '0.1s', 'avia_framework' ) => 'd100',
  201. __( '0.2s', 'avia_framework' ) => 'd200',
  202. __( '0.3s', 'avia_framework' ) => 'd300',
  203. __( '0.4s', 'avia_framework' ) => 'd400',
  204. __( '0.5s', 'avia_framework' ) => 'd500',
  205. __( '0.6s', 'avia_framework' ) => 'd600',
  206. __( '0.7s', 'avia_framework' ) => 'd700',
  207. __( '0.8s', 'avia_framework' ) => 'd800',
  208. __( '0.9s', 'avia_framework' ) => 'd900',
  209. __( '1s', 'avia_framework' ) => 'd1000',
  210. __( '1.1s', 'avia_framework' ) => 'd1100',
  211. __( '1.2s', 'avia_framework' ) => 'd1200',
  212. __( '1.3s', 'avia_framework' ) => 'd1300',
  213. __( '1.4s', 'avia_framework' ) => 'd1400',
  214. __( '1.5s', 'avia_framework' ) => 'd1500',
  215. __( '1.6s', 'avia_framework' ) => 'd1600',
  216. __( '1.7s', 'avia_framework' ) => 'd1700',
  217. __( '1.8s', 'avia_framework' ) => 'd1800',
  218. __( '1.9s', 'avia_framework' ) => 'd1900',
  219. __( '2s', 'avia_framework' ) => 'd2000',
  220. __( '2.1s', 'avia_framework' ) => 'd2100',
  221. __( '2.2s', 'avia_framework' ) => 'd2200',
  222. __( '2.3s', 'avia_framework' ) => 'd2300',
  223. __( '2.4s', 'avia_framework' ) => 'd2400',
  224. __( '2.5s', 'avia_framework' ) => 'd2500',
  225. __( '2.6s', 'avia_framework' ) => 'd2600',
  226. __( '2.7s', 'avia_framework' ) => 'd2700',
  227. __( '2.8s', 'avia_framework' ) => 'd2800',
  228. __( '2.9s', 'avia_framework' ) => 'd2900',
  229. __( '3s', 'avia_framework' ) => 'd3000',
  230. );
  231. }
  232.  
  233. public static function get_slider_speeds():array {
  234. return array(
  235. __( '3s', 'avia_framework' ) => '3000',
  236. __( '4s', 'avia_framework' ) => '4000',
  237. __( '5s', 'avia_framework' ) => '5000',
  238. __( '6s', 'avia_framework' ) => '6000',
  239. __( '7s', 'avia_framework' ) => '7000',
  240. __( '8s', 'avia_framework' ) => '8000',
  241. __( '9s', 'avia_framework' ) => '9000',
  242. __( '10s', 'avia_framework' ) => '10000',
  243. __( '11s', 'avia_framework' ) => '11000',
  244. __( '12s', 'avia_framework' ) => '12000',
  245. __( '13s', 'avia_framework' ) => '13000',
  246. __( '14s', 'avia_framework' ) => '14000',
  247. __( '15s', 'avia_framework' ) => '15000',
  248. );
  249. }
  250. public static function get_intro_animations():array {
  251. return array(
  252. array(
  253. __( 'None', 'avia_framework' ) => '',
  254. __( 'animate__bounce', 'avia_framework' ) => 'animate__animated animate__bounce',
  255. __( 'animate__flash', 'avia_framework' ) => 'animate__animated animate__flash',
  256. __( 'Back in down', 'avia_framework' ) => 'animate__animated animate__backInDown',
  257. __( 'Back in left', 'avia_framework' ) => 'animate__animated animate__backInLeft',
  258. __( 'Back in right', 'avia_framework' ) => 'animate__animated animate__backInRight',
  259. __( 'Back in up', 'avia_framework' ) => 'animate__animated animate__backInUp',
  260. __( 'Bounce in', 'avia_framework' ) => 'animate__animated animate__bounceIn',
  261. __( 'Bounce in down', 'avia_framework' ) => 'animate__animated animate__bounceInDown',
  262. __( 'Bounce in left', 'avia_framework' ) => 'animate__animated animate__bounceInLeft',
  263. __( 'Bounce in right', 'avia_framework' ) => 'animate__animated animate__bounceInRight',
  264. __( 'Bounce in up', 'avia_framework' ) => 'animate__animated animate__bounceInUp',
  265. __( 'Fade in', 'avia_framework' ) => 'animate__animated animate__fadeIn',
  266. __( 'Fade in bottom left', 'avia_framework' ) => 'animate__animated animate__fadeInBottomLeft',
  267. __( 'Fade in bottom right', 'avia_framework' ) => 'animate__animated animate__fadeInBottomRight',
  268. __( 'Fade in down', 'avia_framework' ) => 'animate__animated animate__fadeInDown',
  269. __( 'Fade down big', 'avia_framework' ) => 'animate__animated animate__fadeInDownBig',
  270. __( 'Fade in left', 'avia_framework' ) => 'animate__animated animate__fadeInLeft',
  271. __( 'Fade in left big', 'avia_framework' ) => 'animate__animated animate__fadeInLeftBig',
  272. __( 'Fade in right', 'avia_framework' ) => 'animate__animated animate__fadeInRight',
  273. __( 'Fade in right big', 'avia_framework' ) => 'animate__animated animate__fadeInRightBig',
  274. __( 'Fade in up', 'avia_framework' ) => 'animate__animated animate__fadeInUp',
  275. __( 'Fade in up big', 'avia_framework' ) => 'animate__animated animate__fadeInUpBig',
  276. __( 'Fade in top left', 'avia_framework' ) => 'animate__animated animate__fadeInTopLeft',
  277. __( 'Fade in top right', 'avia_framework' ) => 'animate__animated animate__fadeInTopRight',
  278. __( 'Flip', 'avia_framework' ) => 'animate__animated animate__flip',
  279. __( 'Flip X', 'avia_framework' ) => 'animate__animated animate__flipInX',
  280. __( 'Flip Y', 'avia_framework' ) => 'animate__animated animate__flipInY',
  281. __( 'Head Shake', 'avia_framework' ) => 'animate__animated animate__headShake',
  282. __( 'Heartbeat', 'avia_framework' ) => 'animate__animated animate__heartBeat',
  283. __( 'Hinge', 'avia_framework' ) => 'animate__animated animate__hinge',
  284. __( 'Jack In The Box', 'avia_framework' ) => 'animate__animated animate__jackInTheBox',
  285. __( 'Jello', 'avia_framework' ) => 'animate__animated animate__jello',
  286. __( 'Lightspeed in left', 'avia_framework' ) => 'animate__animated animate__lightSpeedInLeft',
  287. __( 'Lightspeed in right', 'avia_framework' ) => 'animate__animated animate__lightSpeedInRight',
  288. __( 'Mask', 'avia_framework' ) => 'animate__animated animate__pulse',
  289. __( 'Roll in', 'avia_framework' ) => 'animate__animated animate__rollIn',
  290. __( 'Rotate in', 'avia_framework' ) => 'animate__animated animate__rotateIn',
  291. __( 'Rotate down left', 'avia_framework' ) => 'animate__animated animate__rotateInDownLeft',
  292. __( 'Rotate in down right', 'avia_framework' ) => 'animate__animated animate__rotateInDownRight',
  293. __( 'Rotate in up left', 'avia_framework' ) => 'animate__animated animate__rotateInUpLeft',
  294. __( 'Rotate in up right', 'avia_framework' ) => 'animate__animated animate__rotateInUpRight',
  295. __( 'Rubber Band', 'avia_framework' ) => 'animate__animated animate__rubberBand',
  296. __( 'Shake X', 'avia_framework' ) => 'animate__animated animate__shakeX',
  297. __( 'Shake Y', 'avia_framework' ) => 'animate__animated animate__shakeY',
  298. __( 'Slide in', 'avia_framework' ) => 'animate__animated animate__slideInDown',
  299. __( 'Slide in left', 'avia_framework' ) => 'animate__animated animate__slideInLeft',
  300. __( 'Slide in right', 'avia_framework' ) => 'animate__animated animate__slideInRight',
  301. __( 'Slide in up', 'avia_framework' ) => 'animate__animated animate__slideInUp',
  302. __( 'Swing', 'avia_framework' ) => 'animate__animated animate__swing',
  303. __( 'Tada', 'avia_framework' ) => 'animate__animated animate__tada',
  304. __( 'Wobble', 'avia_framework' ) => 'animate__animated animate__wobble',
  305. __( 'Zoom in', 'avia_framework' ) => 'animate__animated animate__zoomIn',
  306. __( 'Zoom in down', 'avia_framework' ) => 'animate__animated animate__zoomInDown',
  307. __( 'Zoom in left', 'avia_framework' ) => 'animate__animated animate__zoomInLeft',
  308. __( 'Zoom in right', 'avia_framework' ) => 'animate__animated animate__zoomInRight',
  309. __( 'Zoom in up', 'avia_framework' ) => 'animate__animated animate__zoomInUp',
  310. )
  311. );
  312. }
  313. public static function get_button_links($type):array {
  314. $data = match ($type) {
  315. 'page' => get_pages(),
  316. default => get_posts(),
  317. };
  318. $links = array();
  319. foreach ($data as $link) {
  320. $links[__( $link->post_title, 'avia_framework' )] = $link->post_name;
  321. }
  322.  
  323. return $links;
  324. }
  325. public static function get_full_percentage():array {
  326. $i = 1;
  327. $nums = array();
  328. while ($i < 101) {
  329. $k = $i . '%';
  330. $nums[$k] = $i . '%';
  331. $i++;
  332. }
  333. return $nums;
  334. }
  335. public static function get_full_360():array {
  336. $i = 1;
  337. $nums = array();
  338. while ($i < 361) {
  339. $k = $i;
  340. $nums[$k] = $i;
  341. $i++;
  342. }
  343. return $nums;
  344. }
  345. public static function create_button_link($atts, $b = 'button'):string {
  346. $link = '';
  347. if (isset($atts[$b]) && $atts[$b] == 'yes') {
  348. switch ($atts[$b . '_link_type']) {
  349. case 'page':
  350. $link = home_url() . '/' . $atts[$b . '_page_link'];
  351. break;
  352. case 'post':
  353. $link .= home_url() . '/' . $atts[$b . '_post_link'];
  354. break;
  355. case 'custom':
  356. $link .= $atts[$b . '_custom_link'];
  357. break;
  358. default:
  359.  
  360. }
  361. }
  362. return $link;
  363. }
  364. public static function get_seconds():array {
  365. return array(
  366. '1s' => '1s',
  367. '2s' => '2s',
  368. '3s' => '3s',
  369. '4s' => '4s',
  370. '5s' => '5s',
  371. '6s' => '6s',
  372. '7s' => '7s',
  373. '8s' => '8s',
  374. '9s' => '9s',
  375. '10s' => '10s',
  376. '11s' => '11s',
  377. '12s' => '12s',
  378. '13s' => '13s',
  379. '14s' => '14s',
  380. '15s' => '15s',
  381. '16s' => '16s',
  382. '17s' => '17s',
  383. '18s' => '18s',
  384. '19s' => '19s',
  385. '20s' => '20s',
  386. );
  387. }
  388. public static function select_button_style():array {
  389. $arr = array (
  390. __( 'Animated Gradient', 'avia_framework' ) => 'amg_1',
  391. __( 'Candied Colored 1', 'avia_framework' ) => 'amg_2',
  392. __( 'Candied Colored 2', 'avia_framework' ) => 'amg_3',
  393. __( 'Candied Colored 3', 'avia_framework' ) => 'amg_4',
  394. __( 'Candied Colored 4', 'avia_framework' ) => 'amg_5',
  395. __( 'Candied Colored 5', 'avia_framework' ) => 'amg_6',
  396. __( 'Candied Colored 6', 'avia_framework' ) => 'amg_7',
  397. __( 'Candied Colored 7', 'avia_framework' ) => 'amg_8',
  398. __( 'Candied Colored 8', 'avia_framework' ) => 'amg_9',
  399. __( 'Candied Colored 9', 'avia_framework' ) => 'amg_10',
  400. __( 'Candied Colored 10', 'avia_framework' ) => 'amg_11',
  401. __( 'Candied Colored 11', 'avia_framework' ) => 'amg_12',
  402. __( 'Candied Colored 12', 'avia_framework' ) => 'amg_13',
  403. __( 'Candied Colored 13', 'avia_framework' ) => 'amg_14',
  404. __( 'Candied Colored 14', 'avia_framework' ) => 'amg_15',
  405. __( 'Candied Colored 15', 'avia_framework' ) => 'amg_16',
  406. __( 'Candied Colored 16', 'avia_framework' ) => 'amg_17',
  407. __( 'Coin', 'avia_framework' ) => 'amg_18',
  408. __( 'Cold Light', 'avia_framework' ) => 'amg_19',
  409. __( 'Flip Box', 'avia_framework' ) => 'amg_20',
  410. __( 'Gradient', 'avia_framework' ) => 'amg_21',
  411. __( 'Gradient Glow', 'avia_framework' ) => 'amg_22',
  412. __( 'Gradient Hole', 'avia_framework' ) => 'amg_61',
  413. __( 'Hover 1', 'avia_framework' ) => 'amg_23',
  414. __( 'Hover 2', 'avia_framework' ) => 'amg_24',
  415. __( 'Hover 3', 'avia_framework' ) => 'amg_25',
  416. __( 'Hover 4', 'avia_framework' ) => 'amg_26',
  417. __( 'Label Slice', 'avia_framework' ) => 'amg_27',
  418. __( 'Liquid', 'avia_framework' ) => 'amg_28',
  419. __( 'Menu', 'avia_framework' ) => 'amg_29',
  420. __( 'Modern 1', 'avia_framework' ) => 'amg_30',
  421. __( 'Modern 2', 'avia_framework' ) => 'amg_31',
  422. __( 'Modern 3', 'avia_framework' ) => 'amg_32',
  423. __( 'Modern 4', 'avia_framework' ) => 'amg_33',
  424. __( 'Modern 5', 'avia_framework' ) => 'amg_34',
  425. __( 'Modern 6', 'avia_framework' ) => 'amg_35',
  426. __( 'Modern 7', 'avia_framework' ) => 'amg_36',
  427. __( 'Modern 8', 'avia_framework' ) => 'amg_37',
  428. __( 'Modern 9', 'avia_framework' ) => 'amg_38',
  429. __( 'Modern 10', 'avia_framework' ) => 'amg_39',
  430. __( 'Modern 11', 'avia_framework' ) => 'amg_40',
  431. __( 'Modern 12', 'avia_framework' ) => 'amg_41',
  432. __( 'Modern 13', 'avia_framework' ) => 'amg_42',
  433. __( 'Modern 14', 'avia_framework' ) => 'amg_43',
  434. __( 'Modern 15', 'avia_framework' ) => 'amg_44',
  435. __( 'Modern 16', 'avia_framework' ) => 'amg_45',
  436. __( 'Modern 17', 'avia_framework' ) => 'amg_46',
  437. __( 'Modern 18', 'avia_framework' ) => 'amg_47',
  438. __( 'Modern 19', 'avia_framework' ) => 'amg_48',
  439. __( 'Modern 20', 'avia_framework' ) => 'amg_49',
  440. __( 'Modern 21', 'avia_framework' ) => 'amg_50',
  441. __( 'Modern 22', 'avia_framework' ) => 'amg_51',
  442. __( 'Modern 23', 'avia_framework' ) => 'amg_52',
  443. __( 'Modern 24', 'avia_framework' ) => 'amg_53',
  444. __( 'Modern 25', 'avia_framework' ) => 'amg_54',
  445. __( 'Modern 26', 'avia_framework' ) => 'amg_55',
  446. __( 'Modern 27', 'avia_framework' ) => 'amg_56',
  447. __( 'Modern 28', 'avia_framework' ) => 'amg_57',
  448. __( 'Plastic', 'avia_framework' ) => 'amg_58',
  449. __( 'Neon Lines', 'avia_framework' ) => 'amg_59',
  450. __( 'Pulsating', 'avia_framework' ) => 'amg_60',
  451. __( 'Hover 4', 'avia_framework' ) => 'amg_62',
  452. __( 'Snake Border 2', 'avia_framework' ) => 'amg_63',
  453. __( 'Hover 5', 'avia_framework' ) => 'amg_64',
  454. __( 'Hover 6', 'avia_framework' ) => 'amg_65',
  455. __( 'Ripple', 'avia_framework' ) => 'amg_66',
  456. __( 'Snake Border 1', 'avia_framework' ) => 'amg_67',
  457. __( 'Gradient Hover Border', 'avia_framework' ) => 'amg_68',
  458. __( 'Pulsar', 'avia_framework' ) => 'amg_69',
  459. __( 'Neon Lights', 'avia_framework' ) => 'amg_70',
  460. __( 'Blend Mode', 'avia_framework' ) => 'amg_71',
  461. __( 'Bubble Bursts', 'avia_framework' ) => 'amg_72',
  462.  
  463. );
  464. ksort($arr, SORT_NATURAL);
  465. return $arr;
  466. }
  467. function amg_enfold_admin_menu() : void
  468. {
  469. add_options_page(
  470. 'AMG Enfold Extensions',
  471. 'AMG Enfold',
  472. 'manage_options',
  473. 'amg-enfold-options',
  474. array(
  475. $this,
  476. 'amg_enfold_admin_settings'
  477. ),
  478. '1'
  479. );
  480. }
  481. function amg_enfold_admin_settings_init() : void
  482. {
  483. /// sticky banner text
  484. add_settings_section (
  485. 'enfold_extensions_developer_section' ,
  486. 'Developer' ,
  487. '',
  488. 'amg-enfold-options'
  489. );
  490.  
  491. add_settings_section (
  492. 'enfold_extensions_elements_section' ,
  493. 'Active Elements' ,
  494. '',
  495. 'amg-enfold-options'
  496. );
  497.  
  498. register_setting(
  499. 'amg-enfold-options',
  500. 'amg_enfold_developer_mode',
  501. array(
  502. 'type' => 'string',
  503. 'sanitize_callback' => 'sanitize_text_field',
  504. 'default' => 'no'
  505. )
  506. );
  507. add_settings_field(
  508. 'amg_enfold_developer_mode',
  509. 'Developer Mode On',
  510. array($this, 'amg_enfold_developer_mode_callback'),
  511. 'amg-enfold-options',
  512. 'enfold_extensions_developer_section'
  513. );
  514.  
  515. $count = count($this->elements);
  516. for ($i = 0; $i < $count; $i++) {
  517. register_setting(
  518. 'amg-enfold-options',
  519. "amg_enfold_extensions_{$this->elements[$i]}_active",
  520. array(
  521. 'type' => 'string',
  522. 'default' => ''
  523. )
  524. );
  525. add_settings_field(
  526. "amg_enfold_extensions_{$this->elements[$i]}_active",
  527. ucfirst($this->elements[$i]),
  528. array($this, 'amg_enfold_modules_callback'),
  529. 'amg-enfold-options',
  530. 'enfold_extensions_elements_section',
  531. $this->elements[$i]
  532.  
  533. );
  534. }
  535.  
  536. $count = count($this->deletes);
  537. for ($k = 0; $i < $count; $k++) {
  538. $option = get_option("amg_enfold_extensions_{$this->deletes[$k]}_active");
  539. if (!empty($option)) {
  540. delete_option("amg_enfold_extensions_{$this->deletes[$k]}_active");
  541. }
  542. }
  543. }
  544. function amg_enfold_admin_settings(): void
  545. {
  546. require_once plugin_dir_path(__FILE__) . 'templates/admin_settings.php';
  547. }
  548. public function amg_enfold_developer_mode_callback(): void
  549. {
  550. $checked = checked( 'yes', get_option( 'amg_enfold_developer_mode' ), false );
  551. ?>
  552. <input type="checkbox" name="amg_enfold_developer_mode" value="yes" <?php echo $checked ?>/>
  553. <?php
  554. }
  555. public function amg_enfold_modules_callback($name): void
  556. {
  557. $field = "amg_enfold_extensions_{$name}_active";
  558. $checked = checked( 'yes', get_option( $field ), false );
  559. ?>
  560. <input type="checkbox" name="<?php echo $field ?>" value="yes" <?php echo $checked ?>/> &nbsp;
  561. <a title="view demo" href="<?php echo 'https://natesstg.wpenginepowered.com/' . $name . '/' ?>" target="_blank"><i class="fa-solid fa-arrow-up-right-from-square"></i></a>
  562.  
  563. <?php
  564. }
  565. public static function amg_enfold_popup() : void
  566. {
  567. $html = "<div id='amg-enfold-popup' class=''>";
  568. $html .= "<div id='amg-enfold-popup-bg'></div>";
  569. $html .= "<div id='amg-enfold-popup-box'>";
  570. $html .= "<div id='amg-enfold-popup-close'><i class='fi fi-br-circle-xmark'></i></div>";
  571. $html .= "<div id='content'></div>";
  572. $html .= "</div></div>";
  573. echo $html;
  574. }
  575.  
  576. public static function prepare_navigation(array $atts): array
  577. {
  578. $prev_button = '';
  579. $next_button = '';
  580. if (isset($atts['navigation']) && $atts['navigation'] == 'yes') {
  581. $prev_button = "<div class='swiper-button-prev'></div>";
  582. $next_button = '<div class="swiper-button-next"></div>';
  583. }
  584. if (isset($atts['pagination']) && $atts['pagination'] == 'yes') {
  585. $pagination = "<div class='swiper-pagination'></div>";
  586. }
  587.  
  588. $above = '';
  589. $below = '';
  590. $side = '';
  591. if (isset($atts['navigation_position']) && $atts['navigation_position'] == 'above' && $atts['nav_layout'] == 'custom') {
  592. $above = "<div class='swiper-nav-wrapper above'>";
  593. $above .= $prev_button;
  594. $above .= $pagination;
  595. $above .= $next_button;
  596. $above .= '</div>';
  597. } else if (isset($atts['navigation_position']) && $atts['navigation_position'] == 'below' && $atts['nav_layout'] == 'custom') {
  598. $below = "<div class='swiper-nav-wrapper below'>";
  599. $below .= $prev_button;
  600. $below .= $pagination;
  601. $below .= $next_button;
  602. $below .= '</div>';
  603. } else {
  604. $below = $pagination;
  605. $side = $prev_button;
  606. $side .= $next_button;
  607. }
  608. return array($atts, $above, $below, $side);
  609. }
  610.  
  611. public static function amg_enfold_section($title) : array
  612. {
  613. $c = null;
  614. $template = null;
  615. switch ($title) {
  616. case 'Button':
  617. $c = array(
  618. array(
  619. 'name' => __( 'Enable?', 'avia_framework' ),
  620. 'desc' => __( 'Choosing yes enables the button for this single element.', 'avia_framework' ),
  621. 'id' => 'button',
  622. 'type' => 'select',
  623. 'std' => 'no',
  624. 'lockable' => true,
  625. 'subtype' => array(
  626. __( 'No', 'avia_framework' ) => 'no',
  627. __( 'Yes', 'avia_framework' ) => 'yes' ,
  628. )
  629. ),
  630. array(
  631. 'name' => __( 'Button Label', 'avia_framework' ),
  632. 'desc' => __( 'This is the text that appears on your button.', 'avia_framework' ),
  633. 'id' => 'label',
  634. 'type' => 'input',
  635. 'std' => __( 'Contact Us', 'avia_framework' ),
  636. 'required' => array( 'button', 'equals', 'yes' ),
  637. 'lockable' => true
  638. ),
  639. /* array(
  640. 'name' => __( 'Show Button Icon', 'avia_framework' ),
  641. 'desc' => __( 'Should an icon be displayed at the left or right side of the button', 'avia_framework' ),
  642. 'id' => 'button_icon_select',
  643. 'type' => 'select',
  644. 'std' => 'yes',
  645. 'lockable' => true,
  646. 'required' => array( 'button', 'equals', 'yes' ),
  647. 'subtype' => array(
  648. __( 'No Icon', 'avia_framework' ) => 'no',
  649. __( 'Display icon to the left', 'avia_framework' ) => 'yes' ,
  650. __( 'Display icon to the right', 'avia_framework' ) => 'yes-right-icon',
  651. )
  652. ),
  653. array(
  654. 'name' => __( 'Button Icon', 'avia_framework' ),
  655. 'desc' => __( 'Select an icon for your Button below', 'avia_framework' ),
  656. 'id' => 'button_icon',
  657. 'type' => 'iconfont',
  658. 'std' => '',
  659. 'lockable' => true,
  660. 'locked' => array( 'button_icon', 'font' ),
  661. 'required' => array( 'button_icon_select', 'not_empty_and', 'no' )
  662. ),
  663. array(
  664. 'name' => __( 'Icon Visibility', 'avia_framework' ),
  665. 'desc' => __( 'Check to only display icon on hover', 'avia_framework' ),
  666. 'id' => 'button_icon_hover',
  667. 'type' => 'checkbox',
  668. 'std' => '',
  669. 'lockable' => true,
  670. 'required' => array( 'button_icon_select', 'not_empty_and', 'no' )
  671. )*/
  672.  
  673. );
  674. break;
  675. case 'Link Settings':
  676. $template = array(
  677. array(
  678. 'type' => 'template',
  679. 'template_id' => 'linkpicker_toggle',
  680. 'name' => __( 'Button Link', 'avia_framework' ),
  681. 'desc' => __( 'Where should your button link to?', 'avia_framework' ),
  682. 'subtypes' => array( 'manually', 'single', 'taxonomy' ),
  683. 'target_id' => 'link_target',
  684. 'lockable' => true
  685. ),
  686. );
  687. break;
  688. case 'Appearance':
  689. $c = array(
  690. array(
  691. 'name' => __( 'Button Size', 'avia_framework' ),
  692. 'desc' => __( 'Choose the size of your button here.', 'avia_framework' ),
  693. 'id' => 'size',
  694. 'type' => 'select',
  695. 'std' => 'small',
  696. 'lockable' => true,
  697. 'subtype' => array(
  698. __( 'Small', 'avia_framework' ) => 'small',
  699. __( 'Medium', 'avia_framework' ) => 'medium',
  700. __( 'Large', 'avia_framework' ) => 'large',
  701. __( 'X Large', 'avia_framework' ) => 'x-large'
  702. )
  703. ),
  704.  
  705. array(
  706. 'name' => __( 'Button Position', 'avia_framework' ),
  707. 'desc' => __( 'Choose the alignment of your button here', 'avia_framework' ),
  708. 'id' => 'position',
  709. 'type' => 'select',
  710. 'std' => 'center',
  711. 'lockable' => true,
  712. 'subtype' => array(
  713. __( 'Align Left', 'avia_framework' ) => 'left',
  714. __( 'Align Center', 'avia_framework' ) => 'center',
  715. __( 'Align Right', 'avia_framework' ) => 'right',
  716. ),
  717. 'required' => array( 'size', 'not', 'fullwidth' )
  718. ),
  719.  
  720. array(
  721. 'name' => __( 'Button Label Display', 'avia_framework' ),
  722. 'desc' => __( 'Select how to display the label', 'avia_framework' ),
  723. 'id' => 'label_display',
  724. 'type' => 'select',
  725. 'std' => '',
  726. 'lockable' => true,
  727. 'subtype' => array(
  728. __( 'Always display', 'avia_framework' ) => '',
  729. __( 'Display on hover', 'avia_framework' ) => 'av-button-label-on-hover',
  730. )
  731. ),
  732.  
  733. array(
  734. 'name' => __( 'Button Title Attribute', 'avia_framework' ),
  735. 'desc' => __( 'Add a title attribute for this button.', 'avia_framework' ),
  736. 'id' => 'title_attr',
  737. 'type' => 'input',
  738. 'std' => '',
  739. 'required' => array( 'label_display', 'equals', '' )
  740. ),
  741.  
  742.  
  743. );
  744. break;
  745. case 'Font Sizes':
  746. $c = array(
  747. array(
  748. 'name' => __( 'Button Text Font Sizes', 'avia_framework' ),
  749. 'desc' => __( 'Select a custom font size for the button text.', 'avia_framework' ),
  750. 'type' => 'template',
  751. 'template_id' => 'font_sizes_icon_switcher',
  752. 'textfield' => true,
  753. 'lockable' => true,
  754. 'subtype' => array(
  755. 'default' => AviaHtmlHelper::number_array( 10, 90, 1, array( __( 'Use Default', 'avia_framework' ) => '' ), 'px' ),
  756. 'desktop' => AviaHtmlHelper::number_array( 10, 90, 1, array( __( 'Use Default', 'avia_framework' ) => '' ), 'px' ),
  757. 'medium' => AviaHtmlHelper::number_array( 10, 90, 1, array( __( 'Use Default', 'avia_framework' ) => '', __( 'Hidden', 'avia_framework' ) => 'hidden' ), 'px' ),
  758. 'small' => AviaHtmlHelper::number_array( 10, 90, 1, array( __( 'Use Default', 'avia_framework' ) => '', __( 'Hidden', 'avia_framework' ) => 'hidden' ), 'px' ),
  759. 'mini' => AviaHtmlHelper::number_array( 10, 90, 1, array( __( 'Use Default', 'avia_framework' ) => '', __( 'Hidden', 'avia_framework' ) => 'hidden' ), 'px' )
  760. ),
  761. 'id_sizes' => array(
  762. 'default' => 'size-text',
  763. 'desktop' => 'av-desktop-font-size-text',
  764. 'medium' => 'av-medium-font-size-text',
  765. 'small' => 'av-small-font-size-text',
  766. 'mini' => 'av-mini-font-size-text'
  767. )
  768. ),
  769. array(
  770. 'name' => __( 'Button Icon Font Sizes', 'avia_framework' ),
  771. 'desc' => __( 'Select a custom font size for the button text.', 'avia_framework' ),
  772. 'type' => 'template',
  773. 'template_id' => 'font_sizes_icon_switcher',
  774. 'textfield' => true,
  775. 'lockable' => true,
  776. 'subtype' => array(
  777. 'default' => AviaHtmlHelper::number_array( 10, 90, 1, array( __( 'Use Default', 'avia_framework' ) => '' ), 'px' ),
  778. 'desktop' => AviaHtmlHelper::number_array( 10, 90, 1, array( __( 'Use Default', 'avia_framework' ) => '' ), 'px' ),
  779. 'medium' => AviaHtmlHelper::number_array( 10, 90, 1, array( __( 'Use Default', 'avia_framework' ) => '', __( 'Hidden', 'avia_framework' ) => 'hidden' ), 'px' ),
  780. 'small' => AviaHtmlHelper::number_array( 10, 90, 1, array( __( 'Use Default', 'avia_framework' ) => '', __( 'Hidden', 'avia_framework' ) => 'hidden' ), 'px' ),
  781. 'mini' => AviaHtmlHelper::number_array( 10, 90, 1, array( __( 'Use Default', 'avia_framework' ) => '', __( 'Hidden', 'avia_framework' ) => 'hidden' ), 'px' )
  782. ),
  783. 'id_sizes' => array(
  784. 'default' => 'size-button-icon',
  785. 'desktop' => 'av-desktop-font-size-button-icon',
  786. 'medium' => 'av-medium-font-size-button-icon',
  787. 'small' => 'av-small-font-size-button-icon',
  788. 'mini' => 'av-mini-font-size-button-icon'
  789. )
  790. )
  791. );
  792. break;
  793. case 'Button Margin And Padding':
  794. $template = array(
  795. array(
  796. 'type' => 'template',
  797. 'template_id' => 'margin_padding',
  798. 'toggle' => true,
  799. 'name' => __( 'Margin And Padding', 'avia_framework' ),
  800. 'desc' => __( 'Set a responsive margin and a padding to text for the button.', 'avia_framework' ),
  801. 'lockable' => true,
  802. )
  803. );
  804. break;
  805. case 'Colors':
  806. $c = array(
  807. array(
  808. 'name' => __( 'Button Colors Selection', 'avia_framework' ),
  809. 'desc' => __( "Choose the available options for button colors. Switching to advanced options for already existing buttons you need to set all options (color settings from basic options are ignored)", 'avia_framework' ),
  810. 'id' => 'color_options',
  811. 'type' => 'select',
  812. 'std' => '',
  813. 'lockable' => true,
  814. 'subtype' => array(
  815. __( 'Basic options only', 'avia_framework' ) => '',
  816. __( 'Advanced options', 'avia_framework' ) => 'color_options_advanced',
  817. )
  818. ),
  819. array(
  820. 'type' => 'template',
  821. 'template_id' => 'named_colors',
  822. 'custom' => true,
  823. 'lockable' => true,
  824. 'required' => array( 'color_options', 'equals', '' )
  825. ),
  826. array(
  827. 'name' => __( 'Custom Background Color', 'avia_framework' ),
  828. 'desc' => __( 'Select a custom background color for your button here', 'avia_framework' ),
  829. 'id' => 'custom_bg',
  830. 'type' => 'colorpicker',
  831. 'std' => '#444444',
  832. 'lockable' => true,
  833. 'required' => array( 'color', 'equals', 'custom' )
  834. ),
  835. array(
  836. 'name' => __( 'Custom Font Color', 'avia_framework' ),
  837. 'desc' => __( 'Select a custom font color for your button here', 'avia_framework' ),
  838. 'id' => 'custom_font',
  839. 'type' => 'colorpicker',
  840. 'std' => '#ffffff',
  841. 'lockable' => true,
  842. 'required' => array( 'color', 'equals', 'custom')
  843. ),
  844. array(
  845. 'type' => 'template',
  846. 'template_id' => 'button_colors',
  847. 'color_id' => 'btn_color',
  848. 'custom_id' => 'btn_custom',
  849. 'lockable' => true,
  850. 'required' => array( 'color_options', 'not', '' )
  851. )
  852. );
  853. break;
  854. case 'Animation':
  855. $c = array(
  856. array(
  857. 'type' => 'template',
  858. 'template_id' => 'animation',
  859. 'lockable' => true,
  860. 'std_none' => '',
  861. 'name' => __( 'Button Animation', 'avia_framework' ),
  862. 'desc' => __( 'Add a small animation to the button when the user first scrolls to the button position. This is only to add some &quot;spice&quot; to the site and only works in modern browsers and only on desktop computers to keep page rendering as fast as possible.', 'avia_framework' ),
  863. 'groups' => array( 'fade', 'slide', 'rotate', 'fade-adv', 'special' )
  864. )
  865. );
  866. break;
  867. case 'Content':
  868. $c = array(
  869. array(
  870. 'name' => __( 'Content Display', 'avia_framework' ),
  871. 'desc' => __( 'Choose to display the content in a popup or below the slides.', 'avia_framework' ),
  872. 'id' => 'content_layout',
  873. 'type' => 'select',
  874. 'std' => '',
  875. 'lockable' => true,
  876. 'subtype' => array(
  877. __( 'No Display', 'avia_framework' ) => '',
  878. __( 'Display content in popup', 'avia_framework' ) => 'popup',
  879. __( 'Display content below slides', 'avia_framework' ) => 'inline'
  880. ),
  881. ),
  882. array(
  883. 'name' => __( 'Max Width', 'avia_framework' ),
  884. 'desc' => __( 'This is the width of your content box.', 'avia_framework' ),
  885. 'id' => 'popup_max_width',
  886. 'type' => 'input',
  887. 'std' => '750px',
  888. 'lockable' => true,
  889. 'required' => array( 'content_layout', 'not', '' ),
  890. 'container_class' => 'av_third av_third_first'
  891. ),
  892. array(
  893. 'name' => __( 'Min Height', 'avia_framework' ),
  894. 'desc' => __( 'This is the min-height of your content box.', 'avia_framework' ),
  895. 'id' => 'popup_min_height',
  896. 'type' => 'input',
  897. 'std' => '320px',
  898. 'lockable' => true,
  899. 'required' => array( 'content_layout', 'not', '' ),
  900. 'container_class' => 'av_third'
  901. ),
  902. array(
  903. 'name' => __( 'Text Align', 'avia_framework' ),
  904. 'desc' => __( 'Figure it out.', 'avia_framework' ),
  905. 'id' => 'popup_text_align',
  906. 'type' => 'select',
  907. 'std' => 'center',
  908. 'lockable' => true,
  909. 'required' => array( 'content_layout', 'not', '' ),
  910. 'container_class' => 'av_third',
  911. 'subtype' => array(
  912. __( 'Left', 'avia_framework' ) => 'left',
  913. __( 'Center', 'avia_framework' ) => 'center',
  914. __( 'Right', 'avia_framework' ) => 'right'
  915. ),
  916. ),
  917. array(
  918. 'name' => __( 'Container BG Color', 'avia_framework' ),
  919. 'desc' => __( 'This is the background of the content box', 'avia_framework' ),
  920. 'id' => 'popup_background_color',
  921. 'type' => 'colorpicker',
  922. 'std' => '',
  923. 'rgba' => true,
  924. 'lockable' => true,
  925. 'required' => array( 'content_layout', 'equals', 'popup' ),
  926. 'container_class' => 'av_half av_half_first'
  927. ),
  928. array(
  929. 'name' => __( 'Background BG Color', 'avia_framework' ),
  930. 'desc' => __( 'This is the full page background when the popup is visible.', 'avia_framework' ),
  931. 'id' => 'popup_bg_color',
  932. 'type' => 'colorpicker',
  933. 'std' => '',
  934. 'rgba' => true,
  935. 'lockable' => true,
  936. 'required' => array( 'content_layout', 'equals', 'popup' ),
  937. 'container_class' => 'av_half'
  938. ),
  939. array(
  940. 'name' => __( 'Border Radius', 'avia_framework' ),
  941. 'desc' => __( 'Set the border radius of the content box.', 'avia_framework' ),
  942. 'id' => 'popup_border_radius',
  943. 'type' => 'multi_input',
  944. 'sync' => true,
  945. 'std' => '24px',
  946. 'lockable' => true,
  947. 'required' => array( 'content_layout', 'not', '' ),
  948. 'multi' => array(
  949. 'top' => __( 'Top-Left-Radius', 'avia_framework' ),
  950. 'right' => __( 'Top-Right-Radius', 'avia_framework' ),
  951. 'bottom' => __( 'Bottom-Right-Radius', 'avia_framework' ),
  952. 'left' => __( 'Bottom-Left-Radius', 'avia_framework' )
  953. ),
  954. ),
  955. array(
  956. 'type' => 'template',
  957. 'template_id' => 'box_shadow',
  958. 'id' => 'popup_box_shadow',
  959. 'names' => array(
  960. __( 'Box Shadow', 'avia_framework' ),
  961. __( 'Box Shadow Styling ', 'avia_framework' ),
  962. __( 'Box Shadow Color', 'avia_framework' )
  963. ),
  964. 'default_check' => true,
  965. 'lockable' => true,
  966. 'required' => array( 'content_layout', 'not', '' )
  967. )
  968. );
  969. break;
  970. case 'Navigation':
  971. $c = array(
  972. array(
  973. 'name' => __( 'Navigation Layout', 'avia_framework' ),
  974. 'desc' => __( 'Either use the widget default colors or apply some custom ones', 'avia_framework' ),
  975. 'id' => 'nav_layout',
  976. 'type' => 'select',
  977. 'std' => '',
  978. 'lockable' => true,
  979. 'subtype' => array(
  980. __( 'Default', 'avia_framework' ) => '',
  981. __( 'Define Custom layout', 'avia_framework' ) => 'custom'
  982. ),
  983.  
  984. ),
  985. array(
  986. 'name' => __( 'Vertical Position', 'avia_framework' ),
  987. 'desc' => __( 'Define the vertical position of the navigation controls', 'avia_framework' ),
  988. 'id' => 'navigation_position',
  989. 'type' => 'select',
  990. 'std' => '',
  991. 'lockable' => true,
  992. 'required' => array( 'nav_layout', 'equals', 'custom' ),
  993. 'subtype' => array(
  994. __( 'Default', 'avia_framework' ) => '',
  995. __( 'Above', 'avia_framework' ) => 'above',
  996. __( 'Below', 'avia_framework' ) => 'below',
  997. )
  998. ),
  999. array(
  1000. 'name' => __( 'Controls Max Width', 'avia_framework' ),
  1001. 'desc' => __( 'Enter the max width of the navigation controls', 'avia_framework' ),
  1002. 'id' => 'nav_max_width',
  1003. 'type' => 'input',
  1004. 'std' => '100%',
  1005. 'lockable' => true,
  1006. 'required' => array( 'navigation_position', 'not', ''),
  1007.  
  1008. ),
  1009. array(
  1010. 'name' => __( 'Horizontal Alignment', 'avia_framework' ),
  1011. 'desc' => __( 'This only works if navigation controls are not 100% max width', 'avia_framework' ),
  1012. 'id' => 'navigation_alignment',
  1013. 'type' => 'select',
  1014. 'std' => 'center',
  1015. 'lockable' => true,
  1016. 'required' => array( 'navigation_position', 'not', ''),
  1017. 'subtype' => array(
  1018. __( 'Left', 'avia_framework' ) => 'left',
  1019. __( 'Center', 'avia_framework' ) => 'center',
  1020. __( 'Right', 'avia_framework' ) => 'right',
  1021. )
  1022. ),
  1023. array(
  1024. 'name' => __( 'Horizontal Offset', 'avia_framework' ),
  1025. 'desc' => __( 'Enter a CSS value (50px) to push the controls towards center', 'avia_framework' ),
  1026. 'id' => 'nav_offset',
  1027. 'type' => 'input',
  1028. 'std' => '0',
  1029. 'lockable' => true,
  1030. 'required' => array( 'navigation_alignment', 'not', 'center'),
  1031. ),
  1032. array(
  1033. 'name' => __( 'Button Width', 'avia_framework' ),
  1034. 'desc' => __( 'Button width in a CSS value', 'avia_framework' ),
  1035. 'id' => 'nav_width',
  1036. 'type' => 'input',
  1037. 'std' => '50px',
  1038. 'lockable' => true,
  1039. 'required' => array( 'nav_layout', 'equals', 'custom' ),
  1040. 'container_class' => 'av_half av_half_first'
  1041. ),
  1042. array(
  1043. 'name' => __( 'Button Height', 'avia_framework' ),
  1044. 'desc' => __( 'Button height in a CSS value', 'avia_framework' ),
  1045. 'id' => 'nav_height',
  1046. 'type' => 'input',
  1047. 'std' => '50px',
  1048. 'lockable' => true,
  1049. 'required' => array( 'nav_layout', 'equals', 'custom' ),
  1050. 'container_class' => 'av_half'
  1051. ),
  1052. array(
  1053. 'name' => __( 'Button Border Radius', 'avia_framework' ),
  1054. 'desc' => __( 'Set the border radius of the button', 'avia_framework' ),
  1055. 'id' => 'nav_radius',
  1056. 'type' => 'multi_input',
  1057. 'sync' => true,
  1058. 'std' => '50%',
  1059. 'lockable' => true,
  1060. 'required' => array( 'nav_layout', 'equals', 'custom' ),
  1061. 'multi' => array(
  1062. 'top' => __( 'Top-Left-Radius', 'avia_framework' ),
  1063. 'right' => __( 'Top-Right-Radius', 'avia_framework' ),
  1064. 'bottom' => __( 'Bottom-Right-Radius', 'avia_framework' ),
  1065. 'left' => __( 'Bottom-Left-Radius', 'avia_framework' )
  1066. ),
  1067. ),
  1068. );
  1069. break;
  1070. case 'Image':
  1071. $c = array(
  1072. array(
  1073. 'name' => __( 'Image Size and Orientation', 'avia_framework' ),
  1074. 'desc' => __( 'Either use the widget default colors or apply some custom ones', 'avia_framework' ),
  1075. 'id' => 'orientation_and_size',
  1076. 'type' => 'select',
  1077. 'std' => '',
  1078. 'lockable' => true,
  1079. 'subtype' => AbstraktEnfoldExtensions::get_image_sizes(),
  1080. ),
  1081. array(
  1082. 'name' => __( 'Image Aspect Ratio', 'avia_framework' ),
  1083. 'desc' => __( 'Enter the CSS value as a fraction, ie 16/9', 'avia_framework' ),
  1084. 'id' => 'aspect_ratio',
  1085. 'type' => 'input',
  1086. 'std' => '',
  1087. 'lockable' => true,
  1088. 'required' => array( 'orientation_and_size', 'not', '' ),
  1089. 'container_class' => 'av_third av_third_first'
  1090. ),
  1091. array(
  1092. 'name' => __( 'Image Object Fit', 'avia_framework' ),
  1093. 'desc' => __( 'Select one of the CSS values or choose none.', 'avia_framework' ),
  1094. 'id' => 'object_fit',
  1095. 'type' => 'select',
  1096. 'std' => 'cover',
  1097. 'lockable' => true,
  1098. 'required' => array( 'orientation_and_size', 'not', '' ),
  1099. 'container_class' => 'av_third',
  1100. 'subtype' => array(
  1101. __( 'None', 'avia_framework' ) => 'none',
  1102. __( 'Fill', 'avia_framework' ) => 'fill',
  1103. __( 'Contain', 'avia_framework' ) => 'contain',
  1104. __( 'Cover', 'avia_framework' ) => 'cover',
  1105. __( 'Scale Down', 'avia_framework' ) => 'scale-down'
  1106. ),
  1107. ),
  1108. array(
  1109. 'name' => __( 'Image Object Position', 'avia_framework' ),
  1110. 'desc' => __( 'Enter a css value ie 50% 50% or left top', 'avia_framework' ),
  1111. 'id' => 'object_position',
  1112. 'type' => 'input',
  1113. 'std' => 'center center',
  1114. 'lockable' => true,
  1115. 'required' => array( 'orientation_and_size', 'not', '' ),
  1116. 'container_class' => 'av_third',
  1117. ),
  1118. );
  1119. break;
  1120. case 'Container':
  1121. $c = array(
  1122. array(
  1123. 'name' => __( 'Slides Layout', 'avia_framework' ),
  1124. 'desc' => __( 'Either use the widget default colors or apply some custom ones', 'avia_framework' ),
  1125. 'id' => 'slides_layout',
  1126. 'type' => 'select',
  1127. 'std' => '',
  1128. 'lockable' => true,
  1129. 'subtype' => array(
  1130. __( 'Default', 'avia_framework' ) => '',
  1131. __( 'Define Custom layout', 'avia_framework' ) => 'custom'
  1132. ),
  1133.  
  1134. ),
  1135. array(
  1136. 'name' => __( 'Badge Max Width', 'avia_framework' ),
  1137. 'desc' => __( 'Enter the badges title here (Better keep it short)', 'avia_framework' ),
  1138. 'id' => 'max_width',
  1139. 'type' => 'input',
  1140. 'std' => '250px',
  1141. 'lockable' => true,
  1142. 'required' => array( 'slides_layout', 'equals', 'custom' ),
  1143. 'container_class' => 'av_half av_half_first'
  1144. ),
  1145. array(
  1146. 'name' => __( 'Badge Min Height', 'avia_framework' ),
  1147. 'desc' => __( 'Enter the badges title here (Better keep it short)', 'avia_framework' ),
  1148. 'id' => 'min_height',
  1149. 'type' => 'input',
  1150. 'std' => '400px',
  1151. 'lockable' => true,
  1152. 'required' => array( 'slides_layout', 'equals', 'custom' ),
  1153. 'container_class' => 'av_half'
  1154. ),
  1155. array(
  1156. 'name' => __( 'Badge Border Radius', 'avia_framework' ),
  1157. 'desc' => __( 'Set the border radius of the column', 'avia_framework' ),
  1158. 'id' => 'border_radius',
  1159. 'type' => 'multi_input',
  1160. 'sync' => true,
  1161. 'std' => '',
  1162. 'lockable' => true,
  1163. 'required' => array( 'slides_layout', 'equals', 'custom' ),
  1164. 'multi' => array(
  1165. 'top' => __( 'Top-Left-Radius', 'avia_framework' ),
  1166. 'right' => __( 'Top-Right-Radius', 'avia_framework' ),
  1167. 'bottom' => __( 'Bottom-Right-Radius', 'avia_framework' ),
  1168. 'left' => __( 'Bottom-Left-Radius', 'avia_framework' )
  1169. ),
  1170. ),
  1171. );
  1172. break;
  1173. }
  1174. if (!is_array($template)) {
  1175. $template = array(
  1176. array(
  1177. 'type' => 'template',
  1178. 'template_id' => 'toggle',
  1179. 'title' => __( $title, 'avia_framework' ),
  1180. 'content' => $c
  1181. ),
  1182. );
  1183. }
  1184.  
  1185. return $template;
  1186. }
  1187. public static function amg_enfold_inline($atts) : string
  1188. {
  1189. $output = '';
  1190. if ($atts['content_layout'] == 'inline') {
  1191. $output .= "<div id='amg-enfold-inline'>";
  1192. $output .= "<div id='amg-enfold-inline-box'>";
  1193. $output .= "<div id='content'></div>";
  1194. $output .= "</div>";
  1195. $output .= "</div>";
  1196. }
  1197. return $output;
  1198. }
  1199.  
  1200. public static function amg_button_append_selectors($selectors, $element_id) : array
  1201. {
  1202. $selectors['wrap'] = "#top #wrap_all .accordionContainer.{$element_id} .c-accordion .c-accordion__item .avia-button-wrap.button-wrap";
  1203. $selectors['wrap-animation'] = "#top #wrap_all .accordionContainer.{$element_id} .c-accordion .c-accordion__item .avia_transform .avia-button-wrap.button-wrap";
  1204. $selectors['button_container'] = "#top #wrap_all .accordionContainer.{$element_id} .c-accordion .c-accordion__item .avia-button";
  1205. $selectors['container-hover'] = "#top #wrap_all .accordionContainer.{$element_id} .c-accordion .c-accordion__item .avia-button:hover";
  1206. $selectors['container-hover-overlay'] = "#top #wrap_all .accordionContainer.{$element_id} .c-accordion .c-accordion__item .avia-button:hover .avia_button_background";
  1207. $selectors['container-after'] = "#top #wrap_all .accordionContainer.{$element_id} .c-accordion .c-accordion__item .avia-button.avia-sonar-shadow:after";
  1208. $selectors['container-after-hover'] = "#top #wrap_all .accordionContainer.{$element_id} .c-accordion .c-accordion__item .avia-button.avia-sonar-shadow:hover:after";
  1209. $selectors['curtain'] = "#top #wrap_all .accordionContainer.{$element_id} .c-accordion .c-accordion__item .avia-button-wrap.button-wrap .avia-curtain-reveal-overlay";
  1210. $selectors['button_icon'] = "#top #wrap_all .accordionContainer.{$element_id} .c-accordion .c-accordion__item .amg-button-wrap .amg-tab-icon";
  1211.  
  1212. return $selectors;
  1213. }
  1214.  
  1215. public static function amg_create_button(array $atts, array $meta, $container_class, $style_tag, $wrap_class, $background_hover ):string {
  1216. $data = '';
  1217.  
  1218. /* if( $atts['button_icon_select'] == 'yes' )
  1219. {
  1220. $atts['button_icon_select'] = 'yes-left-icon';
  1221. }
  1222.  
  1223. $fonts = explode(',', $atts['font']);
  1224. $font = $fonts[1] ?? $fonts[0];
  1225. $display_char = av_icon( $atts['button_icon'], $font );*/
  1226.  
  1227. if( ! empty( $atts['label_display'] ) && $atts['label_display'] == 'av-button-label-on-hover' )
  1228. {
  1229. $data .= 'data-avia-tooltip="' . htmlspecialchars( $atts['label'] ) . '"';
  1230. $atts['label'] = '';
  1231. }
  1232.  
  1233. $blank = AviaHelper::get_link_target( $atts['link_target'] );
  1234. $link = AviaHelper::get_url( $atts['link'] );
  1235. $link = ( ( $link == 'http://' ) || ( $link == 'manually' ) ) ? '' : $link;
  1236.  
  1237. $title_attr = ! empty( $atts['title_attr'] ) && empty( $atts['label_display'] ) ? 'title="' . esc_attr( $atts['title_attr'] ) . '"' : '';
  1238.  
  1239. $content_html = '';
  1240.  
  1241. /*if( 'yes-left-icon' == $atts['button_icon_select'] )
  1242. {
  1243. $content_html .= "<span class='avia_button_icon avia_button_icon_left'></span>";
  1244. }*/
  1245.  
  1246. $content_html .= "<span class='avia_iconbox_title' >{$atts['label']}</span>";
  1247.  
  1248. /*if( 'yes-right-icon' == $atts['button_icon_select'] )
  1249. {
  1250. $content_html .= "<span class='avia_button_icon avia_button_icon_right' {$display_char}></span>";
  1251. }*/
  1252.  
  1253. $curtain_reveal_overlay = '';
  1254.  
  1255. $html = '';
  1256. $html .= $style_tag;
  1257.  
  1258. $html .= "<a href='{$link}' {$data} class='{$container_class}' {$blank} {$title_attr}>";
  1259. $html .= $curtain_reveal_overlay;
  1260. $html .= $content_html;
  1261. $html .= $background_hover;
  1262. $html .= '</a>';
  1263.  
  1264. $output = "<div {$meta['custom_el_id']} class='avia-button-wrap {$wrap_class} avia-button-{$atts['position']} {$meta['el_class']}'>";
  1265. //$output .= $curtain_reveal_overlay;
  1266. $output .= $html;
  1267. $output .= '</div>';
  1268.  
  1269. return $output;
  1270. }
  1271. }
  1272. }
  1273.  
  1274. new AbstraktEnfoldExtensions();
  1275.  
  1276. require 'plugin-update-checker-master/plugin-update-checker.php';
  1277. use YahnisElsts\PluginUpdateChecker\v5\PucFactory;
  1278. $myUpdateChecker = PucFactory::buildUpdateChecker(
  1279. 'https://nates1dev.wpengine.com/wp-content/uploads/enfold-extensions/info.json',
  1280. __FILE__, //Full path to the main plugin file or functions.php.
  1281. 'abstrakt-enfold-extensions'
  1282. );
Advertisement
Add Comment
Please, Sign In to add comment