本文整理汇总了PHP中sDB::clean方法的典型用法代码示例。如果您正苦于以下问题:PHP sDB::clean方法的具体用法?PHP sDB::clean怎么用?PHP sDB::clean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sDB
的用法示例。
在下文中一共展示了sDB::clean方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: copydata
/**
* Copy property values into the current DatbaseObject from another object
*
* Copies the property values from a specified object into the current
* ShoppDatabaseObject where the property names match.
*
* @author Jonathan Davis
* @since 1.0
*
* @param object $data The source object or array to copy from
* @param string $prefix (optional) A property prefix
* @param array $ignores (optional) List of property names to ignore copying from
* @return void
**/
public function copydata($data, $prefix = '', array $ignores = array('_datatypes', '_table', '_key', '_lists', '_map', 'id', 'created', 'modified'))
{
if (!is_array($ignores)) {
$ignores = array();
}
$properties = is_object($data) ? get_object_vars($data) : $data;
foreach ((array) $properties as $property => $value) {
$property = $prefix . $property;
if (property_exists($this, $property) && !in_array($property, $ignores)) {
$this->{$property} = sDB::clean($value);
}
}
}
示例2: download_loader
/**
* Download record loader to map download file data to the loaded downloads for the customer
*
* @author Jonathan Davis
* @since 1.3.2
*
* @param array $records The records to map to (unused becase they are mapped to the Customer->downloads records)
* @param array $record The record data loaded from the query
* @return void
**/
public function download_loader(&$records, &$record)
{
// Lookup the download key
if (empty($this->_filemap[$record->id])) {
return;
}
$dkey = $this->_filemap[$record->id];
// Find the purchased download
if (empty($this->downloads[$dkey])) {
return;
}
$Purchased =& $this->downloads[$dkey];
// Unserialize the file data
$data = maybe_unserialize($record->value);
if (is_object($data)) {
$properties = get_object_vars($data);
} else {
return;
}
// Map the file data to the purchased download record
foreach ((array) $properties as $property => $value) {
$Purchased->{$property} = sDB::clean($value);
}
}
示例3: load_purchased
/**
* Loads or constructs item properties from a purchased product
*
* @author Jonathan Davis
* @since 1.3
*
* @return void
**/
public function load_purchased($Purchased)
{
$this->load(new ShoppProduct($Purchased->product), $Purchased->price, false);
// Copy matching properties
$properties = get_object_vars($Purchased);
foreach ((array) $properties as $property => $value) {
if (property_exists($this, $property)) {
$this->{$property} = sDB::clean($value);
}
}
}
示例4: delete
/**
* Remove a setting from the registry and the database
*
* @since 1.0
*
* @param string $name Name of the setting to remove
* @return boolean
**/
public function delete($name = false)
{
$null = null;
if (empty($name)) {
return false;
}
$Setting = $this->setting();
$where = array("context='{$Setting->context}'", "type='{$Setting->type}'");
if (!empty($name)) {
$where[] = "name='" . sDB::clean($name) . "'";
}
$where = join(' AND ', $where);
if (!sDB::query("DELETE FROM {$this->_table} WHERE {$where}")) {
return false;
}
if (isset($this->registry[$name])) {
$this->registry[$name] = $null;
}
return true;
}