-
-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
111 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
# [Trackspace](https://trackspace.upitup.com) | ||
|
||
Trackspace Provider | ||
|
||
## Implementation Details | ||
|
||
- Provider | ||
Name: Trackspace | ||
- Documentation: NONE | ||
- HTTPS support: YES | ||
- Fake Response: NO | ||
- Oembed Params: maxwidth , maxheight | ||
- Supported Hosts: trackspace.upitup.com | ||
- Responsive response: YES | ||
- Collections: DefaultProviderCollection | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
<?php | ||
/** | ||
* Trackspace.php | ||
* | ||
* @package Embera | ||
* @author Michael Pratt <yo@michael-pratt.com> | ||
* @link http://www.michael-pratt.com/ | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Embera\Provider; | ||
|
||
use Embera\Url; | ||
|
||
/** | ||
* Trackspace Provider | ||
* | ||
* @link https://trackspace.upitup.com | ||
*/ | ||
class Trackspace extends ProviderAdapter implements ProviderInterface | ||
{ | ||
/** inline {@inheritdoc} */ | ||
protected $endpoint = 'https://trackspace.upitup.com/oembed?format=json'; | ||
|
||
/** inline {@inheritdoc} */ | ||
protected static $hosts = [ | ||
'trackspace.upitup.com' | ||
]; | ||
|
||
/** inline {@inheritdoc} */ | ||
protected $allowedParams = [ 'maxwidth', 'maxheight' ]; | ||
|
||
/** inline {@inheritdoc} */ | ||
protected $httpsSupport = true; | ||
|
||
/** inline {@inheritdoc} */ | ||
protected $responsiveSupport = true; | ||
|
||
/** inline {@inheritdoc} */ | ||
public function validateUrl(Url $url) | ||
{ | ||
return (bool) (preg_match('~trackspace\.upitup\.com/(user|track)/([^/]+)~i', (string) $url)); | ||
} | ||
|
||
/** inline {@inheritdoc} */ | ||
public function normalizeUrl(Url $url) | ||
{ | ||
$url->convertToHttps(); | ||
$url->removeQueryString(); | ||
$url->removeLastSlash(); | ||
|
||
return $url; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<?php | ||
/** | ||
* TrackspaceTest.php | ||
* | ||
* @package Embera | ||
* @author Michael Pratt <yo@michael-pratt.com> | ||
* @link http://www.michael-pratt.com/ | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Embera\Provider; | ||
|
||
use Embera\ProviderTester; | ||
|
||
/** | ||
* Test the Trackspace Provider | ||
*/ | ||
final class TrackspaceTest extends ProviderTester | ||
{ | ||
protected $tasks = [ | ||
'valid_urls' => [ | ||
'https://trackspace.upitup.com/track/17', | ||
'https://trackspace.upitup.com/user/test-user-mrxme', | ||
], | ||
'invalid_urls' => [ | ||
'https://trackspace.upitup.com', | ||
], | ||
]; | ||
|
||
public function testProvider() | ||
{ | ||
$this->validateProvider('Trackspace', [ 'width' => 480, 'height' => 270]); | ||
} | ||
} |