| 1 |
<?php |
| 2 |
/* |
| 3 |
Plugin Name: Social Share Button |
| 4 |
Plugin URI: http://pickplugins.com |
| 5 |
Description: Awesome Share Button. |
| 6 |
Version: 2.1.14 |
| 7 |
Author: PickPlugins |
| 8 |
Author URI: http://pickplugins.com |
| 9 |
Text Domain: social-share-button |
| 10 |
License: GPLv2 or later |
| 11 |
License URI: http://www.gnu.org/licenses/gpl-2.0.html |
| 12 |
*/ |
| 13 |
|
| 14 |
if ( ! defined('ABSPATH')) exit; // if direct access |
| 15 |
|
| 16 |
|
| 17 |
class SocialShareButton{ |
| 18 |
|
| 19 |
public function __construct(){ |
| 20 |
|
| 21 |
define('social_share_button_plugin_url', plugins_url('/', __FILE__) ); |
| 22 |
define('social_share_button_plugin_dir', plugin_dir_path( __FILE__ ) ); |
| 23 |
define('social_share_button_plugin_name', "Social Share Button" ); |
| 24 |
define('social_share_button_plugin_version', '2.1.14' ); |
| 25 |
|
| 26 |
|
| 27 |
$socialShareButtonCss = ''; |
| 28 |
global $socialShareButtonCss; |
| 29 |
|
| 30 |
|
| 31 |
// Class |
| 32 |
//require_once( plugin_dir_path( __FILE__ ) . 'includes/class-post-types.php'); |
| 33 |
// require_once( plugin_dir_path( __FILE__ ) . 'includes/class-post-meta.php'); |
| 34 |
require_once( plugin_dir_path( __FILE__ ) . 'includes/class-shortcodes.php'); |
| 35 |
require_once( plugin_dir_path( __FILE__ ) . 'includes/class-functions.php'); |
| 36 |
require_once( plugin_dir_path( __FILE__ ) . 'includes/class-settings.php'); |
| 37 |
|
| 38 |
require_once( plugin_dir_path( __FILE__ ) . 'includes/class-migrate.php'); |
| 39 |
require_once( plugin_dir_path( __FILE__ ) . 'includes/class-settings-tabs.php'); |
| 40 |
|
| 41 |
|
| 42 |
// Function's |
| 43 |
require_once( plugin_dir_path( __FILE__ ) . 'includes/functions.php'); |
| 44 |
require_once( plugin_dir_path( __FILE__ ) . 'includes/functions-settings.php'); |
| 45 |
|
| 46 |
|
| 47 |
//add_action( 'admin_enqueue_scripts', 'wp_enqueue_media' ); |
| 48 |
add_action( 'wp_enqueue_scripts', array( $this, 'front_scripts' ) ); |
| 49 |
add_action( 'admin_enqueue_scripts', array( $this, 'admin_scripts' ) ); |
| 50 |
|
| 51 |
|
| 52 |
add_action( 'plugins_loaded', array( $this, 'textdomain' )); |
| 53 |
|
| 54 |
register_activation_hook( __FILE__, array( $this, 'activation' ) ); |
| 55 |
register_deactivation_hook( __FILE__, array( $this, 'deactivation' ) ); |
| 56 |
//register_uninstall_hook( __FILE__, array( $this, 'uninstall' ) ); |
| 57 |
|
| 58 |
} |
| 59 |
|
| 60 |
public function textdomain() { |
| 61 |
|
| 62 |
$locale = apply_filters( 'plugin_locale', get_locale(), 'social-share-button' ); |
| 63 |
load_textdomain('social-share-button', WP_LANG_DIR .'/social-share-button/social-share-button-'. $locale .'.mo' ); |
| 64 |
|
| 65 |
load_plugin_textdomain( 'social-share-button', false, plugin_basename( dirname( __FILE__ ) ) . '/languages/' ); |
| 66 |
} |
| 67 |
|
| 68 |
|
| 69 |
|
| 70 |
|
| 71 |
public function activation(){ |
| 72 |
|
| 73 |
do_action( 'social_share_button_activation' ); |
| 74 |
} |
| 75 |
|
| 76 |
public function uninstall(){ |
| 77 |
|
| 78 |
do_action( 'social_share_button_uninstall' ); |
| 79 |
} |
| 80 |
|
| 81 |
public function deactivation(){ |
| 82 |
|
| 83 |
do_action( 'social_share_button_deactivation' ); |
| 84 |
} |
| 85 |
|
| 86 |
public function front_scripts(){ |
| 87 |
|
| 88 |
wp_enqueue_script('jquery'); |
| 89 |
//wp_enqueue_script('jquery-ui-datepicker'); |
| 90 |
|
| 91 |
wp_enqueue_script('social_share_button_front_js', plugins_url( 'assets/front/js/scripts.js' , __FILE__ ) , array( 'jquery' ),'1.0.0'); |
| 92 |
wp_localize_script('social_share_button_front_js', 'social_share_button_ajax', array( 'social_share_button_ajaxurl' => admin_url( 'admin-ajax.php'))); |
| 93 |
|
| 94 |
|
| 95 |
wp_enqueue_style('social_share_button_style', social_share_button_plugin_url.'assets/front/css/style.css',[],'1.0.0'); |
| 96 |
wp_enqueue_style('fontawesome-5', social_share_button_plugin_url.'assets/global/css/fontawesome-5.min.css',[],'5.0.0'); |
| 97 |
|
| 98 |
} |
| 99 |
|
| 100 |
public function admin_scripts(){ |
| 101 |
|
| 102 |
$screen = get_current_screen(); |
| 103 |
|
| 104 |
|
| 105 |
//var_dump($screen); |
| 106 |
|
| 107 |
|
| 108 |
wp_register_style('font-awesome-4', social_share_button_plugin_url.'assets/global/css/font-awesome.css',[],'4.0.0'); |
| 109 |
wp_register_style('font-awesome-5', social_share_button_plugin_url.'assets/global/css/fontawesome-5.min.css',[],'5.0.0'); |
| 110 |
|
| 111 |
wp_register_script('select2', social_share_button_plugin_url.'assets/admin/js/select2.full.js', array('jquery'),'4.0.0'); |
| 112 |
wp_register_style( 'select2', social_share_button_plugin_url . 'assets/admin/css/select2.min.css',[],'4.0.0'); |
| 113 |
wp_register_script('jquery.lazy', social_share_button_plugin_url.'assets/admin/js/jquery.lazy.min.js', array('jquery'),'1.0.0'); |
| 114 |
|
| 115 |
|
| 116 |
wp_register_style('settings-tabs', social_share_button_plugin_url.'assets/settings-tabs/settings-tabs.css',[],'1.0.0'); |
| 117 |
wp_register_script('settings-tabs', social_share_button_plugin_url. 'assets/settings-tabs/settings-tabs.js', array( 'jquery' ),'1.0.0'); |
| 118 |
|
| 119 |
if ($screen->id == 'toplevel_page_social-share-button'){ |
| 120 |
|
| 121 |
|
| 122 |
wp_enqueue_style('select2'); |
| 123 |
wp_enqueue_script('select2'); |
| 124 |
|
| 125 |
$settings_tabs_field = new settings_tabs_field(); |
| 126 |
$settings_tabs_field->admin_scripts(); |
| 127 |
|
| 128 |
} |
| 129 |
|
| 130 |
|
| 131 |
|
| 132 |
} |
| 133 |
|
| 134 |
|
| 135 |
|
| 136 |
|
| 137 |
|
| 138 |
} |
| 139 |
|
| 140 |
new SocialShareButton(); |