本文整理汇总了PHP中JevDate::strtotime方法的典型用法代码示例。如果您正苦于以下问题:PHP JevDate::strtotime方法的具体用法?PHP JevDate::strtotime怎么用?PHP JevDate::strtotime使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JevDate
的用法示例。
在下文中一共展示了JevDate::strtotime方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: JEventDate
function JEventDate($datetime = '')
{
$time = JevDate::strtotime($datetime);
if ($datetime != "" && $time !== false) {
$this->date = $time;
$parts = explode(":", date("Y:m:j:G:i:s:t", $this->date));
$this->year = intval($parts[0]);
$this->month = intval($parts[1]);
$this->day = intval($parts[2]);
$this->hour = intval($parts[3]);
$this->minute = intval($parts[4]);
$this->second = intval($parts[5]);
$this->dim = intval($parts[6]);
} else {
$this->date = time();
$parts = explode(":", date("Y:m:j:G:i:s:t", $this->date));
$this->year = intval($parts[0]);
$this->month = intval($parts[1]);
$this->day = intval($parts[2]);
$this->hour = 0;
$this->minute = 0;
$this->second = 0;
$this->dim = intval($parts[6]);
}
}
示例2: Defaultgetstartenddates
function Defaultgetstartenddates($view)
{
$params = JComponentHelper::getParams(JEV_COM_COMPONENT);
$startdate = JRequest::getString("startdate", "");
$enddate = JRequest::getString("enddate", "");
if ($startdate == "") {
if ($params->get("relative", "rel") == "abs") {
$startdate = $params->get("absstart", "");
list($startyear, $startmonth, $startday) = explode("-", $startdate);
} else {
if ($params->get("relative", "rel") == "strtotime") {
$value = $params->get("strstart", "");
$value = new JevDate(JevDate::strtotime($value));
$startdate = $value->toFormat("%Y-%m-%d");
} else {
$value = $params->get("relstart", "");
$value = str_replace(",", " ", $value);
$value = str_replace("y", "year", $value);
$value = str_replace("d", "day", $value);
$value = str_replace("w", "week", $value);
$value = str_replace("m", "month", $value);
$value = new JevDate($value);
$startdate = $value->toFormat("%Y-%m-%d");
}
}
}
if ($enddate == "") {
if ($params->get("relative", "rel") == "abs") {
$enddate = $params->get("absend", "");
} else {
if ($params->get("relative", "rel") == "strtotime") {
$value = $params->get("strend", "");
$value = new JevDate(JevDate::strtotime($value));
$enddate = $value->toFormat("%Y-%m-%d");
} else {
$value = $params->get("relend", "");
$value = str_replace(",", " ", $value);
$value = str_replace("y", "year", $value);
$value = str_replace("d", "day", $value);
$value = str_replace("w", "week", $value);
$value = str_replace("m", "month", $value);
$value = new JevDate($value);
$enddate = $value->toFormat("%Y-%m-%d");
}
}
}
if ($enddate < $startdate) {
// default to 1 year when input dates are not valid!
$value = new JevDate($startdate);
$value->add(new DateInterval('P1Y'));
$enddate = $value->toFormat("%Y-%m-%d");
}
return array($startdate, $enddate);
}
示例3: _createFilter
function _createFilter($prefix = "")
{
if (!$this->filterField) {
return "";
}
// first time visit
if (isset($this->filter_values[2]) && $this->filter_values[2] == 0) {
$this->filter_values = array();
$this->filter_values[0] = 1;
// default scenario is only events starting after 2 weeeks ago
$fulldate = date('Y-m-d H:i:s', JevDate::strtotime("-2 weeks"));
$this->filter_values[1] = substr($fulldate, 0, 10);
$this->filter_values[2] = 1;
return $this->dmap . ".startrepeat>='{$fulldate}'";
} else {
if ($this->filter_values[0] == 0) {
$this->filter_values[1] = "";
$this->_date = $this->filter_values[1];
} else {
if ($this->filter_values[0] == -1 && $this->filter_values[1] == "") {
$fulldate = date('Y-m-d H:i:s', JevDate::strtotime("+2 weeks"));
$this->filter_values[1] = substr($fulldate, 0, 10);
$this->_date = $this->filter_values[1];
} else {
if ($this->filter_values[0] == 1 && $this->filter_values[1] == "") {
$fulldate = date('Y-m-d H:i:s', JevDate::strtotime("-2 weeks"));
$this->filter_values[1] = substr($fulldate, 0, 10);
$this->_date = $this->filter_values[1];
}
}
}
}
$filter = "";
if ($this->_date != "" && $this->_onorbefore != 0) {
$date = JevDate::strtotime($this->_date);
$fulldate = date('Y-m-d H:i:s', $date);
if ($this->_onorbefore > 0) {
$date = $this->dmap . ".startrepeat>='{$fulldate}'";
} else {
$date = $this->dmap . ".startrepeat<'{$fulldate}'";
}
} else {
$date = "";
}
$filter = $date;
return $filter;
}
示例4: processMatch
protected function processMatch(&$content, $match, $dayEvent, $dateParm, $relDay)
{
$datenow = JEVHelper::getNow();
$dispatcher = JDispatcher::getInstance();
// get the title and start time
$startDate = JevDate::strtotime($dayEvent->publish_up());
if ($relDay > 0) {
$eventDate = JevDate::strtotime($datenow->toFormat('%Y-%m-%d ') . JevDate::strftime('%H:%M', $startDate) . " +{$relDay} days");
} else {
$eventDate = JevDate::strtotime($datenow->toFormat('%Y-%m-%d ') . JevDate::strftime('%H:%M', $startDate) . " {$relDay} days");
}
$endDate = JevDate::strtotime($dayEvent->publish_down());
list($st_year, $st_month, $st_day) = explode('-', JevDate::strftime('%Y-%m-%d', $startDate));
list($ev_year, $ev_month, $ev_day) = explode('-', JevDate::strftime('%Y-%m-%d', $startDate));
$task_events = 'icalrepeat.detail';
switch ($match) {
case 'endDate':
case 'startDate':
case 'eventDate':
// Note we need to examine the date specifiers used to determine if language translation will be
// necessary. Do this later when script is debugged.
if (!$this->disableDateStyle) {
$content .= '<span class="mod_events_latest_date">';
}
if (!$dayEvent->alldayevent() && $match == "endDate" && ($dayEvent->noendtime() && $dayEvent->getUnixStartDate() == $dayEvent->getUnixEndDate() || $dayEvent->getUnixStartTime() == $dayEvent->getUnixEndTime())) {
$time_fmt = "";
} else {
if (!isset($dateParm) || $dateParm == '') {
if ($this->com_calUseStdTime) {
$time_fmt = $dayEvent->alldayevent() ? '' : IS_WIN ? ' @%I:%M%p' : ' @%l:%M%p';
} else {
$time_fmt = $dayEvent->alldayevent() ? '' : ' @%H:%M';
}
$dateFormat = $this->displayYear ? '%a %b %d, %Y' . $time_fmt : '%a %b %d' . $time_fmt;
$jmatch = new JevDate(${$match});
$content .= $jmatch->toFormat($dateFormat);
//$content .= JEV_CommonFunctions::jev_strftime($dateFormat, $$match);
} else {
// format endDate when midnight to show midnight!
if ($match == "endDate" && $dayEvent->sdn() == 59) {
$tempEndDate = $endDate + 1;
if ($dayEvent->alldayevent()) {
// if an all day event then we don't want to roll to the next day
$tempEndDate -= 86400;
}
$match = "tempEndDate";
}
// if a '%' sign detected in date format string, we assume JevDate::strftime() is to be used,
if (preg_match("/\\%/", $dateParm)) {
$jmatch = new JevDate(${$match});
$content .= $jmatch->toFormat($dateParm);
} else {
$content .= date($dateParm, ${$match});
}
if ($match == "tempDndDate") {
$match = "endDate";
}
}
}
if (!$this->disableDateStyle) {
$content .= "</span>";
}
break;
case 'title':
$title = $dayEvent->title();
if (!empty($dateParm)) {
$parts = explode("|", $dateParm);
if (count($parts) > 0 && strlen($title) > intval($parts[0])) {
$title = substr($title, 0, intval($parts[0]));
if (count($parts) > 1) {
$title .= $parts[1];
}
}
}
if (!$this->disableTitleStyle) {
$content .= '<span class="mod_events_latest_content">';
}
if ($this->displayLinks) {
$link = $dayEvent->viewDetailLink($ev_year, $ev_month, $ev_day, false, $this->myItemid);
if ($this->modparams->get("ignorefiltermodule", 0)) {
$link = JRoute::_($link . $this->datamodel->getCatidsOutLink() . "&filter_reset=1");
} else {
$link = JRoute::_($link . $this->datamodel->getCatidsOutLink());
}
$content .= $this->_htmlLinkCloaking($link, JEventsHTML::special($title));
} else {
$content .= JEventsHTML::special($title);
}
if (!$this->disableTitleStyle) {
$content .= '</span>';
}
break;
case 'category':
$catobj = $dayEvent->getCategoryName();
$content .= JEventsHTML::special($catobj);
break;
case 'categoryimage':
$catobj = $dayEvent->getCategoryImage();
$content .= $catobj;
break;
//.........这里部分代码省略.........
示例5: _getWeekNumberISO8601
/**
* Get week number according ISO 8601
*
* @static
* @param int $date date
* @return int weeknumber
*/
function _getWeekNumberISO8601($date)
{
$thursday = JEV_CompatWin::_getThursdayOfWeek($date);
$thursday_Y = JevDate::strftime('%Y', $thursday);
$first_th = JEV_CompatWin::_getThursdayOfWeek(JevDate::strtotime($thursday_Y . '-01-04'));
return (JevDate::strftime('%j', $thursday) - JevDate::strftime('%j', $first_th)) / 7 + 1;
}
示例6: fixDtstart
function fixDtstart()
{
// must only ever do this once!
if (isset($this->dtfixed) && $this->dtfixed) {
return;
}
$this->dtfixed = 1;
$db =& JFactory::getDBO();
// Now get the first repeat since dtstart may have been set in a different timezeone and since it is a unixdate it would then be wrong
if (strtolower($this->freq()) == "none") {
$repeat = $this->getFirstRepeat();
$this->dtstart($repeat->getUnixStartTime());
$this->dtend($repeat->getUnixEndTime());
} else {
$repeat = $this->getFirstRepeat();
// Is this repeat an exception?
$db->setQuery("SELECT * FROM #__jevents_exception WHERE rp_id=" . intval($repeat->rp_id()));
$exception = $db->loadObject();
if (!$exception) {
$this->dtstart($repeat->getUnixStartTime());
$this->dtend($repeat->getUnixEndTime());
} else {
// This is the scenario where the first repeat is an exception so check to see if we need to be worried
$jregistry =& JRegistry::getInstance("jevents");
// This is the server default timezone
$jtimezone = $jregistry->getValue("jevents.timezone", false);
if ($jtimezone) {
// This is the JEvents set timezone
$timezone = date_default_timezone_get();
// Only worry if the JEvents set timezone is different to the server timezone
if ($timezone != $jtimezone) {
// look for repeats that are not exceptions
$repeat2 = $this->getFirstRepeat(false);
// if we have none then use the first repeat and give a warning
if (!$repeat2) {
$this->dtstart($repeat->getUnixStartTime());
$this->dtend($repeat->getUnixEndTime());
JFactory::getApplication()->enqueueMessage(JText::_('JEV_PLEASE_CHECK_START_AND_END_TIMES_FOR_THIS_EVENT'));
} else {
// Calculate the time adjustment (if any) then check against the non-exceptional repeat
// Convert dtstart using system timezone to date
date_default_timezone_set($jtimezone);
$truestarttime = JevDate::strftime("%H:%M:%S", $this->dtstart());
// if the system timezone version of dtstart is the same time as the first non-exceptional repeat
// then we are safe to use this adjustment mechanism to dtstart. We use the real "date" and convert
// back into unix time using the Jevents timezone
if ($truestarttime == JevDate::strftime("%H:%M:%S", JevDate::mktime($repeat2->hup(), $repeat2->minup(), $repeat2->sup(), 0, 0, 0))) {
$truedtstart = JevDate::strftime("%Y-%m-%d %H:%M:%S", $this->dtstart());
$truedtend = JevDate::strftime("%Y-%m-%d %H:%M:%S", $this->dtend());
// switch timezone back to Jevents timezone
date_default_timezone_set($timezone);
$this->dtstart(JevDate::strtotime($truedtstart));
$this->dtend(JevDate::strtotime($truedtend));
} else {
// In this scenario we have no idea what the time should be unfortunately
JFactory::getApplication()->enqueueMessage(JText::_('JEV_PLEASE_CHECK_START_AND_END_TIMES_FOR_THIS_EVENT'));
// switch timezone back
date_default_timezone_set($timezone);
}
}
}
}
}
}
}
示例7: _displayCalendarMod
function _displayCalendarMod($time, $startday, $linkString, &$day_name, $monthMustHaveEvent = false, $basedate = false)
{
$db = JFactory::getDBO();
$cfg = JEVConfig::getInstance();
$compname = JEV_COM_COMPONENT;
$cal_day = date("d", $time);
//$cal_year=date("Y",$time);
//$cal_month=date("m",$time);
//list($cal_year,$cal_month,$cal_day) = JEVHelper::getYMD();
if (!$basedate) {
$basedate = $time;
}
$base_year = date("Y", $basedate);
$base_month = date("m", $basedate);
$basefirst_of_month = JevDate::mktime(0, 0, 0, $base_month, 1, $base_year);
$requestYear = JRequest::getInt("year", 0);
$requestMonth = JRequest::getInt("month", 0);
// special case when site link set the dates for the mini-calendar in the URL but not in the ajax request
if ($requestMonth && $requestYear && JRequest::getString("task", "") != "modcal.ajax" && $this->modparams->get("minical_usedate", 0)) {
$requestDay = JRequest::getInt("day", 1);
$requestTime = JevDate::mktime(0, 0, 0, $requestMonth, $requestDay, $requestYear);
if ($time - $basedate > 100000) {
$requestTime = JevDate::strtotime("+1 month", $requestTime);
} else {
if ($time - $basedate < -100000) {
$requestTime = JevDate::strtotime("-1 month", $requestTime);
}
}
$cal_year = date("Y", $requestTime);
$cal_month = date("m", $requestTime);
$base_year = $requestYear;
$base_month = $requestMonth;
$basefirst_of_month = JevDate::mktime(0, 0, 0, $requestMonth, $requestDay, $requestYear);
} else {
$cal_year = date("Y", $time);
$cal_month = date("m", $time);
}
$base_prev_month = $base_month - 1;
$base_next_month = $base_month + 1;
$base_next_month_year = $base_year;
$base_prev_month_year = $base_year;
if ($base_prev_month == 0) {
$base_prev_month = 12;
$base_prev_month_year -= 1;
}
if ($base_next_month == 13) {
$base_next_month = 1;
$base_next_month_year += 1;
}
$reg = JFactory::getConfig();
$reg->set("jev.modparams", $this->modparams);
if ($this->modparams->get("showtooltips", 0)) {
$data = $this->datamodel->getCalendarData($cal_year, $cal_month, 1, false, false);
$this->hasTooltips = true;
} else {
$data = $this->datamodel->getCalendarData($cal_year, $cal_month, 1, true, $this->modparams->get("noeventcheck", 0));
}
$reg->set("jev.modparams", false);
$width = $this->modparams->get("mod_cal_width", "135px");
$height = $this->modparams->get("mod_cal_height", "auto");
$rowheight = $this->modparams->get("mod_cal_rowheight", "auto");
$month_name = JEVHelper::getMonthName($cal_month);
$to_day = date("Y-m-d", $this->timeWithOffset);
$today = JevDate::mktime(0, 0, 0, $cal_month, $cal_day, $cal_year);
$cal_prev_month = $cal_month - 1;
$cal_next_month = $cal_month + 1;
$cal_next_month_year = $cal_year;
$cal_prev_month_year = $cal_year;
// additional EBS
if ($cal_prev_month == 0) {
$cal_prev_month = 12;
$cal_prev_month_year -= 1;
}
if ($cal_next_month == 13) {
$cal_next_month = 1;
$cal_next_month_year += 1;
}
$viewname = $this->getTheme();
$viewpath = JURI::root(true) . "/components/{$compname}/views/" . $viewname . "/assets";
$viewimages = $viewpath . "/images";
$linkpref = "index.php?option={$compname}&Itemid=" . $this->myItemid . $this->cat . "&task=";
/*
$linkprevious = $linkpref."month.calendar&day=$cal_day&month=$cal_prev_month&year=$cal_prev_month_year";
$linkprevious = JRoute::_($linkprevious);
$linkprevious = $this->htmlLinkCloaking($linkprevious, '<img border="0" title="' . JText::_("JEV_PREVIOUSMONTH") . '" alt="' . JText::_("JEV_PREVIOUSMONTH") . '" src="'.$viewimages.'/mini_arrowleft.gif"/>' );
*/
$jev_component_name = JEV_COM_COMPONENT;
$this->_navigationJS($this->_modid);
$scriptlinks = "";
if ($this->minical_prevmonth) {
$linkprevious = htmlentities(JURI::base() . "index.php?option={$jev_component_name}&task=modcal.ajax&day=1&month={$base_prev_month}&year={$base_prev_month_year}&modid={$this->_modid}&tmpl=component" . $this->cat);
$scriptlinks .= "linkprevious = '" . $linkprevious . "';\n";
$linkprevious = '<img border="0" title="' . JText::_("JEV_PREVIOUSMONTH") . '" alt="' . JText::_("JEV_LAST_MONTH") . '" class="mod_events_link" src="' . $viewimages . '/mini_arrowleft.gif" onmousedown="callNavigation(\'' . $linkprevious . '\');" />';
} else {
$linkprevious = "";
}
if ($this->minical_actmonth == 1) {
$linkcurrent = $linkpref . "month.calendar&day={$cal_day}&month={$cal_month}&year={$cal_year}";
$linkcurrent = JRoute::_($linkcurrent);
$linkcurrent = $this->htmlLinkCloaking($linkcurrent, $month_name . " " . $cal_year, array("style" => "text-decoration:none;color:inherit;"));
//.........这里部分代码省略.........
示例8: simulateSaveRepeat
function simulateSaveRepeat($requestObject)
{
include_once JPATH_SITE . "/components/com_jevents/jevents.defines.php";
if (!JEVHelper::isEventCreator()) {
throwerror(JText::_('ALERTNOTAUTH'));
}
// Convert formdata to array
$formdata = array();
foreach (get_object_vars($requestObject->formdata) as $k => $v) {
$k = str_replace("[]", "", $k);
$formdata[$k] = $v;
}
$array = JRequest::_cleanVar($formdata, JREQUEST_ALLOWHTML);
if (!array_key_exists("rp_id", $array) || intval($array["rp_id"]) <= 0) {
throwerror(JText::_("Not a repeat", true));
}
$rp_id = intval($array["rp_id"]);
$dataModel = new JEventsDataModel("JEventsAdminDBModel");
$queryModel = new JEventsDBModel($dataModel);
// I should be able to do this in one operation but that can come later
$event = $queryModel->listEventsById(intval($rp_id), 1, "icaldb");
if (!JEVHelper::canEditEvent($event)) {
throwerror(JText::_('ALERTNOTAUTH'));
}
$db =& JFactory::getDBO();
$rpt = new iCalRepetition($db);
$rpt->load($rp_id);
$query = "SELECT detail_id FROM #__jevents_vevent WHERE ev_id={$rpt->eventid}";
$db->setQuery($query);
$eventdetailid = $db->loadResult();
$data["UID"] = valueIfExists($array, "uid", md5(uniqid(rand(), true)));
$data["X-EXTRAINFO"] = valueIfExists($array, "extra_info", "");
$data["LOCATION"] = valueIfExists($array, "location", "");
$data["allDayEvent"] = valueIfExists($array, "allDayEvent", "off");
$data["CONTACT"] = valueIfExists($array, "contact_info", "");
// allow raw HTML (mask =2)
$data["DESCRIPTION"] = valueIfExists($array, "jevcontent", "", 'request', 'html', 2);
$data["publish_down"] = valueIfExists($array, "publish_down", "2006-12-12");
$data["publish_up"] = valueIfExists($array, "publish_up", "2006-12-12");
$interval = valueIfExists($array, "rinterval", 1);
$data["SUMMARY"] = valueIfExists($array, "title", "");
$data["MULTIDAY"] = intval(valueIfExists($array, "multiday", "1"));
$data["NOENDTIME"] = intval(valueIfExists($array, "noendtime", 0));
$ics_id = valueIfExists($array, "ics_id", 0);
if ($data["allDayEvent"] == "on") {
$start_time = "00:00";
} else {
$start_time = valueIfExists($array, "start_time", "08:00");
}
$publishstart = $data["publish_up"] . ' ' . $start_time . ':00';
$data["DTSTART"] = JevDate::strtotime($publishstart);
if ($data["allDayEvent"] == "on") {
$end_time = "23:59";
$publishend = $data["publish_down"] . ' ' . $end_time . ':59';
} else {
$end_time = valueIfExists($array, "end_time", "15:00");
$publishend = $data["publish_down"] . ' ' . $end_time . ':00';
}
$data["DTEND"] = JevDate::strtotime($publishend);
// iCal for whole day uses 00:00:00 on the next day JEvents uses 23:59:59 on the same day
list($h, $m, $s) = explode(":", $end_time . ':00');
if ($h + $m + $s == 0 && $data["allDayEvent"] == "on" && $data["DTEND"] > $data["DTSTART"]) {
$publishend = JevDate::strftime('%Y-%m-%d 23:59:59', $data["DTEND"] - 86400);
$data["DTEND"] = JevDate::strtotime($publishend);
}
$data["X-COLOR"] = valueIfExists($array, "color", "");
// Add any custom fields into $data array
foreach ($array as $key => $value) {
if (strpos($key, "custom_") === 0) {
$data[$key] = $value;
}
}
// populate rpt with data
$start = $data["DTSTART"];
$end = $data["DTEND"];
$rpt->startrepeat = JevDate::strftime('%Y-%m-%d %H:%M:%S', $start);
$rpt->endrepeat = JevDate::strftime('%Y-%m-%d %H:%M:%S', $end);
$rpt->duplicatecheck = md5($rpt->eventid . $start);
$rpt->rp_id = $rp_id;
$rpt->event = $event;
return $rpt;
}
示例9: array
$this->data["dates"][$dn]["slots"][$slot_to_use] = array($event, $blocks, $i);
for ($block = 1; $block < $blocks; $block++) {
if ($cfg->get('flattruncpriorpost', 0) && $this->data["dates"][$dn + $block]["month"] != $this->month) {
// RESET THE BLOCK COUNT FOR THE END OF MONTH AND BREAK
$this->data["dates"][$dn]["slots"][$slot_to_use] = array($event, $block, $i);
break;
}
$this->data["dates"][$dn + $block]["slots"][$slot_to_use] = array($event, 0, $i);
}
}
} else {
$event->_length = 1;
}
// For events into their second or third week then update blocks accordingly
if ($dayOfWeek == 0 && $currentDay["cellDate"] != $event->_startday) {
$event->_length = JevDate::strtotime($event->endDate()) - $currentDay["cellDate"];
$event->_length = intval(round($event->_length / 86400, 0)) + 1;
if ($dayOfWeek + $event->_length > 6) {
$blocks = 7 - $dayOfWeek;
} else {
$blocks = $event->_length;
}
$this->data["dates"][$dn]["slots"][$slot_to_use] = array($event, $blocks, $i);
for ($block = 1; $block < $blocks; $block++) {
$this->data["dates"][$dn + $block]["slots"][$slot_to_use] = array($event, 0, $i);
}
}
// mark event as shown
$event->_shown = true;
}
}
示例10: getAjaxCal
function getAjaxCal($modid = 0, $month, $year)
{
// capture module id so that we can use it for ajax type navigation
if ($modid != 0) {
$this->_modid = $modid;
}
$user =& JFactory::getUser();
$db =& JFactory::getDBO();
static $isloaded_css = false;
// this will get the viewname based on which classes have been implemented
$cfg =& JEVConfig::getInstance();
$viewname = ucfirst($cfg->get('com_calViewName', "default"));
$cfg =& JEVConfig::getInstance();
// get array
$day_name = JEVHelper::getWeekdayLetter(null, 1);
$day_name[0] = '<span class="sunday">' . $day_name[0] . '</span>';
$day_name[6] = '<span class="saturday">' . $day_name[6] . '</span>';
$content = "";
$mod = "";
if (isset($this->_modid) && $this->_modid > 0) {
$mod = 'id="modid_' . $this->_modid . '" ';
$content .= "<span id='testspan" . $this->_modid . "' style='display:none'></span>\n";
}
$temptime = JevDate::mktime(12, 0, 0, $month, 15, $year);
//$content .= $this->_displayCalendarMod($temptime,$this->com_starday, JText::_('JEV_THIS_MONTH'),$day_name, false);
$thisDayOfMonth = date("j", $temptime);
$daysLeftInMonth = date("t", $temptime) - date("j", $temptime) + 1;
// calculate month offset from first of month
$first_of_current_month = JevDate::strtotime(date('Y-m-01', $temptime));
$base_year = date("Y", $temptime);
$base_month = date("m", $temptime);
$basefirst_of_month = JevDate::mktime(0, 0, 0, $base_month, 1, $base_year);
if ($this->disp_lastMonth && (!$this->disp_lastMonthDays || $thisDayOfMonth <= $this->disp_lastMonthDays)) {
$content .= $this->_displayCalendarMod(JevDate::strtotime("-1 month", $first_of_current_month), $this->com_starday, JText::_('JEV_LAST_MONTH'), $day_name, $this->disp_lastMonth == 2, $first_of_current_month);
}
$content .= $this->_displayCalendarMod($temptime, $this->com_starday, JText::_('JEV_THIS_MONTH'), $day_name, false, $first_of_current_month);
if ($this->disp_nextMonth && (!$this->disp_nextMonthDays || $daysLeftInMonth <= $this->disp_nextMonthDays)) {
$content .= $this->_displayCalendarMod(JevDate::strtotime("+1 month", $first_of_current_month), $this->com_starday, JText::_('JEV_NEXT_MONTH'), $day_name, $this->disp_nextMonth == 2, $first_of_current_month);
}
return $content;
}
示例11: unixTime
/**
* iCal spec represents date in ISO 8601 format followed by "T" then the time
* a "Z at the end means the time is UTC and not local time zone
*
* TODO make sure if time is UTC we take account of system time offset properly
*
*/
function unixTime($ical_date, $tz = false)
{
jimport("joomla.utilities.date");
static $offset = null;
if (is_null($offset)) {
$config =& JFactory::getConfig();
$offset = $config->getValue('config.offset', 0);
}
if (!is_numeric($ical_date)) {
$t = JevDate::strtotime($ical_date);
if (JString::strpos($ical_date, "Z") > 0) {
if (is_callable("date_default_timezone_set")) {
$timezone = date_default_timezone_get();
// See http://www.php.net/manual/en/timezones.php
$params = JComponentHelper::getParams(JEV_COM_COMPONENT);
// server offset tiemzone
if ($params->get("icaltimezone", "") != "") {
date_default_timezone_set($params->get("icaltimezone", ""));
}
// server offset PARAMS
$serveroffset1 = (JevDate::strtotime(JevDate::strftime('%Y%m%dT%H%M%S', $t)) - JevDate::strtotime(JevDate::strftime('%Y%m%dT%H%M%SZ', $t))) / 3600;
// server offset SERVER
date_default_timezone_set($timezone);
$serveroffset2 = (JevDate::strtotime(JevDate::strftime('%Y%m%dT%H%M%S', $t)) - JevDate::strtotime(JevDate::strftime('%Y%m%dT%H%M%SZ', $t))) / 3600;
$t = new JevDate($ical_date, $serveroffset1 - $serveroffset2);
//$t = new JevDate($ical_date );
date_default_timezone_set($timezone);
echo "icaldate = " . $ical_date . " imported date=" . $t->toMySQL() . "<br/>";
} else {
// Summer Time adjustment
list($y, $m, $d, $h, $min, $s) = explode(":", JevDate::strftime('%Y:%m:%d:%H:%M:%S', $t));
$dst = (JevDate::mktime($h, $min, $s, $m, $d, $y, 0) - JevDate::mktime($h, $min, $s, $m, $d, $y, -1)) / 3600;
// server offset including DST
$serveroffset = (JevDate::strtotime(JevDate::strftime('%Y%m%dT%H%M%S', $t)) - JevDate::strtotime(JevDate::strftime('%Y%m%dT%H%M%SZ', $t))) / 3600;
$serveroffset += $dst;
$t = new JevDate($ical_date, -($serveroffset + $offset));
}
/*
echo "<h3>SET TIMEZONE</h3>";
$timezone= date_default_timezone_get();
date_default_timezone_set('America/New_York');
$tempIcal = "20091020T163000Z";
echo $tempIcal."<br/>";
$temp = JevDate::strtotime($tempIcal);
list($y,$m,$d,$h,$min,$s) = explode(":", JevDate::strftime('%Y:%m:%d:%H:%M:%S',$temp));
echo "$y,$m,$d,$h,$min,$s<br/>";
$dst = (JevDate::mktime($h,$min,$s,$m,$d,$y,0)-JevDate::mktime($h,$min,$s,$m,$d,$y,-1))/3600;
$so = (JevDate::strtotime(JevDate::strftime('%Y%m%dT%H%M%S',$temp))-JevDate::strtotime(JevDate::strftime('%Y%m%dT%H%M%SZ',$temp)))/3600;
echo " dst=".$dst." serverforoffset=".$so."<br/>";
$so += $dst;
$t = new JevDate($tempIcal);
echo $t->toMySQL()."<br><br/>";
$tempIcal = "20091029T163000Z";
echo $tempIcal."<br/>";
$temp = JevDate::strtotime($tempIcal);
list($y,$m,$d,$h,$min,$s) = explode(":", JevDate::strftime('%Y:%m:%d:%H:%M:%S',$temp));
echo "$y,$m,$d,$h,$min,$s<br/>";
$dst = (JevDate::mktime($h,$min,$s,$m,$d,$y,0)-JevDate::mktime($h,$min,$s,$m,$d,$y,-1))/3600;
$so = (JevDate::strtotime(JevDate::strftime('%Y%m%dT%H%M%S',$temp))-JevDate::strtotime(JevDate::strftime('%Y%m%dT%H%M%SZ',$temp)))/3600;
echo " dst=".$dst." serverforoffset=".$so."<br/>";
$so += $dst;
$t = new JevDate($tempIcal );
echo $t->toMySQL()."<br><br/>";
$tempIcal = "20091103T163000Z";
echo $tempIcal."<br/>";
$temp = JevDate::strtotime($tempIcal);
list($y,$m,$d,$h,$min,$s) = explode(":", JevDate::strftime('%Y:%m:%d:%H:%M:%S',$temp));
echo "$y,$m,$d,$h,$min,$s<br/>";
$dst = (JevDate::mktime($h,$min,$s,$m,$d,$y,0)-JevDate::mktime($h,$min,$s,$m,$d,$y,-1))/3600;
$so = (JevDate::strtotime(JevDate::strftime('%Y%m%dT%H%M%S',$temp))-JevDate::strtotime(JevDate::strftime('%Y%m%dT%H%M%SZ',$temp)))/3600;
echo " dst=".$dst." serverforoffset=".$so."<br/>";
$so += $dst;
$t = new JevDate($tempIcal);
echo $t->toMySQL()."<br>";
*/
} else {
if ($tz != false && $tz != "") {
// really should use the timezone of the inputted date
$tz = new DateTimeZone($tz);
$t = new JevDate($ical_date, $tz);
echo "icaldate = " . $ical_date . " imported date=" . $t->toMySQL() . "<br/>";
} else {
$compparams = JComponentHelper::getParams(JEV_COM_COMPONENT);
$jtz = $compparams->get("icaltimezonelive", "");
if ($jtz) {
$t = new JevDate($ical_date, $jtz);
} else {
$t = new JevDate($ical_date);
}
//.........这里部分代码省略.........
示例12: processMatch
protected function processMatch(&$content, $match, $dayEvent, $dateParm, $relDay)
{
$datenow = JEVHelper::getNow();
$dispatcher =& JDispatcher::getInstance();
// get the title and start time
$startDate = JevDate::strtotime($dayEvent->publish_up());
if ($relDay > 0) {
$eventDate = JevDate::strtotime($datenow->toFormat('%Y-%m-%d ') . JevDate::strftime('%H:%M', $startDate) . " +{$relDay} days");
} else {
$eventDate = JevDate::strtotime($datenow->toFormat('%Y-%m-%d ') . JevDate::strftime('%H:%M', $startDate) . " {$relDay} days");
}
$endDate = JevDate::strtotime($dayEvent->publish_down());
list($st_year, $st_month, $st_day) = explode('-', JevDate::strftime('%Y-%m-%d', $startDate));
list($ev_year, $ev_month, $ev_day) = explode('-', JevDate::strftime('%Y-%m-%d', $startDate));
$task_events = 'icalrepeat.detail';
switch ($match) {
case 'endDate':
case 'startDate':
case 'eventDate':
// Note we need to examine the date specifiers used to determine if language translation will be
// necessary. Do this later when script is debugged.
if (!$this->disableDateStyle) {
$content .= '<span class="mod_events_latest_date">';
}
if (!$dayEvent->alldayevent() && $match == "endDate" && ($dayEvent->noendtime() || $dayEvent->getUnixStartTime() == $dayEvent->getUnixEndTime())) {
$time_fmt = "";
} else {
if (!isset($dateParm) || $dateParm == '') {
if ($this->com_calUseStdTime) {
$time_fmt = $dayEvent->alldayevent() ? '' : ' @%l:%M%p';
} else {
$time_fmt = $dayEvent->alldayevent() ? '' : ' @%H:%M';
}
$dateFormat = $this->displayYear ? '%a %b %d, %Y' . $time_fmt : '<span class="eventDay">%a</span> <span class="eventDate">%d<span class="eventMonth">%b</span></span>';
$jmatch = new JevDate(${$match});
$content .= $jmatch->toFormat($dateFormat);
//$content .= JEV_CommonFunctions::jev_strftime($dateFormat, $$match);
} else {
// format endDate when midnight to show midnight!
if ($match == "endDate" && $dayEvent->sdn() == 59) {
$tempEndDate = $endDate + 1;
if ($dayEvent->alldayevent()) {
// if an all day event then we don't want to roll to the next day
$tempEndDate -= 86400;
}
$match = "tempEndDate";
}
// if a '%' sign detected in date format string, we assume JevDate::strftime() is to be used,
if (preg_match("/\\%/", $dateParm)) {
$jmatch = new JevDate(${$match});
$content .= $jmatch->toFormat($dateParm);
} else {
$content .= date($dateParm, ${$match});
}
if ($match == "tempDndDate") {
$match = "endDate";
}
}
}
if (!$this->disableDateStyle) {
$content .= "</span>";
}
break;
case 'title':
$title = $dayEvent->title();
if (!empty($dateParm)) {
$parts = explode("|", $dateParm);
if (count($parts) > 0 && strlen($title) > intval($parts[0])) {
$title = substr($title, 0, intval($parts[0]));
if (count($parts) > 1) {
$title .= $parts[1];
}
}
}
if (!$this->disableTitleStyle) {
$content .= '<span class="mod_events_latest_content">';
}
if ($this->displayLinks) {
$link = $dayEvent->viewDetailLink($ev_year, $ev_month, $ev_day, false, $this->myItemid);
$link = JRoute::_($link . $this->datamodel->getCatidsOutLink());
$content .= $this->_htmlLinkCloaking($link, JEventsHTML::special($title));
} else {
$content .= JEventsHTML::special($title);
}
if (!$this->disableTitleStyle) {
$content .= '</span>';
}
break;
case 'category':
$catobj = $dayEvent->getCategoryName();
$content .= JEventsHTML::special($catobj);
break;
case 'calendar':
$catobj = $dayEvent->getCalendarName();
$content .= JEventsHTML::special($catobj);
break;
case 'contact':
// Also want to cloak contact details so
$this->modparams->set("image", 1);
$dayEvent->text = $dayEvent->contact_info();
//.........这里部分代码省略.........
示例13: vtimezone
private function vtimezone($icalEvents)
{
$params = JComponentHelper::getParams(JEV_COM_COMPONENT);
$tzid = "";
if (is_callable("date_default_timezone_set")) {
$current_timezone = date_default_timezone_get();
// Do the Timezone definition
$tzid = ";TZID={$current_timezone}";
// find the earliest start date
$firststart = false;
foreach ($icalEvents as $a) {
if (!$firststart || $a->getUnixStartTime() < $firststart) {
$firststart = $a->getUnixStartTime();
}
}
// Subtract 1 leap year to make sure we have enough transitions
$firststart -= 31622400;
$timezone = new DateTimeZone($current_timezone);
if (version_compare(PHP_VERSION, "5.3.0") >= 0) {
$transitions = $timezone->getTransitions($firststart);
} else {
$transitions = $timezone->getTransitions();
}
$tzindex = 0;
while (JevDate::strtotime($transitions[$tzindex]['time']) < $firststart) {
$tzindex++;
}
$transitions = array_slice($transitions, $tzindex);
if (count($transitions) >= 2) {
$lastyear = $params->get("com_latestyear", 2020);
echo "BEGIN:VTIMEZONE\n";
echo "TZID:{$current_timezone}\n";
for ($t = 0; $t < count($transitions); $t++) {
$transition = $transitions[$t];
if ($transition['isdst'] == 0) {
if (JevDate::strftime("%Y", $transition['ts']) > $lastyear) {
continue;
}
echo "BEGIN:STANDARD\n";
echo "DTSTART:" . JevDate::strftime("%Y%m%dT%H%M%S\n", $transition['ts']);
if ($t < count($transitions) - 1) {
echo "RDATE:" . JevDate::strftime("%Y%m%dT%H%M%S\n", $transitions[$t + 1]['ts']);
}
// if its the first transition then assume the old setting is the same as the next otherwise use the previous value
$prev = $t;
$prev += $t == 0 ? 1 : -1;
$offset = $transitions[$prev]["offset"];
$sign = $offset >= 0 ? "+" : "-";
$offset = abs($offset);
$offset = $sign . sprintf("%04s", floor($offset / 3600) * 100 + $offset % 60);
echo "TZOFFSETFROM:{$offset}\n";
$offset = $transitions[$t]["offset"];
$sign = $offset >= 0 ? "" : "-";
$offset = abs($offset);
$offset = $sign . sprintf("%04s", floor($offset / 3600) * 100 + $offset % 60);
echo "TZOFFSETTO:{$offset}\n";
echo "TZNAME:{$current_timezone} " . $transitions[$t]["abbr"] . "\n";
echo "END:STANDARD\n";
}
}
for ($t = 0; $t < count($transitions); $t++) {
$transition = $transitions[$t];
if ($transition['isdst'] == 1) {
if (JevDate::strftime("%Y", $transition['ts']) > $lastyear) {
continue;
}
echo "BEGIN:DAYLIGHT\n";
echo "DTSTART:" . JevDate::strftime("%Y%m%dT%H%M%S\n", $transition['ts']);
if ($t < count($transitions) - 1) {
echo "RDATE:" . JevDate::strftime("%Y%m%dT%H%M%S\n", $transitions[$t + 1]['ts']);
}
// if its the first transition then assume the old setting is the same as the next otherwise use the previous value
$prev = $t;
$prev += $t == 0 ? 1 : -1;
$offset = $transitions[$prev]["offset"];
$sign = $offset >= 0 ? "+" : "-";
$offset = abs($offset);
$offset = $sign . sprintf("%04s", floor($offset / 3600) * 100 + $offset % 60);
echo "TZOFFSETFROM:{$offset}\n";
$offset = $transitions[$t]["offset"];
$sign = $offset >= 0 ? "" : "-";
$offset = abs($offset);
$offset = $sign . sprintf("%04s", floor($offset / 3600) * 100 + $offset % 60);
echo "TZOFFSETTO:{$offset}\n";
echo "TZNAME:{$current_timezone} " . $transitions[$t]["abbr"] . "\n";
echo "END:DAYLIGHT\n";
}
}
echo "END:VTIMEZONE\n";
}
}
return $tzid;
}
示例14: datetimeToUtcIcsFormat
/**
* Function converts datetime to iCal format
*
* @param datetime Datetime of the event
* @return converted datetime in iCal format
*/
private function datetimeToUtcIcsFormat($datetime)
{
$datetime = JevDate::strtotime($datetime);
return gmdate("Ymd", $datetime) . "T" . gmdate("His", $datetime) . "Z";
}
示例15: JFeedImage
$doc->setDescription($this->info['description']);
$docimage = new JFeedImage();
$docimage->set('description', $this->info['description']);
$docimage->set('title', $this->info['title']);
$docimage->set('url', $this->info['image_url']);
$docimage->set('link', $this->info['imagelink']);
$doc->set('image', $docimage);
foreach ($this->eventsByRelDay as $relDay => $ebrd) {
foreach ($ebrd as $row) {
// title for particular item
$item_title = htmlspecialchars($row->title());
$item_title = html_entity_decode($item_title);
// url link to article
$startDate = $row->publish_up();
//$eventDate = JevDate::mktime(substr($startDate,11,2),substr($startDate,14,2), substr($startDate,17,2),$this->jeventCalObject->now_m,$this->jeventCalObject->now_d + $relDay,$this->jeventCalObject->now_Y);
$eventDate = JevDate::strtotime($startDate);
$targetid = $this->modparams->get("target_itemid", 0);
$link = $row->viewDetailLink(date("Y", $eventDate), date("m", $eventDate), date("d", $eventDate), false, $targetid);
$item_link = JRoute::_($link . $this->jeventCalObject->datamodel->getCatidsOutLink());
// removes all formating from the intro text for the description text
$item_description = $row->content();
if ($this->info['limit_text']) {
if ($this->info['text_length']) {
$item_description = JFilterOutput::cleanText($item_description);
// limits description text to x words
$item_description_array = explode(' ', $item_description);
$count = count($item_description_array);
if ($count > $this->info['text_length']) {
$item_description = '';
for ($a = 0; $a < $this->info['text_length']; $a++) {
$item_description .= $item_description_array[$a] . ' ';