本文整理汇总了PHP中XLite\Core\Converter::time方法的典型用法代码示例。如果您正苦于以下问题:PHP Converter::time方法的具体用法?PHP Converter::time怎么用?PHP Converter::time使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XLite\Core\Converter
的用法示例。
在下文中一共展示了Converter::time方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doActionStartExpressCheckout
/**
* doActionStartExpressCheckout
*
* @return void
*/
protected function doActionStartExpressCheckout()
{
if (Paypal\Main::isExpressCheckoutEnabled()) {
$paymentMethod = $this->getExpressCheckoutPaymentMethod();
$this->getCart()->setPaymentMethod($paymentMethod);
$this->updateCart();
\XLite\Core\Session::getInstance()->ec_type = Paypal\Model\Payment\Processor\ExpressCheckout::EC_TYPE_SHORTCUT;
$processor = $paymentMethod->getProcessor();
$token = $processor->doSetExpressCheckout($paymentMethod);
if (isset($token)) {
\XLite\Core\Session::getInstance()->ec_token = $token;
\XLite\Core\Session::getInstance()->ec_date = \XLite\Core\Converter::time();
\XLite\Core\Session::getInstance()->ec_payer_id = null;
$processor->redirectToPaypal($token);
exit;
} else {
if (\XLite\Core\Request::getInstance()->inContext) {
\XLite\Core\Session::getInstance()->cancelUrl = \XLite\Core\Request::getInstance()->cancelUrl;
\XLite\Core\Session::getInstance()->inContextRedirect = true;
$this->setReturnURL($this->buildURL('checkout_failed'));
}
\XLite\Core\TopMessage::getInstance()->addError($processor->getErrorMessage() ?: 'Failure to redirect to PayPal.');
}
}
}
示例2: doActionBackup
/**
* doActionBackup
*
* @return void
*/
protected function doActionBackup()
{
$destFile = LC_DIR_BACKUP . sprintf('sqldump.backup.%d.sql', \XLite\Core\Converter::time());
$this->startDownload('db_backup.sql');
// Make database backup and store it in $this->sqldumpFile file
\XLite\Core\Database::getInstance()->exportSQLToFile($destFile, false);
readfile($destFile);
\Includes\Utils\FileManager::deleteFile($destFile);
exit;
}
示例3: getDefaultOptions
/**
* Get default options
*
* @return array
*/
protected function getDefaultOptions()
{
$time = \XLite\Core\Converter::time();
$allowedDateFormats = \XLite\Core\Converter::getAvailableDateFormats();
$options = array();
foreach ($allowedDateFormats as $phpFormat => $formats) {
$options[$phpFormat] = \XLite\Core\Converter::formatDate($time, $phpFormat);
}
return $options;
}
示例4: measure
/**
* Measure enviroment
*
* @param boolean $force Force run OPTIONAL
*
* @return boolean
*/
public function measure($force = false)
{
$result = false;
if ($force || $this->checkAccess()) {
set_time_limit(0);
$measure = new \XLite\Model\Measure();
$measure->setDate(\XLite\Core\Converter::time());
$measure->setFsTime(intval($this->measureFilesystem() * 1000));
$measure->setDbTime(intval($this->measureDatabase() * 1000));
$measure->setCpuTime(intval($this->measureComputation() * 1000));
\XLite\Core\Database::getEM()->persist($measure);
\XLite\Core\Database::getEM()->flush();
$result = true;
}
return $result;
}
示例5: registerEvent
/**
* Register event to the order
*
* @param integer $orderId Order identificator
* @param string $code Event code
* @param string $description Event description
* @param array $data Data for event description OPTIONAL
* @param string $comment Event comment OPTIONAL
* @param array $details Event details OPTIONAL
*
* @return void
*/
public function registerEvent($orderId, $code, $description, array $data = array(), $comment = '', $details = array())
{
$order = \XLite\Core\Database::getRepo('XLite\\Model\\Order')->find($orderId);
if (!$order->isRemoving()) {
$event = new \XLite\Model\OrderHistoryEvents(array('date' => \XLite\Core\Converter::time(), 'code' => $code, 'description' => $description, 'data' => $data, 'comment' => $comment));
if (!empty($details)) {
$event->setDetails($details);
}
if (\XLite\Core\Auth::getInstance()->getProfile()) {
$event->setAuthor(\XLite\Core\Auth::getInstance()->getProfile());
}
$event->setOrder($order);
$order->addEvents($event);
$this->insert($event);
}
}
示例6: restoreDatabase
/**
* Common restore database method used by actions
*
* @param mixed $sqlFile File with SQL data for loading into database
*
* @return boolean
*/
protected function restoreDatabase($sqlFile)
{
$result = false;
// File to create temporary backup to be able rollback database
$backupSQLFile = LC_DIR_BACKUP . sprintf('sqldump.backup.%d.sql', \XLite\Core\Converter::time());
// Make the process of restoring database verbose
$verbose = true;
// Start
$this->startDump();
// Making the temporary backup file
\Includes\Utils\Operator::flush(static::t('Making backup of the current database state ... '), true);
$result = \XLite\Core\Database::getInstance()->exportSQLToFile($backupSQLFile, $verbose);
\Includes\Utils\Operator::flush(static::t('done') . LC_EOL . LC_EOL, true);
// Loading specified SQL-file to the database
\Includes\Utils\Operator::flush(static::t('Loading the database from file .'));
$result = \Includes\Utils\Database::uploadSQLFromFile($sqlFile, $verbose);
$restore = false;
if ($result) {
// If file has been loaded into database successfully
$message = static::t('Database restored successfully!');
// Prepare the cache rebuilding
\XLite::setCleanUpCacheFlag(true);
} else {
// If an error occured while loading file into database
$message = static::t('The database has not been restored because of the errors');
$restore = true;
}
// Display the result message
\Includes\Utils\Operator::flush(' ' . static::t('done') . LC_EOL . LC_EOL . $message . LC_EOL);
if ($restore) {
// Restore database from temporary backup
\Includes\Utils\Operator::flush(LC_EOL . static::t('Restoring database from the backup .'));
\Includes\Utils\Database::uploadSQLFromFile($backupSQLFile, $verbose);
\Includes\Utils\Operator::flush(' ' . static::t('done') . LC_EOL . LC_EOL);
}
// Display Javascript to cancel scrolling page to bottom
func_refresh_end();
// Display the bottom HTML part
$this->displayPageFooter();
// Remove temporary backup file
unlink($backupSQLFile);
return $result;
}
示例7: doNoAction
/**
* Preprocessor for no-action
*
* @return void
*/
protected function doNoAction()
{
$this->startTime = time();
$this->startMemory = memory_get_usage(true);
$this->memoryLimitIni = \XLite\Core\Converter::convertShortSize(ini_get('memory_limit') ?: '16M');
foreach (\XLite\Core\Database::getRepo('XLite\\Model\\Task')->findAll() as $task) {
if (!$task->isExpired()) {
continue;
}
$runner = $task->getOwnerInstance();
if ($runner) {
$this->runRunner($runner);
}
sleep($this->sleepTime);
if (!$this->checkThreadResource()) {
$time = gmdate('H:i:s', \XLite\Core\Converter::time() - $this->startTime);
$memory = \XLite\Core\Converter::formatFileSize(memory_get_usage(true));
$this->printContent('Step is interrupted (time: ' . $time . '; memory usage: ' . $memory . ')');
break;
}
}
}
示例8: getTimeLeftToUnlock
/**
* Return time left to unlock
*
* @return integer
*/
protected function getTimeLeftToUnlock()
{
if (!isset($this->timeLeftToUnlock)) {
$this->timeLeftToUnlock = \XLite\Core\Session::getInstance()->dateOfLockLogin ? \XLite\Core\Session::getInstance()->dateOfLockLogin + \XLite\Core\Auth::TIME_OF_LOCK_LOGIN - \XLite\Core\Converter::time() : 0;
}
return $this->timeLeftToUnlock;
}
示例9: isExpired
/**
* Check - is tracking data are expired or not
*
* @return boolean
*/
public function isExpired()
{
return \XLite\Core\Converter::time() > $this->getExpiry();
}
示例10: getPostedData
/**
* Get posted data
*
* @param string $field Name of the field to retrieve OPTIONAL
*
* @return mixed
*/
protected function getPostedData($field = null)
{
$value = parent::getPostedData($field);
$time = \XLite\Core\Converter::time();
if (!isset($field)) {
if (isset($value['arrivalDate'])) {
$value['arrivalDate'] = intval(strtotime($value['arrivalDate'])) ?: mktime(0, 0, 0, date('m', $time), date('j', $time), date('Y', $time));
}
if (isset($value['sku']) && \XLite\Core\Converter::isEmptyString($value['sku'])) {
$value['sku'] = null;
}
if (isset($value['productClass'])) {
$value['productClass'] = \XLite\Core\Database::getRepo('\\XLite\\Model\\ProductClass')->find($value['productClass']);
}
if (isset($value['taxClass'])) {
$value['taxClass'] = \XLite\Core\Database::getRepo('\\XLite\\Model\\TaxClass')->find($value['taxClass']);
}
} elseif ('arrivalDate' === $field) {
$value = intval(strtotime($value)) ?: mktime(0, 0, 0, date('m', $time), date('j', $time), date('Y', $time));
} elseif ('sku' === $field) {
$value = null;
} elseif ('productClass' === $field) {
$value = \XLite\Core\Database::getRepo('\\XLite\\Model\\ProductClass')->find($value);
} elseif ('taxClass' === $field) {
$value = \XLite\Core\Database::getRepo('\\XLite\\Model\\TaxClass')->find($value);
}
return $value;
}
示例11: isPromoBannerActive
/**
* Defines if the promo banner is active or expired
* Banner is active if no expiration date is defined ('' value)
* or the expiration date is greater than current time
*
* @param string $date Date
*
* @return boolean
*/
protected function isPromoBannerActive($date)
{
$timestamp = strtotime($date);
return '' === $date || \XLite\Core\Converter::time() < $timestamp;
}
示例12: prepareBeforeCreate
/**
* Prepare creation date
*
* @return void
*
* @PrePersist
*/
public function prepareBeforeCreate()
{
// Assign a profile creation date/time
if (!$this->getAdded()) {
$this->setAdded(\XLite\Core\Converter::time());
}
// Assign current language
$language = $this->getLanguage(true);
if (empty($language)) {
$this->setLanguage(\XLite\Core\Session::getInstance()->getLanguage()->getCode());
}
// Assign referer value
if (empty($this->referer)) {
if (\XLite\Core\Auth::getInstance()->isAdmin()) {
$currentlyLoggedInProfile = \XLite\Core\Auth::getInstance()->getProfile();
$this->setReferer(sprintf('Created by administrator (%s)', $currentlyLoggedInProfile->getLogin()));
} elseif (isset($_COOKIE[\XLite\Core\Session::LC_REFERER_COOKIE_NAME])) {
$this->setReferer($_COOKIE[\XLite\Core\Session::LC_REFERER_COOKIE_NAME]);
}
}
// Assign status 'Enabled' if not defined
if (empty($this->status)) {
$this->enable();
}
}
示例13: prepareSearchParams
/**
* Initialize search parameters from request data
*
* @return void
*/
protected function prepareSearchParams()
{
$ordersSearch = array();
// Prepare dates
$this->startDate = $this->getDateValue('startDate');
$this->endDate = $this->getDateValue('endDate', true);
if (0 === $this->startDate || 0 === $this->endDate || $this->startDate > $this->endDate) {
$date = getdate(\XLite\Core\Converter::time());
$this->startDate = mktime(0, 0, 0, $date['mon'], 1, $date['year']);
$this->endDate = mktime(0, 0, 0, $date['mon'], $date['mday'], $date['year']);
}
foreach ($this->getSearchParams() as $modelParam => $requestParam) {
if (\XLite\Model\Repo\Order::P_DATE === $requestParam) {
$ordersSearch[$requestParam] = array($this->startDate, $this->endDate);
} elseif (isset(\XLite\Core\Request::getInstance()->{$requestParam})) {
$ordersSearch[$requestParam] = \XLite\Core\Request::getInstance()->{$requestParam};
}
}
if (!isset($ordersSearch[\XLite\Model\Repo\Order::P_PROFILE_ID])) {
$ordersSearch[\XLite\Model\Repo\Order::P_PROFILE_ID] = 0;
}
\XLite\Core\Session::getInstance()->{$this->getSessionCellName()} = $ordersSearch;
}
示例14: prepareCndEnabled
/**
* Prepare certain search condition
*
* @param \Doctrine\ORM\QueryBuilder $queryBuilder Query builder to prepare
* @param array|string $value Condition data
* @param boolean $countOnly "Count only" flag. Do not need to add "order by" clauses if only count is needed.
*
* @return void
*/
protected function prepareCndEnabled(\Doctrine\ORM\QueryBuilder $queryBuilder, $value, $countOnly)
{
if ($value) {
$queryBuilder->andWhere('n.enabled = :true AND n.date < :time')->setParameter('true', true)->setParameter('time', \XLite\Core\Converter::time());
}
}
示例15: getDayEnd
/**
* Returns end of the day
*
* @param integer $time Server time
*
* @return integer
*/
public static function getDayEnd($time = null)
{
if (null === $time) {
$time = \XLite\Core\Converter::time();
}
return mktime(23, 59, 59, date('n', $time), date('j', $time), date('Y', $time));
}