Bearsampp 2026.9.23
Loading...
Searching...
No Matches
PEAR_Frontend Class Reference
Inheritance diagram for PEAR_Frontend:
Collaboration diagram for PEAR_Frontend:

Public Member Functions

 log ($msg, $append_crlf=true)
 outputData ($data, $command='_default')
 runPostinstallScripts (&$scripts)
 setConfig (&$config)
 userDialog ($command, $prompts, $types=array(), $defaults=array())
Public Member Functions inherited from PEAR
 __call ($method, $arguments)
 __construct ($error_class=null)
 _checkDelExpect ($error_code)
 _PEAR ()
 delExpect ($error_code)
 expectError ($code=' *')
 PEAR ($error_class=null)
 popExpect ()

Static Public Member Functions

static addTempFile ($file)
static isIncludeable ($path)
static & setFrontendClass ($uiclass)
static & setFrontendObject ($uiobject)
static & singleton ($type=null)
Static Public Member Functions inherited from PEAR
static __callStatic ($method, $arguments)
static getSourceDateEpoch ()
static & getStaticProperty ($class, $var)
static isError ($data, $code=null)
static loadExtension ($ext)
static registerShutdownFunc ($func, $args=array())
static staticPopErrorHandling ()
static staticPushErrorHandling ($mode, $options=null)

Additional Inherited Members

Data Fields inherited from PEAR
 $_debug = false
 $_default_error_handler = ''
 $_default_error_mode = null
 $_default_error_options = null
 $_error_class = 'PEAR_Error'
 $_expected_errors = array()
Static Protected Member Functions inherited from PEAR
static _popErrorHandling ($object)
static _pushErrorHandling ($object, $mode, $options=null)
static _raiseError ($object, $message=null, $code=null, $mode=null, $options=null, $userinfo=null, $error_class=null, $skipmsg=false)
static _setErrorHandling ( $object, $mode=null, $options=null)
static _throwError ($object, $message=null, $code=null, $userinfo=null)
Static Protected Attributes inherited from PEAR
static $bivalentMethods

Detailed Description

Definition at line 45 of file Frontend.php.

Member Function Documentation

◆ addTempFile()

addTempFile ( $file)
static

This can be overridden to allow session-based temporary file management

By default, all files are deleted at the end of a session. The web installer needs to be able to sustain a list over many sessions in order to support user interaction with install scripts

Definition at line 163 of file Frontend.php.

164 {
165 $GLOBALS['_PEAR_Common_tempfiles'][] = $file;
166 }
$GLOBALS['_PEAR_FRONTEND_CLASS']
Definition Frontend.php:25

References $GLOBALS.

Referenced by PEAR_Common\addTempFile().

Here is the caller graph for this function:

◆ isIncludeable()

isIncludeable ( $path)
static
Parameters
string$pathrelative or absolute include path
Returns
boolean

Definition at line 134 of file Frontend.php.

135 {
136 if (file_exists($path) && is_readable($path)) {
137 return true;
138 }
139
140 $fp = @fopen($path, 'r', true);
141 if ($fp) {
142 fclose($fp);
143 return true;
144 }
145
146 return false;
147 }

Referenced by setFrontendClass().

Here is the caller graph for this function:

◆ log()

log ( $msg,
$append_crlf = true )

Log an action

Parameters
string$msgthe message to log
boolean$append_crlf
Returns
boolean true @abstract

Reimplemented in PEAR_Frontend_CLI.

Definition at line 176 of file Frontend.php.

177 {
178 }

◆ outputData()

outputData ( $data,
$command = '_default' )

Display human-friendly output formatted depending on the $command parameter.

This should be able to handle basic output data with no command

Parameters
mixed$datadata structure containing the information to display
string$commandcommand from which this method was called @abstract

Reimplemented in PEAR_Frontend_CLI.

Definition at line 199 of file Frontend.php.

200 {
201 }

References $command.

◆ runPostinstallScripts()

runPostinstallScripts ( & $scripts)

Run a post-installation script

Parameters
array$scriptsarray of post-install scripts @abstract

Reimplemented in PEAR_Frontend_CLI.

Definition at line 186 of file Frontend.php.

187 {
188 }

◆ setConfig()

setConfig ( & $config)
Parameters
PEAR_Config

Definition at line 152 of file Frontend.php.

153 {
154 }

References $config.

◆ setFrontendClass()

& setFrontendClass ( $uiclass)
static

Set the frontend class that will be used by calls to singleton()

Frontends are expected to conform to the PEAR naming standard of _ => DIRECTORY_SEPARATOR (PEAR_Frontend_CLI is in PEAR/Frontend/CLI.php)

Parameters
string$uiclassfull class name
Returns
PEAR_Frontend

Definition at line 73 of file Frontend.php.

74 {
75 if (is_object($GLOBALS['_PEAR_FRONTEND_SINGLETON']) &&
76 is_a($GLOBALS['_PEAR_FRONTEND_SINGLETON'], $uiclass)) {
77 return $GLOBALS['_PEAR_FRONTEND_SINGLETON'];
78 }
79
80 if (!class_exists($uiclass)) {
81 $file = str_replace('_', '/', $uiclass) . '.php';
83 include_once $file;
84 }
85 }
86
87 if (class_exists($uiclass)) {
88 $obj = new $uiclass;
89 // quick test to see if this class implements a few of the most
90 // important frontend methods
91 if (is_a($obj, 'PEAR_Frontend')) {
92 $GLOBALS['_PEAR_FRONTEND_SINGLETON'] = &$obj;
93 $GLOBALS['_PEAR_FRONTEND_CLASS'] = $uiclass;
94 return $obj;
95 }
96
97 $err = PEAR::raiseError("not a frontend class: $uiclass");
98 return $err;
99 }
100
101 $err = PEAR::raiseError("no such class: $uiclass");
102 return $err;
103 }
static isIncludeable($path)
Definition Frontend.php:134

References $GLOBALS, and isIncludeable().

Referenced by PEAR_Command\setFrontendClass(), and singleton().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setFrontendObject()

& setFrontendObject ( $uiobject)
static

Set the frontend class that will be used by calls to singleton()

Frontends are expected to be a descendant of PEAR_Frontend

Parameters
PEAR_Frontend
Returns
PEAR_Frontend

Definition at line 112 of file Frontend.php.

113 {
114 if (is_object($GLOBALS['_PEAR_FRONTEND_SINGLETON']) &&
115 is_a($GLOBALS['_PEAR_FRONTEND_SINGLETON'], get_class($uiobject))) {
116 return $GLOBALS['_PEAR_FRONTEND_SINGLETON'];
117 }
118
119 if (!is_a($uiobject, 'PEAR_Frontend')) {
120 $err = PEAR::raiseError('not a valid frontend class: (' .
121 get_class($uiobject) . ')');
122 return $err;
123 }
124
125 $GLOBALS['_PEAR_FRONTEND_SINGLETON'] = &$uiobject;
126 $GLOBALS['_PEAR_FRONTEND_CLASS'] = get_class($uiobject);
127 return $uiobject;
128 }

References $GLOBALS.

◆ singleton()

& singleton ( $type = null)
static

Retrieve the frontend object

Returns
PEAR_Frontend_CLI|PEAR_Frontend_Web|PEAR_Frontend_Gtk

Definition at line 51 of file Frontend.php.

52 {
53 if ($type === null) {
54 if (!isset($GLOBALS['_PEAR_FRONTEND_SINGLETON'])) {
55 $a = false;
56 return $a;
57 }
58 return $GLOBALS['_PEAR_FRONTEND_SINGLETON'];
59 }
60
62 return $a;
63 }
static & setFrontendClass($uiclass)
Definition Frontend.php:73

References $GLOBALS, and setFrontendClass().

Referenced by PEAR_Registry\_addPackage2(), PEAR_Command\getFrontendObject(), PEAR_REST_10\listAll(), PEAR_Common\log(), and PEAR_PackageFile_v2\runPostinstallScripts().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ userDialog()

userDialog ( $command,
$prompts,
$types = array(),
$defaults = array() )

Display a modal form dialog and return the given input

A frontend that requires multiple requests to retrieve and process data must take these needs into account, and implement the request handling code.

Parameters
string$commandcommand from which this method was called
array$promptsassociative array. keys are the input field names and values are the description
array$typesarray of input field types (text, password, etc.) keys have to be the same like in $prompts
array$defaultsarray of default values. again keys have to be the same like in $prompts. Do not depend on a default value being set.
Returns
array input sent by the user @abstract

Definition at line 220 of file Frontend.php.

221 {
222 }

References $command.


The documentation for this class was generated from the following file:
  • E:/Bearsampp-development/sandbox/core/libs/php/pear/pear/PEAR/Frontend.php