Video Background - Version 2.2.0

Version Description

  • Fixed notices on 404 page when debug mode is set to true
  • Fixed blog posts page video background.
Download this release

Release Info

Developer blakedotvegas
Plugin Icon 128x128 Video Background
Version 2.2.0
Comparing to
See all releases

Code changes from version 2.1.4 to 2.2.0

Files changed (2) hide show
  1. candide-vidbg.php +70 -50
  2. readme.txt +5 -1
candide-vidbg.php CHANGED
@@ -4,7 +4,7 @@ Plugin Name: Video Background
4
  Plugin URI: http://blake.vegas/plugins/video-background/
5
  Description: jQuery WordPress plugin to easily assign a video background to any element. Awesome.
6
  Author: Blake Wilson
7
- Version: 2.1.4
8
  Author URI: http://blake.vegas
9
  */
10
 
@@ -21,7 +21,7 @@ add_action('admin_enqueue_scripts', 'vidbg_metabox_scripts');
21
  * Enqueue vidbg jquery script
22
  */
23
  function vidbg_jquery() {
24
- wp_enqueue_script('vidbg-video-background', plugins_url('/js/jquery.vidbg-min.js', __FILE__), array('jquery'), '2.1.4', true);
25
  }
26
  add_action('wp_footer', 'vidbg_jquery' );
27
 
@@ -154,7 +154,7 @@ function vidbg_meta_box_save( $post_id )
154
  if( !isset( $_POST['meta_box_nonce'] ) || !wp_verify_nonce( $_POST['meta_box_nonce'], 'my_meta_box_nonce' ) ) return;
155
 
156
  // if our current user can't edit this post, bail
157
- if( !current_user_can( 'edit_post' ) ) return;
158
 
159
  // now we can actually save the data
160
  $allowed = array(
@@ -190,59 +190,79 @@ function vidbg_meta_box_save( $post_id )
190
  * Add inline javascript to footer for video background
191
  */
192
  function vidbg_initialize_footer() {
193
- global $post;
194
- $container_field = get_post_meta( $post->ID, 'vidbg_metabox_field_container', true );
195
- $mp4_field = get_post_meta( $post->ID, 'vidbg_metabox_field_mp4', true );
196
- $webm_field = get_post_meta( $post->ID, 'vidbg_metabox_field_webm', true );
197
- $poster_field = get_post_meta( $post->ID, 'vidbg_metabox_field_poster', true );
198
- $pattern_overlay = get_post_meta( $post->ID, 'vidbg_metabox_field_overlay', true );
199
- $no_loop_field = get_post_meta( $post->ID, 'vidbg_metabox_field_no_loop', true );
200
- $unmute_field = get_post_meta( $post->ID, 'vidbg_metabox_field_unmute', true ); ?>
201
- <?php if($container_field): ?>
202
- <script type="text/javascript">
203
- jQuery(function($){
204
- $('<?php echo $container_field; ?>').vidbg({
205
- 'mp4': '<?php echo $mp4_field; ?>',
206
- 'webm': '<?php echo $webm_field; ?>',
207
- 'poster': '<?php echo $poster_field; ?>',
208
- }, {
209
- // Options
210
- muted: <?php if($unmute_field == 'on'): ?>false<?php else: ?>true<?php endif; ?>,
211
- loop: <?php if($no_loop_field == 'on'): ?>false<?php else: ?>true<?php endif; ?>,
212
- });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
213
  });
214
- </script>
215
- <?php endif; ?>
216
- <?php if($pattern_overlay == 'on'): ?>
217
- <script type="text/javascript">
218
- jQuery(function($) {
219
- $( "<div class='vidbg-overlay'></div>" ).insertAfter( $( ".vidbg-container > video" ) );
220
- });
221
- </script>
222
- <?php endif; ?>
223
- <?php }
224
  add_action( 'wp_footer', 'vidbg_initialize_footer' );
225
 
226
  /**
227
  * Add overlay css to header
228
  */
229
- function vidbg_initialize_header() {
230
- global $post;
231
- $pattern_overlay = get_post_meta( $post->ID, 'vidbg_metabox_field_overlay', true ); ?>
232
- <?php if($pattern_overlay == 'on'): ?>
233
- <style>
234
- .vidbg-overlay {
235
- background: url("<?php echo plugins_url( 'images/overlay.png', __FILE__ ); ?>") repeat;
236
- position: absolute;
237
- top:0;
238
- right:0;
239
- left:0;
240
- bottom:0;
241
- z-index: -1;
242
- }
243
- </style>
244
- <?php endif; ?>
245
- <?php }
 
 
 
 
 
 
 
246
  add_action( 'wp_head', 'vidbg_initialize_header' );
247
 
248
  /**
4
  Plugin URI: http://blake.vegas/plugins/video-background/
5
  Description: jQuery WordPress plugin to easily assign a video background to any element. Awesome.
6
  Author: Blake Wilson
7
+ Version: 2.2.0
8
  Author URI: http://blake.vegas
9
  */
10
 
21
  * Enqueue vidbg jquery script
22
  */
23
  function vidbg_jquery() {
24
+ wp_enqueue_script('vidbg-video-background', plugins_url('/js/jquery.vidbg-min.js', __FILE__), array('jquery'), '2.2.0', true);
25
  }
26
  add_action('wp_footer', 'vidbg_jquery' );
27
 
154
  if( !isset( $_POST['meta_box_nonce'] ) || !wp_verify_nonce( $_POST['meta_box_nonce'], 'my_meta_box_nonce' ) ) return;
155
 
156
  // if our current user can't edit this post, bail
157
+ if( !current_user_can( 'edit_posts' ) ) return;
158
 
159
  // now we can actually save the data
160
  $allowed = array(
190
  * Add inline javascript to footer for video background
191
  */
192
  function vidbg_initialize_footer() {
193
+ if(is_page() || is_single() || is_home()) {
194
+ if(is_page() || is_single()) {
195
+ global $post;
196
+ $container_field = get_post_meta( $post->ID, 'vidbg_metabox_field_container', true );
197
+ $mp4_field = get_post_meta( $post->ID, 'vidbg_metabox_field_mp4', true );
198
+ $webm_field = get_post_meta( $post->ID, 'vidbg_metabox_field_webm', true );
199
+ $poster_field = get_post_meta( $post->ID, 'vidbg_metabox_field_poster', true );
200
+ $pattern_overlay = get_post_meta( $post->ID, 'vidbg_metabox_field_overlay', true );
201
+ $no_loop_field = get_post_meta( $post->ID, 'vidbg_metabox_field_no_loop', true );
202
+ $unmute_field = get_post_meta( $post->ID, 'vidbg_metabox_field_unmute', true );
203
+ } elseif (is_home()) {
204
+ $page_object = get_queried_object();
205
+ $container_field = get_post_meta( $page_object->ID, 'vidbg_metabox_field_container', true );
206
+ $mp4_field = get_post_meta( $page_object->ID, 'vidbg_metabox_field_mp4', true );
207
+ $webm_field = get_post_meta( $page_object->ID, 'vidbg_metabox_field_webm', true );
208
+ $poster_field = get_post_meta( $page_object->ID, 'vidbg_metabox_field_poster', true );
209
+ $pattern_overlay = get_post_meta( $page_object->ID, 'vidbg_metabox_field_overlay', true );
210
+ $no_loop_field = get_post_meta( $page_object->ID, 'vidbg_metabox_field_no_loop', true );
211
+ $unmute_field = get_post_meta( $page_object->ID, 'vidbg_metabox_field_unmute', true );
212
+ } ?>
213
+ <?php if($container_field): ?>
214
+ <script type="text/javascript">
215
+ jQuery(function($){
216
+ $('<?php echo $container_field; ?>').vidbg({
217
+ 'mp4': '<?php echo $mp4_field; ?>',
218
+ 'webm': '<?php echo $webm_field; ?>',
219
+ 'poster': '<?php echo $poster_field; ?>',
220
+ }, {
221
+ // Options
222
+ muted: <?php if($unmute_field == 'on'): ?>false<?php else: ?>true<?php endif; ?>,
223
+ loop: <?php if($no_loop_field == 'on'): ?>false<?php else: ?>true<?php endif; ?>,
224
+ });
225
+ });
226
+ </script>
227
+ <?php endif; ?>
228
+ <?php if($pattern_overlay == 'on'): ?>
229
+ <script type="text/javascript">
230
+ jQuery(function($) {
231
+ $( "<div class='vidbg-overlay'></div>" ).insertAfter( $( ".vidbg-container > video" ) );
232
  });
233
+ </script>
234
+ <?php endif; ?>
235
+ <?php }
236
+ }
 
 
 
 
 
 
237
  add_action( 'wp_footer', 'vidbg_initialize_footer' );
238
 
239
  /**
240
  * Add overlay css to header
241
  */
242
+ function vidbg_initialize_header() {
243
+ if(is_page() || is_single() || is_home()) {
244
+ if(is_page() || is_single()) {
245
+ global $post;
246
+ $pattern_overlay = get_post_meta( $post->ID, 'vidbg_metabox_field_overlay', true );
247
+ } elseif (is_home()) {
248
+ $page_object = get_queried_object();
249
+ $pattern_overlay = get_post_meta( $page_object->ID, 'vidbg_metabox_field_overlay', true );
250
+ } ?>
251
+ <?php if($pattern_overlay == 'on'): ?>
252
+ <style>
253
+ .vidbg-overlay {
254
+ background: url("<?php echo plugins_url( 'images/overlay.png', __FILE__ ); ?>") repeat;
255
+ position: absolute;
256
+ top:0;
257
+ right:0;
258
+ left:0;
259
+ bottom:0;
260
+ z-index: -1;
261
+ }
262
+ </style>
263
+ <?php endif; ?>
264
+ <?php }
265
+ }
266
  add_action( 'wp_head', 'vidbg_initialize_header' );
267
 
268
  /**
readme.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: http://blake.vegas/plugins/video-background/
4
  Tags: html5, video background, mp4, webm, responsive, shortcode, overlay, fullscreen background, fullscreen, html5 video background, metabox, blake vegas, loop, mute, unmute
5
  Requires at least: 3.2
6
  Tested up to: 4.3.1
7
- Stable tag: 2.1.4
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
@@ -73,6 +73,10 @@ To add a video background to a class called **header** add ".header" to the cont
73
 
74
  == Changelog ==
75
 
 
 
 
 
76
  = 2.1.4 =
77
  * Added toggle loop
78
  * Added toggle mute
4
  Tags: html5, video background, mp4, webm, responsive, shortcode, overlay, fullscreen background, fullscreen, html5 video background, metabox, blake vegas, loop, mute, unmute
5
  Requires at least: 3.2
6
  Tested up to: 4.3.1
7
+ Stable tag: 2.2.0
8
  License: GPLv2 or later
9
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
 
73
 
74
  == Changelog ==
75
 
76
+ = 2.2.0 =
77
+ * Fixed notices on 404 page when debug mode is set to true
78
+ * Fixed blog posts page video background.
79
+
80
  = 2.1.4 =
81
  * Added toggle loop
82
  * Added toggle mute