本文整理汇总了PHP中JUtility::isWinOS方法的典型用法代码示例。如果您正苦于以下问题:PHP JUtility::isWinOS方法的具体用法?PHP JUtility::isWinOS怎么用?PHP JUtility::isWinOS使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JUtility
的用法示例。
在下文中一共展示了JUtility::isWinOS方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: jev_strftime
/**
* Support all JevDate::strftime() parameter for Window systems
*
* @param string $format
* @param int $timestamp
* @return string formated string
*/
function jev_strftime($format = '', $timestamp = null)
{
if (!$timestamp) {
$timestamp = time();
}
// Replace names by own translation to get rid of improper os system library
if (strpos($format, '%a') !== false) {
$format = str_replace('%a', JEVHelper::getShortDayName(date('w', $timestamp)), $format);
}
if (strpos($format, '%A') !== false) {
$format = str_replace('%A', JEVHelper::getDayName(date('w', $timestamp)), $format);
}
if (strpos($format, '%b') !== false) {
$format = str_replace('%b', JEVHelper::getShortMonthName(date('n', $timestamp)), $format);
}
if (strpos($format, '%B') !== false) {
$format = str_replace('%B', JEVHelper::getMonthName(date('n', $timestamp)), $format);
}
if (JUtility::isWinOS()) {
if (!class_exists('JEV_CompatWin')) {
require_once dirname(__FILE__) . '/compatwin.php';
}
return JEV_CompatWin::win_strftime($format, $timestamp);
} else {
return JevDate::strftime($format, $timestamp);
}
}
示例2: toFormat
/**
* Gets the date in a specific format
*
* Returns a string formatted according to the given format. Month and weekday names and
* other language dependent strings respect the current locale
*
* @param string $format The date format specification string (see {@link PHP_MANUAL#strftime})
* @return a date in a specific format
*/
function toFormat($format = '%Y-%m-%d %H:%M:%S')
{
$date = $this->_date !== false ? strftime($format, $this->_date + $this->_offset) : null;
// for Windows there is a need to convert the OS date string to utf-8.
if (JUtility::isWinOS() && function_exists('iconv')) {
$lang =& JFactory::getLanguage();
return iconv($lang->getWinCP(), 'UTF-8', $date);
}
return $date;
}
示例3: testIsWinOS
/**
* Testing isWinOS().
*
* @param bool return value from mock
*
* @return void
*
* @dataProvider casesWinOS
*/
public function testIsWinOS($expResult)
{
$mockApplication = $this->getMock('JAplication', array('isWinOS'));
$mockApplication->expects($this->once())->method('isWinOS')->will($this->returnValue($expResult));
JFactory::$application = $mockApplication;
$this->assertThat(JUtility::isWinOS(), $this->equalTo($expResult));
}
示例4: getTime
function getTime($date, $h = -1, $m = -1)
{
$cfg =& JEVConfig::getInstance();
static $format_type;
if (!isset($format_type)) {
$cfg =& JEVConfig::getInstance();
$format_type = $cfg->get('com_dateformat');
}
// if date format is from langauge file then do this first
if ($format_type == 3) {
if ($h >= 0 && $m >= 0) {
$time = JevDate::mktime($h, $m);
return JEV_CommonFunctions::jev_strftime(JText::_("TIME_FORMAT"), $time);
} else {
return JEV_CommonFunctions::jev_strftime(JText::_("TIME_FORMAT"), $date);
}
}
if ($cfg->get('com_calUseStdTime') == '0') {
if ($h >= 0 && $m >= 0) {
return sprintf('%02d:%02d', $h, $m);
} else {
return JevDate::strftime("%H:%M", $date);
}
} else {
if (JUtility::isWinOS()) {
return JevDate::strftime("%#I:%M%p", $date);
} else {
return strtolower(JevDate::strftime("%I:%M%p", $date));
}
}
}