function &create($data) { $edge =& new EdgePDF(); $edge->width = $data['width']; $edge->color =& new Color($data['color'], is_transparent($data['color'])); $edge->style = $data['style']; $edge->_isDefaultColor = true; return $edge; }
function parse($value) { $terms = preg_split("/(?![,(\\s])\\s+/ ", $value); // Note that color declaration always will contain only one word; // thus, we can split out value into words and try to parse each one as color // if parse_color_declaration returns transparent value, it is possible not // a color part of background declaration foreach ($terms as $term) { $color = parse_color_declaration($term, array(-1, -1, -1)); if (!is_transparent($color)) { return new Color($color, false); } } return CSSBackgroundColor::default_value(); }
function &parse_color_declaration($decl) { $color = _parse_color_declaration($decl, $success); $color_obj =& new Color($color, is_transparent($color)); return $color_obj; }
} } else { if ($refhost != ALLOWED_DOMAIN) { err('DISALLOWED_DOMAIN'); } } } $fonts_dir = str_replace('\\', '/', realpath(FONTS_DIR . '/')); if (substr($fonts_dir, -1) != '/') { $fonts_dir .= '/'; } $FLIR = array(); $FStyle = preg_match('#^\\{("[\\w]+":"[^"]*",?)*\\}$#i', $_GET['fstyle']) ? json_decode($_GET['fstyle'], true) : array(); $FLIR['mode'] = isset($FStyle['mode']) ? $FStyle['mode'] : ''; $FLIR['output'] = isset($FStyle['output']) ? $FStyle['output'] == 'jpeg' ? 'jpg' : $FStyle['output'] : 'auto'; $FLIR['bkg_transparent'] = is_transparent($FStyle['cBackground']); if ($FLIR['output'] == 'auto') { $FLIR['output'] = $FLIR['bkg_transparent'] ? 'png' : 'gif'; } // format not supported, fall back to png if ($FLIR['output'] == 'gif' && !function_exists('imagegif') || $FLIR['output'] == 'jpg' && !function_exists('imagejpeg')) { $FLIR['output'] = 'png'; } $FLIR['dpi'] = preg_match('#^[0-9]+$#', $FStyle['dpi']) ? $FStyle['dpi'] : 96; $FLIR['size'] = is_number($FStyle['cSize'], true) ? $FStyle['cSize'] : UNKNOWN_FONT_SIZE; // pixels $FLIR['size_pts'] = ENABLE_FONTSIZE_BUG ? $FLIR['size'] : get_points($FLIR['dpi'], $FLIR['size']); $FLIR['maxheight'] = is_number($_GET['h']) ? $_GET['h'] : UNKNOWN_FONT_SIZE; // pixels $FLIR['maxwidth'] = is_number($_GET['w']) ? $_GET['w'] : 800; // pixels
function EdgePDF($edge) { $this->_width = units2pt($edge['width']); $this->color = new Color($edge['color'], is_transparent($edge['color'])); $this->style = $edge['style']; }
function parse($value) { $old_color = $this->get(); $color = parse_color_declaration($value, array($old_color->r, $old_color->g, $old_color->b)); return new Color($color, is_transparent($color)); }
} } } $fonts_dir = str_replace('\\', '/', realpath(FONTS_DIR . '/')); // fix FONTS_DIR path if (substr($fonts_dir, -1) != '/') { $fonts_dir .= '/'; } // Grab the CSS settings being passed with request $CSS = parse_css_codes($_GET['c']); $FLIR = array(); $passed_fstyle = preg_match('#^\\{("[\\w]+":"?[^"]*"?,?)*\\}$#i', $_GET['f']) ? json_decode($_GET['f'], true) : array(); $FStyle = array_merge($Default_FLIRStyle_Values, $passed_fstyle); $FLIR['mode'] = isset($FStyle['mode']) && preg_match('#^[a-z0-9_-]+$#i', $FStyle['mode']) ? $FStyle['mode'] : ''; $FLIR['output'] = isset($FStyle['output']) ? $FStyle['output'] : 'png'; $FLIR['bkg_transparent'] = is_transparent($CSS['background-color']); if ($FLIR['output'] == 'auto') { $FLIR['output'] = $FLIR['bkg_transparent'] ? 'png' : 'gif'; } // format not supported, fall back to png if ($FLIR['output'] == 'gif' && !function_exists('imagegif')) { $FLIR['output'] = 'png'; } $FLIR['dpi'] = preg_match('#^\\d+$#', $_GET['d']) ? $_GET['d'] : 96; if ($FStyle['hq'] == 'true') { $FLIR['dpi'] /= 2; } $FLIR['size'] = is_number($CSS['font-size'], true) ? $CSS['font-size'] : UNKNOWN_FONT_SIZE; // pixels $FLIR['size_pts'] = get_points($FLIR['dpi'], $FLIR['size']); $FLIR['maxheight'] = is_number($_GET['h']) ? $_GET['h'] : UNKNOWN_FONT_SIZE;