本文整理汇总了PHP中OCP\USER类的典型用法代码示例。如果您正苦于以下问题:PHP USER类的具体用法?PHP USER怎么用?PHP USER使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了USER类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: search
/**
* Search for query in calendar events
*
* @param string $query
* @return array list of \OCA\Calendar\Search\Event
*/
function search($query)
{
$calendars = \OC_Calendar_Calendar::allCalendars(\OCP\USER::getUser(), true);
// check if the calenar is enabled
if (count($calendars) == 0 || !\OCP\App::isEnabled('calendar')) {
return array();
}
$results = array();
foreach ($calendars as $calendar) {
$objects = \OC_Calendar_Object::all($calendar['id']);
$date = strtotime($query);
// search all calendar objects, one by one
foreach ($objects as $object) {
// skip non-events
if ($object['objecttype'] != 'VEVENT') {
continue;
}
// check the event summary string
if (stripos($object['summary'], $query) !== false) {
$results[] = new \OCA\Calendar\Search\Event($object);
continue;
}
// check if the event is happening on a queried date
$range = $this->getDateRange($object);
if ($date && $this->fallsWithin($date, $range)) {
$results[] = new \OCA\Calendar\Search\Event($object);
continue;
}
}
}
return $results;
}
开发者ID:yheric455042,项目名称:owncloud82,代码行数:38,代码来源:provider.php
示例2: getCalenderSources
public static function getCalenderSources($parameters)
{
$base_url = \OCP\Util::linkTo('calendar', 'ajax/events.php') . '?calendar_id=';
foreach (Addressbook::all(\OCP\USER::getUser()) as $addressbook) {
$parameters['sources'][] = array('url' => $base_url . 'birthday_' . $addressbook['id'], 'backgroundColor' => '#cccccc', 'borderColor' => '#888', 'textColor' => 'black', 'cache' => true, 'editable' => false);
}
}
开发者ID:netcon-source,项目名称:apps,代码行数:7,代码来源:hooks.php
示例3: getACL
/**
* Returns a list of ACE's for this node.
*
* Each ACE has the following properties:
* * 'privilege', a string such as {DAV:}read or {DAV:}write. These are
* currently the only supported privileges
* * 'principal', a url to the principal who owns the node
* * 'protected' (optional), indicating that this ACE is not allowed to
* be updated.
*
* @return array
*/
public function getACL()
{
$readprincipal = $this->getOwner();
$writeprincipal = $this->getOwner();
$uid = CalendarCalendar::extractUserID($this->getOwner());
$calendar = CalendarApp::getCalendar($this->calendarInfo['id'], false, false);
if ($uid === \OCP\USER::getUser() && (bool) $calendar['issubscribe'] === true) {
$readprincipal = 'principals/' . \OCP\USER::getUser();
$writeprincipal = '';
}
if ($uid !== \OCP\USER::getUser()) {
$sharedCalendar = \OCP\Share::getItemSharedWithBySource(CalendarApp::SHARECALENDAR, CalendarApp::SHARECALENDARPREFIX . $this->calendarInfo['id']);
if ($sharedCalendar && $sharedCalendar['permissions'] & \OCP\PERMISSION_READ) {
$readprincipal = 'principals/' . \OCP\USER::getUser();
$writeprincipal = '';
}
if ($sharedCalendar && $sharedCalendar['permissions'] & \OCP\PERMISSION_UPDATE) {
$readprincipal = 'principals/' . \OCP\USER::getUser();
$writeprincipal = 'principals/' . \OCP\USER::getUser();
}
}
$acl = array(array('privilege' => '{DAV:}read', 'principal' => $readprincipal, 'protected' => true), array('privilege' => '{DAV:}write', 'principal' => $writeprincipal, 'protected' => true), array('privilege' => '{DAV:}read', 'principal' => $readprincipal . '/calendar-proxy-write', 'protected' => true), array('privilege' => '{DAV:}write', 'principal' => $writeprincipal . '/calendar-proxy-write', 'protected' => true), array('privilege' => '{DAV:}read', 'principal' => $readprincipal . '/calendar-proxy-read', 'protected' => true), array('privilege' => '{' . \Sabre\CalDAV\Plugin::NS_CALDAV . '}read-free-busy', 'principal' => '{DAV:}authenticated', 'protected' => true));
if (empty($this->calendarInfo['{http://sabredav.org/ns}read-only'])) {
$acl[] = ['privilege' => '{DAV:}write', 'principal' => $writeprincipal, 'protected' => true];
$acl[] = ['privilege' => '{DAV:}write', 'principal' => $writeprincipal . '/calendar-proxy-write', 'protected' => true];
}
return $acl;
}
开发者ID:Bullnados,项目名称:calendarplus,代码行数:40,代码来源:calendar.php
示例4: getACL
/**
* Returns a list of ACE's for this node.
*
* Each ACE has the following properties:
* * 'privilege', a string such as {DAV:}read or {DAV:}write. These are
* currently the only supported privileges
* * 'principal', a url to the principal who owns the node
* * 'protected' (optional), indicating that this ACE is not allowed to
* be updated.
*
* @return array
*/
public function getACL()
{
$readprincipal = $this->getOwner();
$writeprincipal = $this->getOwner();
$createprincipal = $this->getOwner();
$deleteprincipal = $this->getOwner();
$uid = AddrBook::extractUserID($this->getOwner());
//\OCP\Config::setUserValue($uid, 'contactsplus', 'syncaddrbook', $this->addressBookInfo['uri']);
$readWriteACL = array(array('privilege' => '{DAV:}read', 'principal' => 'principals/' . \OCP\User::getUser(), 'protected' => true), array('privilege' => '{DAV:}write', 'principal' => 'principals/' . \OCP\User::getUser(), 'protected' => true));
if ($uid !== \OCP\USER::getUser()) {
$sharedAddressbook = \OCP\Share::getItemSharedWithBySource(ContactsApp::SHAREADDRESSBOOK, ContactsApp::SHAREADDRESSBOOKPREFIX . $this->addressBookInfo['id']);
if ($sharedAddressbook) {
if ($sharedAddressbook['permissions'] & \OCP\PERMISSION_CREATE && $sharedAddressbook['permissions'] & \OCP\PERMISSION_UPDATE && $sharedAddressbook['permissions'] & \OCP\PERMISSION_DELETE) {
return $readWriteACL;
}
if ($sharedAddressbook['permissions'] & \OCP\PERMISSION_CREATE) {
$createprincipal = 'principals/' . \OCP\USER::getUser();
}
if ($sharedAddressbook['permissions'] & \OCP\PERMISSION_READ) {
$readprincipal = 'principals/' . \OCP\USER::getUser();
}
if ($sharedAddressbook['permissions'] & \OCP\PERMISSION_UPDATE) {
$writeprincipal = 'principals/' . \OCP\USER::getUser();
}
if ($sharedAddressbook['permissions'] & \OCP\PERMISSION_DELETE) {
$deleteprincipal = 'principals/' . \OCP\USER::getUser();
}
}
} else {
return parent::getACL();
}
return array(array('privilege' => '{DAV:}read', 'principal' => $readprincipal, 'protected' => true), array('privilege' => '{DAV:}write-content', 'principal' => $writeprincipal, 'protected' => true), array('privilege' => '{DAV:}bind', 'principal' => $createprincipal, 'protected' => true), array('privilege' => '{DAV:}unbind', 'principal' => $deleteprincipal, 'protected' => true));
}
开发者ID:sahne123,项目名称:contactsplus,代码行数:45,代码来源:addressbook.php
示例5: getACL
/**
* Returns a list of ACE's for this node.
*
* Each ACE has the following properties:
* * 'privilege', a string such as {DAV:}read or {DAV:}write. These are
* currently the only supported privileges
* * 'principal', a url to the principal who owns the node
* * 'protected' (optional), indicating that this ACE is not allowed to
* be updated.
*
* @return array
*/
public function getACL()
{
$readprincipal = $this->getOwner();
$writeprincipal = $this->getOwner();
$calendarConnector = new CalendarConnector();
$shareConnector = new ShareConnector();
$uid = $calendarConnector->extractUserID($this->getOwner());
$calendar = $calendarConnector->getCalendar($this->calendarInfo['id'], false, false);
$user = \OCP\USER::getUser();
if ($uid === $user && (bool) $calendar['issubscribe'] === true) {
$readprincipal = 'principals/' . $user;
$writeprincipal = '';
}
if ($uid !== $user) {
$sharedCalendar = $shareConnector->getItemSharedWithBySourceCalendar($this->calendarInfo['id']);
if ($sharedCalendar && $sharedCalendar['permissions'] & $shareConnector->getReadAccess()) {
$readprincipal = 'principals/' . $user;
$writeprincipal = '';
}
if ($sharedCalendar && $sharedCalendar['permissions'] & $shareConnector->getUpdateAccess()) {
$readprincipal = 'principals/' . $user;
$writeprincipal = 'principals/' . $user;
}
}
$acl = array(array('privilege' => '{DAV:}read', 'principal' => $readprincipal, 'protected' => true), array('privilege' => '{DAV:}write', 'principal' => $writeprincipal, 'protected' => true), array('privilege' => '{DAV:}read', 'principal' => $readprincipal . '/calendar-proxy-write', 'protected' => true), array('privilege' => '{DAV:}write', 'principal' => $writeprincipal . '/calendar-proxy-write', 'protected' => true), array('privilege' => '{DAV:}read', 'principal' => $readprincipal . '/calendar-proxy-read', 'protected' => true), array('privilege' => '{' . \Sabre\CalDAV\Plugin::NS_CALDAV . '}read-free-busy', 'principal' => '{DAV:}authenticated', 'protected' => true));
if (empty($this->calendarInfo['{http://sabredav.org/ns}read-only'])) {
$acl[] = ['privilege' => '{DAV:}write', 'principal' => $writeprincipal, 'protected' => true];
$acl[] = ['privilege' => '{DAV:}write', 'principal' => $writeprincipal . '/calendar-proxy-write', 'protected' => true];
}
return $acl;
}
开发者ID:Rotzbua,项目名称:calendarplus,代码行数:43,代码来源:calendar.php
示例6: __construct
public function __construct($userid = null)
{
if ($userid !== null) {
$this->userid = $userid;
} else {
$this->userid = \OCP\USER::getUser();
}
}
开发者ID:netcon-source,项目名称:apps,代码行数:8,代码来源:foldermapper.php
示例7: setFileData
public function setFileData($path, $width, $height)
{
$stmt = \OCP\DB::prepare('INSERT INTO `*PREFIX*pictures_images_cache` (`uid_owner`, `path`, `width`, `height`) VALUES (?, ?, ?, ?)');
$stmt->execute(array(\OCP\USER::getUser(), $path, $width, $height));
$ret = array('path' => $path, 'width' => $width, 'height' => $height);
$dir = dirname($path);
$this->cache[$dir][$path] = $ret;
return $ret;
}
开发者ID:blablubli,项目名称:owncloudapps,代码行数:9,代码来源:managers.php
示例8: init
/**
* init the versioning and create the versions folder.
*/
public static function init()
{
if (\OCP\Config::getSystemValue('files_versions', Storage::DEFAULTENABLED) == 'true') {
// create versions folder
$foldername = \OCP\Config::getSystemValue('datadirectory') . '/' . \OCP\USER::getUser() . '/' . \OCP\Config::getSystemValue('files_versionsfolder', Storage::DEFAULTFOLDER);
if (!is_dir($foldername)) {
mkdir($foldername);
}
}
}
开发者ID:jaeindia,项目名称:ownCloud-Enhancements,代码行数:13,代码来源:versions.php
示例9: deleteThumb
/**
* Delete thumb from filesystem if exists
* @param string $thumbPath
*/
private static function deleteThumb($thumbPath)
{
// Get full thumbnail path
$fileInfo = pathinfo($thumbPath);
$user = \OCP\USER::getUser();
$previewDir = \OC_User::getHome($user) . '/oclife/previews/' . $user;
$fullThumbPath = $previewDir . $fileInfo['dirname'] . '/' . $fileInfo['filename'] . '.png';
// If thumbnail exists remove it
if (file_exists($fullThumbPath)) {
unlink($fullThumbPath);
}
}
开发者ID:Greenworker,项目名称:oclife,代码行数:16,代码来源:utilities.php
示例10: getAddressBooksForUser
/**
* Returns the list of addressbooks for a specific user.
*
* @param string $principaluri
* @return array
*/
public function getAddressBooksForUser($principaluri)
{
$data = AddrBook::allWherePrincipalURIIs($principaluri);
$addressbooks = array();
foreach ($data as $i) {
if ($i['userid'] !== \OCP\USER::getUser()) {
$i['uri'] = $i['uri'] . '_shared_by_' . $i['userid'];
}
$addressbooks[] = array('id' => $i['id'], 'uri' => $i['uri'], 'principaluri' => 'principals/' . $i['userid'], '{DAV:}displayname' => $i['displayname'], '{' . \Sabre\CardDAV\Plugin::NS_CARDDAV . '}addressbook-description' => $i['description'], '{http://calendarserver.org/ns/}getctag' => $i['ctag'], '{http://sabredav.org/ns}sync-token' => $i['ctag'] ? $i['ctag'] : '0');
//\OCP\Util::writeLog('kontakte','CARDDAV->:'.$i['displayname'], \OCP\Util::DEBUG);
}
return $addressbooks;
}
开发者ID:BacLuc,项目名称:newGryfiPage,代码行数:19,代码来源:backend.php
示例11: getACL
/**
* Returns a list of ACE's for this node.
*
* Each ACE has the following properties:
* * 'privilege', a string such as {DAV:}read or {DAV:}write. These are
* currently the only supported privileges
* * 'principal', a url to the principal who owns the node
* * 'protected' (optional), indicating that this ACE is not allowed to
* be updated.
*
* @return array
*/
public function getACL()
{
$readprincipal = $this->getOwner();
$writeprincipal = $this->getOwner();
$uid = AddrBook::extractUserID($this->getOwner());
if ($uid !== \OCP\USER::getUser()) {
$sharedAddressbook = \OCP\Share::getItemSharedWithBySource(ContactsApp::SHAREADDRESSBOOK, ContactsApp::SHAREADDRESSBOOKPREFIX . $this->addressBookInfo['id']);
if ($sharedAddressbook && $sharedAddressbook['permissions'] & \OCP\PERMISSION_READ) {
$readprincipal = 'principals/' . \OCP\USER::getUser();
}
if ($sharedAddressbook && $sharedAddressbook['permissions'] & \OCP\PERMISSION_UPDATE) {
$writeprincipal = 'principals/' . \OCP\USER::getUser();
}
}
return array(array('privilege' => '{DAV:}read', 'principal' => $readprincipal, 'protected' => true), array('privilege' => '{DAV:}write', 'principal' => $writeprincipal, 'protected' => true));
}
开发者ID:BacLuc,项目名称:newGryfiPage,代码行数:28,代码来源:card.php
示例12: search
/**
* Search for query in tasks
*
* @param string $query
* @return array list of \OCA\Tasks\Controller\Task
*/
function search($query)
{
$calendars = \OC_Calendar_Calendar::allCalendars(\OCP\USER::getUser(), true);
$user_timezone = \OC_Calendar_App::getTimezone();
// check if the calenar is enabled
if (count($calendars) == 0 || !\OCP\App::isEnabled('tasks')) {
return array();
}
$results = array();
foreach ($calendars as $calendar) {
// $calendar_entries = \OC_Calendar_Object::all($calendar['id']);
$objects = \OC_Calendar_Object::all($calendar['id']);
// $date = strtotime($query);
// // search all calendar objects, one by one
foreach ($objects as $object) {
// skip non-todos
if ($object['objecttype'] != 'VTODO') {
continue;
}
$vtodo = Helper::parseVTODO($object['calendardata']);
$id = $object['id'];
$calendarId = $object['calendarid'];
// check these properties
$properties = array('SUMMARY', 'DESCRIPTION', 'LOCATION', 'CATEGORIES');
foreach ($properties as $property) {
$string = $vtodo->getAsString($property);
if (stripos($string, $query) !== false) {
// $results[] = new \OCA\Tasks\Controller\Task($id,$calendarId,$vtodo,$property,$query,$user_timezone);
$results[] = Helper::arrayForJSON($id, $vtodo, $user_timezone, $calendarId);
continue 2;
}
}
$comments = $vtodo->COMMENT;
if ($comments) {
foreach ($comments as $com) {
if (stripos($com->value, $query) !== false) {
// $results[] = new \OCA\Tasks\Controller\Task($id,$calendarId,$vtodo,'COMMENTS',$query,$user_timezone);
$results[] = Helper::arrayForJSON($id, $vtodo, $user_timezone, $calendarId);
continue 2;
}
}
}
}
}
usort($results, array($this, 'sort_completed'));
return $results;
}
开发者ID:WeatherellTechnology,项目名称:weatherstorm7,代码行数:53,代码来源:searchcontroller.php
示例13: getACL
/**
* Returns a list of ACE's for this node.
*
* Each ACE has the following properties:
* * 'privilege', a string such as {DAV:}read or {DAV:}write. These are
* currently the only supported privileges
* * 'principal', a url to the principal who owns the node
* * 'protected' (optional), indicating that this ACE is not allowed to
* be updated.
*
* @return array
*/
public function getACL()
{
$readprincipal = $this->getOwner();
$writeprincipal = $this->getOwner();
$uid = $this->carddavBackend->userIDByPrincipal($this->getOwner());
if ($uid != \OCP\USER::getUser()) {
list(, $id) = explode('::', $this->addressBookInfo['id']);
$sharedAddressbook = \OCP\Share::getItemSharedWithBySource('addressbook', $id);
if ($sharedAddressbook && $sharedAddressbook['permissions'] & \OCP\PERMISSION_READ) {
$readprincipal = 'principals/' . \OCP\USER::getUser();
}
if ($sharedAddressbook && $sharedAddressbook['permissions'] & \OCP\PERMISSION_UPDATE) {
$writeprincipal = 'principals/' . \OCP\USER::getUser();
}
}
return array(array('privilege' => '{DAV:}read', 'principal' => $readprincipal, 'protected' => true), array('privilege' => '{DAV:}write', 'principal' => $writeprincipal, 'protected' => true));
}
开发者ID:WYSAC,项目名称:oregon-owncloud,代码行数:29,代码来源:card.php
示例14: __construct
public function __construct($imagePath, $user = null, $square = false)
{
if (!Filesystem::isValidPath($imagePath)) {
return;
}
if (is_null($user)) {
$this->view = Filesystem::getView();
$this->user = \OCP\USER::getUser();
} else {
$this->view = new View('/' . $user . '/files');
$this->user = $user;
}
$galleryDir = \OC_User::getHome($this->user) . '/gallery/' . $this->user . '/';
$this->path = $galleryDir . $imagePath . '.png';
if (!file_exists($this->path)) {
self::create($imagePath, $square);
}
}
开发者ID:WYSAC,项目名称:oregon-owncloud,代码行数:18,代码来源:albumthumbnail.php
示例15: explore
function explore($current_dir, $sub_dirs, $num_of_results)
{
$return = array();
// Search for pdfs in sub directories.
foreach ($sub_dirs as $dir) {
$pdfs = \OC_FileCache::searchByMime('application', 'pdf', '/' . \OCP\USER::getUser() . '/files' . $current_dir . $dir . '/');
sort($pdfs);
$max_count = min(count($pdfs), $num_of_results);
$thumbs = array();
for ($i = $max_count - 1; $i >= 0; $i--) {
if (!in_array($pdfs[$i], $thumbs)) {
$thumbs[] = $pdfs[$i];
}
}
$return[] = array($dir, $thumbs);
}
return $return;
}
开发者ID:DOM-Digital-Online-Media,项目名称:apps,代码行数:18,代码来源:dir.php
示例16: getFileData
public function getFileData($path)
{
$gallery_path = \OCP\Config::getSystemValue('datadirectory') . '/' . \OC_User::getUser() . '/gallery';
$path = $gallery_path . $path;
$stmt = \OCP\DB::prepare('SELECT * FROM *PREFIX*pictures_images_cache WHERE uid_owner LIKE ? AND path = ?');
$result = $stmt->execute(array(\OCP\USER::getUser(), $path));
if (($row = $result->fetchRow()) != false) {
return $row;
}
$image = new \OC_Image();
if (!$image->loadFromFile($path)) {
return false;
}
$stmt = \OCP\DB::prepare('INSERT INTO *PREFIX*pictures_images_cache (uid_owner, path, width, height) VALUES (?, ?, ?, ?)');
$stmt->execute(array(\OCP\USER::getUser(), $path, $image->width(), $image->height()));
$ret = array('path' => $path, 'width' => $image->width(), 'height' => $image->height());
unset($image);
return $ret;
}
开发者ID:jaeindia,项目名称:ownCloud-Enhancements,代码行数:19,代码来源:managers.php
示例17: getAddressBooksForUser
/**
* Returns the list of addressbooks for a specific user.
*
* @param string $principaluri
* @return array
*/
public function getAddressBooksForUser($principaluri)
{
$app = new Contacts\App();
$userAddressBooks = array();
foreach ($this->backends as $backendName) {
$backend = $app->getBackend($backendName);
$addressBooks = $backend->getAddressBooksForUser();
if (is_array($addressBooks)) {
foreach ($addressBooks as $addressBook) {
if ($addressBook['owner'] != \OCP\USER::getUser()) {
$addressBook['uri'] = $addressBook['uri'] . '_shared_by_' . $addressBook['owner'];
$addressBook['displayname'] = $addressBook['displayname'];
}
$userAddressBooks[] = array('id' => $backend->name . '::' . $addressBook['id'], 'uri' => $addressBook['uri'], 'principaluri' => 'principals/' . $addressBook['owner'], '{DAV:}displayname' => $addressBook['displayname'], '{' . \Sabre_CardDAV_Plugin::NS_CARDDAV . '}addressbook-description' => $addressBook['description'], '{http://calendarserver.org/ns/}getctag' => $addressBook['lastmodified'], '{' . \Sabre_CardDAV_Plugin::NS_CARDDAV . '}supported-address-data' => new \Sabre_CardDAV_Property_SupportedAddressData());
}
}
}
return $userAddressBooks;
}
开发者ID:CDN-Sparks,项目名称:owncloud,代码行数:25,代码来源:backend.php
示例18: getACL
/**
* Returns a list of ACE's for this node.
*
* Each ACE has the following properties:
* * 'privilege', a string such as {DAV:}read or {DAV:}write. These are
* currently the only supported privileges
* * 'principal', a url to the principal who owns the node
* * 'protected' (optional), indicating that this ACE is not allowed to
* be updated.
*
* @return array
*/
public function getACL()
{
$readprincipal = $this->getOwner();
$writeprincipal = $this->getOwner();
$uid = CalendarCalendar::extractUserID($this->getOwner());
if ($uid != \OCP\USER::getUser()) {
$object = VObject::parse($this->objectData['calendardata']);
$sharedCalendar = \OCP\Share::getItemSharedWithBySource(CalendarApp::SHARECALENDAR, CalendarApp::SHARECALENDARPREFIX . $this->calendarInfo['id']);
$sharedAccessClassPermissions = Object::getAccessClassPermissions($object);
if ($sharedCalendar && $sharedCalendar['permissions'] & \OCP\PERMISSION_READ && $sharedAccessClassPermissions & \OCP\PERMISSION_READ) {
$readprincipal = 'principals/' . \OCP\USER::getUser();
}
if ($sharedCalendar && $sharedCalendar['permissions'] & \OCP\PERMISSION_UPDATE && $sharedAccessClassPermissions & \OCP\PERMISSION_UPDATE) {
$writeprincipal = 'principals/' . \OCP\USER::getUser();
} else {
$writeprincipal = '';
}
}
return array(array('privilege' => '{DAV:}read', 'principal' => $readprincipal, 'protected' => true), array('privilege' => '{DAV:}write', 'principal' => $writeprincipal, 'protected' => true), array('privilege' => '{DAV:}read', 'principal' => $readprincipal . '/calendar-proxy-write', 'protected' => true), array('privilege' => '{DAV:}write', 'principal' => $writeprincipal . '/calendar-proxy-write', 'protected' => true), array('privilege' => '{DAV:}read', 'principal' => $readprincipal . '/calendar-proxy-read', 'protected' => true));
}
开发者ID:Bullnados,项目名称:calendarplus,代码行数:32,代码来源:calendarobject.php
示例19: search
function search($query)
{
$addressbooks = Addressbook::all(\OCP\USER::getUser(), 1);
if (count($addressbooks) == 0 || !\OCP\App::isEnabled('contacts')) {
return array();
}
$results = array();
$l = new \OC_l10n('contacts');
foreach ($addressbooks as $addressbook) {
$vcards = VCard::all($addressbook['id']);
foreach ($vcards as $vcard) {
if (substr_count(strtolower($vcard['fullname']), strtolower($query)) > 0) {
//$link = \OCP\Util::linkTo('contacts', 'index.php').'?id='.urlencode($vcard['id']);
$link = 'javascript:openContact(' . $vcard['id'] . ')';
$results[] = new \OC_Search_Result($vcard['fullname'], '', $link, (string) $l->t('Contact'));
//$name,$text,$link,$type
}
}
}
return $results;
}
开发者ID:netcon-source,项目名称:apps,代码行数:21,代码来源:search.php
示例20: explore
function explore($current_dir, $sub_dirs)
{
$return = array();
// Search for pdfs in sub directories.
foreach ($sub_dirs as $dir) {
$pdfs = \OC_FileCache::searchByMime('application', 'pdf', '/' . \OCP\USER::getUser() . '/files' . $current_dir . $dir . '/');
sort($pdfs);
$thumbs = array();
$count = 1;
foreach ($pdfs as $pdf) {
// We need only 3 pdf pages to create thumbnails for folders.
if ($count <= 3) {
// Store the urls in an array.
$thumbs[] = $pdf;
$count++;
}
}
// Return the directory and contained pdfs(any 3).
$return[] = array($dir, $thumbs);
}
return $return;
}
开发者ID:noldmess,项目名称:apps,代码行数:22,代码来源:dir.php
注:本文中的OCP\USER类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论