Version Description
- Updated the admin page to use the improved media manager UII
- Fixed function name conflicts with the Pro version.
- Improved data validation
Download this release
Release Info
Developer | mordauk |
Plugin | Simple Full Screen Background Image |
Version | 1.1 |
Comparing to | |
See all releases |
Code changes from version 1.0.4 to 1.1
- includes/admin-page.php +12 -14
- includes/display-image.php +3 -3
- includes/fsb-scripts.js +49 -19
- includes/fullscreen-image.css +4 -4
- includes/scripts.php +9 -12
- readme.txt +9 -3
- simple-full-screen-background.php +3 -3
includes/admin-page.php
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
function
|
4 |
|
5 |
-
global $
|
6 |
-
|
7 |
<div class="wrap">
|
8 |
<div id="fsb-wrap" class="fsb-help">
|
9 |
<h2>Full Screen Background Image</h2>
|
@@ -21,14 +21,14 @@ function fsb_admin_page() {
|
|
21 |
<h4>Choose Your Image</h4>
|
22 |
|
23 |
<p>
|
24 |
-
<input id="fsb_settings[image]" name="fsb_settings[image]" type="text" class="upload_field" value="<?php echo $
|
25 |
<input class="upload_image_button button-secondary" type="button" value="Choose Image"/>
|
26 |
<label class="description" for="fsb_settings[image]"><?php _e( 'This image will be applied to the background of your website' ); ?></label>
|
27 |
</p>
|
28 |
|
29 |
<p>
|
30 |
-
<?php if($
|
31 |
-
<img src="<?php echo $
|
32 |
<?php } else { ?>
|
33 |
<img src="<?php echo plugin_dir_url( __FILE__ ) . 'preview.jpg'; ?>" id="fsb_preview_image" style="padding: 3px; border: 1px solid #f0f0f0; max-width: 600px; overflow: hidden;"/>
|
34 |
<?php } ?>
|
@@ -39,20 +39,18 @@ function fsb_admin_page() {
|
|
39 |
<input type="submit" class="button-primary" value="<?php _e( 'Save Options' ); ?>" />
|
40 |
</p>
|
41 |
|
42 |
-
|
43 |
</form>
|
44 |
</div><!--end fsb-wrap-->
|
45 |
</div><!--end wrap-->
|
46 |
-
|
47 |
-
|
48 |
}
|
49 |
-
function
|
50 |
-
add_submenu_page( 'themes.php', 'Full Screen Background Image', 'Fullscreen BG Image', 'manage_options', 'full-screen-background', '
|
51 |
}
|
52 |
-
add_action('admin_menu', '
|
53 |
|
54 |
// register the plugin settings
|
55 |
-
function
|
56 |
register_setting( 'fsb_register_settings', 'fsb_settings' );
|
57 |
}
|
58 |
-
add_action( 'admin_init', '
|
1 |
<?php
|
2 |
|
3 |
+
function sfsb_admin_page() {
|
4 |
|
5 |
+
global $sfsb_options;
|
6 |
+
?>
|
7 |
<div class="wrap">
|
8 |
<div id="fsb-wrap" class="fsb-help">
|
9 |
<h2>Full Screen Background Image</h2>
|
21 |
<h4>Choose Your Image</h4>
|
22 |
|
23 |
<p>
|
24 |
+
<input id="fsb_settings[image]" name="fsb_settings[image]" type="text" class="upload_field" value="<?php echo $sfsb_options['image']; ?>"/>
|
25 |
<input class="upload_image_button button-secondary" type="button" value="Choose Image"/>
|
26 |
<label class="description" for="fsb_settings[image]"><?php _e( 'This image will be applied to the background of your website' ); ?></label>
|
27 |
</p>
|
28 |
|
29 |
<p>
|
30 |
+
<?php if( ! empty( $sfsb_options['image'] ) ) { ?>
|
31 |
+
<img src="<?php echo $sfsb_options['image']; ?>" id="fsb_preview_image" style="padding: 3px; border: 1px solid #f0f0f0; max-width: 600px; overflow: hidden;"/>
|
32 |
<?php } else { ?>
|
33 |
<img src="<?php echo plugin_dir_url( __FILE__ ) . 'preview.jpg'; ?>" id="fsb_preview_image" style="padding: 3px; border: 1px solid #f0f0f0; max-width: 600px; overflow: hidden;"/>
|
34 |
<?php } ?>
|
39 |
<input type="submit" class="button-primary" value="<?php _e( 'Save Options' ); ?>" />
|
40 |
</p>
|
41 |
|
|
|
42 |
</form>
|
43 |
</div><!--end fsb-wrap-->
|
44 |
</div><!--end wrap-->
|
45 |
+
<?php
|
|
|
46 |
}
|
47 |
+
function sfsb_init_admin() {
|
48 |
+
add_submenu_page( 'themes.php', 'Full Screen Background Image', 'Fullscreen BG Image', 'manage_options', 'full-screen-background', 'sfsb_admin_page' );
|
49 |
}
|
50 |
+
add_action('admin_menu', 'sfsb_init_admin');
|
51 |
|
52 |
// register the plugin settings
|
53 |
+
function sfsb_register_settings() {
|
54 |
register_setting( 'fsb_register_settings', 'fsb_settings' );
|
55 |
}
|
56 |
+
add_action( 'admin_init', 'sfsb_register_settings' );
|
includes/display-image.php
CHANGED
@@ -1,10 +1,10 @@
|
|
1 |
<?php
|
2 |
|
3 |
function fsb_display_image() {
|
4 |
-
global $
|
5 |
|
6 |
-
if ( isset( $
|
7 |
-
$image = $
|
8 |
if( is_ssl() ) {
|
9 |
$image = str_replace( 'http://', 'https://', $image );
|
10 |
}
|
1 |
<?php
|
2 |
|
3 |
function fsb_display_image() {
|
4 |
+
global $sfsb_options;
|
5 |
|
6 |
+
if ( isset( $sfsb_options['image'] ) ) {
|
7 |
+
$image = $sfsb_options['image'];
|
8 |
if( is_ssl() ) {
|
9 |
$image = str_replace( 'http://', 'https://', $image );
|
10 |
}
|
includes/fsb-scripts.js
CHANGED
@@ -1,27 +1,57 @@
|
|
1 |
jQuery(document).ready(function($) {
|
2 |
|
3 |
-
|
|
|
4 |
|
5 |
-
|
6 |
-
window.widgetFormfield = jQuery('.upload_field',jQuery(this).parent());
|
7 |
-
tb_show('Choose Image', 'media-upload.php?TB_iframe=true');
|
8 |
-
return false;
|
9 |
-
});
|
10 |
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
else {
|
19 |
-
window.original_send_to_editor(html);
|
20 |
}
|
21 |
-
window.widgetFormfield = '';
|
22 |
-
window.imagefield = false;
|
23 |
|
24 |
-
|
25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
|
27 |
});
|
1 |
jQuery(document).ready(function($) {
|
2 |
|
3 |
+
var file_frame;
|
4 |
+
$('body').on('click', '.upload_image_button', function(e) {
|
5 |
|
6 |
+
e.preventDefault();
|
|
|
|
|
|
|
|
|
7 |
|
8 |
+
var formfield = $(this).prev();
|
9 |
+
|
10 |
+
// If the media frame already exists, reopen it.
|
11 |
+
if ( file_frame ) {
|
12 |
+
//file_frame.uploader.uploader.param( 'post_id', set_to_post_id );
|
13 |
+
file_frame.open();
|
14 |
+
return;
|
|
|
|
|
15 |
}
|
|
|
|
|
16 |
|
17 |
+
// Create the media frame.
|
18 |
+
file_frame = wp.media.frames.file_frame = wp.media({
|
19 |
+
frame: 'select',
|
20 |
+
title: 'Choose Image',
|
21 |
+
multiple: false,
|
22 |
+
library: {
|
23 |
+
type: 'image'
|
24 |
+
},
|
25 |
+
button: {
|
26 |
+
text: 'Use Image'
|
27 |
+
}
|
28 |
+
});
|
29 |
+
|
30 |
+
file_frame.on( 'menu:render:default', function(view) {
|
31 |
+
// Store our views in an object.
|
32 |
+
var views = {};
|
33 |
+
|
34 |
+
// Unset default menu items
|
35 |
+
view.unset('library-separator');
|
36 |
+
view.unset('gallery');
|
37 |
+
view.unset('featured-image');
|
38 |
+
view.unset('embed');
|
39 |
+
|
40 |
+
// Initialize the views in our view object.
|
41 |
+
view.set(views);
|
42 |
+
});
|
43 |
+
|
44 |
+
// When an image is selected, run a callback.
|
45 |
+
file_frame.on( 'select', function() {
|
46 |
+
|
47 |
+
var attachment = file_frame.state().get('selection').first().toJSON();
|
48 |
+
formfield.val(attachment.url);
|
49 |
+
$('#fsb_preview_image').attr('src', attachment.url);
|
50 |
+
|
51 |
+
});
|
52 |
+
|
53 |
+
// Finally, open the modal
|
54 |
+
file_frame.open();
|
55 |
+
});
|
56 |
|
57 |
});
|
includes/fullscreen-image.css
CHANGED
@@ -14,8 +14,8 @@ img#fsb_image {
|
|
14 |
z-index: -9999;
|
15 |
}
|
16 |
@media screen and (max-width: 1024px) { /* Specific to this particular image */
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
}
|
14 |
z-index: -9999;
|
15 |
}
|
16 |
@media screen and (max-width: 1024px) { /* Specific to this particular image */
|
17 |
+
img#fsb_image {
|
18 |
+
left: 50%;
|
19 |
+
margin-left: -512px; /* 50% */
|
20 |
+
}
|
21 |
}
|
includes/scripts.php
CHANGED
@@ -1,21 +1,18 @@
|
|
1 |
<?php
|
2 |
|
3 |
-
function
|
4 |
-
global $
|
5 |
-
if( isset( $
|
6 |
wp_enqueue_style( 'fsb-image', plugin_dir_url( __FILE__ ) . 'fullscreen-image.css' );
|
|
|
7 |
}
|
8 |
-
add_action( '
|
9 |
|
10 |
-
function
|
11 |
if( 'appearance_page_full-screen-background' !== $hook )
|
12 |
return;
|
|
|
|
|
13 |
wp_enqueue_script( 'fsb-scripts', plugin_dir_url( __FILE__ ) . 'fsb-scripts.js', array( 'jquery', 'media-upload', 'thickbox' ), filemtime( plugin_dir_path( __FILE__ ) . 'fsb-scripts.js' ) );
|
14 |
}
|
15 |
-
|
16 |
-
if( 'appearance_page_full-screen-background' !== $hook )
|
17 |
-
return;
|
18 |
-
wp_enqueue_style( 'thickbox' );
|
19 |
-
}
|
20 |
-
add_action( 'admin_enqueue_scripts', 'fsb_load_admin_scripts' );
|
21 |
-
add_action( 'admin_enqueue_scripts', 'fsb_load_admin_styles' );
|
1 |
<?php
|
2 |
|
3 |
+
function sfsb_load_css() {
|
4 |
+
global $sfsb_options;
|
5 |
+
if( isset( $sfsb_options['image'] ) ) {
|
6 |
wp_enqueue_style( 'fsb-image', plugin_dir_url( __FILE__ ) . 'fullscreen-image.css' );
|
7 |
+
}
|
8 |
}
|
9 |
+
add_action( 'wp_enqueue_scripts', 'sfsb_load_css' );
|
10 |
|
11 |
+
function sfsb_load_admin_scripts( $hook ) {
|
12 |
if( 'appearance_page_full-screen-background' !== $hook )
|
13 |
return;
|
14 |
+
|
15 |
+
wp_enqueue_media();
|
16 |
wp_enqueue_script( 'fsb-scripts', plugin_dir_url( __FILE__ ) . 'fsb-scripts.js', array( 'jquery', 'media-upload', 'thickbox' ), filemtime( plugin_dir_path( __FILE__ ) . 'fsb-scripts.js' ) );
|
17 |
}
|
18 |
+
add_action( 'admin_enqueue_scripts', 'sfsb_load_admin_scripts' );
|
|
|
|
|
|
|
|
|
|
|
|
readme.txt
CHANGED
@@ -4,9 +4,9 @@ Author URI: http://pippinsplugins.com
|
|
4 |
Plugin URI: http://pippinspages.com/simple-fullscreen-background-image
|
5 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=72HGD7SA97KPE
|
6 |
Tags: background, fullscreen, image, bg image, full screen
|
7 |
-
Requires at least: 3.
|
8 |
-
Tested up to:
|
9 |
-
Stable tag: 1.
|
10 |
|
11 |
This plugin lets provides a simple way to set an automatically scaled full screen background image.
|
12 |
|
@@ -32,6 +32,12 @@ Check out http://pippinsplugins.com/simple-fullscreen-background-image for scree
|
|
32 |
|
33 |
== Changelog ==
|
34 |
|
|
|
|
|
|
|
|
|
|
|
|
|
35 |
= 1.0.4 =
|
36 |
|
37 |
* Fixed an issue with images loading via http when on an https site
|
4 |
Plugin URI: http://pippinspages.com/simple-fullscreen-background-image
|
5 |
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=72HGD7SA97KPE
|
6 |
Tags: background, fullscreen, image, bg image, full screen
|
7 |
+
Requires at least: 3.6
|
8 |
+
Tested up to: 4.0
|
9 |
+
Stable tag: 1.1
|
10 |
|
11 |
This plugin lets provides a simple way to set an automatically scaled full screen background image.
|
12 |
|
32 |
|
33 |
== Changelog ==
|
34 |
|
35 |
+
= 1.1 =
|
36 |
+
|
37 |
+
* Updated the admin page to use the improved media manager UII
|
38 |
+
* Fixed function name conflicts with the Pro version.
|
39 |
+
* Improved data validation
|
40 |
+
|
41 |
= 1.0.4 =
|
42 |
|
43 |
* Fixed an issue with images loading via http when on an https site
|
simple-full-screen-background.php
CHANGED
@@ -1,8 +1,8 @@
|
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Simple Full Screen Background Image
|
4 |
-
Description: Easily set an automatically scaled full-screen background
|
5 |
-
Version: 1.
|
6 |
Author: Pippin Williamson
|
7 |
Author URI: http://pippinsplugins.com
|
8 |
*/
|
@@ -11,7 +11,7 @@ Author URI: http://pippinsplugins.com
|
|
11 |
* global
|
12 |
*****************************************/
|
13 |
|
14 |
-
$
|
15 |
|
16 |
/*****************************************
|
17 |
* includes
|
1 |
<?php
|
2 |
/*
|
3 |
Plugin Name: Simple Full Screen Background Image
|
4 |
+
Description: Easily set an automatically scaled full-screen background images
|
5 |
+
Version: 1.1
|
6 |
Author: Pippin Williamson
|
7 |
Author URI: http://pippinsplugins.com
|
8 |
*/
|
11 |
* global
|
12 |
*****************************************/
|
13 |
|
14 |
+
$sfsb_options = get_option('fsb_settings');
|
15 |
|
16 |
/*****************************************
|
17 |
* includes
|