| 1 |
<?php |
| 2 |
/** |
| 3 |
* Plugin Name: Floating Button |
| 4 |
* Plugin URI: https://wordpress.org/plugins/floating-button/ |
| 5 |
* Description: Easily create a floating button |
| 6 |
* Version: 2.0.2 |
| 7 |
* Author: Wow-Company |
| 8 |
* Author URI: https://wow-estore.com/ |
| 9 |
* License: GPL-2.0+ |
| 10 |
* License URI: http://www.gnu.org/licenses/gpl-2.0.txt |
| 11 |
* Text Domain: floating-button |
| 12 |
*/ |
| 13 |
|
| 14 |
namespace floatingbutton; |
| 15 |
|
| 16 |
if ( ! defined( 'ABSPATH' ) ) { |
| 17 |
exit; |
| 18 |
} |
| 19 |
|
| 20 |
|
| 21 |
if ( ! class_exists( 'Wow_Plugin_Class' ) ) { |
| 22 |
|
| 23 |
final class Wow_Plugin_Class { |
| 24 |
|
| 25 |
private static $instance; |
| 26 |
|
| 27 |
const PREF = 'fbtnp'; |
| 28 |
|
| 29 |
public static function instance() { |
| 30 |
|
| 31 |
if ( ! isset( self::$instance ) && ! ( self::$instance instanceof Wow_Plugin_Class ) ) { |
| 32 |
|
| 33 |
$info = array( |
| 34 |
'plugin_name' => 'Floating Button', |
| 35 |
'plugin_menu' => 'Floating Button', |
| 36 |
'plugin_home_url' => 'https://wordpress.org/plugins/floating-button/', |
| 37 |
'plugin_version' => '2.0.2', |
| 38 |
'plugin_file' => basename( __FILE__ ), |
| 39 |
'plugin_slug' => dirname( plugin_basename( __FILE__ ) ), |
| 40 |
'plugin_dir' => plugin_dir_path( __FILE__ ), |
| 41 |
'plugin_url' => plugin_dir_url( __FILE__ ), |
| 42 |
'plugin_pref' => self::PREF, |
| 43 |
'author_url' => 'https://wow-estore.com', |
| 44 |
'pro_url' => 'https://wow-estore.com/item/floating-button-pro/', |
| 45 |
'shortcode' => 'Floating-Button', |
| 46 |
'text_domain' => 'floating-button', |
| 47 |
'author' => 'Wow-Company', |
| 48 |
); |
| 49 |
|
| 50 |
self::$instance = new Wow_Plugin_Class; |
| 51 |
|
| 52 |
register_activation_hook( __FILE__, array( self::$instance, 'plugin_activate' ) ); |
| 53 |
register_deactivation_hook( __FILE__, array( self::$instance, 'plugin_deactivate' ) ); |
| 54 |
|
| 55 |
add_action( 'plugins_loaded', array( self::$instance, 'load_textdomain' ) ); |
| 56 |
add_action( 'admin_init', array( self::$instance, 'create_field' ) ); |
| 57 |
|
| 58 |
self::$instance->includes(); |
| 59 |
self::$instance->admin = new Wow_Admin_Class( $info ); |
| 60 |
self::$instance->public = new Wow_Public_Class( $info ); |
| 61 |
|
| 62 |
} |
| 63 |
|
| 64 |
return self::$instance; |
| 65 |
} |
| 66 |
|
| 67 |
public function __clone() { |
| 68 |
// Cloning instances of the class is forbidden. |
| 69 |
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'floating-button' ), '1.0' ); |
| 70 |
} |
| 71 |
|
| 72 |
public function __wakeup() { |
| 73 |
// Unserializing instances of the class is forbidden. |
| 74 |
_doing_it_wrong( __FUNCTION__, __( 'Cheatin’ huh?', 'floating-button' ), '1.0' ); |
| 75 |
} |
| 76 |
|
| 77 |
|
| 78 |
private function includes() { |
| 79 |
if ( ! class_exists( 'Wow_Company' ) ) { |
| 80 |
require_once plugin_dir_path( __FILE__ ) . 'includes/class-wow-company.php'; |
| 81 |
} |
| 82 |
require_once plugin_dir_path( __FILE__ ) . 'includes/class-js-packer.php'; |
| 83 |
require_once plugin_dir_path( __FILE__ ) . 'includes/class-db-update.php'; |
| 84 |
require_once plugin_dir_path( __FILE__ ) . 'admin/class-admin.php'; |
| 85 |
require_once plugin_dir_path( __FILE__ ) . 'public/class-public.php'; |
| 86 |
} |
| 87 |
|
| 88 |
public function plugin_activate() { |
| 89 |
$field = dirname( plugin_basename( __FILE__ ) ); |
| 90 |
require_once plugin_dir_path( __FILE__ ) . 'includes/activator.php'; |
| 91 |
} |
| 92 |
|
| 93 |
public function plugin_deactivate() { |
| 94 |
require_once plugin_dir_path( __FILE__ ) . 'includes/deactivator.php'; |
| 95 |
} |
| 96 |
|
| 97 |
public function create_field() { |
| 98 |
if ( get_option( 'wow_' . self::PREF .'_create_field' ) === false ) { |
| 99 |
$upload = wp_upload_dir(); |
| 100 |
$field = dirname( plugin_basename( __FILE__ ) ); |
| 101 |
$basedir = $upload['basedir'] . '/' . $field . '/'; |
| 102 |
if ( ! file_exists( $basedir ) ) { |
| 103 |
wp_mkdir_p( $basedir ); |
| 104 |
} |
| 105 |
update_option( 'wow_' . self::PREF .'_create_field', '2.0' ); |
| 106 |
} |
| 107 |
} |
| 108 |
|
| 109 |
public function load_textdomain() { |
| 110 |
load_plugin_textdomain( 'floating-button', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); |
| 111 |
} |
| 112 |
|
| 113 |
} |
| 114 |
} |
| 115 |
function wow_plugin_run() { |
| 116 |
return Wow_Plugin_Class::instance(); |
| 117 |
} |
| 118 |
|
| 119 |
// Get Running. |
| 120 |
wow_plugin_run(); |