Advertisements

sanitize_bookmark

Definition:
function sanitize_bookmark($bookmark, $context = 'display') {}

Sanitizes all bookmark fields

Parameters

  • object|array $bookmark: Bookmark row
  • string $context: Optional, default is ‘display’. How to filter the fields

Return values

returns:Same type as $bookmark but with fields sanitized.

Source code

function sanitize_bookmark($bookmark, $context = 'display') {

	$fields = array('link_id', 'link_url', 'link_name', 'link_image', 'link_target', 'link_category',

		'link_description', 'link_visible', 'link_owner', 'link_rating', 'link_updated',

		'link_rel', 'link_notes', 'link_rss', );



	if ( is_object($bookmark) ) {

		$do_object = true;

		$link_id = $bookmark->link_id;

	} else {

		$do_object = false;

		$link_id = $bookmark['link_id'];

	}



	foreach ( $fields as $field ) {

		if ( $do_object ) {

			if ( isset($bookmark->$field) )

				$bookmark->$field = sanitize_bookmark_field($field, $bookmark->$field, $link_id, $context);

		} else {

			if ( isset($bookmark[$field]) )

				$bookmark[$field] = sanitize_bookmark_field($field, $bookmark[$field], $link_id, $context);

		}

	}



	return $bookmark;

}

2759

Advertisements

No comments yet... Be the first to leave a reply!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: