*/ class Add_Social_Share_Buttons_Plugin_Admin { /** * The ID of this plugin. * * @since 1.0.0 * @access private * @var string $plugin_name The ID of this plugin. */ private $plugin_name; /** * The version of this plugin. * * @since 1.0.0 * @access private * @var string $version The current version of this plugin. */ private $version; /** * Initialize the class and set its properties. * * @since 1.0.0 * * @param string $plugin_name The name of this plugin. * @param string $version The version of this plugin. */ public function __construct($plugin_name, $version) { $this->plugin_name = $plugin_name; $this->version = $version; } /** * Register the stylesheets for the admin area. * * @since 1.0.0 */ public function enqueue_styles() { /** * This function is provided for demonstration purposes only. * * An instance of this class should be passed to the run() function * defined in Add_Social_Share_Buttons_Plugin_Loader as all of the hooks are defined * in that particular class. * * The Add_Social_Share_Buttons_Plugin_Loader will then create the relationship * between the defined hooks and the functions defined in this * class. */ if (isset($_GET['page']) && !empty($_GET['page']) && ($_GET['page'] == 'add_social_share_buttons')) { wp_enqueue_style('wp-pointer'); wp_enqueue_style('add-social-share-buttons-plugin-admin', plugin_dir_url(__FILE__) . 'css/add-social-share-buttons-plugin-admin.css', array('wp-jquery-ui-dialog'), $this->version, 'all'); wp_enqueue_style('chosen-css', plugin_dir_url(__FILE__) . 'css/chosen.css', array(), $this->version, 'all'); wp_enqueue_script('wp-pointer'); } } /** * Register the JavaScript for the admin area. * * @since 1.0.0 */ public function enqueue_scripts() { /** * This function is provided for demonstration purposes only. * * An instance of this class should be passed to the run() function * defined in Add_Social_Share_Buttons_Plugin_Loader as all of the hooks are defined * in that particular class. * * The Add_Social_Share_Buttons_Plugin_Loader will then create the relationship * between the defined hooks and the functions defined in this * class. */ if (isset($_GET['page']) && !empty($_GET['page']) && ($_GET['page'] == 'add_social_share_buttons')) { wp_enqueue_script('jquery-ui-sortable'); wp_enqueue_script('add-social-share-buttons-plugin-admin', plugin_dir_url(__FILE__) . 'js/add-social-share-buttons-plugin-admin.js', array('jquery', 'jquery-ui-dialog'), $this->version, false); wp_localize_script('add-social-share-buttons-plugin-admin', 'pagevisit', array('ajaxurl' => admin_url('admin-ajax.php'))); //get settings option $get_share_settings = get_option(ADSSB_PLUGIN_GLOBAL_SETTING_KEY); $get_share_settings = maybe_unserialize($get_share_settings); if (!empty($get_share_settings['share_posttype']) || $get_share_settings['share_posttype'] != "") { $options = !empty($get_share_settings['share_posttype']) ? $get_share_settings['share_posttype'] : json_encode(array()); if (!empty($options) || $options != "") { wp_localize_script('add-social-share-buttons-plugin-admin', 'get_post_option_share', array('optionsarray' => json_encode($options))); } else { wp_localize_script('add-social-share-buttons-plugin-admin', 'get_post_option_share', array('optionsarray' => '')); } } else { $post_types = get_post_types(); wp_localize_script('add-social-share-buttons-plugin-admin', 'get_post_option_share', array('optionsarray' => '')); //json_encode($post_types)) } wp_enqueue_script('jquery-validate-min', plugin_dir_url(__FILE__) . 'js/jquery.validate.min.js', $this->version, false); wp_enqueue_script('chosen-jquery-js', plugin_dir_url(__FILE__) . 'js/chosen.jquery.js', '4.5.2'); } } /** * add plugin main menu in admin menu * */ public function whatsapp_sharing_custom_menu() { //add admin main Crea plugins menu add_submenu_page('options-general.php', ADSSB_PLUGIN_PAGE_MENU_TITLE, __(ADSSB_PLUGIN_NAME, 'add-social-share-buttons-plugin'), 'manage_options', ADSSB_PLUGIN_PAGE_MENU_SLUG, 'custom_whatsapp_sharing_setting_html'); /** * function for plugin admin menu callback html function */ function custom_whatsapp_sharing_setting_html() { //get settings option $get_share_settings = get_option(ADSSB_PLUGIN_GLOBAL_SETTING_KEY); $get_share_settings = maybe_unserialize($get_share_settings); $get_services = get_option(ADSSB_PLUGIN_ADD_SOCIAL_BUTTIN_KEY); $get_services = maybe_unserialize($get_services); $sharesmallimagearray = array(); $sharesmallimagearray['Whatsapp'] = ASSB_PATH . '/images/whatsapp_small.png'; $sharesmallimagearray['Viber'] = ASSB_PATH . '/images/viber_small.png'; $sharesmallimagearray['Facebook'] = ASSB_PATH . '/images/facebook_small.png'; $sharesmallimagearray['Twitter'] = ASSB_PATH . '/images/twitter_small.png'; $sharesmallimagearray['Google_plus'] = ASSB_PATH . '/images/googleplus_small.png'; $sharesmallimagearray['Linkedin'] = ASSB_PATH . '/images/linkedin_small.png'; $sharemediumimagearray = array(); $sharemediumimagearray['Whatsapp'] = ASSB_PATH . '/images/whatsapp_medium.png'; $sharemediumimagearray['Viber'] = ASSB_PATH . '/images/viber_medium.png'; $sharemediumimagearray['Facebook'] = ASSB_PATH . '/images/facebook_medium.png'; $sharemediumimagearray['Twitter'] = ASSB_PATH . '/images/twitter_medium.png'; $sharemediumimagearray['Google_plus'] = ASSB_PATH . '/images/googleplus_medium.png'; $sharemediumimagearray['Linkedin'] = ASSB_PATH . '/images/linkedin_medium.png'; $sharelargeagearray = array(); $sharelargeagearray['Whatsapp'] = ASSB_PATH . '/images/whatsapp_large.png'; $sharelargeagearray['Viber'] = ASSB_PATH . '/images/viber_large.png'; $sharelargeagearray['Facebook'] = ASSB_PATH . '/images/facebook_large.png'; $sharelargeagearray['Twitter'] = ASSB_PATH . '/images/twitter_large.png'; $sharelargeagearray['Google_plus'] = ASSB_PATH . '/images/googleplus_large.png'; $sharelargeagearray['Linkedin'] = ASSB_PATH . '/images/linkedin_large.png'; ?>