Skip to content

Commit 924ff39

Browse files
committed
deploy: 5cfbcc6
1 parent 37594fb commit 924ff39

File tree

6 files changed

+311
-21
lines changed

6 files changed

+311
-21
lines changed

able_player_css.html

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ <h2></h2>
3636

3737

3838

39-
<h4 class="name" id="able_player_css">apply_filters( 'able_player_css', <span class="signature">$url, $is_production )</span><span class="type-signature"></span></h4>
39+
<h4 class="name" id="able_player_css">apply_filters( 'able_player_css', <span class="signature">$url, $is_production )</span><span class="type-signature"> &rarr; {string}</span></h4>
4040

4141

4242

@@ -157,7 +157,7 @@ <h5>Parameters:</h5>
157157

158158
<dt class="tag-source">Source:</dt>
159159
<dd class="tag-source"><ul class="dummy"><li>
160-
<a href="ableplayer.php.html">ableplayer.php</a>, <a href="ableplayer.php.html#line68">line 68</a>
160+
<a href="ableplayer.php.html">ableplayer.php</a>, <a href="ableplayer.php.html#line74">line 74</a>
161161
</li></ul></dd>
162162

163163

@@ -183,11 +183,19 @@ <h5>Parameters:</h5>
183183
<h5>Returns:</h5>
184184

185185

186-
<div class="param-desc">
187-
<p>string</p>
188-
</div>
189186

190187

188+
<dl>
189+
<dt>
190+
Type
191+
</dt>
192+
<dd>
193+
194+
<span class="param-type">string</span>
195+
196+
197+
</dd>
198+
</dl>
191199

192200

193201

@@ -213,7 +221,7 @@ <h5>Returns:</h5>
213221
</div>
214222

215223
<nav>
216-
<h2><a href="index.html">Home</a></h2><h3>Filters</h3><ul><li><a href="able_player_css.html">able_player_css</a></li><li><a href="able_player_js.html">able_player_js</a></li><li><a href="ableplayer_parameters.html">ableplayer_parameters</a></li></ul>
224+
<h2><a href="index.html">Home</a></h2><h3>Filters</h3><ul><li><a href="able_player_css.html">able_player_css</a></li><li><a href="able_player_js.html">able_player_js</a></li><li><a href="ableplayer_dependencies.html">ableplayer_dependencies</a></li><li><a href="ableplayer_parameters.html">ableplayer_parameters</a></li></ul>
217225
</nav>
218226

219227
<br class="clear">

able_player_js.html

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ <h2></h2>
3636

3737

3838

39-
<h4 class="name" id="able_player_js">apply_filters( 'able_player_js', <span class="signature">$url, $is_production )</span><span class="type-signature"></span></h4>
39+
<h4 class="name" id="able_player_js">apply_filters( 'able_player_js', <span class="signature">$url, $is_production )</span><span class="type-signature"> &rarr; {string}</span></h4>
4040

4141

4242

@@ -157,7 +157,7 @@ <h5>Parameters:</h5>
157157

158158
<dt class="tag-source">Source:</dt>
159159
<dd class="tag-source"><ul class="dummy"><li>
160-
<a href="ableplayer.php.html">ableplayer.php</a>, <a href="ableplayer.php.html#line57">line 57</a>
160+
<a href="ableplayer.php.html">ableplayer.php</a>, <a href="ableplayer.php.html#line63">line 63</a>
161161
</li></ul></dd>
162162

163163

@@ -183,11 +183,19 @@ <h5>Parameters:</h5>
183183
<h5>Returns:</h5>
184184

185185

186-
<div class="param-desc">
187-
<p>string</p>
188-
</div>
189186

190187

188+
<dl>
189+
<dt>
190+
Type
191+
</dt>
192+
<dd>
193+
194+
<span class="param-type">string</span>
195+
196+
197+
</dd>
198+
</dl>
191199

192200

193201

@@ -213,7 +221,7 @@ <h5>Returns:</h5>
213221
</div>
214222

215223
<nav>
216-
<h2><a href="index.html">Home</a></h2><h3>Filters</h3><ul><li><a href="able_player_css.html">able_player_css</a></li><li><a href="able_player_js.html">able_player_js</a></li><li><a href="ableplayer_parameters.html">ableplayer_parameters</a></li></ul>
224+
<h2><a href="index.html">Home</a></h2><h3>Filters</h3><ul><li><a href="able_player_css.html">able_player_css</a></li><li><a href="able_player_js.html">able_player_js</a></li><li><a href="ableplayer_dependencies.html">ableplayer_dependencies</a></li><li><a href="ableplayer_parameters.html">ableplayer_parameters</a></li></ul>
217225
</nav>
218226

219227
<br class="clear">

ableplayer.php.html

Lines changed: 48 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,13 @@
7474
wp_enqueue_script( 'js-cookie', plugins_url( 'thirdparty', __FILE__ ) . '/js.cookie.js', array( 'jquery' ), ABLEPLAYER_VERSION, true );
7575
wp_enqueue_script( 'vimeo', 'https://player.vimeo.com/api/player.js', array(), ABLEPLAYER_VERSION, true );
7676
wp_register_script( 'ableplayer-video', plugins_url( 'assets', __FILE__ ) . '/js/video.js', array(), ABLEPLAYER_VERSION, true );
77-
77+
wp_localize_script(
78+
'ableplayer-video',
79+
'ableplayer',
80+
array(
81+
'settings' => ableplayer_get_settings(),
82+
)
83+
);
7884
// if the environment is production, use minified files. Otherwise, inherit the value of SCRIPT_DEBUG.
7985
$is_production = ( function_exists( 'wp_get_environment_type' ) &amp;&amp; wp_get_environment_type() === 'production' ) ? true : SCRIPT_DEBUG;
8086

@@ -88,7 +94,7 @@
8894
* @param {string} $url URL to Able Player root directory.
8995
* @param {bool} $is_production True if environment is designated as production.
9096
*
91-
* @return string
97+
* @return {string}
9298
*/
9399
$js_dir = apply_filters( 'able_player_js', plugins_url( 'build', __FILE__ ) . '/' . $js_file, $is_production );
94100
/**
@@ -99,16 +105,52 @@
99105
* @param {string} $url URL to Able Player root directory.
100106
* @param {bool} $is_production True if environment is designated as production.
101107
*
102-
* @return string
108+
* @return {string}
103109
*/
104110
$css_dir = apply_filters( 'able_player_css', plugins_url( 'build', __FILE__ ) . '/' . $css_file, $is_production );
105111

106-
// Enqueue Able Player script and CSS.
107-
wp_enqueue_script( 'ableplayer', $js_dir, array( 'jquery', 'ableplayer-video' ), ABLEPLAYER_VERSION, true );
112+
$dependencies = array( 'jquery', 'ableplayer-video' );
113+
/**
114+
* Filter the Able Player script dependencies.
115+
*
116+
* @hook ableplayer_dependencies
117+
*
118+
* @param {array} $dependencies Array of scripts required by the main AblePlayer script.
119+
* @param {bool} $is_production True if environment is designated as production.
120+
*
121+
* @return {array}
122+
*/
123+
$dependencies = apply_filters( 'ableplayer_dependencies', $dependencies, $is_production );
124+
wp_enqueue_script( 'ableplayer', $js_dir, $dependencies, ABLEPLAYER_VERSION, true );
108125
wp_enqueue_style( 'ableplayer', $css_dir, array(), ABLEPLAYER_VERSION );
109126
}
110127
add_action( 'wp_enqueue_scripts', 'ableplayer_enqueue_scripts' );
111128

129+
/**
130+
* Get Able Player settings.
131+
*
132+
* @param string $setting A specific setting key. Default empty string.
133+
*
134+
* @return array|mixed The full settings array or a specific setting value.
135+
*/
136+
function ableplayer_get_settings( $setting = '' ) {
137+
$settings = get_option( 'ableplayer_settings', ableplayer_default_settings() );
138+
if ( $setting &amp;&amp; isset( $settings[ $setting ] ) ) {
139+
return $settings[ $setting ];
140+
}
141+
142+
return $settings;
143+
}
144+
145+
/**
146+
* Get Able Player default settings.
147+
*
148+
* @return array
149+
*/
150+
function ableplayer_default_settings() {
151+
return array();
152+
}
153+
112154
/**
113155
* Self-documenting array of AblePlayer attributes.
114156
*
@@ -517,7 +559,7 @@
517559
</div>
518560

519561
<nav>
520-
<h2><a href="index.html">Home</a></h2><h3>Filters</h3><ul><li><a href="able_player_css.html">able_player_css</a></li><li><a href="able_player_js.html">able_player_js</a></li><li><a href="ableplayer_parameters.html">ableplayer_parameters</a></li></ul>
562+
<h2><a href="index.html">Home</a></h2><h3>Filters</h3><ul><li><a href="able_player_css.html">able_player_css</a></li><li><a href="able_player_js.html">able_player_js</a></li><li><a href="ableplayer_dependencies.html">ableplayer_dependencies</a></li><li><a href="ableplayer_parameters.html">ableplayer_parameters</a></li></ul>
521563
</nav>
522564

523565
<br class="clear">

0 commit comments

Comments
 (0)