diff options
-rwxr-xr-x | apps/calendar/appinfo/app.php | 2 | ||||
-rwxr-xr-x | apps/calendar/index.php | 2 | ||||
-rwxr-xr-x | apps/calendar/lib/app.php | 2 | ||||
-rwxr-xr-x | apps/contacts/appinfo/app.php | 6 | ||||
-rwxr-xr-x | apps/files_archive/appinfo/app.php | 2 | ||||
-rwxr-xr-x | apps/files_encryption/appinfo/app.php | 2 | ||||
-rwxr-xr-x | apps/files_sharing/appinfo/app.php | 12 | ||||
-rwxr-xr-x | apps/files_sharing/lib_share.php | 4 | ||||
-rwxr-xr-x | apps/files_versions/appinfo/app.php | 2 | ||||
-rwxr-xr-x | apps/gallery/lib/hooks_handlers.php | 6 | ||||
-rwxr-xr-x | apps/media/lib_media.php | 8 | ||||
-rw-r--r-- | lib/public/template.php | 56 | ||||
-rw-r--r-- | lib/public/util.php | 29 |
13 files changed, 109 insertions, 24 deletions
diff --git a/apps/calendar/appinfo/app.php b/apps/calendar/appinfo/app.php index 7b5db834fb5..b02fc602c6b 100755 --- a/apps/calendar/appinfo/app.php +++ b/apps/calendar/appinfo/app.php @@ -7,7 +7,7 @@ OC::$CLASSPATH['OC_Calendar_Hooks'] = 'apps/calendar/lib/hooks.php'; OC::$CLASSPATH['OC_Connector_Sabre_CalDAV'] = 'apps/calendar/lib/connector_sabre.php'; OC::$CLASSPATH['OC_Calendar_Share'] = 'apps/calendar/lib/share.php'; OC::$CLASSPATH['OC_Search_Provider_Calendar'] = 'apps/calendar/lib/search.php'; -OC_HOOK::connect('OC_User', 'post_deleteUser', 'OC_Calendar_Hooks', 'deleteUser'); +OCP\Util::connectHook('OC_User', 'post_deleteUser', 'OC_Calendar_Hooks', 'deleteUser'); OCP\Util::addscript('calendar','loader'); OCP\Util::addscript("3rdparty", "chosen/chosen.jquery.min"); OCP\Util::addStyle("3rdparty", "chosen/chosen"); diff --git a/apps/calendar/index.php b/apps/calendar/index.php index 3a3915b9669..5aee5f6ace8 100755 --- a/apps/calendar/index.php +++ b/apps/calendar/index.php @@ -25,7 +25,7 @@ foreach($calendars as $calendar){ $eventSources[] = array('url' => '?app=calendar&getfile=ajax/events.php?calendar_id=shared_rw', 'backgroundColor' => '#1D2D44', 'borderColor' => '#888', 'textColor' => 'white', 'editable'=>'true'); $eventSources[] = array('url' => '?app=calendar&getfile=ajax/events.php?calendar_id=shared_r', 'backgroundColor' => '#1D2D44', 'borderColor' => '#888', 'textColor' => 'white', 'editable' => 'false'); -OC_Hook::emit('OC_Calendar', 'getSources', array('sources' => &$eventSources)); +OCP\Util::emitHook('OC_Calendar', 'getSources', array('sources' => &$eventSources)); $categories = OC_Calendar_App::getCategoryOptions(); //Fix currentview for fullcalendar diff --git a/apps/calendar/lib/app.php b/apps/calendar/lib/app.php index f955c59603d..eb440b5794b 100755 --- a/apps/calendar/lib/app.php +++ b/apps/calendar/lib/app.php @@ -338,7 +338,7 @@ class OC_Calendar_App{ OCP\Response::setETagHeader($calendar['ctag']); $events = OC_Calendar_Object::allInPeriod($calendar_id, $start, $end); } else { - OC_Hook::emit('OC_Calendar', 'getEvents', array('calendar_id' => $calendar_id, 'events' => &$events)); + OCP\Util::emitHook('OC_Calendar', 'getEvents', array('calendar_id' => $calendar_id, 'events' => &$events)); } } return $events; diff --git a/apps/contacts/appinfo/app.php b/apps/contacts/appinfo/app.php index 4808ea5fa83..e5e1d572f2d 100755 --- a/apps/contacts/appinfo/app.php +++ b/apps/contacts/appinfo/app.php @@ -5,9 +5,9 @@ OC::$CLASSPATH['OC_Contacts_VCard'] = 'apps/contacts/lib/vcard.php'; OC::$CLASSPATH['OC_Contacts_Hooks'] = 'apps/contacts/lib/hooks.php'; OC::$CLASSPATH['OC_Connector_Sabre_CardDAV'] = 'apps/contacts/lib/connector_sabre.php'; OC::$CLASSPATH['OC_Search_Provider_Contacts'] = 'apps/contacts/lib/search.php'; -OC_HOOK::connect('OC_User', 'post_deleteUser', 'OC_Contacts_Hooks', 'deleteUser'); -OC_HOOK::connect('OC_Calendar', 'getEvents', 'OC_Contacts_Hooks', 'getBirthdayEvents'); -OC_HOOK::connect('OC_Calendar', 'getSources', 'OC_Contacts_Hooks', 'getCalenderSources'); +OCP\Util::connectHook('OC_User', 'post_deleteUser', 'OC_Contacts_Hooks', 'deleteUser'); +OCP\Util::connectHook('OC_Calendar', 'getEvents', 'OC_Contacts_Hooks', 'getBirthdayEvents'); +OCP\Util::connectHook('OC_Calendar', 'getSources', 'OC_Contacts_Hooks', 'getCalenderSources'); OCP\App::register( array( 'order' => 10, diff --git a/apps/files_archive/appinfo/app.php b/apps/files_archive/appinfo/app.php index 0b156ced277..67376c4a03a 100755 --- a/apps/files_archive/appinfo/app.php +++ b/apps/files_archive/appinfo/app.php @@ -8,6 +8,6 @@ OC::$CLASSPATH['OC_Filestorage_Archive']='apps/files_archive/lib/storage.php'; -OC_Hook::connect('OC_Filesystem','get_mountpoint','OC_Filestorage_Archive','autoMount'); +OCP\Util::connectHook('OC_Filesystem','get_mountpoint','OC_Filestorage_Archive','autoMount'); OCP\Util::addscript( 'files_archive', 'archive' ); diff --git a/apps/files_encryption/appinfo/app.php b/apps/files_encryption/appinfo/app.php index 02fc9dfa267..679d0b95edc 100755 --- a/apps/files_encryption/appinfo/app.php +++ b/apps/files_encryption/appinfo/app.php @@ -6,7 +6,7 @@ OC::$CLASSPATH['OC_FileProxy_Encryption'] = 'apps/files_encryption/lib/proxy.php OC_FileProxy::register(new OC_FileProxy_Encryption()); -OC_Hook::connect('OC_User','post_login','OC_Crypt','loginListener'); +OCP\Util::connectHook('OC_User','post_login','OC_Crypt','loginListener'); stream_wrapper_register('crypt','OC_CryptStream'); diff --git a/apps/files_sharing/appinfo/app.php b/apps/files_sharing/appinfo/app.php index f80bdb9e195..bd81a45cc55 100755 --- a/apps/files_sharing/appinfo/app.php +++ b/apps/files_sharing/appinfo/app.php @@ -4,12 +4,12 @@ require_once('apps/files_sharing/sharedstorage.php'); OC::$CLASSPATH['OC_Share'] = "apps/files_sharing/lib_share.php"; OCP\App::registerAdmin('files_sharing', 'settings'); -OC_Hook::connect("OC_Filesystem", "post_delete", "OC_Share", "deleteItem"); -OC_Hook::connect("OC_Filesystem", "post_rename", "OC_Share", "renameItem"); -OC_Hook::connect("OC_Filesystem", "post_write", "OC_Share", "updateItem"); -OC_Hook::connect('OC_User', 'post_deleteUser', 'OC_Share', 'removeUser'); -OC_Hook::connect('OC_User', 'post_addToGroup', 'OC_Share', 'addToGroupShare'); -OC_Hook::connect('OC_User', 'post_removeFromGroup', 'OC_Share', 'removeFromGroupShare'); +OCP\Util::connectHook("OC_Filesystem", "post_delete", "OC_Share", "deleteItem"); +OCP\Util::connectHook("OC_Filesystem", "post_rename", "OC_Share", "renameItem"); +OCP\Util::connectHook("OC_Filesystem", "post_write", "OC_Share", "updateItem"); +OCP\Util::connectHook('OC_User', 'post_deleteUser', 'OC_Share', 'removeUser'); +OCP\Util::connectHook('OC_User', 'post_addToGroup', 'OC_Share', 'addToGroupShare'); +OCP\Util::connectHook('OC_User', 'post_removeFromGroup', 'OC_Share', 'removeFromGroupShare'); $dir = isset($_GET['dir']) ? $_GET['dir'] : '/'; if ($dir != '/Shared' || OCP\Config::getAppValue('files_sharing', 'resharing', 'yes') == 'yes') { OCP\Util::addscript("files_sharing", "share"); diff --git a/apps/files_sharing/lib_share.php b/apps/files_sharing/lib_share.php index fe8aa64fa81..71cca309776 100755 --- a/apps/files_sharing/lib_share.php +++ b/apps/files_sharing/lib_share.php @@ -410,7 +410,7 @@ class OC_Share { $source = "/".OCP\USER::getUser()."/files".self::cleanPath($arguments['path']); if ($target = self::getTarget($source)) { // Forward hook to notify of changes to target file - OC_Hook::emit("OC_Filesystem", "post_delete", array('path' => $target)); + OCP\Util::emitHook("OC_Filesystem", "post_delete", array('path' => $target)); $query = OCP\DB::prepare("DELETE FROM *PREFIX*sharing WHERE SUBSTR(source, 1, ?) = ? AND uid_owner = ?"); $query->execute(array(strlen($source), $source, OCP\USER::getUser())); } @@ -432,7 +432,7 @@ class OC_Share { $source = "/".OCP\USER::getUser()."/files".self::cleanPath($arguments['path']); if ($target = self::getTarget($source)) { // Forward hook to notify of changes to target file - OC_Hook::emit("OC_Filesystem", "post_write", array('path' => $target)); + OCP\Util::emitHook("OC_Filesystem", "post_write", array('path' => $target)); } } diff --git a/apps/files_versions/appinfo/app.php b/apps/files_versions/appinfo/app.php index ebaa7ee0e7e..fd3f78ab575 100755 --- a/apps/files_versions/appinfo/app.php +++ b/apps/files_versions/appinfo/app.php @@ -12,7 +12,7 @@ OCP\App::registerAdmin('files_versions', 'settings'); OCP\Util::addscript('files_versions', 'versions'); // Listen to write signals -OC_Hook::connect(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_post_write, "OCA_Versions\Storage", "write_hook"); +OCP\Util::connectHook(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_post_write, "OCA_Versions\Storage", "write_hook"); diff --git a/apps/gallery/lib/hooks_handlers.php b/apps/gallery/lib/hooks_handlers.php index 678d3fe7531..6391e9f4e54 100755 --- a/apps/gallery/lib/hooks_handlers.php +++ b/apps/gallery/lib/hooks_handlers.php @@ -21,9 +21,9 @@ * */ -OC_Hook::connect(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_post_write, "OC_Gallery_Hooks_Handlers", "addPhotoFromPath"); -OC_Hook::connect(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_delete, "OC_Gallery_Hooks_Handlers", "removePhoto"); -//OC_Hook::connect(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_post_rename, "OC_Gallery_Hooks_Handlers", "renamePhoto"); +OCP\Util::connectHook(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_post_write, "OC_Gallery_Hooks_Handlers", "addPhotoFromPath"); +OCP\Util::connectHook(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_delete, "OC_Gallery_Hooks_Handlers", "removePhoto"); +//OCP\Util::connectHook(OC_Filesystem::CLASSNAME, OC_Filesystem::signal_post_rename, "OC_Gallery_Hooks_Handlers", "renamePhoto"); require_once(OC::$CLASSPATH['OC_Gallery_Album']); require_once(OC::$CLASSPATH['OC_Gallery_Photo']); diff --git a/apps/media/lib_media.php b/apps/media/lib_media.php index 94c3fabe8a0..71069fdf4b9 100755 --- a/apps/media/lib_media.php +++ b/apps/media/lib_media.php @@ -22,16 +22,16 @@ */ //we need to have the sha256 hash of passwords for ampache -OC_Hook::connect('OC_User','post_login','OC_MEDIA','loginListener'); +OCP\Util::connectHook('OC_User','post_login','OC_MEDIA','loginListener'); //connect to the filesystem for auto updating -OC_Hook::connect('OC_Filesystem','post_write','OC_MEDIA','updateFile'); +OCP\Util::connectHook('OC_Filesystem','post_write','OC_MEDIA','updateFile'); //listen for file deletions to clean the database if a song is deleted -OC_Hook::connect('OC_Filesystem','post_delete','OC_MEDIA','deleteFile'); +OCP\Util::connectHook('OC_Filesystem','post_delete','OC_MEDIA','deleteFile'); //list for file moves to update the database -OC_Hook::connect('OC_Filesystem','post_rename','OC_MEDIA','moveFile'); +OCP\Util::connectHook('OC_Filesystem','post_rename','OC_MEDIA','moveFile'); class OC_MEDIA{ /** diff --git a/lib/public/template.php b/lib/public/template.php new file mode 100644 index 00000000000..eefd2a029fc --- /dev/null +++ b/lib/public/template.php @@ -0,0 +1,56 @@ +<?php +/** +* ownCloud +* +* @author Frank Karlitschek +* @copyright 2010 Frank Karlitschek karlitschek@kde.org +* +* This library is free software; you can redistribute it and/or +* modify it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE +* License as published by the Free Software Foundation; either +* version 3 of the License, or any later version. +* +* This library 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 library. If not, see <http://www.gnu.org/licenses/>. +* +*/ + +/** + * Public interface of ownCloud for apps to use. + * Template Class + * + */ + +// use OCP namespace for all classes that are considered public. +// This means that they should be used by apps instead of the internal ownCloud classes +namespace OCP; + + +/** + * @brief make OC_Helper::imagePath available as a simple function + * @param $app app + * @param $image image + * @returns link to the image + * + * For further information have a look at OC_Helper::imagePath + */ +function image_path( $app, $image ){ + return(image_path( $app, $image )); +} + + + +class Template extends OC_Template { + + + + + +} + +?> diff --git a/lib/public/util.php b/lib/public/util.php index a65b9aa2627..f5b8e798bb4 100644 --- a/lib/public/util.php +++ b/lib/public/util.php @@ -191,8 +191,37 @@ class Util { return(\OC_Helper::computerFileSize( $str )); } + /** + * @brief connects a function to a hook + * @param $signalclass class name of emitter + * @param $signalname name of signal + * @param $slotclass class name of slot + * @param $slotname name of slot + * @returns true/false + * + * This function makes it very easy to connect to use hooks. + * + * TODO: write example + */ + static public function connectHook( $signalclass, $signalname, $slotclass, $slotname ){ + return(\OC_Hook::connect( $signalclass, $signalname, $slotclass, $slotname )); + } + /** + * @brief emitts a signal + * @param $signalclass class name of emitter + * @param $signalname name of signal + * @param $params defautl: array() array with additional data + * @returns 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 emitHook( $signalclass, $signalname, $params = array()){ + return(\OC_Hook::emit( $signalclass, $signalname, $params )); + } } |