Skip to content

Commit d65c56b

Browse files
author
Praesidiarius
committed
new release candidate
1 parent c28f1a4 commit d65c56b

File tree

15 files changed

+311
-54
lines changed

15 files changed

+311
-54
lines changed

wpplc-swissknife/assets/css/plc-admin-style.css

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,52 @@
1-
/* Admin Meni List Item Container */
2-
.plc-admin-menu-list-item {
1+
/* Admin Panel Main Frame */
2+
div.plc-admin {
3+
margin: 0 0 -65px -20px;
4+
}
5+
6+
/* Admin Panel Settings Wrapper */
7+
div.plc-settings-wrapper {
8+
margin:0; padding:0; display: block !important;
9+
}
10+
11+
/* Admin Panel Settings Header */
12+
div.plc-settings-header {
13+
padding: 20px 50px 80px; background:#13b4df;
14+
}
15+
16+
/* Admin Panel Settings Header Content */
17+
div.plc-settings-header-main {
18+
padding-top:12px; position: relative; display: flex; justify-content: space-between;
19+
}
20+
21+
/* Admin Panel Settings Header Title */
22+
div.plc-settings-header-main-title {
23+
height: 52px;line-height: 52px;font-size: 17px;color:#fff;margin: 0;
24+
}
25+
26+
/* Admin Panel Main Content Section */
27+
main.plc-admin-main {
28+
position: relative;background:#fff;border-radius: 5px;margin: -60px 50px 0;box-shadow: 0 3px 6px rgba(0,0,0,.11);min-height: 600px;
29+
}
30+
31+
/* Admin Panel Header Menu Container */
32+
div.plc-admin-menu-container {
33+
width:100%; padding-left:40px; display: inline-block; float:left; border-bottom:1px solid lightgray;
34+
}
35+
36+
/* Admin Menu List */
37+
ul.plc-admin-menu-list {
38+
margin: 20px 0; list-style-type: none; padding: 0;
39+
}
40+
41+
/* Admin Menu List Item Container */
42+
li.plc-admin-menu-list-item {
343
margin: 0 30px 0 0;
444
position: relative;
545
float: left;
646
}
747

848
/* Admin Menu List Item (Navi) */
9-
.plc-admin-menu-list-item a {
49+
li.plc-admin-menu-list-item a {
1050
display: block;
1151
position: relative;
1252
color: #80a5bb;

wpplc-swissknife/includes/Modules/Revisions.php

Lines changed: 29 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,22 +23,45 @@ final class Revisions {
2323
private static $instance = null;
2424

2525
/**
26-
* Enable Google Sitekit IP Anonymization
26+
* Enable Revisions Management
2727
*
2828
* @since 0.1-stable
2929
*/
3030
public function register() {
31-
// change autosave interval from 60 to 300 seconds
32-
if(defined('AUTOSAVE_INTERVAL')) {
33-
define('AUTOSAVE_INTERVAL', 300);
31+
$bDisableAutosave = get_option('wpplc_swissknife_disable_autosave');
32+
33+
// disable autosave
34+
if($bDisableAutosave == true) {
35+
add_action( 'admin_init', [ $this, 'disableAutosave' ] );
36+
} else {
37+
// change autosave interval from 60 to x seconds
38+
if(defined('AUTOSAVE_INTERVAL')) {
39+
$iNewInterval = (get_option('wpplc_swissknife_autosave_interval')) ? (int)get_option('wpplc_swissknife_autosave_interval') : 300;
40+
define('AUTOSAVE_INTERVAL', $iNewInterval);
41+
}
3442
}
3543

36-
// disable post revision
44+
// disable or limit post revision
3745
if(defined('WP_POST_REVISIONS')) {
38-
define('WP_POST_REVISIONS', false);
46+
$bDisableRevisions = get_option('wpplc_swissknife_disable_revisions');
47+
if($bDisableRevisions == true) {
48+
define('WP_POST_REVISIONS', false);
49+
} else {
50+
$iNewRevisionLimit = (get_option('wpplc_swissknife_limit_revisions')) ? (int)get_option('wpplc_swissknife_limit_revisions') : 3;
51+
define('WP_POST_REVISIONS', $iNewRevisionLimit);
52+
}
3953
}
4054
}
4155

56+
/**
57+
* Disable Autosave completly
58+
*
59+
* @since 0.3.4
60+
*/
61+
public function disableAutosave() {
62+
wp_deregister_script( 'autosave' );
63+
}
64+
4265
/**
4366
* Loads the module main instance and initializes it.
4467
*

wpplc-swissknife/includes/Modules/Settings.php

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,18 @@ public function register() {
3636

3737
// Register Settings
3838
add_action( 'admin_init', [ $this, 'registerSettings' ] );
39+
40+
// Add Plugin Languages
41+
add_action('plugins_loaded', [ $this, 'loadTextDomain' ] );
42+
}
43+
44+
/**
45+
* load text domain (translations)
46+
*
47+
* @since 0.3.4
48+
*/
49+
public function loadTextDomain() {
50+
load_plugin_textdomain( 'wpplc-swissknife', false, dirname( plugin_basename(WPPLC_SWISSKNIFE_MAIN_FILE) ) . '/language/' );
3951
}
4052

4153
/**

wpplc-swissknife/includes/Modules/Tweaks.php

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -29,38 +29,56 @@ final class Tweaks {
2929
*/
3030
public function register() {
3131
// Disable wordpress emojis
32-
add_action( 'init', [ $this, 'disableEmojis' ] );
32+
if(get_option( 'wpplc_swissknife_disable_emojis') == true) {
33+
add_action('init', [$this, 'disableEmojis']);
34+
}
3335

3436
// Disable XML-RPC
35-
add_filter('xmlrpc_enabled', '__return_false');
37+
if(get_option( 'wpplc_swissknife_disable_xmlrpc') == true) {
38+
add_filter('xmlrpc_enabled', '__return_false');
39+
}
3640

3741
// Disable wordpress embeds
38-
add_action( 'init', [ $this, 'disableEmbeds' ], 9999 );
42+
if(get_option( 'wpplc_swissknife_disable_embeds') == true) {
43+
add_action('init', [$this, 'disableEmbeds'], 9999);
44+
}
3945

4046
// Disable Self Pingbacks
41-
add_action( 'pre_ping', [ $this, 'disableSelfPingbacks' ] );
47+
if(get_option( 'wpplc_swissknife_disable_self_pingback') == true) {
48+
add_action('pre_ping', [$this, 'disableSelfPingbacks']);
49+
}
4250

4351
// Remove Query String from Static resources
44-
add_filter( 'style_loader_src', [ $this , 'removeCssJsVersion' ], 10, 2 );
45-
add_filter( 'script_loader_src', [ $this , 'removeCssJsVersion' ], 10, 2 );
52+
if(get_option( 'wpplc_swissknife_remove_qry_static') == true) {
53+
add_filter('style_loader_src', [$this, 'removeCssJsVersion'], 10, 2);
54+
add_filter('script_loader_src', [$this, 'removeCssJsVersion'], 10, 2);
55+
}
4656

4757
// Remove jQuery Migrate
48-
add_action( 'wp_default_scripts', [ $this, 'removeJqueryMigrate' ] );
58+
if(get_option( 'wpplc_swissknife_remove_jquery_migrate') == true) {
59+
add_action('wp_default_scripts', [$this, 'removeJqueryMigrate']);
60+
}
4961

5062
// Remove Shortlink
51-
add_filter('after_setup_theme', [ $this, 'removeShortlink' ]);
63+
if(get_option( 'wpplc_swissknife_remove_shortlink') == true) {
64+
add_filter('after_setup_theme', [$this, 'removeShortlink']);
65+
}
5266

5367
// Disable RSS Feed
54-
add_action('do_feed', [ $this, 'disableRSSFeed' ], 1);
55-
add_action('do_feed_rdf', [ $this, 'disableRSSFeed' ], 1);
56-
add_action('do_feed_rss', [ $this, 'disableRSSFeed' ], 1);
57-
add_action('do_feed_rss2', [ $this, 'disableRSSFeed' ], 1);
58-
add_action('do_feed_atom', [ $this, 'disableRSSFeed' ], 1);
59-
add_action('do_feed_rss2_comments', [ $this, 'disableRSSFeed' ], 1);
60-
add_action('do_feed_atom_comments', [ $this, 'disableRSSFeed' ], 1);
68+
if(get_option( 'wpplc_swissknife_disable_rssfeeds') == true) {
69+
add_action('do_feed', [$this, 'disableRSSFeed'], 1);
70+
add_action('do_feed_rdf', [$this, 'disableRSSFeed'], 1);
71+
add_action('do_feed_rss', [$this, 'disableRSSFeed'], 1);
72+
add_action('do_feed_rss2', [$this, 'disableRSSFeed'], 1);
73+
add_action('do_feed_atom', [$this, 'disableRSSFeed'], 1);
74+
add_action('do_feed_rss2_comments', [$this, 'disableRSSFeed'], 1);
75+
add_action('do_feed_atom_comments', [$this, 'disableRSSFeed'], 1);
76+
}
6177

6278
// Disable Rest API
63-
add_filter( 'rest_authentication_errors', [ $this, 'disableRestAPI' ] );
79+
if(get_option( 'wpplc_swissknife_disable_restapi') == true) {
80+
add_filter('rest_authentication_errors', [$this, 'disableRestAPI']);
81+
}
6482
}
6583

6684
/**
@@ -71,7 +89,7 @@ public function register() {
7189
*/
7290
public function disableRestAPI($access) {
7391
if( ! is_user_logged_in() ) {
74-
return new WP_Error( 'rest_cannot_access', __( 'Only authenticated users can access the REST API.', 'disable-json-api' ), [ 'status' => rest_authorization_required_code() ] );
92+
return new \WP_Error( 'rest_cannot_access', __( 'Only authenticated users can access the REST API.', 'disable-json-api' ), [ 'status' => rest_authorization_required_code() ] );
7593
}
7694
return $access;
7795
}

wpplc-swissknife/includes/ajax/setting_update.php

Lines changed: 92 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,102 @@
1414
/**
1515
* Save Settings based on key
1616
*/
17+
// Default is boolean
18+
$bSettingsVal = ($sVal == 1) ? true : false;
1719
switch($sName) {
20+
// disable rest-api (boolean)
21+
case 'wpplc_swissknife_disable_restapi':
22+
// Update Option
23+
update_option('wpplc_swissknife_disable_restapi',$bSettingsVal);
24+
25+
// Show Message
26+
$sMessage = 'Rest-API successfully ';
27+
$sMessage .= ($bSettingsVal) ? ' <b>disabled</b>' : ' <b>enabled</b>';
28+
$sClass = 'success';
29+
break;
30+
// disable rss feeds (boolean)
31+
case 'wpplc_swissknife_disable_rssfeeds':
32+
// Update Option
33+
update_option('wpplc_swissknife_disable_rssfeeds',$bSettingsVal);
34+
35+
// Show Message
36+
$sMessage = 'RSS Feeds successfully ';
37+
$sMessage .= ($bSettingsVal) ? ' <b>disabled</b>' : ' <b>enabled</b>';
38+
$sClass = 'success';
39+
break;
40+
// remove jquery shortlink (boolean)
41+
case 'wpplc_swissknife_remove_shortlink':
42+
// Update Option
43+
update_option('wpplc_swissknife_remove_shortlink',$bSettingsVal);
44+
45+
// Show Message
46+
$sMessage = 'Shortlink successfully ';
47+
$sMessage .= ($bSettingsVal) ? ' <b>removed</b>' : ' <b>added</b>';
48+
$sClass = 'success';
49+
break;
50+
// remove jquery migrate (boolean)
51+
case 'wpplc_swissknife_remove_jquery_migrate':
52+
// Update Option
53+
update_option('wpplc_swissknife_remove_jquery_migrate',$bSettingsVal);
54+
55+
// Show Message
56+
$sMessage = 'jQuery migrate successfully ';
57+
$sMessage .= ($bSettingsVal) ? ' <b>removed</b>' : ' <b>added</b>';
58+
$sClass = 'success';
59+
break;
60+
// disable querystring for static files (boolean)
61+
case 'wpplc_swissknife_remove_qry_static':
62+
// Update Option
63+
update_option('wpplc_swissknife_remove_qry_static',$bSettingsVal);
64+
65+
// Show Message
66+
$sMessage = 'Querystring for static files successfully ';
67+
$sMessage .= ($bSettingsVal) ? ' <b>removed</b>' : ' <b>added</b>';
68+
$sClass = 'success';
69+
break;
70+
// disable self-pingback (boolean)
71+
case 'wpplc_swissknife_disable_self_pingback':
72+
// Update Option
73+
update_option('wpplc_swissknife_disable_self_pingback',$bSettingsVal);
74+
75+
// Show Message
76+
$sMessage = 'Self-Pingback successfully ';
77+
$sMessage .= ($bSettingsVal) ? ' <b>disabled</b>' : ' <b>enabled</b>';
78+
$sClass = 'success';
79+
break;
80+
// disable embeds (boolean)
81+
case 'wpplc_swissknife_disable_embeds':
82+
// Update Option
83+
update_option('wpplc_swissknife_disable_embeds',$bSettingsVal);
84+
85+
// Show Message
86+
$sMessage = 'Embeds successfully ';
87+
$sMessage .= ($bSettingsVal) ? ' <b>disabled</b>' : ' <b>enabled</b>';
88+
$sClass = 'success';
89+
break;
90+
// disable xmlrpc (boolean)
91+
case 'wpplc_swissknife_disable_xmlrpc':
92+
// Update Option
93+
update_option('wpplc_swissknife_disable_xmlrpc',$bSettingsVal);
94+
95+
// Show Message
96+
$sMessage = 'XML-RPC successfully ';
97+
$sMessage .= ($bSettingsVal) ? ' <b>disabled</b>' : ' <b>enabled</b>';
98+
$sClass = 'success';
99+
break;
100+
// disable emojis options (boolean)
101+
case 'wpplc_swissknife_disable_emojis':
102+
// Update Option
103+
update_option('wpplc_swissknife_disable_emojis',$bSettingsVal);
104+
105+
// Show Message
106+
$sMessage = 'Emojis successfully ';
107+
$sMessage .= ($bSettingsVal) ? ' <b>disabled</b>' : ' <b>enabled</b>';
108+
$sClass = 'success';
109+
break;
18110
// disable comments options (boolean)
19111
case 'wpplc_swissknife_disable_comments':
20112
// Update Option
21-
$bSettingsVal = ($sVal == 1) ? true : false;
22113
update_option('wpplc_swissknife_disable_comments',$bSettingsVal);
23114

24115
// Show Message
@@ -29,16 +120,13 @@
29120
// google sitekit ip anonymization
30121
case 'wpplc_swissknife_enable_sitekit_ip_anonymization':
31122
// Update Option
32-
$bSettingsVal = ($sVal == 1) ? true : false;
33123
update_option('wpplc_swissknife_enable_sitekit_ip_anonymization',$bSettingsVal);
34124

35125
// Show Message
36126
$sMessage = 'Sitekit IP Anonimization is now ';
37127
$sMessage .= ($bSettingsVal) ? ' <b>active</b>' : ' <b>inactive</b>';
38128
$sClass = 'success';
39129
break;
40-
41-
42130
default:
43131
break;
44132
}

wpplc-swissknife/includes/templates/partials/commentsettings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<article class="plc-admin-page-commentsettings plc-admin-page" style="padding: 10px 40px 40px 40px;">
2-
<h1>Comment Preferences</h1>
2+
<h1><?=__('Comment Preferences','wpplc-swissknife')?></h1>
33
<p>Here you can change the comment settings of swissknife plugin</p>
44
<!-- Rectangular switch -->
55
<label class="plc-settings-switch">

wpplc-swissknife/includes/templates/partials/gdprsettings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<article class="plc-admin-page-gdprsettings plc-admin-page" style="padding: 10px 40px 40px 40px">
2-
<h1>GDPR Preferences</h1>
2+
<h1><?=__('GDPR Preferences','wpplc-swissknife')?></h1>
33
<p>Here you can change the basic settings of swissknife plugin</p>
44

55
<?php

wpplc-swissknife/includes/templates/partials/revisionsettings.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<article class="plc-admin-page-revisionsettings plc-admin-page" style="padding: 10px 40px 40px 40px;">
2-
<h1>Revision Preferences</h1>
2+
<h1><?=__('Revision Preferences','wpplc-swissknife')?></h1>
33
<p>Here you can change the revision settings of swissknife plugin</p>
44

55
<!-- Disable Revisions Toggle -->

wpplc-swissknife/includes/templates/partials/tweaks.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<article class="plc-admin-page-tweaks plc-admin-page" style="padding: 10px 40px 40px 40px;">
2-
<h1>More Tweaks</h1>
2+
<h1><?=__('More Tweaks','wpplc-swissknife')?></h1>
33
<p>Here you have some more performance and security tweaks of swissknife plugin</p>
44

55
<!-- Disable Emojis Toggle -->

0 commit comments

Comments
 (0)