-
-
Notifications
You must be signed in to change notification settings - Fork 4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: John Molakvoæ <skjnldsv@users.noreply.github.com>
- Loading branch information
Showing
7 changed files
with
295 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
<?php | ||
/** | ||
* @copyright Copyright (c) 2021 John Molakvoæ <skjnldsv@protonmail.com> | ||
* | ||
* @author John Molakvoæ <skjnldsv@protonmail.com> | ||
* | ||
* @license GNU AGPL version 3 or any later version | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
use OCP\Profile\IActionManager; | ||
use OCP\Profile\IProfileAction; | ||
|
||
/** | ||
* @since 23 | ||
*/ | ||
class ActionManager implements IActionManager { | ||
|
||
public function __construct() {} | ||
|
||
/** @var array */ | ||
protected $actions = []; | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function registerAction(IProfileAction $action) { | ||
$this->actions[] = $action; | ||
} | ||
|
||
/** | ||
* @inheritDoc | ||
*/ | ||
public function getActions(): array { | ||
return $this->actions; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
<?php | ||
|
||
use OCP\IL10N; | ||
use OCP\IURLGenerator; | ||
use OCP\Profile\IProfileAction; | ||
|
||
/** | ||
* @copyright Copyright (c) 2021 John Molakvoæ <skjnldsv@protonmail.com> | ||
* | ||
* @author John Molakvoæ <skjnldsv@protonmail.com> | ||
* | ||
* @license GNU AGPL version 3 or any later version | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
class EmailAction implements IProfileAction { | ||
|
||
/** @var string */ | ||
private $value; | ||
|
||
/** @var IL10N */ | ||
private $l10n; | ||
|
||
/** @var IUrlGenerator */ | ||
private $urlGenerator; | ||
|
||
/** | ||
* Personal Section constructor. | ||
* | ||
* @param string $appName | ||
* @param IURLGenerator $urlGenerator | ||
* @param IL10N $l10n | ||
*/ | ||
public function __construct(string $value, | ||
IL10N $l10n, | ||
IURLGenerator $urlGenerator) { | ||
$this->value = $value; | ||
$this->l10n = $l10n; | ||
$this->urlGenerator = $urlGenerator; | ||
} | ||
|
||
public function getTitle(): string { | ||
return $this->l10n->t('Mail %s', [$this->value]); | ||
} | ||
|
||
public function getPriority(): int { | ||
return 20; | ||
} | ||
|
||
public function getIcon(): string { | ||
return 'icon-mail'; | ||
} | ||
|
||
public function getTarget(): string { | ||
return 'mailto:' . $this->value; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
<?php | ||
/** | ||
* @copyright Copyright (c) 2021 John Molakvoæ <skjnldsv@protonmail.com> | ||
* | ||
* @author John Molakvoæ <skjnldsv@protonmail.com> | ||
* | ||
* @license GNU AGPL version 3 or any later version | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as | ||
* published by the Free Software Foundation, either version 3 of the | ||
* License, or (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
namespace OCP\Profile; | ||
|
||
/** | ||
* @since 23 | ||
*/ | ||
interface IActionManager { | ||
|
||
/** | ||
* Register a new action for the user profile page | ||
* | ||
* @since 23 | ||
*/ | ||
public function registerAction(IProfileAction $action); | ||
|
||
/** | ||
* Returns the list of all registered profile actions | ||
* | ||
* @since 23 | ||
*/ | ||
public function getActions(): array; | ||
} |
Oops, something went wrong.