Пример #1
0
    /**
     * iCal event test
     */
    public function testIcal()
    {
        //Standalone ICS tests
        require_once '../extras/EasyPeasyICS.php';
        $ICS = new EasyPeasyICS("PHPMailer test calendar");
        $this->assertNotEmpty(
            $ICS->addEvent(
                strtotime('tomorrow 10:00 Europe/Paris'),
                strtotime('tomorrow 11:00 Europe/Paris'),
                'PHPMailer iCal test',
                'A test of PHPMailer iCal support',
                'https://github.com/PHPMailer/PHPMailer'
            ),
            'Generated event string is empty'
        );
        $ICS->addEvent(
            strtotime('tomorrow 10:00 Europe/Paris'),
            strtotime('tomorrow 11:00 Europe/Paris'),
            'PHPMailer iCal test',
            'A test of PHPMailer iCal support',
            'https://github.com/PHPMailer/PHPMailer'
        );
        $events = $ICS->getEvents();
        $this->assertEquals(2, count($events), 'Event count mismatch');
        $ICS->clearEvents();
        $events = $ICS->getEvents();
        $this->assertEquals(0, count($events), 'Event clearing failed');
        $ICS->setName('test');
        $this->assertEquals('test', $ICS->getName(), 'Setting ICS name failed');
        $this->assertNotEmpty($ICS->render(false), 'Empty calendar');
        //Need to test generated output but PHPUnit isn't playing nice
        //$rendered = $ICS->render();

        //Now test sending an ICS
        $this->Mail->Body = 'This is the <strong>HTML</strong> part of the email.';
        $this->Mail->AltBody = 'This is the text part of the email.';
        $this->Mail->Subject .= ': iCal';
        $this->Mail->isHTML(true);
        $this->buildBody();
        $ICS = new EasyPeasyICS("PHPMailer test calendar");
        $ICS->addEvent(
            strtotime('tomorrow 10:00 Europe/Paris'),
            strtotime('tomorrow 11:00 Europe/Paris'),
            'PHPMailer iCal test',
            'A test of PHPMailer iCal support',
            'https://github.com/PHPMailer/PHPMailer'
        );
        $this->Mail->Ical = $ICS->render(false);
        $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
        $this->Mail->Body = 'Embedded Image: <img alt="phpmailer" src="cid:my-attach">' .
            'Here is an image!</a>.';
        $this->Mail->AltBody = 'This is the text part of the email.';
        $this->Mail->Subject .= ': iCal + inline';
        $this->Mail->isHTML(true);
        $this->Mail->addEmbeddedImage(
            '../examples/images/phpmailer.png',
            'my-attach',
            'phpmailer.png',
            'base64',
            'image/png'
        );
        $this->buildBody();
        $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
    }
 /**
  * iCal event test
  */
 public function testIcal()
 {
     $this->Mail->Body = 'This is the <strong>HTML</strong> part of the email.';
     $this->Mail->AltBody = 'This is the text part of the email.';
     $this->Mail->Subject .= ': iCal';
     $this->Mail->isHTML(true);
     $this->buildBody();
     require_once '../extras/EasyPeasyICS.php';
     $ICS = new EasyPeasyICS("PHPMailer test calendar");
     $ICS->addEvent(strtotime('tomorrow 10:00 Europe/Paris'), strtotime('tomorrow 11:00 Europe/Paris'), 'PHPMailer iCal test', 'A test of PHPMailer iCal support', 'https://github.com/PHPMailer/PHPMailer');
     $this->Mail->Ical = $ICS->render(false);
     $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
     $this->Mail->Body = 'Embedded Image: <img alt="phpmailer" src="cid:my-attach">' . 'Here is an image!</a>.';
     $this->Mail->AltBody = 'This is the text part of the email.';
     $this->Mail->Subject .= ': iCal + inline';
     $this->Mail->isHTML(true);
     $this->Mail->addEmbeddedImage('../examples/images//phpmailer.png', 'my-attach', 'phpmailer.png', 'base64', 'image/png');
     $this->buildBody();
     $this->assertTrue($this->Mail->send(), $this->Mail->ErrorInfo);
 }
Пример #3
0
 function ical()
 {
     $this->epl->load_file('libraries/EasyPeasyICS.php');
     $ICS = new EasyPeasyICS(get_bloginfo());
     $ical_token = epl_get_element('ical_token', $_GET, false) == md5(NONCE_KEY);
     //$d = $this->epl->epl_util->get_days_for_fc( array('event_id' => 10157,'raw' => 1, 'show_att_counts' => $ical_token ) );
     $d = $this->epl->epl_util->get_days_for_fc(array('raw' => 1, 'show_att_counts' => $ical_token, 'show_past' => epl_get_element('show_past', $_GET, 0), 'taxonomy' => epl_get_element('taxonomy', $_GET, ''), 'taxonomy_exclude' => epl_get_element('taxonomy_exclude', $_GET, ''), 'event_id' => epl_get_element('event_id', $_GET, '')));
     foreach ($d as $k => $v) {
         $ICS->addEvent(strtotime($v['start']), strtotime($v['end']), $v['raw_title'] . ' ' . $v['att_counts'], '', $v['edit_url']);
     }
     $ICS->render();
     exit;
 }