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

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