function swftools_wijering4_autocomplete_skin in SWF Tools 6.3
Autocompleter to suggest possible skin names.
Parameters
string $string: The partial name of the skin.
Return value
array An array of possible matches.
1 string reference to 'swftools_wijering4_autocomplete_skin'
- swftools_wijering4_menu in wijering4/
swftools_wijering4.module - Implementation of hook_menu().
File
- wijering4/
swftools_wijering4.admin.inc, line 72 - Configuration settings for LongTail JW Player 4.
Code
function swftools_wijering4_autocomplete_skin($string = '') {
// Only do something if there is a string to be matched
if ($string) {
// Scan the mediaplayer4/skins directory for swf files
$skins = file_scan_directory(swftools_get_library('mediaplayer4') . '/skins', '\\.swf$');
// Build an array skin names
$possible_values = array();
foreach ($skins as $skin) {
$possible_values[] = $skin->basename;
}
// Find matches
$matches = array();
foreach ($possible_values as $value) {
if (preg_match("/{$string}/i", $value)) {
$matches[$value] = $value;
}
}
print drupal_json($matches);
}
}