Created
January 30, 2017 17:34
-
-
Save strsar/b0631fb954fd3d960a6f72741531510a to your computer and use it in GitHub Desktop.
[Joomla!] - Create standalone application
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Custom standalone application | |
| * | |
| * @package Joomla.Cli | |
| * @application Stand-alone | |
| */ | |
| define('_JEXEC', 1); | |
| ini_set('magic_quotes_runtime', 0); | |
| ini_set('max_execution_time', 0); | |
| if(file_exists(dirname(dirname(__FILE__)).'/defines.php')){ | |
| require_once dirname(dirname(__FILE__)).'/defines.php'; | |
| } | |
| if(!defined('_JDEFINES')){ | |
| define('JPATH_BASE', dirname(dirname(__FILE__))); | |
| require_once JPATH_BASE.'/includes/defines.php'; | |
| } | |
| require_once JPATH_LIBRARIES.'/import.php'; | |
| require_once JPATH_LIBRARIES.'/cms.php'; | |
| JError::$legacy = true; | |
| require_once JPATH_CONFIGURATION.'/configuration.php'; | |
| /** | |
| * Custom application class | |
| */ | |
| class CustomApplication extends JApplicationWeb { | |
| protected function doExecute(){ | |
| $code = 'Code'; | |
| $site = JURI::current(); | |
| $return = $site.' - '.$code.' Example'; | |
| // Displays view | |
| $this->setBody($return); | |
| } | |
| } | |
| // Instantiate the application. | |
| $application = CustomApplication::getInstance('CustomApplication'); | |
| // Run the application | |
| $application->execute(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment