1<?php
2function is_allowed_media($media_list) {
3  // Now we've got the list of media this style can be applied to;
4  // check if at least one of this media types is being used by the script
5  //
6  $allowed_media = config_get_allowed_media();
7  $allowed_found = false;
8
9  // Note that media names should be case-insensitive;
10  // it is not guaranteed that $media_list contains lower-case variants,
11  // as well as it is not guaranteed that configuration data contains them.
12  // Thus, media name lists should be explicitly converted to lowercase
13  $media_list = array_map('strtolower', $media_list);
14  $allowed_media = array_map('strtolower', $allowed_media);
15
16  foreach ($media_list as $media) {
17    $allowed_found |= (array_search($media, $allowed_media) !== false);
18  };
19
20  return $allowed_found;
21}
22
23?>