Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
composer.lock
vendor/*
.idea/*
10 changes: 0 additions & 10 deletions .travis.yml

This file was deleted.

15 changes: 6 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
MicrodataPHP [![Build Status](https://travis-ci.org/linclark/MicrodataPHP.svg?branch=2.0.x)](https://travis-ci.org/linclark/MicrodataPHP)
ZMicrodataPHP (forked)
============

```
composer require zoonru/z-microdata-php
```

Microdata is a syntax for embedding machine-readable metadata in HTML.

MicrodataPHP is a PHP library for extracting microdata from HTML documents. It
Expand All @@ -11,7 +15,7 @@ Example use:
```
require 'vendor/autoload.php';

use linclark\MicrodataPHP\MicrodataPhp;
use Zoon\ZMicrodataPHP\MicrodataPhp;

$url = 'http://example.com';
$md = new MicrodataPhp($url);
Expand All @@ -23,10 +27,3 @@ print $data->items[0]->properties['name'][0];
// Get a property of a nested item.
print $data->items[0]->properties['hiringOrganization'][0]->properties['name'][0];
```

Requirements
============
- Autoloading (e.g. the autoloader provided by [Composer](https://getcomposer.org/))
- PHP 5.3+

Check out the 1.x branch for older setups.
10 changes: 3 additions & 7 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,10 @@
{
"name": "linclark/microdata-php",
"name": "zoonru/z-microdata-php",
"description": "Extracts microdata from HTML using PHP.",
"autoload": {
"psr-4": {
"linclark\\MicrodataPHP\\": ["src/", "tests/src/"]
"Zoon\\ZMicrodataPHP\\": "src/"
}
},
"license": "MIT",
"minimum-stability": "dev",
"require-dev": {
"phpunit/phpunit": "4.1.x-dev"
}
"license": "MIT"
}
10 changes: 0 additions & 10 deletions phpunit.xml.dist

This file was deleted.

6 changes: 3 additions & 3 deletions src/MicrodataPhp.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
* Copyright (c) 2009-2011 Philip Jägenstedt
*/

namespace linclark\MicrodataPHP;
namespace Zoon\ZMicrodataPHP;

/**
* Extracts microdata from HTML.
Expand Down Expand Up @@ -40,8 +40,8 @@ public function __construct($config) {
}

$dom = new MicrodataPhpDOMDocument();
$dom->registerNodeClass('DOMDocument', 'linclark\MicrodataPHP\MicrodataPhpDOMDocument');
$dom->registerNodeClass('DOMElement', 'linclark\MicrodataPHP\MicrodataPhpDOMElement');
$dom->registerNodeClass('DOMDocument', MicrodataPhpDOMDocument::class);
$dom->registerNodeClass('DOMElement', MicrodataPhpDOMElement::class);
$dom->preserveWhiteSpace = false;

// Prepare the DOM using either the URL or HTML string.
Expand Down
2 changes: 1 addition & 1 deletion src/MicrodataPhpDOMDocument.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace linclark\MicrodataPHP;
namespace Zoon\ZMicrodataPHP;

/**
* Extend the DOMDocument class with the Microdata API functions.
Expand Down
8 changes: 6 additions & 2 deletions src/MicrodataPhpDOMElement.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace linclark\MicrodataPHP;
namespace Zoon\ZMicrodataPHP;

/**
* Extend the DOMElement class with the Microdata API functions.
Expand Down Expand Up @@ -148,7 +148,11 @@ public function itemValue() {
if ($this->getAttribute('content')) {
return $this->getAttribute('content');
} else {
return $this->textContent;
$text = '';
foreach ($this->childNodes as $node) {
$text .= $node->textContent . ' ';
}
return trim($text);
}
}
}
Expand Down
10 changes: 0 additions & 10 deletions tests/data/itemtype.html

This file was deleted.

21 changes: 0 additions & 21 deletions tests/data/nested_item.html

This file was deleted.

32 changes: 0 additions & 32 deletions tests/data/person.html

This file was deleted.

48 changes: 0 additions & 48 deletions tests/data/recipe.html

This file was deleted.

59 changes: 0 additions & 59 deletions tests/data/recipeItempropContent.html

This file was deleted.

83 changes: 0 additions & 83 deletions tests/src/MicrodataPhpTest.php

This file was deleted.