本文整理汇总了PHP中JApplicationWeb类的典型用法代码示例。如果您正苦于以下问题:PHP JApplicationWeb类的具体用法?PHP JApplicationWeb怎么用?PHP JApplicationWeb使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了JApplicationWeb类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: onBeforeMain
public function onBeforeMain()
{
// Load system defines
if (file_exists(APATH_ROOT . '/defines.php')) {
include_once APATH_ROOT . '/defines.php';
}
if (!defined('_JDEFINES')) {
define('JPATH_BASE', APATH_SITE);
require_once JPATH_BASE . '/includes/defines.php';
}
// Load the rest of the framework include files
if (file_exists(JPATH_LIBRARIES . '/import.legacy.php')) {
require_once JPATH_LIBRARIES . '/import.legacy.php';
} else {
require_once JPATH_LIBRARIES . '/import.php';
}
require_once JPATH_LIBRARIES . '/cms.php';
// You can't fix stupid… but you can try working around it
if (!function_exists('json_encode') || !function_exists('json_decode')) {
require_once JPATH_ADMINISTRATOR . '/components/com_akeeba/helpers/jsonlib.php';
}
// Load the JApplicationCli class
JLoader::import('joomla.application.web');
require_once APATH_INSTALLATION . '/angie/assets/runscripts.php';
$run = JApplicationWeb::getInstance('RunScripts');
$run->execute();
return false;
}
示例2: __construct
/**
* Overrides the parent constructor to set the execution start time.
*
* @param mixed $input An optional argument to provide dependency injection for the application's
* input object. If the argument is a JInput object that object will become
* the application's input object, otherwise a default input object is created.
* @param mixed $config An optional argument to provide dependency injection for the application's
* config object. If the argument is a JRegistry object that object will become
* the application's config object, otherwise a default config object is created.
* @param mixed $client An optional argument to provide dependency injection for the application's
* client object. If the argument is a JApplicationWebClient object that object will become
* the application's client object, otherwise a default client object is created.
*
* @since 11.3
*/
public function __construct(JInput $input = null, JRegistry $config = null, JApplicationWebClient $client = null)
{
$this->_startTime = microtime(true);
parent::__construct($input, $config, $client);
$this->errors = new WebServiceApplicationWebErrors($this, $this->input);
$this->errors->checkSupressResponseCodes();
}
示例3: __construct
/**
* Class constructor.
*
* @param mixed $input An optional argument to provide dependency injection for the application's
* input object. If the argument is a JInput object that object will become
* the application's input object, otherwise a default input object is created.
* @param mixed $config An optional argument to provide dependency injection for the application's
* config object. If the argument is a JRegistry object that object will become
* the application's config object, otherwise a default config object is created.
* @param mixed $client An optional argument to provide dependency injection for the application's
* client object. If the argument is a JApplicationWebClient object that object will become
* the application's client object, otherwise a default client object is created.
*/
public function __construct(JInput $input = null, JRegistry $config = null, JApplicationWebClient $client = null)
{
parent::__construct($input, $config, $client);
$this->config->set('session', false);
// Inject the application into JFactory
JFactory::$application = $this;
}
示例4: __construct
public function __construct(JInput $input = null, JRegistry $config = null, JApplicationWebClient $client = null)
{
parent::__construct($input, $config, $client);
// Load and set the dispatcher
$this->loadDispatcher();
// Register the application to JFactory
JFactory::$application = $this;
// Enable sessions by default.
if (is_null($this->config->get('session')))
{
$this->config->set('session', true);
}
// Set the session default name.
if (is_null($this->config->get('session_name')))
{
$this->config->set('session_name', 'site');
}
// Create the session if a session name is passed.
if ($this->config->get('session') !== false)
{
$this->loadSession();
// Register the session with JFactory
JFactory::$session = $this->getSession();
}
}
示例5: __construct
function __construct()
{
parent::__construct();
$this->db = JFactory::getDbo();
$app = JFactory::getApplication();
$limit = $app->getUserStateFromRequest('global.list.limit', 'limit', JApplicationWeb::getInstance()->get('list_limit'), 'int');
$limitstart = $app->getUserStateFromRequest('easyjoomlabackup.limitstart', 'limitstart', 0, 'int');
$limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0;
$search = $app->getUserStateFromRequest('easyfrontendseo.filter.search', 'filter_search', null);
$this->setState('limit', $limit);
$this->setState('limitstart', $limitstart);
$this->setState('filter.search', $search);
}
示例6: __construct
function __construct()
{
parent::__construct();
$app = JFactory::getApplication();
$limit = $app->getUserStateFromRequest('global.list.limit', 'limit', JApplicationWeb::getInstance()->get('list_limit'), 'int');
$limitstart = $app->getUserStateFromRequest('joomlachecksumscanner.limitstart', 'limitstart', 0, 'int');
$limitstart = $limit != 0 ? floor($limitstart / $limit) * $limit : 0;
$search = $app->getUserStateFromRequest('joomlachecksumscanner.filter.search', 'filter_search', null);
$this->setState('limit', $limit);
$this->setState('limitstart', $limitstart);
$this->setState('filter.search', $search);
$this->_db = JFactory::getDbo();
$this->_input = JFactory::getApplication()->input;
$this->_params = JComponentHelper::getParams('com_joomlachecksumscanner');
$this->_snapshot_datetime = JFactory::getDate('now', JFactory::getApplication()->getCfg('offset'));
}
示例7: define
<?php
/**
* @package Joomla.Installation
*
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
/**
* Define the application's minimum supported PHP version as a constant so it can be referenced within the application.
*/
define('JOOMLA_MINIMUM_PHP', '5.3.10');
if (version_compare(PHP_VERSION, JOOMLA_MINIMUM_PHP, '<')) {
die('Your host needs to use PHP ' . JOOMLA_MINIMUM_PHP . ' or higher to run this version of Joomla!');
}
/**
* Constant that is checked in included files to prevent direct access.
* define() is used in the installation folder rather than "const" to not error for PHP 5.2 and lower
*/
define('_JEXEC', 1);
// Bootstrap the application
require_once dirname(__FILE__) . '/application/bootstrap.php';
// Get the application
$app = JApplicationWeb::getInstance('InstallationApplicationWeb');
// Execute the application
$app->execute();
示例8:
//
// You can append to the body of the response using appendBody.
//
// Set up the beginning of the HTML repsonse.
$this->appendBody('<html>')->appendBody('<head>')->appendBody('<title>JApplicationWeb - Detect Client</title>')->appendBody('</head>')->appendBody('<body style="font-family:verdana;">');
// Introduce the page.
$this->appendBody('<p>Welcome to the Joomla! Platform's <code style="font-size:140%">JApplicationWeb</code> class.</p>');
// Start a list.
$this->appendBody('<ul>');
//
// The client information is accessible via the get method.
//
// Get the user agent string.
$this->appendBody(sprintf('<li>User-agent: <em>%s</em></li>', $this->client->userAgent));
// Determine if this is a mobile device.
$this->appendBody(sprintf('<li>Is a mobile device? <em>%s</em></li>', $this->client->mobile ? 'Yes' : 'No'));
// Get the platform.
$this->appendBody(sprintf('<li>Platform: <em>%s</em></li>', $this->client->platform));
// Get the engine.
$this->appendBody(sprintf('<li>Engine: <em>%s</em></li>', $this->client->engine));
// Get the browser and version.
$this->appendBody(sprintf('<li>Browser: <em>%s (%s)</em></li>', $this->client->browser, $this->client->browserVersion));
$this->appendBody('</ul>');
// Finished up the HTML repsonse.
$this->appendBody('</body>')->appendBody('</html>');
}
}
// Instantiate the application object, passing the class name to JApplicationWeb::getInstance
// and use chaining to execute the application.
JApplicationWeb::getInstance('DetectClient')->execute();
示例9: doExecute
* @package ECR_COM_NAME
*/
class ECR_COM_NAME extends JApplicationWeb
{
/**
* Overrides the parent doExecute method to run the web application.
*
* This method should include your custom code that runs the application.
*
* @return void
*/
protected function doExecute()
{
// This application will just output a simple HTML document.
// Use the setBody method to set the output.
// JApplicationWeb will take care of all the headers and such for you.
$this->setBody('
<html>
<head>
<title>Hello WWW</title>
</head>
<body style="font-family:verdana;">
<p>Hello WWW!</p>
</body>
</html>');
}
}
// Instantiate the application object, passing the class name to JApplicationWeb::getInstance
// and use chaining to execute the application.
JApplicationWeb::getInstance('ECR_COM_NAME')->execute();
示例10: ob_start
$result = $db->loadObject();
if ($result && $result->otpKey != '')
{
//jimport('sourcecoast.utilities');
//SCStringUtilities::loadLanguage('mod_sclogin');
JFactory::getLanguage()->load('mod_sclogin');
//$password = JRequest::getString('p', '', 'POST', JREQUEST_ALLOWRAW);
//if (JUserHelper::verifyPassword($password, $result->password, $result->id))
//{
$response->needsOtp = 'true';
ob_start();
require(JModuleHelper::getLayoutPath('mod_sclogin', 'otp'));
$response->form = ob_get_clean();
//}
}
}
}
echo json_encode($response);
exit;
}
}
// Instantiate the application object, passing the class name to JCli::getInstance
// and use chaining to execute the application.
$app = JApplicationWeb::getInstance('SourcecoastTfaCheckWeb');
// Loading the 'site' application to make sure our session (and other) data is from the 'site'.. sounds obvious, but documenting it, because it won't be the next time I look at this.
JFactory::getApplication('site');
$app->execute();
示例11: getenv
/**
* Web server entry point for the WebService Application.
*
* @package WebService.Application
*
* @copyright Copyright (C) 2005 - 2012 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
*/
// Bootstrap the application.
$path = getenv('WEBSERVICE_HOME');
if ($path) {
require_once $path . '/bootstrap.php';
} else {
require_once realpath(__DIR__ . '/../code/bootstrap.php');
}
try {
// Instantiate the application.
$application = JApplicationWeb::getInstance('WebServiceApplicationWeb');
// Set the default JInput class for the application to use JSON input.
// $application->input = new JInputJson;
// Store the application.
JFactory::$application = $application;
// Execute the application.
$application->loadDatabase()->loadRouter()->execute();
} catch (Exception $e) {
// Set the server response code.
header('Status: 500', true, 500);
// An exception has been caught, echo the message and exit.
echo json_encode(array('message' => $e->getMessage(), 'code' => $e->getCode(), 'type' => get_class($e)));
exit;
}
示例12: doExecute
*/
class HelloWww extends JApplicationWeb
{
/**
* Overrides the parent doExecute method to run the web application.
*
* This method should include your custom code that runs the application.
*
* @return void
*
* @since 11.3
*/
protected function doExecute()
{
// This application will just output a simple HTML document.
// Use the setBody method to set the output.
// JApplicationWeb will take care of all the headers and such for you.
$this->setBody('<html>
<head>
<title>Hello WWW</title>
</head>
<body style="font-family:verdana;">
<p>Hello WWW!</p>
</body>
</html>');
}
}
// Instantiate the application object, passing the class name to JApplicationWeb::getInstance
// and use chaining to execute the application.
JApplicationWeb::getInstance('HelloWww')->execute();
示例13: define
}
if (!defined('JPATH_CACHE')) {
define('JPATH_CACHE', '/tmp/cache');
}
if (!defined('JPATH_CONFIGURATION')) {
define('JPATH_CONFIGURATION', $JAPIHOME . '/etc');
}
if (!defined('JPATH_API')) {
define('JPATH_API', $JAPIHOME . '/api');
}
if (!defined('JPATH_PLUGINS')) {
define('JPATH_PLUGINS', $JAPIHOME . '/plugins');
}
try {
// Fire up the API importer.
if (file_exists(JPATH_API . '/import.php')) {
require JPATH_API . '/import.php';
}
// Instantiate the application.
$application = JApplicationWeb::getInstance('ApiApplicationWeb');
// Store the application.
JFactory::$application = $application;
// Execute the application.
$application->loadSession()->loadDatabase()->loadIdentity()->loadDispatcher()->fetchStandardMaps()->loadRouter()->execute();
} catch (Exception $e) {
// Set the server response code.
header('Status: 500', true, 500);
// An exception has been caught, echo the message and exit.
echo json_encode(array('message' => $e->getMessage(), 'code' => $e->getCode(), 'type' => get_class($e)));
exit;
}
示例14: download
public function download()
{
// turn off all error reporting to prevent errors showing in download file
error_reporting(0);
jimport('joomla.filesystem.archive');
jimport('joomla.filesystem.archive.zip');
jimport('joomla.application.web');
JApplicationWeb::clearHeaders();
$path = JPATH_ADMINISTRATOR . '/components/com_joomailermailchimpintegration/templates/';
$folder = JRequest::getVar('template', '', '', 'string');
$fullPath = JPath::clean($path . '/' . $folder);
$files = JFolder::files($fullPath, '.', false, false);
$archive = $path . $folder . '.zip';
$filesData = array();
for ($i = 0; $i < count($files); $i++) {
$filesData[$i]['name'] = $files[$i];
$filesData[$i]['data'] = file_get_contents($fullPath . '/' . $files[$i]);
}
// delete file if it already exists
@chmod($path . '/' . $folder . '.zip', 0777);
@unlink($path . '/' . $folder . '.zip');
$JArchiveZip = JArchive::getAdapter('zip');
$JArchiveZip->create($archive, $filesData);
// push download
ob_end_clean();
ob_start();
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: public");
header("Content-Description: File Transfer");
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"{$folder}.zip\"");
header("Content-Transfer-Encoding: binary");
header("Content-Length: " . filesize($archive));
readfile($archive);
ob_end_flush();
}
示例15: display
/**
* Display
*
* @return bool
*
* @throws \Exception
* @since 1.7.2
*/
public function display()
{
// Get model data.
$item = $this->get('Item');
$middlename = null;
// Check for errors.
if (count($errors = $this->get('Errors')))
{
Throw new Exception(implode("\n", $errors));
}
JFactory::getDocument()->setMetaData('Content-Type', 'text/directory', true);
// Compute lastname, firstname and middlename
$item->name = trim($item->name);
// "Lastname, Firstname Midlename" format support
// e.g. "de Gaulle, Charles"
$namearray = explode(',', $item->name);
if (count($namearray) > 1)
{
$lastname = $namearray[0];
$card_name = $lastname;
$name_and_midname = trim($namearray[1]);
$firstname = '';
if (!empty($name_and_midname))
{
$namearray = explode(' ', $name_and_midname);
$firstname = $namearray[0];
$middlename = (count($namearray) > 1) ? $namearray[1] : '';
$card_name = $firstname . ' ' . ($middlename ? $middlename . ' ' : '') . $card_name;
}
}
// "Firstname Middlename Lastname" format support
else
{
$namearray = explode(' ', $item->name);
$middlename = (count($namearray) > 2) ? $namearray[1] : '';
$firstname = array_shift($namearray);
$lastname = count($namearray) ? end($namearray) : '';
$card_name = $firstname . ($middlename ? ' ' . $middlename : '') . ($lastname ? ' ' . $lastname : '');
}
$rev = date('c', strtotime($item->modified));
$web = new JApplicationWeb;
$web->setHeader('Content-disposition', 'attachment; filename="' . $card_name . '.vcf"', true);
$vcard = [];
$vcard[] .= 'BEGIN:VCARD';
$vcard[] .= 'VERSION:3.0';
$vcard[] = 'N:' . $lastname . ';' . $firstname . ';' . $middlename;
$vcard[] = 'FN:' . $item->name;
$vcard[] = 'TITLE:' . $item->con_position;
$vcard[] = 'TEL;TYPE=WORK,VOICE:' . $item->telephone;
$vcard[] = 'TEL;TYPE=WORK,FAX:' . $item->fax;
$vcard[] = 'TEL;TYPE=WORK,MOBILE:' . $item->mobile;
$vcard[] = 'ADR;TYPE=WORK:;;' . $item->address . ';' . $item->suburb . ';' . $item->state . ';' . $item->postcode . ';' . $item->country;
$vcard[] = 'LABEL;TYPE=WORK:' . $item->address . "\n" . $item->suburb . "\n" . $item->state . "\n" . $item->postcode . "\n" . $item->country;
$vcard[] = 'EMAIL;TYPE=PREF,INTERNET:' . $item->email_to;
$vcard[] = 'URL:' . $item->webpage;
$vcard[] = 'REV:' . $rev . 'Z';
$vcard[] = 'END:VCARD';
echo implode("\n", $vcard);
return true;
}