function get_banner($banner_slug, $echo = true, $url_and_link = false) { $banner_id = get_post_id_by_slug($banner_slug, 'banners'); $banners = new Attachments('banner_attachments', $banner_id); $output = ""; if ($banners->exist()) { $i = 0; //пишем всю эту муть.. там в Attachments::()->OneSort(); $o = $banners->OneSort(); if (empty($o)) { $o = 0; } //ты втираешь мне какуюто Дичь!? if ($banners->total() > 1) { if (!session_id()) { session_start(); } if (!isset($_SESSION[$banner_slug])) { $_SESSION[$banner_slug] = $o; $_SESSION[start] = true; } else { $_SESSION[start] = false; } $i = intval($_SESSION[$banner_slug]); //извольте?!? if ($_SESSION[start]) { $i = $i; } else { if ($i < $banners->total() - 1) { $_SESSION[$banner_slug] = ++$i; } else { $_SESSION[$banner_slug] = $i = 0; } } } if ($banners->get_single($i)) { if ($url_and_link) { return array('url' => $banners->url($i), 'link' => $banners->field('link_url', $i)); } if ($banners->type($i) == 'image') { $b_url = $banners->field('link_url', $i); if (!empty($b_url)) { $output .= '<noindex><a rel="nofollow" href="' . $b_url . '" target="_blank">'; } $output .= '<img src="' . $banners->url($i) . '" width="100%" />'; if (!empty($b_url)) { $output .= '</a></noindex>'; } } if ($banners->type($i) == 'application') { $hb = explode("x", $banner_slug); $parent_id = $banner_slug . '_' . $banners->id($i); $output .= '<div id="' . $parent_id . '"><script type="text/javascript">'; $output .= 'swfobject.embedSWF("' . $banners->url($i) . '", "' . $parent_id . '", "100%", "' . $hb[1] . '", "10.0.0", "install flash player", null, {menu: "false", wmode: "transparent", scale:"default"}, null);'; $output .= '</script></div>'; } } } else { if ($echo) { echo $output; } else { return false; } } if ($echo) { echo $output; } else { return $output; } }
<input name="action" type="hidden" value="contact"> <div class="row"> <div class="col-md-6"><input class="form-control required" name="name" pattern="[a-zA-Z0-9 ]+" type="text" placeholder="Name"></div> <div class="col-md-6"><input class="form-control email required" name="email" type="email" placeholder="Email"></div> </div> <div class="row"> <div class="col-md-12"><textarea class="form-control required" name="message" placeholder="Message"></textarea></div> </div> <div class="row"> <div class="col-md-12"><input class="btn btn-primary form-control" type="submit" value="Send Message"></div> </div> </form> </div> <div class="col-md-4 side"> <?php if ($attachments->exist() && $attachments->total() > 1) { $attachments->rewind(); ?> <div class="row" id="gallery-controls"> <?php while ($index = $attachments->get()) { ?> <div class="col-md-6<?php if ($index->id == $attachments->id(0)) { ?> active<?php } ?> "> <div class="thumbnail<?php if ($index->id == $attachments->id(0)) {