示例#1
0
    /**
     * Test filter method.
     */
    public function testFilter()
    {
        require_once IBEDUCATOR_PLUGIN_DIR . '/includes/ib-educator-email.php';
        $ibe_email = new IB_Educator_Email();
        $str1 = "\na\rb%0Ac\r\n%0D<CR><LF>";
        $str2 = <<<EOT
de

f

EOT;
        $this->assertEquals('abc', $ibe_email->filter($str1));
        $this->assertEquals('def', $ibe_email->filter($str2));
    }
示例#2
0
/**
 * Send email notification.
 *
 * @param string $to
 * @param string $template
 * @param array $subject_vars
 * @param array $template_vars
 */
function ib_edu_send_notification($to, $template, $subject_vars, $template_vars)
{
    require_once IBEDUCATOR_PLUGIN_DIR . '/includes/ib-educator-email.php';
    // Set default template vars.
    $template_vars['login_link'] = apply_filters('ib_educator_login_url', wp_login_url());
    // Send email.
    $email = new IB_Educator_Email();
    $email->set_template($template);
    $email->parse_subject($subject_vars);
    $email->parse_template($template_vars);
    $email->add_recipient($to);
    $email->send();
}