public function init()
{
parent::init();
$this->setConfig('github');
$this->settings['type'] = $this->type;
if (empty($this->settings['repo'])) {
throw new InvalidConfigException("The GitHub 'repository' has not been set.");
}
if (empty($this->settings['user'])) {
throw new InvalidConfigException("The GitHub 'user' must be set.");
}
if (empty($this->settings['type'])) {
throw new InvalidConfigException("The GitHub button 'type' has not been set.");
}
if (!isset($this->noscript)) {
$this->noscript = Yii::t('kvsocial', 'Please enable JavaScript on your browser to view the Facebook {pluginName} plugin correctly on this site.', ['pluginName' => Yii::t('kvsocial', str_replace('fb-', '', $this->type))]);
}
if (!empty($this->settings['count']) && ($this->settings['count'] || $this->settings['count'] == 'true')) {
$this->settings['count'] = 'true';
} else {
unset($this->settings['count']);
}
$this->settings['v'] = 2;
$large = !empty($this->settings['size']) && $this->settings['size'] == 'large';
$defaultOptions = ['allowtransparency' => "true", 'frameborder' => 0, 'scrolling' => 0] + ($large ? ['width' => 170, 'height' => 30] : ['width' => 110, 'height' => 20]);
$this->options = array_replace($defaultOptions, $this->options);
$this->options['src'] = ltrim(Url::to([self::API] + $this->settings), Url::to(['/']));
echo Html::tag('iframe', '', $this->options);
}