| 1 |
<?php |
| 2 |
/* |
| 3 |
* Plugin Name: Advanced scrollbar |
| 4 |
* Author URI: http://bplugins.com |
| 5 |
* Description: Customize scrollbar of your website with unlimited styling and color using the plugin. |
| 6 |
* Version: 1.1.5 |
| 7 |
* Author: bPlugins |
| 8 |
* License: GPLv3 |
| 9 |
* License URI: https://www.gnu.org/licenses/gpl-3.0.txt |
| 10 |
* Text Domain: advanced-scrollbar |
| 11 |
*/ |
| 12 |
|
| 13 |
/*-------------------------------------------------------------------------------*/ |
| 14 |
/* Rendering all javaScript |
| 15 |
/*-------------------------------------------------------------------------------*/ |
| 16 |
|
| 17 |
if ( function_exists( 'asb_fs' ) ) { |
| 18 |
asb_fs()->set_basename( true, __FILE__ ); |
| 19 |
// asb_fs()->add_settings_page(); |
| 20 |
} else { |
| 21 |
/* Latest jQuery of wordpress */ |
| 22 |
define('CSB_VERSION', isset( $_SERVER['HTTP_HOST'] ) && 'localhost' === $_SERVER['HTTP_HOST'] ? time() : '1.1.5' ); |
| 23 |
define('CSB_DIR_URL', plugin_dir_url(__FILE__)); |
| 24 |
define('CSB_DIR_PATH', plugin_dir_path(__FILE__)); |
| 25 |
define('CSB_HAS_FREE', 'advanced-scrollbar/plugin.php' === plugin_basename(__FILE__)); |
| 26 |
define('CSB_HAS_PRO', 'advanced-scrollbar-pro/plugin.php' === plugin_basename(__FILE__)); |
| 27 |
if ( ! function_exists( 'asb_fs' ) ) { |
| 28 |
// Create a helper function for easy SDK access. |
| 29 |
function asb_fs() { |
| 30 |
global $asb_fs; |
| 31 |
|
| 32 |
if ( ! isset( $asb_fs ) ) { |
| 33 |
// Include Freemius SDK. |
| 34 |
require_once dirname(__FILE__) . '/freemius/start.php'; |
| 35 |
|
| 36 |
$asb_fs = fs_dynamic_init( array( |
| 37 |
'id' => '14870', |
| 38 |
'slug' => 'advanced-scrollbar', |
| 39 |
'premium_slug' => 'advanced-scrollbar-pro', |
| 40 |
'type' => 'plugin', |
| 41 |
'public_key' => 'pk_419d245dc8547a274d192990c096a', |
| 42 |
'is_premium' => true, |
| 43 |
'premium_suffix' => 'Pro', |
| 44 |
'has_premium_version' => true, |
| 45 |
'has_addons' => false, |
| 46 |
'has_paid_plans' => true, |
| 47 |
'trial' => array( |
| 48 |
'days' => 7, |
| 49 |
'is_require_payment' => false |
| 50 |
), |
| 51 |
'menu' => array( |
| 52 |
'slug' => 'advanced-scrollbar', |
| 53 |
'contact' => false, |
| 54 |
'support' => false, |
| 55 |
'parent' => array( |
| 56 |
'slug' => 'options-general.php' |
| 57 |
) |
| 58 |
) |
| 59 |
) ); |
| 60 |
} |
| 61 |
|
| 62 |
return $asb_fs; |
| 63 |
} |
| 64 |
|
| 65 |
// Init Freemius. |
| 66 |
asb_fs(); |
| 67 |
// Signal that SDK was initiated. |
| 68 |
do_action( 'asb_fs_loaded' ); |
| 69 |
} |
| 70 |
|
| 71 |
|
| 72 |
function asbIsPremium(){ |
| 73 |
return asb_fs()->is__premium_only() && asb_fs()->can_use_premium_code(); |
| 74 |
} |
| 75 |
|
| 76 |
|
| 77 |
if (!class_exists("CSB_Scrollbar")) { |
| 78 |
class CSB_Scrollbar { |
| 79 |
|
| 80 |
function __construct() { |
| 81 |
add_action("wp_enqueue_scripts", [$this,"enqueueScrollbarScript"]); |
| 82 |
add_action('wp_footer',[$this,"csbFooter"]); |
| 83 |
add_action('wp_head', [$this,"isPremium"]); |
| 84 |
add_action('admin_head', [$this,"isPremium"]); |
| 85 |
// add_action('edit_attachment_head"', [$this,"isPremium"]); |
| 86 |
} |
| 87 |
|
| 88 |
function csbFooter(){ |
| 89 |
$csb_data = get_option('asb-advanced-scrollbar-thirds'); |
| 90 |
$csb_data = json_encode($csb_data); |
| 91 |
echo '<div id="csbScrollbar" data-scrollbar="'. esc_attr( $csb_data ) .'"></div>'; |
| 92 |
} |
| 93 |
|
| 94 |
function enqueueScrollbarScript(){ |
| 95 |
wp_enqueue_script('csb-nicescroll-js', CSB_DIR_URL . 'assets/js/jquery.nicescroll.min.js', array('jquery'), CSB_VERSION, false); |
| 96 |
wp_enqueue_style( 'csb-scrollbar-style', CSB_DIR_URL . 'build/scrollbar.css', array(), CSB_VERSION ); |
| 97 |
wp_enqueue_script( 'csb-scrollbar-script', CSB_DIR_URL . 'build/scrollbar.js', array('react','react-dom','jquery'), CSB_VERSION, true ); |
| 98 |
} |
| 99 |
|
| 100 |
function isPremium () { |
| 101 |
?> |
| 102 |
<script type="text/javascript"> |
| 103 |
const csbIsPremium = <?php echo json_encode(asbIsPremium()); ?>; |
| 104 |
</script> |
| 105 |
<?php |
| 106 |
} |
| 107 |
} |
| 108 |
new CSB_Scrollbar(); |
| 109 |
} |
| 110 |
|
| 111 |
/*-------------------------------------------------------------------------------*/ |
| 112 |
/* Include all require file |
| 113 |
/*-------------------------------------------------------------------------------*/ |
| 114 |
require_once "inc/Settings.php"; |
| 115 |
require_once "inc/import.php"; |
| 116 |
require_once "inc/cursor.php"; |
| 117 |
require_once "inc/admin.php"; |
| 118 |
} |