-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Add a couple of interface definitions #4928
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ac73ce1
aa8a85f
e3013c5
e92abfd
9116303
e31f6c0
f83f323
d3d52dd
0c6dcdb
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| <?php | ||
| /** | ||
| * Copyright (c) 2013 Bart Visscher <bartv@thisnet.nl> | ||
| * This file is licensed under the Affero General Public License version 3 or | ||
| * later. | ||
| * See the COPYING-README file. | ||
| * | ||
| */ | ||
|
|
||
| namespace OC; | ||
|
|
||
| /** | ||
| * Class to combine all the configuration options ownCloud offers | ||
| */ | ||
| class AllConfig implements \OCP\IConfig { | ||
| /** | ||
| * Sets a new system wide value | ||
| * @param string $key the key of the value, under which will be saved | ||
| * @param string $value the value that should be stored | ||
| * @todo need a use case for this | ||
| */ | ||
| // public function setSystemValue($key, $value) { | ||
| // \OCP\Config::setSystemValue($key, $value); | ||
| // } | ||
|
|
||
| /** | ||
| * Looks up a system wide defined value | ||
| * @param string $key the key of the value, under which it was saved | ||
| * @return string the saved value | ||
| */ | ||
| public function getSystemValue($key) { | ||
| return \OCP\Config::getSystemValue($key, ''); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * Writes a new app wide value | ||
| * @param string $appName the appName that we want to store the value under | ||
| * @param string $key the key of the value, under which will be saved | ||
| * @param string $value the value that should be stored | ||
| */ | ||
| public function setAppValue($appName, $key, $value) { | ||
| \OCP\Config::setAppValue($appName, $key, $value); | ||
| } | ||
|
|
||
| /** | ||
| * Looks up an app wide defined value | ||
| * @param string $appName the appName that we stored the value under | ||
| * @param string $key the key of the value, under which it was saved | ||
| * @return string the saved value | ||
| */ | ||
| public function getAppValue($appName, $key) { | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. doesn't match the interface declaration |
||
| return \OCP\Config::getAppValue($appName, $key, ''); | ||
| } | ||
|
|
||
|
|
||
| /** | ||
| * Set a user defined value | ||
| * @param string $userId the userId of the user that we want to store the value under | ||
| * @param string $appName the appName that we want to store the value under | ||
| * @param string $key the key under which the value is being stored | ||
| * @param string $value the value that you want to store | ||
| */ | ||
| public function setUserValue($userId, $appName, $key, $value) { | ||
| \OCP\Config::setUserValue($userId, $appName, $key, $value); | ||
| } | ||
|
|
||
| /** | ||
| * Shortcut for getting a user defined value | ||
| * @param string $userId the userId of the user that we want to store the value under | ||
| * @param string $appName the appName that we stored the value under | ||
| * @param string $key the key under which the value is being stored | ||
| */ | ||
| public function getUserValue($userId, $appName, $key){ | ||
| return \OCP\Config::getUserValue($userId, $appName, $key); | ||
| } | ||
| } | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| <?php | ||
| /** | ||
| * Copyright (c) 2013 Bart Visscher <bartv@thisnet.nl> | ||
| * This file is licensed under the Affero General Public License version 3 or | ||
| * later. | ||
| * See the COPYING-README file. | ||
| * | ||
| */ | ||
|
|
||
| namespace OC; | ||
|
|
||
| /** | ||
| * Manages the ownCloud navigation | ||
| */ | ||
| class NavigationManager implements \OCP\INavigationManager { | ||
| protected $entries = array(); | ||
| protected $activeEntry; | ||
|
|
||
| /** | ||
| * Creates a new navigation entry | ||
| * @param array $entry containing: id, name, order, icon and href key | ||
| */ | ||
| public function add(array $entry) { | ||
| $entry['active'] = false; | ||
| if(!isset($entry['icon'])) { | ||
| $entry['icon'] = ''; | ||
| } | ||
| $this->entries[] = $entry; | ||
| } | ||
|
|
||
| /** | ||
| * @brief returns all the added Menu entries | ||
| * @return array of the added entries | ||
| */ | ||
| public function getAll() { | ||
| return $this->entries; | ||
| } | ||
|
|
||
| /** | ||
| * @brief removes all the entries | ||
| */ | ||
| public function clear() { | ||
| $this->entries = array(); | ||
| } | ||
|
|
||
| /** | ||
| * Sets the current navigation entry of the currently running app | ||
| * @param string $id of the app entry to activate (from added $entry) | ||
| */ | ||
| public function setActiveEntry($id) { | ||
| $this->activeEntry = $id; | ||
| } | ||
|
|
||
| /** | ||
| * @brief gets the active Menu entry | ||
| * @return string id or empty string | ||
| * | ||
| * This function returns the id of the active navigation entry (set by | ||
| * setActiveEntry | ||
| */ | ||
| public function getActiveEntry() { | ||
| return $this->activeEntry; | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,65 @@ | ||
| <?php | ||
| /** | ||
| * Copyright (c) 2013 Bart Visscher <bartv@thisnet.nl> | ||
| * This file is licensed under the Affero General Public License version 3 or | ||
| * later. | ||
| * See the COPYING-README file. | ||
| * | ||
| */ | ||
|
|
||
| namespace OCP; | ||
|
|
||
| /** | ||
| * Access to all the configuration options ownCloud offers | ||
| */ | ||
| interface IConfig { | ||
| /** | ||
| * Sets a new system wide value | ||
| * @param string $key the key of the value, under which will be saved | ||
| * @param string $value the value that should be stored | ||
| * @todo need a use case for this | ||
| */ | ||
| // public function setSystemValue($key, $value); | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmmm - if there is a getSystemValue() why not a setSystemValue()?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do we want apps to write into config.php? is not really the place to store app values.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. hmm - where did my comments go? Well accessing config.php has some sec issues as well like getting access to the password salt, database credentials ... |
||
|
|
||
| /** | ||
| * Looks up a system wide defined value | ||
| * @param string $key the key of the value, under which it was saved | ||
| * @return string the saved value | ||
| */ | ||
| public function getSystemValue($key); | ||
|
|
||
|
|
||
| /** | ||
| * Writes a new app wide value | ||
| * @param string $appName the appName that we want to store the value under | ||
| * @param string $key the key of the value, under which will be saved | ||
| * @param string $value the value that should be stored | ||
| */ | ||
| public function setAppValue($appName, $key, $value); | ||
|
|
||
| /** | ||
| * Looks up an app wide defined value | ||
| * @param string $appName the appName that we stored the value under | ||
| * @param string $key the key of the value, under which it was saved | ||
| * @return string the saved value | ||
| */ | ||
| public function getAppValue($appName, $key); | ||
|
|
||
|
|
||
| /** | ||
| * Set a user defined value | ||
| * @param string $userId the userId of the user that we want to store the value under | ||
| * @param string $appName the appName that we want to store the value under | ||
| * @param string $key the key under which the value is being stored | ||
| * @param string $value the value that you want to store | ||
| */ | ||
| public function setUserValue($userId, $appName, $key, $value); | ||
|
|
||
| /** | ||
| * Shortcut for getting a user defined value | ||
| * @param string $userId the userId of the user that we want to store the value under | ||
| * @param string $appName the appName that we stored the value under | ||
| * @param string $key the key under which the value is being stored | ||
| */ | ||
| public function getUserValue($userId, $appName, $key); | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't match the interface declaration
= nullis missing