Skip to content

Commit 0b2425a

Browse files
committed
Merge pull request #47 from oscarotero/revert-45-master
Revert "Added attribute publishedTime to the response"
2 parents 762ac5f + e109d4d commit 0b2425a

File tree

9 files changed

+2
-123
lines changed

9 files changed

+2
-123
lines changed

README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,6 @@ $info->providerName; //The provider name of the page (youtube, twitter, instagra
5151
$info->providerUrl; //The provider url
5252
$info->providerIcons; //All provider icons found in the page
5353
$info->providerIcon; //The icon choosen as main icon
54-
55-
$info->publishedTime; //The publication date of the article, if present
5654
```
5755

5856
Available options

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"name": "thenextweb/embed",
2+
"name": "embed/embed",
33
"type": "library",
44
"description": "PHP library to retrieve page info using oembed, opengraph, etc",
55
"keywords": ["oembed", "opengraph", "twitter cards", "embed", "embedly"],

src/Adapters/Adapter.php

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -364,12 +364,4 @@ public function getHeight()
364364
{
365365
return $this->getFromProviders('height');
366366
}
367-
368-
/**
369-
* {@inheritDoc}
370-
*/
371-
public function getPublishedTime()
372-
{
373-
return $this->getFromProviders('publishedTime');
374-
}
375367
}

src/Adapters/AdapterInterface.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -163,11 +163,4 @@ public function getHeight();
163163
* @return float|null
164164
*/
165165
public function getAspectRatio();
166-
167-
/**
168-
* Gets the published time, if the webpage is an article
169-
*
170-
* @return string|null
171-
*/
172-
public function getPublishedTime ();
173166
}

src/Adapters/Webpage.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ protected function initProviders(Request $request)
2828
'Html' => new Providers\Html($request),
2929
'TwitterCards' => new Providers\TwitterCards($request),
3030
'OpenGraph' => new Providers\OpenGraph($request),
31-
'Sailthru' => new Providers\Sailthru($request),
3231
);
3332

3433
if ($this->options['facebookProvider']) {

src/Providers/Html.php

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -91,11 +91,6 @@ public function __construct(Request $request)
9191
$icons[] = $meta->getAttribute('content');
9292
continue 2;
9393

94-
case 'pub_date':
95-
case 'date':
96-
$this->set('datepublished', $meta->getAttribute('content'));
97-
continue 2;
98-
9994
default:
10095
if ($meta->hasAttribute('content')) {
10196
$this->set($name, $meta->getAttribute('content'));
@@ -104,27 +99,12 @@ public function __construct(Request $request)
10499
}
105100
}
106101

107-
if ($meta->hasAttribute('itemprop')) {
108-
$name = strtolower($meta->getAttribute('itemprop'));
109-
$this->set($name, $meta->getAttribute('content'));
110-
}
111-
112102
if ($meta->hasAttribute('http-equiv') && $meta->hasAttribute('content')) {
113103
$name = strtolower($meta->getAttribute('http-equiv'));
114104
$this->set($name, $meta->getAttribute('content'));
115105
}
116106
}
117107

118-
//Time
119-
foreach($html->getElementsByTagName('time') as $time) {
120-
if ($time->hasAttribute('itemprop')) {
121-
$name = strtolower($time->getAttribute('itemprop'));
122-
$this->set($name, $time->getAttribute('datetime'));
123-
} else if ($time->hasAttribute('datetime')) {
124-
$this->set('datepublished', $time->getAttribute('datetime'));
125-
}
126-
}
127-
128108
//Search the main element:
129109
$content = $html->getElementsByTagName('main'); //<main> element
130110

@@ -300,14 +280,4 @@ public function getHeight()
300280
{
301281
return $this->get('video_height');
302282
}
303-
304-
/**
305-
* Gets the article publication date
306-
*
307-
* @return string|null
308-
*/
309-
public function getPublishedTime()
310-
{
311-
return $this->get('datepublished');
312-
}
313283
}

src/Providers/OpenGraph.php

Lines changed: 1 addition & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,9 @@ public function __construct(Request $request)
2525

2626
foreach ($html->getElementsByTagName('meta') as $meta) {
2727
if (strpos($meta->getAttribute('property'), 'og:') === 0) {
28-
if (strpos($meta->getAttribute('property'), 'og:article:') === 0) {
29-
$name = substr($meta->getAttribute('property'), 11);
30-
} else {
31-
$name = substr($meta->getAttribute('property'), 3);
32-
}
28+
$name = substr($meta->getAttribute('property'), 3);
3329
} elseif (strpos($meta->getAttribute('name'), 'og:') === 0) {
3430
$name = substr($meta->getAttribute('name'), 3);
35-
} elseif (strpos($meta->getAttribute('property'), 'article:') === 0) {
36-
$name = substr($meta->getAttribute('property'), 8);
3731
} else {
3832
continue;
3933
}
@@ -185,14 +179,4 @@ public function getHeight()
185179
{
186180
return $this->get('image:height') ?: $this->get('video:height');
187181
}
188-
189-
/**
190-
* Gets the article publication date
191-
*
192-
* @return string|null
193-
*/
194-
public function getPublishedTime()
195-
{
196-
return $this->get('published_time');
197-
}
198182
}

src/Providers/Sailthru.php

Lines changed: 0 additions & 39 deletions
This file was deleted.

tests/ArticleTest.php

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)