function swftools_get_methods in SWF Tools 6.3
Collects information from all modules about the players and embedding methods available.
Parameters
string $action: Optional parameter to retrieve data only about a specific method.
bool $reset: Optional parameter which if TRUE will reset the method cache and rebuild it.
Return value
array An array of data describing the available methods.
9 calls to swftools_get_methods()
- swf in ./
swftools.module - Processes a file, or an array of files, and returns the relevant mark-up to render a Flash based player.
- swftools_admin_embed_form in includes/
swftools.admin.inc - Form definition for embedding settings.
- swftools_admin_generic_form in includes/
swftools.genericplayers.inc - Returns the generic player administration form.
- swftools_menu in ./
swftools.module - Implementation of hook_menu().
- swftools_profiles_menu in profiles/
swftools_profiles.module - Implementation of hook_menu().
File
- includes/
swftools.core.inc, line 261 - Implements SWF Tools core functions that are common to the main module and the API module.
Code
function swftools_get_methods($action = NULL, $reset = FALSE) {
// Cache methods array as it may be called several times
static $methods;
// If user has requested the cache to be reset then reset it
if ($reset || !isset($methods)) {
if (!$reset && ($cached = cache_get('swftools:methods'))) {
$methods = $cached->data;
}
else {
$methods = array();
foreach (module_implements('swftools_methods') as $module) {
$function = $module . '_swftools_methods';
if (function_exists($function)) {
$implements = $function();
foreach ($implements as $method_type => $method) {
foreach ($method as $method_name => $method_details) {
$method_details += array(
'name' => $method_name,
'module' => '',
'title' => '',
'download' => '',
'library' => '',
'profile' => array(),
);
if ($method_type == 'swftools_embed_method') {
$method_details += array(
'theme' => $method_name,
);
}
else {
$method_details += array(
'version' => 7,
);
}
$methods[$method_type][$method_name] = $method_details;
}
}
}
}
cache_set('swftools:methods', $methods);
}
}
// In case no module is presenting a method for the required action the following line avoids a notice error
if ($action) {
$methods += array(
$action => NULL,
);
}
// Return results - either for the specific action, or the whole array
return $action ? $methods[$action] : $methods;
}