/template-options.php
PHP | 2064 lines | 1465 code | 268 blank | 331 comment | 212 complexity | f9216f3cd8f2903a261a5b62e7388208 MD5 | raw file
Large files files are truncated, but you can click here to view the full file
- <?php
- /*********************************************************
- * Theme options
- * renders UI and theme model for chosing and previewing options
- *
- * @since 2010 Translucence 1.0
- *********************************************************/
- function translucence_theme_options_do_page() {
- global $translucence_config;
- global $translucence_options_id, $translucence_options, $translucence_options_values;
- global $translucence_custom_header_set, $translucence_custom_background_set, $translucence_custom_header_image;
- global $translucence_syndication_image, $translucence_model_site_width, $translucence_model_content_width;
- if ($translucence_options['revert'] == 1) {
- translucence_option_feedback();
- translucence_delete_options();
- $translucence_options['revert'] = 0;
- translucence_theme_options_update();
- }
- translucence_option_feedback();
- $translucence_options = get_option($translucence_options_id);
-
- $current_widgets = get_option ('sidebars_widgets');
-
- $custom_background_color = get_background_color();
- $custom_background_image = get_background_image();
- $translucence_custom_header_image = get_header_image();
-
- if (isset($translucence_custom_header_image) && $translucence_custom_header_image != "") {
- $translucence_custom_header_set = 1;
- } else {
- $translucence_custom_header_set = 0;
- }
-
- if ($translucence_custom_header_set == 0 && $translucence_options['header-image-options'] != "none") {
- $custom_header = $translucence_config['custom_header'][$translucence_options['header-image-options']]['url'];
- $custom_header = str_replace('%s', '', $custom_header);
- $translucence_custom_header_image = $custom_header;
- $translucence_custom_header_set = 1;
- }
- if ($custom_background_image) {
- $translucence_options['background_image'] = "url('".$custom_background_image."')";
- $translucence_options['background_repeat'] = get_theme_mod( 'background_repeat', 'repeat' );
- $translucence_options['background_attachment'] = get_theme_mod( 'background_attachment', 'scroll' );
- $translucence_options['background_position'] = get_theme_mod( 'background_position_x', 'left' );
- $translucence_custom_background_set = 1;
- } else if ($custom_background_color) {
- $translucence_custom_background_set = 1;
- } else {
- $translucence_custom_background_set = 0;
- }
-
- /*********************************************************
- * Define theme layout model values
- *********************************************************/
-
- $translucence_model_site_width = $translucence_options['site-width']+80;
-
- $model_right_sidebar_width = $translucence_options['right01-width']+50;
- $model_right_sidebar_width02 = $translucence_options['right02-width']+50;
- $model_left_sidebar_width = $translucence_options['left01-width']+50;
-
- $translucence_model_content_width = $translucence_options['site-width'] - ($translucence_options['left01-width'] + $translucence_options['right01-width'] + $translucence_options['right02-width'] + 220);
-
- /*********************************************************
- * Define theme model css
- * model css uses most of the actual theme's css except
- * theme body css
- * model css adds css for theme edit UI components
- *********************************************************/
-
- $model_css = preg_replace("/body/", ".body_na", $translucence_options['css']);
- $translucence_syndication_image = get_template_directory_uri()."/variations/feed.png";
- print "
- <script type='text/javascript' src='".get_template_directory_uri()."/jscolor/jscolor.js'></script>
- <style type='text/css'>";
- print $model_css;
- print translucence_get_theme_model_css();
- // printpre($translucence_options['activated-widgets']);
- // printpre($translucence_options['page-links-display']);
- /******************************************************************************
- * Theme Options Introduction with Update and Revert buttons
- ******************************************************************************/
-
- ?>
- <form id='settings' action='options.php' method='post' class='themeform' style='margin: 20px;'>
- <?php settings_fields( $translucence_options_id ); ?>
- <?php $translucence_options = get_option($translucence_options_id); ?>
-
- <table width = '<?php print $translucence_model_site_width; ?>' cellpadding='0' style='background-color: transparent;'>
- <tr>
- <td width='20%'>
- <span class='submit'><input type='submit' value='<?php _e( 'Update', '2010-translucence' ); ?>' name='save'/></span>
- <span class='submit'><input type='submit' value='<?php _e( 'Revert to Default', '2010-translucence' ); ?>' name='<?php echo $translucence_options_id ?>[reset]'/></span>
- </td>
- <td width='80%'>
-
- <?php
- print "<input type='hidden' value='".$translucence_options['activated-theme']."' name='".$translucence_options_id."[activated-theme]'/>";
- print "<input type='hidden' value='".$translucence_options['footer-widget-width']."' name='".$translucence_options_id."[footer-widget-width]'/>";
- /******************************************************************************
- * Widget Set Options
- ******************************************************************************/
- print "<div style='font-size: 10px;'>";
- if (in_array("activated-widgets", $translucence_config['model'])) {
- // widget set label
- print __('Widgets', '2010-translucence').": ";
- // widget set select field
- print "<select name='".$translucence_options_id."[activated-widgets]' style='font-size: 10px;' onchange='this.form.submit();'>";
- $widget_sets = array_keys($translucence_config['preset_widgets']);
- foreach ($widget_sets as $widget_set) {
- print "\n<option value='".$widget_set."'".($translucence_options['activated-widgets'] == $widget_set ? ' selected' : '') . ">".$widget_set."</option>";
- }
- print "</select> ";
- // widget set description and activate button
- //printpre($translucence_config['preset_widgets'][$translucence_options['activated-widgets']]['description']);
- if ($translucence_options['activated-widgets'] != "default" ) {
- print "<span class='submit'><input type='submit' value='".__('Activate New Widgets', '2010-translucence')."' name='".$translucence_options_id."[widgets]'/></span>";
- print " <span style='font-size: 10px;'> (".__('will <span class=\'warning\'>replace</span> existing widgets.', '2010-translucence').")</span>";
- print "<div style='margin-left: 100px;'>";
- print " <span style='font-size: 10px; font-style: italic'> ".$translucence_config['preset_widgets'][$translucence_options['activated-widgets']]['description'][0]."</span> ";
- print "</div>";
- } else {
- print "<input type='hidden' value='default' name='".$translucence_options_id."[widgets]'/>";
- }
- }
- print "</div>";
- /******************************************************************************
- * Content Set Options
- * NOT IMPLEMENTED YET....
- ******************************************************************************/
- print "<div style='font-size: 10px;'>";
- if (in_array("added-content-not-implemented", $translucence_config['model'])) {
- //content set label
- print __('Content', '2010-translucence').": ";
- // content set select field
- print "<select name='".$translucence_options_id."[added-content]' style='font-size: 10px;' onchange='this.form.submit();'>";
- $content_sets = array_keys($translucence_config['preset_content']);
- foreach ($content_sets as $content_set) {
- print "\n<option value='".$content_set."'".($translucence_options['added-content'] == $content_set ? ' selected' : '') . ">".$content_set."</option>";
- }
- print "</select> ";
- // widget set description and activate button
- if ($translucence_options['added-content'] != "default" ) {
- print " <span class='submit'><input type='submit' value='".__('Add New Content', '2010-translucence')."' name='".$translucence_options_id."[content]'/></span>";
- 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>";
- print "<div style='margin-left: 100px;'>";
- print " <span style='font-size: 10px; font-style: italic'> ".$translucence_config['preset_content'][$translucence_options['added-content']]['description'][0]."</span> ";
- print "</div>";
- } else {
- print "<input type='hidden' value='default' name='".$translucence_options_id."[content]'/>";
- }
- }
- print "</div>";
- ?>
- </div>
- </td>
- <td width='20%'>
- </td>
- </tr>
- </table>
-
- <?php
-
- /******************************************************************************
- * html from theme template files (header.php, index.php, footer.php and sidebars
- * embedded in this html are functions for printing theme options UI
- ******************************************************************************/
- ?>
- <div class='modelwrapper' style='margin-bottom: 5px;'>
- <?php print translucence_get_global_options(); ?>
- </div>
- <div class='modelwrapper'>
- <div class='sitewrapper'>
- <div class='headermeta_right'>
- <div class='bgtextcolor'><?php print translucence_headermeta_right(); ?></div>
- </div>
- <div class='headermeta_left'>
- <div class='bgtextcolor'><?php print translucence_headermeta_left(); ?></div>
- </div>
- <?php print translucence_get_custom_options(); ?>
- </div>
- <div id='wrapper'>
- <div id='header'>
- <div id='masthead'>
- <div id='branding'>
- <div class='headerblock'>
- </div>
- <span id='title-box'>
- <a href='index.php'>
- <div id='site-title'><?php print get_bloginfo('name') ?></div><br/>
- <div id='site-description'><?php print get_bloginfo('description') ?></div>
- </a>
- </span>
- </div><!-- #branding -->
- <div id='access' role='navigation'>
- <!-- top navigation links -->
- <div class='menu-header'>
- <?php print translucence_get_topmenu_options(); ?>
- </div>
- </div><!-- #access -->
- </div><!-- #masthead -->
- </div><!-- #header -->
- <div id='main' style="clear: both;">
- <div id='container'>
- <div id='tertiary' class='widget-area'>
- <!-- left sidebar -->
- <h3 class='widget-title'><?php _e( 'Left Sidebar', '2010-translucence' ); ?></h3>
- <?php print translucence_get_left01_options(); ?>
- </div>
- <div id='content'>
- <!-- syndication links -->
- <div style = 'width: 100%; float: right;'>
- <div id='syndication'>
- <a href='#' class='feed'><?php _e( 'Posts RSS', '2010-translucence' ); ?></a>
- <a href='#' class='feed'><?php _e( 'Comments RSS', '2010-translucence' ); ?></a>
- </div>
- </div>
- <!-- main content -->
- <?php print translucence_get_layout_options(); ?>
- <h2 class='entry-title'><?php _e( 'Entry Title', '2010-translucence' ); ?></h2>
- <div class='entry-content'>
- <?php print translucence_get_post_options(); ?>
- </div>
- </div>
- <div id='primary' class='widget-area'>
- <!-- 1st right sidebar -->
- <h3 class='widget-title'><?php _e( '1st Right Sidebar', '2010-translucence' ); ?></h3>
- <?php print translucence_get_right01_options(); ?>
- </div>
- <div id='secondary' class='widget-area' style=''>
- <!-- 2nd right sidebar -->
- <h3 class='widget-title'><?php _e( '2nd Right Sidebar', '2010-translucence' ); ?></h3>
- <?php print translucence_get_right02_options(); ?>
- </div>
- </div><!-- #container -->
- </div><!-- #main -->
- <br/>
- <div id='colophon'></div><!-- #colophon -->
- <div id='footer-widget-area'>
- <?php print translucence_get_footer_options(); ?>
- <!-- footer -->
- <div id='first' class='widget-area'>
- <ul class='xoxo'>
- <h3 class='widget-title'><?php _e( 'First Footer Widget Area', '2010-translucence' ); ?></h3>
- <?php print translucence_get_footer_widgets('first'); ?>
- </ul>
- </div>
- <div id='second' class='widget-area'>
- <ul class='xoxo'>
- <h3 class='widget-title'><?php _e( 'Second Footer Widget Area', '2010-translucence' ); ?></h3>
- <?php print translucence_get_footer_widgets('second'); ?>
- </ul>
- </div>
- <div id='third' class='widget-area'>
- <ul class='xoxo'>
- <h3 class='widget-title'><?php _e( 'Third Footer Widget Area', '2010-translucence' ); ?></h3>
- <?php print translucence_get_footer_widgets('third'); ?>
- </ul>
- </div>
- <div id='fourth' class='widget-area'>
- <ul class='xoxo'>
- <h3 class='widget-title'><?php _e( 'Fourth Footer Widget Area', '2010-translucence' ); ?></h3>
- <?php print translucence_get_footer_widgets('fourth'); ?>
- </ul>
- </div>
- </div>
- </div><!-- #wrapper -->
-
- <div class='sitewrapper'>
- <div class='footermeta_right'>
- <div class='bgtextcolor'><?php print translucence_footermeta_right(); ?></div>
- </div>
- <div class='footermeta_left'>
- <div class='bgtextcolor'><?php print translucence_footermeta_left(); ?></div>
- </div>
- </div><!-- #sitewrapper -->
- </div><!-- modelwrapper -->
- <div class='modelwrapper' style='margin-top: 5px;'>
- <?php print translucence_get_footermeta_options(); ?>
- </div>
-
-
- <?php
- /******************************************************************************
- * Update and Revert button
- ******************************************************************************/
- ?>
- <span class='submit'><input type='submit' value='<?php _e( 'Update', '2010-translucence' ); ?>' name='save'/></span>
- <span class='submit'><input type='submit' value='<?php _e( 'Revert to Default', '2010-translucence' ); ?>' name='<?php echo $translucence_options_id ?>[reset]'/></span>
-
- </form>
- <?php
- }
- /**
- * Generates CSS for theme options UI (based on theme CSS)
- *
- * @since 2010 Translucence 1.0
- * @return string CSS for theme options UI
- */
- function translucence_get_theme_model_css() {
- global $translucence_config;
- global $translucence_options_id, $translucence_options, $translucence_options_values;
- global $translucence_custom_header_image, $translucence_model_site_width, $translucence_syndication_image;
- ob_start();
- print "
- .modelwrapper {
- background-image: ".$translucence_options['background_image'].";
- background-position: ".$translucence_options['background_position'].";
- background-color: ".$translucence_options['background_color'].";
- background-repeat: ".$translucence_options['background_repeat'].";
- background-attachment: ".$translucence_options['background_attachment'].";
- width: ".$translucence_model_site_width."px;
- background-color: ".$translucence_options['background_color'].";
- color: #000000;
- padding: 1px 0px 0px 0px;
- border: 1px solid #CCCCCC;
- }
-
- #wphead h1 a {
- text-decoration: none;
- border-bottom: none;
- }
-
- a, a:hover {
- border-bottom: none;
- text-decoration: none;
- }
-
- #wrapper {
- margin: 0 auto;
- margin-top: 1px;
- margin-bottom: 10px;
- }
- .sitewrapper {
- margin-left: auto;
- margin-right: auto;
- }
- /* The theme meta areas */
- .headermeta_left {
- font-size: 12px;
- width: 50%;
- text-align: left;
- }
- .headermeta_right {
- font-size: 12px;
- width: 45%;
- text-align: right;
- float: right;
- clear: left;
- }
- .footermeta_left {
- font-size: 12px;
- width: 50%;
- text-align: left;
- padding-top: 5px;
- padding-bottom: 10px;
- }
- .footermeta_right {
- font-size: 12px;
- width: 40%;
- text-align: right;
- float: right;
- padding-top: 5px;
- padding-bottom: 10px;
- }
- /* The theme header area */
- #header {
- padding: 0 0 0 0px;
- }
-
- #branding {
- margin: 0 auto;
- position: relative;
- }
- #branding .headerblock {
- margin: 0 auto;
- position: absolute;
- color: transparent;
- top: 0;
- left: 0;
- overflow: hidden;
- cursor:pointer;
- }
- #branding #title-box {
- position: absolute;
- }
- #branding #title-box a {
- text-decoration:none;
- border:0;
- }
- #branding #title-box a:hover {
- text-decoration:none;
- border:0;
- }
- #branding #site-title {
- margin-bottom: 4px;
- display:inline-block;
- padding:0 3px;
- }
- #branding #site-description {
- display:inline-block;
- padding:0 3px;
- cursor:pointer;
- }
- .headerblock {
- background-image: url(".$translucence_custom_header_image.");
- background-position: center center;
- background-repeat: no-repeat;
- }
-
- #content {
- float: left;
- position:relative;
- margin-bottom: 25px;
- }
-
- #primary,
- #secondary,
- #tertiary {
- float: left;
- position:relative;
- }
-
- #primary {
- display:".$translucence_options['right01-visibility']."
- }
- #secondary {
- display:".$translucence_options['right02-visibility']."
- }
-
- #tertiary {
- display:".$translucence_options['left01-visibility']."
- }
- #footer-widget-area {
- overflow: hidden;
- padding: 20px 0px 0px 4px;
- }
- #footer-widget-area .widget-area {
- float: left;
- background-color: transparent;
- margin-right: 1px;
- }
- #footer-widget-area #fourth {
- margin-right: 0;
- }
-
- #syndication{
- width: 100%;
- text-align: right;
- font-size: 11px;
- padding: 0px 0 10px 0;
- white-space:nowrap;
- }
-
- #syndication a.feed {
- padding: 5px 2px 0px 23px;
- background: url(".$translucence_syndication_image.") no-repeat 0 1px;
- border-bottom: none;
- }
-
- .catlinks a,
- .taglinks a {
- border: 1px solid #666666;
- cursor: pointer;
- display: inline-block;
- margin: 2px 0.2em;
- padding: 0.1em 0.2em;
- }
- .options {
- margin-top: 5px;
- margin-bottom: 5px;
- margin-right: 5px;
- margin-left: 5px;
- background-color: #fff;
- font-size: 10px;
- line-height: 1.5em;
- padding: 10px;
- border: 1px dotted #CCCCCC;
- }
-
- .option-group {
- color: #333333;
- }
-
- .option-label {
- color: #333333;
- }
- .option-label:hover {
- color: #333333;
- }
- .option-label-dimmed {
- color: #CCCCCC;
- }
- .option-label-dimmed:hover {
- color: #333333;
- }
-
- .option-row {
- width: 100%;
- color: #CCCCCC;
- background-color: #fff;
- border-bottom: 1px dotted;
- padding: 2px;
- }
-
- .option-row:hover {
- background-color: #F8F8F8;
- color: #000000;
- }
-
- .instructions {
- margin-top: 5px;
- margin-bottom: 5px;
- margin-right: 0px;
- margin-left: 0px;
- background-color: #fffeeb;
- color: #000000;
- font-size: 10px;
- line-height: 1.5em;
- padding: 5px;
- border: 1px solid #CCCCCC;
- }
-
-
- .widgetbox {
- font-size: 10px;
- border-width: 1px;
- border-style: solid;
- padding: 5px;
- margin: 3px;
- }
- #appgroupedit textarea {
- width: 300px;
- }
- .metatext {
- font-size: 9px;
- color: ".$translucence_options['bglinkcolor'].";
- }
-
- .metatext a {
- color: ".$translucence_options['bglinkcolor'].";
- }
- .horizontalbar {
- padding-top: 4px;
- padding-bottom: 4px;
- margin-bottom: 4px;
- text-align: right;
- }
-
- #primary a,
- #secondary a,
- #tertiary a {
- border: 1px dotted;
- }
-
- #primary post-link {
- border-color: ".$translucence_options['right01-link-color'].";
- margin-right: 5px;
- margin-left: 5px;
- }
- .post-link {
- border-color: ".$translucence_options['bgtextcolor'].";
- margin-right: 5px;
- margin-left: 5px;
- }
-
- .editwidgetlink {
- display: block;
- color: ".$translucence_options['linkcolor'].";
-
- }
-
- .editwidgetlink a {
- display: block;
- color: ".$translucence_options['linkcolor'].";
- border: 1px dotted;
- padding: 3px;
- margin-bottom: 3px;
- }
-
- .editwidgetlink a:hover {
- border: 1px solid;
- text-decoration: none;
- }
- .editheaderlink {
- color: ".$translucence_options['bglinkcolor'].";
- font-size: 9px;
- white-space:nowrap;
- }
-
- .editheaderlink a {
- color: ".$translucence_options['bglinkcolor'].";
- padding: 3px;
- border: 1px dotted ".$translucence_options['bglinkcolor'].";
- }
- .editheaderlink a:hover {
- border: 1px solid ".$translucence_options['bglinkcolor'].";
- text-decoration: none;
- color: ".$translucence_options['bglinkcolor'].";
- }
-
- .modelheadertextposition {
- font-size: 20px;
- margin-left: 5px;
- padding-top: ".$translucence_options['header-text-padding-top']."px;
- color: ".$translucence_options['site-title-color'].";
- }
-
- .warning {
- color: #900;
- font-weight: bold;
- }
- .notify {
- color: #009933;
- font-weight: bold;
- }
- </style>
- ";
- print "<!--[if IE]>";
- print "<style type='text/css'>";
- print $translucence_options['header-color-ie']."\n";
- print $translucence_options['title-box-color-ie']."\n";
- print $translucence_options['description-box-color-ie']."\n";
- print $translucence_options['right02-color-ie']."\n";
- print $translucence_options['top-color-ie']."\n";
- // print $translucence_options['submenu-color-ie']."\n";
- print $translucence_options['content-color-ie']."\n";
- print $translucence_options['bottom-color-ie']."\n";
- print $translucence_options['left01-color-ie']."\n";
- print $translucence_options['right01-color-ie']."\n";
- print $translucence_options['right02-color-ie']."\n";
- print $translucence_options['cat-links-color-ie']."\n";
- print $translucence_options['tag-links-color-ie']."\n";
- print "#access ul ul {border-left: 1px solid #ccc; border-right: 1px solid #ccc;}";
- print "</style>";
- print "<![endif]-->";
- $translucence_theme_model_css = ob_get_contents();
- ob_end_clean();
- return $translucence_theme_model_css;
- }
- /**
- * Gets theme options UI for header left meta options
- *
- * @since 2010 Translucence 1.0
- * @return string html for theme options UI
- */
- function translucence_headermeta_left() {
- global $translucence_config, $translucence_options, $translucence_options_id;
-
- ob_start();
- print "<div class='metatext'>";
-
- if ($translucence_options['headerleft'] == "") {
- print "no links defined...";
- } else {
- print $translucence_options['headerleft'];
- }
-
- // if header left links selection is custom
- if ($translucence_options['header-meta-left'] == 'custom') {
- print "
- <input id='appgroupdo' type='hidden' name='appgroupdo' value='0'/> -
- <a href='javascript: document.getElementById(\"appgroupedit\").style.display = \"block\"; document.getElementById(\"appgroupdo\").value = \"1\"; exit; '>edit</a>
- <div id='appgroupedit' style='display: none;'>
- <textarea name='".$translucence_options_id."[headerleftcustom].' style='width: 100%; height: 50px; font-size: 10px;' class='code'>";
- print stripslashes(stripslashes(trim($translucence_options['headerleftcustom'])));
- print "</textarea>
-
- <a href='javascript: document.getElementById(\"appgroupedit\").style.display = \"none\"; document.getElementById(\"appgroupdo\").value = \"0\"; exit;'>Cancel</a> -
- <span class='submit'><input type='submit' value='Update' name='save'/></span>
- </div>
- ";
- }
- print "</div>";
- $headermeta_left = ob_get_contents();
- ob_end_clean();
- return $headermeta_left;
- }
- /**
- * Gets theme options UI for header right meta options
- *
- * @since 2010 Translucence 1.0
- * @return string html for theme options UI
- */
- function translucence_headermeta_right() {
- global $translucence_config, $translucence_options, $translucence_options_id;
-
- ob_start();
- print "<div class='metatext'>";
-
- if ($translucence_options['headerright'] == "") {
- print "no links defined...";
- } else {
- print $translucence_options['headerright'];
- }
-
- // if header right links selection is custom
- if ($translucence_options['header-meta-right'] == 'custom') {
- print "
- <input id='headerrightdo' type='hidden' name='headerrightdo' value='0'/> -
- <a href='javascript: document.getElementById(\"headerrightedit\").style.display = \"block\"; document.getElementById(\"headerrightdo\").value = \"1\"; exit; '>edit</a>
- <div id='headerrightedit' style='display: none;'>
- <textarea name='".$translucence_options_id."[headerrightcustom].' style='width: 100%; height: 50px; font-size: 10px;' class='code'>";
- print stripslashes(stripslashes(trim($translucence_options['headerrightcustom'])));
- print "</textarea>
-
- <a href='javascript: document.getElementById(\"headerrightedit\").style.display = \"none\"; document.getElementById(\"headerrightdo\").value = \"0\"; exit;'>Cancel</a> -
- <span class='submit'><input type='submit' value='Update' name='save'/></span>
- </div>
- ";
- }
- print "</div>";
- $headermeta_right = ob_get_contents();
- ob_end_clean();
- return $headermeta_right;
- }
- /**
- * Gets theme options UI for global options
- *
- * @uses translucence_get_option_modes() to get option modes
- * @uses translucence_get_active_options() to get options that are active for a given option mode
- * @uses translucence_get_option_selector() to generate select field for a given option
- * @uses translucence_get_option_field() to display a field for a given option
- *
- * @since 2010 Translucence 1.0
- * @return string html of global options for theme options UI
- */
- function translucence_get_global_options() {
- global $translucence_config, $translucence_options, $translucence_options_values, $translucence_variations;
- global $translucence_options_id;
- global $translucence_custom_header_set, $translucence_custom_background_set, $active_options;
-
- ob_start();
- print "<div class='options'>";
- print "<table style='width: 100%;'>";
- print "<tr>";
-
- // Variation options
- print "<td style='width: 70%; text-align: left; border-bottom: 1px solid; padding-bottom: 5px; '>";
- if (in_array("background", $translucence_config['model'])) {
- print "<div>";
- print "<select name='".$translucence_options_id."[background]' style='font-size: 14px;' onchange='this.form.submit();'>";
- // variations defined in variations folder
- foreach ($translucence_variations as $label => $value) {
- if (!in_array($value, $translucence_config['variations_disabled']))
- print "\n<option value='".$value."'".($translucence_options['background'] == $value ? ' selected' : '') . ">".$label."</option>";
- }
- print "</select>";
- print __( '', '2010-translucence' )."<span class='option-label'>";
- translucence_get_option_selector ("", "variation-type", $translucence_options_values['variation-type'], 'active');
- print "</span>";
- print "</div>";
-
- if ($translucence_custom_background_set == 1) {
- print "<div style='font-size: 10px; text-align: left; border-color: ".$translucence_options['bgtextcolor']."'>";
- print "(Custom background color or image may change the background of this variation)";
- print "</div>";
- }
- }
- print "</td>";
-
- // options mode values (used in translucence_get_active_options)
- $translucence_options_values['mode'] = translucence_get_option_modes();
-
- print "<td style='width: 30%; text-align: right; border-bottom: 1px solid; padding-bottom: 5px;'>";
- print __( 'Options Mode', '2010-translucence' ).":<span class='option-label'>";
- translucence_get_option_selector ("", "options-mode", $translucence_options_values['mode'], 'active');
- print "</span>";
-
- print "</td>";
- print "</tr>";
- print "</table>";
-
- // global options for: site, header, site title, tagline and header meta
- print "<table style='width: 100%;'>";
- print "<tr>";
-
- // get active options
- if (in_array('options-mode', $translucence_config['model'])) {
- $active_options = translucence_get_active_options($translucence_options['options-mode']);
- }
- // site width, color, opacity and border options
- if (in_array('site-options', $active_options)) {
- print "<td class='option-row'>";
- //site width
- print "<span class='option-label'>".__( 'Site', '2010-translucence' )."</span>";
- $translucence_title = __( 'width', '2010-translucence' );
- translucence_get_option_selector ($translucence_title, "site-width", $translucence_options_values['site-width']);
- // site color
- if ($translucence_options['variation-type'] == "custom") {
- $translucence_title = __( 'color', '2010-translucence' );
- translucence_get_option_selector ($translucence_title, "site-color", $translucence_options_values['sidebar-color']);
- // site opacity
- $translucence_title = __( 'opacity', '2010-translucence' );
- translucence_get_option_selector ($translucence_title, "site-opacity", $translucence_options_values['header-opacity']);
- // site border
- $translucence_title = __( 'border', '2010-translucence' );
- translucence_get_option_selector ($translucence_title, "site-border-style", $translucence_options_values['border-style']);
- }
- print "</td>";
- print "</tr>";
- // if not in active_options print out as hidden fields
- } else {
- translucence_get_option_selector ("", "site-width", $translucence_options_values['site-width'])."<br/>";
- translucence_get_option_selector ("", "site-color", $translucence_options_values['sidebar-color'])."<br/>";
- translucence_get_option_selector ("", "site-opacity", $translucence_options_values['header-opacity'])."<br/>";
- translucence_get_option_selector ("", "site-border-style", $translucence_options_values['border-style'])."<br/>";
- }
-
- // header height, color, opacity, border options
- if (in_array('header-options', $active_options)) {
- print "<tr>";
- print "<td class='option-row'>";
- // header height options
- print "<span class='option-label'>".__( 'Header', '2010-translucence' )."</span>";
- $translucence_title = __( 'height', '2010-translucence' );
- translucence_get_option_selector ($translucence_title, "header-block-height", $translucence_options_values['header-block-height']);
- // header color
- if ($translucence_options['variation-type'] == "custom") {
- $translucence_title = __( 'color', '2010-translucence' );
- translucence_get_option_selector ($translucence_title, "header-color", $translucence_options_values['header-color']);
- }
- if ($translucence_options['variation-type'] == "custom") {
- // header opacity
- $translucence_title = __( 'opacity', '2010-translucence' );
- translucence_get_option_selector ($translucence_title, "header-opacity", $translucence_options_values['header-opacity']);
- // header border
- $translucence_title = __( 'border', '2010-translucence' );
- translucence_get_option_selector ($translucence_title, "header-border-style", $translucence_options_values['border-style']);
- }
- print "</td>";
- print "</tr>";
- // if not in active_options print out as hidden fields
- } else {
- translucence_get_option_selector ("", "header-block-height", $translucence_options_values['header-block-height']);
- translucence_get_option_selector ("", "header-color", $translucence_options_values['header-color']);
- translucence_get_option_selector ("", "header-opacity", $translucence_options_values['header-opacity']);
- translucence_get_option_selector ("", "header-border-style", $translucence_options_values['border-style']);
- }
-
- // header text size color shadow, box and position
- if (in_array('site-title-options', $active_options) || $translucence_custom_header_set == 1) {
- print "<tr>";
- print "<td class='option-row'>";
-
- if (in_array('site-title-options', $active_options)) {
-
- // header-text-size options
- if (in_array("site-title-size", $translucence_config['model'])) {
- print "<span class='option-label'>".__( 'Site Title', '2010-translucence' )." </span>";
- $translucence_title = __( 'size', '2010-translucence' );
- translucence_get_option_selector ($translucence_title, "site-title-size", $translucence_options_values['header-text-size']);
- }
- // header-text-color options
- // if (in_array("site-title-color", $translucence_config['model']) && $translucence_options['variation-type'] == "custom") {
- // $translucence_title = __( 'color', '2010-translucence' );
- // translucence_get_option_field ($translucence_title, "site-title-color", 6);
- // }
- // header-text-offset options
- if (in_array("header-text-shadow-offset", $translucence_config['model']) && $translucence_options['variation-type'] == "custom") {
- $translucence_title = __( 'offset', '2010-translucence' );
- translucence_get_option_selector ($translucence_title, "header-text-shadow-offset", $translucence_options_values['text-shadow-offset']);
- }
- // header-text-blur options
- if (in_array("header-text-shadow-blur", $translucence_config['model']) && $translucence_options['variation-type'] == "custom") {
- $translucence_title = __( 'blur', '2010-translucence' );
- translucence_get_option_selector ($translucence_title, "header-text-shadow-blur", $translucence_options_values['text-shadow-blur']);
- }
- }
-
- if (in_array('site-title-box-options', $active_options) || $translucence_custom_header_set == 1) {
- translucence_get_option_field ("Color: #", "site-title-color", 6);
- // header-text-box options
- if (in_array("title-box-color", $translucence_config['model'])) {
- print "<span class='option-label'> ".__( 'Site Title Box', '2010-translucence' )."</span>";
- $translucence_title = __( 'color', '2010-translucence' );
- translucence_get_option_selector ($translucence_title, "title-box-color", $translucence_options_values['header-color']);
- }
- if (in_array("title-box-opacity", $translucence_config['model'])) {
- $translucence_title = __( 'opacity', '2010-translucence' );
- translucence_get_option_selector ($translucence_title, "title-box-opacity", $translucence_options_values['header-opacity']);
- }
- // header-text-display options
- if (in_array("header-text-display", $translucence_config['model'])) {
- print "
- <span class='option-label' <span style='font-size: 10px;'>".__( 'position', '2010-translucence' )."
- <select name='".$translucence_options_id."[header-text-display]' class='option-label-dimmed' style='font-size: 10px;' onchange='this.form.submit();'>
- <option value='middle' ".($translucence_options['header-text-display'] == 'middle' ? ' selected' : '') . ">".__( 'Middle', '2010-translucence' )."</option>
- <option value='top' ".($translucence_options['header-text-display'] == 'top' ? ' selected' : '') . ">".__( 'Top', '2010-translucence' )."</option>
- <option value='bottom' ".($translucence_options['header-text-display'] == 'bottom' ? ' selected' : '') . ">".__( 'Bottom', '2010-translucence' )."</option>
- <option value='hide' ".($translucence_options['header-text-display'] == 'hide' ? ' selected' : '') . ">".__( 'Hide', '2010-translucence' )."</option>
- <option value='above' ".($translucence_options['header-text-display'] == 'above' ? ' selected' : '') . ">".__( 'Above', '2010-translucence' )."</option>
- </select>
- </span></span>";
- }
- }
-
- print "</td>";
- print "</tr>";
-
- // if not in active_options print out as hidden fields
- } else {
- translucence_get_option_selector ("size: ", "site-title-size", $translucence_options_values['header-text-size']);
- //translucence_get_option_field ("Color: #", "site-title-color", 6);
- translucence_get_option_selector ("offset: ", "header-text-shadow-offset", $translucence_options_values['text-shadow-offset']);
- translucence_get_option_selector ("blur: ", "header-text-shadow-blur", $translucence_options_values['text-shadow-blur']);
- translucence_get_option_selector ("color: ", "title-box-color", $translucence_options_values['header-color']);
- translucence_get_option_selector ("opacity:", "title-box-opacity", $translucence_options_values['header-opacity']);
- print "<input type='hidden' name='".$translucence_options_id."[header-text-display]' value = '".$translucence_options['header-text-display']."'/>";
- }
-
- // Tagline text size, color, box
- if (in_array('tagline-options', $active_options) || $translucence_custom_header_set == 1) {
- print "<tr>";
- print "<td class='option-row'>";
-
- // text size and color
- if (in_array('site-description-size', $active_options)) {
- // header-description-size options
- if (in_array("site-description-size", $translucence_config['model'])) {
- print "<span class='option-label'>".__( 'Tagline', '2010-translucence' )."</span><span class='option-label'>";
- $translucence_title = __( 'size', '2010-translucence' );
- translucence_get_option_selector ("size: ", "site-description-size", $translucence_options_values['header-text-size']);
- print "</span>";
- }
- // if not in active_options print out as hidden fields
- } else {
- translucence_get_option_selector ("size: ", "site-description-size", $translucence_options_values['header-text-size']);
- }
- if (in_array('site-description-color', $active_options)) {
- // header-description-color options
- if (in_array("site-description-color", $translucence_config['model'])) {
- print "<span class='option-label'>";
- $translucence_title = __( 'Color #', '2010-translucence' );
- translucence_get_option_field ($translucence_title, "site-description-color", 6);
- print "</span>";
- }
- // if not in active_options print out as hidden fields
- } else {
- translucence_get_option_field ("color: #", "site-description-color", 6);
- }
-
- if (in_array('description-box-color', $active_options) || $translucence_custom_header_set == 1) {
-
- if (in_array("description-box-color", $translucence_config['model'])) {
- print "<span class='option-label'> ".__( 'Tagline box', '2010-translucence' )."</span><span class='option-label'>";
- $translucence_title = __( 'color', '2010-translucence' );
- translucence_get_option_selector ($translucence_title, "description-box-color", $translucence_options_values['header-color']);
- print "</span>";
- }
-
- if (in_array("description-box-opacity", $translucence_config['model'])) {
- print "<span class='option-label'>";
- $translucence_title = __( 'opacity', '2010-translucence' );
- translucence_get_option_selector ($translucence_title, "description-box-opacity", $translucence_options_values['header-opacity']);
- print "</span>";
- }
- // if not in active_options print out as hidden fields
- } else {
- translucence_get_option_selector ("color:", "description-box-color", $translucence_options_values['header-color']);
- translucence_get_option_selector ("opacity:", "description-box-opacity", $translucence_options_values['header-opacity']);
- }
-
- print "</td>";
- print "</tr>";
- // if not in active_options print out as hidden fields
- } else {
- translucence_get_option_selector ("size: ", "site-description-size", $translucence_options_values['header-text-size']);
- translucence_get_option_field ("color: #", "site-description-color", 6);
- translucence_get_option_selector ("color:", "description-box-color", $translucence_options_values['header-color']);
- translucence_get_option_selector ("opacity:", "description-box-opacity", $translucence_options_values['header-opacity']);
- }
- print "</table>";
-
- // headermeta right and left options
- if (in_array('headermeta-options', $active_options)) {
- print "<table style='width: 100%;'>";
- print "<tr>";
- // headermeta left options
- print "<td style='width: 50%'>";
- if (in_array("header-meta-left", $translucence_config['model'])) {
- print "<span style='font-size: 9px;'>".__( 'Left Header Links', '2010-translucence' )."</span>\n";
- print "<select name='".$translucence_options_id."[header-meta-left]' style='font-size: 10px;' onchange='this.form.submit();'>";
- foreach (array_keys($translucence_config['header_meta_left_options']) as $meta_left_option) {
- print "<option value='".$translucence_config['header_meta_left_options'][$meta_left_option]['option_name']."' ";
- print ($translucence_options['header-meta-left'] == $translucence_config['header_meta_left_options'][$meta_left_option]['option_name'] ? ' selected' : '') . ">";
- print $translucence_config['header_meta_left_options'][$meta_left_option]['option_label']."</option>";
- }
- print "</select>";
- }
- print "</td>";
-
- // headermeta right options
- print "<td style='width: 50%; text-align: right;'>";
- if (in_array("header-meta-right", $translucence_config['model'])) {
- print "
- <span style='font-size: 9px;'>".__( 'Right Header Links', '2010-translucence' ).":</span>\n";
- print "<select name='".$translucence_options_id."[header-meta-right]' style='font-size: 10px;' onchange='this.form.submit();'>";
- foreach (array_keys($translucence_config['header_meta_right_options']) as $meta_right_option) {
- print "<option value='".$translucence_config['header_meta_right_options'][$meta_right_option]['option_name']."' ";
- print ($translucence_options['header-meta-right'] == $translucence_config['header_meta_right_options'][$meta_left_option]['option_name'] ? ' selected' : '') . ">";
- print $translucence_config['header_meta_right_options'][$meta_right_option]['option_label']."</option>";
- }
- print "</select>"; }
- print "</td>";
- print "</tr>";
- print "</table>";
- // if not in active_options print out as hidden fields
- } else {
- print "<input type='hidden' name='".$translucence_options_id."[header-meta-left]' value='".$translucence_options['header-meta-left']."'/>";
- //print "<input type='hidden' name='".$translucence_options_id."[headermeta]' value='".$translucence_options['headermeta']."'/>";
- }
- print "<div style='font-size: 10px;'>";
- if ($translucence_options['options-mode'] != "global" && $translucence_options['options-mode'] != "advanced") {
- print __( 'For more site and header options see', '2010-translucence' ).": ";
- print "<a style='color: #003366;' href='javascript:setThemeOptionsMode(\"basic\", \"".$translucence_options_id."\")'>Basic Options</a> | ";
- print "<a style='color: #003366;' href='javascript:setThemeOptionsMode(\"global\", \"".$translucence_options_id."\")'>Global Options</a>";
- } else {
- print __( 'For basic options see', '2010-translucence' ).": ";
- print "<a style='color: #003366;' href='javascript:setThemeOptionsMode(\"basic\", \"".$translucence_options_id."\")'>Basic Options</a>";
- }
- print "</div>";
- print "</div>";
- $global_options = ob_get_contents();
- ob_end_clean();
- return $global_options;
- }
- /**
- * Gets theme options UI for custom options
- *
- * @since 2010 Translucence 1.0
- * @return string html of custom options for theme options UI
- */
- function translucence_get_custom_options() {
- global $translucence_config, $translucence_options, $translucence_options_values;
- global $translucence_options_id;
- global $translucence_custom_header_set, $translucence_custom_background_set;
-
- ob_start();
- print "<div class='options' style='background-color: transparent; clear: both; border: none; margin-bottom: 35px;'>";
-
- if ($translucence_custom_header_set == 1) {
- print "<div class='post-link' style='float: left; width: 40%;'>";
- 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>";
- print "</div>";
- } else {
- print "<div class='post-link' style='float: left; width: 55%;'>";
- 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>";
- print "</div>";
- }
- if ($translucence_custom_background_set == 1) {
- print "<div class='post-link' style='float: right; width: 40%;'>";
- 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>";
- print "</div>";
- } else {
- print "<div class='post-link' style='float: right; width: 40%; '>";
- 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>";
- print "</div>";
- }
-
- if ($translucence_options['header-text-display'] == "hide") {
- print "<div style='float: left; color:".$translucence_options['bglinkcolor']."; padding-bottom: 10px;'>";
- print "<em>".__( 'Site Title and description are hidden', '2010-translucence')."</em> ";
- // 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();'/>";
- print "</div>";
- }
-
- print "</div>";
- $custom_options = ob_get_contents();
- ob_end_clean();
- return $custom_options;
- }
- /**
- * Gets theme options UI for layout options
- *
- * @uses translucence_get_option_selector() to generate select field for a given option
- * @uses is_active_sidebar() to determine if sidebar has widgets
- *
- * @since 2010 Translucence 1.0
- * @return string html of layout options for theme options UI
- */
- function translucence_get_layout_options() {
- global $translucence_config, $translucence_options, $translucence_options_values, $translucence_model_content_width;
- global $translucence_options_id, $active_options;
- ob_start();
- if (in_array('layout-options', $active_options)) {
- print "<div class='options' style='background-color: transparent; clear: both;'>";
- print "<div style='font-size: 10px; text-align: center;'>← ".$translucence_model_content_width." px →<br/>";
-
- if ($translucence_options['variation-type'] == "custom") {
- print "<span style='font-size: 10px;'>".__( 'Content', '2010-translucence')."</span>\n";
- translucence_get_option_selector ("", "content-color", $translucence_options_values['sidebar-color']);
- translucence_get_option_selector ("", "content-opacity", $translucence_options_values['sidebar-opacity']);
- translucence_get_option_selector ("", "content-border-style", $translucence_options_values['border-style']);
- }
- print "</div>";
-
- print "<table style='width: 100%;'>";
- print "<tr>";
- // left sidebar
- print "<td>";
- print "<div>".__( 'Left Sidebar', '2010-translucence')."</div>\n";
- // hidden widgets warning
- if (is_active_sidebar("sidebar-1") && $translucence_options['left01-width'] == 0) {
- print "<span class='warning' style='font-size: 10px'>".__( 'hidden widgets!', '2010-translucence')."</span>";
- }
- //width
- translucence_get_option_selector ("", "left01-width", $translucence_options_values['sidebar-width']);
- print "</td>";
- // Right sidebar
- print "<td style='text-align: right;'>";
- print "<div>".__( '1st Right Sidebar', '2010-translucence')."</div>\n";
- // hidden widgets warning
- if (is_active_sidebar("primary-widget-area") && $translucence_options['right01-width'] == 0) {
- print "<span class='warning' style='font-size: 10px'>".__( 'hidden widgets!', '2010-translucence')."</span>";
- }
- // width
- translucence_get_option_selector ("", "right01-width", $translucence_options_values['sidebar-width']);
- print "</td>";
- print "</tr>";
- print "<tr>";
-
- // Default Post Display
- print "<td>";
- print "<div>".__( 'Default Post Display', '2010-translucence')."</div>\n";
- translucence_get_option_selector ("", "default-post-display", $translucence_options_values['post-display']);
- print "</td>";
-
- // 2nd Right sidebar
- print "<td style='text-align: right;'>";
- print "<div>".__( '2nd Right Sidebar', '2010-translucence')."</div>\n";
- // hidden widgets warning
- if (is_active_sidebar("secondary-widget-area") && $translucence_options['right02-width'] == 0) {
- print "<span class='warning' style='font-size: 10px'>".__( 'hidden widgets!', '2010-translucence')."</span>";
- }
- // width
- translucence_get_option_selector ("", "right02-width", $translucence_options_values['sidebar-width']);
- print "</td>";
- print "</tr>";
- print "</table>";
- print __( 'For more sidebar options, see', '2010-translucence').": ";
- print "<a href='javascript:setThemeOptionsMode(\"layout\", \"".$translucence_options_id."\")'>".__( 'Layout Options', '2010-translucence')."</a> | ";
- print "<a href='javascript:setThemeOptionsMode(\"sidebar\", \"".$translucence_options_id."\")'>".__( 'Sidebar Options', '2010-translucence')."</a>";
- print "</div>";
-
- if ($translucence_options['options-mode'] == "layout") {
- print "<input type='hidden' name='".$translucence_options_id."[site-title-color]' value = '".$translucence_options['site-title-color']."'/>";
- print "<input type='hidden' name='".$translucence_options_id."[site-description-color]' value = '".$translucence_options['site-description-color']."'/>";
- }
-
- // if not in active_options print out as hidden fields
- } else {
-
- translucence_get_option_selector ("", "content-color", $translucence_options_values['sidebar-color']);
- translucence_get_option_selector ("", "content-opacity", $translucence_options_values['sidebar-opacity']);
- translucence_get_option_selector ("", "content-border-style", $translucence_options_values['border-style']);
- translucence_get_option_selector ("", "left01-width", $translucence_options_values['sidebar-width']);
- translucence_get_option_selector ("", "right01-width", $translucence_options_values['sidebar-width']);
- translucence_get_option_selector ("", "right02-width", $translucence_options_values['sidebar-width']);
- print "<div style='font-size: 10px;'>";
- print __( 'For more sidebar layout options, see', '2010-translucence').": ";
- print "<a href='javascript:setThemeOptionsMode(\"layout\", \"".$translucence_options_id."\")'>".__( 'Layout Options', '2010-translucence')."</a>";
- print "</div>";
- }
- $entry_options = ob_get_contents();
- ob_end_clean();
- return $entry_options;
- …
Large files files are truncated, but you can click here to view the full file