Simple Full Screen Background Image - Version 1.2.7

Version Description

  • Reverted plugin suggestions from v1.2.6
Download this release

Release Info

Developer scott.deluzio
Plugin Icon 128x128 Simple Full Screen Background Image
Version 1.2.7
Comparing to
See all releases

Code changes from version 1.2.6 to 1.2.7

includes/meta-box.php CHANGED
@@ -1,281 +1,28 @@
1
  <?php
2
- if ( !defined( 'ABSPATH' ) ) {
3
- die( "Sorry, you are not allowed to access this page directly." );
4
- }
5
- if( !class_exists( 'AmplifyPluginsSuggestions' ) ){
6
- /**
7
- * Amplify Plugins suggested plugins class
8
- * @version 1.0
9
- */
10
- class AmplifyPluginsSuggestions {
11
-
12
- /**
13
- * Initialize
14
- * @since 1.0
15
- */
16
- public static function init(){
17
- add_action( 'admin_init', array( __CLASS__, 'add_woocommerce_suggestions' ) );
18
- add_action( 'add_meta_boxes', array( __CLASS__, 'add_suggestions_meta_box' ) );
19
- }
20
-
21
- /**
22
- * Add Suggestions to WooCommerce Marketplace Suggestions
23
- * @since 1.0
24
- */
25
- public static function add_woocommerce_suggestions(){
26
- if( class_exists( 'WooCommerce' ) ){
27
- global $woocommerce;
28
- // We don't want to continue if running a version of WooCommerce under 3.6
29
- if( version_compare( $woocommerce->version, '3.6', '<' ) ){
30
- return;
31
- }
32
- $suggestion_transient = get_transient( 'amplify_plugins_woo_suggestions_update' );
33
- if( !$suggestion_transient ){
34
- // Get existing WooCommerce suggestions
35
- $data = get_option( 'woocommerce_marketplace_suggestions', array() );
36
- $suggestions = self::get_amplify_plugins_suggestions();
37
- if( $suggestions ){
38
- // Remove any of our suggestions before adding them back to update any data.
39
- $data['suggestions'] = self::reset_amplify_plugins_suggestions( $data['suggestions'], $suggestions );
40
- // Maybe add suggestions depending on if certain plugins are active.
41
- foreach( $suggestions as $plugin ){
42
- switch ( $plugin['slug'] ) {
43
- case 'product-edit-conditional-checkout-fields':
44
- if( !defined( 'CWCFP_PLUGIN' ) ){
45
- array_unshift( $data['suggestions'], $plugin );
46
- }
47
- break;
48
-
49
- case 'product-edit-quick-checkout':
50
- if( !defined( 'WQC_PLUGIN_FILE' ) ){
51
- array_unshift( $data['suggestions'], $plugin );
52
- }
53
- break;
54
-
55
- case 'product-edit-full-screen-background-images':
56
- if( is_plugin_active( 'simple-full-screen-background-image/simple-full-screen-background.php' ) ){
57
- array_unshift( $data['suggestions'], $plugin );
58
- }
59
- break;
60
-
61
- case 'product-edit-wp1099-affiliate':
62
- case 'product-edit-wp1099-vendor':
63
- if( !defined( 'WP_TEN_NINETY_NINE' ) ){
64
- array_unshift( $data['suggestions'], $plugin );
65
- }
66
- break;
67
-
68
- default:
69
- array_unshift( $data['suggestions'], $plugin );
70
- break;
71
- }
72
- }
73
-
74
- // Clean up duplicates, which there shouldn't be any of at this point.
75
- $data['suggestions'] = self::search_woo_marketplace( $data['suggestions'], 'slug' );
76
- // Update marketplace suggestions
77
- update_option( 'woocommerce_marketplace_suggestions', $data );
78
- // Set transient to prevent updating more than once per day.
79
- set_transient( 'amplify_plugins_woo_suggestions_update', time(), DAY_IN_SECONDS );
80
- }
81
- }
82
- }
83
- }
84
-
85
- /**
86
- * Add suggestions meta boxes.
87
- * @since 1.0
88
- */
89
- public static function add_suggestions_meta_box(){
90
- // Suggestions are only displayed if user can install plugins.
91
- if ( ! current_user_can( 'install_plugins' ) ) {
92
- return false;
93
- }
94
-
95
- $single_suggestion = self::get_one_amplify_plugins_suggestion();
96
-
97
- // Make sure we have a suggestion to offer.
98
- if( empty( $single_suggestion ) || !array( $single_suggestion ) ){
99
- return false;
100
- }
101
-
102
- // Get all post types as objects
103
- $post_types = get_post_types(
104
- array(
105
- 'show_ui' => true
106
- ),
107
- 'objects'
108
- );
109
-
110
- // Loop through each post type
111
- foreach( $post_types as $post_type ) {
112
- // This is to make sure the meta box is not added to certain post types
113
- $exclude = array(
114
- 'attachment',
115
- 'menu',
116
- 'modals'
117
- );
118
-
119
- // Check if WooCommerce is active
120
- if( class_exists( 'WooCommerce' ) ){
121
- global $woocommerce;
122
- // We don't want to continue adding a metabox to WooCommerce product edit screens above 3.6
123
- if( version_compare( $woocommerce->version, '3.6', '>=' ) ){
124
- $exclude[] = 'product';
125
- }
126
- // We never want to add a metabox to the orders, coupons, webhooks, product visibility, or product variations.
127
- $exclude[] = 'shop_order';
128
- $exclude[] = 'shop_coupon';
129
- $exclude[] = 'shop_webhook';
130
- $exclude[] = 'product_visibility';
131
- $exclude[] = 'product_variation';
132
- }
133
-
134
- if( !in_array( $post_type->name, $exclude ) ) {
135
- add_meta_box(
136
- 'amplify-plugins-meta-box',
137
- $single_suggestion['title'],
138
- array( __CLASS__, 'show_meta_box' ),
139
- $post_type->name,
140
- 'side',
141
- 'high'
142
- );
143
- }
144
- }
145
- }
146
 
147
- /**
148
- * Retrieve one random suggestion
149
- * @since 1.0
150
- * @return array
151
- */
152
- public static function get_one_amplify_plugins_suggestion(){
153
- $random_suggestion = get_transient( 'amplify_plugins_random_suggestion' );
154
- if( !$random_suggestion ){
155
- $suggestions = get_transient( 'amplify_plugins_suggestions' );
156
- // If no suggestions are stored or $suggestions is not an array return an empty array.
157
- if( !$suggestions || !is_array( $suggestions ) ){
158
- return array(); // empty() == true
159
- }
160
-
161
- // Select a single random suggestion from the array of suggestions.
162
- $random_key = array_rand( $suggestions, 1 );
163
-
164
- // Some suggestions we only want to show if another dependent plugin is active.
165
- if( isset( $suggestions[$random_key]['show-if-active'] ) ){
166
- $is_active = array();
167
- $active_plugin_slugs = array_map( 'dirname', get_option( 'active_plugins' ) );
168
- // Loop through until we get a plugin that matches the show if active condition.
169
- do{
170
- foreach( $suggestions[$random_key]['show-if-active'] as $active_check ){
171
- if( in_array( $active_check, $active_plugin_slugs ) ){
172
- $is_active[] = true;
173
- }
174
- }
175
- } while ( !in_array( true, $is_active ) );
176
- }
177
- $random_suggestion = $suggestions[$random_key];
178
- set_transient( 'amplify_plugins_random_suggestion', $random_suggestion, HOUR_IN_SECONDS );
179
- }
180
-
181
- return $random_suggestion;
182
- }
183
-
184
- /**
185
- * Show the content of the suggestion metabox
186
- * @since 1.0
187
- */
188
- public static function show_meta_box() {
189
- $post = get_post();
190
- $suggestion = self::get_one_amplify_plugins_suggestion();
191
- $url = $suggestion['url'];
192
- $url = str_replace( 'utm_medium=wc-suggestions', 'utm_medium=metabox', $url );
193
- $obj = get_post_type_object( $post->post_type );
194
- $pt_name = $obj->labels->singular_name;
195
- $copy = $suggestion['copy'];
196
- $title = $suggestion['title'];
197
-
198
- echo '<div>' . $copy . '</div>';
199
- echo '<div style="margin-top:10px;"><a target="_blank" class="button button-primary" href="' . $url . '">' . __( 'Get ' ) . $title . '</a></div>';
200
- }
201
-
202
- /**
203
- * Make sure WooCommerce Marketplace Suggestions are returning unique values
204
- * @since 1.0
205
- */
206
-
207
- public static function search_woo_marketplace( $array, $key ){
208
- $temp_array = array();
209
- $i = 0;
210
- $key_array = array();
211
-
212
- foreach( $array as $val ) {
213
- if ( !in_array( $val[$key], $key_array ) ) {
214
- $key_array[$i] = $val[$key];
215
- $temp_array[$i] = $val;
216
- }
217
- $i++;
218
- }
219
- return $temp_array;
220
- }
221
-
222
- /**
223
- * Reset Amplify Plugins suggestions
224
- * @since 1.0
225
- */
226
- public static function reset_amplify_plugins_suggestions( $array, $body ){
227
- $suggestions = array();
228
- foreach( $body as $slug ){
229
- $suggestions[] = $slug['slug'];
230
- }
231
- foreach( $array as $key => $value ){
232
- if( in_array( $value['slug'], $suggestions ) ){
233
- unset( $array[$key] );
234
- }
235
- }
236
- return $array;
237
  }
 
 
 
238
 
239
- /**
240
- * Retrieve Amplify Plugin suggestions remotely
241
- * @since 1.0
242
- * @return array of suggestions from Amplify Plugins
243
- */
244
- public static function get_amplify_plugins_suggestions(){
245
- $suggestions = get_transient( 'amplify_plugins_suggestions' );
246
- if( !$suggestions ){
247
- // Retrieve Amplify Plugins suggestions
248
- $url = 'https://amplifyplugins.com/wp-content/uploads/suggestions/suggestions.json';
249
- $request = wp_safe_remote_get( $url );
250
-
251
- // Error checking
252
- if ( is_wp_error( $request ) ) {
253
- // If there is an error, reschedule transient for one day to check back again.
254
- set_transient( 'amplify_plugins_suggestions', array(), DAY_IN_SECONDS );
255
- return;
256
- }
257
-
258
- $body = wp_remote_retrieve_body( $request );
259
- if ( empty( $body ) ) {
260
- // If the $body is empty, reschedule transient for one day to check back again.
261
- set_transient( 'amplify_plugins_suggestions', array(), DAY_IN_SECONDS );
262
- return;
263
- }
264
 
265
- $body = json_decode( $body, true );
266
- if ( empty( $body ) || ! is_array( $body ) ) {
267
- // If the $body is empty or not an array, reschedule transient for one day to check back again.
268
- set_transient( 'amplify_plugins_suggestions', array(), DAY_IN_SECONDS );
269
- return;
270
- } else {
271
- // Sets a transient to only check once every week so this doesn't run constantly.
272
- set_transient( 'amplify_plugins_suggestions', $body, WEEK_IN_SECONDS );
273
- }
274
- // Update $suggestions with the new response or empty array().
275
- $suggestions = get_transient( 'amplify_plugins_suggestions' );
276
- }
277
- return $suggestions;
278
- }
279
- }
280
- AmplifyPluginsSuggestions::init();
281
  }
1
  <?php
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
 
3
+ function sfsb_add_meta_box() {
4
+ $posttypes = get_post_types(array('show_ui' => true), 'objects');
5
+ foreach($posttypes as $posttype) {
6
+ // this is to make sure the meta box is not added to certain post types
7
+ $exclude = array(
8
+ 'attachment',
9
+ 'menu',
10
+ 'modals'
11
+ );
12
+ if( !in_array( $posttype->name, $exclude ) ) {
13
+ add_meta_box('sfsb-meta-box', __('Full Screen Background Image',' simple-full-screen-background-image'), 'sfsb_show_meta_box', $posttype->name, 'side', 'high');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
14
  }
15
+ }
16
+ }
17
+ add_action('add_meta_boxes', 'sfsb_add_meta_box');
18
 
19
+ function sfsb_show_meta_box($post) {
20
+ $url = 'https://fullscreenbackgroundimages.com/downloads/full-screen-background-images-pro/?utm_source=simple-fsbgimg-editor-metabox&utm_medium=upgrade-to-pro&utm_campaign=admin';
21
+ $link = sprintf(
22
+ __( 'Want a different background image on this %s? Check out Full Screen Background Images Pro. ', 'simple-full-screen-background-image' ),
23
+ $post->post_type
24
+ );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
 
26
+ echo '<div>' . $link . '</div>';
27
+ echo '<div style="margin-top:10px;"><a target="_blank" class="button button-primary" href="' . $url . '">' . __( 'Get Full Screen Background Images Pro!', 'simple-full-screen-background-image' ) . '</a></div>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
  }
readme.txt CHANGED
@@ -5,8 +5,8 @@ Author URI: https://amplifyplugins.com
5
  Plugin URI: https://fullscreenbackgroundimages.com
6
  Tags: background, fullscreen, background image, full screen, image
7
  Requires at least: 3.6
8
- Tested up to: 5.2.2
9
- Stable tag: 1.2.6
10
 
11
  This plugin provides a simple way to set an automatically scaled full screen background image.
12
 
@@ -41,6 +41,10 @@ Learn more about the Pro version [here](https://fullscreenbackgroundimages.com/d
41
 
42
  == Changelog ==
43
 
 
 
 
 
44
  = 1.2.6 =
45
 
46
  * Updated translation file.
@@ -89,7 +93,6 @@ Learn more about the Pro version [here](https://fullscreenbackgroundimages.com/d
89
 
90
  == Upgrade Notice ==
91
 
92
- = 1.2.6 =
93
 
94
- * Updated translation file.
95
- * Added suggestions for plugins in relevant contexts.
5
  Plugin URI: https://fullscreenbackgroundimages.com
6
  Tags: background, fullscreen, background image, full screen, image
7
  Requires at least: 3.6
8
+ Tested up to: 5.4.0
9
+ Stable tag: 1.2.7
10
 
11
  This plugin provides a simple way to set an automatically scaled full screen background image.
12
 
41
 
42
  == Changelog ==
43
 
44
+ = 1.2.7 =
45
+
46
+ * Reverted plugin suggestions from v1.2.6
47
+
48
  = 1.2.6 =
49
 
50
  * Updated translation file.
93
 
94
  == Upgrade Notice ==
95
 
96
+ = 1.2.7 =
97
 
98
+ * Reverted plugin suggestions from v1.2.6
 
simple-full-screen-background.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Simple Full Screen Background Image
4
  Plugin URI: https://fullscreenbackgroundimages.com/
5
  Description: Easily set an automatically scaled full-screen background image
6
- Version: 1.2.6
7
  Author: Scott DeLuzio
8
  Author URI: https://amplifyplugins.com
9
  */
3
  Plugin Name: Simple Full Screen Background Image
4
  Plugin URI: https://fullscreenbackgroundimages.com/
5
  Description: Easily set an automatically scaled full-screen background image
6
+ Version: 1.2.7
7
  Author: Scott DeLuzio
8
  Author URI: https://amplifyplugins.com
9
  */