public function testSvgComponents() { $svg = new Svg(100, 100); $svg->add(new Path(array(array(0, 0), array(100, 0)))); $svg->add(new Path(array(array(0, 100), array(100, 100)), array('class' => 'testing'))); $this->assertEquals('<?xml version="1.0" encoding="UTF-8"?><svg xmlns="http://www.w3.org/2000/svg" width="100" height="100"><path class="path" d="M0,0L100,0"></path><path class="testing" d="M0,100L100,100"></path></svg>', $svg->render()); }
/** * @dataProvider childrenProvider */ public function testSvg($width, $height, $children, $result) { $svg = new Svg($width, $height); foreach ($children as $child) { $svg->addChild($child); } $this->assertEquals($result, (string) $svg); }
private function createRightEarBar() { $svg = new Svg(); $earRect = new Polygon(); $earTriangl = new Polygon(); $svg->addChild($earRect); $svg->addChild($earTriangl); $mainSpan = new Span(); $mainSpan->addChild($svg); $mainSpan->addStyleClass("right_ear"); $earTriangl->addAttribute("points", "0,0 0,10 10,10"); $earTriangl->addAttribute("style", "stroke:#ade681; fill:#ade681; stroke-width: 1;"); $earRect->addAttribute("points", "0,10 10,10 10,40 0,40"); $earRect->addAttribute("style", "stroke:#88cc55; fill:#88cc55; stroke-width: 1;"); return $mainSpan; }
protected function drawBodyLabel($x, $y, $options) { if (isset($options['labelGrahaFont'])) { $this->Renderer->setOptions($options['labelGrahaFont']); } $bodyLabelPoints = $this->Chakra->getBodyLabelPoints($this->options); foreach ($bodyLabelPoints as $body => $point) { if (!array_key_exists($body, Graha::$graha) && isset($options['labelExtraFont'])) { $this->Renderer->setOptions($options['labelExtraFont']); } $bodyLabel = $this->getBodyLabel($body, ['labelGrahaType' => $this->options['labelGrahaType'], 'labelGrahaCallback' => $this->options['labelGrahaCallback']]); $this->Renderer->drawText($bodyLabel, $point['x'] + $x, $point['y'] + $y, ['textAlign' => $point['textAlign'], 'textValign' => $point['textValign']]); } }
/** * Creates and returns an Buildable absolute condition element. * * @access public * @return Hoathis\Regex\Visitor\Buildable */ public function createAbsoluteCondition() { $condition = new Svg(); $condition->setHorizontalLayout(); $condition->addCondition(); return $condition; }
/** * Render the drawing with correct headers. * * @return mixed */ public function render() { $this->Renderer->render(); }
<?php if (!defined('BASEPATH')) { exit('No direct script access allowed'); } /** * MC SVG Icon Plugin * * @category Plugin * @author Michael C. * @link http://www.pro-image.co.il */ $plugin_info = array('pi_name' => 'MC SVG Icons', 'pi_version' => '1.1.0', 'pi_author' => 'Michael C.', 'pi_author_url' => 'http://www.pro-image.co.il', 'pi_description' => 'Simple plugin to enable easy use of external SVG icons in EE2.', 'pi_usage' => Svg::usage()); class Svg { // PREPARE VARS public $return_data; /** * Constructor */ public function __construct() { $this->EE =& get_instance(); // SVG Motherfile $file = trim($this->EE->TMPL->fetch_param('file')); // Use specified 'file' parameter override if ($file) { $icon_svg_file = $file; } elseif ($this->EE->config->item('icon_svg_file') !== false) { $icon_svg_file = $this->EE->config->item('icon_svg_file'); } else {
/** * Returns the user's QR code. * @route my/account/2-factor/qr-code * */ public function twoFactorSetupQRCode() { if (!$this->isLoggedIn()) { \Airship\redirect($this->airship_cabin_prefix); } $gauth = $this->twoFactorPreamble(); $user = $this->acct->getUserAccount($this->getActiveUserId()); if (\extension_loaded('gd')) { \header('Content-Type: image/png'); $writer = null; } else { $renderer = new Svg(); $renderer->setHeight(384); $renderer->setWidth(384); $writer = new QRCodeWriter($renderer); $this->airship_lens_object->sendStandardHeaders('image/svg+xml'); } $gauth->makeQRCode($writer, 'php://output', $user['username'] . '@' . $_SERVER['HTTP_HOST'], $this->config('two-factor.issuer') ?? '', $this->config('two-factor.label') ?? ''); }