コード例 #1
0
}
/** Fallback for missing "from_addr" configuration directive. */
if (!isset($phpMussel['Config']['notifications']['from_addr'])) {
    $phpMussel['Config']['notifications']['from_addr'] = '';
}
/**
 * Determine whether to use functions or closures (based upon whether we're
 * pre-v1 or post-v1, which can be determined by the presense of certain
 * functions).
 */
if (function_exists('phpMussel_Register_Hook')) {
    /** Pre-v1 code (considered deprecated and will eventually remove). */
    /**
     * Registers the `phpMussel_Notify()` function to the `before_html_out` hook.
     */
    phpMussel_Register_Hook('phpMussel_Notify', 'before_html_out');
    /**
     * The pre-v1 plugin code.
     *
     * @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).
     * @return bool Returns true if everything is working correctly.
     */
    function phpMussel_Notify($input)
    {
        global $phpMussel;
        if (empty($phpMussel['Config']['notifications']['to_addr']) || empty($phpMussel['Config']['notifications']['from_addr']) || empty($phpMussel['whyflagged'])) {
            return false;
        }
        $NotifyLang = !file_exists($phpMussel['vault'] . 'plugins/notifications/template.' . $phpMussel['Config']['general']['lang'] . '.eml') ? 'en' : $phpMussel['Config']['general']['lang'];
コード例 #2
0
 * "hook". You can register your function to a chosen "hook" by using the
 * `phpMussel_Register_Hook` function, in a similar way to as demonstrated
 * herein.
 *
 * The `phpMussel_Register_Hook()` function accepts three inputs. The first, is
 * a string, representing the name of the chosen function to execute at the
 * desired point in the script; The second, is a string, instructing to the
 * function which "hook" to register your chosen function to; The third is
 * optional, is a string, or an array of strings, representing which variables
 * need to be parsed to your function from the scope in which it'll be executed
 * from (note that you can call anything contained by the $phpMussel or
 * $GLOBALS superglobal by using the "global" statement within your functions
 * and classes, and so, it isn't always necessary to "parse in" variables from
 * the calling scope via this third input).
 */
phpMussel_Register_Hook('phpMussel_HelloWorld', 'before_phpmussel', 'hello');
/**
 * In the example given, we're registering the `phpMussel_HelloWorld()`
 * function to the `before_phpmussel` hook, which means that the
 * `phpMussel_HelloWorld()` function will be executed at the point in the
 * script where the `before_phpmussel` hook exists. The variable, "hello", is
 * parsed from the scope from where that hook exists to the
 * `phpMussel_HelloWorld()` function.
 *
 * Below (after this phpDoc comment), is the aforementioned
 * `phpMussel_HelloWorld()` function, included as a demonstration.
 *
 * Referring to the demonstration, the "input" is always parsed as an numeric
 * array of the variables being parsed to the function. Any non-array data
 * returned will be discarded by the script. Any array data returned will be
 * parsed back to the original scope as variables, where the element keys