index.template.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595
  1. <?php
  2. /**
  3. * Simple Machines Forum (SMF)
  4. *
  5. * @package SMF
  6. * @author Simple Machines
  7. * @copyright 2011 Simple Machines
  8. * @license http://www.simplemachines.org/about/smf/license.php BSD
  9. *
  10. * @version 2.1 Alpha 1
  11. */
  12. /* This template is, perhaps, the most important template in the theme. It
  13. contains the main template layer that displays the header and footer of
  14. the forum, namely with main_above and main_below. It also contains the
  15. menu sub template, which appropriately displays the menu; the init sub
  16. template, which is there to set the theme up; (init can be missing.) and
  17. the linktree sub template, which sorts out the link tree.
  18. The init sub template should load any data and set any hardcoded options.
  19. The main_above sub template is what is shown above the main content, and
  20. should contain anything that should be shown up there.
  21. The main_below sub template, conversely, is shown after the main content.
  22. It should probably contain the copyright statement and some other things.
  23. The linktree sub template should display the link tree, using the data
  24. in the $context['linktree'] variable.
  25. The menu sub template should display all the relevant buttons the user
  26. wants and or needs.
  27. For more information on the templating system, please see the site at:
  28. http://www.simplemachines.org/
  29. */
  30. /**
  31. * Initialize the template... mainly little settings.
  32. */
  33. function template_init()
  34. {
  35. global $context, $settings, $options, $txt;
  36. /* Use images from default theme when using templates from the default theme?
  37. if this is 'always', images from the default theme will be used.
  38. if this is 'defaults', images from the default theme will only be used with default templates.
  39. if this is 'never' or isn't set at all, images from the default theme will not be used. */
  40. $settings['use_default_images'] = 'never';
  41. /* What document type definition is being used? (for font size and other issues.)
  42. 'xhtml' for an XHTML 1.0 document type definition.
  43. 'html' for an HTML 4.01 document type definition. */
  44. $settings['doctype'] = 'xhtml';
  45. // The version this template/theme is for. This should probably be the version of SMF it was created for.
  46. $settings['theme_version'] = '2.0';
  47. // Set a setting that tells the theme that it can render the tabs.
  48. $settings['use_tabs'] = true;
  49. // Use plain buttons - as opposed to text buttons?
  50. $settings['use_buttons'] = true;
  51. // Show sticky and lock status separate from topic icons?
  52. $settings['separate_sticky_lock'] = true;
  53. // Does this theme use the strict doctype?
  54. $settings['strict_doctype'] = false;
  55. // Does this theme use post previews on the message index?
  56. $settings['message_index_preview'] = false;
  57. // Set the following variable to true if this theme requires the optional theme strings file to be loaded.
  58. $settings['require_theme_strings'] = false;
  59. // Load the CSS
  60. // The ?fin20 part of this link is just here to make sure browsers don't cache it wrongly.
  61. loadCSSFile($settings['theme_url'] . '/css/index' . $context['theme_variant'] . '.css?fin20');
  62. // Some browsers need an extra stylesheet due to bugs/compatibility issues.
  63. foreach (array('ie7', 'ie6', 'webkit') as $cssfix)
  64. if (isBrowser('is_' . $cssfix))
  65. loadCSSFile($settings['default_theme_url'] . '/css/' . $cssfix . '.css');
  66. // RTL languages require an additional stylesheet.
  67. if (!empty($context['right_to_left']))
  68. loadCSSFile($settings['theme_url'] . '/css/rtl.css');
  69. // Now load the JS
  70. // Note that the Superfish function seems to like being called by the full syntax.
  71. // It doesn't appear to like being called by short syntax. Please test if contemplating changes.
  72. loadJavascriptFile($settings['theme_url'] . '/scripts/jquery-1.6.4.min.js');
  73. loadJavascriptFile($settings['theme_url'] . '/scripts/hoverIntent.js');
  74. loadJavascriptFile($settings['theme_url'] . '/scripts/superfish.js');
  75. loadJavascriptFile($settings['default_theme_url'] . '/scripts/script.js?fin20');
  76. loadJavascriptFile($settings['theme_url'] . '/scripts/theme.js?fin20');
  77. }
  78. /**
  79. * The main sub template above the content.
  80. */
  81. function template_html_above()
  82. {
  83. global $context, $settings, $options, $scripturl, $txt, $modSettings;
  84. // Show right to left and the character set for ease of translating.
  85. echo '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  86. <html xmlns="http://www.w3.org/1999/xhtml"', $context['right_to_left'] ? ' dir="rtl"' : '', '>
  87. <head>';
  88. template_css();
  89. // Here comes the JavaScript bits!
  90. echo '
  91. <script type="text/javascript"><!-- // --><![CDATA[
  92. var smf_theme_url = "', $settings['theme_url'], '";
  93. var smf_default_theme_url = "', $settings['default_theme_url'], '";
  94. var smf_images_url = "', $settings['images_url'], '";
  95. var smf_scripturl = "', $scripturl, '";
  96. var smf_iso_case_folding = ', $context['server']['iso_case_folding'] ? 'true' : 'false', ';
  97. var smf_charset = "', $context['character_set'], '";
  98. var smf_session_id = "', $context['session_id'], '";
  99. var smf_session_var = "', $context['session_var'], '";
  100. var smf_member_id = "', $context['user']['id'], '";', $context['show_pm_popup'] ? '
  101. var fPmPopup = function ()
  102. {
  103. if (confirm("' . $txt['show_personal_messages'] . '"))
  104. window.open(smf_prepareScriptUrl(smf_scripturl) + "action=pm");
  105. }
  106. addLoadEvent(fPmPopup);' : '', '
  107. var ajax_notification_text = "', $txt['ajax_in_progress'], '";
  108. var ajax_notification_cancel_text = "', $txt['modify_cancel'], '";
  109. // ]]></script>';
  110. template_javascript();
  111. echo '
  112. <script type="text/javascript"><!-- // --><![CDATA[
  113. $(document).ready(function() {
  114. $("ul.dropmenu").superfish();
  115. });
  116. // ]]></script>';
  117. echo '
  118. <meta http-equiv="Content-Type" content="text/html; charset=', $context['character_set'], '" />
  119. <meta name="description" content="', $context['page_title_html_safe'], '" />', !empty($context['meta_keywords']) ? '
  120. <meta name="keywords" content="' . $context['meta_keywords'] . '" />' : '', '
  121. <title>', $context['page_title_html_safe'], '</title>';
  122. // Please don't index these Mr Robot.
  123. if (!empty($context['robot_no_index']))
  124. echo '
  125. <meta name="robots" content="noindex" />';
  126. // Present a canonical url for search engines to prevent duplicate content in their indices.
  127. if (!empty($context['canonical_url']))
  128. echo '
  129. <link rel="canonical" href="', $context['canonical_url'], '" />';
  130. // Show all the relative links, such as help, search, contents, and the like.
  131. echo '
  132. <link rel="help" href="', $scripturl, '?action=help" />
  133. <link rel="contents" href="', $scripturl, '" />', ($context['allow_search'] ? '
  134. <link rel="search" href="' . $scripturl . '?action=search" />' : '');
  135. // If RSS feeds are enabled, advertise the presence of one.
  136. if (!empty($modSettings['xmlnews_enable']) && (!empty($modSettings['allow_guestAccess']) || $context['user']['is_logged']))
  137. echo '
  138. <link rel="alternate" type="application/rss+xml" title="', $context['forum_name_html_safe'], ' - ', $txt['rss'], '" href="', $scripturl, '?type=rss;action=.xml" />';
  139. // If we're viewing a topic, these should be the previous and next topics, respectively.
  140. if (!empty($context['current_topic']))
  141. echo '
  142. <link rel="prev" href="', $scripturl, '?topic=', $context['current_topic'], '.0;prev_next=prev" />
  143. <link rel="next" href="', $scripturl, '?topic=', $context['current_topic'], '.0;prev_next=next" />';
  144. // If we're in a board, or a topic for that matter, the index will be the board's index.
  145. if (!empty($context['current_board']))
  146. echo '
  147. <link rel="index" href="', $scripturl, '?board=', $context['current_board'], '.0" />';
  148. // Output any remaining HTML headers. (from mods, maybe?)
  149. echo $context['html_headers'];
  150. echo '
  151. </head>
  152. <body class="action_', !empty($context['current_action']) ? htmlspecialchars($context['current_action']) : (!empty($context['current_board']) ? 'messageindex' : (!empty($context['current_topic']) ? 'display' : 'home')),
  153. !empty($context['current_board']) ? ' board_' . htmlspecialchars($context['current_board']) : '',
  154. '"',
  155. // Style per page.
  156. !empty($context['body_id']) ? ' id="' . $context['body_id'] . '"' : '', '>';
  157. }
  158. function template_body_above()
  159. {
  160. global $context, $settings, $options, $scripturl, $txt, $modSettings;
  161. echo !empty($settings['forum_width']) ? '
  162. <div id="wrapper" style="width: ' . $settings['forum_width'] . '">' : '', '
  163. <div id="header"><div class="frame">
  164. <div id="top_section">
  165. <h1 class="forumtitle">
  166. <a href="', $scripturl, '">', empty($context['header_logo_url_html_safe']) ? $context['forum_name'] : '<img src="' . $context['header_logo_url_html_safe'] . '" alt="' . $context['forum_name'] . '" />', '</a>
  167. </h1>';
  168. // the upshrink image, right-floated
  169. echo '
  170. <img id="upshrink" src="', $settings['images_url'], '/upshrink.png" alt="*" title="', $txt['upshrink_description'], '" style="display: none;" />';
  171. echo '
  172. ', empty($settings['site_slogan']) ? '<img id="smflogo" src="' . $settings['images_url'] . '/smflogo.png" alt="Simple Machines Forum" title="Simple Machines Forum" />' : '<div id="siteslogan" class="floatright">' . $settings['site_slogan'] . '</div>', '
  173. </div>
  174. <div id="upper_section" class="middletext"', empty($options['collapse_header']) ? '' : ' style="display: none;"', '>
  175. <div class="user">';
  176. // If the user is logged in, display stuff like their name, new messages, etc.
  177. if ($context['user']['is_logged'])
  178. {
  179. if (!empty($context['user']['avatar']))
  180. echo '
  181. <p class="avatar">', $context['user']['avatar']['image'], '</p>';
  182. echo '
  183. <ul class="reset">
  184. <li class="greeting">', $txt['hello_member_ndt'], ' <span>', $context['user']['name'], '</span></li>
  185. <li><a href="', $scripturl, '?action=unread">', $txt['unread_since_visit'], '</a></li>
  186. <li><a href="', $scripturl, '?action=unreadreplies">', $txt['show_unread_replies'], '</a></li>';
  187. // Is the forum in maintenance mode?
  188. if ($context['in_maintenance'] && $context['user']['is_admin'])
  189. echo '
  190. <li class="notice">', $txt['maintain_mode_on'], '</li>';
  191. // Are there any members waiting for approval?
  192. if (!empty($context['unapproved_members']))
  193. echo '
  194. <li>', $context['unapproved_members'] == 1 ? $txt['approve_thereis'] : $txt['approve_thereare'], ' <a href="', $scripturl, '?action=admin;area=viewmembers;sa=browse;type=approve">', $context['unapproved_members'] == 1 ? $txt['approve_member'] : $context['unapproved_members'] . ' ' . $txt['approve_members'], '</a> ', $txt['approve_members_waiting'], '</li>';
  195. if (!empty($context['open_mod_reports']) && $context['show_open_reports'])
  196. echo '
  197. <li><a href="', $scripturl, '?action=moderate;area=reports">', sprintf($txt['mod_reports_waiting'], $context['open_mod_reports']), '</a></li>';
  198. echo '
  199. <li>', $context['current_time'], '</li>
  200. </ul>';
  201. }
  202. // Otherwise they're a guest - this time ask them to either register or login - lazy bums...
  203. elseif (!empty($context['show_login_bar']))
  204. {
  205. echo '
  206. <script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/sha1.js"></script>
  207. <form id="guest_form" action="', $scripturl, '?action=login2" method="post" accept-charset="', $context['character_set'], '" ', empty($context['disable_login_hashing']) ? ' onsubmit="hashLoginPassword(this, \'' . $context['session_id'] . '\');"' : '', '>
  208. <div class="info">', sprintf($txt[$context['can_register'] ? 'welcome_guest_register' : 'welcome_guest'], $txt['guest_title'], $scripturl . '?action=login'), '</div>
  209. <input type="text" name="user" size="10" class="input_text" />
  210. <input type="password" name="passwrd" size="10" class="input_password" />
  211. <select name="cookielength">
  212. <option value="60">', $txt['one_hour'], '</option>
  213. <option value="1440">', $txt['one_day'], '</option>
  214. <option value="10080">', $txt['one_week'], '</option>
  215. <option value="43200">', $txt['one_month'], '</option>
  216. <option value="-1" selected="selected">', $txt['forever'], '</option>
  217. </select>
  218. <input type="submit" value="', $txt['login'], '" class="button_submit" /><br />
  219. <div class="info">', $txt['quick_login_dec'], '</div>';
  220. if (!empty($modSettings['enableOpenID']))
  221. echo '
  222. <br /><input type="text" name="openid_identifier" size="25" class="input_text openid_login" />';
  223. echo '
  224. <input type="hidden" name="hash_passwrd" value="" />
  225. <input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
  226. <input type="hidden" name="', $context['login_token_var'], '" value="', $context['login_token'], '" />
  227. </form>';
  228. }
  229. echo '
  230. </div>
  231. <div class="news normaltext">';
  232. if ($context['allow_search'])
  233. {
  234. echo '
  235. <form id="search_form" action="', $scripturl, '?action=search2" method="post" accept-charset="', $context['character_set'], '">
  236. <input type="text" name="search" value="" class="input_text" />&nbsp;
  237. <input type="submit" name="submit" value="', $txt['search'], '" class="button_submit" />
  238. <input type="hidden" name="advanced" value="0" />';
  239. // Search within current topic?
  240. if (!empty($context['current_topic']))
  241. echo '
  242. <input type="hidden" name="topic" value="', $context['current_topic'], '" />';
  243. // If we're on a certain board, limit it to this board ;).
  244. elseif (!empty($context['current_board']))
  245. echo '
  246. <input type="hidden" name="brd[', $context['current_board'], ']" value="', $context['current_board'], '" />';
  247. echo '</form>';
  248. }
  249. // Show a random news item? (or you could pick one from news_lines...)
  250. if (!empty($settings['enable_news']))
  251. echo '
  252. <h2>', $txt['news'], ': </h2>
  253. <p>', $context['random_news_line'], '</p>';
  254. echo '
  255. </div>
  256. </div>
  257. <br class="clear" />';
  258. // Define the upper_section toggle in JavaScript.
  259. echo '
  260. <script type="text/javascript"><!-- // --><![CDATA[
  261. var oMainHeaderToggle = new smc_Toggle({
  262. bToggleEnabled: true,
  263. bCurrentlyCollapsed: ', empty($options['collapse_header']) ? 'false' : 'true', ',
  264. aSwappableContainers: [
  265. \'upper_section\'
  266. ],
  267. aSwapImages: [
  268. {
  269. sId: \'upshrink\',
  270. srcExpanded: smf_images_url + \'/upshrink.png\',
  271. altExpanded: ', JavaScriptEscape($txt['upshrink_description']), ',
  272. srcCollapsed: smf_images_url + \'/upshrink2.png\',
  273. altCollapsed: ', JavaScriptEscape($txt['upshrink_description']), '
  274. }
  275. ],
  276. oThemeOptions: {
  277. bUseThemeSettings: smf_member_id == 0 ? false : true,
  278. sOptionName: \'collapse_header\',
  279. sSessionVar: smf_session_var,
  280. sSessionId: smf_session_id
  281. },
  282. oCookieOptions: {
  283. bUseCookie: smf_member_id == 0 ? true : false,
  284. sCookieName: \'upshrink\'
  285. }
  286. });
  287. // ]]></script>';
  288. // Show the menu here, according to the menu sub template.
  289. template_menu();
  290. echo '
  291. <br class="clear" />
  292. </div></div>';
  293. // The main content should go here.
  294. echo '
  295. <div id="content_section"><div class="frame">
  296. <div id="main_content_section">';
  297. // Custom banners and shoutboxes should be placed here, before the linktree.
  298. // Show the navigation tree.
  299. theme_linktree();
  300. }
  301. function template_body_below()
  302. {
  303. global $context, $settings, $options, $scripturl, $txt, $modSettings;
  304. echo '
  305. </div>
  306. </div></div>';
  307. // Show the "Powered by" and "Valid" logos, as well as the copyright. Remember, the copyright must be somewhere!
  308. echo '
  309. <div id="footer_section"><div class="frame">
  310. <ul class="reset">
  311. <li class="copyright">', theme_copyright(), '</li>
  312. <li><a id="button_xhtml" href="http://validator.w3.org/check?uri=referer" target="_blank" class="new_win" title="', $txt['valid_xhtml'], '"><span>', $txt['xhtml'], '</span></a></li>
  313. ', !empty($modSettings['xmlnews_enable']) && (!empty($modSettings['allow_guestAccess']) || $context['user']['is_logged']) ? '<li><a id="button_rss" href="' . $scripturl . '?action=.xml;type=rss" class="new_win"><span>' . $txt['rss'] . '</span></a></li>' : '', '
  314. <li class="last"><a id="button_wap2" href="', $scripturl , '?wap2" class="new_win"><span>', $txt['wap2'], '</span></a></li>
  315. </ul>';
  316. // Show the load time?
  317. if ($context['show_load_time'])
  318. echo '
  319. <p>', $txt['page_created'], $context['load_time'], $txt['seconds_with'], $context['load_queries'], $txt['queries'], '</p>';
  320. echo '
  321. </div></div>', !empty($settings['forum_width']) ? '
  322. </div>' : '';
  323. }
  324. function template_html_below()
  325. {
  326. global $context, $settings, $options, $scripturl, $txt, $modSettings;
  327. template_javascript(true);
  328. echo '
  329. </body></html>';
  330. }
  331. /**
  332. * Show a linktree. This is that thing that shows "My Community | General Category | General Discussion"..
  333. * @param bool $force_show = false
  334. */
  335. function theme_linktree($force_show = false)
  336. {
  337. global $context, $settings, $options, $shown_linktree;
  338. // If linktree is empty, just return - also allow an override.
  339. if (empty($context['linktree']) || (!empty($context['dont_default_linktree']) && !$force_show))
  340. return;
  341. echo '
  342. <div class="navigate_section">
  343. <ul>';
  344. // Each tree item has a URL and name. Some may have extra_before and extra_after.
  345. foreach ($context['linktree'] as $link_num => $tree)
  346. {
  347. echo '
  348. <li', ($link_num == count($context['linktree']) - 1) ? ' class="last"' : '', '>';
  349. // Show something before the link?
  350. if (isset($tree['extra_before']))
  351. echo $tree['extra_before'];
  352. // Show the link, including a URL if it should have one.
  353. echo $settings['linktree_link'] && isset($tree['url']) ? '
  354. <a href="' . $tree['url'] . '"><span>' . $tree['name'] . '</span></a>' : '<span>' . $tree['name'] . '</span>';
  355. // Show something after the link...?
  356. if (isset($tree['extra_after']))
  357. echo $tree['extra_after'];
  358. // Don't show a separator for the last one.
  359. if ($link_num != count($context['linktree']) - 1)
  360. echo ' &#187;';
  361. echo '
  362. </li>';
  363. }
  364. echo '
  365. </ul>
  366. </div>';
  367. $shown_linktree = true;
  368. }
  369. /**
  370. * Show the menu up top. Something like [home] [help] [profile] [logout]...
  371. */
  372. function template_menu()
  373. {
  374. global $context, $settings, $options, $scripturl, $txt;
  375. echo '
  376. <div id="main_menu">
  377. <ul class="dropmenu" id="menu_nav">';
  378. foreach ($context['menu_buttons'] as $act => $button)
  379. {
  380. echo '
  381. <li id="button_', $act, '">
  382. <a class="', $button['active_button'] ? 'active ' : '', 'firstlevel" href="', $button['href'], '"', isset($button['target']) ? ' target="' . $button['target'] . '"' : '', '>
  383. <span class="', isset($button['is_last']) ? 'last ' : '', 'firstlevel">', $button['title'], '</span>
  384. </a>';
  385. if (!empty($button['sub_buttons']))
  386. {
  387. echo '
  388. <ul>';
  389. foreach ($button['sub_buttons'] as $childbutton)
  390. {
  391. echo '
  392. <li>
  393. <a href="', $childbutton['href'], '"', isset($childbutton['target']) ? ' target="' . $childbutton['target'] . '"' : '', '>
  394. <span', isset($childbutton['is_last']) ? ' class="last"' : '', '>', $childbutton['title'], !empty($childbutton['sub_buttons']) ? '...' : '', '</span>
  395. </a>';
  396. // 3rd level menus :)
  397. if (!empty($childbutton['sub_buttons']))
  398. {
  399. echo '
  400. <ul>';
  401. foreach ($childbutton['sub_buttons'] as $grandchildbutton)
  402. echo '
  403. <li>
  404. <a href="', $grandchildbutton['href'], '"', isset($grandchildbutton['target']) ? ' target="' . $grandchildbutton['target'] . '"' : '', '>
  405. <span', isset($grandchildbutton['is_last']) ? ' class="last"' : '', '>', $grandchildbutton['title'], '</span>
  406. </a>
  407. </li>';
  408. echo '
  409. </ul>';
  410. }
  411. echo '
  412. </li>';
  413. }
  414. echo '
  415. </ul>';
  416. }
  417. echo '
  418. </li>';
  419. }
  420. echo '
  421. </ul>
  422. </div>';
  423. }
  424. /**
  425. * Generate a strip of buttons.
  426. * @param array $button_strip
  427. * @param string $direction = ''
  428. * @param array $strip_options = array()
  429. */
  430. function template_button_strip($button_strip, $direction = '', $strip_options = array())
  431. {
  432. global $settings, $context, $txt, $scripturl;
  433. if (!is_array($strip_options))
  434. $strip_options = array();
  435. // List the buttons in reverse order for RTL languages.
  436. if ($context['right_to_left'])
  437. $button_strip = array_reverse($button_strip, true);
  438. // Create the buttons...
  439. $buttons = array();
  440. foreach ($button_strip as $key => $value)
  441. {
  442. if (!isset($value['test']) || !empty($context[$value['test']]))
  443. $buttons[] = '
  444. <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>';
  445. }
  446. // No buttons? No button strip either.
  447. if (empty($buttons))
  448. return;
  449. // Make the last one, as easy as possible.
  450. $buttons[count($buttons) - 1] = str_replace('<span>', '<span class="last">', $buttons[count($buttons) - 1]);
  451. echo '
  452. <div class="buttonlist', !empty($direction) ? ' float' . $direction : '', '"', (empty($buttons) ? ' style="display: none;"' : ''), (!empty($strip_options['id']) ? ' id="' . $strip_options['id'] . '"': ''), '>
  453. <ul>',
  454. implode('', $buttons), '
  455. </ul>
  456. </div>';
  457. }
  458. /**
  459. * Output the Javascript files
  460. */
  461. function template_javascript($do_defered = false)
  462. {
  463. global $context;
  464. // Use this hook to minify/optimize Javascript files
  465. call_integration_hook('pre_javascript_output');
  466. foreach ($context['javascript_files'] as $filename => $options)
  467. if ((!$do_defered && empty($options['defer'])) || ($do_defered && !empty($options['defer'])))
  468. echo '
  469. <script type="text/javascript" src="', $filename, '"></script>';
  470. }
  471. /**
  472. * Output the Javascript vars
  473. */
  474. function template_javascript_vars()
  475. {
  476. global $context;
  477. call_integration_hook('pre_javascript_vars_output');
  478. foreach ($context['javascript_vars'] as $key => $value)
  479. echo '
  480. var ', $key, ' = ', $value;
  481. }
  482. /**
  483. * Output the CSS files
  484. */
  485. function template_css()
  486. {
  487. global $context;
  488. // Use this hook to minify/optimize CSS files
  489. call_integration_hook('pre_css_output');
  490. foreach ($context['css_files'] as $filename => $options)
  491. echo '
  492. <link rel="stylesheet" type="text/css" href="', $filename, '" />';
  493. }
  494. ?>