Code Duplication    Length = 22-23 lines in 2 locations

modules/wordads/wordads.php 2 locations

@@ 247-268 (lines=22) @@
244
	 *
245
	 * @since 4.5.0
246
	 */
247
	function insert_ad( $content ) {
248
		// Ad JS won't work in XML feeds.
249
		if ( is_feed() ) {
250
			return $content;
251
		}
252
		/**
253
		 * Allow third-party tools to disable the display of in post ads.
254
		 *
255
		 * @module wordads
256
		 *
257
		 * @since 4.5.0
258
		 *
259
		 * @param bool true Should the in post unit be disabled. Default to false.
260
		 */
261
		$disable = apply_filters( 'wordads_inpost_disable', false );
262
		if ( ! $this->params->should_show() || $disable ) {
263
			return $content;
264
		}
265
266
		$ad_type = $this->option( 'wordads_house' ) ? 'house' : 'iponweb';
267
		return $content . $this->get_ad( 'belowpost', $ad_type );
268
	}
269
270
	/**
271
	 * Insert an inline ad into a post content
@@ 276-298 (lines=23) @@
273
	 *
274
	 * @since 6.1.0
275
	 */
276
	function insert_inline_ad( $content ) {
277
		// Ad JS won't work in XML feeds.
278
		if ( is_feed() ) {
279
			return $content;
280
		}
281
		/**
282
		 * Allow third-party tools to disable the display of in post ads.
283
		 *
284
		 * @module wordads
285
		 *
286
		 * @since 4.5.0
287
		 *
288
		 * @param bool true Should the in post unit be disabled. Default to false.
289
		 */
290
		$disable = apply_filters( 'wordads_inpost_disable', false );
291
		if ( $disable ) {
292
			return $content;
293
		}
294
295
		$ad_type = $this->option( 'wordads_house' ) ? 'house' : 'iponweb';
296
		$content .= $this->get_ad( 'inline', $ad_type );
297
		return $content;
298
	}
299
300
	/**
301
	 * Inserts ad into header