Code Duplication    Length = 13-13 lines in 3 locations

includes/class-wp-fields-api-screen.php 1 location

@@ 245-257 (lines=13) @@
242
	 *
243
	 * @return bool False if theme doesn't support the screen or user can't change screen, otherwise true.
244
	 */
245
	public function check_capabilities() {
246
247
		if ( $this->capability && ! call_user_func_array( 'current_user_can', (array) $this->capability ) ) {
248
			return false;
249
		}
250
251
		if ( $this->theme_supports && ! call_user_func_array( 'current_theme_supports', (array) $this->theme_supports ) ) {
252
			return false;
253
		}
254
255
		return true;
256
257
	}
258
259
	/**
260
	 * Get the screen's content template for insertion into the Fields API screen.

includes/class-wp-fields-api-section.php 1 location

@@ 266-278 (lines=13) @@
263
	 *
264
	 * @return bool False if theme doesn't support the section or user can't change section, otherwise true.
265
	 */
266
	public function check_capabilities() {
267
268
		if ( $this->capability && ! call_user_func_array( 'current_user_can', (array) $this->capability ) ) {
269
			return false;
270
		}
271
272
		if ( $this->theme_supports && ! call_user_func_array( 'current_theme_supports', (array) $this->theme_supports ) ) {
273
			return false;
274
		}
275
276
		return true;
277
278
	}
279
280
	/**
281
	 * Get the section's content template for insertion into the Fields UI.

includes/class-wp-fields-api-field.php 1 location

@@ 482-494 (lines=13) @@
479
	 *
480
	 * @return bool False if theme doesn't support the section or user can't change section, otherwise true.
481
	 */
482
	public function check_capabilities() {
483
484
		if ( $this->capability && ! call_user_func_array( 'current_user_can', (array) $this->capability ) ) {
485
			return false;
486
		}
487
488
		if ( $this->theme_supports && ! call_user_func_array( 'current_theme_supports', (array) $this->theme_supports ) ) {
489
			return false;
490
		}
491
492
		return true;
493
494
	}
495
496
	/**
497
	 * Multidimensional helper function.