本文整理匯總了PHP中sDB::mktime方法的典型用法代碼示例。如果您正苦於以下問題:PHP sDB::mktime方法的具體用法?PHP sDB::mktime怎麽用?PHP sDB::mktime使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類sDB
的用法示例。
在下文中一共展示了sDB::mktime方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: populate
/**
* Populates the ShoppDatabaseObject properties from a db query result object
*
* Uses the available data model built from the table schema to
* automatically set the object properties, taking care to convert
* special data such as dates and serialized structures.
*
* @author Jonathan Davis
* @since 1.0
*
* @param object $data The query results
* @return void
**/
public function populate($data)
{
if (empty($data)) {
return false;
}
$properties = get_object_vars($data);
foreach ((array) $properties as $var => $value) {
$mapping = empty($this->_map) ? array() : array_flip($this->_map);
if (!isset($this->_addmap) && !empty($mapping) && !isset($mapping[$var])) {
continue;
}
$property = isset($mapping[$var]) ? $mapping[$var] : $var;
if (empty($this->_datatypes[$var])) {
continue;
}
// Process the data
switch ($this->_datatypes[$var]) {
case 'date':
$this->{$property} = sDB::mktime($value);
break;
case 'float':
$this->{$property} = (double) $value;
break;
case 'int':
$this->{$property} = (int) $value;
break;
case 'string':
// If string has been serialized, unserialize it
if (sDB::serialized($value)) {
$value = @unserialize($value);
}
default:
// Anything not needing processing
// passes through into the object
$this->{$property} = $value;
}
}
}
示例2: date
/**
* Provides the date the purchase order was created
*
* @api `shopp('purchase.date')`
* @since 1.0
*
* @param string $result The output
* @param array $options The options
* - **format**: Sets the PHP date formatting to use. Defaults to the WordPress date and time formats
* @param ShoppPurchase $O The working object
* @return string The purchase order date
**/
public static function date($result, $options, $O)
{
if (empty($options['format'])) {
$options['format'] = get_option('date_format') . ' ' . get_option('time_format');
}
return _d($options['format'], is_int($O->created) ? $O->created : sDB::mktime($O->created));
}
示例3: sumloader
/**
* Populates the product with summary data
*
* @author Jonathan Davis
* @since 1.2
*
* @return void
**/
public function sumloader(&$records, &$data)
{
$Summary = new ProductSummary();
$properties = array_keys($Summary->_datatypes);
$ignore = array('product', 'modified');
foreach ($properties as $property) {
if ($property[0] == '_') {
continue;
}
if (in_array($property, $ignore)) {
continue;
}
switch ($property) {
case 'ranges':
$ranges = explode(',', $data->{$property});
$minmax = array('min', 'max');
$i = 0;
foreach ($minmax as $m) {
$range =& $this->{$m};
foreach (ProductSummary::$_ranges as $prop) {
if (isset($ranges[$i])) {
$range[$prop] = (double) $ranges[$i++];
}
}
}
break;
case 'taxed':
$taxed = explode(',', $data->{$property});
foreach ($taxed as $pricetag) {
if (!$pricetag) {
continue;
}
list($m, $name) = explode(' ', $pricetag);
if (empty($m)) {
continue;
}
$range =& $this->{$m};
$range[$name . '_tax'] = true;
}
default:
$this->{$property} = isset($data->{$property}) ? $data->{$property} : false;
}
if (isset($this->{$property})) {
if ('float' == $Summary->_datatypes[$property]) {
$this->checksum .= (double) $this->{$property};
} else {
$this->checksum .= $this->{$property};
}
}
}
$this->checksum = md5($this->checksum);
if (isset($data->summed)) {
$this->summed = sDB::mktime($data->summed);
}
if (shopp_setting_enabled('inventory') && Shopp::str_true($this->inventory) && $this->stock <= 0) {
$this->outofstock = true;
}
}
示例4: load
/**
* Load the session from the database
*
* @since 1.0
*
* @param string $session (optional) A session id to load
* @return bool True if session data was loaded successfully, false otherwise
**/
protected function load($session = false)
{
if (empty($session)) {
$session = $this->session;
}
if (empty($session)) {
return false;
}
do_action('shopp_session_load');
$query = "SELECT * FROM {$this->_table} WHERE session='{$session}'";
$loaded = sDB::query($query, 'object');
if (empty($loaded)) {
// No session found in the database
if (!empty($this->session)) {
$this->session(true);
// Cookie exists, but no session in the database, re-session (new id)
$this->cook();
// Ensure leftover session cookies are replaced for security reasons
}
return false;
}
$this->decrypt($loaded->data);
if (empty($loaded->data)) {
return false;
}
$this->session = $loaded->session;
$this->ip = $loaded->ip;
$this->data = unserialize($loaded->data);
$this->stash = $loaded->stash;
$this->created = sDB::mktime($loaded->created);
$this->modified = sDB::mktime($loaded->modified);
do_action('shopp_session_loaded');
return true;
}