-
Notifications
You must be signed in to change notification settings - Fork 1
/
sublimevideo-official.php
114 lines (90 loc) · 3.67 KB
/
sublimevideo-official.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
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
<?php
/**
* @package SublimeVideo - HTML5 Video Player
*/
/*
Plugin Name: SublimeVideo - HTML5 Video Player
Plugin URI: http://docs.sublimevideo.net/wordpress
Author: SublimeVideo
Author URI: http://sublimevideo.net
Version: 1.8.2
Description: SublimeVideo is the most reliable HTML5 Video Player on the Web. It allows your videos to play flawlessly on any device or browser and in any page.
License: GPLv2 or later
*/
define('SUBLIMEVIDEO_PLUGIN_VERSION', '1.8.2');
define('SUBLIMEVIDEO_PLUGIN_URL', plugin_dir_url( __FILE__ ));
// A class with translations
require_once dirname( __FILE__ ) . '/class-sublimevideo-locales.php';
class SublimeVideo {
// format => [title, array_of_qualities]
static $formats = array(
'mp4' => array( 'MP4', array( 'Normal', 'HD', 'Mobile' ) ),
'webm_ogg' => array( 'WebM or Ogg', array( 'Normal', 'HD' ) )
);
const FORMAT_TITLE = 0;
const FORMAT_QUALITIES = 1;
// Settings
static $user_editable_settings = array('sv_site_token', 'sv_site_domain', 'sv_player_width', 'sv_player_stage');
static $non_editable_settings = array('sv_oauth_token');
// Allowed data- attributes.
static $allowed_data_attributes = array(
'uid' => 'data-uid',
'title' => 'title',
'name' => 'title',
'settings' => 'data-settings'
);
// Allowed "behaviors" (fired through the JS API).
// These behaviors can be added in the shortcode without value, e.g.: [sublimevideo src1='' loop]
static $allowed_behaviors = array('loop', 'autoplay');
// Default player stage
static $default_player_stage = 'stable';
// Add webm to the uploadable extensions
static function allow_webm_uploading( $existing_mimes=array() ) {
$existing_mimes['webm'] = 'video/webm';
return $existing_mimes;
}
public function install() {
update_option('sv_player_width', SublimeVideoUtils::video_default_width());
update_option('sv_player_stage', SublimeVideo::$default_player_stage);
}
public function uninstall() {
foreach (SublimeVideo::$user_editable_settings as $setting) {
delete_option($setting);
}
foreach (SublimeVideo::$non_editable_settings as $setting) {
delete_option($setting);
}
}
public static $instance = null;
public function __construct() {
register_activation_hook( __FILE__, array( $this, 'install' ) );
register_deactivation_hook( __FILE__, array( $this, 'uninstall' ) );
$this->locales = new SublimeVideoLocales( 'en' );
self::$instance = $this;
}
private static function instance() {
if ( self::$instance ) return self::$instance;
else return new SublimeVideo();
}
public static function t( $key, $lang='en' ) {
return self::instance()->locales->t( $key, $lang );
}
}
$sublimevideo = new SublimeVideo();
// Add webm to the authorized MIME Type for upload ( http://chrismeller.com/2007/07/modifying-allowed-upload-types-in-wordpress )
add_filter('upload_mimes', array( 'SublimeVideo', 'allow_webm_uploading' ) );
// A class with some methods to do mostly various WordPress-related stuff
require_once dirname( __FILE__ ) . '/class-sublimevideo-utils.php';
// A class with some methods that hooks into WordPress core
require_once dirname( __FILE__ ) . '/class-sublimevideo-actions.php';
// Shortcode definition / generation
require_once dirname( __FILE__ ) . '/class-sublimevideo-shortcodes.php';
// A class that renders all the UIs
require_once dirname( __FILE__ ) . '/class-sublimevideo-ui.php';
if ( is_admin() ) {
// Wrapper to access the SublimeVideo service API
require_once dirname( __FILE__ ) . '/class-sublimevideo-api.php';
// Admin settings panel related stuff
require_once dirname( __FILE__ ) . '/class-sublimevideo-admin.php';
}
?>