public function init()
{
$this->validPlugins = false;
parent::init();
$config = $this->setConfig('disqus');
if ($this->credits === null) {
$this->credits = Html::a(Yii::t('kvsocial', 'comments powered by Disqus'), 'http://disqus.com/?ref_noscript');
}
$this->noscript = Yii::t('kvsocial', 'Please enable JavaScript to view the {pluginLink}.', ['pluginLink' => $this->credits]);
if (empty($this->settings['shortname'])) {
throw new InvalidConfigException("Disqus 'shortname' has not been set in settings.");
}
$variables = "";
foreach ($this->settings as $key => $value) {
$variables .= $key == 'disable_mobile' ? "var disqus_{$key} = {$value};\n" : "var disqus_{$key} = '{$value}';\n";
}
$params = ['variables' => $variables, 'credits' => $this->showCredits ? $this->credits : '', 'noscript' => $this->renderNoScript()];
$view = $this->showCount ? 'disqus-count' : 'disqus-comments';
echo $this->render($view, $params);
}