Buyur dostum
<?php

/** blocks options */
class BlocksOptions {
	function getOptions() {
		$options = get_option('blocks_options');
		if (!is_array($options)) {
			$options['sidebar'] = 1;
			$options['sidebar_position'] = 'right';
			$options['left_sidebar_width'] = '';
			$options['notice'] = false;
			$options['notice_content'] = '';
			$options['notice_color'] = 2;
			$options['categories'] = false;
			$options['tags'] = true;
			$options['feed'] = false;
			$options['feed_url'] = '';
			update_option('blocks_options', $options);
		}
		return $options;
	}

	function add() {
		if(isset($_POST['blocks_save'])) {
			$options = BlocksOptions::getOptions();

			// style
			$options['sidebar'] = $_POST['sidebar'];
			$options['sidebar_position'] = $_POST['sidebar_position'];
			$options['left_sidebar_width'] = $_POST['left_sidebar_width'];
			if ($options['left_sidebar_width'] != '' && $options['left_sidebar_width'] < 64) {
				$options['left_sidebar_width'] = 64;
			} else if ($options['left_sidebar_width'] != '' && $options['left_sidebar_width'] > 244) {
				$options['left_sidebar_width'] = 244;
			}

			// notice
			if ($_POST['notice']) {
				$options['notice'] = (bool)true;
			} else {
				$options['notice'] = (bool)false;
			}
			$options['notice_color'] = $_POST['notice_color'];
			$options['notice_content'] = stripslashes($_POST['notice_content']);

			// categories & tags
			if ($_POST['categories']) {
				$options['categories'] = (bool)true;
			} else {
				$options['categories'] = (bool)false;
			}
			if (!$_POST['tags']) {
				$options['tags'] = (bool)false;
			} else {
				$options['tags'] = (bool)true;
			}

			// feed
			if ($_POST['feed']) {
				$options['feed'] = (bool)true;
			} else {
				$options['feed'] = (bool)false;
			}
			$options['feed_url'] = stripslashes($_POST['feed_url']);

			update_option('blocks_options', $options);

		} else {
			BlocksOptions::getOptions();
		}

		add_theme_page("Current Theme Options", "Current Theme Options", 'edit_themes', basename(__FILE__), array('BlocksOptions', 'display'));
	}

	function display() {
		$options = BlocksOptions::getOptions();
?>

<form action="#" method="post" enctype="multipart/form-data" name="blocks_form" id="blocks_form">
	<div class="wrap">
		<h2><?php _e('Current Theme Options', 'blocks'); ?></h2>

		<table class="form-table">
			<tbody>
				<tr valign="top">
					<th scope="row"><?php _e('Sidebar', 'blocks'); ?></th>
					<td>
						<label>
							<select name="sidebar" size="1">
								<option value="1" <?php if($options['sidebar'] != 2) echo ' selected '; ?>><?php _e('Single', 'blocks'); ?></option>
								<option value="2" <?php if($options['sidebar'] == 2) echo ' selected '; ?>><?php _e('Double', 'blocks'); ?></option>
							</select>
							 <?php _e('sidebar(s).', 'blocks'); ?>
						</label>
						<br/>
						<label>
							<select name="sidebar_position" size="1">
								<option value="left" <?php if($options['sidebar_position'] == left) echo ' selected '; ?>><?php _e('Left', 'blocks'); ?></option>
								<option value="right" <?php if($options['sidebar_position'] != left) echo ' selected '; ?>><?php _e('Right', 'blocks'); ?></option>
							</select>
							 <?php _e('side of page.', 'blocks'); ?>
						</label>
						<br/>
						<input name="left_sidebar_width" type="input" class="code" size="3" value="<?php echo($options['left_sidebar_width']) ?>" />
						<?php _e('px. Width of left-sidebar, between 64 to 244, default 124.', 'blocks'); ?>
					</td>
				</tr>
			</tbody>
		</table>

		<table class="form-table">
			<tbody>
				<tr valign="top">
					<th scope="row">
						<?php _e('Notice', 'blocks'); ?>
						<br/>
						<small style="font-weight:normal;"><?php _e('HTML enabled', 'blocks'); ?></small>
					</th>
					<td>
						<div style="width:98%;">
							<div style="float:left;">
								<label>
									<input name="notice" type="checkbox" value="checkbox" <?php if($options['notice']) echo "checked='checked'"; ?> />
									 <?php _e('Show notice.', 'blocks'); ?>
								</label>
							</div>
							<div style="float:right;">
								<label>
									<?php _e('Color: ', 'blocks'); ?>
									<select name="notice_color" size="1">
										<option value="1" <?php if($options['notice_color'] == 1) echo ' selected '; ?>><?php _e('Blue', 'blocks'); ?></option>
										<option value="2" <?php if($options['notice_color'] != 1 && $options['notice_color'] != 3) echo ' selected '; ?>><?php _e('Green', 'blocks'); ?></option>
										<option value="3" <?php if($options['notice_color'] == 3) echo ' selected '; ?>><?php _e('Red', 'blocks'); ?></option>
									</select>
								</label>
							</div>
							<div style="clear:both;"></div>
						</div>
						<label>
							<textarea name="notice_content" cols="50" rows="10" id="notice_content" class="code" style="width:98%;font-size:12px;"><?php echo($options['notice_content']); ?></textarea>
						</label>
					</td>
				</tr>
			</tbody>
		</table>

		<table class="form-table">
			<tbody>
				<tr valign="top">
					<th scope="row"><?php _e('Categories & Tags', 'blocks'); ?></th>
					<td>
						<label>
							<input name="categories" type="checkbox" value="checkbox" <?php if($options['categories']) echo "checked='checked'"; ?> />
							 <?php _e('Show categories on posts.', 'blocks'); ?>
						</label>
						<br/>
						<label>
							<input name="tags" type="checkbox" value="checkbox" <?php if($options['tags']) echo "checked='checked'"; ?> />
							 <?php _e('Show tags on posts.', 'blocks'); ?>
						</label>
					</td>
				</tr>
			</tbody>
		</table>

		<table class="form-table">
			<tbody>
				<tr valign="top">
					<th scope="row"><?php _e('Feed', 'blocks'); ?></th>
					<td>
						<label>
							<input name="feed" type="checkbox" value="checkbox" <?php if($options['feed']) echo "checked='checked'"; ?> />
							 <?php _e('Using custom feed.', 'blocks'); ?>
						</label>
						<br/>
						<?php _e('Feed URL:', 'blocks'); ?>
						 <input type="text" name="feed_url" class="code" size="40" value="<?php echo($options['feed_url']); ?>">
					</td>
				</tr>
			</tbody>
		</table>

		<p class="submit">
			<input type="submit" name="blocks_save" value="<?php _e('Save Changes', 'blocks'); ?>" />
		</p>
	</div>

</form>

<?php
	}
}

// Register functions
add_action('admin_menu', array('BlocksOptions', 'add'));

/** l10n */
function theme_init(){
	load_theme_textdomain('blocks');
}
add_action ('init', 'theme_init');

/** widgets */
$options = get_option('blocks_options');

if(function_exists('register_sidebar') && $options['sidebar'] == 1) {
	register_sidebar(array(
		'name' => 'Sidebar_single',
		'before_widget' => '<li id="%1$s" class="widget %2$s">',
		'after_widget' => '</li>',
		'before_title' => '<h3>',
		'after_title' => '</h3>',
	));

} else if(function_exists('register_sidebar') && $options['sidebar'] == 2) {
	register_sidebar(array(
			'name' => 'Sidebar_left',
			'before_widget' => '<li id="%1$s" class="widget %2$s">',
			'after_widget' => '</li>',
			'before_title' => '<h3>',
			'after_title' => '</h3>',
	));
	register_sidebar(array(
			'name' => 'Sidebar_right',
			'before_widget' => '<li id="%1$s" class="widget %2$s">',
			'after_widget' => '</li>',
			'before_title' => '<h3>',
			'after_title' => '</h3>',
	));
}

?>