Skip to content
This repository was archived by the owner on Jun 10, 2020. It is now read-only.

Commit 6075dd7

Browse files
committed
PSR+phpDocs
Closing PHP tags removed and all tabs converted to spaces (in order to improve compliance with PSR); Rewrote all comments contained within the `plugin.php` file to the phpDocs format; Iterated plugin version to "1.0.1"; No other changes.
1 parent 074a2c0 commit 6075dd7

File tree

1 file changed

+41
-16
lines changed

1 file changed

+41
-16
lines changed

notifications/plugin.php

Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -8,37 +8,62 @@
88
PLUGIN INFORMATION BEGIN
99
Plugin Name: Notifications.
1010
Plugin Author: Caleb M / Maikuolan.
11-
Plugin Version: 1.0.0
11+
Plugin Version: 1.0.1
1212
Download Address: https://github.com/Maikuolan/phpMussel-plugin-notifications
1313
Min. Compatible: 0.9.0
1414
Max. Compatible: -
15-
Tested up to: 0.9.0
16-
Last Modified: 2015.11.15
15+
Tested up to: 0.9.2
16+
Last Modified: 2016.12.08
1717
Plugin Description: Receive email notifications from phpMussel whenever a file
1818
upload is blocked (requires PHP "mail" function to be
1919
correctly configured; for more information, please refer
2020
to http://php.net/manual/en/function.mail.php).
2121
PLUGIN INFORMATION END */
2222

23+
/**
24+
* Notifications plugin for phpMussel.
25+
*
26+
* Receive email notifications from phpMussel whenever a file upload is blocked
27+
* (requires PHP "mail" function to be correctly configured; for more
28+
* information, please refer to http://php.net/manual/en/function.mail.php).
29+
*
30+
* This document and its associated package can be downloaded for free from:
31+
* - GitHub <https://github.com/Maikuolan/phpMussel-plugin-notifications>.
32+
*
33+
* @package Maikuolan/phpMussel-plugin-notifications
34+
*/
35+
36+
/**
37+
* Prevents direct access (the plugin should only be called from the phpMussel
38+
* plugin system).
39+
*/
2340
if(!defined('phpMussel'))die('[phpMussel] This should not be accessed directly.');
2441

42+
/**
43+
* Registers the `phpMussel_Notify()` function to the `before_html_out` hook.
44+
*/
2545
phpMussel_Register_Hook('phpMussel_Notify','before_html_out');
2646

2747
if(!isset($MusselConfig['notifications']))$MusselConfig['notifications']=array();
2848
if(!isset($MusselConfig['notifications']['to_addr']))$MusselConfig['notifications']['to_addr']='';
2949
if(!isset($MusselConfig['notifications']['from_addr']))$MusselConfig['notifications']['from_addr']='';
3050

51+
/**
52+
* The actual plugin code (the "Notifications" plugin only has one small
53+
* function; nothing else is needed).
54+
*
55+
* @param array $input An empty array (we don't need to send anything from the calling scope to the function, but, the plugin system nonetheless requires this parameter to exist).
56+
* @return bool Returns true if everything is working correctly.
57+
*/
3158
function phpMussel_Notify($input)
32-
{
33-
if(!$GLOBALS['MusselConfig']['notifications']['to_addr']||!$GLOBALS['MusselConfig']['notifications']['from_addr']||empty($GLOBALS['whyflagged']))return false;
34-
$NotifyLang=(!file_exists($GLOBALS['vault'].'plugins/notifications/template.'.$GLOBALS['MusselConfig']['general']['lang'].'.eml'))?'en':$GLOBALS['MusselConfig']['general']['lang'];
35-
$NotifyVars=array();
36-
$NotifyVars['whyflagged']=$GLOBALS['whyflagged'];
37-
$NotifyVars['ipaddr']=$_SERVER[$GLOBALS['MusselConfig']['general']['ipaddr']];
38-
$NotifyVars['time']=date('r');
39-
$content=phpMusselV($NotifyVars,phpMusselFile($GLOBALS['vault'].'plugins/notifications/template.'.$NotifyLang.'.eml',0,true));
40-
mail($GLOBALS['MusselConfig']['notifications']['to_addr'],$GLOBALS['MusselConfig']['lang']['denied'],$content,"MIME-Version: 1.0\nContent-type: text/plain; charset=iso-8859-1\nFrom: ".$GLOBALS['MusselConfig']['notifications']['from_addr'],'-f'.$GLOBALS['MusselConfig']['notifications']['from_addr']);
41-
return true;
42-
}
43-
44-
?>
59+
{
60+
if(!$GLOBALS['MusselConfig']['notifications']['to_addr']||!$GLOBALS['MusselConfig']['notifications']['from_addr']||empty($GLOBALS['whyflagged']))return false;
61+
$NotifyLang=(!file_exists($GLOBALS['vault'].'plugins/notifications/template.'.$GLOBALS['MusselConfig']['general']['lang'].'.eml'))?'en':$GLOBALS['MusselConfig']['general']['lang'];
62+
$NotifyVars=array();
63+
$NotifyVars['whyflagged']=$GLOBALS['whyflagged'];
64+
$NotifyVars['ipaddr']=$_SERVER[$GLOBALS['MusselConfig']['general']['ipaddr']];
65+
$NotifyVars['time']=date('r');
66+
$content=phpMusselV($NotifyVars,phpMusselFile($GLOBALS['vault'].'plugins/notifications/template.'.$NotifyLang.'.eml',0,true));
67+
mail($GLOBALS['MusselConfig']['notifications']['to_addr'],$GLOBALS['MusselConfig']['lang']['denied'],$content,"MIME-Version: 1.0\nContent-type: text/plain; charset=iso-8859-1\nFrom: ".$GLOBALS['MusselConfig']['notifications']['from_addr'],'-f'.$GLOBALS['MusselConfig']['notifications']['from_addr']);
68+
return true;
69+
}

0 commit comments

Comments
 (0)