/* Сайдбары
----------------------------------------------- */
/* -----------| Регистрируем сайдбары для виджетов |----------- */
/* - Главная – Левая колонка - */
if ( function_exists('register_sidebar') )
{
/* - Фото сайдбар - */
register_sidebar
(
array
(
'name' => 'Foto sidebar',
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => ''
)
);
/* - Сайдбар для всякой фигни - */
register_sidebar
(
array
(
'name' => 'Tools sidebar',
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => ''
)
);
/* - Центральный сайдбар для всякой фигни - */
register_sidebar
(
array
(
'name' => 'Center sidebar',
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => ''
)
);
}
/* Виджеты
----------------------------------------------- */
/* -----------| Виджет вывода портрета |----------- */
/* - Регистрируем виджет и опции - */
register_sidebar_widget('Academic – Портрет', 'widget_academic_portrait');
register_widget_control('Academic – Портрет', 'widget_academic_portrait_options');
/* - Описываем виджет - */
function widget_academic_portrait()
{
$options = get_option('widget_academic_portrait');
$name = $options['name'] ? $options['name'] : 'sidebar';
echo "
";
}
/* - Описываем опции виджета - */
function widget_academic_portrait_options()
{
$options = $newoptions = get_option('widget_academic_portrait');
if ( $_POST['widget_academic_portrait_submit'] )
{
$newoptions['name'] = stripslashes($_POST['widget_academic_portrait_name']);
}
if ( $options != $newoptions )
{
$options = $newoptions;
update_option('widget_academic_portrait', $options);
}
$name = attribute_escape($options['name']);
echo <<
Лучше всего будет подогнать картнку под 280 на 300 пикселов...
EOF;
}
/* -----------| Виджет вывода сообщений Твиттера |----------- */
/* - Регистрируем виджет и опции - */
register_sidebar_widget('Academic – Twitter', 'widget_academic_twitter');
register_widget_control('Academic – Twitter', 'widget_academic_twitter_options');
/* - Описываем виджет - */
function widget_academic_twitter()
{
$options = get_option('widget_academic_twitter');
if (!empty($options['name'])) {$name = $options['name'];} else {$name = "ATimofeev";}
if (!empty($options['header'])) {$header = $options['header'];} else {$header = "Microblog by $name";}
if (!empty($options['count'])) {$count = $options['count'];} else {$count = 5;}
echo "
";
}
/* - Описываем опции виджета - */
function widget_academic_twitter_options()
{
$options = $newoptions = get_option('widget_academic_twitter');
if ( $_POST['widget_academic_twitter_submit'] )
{
$newoptions['name'] = stripslashes($_POST['widget_academic_twitter_name']);
$newoptions['header'] = stripslashes($_POST['widget_academic_twitter_header']);
$newoptions['count'] = stripslashes($_POST['widget_academic_twitter_count']);
}
if ( $options != $newoptions )
{
$options = $newoptions;
update_option('widget_academic_twitter', $options);
}
$name = attribute_escape($options['name']);
$header = attribute_escape($options['header']);
$count = attribute_escape($options['count']);
echo <<
Заголовок блока:
Количество записей:
EOF;
}
/* -----------| Виджет вывода превьюшек с Фликера |----------- */
/* - Регистрируем виджет и опции - */
register_sidebar_widget('Academic – Flickr превью', 'widget_academic_flickr');
register_widget_control('Academic – Flickr превью', 'widget_academic_flickr_options');
/* - Описываем виджет - */
function widget_academic_flickr()
{
$options = get_option('widget_academic_flickr');
$name = $options['name'] ? $options['name'] : 'sidebar';
echo "
";
}
/* - Описываем опции виджета - */
function widget_academic_flickr_options()
{
$options = $newoptions = get_option('widget_academic_flickr');
if ( $_POST['widget_academic_flickr_submit'] )
{
$newoptions['name'] = stripslashes($_POST['widget_academic_flickr_name']);
}
if ( $options != $newoptions )
{
$options = $newoptions;
update_option('widget_academic_flickr', $options);
}
$name = attribute_escape($options['name']);
echo <<
Чтобы узнать свой ID на flickr можно воспользоваться этим сервисом.
EOF;
}
?>