Code Duplication    Length = 9-11 lines in 3 locations

src/wp-includes/class-wp-customize-section.php 1 location

@@ 262-272 (lines=11) @@
259
	 *
260
	 * @return bool False if theme doesn't support the section or user doesn't have the capability.
261
	 */
262
	final public function check_capabilities() {
263
		if ( $this->capability && ! call_user_func_array( 'current_user_can', (array) $this->capability ) ) {
264
			return false;
265
		}
266
267
		if ( $this->theme_supports && ! call_user_func_array( 'current_theme_supports', (array) $this->theme_supports ) ) {
268
			return false;
269
		}
270
271
		return true;
272
	}
273
274
	/**
275
	 * Get the section's content for insertion into the Customizer pane.

src/wp-includes/class-wp-customize-panel.php 1 location

@@ 243-253 (lines=11) @@
240
	 *
241
	 * @return bool False if theme doesn't support the panel or the user doesn't have the capability.
242
	 */
243
	final public function check_capabilities() {
244
		if ( $this->capability && ! call_user_func_array( 'current_user_can', (array) $this->capability ) ) {
245
			return false;
246
		}
247
248
		if ( $this->theme_supports && ! call_user_func_array( 'current_theme_supports', (array) $this->theme_supports ) ) {
249
			return false;
250
		}
251
252
		return true;
253
	}
254
255
	/**
256
	 * Get the panel's content template for insertion into the Customizer pane.

src/wp-includes/class-wp-customize-setting.php 1 location

@@ 835-843 (lines=9) @@
832
	 *
833
	 * @return bool False if theme doesn't support the setting or user can't change setting, otherwise true.
834
	 */
835
	final public function check_capabilities() {
836
		if ( $this->capability && ! call_user_func_array( 'current_user_can', (array) $this->capability ) )
837
			return false;
838
839
		if ( $this->theme_supports && ! call_user_func_array( 'current_theme_supports', (array) $this->theme_supports ) )
840
			return false;
841
842
		return true;
843
	}
844
845
	/**
846
	 * Multidimensional helper function.