function random_gal_widget($num = 1) { $widget = 'random_gal_widget_' . $num; // имя для опций = виджет + номер $options = mso_get_option($widget, 'plugins', array()); // получаем опции // заменим заголовок, чтобы был в h2 class="box" if (isset($options['header']) and $options['header']) { $options['header'] = mso_get_val('widget_header_start', '<div class="mso-widget-header"><span>') . $options['header'] . mso_get_val('widget_header_end', '</span></div>'); } else { $options['header'] = ''; } return random_gal_widget_custom($options, $num); }
require getinfo('template_dir') . 'main-start.php'; if (isset($options['all'])) { $current_gal = mso_segment(2); // first | Моя галерея | / % test | name_file | 100 $all = explode("\n", trim($options['all'])); if ($current_gal) { foreach ($all as $gal) { $gal = explode('|', $gal); if (isset($gal[0]) and trim($gal[0]) == $current_gal) { echo '<h1>' . trim($gal[1]) . '</h1>'; $arg = array('galother' => str_replace('%', '|', $gal[2]), 'sort' => trim($gal[3]), 'count' => (int) $gal[4], 'class' => 'gallery_page'); if (isset($gal[5])) { $arg['filter'] = $gal[5]; } echo '<p><a href="' . getinfo('site_url') . $options['slug_gallery'] . '">' . t('Все галереи') . '</a>'; echo random_gal_widget_custom($arg); break; } } } else { echo '<h1>' . t('Галереи') . '</h1>'; echo '<div class="gallery_page"><ul class="gallery_page">'; foreach ($all as $gal) { $gal = explode('|', $gal); echo '<li><a href="' . getinfo('site_url') . $options['slug_gallery'] . '/' . trim($gal[0]) . '">' . $gal[1] . '</a></li>'; } echo '</ul></div><!-- div class=gallery_page -->'; } } # конечная часть шаблона require getinfo('template_dir') . 'main-end.php';