function rrssb_calc_css in Ridiculously Responsive Social Sharing Buttons 8.2
Calculate CSS for the specified buttons.
2 calls to rrssb_calc_css()
- drush_rrssb_gen_css in includes/
rrssb.drush.inc - Implementation of drush_hook_COMMAND().
- rrssb_gen_css in ./
rrssb.module - Auto-generate CSS for buttons.
File
- ./
rrssb.module, line 365
Code
function rrssb_calc_css($buttons) {
$css = '';
foreach ($buttons as $name => $button) {
// Add a white fill.
$svg = str_replace('<path ', '<path fill="#FFF" ', $button['svg']);
// URL encode - only certain special characters are needed: <>#" and " can be safely swapped for '.
$svg = strtr($svg, [
'<' => '%3C',
'>' => '%3E',
'#' => '%23',
'"' => '\'',
]);
$css .= <<<EOM
.rrssb-buttons li.rrssb-{<span class="php-variable">$name</span>} a { background-color: {<span class="php-variable">$button</span>[<span class="php-string">'color'</span>]}; }
.rrssb-buttons li.rrssb-{<span class="php-variable">$name</span>} a:hover { background-color: {<span class="php-variable">$button</span>[<span class="php-string">'color_hover'</span>]}; }
.rrssb-{<span class="php-variable">$name</span>} .rrssb-icon { background: url("data:image/svg+xml,{<span class="php-variable">$svg</span>}"); }
EOM;
}
return $css;
}