45 lines
1017 B
PHP
45 lines
1017 B
PHP
<?php
|
|
/**
|
|
* @package CleverOgre
|
|
* @subpackage OgreIssuu
|
|
* @version 0.1.0
|
|
* @since 0.1.0
|
|
*/
|
|
|
|
namespace OgreIssuu\Shortcodes;
|
|
|
|
use OgreIssuu\Api;
|
|
|
|
defined('ABSPATH') || exit;
|
|
|
|
class PublicationEmbed extends Shortcode {
|
|
|
|
public function get_default_attributes():array {
|
|
return [
|
|
'slug' => '',
|
|
'responsive' => true,
|
|
'width' => '100%',
|
|
'height' => '100%',
|
|
'hideIssuuLogo' => false,
|
|
'hideShareButton' => false,
|
|
'showOtherPublications' => false,
|
|
'bgColor' => '',
|
|
'fullScreenShareBgColor' => '',
|
|
];
|
|
}
|
|
|
|
public function render(array $atts, string $content):void {
|
|
$slug = $atts['slug'];
|
|
unset($atts['slug']);
|
|
if (empty($slug)) return;
|
|
|
|
$embed = Api::instance()->get_publication_embed($slug, $atts);
|
|
if (is_null($embed) || !property_exists($embed, 'embed')) return;
|
|
|
|
echo $embed->embed;
|
|
}
|
|
|
|
}
|
|
|
|
PublicationEmbed::instance();
|