public function options_page()
    {
        global $wacpath;
        $cache_folder = plugin_dir_path($wacpath) . WoW_Armory_Character_View::CACHE_FOLDER_NAME;
        if (!@is_writable($cache_folder)) {
            echo '<div id="message" class="error"><p>' . sprintf(__('<strong>Warning:</strong> ' . 'The cache folder (<code>%s</code>) is not writable. Please ensure your ' . 'webserver has the correct permissions to write files to this folder.', 'wow_armory_character'), $cache_folder) . '</p></div>';
        }
        if (isset($_POST['deleteit']) && isset($_POST['delete'])) {
            // Verify nonce
            check_admin_referer('wowarmchar');
            $clear_count = 0;
            foreach ((array) $_POST['delete'] as $clear_name) {
                delete_transient(str_replace('_transient_', '', $clear_name));
                $clear_count++;
            }
            echo '<div id="message" class="updated fade"><p>' . sprintf(__('Cleared %s caches.', 'wow_armory_character'), $clear_count) . '</p></div>';
        }
        if (isset($_POST['deleteall'])) {
            // Verify nonce
            check_admin_referer('wowarmchar');
            WoW_Armory_Character_DAL::clear_all_cache();
            echo '<div id="message" class="updated fade"><p>' . __('Cleared all cached items.', 'wow_armory_character') . '</p></div>';
        }
        $options = get_option('wac_settings');
        ?>
		<div class="wrap">
			<h2><?php 
        _e('World of Warcraft Armory Character', 'wow_armory_character');
        ?>
</h2>

			<form method="post" action="<?php 
        echo admin_url('options.php');
        ?>
">
				<?php 
        settings_fields('wac_settings');
        ?>

				<table class="form-table">
					<tr>
						<th>Global settings</th>
						<td>
							<input id="attach_css" name="wac_settings[attach_css]" type="checkbox"
							       value="1" <?php 
        checked(1, $options['attach_css']);
        ?>
 />
							<label for="attach_css" title="<?php 
        _e('DEPRECATED. Please see documentation on filters. Add a basic CSS file that styles the widget and shortcode outputs. Unchecking this will remove all styling from the plugins display. Please ensure you have styled the plugin in your own CSS.', 'wow_armory_character');
        ?>
">
								<?php 
        _e('Add plugin css to the page. (Deprecated. See readme)', 'wow_armory_character');
        ?>
							</label>
							<br/>
							<input id="use_tooltips" name="wac_settings[use_tooltips]" type="checkbox"
							       value="1" <?php 
        checked(1, $options['use_tooltips']);
        ?>
 />
							<label for="use_tooltips" title="<?php 
        _e('Display informational tooltips when hovering over equipped items and completed achievements.', 'wow_armory_character');
        ?>
">
								<?php 
        _e('Show equipped item tooltips.', 'wow_armory_character');
        ?>
							</label>
							<br/>
							<input id="wowhead_links" name="wac_settings[wowhead_links]" type="checkbox"
							       value="1" <?php 
        checked(1, $options['wowhead_links']);
        ?>
 />
							<label for="wowhead_links" title="<?php 
        _e('Instead of linking items and acheivements to battle.net link to the wowhead 3rd party site.', 'wow_armory_character');
        ?>
">
								<?php 
        _e('Link items and acheivements to wowhead.', 'wow_armory_character');
        ?>
							</label>
						</td>
					</tr>
				</table>

				<p class="submit">
					<input type="submit" class="button-primary" value="<?php 
        _e('Save Changes');
        ?>
"/>
				</p>
			</form>

			<h3 class="title"><?php 
        _e('Character Cache', 'wow_armory_character');
        ?>
</h3>

			<form id="cache-list" action="options-general.php?page=wowarmchar" method="post">
				<?php 
        // Add a nonce
        wp_nonce_field('wowarmchar');
        ?>

				<table class="widefat">
					<thead>
					<tr>
						<th scope="col" class="check-column"><input type="checkbox"
						                                            onclick="checkAll(document.getElementById('cache-list'));"/>
						</th>
						<th scope="col"><?php 
        _e('Character Name', 'wow_armory_character');
        ?>
</th>
						<th scope="col"><?php 
        _e('Realm', 'wow_armory_character');
        ?>
</th>
						<th scope="col"><?php 
        _e('Cached On', 'wow_armory_character');
        ?>
</th>
						<th scope="col"><?php 
        _e('Note/s', 'wow_armory_character');
        ?>
</th>
					</tr>
					</thead>
					<tbody>

					<?php 
        $chars = WoW_Armory_Character_DAL::fetch_all_cached_characters();
        if (count($chars) == 0) {
            ?>
						<tr>
							<td scope="row" colspan="5" style="text-align: center;"><strong><?php 
            _e('No cached characters found', 'wow_armory_character');
            ?>
</strong></td>
						</tr>
					<?php 
        } else {
            foreach ($chars as $character) {
                if ($character instanceof WoW_Armory_Character) {
                    $char_view = new WoW_Armory_Character_View($character);
                    ?>
								<tr>
									<th scope="row" class="check-column"><input type="checkbox" name="delete[]"
									                                            value="<?php 
                    echo $character->cache_name;
                    ?>
"/>
									</th>
									<td scope="row" style="text-align: left">
										<img class="icon-race-18" src="<?php 
                    echo $char_view->get_race_icon_url();
                    ?>
"/>
										<span class="<?php 
                    echo $char_view->get_class_icon_class();
                    ?>
"></span>
										<?php 
                    echo $character->name;
                    ?>
									</td>
									<td scope="row" style="text-align: left"><?php 
                    echo $character->realm;
                    ?>
</td>
									<td scope="row" style="text-align: left"><?php 
                    echo date(__('F j, Y, g:i a', 'wow_armory_character'), $character->last_checked);
                    ?>
</td>
									<td scope="row" style="text-align: left" class="notes">
										<?php 
                    if (count($character->notes) > 0) {
                        ?>
											<img class="warning-icon"
											     src="<?php 
                        echo plugins_url('images/warning.png', $wacpath);
                        ?>
"
											     alt="<?php 
                        _e('Warning Icon', 'wow_armory_character');
                        ?>
"/>
											<p>
												<?php 
                        foreach ($character->notes as $note) {
                            ?>
													<?php 
                            echo $note;
                            ?>
<br/>
												<?php 
                        }
                        ?>
											</p>
										<?php 
                    }
                    ?>
									</td>
								</tr>
							<?php 
                } else {
                    ?>
								<tr>
									<th scope="row" class="check-column"><input type="checkbox" name="delete[]"
									                                            value="<?php 
                    echo $character->cache_name;
                    ?>
"/>
									</th>
									<td scope="row" style="text-align: left"></td>
									<td scope="row" style="text-align: left"></td>
									<td scope="row" style="text-align: left"><?php 
                    echo date(__('F j, Y, g:i a', 'wow_armory_character'), $character->last_checked);
                    ?>
</td>
									<td scope="row" style="text-align: left" class="notes">
										<?php 
                    if (count($character->notes) > 0) {
                        ?>
											<img class="warning-icon"
											     src="<?php 
                        echo plugins_url('images/warning.png', $wacpath);
                        ?>
"
											     alt="<?php 
                        _e('Warning Icon', 'wow_armory_character');
                        ?>
"/>
											<p>
												<?php 
                        foreach ($character->notes as $note) {
                            ?>
													<?php 
                            echo $note;
                            ?>
<br/>
												<?php 
                        }
                        ?>
											</p>
										<?php 
                    }
                    ?>
									</td>
								</tr>
							<?php 
                }
            }
        }
        ?>

					</tbody>
				</table>
				<div class="tablenav">
					<input type="submit" value="<?php 
        _e('Clear selected cache items', 'wow_armory_character');
        ?>
"
					       name="deleteit" class="button-primary delete"/>
					<input type="submit" value="<?php 
        _e('Clear all cache items', 'wow_armory_character');
        ?>
"
					       name="deleteall" class="button-secondary delete"/>
					<br class="clear"/>
				</div>

				<br class="clear"/>
			</form>
		</div>
	<?php 
    }