Code Duplication    Length = 10-12 lines in 2 locations

includes/admin/shortcodes/abstract-shortcode-generator.php 1 location

@@ 297-308 (lines=12) @@
294
		$posts   = get_posts( $args );
295
		$options = array();
296
297
		if ( ! empty( $posts ) ) {
298
			foreach ( $posts as $post ) {
299
				$options[ absint( $post->ID ) ] = empty( $post->post_title )
300
					? sprintf( __( 'Untitled (#%s)', 'give' ), $post->ID )
301
					: apply_filters( 'the_title', $post->post_title );
302
			}
303
304
			$field['type']    = 'listbox';
305
			$field['options'] = $options;
306
307
			return $this->generate_listbox( $field );
308
		}
309
310
		// perform validation here before returning false
311
		$this->validate( $field );

includes/class-give-html-elements.php 1 location

@@ 150-159 (lines=10) @@
147
		}
148
149
		$options[0] = esc_html__( 'No forms found.', 'give' );
150
		if ( ! empty( $forms ) ) {
151
			$options[0] = $args['placeholder'];
152
			foreach ( $forms as $form ) {
153
				$form_title = empty( $form->post_title )
154
					? sprintf( __( 'Untitled (#%s)', 'give' ), $form->ID )
155
					: $form->post_title;
156
157
				$options[ absint( $form->ID ) ] = esc_html( $form_title );
158
			}
159
		}
160
161
		$output = $this->select( array(
162
			'name'             => $args['name'],