You are here

function _media_gallery_sanitize_ids in Media Gallery 7

Same name and namespace in other branches
  1. 7.2 media_gallery.pages.inc \_media_gallery_sanitize_ids()

Helper function for media_gallery_ajax_sort() that sanitizes a list of IDs.

Removes a string such as 'node-' from each item in an array, leaving only a numeric ID.

Parameters

string $prefix: The prefix to remove from each ID in the list.

array $list: The list of IDs.

Return value

array The list of sanitized IDs.

1 call to _media_gallery_sanitize_ids()
media_gallery_ajax_sort in ./media_gallery.pages.inc
AJAX callback for drag-and-drop gallery sorting.

File

./media_gallery.pages.inc, line 203
Common pages for the Media Gallery module.

Code

function _media_gallery_sanitize_ids($prefix, $list) {
  foreach ($list as &$value) {
    $value = intval(str_replace($prefix, '', $value));
  }
  return $list;
}