Skip to content
Browse files

Added setting for where the admin menu appears.

  • Loading branch information...
1 parent 4342196 commit 38aa30d4a65f0f80a67b96a4a94d4cc1e07fea85 @mvied committed
View
19 admin/templates/metabox/settings.php
@@ -5,7 +5,7 @@
$ssl_host = str_replace($this->getPlugin()->getHttpUrl()->getPath(), '', $ssl_host, $count);
$ssl_host = rtrim($ssl_host, '/');
?>
-<form name="form" id="<?php echo $this->getPlugin()->getSlug(); ?>" action="admin.php?page=wordpress-https" method="post">
+<form name="form" id="<?php echo $this->getPlugin()->getSlug(); ?>" action="<?php echo $_SERVER['REQUEST_URI']; ?>" method="post">
<?php settings_fields($this->getPlugin()->getSlug()); ?>
<table class="form-table">
@@ -61,9 +61,9 @@
<td>
<fieldset>
<label for="ssl_proxy" class="label-radio">
- <input type="radio" name="ssl_proxy" value="0"<?php echo ((! $this->getPlugin()->getSetting('ssl_proxy')) ? ' checked="checked"' : ''); ?>> No
- <input type="radio" name="ssl_proxy" value="auto"<?php echo (($this->getPlugin()->getSetting('ssl_proxy') === 'auto') ? ' checked="checked"' : ''); ?>> Auto
- <input type="radio" name="ssl_proxy" value="1"<?php echo (($this->getPlugin()->getSetting('ssl_proxy') == 1) ? ' checked="checked"' : ''); ?>> Yes
+ <input type="radio" name="ssl_proxy" value="0"<?php echo ((! $this->getPlugin()->getSetting('ssl_proxy')) ? ' checked="checked"' : ''); ?>> <span>No</span>
+ <input type="radio" name="ssl_proxy" value="auto"<?php echo (($this->getPlugin()->getSetting('ssl_proxy') === 'auto') ? ' checked="checked"' : ''); ?>> <span>Auto</span>
+ <input type="radio" name="ssl_proxy" value="1"<?php echo (($this->getPlugin()->getSetting('ssl_proxy') == 1) ? ' checked="checked"' : ''); ?>> <span>Yes</span>
</label>
</fieldset>
</td>
@@ -80,6 +80,17 @@
</fieldset>
</td>
</tr>
+ <tr valign="top" id="admin_menu_row">
+ <th scope="row">Admin Menu</th>
+ <td>
+ <fieldset>
+ <label for="admin_menu" class="label-radio">
+ <input type="radio" name="admin_menu" value="side"<?php echo (($this->getPlugin()->getSetting('admin_menu') === 'side') ? ' checked="checked"' : ''); ?>> <span>Admin Sidebar</span>
+ <input type="radio" name="admin_menu" value="settings"<?php echo (($this->getPlugin()->getSetting('admin_menu') === 'settings') ? ' checked="checked"' : ''); ?>> <span>General Settings</span>
+ </label>
+ </fieldset>
+ </td>
+ </tr>
</table>
<input type="hidden" name="action" value="save" />
View
1 lib/WordPressHTTPS.php
@@ -42,6 +42,7 @@ class WordPressHTTPS extends WordPressHTTPS_Plugin {
'ssl_admin' => 0, // Force SSL Over Administration Panel (The same as FORCE_SSL_ADMIN)
'ssl_proxy' => 0, // Proxy detection
'debug' => 0, // Debug Mode
+ 'admin_menu' => 'side', // HTTPS Admin Menu location
);
/**
View
8 lib/WordPressHTTPS/Module/Admin.php
@@ -53,9 +53,11 @@ public function admin_enqueue_scripts() {
* @return void
*/
public function menu() {
- add_menu_page('HTTPS', 'HTTPS', 'manage_options', $this->getPlugin()->getSlug(), array($this->getPlugin()->getModule('Admin\Settings'), 'dispatch'), '', 88);
- //remove_submenu_page( $this->getPlugin()->getSlug(), $this->getPlugin()->getSlug() );
- //add_submenu_page($this->getPlugin()->getSlug() . '-menu', 'Updates', 'Updates', 'manage_options', $this->getPlugin()->getSlug() . '-updates', array(&$this, 'dispatch'));
+ if ( $this->getPlugin()->getSetting('admin_menu') === 'side' ) {
+ add_menu_page('HTTPS', 'HTTPS', 'manage_options', $this->getPlugin()->getSlug(), array($this->getPlugin()->getModule('Admin\Settings'), 'dispatch'), '', 88);
+ } else {
+ add_options_page('HTTPS', 'HTTPS', 'manage_options', $this->getPlugin()->getSlug(), array($this->getPlugin()->getModule('Admin\Settings'), 'dispatch'));
+ }
}
/**
View
2 lib/WordPressHTTPS/Module/Admin/Settings.php
@@ -26,7 +26,7 @@ public function init() {
add_action('plugins_loaded', array(&$this, 'save'), 1);
}
- add_action('toplevel_page_' . $this->getPlugin()->getSlug(), array(&$this, 'add_meta_boxes'));
+ add_action('admin_init', array(&$this, 'add_meta_boxes'));
// Add scripts
add_action('admin_enqueue_scripts', array(&$this, 'enqueue_scripts'));

0 comments on commit 38aa30d

Please sign in to comment.
Something went wrong with that request. Please try again.