PluginProbe
Borderless – Addons and Templates for Elementor / 1.1.1
Borderless – Addons and Templates for Elementor v1.1.1
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 / borderless.php

borderless.php in Borderless – Addons and Templates for Elementor 1.1.1, at borderless.php

119 lines 4.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /*
4 Plugin Name: Borderless
5 Plugin URI: https://borderless.visualmodo.com/
6 Description: One service packed with powerful tools to help you reach your purposes.
7 Version: 1.1.1
8 Author: Visualmodo
9 Author URI: https://visualmodo.com
10 License: GPLv3 or later
11 Text Domain: borderless
12 Domain Path: /languages
13 */
14
15 // don't load directly
16 defined( 'ABSPATH' ) || exit;
17
18 /**
19 * Define Constants.
20 */
21 define( 'BORDERLESS__VERSION', '1.1.1' );
22 define( 'BORDERLESS__DIR', plugin_dir_path( __FILE__ ) );
23 define( 'BORDERLESS__URL', plugins_url( '/', __FILE__ ) );
24 define( 'BORDERLESS__INC', BORDERLESS__DIR . '/includes' );
25 define( 'BORDERLESS__ASSETS', BORDERLESS__DIR . '/assets' );
26 define( 'BORDERLESS__WPBAKERY', BORDERLESS__DIR . '/modules/wpbakery' );
27 define( 'BORDERLESS__ELEMENTOR', BORDERLESS__DIR . '/modules/elementor' );
28 define( 'BORDERLESS__RELATED_POSTS', BORDERLESS__DIR . '/modules/related-posts' );
29
30
31 /**
32 * Requires.
33 */
34
35 $options = get_option( 'borderless' ); // Just for enable/disable requires.
36 require_once( BORDERLESS__DIR . "/dashboard.php");
37 require_once( BORDERLESS__INC . "/icon-manager/icon-manager.php");
38 require_once( BORDERLESS__INC . "/svg/svg.php");
39 if ( isset( $options['elementor'] ) && in_array( 'elementor/elementor.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) { require_once( BORDERLESS__ELEMENTOR . "/elementor.php"); }
40 if ( isset( $options['related_posts'] ) ) { require_once( BORDERLESS__RELATED_POSTS . "/related-posts.php"); }
41
42 /*-----------------------------------------------------------------------------------*/
43 /* *. Borderless Construct
44 /*-----------------------------------------------------------------------------------*/
45
46 class Borderless {
47 function __construct() {
48
49 // We safely integrate with WPBakery with this hook
50 add_action( 'init', array( $this, 'wpbakeryCheck' ) );
51
52 add_action( 'wp_enqueue_scripts', array( $this, 'frontendAssets' ) );
53 add_action('admin_enqueue_scripts',array($this,'backendAssets'));
54 }
55
56 // Load plugin css and javascript files which you may need on front end of your site
57 public function frontendAssets() {
58 wp_register_style( 'borderless_frontend_style', plugins_url('assets/styles/borderless.min.css', __FILE__), array(), BORDERLESS__VERSION );
59 wp_enqueue_style( 'borderless_frontend_style' );
60
61 // If you need any javascript files on front end, here is how you can load them.
62 wp_enqueue_script( 'borderless_frontend_script', plugins_url('assets/scripts/borderless.min.js', __FILE__), array('jquery'), BORDERLESS__VERSION, true );
63 }
64
65 function backendAssets($hook) {
66
67 // enqueue css files on backend
68 if($hook == "post.php" || $hook == "post-new.php" || $hook == 'visual-composer_page_vc-roles'){
69 if((isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] == 'on') || is_ssl()) {
70 $scheme = 'https';
71 }
72 else {
73 $scheme = 'http';
74 }
75 $this->paths = wp_upload_dir();
76 $this->paths['fonts'] = 'borderless_icon_fonts';
77 $this->paths['fonturl'] = set_url_scheme($this->paths['baseurl'].'/'.$this->paths['fonts'], $scheme);
78 $fonts = get_option('borderless_icon_fonts');
79 if(is_array($fonts))
80 {
81 foreach($fonts as $font => $info)
82 {
83 if(strpos($info['style'], 'http://' ) !== false) {
84 wp_enqueue_style('borderless-'.$font,$info['style']);
85 } else {
86 wp_enqueue_style('borderless-'.$font,trailingslashit($this->paths['fonturl']).$info['style']);
87 }
88 }
89 }
90 }
91 }
92
93
94 /**
95 * WPBakery.
96 */
97
98 // Check if WPBakery is installed
99 public function wpbakeryCheck() {
100 if ( defined( 'WPB_VC_VERSION' ) ) {
101 require_once( BORDERLESS__WPBAKERY . "/wpbakery.php");
102 } else {
103 add_action('admin_notices', array( $this, 'wpbakeryNotice' ));
104 return;
105 }
106 }
107
108 // Show notice if your plugin is activated but WPBakery is not
109 public function wpbakeryNotice() {
110 $plugin_data = get_plugin_data(__FILE__);
111 echo '
112 <div class="updated">
113 <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>
114 </div>';
115 }
116
117 }
118 // Finally initialize code
119 new Borderless();