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

Class: System_Folders_Cached

Source Location: /System_Folders-1.0.5/System/Folders/Cached.php

Class Overview

System_Folders
   |
   --System_Folders_Cached

Provides a cached version of System_Folders.


Author(s):

Variables

Methods


Inherited Variables

Inherited Methods

Class: System_Folders

System_Folders::System_Folders()
Constructor; initializes the system variable.
System_Folders::addTrailingSlash()
Adds a trailing slash to the given path if there is none.
System_Folders::fixWindowsPath()
Directories in windows environment variables sometimes have a double backslash, and this needs to be fixed.
System_Folders::getAllUsers()
Returns the All Users directory.
System_Folders::getAppData()
Returns the path to the application data directory.
System_Folders::getCOMPath()
Loads a windows path via COM using $objCom.
System_Folders::getDesktop()
Returns the path to the user's desktop.
System_Folders::getDocuments()
Returns the path to the user's documents directory.
System_Folders::getHome()
Returns the path to the user's home directory.
System_Folders::getPrograms()
Returns the path to the programs directory.
System_Folders::getSharedDocuments()
Returns the path to the shared documents directory.
System_Folders::getSys()
Returns the name of the guesses system.
System_Folders::getTemp()
Returns the path to the directory for temporary files.
System_Folders::getUserName()
Returns the name for the user under which name the program runs.
System_Folders::getWindows()
Returns the windows directory (if any).
System_Folders::loadCOM()
Loads the COM object into the $objCom variable.
System_Folders::tryPaths()
Loops through a list of given paths and checks which of them are correct.

Class Details

[line 49]
Provides a cached version of System_Folders.

It also has methods to read folder settings from an ini file.

Be very careful when overriding the AppData setting with setAppData()! When loading a config file without specifying the file name, the default app data directory will be used. After loading, the file will be saved to the new app data directory, thus it won't be available the next time, as the app data folder is the old one again.



[ Top ]


Class Variables

$arCache = array()

[line 57]

The cached paths will be hold here.
  • Access: protected

Type:   array


[ Top ]

$arSettings = array(
        'AllUsers', 'AppData', 'Desktop', 'Documents', 'Home',
        'Programs', 'Temp', 'SharedDocuments', 'Windows'
    )

[line 65]

The settings that are available.
  • Access: protected

Type:   array


[ Top ]



Method Detail

System_Folders_Cached (Constructor)   [line 75]

System_Folders_Cached System_Folders_Cached( )

Create a new instance

[ Top ]

getAllUsers   [line 239]

string getAllUsers( )

Cached version of getAllUsers().

Overrides System_Folders::getAllUsers() (Returns the All Users directory.)
[ Top ]

getAppData   [line 255]

string getAppData( )

Cached version of getAppData().

Overrides System_Folders::getAppData() (Returns the path to the application data directory.)
[ Top ]

getCachedValue   [line 189]

string getCachedValue( string $strKey)

Returns a cached value.

If the cache doesn't exist, the cached value is empty or null, the System_Folders method for the key is called to get the value.

  • Return: The directory
  • Access: protected

Parameters:

string   $strKey     The id of the value to get

[ Top ]

getDefaultConfigFile   [line 171]

string getDefaultConfigFile( )

Returns the path to the default config file.

It the one that's used if no filename is passed to the saveToFile/loadFromFile methods.

  • Return: The filename
  • Access: public

[ Top ]

getDesktop   [line 271]

string getDesktop( )

Cached version of getDesktop().

Overrides System_Folders::getDesktop() (Returns the path to the user's desktop.)
[ Top ]

getDocuments   [line 287]

string getDocuments( )

Cached version of getDocuments().

Overrides System_Folders::getDocuments() (Returns the path to the user's documents directory.)
[ Top ]

getHome   [line 303]

string getHome( )

Cached version of getHome().

Overrides System_Folders::getHome() (Returns the path to the user's home directory.)
[ Top ]

getPrograms   [line 319]

string getPrograms( )

Cached version of getPrograms().

Overrides System_Folders::getPrograms() (Returns the path to the programs directory.)
[ Top ]

getSharedDocuments   [line 351]

string getSharedDocuments( )

Cached version of getSharedDocuments().

Overrides System_Folders::getSharedDocuments() (Returns the path to the shared documents directory.)
[ Top ]

getTemp   [line 335]

string getTemp( )

Cached version of getTemp().

Overrides System_Folders::getTemp() (Returns the path to the directory for temporary files.)
[ Top ]

getWindows   [line 367]

string getWindows( )

Cached version of getWindows().

Overrides System_Folders::getWindows() (Returns the windows directory (if any).)
[ Top ]

loadFromFile   [line 93]

mixed loadFromFile( [string $strFile = null])

Loads the directories from an ini file.

If you don't specify the config file, it will be determined automatically.

  • Return: True on success, PEAR_Error on failure
  • Access: public

Parameters:

string   $strFile     The file to load the data from (ini file)

[ Top ]

saveToFile   [line 139]

mixed saveToFile( [string $strFile = null], [boolean $bSaveAllSettings = true])

Saves the folders into a config file that can be edited by hand.

If you don't specify the config file, it will be determined automatically. Values that are NULL won't be saved.

  • Return: True on success, PEAR_Error on failure
  • Access: public

Parameters:

string   $strFile     The file to save the data into (ini file)
boolean   $bSaveAllSettings     If all settings shall be saved that can be loaded, or only that settings, that have been retrieved by the user

[ Top ]

setAllUsers   [line 392]

void setAllUsers( string $value)

Sets an own all users directory.

Set it to NULL to deactivate saving and remove the value from the cache.


Parameters:

string   $value     The new all users directory

[ Top ]

setAppData   [line 411]

void setAppData( string $value)

Sets an own application data directory.

Set it to NULL to deactivate saving and remove the value from the cache.


Parameters:

string   $value     The new app data directory

[ Top ]

setCachedValue   [line 213]

void setCachedValue( string $strKey, string $strValue)

Sets the cache of the given key to the given value.

Passing NULL removes the cache entry.

  • Access: protected

Parameters:

string   $strKey     Id of the value to get
string   $strValue     Value to set.

[ Top ]

setDesktop   [line 430]

void setDesktop( string $value)

Sets an own desktop directory.

Set it to NULL to deactivate saving and remove the value from the cache.


Parameters:

string   $value     The new desktop directory

[ Top ]

setDocuments   [line 449]

void setDocuments( string $value)

Sets an own documents directory.

Set it to NULL to deactivate saving and remove the value from the cache.


Parameters:

string   $value     The new documents directory

[ Top ]

setHome   [line 468]

void setHome( string $value)

Sets an own home directory.

Set it to NULL to deactivate saving and remove the value from the cache.


Parameters:

string   $value     The new home directory

[ Top ]

setPrograms   [line 487]

void setPrograms( string $value)

Sets an own programs directory.

Set it to NULL to deactivate saving and remove the value from the cache.


Parameters:

string   $value     The new programs directory

[ Top ]

setSharedDocuments   [line 525]

void setSharedDocuments( string $value)

Sets an own shared documents directory.

Set it to NULL to deactivate saving and remove the value from the cache.


Parameters:

string   $value     The new shared documents directory

[ Top ]

setTemp   [line 506]

void setTemp( string $value)

Sets an own temp directory.

Set it to NULL to deactivate saving and remove the value from the cache.


Parameters:

string   $value     The new temp directory

[ Top ]

setWindows   [line 544]

void setWindows( string $value)

Sets an own windows directory.

Set it to NULL to deactivate saving and remove the value from the cache.


Parameters:

string   $value     The new windows directory

[ Top ]


Documentation generated on Fri, 21 Dec 2012 15:30:02 +0000 by phpDocumentor 1.4.3. PEAR Logo Copyright © PHP Group 2004.