'#021728', 'theme_opt_googleAnalyticID_used' => '0', 'theme_opt_googleAnalyticID' => 'UA-XXXXXXX-Y', 'theme_opt_adRotate_group1' => '0', 'theme_opt_adRotate_group2' => '0', 'theme_opt_automaticHideLeft' => '1', 'theme_opt_delayBeforeHideLeft' => '10', 'theme_opt_keepDesignerPromoCode' => '0', 'theme_opt_image_background_show' => '1', 'theme_opt_image_background' => 'back_white_shadow_right.png', 'theme_opt_image_logoBackground_show' => '1', 'theme_opt_image_logoBackground' => 'yingYang_DavidColl_originalArt.png', 'theme_opt_image_favicon' => 'funky.ico' ); var $options_list = array(); function theme_class(){ $this->__loadThemeDetails(); load_theme_textdomain($this->domain, $this->theme_path . '/languages'); $this->theme_fn_setOptions(); add_action('wp_head', array($this, 'theme_fn_wp_head')); add_action('admin_menu',array($this, 'theme_fn_add_admin')); if (isset($_REQUEST['preview']) && current_user_can('edit_themes')) { add_action('wp_head', array($this, 'theme_fn_preview_head')); } $this->setWidgetSidebarsStyle(); } function __loadThemeDetails(){ $this->theme_url = get_theme_root_uri() . '/' . basename(dirname(__FILE__)); $this->theme_path = get_theme_root() . '/' . basename(dirname(__FILE__)); $this->domain = basename(dirname(__FILE__)); $theme_data = get_theme_data( $this->theme_path."/style.css"); $this->t_name = $theme_data['Name']; $this->t_version = $theme_data['Version']; $this->t_info_url = $theme_data['URI']; } /*---- Retrieves saved options and overwrite the defaults ----*/ function theme_fn_setOptions(){ foreach($this->options as $k => $v){ $var = esc_attr(get_option($k)); if ( $var != $v && $var != '') { $this->options[$k] = $var; } $this->options_list[] = $k; } } /*---- Set widgetized sidebars style----*/ function setWidgetSidebarsStyle(){ register_sidebar(array( 'name' => __('Left top section (fixed)', $this->domain), 'id' => 'theme_sidebar_left_top', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

' )); register_sidebar(array( 'name' => __('Left bottom section (fixed)', $this->domain), 'id' => 'theme_sidebar_left_bottom', 'before_widget' => '', 'before_title' => '

', 'after_title' => '

' )); register_sidebar(array( 'name' => __('Right section (normal)', $this->domain), 'id' => 'theme_sidebar_right_bottom', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' )); } /*==== Output for colorized theme description ====*/ function theme_fn_wp_head() { global $post; $includeBackgroundImage = $includeLogoBackgroundImage = null; unset($match); if (is_single() && get_post_meta($post->ID, 'back_color_used', true) == 'yes'){ if (preg_match('@#\w{6}@', get_post_meta($post->ID, 'back_color', true), $match)){ $backgroundColor = $match[0]; } }else{ $backgroundColor = $this->options['theme_opt_backgroundColor']; } if ($this->options['theme_opt_image_background_show'] == '1'){ $includeBackgroundImage = 'html, #container {background-image: url("'. $this->theme_url . '/img/backgrounds/' . $this->options['theme_opt_image_background'] .'"); }'; } if ($this->options['theme_opt_image_logoBackground_show'] == '1'){ $includeLogoBackgroundImage = '#content { background-image: url("'. $this->theme_url . '/img/backgrounds/' . $this->options['theme_opt_image_logoBackground'] .'"); }'; } echo ' '; if($this->options['theme_opt_googleAnalyticID_used'] == 1) { echo ' '; } if($this->options['theme_opt_automaticHideLeft'] == 1) { echo ' '; } echo "\n"; } /*==== Instantiate admin menu ====*/ function theme_fn_add_admin() { if ( isset($_GET['page']) && $_GET['page'] == basename(__FILE__) ) { if ( isset($_REQUEST['action']) && 'save' == $_REQUEST['action'] ) { check_admin_referer('theme_fn_save_options'); foreach($this->options as $k => $v){ update_option($k, strip_tags(stripslashes($_REQUEST[$k]))); } header("Location: themes.php?page=functions.php&saved=true"); die; } elseif ( isset($_REQUEST['action']) && 'reset' == $_REQUEST['action'] ) { check_admin_referer('theme_fn_reset_options'); foreach($this->options as $k => $v){ delete_option($k); } header("Location: themes.php?page=functions.php&reset=true"); die; } } add_meta_box($this->domain, __('Specify your theme background color for this post', $this->domain ), array($this, 'theme_fn_edit_box'),'post'); add_meta_box($this->domain, __('Specify your theme background color for this post', $this->domain ), array($this, 'theme_fn_edit_box'),'page'); add_action('save_post', array($this, 'theme_fn_save_box_data')); add_theme_page( sprintf(__( '%s Theme Options', $this->domain ), $this->t_name), __( 'Set theme options', $this->domain ), 'edit_themes', basename(__FILE__), array($this, 'theme_fn_admin') ); add_thickbox(); wp_enqueue_script( 'theme-preview' ); wp_enqueue_script( 'prototype' ); wp_enqueue_script( 'scriptaculous.js?load=effects,dragdrop,slider' ); } /*==== Render admin page ====*/ function theme_fn_admin() { if ( isset($_REQUEST['saved']) ) { ?>

', $this->domain), $this->t_name, ''); ?>

domain), $this->t_name); ?>

domain ), $this->t_name, $this->t_version); ?>

GNU GENERAL PUBLIC LICENSE - GPLv3 domain), ''.$this->t_name.'' );?>
domain), 'David Coll', '', '' );?> theme_fn_donate()?> domain), '');?>


domain), '', '');?>

Save Options to save any changes. You can also discard your changes and reload the default settings by clicking on Reset.', $this->domain) ?>

domain); ?>


domain); ?>

domain); ?>

domain); ?>
options['theme_opt_image_background_show'] == '1'){ echo 'checked="true"';}?> id="theme_opt_image_background_show" value="1" name="theme_opt_image_background_show"/>

domain); ?>

options['theme_opt_image_logoBackground_show'] == '1'){ echo 'checked="true"';}?> id="theme_opt_image_logoBackground_show" value="1" name="theme_opt_image_logoBackground_show"/>

domain); ?>

domain); ?>

domain); ?>
options['theme_opt_automaticHideLeft'] == '1'){ echo 'checked="true"';}?> id="theme_opt_automaticHideLeft" value="1" name="theme_opt_automaticHideLeft"/>

domain); ?>

domain); ?>

domain); ?>

options['theme_opt_keepDesignerPromoCode'] == '1'){ echo 'checked="true"';}?> id="theme_opt_keepDesignerPromoCode" value="1" name="theme_opt_keepDesignerPromoCode"/>

domain); ?>

domain); ?>

Disabled for Wordpress compliance, enter your tracker manually via widgets.

options['theme_opt_googleAnalyticID_used'] == '1'){ echo 'checked="true"';}?> id="theme_opt_googleAnalyticID_used" value="1" name="theme_opt_googleAnalyticID_used"/>

domain); ?>


domain); ?>

UA-XXXXX-YY.', $this->domain); ?>

domain); ?>

domain); ?> domain); ?>


domain); ?>

domain); ?>

Save Options. A reset does not affect the actual theme files in any way.', $this->domain); ?>

' . "\n\t"; echo $form; } function theme_fn_select_color(){ if (isset($_COOKIE['WP_theme_color_preference'])){ echo $_COOKIE['WP_theme_color_preference']; } else { echo $this->options['theme_opt_backgroundColor']; } } function theme_fn_preview_head() { echo ' '; return; } /*==== Render color box in edit pages ====*/ function theme_fn_edit_box($post){ $background_color_use = get_post_meta($post->ID, 'back_color_used', true); $background_color = get_post_meta($post->ID, 'back_color', true); ?> id="back_color_used" value="yes" name="back_color_used"/>


I want no ads there'; $groups = $wpdb->get_results("SELECT * FROM `".$wpdb->prefix."adrotate_groups` WHERE `id` > 0"); foreach ($groups as $group){ unset($sel); if ($selected == $group->id) { $sel = 'selected="selected"'; } $ret .= ""; } return $ret; } function theme_fn_get_background_image($selected, $dir = 'backgrounds'){ $ret = ''; $directory = $this->theme_path.'/img/'.$dir; if ($handle = opendir($directory)) { /* This is the correct way to loop over the directory. */ while (false !== ($file = readdir($handle))) { if(is_file($directory.'/'.$file)){ unset($sel); if ($selected == $file) { $sel = 'selected="selected"'; } $ret .= ""; } } closedir($handle); } return $ret; } /*==== Used in postTemplate.php - Get images attached to the post ====*/ function theme_fn_get_post_first_image(){ global $post; $args = array( 'post_type' => 'attachment', 'post_mime_type' => 'image', 'numberposts' => -1, 'order' => 'ASC', 'post_status' => null, 'post_parent' => $post->ID ); $attachments = get_posts($args); if ($attachments) { foreach ($attachments as $attachment) { $this->first_post_img = wp_get_attachment_thumb_url( $attachment->ID ); return true; break; } } return false; } /*==== Used in postTemplate.php - Replacement function from the core ====*/ function theme_fn_get_author_posts_link() { global $authordata; return sprintf( '%3$s', get_author_posts_url( $authordata->ID, $authordata->user_nicename ), sprintf( esc_attr__( 'Posts by %s', $this->domain ), esc_attr( get_the_author() ) ), get_the_author() ); } } /* Stupid function to call data inside the class without reconstructuring it */ function theme_ext_check_option($id){ global $theme_class; return $theme_class->options[$id]; } function theme_ext_domain(){ global $theme_class; return $theme_class->domain; } ?>