PageRenderTime 32ms CodeModel.GetById 38ms RepoModel.GetById 0ms app.codeStats 1ms

/template-options.php

https://github.com/marpa/translucence
PHP | 2064 lines | 1465 code | 268 blank | 331 comment | 212 complexity | f9216f3cd8f2903a261a5b62e7388208 MD5 | raw file
  1. <?php
  2. /*********************************************************
  3. * Theme options
  4. * renders UI and theme model for chosing and previewing options
  5. *
  6. * @since 2010 Translucence 1.0
  7. *********************************************************/
  8. function translucence_theme_options_do_page() {
  9. global $translucence_config;
  10. global $translucence_options_id, $translucence_options, $translucence_options_values;
  11. global $translucence_custom_header_set, $translucence_custom_background_set, $translucence_custom_header_image;
  12. global $translucence_syndication_image, $translucence_model_site_width, $translucence_model_content_width;
  13. if ($translucence_options['revert'] == 1) {
  14. translucence_option_feedback();
  15. translucence_delete_options();
  16. $translucence_options['revert'] = 0;
  17. translucence_theme_options_update();
  18. }
  19. translucence_option_feedback();
  20. $translucence_options = get_option($translucence_options_id);
  21. $current_widgets = get_option ('sidebars_widgets');
  22. $custom_background_color = get_background_color();
  23. $custom_background_image = get_background_image();
  24. $translucence_custom_header_image = get_header_image();
  25. if (isset($translucence_custom_header_image) && $translucence_custom_header_image != "") {
  26. $translucence_custom_header_set = 1;
  27. } else {
  28. $translucence_custom_header_set = 0;
  29. }
  30. if ($translucence_custom_header_set == 0 && $translucence_options['header-image-options'] != "none") {
  31. $custom_header = $translucence_config['custom_header'][$translucence_options['header-image-options']]['url'];
  32. $custom_header = str_replace('%s', '', $custom_header);
  33. $translucence_custom_header_image = $custom_header;
  34. $translucence_custom_header_set = 1;
  35. }
  36. if ($custom_background_image) {
  37. $translucence_options['background_image'] = "url('".$custom_background_image."')";
  38. $translucence_options['background_repeat'] = get_theme_mod( 'background_repeat', 'repeat' );
  39. $translucence_options['background_attachment'] = get_theme_mod( 'background_attachment', 'scroll' );
  40. $translucence_options['background_position'] = get_theme_mod( 'background_position_x', 'left' );
  41. $translucence_custom_background_set = 1;
  42. } else if ($custom_background_color) {
  43. $translucence_custom_background_set = 1;
  44. } else {
  45. $translucence_custom_background_set = 0;
  46. }
  47. /*********************************************************
  48. * Define theme layout model values
  49. *********************************************************/
  50. $translucence_model_site_width = $translucence_options['site-width']+80;
  51. $model_right_sidebar_width = $translucence_options['right01-width']+50;
  52. $model_right_sidebar_width02 = $translucence_options['right02-width']+50;
  53. $model_left_sidebar_width = $translucence_options['left01-width']+50;
  54. $translucence_model_content_width = $translucence_options['site-width'] - ($translucence_options['left01-width'] + $translucence_options['right01-width'] + $translucence_options['right02-width'] + 220);
  55. /*********************************************************
  56. * Define theme model css
  57. * model css uses most of the actual theme's css except
  58. * theme body css
  59. * model css adds css for theme edit UI components
  60. *********************************************************/
  61. $model_css = preg_replace("/body/", ".body_na", $translucence_options['css']);
  62. $translucence_syndication_image = get_template_directory_uri()."/variations/feed.png";
  63. print "
  64. <script type='text/javascript' src='".get_template_directory_uri()."/jscolor/jscolor.js'></script>
  65. <style type='text/css'>";
  66. print $model_css;
  67. print translucence_get_theme_model_css();
  68. // printpre($translucence_options['activated-widgets']);
  69. // printpre($translucence_options['page-links-display']);
  70. /******************************************************************************
  71. * Theme Options Introduction with Update and Revert buttons
  72. ******************************************************************************/
  73. ?>
  74. <form id='settings' action='options.php' method='post' class='themeform' style='margin: 20px;'>
  75. <?php settings_fields( $translucence_options_id ); ?>
  76. <?php $translucence_options = get_option($translucence_options_id); ?>
  77. <table width = '<?php print $translucence_model_site_width; ?>' cellpadding='0' style='background-color: transparent;'>
  78. <tr>
  79. <td width='20%'>
  80. <span class='submit'><input type='submit' value='<?php _e( 'Update', '2010-translucence' ); ?>' name='save'/></span>
  81. <span class='submit'><input type='submit' value='<?php _e( 'Revert to Default', '2010-translucence' ); ?>' name='<?php echo $translucence_options_id ?>[reset]'/></span>
  82. </td>
  83. <td width='80%'>
  84. <?php
  85. print "<input type='hidden' value='".$translucence_options['activated-theme']."' name='".$translucence_options_id."[activated-theme]'/>";
  86. print "<input type='hidden' value='".$translucence_options['footer-widget-width']."' name='".$translucence_options_id."[footer-widget-width]'/>";
  87. /******************************************************************************
  88. * Widget Set Options
  89. ******************************************************************************/
  90. print "<div style='font-size: 10px;'>";
  91. if (in_array("activated-widgets", $translucence_config['model'])) {
  92. // widget set label
  93. print __('Widgets', '2010-translucence').": ";
  94. // widget set select field
  95. print "<select name='".$translucence_options_id."[activated-widgets]' style='font-size: 10px;' onchange='this.form.submit();'>";
  96. $widget_sets = array_keys($translucence_config['preset_widgets']);
  97. foreach ($widget_sets as $widget_set) {
  98. print "\n<option value='".$widget_set."'".($translucence_options['activated-widgets'] == $widget_set ? ' selected' : '') . ">".$widget_set."</option>";
  99. }
  100. print "</select> ";
  101. // widget set description and activate button
  102. //printpre($translucence_config['preset_widgets'][$translucence_options['activated-widgets']]['description']);
  103. if ($translucence_options['activated-widgets'] != "default" ) {
  104. print "<span class='submit'><input type='submit' value='".__('Activate New Widgets', '2010-translucence')."' name='".$translucence_options_id."[widgets]'/></span>";
  105. print " <span style='font-size: 10px;'> (".__('will <span class=\'warning\'>replace</span> existing widgets.', '2010-translucence').")</span>";
  106. print "<div style='margin-left: 100px;'>";
  107. print " <span style='font-size: 10px; font-style: italic'> ".$translucence_config['preset_widgets'][$translucence_options['activated-widgets']]['description'][0]."</span> ";
  108. print "</div>";
  109. } else {
  110. print "<input type='hidden' value='default' name='".$translucence_options_id."[widgets]'/>";
  111. }
  112. }
  113. print "</div>";
  114. /******************************************************************************
  115. * Content Set Options
  116. * NOT IMPLEMENTED YET....
  117. ******************************************************************************/
  118. print "<div style='font-size: 10px;'>";
  119. if (in_array("added-content-not-implemented", $translucence_config['model'])) {
  120. //content set label
  121. print __('Content', '2010-translucence').": ";
  122. // content set select field
  123. print "<select name='".$translucence_options_id."[added-content]' style='font-size: 10px;' onchange='this.form.submit();'>";
  124. $content_sets = array_keys($translucence_config['preset_content']);
  125. foreach ($content_sets as $content_set) {
  126. print "\n<option value='".$content_set."'".($translucence_options['added-content'] == $content_set ? ' selected' : '') . ">".$content_set."</option>";
  127. }
  128. print "</select> ";
  129. // widget set description and activate button
  130. if ($translucence_options['added-content'] != "default" ) {
  131. print " <span class='submit'><input type='submit' value='".__('Add New Content', '2010-translucence')."' name='".$translucence_options_id."[content]'/></span>";
  132. print "<span style='font-size: 10px;'> ".__('New posts, pages, tags and categories will be <span class=\'notify\'>added</span> to your site.', '2010-translucence')."</span>";
  133. print "<div style='margin-left: 100px;'>";
  134. print " <span style='font-size: 10px; font-style: italic'> ".$translucence_config['preset_content'][$translucence_options['added-content']]['description'][0]."</span> ";
  135. print "</div>";
  136. } else {
  137. print "<input type='hidden' value='default' name='".$translucence_options_id."[content]'/>";
  138. }
  139. }
  140. print "</div>";
  141. ?>
  142. </div>
  143. </td>
  144. <td width='20%'>
  145. </td>
  146. </tr>
  147. </table>
  148. <?php
  149. /******************************************************************************
  150. * html from theme template files (header.php, index.php, footer.php and sidebars
  151. * embedded in this html are functions for printing theme options UI
  152. ******************************************************************************/
  153. ?>
  154. <div class='modelwrapper' style='margin-bottom: 5px;'>
  155. <?php print translucence_get_global_options(); ?>
  156. </div>
  157. <div class='modelwrapper'>
  158. <div class='sitewrapper'>
  159. <div class='headermeta_right'>
  160. <div class='bgtextcolor'><?php print translucence_headermeta_right(); ?></div>
  161. </div>
  162. <div class='headermeta_left'>
  163. <div class='bgtextcolor'><?php print translucence_headermeta_left(); ?></div>
  164. </div>
  165. <?php print translucence_get_custom_options(); ?>
  166. </div>
  167. <div id='wrapper'>
  168. <div id='header'>
  169. <div id='masthead'>
  170. <div id='branding'>
  171. <div class='headerblock'>
  172. </div>
  173. <span id='title-box'>
  174. <a href='index.php'>
  175. <div id='site-title'><?php print get_bloginfo('name') ?></div><br/>
  176. <div id='site-description'><?php print get_bloginfo('description') ?></div>
  177. </a>
  178. </span>
  179. </div><!-- #branding -->
  180. <div id='access' role='navigation'>
  181. <!-- top navigation links -->
  182. <div class='menu-header'>
  183. <?php print translucence_get_topmenu_options(); ?>
  184. </div>
  185. </div><!-- #access -->
  186. </div><!-- #masthead -->
  187. </div><!-- #header -->
  188. <div id='main' style="clear: both;">
  189. <div id='container'>
  190. <div id='tertiary' class='widget-area'>
  191. <!-- left sidebar -->
  192. <h3 class='widget-title'><?php _e( 'Left Sidebar', '2010-translucence' ); ?></h3>
  193. <?php print translucence_get_left01_options(); ?>
  194. </div>
  195. <div id='content'>
  196. <!-- syndication links -->
  197. <div style = 'width: 100%; float: right;'>
  198. <div id='syndication'>
  199. <a href='#' class='feed'><?php _e( 'Posts RSS', '2010-translucence' ); ?></a>
  200. <a href='#' class='feed'><?php _e( 'Comments RSS', '2010-translucence' ); ?></a>
  201. </div>
  202. </div>
  203. <!-- main content -->
  204. <?php print translucence_get_layout_options(); ?>
  205. <h2 class='entry-title'><?php _e( 'Entry Title', '2010-translucence' ); ?></h2>
  206. <div class='entry-content'>
  207. <?php print translucence_get_post_options(); ?>
  208. </div>
  209. </div>
  210. <div id='primary' class='widget-area'>
  211. <!-- 1st right sidebar -->
  212. <h3 class='widget-title'><?php _e( '1st Right Sidebar', '2010-translucence' ); ?></h3>
  213. <?php print translucence_get_right01_options(); ?>
  214. </div>
  215. <div id='secondary' class='widget-area' style=''>
  216. <!-- 2nd right sidebar -->
  217. <h3 class='widget-title'><?php _e( '2nd Right Sidebar', '2010-translucence' ); ?></h3>
  218. <?php print translucence_get_right02_options(); ?>
  219. </div>
  220. </div><!-- #container -->
  221. </div><!-- #main -->
  222. <br/>
  223. <div id='colophon'></div><!-- #colophon -->
  224. <div id='footer-widget-area'>
  225. <?php print translucence_get_footer_options(); ?>
  226. <!-- footer -->
  227. <div id='first' class='widget-area'>
  228. <ul class='xoxo'>
  229. <h3 class='widget-title'><?php _e( 'First Footer Widget Area', '2010-translucence' ); ?></h3>
  230. <?php print translucence_get_footer_widgets('first'); ?>
  231. </ul>
  232. </div>
  233. <div id='second' class='widget-area'>
  234. <ul class='xoxo'>
  235. <h3 class='widget-title'><?php _e( 'Second Footer Widget Area', '2010-translucence' ); ?></h3>
  236. <?php print translucence_get_footer_widgets('second'); ?>
  237. </ul>
  238. </div>
  239. <div id='third' class='widget-area'>
  240. <ul class='xoxo'>
  241. <h3 class='widget-title'><?php _e( 'Third Footer Widget Area', '2010-translucence' ); ?></h3>
  242. <?php print translucence_get_footer_widgets('third'); ?>
  243. </ul>
  244. </div>
  245. <div id='fourth' class='widget-area'>
  246. <ul class='xoxo'>
  247. <h3 class='widget-title'><?php _e( 'Fourth Footer Widget Area', '2010-translucence' ); ?></h3>
  248. <?php print translucence_get_footer_widgets('fourth'); ?>
  249. </ul>
  250. </div>
  251. </div>
  252. </div><!-- #wrapper -->
  253. <div class='sitewrapper'>
  254. <div class='footermeta_right'>
  255. <div class='bgtextcolor'><?php print translucence_footermeta_right(); ?></div>
  256. </div>
  257. <div class='footermeta_left'>
  258. <div class='bgtextcolor'><?php print translucence_footermeta_left(); ?></div>
  259. </div>
  260. </div><!-- #sitewrapper -->
  261. </div><!-- modelwrapper -->
  262. <div class='modelwrapper' style='margin-top: 5px;'>
  263. <?php print translucence_get_footermeta_options(); ?>
  264. </div>
  265. <?php
  266. /******************************************************************************
  267. * Update and Revert button
  268. ******************************************************************************/
  269. ?>
  270. <span class='submit'><input type='submit' value='<?php _e( 'Update', '2010-translucence' ); ?>' name='save'/></span>
  271. <span class='submit'><input type='submit' value='<?php _e( 'Revert to Default', '2010-translucence' ); ?>' name='<?php echo $translucence_options_id ?>[reset]'/></span>
  272. </form>
  273. <?php
  274. }
  275. /**
  276. * Generates CSS for theme options UI (based on theme CSS)
  277. *
  278. * @since 2010 Translucence 1.0
  279. * @return string CSS for theme options UI
  280. */
  281. function translucence_get_theme_model_css() {
  282. global $translucence_config;
  283. global $translucence_options_id, $translucence_options, $translucence_options_values;
  284. global $translucence_custom_header_image, $translucence_model_site_width, $translucence_syndication_image;
  285. ob_start();
  286. print "
  287. .modelwrapper {
  288. background-image: ".$translucence_options['background_image'].";
  289. background-position: ".$translucence_options['background_position'].";
  290. background-color: ".$translucence_options['background_color'].";
  291. background-repeat: ".$translucence_options['background_repeat'].";
  292. background-attachment: ".$translucence_options['background_attachment'].";
  293. width: ".$translucence_model_site_width."px;
  294. background-color: ".$translucence_options['background_color'].";
  295. color: #000000;
  296. padding: 1px 0px 0px 0px;
  297. border: 1px solid #CCCCCC;
  298. }
  299. #wphead h1 a {
  300. text-decoration: none;
  301. border-bottom: none;
  302. }
  303. a, a:hover {
  304. border-bottom: none;
  305. text-decoration: none;
  306. }
  307. #wrapper {
  308. margin: 0 auto;
  309. margin-top: 1px;
  310. margin-bottom: 10px;
  311. }
  312. .sitewrapper {
  313. margin-left: auto;
  314. margin-right: auto;
  315. }
  316. /* The theme meta areas */
  317. .headermeta_left {
  318. font-size: 12px;
  319. width: 50%;
  320. text-align: left;
  321. }
  322. .headermeta_right {
  323. font-size: 12px;
  324. width: 45%;
  325. text-align: right;
  326. float: right;
  327. clear: left;
  328. }
  329. .footermeta_left {
  330. font-size: 12px;
  331. width: 50%;
  332. text-align: left;
  333. padding-top: 5px;
  334. padding-bottom: 10px;
  335. }
  336. .footermeta_right {
  337. font-size: 12px;
  338. width: 40%;
  339. text-align: right;
  340. float: right;
  341. padding-top: 5px;
  342. padding-bottom: 10px;
  343. }
  344. /* The theme header area */
  345. #header {
  346. padding: 0 0 0 0px;
  347. }
  348. #branding {
  349. margin: 0 auto;
  350. position: relative;
  351. }
  352. #branding .headerblock {
  353. margin: 0 auto;
  354. position: absolute;
  355. color: transparent;
  356. top: 0;
  357. left: 0;
  358. overflow: hidden;
  359. cursor:pointer;
  360. }
  361. #branding #title-box {
  362. position: absolute;
  363. }
  364. #branding #title-box a {
  365. text-decoration:none;
  366. border:0;
  367. }
  368. #branding #title-box a:hover {
  369. text-decoration:none;
  370. border:0;
  371. }
  372. #branding #site-title {
  373. margin-bottom: 4px;
  374. display:inline-block;
  375. padding:0 3px;
  376. }
  377. #branding #site-description {
  378. display:inline-block;
  379. padding:0 3px;
  380. cursor:pointer;
  381. }
  382. .headerblock {
  383. background-image: url(".$translucence_custom_header_image.");
  384. background-position: center center;
  385. background-repeat: no-repeat;
  386. }
  387. #content {
  388. float: left;
  389. position:relative;
  390. margin-bottom: 25px;
  391. }
  392. #primary,
  393. #secondary,
  394. #tertiary {
  395. float: left;
  396. position:relative;
  397. }
  398. #primary {
  399. display:".$translucence_options['right01-visibility']."
  400. }
  401. #secondary {
  402. display:".$translucence_options['right02-visibility']."
  403. }
  404. #tertiary {
  405. display:".$translucence_options['left01-visibility']."
  406. }
  407. #footer-widget-area {
  408. overflow: hidden;
  409. padding: 20px 0px 0px 4px;
  410. }
  411. #footer-widget-area .widget-area {
  412. float: left;
  413. background-color: transparent;
  414. margin-right: 1px;
  415. }
  416. #footer-widget-area #fourth {
  417. margin-right: 0;
  418. }
  419. #syndication{
  420. width: 100%;
  421. text-align: right;
  422. font-size: 11px;
  423. padding: 0px 0 10px 0;
  424. white-space:nowrap;
  425. }
  426. #syndication a.feed {
  427. padding: 5px 2px 0px 23px;
  428. background: url(".$translucence_syndication_image.") no-repeat 0 1px;
  429. border-bottom: none;
  430. }
  431. .catlinks a,
  432. .taglinks a {
  433. border: 1px solid #666666;
  434. cursor: pointer;
  435. display: inline-block;
  436. margin: 2px 0.2em;
  437. padding: 0.1em 0.2em;
  438. }
  439. .options {
  440. margin-top: 5px;
  441. margin-bottom: 5px;
  442. margin-right: 5px;
  443. margin-left: 5px;
  444. background-color: #fff;
  445. font-size: 10px;
  446. line-height: 1.5em;
  447. padding: 10px;
  448. border: 1px dotted #CCCCCC;
  449. }
  450. .option-group {
  451. color: #333333;
  452. }
  453. .option-label {
  454. color: #333333;
  455. }
  456. .option-label:hover {
  457. color: #333333;
  458. }
  459. .option-label-dimmed {
  460. color: #CCCCCC;
  461. }
  462. .option-label-dimmed:hover {
  463. color: #333333;
  464. }
  465. .option-row {
  466. width: 100%;
  467. color: #CCCCCC;
  468. background-color: #fff;
  469. border-bottom: 1px dotted;
  470. padding: 2px;
  471. }
  472. .option-row:hover {
  473. background-color: #F8F8F8;
  474. color: #000000;
  475. }
  476. .instructions {
  477. margin-top: 5px;
  478. margin-bottom: 5px;
  479. margin-right: 0px;
  480. margin-left: 0px;
  481. background-color: #fffeeb;
  482. color: #000000;
  483. font-size: 10px;
  484. line-height: 1.5em;
  485. padding: 5px;
  486. border: 1px solid #CCCCCC;
  487. }
  488. .widgetbox {
  489. font-size: 10px;
  490. border-width: 1px;
  491. border-style: solid;
  492. padding: 5px;
  493. margin: 3px;
  494. }
  495. #appgroupedit textarea {
  496. width: 300px;
  497. }
  498. .metatext {
  499. font-size: 9px;
  500. color: ".$translucence_options['bglinkcolor'].";
  501. }
  502. .metatext a {
  503. color: ".$translucence_options['bglinkcolor'].";
  504. }
  505. .horizontalbar {
  506. padding-top: 4px;
  507. padding-bottom: 4px;
  508. margin-bottom: 4px;
  509. text-align: right;
  510. }
  511. #primary a,
  512. #secondary a,
  513. #tertiary a {
  514. border: 1px dotted;
  515. }
  516. #primary post-link {
  517. border-color: ".$translucence_options['right01-link-color'].";
  518. margin-right: 5px;
  519. margin-left: 5px;
  520. }
  521. .post-link {
  522. border-color: ".$translucence_options['bgtextcolor'].";
  523. margin-right: 5px;
  524. margin-left: 5px;
  525. }
  526. .editwidgetlink {
  527. display: block;
  528. color: ".$translucence_options['linkcolor'].";
  529. }
  530. .editwidgetlink a {
  531. display: block;
  532. color: ".$translucence_options['linkcolor'].";
  533. border: 1px dotted;
  534. padding: 3px;
  535. margin-bottom: 3px;
  536. }
  537. .editwidgetlink a:hover {
  538. border: 1px solid;
  539. text-decoration: none;
  540. }
  541. .editheaderlink {
  542. color: ".$translucence_options['bglinkcolor'].";
  543. font-size: 9px;
  544. white-space:nowrap;
  545. }
  546. .editheaderlink a {
  547. color: ".$translucence_options['bglinkcolor'].";
  548. padding: 3px;
  549. border: 1px dotted ".$translucence_options['bglinkcolor'].";
  550. }
  551. .editheaderlink a:hover {
  552. border: 1px solid ".$translucence_options['bglinkcolor'].";
  553. text-decoration: none;
  554. color: ".$translucence_options['bglinkcolor'].";
  555. }
  556. .modelheadertextposition {
  557. font-size: 20px;
  558. margin-left: 5px;
  559. padding-top: ".$translucence_options['header-text-padding-top']."px;
  560. color: ".$translucence_options['site-title-color'].";
  561. }
  562. .warning {
  563. color: #900;
  564. font-weight: bold;
  565. }
  566. .notify {
  567. color: #009933;
  568. font-weight: bold;
  569. }
  570. </style>
  571. ";
  572. print "<!--[if IE]>";
  573. print "<style type='text/css'>";
  574. print $translucence_options['header-color-ie']."\n";
  575. print $translucence_options['title-box-color-ie']."\n";
  576. print $translucence_options['description-box-color-ie']."\n";
  577. print $translucence_options['right02-color-ie']."\n";
  578. print $translucence_options['top-color-ie']."\n";
  579. // print $translucence_options['submenu-color-ie']."\n";
  580. print $translucence_options['content-color-ie']."\n";
  581. print $translucence_options['bottom-color-ie']."\n";
  582. print $translucence_options['left01-color-ie']."\n";
  583. print $translucence_options['right01-color-ie']."\n";
  584. print $translucence_options['right02-color-ie']."\n";
  585. print $translucence_options['cat-links-color-ie']."\n";
  586. print $translucence_options['tag-links-color-ie']."\n";
  587. print "#access ul ul {border-left: 1px solid #ccc; border-right: 1px solid #ccc;}";
  588. print "</style>";
  589. print "<![endif]-->";
  590. $translucence_theme_model_css = ob_get_contents();
  591. ob_end_clean();
  592. return $translucence_theme_model_css;
  593. }
  594. /**
  595. * Gets theme options UI for header left meta options
  596. *
  597. * @since 2010 Translucence 1.0
  598. * @return string html for theme options UI
  599. */
  600. function translucence_headermeta_left() {
  601. global $translucence_config, $translucence_options, $translucence_options_id;
  602. ob_start();
  603. print "<div class='metatext'>";
  604. if ($translucence_options['headerleft'] == "") {
  605. print "no links defined...";
  606. } else {
  607. print $translucence_options['headerleft'];
  608. }
  609. // if header left links selection is custom
  610. if ($translucence_options['header-meta-left'] == 'custom') {
  611. print "
  612. <input id='appgroupdo' type='hidden' name='appgroupdo' value='0'/> -
  613. <a href='javascript: document.getElementById(\"appgroupedit\").style.display = \"block\"; document.getElementById(\"appgroupdo\").value = \"1\"; exit; '>edit</a>
  614. <div id='appgroupedit' style='display: none;'>
  615. <textarea name='".$translucence_options_id."[headerleftcustom].' style='width: 100%; height: 50px; font-size: 10px;' class='code'>";
  616. print stripslashes(stripslashes(trim($translucence_options['headerleftcustom'])));
  617. print "</textarea>
  618. &nbsp;&nbsp;&nbsp;
  619. <a href='javascript: document.getElementById(\"appgroupedit\").style.display = \"none\"; document.getElementById(\"appgroupdo\").value = \"0\"; exit;'>Cancel</a> -
  620. <span class='submit'><input type='submit' value='Update' name='save'/></span>
  621. </div>
  622. ";
  623. }
  624. print "</div>";
  625. $headermeta_left = ob_get_contents();
  626. ob_end_clean();
  627. return $headermeta_left;
  628. }
  629. /**
  630. * Gets theme options UI for header right meta options
  631. *
  632. * @since 2010 Translucence 1.0
  633. * @return string html for theme options UI
  634. */
  635. function translucence_headermeta_right() {
  636. global $translucence_config, $translucence_options, $translucence_options_id;
  637. ob_start();
  638. print "<div class='metatext'>";
  639. if ($translucence_options['headerright'] == "") {
  640. print "no links defined...";
  641. } else {
  642. print $translucence_options['headerright'];
  643. }
  644. // if header right links selection is custom
  645. if ($translucence_options['header-meta-right'] == 'custom') {
  646. print "
  647. <input id='headerrightdo' type='hidden' name='headerrightdo' value='0'/> -
  648. <a href='javascript: document.getElementById(\"headerrightedit\").style.display = \"block\"; document.getElementById(\"headerrightdo\").value = \"1\"; exit; '>edit</a>
  649. <div id='headerrightedit' style='display: none;'>
  650. <textarea name='".$translucence_options_id."[headerrightcustom].' style='width: 100%; height: 50px; font-size: 10px;' class='code'>";
  651. print stripslashes(stripslashes(trim($translucence_options['headerrightcustom'])));
  652. print "</textarea>
  653. &nbsp;&nbsp;&nbsp;
  654. <a href='javascript: document.getElementById(\"headerrightedit\").style.display = \"none\"; document.getElementById(\"headerrightdo\").value = \"0\"; exit;'>Cancel</a> -
  655. <span class='submit'><input type='submit' value='Update' name='save'/></span>
  656. </div>
  657. ";
  658. }
  659. print "</div>";
  660. $headermeta_right = ob_get_contents();
  661. ob_end_clean();
  662. return $headermeta_right;
  663. }
  664. /**
  665. * Gets theme options UI for global options
  666. *
  667. * @uses translucence_get_option_modes() to get option modes
  668. * @uses translucence_get_active_options() to get options that are active for a given option mode
  669. * @uses translucence_get_option_selector() to generate select field for a given option
  670. * @uses translucence_get_option_field() to display a field for a given option
  671. *
  672. * @since 2010 Translucence 1.0
  673. * @return string html of global options for theme options UI
  674. */
  675. function translucence_get_global_options() {
  676. global $translucence_config, $translucence_options, $translucence_options_values, $translucence_variations;
  677. global $translucence_options_id;
  678. global $translucence_custom_header_set, $translucence_custom_background_set, $active_options;
  679. ob_start();
  680. print "<div class='options'>";
  681. print "<table style='width: 100%;'>";
  682. print "<tr>";
  683. // Variation options
  684. print "<td style='width: 70%; text-align: left; border-bottom: 1px solid; padding-bottom: 5px; '>";
  685. if (in_array("background", $translucence_config['model'])) {
  686. print "<div>";
  687. print "<select name='".$translucence_options_id."[background]' style='font-size: 14px;' onchange='this.form.submit();'>";
  688. // variations defined in variations folder
  689. foreach ($translucence_variations as $label => $value) {
  690. if (!in_array($value, $translucence_config['variations_disabled']))
  691. print "\n<option value='".$value."'".($translucence_options['background'] == $value ? ' selected' : '') . ">".$label."</option>";
  692. }
  693. print "</select>";
  694. print __( '', '2010-translucence' )."<span class='option-label'>";
  695. translucence_get_option_selector ("", "variation-type", $translucence_options_values['variation-type'], 'active');
  696. print "</span>";
  697. print "</div>";
  698. if ($translucence_custom_background_set == 1) {
  699. print "<div style='font-size: 10px; text-align: left; border-color: ".$translucence_options['bgtextcolor']."'>";
  700. print "(Custom background color or image may change the background of this variation)";
  701. print "</div>";
  702. }
  703. }
  704. print "</td>";
  705. // options mode values (used in translucence_get_active_options)
  706. $translucence_options_values['mode'] = translucence_get_option_modes();
  707. print "<td style='width: 30%; text-align: right; border-bottom: 1px solid; padding-bottom: 5px;'>";
  708. print __( 'Options Mode', '2010-translucence' ).":<span class='option-label'>";
  709. translucence_get_option_selector ("", "options-mode", $translucence_options_values['mode'], 'active');
  710. print "</span>";
  711. print "</td>";
  712. print "</tr>";
  713. print "</table>";
  714. // global options for: site, header, site title, tagline and header meta
  715. print "<table style='width: 100%;'>";
  716. print "<tr>";
  717. // get active options
  718. if (in_array('options-mode', $translucence_config['model'])) {
  719. $active_options = translucence_get_active_options($translucence_options['options-mode']);
  720. }
  721. // site width, color, opacity and border options
  722. if (in_array('site-options', $active_options)) {
  723. print "<td class='option-row'>";
  724. //site width
  725. print "<span class='option-label'>".__( 'Site', '2010-translucence' )."</span>";
  726. $translucence_title = __( 'width', '2010-translucence' );
  727. translucence_get_option_selector ($translucence_title, "site-width", $translucence_options_values['site-width']);
  728. // site color
  729. if ($translucence_options['variation-type'] == "custom") {
  730. $translucence_title = __( 'color', '2010-translucence' );
  731. translucence_get_option_selector ($translucence_title, "site-color", $translucence_options_values['sidebar-color']);
  732. // site opacity
  733. $translucence_title = __( 'opacity', '2010-translucence' );
  734. translucence_get_option_selector ($translucence_title, "site-opacity", $translucence_options_values['header-opacity']);
  735. // site border
  736. $translucence_title = __( 'border', '2010-translucence' );
  737. translucence_get_option_selector ($translucence_title, "site-border-style", $translucence_options_values['border-style']);
  738. }
  739. print "</td>";
  740. print "</tr>";
  741. // if not in active_options print out as hidden fields
  742. } else {
  743. translucence_get_option_selector ("", "site-width", $translucence_options_values['site-width'])."<br/>";
  744. translucence_get_option_selector ("", "site-color", $translucence_options_values['sidebar-color'])."<br/>";
  745. translucence_get_option_selector ("", "site-opacity", $translucence_options_values['header-opacity'])."<br/>";
  746. translucence_get_option_selector ("", "site-border-style", $translucence_options_values['border-style'])."<br/>";
  747. }
  748. // header height, color, opacity, border options
  749. if (in_array('header-options', $active_options)) {
  750. print "<tr>";
  751. print "<td class='option-row'>";
  752. // header height options
  753. print "<span class='option-label'>".__( 'Header', '2010-translucence' )."</span>";
  754. $translucence_title = __( 'height', '2010-translucence' );
  755. translucence_get_option_selector ($translucence_title, "header-block-height", $translucence_options_values['header-block-height']);
  756. // header color
  757. if ($translucence_options['variation-type'] == "custom") {
  758. $translucence_title = __( 'color', '2010-translucence' );
  759. translucence_get_option_selector ($translucence_title, "header-color", $translucence_options_values['header-color']);
  760. }
  761. if ($translucence_options['variation-type'] == "custom") {
  762. // header opacity
  763. $translucence_title = __( 'opacity', '2010-translucence' );
  764. translucence_get_option_selector ($translucence_title, "header-opacity", $translucence_options_values['header-opacity']);
  765. // header border
  766. $translucence_title = __( 'border', '2010-translucence' );
  767. translucence_get_option_selector ($translucence_title, "header-border-style", $translucence_options_values['border-style']);
  768. }
  769. print "</td>";
  770. print "</tr>";
  771. // if not in active_options print out as hidden fields
  772. } else {
  773. translucence_get_option_selector ("", "header-block-height", $translucence_options_values['header-block-height']);
  774. translucence_get_option_selector ("", "header-color", $translucence_options_values['header-color']);
  775. translucence_get_option_selector ("", "header-opacity", $translucence_options_values['header-opacity']);
  776. translucence_get_option_selector ("", "header-border-style", $translucence_options_values['border-style']);
  777. }
  778. // header text size color shadow, box and position
  779. if (in_array('site-title-options', $active_options) || $translucence_custom_header_set == 1) {
  780. print "<tr>";
  781. print "<td class='option-row'>";
  782. if (in_array('site-title-options', $active_options)) {
  783. // header-text-size options
  784. if (in_array("site-title-size", $translucence_config['model'])) {
  785. print "<span class='option-label'>".__( 'Site Title', '2010-translucence' )." </span>";
  786. $translucence_title = __( 'size', '2010-translucence' );
  787. translucence_get_option_selector ($translucence_title, "site-title-size", $translucence_options_values['header-text-size']);
  788. }
  789. // header-text-color options
  790. // if (in_array("site-title-color", $translucence_config['model']) && $translucence_options['variation-type'] == "custom") {
  791. // $translucence_title = __( 'color', '2010-translucence' );
  792. // translucence_get_option_field ($translucence_title, "site-title-color", 6);
  793. // }
  794. // header-text-offset options
  795. if (in_array("header-text-shadow-offset", $translucence_config['model']) && $translucence_options['variation-type'] == "custom") {
  796. $translucence_title = __( 'offset', '2010-translucence' );
  797. translucence_get_option_selector ($translucence_title, "header-text-shadow-offset", $translucence_options_values['text-shadow-offset']);
  798. }
  799. // header-text-blur options
  800. if (in_array("header-text-shadow-blur", $translucence_config['model']) && $translucence_options['variation-type'] == "custom") {
  801. $translucence_title = __( 'blur', '2010-translucence' );
  802. translucence_get_option_selector ($translucence_title, "header-text-shadow-blur", $translucence_options_values['text-shadow-blur']);
  803. }
  804. }
  805. if (in_array('site-title-box-options', $active_options) || $translucence_custom_header_set == 1) {
  806. translucence_get_option_field ("Color: #", "site-title-color", 6);
  807. // header-text-box options
  808. if (in_array("title-box-color", $translucence_config['model'])) {
  809. print "<span class='option-label'> ".__( 'Site Title Box', '2010-translucence' )."</span>";
  810. $translucence_title = __( 'color', '2010-translucence' );
  811. translucence_get_option_selector ($translucence_title, "title-box-color", $translucence_options_values['header-color']);
  812. }
  813. if (in_array("title-box-opacity", $translucence_config['model'])) {
  814. $translucence_title = __( 'opacity', '2010-translucence' );
  815. translucence_get_option_selector ($translucence_title, "title-box-opacity", $translucence_options_values['header-opacity']);
  816. }
  817. // header-text-display options
  818. if (in_array("header-text-display", $translucence_config['model'])) {
  819. print "
  820. <span class='option-label' <span style='font-size: 10px;'>".__( 'position', '2010-translucence' )."
  821. <select name='".$translucence_options_id."[header-text-display]' class='option-label-dimmed' style='font-size: 10px;' onchange='this.form.submit();'>
  822. <option value='middle' ".($translucence_options['header-text-display'] == 'middle' ? ' selected' : '') . ">".__( 'Middle', '2010-translucence' )."</option>
  823. <option value='top' ".($translucence_options['header-text-display'] == 'top' ? ' selected' : '') . ">".__( 'Top', '2010-translucence' )."</option>
  824. <option value='bottom' ".($translucence_options['header-text-display'] == 'bottom' ? ' selected' : '') . ">".__( 'Bottom', '2010-translucence' )."</option>
  825. <option value='hide' ".($translucence_options['header-text-display'] == 'hide' ? ' selected' : '') . ">".__( 'Hide', '2010-translucence' )."</option>
  826. <option value='above' ".($translucence_options['header-text-display'] == 'above' ? ' selected' : '') . ">".__( 'Above', '2010-translucence' )."</option>
  827. </select>
  828. </span></span>";
  829. }
  830. }
  831. print "</td>";
  832. print "</tr>";
  833. // if not in active_options print out as hidden fields
  834. } else {
  835. translucence_get_option_selector ("size: ", "site-title-size", $translucence_options_values['header-text-size']);
  836. //translucence_get_option_field ("Color: #", "site-title-color", 6);
  837. translucence_get_option_selector ("offset: ", "header-text-shadow-offset", $translucence_options_values['text-shadow-offset']);
  838. translucence_get_option_selector ("blur: ", "header-text-shadow-blur", $translucence_options_values['text-shadow-blur']);
  839. translucence_get_option_selector ("color: ", "title-box-color", $translucence_options_values['header-color']);
  840. translucence_get_option_selector ("opacity:", "title-box-opacity", $translucence_options_values['header-opacity']);
  841. print "<input type='hidden' name='".$translucence_options_id."[header-text-display]' value = '".$translucence_options['header-text-display']."'/>";
  842. }
  843. // Tagline text size, color, box
  844. if (in_array('tagline-options', $active_options) || $translucence_custom_header_set == 1) {
  845. print "<tr>";
  846. print "<td class='option-row'>";
  847. // text size and color
  848. if (in_array('site-description-size', $active_options)) {
  849. // header-description-size options
  850. if (in_array("site-description-size", $translucence_config['model'])) {
  851. print "<span class='option-label'>".__( 'Tagline', '2010-translucence' )."</span><span class='option-label'>";
  852. $translucence_title = __( 'size', '2010-translucence' );
  853. translucence_get_option_selector ("size: ", "site-description-size", $translucence_options_values['header-text-size']);
  854. print "</span>";
  855. }
  856. // if not in active_options print out as hidden fields
  857. } else {
  858. translucence_get_option_selector ("size: ", "site-description-size", $translucence_options_values['header-text-size']);
  859. }
  860. if (in_array('site-description-color', $active_options)) {
  861. // header-description-color options
  862. if (in_array("site-description-color", $translucence_config['model'])) {
  863. print "<span class='option-label'>";
  864. $translucence_title = __( 'Color #', '2010-translucence' );
  865. translucence_get_option_field ($translucence_title, "site-description-color", 6);
  866. print "</span>";
  867. }
  868. // if not in active_options print out as hidden fields
  869. } else {
  870. translucence_get_option_field ("color: #", "site-description-color", 6);
  871. }
  872. if (in_array('description-box-color', $active_options) || $translucence_custom_header_set == 1) {
  873. if (in_array("description-box-color", $translucence_config['model'])) {
  874. print "<span class='option-label'> ".__( 'Tagline box', '2010-translucence' )."</span><span class='option-label'>";
  875. $translucence_title = __( 'color', '2010-translucence' );
  876. translucence_get_option_selector ($translucence_title, "description-box-color", $translucence_options_values['header-color']);
  877. print "</span>";
  878. }
  879. if (in_array("description-box-opacity", $translucence_config['model'])) {
  880. print "<span class='option-label'>";
  881. $translucence_title = __( 'opacity', '2010-translucence' );
  882. translucence_get_option_selector ($translucence_title, "description-box-opacity", $translucence_options_values['header-opacity']);
  883. print "</span>";
  884. }
  885. // if not in active_options print out as hidden fields
  886. } else {
  887. translucence_get_option_selector ("color:", "description-box-color", $translucence_options_values['header-color']);
  888. translucence_get_option_selector ("opacity:", "description-box-opacity", $translucence_options_values['header-opacity']);
  889. }
  890. print "</td>";
  891. print "</tr>";
  892. // if not in active_options print out as hidden fields
  893. } else {
  894. translucence_get_option_selector ("size: ", "site-description-size", $translucence_options_values['header-text-size']);
  895. translucence_get_option_field ("color: #", "site-description-color", 6);
  896. translucence_get_option_selector ("color:", "description-box-color", $translucence_options_values['header-color']);
  897. translucence_get_option_selector ("opacity:", "description-box-opacity", $translucence_options_values['header-opacity']);
  898. }
  899. print "</table>";
  900. // headermeta right and left options
  901. if (in_array('headermeta-options', $active_options)) {
  902. print "<table style='width: 100%;'>";
  903. print "<tr>";
  904. // headermeta left options
  905. print "<td style='width: 50%'>";
  906. if (in_array("header-meta-left", $translucence_config['model'])) {
  907. print "<span style='font-size: 9px;'>".__( 'Left Header Links', '2010-translucence' )."</span>\n";
  908. print "<select name='".$translucence_options_id."[header-meta-left]' style='font-size: 10px;' onchange='this.form.submit();'>";
  909. foreach (array_keys($translucence_config['header_meta_left_options']) as $meta_left_option) {
  910. print "<option value='".$translucence_config['header_meta_left_options'][$meta_left_option]['option_name']."' ";
  911. print ($translucence_options['header-meta-left'] == $translucence_config['header_meta_left_options'][$meta_left_option]['option_name'] ? ' selected' : '') . ">";
  912. print $translucence_config['header_meta_left_options'][$meta_left_option]['option_label']."</option>";
  913. }
  914. print "</select>";
  915. }
  916. print "</td>";
  917. // headermeta right options
  918. print "<td style='width: 50%; text-align: right;'>";
  919. if (in_array("header-meta-right", $translucence_config['model'])) {
  920. print "
  921. <span style='font-size: 9px;'>".__( 'Right Header Links', '2010-translucence' ).":</span>\n";
  922. print "<select name='".$translucence_options_id."[header-meta-right]' style='font-size: 10px;' onchange='this.form.submit();'>";
  923. foreach (array_keys($translucence_config['header_meta_right_options']) as $meta_right_option) {
  924. print "<option value='".$translucence_config['header_meta_right_options'][$meta_right_option]['option_name']."' ";
  925. print ($translucence_options['header-meta-right'] == $translucence_config['header_meta_right_options'][$meta_left_option]['option_name'] ? ' selected' : '') . ">";
  926. print $translucence_config['header_meta_right_options'][$meta_right_option]['option_label']."</option>";
  927. }
  928. print "</select>"; }
  929. print "</td>";
  930. print "</tr>";
  931. print "</table>";
  932. // if not in active_options print out as hidden fields
  933. } else {
  934. print "<input type='hidden' name='".$translucence_options_id."[header-meta-left]' value='".$translucence_options['header-meta-left']."'/>";
  935. //print "<input type='hidden' name='".$translucence_options_id."[headermeta]' value='".$translucence_options['headermeta']."'/>";
  936. }
  937. print "<div style='font-size: 10px;'>";
  938. if ($translucence_options['options-mode'] != "global" && $translucence_options['options-mode'] != "advanced") {
  939. print __( 'For more site and header options see', '2010-translucence' ).": ";
  940. print "<a style='color: #003366;' href='javascript:setThemeOptionsMode(\"basic\", \"".$translucence_options_id."\")'>Basic Options</a> | ";
  941. print "<a style='color: #003366;' href='javascript:setThemeOptionsMode(\"global\", \"".$translucence_options_id."\")'>Global Options</a>";
  942. } else {
  943. print __( 'For basic options see', '2010-translucence' ).": ";
  944. print "<a style='color: #003366;' href='javascript:setThemeOptionsMode(\"basic\", \"".$translucence_options_id."\")'>Basic Options</a>";
  945. }
  946. print "</div>";
  947. print "</div>";
  948. $global_options = ob_get_contents();
  949. ob_end_clean();
  950. return $global_options;
  951. }
  952. /**
  953. * Gets theme options UI for custom options
  954. *
  955. * @since 2010 Translucence 1.0
  956. * @return string html of custom options for theme options UI
  957. */
  958. function translucence_get_custom_options() {
  959. global $translucence_config, $translucence_options, $translucence_options_values;
  960. global $translucence_options_id;
  961. global $translucence_custom_header_set, $translucence_custom_background_set;
  962. ob_start();
  963. print "<div class='options' style='background-color: transparent; clear: both; border: none; margin-bottom: 35px;'>";
  964. if ($translucence_custom_header_set == 1) {
  965. print "<div class='post-link' style='float: left; width: 40%;'>";
  966. print "<a style='color:".$translucence_options['bglinkcolor']."; border-color:".$translucence_options['bgtextcolor']." ' href='".get_bloginfo('url')."/wp-admin/themes.php?page=custom-header'>".__( 'Edit Custom Header', '2010-translucence')."</a>";
  967. print "</div>";
  968. } else {
  969. print "<div class='post-link' style='float: left; width: 55%;'>";
  970. print "<a style='color:".$translucence_options['bglinkcolor']."; border-color:".$translucence_options['bgtextcolor']." ' href='".get_bloginfo('url')."/wp-admin/themes.php?page=custom-header'>".__( 'Add Custom Header', '2010-translucence')."</a>";
  971. print "</div>";
  972. }
  973. if ($translucence_custom_background_set == 1) {
  974. print "<div class='post-link' style='float: right; width: 40%;'>";
  975. print "<a style='color:".$translucence_options['bglinkcolor']."; border-color:".$translucence_options['bgtextcolor']." ' href='".get_bloginfo('url')."/wp-admin/themes.php?page=custom-background'>".__( 'Edit Custom Background', '2010-translucence')."</a>";
  976. print "</div>";
  977. } else {
  978. print "<div class='post-link' style='float: right; width: 40%; '>";
  979. print "<a style='color:".$translucence_options['bglinkcolor']."; border-color:".$translucence_options['bgtextcolor']." ' href='".get_bloginfo('url')."/wp-admin/themes.php?page=custom-background'>".__( 'Add Custom Background', '2010-translucence')."</a>";
  980. print "</div>";
  981. }
  982. if ($translucence_options['header-text-display'] == "hide") {
  983. print "<div style='float: left; color:".$translucence_options['bglinkcolor']."; padding-bottom: 10px;'>";
  984. print "<em>".__( 'Site Title and description are hidden', '2010-translucence')."</em> ";
  985. // print "display: <input type='checkbox' name='header-text-display' id='header-text-display'".(isset($translucence_options['header-text-display']) && $translucence_options['header-text-display'] != 'hide' ? ' checked' : '')." onchange='this.form.submit();'/>";
  986. print "</div>";
  987. }
  988. print "</div>";
  989. $custom_options = ob_get_contents();
  990. ob_end_clean();
  991. return $custom_options;
  992. }
  993. /**
  994. * Gets theme options UI for layout options
  995. *
  996. * @uses translucence_get_option_selector() to generate select field for a given option
  997. * @uses is_active_sidebar() to determine if sidebar has widgets
  998. *
  999. * @since 2010 Translucence 1.0
  1000. * @return string html of layout options for theme options UI
  1001. */
  1002. function translucence_get_layout_options() {
  1003. global $translucence_config, $translucence_options, $translucence_options_values, $translucence_model_content_width;
  1004. global $translucence_options_id, $active_options;
  1005. ob_start();
  1006. if (in_array('layout-options', $active_options)) {
  1007. print "<div class='options' style='background-color: transparent; clear: both;'>";
  1008. print "<div style='font-size: 10px; text-align: center;'>&larr; ".$translucence_model_content_width." px &rarr;<br/>";
  1009. if ($translucence_options['variation-type'] == "custom") {
  1010. print "<span style='font-size: 10px;'>".__( 'Content', '2010-translucence')."</span>\n";
  1011. translucence_get_option_selector ("", "content-color", $translucence_options_values['sidebar-color']);
  1012. translucence_get_option_selector ("", "content-opacity", $translucence_options_values['sidebar-opacity']);
  1013. translucence_get_option_selector ("", "content-border-style", $translucence_options_values['border-style']);
  1014. }
  1015. print "</div>";
  1016. print "<table style='width: 100%;'>";
  1017. print "<tr>";
  1018. // left sidebar
  1019. print "<td>";
  1020. print "<div>".__( 'Left Sidebar', '2010-translucence')."</div>\n";
  1021. // hidden widgets warning
  1022. if (is_active_sidebar("sidebar-1") && $translucence_options['left01-width'] == 0) {
  1023. print "<span class='warning' style='font-size: 10px'>".__( 'hidden widgets!', '2010-translucence')."</span>";
  1024. }
  1025. //width
  1026. translucence_get_option_selector ("", "left01-width", $translucence_options_values['sidebar-width']);
  1027. print "</td>";
  1028. // Right sidebar
  1029. print "<td style='text-align: right;'>";
  1030. print "<div>".__( '1st Right Sidebar', '2010-translucence')."</div>\n";
  1031. // hidden widgets warning
  1032. if (is_active_sidebar("primary-widget-area") && $translucence_options['right01-width'] == 0) {
  1033. print "<span class='warning' style='font-size: 10px'>".__( 'hidden widgets!', '2010-translucence')."</span>";
  1034. }
  1035. // width
  1036. translucence_get_option_selector ("", "right01-width", $translucence_options_values['sidebar-width']);
  1037. print "</td>";
  1038. print "</tr>";
  1039. print "<tr>";
  1040. // Default Post Display
  1041. print "<td>";
  1042. print "<div>".__( 'Default Post Display', '2010-translucence')."</div>\n";
  1043. translucence_get_option_selector ("", "default-post-display", $translucence_options_values['post-display']);
  1044. print "</td>";
  1045. // 2nd Right sidebar
  1046. print "<td style='text-align: right;'>";
  1047. print "<div>".__( '2nd Right Sidebar', '2010-translucence')."</div>\n";
  1048. // hidden widgets warning
  1049. if (is_active_sidebar("secondary-widget-area") && $translucence_options['right02-width'] == 0) {
  1050. print "<span class='warning' style='font-size: 10px'>".__( 'hidden widgets!', '2010-translucence')."</span>";
  1051. }
  1052. // width
  1053. translucence_get_option_selector ("", "right02-width", $translucence_options_values['sidebar-width']);
  1054. print "</td>";
  1055. print "</tr>";
  1056. print "</table>";
  1057. print __( 'For more sidebar options, see', '2010-translucence').": ";
  1058. print "<a href='javascript:setThemeOptionsMode(\"layout\", \"".$translucence_options_id."\")'>".__( 'Layout Options', '2010-translucence')."</a> | ";
  1059. print "<a href='javascript:setThemeOptionsMode(\"sidebar\", \"".$translucence_options_id."\")'>".__( 'Sidebar Options', '2010-translucence')."</a>";
  1060. print "</div>";
  1061. if ($translucence_options['options-mode'] == "layout") {
  1062. print "<input type='hidden' name='".$translucence_options_id."[site-title-color]' value = '".$translucence_options['site-title-color']."'/>";
  1063. print "<input type='hidden' name='".$translucence_options_id."[site-description-color]' value = '".$translucence_options['site-description-color']."'/>";
  1064. }
  1065. // if not in active_options print out as hidden fields
  1066. } else {
  1067. translucence_get_option_selector ("", "content-color", $translucence_options_values['sidebar-color']);
  1068. translucence_get_option_selector ("", "content-opacity", $translucence_options_values['sidebar-opacity']);
  1069. translucence_get_option_selector ("", "content-border-style", $translucence_options_values['border-style']);
  1070. translucence_get_option_selector ("", "left01-width", $translucence_options_values['sidebar-width']);
  1071. translucence_get_option_selector ("", "right01-width", $translucence_options_values['sidebar-width']);
  1072. translucence_get_option_selector ("", "right02-width", $translucence_options_values['sidebar-width']);
  1073. print "<div style='font-size: 10px;'>";
  1074. print __( 'For more sidebar layout options, see', '2010-translucence').": ";
  1075. print "<a href='javascript:setThemeOptionsMode(\"layout\", \"".$translucence_options_id."\")'>".__( 'Layout Options', '2010-translucence')."</a>";
  1076. print "</div>";
  1077. }
  1078. $entry_options = ob_get_contents();
  1079. ob_end_clean();
  1080. return $entry_options;
  1081. }
  1082. /**
  1083. * Gets theme options UI for layout options
  1084. *
  1085. * @uses translucence_get_option_selector() to generate select field for a given option
  1086. *
  1087. * @since 2010 Translucence 1.0
  1088. * @return string html of top navigation options for theme options UI
  1089. */
  1090. function translucence_get_topmenu_options() {
  1091. global $translucence_config, $translucence_options, $translucence_options_values;
  1092. global $translucence_options_id;
  1093. ob_start();
  1094. print "<div style='padding: 10px;'>";
  1095. //print "<span style='padding-top: 0px; font-size: 10px; float: left;'>Navigation</span>";
  1096. print "<div style='font-size: 8px; float: left; margin-bottom: 10px;'>";
  1097. if ($translucence_options['variation-type'] == "custom") {
  1098. translucence_get_option_selector ("", "top-color", $translucence_options_values['sidebar-color']);
  1099. translucence_get_option_selector ("", "top-opacity", $translucence_options_values['sidebar-opacity']);
  1100. translucence_get_option_selector ("", "top-border-style", $translucence_options_values['border-style']);
  1101. }
  1102. print"</div>";
  1103. print "</div>";
  1104. $topmenu_options = ob_get_contents();
  1105. ob_end_clean();
  1106. return $topmenu_options;
  1107. }
  1108. /**
  1109. * Gets theme options UI for post options
  1110. *
  1111. * @uses translucence_get_option_selector() to generate select field for a given option
  1112. *
  1113. * @since 2010 Translucence 1.0
  1114. * @return string html of post options for theme options UI
  1115. */
  1116. function translucence_get_post_options() {
  1117. global $translucence_config, $translucence_options, $translucence_options_values;
  1118. global $translucence_options_id;
  1119. ob_start();
  1120. print "<div>";
  1121. // post single sidebar options
  1122. print "<div style='float: right; clear: left; font-size: 10px;'>\n";
  1123. $translucence_title = "<span style='font-size: 9px;'>".__( 'single post pages', '2010-translucence' )." ".__( 'include', '2010-translucence' )."</span>";
  1124. translucence_get_option_selector ($translucence_title, "post-single-sidebar", $translucence_options_values['sidebar-display']);
  1125. print "</div>";
  1126. // author sidebar options
  1127. print "<div style='float: right; clear: both; font-size: 10px;'>\n";
  1128. $translucence_title = "<span style='font-size: 9px;'>".__( 'author pages', '2010-translucence' )." ".__( 'include', '2010-translucence' )."</span>";
  1129. translucence_get_option_selector ($translucence_title, "author-single-sidebar", $translucence_options_values['sidebar-display']);
  1130. print "</div>";
  1131. print "<div style='font-size: 9px;'>April 16th, 2009 by Author</div>";
  1132. // category sidebar options
  1133. print "<div style='float: right; clear: both; font-size: 10px;'>\n";
  1134. $translucence_title = "<span style='font-size: 9px;'>".__( 'category archive', '2010-translucence' )." ".__( 'include', '2010-translucence' )."</span>";
  1135. translucence_get_option_selector ("<span style='font-size: 9px;'>category archive includes</span>", "category-single-sidebar", $translucence_options_values['sidebar-display']);
  1136. print "</div>";
  1137. print "<div><span class='entry'>".__( 'Categories', '2010-translucence' ).": </span><span class='catlinks'><a href='#'>".__( 'Category', '2010-translucence' )."</a></span></div>";
  1138. // post display options
  1139. if ($translucence_options['default-post-display'] != "title") {
  1140. print "<div><br/>Lorem ipsum dolor sit amet, <span class='entry-visited'>visited link</span> adipiscing elit. Donec ac felis non mauris tristique vehicula. Nunc commodo, justo vel imperdiet cursus, leo dui <a href='#'>link</a>, vel bibendum neque justo nec ipsum. Aliquam erat volutpat. <a href='#'>another link</a> leo tellus, sagittis id mollis non, pretium a tellus.</div>";
  1141. }
  1142. // tag sidebar options
  1143. print "<div style='float: right; clear: left; font-size: 10px;'>\n";
  1144. $translucence_title = "<span style='font-size: 9px;'>".__( 'tag archive', '2010-translucence' )." ".__( 'include', '2010-translucence' )."</span>";
  1145. translucence_get_option_selector ("<span style='font-size: 9px;'>tag archive includes</span>", "tag-single-sidebar", $translucence_options_values['sidebar-display']);
  1146. print "</div>";
  1147. print "<div><span class='entry'>".__( 'Tags', '2010-translucence' ).": </span><span class='taglinks'><a href='#'>".__( 'tag', '2010-translucence' )."</a></span></div>";
  1148. print "<div class='entry' style='text-align: right;'>".__( 'No Comments', '2010-translucence' )." &#187;</div><br/>";
  1149. // search sidebar options
  1150. print "<div style='float: right; clear: both; font-size: 10px;'>";
  1151. $translucence_title = "<span style='font-size: 9px;'>".__( 'search archive', '2010-translucence' )." ".__( 'include', '2010-translucence' )."</span>";
  1152. translucence_get_option_selector ("<span style='font-size: 9px;'>search archive includes</span><br/>", "search-single-sidebar", $translucence_options_values['sidebar-display']);
  1153. print "</div>";
  1154. // page links display options
  1155. print "<div style=' font-size: 10px;'>";
  1156. $translucence_title = "<span style='font-size: 9px;'>".__( 'page links', '2010-translucence' )." ".__( 'display', '2010-translucence' )."</span>";
  1157. translucence_get_option_selector ("<span style='font-size: 9px;'>page links display</span><br/>", "page-links-display", $translucence_options_values['page-links-display']);
  1158. print "</div>";
  1159. // archives sidebar options
  1160. print "<div style=' font-size: 10px;'>";
  1161. $translucence_title = "<span style='font-size: 9px;'>".__( 'archives page', '2010-translucence' )." ".__( 'include', '2010-translucence' )."</span>";
  1162. translucence_get_option_selector ("<span style='font-size: 9px;'>archives page includes</span><br/>", "archives-single-sidebar", $translucence_options_values['sidebar-display']);
  1163. print "</div>";
  1164. if ($translucence_options['options-mode'] == "sidebar" || $translucence_options['options-mode'] == "post") {
  1165. print "<input type='hidden' name='".$translucence_options_id."[site-title-color]' value = '".$translucence_options['site-title-color']."'/>";
  1166. print "<input type='hidden' name='".$translucence_options_id."[site-description-color]' value = '".$translucence_options['site-description-color']."'/>";
  1167. }
  1168. /*********************************************************
  1169. * Text, Link, Category and Tag options
  1170. *********************************************************/
  1171. if ($translucence_options['options-mode'] == "post" || $translucence_options['options-mode'] == "advanced") {
  1172. print "
  1173. <hr/>
  1174. <table width = '100%' cellpadding='0'>
  1175. <tr><td valign='top'>
  1176. <table width = '100%' cellpadding='0'>
  1177. <tr>
  1178. <td style='border-bottom: 1px dotted;'><span style='font-size: 10px; color:".$translucence_options['textcolor'].";'>".__( 'Text', '2010-translucence' )." ".__( 'alignment', '2010-translucence' )."</span></td>
  1179. <td style='border-bottom: 1px dotted; text-align: right;'>";
  1180. // text alignment options
  1181. translucence_get_option_selector ("", "entry-text-align", $translucence_options_values['entry-text-align']);
  1182. print "
  1183. </td>
  1184. </tr>
  1185. <tr>
  1186. <td style='border-bottom: 1px dotted;'><span style='font-size: 10px; color:".$translucence_options['textcolor'].";'>".__( 'Text', '2010-translucence' )."</span></td>
  1187. <td style='border-bottom: 1px dotted; text-align: right;'>";
  1188. // text color and size options
  1189. translucence_get_option_selector ("color", "textcolor", $translucence_options_values['textcolor']);
  1190. translucence_get_option_selector ("size", "entry-text-size", $translucence_options_values['text-size']);
  1191. print "
  1192. </td>
  1193. </tr>
  1194. <tr>
  1195. <td style='border-bottom: 1px dotted;'><span style='font-size: 10px; color:".$translucence_options['linkcolor'].";'>".__( 'Link', '2010-translucence' )." ".__( 'color', '2010-translucence' )."</span></td>
  1196. <td style='border-bottom: 1px dotted; text-align: right;'>";
  1197. // link color options
  1198. if ($translucence_options['variation-type'] == "custom") {
  1199. translucence_get_option_selector ("", "linkcolor", $translucence_options_values['linkcolor']);
  1200. }
  1201. print "
  1202. </td>
  1203. </tr>
  1204. </table>
  1205. </td><td valign='top' width='50%'>
  1206. <table width = '100%' cellpadding='0'>
  1207. <tr>";
  1208. // category link style
  1209. print "
  1210. <td style='border-bottom: 1px dotted;'><span class='catlinks' style='font-size: 10px;'><a href='#'>".__( 'Categories', '2010-translucence' )."</a></span></td>
  1211. <td style='border-bottom: 1px dotted; text-align: right;'>";
  1212. if ($translucence_options['variation-type'] == "custom") {
  1213. translucence_get_option_selector ("", "cat-links-color", $translucence_options_values['sidebar-color']);
  1214. }
  1215. print "
  1216. </td>
  1217. </tr><tr>";
  1218. // Tag link style
  1219. print "
  1220. <td style='border-bottom: 1px dotted;'><span class='taglinks' style='font-size: 10px;'><a href='#'>".__( 'Tags', '2010-translucence' )."</a></span></td>
  1221. <td style='border-bottom: 1px dotted; text-align: right;'>\n";
  1222. if ($translucence_options['variation-type'] == "custom") {
  1223. translucence_get_option_selector ("", "tag-links-color", $translucence_options_values['sidebar-color']);
  1224. }
  1225. print "
  1226. </td>
  1227. </tr><tr>";
  1228. // Entry link style
  1229. print "
  1230. <td style='border-bottom: 1px dotted;'><span class='entry' style='font-size: 10px;'><a href='#'>".__( 'Entry', '2010-translucence' )." ".__( 'link', '2010-translucence' )."</a></span></td>
  1231. <td style='border-bottom: 1px dotted; text-align: right;'>\n";
  1232. translucence_get_option_selector ("", "entry-link-style", $translucence_options_values['entry-link-style']);
  1233. print "
  1234. </td></tr>
  1235. </table>
  1236. </table>";
  1237. // if not in active_options print out as hidden fields
  1238. } else {
  1239. translucence_get_option_selector ("", "entry-text-align", $translucence_options_values['entry-text-align']);
  1240. translucence_get_option_selector ("color", "textcolor", $translucence_options_values['textcolor']);
  1241. translucence_get_option_selector ("size", "entry-text-size", $translucence_options_values['text-size']);
  1242. translucence_get_option_selector ("", "linkcolor", $translucence_options_values['linkcolor']);
  1243. translucence_get_option_selector ("", "cat-links-color", $translucence_options_values['sidebar-color']);
  1244. translucence_get_option_selector ("", "tag-links-color", $translucence_options_values['sidebar-color']);
  1245. translucence_get_option_selector ("", "entry-link-style", $translucence_options_values['entry-link-style']);
  1246. print "<div style='font-size: 10px;'>";
  1247. print __( 'For text and link options, see', '2010-translucence' ).": ";
  1248. print "<a href='javascript:setThemeOptionsMode(\"post\", \"".$translucence_options_id."\")'>".__( 'Post Options', '2010-translucence' )."</a>";
  1249. print "</div>";
  1250. }
  1251. print "</div>";
  1252. $post_options = ob_get_contents();
  1253. ob_end_clean();
  1254. return $post_options;
  1255. }
  1256. /**
  1257. * Gets theme options UI for left sidebar options
  1258. *
  1259. * @uses translucence_get_option_selector() to generate select field for a given option
  1260. * @uses is_active_sidebar() to determine whether to show add or edit widgets link
  1261. *
  1262. * @since 2010 Translucence 1.0
  1263. * @return string html of left sidebar options for theme options UI
  1264. */
  1265. function translucence_get_left01_options() {
  1266. global $translucence_config, $translucence_options, $translucence_options_values;
  1267. global $translucence_options_id;
  1268. ob_start();
  1269. print "<div>";
  1270. if ($translucence_options['left01-width'] != 0) {
  1271. print "<div style='font-size: 10px; text-align: center; color: ".$translucence_options['left01-heading-color'].";'>&larr; ".$translucence_options['left01-width']." px &rarr;</div>";
  1272. if ($translucence_options['variation-type'] == "custom") {
  1273. // opacity
  1274. translucence_get_option_selector ("", "left01-opacity", $translucence_options_values['sidebar-opacity']);
  1275. // color
  1276. translucence_get_option_selector ("", "left01-color", $translucence_options_values['sidebar-color']);
  1277. // border
  1278. translucence_get_option_selector ("", "left01-border-style", $translucence_options_values['border-style']);
  1279. }
  1280. $current_widgets = get_option ('sidebars_widgets');
  1281. if (is_active_sidebar("tertiary-widget-area")) {
  1282. print "<br/><br/><div class='post-link' style='font-size: 10px; border-color: ".$translucence_options['left01-link-color'].";'>";
  1283. print "<a href='".get_bloginfo('url')."/wp-admin/widgets.php'>Edit Widgets</a>";
  1284. print "</div><br/>";
  1285. if (is_array($current_widgets['tertiary-widget-area'])) {
  1286. foreach ($current_widgets['tertiary-widget-area'] as $widget) {
  1287. $widget = str_replace("-", " ", $widget);
  1288. $widget = str_replace("_", " ", $widget);
  1289. $widget = rtrim(ucwords($widget), "0..9");
  1290. print "<div class='widgetbox' style='color: ".$translucence_options['left01-heading-color']."; border-color: ".$translucence_options['left01-heading-color'].";'>";
  1291. print $widget;
  1292. print "</div>";
  1293. }
  1294. }
  1295. } else {
  1296. print "<br/><br/><div class='post-link' style='font-size: 10px; border-color: ".$translucence_options['left01-link-color'].";'>";
  1297. print "<a style='color:".$translucence_options['left01-link-color'].";' href='".get_bloginfo('url')."/wp-admin/widgets.php'>Add Widgets</a>";
  1298. print "</div><br/>";
  1299. print "<div class='widgetbox' style='color: ".$translucence_options['left01-heading-color']."; border-color: ".$translucence_options['left01-heading-color'].";'>";
  1300. print "<div style='font-size: 10px; padding-left: 10px; color: ".$translucence_options['left01-heading-color'].";'>no widgets...</div>";
  1301. print "<div style='font-size: 9px; padding-left: 10px; color: ".$translucence_options['left01-heading-color'].";'>add widgets or use defaults...</div>";
  1302. print "</div>";
  1303. //print "<div class='submit'><input type='submit' value='Add Default Widgets' name='default_widgets'/></div>";
  1304. }
  1305. }
  1306. print "</div>";
  1307. $left01_options = ob_get_contents();
  1308. ob_end_clean();
  1309. return $left01_options;
  1310. }
  1311. /**
  1312. * Gets theme options UI for 1st right sidebar options
  1313. *
  1314. * @uses translucence_get_option_selector() to generate select field for a given option
  1315. * @uses is_active_sidebar() to determine whether to show add or edit widgets link
  1316. *
  1317. * @since 2010 Translucence 1.0
  1318. * @return string html of 1st right sidebar options for theme options UI
  1319. */
  1320. function translucence_get_right01_options() {
  1321. global $translucence_config, $translucence_options, $translucence_options_values;
  1322. global $translucence_options_id;
  1323. ob_start();
  1324. print "<div>";
  1325. if ($translucence_options['right01-width'] != 0) {
  1326. print "<div style='font-size: 10px; text-align: center; color: ".$translucence_options['right01-heading-color'].";'>&larr; ".$translucence_options['right01-width']." px &rarr;</div>";
  1327. if ($translucence_options['variation-type'] == "custom") {
  1328. // opacity
  1329. translucence_get_option_selector ("", "right01-opacity", $translucence_options_values['sidebar-opacity']);
  1330. // color
  1331. translucence_get_option_selector ("", "right01-color", $translucence_options_values['sidebar-color']);
  1332. // border
  1333. translucence_get_option_selector ("", "right01-border-style", $translucence_options_values['border-style']);
  1334. }
  1335. $current_widgets = get_option ('sidebars_widgets');
  1336. //printpre($current_widgets);
  1337. if (is_active_sidebar("primary-widget-area")) {
  1338. print "<br/><br/><div class='post-link' style='font-size: 10px; border-color: ".$translucence_options['right01-link-color'].";'>";
  1339. print "<a style='' href='".get_bloginfo('url')."/wp-admin/widgets.php'>Edit Widgets</a>";
  1340. print "</div><br/>";
  1341. if (is_array($current_widgets['primary-widget-area'])) {
  1342. foreach ($current_widgets['primary-widget-area'] as $widget) {
  1343. $widget = str_replace("-", " ", $widget);
  1344. $widget = str_replace("_", " ", $widget);
  1345. $widget = rtrim(ucwords($widget), "0..9");
  1346. print "<div class='widgetbox' style='color: ".$translucence_options['right01-heading-color']."; border-color: ".$translucence_options['right01-heading-color'].";'>";
  1347. print $widget;
  1348. print "</div>";
  1349. }
  1350. }
  1351. } else {
  1352. print "<br/><br/><div class='post-link' style='font-size: 10px; border-color: ".$translucence_options['right01-link-color'].";'>";
  1353. print "<a style='color:".$translucence_options['right01-link-color'].";' href='".get_bloginfo('url')."/wp-admin/widgets.php'>Add Widgets</a>";
  1354. print "</div><br/>";
  1355. print "<div class='widgetbox' style='color: ".$translucence_options['right01-heading-color']."; border-color: ".$translucence_options['right01-heading-color'].";'>";
  1356. print "<div style='font-size: 10px; padding-left: 10px; color: ".$translucence_options['right01-heading-color'].";'>no widgets...</div>";
  1357. print "<div style='font-size: 9px; padding-left: 10px; color: ".$translucence_options['right01-heading-color'].";'>add widgets or use defaults...</div>";
  1358. print "</div>";
  1359. //print "<div class='submit'><input type='submit' value='Add Default Widgets' name='default_widgets'/></div>";
  1360. }
  1361. }
  1362. print "</div>";
  1363. $right01_options = ob_get_contents();
  1364. ob_end_clean();
  1365. return $right01_options;
  1366. }
  1367. /**
  1368. * Gets theme options UI for 2nd right sidebar options
  1369. *
  1370. * @uses translucence_get_option_selector() to generate select field for a given option
  1371. * @uses is_active_sidebar() to determine whether to show add or edit widgets link
  1372. *
  1373. * @since 2010 Translucence 1.0
  1374. * @return string html of 2nd right sidebar options for theme options UI
  1375. */
  1376. function translucence_get_right02_options() {
  1377. global $translucence_config, $translucence_options, $translucence_options_values;
  1378. global $translucence_options_id;
  1379. ob_start();
  1380. print "<div>";
  1381. if ($translucence_options['right02-width'] != 0) {
  1382. print "<div style='font-size: 10px; text-align: center; color: ".$translucence_options['right02-heading-color'].";'>&larr; ".$translucence_options['right02-width']." px &rarr;</div>";
  1383. if ($translucence_options['variation-type'] == "custom") {
  1384. // opacity
  1385. translucence_get_option_selector ("", "right02-opacity", $translucence_options_values['sidebar-opacity']);
  1386. // color
  1387. translucence_get_option_selector ("", "right02-color", $translucence_options_values['sidebar-color']);
  1388. // border
  1389. translucence_get_option_selector ("", "right02-border-style", $translucence_options_values['border-style']);
  1390. }
  1391. $current_widgets = get_option ('sidebars_widgets');
  1392. if (is_active_sidebar("secondary-widget-area")) {
  1393. print "<br/><br/><div class='post-link' style='font-size: 10px; border-color: ".$translucence_options['right02-link-color']."'>";
  1394. print "<a href='".get_bloginfo('url')."/wp-admin/widgets.php'>Edit Widgets</a>";
  1395. print "</div><br/>";
  1396. if (is_array($current_widgets['secondary-widget-area'])) {
  1397. foreach ($current_widgets['secondary-widget-area'] as $widget) {
  1398. $widget = str_replace("-", " ", $widget);
  1399. $widget = str_replace("_", " ", $widget);
  1400. $widget = rtrim(ucwords($widget), "0..9");
  1401. print "<div class='widgetbox' style='color: ".$translucence_options['right02-heading-color']."; border-color: ".$translucence_options['right02-heading-color'].";'>";
  1402. print $widget;
  1403. print "</div>";
  1404. }
  1405. }
  1406. } else {
  1407. print "<br/><br/><div class='post-link' style='font-size: 10px; border-color: ".$translucence_options['right02-link-color']."'>";
  1408. print "<a style='color:".$translucence_options['right02-link-color'].";' href='".get_bloginfo('url')."/wp-admin/widgets.php'>Add Widgets</a>";
  1409. print "</div><br/>";
  1410. print "<div class='widgetbox' style='color: ".$translucence_options['right02-heading-color']."; border-color: ".$translucence_options['right02-heading-color'].";'>";
  1411. print "<div style='font-size: 10px; padding-left: 10px; color: ".$translucence_options['right02-heading-color'].";'>no widgets...</div>";
  1412. print "<div style='font-size: 9px; padding-left: 10px; color: ".$translucence_options['right02-heading-color'].";'>add widgets or use defaults...</div>";
  1413. print "</div>";
  1414. //print "<div class='submit'><input type='submit' value='Add Default Widgets' name='default_widgets'/></div>";
  1415. }
  1416. }
  1417. print "</div>";
  1418. $right02_options = ob_get_contents();
  1419. ob_end_clean();
  1420. return $right02_options;
  1421. }
  1422. /**
  1423. * Gets theme options UI for footer area options
  1424. *
  1425. * @uses translucence_get_option_selector() to generate select field for a given option
  1426. *
  1427. * @since 2010 Translucence 1.0
  1428. * @return string html of footer area options for theme options UI
  1429. */
  1430. function translucence_get_footer_options() {
  1431. global $translucence_config, $translucence_options, $translucence_options_values;
  1432. global $translucence_options_id;
  1433. ob_start();
  1434. print "<div>";
  1435. if (in_array("footer-bottom-color", $translucence_config['model']))
  1436. print "<span style='padding-top: 0px; font-size: 10px; float: left;'>".__( 'Footer Widgets', '2010-translucence' )."</span>";
  1437. print "<span class='horizontalbar' style='font-size: 8px'>";
  1438. translucence_get_option_selector ("", "bottom-color", $translucence_options_values['sidebar-color']);
  1439. translucence_get_option_selector ("", "bottom-opacity", $translucence_options_values['sidebar-opacity']);
  1440. translucence_get_option_selector ("", "bottom-border-style", $translucence_options_values['border-style']);
  1441. print"</span>";
  1442. print "</div>";
  1443. $footer_options = ob_get_contents();
  1444. ob_end_clean();
  1445. return $footer_options;
  1446. }
  1447. /**
  1448. * Gets theme options UI for footer widget area options
  1449. *
  1450. * @uses translucence_get_option_selector() to generate select field for a given option
  1451. * @uses is_active_sidebar() to determine whether there are widgets
  1452. *
  1453. * @since 2010 Translucence 1.0
  1454. * @return string html of footer widget area options for theme options UI
  1455. */
  1456. function translucence_get_footer_widgets($order) {
  1457. global $translucence_config, $translucence_options, $translucence_options_values;
  1458. global $translucence_options_id;
  1459. $current_widgets = get_option ('sidebars_widgets');
  1460. ob_start();
  1461. print "<div>";
  1462. if (is_active_sidebar( $order.'-footer-widget-area' )) {
  1463. foreach ($current_widgets[$order.'-footer-widget-area'] as $widget) {
  1464. $widget = str_replace("-", " ", $widget);
  1465. $widget = str_replace("_", " ", $widget);
  1466. $widget = rtrim(ucwords($widget), "0..9");
  1467. print "<div class='widgetbox' style='width: 150px; color: ".$translucence_options['bottom-heading-color']."; border-color: ".$translucence_options['bottom-heading-color'].";'>";
  1468. print $widget;
  1469. print "</div>";
  1470. }
  1471. }
  1472. print "</div>";
  1473. $footer_widgets = ob_get_contents();
  1474. ob_end_clean();
  1475. return $footer_widgets;
  1476. }
  1477. /**
  1478. * Gets theme options UI for footer right meta options
  1479. *
  1480. * @since 2010 Translucence 1.0
  1481. * @return string html of footer right meta options for theme options UI
  1482. */
  1483. function translucence_footermeta_right() {
  1484. global $translucence_config, $translucence_options, $translucence_options_values;
  1485. global $translucence_options_id;
  1486. ob_start();
  1487. print"<input name='theme-name' type='hidden' value='".$translucence_options['theme-name']."'>";
  1488. print"<input name='theme-url' type='hidden' value='".$translucence_options['theme-url']."'>";
  1489. print "<div style='font-size: 9px; float: right; clear: left; color: ".$translucence_options['bgtextcolor'].";'>";
  1490. print $translucence_options['theme-name']." | WordPress";
  1491. print "</div>";
  1492. $footermeta_right = ob_get_contents();
  1493. ob_end_clean();
  1494. return $footermeta_right;
  1495. }
  1496. /**
  1497. * Gets theme options UI for footer left meta options
  1498. *
  1499. * @since 2010 Translucence 1.0
  1500. * @return string html of footer left meta options for theme options UI
  1501. */
  1502. function translucence_footermeta_left() {
  1503. global $translucence_config, $translucence_options, $translucence_options_values;
  1504. global $translucence_options_id;
  1505. ob_start();
  1506. print "<div style='font-size: 9px;'>";
  1507. if ($translucence_options['footerleft'] == "") {
  1508. print "no links defined...";
  1509. } else {
  1510. print $translucence_options['footerleft'];
  1511. }
  1512. if ($translucence_options['footer-meta-left'] == 'custom') {
  1513. print "
  1514. <input id='footerleftdo' type='hidden' name='footerleftdo' value='0'/> -
  1515. <a href='javascript: document.getElementById(\"footerleftedit\").style.display = \"block\"; document.getElementById(\"footerleftdo\").value = \"1\"; exit;'>edit</a>
  1516. <div id='footerleftedit' style='display: none;'>
  1517. <textarea name='".$translucence_options_id."[footerleftcustom]' style='width: 100%; height: 50px; font-size: 10px;' class='code'>";
  1518. print stripslashes(stripslashes(trim($translucence_options['footerleftcustom'])));
  1519. print "</textarea>
  1520. &nbsp;&nbsp;&nbsp;
  1521. <a href='javascript: document.getElementById(\"footerleftedit\").style.display = \"none\"; document.getElementById(\"footerlefteditdo\").value = \"0\"; exit;'>Cancel</a> -
  1522. <span class='submit'><input type='submit' value='Update' name='save'/></span>
  1523. </div>
  1524. ";
  1525. }
  1526. print "</div>";
  1527. $footermeta_left = ob_get_contents();
  1528. ob_end_clean();
  1529. return $footermeta_left;
  1530. }
  1531. /**
  1532. * Gets theme options UI for footer right meta options
  1533. *
  1534. * @since 2010 Translucence 1.0
  1535. * @return string html of footer right meta options for theme options UI
  1536. */
  1537. function translucence_get_footermeta_options() {
  1538. global $translucence_config, $translucence_options, $translucence_options_values;
  1539. global $translucence_options_id;
  1540. ob_start();
  1541. print "<div class='options'>";
  1542. // footer meta left appgroups options
  1543. if (in_array("footer-meta-left", $translucence_config['model'])) {
  1544. print "<span style='font-size: 9px;'>Footer Links:</span>\n";
  1545. print "<select name='".$translucence_options_id."[footer-meta-left]' style='font-size: 10px;' onchange='this.form.submit();'>";
  1546. foreach (array_keys($translucence_config['footer_meta_left_options']) as $meta_left_option) {
  1547. print "<option value='".$translucence_config['footer_meta_left_options'][$meta_left_option]['option_name']."' ";
  1548. print ($translucence_options['footer-meta-left'] == $translucence_config['footer_meta_left_options'][$meta_left_option]['option_name'] ? ' selected' : '') . ">";
  1549. print $translucence_config['footer_meta_left_options'][$meta_left_option]['option_label']."</option>";
  1550. }
  1551. print "</select>";
  1552. }
  1553. print "</div>";
  1554. $footermeta_options = ob_get_contents();
  1555. ob_end_clean();
  1556. return $footermeta_options;
  1557. }
  1558. /**
  1559. * Gets theme option modes
  1560. *
  1561. * @since 2010 Translucence 1.0
  1562. * @return array theme option modes for theme options UI
  1563. */
  1564. function translucence_get_option_modes() {
  1565. $option_modes = array(
  1566. 'Basic Options' => 'basic',
  1567. 'Post Options' => 'post',
  1568. 'Layout Options' => 'layout',
  1569. 'Sidebar Options' => 'sidebar',
  1570. 'Global Options' => 'global',
  1571. 'All Options' => 'advanced'
  1572. );
  1573. return $option_modes;
  1574. }
  1575. /**
  1576. * Gets active options that are included in given option mode
  1577. *
  1578. * @since 2010 Translucence 1.0
  1579. * @return array theme option that are active for a given theme mode
  1580. */
  1581. function translucence_get_active_options($translucence_options_mode) {
  1582. global $translucence_config, $translucence_options;
  1583. $active_options = array();
  1584. if (in_array('options-mode', $translucence_config['model'])) {
  1585. if ($translucence_options_mode == "basic") {
  1586. $active_options[] = 'options-mode';
  1587. $active_options[] = 'variation-type';
  1588. $active_options[] = 'site-options';
  1589. // $active_options[] = 'header-options';
  1590. $active_options[] = 'layout-options';
  1591. $active_options[] = 'site-title-options';
  1592. $active_options[] = 'site-title-color';
  1593. $active_options[] = 'site-title-size';
  1594. $active_options[] = 'title-box-opacity';
  1595. $active_options[] = 'title-box-color';
  1596. $active_options[] = 'tagline-options';
  1597. $active_options[] = 'site-description-size';
  1598. $active_options[] = 'site-description-color';
  1599. $active_options[] = 'description-box-color';
  1600. // $active_options[] = 'headermeta-options';
  1601. $active_options[] = 'site-width';
  1602. //$active_options[] = 'site-color';
  1603. //$active_options[] = 'site-opacity';
  1604. //$active_options[] = 'site-border-style';
  1605. //$active_options[] = 'header-block-height';
  1606. //$active_options[] = 'header-color';
  1607. //$active_options[] = 'header-opacity';
  1608. //$active_options[] = 'header-border-style';
  1609. $active_options[] = 'left01-width';
  1610. $active_options[] = 'right01-width';
  1611. $active_options[] = 'right02-width';
  1612. $active_options[] = 'top-opacity';
  1613. $active_options[] = 'left01-opacity';
  1614. $active_options[] = 'right01-opacity';
  1615. $active_options[] = 'right02-opacity';
  1616. $active_options[] = 'top-color';
  1617. $active_options[] = 'left01-color';
  1618. $active_options[] = 'right01-color';
  1619. $active_options[] = 'right02-color';
  1620. $active_options[] = 'bottom-color';
  1621. $active_options[] = 'top-border-style';
  1622. $active_options[] = 'left01-border-style';
  1623. $active_options[] = 'right01-border-style';
  1624. $active_options[] = 'right02-border-style';
  1625. $active_options[] = 'bottom-border-style';
  1626. $active_options[] = 'page-links-display';
  1627. } else if ($translucence_options_mode == "post") {
  1628. $active_options[] = 'variation-type';
  1629. $active_options[] = 'options-mode';
  1630. $active_options[] = 'entry-text-align';
  1631. $active_options[] = 'entry-text-size';
  1632. $active_options[] = 'textcolor';
  1633. $active_options[] = 'linkcolor';
  1634. $active_options[] = 'cat-links-color';
  1635. $active_options[] = 'tag-links-color';
  1636. $active_options[] = 'entry-link-style';
  1637. } else if ($translucence_options_mode == "layout") {
  1638. $active_options[] = 'variation-type';
  1639. $active_options[] = 'options-mode';
  1640. $active_options[] = 'layout-options';
  1641. $active_options[] = 'left01-width';
  1642. $active_options[] = 'right01-width';
  1643. $active_options[] = 'right02-width';
  1644. $active_options[] = 'default-post-display';
  1645. $active_options[] = 'page-links-display';
  1646. $active_options[] = 'top-border-style';
  1647. $active_options[] = 'content-border-style';
  1648. $active_options[] = 'left01-border-style';
  1649. $active_options[] = 'right01-border-style';
  1650. $active_options[] = 'right02-border-style';
  1651. $active_options[] = 'bottom-border-style';
  1652. $active_options[] = 'top-opacity';
  1653. $active_options[] = 'left01-opacity';
  1654. $active_options[] = 'content-opacity';
  1655. $active_options[] = 'right01-opacity';
  1656. $active_options[] = 'right02-opacity';
  1657. $active_options[] = 'bottom-opacity';
  1658. $active_options[] = 'top-color';
  1659. $active_options[] = 'left01-color';
  1660. $active_options[] = 'content-color';
  1661. $active_options[] = 'right01-color';
  1662. $active_options[] = 'right02-color';
  1663. $active_options[] = 'bottom-color';
  1664. } else if ($translucence_options_mode == "sidebar") {
  1665. $active_options[] = 'variation-type';
  1666. $active_options[] = 'options-mode';
  1667. $active_options[] = 'post-single-sidebar';
  1668. $active_options[] = 'author-single-sidebar';
  1669. $active_options[] = 'content-border-style';
  1670. $active_options[] = 'category-single-sidebar';
  1671. $active_options[] = 'tag-single-sidebar';
  1672. $active_options[] = 'search-single-sidebar';
  1673. $active_options[] = 'archives-single-sidebar';
  1674. $active_options[] = 'top-border-style';
  1675. $active_options[] = 'content-border-style';
  1676. $active_options[] = 'left01-border-style';
  1677. $active_options[] = 'right01-border-style';
  1678. $active_options[] = 'right02-border-style';
  1679. $active_options[] = 'bottom-border-style';
  1680. $active_options[] = 'top-opacity';
  1681. $active_options[] = 'left01-opacity';
  1682. $active_options[] = 'content-opacity';
  1683. $active_options[] = 'right01-opacity';
  1684. $active_options[] = 'right02-opacity';
  1685. $active_options[] = 'bottom-opacity';
  1686. $active_options[] = 'top-color';
  1687. $active_options[] = 'left01-color';
  1688. $active_options[] = 'content-color';
  1689. $active_options[] = 'right01-color';
  1690. $active_options[] = 'right02-color';
  1691. $active_options[] = 'bottom-color';
  1692. } else if ($translucence_options_mode == "global") {
  1693. $active_options[] = 'variation-type';
  1694. $active_options[] = 'options-mode';
  1695. $active_options[] = 'site-options';
  1696. $active_options[] = 'header-options';
  1697. $active_options[] = 'site-title-options';
  1698. $active_options[] = 'site-title-box-options';
  1699. $active_options[] = 'tagline-options';
  1700. $active_options[] = 'headermeta-options';
  1701. $active_options[] = 'site-width';
  1702. $active_options[] = 'site-color';
  1703. $active_options[] = 'site-opacity';
  1704. $active_options[] = 'site-border-style';
  1705. $active_options[] = 'header-block-height';
  1706. $active_options[] = 'header-color';
  1707. $active_options[] = 'header-opacity';
  1708. $active_options[] = 'header-border-style';
  1709. $active_options[] = 'site-title-size';
  1710. $active_options[] = 'site-title-color';
  1711. $active_options[] = 'header-text-shadow-offset';
  1712. $active_options[] = 'header-text-shadow-blur';
  1713. $active_options[] = 'title-box-color';
  1714. $active_options[] = 'title-box-opacity';
  1715. $active_options[] = 'header-text-display';
  1716. $active_options[] = 'site-description-size';
  1717. $active_options[] = 'site-description-color';
  1718. $active_options[] = 'description-box-color';
  1719. $active_options[] = 'description-box-opacity';
  1720. $active_options[] = 'header_meta_left_options';
  1721. // $active_options[] = 'headermeta';
  1722. //$active_options[] = '';
  1723. } else {
  1724. $active_options = $translucence_options;
  1725. }
  1726. }
  1727. return $active_options;
  1728. }
  1729. /**
  1730. * Gets select field for a given theme option
  1731. *
  1732. * @uses translucence_get_active_options() to determine active options for a given option mode
  1733. *
  1734. * @since 2010 Translucence 1.0
  1735. * @return string theme option form elements for use in theme options UI
  1736. */
  1737. function translucence_get_option_selector ($option_title, $option_name, $option_values, $state='dimmed') {
  1738. global $translucence_config, $translucence_options, $translucence_options_values;
  1739. global $translucence_custom_header_set, $translucence_custom_background_set, $translucence_options_id;
  1740. $translucence_options_mode = translucence_get_active_options($translucence_options['options-mode']);
  1741. $display_option = false;
  1742. //if ($translucence_options['options-mode'] == "basic") {
  1743. if (in_array($option_name, $translucence_options_mode)) {
  1744. $display_option = true;
  1745. } else if ($translucence_custom_header_set == 1 && (preg_match("/box/", $option_name))) {
  1746. $display_option = true;
  1747. }
  1748. //} else {
  1749. //$display_option = true;
  1750. //}
  1751. if ($state == "dimmed") {
  1752. $state_css = "option-label-dimmed";
  1753. } else if ($state == "active") {
  1754. $state_css = "option-label";
  1755. }
  1756. if (in_array($option_name, $translucence_config['model']) && $display_option == true) {
  1757. print "<span style='white-space:nowrap;'>\n";
  1758. if ($option_title != "") print " <span style='font-size: 10px;'>".$option_title."</span>\n";
  1759. print "<select name='".$translucence_options_id."[".$option_name."]' style='font-size: 10px;' class='".$state_css."' onchange='this.form.submit();'>\n";
  1760. // options
  1761. foreach ($option_values as $label => $value) {
  1762. print "\n<option value='".$value."'".($translucence_options[$option_name] == $value ? ' selected' : '') . ">".$label."</option>";
  1763. }
  1764. print "</select>\n";
  1765. print "</span> &nbsp;\n";
  1766. } else {
  1767. print "<input type='hidden' name='".$translucence_options_id."[".$option_name."]' value = '".$translucence_options[$option_name]."'/>";
  1768. }
  1769. }
  1770. /**
  1771. * Gets input field for a given theme option
  1772. *
  1773. * @uses translucence_get_active_options() to determine active options for a given option mode
  1774. *
  1775. * @since 2010 Translucence 1.0
  1776. * @return string theme option form elements for use in theme options UI
  1777. */
  1778. function translucence_get_option_field ($option_title, $option_name, $option_field_width) {
  1779. global $translucence_config, $translucence_options, $translucence_options_values, $translucence_options_id;
  1780. $translucence_options_mode = translucence_get_active_options($translucence_options['options-mode']);
  1781. $display_option = false;
  1782. //if ($translucence_options['options-mode'] == "basic") {
  1783. if (in_array($option_name, $translucence_options_mode)) $display_option = true;
  1784. //} else {
  1785. // $display_option = true;
  1786. //}
  1787. if (in_array($option_name, $translucence_config['model']) && $display_option == true) {
  1788. print "<span style='white-space:nowrap'>";
  1789. if ($option_title != "") print "<span style='font-size: 10px;'>".$option_title."</span>\n";
  1790. print "<input name='".$translucence_options_id."[".$option_name."]' class='color' type='text' size='".$option_field_width."' style='font-size: 10px;'
  1791. value='".(isset($translucence_options[$option_name]) ? $translucence_options[$option_name] : '')."'/></span>";
  1792. } else {
  1793. print "<input type='hidden' name='".$translucence_options_id."[".$option_name."]' value = '".$translucence_options[$option_name]."'/>";
  1794. }
  1795. }
  1796. ?>