You are here

public function SassExtentionsCompassFunctionsInlineData::inline_font_files in Sassy 7

File

phamlp/sass/extensions/compass/functions/inlineData.php, line 26

Class

SassExtentionsCompassFunctionsInlineData
Compass extension SassScript inline data functions class. A collection of functions for use in SassSCript. @package PHamlP @subpackage Sass.extensions.compass.functions

Code

public function inline_font_files() {
  if (func_num_args() % 2) {
    throw new SassScriptFunctionException('An even number of arguments must be passed to inline_font_files()', array(), SassScriptParser::$context->node);
  }
  $args = func_get_args();
  $files = array();
  while ($args) {
    $path = array_shift($args);
    $real_path = SassExtentionsCompassConfig::config('fonts_path') . DIRECTORY_SEPARATOR . $path->value;
    $fp = fopen($real_path, 'rb');
    $url = 'url(data:' . self::compute_mime_type($path) . ';base64,' . self::data($real_path) . ')';
    $files[] = "{$url} format('" . array_shift($args) . "')";
  }
  return new SassString(join(", ", $files));
}