PluginProbe
Borderless – Addons and Templates for Elementor / 1.2.5
Borderless – Addons and Templates for Elementor v1.2.5
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 1.1.0 1.1.1 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 1.1.9 1.2.0 1.2.1 1.2.2 1.2.3 All 78 releases
borderless / modules / wpbakery / wpbakery.php

wpbakery.php in Borderless – Addons and Templates for Elementor 1.2.5, at modules/wpbakery/wpbakery.php

73 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 // don't load directly
4 defined( 'ABSPATH' ) || exit;
5
6 final class Borderless_Wpbakery {
7
8 public function __construct() {
9
10 // We safely integrate with WPBakery with this hook
11 add_action( 'plugins_loaded', [ $this, 'wpbakery_check' ] );
12
13 add_action('admin_enqueue_scripts',array($this,'wpbakery_icon_fonts_styles'));
14
15 }
16
17 // Check if WPBakery is installed
18 public function wpbakery_check() {
19 if ( defined( 'WPB_VC_VERSION' ) ) {
20 add_action( 'init', [ $this, 'wpbakery_init' ] );
21 return;
22 } else {
23 add_action('admin_notices', array( $this, 'wpbakery_notice' ));
24 return;
25 }
26 }
27
28 // Show notice if your plugin is activated but WPBakery is not
29 public function wpbakery_notice() {
30 $plugin_data = get_plugin_data(__FILE__);
31 echo '
32 <div class="updated">
33 <p>'.sprintf(__('<strong>%s</strong> requires <strong><a href="https://wpbakery.com/" target="_blank">WPBakery Page Builder</a></strong> plugin to be installed and activated on your site.', 'borderless'), $plugin_data['Name']).'</p>
34 </div>';
35 }
36
37 public function wpbakery_init() {
38
39 require_once( BORDERLESS__WPBAKERY . "/lean-map.php");
40 require_once( BORDERLESS__WPBAKERY . "/paramns/icon-manager-param.php" );
41
42 }
43
44 function wpbakery_icon_fonts_styles($hook) {
45
46 // enqueue css files on backend
47 if($hook == "post.php" || $hook == "post-new.php" || $hook == 'visual-composer_page_vc-roles'){
48 if((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || is_ssl()) {
49 $scheme = 'https';
50 }
51 else {
52 $scheme = 'http';
53 }
54 $this->paths = wp_upload_dir();
55 $this->paths['fonts'] = 'borderless_icon_fonts';
56 $this->paths['fonturl'] = set_url_scheme($this->paths['baseurl'].'/'.$this->paths['fonts'], $scheme);
57 $fonts = get_option('borderless_icon_fonts');
58 if(is_array($fonts))
59 {
60 foreach($fonts as $font => $info)
61 {
62 if(strpos($info['style'], 'http://' ) !== false) {
63 wp_enqueue_style('borderless-'.$font,$info['style']);
64 } else {
65 wp_enqueue_style('borderless-'.$font,trailingslashit($this->paths['fonturl']).$info['style']);
66 }
67 }
68 }
69 }
70 }
71
72 }
73 new Borderless_Wpbakery();