本文整理汇总了PHP中eZDateTime::timeStamp方法的典型用法代码示例。如果您正苦于以下问题:PHP eZDateTime::timeStamp方法的具体用法?PHP eZDateTime::timeStamp怎么用?PHP eZDateTime::timeStamp使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类eZDateTime
的用法示例。
在下文中一共展示了eZDateTime::timeStamp方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: search
//.........这里部分代码省略.........
for ( $i = 0; $i < ( $numQuotes / 2 ); $i ++ )
{
$quotePosStart = strpos( $searchText, '"', $pos );
$quotePosEnd = strpos( $searchText, '"', $quotePosStart + 1 );
$prePhraseText = substr( $searchText, $pos, $quotePosStart - $pos );
$postPhraseText = substr( $searchText, $quotePosEnd +1 );
$phraseText = substr( $searchText, $quotePosStart + 1, $quotePosEnd - $quotePosStart - 1 );
$phraseTextArray[] = $phraseText;
// $fullText .= $prePhraseText;
$nonPhraseText .= $prePhraseText;
$pos = $quotePosEnd + 1;
}
}
$nonPhraseText .= $postPhraseText;
*/
$phrasesResult = $this->getPhrases($searchText);
$phraseTextArray = $phrasesResult['phrases'];
$nonPhraseText = $phrasesResult['nonPhraseText'];
$fullText = $phrasesResult['fullText'];
$sectionQuery = '';
if (is_numeric($searchSectionID) and $searchSectionID > 0) {
$sectionQuery = "ezsearch_object_word_link.section_id = '{$searchSectionID}' AND ";
} else {
if (is_array($searchSectionID)) {
// Build query for searching in an array of sections
$sectionQuery = $db->generateSQLINStatement($searchSectionID, 'ezsearch_object_word_link.section_id', false, false, 'int') . " AND ";
}
}
$searchDateQuery = '';
if (is_numeric($searchDate) and $searchDate > 0 or $searchTimestamp) {
$date = new eZDateTime();
$timestamp = $date->timeStamp();
$day = $date->attribute('day');
$month = $date->attribute('month');
$year = $date->attribute('year');
$publishedDateStop = false;
if ($searchTimestamp) {
if (is_array($searchTimestamp)) {
$publishedDate = (int) $searchTimestamp[0];
$publishedDateStop = (int) $searchTimestamp[1];
} else {
$publishedDate = (int) $searchTimestamp;
}
} else {
switch ($searchDate) {
case 1:
$adjustment = 24 * 60 * 60;
//seconds for one day
$publishedDate = $timestamp - $adjustment;
break;
case 2:
$adjustment = 7 * 24 * 60 * 60;
//seconds for one week
$publishedDate = $timestamp - $adjustment;
break;
case 3:
$adjustment = 31 * 24 * 60 * 60;
//seconds for one month
$publishedDate = $timestamp - $adjustment;
break;
case 4:
$adjustment = 3 * 31 * 24 * 60 * 60;
//seconds for three months
$publishedDate = $timestamp - $adjustment;
示例2: eZDateTime
$scriptFile = $scriptDirectory . '/' . $cronScript;
if (file_exists($scriptFile)) {
break;
}
}
if (file_exists($scriptFile)) {
if ($index > 0) {
$cli->output();
}
if (!$isQuiet) {
$startTime = new eZDateTime();
$cli->output('Running ' . $cli->stylize('emphasize', $scriptFile) . ' at: ' . $startTime->toString(true));
}
eZDebug::addTimingPoint("Script {$scriptFile} starting");
eZRunCronjobs::runScript($cli, $scriptFile);
eZDebug::addTimingPoint("Script {$scriptFile} done");
++$index;
// The transaction check
$transactionCounterCheck = eZDB::checkTransactionCounter();
if (isset($transactionCounterCheck['error'])) {
$cli->error($transactionCounterCheck['error']);
}
if (!$isQuiet) {
$endTime = new eZDateTime();
$cli->output('Completing ' . $cli->stylize('emphasize', $scriptFile) . ' at: ' . $endTime->toString(true));
$elapsedTime = new eZTime($endTime->timeStamp() - $startTime->timeStamp());
$cli->output('Elapsed time: ' . sprintf('%02d:%02d:%02d', $elapsedTime->hour(), $elapsedTime->minute(), $elapsedTime->second()));
}
}
}
$script->shutdown();
示例3: import
//.........这里部分代码省略.........
case "ezstring":
case "eztext":
if (!isset($xmlTextArray[$sectionName])) {
continue;
}
$eztextDom = new DOMDOcument('1.0', 'UTF-8');
$eztextDom->loadXML($xmlTextArray[$sectionName]);
$text = $eztextDom->documentElement->textContent;
$dataMap[$attributeIdentifier]->setAttribute('data_text', trim($text));
$dataMap[$attributeIdentifier]->store();
break;
case "ezxmltext":
if (!isset($xmlTextArray[$sectionName])) {
continue;
}
$dataMap[$attributeIdentifier]->setAttribute('data_text', $xmlTextArray[$sectionName]);
$dataMap[$attributeIdentifier]->store();
break;
case "ezdate":
// Only support date formats as a single paragraph in a section with the format:
// day/month/year
if (!isset($xmlTextArray[$sectionName])) {
continue;
}
$dateString = strip_tags($xmlTextArray[$sectionName]);
$dateArray = explode("/", $dateString);
if (count($dateArray) == 3) {
$year = $dateArray[2];
$month = $dateArray[1];
$day = $dateArray[0];
$date = new eZDate();
$contentClassAttribute = $dataMap[$attributeIdentifier];
$date->setMDY($month, $day, $year);
$dataMap[$attributeIdentifier]->setAttribute('data_int', $date->timeStamp());
$dataMap[$attributeIdentifier]->store();
}
break;
case "ezdatetime":
// Only support date formats as a single paragraph in a section with the format:
// day/month/year 14:00
if (!isset($xmlTextArray[$sectionName])) {
continue;
}
$dateString = trim(strip_tags($xmlTextArray[$sectionName]));
$dateTimeArray = explode(" ", $dateString);
$dateArray = explode("/", $dateTimeArray[0]);
$timeArray = explode(":", $dateTimeArray[1]);
if (count($dateArray) == 3 and count($timeArray) == 2) {
$year = $dateArray[2];
$month = $dateArray[1];
$day = $dateArray[0];
$hour = $timeArray[0];
$minute = $timeArray[1];
$dateTime = new eZDateTime();
$contentClassAttribute = $dataMap[$attributeIdentifier];
$dateTime->setMDYHMS($month, $day, $year, $hour, $minute, 0);
$dataMap[$attributeIdentifier]->setAttribute('data_int', $dateTime->timeStamp());
$dataMap[$attributeIdentifier]->store();
}
break;
case "ezimage":
$hasImage = false;
// Images are treated as an image object inside a paragrah.
// We fetch the first image object if there are multiple and ignore the rest
if (is_object($sectionNodeHash[$sectionName])) {
// Look for paragraphs in the section
示例4: batchInitializeObjectAttributeData
function batchInitializeObjectAttributeData( $classAttribute )
{
$defaultType = $classAttribute->attribute( self::DEFAULT_FIELD );
switch( $defaultType )
{
case self::DEFAULT_CURRENT_DATE:
{
$default = time();
} break;
case self::DEFAULT_ADJUSTMENT:
{
$adjustments = $this->classAttributeContent( $classAttribute );
$value = new eZDateTime();
$secondAdjustment = $classAttribute->attribute( self::USE_SECONDS_FIELD ) == 1 ? $adjustments['second'] : 0;
$value->adjustDateTime( $adjustments['hour'], $adjustments['minute'], $secondAdjustment, $adjustments['month'], $adjustments['day'], $adjustments['year'] );
$default = $value->timeStamp();
} break;
default:
{
$default = 0;
}
}
return array( 'data_int' => $default, 'sort_key_int' => $default );
}
示例5: getTimestamp
function getTimestamp($http, $id)
{
$day = $http->postVariable('newsletter_datetime_day_' . $id);
$month = $http->postVariable('newsletter_datetime_month_' . $id);
$year = $http->postVariable('newsletter_datetime_year_' . $id);
$hour = $http->postVariable('newsletter_datetime_hour_' . $id);
$minute = $http->postVariable('newsletter_datetime_minute_' . $id);
$dateTime = new eZDateTime();
if ($year == '' and $month == '' and $day == '' and $hour == '' and $minute == '' or !checkdate($month, $day, $year) or $year < 1970) {
$dateTime->setTimeStamp(0);
} else {
$dateTime->setMDYHMS($month, $day, $year, $hour, $minute, 0);
}
return $dateTime->timeStamp();
}