当前位置: 首页>>代码示例>>PHP>>正文


PHP JemHelper::isValidDate方法代码示例

本文整理汇总了PHP中JemHelper::isValidDate方法的典型用法代码示例。如果您正苦于以下问题:PHP JemHelper::isValidDate方法的具体用法?PHP JemHelper::isValidDate怎么用?PHP JemHelper::isValidDate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JemHelper的用法示例。


在下文中一共展示了JemHelper::isValidDate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: array

			<?php 
    echo $this->params->get('introtext');
    ?>
		</div>
		<p> </p>
	<?php 
}
?>

	<?php 
$countcatevents = array();
$countperday = array();
$limit = $this->params->get('daylimit', 10);
$catinfo = array();
foreach ($this->rows as $row) {
    if (!JemHelper::isValidDate($row->dates)) {
        continue;
        // skip, open date !
    }
    //get event date
    $year = strftime('%Y', strtotime($row->dates));
    $month = strftime('%m', strtotime($row->dates));
    $day = strftime('%d', strtotime($row->dates));
    @$countperday[$year . $month . $day]++;
    if ($countperday[$year . $month . $day] == $limit + 1) {
        $var1a = JRoute::_('index.php?view=day&id=' . $year . $month . $day);
        $var1b = JText::_('COM_JEM_AND_MORE');
        $var1c = "<a href=\"" . $var1a . "\">" . $var1b . "</a>";
        $id = 'eventandmore';
        $this->cal->setEventContent($year, $month, $day, $var1c, null, $id);
        continue;
开发者ID:JKoelman,项目名称:JEM-3,代码行数:31,代码来源:default.php

示例2: eventDateTime

 static function eventDateTime($row, $dateStart = false, $timeStart = false, $dateEnd = false, $timeEnd = false)
 {
     # @todo add support for suffix time
     # @todo replace strftime by date
     if (!$row) {
         return false;
     }
     if (!JemHelper::isValidDate($row->dates)) {
         # for the date function we need at least a valid startdate
         return false;
     }
     $result = "";
     $settings = JemHelper::config();
     $timeFormat = $settings->formattime;
     $dateFormat = $settings->formatdate;
     if ($timeFormat) {
         # mapping of time values
         # incoming values are in strftime format
         # output is in date format
         $timeFormat = str_replace('%H', 'H', $timeFormat);
         $timeFormat = str_replace('%M', 'i', $timeFormat);
         $timeFormat = str_replace('%p', 'A', $timeFormat);
         $timeFormat = str_replace('%P', 'a', $timeFormat);
         $timeFormat = str_replace('%I', 'h', $timeFormat);
         $timeFormat = str_replace('%l', 'g', $timeFormat);
     } else {
         $timeFormat = "H:i";
     }
     if (!$dateFormat) {
         $dateFormat = "D, M. j, Y";
     }
     # we have a row so let's combine the date+time and retrieve the date parts
     ########################
     ## COMBINE DATE/TIMES ##
     ########################
     # -- date/time Start --
     # at this point we have a startddate
     # but we've to see if we have a starttime
     $rowtime = $row->times;
     if ($row->times == null || $row->times == '00:00:00') {
         $rowtime = null;
         $row->times = '00:00:00';
     }
     $datetimeStart = new JDate($row->dates . ' ' . $row->times);
     $otimeStart = $datetimeStart->format('H:i');
     $odateStart = $datetimeStart->format($dateFormat);
     if ($otimeStart == '00.00' || $otimeStart == '00:00') {
         if ($rowtime == null) {
             $otimeStart = "";
         } else {
             $otimeStart = $datetimeStart->format($timeFormat);
         }
     } else {
         $otimeStart = $datetimeStart->format($timeFormat);
     }
     # -- date/time End --
     # - no enddate + no endtime = blank both variables
     # - no enddate + endtime = the time will be combined with the startdate
     # - enddate + endtime = the time + enddate will be filled
     # - enddate + no endtime = the time will be blanked, but the date will be outputted
     $rowendtime = $row->endtimes;
     if ($row->endtimes == null || $row->endtimes == '00:00:00') {
         $rowendtime = null;
         $row->endtimes = '00:00:00';
     }
     if (!($row->enddates == null || $row->enddates == '0000-00-00')) {
         # we have a enddate
         $datetimeEnd = new JDate($row->enddates . ' ' . $row->endtimes);
         $odateEnd = $datetimeEnd->format($dateFormat);
         $otimeEnd = $datetimeEnd->format('H:i');
         if ($otimeEnd == '00.00' || $otimeEnd == '00:00') {
             if ($rowendtime == null) {
                 $otimeEnd = "";
             } else {
                 $otimeEnd = $datetimeEnd->format($timeFormat);
             }
         } else {
             $otimeEnd = $datetimeEnd->format($timeFormat);
         }
     }
     if ($row->enddates == null || $row->enddates == '0000-00-00') {
         # we don't have a enddate, but do we have a endtime?
         $odateEnd = "";
         if ($rowendtime == null) {
             $otimeEnd = "";
         } else {
             # we do have a endtime but no enddate so let's combine it with the startddate
             $datetimeEnd = new JDate($row->dates . ' ' . $row->endtimes);
             //$odateEnd		= $datetimeEnd->format($dateFormat);
             $otimeEnd = $datetimeEnd->format($timeFormat);
         }
     }
     # outputting
     $result = array();
     if ($dateStart) {
         $result['dateStart'] = $odateStart;
     }
     if ($timeStart) {
         $lang = JFactory::getLanguage();
         if ($lang->getTag() == 'zh-TW') {
//.........这里部分代码省略.........
开发者ID:JKoelman,项目名称:JEM-3,代码行数:101,代码来源:output.class.php

示例3: formatSchemaOrgDateTime

	static function formatSchemaOrgDateTime($dateStart, $timeStart, $dateEnd = "", $timeEnd = "")
	{
		$settings = JemHelper::globalattribs();
		$output = "";
		$formatD = "Y-m-d";
		$formatT = "%H:%M";

		if(JemHelper::isValidDate($dateStart)) {
			$content = self::formatdate($dateStart, $formatD);

			if($settings->get('global_show_timedetails','1') && $timeStart) {
				$content .= 'T'.self::formattime($timeStart, $formatT, false);
			}
			$output .= '<meta itemprop="startDate" content="'.$content.'" />';

			if(JemHelper::isValidDate($dateEnd)) {
				$content = self::formatdate($dateEnd, $formatD);

				if($settings->get('global_show_timedetails','1') && $timeEnd) {
					$content .= 'T'.self::formattime($timeEnd, $formatT, false);
				}
				$output .= '<meta itemprop="endDate" content="'.$content.'" />';
			}
		} else {
			// Open date

			if($settings->get('global_show_timedetails','1')) {
				if($timeStart) {
					$content = self::formattime($timeStart, $formatT, false);
					$output .= '<meta itemprop="startDate" content="'.$content.'" />';
				}
				// Display end time only when both times are set
				if($timeStart && $timeEnd) {
					$content .= self::formattime($timeEnd, $formatT, false);
					$output .= '<meta itemprop="endDate" content="'.$content.'" />';
				}
			}
		}
		return $output;
	}
开发者ID:BillVGN,项目名称:PortalPRP,代码行数:40,代码来源:output.class.php

示例4: icalAddEvent

 static function icalAddEvent(&$calendartool, $event, $rows)
 {
     require_once JPATH_SITE . '/components/com_jem/classes/iCalcreator.class.php';
     $jemsettings = JemHelper::config();
     $settings = JemHelper::globalattribs();
     $config = JFactory::getConfig();
     $sitename = $config->get('sitename');
     # retrieve TimezoneName
     # if we have a timezone for the venue then that info will be used for the output
     if ($event->timezone) {
         # venue - timeZone
         $timezone_name = $event->timezone;
     } else {
         # global - TimeZone
         $timezone_name = JemHelper::getTimeZoneName();
     }
     // get categories names
     $categories = array();
     foreach ($event->categories as $c) {
         $categories[] = $c->catname;
     }
     // no start date...
     $validdate = JemHelper::isValidDate($event->dates);
     if (!$event->dates || !$validdate) {
         return false;
     }
     // make end date same as start date if not set
     if (!$event->enddates) {
         $event->enddates = $event->dates;
     }
     // start
     if (!preg_match('/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})/', $event->dates, $start_date)) {
         JError::raiseError(0, JText::_('COM_JEM_ICAL_EXPORT_WRONG_STARTDATE_FORMAT'));
     }
     $date = array('year' => (int) $start_date[1], 'month' => (int) $start_date[2], 'day' => (int) $start_date[3]);
     // all day event if start time is not set
     if (!$event->times) {
         $dateparam = array('VALUE' => 'DATE');
         // for ical all day events, dtend must be send to the next day
         $event->enddates = strftime('%Y-%m-%d', strtotime($event->enddates . ' +1 day'));
         if (!preg_match('/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})/', $event->enddates, $end_date)) {
             JError::raiseError(0, JText::_('COM_JEM_ICAL_EXPORT_WRONG_ENDDATE_FORMAT'));
         }
         $date_end = array('year' => $end_date[1], 'month' => $end_date[2], 'day' => $end_date[3]);
         $dateendparam = array('VALUE' => 'DATE');
     } else {
         if (!preg_match('/([0-9]{2}):([0-9]{2}):([0-9]{2})/', $event->times, $start_time)) {
             JError::raiseError(0, JText::_('COM_JEM_ICAL_EXPORT_WRONG_STARTTIME_FORMAT'));
         }
         $date['hour'] = $start_time[1];
         $date['min'] = $start_time[2];
         $date['sec'] = $start_time[3];
         $dateparam = array('VALUE' => 'DATE-TIME');
         if ($settings->get('ical_tz', 0) == 1) {
             $dateparam['TZID'] = $timezone_name;
         }
         if (!$event->endtimes || $event->endtimes == '00:00:00') {
             $event->endtimes = $event->times;
         }
         // if same day but end time < start time, change end date to +1 day
         if ($event->enddates == $event->dates && strtotime($event->dates . ' ' . $event->endtimes) < strtotime($event->dates . ' ' . $event->times)) {
             $event->enddates = strftime('%Y-%m-%d', strtotime($event->enddates . ' +1 day'));
         }
         if (!preg_match('/([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})/', $event->enddates, $end_date)) {
             JError::raiseError(0, JText::_('COM_JEM_ICAL_EXPORT_WRONG_ENDDATE_FORMAT'));
         }
         $date_end = array('year' => $end_date[1], 'month' => $end_date[2], 'day' => $end_date[3]);
         if (!preg_match('/([0-9]{2}):([0-9]{2}):([0-9]{2})/', $event->endtimes, $end_time)) {
             JError::raiseError(0, JText::_('COM_JEM_ICAL_EXPORT_WRONG_STARTTIME_FORMAT'));
         }
         $date_end['hour'] = $end_time[1];
         $date_end['min'] = $end_time[2];
         $date_end['sec'] = $end_time[3];
         $dateendparam = array('VALUE' => 'DATE-TIME');
         if ($settings->get('ical_tz') == 1) {
             $dateendparam['TZID'] = $timezone_name;
         }
     }
     // item description text
     $description = $event->title . '\\n';
     $description .= JText::_('COM_JEM_CATEGORY') . ': ' . implode(', ', $categories) . '\\n';
     $link = JURI::root() . JemHelperRoute::getEventRoute($event->slug);
     $link = JRoute::_($link);
     $description .= JText::_('COM_JEM_ICS_LINK') . ': ' . $link . '\\n';
     // location
     $location = array($event->venue);
     if (isset($event->street) && !empty($event->street)) {
         $location[] = $event->street;
     }
     if (isset($event->postalCode) && !empty($event->postalCode) && isset($event->city) && !empty($event->city)) {
         $location[] = $event->postalCode . ' ' . $event->city;
     } else {
         if (isset($event->postalCode) && !empty($event->postalCode)) {
             $location[] = $event->postalCode;
         }
         if (isset($event->city) && !empty($event->city)) {
             $location[] = $event->city;
         }
     }
     if (isset($event->countryname) && !empty($event->countryname)) {
//.........这里部分代码省略.........
开发者ID:JKoelman,项目名称:JEM-3,代码行数:101,代码来源:helper.php


注:本文中的JemHelper::isValidDate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。