function fonts_com_filter_choices in @font-your-face 7.2
Returns filter choices, refreshed periodically.
1 call to fonts_com_filter_choices()
- fonts_com_browse_form in modules/
fonts_com/ fonts_com.module - Shows browse filters and results.
1 string reference to 'fonts_com_filter_choices'
- fonts_com_uninstall in modules/
fonts_com/ fonts_com.install - Implements hook_uninstall().
File
- modules/
fonts_com/ fonts_com.module, line 1352
Code
function fonts_com_filter_choices($current_filters = FALSE) {
if (!$current_filters) {
$choices = variable_get('fonts_com_filter_choices', array());
if (!isset($choices['updated']) || REQUEST_TIME - $choices['updated'] > 4 * 60 * 60) {
module_load_include('inc', 'fonts_com', 'api');
$options = fonts_com_get_all_filter_choices(array(
'wfsfreeorpaid' => '-1',
));
$choices['filters'] = $options + array(
'Designer' => array(),
'Foundry' => array(),
'Classification' => array(),
'Language' => array(),
'Alpha' => array(),
'FreeOrPaid' => array(),
);
$choices['updated'] = REQUEST_TIME;
variable_set('fonts_com_filter_choices', $choices);
}
// if
return $choices['filters'];
}
else {
// Fonts.com doesn't use consistant names in the API. :|
$filter_map = array(
'wfsLangId' => 'wfslanguageid',
'wfsClassId' => 'wfsclassificationid',
'wfsDesignerId' => 'wfsdesignerid',
'wfsFountryId' => 'wfsfoundryid',
'wfsAlphabet' => 'wfsalphachar',
'wfsfree' => 'wfsfreeorpaid',
);
$filters = array();
foreach ($current_filters as $key => $value) {
if (isset($filter_map[$key])) {
$filters[$filter_map[$key]] = $value;
}
// if
}
// foreach
if (count($filters) > 0) {
module_load_include('inc', 'fonts_com', 'api');
$options = fonts_com_get_all_filter_choices($filters);
return $options + array(
'Designer' => array(),
'Foundry' => array(),
'Classification' => array(),
'Language' => array(),
'Alpha' => array(),
'FreeOrPaid' => array(),
);
}
else {
return fonts_com_filter_choices();
}
// else
}
// else
}