| 1 |
<?php |
| 2 |
|
| 3 |
/** |
| 4 |
* The admin-specific functionality of the plugin. |
| 5 |
* |
| 6 |
* @link http://socketlabs.com |
| 7 |
* @since 1.0.0 |
| 8 |
* |
| 9 |
* @package Socketlabs |
| 10 |
* @subpackage Socketlabs/admin |
| 11 |
*/ |
| 12 |
|
| 13 |
/** |
| 14 |
* The admin-specific functionality of the plugin. |
| 15 |
* |
| 16 |
* Defines the plugin name, version, and two examples hooks for how to |
| 17 |
* enqueue the admin-specific stylesheet and JavaScript. |
| 18 |
* |
| 19 |
* @package Socketlabs |
| 20 |
* @subpackage Socketlabs/admin |
| 21 |
* @author Socketlabs Dev Team <support@socketlabs.com> |
| 22 |
*/ |
| 23 |
class Socketlabs_Admin { |
| 24 |
|
| 25 |
/** |
| 26 |
* The ID of this plugin. |
| 27 |
* |
| 28 |
* @since 1.0.0 |
| 29 |
* @access private |
| 30 |
* @var string $plugin_name The ID of this plugin. |
| 31 |
*/ |
| 32 |
private $plugin_name; |
| 33 |
|
| 34 |
/** |
| 35 |
* The version of this plugin. |
| 36 |
* |
| 37 |
* @since 1.0.0 |
| 38 |
* @access private |
| 39 |
* @var string $version The current version of this plugin. |
| 40 |
*/ |
| 41 |
private $version; |
| 42 |
|
| 43 |
/** |
| 44 |
* Initialize the class and set its properties. |
| 45 |
* |
| 46 |
* @since 1.0.0 |
| 47 |
* @param string $plugin_name The name of this plugin. |
| 48 |
* @param string $version The version of this plugin. |
| 49 |
*/ |
| 50 |
public function __construct( $plugin_name, $version ) { |
| 51 |
|
| 52 |
$this->plugin_name = $plugin_name; |
| 53 |
$this->version = $version; |
| 54 |
} |
| 55 |
|
| 56 |
/** |
| 57 |
* Register the stylesheets for the admin area. |
| 58 |
* |
| 59 |
* @since 1.0.0 |
| 60 |
*/ |
| 61 |
public function enqueue_styles() { |
| 62 |
|
| 63 |
/** |
| 64 |
* An instance of this class should be passed to the run() function |
| 65 |
* defined in Sl_Signup_Loader as all of the hooks are defined |
| 66 |
* in that particular class. |
| 67 |
* |
| 68 |
* The Sl_Signup_Loader will then create the relationship |
| 69 |
* between the defined hooks and the functions defined in this |
| 70 |
* class. |
| 71 |
*/ |
| 72 |
|
| 73 |
wp_enqueue_style( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'css/socketlabs-admin.css', array(), $this->version, 'all' ); |
| 74 |
} |
| 75 |
|
| 76 |
/** |
| 77 |
* Register the JavaScript for the admin area. |
| 78 |
* |
| 79 |
* @since 1.0.0 |
| 80 |
*/ |
| 81 |
public function enqueue_scripts() { |
| 82 |
|
| 83 |
/** |
| 84 |
* An instance of this class should be passed to the run() function |
| 85 |
* defined in Sl_Signup_Loader as all of the hooks are defined |
| 86 |
* in that particular class. |
| 87 |
* |
| 88 |
* The Sl_Signup_Loader will then create the relationship |
| 89 |
* between the defined hooks and the functions defined in this |
| 90 |
* class. |
| 91 |
*/ |
| 92 |
|
| 93 |
wp_enqueue_script( $this->plugin_name, plugin_dir_url( __FILE__ ) . 'js/socketlabs-admin.js', array( 'jquery' ), $this->version, false ); |
| 94 |
} |
| 95 |
|
| 96 |
/** |
| 97 |
* Register a custom menu page. |
| 98 |
*/ |
| 99 |
public function admin_menu() { |
| 100 |
add_menu_page( |
| 101 |
__( 'SocketLabs', 'textdomain' ), //page_title |
| 102 |
'SocketLabs', //menu_title |
| 103 |
'administrator', //capability |
| 104 |
'socketlabs/admin/partials/socketlabs-admin-display.php', //menu_slug |
| 105 |
'', //callback |
| 106 |
plugins_url( 'socketlabs/admin/images/logo-wp-icon.png' ), //icon_url |
| 107 |
'' //position |
| 108 |
); |
| 109 |
} |
| 110 |
//add_action( 'admin_menu', 'register_socketlabs_menu' ); |
| 111 |
|
| 112 |
/** |
| 113 |
* Create the admin UI. |
| 114 |
* |
| 115 |
* @since 1.0.0 |
| 116 |
*/ |
| 117 |
public function create_admin_page() |
| 118 |
{ |
| 119 |
require_once plugin_dir_path( __FILE__ ) . 'partials/socketlabs-admin-display.php'; |
| 120 |
} |
| 121 |
|
| 122 |
} |
| 123 |
?> |
| 124 |
|