Changeset 1064293
- Timestamp:
- 01/10/2015 12:15:35 AM (11 years ago)
- Location:
- jellyfish-backdrop/trunk
- Files:
-
- 3 edited
-
admin.php (modified) (1 diff)
-
jellyfish-backdrop.php (modified) (3 diffs)
-
readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
jellyfish-backdrop/trunk/admin.php
r1050715 r1064293 193 193 function define_post_metabox() { 194 194 // Add custom post meta box 195 require_once("meta-box-class/my-meta-box-class.php");196 195 $jb_prefix = '_jellyfish_backdrop_'; 197 196 $options = get_option( 'jellyfish_backdrop' ); 198 $post_types = array_keys($options['use_postmeta'], true); 199 200 $jb_config = array( 201 'id' => 'jellyfish_backdrop', 202 'title' => __('Backdrop Slideshow', 'jellyfish-backdrop'), 203 'pages' => $post_types, 204 'context' => 'normal', 205 'priority' => 'high', 206 'fields' => array(), 207 'local_images' => false, 208 'use_with_theme' => false 209 ); 210 211 $jb_meta = new AT_Meta_Box($jb_config); 212 213 $jb_meta->add_text('_jellyfish_backdrop_container', 214 array( 215 'name'=> __('Containing Element', 'jellyfish-backdrop'), 216 'desc' => __('id or class of a page element to place the images in, defaults to body (full page)', 'jellyfish-backdrop'), 217 'std' => $options['container'], 218 'class' => 'regular-text' 219 ) 220 ); 221 222 $jb_meta->add_slider('_jellyfish_backdrop_slide_duration', 223 array( 224 'name'=> __('Slide Duration', 'jellyfish-backdrop'), 225 'desc' => __('How long to show each image (in seconds)', 'jellyfish-backdrop'), 226 'std' => $options['slide_duration'], 227 'min' => '0', 228 'max' => '30', 229 'step' => '0.1', 230 'class' => '' 231 ) 232 ); 233 234 $jb_meta->add_slider('_jellyfish_backdrop_fade_speed', 235 array( 236 'name'=> __('Fade Speed', 'jellyfish-backdrop'), 237 'desc' => __('Speed of fade between images (in seconds)', 'jellyfish-backdrop'), 238 'std' => $options['fade_speed'], 239 'min' => '0', 240 'max' => '5', 241 'step' => '0.01', 242 'class' => '' 243 ) 244 ); 245 246 $jb_repeater_fields[] = $jb_meta->add_image('_jellyfish_backdrop_image', 247 array( 248 'name'=> '', 249 'size' => 'thumbnail', 250 'hide_remove' => true 251 ), 252 true 253 ); 254 255 $jb_meta->add_repeater_block('_jellyfish_backdrop_images', 256 array( 257 'name' => __('Background Images', 'jellyfish-backdrop'), 258 'fields' => $jb_repeater_fields, 259 'inline' => true, 260 'sortable' => true 261 ) 262 ); 263 264 $jb_meta->finish(); 197 if (! empty($options['use_postmeta'])) { 198 require_once("meta-box-class/my-meta-box-class.php"); 199 $post_types = array_keys((array)$options['use_postmeta'], true); 200 201 $jb_config = array( 202 'id' => 'jellyfish_backdrop', 203 'title' => __('Backdrop Slideshow', 'jellyfish-backdrop'), 204 'pages' => $post_types, 205 'context' => 'normal', 206 'priority' => 'high', 207 'fields' => array(), 208 'local_images' => false, 209 'use_with_theme' => false 210 ); 211 212 $jb_meta = new AT_Meta_Box($jb_config); 213 214 $jb_meta->add_text('_jellyfish_backdrop_container', 215 array( 216 'name'=> __('Containing Element', 'jellyfish-backdrop'), 217 'desc' => __('id or class of a page element to place the images in, defaults to body (full page)', 'jellyfish-backdrop'), 218 'std' => $options['container'], 219 'class' => 'regular-text' 220 ) 221 ); 222 223 $jb_meta->add_slider('_jellyfish_backdrop_slide_duration', 224 array( 225 'name'=> __('Slide Duration', 'jellyfish-backdrop'), 226 'desc' => __('How long to show each image (in seconds)', 'jellyfish-backdrop'), 227 'std' => $options['slide_duration'], 228 'min' => '0', 229 'max' => '30', 230 'step' => '0.1', 231 'class' => '' 232 ) 233 ); 234 235 $jb_meta->add_slider('_jellyfish_backdrop_fade_speed', 236 array( 237 'name'=> __('Fade Speed', 'jellyfish-backdrop'), 238 'desc' => __('Speed of fade between images (in seconds)', 'jellyfish-backdrop'), 239 'std' => $options['fade_speed'], 240 'min' => '0', 241 'max' => '5', 242 'step' => '0.01', 243 'class' => '' 244 ) 245 ); 246 247 $jb_repeater_fields[] = $jb_meta->add_image('_jellyfish_backdrop_image', 248 array( 249 'name'=> '', 250 'size' => 'thumbnail', 251 'hide_remove' => true 252 ), 253 true 254 ); 255 256 $jb_meta->add_repeater_block('_jellyfish_backdrop_images', 257 array( 258 'name' => __('Background Images', 'jellyfish-backdrop'), 259 'fields' => $jb_repeater_fields, 260 'inline' => true, 261 'sortable' => true 262 ) 263 ); 264 265 $jb_meta->finish(); 266 } 265 267 } 266 268 267 269 function validate_options( $input ) { 268 270 // return array of valid options 269 $valid['url'] = esc_url( $input['url'] );270 $valid['id'] = intval( $input['id'] );271 $valid['container'] = wp_filter_nohtml_kses( $input['container'] );271 $valid['url'] = esc_url( $input['url'] ); 272 $valid['id'] = intval( $input['id'] ); 273 $valid['container'] = wp_filter_nohtml_kses( $input['container'] ); 272 274 if (is_numeric($input['slide_duration']) && ($input['slide_duration'] > 0)) 273 $valid['slide_duration'] = sanitize_text_field($input['slide_duration']);275 $valid['slide_duration'] = sanitize_text_field($input['slide_duration']); 274 276 if (is_numeric($input['fade_speed']) && ($input['fade_speed'] >= 0)) 275 $valid['fade_speed'] = sanitize_text_field($input['fade_speed']);276 foreach ( $input['use_postmeta'] as $key => $value) {277 $valid['fade_speed'] = sanitize_text_field($input['fade_speed']); 278 foreach ((array)$input['use_postmeta'] as $key => $value) { 277 279 $valid['use_postmeta'][$key] = ($value == true) ? true : false; 278 280 } -
jellyfish-backdrop/trunk/jellyfish-backdrop.php
r1050715 r1064293 5 5 Description: Add fullscreen background images and background slideshows to any WordPress page element. 6 6 Author: Robert Miller <rob@strawberryjellyfish.com> 7 Version: 0.6. 57 Version: 0.6.6 8 8 Author URI: http://strawberryjellyfish.com/ 9 9 */ … … 65 65 66 66 } elseif ($current_post_type) { 67 if ( (array_key_exists($current_post_type, $options['use_postmeta']) && $options['use_postmeta'][$current_post_type] == true )67 if ( (array_key_exists($current_post_type, (array)$options['use_postmeta']) && $options['use_postmeta'][$current_post_type] == true ) 68 68 && ( is_single() or is_page() ) 69 69 && ( get_post_meta( get_the_ID(), '_jellyfish_backdrop_images', true ) ) ) { … … 95 95 $current_post_type = get_post_type( get_the_ID() ); 96 96 97 if ( (array_key_exists($current_post_type, $options['use_postmeta'])97 if ( (array_key_exists($current_post_type, (array)$options['use_postmeta']) 98 98 && $options['use_postmeta'][$current_post_type] == true ) 99 99 && ( is_single() or is_page() ) ) { -
jellyfish-backdrop/trunk/readme.txt
r1050717 r1064293 7 7 Requires at least: 3.0 8 8 Tested up to: 4.1 9 Stable tag: 0.6. 59 Stable tag: 0.6.6 10 10 License: GPLv2 or later 11 11 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 106 106 == Changelog == 107 107 108 = 0.6.6 = 109 * Bugfix: Fixed error caused by missing settings introduced in 0.6.5. 110 (Plugin was broken for new installs, thanks to peckjon for pointing this out) 111 108 112 = 0.6.5 = 109 113 * Added ability to select which post types to allow slideshows on,
Note: See TracChangeset
for help on using the changeset viewer.