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

Class: System_Folders

Source Location: /System_Folders-0.1.5/Folders.php

Class Overview


Provides the locations of several system and user directories independent of the operating system used.


Author(s):

Variables

Methods


Child classes:

System_Folders_Cached
Provides a cached version of System_Folders.

Inherited Variables

Inherited Methods


Class Details

[line 42]
Provides the locations of several system and user directories independent of the operating system used.

If a path does not exist or can't be found (error), NULL is returned.

The class uses both $_ENV and $_SERVER to retrieve the environment paths, as this seems to be different between php4 and 5.



[ Top ]


Class Variables

$arAppDataNames = array(
        'Application data',       //english
        'Anwendungsdaten',        //german
        'Toepassingsgegevens',    //dutch
        'Datos de programa',      //spanish
        'Dados de aplicativos',   //portugese
        'Data aplikací',          //czech
        'Programdata',            //norwegian
        'Henkilokohtainen',       //finnish
        'Donnees d\'applications',//french
        'Dati applicazioni',      //italian
        'Dane aplikacji',         //polish
    )

[line 68]

Known names for the application directory in windows.
  • Access: protected

Type:   array


[ Top ]

$arDesktop = array(
        'Desktop' //english, german
    )

[line 103]

Known names for the my Desktop directory.
  • Access: protected

Type:   array


[ Top ]

$arDocsAndSettings = array(
        'C:\\Documents and Settings\\',     //english
        'C:\\Dokumente und Einstellungen\\' //german
    )

[line 129]

Known paths for the documents and settings directory on windows.
  • Access: protected

Type:   array


[ Top ]

$arDocumentsLinux = array(
        'Documents',    //english
        'Dokumente'     //german
    )

[line 116]

Known names for the my documents directory on linux and mac.
  • Access: protected

Type:   array


[ Top ]

$arDocumentsWindows = array(
        'My Documents',  //english
        'Own Files',     //english?
        'Eigene Dateien' //german
    )

[line 90]

Known names for the my documents directory on windows.
  • Access: protected

Type:   array


[ Top ]

$arProgramsWindows = array(
        'C:\\Program Files\\',
        'C:\\Programs\\',
        'C:\\Programme\\',     //german
    )

[line 141]

Known paths for the programs directory on windows.
  • Access: protected

Type:   array


[ Top ]

$arSharedDocumentsWindows = array(
        'Documents', //english
        'Dokumente' //german
    )

[line 157]

Known names for the shared documents directory on windows.

Although the explorer shows "Shared documents" or "Gemeinsame Dokumente", the *real* directory is only one of the ones here.

  • Access: protected

Type:   array


[ Top ]

$arWindowsDirs = array(
        'C:\\WINDOWS\\',
        'C:\\WINNT\\',
        'C:\\WIN98\\',
        'C:\\WIN95\\',
        'C:\\WIN2000\\',
        'C:\\WIN2K\\',
        'C:\\WINXP\\'
    )

[line 168]

Known paths for the windows directory.
  • Access: protected

Type:   array


[ Top ]

$sys =  'unknown'

[line 59]

The operating system on which we work here Gotten from OS_Guess::getSysname()

Values (are lowercase):

  • windows
  • linux
  • darwin
use the SYS_* constants to check it

  • Access: protected

Type:   string


[ Top ]



Method Detail

System_Folders (Constructor)   [line 184]

System_Folders System_Folders( )

Constructor; initializes the system variable.

[ Top ]

getAllUsers   [line 263]

string getAllUsers( )

Returns the All Users directory.

Works on windows only, returns NULL if not found.

  • Return: The all users directory
  • Access: public

Overridden in child classes as:

System_Folders_Cached::getAllUsers()
Cached version of getAllUsers().

[ Top ]

getAppData   [line 302]

string getAppData( )

Returns the path to the application data directory.

This is the directory in which applications save their settings.

On Windows, this is an own directory called "Application data", on *nix, the home directory is used. MacOS X has two application settings directories:

  • $HOME/Library/Preferences/<pref_file> for normal settings
  • $HOME/Library/Application Support/<app_name>/ for data files that that the application needs to store
This method returns the latter, as it works for both storing just prefs and files in an application specific subdir. That's not 100% correct for apple, but it will work.

  • Return: The application data directory
  • Access: public

Overridden in child classes as:

System_Folders_Cached::getAppData()
Cached version of getAppData().

[ Top ]

getDesktop   [line 336]

string getDesktop( )

Returns the path to the user's desktop.
  • Return: The user's desktop
  • Access: public

Overridden in child classes as:

System_Folders_Cached::getDesktop()
Cached version of getDesktop().

[ Top ]

getDocuments   [line 358]

string getDocuments( )

Returns the path to the user's documents directory.

(normally below the home folder)

  • Return: The "documents" directory
  • Access: public

Overridden in child classes as:

System_Folders_Cached::getDocuments()
Cached version of getDocuments().

[ Top ]

getHome   [line 387]

string getHome( )

Returns the path to the user's home directory.
  • Return: The user's home directory
  • Access: public

Overridden in child classes as:

System_Folders_Cached::getHome()
Cached version of getHome().

[ Top ]

getPrograms   [line 447]

string getPrograms( )

Returns the path to the programs directory.

This is the dir where all programs are installed normally.

On windows, it's mostly "C:\Programs\", on linux, the /opt/ directory is returned.

  • Return: The programs directory
  • Access: public

Overridden in child classes as:

System_Folders_Cached::getPrograms()
Cached version of getPrograms().

[ Top ]

getSharedDocuments   [line 515]

string getSharedDocuments( )

Returns the path to the shared documents directory.

Supports windows only (at least for now) as no other operating system seems to have such a folder. Returns NULL on failure (not windows or not found).

  • Return: The shared documents dir
  • Access: public

Overridden in child classes as:

System_Folders_Cached::getSharedDocuments()
Cached version of getSharedDocuments().

[ Top ]

getSys   [line 537]

string getSys( )

Returns the name of the guesses system.

Can be compared with SYS_* constants.

  • Return: The detected system
  • Access: public

[ Top ]

getTemp   [line 479]

string getTemp( )

Returns the path to the directory for temporary files.
  • Return: The temporary directory
  • Access: public

Overridden in child classes as:

System_Folders_Cached::getTemp()
Cached version of getTemp().

[ Top ]

getUserName   [line 560]

string getUserName( )

Returns the name for the user under which name the program runs.

This function returns the *system user name*, not the name with forename and surname On unix, this would be e.g. 'fbar' or so for the user 'Foo Bar'

This method is used my most other methods, so recognizing the user name is really important. Be sure to check this method if the others fail.

  • Return: The user name
  • Access: public

[ Top ]

getWindows   [line 591]

string getWindows( )

Returns the windows directory (if any).

NULL is returned if the system is not Windows.

  • Return: The windows directory
  • Access: public

Overridden in child classes as:

System_Folders_Cached::getWindows()
Cached version of getWindows().

[ Top ]


Documentation generated on Mon, 11 Mar 2019 14:38:26 -0400 by phpDocumentor 1.4.4. PEAR Logo Copyright © PHP Group 2004.