Advertisement
Guest User

Untitled

a guest
Mar 7th, 2011
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.33 KB | None | 0 0
  1. <?php
  2. // Version: 2.0 RC3; Compat
  3.  
  4. // Generate a strip of buttons, out of buttons.
  5. function template_button_strip($button_strip, $direction = 'top', $strip_options = array())
  6. {
  7.     global $settings, $context, $txt, $scripturl;
  8.  
  9.     // Compatibility.
  10.     if (!is_array($strip_options))
  11.         $strip_options = array();
  12.  
  13.     // Create the buttons...
  14.     $buttons = array();
  15.     foreach ($button_strip as $key => $value)
  16.     {
  17.         if (!isset($value['test']) || !empty($context[$value['test']]))
  18.             $buttons[] = '
  19.                 <li><a' . (isset($value['id']) ? ' id="button_strip_' . $value['id'] . '"' : '') . ' class="button_strip_' . $key . '' . (isset($value['active']) ? ' active' : '') . '" href="' . $value['url'] . '"' . (isset($value['custom']) ? ' ' . $value['custom'] : '') . '><span>' . $txt[$value['text']] . '</span></a></li>';
  20.     }
  21.  
  22.     // No buttons? No button strip either.
  23.     if (empty($buttons))
  24.         return;
  25.  
  26.     // Make the last one, as easy as possible.
  27.     $buttons[count($buttons) - 1] = str_replace('<span>', '<span class="last">', $buttons[count($buttons) - 1]);
  28.  
  29.     echo '
  30.         <div class="buttonlist', $direction != 'top' ? '_bottom' : '', '"', (empty($buttons) ? ' style="display: none;"' : ''), (!empty($strip_options['id']) ? ' id="' . $strip_options['id'] . '"': ''), '>
  31.             <ul class="reset clearfix">
  32.                 implode('', $buttons), '
  33.             </ul>
  34.         </div>';
  35. }
  36.  
  37. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement