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

@@ 748-808 (lines=61) @@
745
        exit;
746
	}
747
    
748
    public function save_gallery_options( $postid, $gallery_ids, $options, $type = false ) {
749
750
		// gallery width
751
		$gallery_width = isset( $options['width'] ) ? $options['width'] : false;
752
753
		// gallery grid item width
754
		$item_width = isset( $options['itemwidth'] ) ? $options['itemwidth'] : false;
755
756
		// caption
757
		$caption = isset( $options['caption'] ) ? $options['caption'] : false;
758
759
		// gallery transition
760
		$transition = isset( $options['transition'] ) ? $options['transition'] : false;
761
762
		// gallery transition speed
763
		$transitionSpeed = isset( $options['speed'] ) ? $options['speed'] : false;
764
765
		// gallery hide thumbs
766
		$hideThumbs = isset( $options['hideThumbs'] ) ? $options['hideThumbs'] : false;
767
768
		// photoset layout hardwired to on for now
769
		$psLayout = isset( $options['pslayout'] ) ? $options['pslayout'] : false;
770
771
		// photoset layout
772
		$psLightbox = 'on';//isset( $options['pslightbox'] ) ? $options['pslightbox'] : false;
773
		
774
		// hero gallery height
775
		$gallery_height = isset( $options['height'] ) ? $options['height'] : false;
776
777
		// update gallery ids
778
		if ( !empty( $gallery_ids ) ) {
779
780
			update_post_meta( $postid, '_ase_gallery_images', $gallery_ids );
781
782
		}
783
784
		update_post_meta( $postid, 'aesop_gallery_type', sanitize_text_field( trim( $type ) ) );
785
786
		update_post_meta( $postid, 'aesop_gallery_width', sanitize_text_field( trim( $gallery_width ) ) );
787
788
		update_post_meta( $postid, 'aesop_grid_gallery_width', sanitize_text_field( trim( $item_width ) ) );
789
790
		update_post_meta( $postid, 'aesop_gallery_caption', sanitize_text_field( trim( $caption ) ) );
791
792
		update_post_meta( $postid, 'aesop_thumb_gallery_transition', sanitize_text_field( trim( $transition ) ) );
793
794
		update_post_meta( $postid, 'aesop_thumb_gallery_transition_speed', absint( trim( $transitionSpeed ) ) );
795
796
		update_post_meta( $postid, 'aesop_thumb_gallery_hide_thumbs', sanitize_text_field( trim( $hideThumbs ) ) );
797
798
		update_post_meta( $postid, 'aesop_photoset_gallery_layout', sanitize_text_field( trim( $psLayout ) ) );
799
800
		update_post_meta( $postid, 'aesop_photoset_gallery_lightbox', sanitize_text_field( trim( $psLightbox ) ) );
801
		
802
		update_post_meta( $postid, 'aesop_hero_gallery_height', sanitize_text_field( trim( $gallery_height ) ) );
803
		
804
		//hardwired for now
805
		
806
		update_post_meta( $postid, 'aesop_hero_gallery_transition_speed', 300 );
807
808
	}
809
	
810
	function getEnglishMonthName($foreignMonthName){
811