eSystem
[ class tree: eSystem ] [ index: eSystem ] [ all elements ]

Class: eSystem

Source Location: /eSystem/eSystem.php

Class Overview


Base class for system mapping api


Author(s):

Version:

  • $Revision$

Variables

Methods



Class Details

[line 34]
Base class for system mapping api



Tags:

version:  $Revision$
access:  public


[ Top ]


Class Variables

$retint =

[line 65]

Shell return code



Tags:

access:  public

Type:   integer


[ Top ]

$stderr =

[line 55]

Standard Error file description



Tags:

access:  public

Type:   reousrce


[ Top ]

$stdout =

[line 60]

Standard Out file description



Tags:

access:  public

Type:   reousrce


[ Top ]

$tmpdir =  '/tmp'

[line 49]

Location for create tmp file



Tags:

access:  public

Type:   string


[ Top ]



Class Methods


method backSpace [line 374]

void backSpace( integer $no)

print backspace

This API is Deprecated. Use ePrint::backSpace instead of this method




Tags:

see:  ePrint::backSpace()
deprecated:  deprecated since 1.0.1. Use ePrint::backSpace() instead of this method
access:  public


Parameters:

integer   $no   number of space charactor

[ Top ]

method boldStr [line 338]

string boldStr( string $str)

Return given string with white ansi code



Tags:

see:  ePrint::asPrintf()
deprecated:  deprecated since 1.0.1. Use ePrint::asPrintf(), white) instead of this method
access:  public


Parameters:

string   $str   Input strings

[ Top ]

method exec [line 149]

string exec( string $_cmd, [array &$_output = NULL], [integer &$_returncode = NULL])

Wrapping exec() function

If server admin disables php exec() function, this method has same execution with php exec().

You can use this api that change only exec(...) to $obj->exec(...)




Tags:

return:  Returns the last line of the command output on success, and FALSE on failure.
access:  public


Parameters:

string   $_cmd   The command that will be executed.
array   &$_output   (optional) If the _output argument is present, then the specified array will be filled with every line of output from the command. Trailing whitespace, such as \n, is not included in this array. Note that if the array already contains some elements, exec() will append to the end of the array. If you do not want the function to append elements, call unset() on the array before passing it to exec().
integer   &$_returncode   (optional) If the _returncode argument is present, then the return status of the executed command will be written to this variable.

[ Top ]

method execl [line 183]

string execl( string $_cmd, [string $_output = NULL], [integer $_returncode = NULL])

Wrapping exec() function

This method same $this->exec(), but return value of 2th argument is not array, it's plain text strings.




Tags:

return:  Returns the last line of the command output on success, and FALSE on failure.
access:  public


Parameters:

string   $_cmd   The command that will be executed.
string   $_output   (optional) If the _output argument is present, this argument contains output from the command.
integer   $_returncode   (optional) If the _returncode argument is present, then the return status of the executed command will be written to this variable.

[ Top ]

method file_nr [line 482]

array file_nr( string $f, [boolean $use_include_path = false], [resource $resource = null])

Reads entire file into an array file_nr api runs same file function of php. But file_nr has no \r\n or \n character on array members.



Tags:

return:  Array or false if not found file path nor file resource.
see:  ePrint::file_nr()
deprecated:  deprecated since 1.0.1. Use ePrint::file_nr() instead of this method
access:  public


Parameters:

string   $f   file path
boolean   $use_include_path   (optional) Search file path on include_path of php. Defaults is false.
resource   $resource   (optional) already opend file description resource Defaults is null.

[ Top ]

method find [line 299]

array find( [string $path = './'], [string $type = ''], [boolean $norecursive = false])

get file list that under given path



Tags:

return:  return array of file list. If given path is null or don't exist, return false.
see:  eFilesystem::find()
deprecated:  deprecated since 1.0.1. Use eFilesystem::find() instead of this method
access:  public


Parameters:

string   $path   (optional) Given path. Defaults to current directory (./)
string   $type   (optional) list type. Defaults to all.
f (get only files),
d (get only directories),
l (get only links),
fd (get only files and directories),
fl (get only files and links),
dl (get only directories and links)
/regex/ (use regular expression)
boolean   $norecursive   (optional) Defaults to false. set true, don't recursive search.

[ Top ]

method getopt [line 503]

string getopt( integer $argc, array $argv, string $optstrs)

Wrapping o_getopt on Oops C library This class is supported alternative getopt function.



Tags:

return:  return short option.
If return -1, end of getopt processing. If wrong option, print error message and return null
see:  oGetopt::exec()
deprecated:  deprecated since 1.0.1. Use oGetopt::exec() instead of this method
access:  public


Parameters:

integer   $argc   Number of command line arguments
array   $argv   Command line arguments
string   $optstrs   Option format. See also 'man 3 getopt'

[ Top ]

method makeWhiteSpace [line 356]

strings makeWhiteSpace( integer $no)

Print white space about given number



Tags:

see:  ePrint::whiteSpace()
deprecated:  deprecated since 1.0.1. Use ePrint::whiteSpace() instead of this method
access:  public


Parameters:

integer   $no   number of space charactor

[ Top ]

method man [line 573]

string man( string $_name, int $_no, [string $_int = NULL], [string $__base = null], [boolean $_s = false])

Return man page contents for human readable

The exmaple:

  1. echo "\n\nview bash man page (wait 3sec)\n";
  2. sleep (3);




Tags:

return:  Returns man page file path
access:  public


Parameters:

string   $_name   name of man page
int   $_no   Section of man page
string   $_int   (optional) L10n code for international man pages
string   $__base   (optional) Base man page base path
boolean   $_s   (optional) Defaults to 0. Set true, even if result is array, force convert plain text strings.

[ Top ]

method manPath [line 550]

string manPath( string $_name, [string $_path = '/usr/share/man'], [integer $_sec = 0])

Return man page file path with man page section and name

The exmaple:

  1. echo "bash man path:\n";
  2. print_r ($e->manPath ('bash'));




Tags:

return:  Returns man page file path
access:  public


Parameters:

string   $_name   Name of man page for searching
string   $_path   (optional) Base man page base path
integer   $_sec   (optional) Section of man page

[ Top ]

method mkdir_p [line 218]

boolean mkdir_p( string $path, [int $mode = 0755])

Attempts to create the directory specified by pathname.

If does not parent directory, this API create success. This means that same operate with mkdir (path, mode, true) of php




Tags:

return:  return false, create error by other error.
return true, create success.
see:  eFilesystem::mkdir_p()
deprecated:  deprecated since 1.0.1. Use eFilesystem::mkdir_p() instead of this method
access:  public


Parameters:

string   $path   given path
int   $mode   (optional) The mode is 0777 by default, which means the widest possible access. For more information on modes, read the details on the chmod() page.

[ Top ]

method printe [line 393]

int printe( string $format, [mixed $msg = ''])

Output a formatted string to stderr



Tags:

return:  length of output messages.
see:  ePrint::ePrintf()
deprecated:  deprecated since 1.0.1. Use ePrint::ePrintf() instead of this method
access:  public


Parameters:

string   $format   same format of printf
mixed   $msg   (optional) format value.
If only one format argument, $msg is strings or array.
For multiple format arguments, $msg is array.

[ Top ]

method print_f [line 416]

int print_f( $file, string $format, [mixed $msg = ''], string $path)

Save a formatted string to file

A newline is not automatically added to the end of the message string.




Tags:

return:  length of print string
see:  ePrint::lPrintf()
see:  ePrint::ePrintf()
deprecated:  deprecated since 1.0.1. Use ePrint::ePrintf() or ePrint::lPrintf() instead of this method
access:  public


Parameters:

string   $path   target file
string   $format   same format of printf
mixed   $msg   (optional) format value.
If only one format argument, $msg is strings or array.
For multiple format arguments, $msg is array.
   $file  

[ Top ]

method print_s [line 436]

int print_s( mixed $msg, [integer $width = 75], [integer $indent = 0], [string $ul = ''], [boolean $to_stderr = 0])

print with indent.



Tags:

return:  Length of print string. If on error, return false
see:  ePrint::printi()
deprecated:  deprecated since 1.0.1. Use ePrint::printi() instead of this method
access:  public


Parameters:

mixed   $msg   output string
integer   $width   (optional) location of line brek. default 80
integer   $indent   (optional) indent of each line
string   $ul   (optional) list itme
boolean   $to_stderr   (optional) set true, print stderr

[ Top ]

method putColor [line 319]

string putColor( string $str, [string $color = 'gray'])

Return given string with ansi code about specified color

Color strings support follows: gray, red, green, yellow, blue, megenta, cyan, white




Tags:

see:  ePrint::asPrintf()
deprecated:  deprecated since 1.0.1. Use ePrint::asPrintf() instead of this method
access:  public


Parameters:

string   $str   Input strings
string   $color   color string for anci code. Defaults to 'gray'

[ Top ]

method system [line 108]

string system( string $_cmd, [int &$_returncode = NULL])

Wrapping system function

If server admin disables php system() function, this method has same execution with php system().

You can use this api that change only system(...) to $obj->system(...)




Tags:

return:  Returns the last line of the command output on success, and FALSE on failure.
access:  public


Parameters:

string   $_cmd   The command that will be executed.
int   &$_returncode   (optional) If the _returncode argument is present, then the return status of the executed command will be written to this variable.

[ Top ]

method tree [line 273]

object object tree( [string $dir = '.'])

print directory tree for given path



Tags:

return:  members are follow:
obj->file is number of files.
obj->dir is number of directories.
see:  eFilesystem::tree()
deprecated:  deprecated since 1.0.1. Use eFilesystem::tree() instead of this method
access:  public


Parameters:

string   $dir   (optional) Given path. Defaults to current directory (./).

[ Top ]

method unlink [line 237]

int unlink( string $path)

Deletes a file. If given file is directory, no error and return false.



Tags:

return:  return true, success
return false, remove false
return 2, file not found
return 3, file is directory
see:  eFilesystem::safe_unlink()
deprecated:  deprecated since 1.0.1. Use eFilesystem::safe_unlnk() instead of this method
access:  public


Parameters:

string   $path   given file path

[ Top ]

method unlink_r [line 254]

boolean unlink_r( string $path)

Deletes a file or directory that include some files



Tags:

see:  eFilesystem::unlink_r()
deprecated:  deprecated since 1.0.1. Use eFilesystem::unlink_r() instead of this method
access:  public


Parameters:

string   $path   Given path. You can use Asterisk(*) or brace expand({a,b}) on path.

[ Top ]

method wordwrap [line 460]

strings wordwrap( string $msg, [integer $width = 75], [string $break = "\n"], [integer $cut = 0])

Wraps a string to a given number of characters. Difference with wordwarp of PHP, wrapped line joins next line and rewraps.



Tags:

see:  ePrint::wordwrap()
deprecated:  deprecated since 1.0.1. Use ePrint::wordwrap() instead of this method
access:  public


Parameters:

string   $msg   input string
integer   $width   (optional) The column widht. Defaults to 75
string   $break   (optional) The line is broken using the optional break parameter. Defaults to '\n'.
integer   $cut   (optional) If the cut is set to TRUE, the string is always wrapped at or before the specified width. So if you have a word that is larger than the given width, it is broken apart. Seealso wordwrap of php

[ Top ]


Documentation generated on Tue, 14 May 2019 02:00:01 +0900 by phpDocumentor 1.4.4