Файловый менеджер - Редактировать - /home/wuectly/www/03cbe/date.tar
Назад
index.html 0000604 00000000037 15245611116 0006537 0 ustar 00 <!DOCTYPE html><title></title> period.php 0000604 00000007202 15245611116 0006536 0 ustar 00 <?php /** *------------------------------------------------------------------------------ * iC Library - Library by Jooml!C, for Joomla! *------------------------------------------------------------------------------ * @package iC Library * @subpackage date * @copyright Copyright (c)2014-2015 Cyril Rezé, Jooml!C - All rights reserved * * @license GNU General Public License version 3 or later; see LICENSE.txt * @author Cyril Rezé (Lyr!C) * @link http://www.joomlic.com * * @version 1.2.2 2015-03-06 * @since 1.1.0 *------------------------------------------------------------------------------ */ // No direct access to this file defined('_JEXEC') or die(); /** * class iCDate */ class iCDatePeriod { /** * Function to return all dates of a period (from ... to ...) * * @access public static * @param $startdate : start datetime of the period (0000-00-00 00:00:00) * $enddate : end datetime of the period (0000-00-00 00:00:00) * $timezone : Time zone to be used for the date. * Special cases: boolean true for user setting, boolean false for server setting. * Default: null, no timezone. * @return array of all dates of the period * * @since 1.1.0 */ static public function listDates($startdate, $enddate, $timezone = null) { $test_startdate = iCDate::isDate($startdate); $test_enddate = iCDate::isDate($enddate); $out = array(); if ($test_startdate && $test_enddate) { $timestartdate = date('H:i', strtotime($startdate)); $timeenddate = date('H:i', strtotime($enddate)); if (class_exists('DateInterval')) { // Create array with all dates of the period - PHP 5.3+ $start = new DateTime($startdate); $interval = '+1 days'; $date_interval = DateInterval::createFromDateString($interval); if ($timeenddate <= $timestartdate) { $end = new DateTime("$enddate +1 days"); } else { $end = new DateTime($enddate); } // Return all dates. $perioddates = new DatePeriod($start, $date_interval, $end); foreach($perioddates as $date) { $out[] = ( $date->format('Y-m-d H:i') ); } } else { // TO BE REMOVED : when Joomla 2.5 and php 5.2 support will end // Create array with all dates of the period - PHP 5.2 $nodate = '0000-00-00 00:00:00'; if (($startdate != $nodate) && ($enddate != $nodate)) { $start = new DateTime($startdate); if ($timeenddate <= $timestartdate) { $end = new DateTime("$enddate +1 days"); } else { $end = new DateTime($enddate); } while($start < $end) { $out[] = $start->format('Y-m-d H:i'); $start->modify('+1 day'); } } } return $out; } else { return array(); } } /** * Return weekdays data to array of days of the week selected * * @access public static * @param $weekdays : weekdays saved in database (x,x,x) * @return array of all weekdays of the period * * @since 1.2.0 */ static public function weekdaysToArray($i_weekdays) { $allWeekDays = array(0,1,2,3,4,5,6); $weekdays = isset($i_weekdays) ? $i_weekdays : array(); $weekdays = explode (',', $weekdays); $weekdaysarray = array(); foreach ($weekdays as $day) { array_push($weekdaysarray, $day); } if (in_array('', $weekdaysarray)) // Joomla 2.5 multiple select { $arrayWeekDays = $allWeekDays; } elseif ($i_weekdays) { $arrayWeekDays = $weekdaysarray; } elseif (in_array('0', $weekdaysarray)) // Sunday only selected { $arrayWeekDays = $weekdaysarray; } else { $arrayWeekDays = $allWeekDays; } return $arrayWeekDays; } } date.php 0000604 00000004771 15245611116 0006201 0 ustar 00 <?php /** *------------------------------------------------------------------------------ * iC Library - Library by Jooml!C, for Joomla! *------------------------------------------------------------------------------ * @package iC Library * @subpackage date * @copyright Copyright (c)2014-2015 Cyril Rezé, Jooml!C - All rights reserved * * @license GNU General Public License version 3 or later; see LICENSE.txt * @author Cyril Rezé (Lyr!C) * @link http://www.joomlic.com * * @version 1.2.4 2015-05-06 * @since 1.0.3 *------------------------------------------------------------------------------ */ // No direct access to this file defined('_JEXEC') or die(); /** * class iCDate */ class iCDate { /** * Function to test if date is a valid Datetime * * @access public static * @param $date : date to be tested (1993-04-30 14:33:00) * @return alias * * @since 1.1.0 */ static public function isDate($date) { $stamp = strtotime($date); $date_numeric = iCDate::dateToNumeric($date); $date_valid = str_replace('0', '', $date_numeric); if ( ! is_numeric($stamp) || ! $date_valid) { return false; } return true; } /** * Function to convert datetime to numeric * * @access public static * @param $date: date to convert (1993-04-30 14:33:00 -> 19930430143300) * @return alias * * @since 1.1.0 */ static public function dateToNumeric($date) { $date = preg_replace("/[^0-9]/","", $date); return $date; } /** * Function to convert datetime to alias * * @access public static * @param $date: date to convert (1993-04-30 14:33:00 -> 1993-04-30-14-33-00) * $format: format of the date before convertion (eg. Y-m-d if only date) * default format: use parent format * @return alias * * @since 1.0.3 */ static public function dateToAlias($date, $format = null) { if ($format) { $date = date($format, strtotime($date)); } if (self::isDate($date)) { $replace = array(' ', ':'); $date = str_replace($replace, '-', $date); return $date; } return false; } /** * Format Month Short Core - From Joomla language file xx-XX.ini (eg. Apr) * * @access public static * @param $date: date to convert (1993-04-30 14:33:00 -> Apr) * @return translation string for MONTH_SHORT * * @since 1.2.0 */ static public function monthShortJoomla($date) { $month = date('F', strtotime($date)); $monthShortJoomla = JText::_($month . '_SHORT'); return $monthShortJoomla; } }
| ver. 1.4 |
Github
|
.
| PHP 8.1.34 | Генерация страницы: 0 |
proxy
|
phpinfo
|
Настройка