| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Alerts for Beaver Builder |
| 4 |
* Plugin URI: https://pratikchaskar.com/ |
| 5 |
* Description: This is the plugin to create predefined alert messages. |
| 6 |
* Version: 1.2.7 |
| 7 |
* Author: Pratik Chaskar |
| 8 |
* Author URI: https://pratikchaskar.com/ |
| 9 |
* Text Domain: bb-bootstrap-alerts |
| 10 |
*/ |
| 11 |
define( 'BB_BALERTS_DIR', plugin_dir_path( __FILE__ ) ); |
| 12 |
define( 'BB_BALERTS_URL', plugins_url( '/', __FILE__ ) ); |
| 13 |
|
| 14 |
// check of BSFBBAlerts class already exist or not |
| 15 |
if ( !class_exists( 'BSFBBAlerts' ) ) { |
| 16 |
|
| 17 |
class BSFBBAlerts |
| 18 |
{ |
| 19 |
|
| 20 |
function __construct() { |
| 21 |
|
| 22 |
add_action( 'init', array( $this, 'load_bb_alerts' ) ); |
| 23 |
add_action('init', array( $this, 'load_textdomain')); |
| 24 |
} |
| 25 |
|
| 26 |
// function to load BB Alerts |
| 27 |
function load_bb_alerts() { |
| 28 |
if ( class_exists( 'FLBuilder' ) ) { |
| 29 |
|
| 30 |
// If class exist it loads the module |
| 31 |
require_once 'bb-bootstrap-alerts-module/bb-bootstrap-alerts-module.php'; |
| 32 |
} |
| 33 |
else |
| 34 |
{ |
| 35 |
// Display admin notice for activating beaver builder |
| 36 |
add_action('admin_notices',array($this,'admin_notices_function')); |
| 37 |
add_action('network_admin_notices',array($this,'admin_notices_function')); |
| 38 |
} |
| 39 |
} |
| 40 |
|
| 41 |
// function to load text domain |
| 42 |
public function load_textdomain() { |
| 43 |
load_plugin_textdomain( 'bb-bootstrap-alerts' ); |
| 44 |
} |
| 45 |
|
| 46 |
// function to display admin notice |
| 47 |
function admin_notices_function() { |
| 48 |
|
| 49 |
// check for Beaver Builder Installed / Activated or not |
| 50 |
if ( file_exists( plugin_dir_path( 'bb-plugin-agency/fl-builder.php' ) ) |
| 51 |
|| file_exists( plugin_dir_path( 'beaver-builder-lite-version/fl-builder.php' ) ) ) { |
| 52 |
|
| 53 |
$url = network_admin_url() . 'plugins.php?s=Beaver+Builder+Plugin'; |
| 54 |
} else { |
| 55 |
$url = network_admin_url() . 'plugin-install.php?s=billyyoung&tab=search&type=author'; |
| 56 |
} |
| 57 |
|
| 58 |
echo '<div class="notice notice-error">'; |
| 59 |
echo "<p>". sprintf( __( 'The <strong>Bootstrap Alerts For Beaver Builder</strong> plugin requires <strong><a href="%s">Beaver Builder</strong></a> plugin installed & activated.' , 'bb-bootstrap-alerts' ), $url ) ."</p>"; |
| 60 |
echo '</div>'; |
| 61 |
} |
| 62 |
} |
| 63 |
|
| 64 |
new BSFBBAlerts(); |
| 65 |
} |