本文整理汇总了PHP中JDocument::__construct方法的典型用法代码示例。如果您正苦于以下问题:PHP JDocument::__construct方法的具体用法?PHP JDocument::__construct怎么用?PHP JDocument::__construct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JDocument
的用法示例。
在下文中一共展示了JDocument::__construct方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
/**
* 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: __construct
/**
* 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: __construct
/**
* 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: __construct
/**
* 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: array
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: __construct
/**
* 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: __construct
/**
* 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: array
/**
* 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: __construct
/**
* 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: array
/**
* 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: __construct
/**
* 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: __construct
/**
* 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: array
/**
* 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: array
/**
* 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: __construct
/**
* 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');
}