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