本文整理汇总了PHP中Calendar::setDay方法的典型用法代码示例。如果您正苦于以下问题:PHP Calendar::setDay方法的具体用法?PHP Calendar::setDay怎么用?PHP Calendar::setDay使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Calendar
的用法示例。
在下文中一共展示了Calendar::setDay方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayCalendar
function displayCalendar($paramstring, $params = array())
{
global $wgParser;
global $wgScript, $wgScriptPath;
global $wgTitle, $wgUser;
global $wgRestrictCalendarTo, $wgCalendarDisableRedirects;
global $wgCalendarForceNamespace, $wgCalendarDateFormat;
$wgParser->disableCache();
$wikiRoot = $wgScript . "?title=";
$userMode = 'month';
// grab the page title
$title = $wgTitle->getPrefixedText();
$config_page = " ";
$calendar = null;
$calendar = new Calendar($wikiRoot, isset($params["debug"]));
//return $calendar->getURLRelativePath();
$calendar->namespace = $wgTitle->getNsText();
if (!isset($params["name"])) {
$params["name"] = "Public";
}
// append simplemonth to name to seperate from normal calendar names
//if(isset($params["simplemonth"])) $params["name"] .= "_simplemonth";
$calendar->paramstring = $paramstring;
// set path
$params['path'] = str_replace("\\", "/", dirname(__FILE__));
$name = Common::checkForMagicWord($params["name"]);
// normal calendar...
$calendar->calendarPageName = "{$title}/{$name}";
// if the calendar isn't in a namespace(s) specificed in $wgCalendarForceNamespace, return a warning
// this can be a string or an array
if (isset($wgCalendarForceNamespace)) {
if (is_array($wgCalendarForceNamespace)) {
if (!in_array($calendar->namespace, $wgCalendarForceNamespace)) {
$namespaces = "";
foreach ($wgCalendarForceNamespace as $namespace) {
$namespaces .= $namespace . ", ";
}
return Common::translate('invalid_namespace') . '<b>' . $namespaces . '</b>';
}
} else {
if ($wgCalendarForceNamespace != $calendar->namespace) {
return Common::translate('invalid_namespace') . '<b>' . $wgCalendarForceNamespace . '</b>';
}
}
}
//set defaults that are required later in the code...
if (!isset($params["timetrackhead"])) {
$params["timetrackhead"] = "Event, Value";
}
if (!isset($params["maxdailyevents"])) {
$params["maxdailyevents"] = 5;
}
if (!isset($params["yearoffset"])) {
$params["yearoffset"] = 2;
}
if (!isset($params["charlimit"])) {
$params["charlimit"] = 25;
}
if (!isset($params["css"])) {
$params["css"] = "default.css";
}
//if(!isset($params["formatdate"])) $params["formatdate"] = 'M-D-YYYY';
//if($params["formatdate"] == 'formatdate'){
// return 'Invalid date format';
//}
//set secure mode via $wgRestrictCalendarTo global
// this global is set via LocalSetting.php (ex: $wgRestrictCalendarTo = 'sysop';
if (isset($wgRestrictCalendarTo)) {
$arrGroups = $wgUser->getGroups();
if (is_array($wgRestrictCalendarTo)) {
if (count(array_intersect($wgRestrictCalendarTo, $arrGroups)) == 0) {
$params["lockdown"] = true;
}
} else {
if (!in_array($wgRestrictCalendarTo, $arrGroups)) {
$params["lockdown"] = true;
}
}
}
if (isset($wgCalendarDisableRedirects)) {
$params['disableredirects'] = true;
}
// no need to pass a parameter here... isset check for the params name, thats it
if (isset($params["lockdown"])) {
$params['disableaddevent'] = true;
$params['disablelinks'] = true;
$params['locktemplates'] = true;
}
// this needs to be last after all required $params are updated, changed, defaulted or whatever
$calendar->arrSettings = $params;
// finished special conditions; set the $title and $name in the class
$calendar->setTitle($title);
$calendar->setName($name);
$cookie_name = preg_replace('/(\\.|\\s)/', '_', $title . " " . $name);
//replace periods and spaces
if (isset($_COOKIE[$cookie_name])) {
$calendar->debug->set('cookie loaded');
$arrSession = split("`", $_COOKIE[$cookie_name]);
$calendar->setMonth($arrSession[0]);
$calendar->setDay($arrSession[1]);
//.........这里部分代码省略.........
示例2: displayCalendar
//.........这里部分代码省略.........
if (isset($wgRestrictCalendarTo)) {
$arrGroups = $wgUser->getGroups();
if (is_array($wgRestrictCalendarTo)) {
if (count(array_intersect($wgRestrictCalendarTo, $arrGroups)) == 0) {
$params["lockdown"] = true;
}
} else {
if (!in_array($wgRestrictCalendarTo, $arrGroups)) {
$params["lockdown"] = true;
}
}
}
if (isset($wgCalendarDisableRedirects)) {
$params['disableredirects'] = true;
}
// no need to pass a parameter here... isset check for the params name, thats it
if (isset($params["lockdown"])) {
$params['disableaddevent'] = true;
$params['disablelinks'] = true;
$params['locktemplates'] = true;
}
if (isset($params["5dayweek"])) {
$params['monday'] = true;
}
// this needs to be last after all required $params are updated, changed, defaulted or whatever
$calendar->arrSettings = $params;
// joint calendar...pulling data from our calendar and the subscribers...ie: "title/name" format
if (isset($params["subscribe"])) {
if ($params["subscribe"] != "subscribe") {
$calendar->subscribedPages = split(",", $params["subscribe"]);
}
}
// subscriber only calendar...basically, taking the subscribers identity fully...ie: "title/name" format
if (isset($params["fullsubscribe"])) {
if ($params["fullsubscribe"] != "fullsubscribe") {
$arrString = explode('/', $params["fullsubscribe"]);
array_pop($arrString);
$string = implode('/', $arrString);
$article = new Article(Title::newFromText($string));
// if the fullsubscribe calendar doesn't exisit, return a warning...
if (!$article->exists()) {
return "Invalid 'fullsubscribe' calendar page: <b><i>{$string}</i></b>";
}
$calendar->calendarPageName = htmlspecialchars($params["fullsubscribe"]);
$calendar->isFullSubscribe = true;
}
}
// finished special conditions; set the $title and $name in the class
$calendar->setTitle($title);
$calendar->setName($name);
$cookie_name = preg_replace('/(\\.|\\s)/', '_', $title . " " . $name);
//replace periods and spaces
if (isset($_COOKIE[$cookie_name])) {
$calendar->debug->set('cookie loaded');
$arrSession = split("`", $_COOKIE[$cookie_name]);
$calendar->setMonth($arrSession[0]);
$calendar->setDay($arrSession[1]);
$calendar->setYear($arrSession[2]);
$calendar->setTitle($arrSession[3]);
$calendar->setName($arrSession[4]);
if (strlen($arrSession[5]) > 0) {
$userMode = $arrSession[5];
}
} else {
// defaults from the <calendar /> parameters; must restart browser to enable
if (isset($params['week'])) {
$userMode = 'week';
}
if (isset($params['year'])) {
$userMode = 'year';
}
}
if (isset($params['useeventlist'])) {
$userMode = 'events';
}
if (isset($params['date'])) {
$userMode = 'day';
}
if (isset($params['simplemonth'])) {
$userMode = 'simplemonth';
}
if (isset($_COOKIE['calendar_ical'])) {
$calendar->debug->set('ical cookie loaded');
$calendar->load_iCal($_COOKIE['calendar_ical']);
//delete ical file in "mediawiki/images" folder
@unlink($_COOKIE['calendar_ical']);
// delete the ical path cookie
setcookie('calendar_ical', "", time() - 3600);
// refresh the calendar's newly added events
$calendar->invalidateCache = true;
}
$render = $calendar->renderCalendar($userMode);
// purge main calendar before displaying the calendar
if ($calendar->invalidateCache) {
$article = new Article(Title::newFromText($title));
$article->purge();
header("Location: " . $wikiRoot . $title);
}
return $render;
}
示例3: Calendar
<?php
include "calendar.php";
$calendar = new Calendar("Tomorrow");
echo "Tomorrow: " . $calendar->getDate() . "<br>";
$calendar->setDay("yesterday");
echo "Yesterday: " . $calendar->getDate() . "<br>";
$calendar->setDay("today");
echo "Today is : " . $calendar->getDate() . "<br>";