[ Index ] |
PHP Cross Reference of phpBB-3.2.11-deutsch |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * 4 * This file is part of the phpBB Forum Software package. 5 * 6 * @copyright (c) phpBB Limited <https://www.phpbb.com> 7 * @license GNU General Public License, version 2 (GPL-2.0) 8 * 9 * For full copyright and license information, please see 10 * the docs/CREDITS.txt file. 11 * 12 */ 13 14 namespace phpbb\notification\method; 15 16 use phpbb\notification\type\type_interface; 17 18 /** 19 * Jabber notification method class 20 * This class handles sending Jabber messages for notifications 21 */ 22 23 class jabber extends \phpbb\notification\method\messenger_base 24 { 25 /** @var \phpbb\user */ 26 protected $user; 27 28 /** @var \phpbb\config\config */ 29 protected $config; 30 31 /** 32 * Notification Method jabber Constructor 33 * 34 * @param \phpbb\user_loader $user_loader 35 * @param \phpbb\user $user 36 * @param \phpbb\config\config $config 37 * @param string $phpbb_root_path 38 * @param string $php_ext 39 */ 40 public function __construct(\phpbb\user_loader $user_loader, \phpbb\user $user, \phpbb\config\config $config, $phpbb_root_path, $php_ext) 41 { 42 parent::__construct($user_loader, $phpbb_root_path, $php_ext); 43 44 $this->user = $user; 45 $this->config = $config; 46 } 47 48 /** 49 * Get notification method name 50 * 51 * @return string 52 */ 53 public function get_type() 54 { 55 return 'notification.method.jabber'; 56 } 57 58 /** 59 * Is this method available for the user? 60 * This is checked on the notifications options 61 * 62 * @param type_interface $notification_type An optional instance of a notification type. If provided, this 63 * method additionally checks if the type provides an email template. 64 * @return bool 65 */ 66 public function is_available(type_interface $notification_type = null) 67 { 68 return parent::is_available($notification_type) && $this->global_available() && $this->user->data['user_jabber']; 69 } 70 71 /** 72 * Is this method available at all? 73 * This is checked before notifications are sent 74 */ 75 public function global_available() 76 { 77 return !( 78 empty($this->config['jab_enable']) || 79 empty($this->config['jab_host']) || 80 empty($this->config['jab_username']) || 81 empty($this->config['jab_password']) || 82 !@extension_loaded('xml') 83 ); 84 } 85 86 public function notify() 87 { 88 if (!$this->global_available()) 89 { 90 return; 91 } 92 93 $this->notify_using_messenger(NOTIFY_IM, 'short/'); 94 } 95 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Nov 11 20:33:01 2020 | Cross-referenced by PHPXref 0.7.1 |