Code Duplication    Length = 20-20 lines in 2 locations

includes/process/gallery.php 1 location

@@ 117-136 (lines=20) @@
114
	 *
115
	 * @return array "message" key has the message.
116
	 */
117
	public function update( $data ) {
118
119
		$options      = isset( $data['fields'] ) ? $data['fields'] : false;
120
		$postid   	  = !empty( $options ) ? (int) $options['id'] : false;
121
		$gallery_ids  = isset( $data['gallery_ids'] ) ? $data['gallery_ids'] : false;
122
		if ( ! empty( $data ) && $data[ 'gallery_type' ] ) {
123
			$type = $data[ 'gallery_type' ];
124
		}elseif ( ! empty( $options ) && $options[ 'galleryType' ] ) {
125
			$type = $options[ 'galleryType' ];
126
		}else{
127
			$type = false;
128
		}
129
130
		save_gallery::save_gallery_options( $postid, $gallery_ids, $options, $type );
131
132
		return array(
133
			'message' => 'gallery-updated'
134
		);
135
136
	}
137
138
	/**
139
	 * When the user clicks the settings icon in the gallery component it

public/includes/lasso.php 1 location

@@ 755-774 (lines=20) @@
752
        exit;
753
	}
754
    
755
    public function update_gallery( ) {
756
        
757
		$options      = isset( $_POST['fields'] ) ? $_POST['fields'] : false;
758
        
759
		$postid   	  = !empty( $options ) ? (int) $options['id'] : false;
760
		$gallery_ids  = isset( $_POST['gallery_ids'] ) ? $_POST['gallery_ids'] : false;
761
		if ( $_POST[ 'gallery_type' ] ) {
762
			$type = $_POST[ 'gallery_type' ];
763
		}elseif ( ! empty( $options ) && $options[ 'galleryType' ] ) {
764
			$type = $options[ 'galleryType' ];
765
		}else{
766
			$type = false;
767
		}
768
769
		self::save_gallery_options( $postid, $gallery_ids, $options, $type );
770
771
        echo json_encode( array('message' => 'gallery-updated') );
772
773
        exit;
774
	}
775
    
776
    public function save_gallery_options( $postid, $gallery_ids, $options, $type = false ) {
777