![]() |
PHPDevShell 3.1.3-Stable
PHP OOP RAD Development Framework
|
Public Member Functions | |
| __construct ($dependance) | |
| connect () | |
| connector ($connector=null) | |
| newQuery ($query) | |
| sqlQuery ($query) | |
| invokeQuery ($query_name) | |
| invokeQueryWith ($query_name, $params) | |
| makeQuery ($query_name) | |
| startTransaction () | |
| endTransaction () | |
| protect ($param) | |
| protectArray (array $a, $quote= '') | |
| tableExist ($table) | |
| countRows ($table_name, $column=false) | |
| logMenuAccess () | |
| logThis () | |
| getRoles ($user_id=false, $return_array=false) | |
| getGroups ($user_id=false, $return_array=false, $alias_only=false) | |
| roleExist ($role_id) | |
| groupExist ($group_id) | |
| belongsToRole ($user_id=false, $user_role) | |
| belongsToGroup ($user_id=false, $user_group) | |
| setRoleQuery ($query_request, $query_root_request=false) | |
| setGroupQuery ($query_request, $query_root_request=false) | |
| settingsPrefix ($custom_prefix=false) | |
| writeSettings ($write_settings, $custom_prefix= '', $notes=array()) | |
| deleteSettings ($settings_to_delete=false, $custom_prefix=false) | |
| getSettings ($settings_required=false, $custom_prefix=false) | |
| getEssentialSettings () | |
| doesRecordExist ($table_name, $search_column_names, $search_field_values, $column_name_for_exclusion=false, $exclude_field_value=false) | |
| selectQuick ($from_table_name, $select_column_name, $where_column_name, $is_equal_to_column_value) | |
| deleteQuick ($from_table_name, $where_column_name, $is_equal_to_column_value, $return_column_value=false) | |
| nameOfNewCopy ($table_name, $name_field, $orig_name) | |
| installedPlugins () | |
| connectCacheServer () | |
| cacheWrite ($unique_key, $cache_data, $compress=false, $timeout=false) | |
| cacheRead ($unique_key) | |
| cacheClear ($unique_key=false) | |
| cacheEmpty ($unique_key) | |
Data Fields | |
| $server | |
| $dbUsername | |
| $dbPassword | |
| $dbName | |
| $connection | |
| $memcache | |
| $logArray | |
| $countQueries = -2 | |
| $pluginsInstalled | |
| $pluginLogo | |
| $essentialSettings | |
| $displaySqlInError = false | |
| $result | |
Protected Attributes | |
| $connector | |
| $connectors | |
| $defaultQuery | |
This is a new version of one the Big5: the db class
This new version supports connectors and queries class and should be compatible with the old one
| __construct | ( | $ | dependance | ) |
Constructor.
| belongsToGroup | ( | $ | user_id = false, |
| $ | user_group | ||
| ) |
Check if user belongs to given group. Returns true if user belongs to user group.
| integer | $user_id | |
| integer | $user_group |
| belongsToRole | ( | $ | user_id = false, |
| $ | user_role | ||
| ) |
Check if user belongs to given role. Returns true if user belongs to user role.
| integer | $user_id | |
| integer | $user_role |
| cacheClear | ( | $ | unique_key = false | ) |
Clear specific or all cache memory.
| mixed | $unique_key |
| cacheEmpty | ( | $ | unique_key | ) |
Checks if we have an empty cache container.
| mixed | $unique_key |
| cacheRead | ( | $ | unique_key | ) |
Return exising cache result to required item.
| mixed | $unique_key |
| cacheWrite | ( | $ | unique_key, |
| $ | cache_data, | ||
| $ | compress = false, |
||
| $ | timeout = false |
||
| ) |
Writes new data to cache.
| string | $unique_key | |
| mixed | $cache_data | |
| boolean | $compress | |
| int | $timeout |
| connect | ( | ) |
Force database connection. FIX: Note this is used in core initiation to fix some dependent functions like mysql_real_escape_string requiring a DB connection. Only dbConnecter->query initiated the connection which was unfair to dependent functions.
| connectCacheServer | ( | ) |
Does the connection to the memcache server. Currently memcache is the primary supported engine.
| connector | ( | $ | connector = null | ) |
Handle access to the alternate connector list
Give a class name, the connector will be instantiated if needed
| string | $connector,class | name of the connector |
| countRows | ( | $ | table_name, |
| $ | column = false |
||
| ) |
Simple method to count number of rows in a table.
| string | $table_name | |
| string | $column |
| deleteQuick | ( | $ | from_table_name, |
| $ | where_column_name, | ||
| $ | is_equal_to_column_value, | ||
| $ | return_column_value = false |
||
| ) |
Delete data from the database with minimal effort.
| string | $from_table_name | |
| string | $where_column_name | |
| string | $is_equal_to_column_value | |
| string | $return_column_value |
| deleteSettings | ( | $ | settings_to_delete = false, |
| $ | custom_prefix = false |
||
| ) |
Delete all settings stored by a given plugins name, is used when uninstalling a plugin.
Example: deleteSettings(false, 'SimplePhonebook')
| array | $settings_to_delete | Use '*' to delete all settings for certain plugin. |
| string | $custom_prefix |
| doesRecordExist | ( | $ | table_name, |
| $ | search_column_names, | ||
| $ | search_field_values, | ||
| $ | column_name_for_exclusion = false, |
||
| $ | exclude_field_value = false |
||
| ) |
Determines whether the specified search string already exists in the specified field within the supplied table. Optional: Also looks at an id field (typically the primary key of a table) to make sure that the record you are working with is NOT included in the search. Usefull when modifying an existing record and you need first to check if another record with the same value doesn't already exist.
| string | The name of the database table. |
| mixed | The array names of the columns in which to look for the search strings, a single value can also be given. |
| mixed | In the same order as $search_column_name array, the search strings in array that should not be duplicated, a single value can also be given. |
| string | The name of the primary key column name of the record you will be updating. |
| string | The value of the primary key of the record you will be updating that should not be included in the search. |
| endTransaction | ( | ) |
Commits database transactions.
| getEssentialSettings | ( | ) |
Used to get all essential system settings from the database, preventing multiple queries.
| getGroups | ( | $ | user_id = false, |
| $ | return_array = false, |
||
| $ | alias_only = false |
||
| ) |
This function gets all group id's for given user ids, while returning a string divided by ',' character or an array with ids. To pull multiple user groups, provide a string for $user_ids like so : '2,5,10,19'.
| string | $user_id | Leave this field empty if you want skip if user is root. |
| boolean | $return_array | |
| string | $alias_only | If you would like only items of a certain alias to be called. |
| getRoles | ( | $ | user_id = false, |
| $ | return_array = false |
||
| ) |
This function gets all role id's for a given user id, while returning a string divided by ',' character or an array with ids. To pull multiple user roles, provide a string for $user_ids like so: '2,5,10,19'.
| string | $user_id | |
| boolean | $return_array |
| getSettings | ( | $ | settings_required = false, |
| $ | custom_prefix = false |
||
| ) |
Loads and returns required settings from database. Class will always use plugin name as prefix for settings if no custom prefix is provided.
| array | $settings_required | |
| string | $prefix | This allows you to use a prefix value of your choice to select a setting from another plugin, otherwise PHPDevShell will be used. |
| groupExist | ( | $ | group_id | ) |
Simple check to see if a certain group exists.
| integer | $group_id |
| installedPlugins | ( | ) |
Writes array of all the installed plugins on the system.
| invokeQuery | ( | $ | query_name | ) |
Locates the query class of the given name, loads it, intantiate it, send the query to the DB, and return the result
| $query_name | string, the name of the query class (descendant of PHPDS_query) |
| invokeQueryWith | ( | $ | query_name, |
| $ | params | ||
| ) |
Locates the query class of the given name, loads it, intantiate it, send the query to the DB, and return the result
| $query_name | string, the name of the query class (descendant of PHPDS_query) |
| $args | array of parameters |
| logMenuAccess | ( | ) |
Method logs menu access per user.
| logThis | ( | ) |
This method logs error and success entries to the database.
| integer | $log_type | |
| string | $log_description |
| makeQuery | ( | $ | query_name | ) |
Locates the query class of the given name, loads it, intantiate it, and returns the query object
| $query_name | string, the name of the query class (descendant of PHPDS_query) |
| nameOfNewCopy | ( | $ | table_name, |
| $ | name_field, | ||
| $ | orig_name | ||
| ) |
This method is used to generate a new name value for a particular string in the database.
Usage Example : // This code generates a copy of the text "Some Value". The name_of_new_copy function // checks that it doesn't duplicate the name. $result = $db->nameOfNewCopy('PHPDS_table', 'some_field', 'Some Value');
// name_of_new_copy() returns 'Copy of Some Value', unless 'Copy of Some Value' already exists. If // it does, the function will return with 'Copy (x) of Some Value' where x is the next available // number that is not in use.
| string | The name of the table to search within. |
| string | The fieldname to search withing. |
| string | The original text to search for. |
| newQuery | ( | $ | query | ) |
Compatibility Do direct sql query without models.
| string |
| protect | ( | $ | param | ) |
Protect a single string from possible hacker (i.e. escape possible harmfull chars)
Actually deleguate the action to the connector
| $param | mixed, the parameter to espace |
| protectArray | ( | array $ | a, |
| $ | quote = '' |
||
| ) |
Protect a array of strings from possible hacker (i.e. escape possible harmfull chars) (this has been moved from PHPDS_query)
| $a | array, the strings to protect |
| $quote | string, the quotes to add to each non-numerical scalar value |
| roleExist | ( | $ | role_id | ) |
Simple check to see if a certain role exists.
| integer | $role_id |
| selectQuick | ( | $ | from_table_name, |
| $ | select_column_name, | ||
| $ | where_column_name, | ||
| $ | is_equal_to_column_value | ||
| ) |
Get a single result from database with minimal effort.
| string | $from_table_name | |
| string | $select_column_name | |
| string | $where_column_name | |
| string | $is_equal_to_column_value |
| setGroupQuery | ( | $ | query_request, |
| $ | query_root_request = false |
||
| ) |
Creates a query to extend a group query, it will return false if user is root so everything can get listed. This is meant to be used inside an existing group query.
| string | $query_request | Normal query to be returned if user is not a root user. |
| string | $query_root_request | If you want a query to be processed for a root user seperately. |
| setRoleQuery | ( | $ | query_request, |
| $ | query_root_request = false |
||
| ) |
Creates a query to extend a role query, it will return false if user is root so everything can get listed. This is meant to be used inside an existing role query.
| string | $query_request | Normal query to be returned if user is not a root user. |
| string | $query_root_request | If you want a query to be processed for a root user seperately. |
| settingsPrefix | ( | $ | custom_prefix = false | ) |
Generates a prefix for plugin general settings.
| string | $custom_prefix |
| sqlQuery | ( | $ | query | ) |
Alias to newQuery
| string | $query |
| startTransaction | ( | ) |
Set the starting point for a SQL transaction
You should call end_transaction(true) for the queries to actually occur
| tableExist | ( | $ | table | ) |
Checks if a database table exists.
| string | $table |
| writeSettings | ( | $ | write_settings, |
| $ | custom_prefix = '', |
||
| $ | notes = array() |
||
| ) |
Used to write general plugin settings to the database. Class will always use plugin name as prefix for settings if no custom prefix is provided. // Example: $db->writeSettings(array('setting_name'=>'value')[,'Example'][,array('setting_name'=>'note')]);
| array | $write_settings | This array should contain settings to write. |
| string | $custom_prefix | If you would like to have a custom prefix added to your settings. |
| array | $notes | For adding notes about setting. |
| $connection |
$connector [protected] |
$connectors [protected] |
| $countQueries = -2 |
| $dbName |
| $dbPassword |
| $dbUsername |
$defaultQuery [protected] |
| $displaySqlInError = false |
| $essentialSettings |
| $logArray |
| $memcache |
| $pluginLogo |
| $pluginsInstalled |
| $result |
| $server |