Пример #1
0
 /**
  * Class constructor
  *
  * @param   array  $options  Associative array of options
  *
  * @since  11.1
  */
 public function __construct($options = array())
 {
     parent::__construct($options);
     // Set document type
     $this->_type = 'opensearch';
     // Set mime type
     $this->_mime = 'application/opensearchdescription+xml';
     // Add the URL for self updating
     $update = new JOpenSearchUrl();
     $update->type = 'application/opensearchdescription+xml';
     $update->rel = 'self';
     $update->template = JRoute::_(JUri::getInstance());
     $this->addUrl($update);
     // Add the favicon as the default image
     // Try to find a favicon by checking the template and root folder
     $app = JFactory::getApplication();
     $dirs = array(JPATH_THEMES . '/' . $app->getTemplate(), JPATH_BASE);
     foreach ($dirs as $dir) {
         if (file_exists($dir . '/favicon.ico')) {
             $path = str_replace(JPATH_BASE . '/', '', $dir);
             $path = str_replace('\\', '/', $path);
             $favicon = new JOpenSearchImage();
             $favicon->data = JUri::base() . $path . '/favicon.ico';
             $favicon->height = '16';
             $favicon->width = '16';
             $favicon->type = 'image/vnd.microsoft.icon';
             $this->addImage($favicon);
             break;
         }
     }
 }
Пример #2
0
 /**
  * Class constructor
  *
  * @param   array  $options  Associative array of options
  */
 public function __construct($options = array())
 {
     parent::__construct($options);
     //set mime type
     $this->_mime = 'text/html';
     //set document type
     $this->_type = 'raw';
 }
Пример #3
0
 /**
  * Class constructor
  *
  * @param   array  $options  Associative array of options
  *
  * @since   11.1
  */
 public function __construct($options = array())
 {
     parent::__construct($options);
     //set mime type
     $this->_mime = 'application/xml';
     //set document type
     $this->_type = 'xml';
 }
Пример #4
0
 /**
  * Class constructor
  *
  * @param   array  $options  Associative array of options
  *
  * @since   12.1
  */
 public function __construct($options = array())
 {
     parent::__construct($options);
     // Set mime type
     $this->_mime = 'image/png';
     // Set document type
     $this->_type = 'image';
 }
Пример #5
0
 function __construct($options = array())
 {
     // let the parent class do its bit
     parent::__construct($options);
     // set the MIME type
     $this->_type = 'yql';
     //$this->setMimeEncoding("application/json");
     $this->setAuthor('Fabrik');
 }
Пример #6
0
Файл: html.php Проект: akksi/jcg
 /**
  * Class constructor
  *
  * @param	array	$options Associative array of options
  */
 public function __construct($options = array())
 {
     parent::__construct($options);
     //set document type
     $this->_type = 'html';
     //set default mime type and document metadata (meta data syncs with mime type by default)
     $this->setMetaData('Content-Type', 'text/html', true);
     $this->setMetaData('robots', 'index, follow');
 }
Пример #7
0
 /**
  * Class constructor
  *
  * @param   array  $options  Associative array of options
  *
  * @since  3.1
  */
 public function __construct($options = array())
 {
     parent::__construct($options);
     // Set default mime type.
     $this->_mime = 'application/json';
     // Set document type.
     $this->_type = 'hal+json';
     // Set absolute/relative hrefs.
     $this->absoluteHrefs = isset($options['absoluteHrefs']) ? $options['absoluteHrefs'] : false;
 }
Пример #8
0
 /**
  * Class constructor
  *
  * @access protected
  * @param	array	$options Associative array of options
  */
 function __construct($options = array())
 {
     parent::__construct($options);
     //set document type
     $this->_type = 'html';
     //set mime type
     $this->_mime = 'text/html';
     //set default document metadata
     $this->setMetaData('Content-Type', $this->_mime . '; charset=' . $this->_charset, true);
     $this->setMetaData('robots', 'index, follow');
 }
Пример #9
0
 /**
  * Class constructor
  *
  * @param   array  $options  Associative array of options
  *
  * @since  11.1
  */
 public function __construct($options = array())
 {
     parent::__construct($options);
     // Set mime type
     if (isset($_SERVER['HTTP_ACCEPT']) && strpos($_SERVER['HTTP_ACCEPT'], 'application/json') === false && strpos($_SERVER['HTTP_ACCEPT'], 'text/html') !== false) {
         // Internet Explorer < 10
         $this->_mime = 'text/plain';
     } else {
         $this->_mime = 'application/json';
     }
     // Set document type
     $this->_type = 'json';
 }
Пример #10
0
 /**
  * Class constructore
  *
  * @access protected
  * @param	array	$options Associative array of options
  */
 function __construct($options = array())
 {
     parent::__construct($options);
     if (isset($options['margin-header'])) {
         $this->_margin_header = $options['margin-header'];
     }
     if (isset($options['margin-footer'])) {
         $this->_margin_footer = $options['margin-footer'];
     }
     if (isset($options['margin-top'])) {
         $this->_margin_top = $options['margin-top'];
     }
     if (isset($options['margin-bottom'])) {
         $this->_margin_bottom = $options['margin-bottom'];
     }
     if (isset($options['margin-left'])) {
         $this->_margin_left = $options['margin-left'];
     }
     if (isset($options['margin-right'])) {
         $this->_margin_right = $options['margin-right'];
     }
     if (isset($options['image-scale'])) {
         $this->_image_scale = $options['image-scale'];
     }
     //set mime type
     $this->_mime = 'application/pdf';
     //set document type
     $this->_type = 'pdf';
     /*
      * Setup external configuration options
      */
     //	define('K_TCPDF_EXTERNAL_CONFIG', true);
     /*
      * Create the pdf document
      */
     // Default settings are a portrait layout with an A4 configuration using millimeters as units
     if (!class_exists('TCPDF')) {
         require JPATH_ROOT . DS . 'libraries' . DS . 'tcpdf' . DS . 'tcpdf.php';
     }
     $this->_engine = new TCPDF('P', 'mm', 'A4', true, 'UTF-8', true);
     //set margins
     $this->_engine->SetMargins($this->_margin_left, $this->_margin_top, $this->_margin_right);
     //set auto page breaks
     $this->_engine->SetAutoPageBreak(TRUE, $this->_margin_bottom);
     $this->_engine->SetHeaderMargin($this->_margin_header);
     $this->_engine->SetFooterMargin($this->_margin_footer);
     $this->_engine->setImageScale($this->_image_scale);
 }
Пример #11
0
 /**
  * Class constructor
  *
  * @param   array   $options   Associative array of options
  * @param   string  $mimeType  Document type
  *
  * @since  1.4
  */
 public function __construct($options = array(), $mimeType = 'json')
 {
     parent::__construct($options);
     $this->documentFormat = $options['documentFormat'];
     if (!in_array($this->documentFormat, array('json'))) {
         $this->documentFormat = 'json';
     }
     // Set default mime type.
     $this->_mime = 'application/' . $mimeType;
     // Set document type.
     $this->_type = 'json';
     // Set absolute/relative hrefs.
     $this->absoluteHrefs = isset($options['absoluteHrefs']) ? $options['absoluteHrefs'] : true;
     // Set token if needed
     $this->uriParams = isset($options['uriParams']) ? $options['uriParams'] : array();
 }
Пример #12
0
 /**
  * Class constructor
  *
  * @param   array  $options  Associative array of options
  *
  * @since  11.1
  */
 public function __construct($options = array())
 {
     parent::__construct($options);
     // Set document type
     $this->_type = 'feed';
 }
Пример #13
0
 /**
  * Class constructor
  *
  * @access protected
  * @param   array	$options Associative array of options
  */
 function __construct($options = array())
 {
     parent::__construct($options);
     //set document type
     $this->_type = 'fabrikfeed';
 }
Пример #14
0
 /**
  * Class constructore
  *
  * @access protected
  * @param	array	$options Associative array of options
  */
 function __construct($options = array())
 {
     parent::__construct($options);
     if (isset($options['margin-header'])) {
         $this->_margin_header = $options['margin-header'];
     }
     if (isset($options['margin-footer'])) {
         $this->_margin_footer = $options['margin-footer'];
     }
     if (isset($options['margin-top'])) {
         $this->_margin_top = $options['margin-top'];
     }
     if (isset($options['margin-bottom'])) {
         $this->_margin_bottom = $options['margin-bottom'];
     }
     if (isset($options['margin-left'])) {
         $this->_margin_left = $options['margin-left'];
     }
     if (isset($options['margin-right'])) {
         $this->_margin_right = $options['margin-right'];
     }
     if (isset($options['image-scale'])) {
         $this->_image_scale = $options['image-scale'];
     }
     //set mime type
     $this->_mime = 'application/pdf';
     //set document type
     $this->_type = 'pdf';
     /*
      * Setup external configuration options
      */
     define('K_TCPDF_EXTERNAL_CONFIG', true);
     /*
      * Path options
      */
     // Installation path
     define("K_PATH_MAIN", JPATH_LIBRARIES . DS . "tcpdf");
     // URL path
     define("K_PATH_URL", JPATH_BASE);
     // Fonts path
     define("K_PATH_FONTS", JPATH_SITE . DS . 'language' . DS . "pdf_fonts" . DS);
     // Cache directory path
     define("K_PATH_CACHE", K_PATH_MAIN . DS . "cache");
     // Cache URL path
     define("K_PATH_URL_CACHE", K_PATH_URL . DS . "cache");
     // Images path
     define("K_PATH_IMAGES", K_PATH_MAIN . DS . "images");
     // Blank image path
     define("K_BLANK_IMAGE", K_PATH_IMAGES . DS . "_blank.png");
     /*
      * Format options
      */
     // Cell height ratio
     define("K_CELL_HEIGHT_RATIO", 1.25);
     // Magnification scale for titles
     define("K_TITLE_MAGNIFICATION", 1.3);
     // Reduction scale for small font
     define("K_SMALL_RATIO", 2 / 3);
     // Magnication scale for head
     define("HEAD_MAGNIFICATION", 1.1);
     /*
      * Create the pdf document
      */
     jimport('tcpdf.tcpdf');
     // Default settings are a portrait layout with an A4 configuration using millimeters as units
     $this->_engine = new TCPDF();
     //set margins
     $this->_engine->SetMargins($this->_margin_left, $this->_margin_top, $this->_margin_right);
     //set auto page breaks
     $this->_engine->SetAutoPageBreak(TRUE, $this->_margin_bottom);
     $this->_engine->SetHeaderMargin($this->_margin_header);
     $this->_engine->SetFooterMargin($this->_margin_footer);
     $this->_engine->setImageScale($this->_image_scale);
 }
Пример #15
0
 /**
  * Class constructor
  *
  * @param   array  $options  Associative array of options
  *
  * @since   11.1
  */
 public function __construct($options = array())
 {
     parent::__construct($options);
     // Set document type
     $this->_type = 'html';
     // Set default mime type and document metadata (meta data syncs with mime type by default)
     $this->setMimeEncoding('text/html');
 }
 /**
  * Class constructore
  *
  * @access protected
  * @param	array	$options Associative array of options
  */
 function __construct($options = array())
 {
     parent::__construct($options);
     //set mime type
     $this->_mime = 'application/pdf';
     //set document type
     $this->_type = 'pdf';
     $type = JRequest::getCmd('type', null);
     // to test engines
     // load plugin parameter or set empty params.
     $plugin = JPluginHelper::getPlugin('document', 'pdf');
     if (empty($plugin)) {
         $params = '';
     } else {
         $params = $plugin->params;
     }
     $this->params = new JRegistry();
     $this->params->loadString($params);
     // verify and load the PDF class and assign by ref the jdocument
     if ($type === null) {
         $type = $this->params->get('engine', 'mpdf');
     }
     if (!file_exists(JPATH_LIBRARIES . '/' . $type)) {
         // reset type & fallback to installed PDF classes
         $type = null;
         $renderers = JFolder::files(dirname(__FILE__) . '/renderer/', '\\.php$');
         foreach ($renderers as $renderer) {
             $lib = substr($renderer, 0, -4);
             if (file_exists(JPATH_LIBRARIES . '/' . $lib)) {
                 $type = $lib;
                 break;
             }
         }
     }
     // Benchmark render engine
     // $this->rendertime = microtime(true); // Gets microseconds
     $this->engineName = $type;
     $this->_engine = $this->loadRenderer($type);
     // hock for missing PDF view in component
     // set the type to HTML to fake component.
     // Note : this can give bad result if you display a front view called from administrator and want use view.pdf.php
     $viewPath = JPATH_ROOT . '/';
     $input = JFactory::getApplication()->input;
     $option = $input->get('option', '', 'word');
     $view = $input->get('view', substr($option, 4), 'word');
     $app = JFactory::getApplication();
     if (!$app->isSite()) {
         $viewPath .= 'administrator/';
     }
     $viewPath .= 'components/' . $option . '/views/' . $view . '/view.pdf.php';
     if (!file_exists($viewPath)) {
         $input->set('format', 'html');
         $this->_type = 'html';
         // jrequest::setVar('format','html');
     }
     // var_dump(debug_backtrace());
 }