public function testInstantArticleAlmostEmpty()
 {
     $article = InstantArticle::create()->withCanonicalUrl('')->withHeader(Header::create())->addChild(Paragraph::create()->appendText('Some text to be within a paragraph for testing.'))->addChild(Paragraph::create())->addChild(Paragraph::create()->appendText(" \n \t "))->addChild(Image::create())->addChild(Image::create()->withURL(''))->addChild(SlideShow::create()->addImage(Image::create()->withURL('https://jpeg.org/images/jpegls-home.jpg'))->addImage(Image::create()))->addChild(Ad::create())->addChild(Paragraph::create()->appendText('Other text to be within a second paragraph for testing.'))->addChild(Analytics::create())->withFooter(Footer::create());
     $expected = '<!doctype html>' . '<html>' . '<head>' . '<link rel="canonical" href=""/>' . '<meta charset="utf-8"/>' . '<meta property="op:generator" content="facebook-instant-articles-sdk-php"/>' . '<meta property="op:generator:version" content="' . InstantArticle::CURRENT_VERSION . '"/>' . '<meta property="op:markup_version" content="v1.0"/>' . '</head>' . '<body>' . '<article>' . '<p>Some text to be within a paragraph for testing.</p>' . '<figure class="op-slideshow">' . '<figure>' . '<img src="https://jpeg.org/images/jpegls-home.jpg"/>' . '</figure>' . '</figure>' . '<p>Other text to be within a second paragraph for testing.</p>' . '</article>' . '</body>' . '</html>';
     $result = $article->render();
     $this->assertEquals($expected, $result);
 }
 public function testHeaderWithSlideshow()
 {
     $header = Header::create()->withTitle(H1::create()->appendText('Big Top Title ')->appendText(Bold::create()->appendText('in Bold')))->withSubTitle(H2::create()->appendText('Smaller SubTitle ')->appendText(Bold::create()->appendText('in Bold')))->withKicker(H3::create()->appendText('Kicker ')->appendText(Bold::create()->appendText('in Bold')))->withCover(SlideShow::create()->addImage(Image::create()->withURL('https://jpeg.org/images/jpegls-home.jpg'))->addImage(Image::create()->withURL('https://jpeg.org/images/jpegls-home2.jpg'))->addImage(Image::create()->withURL('https://jpeg.org/images/jpegls-home3.jpg')));
     $expected = '<header>' . '<figure class="op-slideshow">' . '<figure>' . '<img src="https://jpeg.org/images/jpegls-home.jpg"/>' . '</figure>' . '<figure>' . '<img src="https://jpeg.org/images/jpegls-home2.jpg"/>' . '</figure>' . '<figure>' . '<img src="https://jpeg.org/images/jpegls-home3.jpg"/>' . '</figure>' . '</figure>' . '<h1>Big Top Title <b>in Bold</b></h1>' . '<h2>Smaller SubTitle <b>in Bold</b></h2>' . '<h3 class="op-kicker">Kicker <b>in Bold</b></h3>' . '</header>';
     $rendered = $header->render();
     $this->assertEquals($expected, $rendered);
 }
 /**
  * Add data to DB scheme
  * @return null;
  */
 public function run()
 {
     SlideShow::truncate();
     $pos = 1;
     Slideshow::create(['title' => 'is the answer', 'description' => 'alle esigenze amministrative di tutte le Aziende, piccole e medie imprese, professionisti ed associazioni.', 'position' => $pos++, 'published' => true]);
     Slideshow::create(['title' => 'offers', 'description' => "consulenze di alto livello alle imprese, accompagnando passo dopo passo i propri assistiti negli ormai complessi meandri fiscali. Il servizio di elaborazione elettronica dei dati contabili permette di soddisfare tutti gli adempimenti previsti dalle norme vigenti.", 'position' => $pos++, 'published' => true]);
     Slideshow::create(['title' => "svolge", 'description' => "l'attività di elaborazione dati contabili e fiscali con particolare meticolosità e puntualità con i dati ed i documenti forniti dal Cliente.", 'position' => $pos++, 'published' => true]);
 }
 public function testRenderWithAudio()
 {
     $audio = Audio::create()->withURL('http://foo.com/mp3')->withTitle('audio title')->enableMuted()->enableAutoplay();
     $expected_audio = '<audio title="audio title" autoplay="autoplay" muted="muted">' . '<source src="http://foo.com/mp3"/>' . '</audio>';
     $slideshow = SlideShow::create()->addImage(Image::create()->withURL('https://jpeg.org/images/jpegls-home.jpg'))->addImage(Image::create()->withURL('https://jpeg.org/images/jpegls-home2.jpg'))->addImage(Image::create()->withURL('https://jpeg.org/images/jpegls-home3.jpg'))->withAudio($audio);
     $expected = '<figure class="op-slideshow">' . '<figure>' . '<img src="https://jpeg.org/images/jpegls-home.jpg"/>' . '</figure>' . '<figure>' . '<img src="https://jpeg.org/images/jpegls-home2.jpg"/>' . '</figure>' . '<figure>' . '<img src="https://jpeg.org/images/jpegls-home3.jpg"/>' . '</figure>' . $expected_audio . '</figure>';
     $rendered = $slideshow->render();
     $this->assertEquals($expected, $rendered);
 }
Beispiel #5
0
<?php

//require_once("vendor/autoload.php");
require_once 'SlideShow.class.php';
$ss = new SlideShow('loc', './images', false);
//'url', 'http://www.granbyrotary.org/images')
$names = $ss->getImageNames();
//$names = explode(',', $imageNames);
echo <<<EOF
<!DOCTYPE html>
<html lang="en">
<head>
  <title>Photo Slide Show Demo</title>
  <!-- jQuery -->
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
  <script>
// Initialize the SlideShow object. See SlideShow.js for
// information on initialization process.

jQuery(document).ready(function(\$) {
  var names = [{$names}];

  function next(i) {
    console.log(i);
//    \$("#slideshow").html("<img src='"+names[i]+"'>");
    \$("#slideshow").html("<img src='SlideShow.class.php?mode=proxy&path="+names[i]+"'>");
    if(++i >= names.length) {
      i = 0;
    }
    setTimeout(function() {
      next(i);