Code Duplication    Length = 13-15 lines in 2 locations

src/wp-includes/bookmark.php 1 location

@@ 71-85 (lines=15) @@
68
 * @param string $context Optional. The context of how the field will be used.
69
 * @return string|WP_Error
70
 */
71
function get_bookmark_field( $field, $bookmark, $context = 'display' ) {
72
	$bookmark = (int) $bookmark;
73
	$bookmark = get_bookmark( $bookmark );
74
75
	if ( is_wp_error($bookmark) )
76
		return $bookmark;
77
78
	if ( !is_object($bookmark) )
79
		return '';
80
81
	if ( !isset($bookmark->$field) )
82
		return '';
83
84
	return sanitize_bookmark_field($field, $bookmark->$field, $bookmark->link_id, $context);
85
}
86
87
/**
88
 * Retrieves the list of bookmarks

src/wp-includes/taxonomy.php 1 location

@@ 950-962 (lines=13) @@
947
 * @param string      $context  Optional, default is display. Look at sanitize_term_field() for available options.
948
 * @return string|int|null|WP_Error Will return an empty string if $term is not an object or if $field is not set in $term.
949
 */
950
function get_term_field( $field, $term, $taxonomy = '', $context = 'display' ) {
951
	$term = get_term( $term, $taxonomy );
952
	if ( is_wp_error($term) )
953
		return $term;
954
955
	if ( !is_object($term) )
956
		return '';
957
958
	if ( !isset($term->$field) )
959
		return '';
960
961
	return sanitize_term_field( $field, $term->$field, $term->term_id, $term->taxonomy, $context );
962
}
963
964
/**
965
 * Sanitizes Term for editing.