-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Create configuration for OpenGraph. Updated README
- Loading branch information
Showing
17 changed files
with
162 additions
and
152 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
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,29 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace umanskyi31\opengraph; | ||
|
||
/** | ||
* This is an implementation of configuration for open graph | ||
* With this configuration you can override exists tags and set own implmentation | ||
* | ||
* @author Vladyslav Umanskyi <[email protected]> | ||
* @version 2.0.1 | ||
*/ | ||
interface Configuration | ||
{ | ||
const VERSION = '2.0.1'; | ||
|
||
/** | ||
* Consist all available tags | ||
* | ||
* @return array | ||
*/ | ||
public function tags(): array; | ||
|
||
/** | ||
* @param array $data | ||
* @return string|array|void | ||
*/ | ||
public function render(array $data); | ||
} |
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,47 @@ | ||
<?php | ||
declare(strict_types=1); | ||
|
||
namespace umanskyi31\opengraph; | ||
|
||
|
||
use umanskyi31\opengraph\Tags\Article; | ||
use umanskyi31\opengraph\Tags\Audio; | ||
use umanskyi31\opengraph\Tags\Basic; | ||
use umanskyi31\opengraph\Tags\Book; | ||
use umanskyi31\opengraph\Tags\Image; | ||
use umanskyi31\opengraph\Tags\Music; | ||
use umanskyi31\opengraph\Tags\Profile; | ||
use umanskyi31\opengraph\Tags\TwitterCard; | ||
use umanskyi31\opengraph\Tags\Video; | ||
use Yii; | ||
|
||
class OpenGraphConfiguration implements Configuration | ||
{ | ||
/** | ||
* @return array | ||
*/ | ||
public function tags(): array | ||
{ | ||
return [ | ||
'getBasic' => new Basic($this), | ||
'getImage' => new Image($this), | ||
'getMusic' => new Music($this), | ||
'getVideo' => new Video($this), | ||
'getAudio' => new Audio($this), | ||
'getArticle' => new Article($this), | ||
'getBook' => new Book($this), | ||
'getProfile' => new Profile($this), | ||
'useTwitterCard' => new TwitterCard($this), | ||
]; | ||
} | ||
|
||
/** | ||
* @codeCoverageIgnore | ||
* @param array $data | ||
* @return array|string|void | ||
*/ | ||
public function render(array $data) | ||
{ | ||
Yii::$app->view->registerMetaTag($data); | ||
} | ||
} |
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
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
Oops, something went wrong.