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

Public Member Functions

 __construct ()
 _PEAR_Common ()
 _postProcessChecks ($pf)
 _postProcessValidPackagexml (&$pf)
 buildProvidesArray ($srcinfo)
 detectDependencies ($any, $status_callback=null)
 downloadHttp ( $url, &$ui, $save_dir='.', $callback=null, $lastmodified=null, $accept=false, $channel=false)
 infoFromAny ($info)
 infoFromDescriptionFile ($descfile)
 infoFromString ($data)
 infoFromTgzFile ($file)
 log ($level, $msg, $append_crlf=true)
 mkDirHier ($dir)
 mkTempDir ($tmpdir='')
 setFrontendObject (&$ui)
 validatePackageInfo ($info, &$errors, &$warnings, $dir_prefix='')
 validPackageName ($name)
 validPackageVersion ($ver)
 xmlFromInfo ($pkginfo)
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 analyzeSourceCode ($file)
static betterStates ($state, $include=false)
static getDependencyRelations ()
static getDependencyTypes ()
static getFileRoles ()
static getProvideTypes ()
static getReleaseStates ()
static getReplacementTypes ()
static getScriptPhases ()
static getUserRoles ()
static isIncludeable ($path)
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)

Data Fields

 $_validPackageFile
 $config = null
 $current_attributes = array()
 $current_element
 $current_path = null
 $element_stack = array()
 $pkginfo = array()
 $ui = null
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()

Additional Inherited Members

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 126 of file Common.php.

Constructor & Destructor Documentation

◆ __construct()

__construct ( )

PEAR_Common constructor

@access public

Definition at line 167 of file Common.php.

168 {
169 parent::__construct();
170 $this->config = &PEAR_Config::singleton();
171 $this->debug = $this->config->get('verbose');
172 }

Member Function Documentation

◆ _PEAR_Common()

_PEAR_Common ( )

PEAR_Common destructor

@access private

Definition at line 179 of file Common.php.

180 {
181 // doesn't work due to bug #14744
182 //$tempfiles = $this->_tempfiles;
183 $tempfiles =& $GLOBALS['_PEAR_Common_tempfiles'];
184 while ($file = array_shift($tempfiles)) {
185 if (@is_dir($file)) {
186 if (!class_exists('System')) {
187 require_once 'System.php';
188 }
189
190 System::rm(array('-rf', $file));
191 } elseif (file_exists($file)) {
192 unlink($file);
193 }
194 }
195 }
$GLOBALS['_PEAR_Common_tempfiles']
Definition Common.php:61
static rm($args)
Definition System.php:210

References $GLOBALS.

◆ _postProcessChecks()

_postProcessChecks ( $pf)

Definition at line 449 of file Common.php.

450 {
451 if (!PEAR::isError($pf)) {
452 return $this->_postProcessValidPackagexml($pf);
453 }
454
455 $errs = $pf->getUserinfo();
456 if (is_array($errs)) {
457 foreach ($errs as $error) {
458 $e = $this->raiseError($error['message'], $error['code'], null, null, $error);
459 }
460 }
461
462 return $pf;
463 }
_postProcessValidPackagexml(&$pf)
Definition Common.php:526

References _postProcessValidPackagexml(), and PEAR\isError().

Referenced by infoFromDescriptionFile(), infoFromString(), and infoFromTgzFile().

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

◆ _postProcessValidPackagexml()

_postProcessValidPackagexml ( & $pf)
Parameters
PEAR_PackageFile_v1|PEAR_PackageFile_v2
Returns
array

Definition at line 526 of file Common.php.

527 {
528 if (!is_a($pf, 'PEAR_PackageFile_v2')) {
529 $this->pkginfo = $pf->toArray();
530 return $this->pkginfo;
531 }
532
533 // sort of make this into a package.xml 1.0-style array
534 // changelog is not converted to old format.
535 $arr = $pf->toArray(true);
536 $arr = array_merge($arr, $arr['old']);
537 unset($arr['old'], $arr['xsdversion'], $arr['contents'], $arr['compatible'],
538 $arr['channel'], $arr['uri'], $arr['dependencies'], $arr['phprelease'],
539 $arr['extsrcrelease'], $arr['zendextsrcrelease'], $arr['extbinrelease'],
540 $arr['zendextbinrelease'], $arr['bundle'], $arr['lead'], $arr['developer'],
541 $arr['helper'], $arr['contributor']);
542 $arr['filelist'] = $pf->getFilelist();
543 $this->pkginfo = $arr;
544 return $arr;
545 }

References $pkginfo.

Referenced by _postProcessChecks(), and infoFromAny().

Here is the caller graph for this function:

◆ addTempFile()

addTempFile ( $file)
static

Register a temporary file or directory. When the destructor is executed, all registered temporary files and directories are removed.

Parameters
string$filename of file or directory
Returns
void

@access public

Definition at line 208 of file Common.php.

209 {
210 if (!class_exists('PEAR_Frontend')) {
211 require_once 'PEAR/Frontend.php';
212 }
214 }
static addTempFile($file)
Definition Frontend.php:163

References PEAR_Frontend\addTempFile().

Referenced by PEAR_Builder\build(), and mkTempDir().

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

◆ analyzeSourceCode()

analyzeSourceCode ( $file)
static

Analyze the source code of the given PHP file

Parameters
stringFilename of the PHP file
Returns
mixed @access public

Definition at line 721 of file Common.php.

722 {
723 if (!class_exists('PEAR_PackageFile_v2_Validator')) {
724 require_once 'PEAR/PackageFile/v2/Validator.php';
725 }
726
727 $a = new PEAR_PackageFile_v2_Validator;
728 return $a->analyzeSourceCode($file);
729 }

References PEAR_PackageFile_v2_Validator\analyzeSourceCode().

Referenced by detectDependencies().

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

◆ betterStates()

betterStates ( $state,
$include = false )
static

Return an array containing all of the states that are more stable than or equal to the passed in state

Parameters
stringRelease state
booleanDetermines whether to include $state in the list
Returns
false|array False if $state is not a valid release state

Definition at line 307 of file Common.php.

308 {
309 static $states = array('snapshot', 'devel', 'alpha', 'beta', 'stable');
310 $i = array_search($state, $states);
311 if ($i === false) {
312 return false;
313 }
314 if ($include) {
315 $i--;
316 }
317 return array_slice($states, $i + 1);
318 }

Referenced by PEAR_Downloader_Package\_analyzeDownloadURL(), and PEAR_Command_Remote\doListUpgrades().

Here is the caller graph for this function:

◆ buildProvidesArray()

buildProvidesArray ( $srcinfo)

Build a "provides" array from data returned by analyzeSourceCode(). The format of the built array is like this:

array( 'class;MyClass' => 'array('type' => 'class', 'name' => 'MyClass'), ... )

Parameters
array$srcinfoarray with information about a source file as returned by the analyzeSourceCode() method.
Returns
void

@access public

Definition at line 662 of file Common.php.

663 {
664 $file = basename($srcinfo['source_file']);
665 $pn = '';
666 if (isset($this->_packageName)) {
667 $pn = $this->_packageName;
668 }
669
670 $pnl = strlen($pn);
671 foreach ($srcinfo['declared_classes'] as $class) {
672 $key = "class;$class";
673 if (isset($this->pkginfo['provides'][$key])) {
674 continue;
675 }
676
677 $this->pkginfo['provides'][$key] =
678 array('file'=> $file, 'type' => 'class', 'name' => $class);
679 if (isset($srcinfo['inheritance'][$class])) {
680 $this->pkginfo['provides'][$key]['extends'] =
681 $srcinfo['inheritance'][$class];
682 }
683 }
684
685 foreach ($srcinfo['declared_methods'] as $class => $methods) {
686 foreach ($methods as $method) {
687 $function = "$class::$method";
688 $key = "function;$function";
689 if ($method[0] == '_' || !strcasecmp($method, $class) ||
690 isset($this->pkginfo['provides'][$key])) {
691 continue;
692 }
693
694 $this->pkginfo['provides'][$key] =
695 array('file'=> $file, 'type' => 'function', 'name' => $function);
696 }
697 }
698
699 foreach ($srcinfo['declared_functions'] as $function) {
700 $key = "function;$function";
701 if ($function[0] == '_' || isset($this->pkginfo['provides'][$key])) {
702 continue;
703 }
704
705 if (!strstr($function, '::') && strncasecmp($function, $pn, $pnl)) {
706 $warnings[] = "in1 " . $file . ": function \"$function\" not prefixed with package name \"$pn\"";
707 }
708
709 $this->pkginfo['provides'][$key] =
710 array('file'=> $file, 'type' => 'function', 'name' => $function);
711 }
712 }

◆ detectDependencies()

detectDependencies ( $any,
$status_callback = null )

Definition at line 731 of file Common.php.

732 {
733 if (!function_exists("token_get_all")) {
734 return false;
735 }
736
737 if (PEAR::isError($info = $this->infoFromAny($any))) {
738 return $this->raiseError($info);
739 }
740
741 if (!is_array($info)) {
742 return false;
743 }
744
745 $deps = array();
746 $used_c = $decl_c = $decl_f = $decl_m = array();
747 foreach ($info['filelist'] as $file => $fa) {
748 $tmp = $this->analyzeSourceCode($file);
749 $used_c = @array_merge($used_c, $tmp['used_classes']);
750 $decl_c = @array_merge($decl_c, $tmp['declared_classes']);
751 $decl_f = @array_merge($decl_f, $tmp['declared_functions']);
752 $decl_m = @array_merge($decl_m, $tmp['declared_methods']);
753 $inheri = @array_merge($inheri, $tmp['inheritance']);
754 }
755
756 $used_c = array_unique($used_c);
757 $decl_c = array_unique($decl_c);
758 $undecl_c = array_diff($used_c, $decl_c);
759
760 return array('used_classes' => $used_c,
761 'declared_classes' => $decl_c,
762 'declared_methods' => $decl_m,
763 'declared_functions' => $decl_f,
764 'undeclared_classes' => $undecl_c,
765 'inheritance' => $inheri,
766 );
767 }
infoFromAny($info)
Definition Common.php:558
static analyzeSourceCode($file)
Definition Common.php:721

References analyzeSourceCode(), infoFromAny(), and PEAR\isError().

Here is the call graph for this function:

◆ downloadHttp()

downloadHttp ( $url,
& $ui,
$save_dir = '.',
$callback = null,
$lastmodified = null,
$accept = false,
$channel = false )

Download a file through HTTP. Considers suggested file name in Content-disposition: header and can run a callback function for different events. The callback will be called with two parameters: the callback type, and parameters. The implemented callback types are:

'setup' called at the very beginning, parameter is a UI object that should be used for all output 'message' the parameter is a string with an informational message 'saveas' may be used to save with a different file name, the parameter is the filename that is about to be used. If a 'saveas' callback returns a non-empty string, that file name will be used as the filename instead. Note that $save_dir will not be affected by this, only the basename of the file. 'start' download is starting, parameter is number of bytes that are expected, or -1 if unknown 'bytesread' parameter is the number of bytes read so far 'done' download is complete, parameter is the total number of bytes read 'connfailed' if the TCP connection fails, this callback is called with array(host,port,errno,errmsg) 'writefailed' if writing to disk fails, this callback is called with array(destfile,errmsg)

If an HTTP proxy has been configured (http_proxy PEAR_Config setting), the proxy will be used.

Parameters
string$urlthe URL to download
object$uiPEAR_Frontend_* instance
object$configPEAR_Config instance
string$save_dir(optional) directory to save file in
mixed$callback(optional) function/method to call for status updates
false | string | array$lastmodifiedheader values to check against for caching use false to return the header values from this download
false | array$acceptAccept headers to send
false | string$channelChannel to use for retrieving authentication
Returns
mixed Returns the full path of the downloaded file or a PEAR error on failure. If the error is caused by socket-related errors, the error object will have the fsockopen error code available through getCode(). If caching is requested, then return the header values. If $lastmodified was given and the there are no changes, boolean false is returned.

@access public

Definition at line 823 of file Common.php.

826 {
827 if (!class_exists('PEAR_Downloader')) {
828 require_once 'PEAR/Downloader.php';
829 }
831 $this, $url, $ui, $save_dir, $callback, $lastmodified,
832 $accept, $channel
833 );
834 }
static _downloadHttp( $object, $url, &$ui, $save_dir='.', $callback=null, $lastmodified=null, $accept=false, $channel=false)

References $ui, and PEAR_Downloader\_downloadHttp().

Referenced by PEAR_Downloader\discover(), and PEAR_Downloader\download().

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

◆ getDependencyRelations()

getDependencyRelations ( )
static

Get the implemented dependency relations (has, lt, ge etc.)

Returns
array

Definition at line 355 of file Common.php.

356 {
357 return $GLOBALS['_PEAR_Common_dependency_relations'];
358 }

References $GLOBALS.

Referenced by PEAR_PackageFile_v1\validate().

Here is the caller graph for this function:

◆ getDependencyTypes()

getDependencyTypes ( )
static

Get the implemented dependency types (php, ext, pkg etc.)

Returns
array

Definition at line 345 of file Common.php.

346 {
347 return $GLOBALS['_PEAR_Common_dependency_types'];
348 }

References $GLOBALS.

Referenced by PEAR_PackageFile_v1\validate().

Here is the caller graph for this function:

◆ getFileRoles()

getFileRoles ( )
static

Get the implemented file roles

Returns
array

Definition at line 365 of file Common.php.

366 {
367 return $GLOBALS['_PEAR_Common_file_roles'];
368 }

References $GLOBALS.

Referenced by PEAR_Command_Pickle\_convertPackage(), and PEAR_PackageFile_v1\validate().

Here is the caller graph for this function:

◆ getProvideTypes()

getProvideTypes ( )
static

Get the implemented file replacement types in

Returns
array

Definition at line 385 of file Common.php.

386 {
387 return $GLOBALS['_PEAR_Common_provide_types'];
388 }

References $GLOBALS.

◆ getReleaseStates()

getReleaseStates ( )
static

Get the valid package release states of packages

Returns
array

Definition at line 335 of file Common.php.

336 {
337 return $GLOBALS['_PEAR_Common_release_states'];
338 }

References $GLOBALS.

◆ getReplacementTypes()

getReplacementTypes ( )
static

Get the implemented file replacement types in

Returns
array

Definition at line 375 of file Common.php.

376 {
377 return $GLOBALS['_PEAR_Common_replacement_types'];
378 }

References $GLOBALS.

◆ getScriptPhases()

getScriptPhases ( )
static

Get the implemented file replacement types in

Returns
array

Definition at line 395 of file Common.php.

396 {
397 return $GLOBALS['_PEAR_Common_script_phases'];
398 }

References $GLOBALS.

◆ getUserRoles()

getUserRoles ( )
static

Get the valid roles for a PEAR package maintainer

Returns
array

Definition at line 325 of file Common.php.

326 {
327 return $GLOBALS['_PEAR_Common_maintainer_roles'];
328 }

References $GLOBALS.

Referenced by PEAR_PackageFile_v1\validate().

Here is the caller graph for this function:

◆ infoFromAny()

infoFromAny ( $info)

Returns package information from different sources

This method is able to extract information about a package from a .tgz archive or from a XML package definition file.

@access public

Parameters
stringFilename of the source ('package.xml', '<package>.tgz')
Returns
string
Deprecated
use PEAR_PackageFile->fromAnyFile() instead

Definition at line 558 of file Common.php.

559 {
560 if (is_string($info) && file_exists($info)) {
561 $packagefile = new PEAR_PackageFile($this->config);
562 $pf = &$packagefile->fromAnyFile($info, PEAR_VALIDATE_NORMAL);
563 if (PEAR::isError($pf)) {
564 $errs = $pf->getUserinfo();
565 if (is_array($errs)) {
566 foreach ($errs as $error) {
567 $e = $this->raiseError($error['message'], $error['code'], null, null, $error);
568 }
569 }
570
571 return $pf;
572 }
573
574 return $this->_postProcessValidPackagexml($pf);
575 }
576
577 return $info;
578 }
const PEAR_VALIDATE_NORMAL
Definition Validate.php:20

References _postProcessValidPackagexml(), PEAR\isError(), and PEAR_VALIDATE_NORMAL.

Referenced by detectDependencies().

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

◆ infoFromDescriptionFile()

infoFromDescriptionFile ( $descfile)

Returns information about a package file. Expects the name of a package xml file as input.

Parameters
string$descfilename of package xml file
Returns
array array with package information

@access public

Deprecated
use PEAR_PackageFile->fromPackageFile() instead

Definition at line 496 of file Common.php.

497 {
498 $packagefile = new PEAR_PackageFile($this->config);
499 $pf = &$packagefile->fromPackageFile($descfile, PEAR_VALIDATE_NORMAL);
500 return $this->_postProcessChecks($pf);
501 }
_postProcessChecks($pf)
Definition Common.php:449

References _postProcessChecks(), and PEAR_VALIDATE_NORMAL.

Here is the call graph for this function:

◆ infoFromString()

infoFromString ( $data)

Returns information about a package file. Expects the contents of a package xml file as input.

Parameters
string$datacontents of package.xml file
Returns
array array with package information

@access public

Deprecated
use PEAR_PackageFile->fromXmlstring() instead

Definition at line 515 of file Common.php.

516 {
517 $packagefile = new PEAR_PackageFile($this->config);
518 $pf = &$packagefile->fromXmlString($data, PEAR_VALIDATE_NORMAL, false);
519 return $this->_postProcessChecks($pf);
520 }

References _postProcessChecks(), and PEAR_VALIDATE_NORMAL.

Here is the call graph for this function:

◆ infoFromTgzFile()

infoFromTgzFile ( $file)

Returns information about a package file. Expects the name of a gzipped tar file as input.

Parameters
string$filename of .tgz file
Returns
array array with package information

@access public

Deprecated
use PEAR_PackageFile->fromTgzFile() instead

Definition at line 477 of file Common.php.

478 {
479 $packagefile = new PEAR_PackageFile($this->config);
480 $pf = &$packagefile->fromTgzFile($file, PEAR_VALIDATE_NORMAL);
481 return $this->_postProcessChecks($pf);
482 }

References _postProcessChecks(), and PEAR_VALIDATE_NORMAL.

Here is the call graph for this function:

◆ isIncludeable()

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

Definition at line 432 of file Common.php.

433 {
434 if (file_exists($path) && is_readable($path)) {
435 return true;
436 }
437
438 $ipath = explode(PATH_SEPARATOR, ini_get('include_path'));
439 foreach ($ipath as $include) {
440 $test = realpath($include . DIRECTORY_SEPARATOR . $path);
441 if (file_exists($test) && is_readable($test)) {
442 return true;
443 }
444 }
445
446 return false;
447 }

◆ log()

log ( $level,
$msg,
$append_crlf = true )

Logging method.

Parameters
int$levellog level (0 is quiet, higher is noisier)
string$msgmessage to write to the log
Returns
void

Reimplemented in PEAR_Builder.

Definition at line 244 of file Common.php.

245 {
246 if ($this->debug >= $level) {
247 if (!class_exists('PEAR_Frontend')) {
248 require_once 'PEAR/Frontend.php';
249 }
250
252 if (is_a($ui, 'PEAR_Frontend')) {
253 $ui->log($msg, $append_crlf);
254 } else {
255 print "$msg\n";
256 }
257 }
258 }
static & singleton($type=null)
Definition Frontend.php:51

References $ui, and PEAR_Frontend\singleton().

Referenced by PEAR_Installer\_compileSourceFiles(), PEAR_Downloader\_downloadCallback(), PEAR_Downloader\_getDepPackageDownloadUrl(), PEAR_Installer\_installFile(), PEAR_Installer\_installFile2(), PEAR_Installer\_parsePackageXml(), PEAR_Installer\addFileOperation(), PEAR_Downloader\analyzeDependencies(), PEAR_Installer\commitFileTransaction(), PEAR_Downloader\discover(), PEAR_Downloader\download(), PEAR_Downloader\getDownloadDir(), PEAR_Installer\install(), mkDirHier(), PEAR_Packager\package(), PEAR_Installer\rollbackFileTransaction(), and PEAR_Installer\uninstall().

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

◆ mkDirHier()

mkDirHier ( $dir)

Wrapper to System::mkDir(), creates a directory as well as any necessary parent directories.

Parameters
string$dirdirectory name
Returns
bool TRUE on success, or a PEAR error

@access public

Reimplemented in PEAR_Installer.

Definition at line 226 of file Common.php.

227 {
228 // Only used in Installer - move it there ?
229 $this->log(2, "+ create dir $dir");
230 if (!class_exists('System')) {
231 require_once 'System.php';
232 }
233 return System::mkDir(array('-p', $dir));
234 }
log($level, $msg, $append_crlf=true)
Definition Common.php:244
static mkDir($args)
Definition System.php:254

References log().

Here is the call graph for this function:

◆ mkTempDir()

mkTempDir ( $tmpdir = '')

Create and register a temporary directory.

Parameters
string$tmpdir(optional) Directory to use as tmpdir. Will use system defaults (for example /tmp or c:\windows\temp) if not specified
Returns
string name of created directory

@access public

Definition at line 271 of file Common.php.

272 {
273 $topt = $tmpdir ? array('-t', $tmpdir) : array();
274 $topt = array_merge($topt, array('-d', 'pear'));
275 if (!class_exists('System')) {
276 require_once 'System.php';
277 }
278
279 if (!$tmpdir = System::mktemp($topt)) {
280 return false;
281 }
282
283 self::addTempFile($tmpdir);
284 return $tmpdir;
285 }
static addTempFile($file)
Definition Common.php:208

References addTempFile().

Here is the call graph for this function:

◆ setFrontendObject()

setFrontendObject ( & $ui)

Set object that represents the frontend to be used.

Parameters
objectReference of the frontend object
Returns
void @access public

Definition at line 294 of file Common.php.

295 {
296 $this->ui = &$ui;
297 }

References $ui.

Referenced by PEAR_Builder\__construct(), and PEAR_Installer\__construct().

Here is the caller graph for this function:

◆ validatePackageInfo()

validatePackageInfo ( $info,
& $errors,
& $warnings,
$dir_prefix = '' )

Validate XML package definition file.

Parameters
string$infoFilename of the package archive or of the package definition file
array$errorsArray that will contain the errors
array$warningsArray that will contain the warnings
string$dir_prefix(optional) directory where source files may be found, or empty if they are not available @access public
Returns
boolean
Deprecated
use the validation of PEAR_PackageFile objects

Definition at line 613 of file Common.php.

614 {
615 $config = &PEAR_Config::singleton();
616 $packagefile = new PEAR_PackageFile($config);
618 if (strpos($info, '<?xml') !== false) {
619 $pf = &$packagefile->fromXmlString($info, PEAR_VALIDATE_NORMAL, '');
620 } else {
621 $pf = &$packagefile->fromAnyFile($info, PEAR_VALIDATE_NORMAL);
622 }
623
625 if (PEAR::isError($pf)) {
626 $errs = $pf->getUserinfo();
627 if (is_array($errs)) {
628 foreach ($errs as $error) {
629 if ($error['level'] == 'error') {
630 $errors[] = $error['message'];
631 } else {
632 $warnings[] = $error['message'];
633 }
634 }
635 }
636
637 return false;
638 }
639
640 return true;
641 }
const PEAR_ERROR_RETURN
Definition PEAR.php:24
static staticPopErrorHandling()
Definition PEAR.php:654
static staticPushErrorHandling($mode, $options=null)
Definition PEAR.php:619

References $config, PEAR\isError(), PEAR_ERROR_RETURN, PEAR_VALIDATE_NORMAL, PEAR\staticPopErrorHandling(), and PEAR\staticPushErrorHandling().

Here is the call graph for this function:

◆ validPackageName()

validPackageName ( $name)

Test whether a string contains a valid package name.

Parameters
string$namethe package name to test
Returns
bool

@access public

Definition at line 409 of file Common.php.

410 {
411 return (bool)preg_match(PEAR_COMMON_PACKAGE_NAME_PREG, $name);
412 }
const PEAR_COMMON_PACKAGE_NAME_PREG
Definition Common.php:29

References PEAR_COMMON_PACKAGE_NAME_PREG.

◆ validPackageVersion()

validPackageVersion ( $ver)

Test whether a string contains a valid package version.

Parameters
string$verthe package version to test
Returns
bool

@access public

Definition at line 423 of file Common.php.

424 {
425 return (bool)preg_match(PEAR_COMMON_PACKAGE_VERSION_PREG, $ver);
426 }
const PEAR_COMMON_PACKAGE_VERSION_PREG
Definition Common.php:33

References PEAR_COMMON_PACKAGE_VERSION_PREG.

◆ xmlFromInfo()

xmlFromInfo ( $pkginfo)

Return an XML document based on the package info (as returned by the PEAR_Common::infoFrom* methods).

Parameters
array$pkginfopackage info
Returns
string XML data

@access public

Deprecated
use a PEAR_PackageFile_v* object's generator instead

Definition at line 591 of file Common.php.

592 {
593 $config = &PEAR_Config::singleton();
594 $packagefile = new PEAR_PackageFile($config);
595 $pf = &$packagefile->fromArray($pkginfo);
596 $gen = &$pf->getDefaultGenerator();
597 return $gen->toXml(PEAR_VALIDATE_PACKAGING);
598 }
const PEAR_VALIDATE_PACKAGING
Definition Validate.php:22

References $config, $pkginfo, and PEAR_VALIDATE_PACKAGING.

Field Documentation

◆ $_validPackageFile

$_validPackageFile

Definition at line 160 of file Common.php.

◆ $config

◆ $current_attributes

$current_attributes = array()

array of attributes of the currently parsed XML element

Definition at line 148 of file Common.php.

◆ $current_element

$current_element

name of currently parsed XML element

Definition at line 145 of file Common.php.

◆ $current_path

$current_path = null

Definition at line 153 of file Common.php.

◆ $element_stack

$element_stack = array()

stack of elements, gives some sort of XML context

Definition at line 142 of file Common.php.

◆ $pkginfo

$pkginfo = array()

assoc with information about a package

Definition at line 151 of file Common.php.

Referenced by _postProcessValidPackagexml(), and xmlFromInfo().

◆ $ui


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