-
Notifications
You must be signed in to change notification settings - Fork 0
/
radium-html5-media.php
executable file
·168 lines (131 loc) · 4.21 KB
/
radium-html5-media.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
<?php
/*
Plugin Name: Radium HTML5 Media
Plugin URI: http://radiumthemes.com/
Description: The plugin allows you to embed audio and video files anywhere on your site.
Author: Franklin M Gitonga
Author URI: http://radiumthemes.com/
Version: 1.0.0
License: GNU General Public License v2.0 or later
License URI: http://www.opensource.org/licenses/gpl-license.php
*/
/**
Copyright 2011 RadiumThemes. (email : info@radiumthemes.com)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License, version 2, as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*/
/**
* Init class for Radium_Forms.
*
* Loads all of the necessary components for the radium forms plugin.
*
* @since 1.0.1
*
* @package Radium_Forms
* @author Franklin Gitonga
*/
/** Load all of the necessary class files for the plugin */
spl_autoload_register( 'Radium_HTML5Media::autoload' );
class Radium_HTML5Media {
/**
* Holds a copy of the object for easy reference.
*
* @since 1.0.0
*
* @var object
*/
private static $instance;
/**
* Current version of the plugin.
*
* @since 1.0.0
*
* @var string
*/
public $version = '1.0.1';
/**
* Holds a copy of the main plugin filepath.
*
* @since 1.0.0
*
* @var string
*/
private static $file = __FILE__;
/**
* Constructor. Hooks all interactions into correct areas to start
* the class.
*
* @since 1.0.0
*/
public function __construct() {
self::$instance = $this;
/** Run a hook before the form is loaded and pass the object */
do_action_ref_array( 'radium_html5_media_init', array( $this ) );
/** Load the plugin */
add_action( 'init', array( $this, 'init' ) );
/** Load assets */
add_action( 'wp_enqueue_scripts', array( &$this, 'enqueue') );
}
/**
* loads all the actions and filters for the class.
*
* @since 1.0.0
*/
public function init() {
/** Load the plugin textdomain for internationalizing strings */
load_plugin_textdomain( 'radium_html5_media', false, plugin_basename( __FILE__ ) . '/languages/' );
/** Instantiate all the necessary components of the plugin */
define( 'RADIUM_HTML5_MEDIA_ASSETS_URL', apply_filters( 'radium_html5_media_assets_url', plugins_url( 'assets/', __FILE__ ) ) );
/** Fire up the shortcode */
$radium_html5_media_shortcode = new Radium_HTML5Media_Shortcode;
$args = array(
'remote_url' => 'http://api.radiumthemes.com/updates/radium-html5-media.json',
'time' => 12, //how often to check for updates in hours,
'plugin_slug' => 'radium-html5-media'
);
//check for updates
$radium_html5_media_update = new Radium_Updates_Checker( $args['remote_url'], __FILE__, $args['plugin_slug'], $args['time'] );
}
/**
* loads all the actions and filters for the class.
*
* @since 1.0.0
*/
public function enqueue() {
wp_enqueue_script('jquery');
wp_enqueue_script('radium_jplayer', RADIUM_HTML5_MEDIA_ASSETS_URL. 'js/jplayer.js', 'jquery', '1.0' , true);
wp_enqueue_style('radium_html5_media_styles', RADIUM_HTML5_MEDIA_ASSETS_URL. 'css/style.css', false, '1.0', 'all');
}
/**
* PSR-0 compliant autoloader to load classes as needed.
*
* @since 1.0.0
*
* @param string $classname The name of the class
* @return null Return early if the class name does not start with the correct prefix
*/
public static function autoload( $classname ) {
if ( 'Radium' !== mb_substr( $classname, 0, 6 ) )
return;
$filename = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . str_replace( '_', DIRECTORY_SEPARATOR, $classname ) . '.php';
if ( file_exists( $filename ) )
require $filename;
}
/**
* Getter method for retrieving the main plugin filepath.
*
* @since 1.0.0
*/
public static function get_file() {
return self::$file;
}
}
new Radium_HTML5Media;