本文整理汇总了PHP中JApplicationWeb::getInstance方法的典型用法代码示例。如果您正苦于以下问题:PHP JApplicationWeb::getInstance方法的具体用法?PHP JApplicationWeb::getInstance怎么用?PHP JApplicationWeb::getInstance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JApplicationWeb
的用法示例。
在下文中一共展示了JApplicationWeb::getInstance方法的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
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);
}
示例3: __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'));
}
示例4: foreach
foreach ($result as $r) {
echo '<a href="' . $r['full_url'] . '" title="' . $r['title'] . '">
<img src="' . $r['thumbnail_url'] . '" width="' . $r['thumbnail_width'] . '" height="' . $r['thumbnail_height'] . '" alt="' . $r['title'] . '" />
</a>';
}
// Get the buffer output.
$output = ob_get_clean();
// Push the output into the document buffer.
$this->document->setBuffer($output, array('type' => 'component', 'name' => 'main'));
}
/**
* Method to get the template name. This is needed for compatability with JApplication.
*
* @return string The theme name.
*
* @since 12.1
*/
public function getTemplate()
{
return $this->get('theme');
}
}
// Instantiate the application.
$application = JApplicationWeb::getInstance('PicasaPhotos');
// Initialise the application.
$application->initialise();
// Store the application.
JFactory::$application = $application;
// Execute the application.
$application->execute();
//echo 'PicasaPhotos';
示例5: 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();
示例6: testGetInstance
/**
* Tests the JApplicationWeb::getInstance method.
*
* @return void
*
* @since 11.3
*/
public function testGetInstance()
{
$this->assertInstanceOf('JApplicationWebInspector', JApplicationWeb::getInstance('JApplicationWebInspector'));
TestReflection::setValue('JApplicationWeb', 'instance', 'foo');
$this->assertEquals('foo', JApplicationWeb::getInstance('JApplicationWebInspector'));
TestReflection::setValue('JApplicationWeb', 'instance', null);
$this->assertInstanceOf('JApplicationWeb', JApplicationWeb::getInstance('Foo'));
}
示例7: 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();
示例8: testGetInstance
/**
* Tests the JApplicationWeb::getInstance method.
*
* @return void
*
* @since 11.3
*/
public function testGetInstance()
{
$this->assertInstanceOf('JApplicationWebInspector', JApplicationWeb::getInstance('JApplicationWebInspector'), 'Tests that getInstance will instantiate a valid child class of JApplicationWeb.');
TestReflection::setValue('JApplicationWeb', 'instance', 'foo');
$this->assertThat(JApplicationWeb::getInstance('JApplicationWebInspector'), $this->equalTo('foo'), 'Tests that singleton value is returned.');
TestReflection::setValue('JApplicationWeb', 'instance', null);
$this->assertInstanceOf('JApplicationWeb', JApplicationWeb::getInstance('Foo'), 'Tests that getInstance will instantiate a valid child class of JApplicationWeb given a non-existent type.');
}
示例9: 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();
示例10:
//
// 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();
示例11: define
<?php
/**
* Constant that is checked in included files to prevent direct access.
*/
const _JEXEC = 1;
// Define the paths we need
const JPATH_BASE = __DIR__;
const JPATH_ROOT = __DIR__;
define('JPATH_THEMES', JPATH_BASE . '/templates');
define('JPATH_LIBRARIES', dirname(JPATH_ROOT) . '/libraries');
// Set up the environment
error_reporting(E_ALL);
ini_set('display_errors', true);
const JDEBUG = false;
// Import the Joomla Platform.
require_once JPATH_LIBRARIES . '/import.php';
// Register the prefix for our classes
JLoader::registerPrefix('G', JPATH_BASE);
// Get the application
$app = JApplicationWeb::getInstance('GApplicationWeb');
// Execute the application
$app->execute();
示例12: define
<?php
// Set the Joomla execution flag.
define('_JEXEC', 1);
##*HEADER*##
version_compare(PHP_VERSION, '5.3', '>=') || die('This script requires PHP >= 5.3');
try {
require_once realpath(__DIR__ . '/../code/bootstrap.php');
// Instantiate the application.
$application = JApplicationWeb::getInstance('ECR_CLASS_PREFIXApplicationWeb');
defined('JDEBUG') || define('JDEBUG', $application->get('debug') ? 1 : 0);
// Set all loggers to echo.
if (JDEBUG) {
JLog::addLogger(array('logger' => 'echo'), JLog::ALL);
}
// Store the application.
JFactory::$application = $application;
// Execute the application.
$application->execute();
} catch (Exception $e) {
// An exception has been caught, just echo the message.
echo '<p style="color: red">' . $e->getMessage() . '</p>';
debug_print_backtrace();
echo '<pre>' . print_r($e, 1) . '</pre>';
JLog::add($e->getMessage(), JLog::ERROR);
exit($e->getCode());
}
示例13: 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;
}
示例14: 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();
示例15: 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;
}