Skip to content

Commit 916a56c

Browse files
committed
Bugs fixed
1 parent 68a2819 commit 916a56c

File tree

6 files changed

+15
-27
lines changed

6 files changed

+15
-27
lines changed

Embed/Adapters/Adapter.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
abstract class Adapter
1313
{
14+
protected $request;
15+
1416
public $providers = array();
1517
public $options = array(
1618
'minImageWidth' => 0,

Embed/Adapters/Soundcloud.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ protected function initProviders(Request $request)
2626

2727
$api = new Request('http://api.soundcloud.com/resolve.json');
2828
$api->setParameter('client_id', isset($this->options['soundcloudClientId']) ? $this->options['soundcloudClientId'] : 'YOUR_CLIENT_ID');
29-
$api->setParameter('url', $Url->getUrl());
29+
$api->setParameter('url', $request->getUrl());
3030

3131
if ($json = $api->getJsonContent()) {
3232
$this->api->set($json);

Embed/Request.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function setUrl($url)
4545
if ($url instanceof RequestResolvers\RequestResolverInterface) {
4646
$this->resolver = $url;
4747
} else {
48-
$this->resolver = new static::$defaultResolver($url);
48+
$this->resolver = new self::$defaultResolver($url);
4949
}
5050

5151
$this->parseUrl($this->resolver->getLatestUrl());

Embed/Sources/Feed.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ protected static function getRssItems(\SimpleXMLElement $items)
7474
{
7575
$rssItems = array();
7676

77-
$namespaces = $Items->getNamespaces(true);
77+
$namespaces = $items->getNamespaces(true);
7878

7979
foreach ($items as $item) {
8080
$rssItem = array(
@@ -100,7 +100,7 @@ protected static function getRssItems(\SimpleXMLElement $items)
100100
}
101101
}
102102

103-
return $rssItem;
103+
return $rssItems;
104104
}
105105

106106
protected static function parseAtom(\SimpleXMLElement $xml)

test-sources.php

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -53,25 +53,23 @@
5353
if (!empty($_GET['url'])): ?>
5454
<section>
5555
<?php
56-
57-
$Url = new Embed\Url($_GET['url']);
58-
59-
$Source = Embed\Embed::createSource($Url);
56+
$request = new Embed\Request($_GET['url']);
57+
$source = Embed\Embed::createSource($request);
6058
?>
6159

62-
<?php if (empty($Source)): ?>
60+
<?php if (empty($source)): ?>
6361

6462
<p>The url is not valid!</p>
6563

6664
<?php else: ?>
6765

68-
<h1><a href="<?php echo $Source->providerUrl; ?>"><?php echo $Source->providerUrl; ?></a></h1>
66+
<h1><a href="<?php echo $source->providerUrl; ?>"><?php echo $source->providerUrl; ?></a></h1>
6967

70-
<a href="test.php?url=<?php echo $Source->providerUrl; ?>" target="_blank">Test</a><br>
71-
<a href="<?php echo $Source->sourceUrl; ?>" target="_blank">Source url</a>
68+
<a href="test.php?url=<?php echo $source->providerUrl; ?>" target="_blank">Test</a><br>
69+
<a href="<?php echo $source->sourceUrl; ?>" target="_blank">Source url</a>
7270

7371
<ul>
74-
<?php foreach ($Source->items as $url): ?>
72+
<?php foreach ($source->items as $url): ?>
7573
<li>
7674
<a href="<?php echo $url['url']; ?>"><?php echo $url['url']; ?></a> | <a href="test.php?url=<?php echo urlencode($url['url']); ?>" target="_blank">Test</a><br>
7775
<?php if ($url['originUrl']): ?>
@@ -89,22 +87,10 @@
8987
<tr>
9088
<th>Content</th>
9189
<td>
92-
<pre><?php echo htmlspecialchars($Url->getContent(), ENT_IGNORE); ?></pre>
90+
<pre><?php echo htmlspecialchars($url->getContent(), ENT_IGNORE); ?></pre>
9391
</td>
9492
</tr>
9593
</table>
96-
97-
<?php elseif (!empty($_FILES['opml']['tmp_name'])): ?>
98-
<section>
99-
<?php
100-
$string = file_get_contents($_FILES['opml']['tmp_name']);
101-
$feeds = Embed\Sources\Feed::createFromOPML($string);
102-
103-
echo '<pre>';
104-
var_dump($feeds);
105-
echo '</pre>';
106-
?>
107-
</section>
10894
<?php endif; ?>
10995

11096
</body>

test.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ function getOption($name, $default = null)
101101
<td>
102102
<ul>
103103
<?php
104-
foreach ($url->getResult() as $name => $value) {
104+
foreach ($url->getRequestInfo() as $name => $value) {
105105
if (is_array($value)) {
106106
$value = print_r($value, true);
107107
}

0 commit comments

Comments
 (0)