PHP Class Core, generatedata

Version history (please keep backward compatible): 1.0, 2008-10-09: Cornelius Hansjakob
Author: Cornelius Hansjakob (cha@massiveart.com)
显示文件 Open project: benkeen/generatedata Class Usage Examples

Public Properties

Property Type Description
$countryPlugins CountryPlugin
$dataTypePlugins
$db Database
$exportTypePlugins
$geoData GeoData
$language Language
$smarty Smarty
$translations Translations
$user Account

Public Methods

Method Description
checkAllowMultiUserAnonymousUse ( )
checkDemoMode ( ) TODO Yuck! Why does this return a boolean as a frickin' string?! Was I drunk?
checkIsInstalled ( ) Full installation of the program is determined by (a) the settings.php file existing and (b) the "installationComplete" setting value existing in the database. Note: this function assumes the database connection in Core::$db has already been created.
checkIsLoggedIn ( )
checkSettingsFileExists ( )
getContinents ( )
getDataTypeGroups ( )
getDbName ( )
getDbPassword ( )
getDbTablePrefix ( )
getDbUsername ( )
getDefaultCountryPlugins ( )
getDefaultExportType ( ) Returns the out-the-box default Export Type.
getDefaultLanguageFile ( )
getDefaultNumRows ( )
getDefaultTheme ( ) Used during the installation process only: it returns the default theme for new installations.
getEncryptionSalt ( )
getHostname ( )
getMaxDataSetHistorySize ( )
getMaxDemoModeRows ( )
getMaxGeneratedRows ( )
getMinimumMySQLVersion ( ) Returns the minimum MySQL version required to run this script. Used during installation to ensure the server environment is adequate.
getMinimumPHPVersion ( ) Returns the minimum PHP version required to run this script. Used during installation to ensure the server environment is adequate.
getPluginSettings ( $pluginType, $pluginFolder ) : mixed Added in 3.1.4. This allows any plugins to have custom settings defined in $pluginSettings. This function returns null if no settings exist for the plugin, or whatever settings have been provided.
getVersion ( )
init ( string $runtimeContext = "ui" ) Core::init()
initSessions ( )
initUser ( boolean $bypass = false ) Initializes the current logged in user and stores their Account object in Core::$user.
isApiEnabled ( ) : boolean Determines whether the REST API functionality is available or not.
isInstalling ( )
isSmartySecurityEnabled ( )
isUsingMinifiedResources ( ) : boolean Returns a boolean signifying whether we should use the minified + bundled resources generated via Grunt.

Private Methods

Method Description
initCountries ( ) Called by Core::init(), this initializes Core::$countryPlugins.
initDataTypes ( $runtimeContext ) Called by Core::init(), this initializes Core::$dataTypePlugins. Note that this will contain ALL installed plugins, not those that are selected by a particular user. In 3.2.2 that feature was added, so use Account::getDataTypePlugins() instead.
initDatabase ( ) Initializes the Database object and stores it in Core::$db.
initExportTypes ( $runtimeContext ) Called by Core::init(), this initializes Core::$exportTypePlugins.
initGeoData ( ) This function returns the actual data populated in the database by the Country plugins. It returns an array of country data, contains regions and cities.
initSmarty ( ) Initializes the Smarty object used for things like rendering the Smarty templates found in resources/templates/ - and for other misc uses.
loadSettingsFile ( ) Core::loadSettingsFile()

Method Details

checkAllowMultiUserAnonymousUse() public static method

checkDemoMode() public static method

TODO Yuck! Why does this return a boolean as a frickin' string?! Was I drunk?
public static checkDemoMode ( )

checkIsInstalled() public static method

Full installation of the program is determined by (a) the settings.php file existing and (b) the "installationComplete" setting value existing in the database. Note: this function assumes the database connection in Core::$db has already been created.
public static checkIsInstalled ( )

checkIsLoggedIn() public static method

public static checkIsLoggedIn ( )

checkSettingsFileExists() public static method

public static checkSettingsFileExists ( )

getContinents() public static method

public static getContinents ( )

getDataTypeGroups() public static method

public static getDataTypeGroups ( )

getDbName() public static method

public static getDbName ( )

getDbPassword() public static method

public static getDbPassword ( )

getDbTablePrefix() public static method

public static getDbTablePrefix ( )

getDbUsername() public static method

public static getDbUsername ( )

getDefaultCountryPlugins() public static method

public static getDefaultCountryPlugins ( )

getDefaultExportType() public static method

Returns the out-the-box default Export Type.
public static getDefaultExportType ( )

getDefaultLanguageFile() public static method

public static getDefaultLanguageFile ( )

getDefaultNumRows() public static method

public static getDefaultNumRows ( )

getDefaultTheme() public static method

Used during the installation process only: it returns the default theme for new installations.
public static getDefaultTheme ( )

getEncryptionSalt() public static method

public static getEncryptionSalt ( )

getHostname() public static method

public static getHostname ( )

getMaxDataSetHistorySize() public static method

public static getMaxDataSetHistorySize ( )

getMaxDemoModeRows() public static method

public static getMaxDemoModeRows ( )

getMaxGeneratedRows() public static method

public static getMaxGeneratedRows ( )

getMinimumMySQLVersion() public static method

Returns the minimum MySQL version required to run this script. Used during installation to ensure the server environment is adequate.
public static getMinimumMySQLVersion ( )

getMinimumPHPVersion() public static method

Returns the minimum PHP version required to run this script. Used during installation to ensure the server environment is adequate.
public static getMinimumPHPVersion ( )

getPluginSettings() public static method

Added in 3.1.4. This allows any plugins to have custom settings defined in $pluginSettings. This function returns null if no settings exist for the plugin, or whatever settings have been provided.
public static getPluginSettings ( $pluginType, $pluginFolder ) : mixed
$pluginType
$pluginFolder
return mixed

getVersion() public static method

public static getVersion ( )

init() public static method

Our initialization function. This is called on all page requests to initialize the Core object. Since it's also used during installation (when the database and/or plugins haven't been installed), the optional parameter controls whether or not the database object, plugins, sessions and user should be initialized. Different call contexts require different initialization.
public static init ( string $runtimeContext = "ui" )
$runtimeContext string This determines the context in which the Core is being initialized. This info is used to let plugins instantiate themselves differently, as well as prevent the loading of incomplete parts of the script.
installation: a fresh installation, DB not installed yet
installationDatabaseReady: during installation after the DB has been installed
ui: (default) for the main generator page
generation: when we're in the process of creating actual data resetPlugins: initialized everything except the plugins, which may be safely reset

initSessions() public static method

public static initSessions ( )

initUser() public static method

Initializes the current logged in user and stores their Account object in Core::$user.
public static initUser ( boolean $bypass = false )
$bypass boolean

isApiEnabled() public static method

Determines whether the REST API functionality is available or not.
public static isApiEnabled ( ) : boolean
return boolean

isInstalling() public static method

public static isInstalling ( )

isSmartySecurityEnabled() public static method

public static isSmartySecurityEnabled ( )

isUsingMinifiedResources() public static method

Returns a boolean signifying whether we should use the minified + bundled resources generated via Grunt.
public static isUsingMinifiedResources ( ) : boolean
return boolean

Property Details

$countryPlugins public_oe static_oe property

public static CountryPlugin $countryPlugins
return CountryPlugin

$dataTypePlugins public_oe static_oe property

public static $dataTypePlugins

$db public_oe static_oe property

public static Database $db
return Database

$exportTypePlugins public_oe static_oe property

public static $exportTypePlugins

$geoData public_oe static_oe property

public static GeoData $geoData
return GeoData

$language public_oe static_oe property

public static Language $language
return Language

$smarty public_oe static_oe property

public static Smarty $smarty
return Smarty

$translations public_oe static_oe property

public static Translations $translations
return Translations

$user public_oe static_oe property

public static Account $user
return Account