-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplugin-run.php
51 lines (41 loc) · 1.55 KB
/
plugin-run.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
<?php
/**
* This wrapper allows to have no namespaces in plugin's main file, making it parseable in <5.3.
* Plugin will not execute but it will be nice enough to provide user a message to upgrade.
*/
class LSB_Plugin_Run {
static function install() {
$installer = new livestreambadger\LSB_Installer();
$installer->install();
}
static function uninstall() {
$installer = new livestreambadger\LSB_Installer();
$installer->uninstall();
}
/**
* Anything that needs to be run/setup as a part of the plugin
*/
static function run() {
// Register styles
if ( livestreambadger\Settings::read_settings( 'disable_css' ) == false ) {
add_action( 'wp_enqueue_scripts', 'lsb_register_styles' );
}
function lsb_register_styles() {
wp_register_style( 'lsb-style', plugins_url( 'style.css', __FILE__ ) );
wp_enqueue_style( 'lsb-style' );
}
// Register widget
add_action( 'widgets_init', function() {
register_widget( 'livestreambadger\Stream_Status_Widget' );
});
add_filter( 'lsb_stream_status_widget_text', 'do_shortcode' );
// Register shortcode
$embedded_stream_sc = new livestreambadger\LSB_Embedded_Stream();
add_shortcode( 'livestream', array( $embedded_stream_sc, 'do_shortcode' ) );
new livestreambadger\LSB_Admin_Settings(
new livestreambadger\LSB_Stream_Storage(
new livestreambadger\LSB_API_Sync()
)
);
}
}