forked from otacke/h5p-sharing
-
Notifications
You must be signed in to change notification settings - Fork 0
/
h5p-sharing.php
96 lines (78 loc) · 2.15 KB
/
h5p-sharing.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<?php
/**
* Plugin Name: H5P-Sharing
* Text Domain: H5PSHARING
* Domain Path: /languages
* Description: Add some sharing functionality to the H5P plugin
* Version: 0.2.3
* Author: Oliver Tacke
* Author URI: https://snordian.de
* License: MIT
* License URI: http://opensource.org/licenses/MIT
*/
namespace H5PSHARING;
// as suggested by the WordPress community
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
if ( ! defined( 'H5PSHARING_VERSION' ) ) {
define( 'H5PSHARING_VERSION', '0.2.2' );
}
// Includes
require_once( __DIR__ . '/class-admin.php' );
/**
* Activate the plugin.
*/
function on_activation() {
}
/**
* Deactivate the plugin.
*/
function on_deactivation() {
}
/**
* Uninstall the plugin.
*/
function on_uninstall() {
}
/**
* Update the plugin.
*/
function update() {
if ( H5PSHARING_VERSION === get_option( 'H5PSHARING_version' ) ) {
return;
}
/*
* Do updates based on return value of get_option( 'H5PSHARING_version' ) and
* use update_option( 'H5PSHARING_version', '<VERSION>' ) to set new version.
*/
update_option( 'H5PSHARING_version', H5PSHARING_VERSION );
}
/**
* Load the text domain for internationalization.
*/
function h5psharing_load_plugin_textdomain() {
load_plugin_textdomain( 'H5PSHARING', false, basename( dirname( __FILE__ ) ) . '/languages/' );
}
/**
* Register custom style for admin area.
*/
function h5psharing_add_admin_styles() {
wp_register_style( 'H5PSHARING', plugins_url( '/styles/h5p-sharing-admin.css', __FILE__ ), array(), H5PSHARING_VERSION );
wp_enqueue_style( 'H5PSHARING' );
}
// Start setup
register_activation_hook( __FILE__, 'H5PSHARING\on_activation' );
register_deactivation_hook( __FILE__, 'H5PSHARING\on_deactivation' );
register_uninstall_hook( __FILE__, 'H5PSHARING\on_uninstall' );
add_action( 'plugins_loaded', 'H5PSHARING\h5psharing_load_plugin_textdomain' );
add_action( 'plugins_loaded', 'H5PSHARING\update' );
// Custom style for admin area
add_action( 'admin_enqueue_scripts', 'H5PSHARING\h5psharing_add_admin_styles' );
/**
* Launch.
*/
function start_admin() {
new Admin;
}
if ( is_admin() ) {
add_action( 'admin_enqueue_scripts', 'H5PSHARING\start_admin' );
}