File tree Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Expand file tree Collapse file tree 1 file changed +12
-8
lines changed Original file line number Diff line number Diff line change 5
5
namespace Embed \Adapters ;
6
6
7
7
use Embed \Request ;
8
+ use Embed \Providers \Provider ;
8
9
9
10
class Github extends Webpage implements AdapterInterface
10
11
{
@@ -22,24 +23,27 @@ public static function check(Request $request)
22
23
/**
23
24
* {@inheritDoc}
24
25
*/
25
- public function getCode ( )
26
+ protected function initProviders ( Request $ request )
26
27
{
27
- $ url = $ this -> getUrl ( );
28
+ parent :: initProviders ( $ request );
28
29
29
- if (substr ($ url , -1 ) === '/ ' ) {
30
- $ url = substr ($ url , 0 , -1 );
31
- }
30
+ $ this ->api = new Provider ();
31
+ $ api = new Request ($ request ->getUrl ().'.json ' );
32
32
33
- return '<script src=" ' .$ url .'.js"></script> ' ;
33
+ if (($ json = $ api ->getJsonContent ())) {
34
+ $ this ->api ->set ($ json );
35
+ }
34
36
}
35
37
36
38
37
39
/**
38
40
* {@inheritDoc}
39
41
*/
40
- public function getUrl ()
42
+ public function getCode ()
41
43
{
42
- return $ this ->request ->getUrl ();
44
+ if (($ code = $ this ->api ->get ('div ' )) && ($ stylesheet = $ this ->api ->get ('stylesheet ' ))) {
45
+ return '<link href=" ' .$ stylesheet .'" rel="stylesheet"> ' .$ code ;
46
+ }
43
47
}
44
48
45
49
You can’t perform that action at this time.
0 commit comments