mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-12-27 09:09:04 +01:00
use static Hooks methods
This commit is contained in:
parent
c6e6da63ef
commit
e87cbc4832
@ -1057,7 +1057,7 @@ class Accounts
|
||||
}
|
||||
// call hook to notify interested apps about the new account
|
||||
$GLOBALS['hook_values'] = $data;
|
||||
$GLOBALS['egw']->hooks->process($data+array(
|
||||
Hooks::process($data+array(
|
||||
'location' => 'addaccount',
|
||||
// at login-time only the hooks from the following apps will be called
|
||||
'order' => array('felamimail','fudforum'),
|
||||
|
@ -260,7 +260,7 @@ class Auth
|
||||
'old_passwd' => $old_passwd,
|
||||
'new_passwd' => $new_passwd,
|
||||
);
|
||||
$GLOBALS['egw']->hooks->process($GLOBALS['hook_values']+array(
|
||||
Hooks::process($GLOBALS['hook_values']+array(
|
||||
'location' => 'changepassword'
|
||||
),False,True); // called for every app now, not only enabled ones)
|
||||
}
|
||||
|
@ -389,7 +389,7 @@ class CalDAV extends HTTP_WebDAV_Server
|
||||
|
||||
if ($path == '/')
|
||||
{
|
||||
$GLOBALS['egw']->hooks->process(array(
|
||||
Hooks::process(array(
|
||||
'location' => 'groupdav_root_props',
|
||||
'props' => &$files['files'][0]['props'],
|
||||
'options' => $options,
|
||||
|
@ -626,11 +626,11 @@ class Categories
|
||||
);
|
||||
if($this->is_global($cat_id, true)) // true = application global (otherwise eg. global addressbook categories call all apps)
|
||||
{
|
||||
$GLOBALS['egw']->hooks->process($GLOBALS['hook_values'],False,True); // called for every app now, not only enabled ones)
|
||||
Hooks::process($GLOBALS['hook_values'],False,True); // called for every app now, not only enabled ones)
|
||||
}
|
||||
else
|
||||
{
|
||||
$GLOBALS['egw']->hooks->single($GLOBALS['hook_values'], self::id2name($cat_id,'appname'));
|
||||
Hooks::single($GLOBALS['hook_values'], self::id2name($cat_id,'appname'));
|
||||
}
|
||||
|
||||
$this->db->delete(self::TABLE,$where,__LINE__,__FILE__);
|
||||
|
@ -992,7 +992,7 @@ class Contacts extends Contacts\Storage
|
||||
$GLOBALS['egw']->accounts->cache_invalidate($contact['account_id']);
|
||||
// call edit-accout hook, to let other apps know about changed account (names or email)
|
||||
$GLOBALS['hook_values'] = $GLOBALS['egw']->accounts->read($contact['account_id']);
|
||||
$GLOBALS['egw']->hooks->process($GLOBALS['hook_values']+array(
|
||||
Hooks::process($GLOBALS['hook_values']+array(
|
||||
'location' => 'editaccount',
|
||||
),False,True); // called for every app now, not only enabled ones)
|
||||
}
|
||||
@ -1000,7 +1000,7 @@ class Contacts extends Contacts\Storage
|
||||
if (!$to_write['owner'] && $to_write['account_id'] && $isUpdate)
|
||||
{
|
||||
$to_write['location'] = 'editaccountcontact';
|
||||
$GLOBALS['egw']->hooks->process($to_write,False,True); // called for every app now, not only enabled ones));
|
||||
Hooks::process($to_write,False,True); // called for every app now, not only enabled ones));
|
||||
}
|
||||
// Notify linked apps about changes in the contact data
|
||||
Link::notify_update('addressbook', $contact['id'], $contact);
|
||||
|
@ -487,7 +487,7 @@ class Backup
|
||||
Api\Cache::flush(Api\Cache::INSTANCE);
|
||||
|
||||
// search-and-register-hooks
|
||||
$GLOBALS['egw']->hooks->register_all_hooks();
|
||||
Api\Hooks::read(true);
|
||||
|
||||
return '';
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ class Etemplate extends Etemplate\Widget\Template
|
||||
*/
|
||||
function exec($method,array $content,array $sel_options=null,array $readonlys=null,array $preserv=null,$output_mode=0,$ignore_validation='',array $changes=null)
|
||||
{
|
||||
$hook_data = $GLOBALS['egw']->hooks->process(
|
||||
$hook_data = Hooks::process(
|
||||
array('hook_location' => 'etemplate2_before_exec') +
|
||||
array('location_name' => $this->name) +
|
||||
array('location_object' => &$this) +
|
||||
@ -351,7 +351,7 @@ class Etemplate extends Etemplate\Widget\Template
|
||||
// tell request call to remove request, if it is not modified eg. by call to exec in callback
|
||||
self::$request->remove_if_not_modified();
|
||||
|
||||
foreach($GLOBALS['egw']->hooks->process(array(
|
||||
foreach(Hooks::process(array(
|
||||
'hook_location' => 'etemplate2_before_process',
|
||||
'location_name' => $template->id,
|
||||
) + self::complete_array_merge(self::$request->preserv, $validated)) as $extras)
|
||||
@ -374,7 +374,7 @@ class Etemplate extends Etemplate\Widget\Template
|
||||
$tcontent = is_array($content) ? $content :
|
||||
self::complete_array_merge(self::$request->preserv, $validated);
|
||||
|
||||
$hook_data = $GLOBALS['egw']->hooks->process(
|
||||
$hook_data = Hooks::process(
|
||||
array(
|
||||
'hook_location' => 'etemplate2_after_process',
|
||||
'location_name' => $template->id
|
||||
|
@ -323,7 +323,7 @@ class Widget
|
||||
}
|
||||
|
||||
// Use hook to load custom widgets from other apps
|
||||
$widgets = $GLOBALS['egw']->hooks->process('etemplate2_register_widgets',array(),true);
|
||||
$widgets = Api\Hooks::process('etemplate2_register_widgets',array(),true);
|
||||
foreach($widgets as $list)
|
||||
{
|
||||
if (is_array($list))
|
||||
|
@ -12,6 +12,8 @@
|
||||
|
||||
namespace EGroupware\Api\Header;
|
||||
|
||||
use EGroupware\Api;
|
||||
|
||||
/**
|
||||
* Content Security Policy headers
|
||||
*/
|
||||
@ -50,8 +52,8 @@ class ContentSecurityPolicy
|
||||
// set frame-src attrs of API and apps via hook
|
||||
if ($source == 'frame-src' && !isset($attrs))
|
||||
{
|
||||
$attrs = array('manual.egroupware.org', 'www.egroupware.org');
|
||||
if (($app_additional = $GLOBALS['egw']->hooks->process('csp-frame-src')))
|
||||
$attrs = array('www.egroupware.org');
|
||||
if (($app_additional = Api\Hooks::process('csp-frame-src')))
|
||||
{
|
||||
foreach($app_additional as $addtional)
|
||||
{
|
||||
|
@ -207,7 +207,7 @@ class Link extends Link\Storage
|
||||
// for performance reasons, we do it only once / cache it in the session
|
||||
if (!($search_link_hooks = Cache::getSession(__CLASS__, 'search_link_hooks')))
|
||||
{
|
||||
$search_link_hooks = $GLOBALS['egw']->hooks->process('search_link',array(), (bool)$GLOBALS['egw_info']['flags']['async-service']);
|
||||
$search_link_hooks = Hooks::process('search_link',array(), (bool)$GLOBALS['egw_info']['flags']['async-service']);
|
||||
Cache::setSession(__CLASS__, 'search_link_hooks', $search_link_hooks);
|
||||
}
|
||||
if (is_array($search_link_hooks))
|
||||
|
@ -14,6 +14,8 @@
|
||||
|
||||
namespace EGroupware\Api\Mail;
|
||||
|
||||
use EGroupware\Api;
|
||||
|
||||
class Types
|
||||
{
|
||||
/**
|
||||
@ -26,7 +28,7 @@ class Types
|
||||
static public function getSMTPServerTypes($extended=true)
|
||||
{
|
||||
$retData = self::server_types(false, $extended);
|
||||
foreach($GLOBALS['egw']->hooks->process(array(
|
||||
foreach(Api\Hooks::process(array(
|
||||
'location' => 'smtp_server_types',
|
||||
'extended' => $extended,
|
||||
), array('managementserver'), true) as $app => $data)
|
||||
@ -56,7 +58,7 @@ class Types
|
||||
static public function getIMAPServerTypes($extended=true)
|
||||
{
|
||||
$retData = self::server_types(true, $extended);
|
||||
foreach($GLOBALS['egw']->hooks->process(array(
|
||||
foreach(Api\Hooks::process(array(
|
||||
'location' => 'imap_server_types',
|
||||
'extended' => $extended,
|
||||
), array('managementserver'), true) as $app => $data)
|
||||
|
@ -503,7 +503,7 @@ class Mailer extends Horde_Mime_Mail
|
||||
}
|
||||
$body_sha1 = null; // skip sha1, it requires whole mail in memory, which we traing to avoid now
|
||||
|
||||
$mail_id = $GLOBALS['egw']->hooks->process(array(
|
||||
$mail_id = Hooks::process(array(
|
||||
'location' => 'send_mail',
|
||||
'subject' => $subject=$this->getHeader('Subject'),
|
||||
'from' => $this->getHeader('Return-Path') ? $this->getHeader('Return-Path') : $this->getHeader('From'),
|
||||
@ -578,7 +578,7 @@ class Mailer extends Horde_Mime_Mail
|
||||
}
|
||||
catch (\Exception $e) {
|
||||
// in case of errors/exceptions call hook again with previous returned mail_id and error-message to log
|
||||
$GLOBALS['egw']->hooks->process(array(
|
||||
Hooks::process(array(
|
||||
'location' => 'send_mail',
|
||||
'subject' => $subject,
|
||||
'from' => $this->getHeader('Return-Path') ? $this->getHeader('Return-Path') : $this->getHeader('From'),
|
||||
|
@ -566,7 +566,7 @@ class Session
|
||||
$this->session_flags = 'N';
|
||||
}
|
||||
|
||||
if (($hook_result = $GLOBALS['egw']->hooks->process(array(
|
||||
if (($hook_result = Hooks::process(array(
|
||||
'location' => 'session_creation',
|
||||
'sessionid' => $this->sessionid,
|
||||
'session_flags' => $this->session_flags,
|
||||
@ -1042,7 +1042,7 @@ class Session
|
||||
),__LINE__,__FILE__)->fetchColumn();
|
||||
}
|
||||
|
||||
$GLOBALS['egw']->hooks->process(array(
|
||||
Hooks::process(array(
|
||||
'location' => 'session_destroyed',
|
||||
'sessionid' => $sessionid,
|
||||
),'',true); // true = run hooks from all apps, not just the ones the current user has perms to run
|
||||
|
@ -500,7 +500,7 @@ abstract class Merge
|
||||
$exportLimitStore[$app] = $GLOBALS['egw_info']['server']['export_limit'];
|
||||
if ($app !='common')
|
||||
{
|
||||
$app_limit = $GLOBALS['egw']->hooks->single('export_limit',$app);
|
||||
$app_limit = Api\Hooks::single('export_limit',$app);
|
||||
if ($app_limit) $exportLimitStore[$app] = $app_limit;
|
||||
}
|
||||
//error_log(__METHOD__.__LINE__.' building cache for app:'.$app.' -> '.$exportLimitStore[$app]);
|
||||
|
@ -1768,7 +1768,7 @@ class Vfs extends Vfs\StreamWrapper
|
||||
$extra[] = $extra_info;
|
||||
}
|
||||
|
||||
if (($vfs_extra = $GLOBALS['egw']->hooks->process(array(
|
||||
if (($vfs_extra = Hooks::process(array(
|
||||
'location' => 'vfs_extra',
|
||||
'path' => $path,
|
||||
'content' => $content,
|
||||
|
@ -125,7 +125,7 @@ class Utils extends StreamWrapper
|
||||
if ($check_msgs) $msgs = array_merge($msgs, $check_msgs);
|
||||
}
|
||||
|
||||
foreach ($GLOBALS['egw']->hooks->process(array(
|
||||
foreach (Api\Hooks::process(array(
|
||||
'location' => 'fsck',
|
||||
'check_only' => $check_only)
|
||||
) as $app_msgs)
|
||||
|
@ -360,7 +360,7 @@ class StreamWrapper implements StreamWrapperIface
|
||||
|
||||
if (isset($GLOBALS['egw']) && isset($GLOBALS['egw']->hooks))
|
||||
{
|
||||
$GLOBALS['egw']->hooks->process(array(
|
||||
Api\Hooks::process(array(
|
||||
'location' => str_replace('b','',$this->opened_stream_mode) == 'r' ? 'vfs_read' :
|
||||
($this->opened_stream_is_new ? 'vfs_added' : 'vfs_modified'),
|
||||
'path' => $this->opened_stream_path,
|
||||
@ -507,7 +507,7 @@ class StreamWrapper implements StreamWrapperIface
|
||||
// call "vfs_unlink" hook only after successful unlink, with data from (not longer possible) stat call
|
||||
if ($ok && isset($GLOBALS['egw']) && isset($GLOBALS['egw']->hooks))
|
||||
{
|
||||
$GLOBALS['egw']->hooks->process(array(
|
||||
Api\Hooks::process(array(
|
||||
'location' => 'vfs_unlink',
|
||||
'path' => $path[0] == '/' ? $path : self::parse_url($path, PHP_URL_PATH),
|
||||
'url' => $url,
|
||||
@ -560,7 +560,7 @@ class StreamWrapper implements StreamWrapperIface
|
||||
// call "vfs_rename" hook
|
||||
if ($ret && isset($GLOBALS['egw']) && isset($GLOBALS['egw']->hooks))
|
||||
{
|
||||
$GLOBALS['egw']->hooks->process(array(
|
||||
Api\Hooks::process(array(
|
||||
'location' => 'vfs_rename',
|
||||
'from' => $path_from[0] == '/' ? $path_from : self::parse_url($path_from, PHP_URL_PATH),
|
||||
'to' => $path_to[0] == '/' ? $path_to : self::parse_url($path_to, PHP_URL_PATH),
|
||||
@ -593,7 +593,7 @@ class StreamWrapper implements StreamWrapperIface
|
||||
// call "vfs_mkdir" hook
|
||||
if ($ret && isset($GLOBALS['egw']) && isset($GLOBALS['egw']->hooks))
|
||||
{
|
||||
$GLOBALS['egw']->hooks->process(array(
|
||||
Api\Hooks::process(array(
|
||||
'location' => 'vfs_mkdir',
|
||||
'path' => $path[0] == '/' ? $path : self::parse_url($path, PHP_URL_PATH),
|
||||
'url' => $url,
|
||||
@ -631,7 +631,7 @@ class StreamWrapper implements StreamWrapperIface
|
||||
// call "vfs_rmdir" hook, only after successful rmdir
|
||||
if ($ok && isset($GLOBALS['egw']) && isset($GLOBALS['egw']->hooks))
|
||||
{
|
||||
$GLOBALS['egw']->hooks->process(array(
|
||||
Api\Hooks::process(array(
|
||||
'location' => 'vfs_rmdir',
|
||||
'path' => $path[0] == '/' ? $path : self::parse_url($path, PHP_URL_PATH),
|
||||
'url' => $url,
|
||||
|
Loading…
Reference in New Issue
Block a user