本文整理汇总了PHP中JDocument类的典型用法代码示例。如果您正苦于以下问题:PHP JDocument类的具体用法?PHP JDocument怎么用?PHP JDocument使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JDocument类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: fetchScripts
/**
* Generates the head HTML and return the results as a string
*
* @param JDocument $document The document for which the head will be created
*
* @return string The head hTML
*
* @since 11.1
*/
public function fetchScripts($document)
{
// Trigger the onBeforeCompileHead event
$app = JFactory::getApplication();
// Get line endings
$lnEnd = $document->_getLineEnd();
$tab = $document->_getTab();
$tagEnd = ' />';
$buffer = '';
if ($disabled_scripts_list = $document->params->get('disabled_scripts_list', '')) {
$disable_scripts = preg_split("#\n" . '|' . "\r\n#", $disabled_scripts_list);
}
// Generate script file links
foreach ($document->_scripts as $strSrc => $strAttr) {
if (!in_array($strSrc, $disable_scripts)) {
$buffer .= $tab . '<script src="' . $strSrc . '"';
$defaultMimes = array('text/javascript', 'application/javascript', 'text/x-javascript', 'application/x-javascript');
if (!is_null($strAttr['mime']) && (!$document->isHtml5() || !in_array($strAttr['mime'], $defaultMimes))) {
$buffer .= ' type="' . $strAttr['mime'] . '"';
}
if ($strAttr['defer']) {
$buffer .= ' defer="defer"';
}
if ($strAttr['async']) {
$buffer .= ' async="async"';
}
$buffer .= '></script>' . $lnEnd;
}
}
// Generate script declarations
foreach ($document->_script as $type => $content) {
$buffer .= $tab . '<script type="' . $type . '">' . $lnEnd;
// This is for full XHTML support.
if ($document->_mime != 'text/html') {
$buffer .= $tab . $tab . '<![CDATA[' . $lnEnd;
}
$buffer .= $content . $lnEnd;
// See above note
if ($document->_mime != 'text/html') {
$buffer .= $tab . $tab . ']]>' . $lnEnd;
}
$buffer .= $tab . '</script>' . $lnEnd;
}
// Generate script language declarations.
if (count(JText::script())) {
$buffer .= $tab . '<script type="text/javascript">' . $lnEnd;
$buffer .= $tab . $tab . '(function() {' . $lnEnd;
$buffer .= $tab . $tab . $tab . 'var strings = ' . json_encode(JText::script()) . ';' . $lnEnd;
$buffer .= $tab . $tab . $tab . 'if (typeof Joomla == \'undefined\') {' . $lnEnd;
$buffer .= $tab . $tab . $tab . $tab . 'Joomla = {};' . $lnEnd;
$buffer .= $tab . $tab . $tab . $tab . 'Joomla.JText = strings;' . $lnEnd;
$buffer .= $tab . $tab . $tab . '}' . $lnEnd;
$buffer .= $tab . $tab . $tab . 'else {' . $lnEnd;
$buffer .= $tab . $tab . $tab . $tab . 'Joomla.JText.load(strings);' . $lnEnd;
$buffer .= $tab . $tab . $tab . '}' . $lnEnd;
$buffer .= $tab . $tab . '})();' . $lnEnd;
$buffer .= $tab . '</script>' . $lnEnd;
}
return $buffer;
}
开发者ID:shanginn,项目名称:joomla-template,代码行数:69,代码来源:foot_j3.php
示例2: mapJS
/**
* Adds the map javascript to the document
*/
protected function mapJS(JDocument $document)
{
// Add map interface Javascript
JHtml::_('behavior.framework', true);
$document->addScript('/libraries/openlayers/OpenLayers.debug.js');
$document->addScript('/swg/js/maps.js');
$document->addScript('/swg/js/events.js');
}
开发者ID:SheffieldWalkingGroup,项目名称:swgwebsite,代码行数:11,代码来源:eventinfo.html.php
示例3: fetchJs
/**
* Generates the javascript HTML and return the results as a string
*
* @param JDocument $document The document for which the javascript will be created
*
* @return string The javascript hTML
*
* @since 11.1
*/
public function fetchJs($document)
{
// Get line endings
$lnEnd = $document->_getLineEnd();
$tab = $document->_getTab();
$buffer = '';
// Generate script file links
foreach ($document->_scripts as $strSrc => $strAttr) {
$buffer .= $tab . '<script src="' . $strSrc . '"';
$defaultMimes = array('text/javascript', 'application/javascript', 'text/x-javascript', 'application/x-javascript');
if (!is_null($strAttr['mime']) && (!$document->isHtml5() || !in_array($strAttr['mime'], $defaultMimes))) {
$buffer .= ' type="' . $strAttr['mime'] . '"';
}
if ($strAttr['defer']) {
$buffer .= ' defer="defer"';
}
if ($strAttr['async']) {
$buffer .= ' async="async"';
}
$buffer .= '></script>' . $lnEnd;
}
// Generate script declarations
foreach ($document->_script as $type => $content) {
$buffer .= $tab . '<script type="' . $type . '">' . $lnEnd;
// This is for full XHTML support.
if ($document->_mime != 'text/html') {
$buffer .= $tab . $tab . '<![CDATA[' . $lnEnd;
}
$buffer .= $content . $lnEnd;
// See above note
if ($document->_mime != 'text/html') {
$buffer .= $tab . $tab . ']]>' . $lnEnd;
}
$buffer .= $tab . '</script>' . $lnEnd;
}
// Generate script language declarations.
if (count(JText::script())) {
$buffer .= $tab . '<script type="text/javascript">' . $lnEnd;
$buffer .= $tab . $tab . '(function() {' . $lnEnd;
$buffer .= $tab . $tab . $tab . 'var strings = ' . json_encode(JText::script()) . ';' . $lnEnd;
$buffer .= $tab . $tab . $tab . 'if (typeof Joomla == \'undefined\') {' . $lnEnd;
$buffer .= $tab . $tab . $tab . $tab . 'Joomla = {};' . $lnEnd;
$buffer .= $tab . $tab . $tab . $tab . 'Joomla.JText = strings;' . $lnEnd;
$buffer .= $tab . $tab . $tab . '}' . $lnEnd;
$buffer .= $tab . $tab . $tab . 'else {' . $lnEnd;
$buffer .= $tab . $tab . $tab . $tab . 'Joomla.JText.load(strings);' . $lnEnd;
$buffer .= $tab . $tab . $tab . '}' . $lnEnd;
$buffer .= $tab . $tab . '})();' . $lnEnd;
$buffer .= $tab . '</script>' . $lnEnd;
}
foreach ($document->_custom as $custom) {
$buffer .= $tab . $custom . $lnEnd;
}
return $buffer;
}
开发者ID:Vartacom,项目名称:bootstrapbase,代码行数:64,代码来源:js.php
示例4: render
/**
* Render the error page based on an exception.
*
* @param Exception $error The exception for which to render the error page.
*
* @return void
*
* @since 3.0
*/
public static function render(Exception $error)
{
try {
$app = JFactory::getApplication();
$document = JDocument::getInstance('error');
if (!$document) {
// We're probably in an CLI environment
jexit($error->getMessage());
}
// Get the current template from the application
$template = $app->getTemplate();
// Push the error object into the document
$document->setError($error);
if (ob_get_contents()) {
ob_end_clean();
}
$document->setTitle(JText::_('Error') . ': ' . $error->getCode());
$data = $document->render(false, array('template' => $template, 'directory' => JPATH_THEMES, 'debug' => JDEBUG));
// Do not allow cache
$app->allowCache(false);
// If nothing was rendered, just use the message from the Exception
if (empty($data)) {
$data = $error->getMessage();
}
$app->setBody($data);
echo $app->toString();
} catch (Exception $e) {
// Try to set a 500 header if they haven't already been sent
if (!headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');
}
jexit('Error displaying the error page: ' . $e->getMessage() . ': ' . $error->getMessage());
}
}
开发者ID:grlf,项目名称:eyedock,代码行数:43,代码来源:page.php
示例5: resetDocumentType
/**
* Resets the document type to format=raw
*
* @return void
* @since 0.1
* @todo Figure out if there is a better way to do this
*/
private function resetDocumentType()
{
$document =& JFactory::getDocument();
$raw =& JDocument::getInstance('raw');
$document = $raw;
JResponse::clearHeaders();
}
开发者ID:bizanto,项目名称:Hooked,代码行数:14,代码来源:http.php
示例6: display
function display()
{
$doDisplay = true;
// Set a default view if none exists
if (!JRequest::getCmd('view')) {
JRequest::setVar('view', 'tickets');
}
// Handle displaying an attachment
if (JRequest::getCmd('view') == 'attachment') {
$model = $this->getModel('attachment');
$result = $model->download(JRequest::getVar('ArticleID', '', '', 'integer'), JRequest::getVar('AtmID', '', '', 'integer'));
if (array_key_exists('data', $result)) {
$document =& JFactory::getDocument();
$doc =& JDocument::getInstance('raw');
$document = $doc;
JResponse::clearHeaders();
$document->setMimeEncoding($result['data']->ContentType);
JResponse::setHeader('Content-length', $result['data']->FilesizeRaw, true);
$fn = preg_replace('/"/', '\\"', $result['data']->Filename);
JResponse::setHeader('Content-disposition', sprintf('attachment;filename="%s"', $fn), true);
$document->render();
echo $result['data']->Content;
$doDisplay = false;
}
}
if ($doDisplay) {
parent::display();
}
}
开发者ID:noamk,项目名称:OTRS-Joomla-Gateway,代码行数:29,代码来源:controller.php
示例7: testCalendar
/**
* Tests JHtml::calendar() method with and without 'readonly' attribute.
*/
public function testCalendar()
{
// Create a world for the test
jimport('joomla.session.session');
jimport('joomla.application.application');
jimport('joomla.document.document');
$cfg = new JObject();
JFactory::$session = $this->getMock('JSession', array('_start'));
JFactory::$application = $this->getMock('ApplicationMock');
JFactory::$config = $cfg;
JFactory::$application->expects($this->any())->method('getTemplate')->will($this->returnValue('atomic'));
$cfg->live_site = 'http://example.com';
$cfg->offset = 'Europe/Kiev';
$_SERVER['HTTP_USER_AGENT'] = 'Test Browser';
// two sets of test data
$test_data = array('date' => '2010-05-28 00:00:00', 'friendly_date' => 'Friday, 28 May 2010', 'name' => 'cal1_name', 'id' => 'cal1_id', 'format' => '%Y-%m-%d', 'attribs' => array());
$test_data_ro = array_merge($test_data, array('attribs' => array('readonly' => 'readonly')));
foreach (array($test_data, $test_data_ro) as $data) {
// Reset the document
JFactory::$document = JDocument::getInstance('html', array('unique_key' => serialize($data)));
$input = JHtml::calendar($data['date'], $data['name'], $data['id'], $data['format'], $data['attribs']);
$this->assertEquals((string) $xml->input['title'], $data['friendly_date'], 'Line:' . __LINE__ . ' The calendar input should have `title == "' . $data['friendly_date'] . '"`');
$this->assertEquals((string) $xml->input['name'], $data['name'], 'Line:' . __LINE__ . ' The calendar input should have `name == "' . $data['name'] . '"`');
$this->assertEquals((string) $xml->input['id'], $data['id'], 'Line:' . __LINE__ . ' The calendar input should have `id == "' . $data['id'] . '"`');
$head_data = JFactory::getDocument()->getHeadData();
if (!isset($data['attribs']['readonly']) || !$data['attribs']['readonly'] === 'readonly') {
$this->assertArrayHasKey('/media/system/js/calendar.js', $head_data['scripts'], 'Line:' . __LINE__ . ' JS file "calendar.js" should be loaded');
$this->assertArrayHasKey('/media/system/js/calendar-setup.js', $head_data['scripts'], 'Line:' . __LINE__ . ' JS file "calendar-setup.js" should be loaded');
}
}
}
开发者ID:realityking,项目名称:oldunittests,代码行数:34,代码来源:JHtmlTest.php
示例8: sendBug
/**
* Submits a bug report to Dioscouri.
* Thanks so much! They really help improve the product!
*/
function sendBug()
{
$mainframe = JFactory::getApplication();
$body = JRequest::getVar('body');
$name = JRequest::getVar('title');
$body .= "\n\n Project: tienda";
$body .= "\n Tracker: Bug";
$body .= "\n Affected Version: " . Tienda::getVersion();
$doc = JDocument::getInstance('raw');
ob_start();
$option = JRequest::getCmd('option');
$db = JFactory::getDBO();
$path = JPATH_ADMINISTRATOR . '/components/com_admin/';
require_once $path . 'admin.admin.html.php';
$path .= 'tmpl/';
require_once $path . 'sysinfo_system.php';
require_once $path . 'sysinfo_directory.php';
require_once $path . 'sysinfo_phpinfo.php';
require_once $path . 'sysinfo_phpsettings.php';
require_once $path . 'sysinfo_config.php';
jimport('joomla.filesystem.file');
$contents = ob_get_contents();
ob_end_clean();
$doc->setBuffer($contents);
$contents = $doc->render();
$sitename = $config->get('sitename', $mainframe->getCfg('sitename'));
// write file with info
$config = JFactory::getConfig();
$filename = 'system_info_' . $sitename . '.html';
$file = JPATH_SITE . '/tmp/' . $filename;
JFile::write($file, $contents);
$mailer = JFactory::getMailer();
$success = false;
// For now, bug submission goes to [email protected],
// but in the future, it will go to [email protected]
// (once we get the Redmine auto-create working properly
// and format the subject/body of the email properly)
$mailer->addRecipient('[email protected]');
$mailer->setSubject($name);
$mailfrom = $config->get('emails_defaultemail', $mainframe->getCfg('mailfrom'));
$fromname = $config->get('emails_defaultname', $mainframe->getCfg('fromname'));
// check user mail format type, default html
$mailer->setBody($body);
$mailer->addAttachment($file);
$sender = array($mailfrom, $fromname);
$mailer->setSender($sender);
$sent = $mailer->send();
if ($sent == '1') {
$success = true;
}
JFile::delete($file);
if ($success) {
$msg = JText::_('COM_TIENDA_BUG_SUBMIT_OK');
$msgtype = 'message';
} else {
$msg = JText::_('COM_TIENDA_BUG_SUBMIT_FAIL');
$msgtype = 'notice';
}
$mainframe->redirect(JRoute::_('index.php?option=com_tienda&view=dashboard'), $msg, $msgtype);
}
开发者ID:annggeel,项目名称:tienda,代码行数:64,代码来源:bug_report.php
示例9: testRender
/**
* @todo Implement testRender().
*/
public function testRender()
{
$this->object = new JDocument();
$this->object->render();
$headers = JResponse::getHeaders();
$lastMod = false;
$contentType = false;
foreach ($headers as $header) {
if ($header['name'] == 'Last-Modified') {
$lastMod = $header;
}
if ($header['name'] == 'Content-Type') {
$contentType = $header;
}
}
$this->assertThat($lastMod, $this->equalTo(false));
$this->assertThat($contentType['value'], $this->equalTo('; charset=utf-8'));
$this->object->setModifiedDate('My date');
$this->object->setMimeEncoding('MyMimeType');
$this->object->setCharset('MyCharset');
$this->object->render();
$headers = JResponse::getHeaders();
$lastMod = false;
$contentType = false;
foreach ($headers as $header) {
if ($header['name'] == 'Last-Modified') {
$lastMod = $header;
}
if ($header['name'] == 'Content-Type') {
$contentType = $header;
}
}
$this->assertThat($lastMod['value'], $this->equalTo('My date'));
$this->assertThat($contentType['value'], $this->equalTo('mymimetype; charset=MyCharset'));
}
开发者ID:nguyen1986vn,项目名称:atj25,代码行数:38,代码来源:JDocumentTest.php
示例10: render
/**
* Render the error page based on an exception.
*
* @param Exception $error The exception for which to render the error page.
*
* @return void
*
* @since 3.0
*/
public static function render(Exception $error)
{
try {
$app = JFactory::getApplication();
$document = JDocument::getInstance('error');
if (!$document) {
// We're probably in an CLI environment
exit($error->getMessage());
$app->close(0);
}
$config = JFactory::getConfig();
// Get the current template from the application
$template = $app->getTemplate();
// Push the error object into the document
$document->setError($error);
if (ob_get_contents()) {
ob_end_clean();
}
$document->setTitle(JText::_('Error') . ': ' . $error->getCode());
$data = $document->render(false, array('template' => $template, 'directory' => JPATH_THEMES, 'debug' => $config->get('debug')));
// Failsafe to get the error displayed.
if (empty($data)) {
exit($error->getMessage());
} else {
// Do not allow cache
$app->allowCache(false);
$app->setBody($data);
echo $app->toString();
}
} catch (Exception $e) {
exit('Error displaying the error page: ' . $e->getMessage() . ': ' . $error->getMessage());
}
}
开发者ID:ziyou-liu,项目名称:1line,代码行数:42,代码来源:page.php
示例11: register
/**
* Register the API server.
*
* @throws \Exception
* @return boolean
*/
public function register()
{
$uri = \JURI::getInstance();
if (!$this->isApi()) {
return false;
}
$app = \JFactory::getApplication();
$input = $app->input;
// Restore Joomla handler and using our Json handler.
JsonResponse::registerErrorHandler();
// Authentication
if (!$this->isUserOperation($uri) && $this->option['authorise']) {
if (!Authentication::authenticate($input->get('session_key'))) {
throw new \Exception(\JText::_('JERROR_ALERTNOAUTHOR'), 403);
}
}
// Set Format to JSON
$input->set('format', 'json');
// Store JDocumentJson to Factory
\JFactory::$document = \JDocument::getInstance('json');
$router = $app::getRouter();
// Attach a hook to Router
$router->attachParseRule(array($this, 'parseRule'));
return true;
}
开发者ID:lyrasoft,项目名称:lyrasoft.github.io,代码行数:31,代码来源:ApiServer.php
示例12: render
/**
* Render the document.
*
* @access public
* @param boolean $cache If true, cache the output
* @param array $params Associative array of attributes
* @return The rendered data
*/
function render($cache = false, $params = array())
{
// Instantiate feed renderer and set the mime encoding
require_once dirname(__FILE__) . DS . 'renderer' . DS . 'xml.php';
$renderer =& $this->loadRenderer('xml');
if (!is_a($renderer, 'JDocumentRenderer')) {
JError::raiseError(404, JText::_('Resource Not Found'));
}
$url = 'http://demo.fabrikar.com/index.php?option=com_fabrik&view=table&tableid=' . $this->tableid . '&format=raw&type=xml';
$url = htmlspecialchars($url, ENT_COMPAT, 'UTF-8');
$data = '<?xml version="1.0" encoding="UTF-8"?>
<table xmlns="http://query.yahooapis.com/v1/schema/table.xsd">
<meta>
<author>' . htmlspecialchars($this->author, ENT_COMPAT, 'UTF-8') . '</author>
<documentationURL>None</documentationURL>
<description>' . htmlspecialchars($this->description, ENT_COMPAT, 'UTF-8') . '</description>
<sampleQuery>SELECT * FROM {table} WHERE jos_fabrik_calendar_events___visualization_id_raw="0"</sampleQuery>
</meta>
<bindings>
<select itemPath="root.row" produces="XML">
<urls>
<url>' . $url . '</url>
</urls>
</select>
</bindings>
</table>';
// Render the feed
//$data .= $renderer->render();
parent::render();
return $data;
}
开发者ID:nikshade,项目名称:fabrik21,代码行数:40,代码来源:yqldocument.php
示例13: render
/**
* Render the error page based on an exception.
*
* @param Exception|Throwable $error An Exception or Throwable (PHP 7+) object for which to render the error page.
*
* @return void
*
* @since 3.0
*/
public static function render($error)
{
$expectedClass = PHP_MAJOR_VERSION >= 7 ? 'Throwable' : 'Exception';
$isException = $error instanceof $expectedClass;
// In PHP 5, the $error object should be an instance of Exception; PHP 7 should be a Throwable implementation
if ($isException) {
try {
// If site is offline and it's a 404 error, just go to index (to see offline message, instead of 404)
if ($error->getCode() == '404' && JFactory::getConfig()->get('offline') == 1) {
JFactory::getApplication()->redirect('index.php');
}
$app = JFactory::getApplication();
$document = JDocument::getInstance('error');
if (!$document) {
// We're probably in an CLI environment
jexit($error->getMessage());
}
// Get the current template from the application
$template = $app->getTemplate();
// Push the error object into the document
$document->setError($error);
if (ob_get_contents()) {
ob_end_clean();
}
$document->setTitle(JText::_('Error') . ': ' . $error->getCode());
$data = $document->render(false, array('template' => $template, 'directory' => JPATH_THEMES, 'debug' => JDEBUG));
// Do not allow cache
$app->allowCache(false);
// If nothing was rendered, just use the message from the Exception
if (empty($data)) {
$data = $error->getMessage();
}
$app->setBody($data);
echo $app->toString();
$app->close(0);
// This return is needed to ensure the test suite does not trigger the non-Exception handling below
return;
} catch (Throwable $e) {
// Pass the error down
} catch (Exception $e) {
// Pass the error down
}
}
// This isn't an Exception, we can't handle it.
if (!headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');
}
$message = 'Error displaying the error page';
if ($isException) {
$message .= ': ';
if (isset($e)) {
$message .= $e->getMessage() . ': ';
}
$message .= $error->getMessage();
}
echo $message;
jexit(1);
}
开发者ID:adjaika,项目名称:J3Base,代码行数:67,代码来源:page.php
示例14: render
/**
* Render the error page based on an exception.
*
* @param object $error An Exception or Throwable (PHP 7+) object for which to render the error page.
*
* @return void
*
* @since 3.0
*/
public static function render($error)
{
$expectedClass = PHP_MAJOR_VERSION >= 7 ? 'Throwable' : 'Exception';
$isException = $error instanceof $expectedClass;
// In PHP 5, the $error object should be an instance of Exception; PHP 7 should be a Throwable implementation
if ($isException) {
try {
$app = JFactory::getApplication();
$document = JDocument::getInstance('error');
$code = $error->getCode();
if (!isset(JHttpResponse::$status_messages[$code])) {
$code = '500';
}
if (ini_get('display_errors')) {
$message = $error->getMessage();
} else {
$message = JHttpResponse::$status_messages[$code];
}
if (!$document || PHP_SAPI == 'cli') {
// We're probably in an CLI environment
jexit($message);
}
// Get the current template from the application
$template = $app->getTemplate();
// Push the error object into the document
$document->setError($error);
if (ob_get_contents()) {
ob_end_clean();
}
$document->setTitle(JText::_('Error') . ': ' . $code);
$data = $document->render(false, array('template' => $template, 'directory' => JPATH_THEMES, 'debug' => JFactory::getConfig()->get('debug')));
// Do not allow cache
$app->allowCache(false);
// If nothing was rendered, just use the message from the Exception
if (empty($data)) {
$data = $message;
}
$app->setBody($data);
echo $app->toString();
return;
} catch (Exception $e) {
// Pass the error down
}
}
// This isn't an Exception, we can't handle it.
if (!headers_sent()) {
header('HTTP/1.1 500 Internal Server Error');
}
$message = 'Error displaying the error page';
if ($isException) {
$message .= ': ' . $e->getMessage() . ': ' . $message;
}
echo $message;
jexit(1);
}
开发者ID:joomlatools,项目名称:joomla-platform,代码行数:64,代码来源:page.php
示例15: ezStream
function ezStream()
{
$options = array('margin-header' => 5, 'margin-footer' => 10, 'margin-top' => 20, 'margin-bottom' => 20, 'margin-left' => 15, 'margin-right' => 15);
$pdfDoc =& JDocument::getInstance('pdf', $options);
$pdfDoc->setTitle($this->_title);
$pdfDoc->setHeader($this->_header);
$pdfDoc->setBuffer($this->_text);
header('Content-Type: application/pdf');
header('Content-disposition: inline; filename="file.pdf"', true);
echo $pdfDoc->render();
}
开发者ID:kaantunc,项目名称:MYK-BOR,代码行数:11,代码来源:kunena.pdf.php
示例16: render
/**
* Render the document.
*
* @access public
* @param boolean $cache If true, cache the output
* @param array $params Associative array of attributes
* @return The rendered data
*/
function render($cache = false, $params = array())
{
// Instantiate feed renderer and set the mime encoding
require_once dirname(__FILE__) . DS . 'renderer' . DS . 'xml.php';
$renderer =& $this->loadRenderer('xml');
if (!is_a($renderer, 'JDocumentRenderer')) {
JError::raiseError(404, JText::_('Resource Not Found'));
}
$data = '';
// Render the feed
$data .= $renderer->render();
parent::render();
return $data;
}
开发者ID:nikshade,项目名称:fabrik21,代码行数:22,代码来源:xmldocument.php
示例17: _prepareDocument
/**
* Prepares the document
*/
protected function _prepareDocument()
{
$app = JFactory::getApplication();
$menus = $app->getMenu();
$title = null;
// Because the application sets a default page title,
// we need to get it from the menu item itself
$menu = $menus->getActive();
if ($menu) {
$this->params->get('page_heading', $this->params->get('page_title', $menu->title));
}
$title = $this->params->get('page_title', '');
if (empty($title)) {
$title = $app->getCfg('sitename');
} elseif ($app->getCfg('sitename_pagetitles', 0) == 1) {
$title = JText::sprintf('JPAGETITLE', $app->getCfg('sitename'), $title);
} elseif ($app->getCfg('sitename_pagetitles', 0) == 2) {
$title = JText::sprintf('JPAGETITLE', $title, $app->getCfg('sitename'));
}
$this->document->setTitle($title);
if ($this->params->get('menu-meta_description')) {
$this->document->setDescription($this->params->get('menu-meta_description'));
}
if ($this->params->get('menu-meta_keywords')) {
$this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords'));
}
if ($this->params->get('robots')) {
$this->document->setMetadata('robots', $this->params->get('robots'));
}
}
开发者ID:sansandeep143,项目名称:av,代码行数:33,代码来源:view.html.php
示例18: populate
public function populate()
{
if (!empty($this->script_files)) {
ksort($this->script_files);
foreach ($this->script_files as $order => $order_entries) {
foreach ($order_entries as $entry_key => $entry) {
$this->document->addScript($entry);
}
}
}
if (!empty($this->inline_scripts)) {
ksort($this->inline_scripts);
foreach ($this->inline_scripts as $order => $order_entries) {
foreach ($order_entries as $entry_key => $entry) {
$this->document->addScriptDeclaration($entry);
}
}
}
if (!empty($this->style_files)) {
ksort($this->style_files);
foreach ($this->style_files as $order => $order_entries) {
foreach ($order_entries as $entry_key => $entry) {
$this->document->addStyleSheet($entry);
}
}
}
if (!empty($this->inline_styles)) {
ksort($this->inline_styles);
foreach ($this->inline_styles as $order => $order_entries) {
foreach ($order_entries as $entry_key => $entry) {
$this->document->addStyleDeclaration($entry);
}
}
}
// Generate domready script
if (!empty($this->domready_scripts)) {
ksort($this->domready_scripts);
$strHtml = 'window.addEvent(\'domready\', function() {';
foreach ($this->domready_scripts as $order => $order_entries) {
foreach ($order_entries as $entry_key => $entry) {
$strHtml .= chr(13) . $entry;
}
}
$strHtml .= chr(13) . '});' . chr(13);
$this->document->addScriptDeclaration($strHtml);
}
if (!empty($this->loadevent_scripts)) {
ksort($this->loadevent_scripts);
$strHtml = 'window.addEvent(\'load\', function() {';
foreach ($this->loadevent_scripts as $order => $order_entries) {
foreach ($order_entries as $entry_key => $entry) {
$strHtml .= chr(13) . $entry;
}
}
$strHtml .= chr(13) . '});' . chr(13);
$this->document->addScriptDeclaration($strHtml);
}
$this->populated = true;
$this->reset();
}
开发者ID:TeamCodeStudio,项目名称:fpmoz,代码行数:60,代码来源:Joomla.php
示例19: render
/**
* Render the document.
*
* @param boolean $cache If true, cache the output
* @param array $params Associative array of attributes
*
* @return The rendered data
*
* @since 3.1
*/
public function render($cache = false, $params = array())
{
JResponse::allowCache($cache);
JResponse::setHeader('Content-disposition', 'attachment; filename="' . $this->getName() . '.json"', true);
// Unfortunately, the exact syntax of the Content-Type header
// is not defined, so we have to try to be a bit clever here.
$contentType = $this->_mime;
if (stripos($contentType, 'json') === false) {
$contentType .= '+' . $this->_type;
}
$this->_mime = $contentType;
parent::render();
// Get the HAL object from the buffer.
$hal = $this->getBuffer();
// If required, change relative links to absolute.
if ($this->absoluteHrefs && is_object($hal) && isset($hal->_links)) {
// Adjust hrefs in the _links object.
$this->relToAbs($hal->_links);
// Adjust hrefs in the _embedded object (if there is one).
if (isset($hal->_embedded)) {
foreach ($hal->_embedded as $rel => $resources) {
foreach ($resources as $id => $resource) {
if (isset($resource->_links)) {
$this->relToAbs($resource->_links);
}
}
}
}
}
// Return it as a JSON string.
return json_encode($hal);
}
开发者ID:prox91,项目名称:joomla-dev,代码行数:42,代码来源:json.php
示例20: render
/**
* Render the document.
*
* @param boolean $cache If true, cache the output
* @param array $params Associative array of attributes
*
* @return The rendered data
*
* @since 12.1
*/
public function render($cache = false, $params = array())
{
// Get the image type
$type = JFactory::getApplication()->input->get('type', 'png');
switch ($type)
{
case 'jpg':
case 'jpeg':
$this->_mime = 'image/jpeg';
break;
case 'gif':
$this->_mime = 'image/gif';
break;
case 'png':
default:
$this->_mime = 'image/png';
break;
}
$this->_charset = null;
parent::render();
return $this->getBuffer();
}
开发者ID:realityking,项目名称:joomla-platform,代码行数:36,代码来源:image.php
注:本文中的JDocument类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论