Fatal error: Cannot redeclare class Options in /home/xantasia/public_html/Welcom


#1

Greetings, first and foremost, please forgive me if I didn’t post everything below the proper way. I am major illiterate when it comes to php so that’s why I came here. I designed a Wordpress Blog using the “Station” theme and it took about a week to design the site. I was going to add another plugin, it affected something and since then I can no longer access my site. When I type in the url www.ILoveJehovah.com I get the following:

Fatal error: Cannot redeclare class Options in /home/xantasia/public_html/WelcomeTo/wp-content/themes/station/core/admin/options.class.php on line 4

I copied the options.class.php using FTP from my Hostgator account and included it below. I would be so grateful if someone here that is more fluent in this area to perhaps help me save my site. I’ve done so much to it and would hate to lose it after all that was done.

Please, Please, Please help. I will be more than happy to get any information about the site to you if you need it, no problem.

Thanks a million in advance for any help.

Here’s the info from that page. Hope this helps. If not, let me know what I need to do and I will do it. Again, this site is really important to me.
Thanks :slight_smile:

[php]<?php

class Options {

// BUILD THE PAGELINES OBJECT
	function __construct() {
		$this->update_or_install();
		$this->get_options();			
	}


//INITIAL INSTALL OR UPDATING
function update_or_install(){
	
		//if options aren't set
		if(!get_option('pagelines_options') && !get_option('pagelines_options_redundant')){ 
		
			//if old options are set
			if(get_option('pagepress_options')){
			
				//set new options to old
				update_option('pagelines_options',get_option('pagepress_options'));
			
			}else{
			
				// first time using this theme in this install so set defaults
				$this->default_features();	
				$this->default_options();
				$this->save_options();
			}
		}
	}

// DEFAULT SETTINGS

	function default_options(){
			// admin	
			$this->credlink = "http://www.pagelines.com";
			$this->set_defaults_from_array(get_option_array());	
	}
	
	function default_features(){
	
		$this->features = get_default_features();
		$this->fboxes = get_default_fboxes();
		$this->set_defaults_from_array(get_feature_array());

	}
	

// GET OPTION FUNCTIONS 
	function get_options() {
	
		if(!get_option('pagelines_options')){ 
			$saved_options = maybe_unserialize(get_option('pagelines_options_redundant'));
			update_option('pagelines_options',get_option('pagelines_options_redundant'));
		}else{ $saved_options = maybe_unserialize(get_option('pagelines_options'));	}
	
		if (!empty($saved_options) && is_object($saved_options)) {
			foreach ($saved_options as $option_name => $value)
				$this->$option_name = stripslashes_deep($value);
		}
		
	}

// UPDATE OPTION FUNCTIONS
	function update_option($name, $data = false){
			$option_value =  isset($_POST[$name]) ? $_POST[$name] : null;

			if($data) $this->$name = $data;
			else $this->$name = $option_value;
	}

// SAVE OPTION FUNCTIONS
	function save_options() {
		if(!isset($_GET['activated'])) checkauthority();
		update_option('pagelines_options', $this);
		
		//Redundancy Backup (Hopefully will solve suspected DB problems w some users)
		if(get_option('pagelines_options')){
			update_option('pagelines_options_redundant', $this);
		}
	}
	
	function save_features($postdata){
		
		$this->update_options_from_array(get_feature_array());
		
		if($postdata){
			$this->update_option('features', $postdata['feature']);
			$this->update_option('fboxes', $postdata['fbox']);
		}
		$this->save_options();
		
	}

// RESTORE FUNCTIONS 
	
	function restore_options(){
		//if they get messed up
	
		$this->default_options();
		$this->save_options();	
	}

	
	function restore_features(){
	
		$this->default_features();
		$this->save_options();
	}
	
// RESTORE FROM DATABASE FUNCTIONS	
	function restore_from_backup(){
	
		$this->restore_from_backup_with_array(get_option_array());
		$this->save_options();
	}
	
	function restore_features_from_backup(){
		$this->restore_from_backup_with_array(get_feature_array());
		$this->features = get_option('features');
		$this->fboxes = get_option('fboxes');
		$this->save_options();
	}

// DATABASE BACKUP
	function backup_features(){
		
		$this->save_features($postdata);
		
		$this->backup_from_array(get_feature_array(),$postdata);

		update_option('features', $_POST['feature']);
		update_option('fboxes', $_POST['fbox']);
	}

	function backup_options($postdata){
		$this->backup_from_array(get_option_array(), $postdata);
	}
	
// ARRAY HELPER FUNCTIONS 

	function update_options_from_array($the_array = array()){
		foreach($the_array as $menuitem => $options ){
			foreach($options as $optionid => $o ){
				if($o['type']=='check_multi'){
					foreach($o['selectvalues'] as $multi_optionid => $multi_o){
						$this->update_option($multi_optionid);
					}
				}elseif(isset($o['wp_option']) && $o['type'] != 'image_upload'){
					// saves as a regular WP option
					if(isset($_POST[$optionid])) update_option($optionid, $_POST[$optionid]);
				}elseif($o['type'] == 'layout'){
				
					update_option('pagelines_layout_map', $_POST['layout']);
					
					//	print_r(get_option('pagelines_layout_map'));
				}
				else{
					$this->update_option($optionid);
				}
			}
		}		
	}

	function set_defaults_from_array($the_array = array()){
		foreach($the_array as $menuitem => $options ){
			foreach($options as $optionid => $o ){
				if($o['type']=='check_multi'){
					foreach($o['selectvalues'] as $multi_optionid => $multi_o){
						if(isset($multi_o['default'])) $this->$multi_optionid = $multi_o['default'];
					}
				}elseif(isset($o['wp_option'])){
					update_option( $optionid, $o['default']);
				}else{
					if(!VPRO && isset($o['version_set_default']) && $o['version_set_default'] == 'pro') $this->$optionid = null;
					elseif(isset($o['default'])) $this->$optionid = $o['default'];
				}
			}
		}
	}

	function backup_from_array($the_array = array(), $postdata){
		foreach($the_array as $menuitem => $options ){
			foreach($options as $optionid => $o ){
				if($o['type']=='check_multi'){
					foreach($o['selectvalues'] as $multi_optionid => $multi_o){
						if(isset($postdata[$multi_optionid])) update_option($multi_optionid, $postdata[$multi_optionid]);
					}
				}elseif(isset($postdata[$optionid])){update_option($optionid, $postdata[$optionid]);}
			}
		}
	}

	function restore_from_backup_with_array($the_array = array()){
		foreach($the_array as $menuitem => $options ){
			foreach($options as $optionid => $optionfields ){
				if($o['type']=='check_multi'){
					foreach($o['selectvalues'] as $multi_optionid => $multi_o){
						$this->$multi_optionid = get_option($multi_optionid);
					}
				}else{
					$this->$optionid = get_option($optionid);
				}
			}
		}
	}

}

//********* END OF OPTIONS CLASS *********//

// PageLines function returns attributes from option class

function pagelines($option, $post_id = ‘’){

if($post_id && get_post_meta($post_id, $option, true) && !is_home()){
	//if option is set for a page/post
	return get_post_meta($post_id, $option, true);
}else{
	//if not set on page/post return global option.
	global $pagelines; 
	if (is_object($pagelines) && isset($pagelines->$option)){
		return $pagelines->$option;
	} else return false;
}

}

function pagelines_pro($option, $post_id = ‘’){

if(VPRO) return pagelines($option, $post_id);
else return false;

}

function e_pagelines($option, $alt = ‘’, $post_id = ‘’){

global $pagelines; 

if($post_id && get_post_meta($post_id, $option, true) && !is_home()){
	//if option is set for a page/post
	echo get_post_meta($post_id, $option, true);
}elseif(isset($pagelines->$option)&&!empty($pagelines->$option)){
	echo $pagelines->$option;
}else{
	echo $alt;
}	

}

function m_pagelines($option, $post){
$meta = get_post_meta($post, $option, true);
if(isset($meta) && !is_home()){
return $meta;
}else{
return false;
}
}

function em_pagelines($option, $post, $alt = ‘’){
$post_meta = m_pagelines($option, $post);

if(isset($post_meta)){
	echo $post_meta;
}else{
	echo $alt;
}

}

?>[/php]


#2
hello xantasia, Generally this error occurs when class file used by is included in you code twice. Please check your code. ~~SR~~

#3

Thank you for the response Sarthak. I know this sounds dumb, because I am a dummy ??? when it comes to code and stuff. To be quite honest, I wouldn’t even know where to look or what to look for. I set up my site using word press, but not anything through code. Just dashboard. Thanks again for the tip. I just don’t know what I’m doing. :wink: or where to start.

Thanks
X