function flickr_split_style in Flickr 7
Parse parameters to the filter from a format like: style="float:left;border:1px" into an associative array with HTML attributes and their values.
2 calls to flickr_split_style()
- theme_flickr_flickrcomslideshow in ./
flickr.module - Theme Flickr set/user/group photos as an embedded Flickr.com slideshow ('size' = x).
- theme_flickr_flickrcomslideshow_simple in ./
flickr.module - Theme Flickr set/user/group photos as an embedded Flickr.com slideshow ('size' = y).
File
- ./
flickr.inc, line 2282 - The Flickr API functions.
Code
function flickr_split_style($string) {
$attribs = array();
// Put each setting on its own line.
$string = str_replace(';', "\n", $string);
// Break them up around colons.
preg_match_all('/([a-zA-Z.]+):([-@\\/0-9a-zA-Z .\\%"\']+)/', $string, $parts, PREG_SET_ORDER);
foreach ($parts as $part) {
// Normalize to lowercase and remove extra spaces.
$name = strtolower(trim($part[1]));
$value = trim($part[2]);
// Remove undesired but tolerated characters from the value.
$value = str_replace(str_split('"\''), '', $value);
$attribs[$name] = $value;
}
return array(
$attribs,
);
}