Code Duplication    Length = 61-61 lines in 2 locations

includes/save_gallery.php 1 location

@@ 15-75 (lines=61) @@
12
	/**
13
	 * Update an existing galleries options
14
	 */
15
	public static function save_gallery_options( $postid, $gallery_ids, $options, $type = false ) {
16
17
		// gallery width
18
		$gallery_width = isset( $options['width'] ) ? $options['width'] : false;
19
20
		// gallery grid item width
21
		$item_width = isset( $options['itemwidth'] ) ? $options['itemwidth'] : false;
22
23
		// caption
24
		$caption = isset( $options['caption'] ) ? $options['caption'] : false;
25
26
		// gallery transition
27
		$transition = isset( $options['transition'] ) ? $options['transition'] : false;
28
29
		// gallery transition speed
30
		$transitionSpeed = isset( $options['speed'] ) ? $options['speed'] : false;
31
32
		// gallery hide thumbs
33
		$hideThumbs = isset( $options['hideThumbs'] ) ? $options['hideThumbs'] : false;
34
35
		// photoset layout hardwired to on for now
36
		$psLayout = isset( $options['pslayout'] ) ? $options['pslayout'] : false;
37
38
		// photoset layout
39
		$psLightbox = 'on';//isset( $options['pslightbox'] ) ? $options['pslightbox'] : false;
40
		
41
		// hero gallery height
42
		$gallery_height = isset( $options['height'] ) ? $options['height'] : false;
43
44
		// update gallery ids
45
		if ( !empty( $gallery_ids ) ) {
46
47
			update_post_meta( $postid, '_ase_gallery_images', $gallery_ids );
48
49
		}
50
51
		update_post_meta( $postid, 'aesop_gallery_type', sanitize_text_field( trim( $type ) ) );
52
53
		update_post_meta( $postid, 'aesop_gallery_width', sanitize_text_field( trim( $gallery_width ) ) );
54
55
		update_post_meta( $postid, 'aesop_grid_gallery_width', sanitize_text_field( trim( $item_width ) ) );
56
57
		update_post_meta( $postid, 'aesop_gallery_caption', sanitize_text_field( trim( $caption ) ) );
58
59
		update_post_meta( $postid, 'aesop_thumb_gallery_transition', sanitize_text_field( trim( $transition ) ) );
60
61
		update_post_meta( $postid, 'aesop_thumb_gallery_transition_speed', absint( trim( $transitionSpeed ) ) );
62
63
		update_post_meta( $postid, 'aesop_thumb_gallery_hide_thumbs', sanitize_text_field( trim( $hideThumbs ) ) );
64
65
		update_post_meta( $postid, 'aesop_photoset_gallery_layout', sanitize_text_field( trim( $psLayout ) ) );
66
67
		update_post_meta( $postid, 'aesop_photoset_gallery_lightbox', sanitize_text_field( trim( $psLightbox ) ) );
68
		
69
		update_post_meta( $postid, 'aesop_hero_gallery_height', sanitize_text_field( trim( $gallery_height ) ) );
70
		
71
		//hardwired for now
72
		
73
		update_post_meta( $postid, 'aesop_hero_gallery_transition_speed', 300 );
74
75
	}
76
77
}
78

public/includes/lasso.php 1 location

@@ 668-728 (lines=61) @@
665
        exit;
666
	}
667
    
668
    public function save_gallery_options( $postid, $gallery_ids, $options, $type = false ) {
669
670
		// gallery width
671
		$gallery_width = isset( $options['width'] ) ? $options['width'] : false;
672
673
		// gallery grid item width
674
		$item_width = isset( $options['itemwidth'] ) ? $options['itemwidth'] : false;
675
676
		// caption
677
		$caption = isset( $options['caption'] ) ? $options['caption'] : false;
678
679
		// gallery transition
680
		$transition = isset( $options['transition'] ) ? $options['transition'] : false;
681
682
		// gallery transition speed
683
		$transitionSpeed = isset( $options['speed'] ) ? $options['speed'] : false;
684
685
		// gallery hide thumbs
686
		$hideThumbs = isset( $options['hideThumbs'] ) ? $options['hideThumbs'] : false;
687
688
		// photoset layout hardwired to on for now
689
		$psLayout = isset( $options['pslayout'] ) ? $options['pslayout'] : false;
690
691
		// photoset layout
692
		$psLightbox = 'on';//isset( $options['pslightbox'] ) ? $options['pslightbox'] : false;
693
		
694
		// hero gallery height
695
		$gallery_height = isset( $options['height'] ) ? $options['height'] : false;
696
697
		// update gallery ids
698
		if ( !empty( $gallery_ids ) ) {
699
700
			update_post_meta( $postid, '_ase_gallery_images', $gallery_ids );
701
702
		}
703
704
		update_post_meta( $postid, 'aesop_gallery_type', sanitize_text_field( trim( $type ) ) );
705
706
		update_post_meta( $postid, 'aesop_gallery_width', sanitize_text_field( trim( $gallery_width ) ) );
707
708
		update_post_meta( $postid, 'aesop_grid_gallery_width', sanitize_text_field( trim( $item_width ) ) );
709
710
		update_post_meta( $postid, 'aesop_gallery_caption', sanitize_text_field( trim( $caption ) ) );
711
712
		update_post_meta( $postid, 'aesop_thumb_gallery_transition', sanitize_text_field( trim( $transition ) ) );
713
714
		update_post_meta( $postid, 'aesop_thumb_gallery_transition_speed', absint( trim( $transitionSpeed ) ) );
715
716
		update_post_meta( $postid, 'aesop_thumb_gallery_hide_thumbs', sanitize_text_field( trim( $hideThumbs ) ) );
717
718
		update_post_meta( $postid, 'aesop_photoset_gallery_layout', sanitize_text_field( trim( $psLayout ) ) );
719
720
		update_post_meta( $postid, 'aesop_photoset_gallery_lightbox', sanitize_text_field( trim( $psLightbox ) ) );
721
		
722
		update_post_meta( $postid, 'aesop_hero_gallery_height', sanitize_text_field( trim( $gallery_height ) ) );
723
		
724
		//hardwired for now
725
		
726
		update_post_meta( $postid, 'aesop_hero_gallery_transition_speed', 300 );
727
728
	}
729
	
730
	function getEnglishMonthName($foreignMonthName){
731