Exemple #1
0
    echo htmlspecialchars($url);
    ?>
</a></legend><?php 
    if (version_compare(PHP_VERSION, '5.4', '<')) {
        ?>
<p class="hint">Unfortunately JSON pretty-printing is only available with PHP 5.4+.</p><?php 
    }
    // Include the Composer autoloader
    if (@is_file(dirname(__DIR__) . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php')) {
        require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php';
        // Exit on failure
    } else {
        die('<p style="font-weight:bold;color:red">Please follow the <a href="https://github.com/jkphl/micrometa#dependencies" target="_blank">instructions</a> to install the additional libraries that micrometa is depending on</p>');
    }
    require_once dirname(__DIR__) . DIRECTORY_SEPARATOR . 'src' . DIRECTORY_SEPARATOR . 'Jkphl' . DIRECTORY_SEPARATOR . 'Micrometa.php';
    $micrometa = \Jkphl\Micrometa::instance(trim($url));
    if ($data == 'author') {
        $micrometa = $micrometa->author();
    }
    if (!$micrometa) {
        ?>
The requested micro information could not be found embedded into this document.<?php 
    } elseif ($format == 'json') {
        ?>
<pre><?php 
        echo htmlspecialchars($micrometa->toJSON(true));
        ?>
</pre><?php 
    } else {
        echo tree($micrometa->toObject());
    }
Exemple #2
0
 /**
  * Test a document with an h-entry + h-card with u-url == rel-author
  *
  * @return void
  * @see http://indiewebcamp.com/authorship			Case 3.1
  */
 public function testRelAuthorHcardUrl()
 {
     $micrometa = \Jkphl\Micrometa::instance($this->_urlPrefix . 'h-entry_with_rel-author_and_h-card_with_u-url_pointing_to_rel-author_href.html');
     $author = $micrometa->author();
     $this->assertInstanceOf('\\Jkphl\\Micrometa\\Parser\\Microformats2\\Item', $author);
     $this->assertJsonStringEqualsJsonString($author->toJSON(), '{"id":null,"types":["h-card"],"value":null,"properties":{"name":["John Doe"],"url":["https:\\/\\/raw.githubusercontent.com\\/sandeepshetty\\/authorship-test-cases\\/master\\/no_h-card.html"],"photo":["http:\\/\\/www.gravatar.com\\/avatar\\/fd876f8cd6a58277fc664d47ea10ad19.jpg?s=80&d=mm"]},"children":[]}');
 }