Example #1
0
<?php

if (!defined('BASEPATH')) {
    exit('No direct script access allowed');
}
/**
 * Inline SVG Plugin
 *
 * @category    Plugin
 */
$plugin_info = array('pi_name' => 'Inline SVG', 'pi_version' => '1.0', 'pi_author' => 'Jamie Blacker', 'pi_author_url' => 'http://amitywebsolutions.co.uk', 'pi_description' => 'Inline an svg file', 'pi_usage' => Inline::usage());
class Inline
{
    // PREPARE VARS
    public $return_data;
    /**
     * Constructor
     */
    public function __construct()
    {
        $this->EE =& get_instance();
        // Get folder from config
        $folder = $this->EE->config->item('svg_folder');
        // Only proceed if folder is set
        if ($folder !== FALSE) {
            $filename = trim($this->EE->TMPL->fetch_param('file'));
            // Fail silently with @
            $svg_file = @file_get_contents($folder . $filename);
            return $svg_file;
        } else {
            // Log error and do nothing