<?php
defined('WBCAT') or die('Restricted access');
if($_POST['submit']){
unset($_POST['submit']);
#Для отладки разкомментируйте следующею строку
foreach ($_POST as $key => $value) { echo "Параметр: {$key}; Значение: {$value}<br />\n"; }
try {
$_POST['style']=intval($_POST['style']);
if($Widget->set_widget_settings("socialbookmarks",$_POST)){ echo '<div class="ok">Настройки сохранены!</div>';}
} catch (Exception $error) { echo "<div class=\"error\">{$error->getMessage()}</div>";}
}
$Wset=$Widget->get_widget_settings('socialbookmarks');
$code='<script type="text/javascript" src="//yandex.st/share/share.js"
charset="utf-8"></script>
<div class="yashare-auto-init" data-yashareL10n="ru"
data-yashareType="button" data-yashareQuickServices="yaru,vkontakte,facebook,twitter,odnoklassniki,moimir,lj,friendfeed,moikrug,gplus,surfingbird"
></div> ';
$code1='<script type="text/javascript" src="//yandex.st/share/share.js"
charset="utf-8"></script>
<div class="yashare-auto-init" data-yashareL10n="ru"
data-yashareType="link" data-yashareQuickServices="yaru,vkontakte,facebook,twitter,odnoklassniki,moimir,lj,friendfeed,moikrug,gplus,surfingbird"
></div> ';
$code2='<script type="text/javascript" src="//yandex.st/share/share.js"
charset="utf-8"></script>
<div class="yashare-auto-init" data-yashareL10n="ru"
data-yashareType="icon" data-yashareQuickServices="yaru,vkontakte,facebook,twitter,odnoklassniki,moimir,lj,friendfeed,moikrug,gplus,surfingbird"
></div> ';
$code3='<script type="text/javascript" src="//yandex.st/share/share.js"
charset="utf-8"></script>
<div class="yashare-auto-init" data-yashareL10n="ru"
data-yashareType="none" data-yashareQuickServices="yaru,vkontakte,facebook,twitter,odnoklassniki,moimir,lj,friendfeed,moikrug,gplus,surfingbird"
></div> ';
$Wset['style']=intval($Wset['style']);
$print_code='
<div style="background: #F6F6F6; border: 1px solid #D8D8D8;">
<input type="radio" value="0" name="style" ' . ($Wset['style'] == 0 ? 'checked="checked"' : '') . ' />кнопка: '.$code.'</div>
<div style="background: #E1DCDC; border: 1px solid #D4CCCC;">
<input type="radio" value="1" name="style" ' . ($Wset['style'] == 1 ? 'checked="checked"' : '') . '/>ссылка:'.$code1.'</div>
<div style="background: #F6F6F6; border: 1px solid #D8D8D8;">
<input type="radio" value="2" name="style" ' . ($Wset['style'] == 2 ? 'checked="checked"' : '') . ' />иконки и меню: '.$code2.'</div>
<div style="background: #E1DCDC; border: 1px solid #D4CCCC;">
<input type="radio" value="3" name="style" ' . ($Wset['style'] == 3 ? 'checked="checked"' : '') . '/>только иконки:'.$code3.'</div>
';
echo <<<html
<h2>Настройка виджета socialbookmarks</h2>
<form action="" method="post">
<b>Выберите внешний вид виджета</b><br/>
{$print_code}
<input type="submit" name="submit" value="Сохранить" />
</form>
html;
?>