Source for file Launcher.php
Documentation is available at Launcher.php
/* vim: set expandtab tabstop=4 shiftwidth=4 softtabstop=4: */
* Launch files with the associated application.
* require_once 'System/Launcher.php';
* $launcher = new System_Launcher;
* $launcher->launch('/data/docs/index.html', true);
* Windows: start <filename>
* KDE kfmclient exec <filename>
* Portland xdg-open <filename>
* Gnome gnome-open <filename>
* Mac OSX open <filename>
* @package System_Launcher
* @author Christian Weiske <cweiske@php.net>
* @author Olle Jonsson <olle.jonsson@gmail.com>
* @license http://www.gnu.org/licenses/lgpl.html LGPL
* @link http://github.com/olleolleolle/System_Launcher
* @since File available since Release 0.1.0
require_once 'Launcher/Exception.php';
require_once 'Launcher/Driver.php';
require_once 'Launcher/Driver/GNOME.php';
require_once 'Launcher/Driver/KDE.php';
require_once 'Launcher/Driver/Mac.php';
/** Driver for Portland */
require_once 'Launcher/Driver/Portland.php';
/** Driver for Windows */
require_once 'Launcher/Driver/Windows.php';
* Launches files with the associated application.
* @package System_Launcher
* @author Christian Weiske <cweiske@php.net>
* @author Olle Jonsson <olle.jonsson@gmail.com>
* @copyright 1997-2005 Christian Weiske
* @license http://www.gnu.org/licenses/lgpl.html LGPL
* @version Release: 0.5.1
* @link http://github.com/olleolleolle/System_Launcher
* The driver for detected operating system.
* Ordered list of drivers to test.
* Sets up a list of operating system checkers.
* @param array $drivers List of System_Launcher_Driver checkers.
* Tries to detect the current operating system and set its driver.
foreach ($this->drivers as $driver) {
if ($driver->applies ()) {
* Returns the appropriate command to launch the given file name,
* depending on the operating system and the desktop environment.
* @param boolean $runInBackground True if the application should be run in the
* @return string The command to execute
$commandTemplate = $this->os->getCommand ($runInBackground);
if ($commandTemplate === '') {
* Launches a file or URL with its associated application.
* @param string $fileName The file or URL to open
* @param boolean $runInBackground True if the application should be run in the
* @return boolean True if all was ok, false if there has been a problem
public function launch($fileName, $runInBackground=false )
$this->getCommand($runInBackground), $this->cleanFileName ($fileName)
* Removes initial dashes to avoid injection of command parameters.
* @param string $fileName Possibly malicious filename
* @return string Cleaned filename
* Launches a file or URL in the background.
* @param string $fileName The file or URL to open
* @return boolean True if all was ok, false if there has been a problem
return $this->launch($fileName, true );
* Returns last command output as lines of text.
Documentation generated on Wed, 02 Jan 2013 22:00:02 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.
|