本文整理匯總了PHP中OCP\App::getAppVersion方法的典型用法代碼示例。如果您正苦於以下問題:PHP App::getAppVersion方法的具體用法?PHP App::getAppVersion怎麽用?PHP App::getAppVersion使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類OCP\App
的用法示例。
在下文中一共展示了App::getAppVersion方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: Check
/**
* @AdminRequired
* @NoCSRFRequired
*/
public function Check()
{
\OCP\JSON::setContentTypeHeader('application/json');
if ($this->Allow) {
try {
$LastVersionNumber = Tools::GetLastVersionNumber();
$AppVersion = \OCP\App::getAppVersion('ocdownloader');
$Response = array('ERROR' => false, 'RESULT' => version_compare($AppVersion, $LastVersionNumber, '<'));
} catch (Exception $E) {
$Response = array('ERROR' => true, 'MESSAGE' => (string) $this->L10N->t('Error while checking application version on GitHub'));
}
} else {
$Response = array('ERROR' => true, 'MESSAGE' => (string) $this->L10N->t('You are not allowed to check for application updates'));
}
return new JSONResponse($Response);
}
示例2: createContact
/**
* Creates a new contact
*
* In the Database and Shared backends contact be either a Contact object or a string
* with carddata to be able to play seamlessly with the CardDAV backend.
* If this method is called by the CardDAV backend, the carddata is already validated.
* NOTE: It's assumed that this method is called either from the CardDAV backend, the
* import script, or from the ownCloud web UI in which case either the uri parameter is
* set, or the contact has a UID. If neither is set, it will fail.
*
* @param string $addressbookid
* @param VCard|string $contact
* @param array $options - Optional (backend specific options)
* @return string|bool The identifier for the new contact or false on error.
*/
public function createContact($addressbookid, $contact, array $options = array())
{
$qname = 'createcontact';
$uri = isset($options['uri']) ? $options['uri'] : null;
if (!$contact instanceof VCard) {
try {
$contact = Reader::read($contact);
} catch (\Exception $e) {
\OCP\Util::writeLog('contacts', __METHOD__ . ', exception: ' . $e->getMessage(), \OCP\Util::ERROR);
return false;
}
}
try {
$contact->validate(VCard::REPAIR | VCard::UPGRADE);
} catch (\Exception $e) {
OCP\Util::writeLog('contacts', __METHOD__ . ' ' . 'Error validating vcard: ' . $e->getMessage(), \OCP\Util::ERROR);
return false;
}
$uri = is_null($uri) ? $contact->UID . '.vcf' : $uri;
$now = new \DateTime();
$contact->REV = $now->format(\DateTime::W3C);
$appinfo = \OCP\App::getAppInfo('contacts');
$appversion = \OCP\App::getAppVersion('contacts');
$prodid = '-//ownCloud//NONSGML ' . $appinfo['name'] . ' ' . $appversion . '//EN';
$contact->PRODID = $prodid;
$data = $contact->serialize();
if (!isset(self::$preparedQueries[$qname])) {
self::$preparedQueries[$qname] = \OCP\DB::prepare('INSERT INTO `' . $this->cardsTableName . '` (`addressbookid`,`fullname`,`carddata`,`uri`,`lastmodified`) VALUES(?,?,?,?,?)');
}
try {
$result = self::$preparedQueries[$qname]->execute(array($addressbookid, (string) $contact->FN, $contact->serialize(), $uri, time()));
if (\OCP\DB::isError($result)) {
\OCP\Util::writeLog('contacts', __METHOD__ . 'DB error: ' . \OC_DB::getErrorMessage($result), \OCP\Util::ERROR);
return false;
}
} catch (\Exception $e) {
\OCP\Util::writeLog('contacts', __METHOD__ . ', exception: ' . $e->getMessage(), \OCP\Util::ERROR);
return false;
}
$newid = \OCP\DB::insertid($this->cardsTableName);
$this->touchAddressBook($addressbookid);
\OCP\Util::emitHook('OCA\\Contacts', 'post_createContact', array('id' => $newid, 'parent' => $addressbookid, 'contact' => $contact));
return (string) $newid;
}
示例3: createVCardFromRequest
public static function createVCardFromRequest($sRequest)
{
$uid = substr(md5(rand() . time()), 0, 10);
$appinfo = \OCP\App::getAppInfo(self::$appname);
$appversion = \OCP\App::getAppVersion(self::$appname);
$prodid = '-//ownCloud//NONSGML ' . $appinfo['name'] . ' ' . $appversion . '//EN';
$vcard = new VObject\Component\VCard(array('PRODID' => $prodid, 'VERSION' => '3.0', 'UID' => $uid));
return self::updateVCardFromRequest($sRequest, $vcard);
}
示例4: getBirthdayEvent
/**
* Generate an event to show in the calendar
*
* @return \Sabre\VObject\Component\VCalendar|null
*/
public function getBirthdayEvent()
{
if (!isset($this->BDAY)) {
return null;
}
$birthday = $this->BDAY;
if ((string) $birthday) {
$title = str_replace('{name}', strtr((string) $this->FN, array('\\,' => ',', '\\;' => ';')), App::$l10n->t('{name}\'s Birthday'));
try {
$date = new \DateTime($birthday);
} catch (Exception $e) {
return null;
}
$vCal = new \Sabre\VObject\Component\VCalendar();
$vCal->VERSION = '2.0';
$vEvent = $vCal->createComponent('VEVENT');
$vEvent->add('DTSTART');
$vEvent->DTSTART->setDateTime($date);
$vEvent->DTSTART['VALUE'] = 'DATE';
$vEvent->add('DTEND');
$date->add(new \DateInterval('P1D'));
$vEvent->DTEND->setDateTime($date);
$vEvent->DTEND['VALUE'] = 'DATE';
$lm = new \DateTime('@' . $this->lastModified());
$lm->setTimeZone(new \DateTimeZone('UTC'));
$vEvent->DTSTAMP->setDateTime($lm);
$vEvent->{'UID'} = $this->UID;
$vEvent->{'RRULE'} = 'FREQ=YEARLY';
$vEvent->{'SUMMARY'} = $title . ' (' . $date->format('Y') . ')';
$vEvent->{'TRANSP'} = 'TRANSPARENT';
$alarm = $vCal->createComponent('VALARM');
$alarm->{'TRIGGER'} = '-PT0H';
$alarm->add($vCal->createProperty('TRIGGER', '-PT0M', ['VALUE' => 'DURATION']));
$alarm->add($vCal->createProperty('DESCRIPTION', $title . ' (' . $date->format('Y') . ')'));
$vEvent->add($alarm);
$appInfo = \OCP\App::getAppInfo('contacts');
$appVersion = \OCP\App::getAppVersion('contacts');
$vCal->PRODID = '-//ownCloud//NONSGML ' . $appInfo['name'] . ' ' . $appVersion . '//EN';
$vCal->add($vEvent);
return $vCal;
}
return null;
}
示例5: isset
<?php
/** @var array $_ */
/** @var OCP\IURLGenerator $urlGenerator */
$urlGenerator = $_['urlGenerator'];
$version = \OCP\App::getAppVersion('files_reader');
$dllink = isset($_GET['file']) ? $_GET['file'] : '';
?>
<html dir="ltr">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
<meta name="apple-mobile-web-app-capable" content="yes">
<base href="<?php
p($urlGenerator->linkTo('files_reader', ''));
?>
">
<title>
<?php
p($_['title']);
?>
</title>
<link rel="shortcut icon" href="img/book.png">
<link rel="stylesheet" href="css/normalize.css">
<link rel="stylesheet" href="css/main.css">
<link rel="stylesheet" href="css/popup.css">
<link rel="stylesheet" href="css/tooltip.css">
<!--
<script type="text/javascript" src="js/libs/jquery-2.1.0.min.js"> </script>
<script type="text/javascript" src="js/libs/jquery.highlight.js"> </script>
示例6: getBirthdayEvents
public static function getBirthdayEvents($parameters)
{
$name = $parameters['calendar_id'];
if (strpos($name, 'birthday_') != 0) {
return;
}
$info = explode('_', $name);
$aid = $info[1];
Addressbook::find($aid);
foreach (VCard::all($aid) as $contact) {
try {
$vcard = VObject\Reader::read($contact['carddata']);
} catch (Exception $e) {
continue;
}
$birthday = $vcard->BDAY;
if ($birthday) {
$date = new \DateTime($birthday);
$vevent = VObject\Component::create('VEVENT');
//$vevent->setDateTime('LAST-MODIFIED', new DateTime($vcard->REV));
$vevent->add('DTSTART');
$vevent->DTSTART->setDateTime($date, VObject\Property\DateTime::DATE);
$vevent->add('DURATION', 'P1D');
$vevent->{'UID'} = substr(md5(rand() . time()), 0, 10);
// DESCRIPTION?
$vevent->{'RRULE'} = 'FREQ=YEARLY';
$title = str_replace('{name}', $vcard->FN, App::$l10n->t('{name}\'s Birthday'));
$parameters['events'][] = array('id' => 0, 'vevent' => $vevent, 'repeating' => true, 'summary' => $title, 'calendardata' => "BEGIN:VCALENDAR\nVERSION:2.0\n" . "PRODID:ownCloud Contacts " . \OCP\App::getAppVersion('contacts') . "\n" . $vevent->serialize() . "END:VCALENDAR");
}
}
}
示例7: exceptionHandler
public function exceptionHandler(\Exception $e)
{
self::$errors = [0 => ["check" => function ($msg) {
if (substr($msg, 0, 17) === 'js file not found') {
return true;
}
if (substr($msg, 0, 18) === 'css file not found') {
return true;
}
return false;
}, "brief" => 'JS or CSS files not generated', "info" => <<<INFO
\tThere are two options to solve this problem: <br>
\t\t1. generate them yourself <br>
\t\t2. download packaged Chat app
\tClick the "more information" button for more information.
INFO
, "link" => "https://github.com/owncloud/chat#install"], 1 => ["check" => function ($msg) {
if (substr($msg, 0, 23) === '[404] Contact not found') {
return true;
}
}, "brief" => "Contact app failed to load some contacts", "info" => <<<INFO
\tThis is a bug in the Contacts app, which is fixed in the latest version of ownCloud and the Contacts app.<br>
\tPlease open an issue if this issue keeps occurring after updating the Contacts app.
INFO
, "link" => ""], 2 => ["check" => function ($msg) {
if (\OCP\App::isEnabled('user_ldap')) {
return true;
}
}, "brief" => "Chat app doens't work with user_ldap enabled", "info" => <<<INFO
\tThere is an bug in core with user_ldap. Therefore the Chat app can't be used. This bug is solved in the latest version of the Chat app.
INFO
, "link" => ""]];
foreach (self::$errors as $possibleError) {
if ($possibleError['check']($e->getMessage())) {
$brief = $possibleError["brief"];
$info = $possibleError["info"];
$link = $possibleError["link"];
$raw = $e->getMessage();
}
}
$version = \OCP\App::getAppVersion('chat');
$requesttoken = \OC::$server->getSession()->get('requesttoken');
include __DIR__ . "/../templates/error.php";
die;
}
示例8: exportBirthdays
/**
* @NoAdminRequired
* @NoCSRFRequired
*/
public function exportBirthdays()
{
$bookid = $this->params('aid');
$bookid = isset($bookid) ? $bookid : null;
if (!is_null($bookid)) {
$addressbook = Addressbook::find($bookid);
$aDefNArray = array('0' => 'fname', '1' => 'lname', '3' => 'title', '4' => '');
foreach (VCard::all($bookid) as $contact) {
try {
$vcard = VObject\Reader::read($contact['carddata']);
} catch (Exception $e) {
continue;
}
$birthday = $vcard->BDAY;
if ((string) $birthday) {
$details = VCard::structureContact($vcard);
$BirthdayTemp = new \DateTime($birthday);
$checkForm = $BirthdayTemp->format('d-m-Y');
$temp = explode('-', $checkForm);
$getAge = $this->getAgeCalc($temp[2], $temp[1], $temp[0]);
//$getAge=$BirthdayTemp->format('d-m-Y');
$title = isset($vcard->FN) ? strtr($vcard->FN->getValue(), array('\\,' => ',', '\\;' => ';')) : '';
$sNameOutput = '';
if (isset($details['N'][0]['value']) && count($details['N'][0]['value']) > 0) {
foreach ($details['N'][0]['value'] as $key => $val) {
if ($val != '') {
$aNameOutput[$aDefNArray[$key]] = $val;
}
}
//$sNameOutput=isset($aNameOutput['title'])?$aNameOutput['title'].' ':'';
$sNameOutput .= isset($aNameOutput['lname']) ? $aNameOutput['lname'] . ' ' : '';
$sNameOutput .= isset($aNameOutput['fname']) ? $aNameOutput['fname'] . ' ' : '';
unset($aNameOutput);
}
if ($sNameOutput == '') {
$sNameOutput = $title;
}
$sTitle1 = (string) $this->l10n->t('%1$s (%2$s)', array($sNameOutput, $getAge));
$aktYear = $BirthdayTemp->format('d-m');
$aktYear = $aktYear . date('-Y');
$start = new \DateTime($aktYear);
$end = new \DateTime($aktYear . ' +1 day');
$vcalendar = new VObject\Component\VCalendar();
$vevent = $vcalendar->createComponent('VEVENT');
$vevent->add('DTSTART');
$vevent->DTSTART->setDateTime($start);
$vevent->DTSTART['VALUE'] = 'date';
$vevent->add('DTEND');
$vevent->DTEND->setDateTime($end);
$vevent->DTEND['VALUE'] = 'date';
$vevent->{'SUMMARY'} = (string) $sTitle1;
$vevent->{'UID'} = substr(md5(rand() . time()), 0, 10);
$params['events'][] = $vevent->serialize();
}
}
if (is_array($params['events'])) {
$return = "BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:ownCloud Calendar " . \OCP\App::getAppVersion('calendar') . "\nX-WR-CALNAME: export-bday-" . $bookid . "\n";
foreach ($params['events'] as $event) {
$return .= $event;
}
$return .= "END:VCALENDAR";
$name = str_replace(' ', '_', $addressbook['displayname']) . '_birthdays' . '.ics';
$response = new DataDownloadResponse($return, $name, 'text/calendar');
return $response;
}
}
}
示例9: add
/**
* @brief Adds a card
* @param $aid integer Addressbook id
* @param $card Sabre\VObject\Component vCard file
* @param $uri string the uri of the card, default based on the UID
* @param $isChecked boolean If the vCard should be checked for validity and version.
* @return insertid on success or false.
*/
public static function add($aid, VObject\Component $card, $uri = null, $isChecked = false)
{
if (is_null($card)) {
\OCP\Util::writeLog('contacts', __METHOD__ . ', No vCard supplied', \OCP\Util::ERROR);
return null;
}
$addressbook = Addressbook::find($aid);
if ($addressbook['userid'] != \OCP\User::getUser()) {
$sharedAddressbook = \OCP\Share::getItemSharedWithBySource('addressbook', $aid);
if (!$sharedAddressbook || !($sharedAddressbook['permissions'] & \OCP\PERMISSION_CREATE)) {
throw new \Exception(App::$l10n->t('You do not have the permissions to add contacts to this addressbook.'));
}
}
if (!$isChecked) {
self::updateValuesFromAdd($aid, $card);
}
$card->{'VERSION'} = '3.0';
// Add product ID is missing.
//$prodid = trim($card->getAsString('PRODID'));
//if(!$prodid) {
if (!isset($card->PRODID)) {
$appinfo = \OCP\App::getAppInfo('contacts');
$appversion = \OCP\App::getAppVersion('contacts');
$prodid = '-//ownCloud//NONSGML ' . $appinfo['name'] . ' ' . $appversion . '//EN';
$card->add('PRODID', $prodid);
}
$fn = isset($card->FN) ? $card->FN : '';
$uri = isset($uri) ? $uri : $card->UID . '.vcf';
$data = $card->serialize();
$stmt = \OCP\DB::prepare('INSERT INTO `*PREFIX*contacts_cards` (`addressbookid`,`fullname`,`carddata`,`uri`,`lastmodified`) VALUES(?,?,?,?,?)');
try {
$result = $stmt->execute(array($aid, $fn, $data, $uri, time()));
if (\OC_DB::isError($result)) {
\OC_Log::write('contacts', __METHOD__ . 'DB error: ' . \OC_DB::getErrorMessage($result), \OCP\Util::ERROR);
return false;
}
} catch (\Exception $e) {
\OCP\Util::writeLog('contacts', __METHOD__ . ', exception: ' . $e->getMessage(), \OCP\Util::ERROR);
\OCP\Util::writeLog('contacts', __METHOD__ . ', aid: ' . $aid . ' uri' . $uri, \OCP\Util::DEBUG);
return false;
}
$newid = \OCP\DB::insertid('*PREFIX*contacts_cards');
App::loadCategoriesFromVCard($newid, $card);
App::updateDBProperties($newid, $card);
App::cacheThumbnail($newid);
Addressbook::touch($aid);
\OC_Hook::emit('\\OCA\\Contacts\\VCard', 'post_createVCard', $newid);
return $newid;
}
示例10: prepareIosGroups
/**
* @NoAdminRequired
*/
public function prepareIosGroups()
{
$pGroups = $this->params('agroups');
$pAddrBookId = $this->params('aid');
if ($pAddrBookId > 0) {
$existIosGroups = ContactsApp::getIosGroups();
$iCountExist = count($pGroups);
$iCountIosExist = count($existIosGroups);
if ($iCountExist < $iCountIosExist) {
//Group Delete
foreach ($existIosGroups as $key => $value) {
if (!array_key_exists($key, $pGroups)) {
VCard::delete($value['id']);
}
}
}
if ($iCountExist > $iCountIosExist) {
//Group Added
$newGroup = array();
foreach ($pGroups as $key => $value) {
if (!array_key_exists($key, $existIosGroups)) {
$newGroup[] = $key;
}
}
foreach ($newGroup as $val) {
$uid = substr(md5(rand() . time()), 0, 10);
$appinfo = \OCP\App::getAppInfo($this->appName);
$appversion = \OCP\App::getAppVersion($this->appName);
$prodid = '-//ownCloud//NONSGML ' . $appinfo['name'] . ' ' . $appversion . '//EN';
$vcard = new \Sabre\VObject\Component\VCard(array('PRODID' => $prodid, 'VERSION' => '3.0', 'UID' => $uid));
$vcard->N = $val;
$vcard->FN = $val;
//X-ADDRESSBOOKSERVER-KIND:group
$vcard->{'X-ADDRESSBOOKSERVER-KIND'} = 'group';
$id = VCard::add($pAddrBookId, $vcard, null, true);
}
}
$params = ['status' => 'success'];
$response = new JSONResponse($params);
return $response;
}
//END $addrBk
}
示例11: index
/**
* @NoAdminRequired
* @NoCSRFRequired
*/
public function index()
{
if (\OC::$server->getAppManager()->isEnabledForUser('contactsplus')) {
$appinfo = \OCP\App::getAppVersion('contactsplus');
if (version_compare($appinfo, '1.0.6', '>=')) {
$calId = $this->calendarController->checkBirthdayCalendarByUri('bdaycpltocal_' . $this->userId);
}
}
$calendars = CalendarCalendar::allCalendars($this->userId, false, false, false);
if (count($calendars) == 0) {
CalendarCalendar::addDefaultCalendars($this->userId);
$calendars = CalendarCalendar::allCalendars($this->userId, true);
}
if ($this->configInfo->getUserValue($this->userId, $this->appName, 'currentview', 'month') == "onedayview") {
$this->configInfo->setUserValue($this->userId, $this->appName, 'currentview', "agendaDay");
}
if ($this->configInfo->getUserValue($this->userId, $this->appName, 'currentview', 'month') == "oneweekview") {
$this->configInfo->setUserValue($this->userId, $this->appName, 'currentview', "agendaWeek");
}
if ($this->configInfo->getUserValue($this->userId, $this->appName, 'currentview', 'month') == "onemonthview") {
$this->configInfo->setUserValue($this->userId, $this->appName, 'currentview', "month");
}
if ($this->configInfo->getUserValue($this->userId, $this->appName, 'currentview', 'month') == "listview") {
$this->configInfo->setUserValue($this->userId, $this->appName, 'currentview', "list");
}
if ($this->configInfo->getUserValue($this->userId, $this->appName, 'currentview', 'month') == "fourweeksview") {
$this->configInfo->setUserValue($this->userId, $this->appName, 'currentview', "fourweeks");
}
\OCP\Util::addStyle($this->appName, '3rdparty/colorPicker');
\OCP\Util::addscript($this->appName, '3rdparty/jquery.colorPicker');
\OCP\Util::addScript($this->appName, '3rdparty/fullcalendar');
\OCP\Util::addStyle($this->appName, '3rdparty/fullcalendar');
\OCP\Util::addStyle($this->appName, '3rdparty/jquery.timepicker');
\OCP\Util::addStyle($this->appName, '3rdparty/fontello/css/animation');
\OCP\Util::addStyle($this->appName, '3rdparty/fontello/css/fontello');
\OCP\Util::addScript($this->appName, 'jquery.scrollTo.min');
//\OCP\Util::addScript($this->appName,'timepicker');
\OCP\Util::addScript($this->appName, '3rdparty/datepair');
\OCP\Util::addScript($this->appName, '3rdparty/jquery.datepair');
\OCP\Util::addScript($this->appName, '3rdparty/jquery.timepicker');
\OCP\Util::addScript($this->appName, "3rdparty/jquery.webui-popover");
\OCP\Util::addScript($this->appName, "3rdparty/chosen.jquery.min");
\OCP\Util::addStyle($this->appName, "3rdparty/chosen");
\OCP\Util::addScript($this->appName, '3rdparty/tag-it');
\OCP\Util::addStyle($this->appName, '3rdparty/jquery.tagit');
\OCP\Util::addStyle($this->appName, '3rdparty/jquery.webui-popover');
if ($this->configInfo->getUserValue($this->userId, $this->appName, 'timezone') == null || $this->configInfo->getUserValue($this->userId, $this->appName, 'timezonedetection') == 'true') {
\OCP\Util::addScript($this->appName, '3rdparty/jstz-1.0.4.min');
\OCP\Util::addScript($this->appName, 'geo');
}
\OCP\Util::addScript($this->appName, '3rdparty/printThis');
\OCP\Util::addScript($this->appName, 'app');
\OCP\Util::addScript($this->appName, 'loaderimport');
\OCP\Util::addStyle($this->appName, 'style');
\OCP\Util::addStyle($this->appName, "mobile");
\OCP\Util::addScript($this->appName, 'jquery.multi-autocomplete');
\OCP\Util::addScript('core', 'tags');
\OCP\Util::addScript($this->appName, 'on-event');
$leftNavAktiv = $this->configInfo->getUserValue($this->userId, $this->appName, 'calendarnav');
$rightNavAktiv = $this->configInfo->getUserValue($this->userId, $this->appName, 'tasknav');
$pCalendar = $calendars;
$pHiddenCal = 'class="isHiddenCal"';
$pButtonCalAktive = '';
if ($leftNavAktiv === 'true') {
$pHiddenCal = '';
$pButtonCalAktive = 'button-info';
}
$pButtonTaskAktive = '';
$pTaskOutput = '';
$pRightnavAktiv = $rightNavAktiv;
$pIsHidden = 'class="isHiddenTask"';
if ($rightNavAktiv === 'true' && \OC::$server->getAppManager()->isEnabledForUser('tasksplus')) {
$allowedCals = [];
foreach ($calendars as $calInfo) {
$isAktiv = (int) $calInfo['active'];
if ($this->configInfo->getUserValue($this->userId, $this->appName, 'calendar_' . $calInfo['id']) !== '') {
$isAktiv = (int) $this->configInfo->getUserValue($this->userId, $this->appName, 'calendar_' . $calInfo['id']);
}
if ($isAktiv === 1) {
$allowedCals[] = $calInfo;
}
}
$cDataTimeLine = new \OCA\TasksPlus\Timeline();
$cDataTimeLine->setCalendars($allowedCals);
$taskOutPutbyTime = $cDataTimeLine->generateAddonCalendarTodo();
$paramsList = ['taskOutPutbyTime' => $taskOutPutbyTime];
$list = new TemplateResponse('tasksplus', 'calendars.tasks.list', $paramsList, '');
$pButtonTaskAktive = 'button-info';
$pTaskOutput = $list->render();
$pIsHidden = '';
}
$params = ['calendars' => $pCalendar, 'leftnavAktiv' => $leftNavAktiv, 'isHiddenCal' => $pHiddenCal, 'buttonCalAktive' => $pButtonCalAktive, 'isHidden' => $pIsHidden, 'buttonTaskAktive' => $pButtonTaskAktive, 'taskOutput' => $pTaskOutput, 'rightnavAktiv' => $pRightnavAktiv, 'mailNotificationEnabled' => \OC::$server->getAppConfig()->getValue('core', 'shareapi_allow_mail_notification', 'yes'), 'allowShareWithLink' => \OC::$server->getAppConfig()->getValue('core', 'shareapi_allow_links', 'yes'), 'mailPublicNotificationEnabled' => \OC::$server->getAppConfig()->getValue('core', 'shareapi_allow_public_notification', 'no')];
$csp = new \OCP\AppFramework\Http\ContentSecurityPolicy();
$csp->addAllowedImageDomain('*');
$response = new TemplateResponse($this->appName, 'calendar', $params);
$response->setContentSecurityPolicy($csp);
//.........這裏部分代碼省略.........
示例12: getOwnAppVersion
public static function getOwnAppVersion()
{
return \OCP\App::getAppVersion(Settings::APP_ID);
}
示例13: getBirthdayEvent
/**
* Generate an event to show in the calendar
*
* @return \Sabre\VObject\Component\VCalendar|null
*/
public function getBirthdayEvent()
{
if (!isset($this->BDAY)) {
return null;
}
$birthday = $this->BDAY;
if ((string) $birthday) {
$title = str_replace('{name}', strtr((string) $this->FN, array('\\,' => ',', '\\;' => ';')), App::$l10n->t('{name}\'s Birthday'));
try {
$date = new \DateTime($birthday);
} catch (Exception $e) {
return null;
}
$vCal = new \Sabre\VObject\Component\VCalendar();
$vCal->VERSION = '2.0';
$vEvent = $vCal->createComponent('VEVENT');
$vEvent->add('DTSTART');
$vEvent->DTSTART->setDateTime($date);
$vEvent->DTSTART['VALUE'] = 'date';
$vEvent->add('DURATION', 'P1D');
$vEvent->{'UID'} = $this->UID;
$vEvent->{'RRULE'} = 'FREQ=YEARLY';
$vEvent->{'SUMMARY'} = $title . ' (' . $date->format('Y') . ')';
$vEvent->{'TRANSP'} = 'TRANSPARENT';
$appInfo = \OCP\App::getAppInfo('contacts');
$appVersion = \OCP\App::getAppVersion('contacts');
$vCal->PRODID = '-//ownCloud//NONSGML ' . $appInfo['name'] . ' ' . $appVersion . '//EN';
$vCal->add($vEvent);
return $vCal;
}
return null;
}
示例14: event
/**
* @brief exports an event and convert all times to UTC
* @param integer $id id of the event
* @return string
*/
private static function event($id)
{
$event = Object::find($id);
$return = "BEGIN:VCALENDAR\nVERSION:2.0\nPRODID:ownCloud Calendar " . \OCP\App::getAppVersion(App::$appname) . "\nX-WR-CALNAME:" . $event['summary'] . "\n";
$object = VObject::parse($event['calendardata']);
if ($object->VTIMEZONE) {
$return .= self::addVtimezone();
}
$return .= self::generateEvent($event);
$return .= "END:VCALENDAR";
return $return;
}
示例15:
<?php
/** @var array $_ */
/** @var OCP\IURLGenerator $urlGenerator */
$urlGenerator = $_['urlGenerator'];
$version = \OCP\App::getAppVersion('files_pdfviewer');
?>
<!--
Copyright 2012 Mozilla Foundation
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Adobe CMap resources are covered by their own copyright and license:
http://sourceforge.net/adobe/cmap/wiki/License/
-->
<html dir="ltr" mozdisallowselectionprint moznomarginboxes>
<head data-workersrc="<?php
p($urlGenerator->linkTo('files_pdfviewer', 'vendor/pdfjs/build/pdf.worker.js'));
?>
?v=<?php
p($version);
?>