Support for site verification codes
This commit is contained in:
parent
96e084e353
commit
bee1f6c96c
@ -55,15 +55,15 @@ body {
|
||||
}
|
||||
|
||||
#adminmenu > li a {
|
||||
color: #1d4899;
|
||||
color: #020918;
|
||||
}
|
||||
|
||||
#adminmenu > li div.wp-menu-image:before {
|
||||
color: #1d4899;
|
||||
color: #020918;
|
||||
}
|
||||
|
||||
#adminmenu > li a:hover, #adminmenu > li.menu-top:hover, #adminmenu > li.opensub > a.menu-top, #adminmenu > li > a.menu-top:focus {
|
||||
color: #1d4899;
|
||||
color: #020918;
|
||||
}
|
||||
|
||||
#adminmenu > li.menu-top:hover, #adminmenu > li.opensub > a.menu-top, #adminmenu > li > a.menu-top:focus {
|
||||
@ -111,7 +111,6 @@ body {
|
||||
|
||||
#adminmenu > li .wp-submenu .wp-submenu-head {
|
||||
color: #1d4899;
|
||||
font-weight: bold !important;
|
||||
}
|
||||
|
||||
.wp-has-current-submenu:hover {
|
||||
@ -122,13 +121,35 @@ body {
|
||||
padding: 10px 0px 10px 10px;
|
||||
padding-top: 10px !important;
|
||||
padding-bottom: 10px !important;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
#collapse-button {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.bdp_setting_box {
|
||||
margin-right: 10px;
|
||||
background-color: #ffffff;
|
||||
padding: 15px;
|
||||
border-style: solid;
|
||||
border-width: 1px;
|
||||
border-top-width: 0 !important;
|
||||
border-color: #1d94cf;
|
||||
}
|
||||
|
||||
.bdp_setting_box:first-of-type {
|
||||
border-top-width: 1px !important;
|
||||
}
|
||||
|
||||
.bdp_setting_box label {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.bdp_setting_box label span {
|
||||
cursor: pointer;
|
||||
width: 10pt;
|
||||
color: #a0a0a0;
|
||||
}
|
||||
|
||||
@media screen and (min-width: 783px) {
|
||||
.wp-has-current-submenu li a {
|
||||
@ -216,13 +237,13 @@ ul#adminmenu a.wp-has-current-submenu::after, ul#adminmenu > li.current > a.curr
|
||||
}
|
||||
|
||||
#adminmenu div.wp-menu-name {
|
||||
font-weight: bolder;
|
||||
|
||||
}
|
||||
|
||||
#adminmenu > li .wp-submenu a, #adminmenu > li.wp-has-current-submenu .wp-submenu a, #adminmenu > li a.wp-has-current-submenu:focus + .wp-submenu a, .folded #adminmenu > li.wp-has-current-submenu .wp-submenu a, #adminmenu > li.wp-has-current-submenu.opensub .wp-submenu a {
|
||||
color: #1d4899;
|
||||
color: #020918;
|
||||
padding-left: 25px;
|
||||
font-weight: bold;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -232,7 +253,7 @@ ul#adminmenu a.wp-has-current-submenu::after, ul#adminmenu > li.current > a.curr
|
||||
}
|
||||
|
||||
#adminmenu > li .wp-submenu li.current a, #adminmenu > li a.wp-has-current-submenu:focus + .wp-submenu li.current a, #adminmenu > li.wp-has-current-submenu.opensub .wp-submenu li.current a {
|
||||
color: #1d4899;
|
||||
color: #010a1a;
|
||||
}
|
||||
|
||||
#adminmenu > li .wp-submenu li.current a:hover, #adminmenu > li .wp-submenu li.current a:focus, #adminmenu > li a.wp-has-current-submenu:focus + .wp-submenu li.current a:hover, #adminmenu > li a.wp-has-current-submenu:focus + .wp-submenu li.current a:focus, #adminmenu > li.wp-has-current-submenu.opensub .wp-submenu li.current a:hover, #adminmenu > li.wp-has-current-submenu.opensub .wp-submenu li.current a:focus {
|
||||
|
@ -2,7 +2,7 @@
|
||||
/**
|
||||
* Plugin Name: BdP Kompass
|
||||
* Description: Wordpress-Plugin zur Unterstützung von Stämmen im Bund der Pfadfinderinnen und Pfadfinder e.V. zur optimalen Verwaltung eurer Webseite
|
||||
* Version: 4.3.6
|
||||
* Version: 4.3.7
|
||||
* Tags: bdp, utility, helper
|
||||
* Requires at least: 6.0
|
||||
* Requires PHP: 8.2
|
||||
@ -12,6 +12,7 @@
|
||||
* Text Domain: bdp-kompass
|
||||
*/
|
||||
|
||||
use Bdp\Modules\KompassSettings\Controllers\SettingsPage as KomnpassSettings;
|
||||
use Bdp\Modules\LimitLoginAttempts\Controllers\OptionsPage as OptionsPageAlias;
|
||||
use Bdp\Modules\Security\Security;
|
||||
use Bdp\Modules\Seo\Seo;
|
||||
@ -35,12 +36,14 @@ function bdp_plugin_init() {
|
||||
update_option('kompass_already_installed', true);
|
||||
wp_redirect( 'site-health.php?tab=bdp_enhanced_security');
|
||||
}
|
||||
Seo::importVerificationKeys();
|
||||
|
||||
}
|
||||
|
||||
add_action('admin_menu', function () {
|
||||
bdp_kompass_load_plugin_textdomain();
|
||||
new OptionsPageAlias();
|
||||
new KomnpassSettings();
|
||||
});
|
||||
|
||||
|
||||
|
13
changelog
13
changelog
@ -1,8 +1,19 @@
|
||||
<h4>Version 4.3.6</h4>
|
||||
<h4>Version 4.3.8</h4>
|
||||
<ul>
|
||||
<li>Google- und Bing-Verifizierung nun auch im Plugin möglich</li>
|
||||
|
||||
</ul>
|
||||
|
||||
<h4>Version 4.3.7</h4>
|
||||
<ul>
|
||||
<li>Design - Optimierungen</li>
|
||||
</ul>
|
||||
|
||||
<h4>Version 4.3.6</h4>
|
||||
<ul>
|
||||
<li>Sicherheitspatch</li>
|
||||
</ul>
|
||||
|
||||
<h4>Version 4.3.5</h4>
|
||||
<ul>
|
||||
<li>Translation fixes</li>
|
||||
|
19
components/partials/text-element.php
Normal file
19
components/partials/text-element.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
function kompass_print_textbox($settingName, $settingValue, $style = '') {
|
||||
echo '<input style="' . $style . '" type="text" name="' . $settingName . '" value="' . $settingValue. '" />';
|
||||
if (defined('WP_DEBUG') && WP_DEBUG == true) {
|
||||
echo '<br />' . $settingName;
|
||||
}
|
||||
}
|
||||
|
||||
function _kompass_limit_logins_settings_callback(array $args) {
|
||||
$setting = get_option($args['setting'], null);
|
||||
$style = isset($args['style']) ? $args['style'] : '';
|
||||
|
||||
$value = esc_attr($setting);
|
||||
if (isset($args['unit_division'])) {
|
||||
$value = (int)$value / (int)$args['unit_division'];
|
||||
}
|
||||
|
||||
kompass_print_textbox($args['setting'], $value, $style);
|
||||
}
|
@ -8,7 +8,7 @@ add_action('wp_login_failed', [$loginHandler, 'onFailedLogin']);
|
||||
add_filter('wp_authenticate_user', [$loginHandler, 'onSuccessFullLogin'], 99999, 2);
|
||||
add_filter( 'admin_enqueue_scripts', 'enqueue_custom_password_js',10 );
|
||||
|
||||
add_action('admin_init', 'admin_init');
|
||||
add_action('admin_init', 'kompass_admin_init');
|
||||
|
||||
if (get_option('kompass_cookies', false)) {
|
||||
$loginHandler->handleCookies();
|
||||
@ -21,3 +21,5 @@ if (isset($_POST['save_kompass_balist_list_type'])) {
|
||||
}
|
||||
|
||||
|
||||
|
||||
add_action('wp_head', 'kompass_seo_add_verfications');
|
@ -16,47 +16,40 @@ function bdp_update_dashboard_style() {
|
||||
|
||||
|
||||
function bdp_add_menu_security() {
|
||||
|
||||
$moduleLoad = get_admin_url() . 'admin.php?page=' . BDP_LV_PLUGIN_SLUG . '/modules/index.php&loadmodule=';
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
function bdp_add_menu_contents() {
|
||||
add_menu_page(
|
||||
'Beiträge',
|
||||
'Inhalte',
|
||||
'edit_posts',
|
||||
'edit.php',
|
||||
'',
|
||||
'dashicons-format-aside',
|
||||
4
|
||||
);
|
||||
add_menu_page('Seiten',
|
||||
'Inhalte',
|
||||
'edit_posts',
|
||||
'edit.php?post_type=page',
|
||||
'',
|
||||
'dashicons-format-aside',
|
||||
4
|
||||
);
|
||||
|
||||
add_submenu_page('edit.php',
|
||||
add_submenu_page('edit.php?post_type=page',
|
||||
'media',
|
||||
'Medienverwaltung',
|
||||
'edit_posts',
|
||||
'upload.php'
|
||||
);
|
||||
|
||||
add_submenu_page('edit.php',
|
||||
'media',
|
||||
'Statische Seiten',
|
||||
'edit_posts',
|
||||
'edit.php?post_type=page'
|
||||
);
|
||||
|
||||
add_submenu_page('edit.php',
|
||||
add_submenu_page('edit.php?post_type=page',
|
||||
'comments',
|
||||
'Kommentare',
|
||||
'edit_posts',
|
||||
'edit-comments.php'
|
||||
);
|
||||
|
||||
add_submenu_page('edit.php?post_type=page',
|
||||
'Beiträge',
|
||||
'Beiträge',
|
||||
'edit_posts',
|
||||
'edit.php'
|
||||
);
|
||||
|
||||
}
|
||||
|
||||
function bdp_add_menu_mein_lv() {
|
||||
@ -162,15 +155,13 @@ function bdp_cleanup_menu()
|
||||
bdp_add_menu_security();
|
||||
|
||||
|
||||
|
||||
remove_submenu_page('edit.php?post_type=page','post-new.php?post_type=page');
|
||||
remove_submenu_page('users.php','user-new.php');
|
||||
remove_submenu_page('users.php','profile.php');
|
||||
|
||||
remove_submenu_page('edit.php','post-new.php');
|
||||
remove_submenu_page('edit.php','edit-tags.php?taxonomy=category');
|
||||
remove_submenu_page('edit.php','edit-tags.php?taxonomy=post_tag');
|
||||
|
||||
|
||||
}
|
||||
|
||||
function bdp_create_menu_structure()
|
||||
|
@ -17,13 +17,14 @@ require_once BDP_LV_PLUGIN_DIR . 'includes/WpConfigEditor.class.php';
|
||||
require_once (BDP_LV_PLUGIN_DIR . '/includes/filters.php');
|
||||
require_once (BDP_LV_PLUGIN_DIR . '/lib/ics-parser/Event.php');
|
||||
require_once (BDP_LV_PLUGIN_DIR . '/lib/ics-parser/ICal.php');
|
||||
|
||||
require_once (BDP_LV_PLUGIN_DIR . '/modules/seo/seo.php');
|
||||
require_once (BDP_LV_PLUGIN_DIR . '/modules/calendar/calendar.php');
|
||||
require_once (BDP_LV_PLUGIN_DIR . '/includes/frontend-functions.php');
|
||||
|
||||
require_once (BDP_LV_PLUGIN_DIR . '/modules/security/security.php');
|
||||
|
||||
function admin_init()
|
||||
function kompass_admin_init()
|
||||
{
|
||||
kompass_settings_validators();
|
||||
}
|
||||
|
@ -19,7 +19,15 @@ spl_autoload_register(function ($className) {
|
||||
require_once $fileName;
|
||||
});
|
||||
|
||||
$modules = ['LimitLoginAttempts', 'PasswordStrength'];
|
||||
|
||||
$directoryPath = BDP_LV_PLUGIN_DIR . 'components/partials/';
|
||||
foreach (glob($directoryPath . '*.php') as $file) {
|
||||
require_once $file;
|
||||
}
|
||||
|
||||
|
||||
|
||||
$modules = ['KompassSettings', 'LimitLoginAttempts', 'PasswordStrength', 'seo'];
|
||||
$subdirs = ['includes', 'Controllers', 'Views'];
|
||||
|
||||
foreach ($modules as $curModule) {
|
||||
|
Binary file not shown.
Binary file not shown.
@ -1,3 +1,18 @@
|
||||
msgid "kompass"
|
||||
msgstr "kompass"
|
||||
|
||||
msgid "SEO-Options"
|
||||
msgstr "Suchmaschinen-Einstellungen"
|
||||
|
||||
msgid "Google Site verification"
|
||||
msgstr "Google Seiten-Verifikation"
|
||||
|
||||
msgid "Bing Site verification"
|
||||
msgstr "Bing Seiten-Verifikation"
|
||||
|
||||
msgid "Calendar Settings"
|
||||
msgstr "Kalender-Einstellungen"
|
||||
|
||||
msgid "Extended Security"
|
||||
msgstr "Erweiterte Sicherheit"
|
||||
|
||||
|
74
modules/KompassSettings/Controllers/SettingsPage.php
Normal file
74
modules/KompassSettings/Controllers/SettingsPage.php
Normal file
@ -0,0 +1,74 @@
|
||||
<?php
|
||||
|
||||
namespace Bdp\Modules\KompassSettings\Controllers;
|
||||
|
||||
|
||||
class SettingsPage
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
add_options_page(BDP_LV_PLUGIN_SLUG . '-kompass',
|
||||
__('kompass', BDP_LV_PLUGIN_SLUG) . ' - ' . __('Settings', BDP_LV_PLUGIN_SLUG),
|
||||
'manage_options',
|
||||
BDP_LV_PLUGIN_SLUG . '-Kompass-settings',
|
||||
[$this, 'option_page'],2048);
|
||||
}
|
||||
|
||||
|
||||
public function option_page() {
|
||||
bdp_kompass_load_plugin_textdomain();
|
||||
$showMessage = null;
|
||||
$tab = isset($_REQUEST['tab']) ? $_REQUEST['tab'] : 'tab1';
|
||||
if (isset($_REQUEST['update_options']) && $_REQUEST['update_options'] == true) {
|
||||
switch ($tab) {
|
||||
case 'tab1':
|
||||
break;
|
||||
|
||||
case 'tab2':
|
||||
update_option('kompass_seo_google_verification', $_POST['kompass_seo_google_verification']);
|
||||
update_option('kompass_seo_bing_verification', $_POST['kompass_seo_bing_verification']);
|
||||
$showMessage = __('The settings were saved.', BDP_LV_PLUGIN_SLUG);
|
||||
break;
|
||||
}
|
||||
|
||||
if (null !== $showMessage) {
|
||||
echo '<div class="notice notice-success" style="padding: 5px 10px;">';
|
||||
echo $showMessage;
|
||||
echo '</div>';
|
||||
}
|
||||
}
|
||||
|
||||
bdp_kompass_load_plugin_textdomain();
|
||||
|
||||
?>
|
||||
|
||||
<div class="wrap">
|
||||
<h1 class="wp-heading-inline">
|
||||
<?= __('kompass', BDP_LV_PLUGIN_SLUG); ?> - <?= __('Settings', BDP_LV_PLUGIN_SLUG); ?></h1>
|
||||
<hr class="wp-header-end">
|
||||
<?= kompass_settings_print_tab_header($tab); ?>
|
||||
|
||||
<div class="tab-content">
|
||||
<?php
|
||||
switch ($tab) {
|
||||
case 'tab1':
|
||||
echo '<form action="admin.php?page=bdp-kompass-Kompass-settings&tab=tab1" method="post">';
|
||||
do_settings_sections(BDP_LV_PLUGIN_SLUG . '-seo-settings');
|
||||
submit_button();
|
||||
echo '<input type="hidden" name="tab" value="tab4" />';
|
||||
echo '</form>';
|
||||
break;
|
||||
case 'tab2':
|
||||
echo '<form action="admin.php?page=bdp-kompass-Kompass-settings" method="post">';
|
||||
do_settings_sections(BDP_LV_PLUGIN_SLUG . '-seo-settings');
|
||||
submit_button();
|
||||
echo '<input type="hidden" name="tab" value="tab2" />';
|
||||
echo '</form>';
|
||||
break;
|
||||
}
|
||||
?>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
}
|
||||
}
|
13
modules/KompassSettings/Views/tab-control.php
Normal file
13
modules/KompassSettings/Views/tab-control.php
Normal file
@ -0,0 +1,13 @@
|
||||
<?php
|
||||
function kompass_settings_print_tab_header(string $activeTab = 'tab1')
|
||||
{
|
||||
$baseUrl = 'admin.php?page=bdp-kompass-Kompass-settings&tab=';
|
||||
return '<h2 class="nav-tab-wrapper">'.
|
||||
'<a href="' . $baseUrl . 'tab1" class="nav-tab ' . ($activeTab == 'tab1' ? 'nav-tab-active' : '') . '">' .
|
||||
__('Calendar Settings', BDP_LV_PLUGIN_SLUG) .
|
||||
'</a>'.
|
||||
'<a href="' . $baseUrl . 'tab2" class="nav-tab ' . ($activeTab == 'tab2' ? 'nav-tab-active' : '') .'">' .
|
||||
__('SEO', BDP_LV_PLUGIN_SLUG) .
|
||||
'</a>'.
|
||||
'</h2>';
|
||||
}
|
@ -1,7 +0,0 @@
|
||||
<?php
|
||||
function kompass_print_textbox($settingName, $settingValue) {
|
||||
echo '<input type="text" name="' . $settingName . '" value="' . $settingValue. '" />';
|
||||
if (defined('WP_DEBUG') && WP_DEBUG == true) {
|
||||
echo '<br />' . $settingName;
|
||||
}
|
||||
}
|
@ -4,19 +4,7 @@ function custom_settings_section_callback() {
|
||||
echo '<input type="hidden" name="update_options" value="true" />';
|
||||
}
|
||||
|
||||
function _kompass_limit_logins_settings_callback(array $args) {
|
||||
$setting = get_option($args['setting'], null);
|
||||
if (null === $setting) {
|
||||
return;
|
||||
}
|
||||
|
||||
$value = esc_attr($setting);
|
||||
if (isset($args['unit_division'])) {
|
||||
$value = (int)$value / (int)$args['unit_division'];
|
||||
}
|
||||
|
||||
kompass_print_textbox($args['setting'], $value);
|
||||
}
|
||||
|
||||
function _kompass_limit_logins_settings_radio_callback(array $args)
|
||||
{
|
||||
@ -35,6 +23,10 @@ add_settings_section(
|
||||
BDP_LV_PLUGIN_SLUG . '-limit-login-attempts'
|
||||
);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
$settings_page = BDP_LV_PLUGIN_SLUG . '-limit-login-attempts';
|
||||
|
||||
|
||||
@ -45,7 +37,7 @@ add_settings_field(
|
||||
'_kompass_limit_logins_settings_callback',
|
||||
$settings_page,
|
||||
'custom_settings_section',
|
||||
['setting' => 'kompass_limit_login_allowed_retries']);
|
||||
['setting' => 'kompass_seo_google_verification']);
|
||||
|
||||
add_settings_field(
|
||||
'kompass_lla_2',
|
||||
@ -110,3 +102,4 @@ add_settings_field(
|
||||
$settings_page,
|
||||
'custom_settings_section',
|
||||
['setting' => 'kompass_limit_login_notify_email_after']);
|
||||
|
||||
|
28
modules/seo/Views/seo-form.php
Normal file
28
modules/seo/Views/seo-form.php
Normal file
@ -0,0 +1,28 @@
|
||||
<?php
|
||||
|
||||
|
||||
add_settings_section(
|
||||
'custom_settings_section',
|
||||
__('SEO-Options', BDP_LV_PLUGIN_SLUG),
|
||||
'custom_settings_section_callback',
|
||||
BDP_LV_PLUGIN_SLUG . '-seo-settings'
|
||||
);
|
||||
|
||||
$seo_settings_page = BDP_LV_PLUGIN_SLUG . '-seo-settings';
|
||||
|
||||
add_settings_field(
|
||||
'kompass_seo_1',
|
||||
__('Google Site verification', BDP_LV_PLUGIN_SLUG),
|
||||
'_kompass_limit_logins_settings_callback',
|
||||
$seo_settings_page,
|
||||
'custom_settings_section',
|
||||
['setting' => 'kompass_seo_google_verification', 'style' => 'width: 500px']);
|
||||
|
||||
|
||||
add_settings_field(
|
||||
'kompass_seo_2',
|
||||
__('Bing Site verification', BDP_LV_PLUGIN_SLUG),
|
||||
'_kompass_limit_logins_settings_callback',
|
||||
$seo_settings_page,
|
||||
'custom_settings_section',
|
||||
['setting' => 'kompass_seo_bing_verification', 'style' => 'width: 500px']);
|
@ -3,8 +3,34 @@
|
||||
namespace Bdp\Modules\Seo;
|
||||
class Seo
|
||||
{
|
||||
public static function importVerificationKeys() {
|
||||
$aioseoSetting = get_option('aioseo_options', null);
|
||||
if (null === $aioseoSetting) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ('' !== $aioseoSetting && !is_object($aioseoSetting) && !is_array($aioseoSetting)){
|
||||
$aioseoSetting = json_decode( $aioseoSetting );
|
||||
}
|
||||
|
||||
if (!is_object($aioseoSetting) ||!isset($aioseoSetting->webmasterTools) ||!is_object($aioseoSetting->webmasterTools)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
$webmasterTools = $aioseoSetting->webmasterTools;
|
||||
if ('' !== get_option('kompass_seo_google_verification', '')) {
|
||||
update_option('kompass_seo_google_verification', $webmasterTools->google);
|
||||
}
|
||||
|
||||
if ('' !== get_option('kompass_seo_bing_verification', '')) {
|
||||
update_option('kompass_seo_bing_verification', $webmasterTools->bing);
|
||||
}
|
||||
}
|
||||
|
||||
public static function setup()
|
||||
{
|
||||
|
||||
if (get_option('permalink_structure') === '') {
|
||||
update_option('permalink_structure', '/%postname%/');
|
||||
flush_rewrite_rules();
|
||||
|
12
modules/seo/includes/meta.php
Normal file
12
modules/seo/includes/meta.php
Normal file
@ -0,0 +1,12 @@
|
||||
<?php
|
||||
function kompass_seo_add_verfications() {
|
||||
$googleVerification = get_option('kompass_seo_google_verification', '');
|
||||
if ('' !== $googleVerification) {
|
||||
echo '<meta name="google-site-verification" content="' . $googleVerification . '" />' . "\n";
|
||||
}
|
||||
|
||||
$bingVerification = get_option('kompass_seo_bing_verification', '');
|
||||
if ('' !== $bingVerification) {
|
||||
echo '<meta name="msvalidate.01="' . $bingVerification . '" />' . "\n";
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user