Beispiel #1
0
 function baselines()
 {
     $thesis_design = new thesis_design_options();
     $thesis_design->get_options();
     $this->base['num'] = 10;
     $this->fonts = $thesis_design->fonts;
     $this->colors = $thesis_design->colors;
     $this->borders = $thesis_design->borders;
     $this->nav = $thesis_design->nav;
     $this->layout = $thesis_design->layout;
     $this->teasers = $thesis_design->teasers;
     $this->feature_box = $thesis_design->feature_box;
     $this->multimedia_box = $thesis_design->multimedia_box;
     // Calculate line heights
     if (is_array($this->fonts['sizes'])) {
         foreach ($this->fonts['sizes'] as $area => $size) {
             if ($area == 'header' || $area == 'tagline' || $area == 'sidebars' || $area == 'code') {
                 $line_height = $size + 6;
                 if ($line_height % 2 == 1) {
                     $line_height = $line_height - 1;
                 }
             } elseif ($area == 'nav_menu') {
                 $line_height = $size + 4;
                 if ($line_height % 2 == 1) {
                     $line_height = $line_height - 1;
                 }
             } else {
                 $line_height = $size + 8;
                 if ($line_height % 2 == 1) {
                     $line_height = $line_height - 1;
                 }
             }
             $this->line_heights[$area] = $line_height;
         }
     }
     $this->base['horizontal'] = $this->line_heights['content'];
     $this->base['page_padding'] = $this->layout['page_padding'] ? $this->line_heights['content'] * $this->layout['page_padding'] : 0;
 }
Beispiel #2
0
<?php

// Internationalization
load_theme_textdomain('thesis', THESIS_LIB . '/languages');
// Register sidebars and widgets
thesis_register_sidebars();
thesis_register_widgets();
$thesis_site = new thesis_site_options();
$thesis_design = new thesis_design_options();
$thesis_terms = new thesis_term_options();
$thesis_data = new thesis_data();
$thesis_site->get_options();
$thesis_design->get_options();
$thesis_terms->get_terms();
// Add Thesis Options and Design Options pages to the WordPress Dashboard
if (is_admin()) {
    thesis_admin_setup();
}
if ($_GET['activated']) {
    thesis_upgrade();
}
// Deconstruct the WordPress header to make way for Thesis pwnage
remove_action('wp_head', 'wp_generator');
remove_action('wp_head', 'start_post_rel_link');
remove_action('wp_head', 'index_rel_link');
remove_action('wp_head', 'adjacent_posts_rel_link_wp_head');
remove_action('wp_head', 'parent_post_rel_link');
remove_action('wp_head', 'rel_canonical');
remove_action('wp_head', 'wp_shortlink_wp_head');
remove_action('wp_head', 'rsd_link');
remove_action('wp_head', 'wlwmanifest_link');
Beispiel #3
0
 function upgrade_options()
 {
     $site_options = new thesis_site_options();
     $site_options->get_options();
     $default_site_options = new thesis_site_options();
     $default_site_options->default_options();
     $design_options = new thesis_design_options();
     $design_options->get_options();
     $default_design_options = new thesis_design_options();
     $default_design_options->default_options();
     // This is necessary for the 1.8 upgrade
     $page_options = new thesis_page_options();
     $page_options->get_options();
     $page_options->upgrade_terms();
     // Begin code to upgrade all Thesis Options to the newest data structures
     if (isset($site_options->multimedia_box)) {
         $multimedia_box = $site_options->multimedia_box;
     }
     if (isset($design_options->home_layout)) {
         if ($design_options->home_layout) {
             $features = $design_options->teasers;
             unset($design_options->teasers);
         } else {
             $features = get_option('posts_per_page');
         }
     }
     // If any new data structures have been introduced, incorporate them now
     foreach ($default_site_options as $option_name => $value) {
         if (!isset($site_options->{$option_name})) {
             $site_options->{$option_name} = $default_site_options->{$option_name};
         }
     }
     foreach ($default_design_options as $option_name => $value) {
         if (!isset($design_options->{$option_name})) {
             $design_options->{$option_name} = $value;
         }
     }
     // 1.8 nav upgrade and cleanup
     if (isset($site_options->nav)) {
         if (!isset($site_options->nav['type'])) {
             $site_options->nav['type'] = 'thesis';
         }
         if (isset($site_options->nav['submenu_width'])) {
             unset($site_options->nav['submenu_width']);
         }
         if (isset($site_options->nav['border'])) {
             unset($site_options->nav['border']);
         }
         if (isset($site_options->nav['style'])) {
             unset($site_options->nav['style']);
         }
     }
     // Home page options upgrade for 1.8
     if (isset($site_options->home)) {
         if (isset($site_options->home['meta']['description'])) {
             $site_options->home['head']['meta']['description'] = $site_options->home['meta']['description'];
             unset($site_options->home['meta']['description']);
         } elseif (isset($site_options->head['meta']['description'])) {
             $site_options->home['head']['meta']['description'] = $site_options->head['meta']['description'];
             unset($site_options->head['meta']['description']);
         }
         if (isset($site_options->home['meta']['keywords'])) {
             $site_options->home['head']['meta']['keywords'] = $site_options->home['meta']['keywords'];
             unset($site_options->home['meta']['keywords']);
         } elseif (isset($site_options->head['meta']['keywords'])) {
             $site_options->home['head']['meta']['keywords'] = $site_options->head['meta']['keywords'];
             unset($site_options->head['meta']['keywords']);
         }
         if (isset($site_options->home['features'])) {
             $design_options->home['body']['content']['features'] = $site_options->home['features'];
             unset($site_options->home['features']);
         }
     } else {
         if (isset($site_options->meta_description)) {
             $site_options->home['head']['meta']['description'] = $site_options->meta_description;
         }
         if (isset($site_options->meta_keywords)) {
             $site_options->home['head']['meta']['keywords'] = $site_options->meta_keywords;
         }
     }
     if (isset($design_options->layout['home'])) {
         if ($design_options->layout['home'] == 'teasers') {
             $design_options->home['body']['content']['features'] = $design_options->teasers['features'] ? $design_options->teasers['features'] : 2;
             unset($design_options->teasers['features']);
         } else {
             $design_options->home['body']['content']['features'] = get_option('posts_per_page');
         }
         #wp
         foreach ($design_options->layout as $layout_var => $value) {
             if ($layout_var != 'home') {
                 $new_layout[$layout_var] = $value;
             }
         }
         if ($new_layout) {
             $design_options->layout = $new_layout;
         }
     } elseif (isset($features)) {
         $design_options->home['body']['content']['features'] = $features;
     }
     // Display options move for 1.8
     if (isset($site_options->display)) {
         $design_options->display = $site_options->display;
         if (isset($site_options->comments)) {
             $design_options->display['comments'] = $site_options->comments;
         }
     }
     // Home page options move for 1.8
     if (isset($page_options->home)) {
         if (isset($page_options->home['head'])) {
             $site_options->home['head'] = $page_options->home['head'];
         }
         if (isset($page_options->home['body'])) {
             $design_options->home['body'] = $page_options->home['body'];
         }
         if (isset($page_options->home['javascript'])) {
             $design_options->home['javascript'] = $page_options->home['javascript'];
         }
     }
     // Updated $head array for 1.7
     if (isset($site_options->head['title']['title']) || isset($site_options->head['title']['tagline'])) {
         $separator = $site_options->head['title']['separator'] ? urldecode($site_options->head['title']['separator']) : '&#8212;';
         if ($site_options->head['title']['title'] && $site_options->head['title']['tagline']) {
             $title = $site_options->head['title']['tagline_first'] ? get_bloginfo('description') . " {$separator} " . get_bloginfo('name') : get_bloginfo('name') . " {$separator} " . get_bloginfo('description');
         } elseif ($site_options->head['title']['title']) {
             $title = get_bloginfo('name');
         } else {
             $title = get_bloginfo('description');
         }
         $site_options->home['head']['title'] = urlencode($title);
         unset($site_options->head['title']['title'], $site_options->head['title']['tagline'], $site_options->head['title']['tagline_first']);
     }
     if (isset($site_options->head['noindex'])) {
         $site_options->head['meta']['robots']['noindex'] = $site_options->head['meta']['robots']['nofollow'] = $site_options->head['noindex'];
         $site_options->head['meta']['robots']['noindex']['sub'] = true;
         unset($site_options->head['noindex']);
     }
     if (!isset($site_options->head['meta']['robots']['nofollow'])) {
         $site_options->head['meta']['robots']['nofollow'] = $default_site_options->head['meta']['robots']['nofollow'];
     }
     if (!isset($site_options->head['meta']['robots']['noarchive'])) {
         $site_options->head['meta']['robots']['noarchive'] = $default_site_options->head['meta']['robots']['noarchive'];
     }
     if (!isset($site_options->head['meta']['robots']['noodp'])) {
         $site_options->head['meta']['robots']['noodp'] = $default_site_options->head['meta']['robots']['noodp'];
     }
     if (!isset($site_options->head['meta']['robots']['noydir'])) {
         $site_options->head['meta']['robots']['noydir'] = $default_site_options->head['meta']['robots']['noydir'];
     }
     if (isset($site_options->head['canonical'])) {
         $site_options->head['links']['canonical'] = $site_options->head['canonical'];
         unset($site_options->head['canonical']);
     }
     if (isset($site_options->head['version'])) {
         unset($site_options->head['version']);
     }
     if ($site_options->feed['url']) {
         $site_options->head['feed']['url'] = $site_options->feed['url'];
     } elseif (isset($site_options->feed_url)) {
         $site_options->head['feed']['url'] = $site_options->feed_url;
     }
     if (isset($site_options->scripts)) {
         $site_options->head['scripts'] = $site_options->scripts['header'];
         $site_options->javascript['scripts'] = $site_options->scripts['footer'];
     }
     if (isset($site_options->header_scripts)) {
         $site_options->head['scripts'] = $site_options->header_scripts;
     } elseif (isset($site_options->mint)) {
         $site_options->head['scripts'] = $site_options->mint;
     }
     if (isset($site_options->footer_scripts)) {
         $site_options->javascript['scripts'] = $site_options->footer_scripts;
     } elseif (isset($site_options->analytics)) {
         $site_options->javascript['scripts'] = $site_options->analytics;
     }
     // Custom stylesheet option, updated for 1.8
     if (isset($design_options->layout['custom']) && !isset($site_options->custom['stylesheet'])) {
         $site_options->custom['stylesheet'] = (bool) $design_options->layout['custom'];
         unset($design_options->layout['custom']);
     } elseif (isset($site_options->style)) {
         $site_options->custom['stylesheet'] = (bool) $site_options->style['custom'];
     }
     // Display options (updated for 1.8)
     if (isset($site_options->show_title)) {
         $design_options->display['header']['title'] = (bool) $site_options->show_title;
     }
     if (isset($site_options->show_tagline)) {
         $design_options->display['header']['tagline'] = (bool) $site_options->show_tagline;
     }
     if (isset($site_options->show_author)) {
         $design_options->display['byline']['author']['show'] = (bool) $site_options->show_author;
     }
     if (isset($site_options->link_author_names)) {
         $design_options->display['byline']['author']['link'] = (bool) $site_options->link_author_names;
     }
     if (isset($site_options->author_nofollow)) {
         $design_options->display['byline']['author']['nofollow'] = (bool) $site_options->author_nofollow;
     }
     if (isset($site_options->show_date)) {
         $design_options->display['byline']['date']['show'] = (bool) $site_options->show_date;
     }
     if (isset($site_options->show_author_on_pages)) {
         $design_options->display['byline']['page']['author'] = (bool) $site_options->show_author_on_pages;
     }
     if (isset($site_options->show_date_on_pages)) {
         $design_options->display['byline']['page']['date'] = (bool) $site_options->show_date_on_pages;
     }
     if (isset($site_options->show_num_comments)) {
         $design_options->display['byline']['num_comments']['show'] = (bool) $site_options->show_num_comments;
     }
     if (isset($site_options->show_categories)) {
         $design_options->display['byline']['categories']['show'] = (bool) $site_options->show_categories;
     }
     if (isset($site_options->read_more_text)) {
         $design_options->display['posts']['read_more_text'] = $site_options->read_more_text;
     } elseif (isset($site_options->display['read_more_text'])) {
         $design_options->display['posts']['read_more_text'] = $site_options->display['read_more_text'];
     }
     if (isset($site_options->show_post_nav)) {
         $design_options->display['posts']['nav'] = (bool) $site_options->show_post_nav;
     } elseif (isset($site_options->display['navigation'])) {
         $design_options->display['posts']['nav'] = (bool) $site_options->display['navigation'];
     }
     if (isset($site_options->archive_style)) {
         $design_options->display['archives']['style'] = $site_options->archive_style;
     }
     if (isset($site_options->tags_single)) {
         $design_options->display['tags']['single'] = (bool) $site_options->tags_single;
     }
     if (isset($site_options->tags_index)) {
         $design_options->display['tags']['index'] = (bool) $site_options->tags_index;
     }
     if (isset($site_options->tags_nofollow)) {
         $design_options->display['tags']['nofollow'] = (bool) $site_options->tags_nofollow;
     }
     if (isset($site_options->show_default_widgets)) {
         $design_options->display['sidebars']['default_widgets'] = (bool) $site_options->show_default_widgets;
     }
     if (isset($site_options->edit_post_link)) {
         $design_options->display['admin']['edit_post'] = (bool) $site_options->edit_post_link;
     }
     if (isset($site_options->admin_link)) {
         $design_options->display['admin']['link'] = $site_options->admin_link == 'always' ? true : false;
     }
     // Update old comment options for version 1.8
     if (isset($site_options->display['comments'])) {
         // Thesis Options
         $design_options->display['comments']['disable_pages'] = (bool) $site_options->display['comments']['disable_pages'];
         // Design Options
         $design_options->comments['comments']['options']['meta']['number']['show'] = (bool) $site_options->display['comments']['numbers'];
         $design_options->comments['comments']['options']['meta']['avatar']['options']['size'] = $site_options->display['comments']['avatar_size'];
     }
     if (isset($site_options->show_comment_numbers)) {
         $design_options->comments['comments']['options']['meta']['number']['show'] = (bool) $site_options->show_comment_numbers;
     }
     if (isset($site_options->avatar_size)) {
         $design_options->comments['comments']['options']['meta']['avatar']['options']['size'] = $site_options->avatar_size;
     }
     if (isset($site_options->disable_comments)) {
         $design_options->display['comments']['disable_pages'] = (bool) $site_options->disable_comments;
     }
     // Nav menu
     if (isset($site_options->nav_menu_pages)) {
         $nav_menu_pages = explode(',', $site_options->nav_menu_pages);
         foreach ($nav_menu_pages as $nav_page) {
             if ($nav_page) {
                 $site_options->nav['pages'][$nav_page]['show'] = true;
             }
         }
     }
     if (isset($site_options->nav_category_pages)) {
         $site_options->nav['categories'] = $site_options->nav_category_pages;
     }
     if (isset($site_options->nav_link_category)) {
         $site_options->nav['links'] = $site_options->nav_link_category;
     }
     if (isset($site_options->nav_home_text)) {
         $site_options->nav['home']['text'] = $site_options->nav_home_text;
     }
     if (isset($site_options->show_feed_link)) {
         $site_options->nav['feed']['show'] = (bool) $site_options->show_feed_link;
     }
     if (isset($site_options->feed_link_text)) {
         $site_options->nav['feed']['text'] = $site_options->feed_link_text;
     }
     // Post images and thumbnails
     if (isset($site_options->image)) {
         // This is for 1.7
         $design_options->image = $site_options->image;
     } else {
         // This is suuuuper legacy
         if (isset($design_options->post_image_horizontal)) {
             $design_options->image['post']['x'] = $design_options->post_image_horizontal;
         }
         if (isset($design_options->post_image_vertical)) {
             $design_options->image['post']['y'] = $design_options->post_image_vertical;
         }
         if (isset($design_options->post_image_frame)) {
             $design_options->image['post']['frame'] = $design_options->post_image_frame ? 'on' : 'off';
         }
         if (isset($design_options->post_image_single)) {
             $design_options->image['post']['single'] = $design_options->post_image_single;
         }
         if (isset($design_options->post_image_archives)) {
             $design_options->image['post']['archives'] = $design_options->post_image_archives;
         }
         if (isset($design_options->thumb_horizontal)) {
             $design_options->image['thumb']['x'] = $design_options->thumb_horizontal;
         }
         if (isset($design_options->thumb_vertical)) {
             $design_options->image['thumb']['y'] = $design_options->thumb_vertical;
         }
         if (isset($design_options->thumb_frame)) {
             $design_options->image['thumb']['frame'] = $design_options->thumb_frame ? 'on' : 'off';
         }
         if (isset($design_options->thumb_size)) {
             $design_options->image['thumb']['width'] = $design_options->thumb_size['width'];
             $design_options->image['thumb']['height'] = $design_options->thumb_size['height'];
         }
     }
     // Multimedia box
     if (isset($multimedia_box) && is_array($multimedia_box)) {
         foreach ($multimedia_box as $item => $value) {
             $design_options->multimedia_box[$item] = $value;
         }
     } elseif (isset($multimedia_box)) {
         $design_options->multimedia_box['status'] = $multimedia_box;
         if ($site_options->image_alt_tags) {
             foreach ($site_options->image_alt_tags as $image_name => $alt_text) {
                 if ($alt_text != '') {
                     $design_options->multimedia_box['alt_tags'][$image_name] = $alt_text;
                 }
             }
         }
         if ($site_options->image_link_urls) {
             foreach ($site_options->image_link_urls as $image_name => $link_url) {
                 if ($link_url != '') {
                     $design_options->multimedia_box['link_urls'][$image_name] = $link_url;
                 }
             }
         }
         if ($site_options->video_code) {
             $design_options->multimedia_box['video'] = $site_options->video_code;
         }
         if ($site_options->custom_code) {
             $design_options->multimedia_box['code'] = $site_options->custom_code;
         }
     }
     // Loop back through all existing Thesis Options and make changes as necessary
     foreach ($site_options as $option_name => $value) {
         if (!isset($default_site_options->{$option_name})) {
             unset($site_options->{$option_name});
         }
         // Has this option been nuked? If so, kill it!
     }
     if (version_compare($site_options->version, thesis_version(), '<')) {
         $site_options->version = thesis_version();
     }
     update_option('thesis_options', $site_options);
     // Save upgraded Thesis Options
     update_option('thesis_design_options', $design_options);
     // Save upgraded Design Options
     delete_option('thesis_pages');
 }
 function manage_options()
 {
     if (isset($_GET['download'])) {
         if ($_GET['download'] == 'site') {
             check_admin_referer('thesis-download-site');
             #wp
             header("Cache-Control: public, must-revalidate");
             header("Pragma: hack");
             header("Content-Type: text/plain");
             header('Content-Disposition: attachment; filename="thesis-site-options-' . date("Ymd") . '.dat"');
             $site_options = new thesis_site_options();
             $site_options->get_options();
             echo serialize($site_options);
             exit;
         } elseif ($_GET['download'] == 'design') {
             check_admin_referer('thesis-download-design');
             #wp
             header("Cache-Control: public, must-revalidate");
             header("Pragma: hack");
             header("Content-Type: text/plain");
             header('Content-Disposition: attachment; filename="thesis-design-options-' . date("Ymd") . '.dat"');
             $design_options = new thesis_design_options();
             $design_options->get_options();
             echo serialize($design_options);
             exit;
         } elseif ($_GET['download'] == 'all') {
             check_admin_referer('thesis-download-all');
             #wp
             header("Cache-Control: public, must-revalidate");
             header("Pragma: hack");
             header("Content-Type: text/plain");
             header('Content-Disposition: attachment; filename="thesis-all-options-' . date("Ymd") . '.dat"');
             $site_options = new thesis_site_options();
             $site_options->get_options();
             $design_options = new thesis_design_options();
             $design_options->get_options();
             echo serialize(array('site_options' => $site_options, 'design_options' => $design_options));
             exit;
         }
     } elseif (isset($_GET['restore'])) {
         if ($_GET['restore'] == 'site') {
             check_admin_referer('thesis-restore-site');
             #wp
             $default_site_options = new thesis_site_options();
             $default_site_options->default_options();
             update_option('thesis_options', $default_site_options);
             #wp
             wp_redirect(admin_url('admin.php?page=options-manager&restored=true&type=Site'));
             #wp
         } elseif ($_GET['restore'] == 'design') {
             check_admin_referer('thesis-restore-design');
             #wp
             $default_design_options = new thesis_design_options();
             $default_design_options->default_options();
             update_option('thesis_design_options', $default_design_options);
             #wp
             thesis_generate_css();
             wp_redirect(admin_url('admin.php?page=options-manager&restored=true&type=Design'));
             #wp
         } elseif ($_GET['restore'] == 'all') {
             check_admin_referer('thesis-restore-all');
             #wp
             $default_site_options = new thesis_site_options();
             $default_site_options->default_options();
             $default_design_options = new thesis_design_options();
             $default_design_options->default_options();
             update_option('thesis_options', $default_site_options);
             #wp
             update_option('thesis_design_options', $default_design_options);
             #wp
             thesis_generate_css();
             wp_redirect(admin_url('admin.php?page=options-manager&restored=true&type=All'));
             #wp
         }
     } elseif (isset($_POST['upload'])) {
         global $thesis_site;
         if ($_POST['upload'] == 'site') {
             check_admin_referer('thesis-upload-site', '_wpnonce-thesis-upload-site');
             #wp
             if (strpos($_FILES['file']['name'], 'thesis-site-options') === false) {
                 wp_redirect(admin_url('admin.php?page=options-manager&type=Site&error=wrongfile'));
             } elseif ($_FILES['file']['error'] > 0) {
                 wp_redirect(admin_url('admin.php?page=options-manager&type=Site&error=file'));
             } else {
                 $raw_options = file_get_contents($_FILES['file']['tmp_name']);
                 $site_options = new thesis_site_options();
                 $site_options = unserialize($raw_options);
                 if (function_exists('wp_cache_clean_cache')) {
                     #wp
                     global $file_prefix;
                     wp_cache_clean_cache($file_prefix);
                 }
                 if (is_object($site_options) && version_compare($thesis_site->version, $site_options->version, '==')) {
                     update_option('thesis_options', $site_options);
                     #wp
                     wp_redirect(admin_url('admin.php?page=options-manager&imported=true&type=Site'));
                     #wp
                 } else {
                     wp_redirect(admin_url("admin.php?page=options-manager&type=Site&error=version&tried={$site_options->version}"));
                 }
                 #wp
             }
         } elseif ($_POST['upload'] == 'design') {
             check_admin_referer('thesis-upload-design', '_wpnonce-thesis-upload-design');
             #wp
             if (strpos($_FILES['file']['name'], 'thesis-design-options') === false) {
                 wp_redirect(admin_url('admin.php?page=options-manager&type=Design&error=wrongfile'));
             } elseif ($_FILES['file']['error'] > 0) {
                 wp_redirect(admin_url('admin.php?page=options-manager&type=Design&error=file'));
             } else {
                 $raw_options = file_get_contents($_FILES['file']['tmp_name']);
                 $design_options = new thesis_design_options();
                 $design_options = unserialize($raw_options);
                 if (function_exists('wp_cache_clean_cache')) {
                     #wp
                     global $file_prefix;
                     wp_cache_clean_cache($file_prefix);
                 }
                 if (is_object($design_options) && version_compare($thesis_site->version, $design_options->version, '==')) {
                     update_option('thesis_design_options', $design_options);
                     #wp
                     thesis_generate_css();
                     wp_redirect(admin_url('admin.php?page=options-manager&imported=true&type=Design'));
                     #wp
                 } else {
                     wp_redirect(admin_url('admin.php?page=options-manager&type=Design&error=version-unknown'));
                 }
                 #wp
             }
         } elseif ($_POST['upload'] == 'all') {
             check_admin_referer('thesis-upload-all', '_wpnonce-thesis-upload-all');
             #wp
             if (strpos($_FILES['file']['name'], 'thesis-all-options') === false) {
                 wp_redirect(admin_url('admin.php?page=options-manager&type=All&error=wrongfile'));
             } elseif ($_FILES['file']['error'] > 0) {
                 wp_redirect(admin_url('admin.php?page=options-manager&type=All&error=file'));
             } else {
                 $raw_options = file_get_contents($_FILES['file']['tmp_name']);
                 $all_options = unserialize($raw_options);
                 $site_options = new thesis_site_options();
                 $design_options = new thesis_design_options();
                 $site_options = $all_options['site_options'];
                 $design_options = $all_options['design_options'];
                 if (function_exists('wp_cache_clean_cache')) {
                     #wp
                     global $file_prefix;
                     wp_cache_clean_cache($file_prefix);
                     #wp
                 }
                 if (is_object($site_options) && version_compare($thesis_site->version, $site_options->version, '==') && is_object($design_options) && version_compare($thesis_site->version, $design_options->version, '==')) {
                     update_option('thesis_options', $site_options);
                     #wp
                     update_option('thesis_design_options', $design_options);
                     #wp
                     thesis_generate_css();
                     wp_redirect(admin_url('admin.php?page=options-manager&imported=true&type=All'));
                     #wp
                 } else {
                     wp_redirect(admin_url("admin.php?page=options-manager&type=All&error=version&tried={$site_options->version}"));
                 }
                 #wp
             }
         }
     }
 }
Beispiel #5
0
    function baselines()
    {
        $this->stacks = new thesis_fonts();
        $thesis_design = new thesis_design_options();
        $thesis_design->get_options();
        $this->base['num'] = 10;
        $this->fonts = $thesis_design->fonts;
        $this->colors = $thesis_design->colors;
        $this->borders = $thesis_design->borders;
        $this->nav = $thesis_design->nav;
        $this->layout = $thesis_design->layout;
        $this->teasers = $thesis_design->teasers;
        $this->feature_box = $thesis_design->feature_box;
        $this->multimedia_box = $thesis_design->multimedia_box;
        $this->css .= '/*---:[ copyright notice ]:-----------------------------------------------------

The CSS, JavaScript, and images contained in Thesis are all released under the
Thesis Proprietary Use License and cannot be redistributed. Doing so will
result in termination of membership with DIYthemes.

The custom.css file and any images in the custom images folder do NOT fall
under the Thesis Proprietary Use License. The end user determines the license
that should be applied here (if applicable).

The jscolor color picker script and associated images do NOT fall under the
Thesis Proprietary Use License and are free for use as determined by the GNU
Lesser GPL.

For more information on Thesis licensing and the Terms of Service, please see
the terms_of_service.txt file included in this package.

------------------------------------------------------------------------------*/' . "\n\n";
        // Set up typefaces
        foreach ($this->fonts['families'] as $area => $active_font) {
            if ($this->stacks->fonts[$active_font]['google']) {
                $google_fonts[] = $active_font;
            }
            if ($area == 'code' && !$active_font) {
                $this->font_families[$area] = 'font-family: ' . $this->stacks->fonts[$this->fonts['families']['body']]['family'] . '; ';
            } elseif ($area == 'tagline' && !$active_font) {
                $this->font_families[$area] = $this->fonts['families']['header'] ? 'font-family: ' . $this->stacks->fonts[$this->fonts['families']['header']]['family'] . '; ' : '';
            } elseif ($area == 'subheads') {
                if ($active_font) {
                    $this->font_families[$area] = '.format_text h2, .format_text h3, .format_text h4, .format_text h5, .format_text h6 { font-family: ' . $this->stacks->fonts[$active_font]['family'] . '; }' . "\n";
                } elseif ($this->fonts['families']['headlines']) {
                    $this->font_families[$area] = '.format_text h2, .format_text h3, .format_text h4, .format_text h5, .format_text h6 { font-family: ' . $this->stacks->fonts[$this->fonts['families']['headlines']]['family'] . '; }' . "\n";
                } else {
                    $this->font_families[$area] = '';
                }
            } elseif ($area == 'multimedia_box') {
                $this->font_families['multimedia_box'] = $active_font ? '#multimedia_box { font-family: ' . $this->stacks->fonts[$this->fonts['families']['multimedia_box']]['family'] . "; }" : '';
            } elseif ($active_font) {
                $this->font_families[$area] = 'font-family: ' . $this->stacks->fonts[$active_font]['family'] . '; ';
            }
        }
        // Import CSS for applicable Google fonts
        $this->css .= is_array($google_fonts) ? $this->stacks->import_css($google_fonts) . "\n" : '';
        // Calculate line heights
        if (is_array($this->fonts['sizes'])) {
            foreach ($this->fonts['sizes'] as $area => $size) {
                if ($area == 'header' || $area == 'tagline' || $area == 'sidebars' || $area == 'code') {
                    $line_height = $size + 6;
                    if ($line_height % 2 == 1) {
                        $line_height = $line_height - 1;
                    }
                } elseif ($area == 'nav_menu') {
                    $line_height = $size + 4;
                    if ($line_height % 2 == 1) {
                        $line_height = $line_height - 1;
                    }
                } else {
                    $line_height = $size + 8;
                    if ($line_height % 2 == 1) {
                        $line_height = $line_height - 1;
                    }
                }
                $this->line_heights[$area] = $line_height;
            }
        }
        $this->base['horizontal'] = $this->line_heights['content'];
        $this->base['page_padding'] = $this->layout['page_padding'] ? $this->line_heights['content'] * $this->layout['page_padding'] : 0;
    }
Beispiel #6
0
 function upgrade_options()
 {
     // Retrieve Design Options and Design Options defaults
     $design_options = new thesis_design_options();
     $design_options->get_options();
     $default_design_options = new thesis_design_options();
     $default_design_options->default_options();
     // Retrieve Thesis Options and Thesis Options defaults
     $thesis_options = new thesis_site_options();
     $thesis_options->get_options();
     $default_options = new thesis_site_options();
     $default_options->default_options();
     if (isset($design_options->teasers) && !is_array($design_options->teasers)) {
         unset($design_options->teasers);
     }
     if (isset($design_options->feature_box_condition)) {
         $feature_box = $design_options->feature_box;
         unset($design_options->feature_box);
     }
     if (isset($thesis_options->multimedia_box)) {
         $multimedia_box = $thesis_options->multimedia_box;
     }
     // Ubiquitous options upgrade code
     foreach ($default_design_options as $option_name => $value) {
         if (!isset($design_options->{$option_name})) {
             $design_options->{$option_name} = $value;
         }
     }
     // 1.7 upgrade
     if (isset($design_options->style)) {
         $design_options->layout['custom'] = (bool) $design_options->style['custom'];
     }
     // 1.6b niceness
     if (!isset($design_options->nav['link']['parent'])) {
         $design_options->nav['link']['parent'] = $default_design_options->nav['link']['parent'];
     }
     if (!isset($design_options->nav['background']['parent'])) {
         $design_options->nav['background']['parent'] = $default_design_options->nav['background']['parent'];
     }
     // Version-specific upgrade code
     if (isset($design_options->font_sizes)) {
         foreach ($design_options->fonts as $area => $family) {
             $design_options->fonts['families'][$area] = $family ? $family : false;
         }
         foreach ($design_options->font_sizes as $area => $size) {
             $design_options->fonts['sizes'][$area] = $size;
         }
     }
     if (isset($design_options->num_columns)) {
         $design_options->layout['columns'] = $design_options->num_columns;
     }
     if (isset($design_options->widths)) {
         $design_options->layout['widths']['content'] = $design_options->widths['content'] ? $design_options->widths['content'] : 480;
         $design_options->layout['widths']['sidebar_1'] = $design_options->widths['sidebar_1'] ? $design_options->widths['sidebar_1'] : 195;
         $design_options->layout['widths']['sidebar_2'] = $design_options->widths['sidebar_2'] ? $design_options->widths['sidebar_2'] : 195;
     }
     if (isset($design_options->column_order)) {
         $design_options->layout['order'] = $design_options->column_order;
     }
     if (isset($design_options->html_framework)) {
         $design_options->layout['framework'] = $design_options->html_framework ? $design_options->html_framework : 'page';
     }
     if (isset($design_options->page_padding)) {
         $design_options->layout['page_padding'] = $design_options->page_padding;
     }
     if (isset($design_options->teaser_options) && isset($design_options->teaser_content)) {
         foreach ($design_options->teaser_content as $teaser_area) {
             $new_teaser_options[$teaser_area]['name'] = $design_options->teasers['options'][$teaser_area]['name'];
             $new_teaser_options[$teaser_area]['show'] = (bool) $design_options->teaser_options[$teaser_area];
         }
         if ($new_teaser_options) {
             $design_options->teasers['options'] = $new_teaser_options;
         }
     }
     if (isset($design_options->teaser_date)) {
         $design_options->teasers['date']['format'] = $design_options->teaser_date ? $design_options->teaser_date : 'standard';
     }
     if (isset($design_options->teaser_date_custom)) {
         $design_options->teasers['date']['custom'] = $design_options->teaser_date_custom ? $design_options->teaser_date_custom : 'F j, Y';
     }
     if (isset($design_options->teaser_font_sizes)) {
         foreach ($design_options->teaser_font_sizes as $teaser_area => $size) {
             $design_options->teasers['font_sizes'][$teaser_area] = $size;
         }
     }
     if (isset($design_options->teaser_link_text)) {
         $design_options->teasers['link_text'] = $design_options->teaser_link_text ? $design_options->teaser_link_text : false;
     }
     if (isset($feature_box)) {
         $design_options->feature_box['position'] = $feature_box;
         if (isset($design_options->feature_box_condition)) {
             $design_options->feature_box['status'] = $design_options->feature_box_condition;
         }
         if (isset($design_options->feature_box_after_post)) {
             $design_options->feature_box['after_post'] = $design_options->feature_box_after_post;
         }
     }
     // Multimedia box
     if (isset($multimedia_box) && is_array($multimedia_box)) {
         foreach ($multimedia_box as $item => $value) {
             $design_options->multimedia_box[$item] = $value;
         }
     } elseif (isset($multimedia_box)) {
         $design_options->multimedia_box['status'] = $multimedia_box;
         unset($thesis_options->multimedia_box);
         if ($thesis_options->image_alt_tags) {
             foreach ($thesis_options->image_alt_tags as $image_name => $alt_text) {
                 if ($alt_text != '') {
                     $design_options->multimedia_box['alt_tags'][$image_name] = $alt_text;
                 }
             }
             unset($thesis_options->image_alt_tags);
         }
         if ($thesis_options->image_link_urls) {
             foreach ($thesis_options->image_link_urls as $image_name => $link_url) {
                 if ($link_url != '') {
                     $design_options->multimedia_box['link_urls'][$image_name] = $link_url;
                 }
             }
             unset($thesis_options->image_link_urls);
         }
         if ($thesis_options->video_code) {
             $design_options->multimedia_box['video'] = $thesis_options->video_code;
             unset($thesis_options->video_code);
         }
         if ($thesis_options->custom_code) {
             $design_options->multimedia_box['code'] = $thesis_options->custom_code;
             unset($thesis_options->custom_code);
         }
     }
     // 1.6 Multimedia box style upgrades
     if (!isset($multimedia_box['color'])) {
         $design_options->multimedia_box['color'] = $default_design_options->multimedia_box['color'];
     }
     if (!isset($multimedia_box['background'])) {
         $design_options->multimedia_box['background']['image'] = $default_design_options->multimedia_box['background']['image'];
         $design_options->multimedia_box['background']['video'] = $default_design_options->multimedia_box['background']['video'];
         $design_options->multimedia_box['background']['code'] = $default_design_options->multimedia_box['background']['code'];
     }
     // Post images and thumbnails
     if (isset($design_options->post_image_horizontal)) {
         $thesis_options->image['post']['x'] = $design_options->post_image_horizontal;
     }
     if (isset($design_options->post_image_vertical)) {
         $thesis_options->image['post']['y'] = $design_options->post_image_vertical;
     }
     if (isset($design_options->post_image_frame)) {
         $thesis_options->image['post']['frame'] = $design_options->post_image_frame;
     }
     if (isset($design_options->post_image_single)) {
         $thesis_options->image['post']['single'] = $design_options->post_image_single;
     }
     if (isset($design_options->post_image_archives)) {
         $thesis_options->image['post']['archives'] = $design_options->post_image_archives;
     }
     if (isset($design_options->thumb_horizontal)) {
         $thesis_options->image['thumb']['x'] = $design_options->thumb_horizontal;
     }
     if (isset($design_options->thumb_vertical)) {
         $thesis_options->image['thumb']['y'] = $design_options->thumb_vertical;
     }
     if (isset($design_options->thumb_frame)) {
         $thesis_options->image['thumb']['frame'] = $design_options->thumb_frame;
     }
     if (isset($design_options->thumb_size)) {
         $thesis_options->image['thumb']['width'] = $design_options->thumb_size['width'];
         $thesis_options->image['thumb']['height'] = $design_options->thumb_size['height'];
     }
     // Preserve old font variables
     if ($design_options->font_body) {
         $design_options->fonts['families']['body'] = $design_options->font_body;
     }
     if ($design_options->font_content_subheads_family) {
         $design_options->fonts['families']['subheads'] = $design_options->font_content_subheads_family;
     }
     if ($design_options->font_nav_family) {
         $design_options->fonts['families']['nav_menu'] = $design_options->font_nav_family;
     }
     if ($design_options->font_header_family) {
         $design_options->fonts['families']['header'] = $design_options->font_header_family;
     }
     if ($design_options->font_header_tagline_family) {
         $design_options->fonts['families']['tagline'] = $design_options->font_header_tagline_family;
     }
     if ($design_options->font_headlines_family) {
         $design_options->fonts['families']['headlines'] = $design_options->font_headlines_family;
     }
     if ($design_options->font_bylines_family) {
         $design_options->fonts['families']['bylines'] = $design_options->font_bylines_family;
     }
     if ($design_options->font_multimedia_family) {
         $design_options->fonts['families']['multimedia_box'] = $design_options->font_multimedia_family;
     }
     if ($design_options->font_sidebars_family) {
         $design_options->fonts['families']['sidebars'] = $design_options->font_sidebars_family;
     }
     if ($design_options->font_sidebars_headings_family) {
         $design_options->fonts['families']['sidebar_headings'] = $design_options->font_sidebars_headings_family;
     }
     if ($design_options->font_footer_family) {
         $design_options->fonts['families']['footer'] = $design_options->font_footer_family;
     }
     // Preserve old font size variables
     if ($design_options->font_content_size) {
         $design_options->fonts['sizes']['content'] = $design_options->font_content_size;
     }
     if ($design_options->font_nav_size) {
         $design_options->fonts['sizes']['nav_menu'] = $design_options->font_nav_size;
     }
     if ($design_options->font_header_size) {
         $design_options->fonts['sizes']['header'] = $design_options->font_header_size;
     }
     if ($design_options->font_headlines_size) {
         $design_options->fonts['sizes']['headlines'] = $design_options->font_headlines_size;
     }
     if ($design_options->font_bylines_size) {
         $design_options->fonts['sizes']['bylines'] = $design_options->font_bylines_size;
     }
     if ($design_options->font_multimedia_size) {
         $design_options->fonts['sizes']['multimedia_box'] = $design_options->font_multimedia_size;
     }
     if ($design_options->font_sidebars_size) {
         $design_options->fonts['sizes']['sidebars'] = $design_options->font_sidebars_size;
     }
     if ($design_options->font_footer_size) {
         $design_options->fonts['sizes']['footer'] = $design_options->font_footer_size;
     }
     // Preserve old width settings
     if ($design_options->num_columns == 3 && $design_options->width_content_3) {
         $design_options->layout['widths']['content'] = $design_options->width_content_3;
     } elseif ($design_options->num_columns == 2 && $design_options->width_content_2) {
         $design_options->layout['widths']['content'] = $design_options->width_content_2;
         $design_options->layout['widths']['sidebar_1'] = $design_options->width_sidebar;
     } elseif ($design_options->num_columns == 3 && $design_options->width_content_1) {
         $design_options->layout['widths']['content'] = $design_options->width_content_1;
     }
     // Clean up the $design_options->fonts array from 1.5b r3 to 1.5
     foreach ($design_options->fonts as $type => $value) {
         if ($type == 'families' || $type == 'sizes') {
             $new_fonts_array[$type] = $value;
         }
     }
     $design_options->fonts = $new_fonts_array;
     foreach ($design_options as $option_name => $value) {
         if (!isset($default_design_options->{$option_name})) {
             unset($design_options->{$option_name});
         }
         // Has this option been nuked? If so, kill it!
     }
     update_option('thesis_design_options', $design_options);
     // Save upgraded options
     update_option('thesis_options', $thesis_options);
     thesis_generate_css();
 }