summaryrefslogtreecommitdiffstats
path: root/ocs-provider/index.php
diff options
context:
space:
mode:
Diffstat (limited to 'ocs-provider/index.php')
0 files changed, 0 insertions, 0 deletions
n53'>53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108
<?php

/**
 * This class manages the hooks. It basically provides two functions: adding
 * slots and emitting signals.
 */
class OC_Hook{
	static private $registered = array();

	/**
	 * @brief connects a function to a hook
	 * @param string $signalclass class name of emitter
	 * @param string $signalname name of signal
	 * @param string $slotclass class name of slot
	 * @param string $slotname name of slot
	 * @return bool
	 *
	 * This function makes it very easy to connect to use hooks.
	 *
	 * TODO: write example
	 */
	static public function connect( $signalclass, $signalname, $slotclass, $slotname ) {
		// If we're trying to connect to an emitting class that isn't
		// yet registered, register it
		if( !array_key_exists( $signalclass, self::$registered )) {
			self::$registered[$signalclass] = array();
		}
		// If we're trying to connect to an emitting method that isn't
		// yet registered, register it with the emitting class
		if( !array_key_exists( $signalname, self::$registered[$signalclass] )) {
			self::$registered[$signalclass][$signalname] = array();
		}

		// Connect the hook handler to the requested emitter
		self::$registered[$signalclass][$signalname][] = array(
				"class" => $slotclass,
				"name" => $slotname
		);

		// No chance for failure ;-)
		return true;
	}

	/**
	 * @brief emits a signal
	 * @param string $signalclass class name of emitter
	 * @param string $signalname name of signal
	 * @param array $params defautl: array() array with additional data
	 * @return bool, true if slots exists or false if not
	 *
	 * Emits a signal. To get data from the slot use references!
	 *
	 * TODO: write example
	 */
	static public function emit( $signalclass, $signalname, $params = array()) {

		// Return false if no hook handlers are listening to this
		// emitting class
		if( !array_key_exists( $signalclass, self::$registered )) {
			return false;
		}

		// Return false if no hook handlers are listening to this
		// emitting method
		if( !array_key_exists( $signalname, self::$registered[$signalclass] )) {
			return false;
		}

		// Call all slots
		foreach( self::$registered[$signalclass][$signalname] as $i ) {
			try {
				call_user_func( array( $i["class"], $i["name"] ), $params );
			} catch (Exception $e){
				OC_Log::write('hook',
					'error while running hook (' . $i["class"] . '::' . $i["name"] . '): '.$e->getMessage(),
					OC_Log::ERROR);
			}
		}

		// return true
		return true;
	}

	/**
	 * clear hooks
	 * @param string $signalclass
	 * @param string $signalname
	 */
	static public function clear($signalclass='', $signalname='') {
		if($signalclass) {
			if($signalname) {
				self::$registered[$signalclass][$signalname]=array();
			}else{
				self::$registered[$signalclass]=array();
			}
		}else{
			self::$registered=array();
		}
	}

	/**
	 * DO NOT USE!
	 * For unit tests ONLY!
	 */
	static public function getHooks() {
		return self::$registered;
	}
}
="kd">#: ajax/togglegroups.php:12 msgid "Admins can't remove themself from the admin group" msgstr "" #: ajax/togglegroups.php:28 #, php-format msgid "Unable to add user to group %s" msgstr "" #: ajax/togglegroups.php:34 #, php-format msgid "Unable to remove user from group %s" msgstr "" #: ajax/updateapp.php:13 msgid "Couldn't update app." msgstr "" #: js/apps.js:30 msgid "Update to {appversion}" msgstr "" #: js/apps.js:36 js/apps.js:76 msgid "Disable" msgstr "" #: js/apps.js:36 js/apps.js:64 msgid "Enable" msgstr "" #: js/apps.js:55 msgid "Please wait...." msgstr "" #: js/apps.js:84 msgid "Updateing...." msgstr "" #: js/apps.js:87 msgid "Error while updating app" msgstr "" #: js/apps.js:87 msgid "Error" msgstr "" #: js/apps.js:90 msgid "Updated" msgstr "" #: js/personal.js:69 msgid "Saving..." msgstr "" #: personal.php:34 personal.php:35 msgid "__language_name__" msgstr "" #: templates/apps.php:10 msgid "Add your App" msgstr "" #: templates/apps.php:11 msgid "More Apps" msgstr "" #: templates/apps.php:24 msgid "Select an App" msgstr "" #: templates/apps.php:28 msgid "See application page at apps.owncloud.com" msgstr "" #: templates/apps.php:29 msgid "" "<span class=\"licence\"></span>-licensed by <span class=\"author\"></span>" msgstr "" #: templates/apps.php:31 msgid "Update" msgstr "" #: templates/help.php:3 msgid "User Documentation" msgstr "" #: templates/help.php:4 msgid "Administrator Documentation" msgstr "" #: templates/help.php:6 msgid "Online Documentation" msgstr "" #: templates/help.php:7 msgid "Forum" msgstr "" #: templates/help.php:9 msgid "Bugtracker" msgstr "" #: templates/help.php:11 msgid "Commercial Support" msgstr "" #: templates/personal.php:8 #, php-format msgid "You have used <strong>%s</strong> of the available <strong>%s</strong>" msgstr "" #: templates/personal.php:12 msgid "Clients" msgstr "" #: templates/personal.php:13 msgid "Download Desktop Clients" msgstr "" #: templates/personal.php:14 msgid "Download Android Client" msgstr "" #: templates/personal.php:15 msgid "Download iOS Client" msgstr "" #: templates/personal.php:21 templates/users.php:23 templates/users.php:81 msgid "Password" msgstr "" #: templates/personal.php:22 msgid "Your password was changed" msgstr "" #: templates/personal.php:23 msgid "Unable to change your password" msgstr "" #: templates/personal.php:24 msgid "Current password" msgstr "" #: templates/personal.php:25 msgid "New password" msgstr "" #: templates/personal.php:26 msgid "show" msgstr "" #: templates/personal.php:27 msgid "Change password" msgstr "" #: templates/personal.php:33 msgid "Email" msgstr "" #: templates/personal.php:34 msgid "Your email address" msgstr "" #: templates/personal.php:35 msgid "Fill in an email address to enable password recovery" msgstr "" #: templates/personal.php:41 templates/personal.php:42 msgid "Language" msgstr "" #: templates/personal.php:47 msgid "Help translate" msgstr "" #: templates/personal.php:52 msgid "WebDAV" msgstr "" #: templates/personal.php:54 msgid "Use this address to connect to your ownCloud in your file manager" msgstr "" #: templates/personal.php:63 msgid "Version" msgstr "" #: templates/personal.php:65 msgid "" "Developed by the <a href=\"http://ownCloud.org/contact\" target=\"_blank" "\">ownCloud community</a>, the <a href=\"https://github.com/owncloud\" " "target=\"_blank\">source code</a> is licensed under the <a href=\"http://www." "gnu.org/licenses/agpl-3.0.html\" target=\"_blank\"><abbr title=\"Affero " "General Public License\">AGPL</abbr></a>." msgstr "" #: templates/users.php:21 templates/users.php:79 msgid "Login Name" msgstr "" #: templates/users.php:26 templates/users.php:82 templates/users.php:107 msgid "Groups" msgstr "" #: templates/users.php:32 msgid "Create" msgstr "" #: templates/users.php:35 msgid "Default Storage" msgstr "" #: templates/users.php:42 templates/users.php:142 msgid "Unlimited" msgstr "" #: templates/users.php:60 templates/users.php:157 msgid "Other" msgstr "" #: templates/users.php:80 msgid "Display Name" msgstr "" #: templates/users.php:84 templates/users.php:121 msgid "Group Admin" msgstr "" #: templates/users.php:86 msgid "Storage" msgstr "" #: templates/users.php:97 msgid "change display name" msgstr "" #: templates/users.php:101 msgid "set new password" msgstr "" #: templates/users.php:137 msgid "Default" msgstr "" #: templates/users.php:165 msgid "Delete" msgstr ""