Bearsampp 2026.9.23
Loading...
Searching...
No Matches
Frontend.php
Go to the documentation of this file.
1<?php
15
19//require_once 'PEAR.php';
20
25$GLOBALS['_PEAR_FRONTEND_CLASS'] = 'PEAR_Frontend_CLI';
26
31$GLOBALS['_PEAR_FRONTEND_SINGLETON'] = null;
32
45class PEAR_Frontend extends PEAR
46{
51 public static function &singleton($type = null)
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 }
64
73 public static function &setFrontendClass($uiclass)
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 }
104
112 public static function &setFrontendObject($uiobject)
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 }
129
134 public static function isIncludeable($path)
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 }
148
153 {
154 }
155
163 static function addTempFile($file)
164 {
165 $GLOBALS['_PEAR_Common_tempfiles'][] = $file;
166 }
167
176 function log($msg, $append_crlf = true)
177 {
178 }
179
186 function runPostinstallScripts(&$scripts)
187 {
188 }
189
199 function outputData($data, $command = '_default')
200 {
201 }
202
220 function userDialog($command, $prompts, $types = array(), $defaults = array())
221 {
222 }
223}
$GLOBALS['_PEAR_FRONTEND_CLASS']
Definition Frontend.php:25
$GLOBALS['_PEAR_default_error_mode']
Definition PEAR.php:46
runPostinstallScripts(&$scripts)
Definition Frontend.php:186
userDialog($command, $prompts, $types=array(), $defaults=array())
Definition Frontend.php:220
static & setFrontendObject($uiobject)
Definition Frontend.php:112
setConfig(&$config)
Definition Frontend.php:152
static & setFrontendClass($uiclass)
Definition Frontend.php:73
static addTempFile($file)
Definition Frontend.php:163
static & singleton($type=null)
Definition Frontend.php:51
log($msg, $append_crlf=true)
Definition Frontend.php:176
static isIncludeable($path)
Definition Frontend.php:134
outputData($data, $command='_default')
Definition Frontend.php:199
$config
Definition pearcmd.php:182
if( $raw) foreach($opts as $opt) if( $store_system_config) if($store_user_config) $command
Definition pearcmd.php:322